From 23f87c31d2e22fe22db6ca4eec2db764603e3f1b Mon Sep 17 00:00:00 2001 From: Aubrey Date: Wed, 12 Nov 2025 05:16:23 -0600 Subject: [PATCH] Projects/Scene: Implement `SceneInitInfo` (#796) --- data/file_list.yml | 2 +- lib/al/Library/Scene/Scene.cpp | 18 +++++++++--------- lib/al/Library/Scene/SceneUtil.cpp | 24 ++++++++++++------------ lib/al/Project/Scene/SceneInitInfo.cpp | 14 ++++++++++++++ lib/al/Project/Scene/SceneInitInfo.h | 18 ++++++++++++------ src/Scene/StageSceneStatePauseMenu.cpp | 4 ++-- src/Scene/TitleMenuScene.cpp | 2 +- 7 files changed, 51 insertions(+), 31 deletions(-) create mode 100644 lib/al/Project/Scene/SceneInitInfo.cpp diff --git a/data/file_list.yml b/data/file_list.yml index 4cfc6b624..018e204f8 100644 --- a/data/file_list.yml +++ b/data/file_list.yml @@ -295975,7 +295975,7 @@ Project/Scene/SceneInitInfo.o: label: - _ZN2al13SceneInitInfoC1EPKNS_14GameSystemInfoEPNS_18GameDataHolderBaseEPNS_21ScreenCaptureExecutorEPKciS9_PNS_13AudioDirectorE - _ZN2al13SceneInitInfoC2EPKNS_14GameSystemInfoEPNS_18GameDataHolderBaseEPNS_21ScreenCaptureExecutorEPKciS9_PNS_13AudioDirectorE - status: NotDecompiled + status: Matching Project/Screen/ScreenCapture.o: '.text': - offset: 0xa7fdf8 diff --git a/lib/al/Library/Scene/Scene.cpp b/lib/al/Library/Scene/Scene.cpp index 9af19d3b4..a5d0e22af 100644 --- a/lib/al/Library/Scene/Scene.cpp +++ b/lib/al/Library/Scene/Scene.cpp @@ -83,7 +83,7 @@ void Scene::initializeAsync(const SceneInitInfo& info) { } void Scene::initDrawSystemInfo(const SceneInitInfo& info) { - mDrawSystemInfo = info.gameSysInfo->drawSystemInfo; + mDrawSystemInfo = info.gameSystemInfo->drawSystemInfo; } void Scene::initSceneObjHolder(SceneObjHolder* sceneObjHolder) { @@ -99,7 +99,7 @@ void Scene::initLiveActorKit(const SceneInitInfo& info, s32 maxActors, s32 maxPl s32 maxCameras) { initLiveActorKitImpl(info, maxActors, maxPlayers, maxCameras); - DrawSystemInfo* drawSystemInfo = info.gameSysInfo->drawSystemInfo; + DrawSystemInfo* drawSystemInfo = info.gameSystemInfo->drawSystemInfo; GraphicsInitArg graphicsInitArg = {getSceneDrawContext(this), drawSystemInfo->dockedRenderBuffer}; graphicsInitArg._3c = maxCameras; @@ -107,15 +107,15 @@ void Scene::initLiveActorKit(const SceneInitInfo& info, s32 maxActors, s32 maxPl mLiveActorKit->initGraphics(graphicsInitArg); mLiveActorKit->getGraphicsSystemInfo()->setApplicationMessageReceiver( - info.gameSysInfo->applicationMessageReciever); + info.gameSystemInfo->applicationMessageReciever); } void Scene::initLiveActorKitImpl(const SceneInitInfo& info, s32 maxActors, s32 maxPlayers, s32 maxCameras) { mLiveActorKit = new LiveActorKit(maxActors, maxPlayers); mLiveActorKit->setSceneDrawContext(getSceneDrawContext(this)); - mLiveActorKit->setGamePadSystem(info.gameSysInfo->gamePadSystem); - mLiveActorKit->setEffectSystem(info.gameSysInfo->effectSystem); + mLiveActorKit->setGamePadSystem(info.gameSystemInfo->gamePadSystem); + mLiveActorKit->setEffectSystem(info.gameSystemInfo->effectSystem); mLiveActorKit->init(maxCameras); } @@ -125,13 +125,13 @@ void Scene::initLiveActorKitWithGraphics(const GraphicsInitArg& graphicsInitArg, initLiveActorKitImpl(info, maxActors, maxPlayers, maxCameras); mLiveActorKit->initGraphics(graphicsInitArg); mLiveActorKit->getGraphicsSystemInfo()->setApplicationMessageReceiver( - info.gameSysInfo->applicationMessageReciever); + info.gameSystemInfo->applicationMessageReciever); } void Scene::initLayoutKit(const SceneInitInfo& info) { - mLayoutKit = new LayoutKit(info.gameSysInfo->fontHolder); - mLayoutKit->setEffectSystem(info.gameSysInfo->effectSystem); - mLayoutKit->setLayoutSystem(info.gameSysInfo->layoutSystem); + mLayoutKit = new LayoutKit(info.gameSystemInfo->fontHolder); + mLayoutKit->setEffectSystem(info.gameSystemInfo->effectSystem); + mLayoutKit->setLayoutSystem(info.gameSystemInfo->layoutSystem); mLayoutKit->setDrawContext(getSceneDrawContext(this)); } diff --git a/lib/al/Library/Scene/SceneUtil.cpp b/lib/al/Library/Scene/SceneUtil.cpp index cc6815c7f..6f91f9cea 100644 --- a/lib/al/Library/Scene/SceneUtil.cpp +++ b/lib/al/Library/Scene/SceneUtil.cpp @@ -198,14 +198,14 @@ void initLayoutInitInfo(LayoutInitInfo* layoutInfo, const Scene* scene, layoutInfo->init( actorKit->getExecuteDirector(), actorKit->getEffectSystem()->getEffectSystemInfo(), scene->getSceneObjHolder(), scene->getAudioDirector(), actorKit->getCameraDirector(), - sceneInfo.gameSysInfo->layoutSystem, sceneInfo.gameSysInfo->messageSystem, - sceneInfo.gameSysInfo->gamePadSystem, actorKit->getPadRumbleDirector()); + sceneInfo.gameSystemInfo->layoutSystem, sceneInfo.gameSystemInfo->messageSystem, + sceneInfo.gameSystemInfo->gamePadSystem, actorKit->getPadRumbleDirector()); } else { - layoutInfo->init(layoutKit->getExecuteDirector(), - layoutKit->getEffectSystem()->getEffectSystemInfo(), - scene->getSceneObjHolder(), scene->getAudioDirector(), nullptr, - sceneInfo.gameSysInfo->layoutSystem, sceneInfo.gameSysInfo->messageSystem, - sceneInfo.gameSysInfo->gamePadSystem, nullptr); + layoutInfo->init( + layoutKit->getExecuteDirector(), layoutKit->getEffectSystem()->getEffectSystemInfo(), + scene->getSceneObjHolder(), scene->getAudioDirector(), nullptr, + sceneInfo.gameSystemInfo->layoutSystem, sceneInfo.gameSystemInfo->messageSystem, + sceneInfo.gameSystemInfo->gamePadSystem, nullptr); } layoutInfo->setDrawContext(scene->getDrawSystemInfo()->drawContext); @@ -682,8 +682,8 @@ void endCameraPause(PauseCameraCtrl* pauseCameraCtrl) { AudioDirector* initAudioDirectorImpl(Scene* scene, const SceneInitInfo& sceneInfo, AudioDirectorInitInfo& audioDirectorInfo) { audioDirectorInfo.audioSystemInfo = - sceneInfo.gameSysInfo->audioSystem ? - sceneInfo.gameSysInfo->audioSystem->getAudioSystemInfo() : + sceneInfo.gameSystemInfo->audioSystem ? + sceneInfo.gameSystemInfo->audioSystem->getAudioSystemInfo() : nullptr; if (!audioDirectorInfo.curStage) @@ -739,8 +739,8 @@ void initAudioDirector3D(Scene* scene, const SceneInitInfo& sceneInfo, void initSceneAudioKeeper(Scene* scene, const SceneInitInfo& sceneInfo, const char* name) { AudioSystemInfo* audioSystemInfo = nullptr; - if (sceneInfo.gameSysInfo->audioSystem) - audioSystemInfo = sceneInfo.gameSysInfo->audioSystem->getAudioSystemInfo(); + if (sceneInfo.gameSystemInfo->audioSystem) + audioSystemInfo = sceneInfo.gameSystemInfo->audioSystem->getAudioSystemInfo(); const char* seUserName = alSeDbFunction::tryFindSceneSeUserName( audioSystemInfo, sceneInfo.initStageName, sceneInfo.scenarioNo); @@ -959,7 +959,7 @@ void stopAllSe(const Scene* scene, u32 index) { } void initPadRumble(const Scene* scene, const SceneInitInfo& sceneInfo) { - WaveVibrationHolder* waveVibrationHolder = sceneInfo.gameSysInfo->waveVibrationHolder; + WaveVibrationHolder* waveVibrationHolder = sceneInfo.gameSystemInfo->waveVibrationHolder; scene->getLiveActorKit()->getPadRumbleDirector()->setWaveVibrationHolder(waveVibrationHolder); alAudioSystemFunction::setPadRumbleDirectorForSe( diff --git a/lib/al/Project/Scene/SceneInitInfo.cpp b/lib/al/Project/Scene/SceneInitInfo.cpp new file mode 100644 index 000000000..de9e1ea5c --- /dev/null +++ b/lib/al/Project/Scene/SceneInitInfo.cpp @@ -0,0 +1,14 @@ +#include "Project/Scene/SceneInitInfo.h" + +namespace al { +SceneInitInfo::SceneInitInfo(const GameSystemInfo* gameSystemInfo, + GameDataHolderBase* gameDataHolder, + ScreenCaptureExecutor* screenCaptureExecutor, + const char* initStageName, s32 scenarioNo, const char* initSceneName, + AudioDirector* audioDirector) + : gameSystemInfo(gameSystemInfo), gameDataHolder(gameDataHolder), + screenCaptureExecutor(screenCaptureExecutor), initStageName(initStageName), + scenarioNo(scenarioNo), audioDirector(audioDirector) { + sceneName = initSceneName; +} +} // namespace al diff --git a/lib/al/Project/Scene/SceneInitInfo.h b/lib/al/Project/Scene/SceneInitInfo.h index 7dca77e08..97c19c793 100644 --- a/lib/al/Project/Scene/SceneInitInfo.h +++ b/lib/al/Project/Scene/SceneInitInfo.h @@ -1,18 +1,24 @@ #pragma once #include +#include namespace al { -class AudioDirector; +struct GameSystemInfo; class GameDataHolderBase; +class ScreenCaptureExecutor; +class AudioDirector; struct SceneInitInfo { - struct GameSystemInfo* gameSysInfo; + SceneInitInfo(const GameSystemInfo* gameSystemInfo, GameDataHolderBase* gameDataHolder, + ScreenCaptureExecutor* screenCaptureExecutor, const char* initStageName, + s32 scenarioNo, const char* sceneName, AudioDirector* audioDirector); + const GameSystemInfo* gameSystemInfo; GameDataHolderBase* gameDataHolder; - char field_10[8]; - char* initStageName; - u32 scenarioNo; - char filler[0x218]; + ScreenCaptureExecutor* screenCaptureExecutor; + const char* initStageName; + s32 scenarioNo; + sead::FixedSafeString<512> sceneName; AudioDirector* audioDirector; }; diff --git a/src/Scene/StageSceneStatePauseMenu.cpp b/src/Scene/StageSceneStatePauseMenu.cpp index b9114bcf0..5a54ff907 100644 --- a/src/Scene/StageSceneStatePauseMenu.cpp +++ b/src/Scene/StageSceneStatePauseMenu.cpp @@ -124,7 +124,7 @@ StageSceneStatePauseMenu::StageSceneStatePauseMenu( initNerve(&NrvStageSceneStatePauseMenu.Appear, 4); - al::GamePadSystem* gamePadSystem = sceneInitInfo.gameSysInfo->gamePadSystem; + al::GamePadSystem* gamePadSystem = sceneInitInfo.gameSystemInfo->gamePadSystem; mStateStartSeparatePlay = new StageSceneStateStartSeparatePlay( "おすそ分け開始", this, layoutInitInfo, mMenuWipe, gamePadSystem, mFooterParts); @@ -142,7 +142,7 @@ StageSceneStatePauseMenu::StageSceneStatePauseMenu( "オプション画面[ヘルプから遷移]"); rs::registerGraphicsPresetPause(getHost()); - mHtmlViewer = sceneInitInfo.gameSysInfo->htmlViewer; + mHtmlViewer = sceneInitInfo.gameSystemInfo->htmlViewer; } void StageSceneStatePauseMenu::appear() { diff --git a/src/Scene/TitleMenuScene.cpp b/src/Scene/TitleMenuScene.cpp index eeba4331e..48af20f77 100644 --- a/src/Scene/TitleMenuScene.cpp +++ b/src/Scene/TitleMenuScene.cpp @@ -104,7 +104,7 @@ void TitleMenuScene::init(const al::SceneInitInfo& info) { al::initAudioDirector3D(this, info, audioDirectorInitInfo); al::initSceneAudioKeeper(this, info, nullptr); - alAudioSystemFunction::disableAudioMaximizer(info.gameSysInfo); + alAudioSystemFunction::disableAudioMaximizer(info.gameSystemInfo); ProjectCameraPoserFactory* projectCameraPoserFactory = new ProjectCameraPoserFactory(); al::initCameraDirectorWithoutStageResource(this, projectCameraPoserFactory);