Skip to content

Commit

Permalink
Add LTCG symbols: CDevice_KickOff_0_edx, CDevice_KickOff_0_ecx, D3DDe…
Browse files Browse the repository at this point in the history
…vice_MakeSpace_0, XGSetSurfaceHeader
  • Loading branch information
jackchentwkh authored and RadWolfie committed Oct 27, 2023
1 parent 3896aab commit c41069d
Show file tree
Hide file tree
Showing 12 changed files with 332 additions and 0 deletions.
5 changes: 5 additions & 0 deletions include/xref/d3d8ltcg.def
Original file line number Diff line number Diff line change
Expand Up @@ -25,5 +25,10 @@ XREF_SYMBOL(D3DDevice_SetRenderStateInline__GenericFragment)
// TODO: Verify each xref's function match with d3d8.def's function xrefs.

// functions
XREF_SYMBOL(D3DDevice_GetBackBuffer_8)
XREF_SYMBOL(D3DDevice_GetBackBuffer2_0__LTCG_eax1)
XREF_SYMBOL(D3DDevice_SetTextureStageStateNotInline2)
XREF_SYMBOL(D3D_KickOffAndWaitForIdle2)
XREF_SYMBOL(D3DDevice_MakeSpace_0)
XREF_SYMBOL(CDevice_KickOff_0_ecx)
XREF_SYMBOL(CDevice_KickOff_0_edx)
1 change: 1 addition & 0 deletions include/xref/xgraphic.def
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ XREF_SYMBOL(XFONT_OpenBitmapFontFromMemory)
XREF_SYMBOL(XGCompressRect)
XREF_SYMBOL(XGIsSwizzledFormat)
XREF_SYMBOL(XGSetIndexBufferHeader)
XREF_SYMBOL(XGSetSurfaceHeader)
XREF_SYMBOL(XGSetTextureHeader)
XREF_SYMBOL(XGSetVertexBufferHeader)
XREF_SYMBOL(XGSwizzleBox)
Expand Down
44 changes: 44 additions & 0 deletions src/OOVPADatabase/D3D8LTCG/3925.inl
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
// ******************************************************************
// *
// * OOVPADatabase->D3D8LTCG->3911.inl
// *
// * XbSymbolDatabase is 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, Boston, MA 02111-1307, USA.
// *
// * (c) 2017 jarupxx
// *
// * All rights reserved
// *
// ******************************************************************

// test case: NASCAR Heat 2002
// ******************************************************************
// * D3D::CDevice::KickOff
// ******************************************************************
OOVPA_SIG_HEADER_NO_XREF(CDevice_KickOff_0_edx,
3925)
OOVPA_SIG_MATCH(

// test eax, eax
// jz EIP+8
OV_MATCH(0x05, 0x85, 0xC0, 0x75, 0x2B),
// test byte ptr [edx+0Ch], 4
OV_MATCH(0x09, 0xF6, 0x42, 0x0C, 0x04),
// push esi
// jz EIP+8
OV_MATCH(0x0D, 0x56, 0x74, 0x08),

//
);
27 changes: 27 additions & 0 deletions src/OOVPADatabase/D3D8LTCG/4039.inl
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,33 @@ OOVPA_SIG_MATCH(
// Do not use any offsets after 0x1B
);

// test case: NBA2K2
// ******************************************************************
// * D3D::CDevice::KickOff
// ******************************************************************
OOVPA_SIG_HEADER_XREF(CDevice_KickOff_0_edx,
4039,
XRefOne)
OOVPA_SIG_MATCH(
// mov eax, XREF_D3D_g_pDevice
XREF_ENTRY(0x41, XREF_D3D_g_pDevice), // Derived

// mov eax, [edx+8]
OV_MATCH(0x00, 0x8B, 0x42, 0x08),
// test ah, 20h
// push esi
OV_MATCH(0x03, 0xF6, 0xC4, 0x20, 0x56),

// test al, 0x04
// jz EIP+8
OV_MATCH(0x0D, 0xA8, 0x04, 0x74, 0x08),

// mov eax, XREF_D3D_g_pDevice
OV_MATCH(0x40, 0xA1),

//
);

// ******************************************************************
// * D3DDevice_SetViewport
// ******************************************************************
Expand Down
27 changes: 27 additions & 0 deletions src/OOVPADatabase/D3D8LTCG/4928.inl
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,33 @@ OOVPA_SIG_MATCH(
//
);

// test case: Crimson Sea
// ******************************************************************
// * D3D::CDevice::KickOff
// ******************************************************************
OOVPA_SIG_HEADER_XREF(CDevice_KickOff_0_edx,
4928,
XRefOne)
OOVPA_SIG_MATCH(
// mov eax, XREF_D3D_g_pDevice
XREF_ENTRY(0x3C, XREF_D3D_g_pDevice), // Derived

// mov eax, [edx+8]
OV_MATCH(0x00, 0x8B, 0x42, 0x08),
// test al, 4
// push esi
// jz EIP+8
OV_MATCH(0x03, 0xA8, 0x04, 0x56, 0x74, 0x08),

// test ah, 0x20
OV_MATCH(0x12, 0xF6, 0xC4, 0x20),

// mov eax, XREF_D3D_g_pDevice
OV_MATCH(0x3B, 0xA1),

//
);

// ******************************************************************
// * D3DDevice_PersistDisplay
// ******************************************************************
Expand Down
26 changes: 26 additions & 0 deletions src/OOVPADatabase/D3D8LTCG/5120.inl
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,32 @@ OOVPA_SIG_MATCH(
//
);

// ******************************************************************
// * D3D::CDevice::KickOff_0
// ******************************************************************
OOVPA_SIG_HEADER_XREF(CDevice_KickOff_0_edx,
5120,
XRefOne)
OOVPA_SIG_MATCH(
// mov eax, XREF_D3D_g_pDevice
XREF_ENTRY(0x36, XREF_D3D_g_pDevice), // Derived

// mov eax, [edx+8]
OV_MATCH(0x00, 0x8B, 0x42, 0x08),
// test al, 4
// push esi
// jz EIP+8
OV_MATCH(0x03, 0xA8, 0x04, 0x56, 0x74, 0x08),

// test ah, 0x20
OV_MATCH(0x12, 0xF6, 0xC4, 0x20),

// mov ecx, XREF_D3D_g_pDevice
OV_MATCH(0x34, 0x8B, 0x0D),

//
);

// ******************************************************************
// * D3DDevice_Reset
// ******************************************************************
Expand Down
51 changes: 51 additions & 0 deletions src/OOVPADatabase/D3D8LTCG/5558.inl
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
// ******************************************************************
// *
// * OOVPADatabase->D3D8LTCG->5849.inl
// *
// * XbSymbolDatabase is 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, Boston, MA 02111-1307, USA.
// *
// * (c) 2017 jarupxx
// *
// * All rights reserved
// *
// ******************************************************************

//test case: OddWorld Stranger's Wrath
// ******************************************************************
// * D3D::CDevice::KickOff
// ******************************************************************
OOVPA_SIG_HEADER_XREF(CDevice_KickOff_0_ecx,
5558,
XRefOne)
OOVPA_SIG_MATCH(
// mov eax, XREF_D3D_g_pDevice
XREF_ENTRY(0x1E, XREF_D3D_g_pDevice), // Derived

// mov eax, [ecx+8]
OV_MATCH(0x00, 0x8B, 0x41, 0x08),
// test al, 4
// push esi
// jz EIP+8
OV_MATCH(0x03, 0xA8, 0x04, 0x56, 0x74, 0x08),

// test ah, 0x20
OV_MATCH(0x12, 0xF6, 0xC4, 0x20),

// mov edi, XREF_D3D_g_pDevice
OV_MATCH(0x1C, 0x8B, 0x3D),

//
);
80 changes: 80 additions & 0 deletions src/OOVPADatabase/D3D8LTCG/5849.inl
Original file line number Diff line number Diff line change
Expand Up @@ -185,6 +185,31 @@ OOVPA_SIG_MATCH(
//
);

// ******************************************************************
// * D3DDevice_MakeSpace
// ******************************************************************
OOVPA_SIG_HEADER_XREF(D3DDevice_MakeSpace_0,
5849,
XRefOne)
OOVPA_SIG_MATCH(

// call D3D::MakeRequestedSpace
XREF_ENTRY(0x0B, XREF_D3D_MakeRequestedSpace),

// D3DDevice_MakeSpace+0x00 : mov eax,[addr]
OV_MATCH(0x00, 0xA1),

// D3DDevice_MakeSpace+0x09 : push ecx
OV_MATCH(0x09, 0x51),

// D3DDevice_MakeSpace+0x0A : call D3D::MakeRequestedSpace
OV_MATCH(0x0A, 0xE8),

// D3DDevice_MakeSpace+0x0E : ret
OV_MATCH(0x0F, 0xC3),
//
);

// ******************************************************************
// * D3D_KickOffAndWaitForIdle
// ******************************************************************
Expand All @@ -210,6 +235,61 @@ OOVPA_SIG_MATCH(
//
);

//test case: Otogi 2/MechAssault 2
// ******************************************************************
// * D3D::CDevice::KickOff
// ******************************************************************
OOVPA_SIG_HEADER_XREF(CDevice_KickOff_0_edx,
5849,
XRefOne)
OOVPA_SIG_MATCH(
// mov eax, XREF_D3D_g_pDevice
XREF_ENTRY(0x35, XREF_D3D_g_pDevice), // Derived

// mov eax, [edx+8]
OV_MATCH(0x00, 0x8B, 0x42, 0x08),
// test al, 4
// push esi
// jz EIP+8
OV_MATCH(0x03, 0xA8, 0x04, 0x56, 0x74, 0x08),

// test ah, 0x20
OV_MATCH(0x12, 0xF6, 0xC4, 0x20),

// mov ecx, XREF_D3D_g_pDevice
OV_MATCH(0x34, 0x8B),

//
);

//test case: OddWorld Stranger's Wrath
// ******************************************************************
// * D3D::CDevice::KickOff
// ******************************************************************
OOVPA_SIG_HEADER_XREF(CDevice_KickOff_0_ecx,
5849,
XRefOne)
OOVPA_SIG_MATCH(
// mov eax, XREF_D3D_g_pDevice
XREF_ENTRY(0x1E, XREF_D3D_g_pDevice), // Derived

// mov eax, [ecx+8]
OV_MATCH(0x00, 0x8B, 0x41, 0x08),
// test al, 4
// push esi
// jz EIP+8
OV_MATCH(0x03, 0xA8, 0x04, 0x56, 0x74, 0x08),

// test ah, 0x20
OV_MATCH(0x12, 0xF6, 0xC4, 0x20),

// mov edi, XREF_D3D_g_pDevice
OV_MATCH(0x1C, 0x8B, 0x3D),

//
);


// ******************************************************************
// * D3DDevice_SetRenderState_TwoSidedLighting
// ******************************************************************
Expand Down
5 changes: 5 additions & 0 deletions src/OOVPADatabase/D3D8LTCG_OOVPA.inl
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@
#include "OOVPA.h"

#include "D3D8LTCG/3911.inl"
#include "D3D8LTCG/3925.inl"
#include "D3D8LTCG/4034.inl"
#include "D3D8LTCG/4039.inl"
#include "D3D8LTCG/4432.inl"
Expand All @@ -58,6 +59,7 @@
#include "D3D8LTCG/5233.inl"
#include "D3D8LTCG/5344.inl"
#include "D3D8LTCG/5455.inl"
#include "D3D8LTCG/5558.inl"
#include "D3D8LTCG/5788.inl"
#include "D3D8LTCG/5849.inl"

Expand Down Expand Up @@ -246,6 +248,9 @@ OOVPATable D3D8LTCG_OOVPA[] = {
REGISTER_OOVPAS(D3D_CommonSetRenderTarget, 1024, 1036, 1048, 1060),
REGISTER_OOVPAS_BIND_XREF(D3D_CommonSetMultiSampleModeAndScale_4__LTCG_eax1, D3D_CommonSetMultiSampleModeAndScale, 5344),
REGISTER_OOVPAS(D3D_KickOffAndWaitForIdle2, 1024, 1036, 1048),
REGISTER_OOVPAS(CDevice_KickOff_0_edx, 3925, 4039, 4928, 5120, 5849),
REGISTER_OOVPAS(CDevice_KickOff_0_ecx, 5558, 5849),
REGISTER_OOVPAS(D3DDevice_MakeSpace_0, 5849),
REGISTER_OOVPAS(Direct3D_CreateDevice, 1024, 1036),
REGISTER_OOVPAS_BIND_XREF(Direct3D_CreateDevice_16__LTCG_eax_BehaviorFlags_ebx_ppReturnedDeviceInterface, Direct3D_CreateDevice, 2024),
REGISTER_OOVPAS_BIND_XREF(Direct3D_CreateDevice_16__LTCG_eax_BehaviorFlags_ecx_ppReturnedDeviceInterface, Direct3D_CreateDevice, 2036, 2048),
Expand Down
20 changes: 20 additions & 0 deletions src/OOVPADatabase/XGraphic/3911.inl
Original file line number Diff line number Diff line change
Expand Up @@ -236,3 +236,23 @@ OOVPA_SIG_MATCH(
{ 0x12, 0x18 },
//
);

// ******************************************************************
// * XGSetSurfaceHeader
// ******************************************************************

OOVPA_SIG_HEADER_NO_XREF(XGSetSurfaceHeader,
3911)
OOVPA_SIG_MATCH(

// XGSetSurfaceHeader+0x00 : push ebp, mov ebp,esp
OV_MATCH(0x00, 0x55, 0x8B, 0xEC),

OV_MATCH(0x06, 0x14),

OV_MATCH(0x09, 0x10),

// XGSetSurfaceHeader+0x0F : push 0x00, push 0x00
OV_MATCH(0x0F, 0x6A, 0x00, 0x6A, 0x00),

);
Loading

0 comments on commit c41069d

Please sign in to comment.