mirror of
https://github.com/hedge-dev/UnleashedRecomp
synced 2026-06-10 12:55:51 -04:00
Compare commits
2 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| ea86d8b6c0 | |||
| 0bdf9e6413 |
@@ -89,9 +89,6 @@ PPC_FUNC(sub_822C1130)
|
|||||||
if (Config::EnableObjectCollisionDebugView)
|
if (Config::EnableObjectCollisionDebugView)
|
||||||
*SWA::SGlobals::ms_IsObjectCollisionRender = true;
|
*SWA::SGlobals::ms_IsObjectCollisionRender = true;
|
||||||
|
|
||||||
if (Config::EnableStageCollisionDebugView)
|
|
||||||
*SWA::SGlobals::ms_IsCollisionRender = true;
|
|
||||||
|
|
||||||
__imp__sub_822C1130(ctx, base);
|
__imp__sub_822C1130(ctx, base);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -195,11 +195,3 @@ bool SparkleLocusMidAsmHook()
|
|||||||
// This has the side effect of the locus particle eventually snapping to the rest position during pause, but it's better than vertices exploding.
|
// This has the side effect of the locus particle eventually snapping to the rest position during pause, but it's better than vertices exploding.
|
||||||
return App::s_deltaTime < (1.0 / 60.0);
|
return App::s_deltaTime < (1.0 / 60.0);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CEvilSonicContext_CStateWall_LeaveRotationMidAsmHook(PPCRegister& f1)
|
|
||||||
{
|
|
||||||
// The code in the Werehog's "wall" state for leaving walls adds a constant
|
|
||||||
// value of 0.05 to his transform every frame. This makes the value respect
|
|
||||||
// delta time whilst maintaining the original behaviour at 30 FPS.
|
|
||||||
f1.f64 = f1.f64 * (std::min(App::s_deltaTime, 1.0 / 15.0) / (1.0 / 30.0));
|
|
||||||
}
|
|
||||||
|
|||||||
@@ -1,3 +1,4 @@
|
|||||||
|
#include "misc_patches.h"
|
||||||
#include <api/SWA.h>
|
#include <api/SWA.h>
|
||||||
#include <ui/game_window.h>
|
#include <ui/game_window.h>
|
||||||
#include <user/achievement_manager.h>
|
#include <user/achievement_manager.h>
|
||||||
@@ -194,28 +195,53 @@ PPC_FUNC(sub_824EE620)
|
|||||||
ctx.r3.u32 = PersistentStorageManager::ShouldDisplayDLCMessage(true);
|
ctx.r3.u32 = PersistentStorageManager::ShouldDisplayDLCMessage(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
// This is a constructor for some struct that constructed inside CTownManContext::CTownManContext()
|
bool StageCollisionDebugViewMidAsmHook(PPCRegister& r27)
|
||||||
// and within the calls contained in CTownManBase::ProcMsgSetTownManRetryTimeTable().
|
|
||||||
//
|
|
||||||
// Within the constructor of the CTownManContext, the second member of this struct is initialized to -1
|
|
||||||
// after this call happens inside CTownManContext::CTownManContext() at pretty much the very of that function call.
|
|
||||||
//
|
|
||||||
// This initialization of the member variable is however not executed when this constructor for the struct
|
|
||||||
// is called from someplace else in the game's code, as such it remains with unitialized data for that field.
|
|
||||||
//
|
|
||||||
// Ensuring that this member variable is initialized to 0 anytime this constructor is called fixes an issue with
|
|
||||||
// Tails not disappearing when giving you the camera after Rooftop Run Act 1 (Night). This setting of it to 0 won't
|
|
||||||
// break the behaviour created by the call to it from CTownManContext::CTownManContext() as that itself sets it to -1 later on.
|
|
||||||
// It only affects other instance of the call.
|
|
||||||
//
|
|
||||||
// NOTE: ctx.r3.u32 + 0 is also unitialized by this constructor, however both instances of this function being called
|
|
||||||
// initialized the said variable later on before being used.
|
|
||||||
//
|
|
||||||
// NOTE: ctx.r3.u32 + 20 is also unitialized, however I could not find any uses for this. Since this is already
|
|
||||||
// quite a big change due to the amount of NPCs in the game, I would rather not touch this unless an issue is found.
|
|
||||||
PPC_FUNC_IMPL(__imp__sub_8297C630);
|
|
||||||
PPC_FUNC(sub_8297C630)
|
|
||||||
{
|
{
|
||||||
PPC_STORE_U32(ctx.r3.u32 + 4, 0);
|
if (Config::EnableStageCollisionDebugView)
|
||||||
__imp__sub_8297C630(ctx, base);
|
{
|
||||||
|
r27.u32 = true;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
// The game is set up so that after parsing the Stage.set.xml it checks if TerrainInfoFile is found or not.
|
||||||
|
// Based on the result of that it will either draw terrain or debug collision (if enabled).
|
||||||
|
//
|
||||||
|
// The XMLs in the game are populated like this generally speaking:
|
||||||
|
// <Terrain>
|
||||||
|
// <TerrainInfoFile>terrain</TerrainInfoFile>
|
||||||
|
// <GIAtlas>1</GIAtlas>
|
||||||
|
// </Terrain>
|
||||||
|
// <Terrain>
|
||||||
|
// <RigidBodyContainer>collision</RigidBodyContainer>
|
||||||
|
// <IsCollisionRender>false</IsCollisionRender>
|
||||||
|
// </Terrain>
|
||||||
|
//
|
||||||
|
// In some cases however, the information in these two Terrain blocks is combined into one block,
|
||||||
|
// which makes the logic checking TerrainInfoFile's contents only fire once, and with success only, as such
|
||||||
|
// the logic for drawing collision will never execute.
|
||||||
|
//
|
||||||
|
// To combat this we check if both types returned with some value from the XML file, which indicates that its
|
||||||
|
// a single Terrain block, and if so we store that information so we can later on re-use to manually fire the
|
||||||
|
// logic controlling the drawing of the debug collision view.
|
||||||
|
void StageCollisionDebugViewStoreXmlTypeMidAsmHook(PPCRegister& r1)
|
||||||
|
{
|
||||||
|
uint8_t* base = g_memory.base;
|
||||||
|
|
||||||
|
const char* rigidBodyContainer = (const char*)(base + PPC_LOAD_U32(r1.u32 + 108));
|
||||||
|
const char* terrainInfoFile = (const char*)(base + PPC_LOAD_U32(r1.u32 + 132));
|
||||||
|
if (*rigidBodyContainer != '\0' && *terrainInfoFile != '\0')
|
||||||
|
{
|
||||||
|
g_singleTerrainBlockXml = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
bool StageCollisionDebugViewSingleTerrainBlockXmlMidAsmHook()
|
||||||
|
{
|
||||||
|
bool runCollisionViewDrawLogic = g_singleTerrainBlockXml;
|
||||||
|
g_singleTerrainBlockXml = false;
|
||||||
|
|
||||||
|
return runCollisionViewDrawLogic;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,3 @@
|
|||||||
|
#pragma once
|
||||||
|
|
||||||
|
static bool g_singleTerrainBlockXml = false;
|
||||||
@@ -1142,14 +1142,18 @@ name = "EndingTextPositionMidAsmHook"
|
|||||||
address = 0x82580168
|
address = 0x82580168
|
||||||
registers = ["r31", "f13"]
|
registers = ["r31", "f13"]
|
||||||
|
|
||||||
# Wall Leave - Left
|
|
||||||
[[midasm_hook]]
|
[[midasm_hook]]
|
||||||
name = "CEvilSonicContext_CStateWall_LeaveRotationMidAsmHook"
|
name = "StageCollisionDebugViewMidAsmHook"
|
||||||
address = 0x824067BC
|
address = 0x825648F8
|
||||||
registers = ["f1"]
|
registers = ["r27"]
|
||||||
|
jump_address_on_true = 0x825648FC
|
||||||
|
|
||||||
# Wall Leave - Right
|
|
||||||
[[midasm_hook]]
|
[[midasm_hook]]
|
||||||
name = "CEvilSonicContext_CStateWall_LeaveRotationMidAsmHook"
|
name = "StageCollisionDebugViewStoreXmlTypeMidAsmHook"
|
||||||
address = 0x82406774
|
address = 0x8256422C
|
||||||
registers = ["f1"]
|
registers = ["r1"]
|
||||||
|
|
||||||
|
[[midasm_hook]]
|
||||||
|
name = "StageCollisionDebugViewSingleTerrainBlockXmlMidAsmHook"
|
||||||
|
address = 0x82564B00
|
||||||
|
jump_address_on_true = 0x82564764
|
||||||
|
|||||||
Reference in New Issue
Block a user