diff --git a/Core/Core.vcxproj b/Core/Core.vcxproj index 327f106974..cfd6c3a3d3 100644 --- a/Core/Core.vcxproj +++ b/Core/Core.vcxproj @@ -599,6 +599,7 @@ + @@ -635,4 +636,4 @@ - + \ No newline at end of file diff --git a/Core/Core.vcxproj.filters b/Core/Core.vcxproj.filters index a8d2a39962..e7f97e0803 100644 --- a/Core/Core.vcxproj.filters +++ b/Core/Core.vcxproj.filters @@ -726,6 +726,9 @@ Core + + Core + Core @@ -964,4 +967,4 @@ - \ No newline at end of file + diff --git a/Core/Debugger/DisassemblyManager.cpp b/Core/Debugger/DisassemblyManager.cpp index 96e0d46756..15bb840ef6 100644 --- a/Core/Debugger/DisassemblyManager.cpp +++ b/Core/Debugger/DisassemblyManager.cpp @@ -22,6 +22,7 @@ #include "ext/xxhash.h" #include "Common/CommonTypes.h" +#include "Core/MemMap.h" #include "Core/System.h" #include "Core/MIPS/MIPSCodeUtils.h" #include "Core/MIPS/MIPSTables.h" diff --git a/Core/HLE/HLE.h b/Core/HLE/HLE.h index b7b87343d7..85daff1fe8 100644 --- a/Core/HLE/HLE.h +++ b/Core/HLE/HLE.h @@ -18,6 +18,8 @@ #pragma once #include "Common/CommonTypes.h" +#include "Common/ChunkFile.h" +#include "Core/MemMap.h" // TODO: Try to get rid of this include. #include "Core/MIPS/MIPS.h" typedef void (* HLEFunc)(); diff --git a/Core/HLE/sceGe.h b/Core/HLE/sceGe.h index 4d81a251d5..e6884234de 100644 --- a/Core/HLE/sceGe.h +++ b/Core/HLE/sceGe.h @@ -17,6 +17,7 @@ #pragma once +#include "Core/MemMap.h" #include "Core/HLE/sceKernelThread.h" #define SCE_GE_LIST_COMPLETED 0 diff --git a/Core/HLE/sceKernelMutex.cpp b/Core/HLE/sceKernelMutex.cpp index 215f3c542d..8ebea059b7 100644 --- a/Core/HLE/sceKernelMutex.cpp +++ b/Core/HLE/sceKernelMutex.cpp @@ -18,6 +18,7 @@ #include #include #include "Common/ChunkFile.h" +#include "Core/MemMap.h" #include "Core/HLE/HLE.h" #include "Core/MIPS/MIPS.h" #include "Core/CoreTiming.h" diff --git a/Core/HLE/sceMpeg.cpp b/Core/HLE/sceMpeg.cpp index 76f1bcd308..261e72b4e7 100644 --- a/Core/HLE/sceMpeg.cpp +++ b/Core/HLE/sceMpeg.cpp @@ -83,6 +83,18 @@ static const s64 UNKNOWN_TIMESTAMP = -1; // At least 2048 bytes of MPEG data is provided when analysing the MPEG header static const int MPEG_HEADER_BUFFER_MINIMUM_SIZE = 2048; +void SceMpegAu::read(u32 addr) { + Memory::ReadStruct(addr, this); + pts = (pts & 0xFFFFFFFFULL) << 32 | (((u64)pts) >> 32); + dts = (dts & 0xFFFFFFFFULL) << 32 | (((u64)dts) >> 32); +} + +void SceMpegAu::write(u32 addr) { + pts = (pts & 0xFFFFFFFFULL) << 32 | (((u64)pts) >> 32); + dts = (dts & 0xFFFFFFFFULL) << 32 | (((u64)dts) >> 32); + Memory::WriteStruct(addr, this); +} + int getMaxAheadTimestamp(const SceMpegRingBuffer &ringbuf) { return std::max(maxAheadTimestamp, 700 * ringbuf.packets); // empiric value from JPCSP, thanks! } diff --git a/Core/HLE/sceMpeg.h b/Core/HLE/sceMpeg.h index ed7cdc352a..a1ebd83f30 100644 --- a/Core/HLE/sceMpeg.h +++ b/Core/HLE/sceMpeg.h @@ -49,17 +49,8 @@ struct SceMpegAu { u32_le esBuffer; u32_le esSize; - void read(u32 addr) { - Memory::ReadStruct(addr, this); - pts = (pts & 0xFFFFFFFFULL) << 32 | (((u64)pts) >> 32); - dts = (dts & 0xFFFFFFFFULL) << 32 | (((u64)dts) >> 32); - } - - void write(u32 addr) { - pts = (pts & 0xFFFFFFFFULL) << 32 | (((u64)pts) >> 32); - dts = (dts & 0xFFFFFFFFULL) << 32 | (((u64)dts) >> 32); - Memory::WriteStruct(addr, this); - } + void read(u32 addr); + void write(u32 addr); }; // As native in PSP ram diff --git a/Core/MIPS/ARM/ArmCompVFPU.cpp b/Core/MIPS/ARM/ArmCompVFPU.cpp index 00a57cd619..5a475a0c20 100644 --- a/Core/MIPS/ARM/ArmCompVFPU.cpp +++ b/Core/MIPS/ARM/ArmCompVFPU.cpp @@ -20,6 +20,7 @@ #include "Core/MemMap.h" #include "Core/MIPS/MIPS.h" +#include "Core/MIPS/MIPSTables.h" #include "Core/MIPS/MIPSAnalyst.h" #include "Core/MIPS/MIPSCodeUtils.h" #include "Common/CPUDetect.h" @@ -132,7 +133,7 @@ namespace MIPSComp // Prefix may say "z, z, z, z" but if this is a pair, we force to x. // TODO: But some ops seem to use const 0 instead? if (regnum >= n) { - WARN_LOG(CPU, "JIT: Invalid VFPU swizzle: %08x : %d / %d at PC = %08x (%s)", prefix, regnum, n, js.compilerPC, currentMIPS->DisasmAt(js.compilerPC)); + WARN_LOG(CPU, "JIT: Invalid VFPU swizzle: %08x : %d / %d at PC = %08x (%s)", prefix, regnum, n, js.compilerPC, MIPSDisasmAt(js.compilerPC)); regnum = 0; } diff --git a/Core/MIPS/ARM/ArmRegCache.cpp b/Core/MIPS/ARM/ArmRegCache.cpp index c8f4f86500..571bd6a194 100644 --- a/Core/MIPS/ARM/ArmRegCache.cpp +++ b/Core/MIPS/ARM/ArmRegCache.cpp @@ -15,6 +15,7 @@ // Official git repository and contact information can be found at // https://github.com/hrydgard/ppsspp and http://www.ppsspp.org/. +#include "Core/MemMap.h" #include "Core/MIPS/ARM/ArmRegCache.h" #include "Core/MIPS/ARM/ArmJit.h" #include "Core/MIPS/MIPSAnalyst.h" diff --git a/Core/MIPS/ARM/ArmRegCacheFPU.cpp b/Core/MIPS/ARM/ArmRegCacheFPU.cpp index b19b628a74..cf982f87d7 100644 --- a/Core/MIPS/ARM/ArmRegCacheFPU.cpp +++ b/Core/MIPS/ARM/ArmRegCacheFPU.cpp @@ -18,6 +18,7 @@ #include "base/logging.h" #include "Common/CPUDetect.h" #include "Core/MIPS/ARM/ArmRegCacheFPU.h" +#include "Core/MIPS/MIPSTables.h" using namespace ArmGen; @@ -478,11 +479,11 @@ ARMReg ArmRegCacheFPU::R(int mipsReg) { return (ARMReg)(mr[mipsReg].reg + S0); } else { if (mipsReg < 32) { - ERROR_LOG(JIT, "FReg %i not in ARM reg. compilerPC = %08x : %s", mipsReg, compilerPC_, currentMIPS->DisasmAt(compilerPC_)); + ERROR_LOG(JIT, "FReg %i not in ARM reg. compilerPC = %08x : %s", mipsReg, compilerPC_, MIPSDisasmAt(compilerPC_)); } else if (mipsReg < 32 + 128) { - ERROR_LOG(JIT, "VReg %i not in ARM reg. compilerPC = %08x : %s", mipsReg - 32, compilerPC_, currentMIPS->DisasmAt(compilerPC_)); + ERROR_LOG(JIT, "VReg %i not in ARM reg. compilerPC = %08x : %s", mipsReg - 32, compilerPC_, MIPSDisasmAt(compilerPC_)); } else { - ERROR_LOG(JIT, "Tempreg %i not in ARM reg. compilerPC = %08x : %s", mipsReg - 128 - 32, compilerPC_, currentMIPS->DisasmAt(compilerPC_)); + ERROR_LOG(JIT, "Tempreg %i not in ARM reg. compilerPC = %08x : %s", mipsReg - 128 - 32, compilerPC_, MIPSDisasmAt(compilerPC_)); } return INVALID_REG; // BAAAD } diff --git a/Core/MIPS/MIPS.cpp b/Core/MIPS/MIPS.cpp index 618831d82a..8de10b794a 100644 --- a/Core/MIPS/MIPS.cpp +++ b/Core/MIPS/MIPS.cpp @@ -307,9 +307,3 @@ void MIPSState::InvalidateICache(u32 address, int length) { if (MIPSComp::jit) MIPSComp::jit->ClearCacheAt(address, length); } - -const char *MIPSState::DisasmAt(u32 compilerPC) { - static char temp[256]; - MIPSDisAsm(Memory::Read_Instruction(compilerPC), 0, temp); - return temp; -} diff --git a/Core/MIPS/MIPS.h b/Core/MIPS/MIPS.h index 5b152660ac..7b21402a11 100644 --- a/Core/MIPS/MIPS.h +++ b/Core/MIPS/MIPS.h @@ -19,7 +19,8 @@ #include "util/random/rng.h" #include "Common/CommonTypes.h" -#include "Core/MemMap.h" +#include "Common/ChunkFile.h" +#include "Core/Opcode.h" typedef Memory::Opcode MIPSOpcode; @@ -188,9 +189,6 @@ public: int RunLoopUntil(u64 globalTicks); // To clear jit caches, etc. void InvalidateICache(u32 address, int length = 4); - - // for logging messages only. - const char *DisasmAt(u32 compilerPC); }; diff --git a/Core/MIPS/MIPSIntVFPU.cpp b/Core/MIPS/MIPSIntVFPU.cpp index 1d17bde308..dfa11f02ae 100644 --- a/Core/MIPS/MIPSIntVFPU.cpp +++ b/Core/MIPS/MIPSIntVFPU.cpp @@ -17,20 +17,21 @@ // TODO: Test and maybe fix: https://code.google.com/p/jpcsp/source/detail?r=3082# -#include "Core/Core.h" -#include "Core/Reporting.h" -#include "math/math_util.h" - #include - -#include "MIPS.h" -#include "MIPSInt.h" -#include "MIPSTables.h" -#include "MIPSVFPUUtils.h" - #include #include +#include "math/math_util.h" + +#include "Core/Core.h" +#include "Core/Reporting.h" +#include "Core/MemMap.h" + +#include "Core/MIPS/MIPS.h" +#include "Core/MIPS/MIPSInt.h" +#include "Core/MIPS/MIPSTables.h" +#include "Core/MIPS/MIPSVFPUUtils.h" + #define R(i) (currentMIPS->r[i]) #define V(i) (currentMIPS->v[voffset[i]]) #define VI(i) (currentMIPS->vi[voffset[i]]) @@ -114,7 +115,7 @@ void ApplyPrefixST(float *r, u32 data, VectorSize size) // Prefix may say "z, z, z, z" but if this is a pair, we force to x. // TODO: But some ops seem to use const 0 instead? if (regnum >= n) { - ERROR_LOG_REPORT(CPU, "Invalid VFPU swizzle: %08x: %i / %d at PC = %08x (%s)", data, regnum, n, currentMIPS->pc, currentMIPS->DisasmAt(currentMIPS->pc)); + ERROR_LOG_REPORT(CPU, "Invalid VFPU swizzle: %08x: %i / %d at PC = %08x (%s)", data, regnum, n, currentMIPS->pc, MIPSDisasmAt(currentMIPS->pc)); //for (int i = 0; i < 12; i++) { // ERROR_LOG(CPU, " vfpuCtrl[%i] = %08x", i, currentMIPS->vfpuCtrl[i]); //} diff --git a/Core/MIPS/MIPSTables.cpp b/Core/MIPS/MIPSTables.cpp index 224baf988b..d91411866a 100644 --- a/Core/MIPS/MIPSTables.cpp +++ b/Core/MIPS/MIPSTables.cpp @@ -17,6 +17,7 @@ #include "Core/Core.h" #include "Core/System.h" +#include "Core/MemMap.h" #include "Core/MIPS/MIPS.h" #include "Core/MIPS/MIPSDis.h" #include "Core/MIPS/MIPSDisVFPU.h" @@ -1107,3 +1108,9 @@ int MIPSGetInstructionCycleEstimate(MIPSOpcode op) else return 1; } + +const char *MIPSDisasmAt(u32 compilerPC) { + static char temp[256]; + MIPSDisAsm(Memory::Read_Instruction(compilerPC), 0, temp); + return temp; +} diff --git a/Core/MIPS/MIPSTables.h b/Core/MIPS/MIPSTables.h index 221c43fbd3..b05e04e199 100644 --- a/Core/MIPS/MIPSTables.h +++ b/Core/MIPS/MIPSTables.h @@ -105,6 +105,6 @@ MIPSInterpretFunc MIPSGetInterpretFunc(MIPSOpcode op); int MIPSGetInstructionCycleEstimate(MIPSOpcode op); const char *MIPSGetName(MIPSOpcode op); - +const char *MIPSDisasmAt(u32 compilerPC); void FillMIPSTables(); diff --git a/Core/MIPS/x86/Jit.h b/Core/MIPS/x86/Jit.h index 6007712958..4640289715 100644 --- a/Core/MIPS/x86/Jit.h +++ b/Core/MIPS/x86/Jit.h @@ -19,6 +19,7 @@ #include "Common/CommonTypes.h" #include "Common/Thunk.h" +#include "Common/ChunkFile.h" #include "Core/MIPS/x86/Asm.h" #if defined(ARM) diff --git a/Core/MemMap.h b/Core/MemMap.h index 9cbbddcad0..0556b8361a 100644 --- a/Core/MemMap.h +++ b/Core/MemMap.h @@ -23,6 +23,7 @@ #include "Common/Common.h" #include "Common/CommonTypes.h" #include "HDRemaster.h" +#include "Core/Opcode.h" // PPSSPP is very aggressive about trying to do memory accesses directly, for speed. // This can be a problem when debugging though, as stray memory reads and writes will @@ -107,32 +108,6 @@ void Shutdown(); void DoState(PointerWrap &p); void Clear(); -struct Opcode { - Opcode() { - } - - explicit Opcode(u32 v) : encoding (v) { - } - - u32 operator & (const u32 &arg) const { - return encoding & arg; - } - - u32 operator >> (const u32 &arg) const { - return encoding >> arg; - } - - bool operator == (const u32 &arg) const { - return encoding == arg; - } - - bool operator != (const u32 &arg) const { - return encoding != arg; - } - - u32 encoding; -}; - // used by JIT to read instructions. Does not resolve replacements. Opcode Read_Opcode_JIT(const u32 _Address); // used by JIT. Reads in the "Locked cache" mode diff --git a/Core/Opcode.h b/Core/Opcode.h new file mode 100644 index 0000000000..6eb01c41fc --- /dev/null +++ b/Core/Opcode.h @@ -0,0 +1,52 @@ +// Copyright (C) 2013 PPSSPP Project. + +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, version 2.0 or later versions. + +// 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 2.0 for more details. + +// A copy of the GPL 2.0 should have been included with the program. +// If not, see http://www.gnu.org/licenses/ + +// Official SVN repository and contact information can be found at +// http://code.google.com/p/dolphin-emu/ + +#pragma once + +#include "CommonTypes.h" + +// Broken out of MemMap.h to avoid a bad include dependency. + +namespace Memory { + +struct Opcode { + Opcode() { + } + + explicit Opcode(u32 v) : encoding(v) { + } + + u32 operator & (const u32 &arg) const { + return encoding & arg; + } + + u32 operator >> (const u32 &arg) const { + return encoding >> arg; + } + + bool operator == (const u32 &arg) const { + return encoding == arg; + } + + bool operator != (const u32 &arg) const { + return encoding != arg; + } + + u32 encoding; +}; + +}