O2R Support

This commit is contained in:
inspectredc 2025-01-09 10:17:46 +00:00 committed by Lywx
parent 56b80e3081
commit 16aebcd560
7 changed files with 25 additions and 24 deletions

1
.gitignore vendored
View File

@ -16,6 +16,7 @@ ctx.c.m2c
*.u64
*.bin
*.otr
*.o2r
*.eeprom
assets/yaml/us/ast_test.yaml
/audio_data

View File

@ -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")

View File

@ -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`

View File

@ -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

View File

@ -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

View File

@ -58,14 +58,14 @@ GameEngine* GameEngine::Instance;
static GamePool MemoryPool = { .chunk = 1024 * 512, .cursor = 0, .length = 0, .memory = nullptr };
GameEngine::GameEngine() {
std::vector<std::string> OTRFiles;
if (const std::string cube_path = Ship::Context::GetPathRelativeToAppDirectory("starship.otr");
std::vector<std::string> 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<LUS::ControlDeck>();
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<Fast::Fast3dWindow>(std::vector<std::shared_ptr<Ship::GuiWindow>>({}));
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));

@ -1 +1 @@
Subproject commit 4459958deed7af3c9ed7343914789709d6ef6ef1
Subproject commit 94be71101cf5a81685949a6025a3870f2d798284