Add controller buttons as config option & handle loading screen.

This commit is contained in:
Skyth 2024-12-07 14:25:10 +03:00
parent c193179158
commit 2651bfa5a1
8 changed files with 54 additions and 3 deletions

View file

@ -2614,7 +2614,7 @@ static void ProcSetViewport(const RenderCommand& cmd)
static void SetTexture(GuestDevice* device, uint32_t index, GuestTexture* texture) static void SetTexture(GuestDevice* device, uint32_t index, GuestTexture* texture)
{ {
if (texture != nullptr && texture->patchedTexture != nullptr) if (Config::ControllerButtons == EControllerButtons::PlayStation && texture != nullptr && texture->patchedTexture != nullptr)
texture = texture->patchedTexture.get(); texture = texture->patchedTexture.get();
RenderCommand cmd; RenderCommand cmd;

View file

@ -131,6 +131,22 @@ CONFIG_DEFINE_ENUM_LOCALE(ETimeOfDayTransition)
} }
}; };
CONFIG_DEFINE_LOCALE(ControllerButtons)
{
{ ELanguage::English, { "Controller Buttons", "[PLACEHOLDER]" } }
};
CONFIG_DEFINE_ENUM_LOCALE(EControllerButtons)
{
{
ELanguage::English,
{
{ EControllerButtons::Xbox, { "XBOX", "[PLACEHOLDER]" } },
{ EControllerButtons::PlayStation, { "PLAYSTATION", "[PLACEHOLDER]" } }
}
}
};
CONFIG_DEFINE_LOCALE(SkipIntroLogos) CONFIG_DEFINE_LOCALE(SkipIntroLogos)
{ {
{ ELanguage::English, { "Skip Intro Logos", "Skip the logos during the game's boot sequence.\n\n[TO BE REMOVED]" } } { ELanguage::English, { "Skip Intro Logos", "Skip the logos during the game's boot sequence.\n\n[TO BE REMOVED]" } }

View file

@ -101,3 +101,20 @@ PPC_FUNC(sub_82BD06C8)
{ {
ctx.r3.u64 = 0; ctx.r3.u64 = 0;
} }
void LoadingScreenControllerMidAsmHook()
{
static constexpr size_t STR_ADDRESSES[] =
{
0x820301AC, // 360_sonic1
0x820301B8, // 360_sonic2
0x820301C4, // 360_sonic3
0x820301D0, // 360_evil
0x820301DC, // 360_robo
0x820301E8, // 360_super
};
const char* prefix = Config::ControllerButtons == EControllerButtons::PlayStation ? "ps3" : "360";
for (auto address : STR_ADDRESSES)
memcpy(g_memory.Translate(address), prefix, 3);
}

View file

@ -790,6 +790,7 @@ static void DrawConfigOptions()
DrawConfigOption(rowCount++, yOffset, &Config::InvertCameraX, true); DrawConfigOption(rowCount++, yOffset, &Config::InvertCameraX, true);
DrawConfigOption(rowCount++, yOffset, &Config::InvertCameraY, true); DrawConfigOption(rowCount++, yOffset, &Config::InvertCameraY, true);
DrawConfigOption(rowCount++, yOffset, &Config::AllowBackgroundInput, true); DrawConfigOption(rowCount++, yOffset, &Config::AllowBackgroundInput, true);
DrawConfigOption(rowCount++, yOffset, &Config::ControllerButtons, true);
break; break;
case 2: // AUDIO case 2: // AUDIO
DrawConfigOption(rowCount++, yOffset, &Config::MusicVolume, true); DrawConfigOption(rowCount++, yOffset, &Config::MusicVolume, true);

View file

@ -24,6 +24,7 @@ public:
CONFIG_DEFINE_LOCALISED("Input", bool, XButtonHoming, true); CONFIG_DEFINE_LOCALISED("Input", bool, XButtonHoming, true);
CONFIG_DEFINE_LOCALISED("Input", bool, AllowCancellingUnleash, false); CONFIG_DEFINE_LOCALISED("Input", bool, AllowCancellingUnleash, false);
CONFIG_DEFINE_LOCALISED("Input", bool, AllowBackgroundInput, false); CONFIG_DEFINE_LOCALISED("Input", bool, AllowBackgroundInput, false);
CONFIG_DEFINE_ENUM_LOCALISED("Input", EControllerButtons, ControllerButtons, EControllerButtons::Xbox);
CONFIG_DEFINE_LOCALISED("Audio", float, MusicVolume, 1.0f); CONFIG_DEFINE_LOCALISED("Audio", float, MusicVolume, 1.0f);
CONFIG_DEFINE_LOCALISED("Audio", float, EffectsVolume, 1.0f); CONFIG_DEFINE_LOCALISED("Audio", float, EffectsVolume, 1.0f);

View file

@ -67,6 +67,18 @@ CONFIG_DEFINE_ENUM_TEMPLATE(ETimeOfDayTransition)
{ "PlayStation", ETimeOfDayTransition::PlayStation } { "PlayStation", ETimeOfDayTransition::PlayStation }
}; };
enum class EControllerButtons : uint32_t
{
Xbox,
PlayStation
};
CONFIG_DEFINE_ENUM_TEMPLATE(EControllerButtons)
{
{ "Xbox", EControllerButtons::Xbox },
{ "PlayStation", EControllerButtons::PlayStation }
};
enum class EVoiceLanguage : uint32_t enum class EVoiceLanguage : uint32_t
{ {
English, English,

View file

@ -554,3 +554,7 @@ name = "TitleMenuAddInstallOptionMidAsmHook"
address = 0x8258547C address = 0x8258547C
registers = ["r3"] registers = ["r3"]
jump_address = 0x82585480 jump_address = 0x82585480
[[midasm_hook]]
name = "LoadingScreenControllerMidAsmHook"
address = 0x824DC9D4

@ -1 +1 @@
Subproject commit d45116bb0b5c5075da9b3c166fdf73af2415e880 Subproject commit bcad34ee648f69c448b204cb38337e7ef2e0aa18