diff --git a/Runtime/CPakFile.hpp b/Runtime/CPakFile.hpp index edfbd1f6f..b8fefe4a5 100644 --- a/Runtime/CPakFile.hpp +++ b/Runtime/CPakFile.hpp @@ -77,6 +77,7 @@ public: const SResInfo* GetResInfoForLoadPreferForward(CAssetId id) const; const SResInfo* GetResInfoForLoadDirectionless(CAssetId id) const; const SResInfo* GetResInfo(CAssetId id) const; + bool IsWorldPak() const { return x28_26_worldPak; } u32 GetFakeStaticSize() const { return 0; } void AsyncIdle(); }; diff --git a/Runtime/CResLoader.hpp b/Runtime/CResLoader.hpp index f857430bb..22fb9b935 100644 --- a/Runtime/CResLoader.hpp +++ b/Runtime/CResLoader.hpp @@ -54,6 +54,7 @@ public: std::vector> GetResourceIdToNameList() const; void EnumerateResources(const std::function& lambda) const; void EnumerateNamedResources(const std::function& lambda) const; + const std::list>& GetPaks() const { return x18_pakLoadedList; } }; } diff --git a/Runtime/CStateManager.cpp b/Runtime/CStateManager.cpp index 901916758..7e45baf92 100644 --- a/Runtime/CStateManager.cpp +++ b/Runtime/CStateManager.cpp @@ -53,6 +53,7 @@ #include "World/CScriptDoor.hpp" #include "World/CScriptDamageableTrigger.hpp" #include "World/CScriptDebris.hpp" +#include "hecl/CVarManager.hpp" #include namespace urde @@ -213,6 +214,8 @@ CStateManager::CStateManager(const std::weak_ptr& relayTracker, ControlMapper::ResetCommandFilters(); x8f0_shadowTex = g_SimplePool->GetObj("DefaultShadow"); g_StateManager = this; + + hecl::CVarManager::instance()->findOrMakeCVar("stateManager.logScripting"sv, "Prints object communication to the console", false, hecl::CVar::EFlags::ReadOnly | hecl::CVar::EFlags::Archive | hecl::CVar::EFlags::Game); } CStateManager::~CStateManager() @@ -1090,10 +1093,10 @@ void CStateManager::SendScriptMsg(CEntity* dest, TUniqueId src, EScriptObjectMes { if (dest && !dest->x30_26_scriptingBlocked) { -#ifndef NDEBUG - LogModule.report(logvisor::Info, "Sending '%s' to '%s' id= 0x%.4X\n", - ScriptObjectMessageToStr(msg).data(), dest->GetName().data(), dest->GetUniqueId().id); -#endif + const hecl::CVar* logScripting = hecl::CVarManager::instance()->findCVar("stateManager.logScripting"sv); + if (logScripting && logScripting->toBoolean()) + LogModule.report(logvisor::Info, "Sending '%s' to '%s' id= 0x%.4X\n", + ScriptObjectMessageToStr(msg).data(), dest->GetName().data(), dest->GetUniqueId().id); dest->AcceptScriptMsg(msg, src, *this); } } diff --git a/Runtime/MP1/MP1.cpp b/Runtime/MP1/MP1.cpp index cfa3f936f..1349dca1e 100644 --- a/Runtime/MP1/MP1.cpp +++ b/Runtime/MP1/MP1.cpp @@ -113,8 +113,8 @@ CGameArchitectureSupport::CGameArchitectureSupport(CMain& parent, CStreamAudioManager::SetMusicVolume(0x7f); m->ResetGameState(); - //std::shared_ptr splash = std::make_shared(CSplashScreen::ESplashScreen::Nintendo); - //x58_ioWinManager.AddIOWin(splash, 1000, 10000); + std::shared_ptr splash = std::make_shared(CSplashScreen::ESplashScreen::Nintendo); + x58_ioWinManager.AddIOWin(splash, 1000, 10000); std::shared_ptr mf = std::make_shared(); x58_ioWinManager.AddIOWin(mf, 0, 0); @@ -537,6 +537,20 @@ void CMain::Teleport(hecl::Console *, const std::vector& args) g_StateManager->Player()->Teleport(xf, *g_StateManager, false); } +void CMain::ListWorlds(hecl::Console* con, const std::vector &) +{ + if (g_ResFactory && g_ResFactory->GetResLoader()) + { + for (const auto& pak : g_ResFactory->GetResLoader()->GetPaks()) + if (pak->IsWorldPak()) + { + for (const auto& named : pak->GetNameList()) + if (named.second.type == SBIG('MLVL')) + con->report(hecl::Console::Level::Info, "%s '%08X'", named.first.c_str(), named.second.id.Value()); + } + } +} + void CMain::StreamNewGameState(CBitStreamReader& r, u32 idx) { bool fusionBackup = g_GameState->SystemOptions().GetPlayerFusionSuitActive(); @@ -641,7 +655,7 @@ void CMain::Init(const hecl::Runtime::FileStoreManager& storeMgr, m_console->registerCommand("quit"sv, "Quits the game immediately"sv, ""sv, std::bind(&CMain::quit, this, std::placeholders::_1, std::placeholders::_2)); m_console->registerCommand("Give"sv, "Gives the player the specified item, maxing it out"sv, ""sv, std::bind(&CMain::Give, this, std::placeholders::_1, std::placeholders::_2), hecl::SConsoleCommand::ECommandFlags::Cheat); m_console->registerCommand("Teleport"sv, "Teleports the player to the specified coordinates in worldspace"sv, "x y z [dX dY dZ]"sv, std::bind(&CMain::Teleport, this, std::placeholders::_1, std::placeholders::_2), (hecl::SConsoleCommand::ECommandFlags::Cheat | hecl::SConsoleCommand::ECommandFlags::Developer)); - + m_console->registerCommand("listWorlds"sv, "Lists loaded worlds"sv, ""sv, std::bind(&CMain::ListWorlds, this, std::placeholders::_1, std::placeholders::_2), hecl::SConsoleCommand::ECommandFlags::Normal); InitializeSubsystems(storeMgr); x128_globalObjects.PostInitialize(); diff --git a/Runtime/MP1/MP1.hpp b/Runtime/MP1/MP1.hpp index 7ce480f99..a107b4842 100644 --- a/Runtime/MP1/MP1.hpp +++ b/Runtime/MP1/MP1.hpp @@ -333,6 +333,7 @@ public: } void Give(hecl::Console*, const std::vector&); void Teleport(hecl::Console*, const std::vector&); + void ListWorlds(hecl::Console*, const std::vector&); hecl::Console* Console() const { return m_console.get(); } }; diff --git a/hecl b/hecl index 667d4113b..01d4e0621 160000 --- a/hecl +++ b/hecl @@ -1 +1 @@ -Subproject commit 667d4113b5475de7d25abc3807ee126749f90aa9 +Subproject commit 01d4e0621e749a090d5d0bc992f529fcb714aab9