Skip to content

Commit

Permalink
Merge pull request #1798 from nicolasnoble/persist-map-path
Browse files Browse the repository at this point in the history
Making symbol map load dialog persisting its path.
  • Loading branch information
nicolasnoble authored Nov 6, 2024
2 parents f8f9025 + 9bcedcb commit cc67b8e
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 6 deletions.
3 changes: 2 additions & 1 deletion src/core/psxemulator.h
Original file line number Diff line number Diff line change
Expand Up @@ -189,6 +189,7 @@ class Emulator {
typedef SettingPath<TYPESTRING("EXP1Filepath")> SettingEXP1Filepath;
typedef SettingPath<TYPESTRING("EXP1BrowsePath")> SettingEXP1BrowsePath;
typedef Setting<bool, TYPESTRING("PIOConnected")> SettingPIOConnected;
typedef SettingPath<TYPESTRING("MapBrowsePath")> SettingMapBrowsePath;

Settings<SettingMcd1, SettingMcd2, SettingBios, SettingPpfDir, SettingPsxExe, SettingXa, SettingSpuIrq,
SettingBnWMdec, SettingScaler, SettingAutoVideo, SettingVideo, SettingFastBoot, SettingDebugSettings,
Expand All @@ -197,7 +198,7 @@ class Emulator {
SettingGLErrorReportingSeverity, SettingFullCaching, SettingHardwareRenderer, SettingShownAutoUpdateConfig,
SettingAutoUpdate, SettingMSAA, SettingLinearFiltering, SettingKioskMode, SettingMcd1Pocketstation,
SettingMcd2Pocketstation, SettingBiosBrowsePath, SettingEXP1Filepath, SettingEXP1BrowsePath,
SettingPIOConnected>
SettingPIOConnected, SettingMapBrowsePath>
settings;
class PcsxConfig {
public:
Expand Down
2 changes: 1 addition & 1 deletion src/gui/gui.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1557,7 +1557,7 @@ in Configuration->Emulation, restart PCSX-Redux, then try again.)"));
}

if (m_assembly.m_show) {
m_assembly.draw(this, &g_emulator->m_cpu->m_regs, g_emulator->m_mem.get(), _("Assembly"));
changed |= m_assembly.draw(this, &g_emulator->m_cpu->m_regs, g_emulator->m_mem.get(), _("Assembly"));
}

if (m_disassembly.m_show && g_emulator->m_cpu->isDynarec()) {
Expand Down
17 changes: 14 additions & 3 deletions src/gui/widgets/assembly.cc
Original file line number Diff line number Diff line change
Expand Up @@ -459,15 +459,16 @@ void PCSX::Widgets::Assembly::Offset(uint32_t addr, int size) {
}
}

void PCSX::Widgets::Assembly::draw(GUI* gui, psxRegisters* registers, Memory* memory, const char* title) {
bool PCSX::Widgets::Assembly::draw(GUI* gui, psxRegisters* registers, Memory* memory, const char* title) {
bool changed = false;
auto& cpu = g_emulator->m_cpu;
m_registers = registers;
m_memory = memory;
ImGui::SetNextWindowPos(ImVec2(10, 30), ImGuiCond_FirstUseEver);
ImGui::SetNextWindowSize(ImVec2(500, 500), ImGuiCond_FirstUseEver);
if (!ImGui::Begin(title, &m_show, ImGuiWindowFlags_MenuBar)) {
ImGui::End();
return;
return changed;
}

float glyphWidth = ImGui::GetFontSize();
Expand Down Expand Up @@ -1044,8 +1045,17 @@ if not success then return msg else return nil end
}
ImGui::End();

if (openSymbolsDialog) m_symbolsFileDialog.openDialog();
auto& mapPath = g_emulator->settings.get<Emulator::SettingMapBrowsePath>();

if (openSymbolsDialog) {
if (!mapPath.empty()) {
m_symbolsFileDialog.m_currentPath = mapPath.value;
}
m_symbolsFileDialog.openDialog();
}
if (m_symbolsFileDialog.draw()) {
mapPath.value = m_symbolsFileDialog.m_currentPath;
changed = true;
std::vector<PCSX::u8string> filesToOpen = m_symbolsFileDialog.selected();
for (auto fileName : filesToOpen) {
std::ifstream file;
Expand Down Expand Up @@ -1100,6 +1110,7 @@ if not success then return msg else return nil end
}
ImGui::End();
}
return changed;
}

std::list<std::string> PCSX::Widgets::Assembly::findSymbol(uint32_t addr) {
Expand Down
2 changes: 1 addition & 1 deletion src/gui/widgets/assembly.h
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ class Assembly : private Disasm {
m_listener.listen<Events::GUI::JumpToPC>([this](const auto& event) { m_jumpToPC = event.pc; });
memset(m_jumpAddressString, 0, sizeof(m_jumpAddressString));
}
void draw(GUI* gui, psxRegisters* registers, Memory* memory, const char* title);
bool draw(GUI* gui, psxRegisters* registers, Memory* memory, const char* title);

bool& m_show;

Expand Down

0 comments on commit cc67b8e

Please sign in to comment.