mirror of
https://github.com/HarbourMasters/Shipwright.git
synced 2024-12-18 14:22:17 -05:00
2308ab8823
* Bump LUS * Ship -> LUS namespace change * z_scene_otr Ship -> LUS namespace * Starting to get SoH to build with LUS imgui changes. * start stuff * gamecontroleditor build issues resolved maybe * cosmetics editor and what not * console * actor viewer * more stuff * more stuff * on to errors that make sense * putting this down for a bit * no idea what these errors mean now * some kind of progress maybe * latest lus main * more * back to linker errors and being lost * Fixes command function signature. * More fixes * Even more fixes * Bump LUS * More Fixes. * Fixes even more errors. * lus bump * input editor as var * audio editor working * it builds with this * bump lus * it opens * bump lus to latest main again * make sure to do all the command registering in debugconsole * lus and what not * switch type stuff plz * undo * do the thing that fixes the thing * fix mac? * correctly show/hide menubar on boot * bump lus * input blocking updates * bump lus * Bump LUS * Press F1 to open enhancement menus moved to SoH * lus and rendering backend stuff * audio backend and lus * Bump LUS * Fixes WindowBackend dropdown * Bump LUS * misc -> utils and moves binarytools to utils. * Window refactor * bump lus * make it work * Fixes for moved files again * Bump LUS * Mercury -> Config * Bump LUS * Reacts to removed LUS hooks and bump LUS * Remove Hook: GfxInit * Removes debug audio_setgamevolume to 1 * use non-crashing branch of lus * fix: make audio init work without hooks * game icon stuff * multifix bmp * use input viewer class branch for now * just "Ship" it's cleaner * Bump LUS * Removed ExitGame hook. * Bump LUS * Hook system removed from LUS. * More LUS updates * Changes to make window position saving. * Bump LUS * Bump LUS (for real) * LUS resources now return a specialized pointer. * Bump LUS * Fixes issue in SetPathways::GetPointerSize * Bump LUS to 1.0.0 * builds but crashes * fix crash * better macro names in debug console * remove commeted out line * remove redundant check tracker settings window logic * remove commented out line * move the * * remove extra seqplayers enum def * this sneaky little guy was hiding behind a wii u ifdef * remove extra check tracker header --------- Co-authored-by: Kenix <kenixwhisperwind@gmail.com> Co-authored-by: briaguya <briaguya@alice>
122 lines
3.9 KiB
C++
122 lines
3.9 KiB
C++
#include "z64.h"
|
|
|
|
//OTRTODO - this is awful
|
|
|
|
extern "C" {
|
|
void InitOTR();
|
|
void Graph_ProcessFrame(void (*run_one_game_iter)(void));
|
|
void Graph_StartFrame();
|
|
void Graph_ProcessGfxCommands(Gfx* commands);
|
|
void OTRLogString(const char* src);
|
|
void OTRGfxPrint(const char* str, void* printer, void (*printImpl)(void*, char));
|
|
void OTRSetFrameDivisor(int divisor);
|
|
void OTRGetPixelDepthPrepare(float x, float y);
|
|
uint16_t OTRGetPixelDepth(float x, float y);
|
|
int32_t OTRGetLastScancode();
|
|
void ResourceMgr_LoadDirectory(const char* resName);
|
|
void ResourceMgr_LoadFile(const char* resName);
|
|
char* ResourceMgr_LoadFileFromDisk(const char* filePath);
|
|
uint16_t ResourceMgr_LoadTexWidthByName(char* texPath);
|
|
uint16_t ResourceMgr_LoadTexHeightByName(char* texPath);
|
|
size_t ResourceGetTexSizeByName(const char* name);
|
|
char* ResourceMgr_LoadTexOrDListByName(char* filePath);
|
|
char* ResourceMgr_LoadIfDListByName(char* filePath);
|
|
char* ResourceMgr_LoadPlayerAnimByName(char* animPath);
|
|
char* ResourceMgr_GetNameByCRC(uint64_t crc, char* alloc);
|
|
Gfx* ResourceMgr_LoadGfxByCRC(uint64_t crc);
|
|
Gfx* ResourceMgr_LoadGfxByName(char* path);
|
|
Vtx* ResourceMgr_LoadVtxByCRC(uint64_t crc);
|
|
Vtx* ResourceMgr_LoadVtxByName(char* path);
|
|
CollisionHeader* ResourceMgr_LoadColByName(char* path);
|
|
uint64_t GetPerfCounter();
|
|
int ResourceMgr_OTRSigCheck(char* imgData);
|
|
void ResourceMgr_PushCurrentDirectory(char* path);
|
|
|
|
}
|
|
|
|
|
|
extern "C" void gSPSegment(void* value, int segNum, uintptr_t target) {
|
|
char* imgData = (char*)target;
|
|
|
|
int res = ResourceMgr_OTRSigCheck(imgData);
|
|
|
|
// OTRTODO: Disabled for now to fix an issue with HD Textures.
|
|
// With HD textures, we need to pass the path to F3D, not the raw texture data.
|
|
// Otherwise the needed metadata is not available for proper rendering...
|
|
// This should *not* cause any crashes, but some testing may be needed...
|
|
// UPDATE: To maintain compatability it will still do the old behavior if the resource is a display list.
|
|
// That should not affect HD textures.
|
|
if (res) {
|
|
uintptr_t desiredTarget = (uintptr_t)ResourceMgr_LoadIfDListByName(imgData);
|
|
|
|
if (desiredTarget != NULL)
|
|
target = desiredTarget;
|
|
}
|
|
|
|
__gSPSegment(value, segNum, target);
|
|
}
|
|
|
|
extern "C" void gSPSegmentLoadRes(void* value, int segNum, uintptr_t target) {
|
|
char* imgData = (char*)target;
|
|
|
|
int res = ResourceMgr_OTRSigCheck(imgData);
|
|
|
|
if (res) {
|
|
target = (uintptr_t)ResourceMgr_LoadTexOrDListByName(imgData);
|
|
}
|
|
|
|
__gSPSegment(value, segNum, target);
|
|
}
|
|
|
|
extern "C" void gDPSetTextureImage(Gfx* pkt, u32 format, u32 size, u32 width, uintptr_t i) {
|
|
__gDPSetTextureImage(pkt, format, size, width, i);
|
|
}
|
|
|
|
extern "C" void gDPSetTextureImageFB(Gfx* pkt, u32 format, u32 size, u32 width, int fb)
|
|
{
|
|
__gDPSetTextureImageFB(pkt, format, size, width, fb);
|
|
}
|
|
|
|
extern "C" void gSPDisplayList(Gfx* pkt, Gfx* dl) {
|
|
char* imgData = (char*)dl;
|
|
|
|
if (ResourceMgr_OTRSigCheck(imgData) == 1) {
|
|
|
|
//ResourceMgr_PushCurrentDirectory(imgData);
|
|
//gsSPPushCD(pkt++, imgData);
|
|
dl = ResourceMgr_LoadGfxByName(imgData);
|
|
}
|
|
|
|
__gSPDisplayList(pkt, dl);
|
|
}
|
|
|
|
extern "C" void gSPDisplayListOffset(Gfx* pkt, Gfx* dl, int offset) {
|
|
char* imgData = (char*)dl;
|
|
|
|
if (ResourceMgr_OTRSigCheck(imgData) == 1)
|
|
dl = ResourceMgr_LoadGfxByName(imgData);
|
|
|
|
__gSPDisplayList(pkt, dl + offset);
|
|
}
|
|
|
|
extern "C" void gSPVertex(Gfx* pkt, uintptr_t v, int n, int v0) {
|
|
|
|
if (ResourceMgr_OTRSigCheck((char*)v) == 1)
|
|
v = (uintptr_t)ResourceMgr_LoadVtxByName((char*)v);
|
|
|
|
__gSPVertex(pkt, v, n, v0);
|
|
}
|
|
|
|
extern "C" void gSPInvalidateTexCache(Gfx* pkt, uintptr_t texAddr)
|
|
{
|
|
char* imgData = (char*)texAddr;
|
|
|
|
if (texAddr != 0 && ResourceMgr_OTRSigCheck(imgData)) {
|
|
// Temporary solution to the mq/nonmq issue, this will be
|
|
// handled better with LUS 1.0
|
|
texAddr = (uintptr_t)ResourceMgr_LoadTexOrDListByName(imgData);
|
|
}
|
|
|
|
__gSPInvalidateTexCache(pkt, texAddr);
|
|
}
|