summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorArchez <Archez@users.noreply.github.com>2024-05-09 13:53:18 -0400
committerGarrett Cox <garrettjcox@gmail.com>2024-05-22 09:05:04 -0500
commitdf1976cd36e2e64ea0d27cd4f35c6397d6dd7239 (patch)
tree4090920db61821ea9d5417bda2305f5d7989a7f8
parent140b45c5c545b8b475b323e3db23a30f6de56dc6 (diff)
bump latest lus; window changes; header updates (#345)
m---------ZAPDTR0
m---------libultraship0
-rw-r--r--mm/2s2h/BenGui/BenMenuBar.cpp1
-rw-r--r--mm/2s2h/BenPort.cpp39
-rw-r--r--mm/2s2h/DeveloperTools/DeveloperTools.cpp1
-rw-r--r--mm/include/PR/gu.h6
-rw-r--r--mm/include/PR/os_ai.h5
-rw-r--r--mm/include/PR/os_cache.h6
-rw-r--r--mm/include/PR/os_motor.h6
-rw-r--r--mm/src/audio/lib/aisetnextbuf.c4
-rw-r--r--mm/src/code/graph.c4
-rw-r--r--mm/src/code/stubs.c23
12 files changed, 53 insertions, 42 deletions
diff --git a/ZAPDTR b/ZAPDTR
-Subproject 2b8794fc208de3b5db33977ebcea0b539574cd1
+Subproject ce2d63d8dd594a8ebc35073868d071aa3625831
diff --git a/libultraship b/libultraship
-Subproject 0a45004554c0917c771300957a7cd8727151696
+Subproject 0da318c0f4e431313565cad546fc469b8e85038
diff --git a/mm/2s2h/BenGui/BenMenuBar.cpp b/mm/2s2h/BenGui/BenMenuBar.cpp
index 565be1e84..afb0b38f4 100644
--- a/mm/2s2h/BenGui/BenMenuBar.cpp
+++ b/mm/2s2h/BenGui/BenMenuBar.cpp
@@ -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>
diff --git a/mm/2s2h/BenPort.cpp b/mm/2s2h/BenPort.cpp
index 1d710e86a..d178aea1e 100644
--- a/mm/2s2h/BenPort.cpp
+++ b/mm/2s2h/BenPort.cpp
@@ -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 };
diff --git a/mm/2s2h/DeveloperTools/DeveloperTools.cpp b/mm/2s2h/DeveloperTools/DeveloperTools.cpp
index 6caef923b..320f7dd4c 100644
--- a/mm/2s2h/DeveloperTools/DeveloperTools.cpp
+++ b/mm/2s2h/DeveloperTools/DeveloperTools.cpp
@@ -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" {
diff --git a/mm/include/PR/gu.h b/mm/include/PR/gu.h
index 51beaf97b..9ffb7c39f 100644
--- a/mm/include/PR/gu.h
+++ b/mm/include/PR/gu.h
@@ -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
diff --git a/mm/include/PR/os_ai.h b/mm/include/PR/os_ai.h
index 22f50d41e..ede16e8f2 100644
--- a/mm/include/PR/os_ai.h
+++ b/mm/include/PR/os_ai.h
@@ -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
diff --git a/mm/include/PR/os_cache.h b/mm/include/PR/os_cache.h
index 8a920c728..b9f7d85a9 100644
--- a/mm/include/PR/os_cache.h
+++ b/mm/include/PR/os_cache.h
@@ -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
diff --git a/mm/include/PR/os_motor.h b/mm/include/PR/os_motor.h
index 378768588..15a402e77 100644
--- a/mm/include/PR/os_motor.h
+++ b/mm/include/PR/os_motor.h
@@ -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
diff --git a/mm/src/audio/lib/aisetnextbuf.c b/mm/src/audio/lib/aisetnextbuf.c
index d58421161..4f9d90b27 100644
--- a/mm/src/audio/lib/aisetnextbuf.c
+++ b/mm/src/audio/lib/aisetnextbuf.c
@@ -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
diff --git a/mm/src/code/graph.c b/mm/src/code/graph.c
index 33f9ec791..8014b50df 100644
--- a/mm/src/code/graph.c
+++ b/mm/src/code/graph.c
@@ -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.
diff --git a/mm/src/code/stubs.c b/mm/src/code/stubs.c
index da078b734..e2e894568 100644
--- a/mm/src/code/stubs.c
+++ b/mm/src/code/stubs.c
@@ -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) {