Lus window bump (#4131)

This commit is contained in:
Kenix3 2024-05-08 02:25:50 -04:00 committed by GitHub
parent 0976198f2c
commit 3c87c1ec98
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 24 additions and 12 deletions

@ -1 +1 @@
Subproject commit 97b11c9601178ff02e141b7398f5d50ddf91fdc4 Subproject commit 61e304d21fe00b5b1de49998b16c510615ad7b44

View File

@ -7,6 +7,7 @@
#include <chrono> #include <chrono>
#include <ResourceManager.h> #include <ResourceManager.h>
#include "graphic/Fast3D/Fast3dWindow.h"
#include <File.h> #include <File.h>
#include <DisplayList.h> #include <DisplayList.h>
#include <Window.h> #include <Window.h>
@ -1253,11 +1254,6 @@ extern "C" uint64_t GetUnixTimestamp() {
return (uint64_t)millis.count(); return (uint64_t)millis.count();
} }
// C->C++ Bridge
extern "C" void Graph_ProcessFrame(void (*run_one_game_iter)(void)) {
OTRGlobals::Instance->context->GetWindow()->MainLoop(run_one_game_iter);
}
extern bool ToggleAltAssetsAtEndOfFrame; extern bool ToggleAltAssetsAtEndOfFrame;
extern "C" void Graph_StartFrame() { extern "C" void Graph_StartFrame() {
@ -1381,6 +1377,7 @@ extern "C" void Graph_ProcessGfxCommands(Gfx* commands) {
static int time; static int time;
int fps = target_fps; int fps = target_fps;
int original_fps = 60 / R_UPDATE_RATE; int original_fps = 60 / R_UPDATE_RATE;
auto wnd = std::dynamic_pointer_cast<Fast::Fast3dWindow>(Ship::Context::GetInstance()->GetWindow());
if (target_fps == 20 || original_fps > target_fps) { if (target_fps == 20 || original_fps > target_fps) {
fps = original_fps; fps = original_fps;
@ -1404,10 +1401,12 @@ extern "C" void Graph_ProcessGfxCommands(Gfx* commands) {
time -= fps; time -= fps;
OTRGlobals::Instance->context->GetWindow()->SetTargetFps(fps); if (wnd != nullptr) {
wnd->SetTargetFps(fps);
}
int threshold = CVarGetInteger(CVAR_SETTING("ExtraLatencyThreshold"), 80); int threshold = CVarGetInteger(CVAR_SETTING("ExtraLatencyThreshold"), 80);
OTRGlobals::Instance->context->GetWindow()->SetMaximumFrameLatency(threshold > 0 && target_fps >= threshold ? 2 : 1); wnd->SetMaximumFrameLatency(threshold > 0 && target_fps >= threshold ? 2 : 1);
RunCommands(commands, mtx_replacements); RunCommands(commands, mtx_replacements);
@ -1440,11 +1439,21 @@ extern "C" void Graph_ProcessGfxCommands(Gfx* commands) {
float divisor_num = 0.0f; float divisor_num = 0.0f;
extern "C" void OTRGetPixelDepthPrepare(float x, float y) { extern "C" void OTRGetPixelDepthPrepare(float x, float y) {
OTRGlobals::Instance->context->GetWindow()->GetPixelDepthPrepare(x, y); auto wnd = std::dynamic_pointer_cast<Fast::Fast3dWindow>(Ship::Context::GetInstance()->GetWindow());
if (wnd == nullptr) {
return;
}
wnd->GetPixelDepthPrepare(x, y);
} }
extern "C" uint16_t OTRGetPixelDepth(float x, float y) { extern "C" uint16_t OTRGetPixelDepth(float x, float y) {
return OTRGlobals::Instance->context->GetWindow()->GetPixelDepth(x, y); auto wnd = std::dynamic_pointer_cast<Fast::Fast3dWindow>(Ship::Context::GetInstance()->GetWindow());
if (wnd == nullptr) {
return 0;
}
return wnd->GetPixelDepth(x, y);
} }
extern "C" uint32_t ResourceMgr_GetNumGameVersions() { extern "C" uint32_t ResourceMgr_GetNumGameVersions() {

View File

@ -8,6 +8,7 @@
#include <libultraship/libultraship.h> #include <libultraship/libultraship.h>
#include "UIWidgets.hpp" #include "UIWidgets.hpp"
#include "include/z64audio.h" #include "include/z64audio.h"
#include "graphic/Fast3D/gfx_rendering_api.h"
#include "OTRGlobals.h" #include "OTRGlobals.h"
#include "z64.h" #include "z64.h"
#include "Enhancements/game-interactor/GameInteractor.h" #include "Enhancements/game-interactor/GameInteractor.h"

View File

@ -10,6 +10,7 @@
#include "soh/Enhancements/debugger/valueViewer.h" #include "soh/Enhancements/debugger/valueViewer.h"
#include "soh/Enhancements/gameconsole.h" #include "soh/Enhancements/gameconsole.h"
#include "soh/OTRGlobals.h" #include "soh/OTRGlobals.h"
#include "libultraship/bridge.h"
#define GFXPOOL_HEAD_MAGIC 0x1234 #define GFXPOOL_HEAD_MAGIC 0x1234
#define GFXPOOL_TAIL_MAGIC 0x5678 #define GFXPOOL_TAIL_MAGIC 0x5678
@ -541,8 +542,9 @@ static void RunFrame()
} }
void Graph_ThreadEntry(void* arg0) { void Graph_ThreadEntry(void* arg0) {
while (WindowIsRunning()) {
Graph_ProcessFrame(RunFrame); RunFrame();
}
} }
void* Graph_Alloc(GraphicsContext* gfxCtx, size_t size) { void* Graph_Alloc(GraphicsContext* gfxCtx, size_t size) {