Compare commits

..

1 Commits

Author SHA1 Message Date
Hyper 4a33883512 hid: implemented delay input for switching devices
This makes controllers have their first input ignored until after detection, much like other PC ports.

This probably won't end up being merged in though, as other Sonic PC ports don't seem to work this way, but I'll push it anyway just for the sake of having this somewhere.
2025-02-16 19:21:58 +00:00
41 changed files with 98 additions and 714 deletions
-1
View File
@@ -137,7 +137,6 @@ set(UNLEASHED_RECOMP_PATCHES_CXX_SOURCES
"patches/CTitleStateIntro_patches.cpp" "patches/CTitleStateIntro_patches.cpp"
"patches/CTitleStateMenu_patches.cpp" "patches/CTitleStateMenu_patches.cpp"
"patches/fps_patches.cpp" "patches/fps_patches.cpp"
"patches/free_camera_patches.cpp"
"patches/frontend_listener.cpp" "patches/frontend_listener.cpp"
"patches/input_patches.cpp" "patches/input_patches.cpp"
"patches/inspire_patches.cpp" "patches/inspire_patches.cpp"
@@ -21,5 +21,3 @@ namespace Hedgehog::Base
void operator delete(void* in_pMem, void* in_pObj); void operator delete(void* in_pMem, void* in_pObj);
}; };
} }
#include "hhObject.inl"
@@ -1,39 +0,0 @@
namespace Hedgehog::Base
{
inline CObject::CObject()
{
}
inline CObject::CObject(const swa_null_ctor&)
{
}
inline void* CObject::operator new(const size_t in_Size)
{
return __HH_ALLOC(in_Size);
}
// inline void* CObject::operator new(const size_t in_Size, const size_t in_Align)
// {
// return __HH_ALLOCALIGN(in_Size, in_Align);
// }
inline void CObject::operator delete(void* in_pMem)
{
return __HH_FREE(in_pMem);
}
inline void* CObject::operator new(const size_t in_Size, void* in_pObj)
{
return in_pObj;
}
inline void* CObject::operator new(const size_t in_Size, const size_t in_Align, void* in_pObj)
{
return in_pObj;
}
inline void CObject::operator delete(void* in_pMem, void* in_pObj)
{
}
}
@@ -18,16 +18,6 @@ namespace Hedgehog::Math
be<float> Y; be<float> Y;
be<float> Z; be<float> Z;
be<float> W; be<float> W;
CVector operator*(const float& scalar) const
{
return { X * scalar, Y * scalar, Z * scalar };
}
CVector operator+(const CVector& v) const
{
return { X + v.X, Y + v.Y, Z + v.Z };
}
}; };
class CVector4 class CVector4
@@ -1,19 +0,0 @@
#pragma once
#include <SWA.inl>
#include <Hedgehog/Base/hhObject.h>
#include <boost/smart_ptr/shared_ptr.h>
namespace Hedgehog::Universe
{
class Message : public Base::CObject
{
public:
be<uint32_t> m_pVftable;
be<uint32_t> m_SenderActorID;
boost::shared_ptr<Message> m_spSelf;
};
class MessageTypeGet : public Message {};
class MessageTypeSet : public Message {};
}
+1 -11
View File
@@ -49,7 +49,6 @@
#include "Hedgehog/MirageCore/RenderData/hhVertexShaderData.h" #include "Hedgehog/MirageCore/RenderData/hhVertexShaderData.h"
#include "Hedgehog/MirageCore/Renderable/hhRenderable.h" #include "Hedgehog/MirageCore/Renderable/hhRenderable.h"
#include "Hedgehog/Sparkle/hhParticleMaterial.h" #include "Hedgehog/Sparkle/hhParticleMaterial.h"
#include "Hedgehog/Universe/Engine/hhMessage.h"
#include "Hedgehog/Universe/Engine/hhMessageActor.h" #include "Hedgehog/Universe/Engine/hhMessageActor.h"
#include "Hedgehog/Universe/Engine/hhMessageProcess.h" #include "Hedgehog/Universe/Engine/hhMessageProcess.h"
#include "Hedgehog/Universe/Engine/hhStateMachineBase.h" #include "Hedgehog/Universe/Engine/hhStateMachineBase.h"
@@ -66,8 +65,7 @@
#include "SWA/CSD/CsdTexListMirage.h" #include "SWA/CSD/CsdTexListMirage.h"
#include "SWA/CSD/GameObjectCSD.h" #include "SWA/CSD/GameObjectCSD.h"
#include "SWA/Camera/Camera.h" #include "SWA/Camera/Camera.h"
#include "SWA/Camera/Controller/CameraController.h" #include "SWA/Camera/CameraController.h"
#include "SWA/Camera/Controller/FreeCamera.h"
#include "SWA/CharacterUtility/CharacterProxy.h" #include "SWA/CharacterUtility/CharacterProxy.h"
#include "SWA/ExtraStage/Tails/Enemy/Boss/ExStageBoss.h" #include "SWA/ExtraStage/Tails/Enemy/Boss/ExStageBoss.h"
#include "SWA/ExtraStage/Tails/Enemy/Boss/State/StateBase.h" #include "SWA/ExtraStage/Tails/Enemy/Boss/State/StateBase.h"
@@ -89,20 +87,13 @@
#include "SWA/Inspire/InspireTextureOverlay.h" #include "SWA/Inspire/InspireTextureOverlay.h"
#include "SWA/Inspire/InspireTextureOverlayInfo.h" #include "SWA/Inspire/InspireTextureOverlayInfo.h"
#include "SWA/Menu/MenuWindowBase.h" #include "SWA/Menu/MenuWindowBase.h"
#include "SWA/Message/MsgCameraPauseMove.h"
#include "SWA/Message/MsgPopCameraController.h"
#include "SWA/Message/MsgSetPosition.h"
#include "SWA/Message/MsgSetVelocity.h"
#include "SWA/Movie/MovieDisplayer.h" #include "SWA/Movie/MovieDisplayer.h"
#include "SWA/Movie/MovieManager.h" #include "SWA/Movie/MovieManager.h"
#include "SWA/Object/Common/DashPanel/ObjDashPanel.h" #include "SWA/Object/Common/DashPanel/ObjDashPanel.h"
#include "SWA/Object/SonicStage/EU/RollingBarrel/ObjRollingBarrel.h" #include "SWA/Object/SonicStage/EU/RollingBarrel/ObjRollingBarrel.h"
#include "SWA/Player/Character/Base/PlayerContext.h"
#include "SWA/Player/Character/EvilSonic/EvilSonic.h" #include "SWA/Player/Character/EvilSonic/EvilSonic.h"
#include "SWA/Player/Character/EvilSonic/EvilSonicContext.h" #include "SWA/Player/Character/EvilSonic/EvilSonicContext.h"
#include "SWA/Player/Character/EvilSonic/Hud/EvilHudGuide.h" #include "SWA/Player/Character/EvilSonic/Hud/EvilHudGuide.h"
#include "SWA/Player/Character/Speed/PlayerSpeedContext.h"
#include "SWA/Replay/Camera/ReplayFreeCamera.h"
#include "SWA/Sequence/Unit/SequenceUnitBase.h" #include "SWA/Sequence/Unit/SequenceUnitBase.h"
#include "SWA/Sequence/Unit/SequenceUnitPlayMovie.h" #include "SWA/Sequence/Unit/SequenceUnitPlayMovie.h"
#include "SWA/Sequence/Utility/SequencePlayMovieWrapper.h" #include "SWA/Sequence/Utility/SequencePlayMovieWrapper.h"
@@ -133,6 +124,5 @@
#include "SWA/System/MatrixNodeTransform.h" #include "SWA/System/MatrixNodeTransform.h"
#include "SWA/System/PadState.h" #include "SWA/System/PadState.h"
#include "SWA/System/World.h" #include "SWA/System/World.h"
#include "SWA/Tool/FreeCameraTool/FreeCameraTool.h"
#include "boost/smart_ptr/make_shared_object.h" #include "boost/smart_ptr/make_shared_object.h"
#include "boost/smart_ptr/shared_ptr.h" #include "boost/smart_ptr/shared_ptr.h"
@@ -0,0 +1,17 @@
#pragma once
#include <SWA.inl>
namespace SWA
{
class CCameraController : public Hedgehog::Universe::CStateMachineBase::CStateBase
{
public:
SWA_INSERT_PADDING(0x04);
be<float> m_FieldOfView;
SWA_INSERT_PADDING(0x68);
};
SWA_ASSERT_OFFSETOF(CCameraController, m_FieldOfView, 0x64);
SWA_ASSERT_SIZEOF(CCameraController, 0xD0);
}
@@ -1,24 +0,0 @@
#pragma once
#include <SWA.inl>
namespace SWA
{
class CCameraController
{
public:
SWA_INSERT_PADDING(0x08);
xpointer<CCamera> m_pCamera;
SWA_INSERT_PADDING(0x58);
be<float> m_FieldOfView;
SWA_INSERT_PADDING(0x08);
Hedgehog::Math::CVector m_Position;
Hedgehog::Math::CVector m_UpVector;
Hedgehog::Math::CQuaternion m_Rotation;
SWA_INSERT_PADDING(0x30);
};
SWA_ASSERT_OFFSETOF(CCameraController, m_pCamera, 0x08);
SWA_ASSERT_OFFSETOF(CCameraController, m_FieldOfView, 0x64);
SWA_ASSERT_SIZEOF(CCameraController, 0xD0);
}
@@ -1,16 +0,0 @@
#pragma once
#include <SWA.inl>
#include "SWA/Camera/Controller/CameraController.h"
namespace SWA
{
class CFreeCamera : public CCameraController
{
public:
SWA_INSERT_PADDING(0x10);
be<float> m_Speed;
};
SWA_ASSERT_OFFSETOF(CFreeCamera, m_Speed, 0xE0);
}
-8
View File
@@ -9,9 +9,6 @@ namespace SWA
// ms_DrawLightFieldSamplingPoint: サンプリング点をデバッグ表示 // ms_DrawLightFieldSamplingPoint: サンプリング点をデバッグ表示
static inline bool* ms_DrawLightFieldSamplingPoint; static inline bool* ms_DrawLightFieldSamplingPoint;
// N/A
static inline be<float>* ms_FreeCameraSpeed;
// N/A // N/A
static inline bool* ms_IsAutoSaveWarningShown; static inline bool* ms_IsAutoSaveWarningShown;
@@ -36,9 +33,6 @@ namespace SWA
// ms_IsRenderDebugPositionDraw: デバッグ位置描画 // ms_IsRenderDebugPositionDraw: デバッグ位置描画
static inline bool* ms_IsRenderDebugPositionDraw; static inline bool* ms_IsRenderDebugPositionDraw;
// N/A
static inline bool* ms_IsRenderDepthOfField;
// ms_IsRenderGameMainHud: ゲームメインHUD 描画 // ms_IsRenderGameMainHud: ゲームメインHUD 描画
static inline bool* ms_IsRenderGameMainHud; static inline bool* ms_IsRenderGameMainHud;
@@ -63,7 +57,6 @@ namespace SWA
static void Init() static void Init()
{ {
ms_DrawLightFieldSamplingPoint = (bool*)MmGetHostAddress(0x83367BCE); ms_DrawLightFieldSamplingPoint = (bool*)MmGetHostAddress(0x83367BCE);
ms_FreeCameraSpeed = (be<float>*)MmGetHostAddress(0x83366DF8);
ms_IgnoreLightFieldData = (bool*)MmGetHostAddress(0x83367BCF); ms_IgnoreLightFieldData = (bool*)MmGetHostAddress(0x83367BCF);
ms_IsAutoSaveWarningShown = (bool*)MmGetHostAddress(0x83367BC1); ms_IsAutoSaveWarningShown = (bool*)MmGetHostAddress(0x83367BC1);
ms_IsCollisionRender = (bool*)MmGetHostAddress(0x833678A6); ms_IsCollisionRender = (bool*)MmGetHostAddress(0x833678A6);
@@ -72,7 +65,6 @@ namespace SWA
ms_IsRenderDebugDraw = (bool*)MmGetHostAddress(0x8328BB23); ms_IsRenderDebugDraw = (bool*)MmGetHostAddress(0x8328BB23);
ms_IsRenderDebugDrawText = (bool*)MmGetHostAddress(0x8328BB25); ms_IsRenderDebugDrawText = (bool*)MmGetHostAddress(0x8328BB25);
ms_IsRenderDebugPositionDraw = (bool*)MmGetHostAddress(0x8328BB24); ms_IsRenderDebugPositionDraw = (bool*)MmGetHostAddress(0x8328BB24);
ms_IsRenderDepthOfField = (bool*)MmGetHostAddress(0x83302720);
ms_IsRenderGameMainHud = (bool*)MmGetHostAddress(0x8328BB27); ms_IsRenderGameMainHud = (bool*)MmGetHostAddress(0x8328BB27);
ms_IsRenderHud = (bool*)MmGetHostAddress(0x8328BB26); ms_IsRenderHud = (bool*)MmGetHostAddress(0x8328BB26);
ms_IsRenderHudPause = (bool*)MmGetHostAddress(0x8328BB28); ms_IsRenderHudPause = (bool*)MmGetHostAddress(0x8328BB28);
@@ -1,17 +0,0 @@
#pragma once
#include <SWA.inl>
namespace SWA::Message
{
class MsgCameraPauseMove : public Hedgehog::Universe::MessageTypeSet
{
public:
SWA_INSERT_PADDING(0x08);
bool m_isPaused;
MsgCameraPauseMove(bool in_isPaused) : m_isPaused(in_isPaused) {}
};
SWA_ASSERT_OFFSETOF(MsgCameraPauseMove, m_isPaused, 0x18);
}
@@ -1,32 +0,0 @@
#pragma once
#include <SWA.inl>
namespace SWA::Message
{
class MsgPopCameraController : public Hedgehog::Universe::MessageTypeSet
{
public:
SWA_INSERT_PADDING(0x08);
xpointer<CCameraController> m_pCameraController;
SWA_INSERT_PADDING(0x08);
xpointer<Hedgehog::Base::CSharedString> m_pCameraName;
be<float> m_InterpolateTime;
bool m_Field2C;
bool m_Field2D;
bool m_Field2E;
MsgPopCameraController(CCameraController* in_pCameraController, float in_interpolateTime)
: m_pCameraController(in_pCameraController), m_InterpolateTime(in_interpolateTime) {}
MsgPopCameraController(Hedgehog::Base::CSharedString* in_pCameraName, float in_interpolateTime)
: m_pCameraName(in_pCameraName), m_InterpolateTime(in_interpolateTime) {}
};
SWA_ASSERT_OFFSETOF(MsgPopCameraController, m_pCameraController, 0x18);
SWA_ASSERT_OFFSETOF(MsgPopCameraController, m_pCameraName, 0x24);
SWA_ASSERT_OFFSETOF(MsgPopCameraController, m_InterpolateTime, 0x28);
SWA_ASSERT_OFFSETOF(MsgPopCameraController, m_Field2C, 0x2C);
SWA_ASSERT_OFFSETOF(MsgPopCameraController, m_Field2D, 0x2D);
SWA_ASSERT_OFFSETOF(MsgPopCameraController, m_Field2E, 0x2E);
}
@@ -1,18 +0,0 @@
#pragma once
#include <SWA.inl>
namespace SWA::Message
{
class MsgSetPosition : public Hedgehog::Universe::MessageTypeSet
{
public:
SWA_INSERT_PADDING(0x10);
Hedgehog::Math::CVector m_Position;
MsgSetPosition(const Hedgehog::Math::CVector& in_rPosition) : m_Position(in_rPosition) {}
};
SWA_ASSERT_OFFSETOF(MsgSetPosition, m_Position, 0x20);
SWA_ASSERT_SIZEOF(MsgSetPosition, 0x30);
}
@@ -1,18 +0,0 @@
#pragma once
#include <SWA.inl>
namespace SWA::Message
{
class MsgSetVelocity : public Hedgehog::Universe::MessageTypeSet
{
public:
SWA_INSERT_PADDING(0x10);
Hedgehog::Math::CVector m_Velocity;
MsgSetVelocity(const Hedgehog::Math::CVector& in_rVelocity) : m_Velocity(in_rVelocity) {}
};
SWA_ASSERT_OFFSETOF(MsgSetVelocity, m_Velocity, 0x20);
SWA_ASSERT_SIZEOF(MsgSetVelocity, 0x30);
}
@@ -1,29 +0,0 @@
#pragma once
#include <SWA.inl>
#include "boost/smart_ptr/shared_ptr.h"
namespace SWA::Player
{
class CPlayer;
class CPlayerContext
{
public:
SWA_INSERT_PADDING(0x10);
boost::shared_ptr<CMatrixNodeTransform> m_spMatrixNode;
SWA_INSERT_PADDING(0x18);
boost::anonymous_shared_ptr m_spRayCastCollision;
SWA_INSERT_PADDING(0xC8);
xpointer<CPlayer> m_pPlayer;
SWA_INSERT_PADDING(0xF8);
boost::shared_ptr<void> m_spParameter;
SWA_INSERT_PADDING(0x0C);
};
SWA_ASSERT_OFFSETOF(CPlayerContext, m_spMatrixNode, 0x10);
SWA_ASSERT_OFFSETOF(CPlayerContext, m_spRayCastCollision, 0x30);
SWA_ASSERT_OFFSETOF(CPlayerContext, m_pPlayer, 0x100);
SWA_ASSERT_OFFSETOF(CPlayerContext, m_spParameter, 0x1FC);
SWA_ASSERT_SIZEOF(CPlayerContext, 0x210);
}
@@ -5,26 +5,19 @@
namespace SWA::Player namespace SWA::Player
{ {
class CEvilSonicContext : public CPlayerContext class CEvilSonicContext // : public CPlayerContext
{ {
public: public:
SWA_INSERT_PADDING(0x478); SWA_INSERT_PADDING(0x688);
be<float> m_DarkGaiaEnergy; be<float> m_DarkGaiaEnergy;
SWA_INSERT_PADDING(0x138); SWA_INSERT_PADDING(0x138);
be<uint32_t> m_AnimationID; be<uint32_t> m_AnimationID;
SWA_INSERT_PADDING(0x38); SWA_INSERT_PADDING(0x38);
be<float> m_Field800; // Related to EvilHudGuide be<float> m_UnkHudGuideF32;
be<uint32_t> m_Field804; // Related to EvilHudGuide be<uint32_t> m_UnkHudGuideU32;
SWA_INSERT_PADDING(0x18); SWA_INSERT_PADDING(0x18);
be<EGuideType> m_GuideType; be<EGuideType> m_GuideType;
SWA_INSERT_PADDING(0xA8); SWA_INSERT_PADDING(0xA8);
be<uint32_t> m_OutOfControlCount; be<uint32_t> m_OutOfControlCount;
}; };
SWA_ASSERT_OFFSETOF(CEvilSonicContext, m_DarkGaiaEnergy, 0x688);
SWA_ASSERT_OFFSETOF(CEvilSonicContext, m_AnimationID, 0x7C4);
SWA_ASSERT_OFFSETOF(CEvilSonicContext, m_Field800, 0x800);
SWA_ASSERT_OFFSETOF(CEvilSonicContext, m_Field804, 0x804);
SWA_ASSERT_OFFSETOF(CEvilSonicContext, m_GuideType, 0x820);
SWA_ASSERT_OFFSETOF(CEvilSonicContext, m_OutOfControlCount, 0x8CC);
} }
@@ -1,15 +0,0 @@
#pragma once
#include <SWA.inl>
namespace SWA::Player
{
class CPlayerSpeedContext : public CPlayerContext
{
public:
// TODO: Hedgehog::Base::TSynchronizedPtr<CGameDocument>
static CPlayerSpeedContext* GetInstance();
};
}
#include "PlayerSpeedContext.inl"
@@ -1,7 +0,0 @@
namespace SWA::Player
{
inline CPlayerSpeedContext* CPlayerSpeedContext::GetInstance()
{
return *(xpointer<CPlayerSpeedContext>*)MmGetHostAddress(0x83362F98);
}
}
@@ -1,16 +0,0 @@
#pragma once
#include <SWA.inl>
#include "SWA/Camera/Controller/CameraController.h"
namespace SWA
{
class CReplayFreeCamera : public CCameraController
{
public:
SWA_INSERT_PADDING(0x90);
be<float> m_Speed;
};
SWA_ASSERT_OFFSETOF(CReplayFreeCamera, m_Speed, 0x160);
}
@@ -36,9 +36,7 @@ namespace SWA
xpointer<CSoundAdministrator> m_pSoundAdministrator; xpointer<CSoundAdministrator> m_pSoundAdministrator;
SWA_INSERT_PADDING(0x48); SWA_INSERT_PADDING(0x48);
xpointer<CGeneralWindow> m_pGeneralWindow; xpointer<CGeneralWindow> m_pGeneralWindow;
SWA_INSERT_PADDING(0xC0); SWA_INSERT_PADDING(0xD8);
boost::anonymous_shared_ptr m_spPlayerSwitchManager;
SWA_INSERT_PADDING(0x10);
SScoreInfo m_ScoreInfo; SScoreInfo m_ScoreInfo;
SWA_INSERT_PADDING(0x0C); SWA_INSERT_PADDING(0x0C);
}; };
@@ -65,7 +63,6 @@ namespace SWA
SWA_ASSERT_OFFSETOF(CGameDocument::CMember, m_StageName, 0xAC); SWA_ASSERT_OFFSETOF(CGameDocument::CMember, m_StageName, 0xAC);
SWA_ASSERT_OFFSETOF(CGameDocument::CMember, m_pSoundAdministrator, 0xB0); SWA_ASSERT_OFFSETOF(CGameDocument::CMember, m_pSoundAdministrator, 0xB0);
SWA_ASSERT_OFFSETOF(CGameDocument::CMember, m_pGeneralWindow, 0xFC); SWA_ASSERT_OFFSETOF(CGameDocument::CMember, m_pGeneralWindow, 0xFC);
SWA_ASSERT_OFFSETOF(CGameDocument::CMember, m_spPlayerSwitchManager, 0x1C0);
SWA_ASSERT_OFFSETOF(CGameDocument::CMember, m_ScoreInfo, 0x1D8); SWA_ASSERT_OFFSETOF(CGameDocument::CMember, m_ScoreInfo, 0x1D8);
SWA_ASSERT_SIZEOF(CGameDocument::CMember, 0x230); SWA_ASSERT_SIZEOF(CGameDocument::CMember, 0x230);
@@ -1,15 +0,0 @@
#pragma once
#include <SWA.inl>
namespace SWA
{
class CFreeCameraTool : public CGameObject
{
public:
SWA_INSERT_PADDING(0x04);
xpointer<CFreeCamera> m_pFreeCamera;
};
SWA_ASSERT_OFFSETOF(CFreeCameraTool, m_pFreeCamera, 0xC0);
}
-10
View File
@@ -5,7 +5,6 @@
#include <kernel/function.h> #include <kernel/function.h>
#include <os/process.h> #include <os/process.h>
#include <patches/audio_patches.h> #include <patches/audio_patches.h>
#include <patches/free_camera_patches.h>
#include <patches/inspire_patches.h> #include <patches/inspire_patches.h>
#include <ui/game_window.h> #include <ui/game_window.h>
#include <user/config.h> #include <user/config.h>
@@ -74,7 +73,6 @@ PPC_FUNC(sub_822C1130)
} }
AudioPatches::Update(App::s_deltaTime); AudioPatches::Update(App::s_deltaTime);
FreeCameraPatches::Update();
InspirePatches::Update(); InspirePatches::Update();
// Apply subtitles option. // Apply subtitles option.
@@ -96,11 +94,3 @@ PPC_FUNC(sub_822C1130)
__imp__sub_822C1130(ctx, base); __imp__sub_822C1130(ctx, base);
} }
// SWA::CGameModeStage::CGameModeStage
PPC_FUNC_IMPL(__imp__sub_82541138);
PPC_FUNC(sub_82541138)
{
App::s_pGameModeStage = (SWA::CGameModeStage*)g_memory.Translate(ctx.r3.u32);
__imp__sub_82541138(ctx, base);
}
+1 -4
View File
@@ -1,6 +1,5 @@
#pragma once #pragma once
#include <api/SWA.h>
#include <user/config.h> #include <user/config.h>
class App class App
@@ -9,11 +8,9 @@ public:
static inline bool s_isInit; static inline bool s_isInit;
static inline bool s_isMissingDLC; static inline bool s_isMissingDLC;
static inline bool s_isLoading; static inline bool s_isLoading;
static inline bool s_isWerehog;
static inline bool s_isSaveDataCorrupt; static inline bool s_isSaveDataCorrupt;
static inline SWA::CGameModeStage* s_pGameModeStage;
static inline SWA::Player::CEvilSonicContext* s_pEvilSonicContext;
static inline ELanguage s_language; static inline ELanguage s_language;
static inline double s_deltaTime; static inline double s_deltaTime;
+1 -1
View File
@@ -3596,7 +3596,7 @@ static void SetTexture(GuestDevice* device, uint32_t index, GuestTexture* textur
auto isPlayStation = Config::ControllerIcons == EControllerIcons::PlayStation; auto isPlayStation = Config::ControllerIcons == EControllerIcons::PlayStation;
if (Config::ControllerIcons == EControllerIcons::Auto) if (Config::ControllerIcons == EControllerIcons::Auto)
isPlayStation = hid::g_inputDeviceController == hid::EInputDevice::PlayStation; isPlayStation = hid::g_inputDevicePad == hid::EInputDevice::PlayStation;
if (isPlayStation && texture != nullptr && texture->patchedTexture != nullptr) if (isPlayStation && texture != nullptr && texture->patchedTexture != nullptr)
texture = texture->patchedTexture.get(); texture = texture->patchedTexture.get();
+29 -13
View File
@@ -174,17 +174,16 @@ static void SetControllerInputDevice(Controller* controller)
if (App::s_isLoading) if (App::s_isLoading)
return; return;
// Signal that we've changed input device to block first input.
if (hid::g_inputDevice == hid::EInputDevice::Keyboard)
hid::g_hasChangedInputDevice = true;
hid::g_inputDevice = controller->GetInputDevice(); hid::g_inputDevice = controller->GetInputDevice();
hid::g_inputDeviceController = hid::g_inputDevice; hid::g_inputDevicePad = hid::g_inputDevice;
hid::g_inputDevicePadExplicit = (hid::EInputDeviceExplicit)controller->GetControllerType();
auto controllerType = (hid::EInputDeviceExplicit)controller->GetControllerType(); if (hid::g_hasChangedInputDevice)
LOGFN("Input Device: {}", hid::GetInputDeviceName());
if (hid::g_inputDeviceExplicit != controllerType)
{
hid::g_inputDeviceExplicit = controllerType;
LOGFN("Detected controller: {}", hid::GetInputDeviceName());
}
} }
static void SetControllerTimeOfDayLED(Controller& controller, bool isNight) static void SetControllerTimeOfDayLED(Controller& controller, bool isNight)
@@ -210,7 +209,7 @@ int HID_OnSDLEvent(void*, SDL_Event* event)
g_controllers[freeIndex] = controller; g_controllers[freeIndex] = controller;
SetControllerTimeOfDayLED(controller, App::s_pEvilSonicContext); SetControllerTimeOfDayLED(controller, App::s_isWerehog);
} }
break; break;
@@ -244,14 +243,16 @@ int HID_OnSDLEvent(void*, SDL_Event* event)
SetControllerInputDevice(controller); SetControllerInputDevice(controller);
} }
controller->PollAxis(); if (!hid::g_hasChangedInputDevice)
controller->PollAxis();
} }
else else
{ {
SDL_ShowCursor(SDL_DISABLE); SDL_ShowCursor(SDL_DISABLE);
SetControllerInputDevice(controller); SetControllerInputDevice(controller);
controller->Poll(); if (!hid::g_hasChangedInputDevice)
controller->Poll();
} }
break; break;
@@ -259,8 +260,17 @@ int HID_OnSDLEvent(void*, SDL_Event* event)
case SDL_KEYDOWN: case SDL_KEYDOWN:
case SDL_KEYUP: case SDL_KEYUP:
hid::g_inputDevice = hid::EInputDevice::Keyboard; {
if (hid::g_inputDevice != hid::EInputDevice::Keyboard)
{
hid::g_inputDevice = hid::EInputDevice::Keyboard;
hid::g_hasChangedInputDevice = true;
LOGN("Input Device: Keyboard");
}
break; break;
}
case SDL_MOUSEMOTION: case SDL_MOUSEMOTION:
case SDL_MOUSEBUTTONDOWN: case SDL_MOUSEBUTTONDOWN:
@@ -331,6 +341,12 @@ uint32_t hid::GetState(uint32_t dwUserIndex, XAMINPUT_STATE* pState)
if (!g_activeController) if (!g_activeController)
return ERROR_DEVICE_NOT_CONNECTED; return ERROR_DEVICE_NOT_CONNECTED;
if (hid::g_hasChangedInputDevice)
{
hid::g_hasChangedInputDevice = false;
return ERROR_SUCCESS;
}
pState->Gamepad = g_activeController->state; pState->Gamepad = g_activeController->state;
return ERROR_SUCCESS; return ERROR_SUCCESS;
+5 -4
View File
@@ -2,9 +2,10 @@
#include <ui/game_window.h> #include <ui/game_window.h>
#include <user/config.h> #include <user/config.h>
hid::EInputDevice hid::g_inputDevice; hid::EInputDevice hid::g_inputDevice = EInputDevice::None;
hid::EInputDevice hid::g_inputDeviceController; hid::EInputDevice hid::g_inputDevicePad = EInputDevice::None;
hid::EInputDeviceExplicit hid::g_inputDeviceExplicit; hid::EInputDeviceExplicit hid::g_inputDevicePadExplicit = EInputDeviceExplicit::Unknown;
bool hid::g_hasChangedInputDevice;
uint16_t hid::g_prohibitedButtons; uint16_t hid::g_prohibitedButtons;
bool hid::g_isLeftStickProhibited; bool hid::g_isLeftStickProhibited;
@@ -39,7 +40,7 @@ std::string hid::GetInputDeviceName()
return "Mouse"; return "Mouse";
} }
switch (g_inputDeviceExplicit) switch (g_inputDevicePadExplicit)
{ {
case EInputDeviceExplicit::Xbox360: case EInputDeviceExplicit::Xbox360:
return "Xbox 360"; return "Xbox 360";
+4 -2
View File
@@ -4,6 +4,7 @@ namespace hid
{ {
enum class EInputDevice enum class EInputDevice
{ {
None,
Keyboard, Keyboard,
Mouse, Mouse,
Xbox, Xbox,
@@ -29,8 +30,9 @@ namespace hid
}; };
extern EInputDevice g_inputDevice; extern EInputDevice g_inputDevice;
extern EInputDevice g_inputDeviceController; extern EInputDevice g_inputDevicePad;
extern EInputDeviceExplicit g_inputDeviceExplicit; extern EInputDeviceExplicit g_inputDevicePadExplicit;
extern bool g_hasChangedInputDevice;
extern uint16_t g_prohibitedButtons; extern uint16_t g_prohibitedButtons;
extern bool g_isLeftStickProhibited; extern bool g_isLeftStickProhibited;
+20 -66
View File
@@ -562,68 +562,14 @@ PPC_FUNC(sub_82E0D3E8)
g_userHeap.Free(newArlFileData); g_userHeap.Free(newArlFileData);
} }
// Load elements have an unused "pretty name" field. We will use this field to store the archive file path,
// prefixed with a magic string. When the first load detects this string, it will load append archives
// and then clear the field to prevent remaining splits from loading the append archives again.
// We cannot rely on .ar.00 being the first split to be loaded, so this approach is necessary.
static thread_local uint32_t g_prefixedArFilePath = NULL;
// Hedgehog::Database::CDatabaseLoader::LoadArchives
PPC_FUNC_IMPL(__imp__sub_82E0CC38);
PPC_FUNC(sub_82E0CC38)
{
if (g_mods.empty())
{
__imp__sub_82E0CC38(ctx, base);
return;
}
auto r3 = ctx.r3;
auto r4 = ctx.r4;
auto r5 = ctx.r5;
auto r6 = ctx.r6;
auto r7 = ctx.r7;
auto r8 = ctx.r8;
const char* arFilePath = reinterpret_cast<const char*>(base + PPC_LOAD_U32(r5.u32));
// __HH_ALLOC
ctx.r3.u32 = 22 + strlen(arFilePath);
sub_822C0988(ctx, base);
char* prefixedArFilePath = reinterpret_cast<char*>(base + ctx.r3.u32);
*reinterpret_cast<be<uint32_t>*>(prefixedArFilePath) = 1;
strcpy(prefixedArFilePath + 0x4, "/UnleashedRecomp/");
strcpy(prefixedArFilePath + 0x15, arFilePath);
ctx.r1.u32 -= 0x10;
uint32_t stackSpace = ctx.r1.u32;
PPC_STORE_U32(stackSpace, static_cast<uint32_t>(reinterpret_cast<uint8_t*>(prefixedArFilePath) - base) + 0x4);
g_prefixedArFilePath = stackSpace;
ctx.r3 = r3;
ctx.r4 = r4;
ctx.r5 = r5;
ctx.r6 = r6;
ctx.r7 = r7;
ctx.r8 = r8;
__imp__sub_82E0CC38(ctx, base);
// Hedgehog::Base::CSharedString::~CSharedString
ctx.r3.u32 = stackSpace;
sub_82DFB148(ctx, base);
g_prefixedArFilePath = NULL;
ctx.r1.u32 += 0x10;
}
// Hedgehog::Database::SLoadElement::SLoadElement // Hedgehog::Database::SLoadElement::SLoadElement
PPC_FUNC_IMPL(__imp__sub_82E140D8); PPC_FUNC_IMPL(__imp__sub_82E140D8);
PPC_FUNC(sub_82E140D8) PPC_FUNC(sub_82E140D8)
{ {
// Store the prefixed archive file path as the pretty name. It's unused for archives we want to append to. // Store archive name as the pretty name to use it later for append archive loading.
if (!g_mods.empty() && PPC_LOAD_U32(ctx.r5.u32) == 0x8200A621 && g_prefixedArFilePath != NULL) // This is always set to an empty string for archives, so it should be safe to replace.
ctx.r5.u32 = g_prefixedArFilePath; if (!g_mods.empty() && PPC_LOAD_U32(ctx.r5.u32) == 0x8200A621)
ctx.r5.u32 = ctx.r6.u32;
__imp__sub_82E140D8(ctx, base); __imp__sub_82E140D8(ctx, base);
} }
@@ -638,17 +584,25 @@ PPC_FUNC(sub_82E0B500)
return; return;
} }
uint32_t prefixedArFilePath = PPC_LOAD_U32(ctx.r5.u32); std::u8string_view arFilePathU8(reinterpret_cast<const char8_t*>(base + PPC_LOAD_U32(ctx.r5.u32)));
std::u8string_view arFilePathU8(reinterpret_cast<const char8_t*>(base + prefixedArFilePath)); size_t index = arFilePathU8.find(u8".ar.00");
if (!arFilePathU8.starts_with(u8"/UnleashedRecomp/")) if (index == (arFilePathU8.size() - 6))
{ {
__imp__sub_82E0B500(ctx, base); arFilePathU8.remove_suffix(3);
return;
} }
else
{
index = arFilePathU8.find(u8".ar");
// Immediately clear the string, so the remaining splits don't load append archives again. if (index != (arFilePathU8.size() - 3) ||
PPC_STORE_U8(prefixedArFilePath, 0x00); arFilePathU8.starts_with(u8"tg-") ||
arFilePathU8.remove_prefix(0x11); arFilePathU8.starts_with(u8"gia-") ||
arFilePathU8.starts_with(u8"gi-texture-"))
{
__imp__sub_82E0B500(ctx, base);
return;
}
}
auto r3 = ctx.r3; // Callback auto r3 = ctx.r3; // Callback
auto r4 = ctx.r4; // Database auto r4 = ctx.r4; // Database
@@ -1,6 +1,5 @@
#include <kernel/function.h> #include <kernel/function.h>
#include <api/SWA.h> #include <api/SWA.h>
#include <patches/free_camera_patches.h>
#include <ui/achievement_menu.h> #include <ui/achievement_menu.h>
#include <ui/button_guide.h> #include <ui/button_guide.h>
#include <ui/options_menu.h> #include <ui/options_menu.h>
@@ -120,9 +119,6 @@ bool CHudPauseMiscInjectOptionsMidAsmHook(PPCRegister& pThis)
PPC_FUNC_IMPL(__imp__sub_824B0930); PPC_FUNC_IMPL(__imp__sub_824B0930);
PPC_FUNC(sub_824B0930) PPC_FUNC(sub_824B0930)
{ {
if (FreeCameraPatches::s_isActive)
return;
if (App::s_isLoading) if (App::s_isLoading)
{ {
__imp__sub_824B0930(ctx, base); __imp__sub_824B0930(ctx, base);
+4 -7
View File
@@ -1,10 +1,9 @@
#include "camera_patches.h"
#include <api/SWA.h> #include <api/SWA.h>
#include <gpu/video.h>
#include <patches/aspect_ratio_patches.h>
#include <patches/free_camera_patches.h>
#include <ui/game_window.h> #include <ui/game_window.h>
#include <user/config.h> #include <user/config.h>
#include <gpu/video.h>
#include "camera_patches.h"
#include "aspect_ratio_patches.h"
void CameraAspectRatioMidAsmHook(PPCRegister& r30, PPCRegister& r31) void CameraAspectRatioMidAsmHook(PPCRegister& r30, PPCRegister& r31)
{ {
@@ -36,9 +35,7 @@ void CameraFieldOfViewMidAsmHook(PPCRegister& r31, PPCRegister& f31)
{ {
auto camera = (SWA::CCamera*)g_memory.Translate(r31.u32); auto camera = (SWA::CCamera*)g_memory.Translate(r31.u32);
f31.f64 = FreeCameraPatches::s_isActive f31.f64 = AdjustFieldOfView(f31.f64, camera->m_HorzAspectRatio);
? FreeCameraPatches::s_fieldOfView
: AdjustFieldOfView(f31.f64, camera->m_HorzAspectRatio);
} }
PPC_FUNC_IMPL(__imp__sub_824697B0); PPC_FUNC_IMPL(__imp__sub_824697B0);
@@ -1,250 +0,0 @@
#include "free_camera_patches.h"
#include <api/SWA.h>
#include <os/logger.h>
#include <ui/game_window.h>
#include <user/config.h>
#include <app.h>
#define DEGREES_TO_RADIANS(x) (float)(x / 180.0f * M_PI)
#define RADIANS_TO_DEGREES(x) (float)(x / M_PI * 180.0f)
constexpr float DEFAULT_SPEED = 1.0f;
constexpr float DEFAULT_FIELD_OF_VIEW = 45.0f;
constexpr float MOVE_SPEED_SLOW = 0.075f;
constexpr float MOVE_SPEED_FAST = 8.0f;
constexpr float MOVE_SPEED_MODIFIER_RATIO = 0.02f;
constexpr float FOV_MODIFIER_RATIO = 1.0f;
static float g_baseSpeed = DEFAULT_SPEED;
static float g_baseFieldOfView = DEFAULT_FIELD_OF_VIEW;
static bool g_isDisablingFreeCamera;
static bool g_isCameraLocked;
static float g_speed;
static float g_fieldOfView;
static void ResetParameters()
{
g_isCameraLocked = false;
g_speed = g_baseSpeed = DEFAULT_SPEED;
*SWA::SGlobals::ms_IsRenderDepthOfField = true;
FreeCameraPatches::s_fieldOfView = g_fieldOfView = g_baseFieldOfView = DEFAULT_FIELD_OF_VIEW;
}
bool FreeCameraActiveMidAsmHook()
{
return Config::EnableFreeCamera && FreeCameraPatches::s_isActive;
}
bool FreeCameraSpeedInputMidAsmHook(PPCRegister& r31, PPCRegister& r29, PPCRegister& f0)
{
if (!Config::EnableFreeCamera)
return false;
auto pCamera = (SWA::CFreeCamera*)g_memory.Translate(r31.u32);
auto pPadState = (SWA::SPadState*)g_memory.Translate(r29.u32);
auto factor = App::s_deltaTime / (1.0f / 60.0f);
if (g_isCameraLocked)
{
g_speed = 0.0f;
}
else
{
static auto isLeftTriggerSpeedModifier = false;
static auto isRightTriggerSpeedModifier = false;
if (pPadState->IsDown(SWA::eKeyState_LeftTrigger))
{
g_speed = MOVE_SPEED_SLOW;
isLeftTriggerSpeedModifier = true;
}
else if (isLeftTriggerSpeedModifier)
{
g_speed = g_baseSpeed;
isLeftTriggerSpeedModifier = false;
}
if (pPadState->IsDown(SWA::eKeyState_RightTrigger))
{
g_speed = MOVE_SPEED_FAST;
isRightTriggerSpeedModifier = true;
}
else if (isRightTriggerSpeedModifier)
{
g_speed = g_baseSpeed;
isRightTriggerSpeedModifier = false;
}
if (isLeftTriggerSpeedModifier && isRightTriggerSpeedModifier)
g_speed = MOVE_SPEED_FAST / 3;
if (pPadState->IsDown(SWA::eKeyState_A))
g_speed = g_baseSpeed = DEFAULT_SPEED;
if (pPadState->IsDown(SWA::eKeyState_B))
{
g_baseSpeed -= MOVE_SPEED_MODIFIER_RATIO * factor;
g_speed = g_baseSpeed;
LOGFN("[Free Camera] Speed: {}", g_speed);
}
if (pPadState->IsDown(SWA::eKeyState_X))
{
g_baseSpeed += MOVE_SPEED_MODIFIER_RATIO * factor;
g_speed = g_baseSpeed;
LOGFN("[Free Camera] Speed: {}", g_speed);
}
g_speed = std::clamp(g_speed, 0.01f, 20.0f);
}
f0.f64 = g_speed;
return true;
}
// SWA::CFreeCamera::Update
PPC_FUNC_IMPL(__imp__sub_82472A18);
PPC_FUNC(sub_82472A18)
{
if (Config::EnableFreeCamera)
{
auto pCamera = (SWA::CFreeCamera*)g_memory.Translate(ctx.r3.u32);
auto aspectRatio = (float)GameWindow::s_width / (float)GameWindow::s_height;
if (auto pInputState = SWA::CInputState::GetInstance())
{
auto& rPadState = pInputState->GetPadState();
// Deactivate.
if (rPadState.IsTapped(SWA::eKeyState_Select))
{
guest_stack_var<SWA::Message::MsgPopCameraController> msgPopCameraController(pCamera, 0.0f);
guest_stack_var<SWA::Message::MsgCameraPauseMove> msgCameraPauseMove(false);
// Process SWA::Message::MsgPopCameraController.
GuestToHostFunction<int>(sub_8246A840, pCamera->m_pCamera.get(), msgPopCameraController.get());
// Process SWA::Message::MsgFinishFreeCamera.
GuestToHostFunction<int>(sub_8253ADB8, App::s_pGameModeStage);
// Process SWA::Message::MsgCameraPauseMove.
GuestToHostFunction<int>(sub_824679C0, pCamera->m_pCamera.get(), msgCameraPauseMove.get());
FreeCameraPatches::s_isActive = false;
*SWA::SGlobals::ms_IsRenderHud = true;
LOGN("[Free Camera] Disabled");
g_isDisablingFreeCamera = true;
return;
}
// Teleport player to camera.
if (rPadState.IsTapped(SWA::eKeyState_LeftStick))
{
guest_stack_var<SWA::Message::MsgSetPosition> msgSetPosition(pCamera->m_Position);
guest_stack_var<SWA::Message::MsgSetVelocity> msgSetVelocity(Hedgehog::Math::CVector(0.0f, 0.0f, 0.0f));
if (auto pPlayerSpeedContext = SWA::Player::CPlayerSpeedContext::GetInstance())
{
// Process SWA::Message::MsgSetPosition.
GuestToHostFunction<int>(sub_82303100, pPlayerSpeedContext->m_pPlayer.get(), msgSetPosition.get());
// Process SWA::Message::MsgSetVelocity.
GuestToHostFunction<int>(sub_82311820, pPlayerSpeedContext->m_pPlayer.get(), msgSetVelocity.get());
}
else if (App::s_pEvilSonicContext)
{
// Process SWA::Message::MsgSetPosition.
GuestToHostFunction<int>(sub_82303100, App::s_pEvilSonicContext->m_pPlayer.get(), msgSetPosition.get());
}
}
// Lock camera.
if (rPadState.IsTapped(SWA::eKeyState_DpadLeft))
{
g_isCameraLocked = !g_isCameraLocked;
if (g_isCameraLocked)
{
LOGN("[Free Camera] Locked");
}
else
{
g_speed = g_baseSpeed;
LOGN("[Free Camera] Unlocked");
}
}
// Toggle depth of field.
if (rPadState.IsTapped(SWA::eKeyState_DpadRight))
{
*SWA::SGlobals::ms_IsRenderDepthOfField = !*SWA::SGlobals::ms_IsRenderDepthOfField;
if (*SWA::SGlobals::ms_IsRenderDepthOfField)
{
LOGN("[Free Camera] Depth of Field ON");
}
else
{
LOGN("[Free Camera] Depth of Field OFF");
}
}
auto isResetFOV = rPadState.IsDown(SWA::eKeyState_Y);
auto isIncreaseFOV = rPadState.IsDown(SWA::eKeyState_DpadUp);
auto isDecreaseFOV = rPadState.IsDown(SWA::eKeyState_DpadDown);
auto fovScaleFactor = 0.0f;
if (isIncreaseFOV)
{
fovScaleFactor = FOV_MODIFIER_RATIO;
}
else if (isDecreaseFOV)
{
fovScaleFactor = -FOV_MODIFIER_RATIO;
}
g_fieldOfView = fmodf(isResetFOV ? DEFAULT_FIELD_OF_VIEW : g_fieldOfView + fovScaleFactor * App::s_deltaTime * 60.0f, 180.0f);
FreeCameraPatches::s_fieldOfView = 2.0f * atan(tan(DEGREES_TO_RADIANS(g_fieldOfView / 2.0f) * (16.0f / 9.0f / std::min(aspectRatio, 16.0f / 9.0f))));
}
}
__imp__sub_82472A18(ctx, base);
}
void FreeCameraPatches::Update()
{
if (!Config::EnableFreeCamera || !App::s_pGameModeStage)
return;
if (auto pInputState = SWA::CInputState::GetInstance())
{
auto& rPadState = pInputState->GetPadState();
if (rPadState.IsTapped(SWA::eKeyState_Select) && !FreeCameraPatches::s_isActive && !g_isDisablingFreeCamera)
{
ResetParameters();
// Process SWA::Message::MsgStartFreeCamera.
GuestToHostFunction<int>(sub_8253ACB8, App::s_pGameModeStage);
FreeCameraPatches::s_isActive = true;
*SWA::SGlobals::ms_IsRenderHud = false;
LOGN("[Free Camera] Enabled");
}
if (rPadState.IsReleased(SWA::eKeyState_Select) && !FreeCameraPatches::s_isActive)
g_isDisablingFreeCamera = false;
}
}
@@ -1,11 +0,0 @@
#pragma once
class FreeCameraPatches
{
public:
static inline bool s_isActive;
static inline float s_fieldOfView;
static void Update();
};
+1 -1
View File
@@ -186,7 +186,7 @@ public:
case SDL_CONTROLLERTOUCHPADDOWN: case SDL_CONTROLLERTOUCHPADDOWN:
{ {
g_worldMapCursorParams = hid::g_inputDeviceExplicit == hid::EInputDeviceExplicit::DualSense g_worldMapCursorParams = hid::g_inputDevicePadExplicit == hid::EInputDeviceExplicit::DualSense
? (WorldMapCursorParams)g_worldMapCursorParamsProspero ? (WorldMapCursorParams)g_worldMapCursorParamsProspero
: (WorldMapCursorParams)g_worldMapCursorParamsOrbis; : (WorldMapCursorParams)g_worldMapCursorParamsOrbis;
+1 -1
View File
@@ -57,7 +57,7 @@ PPC_FUNC(sub_82B98D30)
g_pScene = nullptr; g_pScene = nullptr;
InspirePatches::s_sceneName.clear(); InspirePatches::s_sceneName.clear();
SDL_User_EvilSonic(App::s_pEvilSonicContext); SDL_User_EvilSonic(App::s_isWerehog);
g_loadedMouthExplosionAnimation = false; g_loadedMouthExplosionAnimation = false;
g_hideMorphModels = false; g_hideMorphModels = false;
+1 -1
View File
@@ -80,7 +80,7 @@ PPC_FUNC(sub_82B14CC0)
auto isPlayStation = Config::ControllerIcons == EControllerIcons::PlayStation; auto isPlayStation = Config::ControllerIcons == EControllerIcons::PlayStation;
if (Config::ControllerIcons == EControllerIcons::Auto) if (Config::ControllerIcons == EControllerIcons::Auto)
isPlayStation = hid::g_inputDeviceController == hid::EInputDevice::PlayStation; isPlayStation = hid::g_inputDevicePad == hid::EInputDevice::PlayStation;
if (isPlayStation) if (isPlayStation)
{ {
+4 -4
View File
@@ -104,10 +104,10 @@ void SetXButtonHomingMidAsmHook(PPCRegister& r30)
PPC_FUNC_IMPL(__imp__sub_823B49D8); PPC_FUNC_IMPL(__imp__sub_823B49D8);
PPC_FUNC(sub_823B49D8) PPC_FUNC(sub_823B49D8)
{ {
App::s_pEvilSonicContext = (SWA::Player::CEvilSonicContext*)g_memory.Translate(ctx.r3.u32);
__imp__sub_823B49D8(ctx, base); __imp__sub_823B49D8(ctx, base);
App::s_isWerehog = true;
SDL_User_EvilSonic(true); SDL_User_EvilSonic(true);
} }
@@ -115,9 +115,9 @@ PPC_FUNC(sub_823B49D8)
PPC_FUNC_IMPL(__imp__sub_823B4590); PPC_FUNC_IMPL(__imp__sub_823B4590);
PPC_FUNC(sub_823B4590) PPC_FUNC(sub_823B4590)
{ {
App::s_pEvilSonicContext = nullptr;
__imp__sub_823B4590(ctx, base); __imp__sub_823B4590(ctx, base);
App::s_isWerehog = false;
SDL_User_EvilSonic(false); SDL_User_EvilSonic(false);
} }
+2 -2
View File
@@ -20,7 +20,7 @@ PPC_FUNC(sub_824DCF38)
if (Config::TimeOfDayTransition == ETimeOfDayTransition::PlayStation) if (Config::TimeOfDayTransition == ETimeOfDayTransition::PlayStation)
{ {
ctx.r4.u32 = SWA::eLoadingDisplayType_ChangeTimeOfDay; ctx.r4.u32 = SWA::eLoadingDisplayType_ChangeTimeOfDay;
pLoading->m_IsNightToDay = App::s_pEvilSonicContext; pLoading->m_IsNightToDay = App::s_isWerehog;
} }
if (Config::UseArrowsForTimeOfDayTransition) if (Config::UseArrowsForTimeOfDayTransition)
@@ -161,7 +161,7 @@ void LoadingScreenControllerMidAsmHook()
auto isPlayStation = Config::ControllerIcons == EControllerIcons::PlayStation; auto isPlayStation = Config::ControllerIcons == EControllerIcons::PlayStation;
if (Config::ControllerIcons == EControllerIcons::Auto) if (Config::ControllerIcons == EControllerIcons::Auto)
isPlayStation = hid::g_inputDeviceController == hid::EInputDevice::PlayStation; isPlayStation = hid::g_inputDevicePad == hid::EInputDevice::PlayStation;
const char* prefix = isPlayStation ? "ps3" : "360"; const char* prefix = isPlayStation ? "ps3" : "360";
+1 -1
View File
@@ -67,7 +67,7 @@ std::tuple<std::tuple<ImVec2, ImVec2>, GuestTexture*> GetButtonIcon(EButtonIcon
GuestTexture* texture; GuestTexture* texture;
auto isPlayStation = Config::ControllerIcons == EControllerIcons::Auto auto isPlayStation = Config::ControllerIcons == EControllerIcons::Auto
? hid::g_inputDeviceController == hid::EInputDevice::PlayStation ? hid::g_inputDevicePad == hid::EInputDevice::PlayStation
: Config::ControllerIcons == EControllerIcons::PlayStation; : Config::ControllerIcons == EControllerIcons::PlayStation;
auto yOffsetCmn = isPlayStation ? 42 : 0; auto yOffsetCmn = isPlayStation ? 42 : 0;
@@ -185,7 +185,7 @@ GuestTexture* GetThumbnail(const IConfigDef* cfg)
bool isPlayStation = Config::ControllerIcons == EControllerIcons::PlayStation; bool isPlayStation = Config::ControllerIcons == EControllerIcons::PlayStation;
if (Config::ControllerIcons == EControllerIcons::Auto) if (Config::ControllerIcons == EControllerIcons::Auto)
isPlayStation = hid::g_inputDeviceController == hid::EInputDevice::PlayStation; isPlayStation = hid::g_inputDevicePad == hid::EInputDevice::PlayStation;
texture = isPlayStation ? g_namedThumbnails["ControlTutorialPS"].get() : g_namedThumbnails["ControlTutorialXB"].get(); texture = isPlayStation ? g_namedThumbnails["ControlTutorialPS"].get() : g_namedThumbnails["ControlTutorialXB"].get();
} }
-1
View File
@@ -80,7 +80,6 @@ CONFIG_DEFINE_HIDDEN("Codes", bool, DisableAutoSaveWarning, false);
CONFIG_DEFINE_HIDDEN("Codes", bool, DisableDLCIcon, false); CONFIG_DEFINE_HIDDEN("Codes", bool, DisableDLCIcon, false);
CONFIG_DEFINE_HIDDEN("Codes", bool, DisableDWMRoundedCorners, false); CONFIG_DEFINE_HIDDEN("Codes", bool, DisableDWMRoundedCorners, false);
CONFIG_DEFINE_HIDDEN("Codes", bool, EnableEventCollisionDebugView, false); CONFIG_DEFINE_HIDDEN("Codes", bool, EnableEventCollisionDebugView, false);
CONFIG_DEFINE_HIDDEN("Codes", bool, EnableFreeCamera, false);
CONFIG_DEFINE_HIDDEN("Codes", bool, EnableGIMipLevelDebugView, false); CONFIG_DEFINE_HIDDEN("Codes", bool, EnableGIMipLevelDebugView, false);
CONFIG_DEFINE_HIDDEN("Codes", bool, EnableObjectCollisionDebugView, false); CONFIG_DEFINE_HIDDEN("Codes", bool, EnableObjectCollisionDebugView, false);
CONFIG_DEFINE_HIDDEN("Codes", bool, EnableStageCollisionDebugView, false); CONFIG_DEFINE_HIDDEN("Codes", bool, EnableStageCollisionDebugView, false);
-18
View File
@@ -1086,21 +1086,3 @@ registers = ["r4"]
name = "AnimationDataMakeMidAsmHook" name = "AnimationDataMakeMidAsmHook"
address = 0x82BB38E4 address = 0x82BB38E4
registers = ["r31", "r29", "r28"] registers = ["r31", "r29", "r28"]
[[midasm_hook]]
name = "FreeCameraSpeedInputMidAsmHook"
address = 0x82472A7C
registers = ["r31", "r29", "f0"]
jump_address_on_true = 0x82472AC4
# Disable start/end tool input.
[[midasm_hook]]
name = "FreeCameraActiveMidAsmHook"
address = 0x825D7690
jump_address_on_true = 0x825D7704
# Disable deactivation input.
[[midasm_hook]]
name = "FreeCameraActiveMidAsmHook"
address = 0x825D745C
jump_address_on_true = 0x825D768C