mirror of
https://github.com/hedge-dev/UnleashedRecomp
synced 2026-06-10 04:54:37 -04:00
Compare commits
2 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| ea86d8b6c0 | |||
| 0bdf9e6413 |
@@ -352,8 +352,6 @@ if (UNLEASHED_RECOMP_FLATPAK)
|
||||
)
|
||||
endif()
|
||||
|
||||
target_compile_definitions(UnleashedRecomp PRIVATE $<$<CONFIG:Debug>:UNLEASHED_RECOMP_DEBUG=1>)
|
||||
|
||||
find_package(CURL REQUIRED)
|
||||
|
||||
if (UNLEASHED_RECOMP_D3D12)
|
||||
|
||||
@@ -89,9 +89,6 @@ PPC_FUNC(sub_822C1130)
|
||||
if (Config::EnableObjectCollisionDebugView)
|
||||
*SWA::SGlobals::ms_IsObjectCollisionRender = true;
|
||||
|
||||
if (Config::EnableStageCollisionDebugView)
|
||||
*SWA::SGlobals::ms_IsCollisionRender = true;
|
||||
|
||||
__imp__sub_822C1130(ctx, base);
|
||||
}
|
||||
|
||||
|
||||
@@ -3145,7 +3145,7 @@ static GuestTexture* CreateTexture(uint32_t width, uint32_t height, uint32_t dep
|
||||
|
||||
g_textureDescriptorSet->setTexture(texture->descriptorIndex, texture->texture, RenderTextureLayout::SHADER_READ, texture->textureView.get());
|
||||
|
||||
#ifdef UNLEASHED_RECOMP_DEBUG
|
||||
#ifdef _DEBUG
|
||||
texture->texture->setName(fmt::format("Texture {:X}", g_memory.MapVirtual(texture)));
|
||||
#endif
|
||||
|
||||
@@ -3162,7 +3162,7 @@ static GuestBuffer* CreateVertexBuffer(uint32_t length)
|
||||
auto buffer = g_userHeap.AllocPhysical<GuestBuffer>(ResourceType::VertexBuffer);
|
||||
buffer->buffer = g_device->createBuffer(RenderBufferDesc::VertexBuffer(length, GetBufferHeapType(), RenderBufferFlag::INDEX));
|
||||
buffer->dataSize = length;
|
||||
#ifdef UNLEASHED_RECOMP_DEBUG
|
||||
#ifdef _DEBUG
|
||||
buffer->buffer->setName(fmt::format("Vertex Buffer {:X}", g_memory.MapVirtual(buffer)));
|
||||
#endif
|
||||
return buffer;
|
||||
@@ -3175,7 +3175,7 @@ static GuestBuffer* CreateIndexBuffer(uint32_t length, uint32_t, uint32_t format
|
||||
buffer->dataSize = length;
|
||||
buffer->format = ConvertFormat(format);
|
||||
buffer->guestFormat = format;
|
||||
#ifdef UNLEASHED_RECOMP_DEBUG
|
||||
#ifdef _DEBUG
|
||||
buffer->buffer->setName(fmt::format("Index Buffer {:X}", g_memory.MapVirtual(buffer)));
|
||||
#endif
|
||||
return buffer;
|
||||
@@ -3213,7 +3213,7 @@ static GuestSurface* CreateSurface(uint32_t width, uint32_t height, uint32_t for
|
||||
surface->descriptorIndex = g_textureDescriptorAllocator.allocate();
|
||||
g_textureDescriptorSet->setTexture(surface->descriptorIndex, surface->textureHolder.get(), RenderTextureLayout::SHADER_READ, surface->textureView.get());
|
||||
|
||||
#ifdef UNLEASHED_RECOMP_DEBUG
|
||||
#ifdef _DEBUG
|
||||
surface->texture->setName(fmt::format("{} {:X}", desc.flags & RenderTextureFlag::RENDER_TARGET ? "Render Target" : "Depth Stencil", g_memory.MapVirtual(surface)));
|
||||
#endif
|
||||
|
||||
@@ -5857,7 +5857,7 @@ static void MakePictureData(GuestPictureData* pictureData, uint8_t* data, uint32
|
||||
|
||||
if (LoadTexture(texture, data, dataSize, {}))
|
||||
{
|
||||
#ifdef UNLEASHED_RECOMP_DEBUG
|
||||
#ifdef _DEBUG
|
||||
texture.texture->setName(reinterpret_cast<char*>(g_memory.Translate(pictureData->name + 2)));
|
||||
#endif
|
||||
XXH64_hash_t hash = XXH3_64bits(data, dataSize);
|
||||
|
||||
@@ -203,7 +203,7 @@ uint32_t XamShowMessageBoxUI(uint32_t dwUserIndex, be<uint16_t>* wszTitle, be<ui
|
||||
{
|
||||
*pResult = cButtons ? cButtons - 1 : 0;
|
||||
|
||||
#if UNLEASHED_RECOMP_DEBUG
|
||||
#if _DEBUG
|
||||
assert("XamShowMessageBoxUI encountered!" && false);
|
||||
#elif _WIN32
|
||||
// This code is Win32-only as it'll most likely crash, misbehave or
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
#define LOG_WARNING(str) LOG_IMPL(Warning, __func__, str)
|
||||
#define LOG_ERROR(str) LOG_IMPL(Error, __func__, str)
|
||||
|
||||
#if UNLEASHED_RECOMP_DEBUG
|
||||
#if _DEBUG
|
||||
#define LOG_UTILITY(str) LOG_IMPL(Utility, __func__, str)
|
||||
#else
|
||||
#define LOG_UTILITY(str)
|
||||
@@ -21,7 +21,7 @@
|
||||
#define LOGF_WARNING(str, ...) LOGF_IMPL(Warning, __func__, str, __VA_ARGS__)
|
||||
#define LOGF_ERROR(str, ...) LOGF_IMPL(Error, __func__, str, __VA_ARGS__)
|
||||
|
||||
#if UNLEASHED_RECOMP_DEBUG
|
||||
#if _DEBUG
|
||||
#define LOGF_UTILITY(str, ...) LOGF_IMPL(Utility, __func__, str, __VA_ARGS__)
|
||||
#else
|
||||
#define LOGF_UTILITY(str, ...)
|
||||
@@ -33,7 +33,7 @@
|
||||
#define LOGN_WARNING(str) LOG_IMPL(Warning, "*", str)
|
||||
#define LOGN_ERROR(str) LOG_IMPL(Error, "*", str)
|
||||
|
||||
#if UNLEASHED_RECOMP_DEBUG
|
||||
#if _DEBUG
|
||||
#define LOGN_UTILITY(str) LOG_IMPL(Utility, "*", str)
|
||||
#else
|
||||
#define LOGN_UTILITY(str)
|
||||
@@ -43,7 +43,7 @@
|
||||
#define LOGFN_WARNING(str, ...) LOGF_IMPL(Warning, "*", str, __VA_ARGS__)
|
||||
#define LOGFN_ERROR(str, ...) LOGF_IMPL(Error, "*", str, __VA_ARGS__)
|
||||
|
||||
#if UNLEASHED_RECOMP_DEBUG
|
||||
#if _DEBUG
|
||||
#define LOGFN_UTILITY(str, ...) LOGF_IMPL(Utility, "*", str, __VA_ARGS__)
|
||||
#else
|
||||
#define LOGFN_UTILITY(str, ...)
|
||||
|
||||
@@ -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.
|
||||
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 <ui/game_window.h>
|
||||
#include <user/achievement_manager.h>
|
||||
@@ -193,3 +194,54 @@ PPC_FUNC(sub_824EE620)
|
||||
|
||||
ctx.r3.u32 = PersistentStorageManager::ShouldDisplayDLCMessage(true);
|
||||
}
|
||||
|
||||
bool StageCollisionDebugViewMidAsmHook(PPCRegister& r27)
|
||||
{
|
||||
if (Config::EnableStageCollisionDebugView)
|
||||
{
|
||||
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;
|
||||
@@ -3,7 +3,7 @@
|
||||
#define UNLEASHED_RECOMP_VERSION_BIN @WIN32_VERSION_BINARY@
|
||||
#define UNLEASHED_RECOMP_VERSION_STR "@WIN32_VERSION_STRING@"
|
||||
|
||||
#ifdef UNLEASHED_RECOMP_DEBUG
|
||||
#ifdef _DEBUG
|
||||
#define UNLEASHED_RECOMP_FILE_FLAGS VS_FF_DEBUG
|
||||
#else
|
||||
#define UNLEASHED_RECOMP_FILE_FLAGS 0
|
||||
|
||||
@@ -817,7 +817,7 @@ void Config::Load()
|
||||
{
|
||||
def->ReadValue(toml);
|
||||
|
||||
#if UNLEASHED_RECOMP_DEBUG
|
||||
#if _DEBUG
|
||||
LOGFN_UTILITY("{} (0x{:X})", def->GetDefinition().c_str(), (intptr_t)def->GetValue());
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -1142,14 +1142,18 @@ name = "EndingTextPositionMidAsmHook"
|
||||
address = 0x82580168
|
||||
registers = ["r31", "f13"]
|
||||
|
||||
# Wall Leave - Left
|
||||
[[midasm_hook]]
|
||||
name = "CEvilSonicContext_CStateWall_LeaveRotationMidAsmHook"
|
||||
address = 0x824067BC
|
||||
registers = ["f1"]
|
||||
name = "StageCollisionDebugViewMidAsmHook"
|
||||
address = 0x825648F8
|
||||
registers = ["r27"]
|
||||
jump_address_on_true = 0x825648FC
|
||||
|
||||
# Wall Leave - Right
|
||||
[[midasm_hook]]
|
||||
name = "CEvilSonicContext_CStateWall_LeaveRotationMidAsmHook"
|
||||
address = 0x82406774
|
||||
registers = ["f1"]
|
||||
name = "StageCollisionDebugViewStoreXmlTypeMidAsmHook"
|
||||
address = 0x8256422C
|
||||
registers = ["r1"]
|
||||
|
||||
[[midasm_hook]]
|
||||
name = "StageCollisionDebugViewSingleTerrainBlockXmlMidAsmHook"
|
||||
address = 0x82564B00
|
||||
jump_address_on_true = 0x82564764
|
||||
|
||||
Reference in New Issue
Block a user