bump latest lus; window changes; header updates (#345)

This commit is contained in:
Archez 2024-05-09 13:53:18 -04:00 committed by Garrett Cox
parent 140b45c5c5
commit df1976cd36
12 changed files with 55 additions and 44 deletions

2
ZAPDTR

@ -1 +1 @@
Subproject commit 2b8794fc208de3b5db33977ebcea0b539574cd15
Subproject commit ce2d63d8dd594a8ebc35073868d071aa36258317

@ -1 +1 @@
Subproject commit 0a45004554c0917c771300957a7cd87271516965
Subproject commit 0da318c0f4e431313565cad546fc469b8e850388

View File

@ -3,6 +3,7 @@
#include <imgui.h>
#include "public/bridge/consolevariablebridge.h"
#include <libultraship/libultraship.h>
#include "graphic/Fast3D/gfx_rendering_api.h"
#include "UIWidgets.hpp"
#include <unordered_map>
#include <string>

View File

@ -6,6 +6,7 @@
#include <chrono>
#include <ResourceManager.h>
#include "graphic/Fast3D/Fast3dWindow.h"
#include <File.h>
#include <DisplayList.h>
#include <Window.h>
@ -20,11 +21,6 @@
#include <time.h>
#endif
#include <Array.h>
#include <stb/stb_image.h>
#define DRMP3_IMPLEMENTATION
#include <dr_libs/mp3.h>
#define DRWAV_IMPLEMENTATION
#include <dr_libs/wav.h>
#include <AudioPlayer.h>
#include "variables.h"
#include "z64.h"
@ -524,11 +520,6 @@ extern "C" uint64_t GetUnixTimestamp() {
return now;
}
// 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 ShouldClearTextureCacheAtEndOfFrame;
extern "C" void Graph_StartFrame() {
@ -644,6 +635,7 @@ extern "C" void Graph_ProcessGfxCommands(Gfx* commands) {
static int time;
int fps = target_fps;
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) {
fps = original_fps;
@ -667,11 +659,12 @@ extern "C" void Graph_ProcessGfxCommands(Gfx* commands) {
time -= fps;
OTRGlobals::Instance->context->GetWindow()->SetTargetFps(fps);
int threshold = CVarGetInteger("gExtraLatencyThreshold", 80);
OTRGlobals::Instance->context->GetWindow()->SetMaximumFrameLatency(threshold > 0 && target_fps >= threshold ? 2
: 1);
if (wnd != nullptr) {
wnd->SetTargetFps(fps);
wnd->SetMaximumFrameLatency(threshold > 0 && target_fps >= threshold ? 2 : 1);
}
// When the gfx debugger is active, only run with the final mtx
if (GfxDebuggerIsDebugging()) {
@ -708,13 +701,25 @@ float divisor_num = 0.0f;
extern "C" void OTRGetPixelDepthPrepare(float x, float y) {
// Invert the Y value to match the origin values used in the renderer
float adjustedY = SCREEN_HEIGHT - y;
OTRGlobals::Instance->context->GetWindow()->GetPixelDepthPrepare(x, adjustedY);
auto wnd = std::dynamic_pointer_cast<Fast::Fast3dWindow>(Ship::Context::GetInstance()->GetWindow());
if (wnd == nullptr) {
return;
}
wnd->GetPixelDepthPrepare(x, adjustedY);
}
extern "C" uint16_t OTRGetPixelDepth(float x, float y) {
// Invert the Y value to match the origin values used in the renderer
float adjustedY = SCREEN_HEIGHT - y;
return OTRGlobals::Instance->context->GetWindow()->GetPixelDepth(x, adjustedY);
auto wnd = std::dynamic_pointer_cast<Fast::Fast3dWindow>(Ship::Context::GetInstance()->GetWindow());
if (wnd == nullptr) {
return 0;
}
return wnd->GetPixelDepth(x, adjustedY);
}
extern "C" uint32_t ResourceMgr_GetNumGameVersions() {
@ -1037,7 +1042,7 @@ extern "C" void ResourceMgr_PatchGfxCopyCommandByName(const char* path, const ch
}
Gfx* destinationGfx = (Gfx*)&res->Instructions[destinationIndex];
Gfx sourceGfx = res->Instructions[sourceIndex];
Gfx sourceGfx = *(Gfx*)&res->Instructions[sourceIndex];
if (!originalGfx.contains(path) || !originalGfx[path].contains(patchName)) {
originalGfx[path][patchName] = { destinationIndex, *destinationGfx };

View File

@ -1,7 +1,6 @@
#include "DeveloperTools.h"
#include "BenPort.h"
#include <libultraship/libultraship.h>
#include <spdlog/spdlog.h>
#include "2s2h/Enhancements/GameInteractor/GameInteractor.h"
extern "C" {

View File

@ -1,6 +1,10 @@
#ifndef PR_GU_H
#define PR_GU_H
#include <libultraship/libultra/gu.h>
#if 0
#include "ultratypes.h"
#include "gbi.h"
@ -48,6 +52,7 @@ void guMtxL2F(float m1[4][4], Mtx* m2);
void guNormalize(float* x, float* y, float* z);
#endif // 0
f32 sinf(f32 __x);
f32 cosf(f32 __x);
@ -60,4 +65,5 @@ f32 sqrtf(f32 f);
#pragma intrinsic(sqrtf);
#endif
#endif

View File

@ -1,6 +1,10 @@
#ifndef PR_OS_AI_H
#define PR_OS_AI_H
#include <libultraship/libultra/os.h>
#if 0
#include "ultratypes.h"
@ -8,5 +12,6 @@ u32 osAiGetLength(void);
s32 osAiSetFrequency(u32 frequency);
s32 osAiSetNextBuffer(void* buf, u32 size);
#endif // 0
#endif

View File

@ -1,6 +1,10 @@
#ifndef PR_OS_CACHE_H
#define PR_OS_CACHE_H
#include <libultraship/libultra/os.h>
#if 0
#include "ultratypes.h"
#include "libc/stddef.h"
@ -9,4 +13,6 @@ void osInvalICache(void* vaddr, size_t nbytes);
void osWritebackDCache(void* vaddr, s32 nbytes);
void osWritebackDCacheAll(void);
#endif // 0
#endif

View File

@ -1,6 +1,10 @@
#ifndef PR_OS_MOTOR_H
#define PR_OS_MOTOR_H
#include <libultraship/libultra/motor.h>
#if 0
#include "ultratypes.h"
#include "os_pfs.h"
#include "os_message.h"
@ -15,4 +19,6 @@ s32 __osMotorAccess(OSPfs* pfs, s32 flag);
s32 osMotorInit(OSMesgQueue* mq, OSPfs* pfs, s32 channel);
#endif // 0
#endif

View File

@ -3,6 +3,8 @@
//! Note that this is not the same as the original libultra
//! osAiSetNextBuffer, see comments in the function
#if 0
s32 osAiSetNextBuffer(void* buf, u32 size) {
static u8 D_801D6010 = false;
uintptr_t bufAdjusted = (uintptr_t)buf;
@ -30,6 +32,8 @@ s32 osAiSetNextBuffer(void* buf, u32 size) {
return 0;
}
#endif // 0
//! Note that the remaining data and functions are unused and not part of the
//! original libultra osAiSetNextBuffer

View File

@ -433,7 +433,9 @@ void RunFrame() {
}
void Graph_ThreadEntry(void* arg0) {
Graph_ProcessFrame(RunFrame);
while (WindowIsRunning()) {
RunFrame();
}
}
// #region 2S2H [Debugging] Debugging methods for viewing file/line info in the renderer.

View File

@ -114,12 +114,6 @@ s32 osSetRumble(OSPfs* pfs, u32 vibrate) {
return 0;
}
void osWritebackDCache(void* vaddr, s32 nbytes) {
}
void osInvalICache(void* vaddr, size_t nbytes) {
}
u32 __osGetFpcCsr() {
return 0;
}
@ -134,10 +128,6 @@ OSIntMask __osDisableInt(void) {
void __osRestoreInt(OSIntMask a0) {
}
OSPiHandle* osCartRomInit(void) {
return NULL;
}
u32 osMemSize = 1024 * 1024 * 1024;
void Audio_osInvalDCache(void* buf, s32 size) {
@ -146,12 +136,6 @@ void Audio_osInvalDCache(void* buf, s32 size) {
void Audio_osWritebackDCache(void* mem, s32 size) {
}
void osInvalDCache(void* vaddr, size_t nbytes) {
}
void osWritebackDCacheAll(void) {
}
void Audio_SetBGM(u32 bgmId) {
}
@ -314,15 +298,8 @@ void __osExceptionPreamble() {
}
void __osCleanupThread(void) {
}
void osSetEventMesg(OSEvent e, OSMesgQueue* mq, OSMesg msg) {
}
void osDestroyThread(OSThread* thread) {
}
s32 __osMotorAccess(OSPfs* pfs, u32 vibrate) {
}
s32 osMotorInit(OSMesgQueue* ctrlrqueue, OSPfs* pfs, s32 channel) {
return 0;
}
s32 osContSetCh(u8 ch) {
}
void osViSetYScale(f32 scale) {