diff --git a/Utilities/AutoPause.cpp b/Utilities/AutoPause.cpp index fc2e26ad6d..bab3881e33 100644 --- a/Utilities/AutoPause.cpp +++ b/Utilities/AutoPause.cpp @@ -1,5 +1,7 @@ #include "stdafx.h" #include "AutoPause.h" +#include "Utilities/Log.h" +#include "Emu/System.h" using namespace Debug; diff --git a/Utilities/AutoPause.h b/Utilities/AutoPause.h index 208097a55d..cf871b46cb 100644 --- a/Utilities/AutoPause.h +++ b/Utilities/AutoPause.h @@ -1,7 +1,4 @@ #pragma once -#include "Utilities/Log.h" -#include "Utilities/rFile.h" -#include "Emu/System.h" //Regarded as a Debugger Enchantment namespace Debug { diff --git a/Utilities/BEType.h b/Utilities/BEType.h index 8c2880c71b..e87e62379a 100644 --- a/Utilities/BEType.h +++ b/Utilities/BEType.h @@ -1,7 +1,5 @@ #pragma once -#include "Utilities/GNU.h" - #include using std::min; diff --git a/Utilities/GNU.h b/Utilities/GNU.h index 89cb3a1cfa..58074f9835 100644 --- a/Utilities/GNU.h +++ b/Utilities/GNU.h @@ -7,9 +7,9 @@ #endif #ifdef _WIN32 -#define noinline __declspec(noinline) +#define __noinline __declspec(noinline) #else -#define noinline __attribute__((noinline)) +#define __noinline __attribute__((noinline)) #endif template diff --git a/Utilities/Log.cpp b/Utilities/Log.cpp index 4613e39e8a..4d0749426e 100644 --- a/Utilities/Log.cpp +++ b/Utilities/Log.cpp @@ -1,6 +1,7 @@ #include "stdafx.h" #include "rPlatform.h" #include "Log.h" +#include "rMsgBox.h" #include #include #include diff --git a/Utilities/rFile.cpp b/Utilities/rFile.cpp index 83cad71cd0..6fcd4b4066 100644 --- a/Utilities/rFile.cpp +++ b/Utilities/rFile.cpp @@ -1,4 +1,5 @@ #include "stdafx.h" +#include "Log.h" #include #ifdef _WIN32 diff --git a/Utilities/rMsgBox.cpp b/Utilities/rMsgBox.cpp index 716464a156..cabb309e19 100644 --- a/Utilities/rMsgBox.cpp +++ b/Utilities/rMsgBox.cpp @@ -1,4 +1,5 @@ #include "stdafx.h" +#include "rMsgBox.h" #ifndef QT_UI rMessageDialog::rMessageDialog(void *parent, const std::string& msg, const std::string& title , long style ) diff --git a/Utilities/rTime.cpp b/Utilities/rTime.cpp index 21aba77740..a550516501 100644 --- a/Utilities/rTime.cpp +++ b/Utilities/rTime.cpp @@ -1,4 +1,5 @@ #include "stdafx.h" +#include "rTime.h" #include diff --git a/rpcs3/Emu/CPU/CPUDisAsm.h b/rpcs3/Emu/CPU/CPUDisAsm.h index f15a1c6258..4a7eca77c0 100644 --- a/rpcs3/Emu/CPU/CPUDisAsm.h +++ b/rpcs3/Emu/CPU/CPUDisAsm.h @@ -1,7 +1,5 @@ #pragma once -#include "Emu/Memory/Memory.h" - enum CPUDisAsmMode { CPUDisAsm_DumpMode, @@ -21,18 +19,18 @@ protected: { case CPUDisAsm_DumpMode: last_opcode = fmt::Format("\t%08llx:\t%02x %02x %02x %02x\t%s\n", dump_pc, - Memory.Read8(offset + dump_pc), - Memory.Read8(offset + dump_pc + 1), - Memory.Read8(offset + dump_pc + 2), - Memory.Read8(offset + dump_pc + 3), value.c_str()); + offset[dump_pc], + offset[dump_pc + 1], + offset[dump_pc + 2], + offset[dump_pc + 3], value.c_str()); break; case CPUDisAsm_InterpreterMode: last_opcode = fmt::Format("[%08llx] %02x %02x %02x %02x: %s", dump_pc, - Memory.Read8(offset + dump_pc), - Memory.Read8(offset + dump_pc + 1), - Memory.Read8(offset + dump_pc + 2), - Memory.Read8(offset + dump_pc + 3), value.c_str()); + offset[dump_pc], + offset[dump_pc + 1], + offset[dump_pc + 2], + offset[dump_pc + 3], value.c_str()); break; case CPUDisAsm_CompilerElfMode: @@ -44,7 +42,7 @@ protected: public: std::string last_opcode; u64 dump_pc; - u64 offset; + u8* offset; protected: CPUDisAsm(CPUDisAsmMode mode) diff --git a/rpcs3/Emu/Cell/MFC.h b/rpcs3/Emu/Cell/MFC.h index 9f93ce6104..7bd4281f7c 100644 --- a/rpcs3/Emu/Cell/MFC.h +++ b/rpcs3/Emu/Cell/MFC.h @@ -1,5 +1,4 @@ #pragma once -#include enum { diff --git a/rpcs3/Emu/Cell/PPCDisAsm.h b/rpcs3/Emu/Cell/PPCDisAsm.h index 39541d28ca..2666033919 100644 --- a/rpcs3/Emu/Cell/PPCDisAsm.h +++ b/rpcs3/Emu/Cell/PPCDisAsm.h @@ -1,7 +1,6 @@ #pragma once #include "Emu/CPU/CPUDisAsm.h" -#include "Emu/Memory/Memory.h" class PPCDisAsm : public CPUDisAsm { diff --git a/rpcs3/Emu/Cell/PPCThread.cpp b/rpcs3/Emu/Cell/PPCThread.cpp index c8f5411432..86fdb951c0 100644 --- a/rpcs3/Emu/Cell/PPCThread.cpp +++ b/rpcs3/Emu/Cell/PPCThread.cpp @@ -1,7 +1,4 @@ #include "stdafx.h" -#include "Utilities/Log.h" -#include "Emu/Memory/Memory.h" -#include "Emu/System.h" #include "PPCThread.h" PPCThread* GetCurrentPPCThread() diff --git a/rpcs3/Emu/Cell/PPCThread.h b/rpcs3/Emu/Cell/PPCThread.h index e7bc4ddbe1..e5dd118a9e 100644 --- a/rpcs3/Emu/Cell/PPCThread.h +++ b/rpcs3/Emu/Cell/PPCThread.h @@ -1,7 +1,6 @@ #pragma once -#include "Emu/Memory/MemoryBlock.h" + #include "Emu/CPU/CPUThread.h" -#include "Emu/Cell/PPCDecoder.h" class PPCThread : public CPUThread { diff --git a/rpcs3/Emu/Cell/PPUDisAsm.h b/rpcs3/Emu/Cell/PPUDisAsm.h index 5fafd6b474..34e51f7fb2 100644 --- a/rpcs3/Emu/Cell/PPUDisAsm.h +++ b/rpcs3/Emu/Cell/PPUDisAsm.h @@ -1,9 +1,6 @@ #pragma once -#include "Emu/Cell/PPUOpcodes.h" #include "Emu/Cell/PPCDisAsm.h" -#include "Emu/Cell/PPCThread.h" -#include "Emu/Memory/Memory.h" class PPUDisAsm : public PPUOpcodes diff --git a/rpcs3/Emu/Cell/SPUDisAsm.h b/rpcs3/Emu/Cell/SPUDisAsm.h index f070ff78cd..5998eb693a 100644 --- a/rpcs3/Emu/Cell/SPUDisAsm.h +++ b/rpcs3/Emu/Cell/SPUDisAsm.h @@ -2,8 +2,49 @@ #include "Emu/Cell/SPUOpcodes.h" #include "Emu/Cell/PPCDisAsm.h" -#include "Emu/Cell/SPUThread.h" -#include "Emu/Memory/Memory.h" + +static const char* spu_reg_name[128] = +{ + "$LR", "$SP", "$2", "$3", "$4", "$5", "$6", "$7", + "$8", "$9", "$10", "$11", "$12", "$13", "$14", "$15", + "$16", "$17", "$18", "$19", "$20", "$21", "$22", "$23", + "$24", "$25", "$26", "$27", "$28", "$29", "$30", "$31", + "$32", "$33", "$34", "$35", "$36", "$37", "$38", "$39", + "$40", "$41", "$42", "$43", "$44", "$45", "$46", "$47", + "$48", "$49", "$50", "$51", "$52", "$53", "$54", "$55", + "$56", "$57", "$58", "$59", "$60", "$61", "$62", "$63", + "$64", "$65", "$66", "$67", "$68", "$69", "$70", "$71", + "$72", "$73", "$74", "$75", "$76", "$77", "$78", "$79", + "$80", "$81", "$82", "$83", "$84", "$85", "$86", "$87", + "$88", "$89", "$90", "$91", "$92", "$93", "$94", "$95", + "$96", "$97", "$98", "$99", "$100", "$101", "$102", "$103", + "$104", "$105", "$106", "$107", "$108", "$109", "$110", "$111", + "$112", "$113", "$114", "$115", "$116", "$117", "$118", "$119", + "$120", "$121", "$122", "$123", "$124", "$125", "$126", "$127", +}; + +static const char* spu_ch_name[128] = +{ + "$SPU_RdEventStat", "$SPU_WrEventMask", "$SPU_WrEventAck", "$SPU_RdSigNotify1", + "$SPU_RdSigNotify2", "$ch5", "$ch6", "$SPU_WrDec", "$SPU_RdDec", + "$MFC_WrMSSyncReq", "$ch10", "$SPU_RdEventMask", "$MFC_RdTagMask", "$SPU_RdMachStat", + "$SPU_WrSRR0", "$SPU_RdSRR0", "$MFC_LSA", "$MFC_EAH", "$MFC_EAL", "$MFC_Size", + "$MFC_TagID", "$MFC_Cmd", "$MFC_WrTagMask", "$MFC_WrTagUpdate", "$MFC_RdTagStat", + "$MFC_RdListStallStat", "$MFC_WrListStallAck", "$MFC_RdAtomicStat", + "$SPU_WrOutMbox", "$SPU_RdInMbox", "$SPU_WrOutIntrMbox", "$ch31", "$ch32", + "$ch33", "$ch34", "$ch35", "$ch36", "$ch37", "$ch38", "$ch39", "$ch40", + "$ch41", "$ch42", "$ch43", "$ch44", "$ch45", "$ch46", "$ch47", "$ch48", + "$ch49", "$ch50", "$ch51", "$ch52", "$ch53", "$ch54", "$ch55", "$ch56", + "$ch57", "$ch58", "$ch59", "$ch60", "$ch61", "$ch62", "$ch63", "$ch64", + "$ch65", "$ch66", "$ch67", "$ch68", "$ch69", "$ch70", "$ch71", "$ch72", + "$ch73", "$ch74", "$ch75", "$ch76", "$ch77", "$ch78", "$ch79", "$ch80", + "$ch81", "$ch82", "$ch83", "$ch84", "$ch85", "$ch86", "$ch87", "$ch88", + "$ch89", "$ch90", "$ch91", "$ch92", "$ch93", "$ch94", "$ch95", "$ch96", + "$ch97", "$ch98", "$ch99", "$ch100", "$ch101", "$ch102", "$ch103", "$ch104", + "$ch105", "$ch106", "$ch107", "$ch108", "$ch109", "$ch110", "$ch111", "$ch112", + "$ch113", "$ch114", "$ch115", "$ch116", "$ch117", "$ch118", "$ch119", "$ch120", + "$ch121", "$ch122", "$ch123", "$ch124", "$ch125", "$ch126", "$ch127", +}; class SPUDisAsm : public SPUOpcodes diff --git a/rpcs3/Emu/Cell/SPUInterpreter.h b/rpcs3/Emu/Cell/SPUInterpreter.h index 1955137b5c..78d8b9a280 100644 --- a/rpcs3/Emu/Cell/SPUInterpreter.h +++ b/rpcs3/Emu/Cell/SPUInterpreter.h @@ -42,7 +42,7 @@ private: //0 - 10 void STOP(u32 code) { - CPU.DoStop(code); + CPU.StopAndSignal(code); LOG2_OPCODE(); } void LNOP() diff --git a/rpcs3/Emu/Cell/SPURecompiler.h b/rpcs3/Emu/Cell/SPURecompiler.h index da49ef20db..2fc927b6f5 100644 --- a/rpcs3/Emu/Cell/SPURecompiler.h +++ b/rpcs3/Emu/Cell/SPURecompiler.h @@ -1,8 +1,4 @@ #pragma once -#include "Emu/Cell/SPUOpcodes.h" -#include "Emu/Memory/Memory.h" -#include "Emu/Cell/SPUThread.h" -#include "Emu/SysCalls/SysCalls.h" #define ASMJIT_STATIC @@ -438,7 +434,7 @@ private: static void STOP(u32 code) { SPUThread& CPU = *(SPUThread*)GetCurrentCPUThread(); - CPU.DoStop(code); + CPU.StopAndSignal(code); LOG2_OPCODE(); } }; diff --git a/rpcs3/Emu/Cell/SPURecompilerCore.cpp b/rpcs3/Emu/Cell/SPURecompilerCore.cpp index 72a59dc6cf..5d9524475b 100644 --- a/rpcs3/Emu/Cell/SPURecompilerCore.cpp +++ b/rpcs3/Emu/Cell/SPURecompilerCore.cpp @@ -43,6 +43,7 @@ void SPURecompilerCore::Compile(u16 pos) u64 time0 = 0; SPUDisAsm dis_asm(CPUDisAsm_InterpreterMode); + dis_asm.offset = Memory.GetMemFromAddr(CPU.dmac.ls_offset); StringLogger stringLogger; stringLogger.setOption(kLoggerOptionBinaryForm, true); @@ -102,7 +103,7 @@ void SPURecompilerCore::Compile(u16 pos) { const u64 stamp1 = get_system_time(); // disasm for logging: - dis_asm.dump_pc = CPU.dmac.ls_offset + pos * 4; + dis_asm.dump_pc = pos * 4; (*SPU_instr::rrr_list)(&dis_asm, opcode); compiler.addComment(fmt::Format("SPU data: PC=0x%05x %s", pos * 4, dis_asm.last_opcode.c_str()).c_str()); // compile single opcode: @@ -171,21 +172,28 @@ u8 SPURecompilerCore::DecodeMemory(const u64 address) { // check data (hard way) bool is_valid = true; - /*for (u32 i = pos; i < (u32)(entry[pos].count + pos); i++) - { - if (entry[i].valid != ls[i]) - { - is_valid = false; - break; - } - }*/ + //for (u32 i = pos; i < (u32)(entry[pos].count + pos); i++) + //{ + // if (entry[i].valid != ls[i]) + // { + // is_valid = false; + // break; + // } + //} // invalidate if necessary if (!is_valid) { - // TODO - LOG_ERROR(Log::SPU, "SPURecompilerCore::DecodeMemory(ls_addr=0x%x): code has changed", pos * sizeof(u32)); - Emu.Pause(); - return 0; + for (u32 i = 0; i < 0x10000; i++) + { + if (entry[i].pointer && + i + (u32)entry[i].count > (u32)pos && + i < (u32)pos + (u32)entry[pos].count) + { + runtime.release(entry[i].pointer); + entry[i].pointer = nullptr; + } + } + //LOG_ERROR(Log::SPU, "SPURecompilerCore::DecodeMemory(ls_addr=0x%x): code has changed", pos * sizeof(u32)); } } diff --git a/rpcs3/Emu/Cell/SPUThread.h b/rpcs3/Emu/Cell/SPUThread.h index 76a804348d..1b9e4555db 100644 --- a/rpcs3/Emu/Cell/SPUThread.h +++ b/rpcs3/Emu/Cell/SPUThread.h @@ -1,5 +1,7 @@ #pragma once #include "PPUThread.h" +#include "SPUInstrTable.h" +#include "SPUDisAsm.h" #include "Emu/Event.h" #include "Emu/SysCalls/lv2/sys_spu.h" #include "Emu/SysCalls/lv2/sys_event_flag.h" @@ -8,68 +10,6 @@ #include "Emu/SysCalls/ErrorCodes.h" #include -static const char* spu_reg_name[128] = -{ - "$LR", "$SP", "$2", "$3", "$4", "$5", "$6", "$7", - "$8", "$9", "$10", "$11", "$12", "$13", "$14", "$15", - "$16", "$17", "$18", "$19", "$20", "$21", "$22", "$23", - "$24", "$25", "$26", "$27", "$28", "$29", "$30", "$31", - "$32", "$33", "$34", "$35", "$36", "$37", "$38", "$39", - "$40", "$41", "$42", "$43", "$44", "$45", "$46", "$47", - "$48", "$49", "$50", "$51", "$52", "$53", "$54", "$55", - "$56", "$57", "$58", "$59", "$60", "$61", "$62", "$63", - "$64", "$65", "$66", "$67", "$68", "$69", "$70", "$71", - "$72", "$73", "$74", "$75", "$76", "$77", "$78", "$79", - "$80", "$81", "$82", "$83", "$84", "$85", "$86", "$87", - "$88", "$89", "$90", "$91", "$92", "$93", "$94", "$95", - "$96", "$97", "$98", "$99", "$100", "$101", "$102", "$103", - "$104", "$105", "$106", "$107", "$108", "$109", "$110", "$111", - "$112", "$113", "$114", "$115", "$116", "$117", "$118", "$119", - "$120", "$121", "$122", "$123", "$124", "$125", "$126", "$127", -}; -//SPU reg $0 is a dummy reg, and is used for certain instructions. -static const char* spu_specialreg_name[128] = { - "$0", "$1", "$2", "$3", "$4", "$5", "$6", "$7", - "$8", "$9", "$10", "$11", "$12", "$13", "$14", "$15", - "$16", "$17", "$18", "$19", "$20", "$21", "$22", "$23", - "$24", "$25", "$26", "$27", "$28", "$29", "$30", "$31", - "$32", "$33", "$34", "$35", "$36", "$37", "$38", "$39", - "$40", "$41", "$42", "$43", "$44", "$45", "$46", "$47", - "$48", "$49", "$50", "$51", "$52", "$53", "$54", "$55", - "$56", "$57", "$58", "$59", "$60", "$61", "$62", "$63", - "$64", "$65", "$66", "$67", "$68", "$69", "$70", "$71", - "$72", "$73", "$74", "$75", "$76", "$77", "$78", "$79", - "$80", "$81", "$82", "$83", "$84", "$85", "$86", "$87", - "$88", "$89", "$90", "$91", "$92", "$93", "$94", "$95", - "$96", "$97", "$98", "$99", "$100", "$101", "$102", "$103", - "$104", "$105", "$106", "$107", "$108", "$109", "$110", "$111", - "$112", "$113", "$114", "$115", "$116", "$117", "$118", "$119", - "$120", "$121", "$122", "$123", "$124", "$125", "$126", "$127", -}; - -static const char* spu_ch_name[128] = -{ - "$SPU_RdEventStat", "$SPU_WrEventMask", "$SPU_WrEventAck", "$SPU_RdSigNotify1", - "$SPU_RdSigNotify2", "$ch5", "$ch6", "$SPU_WrDec", "$SPU_RdDec", - "$MFC_WrMSSyncReq", "$ch10", "$SPU_RdEventMask", "$MFC_RdTagMask", "$SPU_RdMachStat", - "$SPU_WrSRR0", "$SPU_RdSRR0", "$MFC_LSA", "$MFC_EAH", "$MFC_EAL", "$MFC_Size", - "$MFC_TagID", "$MFC_Cmd", "$MFC_WrTagMask", "$MFC_WrTagUpdate", "$MFC_RdTagStat", - "$MFC_RdListStallStat", "$MFC_WrListStallAck", "$MFC_RdAtomicStat", - "$SPU_WrOutMbox", "$SPU_RdInMbox", "$SPU_WrOutIntrMbox", "$ch31", "$ch32", - "$ch33", "$ch34", "$ch35", "$ch36", "$ch37", "$ch38", "$ch39", "$ch40", - "$ch41", "$ch42", "$ch43", "$ch44", "$ch45", "$ch46", "$ch47", "$ch48", - "$ch49", "$ch50", "$ch51", "$ch52", "$ch53", "$ch54", "$ch55", "$ch56", - "$ch57", "$ch58", "$ch59", "$ch60", "$ch61", "$ch62", "$ch63", "$ch64", - "$ch65", "$ch66", "$ch67", "$ch68", "$ch69", "$ch70", "$ch71", "$ch72", - "$ch73", "$ch74", "$ch75", "$ch76", "$ch77", "$ch78", "$ch79", "$ch80", - "$ch81", "$ch82", "$ch83", "$ch84", "$ch85", "$ch86", "$ch87", "$ch88", - "$ch89", "$ch90", "$ch91", "$ch92", "$ch93", "$ch94", "$ch95", "$ch96", - "$ch97", "$ch98", "$ch99", "$ch100", "$ch101", "$ch102", "$ch103", "$ch104", - "$ch105", "$ch106", "$ch107", "$ch108", "$ch109", "$ch110", "$ch111", "$ch112", - "$ch113", "$ch114", "$ch115", "$ch116", "$ch117", "$ch118", "$ch119", "$ch120", - "$ch121", "$ch122", "$ch123", "$ch124", "$ch125", "$ch126", "$ch127", -}; - enum SPUchannels { SPU_RdEventStat = 0, //Read event status with mask applied @@ -862,6 +802,19 @@ public: { LOG_WARNING(Log::SPU, "MFC_PUTLLC_CMD: Reservation impossibru (~x%d (mask=0x%x)) (opcode=0x%x, cmd=0x%x, lsa = 0x%x, ea = 0x%llx, tag = 0x%x, size = 0x%x)", changed, mask, op, cmd, lsa, ea, tag, size); + + SPUDisAsm dis_asm(CPUDisAsm_InterpreterMode); + for (s32 i = PC; i < PC + 4 * 7; i += 4) + { + dis_asm.dump_pc = i; + dis_asm.offset = Memory.GetMemFromAddr(dmac.ls_offset); + const u32 opcode = Memory.Read32(i + dmac.ls_offset); + (*SPU_instr::rrr_list)(&dis_asm, opcode); + if (i >= 0 && i < 0x40000) + { + LOG_NOTICE(Log::SPU, "*** %s", dis_asm.last_opcode.c_str()); + } + } } } else @@ -984,13 +937,6 @@ public: return; } - if (SPU.In_MBox.GetCount()) - { - LOG_ERROR(Log::SPU, "sys_spu_thread_send_event(v=0x%x, spup=%d): In_MBox is not empty", v, spup); - SPU.In_MBox.PushUncond(CELL_EBUSY); // ??? - return; - } - if (Ini.HLELogging.GetValue()) { LOG_NOTICE(Log::SPU, "sys_spu_thread_send_event(spup=%d, data0=0x%x, data1=0x%x)", spup, v & 0x00ffffff, data); @@ -1356,7 +1302,7 @@ public: if (Emu.IsStopped()) LOG_WARNING(Log::SPU, "%s(%s) aborted", __FUNCTION__, spu_ch_name[ch]); } - void DoStop(u32 code) + void StopAndSignal(u32 code) { SetExitStatus(code); // exit code (not status) diff --git a/rpcs3/Emu/Memory/DynamicMemoryBlockBase.h b/rpcs3/Emu/Memory/DynamicMemoryBlockBase.h index 053f28086c..edd1280808 100644 --- a/rpcs3/Emu/Memory/DynamicMemoryBlockBase.h +++ b/rpcs3/Emu/Memory/DynamicMemoryBlockBase.h @@ -170,12 +170,12 @@ bool DynamicMemoryBlockBase::Free(u64 addr) } } - LOG_ERROR(MEMORY, "DynamicMemoryBlock::Free(addr=0x%llx): failed", addr); - for (u32 i = 0; i < m_allocated.size(); i++) - { - LOG_NOTICE(MEMORY, "*** Memory Block: addr = 0x%llx, size = 0x%x", m_allocated[i].addr, m_allocated[i].size); - } - assert(0); + //LOG_ERROR(MEMORY, "DynamicMemoryBlock::Free(addr=0x%llx): failed", addr); + //for (u32 i = 0; i < m_allocated.size(); i++) + //{ + // LOG_NOTICE(MEMORY, "*** Memory Block: addr = 0x%llx, size = 0x%x", m_allocated[i].addr, m_allocated[i].size); + //} + assert(!"DynamicMemoryBlock::Free() failed"); return false; } @@ -189,7 +189,6 @@ template bool DynamicMemoryBlockBase::IsLocked(u64 addr) { // TODO - LOG_ERROR(MEMORY, "IsLocked(0x%llx) not implemented", addr); assert(0); return false; } @@ -198,7 +197,6 @@ template bool DynamicMemoryBlockBase::Lock(u64 addr, u32 size) { // TODO - LOG_ERROR(MEMORY, "Lock(0x%llx, 0x%x) not implemented", addr, size); assert(0); return false; } @@ -207,7 +205,6 @@ template bool DynamicMemoryBlockBase::Unlock(u64 addr, u32 size) { // TODO - LOG_ERROR(MEMORY, "Unlock(0x%llx, 0x%x) not implemented", addr, size); assert(0); return false; } diff --git a/rpcs3/Emu/Memory/Memory.cpp b/rpcs3/Emu/Memory/Memory.cpp index 8fbae6c536..c60abe9f7c 100644 --- a/rpcs3/Emu/Memory/Memory.cpp +++ b/rpcs3/Emu/Memory/Memory.cpp @@ -8,6 +8,207 @@ MemoryBase Memory; +void MemoryBase::InvalidAddress(const char* func, const u64 addr) +{ + LOG_ERROR(MEMORY, "%s(): invalid address (0x%llx)", func, addr); +} + +void MemoryBase::RegisterPages(u64 addr, u32 size) +{ + std::lock_guard lock(m_mutex); + + //LOG_NOTICE(MEMORY, "RegisterPages(addr=0x%llx, size=0x%x)", addr, size); + for (u64 i = addr / 4096; i < (addr + size) / 4096; i++) + { + if (i >= sizeof(m_pages) / sizeof(m_pages[0])) + { + InvalidAddress(__FUNCTION__, i * 4096); + break; + } + if (m_pages[i]) + { + LOG_ERROR(MEMORY, "Page already registered (addr=0x%llx)", i * 4096); + } + m_pages[i] = 1; // TODO: define page parameters + } +} + +void MemoryBase::UnregisterPages(u64 addr, u32 size) +{ + std::lock_guard lock(m_mutex); + + //LOG_NOTICE(MEMORY, "UnregisterPages(addr=0x%llx, size=0x%x)", addr, size); + for (u64 i = addr / 4096; i < (addr + size) / 4096; i++) + { + if (i >= sizeof(m_pages) / sizeof(m_pages[0])) + { + InvalidAddress(__FUNCTION__, i * 4096); + break; + } + if (!m_pages[i]) + { + LOG_ERROR(MEMORY, "Page not registered (addr=0x%llx)", i * 4096); + } + m_pages[i] = 0; // TODO: define page parameters + } +} + +u32 MemoryBase::InitRawSPU(MemoryBlock* raw_spu) +{ + std::lock_guard lock(m_mutex); + + u32 index; + for (index = 0; index < sizeof(RawSPUMem) / sizeof(RawSPUMem[0]); index++) + { + if (!RawSPUMem[index]) + { + RawSPUMem[index] = raw_spu; + break; + } + } + + MemoryBlocks.push_back(raw_spu->SetRange(RAW_SPU_BASE_ADDR + RAW_SPU_OFFSET * index, RAW_SPU_PROB_OFFSET)); + return index; +} + +void MemoryBase::CloseRawSPU(MemoryBlock* raw_spu, const u32 num) +{ + std::lock_guard lock(m_mutex); + + for (int i = 0; i < MemoryBlocks.size(); ++i) + { + if (MemoryBlocks[i] == raw_spu) + { + MemoryBlocks.erase(MemoryBlocks.begin() + i); + break; + } + } + if (num < sizeof(RawSPUMem) / sizeof(RawSPUMem[0])) RawSPUMem[num] = nullptr; +} + +void MemoryBase::Init(MemoryType type) +{ + std::lock_guard lock(m_mutex); + + if (m_inited) return; + m_inited = true; + + memset(m_pages, 0, sizeof(m_pages)); + memset(RawSPUMem, 0, sizeof(RawSPUMem)); + +#ifdef _WIN32 + m_base_addr = VirtualAlloc(nullptr, 0x100000000, MEM_RESERVE, PAGE_NOACCESS); + if (!m_base_addr) +#else + m_base_addr = ::mmap(nullptr, 0x100000000, PROT_NONE, MAP_PRIVATE | MAP_ANONYMOUS, 0, 0); + if (m_base_addr == (void*)-1) +#endif + { + m_base_addr = nullptr; + LOG_ERROR(MEMORY, "Initializing memory failed"); + assert(0); + return; + } + else + { + LOG_NOTICE(MEMORY, "Initializing memory: m_base_addr = 0x%llx", (u64)m_base_addr); + } + + switch (type) + { + case Memory_PS3: + MemoryBlocks.push_back(MainMem.SetRange(0x00010000, 0x2FFF0000)); + MemoryBlocks.push_back(UserMemory = PRXMem.SetRange(0x30000000, 0x10000000)); + MemoryBlocks.push_back(RSXCMDMem.SetRange(0x40000000, 0x10000000)); + MemoryBlocks.push_back(MmaperMem.SetRange(0xB0000000, 0x10000000)); + MemoryBlocks.push_back(RSXFBMem.SetRange(0xC0000000, 0x10000000)); + MemoryBlocks.push_back(StackMem.SetRange(0xD0000000, 0x10000000)); + break; + + case Memory_PSV: + MemoryBlocks.push_back(PSV.RAM.SetRange(0x81000000, 0x10000000)); + MemoryBlocks.push_back(UserMemory = PSV.Userspace.SetRange(0x91000000, 0x10000000)); + PSV.Init(GetBaseAddr()); + break; + + case Memory_PSP: + MemoryBlocks.push_back(PSP.Scratchpad.SetRange(0x00010000, 0x00004000)); + MemoryBlocks.push_back(PSP.VRAM.SetRange(0x04000000, 0x00200000)); + MemoryBlocks.push_back(PSP.RAM.SetRange(0x08000000, 0x02000000)); + MemoryBlocks.push_back(PSP.Kernel.SetRange(0x88000000, 0x00800000)); + MemoryBlocks.push_back(UserMemory = PSP.Userspace.SetRange(0x08800000, 0x01800000)); + PSP.Init(GetBaseAddr()); + break; + } + + LOG_NOTICE(MEMORY, "Memory initialized."); +} + +void MemoryBase::Close() +{ + std::lock_guard lock(m_mutex); + + if (!m_inited) return; + m_inited = false; + + LOG_NOTICE(MEMORY, "Closing memory..."); + + for (auto block : MemoryBlocks) + { + block->Delete(); + } + + RSXIOMem.Delete(); + + MemoryBlocks.clear(); + +#ifdef _WIN32 + if (!VirtualFree(m_base_addr, 0, MEM_RELEASE)) + { + LOG_ERROR(MEMORY, "VirtualFree(0x%llx) failed", (u64)m_base_addr); + } +#else + if (::munmap(m_base_addr, 0x100000000)) + { + LOG_ERROR(MEMORY, "::munmap(0x%llx) failed", (u64)m_base_addr); + } +#endif +} + +bool MemoryBase::Map(const u64 dst_addr, const u64 src_addr, const u32 size) +{ + std::lock_guard lock(m_mutex); + + if (IsGoodAddr(dst_addr) || !IsGoodAddr(src_addr)) + { + return false; + } + + MemoryBlocks.push_back((new MemoryMirror())->SetRange(GetMemFromAddr(src_addr), dst_addr, size)); + LOG_WARNING(MEMORY, "memory mapped 0x%llx to 0x%llx size=0x%x", src_addr, dst_addr, size); + return true; +} + +bool MemoryBase::Unmap(const u64 addr) +{ + std::lock_guard lock(m_mutex); + + bool result = false; + for (uint i = 0; iIsMirror()) + { + if (MemoryBlocks[i]->GetStartAddr() == addr) + { + delete MemoryBlocks[i]; + MemoryBlocks.erase(MemoryBlocks.begin() + i); + return true; + } + } + } + return false; +} + MemBlockInfo::MemBlockInfo(u64 _addr, u32 _size) : MemInfo(_addr, PAGE_4K(_size)) { diff --git a/rpcs3/Emu/Memory/Memory.h b/rpcs3/Emu/Memory/Memory.h index 9fe3523fb2..8f09a50869 100644 --- a/rpcs3/Emu/Memory/Memory.h +++ b/rpcs3/Emu/Memory/Memory.h @@ -6,7 +6,6 @@ #include "MemoryBlock.h" #include "Emu/SysCalls/Callback.h" -#include /* OS X uses MAP_ANON instead of MAP_ANONYMOUS */ #ifndef MAP_ANONYMOUS @@ -107,50 +106,11 @@ public: return m_base_addr; } - noinline void InvalidAddress(const char* func, const u64 addr) - { - LOG_ERROR(MEMORY, "%s(): invalid address (0x%llx)", func, addr); - } + __noinline void InvalidAddress(const char* func, const u64 addr); - void RegisterPages(u64 addr, u32 size) - { - std::lock_guard lock(m_mutex); + void RegisterPages(u64 addr, u32 size); - //LOG_NOTICE(MEMORY, "RegisterPages(addr=0x%llx, size=0x%x)", addr, size); - for (u64 i = addr / 4096; i < (addr + size) / 4096; i++) - { - if (i >= sizeof(m_pages) / sizeof(m_pages[0])) - { - InvalidAddress(__FUNCTION__, i * 4096); - break; - } - if (m_pages[i]) - { - LOG_ERROR(MEMORY, "Page already registered (addr=0x%llx)", i * 4096); - } - m_pages[i] = 1; // TODO: define page parameters - } - } - - void UnregisterPages(u64 addr, u32 size) - { - std::lock_guard lock(m_mutex); - - //LOG_NOTICE(MEMORY, "UnregisterPages(addr=0x%llx, size=0x%x)", addr, size); - for (u64 i = addr / 4096; i < (addr + size) / 4096; i++) - { - if (i >= sizeof(m_pages) / sizeof(m_pages[0])) - { - InvalidAddress(__FUNCTION__, i * 4096); - break; - } - if (!m_pages[i]) - { - LOG_ERROR(MEMORY, "Page not registered (addr=0x%llx)", i * 4096); - } - m_pages[i] = 0; // TODO: define page parameters - } - } + void UnregisterPages(u64 addr, u32 size); static __forceinline u16 Reverse16(const u16 val) { @@ -215,96 +175,11 @@ public: } } - u32 InitRawSPU(MemoryBlock* raw_spu) - { - std::lock_guard lock(m_mutex); + u32 InitRawSPU(MemoryBlock* raw_spu); - u32 index; - for (index = 0; index < sizeof(RawSPUMem) / sizeof(RawSPUMem[0]); index++) - { - if (!RawSPUMem[index]) - { - RawSPUMem[index] = raw_spu; - break; - } - } + void CloseRawSPU(MemoryBlock* raw_spu, const u32 num); - MemoryBlocks.push_back(raw_spu->SetRange(RAW_SPU_BASE_ADDR + RAW_SPU_OFFSET * index, RAW_SPU_PROB_OFFSET)); - return index; - } - - void CloseRawSPU(MemoryBlock* raw_spu, const u32 num) - { - std::lock_guard lock(m_mutex); - - for (int i = 0; i < MemoryBlocks.size(); ++i) - { - if (MemoryBlocks[i] == raw_spu) - { - MemoryBlocks.erase(MemoryBlocks.begin() + i); - break; - } - } - if (num < sizeof(RawSPUMem) / sizeof(RawSPUMem[0])) RawSPUMem[num] = nullptr; - } - - void Init(MemoryType type) - { - std::lock_guard lock(m_mutex); - - if(m_inited) return; - m_inited = true; - - memset(m_pages, 0, sizeof(m_pages)); - memset(RawSPUMem, 0, sizeof(RawSPUMem)); - -#ifdef _WIN32 - m_base_addr = VirtualAlloc(nullptr, 0x100000000, MEM_RESERVE, PAGE_NOACCESS); - if (!m_base_addr) -#else - m_base_addr = ::mmap(nullptr, 0x100000000, PROT_NONE, MAP_PRIVATE | MAP_ANONYMOUS, 0, 0); - if (m_base_addr == (void*)-1) -#endif - { - m_base_addr = nullptr; - LOG_ERROR(MEMORY, "Initializing memory failed"); - assert(0); - return; - } - else - { - LOG_NOTICE(MEMORY, "Initializing memory: m_base_addr = 0x%llx", (u64)m_base_addr); - } - - switch(type) - { - case Memory_PS3: - MemoryBlocks.push_back(MainMem.SetRange(0x00010000, 0x2FFF0000)); - MemoryBlocks.push_back(UserMemory = PRXMem.SetRange(0x30000000, 0x10000000)); - MemoryBlocks.push_back(RSXCMDMem.SetRange(0x40000000, 0x10000000)); - MemoryBlocks.push_back(MmaperMem.SetRange(0xB0000000, 0x10000000)); - MemoryBlocks.push_back(RSXFBMem.SetRange(0xC0000000, 0x10000000)); - MemoryBlocks.push_back(StackMem.SetRange(0xD0000000, 0x10000000)); - break; - - case Memory_PSV: - MemoryBlocks.push_back(PSV.RAM.SetRange(0x81000000, 0x10000000)); - MemoryBlocks.push_back(UserMemory = PSV.Userspace.SetRange(0x91000000, 0x10000000)); - PSV.Init(GetBaseAddr()); - break; - - case Memory_PSP: - MemoryBlocks.push_back(PSP.Scratchpad.SetRange(0x00010000, 0x00004000)); - MemoryBlocks.push_back(PSP.VRAM.SetRange(0x04000000, 0x00200000)); - MemoryBlocks.push_back(PSP.RAM.SetRange(0x08000000, 0x02000000)); - MemoryBlocks.push_back(PSP.Kernel.SetRange(0x88000000, 0x00800000)); - MemoryBlocks.push_back(UserMemory = PSP.Userspace.SetRange(0x08800000, 0x01800000)); - PSP.Init(GetBaseAddr()); - break; - } - - LOG_NOTICE(MEMORY, "Memory initialized."); - } + void Init(MemoryType type); template bool IsGoodAddr(const T addr) { @@ -334,36 +209,7 @@ public: } } - void Close() - { - std::lock_guard lock(m_mutex); - - if(!m_inited) return; - m_inited = false; - - LOG_NOTICE(MEMORY, "Closing memory..."); - - for (auto block : MemoryBlocks) - { - block->Delete(); - } - - RSXIOMem.Delete(); - - MemoryBlocks.clear(); - -#ifdef _WIN32 - if (!VirtualFree(m_base_addr, 0, MEM_RELEASE)) - { - LOG_ERROR(MEMORY, "VirtualFree(0x%llx) failed", (u64)m_base_addr); - } -#else - if (::munmap(m_base_addr, 0x100000000)) - { - LOG_ERROR(MEMORY, "::munmap(0x%llx) failed", (u64)m_base_addr); - } -#endif - } + void Close(); //MemoryBase template void Write8(T addr, const u8 data) @@ -392,7 +238,7 @@ public: } } - noinline void WriteMMIO32(u32 addr, const u32 data) + __noinline void WriteMMIO32(u32 addr, const u32 data) { { std::lock_guard lock(m_mutex); @@ -479,7 +325,7 @@ public: } } - noinline u32 ReadMMIO32(u32 addr) + __noinline u32 ReadMMIO32(u32 addr) { u32 res; { @@ -624,39 +470,9 @@ public: return UserMemory->Unlock(addr, size); } - bool Map(const u64 dst_addr, const u64 src_addr, const u32 size) - { - std::lock_guard lock(m_mutex); + bool Map(const u64 dst_addr, const u64 src_addr, const u32 size); - if(IsGoodAddr(dst_addr) || !IsGoodAddr(src_addr)) - { - return false; - } - - MemoryBlocks.push_back((new MemoryMirror())->SetRange(GetMemFromAddr(src_addr), dst_addr, size)); - LOG_WARNING(MEMORY, "memory mapped 0x%llx to 0x%llx size=0x%x", src_addr, dst_addr, size); - return true; - } - - bool Unmap(const u64 addr) - { - std::lock_guard lock(m_mutex); - - bool result = false; - for(uint i=0; iIsMirror()) - { - if(MemoryBlocks[i]->GetStartAddr() == addr) - { - delete MemoryBlocks[i]; - MemoryBlocks.erase(MemoryBlocks.begin() + i); - return true; - } - } - } - return false; - } + bool Unmap(const u64 addr); template void* operator + (const T vaddr) { diff --git a/rpcs3/Emu/SysCalls/Modules/cellGame.cpp b/rpcs3/Emu/SysCalls/Modules/cellGame.cpp index 86611c8edb..085cadb5b0 100644 --- a/rpcs3/Emu/SysCalls/Modules/cellGame.cpp +++ b/rpcs3/Emu/SysCalls/Modules/cellGame.cpp @@ -1,5 +1,6 @@ #include "stdafx.h" #include "Utilities/Log.h" +#include "Utilities/rMsgBox.h" #include "Emu/Memory/Memory.h" #include "Emu/System.h" #include "Emu/SysCalls/SC_FUNC.h" diff --git a/rpcs3/Emu/SysCalls/Modules/cellGem.cpp b/rpcs3/Emu/SysCalls/Modules/cellGem.cpp index 24b5897885..9eba668afa 100644 --- a/rpcs3/Emu/SysCalls/Modules/cellGem.cpp +++ b/rpcs3/Emu/SysCalls/Modules/cellGem.cpp @@ -1,4 +1,5 @@ #include "stdafx.h" +#include "Utilities/Log.h" #include "Emu/SysCalls/Modules.h" #include "Emu/SysCalls/SysCalls.h" #include "cellGem.h" diff --git a/rpcs3/Emu/SysCalls/Modules/cellMsgDialog.cpp b/rpcs3/Emu/SysCalls/Modules/cellMsgDialog.cpp index 21d1d4515a..130efd009c 100644 --- a/rpcs3/Emu/SysCalls/Modules/cellMsgDialog.cpp +++ b/rpcs3/Emu/SysCalls/Modules/cellMsgDialog.cpp @@ -1,5 +1,6 @@ #include "stdafx.h" #include "Utilities/Log.h" +#include "Utilities/rMsgBox.h" #include "Emu/Memory/Memory.h" #include "Emu/System.h" #include "Emu/SysCalls/Modules.h" diff --git a/rpcs3/Emu/SysCalls/Modules/cellRtc.cpp b/rpcs3/Emu/SysCalls/Modules/cellRtc.cpp index f16dc3752f..529a62f129 100644 --- a/rpcs3/Emu/SysCalls/Modules/cellRtc.cpp +++ b/rpcs3/Emu/SysCalls/Modules/cellRtc.cpp @@ -1,5 +1,6 @@ #include "stdafx.h" #include "Utilities/Log.h" +#include "Utilities/rTime.h" #include "Emu/Memory/Memory.h" #include "Emu/SysCalls/Modules.h" diff --git a/rpcs3/Emu/SysCalls/Modules/sceNpClans.cpp b/rpcs3/Emu/SysCalls/Modules/sceNpClans.cpp index 5a6b204fbf..ba6d779920 100644 --- a/rpcs3/Emu/SysCalls/Modules/sceNpClans.cpp +++ b/rpcs3/Emu/SysCalls/Modules/sceNpClans.cpp @@ -1,4 +1,5 @@ #include "stdafx.h" +#include "Utilities/Log.h" #include "Emu/SysCalls/Modules.h" #include "Emu/System.h" #include "cellRtc.h" diff --git a/rpcs3/Emu/SysCalls/Modules/sceNpCommerce2.cpp b/rpcs3/Emu/SysCalls/Modules/sceNpCommerce2.cpp index 2e0777cdfd..db17213a60 100644 --- a/rpcs3/Emu/SysCalls/Modules/sceNpCommerce2.cpp +++ b/rpcs3/Emu/SysCalls/Modules/sceNpCommerce2.cpp @@ -1,4 +1,5 @@ #include "stdafx.h" +#include "Utilities/Log.h" #include "Emu/SysCalls/Modules.h" #include "cellRtc.h" #include "sceNpCommerce2.h" diff --git a/rpcs3/Emu/SysCalls/Modules/sceNpSns.cpp b/rpcs3/Emu/SysCalls/Modules/sceNpSns.cpp index a5930c192d..bb7e7ba139 100644 --- a/rpcs3/Emu/SysCalls/Modules/sceNpSns.cpp +++ b/rpcs3/Emu/SysCalls/Modules/sceNpSns.cpp @@ -1,4 +1,5 @@ #include "stdafx.h" +#include "Utilities/Log.h" #include "Emu/SysCalls/Modules.h" #include "sceNpSns.h" diff --git a/rpcs3/Emu/SysCalls/Modules/sceNpTus.cpp b/rpcs3/Emu/SysCalls/Modules/sceNpTus.cpp index ddd66df6c9..dccdecf547 100644 --- a/rpcs3/Emu/SysCalls/Modules/sceNpTus.cpp +++ b/rpcs3/Emu/SysCalls/Modules/sceNpTus.cpp @@ -1,4 +1,5 @@ #include "stdafx.h" +#include "Utilities/Log.h" #include "Emu/SysCalls/Modules.h" #include "cellRtc.h" #include "sceNp.h" diff --git a/rpcs3/Emu/SysCalls/lv2/sys_mutex.cpp b/rpcs3/Emu/SysCalls/lv2/sys_mutex.cpp index fed9b6d3cd..76aea8b150 100644 --- a/rpcs3/Emu/SysCalls/lv2/sys_mutex.cpp +++ b/rpcs3/Emu/SysCalls/lv2/sys_mutex.cpp @@ -9,6 +9,23 @@ SysCallBase sys_mtx("sys_mutex"); +Mutex::~Mutex() +{ + if (u32 owner = m_mutex.GetOwner()) + { + LOG_NOTICE(HLE, "Mutex(%d) was owned by thread %d (recursive=%d)", id, owner, recursive); + } + + if (!m_queue.m_mutex.try_lock()) return; + + for (u32 i = 0; i < m_queue.list.size(); i++) + { + if (u32 owner = m_queue.list[i]) LOG_NOTICE(HLE, "Mutex(%d) was waited by thread %d", id, owner); + } + + m_queue.m_mutex.unlock(); +} + s32 sys_mutex_create(mem32_t mutex_id, mem_ptr_t attr) { sys_mtx.Log("sys_mutex_create(mutex_id_addr=0x%x, attr_addr=0x%x)", mutex_id.GetAddr(), attr.GetAddr()); diff --git a/rpcs3/Emu/SysCalls/lv2/sys_mutex.h b/rpcs3/Emu/SysCalls/lv2/sys_mutex.h index fb91773145..b2813e41d2 100644 --- a/rpcs3/Emu/SysCalls/lv2/sys_mutex.h +++ b/rpcs3/Emu/SysCalls/lv2/sys_mutex.h @@ -36,22 +36,7 @@ struct Mutex { } - ~Mutex() - { - if (u32 owner = m_mutex.GetOwner()) - { - LOG_NOTICE(HLE, "Mutex(%d) was owned by thread %d (recursive=%d)", id, owner, recursive); - } - - if (!m_queue.m_mutex.try_lock()) return; - - for (u32 i = 0; i < m_queue.list.size(); i++) - { - if (u32 owner = m_queue.list[i]) LOG_NOTICE(HLE, "Mutex(%d) was waited by thread %d", id, owner); - } - - m_queue.m_mutex.unlock(); - } + ~Mutex(); }; // SysCalls diff --git a/rpcs3/Gui/AutoPauseManager.cpp b/rpcs3/Gui/AutoPauseManager.cpp index 98235314fa..67a43f2817 100644 --- a/rpcs3/Gui/AutoPauseManager.cpp +++ b/rpcs3/Gui/AutoPauseManager.cpp @@ -1,6 +1,11 @@ #include "stdafx.h" #include "Emu/System.h" #include "AutoPauseManager.h" +#include "stdafx.h" +#include +#include +#include "Utilities/Log.h" +#include "Utilities/rFile.h" enum { diff --git a/rpcs3/Gui/AutoPauseManager.h b/rpcs3/Gui/AutoPauseManager.h index a1b8f00450..c3b207b237 100644 --- a/rpcs3/Gui/AutoPauseManager.h +++ b/rpcs3/Gui/AutoPauseManager.h @@ -1,9 +1,4 @@ #pragma once -#include "stdafx.h" -#include -#include -#include "Utilities/Log.h" -#include "Utilities/rFile.h" class AutoPauseManagerDialog : public wxDialog { diff --git a/rpcs3/Gui/CompilerELF.cpp b/rpcs3/Gui/CompilerELF.cpp index c67dfe0703..c4b388283b 100644 --- a/rpcs3/Gui/CompilerELF.cpp +++ b/rpcs3/Gui/CompilerELF.cpp @@ -1,5 +1,6 @@ #include "stdafx.h" #include "Utilities/Log.h" +#include "Utilities/rMsgBox.h" #include "Emu/Memory/Memory.h" #include "Emu/System.h" #include "CompilerELF.h" diff --git a/rpcs3/Gui/ConLogFrame.cpp b/rpcs3/Gui/ConLogFrame.cpp index 0e2ee848e5..f219b0e114 100644 --- a/rpcs3/Gui/ConLogFrame.cpp +++ b/rpcs3/Gui/ConLogFrame.cpp @@ -7,14 +7,8 @@ #include #include "Ini.h" -#include "Utilities/Thread.h" -#include "Utilities/StrFmt.h" -#include "Utilities/Log.h" -#include "Utilities/Log.h" #include "Gui/ConLogFrame.h" -#include "Utilities/BEType.h" -#include "Emu/Memory/Memory.h" #include "Emu/System.h" wxDEFINE_EVENT(EVT_LOG_COMMAND, wxCommandEvent); diff --git a/rpcs3/Gui/GLGSFrame.cpp b/rpcs3/Gui/GLGSFrame.cpp index d5205f029e..50c7c8a2db 100644 --- a/rpcs3/Gui/GLGSFrame.cpp +++ b/rpcs3/Gui/GLGSFrame.cpp @@ -1,5 +1,6 @@ #include "stdafx.h" #include "GLGSFrame.h" +#include "Utilities/Timer.h" GLGSFrame::GLGSFrame() : GSFrame(nullptr, "GSFrame[OpenGL]") diff --git a/rpcs3/Gui/InterpreterDisAsm.cpp b/rpcs3/Gui/InterpreterDisAsm.cpp index ee1ffdb535..b856d1f0cc 100644 --- a/rpcs3/Gui/InterpreterDisAsm.cpp +++ b/rpcs3/Gui/InterpreterDisAsm.cpp @@ -249,7 +249,7 @@ void InterpreterDisAsmFrame::ShowAddr(const u64 addr) } else { - disasm->offset = CPU->GetOffset(); + disasm->offset = Memory.GetMemFromAddr(CPU->GetOffset()); for(uint i=0, count = 4; iGetOffset() + PC, 4)) diff --git a/rpcs3/Gui/SaveDataUtility.cpp b/rpcs3/Gui/SaveDataUtility.cpp index 46ca644106..2bebd478ad 100644 --- a/rpcs3/Gui/SaveDataUtility.cpp +++ b/rpcs3/Gui/SaveDataUtility.cpp @@ -1,5 +1,10 @@ #include "stdafx.h" #include "SaveDataUtility.h" +#include "stdafx.h" +#include +#include +#include "Utilities/Log.h" +#include "Utilities/rFile.h" //Cause i can not decide what struct to be used to fill those. Just use no real data now. //Currently variable info isn't used. it supposed to be a container for the information passed by other. diff --git a/rpcs3/Gui/SaveDataUtility.h b/rpcs3/Gui/SaveDataUtility.h index 88037add29..38a9bbbd1b 100644 --- a/rpcs3/Gui/SaveDataUtility.h +++ b/rpcs3/Gui/SaveDataUtility.h @@ -1,9 +1,4 @@ #pragma once -#include "stdafx.h" -#include -#include -#include "Utilities/Log.h" -#include "Utilities/rFile.h" //TODO: Implement function calls related to Save Data List. //Those function calls may be needed to use this GUI. diff --git a/rpcs3/Loader/PKG.cpp b/rpcs3/Loader/PKG.cpp index c07e43a5fa..11fa014e20 100644 --- a/rpcs3/Loader/PKG.cpp +++ b/rpcs3/Loader/PKG.cpp @@ -1,5 +1,6 @@ #include "stdafx.h" #include "Utilities/Log.h" +#include "Utilities/rMsgBox.h" #include "PKG.h" #include "../Crypto/unpkg.h" diff --git a/rpcs3/rpcs3.cpp b/rpcs3/rpcs3.cpp index 4ea8af5587..f6190d5a82 100644 --- a/rpcs3/rpcs3.cpp +++ b/rpcs3/rpcs3.cpp @@ -1,6 +1,4 @@ #include "stdafx.h" -#include "Utilities/Log.h" -#include "Emu/Memory/Memory.h" #include "Emu/System.h" #include "rpcs3.h" #include "Ini.h" diff --git a/rpcs3/stdafx.h b/rpcs3/stdafx.h index 0b5741fae2..87b832626f 100644 --- a/rpcs3/stdafx.h +++ b/rpcs3/stdafx.h @@ -56,13 +56,10 @@ typedef int32_t s32; typedef int64_t s64; #include "Utilities/StrFmt.h" -#include "Utilities/Log.h" +#include "Utilities/GNU.h" #include "Utilities/BEType.h" #include "Utilities/rFile.h" -#include "Utilities/rTime.h" -#include "Utilities/rMsgBox.h" #include "Utilities/Thread.h" -#include "Utilities/Timer.h" #include "Utilities/IdManager.h" #define _PRGNAME_ "RPCS3"