@@ -598,6 +598,10 @@ settings, otherwise debugging features may not work.)");
598
598
bool openAssembler = false ;
599
599
bool openSymbolAdder = false ;
600
600
601
+ float lineHeight = ImGui::GetTextLineHeight ();
602
+ float previousSymbolY = topleft.y ;
603
+ std::optional<std::string> previousSymbol;
604
+
601
605
while (clipper.Step ()) {
602
606
bool skipNext = false ;
603
607
bool delaySlotNext = false ;
@@ -681,6 +685,17 @@ settings, otherwise debugging features may not work.)");
681
685
ImGui::PushStyleColor (ImGuiCol_Text, s_labelColor);
682
686
ImGui::Text (" %s:" , symbols.begin ()->c_str ());
683
687
ImGui::PopStyleColor ();
688
+ } else {
689
+ // if the first visible line is not a symbol, show the previous symbol
690
+ float y = ImGui::GetCursorScreenPos ().y ;
691
+ if (y + lineHeight >= topleft.y && y <= topleft.y + lineHeight) {
692
+ previousSymbol = findPreviousSymbol (dispAddr);
693
+ // if the second line is a symbol, push the previous symbol display up
694
+ auto secondLineSymbol = findSymbol (dispAddr + 4 );
695
+ if (secondLineSymbol.size () != 0 && y < previousSymbolY) {
696
+ previousSymbolY = y;
697
+ }
698
+ }
684
699
}
685
700
686
701
for (int i = 0 ; i < m_numColumns * ImGui::GetWindowDpiScale (); i++) {
@@ -938,6 +953,13 @@ settings, otherwise debugging features may not work.)");
938
953
}
939
954
}
940
955
drawList->ChannelsMerge ();
956
+ if (previousSymbol) {
957
+ ImVec2 pos (ImGui::GetCursorScreenPos ().x , previousSymbolY);
958
+ ImVec2 posEnd (pos.x + glyphWidth * 64 , pos.y + ImGui::GetTextLineHeight ());
959
+ drawList->AddRectFilled (pos, posEnd, ImGui::GetColorU32 (ImGuiCol_WindowBg));
960
+ std::string text = " ^ " + previousSymbol.value () + " ^" ;
961
+ drawList->AddText (pos, ImGui::GetColorU32 (s_labelColor), text.data (), text.data () + text.size ());
962
+ }
941
963
ImGui::EndChild ();
942
964
ImGui::PopFont ();
943
965
if (m_jumpToPC.has_value ()) {
@@ -1127,6 +1149,19 @@ std::list<std::string> PCSX::Widgets::Assembly::findSymbol(uint32_t addr) {
1127
1149
return ret;
1128
1150
}
1129
1151
1152
+ std::optional<std::string> PCSX::Widgets::Assembly::findPreviousSymbol (uint32_t addr) {
1153
+ std::optional<std::string> ret;
1154
+ for (auto & symbol : g_emulator->m_cpu ->m_symbols ) {
1155
+ if (symbol.first >= addr) {
1156
+ break ;
1157
+ }
1158
+ if (symbol.first >= m_ramBase) {
1159
+ ret = symbol.second ;
1160
+ }
1161
+ }
1162
+ return ret;
1163
+ }
1164
+
1130
1165
void PCSX::Widgets::Assembly::rebuildSymbolsCaches () {
1131
1166
auto & cpu = g_emulator->m_cpu ;
1132
1167
m_symbolsCache.clear ();
0 commit comments