diff --git a/Cxbx.opt b/Cxbx.opt index 30676c003..9a464722e 100644 Binary files a/Cxbx.opt and b/Cxbx.opt differ diff --git a/Include/Win32/CxbxKrnl/EmuXapi.h b/Include/Win32/CxbxKrnl/EmuXapi.h index 344ff5cc0..3793e1097 100644 --- a/Include/Win32/CxbxKrnl/EmuXapi.h +++ b/Include/Win32/CxbxKrnl/EmuXapi.h @@ -285,6 +285,11 @@ XCALCSIG_SIGNATURE, *PXCALCSIG_SIGNATURE; // ****************************************************************** VOID WINAPI EmuXapiApplyKernelPatches(); +// ****************************************************************** +// * func: EmuXFormatUtilityDrive +// ****************************************************************** +BOOL WINAPI EmuXFormatUtilityDrive(); + // ****************************************************************** // * func: EmuRtlCreateHeap // ****************************************************************** diff --git a/Include/Win32/CxbxKrnl/HLEDataBase/Xapi.1.0.4627.h b/Include/Win32/CxbxKrnl/HLEDataBase/Xapi.1.0.4627.h index a1131cf9c..635d3b778 100644 --- a/Include/Win32/CxbxKrnl/HLEDataBase/Xapi.1.0.4627.h +++ b/Include/Win32/CxbxKrnl/HLEDataBase/Xapi.1.0.4627.h @@ -36,6 +36,7 @@ #include "OOVPA.h" +extern SOOVPA<7> XapiInitProcess_1_0_4928; extern OOVPATable XAPI_1_0_4627[]; extern uint32 XAPI_1_0_4627_SIZE; diff --git a/Include/Win32/CxbxKrnl/ResourceTracker.h b/Include/Win32/CxbxKrnl/ResourceTracker.h index 3eeeace00..1e7af7f13 100644 --- a/Include/Win32/CxbxKrnl/ResourceTracker.h +++ b/Include/Win32/CxbxKrnl/ResourceTracker.h @@ -86,7 +86,7 @@ extern class ResourceTracker : public Mutex } g_VBTrackTotal, g_VBTrackDisable, g_PBTrackTotal, g_PBTrackDisable, g_PBTrackShowOnce, -g_PatchedStreamsCache, g_DataToTexture; +g_PatchedStreamsCache, g_DataToTexture, g_AlignCache; struct RTNode { diff --git a/Source/Win32/CxbxKrnl/Emu.cpp b/Source/Win32/CxbxKrnl/Emu.cpp index b89bf44ae..ae3313be2 100644 --- a/Source/Win32/CxbxKrnl/Emu.cpp +++ b/Source/Win32/CxbxKrnl/Emu.cpp @@ -378,9 +378,18 @@ extern "C" CXBXKRNL_API void NTAPI EmuInit uint16 MajorVersion = pLibraryVersion[v].wMajorVersion; uint16 MinorVersion = pLibraryVersion[v].wMinorVersion; uint16 BuildVersion = pLibraryVersion[v].wBuildVersion; + uint16 OrigBuildVersion = BuildVersion; + + // + // Aliases + // + { + if(BuildVersion == 4928) + BuildVersion = 4627; if(BuildVersion == 5659) BuildVersion = 5558; + } char szLibraryName[9] = {0}; @@ -438,10 +447,19 @@ extern "C" CXBXKRNL_API void NTAPI EmuInit } else if(BuildVersion >= 4361) { + if(OrigBuildVersion == 4928) + { + pFunc = EmuLocateFunction((OOVPA*)&XapiInitProcess_1_0_4928, lower, upper); + ProcessHeapOffs = 0x44; + RtlCreateHeapOffs = 0x3B; + } + else + { pFunc = EmuLocateFunction((OOVPA*)&XapiInitProcess_1_0_4361, lower, upper); ProcessHeapOffs = 0x3E; RtlCreateHeapOffs = 0x37; } + } else // 3911, 4034, 4134 { pFunc = EmuLocateFunction((OOVPA*)&XapiInitProcess_1_0_3911, lower, upper); @@ -608,7 +626,7 @@ extern "C" CXBXKRNL_API void NTAPI EmuInit // _USE_XGMATH Disabled in mesh :[ // halo : dword_0_2E2D18 // halo : 1744F0 (bink) - //_asm int 3; + _asm int 3; /* for(int v=0;v XapiInitProcess_1_0_4361 = } }; - // ****************************************************************** // * XapiThreadStartup // ****************************************************************** diff --git a/Source/Win32/CxbxKrnl/HLEDataBase/Xapi.1.0.4627.inl b/Source/Win32/CxbxKrnl/HLEDataBase/Xapi.1.0.4627.inl index 8de064bff..2f93dcbad 100644 --- a/Source/Win32/CxbxKrnl/HLEDataBase/Xapi.1.0.4627.inl +++ b/Source/Win32/CxbxKrnl/HLEDataBase/Xapi.1.0.4627.inl @@ -32,6 +32,73 @@ // * // ****************************************************************** +// NOTE: This function actually came in with 4928 +// ****************************************************************** +// * XapiApplyKernelPatches +// ****************************************************************** +SOOVPA<7> XapiApplyKernelPatches_1_0_4928 = +{ + 0, // Large == 0 + 7, // Count == 7 + + -1, // Xref Not Saved + 0, // Xref Not Used + + { + { 0x17, 0x81 }, + { 0x2A, 0x81 }, + { 0x4B, 0x05 }, + { 0x5F, 0x1B }, + { 0x7C, 0xFF }, + { 0x88, 0x6A }, + { 0x92, 0xC7 }, + } +}; + +// NOTE: This function actually came in with 4928 +// ****************************************************************** +// * XapiInitProcess +// ****************************************************************** +SOOVPA<7> XapiInitProcess_1_0_4928 = +{ + 0, // Large == 0 + 7, // Count == 7 + + -1, // XRef Not Saved + 0, // XRef Not Used + + { + { 0x22, 0xC7 }, // (Offset,Value)-Pair #1 + { 0x23, 0x45 }, // (Offset,Value)-Pair #2 + { 0x24, 0xCC }, // (Offset,Value)-Pair #3 + { 0x25, 0x30 }, // (Offset,Value)-Pair #4 + { 0x4A, 0xA1 }, // (Offset,Value)-Pair #5 + { 0x4B, 0x18 }, // (Offset,Value)-Pair #6 + { 0x4C, 0x01 }, // (Offset,Value)-Pair #7 + } +}; + +// ****************************************************************** +// * XFormatUtilityDrive +// ****************************************************************** +SOOVPA<7> XFormatUtilityDrive_1_0_4627 = +{ + 0, // Large == 0 + 7, // Count == 7 + + -1, // Xref Not Saved + 0, // Xref Not Used + + { + { 0x10, 0x50 }, + { 0x23, 0xFF }, + { 0x34, 0xC0 }, + { 0x46, 0x45 }, + { 0x58, 0xFF }, + { 0x6D, 0x33 }, + { 0x7C, 0x40 }, + } +}; // ****************************************************************** // * SetThreadPriorityBoost // ****************************************************************** @@ -162,6 +229,36 @@ SOOVPA<10> RtlReAllocateHeap_1_0_4627 = // ****************************************************************** OOVPATable XAPI_1_0_4627[] = { + // XapiApplyKernelPatches + { + (OOVPA*)&XapiApplyKernelPatches_1_0_4928, + + XTL::EmuXapiApplyKernelPatches, + + #ifdef _DEBUG_TRACE + "EmuXapiApplyKernelPatches" + #endif + }, + // XapiInitProcess + { + (OOVPA*)&XapiInitProcess_1_0_4928, + + XTL::EmuXapiInitProcess, + + #ifdef _DEBUG_TRACE + "EmuXapiInitProcess" + #endif + }, + // XFormatUtilityDrive + { + (OOVPA*)&XFormatUtilityDrive_1_0_4627, + + XTL::EmuXFormatUtilityDrive, + + #ifdef _DEBUG_TRACE + "EmuXFormatUtilityDrive" + #endif + }, // SetThreadPriorityBoost { (OOVPA*)&SetThreadPriorityBoost_1_0_4627, diff --git a/Source/Win32/CxbxKrnl/ResourceTracker.cpp b/Source/Win32/CxbxKrnl/ResourceTracker.cpp index 49d743333..e700d7f0e 100644 --- a/Source/Win32/CxbxKrnl/ResourceTracker.cpp +++ b/Source/Win32/CxbxKrnl/ResourceTracker.cpp @@ -38,16 +38,18 @@ bool g_bVBSkipStream = false; bool g_bVBSkipPusher = false; +// +// all of our resource trackers +// + ResourceTracker g_VBTrackTotal; ResourceTracker g_VBTrackDisable; - ResourceTracker g_PBTrackTotal; ResourceTracker g_PBTrackDisable; ResourceTracker g_PBTrackShowOnce; - ResourceTracker g_PatchedStreamsCache; - ResourceTracker g_DataToTexture; +ResourceTracker g_AlignCache; ResourceTracker::~ResourceTracker() {