Skip to content

Commit de85d97

Browse files
committed
[debugger] Implement missing memory editor functions
1 parent 4e73015 commit de85d97

File tree

1 file changed

+88
-12
lines changed

1 file changed

+88
-12
lines changed

platforms/shared/desktop/gui_debug_memory.cpp

Lines changed: 88 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -140,15 +140,72 @@ static void draw_tabs(void)
140140
}
141141
}
142142

143-
void gui_debug_memory_search_window(void) { }
144-
void gui_debug_memory_find_bytes_window(void) { }
145-
void gui_debug_memory_watches_window(void) { }
146-
void gui_debug_memory_step_frame(void) { }
147-
void gui_debug_memory_copy(void) { mem_edit[current_mem_edit].Copy(); }
148-
void gui_debug_memory_paste(void) { mem_edit[current_mem_edit].Paste(); }
149-
void gui_debug_memory_select_all(void) { mem_edit[current_mem_edit].SelectAll(); }
150-
void gui_debug_memory_goto(int editor, int address) { mem_edit_select = editor; mem_edit[editor].JumpToAddress(address); }
151-
void gui_debug_memory_save_dump(const char* file_path, bool binary) { UNUSED(file_path); UNUSED(binary); }
143+
void gui_debug_memory_search_window(void)
144+
{
145+
for (int i = 0; i < MEMORY_EDITOR_MAX; i++)
146+
{
147+
ImGui::PushFont(gui_default_font);
148+
mem_edit[i].DrawSearchWindow();
149+
ImGui::PopFont();
150+
}
151+
}
152+
153+
void gui_debug_memory_find_bytes_window(void)
154+
{
155+
for (int i = 0; i < MEMORY_EDITOR_MAX; i++)
156+
{
157+
ImGui::PushFont(gui_default_font);
158+
mem_edit[i].DrawFindBytesWindow();
159+
ImGui::PopFont();
160+
}
161+
}
162+
163+
void gui_debug_memory_watches_window(void)
164+
{
165+
for (int i = 0; i < MEMORY_EDITOR_MAX; i++)
166+
{
167+
ImGui::PushFont(gui_default_font);
168+
mem_edit[i].DrawWatchWindow();
169+
ImGui::PopFont();
170+
}
171+
}
172+
173+
void gui_debug_memory_step_frame(void)
174+
{
175+
for (int i = 0; i < MEMORY_EDITOR_MAX; i++)
176+
{
177+
mem_edit[i].StepFrame();
178+
}
179+
}
180+
181+
void gui_debug_memory_copy(void)
182+
{
183+
mem_edit[current_mem_edit].Copy();
184+
}
185+
186+
void gui_debug_memory_paste(void)
187+
{
188+
mem_edit[current_mem_edit].Paste();
189+
}
190+
191+
void gui_debug_memory_select_all(void)
192+
{
193+
mem_edit[current_mem_edit].SelectAll();
194+
}
195+
196+
void gui_debug_memory_goto(int editor, int address)
197+
{
198+
mem_edit_select = editor;
199+
mem_edit[editor].JumpToAddress(address);
200+
}
201+
202+
void gui_debug_memory_save_dump(const char* file_path, bool binary)
203+
{
204+
if (binary)
205+
mem_edit[current_mem_edit].SaveToBinaryFile(file_path);
206+
else
207+
mem_edit[current_mem_edit].SaveToTextFile(file_path);
208+
}
152209

153210
void gui_debug_memory_select_range(int editor, int start_address, int end_address)
154211
{
@@ -224,7 +281,13 @@ void gui_debug_memory_add_watch(int editor, int address, const char* notes, int
224281
mem_edit[editor].AddWatchDirect(address, notes, size_index);
225282
}
226283

227-
void gui_debug_memory_open_watch_popup(int editor, int address, const char* notes) { UNUSED(editor); UNUSED(address); UNUSED(notes); }
284+
void gui_debug_memory_open_watch_popup(int editor, int address, const char* notes)
285+
{
286+
if (editor < 0 || editor >= MEMORY_EDITOR_MAX)
287+
return;
288+
289+
mem_edit[editor].PrepareAddWatch(address, notes);
290+
}
228291

229292
void gui_debug_memory_remove_watch(int editor, int address)
230293
{
@@ -243,8 +306,21 @@ void gui_debug_memory_remove_watch(int editor, int address)
243306
}
244307
}
245308

246-
void gui_debug_memory_save_settings(std::ostream& stream) { UNUSED(stream); }
247-
void gui_debug_memory_load_settings(std::istream& stream) { UNUSED(stream); }
309+
void gui_debug_memory_save_settings(std::ostream& stream)
310+
{
311+
for (int i = 0; i < MEMORY_EDITOR_MAX; i++)
312+
{
313+
mem_edit[i].SaveSettings(stream);
314+
}
315+
}
316+
317+
void gui_debug_memory_load_settings(std::istream& stream)
318+
{
319+
for (int i = 0; i < MEMORY_EDITOR_MAX; i++)
320+
{
321+
mem_edit[i].LoadSettings(stream);
322+
}
323+
}
248324

249325
static void memory_editor_menu(void)
250326
{

0 commit comments

Comments
 (0)