Skip to content

Commit edcb9a4

Browse files
ReimousTHIsaacMarovitz
authored andcommitted
No UI #1
1 parent 8fe8355 commit edcb9a4

File tree

7 files changed

+79
-52
lines changed

7 files changed

+79
-52
lines changed

MarathonRecomp/api/Marathon.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -159,8 +159,6 @@
159159
#include "Sonicteam/StageSelectMode.h"
160160
#include "Sonicteam/StdImageFilters/BurnoutBlurFilter.h"
161161
#include "Sonicteam/StdImageFilters/SingleTechniqueFilter.h"
162-
#include "Sonicteam/StageMap.h"
163-
#include "Sonicteam/StageSelectMode.h"
164162
#include "Sonicteam/System/CreateStatic.h"
165163
#include "Sonicteam/System/Diagnostics/Performance.h"
166164
#include "Sonicteam/System/Singleton.h"

MarathonRecomp/api/Sonicteam/StageMap.h

Lines changed: 1 addition & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -3,30 +3,7 @@
33
#include <Marathon.inl>
44
#include <Sonicteam/SoX/Component.h>
55
#include <stdx/string.h>
6-
7-
namespace stdx
8-
{
9-
//Gauge PR :|
10-
template <typename Type>
11-
struct vector
12-
{
13-
be<uint32_t> _MyProxy;
14-
xpointer<Type> _MyFirst;
15-
xpointer<Type> _MyLast;
16-
xpointer<Type> _MyEnd;
17-
18-
Type& operator[](size_t pos)
19-
{
20-
return _MyFirst.get()[pos];
21-
}
22-
23-
size_t size()
24-
{
25-
return _MyLast.get() - _MyFirst.get();
26-
}
27-
28-
};
29-
}
6+
#include <stdx/vector.h>
307

318
namespace Sonicteam
329
{

MarathonRecomp/api/Sonicteam/StageSelectMode.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,8 @@ namespace Sonicteam
1212
xpointer<Sonicteam::StageMap> m_StageMap;
1313
xpointer<Sonicteam::StageMap> m_CurrentStageMap;
1414
MARATHON_INSERT_PADDING(4);
15-
be< uint32_t> m_CurrentStageMapIndex;
16-
be< uint32_t> m_Deep;
15+
be<uint32_t> m_CurrentStageMapIndex;
16+
be<uint32_t> m_Deep;
1717
MARATHON_INSERT_PADDING(0x1C);
1818
xpointer<xpointer<const char>> m_StageMapInfo;
1919
xpointer<uint32_t> m_StageMapType;

MarathonRecomp/ui/devtitle_menu.cpp

Lines changed: 52 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -46,11 +46,16 @@ static void DrawBackgroundDev()
4646
{
4747
auto& res = ImGui::GetIO().DisplaySize;
4848
auto drawList = ImGui::GetBackgroundDrawList();
49-
50-
const uint32_t TOP = IM_COL32(0, 103, 255, 255);
51-
const uint32_t BOTTOM = IM_COL32(0, 40, 100, 255);
52-
53-
drawList->AddRectFilledMultiColor({ 0.0, 0.0 }, res, TOP, TOP, BOTTOM, BOTTOM);
49+
if (Config::DevTitle == EDevTitleMenu::Custom)
50+
{
51+
const uint32_t TOP = IM_COL32(0, 103, 255, 255);
52+
const uint32_t BOTTOM = IM_COL32(0, 40, 100, 255);
53+
drawList->AddRectFilledMultiColor({ 0.0, 0.0 }, res, TOP, TOP, BOTTOM, BOTTOM);
54+
}
55+
else
56+
{
57+
drawList->AddRectFilledMultiColor({ 0.0, 0.0 }, res, 0, 0, 0, 0);
58+
}
5459
}
5560

5661
static void DrawTextDev(const char* text,float posX, float posY,float vfontSize= 24, uint32_t alpha = 255, uint32_t center = CenterFlag::X)
@@ -84,9 +89,9 @@ static void DrawTextDev(const char* text,float posX, float posY,float vfontSize=
8489
}
8590

8691
//05.08.2025 TODO Kanju Display
92+
//31.08.2025 CLANG Version
8793
static std::string ConvertShiftJISToUTF8(const std::string& sjisStr)
8894
{
89-
9095
int wlen = MultiByteToWideChar(932, 0, sjisStr.c_str(), -1, nullptr, 0);
9196
std::wstring wstr(wlen, 0);
9297
MultiByteToWideChar(932, 0, sjisStr.c_str(), -1, &wstr[0], wlen);
@@ -128,7 +133,13 @@ static bool Sonic06Button(ImVec2 pos, const char* label, bool& hovered, const Im
128133
bool pressed = hovered && ImGui::IsMouseClicked(ImGuiMouseButton_Left);
129134

130135
// Colors
131-
const ImU32 col_base IM_COL32(0, 6, 142, 255), col_hover IM_COL32(0, 26, 162, 255);
136+
ImU32 col_base = 0;
137+
ImU32 col_hover = 0;
138+
if (Config::DevTitle == EDevTitleMenu::Custom)
139+
{
140+
col_base = IM_COL32(0, 6, 142, 255);
141+
col_hover = IM_COL32(0, 26, 162, 255);
142+
}
132143

133144
const ImU32 bg[4] =
134145
{
@@ -174,21 +185,28 @@ static void DrawStageMapSelector()
174185
return;
175186

176187
DrawBackgroundDev();
177-
DrawHUD({ 0, 0 }, res, g_mnewRodinFont, pMode->m_StageMapName.get());
178188

179-
const float WINDOW_WIDTH = 0.8f * res.x;
180-
const float BUTTON_HEIGHT = 0.05f * res.y;
181-
const float BUTTON_SPACING = 5.0f;
182-
const int VISIBLE_ITEMS = 9;
183-
const float ITEMS_SCALE_HEIGHT = 0.05f * Video::s_viewportHeight;
184-
const float WINDOW_HEIGHT = (BUTTON_HEIGHT + BUTTON_SPACING) * VISIBLE_ITEMS + ITEMS_SCALE_HEIGHT;
189+
if (Config::DevTitle == EDevTitleMenu::Custom) DrawHUD({ 0, 0 }, res, g_mnewRodinFont, pMode->m_StageMapName.get());
190+
191+
float WINDOW_WIDTH = 0.8f * res.x;
192+
float BUTTON_HEIGHT = 0.05f * res.y;
193+
float BUTTON_SPACING = 5.0f;
194+
int VISIBLE_ITEMS = 9;
195+
float ITEMS_SCALE_HEIGHT = 0.05f * Video::s_viewportHeight;
196+
float WINDOW_HEIGHT = (BUTTON_HEIGHT + BUTTON_SPACING) * VISIBLE_ITEMS + ITEMS_SCALE_HEIGHT;
185197

186-
// Calculate base position for the selector
187-
const ImVec2 base_pos = {
198+
ImVec2 base_pos = {
188199
(res.x - WINDOW_WIDTH) * 0.15f,
189200
(res.y - WINDOW_HEIGHT) * 0.45f
190-
};
191-
201+
};
202+
203+
if (Config::DevTitle == EDevTitleMenu::True)
204+
{
205+
VISIBLE_ITEMS = 18;
206+
base_pos.x = 0;
207+
base_pos.y = 0;
208+
}
209+
192210
auto& items = pMode->m_CurrentStageMap->m_vpStageMap;
193211
const int itemCount = static_cast<int>(items.size());
194212
int currentIdx = pMode->m_CurrentStageMapIndex.get();
@@ -224,8 +242,17 @@ static void DrawStageMapSelector()
224242
base_pos.x + 10,
225243
base_pos.y + 40 + visible_index * (BUTTON_HEIGHT + BUTTON_SPACING)
226244
};
245+
std::string item_name = item->m_Name.c_str();
246+
if (item->m_vpStageMap.size() > 1)
247+
{
248+
item_name = "[" + item_name + "]"; //mark as group
249+
}
250+
if (isSelected)
251+
{
252+
item_name = ">> " + item_name;
253+
}
227254

228-
if (Sonic06Button(button_pos, item->m_Name.c_str(),hovered,
255+
if (Sonic06Button(button_pos, item_name.c_str(), hovered,
229256
ImVec2(WINDOW_WIDTH - 20, BUTTON_HEIGHT), isSelected,CenterFlag::Y))
230257
{
231258
currentIdx = i;
@@ -235,7 +262,7 @@ static void DrawStageMapSelector()
235262
}
236263

237264
// Tooltip with stage information
238-
if (hovered && item->m_vpStageMap.size() > 0) {
265+
if (hovered && item->m_vpStageMap.size() > 0 && Config::DevTitle == EDevTitleMenu::Custom) {
239266
ImDrawList* draw_list = ImGui::GetForegroundDrawList();
240267
const ImVec2 mouse_pos = GetMousePos();
241268
const float font_size = ImGui::GetFontSize();
@@ -316,10 +343,12 @@ static void DrawStageMapSelector()
316343
current_y += line_height + line_spacing;
317344
}
318345
}
319-
320-
346+
347+
321348
}
322349

350+
//Do not draw mouse, if not custom
351+
if (Config::DevTitle != EDevTitleMenu::Custom) return;
323352
// Draw mouse position indicator
324353
const float dot_radius = 7.5f;
325354
const ImU32 dot_color = IM_COL32(0, 150, 255, 220);
@@ -506,7 +535,7 @@ void DevTitleMenu::Draw()
506535
if (!App::s_pApp->m_pDoc->m_pDocMode)
507536
return;
508537

509-
if (!EmbeddedPlayer::s_isActive)
538+
if (!EmbeddedPlayer::s_isActive && Config::DevTitle == EDevTitleMenu::Custom)
510539
EmbeddedPlayer::Init();
511540

512541
auto vft = App::s_pApp->m_pDoc->GetDocMode<Sonicteam::SoX::Engine::Task::Object>()->m_pVftable.ptr.get();

MarathonRecomp/user/config.cpp

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -373,6 +373,13 @@ CONFIG_DEFINE_ENUM_TEMPLATE(EUIAlignmentMode)
373373
{ "Center", EUIAlignmentMode::Centre }
374374
};
375375

376+
CONFIG_DEFINE_ENUM_TEMPLATE(EDevTitleMenu)
377+
{
378+
{ "false", EDevTitleMenu::False },
379+
{ "true", EDevTitleMenu::True },
380+
{ "custom", EDevTitleMenu::Custom }
381+
};
382+
376383
#undef CONFIG_DEFINE
377384
#define CONFIG_DEFINE(section, type, name, defaultValue) \
378385
ConfigDef<type> Config::name{section, #name, defaultValue};
@@ -381,6 +388,10 @@ CONFIG_DEFINE_ENUM_TEMPLATE(EUIAlignmentMode)
381388
#define CONFIG_DEFINE_HIDDEN(section, type, name, defaultValue) \
382389
ConfigDef<type, true> Config::name{section, #name, defaultValue};
383390

391+
#undef CONFIG_DEFINE_ENUM_HIDDEN
392+
#define CONFIG_DEFINE_ENUM_HIDDEN(section, type, name, defaultValue) \
393+
ConfigDef<type,true> Config::name{section, #name, defaultValue, &g_##type##_template};
394+
384395
#undef CONFIG_DEFINE_LOCALISED
385396
#define CONFIG_DEFINE_LOCALISED(section, type, name, defaultValue) \
386397
extern CONFIG_LOCALE g_##name##_locale; \

MarathonRecomp/user/config.h

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -150,6 +150,17 @@ enum class EPlayerCharacter : uint32_t
150150
Rouge,
151151
Knuckles
152152
};
153+
enum class EDevTitleMenu : uint32_t
154+
{
155+
False,
156+
True,
157+
Custom
158+
};
159+
160+
inline uint32_t operator!(EDevTitleMenu value)
161+
{
162+
return (uint32_t)value == 0;
163+
}
153164

154165
template<typename T, bool isHidden = false>
155166
class ConfigDef final : public IConfigDef
@@ -219,6 +230,7 @@ class ConfigDef final : public IConfigDef
219230
#define CONFIG_DEFINE_HIDDEN(section, type, name, defaultValue) CONFIG_DECLARE_HIDDEN(type, name)
220231
#define CONFIG_DEFINE_LOCALISED(section, type, name, defaultValue) CONFIG_DECLARE(type, name)
221232
#define CONFIG_DEFINE_ENUM(section, type, name, defaultValue) CONFIG_DECLARE(type, name)
233+
#define CONFIG_DEFINE_ENUM_HIDDEN(section, type, name, defaultValue) CONFIG_DECLARE_HIDDEN(type, name)
222234
#define CONFIG_DEFINE_ENUM_LOCALISED(section, type, name, defaultValue) CONFIG_DECLARE(type, name)
223235

224236
class Config

MarathonRecomp/user/config_def.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ CONFIG_DEFINE_HIDDEN("Codes", bool, DisableEdgeGrabLeftover, false);
9191
CONFIG_DEFINE_HIDDEN("Codes", bool, TailsGauge, false);
9292
CONFIG_DEFINE_HIDDEN("Codes", bool, EnableDebugMode, false);
9393
CONFIG_DEFINE_HIDDEN("Codes", bool, RestoreDemoCameraMode, false);
94-
CONFIG_DEFINE_HIDDEN("Codes", bool, DevTitle, false);
94+
CONFIG_DEFINE_ENUM_HIDDEN("Codes", EDevTitleMenu, DevTitle, EDevTitleMenu::False);
9595
CONFIG_DEFINE_HIDDEN("Codes", bool, MidairControlForMachSpeed, false);
9696
CONFIG_DEFINE_HIDDEN("Codes", bool, MidairControlForSnowboards, false);
9797
CONFIG_DEFINE_HIDDEN("Codes", bool, ControllableTeleportDash, false);

0 commit comments

Comments
 (0)