mirror of
https://github.com/hedge-dev/UnleashedRecomp.git
synced 2025-10-30 07:11:05 +00:00
api: added globals struct
This commit is contained in:
parent
87d2ab5af1
commit
8cba851212
9 changed files with 86 additions and 17 deletions
|
|
@ -62,6 +62,7 @@
|
|||
#include "SWA/Camera/Camera.h"
|
||||
#include "SWA/Camera/CameraController.h"
|
||||
#include "SWA/CharacterUtility/CharacterProxy.h"
|
||||
#include "SWA/Globals.h"
|
||||
#include "SWA/HUD/GeneralWindow/GeneralWindow.h"
|
||||
#include "SWA/HUD/Loading/Loading.h"
|
||||
#include "SWA/HUD/Pause/HudPause.h"
|
||||
|
|
|
|||
69
UnleashedRecomp/api/SWA/Globals.h
Normal file
69
UnleashedRecomp/api/SWA/Globals.h
Normal file
|
|
@ -0,0 +1,69 @@
|
|||
#pragma once
|
||||
|
||||
#include <SWA.inl>
|
||||
|
||||
namespace SWA
|
||||
{
|
||||
struct SGlobals
|
||||
{
|
||||
// ms_DrawLightFieldSamplingPoint: サンプリング点をデバッグ表示
|
||||
static inline bool* ms_DrawLightFieldSamplingPoint;
|
||||
|
||||
// ms_IgnoreLightFieldData: データを無視する
|
||||
static inline bool* ms_IgnoreLightFieldData;
|
||||
|
||||
// IsCollisionRender
|
||||
static inline bool* ms_IsCollisionRender;
|
||||
|
||||
// N/A
|
||||
static inline bool* ms_IsLoading;
|
||||
|
||||
// IsObjectCollisionRender
|
||||
static inline bool* ms_IsObjectCollisionRender;
|
||||
|
||||
// ms_IsRenderDebugDraw: デバッグ描画
|
||||
static inline bool* ms_IsRenderDebugDraw;
|
||||
|
||||
// ms_IsRenderDebugDrawText: デバッグ文字描画
|
||||
static inline bool* ms_IsRenderDebugDrawText;
|
||||
|
||||
// ms_IsRenderDebugPositionDraw: デバッグ位置描画
|
||||
static inline bool* ms_IsRenderDebugPositionDraw;
|
||||
|
||||
// ms_IsRenderGameMainHud: ゲームメインHUD 描画
|
||||
static inline bool* ms_IsRenderGameMainHud;
|
||||
|
||||
// ms_IsRenderHud: 全 HUD 描画
|
||||
static inline bool* ms_IsRenderHud;
|
||||
|
||||
// ms_IsRenderHudPause: ポーズメニュー 描画
|
||||
static inline bool* ms_IsRenderHudPause;
|
||||
|
||||
// IsTriggerRender
|
||||
static inline bool* ms_IsTriggerRender;
|
||||
|
||||
// ms_LightFieldDebug: 値をデバッグ表示
|
||||
static inline bool* ms_LightFieldDebug;
|
||||
|
||||
// VisualizeLoadedLevel: ミップレベルを視覚化 赤=0, 緑=1, 青=2, 黄=未ロード
|
||||
static inline bool* ms_VisualizeLoadedLevel;
|
||||
|
||||
static void Init()
|
||||
{
|
||||
ms_DrawLightFieldSamplingPoint = (bool*)MmGetHostAddress(0x83367BCE);
|
||||
ms_IgnoreLightFieldData = (bool*)MmGetHostAddress(0x83367BCF);
|
||||
ms_IsCollisionRender = (bool*)MmGetHostAddress(0x833678A6);
|
||||
ms_IsLoading = (bool*)MmGetHostAddress(0x83367A4C);
|
||||
ms_IsObjectCollisionRender = (bool*)MmGetHostAddress(0x83367905);
|
||||
ms_IsRenderDebugDraw = (bool*)MmGetHostAddress(0x8328BB23);
|
||||
ms_IsRenderDebugDrawText = (bool*)MmGetHostAddress(0x8328BB25);
|
||||
ms_IsRenderDebugPositionDraw = (bool*)MmGetHostAddress(0x8328BB24);
|
||||
ms_IsRenderGameMainHud = (bool*)MmGetHostAddress(0x8328BB27);
|
||||
ms_IsRenderHud = (bool*)MmGetHostAddress(0x8328BB26);
|
||||
ms_IsRenderHudPause = (bool*)MmGetHostAddress(0x8328BB28);
|
||||
ms_IsTriggerRender = (bool*)MmGetHostAddress(0x83367904);
|
||||
ms_LightFieldDebug = (bool*)MmGetHostAddress(0x83367BCD);
|
||||
ms_VisualizeLoadedLevel = (bool*)MmGetHostAddress(0x833678C1);
|
||||
}
|
||||
};
|
||||
}
|
||||
|
|
@ -1,4 +1,5 @@
|
|||
#include <app.h>
|
||||
#include "app.h"
|
||||
#include <api/SWA.h>
|
||||
#include <gpu/video.h>
|
||||
#include <install/installer.h>
|
||||
#include <kernel/function.h>
|
||||
|
|
@ -34,6 +35,8 @@ PPC_FUNC(sub_824EB490)
|
|||
App::s_isInit = true;
|
||||
App::s_isMissingDLC = !Installer::checkAllDLC(GetGamePath());
|
||||
App::s_language = Config::Language;
|
||||
|
||||
SWA::SGlobals::Init();
|
||||
Registry::Save();
|
||||
|
||||
__imp__sub_824EB490(ctx, base);
|
||||
|
|
|
|||
|
|
@ -3435,7 +3435,7 @@ static RenderPipeline* CreateGraphicsPipelineInRenderThread(PipelineState pipeli
|
|||
pipeline = CreateGraphicsPipeline(pipelineState);
|
||||
|
||||
#ifdef ASYNC_PSO_DEBUG
|
||||
bool loading = *reinterpret_cast<bool*>(g_memory.Translate(0x83367A4C));
|
||||
bool loading = *SWA::SGlobals::ms_IsLoading;
|
||||
|
||||
if (loading)
|
||||
++g_pipelinesCreatedAsynchronously;
|
||||
|
|
@ -5407,7 +5407,7 @@ static void PipelineCompilerThread()
|
|||
#ifdef _WIN32
|
||||
int newThreadPriority = threadPriority;
|
||||
|
||||
bool loading = *reinterpret_cast<bool*>(g_memory.Translate(0x83367A4C));
|
||||
bool loading = *SWA::SGlobals::ms_IsLoading;
|
||||
if (loading)
|
||||
newThreadPriority = THREAD_PRIORITY_HIGHEST;
|
||||
else
|
||||
|
|
@ -5468,7 +5468,7 @@ static void EnqueueGraphicsPipelineCompilation(
|
|||
|
||||
if (shouldCompile)
|
||||
{
|
||||
bool loading = *reinterpret_cast<bool*>(g_memory.Translate(0x83367A4C));
|
||||
bool loading = *SWA::SGlobals::ms_IsLoading;
|
||||
if (!loading && isPrecompiledPipeline)
|
||||
{
|
||||
// We can just compile here during the logos.
|
||||
|
|
@ -5805,7 +5805,7 @@ static void CompileMeshPipeline(const Mesh& mesh, CompilationArgs& args)
|
|||
|
||||
// We cannot rely on this being accurate during loading as SceneEffect.prm.xml gets loaded a bit later.
|
||||
bool planarReflectionEnabled = *reinterpret_cast<bool*>(g_memory.Translate(0x832FA0D8));
|
||||
bool loading = *reinterpret_cast<bool*>(g_memory.Translate(0x83367A4C));
|
||||
bool loading = *SWA::SGlobals::ms_IsLoading;
|
||||
bool compileNoMsaaPipeline = pipelineState.sampleCount != 1 && (loading || planarReflectionEnabled);
|
||||
|
||||
auto noMsaaPipeline = pipelineState;
|
||||
|
|
|
|||
|
|
@ -161,9 +161,7 @@ PPC_FUNC(sub_824B0930)
|
|||
{
|
||||
g_achievementMenuIntroTime = 0;
|
||||
|
||||
const auto ms_IsRenderHud = (bool*)g_memory.Translate(0x8328BB26);
|
||||
|
||||
if (*ms_IsRenderHud && pHudPause->m_IsShown && !pHudPause->m_Submenu && pHudPause->m_Transition == SWA::eTransitionType_Undefined)
|
||||
if (*SWA::SGlobals::ms_IsRenderHud && pHudPause->m_IsShown && !pHudPause->m_Submenu && pHudPause->m_Transition == SWA::eTransitionType_Undefined)
|
||||
{
|
||||
ButtonGuide::Open(Button(Localise("Achievements_Name"), EButtonIcon::Back, EButtonAlignment::Left, EFontQuality::Low));
|
||||
g_isClosed = false;
|
||||
|
|
|
|||
|
|
@ -94,7 +94,7 @@ bool LoadingUpdateMidAsmHook(PPCRegister& r31)
|
|||
g_ppcContext->f1.f64 = deltaTime;
|
||||
g_memory.FindFunction(update)(*g_ppcContext, base);
|
||||
|
||||
bool loading = PPC_LOAD_U8(0x83367A4C);
|
||||
bool loading = *SWA::SGlobals::ms_IsLoading;
|
||||
if (loading)
|
||||
{
|
||||
now = std::chrono::steady_clock::now();
|
||||
|
|
|
|||
|
|
@ -21,12 +21,9 @@ public:
|
|||
if (event->key.keysym.sym != SDLK_F8 || m_isF8KeyDown)
|
||||
break;
|
||||
|
||||
// アプリケーション設定 / 開発用 / デバッグ / HUD / 全 HUD 描画
|
||||
const auto ms_IsRenderHud = (bool*)g_memory.Translate(0x8328BB26);
|
||||
*SWA::SGlobals::ms_IsRenderHud = !*SWA::SGlobals::ms_IsRenderHud;
|
||||
|
||||
*ms_IsRenderHud = !*ms_IsRenderHud;
|
||||
|
||||
LOGFN("HUD {}", *ms_IsRenderHud ? "ON" : "OFF");
|
||||
LOGFN("HUD {}", *SWA::SGlobals::ms_IsRenderHud ? "ON" : "OFF");
|
||||
|
||||
m_isF8KeyDown = true;
|
||||
|
||||
|
|
@ -38,4 +35,5 @@ public:
|
|||
break;
|
||||
}
|
||||
}
|
||||
} g_frontendlistener;
|
||||
}
|
||||
g_frontendListener;
|
||||
|
|
|
|||
|
|
@ -1430,7 +1430,7 @@ static void DrawInfoPanel(ImVec2 infoMin, ImVec2 infoMax)
|
|||
static void SetOptionsMenuVisible(bool isVisible)
|
||||
{
|
||||
OptionsMenu::s_isVisible = isVisible;
|
||||
*(bool*)g_memory.Translate(0x8328BB26) = !isVisible;
|
||||
*SWA::SGlobals::ms_IsRenderHud = !isVisible;
|
||||
}
|
||||
|
||||
static bool DrawMilesElectric()
|
||||
|
|
|
|||
|
|
@ -81,7 +81,7 @@ CONFIG_DEFINE_HIDDEN("Exports", bool, DisableDLCIcon, false);
|
|||
CONFIG_DEFINE_HIDDEN("Exports", bool, DisableDWMRoundedCorners, false);
|
||||
CONFIG_DEFINE_HIDDEN("Exports", bool, FixUnleashOutOfControlDrain, false);
|
||||
CONFIG_DEFINE_HIDDEN("Exports", bool, HomingAttackOnBoost, true);
|
||||
CONFIG_DEFINE_HIDDEN("Exports", bool, HUDToggleHotkey, false);
|
||||
CONFIG_DEFINE_HIDDEN("Exports", bool, SaveScoreAtCheckpoints, false);
|
||||
CONFIG_DEFINE_HIDDEN("Exports", bool, SkipIntroLogos, false);
|
||||
CONFIG_DEFINE_HIDDEN("Exports", bool, UseOfficialTitleOnTitleBar, false);
|
||||
CONFIG_DEFINE_HIDDEN("Exports", bool, HUDToggleHotkey, false);
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue