Merge branch 'develop' of github.com:Malkierian/Shipwright into dev-to-rando-5-6

This commit is contained in:
Malkierian 2024-05-08 21:36:25 -07:00
commit f550bf1381
12 changed files with 37 additions and 114 deletions

@ -1 +1 @@
Subproject commit a5d84b29429dcd9b32fb1d8b169b6dd269e6c979
Subproject commit 878efcc26701f1779e06389a6c6ca8df7aef64da

View File

@ -547,6 +547,7 @@ if (CMAKE_CXX_COMPILER_ID MATCHES "GNU|Clang|AppleClang")
-Wno-parentheses
-Wno-narrowing
-Wno-missing-braces
-Wno-int-conversion
$<$<COMPILE_LANGUAGE:C>:
-Werror-implicit-function-declaration
-Wno-incompatible-pointer-types

View File

@ -2356,7 +2356,6 @@ s32 __osCheckPackId(OSPfs* pfs, __OSPackId* check);
s32 __osGetId(OSPfs* pfs);
s32 __osCheckId(OSPfs* pfs);
s32 __osPfsRWInode(OSPfs* pfs, __OSInode* inode, u8 flag, u8 bank);
void guMtxL2F(MtxF* m1, Mtx* m2);
s32 osPfsFindFile(OSPfs* pfs, u16 companyCode, u32 gameCode, u8* gameName, u8* extName, s32* fileNo);
s32 osAfterPreNMI(void);
s32 osContStartQuery(OSMesgQueue* mq);
@ -2410,7 +2409,6 @@ u32 __osSpGetStatus(void);
void __osSpSetStatus(u32 status);
void osWritebackDCacheAll(void);
OSThread* __osGetCurrFaultedThread(void);
void guMtxF2L(MtxF* m1, Mtx* m2);
// ? __d_to_ll(?);
// ? __f_to_ll(?);
// ? __d_to_ull(?);

View File

@ -445,7 +445,7 @@ void DrawBgActorCollision() {
bg.curTransform.scale.z, bg.curTransform.rot.x, bg.curTransform.rot.y,
bg.curTransform.rot.z, bg.curTransform.pos.x, bg.curTransform.pos.y,
bg.curTransform.pos.z);
guMtxF2L(&mf, &m);
// guMtxF2L(mf, &m);
mtxDl.push_back(m);
dl.push_back(gsSPMatrix(&mtxDl.back(), G_MTX_MODELVIEW | G_MTX_LOAD | G_MTX_PUSH));
@ -493,7 +493,7 @@ void DrawColCheckList(std::vector<Gfx>& dl, Collider** objects, int32_t count) {
SkinMatrix_SetScale(&ms, radius / 128.0f, radius / 128.0f, radius / 128.0f);
MtxF dest;
SkinMatrix_MtxFMtxFMult(&mf, &ms, &dest);
guMtxF2L(&dest, &m);
// guMtxF2L(&dest, &m);
mtxDl.push_back(m);
dl.push_back(gsSPMatrix(&mtxDl.back(), G_MTX_MODELVIEW | G_MTX_LOAD | G_MTX_PUSH));
@ -512,7 +512,7 @@ void DrawColCheckList(std::vector<Gfx>& dl, Collider** objects, int32_t count) {
SkinMatrix_SetScale(&ms, radius / 128.0f, cyl->dim.height / 128.0f, radius / 128.0f);
MtxF dest;
SkinMatrix_MtxFMtxFMult(&mt, &ms, &dest);
guMtxF2L(&dest, &m);
// guMtxF2L(&dest, &m);
mtxDl.push_back(m);
dl.push_back(gsSPMatrix(&mtxDl.back(), G_MTX_MODELVIEW | G_MTX_LOAD | G_MTX_PUSH));

View File

@ -7,6 +7,7 @@
#include <chrono>
#include <ResourceManager.h>
#include "graphic/Fast3D/Fast3dWindow.h"
#include <File.h>
#include <DisplayList.h>
#include <Window.h>
@ -1264,11 +1265,6 @@ extern "C" uint64_t GetUnixTimestamp() {
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 "C" void Graph_StartFrame() {
@ -1392,6 +1388,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;
@ -1415,10 +1412,12 @@ extern "C" void Graph_ProcessGfxCommands(Gfx* commands) {
time -= fps;
OTRGlobals::Instance->context->GetWindow()->SetTargetFps(fps);
if (wnd != nullptr) {
wnd->SetTargetFps(fps);
}
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);
@ -1451,11 +1450,21 @@ extern "C" void Graph_ProcessGfxCommands(Gfx* commands) {
float divisor_num = 0.0f;
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) {
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() {

View File

@ -1249,7 +1249,7 @@ void SaveManager::SaveSection(int fileNum, int sectionID, bool threaded) {
auto saveContext = new SaveContext;
memcpy(saveContext, &gSaveContext, sizeof(gSaveContext));
if (threaded) {
smThreadPool->push_task_back(&SaveManager::SaveFileThreaded, this, fileNum, saveContext, sectionID);
smThreadPool->detach_task(std::bind(&SaveManager::SaveFileThreaded, this, fileNum, saveContext, sectionID));
} else {
SaveFileThreaded(fileNum, saveContext, sectionID);
}
@ -1340,7 +1340,7 @@ void SaveManager::LoadFile(int fileNum) {
void SaveManager::ThreadPoolWait() {
if (smThreadPool) {
smThreadPool->wait_for_tasks();
smThreadPool->wait();
}
}

View File

@ -40,7 +40,10 @@ typedef struct {
#include <functional>
#include <vector>
#include <filesystem>
#include "thread-pool/BS_thread_pool.hpp"
#define BS_THREAD_POOL_ENABLE_PRIORITY
#define BS_THREAD_POOL_ENABLE_PAUSE
#include <BS_thread_pool.hpp>
#include "z64save.h"

View File

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

View File

@ -1,4 +1,5 @@
#include <libultraship/libultra.h>
#include <stdarg.h>
#include <stdio.h>
#include <string.h>
#include "z64.h"
@ -31,18 +32,6 @@ f32 qNaN0x10000 = 0x7F810000;
// __gSPTextureRectangle(pkt, xl, yl, xh, yh, tile, s, t, dsdx, dtdy);
//}
s32 osJamMesg(OSMesgQueue* mq, OSMesg msg, s32 flag)
{
}
void osSetEventMesg(OSEvent e, OSMesgQueue* mq, OSMesg msg)
{
}
void osViSetEvent(OSMesgQueue* mq, OSMesg msg, u32 retraceCount)
{
}
OSId osGetThreadId(OSThread* thread)
{
}
@ -55,31 +44,11 @@ void osSetThreadPri(OSThread* thread, OSPri pri)
{
}
s32 osSetTimer(OSTimer* timer, OSTime countdown, OSTime interval, OSMesgQueue* mq, OSMesg msg)
{
}
void osCreatePiManager(OSPri pri, OSMesgQueue* cmdQ, OSMesg* cmdBuf, s32 cmdMsgCnt)
{
}
void osCreateViManager(OSPri pri)
{
}
s32 osMotorInit(OSMesgQueue* ctrlrqueue, OSPfs* pfs, s32 channel)
{
return 0;
}
u32 osAiGetLength(void)
{
}
s32 osPfsFreeBlocks(OSPfs* pfs, s32* leftoverBytes)
{
@ -130,16 +99,6 @@ s32 osPfsAllocateFile(OSPfs* pfs, u16 companyCode, u32 gameCode, u8* gameName, u
}
s32 osAiSetNextBuffer(void* buf, size_t size)
{
}
s32 __osMotorAccess(OSPfs* pfs, u32 vibrate)
{
}
OSIntMask osSetIntMask(OSIntMask a)
{
return 0;
@ -200,16 +159,6 @@ void osContGetQuery(OSContStatus* data)
}
void osViSwapBuffer(void* vaddr)
{
}
void* osViGetNextFramebuffer()
{
}
u32 __osGetFpcCsr()
{
return 0;
@ -240,11 +189,6 @@ OSThread* __osGetCurrFaultedThread(void)
}
void osCartRomInit()
{
}
u32 osMemSize = 1024 * 1024 * 1024;
void Audio_osInvalDCache(void* buf, s32 size)
@ -263,11 +207,6 @@ s32 osAiSetFrequency(u32 freq)
return 1;
}
s32 osEPiStartDma(OSPiHandle* handle, OSIoMesg* mb, s32 direction)
{
}
void osInvalDCache(void* vaddr, s32 nbytes)
{
@ -313,31 +252,6 @@ OSPiHandle* osDriveRomInit()
}
void osViSetMode(OSViMode* mode)
{
}
void osViBlack(u8 active)
{
}
void osViSetYScale(f32 scale)
{
}
void osViSetXScale(f32 value)
{
}
void osViSetSpecialFeatures(u32 func)
{
}
void __osInitialize_common(void)
{
@ -390,11 +304,6 @@ s32 osEPiReadIo(OSPiHandle* handle, u32 devAddr, u32* data)
return 0;
}
u32* osViGetCurrentFramebuffer(void)
{
}
void osSpTaskYield(void)
{
}

View File

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

View File

@ -6268,7 +6268,7 @@ s32 func_8083D12C(PlayState* play, Player* this, Input* arg2) {
func_80832340(play, this);
// Skip take breath animation on surface if Link didn't grab an item while underwater and the setting is enabled
if (CVarGetInteger(CVAR_ENHANCEMENT("SkipSwimDeepEndAnim"), 0) && !(this->stateFlags1 & PLAYER_STATE1_ITEM_OVER_HEAD)) {
auto lastAnimFrame = Animation_GetLastFrame(&gPlayerAnim_link_swimer_swim_deep_end);
int lastAnimFrame = Animation_GetLastFrame(&gPlayerAnim_link_swimer_swim_deep_end);
LinkAnimation_Change(play, &this->skelAnime, &gPlayerAnim_link_swimer_swim_deep_end, 1.0f,
lastAnimFrame, lastAnimFrame, ANIMMODE_ONCE, -6.0f);
} else {

View File

@ -141,7 +141,7 @@ static Vtx sCycleAButtonVtx[] = {
};
// Track animation timers for each inventory slot
static sSlotCycleActiveAnimTimer[24] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 };
static int sSlotCycleActiveAnimTimer[24] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 };
// Renders a left and/or right item for any item slot that can support cycling
void KaleidoScope_DrawItemCycleExtras(PlayState* play, u8 slot, u8 canCycle, u8 leftItem, u8 rightItem) {