From 354c5f081a11da3d8adba06b0d810d89bd68bdb9 Mon Sep 17 00:00:00 2001 From: louist103 <35883445+louist103@users.noreply.github.com> Date: Sat, 21 Jun 2025 16:40:51 -0400 Subject: [PATCH] Cleanups and use a thread for message box --- soh/soh/Extractor/Extract.cpp | 16 +++++++++++----- soh/src/code/z_skelanime.c | 14 ++------------ 2 files changed, 13 insertions(+), 17 deletions(-) diff --git a/soh/soh/Extractor/Extract.cpp b/soh/soh/Extractor/Extract.cpp index d3ffd9e18..a12be6264 100644 --- a/soh/soh/Extractor/Extract.cpp +++ b/soh/soh/Extractor/Extract.cpp @@ -607,6 +607,7 @@ std::string Extractor::Mkdtemp() { } extern "C" int zapd_main(int argc, char** argv); +static void MessageboxWorker(); bool Extractor::CallZapd(std::string installPath, std::string exportdir) { constexpr int argc = 22; @@ -669,10 +670,8 @@ bool Extractor::CallZapd(std::string installPath, std::string exportdir) { SetWindowPos(cmdWindow, HWND_NOTOPMOST, 0, 0, 0, 0, SWP_NOSIZE | SWP_NOMOVE); #else // Show extraction in background message until linux/mac can have visual progress - SDL_ShowSimpleMessageBox(SDL_MESSAGEBOX_INFORMATION, "Extracting", - "Extraction will now begin in the background.\n\nPlease be patient for the process to " - "finish. Do not close the main program.", - nullptr); + std::thread mbThread(MessageboxWorker); + mbThread.detach(); #endif zapd_main(argc, (char**)argv.data()); @@ -688,5 +687,12 @@ bool Extractor::CallZapd(std::string installPath, std::string exportdir) { std::filesystem::current_path(curdir); std::filesystem::remove_all(tempdir); - return 0; + return false; +} + +static void MessageboxWorker() { + SDL_ShowSimpleMessageBox(SDL_MESSAGEBOX_INFORMATION, "Extracting", + "Extraction will now begin in the background.\n\nPlease be patient for the process to " + "finish. Do not close the main program.", + nullptr); } diff --git a/soh/src/code/z_skelanime.c b/soh/src/code/z_skelanime.c index eed6da8b5..a7e93e8c3 100644 --- a/soh/src/code/z_skelanime.c +++ b/soh/src/code/z_skelanime.c @@ -894,20 +894,10 @@ void AnimationContext_SetLoadFrame(PlayState* play, LinkAnimationHeader* animati if (ResourceMgr_OTRSigCheck(animation) != 0) animation = ResourceMgr_LoadAnimByName(animation); - LinkAnimationHeader* playerAnimHeader = animation; Vec3s* ram = frameTable; - // osCreateMesgQueue(&entry->data.load.msgQueue, &entry->data.load.msg, 1); - // - // char animPath[2048]; - // - // snprintf(animPath, sizeof(animPath), "misc/link_animetion/gPlayerAnimData_%06X", - // (((uintptr_t)linkAnimHeader->segmentVoid - 0x07000000))); - // - // printf("Streaming %s, seg = %08X\n", animPath, linkAnimHeader->segment); - - s16* animData = /* ResourceMgr_LoadPlayerAnimByName*/ (animation->segment); - // 2S2H [Port] sometimes a HESS can set a negative frame value from a negative playback speed. When converted to + s16* animData = animation->segment; + // SOH [Port] sometimes a HESS can set a negative frame value from a negative playback speed. When converted to // a signed value this will cause a crash due to copying way much data. if (frame < 0) { frame = 0;