diff --git a/Core/HLE/HLETables.cpp b/Core/HLE/HLETables.cpp index df6bf26f3e..ac615914cf 100644 --- a/Core/HLE/HLETables.cpp +++ b/Core/HLE/HLETables.cpp @@ -88,16 +88,7 @@ // #include "sceNp2.h" #include "sceNet_lib.h" -#define N(s) s - -//\*\*\ found\:\ {[a-zA-Z]*}\ {0x[a-zA-Z0-9]*}\ \*\* -//{FID(\2),0,N("\1")}, - -//Metal Gear Acid modules: -//kjfs -//sound -//zlibdec -const HLEFunction FakeSysCalls[] = { +static const HLEFunction FakeSysCalls[] = { {NID_THREADRETURN, __KernelReturnFromThread, "__KernelReturnFromThread", 'x', ""}, {NID_CALLBACKRETURN, __KernelReturnFromMipsCall, "__KernelReturnFromMipsCall", 'x', ""}, {NID_INTERRUPTRETURN, __KernelReturnFromInterrupt, "__KernelReturnFromInterrupt", 'x', ""}, @@ -108,8 +99,7 @@ const HLEFunction FakeSysCalls[] = { {NID_HLECALLRETURN, HLEReturnFromMipsCall, "HLEReturnFromMipsCall", 'x', ""}, }; -const HLEFunction UtilsForUser[] = -{ +static const HLEFunction UtilsForUser[] = { {0X91E4F6A7, &WrapU_V, "sceKernelLibcClock", 'x', "" }, {0X27CC57F0, &WrapU_U, "sceKernelLibcTime", 'x', "x" }, {0X71EC4271, &WrapU_UU, "sceKernelLibcGettimeofday", 'x', "xx" }, @@ -138,8 +128,7 @@ const HLEFunction UtilsForUser[] = {0X920F104A, &WrapU_V, "sceKernelIcacheInvalidateAll", 'x', "" } }; -const HLEFunction LoadCoreForKernel[] = -{ +static const HLEFunction LoadCoreForKernel[] = { {0XACE23476, nullptr, "sceKernelCheckPspConfig", '?', "" }, {0X7BE1421C, nullptr, "sceKernelCheckExecFile", '?', "" }, {0XBF983EF2, nullptr, "sceKernelProbeExecutableObject", '?', "" }, @@ -173,9 +162,7 @@ const HLEFunction LoadCoreForKernel[] = {0XB95FA50D, nullptr, "LoadCoreForKernel_B95FA50D", '?', "" }, }; - -const HLEFunction KDebugForKernel[] = -{ +static const HLEFunction KDebugForKernel[] = { {0XE7A3874D, nullptr, "sceKernelRegisterAssertHandler", '?', "" }, {0X2FF4E9F9, nullptr, "sceKernelAssert", '?', "" }, {0X9B868276, nullptr, "sceKernelGetDebugPutchar", '?', "" }, @@ -198,14 +185,11 @@ const HLEFunction KDebugForKernel[] = {0XB7251823, nullptr, "sceKernelAcceptMbogoSig", '?', "" }, }; -const HLEFunction pspeDebug[] = -{ +static const HLEFunction pspeDebug[] = { {0XDEADBEAF, nullptr, "pspeDebugWrite", '?', "" }, }; - -const HLEModule moduleList[] = -{ +static const HLEModule moduleList[] = { {"FakeSysCalls", ARRAY_SIZE(FakeSysCalls), FakeSysCalls}, {"UtilsForUser", ARRAY_SIZE(UtilsForUser), UtilsForUser}, {"KDebugForKernel", ARRAY_SIZE(KDebugForKernel), KDebugForKernel}, @@ -325,13 +309,13 @@ void RegisterAllModules() { Register_sceSircs(); Register_sceNet_lib(); Register_sceReg(); - // Not ready to enable this due to apparent softlocks in Patapon 3. - // Register_sceNpMatching2(); Register_sceRtc_driver(); Register_scePower_driver(); Register_sceImpose_driver(); Register_sceHprm_driver(); - // add new modules here. + + // Not ready to enable this due to apparent softlocks in Patapon 3. + // Register_sceNpMatching2(); } diff --git a/Core/HLE/sceKernelModule.cpp b/Core/HLE/sceKernelModule.cpp index 72711b87f7..efd32b3638 100644 --- a/Core/HLE/sceKernelModule.cpp +++ b/Core/HLE/sceKernelModule.cpp @@ -214,11 +214,8 @@ PSPModule::~PSPModule() { // Deliberately *not* dropping this module's line info here. Loading a savestate deletes // every kernel object and rebuilds it (KernelObjectPool::Clear), so removing on destruction // threw the line table away every time a state was loaded - and for an ELF launched - // directly there's no file left to read it back from. SymbolMap has the same problem and - // solves it the same way: keep what you have, and let the module that next claims the - // address range replace it (LineInfoMap::AddModule replaces by key, and it's called for - // every module load whether or not that module has any line info to add). The whole thing - // is dropped when the game does, in PSP_Shutdown. + // directly there's no file left to read it back from. Same as SymbolMap: keep what you have, + // and let the module that next claims the address range replace it. } if (modulePtr.ptr) { @@ -1405,22 +1402,19 @@ static PSPModule *__KernelLoadELFFromPtr(const u8 *ptr, size_t elfSize, u32 load if (module->memoryBlockAddr != 0) { g_symbolMap->AddModule(moduleName, module->memoryBlockAddr, module->memoryBlockSize, module->crc); - // Line info out of the module we just loaded. That covers an ELF launched directly - - // pspautotests' .elf builds, or homebrew you built yourself - where the debug sections are - // right here in the file. A PRX has none (prxgen strips every .debug section), so it's a - // cheap no-op for the usual EBOOT case, which the companion below handles instead. + // Line info out of the module we just loaded, where the debug sections are right here in the file. + // A PRX or EBOOT.PBP has none (prxgen strips .debug sections), so this doesn't do anything - instead, + // see LoadCompanionElfDebugInfo. // A relocated module's ELF addresses are relative to where it ended up; one loaded at the // addresses it asked for already has final ones. const u32 lineDelta = reader.DidRelocate() ? reader.GetVaddr() : 0; g_lineInfo.AddModule(std::string_view((const char *)ptr, elfSize), module->memoryBlockAddr, module->memoryBlockSize, lineDelta); - // Homebrew commonly ships the unstripped ELF next to the EBOOT; prxgen strips the symbols - // out of the PRX we actually load, so without this every function in it is just - // z_un_
. See LoadCompanionElfDebugInfo. + // When developing with the homebrew PSPSDK you usually end up with the unstripped ELF next to the EBOOT; + // so without this every function in it is just z_un_
. LoadCompanionElfDebugInfo(PSP_CoreParameter().fileToStart, module->memoryBlockAddr, module->memoryBlockSize); - // Only the .ppsym files follow the setting - it's about writing symbols back out, not about - // reading debug info that's already sitting next to the game. + // Load any .ppsym files where the user has renamed functions. if (g_Config.bAutoSaveLoadSymbols) { int idx = g_symbolMap->GetModuleIndexByName(moduleName); if (idx > 0) { diff --git a/Core/HLE/sceKernelThread.cpp b/Core/HLE/sceKernelThread.cpp index c4c65606d2..33fe155657 100644 --- a/Core/HLE/sceKernelThread.cpp +++ b/Core/HLE/sceKernelThread.cpp @@ -190,12 +190,8 @@ private: u32 idGen_; }; -class ActionAfterMipsCall : public PSPAction -{ - ActionAfterMipsCall() - { - chainedAction = NULL; - } +class ActionAfterMipsCall : public PSPAction { + ActionAfterMipsCall() = default; public: void run(MipsCall &call) override; @@ -231,17 +227,17 @@ public: } } - SceUID threadID; + SceUID threadID = 0; // Saved thread state - int status; - WaitType waitType; - int waitID; - ThreadWaitInfo waitInfo; - bool isProcessingCallbacks; - SceUID currentCallbackId; + int status = 0; + WaitType waitType{}; + int waitID = 0; + ThreadWaitInfo waitInfo{}; + bool isProcessingCallbacks = false; + SceUID currentCallbackId = 0; - PSPAction *chainedAction; + PSPAction *chainedAction = nullptr; }; class ActionAfterCallback : public PSPAction { diff --git a/UI/ImDebugger/ImDebugger.cpp b/UI/ImDebugger/ImDebugger.cpp index 3d1e8a5e6b..491330d186 100644 --- a/UI/ImDebugger/ImDebugger.cpp +++ b/UI/ImDebugger/ImDebugger.cpp @@ -2565,6 +2565,7 @@ void ImDebugger::Frame(MIPSDebugInterface *mipsDebug, GPUCommon *gpuDebug, Draw: ImGui::MenuItem("Ignore bad memory accesses", nullptr, &g_Config.bIgnoreBadMemAccess); ImGui::MenuItem("Break on frame timeout", nullptr, &g_Config.bBreakOnFrameTimeout); ImGui::MenuItem("Fast memory", nullptr, &g_Config.bFastMemory); + ImGui::MenuItem("Auto save/load symbols (PSP/SYSTEM/SYMBOLS)", nullptr, &g_Config.bAutoSaveLoadSymbols); ImGui::Separator(); if (ImGui::MenuItem("Take screenshot")) { g_TakeScreenshot = true;