From 4bc7c0c5a8fb15d5d639f8ca355b8d6317452d36 Mon Sep 17 00:00:00 2001 From: Lioncash Date: Tue, 29 Dec 2015 10:34:31 -0500 Subject: [PATCH] DSPCore: Prefix globals with g_ --- Source/Core/Core/DSP/DSPCore.cpp | 36 +++++++++---------- Source/Core/Core/DSP/DSPCore.h | 8 ++--- Source/Core/Core/DSP/DSPEmitter.cpp | 2 +- Source/Core/Core/DSP/DSPHWInterface.cpp | 6 ++-- Source/Core/Core/DSP/DSPInterpreter.cpp | 8 ++--- Source/Core/Core/DSP/Jit/DSPJitBranch.cpp | 4 +-- .../Core/Core/HW/DSPLLE/DSPDebugInterface.cpp | 18 +++++----- Source/Core/Core/HW/DSPLLE/DSPHost.cpp | 4 +-- Source/Core/Core/HW/DSPLLE/DSPLLE.cpp | 8 ++--- 9 files changed, 47 insertions(+), 47 deletions(-) diff --git a/Source/Core/Core/DSP/DSPCore.cpp b/Source/Core/Core/DSP/DSPCore.cpp index 3a4adb3ce5..ea2ad8e471 100644 --- a/Source/Core/Core/DSP/DSPCore.cpp +++ b/Source/Core/Core/DSP/DSPCore.cpp @@ -23,11 +23,11 @@ #include "Core/DSP/DSPIntUtil.h" SDSP g_dsp; -DSPBreakpoints dsp_breakpoints; +DSPBreakpoints g_dsp_breakpoints; static DSPCoreState core_state = DSPCORE_STOP; -u16 cyclesLeft = 0; -bool init_hax = false; -std::unique_ptr dspjit; +u16 g_cycles_left = 0; +bool g_init_hax = false; +std::unique_ptr g_dsp_jit; std::unique_ptr g_dsp_cap; static Common::Event step_event; @@ -101,8 +101,8 @@ static void DSPCore_FreeMemoryPages() bool DSPCore_Init(const DSPInitOptions& opts) { g_dsp.step_counter = 0; - cyclesLeft = 0; - init_hax = false; + g_cycles_left = 0; + g_init_hax = false; g_dsp.irom = (u16*)AllocateMemoryPages(DSP_IROM_BYTE_SIZE); g_dsp.iram = (u16*)AllocateMemoryPages(DSP_IRAM_BYTE_SIZE); @@ -147,7 +147,7 @@ bool DSPCore_Init(const DSPInitOptions& opts) // Initialize JIT, if necessary if (opts.core_type == DSPInitOptions::CORE_JIT) - dspjit = std::make_unique(); + g_dsp_jit = std::make_unique(); g_dsp_cap.reset(opts.capture_logger); @@ -162,7 +162,7 @@ void DSPCore_Shutdown() core_state = DSPCORE_STOP; - dspjit.reset(); + g_dsp_jit.reset(); DSPCore_FreeMemoryPages(); @@ -241,7 +241,7 @@ void DSPCore_CheckExceptions() // Handle state changes and stepping. int DSPCore_RunCycles(int cycles) { - if (dspjit) + if (g_dsp_jit) { if (g_dsp.external_interrupt_waiting) { @@ -250,14 +250,14 @@ int DSPCore_RunCycles(int cycles) DSPCore_SetExternalInterrupt(false); } - cyclesLeft = cycles; - DSPCompiledCode pExecAddr = (DSPCompiledCode)dspjit->enterDispatcher; + g_cycles_left = cycles; + DSPCompiledCode pExecAddr = (DSPCompiledCode)g_dsp_jit->enterDispatcher; pExecAddr(); if (g_dsp.reset_dspjit_codespace) - dspjit->ClearIRAMandDSPJITCodespaceReset(); + g_dsp_jit->ClearIRAMandDSPJITCodespaceReset(); - return cyclesLeft; + return g_cycles_left; } while (cycles > 0) @@ -313,7 +313,7 @@ void DSPCore_Step() void CompileCurrent() { - dspjit->Compile(g_dsp.pc); + g_dsp_jit->Compile(g_dsp.pc); bool retry = true; @@ -322,11 +322,11 @@ void CompileCurrent() retry = false; for (u16 i = 0x0000; i < 0xffff; ++i) { - if (!dspjit->unresolvedJumps[i].empty()) + if (!g_dsp_jit->unresolvedJumps[i].empty()) { - u16 addrToCompile = dspjit->unresolvedJumps[i].front(); - dspjit->Compile(addrToCompile); - if (!dspjit->unresolvedJumps[i].empty()) + u16 addrToCompile = g_dsp_jit->unresolvedJumps[i].front(); + g_dsp_jit->Compile(addrToCompile); + if (!g_dsp_jit->unresolvedJumps[i].empty()) retry = true; } } diff --git a/Source/Core/Core/DSP/DSPCore.h b/Source/Core/Core/DSP/DSPCore.h index c3452438e2..f673774b35 100644 --- a/Source/Core/Core/DSP/DSPCore.h +++ b/Source/Core/Core/DSP/DSPCore.h @@ -296,10 +296,10 @@ struct SDSP }; extern SDSP g_dsp; -extern DSPBreakpoints dsp_breakpoints; -extern u16 cyclesLeft; -extern bool init_hax; -extern std::unique_ptr dspjit; +extern DSPBreakpoints g_dsp_breakpoints; +extern u16 g_cycles_left; +extern bool g_init_hax; +extern std::unique_ptr g_dsp_jit; extern std::unique_ptr g_dsp_cap; struct DSPInitOptions diff --git a/Source/Core/Core/DSP/DSPEmitter.cpp b/Source/Core/Core/DSP/DSPEmitter.cpp index db27373a66..68b6ca8784 100644 --- a/Source/Core/Core/DSP/DSPEmitter.cpp +++ b/Source/Core/Core/DSP/DSPEmitter.cpp @@ -410,7 +410,7 @@ void DSPEmitter::CompileDispatcher() returnDispatcher = GetCodePtr(); // Decrement cyclesLeft - SUB(16, M(&cyclesLeft), R(EAX)); + SUB(16, M(&g_cycles_left), R(EAX)); J_CC(CC_A, dispatcherLoop); diff --git a/Source/Core/Core/DSP/DSPHWInterface.cpp b/Source/Core/Core/DSP/DSPHWInterface.cpp index cb84c1351e..905975cb8d 100644 --- a/Source/Core/Core/DSP/DSPHWInterface.cpp +++ b/Source/Core/Core/DSP/DSPHWInterface.cpp @@ -57,7 +57,7 @@ void gdsp_mbox_write_l(Mailbox mbx, u16 val) u16 gdsp_mbox_read_h(Mailbox mbx) { - if (init_hax && mbx == MAILBOX_DSP) + if (g_init_hax && mbx == MAILBOX_DSP) { return 0x8054; } @@ -70,9 +70,9 @@ u16 gdsp_mbox_read_l(Mailbox mbx) const u32 value = g_dsp.mbox[mbx].load(std::memory_order_acquire); g_dsp.mbox[mbx].store(value & ~0x80000000, std::memory_order_release); - if (init_hax && mbx == MAILBOX_DSP) + if (g_init_hax && mbx == MAILBOX_DSP) { - init_hax = false; + g_init_hax = false; DSPCore_Reset(); return 0x4348; } diff --git a/Source/Core/Core/DSP/DSPInterpreter.cpp b/Source/Core/Core/DSP/DSPInterpreter.cpp index 281e7c96a6..9e0a66dd51 100644 --- a/Source/Core/Core/DSP/DSPInterpreter.cpp +++ b/Source/Core/Core/DSP/DSPInterpreter.cpp @@ -30,7 +30,7 @@ void WriteCR(u16 val) // HAX! // OSInitAudioSystem ucode should send this mail - not DSP core itself INFO_LOG(DSPLLE,"DSP_CONTROL INIT"); - init_hax = true; + g_init_hax = true; val |= 0x800; } @@ -109,7 +109,7 @@ int RunCyclesDebug(int cycles) { if (g_dsp.cr & CR_HALT) return 0; - if (dsp_breakpoints.IsAddressBreakPoint(g_dsp.pc)) + if (g_dsp_breakpoints.IsAddressBreakPoint(g_dsp.pc)) { DSPCore_SetState(DSPCORE_STEPPING); return cycles; @@ -128,7 +128,7 @@ int RunCyclesDebug(int cycles) { if (g_dsp.cr & CR_HALT) return 0; - if (dsp_breakpoints.IsAddressBreakPoint(g_dsp.pc)) + if (g_dsp_breakpoints.IsAddressBreakPoint(g_dsp.pc)) { DSPCore_SetState(DSPCORE_STEPPING); return cycles; @@ -145,7 +145,7 @@ int RunCyclesDebug(int cycles) // Now, lets run some more without idle skipping. for (int i = 0; i < 200; i++) { - if (dsp_breakpoints.IsAddressBreakPoint(g_dsp.pc)) + if (g_dsp_breakpoints.IsAddressBreakPoint(g_dsp.pc)) { DSPCore_SetState(DSPCORE_STEPPING); return cycles; diff --git a/Source/Core/Core/DSP/Jit/DSPJitBranch.cpp b/Source/Core/Core/DSP/Jit/DSPJitBranch.cpp index a1d22d51f5..b84fc840d3 100644 --- a/Source/Core/Core/DSP/Jit/DSPJitBranch.cpp +++ b/Source/Core/Core/DSP/Jit/DSPJitBranch.cpp @@ -99,12 +99,12 @@ static void WriteBlockLink(DSPEmitter& emitter, u16 dest) { emitter.gpr.FlushRegs(); // Check if we have enough cycles to execute the next block - emitter.MOV(16, R(ECX), M(&cyclesLeft)); + emitter.MOV(16, R(ECX), M(&g_cycles_left)); emitter.CMP(16, R(ECX), Imm16(emitter.blockSize[emitter.startAddr] + emitter.blockSize[dest])); FixupBranch notEnoughCycles = emitter.J_CC(CC_BE); emitter.SUB(16, R(ECX), Imm16(emitter.blockSize[emitter.startAddr])); - emitter.MOV(16, M(&cyclesLeft), R(ECX)); + emitter.MOV(16, M(&g_cycles_left), R(ECX)); emitter.JMP(emitter.blockLinks[dest], true); emitter.SetJumpTarget(notEnoughCycles); } diff --git a/Source/Core/Core/HW/DSPLLE/DSPDebugInterface.cpp b/Source/Core/Core/HW/DSPLLE/DSPDebugInterface.cpp index d22a7d20e4..1570d68a97 100644 --- a/Source/Core/Core/HW/DSPLLE/DSPDebugInterface.cpp +++ b/Source/Core/Core/HW/DSPLLE/DSPDebugInterface.cpp @@ -75,9 +75,9 @@ bool DSPDebugInterface::IsBreakpoint(unsigned int address) { int real_addr = DSPSymbols::Line2Addr(address); if (real_addr >= 0) - return dsp_breakpoints.IsAddressBreakPoint(real_addr); - else - return false; + return g_dsp_breakpoints.IsAddressBreakPoint(real_addr); + + return false; } void DSPDebugInterface::SetBreakpoint(unsigned int address) @@ -86,7 +86,7 @@ void DSPDebugInterface::SetBreakpoint(unsigned int address) if (real_addr >= 0) { - if (dsp_breakpoints.Add(real_addr)) + if (g_dsp_breakpoints.Add(real_addr)) { } @@ -99,7 +99,7 @@ void DSPDebugInterface::ClearBreakpoint(unsigned int address) if (real_addr >= 0) { - if (dsp_breakpoints.Remove(real_addr)) + if (g_dsp_breakpoints.Remove(real_addr)) { } @@ -108,7 +108,7 @@ void DSPDebugInterface::ClearBreakpoint(unsigned int address) void DSPDebugInterface::ClearAllBreakpoints() { - dsp_breakpoints.Clear(); + g_dsp_breakpoints.Clear(); } void DSPDebugInterface::ToggleBreakpoint(unsigned int address) @@ -116,10 +116,10 @@ void DSPDebugInterface::ToggleBreakpoint(unsigned int address) int real_addr = DSPSymbols::Line2Addr(address); if (real_addr >= 0) { - if (dsp_breakpoints.IsAddressBreakPoint(real_addr)) - dsp_breakpoints.Remove(real_addr); + if (g_dsp_breakpoints.IsAddressBreakPoint(real_addr)) + g_dsp_breakpoints.Remove(real_addr); else - dsp_breakpoints.Add(real_addr); + g_dsp_breakpoints.Add(real_addr); } } diff --git a/Source/Core/Core/HW/DSPLLE/DSPHost.cpp b/Source/Core/Core/HW/DSPLLE/DSPHost.cpp index 1ab48e2cb1..213f5875b2 100644 --- a/Source/Core/Core/HW/DSPLLE/DSPHost.cpp +++ b/Source/Core/Core/HW/DSPLLE/DSPHost.cpp @@ -96,8 +96,8 @@ void CodeLoaded(const u8 *ptr, int size) UpdateDebugger(); - if (dspjit) - dspjit->ClearIRAM(); + if (g_dsp_jit) + g_dsp_jit->ClearIRAM(); DSPAnalyzer::Analyze(); } diff --git a/Source/Core/Core/HW/DSPLLE/DSPLLE.cpp b/Source/Core/Core/HW/DSPLLE/DSPLLE.cpp index 737d4ad845..d8e04a8a3b 100644 --- a/Source/Core/Core/HW/DSPLLE/DSPLLE.cpp +++ b/Source/Core/Core/HW/DSPLLE/DSPLLE.cpp @@ -83,8 +83,8 @@ void DSPLLE::DoState(PointerWrap &p) if (p.GetMode() == PointerWrap::MODE_READ) DSPHost::CodeLoaded((const u8*)g_dsp.iram, DSP_IRAM_BYTE_SIZE); p.DoArray(g_dsp.dram, DSP_DRAM_SIZE); - p.Do(cyclesLeft); - p.Do(init_hax); + p.Do(g_cycles_left); + p.Do(g_init_hax); p.Do(m_cycle_count); } @@ -99,7 +99,7 @@ void DSPLLE::DSPThread(DSPLLE* dsp_lle) if (cycles > 0) { std::lock_guard dsp_thread_lock(dsp_lle->m_csDSPThreadActive); - if (dspjit) + if (g_dsp_jit) { DSPCore_RunCycles(cycles); } @@ -176,7 +176,7 @@ bool DSPLLE::Initialize(bool bWii, bool bDSPThread) // needs to be after DSPCore_Init for the dspjit ptr if (NetPlay::IsNetPlayRunning() || Movie::IsMovieActive() || - Core::g_want_determinism || !dspjit) + Core::g_want_determinism || !g_dsp_jit) { bDSPThread = false; }