Remove XapiInitProcess HLE as we are very close to not requiring this patch

This commit is contained in:
Luke Usher 2016-08-19 21:57:37 +01:00
parent 462d8b34e2
commit adc1ec539a
18 changed files with 0 additions and 330 deletions

View File

@ -812,48 +812,6 @@ BOOL WINAPI XTL::EmuGetExitCodeThread
return bRet; return bRet;
} }
// ******************************************************************
// * func: EmuXapiInitProcess
// ******************************************************************
VOID WINAPI XTL::EmuXapiInitProcess()
{
EmuSwapFS(); // Win2k/XP FS
DbgPrintf("EmuXapi (0x%X): EmuXapiInitProcess();\n", GetCurrentThreadId());
// call RtlCreateHeap
{
RTL_HEAP_PARAMETERS HeapParameters;
ZeroMemory(&HeapParameters, sizeof(HeapParameters));
HeapParameters.Length = sizeof(HeapParameters);
EmuSwapFS(); // XBox FS
uint32 dwPeHeapReserve = CxbxKrnl_XbeHeader->dwPeHeapReserve;
uint32 dwPeHeapCommit = CxbxKrnl_XbeHeader->dwPeHeapCommit;
PVOID dwResult = 0;
#define HEAP_GROWABLE 0x00000002
*XTL::EmuXapiProcessHeap = XTL::g_pRtlCreateHeap(HEAP_GROWABLE, 0, dwPeHeapReserve, dwPeHeapCommit, NULL, &HeapParameters);
}
return;
}
// ******************************************************************
// * data: EmuXapiProcessHeap
// ******************************************************************
PVOID* XTL::EmuXapiProcessHeap;
// ******************************************************************
// * func: g_pRtlCreateHeap
// ******************************************************************
XTL::pfRtlCreateHeap XTL::g_pRtlCreateHeap;
// ****************************************************************** // ******************************************************************
// * func: EmuXapiThreadStartup // * func: EmuXapiThreadStartup
// ****************************************************************** // ******************************************************************

View File

@ -556,21 +556,6 @@ BOOL WINAPI EmuGetExitCodeThread
LPDWORD lpExitCode LPDWORD lpExitCode
); );
// ******************************************************************
// * func: EmuXapiInitProcess
// ******************************************************************
VOID WINAPI EmuXapiInitProcess();
// ******************************************************************
// * data: EmuXapiProcessHeap
// ******************************************************************
extern PVOID* EmuXapiProcessHeap;
// ******************************************************************
// * func: g_pRtlCreateHeap
// ******************************************************************
extern pfRtlCreateHeap g_pRtlCreateHeap;
// ****************************************************************** // ******************************************************************
// * func: EmuXapiThreadStartup // * func: EmuXapiThreadStartup
// ****************************************************************** // ******************************************************************

View File

@ -36,8 +36,6 @@
#include "OOVPA.h" #include "OOVPA.h"
extern SOOVPA<7> XapiInitProcess_1_0_3911;
extern SOOVPA<7> XapiInitProcess_1_0_3950;
extern OOVPATable XAPI_1_0_3911[]; extern OOVPATable XAPI_1_0_3911[];
extern uint32 XAPI_1_0_3911_SIZE; extern uint32 XAPI_1_0_3911_SIZE;

View File

@ -1718,27 +1718,6 @@ OOVPATable XAPI_1_0_3911[] =
"EmuSetThreadPriority" "EmuSetThreadPriority"
#endif #endif
}, },
//* Too High Level
// XapiInitProcess
{
(OOVPA*)&XapiInitProcess_1_0_3911,
XTL::EmuXapiInitProcess,
#ifdef _DEBUG_TRACE
"EmuXapiInitProcess"
#endif
},
// XapiInitProcess
{
(OOVPA*)&XapiInitProcess_1_0_3950,
XTL::EmuXapiInitProcess,
#ifdef _DEBUG_TRACE
"EmuXapiInitProcess (3950)"
#endif
},
//*/ //*/
// GetTimeZoneInformation // GetTimeZoneInformation
{ {

View File

@ -279,17 +279,6 @@ OOVPATable XAPI_1_0_4034[] =
#endif #endif
}, },
*/ */
//* Too High Level
// XapiInitProcess (* unchanged since 1.0.3911 *)
{
(OOVPA*)&XapiInitProcess_1_0_3911,
XTL::EmuXapiInitProcess,
#ifdef _DEBUG_TRACE
"EmuXapiInitProcess"
#endif
},
//*/ //*/
// XapiBootToDash (* unchanged since 1.0.3911 *) // XapiBootToDash (* unchanged since 1.0.3911 *)
{ {

View File

@ -511,17 +511,6 @@ OOVPATable XAPI_1_0_4134[] =
"EmuXInitDevices" "EmuXInitDevices"
#endif #endif
}, },
//* Too High Level
// XapiInitProcess (* unchanged since 3911 *)
{
(OOVPA*)&XapiInitProcess_1_0_3911,
XTL::EmuXapiInitProcess,
#ifdef _DEBUG_TRACE
"EmuXapiInitProcess"
#endif
},
//*/ //*/
// SetThreadPriority (* unchanged since 3911 *) // SetThreadPriority (* unchanged since 3911 *)
{ {

View File

@ -36,7 +36,6 @@
#include "OOVPA.h" #include "OOVPA.h"
extern SOOVPA<7> XapiInitProcess_1_0_4361;
extern OOVPATable XAPI_1_0_4361[]; extern OOVPATable XAPI_1_0_4361[];
extern uint32 XAPI_1_0_4361_SIZE; extern uint32 XAPI_1_0_4361_SIZE;

View File

@ -698,17 +698,6 @@ OOVPATable XAPI_1_0_4361[] =
"EmuXInputSetState" "EmuXInputSetState"
#endif #endif
}, },
//* Too High Level
// XapiInitProcess
{
(OOVPA*)&XapiInitProcess_1_0_4361,
XTL::EmuXapiInitProcess,
#ifdef _DEBUG_TRACE
"EmuXapiInitProcess"
#endif
},
//*/ //*/
/* /*
// XapiThreadStartup // XapiThreadStartup

View File

@ -181,17 +181,6 @@ OOVPATable XAPI_1_0_4432[] =
#endif #endif
}, },
//*/ //*/
//* Too High Level
// XapiInitProcess (* unchanged since 1.0.4361 *)
{
(OOVPA*)&XapiInitProcess_1_0_4361,
XTL::EmuXapiInitProcess,
#ifdef _DEBUG_TRACE
"EmuXapiInitProcess"
#endif
},
//*/ //*/
// XapiBootToDash (* unchanged since 1.0.3911 *) // XapiBootToDash (* unchanged since 1.0.3911 *)
{ {

View File

@ -36,9 +36,6 @@
#include "OOVPA.h" #include "OOVPA.h"
extern SOOVPA<7> XapiInitProcess_1_0_4831;
extern SOOVPA<7> XapiInitProcess_1_0_4928;
extern SOOVPA<7> XapiInitProcess_1_0_5028;
extern OOVPATable XAPI_1_0_4627[]; extern OOVPATable XAPI_1_0_4627[];
extern uint32 XAPI_1_0_4627_SIZE; extern uint32 XAPI_1_0_4627_SIZE;

View File

@ -1235,36 +1235,6 @@ OOVPATable XAPI_1_0_4627[] =
"EmuXapiApplyKernelPatches" "EmuXapiApplyKernelPatches"
#endif #endif
}, },
// XapiInitProcess
{
(OOVPA*)&XapiInitProcess_1_0_4928,
XTL::EmuXapiInitProcess,
#ifdef _DEBUG_TRACE
"EmuXapiInitProcess"
#endif
},
// XapiInitProcess
{
(OOVPA*)&XapiInitProcess_1_0_4831,
XTL::EmuXapiInitProcess,
#ifdef _DEBUG_TRACE
"EmuXapiInitProcess (4831)"
#endif
},
// XapiInitProcess
{
(OOVPA*)&XapiInitProcess_1_0_5028,
XTL::EmuXapiInitProcess,
#ifdef _DEBUG_TRACE
"EmuXapiInitProcess (5028)"
#endif
},
// XFormatUtilityDrive // XFormatUtilityDrive
{ {
(OOVPA*)&XFormatUtilityDrive_1_0_4627, (OOVPA*)&XFormatUtilityDrive_1_0_4627,
@ -1523,17 +1493,6 @@ OOVPATable XAPI_1_0_4627[] =
#endif #endif
}, },
//*/ //*/
//* Too High Level
// XapiInitProcess (* unchanged since 1.0.4361 *)
{
(OOVPA*)&XapiInitProcess_1_0_4361,
XTL::EmuXapiInitProcess,
#ifdef _DEBUG_TRACE
"EmuXapiInitProcess"
#endif
},
//*/ //*/
// XapiBootToDash (* unchanged since 1.0.3911 *) // XapiBootToDash (* unchanged since 1.0.3911 *)
{ {

View File

@ -36,8 +36,6 @@
#include "OOVPA.h" #include "OOVPA.h"
extern SOOVPA<7> XapiInitProcess_1_0_5233;
extern SOOVPA<8> XapiInitProcess_1_0_5344;
extern OOVPATable XAPI_1_0_5233[]; extern OOVPATable XAPI_1_0_5233[];
extern uint32 XAPI_1_0_5233_SIZE; extern uint32 XAPI_1_0_5233_SIZE;

View File

@ -234,26 +234,6 @@ OOVPATable XAPI_1_0_5233[] =
"EmuXapiApplyKernelPatches" "EmuXapiApplyKernelPatches"
#endif #endif
}, },
// XapiInitProcess
{
(OOVPA*)&XapiInitProcess_1_0_5233,
XTL::EmuXapiInitProcess,
#ifdef _DEBUG_TRACE
"EmuXapiInitProcess"
#endif
},
// XapiInitProcess
{
(OOVPA*)&XapiInitProcess_1_0_5344,
XTL::EmuXapiInitProcess,
#ifdef _DEBUG_TRACE
"EmuXapiInitProcess (5344)"
#endif
},
// GetTimeZoneInformation (* unchanged since 3911 *) // GetTimeZoneInformation (* unchanged since 3911 *)
{ {
(OOVPA*)&GetTimeZoneInformation_1_0_3911, (OOVPA*)&GetTimeZoneInformation_1_0_3911,

View File

@ -36,8 +36,6 @@
#include "OOVPA.h" #include "OOVPA.h"
extern SOOVPA<8> XapiInitProcess_1_0_5558;
extern SOOVPA<8> XapiInitProcess_1_0_5659;
extern OOVPATable XAPI_1_0_5558[]; extern OOVPATable XAPI_1_0_5558[];
extern uint32 XAPI_1_0_5558_SIZE; extern uint32 XAPI_1_0_5558_SIZE;

View File

@ -629,26 +629,6 @@ OOVPATable XAPI_1_0_5558[] =
#endif #endif
}, },
//*/ //*/
// XapiInitProcess
{
(OOVPA*)&XapiInitProcess_1_0_5558,
XTL::EmuXapiInitProcess,
#ifdef _DEBUG_TRACE
"EmuXapiInitProcess"
#endif
},
// XapiInitProcess
{
(OOVPA*)&XapiInitProcess_1_0_5659,
XTL::EmuXapiInitProcess,
#ifdef _DEBUG_TRACE
"EmuXapiInitProcess"
#endif
},
// XapiBootToDash (* unchanged since 1.0.3911 *) // XapiBootToDash (* unchanged since 1.0.3911 *)
{ {
(OOVPA*)&XapiBootDash_1_0_3911, (OOVPA*)&XapiBootDash_1_0_3911,

View File

@ -36,7 +36,6 @@
#include "OOVPA.h" #include "OOVPA.h"
extern SOOVPA<8> XapiInitProcess_1_0_5849;
extern OOVPATable XAPI_1_0_5849[]; extern OOVPATable XAPI_1_0_5849[];
extern uint32 XAPI_1_0_5849_SIZE; extern uint32 XAPI_1_0_5849_SIZE;

View File

@ -333,16 +333,6 @@ OOVPATable XAPI_1_0_5849[] =
#endif #endif
}, },
//*/ //*/
// XapiInitProcess
{
(OOVPA*)&XapiInitProcess_1_0_5849,
XTL::EmuXapiInitProcess,
#ifdef _DEBUG_TRACE
"EmuXapiInitProcess"
#endif
},
// XapiBootToDash (* unchanged since 1.0.3911 *) // XapiBootToDash (* unchanged since 1.0.3911 *)
{ {
(OOVPA*)&XapiBootDash_1_0_3911, (OOVPA*)&XapiBootDash_1_0_3911,

View File

@ -320,112 +320,6 @@ void EmuHLEIntercept(Xbe::LibraryVersion *pLibraryVersion, Xbe::Header *pXbeHead
{ {
uint32 lower = pXbeHeader->dwBaseAddr; uint32 lower = pXbeHeader->dwBaseAddr;
uint32 upper = pXbeHeader->dwBaseAddr + pXbeHeader->dwSizeofImage; uint32 upper = pXbeHeader->dwBaseAddr + pXbeHeader->dwSizeofImage;
// locate XapiProcessHeap
{
void *pFunc = 0;
uint ProcessHeapOffs;
uint RtlCreateHeapOffs;
if(BuildVersion >= 5849)
{
pFunc = EmuLocateFunction((OOVPA*)&XapiInitProcess_1_0_5849, lower, upper);
ProcessHeapOffs = 0x51;
RtlCreateHeapOffs = 0x4A;
}
else if(BuildVersion >= 5558)
{
pFunc = EmuLocateFunction((OOVPA*)&XapiInitProcess_1_0_5558, lower, upper);
// 5659 has an updated function
if(pFunc == 0)
{
pFunc = EmuLocateFunction((OOVPA*)&XapiInitProcess_1_0_5659, lower, upper);
}
ProcessHeapOffs = 0x51;
RtlCreateHeapOffs = 0x4A;
}
else if(BuildVersion >= 5233)
{
// 5344 has an updated version
if(OrigBuildVersion == 5344)
{
pFunc = EmuLocateFunction((OOVPA*)&XapiInitProcess_1_0_5344, lower, upper);
}
else
{
pFunc = EmuLocateFunction((OOVPA*)&XapiInitProcess_1_0_5233, lower, upper);
}
ProcessHeapOffs = 0x51;
RtlCreateHeapOffs = 0x4A;
}
else if(BuildVersion >= 4361)
{
if(OrigBuildVersion == 4928 || OrigBuildVersion == 4831)
{
pFunc = EmuLocateFunction((OOVPA*)&XapiInitProcess_1_0_4928, lower, upper);
if( pFunc == 0 )
{
pFunc = EmuLocateFunction((OOVPA*)&XapiInitProcess_1_0_4831, lower, upper);
}
ProcessHeapOffs = 0x44;
RtlCreateHeapOffs = 0x3B;
}
else if(OrigBuildVersion == 5028)
{
pFunc = EmuLocateFunction((OOVPA*)&XapiInitProcess_1_0_5028, lower, upper);
ProcessHeapOffs = 0x51;
RtlCreateHeapOffs = 0x4A;
}
else
{
pFunc = EmuLocateFunction((OOVPA*)&XapiInitProcess_1_0_4361, lower, upper);
ProcessHeapOffs = 0x3E;
RtlCreateHeapOffs = 0x37;
}
}
/*else if( OrigBuildVersion == 3950 )
{
pFunc = EmuLocateFunction((OOVPA*)&XapiInitProcess_1_0_3950, lower, upper);
ProcessHeapOffs = 0x3E;
RtlCreateHeapOffs = 0x37;
}*/
else // 3911, 4034, 4134
{
pFunc = EmuLocateFunction((OOVPA*)&XapiInitProcess_1_0_3911, lower, upper);
ProcessHeapOffs = 0x3E;
RtlCreateHeapOffs = 0x37;
}
if(pFunc != 0)
{
XTL::EmuXapiProcessHeap = *(PVOID**)((uint32)pFunc + ProcessHeapOffs);
XTL::g_pRtlCreateHeap = *(XTL::pfRtlCreateHeap*)((uint32)pFunc + RtlCreateHeapOffs);
XTL::g_pRtlCreateHeap = (XTL::pfRtlCreateHeap)((uint32)pFunc + (uint32)XTL::g_pRtlCreateHeap + RtlCreateHeapOffs + 0x04);
DbgPrintf("HLE: 0x%.08X -> EmuXapiProcessHeap\n", XTL::EmuXapiProcessHeap);
DbgPrintf("HLE: 0x%.08X -> g_pRtlCreateHeap\n", XTL::g_pRtlCreateHeap);
}
else if( OrigBuildVersion == 3950 )
{
// This library doesn't appear to have XapiInitProcess.
// So far, only the Halo demo uses this XDK library version.
// TODO: Don't use hard coded values in case other games using this library
// version are discovered. You can get XapiProcessHeap from LocalFree+0x7.
XTL::EmuXapiProcessHeap = (PVOID*)(0x2D9758);
XTL::g_pRtlCreateHeap = (XTL::pfRtlCreateHeap)(0x164FC);
DbgPrintf("HLE: 0x%.08X -> EmuXapiProcessHeap\n", XTL::EmuXapiProcessHeap);
DbgPrintf("HLE: 0x%.08X -> g_pRtlCreateHeap\n", XTL::g_pRtlCreateHeap);
}
}
} }
else if(strcmp("D3D8", szLibraryName) == 0 /*&& strcmp("D3D8LTCG", szOrigLibraryName)*/ && else if(strcmp("D3D8", szLibraryName) == 0 /*&& strcmp("D3D8LTCG", szOrigLibraryName)*/ &&
MajorVersion == 1 && MinorVersion == 0 && MajorVersion == 1 && MinorVersion == 0 &&