Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions src/core/psxhw.cc
Original file line number Diff line number Diff line change
Expand Up @@ -831,6 +831,10 @@
g_emulator->m_mem->msanFree(value);
break;
}
case 0x1f8020a0: {
g_emulator->m_mem->m_psyqoHeapMetadata = value;
break;
}

Check warning on line 837 in src/core/psxhw.cc

View check run for this annotation

CodeScene Delta Analysis / CodeScene Code Health Review (main)

❌ Getting worse: Complex Method

PCSX::HW::write32 increases in cyclomatic complexity from 53 to 54, threshold = 9. This function has many conditional statements (e.g. if, for, while), leading to lower code health. Avoid adding more conditionals and code to it without refactoring.
case 0x1f802094: {
PSXAddress headerAddrInfo(value);
switch (headerAddrInfo.type) {
Expand Down
1 change: 1 addition & 0 deletions src/core/psxmem.cc
Original file line number Diff line number Diff line change
Expand Up @@ -174,6 +174,7 @@
memset(m_wram, 0, 0x00800000);
memset(m_exp1, 0xff, exp1_size);
memset(m_bios, 0, bios_size);
m_psyqoHeapMetadata = 0;

Check warning on line 177 in src/core/psxmem.cc

View check run for this annotation

CodeScene Delta Analysis / CodeScene Code Health Review (main)

❌ Getting worse: Complex Method

PCSX::Memory::reset already has high cyclomatic complexity, and now it increases in Lines of Code from 77 to 78. This function has many conditional statements (e.g. if, for, while), leading to lower code health. Avoid adding more conditionals and code to it without refactoring.
static const uint32_t nobios[6] = {
Mips::Encoder::lui(Mips::Encoder::Reg::V0, 0xbfc0), // v0 = 0xbfc00000
Mips::Encoder::lui(Mips::Encoder::Reg::V1, 0x1f80), // v1 = 0x1f800000
Expand Down
4 changes: 4 additions & 0 deletions src/core/psxmem.h
Original file line number Diff line number Diff line change
Expand Up @@ -331,6 +331,10 @@ class Memory {
uint32_t m_msanPtr = 1024;
EventBus::Listener m_listener;

// Address of the psyqo heap metadata struct in guest memory,
// registered by the MIPS allocator via pcsxhw write to 0x1f8020a0.
uint32_t m_psyqoHeapMetadata = 0;

std::unordered_map<uint32_t, uint32_t> m_msanAllocs;
static constexpr uint32_t c_msanChainMarker = 0x7ffffd;
std::unordered_map<uint32_t, uint32_t> m_msanChainRegistry;
Expand Down
2 changes: 2 additions & 0 deletions src/gui/gui.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1459,6 +1459,7 @@ in Configuration->Emulation, restart PCSX-Redux, then try again.)"));
ImGui::MenuItem(_("Show SIO1 debug"), nullptr, &m_sio1.m_show);
ImGui::EndMenu();
}
ImGui::MenuItem(_("Show PSYQo heap viewer"), nullptr, &m_heapViewer.m_show);
ImGui::Separator();
if (ImGui::BeginMenu(_("Kernel"))) {
ImGui::MenuItem(_("Kernel Events"), nullptr, &m_events.m_show);
Expand Down Expand Up @@ -1742,6 +1743,7 @@ in Configuration->Emulation, restart PCSX-Redux, then try again.)"));
if (g_emulator->m_gpu->m_showCfg) changed |= g_emulator->m_gpu->configure();
if (g_emulator->m_gpu->m_showDebug) g_emulator->m_gpu->debug();
if (m_gpuLogger.m_show) m_gpuLogger.draw(g_emulator->m_gpuLogger.get(), _("GPU Logger"));
if (m_heapViewer.m_show) m_heapViewer.draw(g_emulator->m_mem.get(), _("PSYQo Heap Viewer"));

if (m_showUiCfg) {
if (ImGui::Begin(_("UI Configuration"), &m_showUiCfg)) {
Expand Down
5 changes: 4 additions & 1 deletion src/gui/gui.h
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@
#include "gui/widgets/events.h"
#include "gui/widgets/filedialog.h"
#include "gui/widgets/gpulogger.h"
#include "gui/widgets/heap_viewer.h"
#include "gui/widgets/handlers.h"
#include "gui/widgets/isobrowser.h"
#include "gui/widgets/kernellog.h"
Expand Down Expand Up @@ -115,6 +116,7 @@ class GUI final : public UI {
typedef Setting<bool, TYPESTRING("ShowIsoBrowser")> ShowIsoBrowser;
typedef Setting<bool, TYPESTRING("ShowGPULogger")> ShowGPULogger;
typedef Setting<bool, TYPESTRING("ShowRAMViewer")> ShowRAMViewer;
typedef Setting<bool, TYPESTRING("ShowHeapViewer")> ShowHeapViewer;
typedef Setting<int, TYPESTRING("WindowPosX"), 0> WindowPosX;
typedef Setting<int, TYPESTRING("WindowPosY"), 0> WindowPosY;
typedef Setting<int, TYPESTRING("WindowSizeX"), 1280> WindowSizeX;
Expand Down Expand Up @@ -159,7 +161,7 @@ class GUI final : public UI {
ShowCLUTVRAMViewer, ShowVRAMViewer1, ShowVRAMViewer2, ShowVRAMViewer3, ShowVRAMViewer4, ShowMemoryObserver,
ShowTypedDebugger, ShowPatches, ShowMemcardManager, ShowRegisters, ShowAssembly, ShowDisassembly,
ShowBreakpoints, ShowNamedSaveStates, ShowEvents, ShowHandlers, ShowKernelLog, ShowCallstacks, ShowSIO1,
ShowIsoBrowser, ShowGPULogger, ShowRAMViewer, MainFontSize, MonoFontSize, GUITheme,
ShowIsoBrowser, ShowGPULogger, ShowRAMViewer, ShowHeapViewer, MainFontSize, MonoFontSize, GUITheme,
AllowMouseCaptureToggle,
EnableRawMouseMotion, WidescreenRatio, ShowPIOCartConfig, ShowMemoryEditor1, ShowMemoryEditor2,
ShowMemoryEditor3, ShowMemoryEditor4, ShowMemoryEditor5, ShowMemoryEditor6, ShowMemoryEditor7,
Expand Down Expand Up @@ -407,6 +409,7 @@ class GUI final : public UI {
Widgets::SIO1 m_sio1 = {settings.get<ShowSIO1>().value};

Widgets::GPULogger m_gpuLogger{settings.get<ShowGPULogger>().value};
Widgets::HeapViewer m_heapViewer{settings.get<ShowHeapViewer>().value};

EventBus::Listener m_listener;

Expand Down
Loading
Loading