diff --git a/data/uking_functions.csv b/data/uking_functions.csv index 4f5ee19b..433e025e 100644 --- a/data/uking_functions.csv +++ b/data/uking_functions.csv @@ -88051,9 +88051,9 @@ Address,Quality,Size,Name 0x000000710109ca14,U,000008, 0x000000710109ca1c,U,000260, 0x000000710109cb20,U,000084, -0x000000710109cb74,U,000100, -0x000000710109cbd8,U,000108, -0x000000710109cc44,U,000148,Terminal::createInstance +0x000000710109cb74,O,000100,_ZN4ksys8Terminal18SingletonDisposer_D1Ev +0x000000710109cbd8,O,000108,_ZN4ksys8Terminal18SingletonDisposer_D0Ev +0x000000710109cc44,O,000148,_ZN4ksys8Terminal14createInstanceEPN4sead4HeapE 0x000000710109ccd8,U,000028, 0x000000710109ccf4,U,000020, 0x000000710109cd08,U,000004,j__ZdlPv_1175 @@ -88734,9 +88734,9 @@ Address,Quality,Size,Name 0x00000071010b9c04,U,000128,MoviePlayer::__auto1 0x00000071010b9c84,U,000024, 0x00000071010b9c9c,U,000448,MoviePlayer::__auto0 -0x00000071010b9e5c,U,000056, -0x00000071010b9e94,U,000092, -0x00000071010b9ef0,U,000384,Patrol::createInstance +0x00000071010b9e5c,O,000056,_ZN4ksys6Patrol18SingletonDisposer_D1Ev +0x00000071010b9e94,O,000092,_ZN4ksys6Patrol18SingletonDisposer_D0Ev +0x00000071010b9ef0,O,000384,_ZN4ksys6Patrol14createInstanceEPN4sead4HeapE 0x00000071010ba070,O,000056,_ZN4ksys8Revision18SingletonDisposer_D1Ev 0x00000071010ba0a8,O,000092,_ZN4ksys8Revision18SingletonDisposer_D0Ev 0x00000071010ba104,O,000164,_ZN4ksys8Revision14createInstanceEPN4sead4HeapE diff --git a/src/KingSystem/Framework/GameConfig.h b/src/KingSystem/Framework/GameConfig.h index a17d5661..1ab9f19a 100644 --- a/src/KingSystem/Framework/GameConfig.h +++ b/src/KingSystem/Framework/GameConfig.h @@ -1,9 +1,16 @@ +#pragma once + +#include + class GameConfig { public: static GameConfig* getInstance() { return sInstancePtr; } - char mPadding[0x419]; - bool mField419; + char _0[0x3dd]; + bool _3dd; + char _3de[0x3b]; + bool _419; + sead::SafeString mPatrolFeatures; private: static GameConfig* sInstancePtr; diff --git a/src/KingSystem/System/CMakeLists.txt b/src/KingSystem/System/CMakeLists.txt index 447ca96f..bfc41efe 100644 --- a/src/KingSystem/System/CMakeLists.txt +++ b/src/KingSystem/System/CMakeLists.txt @@ -48,6 +48,8 @@ target_sources(uking PRIVATE SystemPauseMgr.h SystemTimers.cpp SystemTimers.h + Terminal.cpp + Terminal.h Timer.cpp Timer.h UIGlue.cpp diff --git a/src/KingSystem/System/Patrol.cpp b/src/KingSystem/System/Patrol.cpp index 75e53224..c7fc3be4 100644 --- a/src/KingSystem/System/Patrol.cpp +++ b/src/KingSystem/System/Patrol.cpp @@ -1,7 +1,20 @@ #include "KingSystem/System/Patrol.h" +#include +#include "KingSystem/Framework/GameConfig.h" namespace ksys { SEAD_SINGLETON_DISPOSER_IMPL(Patrol) +Patrol::Patrol() { + mField0 = GameConfig::getInstance()->_3dd; + + mHasAutoPlay = GameConfig::getInstance()->mPatrolFeatures.include("オートプレイ"); + mHasAutoGenPatroller = GameConfig::getInstance()->mPatrolFeatures.include("AutoGenPatroller"); + mLoadStaticPhysUnstableMapUnit = false; + + mList.initOffset(8); + sead::EnvUtil::getEnvironmentVariable(&mBuildURL, "BUILD_URL"); +} + } // namespace ksys diff --git a/src/KingSystem/System/Patrol.h b/src/KingSystem/System/Patrol.h index a45fb16d..540480f8 100644 --- a/src/KingSystem/System/Patrol.h +++ b/src/KingSystem/System/Patrol.h @@ -1,6 +1,6 @@ #pragma once -#include +#include #include #include #include "KingSystem/Utils/Types.h" @@ -10,16 +10,19 @@ namespace ksys { class Patrol { SEAD_SINGLETON_DISPOSER(Patrol) -public: - Patrol() = default; + Patrol(); ~Patrol() = default; - u8 _0[0x3 - 0x0]; +public: + // FIXME + bool mField0; + bool mHasAutoPlay; + bool mHasAutoGenPatroller; bool mLoadStaticPhysUnstableMapUnit; sead::FixedSafeString<0x100> mBuildURL; - sead::ListNode _140; - u32 _150; - u32 _154; + // FIXME: Unknown template type + sead::OffsetList mList; }; KSYS_CHECK_SIZE_NX150(Patrol, 0x158); + } // namespace ksys diff --git a/src/KingSystem/System/StarterPackMgr.cpp b/src/KingSystem/System/StarterPackMgr.cpp index c0ede3a0..2948f05a 100644 --- a/src/KingSystem/System/StarterPackMgr.cpp +++ b/src/KingSystem/System/StarterPackMgr.cpp @@ -35,7 +35,7 @@ void StarterPackMgr::registerPackFactoryAndMakeOverlayArena(bool reduced_heap_si } void StarterPackMgr::deleteArenaAndHeapAndUnregisterFactory() { - if (!GameConfig::getInstance()->mField419) { + if (!GameConfig::getInstance()->_419) { if (mOverlayArena) { delete mOverlayArena; mOverlayArena = nullptr; @@ -49,7 +49,7 @@ void StarterPackMgr::deleteArenaAndHeapAndUnregisterFactory() { } void StarterPackMgr::loadBootupGraphicsPack() { - if (!GameConfig::getInstance()->mField419) { + if (!GameConfig::getInstance()->_419) { sead::SafeString extension = ".pack"; res::registerPackExtension(true, extension); @@ -64,7 +64,7 @@ void StarterPackMgr::loadBootupGraphicsPack() { } void StarterPackMgr::loadBootupPacks() { - if (!GameConfig::getInstance()->mField419) { + if (!GameConfig::getInstance()->_419) { sead::SafeString extension = ".pack"; res::registerPackExtension(true, extension); @@ -83,7 +83,7 @@ void StarterPackMgr::loadBootupPacks() { } void StarterPackMgr::loadTitlePack() { - if (!GameConfig::getInstance()->mField419) { + if (!GameConfig::getInstance()->_419) { sead::SafeString extension = ".pack"; res::registerPackExtension(true, extension); @@ -98,7 +98,7 @@ void StarterPackMgr::loadTitlePack() { } void StarterPackMgr::loadTitleBGPacks() { - if (!GameConfig::getInstance()->mField419) { + if (!GameConfig::getInstance()->_419) { sead::SafeString extension = ".pack"; res::registerPackExtension(true, extension); @@ -122,18 +122,18 @@ void StarterPackMgr::loadAocMainFieldPack() { } void StarterPackMgr::unloadBootupGraphicsPack() { - if (!GameConfig::getInstance()->mField419) { + if (!GameConfig::getInstance()->_419) { res::setResourceMgrPack(nullptr); mBootupGfxPack.requestUnload(); } } bool StarterPackMgr::bootupGraphicsPackReady() { - return GameConfig::getInstance()->mField419 || mBootupGfxPack.isReadyOrNeedsParse(); + return GameConfig::getInstance()->_419 || mBootupGfxPack.isReadyOrNeedsParse(); } void StarterPackMgr::setPackToBootupGraphics() { - if (!GameConfig::getInstance()->mField419) { + if (!GameConfig::getInstance()->_419) { mBootupGfxPack.parseResource(nullptr); res::registerPackExtension(false, ""); res::setResourceMgrPack(&mBootupGfxPack); @@ -141,7 +141,7 @@ void StarterPackMgr::setPackToBootupGraphics() { } void StarterPackMgr::unloadBootupAndBootupLangPack() { - if (!GameConfig::getInstance()->mField419) { + if (!GameConfig::getInstance()->_419) { res::setResourceMgrPack(nullptr); mBootupPack.requestUnload(); mBootupLangPack.requestUnload(); @@ -149,12 +149,12 @@ void StarterPackMgr::unloadBootupAndBootupLangPack() { } bool StarterPackMgr::bootupPacksReady() { - return GameConfig::getInstance()->mField419 || + return GameConfig::getInstance()->_419 || (mBootupPack.isReadyOrNeedsParse() && mBootupLangPack.isReadyOrNeedsParse()); } void StarterPackMgr::setPackToBootupPack() { - if (!GameConfig::getInstance()->mField419) { + if (!GameConfig::getInstance()->_419) { mBootupPack.parseResource(nullptr); mBootupLangPack.parseResource(nullptr); res::registerPackExtension(false, ""); @@ -163,22 +163,22 @@ void StarterPackMgr::setPackToBootupPack() { } void StarterPackMgr::unloadTitlePack() { - if (!GameConfig::getInstance()->mField419) { + if (!GameConfig::getInstance()->_419) { res::setResourceMgrPack(nullptr); mTitlePack.requestUnload(); } } bool StarterPackMgr::isTitlePackReady() { - return GameConfig::getInstance()->mField419 || mTitlePack.isReadyOrNeedsParse(); + return GameConfig::getInstance()->_419 || mTitlePack.isReadyOrNeedsParse(); } bool StarterPackMgr::isTitlePackK() { - return GameConfig::getInstance()->mField419 || mTitlePack.hasParsedResource(); + return GameConfig::getInstance()->_419 || mTitlePack.hasParsedResource(); } void StarterPackMgr::setPackToTitlePack() { - if (!GameConfig::getInstance()->mField419) { + if (!GameConfig::getInstance()->_419) { mTitlePack.parseResource(nullptr); res::registerPackExtension(false, ""); res::setResourceMgrPack(&mTitlePack); @@ -186,7 +186,7 @@ void StarterPackMgr::setPackToTitlePack() { } void StarterPackMgr::setPackToTitleBGPack() { - if (!GameConfig::getInstance()->mField419) { + if (!GameConfig::getInstance()->_419) { mTitleBGPack.waitForReady(); mTitleBGPack.parseResource(nullptr); mTitleBGLangPack.waitForReady(); @@ -202,7 +202,7 @@ void StarterPackMgr::setPackToTitleBGPack() { } void StarterPackMgr::unloadTitleBGAndAocMainFieldPacksAndStuff() { - if (!GameConfig::getInstance()->mField419) { + if (!GameConfig::getInstance()->_419) { res::setResourceMgrPack(nullptr); mTitleBGPack.requestUnload(); mTitleBGLangPack.requestUnload(); diff --git a/src/KingSystem/System/Terminal.cpp b/src/KingSystem/System/Terminal.cpp new file mode 100644 index 00000000..aa670e79 --- /dev/null +++ b/src/KingSystem/System/Terminal.cpp @@ -0,0 +1,7 @@ +#include "KingSystem/System/Terminal.h" + +namespace ksys { + +SEAD_SINGLETON_DISPOSER_IMPL(Terminal) + +} // namespace ksys diff --git a/src/KingSystem/System/Terminal.h b/src/KingSystem/System/Terminal.h new file mode 100644 index 00000000..43b7fcad --- /dev/null +++ b/src/KingSystem/System/Terminal.h @@ -0,0 +1,20 @@ +#pragma once + +#include +#include +#include "KingSystem/Utils/Types.h" + +namespace ksys { + +class Terminal : public sead::hostio::Node { + SEAD_SINGLETON_DISPOSER(Terminal) + + Terminal() = default; + virtual ~Terminal() = default; + +public: + u32 mFlag = 0; +}; +KSYS_CHECK_SIZE_NX150(Terminal, 0x30); + +} // namespace ksys