Bump LUS to latest, and handle tinyxml and gfx_pc changes. (#5470)

This commit is contained in:
Malkierian 2025-05-16 21:14:55 -07:00 committed by GitHub
commit b900f8599a
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
42 changed files with 110 additions and 15 deletions

@ -1 +1 @@
Subproject commit ffc062cbf44ce8dc07ac9fc0185224010bd78cc5
Subproject commit ce38cb6883ca030e61749eae584b6d9a7cb7bca5

View file

@ -51,7 +51,7 @@
#include "Extractor/Extract.h"
#endif
#include <Fast3D/gfx_pc.h>
#include <Fast3D/interpreter.h>
#ifdef __APPLE__
#include <SDL_scancode.h>
@ -1899,7 +1899,7 @@ extern "C" void OTRControllerCallback(uint8_t rumble) {
}
extern "C" float OTRGetAspectRatio() {
return gfx_current_dimensions.aspect_ratio;
return Ship::Context::GetInstance()->GetWindow()->GetAspectRatio();
}
extern "C" float OTRGetDimensionFromLeftEdge(float v) {
@ -1912,12 +1912,34 @@ extern "C" float OTRGetDimensionFromRightEdge(float v) {
// Gets the width of the current render target area
extern "C" uint32_t OTRGetGameRenderWidth() {
return gfx_current_dimensions.width;
auto fastWnd = dynamic_pointer_cast<Fast::Fast3dWindow>(Ship::Context::GetInstance()->GetWindow());
auto intP = fastWnd->GetInterpreterWeak().lock();
if (!intP) {
assert(false && "Lost reference to Fast::Interpreter");
return 320;
}
uint32_t height, width;
intP->GetCurDimensions(&width, &height);
return width;
}
// Gets the height of the current render target area
extern "C" uint32_t OTRGetGameRenderHeight() {
return gfx_current_dimensions.height;
auto fastWnd = dynamic_pointer_cast<Fast::Fast3dWindow>(Ship::Context::GetInstance()->GetWindow());
auto intP = fastWnd->GetInterpreterWeak().lock();
if (!intP) {
assert(false && "Lost reference to Fast::Interpreter");
return 240;
}
uint32_t height, width;
intP->GetCurDimensions(&width, &height);
return height;
}
f32 floorf(f32 x); // RANDOTODO False positive error "allowing all exceptions is incompatible with previous function"
@ -2496,11 +2518,23 @@ extern "C" void EntranceTracker_SetLastEntranceOverride(s16 entranceIndex) {
}
extern "C" void Gfx_RegisterBlendedTexture(const char* name, u8* mask, u8* replacement) {
gfx_register_blended_texture(name, mask, replacement);
if (auto intP = dynamic_pointer_cast<Fast::Fast3dWindow>(Ship::Context::GetInstance()->GetWindow())
->GetInterpreterWeak()
.lock()) {
intP->RegisterBlendedTexture(name, mask, replacement);
} else {
assert(false && "Lost reference to Fast::Interpreter");
}
}
extern "C" void Gfx_UnregisterBlendedTexture(const char* name) {
gfx_unregister_blended_texture(name);
if (auto intP = dynamic_pointer_cast<Fast::Fast3dWindow>(Ship::Context::GetInstance()->GetWindow())
->GetInterpreterWeak()
.lock()) {
intP->UnregisterBlendedTexture(name);
} else {
assert(false && "Lost reference to Fast::Interpreter");
}
}
extern "C" void Gfx_TextureCacheDelete(const uint8_t* texAddr) {
@ -2514,7 +2548,13 @@ extern "C" void Gfx_TextureCacheDelete(const uint8_t* texAddr) {
texAddr = (const uint8_t*)ResourceMgr_GetResourceDataByNameHandlingMQ(imgName);
}
gfx_texture_cache_delete(texAddr);
if (auto intP = dynamic_pointer_cast<Fast::Fast3dWindow>(Ship::Context::GetInstance()->GetWindow())
->GetInterpreterWeak()
.lock()) {
intP->TextureCacheDelete(texAddr);
} else {
assert(false && "Lost reference to Fast::Interpreter");
}
}
void SoH_ProcessDroppedFiles(std::string filePath) {

View file

@ -11,7 +11,7 @@
#include "resource/type/Array.h"
#include "resource/type/Skeleton.h"
#include "resource/type/PlayerAnimation.h"
#include <Fast3D/gfx_pc.h>
#include <Fast3D/Fast3dWindow.h>
#include <DisplayList.h>
extern "C" PlayState* gPlayState;
@ -292,7 +292,7 @@ extern "C" char* ResourceMgr_LoadPlayerAnimByName(const char* animPath) {
}
extern "C" void ResourceMgr_PushCurrentDirectory(char* path) {
gfx_push_current_dir(path);
Fast::gfx_push_current_dir(path);
}
extern "C" Gfx* ResourceMgr_LoadGfxByName(const char* path) {

View file

@ -1,5 +1,6 @@
#include "ImGuiUtils.h"
#include <Context.h>
#include <Window.h>
#include "assets/soh_assets.h"
#include "soh/Enhancements/randomizer/rando_hash.h"

View file

@ -3,7 +3,8 @@
#include <libultraship/libultraship.h>
#include "soh/SohGui/UIWidgets.hpp"
#include <graphic/Fast3D/gfx_pc.h>
#include <graphic/Fast3D/Fast3dWindow.h>
#include <graphic/Fast3D/interpreter.h>
#include "soh/OTRGlobals.h"
#include "soh/SohGui/SohMenu.h"
#include "soh/SohGui/SohGui.hpp"
@ -86,6 +87,16 @@ static bool disabled_pixelCount;
using namespace UIWidgets;
static std::weak_ptr<Fast::Interpreter> mInterpreter;
std::shared_ptr<Fast::Interpreter> GetInterpreter() {
auto intP = mInterpreter.lock();
if (!intP) {
assert(false && "Lost reference to Fast::Interpreter");
}
return intP;
}
void ResolutionCustomWidget(WidgetInfo& info) {
ImGui::BeginDisabled(disabled_everything);
// Vertical Resolution
@ -368,18 +379,23 @@ void ResolutionCustomWidget(WidgetInfo& info) {
}
void RegisterResolutionWidgets() {
auto fastWnd = dynamic_pointer_cast<Fast::Fast3dWindow>(Ship::Context::GetInstance()->GetWindow());
mInterpreter = fastWnd->GetInterpreterWeak();
WidgetPath path = { "Settings", "Graphics", SECTION_COLUMN_2 };
// Resolution visualiser
mSohMenu->AddWidget(path, "Viewport dimensions: {} x {}", WIDGET_TEXT)
.RaceDisable(false)
.PreFunc([](WidgetInfo& info) {
auto gfx_current_game_window_viewport = GetInterpreter().get()->mGameWindowViewport;
info.name = fmt::format("Viewport dimensions: {} x {}", gfx_current_game_window_viewport.width,
gfx_current_game_window_viewport.height);
});
mSohMenu->AddWidget(path, "Internal resolution: {} x {}", WIDGET_TEXT)
.RaceDisable(false)
.PreFunc([](WidgetInfo& info) {
auto gfx_current_dimensions = GetInterpreter().get()->mCurDimensions;
info.name = fmt::format("Internal resolution: {} x {}", gfx_current_dimensions.width,
gfx_current_dimensions.height);
});
@ -486,6 +502,7 @@ void RegisterResolutionWidgets() {
}
} else if (showHorizontalResField) { // Show calculated aspect ratio
if (item_aspectRatio) {
auto gfx_current_dimensions = GetInterpreter().get()->mCurDimensions;
ImGui::Dummy({ 0, 2 });
const float resolvedAspectRatio =
(float)gfx_current_dimensions.width / gfx_current_dimensions.height;
@ -539,6 +556,8 @@ void UpdateResolutionVars() {
short integerScale_maximumBounds = 1; // can change when window is resized
// This is mostly just for UX purposes, as Fit Automatically logic is part of LUS.
auto gfx_current_game_window_viewport = GetInterpreter().get()->mGameWindowViewport;
auto gfx_current_dimensions = GetInterpreter().get()->mCurDimensions;
if (((float)gfx_current_game_window_viewport.width / gfx_current_game_window_viewport.height) >
((float)gfx_current_dimensions.width / gfx_current_dimensions.height)) {
// Scale to window height

View file

@ -11,7 +11,6 @@
#include <imgui.h>
#include <imgui_internal.h>
#include <libultraship/libultraship.h>
#include <Fast3D/gfx_pc.h>
#ifdef __APPLE__
#include "graphic/Fast3D/gfx_metal.h"

View file

@ -20,7 +20,7 @@ ResourceFactoryBinaryArrayV0::ReadResource(std::shared_ptr<Ship::File> file,
for (uint32_t i = 0; i < array->ArrayCount; i++) {
if (array->ArrayType == ArrayResourceType::Vertex) {
// OTRTODO: Implement Vertex arrays as just a vertex resource.
F3DVtx data;
Fast::F3DVtx data;
data.v.ob[0] = reader->ReadInt16();
data.v.ob[1] = reader->ReadInt16();
data.v.ob[2] = reader->ReadInt16();

View file

@ -1,6 +1,7 @@
#include "soh/resource/importer/CollisionHeaderFactory.h"
#include "soh/resource/type/CollisionHeader.h"
#include "spdlog/spdlog.h"
#include <tinyxml2.h>
namespace SOH {
std::shared_ptr<Ship::IResource>

View file

@ -2,6 +2,7 @@
#include "soh/resource/type/Path.h"
#include "soh/resource/logging/PathLogger.h"
#include "spdlog/spdlog.h"
#include <tinyxml2.h>
namespace SOH {
std::shared_ptr<Ship::IResource>

View file

@ -1,4 +1,5 @@
#include "spdlog/spdlog.h"
#include <tinyxml2.h>
#include "soh/resource/type/SohResourceType.h"
#include "soh/resource/importer/SceneFactory.h"
#include "soh/resource/type/Scene.h"

View file

@ -1,6 +1,7 @@
#include "soh/resource/importer/SkeletonFactory.h"
#include "soh/resource/type/Skeleton.h"
#include <spdlog/spdlog.h>
#include <tinyxml2.h>
#include <libultraship/libultraship.h>
namespace SOH {

View file

@ -1,6 +1,7 @@
#include "soh/resource/importer/SkeletonLimbFactory.h"
#include "soh/resource/type/SkeletonLimb.h"
#include "spdlog/spdlog.h"
#include <tinyxml2.h>
#include "libultraship/libultraship.h"
namespace SOH {

View file

@ -1,6 +1,7 @@
#include "soh/resource/importer/TextFactory.h"
#include "soh/resource/type/Text.h"
#include "spdlog/spdlog.h"
#include <tinyxml2.h>
namespace SOH {
std::shared_ptr<Ship::IResource>

View file

@ -2,6 +2,7 @@
#include "soh/resource/type/scenecommand/EndMarker.h"
#include "soh/resource/logging/SceneCommandLoggers.h"
#include "spdlog/spdlog.h"
#include <tinyxml2.h>
namespace SOH {
std::shared_ptr<Ship::IResource> EndMarkerFactory::ReadResource(std::shared_ptr<Ship::ResourceInitData> initData,

View file

@ -2,6 +2,7 @@
#include "soh/resource/type/scenecommand/SetActorList.h"
#include "soh/resource/logging/SceneCommandLoggers.h"
#include "spdlog/spdlog.h"
#include <tinyxml2.h>
namespace SOH {
std::shared_ptr<Ship::IResource> SetActorListFactory::ReadResource(std::shared_ptr<Ship::ResourceInitData> initData,

View file

@ -2,6 +2,7 @@
#include "soh/resource/type/scenecommand/SetAlternateHeaders.h"
#include "soh/resource/logging/SceneCommandLoggers.h"
#include "spdlog/spdlog.h"
#include <tinyxml2.h>
#include "libultraship/libultraship.h"
namespace SOH {

View file

@ -2,6 +2,7 @@
#include "soh/resource/type/scenecommand/SetCameraSettings.h"
#include "soh/resource/logging/SceneCommandLoggers.h"
#include "spdlog/spdlog.h"
#include <tinyxml2.h>
namespace SOH {
std::shared_ptr<Ship::IResource>

View file

@ -3,6 +3,7 @@
#include "soh/resource/logging/SceneCommandLoggers.h"
#include "libultraship/libultraship.h"
#include "spdlog/spdlog.h"
#include <tinyxml2.h>
namespace SOH {
std::shared_ptr<Ship::IResource>

View file

@ -2,6 +2,7 @@
#include "soh/resource/type/scenecommand/SetCsCamera.h"
#include "soh/resource/logging/SceneCommandLoggers.h"
#include "spdlog/spdlog.h"
#include <tinyxml2.h>
namespace SOH {
std::shared_ptr<Ship::IResource> SetCsCameraFactory::ReadResource(std::shared_ptr<Ship::ResourceInitData> initData,

View file

@ -3,6 +3,7 @@
#include "soh/resource/logging/SceneCommandLoggers.h"
#include <libultraship/libultraship.h>
#include "spdlog/spdlog.h"
#include <tinyxml2.h>
namespace SOH {
std::shared_ptr<Ship::IResource> SetCutscenesFactory::ReadResource(std::shared_ptr<Ship::ResourceInitData> initData,

View file

@ -2,6 +2,7 @@
#include "soh/resource/type/scenecommand/SetEchoSettings.h"
#include "soh/resource/logging/SceneCommandLoggers.h"
#include "spdlog/spdlog.h"
#include <tinyxml2.h>
namespace SOH {
std::shared_ptr<Ship::IResource> SetEchoSettingsFactory::ReadResource(std::shared_ptr<Ship::ResourceInitData> initData,

View file

@ -2,6 +2,7 @@
#include "soh/resource/type/scenecommand/SetEntranceList.h"
#include "soh/resource/logging/SceneCommandLoggers.h"
#include "spdlog/spdlog.h"
#include <tinyxml2.h>
namespace SOH {
std::shared_ptr<Ship::IResource> SetEntranceListFactory::ReadResource(std::shared_ptr<Ship::ResourceInitData> initData,

View file

@ -2,6 +2,7 @@
#include "soh/resource/type/scenecommand/SetExitList.h"
#include "soh/resource/logging/SceneCommandLoggers.h"
#include "spdlog/spdlog.h"
#include <tinyxml2.h>
namespace SOH {
std::shared_ptr<Ship::IResource> SetExitListFactory::ReadResource(std::shared_ptr<Ship::ResourceInitData> initData,

View file

@ -2,6 +2,7 @@
#include "soh/resource/type/scenecommand/SetLightList.h"
#include "soh/resource/logging/SceneCommandLoggers.h"
#include "spdlog/spdlog.h"
#include <tinyxml2.h>
namespace SOH {
std::shared_ptr<Ship::IResource> SetLightListFactory::ReadResource(std::shared_ptr<Ship::ResourceInitData> initData,

View file

@ -2,6 +2,7 @@
#include "soh/resource/type/scenecommand/SetLightingSettings.h"
#include "soh/resource/logging/SceneCommandLoggers.h"
#include "spdlog/spdlog.h"
#include <tinyxml2.h>
namespace SOH {
std::shared_ptr<Ship::IResource>

View file

@ -2,6 +2,7 @@
#include "soh/resource/type/scenecommand/SetMesh.h"
#include "soh/resource/logging/SceneCommandLoggers.h"
#include "spdlog/spdlog.h"
#include <tinyxml2.h>
#include "libultraship/libultraship.h"
namespace SOH {

View file

@ -2,6 +2,7 @@
#include "soh/resource/type/scenecommand/SetObjectList.h"
#include "soh/resource/logging/SceneCommandLoggers.h"
#include "spdlog/spdlog.h"
#include <tinyxml2.h>
namespace SOH {
std::shared_ptr<Ship::IResource> SetObjectListFactory::ReadResource(std::shared_ptr<Ship::ResourceInitData> initData,

View file

@ -2,6 +2,7 @@
#include "soh/resource/type/scenecommand/SetPathways.h"
#include "soh/resource/logging/SceneCommandLoggers.h"
#include "spdlog/spdlog.h"
#include <tinyxml2.h>
#include <libultraship/libultraship.h>
namespace SOH {

View file

@ -2,6 +2,7 @@
#include "soh/resource/type/scenecommand/SetRoomBehavior.h"
#include "soh/resource/logging/SceneCommandLoggers.h"
#include "spdlog/spdlog.h"
#include <tinyxml2.h>
namespace SOH {
std::shared_ptr<Ship::IResource> SetRoomBehaviorFactory::ReadResource(std::shared_ptr<Ship::ResourceInitData> initData,

View file

@ -2,6 +2,7 @@
#include "soh/resource/type/scenecommand/SetRoomList.h"
#include "soh/resource/logging/SceneCommandLoggers.h"
#include "spdlog/spdlog.h"
#include <tinyxml2.h>
namespace SOH {
std::shared_ptr<Ship::IResource> SetRoomListFactory::ReadResource(std::shared_ptr<Ship::ResourceInitData> initData,

View file

@ -2,6 +2,7 @@
#include "soh/resource/type/scenecommand/SetSkyboxModifier.h"
#include "soh/resource/logging/SceneCommandLoggers.h"
#include "spdlog/spdlog.h"
#include <tinyxml2.h>
namespace SOH {
std::shared_ptr<Ship::IResource>

View file

@ -2,6 +2,7 @@
#include "soh/resource/type/scenecommand/SetSkyboxSettings.h"
#include "soh/resource/logging/SceneCommandLoggers.h"
#include "spdlog/spdlog.h"
#include <tinyxml2.h>
namespace SOH {
std::shared_ptr<Ship::IResource>

View file

@ -2,6 +2,7 @@
#include "soh/resource/type/scenecommand/SetSoundSettings.h"
#include "soh/resource/logging/SceneCommandLoggers.h"
#include "spdlog/spdlog.h"
#include <tinyxml2.h>
namespace SOH {
std::shared_ptr<Ship::IResource> SetSoundSettingsFactory::ReadResource(std::shared_ptr<Ship::ResourceInitData> initData,

View file

@ -2,6 +2,7 @@
#include "soh/resource/type/scenecommand/SetSpecialObjects.h"
#include "soh/resource/logging/SceneCommandLoggers.h"
#include "spdlog/spdlog.h"
#include <tinyxml2.h>
namespace SOH {
std::shared_ptr<Ship::IResource>

View file

@ -2,6 +2,7 @@
#include "soh/resource/type/scenecommand/SetStartPositionList.h"
#include "soh/resource/logging/SceneCommandLoggers.h"
#include "spdlog/spdlog.h"
#include <tinyxml2.h>
namespace SOH {
std::shared_ptr<Ship::IResource>

View file

@ -2,6 +2,7 @@
#include "soh/resource/type/scenecommand/SetTimeSettings.h"
#include "soh/resource/logging/SceneCommandLoggers.h"
#include "spdlog/spdlog.h"
#include <tinyxml2.h>
namespace SOH {
std::shared_ptr<Ship::IResource> SetTimeSettingsFactory::ReadResource(std::shared_ptr<Ship::ResourceInitData> initData,

View file

@ -2,6 +2,7 @@
#include "soh/resource/type/scenecommand/SetTransitionActorList.h"
#include "soh/resource/logging/SceneCommandLoggers.h"
#include "spdlog/spdlog.h"
#include <tinyxml2.h>
namespace SOH {
std::shared_ptr<Ship::IResource>

View file

@ -2,6 +2,7 @@
#include "soh/resource/type/scenecommand/SetWindSettings.h"
#include "soh/resource/logging/SceneCommandLoggers.h"
#include "spdlog/spdlog.h"
#include <tinyxml2.h>
namespace SOH {
std::shared_ptr<Ship::IResource> SetWindSettingsFactory::ReadResource(std::shared_ptr<Ship::ResourceInitData> initData,

View file

@ -1,5 +1,6 @@
#include "soh/resource/type/Path.h"
#include "spdlog/spdlog.h"
#include <tinyxml2.h>
namespace SOH {
void LogPathAsXML(std::shared_ptr<Ship::IResource> resource) {

View file

@ -24,6 +24,7 @@
#include "soh/resource/type/scenecommand/SetTransitionActorList.h"
#include "soh/resource/type/scenecommand/SetWindSettings.h"
#include "spdlog/spdlog.h"
#include <tinyxml2.h>
#include <string.h>
namespace SOH {

View file

@ -23,7 +23,7 @@ size_t Array::GetPointerSize() {
size_t typeSize = 0;
switch (ArrayType) {
case ArrayResourceType::Vertex:
typeSize = sizeof(F3DVtx);
typeSize = sizeof(Fast::F3DVtx);
break;
case ArrayResourceType::Scalar:
default:

View file

@ -2,7 +2,10 @@
#include "resource/Resource.h"
namespace Fast {
union F3DVtx;
}
namespace SOH {
typedef union ScalarData {
uint8_t u8;
@ -80,6 +83,6 @@ class Array : public Ship::Resource<void> {
size_t ArrayCount;
// OTRTODO: Should be a vector of resource pointers...
std::vector<ScalarData> Scalars;
std::vector<F3DVtx> Vertices;
std::vector<Fast::F3DVtx> Vertices;
};
} // namespace SOH