From adc1ec539a711e1912f2efb6d7f083aa3fa44eec Mon Sep 17 00:00:00 2001 From: Luke Usher Date: Fri, 19 Aug 2016 21:57:37 +0100 Subject: [PATCH] Remove XapiInitProcess HLE as we are very close to not requiring this patch --- src/CxbxKrnl/EmuXapi.cpp | 42 -------- src/CxbxKrnl/EmuXapi.h | 15 --- src/CxbxKrnl/HLEDataBase/Xapi.1.0.3911.h | 2 - src/CxbxKrnl/HLEDataBase/Xapi.1.0.3911.inl | 21 ---- src/CxbxKrnl/HLEDataBase/Xapi.1.0.4034.inl | 11 --- src/CxbxKrnl/HLEDataBase/Xapi.1.0.4134.inl | 11 --- src/CxbxKrnl/HLEDataBase/Xapi.1.0.4361.h | 1 - src/CxbxKrnl/HLEDataBase/Xapi.1.0.4361.inl | 11 --- src/CxbxKrnl/HLEDataBase/Xapi.1.0.4432.inl | 11 --- src/CxbxKrnl/HLEDataBase/Xapi.1.0.4627.h | 3 - src/CxbxKrnl/HLEDataBase/Xapi.1.0.4627.inl | 41 -------- src/CxbxKrnl/HLEDataBase/Xapi.1.0.5233.h | 2 - src/CxbxKrnl/HLEDataBase/Xapi.1.0.5233.inl | 20 ---- src/CxbxKrnl/HLEDataBase/Xapi.1.0.5558.h | 2 - src/CxbxKrnl/HLEDataBase/Xapi.1.0.5558.inl | 20 ---- src/CxbxKrnl/HLEDataBase/Xapi.1.0.5849.h | 1 - src/CxbxKrnl/HLEDataBase/Xapi.1.0.5849.inl | 10 -- src/CxbxKrnl/HLEIntercept.cpp | 106 --------------------- 18 files changed, 330 deletions(-) diff --git a/src/CxbxKrnl/EmuXapi.cpp b/src/CxbxKrnl/EmuXapi.cpp index b86dedfd9..68157dfd8 100644 --- a/src/CxbxKrnl/EmuXapi.cpp +++ b/src/CxbxKrnl/EmuXapi.cpp @@ -812,48 +812,6 @@ BOOL WINAPI XTL::EmuGetExitCodeThread 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 // ****************************************************************** diff --git a/src/CxbxKrnl/EmuXapi.h b/src/CxbxKrnl/EmuXapi.h index ff9f35cac..0a111b68e 100644 --- a/src/CxbxKrnl/EmuXapi.h +++ b/src/CxbxKrnl/EmuXapi.h @@ -556,21 +556,6 @@ BOOL WINAPI EmuGetExitCodeThread LPDWORD lpExitCode ); -// ****************************************************************** -// * func: EmuXapiInitProcess -// ****************************************************************** -VOID WINAPI EmuXapiInitProcess(); - -// ****************************************************************** -// * data: EmuXapiProcessHeap -// ****************************************************************** -extern PVOID* EmuXapiProcessHeap; - -// ****************************************************************** -// * func: g_pRtlCreateHeap -// ****************************************************************** -extern pfRtlCreateHeap g_pRtlCreateHeap; - // ****************************************************************** // * func: EmuXapiThreadStartup // ****************************************************************** diff --git a/src/CxbxKrnl/HLEDataBase/Xapi.1.0.3911.h b/src/CxbxKrnl/HLEDataBase/Xapi.1.0.3911.h index ba0f0cb05..696ebc956 100644 --- a/src/CxbxKrnl/HLEDataBase/Xapi.1.0.3911.h +++ b/src/CxbxKrnl/HLEDataBase/Xapi.1.0.3911.h @@ -36,8 +36,6 @@ #include "OOVPA.h" -extern SOOVPA<7> XapiInitProcess_1_0_3911; -extern SOOVPA<7> XapiInitProcess_1_0_3950; extern OOVPATable XAPI_1_0_3911[]; extern uint32 XAPI_1_0_3911_SIZE; diff --git a/src/CxbxKrnl/HLEDataBase/Xapi.1.0.3911.inl b/src/CxbxKrnl/HLEDataBase/Xapi.1.0.3911.inl index 774ac7ff5..4954cffd1 100644 --- a/src/CxbxKrnl/HLEDataBase/Xapi.1.0.3911.inl +++ b/src/CxbxKrnl/HLEDataBase/Xapi.1.0.3911.inl @@ -1718,27 +1718,6 @@ OOVPATable XAPI_1_0_3911[] = "EmuSetThreadPriority" #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 { diff --git a/src/CxbxKrnl/HLEDataBase/Xapi.1.0.4034.inl b/src/CxbxKrnl/HLEDataBase/Xapi.1.0.4034.inl index ad9c3d1db..a9748faa0 100644 --- a/src/CxbxKrnl/HLEDataBase/Xapi.1.0.4034.inl +++ b/src/CxbxKrnl/HLEDataBase/Xapi.1.0.4034.inl @@ -279,17 +279,6 @@ OOVPATable XAPI_1_0_4034[] = #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 *) { diff --git a/src/CxbxKrnl/HLEDataBase/Xapi.1.0.4134.inl b/src/CxbxKrnl/HLEDataBase/Xapi.1.0.4134.inl index 7a1b38f42..218000e2b 100644 --- a/src/CxbxKrnl/HLEDataBase/Xapi.1.0.4134.inl +++ b/src/CxbxKrnl/HLEDataBase/Xapi.1.0.4134.inl @@ -511,17 +511,6 @@ OOVPATable XAPI_1_0_4134[] = "EmuXInitDevices" #endif }, - //* Too High Level - // XapiInitProcess (* unchanged since 3911 *) - { - (OOVPA*)&XapiInitProcess_1_0_3911, - - XTL::EmuXapiInitProcess, - - #ifdef _DEBUG_TRACE - "EmuXapiInitProcess" - #endif - }, //*/ // SetThreadPriority (* unchanged since 3911 *) { diff --git a/src/CxbxKrnl/HLEDataBase/Xapi.1.0.4361.h b/src/CxbxKrnl/HLEDataBase/Xapi.1.0.4361.h index c4dec4bae..944c78bbe 100644 --- a/src/CxbxKrnl/HLEDataBase/Xapi.1.0.4361.h +++ b/src/CxbxKrnl/HLEDataBase/Xapi.1.0.4361.h @@ -36,7 +36,6 @@ #include "OOVPA.h" -extern SOOVPA<7> XapiInitProcess_1_0_4361; extern OOVPATable XAPI_1_0_4361[]; extern uint32 XAPI_1_0_4361_SIZE; diff --git a/src/CxbxKrnl/HLEDataBase/Xapi.1.0.4361.inl b/src/CxbxKrnl/HLEDataBase/Xapi.1.0.4361.inl index 0a5d6c00b..9c066117c 100644 --- a/src/CxbxKrnl/HLEDataBase/Xapi.1.0.4361.inl +++ b/src/CxbxKrnl/HLEDataBase/Xapi.1.0.4361.inl @@ -698,17 +698,6 @@ OOVPATable XAPI_1_0_4361[] = "EmuXInputSetState" #endif }, - //* Too High Level - // XapiInitProcess - { - (OOVPA*)&XapiInitProcess_1_0_4361, - - XTL::EmuXapiInitProcess, - - #ifdef _DEBUG_TRACE - "EmuXapiInitProcess" - #endif - }, //*/ /* // XapiThreadStartup diff --git a/src/CxbxKrnl/HLEDataBase/Xapi.1.0.4432.inl b/src/CxbxKrnl/HLEDataBase/Xapi.1.0.4432.inl index dd595fada..09720f70b 100644 --- a/src/CxbxKrnl/HLEDataBase/Xapi.1.0.4432.inl +++ b/src/CxbxKrnl/HLEDataBase/Xapi.1.0.4432.inl @@ -181,17 +181,6 @@ OOVPATable XAPI_1_0_4432[] = #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 *) { diff --git a/src/CxbxKrnl/HLEDataBase/Xapi.1.0.4627.h b/src/CxbxKrnl/HLEDataBase/Xapi.1.0.4627.h index e960511f6..f571aaba6 100644 --- a/src/CxbxKrnl/HLEDataBase/Xapi.1.0.4627.h +++ b/src/CxbxKrnl/HLEDataBase/Xapi.1.0.4627.h @@ -36,9 +36,6 @@ #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 uint32 XAPI_1_0_4627_SIZE; diff --git a/src/CxbxKrnl/HLEDataBase/Xapi.1.0.4627.inl b/src/CxbxKrnl/HLEDataBase/Xapi.1.0.4627.inl index 37118ea74..7a77d4407 100644 --- a/src/CxbxKrnl/HLEDataBase/Xapi.1.0.4627.inl +++ b/src/CxbxKrnl/HLEDataBase/Xapi.1.0.4627.inl @@ -1235,36 +1235,6 @@ OOVPATable XAPI_1_0_4627[] = "EmuXapiApplyKernelPatches" #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 { (OOVPA*)&XFormatUtilityDrive_1_0_4627, @@ -1523,17 +1493,6 @@ OOVPATable XAPI_1_0_4627[] = #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 *) { diff --git a/src/CxbxKrnl/HLEDataBase/Xapi.1.0.5233.h b/src/CxbxKrnl/HLEDataBase/Xapi.1.0.5233.h index c6e2d30e2..e8ad901fe 100644 --- a/src/CxbxKrnl/HLEDataBase/Xapi.1.0.5233.h +++ b/src/CxbxKrnl/HLEDataBase/Xapi.1.0.5233.h @@ -36,8 +36,6 @@ #include "OOVPA.h" -extern SOOVPA<7> XapiInitProcess_1_0_5233; -extern SOOVPA<8> XapiInitProcess_1_0_5344; extern OOVPATable XAPI_1_0_5233[]; extern uint32 XAPI_1_0_5233_SIZE; diff --git a/src/CxbxKrnl/HLEDataBase/Xapi.1.0.5233.inl b/src/CxbxKrnl/HLEDataBase/Xapi.1.0.5233.inl index 7e789d25d..72ac565a5 100644 --- a/src/CxbxKrnl/HLEDataBase/Xapi.1.0.5233.inl +++ b/src/CxbxKrnl/HLEDataBase/Xapi.1.0.5233.inl @@ -234,26 +234,6 @@ OOVPATable XAPI_1_0_5233[] = "EmuXapiApplyKernelPatches" #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 *) { (OOVPA*)&GetTimeZoneInformation_1_0_3911, diff --git a/src/CxbxKrnl/HLEDataBase/Xapi.1.0.5558.h b/src/CxbxKrnl/HLEDataBase/Xapi.1.0.5558.h index bf680ca74..2aae1c7bf 100644 --- a/src/CxbxKrnl/HLEDataBase/Xapi.1.0.5558.h +++ b/src/CxbxKrnl/HLEDataBase/Xapi.1.0.5558.h @@ -36,8 +36,6 @@ #include "OOVPA.h" -extern SOOVPA<8> XapiInitProcess_1_0_5558; -extern SOOVPA<8> XapiInitProcess_1_0_5659; extern OOVPATable XAPI_1_0_5558[]; extern uint32 XAPI_1_0_5558_SIZE; diff --git a/src/CxbxKrnl/HLEDataBase/Xapi.1.0.5558.inl b/src/CxbxKrnl/HLEDataBase/Xapi.1.0.5558.inl index c4c63ab24..2b7d45e1e 100644 --- a/src/CxbxKrnl/HLEDataBase/Xapi.1.0.5558.inl +++ b/src/CxbxKrnl/HLEDataBase/Xapi.1.0.5558.inl @@ -629,26 +629,6 @@ OOVPATable XAPI_1_0_5558[] = #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 *) { (OOVPA*)&XapiBootDash_1_0_3911, diff --git a/src/CxbxKrnl/HLEDataBase/Xapi.1.0.5849.h b/src/CxbxKrnl/HLEDataBase/Xapi.1.0.5849.h index 7242f9796..e80d57ed7 100644 --- a/src/CxbxKrnl/HLEDataBase/Xapi.1.0.5849.h +++ b/src/CxbxKrnl/HLEDataBase/Xapi.1.0.5849.h @@ -36,7 +36,6 @@ #include "OOVPA.h" -extern SOOVPA<8> XapiInitProcess_1_0_5849; extern OOVPATable XAPI_1_0_5849[]; extern uint32 XAPI_1_0_5849_SIZE; diff --git a/src/CxbxKrnl/HLEDataBase/Xapi.1.0.5849.inl b/src/CxbxKrnl/HLEDataBase/Xapi.1.0.5849.inl index d8bc9913c..3bd6db288 100644 --- a/src/CxbxKrnl/HLEDataBase/Xapi.1.0.5849.inl +++ b/src/CxbxKrnl/HLEDataBase/Xapi.1.0.5849.inl @@ -333,16 +333,6 @@ OOVPATable XAPI_1_0_5849[] = #endif }, //*/ - // XapiInitProcess - { - (OOVPA*)&XapiInitProcess_1_0_5849, - - XTL::EmuXapiInitProcess, - - #ifdef _DEBUG_TRACE - "EmuXapiInitProcess" - #endif - }, // XapiBootToDash (* unchanged since 1.0.3911 *) { (OOVPA*)&XapiBootDash_1_0_3911, diff --git a/src/CxbxKrnl/HLEIntercept.cpp b/src/CxbxKrnl/HLEIntercept.cpp index f9426f54c..87c1644c7 100644 --- a/src/CxbxKrnl/HLEIntercept.cpp +++ b/src/CxbxKrnl/HLEIntercept.cpp @@ -320,112 +320,6 @@ void EmuHLEIntercept(Xbe::LibraryVersion *pLibraryVersion, Xbe::Header *pXbeHead { uint32 lower = pXbeHeader->dwBaseAddr; 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)*/ && MajorVersion == 1 && MinorVersion == 0 &&