├── Resource.rc ├── resource.h ├── BuildVer.h ├── figures ├── bml.png └── HelloWorld.png ├── Util.h ├── Export.h ├── virtools ├── CKBaseManager.cpp ├── CKBaseManager.h ├── CKStateObject.cpp ├── CKStateObject.h ├── CKSceneObject.h ├── CKSceneObject.cpp ├── CKSprite3D.h ├── CK2dCurve.h ├── CKGroup.h ├── CKSpriteText.h ├── CKParameterOperation.h ├── CKParameterIn.h ├── CKObject.h ├── CKSprite3D.cpp ├── CKMessage.h ├── CKBehaviorIO.h ├── CKGroup.cpp ├── CKBehaviorManager.cpp ├── CK2dCurvePoint.h ├── CKObjectDeclaration.h ├── CKCamera.h ├── CKSoundManager.h ├── CKParameterOperation.cpp ├── CKSpriteText.cpp ├── CK2dCurve.cpp ├── CKRenderObject.h ├── CKSoundManager.cpp ├── CKTexture.h ├── CKObject.cpp ├── CKMessageManager.h ├── CKLight.h ├── CKCamera.cpp ├── CKDef.h ├── CKMessage.cpp ├── CKRenderObject.cpp ├── CKPathManager.h ├── CKBeObject.h ├── CKLevel.h ├── CKBehaviorManager.h ├── CKAll.h ├── CKBehaviorIO.cpp ├── CKBehaviorPrototype.h ├── CKInputManager.h ├── CKObjectArray.h ├── CKTexture.cpp ├── CKMessageManager.cpp ├── VxSphere.h ├── CK2dEntity.h ├── CKParameterIn.cpp ├── CKObjectDeclaration.cpp ├── VxQuaternion.cpp ├── CK2dCurvePoint.cpp ├── CKLight.cpp ├── CKPathManager.cpp ├── CKParameter.cpp ├── CKTimeManager.h ├── CKLevel.cpp ├── CKAttributeManager.h ├── CKBeObject.cpp ├── CKTimeManager.cpp ├── CKCollisionManager.h ├── CKBehaviorPrototype.cpp ├── CKDataArray.h ├── CKScene.h ├── CKPluginManager.cpp ├── CKCollisionManager.cpp ├── CKInputManager.cpp ├── XString.cpp ├── CKParameter.h ├── VxRay.h ├── VxMatrix.cpp ├── CKBitmapData.h ├── CK2dEntity.cpp ├── CKSprite.h ├── CKScene.cpp ├── CKSound.h ├── CKParameterManager.h ├── CKObjectArray.cpp ├── CKAttributeManager.cpp ├── CKBitmapData.cpp ├── XHashFun.h └── VxMath.h ├── cpy_debug.py ├── ILogger.h ├── Version.h ├── BMLAll.h ├── Logger.h ├── IMod.cpp ├── inc_ver.py ├── Timer.h ├── ICommand.h ├── LICENSE ├── Logger.cpp ├── IConfig.h ├── Timer.cpp ├── minhook ├── hde │ ├── pstdint.h │ ├── hde32.h │ └── table32.h ├── buffer.h ├── trampoline.h └── LICENSE.txt ├── BML_Release.py ├── BML.sln ├── README.md ├── dllmain.cpp ├── IMod.h ├── .gitattributes ├── Config.h ├── NewBallTypeMod.h └── ScriptHelper.h /Resource.rc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Gamepiaynmo/BallanceModLoader/HEAD/Resource.rc -------------------------------------------------------------------------------- /resource.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Gamepiaynmo/BallanceModLoader/HEAD/resource.h -------------------------------------------------------------------------------- /BuildVer.h: -------------------------------------------------------------------------------- 1 | #define BML_MAJOR_VER 0 2 | #define BML_MINOR_VER 3 3 | #define BML_BUILD_VER 43 4 | -------------------------------------------------------------------------------- /figures/bml.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Gamepiaynmo/BallanceModLoader/HEAD/figures/bml.png -------------------------------------------------------------------------------- /Util.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | 5 | std::string Text2Pinyin(const std::string& text); -------------------------------------------------------------------------------- /figures/HelloWorld.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Gamepiaynmo/BallanceModLoader/HEAD/figures/HelloWorld.png -------------------------------------------------------------------------------- /Export.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #ifndef BML_EXPORT 4 | #ifdef BML_EXPORTS 5 | #define BML_EXPORT __declspec(dllexport) 6 | #else 7 | #define BML_EXPORT __declspec(dllimport) 8 | #endif 9 | #endif 10 | -------------------------------------------------------------------------------- /virtools/CKBaseManager.cpp: -------------------------------------------------------------------------------- 1 | #include "CKBaseManager.h" 2 | 3 | NAKED CKGUID CKBaseManager::GetGuid() { 4 | JUMP(0x2403AB25); 5 | } 6 | 7 | NAKED CKSTRING CKBaseManager::GetName() { 8 | JUMP(0x2403AB37); 9 | } -------------------------------------------------------------------------------- /cpy_debug.py: -------------------------------------------------------------------------------- 1 | import os 2 | import shutil 3 | 4 | shutil.copy('D:\\Program Files (x86)\\Ballance\\BuildingBlocks\\BML.dll', 'Debug') 5 | shutil.copy('D:\\Program Files (x86)\\Ballance\\BuildingBlocks\\BML.lib', 'Debug') 6 | -------------------------------------------------------------------------------- /virtools/CKBaseManager.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "CKDef.h" 4 | 5 | class BML_EXPORT CKBaseManager { 6 | public: 7 | CKGUID GetGuid(); 8 | CKSTRING GetName(); 9 | 10 | protected: 11 | CKBaseManager() {}; 12 | ~CKBaseManager() {}; 13 | }; -------------------------------------------------------------------------------- /ILogger.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "Export.h" 4 | 5 | class BML_EXPORT ILogger { 6 | public: 7 | virtual void Info(const char* fmt, ...) = 0; 8 | virtual void Warn(const char* fmt, ...) = 0; 9 | virtual void Error(const char* fmt, ...) = 0; 10 | }; -------------------------------------------------------------------------------- /virtools/CKStateObject.cpp: -------------------------------------------------------------------------------- 1 | #include "CKStateObject.h" 2 | 3 | NAKED CKBOOL CKStateObject::IsStateActive() { 4 | JUMP(0x2400CEFF); 5 | } 6 | 7 | NAKED void CKStateObject::EnterState() { 8 | JUMP(0x240263C9); 9 | } 10 | 11 | NAKED void CKStateObject::LeaveState() { 12 | JUMP(0x240263D1); 13 | } 14 | -------------------------------------------------------------------------------- /virtools/CKStateObject.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "CKDef.h" 4 | #include "CKObject.h" 5 | 6 | class BML_EXPORT CKStateObject : public CKObject { 7 | public: 8 | CKBOOL IsStateActive(); 9 | void EnterState(); 10 | void LeaveState(); 11 | 12 | protected: 13 | CKStateObject() {}; 14 | ~CKStateObject() {}; 15 | }; -------------------------------------------------------------------------------- /Version.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "BuildVer.h" 4 | #define TOSTRING2(arg) #arg 5 | #define TOSTRING(arg) TOSTRING2(arg) 6 | #define BML_VERSION TOSTRING(BML_MAJOR_VER) "." TOSTRING(BML_MINOR_VER) "." TOSTRING(BML_BUILD_VER) 7 | #define BML_RC_VERSION TOSTRING(BML_MAJOR_VER) "." TOSTRING(BML_MINOR_VER) ".0." TOSTRING(BML_BUILD_VER) 8 | -------------------------------------------------------------------------------- /BMLAll.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "Export.h" 4 | #include "Version.h" 5 | 6 | #include "virtools/CKAll.h" 7 | 8 | #include "IBML.h" 9 | #include "ILogger.h" 10 | #include "ICommand.h" 11 | #include "IConfig.h" 12 | #include "IMod.h" 13 | 14 | #include "Gui.h" 15 | #include "ExecuteBB.h" 16 | #include "RegisterBB.h" 17 | #include "ScriptHelper.h" 18 | 19 | #ifdef BML_EXPORTS 20 | #include "ModLoader.h" 21 | #endif -------------------------------------------------------------------------------- /virtools/CKSceneObject.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "CKDef.h" 4 | #include "CKObject.h" 5 | 6 | class BML_EXPORT CKSceneObject : public CKObject { 7 | public: 8 | CKBOOL IsActiveInScene(CKScene* scene); 9 | CKBOOL IsActiveInCurrentScene(); 10 | CKBOOL IsInScene(CKScene* scene); 11 | int GetSceneInCount(); 12 | CKScene* GetSceneIn(int index); 13 | 14 | protected: 15 | CKSceneObject() {}; 16 | ~CKSceneObject() {}; 17 | }; -------------------------------------------------------------------------------- /Logger.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "ILogger.h" 4 | #include 5 | 6 | class BML_EXPORT Logger : public ILogger { 7 | friend class ModLoader; 8 | public: 9 | Logger(const char* modname); 10 | 11 | virtual void Info(const char* fmt, ...) override; 12 | virtual void Warn(const char* fmt, ...) override; 13 | virtual void Error(const char* fmt, ...) override; 14 | 15 | private: 16 | void Log(const char* level, const char* fmt, va_list args); 17 | 18 | const char* m_modname; 19 | }; 20 | 21 | -------------------------------------------------------------------------------- /virtools/CKSceneObject.cpp: -------------------------------------------------------------------------------- 1 | #include "CKSceneObject.h" 2 | 3 | NAKED CKBOOL CKSceneObject::IsActiveInScene(CKScene* scene) { 4 | JUMP(0x24021660); 5 | } 6 | 7 | NAKED CKBOOL CKSceneObject::IsActiveInCurrentScene() { 8 | JUMP(0x2402166D); 9 | } 10 | 11 | NAKED CKBOOL CKSceneObject::IsInScene(CKScene* scene) { 12 | JUMP(0x24021688); 13 | } 14 | 15 | NAKED int CKSceneObject::GetSceneInCount() { 16 | JUMP(0x240216B2); 17 | } 18 | 19 | NAKED CKScene* CKSceneObject::GetSceneIn(int index) { 20 | JUMP(0x240216BA); 21 | } 22 | -------------------------------------------------------------------------------- /IMod.cpp: -------------------------------------------------------------------------------- 1 | #include "IMod.h" 2 | #include "Logger.h" 3 | #include "Config.h" 4 | #include "ModLoader.h" 5 | 6 | ILogger* IMod::GetLogger() { 7 | if (m_logger == nullptr) 8 | m_logger = new Logger(GetID()); 9 | return m_logger; 10 | } 11 | 12 | IConfig* IMod::GetConfig() { 13 | if (m_config == nullptr) { 14 | Config* config = new Config(this); 15 | m_config = config; 16 | ModLoader::m_instance->AddConfig(config); 17 | } 18 | return m_config; 19 | } 20 | 21 | IMod::~IMod() { 22 | if (m_logger) delete m_logger; 23 | if (m_config) delete m_config; 24 | } -------------------------------------------------------------------------------- /inc_ver.py: -------------------------------------------------------------------------------- 1 | import sys 2 | 3 | version = [0, 0, 0] 4 | 5 | with open('BuildVer.h', 'r') as fin: 6 | for i in range(3): 7 | version[i] = int(fin.readline().split(' ')[-1]) 8 | 9 | if sys.argv[1] == '-m': 10 | version[0] += 1 11 | if sys.argv[1] == '-n': 12 | version[1] += 1 13 | if sys.argv[1] == '-b': 14 | version[2] += 1 15 | 16 | with open('BuildVer.h', 'w') as fout: 17 | fout.write('#define BML_MAJOR_VER ' + str(version[0]) + '\n') 18 | fout.write('#define BML_MINOR_VER ' + str(version[1]) + '\n') 19 | fout.write('#define BML_BUILD_VER ' + str(version[2]) + '\n') -------------------------------------------------------------------------------- /virtools/CKSprite3D.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "CKDef.h" 4 | #include "CK3dEntity.h" 5 | 6 | class BML_EXPORT CKSprite3D : public CK3dEntity { 7 | public: 8 | void SetMaterial(CKMaterial* Mat); 9 | CKMaterial* GetMaterial(); 10 | void SetSize(Vx2DVector& vect); 11 | void GetSize(Vx2DVector& vect); 12 | void SetOffset(Vx2DVector& vect); 13 | void GetOffset(Vx2DVector& vect); 14 | void SetUVMapping(VxRect& rect); 15 | void GetUVMapping(VxRect& rect); 16 | void SetMode(VXSPRITE3D_TYPE Mode); 17 | VXSPRITE3D_TYPE GetMode(); 18 | 19 | protected: 20 | CKSprite3D() {}; 21 | ~CKSprite3D() {}; 22 | }; -------------------------------------------------------------------------------- /virtools/CK2dCurve.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "CKDef.h" 4 | #include "CKObject.h" 5 | #include "CK2dCurvePoint.h" 6 | 7 | class BML_EXPORT CK2dCurve { 8 | public: 9 | float GetLength(); 10 | CKERROR GetPos(float step, Vx2DVector* pos); 11 | float GetY(float X); 12 | void DeleteControlPoint(CK2dCurvePoint* cpt); 13 | void AddControlPoint(const Vx2DVector& pos); 14 | int GetControlPointCount(); 15 | CK2dCurvePoint* GetControlPoint(int pos); 16 | void Update(); 17 | CKStateChunk* Dump(); 18 | CKERROR Read(CKStateChunk* chunk); 19 | void UpdatePointsAndTangents(); 20 | int Rindex(int index); 21 | 22 | protected: 23 | CK2dCurve() {}; 24 | ~CK2dCurve() {}; 25 | 26 | }; 27 | -------------------------------------------------------------------------------- /virtools/CKGroup.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "CKDef.h" 4 | #include "CKBeObject.h" 5 | 6 | #undef GetObject 7 | 8 | class BML_EXPORT CKGroup : public CKBeObject { 9 | public: 10 | CKERROR AddObject(CKBeObject* o); 11 | CKERROR AddObjectFront(CKBeObject* o); 12 | CKERROR InsertObjectAt(CKBeObject* o, int pos); 13 | 14 | CKBeObject* RemoveObject(int pos); 15 | void RemoveObject(CKBeObject* obj); 16 | void Clear(); 17 | 18 | void MoveObjectUp(CKBeObject* o); 19 | void MoveObjectDown(CKBeObject* o); 20 | 21 | CKBeObject* GetObject(int pos); 22 | int GetObjectCount(); 23 | 24 | CK_CLASSID GetCommonClassID(); 25 | 26 | protected: 27 | CKGroup() {}; 28 | ~CKGroup() {}; 29 | }; -------------------------------------------------------------------------------- /virtools/CKSpriteText.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "CKDef.h" 4 | #include "CKSprite.h" 5 | 6 | class BML_EXPORT CKSpriteText : public CKSprite { 7 | public: 8 | void SetText(CKSTRING text); 9 | CKSTRING GetText(); 10 | void SetTextColor(CKDWORD col); 11 | CKDWORD GetTextColor(); 12 | void SetBackgroundColor(CKDWORD col); 13 | CKDWORD GetBackgroundTextColor(); 14 | void SetFont(CKSTRING FontName, int FontSize = 12, int Weight = 400, CKBOOL italic = FALSE, CKBOOL underline = FALSE); 15 | void SetAlign(CKSPRITETEXT_ALIGNMENT align); 16 | CKSPRITETEXT_ALIGNMENT GetAlign(); 17 | void SetTextU(CKUSTRING text); 18 | CKUSTRING GetTextU(); 19 | 20 | protected: 21 | CKSpriteText() {}; 22 | ~CKSpriteText() {}; 23 | }; -------------------------------------------------------------------------------- /virtools/CKParameterOperation.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "CKDef.h" 4 | #include "CKObject.h" 5 | 6 | typedef void (*CK_PARAMETEROPERATION) (CKContext* context, CKParameterOut* Res, CKParameterIn* p1, CKParameterIn* p2); 7 | 8 | class BML_EXPORT CKParameterOperation : public CKObject { 9 | public: 10 | CKParameterIn* GetInParameter1(); 11 | CKParameterIn* GetInParameter2(); 12 | CKParameterOut* GetOutParameter(); 13 | CKBehavior* GetOwner(); 14 | void SetOwner(CKBehavior* beh); 15 | 16 | CKERROR DoOperation(); 17 | CKGUID GetOperationGuid(); 18 | void Reconstruct(CKSTRING Name, CKGUID opguid, CKGUID ResGuid, CKGUID p1Guid, CKGUID p2Guid); 19 | CK_PARAMETEROPERATION GetOperationFunction(); 20 | 21 | protected: 22 | CKParameterOperation(); 23 | ~CKParameterOperation(); 24 | }; -------------------------------------------------------------------------------- /Timer.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | #include "virtools/CKAll.h" 5 | 6 | class Timer { 7 | public: 8 | Timer(CKDWORD delay, std::function callback, CKDWORD tick, float time); 9 | Timer(CKDWORD delay, std::function callback, CKDWORD tick, float time); 10 | Timer(float delay, std::function callback, CKDWORD tick, float time); 11 | Timer(float delay, std::function callback, CKDWORD tick, float time); 12 | 13 | bool Process(CKDWORD tick, float time); 14 | 15 | private: 16 | struct { 17 | std::function once; 18 | std::function loop; 19 | } m_callback; 20 | enum { 21 | TICK, TIME, ONCE, LOOP 22 | } m_delaytype, m_callbacktype; 23 | union { 24 | CKDWORD tick; 25 | float time; 26 | } m_delay, m_start; 27 | }; 28 | -------------------------------------------------------------------------------- /virtools/CKParameterIn.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "CKDef.h" 4 | #include "CKObject.h" 5 | 6 | class BML_EXPORT CKParameterIn : public CKObject { 7 | public: 8 | CKERROR GetValue(void* buf); 9 | void* GetReadDataPtr(); 10 | CKParameterIn* GetSharedSource(); 11 | CKParameter* GetRealSource(); 12 | CKParameter* GetDirectSource(); 13 | CKERROR SetDirectSource(CKParameter* param); 14 | CKERROR ShareSourceWith(CKParameterIn* param); 15 | void SetType(CKParameterType type, CKBOOL UpdateSource = FALSE, CKSTRING NewName = NULL); 16 | void SetGUID(CKGUID guid, CKBOOL UpdateSource = FALSE, CKSTRING NewName = NULL); 17 | CKParameterType GetType(); 18 | CKGUID GetGUID(); 19 | void SetOwner(CKObject* o); 20 | CKObject* GetOwner(); 21 | 22 | protected: 23 | CKParameterIn() {}; 24 | ~CKParameterIn() {}; 25 | }; -------------------------------------------------------------------------------- /virtools/CKObject.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "CKDef.h" 4 | #include "CKContext.h" 5 | 6 | typedef enum CK_OBJECT_SHOWOPTION { 7 | CKHIDE = 0, 8 | CKSHOW = 1, 9 | CKHIERARCHICALHIDE = 2 10 | } CK_OBJECT_SHOWOPTION; 11 | 12 | class BML_EXPORT CKObject { 13 | public: 14 | CKContext* GetCKContext(); 15 | CK_CLASSID GetClassID(); 16 | CK_ID GetID(); 17 | 18 | CKSTRING GetName(); 19 | void SetName(CKSTRING Name, CKBOOL shared = FALSE); 20 | 21 | int CanBeHide(); 22 | CKBOOL IsHiddenByParent(); 23 | CKBOOL IsHierarchicallyHide(); 24 | CKBOOL IsVisible(); 25 | void Show(CK_OBJECT_SHOWOPTION show = CKSHOW); 26 | 27 | void* GetAppData(); 28 | void SetAppData(void* Data); 29 | 30 | CKDWORD GetObjectFlags(); 31 | CKBOOL IsDynamic(); 32 | CKBOOL IsToBeDeleted(); 33 | void ModifyObjectFlags(CKDWORD add, CKDWORD remove); 34 | 35 | protected: 36 | CKObject() {}; 37 | ~CKObject() {}; 38 | }; -------------------------------------------------------------------------------- /virtools/CKSprite3D.cpp: -------------------------------------------------------------------------------- 1 | #include "CKSprite3D.h" 2 | 3 | NAKED void CKSprite3D::SetMaterial(CKMaterial* Mat) { 4 | JUMPV(0x1d4); 5 | } 6 | 7 | NAKED CKMaterial* CKSprite3D::GetMaterial() { 8 | JUMPV(0x1d8); 9 | } 10 | 11 | NAKED void CKSprite3D::SetSize(Vx2DVector& vect) { 12 | JUMPV(0x1dc); 13 | } 14 | 15 | NAKED void CKSprite3D::GetSize(Vx2DVector& vect) { 16 | JUMPV(0x1e0); 17 | } 18 | 19 | NAKED void CKSprite3D::SetOffset(Vx2DVector& vect) { 20 | JUMPV(0x1e4); 21 | } 22 | 23 | NAKED void CKSprite3D::GetOffset(Vx2DVector& vect) { 24 | JUMPV(0x1e8); 25 | } 26 | 27 | NAKED void CKSprite3D::SetUVMapping(VxRect& rect) { 28 | JUMPV(0x1ec); 29 | } 30 | 31 | NAKED void CKSprite3D::GetUVMapping(VxRect& rect) { 32 | JUMPV(0x1f0); 33 | } 34 | 35 | NAKED void CKSprite3D::SetMode(VXSPRITE3D_TYPE Mode) { 36 | JUMPV(0x1f4); 37 | } 38 | 39 | NAKED VXSPRITE3D_TYPE CKSprite3D::GetMode() { 40 | JUMPV(0x1f8); 41 | } 42 | -------------------------------------------------------------------------------- /virtools/CKMessage.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "CKDef.h" 4 | 5 | typedef enum CK_MESSAGE_SENDINGTYPE { 6 | CK_MESSAGE_BROADCAST = 1, 7 | CK_MESSAGE_SINGLE = 2, 8 | CK_MESSAGE_GROUP = 3, 9 | } CK_MESSAGE_SENDINGTYPE; 10 | 11 | class BML_EXPORT CKMessage { 12 | public: 13 | CKERROR SetBroadcastObjectType(CK_CLASSID type = CKCID_BEOBJECT); 14 | CKERROR AddParameter(CKParameter*, CKBOOL DeleteParameterWithMessage = FALSE); 15 | CKERROR RemoveParameter(CKParameter*); 16 | int GetParameterCount(); 17 | CKParameter* GetParameter(int pos); 18 | void SetSender(CKBeObject* obj); 19 | CKBeObject* GetSender(); 20 | void SetRecipient(CKObject* recipient); 21 | CKObject* GetRecipient(); 22 | CK_MESSAGE_SENDINGTYPE GetSendingType(); 23 | void SetSendingType(CK_MESSAGE_SENDINGTYPE Type); 24 | void SetMsgType(CKMessageType type); 25 | CKMessageType GetMsgType(); 26 | 27 | protected: 28 | CKMessage() {}; 29 | ~CKMessage() {}; 30 | }; -------------------------------------------------------------------------------- /virtools/CKBehaviorIO.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "CKDef.h" 4 | #include "CKObject.h" 5 | 6 | class BML_EXPORT CKBehaviorIO : public CKObject { 7 | public: 8 | void SetType(int Type); 9 | int GetType(); 10 | void Activate(CKBOOL Active = TRUE); 11 | CKBOOL IsActive(); 12 | CKBehavior* GetOwner(); 13 | XSObjectPointerArray* GetLinks(); 14 | 15 | protected: 16 | CKBehaviorIO() {}; 17 | ~CKBehaviorIO() {}; 18 | }; 19 | 20 | class BML_EXPORT CKBehaviorLink : public CKObject { 21 | public: 22 | CKERROR SetOutBehaviorIO(CKBehaviorIO* ckbioin); 23 | CKERROR SetInBehaviorIO(CKBehaviorIO* ckbioout); 24 | CKBehaviorIO* GetOutBehaviorIO(); 25 | CKBehaviorIO* GetInBehaviorIO(); 26 | int GetActivationDelay(); 27 | void SetActivationDelay(int delay); 28 | void ResetActivationDelay(); 29 | void SetInitialActivationDelay(int delay); 30 | int GetInitialActivationDelay(); 31 | 32 | protected: 33 | CKBehaviorLink() {}; 34 | ~CKBehaviorLink() {}; 35 | }; -------------------------------------------------------------------------------- /ICommand.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | #include 5 | #include 6 | #include "Export.h" 7 | 8 | class IBML; 9 | 10 | class BML_EXPORT ICommand { 11 | public: 12 | virtual std::string GetName() = 0; 13 | virtual std::string GetAlias() = 0; 14 | virtual std::string GetDescription() = 0; 15 | virtual bool IsCheat() = 0; 16 | 17 | virtual void Execute(IBML* bml, const std::vector& args) = 0; 18 | virtual const std::vector GetTabCompletion(IBML* bml, const std::vector& args) = 0; 19 | 20 | static int ParseInteger(const std::string& str, int mn = INT_MIN, int mx = INT_MAX) { 21 | return (std::max)(mn, (std::min)(mx, atoi(str.c_str()))); 22 | } 23 | 24 | static float ParseFloat(const std::string& str, float mn = FLT_MIN, float mx = FLT_MAX) { 25 | return (std::max)(mn, (std::min)(mx, (float) atof(str.c_str()))); 26 | } 27 | 28 | static bool ParseBoolean(const std::string& str) { 29 | return str == "true" || str == "1"; 30 | } 31 | }; -------------------------------------------------------------------------------- /virtools/CKGroup.cpp: -------------------------------------------------------------------------------- 1 | #include "CKGroup.h" 2 | 3 | NAKED CKERROR CKGroup::AddObject(CKBeObject* o) { 4 | JUMP(0x2402B86F); 5 | } 6 | 7 | NAKED CKERROR CKGroup::AddObjectFront(CKBeObject* o) { 8 | JUMP(0x2402B8CB); 9 | } 10 | 11 | NAKED CKERROR CKGroup::InsertObjectAt(CKBeObject* o, int pos) { 12 | JUMP(0x2402B929); 13 | } 14 | 15 | NAKED CKBeObject* CKGroup::RemoveObject(int pos) { 16 | JUMP(0x2402B997); 17 | } 18 | 19 | NAKED void CKGroup::RemoveObject(CKBeObject* obj) { 20 | JUMP(0x2402B9E9); 21 | } 22 | 23 | NAKED void CKGroup::Clear() { 24 | JUMP(0x2402BAA8); 25 | } 26 | 27 | NAKED void CKGroup::MoveObjectUp(CKBeObject* o) { 28 | JUMP(0x2402BA1B); 29 | } 30 | 31 | NAKED void CKGroup::MoveObjectDown(CKBeObject* o) { 32 | JUMP(0x2402BA4F); 33 | } 34 | 35 | NAKED CKBeObject* CKGroup::GetObject(int pos) { 36 | JUMP(0x2402BA85); 37 | } 38 | 39 | NAKED int CKGroup::GetObjectCount() { 40 | JUMP(0x2402735A); 41 | } 42 | 43 | NAKED CK_CLASSID CKGroup::GetCommonClassID() { 44 | JUMP(0x2402BADA); 45 | } 46 | -------------------------------------------------------------------------------- /virtools/CKBehaviorManager.cpp: -------------------------------------------------------------------------------- 1 | #include "CKBehaviorManager.h" 2 | 3 | NAKED CKERROR CKBehaviorManager::Execute(float delta) { 4 | JUMP(0x2400C40C); 5 | } 6 | 7 | NAKED CKERROR CKBehaviorManager::AddObject(CKBeObject* b) { 8 | UNDEFINED; 9 | } 10 | 11 | NAKED CKERROR CKBehaviorManager::RemoveObject(CKBeObject* b) { 12 | UNDEFINED; 13 | } 14 | 15 | NAKED int CKBehaviorManager::GetObjectsCount() { 16 | JUMP(0x24002E87); 17 | } 18 | 19 | NAKED CKERROR CKBehaviorManager::RemoveAllObjects() { 20 | UNDEFINED; 21 | } 22 | 23 | NAKED CKBeObject* CKBehaviorManager::GetObject(int pos) { 24 | JUMP(0x2400C5D9); 25 | } 26 | 27 | NAKED CKERROR CKBehaviorManager::AddObjectNextFrame(CKBeObject* b) { 28 | UNDEFINED; 29 | } 30 | 31 | NAKED CKERROR CKBehaviorManager::RemoveObjectNextFrame(CKBeObject* b) { 32 | UNDEFINED; 33 | } 34 | 35 | NAKED int CKBehaviorManager::GetBehaviorMaxIteration() { 36 | JUMP(0x2402D41D); 37 | } 38 | 39 | NAKED void CKBehaviorManager::SetBehaviorMaxIteration(int n) { 40 | JUMP(0x2400C6B1); 41 | } 42 | -------------------------------------------------------------------------------- /virtools/CK2dCurvePoint.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "CKDef.h" 4 | 5 | class BML_EXPORT CK2dCurvePoint { 6 | public: 7 | CK2dCurve* GetCurve() const; 8 | float GetBias() const; 9 | void SetBias(float b); 10 | float GetTension() const; 11 | void SetTension(float t); 12 | float GetContinuity() const; 13 | void SetContinuity(float c); 14 | CKBOOL IsLinear() const; 15 | void SetLinear(CKBOOL linear = FALSE); 16 | void UseTCB(CKBOOL use = TRUE); 17 | CKBOOL IsTCB() const; 18 | float GetLength() const; 19 | Vx2DVector& GetPosition(); 20 | void SetPosition(const Vx2DVector& pos); 21 | Vx2DVector& GetInTangent(); 22 | Vx2DVector& GetOutTangent(); 23 | void SetInTangent(const Vx2DVector& in); 24 | void SetOutTangent(const Vx2DVector& out); 25 | void NotifyUpdate(); 26 | void SetCurve(CK2dCurve* curve); 27 | void SetLength(float l); 28 | Vx2DVector& GetRCurvePos(); 29 | void SetRCurvePos(Vx2DVector& v); 30 | void Read(CKStateChunk* chunk); 31 | 32 | protected: 33 | CK2dCurvePoint() {}; 34 | ~CK2dCurvePoint() {}; 35 | }; 36 | -------------------------------------------------------------------------------- /virtools/CKObjectDeclaration.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "CKDef.h" 4 | 5 | typedef CKERROR(*CKDLL_CREATEPROTOFUNCTION) (CKBehaviorPrototype**); 6 | 7 | class BML_EXPORT CKObjectDeclaration { 8 | public: 9 | void SetDescription(CKSTRING Description); 10 | CKSTRING GetDescription(); 11 | void SetGuid(CKGUID guid); 12 | CKGUID GetGuid(); 13 | void SetType(int type); 14 | int GetType(); 15 | void NeedManager(CKGUID Manager); 16 | void SetCreationFunction(CKDLL_CREATEPROTOFUNCTION f); 17 | CKDLL_CREATEPROTOFUNCTION GetCreationFunction(); 18 | void SetAuthorGuid(CKGUID guid); 19 | CKGUID GetAuthorGuid(); 20 | void SetAuthorName(CKSTRING Name); 21 | CKSTRING GetAuthorName(); 22 | void SetVersion(CKDWORD verion); 23 | CKDWORD GetVersion(); 24 | void SetCompatibleClassId(CK_CLASSID id); 25 | CK_CLASSID GetCompatibleClassId(); 26 | void SetCategory(CKSTRING cat); 27 | CKSTRING GetCategory(); 28 | CKSTRING GetName(); 29 | int GetPluginIndex(); 30 | 31 | protected: 32 | CKObjectDeclaration() {}; 33 | ~CKObjectDeclaration() {}; 34 | }; -------------------------------------------------------------------------------- /virtools/CKCamera.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "CKDef.h" 4 | #include "CK3dEntity.h" 5 | 6 | #define CK_PERSPECTIVEPROJECTION 1 7 | #define CK_ORTHOGRAPHICPROJECTION 2 8 | 9 | class BML_EXPORT CKCamera : public CK3dEntity { 10 | public: 11 | float GetFrontPlane(); 12 | void SetFrontPlane(float front); 13 | float GetBackPlane(); 14 | void SetBackPlane(float back); 15 | float GetFov(); 16 | void SetFov(float fov); 17 | int GetProjectionType(); 18 | void SetProjectionType(int proj); 19 | void SetOrthographicZoom(float zoom); 20 | float GetOrthographicZoom(); 21 | void SetAspectRatio(int width, int height); 22 | void GetAspectRatio(int& width, int& height); 23 | void ComputeProjectionMatrix(VxMatrix& mat); 24 | void ResetRoll(); 25 | void Roll(float angle); 26 | CK3dEntity* GetTarget(); 27 | void SetTarget(CK3dEntity* target); 28 | 29 | protected: 30 | CKCamera() {}; 31 | ~CKCamera() {}; 32 | }; 33 | 34 | class BML_EXPORT CKTargetCamera : public CKCamera { 35 | protected: 36 | CKTargetCamera() {}; 37 | ~CKTargetCamera() {}; 38 | }; -------------------------------------------------------------------------------- /virtools/CKSoundManager.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "CKDef.h" 4 | #include "CKBaseManager.h" 5 | 6 | typedef void* CKSOUNDHANDLE; 7 | 8 | struct SoundMinion { 9 | CKSOUNDHANDLE m_Source; 10 | CKSOUNDHANDLE m_OriginalSource; 11 | CK_ID m_Entity; 12 | CK_ID m_OriginalSound; 13 | VxVector m_Position; 14 | VxVector m_Direction; 15 | VxVector m_OldPosition; 16 | float m_TimeStamp; 17 | }; 18 | 19 | class BML_EXPORT CKSoundManager : public CKBaseManager { 20 | public: 21 | void SetListener(CK3dEntity* listener); 22 | CK3dEntity* GetListener(); 23 | void SetStreamedBufferSize(CKDWORD bsize); 24 | CKDWORD GetStreamedBufferSize(); 25 | SoundMinion* CreateMinion(CKSOUNDHANDLE source, float minimumdelay = 0.0f); 26 | void ReleaseMinions(); 27 | void PauseMinions(); 28 | void ResumeMinions(); 29 | void ProcessMinions(); 30 | CKERROR SequenceDeleted(CK_ID* objids, int count); 31 | CKERROR PostClearAll(); 32 | CKDWORD GetValidFunctionsMask(); 33 | void RegisterAttribute(); 34 | 35 | protected: 36 | CKSoundManager() {}; 37 | ~CKSoundManager() {}; 38 | }; -------------------------------------------------------------------------------- /virtools/CKParameterOperation.cpp: -------------------------------------------------------------------------------- 1 | #include "CKParameterOperation.h" 2 | 3 | CKParameterIn* CKParameterOperation::GetInParameter1() { 4 | RETURN_MEM(0x14, CKParameterIn*); 5 | } 6 | 7 | CKParameterIn* CKParameterOperation::GetInParameter2() { 8 | RETURN_MEM(0x18, CKParameterIn*); 9 | } 10 | 11 | CKParameterOut* CKParameterOperation::GetOutParameter() { 12 | RETURN_MEM(0x1c, CKParameterOut*); 13 | } 14 | 15 | CKBehavior* CKParameterOperation::GetOwner() { 16 | RETURN_MEM(0x20, CKBehavior*); 17 | } 18 | 19 | void CKParameterOperation::SetOwner(CKBehavior* beh) { 20 | SET_MEM(0x20, CKBehavior*, beh); 21 | } 22 | 23 | NAKED CKERROR CKParameterOperation::DoOperation() { 24 | JUMP(0x240098BB); 25 | } 26 | 27 | NAKED CKGUID CKParameterOperation::GetOperationGuid() { 28 | JUMP(0x240098A9); 29 | } 30 | 31 | NAKED void CKParameterOperation::Reconstruct(CKSTRING Name, CKGUID opguid, CKGUID ResGuid, CKGUID p1Guid, CKGUID p2Guid) { 32 | JUMP(0x240097DD); 33 | } 34 | 35 | NAKED CK_PARAMETEROPERATION CKParameterOperation::GetOperationFunction() { 36 | JUMP(0x24017AE9); 37 | } -------------------------------------------------------------------------------- /virtools/CKSpriteText.cpp: -------------------------------------------------------------------------------- 1 | #include "CKSpriteText.h" 2 | 3 | NAKED void CKSpriteText::SetText(CKSTRING text) { 4 | JUMPV(0x1e0); 5 | } 6 | 7 | NAKED CKSTRING CKSpriteText::GetText() { 8 | JUMPV(0x1e4); 9 | } 10 | 11 | NAKED void CKSpriteText::SetTextColor(CKDWORD col) { 12 | JUMPV(0x1e8); 13 | } 14 | 15 | NAKED CKDWORD CKSpriteText::GetTextColor() { 16 | JUMPV(0x1ec); 17 | } 18 | 19 | NAKED void CKSpriteText::SetBackgroundColor(CKDWORD col) { 20 | JUMPV(0x1f0); 21 | } 22 | 23 | NAKED CKDWORD CKSpriteText::GetBackgroundTextColor() { 24 | JUMPV(0x1f4); 25 | } 26 | 27 | NAKED void CKSpriteText::SetFont(CKSTRING FontName, int FontSize, int Weight, CKBOOL italic, CKBOOL underline) { 28 | JUMPV(0x1f8); 29 | } 30 | 31 | NAKED void CKSpriteText::SetAlign(CKSPRITETEXT_ALIGNMENT align) { 32 | JUMPV(0x1fc); 33 | } 34 | 35 | NAKED CKSPRITETEXT_ALIGNMENT CKSpriteText::GetAlign() { 36 | JUMPV(0x200); 37 | } 38 | 39 | NAKED void CKSpriteText::SetTextU(CKUSTRING text) { 40 | JUMPV(0x204); 41 | } 42 | 43 | NAKED CKUSTRING CKSpriteText::GetTextU() { 44 | JUMPV(0x208); 45 | } 46 | -------------------------------------------------------------------------------- /virtools/CK2dCurve.cpp: -------------------------------------------------------------------------------- 1 | #include "CK2dCurve.h" 2 | 3 | NAKED float CK2dCurve::GetLength() { 4 | JUMP(0x2403B12C); 5 | } 6 | 7 | NAKED CKERROR CK2dCurve::GetPos(float step, Vx2DVector* pos) { 8 | JUMP(0x24001DB9); 9 | } 10 | 11 | NAKED float CK2dCurve::GetY(float X) { 12 | JUMP(0x24001B36); 13 | } 14 | 15 | NAKED void CK2dCurve::DeleteControlPoint(CK2dCurvePoint* cpt) { 16 | JUMP(0x2403B234); 17 | } 18 | 19 | NAKED void CK2dCurve::AddControlPoint(const Vx2DVector& pos) { 20 | JUMP(0x24001AF5); 21 | } 22 | 23 | NAKED int CK2dCurve::GetControlPointCount() { 24 | JUMP(0x2403B27E); 25 | } 26 | 27 | NAKED CK2dCurvePoint* CK2dCurve::GetControlPoint(int pos) { 28 | JUMP(0x2403B28A); 29 | } 30 | 31 | NAKED void CK2dCurve::Update() { 32 | JUMP(0x24001084); 33 | } 34 | 35 | NAKED CKStateChunk* CK2dCurve::Dump() { 36 | JUMP(0x2400125A); 37 | } 38 | 39 | NAKED CKERROR CK2dCurve::Read(CKStateChunk* chunk) { 40 | JUMP(0x240013E4); 41 | } 42 | 43 | NAKED void CK2dCurve::UpdatePointsAndTangents() { 44 | JUMP(0x24001600); 45 | } 46 | 47 | NAKED int CK2dCurve::Rindex(int index) { 48 | JUMP(0x2403B296); 49 | } 50 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2020 Gamepiaynmo 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /virtools/CKRenderObject.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "CKDef.h" 4 | #include "CKBeObject.h" 5 | 6 | typedef CKBOOL(*CK_RENDEROBJECT_CALLBACK)(CKRenderContext* Dev, CKRenderObject* ent, void* Argument); 7 | 8 | class BML_EXPORT CKRenderObject : public CKBeObject { 9 | public: 10 | CKBOOL IsInRenderContext(CKRenderContext* context); 11 | CKBOOL IsRootObject(); 12 | CKBOOL IsToBeRendered(); 13 | void SetZOrder(int Z); 14 | int GetZOrder(); 15 | CKBOOL IsToBeRenderedLast(); 16 | CKBOOL AddPreRenderCallBack(CK_RENDEROBJECT_CALLBACK Function, void* Argument, CKBOOL Temp = FALSE, CKBOOL ModifyRenderPipeline = TRUE); 17 | CKBOOL RemovePreRenderCallBack(CK_RENDEROBJECT_CALLBACK Function, void* Argument); 18 | CKBOOL SetRenderCallBack(CK_RENDEROBJECT_CALLBACK Function, void* Argument); 19 | CKBOOL RemoveRenderCallBack(); 20 | CKBOOL AddPostRenderCallBack(CK_RENDEROBJECT_CALLBACK Function, void* Argument, CKBOOL Temp = FALSE, CKBOOL ModifyRenderPipeline = TRUE); 21 | CKBOOL RemovePostRenderCallBack(CK_RENDEROBJECT_CALLBACK Function, void* Argument); 22 | void RemoveAllCallbacks(); 23 | 24 | protected: 25 | CKRenderObject() {}; 26 | ~CKRenderObject() {}; 27 | }; -------------------------------------------------------------------------------- /Logger.cpp: -------------------------------------------------------------------------------- 1 | #include "Logger.h" 2 | #include "ModLoader.h" 3 | #include 4 | #include 5 | 6 | Logger::Logger(const char* modname) : m_modname(modname) {} 7 | 8 | void Logger::Info(const char* fmt, ...) { 9 | va_list args; 10 | va_start(args, fmt); 11 | Log("INFO", fmt, args); 12 | va_end(args); 13 | } 14 | 15 | void Logger::Warn(const char* fmt, ...) { 16 | va_list args; 17 | va_start(args, fmt); 18 | Log("WARN", fmt, args); 19 | va_end(args); 20 | } 21 | 22 | void Logger::Error(const char* fmt, ...) { 23 | va_list args; 24 | va_start(args, fmt); 25 | Log("ERROR", fmt, args); 26 | va_end(args); 27 | } 28 | 29 | void Logger::Log(const char* level, const char* fmt, va_list args) { 30 | SYSTEMTIME sys; 31 | GetLocalTime(&sys); 32 | 33 | FILE* out_files[] = { 34 | #ifdef _DEBUG 35 | stdout, 36 | #endif 37 | ModLoader::m_instance->GetLogFile() 38 | }; 39 | 40 | for (FILE* file : out_files) { 41 | fprintf(file, "[%02d/%02d/%d %02d:%02d:%02d.%03d] ", sys.wMonth, sys.wDay, 42 | sys.wYear, sys.wHour, sys.wMinute, sys.wSecond, sys.wMilliseconds); 43 | fprintf(file, "[%s/%s]: ", m_modname, level); 44 | vfprintf(file, fmt, args); 45 | fputc('\n', file); 46 | fflush(file); 47 | } 48 | } -------------------------------------------------------------------------------- /virtools/CKSoundManager.cpp: -------------------------------------------------------------------------------- 1 | #include "CKSoundManager.h" 2 | 3 | NAKED void CKSoundManager::SetListener(CK3dEntity* listener) { 4 | JUMP(0x24017A7A); 5 | } 6 | 7 | NAKED CK3dEntity* CKSoundManager::GetListener() { 8 | JUMP(0x24017AAD); 9 | } 10 | 11 | NAKED void CKSoundManager::SetStreamedBufferSize(CKDWORD bsize) { 12 | JUMP(0x24017ADF); 13 | } 14 | 15 | NAKED CKDWORD CKSoundManager::GetStreamedBufferSize() { 16 | JUMP(0x24017AE9); 17 | } 18 | 19 | NAKED SoundMinion* CKSoundManager::CreateMinion(CKSOUNDHANDLE source, float minimumdelay) { 20 | JUMP(0x24017AED); 21 | } 22 | 23 | NAKED void CKSoundManager::ReleaseMinions() { 24 | JUMP(0x24017BF9); 25 | } 26 | 27 | NAKED void CKSoundManager::PauseMinions() { 28 | JUMP(0x24017BB3); 29 | } 30 | 31 | NAKED void CKSoundManager::ResumeMinions() { 32 | JUMP(0x24017BD5); 33 | } 34 | 35 | NAKED void CKSoundManager::ProcessMinions() { 36 | JUMP(0x24017C48); 37 | } 38 | 39 | NAKED CKERROR CKSoundManager::SequenceDeleted(CK_ID* objids, int count) { 40 | JUMP(0x24017CA1); 41 | } 42 | 43 | NAKED CKERROR CKSoundManager::PostClearAll() { 44 | JUMP(0x24017CA9); 45 | } 46 | 47 | NAKED CKDWORD CKSoundManager::GetValidFunctionsMask() { 48 | JUMP(0x24017D1D); 49 | } 50 | 51 | NAKED void CKSoundManager::RegisterAttribute() { 52 | JUMP(0x2402141A); 53 | } 54 | -------------------------------------------------------------------------------- /virtools/CKTexture.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "CKDef.h" 4 | #include "CKBeObject.h" 5 | #include "CKBitmapData.h" 6 | #include "CKSprite.h" 7 | 8 | #undef LoadImage 9 | 10 | class BML_EXPORT CKTexture : public CKBeObject, public CKBitmapData { 11 | public: 12 | CKBOOL Create(int Width, int Height, int BPP = 32, int Slot = 0); 13 | CKBOOL LoadImage(CKSTRING Name, int Slot = 0); 14 | CKBOOL LoadMovie(CKSTRING Name); 15 | CKBOOL SetAsCurrent(CKRenderContext* Dev, CKBOOL Clamping = FALSE, int TextureStage = 0); 16 | CKBOOL Restore(CKBOOL Clamp = FALSE); 17 | CKBOOL SystemToVideoMemory(CKRenderContext* Dev, CKBOOL Clamping = FALSE); 18 | CKBOOL FreeVideoMemory(); 19 | CKBOOL IsInVideoMemory(); 20 | CKBOOL CopyContext(CKRenderContext* ctx, VxRect* Src, VxRect* Dest, int CubeMapFace = 0); 21 | CKBOOL UseMipmap(int UseMipMap); 22 | int GetMipmapCount(); 23 | CKBOOL GetVideoTextureDesc(VxImageDescEx& desc); 24 | VX_PIXELFORMAT GetVideoPixelFormat(); 25 | CKBOOL GetSystemTextureDesc(VxImageDescEx& desc); 26 | void SetDesiredVideoFormat(VX_PIXELFORMAT pf); 27 | VX_PIXELFORMAT GetDesiredVideoFormat(); 28 | CKBOOL FlushSurfacePtr(int Slot = -1); 29 | BOOL GetUserMipMapLevel(int Level, VxImageDescEx& ResultImage); 30 | int GetRstTextureIndex(); 31 | 32 | protected: 33 | CKTexture() {}; 34 | ~CKTexture() {}; 35 | }; -------------------------------------------------------------------------------- /virtools/CKObject.cpp: -------------------------------------------------------------------------------- 1 | #include "CKObject.h" 2 | 3 | NAKED CKContext* CKObject::GetCKContext() { 4 | JUMP(0x2403AF9D); 5 | } 6 | 7 | NAKED CK_CLASSID CKObject::GetClassID() { 8 | JUMPV(0x14); 9 | } 10 | 11 | NAKED CK_ID CKObject::GetID() { 12 | JUMP(0x2403A50C); 13 | } 14 | 15 | NAKED CKSTRING CKObject::GetName() { 16 | JUMP(0x2403A510); 17 | } 18 | NAKED void CKObject::SetName(CKSTRING Name, CKBOOL shared) { 19 | JUMP(0x24020F30); 20 | } 21 | 22 | NAKED int CKObject::CanBeHide() { 23 | JUMPV(0x8) 24 | } 25 | 26 | NAKED CKBOOL CKObject::IsHiddenByParent() { 27 | JUMPV(0x4); 28 | } 29 | 30 | NAKED CKBOOL CKObject::IsHierarchicallyHide() { 31 | JUMP(0x2403A502); 32 | } 33 | 34 | NAKED CKBOOL CKObject::IsVisible() { 35 | JUMPV(0xc); 36 | } 37 | 38 | NAKED void CKObject::Show(CK_OBJECT_SHOWOPTION show) { 39 | JUMPV(0x0); 40 | } 41 | 42 | NAKED void* CKObject::GetAppData() { 43 | JUMP(0x24020F84); 44 | } 45 | 46 | NAKED void CKObject::SetAppData(void* Data) { 47 | JUMP(0x24020F6C); 48 | } 49 | 50 | NAKED CKDWORD CKObject::GetObjectFlags() { 51 | JUMP(0x2403AB37); 52 | } 53 | 54 | NAKED CKBOOL CKObject::IsDynamic() { 55 | JUMP(0x2403A514); 56 | } 57 | 58 | NAKED CKBOOL CKObject::IsToBeDeleted() { 59 | JUMP(0x2403A526); 60 | } 61 | 62 | NAKED void CKObject::ModifyObjectFlags(CKDWORD add, CKDWORD remove) { 63 | JUMP(0x2403A52D); 64 | } -------------------------------------------------------------------------------- /virtools/CKMessageManager.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "CKDef.h" 4 | #include "CKBaseManager.h" 5 | 6 | #undef SendMessage 7 | 8 | class BML_EXPORT CKMessageManager : public CKBaseManager { 9 | public: 10 | CKMessageType AddMessageType(CKSTRING MsgName); 11 | CKSTRING GetMessageTypeName(CKMessageType MsgType); 12 | int GetMessageTypeCount(); 13 | void RenameMessageType(CKMessageType MsgType, CKSTRING NewName); 14 | void RenameMessageType(CKSTRING OldName, CKSTRING NewName); 15 | CKERROR SendMessage(CKMessage* msg); 16 | CKMessage* SendMessageSingle(CKMessageType MsgType, CKBeObject* dest, CKBeObject* sender = NULL); 17 | CKMessage* SendMessageGroup(CKMessageType MsgType, CKGroup* group, CKBeObject* sender = NULL); 18 | CKMessage* SendMessageBroadcast(CKMessageType MsgType, CK_CLASSID id = CKCID_BEOBJECT, CKBeObject* sender = NULL); 19 | CKERROR RegisterWait(CKMessageType MsgType, CKBehavior* behav, int OutputToActivate, CKBeObject* obj); 20 | CKERROR RegisterWait(CKSTRING MsgName, CKBehavior* behav, int OutputToActivate, CKBeObject* obj); 21 | CKERROR UnRegisterWait(CKMessageType MsgType, CKBehavior* behav, int OutputToActivate); 22 | CKERROR UnRegisterWait(CKSTRING MsgName, CKBehavior* behav, int OutputToActivate); 23 | CKERROR RegisterDefaultMessages(); 24 | 25 | protected: 26 | CKMessageManager() {}; 27 | ~CKMessageManager() {}; 28 | }; -------------------------------------------------------------------------------- /IConfig.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "virtools/CKAll.h" 4 | #include 5 | 6 | class BML_EXPORT IProperty { 7 | public: 8 | virtual CKSTRING GetString() = 0; 9 | virtual bool GetBoolean() = 0; 10 | virtual int GetInteger() = 0; 11 | virtual float GetFloat() = 0; 12 | virtual CKKEYBOARD GetKey() = 0; 13 | 14 | virtual void SetString(CKSTRING value) = 0; 15 | virtual void SetBoolean(bool value) = 0; 16 | virtual void SetInteger(int value) = 0; 17 | virtual void SetFloat(float value) = 0; 18 | virtual void SetKey(CKKEYBOARD value) = 0; 19 | 20 | virtual void SetComment(CKSTRING comment) = 0; 21 | virtual void SetDefaultString(CKSTRING value) = 0; 22 | virtual void SetDefaultBoolean(bool value) = 0; 23 | virtual void SetDefaultInteger(int value) = 0; 24 | virtual void SetDefaultFloat(float value) = 0; 25 | virtual void SetDefaultKey(CKKEYBOARD value) = 0; 26 | 27 | enum PropertyType { 28 | STRING, 29 | BOOLEAN, 30 | INTEGER, 31 | KEY, 32 | FLOAT, 33 | NONE 34 | }; 35 | virtual PropertyType GetType() = 0; 36 | }; 37 | 38 | class BML_EXPORT IConfig { 39 | public: 40 | virtual bool HasCategory(CKSTRING category) = 0; 41 | virtual bool HasKey(CKSTRING category, CKSTRING key) = 0; 42 | 43 | virtual IProperty* GetProperty(CKSTRING category, CKSTRING key) = 0; 44 | virtual void SetCategoryComment(CKSTRING category, CKSTRING comment) = 0; 45 | }; -------------------------------------------------------------------------------- /virtools/CKLight.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "CKDef.h" 4 | #include "CK3dEntity.h" 5 | 6 | typedef enum VXLIGHT_TYPE { 7 | VX_LIGHTPOINT = 1UL, 8 | VX_LIGHTSPOT = 2UL, 9 | VX_LIGHTDIREC = 3UL, 10 | VX_LIGHTPARA = 4UL 11 | } VXLIGHT_TYPE; 12 | 13 | class BML_EXPORT CKLight : public CK3dEntity { 14 | public: 15 | void SetColor(const VxColor& c); 16 | const VxColor& GetColor(); 17 | void SetConstantAttenuation(float Value); 18 | void SetLinearAttenuation(float Value); 19 | void SetQuadraticAttenuation(float Value); 20 | float GetConstantAttenuation(); 21 | float GetLinearAttenuation(); 22 | float GetQuadraticAttenuation(); 23 | VXLIGHT_TYPE GetType(); 24 | void SetType(VXLIGHT_TYPE Type); 25 | float GetRange(); 26 | void SetRange(float Value); 27 | float GetHotSpot(); 28 | float GetFallOff(); 29 | void SetHotSpot(float Value); 30 | void SetFallOff(float Value); 31 | float GetFallOffShape(); 32 | void SetFallOffShape(float Value); 33 | void Active(CKBOOL Active); 34 | CKBOOL GetActivity(); 35 | void SetSpecularFlag(CKBOOL Specular); 36 | CKBOOL GetSpecularFlag(); 37 | CK3dEntity* GetTarget(); 38 | void SetTarget(CK3dEntity* target); 39 | float GetLightPower(); 40 | void SetLightPower(float power = 1.0f); 41 | 42 | protected: 43 | CKLight() {}; 44 | ~CKLight() {}; 45 | }; 46 | 47 | class BML_EXPORT CKTargetLight : public CKLight { 48 | protected: 49 | CKTargetLight() {}; 50 | ~CKTargetLight() {}; 51 | }; -------------------------------------------------------------------------------- /virtools/CKCamera.cpp: -------------------------------------------------------------------------------- 1 | #include "CKCamera.h" 2 | 3 | NAKED float CKCamera::GetFrontPlane() { 4 | JUMPV(0x1d4); 5 | } 6 | 7 | NAKED void CKCamera::SetFrontPlane(float front) { 8 | JUMPV(0x1d8); 9 | } 10 | 11 | NAKED float CKCamera::GetBackPlane() { 12 | JUMPV(0x1dc); 13 | } 14 | 15 | NAKED void CKCamera::SetBackPlane(float back) { 16 | JUMPV(0x1e0); 17 | } 18 | 19 | NAKED float CKCamera::GetFov() { 20 | JUMPV(0x1e4); 21 | } 22 | 23 | NAKED void CKCamera::SetFov(float fov) { 24 | JUMPV(0x1e8); 25 | } 26 | 27 | NAKED int CKCamera::GetProjectionType() { 28 | JUMPV(0x1ec); 29 | } 30 | 31 | NAKED void CKCamera::SetProjectionType(int proj) { 32 | JUMPV(0x1f0); 33 | } 34 | 35 | NAKED void CKCamera::SetOrthographicZoom(float zoom) { 36 | JUMPV(0x1f4); 37 | } 38 | 39 | NAKED float CKCamera::GetOrthographicZoom() { 40 | JUMPV(0x1f8); 41 | } 42 | 43 | NAKED void CKCamera::SetAspectRatio(int width, int height) { 44 | JUMPV(0x1fc); 45 | } 46 | 47 | NAKED void CKCamera::GetAspectRatio(int& width, int& height) { 48 | JUMPV(0x200); 49 | } 50 | 51 | NAKED void CKCamera::ComputeProjectionMatrix(VxMatrix& mat) { 52 | JUMPV(0x204); 53 | } 54 | 55 | NAKED void CKCamera::ResetRoll() { 56 | JUMPV(0x208); 57 | } 58 | 59 | NAKED void CKCamera::Roll(float angle) { 60 | JUMPV(0x20c); 61 | } 62 | 63 | NAKED CK3dEntity* CKCamera::GetTarget() { 64 | JUMPV(0x210); 65 | } 66 | 67 | NAKED void CKCamera::SetTarget(CK3dEntity* target) { 68 | JUMPV(0x214); 69 | } 70 | -------------------------------------------------------------------------------- /virtools/CKDef.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | 5 | #define VX_EXPORT 6 | #define NAKED __declspec(naked) 7 | #define UNDEFINED throw "Unimplemented function called.";__asm ret 8 | 9 | #include "../Export.h" 10 | #include "VxMathDefines.h" 11 | #include "CKdefines2.h" 12 | #include "CKEnums.h" 13 | #include "CKTypes.h" 14 | #include "CKError.h" 15 | 16 | #include "VxMutex.h" 17 | #include "VxAllocator.h" 18 | #include "VxQuaternion.h" 19 | #include "Vx2dVector.h" 20 | #include "VxMatrix.h" 21 | #include "VxVector.h" 22 | #include "VxRect.h" 23 | #include "VxMath.h" 24 | #include "VxColor.h" 25 | #include "VxPlane.h" 26 | #include "VxRay.h" 27 | #include "VxFrustum.h" 28 | #include "VxSphere.h" 29 | 30 | #include "XUtil.h" 31 | #include "XString.h" 32 | #include "XSmartPtr.h" 33 | 34 | #define JUMP(ADDR) \ 35 | static CKDWORD addr = ADDR; \ 36 | __asm jmp addr 37 | #define JUMPV(OFFSET) \ 38 | __asm mov eax, [ecx] \ 39 | __asm mov eax, [eax + OFFSET] \ 40 | __asm jmp eax 41 | #define GETVADDR(OBJ, OFFSET) \ 42 | (*reinterpret_cast(*reinterpret_cast(OBJ) + OFFSET)) 43 | 44 | #define GET_MEMPTR(OFFSET, TYPE) \ 45 | reinterpret_cast(reinterpret_cast(this) + OFFSET) 46 | #define GET_MEM(OFFSET, TYPE) (*GET_MEMPTR(OFFSET, TYPE)) 47 | #define RETURN_MEMPTR(OFFSET, TYPE) return GET_MEMPTR(OFFSET, TYPE) 48 | #define RETURN_MEM(OFFSET, TYPE) return GET_MEM(OFFSET, TYPE) 49 | #define SET_MEM(OFFSET, TYPE, VALUE) (GET_MEM(OFFSET, TYPE) = VALUE) -------------------------------------------------------------------------------- /virtools/CKMessage.cpp: -------------------------------------------------------------------------------- 1 | #include "CKMessage.h" 2 | #include "CKBeObject.h" 3 | 4 | NAKED CKERROR CKMessage::SetBroadcastObjectType(CK_CLASSID type) { 5 | JUMP(0x24007FE6); 6 | } 7 | 8 | NAKED CKERROR CKMessage::AddParameter(CKParameter*, CKBOOL DeleteParameterWithMessage) { 9 | JUMP(0x24007EFE); 10 | } 11 | 12 | NAKED CKERROR CKMessage::RemoveParameter(CKParameter*) { 13 | JUMP(0x24007F6B); 14 | } 15 | 16 | NAKED int CKMessage::GetParameterCount() { 17 | JUMP(0x24007FB8); 18 | } 19 | 20 | NAKED CKParameter* CKMessage::GetParameter(int pos) { 21 | JUMP(0x24007FCB); 22 | } 23 | 24 | void CKMessage::SetSender(CKBeObject* obj) { 25 | SET_MEM(0x10, CK_ID, CKOBJID(obj)); 26 | } 27 | 28 | CKBeObject* CKMessage::GetSender() { 29 | return static_cast(GET_MEM(0x18, CKContext*)->GetObject(GET_MEM(0x10, CK_ID))); 30 | } 31 | 32 | void CKMessage::SetRecipient(CKObject* recipient) { 33 | SET_MEM(0x14, CK_ID, CKOBJID(recipient)); 34 | } 35 | 36 | CKObject* CKMessage::GetRecipient() { 37 | return GET_MEM(0x18, CKContext*)->GetObject(GET_MEM(0x14, CK_ID)); 38 | } 39 | 40 | CK_MESSAGE_SENDINGTYPE CKMessage::GetSendingType() { 41 | RETURN_MEM(0xc, CK_MESSAGE_SENDINGTYPE); 42 | } 43 | 44 | void CKMessage::SetSendingType(CK_MESSAGE_SENDINGTYPE Type) { 45 | SET_MEM(0xc, CK_MESSAGE_SENDINGTYPE, Type); 46 | } 47 | 48 | void CKMessage::SetMsgType(CKMessageType type) { 49 | SET_MEM(0x4, CKMessageType, type); 50 | } 51 | 52 | CKMessageType CKMessage::GetMsgType() { 53 | RETURN_MEM(0x4, CKMessageType); 54 | } 55 | -------------------------------------------------------------------------------- /virtools/CKRenderObject.cpp: -------------------------------------------------------------------------------- 1 | #include "CKRenderObject.h" 2 | 3 | NAKED CKBOOL CKRenderObject::IsInRenderContext(CKRenderContext* context) { 4 | JUMPV(0x54); 5 | } 6 | 7 | NAKED CKBOOL CKRenderObject::IsRootObject() { 8 | JUMPV(0x58); 9 | } 10 | 11 | NAKED CKBOOL CKRenderObject::IsToBeRendered() { 12 | JUMPV(0x5c); 13 | } 14 | 15 | NAKED void CKRenderObject::SetZOrder(int Z) { 16 | JUMPV(0x60); 17 | } 18 | 19 | NAKED int CKRenderObject::GetZOrder() { 20 | JUMPV(0x64); 21 | } 22 | 23 | NAKED CKBOOL CKRenderObject::IsToBeRenderedLast() { 24 | JUMPV(0x68); 25 | } 26 | 27 | NAKED CKBOOL CKRenderObject::AddPreRenderCallBack(CK_RENDEROBJECT_CALLBACK Function, void* Argument, CKBOOL Temp, CKBOOL ModifyRenderPipeline) { 28 | JUMPV(0x6c); 29 | } 30 | 31 | NAKED CKBOOL CKRenderObject::RemovePreRenderCallBack(CK_RENDEROBJECT_CALLBACK Function, void* Argument) { 32 | JUMPV(0x70); 33 | } 34 | 35 | NAKED CKBOOL CKRenderObject::SetRenderCallBack(CK_RENDEROBJECT_CALLBACK Function, void* Argument) { 36 | JUMPV(0x74); 37 | } 38 | 39 | NAKED CKBOOL CKRenderObject::RemoveRenderCallBack() { 40 | JUMPV(0x78); 41 | } 42 | 43 | NAKED CKBOOL CKRenderObject::AddPostRenderCallBack(CK_RENDEROBJECT_CALLBACK Function, void* Argument, CKBOOL Temp, CKBOOL ModifyRenderPipeline) { 44 | JUMPV(0x7c); 45 | } 46 | 47 | NAKED CKBOOL CKRenderObject::RemovePostRenderCallBack(CK_RENDEROBJECT_CALLBACK Function, void* Argument) { 48 | JUMPV(0x80); 49 | } 50 | 51 | NAKED void CKRenderObject::RemoveAllCallbacks() { 52 | JUMPV(0x84); 53 | } 54 | -------------------------------------------------------------------------------- /virtools/CKPathManager.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "CKBaseManager.h" 4 | 5 | typedef enum CK_PATHMANAGER_CATEGORY { 6 | BITMAP_PATH_IDX = 0, // Category index for bitmaps paths 7 | DATA_PATH_IDX = 1, // Category index for datas paths 8 | SOUND_PATH_IDX = 2 // Category index for sounds paths 9 | } CK_PATHMANAGER_CATEGORY; 10 | 11 | class BML_EXPORT CKPathManager : public CKBaseManager { 12 | public: 13 | int AddCategory(const XString& cat); 14 | CKERROR RemoveCategory(int catIdx); 15 | int GetCategoryCount(); 16 | CKERROR GetCategoryName(int catIdx, XString& catName); 17 | int GetCategoryIndex(const XString& cat); 18 | CKERROR RenameCategory(int catIdx, const XString& newName); 19 | int AddPath(int catIdx, const XString& path); 20 | CKERROR RemovePath(int catIdx, int pathIdx); 21 | CKERROR SwapPaths(int catIdx, int pathIdx1, int pathIdx2); 22 | int GetPathCount(int catIdx); 23 | CKERROR GetPathName(int catIdx, int pathIdx, XString& path); 24 | int GetPathIndex(int catIdx, const XString& path); 25 | CKERROR RenamePath(int catIdx, int pathIdx, const XString& path); 26 | CKERROR ResolveFileName(XString& file, int catIdx, int startIdx = -1); 27 | BOOL PathIsAbsolute(const XString& file); 28 | BOOL PathIsUNC(const XString& file); 29 | BOOL PathIsURL(const XString& file); 30 | BOOL PathIsFile(const XString& file); 31 | void RemoveEscapedSpace(char* str); 32 | void AddEscapedSpace(const XString& str); 33 | const XString GetVirtoolsTemporaryFolder(); 34 | 35 | protected: 36 | CKPathManager() {}; 37 | ~CKPathManager() {}; 38 | }; -------------------------------------------------------------------------------- /virtools/CKBeObject.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "CKDef.h" 4 | #include "CKSceneObject.h" 5 | 6 | struct BML_EXPORT CKAttributeVal { 7 | CKAttributeType AttribType; 8 | CK_ID Parameter; 9 | }; 10 | 11 | class BML_EXPORT CKBeObject : public CKSceneObject { 12 | public: 13 | void ExecuteBehaviors(float delta); 14 | 15 | CKBOOL IsInGroup(CKGroup* group); 16 | 17 | CKBOOL HasAttribute(CKAttributeType AttribType); 18 | CKBOOL SetAttribute(CKAttributeType AttribType, CK_ID parameter = 0); 19 | CKBOOL RemoveAttribute(CKAttributeType AttribType); 20 | CKParameterOut* GetAttributeParameter(CKAttributeType AttribType); 21 | 22 | int GetAttributeCount(); 23 | int GetAttributeType(int index); 24 | CKParameterOut* GetAttributeParameterByIndex(int index); 25 | void GetAttributeList(CKAttributeVal* liste); 26 | void RemoveAllAttributes(); 27 | 28 | CKERROR AddScript(CKBehavior* ckb); 29 | CKBehavior* RemoveScript(CK_ID id); 30 | CKBehavior* RemoveScript(int pos); 31 | CKERROR RemoveAllScripts(); 32 | CKBehavior* GetScript(int pos); 33 | int GetScriptCount(); 34 | 35 | int GetPriority(); 36 | void SetPriority(int priority); 37 | 38 | int GetLastFrameMessageCount(); 39 | CKMessage* GetLastFrameMessage(int pos); 40 | 41 | void SetAsWaitingForMessages(CKBOOL wait = TRUE); 42 | CKBOOL IsWaitingForMessages(); 43 | int CallBehaviorCallbackFunction(CKDWORD Message, CKGUID* behguid = NULL); 44 | float GetLastExecutionTime(); 45 | 46 | protected: 47 | CKBeObject() {}; 48 | ~CKBeObject() {}; 49 | 50 | private: 51 | BYTE placeholder[0x4f]; 52 | }; -------------------------------------------------------------------------------- /virtools/CKLevel.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "CKDef.h" 4 | #include "CKBeObject.h" 5 | 6 | class BML_EXPORT CKLevel : public CKBeObject { 7 | public: 8 | CKERROR AddObject(CKObject* obj); 9 | CKERROR RemoveObject(CKObject* obj); 10 | CKERROR RemoveObject(CK_ID obj); 11 | void BeginAddSequence(CKBOOL Begin); 12 | void BeginRemoveSequence(CKBOOL Begin); 13 | 14 | const XObjectPointerArray& ComputeObjectList(CK_CLASSID cid, CKBOOL derived = TRUE); 15 | 16 | CKERROR AddPlace(CKPlace* pl); 17 | CKERROR RemovePlace(CKPlace* pl); 18 | CKPlace* RemovePlace(int pos); 19 | CKPlace* GetPlace(int pos); 20 | int GetPlaceCount(); 21 | 22 | CKERROR AddScene(CKScene* scn); 23 | CKERROR RemoveScene(CKScene* scn); 24 | CKScene* RemoveScene(int pos); 25 | CKScene* GetScene(int pos); 26 | int GetSceneCount(); 27 | 28 | CKERROR SetNextActiveScene(CKScene*, CK_SCENEOBJECTACTIVITY_FLAGS Active = CK_SCENEOBJECTACTIVITY_SCENEDEFAULT, 29 | CK_SCENEOBJECTRESET_FLAGS Reset = CK_SCENEOBJECTRESET_RESET); 30 | 31 | CKERROR LaunchScene(CKScene*, CK_SCENEOBJECTACTIVITY_FLAGS Active = CK_SCENEOBJECTACTIVITY_SCENEDEFAULT, 32 | CK_SCENEOBJECTRESET_FLAGS Reset = CK_SCENEOBJECTRESET_RESET); 33 | CKScene* GetCurrentScene(); 34 | 35 | void AddRenderContext(CKRenderContext*, CKBOOL Main = FALSE); 36 | void RemoveRenderContext(CKRenderContext*); 37 | int GetRenderContextCount(); 38 | CKRenderContext* GetRenderContext(int count); 39 | 40 | CKScene* GetLevelScene(); 41 | 42 | CKERROR Merge(CKLevel* mergedLevel, CKBOOL asScene); 43 | 44 | protected: 45 | CKLevel() {}; 46 | ~CKLevel() {}; 47 | }; -------------------------------------------------------------------------------- /Timer.cpp: -------------------------------------------------------------------------------- 1 | #include "Timer.h" 2 | 3 | Timer::Timer(CKDWORD delay, std::function callback, CKDWORD tick, float time) { 4 | m_callbacktype = ONCE; 5 | m_callback.once = callback; 6 | m_delaytype = TICK; 7 | m_delay.tick = delay; 8 | m_start.tick = tick; 9 | } 10 | 11 | Timer::Timer(CKDWORD delay, std::function callback, CKDWORD tick, float time) { 12 | m_callbacktype = LOOP; 13 | m_callback.loop = callback; 14 | m_delaytype = TICK; 15 | m_delay.tick = delay; 16 | m_start.tick = tick; 17 | } 18 | 19 | Timer::Timer(float delay, std::function callback, CKDWORD tick, float time) { 20 | m_callbacktype = ONCE; 21 | m_callback.once = callback; 22 | m_delaytype = TIME; 23 | m_delay.time = delay; 24 | m_start.time = time; 25 | } 26 | 27 | Timer::Timer(float delay, std::function callback, CKDWORD tick, float time) { 28 | m_callbacktype = LOOP; 29 | m_callback.loop = callback; 30 | m_delaytype = TIME; 31 | m_delay.time = delay; 32 | m_start.time = time; 33 | } 34 | 35 | bool Timer::Process(CKDWORD tick, float time) { 36 | if (m_delaytype == TICK) { 37 | if (m_start.tick + m_delay.tick <= tick) { 38 | if (m_callbacktype == ONCE) { 39 | m_callback.once(); 40 | return false; 41 | } 42 | else { 43 | m_start.tick = tick; 44 | return m_callback.loop(); 45 | } 46 | } 47 | } 48 | else { 49 | if (m_start.time + m_delay.time <= time) { 50 | if (m_callbacktype == ONCE) { 51 | m_callback.once(); 52 | return false; 53 | } 54 | else { 55 | m_start.time = time; 56 | return m_callback.loop(); 57 | } 58 | } 59 | } 60 | return true; 61 | } -------------------------------------------------------------------------------- /virtools/CKBehaviorManager.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "CKDef.h" 4 | #include "CKBaseManager.h" 5 | 6 | #undef GetObject 7 | 8 | #define CKM_BASE 0 9 | #define CKM_BEHAVIORPRESAVE CKM_BASE + 1 10 | #define CKM_BEHAVIORDELETE CKM_BASE + 2 11 | #define CKM_BEHAVIORATTACH CKM_BASE + 3 12 | #define CKM_BEHAVIORDETACH CKM_BASE + 4 13 | #define CKM_BEHAVIORPAUSE CKM_BASE + 5 14 | #define CKM_BEHAVIORRESUME CKM_BASE + 6 15 | #define CKM_BEHAVIORCREATE CKM_BASE + 7 16 | #define CKM_BEHAVIORRESET CKM_BASE + 9 17 | #define CKM_BEHAVIORPOSTSAVE CKM_BASE + 10 18 | #define CKM_BEHAVIORLOAD CKM_BASE + 11 19 | #define CKM_BEHAVIOREDITED CKM_BASE + 12 20 | #define CKM_BEHAVIORSETTINGSEDITED CKM_BASE + 13 21 | #define CKM_BEHAVIORREADSTATE CKM_BASE + 14 22 | #define CKM_BEHAVIORNEWSCENE CKM_BASE + 15 23 | #define CKM_BEHAVIORACTIVATESCRIPT CKM_BASE + 16 24 | #define CKM_BEHAVIORDEACTIVATESCRIPT CKM_BASE + 17 25 | #define CKM_BEHAVIORRESETINBREAKBPOINT CKM_BASE + 18 26 | #define CKM_MAX_BEHAVIOR_CALLBACKS CKM_BASE + 19 27 | 28 | class BML_EXPORT CKBehaviorManager : public CKBaseManager { 29 | public: 30 | CKERROR Execute(float delta); 31 | CKERROR AddObject(CKBeObject* b); 32 | CKERROR RemoveObject(CKBeObject* b); 33 | int GetObjectsCount(); 34 | CKERROR RemoveAllObjects(); 35 | CKBeObject* GetObject(int pos); 36 | CKERROR AddObjectNextFrame(CKBeObject* b); 37 | CKERROR RemoveObjectNextFrame(CKBeObject* b); 38 | int GetBehaviorMaxIteration(); 39 | void SetBehaviorMaxIteration(int n); 40 | 41 | protected: 42 | CKBehaviorManager() {}; 43 | ~CKBehaviorManager() {}; 44 | }; -------------------------------------------------------------------------------- /virtools/CKAll.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "CKDef.h" 4 | 5 | #include "XArray.h" 6 | #include "XBitArray.h" 7 | #include "XClassArray.h" 8 | #include "XHashFun.h" 9 | #include "XHashTable.h" 10 | #include "XObjectArray.h" 11 | #include "XSArray.h" 12 | #include "XSHashTable.h" 13 | 14 | #include "CKGlobals.h" 15 | #include "CKBaseManager.h" 16 | #include "CKAttributeManager.h" 17 | #include "CKBehaviorManager.h" 18 | #include "CKCollisionManager.h" 19 | #include "CKInputManager.h" 20 | #include "CKMessageManager.h" 21 | #include "CKParameterManager.h" 22 | #include "CKPathManager.h" 23 | #include "CKRenderManager.h" 24 | #include "CKSoundManager.h" 25 | #include "CKTimeManager.h" 26 | #include "CKBehaviorPrototype.h" 27 | #include "CKBitmapData.h" 28 | #include "CKContext.h" 29 | #include "CKMessage.h" 30 | #include "CKObject.h" 31 | #include "CKBehaviorIO.h" 32 | #include "CKRenderContext.h" 33 | #include "CKSceneObject.h" 34 | #include "CKBeObject.h" 35 | #include "CKDataArray.h" 36 | #include "CKGroup.h" 37 | #include "CKLevel.h" 38 | #include "CKMaterial.h" 39 | #include "CKMesh.h" 40 | #include "CKParameter.h" 41 | #include "CKParameterIn.h" 42 | #include "CKParameterOperation.h" 43 | #include "CKPluginManager.h" 44 | #include "CKRenderObject.h" 45 | #include "CK2dEntity.h" 46 | #include "CKSprite.h" 47 | #include "CKSpriteText.h" 48 | #include "CKCamera.h" 49 | #include "CKLight.h" 50 | #include "CKSprite3D.h" 51 | #include "CKScene.h" 52 | #include "CKSound.h" 53 | #include "CKTexture.h" 54 | #include "CKBehavior.h" 55 | #include "CKStateObject.h" 56 | #include "CKObjectArray.h" 57 | #include "CKObjectDeclaration.h" 58 | #include "CKDependencies.h" 59 | #include "CK2dCurve.h" 60 | #include "CK2dCurvePoint.h" -------------------------------------------------------------------------------- /virtools/CKBehaviorIO.cpp: -------------------------------------------------------------------------------- 1 | #include "CKBehaviorIO.h" 2 | 3 | void CKBehaviorIO::SetType(int Type) { 4 | GET_MEM(0xc, CKDWORD) &= ~CK_OBJECT_IOTYPEMASK; 5 | GET_MEM(0xc, CKDWORD) |= Type; 6 | } 7 | 8 | int CKBehaviorIO::GetType() { 9 | return GET_MEM(0xc, CKDWORD) & CK_OBJECT_IOTYPEMASK; 10 | } 11 | 12 | void CKBehaviorIO::Activate(CKBOOL Active) { 13 | if (Active) 14 | GET_MEM(0xc, CKDWORD) |= CK_BEHAVIORIO_ACTIVE; 15 | else GET_MEM(0xc, CKDWORD) &= ~CK_BEHAVIORIO_ACTIVE; 16 | } 17 | 18 | CKBOOL CKBehaviorIO::IsActive() { 19 | return (GET_MEM(0xc, CKDWORD) & CK_BEHAVIORIO_ACTIVE); 20 | } 21 | 22 | CKBehavior* CKBehaviorIO::GetOwner() { 23 | RETURN_MEM(0x1c, CKBehavior*); 24 | } 25 | 26 | XSObjectPointerArray* CKBehaviorIO::GetLinks() { 27 | RETURN_MEMPTR(0x14, XSObjectPointerArray); 28 | } 29 | 30 | 31 | NAKED CKERROR CKBehaviorLink::SetOutBehaviorIO(CKBehaviorIO* ckbioin) { 32 | JUMP(0x24006BDA); 33 | } 34 | 35 | NAKED CKERROR CKBehaviorLink::SetInBehaviorIO(CKBehaviorIO* ckbioout) { 36 | JUMP(0x24006B92); 37 | } 38 | 39 | CKBehaviorIO* CKBehaviorLink::GetOutBehaviorIO() { 40 | RETURN_MEM(0x20, CKBehaviorIO*); 41 | } 42 | 43 | CKBehaviorIO* CKBehaviorLink::GetInBehaviorIO() { 44 | RETURN_MEM(0x1c, CKBehaviorIO*); 45 | } 46 | 47 | int CKBehaviorLink::GetActivationDelay() { 48 | RETURN_MEM(0x14, short); 49 | } 50 | 51 | void CKBehaviorLink::SetActivationDelay(int delay) { 52 | SET_MEM(0x14, short, delay); 53 | } 54 | 55 | void CKBehaviorLink::ResetActivationDelay() { 56 | SET_MEM(0x14, short, GET_MEM(0x16, short)); 57 | } 58 | 59 | void CKBehaviorLink::SetInitialActivationDelay(int delay) { 60 | SET_MEM(0x16, short, delay); 61 | } 62 | 63 | int CKBehaviorLink::GetInitialActivationDelay() { 64 | RETURN_MEM(0x16, short); 65 | } -------------------------------------------------------------------------------- /virtools/CKBehaviorPrototype.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "CKDef.h" 4 | 5 | typedef int (*CKBEHAVIORFCT) (const CKBehaviorContext& context); 6 | typedef CKERROR(*CKBEHAVIORCALLBACKFCT) (const CKBehaviorContext& context); 7 | 8 | class BML_EXPORT CKBehaviorPrototype { 9 | public: 10 | int DeclareInput(CKSTRING name); 11 | int DeclareOutput(CKSTRING name); 12 | int DeclareInParameter(CKSTRING name, CKGUID guid_type, CKSTRING defaultval = NULL); 13 | int DeclareInParameter(CKSTRING name, CKGUID guid_type, void* defaultval, int valsize); 14 | int DeclareOutParameter(CKSTRING name, CKGUID guid_type, CKSTRING defaultval = NULL); 15 | int DeclareOutParameter(CKSTRING name, CKGUID guid_type, void* defaultval, int valsize); 16 | int DeclareLocalParameter(CKSTRING name, CKGUID guid_type, CKSTRING defaultval = NULL); 17 | int DeclareLocalParameter(CKSTRING name, CKGUID guid_type, void* defaultval, int valsize); 18 | int DeclareSetting(CKSTRING name, CKGUID guid_type, CKSTRING defaultval = NULL); 19 | int DeclareSetting(CKSTRING name, CKGUID guid_type, void* defaultval, int valsize); 20 | void SetGuid(CKGUID guid); 21 | CKGUID GetGuid(); 22 | void SetFlags(CK_BEHAVIORPROTOTYPE_FLAGS flags); 23 | CK_BEHAVIORPROTOTYPE_FLAGS GetFlags(); 24 | void SetApplyToClassID(CK_CLASSID cid); 25 | CK_CLASSID GetApplyToClassID(); 26 | void SetFunction(CKBEHAVIORFCT fct); 27 | CKBEHAVIORFCT GetFunction(); 28 | void SetBehaviorCallbackFct(CKBEHAVIORCALLBACKFCT fct, CKDWORD CallbackMask = CKCB_BEHAVIORALL, void* param = NULL); 29 | CKBEHAVIORCALLBACKFCT GetBehaviorCallbackFct(); 30 | void SetBehaviorFlags(CK_BEHAVIOR_FLAGS flags); 31 | CK_BEHAVIOR_FLAGS GetBehaviorFlags(); 32 | CKSTRING GetName(); 33 | 34 | protected: 35 | CKBehaviorPrototype() {}; 36 | ~CKBehaviorPrototype() {}; 37 | }; -------------------------------------------------------------------------------- /minhook/hde/pstdint.h: -------------------------------------------------------------------------------- 1 | /* 2 | * MinHook - The Minimalistic API Hooking Library for x64/x86 3 | * Copyright (C) 2009-2017 Tsuda Kageyu. All rights reserved. 4 | * 5 | * Redistribution and use in source and binary forms, with or without 6 | * modification, are permitted provided that the following conditions 7 | * are met: 8 | * 9 | * 1. Redistributions of source code must retain the above copyright 10 | * notice, this list of conditions and the following disclaimer. 11 | * 2. Redistributions in binary form must reproduce the above copyright 12 | * notice, this list of conditions and the following disclaimer in the 13 | * documentation and/or other materials provided with the distribution. 14 | * 15 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR "AS IS" AND ANY EXPRESS OR 16 | * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 17 | * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 18 | * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, 19 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 20 | * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 21 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 22 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 23 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 24 | * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25 | */ 26 | 27 | #pragma once 28 | 29 | #include 30 | 31 | // Integer types for HDE. 32 | typedef INT8 int8_t; 33 | typedef INT16 int16_t; 34 | typedef INT32 int32_t; 35 | typedef INT64 int64_t; 36 | typedef UINT8 uint8_t; 37 | typedef UINT16 uint16_t; 38 | typedef UINT32 uint32_t; 39 | typedef UINT64 uint64_t; 40 | -------------------------------------------------------------------------------- /virtools/CKInputManager.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "CKBaseManager.h" 4 | 5 | #define NO_KEY 0 6 | #define KEY_PRESSED 1 7 | #define KEY_RELEASED 2 8 | 9 | #define KS_IDLE 0 10 | #define KS_PRESSED 1 11 | #define KS_RELEASED 2 12 | 13 | class BML_EXPORT CKInputManager : public CKBaseManager { 14 | public: 15 | void EnableKeyboardRepetition(CKBOOL iEnable = TRUE); 16 | CKBOOL IsKeyboardRepetitionEnabled(); 17 | CKBOOL IsKeyDown(CKDWORD iKey, CKDWORD* oStamp = NULL); 18 | CKBOOL IsKeyUp(CKDWORD iKey); 19 | CKBOOL IsKeyToggled(CKDWORD iKey, CKDWORD* oStamp = NULL); 20 | void GetKeyName(CKDWORD iKey, char* oKeyName); 21 | CKDWORD GetKeyFromName(char* iKeyName); 22 | unsigned char* GetKeyboardState(); 23 | CKBOOL IsKeyboardAttached(); 24 | int GetNumberOfKeyInBuffer(); 25 | int GetKeyFromBuffer(int i, CKDWORD& oKey, CKDWORD* oTimeStamp = NULL); 26 | CKBOOL IsMouseButtonDown(CK_MOUSEBUTTON iButton); 27 | CKBOOL IsMouseClicked(CK_MOUSEBUTTON iButton); 28 | CKBOOL IsMouseToggled(CK_MOUSEBUTTON iButton); 29 | void GetMouseButtonsState(CKBYTE oStates[4]); 30 | void GetMousePosition(Vx2DVector& oPosition, CKBOOL iAbsolute = TRUE); 31 | void GetMouseRelativePosition(VxVector& oPosition); 32 | CKBOOL IsMouseAttached(); 33 | CKBOOL IsJoystickAttached(int iJoystick); 34 | void GetJoystickPosition(int iJoystick, VxVector* oPosition); 35 | void GetJoystickRotation(int iJoystick, VxVector* oRotation); 36 | void GetJoystickSliders(int iJoystick, Vx2DVector* oPosition); 37 | void GetJoystickPointOfViewAngle(int iJoystick, float* oAngle); 38 | CKDWORD GetJoystickButtonsState(int iJoystick); 39 | CKBOOL IsJoystickButtonDown(int iJoystick, int iButton); 40 | void Pause(BOOL pause); 41 | void ShowCursor(BOOL iShow); 42 | BOOL GetCursorVisibility(); 43 | 44 | protected: 45 | CKInputManager() {}; 46 | ~CKInputManager() {}; 47 | }; -------------------------------------------------------------------------------- /virtools/CKObjectArray.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "CKDef.h" 4 | 5 | typedef int (*OBJECTARRAYCMPFCT)(CKObject* elem1, CKObject* elem2); 6 | 7 | class BML_EXPORT CKObjectArray { 8 | public: 9 | int GetCount(); 10 | int GetCurrentPos(); 11 | CKObject* GetData(CKContext* context); 12 | CK_ID GetDataId(); 13 | CK_ID SetDataId(CK_ID id); 14 | CK_ID SetData(CKObject* obj); 15 | void Reset(); 16 | CKBOOL PtrSeek(CKObject*); 17 | CKBOOL IDSeek(CK_ID id); 18 | CKBOOL PositionSeek(int Pos); 19 | CK_ID Seek(int Pos); 20 | void Next(); 21 | void Previous(); 22 | int GetPosition(CKObject* o); 23 | int GetPosition(CK_ID id); 24 | CK_ID PtrFind(CKObject*); 25 | CK_ID IDFind(CK_ID id); 26 | CK_ID PositionFind(int pos); 27 | void InsertFront(CKObject* obj); 28 | void InsertRear(CKObject* obj); 29 | void InsertAt(CKObject* obj); 30 | CKBOOL AddIfNotHere(CKObject* obj); 31 | CKBOOL AddIfNotHereSorted(CKObject* obj, OBJECTARRAYCMPFCT CmpFct, CKContext* context); 32 | void InsertFront(CK_ID id); 33 | void InsertRear(CK_ID id); 34 | void InsertAt(CK_ID id); 35 | CKBOOL AddIfNotHere(CK_ID id); 36 | CKBOOL AddIfNotHereSorted(CK_ID id, OBJECTARRAYCMPFCT CmpFct, CKContext* context); 37 | CKERROR Append(CKObjectArray* array); 38 | CK_ID RemoveFront(); 39 | CK_ID RemoveRear(); 40 | CK_ID RemoveAt(); 41 | CKBOOL Remove(CKObject*); 42 | CKBOOL Remove(CK_ID id); 43 | void Clear(); 44 | CKBOOL EndOfList(); 45 | CKBOOL ListEmpty(); 46 | void SwapCurrentWithNext(); 47 | void SwapCurrentWithPrevious(); 48 | CKBOOL Check(CKContext* context); 49 | void Sort(OBJECTARRAYCMPFCT CmpFct, CKContext* context); 50 | void InsertSorted(CKObject* o, OBJECTARRAYCMPFCT CmpFct, CKContext* context); 51 | void InsertSorted(CK_ID id, OBJECTARRAYCMPFCT CmpFct, CKContext* context); 52 | 53 | protected: 54 | CKObjectArray() {}; 55 | ~CKObjectArray() {}; 56 | }; -------------------------------------------------------------------------------- /BML_Release.py: -------------------------------------------------------------------------------- 1 | import os 2 | import shutil 3 | 4 | version = [0, 0, 0] 5 | 6 | with open('BuildVer.h', 'r') as fin: 7 | for i in range(3): 8 | version[i] = int(fin.readline().split(' ')[-1]) 9 | 10 | shutil.rmtree('..\\dist', True) 11 | 12 | dist_dir = '..\\dist\\BML-' + str(version[0]) + '.' + str(version[1]) + '.' + str(version[2]) + '-dev' 13 | os.makedirs(dist_dir) 14 | 15 | os.makedirs(dist_dir + '\\include\\BML') 16 | shutil.copy('BMLAll.h', dist_dir + '\\include\\BML') 17 | shutil.copy('BuildVer.h', dist_dir + '\\include\\BML') 18 | shutil.copy('ExecuteBB.h', dist_dir + '\\include\\BML') 19 | shutil.copy('Export.h', dist_dir + '\\include\\BML') 20 | shutil.copy('Gui.h', dist_dir + '\\include\\BML') 21 | shutil.copy('IBML.h', dist_dir + '\\include\\BML') 22 | shutil.copy('ICommand.h', dist_dir + '\\include\\BML') 23 | shutil.copy('IConfig.h', dist_dir + '\\include\\BML') 24 | shutil.copy('ILogger.h', dist_dir + '\\include\\BML') 25 | shutil.copy('IMod.h', dist_dir + '\\include\\BML') 26 | shutil.copy('RegisterBB.h', dist_dir + '\\include\\BML') 27 | shutil.copy('ScriptHelper.h', dist_dir + '\\include\\BML') 28 | shutil.copy('Version.h', dist_dir + '\\include\\BML') 29 | shutil.copytree('virtools', dist_dir + '\\include\\BML\\virtools', ignore = shutil.ignore_patterns('*.cpp')) 30 | 31 | os.makedirs(dist_dir + '\\bin\\Release') 32 | os.makedirs(dist_dir + '\\lib\\Release') 33 | 34 | shutil.copy('D:\\Program Files (x86)\\Ballance\\BuildingBlocks\\BML.dll', dist_dir + '\\bin\\Release') 35 | shutil.copy('D:\\Program Files (x86)\\Ballance\\BuildingBlocks\\BML.lib', dist_dir + '\\lib\\Release') 36 | 37 | os.makedirs(dist_dir + '\\bin\\Debug') 38 | os.makedirs(dist_dir + '\\lib\\Debug') 39 | 40 | shutil.copy('Debug\\BML.dll', dist_dir + '\\bin\\Debug') 41 | shutil.copy('Debug\\BML.lib', dist_dir + '\\lib\\Debug') 42 | 43 | shutil.make_archive(dist_dir, 'zip', dist_dir) 44 | -------------------------------------------------------------------------------- /virtools/CKTexture.cpp: -------------------------------------------------------------------------------- 1 | #include "CKTexture.h" 2 | 3 | NAKED CKBOOL CKTexture::Create(int Width, int Height, int BPP, int Slot) { 4 | JUMPV(0x54); 5 | } 6 | 7 | NAKED CKBOOL CKTexture::LoadImage(CKSTRING Name, int Slot) { 8 | JUMPV(0x58); 9 | } 10 | 11 | NAKED CKBOOL CKTexture::LoadMovie(CKSTRING Name) { 12 | JUMPV(0x5c); 13 | } 14 | 15 | NAKED CKBOOL CKTexture::SetAsCurrent(CKRenderContext* Dev, CKBOOL Clamping, int TextureStage) { 16 | JUMPV(0x60); 17 | } 18 | 19 | NAKED CKBOOL CKTexture::Restore(CKBOOL Clamp) { 20 | JUMPV(0x64); 21 | } 22 | 23 | NAKED CKBOOL CKTexture::SystemToVideoMemory(CKRenderContext* Dev, CKBOOL Clamping) { 24 | JUMPV(0x68); 25 | } 26 | 27 | NAKED CKBOOL CKTexture::FreeVideoMemory() { 28 | JUMPV(0x6c); 29 | } 30 | 31 | NAKED CKBOOL CKTexture::IsInVideoMemory() { 32 | JUMPV(0x70); 33 | } 34 | 35 | NAKED CKBOOL CKTexture::CopyContext(CKRenderContext* ctx, VxRect* Src, VxRect* Dest, int CubeMapFace) { 36 | JUMPV(0x74); 37 | } 38 | 39 | NAKED CKBOOL CKTexture::UseMipmap(int UseMipMap) { 40 | JUMPV(0x78); 41 | } 42 | 43 | NAKED int CKTexture::GetMipmapCount() { 44 | JUMPV(0x7c); 45 | } 46 | 47 | NAKED CKBOOL CKTexture::GetVideoTextureDesc(VxImageDescEx& desc) { 48 | JUMPV(0x80); 49 | } 50 | 51 | NAKED VX_PIXELFORMAT CKTexture::GetVideoPixelFormat() { 52 | JUMPV(0x84); 53 | } 54 | 55 | NAKED CKBOOL CKTexture::GetSystemTextureDesc(VxImageDescEx& desc) { 56 | JUMPV(0x88); 57 | } 58 | 59 | NAKED void CKTexture::SetDesiredVideoFormat(VX_PIXELFORMAT pf) { 60 | JUMPV(0x8c); 61 | } 62 | 63 | NAKED VX_PIXELFORMAT CKTexture::GetDesiredVideoFormat() { 64 | JUMPV(0x90); 65 | } 66 | 67 | NAKED CKBOOL CKTexture::FlushSurfacePtr(int Slot) { 68 | JUMPV(0x94); 69 | } 70 | 71 | NAKED BOOL CKTexture::GetUserMipMapLevel(int Level, VxImageDescEx& ResultImage) { 72 | JUMPV(0x98); 73 | } 74 | 75 | NAKED int CKTexture::GetRstTextureIndex() { 76 | JUMPV(0x9c); 77 | } 78 | -------------------------------------------------------------------------------- /virtools/CKMessageManager.cpp: -------------------------------------------------------------------------------- 1 | #include "CKMessageManager.h" 2 | 3 | NAKED CKMessageType CKMessageManager::AddMessageType(CKSTRING MsgName) { 4 | JUMP(0x2400D85B); 5 | } 6 | 7 | NAKED CKSTRING CKMessageManager::GetMessageTypeName(CKMessageType MsgType) { 8 | JUMP(0x2400D924); 9 | } 10 | 11 | NAKED int CKMessageManager::GetMessageTypeCount() { 12 | JUMP(0x2400D951); 13 | } 14 | 15 | NAKED void CKMessageManager::RenameMessageType(CKMessageType MsgType, CKSTRING NewName) { 16 | JUMP(0x2400D95B); 17 | } 18 | 19 | NAKED void CKMessageManager::RenameMessageType(CKSTRING OldName, CKSTRING NewName) { 20 | JUMP(0x2400D983); 21 | } 22 | 23 | NAKED CKERROR CKMessageManager::SendMessage(CKMessage* msg) { 24 | JUMP(0x2400DF0B); 25 | } 26 | 27 | NAKED CKMessage* CKMessageManager::SendMessageSingle(CKMessageType MsgType, CKBeObject* dest, CKBeObject* sender) { 28 | JUMP(0x2400D211); 29 | } 30 | 31 | NAKED CKMessage* CKMessageManager::SendMessageGroup(CKMessageType MsgType, CKGroup* group, CKBeObject* sender) { 32 | JUMP(0x2400D248); 33 | } 34 | 35 | NAKED CKMessage* CKMessageManager::SendMessageBroadcast(CKMessageType MsgType, CK_CLASSID id, CKBeObject* sender) { 36 | JUMP(0x2400D28A); 37 | } 38 | 39 | NAKED CKERROR CKMessageManager::RegisterWait(CKMessageType MsgType, CKBehavior* behav, int OutputToActivate, CKBeObject* obj) { 40 | JUMP(0x2400D99F); 41 | } 42 | 43 | NAKED CKERROR CKMessageManager::RegisterWait(CKSTRING MsgName, CKBehavior* behav, int OutputToActivate, CKBeObject* obj) { 44 | JUMP(0x2400DA82); 45 | } 46 | 47 | NAKED CKERROR CKMessageManager::UnRegisterWait(CKMessageType MsgType, CKBehavior* behav, int OutputToActivate) { 48 | JUMP(0x2400DAA6); 49 | } 50 | 51 | NAKED CKERROR CKMessageManager::UnRegisterWait(CKSTRING MsgName, CKBehavior* behav, int OutputToActivate) { 52 | JUMP(0x2400DB39); 53 | } 54 | 55 | NAKED CKERROR CKMessageManager::RegisterDefaultMessages() { 56 | JUMP(0x2400D83E); 57 | } 58 | -------------------------------------------------------------------------------- /BML.sln: -------------------------------------------------------------------------------- 1 | 2 | Microsoft Visual Studio Solution File, Format Version 12.00 3 | # Visual Studio Version 16 4 | VisualStudioVersion = 16.0.29926.136 5 | MinimumVisualStudioVersion = 10.0.40219.1 6 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "BML", "BML.vcxproj", "{AA1E451D-C0D7-415F-8186-4CE370C75314}" 7 | EndProject 8 | Global 9 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 10 | Debug|x64 = Debug|x64 11 | Debug|x86 = Debug|x86 12 | DebugRelease|x64 = DebugRelease|x64 13 | DebugRelease|x86 = DebugRelease|x86 14 | Release|x64 = Release|x64 15 | Release|x86 = Release|x86 16 | EndGlobalSection 17 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 18 | {AA1E451D-C0D7-415F-8186-4CE370C75314}.Debug|x64.ActiveCfg = Debug|x64 19 | {AA1E451D-C0D7-415F-8186-4CE370C75314}.Debug|x64.Build.0 = Debug|x64 20 | {AA1E451D-C0D7-415F-8186-4CE370C75314}.Debug|x86.ActiveCfg = Debug|Win32 21 | {AA1E451D-C0D7-415F-8186-4CE370C75314}.Debug|x86.Build.0 = Debug|Win32 22 | {AA1E451D-C0D7-415F-8186-4CE370C75314}.DebugRelease|x64.ActiveCfg = DebugRelease|x64 23 | {AA1E451D-C0D7-415F-8186-4CE370C75314}.DebugRelease|x64.Build.0 = DebugRelease|x64 24 | {AA1E451D-C0D7-415F-8186-4CE370C75314}.DebugRelease|x86.ActiveCfg = DebugRelease|Win32 25 | {AA1E451D-C0D7-415F-8186-4CE370C75314}.DebugRelease|x86.Build.0 = DebugRelease|Win32 26 | {AA1E451D-C0D7-415F-8186-4CE370C75314}.Release|x64.ActiveCfg = Release|x64 27 | {AA1E451D-C0D7-415F-8186-4CE370C75314}.Release|x64.Build.0 = Release|x64 28 | {AA1E451D-C0D7-415F-8186-4CE370C75314}.Release|x86.ActiveCfg = Release|Win32 29 | {AA1E451D-C0D7-415F-8186-4CE370C75314}.Release|x86.Build.0 = Release|Win32 30 | EndGlobalSection 31 | GlobalSection(SolutionProperties) = preSolution 32 | HideSolutionNode = FALSE 33 | EndGlobalSection 34 | GlobalSection(ExtensibilityGlobals) = postSolution 35 | SolutionGuid = {6F20D446-AF3D-4098-A9BE-1CFE4F509336} 36 | EndGlobalSection 37 | EndGlobal 38 | -------------------------------------------------------------------------------- /minhook/buffer.h: -------------------------------------------------------------------------------- 1 | /* 2 | * MinHook - The Minimalistic API Hooking Library for x64/x86 3 | * Copyright (C) 2009-2017 Tsuda Kageyu. 4 | * All rights reserved. 5 | * 6 | * Redistribution and use in source and binary forms, with or without 7 | * modification, are permitted provided that the following conditions 8 | * are met: 9 | * 10 | * 1. Redistributions of source code must retain the above copyright 11 | * notice, this list of conditions and the following disclaimer. 12 | * 2. Redistributions in binary form must reproduce the above copyright 13 | * notice, this list of conditions and the following disclaimer in the 14 | * documentation and/or other materials provided with the distribution. 15 | * 16 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 17 | * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED 18 | * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A 19 | * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER 20 | * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 21 | * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 22 | * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 23 | * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF 24 | * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 25 | * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 26 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 27 | */ 28 | 29 | #pragma once 30 | 31 | // Size of each memory slot. 32 | #if defined(_M_X64) || defined(__x86_64__) 33 | #define MEMORY_SLOT_SIZE 64 34 | #else 35 | #define MEMORY_SLOT_SIZE 32 36 | #endif 37 | 38 | VOID InitializeBuffer(VOID); 39 | VOID UninitializeBuffer(VOID); 40 | LPVOID AllocateBuffer(LPVOID pOrigin); 41 | VOID FreeBuffer(LPVOID pBuffer); 42 | BOOL IsExecutableAddress(LPVOID pAddress); 43 | -------------------------------------------------------------------------------- /virtools/VxSphere.h: -------------------------------------------------------------------------------- 1 | 2 | /*************************************************************************/ 3 | /* File : VxSphere.h */ 4 | /* Author : Aymeric Bard */ 5 | /* */ 6 | /* Virtools SDK */ 7 | /* Copyright (c) Virtools 2000, All Rights Reserved. */ 8 | /*************************************************************************/ 9 | #ifndef VXSPHERE_H 10 | #define VXSPHERE_H 11 | 12 | 13 | /********************************************************** 14 | {filename:VxSphere} 15 | Name: VxSphere 16 | 17 | Remarks: 18 | A 3D Sphere defined by a center and a radius. 19 | 20 | 21 | 22 | See Also : 23 | *********************************************************/ 24 | class VxSphere 25 | { 26 | public: 27 | VxSphere() {} 28 | VxSphere(const VxVector& iCenter, const float iRadius):m_Center(iCenter),m_Radius(iRadius) {} 29 | 30 | 31 | // Accessors 32 | VxVector& Center() {return m_Center;} 33 | const VxVector& Center() const {return m_Center;} 34 | float& Radius() {return m_Radius;} 35 | const float& Radius() const {return m_Radius;} 36 | 37 | bool 38 | IsPointInside(const VxVector& iPoint) 39 | { 40 | return (SquareMagnitude(iPoint - m_Center) <= (m_Radius*m_Radius)); 41 | } 42 | 43 | bool 44 | IsBoxTotallyInside(const VxBbox& iBox) 45 | { 46 | float totalDist = 0; 47 | 48 | VxVector minD = m_Center - iBox.Min; 49 | VxVector maxD = m_Center - iBox.Max; 50 | minD.Absolute(); 51 | maxD.Absolute(); 52 | maxD = Maximize(minD, maxD); 53 | return (maxD.SquareMagnitude() < (m_Radius * m_Radius)); 54 | } 55 | 56 | 57 | bool 58 | IsPointOnSurface(const VxVector& iPoint) 59 | { 60 | return (SquareMagnitude(iPoint - m_Center) == (m_Radius*m_Radius)); 61 | } 62 | 63 | bool operator == (const VxSphere& iSphere) const { 64 | return (m_Radius == iSphere.m_Radius) && (m_Center == iSphere.m_Center); 65 | } 66 | 67 | protected: 68 | VxVector m_Center; 69 | float m_Radius; 70 | }; 71 | 72 | 73 | #endif // VXSPHERE_H -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Ballance Mod Loader 2 | 3 | ![BML](figures/bml.png) 4 | 5 | If you play Minecraft and have heard of Forge, then you would easily understand what BML means to Ballance. 6 | 7 | Ballance Mod Loader is a free, open-source modding API used to extend the content of original Ballance game. 8 | 9 | For more information, please read [The Wiki](https://github.com/Gamepiaynmo/BallanceModLoader/wiki). 10 | 11 | The source code of built-in mods is in [another repository](https://github.com/Gamepiaynmo/BML-Mods). 12 | 13 | ### Installing 14 | 15 | Go to the Release page and download the latest build (Do not download the dev package unless you would like to develop your own mod). Extract all contents into your Ballance root folder. After that you can find the following files in your Ballance directory: 16 | 17 | * BML.dll in BuildingBlocks directory; 18 | * ModLoader directory. 19 | 20 | Before launching the game please check if the compatibility mode of Player.exe is at least Windows XP (Windows 7, Windows 8, etc.). If everything goes well, then you can see the message of BML on the top. 21 | 22 | ![Hello World](figures/HelloWorld.png) 23 | 24 | ### Uninstalling 25 | 26 | Go to Ballance root folder, and delete BML.dll in BuildingBlocks directory. If you would like to remove the entire data of BML (installed mods, maps, configs etc.), delete the ModLoader folder as well. 27 | 28 | ### Building 29 | 30 | * Clone this repository. 31 | * Open BML.sln with Visual Studio 2019. 32 | * Go to Project Properties -> C/C++ -> Precompile Header, and disable it. 33 | * Set building configuration to Release, x86. 34 | * Change the output path to what you want. 35 | * Build the solution. 36 | 37 | ### Troubleshooting 38 | 39 | If your game crashes after installing BML, or you have met bugs playing with BML, please raise a new Issue at GitHub, with the following information: 40 | 41 | * Describe the condition you met in detail; 42 | * Screenshots to help explaining if possible; 43 | * Paste the content of ModLoader.log (in ModLoader folder). -------------------------------------------------------------------------------- /virtools/CK2dEntity.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "CKDef.h" 4 | #include "CKRenderObject.h" 5 | 6 | class BML_EXPORT CK2dEntity : public CKRenderObject { 7 | public: 8 | CKERROR GetPosition(Vx2DVector& vect, CKBOOL hom = FALSE, CK2dEntity* ref = NULL); 9 | void SetPosition(const Vx2DVector& vect, CKBOOL hom = FALSE, CKBOOL KeepChildren = FALSE, CK2dEntity* ref = NULL); 10 | CKERROR GetSize(Vx2DVector& vect, CKBOOL hom = FALSE); 11 | void SetSize(const Vx2DVector& vect, CKBOOL hom = FALSE, CKBOOL KeepChildren = FALSE); 12 | void SetRect(const VxRect& rect, CKBOOL KeepChildren = FALSE); 13 | void GetRect(VxRect& rect); 14 | CKERROR SetHomogeneousRect(const VxRect& rect, CKBOOL KeepChildren = FALSE); 15 | CKERROR GetHomogeneousRect(VxRect& rect); 16 | void SetSourceRect(const VxRect& rect); 17 | void GetSourceRect(VxRect& rect); 18 | void UseSourceRect(CKBOOL Use = TRUE); 19 | CKBOOL IsUsingSourceRect(); 20 | void SetPickable(CKBOOL Pick = TRUE); 21 | CKBOOL IsPickable(); 22 | void SetBackground(CKBOOL back = TRUE); 23 | CKBOOL IsBackground(); 24 | void SetClipToParent(CKBOOL clip = TRUE); 25 | CKBOOL IsClipToParent(); 26 | void SetFlags(CKDWORD Flags); 27 | void ModifyFlags(CKDWORD add, CKDWORD remove = 0); 28 | CKDWORD GetFlags(); 29 | void EnableRatioOffset(CKBOOL Ratio = TRUE); 30 | CKBOOL IsRatioOffset(); 31 | CKBOOL SetParent(CK2dEntity* parent); 32 | CK2dEntity* GetParent() const; 33 | int GetChildrenCount() const; 34 | CK2dEntity* GetChild(int i) const; 35 | CK2dEntity* HierarchyParser(CK2dEntity* current) const; 36 | void SetMaterial(CKMaterial* mat); 37 | CKMaterial* GetMaterial(); 38 | void SetHomogeneousCoordinates(CKBOOL Coord = TRUE); 39 | CKBOOL IsHomogeneousCoordinates(); 40 | void EnableClipToCamera(CKBOOL Clip = TRUE); 41 | CKBOOL IsClippedToCamera(); 42 | CKERROR Render(CKRenderContext* context); 43 | CKERROR Draw(CKRenderContext* context); 44 | void GetExtents(VxRect& srcrect, VxRect& rect); 45 | void SetExtents(const VxRect& srcrect, const VxRect& rect); 46 | void RestoreInitialSize(); 47 | }; -------------------------------------------------------------------------------- /virtools/CKParameterIn.cpp: -------------------------------------------------------------------------------- 1 | #include "CKParameterIn.h" 2 | #include "CKParameter.h" 3 | 4 | CKERROR CKParameterIn::GetValue(void* buf) { 5 | CKParameter* p = GetRealSource(); 6 | if (!p) return CKERR_NOTINITIALIZED; 7 | return p->GetValue(buf); 8 | } 9 | 10 | void* CKParameterIn::GetReadDataPtr() { 11 | CKParameter* p = GetRealSource(); 12 | if (!p) return NULL; 13 | return p->GetReadDataPtr(); 14 | } 15 | 16 | CKParameterIn* CKParameterIn::GetSharedSource() { 17 | return (!(GET_MEM(0xc, CKDWORD) & CK_PARAMETERIN_SHARED)) ? NULL : GET_MEM(0x18, CKParameterIn*); 18 | } 19 | 20 | CKParameter* CKParameterIn::GetRealSource() { 21 | if (GET_MEM(0xc, CKDWORD) & CK_PARAMETERIN_SHARED) { 22 | if (GET_MEM(0x18, CKParameterIn*)) return GET_MEM(0x18, CKParameterIn*)->GetRealSource(); 23 | } 24 | else return GET_MEM(0x18, CKParameter*); 25 | 26 | return NULL; 27 | } 28 | 29 | CKParameter* CKParameterIn::GetDirectSource() { 30 | if (GET_MEM(0xc, CKDWORD) & CK_PARAMETERIN_SHARED) return NULL; 31 | return GET_MEM(0x18, CKParameter*); 32 | } 33 | 34 | NAKED CKERROR CKParameterIn::SetDirectSource(CKParameter* param) { 35 | JUMP(0x24008C7A); 36 | } 37 | 38 | NAKED CKERROR CKParameterIn::ShareSourceWith(CKParameterIn* param) { 39 | JUMP(0x24008BE6); 40 | } 41 | 42 | NAKED void CKParameterIn::SetType(CKParameterType type, CKBOOL UpdateSource, CKSTRING NewName) { 43 | JUMP(0x24008D10); 44 | } 45 | 46 | NAKED void CKParameterIn::SetGUID(CKGUID guid, CKBOOL UpdateSource, CKSTRING NewName) { 47 | JUMP(0x24008DC0); 48 | } 49 | 50 | CKParameterType CKParameterIn::GetType() { 51 | if (GET_MEM(0x1c, CKParameterTypeDesc*)) return GET_MEM(0x1c, CKParameterTypeDesc*)->Index; 52 | else return -1; 53 | } 54 | 55 | CKGUID CKParameterIn::GetGUID() { 56 | if (GET_MEM(0x1c, CKParameterTypeDesc*)) return GET_MEM(0x1c, CKParameterTypeDesc*)->Guid; 57 | else return CKGUID(0); 58 | } 59 | 60 | void CKParameterIn::SetOwner(CKObject* o) { 61 | SET_MEM(0x14, CKObject*, o); 62 | } 63 | 64 | CKObject* CKParameterIn::GetOwner() { 65 | RETURN_MEM(0x14, CKObject*); 66 | } -------------------------------------------------------------------------------- /virtools/CKObjectDeclaration.cpp: -------------------------------------------------------------------------------- 1 | #include "CKObjectDeclaration.h" 2 | 3 | NAKED void CKObjectDeclaration::SetDescription(CKSTRING Description) { 4 | JUMP(0x24021525); 5 | } 6 | 7 | NAKED CKSTRING CKObjectDeclaration::GetDescription() { 8 | JUMP(0x24021542); 9 | } 10 | 11 | NAKED void CKObjectDeclaration::SetGuid(CKGUID guid) { 12 | JUMP(0x24006F78); 13 | } 14 | 15 | NAKED CKGUID CKObjectDeclaration::GetGuid() { 16 | JUMP(0x24006F89); 17 | } 18 | 19 | NAKED void CKObjectDeclaration::SetType(int type) { 20 | JUMP(0x24021580); 21 | } 22 | 23 | NAKED int CKObjectDeclaration::GetType() { 24 | JUMP(0x2402158A); 25 | } 26 | 27 | NAKED void CKObjectDeclaration::NeedManager(CKGUID Manager) { 28 | JUMP(0x24021546); 29 | } 30 | 31 | NAKED void CKObjectDeclaration::SetCreationFunction(CKDLL_CREATEPROTOFUNCTION f) { 32 | JUMP(0x24006FA5); 33 | } 34 | 35 | NAKED CKDLL_CREATEPROTOFUNCTION CKObjectDeclaration::GetCreationFunction() { 36 | JUMP(0x2402158E); 37 | } 38 | 39 | NAKED void CKObjectDeclaration::SetAuthorGuid(CKGUID guid) { 40 | JUMP(0x24021592); 41 | } 42 | 43 | NAKED CKGUID CKObjectDeclaration::GetAuthorGuid() { 44 | JUMP(0x240098A9); 45 | } 46 | 47 | NAKED void CKObjectDeclaration::SetAuthorName(CKSTRING Name) { 48 | JUMP(0x240215A3); 49 | } 50 | 51 | NAKED CKSTRING CKObjectDeclaration::GetAuthorName() { 52 | JUMP(0x24017AE9); 53 | } 54 | 55 | NAKED void CKObjectDeclaration::SetVersion(CKDWORD verion) { 56 | JUMP(0x240081A1); 57 | } 58 | 59 | NAKED CKDWORD CKObjectDeclaration::GetVersion() { 60 | JUMP(0x2400CEFF); 61 | } 62 | 63 | NAKED void CKObjectDeclaration::SetCompatibleClassId(CK_CLASSID id) { 64 | JUMP(0x24006F9B); 65 | } 66 | 67 | NAKED CK_CLASSID CKObjectDeclaration::GetCompatibleClassId() { 68 | JUMP(0x24035F34); 69 | } 70 | 71 | NAKED void CKObjectDeclaration::SetCategory(CKSTRING cat) { 72 | JUMP(0x240215C0); 73 | } 74 | 75 | NAKED CKSTRING CKObjectDeclaration::GetCategory() { 76 | JUMP(0x2401B69E); 77 | } 78 | 79 | NAKED CKSTRING CKObjectDeclaration::GetName() { 80 | JUMP(0x2403B0F3); 81 | } 82 | 83 | NAKED int CKObjectDeclaration::GetPluginIndex() { 84 | JUMP(0x2403B119); 85 | } 86 | -------------------------------------------------------------------------------- /virtools/VxQuaternion.cpp: -------------------------------------------------------------------------------- 1 | #include "CKDef.h" 2 | #include "VxQuaternion.h" 3 | 4 | NAKED VxQuaternion Vx3DQuaternionSnuggle(VxQuaternion* Quat, VxVector* Scale) { 5 | JUMP(0x2429CAE0); 6 | } 7 | 8 | NAKED VxQuaternion Vx3DQuaternionFromMatrix(const VxMatrix& Mat) { 9 | JUMP(0x2429D530); 10 | } 11 | 12 | NAKED VxQuaternion Vx3DQuaternionConjugate(const VxQuaternion& Quat) { 13 | JUMP(0x2429D590); 14 | } 15 | 16 | NAKED VxQuaternion Vx3DQuaternionMultiply(const VxQuaternion& QuatL, const VxQuaternion& QuatR) { 17 | JUMP(0x2429D5C0); 18 | } 19 | 20 | NAKED VxQuaternion Vx3DQuaternionDivide(const VxQuaternion& P, const VxQuaternion& Q) { 21 | JUMP(0x2429D650); 22 | } 23 | 24 | NAKED VxQuaternion Slerp(float Theta, const VxQuaternion& Quat1, const VxQuaternion& Quat2) { 25 | JUMP(0x2429C8F0); 26 | } 27 | 28 | NAKED VxQuaternion Squad(float Theta, const VxQuaternion& Quat1, const VxQuaternion& Quat1Out, const VxQuaternion& Quat2In, const VxQuaternion& Quat2) { 29 | JUMP(0x2429CA70); 30 | } 31 | 32 | NAKED VxQuaternion LnDif(const VxQuaternion& P, const VxQuaternion& Q) { 33 | JUMP(0x2429C6E0); 34 | } 35 | 36 | NAKED VxQuaternion Ln(const VxQuaternion& Quat) { 37 | JUMP(0x2429C650); 38 | } 39 | 40 | NAKED VxQuaternion Exp(const VxQuaternion& Quat) { 41 | JUMP(0x2429C720); 42 | } 43 | 44 | NAKED void VxQuaternion::FromMatrix(const VxMatrix& Mat, BOOL MatIsUnit, BOOL RestoreMat) { 45 | JUMP(0x2429C420); 46 | } 47 | 48 | NAKED void VxQuaternion::ToMatrix(VxMatrix& Mat) const { 49 | JUMP(0x242836E0); 50 | } 51 | 52 | NAKED void VxQuaternion::Multiply(const VxQuaternion& Quat) { 53 | JUMP(0x2429C7B0); 54 | } 55 | 56 | NAKED void VxQuaternion::FromRotation(const VxVector& Vector, float Angle) { 57 | JUMP(0x2429C840); 58 | } 59 | 60 | NAKED void VxQuaternion::ToRotation(VxVector& Vector, float& Angle) { 61 | UNDEFINED; 62 | } 63 | 64 | NAKED void VxQuaternion::FromEulerAngles(float eax, float eay, float eaz) { 65 | JUMP(0x2429C880); 66 | } 67 | 68 | NAKED void VxQuaternion::ToEulerAngles(float* eax, float* eay, float* eaz) const { 69 | JUMP(0x2429C8C0); 70 | } 71 | 72 | NAKED void VxQuaternion::Normalize() { 73 | JUMP(0x2429D6E0); 74 | } 75 | -------------------------------------------------------------------------------- /dllmain.cpp: -------------------------------------------------------------------------------- 1 | #include "BMLAll.h" 2 | #include 3 | #include "virtools/CKAll.h" 4 | #include "RegisterBB.h" 5 | 6 | ModLoader *ModLoader::m_instance = nullptr; 7 | 8 | void HookPrototypeRuntime() { 9 | BYTE data[] = { 0xeb, 0x75 }; 10 | ModLoader::WriteMemory(reinterpret_cast(0x240388F4), &data, sizeof(data)); 11 | } 12 | 13 | CKERROR InitInstance(CKContext* context) { 14 | ModLoader::m_instance->Init(); 15 | if (!ModLoader::m_instance->Inited()) 16 | delete ModLoader::m_instance; 17 | return CK_OK; 18 | } 19 | 20 | CKERROR ExitInstance(CKContext* context) { 21 | if (ModLoader::m_instance != nullptr) { 22 | ModLoader::m_instance->Release(); 23 | delete ModLoader::m_instance; 24 | } 25 | return CK_OK; 26 | } 27 | 28 | BOOL APIENTRY DllMain(HMODULE hModule, DWORD ul_reason_for_call, LPVOID lpReserved) { 29 | switch (ul_reason_for_call) { 30 | case DLL_PROCESS_ATTACH: 31 | HookPrototypeRuntime(); 32 | break; 33 | case DLL_PROCESS_DETACH: 34 | ExitInstance(GetCKContext(0)); 35 | break; 36 | } 37 | 38 | return TRUE; 39 | } 40 | 41 | CKPluginInfo g_pInfo; 42 | 43 | EXTERN_C_START 44 | 45 | BML_EXPORT int CKGetPluginInfoCount() { return 1; } 46 | 47 | BML_EXPORT CKPluginInfo* CKGetPluginInfo(int Index) { 48 | g_pInfo.m_Author = "Gamepiaynmo"; 49 | g_pInfo.m_Description = "Ballance Mod Loader"; 50 | g_pInfo.m_Extension = ""; 51 | g_pInfo.m_Type = CKPLUGIN_BEHAVIOR_DLL; 52 | g_pInfo.m_Version = BML_MAJOR_VER << 16 | BML_MINOR_VER; 53 | g_pInfo.m_InitInstanceFct = InitInstance; 54 | g_pInfo.m_ExitInstanceFct = ExitInstance; 55 | g_pInfo.m_GUID = CKGUID(0x6229385d, 0x197331db); 56 | g_pInfo.m_Summary = "Mod Loader for Ballance"; 57 | return &g_pInfo; 58 | } 59 | 60 | BML_EXPORT void RegisterBehaviorDeclarations(XObjectDeclarationArray* reg) { 61 | RegisterBBs(reg); 62 | 63 | if (ModLoader::m_instance == nullptr) { 64 | ModLoader::m_instance = new ModLoader(); 65 | 66 | ModLoader::m_instance->PreloadMods(); 67 | ModLoader::m_instance->RegisterModBBs(reg); 68 | } 69 | } 70 | 71 | EXTERN_C_END -------------------------------------------------------------------------------- /virtools/CK2dCurvePoint.cpp: -------------------------------------------------------------------------------- 1 | #include "CK2dCurvePoint.h" 2 | 3 | NAKED CK2dCurve* CK2dCurvePoint::GetCurve() const { 4 | JUMP(0x2403B129); 5 | } 6 | 7 | NAKED float CK2dCurvePoint::GetBias() const { 8 | JUMP(0x2403B12C); 9 | } 10 | 11 | NAKED void CK2dCurvePoint::SetBias(float b) { 12 | JUMP(0x2403B130); 13 | } 14 | 15 | NAKED float CK2dCurvePoint::GetTension() const { 16 | JUMP(0x2403B13F); 17 | } 18 | 19 | NAKED void CK2dCurvePoint::SetTension(float t) { 20 | JUMP(0x2403B143); 21 | } 22 | 23 | NAKED float CK2dCurvePoint::GetContinuity() const { 24 | JUMP(0x2403B152); 25 | } 26 | 27 | NAKED void CK2dCurvePoint::SetContinuity(float c) { 28 | JUMP(0x2403B156); 29 | } 30 | 31 | NAKED CKBOOL CK2dCurvePoint::IsLinear() const { 32 | JUMP(0x2403B165); 33 | } 34 | 35 | NAKED void CK2dCurvePoint::SetLinear(CKBOOL linear) { 36 | JUMP(0x2403B16C); 37 | } 38 | 39 | NAKED void CK2dCurvePoint::UseTCB(CKBOOL use) { 40 | JUMP(0x2403B185); 41 | } 42 | 43 | NAKED CKBOOL CK2dCurvePoint::IsTCB() const { 44 | JUMP(0x2403B199); 45 | } 46 | 47 | NAKED float CK2dCurvePoint::GetLength() const { 48 | JUMP(0x2403B1A2); 49 | } 50 | 51 | NAKED Vx2DVector& CK2dCurvePoint::GetPosition() { 52 | JUMP(0x2403B1A6); 53 | } 54 | 55 | NAKED void CK2dCurvePoint::SetPosition(const Vx2DVector& pos) { 56 | JUMP(0x2403B1AA); 57 | } 58 | 59 | NAKED Vx2DVector& CK2dCurvePoint::GetInTangent() { 60 | JUMP(0x2403B1C1); 61 | } 62 | 63 | NAKED Vx2DVector& CK2dCurvePoint::GetOutTangent() { 64 | JUMP(0x2403B1C5); 65 | } 66 | 67 | NAKED void CK2dCurvePoint::SetInTangent(const Vx2DVector& in) { 68 | JUMP(0x2403B1C9); 69 | } 70 | 71 | NAKED void CK2dCurvePoint::SetOutTangent(const Vx2DVector& out) { 72 | JUMP(0x2403B1E0); 73 | } 74 | 75 | NAKED void CK2dCurvePoint::NotifyUpdate() { 76 | JUMP(0x2400263F); 77 | } 78 | 79 | NAKED void CK2dCurvePoint::SetCurve(CK2dCurve* curve) { 80 | JUMP(0x2403B1F7); 81 | } 82 | 83 | NAKED void CK2dCurvePoint::SetLength(float l) { 84 | JUMP(0x2403B200); 85 | } 86 | 87 | NAKED Vx2DVector& CK2dCurvePoint::GetRCurvePos() { 88 | JUMP(0x2403B20A); 89 | } 90 | 91 | NAKED void CK2dCurvePoint::SetRCurvePos(Vx2DVector& v) { 92 | JUMP(0x2403B20E); 93 | } 94 | 95 | NAKED void CK2dCurvePoint::Read(CKStateChunk* chunk) { 96 | JUMP(0x24002646); 97 | } 98 | -------------------------------------------------------------------------------- /virtools/CKLight.cpp: -------------------------------------------------------------------------------- 1 | #include "CKLight.h" 2 | 3 | NAKED void CKLight::SetColor(const VxColor& c) { 4 | JUMPV(0x1d4); 5 | } 6 | 7 | NAKED const VxColor& CKLight::GetColor() { 8 | JUMPV(0x1d8); 9 | } 10 | 11 | NAKED void CKLight::SetConstantAttenuation(float Value) { 12 | JUMPV(0x1dc); 13 | } 14 | 15 | NAKED void CKLight::SetLinearAttenuation(float Value) { 16 | JUMPV(0x1e0); 17 | } 18 | 19 | NAKED void CKLight::SetQuadraticAttenuation(float Value) { 20 | JUMPV(0x1e4); 21 | } 22 | 23 | NAKED float CKLight::GetConstantAttenuation() { 24 | JUMPV(0x1e8); 25 | } 26 | 27 | NAKED float CKLight::GetLinearAttenuation() { 28 | JUMPV(0x1ec); 29 | } 30 | 31 | NAKED float CKLight::GetQuadraticAttenuation() { 32 | JUMPV(0x1f0); 33 | } 34 | 35 | NAKED VXLIGHT_TYPE CKLight::GetType() { 36 | JUMPV(0x1f4); 37 | } 38 | 39 | NAKED void CKLight::SetType(VXLIGHT_TYPE Type) { 40 | JUMPV(0x1f8); 41 | } 42 | 43 | NAKED float CKLight::GetRange() { 44 | JUMPV(0x1fc); 45 | } 46 | 47 | NAKED void CKLight::SetRange(float Value) { 48 | JUMPV(0x200); 49 | } 50 | 51 | NAKED float CKLight::GetHotSpot() { 52 | JUMPV(0x204); 53 | } 54 | 55 | NAKED float CKLight::GetFallOff() { 56 | JUMPV(0x208); 57 | } 58 | 59 | NAKED void CKLight::SetHotSpot(float Value) { 60 | JUMPV(0x20c); 61 | } 62 | 63 | NAKED void CKLight::SetFallOff(float Value) { 64 | JUMPV(0x210); 65 | } 66 | 67 | NAKED float CKLight::GetFallOffShape() { 68 | JUMPV(0x214); 69 | } 70 | 71 | NAKED void CKLight::SetFallOffShape(float Value) { 72 | JUMPV(0x218); 73 | } 74 | 75 | NAKED void CKLight::Active(CKBOOL Active) { 76 | JUMPV(0x21c); 77 | } 78 | 79 | NAKED CKBOOL CKLight::GetActivity() { 80 | JUMPV(0x220); 81 | } 82 | 83 | NAKED void CKLight::SetSpecularFlag(CKBOOL Specular) { 84 | JUMPV(0x224); 85 | } 86 | 87 | NAKED CKBOOL CKLight::GetSpecularFlag() { 88 | JUMPV(0x228); 89 | } 90 | 91 | NAKED CK3dEntity* CKLight::GetTarget() { 92 | JUMPV(0x22c); 93 | } 94 | 95 | NAKED void CKLight::SetTarget(CK3dEntity* target) { 96 | JUMPV(0x230); 97 | } 98 | 99 | NAKED float CKLight::GetLightPower() { 100 | JUMPV(0x234); 101 | } 102 | 103 | NAKED void CKLight::SetLightPower(float power) { 104 | JUMPV(0x238); 105 | } 106 | -------------------------------------------------------------------------------- /virtools/CKPathManager.cpp: -------------------------------------------------------------------------------- 1 | #include "CKPathManager.h" 2 | 3 | NAKED int CKPathManager::AddCategory(const XString& cat) { 4 | JUMP(0x24013759); 5 | } 6 | 7 | NAKED CKERROR CKPathManager::RemoveCategory(int catIdx) { 8 | JUMP(0x24013843); 9 | } 10 | 11 | NAKED int CKPathManager::GetCategoryCount() { 12 | JUMP(0x24013866); 13 | } 14 | 15 | NAKED CKERROR CKPathManager::GetCategoryName(int catIdx, XString& catName) { 16 | JUMP(0x24013873); 17 | } 18 | 19 | NAKED int CKPathManager::GetCategoryIndex(const XString& cat) { 20 | JUMP(0x240138AC); 21 | } 22 | 23 | NAKED CKERROR CKPathManager::RenameCategory(int catIdx, const XString& newName) { 24 | JUMP(0x24013890); 25 | } 26 | 27 | NAKED int CKPathManager::AddPath(int catIdx, const XString& path) { 28 | JUMP(0x24013936); 29 | } 30 | 31 | NAKED CKERROR CKPathManager::RemovePath(int catIdx, int pathIdx) { 32 | JUMP(0x240139FC); 33 | } 34 | 35 | NAKED CKERROR CKPathManager::SwapPaths(int catIdx, int pathIdx1, int pathIdx2) { 36 | JUMP(0x24013A27); 37 | } 38 | 39 | NAKED int CKPathManager::GetPathCount(int catIdx) { 40 | JUMP(0x240138F8); 41 | } 42 | 43 | NAKED CKERROR CKPathManager::GetPathName(int catIdx, int pathIdx, XString& path) { 44 | JUMP(0x24013911); 45 | } 46 | 47 | NAKED int CKPathManager::GetPathIndex(int catIdx, const XString& path) { 48 | JUMP(0x24013980); 49 | } 50 | 51 | NAKED CKERROR CKPathManager::RenamePath(int catIdx, int pathIdx, const XString& path) { 52 | JUMP(0x240139D8); 53 | } 54 | 55 | NAKED CKERROR CKPathManager::ResolveFileName(XString& file, int catIdx, int startIdx) { 56 | JUMP(0x24013B3C); 57 | } 58 | 59 | NAKED BOOL CKPathManager::PathIsAbsolute(const XString& file) { 60 | JUMP(0x24014068); 61 | } 62 | 63 | NAKED BOOL CKPathManager::PathIsUNC(const XString& file) { 64 | JUMP(0x240140B0); 65 | } 66 | 67 | NAKED BOOL CKPathManager::PathIsURL(const XString& file) { 68 | JUMP(0x240140FE); 69 | } 70 | 71 | NAKED BOOL CKPathManager::PathIsFile(const XString& file) { 72 | JUMP(0x24014185); 73 | } 74 | 75 | NAKED void CKPathManager::RemoveEscapedSpace(char* str) { 76 | JUMP(0x24013AE1); 77 | } 78 | 79 | NAKED void CKPathManager::AddEscapedSpace(const XString& str) { 80 | JUMP(0x24013A92); 81 | } 82 | 83 | NAKED const XString CKPathManager::GetVirtoolsTemporaryFolder() { 84 | JUMP(0x24013A51); 85 | } 86 | -------------------------------------------------------------------------------- /virtools/CKParameter.cpp: -------------------------------------------------------------------------------- 1 | #include "CKParameter.h" 2 | 3 | NAKED void CKParameter::CheckClass(CKParameterTypeDesc* iType) { 4 | JUMPV(0x68); 5 | } 6 | 7 | NAKED CKObject* CKParameter::GetOwner() { 8 | JUMP(0x2400CEFF); 9 | } 10 | 11 | NAKED void CKParameter::SetOwner(CKObject* o) { 12 | JUMPV(0x64); 13 | } 14 | 15 | NAKED CKGUID CKParameter::GetGUID() { 16 | JUMP(0x24008019); 17 | } 18 | 19 | NAKED CK_CLASSID CKParameter::GetParameterClassID() { 20 | JUMP(0x2400803B); 21 | } 22 | 23 | NAKED CKParameterType CKParameter::GetType() { 24 | JUMP(0x2400800B); 25 | } 26 | 27 | NAKED CKBOOL CKParameter::IsCompatibleWith(CKParameter* param) { 28 | JUMP(0x24008049); 29 | } 30 | 31 | NAKED void CKParameter::SetType(CKParameterType type) { 32 | JUMP(0x24008073); 33 | } 34 | 35 | NAKED void CKParameter::SetGUID(CKGUID guid) { 36 | JUMP(0x2400817C); 37 | } 38 | 39 | NAKED CKERROR CKParameter::CopyValue(CKParameter* param, CKBOOL UpdateParam) { 40 | JUMPV(0x50); 41 | } 42 | 43 | NAKED int CKParameter::GetDataSize() { 44 | JUMP(0x2400829A); 45 | } 46 | 47 | NAKED void* CKParameter::GetReadDataPtr(CKBOOL update) { 48 | JUMPV(0x54); 49 | } 50 | 51 | NAKED int CKParameter::GetStringValue(CKSTRING Value, CKBOOL update) { 52 | JUMPV(0x60); 53 | } 54 | 55 | NAKED CKERROR CKParameter::GetValue(void* buf, CKBOOL update) { 56 | JUMPV(0x48); 57 | } 58 | 59 | NAKED CKObject* CKParameter::GetValueObject(CKBOOL update) { 60 | JUMP(0x240081AB); 61 | } 62 | 63 | NAKED void* CKParameter::GetWriteDataPtr() { 64 | JUMPV(0x58); 65 | } 66 | 67 | NAKED CKERROR CKParameter::SetStringValue(CKSTRING Value) { 68 | JUMPV(0x5c); 69 | } 70 | 71 | NAKED CKERROR CKParameter::SetValue(const void* buf, int size) { 72 | JUMPV(0x4c); 73 | } 74 | 75 | 76 | NAKED void CKParameterOut::DataChanged() { 77 | JUMP(0x2400A4D3); 78 | } 79 | 80 | NAKED CKERROR CKParameterOut::AddDestination(CKParameter* param, CKBOOL CheckType) { 81 | JUMP(0x2400A363); 82 | } 83 | 84 | NAKED void CKParameterOut::RemoveDestination(CKParameter* param) { 85 | JUMP(0x2400A3E5); 86 | } 87 | 88 | NAKED int CKParameterOut::GetDestinationCount() { 89 | JUMP(0x24002962); 90 | } 91 | 92 | NAKED CKParameter* CKParameterOut::GetDestination(int pos) { 93 | JUMP(0x240029E3); 94 | } 95 | 96 | NAKED void CKParameterOut::RemoveAllDestinations() { 97 | JUMP(0x2400A3CF); 98 | } -------------------------------------------------------------------------------- /virtools/CKTimeManager.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "CKDef.h" 4 | #include "CKBaseManager.h" 5 | 6 | typedef enum CK_FRAMERATE_LIMITS 7 | { 8 | CK_RATE_NOP = 0x00000000, 9 | CK_BEHRATE_SYNC = 0x00000001, // Behavioral Rate is synchronized to frame rate 10 | CK_BEHRATE_LIMIT = 0x00000004, // Behavioral Rate is limited to a maximum value (see CKTimeManager::SetBehavioralRateLimit) 11 | CK_BEHRATE_MASK = 0x0000000F, // Mask for values concerning behavioral rate 12 | 13 | CK_FRAMERATE_SYNC = 0x00000010, // Frame Rate is synchronized to screen refresh rate (Render function will wait for vertical blank signal) 14 | CK_FRAMERATE_FREE = 0x00000020, // Frame Rate is free. Rendering occurs at the maximum possible rate. 15 | CK_FRAMERATE_LIMIT = 0x00000040, // Frame Rate is limited to a maximum value (see CKTimeManager::SetFrameRateLimit) 16 | CK_FRAMERATE_MASK = 0x000000F0, // Mask for values concerning frame rate 17 | } CK_FRAMERATE_LIMITS; 18 | 19 | class BML_EXPORT VxTimeProfiler { 20 | public: 21 | void Reset(); 22 | float Current(); 23 | float Split() { 24 | float c = Current(); 25 | Reset(); 26 | return c; 27 | } 28 | 29 | protected: 30 | VxTimeProfiler() {}; 31 | ~VxTimeProfiler() {}; 32 | }; 33 | 34 | class BML_EXPORT CKTimeManager : public CKBaseManager { 35 | public: 36 | CKDWORD GetMainTickCount(); 37 | float GetTime(); 38 | float GetLastDeltaTime(); 39 | float GetLastDeltaTimeFree(); 40 | float GetAbsoluteTime(); 41 | void SetTimeScaleFactor(float mulfactor); 42 | float GetTimeScaleFactor(); 43 | CKDWORD GetLimitOptions(); 44 | float GetFrameRateLimit(); 45 | float GetBehavioralRateLimit(); 46 | float GetMinimumDeltaTime(); 47 | float GetMaximumDeltaTime(); 48 | void ChangeLimitOptions(CK_FRAMERATE_LIMITS FpsOptions, CK_FRAMERATE_LIMITS BehOptions = CK_RATE_NOP); 49 | void SetFrameRateLimit(float FRLimit); 50 | void SetBehavioralRateLimit(float BRLimit); 51 | void SetMinimumDeltaTime(float DtMin); 52 | void SetMaximumDeltaTime(float DtMax); 53 | void SetLastDeltaTime(float DtSet); 54 | void SetLastDeltaTimeFree(float DtSet); 55 | void SetAbsoluteTime(float time); 56 | void SetMainTickCount(CKDWORD tick); 57 | void GetTimeToWaitForLimits(float& TimeBeforeRender, float& TimeBeforeBeh); 58 | void ResetChronos(CKBOOL RenderChrono, CKBOOL BehavioralChrono); 59 | 60 | protected: 61 | CKTimeManager() {}; 62 | ~CKTimeManager() {}; 63 | }; -------------------------------------------------------------------------------- /IMod.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "virtools/CKAll.h" 4 | #include "IBML.h" 5 | #include "IConfig.h" 6 | #include "BuildVer.h" 7 | 8 | #define DECLARE_BML_VERSION \ 9 | virtual BMLVersion GetBMLVersion() override { return { BML_MAJOR_VER, BML_MINOR_VER, BML_BUILD_VER }; } 10 | 11 | struct BMLVersion { 12 | BMLVersion() : major(BML_MAJOR_VER), minor(BML_MINOR_VER), build(BML_BUILD_VER) {} 13 | BMLVersion(int mj, int mn, int bd) : major(mj), minor(mn), build(bd) {} 14 | int major, minor, build; 15 | bool operator <(const BMLVersion& o) { 16 | if (major == o.major) { 17 | if (minor == o.minor) 18 | return build < o.build; 19 | return minor < o.minor; 20 | } 21 | return major < o.major; 22 | } 23 | 24 | bool operator >=(const BMLVersion& o) { 25 | return !(*this < o); 26 | } 27 | }; 28 | 29 | class BML_EXPORT IMod : public IMessageReceiver { 30 | public: 31 | IMod(IBML* bml) : m_bml(bml) {}; 32 | virtual ~IMod(); 33 | 34 | virtual CKSTRING GetID() = 0; 35 | virtual CKSTRING GetVersion() = 0; 36 | virtual CKSTRING GetName() = 0; 37 | virtual CKSTRING GetAuthor() = 0; 38 | virtual CKSTRING GetDescription() = 0; 39 | virtual BMLVersion GetBMLVersion() = 0; 40 | 41 | virtual void OnLoad() {}; 42 | virtual void OnUnload() {}; 43 | virtual void OnModifyConfig(CKSTRING category, CKSTRING key, IProperty* prop) {}; 44 | 45 | virtual void OnLoadObject(CKSTRING filename, BOOL isMap, CKSTRING masterName, 46 | CK_CLASSID filterClass, BOOL addtoscene, BOOL reuseMeshes, BOOL reuseMaterials, 47 | BOOL dynamic, XObjectArray* objArray, CKObject* masterObj) {}; 48 | virtual void OnLoadScript(CKSTRING filename, CKBehavior* script) {}; 49 | 50 | virtual void OnProcess() {}; 51 | virtual void OnRender(CK_RENDER_FLAGS flags) {}; 52 | 53 | virtual void OnCheatEnabled(bool enable) {}; 54 | 55 | virtual void OnPhysicalize(CK3dEntity* target, CKBOOL fixed, float friction, float elasticity, float mass, 56 | CKSTRING collGroup, CKBOOL startFrozen, CKBOOL enableColl, CKBOOL calcMassCenter, float linearDamp, 57 | float rotDamp, CKSTRING collSurface, VxVector massCenter, int convexCnt, CKMesh** convexMesh, 58 | int ballCnt, VxVector* ballCenter, float* ballRadius, int concaveCnt, CKMesh** concaveMesh) {}; 59 | virtual void OnUnphysicalize(CK3dEntity* target) {}; 60 | 61 | protected: 62 | virtual ILogger* GetLogger() final; 63 | virtual IConfig* GetConfig() final; 64 | 65 | IBML* m_bml; 66 | 67 | private: 68 | ILogger* m_logger = nullptr; 69 | IConfig* m_config = nullptr; 70 | }; -------------------------------------------------------------------------------- /virtools/CKLevel.cpp: -------------------------------------------------------------------------------- 1 | #include "CKLevel.h" 2 | 3 | NAKED CKERROR CKLevel::AddObject(CKObject* obj) { 4 | JUMP(0x2402C49A); 5 | } 6 | 7 | NAKED CKERROR CKLevel::RemoveObject(CKObject* obj) { 8 | JUMP(0x2402C4DF); 9 | } 10 | 11 | NAKED CKERROR CKLevel::RemoveObject(CK_ID obj) { 12 | JUMP(0x2402C516); 13 | } 14 | 15 | NAKED void CKLevel::BeginAddSequence(CKBOOL Begin) { 16 | JUMP(0x2402C559); 17 | } 18 | 19 | NAKED void CKLevel::BeginRemoveSequence(CKBOOL Begin) { 20 | JUMP(0x2402C56B); 21 | } 22 | 23 | NAKED const XObjectPointerArray& CKLevel::ComputeObjectList(CK_CLASSID cid, CKBOOL derived) { 24 | JUMP(0x2402C57D); 25 | } 26 | 27 | NAKED CKERROR CKLevel::AddPlace(CKPlace* pl) { 28 | JUMP(0x2402C5B0); 29 | } 30 | 31 | NAKED CKERROR CKLevel::RemovePlace(CKPlace* pl) { 32 | JUMP(0x2402C66A); 33 | } 34 | 35 | NAKED CKPlace* CKLevel::RemovePlace(int pos) { 36 | JUMP(0x2402C65A); 37 | } 38 | 39 | NAKED CKPlace* CKLevel::GetPlace(int pos) { 40 | JUMP(0x2402C5D9); 41 | } 42 | 43 | NAKED int CKLevel::GetPlaceCount() { 44 | JUMP(0x2402C623); 45 | } 46 | 47 | NAKED CKERROR CKLevel::AddScene(CKScene* scn) { 48 | JUMP(0x2402C6FB); 49 | } 50 | 51 | NAKED CKERROR CKLevel::RemoveScene(CKScene* scn) { 52 | JUMP(0x2402C6B5); 53 | } 54 | 55 | NAKED CKScene* CKLevel::RemoveScene(int pos) { 56 | JUMP(0x2402C693); 57 | } 58 | 59 | NAKED CKScene* CKLevel::GetScene(int pos) { 60 | JUMP(0x2402C779); 61 | } 62 | 63 | NAKED int CKLevel::GetSceneCount() { 64 | JUMP(0x2402735A); 65 | } 66 | 67 | NAKED CKERROR CKLevel::SetNextActiveScene(CKScene*, CK_SCENEOBJECTACTIVITY_FLAGS Active, CK_SCENEOBJECTRESET_FLAGS Reset) { 68 | JUMP(0x2402C143); 69 | } 70 | 71 | NAKED CKERROR CKLevel::LaunchScene(CKScene*, CK_SCENEOBJECTACTIVITY_FLAGS Active, CK_SCENEOBJECTRESET_FLAGS Reset) { 72 | JUMP(0x2402C168); 73 | } 74 | 75 | NAKED CKScene* CKLevel::GetCurrentScene() { 76 | JUMP(0x2402C137); 77 | } 78 | 79 | NAKED void CKLevel::AddRenderContext(CKRenderContext*, CKBOOL Main) { 80 | JUMP(0x2402C2F7); 81 | } 82 | 83 | NAKED void CKLevel::RemoveRenderContext(CKRenderContext*) { 84 | JUMP(0x2402C407); 85 | } 86 | 87 | NAKED int CKLevel::GetRenderContextCount() { 88 | JUMP(0x2402C472); 89 | } 90 | 91 | NAKED CKRenderContext* CKLevel::GetRenderContext(int count) { 92 | JUMP(0x2402C47C); 93 | } 94 | 95 | NAKED CKScene* CKLevel::GetLevelScene() { 96 | JUMP(0x2402C797); 97 | } 98 | 99 | NAKED CKERROR CKLevel::Merge(CKLevel* mergedLevel, CKBOOL asScene) { 100 | JUMP(0x2402C7A3); 101 | } 102 | -------------------------------------------------------------------------------- /virtools/CKAttributeManager.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "CKDef.h" 4 | #include "CKBaseManager.h" 5 | 6 | typedef void (*CKATTRIBUTECALLBACK) (CKAttributeType AttribType, CKBOOL Set, CKBeObject* obj, void* arg); 7 | 8 | class BML_EXPORT CKAttributeManager : public CKBaseManager { 9 | public: 10 | CKAttributeType RegisterNewAttributeType(CKSTRING Name, CKGUID ParameterType, CK_CLASSID CompatibleCid = CKCID_BEOBJECT, CK_ATTRIBUT_FLAGS flags = CK_ATTRIBUT_SYSTEM); 11 | void UnRegisterAttribute(CKAttributeType AttribType); 12 | void UnRegisterAttribute(CKSTRING atname); 13 | CKSTRING GetAttributeNameByType(CKAttributeType AttribType); 14 | CKAttributeType GetAttributeTypeByName(CKSTRING AttribName); 15 | void SetAttributeNameByType(CKAttributeType AttribType, CKSTRING name); 16 | int GetAttributeCount(); 17 | CKGUID GetAttributeParameterGUID(CKAttributeType AttribType); 18 | CKParameterType GetAttributeParameterType(CKAttributeType AttribType); 19 | CK_CLASSID GetAttributeCompatibleClassId(CKAttributeType AttribType); 20 | CKBOOL IsAttributeIndexValid(CKAttributeType index); 21 | CKBOOL IsCategoryIndexValid(CKAttributeCategory index); 22 | CK_ATTRIBUT_FLAGS GetAttributeFlags(CKAttributeType AttribType); 23 | void SetAttributeCallbackFunction(CKAttributeType AttribType, CKATTRIBUTECALLBACK fct, void* arg); 24 | void SetAttributeDefaultValue(CKAttributeType AttribType, CKSTRING DefaultVal); 25 | CKSTRING GetAttributeDefaultValue(CKAttributeType AttribType); 26 | const XObjectPointerArray& GetAttributeListPtr(CKAttributeType AttribType); 27 | const XObjectPointerArray& GetGlobalAttributeListPtr(CKAttributeType AttribType); 28 | const XObjectPointerArray& FillListByAttributes(CKAttributeType* ListAttrib, int AttribCount); 29 | const XObjectPointerArray& FillListByGlobalAttributes(CKAttributeType* ListAttrib, int AttribCount); 30 | int GetCategoriesCount(); 31 | CKSTRING GetCategoryName(CKAttributeCategory index); 32 | CKAttributeCategory GetCategoryByName(CKSTRING Name); 33 | void SetCategoryName(CKAttributeCategory catType, CKSTRING name); 34 | CKAttributeCategory AddCategory(CKSTRING Category, CKDWORD flags = 0); 35 | void RemoveCategory(CKSTRING Category); 36 | CKDWORD GetCategoryFlags(CKAttributeCategory cat); 37 | CKDWORD GetCategoryFlags(CKSTRING cat); 38 | void SetAttributeCategory(CKAttributeType AttribType, CKSTRING Category); 39 | CKSTRING GetAttributeCategory(CKAttributeType AttribType); 40 | CKAttributeCategory GetAttributeCategoryIndex(CKAttributeType AttribType); 41 | 42 | protected: 43 | CKAttributeManager() {}; 44 | ~CKAttributeManager() {}; 45 | }; -------------------------------------------------------------------------------- /virtools/CKBeObject.cpp: -------------------------------------------------------------------------------- 1 | #include "CKBeObject.h" 2 | 3 | NAKED void CKBeObject::ExecuteBehaviors(float delta) { 4 | JUMP(0x2401AF67); 5 | } 6 | 7 | NAKED CKBOOL CKBeObject::IsInGroup(CKGroup* group) { 8 | JUMP(0x2401B0C6); 9 | } 10 | 11 | NAKED CKBOOL CKBeObject::HasAttribute(CKAttributeType AttribType) { 12 | JUMP(0x2401B39A); 13 | } 14 | 15 | NAKED CKBOOL CKBeObject::SetAttribute(CKAttributeType AttribType, CK_ID parameter) { 16 | JUMP(0x2401B3BC); 17 | } 18 | 19 | NAKED CKBOOL CKBeObject::RemoveAttribute(CKAttributeType AttribType) { 20 | JUMP(0x2401B4FF); 21 | } 22 | 23 | NAKED CKParameterOut* CKBeObject::GetAttributeParameter(CKAttributeType AttribType) { 24 | JUMP(0x2401B5C5); 25 | } 26 | 27 | NAKED int CKBeObject::GetAttributeCount() { 28 | JUMP(0x2401B5FB); 29 | } 30 | 31 | NAKED int CKBeObject::GetAttributeType(int index) { 32 | JUMP(0x2401B5FF); 33 | } 34 | 35 | NAKED CKParameterOut* CKBeObject::GetAttributeParameterByIndex(int index) { 36 | JUMP(0x2401B572); 37 | } 38 | 39 | NAKED void CKBeObject::GetAttributeList(CKAttributeVal* liste) { 40 | JUMP(0x2401B4C3); 41 | } 42 | 43 | NAKED void CKBeObject::RemoveAllAttributes() { 44 | JUMP(0x2401B646); 45 | } 46 | 47 | NAKED CKERROR CKBeObject::AddScript(CKBehavior* ckb) { 48 | JUMP(0x2401B126); 49 | } 50 | 51 | NAKED CKBehavior* CKBeObject::RemoveScript(CK_ID id) { 52 | JUMP(0x2401B2A7); 53 | } 54 | 55 | NAKED CKBehavior* CKBeObject::RemoveScript(int pos) { 56 | JUMP(0x2401B21B); 57 | } 58 | 59 | NAKED CKERROR CKBeObject::RemoveAllScripts() { 60 | JUMP(0x2401B2F1); 61 | } 62 | 63 | NAKED CKBehavior* CKBeObject::GetScript(int pos) { 64 | JUMP(0x2401B0F0); 65 | } 66 | 67 | NAKED int CKBeObject::GetScriptCount() { 68 | JUMP(0x2401B113); 69 | } 70 | 71 | NAKED int CKBeObject::GetPriority() { 72 | JUMP(0x2401B69E); 73 | } 74 | 75 | NAKED void CKBeObject::SetPriority(int priority) { 76 | JUMP(0x2401B6A2); 77 | } 78 | 79 | NAKED int CKBeObject::GetLastFrameMessageCount() { 80 | JUMP(0x2401B33D); 81 | } 82 | 83 | NAKED CKMessage* CKBeObject::GetLastFrameMessage(int pos) { 84 | JUMP(0x2401B350); 85 | } 86 | 87 | NAKED void CKBeObject::SetAsWaitingForMessages(CKBOOL wait) { 88 | JUMP(0x2401B379); 89 | } 90 | 91 | NAKED CKBOOL CKBeObject::IsWaitingForMessages() { 92 | JUMP(0x2401B391); 93 | } 94 | 95 | NAKED int CKBeObject::CallBehaviorCallbackFunction(CKDWORD Message, CKGUID* behguid) { 96 | JUMP(0x2401B06F); 97 | } 98 | 99 | NAKED float CKBeObject::GetLastExecutionTime() { 100 | JUMP(0x2401AF63); 101 | } 102 | -------------------------------------------------------------------------------- /virtools/CKTimeManager.cpp: -------------------------------------------------------------------------------- 1 | #include "CKTimeManager.h" 2 | 3 | NAKED void VxTimeProfiler::Reset() { 4 | JUMP(0x2428F490); 5 | } 6 | 7 | NAKED float VxTimeProfiler::Current() { 8 | JUMP(0x24284970); 9 | } 10 | 11 | 12 | CKDWORD CKTimeManager::GetMainTickCount() { 13 | RETURN_MEM(0x28, CKDWORD); 14 | } 15 | 16 | float CKTimeManager::GetTime() { 17 | return GET_MEMPTR(0x90, VxTimeProfiler)->Current(); 18 | } 19 | 20 | float CKTimeManager::GetLastDeltaTime() { 21 | RETURN_MEM(0x38, float); 22 | } 23 | 24 | float CKTimeManager::GetLastDeltaTimeFree() { 25 | RETURN_MEM(0xa0, float); 26 | } 27 | 28 | float CKTimeManager::GetAbsoluteTime() { 29 | RETURN_MEM(0x34, float); 30 | } 31 | 32 | void CKTimeManager::SetTimeScaleFactor(float mulfactor) { 33 | SET_MEM(0x5c, float, mulfactor); 34 | } 35 | 36 | float CKTimeManager::GetTimeScaleFactor() { 37 | RETURN_MEM(0x5c, float); 38 | } 39 | 40 | CKDWORD CKTimeManager::GetLimitOptions() { 41 | RETURN_MEM(0x4c, CKDWORD); 42 | } 43 | 44 | float CKTimeManager::GetFrameRateLimit() { 45 | RETURN_MEM(0x3c, float); 46 | } 47 | 48 | float CKTimeManager::GetBehavioralRateLimit() { 49 | RETURN_MEM(0x40, float); 50 | } 51 | 52 | float CKTimeManager::GetMinimumDeltaTime() { 53 | RETURN_MEM(0x48, float); 54 | } 55 | 56 | float CKTimeManager::GetMaximumDeltaTime() { 57 | RETURN_MEM(0x48, float); 58 | } 59 | 60 | NAKED void CKTimeManager::ChangeLimitOptions(CK_FRAMERATE_LIMITS FpsOptions, CK_FRAMERATE_LIMITS BehOptions) { 61 | JUMP(0x24017E47); 62 | } 63 | 64 | NAKED void CKTimeManager::SetFrameRateLimit(float FRLimit) { 65 | JUMP(0x24017E70); 66 | } 67 | 68 | NAKED void CKTimeManager::SetBehavioralRateLimit(float BRLimit) { 69 | JUMP(0x24017E98); 70 | } 71 | 72 | NAKED void CKTimeManager::SetMinimumDeltaTime(float DtMin) { 73 | JUMP(0x24017EDB); 74 | } 75 | 76 | NAKED void CKTimeManager::SetMaximumDeltaTime(float DtMax) { 77 | JUMP(0x24017EC0); 78 | } 79 | 80 | void CKTimeManager::SetLastDeltaTime(float DtSet) { 81 | SET_MEM(0x38, float, DtSet); 82 | } 83 | 84 | void CKTimeManager::SetLastDeltaTimeFree(float DtSet) { 85 | SET_MEM(0xa0, float, DtSet); 86 | } 87 | 88 | void CKTimeManager::SetAbsoluteTime(float time) { 89 | SET_MEM(0x34, float, time); 90 | } 91 | 92 | void CKTimeManager::SetMainTickCount(CKDWORD tick) { 93 | SET_MEM(0x28, CKDWORD, tick); 94 | } 95 | 96 | NAKED void CKTimeManager::GetTimeToWaitForLimits(float& TimeBeforeRender, float& TimeBeforeBeh) { 97 | JUMP(0x24017EF6); 98 | } 99 | 100 | NAKED void CKTimeManager::ResetChronos(CKBOOL RenderChrono, CKBOOL BehavioralChrono) { 101 | JUMP(0x24017F49); 102 | } -------------------------------------------------------------------------------- /virtools/CKCollisionManager.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "CKDef.h" 4 | #include "CKBaseManager.h" 5 | #include "CK3dEntity.h" 6 | 7 | struct ImpactDesc { 8 | CK_ID m_OwnerEntity; 9 | CK_ID m_ObstacleTouched; 10 | CK_ID m_SubObstacleTouched; 11 | int m_TouchedVertex; 12 | int m_TouchingVertex; 13 | int m_TouchedFace; 14 | int m_TouchingFace; 15 | VxMatrix m_ImpactWorldMatrix; 16 | VxVector m_ImpactPoint; 17 | VxVector m_ImpactNormal; 18 | CK_ID m_Entity; 19 | }; 20 | 21 | class BML_EXPORT CKCollisionManager : public CKBaseManager { 22 | public: 23 | void AddObstacle(CK3dEntity* ent, CKBOOL moving = FALSE, CK_GEOMETRICPRECISION precision = CKCOLLISION_BOX, CKBOOL hiera = FALSE); 24 | int AddObstaclesByName(CKLevel* level, CKSTRING substring, CKBOOL moving = FALSE, CK_GEOMETRICPRECISION precision = CKCOLLISION_BOX, CKBOOL hiera = FALSE); 25 | void RemoveObstacle(CK3dEntity* ent); 26 | void RemoveAllObstacles(CKBOOL level = TRUE); 27 | CKBOOL IsObstacle(CK3dEntity* ent, CKBOOL moving = FALSE); 28 | int GetFixedObstacleCount(CKBOOL level = FALSE); 29 | CK3dEntity* GetFixedObstacle(int pos, CKBOOL level = FALSE); 30 | int GetMovingObstacleCount(CKBOOL level = FALSE); 31 | CK3dEntity* GetMovingObstacle(int pos, CKBOOL level = FALSE); 32 | int GetObstacleCount(CKBOOL level = FALSE); 33 | CK3dEntity* GetObstacle(int pos, CKBOOL level = FALSE); 34 | CKBOOL DetectCollision(CK3dEntity* ent, CK_GEOMETRICPRECISION precis_level, int replacementPrecision, int detectionPrecision, CK_IMPACTINFO inmpactFlags, ImpactDesc* imp); 35 | CKBOOL ObstacleBetween(const VxVector& pos, const VxVector& endpos, float width, float height); 36 | CKBOOL BoxBoxIntersection(CK3dEntity* ent1, CKBOOL hiera1, CKBOOL local1, CK3dEntity* ent2, CKBOOL hiera2, CKBOOL local2); 37 | CKBOOL BoxFaceIntersection(CK3dEntity* ent1, CKBOOL hiera1, CKBOOL local1, CK3dEntity* ent2); 38 | CKBOOL FaceFaceIntersection(CK3dEntity* ent1, CK3dEntity* ent2); 39 | CKBOOL IsInCollision(CK3dEntity* ent, CK_GEOMETRICPRECISION precis_level1, CK3dEntity* ent2, CK_GEOMETRICPRECISION precis_level2); 40 | CK3dEntity* IsInCollisionWithHierarchy(CK3dEntity* ent, CK_GEOMETRICPRECISION precis_level1, CK3dEntity* ent2, CK_GEOMETRICPRECISION precis_level2); 41 | CKBOOL IsHierarchyInCollisionWithHierarchy(CK3dEntity* ent, CK_GEOMETRICPRECISION precis_level1, CK3dEntity* ent2, CK_GEOMETRICPRECISION precis_level2, CK3dEntity** sub, CK3dEntity** subob); 42 | CK3dEntity* ObstacleBetween(const VxVector& pos, const VxVector& endpos, CKBOOL iFace = TRUE, CKBOOL iFirstContact = FALSE, CKBOOL iIgnoreAlpha = FALSE, VxIntersectionDesc* oDesc = NULL); 43 | 44 | protected: 45 | CKCollisionManager() {}; 46 | ~CKCollisionManager() {}; 47 | }; -------------------------------------------------------------------------------- /.gitattributes: -------------------------------------------------------------------------------- 1 | ############################################################################### 2 | # Set default behavior to automatically normalize line endings. 3 | ############################################################################### 4 | * text=auto 5 | 6 | ############################################################################### 7 | # Set default behavior for command prompt diff. 8 | # 9 | # This is need for earlier builds of msysgit that does not have it on by 10 | # default for csharp files. 11 | # Note: This is only used by command line 12 | ############################################################################### 13 | #*.cs diff=csharp 14 | 15 | ############################################################################### 16 | # Set the merge driver for project and solution files 17 | # 18 | # Merging from the command prompt will add diff markers to the files if there 19 | # are conflicts (Merging from VS is not affected by the settings below, in VS 20 | # the diff markers are never inserted). Diff markers may cause the following 21 | # file extensions to fail to load in VS. An alternative would be to treat 22 | # these files as binary and thus will always conflict and require user 23 | # intervention with every merge. To do so, just uncomment the entries below 24 | ############################################################################### 25 | #*.sln merge=binary 26 | #*.csproj merge=binary 27 | #*.vbproj merge=binary 28 | #*.vcxproj merge=binary 29 | #*.vcproj merge=binary 30 | #*.dbproj merge=binary 31 | #*.fsproj merge=binary 32 | #*.lsproj merge=binary 33 | #*.wixproj merge=binary 34 | #*.modelproj merge=binary 35 | #*.sqlproj merge=binary 36 | #*.wwaproj merge=binary 37 | 38 | ############################################################################### 39 | # behavior for image files 40 | # 41 | # image files are treated as binary by default. 42 | ############################################################################### 43 | #*.jpg binary 44 | #*.png binary 45 | #*.gif binary 46 | 47 | ############################################################################### 48 | # diff behavior for common document formats 49 | # 50 | # Convert binary document formats to text before diffing them. This feature 51 | # is only available from the command line. Turn it on by uncommenting the 52 | # entries below. 53 | ############################################################################### 54 | #*.doc diff=astextplain 55 | #*.DOC diff=astextplain 56 | #*.docx diff=astextplain 57 | #*.DOCX diff=astextplain 58 | #*.dot diff=astextplain 59 | #*.DOT diff=astextplain 60 | #*.pdf diff=astextplain 61 | #*.PDF diff=astextplain 62 | #*.rtf diff=astextplain 63 | #*.RTF diff=astextplain 64 | -------------------------------------------------------------------------------- /virtools/CKBehaviorPrototype.cpp: -------------------------------------------------------------------------------- 1 | #include "CKBehaviorPrototype.h" 2 | 3 | NAKED int CKBehaviorPrototype::DeclareInput(CKSTRING name) { 4 | JUMPV(0x00); 5 | } 6 | 7 | NAKED int CKBehaviorPrototype::DeclareOutput(CKSTRING name) { 8 | JUMPV(0x04); 9 | } 10 | 11 | NAKED int CKBehaviorPrototype::DeclareInParameter(CKSTRING name, CKGUID guid_type, CKSTRING defaultval) { 12 | JUMPV(0x08); 13 | } 14 | 15 | NAKED int CKBehaviorPrototype::DeclareInParameter(CKSTRING name, CKGUID guid_type, void* defaultval, int valsize) { 16 | JUMPV(0x0c); 17 | } 18 | 19 | NAKED int CKBehaviorPrototype::DeclareOutParameter(CKSTRING name, CKGUID guid_type, CKSTRING defaultval) { 20 | JUMPV(0x10); 21 | } 22 | 23 | NAKED int CKBehaviorPrototype::DeclareOutParameter(CKSTRING name, CKGUID guid_type, void* defaultval, int valsize) { 24 | JUMPV(0x14); 25 | } 26 | 27 | NAKED int CKBehaviorPrototype::DeclareLocalParameter(CKSTRING name, CKGUID guid_type, CKSTRING defaultval) { 28 | JUMP(0x240075F9); 29 | } 30 | 31 | NAKED int CKBehaviorPrototype::DeclareLocalParameter(CKSTRING name, CKGUID guid_type, void* defaultval, int valsize) { 32 | JUMP(0x24007717); 33 | } 34 | 35 | NAKED int CKBehaviorPrototype::DeclareSetting(CKSTRING name, CKGUID guid_type, CKSTRING defaultval) { 36 | JUMP(0x24007841); 37 | } 38 | 39 | NAKED int CKBehaviorPrototype::DeclareSetting(CKSTRING name, CKGUID guid_type, void* defaultval, int valsize) { 40 | JUMP(0x24007962); 41 | } 42 | 43 | NAKED void CKBehaviorPrototype::SetGuid(CKGUID guid) { 44 | JUMP(0x24006F78); 45 | } 46 | 47 | NAKED CKGUID CKBehaviorPrototype::GetGuid() { 48 | JUMP(0x24006F89); 49 | } 50 | 51 | NAKED void CKBehaviorPrototype::SetFlags(CK_BEHAVIORPROTOTYPE_FLAGS flags) { 52 | JUMP(0x24006F9B); 53 | } 54 | 55 | NAKED CK_BEHAVIORPROTOTYPE_FLAGS CKBehaviorPrototype::GetFlags() { 56 | JUMP(0x24035F34); 57 | } 58 | 59 | NAKED void CKBehaviorPrototype::SetApplyToClassID(CK_CLASSID cid) { 60 | JUMP(0x240081A1); 61 | } 62 | 63 | NAKED CK_CLASSID CKBehaviorPrototype::GetApplyToClassID() { 64 | JUMP(0x2400CEFF); 65 | } 66 | 67 | NAKED void CKBehaviorPrototype::SetFunction(CKBEHAVIORFCT fct) { 68 | JUMP(0x24006FAF); 69 | } 70 | 71 | NAKED CKBEHAVIORFCT CKBehaviorPrototype::GetFunction() { 72 | JUMP(0x24021542); 73 | } 74 | 75 | NAKED void CKBehaviorPrototype::SetBehaviorCallbackFct(CKBEHAVIORCALLBACKFCT fct, CKDWORD CallbackMask, void* param) { 76 | JUMP(0x24006FB9); 77 | } 78 | 79 | NAKED CKBEHAVIORCALLBACKFCT CKBehaviorPrototype::GetBehaviorCallbackFct() { 80 | JUMP(0x2400829A); 81 | } 82 | 83 | NAKED void CKBehaviorPrototype::SetBehaviorFlags(CK_BEHAVIOR_FLAGS flags) { 84 | JUMP(0x24006FA5); 85 | } 86 | 87 | NAKED CK_BEHAVIOR_FLAGS CKBehaviorPrototype::GetBehaviorFlags() { 88 | JUMP(0x2402158E); 89 | } 90 | 91 | NAKED CKSTRING CKBehaviorPrototype::GetName() { 92 | JUMP(0x2403B100); 93 | } 94 | -------------------------------------------------------------------------------- /virtools/CKDataArray.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "CKDef.h" 4 | #include "CKBeObject.h" 5 | #include "CKGlobals.h" 6 | 7 | typedef XSArray CKDataRow; 8 | 9 | class BML_EXPORT CKDataArray : public CKBeObject { 10 | public: 11 | void InsertColumn(int cdest, CK_ARRAYTYPE type, CKSTRING name, CKGUID paramguid = CKGUID(0, 0)); 12 | void MoveColumn(int csrc, int cdest); 13 | void RemoveColumn(int c); 14 | void SetColumnName(int c, CKSTRING name); 15 | char* GetColumnName(int c); 16 | void SetColumnType(int c, CK_ARRAYTYPE type, CKGUID paramguid = CKGUID(0, 0)); 17 | CK_ARRAYTYPE GetColumnType(int c); 18 | CKGUID GetColumnParameterGuid(int c); 19 | int GetKeyColumn(); 20 | void SetKeyColumn(int c); 21 | int GetColumnCount(); 22 | 23 | CKDWORD* GetElement(int i, int c); 24 | CKBOOL GetElementValue(int i, int c, void* value); 25 | CKObject* GetElementObject(int i, int c); 26 | 27 | CKBOOL SetElementValue(int i, int c, const void* value, int size = 0); 28 | CKBOOL SetElementValueFromParameter(int i, int c, CKParameter* pout); 29 | CKBOOL SetElementObject(int i, int c, CKObject* object); 30 | 31 | CKBOOL PasteShortcut(int i, int c, CKParameter* pout); 32 | CKParameterOut* RemoveShortcut(int i, int c); 33 | 34 | CKBOOL SetElementStringValue(int i, int c, const char* svalue); 35 | int GetStringValue(CKDWORD key, int c, char* svalue); 36 | int GetElementStringValue(int i, int c, char* svalue); 37 | 38 | CKBOOL LoadElements(CKSTRING string, CKBOOL append, int column); 39 | CKBOOL WriteElements(CKSTRING string, int column, int number, CKBOOL iAppend = FALSE); 40 | 41 | int GetRowCount(); 42 | CKDataRow* GetRow(int n); 43 | void AddRow(); 44 | CKDataRow* InsertRow(int n = -1); 45 | CKBOOL TestRow(int row, int c, CK_COMPOPERATOR op, CKDWORD key, int size = 0); 46 | int FindRowIndex(int c, CK_COMPOPERATOR op, CKDWORD key, int size = 0, int startingindex = 0); 47 | CKDataRow* FindRow(int c, CK_COMPOPERATOR op, CKDWORD key, int size = 0, int startindex = 0); 48 | void RemoveRow(int n); 49 | void MoveRow(int rsrc, int rdst); 50 | void SwapRows(int i1, int i2); 51 | void Clear(CKBOOL Params = TRUE); 52 | 53 | CKBOOL GetHighest(int c, int& row); 54 | CKBOOL GetLowest(int c, int& row); 55 | CKBOOL GetNearest(int c, void* value, int& row); 56 | void ColumnTransform(int c, CK_BINARYOPERATOR op, CKDWORD value); 57 | void ColumnsOperate(int c1, CK_BINARYOPERATOR op, int c2, int cr); 58 | 59 | void Sort(int c, CKBOOL ascending); 60 | void Unique(int c); 61 | void RandomShuffle(); 62 | void Reverse(); 63 | 64 | CKDWORD Sum(int c); 65 | CKDWORD Product(int c); 66 | int GetCount(int c, CK_COMPOPERATOR op, CKDWORD key, int size = 0); 67 | void CreateGroup(int mc, CK_COMPOPERATOR op, CKDWORD key, int size, CKGroup* group, int ec = 0); 68 | 69 | protected: 70 | CKDataArray() {}; 71 | ~CKDataArray() {}; 72 | }; -------------------------------------------------------------------------------- /virtools/CKScene.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "CKDef.h" 4 | #include "CKBeObject.h" 5 | 6 | typedef enum VXFOG_MODE { 7 | VXFOG_NONE = 0UL, 8 | VXFOG_EXP = 1UL, 9 | VXFOG_EXP2 = 2UL, 10 | VXFOG_LINEAR = 3UL 11 | } VXFOG_MODE; 12 | 13 | typedef XHashTable CKSODHash; 14 | typedef CKSODHash::Iterator CKSODHashIt; 15 | 16 | class CKSceneObjectIterator { 17 | public: 18 | CKSceneObjectIterator(CKSODHashIt it, CKSODHash& iHash) : m_Iterator(it), m_Hash(iHash) {} 19 | CK_ID GetObjectID() { return m_Iterator.GetKey(); } 20 | CKSceneObjectDesc* GetObjectDesc() { return &(*m_Iterator); } 21 | void Rewind() { m_Iterator = m_Hash.Begin(); } 22 | void RemoveAt() { m_Iterator = m_Hash.Remove(m_Iterator); } 23 | int End() { return m_Iterator == m_Hash.End(); } 24 | CKSceneObjectIterator& operator++(int) { 25 | ++m_Iterator; 26 | return *this; 27 | } 28 | 29 | CKSODHashIt m_Iterator; 30 | CKSODHash& m_Hash; 31 | }; 32 | 33 | class BML_EXPORT CKScene : public CKBeObject { 34 | public: 35 | void AddObjectToScene(CKSceneObject* o, CKBOOL dependencies = TRUE); 36 | void RemoveObjectFromScene(CKSceneObject* o, CKBOOL dependencies = TRUE); 37 | CKBOOL IsObjectHere(CKObject* o); 38 | void BeginAddSequence(CKBOOL Begin); 39 | void BeginRemoveSequence(CKBOOL Begin); 40 | int GetObjectCount(); 41 | const XObjectPointerArray& ComputeObjectList(CK_CLASSID cid, CKBOOL derived = TRUE); 42 | CKSceneObjectIterator GetObjectIterator(); 43 | void Activate(CKSceneObject* o, CKBOOL Reset); 44 | void DeActivate(CKSceneObject* o); 45 | void SetObjectFlags(CKSceneObject* o, CK_SCENEOBJECT_FLAGS flags); 46 | CK_SCENEOBJECT_FLAGS GetObjectFlags(CKSceneObject* o); 47 | CK_SCENEOBJECT_FLAGS ModifyObjectFlags(CKSceneObject* o, CKDWORD Add, CKDWORD Remove); 48 | CKBOOL SetObjectInitialValue(CKSceneObject* o, CKStateChunk* chunk); 49 | CKStateChunk* GetObjectInitialValue(CKSceneObject* o); 50 | CKBOOL IsObjectActive(CKSceneObject* o); 51 | void ApplyEnvironmentSettings(XObjectPointerArray* renderlist = NULL); 52 | void UseEnvironmentSettings(BOOL use = TRUE); 53 | CKBOOL EnvironmentSettings(); 54 | void SetAmbientLight(CKDWORD Color); 55 | CKDWORD GetAmbientLight(); 56 | void SetFogMode(VXFOG_MODE Mode); 57 | void SetFogStart(float Start); 58 | void SetFogEnd(float End); 59 | void SetFogDensity(float Density); 60 | void SetFogColor(CKDWORD Color); 61 | VXFOG_MODE GetFogMode(); 62 | float GetFogStart(); 63 | float GetFogEnd(); 64 | float GetFogDensity(); 65 | CKDWORD GetFogColor(); 66 | void SetBackgroundColor(CKDWORD Color); 67 | CKDWORD GetBackgroundColor(); 68 | void SetBackgroundTexture(CKTexture* texture); 69 | CKTexture* GetBackgroundTexture(); 70 | void SetStartingCamera(CKCamera* camera); 71 | CKCamera* GetStartingCamera(); 72 | CKLevel* GetLevel(); 73 | CKERROR Merge(CKScene* mergedScene, CKLevel* fromLevel = NULL); 74 | 75 | protected: 76 | CKScene() {}; 77 | ~CKScene() {}; 78 | }; -------------------------------------------------------------------------------- /minhook/hde/hde32.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Hacker Disassembler Engine 32 3 | * Copyright (c) 2006-2009, Vyacheslav Patkov. 4 | * All rights reserved. 5 | * 6 | * hde32.h: C/C++ header file 7 | * 8 | */ 9 | 10 | #ifndef _HDE32_H_ 11 | #define _HDE32_H_ 12 | 13 | /* stdint.h - C99 standard header 14 | * http://en.wikipedia.org/wiki/stdint.h 15 | * 16 | * if your compiler doesn't contain "stdint.h" header (for 17 | * example, Microsoft Visual C++), you can download file: 18 | * http://www.azillionmonkeys.com/qed/pstdint.h 19 | * and change next line to: 20 | * #include "pstdint.h" 21 | */ 22 | #include "pstdint.h" 23 | 24 | #define F_MODRM 0x00000001 25 | #define F_SIB 0x00000002 26 | #define F_IMM8 0x00000004 27 | #define F_IMM16 0x00000008 28 | #define F_IMM32 0x00000010 29 | #define F_DISP8 0x00000020 30 | #define F_DISP16 0x00000040 31 | #define F_DISP32 0x00000080 32 | #define F_RELATIVE 0x00000100 33 | #define F_2IMM16 0x00000800 34 | #define F_ERROR 0x00001000 35 | #define F_ERROR_OPCODE 0x00002000 36 | #define F_ERROR_LENGTH 0x00004000 37 | #define F_ERROR_LOCK 0x00008000 38 | #define F_ERROR_OPERAND 0x00010000 39 | #define F_PREFIX_REPNZ 0x01000000 40 | #define F_PREFIX_REPX 0x02000000 41 | #define F_PREFIX_REP 0x03000000 42 | #define F_PREFIX_66 0x04000000 43 | #define F_PREFIX_67 0x08000000 44 | #define F_PREFIX_LOCK 0x10000000 45 | #define F_PREFIX_SEG 0x20000000 46 | #define F_PREFIX_ANY 0x3f000000 47 | 48 | #define PREFIX_SEGMENT_CS 0x2e 49 | #define PREFIX_SEGMENT_SS 0x36 50 | #define PREFIX_SEGMENT_DS 0x3e 51 | #define PREFIX_SEGMENT_ES 0x26 52 | #define PREFIX_SEGMENT_FS 0x64 53 | #define PREFIX_SEGMENT_GS 0x65 54 | #define PREFIX_LOCK 0xf0 55 | #define PREFIX_REPNZ 0xf2 56 | #define PREFIX_REPX 0xf3 57 | #define PREFIX_OPERAND_SIZE 0x66 58 | #define PREFIX_ADDRESS_SIZE 0x67 59 | 60 | #pragma pack(push,1) 61 | 62 | typedef struct { 63 | uint8_t len; 64 | uint8_t p_rep; 65 | uint8_t p_lock; 66 | uint8_t p_seg; 67 | uint8_t p_66; 68 | uint8_t p_67; 69 | uint8_t opcode; 70 | uint8_t opcode2; 71 | uint8_t modrm; 72 | uint8_t modrm_mod; 73 | uint8_t modrm_reg; 74 | uint8_t modrm_rm; 75 | uint8_t sib; 76 | uint8_t sib_scale; 77 | uint8_t sib_index; 78 | uint8_t sib_base; 79 | union { 80 | uint8_t imm8; 81 | uint16_t imm16; 82 | uint32_t imm32; 83 | } imm; 84 | union { 85 | uint8_t disp8; 86 | uint16_t disp16; 87 | uint32_t disp32; 88 | } disp; 89 | uint32_t flags; 90 | } hde32s; 91 | 92 | #pragma pack(pop) 93 | 94 | #ifdef __cplusplus 95 | extern "C" { 96 | #endif 97 | 98 | /* __cdecl */ 99 | unsigned int hde32_disasm(const void *code, hde32s *hs); 100 | 101 | #ifdef __cplusplus 102 | } 103 | #endif 104 | 105 | #endif /* _HDE32_H_ */ 106 | -------------------------------------------------------------------------------- /virtools/CKPluginManager.cpp: -------------------------------------------------------------------------------- 1 | #include "CKPluginManager.h" 2 | 3 | NAKED int CKPluginManager::ParsePlugins(CKSTRING Directory) { 4 | JUMP(0x240153B3); 5 | } 6 | 7 | NAKED CKERROR CKPluginManager::RegisterPlugin(CKSTRING str) { 8 | JUMP(0x24015425); 9 | } 10 | 11 | NAKED CKPluginEntry* CKPluginManager::FindComponent(CKGUID Component, int catIdx) { 12 | JUMP(0x24014B99); 13 | } 14 | 15 | NAKED int CKPluginManager::AddCategory(CKSTRING cat) { 16 | JUMP(0x240161F7); 17 | } 18 | 19 | NAKED CKERROR CKPluginManager::RemoveCategory(int catIdx) { 20 | JUMP(0x240162ED); 21 | } 22 | 23 | NAKED int CKPluginManager::GetCategoryCount() { 24 | JUMP(0x24016347); 25 | } 26 | 27 | NAKED CKSTRING CKPluginManager::GetCategoryName(int catIdx) { 28 | JUMP(0x24016354); 29 | } 30 | 31 | NAKED int CKPluginManager::GetCategoryIndex(CKSTRING cat) { 32 | JUMP(0x2401638B); 33 | } 34 | 35 | NAKED CKERROR CKPluginManager::RenameCategory(int catIdx, CKSTRING newName) { 36 | JUMP(0x2401636F); 37 | } 38 | 39 | NAKED int CKPluginManager::GetPluginDllCount() { 40 | JUMP(0x240160D0); 41 | } 42 | 43 | NAKED CKPluginDll* CKPluginManager::GetPluginDllInfo(int PluginDllIdx) { 44 | JUMP(0x240160DA); 45 | } 46 | 47 | NAKED CKPluginDll* CKPluginManager::GetPluginDllInfo(CKSTRING PluginName, int* idx) { 48 | JUMP(0x240160E7); 49 | } 50 | 51 | NAKED CKERROR CKPluginManager::UnLoadPluginDll(int PluginDllIdx) { 52 | JUMP(0x24015DC4); 53 | } 54 | 55 | NAKED CKERROR CKPluginManager::ReLoadPluginDll(int PluginDllIdx) { 56 | JUMP(0x24015E8A); 57 | } 58 | 59 | NAKED int CKPluginManager::GetPluginCount(int catIdx) { 60 | JUMP(0x24016158); 61 | } 62 | 63 | NAKED CKPluginEntry* CKPluginManager::GetPluginInfo(int catIdx, int PluginIdx) { 64 | JUMP(0x24016171); 65 | } 66 | 67 | NAKED BOOL CKPluginManager::SetReaderOptionData(CKContext* context, void* memdata, CKParameterOut* Param, CKFileExtension ext, CKGUID* guid) { 68 | JUMP(0x24016960); 69 | } 70 | 71 | NAKED CKParameterOut* CKPluginManager::GetReaderOptionData(CKContext* context, void* memdata, CKFileExtension ext, CKGUID* guid) { 72 | JUMP(0x2401681B); 73 | } 74 | 75 | NAKED CKBitmapReader* CKPluginManager::GetBitmapReader(CKFileExtension& ext, CKGUID* preferedGUID) { 76 | JUMP(0x240165A9); 77 | } 78 | 79 | NAKED CKSoundReader* CKPluginManager::GetSoundReader(CKFileExtension& ext, CKGUID* preferedGUID) { 80 | JUMP(0x240165D3); 81 | } 82 | 83 | NAKED CKModelReader* CKPluginManager::GetModelReader(CKFileExtension& ext, CKGUID* preferedGUID) { 84 | JUMP(0x240165FD); 85 | } 86 | 87 | NAKED CKMovieReader* CKPluginManager::GetMovieReader(CKFileExtension& ext, CKGUID* preferedGUID) { 88 | JUMP(0x24016627); 89 | } 90 | 91 | NAKED CKERROR CKPluginManager::Load(CKContext* context, CKSTRING FileName, CKObjectArray* liste, CK_LOAD_FLAGS LoadFlags, CKCharacter* carac, CKGUID* Readerguid) { 92 | JUMP(0x24016416); 93 | } 94 | 95 | NAKED CKERROR CKPluginManager::Save(CKContext* context, CKSTRING FileName, CKObjectArray* liste, CKDWORD SaveFlags, CKGUID* Readerguid) { 96 | JUMP(0x240164EE); 97 | } 98 | -------------------------------------------------------------------------------- /Config.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "IConfig.h" 4 | #include "IMod.h" 5 | #include 6 | #include 7 | #include 8 | #include 9 | #include 10 | 11 | class Config; 12 | 13 | class Property : public IProperty { 14 | friend class Config; 15 | friend class GuiModMenu; 16 | friend class GuiModCategory; 17 | public: 18 | Property(Config* config, std::string category, std::string key); 19 | Property() {}; 20 | 21 | virtual CKSTRING GetString() override; 22 | virtual bool GetBoolean() override; 23 | virtual int GetInteger() override; 24 | virtual float GetFloat() override; 25 | virtual CKKEYBOARD GetKey() override; 26 | 27 | virtual void SetString(CKSTRING value) override; 28 | virtual void SetBoolean(bool value) override; 29 | virtual void SetInteger(int value) override; 30 | virtual void SetFloat(float value) override; 31 | virtual void SetKey(CKKEYBOARD value) override; 32 | 33 | CKSTRING GetComment(); 34 | virtual void SetComment(CKSTRING comment) override; 35 | 36 | virtual void SetDefaultString(CKSTRING value) override; 37 | virtual void SetDefaultBoolean(bool value) override; 38 | virtual void SetDefaultInteger(int value) override; 39 | virtual void SetDefaultFloat(float value) override; 40 | virtual void SetDefaultKey(CKKEYBOARD value) override; 41 | 42 | virtual PropertyType GetType() override { return m_type; } 43 | 44 | void CopyValue(Property* o); 45 | 46 | private: 47 | union { 48 | bool m_bool; 49 | int m_int = 0; 50 | float m_float; 51 | CKKEYBOARD m_key; 52 | } m_value; 53 | std::string m_string; 54 | 55 | PropertyType m_type = INTEGER; 56 | std::string m_comment; 57 | 58 | std::string m_category, m_key; 59 | Config* m_config = nullptr; 60 | }; 61 | 62 | class Config : public IConfig { 63 | friend class Property; 64 | friend class GuiModMenu; 65 | friend class GuiModCategory; 66 | public: 67 | Config(IMod* mod); 68 | ~Config(); 69 | 70 | IMod* GetMod() { return m_mod; } 71 | 72 | virtual bool HasCategory(CKSTRING category) override; 73 | virtual bool HasKey(CKSTRING category, CKSTRING key) override; 74 | 75 | virtual IProperty* GetProperty(CKSTRING category, CKSTRING key) override; 76 | 77 | CKSTRING GetCategoryComment(CKSTRING category); 78 | virtual void SetCategoryComment(CKSTRING category, CKSTRING comment) override; 79 | 80 | void Load(); 81 | void Save(); 82 | 83 | private: 84 | void trim(std::string& s) { 85 | s.erase(s.begin(), std::find_if(s.begin(), s.end(), std::not_fn(std::isspace))); 86 | s.erase(std::find_if(s.rbegin(), s.rend(), std::not_fn(std::isspace)).base(), s.end()); 87 | } 88 | 89 | IMod* m_mod; 90 | std::string m_modname; 91 | 92 | struct Category { 93 | std::string name; 94 | std::string comment; 95 | Config* config; 96 | 97 | std::vector props; 98 | 99 | Property* GetProperty(CKSTRING name); 100 | }; 101 | 102 | Category& GetCategory(CKSTRING name); 103 | 104 | std::vector m_data; 105 | }; -------------------------------------------------------------------------------- /virtools/CKCollisionManager.cpp: -------------------------------------------------------------------------------- 1 | #include "CKCollisionManager.h" 2 | 3 | NAKED void CKCollisionManager::AddObstacle(CK3dEntity* ent, CKBOOL moving, CK_GEOMETRICPRECISION precision, CKBOOL hiera) { 4 | JUMPV(0x78); 5 | } 6 | 7 | NAKED int CKCollisionManager::AddObstaclesByName(CKLevel* level, CKSTRING substring, CKBOOL moving, CK_GEOMETRICPRECISION precision, CKBOOL hiera) { 8 | JUMPV(0x7c); 9 | } 10 | 11 | NAKED void CKCollisionManager::RemoveObstacle(CK3dEntity* ent) { 12 | JUMPV(0x80); 13 | } 14 | 15 | NAKED void CKCollisionManager::RemoveAllObstacles(CKBOOL level) { 16 | JUMPV(0x84); 17 | } 18 | 19 | NAKED CKBOOL CKCollisionManager::IsObstacle(CK3dEntity* ent, CKBOOL moving) { 20 | JUMPV(0x88); 21 | } 22 | 23 | NAKED int CKCollisionManager::GetFixedObstacleCount(CKBOOL level) { 24 | JUMPV(0x8c); 25 | } 26 | 27 | NAKED CK3dEntity* CKCollisionManager::GetFixedObstacle(int pos, CKBOOL level) { 28 | JUMPV(0x90); 29 | } 30 | 31 | NAKED int CKCollisionManager::GetMovingObstacleCount(CKBOOL level) { 32 | JUMPV(0x94); 33 | } 34 | 35 | NAKED CK3dEntity* CKCollisionManager::GetMovingObstacle(int pos, CKBOOL level) { 36 | JUMPV(0x98); 37 | } 38 | 39 | NAKED int CKCollisionManager::GetObstacleCount(CKBOOL level) { 40 | JUMPV(0x9c); 41 | } 42 | 43 | NAKED CK3dEntity* CKCollisionManager::GetObstacle(int pos, CKBOOL level) { 44 | JUMPV(0xa0); 45 | } 46 | 47 | NAKED CKBOOL CKCollisionManager::DetectCollision(CK3dEntity* ent, CK_GEOMETRICPRECISION precis_level, int replacementPrecision, int detectionPrecision, CK_IMPACTINFO inmpactFlags, ImpactDesc* imp) { 48 | JUMPV(0xa4); 49 | } 50 | 51 | NAKED CKBOOL CKCollisionManager::ObstacleBetween(const VxVector& pos, const VxVector& endpos, float width, float height) { 52 | JUMPV(0xa8); 53 | } 54 | 55 | NAKED CKBOOL CKCollisionManager::BoxBoxIntersection(CK3dEntity* ent1, CKBOOL hiera1, CKBOOL local1, CK3dEntity* ent2, CKBOOL hiera2, CKBOOL local2) { 56 | JUMPV(0xac); 57 | } 58 | 59 | NAKED CKBOOL CKCollisionManager::BoxFaceIntersection(CK3dEntity* ent1, CKBOOL hiera1, CKBOOL local1, CK3dEntity* ent2) { 60 | JUMPV(0xb0); 61 | } 62 | 63 | NAKED CKBOOL CKCollisionManager::FaceFaceIntersection(CK3dEntity* ent1, CK3dEntity* ent2) { 64 | JUMPV(0xb4); 65 | } 66 | 67 | NAKED CKBOOL CKCollisionManager::IsInCollision(CK3dEntity* ent, CK_GEOMETRICPRECISION precis_level1, CK3dEntity* ent2, CK_GEOMETRICPRECISION precis_level2) { 68 | JUMPV(0xb8); 69 | } 70 | 71 | NAKED CK3dEntity* CKCollisionManager::IsInCollisionWithHierarchy(CK3dEntity* ent, CK_GEOMETRICPRECISION precis_level1, CK3dEntity* ent2, CK_GEOMETRICPRECISION precis_level2) { 72 | JUMPV(0xbc); 73 | } 74 | 75 | NAKED CKBOOL CKCollisionManager::IsHierarchyInCollisionWithHierarchy(CK3dEntity* ent, CK_GEOMETRICPRECISION precis_level1, CK3dEntity* ent2, CK_GEOMETRICPRECISION precis_level2, CK3dEntity** sub, CK3dEntity** subob) { 76 | JUMPV(0xc0); 77 | } 78 | 79 | NAKED CK3dEntity* CKCollisionManager::ObstacleBetween(const VxVector& pos, const VxVector& endpos, CKBOOL iFace, CKBOOL iFirstContact, CKBOOL iIgnoreAlpha, VxIntersectionDesc* oDesc) { 80 | JUMPV(0xc4); 81 | } 82 | -------------------------------------------------------------------------------- /virtools/CKInputManager.cpp: -------------------------------------------------------------------------------- 1 | #include "CKInputManager.h" 2 | #include "CKDef.h" 3 | 4 | NAKED void CKInputManager::EnableKeyboardRepetition(CKBOOL iEnable) { 5 | JUMPV(0x78); 6 | } 7 | 8 | NAKED CKBOOL CKInputManager::IsKeyboardRepetitionEnabled() { 9 | JUMPV(0x7c); 10 | } 11 | 12 | NAKED CKBOOL CKInputManager::IsKeyDown(CKDWORD iKey, CKDWORD* oStamp) { 13 | JUMPV(0x80); 14 | } 15 | 16 | NAKED CKBOOL CKInputManager::IsKeyUp(CKDWORD iKey) { 17 | JUMPV(0x84); 18 | } 19 | 20 | NAKED CKBOOL CKInputManager::IsKeyToggled(CKDWORD iKey, CKDWORD* oStamp) { 21 | JUMPV(0x88); 22 | } 23 | 24 | NAKED void CKInputManager::GetKeyName(CKDWORD iKey, char* oKeyName) { 25 | JUMPV(0x8c); 26 | } 27 | 28 | NAKED CKDWORD CKInputManager::GetKeyFromName(char* iKeyName) { 29 | JUMPV(0x90); 30 | } 31 | 32 | NAKED unsigned char* CKInputManager::GetKeyboardState() { 33 | JUMPV(0x94); 34 | } 35 | 36 | NAKED CKBOOL CKInputManager::IsKeyboardAttached() { 37 | JUMPV(0x98); 38 | } 39 | 40 | NAKED int CKInputManager::GetNumberOfKeyInBuffer() { 41 | JUMPV(0x9c); 42 | } 43 | 44 | NAKED int CKInputManager::GetKeyFromBuffer(int i, CKDWORD& oKey, CKDWORD* oTimeStamp) { 45 | JUMPV(0xa0); 46 | } 47 | 48 | NAKED CKBOOL CKInputManager::IsMouseButtonDown(CK_MOUSEBUTTON iButton) { 49 | JUMPV(0xa4); 50 | } 51 | 52 | NAKED CKBOOL CKInputManager::IsMouseClicked(CK_MOUSEBUTTON iButton) { 53 | JUMPV(0xa8); 54 | } 55 | 56 | NAKED CKBOOL CKInputManager::IsMouseToggled(CK_MOUSEBUTTON iButton) { 57 | JUMPV(0xac); 58 | } 59 | 60 | NAKED void CKInputManager::GetMouseButtonsState(CKBYTE oStates[4]) { 61 | JUMPV(0xb0); 62 | } 63 | 64 | NAKED void CKInputManager::GetMousePosition(Vx2DVector& oPosition, CKBOOL iAbsolute) { 65 | JUMPV(0xb4); 66 | } 67 | 68 | NAKED void CKInputManager::GetMouseRelativePosition(VxVector& oPosition) { 69 | JUMPV(0xb8); 70 | } 71 | 72 | NAKED CKBOOL CKInputManager::IsMouseAttached() { 73 | JUMPV(0xbc); 74 | } 75 | 76 | NAKED CKBOOL CKInputManager::IsJoystickAttached(int iJoystick) { 77 | JUMPV(0xc0); 78 | } 79 | 80 | NAKED void CKInputManager::GetJoystickPosition(int iJoystick, VxVector* oPosition) { 81 | JUMPV(0xc4); 82 | } 83 | 84 | NAKED void CKInputManager::GetJoystickRotation(int iJoystick, VxVector* oRotation) { 85 | JUMPV(0xc8); 86 | } 87 | 88 | NAKED void CKInputManager::GetJoystickSliders(int iJoystick, Vx2DVector* oPosition) { 89 | JUMPV(0xcc); 90 | } 91 | 92 | NAKED void CKInputManager::GetJoystickPointOfViewAngle(int iJoystick, float* oAngle) { 93 | JUMPV(0xd0); 94 | } 95 | 96 | NAKED CKDWORD CKInputManager::GetJoystickButtonsState(int iJoystick) { 97 | JUMPV(0xd4); 98 | } 99 | 100 | NAKED CKBOOL CKInputManager::IsJoystickButtonDown(int iJoystick, int iButton) { 101 | JUMPV(0xd8); 102 | } 103 | 104 | NAKED void CKInputManager::Pause(BOOL pause) { 105 | JUMPV(0xdc); 106 | } 107 | 108 | NAKED void CKInputManager::ShowCursor(BOOL iShow) { 109 | JUMPV(0xe0); 110 | } 111 | 112 | NAKED BOOL CKInputManager::GetCursorVisibility() { 113 | JUMPV(0xe4); 114 | } 115 | -------------------------------------------------------------------------------- /virtools/XString.cpp: -------------------------------------------------------------------------------- 1 | #include "CKDef.h" 2 | #include "XString.h" 3 | 4 | XString::XString(const char* iString, const int iLength) { 5 | Constructor(iString, iLength); 6 | } 7 | 8 | NAKED void XString::Constructor(const char* iString, const int iLength) { 9 | JUMP(0x2429E630); 10 | } 11 | 12 | XString::XString(const XString& iSrc) { 13 | Constructor(iSrc); 14 | } 15 | 16 | NAKED void XString::Constructor(const XString& iSrc) { 17 | JUMP(0x2429E7E0); 18 | } 19 | 20 | XString::XString(const XBaseString& iSrc) { 21 | Constructor(iSrc); 22 | } 23 | 24 | NAKED void XString::Constructor(const XBaseString& iSrc) { 25 | JUMP(0x2429E870); 26 | } 27 | 28 | XString::~XString() { 29 | Deconstructor(); 30 | } 31 | 32 | NAKED void XString::Deconstructor() { 33 | JUMP(0x2429E7A0); 34 | } 35 | 36 | NAKED XString& XString::operator = (const XString& iSrc) { 37 | JUMP(0x2429E990); 38 | } 39 | 40 | NAKED XString& XString::operator = (const char* iSrc) { 41 | JUMP(0x2429E950); 42 | } 43 | 44 | NAKED XString& XString::operator = (const XBaseString& iSrc) { 45 | JUMP(0x2429E990); 46 | } 47 | 48 | NAKED XString& XString::Create(const char* iString, const int iLength) { 49 | JUMP(0x2429E900); 50 | } 51 | 52 | NAKED XString& XString::ToUpper() { 53 | JUMP(0x2429EA00); 54 | } 55 | 56 | NAKED XString& XString::ToLower() { 57 | JUMP(0x2429EA40); 58 | } 59 | 60 | NAKED int XString::ICompare(const XBaseString& iStr) const { 61 | JUMP(0x2429EA80); 62 | } 63 | 64 | NAKED XString& XString::Trim() { 65 | JUMP(0x2429EB10); 66 | } 67 | 68 | NAKED XString& XString::Strip() { 69 | JUMP(0x2429EBA0); 70 | } 71 | 72 | NAKED XWORD XString::Find(char iCar, XWORD iStart) const { 73 | JUMP(0x2429EC70); 74 | } 75 | 76 | NAKED XWORD XString::Find(const XBaseString& iStr, XWORD iStart) const { 77 | JUMP(0x2429ECC0); 78 | } 79 | 80 | NAKED XWORD XString::IFind(const XBaseString& iStr, XWORD iStart) const { 81 | UNDEFINED; 82 | } 83 | 84 | NAKED XWORD XString::RFind(char iCar, XWORD iStart) const { 85 | JUMP(0x2429ED10); 86 | } 87 | 88 | NAKED XString XString::Substring(XWORD iStart, XWORD iLength) const { 89 | JUMP(0x2429EFD0); 90 | } 91 | 92 | NAKED XString& XString::Crop(XWORD iStart, XWORD iLength) { 93 | JUMP(0x2429F020); 94 | } 95 | 96 | NAKED XString& XString::Cut(XWORD iStart, XWORD iLength) { 97 | JUMP(0x2429F070); 98 | } 99 | 100 | NAKED int XString::Replace(char iSrc, char iDest) { 101 | JUMP(0x2429F0C0); 102 | } 103 | 104 | NAKED int XString::Replace(const XBaseString& iSrc, const XBaseString& iDest) { 105 | JUMP(0x2429F100); 106 | } 107 | 108 | NAKED XString& XString::operator << (const char* iString) { 109 | JUMP(0x2429E950); 110 | } 111 | 112 | NAKED XString& XString::operator << (const XBaseString& iString) { 113 | JUMP(0x2429EDE0); 114 | } 115 | 116 | NAKED XString& XString::operator << (const char iValue) { 117 | JUMP(0x2429EE40); 118 | } 119 | 120 | NAKED XString& XString::operator << (const int iValue) { 121 | JUMP(0x2429EE80); 122 | } 123 | 124 | NAKED XString& XString::operator << (const unsigned int iValue) { 125 | JUMP(0x2429EEF0); 126 | } 127 | 128 | NAKED XString& XString::operator << (const float iValue) { 129 | JUMP(0x2429EF60); 130 | } 131 | 132 | NAKED XString& XString::operator << (const void* iValue) { 133 | UNDEFINED; 134 | } -------------------------------------------------------------------------------- /virtools/CKParameter.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "CKDef.h" 4 | #include "CKObject.h" 5 | 6 | struct CKPluginEntry; 7 | 8 | typedef CKERROR(*CK_PARAMETERCREATEDEFAULTFUNCTION)(CKParameter*); 9 | typedef void (*CK_PARAMETERDELETEFUNCTION)(CKParameter*); 10 | typedef void (*CK_PARAMETERCHECKFUNCTION)(CKParameter*); 11 | typedef void (*CK_PARAMETERREMAPFUNCTION)(CKParameter*, CKDependenciesContext&); 12 | typedef void (*CK_PARAMETERCOPYFUNCTION)(CKParameter*, CKParameter*); 13 | typedef void (*CK_PARAMETERSAVELOADFUNCTION)(CKParameter* param, CKStateChunk** chunk, CKBOOL load); 14 | typedef int (*CK_PARAMETERSTRINGFUNCTION)(CKParameter* param, CKSTRING ValueString, CKBOOL ReadFromString); 15 | typedef WIN_HANDLE(*CK_PARAMETERUICREATORFUNCTION)(CKParameter* param, WIN_HANDLE ParentWindow, CKRECT* rect); 16 | 17 | struct CKParameterTypeDesc { 18 | CKParameterType Index; 19 | CKGUID Guid; 20 | CKGUID DerivedFrom; 21 | XString TypeName; 22 | int Valid; 23 | int DefaultSize; 24 | CK_PARAMETERCREATEDEFAULTFUNCTION CreateDefaultFunction; 25 | CK_PARAMETERDELETEFUNCTION DeleteFunction; 26 | CK_PARAMETERSAVELOADFUNCTION SaveLoadFunction; 27 | CK_PARAMETERCHECKFUNCTION CheckFunction; 28 | CK_PARAMETERCOPYFUNCTION CopyFunction; 29 | CK_PARAMETERSTRINGFUNCTION StringFunction; 30 | CK_PARAMETERUICREATORFUNCTION UICreatorFunction; 31 | 32 | CKPluginEntry* CreatorDll; 33 | CKDWORD dwParam; 34 | CKDWORD dwFlags; 35 | CKDWORD Cid; 36 | XBitArray DerivationMask; 37 | CKGUID Saver_Manager; 38 | 39 | CKParameterTypeDesc() { 40 | Cid = dwFlags = dwParam = DefaultSize = Valid = 0; 41 | CreatorDll = NULL; 42 | UICreatorFunction = 0; 43 | StringFunction = 0; 44 | SaveLoadFunction = 0; 45 | CheckFunction = 0; 46 | DeleteFunction = 0; 47 | CopyFunction = 0; 48 | CreateDefaultFunction = 0; 49 | DerivedFrom = CKGUID(0, 0); 50 | Guid = CKGUID(0, 0); 51 | TypeName = ""; 52 | Saver_Manager = CKGUID(0, 0); 53 | } 54 | }; 55 | 56 | class BML_EXPORT CKParameter : public CKObject { 57 | public: 58 | void CheckClass(CKParameterTypeDesc* iType); 59 | 60 | CKObject* GetOwner(); 61 | void SetOwner(CKObject* o); 62 | 63 | CKGUID GetGUID(); 64 | CK_CLASSID GetParameterClassID(); 65 | CKParameterType GetType(); 66 | CKBOOL IsCompatibleWith(CKParameter* param); 67 | void SetType(CKParameterType type); 68 | void SetGUID(CKGUID guid); 69 | 70 | CKERROR CopyValue(CKParameter* param, CKBOOL UpdateParam = TRUE); 71 | int GetDataSize(); 72 | void* GetReadDataPtr(CKBOOL update = TRUE); 73 | int GetStringValue(CKSTRING Value, CKBOOL update = TRUE); 74 | CKERROR GetValue(void* buf, CKBOOL update = TRUE); 75 | CKObject* GetValueObject(CKBOOL update = TRUE); 76 | void* GetWriteDataPtr(); 77 | CKERROR SetStringValue(CKSTRING Value); 78 | CKERROR SetValue(const void* buf, int size = 0); 79 | 80 | protected: 81 | CKParameter() {}; 82 | ~CKParameter() {}; 83 | }; 84 | 85 | class BML_EXPORT CKParameterLocal : public CKParameter { 86 | protected: 87 | CKParameterLocal() {}; 88 | ~CKParameterLocal() {}; 89 | }; 90 | 91 | class BML_EXPORT CKParameterOut : public CKParameter { 92 | public: 93 | void DataChanged(); 94 | CKERROR AddDestination(CKParameter* param, CKBOOL CheckType); 95 | void RemoveDestination(CKParameter* param); 96 | int GetDestinationCount(); 97 | CKParameter* GetDestination(int pos); 98 | void RemoveAllDestinations(); 99 | 100 | protected: 101 | CKParameterOut() {}; 102 | ~CKParameterOut() {}; 103 | }; -------------------------------------------------------------------------------- /virtools/VxRay.h: -------------------------------------------------------------------------------- 1 | /*************************************************************************/ 2 | /* File : VxRay.h */ 3 | /* Author : Aymeric Bard */ 4 | /* */ 5 | /* Virtools SDK */ 6 | /* Copyright (c) Virtools 2000, All Rights Reserved. */ 7 | /*************************************************************************/ 8 | #ifndef VXRAY_H 9 | 10 | #define VXRAY_H 11 | 12 | /********************************************************** 13 | {filename:VxRay} 14 | Name: VxRay 15 | 16 | Summary: Class representation of a ray (an origin and a direction). 17 | 18 | Remarks: 19 | A Ray is defined by 2 VxVector and is used to represents 20 | a ray in space (useful for intersection purposes.) 21 | 22 | A VxRay is defined as: 23 | 24 | class VxRay 25 | { 26 | public: 27 | VxVector m_Origin; 28 | VxVector m_Direction; 29 | }; 30 | 31 | 32 | 33 | 34 | See Also : VxMatrix,VxVector 35 | *********************************************************/ 36 | class VxRay 37 | { 38 | public: 39 | // Ctors 40 | VxRay() {} 41 | VxRay(const VxVector& start,const VxVector& end) : m_Origin(start),m_Direction(end-start) {} 42 | VxRay(const VxVector& start,const VxVector& dir,int* dummy) : m_Origin(start),m_Direction(dir) {} 43 | 44 | 45 | // Transform the ray into the other referential 46 | VX_EXPORT void Transform(VxRay& dest,const VxMatrix& mat); 47 | 48 | /************************************************ 49 | Summary: Interpolates a vector along the ray. 50 | 51 | Input Arguments: 52 | t : A float value for interpolation. 53 | 54 | Output Arguments: 55 | p: A point in space = m_Origin+ t* m_Direction. 56 | 57 | ************************************************/ 58 | void Interpolate (VxVector& p,float t) const 59 | { 60 | p = m_Origin + m_Direction * t; 61 | } 62 | 63 | /************************************************ 64 | Summary: Returns the square distance from a point to this ray.. 65 | 66 | Input Arguments: 67 | p: A point in space. 68 | 69 | Remarks: 70 | ************************************************/ 71 | float SquareDistance(const VxVector& p) const 72 | { 73 | VxVector v = p - m_Origin; 74 | float a = SquareMagnitude(v); 75 | float ps = DotProduct(v,m_Direction); 76 | return a - ps*ps; 77 | } 78 | 79 | /************************************************ 80 | Summary: Returns the distance from a point to this ray.. 81 | 82 | Input Arguments: 83 | p: A point in space. 84 | 85 | Return Value: 86 | The algebraic distance from the point to the line 87 | 88 | Remarks: 89 | return the minimum distance between a point p and 90 | a line defined by a point o and a direction d. 91 | All the inputs must be in the same referential. 92 | ************************************************/ 93 | float Distance(const VxVector& p) const 94 | { 95 | return sqrtf(SquareDistance(p)); 96 | } 97 | 98 | bool operator == (const VxRay& iRay) const { 99 | return (m_Origin == iRay.m_Origin) && (m_Direction == iRay.m_Direction); 100 | } 101 | 102 | 103 | const VxVector& GetOrigin() const {return m_Origin;} 104 | VxVector& GetOrigin() {return m_Origin;} 105 | 106 | const VxVector& GetDirection() const {return m_Direction;} 107 | VxVector& GetDirection() {return m_Direction;} 108 | 109 | // Origin of the ray 110 | VxVector m_Origin; 111 | // Direction of the ray (not normalized) 112 | VxVector m_Direction; 113 | 114 | }; 115 | 116 | 117 | #endif 118 | -------------------------------------------------------------------------------- /minhook/hde/table32.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Hacker Disassembler Engine 32 C 3 | * Copyright (c) 2008-2009, Vyacheslav Patkov. 4 | * All rights reserved. 5 | * 6 | */ 7 | 8 | #define C_NONE 0x00 9 | #define C_MODRM 0x01 10 | #define C_IMM8 0x02 11 | #define C_IMM16 0x04 12 | #define C_IMM_P66 0x10 13 | #define C_REL8 0x20 14 | #define C_REL32 0x40 15 | #define C_GROUP 0x80 16 | #define C_ERROR 0xff 17 | 18 | #define PRE_ANY 0x00 19 | #define PRE_NONE 0x01 20 | #define PRE_F2 0x02 21 | #define PRE_F3 0x04 22 | #define PRE_66 0x08 23 | #define PRE_67 0x10 24 | #define PRE_LOCK 0x20 25 | #define PRE_SEG 0x40 26 | #define PRE_ALL 0xff 27 | 28 | #define DELTA_OPCODES 0x4a 29 | #define DELTA_FPU_REG 0xf1 30 | #define DELTA_FPU_MODRM 0xf8 31 | #define DELTA_PREFIXES 0x130 32 | #define DELTA_OP_LOCK_OK 0x1a1 33 | #define DELTA_OP2_LOCK_OK 0x1b9 34 | #define DELTA_OP_ONLY_MEM 0x1cb 35 | #define DELTA_OP2_ONLY_MEM 0x1da 36 | 37 | unsigned char hde32_table[] = { 38 | 0xa3,0xa8,0xa3,0xa8,0xa3,0xa8,0xa3,0xa8,0xa3,0xa8,0xa3,0xa8,0xa3,0xa8,0xa3, 39 | 0xa8,0xaa,0xaa,0xaa,0xaa,0xaa,0xaa,0xaa,0xaa,0xac,0xaa,0xb2,0xaa,0x9f,0x9f, 40 | 0x9f,0x9f,0xb5,0xa3,0xa3,0xa4,0xaa,0xaa,0xba,0xaa,0x96,0xaa,0xa8,0xaa,0xc3, 41 | 0xc3,0x96,0x96,0xb7,0xae,0xd6,0xbd,0xa3,0xc5,0xa3,0xa3,0x9f,0xc3,0x9c,0xaa, 42 | 0xaa,0xac,0xaa,0xbf,0x03,0x7f,0x11,0x7f,0x01,0x7f,0x01,0x3f,0x01,0x01,0x90, 43 | 0x82,0x7d,0x97,0x59,0x59,0x59,0x59,0x59,0x7f,0x59,0x59,0x60,0x7d,0x7f,0x7f, 44 | 0x59,0x59,0x59,0x59,0x59,0x59,0x59,0x59,0x59,0x59,0x59,0x59,0x9a,0x88,0x7d, 45 | 0x59,0x50,0x50,0x50,0x50,0x59,0x59,0x59,0x59,0x61,0x94,0x61,0x9e,0x59,0x59, 46 | 0x85,0x59,0x92,0xa3,0x60,0x60,0x59,0x59,0x59,0x59,0x59,0x59,0x59,0x59,0x59, 47 | 0x59,0x59,0x9f,0x01,0x03,0x01,0x04,0x03,0xd5,0x03,0xcc,0x01,0xbc,0x03,0xf0, 48 | 0x10,0x10,0x10,0x10,0x50,0x50,0x50,0x50,0x14,0x20,0x20,0x20,0x20,0x01,0x01, 49 | 0x01,0x01,0xc4,0x02,0x10,0x00,0x00,0x00,0x00,0x01,0x01,0xc0,0xc2,0x10,0x11, 50 | 0x02,0x03,0x11,0x03,0x03,0x04,0x00,0x00,0x14,0x00,0x02,0x00,0x00,0xc6,0xc8, 51 | 0x02,0x02,0x02,0x02,0x00,0x00,0xff,0xff,0xff,0xff,0x00,0x00,0x00,0xff,0xca, 52 | 0x01,0x01,0x01,0x00,0x06,0x00,0x04,0x00,0xc0,0xc2,0x01,0x01,0x03,0x01,0xff, 53 | 0xff,0x01,0x00,0x03,0xc4,0xc4,0xc6,0x03,0x01,0x01,0x01,0xff,0x03,0x03,0x03, 54 | 0xc8,0x40,0x00,0x0a,0x00,0x04,0x00,0x00,0x00,0x00,0x7f,0x00,0x33,0x01,0x00, 55 | 0x00,0x00,0x00,0x00,0x00,0xff,0xbf,0xff,0xff,0x00,0x00,0x00,0x00,0x07,0x00, 56 | 0x00,0xff,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 57 | 0x00,0xff,0xff,0x00,0x00,0x00,0xbf,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 58 | 0x7f,0x00,0x00,0xff,0x4a,0x4a,0x4a,0x4a,0x4b,0x52,0x4a,0x4a,0x4a,0x4a,0x4f, 59 | 0x4c,0x4a,0x4a,0x4a,0x4a,0x4a,0x4a,0x4a,0x4a,0x55,0x45,0x40,0x4a,0x4a,0x4a, 60 | 0x45,0x59,0x4d,0x46,0x4a,0x5d,0x4a,0x4a,0x4a,0x4a,0x4a,0x4a,0x4a,0x4a,0x4a, 61 | 0x4a,0x4a,0x4a,0x4a,0x4a,0x61,0x63,0x67,0x4e,0x4a,0x4a,0x6b,0x6d,0x4a,0x4a, 62 | 0x45,0x6d,0x4a,0x4a,0x44,0x45,0x4a,0x4a,0x00,0x00,0x00,0x02,0x0d,0x06,0x06, 63 | 0x06,0x06,0x0e,0x00,0x00,0x00,0x00,0x06,0x06,0x06,0x00,0x06,0x06,0x02,0x06, 64 | 0x00,0x0a,0x0a,0x07,0x07,0x06,0x02,0x05,0x05,0x02,0x02,0x00,0x00,0x04,0x04, 65 | 0x04,0x04,0x00,0x00,0x00,0x0e,0x05,0x06,0x06,0x06,0x01,0x06,0x00,0x00,0x08, 66 | 0x00,0x10,0x00,0x18,0x00,0x20,0x00,0x28,0x00,0x30,0x00,0x80,0x01,0x82,0x01, 67 | 0x86,0x00,0xf6,0xcf,0xfe,0x3f,0xab,0x00,0xb0,0x00,0xb1,0x00,0xb3,0x00,0xba, 68 | 0xf8,0xbb,0x00,0xc0,0x00,0xc1,0x00,0xc7,0xbf,0x62,0xff,0x00,0x8d,0xff,0x00, 69 | 0xc4,0xff,0x00,0xc5,0xff,0x00,0xff,0xff,0xeb,0x01,0xff,0x0e,0x12,0x08,0x00, 70 | 0x13,0x09,0x00,0x16,0x08,0x00,0x17,0x09,0x00,0x2b,0x09,0x00,0xae,0xff,0x07, 71 | 0xb2,0xff,0x00,0xb4,0xff,0x00,0xb5,0xff,0x00,0xc3,0x01,0x00,0xc7,0xff,0xbf, 72 | 0xe7,0x08,0x00,0xf0,0x02,0x00 73 | }; 74 | -------------------------------------------------------------------------------- /virtools/VxMatrix.cpp: -------------------------------------------------------------------------------- 1 | #include "CKDef.h" 2 | #include "VxMatrix.h" 3 | 4 | NAKED void Vx3DMatrixIdentity(VxMatrix& Mat) { 5 | JUMP(0x2429A990); 6 | } 7 | 8 | NAKED void Vx3DMultiplyMatrixVector(VxVector* ResultVector, const VxMatrix& Mat, const VxVector& Vector) { 9 | JUMP(0x242838F0); 10 | } 11 | 12 | NAKED void Vx3DMultiplyMatrixVectorMany(VxVector* ResultVectors, const VxMatrix& Mat, const VxVector& Vectors, int count, int stride) { 13 | JUMP(0x242839B0); 14 | } 15 | 16 | NAKED void Vx3DMultiplyMatrixVector4(VxVector4* ResultVector, const VxMatrix& Mat, const VxVector4* Vector) { 17 | JUMP(0x24283B70); 18 | } 19 | 20 | NAKED void Vx3DMultiplyMatrixVector4(VxVector4* ResultVector, const VxMatrix& Mat, const VxVector& Vector) { 21 | JUMP(0x24283C60); 22 | } 23 | 24 | NAKED void Vx3DRotateVector(VxVector* ResultVector, const VxMatrix& Mat, const VxVector& Vector) { 25 | JUMP(0x24283E80); 26 | } 27 | 28 | NAKED void Vx3DRotateVectorMany(VxVector* ResultVector, const VxMatrix& Mat, const VxVector& Vector, int count, int stride) { 29 | JUMP(0x24283F30); 30 | } 31 | 32 | NAKED void Vx3DMultiplyMatrix(VxMatrix& ResultMat, const VxMatrix& MatA, const VxMatrix& MatB) { 33 | JUMP(0x242840C0); 34 | } 35 | 36 | NAKED void Vx3DMultiplyMatrix4(VxMatrix& ResultMat, const VxMatrix& MatA, const VxMatrix& MatB) { 37 | JUMP(0x24284480); 38 | } 39 | 40 | NAKED void Vx3DInverseMatrix(VxMatrix& InverseMat, const VxMatrix& Mat) { 41 | JUMP(0x2429AD50); 42 | } 43 | 44 | NAKED void Vx3DInverseMatrix44(VxMatrix& InverseMat, const VxMatrix& Mat) { 45 | UNDEFINED; 46 | } 47 | 48 | NAKED float Vx3DMatrixDeterminant(const VxMatrix& Mat) { 49 | JUMP(0x2429AD10); 50 | } 51 | 52 | NAKED void Vx3DMatrixFromRotation(VxMatrix& ResultMat, const VxVector& Vector, float Angle) { 53 | JUMP(0x2429AF90); 54 | } 55 | 56 | NAKED void Vx3DMatrixFromRotationAndOrigin(VxMatrix& ResultMat, const VxVector& Vector, const VxVector& Origin, float Angle) { 57 | JUMP(0x2429B0E0); 58 | } 59 | 60 | NAKED void Vx3DMatrixFromEulerAngles(VxMatrix& Mat, float eax, float eay, float eaz) { 61 | JUMP(0x2429B280); 62 | } 63 | 64 | NAKED void Vx3DMatrixToEulerAngles(const VxMatrix& Mat, float* eax, float* eay, float* eaz) { 65 | JUMP(0x2429B3E0); 66 | } 67 | 68 | NAKED void Vx3DInterpolateMatrix(float step, VxMatrix& Res, const VxMatrix& A, const VxMatrix& B) { 69 | JUMP(0x2429A9B0); 70 | } 71 | 72 | NAKED void Vx3DInterpolateMatrixNoScale(float step, VxMatrix& Res, const VxMatrix& A, const VxMatrix& B) { 73 | JUMP(0x2429A9B0); 74 | } 75 | 76 | NAKED void Vx3DTransposeMatrix(VxMatrix& Result, const VxMatrix& A) { 77 | JUMP(0x2429A920); 78 | } 79 | 80 | NAKED void Vx3DDecomposeMatrix(const VxMatrix& A, VxQuaternion& Quat, VxVector& Pos, VxVector& Scale) { 81 | JUMP(0x2429BE50); 82 | } 83 | 84 | NAKED float Vx3DDecomposeMatrixTotal(const VxMatrix& A, VxQuaternion& Quat, VxVector& Pos, VxVector& Scale, VxQuaternion& URot) { 85 | JUMP(0x2429BEF0); 86 | } 87 | 88 | NAKED float Vx3DDecomposeMatrixTotalPtr(const VxMatrix& A, VxQuaternion* Quat, VxVector* Pos, VxVector* Scale, VxQuaternion* URot) { 89 | JUMP(0x2429C080); 90 | } 91 | 92 | NAKED void VxInverseProject(const VxMatrix& iProjection, const Vx2DVector& i2D, const float iZ, VxVector* o3D) { 93 | UNDEFINED; 94 | } 95 | 96 | NAKED const VxMatrix& VxMatrix::Identity() { 97 | JUMP(0x2429B460); 98 | } 99 | 100 | NAKED XBOOL VxMatrix::Compare(const VxMatrix& mat) const { 101 | UNDEFINED; 102 | } 103 | 104 | NAKED void VxMatrix::RecomposeMatrixEx(const VxVector& Pos, const VxVector& Scale, const VxQuaternion& Quat, const VxQuaternion& Shear, float Sign) { 105 | UNDEFINED; 106 | } 107 | 108 | NAKED void VxMatrix::RecomposeMatrix(const VxVector& Pos, const VxVector& Scale, const VxQuaternion& Quat) { 109 | UNDEFINED; 110 | } 111 | -------------------------------------------------------------------------------- /virtools/CKBitmapData.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "CKDef.h" 4 | 5 | #define CKBITMAPDATA_INVALID 1 6 | #define CKBITMAPDATA_TRANSPARENT 2 7 | #define CKBITMAPDATA_FORCERESTORE 4 8 | #define CKBITMAPDATA_CLAMPUPTODATE 8 9 | #define CKBITMAPDATA_CUBEMAP 16 10 | #define CKBITMAPDATA_FREEVIDEOMEMORY 32 11 | #define CKBITMAPDATA_DYNAMIC 64 12 | #define CKBITMAPDATA_VOLUMEMAP 128 13 | #define CKBITMAPDATA_CONDITIONALNONPOW2 256 14 | 15 | class CKMovieReader; 16 | 17 | class CKBitmapSlot { 18 | public: 19 | DWORD* m_DataBuffer; 20 | XString m_FileName; 21 | 22 | public: 23 | CKBitmapSlot() { 24 | m_DataBuffer = NULL; 25 | } 26 | 27 | void Allocate(int Width, int Height, int iBpp) { 28 | Flush(); 29 | m_DataBuffer = (DWORD*) VxNewAligned(Width * Height * iBpp / 8, 16); 30 | } 31 | 32 | void Free() { 33 | Flush(); 34 | m_FileName = ""; 35 | } 36 | 37 | void Resize(VxImageDescEx& Src, VxImageDescEx& Dst) { 38 | DWORD* NewBuffer = (DWORD*)VxNewAligned(Dst.Width * Dst.Height * sizeof(DWORD), 16); 39 | if (m_DataBuffer) { 40 | Src.Image = (BYTE*)m_DataBuffer; 41 | Dst.Image = (BYTE*)NewBuffer; 42 | VxResizeImage32(Src, Dst); 43 | Flush(); 44 | } 45 | else { 46 | DWORD* ptr = NewBuffer; 47 | DWORD size = Dst.Width * Dst.Height; 48 | for (DWORD i = 0; i < size; i++, ptr++) *ptr = 0xFF000000; 49 | } 50 | m_DataBuffer = NewBuffer; 51 | } 52 | 53 | void Flush() { 54 | if (VxIsAllocatedByNewAligned(m_DataBuffer, 16)) 55 | VxDeleteAligned(m_DataBuffer); 56 | else delete[] m_DataBuffer; 57 | m_DataBuffer = NULL; 58 | } 59 | 60 | ~CKBitmapSlot() { 61 | Flush(); 62 | } 63 | }; 64 | 65 | class CKMovieInfo { 66 | public: 67 | XString m_MovieFileName; 68 | CKMovieReader* m_MovieReader; 69 | int m_MovieCurrentSlot; 70 | }; 71 | 72 | class BML_EXPORT CKBitmapData { 73 | public: 74 | CKBOOL CreateImage(int Width, int Height, int BPP = 32, int Slot = 0, void* ImagePointer = NULL); 75 | CKBOOL SaveImage(CKSTRING Name, int Slot = 0, CKBOOL CKUseFormat = FALSE); 76 | CKBOOL SaveImageAlpha(CKSTRING Name, int Slot = 0); 77 | CKSTRING GetMovieFileName(); 78 | CKMovieReader* GetMovieReader(); 79 | CKBYTE* LockSurfacePtr(int Slot = -1); 80 | CKBOOL ReleaseSurfacePtr(int Slot = -1); 81 | CKSTRING GetSlotFileName(int Slot); 82 | CKBOOL SetSlotFileName(int Slot, CKSTRING Filename); 83 | int GetWidth(); 84 | int GetHeight(); 85 | CKBOOL GetImageDesc(VxImageDescEx& oDesc); 86 | int GetSlotCount(); 87 | CKBOOL SetSlotCount(int Count); 88 | CKBOOL SetCurrentSlot(int Slot); 89 | int GetCurrentSlot(); 90 | CKBOOL ReleaseSlot(int Slot); 91 | CKBOOL ReleaseAllSlots(); 92 | CKBOOL SetPixel(int x, int y, CKDWORD col, int slot = -1); 93 | CKDWORD GetPixel(int x, int y, int slot = -1); 94 | CKDWORD GetTransparentColor(); 95 | void SetTransparentColor(CKDWORD Color); 96 | void SetTransparent(CKBOOL Transparency); 97 | CKBOOL IsTransparent(); 98 | CK_BITMAP_SAVEOPTIONS GetSaveOptions(); 99 | void SetSystemCaching(CK_BITMAP_SYSTEMCACHING iOptions); 100 | CK_BITMAP_SYSTEMCACHING GetSystemCaching(); 101 | void SetSaveOptions(CK_BITMAP_SAVEOPTIONS Options); 102 | CKBitmapProperties* GetSaveFormat(); 103 | void SetSaveFormat(CKBitmapProperties* format); 104 | void SetPickThreshold(int pt); 105 | int GetPickThreshold(); 106 | void SetCubeMap(CKBOOL CubeMap); 107 | CKBOOL IsCubeMap(); 108 | void SetVolumeMap(CKBOOL VolumeMap); 109 | CKBOOL IsVolumeMap(); 110 | CKBOOL HasOriginalFile(); 111 | CKBOOL ResizeImages(int Width, int Height); 112 | void SetDynamicHint(CKBOOL Dynamic); 113 | CKBOOL GetDynamicHint(); 114 | void AuthorizeConditionalNonPow2(CKBOOL iAuthorize); 115 | CKBOOL IsConditionalNonPow2Authorized(); 116 | 117 | protected: 118 | CKBitmapData() {}; 119 | ~CKBitmapData() {}; 120 | }; -------------------------------------------------------------------------------- /virtools/CK2dEntity.cpp: -------------------------------------------------------------------------------- 1 | #include "CK2dEntity.h" 2 | 3 | NAKED CKERROR CK2dEntity::GetPosition(Vx2DVector& vect, CKBOOL hom, CK2dEntity* ref) { 4 | JUMPV(0x88); 5 | } 6 | 7 | NAKED void CK2dEntity::SetPosition(const Vx2DVector& vect, CKBOOL hom, CKBOOL KeepChildren, CK2dEntity* ref) { 8 | JUMPV(0x8c); 9 | } 10 | 11 | NAKED CKERROR CK2dEntity::GetSize(Vx2DVector& vect, CKBOOL hom) { 12 | JUMPV(0x90); 13 | } 14 | 15 | NAKED void CK2dEntity::SetSize(const Vx2DVector& vect, CKBOOL hom, CKBOOL KeepChildren) { 16 | JUMPV(0x94); 17 | } 18 | 19 | NAKED void CK2dEntity::SetRect(const VxRect& rect, CKBOOL KeepChildren) { 20 | JUMPV(0x98); 21 | } 22 | 23 | NAKED void CK2dEntity::GetRect(VxRect& rect) { 24 | JUMPV(0x9c); 25 | } 26 | 27 | NAKED CKERROR CK2dEntity::SetHomogeneousRect(const VxRect& rect, CKBOOL KeepChildren) { 28 | JUMPV(0xa0); 29 | } 30 | 31 | NAKED CKERROR CK2dEntity::GetHomogeneousRect(VxRect& rect) { 32 | JUMPV(0xa4); 33 | } 34 | 35 | NAKED void CK2dEntity::SetSourceRect(const VxRect& rect) { 36 | JUMPV(0xa8); 37 | } 38 | 39 | NAKED void CK2dEntity::GetSourceRect(VxRect& rect) { 40 | JUMPV(0xac); 41 | } 42 | 43 | NAKED void CK2dEntity::UseSourceRect(CKBOOL Use) { 44 | JUMPV(0xb0); 45 | } 46 | 47 | NAKED CKBOOL CK2dEntity::IsUsingSourceRect() { 48 | JUMPV(0xb4); 49 | } 50 | 51 | NAKED void CK2dEntity::SetPickable(CKBOOL Pick) { 52 | JUMPV(0xb8); 53 | } 54 | 55 | NAKED CKBOOL CK2dEntity::IsPickable() { 56 | JUMPV(0xbc); 57 | } 58 | 59 | NAKED void CK2dEntity::SetBackground(CKBOOL back) { 60 | JUMPV(0xc0); 61 | } 62 | 63 | NAKED CKBOOL CK2dEntity::IsBackground() { 64 | JUMPV(0xc4); 65 | } 66 | 67 | NAKED void CK2dEntity::SetClipToParent(CKBOOL clip) { 68 | JUMPV(0xc8); 69 | } 70 | 71 | NAKED CKBOOL CK2dEntity::IsClipToParent() { 72 | JUMPV(0xcc); 73 | } 74 | 75 | NAKED void CK2dEntity::SetFlags(CKDWORD Flags) { 76 | JUMPV(0xd0); 77 | } 78 | 79 | NAKED void CK2dEntity::ModifyFlags(CKDWORD add, CKDWORD remove) { 80 | JUMPV(0xd4); 81 | } 82 | 83 | NAKED CKDWORD CK2dEntity::GetFlags() { 84 | JUMPV(0xd8); 85 | } 86 | 87 | NAKED void CK2dEntity::EnableRatioOffset(CKBOOL Ratio) { 88 | JUMPV(0xdc); 89 | } 90 | 91 | NAKED CKBOOL CK2dEntity::IsRatioOffset() { 92 | JUMPV(0xe0); 93 | } 94 | 95 | NAKED CKBOOL CK2dEntity::SetParent(CK2dEntity* parent) { 96 | JUMPV(0xe4); 97 | } 98 | 99 | NAKED CK2dEntity* CK2dEntity::GetParent() const { 100 | JUMPV(0xe8); 101 | } 102 | 103 | NAKED int CK2dEntity::GetChildrenCount() const { 104 | JUMPV(0xec); 105 | } 106 | 107 | NAKED CK2dEntity* CK2dEntity::GetChild(int i) const { 108 | JUMPV(0xf0); 109 | } 110 | 111 | NAKED CK2dEntity* CK2dEntity::HierarchyParser(CK2dEntity* current) const { 112 | JUMPV(0xf4); 113 | } 114 | 115 | NAKED void CK2dEntity::SetMaterial(CKMaterial* mat) { 116 | JUMPV(0xf8); 117 | } 118 | 119 | NAKED CKMaterial* CK2dEntity::GetMaterial() { 120 | JUMPV(0xfc); 121 | } 122 | 123 | NAKED void CK2dEntity::SetHomogeneousCoordinates(CKBOOL Coord) { 124 | JUMPV(0x100); 125 | } 126 | 127 | NAKED CKBOOL CK2dEntity::IsHomogeneousCoordinates() { 128 | JUMPV(0x104); 129 | } 130 | 131 | NAKED void CK2dEntity::EnableClipToCamera(CKBOOL Clip) { 132 | JUMPV(0x108); 133 | } 134 | 135 | NAKED CKBOOL CK2dEntity::IsClippedToCamera() { 136 | JUMPV(0x10c); 137 | } 138 | 139 | NAKED CKERROR CK2dEntity::Render(CKRenderContext* context) { 140 | JUMPV(0x110); 141 | } 142 | 143 | NAKED CKERROR CK2dEntity::Draw(CKRenderContext* context) { 144 | JUMPV(0x114); 145 | } 146 | 147 | NAKED void CK2dEntity::GetExtents(VxRect& srcrect, VxRect& rect) { 148 | JUMPV(0x118); 149 | } 150 | 151 | NAKED void CK2dEntity::SetExtents(const VxRect& srcrect, const VxRect& rect) { 152 | JUMPV(0x11c); 153 | } 154 | 155 | NAKED void CK2dEntity::RestoreInitialSize() { 156 | JUMPV(0x120); 157 | } 158 | -------------------------------------------------------------------------------- /virtools/CKSprite.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "CKDef.h" 4 | #include "CK2dEntity.h" 5 | #include "CKMaterial.h" 6 | 7 | #undef LoadImage 8 | 9 | class CKMovieReader; 10 | 11 | typedef enum VX_LOCKFLAGS { 12 | VX_LOCK_DEFAULT = 0x00000000, 13 | VX_LOCK_WRITEONLY = 0x00000001, 14 | VX_LOCK_READONLY = 0x00000002, 15 | VX_LOCK_DISCARD = 0x00000004, 16 | } VX_LOCKFLAGS; 17 | 18 | struct VxSpriteRenderOptions { 19 | DWORD ModulateColor; 20 | 21 | DWORD Options : 4; 22 | VXCMPFUNC AlphaTestFunc : 4; 23 | VXBLEND_MODE SrcBlendMode : 4; 24 | DWORD Options2 : 4; 25 | DWORD DstBlendMode : 8; 26 | DWORD AlphaRefValue : 8; 27 | }; 28 | 29 | class BML_EXPORT CKSprite : public CK2dEntity { 30 | public: 31 | CKBOOL Create(int Width, int Height, int BPP = 32, int Slot = 0); 32 | CKBOOL LoadImage(CKSTRING Name, int Slot = 0); 33 | CKBOOL SaveImage(CKSTRING Name, int Slot = 0, BOOL CKUseFormat = FALSE); 34 | CKBOOL LoadMovie(CKSTRING Name, int width = 0, int height = 0, int Bpp = 16); 35 | CKSTRING GetMovieFileName(); 36 | CKMovieReader* GetMovieReader(); 37 | CKBYTE* LockSurfacePtr(int Slot = -1); 38 | CKBOOL ReleaseSurfacePtr(int Slot = -1); 39 | CKSTRING GetSlotFileName(int Slot); 40 | CKBOOL SetSlotFileName(int Slot, CKSTRING Filename); 41 | int GetWidth(); 42 | int GetHeight(); 43 | int GetSlotCount(); 44 | CKBOOL SetSlotCount(int Count); 45 | CKBOOL SetCurrentSlot(int Slot); 46 | int GetCurrentSlot(); 47 | CKBOOL ReleaseSlot(int Slot); 48 | CKBOOL ReleaseAllSlots(); 49 | CKBOOL SetPixel(int x, int y, CKDWORD col, int slot = -1); 50 | CKDWORD GetPixel(int x, int y, int slot = -1); 51 | CKDWORD GetTransparentColor(); 52 | void SetTransparentColor(CKDWORD Color); 53 | void SetTransparent(CKBOOL Transparency); 54 | CKBOOL IsTransparent(); 55 | CKBOOL Restore(CKBOOL Clamp = FALSE); 56 | CKBOOL SystemToVideoMemory(CKRenderContext* Dev, CKBOOL Clamping = FALSE); 57 | CKBOOL FreeVideoMemory(); 58 | CKBOOL IsInVideoMemory(); 59 | CKBOOL CopyContext(CKRenderContext* ctx, VxRect* Src, VxRect* Dest); 60 | CKERROR Draw(CKRenderContext* context); 61 | CKBOOL GetVideoTextureDesc(VxImageDescEx& desc); 62 | VX_PIXELFORMAT GetVideoPixelFormat(); 63 | CKBOOL GetSystemTextureDesc(VxImageDescEx& desc); 64 | void SetDesiredVideoFormat(VX_PIXELFORMAT pf); 65 | VX_PIXELFORMAT GetDesiredVideoFormat(); 66 | void SetSystemCaching(CK_BITMAP_SYSTEMCACHING iOptions); 67 | CK_BITMAP_SYSTEMCACHING GetSystemCaching(); 68 | CK_BITMAP_SAVEOPTIONS GetSaveOptions(); 69 | void SetSaveOptions(CK_BITMAP_SAVEOPTIONS Options); 70 | CKBitmapProperties* GetSaveFormat(); 71 | void SetSaveFormat(CKBitmapProperties* format); 72 | void SetPickThreshold(int pt); 73 | int GetPickThreshold(); 74 | CKBOOL ToRestore(); 75 | CKBOOL HasOriginalFile(); 76 | BOOL LockVideoMemory(int SubSurfaceIndex, VxImageDescEx& Surface, CKRECT& SubRect, VX_LOCKFLAGS Flags = VX_LOCK_DEFAULT); 77 | void UnlockVideoMemory(int SubSurfaceIndex); 78 | int GetVideoMemorySurfaceCount(); 79 | void SetRenderOptions(const VxSpriteRenderOptions& option); 80 | const VxSpriteRenderOptions& GetRenderOptions(); 81 | void SetAlphaTest(CKBOOL Enable, CKBYTE RefValue, VXCMPFUNC AlphaTestFunc); 82 | CKBOOL AlphaTestEnabled(); 83 | CKBYTE GetAlphaTestRefValue(); 84 | VXCMPFUNC GetAlphaTestFunc(); 85 | void SetFiltering(CKBOOL Enable); 86 | CKBOOL FilteringEnabled(); 87 | void SetBlending(CKBOOL Enable, VXBLEND_MODE SrcBlendMode, VXBLEND_MODE DstBlendMode); 88 | CKBOOL BlendingEnabled(); 89 | VXBLEND_MODE GetSourceBlendMode(); 90 | VXBLEND_MODE GetDestinationBlendMode(); 91 | void SetColorModulate(CKBOOL Enable, const VxColor& color); 92 | CKBOOL ColorModulateEnabled(); 93 | VxColor GetModulateColor(); 94 | void SetDynamicHint(CKBOOL Dynamic); 95 | CKBOOL FlushSurfacePtr(int Slot = -1); 96 | 97 | protected: 98 | CKSprite() {}; 99 | ~CKSprite() {}; 100 | }; -------------------------------------------------------------------------------- /virtools/CKScene.cpp: -------------------------------------------------------------------------------- 1 | #include "CKScene.h" 2 | 3 | NAKED void CKScene::AddObjectToScene(CKSceneObject* o, CKBOOL dependencies) { 4 | JUMP(0x2402D2D9); 5 | } 6 | 7 | NAKED void CKScene::RemoveObjectFromScene(CKSceneObject* o, CKBOOL dependencies) { 8 | JUMP(0x2402D30A); 9 | } 10 | 11 | NAKED CKBOOL CKScene::IsObjectHere(CKObject* o) { 12 | JUMP(0x2402D2B7); 13 | } 14 | 15 | NAKED void CKScene::BeginAddSequence(CKBOOL Begin) { 16 | JUMP(0x2402D33F); 17 | } 18 | 19 | NAKED void CKScene::BeginRemoveSequence(CKBOOL Begin) { 20 | JUMP(0x2402D3AE); 21 | } 22 | 23 | NAKED int CKScene::GetObjectCount() { 24 | JUMP(0x2402D41D); 25 | } 26 | 27 | NAKED const XObjectPointerArray& CKScene::ComputeObjectList(CK_CLASSID cid, CKBOOL derived) { 28 | JUMP(0x2402DE9B); 29 | } 30 | 31 | NAKED CKSceneObjectIterator CKScene::GetObjectIterator() { 32 | JUMP(0x2402D421); 33 | } 34 | 35 | NAKED void CKScene::Activate(CKSceneObject* o, CKBOOL Reset) { 36 | JUMP(0x2402D5B1); 37 | } 38 | 39 | NAKED void CKScene::DeActivate(CKSceneObject* o) { 40 | JUMP(0x2402D5F8); 41 | } 42 | 43 | NAKED void CKScene::SetObjectFlags(CKSceneObject* o, CK_SCENEOBJECT_FLAGS flags) { 44 | JUMP(0x2402D4EB); 45 | } 46 | 47 | NAKED CK_SCENEOBJECT_FLAGS CKScene::GetObjectFlags(CKSceneObject* o) { 48 | JUMP(0x2402D538); 49 | } 50 | 51 | NAKED CK_SCENEOBJECT_FLAGS CKScene::ModifyObjectFlags(CKSceneObject* o, CKDWORD Add, CKDWORD Remove) { 52 | JUMP(0x2402D509); 53 | } 54 | 55 | NAKED CKBOOL CKScene::SetObjectInitialValue(CKSceneObject* o, CKStateChunk* chunk) { 56 | JUMP(0x2402D556); 57 | } 58 | 59 | NAKED CKStateChunk* CKScene::GetObjectInitialValue(CKSceneObject* o) { 60 | JUMP(0x2402D59A); 61 | } 62 | 63 | NAKED CKBOOL CKScene::IsObjectActive(CKSceneObject* o) { 64 | JUMP(0x2402D63B); 65 | } 66 | 67 | NAKED void CKScene::ApplyEnvironmentSettings(XObjectPointerArray* renderlist) { 68 | JUMP(0x2402D736); 69 | } 70 | 71 | NAKED void CKScene::UseEnvironmentSettings(BOOL use) { 72 | JUMP(0x2402D8CB); 73 | } 74 | 75 | NAKED CKBOOL CKScene::EnvironmentSettings() { 76 | JUMP(0x2402D8DF); 77 | } 78 | 79 | NAKED void CKScene::SetAmbientLight(CKDWORD Color) { 80 | JUMP(0x2402D65C); 81 | } 82 | 83 | NAKED CKDWORD CKScene::GetAmbientLight() { 84 | JUMP(0x2402D669); 85 | } 86 | 87 | NAKED void CKScene::SetFogMode(VXFOG_MODE Mode) { 88 | JUMP(0x2402D670); 89 | } 90 | 91 | NAKED void CKScene::SetFogStart(float Start) { 92 | JUMP(0x2402D67D); 93 | } 94 | 95 | NAKED void CKScene::SetFogEnd(float End) { 96 | JUMP(0x2402D68A); 97 | } 98 | 99 | NAKED void CKScene::SetFogDensity(float Density) { 100 | JUMP(0x2402D697); 101 | } 102 | 103 | NAKED void CKScene::SetFogColor(CKDWORD Color) { 104 | JUMP(0x2402D6A4); 105 | } 106 | 107 | NAKED VXFOG_MODE CKScene::GetFogMode() { 108 | JUMP(0x2402D6B1); 109 | } 110 | 111 | NAKED float CKScene::GetFogStart() { 112 | JUMP(0x2402D6B8); 113 | } 114 | 115 | NAKED float CKScene::GetFogEnd() { 116 | JUMP(0x2402D6BF); 117 | } 118 | 119 | NAKED float CKScene::GetFogDensity() { 120 | JUMP(0x2402D6C6); 121 | } 122 | 123 | NAKED CKDWORD CKScene::GetFogColor() { 124 | JUMP(0x2402D6CD); 125 | } 126 | 127 | NAKED void CKScene::SetBackgroundColor(CKDWORD Color) { 128 | JUMP(0x2402D6D4); 129 | } 130 | 131 | NAKED CKDWORD CKScene::GetBackgroundColor() { 132 | JUMP(0x2402D6DE); 133 | } 134 | 135 | NAKED void CKScene::SetBackgroundTexture(CKTexture* texture) { 136 | JUMP(0x2402D6E2); 137 | } 138 | 139 | NAKED CKTexture* CKScene::GetBackgroundTexture() { 140 | JUMP(0x2402D6F7); 141 | } 142 | 143 | NAKED void CKScene::SetStartingCamera(CKCamera* camera) { 144 | JUMP(0x2402D703); 145 | } 146 | 147 | NAKED CKCamera* CKScene::GetStartingCamera() { 148 | JUMP(0x2402D72A); 149 | } 150 | 151 | NAKED CKLevel* CKScene::GetLevel() { 152 | JUMP(0x2402D2AB); 153 | } 154 | 155 | NAKED CKERROR CKScene::Merge(CKScene* mergedScene, CKLevel* fromLevel) { 156 | JUMP(0x2402D8E6); 157 | } 158 | -------------------------------------------------------------------------------- /virtools/CKSound.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "CKDef.h" 4 | #include "CKBeObject.h" 5 | 6 | class BML_EXPORT CKSound : public CKBeObject { 7 | public: 8 | CK_SOUND_SAVEOPTIONS GetSaveOptions(); 9 | void SetSaveOptions(CK_SOUND_SAVEOPTIONS Options); 10 | 11 | protected: 12 | CKSound() {}; 13 | ~CKSound() {}; 14 | }; 15 | 16 | class BML_EXPORT CKMidiSound : public CKSound { 17 | public: 18 | CKERROR SetSoundFileName(CKSTRING filename); 19 | CKSTRING GetSoundFileName(); 20 | CKDWORD GetCurrentPos(); 21 | CKERROR Play(); 22 | CKERROR Stop(); 23 | CKERROR Pause(CKBOOL pause = TRUE); 24 | CKBOOL IsPlaying(); 25 | CKBOOL IsPaused(); 26 | 27 | protected: 28 | CKMidiSound() {}; 29 | ~CKMidiSound() {}; 30 | }; 31 | 32 | typedef void* CKSOUNDHANDLE; 33 | class CKSoundReader; 34 | struct CKWaveFormat { 35 | WORD wFormatTag; 36 | WORD nChannels; 37 | DWORD nSamplesPerSec; 38 | DWORD nAvgBytesPerSec; 39 | WORD nBlockAlign; 40 | WORD wBitsPerSample; 41 | WORD cbSize; 42 | }; 43 | 44 | class BML_EXPORT CKWaveSound : public CKSound { 45 | public: 46 | CKSOUNDHANDLE PlayMinion(CKBOOL Background = TRUE, CK3dEntity* Ent = NULL, VxVector* Position = NULL, VxVector* Direction = NULL, float MinDelay = 0.0f, float gain = 1.0f); 47 | CKERROR SetSoundFileName(const CKSTRING FileName); 48 | CKSTRING GetSoundFileName(); 49 | int GetSoundLength(); 50 | CKERROR GetSoundFormat(CKWaveFormat& Format); 51 | CK_WAVESOUND_TYPE GetType(); 52 | void SetType(CK_WAVESOUND_TYPE Type); 53 | CKDWORD GetState(); 54 | void SetState(CKDWORD State); 55 | void SetPriority(float Priority); 56 | float GetPriority(); 57 | void SetLoopMode(CKBOOL Enabled); 58 | CKBOOL GetLoopMode(); 59 | CKERROR SetFileStreaming(CKBOOL Enabled, BOOL RecreateSound = FALSE); 60 | CKBOOL GetFileStreaming(); 61 | void Play(float FadeIn = 0, float FinalGain = 1.0f); 62 | void Resume(); 63 | void Rewind(); 64 | void Stop(float FadeOut = 0); 65 | void Pause(); 66 | CKBOOL IsPlaying(); 67 | CKBOOL IsPaused(); 68 | void SetGain(float Gain); 69 | float GetGain(); 70 | void SetPitch(float Rate); 71 | float GetPitch(); 72 | void SetPan(float Pan); 73 | float GetPan(); 74 | CKSOUNDHANDLE GetSource(); 75 | void PositionSound(CK3dEntity* Object, VxVector* Position = NULL, VxVector* Direction = NULL, CKBOOL Commit = FALSE); 76 | CK3dEntity* GetAttachedEntity(); 77 | void GetPosition(VxVector& Pos); 78 | void GetDirection(VxVector& Dir); 79 | void GetSound3DInformation(VxVector& Pos, VxVector& Dir, float& DistanceFromListener); 80 | void SetCone(float InAngle, float OutAngle, float OutsideGain); 81 | void GetCone(float* InAngle, float* OutAngle, float* OutsideGain); 82 | void SetMinMaxDistance(float MinDistance, float MaxDistance, CKDWORD MaxDistanceBehavior = 1); 83 | void GetMinMaxDistance(float* MinDistance, float* MaxDistance, CKDWORD* MaxDistanceBehavior); 84 | void SetVelocity(VxVector& Pos); 85 | void GetVelocity(VxVector& Pos); 86 | void SetOrientation(VxVector& Dir, VxVector& Up); 87 | void GetOrientation(VxVector& Dir, VxVector& Up); 88 | CKERROR WriteData(BYTE* Buffer, int Buffersize); 89 | CKERROR Lock(CKDWORD WriteCursor, CKDWORD NumBytes, void** Ptr1, CKDWORD* Bytes1, void** Ptr2, CKDWORD* Bytes2, CK_WAVESOUND_LOCKMODE Flags); 90 | CKERROR Unlock(void* Ptr1, CKDWORD Bytes1, void* Ptr2, CKDWORD Bytes2); 91 | CKDWORD GetPlayPosition(); 92 | int GetPlayedMs(); 93 | CKERROR Create(CKBOOL FileStreaming, CKSTRING Filename); 94 | CKERROR Create(CK_WAVESOUND_TYPE Type, CKWaveFormat* Format, int Size); 95 | CKERROR SetReader(CKSoundReader* Reader); 96 | CKSoundReader* GetReader(); 97 | void SetDataToRead(int Size); 98 | CKERROR Recreate(BOOL Safe = FALSE); 99 | void Release(); 100 | CKERROR TryRecreate(); 101 | void UpdatePosition(float deltaT); 102 | void UpdateFade(); 103 | CKERROR WriteDataFromReader(); 104 | void FillWithBlanks(CKBOOL IncBf = FALSE); 105 | void InternalStop(); 106 | 107 | protected: 108 | CKWaveSound() {}; 109 | ~CKWaveSound() {}; 110 | }; -------------------------------------------------------------------------------- /virtools/CKParameterManager.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "CKDef.h" 4 | #include "CKBaseManager.h" 5 | #include "CKParameter.h" 6 | 7 | #define CKGUIDCONSTREF CKGUID 8 | #define CKGUIDREF CKGUID& 9 | typedef void (*CK_PARAMETEROPERATION) (CKContext* context, CKParameterOut* Res, CKParameterIn* p1, CKParameterIn* p2); 10 | typedef struct CKOperationDesc { 11 | CKGUID OpGuid; 12 | CKGUID P1Guid; 13 | CKGUID P2Guid; 14 | CKGUID ResGuid; 15 | CK_PARAMETEROPERATION Fct; 16 | } CKOperationDesc; 17 | 18 | class BML_EXPORT CKParameterManager : public CKBaseManager { 19 | public: 20 | CKERROR RegisterParameterType(CKParameterTypeDesc* param_type); 21 | CKERROR UnRegisterParameterType(CKGUIDCONSTREF guid); 22 | CKParameterTypeDesc* GetParameterTypeDescription(int type); 23 | CKParameterTypeDesc* GetParameterTypeDescription(CKGUIDCONSTREF guid); 24 | int GetParameterSize(CKParameterType type); 25 | int GetParameterTypesCount(); 26 | CKERROR ChangeParametersGuid(CKGUIDCONSTREF iOldGuid, CKGUIDCONSTREF iNewGuid); 27 | CKParameterType ParameterGuidToType(CKGUIDCONSTREF guid); 28 | CKSTRING ParameterGuidToName(CKGUIDCONSTREF guid); 29 | CKGUID ParameterTypeToGuid(CKParameterType type); 30 | CKSTRING ParameterTypeToName(CKParameterType type); 31 | CKGUID ParameterNameToGuid(CKSTRING name); 32 | CKParameterType ParameterNameToType(CKSTRING name); 33 | CKBOOL IsDerivedFrom(CKGUIDCONSTREF guid1, CKGUIDCONSTREF parent); 34 | CKBOOL IsDerivedFrom(CKParameterType child, CKParameterType parent); 35 | CKBOOL IsTypeCompatible(CKGUIDCONSTREF guid1, CKGUIDCONSTREF guid2); 36 | CKBOOL IsTypeCompatible(CKParameterType Ptype1, CKParameterType Ptype2); 37 | CK_CLASSID TypeToClassID(CKParameterType type); 38 | CK_CLASSID GuidToClassID(CKGUIDCONSTREF guid); 39 | CKParameterType ClassIDToType(CK_CLASSID cid); 40 | CKGUID ClassIDToGuid(CK_CLASSID cid); 41 | CKERROR RegisterNewFlags(CKGUIDCONSTREF FlagsGuid, CKSTRING FlagsName, CKSTRING FlagsData); 42 | CKERROR RegisterNewEnum(CKGUIDCONSTREF EnumGuid, CKSTRING EnumName, CKSTRING EnumData); 43 | CKERROR ChangeEnumDeclaration(CKGUIDCONSTREF EnumGuid, CKSTRING EnumData); 44 | CKERROR ChangeFlagsDeclaration(CKGUIDCONSTREF FlagsGuid, CKSTRING FlagsData); 45 | CKERROR RegisterNewStructure(CKGUIDCONSTREF StructGuid, CKSTRING StructName, CKSTRING Structdata, ...); 46 | CKERROR RegisterNewStructure(CKGUIDCONSTREF StructGuid, CKSTRING StructName, CKSTRING StructData, XArray& ListGuid); 47 | int GetNbFlagDefined(); 48 | int GetNbEnumDefined(); 49 | int GetNbStructDefined(); 50 | CKFlagsStruct* GetFlagsDescByType(CKParameterType pType); 51 | CKEnumStruct* GetEnumDescByType(CKParameterType pType); 52 | CKStructStruct* GetStructDescByType(CKParameterType pType); 53 | CKOperationType RegisterOperationType(CKGUIDCONSTREF OpCode, CKSTRING name); 54 | CKERROR UnRegisterOperationType(CKGUIDCONSTREF opguid); 55 | CKERROR UnRegisterOperationType(CKOperationType opcode); 56 | CKERROR RegisterOperationFunction(CKGUIDREF operation, CKGUIDREF type_paramres, CKGUIDREF type_param1, CKGUIDREF type_param2, CK_PARAMETEROPERATION op); 57 | CK_PARAMETEROPERATION GetOperationFunction(CKGUIDREF operation, CKGUIDREF type_paramres, CKGUIDREF type_param1, CKGUIDREF type_param2); 58 | CKERROR UnRegisterOperationFunction(CKGUIDREF operation, CKGUIDREF type_paramres, CKGUIDREF type_param1, CKGUIDREF type_param2); 59 | CKGUID OperationCodeToGuid(CKOperationType type); 60 | CKSTRING OperationCodeToName(CKOperationType type); 61 | CKOperationType OperationGuidToCode(CKGUIDCONSTREF guid); 62 | CKSTRING OperationGuidToName(CKGUIDCONSTREF guid); 63 | CKGUID OperationNameToGuid(CKSTRING name); 64 | CKOperationType OperationNameToCode(CKSTRING name); 65 | int GetAvailableOperationsDesc(const CKGUID& opGuid, CKParameterOut* res, CKParameterIn* p1, CKParameterIn* p2, CKOperationDesc* list); 66 | int GetParameterOperationCount(); 67 | CKBOOL IsParameterTypeToBeShown(CKParameterType type); 68 | CKBOOL IsParameterTypeToBeShown(CKGUIDCONSTREF guid); 69 | CKBOOL CheckParamTypeValidity(CKParameterType type); 70 | 71 | protected: 72 | CKParameterManager() {}; 73 | ~CKParameterManager() {}; 74 | }; -------------------------------------------------------------------------------- /NewBallTypeMod.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "IMod.h" 4 | #include "Version.h" 5 | 6 | struct BallTypeInfo { 7 | friend class NewBallTypeMod; 8 | 9 | std::string m_file; 10 | std::string m_id; 11 | std::string m_name; 12 | std::string m_objName; 13 | 14 | CKGroup* m_allGroup = nullptr; 15 | CK3dObject* m_ballObj = nullptr; 16 | 17 | CKGroup* m_piecesGroup = nullptr; 18 | CK3dEntity* m_piecesFrame = nullptr; 19 | 20 | CKBehavior* m_explosion = nullptr; 21 | CKBehavior* m_reset = nullptr; 22 | 23 | std::string m_collGroup; 24 | float m_friction, m_elasticity, m_mass; 25 | float m_linearDamp, m_rotDamp, m_force; 26 | float m_radius; 27 | 28 | private: 29 | CKParameter* m_ballParam = nullptr; 30 | CKParameter* m_usedParam = nullptr; 31 | CKParameter* m_resetParam = nullptr; 32 | CKBehavior* m_timer = nullptr; 33 | CKBehavior* m_binswitch[2]; 34 | }; 35 | 36 | class FixPath : public CKPathManager { 37 | public: 38 | CKERROR Resolve(XString& file, int catIdx, int startIdx); 39 | 40 | typedef CKERROR (FixPath::*ResolveFunc)(XString&, int, int); 41 | static ResolveFunc m_resolve; 42 | }; 43 | 44 | struct FloorTypeInfo { 45 | std::string m_name; 46 | 47 | std::string m_collGroup; 48 | float m_friction, m_elasticity, m_mass; 49 | CKBOOL m_enableColl; 50 | }; 51 | 52 | struct ModulConvexInfo : public FloorTypeInfo { 53 | CKBOOL m_fixed, m_frozen, m_massCenter; 54 | float m_linearDamp, m_rotDamp; 55 | }; 56 | 57 | struct ModulBallInfo : public ModulConvexInfo { 58 | float m_radius; 59 | }; 60 | 61 | struct ModulInfo { 62 | std::string m_name; 63 | int m_type; 64 | }; 65 | 66 | class NewBallTypeMod : public IMod { 67 | public: 68 | NewBallTypeMod(IBML* bml) : IMod(bml) {} 69 | 70 | virtual CKSTRING GetID() override { return "NewBallType"; } 71 | virtual CKSTRING GetVersion() override { return BML_VERSION; } 72 | virtual CKSTRING GetName() override { return "New Ball Type"; } 73 | virtual CKSTRING GetAuthor() override { return "Gamepiaynmo"; } 74 | virtual CKSTRING GetDescription() override { return "Implementation of registering new ball types."; } 75 | DECLARE_BML_VERSION; 76 | 77 | virtual void OnLoad() override; 78 | virtual void OnLoadObject(CKSTRING filename, BOOL isMap, CKSTRING masterName, 79 | CK_CLASSID filterClass, BOOL addtoscene, BOOL reuseMeshes, BOOL reuseMaterials, 80 | BOOL dynamic, XObjectArray* objArray, CKObject* masterObj) override; 81 | virtual void OnLoadScript(CKSTRING filename, CKBehavior* script) override; 82 | 83 | void RegisterBallType(CKSTRING ballFile, CKSTRING ballId, CKSTRING ballName, CKSTRING objName, float friction, float elasticity, 84 | float mass, CKSTRING collGroup, float linearDamp, float rotDamp, float force, float radius); 85 | void RegisterFloorType(CKSTRING floorName, float friction, float elasticity, float mass, CKSTRING collGroup, bool enableColl); 86 | void RegisterModulBall(CKSTRING modulName, bool fixed, float friction, float elasticity, float mass, CKSTRING collGroup, 87 | bool frozen, bool enableColl, bool calcMassCenter, float linearDamp, float rotDamp, float radius); 88 | void RegisterModulConvex(CKSTRING modulName, bool fixed, float friction, float elasticity, float mass, CKSTRING collGroup, 89 | bool frozen, bool enableColl, bool calcMassCenter, float linearDamp, float rotDamp); 90 | void RegisterTrafo(CKSTRING modulName); 91 | void RegisterModul(CKSTRING modulName); 92 | 93 | private: 94 | CKDataArray* m_physBall = nullptr; 95 | CKGroup* m_allBalls = nullptr; 96 | void OnLoadBalls(XObjectArray* objArray); 97 | void OnLoadLevelinit(XObjectArray* objArray); 98 | void OnLoadSounds(XObjectArray* objArray); 99 | 100 | void OnEditScript_Gameplay_Ingame(CKBehavior* script); 101 | void OnEditScript_Base_EventHandler(CKBehavior* script); 102 | void OnEditScript_PhysicalizeNewBall(CKBehavior* graph); 103 | void OnEditScript_ResetBallPieces(CKBehavior* graph); 104 | 105 | std::vector m_ballTypes; 106 | std::vector m_floorTypes; 107 | std::vector m_moduls; 108 | std::vector m_modulContexs; 109 | std::vector m_modulBalls; 110 | }; -------------------------------------------------------------------------------- /virtools/CKObjectArray.cpp: -------------------------------------------------------------------------------- 1 | #include "CKObjectArray.h" 2 | 3 | NAKED int CKObjectArray::GetCount() { 4 | JUMP(0x24035F34); 5 | } 6 | 7 | NAKED int CKObjectArray::GetCurrentPos() { 8 | JUMP(0x2402158E); 9 | } 10 | 11 | NAKED CKObject CKObjectArray::* GetData(CKContext* context) { 12 | JUMP(0x2402A58F); 13 | } 14 | 15 | NAKED CK_ID CKObjectArray::GetDataId() { 16 | JUMP(0x2402A5E1); 17 | } 18 | 19 | NAKED CK_ID CKObjectArray::SetDataId(CK_ID id) { 20 | JUMP(0x2402A5A8); 21 | } 22 | 23 | NAKED CK_ID CKObjectArray::SetData(CKObject* obj) { 24 | JUMP(0x2402A5BF); 25 | } 26 | 27 | NAKED void CKObjectArray::Reset() { 28 | JUMP(0x2402A5EE); 29 | } 30 | 31 | NAKED CKBOOL CKObjectArray::PtrSeek(CKObject*) { 32 | JUMP(0x2402A7C1); 33 | } 34 | 35 | NAKED CKBOOL CKObjectArray::IDSeek(CK_ID id) { 36 | JUMP(0x2402A7D9); 37 | } 38 | 39 | NAKED CKBOOL CKObjectArray::PositionSeek(int Pos) { 40 | JUMP(0x2402A804); 41 | } 42 | 43 | NAKED CK_ID CKObjectArray::Seek(int Pos) { 44 | JUMP(0x2402A879); 45 | } 46 | 47 | NAKED void CKObjectArray::Next() { 48 | JUMP(0x2402A997); 49 | } 50 | 51 | NAKED void CKObjectArray::Previous() { 52 | JUMP(0x2402A980); 53 | } 54 | 55 | NAKED int CKObjectArray::GetPosition(CKObject* o) { 56 | JUMP(0x2402A928); 57 | } 58 | 59 | NAKED int CKObjectArray::GetPosition(CK_ID id) { 60 | JUMP(0x2402A954); 61 | } 62 | 63 | NAKED CK_ID CKObjectArray::PtrFind(CKObject*) { 64 | JUMP(0x2402A896); 65 | } 66 | 67 | NAKED CK_ID CKObjectArray::IDFind(CK_ID id) { 68 | JUMP(0x2402A8C7); 69 | } 70 | 71 | NAKED CK_ID CKObjectArray::PositionFind(int pos) { 72 | JUMP(0x2402A8F8); 73 | } 74 | 75 | NAKED void CKObjectArray::InsertFront(CKObject* obj) { 76 | JUMP(0x2402A6E7); 77 | } 78 | 79 | NAKED void CKObjectArray::InsertRear(CKObject* obj) { 80 | JUMP(0x2402A6FA); 81 | } 82 | 83 | NAKED void CKObjectArray::InsertAt(CKObject* obj) { 84 | JUMP(0x2402A75A); 85 | } 86 | 87 | NAKED CKBOOL CKObjectArray::AddIfNotHere(CKObject* obj) { 88 | JUMP(0x2402A76D); 89 | } 90 | 91 | NAKED CKBOOL CKObjectArray::AddIfNotHereSorted(CKObject* obj, OBJECTARRAYCMPFCT CmpFct, CKContext* context) { 92 | JUMP(0x2402A793); 93 | } 94 | 95 | NAKED void CKObjectArray::InsertFront(CK_ID id) { 96 | JUMP(0x2402A5F8); 97 | } 98 | 99 | NAKED void CKObjectArray::InsertRear(CK_ID id) { 100 | JUMP(0x2402A70D); 101 | } 102 | 103 | NAKED void CKObjectArray::InsertAt(CK_ID id) { 104 | JUMP(0x2402A64A); 105 | } 106 | 107 | NAKED CKBOOL CKObjectArray::AddIfNotHere(CK_ID id) { 108 | JUMP(0x2402A693); 109 | } 110 | 111 | NAKED CKBOOL CKObjectArray::AddIfNotHereSorted(CK_ID id, OBJECTARRAYCMPFCT CmpFct, CKContext* context) { 112 | JUMP(0x2402A6B9); 113 | } 114 | 115 | NAKED CKERROR CKObjectArray::Append(CKObjectArray* array) { 116 | JUMP(0x2402AB4A); 117 | } 118 | 119 | NAKED CK_ID CKObjectArray::RemoveFront() { 120 | JUMP(0x2402A9AF); 121 | } 122 | 123 | NAKED CK_ID CKObjectArray::RemoveRear() { 124 | JUMP(0x2402A9FD); 125 | } 126 | 127 | NAKED CK_ID CKObjectArray::RemoveAt() { 128 | JUMP(0x2402AA48); 129 | } 130 | 131 | NAKED CKBOOL CKObjectArray::Remove(CKObject*) { 132 | JUMP(0x2402AA89); 133 | } 134 | 135 | NAKED CKBOOL CKObjectArray::Remove(CK_ID id) { 136 | JUMP(0x2402AAA1); 137 | } 138 | 139 | NAKED void CKObjectArray::Clear() { 140 | JUMP(0x2402AADF); 141 | } 142 | 143 | NAKED CKBOOL CKObjectArray::EndOfList() { 144 | JUMP(0x2402A57E); 145 | } 146 | 147 | NAKED CKBOOL CKObjectArray::ListEmpty() { 148 | JUMP(0x2402A586); 149 | } 150 | 151 | NAKED void CKObjectArray::SwapCurrentWithNext() { 152 | JUMP(0x2402AB95); 153 | } 154 | 155 | NAKED void CKObjectArray::SwapCurrentWithPrevious() { 156 | JUMP(0x2402ABB6); 157 | } 158 | 159 | NAKED CKBOOL CKObjectArray::Check(CKContext* context) { 160 | JUMP(0x2402ABD5); 161 | } 162 | 163 | NAKED void CKObjectArray::Sort(OBJECTARRAYCMPFCT CmpFct, CKContext* context) { 164 | JUMP(0x2402AC4A); 165 | } 166 | 167 | NAKED void CKObjectArray::InsertSorted(CKObject* o, OBJECTARRAYCMPFCT CmpFct, CKContext* context) { 168 | JUMP(0x2402ACD4); 169 | } 170 | 171 | NAKED void CKObjectArray::InsertSorted(CK_ID id, OBJECTARRAYCMPFCT CmpFct, CKContext* context) { 172 | JUMP(0x2402ACF3); 173 | } 174 | -------------------------------------------------------------------------------- /virtools/CKAttributeManager.cpp: -------------------------------------------------------------------------------- 1 | #include "CKAttributeManager.h" 2 | 3 | NAKED CKAttributeType CKAttributeManager::RegisterNewAttributeType(CKSTRING Name, CKGUID ParameterType, CK_CLASSID CompatibleCid, CK_ATTRIBUT_FLAGS flags) { 4 | JUMP(0x2400AAD9); 5 | } 6 | 7 | NAKED void CKAttributeManager::UnRegisterAttribute(CKAttributeType AttribType) { 8 | JUMP(0x2400ACC3); 9 | } 10 | 11 | NAKED void CKAttributeManager::UnRegisterAttribute(CKSTRING atname) { 12 | JUMP(0x2400AD48); 13 | } 14 | 15 | NAKED CKSTRING CKAttributeManager::GetAttributeNameByType(CKAttributeType AttribType) { 16 | JUMP(0x2400AD93); 17 | } 18 | 19 | NAKED CKAttributeType CKAttributeManager::GetAttributeTypeByName(CKSTRING AttribName) { 20 | JUMP(0x2400ADAD); 21 | } 22 | 23 | NAKED void CKAttributeManager::SetAttributeNameByType(CKAttributeType AttribType, CKSTRING name) { 24 | JUMP(0x2400AFB2); 25 | } 26 | 27 | NAKED int CKAttributeManager::GetAttributeCount() { 28 | JUMP(0x2400E67D); 29 | } 30 | 31 | NAKED CKGUID CKAttributeManager::GetAttributeParameterGUID(CKAttributeType AttribType) { 32 | JUMP(0x2400AEBC); 33 | } 34 | 35 | NAKED CKParameterType CKAttributeManager::GetAttributeParameterType(CKAttributeType AttribType) { 36 | JUMP(0x2400AEF5); 37 | } 38 | 39 | NAKED CK_CLASSID CKAttributeManager::GetAttributeCompatibleClassId(CKAttributeType AttribType) { 40 | JUMP(0x2400AF28); 41 | } 42 | 43 | NAKED CKBOOL CKAttributeManager::IsAttributeIndexValid(CKAttributeType index) { 44 | JUMP(0x2400AFD8); 45 | } 46 | 47 | NAKED CKBOOL CKAttributeManager::IsCategoryIndexValid(CKAttributeCategory index) { 48 | JUMP(0x2400B2D4); 49 | } 50 | 51 | NAKED CK_ATTRIBUT_FLAGS CKAttributeManager::GetAttributeFlags(CKAttributeType AttribType) { 52 | JUMP(0x2400AF4A); 53 | } 54 | 55 | NAKED void CKAttributeManager::SetAttributeCallbackFunction(CKAttributeType AttribType, CKATTRIBUTECALLBACK fct, void* arg) { 56 | JUMP(0x2400AD60); 57 | } 58 | 59 | NAKED void CKAttributeManager::SetAttributeDefaultValue(CKAttributeType AttribType, CKSTRING DefaultVal) { 60 | JUMP(0x2400AE29); 61 | } 62 | 63 | NAKED CKSTRING CKAttributeManager::GetAttributeDefaultValue(CKAttributeType AttribType) { 64 | JUMP(0x2400AE9B); 65 | } 66 | 67 | NAKED const XObjectPointerArray& CKAttributeManager::GetAttributeListPtr(CKAttributeType AttribType) { 68 | JUMP(0x2400B3CE); 69 | } 70 | 71 | NAKED const XObjectPointerArray& CKAttributeManager::GetGlobalAttributeListPtr(CKAttributeType AttribType) { 72 | JUMP(0x2400B416); 73 | } 74 | 75 | NAKED const XObjectPointerArray& CKAttributeManager::FillListByAttributes(CKAttributeType* ListAttrib, int AttribCount) { 76 | JUMP(0x2400B2F5); 77 | } 78 | 79 | NAKED const XObjectPointerArray& CKAttributeManager::FillListByGlobalAttributes(CKAttributeType* ListAttrib, int AttribCount) { 80 | JUMP(0x2400B37B); 81 | } 82 | 83 | NAKED int CKAttributeManager::GetCategoriesCount() { 84 | JUMP(0x2401B69E); 85 | } 86 | 87 | NAKED CKSTRING CKAttributeManager::GetCategoryName(CKAttributeCategory index) { 88 | JUMP(0x2400B07E); 89 | } 90 | 91 | NAKED CKAttributeCategory CKAttributeManager::GetCategoryByName(CKSTRING Name) { 92 | JUMP(0x2400B03F); 93 | } 94 | 95 | NAKED void CKAttributeManager::SetCategoryName(CKAttributeCategory catType, CKSTRING name) { 96 | JUMP(0x2400B27E); 97 | } 98 | 99 | NAKED CKAttributeCategory CKAttributeManager::AddCategory(CKSTRING Category, CKDWORD flags) { 100 | JUMP(0x2400B0D6); 101 | } 102 | 103 | NAKED void CKAttributeManager::RemoveCategory(CKSTRING Category) { 104 | JUMP(0x2400B19C); 105 | } 106 | 107 | NAKED CKDWORD CKAttributeManager::GetCategoryFlags(CKAttributeCategory cat) { 108 | JUMP(0x2400AFF9); 109 | } 110 | 111 | NAKED CKDWORD CKAttributeManager::GetCategoryFlags(CKSTRING cat) { 112 | JUMP(0x2400B01A); 113 | } 114 | 115 | NAKED void CKAttributeManager::SetAttributeCategory(CKAttributeType AttribType, CKSTRING Category) { 116 | JUMP(0x2400B09E); 117 | } 118 | 119 | NAKED CKSTRING CKAttributeManager::GetAttributeCategory(CKAttributeType AttribType) { 120 | JUMP(0x2400AF6B); 121 | } 122 | 123 | NAKED CKAttributeCategory CKAttributeManager::GetAttributeCategoryIndex(CKAttributeType AttribType) { 124 | JUMP(0x2400AF91); 125 | } 126 | -------------------------------------------------------------------------------- /virtools/CKBitmapData.cpp: -------------------------------------------------------------------------------- 1 | #include "CKBitmapData.h" 2 | 3 | NAKED CKBOOL CKBitmapData::CreateImage(int Width, int Height, int BPP, int Slot, void* ImagePointer) { 4 | JUMP(0x2402FF59); 5 | } 6 | 7 | NAKED CKBOOL CKBitmapData::SaveImage(CKSTRING Name, int Slot, CKBOOL CKUseFormat) { 8 | JUMP(0x2402FBBA); 9 | } 10 | 11 | NAKED CKBOOL CKBitmapData::SaveImageAlpha(CKSTRING Name, int Slot) { 12 | JUMP(0x2402FD89); 13 | } 14 | 15 | NAKED CKSTRING CKBitmapData::GetMovieFileName() { 16 | JUMP(0x2403015B); 17 | } 18 | 19 | NAKED CKMovieReader* CKBitmapData::GetMovieReader() { 20 | JUMP(0x2403AF90); 21 | } 22 | 23 | NAKED CKBYTE* CKBitmapData::LockSurfacePtr(int Slot) { 24 | JUMP(0x24030120); 25 | } 26 | 27 | NAKED CKBOOL CKBitmapData::ReleaseSurfacePtr(int Slot) { 28 | JUMP(0x24030151); 29 | } 30 | 31 | NAKED CKSTRING CKBitmapData::GetSlotFileName(int Slot) { 32 | JUMP(0x24030170); 33 | } 34 | 35 | NAKED CKBOOL CKBitmapData::SetSlotFileName(int Slot, CKSTRING Filename) { 36 | JUMP(0x2403019C); 37 | } 38 | 39 | NAKED int CKBitmapData::GetWidth() { 40 | JUMP(0x2403AF9D); 41 | } 42 | 43 | NAKED int CKBitmapData::GetHeight() { 44 | JUMP(0x2403AFA1); 45 | } 46 | 47 | NAKED CKBOOL CKBitmapData::GetImageDesc(VxImageDescEx& oDesc) { 48 | JUMP(0x240302EC); 49 | } 50 | 51 | NAKED int CKBitmapData::GetSlotCount() { 52 | JUMP(0x240302CB); 53 | } 54 | 55 | NAKED CKBOOL CKBitmapData::SetSlotCount(int Count) { 56 | JUMP(0x24030201); 57 | } 58 | 59 | NAKED CKBOOL CKBitmapData::SetCurrentSlot(int Slot) { 60 | JUMP(0x24030462); 61 | } 62 | 63 | NAKED int CKBitmapData::GetCurrentSlot() { 64 | JUMP(0x2403051D); 65 | } 66 | 67 | NAKED CKBOOL CKBitmapData::ReleaseSlot(int Slot) { 68 | JUMP(0x2403052B); 69 | } 70 | 71 | NAKED CKBOOL CKBitmapData::ReleaseAllSlots() { 72 | JUMP(0x240305B5); 73 | } 74 | 75 | NAKED CKBOOL CKBitmapData::SetPixel(int x, int y, CKDWORD col, int slot) { 76 | JUMP(0x240300A5); 77 | } 78 | 79 | NAKED CKDWORD CKBitmapData::GetPixel(int x, int y, int slot) { 80 | JUMP(0x240300E6); 81 | } 82 | 83 | NAKED CKDWORD CKBitmapData::GetTransparentColor() { 84 | JUMP(0x2403AFC8); 85 | } 86 | 87 | NAKED void CKBitmapData::SetTransparentColor(CKDWORD Color) { 88 | JUMP(0x240301CA); 89 | } 90 | 91 | NAKED void CKBitmapData::SetTransparent(CKBOOL Transparency) { 92 | JUMP(0x240301E5); 93 | } 94 | 95 | NAKED CKBOOL CKBitmapData::IsTransparent() { 96 | JUMP(0x2403AFCC); 97 | } 98 | 99 | NAKED CK_BITMAP_SAVEOPTIONS CKBitmapData::GetSaveOptions() { 100 | JUMP(0x2403AFD3); 101 | } 102 | 103 | NAKED void CKBitmapData::SetSystemCaching(CK_BITMAP_SYSTEMCACHING iOptions) { 104 | UNDEFINED; 105 | } 106 | 107 | NAKED CK_BITMAP_SYSTEMCACHING CKBitmapData::GetSystemCaching() { 108 | UNDEFINED; 109 | } 110 | 111 | NAKED void CKBitmapData::SetSaveOptions(CK_BITMAP_SAVEOPTIONS Options) { 112 | JUMP(0x2403AFD7); 113 | } 114 | 115 | NAKED CKBitmapProperties* CKBitmapData::GetSaveFormat() { 116 | JUMP(0x2403AFE1); 117 | } 118 | 119 | NAKED void CKBitmapData::SetSaveFormat(CKBitmapProperties* format) { 120 | JUMP(0x24030088); 121 | } 122 | 123 | NAKED void CKBitmapData::SetPickThreshold(int pt) { 124 | JUMP(0x2403AFE5); 125 | } 126 | 127 | NAKED int CKBitmapData::GetPickThreshold() { 128 | JUMP(0x2403AFEF); 129 | } 130 | 131 | NAKED void CKBitmapData::SetCubeMap(CKBOOL CubeMap) { 132 | JUMP(0x2403AFF3); 133 | } 134 | 135 | NAKED CKBOOL CKBitmapData::IsCubeMap() { 136 | JUMP(0x2403B012); 137 | } 138 | 139 | NAKED void CKBitmapData::SetVolumeMap(CKBOOL VolumeMap) { 140 | UNDEFINED; 141 | } 142 | 143 | NAKED CKBOOL CKBitmapData::IsVolumeMap() { 144 | UNDEFINED; 145 | } 146 | 147 | NAKED CKBOOL CKBitmapData::HasOriginalFile() { 148 | UNDEFINED; 149 | } 150 | 151 | NAKED CKBOOL CKBitmapData::ResizeImages(int Width, int Height) { 152 | JUMP(0x2403032E); 153 | } 154 | 155 | NAKED void CKBitmapData::SetDynamicHint(CKBOOL Dynamic) { 156 | UNDEFINED; 157 | } 158 | 159 | NAKED CKBOOL CKBitmapData::GetDynamicHint() { 160 | UNDEFINED; 161 | } 162 | 163 | NAKED void CKBitmapData::AuthorizeConditionalNonPow2(CKBOOL iAuthorize) { 164 | UNDEFINED; 165 | } 166 | 167 | NAKED CKBOOL CKBitmapData::IsConditionalNonPow2Authorized() { 168 | UNDEFINED; 169 | } 170 | -------------------------------------------------------------------------------- /minhook/trampoline.h: -------------------------------------------------------------------------------- 1 | /* 2 | * MinHook - The Minimalistic API Hooking Library for x64/x86 3 | * Copyright (C) 2009-2017 Tsuda Kageyu. 4 | * All rights reserved. 5 | * 6 | * Redistribution and use in source and binary forms, with or without 7 | * modification, are permitted provided that the following conditions 8 | * are met: 9 | * 10 | * 1. Redistributions of source code must retain the above copyright 11 | * notice, this list of conditions and the following disclaimer. 12 | * 2. Redistributions in binary form must reproduce the above copyright 13 | * notice, this list of conditions and the following disclaimer in the 14 | * documentation and/or other materials provided with the distribution. 15 | * 16 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 17 | * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED 18 | * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A 19 | * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER 20 | * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 21 | * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 22 | * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 23 | * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF 24 | * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 25 | * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 26 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 27 | */ 28 | 29 | #pragma once 30 | 31 | #pragma pack(push, 1) 32 | 33 | // Structs for writing x86/x64 instructions. 34 | 35 | // 8-bit relative jump. 36 | typedef struct _JMP_REL_SHORT 37 | { 38 | UINT8 opcode; // EB xx: JMP +2+xx 39 | UINT8 operand; 40 | } JMP_REL_SHORT, *PJMP_REL_SHORT; 41 | 42 | // 32-bit direct relative jump/call. 43 | typedef struct _JMP_REL 44 | { 45 | UINT8 opcode; // E9/E8 xxxxxxxx: JMP/CALL +5+xxxxxxxx 46 | UINT32 operand; // Relative destination address 47 | } JMP_REL, *PJMP_REL, CALL_REL; 48 | 49 | // 64-bit indirect absolute jump. 50 | typedef struct _JMP_ABS 51 | { 52 | UINT8 opcode0; // FF25 00000000: JMP [+6] 53 | UINT8 opcode1; 54 | UINT32 dummy; 55 | UINT64 address; // Absolute destination address 56 | } JMP_ABS, *PJMP_ABS; 57 | 58 | // 64-bit indirect absolute call. 59 | typedef struct _CALL_ABS 60 | { 61 | UINT8 opcode0; // FF15 00000002: CALL [+6] 62 | UINT8 opcode1; 63 | UINT32 dummy0; 64 | UINT8 dummy1; // EB 08: JMP +10 65 | UINT8 dummy2; 66 | UINT64 address; // Absolute destination address 67 | } CALL_ABS; 68 | 69 | // 32-bit direct relative conditional jumps. 70 | typedef struct _JCC_REL 71 | { 72 | UINT8 opcode0; // 0F8* xxxxxxxx: J** +6+xxxxxxxx 73 | UINT8 opcode1; 74 | UINT32 operand; // Relative destination address 75 | } JCC_REL; 76 | 77 | // 64bit indirect absolute conditional jumps that x64 lacks. 78 | typedef struct _JCC_ABS 79 | { 80 | UINT8 opcode; // 7* 0E: J** +16 81 | UINT8 dummy0; 82 | UINT8 dummy1; // FF25 00000000: JMP [+6] 83 | UINT8 dummy2; 84 | UINT32 dummy3; 85 | UINT64 address; // Absolute destination address 86 | } JCC_ABS; 87 | 88 | #pragma pack(pop) 89 | 90 | typedef struct _TRAMPOLINE 91 | { 92 | LPVOID pTarget; // [In] Address of the target function. 93 | LPVOID pDetour; // [In] Address of the detour function. 94 | LPVOID pTrampoline; // [In] Buffer address for the trampoline and relay function. 95 | 96 | #if defined(_M_X64) || defined(__x86_64__) 97 | LPVOID pRelay; // [Out] Address of the relay function. 98 | #endif 99 | BOOL patchAbove; // [Out] Should use the hot patch area? 100 | UINT nIP; // [Out] Number of the instruction boundaries. 101 | UINT8 oldIPs[8]; // [Out] Instruction boundaries of the target function. 102 | UINT8 newIPs[8]; // [Out] Instruction boundaries of the trampoline function. 103 | } TRAMPOLINE, *PTRAMPOLINE; 104 | 105 | BOOL CreateTrampolineFunction(PTRAMPOLINE ct); 106 | -------------------------------------------------------------------------------- /virtools/XHashFun.h: -------------------------------------------------------------------------------- 1 | /*************************************************************************/ 2 | /* File : XHashFun.h */ 3 | /* Author : Aymeric Bard */ 4 | /* */ 5 | /* Virtools SDK */ 6 | /* Copyright (c) Virtools 2000, All Rights Reserved. */ 7 | /*************************************************************************/ 8 | 9 | 10 | #ifndef _XHashFun_H_ 11 | #define _XHashFun_H_ 12 | 13 | #include "XString.h" 14 | #include "XUtil.h" 15 | 16 | #ifdef _WIN32_WCE 17 | #include "VxMathCE.H" 18 | #else 19 | #include 20 | #include 21 | #endif 22 | /************************************************ 23 | Summary: A serie of comparison function 24 | 25 | Remarks 26 | 27 | 28 | ************************************************/ 29 | template 30 | struct XEqual 31 | { 32 | int operator()(const K& iK1,const K& iK2) const { 33 | return (iK1 == iK2); 34 | } 35 | }; 36 | 37 | 38 | template <> 39 | struct XEqual 40 | { 41 | int operator()(const char* iS1,const char* iS2) const { return !strcmp(iS1,iS2); } 42 | }; 43 | 44 | 45 | template <> 46 | struct XEqual 47 | { 48 | int operator()(const char* iS1,const char* iS2) const { return !strcmp(iS1,iS2); } 49 | }; 50 | 51 | 52 | struct XEqualXStringI 53 | { 54 | int operator()(const XString& iS1,const XString& iS2) const { return !iS1.ICompare(iS2); } 55 | }; 56 | 57 | 58 | struct XEqualStringI 59 | { 60 | int operator()(const char* iS1,const char* iS2) const { return !_stricmp(iS1,iS2); } 61 | }; 62 | 63 | /************************************************ 64 | Summary: A serie of hash functions 65 | 66 | Remarks 67 | These hash functions are designed to be used when declaring a hash table where the 68 | key is one of the following type : 69 | 70 | o XHashFunString : hash function for char* key 71 | o XHashFunXString : hash function for XString key 72 | o XHashFunChar : hash function for char key 73 | o XHashFunByte : hash function for BYTE key 74 | o XHashFunWord : hash function for WORD key 75 | o XHashFunDword : hash function for DWORD key 76 | o XHashFunInt : hash function for int key 77 | o XHashFunFloat : hash function for float key 78 | o XHashFunPtr : hash function for void* key 79 | 80 | 81 | ************************************************/ 82 | template 83 | struct XHashFun 84 | { 85 | int operator ()(const K& iK) 86 | { 87 | return (int) iK; 88 | } 89 | }; 90 | 91 | 92 | // NB hashing should return unsigned int 93 | // and be multiplied by 2654435761 (Knuth method : golden ratio of 2^32) 94 | 95 | 96 | inline int XHashString(const char* __s) 97 | { 98 | unsigned int __h = 0; 99 | for ( ; *__s; ++__s) 100 | __h = 5*__h + *__s; 101 | 102 | return int(__h); 103 | } 104 | 105 | 106 | inline int XHashStringI(const char* __s) 107 | { 108 | unsigned int __h = 0; 109 | 110 | for ( ; *__s; ++__s) 111 | { 112 | // GG : ANSI Compliant 113 | __h = 5*__h + tolower(*__s); 114 | } 115 | 116 | return int(__h); 117 | } 118 | 119 | 120 | template <> 121 | struct XHashFun 122 | { 123 | int operator()(const char* __s) const { return XHashString(__s); } 124 | }; 125 | 126 | 127 | template <> 128 | struct XHashFun 129 | { 130 | int operator()(const char* __s) const { return XHashString(__s); } 131 | }; 132 | 133 | 134 | template <> 135 | struct XHashFun 136 | { 137 | int operator()(const XString& __s) const { return XHashString(__s.CStr()); } 138 | }; 139 | 140 | 141 | template <> 142 | struct XHashFun 143 | { 144 | int operator()(const float __x) const { return *(int*)&__x; } 145 | }; 146 | 147 | 148 | template <> 149 | struct XHashFun 150 | { 151 | int operator()(const void* __x) const { return (int)__x>>8; } 152 | }; 153 | 154 | 155 | template <> 156 | struct XHashFun 157 | { 158 | int operator()(const XGUID& __s) const 159 | { 160 | return __s.d1; 161 | } 162 | }; 163 | 164 | 165 | struct XHashFunStringI 166 | { 167 | int operator()(const char* __s) const { return XHashStringI(__s); } 168 | }; 169 | 170 | 171 | struct XHashFunXStringI 172 | { 173 | int operator()(const XString& __s) const { return XHashStringI(__s.CStr()); } 174 | }; 175 | 176 | #endif 177 | -------------------------------------------------------------------------------- /ScriptHelper.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "virtools/CKAll.h" 4 | #include 5 | 6 | namespace ScriptHelper { 7 | BML_EXPORT bool FindBB(CKBehavior* script, std::function callback, CKSTRING name = nullptr, bool hierarchically = false, 8 | int inputCnt = -1, int outputCnt = -1, int inputParamCnt = -1, int outputParamCnt = -1); 9 | BML_EXPORT CKBehavior* FindFirstBB(CKBehavior* script, CKSTRING name = nullptr, bool hierarchically = false, 10 | int inputCnt = -1, int outputCnt = -1, int inputParamCnt = -1, int outputParamCnt = -1); 11 | 12 | BML_EXPORT CKBehaviorLink* CreateLink(CKBehavior* script, CKBehavior* inBeh, CKBehavior* outBeh, int inPos = 0, int outPos = 0, int delay = 0); 13 | BML_EXPORT CKBehaviorLink* CreateLink(CKBehavior* script, CKBehavior* inBeh, CKBehaviorIO* out, int inPos = 0, int delay = 0); 14 | BML_EXPORT CKBehaviorLink* CreateLink(CKBehavior* script, CKBehaviorIO* in, CKBehavior* outBeh, int outPos = 0, int delay = 0); 15 | BML_EXPORT CKBehaviorLink* CreateLink(CKBehavior* script, CKBehaviorIO* in, CKBehaviorIO* out, int delay = 0); 16 | 17 | BML_EXPORT CKBehavior* CreateBB(CKBehavior* script, CKGUID guid, bool target = false); 18 | BML_EXPORT void InsertBB(CKBehavior* script, CKBehaviorLink* link, CKBehavior* beh, int inPos = 0, int outPos = 0); 19 | 20 | BML_EXPORT CKParameterLocal* CreateLocalParameter(CKBehavior* script, CKSTRING name, CKGUID type); 21 | BML_EXPORT CKParameterLocal* CreateParamObject(CKBehavior* script, CKSTRING name, CKGUID guid, CKObject* value); 22 | BML_EXPORT CKParameterLocal* CreateParamString(CKBehavior* script, CKSTRING name, CKSTRING value); 23 | template 24 | CKParameterLocal* CreateParamValue(CKBehavior* script, CKSTRING name, CKGUID guid, T value) { 25 | CKParameterLocal* param = CreateLocalParameter(script, name, guid); 26 | param->SetValue(&value, sizeof(T)); 27 | return param; 28 | } 29 | 30 | BML_EXPORT void SetParamObject(CKParameter* param, CKObject* value); 31 | BML_EXPORT void SetParamString(CKParameter* param, CKSTRING value); 32 | template 33 | void SetParamValue(CKParameter* param, T value) { 34 | param->SetValue(&value, sizeof(T)); 35 | } 36 | 37 | BML_EXPORT CKObject* GetParamObject(CKParameter* param); 38 | BML_EXPORT CKSTRING GetParamString(CKParameter* param); 39 | template 40 | T GetParamValue(CKParameter* param) { 41 | T res; 42 | param->GetValue(&res); 43 | return res; 44 | } 45 | 46 | BML_EXPORT CKBehaviorLink* FindNextLink(CKBehavior* script, CKBehavior* beh, CKSTRING name = nullptr, int inPos = -1, int outPos = -1, 47 | int inputCnt = -1, int outputCnt = -1, int inputParamCnt = -1, int outputParamCnt = -1); 48 | BML_EXPORT CKBehaviorLink* FindPreviousLink(CKBehavior* script, CKBehavior* beh, CKSTRING name = nullptr, int inPos = -1, int outPos = -1, 49 | int inputCnt = -1, int outputCnt = -1, int inputParamCnt = -1, int outputParamCnt = -1); 50 | 51 | BML_EXPORT CKBehavior* FindNextBB(CKBehavior* script, CKBehavior* beh, CKSTRING name = nullptr, int inPos = -1, int outPos = -1, 52 | int inputCnt = -1, int outputCnt = -1, int inputParamCnt = -1, int outputParamCnt = -1); 53 | BML_EXPORT CKBehavior* FindPreviousBB(CKBehavior* script, CKBehavior* beh, CKSTRING name = nullptr, int inPos = -1, int outPos = -1, 54 | int inputCnt = -1, int outputCnt = -1, int inputParamCnt = -1, int outputParamCnt = -1); 55 | 56 | BML_EXPORT CKBehaviorLink* FindNextLink(CKBehavior* script, CKBehaviorIO* io, CKSTRING name = nullptr, int outPos = -1, 57 | int inputCnt = -1, int outputCnt = -1, int inputParamCnt = -1, int outputParamCnt = -1); 58 | BML_EXPORT CKBehaviorLink* FindPreviousLink(CKBehavior* script, CKBehaviorIO* io, CKSTRING name = nullptr, int inPos = -1, 59 | int inputCnt = -1, int outputCnt = -1, int inputParamCnt = -1, int outputParamCnt = -1); 60 | 61 | BML_EXPORT CKBehavior* FindNextBB(CKBehavior* script, CKBehaviorIO* io, CKSTRING name = nullptr, int outPos = -1, 62 | int inputCnt = -1, int outputCnt = -1, int inputParamCnt = -1, int outputParamCnt = -1); 63 | BML_EXPORT CKBehavior* FindPreviousBB(CKBehavior* script, CKBehaviorIO* io, CKSTRING name = nullptr, int inPos = -1, 64 | int inputCnt = -1, int outputCnt = -1, int inputParamCnt = -1, int outputParamCnt = -1); 65 | 66 | BML_EXPORT CKBehavior* FindEndOfChain(CKBehavior* script, CKBehavior* beh); 67 | 68 | BML_EXPORT void DeleteLink(CKBehavior* script, CKBehaviorLink* link); 69 | BML_EXPORT void DeleteBB(CKBehavior* script, CKBehavior* beh); 70 | }; -------------------------------------------------------------------------------- /minhook/LICENSE.txt: -------------------------------------------------------------------------------- 1 | MinHook - The Minimalistic API Hooking Library for x64/x86 2 | Copyright (C) 2009-2017 Tsuda Kageyu. 3 | All rights reserved. 4 | 5 | Redistribution and use in source and binary forms, with or without 6 | modification, are permitted provided that the following conditions 7 | are met: 8 | 9 | 1. Redistributions of source code must retain the above copyright 10 | notice, this list of conditions and the following disclaimer. 11 | 2. Redistributions in binary form must reproduce the above copyright 12 | notice, this list of conditions and the following disclaimer in the 13 | documentation and/or other materials provided with the distribution. 14 | 15 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 16 | "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED 17 | TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A 18 | PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER 19 | OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 20 | EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 21 | PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 22 | PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF 23 | LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 24 | NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 25 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 26 | 27 | ================================================================================ 28 | Portions of this software are Copyright (c) 2008-2009, Vyacheslav Patkov. 29 | ================================================================================ 30 | Hacker Disassembler Engine 32 C 31 | Copyright (c) 2008-2009, Vyacheslav Patkov. 32 | All rights reserved. 33 | 34 | Redistribution and use in source and binary forms, with or without 35 | modification, are permitted provided that the following conditions 36 | are met: 37 | 38 | 1. Redistributions of source code must retain the above copyright 39 | notice, this list of conditions and the following disclaimer. 40 | 2. Redistributions in binary form must reproduce the above copyright 41 | notice, this list of conditions and the following disclaimer in the 42 | documentation and/or other materials provided with the distribution. 43 | 44 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 45 | "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED 46 | TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A 47 | PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR 48 | CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 49 | EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 50 | PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 51 | PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF 52 | LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 53 | NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 54 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 55 | 56 | ------------------------------------------------------------------------------- 57 | Hacker Disassembler Engine 64 C 58 | Copyright (c) 2008-2009, Vyacheslav Patkov. 59 | All rights reserved. 60 | 61 | Redistribution and use in source and binary forms, with or without 62 | modification, are permitted provided that the following conditions 63 | are met: 64 | 65 | 1. Redistributions of source code must retain the above copyright 66 | notice, this list of conditions and the following disclaimer. 67 | 2. Redistributions in binary form must reproduce the above copyright 68 | notice, this list of conditions and the following disclaimer in the 69 | documentation and/or other materials provided with the distribution. 70 | 71 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 72 | "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED 73 | TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A 74 | PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR 75 | CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 76 | EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 77 | PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 78 | PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF 79 | LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 80 | NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 81 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 82 | -------------------------------------------------------------------------------- /virtools/VxMath.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | typedef XArray XVoidArray; 4 | 5 | #include "VxMutex.h" 6 | #include "CKGlobals.h" 7 | struct VxImageDescEx; 8 | 9 | void InitVxMath(); 10 | void VxDetectProcessor(); 11 | 12 | //------ Interpolation 13 | BML_EXPORT void InterpolateFloatArray(void* Res, void* array1, void* array2, float factor, int count); 14 | BML_EXPORT void InterpolateVectorArray(void* Res, void* Inarray1, void* Inarray2, float factor, int count, DWORD StrideRes, DWORD StrideIn); 15 | BML_EXPORT void MultiplyVectorArray(void* Res, void* Inarray1, const VxVector& factor, int count, DWORD StrideRes, DWORD StrideIn); 16 | BML_EXPORT void MultiplyVector2Array(void* Res, void* Inarray1, const Vx2DVector& factor, int count, DWORD StrideRes, DWORD StrideIn); 17 | BML_EXPORT void MultiplyVector4Array(void* Res, void* Inarray1, const VxVector4& factor, int count, DWORD StrideRes, DWORD StrideIn); 18 | BML_EXPORT void MultiplyAddVectorArray(void* Res, void* Inarray1, const VxVector& factor, const VxVector& offset, int count, DWORD StrideRes, DWORD StrideIn); 19 | BML_EXPORT void MultiplyAddVector4Array(void* Res, void* Inarray1, const VxVector4& factor, const VxVector4& offset, int count, DWORD StrideRes, DWORD StrideIn); 20 | BML_EXPORT BOOL VxTransformBox2D(const VxMatrix& World_ProjectionMat, const VxBbox& box, VxRect* ScreenSize, VxRect* Extents, VXCLIP_FLAGS& OrClipFlags, VXCLIP_FLAGS& AndClipFlags); 21 | BML_EXPORT void VxProjectBoxZExtents(const VxMatrix& World_ProjectionMat, const VxBbox& box, float& ZhMin, float& ZhMax); 22 | 23 | //------- Structure copying 24 | BML_EXPORT BOOL VxFillStructure(int Count, void* Dst, DWORD Stride, DWORD SizeSrc, void* Src); 25 | BML_EXPORT BOOL VxCopyStructure(int Count, void* Dst, DWORD OutStride, DWORD SizeSrc, void* Src, DWORD InStride); 26 | BML_EXPORT BOOL VxFillStructure(int Count, const VxStridedData& Dst, DWORD SizeSrc, void* Src); 27 | BML_EXPORT BOOL VxCopyStructure(int Count, const VxStridedData& Dst, DWORD SizeSrc, const VxStridedData& Src); 28 | 29 | 30 | BML_EXPORT BOOL VxIndexedCopy(const VxStridedData& Dst, const VxStridedData& Src, DWORD SizeSrc, int* Indices, int IndexCount); 31 | BML_EXPORT BOOL VxIndexedCopy(const VxStridedData& Dst, const VxStridedData& Src, DWORD SizeSrc, WORD* Indices, int IndexCount); 32 | 33 | //---- Graphic Utilities 34 | BML_EXPORT void VxDoBlit(const VxImageDescEx& src_desc, const VxImageDescEx& dst_desc); 35 | BML_EXPORT void VxDoBlitUpsideDown(const VxImageDescEx& src_desc, const VxImageDescEx& dst_desc); 36 | 37 | BML_EXPORT void VxDoBlitDeInterleaved(const VxImageDescEx& src_desc, const VxImageDescEx& dst_desc, const BOOL iField1First); 38 | BML_EXPORT void VxDoBlitDeInterleavedUpsideDown(const VxImageDescEx& src_desc, const VxImageDescEx& dst_desc, const BOOL iField1First); 39 | 40 | BML_EXPORT void VxDoAlphaBlit(const VxImageDescEx& dst_desc, BYTE AlphaValue); 41 | BML_EXPORT void VxDoAlphaBlit(const VxImageDescEx& dst_desc, BYTE* AlphaValues); 42 | 43 | BML_EXPORT void VxGetBitCounts(const VxImageDescEx& desc, DWORD& Rbits, DWORD& Gbits, DWORD& Bbits, DWORD& Abits); 44 | BML_EXPORT void VxGetBitShifts(const VxImageDescEx& desc, DWORD& Rshift, DWORD& Gshift, DWORD& Bshift, DWORD& Ashift); 45 | 46 | BML_EXPORT void VxGenerateMipMap(const VxImageDescEx& src_desc, BYTE* DestBuffer); 47 | BML_EXPORT void VxResizeImage32(const VxImageDescEx& src_desc, const VxImageDescEx& dst_desc); 48 | 49 | BML_EXPORT BOOL VxConvertToNormalMap(const VxImageDescEx& image, DWORD ColorMask); 50 | BML_EXPORT BOOL VxConvertToBumpMap(const VxImageDescEx& image); 51 | 52 | BML_EXPORT DWORD GetBitCount(DWORD dwMask); 53 | BML_EXPORT DWORD GetBitShift(DWORD dwMask); 54 | 55 | BML_EXPORT VX_PIXELFORMAT VxImageDesc2PixelFormat(const VxImageDescEx& desc); 56 | BML_EXPORT void VxPixelFormat2ImageDesc(VX_PIXELFORMAT Pf, VxImageDescEx& desc); 57 | BML_EXPORT const char* VxPixelFormat2String(VX_PIXELFORMAT Pf); 58 | 59 | BML_EXPORT void VxBppToMask(VxImageDescEx& desc); 60 | 61 | BML_EXPORT int GetQuantizationSamplingFactor(); 62 | BML_EXPORT void SetQuantizationSamplingFactor(int sf); 63 | 64 | //---- Processor features 65 | BML_EXPORT char* GetProcessorDescription(); 66 | BML_EXPORT int GetProcessorFrequency(); 67 | BML_EXPORT DWORD GetProcessorFeatures(); 68 | BML_EXPORT void ModifyProcessorFeatures(DWORD Add, DWORD Remove); 69 | BML_EXPORT ProcessorsType GetProcessorType(); 70 | 71 | BML_EXPORT BOOL VxPtInRect(CKRECT* rect, CKPOINT* pt); 72 | 73 | // Summary: Compute best Fit Box for a set of points 74 | // 75 | BML_EXPORT BOOL VxComputeBestFitBBox(const BYTE* Points, const DWORD Stride, const int Count, VxMatrix& BBoxMatrix, const float AdditionnalBorder); 76 | 77 | BML_EXPORT void VxAddDirectorySeparator(XString& path); 78 | BML_EXPORT void VxConvertPathToSystemPath(XString& path); 79 | --------------------------------------------------------------------------------