mirror of
https://github.com/hedge-dev/UnleashedRecomp.git
synced 2026-04-27 21:01:37 +00:00
Implemented button guide
This commit is contained in:
parent
0248ef664e
commit
35990687c6
10 changed files with 440 additions and 7 deletions
|
|
@ -111,6 +111,7 @@ set(SWA_PATCHES_CXX_SOURCES
|
|||
set(SWA_UI_CXX_SOURCES
|
||||
"ui/achievement_menu.cpp"
|
||||
"ui/achievement_overlay.cpp"
|
||||
"ui/button_guide.cpp"
|
||||
"ui/message_window.cpp"
|
||||
"ui/options_menu.cpp"
|
||||
"ui/sdl_listener.cpp"
|
||||
|
|
@ -319,8 +320,11 @@ set(RESOURCES_OUTPUT_PATH "${PROJECT_SOURCE_DIR}/res")
|
|||
|
||||
BIN2C(TARGET_OBJ UnleashedRecomp SOURCE_FILE "${RESOURCES_SOURCE_PATH}/images/achievements_menu/trophy.dds" DEST_FILE "${RESOURCES_OUTPUT_PATH}/images/achievements_menu/trophy.dds" ARRAY_NAME "g_trophy" COMPRESSION_TYPE "zstd")
|
||||
BIN2C(TARGET_OBJ UnleashedRecomp SOURCE_FILE "${RESOURCES_SOURCE_PATH}/images/common/general_window.dds" DEST_FILE "${RESOURCES_OUTPUT_PATH}/images/common/general_window.dds" ARRAY_NAME "g_general_window" COMPRESSION_TYPE "zstd")
|
||||
BIN2C(TARGET_OBJ UnleashedRecomp SOURCE_FILE "${RESOURCES_SOURCE_PATH}/images/common/left_mouse_button.dds" DEST_FILE "${RESOURCES_OUTPUT_PATH}/images/common/left_mouse_button.dds" ARRAY_NAME "g_left_mouse_button" COMPRESSION_TYPE "zstd")
|
||||
BIN2C(TARGET_OBJ UnleashedRecomp SOURCE_FILE "${RESOURCES_SOURCE_PATH}/images/common/mat_comon_x360_001.dds" DEST_FILE "${RESOURCES_OUTPUT_PATH}/images/common/mat_comon_x360_001.dds" ARRAY_NAME "g_mat_comon_x360_001" COMPRESSION_TYPE "zstd")
|
||||
BIN2C(TARGET_OBJ UnleashedRecomp SOURCE_FILE "${RESOURCES_SOURCE_PATH}/images/common/select_fade.dds" DEST_FILE "${RESOURCES_OUTPUT_PATH}/images/common/select_fade.dds" ARRAY_NAME "g_select_fade" COMPRESSION_TYPE "zstd")
|
||||
BIN2C(TARGET_OBJ UnleashedRecomp SOURCE_FILE "${RESOURCES_SOURCE_PATH}/images/common/select_fill.dds" DEST_FILE "${RESOURCES_OUTPUT_PATH}/images/common/select_fill.dds" ARRAY_NAME "g_select_fill" COMPRESSION_TYPE "zstd")
|
||||
BIN2C(TARGET_OBJ UnleashedRecomp SOURCE_FILE "${RESOURCES_SOURCE_PATH}/images/common/start_back.dds" DEST_FILE "${RESOURCES_OUTPUT_PATH}/images/common/start_back.dds" ARRAY_NAME "g_start_back" COMPRESSION_TYPE "zstd")
|
||||
BIN2C(TARGET_OBJ UnleashedRecomp SOURCE_FILE "${RESOURCES_SOURCE_PATH}/images/game_icon.bmp" DEST_FILE "${RESOURCES_OUTPUT_PATH}/images/game_icon.bmp" ARRAY_NAME "g_game_icon")
|
||||
BIN2C(TARGET_OBJ UnleashedRecomp SOURCE_FILE "${RESOURCES_SOURCE_PATH}/images/game_icon_night.bmp" DEST_FILE "${RESOURCES_OUTPUT_PATH}/images/game_icon_night.bmp" ARRAY_NAME "g_game_icon_night")
|
||||
BIN2C(TARGET_OBJ UnleashedRecomp SOURCE_FILE "${RESOURCES_SOURCE_PATH}/font/im_font_atlas.bin" DEST_FILE "${RESOURCES_OUTPUT_PATH}/font/im_font_atlas.bin" ARRAY_NAME "g_im_font_atlas" COMPRESSION_TYPE "zstd")
|
||||
|
|
|
|||
|
|
@ -11,6 +11,7 @@
|
|||
#include <shader/shader_cache.h>
|
||||
#include <ui/achievement_menu.h>
|
||||
#include <ui/achievement_overlay.h>
|
||||
#include <ui/button_guide.h>
|
||||
#include <ui/message_window.h>
|
||||
#include <ui/options_menu.h>
|
||||
|
||||
|
|
@ -1078,6 +1079,7 @@ static void CreateImGuiBackend()
|
|||
|
||||
AchievementMenu::Init();
|
||||
AchievementOverlay::Init();
|
||||
ButtonGuide::Init();
|
||||
MessageWindow::Init();
|
||||
OptionsMenu::Init();
|
||||
|
||||
|
|
@ -1787,6 +1789,7 @@ static void DrawImGui()
|
|||
OptionsMenu::Draw();
|
||||
AchievementOverlay::Draw();
|
||||
MessageWindow::Draw();
|
||||
ButtonGuide::Draw();
|
||||
|
||||
ImGui::Render();
|
||||
|
||||
|
|
|
|||
|
|
@ -83,6 +83,36 @@ inline static std::unordered_map<std::string, std::unordered_map<ELanguage, std:
|
|||
{
|
||||
{ ELanguage::English, "Achievement Unlocked!" }
|
||||
}
|
||||
},
|
||||
{
|
||||
"Common_Next",
|
||||
{
|
||||
{ ELanguage::English, "Next" }
|
||||
}
|
||||
},
|
||||
{
|
||||
"Common_Select",
|
||||
{
|
||||
{ ELanguage::English, "Select" }
|
||||
}
|
||||
},
|
||||
{
|
||||
"Common_Back",
|
||||
{
|
||||
{ ELanguage::English, "Back" }
|
||||
}
|
||||
},
|
||||
{
|
||||
"Common_Reset",
|
||||
{
|
||||
{ ELanguage::English, "Reset" }
|
||||
}
|
||||
},
|
||||
{
|
||||
"Common_Switch",
|
||||
{
|
||||
{ ELanguage::English, "Switch" }
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -4,6 +4,7 @@
|
|||
#include <gpu/video.h>
|
||||
#include <kernel/xdbf.h>
|
||||
#include <locale/locale.h>
|
||||
#include <ui/button_guide.h>
|
||||
#include <user/achievement_data.h>
|
||||
#include <user/config.h>
|
||||
#include <app.h>
|
||||
|
|
@ -656,6 +657,8 @@ void AchievementMenu::Open()
|
|||
return std::get<1>(a) > std::get<1>(b);
|
||||
});
|
||||
|
||||
ButtonGuide::Open({ Button(Localise("Common_Back"), EButtonIcon::B) });
|
||||
|
||||
ResetSelection();
|
||||
Game_PlaySound("sys_actstg_pausewinopen");
|
||||
}
|
||||
|
|
@ -668,6 +671,8 @@ void AchievementMenu::Close()
|
|||
g_isClosing = true;
|
||||
}
|
||||
|
||||
ButtonGuide::Close();
|
||||
|
||||
Game_PlaySound("sys_actstg_pausewinclose");
|
||||
Game_PlaySound("sys_actstg_pausecansel");
|
||||
}
|
||||
|
|
|
|||
305
UnleashedRecomp/ui/button_guide.cpp
Normal file
305
UnleashedRecomp/ui/button_guide.cpp
Normal file
|
|
@ -0,0 +1,305 @@
|
|||
#include "button_guide.h"
|
||||
#include "imgui_utils.h"
|
||||
#include <gpu/imgui_snapshot.h>
|
||||
#include <gpu/video.h>
|
||||
#include <decompressor.h>
|
||||
#include <res/images/common/left_mouse_button.dds.h>
|
||||
#include <res/images/common/mat_comon_x360_001.dds.h>
|
||||
#include <res/images/common/start_back.dds.h>
|
||||
|
||||
constexpr float DEFAULT_SIDE_MARGINS = 379;
|
||||
|
||||
ImFont* g_fntNewRodin;
|
||||
ImFont* g_fntNewRodinLQ;
|
||||
|
||||
std::unique_ptr<GuestTexture> g_upIcons;
|
||||
std::unique_ptr<GuestTexture> g_upLMBIcon;
|
||||
std::unique_ptr<GuestTexture> g_upStartBackIcons;
|
||||
|
||||
float g_sideMargins = DEFAULT_SIDE_MARGINS;
|
||||
|
||||
std::vector<Button> g_buttons;
|
||||
|
||||
std::unordered_map<EButtonIcon, float> g_iconWidths =
|
||||
{
|
||||
{ EButtonIcon::A, 40 },
|
||||
{ EButtonIcon::B, 40 },
|
||||
{ EButtonIcon::X, 40 },
|
||||
{ EButtonIcon::Y, 40 },
|
||||
{ EButtonIcon::LB, 70 },
|
||||
{ EButtonIcon::RB, 70 },
|
||||
{ EButtonIcon::LBRB, 70 },
|
||||
{ EButtonIcon::LT, 42 },
|
||||
{ EButtonIcon::RT, 42 },
|
||||
{ EButtonIcon::LTRT, 42 },
|
||||
{ EButtonIcon::Start, 40 },
|
||||
{ EButtonIcon::Back, 40 },
|
||||
{ EButtonIcon::LMB, 40 }
|
||||
};
|
||||
|
||||
std::unordered_map<EButtonIcon, float> g_iconHeights =
|
||||
{
|
||||
{ EButtonIcon::A, 40 },
|
||||
{ EButtonIcon::B, 40 },
|
||||
{ EButtonIcon::X, 40 },
|
||||
{ EButtonIcon::Y, 40 },
|
||||
{ EButtonIcon::LB, 40 },
|
||||
{ EButtonIcon::RB, 40 },
|
||||
{ EButtonIcon::LBRB, 40 },
|
||||
{ EButtonIcon::LT, 42 },
|
||||
{ EButtonIcon::RT, 42 },
|
||||
{ EButtonIcon::LTRT, 42 },
|
||||
{ EButtonIcon::Start, 40 },
|
||||
{ EButtonIcon::Back, 40 },
|
||||
{ EButtonIcon::LMB, 40 }
|
||||
};
|
||||
|
||||
std::tuple<std::tuple<ImVec2, ImVec2>, GuestTexture*> GetButtonIcon(EButtonIcon icon)
|
||||
{
|
||||
std::tuple<ImVec2, ImVec2> btn;
|
||||
GuestTexture* texture;
|
||||
|
||||
switch (icon)
|
||||
{
|
||||
case EButtonIcon::A:
|
||||
btn = PIXELS_TO_UV_COORDS(512, 512, 0, 0, 40, 40);
|
||||
texture = g_upIcons.get();
|
||||
break;
|
||||
|
||||
case EButtonIcon::B:
|
||||
btn = PIXELS_TO_UV_COORDS(512, 512, 40, 0, 40, 40);
|
||||
texture = g_upIcons.get();
|
||||
break;
|
||||
|
||||
case EButtonIcon::X:
|
||||
btn = PIXELS_TO_UV_COORDS(512, 512, 80, 0, 40, 40);
|
||||
texture = g_upIcons.get();
|
||||
break;
|
||||
|
||||
case EButtonIcon::Y:
|
||||
btn = PIXELS_TO_UV_COORDS(512, 512, 120, 0, 40, 40);
|
||||
texture = g_upIcons.get();
|
||||
break;
|
||||
|
||||
case EButtonIcon::LB:
|
||||
btn = PIXELS_TO_UV_COORDS(512, 512, 166, 0, 70, 40);
|
||||
texture = g_upIcons.get();
|
||||
break;
|
||||
|
||||
case EButtonIcon::RB:
|
||||
btn = PIXELS_TO_UV_COORDS(512, 512, 246, 0, 70, 40);
|
||||
texture = g_upIcons.get();
|
||||
break;
|
||||
|
||||
case EButtonIcon::LT:
|
||||
btn = PIXELS_TO_UV_COORDS(512, 512, 319, 0, 42, 42);
|
||||
texture = g_upIcons.get();
|
||||
break;
|
||||
|
||||
case EButtonIcon::RT:
|
||||
btn = PIXELS_TO_UV_COORDS(512, 512, 359, 0, 42, 42);
|
||||
texture = g_upIcons.get();
|
||||
break;
|
||||
|
||||
case EButtonIcon::Start:
|
||||
btn = PIXELS_TO_UV_COORDS(256, 256, 0, 0, 128, 128);
|
||||
texture = g_upStartBackIcons.get();
|
||||
break;
|
||||
|
||||
case EButtonIcon::Back:
|
||||
btn = PIXELS_TO_UV_COORDS(256, 256, 0, 128, 128, 128);
|
||||
texture = g_upStartBackIcons.get();
|
||||
break;
|
||||
|
||||
case EButtonIcon::LMB:
|
||||
btn = PIXELS_TO_UV_COORDS(128, 128, 0, 0, 128, 128);
|
||||
texture = g_upLMBIcon.get();
|
||||
break;
|
||||
}
|
||||
|
||||
return std::make_tuple(btn, texture);
|
||||
}
|
||||
|
||||
ImFont* GetFont(EFontQuality fontQuality)
|
||||
{
|
||||
return fontQuality == EFontQuality::Low
|
||||
? g_fntNewRodinLQ
|
||||
: g_fntNewRodin;
|
||||
}
|
||||
|
||||
static void DrawGuide(float* offset, ImVec2 regionMin, ImVec2 regionMax, EButtonIcon icon,
|
||||
EButtonAlignment alignment, ImVec2 iconMin, ImVec2 iconMax, EFontQuality fontQuality,
|
||||
ImVec2 textSize, float fontSize, const char* text)
|
||||
{
|
||||
auto drawList = ImGui::GetForegroundDrawList();
|
||||
auto _icon = icon;
|
||||
auto iconWidth = Scale(g_iconWidths[icon]);
|
||||
auto dualIconMarginX = Scale(25);
|
||||
|
||||
if (icon == EButtonIcon::LBRB)
|
||||
{
|
||||
_icon = EButtonIcon::LB;
|
||||
}
|
||||
else if (icon == EButtonIcon::LTRT)
|
||||
{
|
||||
_icon = EButtonIcon::LT;
|
||||
}
|
||||
else
|
||||
{
|
||||
dualIconMarginX = 0;
|
||||
}
|
||||
|
||||
if (icon == EButtonIcon::LBRB || icon == EButtonIcon::LTRT)
|
||||
{
|
||||
iconMin = alignment == EButtonAlignment::Left
|
||||
? ImVec2(/* X */ regionMin.x + *offset - dualIconMarginX * 3, /* Y */ iconMin.y)
|
||||
: ImVec2(/* X */ regionMax.x - *offset - textSize.x - iconWidth, /* Y */ iconMin.y);
|
||||
|
||||
iconMax = alignment == EButtonAlignment::Left
|
||||
? ImVec2(iconMin.x + iconWidth, iconMax.y)
|
||||
: ImVec2(iconMin.x, iconMax.y);
|
||||
}
|
||||
|
||||
auto btnIcon = GetButtonIcon(_icon);
|
||||
drawList->AddImage(std::get<1>(btnIcon), iconMin, iconMax, GET_UV_COORDS(std::get<0>(btnIcon)));
|
||||
|
||||
auto textMarginX = alignment == EButtonAlignment::Left
|
||||
? regionMin.x + *offset + dualIconMarginX
|
||||
: regionMax.x - *offset - dualIconMarginX * 2;
|
||||
|
||||
DrawTextWithOutline<int>
|
||||
(
|
||||
GetFont(fontQuality),
|
||||
fontSize,
|
||||
{ /* X */ textMarginX, /* Y */ regionMin.y + Scale(8) },
|
||||
IM_COL32(255, 255, 255, 255),
|
||||
text,
|
||||
2,
|
||||
IM_COL32(0, 0, 0, 255)
|
||||
);
|
||||
|
||||
if (icon == EButtonIcon::LBRB || icon == EButtonIcon::LTRT)
|
||||
{
|
||||
auto btnIcon = GetButtonIcon(icon == EButtonIcon::LBRB ? EButtonIcon::RB : EButtonIcon::RT);
|
||||
|
||||
auto dualIconMin = alignment == EButtonAlignment::Left
|
||||
? ImVec2(/* X */ regionMin.x + *offset + textSize.x + dualIconMarginX * 2, /* Y */ iconMin.y)
|
||||
: ImVec2(/* X */ regionMax.x - *offset + textSize.x - dualIconMarginX, /* Y */ iconMin.y);
|
||||
|
||||
auto dualIconMax = ImVec2(dualIconMin.x + iconWidth, iconMax.y);
|
||||
|
||||
drawList->AddImage(std::get<1>(btnIcon), dualIconMin, dualIconMax, GET_UV_COORDS(std::get<0>(btnIcon)));
|
||||
|
||||
*offset += dualIconMarginX + iconWidth;
|
||||
}
|
||||
}
|
||||
|
||||
void ButtonGuide::Init()
|
||||
{
|
||||
auto& io = ImGui::GetIO();
|
||||
|
||||
constexpr float FONT_SCALE = 2.0f;
|
||||
|
||||
g_fntNewRodin = ImFontAtlasSnapshot::GetFont("FOT-NewRodinPro-M.otf", 24.0f * FONT_SCALE);
|
||||
g_fntNewRodinLQ = ImFontAtlasSnapshot::GetFont("FOT-NewRodinPro-M.otf", 19.0f);
|
||||
|
||||
g_upIcons = LoadTexture(
|
||||
decompressZstd(g_mat_comon_x360_001, g_mat_comon_x360_001_uncompressed_size).get(),
|
||||
g_mat_comon_x360_001_uncompressed_size);
|
||||
|
||||
g_upLMBIcon = LoadTexture(
|
||||
decompressZstd(g_left_mouse_button, g_left_mouse_button_uncompressed_size).get(),
|
||||
g_left_mouse_button_uncompressed_size);
|
||||
|
||||
g_upStartBackIcons = LoadTexture(
|
||||
decompressZstd(g_start_back, g_start_back_uncompressed_size).get(),
|
||||
g_start_back_uncompressed_size);
|
||||
}
|
||||
|
||||
void ButtonGuide::Draw()
|
||||
{
|
||||
if (!s_isVisible)
|
||||
return;
|
||||
|
||||
auto drawList = ImGui::GetForegroundDrawList();
|
||||
auto& res = ImGui::GetIO().DisplaySize;
|
||||
|
||||
auto regionMarginX = Scale(g_sideMargins);
|
||||
auto regionHeight = Scale(102);
|
||||
|
||||
ImVec2 regionMin = { regionMarginX, res.y - regionHeight };
|
||||
ImVec2 regionMax = { res.x - regionMarginX, res.y };
|
||||
|
||||
auto textMarginX = Scale(57);
|
||||
auto textMarginY = Scale(8);
|
||||
auto iconMarginX = Scale(4);
|
||||
auto fontSize = Scale(22.5f);
|
||||
|
||||
auto offsetLeft = 0.0f;
|
||||
auto offsetRight = 0.0f;
|
||||
|
||||
// Draw left aligned icons.
|
||||
for (int i = 0; i < g_buttons.size(); i++)
|
||||
{
|
||||
auto& btn = g_buttons[i];
|
||||
|
||||
if (btn.Alignment != EButtonAlignment::Left)
|
||||
continue;
|
||||
|
||||
if (btn.Visibility && !*btn.Visibility)
|
||||
continue;
|
||||
|
||||
auto iconWidth = Scale(g_iconWidths[btn.Icon]);
|
||||
auto iconHeight = Scale(g_iconHeights[btn.Icon]);
|
||||
auto textSize = g_fntNewRodin->CalcTextSizeA(fontSize, FLT_MAX, 0, btn.Name.c_str());
|
||||
|
||||
if (i > 0)
|
||||
offsetLeft += textSize.x + iconWidth + textMarginX;
|
||||
|
||||
ImVec2 iconMin = { regionMin.x + offsetLeft - iconWidth - iconMarginX, regionMin.y };
|
||||
ImVec2 iconMax = { regionMin.x + offsetLeft - iconMarginX, regionMin.y + iconHeight };
|
||||
|
||||
DrawGuide(&offsetLeft, regionMin, regionMax, btn.Icon, btn.Alignment, iconMin, iconMax, btn.FontQuality, textSize, fontSize, btn.Name.c_str());
|
||||
}
|
||||
|
||||
// Draw right aligned icons.
|
||||
for (int i = g_buttons.size() - 1; i >= 0; i--)
|
||||
{
|
||||
auto& btn = g_buttons[i];
|
||||
|
||||
if (btn.Alignment != EButtonAlignment::Right)
|
||||
continue;
|
||||
|
||||
if (btn.Visibility && !*btn.Visibility)
|
||||
continue;
|
||||
|
||||
auto iconWidth = Scale(g_iconWidths[btn.Icon]);
|
||||
auto iconHeight = Scale(g_iconHeights[btn.Icon]);
|
||||
auto textSize = g_fntNewRodin->CalcTextSizeA(fontSize, FLT_MAX, 0, btn.Name.c_str());
|
||||
|
||||
if (i < g_buttons.size() - 1)
|
||||
offsetRight += textSize.x + iconWidth + textMarginX;
|
||||
|
||||
ImVec2 iconMin = { regionMax.x - offsetRight - iconWidth - iconMarginX, regionMin.y };
|
||||
ImVec2 iconMax = { regionMax.x - offsetRight - iconMarginX, regionMin.y + iconHeight };
|
||||
|
||||
DrawGuide(&offsetRight, regionMin, regionMax, btn.Icon, btn.Alignment, iconMin, iconMax, btn.FontQuality, textSize, fontSize, btn.Name.c_str());
|
||||
}
|
||||
}
|
||||
|
||||
void ButtonGuide::Open(const std::vector<Button> buttons)
|
||||
{
|
||||
s_isVisible = true;
|
||||
g_sideMargins = DEFAULT_SIDE_MARGINS;
|
||||
g_buttons = buttons;
|
||||
}
|
||||
|
||||
void ButtonGuide::SetSideMargins(float width = DEFAULT_SIDE_MARGINS)
|
||||
{
|
||||
g_sideMargins = width;
|
||||
}
|
||||
|
||||
void ButtonGuide::Close()
|
||||
{
|
||||
s_isVisible = false;
|
||||
}
|
||||
61
UnleashedRecomp/ui/button_guide.h
Normal file
61
UnleashedRecomp/ui/button_guide.h
Normal file
|
|
@ -0,0 +1,61 @@
|
|||
#pragma once
|
||||
|
||||
#include <gpu/video.h>
|
||||
|
||||
enum class EButtonIcon
|
||||
{
|
||||
A,
|
||||
B,
|
||||
X,
|
||||
Y,
|
||||
LB,
|
||||
RB,
|
||||
LBRB,
|
||||
LT,
|
||||
RT,
|
||||
LTRT,
|
||||
Start,
|
||||
Back,
|
||||
LMB
|
||||
};
|
||||
|
||||
enum class EButtonAlignment
|
||||
{
|
||||
Left,
|
||||
Right
|
||||
};
|
||||
|
||||
enum class EFontQuality
|
||||
{
|
||||
Low,
|
||||
High
|
||||
};
|
||||
|
||||
class Button
|
||||
{
|
||||
public:
|
||||
std::string Name{};
|
||||
EButtonIcon Icon{};
|
||||
EButtonAlignment Alignment{ EButtonAlignment::Right };
|
||||
EFontQuality FontQuality{ EFontQuality::High };
|
||||
bool* Visibility{ nullptr };
|
||||
|
||||
Button(std::string name, EButtonIcon icon, EButtonAlignment alignment, EFontQuality fontQuality = EFontQuality::High, bool* visibility = nullptr)
|
||||
: Name(name), Icon(icon), Alignment(alignment), FontQuality(fontQuality), Visibility(visibility) {}
|
||||
|
||||
Button(std::string name, EButtonIcon icon, bool* visibility) : Name(name), Icon(icon), Visibility(visibility) {}
|
||||
|
||||
Button(std::string name, EButtonIcon icon) : Name(name), Icon(icon) {}
|
||||
};
|
||||
|
||||
class ButtonGuide
|
||||
{
|
||||
public:
|
||||
inline static bool s_isVisible = false;
|
||||
|
||||
static void Init();
|
||||
static void Draw();
|
||||
static void Open(const std::vector<Button> buttons);
|
||||
static void SetSideMargins(float width);
|
||||
static void Close();
|
||||
};
|
||||
|
|
@ -10,6 +10,7 @@
|
|||
#include <kernel/heap.h>
|
||||
#include <kernel/memory.h>
|
||||
#include <locale/locale.h>
|
||||
#include <ui/button_guide.h>
|
||||
|
||||
#include <patches/audio_patches.h>
|
||||
|
||||
|
|
@ -64,6 +65,7 @@ static const IConfigDef* g_selectedItem;
|
|||
static std::string* g_inaccessibleReason;
|
||||
|
||||
static bool g_isEnterKeyBuffered = false;
|
||||
static bool g_canReset = false;
|
||||
|
||||
static double g_appearTime = 0.0;
|
||||
|
||||
|
|
@ -497,6 +499,12 @@ static void DrawConfigOption(int32_t rowIndex, float yOffset, ConfigDef<T>* conf
|
|||
|
||||
lockedOnOption = g_lockedOnOption;
|
||||
}
|
||||
|
||||
if (g_canReset && padState.IsTapped(SWA::eKeyState_X))
|
||||
{
|
||||
config->MakeDefault();
|
||||
Game_PlaySound("sys_worldmap_decide");
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
@ -522,6 +530,9 @@ static void DrawConfigOption(int32_t rowIndex, float yOffset, ConfigDef<T>* conf
|
|||
drawList->AddRectFilledMultiColor({ min.x, min.y + prevItemOffset }, { max.x, max.y + prevItemOffset }, c0, c0, c1, c1);
|
||||
|
||||
DrawTextWithMarquee(g_seuratFont, size, textPos, min, max, textColour, configName.c_str(), g_rowSelectionTime, 0.9, 250.0);
|
||||
|
||||
// Show reset button if this option is accessible or not a language option.
|
||||
g_canReset = g_selectedItem->GetName().find("Language") == std::string::npos && isAccessible;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
@ -773,16 +784,11 @@ static void DrawConfigOptions()
|
|||
DrawConfigOption(rowCount++, yOffset, &Config::Hints, !isStage, cmnReason);
|
||||
DrawConfigOption(rowCount++, yOffset, &Config::ControlTutorial, !isStage, cmnReason);
|
||||
DrawConfigOption(rowCount++, yOffset, &Config::AchievementNotifications, true);
|
||||
DrawConfigOption(rowCount++, yOffset, &Config::SaveScoreAtCheckpoints, true);
|
||||
DrawConfigOption(rowCount++, yOffset, &Config::UnleashGaugeBehaviour, true);
|
||||
DrawConfigOption(rowCount++, yOffset, &Config::TimeOfDayTransition, true);
|
||||
DrawConfigOption(rowCount++, yOffset, &Config::SkipIntroLogos, true);
|
||||
break;
|
||||
case 1: // INPUT
|
||||
DrawConfigOption(rowCount++, yOffset, &Config::InvertCameraX, true);
|
||||
DrawConfigOption(rowCount++, yOffset, &Config::InvertCameraY, true);
|
||||
DrawConfigOption(rowCount++, yOffset, &Config::XButtonHoming, OptionsMenu::s_pauseMenuType == SWA::eMenuType_WorldMap, cmnReason);
|
||||
DrawConfigOption(rowCount++, yOffset, &Config::AllowCancellingUnleash, true);
|
||||
DrawConfigOption(rowCount++, yOffset, &Config::AllowBackgroundInput, true);
|
||||
break;
|
||||
case 2: // AUDIO
|
||||
|
|
@ -1027,6 +1033,18 @@ void OptionsMenu::Open(bool isPause, SWA::EMenuType pauseMenuType)
|
|||
|
||||
*(bool*)g_memory.Translate(0x8328BB26) = false;
|
||||
|
||||
ButtonGuide::Open
|
||||
(
|
||||
{
|
||||
Button(Localise("Common_Switch"), EButtonIcon::LBRB, EButtonAlignment::Left),
|
||||
Button(Localise("Common_Reset"), EButtonIcon::X, &g_canReset),
|
||||
Button(Localise("Common_Select"), EButtonIcon::A),
|
||||
Button(Localise("Common_Back"), EButtonIcon::B)
|
||||
}
|
||||
);
|
||||
|
||||
ButtonGuide::SetSideMargins(150);
|
||||
|
||||
// TODO: animate Miles Electric in if we're in a stage.
|
||||
}
|
||||
|
||||
|
|
@ -1036,6 +1054,7 @@ void OptionsMenu::Close()
|
|||
|
||||
*(bool*)g_memory.Translate(0x8328BB26) = true;
|
||||
|
||||
ButtonGuide::Close();
|
||||
Config::Save();
|
||||
|
||||
// TODO: animate Miles Electric out if we're in a stage.
|
||||
|
|
|
|||
|
|
@ -219,6 +219,7 @@ public:
|
|||
virtual std::string_view GetName() const = 0;
|
||||
virtual std::string GetNameLocalised() const = 0;
|
||||
virtual std::string GetDescription() const = 0;
|
||||
virtual bool IsDefaultValue() const = 0;
|
||||
virtual const void* GetValue() const = 0;
|
||||
virtual std::string GetValueLocalised() const = 0;
|
||||
virtual std::string GetValueDescription() const = 0;
|
||||
|
|
@ -301,6 +302,11 @@ public:
|
|||
|
||||
std::string GetDescription() const override;
|
||||
|
||||
bool IsDefaultValue() const override
|
||||
{
|
||||
return Value == DefaultValue;
|
||||
}
|
||||
|
||||
const void* GetValue() const override
|
||||
{
|
||||
return &Value;
|
||||
|
|
|
|||
|
|
@ -1 +1 @@
|
|||
Subproject commit 96cbb00e929c3731e01685a7352f59a417d606a4
|
||||
Subproject commit fe09833a4d385388a915a9a8de672db81f590c41
|
||||
2
thirdparty/PowerRecomp
vendored
2
thirdparty/PowerRecomp
vendored
|
|
@ -1 +1 @@
|
|||
Subproject commit ea3e60cb0d618ec8d24cc745d72b1ac39cc722cc
|
||||
Subproject commit 02d23b3463ca2048a0d60f67e46df12fdba31369
|
||||
Loading…
Add table
Reference in a new issue