From 9fa484dbaba6035bf43509231ee058dbf0242c78 Mon Sep 17 00:00:00 2001 From: Tyler Wilding Date: Fri, 6 Nov 2020 16:00:22 -0500 Subject: [PATCH] GameDB/MSVC: renamed _Target_ to _InstrucTarget_ to avoid collisions --- pcsx2/CDVD/CDVD.cpp | 1 - pcsx2/DebugTools/DisR3000A.cpp | 6 +++--- pcsx2/Patch.cpp | 1 - pcsx2/Patch.h | 2 +- pcsx2/R3000A.h | 16 ++++++++-------- pcsx2/R5900.h | 16 ++++++++-------- pcsx2/gui/AppGameDatabase.cpp | 6 +----- pcsx2/gui/AppGameDatabase.h | 2 ++ pcsx2/x86/iR3000A.cpp | 2 +- pcsx2/x86/iR3000Atables.cpp | 4 ++-- pcsx2/x86/ix86-32/iR5900-32.cpp | 2 +- pcsx2/x86/ix86-32/iR5900Jump.cpp | 4 ++-- 12 files changed, 29 insertions(+), 33 deletions(-) diff --git a/pcsx2/CDVD/CDVD.cpp b/pcsx2/CDVD/CDVD.cpp index 0d98f0f438..c389fa8bf5 100644 --- a/pcsx2/CDVD/CDVD.cpp +++ b/pcsx2/CDVD/CDVD.cpp @@ -29,7 +29,6 @@ #include "GS.h" // for gsVideoMode #include "Elfheader.h" #include "ps2/BiosTools.h" -#include "GameDatabase.h" // This typically reflects the Sony-assigned serial code for the Disc, if one exists. // (examples: SLUS-2113, etc). diff --git a/pcsx2/DebugTools/DisR3000A.cpp b/pcsx2/DebugTools/DisR3000A.cpp index f0c93aeee3..14cd2b4c06 100644 --- a/pcsx2/DebugTools/DisR3000A.cpp +++ b/pcsx2/DebugTools/DisR3000A.cpp @@ -56,7 +56,7 @@ typedef char* (*TdisR3000AF)(u32 code, u32 pc); #undef _Rs_ #undef _Sa_ #undef _Im_ -#undef _Target_ +#undef _InstrucTarget_ #define _Funct_ ((code ) & 0x3F) // The funct part of the instruction register #define _Rd_ ((code >> 11) & 0x1F) // The rd part of the instruction register @@ -65,7 +65,7 @@ typedef char* (*TdisR3000AF)(u32 code, u32 pc); #define _Sa_ ((code >> 6) & 0x1F) // The sa part of the instruction register #define _Im_ ( code & 0xFFFF) // The immediate part of the instruction register -#define _Target_ ((pc & 0xf0000000) + ((code & 0x03ffffff) * 4)) +#define _InstrucTarget_ ((pc & 0xf0000000) + ((code & 0x03ffffff) * 4)) #define _Branch_ (pc + 4 + ((short)_Im_ * 4)) #define _OfB_ _Im_, _nRs_ @@ -75,7 +75,7 @@ typedef char* (*TdisR3000AF)(u32 code, u32 pc); #define dHI() sprintf(ostr + strlen(ostr), " %8.8x (%s),", psxRegs.GPR.n.hi, "hi") #define dLO() sprintf(ostr + strlen(ostr), " %8.8x (%s),", psxRegs.GPR.n.lo, "lo") #define dImm() sprintf(ostr + strlen(ostr), " %4.4x (%d),", _Im_, _Im_) -#define dTarget() sprintf(ostr + strlen(ostr), " %8.8x,", _Target_) +#define dTarget() sprintf(ostr + strlen(ostr), " %8.8x,", _InstrucTarget_) #define dSa() sprintf(ostr + strlen(ostr), " %2.2x (%d),", _Sa_, _Sa_) #define dOfB() sprintf(ostr + strlen(ostr), " %4.4x (%8.8x (%s)),", _Im_, psxRegs.GPR.r[_Rs_], disRNameGPR[_Rs_]) #define dOffset() sprintf(ostr + strlen(ostr), " %8.8x,", _Branch_) diff --git a/pcsx2/Patch.cpp b/pcsx2/Patch.cpp index ad37fbda67..e3127d35d9 100644 --- a/pcsx2/Patch.cpp +++ b/pcsx2/Patch.cpp @@ -19,7 +19,6 @@ #include "IopCommon.h" #include "Patch.h" -#include "GameDatabase.h" #include #include diff --git a/pcsx2/Patch.h b/pcsx2/Patch.h index 496cf3369f..7901a5259f 100644 --- a/pcsx2/Patch.h +++ b/pcsx2/Patch.h @@ -37,7 +37,7 @@ #include "Pcsx2Defs.h" #include "SysForwardDefs.h" -#include "GameDatabase.h" +#include "AppGameDatabase.h" enum patch_cpu_type { NO_CPU, diff --git a/pcsx2/R3000A.h b/pcsx2/R3000A.h index 3332e02032..1e8c272d40 100644 --- a/pcsx2/R3000A.h +++ b/pcsx2/R3000A.h @@ -135,13 +135,13 @@ extern s32 iopCycleEE; // tracks IOP's current sych status with the EE /**** R3000A Instruction Macros ****/ #define _PC_ psxRegs.pc // The next PC to be executed -#define _Funct_ ((psxRegs.code ) & 0x3F) // The funct part of the instruction register -#define _Rd_ ((psxRegs.code >> 11) & 0x1F) // The rd part of the instruction register -#define _Rt_ ((psxRegs.code >> 16) & 0x1F) // The rt part of the instruction register -#define _Rs_ ((psxRegs.code >> 21) & 0x1F) // The rs part of the instruction register -#define _Sa_ ((psxRegs.code >> 6) & 0x1F) // The sa part of the instruction register -#define _Im_ ((u16)psxRegs.code) // The immediate part of the instruction register -#define _Target_ (psxRegs.code & 0x03ffffff) // The target part of the instruction register +#define _Funct_ ((psxRegs.code ) & 0x3F) // The funct part of the instruction register +#define _Rd_ ((psxRegs.code >> 11) & 0x1F) // The rd part of the instruction register +#define _Rt_ ((psxRegs.code >> 16) & 0x1F) // The rt part of the instruction register +#define _Rs_ ((psxRegs.code >> 21) & 0x1F) // The rs part of the instruction register +#define _Sa_ ((psxRegs.code >> 6) & 0x1F) // The sa part of the instruction register +#define _Im_ ((u16)psxRegs.code) // The immediate part of the instruction register +#define _InstrucTarget_ (psxRegs.code & 0x03ffffff) // The target part of the instruction register #define _Imm_ ((short)psxRegs.code) // sign-extended immediate #define _ImmU_ (psxRegs.code&0xffff) // zero-extended immediate @@ -160,7 +160,7 @@ extern s32 iopCycleEE; // tracks IOP's current sych status with the EE #define _rHi_ psxRegs.GPR.n.hi // The HI register #define _rLo_ psxRegs.GPR.n.lo // The LO register -#define _JumpTarget_ ((_Target_ << 2) + (_PC_ & 0xf0000000)) // Calculates the target during a jump instruction +#define _JumpTarget_ ((_InstrucTarget_ << 2) + (_PC_ & 0xf0000000)) // Calculates the target during a jump instruction #define _BranchTarget_ (((s32)(s16)_Imm_ * 4) + _PC_) // Calculates the target during a branch instruction #define _SetLink(x) psxRegs.GPR.r[x] = _PC_ + 4; // Sets the return address in the link register diff --git a/pcsx2/R5900.h b/pcsx2/R5900.h index b3ee05d406..96924bbbf7 100644 --- a/pcsx2/R5900.h +++ b/pcsx2/R5900.h @@ -231,13 +231,13 @@ struct tlbs #define _PC_ cpuRegs.pc // The next PC to be executed - only used in this header and R3000A.h -#define _Funct_ ((cpuRegs.code ) & 0x3F) // The funct part of the instruction register -#define _Rd_ ((cpuRegs.code >> 11) & 0x1F) // The rd part of the instruction register -#define _Rt_ ((cpuRegs.code >> 16) & 0x1F) // The rt part of the instruction register -#define _Rs_ ((cpuRegs.code >> 21) & 0x1F) // The rs part of the instruction register -#define _Sa_ ((cpuRegs.code >> 6) & 0x1F) // The sa part of the instruction register -#define _Im_ ((u16)cpuRegs.code) // The immediate part of the instruction register -#define _Target_ (cpuRegs.code & 0x03ffffff) // The target part of the instruction register +#define _Funct_ ((cpuRegs.code ) & 0x3F) // The funct part of the instruction register +#define _Rd_ ((cpuRegs.code >> 11) & 0x1F) // The rd part of the instruction register +#define _Rt_ ((cpuRegs.code >> 16) & 0x1F) // The rt part of the instruction register +#define _Rs_ ((cpuRegs.code >> 21) & 0x1F) // The rs part of the instruction register +#define _Sa_ ((cpuRegs.code >> 6) & 0x1F) // The sa part of the instruction register +#define _Im_ ((u16)cpuRegs.code) // The immediate part of the instruction register +#define _InstrucTarget_ (cpuRegs.code & 0x03ffffff) // The target part of the instruction register #define _Imm_ ((s16)cpuRegs.code) // sign-extended immediate #define _ImmU_ (cpuRegs.code&0xffff) // zero-extended immediate @@ -245,7 +245,7 @@ struct tlbs #define _Opcode_ (cpuRegs.code >> 26 ) -#define _JumpTarget_ ((_Target_ << 2) + (_PC_ & 0xf0000000)) // Calculates the target during a jump instruction +#define _JumpTarget_ ((_InstrucTarget_ << 2) + (_PC_ & 0xf0000000)) // Calculates the target during a jump instruction #define _BranchTarget_ (((s32)(s16)_Im_ * 4) + _PC_) // Calculates the target during a branch instruction #define _TrapCode_ ((u16)cpuRegs.code >> 6) // error code for non-immediate trap instructions. diff --git a/pcsx2/gui/AppGameDatabase.cpp b/pcsx2/gui/AppGameDatabase.cpp index 90e4856df8..b9b503b594 100644 --- a/pcsx2/gui/AppGameDatabase.cpp +++ b/pcsx2/gui/AppGameDatabase.cpp @@ -17,13 +17,10 @@ #include "App.h" #include "AppGameDatabase.h" -#include "PrecompiledHeader.h" -#include "App.h" -#include "AppGameDatabase.h" + #include #include "fmt/core.h" -// TODO - check that this is being threaded properly, remove from AppGameDatabase& AppGameDatabase::LoadFromFile(const wxString& _file) { // TODO - config - kill this with fire with std::filesystem @@ -55,7 +52,6 @@ AppGameDatabase& AppGameDatabase::LoadFromFile(const wxString& _file) u64 qpc_Start = GetCPUTicks(); YamlGameDatabaseImpl gameDb = YamlGameDatabaseImpl(); - // TODO - thread the load! if (!gameDb.initDatabase(std::string(file))) { Console.Error(L"(GameDB) Database could not be loaded successfully"); diff --git a/pcsx2/gui/AppGameDatabase.h b/pcsx2/gui/AppGameDatabase.h index ac91088d16..fe304f606e 100644 --- a/pcsx2/gui/AppGameDatabase.h +++ b/pcsx2/gui/AppGameDatabase.h @@ -17,6 +17,8 @@ #include "GameDatabase.h" +#include "AppConfig.h" + class AppGameDatabase : public YamlGameDatabaseImpl { public: diff --git a/pcsx2/x86/iR3000A.cpp b/pcsx2/x86/iR3000A.cpp index e858f91f7e..ee3765d5cc 100644 --- a/pcsx2/x86/iR3000A.cpp +++ b/pcsx2/x86/iR3000A.cpp @@ -1182,7 +1182,7 @@ static void __fastcall iopRecRecompile( const u32 startpc ) case 2: // J case 3: // JAL - s_branchTo = _Target_ << 2 | (i + 4) & 0xf0000000; + s_branchTo = _InstrucTarget_ << 2 | (i + 4) & 0xf0000000; s_nEndBlock = i + 8; goto StartRecomp; diff --git a/pcsx2/x86/iR3000Atables.cpp b/pcsx2/x86/iR3000Atables.cpp index d955d898bb..fab357bb68 100644 --- a/pcsx2/x86/iR3000Atables.cpp +++ b/pcsx2/x86/iR3000Atables.cpp @@ -940,14 +940,14 @@ void rpsxMTLO() void rpsxJ() { // j target - u32 newpc = _Target_ * 4 + (psxpc & 0xf0000000); + u32 newpc = _InstrucTarget_ * 4 + (psxpc & 0xf0000000); psxRecompileNextInstruction(1); psxSetBranchImm(newpc); } void rpsxJAL() { - u32 newpc = (_Target_ << 2) + ( psxpc & 0xf0000000 ); + u32 newpc = (_InstrucTarget_ << 2) + ( psxpc & 0xf0000000 ); _psxDeleteReg(31, 0); PSX_SET_CONST(31); g_psxConstRegs[31] = psxpc + 4; diff --git a/pcsx2/x86/ix86-32/iR5900-32.cpp b/pcsx2/x86/ix86-32/iR5900-32.cpp index df2a6e1e86..9383febb44 100644 --- a/pcsx2/x86/ix86-32/iR5900-32.cpp +++ b/pcsx2/x86/ix86-32/iR5900-32.cpp @@ -1843,7 +1843,7 @@ static void __fastcall recRecompile( const u32 startpc ) case 2: // J case 3: // JAL - s_branchTo = _Target_ << 2 | (i + 4) & 0xf0000000; + s_branchTo = _InstrucTarget_ << 2 | (i + 4) & 0xf0000000; s_nEndBlock = i + 8; goto StartRecomp; diff --git a/pcsx2/x86/ix86-32/iR5900Jump.cpp b/pcsx2/x86/ix86-32/iR5900Jump.cpp index 3475639bc4..a1693b6903 100644 --- a/pcsx2/x86/ix86-32/iR5900Jump.cpp +++ b/pcsx2/x86/ix86-32/iR5900Jump.cpp @@ -50,7 +50,7 @@ void recJ() EE::Profiler.EmitOp(eeOpcode::J); // SET_FPUSTATE; - u32 newpc = (_Target_ << 2) + ( pc & 0xf0000000 ); + u32 newpc = (_InstrucTarget_ << 2) + ( pc & 0xf0000000 ); recompileNextInstruction(1); if (EmuConfig.Gamefixes.GoemonTlbHack) SetBranchImm(vtlb_V2P(newpc)); @@ -63,7 +63,7 @@ void recJAL() { EE::Profiler.EmitOp(eeOpcode::JAL); - u32 newpc = (_Target_ << 2) + ( pc & 0xf0000000 ); + u32 newpc = (_InstrucTarget_ << 2) + ( pc & 0xf0000000 ); _deleteEEreg(31, 0); if(EE_CONST_PROP) {