yaze 0.3.2
Link to the Past ROM Editor
 
Loading...
Searching...
No Matches
asm_follow_service.cc
Go to the documentation of this file.
2
4#include "imgui/imgui.h"
5
6namespace yaze {
7namespace editor {
8
10 : symbol_provider_(symbol_provider) {}
11
13 if (!enabled_) return;
14
15 double current_time = ImGui::GetTime();
16 if (current_time - last_poll_time_ < 0.1) return; // 10Hz poll for PC sync
17 last_poll_time_ = current_time;
18
20 if (!client || !client->IsConnected()) return;
21
22 auto cpu_state_or = client->GetCpuState();
23 if (!cpu_state_or.ok()) return;
24
25 const auto& cpu = *cpu_state_or;
26 // Combine Bank (K) and PC
27 uint32_t combined_pc = (cpu.K << 16) | (cpu.PC & 0xFFFF);
28
29 if (combined_pc != last_pc_) {
30 last_pc_ = combined_pc;
31
32 if (symbol_provider_) {
33 std::string loc = symbol_provider_->GetSourceLocation(combined_pc);
34 if (!loc.empty() && callback_) {
35 callback_(loc);
36 }
37 }
38 }
39}
40
41} // namespace editor
42} // namespace yaze
emu::debug::SymbolProvider * symbol_provider_
AsmFollowService(emu::debug::SymbolProvider *symbol_provider)
Provider for symbol (label) resolution in disassembly.
std::string GetSourceLocation(uint32_t address) const
Get source file and line for an address (for VS Code integration)
static std::shared_ptr< MesenSocketClient > GetOrCreate()