Modifying layout of HLE database

This commit is contained in:
Aaron Robinson 2003-02-22 07:49:02 +00:00
parent 8afe493180
commit 22791e0e6b
9 changed files with 257 additions and 68 deletions

View File

@ -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

View File

@ -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;
}

View File

@ -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 <caustik@caustik.com>
// *
// * 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

View File

@ -107,20 +107,32 @@ CXBXKRNL_API void NTAPI EmuXInit(Xbe::LibraryVersion *LibraryVersion, DebugMode
for(uint32 v=0;v<dwLibraryVersions;v++)
{
uint16 MajorVersion = LibraryVersion[v].wMajorVersion;
uint16 MinorVersion = LibraryVersion[v].wMinorVersion;
uint16 BuildVersion = LibraryVersion[v].wBuildVersion;
char szLibraryName[9] = {0};
for(uint32 c=0;c<8;c++)
szLibraryName[c] = LibraryVersion[v].szName[c];
printf("EmuX: Locating HLE Information for %s...", szLibraryName);
printf("EmuX: Locating HLE Information for %s %d.%d.%d...", szLibraryName, MajorVersion, MinorVersion, BuildVersion);
bool found=false;
for(uint32 d=0;d<dwHLEEntries;d++)
{
if(strcmp(szLibraryName, HLEDataBase[d].Library) != 0)
continue;
if
(
BuildVersion != HLEDataBase[d].BuildVersion ||
MinorVersion != HLEDataBase[d].MinorVersion ||
MajorVersion != HLEDataBase[d].MajorVersion ||
strcmp(szLibraryName, HLEDataBase[d].Library) != 0
)
continue;
found = true;
printf("Found\n");
EmuXInstallWrappers(HLEDataBase[d].OovpaTable, HLEDataBase[d].OovpaTableSize, Entry, XbeHeader);
@ -264,6 +276,8 @@ void EmuXInstallWrappers(OOVPATable *OovpaTable, uint32 OovpaTableSize, void (*E
upper -= Loovpa->Lovp[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
}
}
}

View File

@ -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);

View File

@ -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
}

View File

@ -31,8 +31,6 @@
// * All rights reserved
// *
// ******************************************************************
#include "Cxbx.h"
#include "EmuX.h"
// ******************************************************************
// * CreateThread

View File

@ -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 <caustik@caustik.com>
// *
// * 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);