mirror of
https://github.com/izzy2lost/Starship.git
synced 2026-07-05 15:19:42 -07:00
Bump LUS (#191)
* Bump LUS (#190) * Bump LUS * Disabled shader-based linear conversion on metal * Fixed missing mInterpolationIndex * Bump LUS --------- Co-authored-by: KiritoDv <kiritodev01@gmail.com> * restore console * bump LUS * Reverted linear conversion on shader --------- Co-authored-by: KiritoDv <kiritodev01@gmail.com>
This commit is contained in:
co-authored by
KiritoDv
parent
a4a465151a
commit
54a4d76b6f
+34
-22
@@ -41,7 +41,7 @@
|
||||
#include "port/patches/DisplayListPatch.h"
|
||||
#include "port/mods/PortEnhancements.h"
|
||||
|
||||
#include <Fast3D/gfx_pc.h>
|
||||
#include <Fast3D/interpreter.h>
|
||||
#include <filesystem>
|
||||
|
||||
#ifdef __SWITCH__
|
||||
@@ -453,14 +453,16 @@ void GameEngine::RunCommands(Gfx* Commands, const std::vector<std::unordered_map
|
||||
return;
|
||||
}
|
||||
|
||||
auto interpreter = wnd->GetInterpreterWeak().lock().get();
|
||||
|
||||
// Process window events for resize, mouse, keyboard events
|
||||
wnd->HandleEvents();
|
||||
|
||||
gInterpolationIndex = 0;
|
||||
interpreter->mInterpolationIndex = 0;
|
||||
|
||||
for (const auto& m : mtx_replacements) {
|
||||
wnd->DrawAndRunGraphicsCommands(Commands, m);
|
||||
gInterpolationIndex++;
|
||||
interpreter->mInterpolationIndex++;
|
||||
}
|
||||
|
||||
bool curAltAssets = CVarGetInteger("gEnhancements.Mods.AlternateAssets", 0);
|
||||
@@ -616,8 +618,16 @@ extern "C" uint32_t GameEngine_GetSamplesPerFrame() {
|
||||
|
||||
// End
|
||||
|
||||
Fast::Interpreter* GameEngine_GetInterpreter() {
|
||||
return static_pointer_cast<Fast::Fast3dWindow>(Ship::Context::GetInstance()->GetWindow())
|
||||
->GetInterpreterWeak()
|
||||
.lock()
|
||||
.get();
|
||||
}
|
||||
|
||||
extern "C" float GameEngine_GetAspectRatio() {
|
||||
return gfx_current_dimensions.aspect_ratio;
|
||||
auto interpreter = GameEngine_GetInterpreter();
|
||||
return interpreter->mCurDimensions.aspect_ratio;
|
||||
}
|
||||
|
||||
extern "C" uint32_t GameEngine_GetGameVersion() {
|
||||
@@ -730,34 +740,33 @@ extern "C" uint32_t OTRGetCurrentHeight() {
|
||||
return GameEngine::Instance->context->GetWindow()->GetHeight();
|
||||
}
|
||||
|
||||
extern "C" float OTRGetAspectRatio() {
|
||||
return gfx_current_dimensions.aspect_ratio;
|
||||
}
|
||||
|
||||
extern "C" float OTRGetHUDAspectRatio() {
|
||||
if (CVarGetInteger("gHUDAspectRatio.Enabled", 0) == 0 || CVarGetInteger("gHUDAspectRatio.X", 0) == 0 || CVarGetInteger("gHUDAspectRatio.Y", 0) == 0)
|
||||
{
|
||||
return OTRGetAspectRatio();
|
||||
if (CVarGetInteger("gHUDAspectRatio.Enabled", 0) == 0 || CVarGetInteger("gHUDAspectRatio.X", 0) == 0 || CVarGetInteger("gHUDAspectRatio.Y", 0) == 0) {
|
||||
return GameEngine_GetAspectRatio();
|
||||
}
|
||||
return ((float)CVarGetInteger("gHUDAspectRatio.X", 1) / (float)CVarGetInteger("gHUDAspectRatio.Y", 1));
|
||||
}
|
||||
|
||||
extern "C" float OTRGetDimensionFromLeftEdge(float v) {
|
||||
return (gfx_native_dimensions.width / 2 - gfx_native_dimensions.height / 2 * OTRGetAspectRatio() + (v));
|
||||
auto interpreter = GameEngine_GetInterpreter();
|
||||
return (interpreter->mNativeDimensions.width / 2 - interpreter->mNativeDimensions.height / 2 * interpreter->mCurDimensions.aspect_ratio + (v));
|
||||
}
|
||||
|
||||
extern "C" float OTRGetDimensionFromRightEdge(float v) {
|
||||
return (gfx_native_dimensions.width / 2 + gfx_native_dimensions.height / 2 * OTRGetAspectRatio() -
|
||||
(gfx_native_dimensions.width - v));
|
||||
auto interpreter = GameEngine_GetInterpreter();
|
||||
return (interpreter->mNativeDimensions.width / 2 + interpreter->mNativeDimensions.height / 2 * interpreter->mCurDimensions.aspect_ratio -
|
||||
(interpreter->mNativeDimensions.width - v));
|
||||
}
|
||||
|
||||
extern "C" float OTRGetDimensionFromLeftEdgeForcedAspect(float v, float aspectRatio) {
|
||||
return (gfx_native_dimensions.width / 2 - gfx_native_dimensions.height / 2 * (aspectRatio > 0 ? aspectRatio : OTRGetAspectRatio()) + (v));
|
||||
auto interpreter = GameEngine_GetInterpreter();
|
||||
return (interpreter->mNativeDimensions.width / 2 - interpreter->mNativeDimensions.height / 2 * (aspectRatio > 0 ? aspectRatio : interpreter->mCurDimensions.aspect_ratio) + (v));
|
||||
}
|
||||
|
||||
extern "C" float OTRGetDimensionFromRightEdgeForcedAspect(float v, float aspectRatio) {
|
||||
return (gfx_native_dimensions.width / 2 + gfx_native_dimensions.height / 2 * (aspectRatio > 0 ? aspectRatio : OTRGetAspectRatio()) -
|
||||
(gfx_native_dimensions.width - v));
|
||||
auto interpreter = GameEngine_GetInterpreter();
|
||||
return (interpreter->mNativeDimensions.width / 2 + interpreter->mNativeDimensions.height / 2 * (aspectRatio > 0 ? aspectRatio : interpreter->mCurDimensions.aspect_ratio) -
|
||||
(interpreter->mNativeDimensions.width - v));
|
||||
}
|
||||
|
||||
extern "C" float OTRGetDimensionFromLeftEdgeOverride(float v) {
|
||||
@@ -770,12 +779,14 @@ extern "C" float OTRGetDimensionFromRightEdgeOverride(float v) {
|
||||
|
||||
// Gets the width of the current render target area
|
||||
extern "C" uint32_t OTRGetGameRenderWidth() {
|
||||
return gfx_current_dimensions.width;
|
||||
auto interpreter = GameEngine_GetInterpreter();
|
||||
return interpreter->mCurDimensions.width;
|
||||
}
|
||||
|
||||
// Gets the height of the current render target area
|
||||
extern "C" uint32_t OTRGetGameRenderHeight() {
|
||||
return gfx_current_dimensions.height;
|
||||
auto interpreter = GameEngine_GetInterpreter();
|
||||
return interpreter->mCurDimensions.height;
|
||||
}
|
||||
|
||||
extern "C" int16_t OTRGetRectDimensionFromLeftEdge(float v) {
|
||||
@@ -803,9 +814,10 @@ extern "C" int16_t OTRGetRectDimensionFromRightEdgeOverride(float v) {
|
||||
}
|
||||
|
||||
extern "C" int32_t OTRConvertHUDXToScreenX(int32_t v) {
|
||||
float gameAspectRatio = gfx_current_dimensions.aspect_ratio;
|
||||
int32_t gameHeight = gfx_current_dimensions.height;
|
||||
int32_t gameWidth = gfx_current_dimensions.width;
|
||||
auto interpreter = GameEngine_GetInterpreter();
|
||||
float gameAspectRatio = interpreter->mCurDimensions.aspect_ratio;
|
||||
int32_t gameHeight = interpreter->mCurDimensions.height;
|
||||
int32_t gameWidth = interpreter->mCurDimensions.width;
|
||||
float hudAspectRatio = 4.0f / 3.0f;
|
||||
int32_t hudHeight = gameHeight;
|
||||
int32_t hudWidth = hudHeight * hudAspectRatio;
|
||||
|
||||
Reference in New Issue
Block a user