From 21a6f4046f46369c209834701061a4360973e64c Mon Sep 17 00:00:00 2001 From: Wiseguy <68165316+Mr-Wiseguy@users.noreply.github.com> Date: Fri, 14 Mar 2025 18:11:29 -0400 Subject: [PATCH 1/4] Download full target build of llvm in CI Windows runners to fix missing MIPS support and update N64Recomp CI commit (#549) --- .github/workflows/validate.yml | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/.github/workflows/validate.yml b/.github/workflows/validate.yml index 8c77904..aec6680 100644 --- a/.github/workflows/validate.yml +++ b/.github/workflows/validate.yml @@ -9,7 +9,7 @@ on: N64RECOMP_COMMIT: type: string required: false - default: '198de1b5cf6e58415948588584750c51562d58dd' + default: '989a86b36912403cd323de884bf834f2605ea770' DXC_CHECKSUM: type: string required: false @@ -215,6 +215,13 @@ jobs: run: | choco install ninja Remove-Item -Path "C:\ProgramData\Chocolatey\bin\ccache.exe" -Force -ErrorAction SilentlyContinue + - name: Download portable LLVM + run: | + $ProgressPreference = 'SilentlyContinue' + Invoke-WebRequest -Uri "https://github.com/llvm/llvm-project/releases/download/llvmorg-19.1.3/LLVM-19.1.3-Windows-X64.tar.xz" -OutFile "LLVM.tar.xz" + New-Item -ItemType Directory -Path portable-llvm > $null + 7z x LLVM.tar.xz + 7z x LLVM.tar -oportable-llvm - name: Configure Developer Command Prompt uses: ilammy/msvc-dev-cmd@v1 - name: Prepare Build @@ -254,7 +261,7 @@ jobs: # remove LLVM from PATH so it doesn't overshadow the one provided by VS $env:PATH = ($env:PATH -split ';' | Where-Object { $_ -ne 'C:\Program Files\LLVM\bin' }) -join ';' - cmake -DCMAKE_BUILD_TYPE=${{ matrix.type }} -DCMAKE_CXX_COMPILER_LAUNCHER=ccache -DCMAKE_C_COMPILER_LAUNCHER=ccache -DCMAKE_CXX_COMPILER=clang-cl -DCMAKE_C_COMPILER=clang-cl -DCMAKE_MAKE_PROGRAM=ninja -G Ninja -S . -B cmake-build -DCMAKE_CXX_FLAGS="-Xclang -fexceptions -Xclang -fcxx-exceptions" + cmake -DCMAKE_BUILD_TYPE=${{ matrix.type }} -DCMAKE_CXX_COMPILER_LAUNCHER=ccache -DCMAKE_C_COMPILER_LAUNCHER=ccache -DCMAKE_CXX_COMPILER=clang-cl -DCMAKE_C_COMPILER=clang-cl -DCMAKE_MAKE_PROGRAM=ninja -DPATCHES_C_COMPILER="..\portable-llvm\LLVM-19.1.3-Windows-X64\bin\clang" -DPATCHES_LD="..\portable-llvm\LLVM-19.1.3-Windows-X64\bin\ld.lld" -G Ninja -S . -B cmake-build -DCMAKE_CXX_FLAGS="-Xclang -fexceptions -Xclang -fcxx-exceptions" cmake --build cmake-build --config ${{ matrix.type }} --target Zelda64Recompiled -j $cpuCores env: SDL2_VERSION: ${{ inputs.SDL2_VERSION }} From c6d77fe5cac0b6843663a8d75e9af49433f547ae Mon Sep 17 00:00:00 2001 From: Hugo Locurcio Date: Fri, 14 Mar 2025 23:12:09 +0100 Subject: [PATCH 2/4] Fix link to `decompress_baserom.py` in Building documentation (#548) --- BUILDING.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/BUILDING.md b/BUILDING.md index 4245b8b..bb9ea72 100644 --- a/BUILDING.md +++ b/BUILDING.md @@ -39,7 +39,7 @@ choco install make You will need to decompress the NTSC-U N64 Majora's Mask ROM (sha1: d6133ace5afaa0882cf214cf88daba39e266c078) before running the recompiler. There are a few tools that can do it: -* This python script from the Majora's Mask decompilation project: https://github.com/zeldaret/mm/blob/main/tools/buildtools/decompress_baserom.py +* This python script from the Majora's Mask decompilation project: https://github.com/zeldaret/mm/blob/main/tools/decompress_baserom.py * https://github.com/z64tools/z64decompress Regardless of which method you use, copy the decompressed ROM to the root of the Zelda64Recomp repository with this filename: @@ -73,5 +73,5 @@ cmake --build build-cmake --target Zelda64Recompiled -j$(nproc) --config Release VoilĂ ! You should now have a `Zelda64Recompiled` executable in the build directory! If you used Visual Studio this will be `out/build/x64-[Configuration]` and if you used the provided CMake commands then this will be `build-cmake`. You will need to run the executable out of the root folder of this project or copy the assets folder to the build folder to run it. -> [!IMPORTANT] +> [!IMPORTANT] > In the game itself, you should be using a standard ROM, not the decompressed one. From 1c8668fb6580f26d188cae467fce585ed874c30e Mon Sep 17 00:00:00 2001 From: David Chavez Date: Sat, 15 Mar 2025 19:25:29 +0100 Subject: [PATCH 3/4] Update RT64 for MacOS Intel GPU support and region resolve fix (#550) --- lib/rt64 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/rt64 b/lib/rt64 index 8efb6cc..ca146db 160000 --- a/lib/rt64 +++ b/lib/rt64 @@ -1 +1 @@ -Subproject commit 8efb6cc8168e746fb22d08c2dd766b2a176e1a51 +Subproject commit ca146dbd312e91afeacb8e2b0e8702c33db35de6 From 3d3524ffe7f255b290ef27caa6780dd3a434d693 Mon Sep 17 00:00:00 2001 From: squidbus <175574877+squidbus@users.noreply.github.com> Date: Sun, 23 Mar 2025 12:23:44 -0700 Subject: [PATCH 4/4] Fix portable mode on macOS (#552) --- include/zelda_support.h | 3 ++- src/game/config.cpp | 9 +++++++++ src/main/support.cpp | 4 +--- src/main/support_apple.mm | 9 +++++++-- 4 files changed, 19 insertions(+), 6 deletions(-) diff --git a/include/zelda_support.h b/include/zelda_support.h index 4e138a7..9751e9a 100644 --- a/include/zelda_support.h +++ b/include/zelda_support.h @@ -12,7 +12,8 @@ namespace zelda64 { // Apple specific methods that usually require Objective-C. Implemented in support_apple.mm. #ifdef __APPLE__ void dispatch_on_ui_thread(std::function func); - const char* get_bundle_resource_directory(); + std::filesystem::path get_bundle_resource_directory(); + std::filesystem::path get_bundle_directory(); #endif } diff --git a/src/game/config.cpp b/src/game/config.cpp index 3681b7b..7f6c614 100644 --- a/src/game/config.cpp +++ b/src/game/config.cpp @@ -2,6 +2,7 @@ #include "recomp_input.h" #include "zelda_sound.h" #include "zelda_render.h" +#include "zelda_support.h" #include "ultramodern/config.hpp" #include "librecomp/files.hpp" #include @@ -136,6 +137,14 @@ std::filesystem::path zelda64::get_app_folder_path() { return std::filesystem::current_path(); } +#if defined(__APPLE__) + // Check for portable file in the directory containing the app bundle. + const auto app_bundle_path = zelda64::get_bundle_directory().parent_path(); + if (std::filesystem::exists(app_bundle_path / "portable.txt")) { + return app_bundle_path; + } +#endif + std::filesystem::path recomp_dir{}; #if defined(_WIN32) diff --git a/src/main/support.cpp b/src/main/support.cpp index 3bad3fd..dee5f5d 100644 --- a/src/main/support.cpp +++ b/src/main/support.cpp @@ -25,9 +25,7 @@ namespace zelda64 { std::filesystem::path get_asset_path(const char* asset) { std::filesystem::path base_path = ""; #if defined(__APPLE__) - const char* resource_dir = get_bundle_resource_directory(); - base_path = resource_dir; - free((void*)resource_dir); + base_path = get_bundle_resource_directory(); #endif return base_path / "assets" / asset; diff --git a/src/main/support_apple.mm b/src/main/support_apple.mm index 67b56f8..604a998 100644 --- a/src/main/support_apple.mm +++ b/src/main/support_apple.mm @@ -12,9 +12,14 @@ namespace zelda64 { }); } - const char* get_bundle_resource_directory() { + std::filesystem::path get_bundle_resource_directory() { NSString *bundlePath = [[NSBundle mainBundle] resourcePath]; - return strdup([bundlePath UTF8String]); + return std::filesystem::path([bundlePath UTF8String]); + } + + std::filesystem::path get_bundle_directory() { + NSString *bundlePath = [[NSBundle mainBundle] bundlePath]; + return std::filesystem::path([bundlePath UTF8String]); } }