summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKiritoDv <kiritodev01@gmail.com>2024-09-06 23:25:52 -0600
committerSonic Dreamcaster <alejandro.asenjo88@gmail.com>2024-09-17 20:30:14 -0300
commitb03d093fc23f6b6ef5ebd38b04e10b813c9a2e1a (patch)
tree0720b2e0c2109d71459cd1b0f4fbf34cd7b18232
parent299aa719668d40044f6d101cafdd0bdb5bf05e83 (diff)
Fixed compilation with latest lus
-rw-r--r--CMakeLists.txt19
-rw-r--r--config.yml4
-rw-r--r--src/port/Engine.cpp4
-rw-r--r--src/port/GBIMiddleware.cpp29
-rw-r--r--src/port/ui/ImguiUI.cpp30
5 files changed, 46 insertions, 40 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index c659a485..80e9b08e 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -537,3 +537,22 @@ if (CMAKE_CXX_COMPILER_ID MATCHES "GNU|Clang|AppleClang")
)
endif()
endif()
+
+include(ExternalProject)
+ExternalProject_Add(Torch
+ PREFIX Torch
+ SOURCE_DIR ${CMAKE_SOURCE_DIR}/tools/Torch
+ CMAKE_ARGS -DCMAKE_INSTALL_PREFIX=${CMAKE_BINARY_DIR}/Torch
+)
+ExternalProject_Get_Property(Torch install_dir)
+set(TORCH_EXECUTABLE ${install_dir}/src/Torch-build/$<CONFIGURATION>/torch)
+add_custom_target(
+ ExtractAssets
+ DEPENDS Torch
+ WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
+ COMMAND ${TORCH_EXECUTABLE} header -o baserom.us.uncompressed.z64
+ COMMAND ${TORCH_EXECUTABLE} otr baserom.us.uncompressed.z64
+ # COMMAND ${TORCH_EXECUTABLE} pack assets starship.otr
+ COMMAND ${CMAKE_COMMAND} -E copy_if_different "${CMAKE_SOURCE_DIR}/sf64.otr" "${CMAKE_BINARY_DIR}/sf64.otr"
+ # COMMAND ${CMAKE_COMMAND} -E copy_if_different "${CMAKE_SOURCE_DIR}/starship.otr" "${CMAKE_BINARY_DIR}/starship.otr"
+) \ No newline at end of file
diff --git a/config.yml b/config.yml
index 8a2b8854..69ba91ea 100644
--- a/config.yml
+++ b/config.yml
@@ -8,7 +8,7 @@ f7475fb11e7e6830f82883412638e8390791ab87:
sort: OFFSET
# logging: ERROR
output:
- binary: starship.otr
+ binary: sf64.otr
code: src/assets
headers: include/assets
modding: src/assets
@@ -27,7 +27,7 @@ d064229a32cc05ab85e2381ce07744eb3ffaf530:
gbi: F3DEX
sort: OFFSET
output:
- binary: starship.otr
+ binary: sf64.otr
code: src/assets
headers: include/assets
modding: src/assets
diff --git a/src/port/Engine.cpp b/src/port/Engine.cpp
index 5669c4e0..f7636761 100644
--- a/src/port/Engine.cpp
+++ b/src/port/Engine.cpp
@@ -21,7 +21,6 @@
#include <DisplayListFactory.h>
#include <TextureFactory.h>
#include <MatrixFactory.h>
-#include <ArrayFactory.h>
#include <BlobFactory.h>
#include <VertexFactory.h>
@@ -45,7 +44,7 @@ GameEngine::GameEngine() {
if (const std::string cube_path = Ship::Context::GetPathRelativeToAppDirectory("starship.otr"); std::filesystem::exists(cube_path)) {
OTRFiles.push_back(cube_path);
}
- if (const std::string sm64_otr_path = Ship::Context::GetPathRelativeToAppBundle("sm64.otr"); std::filesystem::exists(sm64_otr_path)) {
+ if (const std::string sm64_otr_path = Ship::Context::GetPathRelativeToAppBundle("sf64.otr"); std::filesystem::exists(sm64_otr_path)) {
OTRFiles.push_back(sm64_otr_path);
}
if (const std::string patches_path = Ship::Context::GetPathRelativeToAppDirectory("mods"); !patches_path.empty() && std::filesystem::exists(patches_path)) {
@@ -80,7 +79,6 @@ GameEngine::GameEngine() {
loader->RegisterResourceFactory(std::make_shared<LUS::ResourceFactoryBinaryVertexV0>(), RESOURCE_FORMAT_BINARY, "Vertex", static_cast<uint32_t>(LUS::ResourceType::Vertex), 0);
loader->RegisterResourceFactory(std::make_shared<LUS::ResourceFactoryBinaryDisplayListV0>(), RESOURCE_FORMAT_BINARY, "DisplayList", static_cast<uint32_t>(LUS::ResourceType::DisplayList), 0);
loader->RegisterResourceFactory(std::make_shared<LUS::ResourceFactoryBinaryMatrixV0>(), RESOURCE_FORMAT_BINARY, "Matrix", static_cast<uint32_t>(LUS::ResourceType::Matrix), 0);
- loader->RegisterResourceFactory(std::make_shared<LUS::ResourceFactoryBinaryArrayV0>(), RESOURCE_FORMAT_BINARY, "Array", static_cast<uint32_t>(LUS::ResourceType::Array), 0);
loader->RegisterResourceFactory(std::make_shared<LUS::ResourceFactoryBinaryBlobV0>(), RESOURCE_FORMAT_BINARY, "Blob", static_cast<uint32_t>(LUS::ResourceType::Blob), 0);
}
diff --git a/src/port/GBIMiddleware.cpp b/src/port/GBIMiddleware.cpp
index da0809dc..68c3a3c6 100644
--- a/src/port/GBIMiddleware.cpp
+++ b/src/port/GBIMiddleware.cpp
@@ -2,7 +2,6 @@
#include "Engine.h"
#include "DisplayList.h"
-#include "Array.h"
extern "C" int GameEngine_OTRSigCheck(const char* data);
@@ -31,24 +30,16 @@ extern "C" void gSPVertex(Gfx* pkt, uintptr_t v, int n, int v0) {
}
extern "C" void gSPInvalidateTexCache(Gfx* pkt, uintptr_t texAddr) {
- auto data = reinterpret_cast<char*>(texAddr);
-
- if (texAddr != 0 && GameEngine_OTRSigCheck(data)) {
- const auto res = Ship::Context::GetInstance()->GetResourceManager()->LoadResource(data);
- const auto type = static_cast<LUS::ResourceType>(res->GetInitData()->Type);
-
- switch(type) {
- case LUS::ResourceType::DisplayList:
- texAddr = reinterpret_cast<uintptr_t>(&std::static_pointer_cast<LUS::DisplayList>(res)->Instructions[0]);
- break;
- case LUS::ResourceType::Array:
- texAddr = reinterpret_cast<uintptr_t>(std::static_pointer_cast<LUS::Array>(res)->Vertices.data());
- break;
- default:
- texAddr = reinterpret_cast<uintptr_t>(res->GetRawPointer());
- break;
+ char* imgData = (char*)texAddr;
+
+ if (texAddr != 0 && GameEngine_OTRSigCheck(imgData)) {
+ auto res = Ship::Context::GetInstance()->GetResourceManager()->LoadResource(imgData);
+
+ if (res->GetInitData()->Type == (uint32_t) LUS::ResourceType::DisplayList)
+ texAddr = (uintptr_t)&((std::static_pointer_cast<LUS::DisplayList>(res))->Instructions[0]);
+ else {
+ texAddr = (uintptr_t) res->GetRawPointer();
}
}
-
__gSPInvalidateTexCache(pkt, texAddr);
-}
+} \ No newline at end of file
diff --git a/src/port/ui/ImguiUI.cpp b/src/port/ui/ImguiUI.cpp
index f73353f0..442738fe 100644
--- a/src/port/ui/ImguiUI.cpp
+++ b/src/port/ui/ImguiUI.cpp
@@ -111,16 +111,15 @@ void DrawSettingsMenu(){
// })) {
// audio_set_player_volume(SEQ_PLAYER_ENV, CVarGetFloat("gEnvironmentVolume", 1.0f));
// }
- //
+
// static std::unordered_map<Ship::AudioBackend, const char*> audioBackendNames = {
// { Ship::AudioBackend::WASAPI, "Windows Audio Session API" },
- // { Ship::AudioBackend::PULSE, "PulseAudio" },
// { Ship::AudioBackend::SDL, "SDL" },
// };
- //
+
// ImGui::Text("Audio API (Needs reload)");
// auto currentAudioBackend = Ship::Context::GetInstance()->GetAudio()->GetAudioBackend();
- //
+
// if (Ship::Context::GetInstance()->GetAudio()->GetAvailableAudioBackends()->size() <= 1) {
// UIWidgets::DisableComponent(ImGui::GetStyle().Alpha * 0.5f);
// }
@@ -136,7 +135,7 @@ void DrawSettingsMenu(){
// if (Ship::Context::GetInstance()->GetAudio()->GetAvailableAudioBackends()->size() <= 1) {
// UIWidgets::ReEnableComponent("");
// }
- //
+
// ImGui::EndMenu();
// }
@@ -188,7 +187,7 @@ void DrawSettingsMenu(){
{ // FPS Slider
const int minFps = 30;
static int maxFps;
- if (Ship::Context::GetInstance()->GetWindow()->GetWindowBackend() == Ship::WindowBackend::DX11) {
+ if (Ship::Context::GetInstance()->GetWindow()->GetWindowBackend() == Ship::WindowBackend::FAST3D_DXGI_DX11) {
maxFps = 360;
} else {
maxFps = Ship::Context::GetInstance()->GetWindow()->GetCurrentRefreshRate();
@@ -256,12 +255,12 @@ void DrawSettingsMenu(){
Ship::Context::GetInstance()->GetWindow()->GetGui()->SaveConsoleVariablesOnNextTick();
#else
bool matchingRefreshRate =
- CVarGetInteger("gMatchRefreshRate", 0) && Ship::Context::GetInstance()->GetWindow()->GetWindowBackend() != Ship::WindowBackend::DX11;
+ CVarGetInteger("gMatchRefreshRate", 0) && Ship::Context::GetInstance()->GetWindow()->GetWindowBackend() != Ship::WindowBackend::FAST3D_DXGI_DX11;
UIWidgets::CVarSliderInt((currentFps == 20) ? "FPS: Original (20)" : "FPS: %d", "gInterpolationFPS", minFps, maxFps, 1, {
.disabled = matchingRefreshRate
});
#endif
- if (Ship::Context::GetInstance()->GetWindow()->GetWindowBackend() == Ship::WindowBackend::DX11) {
+ if (Ship::Context::GetInstance()->GetWindow()->GetWindowBackend() == Ship::WindowBackend::FAST3D_DXGI_DX11) {
UIWidgets::Tooltip(
"Uses Matrix Interpolation to create extra frames, resulting in smoother graphics. This is purely "
"visual and does not impact game logic, execution of glitches etc.\n\n"
@@ -275,7 +274,7 @@ void DrawSettingsMenu(){
}
} // END FPS Slider
- if (Ship::Context::GetInstance()->GetWindow()->GetWindowBackend() == Ship::WindowBackend::DX11) {
+ if (Ship::Context::GetInstance()->GetWindow()->GetWindowBackend() == Ship::WindowBackend::FAST3D_DXGI_DX11) {
UIWidgets::Spacer(0);
if (ImGui::Button("Match Refresh Rate")) {
int hz = Ship::Context::GetInstance()->GetWindow()->GetCurrentRefreshRate();
@@ -290,7 +289,7 @@ void DrawSettingsMenu(){
UIWidgets::Tooltip("Matches interpolation value to the current game's window refresh rate");
- if (Ship::Context::GetInstance()->GetWindow()->GetWindowBackend() == Ship::WindowBackend::DX11) {
+ if (Ship::Context::GetInstance()->GetWindow()->GetWindowBackend() == Ship::WindowBackend::FAST3D_DXGI_DX11) {
UIWidgets::PaddedEnhancementSliderInt(CVarGetInteger("gExtraLatencyThreshold", 80) == 0 ? "Jitter fix: Off" : "Jitter fix: >= %d FPS",
"##ExtraLatencyThreshold", "gExtraLatencyThreshold", 0, 360, "", 80, true, true, false);
UIWidgets::Tooltip("When Interpolation FPS setting is at least this threshold, add one frame of input lag (e.g. 16.6 ms for 60 FPS) in order to avoid jitter. This setting allows the CPU to work on one frame while GPU works on the previous frame.\nThis setting should be used when your computer is too slow to do CPU + GPU work in time.");
@@ -300,17 +299,16 @@ void DrawSettingsMenu(){
static std::unordered_map<Ship::WindowBackend, const char*> windowBackendNames = {
- { Ship::WindowBackend::DX11, "DirectX" },
- { Ship::WindowBackend::SDL_OPENGL, "OpenGL"},
- { Ship::WindowBackend::SDL_METAL, "Metal" },
- { Ship::WindowBackend::GX2, "GX2"}
+ { Ship::WindowBackend::FAST3D_DXGI_DX11, "DirectX" },
+ { Ship::WindowBackend::FAST3D_SDL_OPENGL, "OpenGL"},
+ { Ship::WindowBackend::FAST3D_SDL_METAL, "Metal" }
};
ImGui::Text("Renderer API (Needs reload)");
Ship::WindowBackend runningWindowBackend = Ship::Context::GetInstance()->GetWindow()->GetWindowBackend();
Ship::WindowBackend configWindowBackend;
int configWindowBackendId = Ship::Context::GetInstance()->GetConfig()->GetInt("Window.Backend.Id", -1);
- if (configWindowBackendId != -1 && configWindowBackendId < static_cast<int>(Ship::WindowBackend::BACKEND_COUNT)) {
+ if (configWindowBackendId != -1 && configWindowBackendId < static_cast<int>(Ship::WindowBackend::WINDOW_BACKEND_COUNT)) {
configWindowBackend = static_cast<Ship::WindowBackend>(configWindowBackendId);
} else {
configWindowBackend = runningWindowBackend;
@@ -364,7 +362,7 @@ void DrawSettingsMenu(){
void DrawMenuBarIcon() {
static bool gameIconLoaded = false;
if (!gameIconLoaded) {
- // Ship::Context::GetInstance()->GetWindow()->GetGui()->LoadTexture("Game_Icon", "textures/icons/gIcon.png");
+ // Ship::Context::GetInstance()->GetWindow()->GetGui()->LoadGuiTexture("Game_Icon", "textures/icons/gIcon.png", ImVec4(1.0f, 1.0f, 1.0f, 1.0f));
gameIconLoaded = false;
}