@@ -37,6 +37,11 @@ struct DevTitleMenuSTable
3737 } m_state[5 ];
3838};
3939
40+ static ImVec2 GetMousePos ()
41+ {
42+ return ImGui::GetIO ().MousePos ;
43+ }
44+
4045static void DrawBackgroundDev ()
4146{
4247 auto & res = ImGui::GetIO ().DisplaySize ;
@@ -117,9 +122,9 @@ static bool Sonic06Button(ImVec2 pos, const char* label, bool& hovered, const Im
117122 const auto label_size = g_mnewRodinFont->CalcTextSizeA (font_size, FLT_MAX , 0 , label);
118123 const auto size = ImVec2 (size_arg.x ? size_arg.x : label_size.x , size_arg.y ? size_arg.y : label_size.y );
119124 const float skew = size.y * skew_amount;
120-
125+
121126 const ImRect bb (pos, { pos.x + size.x + skew, pos.y + size.y });
122- hovered = bb.Contains (io. MousePos );
127+ hovered = bb.Contains (GetMousePos () );
123128 bool pressed = hovered && ImGui::IsMouseClicked (ImGuiMouseButton_Left);
124129
125130 // Colors
@@ -184,11 +189,11 @@ static void DrawStageMapSelector()
184189 (res.y - WINDOW_HEIGHT ) * 0 .45f
185190 };
186191
187- auto & items = pMode->m_CurrentStageMap ->m_sStageMap ;
192+ auto & items = pMode->m_CurrentStageMap ->m_vpStageMap ;
188193 const int itemCount = static_cast <int >(items.size ());
189194 int currentIdx = pMode->m_CurrentStageMapIndex .get ();
190195
191- // Input handling
196+ // Input handling (Mouse)
192197 auto pMsgRec = reinterpret_cast <uintptr_t >(static_cast <Sonicteam::SoX::MessageReceiver*>(pMode));
193198
194199 if (abs (io.MouseWheel ) > ScrollAmount) {
@@ -205,7 +210,7 @@ static void DrawStageMapSelector()
205210 const int start_idx = std::max (0 , currentIdx - VISIBLE_ITEMS / 2 );
206211 const int end_idx = std::min (itemCount, start_idx + VISIBLE_ITEMS );
207212
208- // Draw visible items with absolute positioning
213+ // Draw visible items
209214 for (int i = start_idx; i < end_idx; ++i) {
210215 const auto & item = items[i];
211216 if (!item) continue ;
@@ -230,9 +235,9 @@ static void DrawStageMapSelector()
230235 }
231236
232237 // Tooltip with stage information
233- if (hovered && item->m_sStageMap .size () > 0 ) {
238+ if (hovered && item->m_vpStageMap .size () > 0 ) {
234239 ImDrawList* draw_list = ImGui::GetForegroundDrawList ();
235- const ImVec2 mouse_pos = ImGui::GetIO (). MousePos ;
240+ const ImVec2 mouse_pos = GetMousePos () ;
236241 const float font_size = ImGui::GetFontSize ();
237242 const float line_spacing = 2 .0f ;
238243
@@ -242,8 +247,8 @@ static void DrawStageMapSelector()
242247 float total_height = 0 .0f ;
243248 std::vector<std::pair<std::string, std::string>> entries;
244249
245- for (int j = 0 ; j < item->m_sStageMap .size (); ++j) {
246- const auto & stage = item->m_sStageMap [j];
250+ for (int j = 0 ; j < item->m_vpStageMap .size (); ++j) {
251+ const auto & stage = item->m_vpStageMap [j];
247252 if (!stage.ptr .get ()) continue ;
248253
249254 std::string nameUtf8 = ConvertShiftJISToUTF8 (stage->m_Name .c_str ());
@@ -319,7 +324,7 @@ static void DrawStageMapSelector()
319324 const float dot_radius = 7 .5f ;
320325 const ImU32 dot_color = IM_COL32 (0 , 150 , 255 , 220 );
321326 const ImU32 outline_color = IM_COL32 (255 , 255 , 255 , 180 );
322- ImVec2 mouse_pos = io. MousePos ;
327+ ImVec2 mouse_pos = GetMousePos () ;
323328
324329 ImGui::GetBackgroundDrawList ()->AddCircleFilled (
325330 mouse_pos, dot_radius, dot_color, 12
@@ -352,11 +357,6 @@ static void DrawDevTitle() {
352357 GuestToHostFunction<void >(sub_824A0E38, static_cast <uint32_t >(pMsgRec), vMsgRec.get ());
353358 }
354359
355- if (ImGui::IsMouseClicked (ImGuiMouseButton_Right))
356- {
357- guest_stack_var<DevMessage> vMsgRec (0x10002 , 0 , 0 );
358- GuestToHostFunction<void >(sub_824A0E38, static_cast <uint32_t >(pMsgRec), vMsgRec.get ());
359- }
360360 if (ImGui::IsMouseClicked (ImGuiMouseButton_Left))
361361 {
362362 guest_stack_var<DevMessage> vMsgRec (0x10002 , 0 , 1 );
@@ -382,8 +382,6 @@ static void DevTitleAudioCommon(DevMessage* message)
382382 if (!message->id3 )
383383 Game_PlaySound (" window_close" );
384384 break ;
385-
386-
387385 }
388386}
389387
@@ -412,9 +410,7 @@ PPC_FUNC(sub_824A0E38)
412410 if (pMessage->id2 == 0x5A || pMessage->id3 )
413411 {
414412 auto pPocture = pTitle->m_PictureTitle ;
415-
416413 pTitle->m_PictureTitle ->m_State3 = 4 ;
417-
418414 DevTitleDelay = DevTitleDelayDefault;
419415 }
420416 else
@@ -430,6 +426,12 @@ PPC_FUNC(sub_824A0E38)
430426PPC_FUNC_IMPL (__imp__sub_82161AB8);
431427PPC_FUNC (sub_82161AB8)
432428{
429+ if (!Config::DevTitle)
430+ {
431+ __imp__sub_82161AB8 (ctx, base);
432+ return ;
433+ }
434+
433435 auto pDoc = (Sonicteam::DocMarathonImp*)(base + ctx.r3 .u32 );
434436 GuestToHostFunction<void >(sub_825E9E28, ctx.r3 .u32 , ctx.r4 .u32 );
435437
@@ -443,19 +445,19 @@ PPC_FUNC(sub_82161AB8)
443445
444446 auto pDevMode = (*(be<uint32_t >*)(base + 0x82D35E78 )).get ();
445447
446- // nah vft call
448+ // nah vft call, sub_825E8D78 should do it
447449 // DocSetMode
448450 GuestToHostFunction<void >(sub_825E8D78, ctx.r3 .u32 , pDevMode);
449451
450452}
451453
454+ // tateDevTitle, vft + 8
452455PPC_FUNC_IMPL (__imp__sub_82162298);
453456PPC_FUNC (sub_82162298)
454457{
455458 auto pDoc = (Sonicteam::DocMarathonState*)(base + ctx.r4 .u32 );
456459 auto pTitle = (StateDevTitle*)(base + ctx.r3 .u32 );
457460
458-
459461 if (ctx.r3 .u32 && pTitle->m_PictureTitle && pTitle->m_PictureTitle ->m_State3 > 4 )
460462 {
461463 DevTitleDelay = std::clamp (DevTitleDelay - 0 .016666668f , 0 .0f , DevTitleDelay);
@@ -464,6 +466,7 @@ PPC_FUNC(sub_82162298)
464466 {
465467 DevTitleDelay = DevTitleDelayDefault;
466468 }
469+
467470 if (!GuestToHostFunction<uint32_t >(sub_82581C68, ctx.r4 .u32 ))
468471 {
469472 // Wait for transistion
@@ -481,11 +484,18 @@ PPC_FUNC(sub_82162298)
481484
482485void DevTitleMenu::Init ()
483486{
487+ if (!Config::DevTitle)
488+ return ;
489+
484490 g_mrodinFont = ImFontAtlasSnapshot::GetFont (" FOT-RodinPro-DB.otf" );
485491 g_mnewRodinFont = ImFontAtlasSnapshot::GetFont (" FOT-NewRodinPro-UB.otf" );
486492
487493}
488- void DevTitleMenu::Draw () {
494+ void DevTitleMenu::Draw ()
495+ {
496+
497+ if (!Config::DevTitle)
498+ return ;
489499
490500 if (!App::s_pApp)
491501 return ;
@@ -509,7 +519,7 @@ void DevTitleMenu::Draw() {
509519 DrawDevTitle ();
510520 };
511521 break ;
512- // StageSelect
522+ // StageSelect/StoreSelect
513523 case 0x820336A4 :
514524 {
515525 DevTitleMenu::IsVisible = true ;
0 commit comments