@@ -227,16 +227,10 @@ void CheckAndCreateModFolder() {
227227}
228228
229229void GameEngine::LoadResourceFiles () {
230- std::unordered_map<std::string, std::string> defines = {
231- { " VERSION_US" , " 1" },
232- { " ENABLE_RUMBLE" , " 1" },
233- { " F3D_OLD" , " 1" },
234- { " F3D_GBI" , " 1" },
235- { " GBI_FLOATS" , " 1" },
236- { " _LANGUAGE_C" , " 1" },
237- { " _USE_MATH_DEFINES" , " 1" },
238- { " AVOID_UB" , " 1" }
239- };
230+ std::unordered_map<std::string, std::string> defines = { { " VERSION_US" , " 1" }, { " ENABLE_RUMBLE" , " 1" },
231+ { " F3D_OLD" , " 1" }, { " F3D_GBI" , " 1" },
232+ { " GBI_FLOATS" , " 1" }, { " _LANGUAGE_C" , " 1" },
233+ { " _USE_MATH_DEFINES" , " 1" }, { " AVOID_UB" , " 1" } };
240234
241235 context->InitScriptSystem (defines, 1 );
242236
@@ -306,16 +300,10 @@ void GameEngine::FinishInit() {
306300 context->InitGfxDebugger ();
307301 context->InitFileDropMgr ();
308302 context->InitCrashHandler ();
309- std::unordered_map<std::string, std::string> defines = {
310- { " VERSION_US" , " 1" },
311- { " ENABLE_RUMBLE" , " 1" },
312- { " F3D_OLD" , " 1" },
313- { " F3D_GBI" , " 1" },
314- { " GBI_FLOATS" , " 1" },
315- { " _LANGUAGE_C" , " 1" },
316- { " _USE_MATH_DEFINES" , " 1" },
317- { " AVOID_UB" , " 1" }
318- };
303+ std::unordered_map<std::string, std::string> defines = { { " VERSION_US" , " 1" }, { " ENABLE_RUMBLE" , " 1" },
304+ { " F3D_OLD" , " 1" }, { " F3D_GBI" , " 1" },
305+ { " GBI_FLOATS" , " 1" }, { " _LANGUAGE_C" , " 1" },
306+ { " _USE_MATH_DEFINES" , " 1" }, { " AVOID_UB" , " 1" } };
319307
320308 context->InitScriptSystem (defines, 1 );
321309
@@ -353,9 +341,8 @@ void GameEngine::FinishInit() {
353341 loader->RegisterResourceFactory (std::make_shared<Fast::ResourceFactoryBinaryDisplayListV0>(),
354342 RESOURCE_FORMAT_BINARY , " DisplayList" ,
355343 static_cast <uint32_t >(Fast::ResourceType::DisplayList), 0 );
356- loader->RegisterResourceFactory (std::make_shared<Fast::ResourceFactoryXMLDisplayListV0>(),
357- RESOURCE_FORMAT_XML , " DisplayList" ,
358- static_cast <uint32_t >(Fast::ResourceType::DisplayList), 0 );
344+ loader->RegisterResourceFactory (std::make_shared<Fast::ResourceFactoryXMLDisplayListV0>(), RESOURCE_FORMAT_XML ,
345+ " DisplayList" , static_cast <uint32_t >(Fast::ResourceType::DisplayList), 0 );
359346 loader->RegisterResourceFactory (std::make_shared<Fast::ResourceFactoryBinaryMatrixV0>(), RESOURCE_FORMAT_BINARY ,
360347 " Matrix" , static_cast <uint32_t >(Fast::ResourceType::Matrix), 0 );
361348 loader->RegisterResourceFactory (std::make_shared<Fast::ResourceFactoryBinaryLightV0>(), RESOURCE_FORMAT_BINARY ,
@@ -741,9 +728,7 @@ void GameEngine::RunExtract(int argc, char* argv[]) {
741728 auto & info = archive->GetManifest ();
742729 file = info.Name ;
743730 };
744- auto post = [&]() {
745- compileCount++;
746- };
731+ auto post = [&]() { compileCount++; };
747732 scripting->CompileAll (pre , post );
748733 extractDone = true ;
749734 });
@@ -800,11 +785,11 @@ void GameEngine::RunExtract(int argc, char* argv[]) {
800785 ImGui::PopStyleVar (2 );
801786 }
802787
803- if (totalScripts > 0 && !ImGui::IsPopupOpen (" Ghostship" )) {
788+ if (totalScripts > 0 && !ImGui::IsPopupOpen (" Ghostship" )) {
804789 ImGui::OpenPopup (" Ghostship" );
805790 }
806791
807- if (totalScripts > 0 ) {
792+ if (totalScripts > 0 ) {
808793 ImGui::PushStyleVar (ImGuiStyleVar_FrameRounding, 3 .0f );
809794 ImGui::PushStyleVar (ImGuiStyleVar_FramePadding, ImVec2 (10 .0f , 8 .0f ));
810795 auto color = UIWidgets::ColorValues.at (THEME_COLOR );
@@ -816,8 +801,7 @@ void GameEngine::RunExtract(int argc, char* argv[]) {
816801 ImGuiWindowFlags_NoMove | ImGuiWindowFlags_NoScrollbar |
817802 ImGuiWindowFlags_NoSavedSettings)) {
818803 float progress = (totalScripts > 0 .0f ? (float )compileCount / (float )totalScripts : 0 ) * 100 .0f ;
819- ImGui::Text (" Loading %s...%s" , file.c_str (),
820- roundf (progress) == 100 .0f ? " Done. Finishing up." : " " );
804+ ImGui::Text (" Loading %s...%s" , file.c_str (), roundf (progress) == 100 .0f ? " Done. Finishing up." : " " );
821805 std::string overlay = compileCount > 0 ? fmt::format (" {:.0f}%" , progress) : " Starting Up" ;
822806 ImGui::ProgressBar (progress / 100 .0f , ImVec2 (600 .0f , 50 .0f ), overlay.c_str ());
823807 ImGui::EndPopup ();
@@ -896,7 +880,8 @@ void GameEngine::ScaleImGui() {
896880
897881void GameEngine::LoadScripts () {
898882 auto scripting = Ship::Context::GetInstance ()->GetScriptSystem ();
899- Notification::Emit ({ .message = " Loading mods this may take a while..." , .remainingTime = (totalScripts * 5 .0f ), .mute = true });
883+ Notification::Emit (
884+ { .message = " Loading mods this may take a while..." , .remainingTime = (totalScripts * 5 .0f ), .mute = true });
900885 static std::shared_ptr<BS ::thread_pool> mThreadPool = std::make_shared<BS ::thread_pool>(1 );
901886 mThreadPool ->submit_task ([&]() -> void {
902887 auto currentScriptName = std::make_shared<std::string>(" " );
@@ -906,18 +891,21 @@ void GameEngine::LoadScripts() {
906891 notification->remainingTime = 7 .0f ;
907892 try {
908893 scripting->CompileAll ([&](const std::shared_ptr<Ship::Archive>& archive) {
909- if (!archive) return ;
894+ if (!archive)
895+ return ;
910896
911897 auto & info = archive->GetManifest ();
912898 *currentScriptName = info.Name ;
913899 int scriptNum = ++(*currentScript);
914900
915- notification->message = fmt::format (" Loading {} ({}/{})" , *currentScriptName, scriptNum, this ->totalScripts );
901+ notification->message =
902+ fmt::format (" Loading {} ({}/{})" , *currentScriptName, scriptNum, this ->totalScripts );
916903
917904 Notification::Emit (*notification);
918905 });
919906 } catch (std::exception& e) {
920- notification->message = fmt::format (" Failed to build {} ({}/{})" , *currentScriptName, (*currentScript + 1 ), this ->totalScripts );
907+ notification->message =
908+ fmt::format (" Failed to build {} ({}/{})" , *currentScriptName, (*currentScript + 1 ), this ->totalScripts );
921909 SPDLOG_ERROR (" Failed to build script {}: {}" , *currentScriptName, e.what ());
922910 Notification::Emit (*notification);
923911 }
@@ -928,8 +916,9 @@ void GameEngine::LoadScripts() {
928916 } catch (std::exception& e) {
929917 SPDLOG_ERROR (" Failed to load scripts: {}" , e.what ());
930918 Notification::Emit ({ .message = " Failed to load some mods, check logs for details." ,
931- .messageColor = ImVec4 (1 .0f , 0 .5f , 0 .5f , 1 .0f ),
932- .remainingTime = 5 .0f , .mute = true });
919+ .messageColor = ImVec4 (1 .0f , 0 .5f , 0 .5f , 1 .0f ),
920+ .remainingTime = 5 .0f ,
921+ .mute = true });
933922 }
934923 });
935924}
0 commit comments