From 22791e0e6b1e5d5caab653b90dedff6a2e0b6917 Mon Sep 17 00:00:00 2001 From: Aaron Robinson Date: Sat, 22 Feb 2003 07:49:02 +0000 Subject: [PATCH] Modifying layout of HLE database --- CxbxKrnl.dsp | 12 +- Include/Win32/CxbxKrnl/HLEDataBase.h | 10 +- Include/Win32/CxbxKrnl/Xapi.1.0.4627.h | 40 +++++++ .../{D3D8.1.0.4361.cpp => D3D8.1.0.4361.inl} | 0 Source/Win32/CxbxKrnl/EmuX.cpp | 62 +++++++---- Source/Win32/CxbxKrnl/EmuXD3D.cpp | 78 ++++++------- Source/Win32/CxbxKrnl/HLEDataBase.cpp | 16 ++- .../{Xapi.1.0.4361.cpp => Xapi.1.0.4361.inl} | 2 - Source/Win32/CxbxKrnl/Xapi.1.0.4627.inl | 105 ++++++++++++++++++ 9 files changed, 257 insertions(+), 68 deletions(-) create mode 100644 Include/Win32/CxbxKrnl/Xapi.1.0.4627.h rename Source/Win32/CxbxKrnl/{D3D8.1.0.4361.cpp => D3D8.1.0.4361.inl} (100%) rename Source/Win32/CxbxKrnl/{Xapi.1.0.4361.cpp => Xapi.1.0.4361.inl} (99%) create mode 100644 Source/Win32/CxbxKrnl/Xapi.1.0.4627.inl diff --git a/CxbxKrnl.dsp b/CxbxKrnl.dsp index 50f25520e..551cf35ef 100644 --- a/CxbxKrnl.dsp +++ b/CxbxKrnl.dsp @@ -168,6 +168,10 @@ SOURCE=.\Include\Win32\CxbxKrnl\Xapi.1.0.4361.h # End Source File # Begin Source File +SOURCE=.\Include\Win32\CxbxKrnl\Xapi.1.0.4627.h +# End Source File +# Begin Source File + SOURCE=.\Include\Win32\CxbxKrnl\xntdll.h # End Source File # End Group @@ -180,7 +184,7 @@ SOURCE=.\Include\Win32\CxbxKrnl\xntdll.h # PROP Default_Filter "" # Begin Source File -SOURCE=.\Source\Win32\CxbxKrnl\D3D8.1.0.4361.cpp +SOURCE=.\Source\Win32\CxbxKrnl\D3D8.1.0.4361.inl # End Source File # Begin Source File @@ -216,7 +220,11 @@ SOURCE=.\Source\Win32\CxbxKrnl\KernelThunk.cpp # End Source File # Begin Source File -SOURCE=.\Source\Win32\CxbxKrnl\Xapi.1.0.4361.cpp +SOURCE=.\Source\Win32\CxbxKrnl\Xapi.1.0.4361.inl +# End Source File +# Begin Source File + +SOURCE=.\Source\Win32\CxbxKrnl\Xapi.1.0.4627.inl # End Source File # End Group # End Target diff --git a/Include/Win32/CxbxKrnl/HLEDataBase.h b/Include/Win32/CxbxKrnl/HLEDataBase.h index 19da934fc..a8a40b20b 100644 --- a/Include/Win32/CxbxKrnl/HLEDataBase.h +++ b/Include/Win32/CxbxKrnl/HLEDataBase.h @@ -34,13 +34,21 @@ #ifndef HLEDATABASE_H #define HLEDATABASE_H +#include "Xapi.1.0.4361.h" +#include "Xapi.1.0.4627.h" +#include "D3D8.1.0.4361.h" + // ****************************************************************** // * HLEDataBase // ****************************************************************** extern struct HLEData { char *Library; - char *Version; + + uint16 MajorVersion; + uint16 MinorVersion; + uint16 BuildVersion; + OOVPATable *OovpaTable; uint32 OovpaTableSize; } diff --git a/Include/Win32/CxbxKrnl/Xapi.1.0.4627.h b/Include/Win32/CxbxKrnl/Xapi.1.0.4627.h new file mode 100644 index 000000000..62945d2fa --- /dev/null +++ b/Include/Win32/CxbxKrnl/Xapi.1.0.4627.h @@ -0,0 +1,40 @@ +// ****************************************************************** +// * +// * .,-::::: .,:: .::::::::. .,:: .: +// * ,;;;'````' `;;;, .,;; ;;;'';;' `;;;, .,;; +// * [[[ '[[,,[[' [[[__[[\. '[[,,[[' +// * $$$ Y$$$P $$""""Y$$ Y$$$P +// * `88bo,__,o, oP"``"Yo, _88o,,od8P oP"``"Yo, +// * "YUMMMMMP",m" "Mm,""YUMMMP" ,m" "Mm, +// * +// * Cxbx->Win32->CxbxKrnl->Xapi.1.0.4627.h +// * +// * This file is part of the Cxbx project. +// * +// * Cxbx and Cxbe are free software; you can redistribute them +// * and/or modify them under the terms of the GNU General Public +// * License as published by the Free Software Foundation; either +// * version 2 of the license, or (at your option) any later version. +// * +// * This program is distributed in the hope that it will be useful, +// * but WITHOUT ANY WARRANTY; without even the implied warranty of +// * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// * GNU General Public License for more details. +// * +// * You should have recieved a copy of the GNU General Public License +// * along with this program; see the file COPYING. +// * If not, write to the Free Software Foundation, Inc., +// * 59 Temple Place - Suite 330, Bostom, MA 02111-1307, USA. +// * +// * (c) 2002-2003 Aaron Robinson +// * +// * All rights reserved +// * +// ****************************************************************** +#ifndef XAPI_1_0_4627_H +#define XAPI_1_0_4627_H + +extern OOVPATable XAPI_1_0_4627[]; +extern uint32 XAPI_1_0_4627_SIZE; + +#endif diff --git a/Source/Win32/CxbxKrnl/D3D8.1.0.4361.cpp b/Source/Win32/CxbxKrnl/D3D8.1.0.4361.inl similarity index 100% rename from Source/Win32/CxbxKrnl/D3D8.1.0.4361.cpp rename to Source/Win32/CxbxKrnl/D3D8.1.0.4361.inl diff --git a/Source/Win32/CxbxKrnl/EmuX.cpp b/Source/Win32/CxbxKrnl/EmuX.cpp index 0dbe7b3e4..6847a6d13 100644 --- a/Source/Win32/CxbxKrnl/EmuX.cpp +++ b/Source/Win32/CxbxKrnl/EmuX.cpp @@ -107,20 +107,32 @@ CXBXKRNL_API void NTAPI EmuXInit(Xbe::LibraryVersion *LibraryVersion, DebugMode for(uint32 v=0;vLovp[count-1].Offset; + bool found = false; + // ****************************************************************** // * Search all of the image memory // ****************************************************************** @@ -296,18 +310,20 @@ void EmuXInstallWrappers(OOVPATable *OovpaTable, uint32 OovpaTableSize, void (*E EmuXInstallWrapper((void*)cur, OovpaTable[a].lpRedirect); + found = true; + break; } + } - // ****************************************************************** - // * not found - // ****************************************************************** - if(cur == upper && v != count) - { - #ifdef _DEBUG_TRACE - printf("None (OK)\n"); - #endif - } + // ****************************************************************** + // * not found + // ****************************************************************** + if(!found) + { + #ifdef _DEBUG_TRACE + printf("None (OK)\n"); + #endif } } // ****************************************************************** @@ -319,6 +335,8 @@ void EmuXInstallWrappers(OOVPATable *OovpaTable, uint32 OovpaTableSize, void (*E upper -= Soovpa->Sovp[count-1].Offset; + bool found = false; + // ****************************************************************** // * Search all of the image memory // ****************************************************************** @@ -351,18 +369,20 @@ void EmuXInstallWrappers(OOVPATable *OovpaTable, uint32 OovpaTableSize, void (*E EmuXInstallWrapper((void*)cur, OovpaTable[a].lpRedirect); + found = true; + break; } + } - // ****************************************************************** - // * not found - // ****************************************************************** - if(cur == upper && v != count) - { - #ifdef _DEBUG_TRACE - printf("None (OK)\n"); - #endif - } + // ****************************************************************** + // * not found + // ****************************************************************** + if(!found) + { + #ifdef _DEBUG_TRACE + printf("None (OK)\n"); + #endif } } } diff --git a/Source/Win32/CxbxKrnl/EmuXD3D.cpp b/Source/Win32/CxbxKrnl/EmuXD3D.cpp index e3c36e6a9..490a41c2b 100644 --- a/Source/Win32/CxbxKrnl/EmuXD3D.cpp +++ b/Source/Win32/CxbxKrnl/EmuXD3D.cpp @@ -122,22 +122,27 @@ void EmuXRenderWindow(PVOID) UpdateWindow(g_EmuXWindow); } - MSG msg; - - ZeroMemory(&msg, sizeof(msg)); - - while(msg.message != WM_QUIT) + // ****************************************************************** + // * message processing loop + // ****************************************************************** { - if(PeekMessage( &msg, NULL, 0U, 0U, PM_REMOVE )) - { - TranslateMessage(&msg); - DispatchMessage(&msg); - } - else - Sleep(10); - } + MSG msg; - ExitProcess(0); + ZeroMemory(&msg, sizeof(msg)); + + while(msg.message != WM_QUIT) + { + if(PeekMessage( &msg, NULL, 0U, 0U, PM_REMOVE )) + { + TranslateMessage(&msg); + DispatchMessage(&msg); + } + else + Sleep(10); + } + + ExitProcess(0); + } } // ****************************************************************** @@ -199,21 +204,22 @@ HRESULT WINAPI xboxkrnl::EmuXIDirect3D8_CreateDevice hFocusWindow = g_EmuXWindow; - // Tricky MS randomizing .h #defines :[ - if(pPresentationParameters->BackBufferFormat == 0x07) - pPresentationParameters->BackBufferFormat = D3DFMT_X8R8G8B8; + // TODO: Use lookup table that is dependant on library version + { + // Tricky MS randomizing .h #defines :[ + if(pPresentationParameters->BackBufferFormat == 0x07) + pPresentationParameters->BackBufferFormat = D3DFMT_X8R8G8B8; - // Tricky MS randomizing .h #defines :[ - if(pPresentationParameters->AutoDepthStencilFormat == 0x2A) - pPresentationParameters->AutoDepthStencilFormat = D3DFMT_D24S8; + // Tricky MS randomizing .h #defines :[ + if(pPresentationParameters->AutoDepthStencilFormat == 0x2A) + pPresentationParameters->AutoDepthStencilFormat = D3DFMT_D24S8; + } } // ****************************************************************** // * TODO: Query for Software Vertex Processing abilities!! // ****************************************************************** - { - BehaviorFlags = D3DCREATE_SOFTWARE_VERTEXPROCESSING; - } + BehaviorFlags = D3DCREATE_SOFTWARE_VERTEXPROCESSING; // ****************************************************************** // * redirect to windows d3d @@ -223,7 +229,7 @@ HRESULT WINAPI xboxkrnl::EmuXIDirect3D8_CreateDevice Adapter, DeviceType, hFocusWindow, - BehaviorFlags, // TODO: perhaps allow software vertex processing + BehaviorFlags, pPresentationParameters, ppReturnedDeviceInterface ); @@ -231,9 +237,7 @@ HRESULT WINAPI xboxkrnl::EmuXIDirect3D8_CreateDevice // ****************************************************************** // * it is necessary to store this pointer globally for emulation // ****************************************************************** - { - g_pD3D8Device = *ppReturnedDeviceInterface; - } + g_pD3D8Device = *ppReturnedDeviceInterface; EmuXSwapFS(); // XBox FS @@ -279,22 +283,20 @@ HRESULT WINAPI xboxkrnl::EmuXIDirect3DDevice8_Clear // ****************************************************************** { // TODO: D3DCLEAR_TARGET_A, *R, *G, *B don't exist on windows - + // TODO: Use lookup table that is dependant on library version // Tricky MS randomizing .h #defines :[ - { - DWORD newFlags = 0; + DWORD newFlags = 0; - if(Flags & 0x000000f0l) - newFlags |= D3DCLEAR_TARGET; + if(Flags & 0x000000f0l) + newFlags |= D3DCLEAR_TARGET; - if(Flags & 0x00000001l) - newFlags |= D3DCLEAR_ZBUFFER; + if(Flags & 0x00000001l) + newFlags |= D3DCLEAR_ZBUFFER; - if(Flags & 0x00000002l) - newFlags |= D3DCLEAR_STENCIL; + if(Flags & 0x00000002l) + newFlags |= D3DCLEAR_STENCIL; - Flags = newFlags; - } + Flags = newFlags; } HRESULT ret = g_pD3D8Device->Clear(Count, pRects, Flags, Color, Z, Stencil); diff --git a/Source/Win32/CxbxKrnl/HLEDataBase.cpp b/Source/Win32/CxbxKrnl/HLEDataBase.cpp index 82ff1c5a3..fb169b5d8 100644 --- a/Source/Win32/CxbxKrnl/HLEDataBase.cpp +++ b/Source/Win32/CxbxKrnl/HLEDataBase.cpp @@ -34,8 +34,9 @@ #include "Cxbx.h" #include "EmuX.h" -#include "Xapi.1.0.4361.h" -#include "D3D8.1.0.4361.h" +#include "Xapi.1.0.4361.inl" +#include "Xapi.1.0.4627.inl" +#include "D3D8.1.0.4361.inl" // ****************************************************************** // * HLEDataBase @@ -45,14 +46,21 @@ HLEData HLEDataBase[] = // Xapilib Version 1.0.4361 { "XAPILIB", - "1.0.4361", + 1, 0, 4361, XAPI_1_0_4361, XAPI_1_0_4361_SIZE }, + // Xapilib Version 1.0.4627 + { + "XAPILIB", + 1, 0, 4627, + XAPI_1_0_4627, + XAPI_1_0_4627_SIZE + }, // D3D8 Version 1.0.4361 { "D3D8", - "1.0.4361", + 1, 0, 4361, D3D8_1_0_4361, D3D8_1_0_4361_SIZE } diff --git a/Source/Win32/CxbxKrnl/Xapi.1.0.4361.cpp b/Source/Win32/CxbxKrnl/Xapi.1.0.4361.inl similarity index 99% rename from Source/Win32/CxbxKrnl/Xapi.1.0.4361.cpp rename to Source/Win32/CxbxKrnl/Xapi.1.0.4361.inl index 926884e9a..b92e789a8 100644 --- a/Source/Win32/CxbxKrnl/Xapi.1.0.4361.cpp +++ b/Source/Win32/CxbxKrnl/Xapi.1.0.4361.inl @@ -31,8 +31,6 @@ // * All rights reserved // * // ****************************************************************** -#include "Cxbx.h" -#include "EmuX.h" // ****************************************************************** // * CreateThread diff --git a/Source/Win32/CxbxKrnl/Xapi.1.0.4627.inl b/Source/Win32/CxbxKrnl/Xapi.1.0.4627.inl new file mode 100644 index 000000000..1ccdb853a --- /dev/null +++ b/Source/Win32/CxbxKrnl/Xapi.1.0.4627.inl @@ -0,0 +1,105 @@ +// ****************************************************************** +// * +// * .,-::::: .,:: .::::::::. .,:: .: +// * ,;;;'````' `;;;, .,;; ;;;'';;' `;;;, .,;; +// * [[[ '[[,,[[' [[[__[[\. '[[,,[[' +// * $$$ Y$$$P $$""""Y$$ Y$$$P +// * `88bo,__,o, oP"``"Yo, _88o,,od8P oP"``"Yo, +// * "YUMMMMMP",m" "Mm,""YUMMMP" ,m" "Mm, +// * +// * Cxbx->Win32->CxbxKrnl->Xapi.1.0.4627.cpp +// * +// * This file is part of the Cxbx project. +// * +// * Cxbx and Cxbe are free software; you can redistribute them +// * and/or modify them under the terms of the GNU General Public +// * License as published by the Free Software Foundation; either +// * version 2 of the license, or (at your option) any later version. +// * +// * This program is distributed in the hope that it will be useful, +// * but WITHOUT ANY WARRANTY; without even the implied warranty of +// * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// * GNU General Public License for more details. +// * +// * You should have recieved a copy of the GNU General Public License +// * along with this program; see the file COPYING. +// * If not, write to the Free Software Foundation, Inc., +// * 59 Temple Place - Suite 330, Bostom, MA 02111-1307, USA. +// * +// * (c) 2002-2003 Aaron Robinson +// * +// * All rights reserved +// * +// ****************************************************************** + +// ****************************************************************** +// * XAPI_1_0_4627 +// ****************************************************************** +OOVPATable XAPI_1_0_4627[] = +{ + // CreateThread (unchanged since 4361) + { + (OOVPA*)&CreateThread_1_0_4361, + + xboxkrnl::EmuXCreateThread, + + #ifdef _DEBUG_TRACE + "EmuXCreateThread" + #endif + }, + // CloseHandle (unchanged since 4361) + { + (OOVPA*)&CloseHandle_1_0_4361, + + xboxkrnl::EmuXCloseHandle, + + #ifdef _DEBUG_TRACE + "EmuXCloseHandle" + #endif + }, + // XapiInitProcess (unchanged since 4361) + { + (OOVPA*)&XapiInitProcess_1_0_4361, + + xboxkrnl::EmuXapiInitProcess, + + #ifdef _DEBUG_TRACE + "EmuXapiInitProcess" + #endif + }, + // XapiBootToDash (unchanged since 4361) + { + (OOVPA*)&XapiBootDash_1_0_4361, + + xboxkrnl::EmuXapiBootDash, + + #ifdef _DEBUG_TRACE + "EmuXapiBootDash" + #endif + }, + // __rtinit (unchanged since 4361) + { + (OOVPA*)&__rtinit_1_0_4361, + + xboxkrnl::EmuX__rtinit, + + #ifdef _DEBUG_TRACE + "EmuX__rtinit", + #endif + }, + // __cinit (unchanged since 4361) + { + (OOVPA*)&__cinit_1_0_4361, + + xboxkrnl::EmuX__cinit, + + #ifdef _DEBUG_TRACE + "EmuX__cinit", + #endif + }, +}; + +// ****************************************************************** +// * XAPI_1_0_4627_SIZE +// ****************************************************************** +uint32 XAPI_1_0_4627_SIZE = sizeof(XAPI_1_0_4627);