From 16aebcd5601d7934a2dba0ea936f082453bae150 Mon Sep 17 00:00:00 2001 From: inspectredc Date: Thu, 9 Jan 2025 10:17:46 +0000 Subject: [PATCH] O2R Support --- .gitignore | 1 + CMakeLists.txt | 8 ++++---- README.md | 6 +++--- config.yml | 6 +++--- docs/BUILDING.md | 8 ++++---- src/port/Engine.cpp | 18 +++++++++--------- tools/Torch | 2 +- 7 files changed, 25 insertions(+), 24 deletions(-) diff --git a/.gitignore b/.gitignore index 7e171463..d2f57e2f 100644 --- a/.gitignore +++ b/.gitignore @@ -16,6 +16,7 @@ ctx.c.m2c *.u64 *.bin *.otr +*.o2r *.eeprom assets/yaml/us/ast_test.yaml /audio_data diff --git a/CMakeLists.txt b/CMakeLists.txt index 97fd456c..cf0342aa 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -545,16 +545,16 @@ add_custom_target( ExtractAssets DEPENDS torch WORKING_DIRECTORY ${CMAKE_SOURCE_DIR} - COMMAND ${TORCH_EXECUTABLE} otr baserom.z64 - COMMAND ${CMAKE_COMMAND} -E copy_if_different "${CMAKE_SOURCE_DIR}/sf64.otr" "${CMAKE_BINARY_DIR}/sf64.otr" + COMMAND ${TORCH_EXECUTABLE} o2r baserom.z64 + COMMAND ${CMAKE_COMMAND} -E copy_if_different "${CMAKE_SOURCE_DIR}/sf64.o2r" "${CMAKE_BINARY_DIR}/sf64.o2r" ) add_custom_target( GeneratePortOTR DEPENDS torch WORKING_DIRECTORY ${CMAKE_SOURCE_DIR} - COMMAND ${TORCH_EXECUTABLE} pack port starship.otr - COMMAND ${CMAKE_COMMAND} -E copy_if_different "${CMAKE_SOURCE_DIR}/starship.otr" "${CMAKE_BINARY_DIR}/starship.otr" + COMMAND ${TORCH_EXECUTABLE} pack port starship.o2r o2r + COMMAND ${CMAKE_COMMAND} -E copy_if_different "${CMAKE_SOURCE_DIR}/starship.o2r" "${CMAKE_BINARY_DIR}/starship.o2r" ) if(CMAKE_SYSTEM_NAME MATCHES "Darwin") diff --git a/README.md b/README.md index e74fe85c..8071ba2a 100644 --- a/README.md +++ b/README.md @@ -25,16 +25,16 @@ Your ROM needs to be in .z64 format. If it's in .n64 format, use the following t ### 2. Download Starship from [Releases](https://github.com/HarbourMasters/Starship/releases) -### 3. Generating the OTR from the ROM +### 3. Generating the O2R from the ROM #### Windows * Extract every file from the zip into a folder of your choosing. * Copy your ROM to the root of the folder you extracted the zip to. -* Run "generate_otr.bat" +* Run "generate_o2r.bat" #### MacOS * Extract every file from the zip into a folder of your choosing. * Copy your ROM to the root of the folder you extracted the zip to. -* Run "generate_otr.sh" +* Run "generate_o2r.sh" ### 4. Play! * Launch `Starship.exe` diff --git a/config.yml b/config.yml index f65ff18b..29b03efe 100644 --- a/config.yml +++ b/config.yml @@ -17,7 +17,7 @@ f7475fb11e7e6830f82883412638e8390791ab87: sort: OFFSET # logging: ERROR output: - binary: sf64.otr + binary: sf64.o2r # code: src/assets # headers: include/assets # modding: src/assets @@ -47,7 +47,7 @@ d8b1088520f7c5f81433292a9258c1184afa1457: sort: OFFSET # logging: ERROR output: - binary: sf64.otr + binary: sf64.o2r # code: src/assets # headers: include/assets # modding: src/assets @@ -77,7 +77,7 @@ d064229a32cc05ab85e2381ce07744eb3ffaf530: sort: OFFSET logging: ERROR output: - binary: ./mods/sf64jp.otr + binary: ./mods/sf64jp.o2r code: src/assets headers: include/assets modding: src/assets diff --git a/docs/BUILDING.md b/docs/BUILDING.md index 67898398..d042a25c 100644 --- a/docs/BUILDING.md +++ b/docs/BUILDING.md @@ -22,7 +22,7 @@ It is recommended that you install Python and Git standalone, the install proces _Note: Be sure to either clone with the ``--recursive`` flag or do ``git submodule update --init`` after cloning to pull in the libultraship submodule!_ -2. After setup and initial build, use the built-in OTR extraction to make your sf64.otr file. +2. After setup and initial build, use the built-in OTR extraction to make your sf64.o2r file. _Note: Instructions assume using powershell_ ```powershell @@ -33,7 +33,7 @@ cd starship # Add `-DCMAKE_BUILD_TYPE:STRING=Release` if you're packaging & 'C:\Program Files\CMake\bin\cmake' -S . -B "build/x64" -G "Visual Studio 17 2022" -T v143 -A x64 -# Generate sf64.otr +# Generate sf64.o2r & 'C:\Program Files\CMake\bin\cmake.exe' --build .\build\x64 --target ExtractAssets # Compile project @@ -130,7 +130,7 @@ git submodule update --init # Add `-DPython3_EXECUTABLE=$(which python3)` if you are using non-standard Python installations such as PyEnv cmake -H. -Bbuild-cmake -GNinja -# Generate sf64.otr +# Generate sf64.o2r cmake --build build-cmake --target ExtractAssets # Compile the project @@ -177,7 +177,7 @@ git submodule update --init # Add `-DCMAKE_BUILD_TYPE:STRING=Release` if you're packaging cmake -H. -Bbuild-cmake -GNinja -# Generate sf64.otr +# Generate sf64.o2r cmake --build build-cmake --target ExtractAssets # Compile the project diff --git a/src/port/Engine.cpp b/src/port/Engine.cpp index 39a26a8e..a764d61f 100644 --- a/src/port/Engine.cpp +++ b/src/port/Engine.cpp @@ -58,14 +58,14 @@ GameEngine* GameEngine::Instance; static GamePool MemoryPool = { .chunk = 1024 * 512, .cursor = 0, .length = 0, .memory = nullptr }; GameEngine::GameEngine() { - std::vector OTRFiles; - if (const std::string cube_path = Ship::Context::GetPathRelativeToAppDirectory("starship.otr"); + std::vector archiveFiles; + if (const std::string cube_path = Ship::Context::GetPathRelativeToAppDirectory("starship.o2r"); std::filesystem::exists(cube_path)) { - OTRFiles.push_back(cube_path); + archiveFiles.push_back(cube_path); } - if (const std::string sm64_otr_path = Ship::Context::GetPathRelativeToAppDirectory("sf64.otr"); + if (const std::string sm64_otr_path = Ship::Context::GetPathRelativeToAppDirectory("sf64.o2r"); std::filesystem::exists(sm64_otr_path)) { - OTRFiles.push_back(sm64_otr_path); + archiveFiles.push_back(sm64_otr_path); } if (const std::string patches_path = Ship::Context::GetPathRelativeToAppDirectory("mods"); !patches_path.empty() && std::filesystem::exists(patches_path)) { @@ -73,12 +73,12 @@ GameEngine::GameEngine() { for (const auto& p : std::filesystem::recursive_directory_iterator(patches_path)) { const auto ext = p.path().extension().string(); if (StringHelper::IEquals(ext, ".otr") || StringHelper::IEquals(ext, ".o2r")) { - OTRFiles.push_back(p.path().generic_string()); + archiveFiles.push_back(p.path().generic_string()); } if (StringHelper::IEquals(ext, ".zip")) { SPDLOG_WARN("Zip files should be only used for development purposes, not for distribution"); - OTRFiles.push_back(p.path().generic_string()); + archiveFiles.push_back(p.path().generic_string()); } } } @@ -92,12 +92,12 @@ GameEngine::GameEngine() { auto controlDeck = std::make_shared(); - this->context->InitResourceManager(OTRFiles, {}, 3); // without this line InitWindow fails in Gui::Init() + this->context->InitResourceManager(archiveFiles, {}, 3); // without this line InitWindow fails in Gui::Init() this->context->InitConsole(); // without this line the GuiWindow constructor fails in ConsoleWindow::InitElement() auto window = std::make_shared(std::vector>({})); - this->context->Init(OTRFiles, {}, 3, { 32000, 1024, 1680 }, window, controlDeck); + this->context->Init(archiveFiles, {}, 3, { 32000, 1024, 1680 }, window, controlDeck); Ship::Context::GetInstance()->GetLogger()->set_level( (spdlog::level::level_enum) CVarGetInteger("gDeveloperTools.LogLevel", 1)); diff --git a/tools/Torch b/tools/Torch index 4459958d..94be7110 160000 --- a/tools/Torch +++ b/tools/Torch @@ -1 +1 @@ -Subproject commit 4459958deed7af3c9ed7343914789709d6ef6ef1 +Subproject commit 94be71101cf5a81685949a6025a3870f2d798284