From b9afc1bf51d6f2915b7c0aa052d6f875903f6c31 Mon Sep 17 00:00:00 2001 From: PatrickvL Date: Sun, 5 Nov 2023 15:04:47 +0100 Subject: [PATCH] Slightly rename HLE_API_METHOD into NV097_HLE_API --- src/core/hle/D3D8/Direct3D9/HleInNv2a.h | 8 +++++--- src/devices/video/EmuNV2A_PGRAPH.cpp | 8 ++++---- 2 files changed, 9 insertions(+), 7 deletions(-) diff --git a/src/core/hle/D3D8/Direct3D9/HleInNv2a.h b/src/core/hle/D3D8/Direct3D9/HleInNv2a.h index 5550b461f..daa6c13f2 100644 --- a/src/core/hle/D3D8/Direct3D9/HleInNv2a.h +++ b/src/core/hle/D3D8/Direct3D9/HleInNv2a.h @@ -194,9 +194,11 @@ typedef enum _X_D3DAPI_ENUM { } X_D3DAPI_ENUM; // virtual NV2A register for HLE API handler -#define HLE_API_METHOD 0x00000080 // See COMMAND_WORD_MASK_METHOD +# define NV097_HLE_API 0x00000080 /* Snugged this method in the middle between +# define NV097_SET_OBJECT 0x00000000 the first method, and the next known one : +# define NV097_NO_OPERATION 0x00000100 Aternatively, move to the end, after NV097_DEBUG_INIT */ -#define HLE_PUSH_ENCODE(dword_count) PUSH_ENCODE(PUSH_INSTR_IMM_NOINC, dword_count, PUSH_SUBCH_0, HLE_API_METHOD, PUSH_TYPE_METHOD) +#define HLE_PUSH_ENCODE(dword_count) PUSH_ENCODE(PUSH_INSTR_IMM_NOINC, dword_count, PUSH_SUBCH_0, NV097_HLE_API, PUSH_TYPE_METHOD) static inline DWORD FtoDW(FLOAT f) { return *((DWORD*)&f); } static inline FLOAT DWtoF(DWORD f) { return *((FLOAT*)&f); } @@ -334,7 +336,7 @@ D3DDevice_SetIndices_4 /* -notes for my trials and errors. +jackchen notes for my trials and errors. Original idea was to use a virtual pushbuffer method to represent each patched HLE api and push the virtual pushbuffer method to pushbuffer then let pgraph method handler handle the patched HLE api later. this should solve the sync issue between pushbuffer and HLE api. diff --git a/src/devices/video/EmuNV2A_PGRAPH.cpp b/src/devices/video/EmuNV2A_PGRAPH.cpp index 651fb9cad..b311ea97d 100644 --- a/src/devices/video/EmuNV2A_PGRAPH.cpp +++ b/src/devices/video/EmuNV2A_PGRAPH.cpp @@ -1535,8 +1535,8 @@ void HLE_API_handle_method uint32_t* argv ) { - X_D3DAPI_ENUM hleAPI; - hleAPI = (X_D3DAPI_ENUM)argv[0]; + X_D3DAPI_ENUM hleAPI = (X_D3DAPI_ENUM)argv[0]; + switch (hleAPI) { //case X_CDevice_SetStateUP: break; @@ -2145,7 +2145,7 @@ int pgraph_handle_method( switch (method) { // TODO : Replace 'special cases' with check on (arg0 >> 29 == COMMAND_INSTRUCTION_NON_INCREASING_METHODS) //list all special cases here. //case NV097_SET_OBJECT: - case HLE_API_METHOD: [[fallthrough]]; + case NV097_HLE_API: [[fallthrough]]; case NV097_NO_OPERATION: //this is used as short jump or interrupt, padding in front of fixups in order to make sure fixup will be applied before the instruction enter cache. //case NV097_SET_BEGIN_END://now we use pg->primitive_mode for PrititiveType state //enclave subset of drawing instructions. need special handling. // NV097_ARRAY_ELEMENT32 is PUSH_INSTR_IMM_INC, test case: Otogi. it's logical since NV097_ARRAY_ELEMENT32 is used to transfer the last odd index, if there were one. @@ -2178,7 +2178,7 @@ int pgraph_handle_method( switch (method) { case NV097_SET_OBJECT://done break; - case HLE_API_METHOD: + case NV097_HLE_API: HLE_API_handle_method(argv); break; case NV097_NO_OPERATION://done