Skip to content

Commit cc67b8e

Browse files
authored
Merge pull request #1798 from nicolasnoble/persist-map-path
Making symbol map load dialog persisting its path.
2 parents f8f9025 + 9bcedcb commit cc67b8e

File tree

4 files changed

+18
-6
lines changed

4 files changed

+18
-6
lines changed

src/core/psxemulator.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -189,6 +189,7 @@ class Emulator {
189189
typedef SettingPath<TYPESTRING("EXP1Filepath")> SettingEXP1Filepath;
190190
typedef SettingPath<TYPESTRING("EXP1BrowsePath")> SettingEXP1BrowsePath;
191191
typedef Setting<bool, TYPESTRING("PIOConnected")> SettingPIOConnected;
192+
typedef SettingPath<TYPESTRING("MapBrowsePath")> SettingMapBrowsePath;
192193

193194
Settings<SettingMcd1, SettingMcd2, SettingBios, SettingPpfDir, SettingPsxExe, SettingXa, SettingSpuIrq,
194195
SettingBnWMdec, SettingScaler, SettingAutoVideo, SettingVideo, SettingFastBoot, SettingDebugSettings,
@@ -197,7 +198,7 @@ class Emulator {
197198
SettingGLErrorReportingSeverity, SettingFullCaching, SettingHardwareRenderer, SettingShownAutoUpdateConfig,
198199
SettingAutoUpdate, SettingMSAA, SettingLinearFiltering, SettingKioskMode, SettingMcd1Pocketstation,
199200
SettingMcd2Pocketstation, SettingBiosBrowsePath, SettingEXP1Filepath, SettingEXP1BrowsePath,
200-
SettingPIOConnected>
201+
SettingPIOConnected, SettingMapBrowsePath>
201202
settings;
202203
class PcsxConfig {
203204
public:

src/gui/gui.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1557,7 +1557,7 @@ in Configuration->Emulation, restart PCSX-Redux, then try again.)"));
15571557
}
15581558

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

15631563
if (m_disassembly.m_show && g_emulator->m_cpu->isDynarec()) {

src/gui/widgets/assembly.cc

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -459,15 +459,16 @@ void PCSX::Widgets::Assembly::Offset(uint32_t addr, int size) {
459459
}
460460
}
461461

462-
void PCSX::Widgets::Assembly::draw(GUI* gui, psxRegisters* registers, Memory* memory, const char* title) {
462+
bool PCSX::Widgets::Assembly::draw(GUI* gui, psxRegisters* registers, Memory* memory, const char* title) {
463+
bool changed = false;
463464
auto& cpu = g_emulator->m_cpu;
464465
m_registers = registers;
465466
m_memory = memory;
466467
ImGui::SetNextWindowPos(ImVec2(10, 30), ImGuiCond_FirstUseEver);
467468
ImGui::SetNextWindowSize(ImVec2(500, 500), ImGuiCond_FirstUseEver);
468469
if (!ImGui::Begin(title, &m_show, ImGuiWindowFlags_MenuBar)) {
469470
ImGui::End();
470-
return;
471+
return changed;
471472
}
472473

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

1047-
if (openSymbolsDialog) m_symbolsFileDialog.openDialog();
1048+
auto& mapPath = g_emulator->settings.get<Emulator::SettingMapBrowsePath>();
1049+
1050+
if (openSymbolsDialog) {
1051+
if (!mapPath.empty()) {
1052+
m_symbolsFileDialog.m_currentPath = mapPath.value;
1053+
}
1054+
m_symbolsFileDialog.openDialog();
1055+
}
10481056
if (m_symbolsFileDialog.draw()) {
1057+
mapPath.value = m_symbolsFileDialog.m_currentPath;
1058+
changed = true;
10491059
std::vector<PCSX::u8string> filesToOpen = m_symbolsFileDialog.selected();
10501060
for (auto fileName : filesToOpen) {
10511061
std::ifstream file;
@@ -1100,6 +1110,7 @@ if not success then return msg else return nil end
11001110
}
11011111
ImGui::End();
11021112
}
1113+
return changed;
11031114
}
11041115

11051116
std::list<std::string> PCSX::Widgets::Assembly::findSymbol(uint32_t addr) {

src/gui/widgets/assembly.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ class Assembly : private Disasm {
4646
m_listener.listen<Events::GUI::JumpToPC>([this](const auto& event) { m_jumpToPC = event.pc; });
4747
memset(m_jumpAddressString, 0, sizeof(m_jumpAddressString));
4848
}
49-
void draw(GUI* gui, psxRegisters* registers, Memory* memory, const char* title);
49+
bool draw(GUI* gui, psxRegisters* registers, Memory* memory, const char* title);
5050

5151
bool& m_show;
5252

0 commit comments

Comments
 (0)