Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 8 additions & 6 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -49,11 +49,6 @@ set_property(DIRECTORY ${CMAKE_SOURCE_DIR} PROPERTY VS_STARTUP_PROJECT ${PROJECT
set_property(DIRECTORY ${CMAKE_SOURCE_DIR} PROPERTY VS_DEBUGGER_WORKING_DIRECTORY ${CMAKE_SOURCE_DIR})
endif()

if(NOT EXISTS ${CMAKE_BINARY_DIR}/config.yml)
execute_process(COMMAND ${CMAKE_COMMAND} -E copy_if_different "${CMAKE_SOURCE_DIR}/config.yml" "${CMAKE_BINARY_DIR}/config.yml")
execute_process(COMMAND ${CMAKE_COMMAND} -E copy_directory "${CMAKE_SOURCE_DIR}/assets/" "${CMAKE_BINARY_DIR}/assets/")
endif()

if (MSVC)
set(CPP "${CMAKE_C_COMPILER}" "/EP")
else()
Expand Down Expand Up @@ -602,6 +597,13 @@ if (CMAKE_CXX_COMPILER_ID MATCHES "GNU|Clang|AppleClang")
endif()
endif()

add_custom_command(
TARGET ${PROJECT_NAME} POST_BUILD
COMMENT "Copying asset yamls..."
COMMAND ${CMAKE_COMMAND} -E copy_if_different "${CMAKE_SOURCE_DIR}/config.yml" "$<TARGET_FILE_DIR:Starship>/config.yml"
COMMAND ${CMAKE_COMMAND} -E copy_directory "${CMAKE_SOURCE_DIR}/assets/" "$<TARGET_FILE_DIR:Starship>/assets/"
)

if(NOT CMAKE_SYSTEM_NAME STREQUAL "NintendoSwitch")
include(ExternalProject)
ExternalProject_Add(TorchExternal
Expand Down Expand Up @@ -670,4 +672,4 @@ elseif(CMAKE_SYSTEM_NAME MATCHES "Darwin")
endif()

set(CPACK_PROJECT_CONFIG_FILE ${CMAKE_SOURCE_DIR}/cmake/configure-packaging.cmake)
include(cmake/packaging.cmake)
include(cmake/packaging.cmake)
2 changes: 1 addition & 1 deletion libultraship
Submodule libultraship updated 74 files
+47 −5 .github/workflows/build-validation.yml
+1 −4 CMakeLists.txt
+5 −3 cmake/automate-vcpkg.cmake
+2 −2 cmake/dependencies/common.cmake
+10 −7 cmake/dependencies/windows-vcpkg.cmake
+1 −4 include/libultraship/bridge.h
+0 −4 include/libultraship/classes.h
+1 −4 include/libultraship/color.h
+1 −4 include/libultraship/libultra.h
+1 −4 include/libultraship/libultra/abi.h
+0 −5 include/libultraship/libultra/controller.h
+1 −4 include/libultraship/libultra/convert.h
+1 −4 include/libultraship/libultra/eeprom.h
+1 −4 include/libultraship/libultra/exception.h
+2 −5 include/libultraship/libultra/gbi.h
+1 −4 include/libultraship/libultra/gu.h
+1 −4 include/libultraship/libultra/internal.h
+3 −4 include/libultraship/libultra/interrupt.h
+1 −4 include/libultraship/libultra/pfs.h
+1 −5 include/libultraship/libultra/pi.h
+1 −4 include/libultraship/libultra/printf.h
+1 −4 include/libultraship/libultra/r4300.h
+1 −4 include/libultraship/libultra/rcp.h
+1 −4 include/libultraship/libultra/rdp.h
+1 −4 include/libultraship/libultra/sptask.h
+1 −4 include/libultraship/libultra/thread.h
+1 −4 include/libultraship/libultra/time.h
+1 −4 include/libultraship/libultra/types.h
+1 −4 include/libultraship/libultra/vi.h
+1 −4 include/libultraship/libultraship.h
+1 −1 src/CMakeLists.txt
+1 −1 src/controller/controldeck/ControlDeck.h
+3 −0 src/debug/CrashHandler.cpp
+1 −4 src/debug/CrashHandler.h
+10 −5 src/graphic/Fast3D/backends/gfx_direct3d11.cpp
+1 −3 src/graphic/Fast3D/backends/gfx_dxgi.h
+1 −5 src/graphic/Fast3D/backends/gfx_metal.h
+2 −2 src/graphic/Fast3D/backends/gfx_opengl.cpp
+2 −4 src/graphic/Fast3D/backends/gfx_opengl.h
+1 −3 src/graphic/Fast3D/backends/gfx_rendering_api.h
+1 −4 src/graphic/Fast3D/backends/gfx_screen_config.h
+1 −3 src/graphic/Fast3D/backends/gfx_sdl.h
+6 −7 src/graphic/Fast3D/backends/gfx_sdl2.cpp
+1 −4 src/graphic/Fast3D/backends/gfx_window_manager_api.h
+1 −4 src/graphic/Fast3D/interpreter.h
+0 −5 src/public/bridge/audiobridge.h
+0 −5 src/public/bridge/consolevariablebridge.h
+0 −5 src/public/bridge/controllerbridge.h
+0 −5 src/public/bridge/crashhandlerbridge.h
+1 −4 src/public/bridge/gfxbridge.h
+2 −7 src/public/bridge/gfxdebuggerbridge.h
+0 −5 src/public/bridge/resourcebridge.h
+0 −5 src/public/bridge/windowbridge.h
+5 −3 src/public/libultra/os_eeprom.cpp
+0 −0 src/public/libultra/os_time.cpp
+2 −2 src/resource/archive/ArchiveManager.cpp
+2 −2 src/resource/archive/OtrArchive.cpp
+2 −2 src/resource/archive/OtrArchive.h
+1 −1 src/resource/type/Blob.h
+1 −1 src/resource/type/DisplayList.h
+1 −1 src/resource/type/Json.h
+1 −1 src/resource/type/Light.h
+1 −1 src/resource/type/Matrix.h
+1 −1 src/resource/type/Shader.h
+1 −1 src/resource/type/Texture.h
+1 −1 src/resource/type/Vertex.h
+1 −4 src/utils/AppleFolderManager.h
+1 −1 src/utils/binarytools/MemoryStream.h
+1 −4 src/utils/binarytools/endianness.h
+2 −3 src/utils/macUtils.h
+77 −0 src/window/FileDropMgr.cpp
+8 −4 src/window/FileDropMgr.h
+6 −4 src/window/gui/GameOverlay.cpp
+6 −4 src/window/gui/Gui.cpp
24 changes: 10 additions & 14 deletions src/port/Engine.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -63,28 +63,22 @@ std::vector<uint8_t*> MemoryPool;
GameEngine* GameEngine::Instance;

GameEngine::GameEngine() {
// Initialize context properties early to recognize paths properly for non-portable builds
this->context = Ship::Context::CreateUninitializedInstance("Starship", "ship", "starship.cfg.json");

#ifdef __SWITCH__
Ship::Switch::Init(Ship::PreInitPhase);
Ship::Switch::Init(Ship::PostInitPhase);
#endif

std::vector<std::string> archiveFiles;
const std::string main_path = Ship::Context::GetPathRelativeToAppDirectory("sf64.o2r");
#ifdef __linux__
const std::string assets_path = Ship::Context::GetPathRelativeToAppBundle("starship.o2r");
#else
const std::string assets_path = Ship::Context::GetPathRelativeToAppDirectory("starship.o2r");
#endif

const std::string assets_path = Ship::Context::LocateFileAcrossAppDirs("starship.o2r");

#ifdef _WIN32
AllocConsole();
#endif

if (!fs::exists("mods")) {
fs::create_directories("mods");
}

if (std::filesystem::exists(main_path)) {
archiveFiles.push_back(main_path);
} else {
Expand All @@ -111,7 +105,11 @@ GameEngine::GameEngine() {
}

if (const std::string patches_path = Ship::Context::GetPathRelativeToAppDirectory("mods");
!patches_path.empty() && std::filesystem::exists(patches_path)) {
!patches_path.empty()) {
if (!std::filesystem::exists(patches_path)) {
std::filesystem::create_directories(patches_path);
}

if (std::filesystem::is_directory(patches_path)) {
for (const auto& p : std::filesystem::recursive_directory_iterator(patches_path)) {
const auto ext = p.path().extension().string();
Expand All @@ -127,8 +125,6 @@ GameEngine::GameEngine() {
}
}

this->context = Ship::Context::CreateUninitializedInstance("Starship", "ship", "starship.cfg.json");

this->context->InitConfiguration(); // without this line InitConsoleVariables fails at Config::Reload()
this->context->InitConsoleVariables(); // without this line the controldeck constructor failes in
// ShipDeviceIndexMappingManager::UpdateControllerNamesFromConfig()
Expand Down Expand Up @@ -849,4 +845,4 @@ extern "C" void GameEngine_Free(void* ptr) {
break;
}
}
}
}
7 changes: 5 additions & 2 deletions src/port/extractor/GameExtractor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,10 @@ std::optional<std::string> GameExtractor::ValidateChecksum() const {
}

bool GameExtractor::GenerateOTR() const {
Companion::Instance = new Companion(this->mGameData, ArchiveType::O2R, false);
const std::string assets_path = Ship::Context::GetAppBundlePath();
const std::string game_path = Ship::Context::GetAppDirectoryPath();

Companion::Instance = new Companion(this->mGameData, ArchiveType::O2R, false, assets_path, game_path);

try {
Companion::Instance->Init(ExportType::Binary);
Expand All @@ -63,4 +66,4 @@ bool GameExtractor::GenerateOTR() const {
}

return true;
}
}
1 change: 1 addition & 0 deletions src/port/ui/UIWidgets.cpp
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#define NOMINMAX // prevent defining min/max macros on windows
#include "UIWidgets.h"

#include "libultraship/src/Context.h"
Expand Down
Loading