mirror of
https://github.com/hedge-dev/UnleashedRecomp.git
synced 2025-10-30 07:11:05 +00:00
Fix auto controller icons breaking loading screen graphics (#64)
This commit is contained in:
parent
c98f3942d6
commit
bab9705151
4 changed files with 37 additions and 5 deletions
|
|
@ -20,8 +20,12 @@ namespace SWA
|
|||
class CLoading
|
||||
{
|
||||
public:
|
||||
SWA_INSERT_PADDING(0x128);
|
||||
bool m_IsVisible;
|
||||
SWA_INSERT_PADDING(0xD8);
|
||||
be<uint32_t> m_pUnk;
|
||||
SWA_INSERT_PADDING(0x3C);
|
||||
Chao::CSD::RCPtr<Chao::CSD::CScene> m_rcNightToDay;
|
||||
SWA_INSERT_PADDING(0x0C);
|
||||
be<uint32_t> m_IsVisible;
|
||||
SWA_INSERT_PADDING(0x0C);
|
||||
be<ELoadingDisplayType> m_LoadingDisplayType;
|
||||
SWA_INSERT_PADDING(0x65);
|
||||
|
|
|
|||
|
|
@ -7,6 +7,7 @@ class App
|
|||
public:
|
||||
static inline bool s_isInit;
|
||||
static inline bool s_isMissingDLC;
|
||||
static inline bool s_isLoading;
|
||||
|
||||
static inline ELanguage s_language;
|
||||
|
||||
|
|
|
|||
|
|
@ -4,6 +4,7 @@
|
|||
#include <hid/hid_detail.h>
|
||||
#include <ui/game_window.h>
|
||||
#include <kernel/xdm.h>
|
||||
#include <app.h>
|
||||
|
||||
#define TRANSLATE_INPUT(S, X) SDL_GameControllerGetButton(controller, S) << FirstBitLow(X)
|
||||
#define VIBRATION_TIMEOUT_MS 5000
|
||||
|
|
@ -163,6 +164,10 @@ inline Controller* FindController(int which)
|
|||
static void SetControllerInputDevice(Controller* controller)
|
||||
{
|
||||
g_activeController = controller;
|
||||
|
||||
if (App::s_isLoading)
|
||||
return;
|
||||
|
||||
hid::detail::g_inputDevice = controller->GetInputDevice();
|
||||
hid::detail::g_inputDeviceController = hid::detail::g_inputDevice;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -3,6 +3,8 @@
|
|||
#include <user/config.h>
|
||||
#include <api/SWA.h>
|
||||
#include <os/logger.h>
|
||||
#include <hid/hid_detail.h>
|
||||
#include <app.h>
|
||||
|
||||
const char* m_pStageID;
|
||||
|
||||
|
|
@ -13,10 +15,12 @@ void GetStageIDMidAsmHook(PPCRegister& r5)
|
|||
m_pStageID = *(xpointer<const char>*)g_memory.Translate(r5.u32);
|
||||
}
|
||||
|
||||
// Loading screen hook.
|
||||
// SWA::Message::MsgRequestStartLoading::Impl
|
||||
PPC_FUNC_IMPL(__imp__sub_824DCF38);
|
||||
PPC_FUNC(sub_824DCF38)
|
||||
{
|
||||
App::s_isLoading = true;
|
||||
|
||||
// TODO: use the actual PS3 loading screen ("n_2_d").
|
||||
if (Config::TimeOfDayTransition == ETimeOfDayTransition::PlayStation)
|
||||
{
|
||||
|
|
@ -35,6 +39,18 @@ PPC_FUNC(sub_824DCF38)
|
|||
__imp__sub_824DCF38(ctx, base);
|
||||
}
|
||||
|
||||
// SWA::CLoading::Update
|
||||
PPC_FUNC_IMPL(__imp__sub_824DAB60);
|
||||
PPC_FUNC(sub_824DAB60)
|
||||
{
|
||||
auto pLoading = (SWA::CLoading*)g_memory.Translate(ctx.r3.u32);
|
||||
|
||||
__imp__sub_824DAB60(ctx, base);
|
||||
|
||||
if (!pLoading->m_LoadingDisplayType)
|
||||
App::s_isLoading = false;
|
||||
}
|
||||
|
||||
// Load voice language files.
|
||||
PPC_FUNC_IMPL(__imp__sub_824EB9B0);
|
||||
PPC_FUNC(sub_824EB9B0)
|
||||
|
|
@ -112,10 +128,16 @@ void LoadingScreenControllerMidAsmHook()
|
|||
0x820301C4, // 360_sonic3
|
||||
0x820301D0, // 360_evil
|
||||
0x820301DC, // 360_robo
|
||||
0x820301E8, // 360_super
|
||||
0x820301E8 // 360_super
|
||||
};
|
||||
|
||||
const char* prefix = Config::ControllerIcons == EControllerIcons::PlayStation ? "ps3" : "360";
|
||||
auto isPlayStation = Config::ControllerIcons == EControllerIcons::PlayStation;
|
||||
|
||||
if (Config::ControllerIcons == EControllerIcons::Auto)
|
||||
isPlayStation = hid::detail::g_inputDeviceController == hid::detail::EInputDevice::PlayStation;
|
||||
|
||||
const char* prefix = isPlayStation ? "ps3" : "360";
|
||||
|
||||
for (auto address : STR_ADDRESSES)
|
||||
memcpy(g_memory.Translate(address), prefix, 3);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue