diff --git a/.gitignore b/.gitignore index c6aaaef..1d5b89a 100644 --- a/.gitignore +++ b/.gitignore @@ -6,4 +6,5 @@ *.log *.pch *.pdb -*.tlog \ No newline at end of file +*.tlog +*.sdf \ No newline at end of file diff --git a/Mod Sources/BaseMod/BaseMod.suo b/Mod Sources/BaseMod/BaseMod.suo index fbb1d4a..a63c096 100644 Binary files a/Mod Sources/BaseMod/BaseMod.suo and b/Mod Sources/BaseMod/BaseMod.suo differ diff --git a/Mod Sources/BaseMod/BaseMod/BaseMod.h b/Mod Sources/BaseMod/BaseMod/BaseMod.h deleted file mode 100644 index 98515c8..0000000 --- a/Mod Sources/BaseMod/BaseMod/BaseMod.h +++ /dev/null @@ -1,8 +0,0 @@ -// The following ifdef block is the standard way of creating macros which make exporting -// from a DLL simpler. All files within this DLL are compiled with the BASEMOD_EXPORTS -// symbol defined on the command line. This symbol should not be defined on any project -// that uses this DLL. This way any other project whose source files include this file see -// BASEMOD_API functions as being imported from a DLL, whereas this DLL sees symbols -// defined with this macro as being exported. - -#define BASEMOD_API __declspec( dllexport ) diff --git a/Mod Sources/BaseMod/BaseMod/BaseMod.vcxproj b/Mod Sources/BaseMod/BaseMod/BaseMod.vcxproj index 18bf690..ccff6a4 100644 --- a/Mod Sources/BaseMod/BaseMod/BaseMod.vcxproj +++ b/Mod Sources/BaseMod/BaseMod/BaseMod.vcxproj @@ -39,13 +39,15 @@ true + include;$(IncludePath) false + include;$(IncludePath) - Use + NotUsing Level3 Disabled WIN32;_DEBUG;_WINDOWS;_USRDLL;BASEMOD_EXPORTS;%(PreprocessorDefinitions) @@ -58,7 +60,7 @@ Level3 - Use + NotUsing MaxSpeed true true @@ -72,27 +74,8 @@ - - - - - - - - - - - false - - - false - - - - - Create - Create - + + diff --git a/Mod Sources/BaseMod/BaseMod/BaseMod.vcxproj.filters b/Mod Sources/BaseMod/BaseMod/BaseMod.vcxproj.filters index 8c8706a..cbc2d4a 100644 --- a/Mod Sources/BaseMod/BaseMod/BaseMod.vcxproj.filters +++ b/Mod Sources/BaseMod/BaseMod/BaseMod.vcxproj.filters @@ -15,27 +15,10 @@ - - - - - Header Files - - - Header Files - - - Header Files - - - - + Source Files - - Source Files - - + Source Files diff --git a/Mod Sources/BaseMod/BaseMod/ReadMe.txt b/Mod Sources/BaseMod/BaseMod/ReadMe.txt deleted file mode 100644 index 59d4e6e..0000000 --- a/Mod Sources/BaseMod/BaseMod/ReadMe.txt +++ /dev/null @@ -1,40 +0,0 @@ -======================================================================== - DYNAMIC LINK LIBRARY : BaseMod Project Overview -======================================================================== - -AppWizard has created this BaseMod DLL for you. - -This file contains a summary of what you will find in each of the files that -make up your BaseMod application. - - -BaseMod.vcxproj - This is the main project file for VC++ projects generated using an Application Wizard. - It contains information about the version of Visual C++ that generated the file, and - information about the platforms, configurations, and project features selected with the - Application Wizard. - -BaseMod.vcxproj.filters - This is the filters file for VC++ projects generated using an Application Wizard. - It contains information about the association between the files in your project - and the filters. This association is used in the IDE to show grouping of files with - similar extensions under a specific node (for e.g. ".cpp" files are associated with the - "Source Files" filter). - -BaseMod.cpp - This is the main DLL source file. - -///////////////////////////////////////////////////////////////////////////// -Other standard files: - -StdAfx.h, StdAfx.cpp - These files are used to build a precompiled header (PCH) file - named BaseMod.pch and a precompiled types file named StdAfx.obj. - -///////////////////////////////////////////////////////////////////////////// -Other notes: - -AppWizard uses "TODO:" comments to indicate parts of the source code you -should add to or customize. - -///////////////////////////////////////////////////////////////////////////// diff --git a/Mod Sources/BaseMod/BaseMod/BaseMod.cpp b/Mod Sources/BaseMod/BaseMod/source/BaseMod.cpp similarity index 53% rename from Mod Sources/BaseMod/BaseMod/BaseMod.cpp rename to Mod Sources/BaseMod/BaseMod/source/BaseMod.cpp index 758f453..0d43ca7 100644 --- a/Mod Sources/BaseMod/BaseMod/BaseMod.cpp +++ b/Mod Sources/BaseMod/BaseMod/source/BaseMod.cpp @@ -1,13 +1,10 @@ -// BaseMod.cpp : Defines the exported functions for the DLL application. -// - -#include "stdafx.h" -#include "BaseMod.h" - -extern "C" -{ - BASEMOD_API void ModInitialize(void) - { - return; - } -} \ No newline at end of file +// BaseMod.cpp : Defines the exported functions for the DLL application. +// + +extern "C" +{ + __declspec(dllexport) void ModInitialize(void) + { + return; + } +} diff --git a/Mod Sources/RandomMod/BaseMod/dllmain.cpp b/Mod Sources/BaseMod/BaseMod/source/dllmain.cpp similarity index 89% rename from Mod Sources/RandomMod/BaseMod/dllmain.cpp rename to Mod Sources/BaseMod/BaseMod/source/dllmain.cpp index 8a4edd3..cafeb4a 100644 --- a/Mod Sources/RandomMod/BaseMod/dllmain.cpp +++ b/Mod Sources/BaseMod/BaseMod/source/dllmain.cpp @@ -1,19 +1,20 @@ -// dllmain.cpp : Defines the entry point for the DLL application. -#include "stdafx.h" - -BOOL APIENTRY DllMain( HMODULE hModule, - DWORD ul_reason_for_call, - LPVOID lpReserved - ) -{ - switch (ul_reason_for_call) - { - case DLL_PROCESS_ATTACH: - case DLL_THREAD_ATTACH: - case DLL_THREAD_DETACH: - case DLL_PROCESS_DETACH: - break; - } - return TRUE; -} - +// dllmain.cpp : Defines the entry point for the DLL application. + +#include +#include + +BOOL APIENTRY DllMain( HMODULE hModule, + DWORD ul_reason_for_call, + LPVOID lpReserved + ) +{ + switch (ul_reason_for_call) + { + case DLL_PROCESS_ATTACH: + case DLL_THREAD_ATTACH: + case DLL_THREAD_DETACH: + case DLL_PROCESS_DETACH: + break; + } + return TRUE; +} diff --git a/Mod Sources/BaseMod/BaseMod/stdafx.cpp b/Mod Sources/BaseMod/BaseMod/stdafx.cpp deleted file mode 100644 index 866f2bd..0000000 --- a/Mod Sources/BaseMod/BaseMod/stdafx.cpp +++ /dev/null @@ -1,8 +0,0 @@ -// stdafx.cpp : source file that includes just the standard includes -// BaseMod.pch will be the pre-compiled header -// stdafx.obj will contain the pre-compiled type information - -#include "stdafx.h" - -// TODO: reference any additional headers you need in STDAFX.H -// and not in this file diff --git a/Mod Sources/BaseMod/BaseMod/stdafx.h b/Mod Sources/BaseMod/BaseMod/stdafx.h deleted file mode 100644 index 677e68a..0000000 --- a/Mod Sources/BaseMod/BaseMod/stdafx.h +++ /dev/null @@ -1,16 +0,0 @@ -// stdafx.h : include file for standard system include files, -// or project specific include files that are used frequently, but -// are changed infrequently -// - -#pragma once - -#include "targetver.h" - -#define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers -// Windows Header Files: -#include - - - -// TODO: reference additional headers your program requires here diff --git a/Mod Sources/BaseMod/BaseMod/targetver.h b/Mod Sources/BaseMod/BaseMod/targetver.h deleted file mode 100644 index 90e767b..0000000 --- a/Mod Sources/BaseMod/BaseMod/targetver.h +++ /dev/null @@ -1,8 +0,0 @@ -#pragma once - -// Including SDKDDKVer.h defines the highest available Windows platform. - -// If you wish to build your application for a previous Windows platform, include WinSDKVer.h and -// set the _WIN32_WINNT macro to the platform you wish to support before including SDKDDKVer.h. - -#include diff --git a/Mod Sources/RandomMod/BaseMod/ReadMe.txt b/Mod Sources/RandomMod/BaseMod/ReadMe.txt deleted file mode 100644 index 59d4e6e..0000000 --- a/Mod Sources/RandomMod/BaseMod/ReadMe.txt +++ /dev/null @@ -1,40 +0,0 @@ -======================================================================== - DYNAMIC LINK LIBRARY : BaseMod Project Overview -======================================================================== - -AppWizard has created this BaseMod DLL for you. - -This file contains a summary of what you will find in each of the files that -make up your BaseMod application. - - -BaseMod.vcxproj - This is the main project file for VC++ projects generated using an Application Wizard. - It contains information about the version of Visual C++ that generated the file, and - information about the platforms, configurations, and project features selected with the - Application Wizard. - -BaseMod.vcxproj.filters - This is the filters file for VC++ projects generated using an Application Wizard. - It contains information about the association between the files in your project - and the filters. This association is used in the IDE to show grouping of files with - similar extensions under a specific node (for e.g. ".cpp" files are associated with the - "Source Files" filter). - -BaseMod.cpp - This is the main DLL source file. - -///////////////////////////////////////////////////////////////////////////// -Other standard files: - -StdAfx.h, StdAfx.cpp - These files are used to build a precompiled header (PCH) file - named BaseMod.pch and a precompiled types file named StdAfx.obj. - -///////////////////////////////////////////////////////////////////////////// -Other notes: - -AppWizard uses "TODO:" comments to indicate parts of the source code you -should add to or customize. - -///////////////////////////////////////////////////////////////////////////// diff --git a/Mod Sources/RandomMod/BaseMod/stdafx.cpp b/Mod Sources/RandomMod/BaseMod/stdafx.cpp deleted file mode 100644 index 866f2bd..0000000 --- a/Mod Sources/RandomMod/BaseMod/stdafx.cpp +++ /dev/null @@ -1,8 +0,0 @@ -// stdafx.cpp : source file that includes just the standard includes -// BaseMod.pch will be the pre-compiled header -// stdafx.obj will contain the pre-compiled type information - -#include "stdafx.h" - -// TODO: reference any additional headers you need in STDAFX.H -// and not in this file diff --git a/Mod Sources/RandomMod/BaseMod/stdafx.h b/Mod Sources/RandomMod/BaseMod/stdafx.h deleted file mode 100644 index 7b67610..0000000 --- a/Mod Sources/RandomMod/BaseMod/stdafx.h +++ /dev/null @@ -1,17 +0,0 @@ -// stdafx.h : include file for standard system include files, -// or project specific include files that are used frequently, but -// are changed infrequently -// - -#pragma once - -#include "targetver.h" - -#define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers -// Windows Header Files: -#include -#include - - - -// TODO: reference additional headers your program requires here diff --git a/Mod Sources/RandomMod/BaseMod/targetver.h b/Mod Sources/RandomMod/BaseMod/targetver.h deleted file mode 100644 index 90e767b..0000000 --- a/Mod Sources/RandomMod/BaseMod/targetver.h +++ /dev/null @@ -1,8 +0,0 @@ -#pragma once - -// Including SDKDDKVer.h defines the highest available Windows platform. - -// If you wish to build your application for a previous Windows platform, include WinSDKVer.h and -// set the _WIN32_WINNT macro to the platform you wish to support before including SDKDDKVer.h. - -#include diff --git a/Mod Sources/RandomMod/RandomMod.sln b/Mod Sources/RandomMod/RandomMod.sln index 156a4b0..79a5b6d 100644 --- a/Mod Sources/RandomMod/RandomMod.sln +++ b/Mod Sources/RandomMod/RandomMod.sln @@ -1,7 +1,7 @@  Microsoft Visual Studio Solution File, Format Version 11.00 # Visual C++ Express 2010 -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "BaseMod", "BaseMod\BaseMod.vcxproj", "{2A498B2D-84B2-4BBF-9532-EA17E5BA51BB}" +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "RandomMod", "RandomMod\RandomMod.vcxproj", "{2A498B2D-84B2-4BBF-9532-EA17E5BA51BB}" EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution diff --git a/Mod Sources/RandomMod/RandomMod.suo b/Mod Sources/RandomMod/RandomMod.suo index 50eb8be..97f1af0 100644 Binary files a/Mod Sources/RandomMod/RandomMod.suo and b/Mod Sources/RandomMod/RandomMod.suo differ diff --git a/Mod Sources/TSExtension/BaseMod/BaseMod.vcxproj b/Mod Sources/RandomMod/RandomMod/RandomMod.vcxproj similarity index 73% rename from Mod Sources/TSExtension/BaseMod/BaseMod.vcxproj rename to Mod Sources/RandomMod/RandomMod/RandomMod.vcxproj index e05beeb..d2a5ba6 100644 --- a/Mod Sources/TSExtension/BaseMod/BaseMod.vcxproj +++ b/Mod Sources/RandomMod/RandomMod/RandomMod.vcxproj @@ -1,106 +1,93 @@ - - - - - Debug - Win32 - - - Release - Win32 - - - - {2A498B2D-84B2-4BBF-9532-EA17E5BA51BB} - Win32Proj - BaseMod - - - - DynamicLibrary - true - Unicode - - - DynamicLibrary - false - true - Unicode - - - - - - - - - - - - - true - - - false - - - - NotUsing - Level3 - Disabled - WIN32;_DEBUG;_WINDOWS;_USRDLL;BASEMOD_EXPORTS;%(PreprocessorDefinitions) - - - Windows - true - - - - - Level3 - NotUsing - MaxSpeed - true - true - WIN32;NDEBUG;_WINDOWS;_USRDLL;BASEMOD_EXPORTS;%(PreprocessorDefinitions) - - - Windows - true - true - true - - - - - - - - - - - - - - - - - false - - - false - - - - - - - - Create - Create - - - - - + + + + + Debug + Win32 + + + Release + Win32 + + + + + + + + + + + + + + + + + {2A498B2D-84B2-4BBF-9532-EA17E5BA51BB} + Win32Proj + BaseMod + RandomMod + + + + DynamicLibrary + true + Unicode + + + DynamicLibrary + false + true + Unicode + + + + + + + + + + + + + false + include;$(IncludePath) + + + false + include;$(IncludePath) + + + + NotUsing + Level3 + Disabled + WIN32;_DEBUG;_WINDOWS;_USRDLL;BASEMOD_EXPORTS;%(PreprocessorDefinitions) + + + Windows + true + + + + + Level3 + NotUsing + MaxSpeed + true + true + WIN32;NDEBUG;_WINDOWS;_USRDLL;BASEMOD_EXPORTS;%(PreprocessorDefinitions) + + + Windows + true + true + true + + + + + \ No newline at end of file diff --git a/Mod Sources/RandomMod/BaseMod/BaseMod.vcxproj.filters b/Mod Sources/RandomMod/RandomMod/RandomMod.vcxproj.filters similarity index 65% rename from Mod Sources/RandomMod/BaseMod/BaseMod.vcxproj.filters rename to Mod Sources/RandomMod/RandomMod/RandomMod.vcxproj.filters index 3db6a2c..1dee843 100644 --- a/Mod Sources/RandomMod/BaseMod/BaseMod.vcxproj.filters +++ b/Mod Sources/RandomMod/RandomMod/RandomMod.vcxproj.filters @@ -1,60 +1,48 @@ - - - - - {4FC737F1-C7A5-4376-A066-2A32D752A2FF} - cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx - - - {93995380-89BD-4b04-88EB-625FBE52EBFB} - h;hpp;hxx;hm;inl;inc;xsd - - - {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} - rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms - - - - - - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - + + + + + {4FC737F1-C7A5-4376-A066-2A32D752A2FF} + cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx + + + {93995380-89BD-4b04-88EB-625FBE52EBFB} + h;hpp;hxx;hm;inl;inc;xsd + + + {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} + rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms + + + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + \ No newline at end of file diff --git a/Mod Sources/RandomMod/BaseMod/BaseMod.vcxproj.user b/Mod Sources/RandomMod/RandomMod/RandomMod.vcxproj.user similarity index 98% rename from Mod Sources/RandomMod/BaseMod/BaseMod.vcxproj.user rename to Mod Sources/RandomMod/RandomMod/RandomMod.vcxproj.user index 695b5c7..ace9a86 100644 --- a/Mod Sources/RandomMod/BaseMod/BaseMod.vcxproj.user +++ b/Mod Sources/RandomMod/RandomMod/RandomMod.vcxproj.user @@ -1,3 +1,3 @@ - - + + \ No newline at end of file diff --git a/Mod Sources/RandomMod/BaseMod/BaseMod.h b/Mod Sources/RandomMod/RandomMod/include/BaseMod.h similarity index 98% rename from Mod Sources/RandomMod/BaseMod/BaseMod.h rename to Mod Sources/RandomMod/RandomMod/include/BaseMod.h index 98515c8..fee4c75 100644 --- a/Mod Sources/RandomMod/BaseMod/BaseMod.h +++ b/Mod Sources/RandomMod/RandomMod/include/BaseMod.h @@ -1,8 +1,8 @@ -// The following ifdef block is the standard way of creating macros which make exporting -// from a DLL simpler. All files within this DLL are compiled with the BASEMOD_EXPORTS -// symbol defined on the command line. This symbol should not be defined on any project -// that uses this DLL. This way any other project whose source files include this file see -// BASEMOD_API functions as being imported from a DLL, whereas this DLL sees symbols -// defined with this macro as being exported. - -#define BASEMOD_API __declspec( dllexport ) +// The following ifdef block is the standard way of creating macros which make exporting +// from a DLL simpler. All files within this DLL are compiled with the BASEMOD_EXPORTS +// symbol defined on the command line. This symbol should not be defined on any project +// that uses this DLL. This way any other project whose source files include this file see +// BASEMOD_API functions as being imported from a DLL, whereas this DLL sees symbols +// defined with this macro as being exported. + +#define BASEMOD_API __declspec( dllexport ) diff --git a/Mod Sources/RandomMod/BaseMod/mt.h b/Mod Sources/RandomMod/RandomMod/include/mt.h similarity index 100% rename from Mod Sources/RandomMod/BaseMod/mt.h rename to Mod Sources/RandomMod/RandomMod/include/mt.h diff --git a/Mod Sources/RandomMod/BaseMod/randomCmds.h b/Mod Sources/RandomMod/RandomMod/include/randomCmds.h similarity index 94% rename from Mod Sources/RandomMod/BaseMod/randomCmds.h rename to Mod Sources/RandomMod/RandomMod/include/randomCmds.h index a44e08a..c4f0d95 100644 --- a/Mod Sources/RandomMod/BaseMod/randomCmds.h +++ b/Mod Sources/RandomMod/RandomMod/include/randomCmds.h @@ -1,14 +1,14 @@ -#include "stdafx.h" - -const char* conGuiTsCtrlProject(SimObject *obj,S32 argc, const char* argv[]); -bool conNetObjectSetGhostable(SimObject *obj,S32 argc, const char* argv[]); -const char* conGetVariable(SimObject *obj,S32 argc, const char* argv[]); - -// Merscenne Random -const char *conMRandom(SimObject *obj, S32 argc, const char *argv[]); -const char *conMSeed(SimObject *obj, S32 argc, const char *argv[]); -const char *conMRandomFloat(SimObject *obj, S32 argc, const char *argv[]); - -// Clock -const char*conQPCBegin(SimObject *obj, S32 argc, const char *argv[]); +#include + +const char* conGuiTsCtrlProject(SimObject *obj,S32 argc, const char* argv[]); +bool conNetObjectSetGhostable(SimObject *obj,S32 argc, const char* argv[]); +const char* conGetVariable(SimObject *obj,S32 argc, const char* argv[]); + +// Merscenne Random +const char *conMRandom(SimObject *obj, S32 argc, const char *argv[]); +const char *conMSeed(SimObject *obj, S32 argc, const char *argv[]); +const char *conMRandomFloat(SimObject *obj, S32 argc, const char *argv[]); + +// Clock +const char*conQPCBegin(SimObject *obj, S32 argc, const char *argv[]); const char*conQPCEnd(SimObject *obj, S32 argc, const char *argv[]); \ No newline at end of file diff --git a/Mod Sources/RandomMod/BaseMod/t2api.h b/Mod Sources/RandomMod/RandomMod/include/t2api.h similarity index 96% rename from Mod Sources/RandomMod/BaseMod/t2api.h rename to Mod Sources/RandomMod/RandomMod/include/t2api.h index f18faec..930dd4e 100644 --- a/Mod Sources/RandomMod/BaseMod/t2api.h +++ b/Mod Sources/RandomMod/RandomMod/include/t2api.h @@ -1,109 +1,111 @@ -#pragma once - -void initT2Api(); - - -//api stuff - -typedef unsigned int U32; -typedef int S32; -typedef float F32; - -typedef unsigned int dsize_t; - -//for addvariable -#define TypeS32 1 -#define TypeBool 3 -#define TypeF32 5 - - -//dshit -inline dsize_t dStrlen(const char *str) -{ - return (dsize_t)strlen(str); -} - -class Namespace { - const char* mName; -}; - - - -class SimObject{ - SimObject* group; - const char* objectName; //04h: objectName - SimObject* nextNameObject; //8 - SimObject* nextManagerNameObject; //c - SimObject* nextIdObject; //10h: nextIdObject - U32 stuff; //14 - U32 mFlags; //18h - U32 mNotifyList; //actually a pointer - U32 mId; //20h: mId - //more stuff -}; - -class SimIdDictionary -{ - enum - { - DefaultTableSize = 4096, - TableBitMask = 4095 - }; - SimObject *table[DefaultTableSize]; -}; -extern SimIdDictionary* gIdDictionary; - -class Point3F -{ - public: - F32 x; - F32 y; - F32 z; -}; - - -//GuiTSCtrl -class GuiTSCtrl {}; -class HoverVehicle {}; -void GuiTSCtrl_project(GuiTSCtrl *obj, const Point3F &pt, Point3F *dest); //fake - - -namespace Sim { - extern SimObject* (*findObject)(U32 id); -} - - -//console - -typedef const char * (*StringCallback)(SimObject *obj, S32 argc, const char *argv[]); -typedef S32 (*IntCallback)(SimObject *obj, S32 argc, const char *argv[]); -typedef F32 (*FloatCallback)(SimObject *obj, S32 argc, const char *argv[]); -typedef void (*VoidCallback)(SimObject *obj, S32 argc, const char *argv[]); -typedef bool (*BoolCallback)(SimObject *obj, S32 argc, const char *argv[]); - - -extern void (*someTest)(void); -//functions -namespace Con{ - -extern char * (*getReturnBuffer)(U32 bufferSize); - -extern void (*addMethodB)(const char *nsName, const char *name, BoolCallback cb, const char *usage, S32 minArgs, S32 maxArgs); -extern void (*addMethodS)(const char *nsName, const char *name, StringCallback cb, const char *usage, S32 minArgs, S32 maxArgs); - -extern bool (*addVariable)(const char *name, S32 t, void *dp); - -extern void (*printf)(const char* fmt,...); -extern void (*errorf)(U32 type, const char* fmt,...); - -extern const char * (*getVariable)(const char *name); -extern const char * (*execute)(S32 argc, const char *argv[]); -extern const char * (*executef)(S32 argc, ...); -extern const char * (*executem)(SimObject *object, S32 argc, const char *argv[]); -extern const char * (*evaluate)(const char* string, bool echo, const char *fileName, bool cf); -} - -//d-util -extern int (*dSscanf)(const char *buffer, const char *format, ...); -extern int (*dSprintf)(char *buffer, dsize_t bufferSize, const char *format, ...); +#pragma once + +#include + +void initT2Api(); + + +//api stuff + +typedef unsigned int U32; +typedef int S32; +typedef float F32; + +typedef unsigned int dsize_t; + +//for addvariable +#define TypeS32 1 +#define TypeBool 3 +#define TypeF32 5 + + +//dshit +inline dsize_t dStrlen(const char *str) +{ + return (dsize_t)strlen(str); +} + +class Namespace { + const char* mName; +}; + + + +class SimObject{ + SimObject* group; + const char* objectName; //04h: objectName + SimObject* nextNameObject; //8 + SimObject* nextManagerNameObject; //c + SimObject* nextIdObject; //10h: nextIdObject + U32 stuff; //14 + U32 mFlags; //18h + U32 mNotifyList; //actually a pointer + U32 mId; //20h: mId + //more stuff +}; + +class SimIdDictionary +{ + enum + { + DefaultTableSize = 4096, + TableBitMask = 4095 + }; + SimObject *table[DefaultTableSize]; +}; +extern SimIdDictionary* gIdDictionary; + +class Point3F +{ + public: + F32 x; + F32 y; + F32 z; +}; + + +//GuiTSCtrl +class GuiTSCtrl {}; +class HoverVehicle {}; +void GuiTSCtrl_project(GuiTSCtrl *obj, const Point3F &pt, Point3F *dest); //fake + + +namespace Sim { + extern SimObject* (*findObject)(U32 id); +} + + +//console + +typedef const char * (*StringCallback)(SimObject *obj, S32 argc, const char *argv[]); +typedef S32 (*IntCallback)(SimObject *obj, S32 argc, const char *argv[]); +typedef F32 (*FloatCallback)(SimObject *obj, S32 argc, const char *argv[]); +typedef void (*VoidCallback)(SimObject *obj, S32 argc, const char *argv[]); +typedef bool (*BoolCallback)(SimObject *obj, S32 argc, const char *argv[]); + + +extern void (*someTest)(void); +//functions +namespace Con{ + +extern char * (*getReturnBuffer)(U32 bufferSize); + +extern void (*addMethodB)(const char *nsName, const char *name, BoolCallback cb, const char *usage, S32 minArgs, S32 maxArgs); +extern void (*addMethodS)(const char *nsName, const char *name, StringCallback cb, const char *usage, S32 minArgs, S32 maxArgs); + +extern bool (*addVariable)(const char *name, S32 t, void *dp); + +extern void (*printf)(const char* fmt,...); +extern void (*errorf)(U32 type, const char* fmt,...); + +extern const char * (*getVariable)(const char *name); +extern const char * (*execute)(S32 argc, const char *argv[]); +extern const char * (*executef)(S32 argc, ...); +extern const char * (*executem)(SimObject *object, S32 argc, const char *argv[]); +extern const char * (*evaluate)(const char* string, bool echo, const char *fileName, bool cf); +} + +//d-util +extern int (*dSscanf)(const char *buffer, const char *format, ...); +extern int (*dSprintf)(char *buffer, dsize_t bufferSize, const char *format, ...); extern bool (*dAtob)(const char *str); \ No newline at end of file diff --git a/Mod Sources/RandomMod/BaseMod/BaseMod.cpp b/Mod Sources/RandomMod/RandomMod/source/BaseMod.cpp similarity index 94% rename from Mod Sources/RandomMod/BaseMod/BaseMod.cpp rename to Mod Sources/RandomMod/RandomMod/source/BaseMod.cpp index 5089dc9..9eb1904 100644 --- a/Mod Sources/RandomMod/BaseMod/BaseMod.cpp +++ b/Mod Sources/RandomMod/RandomMod/source/BaseMod.cpp @@ -1,22 +1,21 @@ -// BaseMod.cpp : Defines the exported functions for the DLL application. -// - -#include "stdafx.h" -#include "BaseMod.h" - -#include "t2api.h" -#include "randomCmds.h" - -extern "C" -{ - BASEMOD_API void ModInitialize(void) - { - Con::addMethodS(NULL,"getRandom",&conMRandom,"Random number generation based upon the Mersenne Twister algorithm.",1,3); - Con::addMethodS(NULL,"seedRand",&conMSeed,"Reseeds the Mersenne Twister random number generator.",2,2); - Con::addMethodS(NULL,"getRandomFloat",&conMRandomFloat,"Random number generation based upon the Mersenne Twister algorithm.",1,3); - Con::addMethodS(NULL,"QPCBegin",&conQPCBegin,"Begins the performance counter.",1,1); - Con::addMethodS(NULL,"QPCEnd",&conQPCEnd,"Ends the performance counter and returns the time in seconds.",2,2); - - return; - } +// BaseMod.cpp : Defines the exported functions for the DLL application. +// + +#include "BaseMod.h" + +#include "t2api.h" +#include "randomCmds.h" + +extern "C" +{ + BASEMOD_API void ModInitialize(void) + { + Con::addMethodS(NULL,"getRandom",&conMRandom,"Random number generation based upon the Mersenne Twister algorithm.",1,3); + Con::addMethodS(NULL,"seedRand",&conMSeed,"Reseeds the Mersenne Twister random number generator.",2,2); + Con::addMethodS(NULL,"getRandomFloat",&conMRandomFloat,"Random number generation based upon the Mersenne Twister algorithm.",1,3); + Con::addMethodS(NULL,"QPCBegin",&conQPCBegin,"Begins the performance counter.",1,1); + Con::addMethodS(NULL,"QPCEnd",&conQPCEnd,"Ends the performance counter and returns the time in seconds.",2,2); + + return; + } } \ No newline at end of file diff --git a/Mod Sources/TSExtension/BaseMod/dllmain.cpp b/Mod Sources/RandomMod/RandomMod/source/dllmain.cpp similarity index 89% rename from Mod Sources/TSExtension/BaseMod/dllmain.cpp rename to Mod Sources/RandomMod/RandomMod/source/dllmain.cpp index 8a4edd3..676221a 100644 --- a/Mod Sources/TSExtension/BaseMod/dllmain.cpp +++ b/Mod Sources/RandomMod/RandomMod/source/dllmain.cpp @@ -1,19 +1,20 @@ -// dllmain.cpp : Defines the entry point for the DLL application. -#include "stdafx.h" - -BOOL APIENTRY DllMain( HMODULE hModule, - DWORD ul_reason_for_call, - LPVOID lpReserved - ) -{ - switch (ul_reason_for_call) - { - case DLL_PROCESS_ATTACH: - case DLL_THREAD_ATTACH: - case DLL_THREAD_DETACH: - case DLL_PROCESS_DETACH: - break; - } - return TRUE; -} - +// dllmain.cpp : Defines the entry point for the DLL application. +#include +#include + +BOOL APIENTRY DllMain( HMODULE hModule, + DWORD ul_reason_for_call, + LPVOID lpReserved + ) +{ + switch (ul_reason_for_call) + { + case DLL_PROCESS_ATTACH: + case DLL_THREAD_ATTACH: + case DLL_THREAD_DETACH: + case DLL_PROCESS_DETACH: + break; + } + return TRUE; +} + diff --git a/Mod Sources/RandomMod/BaseMod/mt.cc b/Mod Sources/RandomMod/RandomMod/source/mt.cc similarity index 99% rename from Mod Sources/RandomMod/BaseMod/mt.cc rename to Mod Sources/RandomMod/RandomMod/source/mt.cc index c44808f..02c68f8 100644 --- a/Mod Sources/RandomMod/BaseMod/mt.cc +++ b/Mod Sources/RandomMod/RandomMod/source/mt.cc @@ -47,11 +47,10 @@ email: m-mat @ math.sci.hiroshima-u.ac.jp (remove space) */ -#include "stdafx.h" #include #include -#include "mt.h" +#include /** * Constructor diff --git a/Mod Sources/RandomMod/BaseMod/randomCmds.cpp b/Mod Sources/RandomMod/RandomMod/source/randomCmds.cpp similarity index 94% rename from Mod Sources/RandomMod/BaseMod/randomCmds.cpp rename to Mod Sources/RandomMod/RandomMod/source/randomCmds.cpp index 9e0fca2..b4eae65 100644 --- a/Mod Sources/RandomMod/BaseMod/randomCmds.cpp +++ b/Mod Sources/RandomMod/RandomMod/source/randomCmds.cpp @@ -1,169 +1,173 @@ -#include "stdafx.h" -#include -#include -#include -#include "mt.h" - -#include "t2api.h" - -// Merscenne Twister -MersenneTwister *mt = NULL; -const char *conMRandom(SimObject *obj, S32 argc, const char *argv[]) -{ - if (!mt) - { - mt = new MersenneTwister; - mt->init_genrand(time(NULL)); - } - - char mem[256]; - memset(mem, 0x00, 255); - if (argc == 1) - { - sprintf_s(mem, 256, "%f", mt->random()); - return mem; - } - - char *a_c = (char*)argv[1]; - char *b_c; - if (argc == 3) - b_c = (char*)argv[2]; - else if (argc == 2) - { - b_c = a_c; - a_c = "0"; - } - - int a = atoi(a_c); - int b = atoi(b_c); - - // Check to see if we have any negative arguments - if (a < 0) - { - int max = b + abs(a); - int rand = mt->genrand_int32() % (max); - if (rand > b) - rand = -(rand-b); - sprintf_s(mem, 256, "%d", rand); - return mem; - } - - sprintf_s(mem, 256, "%f", floor(mt->random() * b + a)); - return mem; -} - -const char *conMRandomFloat(SimObject *obj, S32 argc, const char *argv[]) -{ - if (!mt) - { - mt = new MersenneTwister; - mt->init_genrand(time(NULL)); - } - - char mem[256]; - memset(mem, 0x00, 255); - if (argc == 1) - { - sprintf_s(mem, 256, "%f", mt->random()); - return mem; - } - - char *a_c = (char*)argv[1]; - char *b_c; - if (argc == 3) - b_c = (char*)argv[2]; - else if (argc == 2) - { - b_c = a_c; - a_c = "0"; - } - - float a = atof(a_c); - float b = atof(b_c); - if (a > b) - { - int d = b; - b = a; - a = d; - } - - sprintf_s(mem, 256, "%f", mt->random() * b + a); - return mem; -} - -const char *conMSeed(SimObject *obj, S32 argc, const char *argv[]) -{ - if (!mt) - { - mt = new MersenneTwister; - mt->init_genrand(time(NULL)); - } - const char *a_c = argv[1]; - - unsigned long a = 0; - unsigned int len = strlen(a_c); - for (unsigned int i = 0; i < len; i++) - if ( a_c[i] > 57 || a_c[i] < 48) - { - mt->init_by_array((unsigned long*)a_c, len+1); - return "1"; - } - - a = atof(a_c); - mt->init_genrand(a); - return "1"; -} - - -#define QPC_MAX_STOPWATCHES 20 - -static unsigned int CURRENT_STOPWATCH_COUNT = 0; -static __int64 QPC_STOPWATCHES[QPC_MAX_STOPWATCHES]; - -__int64 STARTING_QPC_TIME; -const char*conQPCBegin(SimObject *obj, S32 argc, const char *argv[]) -{ - if (!QueryPerformanceCounter((LARGE_INTEGER*)&QPC_STOPWATCHES[CURRENT_STOPWATCH_COUNT])) - { - Con::errorf(0, "QPCBegin(): Failed to start timer! (%u)", GetLastError()); - return "-1"; - } - else if (CURRENT_STOPWATCH_COUNT >= QPC_MAX_STOPWATCHES) - { - Con::errorf(0, "QPCBegin(): Too many stopwatches active! (Maximum: %u)", QPC_MAX_STOPWATCHES); - return "-1"; - } - - unsigned int return_value = CURRENT_STOPWATCH_COUNT; - char result[256]; - sprintf_s<256>(result, "%u", return_value); - - CURRENT_STOPWATCH_COUNT++; - - return result; -} - -const char*conQPCEnd(SimObject *obj, S32 argc, const char *argv[]) -{ - __int64 ENDING_QPC_TIME; - if (!QueryPerformanceCounter((LARGE_INTEGER*)&ENDING_QPC_TIME)) - { - Con::errorf(0, "QPCEnd(): Failed to stop timer! (%u)", GetLastError()); - return "-1"; - } - else if (CURRENT_STOPWATCH_COUNT == 0) - { - Con::errorf(0, "QPCEnd(): No stopwatches to stop!"); - return "-1"; - } - - __int64 qpc_frequency; - QueryPerformanceFrequency((LARGE_INTEGER*)&qpc_frequency); - - char result[256]; - sprintf_s<256>(result, "%f", ((QPC_STOPWATCHES[CURRENT_STOPWATCH_COUNT - 1]) - ENDING_QPC_TIME) * 1.0 / qpc_frequency); - - CURRENT_STOPWATCH_COUNT--; - - return result; +#include +#include + +#include +#include +#include +#include + +#include "mt.h" + +#include "t2api.h" + +// Merscenne Twister +MersenneTwister *mt = NULL; +const char *conMRandom(SimObject *obj, S32 argc, const char *argv[]) +{ + if (!mt) + { + mt = new MersenneTwister; + mt->init_genrand(time(NULL)); + } + + char mem[256]; + memset(mem, 0x00, 255); + if (argc == 1) + { + sprintf_s(mem, 256, "%f", mt->random()); + return mem; + } + + char *a_c = (char*)argv[1]; + char *b_c; + if (argc == 3) + b_c = (char*)argv[2]; + else if (argc == 2) + { + b_c = a_c; + a_c = "0"; + } + + int a = atoi(a_c); + int b = atoi(b_c); + + // Check to see if we have any negative arguments + if (a < 0) + { + int max = b + abs(a); + int rand = mt->genrand_int32() % (max); + if (rand > b) + rand = -(rand-b); + sprintf_s(mem, 256, "%d", rand); + return mem; + } + + sprintf_s(mem, 256, "%f", floor(mt->random() * b + a)); + return mem; +} + +const char *conMRandomFloat(SimObject *obj, S32 argc, const char *argv[]) +{ + if (!mt) + { + mt = new MersenneTwister; + mt->init_genrand(time(NULL)); + } + + char mem[256]; + memset(mem, 0x00, 255); + if (argc == 1) + { + sprintf_s(mem, 256, "%f", mt->random()); + return mem; + } + + char *a_c = (char*)argv[1]; + char *b_c; + if (argc == 3) + b_c = (char*)argv[2]; + else if (argc == 2) + { + b_c = a_c; + a_c = "0"; + } + + float a = atof(a_c); + float b = atof(b_c); + if (a > b) + { + int d = b; + b = a; + a = d; + } + + sprintf_s(mem, 256, "%f", mt->random() * b + a); + return mem; +} + +const char *conMSeed(SimObject *obj, S32 argc, const char *argv[]) +{ + if (!mt) + { + mt = new MersenneTwister; + mt->init_genrand(time(NULL)); + } + const char *a_c = argv[1]; + + unsigned long a = 0; + unsigned int len = strlen(a_c); + for (unsigned int i = 0; i < len; i++) + if ( a_c[i] > 57 || a_c[i] < 48) + { + mt->init_by_array((unsigned long*)a_c, len+1); + return "1"; + } + + a = atof(a_c); + mt->init_genrand(a); + return "1"; +} + + +#define QPC_MAX_STOPWATCHES 20 + +static unsigned int CURRENT_STOPWATCH_COUNT = 0; +static __int64 QPC_STOPWATCHES[QPC_MAX_STOPWATCHES]; + +__int64 STARTING_QPC_TIME; +const char*conQPCBegin(SimObject *obj, S32 argc, const char *argv[]) +{ + if (!QueryPerformanceCounter((LARGE_INTEGER*)&QPC_STOPWATCHES[CURRENT_STOPWATCH_COUNT])) + { + Con::errorf(0, "QPCBegin(): Failed to start timer! (%u)", GetLastError()); + return "-1"; + } + else if (CURRENT_STOPWATCH_COUNT >= QPC_MAX_STOPWATCHES) + { + Con::errorf(0, "QPCBegin(): Too many stopwatches active! (Maximum: %u)", QPC_MAX_STOPWATCHES); + return "-1"; + } + + unsigned int return_value = CURRENT_STOPWATCH_COUNT; + char result[256]; + sprintf_s<256>(result, "%u", return_value); + + CURRENT_STOPWATCH_COUNT++; + + return result; +} + +const char*conQPCEnd(SimObject *obj, S32 argc, const char *argv[]) +{ + __int64 ENDING_QPC_TIME; + if (!QueryPerformanceCounter((LARGE_INTEGER*)&ENDING_QPC_TIME)) + { + Con::errorf(0, "QPCEnd(): Failed to stop timer! (%u)", GetLastError()); + return "-1"; + } + else if (CURRENT_STOPWATCH_COUNT == 0) + { + Con::errorf(0, "QPCEnd(): No stopwatches to stop!"); + return "-1"; + } + + __int64 qpc_frequency; + QueryPerformanceFrequency((LARGE_INTEGER*)&qpc_frequency); + + char result[256]; + sprintf_s<256>(result, "%f", ((QPC_STOPWATCHES[CURRENT_STOPWATCH_COUNT - 1]) - ENDING_QPC_TIME) * 1.0 / qpc_frequency); + + CURRENT_STOPWATCH_COUNT--; + + return result; } \ No newline at end of file diff --git a/Mod Sources/RandomMod/BaseMod/t2api.cpp b/Mod Sources/RandomMod/RandomMod/source/t2api.cpp similarity index 95% rename from Mod Sources/RandomMod/BaseMod/t2api.cpp rename to Mod Sources/RandomMod/RandomMod/source/t2api.cpp index 5efaa5d..e3688cc 100644 --- a/Mod Sources/RandomMod/BaseMod/t2api.cpp +++ b/Mod Sources/RandomMod/RandomMod/source/t2api.cpp @@ -1,86 +1,85 @@ -#include "stdafx.h" -#include "t2api.h" - -SimIdDictionary* gIdDictionary = reinterpret_cast(0x009E9194); - -//439550 -namespace Sim { - SimObject* (*findObject)(U32 id) = - (SimObject* (_cdecl *)(U32 id) ) - 0x439550; -} - -//hackey way to do member functions, .... -void GuiTSCtrl_project(GuiTSCtrl *obj, const Point3F &pt, Point3F *dest) { - typedef void (__cdecl *projFunc)(const Point3F &pt, Point3F *dest); - static projFunc p = (projFunc)0x4d0b40; - - __asm { - push dest; - push pt; - mov ecx,obj; - lea eax, p; - mov eax, [eax]; - call eax; - } -} - -namespace Con { - -char* (*getReturnBuffer)(U32 bufferSize) = - (char *(__cdecl *)(U32)) - 0x42caa0; - -void (*addMethodB)(const char *nsName, const char *name, BoolCallback cb, const char *usage, S32 minArgs, S32 maxArgs) = - (void (__cdecl *)(const char *, const char *,BoolCallback,const char *,S32,S32)) - 0x426510; - -void (*addMethodS)(const char *, const char *,StringCallback, const char *, S32, S32) = - (void (__cdecl *)(const char *,const char *,StringCallback,const char *,S32,S32)) - 0x426410; - -bool (*addVariable)(const char *name, S32 t, void *dp) = - (bool (__cdecl *)(const char *name, S32 t, void *dp)) - 0x4263B0; - -const char * (*execute)(S32 argc, const char *argv[]) = - (const char * (__cdecl *)(S32 argc, const char *argv[])) - 0x4267A0; - -const char * (*executef)(S32 argc, ...) = - (const char * (__cdecl *)(S32 argc, ...)) - 0x4269E0; - -const char * (*evaluate)(const char* string, bool echo, const char *fileName, bool cf) = - (const char * (__cdecl *)(const char* string, bool echo, const char *fileName, bool cf)) - 0x426690; - -const char * (*executem)(SimObject *object, S32 argc, const char *argv[]) = - (const char * (__cdecl *)(SimObject *object, S32 argc, const char *argv[])) - 0x426800; - -const char * (*getVariable)(const char *name) = - (const char * (__cdecl *)(const char *name)) - 0x4261F0; - -void (*printf)(const char* fmt,...) = - (void (__cdecl *)(const char* fmt,...)) - 0x425F30; - -void (*errorf)(U32 type, const char* fmt,...)= - (void (__cdecl *)(U32, const char*,...)) - 0x425FB0; - -} - -int (*dSscanf)(const char *buffer, const char *format, ...) = - (int (__cdecl *)(const char *,const char *,...)) - 0x55b640; - -int (*dSprintf)(char *buffer, dsize_t bufferSize, const char *format, ...) = - (int (__cdecl *)(char *,dsize_t,const char *,...)) - 0x55b5e0; - -bool (*dAtob)(const char *str) = - (bool (__cdecl *)(const char *str)) - 0x55B490; +#include "t2api.h" + +SimIdDictionary* gIdDictionary = reinterpret_cast(0x009E9194); + +//439550 +namespace Sim { + SimObject* (*findObject)(U32 id) = + (SimObject* (_cdecl *)(U32 id) ) + 0x439550; +} + +//hackey way to do member functions, .... +void GuiTSCtrl_project(GuiTSCtrl *obj, const Point3F &pt, Point3F *dest) { + typedef void (__cdecl *projFunc)(const Point3F &pt, Point3F *dest); + static projFunc p = (projFunc)0x4d0b40; + + __asm { + push dest; + push pt; + mov ecx,obj; + lea eax, p; + mov eax, [eax]; + call eax; + } +} + +namespace Con { + +char* (*getReturnBuffer)(U32 bufferSize) = + (char *(__cdecl *)(U32)) + 0x42caa0; + +void (*addMethodB)(const char *nsName, const char *name, BoolCallback cb, const char *usage, S32 minArgs, S32 maxArgs) = + (void (__cdecl *)(const char *, const char *,BoolCallback,const char *,S32,S32)) + 0x426510; + +void (*addMethodS)(const char *, const char *,StringCallback, const char *, S32, S32) = + (void (__cdecl *)(const char *,const char *,StringCallback,const char *,S32,S32)) + 0x426410; + +bool (*addVariable)(const char *name, S32 t, void *dp) = + (bool (__cdecl *)(const char *name, S32 t, void *dp)) + 0x4263B0; + +const char * (*execute)(S32 argc, const char *argv[]) = + (const char * (__cdecl *)(S32 argc, const char *argv[])) + 0x4267A0; + +const char * (*executef)(S32 argc, ...) = + (const char * (__cdecl *)(S32 argc, ...)) + 0x4269E0; + +const char * (*evaluate)(const char* string, bool echo, const char *fileName, bool cf) = + (const char * (__cdecl *)(const char* string, bool echo, const char *fileName, bool cf)) + 0x426690; + +const char * (*executem)(SimObject *object, S32 argc, const char *argv[]) = + (const char * (__cdecl *)(SimObject *object, S32 argc, const char *argv[])) + 0x426800; + +const char * (*getVariable)(const char *name) = + (const char * (__cdecl *)(const char *name)) + 0x4261F0; + +void (*printf)(const char* fmt,...) = + (void (__cdecl *)(const char* fmt,...)) + 0x425F30; + +void (*errorf)(U32 type, const char* fmt,...)= + (void (__cdecl *)(U32, const char*,...)) + 0x425FB0; + +} + +int (*dSscanf)(const char *buffer, const char *format, ...) = + (int (__cdecl *)(const char *,const char *,...)) + 0x55b640; + +int (*dSprintf)(char *buffer, dsize_t bufferSize, const char *format, ...) = + (int (__cdecl *)(char *,dsize_t,const char *,...)) + 0x55b5e0; + +bool (*dAtob)(const char *str) = + (bool (__cdecl *)(const char *str)) + 0x55B490; diff --git a/Mod Sources/TSExtension/BaseMod.suo b/Mod Sources/TSExtension/BaseMod.suo deleted file mode 100644 index 4a57b45..0000000 Binary files a/Mod Sources/TSExtension/BaseMod.suo and /dev/null differ diff --git a/Mod Sources/TSExtension/BaseMod/BaseMod.h b/Mod Sources/TSExtension/BaseMod/BaseMod.h deleted file mode 100644 index 98515c8..0000000 --- a/Mod Sources/TSExtension/BaseMod/BaseMod.h +++ /dev/null @@ -1,8 +0,0 @@ -// The following ifdef block is the standard way of creating macros which make exporting -// from a DLL simpler. All files within this DLL are compiled with the BASEMOD_EXPORTS -// symbol defined on the command line. This symbol should not be defined on any project -// that uses this DLL. This way any other project whose source files include this file see -// BASEMOD_API functions as being imported from a DLL, whereas this DLL sees symbols -// defined with this macro as being exported. - -#define BASEMOD_API __declspec( dllexport ) diff --git a/Mod Sources/TSExtension/BaseMod/ReadMe.txt b/Mod Sources/TSExtension/BaseMod/ReadMe.txt deleted file mode 100644 index 59d4e6e..0000000 --- a/Mod Sources/TSExtension/BaseMod/ReadMe.txt +++ /dev/null @@ -1,40 +0,0 @@ -======================================================================== - DYNAMIC LINK LIBRARY : BaseMod Project Overview -======================================================================== - -AppWizard has created this BaseMod DLL for you. - -This file contains a summary of what you will find in each of the files that -make up your BaseMod application. - - -BaseMod.vcxproj - This is the main project file for VC++ projects generated using an Application Wizard. - It contains information about the version of Visual C++ that generated the file, and - information about the platforms, configurations, and project features selected with the - Application Wizard. - -BaseMod.vcxproj.filters - This is the filters file for VC++ projects generated using an Application Wizard. - It contains information about the association between the files in your project - and the filters. This association is used in the IDE to show grouping of files with - similar extensions under a specific node (for e.g. ".cpp" files are associated with the - "Source Files" filter). - -BaseMod.cpp - This is the main DLL source file. - -///////////////////////////////////////////////////////////////////////////// -Other standard files: - -StdAfx.h, StdAfx.cpp - These files are used to build a precompiled header (PCH) file - named BaseMod.pch and a precompiled types file named StdAfx.obj. - -///////////////////////////////////////////////////////////////////////////// -Other notes: - -AppWizard uses "TODO:" comments to indicate parts of the source code you -should add to or customize. - -///////////////////////////////////////////////////////////////////////////// diff --git a/Mod Sources/TSExtension/BaseMod/stdafx.cpp b/Mod Sources/TSExtension/BaseMod/stdafx.cpp deleted file mode 100644 index 866f2bd..0000000 --- a/Mod Sources/TSExtension/BaseMod/stdafx.cpp +++ /dev/null @@ -1,8 +0,0 @@ -// stdafx.cpp : source file that includes just the standard includes -// BaseMod.pch will be the pre-compiled header -// stdafx.obj will contain the pre-compiled type information - -#include "stdafx.h" - -// TODO: reference any additional headers you need in STDAFX.H -// and not in this file diff --git a/Mod Sources/TSExtension/BaseMod/stdafx.h b/Mod Sources/TSExtension/BaseMod/stdafx.h deleted file mode 100644 index c02bb95..0000000 --- a/Mod Sources/TSExtension/BaseMod/stdafx.h +++ /dev/null @@ -1,12 +0,0 @@ -// stdafx.h : include file for standard system include files, -// or project specific include files that are used frequently, but -// are changed infrequently -// - -#pragma once - -#include "targetver.h" - -#define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers -// Windows Header Files: -#include \ No newline at end of file diff --git a/Mod Sources/TSExtension/BaseMod/targetver.h b/Mod Sources/TSExtension/BaseMod/targetver.h deleted file mode 100644 index 90e767b..0000000 --- a/Mod Sources/TSExtension/BaseMod/targetver.h +++ /dev/null @@ -1,8 +0,0 @@ -#pragma once - -// Including SDKDDKVer.h defines the highest available Windows platform. - -// If you wish to build your application for a previous Windows platform, include WinSDKVer.h and -// set the _WIN32_WINNT macro to the platform you wish to support before including SDKDDKVer.h. - -#include diff --git a/Mod Sources/TSExtension/Release/BaseMod.exp b/Mod Sources/TSExtension/Release/BaseMod.exp deleted file mode 100644 index 2b20dfb..0000000 Binary files a/Mod Sources/TSExtension/Release/BaseMod.exp and /dev/null differ diff --git a/Mod Sources/TSExtension/Release/BaseMod.pdb b/Mod Sources/TSExtension/Release/BaseMod.pdb deleted file mode 100644 index 9ae28a5..0000000 Binary files a/Mod Sources/TSExtension/Release/BaseMod.pdb and /dev/null differ diff --git a/Mod Sources/TSExtension/BaseMod.sln b/Mod Sources/TSExtension/TSExtension.sln similarity index 83% rename from Mod Sources/TSExtension/BaseMod.sln rename to Mod Sources/TSExtension/TSExtension.sln index 156a4b0..a04ee26 100644 --- a/Mod Sources/TSExtension/BaseMod.sln +++ b/Mod Sources/TSExtension/TSExtension.sln @@ -1,20 +1,20 @@ - -Microsoft Visual Studio Solution File, Format Version 11.00 -# Visual C++ Express 2010 -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "BaseMod", "BaseMod\BaseMod.vcxproj", "{2A498B2D-84B2-4BBF-9532-EA17E5BA51BB}" -EndProject -Global - GlobalSection(SolutionConfigurationPlatforms) = preSolution - Debug|Win32 = Debug|Win32 - Release|Win32 = Release|Win32 - EndGlobalSection - GlobalSection(ProjectConfigurationPlatforms) = postSolution - {2A498B2D-84B2-4BBF-9532-EA17E5BA51BB}.Debug|Win32.ActiveCfg = Debug|Win32 - {2A498B2D-84B2-4BBF-9532-EA17E5BA51BB}.Debug|Win32.Build.0 = Debug|Win32 - {2A498B2D-84B2-4BBF-9532-EA17E5BA51BB}.Release|Win32.ActiveCfg = Release|Win32 - {2A498B2D-84B2-4BBF-9532-EA17E5BA51BB}.Release|Win32.Build.0 = Release|Win32 - EndGlobalSection - GlobalSection(SolutionProperties) = preSolution - HideSolutionNode = FALSE - EndGlobalSection -EndGlobal + +Microsoft Visual Studio Solution File, Format Version 11.00 +# Visual C++ Express 2010 +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "TSExtension", "TSExtension\TSExtension.vcxproj", "{2A498B2D-84B2-4BBF-9532-EA17E5BA51BB}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Win32 = Debug|Win32 + Release|Win32 = Release|Win32 + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {2A498B2D-84B2-4BBF-9532-EA17E5BA51BB}.Debug|Win32.ActiveCfg = Debug|Win32 + {2A498B2D-84B2-4BBF-9532-EA17E5BA51BB}.Debug|Win32.Build.0 = Debug|Win32 + {2A498B2D-84B2-4BBF-9532-EA17E5BA51BB}.Release|Win32.ActiveCfg = Release|Win32 + {2A498B2D-84B2-4BBF-9532-EA17E5BA51BB}.Release|Win32.Build.0 = Release|Win32 + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection +EndGlobal diff --git a/Mod Sources/TSExtension/TSExtension.suo b/Mod Sources/TSExtension/TSExtension.suo new file mode 100644 index 0000000..2722de9 Binary files /dev/null and b/Mod Sources/TSExtension/TSExtension.suo differ diff --git a/Mod Sources/RandomMod/BaseMod/BaseMod.vcxproj b/Mod Sources/TSExtension/TSExtension/TSExtension.vcxproj similarity index 71% rename from Mod Sources/RandomMod/BaseMod/BaseMod.vcxproj rename to Mod Sources/TSExtension/TSExtension/TSExtension.vcxproj index ce2e819..7170c49 100644 --- a/Mod Sources/RandomMod/BaseMod/BaseMod.vcxproj +++ b/Mod Sources/TSExtension/TSExtension/TSExtension.vcxproj @@ -1,107 +1,92 @@ - - - - - Debug - Win32 - - - Release - Win32 - - - - {2A498B2D-84B2-4BBF-9532-EA17E5BA51BB} - Win32Proj - BaseMod - RandomMod - - - - DynamicLibrary - true - Unicode - - - DynamicLibrary - false - true - Unicode - - - - - - - - - - - - - true - - - false - - - - Use - Level3 - Disabled - WIN32;_DEBUG;_WINDOWS;_USRDLL;BASEMOD_EXPORTS;%(PreprocessorDefinitions) - - - Windows - true - - - - - Level3 - Use - MaxSpeed - true - true - WIN32;NDEBUG;_WINDOWS;_USRDLL;BASEMOD_EXPORTS;%(PreprocessorDefinitions) - - - Windows - true - true - true - - - - - - - - - - - - - - - - - false - - - false - - - - - - - Create - Create - - - - - - + + + + + Debug + Win32 + + + Release + Win32 + + + + + + + + + + + + + + + + {2A498B2D-84B2-4BBF-9532-EA17E5BA51BB} + Win32Proj + BaseMod + TSExtension + + + + DynamicLibrary + true + Unicode + + + DynamicLibrary + false + true + Unicode + + + + + + + + + + + + + false + include;$(IncludePath) + + + false + include;$(IncludePath) + + + + NotUsing + Level3 + Disabled + WIN32;_DEBUG;_WINDOWS;_USRDLL;BASEMOD_EXPORTS;%(PreprocessorDefinitions) + + + Windows + true + + + + + Level3 + NotUsing + MaxSpeed + true + true + WIN32;NDEBUG;_WINDOWS;_USRDLL;BASEMOD_EXPORTS;%(PreprocessorDefinitions) + + + Windows + true + true + true + + + + + \ No newline at end of file diff --git a/Mod Sources/TSExtension/BaseMod/BaseMod.vcxproj.filters b/Mod Sources/TSExtension/TSExtension/TSExtension.vcxproj.filters similarity index 62% rename from Mod Sources/TSExtension/BaseMod/BaseMod.vcxproj.filters rename to Mod Sources/TSExtension/TSExtension/TSExtension.vcxproj.filters index e6bdb2a..36cee7b 100644 --- a/Mod Sources/TSExtension/BaseMod/BaseMod.vcxproj.filters +++ b/Mod Sources/TSExtension/TSExtension/TSExtension.vcxproj.filters @@ -1,60 +1,45 @@ - - - - - {4FC737F1-C7A5-4376-A066-2A32D752A2FF} - cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx - - - {93995380-89BD-4b04-88EB-625FBE52EBFB} - h;hpp;hxx;hm;inl;inc;xsd - - - {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} - rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms - - - - - - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - + + + + + {4FC737F1-C7A5-4376-A066-2A32D752A2FF} + cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx + + + {93995380-89BD-4b04-88EB-625FBE52EBFB} + h;hpp;hxx;hm;inl;inc;xsd + + + {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} + rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms + + + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + + + Header Files + + + Header Files + + + Header Files + + \ No newline at end of file diff --git a/Mod Sources/TSExtension/BaseMod/BaseMod.vcxproj.user b/Mod Sources/TSExtension/TSExtension/TSExtension.vcxproj.user similarity index 98% rename from Mod Sources/TSExtension/BaseMod/BaseMod.vcxproj.user rename to Mod Sources/TSExtension/TSExtension/TSExtension.vcxproj.user index 695b5c7..ace9a86 100644 --- a/Mod Sources/TSExtension/BaseMod/BaseMod.vcxproj.user +++ b/Mod Sources/TSExtension/TSExtension/TSExtension.vcxproj.user @@ -1,3 +1,3 @@ - - + + \ No newline at end of file diff --git a/Mod Sources/TSExtension/BaseMod/DXAPI.h b/Mod Sources/TSExtension/TSExtension/include/DXAPI.h similarity index 96% rename from Mod Sources/TSExtension/BaseMod/DXAPI.h rename to Mod Sources/TSExtension/TSExtension/include/DXAPI.h index 6be0b17..a2f1d8a 100644 --- a/Mod Sources/TSExtension/BaseMod/DXAPI.h +++ b/Mod Sources/TSExtension/TSExtension/include/DXAPI.h @@ -1,107 +1,107 @@ -/** - * @file DXAPI.h - * @brief The DXAPI is an API that allows you to manipulate various game objects - * in Tribes 2 from raw C++ code. It dynamically resolves the addresses of member - * variables as you can't really trust the compiler to produce binary compatible classes, - * especially with all the inheritance involved in the original Tribes 2 codebase. - * - * This code wouldn't be possible without Linker's original gift on the-construct.net forums, - * whose files are appropriately labelled in this codebase. These files have been edited where - * appropriate in order to make that code play better with the DXAPI. - * - * @copyright (c) 2014 Robert MacGregor - */ - -#pragma once - -#include "LinkerAPI.h" - -namespace DX -{ - //! A typedef referring to some type of unresolved object in the game. - typedef void* UnresolvedObject; - - class Projectile {}; - - //! Structure representing a player object in the game. - typedef struct - { - //! Object Name - const char *name; - //! Object ID - const unsigned int &id; - - //! X Coordinate of the position. - float &position_x; - //! Y Coordinate of the position. - float &position_y; - //! Z Coordinate of the position. - float &position_z; - - //! Player Object Jetting State (readonly, writing it doesn't do anything) - const bool &is_jetting; - //! Player Object Jumping State (readonly, writing it doesn't do anything) - const bool &is_jumping; - } Player; - - /** - * @brief Returns a usable Player structure from a void - * pointer. - * @param obj A void pointer to attempt to resolve from. - * @return A usable Player structure to manipulate. - */ - Player GetPlayerPointer(UnresolvedObject obj); - - //! Structure representing a static shape in the game. - typedef struct - { - //! Object Name - const char *name; - //! X Coordinate of the position. - float &position_x; - //! Y Coordinate of the position. - float &position_y; - //! Z Coordinate of the position. - float &position_z; - } StaticShape; - - /** - * @brief Returns a usable StaticShape structure from a void - * pointer. - * @param obj A void pointer to attempt to resolve from. - * @return A usable StaticShape structure to manipulate. - */ - StaticShape GetStaticShapePointer(UnresolvedObject obj); - - //! Structure representing a SimGroup in the game. - typedef struct - { - - } SimGroup; - - /** - * @brief Returns a usable SimGroup structure from a void - * pointer. - * @param obj A void pointer to attempt to resolve from. - * @return A usable SimGroup structure to manipulate. - */ - SimGroup GetSimGroupPointer(UnresolvedObject obj); - - - //! Structure representing a FlyingVehicle in the game. - typedef struct - { - //! Strafing State. 0=Not Strafing. -1=Strafing Left. 1=Strafing Right (readonly, writing it doesn't do anything) - const float &strafing_state; - } FlyingVehicle; - - /** - * @brief Returns a usable FlyingVehicle structure from a void - * pointer. - * @param obj A void pointer to attempt to resolve from. - * @return A usable FlyingVehicle structure to manipulate. - */ - FlyingVehicle GetFlyingVehiclePointer(UnresolvedObject obj); - - void Projectile_explode(Projectile *obj, const Point3F &position, const Point3F &normal, const unsigned int collideType); +/** + * @file DXAPI.h + * @brief The DXAPI is an API that allows you to manipulate various game objects + * in Tribes 2 from raw C++ code. It dynamically resolves the addresses of member + * variables as you can't really trust the compiler to produce binary compatible classes, + * especially with all the inheritance involved in the original Tribes 2 codebase. + * + * This code wouldn't be possible without Linker's original gift on the-construct.net forums, + * whose files are appropriately labelled in this codebase. These files have been edited where + * appropriate in order to make that code play better with the DXAPI. + * + * @copyright (c) 2014 Robert MacGregor + */ + +#pragma once + +#include "LinkerAPI.h" + +namespace DX +{ + //! A typedef referring to some type of unresolved object in the game. + typedef void* UnresolvedObject; + + class Projectile {}; + + //! Structure representing a player object in the game. + typedef struct + { + //! Object Name + const char *name; + //! Object ID + const unsigned int &id; + + //! X Coordinate of the position. + float &position_x; + //! Y Coordinate of the position. + float &position_y; + //! Z Coordinate of the position. + float &position_z; + + //! Player Object Jetting State (readonly, writing it doesn't do anything) + const bool &is_jetting; + //! Player Object Jumping State (readonly, writing it doesn't do anything) + const bool &is_jumping; + } Player; + + /** + * @brief Returns a usable Player structure from a void + * pointer. + * @param obj A void pointer to attempt to resolve from. + * @return A usable Player structure to manipulate. + */ + Player GetPlayerPointer(UnresolvedObject obj); + + //! Structure representing a static shape in the game. + typedef struct + { + //! Object Name + const char *name; + //! X Coordinate of the position. + float &position_x; + //! Y Coordinate of the position. + float &position_y; + //! Z Coordinate of the position. + float &position_z; + } StaticShape; + + /** + * @brief Returns a usable StaticShape structure from a void + * pointer. + * @param obj A void pointer to attempt to resolve from. + * @return A usable StaticShape structure to manipulate. + */ + StaticShape GetStaticShapePointer(UnresolvedObject obj); + + //! Structure representing a SimGroup in the game. + typedef struct + { + + } SimGroup; + + /** + * @brief Returns a usable SimGroup structure from a void + * pointer. + * @param obj A void pointer to attempt to resolve from. + * @return A usable SimGroup structure to manipulate. + */ + SimGroup GetSimGroupPointer(UnresolvedObject obj); + + + //! Structure representing a FlyingVehicle in the game. + typedef struct + { + //! Strafing State. 0=Not Strafing. -1=Strafing Left. 1=Strafing Right (readonly, writing it doesn't do anything) + const float &strafing_state; + } FlyingVehicle; + + /** + * @brief Returns a usable FlyingVehicle structure from a void + * pointer. + * @param obj A void pointer to attempt to resolve from. + * @return A usable FlyingVehicle structure to manipulate. + */ + FlyingVehicle GetFlyingVehiclePointer(UnresolvedObject obj); + + void Projectile_explode(Projectile *obj, const Point3F &position, const Point3F &normal, const unsigned int collideType); } \ No newline at end of file diff --git a/Mod Sources/TSExtension/BaseMod/DXConCmds.h b/Mod Sources/TSExtension/TSExtension/include/DXConCmds.h similarity index 93% rename from Mod Sources/TSExtension/BaseMod/DXConCmds.h rename to Mod Sources/TSExtension/TSExtension/include/DXConCmds.h index ea7b392..ebe53c7 100644 --- a/Mod Sources/TSExtension/BaseMod/DXConCmds.h +++ b/Mod Sources/TSExtension/TSExtension/include/DXConCmds.h @@ -1,29 +1,28 @@ -/** - * @brief The DXAPI is an API that allows you to manipulate various game objects - * in Tribes 2 from raw C++ code. It dynamically resolves the addresses of member - * variables as you can't really trust the compiler to produce binary compatible classes, - * especially with all the inheritance involved in the original Tribes 2 codebase. - * - * This code wouldn't be possible without Linker's original gift on the-construct.net forums, - * whose files are appropriately labeled in this codebase. - * - * @copyright (c) 2014 Robert MacGregor - */ - -#pragma once - -#include "stdafx.h" -#include "LinkerAPI.h" - -// Returns the address of an object in memory -const char* conGetAddress(SimObject *obj, S32 argc, const char *argv[]); - -// Player Commands ----------------------------------- -bool conPlayerGetJumpingState(SimObject *obj, S32 argc, const char* argv[]); -bool conPlayerGetJettingState(SimObject *obj, S32 argc, const char* argv[]); - -// Projectile explode -bool conProjectileExplode(SimObject *obj, S32 argc, const char* argv[]); - -// Tests Position Z +/** + * @brief The DXAPI is an API that allows you to manipulate various game objects + * in Tribes 2 from raw C++ code. It dynamically resolves the addresses of member + * variables as you can't really trust the compiler to produce binary compatible classes, + * especially with all the inheritance involved in the original Tribes 2 codebase. + * + * This code wouldn't be possible without Linker's original gift on the-construct.net forums, + * whose files are appropriately labeled in this codebase. + * + * @copyright (c) 2014 Robert MacGregor + */ + +#pragma once + +#include + +// Returns the address of an object in memory +const char* conGetAddress(SimObject *obj, S32 argc, const char *argv[]); + +// Player Commands ----------------------------------- +bool conPlayerGetJumpingState(SimObject *obj, S32 argc, const char* argv[]); +bool conPlayerGetJettingState(SimObject *obj, S32 argc, const char* argv[]); + +// Projectile explode +bool conProjectileExplode(SimObject *obj, S32 argc, const char* argv[]); + +// Tests Position Z const char *conPlayerSetZ(SimObject *obj, S32 argc, const char *argv[]); \ No newline at end of file diff --git a/Mod Sources/TSExtension/BaseMod/LinkerAPI.h b/Mod Sources/TSExtension/TSExtension/include/LinkerAPI.h similarity index 95% rename from Mod Sources/TSExtension/BaseMod/LinkerAPI.h rename to Mod Sources/TSExtension/TSExtension/include/LinkerAPI.h index 9b0158a..aafe4f9 100644 --- a/Mod Sources/TSExtension/BaseMod/LinkerAPI.h +++ b/Mod Sources/TSExtension/TSExtension/include/LinkerAPI.h @@ -1,119 +1,119 @@ -// Linker's Tribes 2 API - -#pragma once - -//api stuff - -typedef unsigned int U32; -typedef int S32; -typedef float F32; - -typedef unsigned int dsize_t; -#include - -//for addvariable -#define TypeS32 1 -#define TypeBool 3 -#define TypeF32 5 - -//dshit -inline dsize_t dStrlen(const char *str) -{ - return (dsize_t)strlen(str); -} - -class Namespace -{ - const char* mName; -}; - -struct SimObject -{ - SimObject* group; - const char* objectName; //04h: objectName - SimObject* nextNameObject; //8 - SimObject* nextManagerNameObject; //c - SimObject* nextIdObject; //10h: nextIdObject - U32 stuff; //14 - U32 mFlags; //18h - U32 mNotifyList; //actually a pointer - U32 mId; //20h: mId - //more stuff -}; - -class SimIdDictionary -{ - enum - { - DefaultTableSize = 4096, - TableBitMask = 4095 - }; - SimObject *table[DefaultTableSize]; -}; -extern SimIdDictionary* gIdDictionary; - -class Point3F -{ - public: - Point3F(F32 *x, F32 *y, F32 *z) - { - this->x = x; - this->y = y; - this->z = z; - } - - Point3F(void) - { - this->x = 0; - this->y = 0; - this->z = 0; - } - - F32 *x; - F32 *y; - F32 *z; -}; - - -//GuiTSCtrl -class GuiTSCtrl {}; -void GuiTSCtrl_project(GuiTSCtrl *obj, const Point3F &pt, Point3F *dest); //fake - -namespace Sim { - extern SimObject* (*findObject)(U32 id); -} - -//console - -typedef const char * (*StringCallback)(SimObject *obj, S32 argc, const char *argv[]); -typedef S32 (*IntCallback)(SimObject *obj, S32 argc, const char *argv[]); -typedef F32 (*FloatCallback)(SimObject *obj, S32 argc, const char *argv[]); -typedef void (*VoidCallback)(SimObject *obj, S32 argc, const char *argv[]); -typedef bool (*BoolCallback)(SimObject *obj, S32 argc, const char *argv[]); - - -//functions -namespace Con -{ - -extern char * (*getReturnBuffer)(U32 bufferSize); - -extern void (*addMethodB)(const char *nsName, const char *name, BoolCallback cb, const char *usage, S32 minArgs, S32 maxArgs); -extern void (*addMethodS)(const char *nsName, const char *name, StringCallback cb, const char *usage, S32 minArgs, S32 maxArgs); - -extern bool (*addVariable)(const char *name, S32 t, void *dp); - -extern void (*printf)(const char* fmt,...); -extern void (*errorf)(U32 type, const char* fmt,...); - -extern const char * (*getVariable)(const char *name); -extern const char * (*execute)(S32 argc, const char *argv[]); -extern const char * (*executef)(S32 argc, ...); -extern const char * (*executem)(SimObject *object, S32 argc, const char *argv[]); -extern const char * (*evaluate)(const char* string, bool echo, const char *fileName, bool cf); -} - -//d-util -extern int (*dSscanf)(const char *buffer, const char *format, ...); -extern int (*dSprintf)(char *buffer, dsize_t bufferSize, const char *format, ...); +// Linker's Tribes 2 API + +#pragma once + +//api stuff + +typedef unsigned int U32; +typedef int S32; +typedef float F32; + +typedef unsigned int dsize_t; +#include + +//for addvariable +#define TypeS32 1 +#define TypeBool 3 +#define TypeF32 5 + +//dshit +inline dsize_t dStrlen(const char *str) +{ + return (dsize_t)strlen(str); +} + +class Namespace +{ + const char* mName; +}; + +struct SimObject +{ + SimObject* group; + const char* objectName; //04h: objectName + SimObject* nextNameObject; //8 + SimObject* nextManagerNameObject; //c + SimObject* nextIdObject; //10h: nextIdObject + U32 stuff; //14 + U32 mFlags; //18h + U32 mNotifyList; //actually a pointer + U32 mId; //20h: mId + //more stuff +}; + +class SimIdDictionary +{ + enum + { + DefaultTableSize = 4096, + TableBitMask = 4095 + }; + SimObject *table[DefaultTableSize]; +}; +extern SimIdDictionary* gIdDictionary; + +class Point3F +{ + public: + Point3F(F32 *x, F32 *y, F32 *z) + { + this->x = x; + this->y = y; + this->z = z; + } + + Point3F(void) + { + this->x = 0; + this->y = 0; + this->z = 0; + } + + F32 *x; + F32 *y; + F32 *z; +}; + + +//GuiTSCtrl +class GuiTSCtrl {}; +void GuiTSCtrl_project(GuiTSCtrl *obj, const Point3F &pt, Point3F *dest); //fake + +namespace Sim { + extern SimObject* (*findObject)(U32 id); +} + +//console + +typedef const char * (*StringCallback)(SimObject *obj, S32 argc, const char *argv[]); +typedef S32 (*IntCallback)(SimObject *obj, S32 argc, const char *argv[]); +typedef F32 (*FloatCallback)(SimObject *obj, S32 argc, const char *argv[]); +typedef void (*VoidCallback)(SimObject *obj, S32 argc, const char *argv[]); +typedef bool (*BoolCallback)(SimObject *obj, S32 argc, const char *argv[]); + + +//functions +namespace Con +{ + +extern char * (*getReturnBuffer)(U32 bufferSize); + +extern void (*addMethodB)(const char *nsName, const char *name, BoolCallback cb, const char *usage, S32 minArgs, S32 maxArgs); +extern void (*addMethodS)(const char *nsName, const char *name, StringCallback cb, const char *usage, S32 minArgs, S32 maxArgs); + +extern bool (*addVariable)(const char *name, S32 t, void *dp); + +extern void (*printf)(const char* fmt,...); +extern void (*errorf)(U32 type, const char* fmt,...); + +extern const char * (*getVariable)(const char *name); +extern const char * (*execute)(S32 argc, const char *argv[]); +extern const char * (*executef)(S32 argc, ...); +extern const char * (*executem)(SimObject *object, S32 argc, const char *argv[]); +extern const char * (*evaluate)(const char* string, bool echo, const char *fileName, bool cf); +} + +//d-util +extern int (*dSscanf)(const char *buffer, const char *format, ...); +extern int (*dSprintf)(char *buffer, dsize_t bufferSize, const char *format, ...); extern bool (*dAtob)(const char *str); \ No newline at end of file diff --git a/Mod Sources/TSExtension/BaseMod/BaseMod.cpp b/Mod Sources/TSExtension/TSExtension/source/BaseMod.cpp similarity index 77% rename from Mod Sources/TSExtension/BaseMod/BaseMod.cpp rename to Mod Sources/TSExtension/TSExtension/source/BaseMod.cpp index 68da28b..28b42ce 100644 --- a/Mod Sources/TSExtension/BaseMod/BaseMod.cpp +++ b/Mod Sources/TSExtension/TSExtension/source/BaseMod.cpp @@ -1,22 +1,19 @@ -// BaseMod.cpp : Defines the exported functions for the DLL application. -// - -#include "stdafx.h" -#include "BaseMod.h" - -#include "DXAPI.h" -#include "LinkerAPI.h" - -#include "DXConCmds.h" - -extern "C" -{ - BASEMOD_API void ModInitialize(void) - { - Con::addMethodB("Player", "isjumping", &conPlayerGetJumpingState,"Returns whether or not the player is jumping", 2, 2); - Con::addMethodB("Player", "isjetting", &conPlayerGetJettingState,"Returns whether or not the player is jetting", 2, 2); - - Con::addMethodB("GrenadeProjectile", "explode", &conProjectileExplode,"Explodes the given projectile", 5, 5); - Con::addMethodB("Projectile", "explode", &conProjectileExplode,"Explodes the given projectile", 5, 5); - } +// BaseMod.cpp : Defines the exported functions for the DLL application. +// + +#include +#include + +#include + +extern "C" +{ + __declspec(dllexport) void ModInitialize(void) + { + Con::addMethodB("Player", "isjumping", &conPlayerGetJumpingState,"Returns whether or not the player is jumping", 2, 2); + Con::addMethodB("Player", "isjetting", &conPlayerGetJettingState,"Returns whether or not the player is jetting", 2, 2); + + Con::addMethodB("GrenadeProjectile", "explode", &conProjectileExplode,"Explodes the given projectile", 5, 5); + Con::addMethodB("Projectile", "explode", &conProjectileExplode,"Explodes the given projectile", 5, 5); + } } \ No newline at end of file diff --git a/Mod Sources/TSExtension/BaseMod/DXAPI.cpp b/Mod Sources/TSExtension/TSExtension/source/DXAPI.cpp similarity index 96% rename from Mod Sources/TSExtension/BaseMod/DXAPI.cpp rename to Mod Sources/TSExtension/TSExtension/source/DXAPI.cpp index 098bd21..fb176ed 100644 --- a/Mod Sources/TSExtension/BaseMod/DXAPI.cpp +++ b/Mod Sources/TSExtension/TSExtension/source/DXAPI.cpp @@ -1,90 +1,90 @@ -/** - * @file DXAPI.cpp - * @brief The DXAPI is an API that allows you to manipulate various game objects - * in Tribes 2 from raw C++ code. It dynamically resolves the addresses of member - * variables as you can't really trust the compiler to produce binary compatible classes, - * especially with all the inheritance involved in the original Tribes 2 codebase. - * - * This code wouldn't be possible without Linker's original gift on the-construct.net forums, - * whose files are appropriately labelled in this codebase. These files have been edited where - * appropriate in order to make that code play better with the DXAPI. - * - * @copyright (c) 2014 Robert MacGregor - */ - -#include "DXAPI.h" -#include "LinkerAPI.h" - -namespace DX -{ - Player GetPlayerPointer(UnresolvedObject obj) - { - // Probably some way to do all this via assembly but screw me if I know - unsigned int base_tribes_pointer = (unsigned int)obj; - - Player result = - { - 0x00, // Object Name - *(unsigned int*)(base_tribes_pointer + 32), // Object ID - *(float*)(base_tribes_pointer + 168), // Position X - *(float*)(base_tribes_pointer + 184), // Position Y - *(float*)(base_tribes_pointer + 200), // Position Z - *(bool*)(base_tribes_pointer + 735), // Jetting State - *(bool*)(base_tribes_pointer + 734) // Jumping State - }; - return result; - } - - StaticShape GetStaticShapePointer(UnresolvedObject obj) - { - unsigned int base_tribes_pointer = (unsigned int)obj; - - StaticShape result = - { - 0x00, // Object Name - *(float*)(base_tribes_pointer + 200), // Position X - *(float*)(base_tribes_pointer + 200), // Position Y - *(float*)(base_tribes_pointer + 200) // Position Z - }; - return result; - } - - SimGroup GetSimGroupPointer(UnresolvedObject obj) - { - unsigned int base_tribes_pointer = (unsigned int)obj; - - SimGroup result = - { - - }; - return result; - } - - FlyingVehicle GetFlyingVehiclePointer(UnresolvedObject obj) - { - unsigned int base_tribes_pointer = (unsigned int)obj; - - FlyingVehicle result = - { - *(float*)(base_tribes_pointer + 2200), // Strafing Status - }; - return result; - } - - void Projectile_explode(Projectile *obj, const Point3F &position, const Point3F &normal, const unsigned int collideType) - { - typedef void (__cdecl *explodeFunc)(const Point3F &position, const Point3F &normal, const unsigned int collideType); - static explodeFunc function_call = (explodeFunc)0x62DC30; - - __asm { - push collideType; - push normal; - push position; - mov ecx,obj; - lea eax, function_call; - mov eax, [eax]; - call eax; - } -} - +/** + * @file DXAPI.cpp + * @brief The DXAPI is an API that allows you to manipulate various game objects + * in Tribes 2 from raw C++ code. It dynamically resolves the addresses of member + * variables as you can't really trust the compiler to produce binary compatible classes, + * especially with all the inheritance involved in the original Tribes 2 codebase. + * + * This code wouldn't be possible without Linker's original gift on the-construct.net forums, + * whose files are appropriately labelled in this codebase. These files have been edited where + * appropriate in order to make that code play better with the DXAPI. + * + * @copyright (c) 2014 Robert MacGregor + */ + +#include "DXAPI.h" +#include "LinkerAPI.h" + +namespace DX +{ + Player GetPlayerPointer(UnresolvedObject obj) + { + // Probably some way to do all this via assembly but screw me if I know + unsigned int base_tribes_pointer = (unsigned int)obj; + + Player result = + { + 0x00, // Object Name + *(unsigned int*)(base_tribes_pointer + 32), // Object ID + *(float*)(base_tribes_pointer + 168), // Position X + *(float*)(base_tribes_pointer + 184), // Position Y + *(float*)(base_tribes_pointer + 200), // Position Z + *(bool*)(base_tribes_pointer + 735), // Jetting State + *(bool*)(base_tribes_pointer + 734) // Jumping State + }; + return result; + } + + StaticShape GetStaticShapePointer(UnresolvedObject obj) + { + unsigned int base_tribes_pointer = (unsigned int)obj; + + StaticShape result = + { + 0x00, // Object Name + *(float*)(base_tribes_pointer + 200), // Position X + *(float*)(base_tribes_pointer + 200), // Position Y + *(float*)(base_tribes_pointer + 200) // Position Z + }; + return result; + } + + SimGroup GetSimGroupPointer(UnresolvedObject obj) + { + unsigned int base_tribes_pointer = (unsigned int)obj; + + SimGroup result = + { + + }; + return result; + } + + FlyingVehicle GetFlyingVehiclePointer(UnresolvedObject obj) + { + unsigned int base_tribes_pointer = (unsigned int)obj; + + FlyingVehicle result = + { + *(float*)(base_tribes_pointer + 2200), // Strafing Status + }; + return result; + } + + void Projectile_explode(Projectile *obj, const Point3F &position, const Point3F &normal, const unsigned int collideType) + { + typedef void (__cdecl *explodeFunc)(const Point3F &position, const Point3F &normal, const unsigned int collideType); + static explodeFunc function_call = (explodeFunc)0x62DC30; + + __asm { + push collideType; + push normal; + push position; + mov ecx,obj; + lea eax, function_call; + mov eax, [eax]; + call eax; + } +} + } \ No newline at end of file diff --git a/Mod Sources/TSExtension/BaseMod/DXConCmds.cpp b/Mod Sources/TSExtension/TSExtension/source/DXConCmds.cpp similarity index 91% rename from Mod Sources/TSExtension/BaseMod/DXConCmds.cpp rename to Mod Sources/TSExtension/TSExtension/source/DXConCmds.cpp index 1c0ad1f..70de4aa 100644 --- a/Mod Sources/TSExtension/BaseMod/DXConCmds.cpp +++ b/Mod Sources/TSExtension/TSExtension/source/DXConCmds.cpp @@ -1,58 +1,58 @@ -/** - * - */ - -#include "LinkerAPI.h" -#include "DXAPI.h" - -const char *conGetAddress(SimObject *obj, S32 argc, const char *argv[]) -{ - // Hmm... - char result[256]; - sprintf(result, "%x", obj); - return result; -} - -const char *conPlayerSetZ(SimObject *obj, S32 argc, const char *argv[]) -{ - DX::Player test = DX::GetPlayerPointer(obj); - test.position_y = 100; - test.position_z = 300; - test.position_x = 500; - - char result[256]; - sprintf(result, "LOL"); - return result; -} - -bool conPlayerGetJumpingState(SimObject *obj, S32 argc, const char* argv[]) -{ - DX::Player operand = DX::GetPlayerPointer(obj); - - return operand.is_jumping; -} - -bool conPlayerGetJettingState(SimObject *obj, S32 argc, const char* argv[]) -{ - DX::Player operand = DX::GetPlayerPointer(obj); - - return operand.is_jetting; -} - -bool conProjectileExplode(SimObject *obj, S32 argc, const char* argv[]) -{ - Point3F position; - position.x = 0; - position.y = 0; - position.z = 0; - - Point3F normal; - normal.x = 0; - normal.y = 0; - normal.z = 0; - - unsigned int collideType = atoi(argv[4]); - DX::Projectile_explode((DX::Projectile*)obj, position, normal, collideType); - - return true; +/** + * + */ + +#include +#include + +const char *conGetAddress(SimObject *obj, S32 argc, const char *argv[]) +{ + // Hmm... + char result[256]; + sprintf(result, "%x", obj); + return result; +} + +const char *conPlayerSetZ(SimObject *obj, S32 argc, const char *argv[]) +{ + DX::Player test = DX::GetPlayerPointer(obj); + test.position_y = 100; + test.position_z = 300; + test.position_x = 500; + + char result[256]; + sprintf(result, "LOL"); + return result; +} + +bool conPlayerGetJumpingState(SimObject *obj, S32 argc, const char* argv[]) +{ + DX::Player operand = DX::GetPlayerPointer(obj); + + return operand.is_jumping; +} + +bool conPlayerGetJettingState(SimObject *obj, S32 argc, const char* argv[]) +{ + DX::Player operand = DX::GetPlayerPointer(obj); + + return operand.is_jetting; +} + +bool conProjectileExplode(SimObject *obj, S32 argc, const char* argv[]) +{ + Point3F position; + position.x = 0; + position.y = 0; + position.z = 0; + + Point3F normal; + normal.x = 0; + normal.y = 0; + normal.z = 0; + + unsigned int collideType = atoi(argv[4]); + DX::Projectile_explode((DX::Projectile*)obj, position, normal, collideType); + + return true; } \ No newline at end of file diff --git a/Mod Sources/TSExtension/BaseMod/LinkerAPI.cpp b/Mod Sources/TSExtension/TSExtension/source/LinkerAPI.cpp similarity index 95% rename from Mod Sources/TSExtension/BaseMod/LinkerAPI.cpp rename to Mod Sources/TSExtension/TSExtension/source/LinkerAPI.cpp index 98f0743..f3f9def 100644 --- a/Mod Sources/TSExtension/BaseMod/LinkerAPI.cpp +++ b/Mod Sources/TSExtension/TSExtension/source/LinkerAPI.cpp @@ -1,86 +1,86 @@ -#include "LinkerAPI.h" - -SimIdDictionary* gIdDictionary = reinterpret_cast(0x009E9194); - -//439550 -namespace Sim { - SimObject* (*findObject)(U32 id) = - (SimObject* (_cdecl *)(U32 id) ) - 0x439550; -} - -//hackey way to do member functions, .... -void GuiTSCtrl_project(GuiTSCtrl *obj, const Point3F &pt, Point3F *dest) { - typedef void (__cdecl *projFunc)(const Point3F &pt, Point3F *dest); - static projFunc p = (projFunc)0x4d0b40; - - __asm { - push dest; - push pt; - mov ecx,obj; - lea eax, p; - mov eax, [eax]; - call eax; - } -} - -namespace Con -{ - -char* (*getReturnBuffer)(U32 bufferSize) = - (char *(__cdecl *)(U32)) - 0x42caa0; - -void (*addMethodB)(const char *nsName, const char *name, BoolCallback cb, const char *usage, S32 minArgs, S32 maxArgs) = - (void (__cdecl *)(const char *, const char *,BoolCallback,const char *,S32,S32)) - 0x426510; - -void (*addMethodS)(const char *, const char *,StringCallback, const char *, S32, S32) = - (void (__cdecl *)(const char *,const char *,StringCallback,const char *,S32,S32)) - 0x426410; - -bool (*addVariable)(const char *name, S32 t, void *dp) = - (bool (__cdecl *)(const char *name, S32 t, void *dp)) - 0x4263B0; - -const char * (*execute)(S32 argc, const char *argv[]) = - (const char * (__cdecl *)(S32 argc, const char *argv[])) - 0x4267A0; - -const char * (*executef)(S32 argc, ...) = - (const char * (__cdecl *)(S32 argc, ...)) - 0x4269E0; - -const char * (*evaluate)(const char* string, bool echo, const char *fileName, bool cf) = - (const char * (__cdecl *)(const char* string, bool echo, const char *fileName, bool cf)) - 0x426690; - -const char * (*executem)(SimObject *object, S32 argc, const char *argv[]) = - (const char * (__cdecl *)(SimObject *object, S32 argc, const char *argv[])) - 0x426800; - -const char * (*getVariable)(const char *name) = - (const char * (__cdecl *)(const char *name)) - 0x4261F0; - -void (*printf)(const char* fmt,...) = - (void (__cdecl *)(const char* fmt,...)) - 0x425F30; - -void (*errorf)(U32 type, const char* fmt,...)= - (void (__cdecl *)(U32, const char*,...)) - 0x425FB0; - -} - -int (*dSscanf)(const char *buffer, const char *format, ...) = - (int (__cdecl *)(const char *,const char *,...)) - 0x55b640; - -int (*dSprintf)(char *buffer, dsize_t bufferSize, const char *format, ...) = - (int (__cdecl *)(char *,dsize_t,const char *,...)) - 0x55b5e0; - -bool (*dAtob)(const char *str) = - (bool (__cdecl *)(const char *str)) +#include + +SimIdDictionary* gIdDictionary = reinterpret_cast(0x009E9194); + +//439550 +namespace Sim { + SimObject* (*findObject)(U32 id) = + (SimObject* (_cdecl *)(U32 id) ) + 0x439550; +} + +//hackey way to do member functions, .... +void GuiTSCtrl_project(GuiTSCtrl *obj, const Point3F &pt, Point3F *dest) { + typedef void (__cdecl *projFunc)(const Point3F &pt, Point3F *dest); + static projFunc p = (projFunc)0x4d0b40; + + __asm { + push dest; + push pt; + mov ecx,obj; + lea eax, p; + mov eax, [eax]; + call eax; + } +} + +namespace Con +{ + +char* (*getReturnBuffer)(U32 bufferSize) = + (char *(__cdecl *)(U32)) + 0x42caa0; + +void (*addMethodB)(const char *nsName, const char *name, BoolCallback cb, const char *usage, S32 minArgs, S32 maxArgs) = + (void (__cdecl *)(const char *, const char *,BoolCallback,const char *,S32,S32)) + 0x426510; + +void (*addMethodS)(const char *, const char *,StringCallback, const char *, S32, S32) = + (void (__cdecl *)(const char *,const char *,StringCallback,const char *,S32,S32)) + 0x426410; + +bool (*addVariable)(const char *name, S32 t, void *dp) = + (bool (__cdecl *)(const char *name, S32 t, void *dp)) + 0x4263B0; + +const char * (*execute)(S32 argc, const char *argv[]) = + (const char * (__cdecl *)(S32 argc, const char *argv[])) + 0x4267A0; + +const char * (*executef)(S32 argc, ...) = + (const char * (__cdecl *)(S32 argc, ...)) + 0x4269E0; + +const char * (*evaluate)(const char* string, bool echo, const char *fileName, bool cf) = + (const char * (__cdecl *)(const char* string, bool echo, const char *fileName, bool cf)) + 0x426690; + +const char * (*executem)(SimObject *object, S32 argc, const char *argv[]) = + (const char * (__cdecl *)(SimObject *object, S32 argc, const char *argv[])) + 0x426800; + +const char * (*getVariable)(const char *name) = + (const char * (__cdecl *)(const char *name)) + 0x4261F0; + +void (*printf)(const char* fmt,...) = + (void (__cdecl *)(const char* fmt,...)) + 0x425F30; + +void (*errorf)(U32 type, const char* fmt,...)= + (void (__cdecl *)(U32, const char*,...)) + 0x425FB0; + +} + +int (*dSscanf)(const char *buffer, const char *format, ...) = + (int (__cdecl *)(const char *,const char *,...)) + 0x55b640; + +int (*dSprintf)(char *buffer, dsize_t bufferSize, const char *format, ...) = + (int (__cdecl *)(char *,dsize_t,const char *,...)) + 0x55b5e0; + +bool (*dAtob)(const char *str) = + (bool (__cdecl *)(const char *str)) 0x55B490; \ No newline at end of file diff --git a/Mod Sources/BaseMod/BaseMod/dllmain.cpp b/Mod Sources/TSExtension/TSExtension/source/dllmain.cpp similarity index 89% rename from Mod Sources/BaseMod/BaseMod/dllmain.cpp rename to Mod Sources/TSExtension/TSExtension/source/dllmain.cpp index 8a4edd3..676221a 100644 --- a/Mod Sources/BaseMod/BaseMod/dllmain.cpp +++ b/Mod Sources/TSExtension/TSExtension/source/dllmain.cpp @@ -1,19 +1,20 @@ -// dllmain.cpp : Defines the entry point for the DLL application. -#include "stdafx.h" - -BOOL APIENTRY DllMain( HMODULE hModule, - DWORD ul_reason_for_call, - LPVOID lpReserved - ) -{ - switch (ul_reason_for_call) - { - case DLL_PROCESS_ATTACH: - case DLL_THREAD_ATTACH: - case DLL_THREAD_DETACH: - case DLL_PROCESS_DETACH: - break; - } - return TRUE; -} - +// dllmain.cpp : Defines the entry point for the DLL application. +#include +#include + +BOOL APIENTRY DllMain( HMODULE hModule, + DWORD ul_reason_for_call, + LPVOID lpReserved + ) +{ + switch (ul_reason_for_call) + { + case DLL_PROCESS_ATTACH: + case DLL_THREAD_ATTACH: + case DLL_THREAD_DETACH: + case DLL_PROCESS_DETACH: + break; + } + return TRUE; +} + diff --git a/Mod Sources/TSExtension/ipch/basemod-a53d8d4a/basemod-c8c26461.ipch b/Mod Sources/TSExtension/ipch/basemod-a53d8d4a/basemod-c8c26461.ipch deleted file mode 100644 index b41c6e2..0000000 Binary files a/Mod Sources/TSExtension/ipch/basemod-a53d8d4a/basemod-c8c26461.ipch and /dev/null differ diff --git a/ModLoader/CoreModSystem.v12.suo b/ModLoader/CoreModSystem.v12.suo new file mode 100644 index 0000000..367220d Binary files /dev/null and b/ModLoader/CoreModSystem.v12.suo differ