mirror of
https://github.com/CookiePLMonster/SilentPatch.git
synced 2024-11-25 06:42:29 +01:00
Add RWGTA - wrappers for III/VC RW where macros would be used in SA
This commit is contained in:
parent
77140a8ef6
commit
df012b84cf
36
SilentPatch/RWGTA.cpp
Normal file
36
SilentPatch/RWGTA.cpp
Normal file
@ -0,0 +1,36 @@
|
||||
#include "RWGTA.h"
|
||||
|
||||
#include "Utils/MemoryMgr.h"
|
||||
#include "Utils/Patterns.h"
|
||||
|
||||
#include <rwcore.h>
|
||||
|
||||
// GTA versions of RenderWare functions/macros for GTA III/Vice City
|
||||
// since we cannot use RwEngineInstance directly
|
||||
|
||||
// Anything originally using RwEngineInstance shall be redefined here
|
||||
// Functions which RW 3.6 inlined can also easily be defined here
|
||||
|
||||
void** GTARwEngineInstance = []() -> void** {
|
||||
// Thanks Steam III...
|
||||
|
||||
// Locate RwRenderStateSet
|
||||
auto renderStateSetPtr = hook::get_pattern( "D1 7C 24 2C", 4 );
|
||||
auto renderStateSet = reinterpret_cast<uintptr_t>(Memory::ReadCallFrom( renderStateSetPtr ));
|
||||
|
||||
// Test III 1.0/1.1/VC
|
||||
if ( *reinterpret_cast<uint8_t*>(renderStateSet) == 0xA1 )
|
||||
{
|
||||
return *reinterpret_cast<void***>(renderStateSet + 1);
|
||||
}
|
||||
|
||||
// Test III Steam
|
||||
renderStateSet += 3;
|
||||
if ( *reinterpret_cast<uint8_t*>(renderStateSet) == 0xA1 )
|
||||
{
|
||||
return *reinterpret_cast<void***>(renderStateSet + 1);
|
||||
}
|
||||
|
||||
assert(!"Could not locate RwEngineInstance!");
|
||||
return nullptr;
|
||||
}();
|
12
SilentPatch/RWGTA.h
Normal file
12
SilentPatch/RWGTA.h
Normal file
@ -0,0 +1,12 @@
|
||||
#pragma once
|
||||
|
||||
// GTA versions of RenderWare functions/macros for GTA III/Vice City
|
||||
// since we cannot use RwEngineInstance directly
|
||||
|
||||
// Anything originally using RwEngineInstance shall be redefined here
|
||||
|
||||
extern void** GTARwEngineInstance;
|
||||
|
||||
/* macro used to access global data structure (the root type is RwGlobals) */
|
||||
#define GTARWSRCGLOBAL(variable) \
|
||||
(((RwGlobals *)(*GTARwEngineInstance))->variable)
|
@ -25,6 +25,11 @@
|
||||
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Master|Win32'">NotUsing</PrecompiledHeader>
|
||||
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">NotUsing</PrecompiledHeader>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\SilentPatch\RWGTA.cpp">
|
||||
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">NotUsing</PrecompiledHeader>
|
||||
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Master|Win32'">NotUsing</PrecompiledHeader>
|
||||
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">NotUsing</PrecompiledHeader>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\SilentPatch\StoredCar.cpp" />
|
||||
<ClCompile Include="..\SilentPatch\Timer.cpp" />
|
||||
<ClCompile Include="..\SilentPatch\Utils\Patterns.cpp">
|
||||
@ -44,6 +49,7 @@
|
||||
<ClInclude Include="..\SilentPatch\Common_ddraw.h" />
|
||||
<ClInclude Include="..\SilentPatch\debugmenu_public.h" />
|
||||
<ClInclude Include="..\SilentPatch\General.h" />
|
||||
<ClInclude Include="..\SilentPatch\RWGTA.h" />
|
||||
<ClInclude Include="..\SilentPatch\StdAfx.h" />
|
||||
<ClInclude Include="..\SilentPatch\StoredCar.h" />
|
||||
<ClInclude Include="..\SilentPatch\Timer.h" />
|
||||
|
@ -42,6 +42,9 @@
|
||||
<ClCompile Include="..\SilentPatch\Utils\Patterns.cpp">
|
||||
<Filter>Source Files\Utils</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\SilentPatch\RWGTA.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="..\SilentPatch\Timer.h">
|
||||
@ -77,6 +80,9 @@
|
||||
<ClInclude Include="..\SilentPatch\debugmenu_public.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\SilentPatch\RWGTA.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ResourceCompile Include="..\SilentPatch\SilentPatch.rc">
|
||||
|
@ -174,6 +174,7 @@
|
||||
<ClInclude Include="..\SilentPatch\Common_ddraw.h" />
|
||||
<ClInclude Include="..\SilentPatch\debugmenu_public.h" />
|
||||
<ClInclude Include="..\SilentPatch\General.h" />
|
||||
<ClInclude Include="..\SilentPatch\RWGTA.h" />
|
||||
<ClInclude Include="..\SilentPatch\StdAfx.h" />
|
||||
<ClInclude Include="..\SilentPatch\StoredCar.h" />
|
||||
<ClInclude Include="..\SilentPatch\Timer.h" />
|
||||
@ -194,6 +195,11 @@
|
||||
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Master|Win32'">NotUsing</PrecompiledHeader>
|
||||
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">NotUsing</PrecompiledHeader>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\SilentPatch\RWGTA.cpp">
|
||||
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">NotUsing</PrecompiledHeader>
|
||||
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Master|Win32'">NotUsing</PrecompiledHeader>
|
||||
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">NotUsing</PrecompiledHeader>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\SilentPatch\StoredCar.cpp" />
|
||||
<ClCompile Include="..\SilentPatch\Timer.cpp" />
|
||||
<ClCompile Include="..\SilentPatch\Utils\Patterns.cpp">
|
||||
|
@ -54,6 +54,9 @@
|
||||
<ClInclude Include="..\SilentPatch\debugmenu_public.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\SilentPatch\RWGTA.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="..\SilentPatch\Timer.cpp">
|
||||
@ -80,6 +83,9 @@
|
||||
<ClCompile Include="..\SilentPatch\Utils\Patterns.cpp">
|
||||
<Filter>Source Files\Utils</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\SilentPatch\RWGTA.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ResourceCompile Include="..\SilentPatch\SilentPatch.rc">
|
||||
|
Loading…
Reference in New Issue
Block a user