Compare commits

...

8 Commits

Author SHA1 Message Date
Hyper 11863beb46 Initial research 2025-02-25 16:14:46 +00:00
ĐeäTh 98daa27c14 Added exceptions for specific hint messages being allowed/blocked by the Hints option (#462)
* Fix Windmill Isle Act 1 (Night) chip 'hint' not being shown

* code style adjustments

* Fix Apotos entrance gate first time Chip hint appearing with hints disabled

---------

Co-authored-by: Hyper <34012267+hyperbx@users.noreply.github.com>
2025-02-25 18:34:57 +03:00
ĐeäTh 0b16633ee1 fix options menu reset to default logic getting executed when setting is already default (#461) 2025-02-24 17:17:47 +01:00
Skyth (Asilkan) 388a86e866 Fix shader recompiler not depending on the patched executable. (#453) 2025-02-23 18:07:11 +03:00
Skyth fef357062d Update version milestone to Release Candidate 2. 2025-02-22 17:04:46 +03:00
Darío 03ef34ffe8 Dpi fixes (#449)
* Potential fix for DPI scaling.

* Show window size in pixels while in Fullscreen mode.
2025-02-22 16:12:56 +03:00
Darío c90d1fcb7b Fix typo in Spanish translation. (#447) 2025-02-21 22:14:00 +03:00
Hyper ae3dfb12df options_menu: append inaccessible reason to description (#446) 2025-02-21 21:10:00 +03:00
15 changed files with 192 additions and 56 deletions
@@ -0,0 +1,12 @@
#pragma once
#include <SWA.inl>
namespace Hedgehog::Mirage
{
class CMatrixNodeListener : public Base::CObject
{
public:
SWA_INSERT_PADDING(0x04);
};
}
+3
View File
@@ -31,6 +31,7 @@
#include "Hedgehog/Math/Quaternion.h"
#include "Hedgehog/Math/Vector.h"
#include "Hedgehog/MirageCore/MatrixNode/hhMatrixNode.h"
#include "Hedgehog/MirageCore/MatrixNode/hhMatrixNodeListener.h"
#include "Hedgehog/MirageCore/Misc/hhTransform.h"
#include "Hedgehog/MirageCore/Misc/hhVertexDeclarationPtr.h"
#include "Hedgehog/MirageCore/RenderData/hhMaterialData.h"
@@ -86,10 +87,12 @@
#include "SWA/Inspire/InspireTextureAnimationInfo.h"
#include "SWA/Inspire/InspireTextureOverlay.h"
#include "SWA/Inspire/InspireTextureOverlayInfo.h"
#include "SWA/Message/MsgRequestHelp.h"
#include "SWA/Menu/MenuWindowBase.h"
#include "SWA/Movie/MovieDisplayer.h"
#include "SWA/Movie/MovieManager.h"
#include "SWA/Object/Common/DashPanel/ObjDashPanel.h"
#include "SWA/Object/Event/Hint/ObjHintRing.h"
#include "SWA/Object/SonicStage/EU/RollingBarrel/ObjRollingBarrel.h"
#include "SWA/Player/Character/EvilSonic/EvilSonic.h"
#include "SWA/Player/Character/EvilSonic/EvilSonicContext.h"
@@ -0,0 +1,13 @@
#pragma once
#include <SWA.inl>
namespace SWA::Message
{
class MsgRequestHelp
{
public:
SWA_INSERT_PADDING(0x1C);
Hedgehog::Base::CSharedString m_Name;
};
}
@@ -0,0 +1,14 @@
#pragma once
#include <SWA.inl>
namespace SWA
{
class CObjHintRing
{
public:
SWA_INSERT_PADDING(0x160);
be<uint32_t> m_AnimationID;
bool m_Field164;
};
}
+1 -1
View File
@@ -2344,7 +2344,7 @@ namespace plume {
dstWidth = rect.right - rect.left;
dstHeight = rect.bottom - rect.top;
# elif defined(SDL_VULKAN_ENABLED)
SDL_GetWindowSize(renderWindow, (int *)(&dstWidth), (int *)(&dstHeight));
SDL_GetWindowSizeInPixels(renderWindow, (int *)(&dstWidth), (int *)(&dstHeight));
# elif defined(__ANDROID__)
dstWidth = ANativeWindow_getWidth(renderWindow);
dstHeight = ANativeWindow_getHeight(renderWindow);
+16 -10
View File
@@ -2415,19 +2415,25 @@ static void DrawImGui()
// we can adjust the mouse events before ImGui processes them.
uint32_t width = g_swapChain->getWidth();
uint32_t height = g_swapChain->getHeight();
if (width != Video::s_viewportWidth || height != Video::s_viewportHeight)
float mousePosScaleX = float(width) / float(GameWindow::s_width);
float mousePosScaleY = float(height) / float(GameWindow::s_height);
float mousePosOffsetX = (width - Video::s_viewportWidth) / 2.0f;
float mousePosOffsetY = (height - Video::s_viewportHeight) / 2.0f;
for (int i = 0; i < io.Ctx->InputEventsQueue.Size; i++)
{
float mousePosOffsetX = (width - Video::s_viewportWidth) / 2.0f;
float mousePosOffsetY = (height - Video::s_viewportHeight) / 2.0f;
for (int i = 0; i < io.Ctx->InputEventsQueue.Size; i++)
auto& e = io.Ctx->InputEventsQueue[i];
if (e.Type == ImGuiInputEventType_MousePos)
{
auto& e = io.Ctx->InputEventsQueue[i];
if (e.Type == ImGuiInputEventType_MousePos)
if (e.MousePos.PosX != -FLT_MAX)
{
if (e.MousePos.PosX != -FLT_MAX) e.MousePos.PosX -= mousePosOffsetX;
if (e.MousePos.PosY != -FLT_MAX) e.MousePos.PosY -= mousePosOffsetY;
e.MousePos.PosX *= mousePosScaleX;
e.MousePos.PosX -= mousePosOffsetX;
}
if (e.MousePos.PosY != -FLT_MAX)
{
e.MousePos.PosY *= mousePosScaleY;
e.MousePos.PosY -= mousePosOffsetY;
}
}
}
+1 -1
View File
@@ -213,7 +213,7 @@ std::unordered_map<std::string_view, std::unordered_map<ELanguage, std::string>>
{ ELanguage::Japanese, "この\u200Bオプションは\u200B[現在:げんざい]の\u200BOSで\u200B[変更:へんこう]\u200Bできません" },
{ ELanguage::German, "Diese Option wird von diesem Betriebssystem nicht unterstützt." },
{ ELanguage::French, "Cette option n'est pas prise en charge par votre système d'exploitation." },
{ ELanguage::Spanish, "Está opción no está soportada por tu sistema operativo." },
{ ELanguage::Spanish, "Esta opción no está soportada por tu sistema operativo." },
{ ELanguage::Italian, "Questa opzione non è disponibile con il tuo sistema operativo." }
}
},
+78 -2
View File
@@ -13,6 +13,38 @@ bool DisableHintsMidAsmHook()
return !Config::Hints;
}
// Disable hint ring visuals.
PPC_FUNC_IMPL(__imp__sub_82738088);
PPC_FUNC(sub_82738088)
{
auto pObjHintRing = (SWA::CObjHintRing*)(base + ctx.r3.u32);
auto pDeltaTime = (be<float>*)(base + ctx.r4.u32);
if (!Config::Hints)
{
auto pAnimationControl = PPC_LOAD_U32(ctx.r3.u32 + 0xF0);
// how does this even work
guest_stack_var<be<float>> time = 0.0f;
GuestToHostFunction<int>(sub_82BB4A40, pAnimationControl, time.get());
GuestToHostFunction<int>(sub_82BBC050, pAnimationControl, *pDeltaTime);
return;
}
__imp__sub_82738088(ctx, base);
}
// Disable hint ring hit event.
PPC_FUNC_IMPL(__imp__sub_827391E0);
PPC_FUNC(sub_827391E0)
{
if (!Config::Hints)
return;
__imp__sub_827391E0(ctx, base);
}
// Disable Perfect Dark Gaia hints.
PPC_FUNC_IMPL(__imp__sub_82AC36E0);
PPC_FUNC(sub_82AC36E0)
@@ -24,9 +56,14 @@ PPC_FUNC(sub_82AC36E0)
__imp__sub_82AC36E0(ctx, base);
}
bool DisableControlTutorialMidAsmHook()
// Disable navigation volumes.
PPC_FUNC_IMPL(__imp__sub_8273C4C8);
PPC_FUNC(sub_8273C4C8)
{
return !Config::ControlTutorial;
if (!Config::ControlTutorial)
return;
__imp__sub_8273C4C8(ctx, base);
}
bool DisableEvilControlTutorialMidAsmHook(PPCRegister& r4, PPCRegister& r5)
@@ -108,3 +145,42 @@ PPC_FUNC(sub_82586698)
__imp__sub_82586698(ctx, base);
}
// SWA::CObjHint::MsgNotifyObjectEvent::Impl
// Disable only certain hints from hint volumes.
// This hook should be used to allow hint volumes specifically to also prevent them from affecting the player.
PPC_FUNC_IMPL(__imp__sub_82736E80);
PPC_FUNC(sub_82736E80)
{
// GroupID parameter text
auto* groupId = (const char*)(base + PPC_LOAD_U32(ctx.r3.u32 + 0x100));
if (!Config::Hints)
{
// WhiteIsland_ACT1_001 (Windmill Isle Act 1 Night, Start)
// Your friend went off that way, Sonic. Quick, let's go after him!
if (strcmp(groupId, "WhiteIsland_ACT1_001") != 0)
return;
}
__imp__sub_82736E80(ctx, base);
}
// SWA::CHelpWindow::MsgRequestHelp::Impl
// Disable only certain hints from other sequences.
// This hook should be used to block hint messages from unknown sources.
PPC_FUNC_IMPL(__imp__sub_824C1E60);
PPC_FUNC(sub_824C1E60)
{
auto pMsgRequestHelp = (SWA::Message::MsgRequestHelp*)(base + ctx.r4.u32);
if (!Config::Hints)
{
// s10d_mykETF_c_navi (Town Mykonos Entrance, First Entry)
// Looks like we can get to a bunch of places in the village from here!
if (strcmp(pMsgRequestHelp->m_Name.c_str(), "s10d_mykETF_c_navi") == 0)
return;
}
__imp__sub_824C1E60(ctx, base);
}
+1 -1
View File
@@ -1,4 +1,4 @@
VERSION_MILESTONE="Release Candidate 1"
VERSION_MILESTONE="Release Candidate 2"
VERSION_MAJOR=1
VERSION_MINOR=0
VERSION_REVISION=0
+5
View File
@@ -378,6 +378,11 @@ SDL_Rect GameWindow::GetDimensions()
return rect;
}
void GameWindow::GetSizeInPixels(int *w, int *h)
{
SDL_GetWindowSizeInPixels(s_pWindow, w, h);
}
void GameWindow::SetDimensions(int w, int h, int x, int y)
{
s_width = w;
+1
View File
@@ -37,6 +37,7 @@ public:
static bool IsMaximised();
static EWindowState SetMaximised(bool isEnabled);
static SDL_Rect GetDimensions();
static void GetSizeInPixels(int *w, int *h);
static void SetDimensions(int w, int h, int x = SDL_WINDOWPOS_CENTERED, int y = SDL_WINDOWPOS_CENTERED);
static void ResetDimensions();
static uint32_t GetWindowFlags();
+29 -20
View File
@@ -859,16 +859,19 @@ static void DrawConfigOption(int32_t rowIndex, float yOffset, ConfigDef<T>* conf
if (g_canReset && padState.IsTapped(SWA::eKeyState_X))
{
config->MakeDefault();
if (!config->IsDefaultValue())
{
config->MakeDefault();
VideoConfigValueChangedCallback(config);
XAudioConfigValueChangedCallback(config);
VideoConfigValueChangedCallback(config);
XAudioConfigValueChangedCallback(config);
if (config->Callback)
config->Callback(config);
if (config->Callback)
config->Callback(config);
if (config->ApplyCallback)
config->ApplyCallback(config);
if (config->ApplyCallback)
config->ApplyCallback(config);
}
Game_PlaySound("sys_worldmap_decide");
}
@@ -1121,17 +1124,25 @@ static void DrawConfigOption(int32_t rowIndex, float yOffset, ConfigDef<T>* conf
{
if (config == &Config::WindowSize)
{
auto displayModes = GameWindow::GetDisplayModes();
if (config->Value >= 0 && config->Value < displayModes.size())
if (Config::Fullscreen)
{
auto& displayMode = displayModes[config->Value];
valueText = fmt::format("{}x{}", displayMode.w, displayMode.h);
int displayW, displayH;
GameWindow::GetSizeInPixels(&displayW, &displayH);
valueText = fmt::format("{}x{}", displayW, displayH);
}
else
{
valueText = fmt::format("{}x{}", GameWindow::s_width, GameWindow::s_height);
auto displayModes = GameWindow::GetDisplayModes();
if (config->Value >= 0 && config->Value < displayModes.size())
{
auto& displayMode = displayModes[config->Value];
valueText = fmt::format("{}x{}", displayMode.w, displayMode.h);
}
else
{
valueText = fmt::format("{}x{}", GameWindow::s_width, GameWindow::s_height);
}
}
}
else if (config == &Config::Monitor)
@@ -1195,7 +1206,6 @@ static void DrawConfigOptions()
int32_t rowCount = 0;
bool isStage = OptionsMenu::s_pauseMenuType == SWA::eMenuType_Stage || OptionsMenu::s_pauseMenuType == SWA::eMenuType_Hub;
auto cmnReason = &Localise("Options_Desc_NotAvailable");
// TODO: Don't use raw numbers here!
@@ -1205,8 +1215,8 @@ static void DrawConfigOptions()
DrawConfigOption(rowCount++, yOffset, &Config::Language, !OptionsMenu::s_isPause, cmnReason);
DrawConfigOption(rowCount++, yOffset, &Config::VoiceLanguage, OptionsMenu::s_pauseMenuType == SWA::eMenuType_WorldMap, cmnReason);
DrawConfigOption(rowCount++, yOffset, &Config::Subtitles, true);
DrawConfigOption(rowCount++, yOffset, &Config::Hints, !isStage, cmnReason);
DrawConfigOption(rowCount++, yOffset, &Config::ControlTutorial, !isStage, cmnReason);
DrawConfigOption(rowCount++, yOffset, &Config::Hints, true);
DrawConfigOption(rowCount++, yOffset, &Config::ControlTutorial, true);
DrawConfigOption(rowCount++, yOffset, &Config::AchievementNotifications, true);
DrawConfigOption(rowCount++, yOffset, &Config::TimeOfDayTransition, !Config::UseArrowsForTimeOfDayTransition);
break;
@@ -1458,7 +1468,7 @@ static void DrawInfoPanel(ImVec2 infoMin, ImVec2 infoMax)
if (g_inaccessibleReason)
{
desc = *g_inaccessibleReason;
desc += "\n\n" + *g_inaccessibleReason;
}
else
{
@@ -1476,10 +1486,9 @@ static void DrawInfoPanel(ImVec2 infoMin, ImVec2 infoMax)
}
const auto& valueDescription = g_selectedItem->GetValueDescription(Config::Language);
if (!valueDescription.empty())
{
desc += "\n\n" + valueDescription;
}
}
clipRectMin = { clipRectMin.x, thumbnailMax.y };
+14 -5
View File
@@ -26,8 +26,11 @@ foreach(i RANGE 0 260)
endforeach()
add_custom_command(
OUTPUT ${UNLEASHED_RECOMP_PPC_RECOMPILED_SOURCES}
COMMAND $<TARGET_FILE:XenonRecomp>
OUTPUT
"${CMAKE_CURRENT_SOURCE_DIR}/private/default_patched.xex"
${UNLEASHED_RECOMP_PPC_RECOMPILED_SOURCES}
COMMAND
$<TARGET_FILE:XenonRecomp>
DEPENDS
"${CMAKE_CURRENT_SOURCE_DIR}/private/default.xex"
"${CMAKE_CURRENT_SOURCE_DIR}/private/default.xexp"
@@ -49,9 +52,15 @@ file(GLOB XENOS_RECOMP_SOURCES
)
add_custom_command(
OUTPUT "${CMAKE_CURRENT_SOURCE_DIR}/shader/shader_cache.cpp"
COMMAND $<TARGET_FILE:XenosRecomp>
DEPENDS "${CMAKE_CURRENT_SOURCE_DIR}/private/shader.ar" ${XENOS_RECOMP_SOURCES} ${XENOS_RECOMP_INCLUDE}
OUTPUT
"${CMAKE_CURRENT_SOURCE_DIR}/shader/shader_cache.cpp"
COMMAND
$<TARGET_FILE:XenosRecomp>
DEPENDS
"${CMAKE_CURRENT_SOURCE_DIR}/private/default_patched.xex"
"${CMAKE_CURRENT_SOURCE_DIR}/private/shader.ar"
${XENOS_RECOMP_SOURCES}
${XENOS_RECOMP_INCLUDE}
)
add_library(UnleashedRecompLib
+3 -15
View File
@@ -106,17 +106,11 @@ jump_address = 0x82468EE0
name = "ResetScoreOnRestartMidAsmHook"
address = 0x82304374
# Disable hint volumes
# Disable Tornado Defense hints
[[midasm_hook]]
name = "DisableHintsMidAsmHook"
address = 0x827A2504
jump_address_on_true = 0x827A251C
# Disable hint rings
[[midasm_hook]]
name = "DisableHintsMidAsmHook"
address = 0x827A2E34
jump_address_on_true = 0x827A2E4C
address = 0x82AF52BC
jump_address_on_true = 0x82AF52E4
# Disable Egg Dragoon hint "V_WHG_083" ("That lit-up part on the bottom looks fishy. I'll try aiming for that.")
[[midasm_hook]]
@@ -184,12 +178,6 @@ name = "DisableHintsMidAsmHook"
address = 0x82691CB0
jump_address_on_true = 0x82691E24
# Disable navigation volumes
[[midasm_hook]]
name = "DisableControlTutorialMidAsmHook"
address = 0x827AA5EC
jump_address_on_true = 0x827AA604
# Disable Werehog button prompts
[[midasm_hook]]
name = "DisableEvilControlTutorialMidAsmHook"