From c4d0189175f9791fbe7e1c663810f973551834a3 Mon Sep 17 00:00:00 2001 From: PJB3005 Date: Fri, 27 Mar 2026 17:34:05 +0100 Subject: [PATCH 1/7] Fix map loader gameRegions literally being 2.7 MiB of recursive arrays Just moving it to std::vector, easy enough. --- include/dusk/map_loader_definitions.h | 46 ++++++++++----------------- src/dusk/imgui/ImGuiMapLoader.cpp | 14 ++++---- 2 files changed, 24 insertions(+), 36 deletions(-) diff --git a/include/dusk/map_loader_definitions.h b/include/dusk/map_loader_definitions.h index c2c9e4fedb..31dfef7157 100644 --- a/include/dusk/map_loader_definitions.h +++ b/include/dusk/map_loader_definitions.h @@ -1,79 +1,67 @@ #pragma once struct RoomEntry { - static constexpr int MAX_POINTS = 70; - u8 roomNo; - s16 roomPoints[MAX_POINTS] = {}; - int numPoints; + std::vector roomPoints = {}; - constexpr RoomEntry() : roomNo(0), numPoints(0) {} + constexpr RoomEntry() : roomNo(0) {} constexpr RoomEntry(const RoomEntry& other) = default; template constexpr RoomEntry(const u8 roomNo, const s16 (&points)[N]) : - roomNo(roomNo), numPoints(N) { - static_assert(N <= MAX_POINTS); + roomNo(roomNo) { for (int i = 0; i < N; i++) { - roomPoints[i] = points[i]; + roomPoints.push_back(points[i]); } } constexpr RoomEntry(const u8 roomNo) : - roomNo(roomNo), numPoints(1) { - roomPoints[0] = 0; + roomNo(roomNo) { + roomPoints.push_back(0); } }; struct MapEntry { - static constexpr int MAX_ROOMS = 50; - const char* mapName; const char* mapFile; - RoomEntry mapRooms[MAX_ROOMS] = {}; - int numRooms; + std::vector mapRooms = {}; - constexpr MapEntry() : mapName(nullptr), mapFile(nullptr), numRooms(0) {} + constexpr MapEntry() : mapName(nullptr), mapFile(nullptr) {} constexpr MapEntry(const MapEntry& other) = default; template constexpr MapEntry(const char* mapName, const char* mapFile, const RoomEntry (&rooms)[N], const char*) : mapName(mapName), - mapFile(mapFile), numRooms(N) { - static_assert(N <= MAX_ROOMS); + mapFile(mapFile) { for (int i = 0; i < N; i++) { - mapRooms[i] = rooms[i]; + mapRooms.push_back(rooms[i]); } } template constexpr MapEntry(const char* mapName, const char* mapFile, const RoomEntry (&rooms)[N]) : - mapName(mapName), mapFile(mapFile), numRooms(N) { - static_assert(N <= MAX_ROOMS); + mapName(mapName), mapFile(mapFile) { for (int i = 0; i < N; i++) { - mapRooms[i] = rooms[i]; + mapRooms.push_back(rooms[i]); } } constexpr MapEntry(const char* mapName, const char* mapFile) : mapName(mapName), - mapFile(mapFile), numRooms(0) {} + mapFile(mapFile) {} }; struct RegionEntry { - static constexpr int MAX_MAPS = 22; const char* regionName = nullptr; - int numMaps = 0; - MapEntry maps[MAX_MAPS] = {}; + std::vector maps = {}; template - constexpr RegionEntry(const char* regionName, const MapEntry (&maps)[N]) : regionName(regionName), numMaps(N) { - static_assert(N <= MAX_MAPS); + constexpr RegionEntry(const char* regionName, const MapEntry (&maps)[N]) : regionName(regionName) { for (int i = 0; i < N; i++) { - this->maps[i] = maps[i]; + this->maps.push_back(maps[i]); } } }; -constexpr auto gameRegions = std::to_array({ +static const auto gameRegions = std::to_array({ RegionEntry("Hyrule Field", { MapEntry("Hyrule Field", "F_SP121", { diff --git a/src/dusk/imgui/ImGuiMapLoader.cpp b/src/dusk/imgui/ImGuiMapLoader.cpp index 44b1b7c583..89ab6aa120 100644 --- a/src/dusk/imgui/ImGuiMapLoader.cpp +++ b/src/dusk/imgui/ImGuiMapLoader.cpp @@ -57,7 +57,7 @@ namespace dusk { if (ImGui::BeginCombo("Select Map", previewMap.data())) { int prevMapIdx = m_mapLoaderInfo.mapIdx; - for (int i = 0; i < region.numMaps; ++i) { + for (int i = 0; i < region.maps.size(); ++i) { const auto& map = region.maps[i]; std::string label = m_mapLoaderInfo.showInternalNames ? fmt::format("{} ({})", map.mapName, map.mapFile) : map.mapName; if (ImGui::Selectable(label.data())) { @@ -79,20 +79,20 @@ namespace dusk { const auto& map = region.maps[m_mapLoaderInfo.mapIdx]; const auto& room = map.mapRooms[m_mapLoaderInfo.roomNoIdx]; - if (map.numRooms > 1) { + if (map.mapRooms.size() > 1) { ImGui::Text("Selected Room: %2d", room.roomNo); ImGui::SameLine(); if (ImGui::Button("-###RoomNoIdxDec")) { m_mapLoaderInfo.roomNoIdx--; if (m_mapLoaderInfo.roomNoIdx < 0) { - m_mapLoaderInfo.roomNoIdx = map.numRooms - 1; + m_mapLoaderInfo.roomNoIdx = map.mapRooms.size() - 1; } m_mapLoaderInfo.pointNoIdx = 0; } ImGui::SameLine(); if (ImGui::Button("+###RoomNoIdxInc")) { m_mapLoaderInfo.roomNoIdx++; - if (m_mapLoaderInfo.roomNoIdx >= map.numRooms) { + if (m_mapLoaderInfo.roomNoIdx >= map.mapRooms.size()) { m_mapLoaderInfo.roomNoIdx = 0; } m_mapLoaderInfo.pointNoIdx = 0; @@ -117,19 +117,19 @@ namespace dusk { } } - if (room.numPoints > 1) { + if (room.roomPoints.size() > 1) { ImGui::Text("Selected Point: %3d", room.roomPoints[m_mapLoaderInfo.pointNoIdx]); ImGui::SameLine(); if (ImGui::Button("-###PointNoIdxDec")) { m_mapLoaderInfo.pointNoIdx--; if (m_mapLoaderInfo.pointNoIdx < 0) { - m_mapLoaderInfo.pointNoIdx = room.numPoints - 1; + m_mapLoaderInfo.pointNoIdx = room.roomPoints.size() - 1; } } ImGui::SameLine(); if (ImGui::Button("+###PointNoIdxInc")) { m_mapLoaderInfo.pointNoIdx++; - if (m_mapLoaderInfo.pointNoIdx >= room.numPoints) { + if (m_mapLoaderInfo.pointNoIdx >= room.roomPoints.size()) { m_mapLoaderInfo.pointNoIdx = 0; } } From 0b05eac79f2ad84829cab700f17fc77f0938875f Mon Sep 17 00:00:00 2001 From: Irastris Date: Fri, 27 Mar 2026 23:28:24 -0400 Subject: [PATCH 2/7] Fix MSVC RelWithDebInfo/Release compilation after upstream merge --- libs/JSystem/src/JAHostIO/JAHioNode.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/libs/JSystem/src/JAHostIO/JAHioNode.cpp b/libs/JSystem/src/JAHostIO/JAHioNode.cpp index 66c9431a41..9a30991e4f 100644 --- a/libs/JSystem/src/JAHostIO/JAHioNode.cpp +++ b/libs/JSystem/src/JAHostIO/JAHioNode.cpp @@ -101,7 +101,9 @@ JAHioNode* JAHioNode::getParent() { void JAHioNode::listenPropertyEvent(const JORPropertyEvent* event) { propertyEvent(JAH_P_EVENT0, (uintptr_t)event->id); +#if DEBUG JORReflexible::listenPropertyEvent(event); +#endif propertyEvent(JAH_P_EVENT1, (uintptr_t)event->id); } From d63ffe6030ebaed512477a3dbbde176392e3e29d Mon Sep 17 00:00:00 2001 From: Max Roncace Date: Fri, 27 Mar 2026 23:50:31 -0400 Subject: [PATCH 3/7] Fix Clang compiler error due to CRASH macro --- include/global.h | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/include/global.h b/include/global.h index 3720586ae3..bb30611486 100644 --- a/include/global.h +++ b/include/global.h @@ -218,7 +218,6 @@ using std::isnan; #define IS_REF_NONNULL(r) (1) #endif -#define CRASH(msg) OSPanic(__FILE__, __LINE__, "%s", msg) -#define CRASHF(msg, ...) OSPanic(__FILE__, __LINE__, msg, __VA_ARGS__) +#define CRASH(msg, ...) OSPanic(__FILE__, __LINE__, "%s", msg, ##__VA_ARGS__) #endif From ce12d168f0a27be52264b55f247b26e1ce707eec Mon Sep 17 00:00:00 2001 From: CraftyBoss Date: Sat, 28 Mar 2026 00:56:10 -0400 Subject: [PATCH 4/7] Fix uninitialized field causing occasional crash in d_camera::lockonCamera, fix wolf howling scissors --- src/d/d_camera.cpp | 11 ++++++++++- src/d/d_msg_scrn_howl.cpp | 29 ++++++++++++++++++++++++++++- 2 files changed, 38 insertions(+), 2 deletions(-) diff --git a/src/d/d_camera.cpp b/src/d/d_camera.cpp index ad12a4b773..ce2c7c169a 100644 --- a/src/d/d_camera.cpp +++ b/src/d/d_camera.cpp @@ -4846,6 +4846,15 @@ bool dCamera_c::lockonCamera(s32 param_0) { } } +#if TARGET_PC + f32 sp194 = 1.0f; + if (mCurCamStyleTimer < lockon_change_timer && !lockon->field_0x2a) { + sp194 = dCamMath::rationalBezierRatio((f32)mCurCamStyleTimer / lockon_change_timer, 0.5f); + ang2 *= sp194; + } else if (mCurCamStyleTimer >= lockon_change_timer) { + lockon->field_0x2a = true; + } +#else f32 sp194; if (mCurCamStyleTimer < lockon_change_timer && !lockon->field_0x2a) { sp194 = dCamMath::rationalBezierRatio((f32)mCurCamStyleTimer / lockon_change_timer, 0.5f); @@ -4854,7 +4863,7 @@ bool dCamera_c::lockonCamera(s32 param_0) { lockon->field_0x2a = true; sp194 = 1.0f; } - +#endif cSAngle ang3(mViewCache.mDirection.U().Inv() - ang1); if (mCurCamStyleTimer != 0 && mCurCamStyleTimer < lockon_change_timer) { diff --git a/src/d/d_msg_scrn_howl.cpp b/src/d/d_msg_scrn_howl.cpp index 07018b376d..965bd25075 100644 --- a/src/d/d_msg_scrn_howl.cpp +++ b/src/d/d_msg_scrn_howl.cpp @@ -475,6 +475,10 @@ void dMsgScrnHowl_c::drawWave() { s32 local_94 = 0; Vec fVar12 = field_0x128; Vec this_02 = field_0x140; +#if TARGET_PC // TODO: make this actually use the scissor + f32 fVar1 = 1; + f32 fVar2 = 1; +#else f32 fVar1 = mDoGph_gInf_c::getWidthF() / FB_WIDTH; f32 fVar2 = mDoGph_gInf_c::getHeightF() / FB_HEIGHT; grafContext->scissor( @@ -484,6 +488,8 @@ void dMsgScrnHowl_c::drawWave() { 32.0f + ((this_02.y - fVar12.y) + 2.0f) ); grafContext->setScissor(); +#endif + bool bVar5 = true; if (field_0x2798 == 0) { if (mPlotTime != field_0x212c) { @@ -578,10 +584,17 @@ void dMsgScrnHowl_c::drawGuide() { J2DGrafContext* grafContext = dComIfGp_getCurrentGrafPort(); Vec local_b0 = field_0x128; Vec local_bc = field_0x140; +#if TARGET_PC + grafContext->scissor( + (local_b0.x - mDoGph_gInf_c::getMinXF()) / (mDoGph_gInf_c::getWidthF() / mDoGph_gInf_c::getWidth()), + field_0x2118, (local_bc.x - local_b0.x) / (mDoGph_gInf_c::getWidthF() / mDoGph_gInf_c::getWidth()), + field_0x2120); +#else grafContext->scissor( (local_b0.x - mDoGph_gInf_c::getMinXF()) / (mDoGph_gInf_c::getWidthF() / FB_WIDTH), field_0x2118, (local_bc.x - local_b0.x) / (mDoGph_gInf_c::getWidthF() / FB_WIDTH), field_0x2120); +#endif grafContext->setScissor(); f32 local_cc = mpLineH[0]->getGlobalPosX(); s16 sVar12 = 0; @@ -709,11 +722,19 @@ void dMsgScrnHowl_c::drawGuide2() { } Vec local_58 = field_0x128; Vec local_64 = field_0x140; - f32 local_70 = mDoGph_gInf_c::getHeightF() / FB_HEIGHT; +#if TARGET_PC + f32 local_70 = mDoGph_gInf_c::getHeightF() / mDoGph_gInf_c::getHeight(); + grafContext->scissor( + (local_58.x - mDoGph_gInf_c::getMinXF()) / (mDoGph_gInf_c::getWidthF() / mDoGph_gInf_c::getWidth()), + field_0x2118, (local_64.x - local_58.x) / (mDoGph_gInf_c::getWidthF() / mDoGph_gInf_c::getWidth()), + field_0x2120); +#else + f32 local_70 = mDoGph_gInf_c::getHeightF() / mDoGph_gInf_c::getHeight(); grafContext->scissor( (local_58.x - mDoGph_gInf_c::getMinXF()) / (mDoGph_gInf_c::getWidthF() / FB_WIDTH), field_0x2118, (local_64.x - local_58.x) / (mDoGph_gInf_c::getWidthF() / FB_WIDTH), field_0x2120); +#endif grafContext->setScissor(); f32 local_74 = mpLineH[0]->getGlobalPosX(); s16 local_134 = 0; @@ -815,9 +836,15 @@ void dMsgScrnHowl_c::drawEffect() { Vec vec1 = field_0x128; Vec vec2 = field_0x140; mDoGph_gInf_c::getHeightF(); +#if TARGET_PC + grafContext->scissor( + (vec1.x - mDoGph_gInf_c::getMinXF()) / (mDoGph_gInf_c::getWidthF() / mDoGph_gInf_c::getWidth()), field_0x2118, + 12.0f + ((vec2.x - vec1.x) / (mDoGph_gInf_c::getWidthF() / mDoGph_gInf_c::getWidth())), field_0x2120); +#else grafContext->scissor( (vec1.x - mDoGph_gInf_c::getMinXF()) / (mDoGph_gInf_c::getWidthF() / FB_WIDTH), field_0x2118, 12.0f + ((vec2.x - vec1.x) / (mDoGph_gInf_c::getWidthF() / FB_WIDTH)), field_0x2120); +#endif grafContext->setScissor(); u8 timer = daAlink_getAlinkActorClass()->getWolfHowlMgrP()->getReleaseTimer(); u8 screenAlpha = mpScreen->search(MULTI_CHAR('line00'))->getAlpha(); From 8cb91016d932596ab3058e4f78c9808527ed2bd2 Mon Sep 17 00:00:00 2001 From: CraftyBoss Date: Sat, 28 Mar 2026 10:47:55 -0400 Subject: [PATCH 5/7] increase d_a_coach_2D heap size --- src/d/actor/d_a_coach_2D.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/d/actor/d_a_coach_2D.cpp b/src/d/actor/d_a_coach_2D.cpp index 7c53aa1f10..eab333cb8b 100644 --- a/src/d/actor/d_a_coach_2D.cpp +++ b/src/d/actor/d_a_coach_2D.cpp @@ -14,6 +14,8 @@ #include "JSystem/J2DGraph/J2DAnmLoader.h" #include +#include "dusk/memory.h" + class daCoach2D_HIO_c : public mDoHIO_entry_c { public: struct Param { @@ -153,7 +155,7 @@ int daCoach2D_c::createHeap() { int daCoach2D_c::create() { int phase_state = dComIfG_resLoad(this, l_arcName); if (phase_state == cPhs_COMPLEATE_e) { - if (!fopAcM_entrySolidHeap(this, daCoach2D_createHeap, 0x5050)) { + if (!fopAcM_entrySolidHeap(this, daCoach2D_createHeap, HEAP_SIZE(0x5050, 0x6000))) { return cPhs_ERROR_e; } From daf2954d43cbc94267a52aae582aa7ae0dc48283 Mon Sep 17 00:00:00 2001 From: Irastris Date: Sat, 28 Mar 2026 18:58:18 -0400 Subject: [PATCH 6/7] Revert d_s_logo speedup, skip logos entirely instead --- src/d/d_s_logo.cpp | 47 +++++++++++++++++++++++++--------------------- 1 file changed, 26 insertions(+), 21 deletions(-) diff --git a/src/d/d_s_logo.cpp b/src/d/d_s_logo.cpp index a878de8106..6aa3778dbf 100644 --- a/src/d/d_s_logo.cpp +++ b/src/d/d_s_logo.cpp @@ -412,11 +412,11 @@ void dScnLogo_c::progOutDraw() { } #endif - mDoGph_gInf_c::startFadeIn(1); + mDoGph_gInf_c::startFadeIn(30); } else { mExecCommand = EXEC_PROG_SET; mTimer = 150; - mDoGph_gInf_c::startFadeIn(1); + mDoGph_gInf_c::startFadeIn(30); } } } @@ -427,7 +427,7 @@ void dScnLogo_c::progSetDraw() { if (mTimer == 0) { mExecCommand = EXEC_PROG_SET2; mTimer = 30; - mDoGph_gInf_c::startFadeOut(1); + mDoGph_gInf_c::startFadeOut(30); } } @@ -463,15 +463,15 @@ void dScnLogo_c::progChangeDraw() { mTimer = 90; #else if (mDoRst::getWarningDispFlag() != 0) { - mTimer = 1; + mTimer = 90; mExecCommand = EXEC_NINTENDO_IN; } else { - mTimer = 1; + mTimer = 120; mExecCommand = EXEC_WARNING_IN; } #endif - mDoGph_gInf_c::startFadeIn(1); + mDoGph_gInf_c::startFadeIn(30); } } @@ -516,8 +516,8 @@ void dScnLogo_c::warningDispDraw() { #endif { mExecCommand = EXEC_WARNING_OUT; - mTimer = 1; - mDoGph_gInf_c::startFadeOut(1); + mTimer = 30; + mDoGph_gInf_c::startFadeOut(30); mDoRst::setWarningDispFlag(1); } } @@ -526,9 +526,9 @@ void dScnLogo_c::warningOutDraw() { dComIfGd_set2DOpa(mWarning); if (mTimer == 0) { - mTimer = 1; + mTimer = 90; mExecCommand = EXEC_NINTENDO_IN; - mDoGph_gInf_c::startFadeIn(1); + mDoGph_gInf_c::startFadeIn(30); } } @@ -537,8 +537,8 @@ void dScnLogo_c::nintendoInDraw() { if (mTimer == 0) { mExecCommand = EXEC_NINTENDO_OUT; - mTimer = 1; - mDoGph_gInf_c::startFadeOut(1); + mTimer = 30; + mDoGph_gInf_c::startFadeOut(30); } } @@ -547,8 +547,8 @@ void dScnLogo_c::nintendoOutDraw() { if (mTimer == 0) { mExecCommand = EXEC_DOLBY_IN; - mTimer = 1; - mDoGph_gInf_c::startFadeIn(1); + mTimer = 30; + mDoGph_gInf_c::startFadeIn(30); } } @@ -557,8 +557,8 @@ void dScnLogo_c::dolbyInDraw() { if (mTimer == 0) { mExecCommand = EXEC_DOLBY_OUT; - mTimer = 1; - mDoGph_gInf_c::startFadeOut(1); + mTimer = 30; + mDoGph_gInf_c::startFadeOut(30); } } @@ -567,8 +567,8 @@ void dScnLogo_c::dolbyOutDraw() { if (mTimer == 0) { mExecCommand = EXEC_DOLBY_OUT2; - mTimer = 1; - mDoGph_gInf_c::startFadeIn(1); + mTimer = 30; + mDoGph_gInf_c::startFadeIn(30); } } @@ -1098,7 +1098,7 @@ int dScnLogo_c::create() { mTimer = 90; #endif - mDoGph_gInf_c::startFadeIn(1); + mDoGph_gInf_c::startFadeIn(30); #if !(PLATFORM_WII || PLATFORM_SHIELD) checkProgSelect(); @@ -1107,13 +1107,18 @@ int dScnLogo_c::create() { mTimer = 1; field_0x218 = getProgressiveMode(); } else { + #if TARGET_PC + mTimer = 0; // Possibly unnecessary but just in case + mExecCommand = EXEC_DVD_WAIT; + #else if (mDoRst::getWarningDispFlag()) { - mTimer = 1; // 90; + mTimer = 90; mExecCommand = EXEC_NINTENDO_IN; } else { - mTimer = 1; + mTimer = 120; mExecCommand = EXEC_WARNING_IN; } + #endif mDoRst::setProgSeqFlag(1); } From 880fc5e2f9bbd0a32afa56d91ad9b0386c778737 Mon Sep 17 00:00:00 2001 From: Irastris Date: Sat, 28 Mar 2026 19:18:28 -0400 Subject: [PATCH 7/7] Update Aurora submodule --- extern/aurora | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/extern/aurora b/extern/aurora index d76b70fc72..236a7a5e9a 160000 --- a/extern/aurora +++ b/extern/aurora @@ -1 +1 @@ -Subproject commit d76b70fc72c6a5904a9e78c0526353f8b8e93c61 +Subproject commit 236a7a5e9a65b3d74371c2eae8fd161f3c5eacb1