mirror of
https://github.com/Ragora/T2-CPP.git
synced 2026-07-15 13:44:35 +00:00
Fixed up the ModLoader Project; replaced the old sources with the new
This commit is contained in:
parent
83b8016a30
commit
a3a954b22f
12 changed files with 62 additions and 163 deletions
Binary file not shown.
|
|
@ -40,13 +40,13 @@
|
||||||
<_ProjectFileVersion>10.0.30319.1</_ProjectFileVersion>
|
<_ProjectFileVersion>10.0.30319.1</_ProjectFileVersion>
|
||||||
<OutDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(SolutionDir)$(Configuration)\</OutDir>
|
<OutDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(SolutionDir)$(Configuration)\</OutDir>
|
||||||
<IntDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(Configuration)\</IntDir>
|
<IntDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(Configuration)\</IntDir>
|
||||||
<LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</LinkIncremental>
|
<LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">false</LinkIncremental>
|
||||||
<OutDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(SolutionDir)$(Configuration)\</OutDir>
|
<OutDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(SolutionDir)$(Configuration)\</OutDir>
|
||||||
<IntDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(Configuration)\</IntDir>
|
<IntDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(Configuration)\</IntDir>
|
||||||
<LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">false</LinkIncremental>
|
<LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">false</LinkIncremental>
|
||||||
<IncludePath Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(VCInstallDir)include;$(VCInstallDir)atlmfc\include;$(WindowsSdkDir)include;$(FrameworkSDKDir)\include;include\;include\bullet\;</IncludePath>
|
<IncludePath Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(VCInstallDir)include;$(VCInstallDir)atlmfc\include;$(WindowsSdkDir)include;$(FrameworkSDKDir)\include;include</IncludePath>
|
||||||
<LibraryPath Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(VCInstallDir)lib;$(VCInstallDir)atlmfc\lib;$(WindowsSdkDir)lib;$(FrameworkSDKDir)\lib;lib\;</LibraryPath>
|
<LibraryPath Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(VCInstallDir)lib;$(VCInstallDir)atlmfc\lib;$(WindowsSdkDir)lib;$(FrameworkSDKDir)\lib;lib\;</LibraryPath>
|
||||||
<IncludePath Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(VCInstallDir)include;$(VCInstallDir)atlmfc\include;$(WindowsSdkDir)include;$(FrameworkSDKDir)\include;include\;include\bullet\;</IncludePath>
|
<IncludePath Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(VCInstallDir)include;$(VCInstallDir)atlmfc\include;$(WindowsSdkDir)include;$(FrameworkSDKDir)\include;include</IncludePath>
|
||||||
<LibraryPath Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(VCInstallDir)lib;$(VCInstallDir)atlmfc\lib;$(WindowsSdkDir)lib;$(FrameworkSDKDir)\lib;lib\;</LibraryPath>
|
<LibraryPath Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(VCInstallDir)lib;$(VCInstallDir)atlmfc\lib;$(WindowsSdkDir)lib;$(FrameworkSDKDir)\lib;lib\;</LibraryPath>
|
||||||
<TargetName Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">t2dll</TargetName>
|
<TargetName Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">t2dll</TargetName>
|
||||||
<TargetName Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">t2dll</TargetName>
|
<TargetName Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">t2dll</TargetName>
|
||||||
|
|
@ -121,15 +121,13 @@
|
||||||
</Reference>
|
</Reference>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
<ClCompile Include="..\..\ModLoader\source\modLoader.cpp" />
|
||||||
<ClCompile Include="source\t2api.cpp" />
|
<ClCompile Include="source\t2api.cpp" />
|
||||||
<ClCompile Include="source\t2ConCmds.cpp" />
|
|
||||||
<ClCompile Include="source\t2dll.cpp" />
|
<ClCompile Include="source\t2dll.cpp" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<ClInclude Include="include\config.h" />
|
<ClInclude Include="include\modLoader.h" />
|
||||||
<ClInclude Include="include\stdafx.h" />
|
|
||||||
<ClInclude Include="include\t2api.h" />
|
<ClInclude Include="include\t2api.h" />
|
||||||
<ClInclude Include="include\t2ConCmds.h" />
|
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
||||||
<ImportGroup Label="ExtensionTargets">
|
<ImportGroup Label="ExtensionTargets">
|
||||||
|
|
|
||||||
|
|
@ -9,16 +9,10 @@
|
||||||
</Filter>
|
</Filter>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<ClInclude Include="include\config.h">
|
|
||||||
<Filter>Include</Filter>
|
|
||||||
</ClInclude>
|
|
||||||
<ClInclude Include="include\stdafx.h">
|
|
||||||
<Filter>Include</Filter>
|
|
||||||
</ClInclude>
|
|
||||||
<ClInclude Include="include\t2api.h">
|
<ClInclude Include="include\t2api.h">
|
||||||
<Filter>Include</Filter>
|
<Filter>Include</Filter>
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
<ClInclude Include="include\t2ConCmds.h">
|
<ClInclude Include="include\modLoader.h">
|
||||||
<Filter>Include</Filter>
|
<Filter>Include</Filter>
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
@ -26,10 +20,10 @@
|
||||||
<ClCompile Include="source\t2api.cpp">
|
<ClCompile Include="source\t2api.cpp">
|
||||||
<Filter>Source</Filter>
|
<Filter>Source</Filter>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
<ClCompile Include="source\t2ConCmds.cpp">
|
<ClCompile Include="source\t2dll.cpp">
|
||||||
<Filter>Source</Filter>
|
<Filter>Source</Filter>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
<ClCompile Include="source\t2dll.cpp">
|
<ClCompile Include="..\..\ModLoader\source\modLoader.cpp">
|
||||||
<Filter>Source</Filter>
|
<Filter>Source</Filter>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
|
||||||
|
|
@ -1,7 +0,0 @@
|
||||||
/*
|
|
||||||
* config.h
|
|
||||||
* Contains configuration information for BulletDLL
|
|
||||||
* Copyright (c) 2013 Robert MacGregor
|
|
||||||
*/
|
|
||||||
|
|
||||||
#define MAXIMUM_BULLET_NODES 256
|
|
||||||
8
ModLoader/include/modLoader.h
Normal file
8
ModLoader/include/modLoader.h
Normal file
|
|
@ -0,0 +1,8 @@
|
||||||
|
/*
|
||||||
|
* modLoader.h
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <t2api.h>
|
||||||
|
|
||||||
|
// Mod Loader Implementation
|
||||||
|
bool conLoadMod(SimObject *obj,S32 argc, const char* argv[]);
|
||||||
|
|
@ -1,32 +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
|
|
||||||
|
|
||||||
// Modify the following defines if you have to target a platform prior to the ones specified below.
|
|
||||||
// Refer to MSDN for the latest info on corresponding values for different platforms.
|
|
||||||
#ifndef WINVER // Allow use of features specific to Windows XP or later.
|
|
||||||
#define WINVER 0x0501 // Change this to the appropriate value to target other versions of Windows.
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef _WIN32_WINNT // Allow use of features specific to Windows XP or later.
|
|
||||||
#define _WIN32_WINNT 0x0501 // Change this to the appropriate value to target other versions of Windows.
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef _WIN32_WINDOWS // Allow use of features specific to Windows 98 or later.
|
|
||||||
#define _WIN32_WINDOWS 0x0410 // Change this to the appropriate value to target Windows Me or later.
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef _WIN32_IE // Allow use of features specific to IE 6.0 or later.
|
|
||||||
#define _WIN32_IE 0x0600 // Change this to the appropriate value to target other versions of IE.
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers
|
|
||||||
// Windows Header Files:
|
|
||||||
#include <windows.h>
|
|
||||||
|
|
||||||
// TODO: reference additional headers your program requires here
|
|
||||||
#include "t2api.h"
|
|
||||||
#include "config.h"
|
|
||||||
|
|
@ -1,15 +0,0 @@
|
||||||
/*
|
|
||||||
* t2conCmds.h
|
|
||||||
* Original code by Linker
|
|
||||||
* Modified by Robert MacGregor
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include "stdafx.h"
|
|
||||||
|
|
||||||
// Linker's original functions
|
|
||||||
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[]);
|
|
||||||
|
|
||||||
// Mod Loader Implementation
|
|
||||||
bool conLoadMod(SimObject *obj,S32 argc, const char* argv[]);
|
|
||||||
|
|
@ -1,5 +1,7 @@
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
|
#include <string.h>
|
||||||
|
|
||||||
void initT2Api();
|
void initT2Api();
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
39
ModLoader/source/modLoader.cpp
Normal file
39
ModLoader/source/modLoader.cpp
Normal file
|
|
@ -0,0 +1,39 @@
|
||||||
|
/*
|
||||||
|
* modLoader.cpp
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "stdafx.h"
|
||||||
|
#include <t2api.h>
|
||||||
|
|
||||||
|
// Mod Loader Implementation
|
||||||
|
bool conLoadMod(SimObject *obj,S32 argc, const char* argv[])
|
||||||
|
{
|
||||||
|
typedef void (*LPMODINIT)(void);
|
||||||
|
HINSTANCE hDLL = NULL;
|
||||||
|
LPMODINIT lpInitMod = NULL;
|
||||||
|
|
||||||
|
std::string raw = "mods\\";
|
||||||
|
raw += argv[1];
|
||||||
|
raw += ".dll";
|
||||||
|
|
||||||
|
std::wstring modification(raw.begin(), raw.end());
|
||||||
|
|
||||||
|
hDLL = LoadLibrary(modification.c_str());
|
||||||
|
if (hDLL == NULL)
|
||||||
|
{
|
||||||
|
Con::errorf(0, "loadMod(): Failed to load DLL '%s'. Does it exist in GameData\mods? (%u)", raw.c_str(), GetLastError());
|
||||||
|
return false; // The DLL doesn't exist
|
||||||
|
}
|
||||||
|
|
||||||
|
lpInitMod = (LPMODINIT)GetProcAddress(hDLL, "ModInitialize"); // Attempt to load our entry point
|
||||||
|
|
||||||
|
if (lpInitMod == NULL)
|
||||||
|
{
|
||||||
|
Con::errorf(0, "loadMod(): Failed to locate entry point 'ModInitialize' in mod DLL '%s'. Is it a good mod DLL? (%u)", raw.c_str(), GetLastError());
|
||||||
|
return false; // Unable to load entry point
|
||||||
|
}
|
||||||
|
|
||||||
|
lpInitMod();
|
||||||
|
Con::errorf(0, "loadMod(): Loaded and executed entry point code for mod DLL '%s'", raw.c_str());
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
@ -1,84 +0,0 @@
|
||||||
/*
|
|
||||||
* t2ConCmds.cpp
|
|
||||||
* Original code by Linker
|
|
||||||
* Modified by Robert MacGregor
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include <string>
|
|
||||||
|
|
||||||
#include "stdafx.h"
|
|
||||||
#include "t2ConCmds.h"
|
|
||||||
|
|
||||||
// Linker's implementations
|
|
||||||
const char* conGuiTsCtrlProject(SimObject *obj,S32 argc, const char* argv[]) {
|
|
||||||
Point3F pt;
|
|
||||||
Point3F rt;
|
|
||||||
dSscanf(argv[2],"%g %g %g",&pt.x,&pt.y,&pt.z);
|
|
||||||
GuiTSCtrl_project(reinterpret_cast<GuiTSCtrl *>(obj),pt,&rt);
|
|
||||||
|
|
||||||
char* buffer = Con::getReturnBuffer(255);
|
|
||||||
dSprintf(buffer,255,"%g %g %g",rt.x,rt.y,rt.z);
|
|
||||||
|
|
||||||
return buffer;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool conNetObjectSetGhostable(SimObject *obj,S32 argc, const char* argv[]) {
|
|
||||||
if (dAtob(argv[2])) {
|
|
||||||
__asm {
|
|
||||||
push ecx
|
|
||||||
mov ecx, [obj]
|
|
||||||
mov eax,[ecx+40h]
|
|
||||||
or eax, 100h
|
|
||||||
mov [ecx+40h], eax
|
|
||||||
pop ecx
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
__asm {
|
|
||||||
xor eax, eax
|
|
||||||
or eax, 100h
|
|
||||||
not eax
|
|
||||||
push ecx
|
|
||||||
mov ecx,[obj]
|
|
||||||
and eax, [ecx+40h]
|
|
||||||
mov [ecx+40h],eax
|
|
||||||
push 40h
|
|
||||||
mov eax, 0x585BE0
|
|
||||||
call eax
|
|
||||||
pop ecx
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
const char* conGetVariable(SimObject *obj,S32 argc, const char* argv[]) {
|
|
||||||
return Con::getVariable(argv[1]);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Mod Loader Implementation
|
|
||||||
bool conLoadMod(SimObject *obj,S32 argc, const char* argv[])
|
|
||||||
{
|
|
||||||
typedef void (*LPMODINIT)(void);
|
|
||||||
HINSTANCE hDLL = NULL;
|
|
||||||
LPMODINIT lpInitMod = NULL;
|
|
||||||
|
|
||||||
std::string raw = argv[1];
|
|
||||||
|
|
||||||
std::wstring input(raw.begin(), raw.end());
|
|
||||||
std::wstring modification = L"mods/";
|
|
||||||
modification += input;
|
|
||||||
modification += L".dll";
|
|
||||||
|
|
||||||
hDLL = LoadLibrary(modification.c_str()); // AfxLoadLibrary is probably better.
|
|
||||||
|
|
||||||
if (hDLL == NULL)
|
|
||||||
return false; // The DLL doesn't exist
|
|
||||||
else
|
|
||||||
lpInitMod = (LPMODINIT)GetProcAddress(hDLL, "?ModInitialize@@YAXXZ"); // Attempt to load our entry point
|
|
||||||
|
|
||||||
if (lpInitMod == NULL)
|
|
||||||
return false; // Unable to load entry point
|
|
||||||
else
|
|
||||||
lpInitMod(); // The function was loaded, call TribesNext and move on to postTN Startup
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
#include "stdafx.h"
|
#include <t2api.h>
|
||||||
|
|
||||||
SimIdDictionary* gIdDictionary = reinterpret_cast<SimIdDictionary*>(0x009E9194);
|
SimIdDictionary* gIdDictionary = reinterpret_cast<SimIdDictionary*>(0x009E9194);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -4,11 +4,12 @@
|
||||||
* Modified by Robert MacGregor
|
* Modified by Robert MacGregor
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "stdafx.h"
|
#include <winsdkver.h>
|
||||||
#include "t2ConCmds.h"
|
|
||||||
#include "t2api.h"
|
|
||||||
#include <Windows.h>
|
#include <Windows.h>
|
||||||
|
|
||||||
|
#include <t2api.h>
|
||||||
|
#include <modLoader.h>
|
||||||
|
|
||||||
BOOL APIENTRY DllMain( HMODULE hModule,
|
BOOL APIENTRY DllMain( HMODULE hModule,
|
||||||
DWORD ul_reason_for_call,
|
DWORD ul_reason_for_call,
|
||||||
LPVOID lpReserved
|
LPVOID lpReserved
|
||||||
|
|
@ -19,11 +20,6 @@ BOOL APIENTRY DllMain( HMODULE hModule,
|
||||||
|
|
||||||
__declspec(dllexport) void initT2Dll(void)
|
__declspec(dllexport) void initT2Dll(void)
|
||||||
{
|
{
|
||||||
// Run Linker's old implementations ...
|
|
||||||
Con::addMethodS("GuiTSCtrl","project",&conGuiTsCtrlProject,"projects a world space vector to on-screen position",3,3);
|
|
||||||
Con::addMethodB("NetObject","SetGhostable",&conNetObjectSetGhostable,"set or unset object to be ghostable",3,3);
|
|
||||||
Con::addMethodS(NULL,"getVariable",&conGetVariable,"Get a variable without restrictions",2,2);
|
|
||||||
|
|
||||||
Con::addVariable("$cpuspeed",TypeS32,reinterpret_cast<void*>(0x8477F8)); //1 - S32, this is so i can set my cpu speed to 31337 or osmething =P
|
Con::addVariable("$cpuspeed",TypeS32,reinterpret_cast<void*>(0x8477F8)); //1 - S32, this is so i can set my cpu speed to 31337 or osmething =P
|
||||||
Con::addVariable("$GameBase::showBoundingBox",TypeBool,reinterpret_cast<void*>(0x9ECF24));
|
Con::addVariable("$GameBase::showBoundingBox",TypeBool,reinterpret_cast<void*>(0x9ECF24));
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue