mirror of
https://github.com/Ragora/T2-CPP.git
synced 2026-03-10 07:50:30 +00:00
WatchDog implementation; moved Bahke's server process code into a generalized mod loader implementation to allow loaded mods to hook into the server process
This commit is contained in:
parent
831d49cc20
commit
a7c9fc2f6e
21 changed files with 466 additions and 467 deletions
|
|
@ -1,40 +1,9 @@
|
|||
/**
|
||||
*
|
||||
*/
|
||||
#define endian(hex) (((hex & 0x000000FF) << 24)+((hex & 0x0000FF00) << 8)+((hex & 0x00FF0000)>>8)+((hex & 0xFF000000) >> 24))
|
||||
#include <LinkerAPI.h>
|
||||
#include <DXAPI/DXAPI.h>
|
||||
void serverProcessReplacement(unsigned int timeDelta) {
|
||||
unsigned int servertickaddr=0x602350;
|
||||
unsigned int serverthisptr=0x9E5EC0;
|
||||
char test[256]="";
|
||||
sprintf (test,"TSTick(%f);",(float)timeDelta/1000);
|
||||
Con::evaluate(test,false,NULL,false);
|
||||
__asm
|
||||
{
|
||||
mov ecx,serverthisptr
|
||||
push timeDelta
|
||||
call servertickaddr
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
const char* congetServPAddr(Linker::SimObject *obj, S32 argc, const char *argv[]) {
|
||||
char test[256] = "";
|
||||
char test2[256]="";
|
||||
int spr=(signed int)*serverProcessReplacement;
|
||||
sprintf(test2,"B8%08XFFD089EC5DC3",endian(spr));
|
||||
/*test2[0]=test[6];
|
||||
test2[1]=test[7];
|
||||
test2[2]=test[4];
|
||||
test2[3]=test[5];
|
||||
test2[4]=test[2];
|
||||
test2[5]=test[3];
|
||||
test2[6]=test[0];
|
||||
test2[7]=test[1];
|
||||
test2[8]=0;*/
|
||||
return test2;
|
||||
}
|
||||
|
||||
const char *conGetAddress(Linker::SimObject *obj, S32 argc, const char *argv[])
|
||||
{
|
||||
// Hmm...
|
||||
|
|
@ -42,6 +11,7 @@ const char *conGetAddress(Linker::SimObject *obj, S32 argc, const char *argv[])
|
|||
sprintf(result, "%x", obj);
|
||||
return result;
|
||||
}
|
||||
|
||||
bool conShapeBaseSetCloakValue(Linker::SimObject *obj, S32 argc, const char* argv[])
|
||||
{
|
||||
DX::ShapeBase operand = DX::ShapeBase((unsigned int)obj);
|
||||
|
|
@ -60,6 +30,7 @@ bool conPlayerGetJumpingState(Linker::SimObject *obj, S32 argc, const char* argv
|
|||
|
||||
return operand.is_jumping;
|
||||
}
|
||||
|
||||
bool conPlayerGetJettingState(Linker::SimObject *obj, S32 argc, const char* argv[])
|
||||
{
|
||||
DX::Player operand = DX::Player((unsigned int)obj);
|
||||
|
|
|
|||
|
|
@ -75,8 +75,6 @@ extern "C"
|
|||
// General
|
||||
Con::addMethodS(NULL, "sprintf", &conSprintf,"Formats a string. See the C sprintf.", 2, 20);
|
||||
Con::addMethodB(NULL, "tsExtensionUpdate", &conTSExtensionUpdate,"Updates the TSExtension.", 1, 1);
|
||||
Con::addMethodS(NULL, "getServPAddr",&congetServPAddr,"Gets the memPatch data for ServerProcess",1,1);
|
||||
|
||||
|
||||
|
||||
// Add this Gvar to signify that TSExtension is active
|
||||
|
|
|
|||
|
|
@ -1,20 +0,0 @@
|
|||
|
||||
Microsoft Visual Studio Solution File, Format Version 12.00
|
||||
# Visual Studio Express 2012 for Windows Desktop
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "CoreModSystem", "ModLoader.vcxproj", "{8740E782-7AC2-4A57-85D5-592C914C5285}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|Win32 = Debug|Win32
|
||||
Release|Win32 = Release|Win32
|
||||
EndGlobalSection
|
||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||
{8740E782-7AC2-4A57-85D5-592C914C5285}.Debug|Win32.ActiveCfg = Debug|Win32
|
||||
{8740E782-7AC2-4A57-85D5-592C914C5285}.Debug|Win32.Build.0 = Debug|Win32
|
||||
{8740E782-7AC2-4A57-85D5-592C914C5285}.Release|Win32.ActiveCfg = Release|Win32
|
||||
{8740E782-7AC2-4A57-85D5-592C914C5285}.Release|Win32.Build.0 = Release|Win32
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
EndGlobalSection
|
||||
EndGlobal
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
|
|
@ -1,135 +0,0 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<ItemGroup Label="ProjectConfigurations">
|
||||
<ProjectConfiguration Include="Debug|Win32">
|
||||
<Configuration>Debug</Configuration>
|
||||
<Platform>Win32</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Release|Win32">
|
||||
<Configuration>Release</Configuration>
|
||||
<Platform>Win32</Platform>
|
||||
</ProjectConfiguration>
|
||||
</ItemGroup>
|
||||
<PropertyGroup Label="Globals">
|
||||
<ProjectGuid>{8740E782-7AC2-4A57-85D5-592C914C5285}</ProjectGuid>
|
||||
<RootNamespace>t2dll</RootNamespace>
|
||||
<Keyword>Win32Proj</Keyword>
|
||||
<ProjectName>CoreModSystem</ProjectName>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
|
||||
<ConfigurationType>DynamicLibrary</ConfigurationType>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
<WholeProgramOptimization>true</WholeProgramOptimization>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
|
||||
<ConfigurationType>DynamicLibrary</ConfigurationType>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
|
||||
<ImportGroup Label="ExtensionSettings">
|
||||
</ImportGroup>
|
||||
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="PropertySheets">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="PropertySheets">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<PropertyGroup Label="UserMacros" />
|
||||
<PropertyGroup>
|
||||
<_ProjectFileVersion>10.0.30319.1</_ProjectFileVersion>
|
||||
<OutDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(SolutionDir)$(Configuration)\</OutDir>
|
||||
<IntDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(Configuration)\</IntDir>
|
||||
<LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">false</LinkIncremental>
|
||||
<OutDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(SolutionDir)$(Configuration)\</OutDir>
|
||||
<IntDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(Configuration)\</IntDir>
|
||||
<LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">false</LinkIncremental>
|
||||
<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>
|
||||
<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>
|
||||
<TargetName Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">t2dll</TargetName>
|
||||
<TargetName Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">t2dll</TargetName>
|
||||
</PropertyGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<ClCompile>
|
||||
<Optimization>Disabled</Optimization>
|
||||
<AdditionalIncludeDirectories>C:\Documents and Settings\Linker\My Documents\Code\t2dll\lualib\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<PreprocessorDefinitions>WIN32;BULLET_WINE;_DEBUG;_WINDOWS;_USRDLL;T2DLL_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<MinimalRebuild>true</MinimalRebuild>
|
||||
<BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
|
||||
<RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
|
||||
<PrecompiledHeader>NotUsing</PrecompiledHeader>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<AdditionalDependencies>%(AdditionalDependencies)</AdditionalDependencies>
|
||||
<AdditionalLibraryDirectories>
|
||||
</AdditionalLibraryDirectories>
|
||||
<DelayLoadDLLs>%(DelayLoadDLLs)</DelayLoadDLLs>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
<SubSystem>Windows</SubSystem>
|
||||
<TargetMachine>MachineX86</TargetMachine>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<ClCompile>
|
||||
<Optimization>MaxSpeed</Optimization>
|
||||
<InlineFunctionExpansion>OnlyExplicitInline</InlineFunctionExpansion>
|
||||
<AdditionalIncludeDirectories>C:\Documents and Settings\Linker\My Documents\Code\t2dll\lualib\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<PreprocessorDefinitions>WIN32;BULLET_WINE;NDEBUG;_WINDOWS;_USRDLL;T2DLL_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
|
||||
<PrecompiledHeader>NotUsing</PrecompiledHeader>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<AdditionalDependencies>%(AdditionalDependencies)</AdditionalDependencies>
|
||||
<AdditionalLibraryDirectories>
|
||||
</AdditionalLibraryDirectories>
|
||||
<IgnoreSpecificDefaultLibraries>
|
||||
</IgnoreSpecificDefaultLibraries>
|
||||
<DelayLoadDLLs>%(DelayLoadDLLs)</DelayLoadDLLs>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
<SubSystem>Windows</SubSystem>
|
||||
<OptimizeReferences>true</OptimizeReferences>
|
||||
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
||||
<TargetMachine>MachineX86</TargetMachine>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="System">
|
||||
<CopyLocalSatelliteAssemblies>true</CopyLocalSatelliteAssemblies>
|
||||
<ReferenceOutputAssembly>true</ReferenceOutputAssembly>
|
||||
</Reference>
|
||||
<Reference Include="System.Data">
|
||||
<CopyLocalSatelliteAssemblies>true</CopyLocalSatelliteAssemblies>
|
||||
<ReferenceOutputAssembly>true</ReferenceOutputAssembly>
|
||||
</Reference>
|
||||
<Reference Include="System.Drawing">
|
||||
<CopyLocalSatelliteAssemblies>true</CopyLocalSatelliteAssemblies>
|
||||
<ReferenceOutputAssembly>true</ReferenceOutputAssembly>
|
||||
</Reference>
|
||||
<Reference Include="System.Windows.Forms">
|
||||
<CopyLocalSatelliteAssemblies>true</CopyLocalSatelliteAssemblies>
|
||||
<ReferenceOutputAssembly>true</ReferenceOutputAssembly>
|
||||
</Reference>
|
||||
<Reference Include="System.Xml">
|
||||
<CopyLocalSatelliteAssemblies>true</CopyLocalSatelliteAssemblies>
|
||||
<ReferenceOutputAssembly>true</ReferenceOutputAssembly>
|
||||
</Reference>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="..\..\ModLoader\source\modLoader.cpp" />
|
||||
<ClCompile Include="source\t2api.cpp" />
|
||||
<ClCompile Include="source\t2dll.cpp" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="include\modLoader.h" />
|
||||
<ClInclude Include="include\t2api.h" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
||||
<ImportGroup Label="ExtensionTargets">
|
||||
</ImportGroup>
|
||||
</Project>
|
||||
|
|
@ -1,30 +0,0 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<ItemGroup>
|
||||
<Filter Include="Source">
|
||||
<UniqueIdentifier>{47c39120-a88e-47c4-b0a8-4bf738d54a5c}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="Include">
|
||||
<UniqueIdentifier>{9cb2992f-6959-4153-a4c4-d9ea4d86347d}</UniqueIdentifier>
|
||||
</Filter>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="include\t2api.h">
|
||||
<Filter>Include</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="include\modLoader.h">
|
||||
<Filter>Include</Filter>
|
||||
</ClInclude>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="source\t2api.cpp">
|
||||
<Filter>Source</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="source\t2dll.cpp">
|
||||
<Filter>Source</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\ModLoader\source\modLoader.cpp">
|
||||
<Filter>Source</Filter>
|
||||
</ClCompile>
|
||||
</ItemGroup>
|
||||
</Project>
|
||||
20
ModLoader/Modloader.sln
Normal file
20
ModLoader/Modloader.sln
Normal file
|
|
@ -0,0 +1,20 @@
|
|||
|
||||
Microsoft Visual Studio Solution File, Format Version 11.00
|
||||
# Visual C++ Express 2010
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Modloader", "Modloader\Modloader.vcxproj", "{10159605-BFF5-496F-8C23-0A1FB9850E55}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|Win32 = Debug|Win32
|
||||
Release|Win32 = Release|Win32
|
||||
EndGlobalSection
|
||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||
{10159605-BFF5-496F-8C23-0A1FB9850E55}.Debug|Win32.ActiveCfg = Debug|Win32
|
||||
{10159605-BFF5-496F-8C23-0A1FB9850E55}.Debug|Win32.Build.0 = Debug|Win32
|
||||
{10159605-BFF5-496F-8C23-0A1FB9850E55}.Release|Win32.ActiveCfg = Release|Win32
|
||||
{10159605-BFF5-496F-8C23-0A1FB9850E55}.Release|Win32.Build.0 = Release|Win32
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
EndGlobalSection
|
||||
EndGlobal
|
||||
BIN
ModLoader/Modloader.suo
Normal file
BIN
ModLoader/Modloader.suo
Normal file
Binary file not shown.
2
ModLoader/Modloader/Debug/Modloader.lastbuildstate
Normal file
2
ModLoader/Modloader/Debug/Modloader.lastbuildstate
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
#v4.0:v100
|
||||
Debug|Win32|C:\Users\Robert MacGregor\Documents\T2-CPP\ModLoader\|
|
||||
BIN
ModLoader/Modloader/Debug/vc100.idb
Normal file
BIN
ModLoader/Modloader/Debug/vc100.idb
Normal file
Binary file not shown.
90
ModLoader/Modloader/Modloader.vcxproj
Normal file
90
ModLoader/Modloader/Modloader.vcxproj
Normal file
|
|
@ -0,0 +1,90 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<ItemGroup Label="ProjectConfigurations">
|
||||
<ProjectConfiguration Include="Debug|Win32">
|
||||
<Configuration>Debug</Configuration>
|
||||
<Platform>Win32</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Release|Win32">
|
||||
<Configuration>Release</Configuration>
|
||||
<Platform>Win32</Platform>
|
||||
</ProjectConfiguration>
|
||||
</ItemGroup>
|
||||
<PropertyGroup Label="Globals">
|
||||
<ProjectGuid>{10159605-BFF5-496F-8C23-0A1FB9850E55}</ProjectGuid>
|
||||
<Keyword>Win32Proj</Keyword>
|
||||
<RootNamespace>Modloader</RootNamespace>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
|
||||
<ConfigurationType>DynamicLibrary</ConfigurationType>
|
||||
<UseDebugLibraries>true</UseDebugLibraries>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
|
||||
<ConfigurationType>DynamicLibrary</ConfigurationType>
|
||||
<UseDebugLibraries>false</UseDebugLibraries>
|
||||
<WholeProgramOptimization>true</WholeProgramOptimization>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
|
||||
<ImportGroup Label="ExtensionSettings">
|
||||
</ImportGroup>
|
||||
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<PropertyGroup Label="UserMacros" />
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<LinkIncremental>false</LinkIncremental>
|
||||
<IncludePath>include;$(IncludePath)</IncludePath>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<LinkIncremental>false</LinkIncremental>
|
||||
</PropertyGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<ClCompile>
|
||||
<PrecompiledHeader>
|
||||
</PrecompiledHeader>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<Optimization>Disabled</Optimization>
|
||||
<PreprocessorDefinitions>WIN32;_DEBUG;_WINDOWS;_USRDLL;MODLOADER_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<SubSystem>Windows</SubSystem>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<ClCompile>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<PrecompiledHeader>
|
||||
</PrecompiledHeader>
|
||||
<Optimization>MaxSpeed</Optimization>
|
||||
<FunctionLevelLinking>true</FunctionLevelLinking>
|
||||
<IntrinsicFunctions>true</IntrinsicFunctions>
|
||||
<PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;_USRDLL;MODLOADER_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<SubSystem>Windows</SubSystem>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
||||
<OptimizeReferences>true</OptimizeReferences>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="source\modLoader.cpp" />
|
||||
<ClCompile Include="source\t2api.cpp" />
|
||||
<ClCompile Include="source\t2dll.cpp" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="include\modLoader.h" />
|
||||
<ClInclude Include="include\stdafx.h" />
|
||||
<ClInclude Include="include\t2api.h" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
||||
<ImportGroup Label="ExtensionTargets">
|
||||
</ImportGroup>
|
||||
</Project>
|
||||
39
ModLoader/Modloader/Modloader.vcxproj.filters
Normal file
39
ModLoader/Modloader/Modloader.vcxproj.filters
Normal file
|
|
@ -0,0 +1,39 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<ItemGroup>
|
||||
<Filter Include="Source Files">
|
||||
<UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier>
|
||||
<Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions>
|
||||
</Filter>
|
||||
<Filter Include="Header Files">
|
||||
<UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier>
|
||||
<Extensions>h;hpp;hxx;hm;inl;inc;xsd</Extensions>
|
||||
</Filter>
|
||||
<Filter Include="Resource Files">
|
||||
<UniqueIdentifier>{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}</UniqueIdentifier>
|
||||
<Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms</Extensions>
|
||||
</Filter>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="source\modLoader.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="source\t2api.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="source\t2dll.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="include\modLoader.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="include\t2api.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="include\stdafx.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
</ItemGroup>
|
||||
</Project>
|
||||
3
ModLoader/Modloader/Modloader.vcxproj.user
Normal file
3
ModLoader/Modloader/Modloader.vcxproj.user
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
</Project>
|
||||
8
ModLoader/Modloader/include/stdafx.h
Normal file
8
ModLoader/Modloader/include/stdafx.h
Normal file
|
|
@ -0,0 +1,8 @@
|
|||
//
|
||||
#include <Windows.h>
|
||||
#include <string>
|
||||
#include <unordered_set>
|
||||
|
||||
typedef void (*ServerProcessPointer)(unsigned int);
|
||||
|
||||
void serverProcessReplacement(unsigned int timeDelta);
|
||||
220
ModLoader/include/t2api.h → ModLoader/Modloader/include/t2api.h
Executable file → Normal file
220
ModLoader/include/t2api.h → ModLoader/Modloader/include/t2api.h
Executable file → Normal file
|
|
@ -1,111 +1,111 @@
|
|||
#pragma once
|
||||
|
||||
#include <string.h>
|
||||
|
||||
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 <string.h>
|
||||
|
||||
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);
|
||||
|
|
@ -5,6 +5,27 @@
|
|||
#include "stdafx.h"
|
||||
#include <t2api.h>
|
||||
|
||||
static std::tr1::unordered_set<ServerProcessPointer> sServerProcessResponders;
|
||||
|
||||
void serverProcessReplacement(unsigned int timeDelta)
|
||||
{
|
||||
unsigned int servertickaddr=0x602350;
|
||||
unsigned int serverthisptr=0x9E5EC0;
|
||||
|
||||
for (auto it = sServerProcessResponders.begin(); it != sServerProcessResponders.end(); it++)
|
||||
(*it)(timeDelta);
|
||||
|
||||
__asm
|
||||
{
|
||||
mov ecx,serverthisptr
|
||||
push timeDelta
|
||||
call servertickaddr
|
||||
}
|
||||
|
||||
return;
|
||||
|
||||
}
|
||||
|
||||
// Mod Loader Implementation
|
||||
bool conLoadMod(SimObject *obj,S32 argc, const char* argv[])
|
||||
{
|
||||
|
|
@ -35,5 +56,15 @@ bool conLoadMod(SimObject *obj,S32 argc, const char* argv[])
|
|||
|
||||
lpInitMod();
|
||||
Con::errorf(0, "loadMod(): Loaded and executed entry point code for mod DLL '%s'", raw.c_str());
|
||||
|
||||
// Check if there's a server process responder in this DLL
|
||||
ServerProcessPointer serverProcess = (ServerProcessPointer)GetProcAddress(hDLL, "ServerProcess"); // Attempt to load our entry point
|
||||
|
||||
if (serverProcess != NULL)
|
||||
{
|
||||
sServerProcessResponders.insert(sServerProcessResponders.end(), serverProcess);
|
||||
Con::errorf(0, "loadMod(): Added server process responder for mod");
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
178
ModLoader/source/t2api.cpp → ModLoader/Modloader/source/t2api.cpp
Executable file → Normal file
178
ModLoader/source/t2api.cpp → ModLoader/Modloader/source/t2api.cpp
Executable file → Normal file
|
|
@ -1,89 +1,89 @@
|
|||
#include <t2api.h>
|
||||
|
||||
SimIdDictionary* gIdDictionary = reinterpret_cast<SimIdDictionary*>(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;
|
||||
}
|
||||
}
|
||||
|
||||
void (*someTest)(void) =
|
||||
(void (__cdecl *)(void))
|
||||
0x4FD9B3;
|
||||
|
||||
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<SimIdDictionary*>(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;
|
||||
}
|
||||
}
|
||||
|
||||
void (*someTest)(void) =
|
||||
(void (__cdecl *)(void))
|
||||
0x4FD9B3;
|
||||
|
||||
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;
|
||||
120
ModLoader/source/t2dll.cpp → ModLoader/Modloader/source/t2dll.cpp
Executable file → Normal file
120
ModLoader/source/t2dll.cpp → ModLoader/Modloader/source/t2dll.cpp
Executable file → Normal file
|
|
@ -1,49 +1,71 @@
|
|||
/*
|
||||
* t2dll.cpp
|
||||
* Original code by Linker
|
||||
* Modified by Robert MacGregor
|
||||
*/
|
||||
|
||||
#include <winsdkver.h>
|
||||
#include <Windows.h>
|
||||
|
||||
#include <t2api.h>
|
||||
#include <modLoader.h>
|
||||
|
||||
BOOL APIENTRY DllMain( HMODULE hModule,
|
||||
DWORD ul_reason_for_call,
|
||||
LPVOID lpReserved
|
||||
)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
__declspec(dllexport) void initT2Dll(void)
|
||||
{
|
||||
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));
|
||||
|
||||
// Mod Loader Function
|
||||
Con::addMethodB(NULL, "loadMod", &conLoadMod, "Loads a C++ modification.",2,2);
|
||||
|
||||
// Load the original TribesNext DLL if available
|
||||
typedef void (*LPINITT2DLL)(void);
|
||||
HINSTANCE hDLL = NULL;
|
||||
LPINITT2DLL lpinitT2DLL = NULL;
|
||||
hDLL = LoadLibrary(L"tribesnext.dll"); // AfxLoadLibrary is probably better.
|
||||
|
||||
if (hDLL == NULL)
|
||||
return; // The DLL doesn't exist
|
||||
else
|
||||
lpinitT2DLL = (LPINITT2DLL)GetProcAddress(hDLL, "_Z9initT2Dllv"); // Attempt to load our entry point
|
||||
|
||||
if (lpinitT2DLL == NULL)
|
||||
return; // Unable to load entry point
|
||||
else
|
||||
lpinitT2DLL(); // The function was loaded, call TribesNext and move on to postTN Startup
|
||||
}
|
||||
|
||||
#ifdef _MANAGED
|
||||
#pragma managed(pop)
|
||||
#endif
|
||||
|
||||
/*
|
||||
* t2dll.cpp
|
||||
* Original code by Linker
|
||||
* Modified by Robert MacGregor
|
||||
*/
|
||||
|
||||
#include <stdafx.h>
|
||||
|
||||
#include <t2api.h>
|
||||
#include <modLoader.h>
|
||||
|
||||
#include <unordered_set>
|
||||
|
||||
#define endian(hex) (((hex & 0x000000FF) << 24)+((hex & 0x0000FF00) << 8)+((hex & 0x00FF0000)>>8)+((hex & 0xFF000000) >> 24))
|
||||
|
||||
BOOL APIENTRY DllMain( HMODULE hModule,
|
||||
DWORD ul_reason_for_call,
|
||||
LPVOID lpReserved
|
||||
)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
const char* congetServPAddr(SimObject *obj, S32 argc, const char *argv[])
|
||||
{
|
||||
char test[256] = "";
|
||||
char test2[256]="";
|
||||
int spr=(signed int)*serverProcessReplacement;
|
||||
sprintf(test2,"B8%08XFFD089EC5DC3",endian(spr));
|
||||
/*test2[0]=test[6];
|
||||
test2[1]=test[7];
|
||||
test2[2]=test[4];
|
||||
test2[3]=test[5];
|
||||
test2[4]=test[2];
|
||||
test2[5]=test[3];
|
||||
test2[6]=test[0];
|
||||
test2[7]=test[1];
|
||||
test2[8]=0;*/
|
||||
return test2;
|
||||
}
|
||||
|
||||
__declspec(dllexport) void initT2Dll(void)
|
||||
{
|
||||
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));
|
||||
|
||||
// Mod Loader Function
|
||||
Con::addMethodB(NULL, "loadMod", &conLoadMod, "Loads a C++ modification.",2,2);
|
||||
Con::addMethodS(NULL, "getServPAddr",&congetServPAddr,"Gets the memPatch data for ServerProcess",1,1);
|
||||
|
||||
// Load the original TribesNext DLL if available
|
||||
typedef void (*LPINITT2DLL)(void);
|
||||
HINSTANCE hDLL = NULL;
|
||||
LPINITT2DLL lpinitT2DLL = NULL;
|
||||
hDLL = LoadLibrary(L"tribesnext.dll"); // AfxLoadLibrary is probably better.
|
||||
|
||||
if (hDLL == NULL)
|
||||
return; // The DLL doesn't exist
|
||||
else
|
||||
lpinitT2DLL = (LPINITT2DLL)GetProcAddress(hDLL, "_Z9initT2Dllv"); // Attempt to load our entry point
|
||||
|
||||
if (lpinitT2DLL == NULL)
|
||||
return; // Unable to load entry point
|
||||
else
|
||||
lpinitT2DLL(); // The function was loaded, call TribesNext and move on to postTN Startup
|
||||
}
|
||||
|
||||
#ifdef _MANAGED
|
||||
#pragma managed(pop)
|
||||
#endif
|
||||
|
||||
Loading…
Add table
Add a link
Reference in a new issue