From f51f1d6c4a5b879743d56b17059870029a28a934 Mon Sep 17 00:00:00 2001 From: Prince Frizzy Date: Sat, 16 Apr 2022 22:12:12 -0400 Subject: [PATCH] Merge in small changes. (#63) --- data/dynos.cpp.h | 8 ++++++++ data/dynos_bin_tex.cpp | 2 +- data/dynos_mgr_actor.cpp | 2 ++ data/dynos_misc.cpp | 3 ++- include/PR/os_pi.h | 3 +-- lib/src/os.h | 3 +-- src/audio/heap.c | 18 +++++++++--------- src/pc/ultra_reimplementation.c | 1 - 8 files changed, 24 insertions(+), 16 deletions(-) diff --git a/data/dynos.cpp.h b/data/dynos.cpp.h index 0cccfb2d..e00a8a28 100644 --- a/data/dynos.cpp.h +++ b/data/dynos.cpp.h @@ -618,6 +618,14 @@ void Print(const char *aFmt, Args... aArgs) { aGfxData->mErrorCount++; \ } +#if DEBUG +#define PrintDebug(...) { Print(__VA_ARGS__); } +#define PrintDebugNoNewLine(...) { PrintNoNewLine(__VA_ARGS__); } +#else +#define PrintDebug(...) +#define PrintDebugNoNewLine(...) +#endif + template SysPath fstring(const char *aFmt, Args... aArgs) { char buffer[1024]; diff --git a/data/dynos_bin_tex.cpp b/data/dynos_bin_tex.cpp index 418bf8f8..ab8cea71 100644 --- a/data/dynos_bin_tex.cpp +++ b/data/dynos_bin_tex.cpp @@ -159,4 +159,4 @@ void DynOS_Tex_Load(FILE *aFile, GfxData *aGfxData) { // Append aGfxData->mTextures.Add(_Node); -} +} \ No newline at end of file diff --git a/data/dynos_mgr_actor.cpp b/data/dynos_mgr_actor.cpp index 80db70b9..629615dd 100644 --- a/data/dynos_mgr_actor.cpp +++ b/data/dynos_mgr_actor.cpp @@ -23,12 +23,14 @@ void DynOS_Actor_AddCustom(const SysPath &aFilename, const char *aActorName) { GfxData *_GfxData = DynOS_Actor_LoadFromBinary(aFilename, actorName, aFilename); if (!_GfxData) { + Print(" ERROR: Couldn't load Actor Binary \"%s\" from \"%s\"", actorName, aPackFolder.c_str()); free(actorName); return; } void* geoLayout = (*(_GfxData->mGeoLayouts.end() - 1))->mData; if (!geoLayout) { + Print(" ERROR: Couldn't load geo layout for \"%s\"", actorName); free(actorName); return; } diff --git a/data/dynos_misc.cpp b/data/dynos_misc.cpp index 8fa1fcf4..d822872f 100644 --- a/data/dynos_misc.cpp +++ b/data/dynos_misc.cpp @@ -136,8 +136,9 @@ static void _RelocateGraphNodePointers(struct GraphNode *aHead, u64 aOffset) { } while (_Node != aHead); } +static Array> sLoadedGraphNodes = {}; + void *DynOS_Geo_GetGraphNode(const void *aGeoLayout, bool aKeepInMemory) { - static Array> sLoadedGraphNodes; if (aKeepInMemory) { s32 _LoadedGraphNodeIndex = sLoadedGraphNodes.FindIf([&aGeoLayout](const Pair &aLoadedGraphNode) { return aLoadedGraphNode.first == aGeoLayout; }); if (_LoadedGraphNodeIndex != -1) { diff --git a/include/PR/os_pi.h b/include/PR/os_pi.h index 8da37e25..4b0f9339 100644 --- a/include/PR/os_pi.h +++ b/include/PR/os_pi.h @@ -76,8 +76,7 @@ typedef struct { /* Functions */ -s32 osPiStartDma(OSIoMesg *mb, s32 priority, s32 direction, uintptr_t devAddr, void *vAddr, - size_t nbytes, OSMesgQueue *mq); +s32 osPiStartDma(OSIoMesg *mb, s32 priority, s32 direction, uintptr_t devAddr, void *vAddr, size_t nbytes, OSMesgQueue *mq); void osCreatePiManager(OSPri pri, OSMesgQueue *cmdQ, OSMesg *cmdBuf, s32 cmdMsgCnt); OSMesgQueue *osPiGetCmdQueue(void); s32 osPiWriteIo(uintptr_t devAddr, u32 data); diff --git a/lib/src/os.h b/lib/src/os.h index 3126f481..a35b6fe3 100644 --- a/lib/src/os.h +++ b/lib/src/os.h @@ -665,8 +665,7 @@ extern s32 osPiRawReadIo(u32, u32 *); extern s32 osPiRawStartDma(s32, u32, void *, u32); extern s32 osPiWriteIo(u32, u32); extern s32 osPiReadIo(u32, u32 *); -extern s32 osPiStartDma(OSIoMesg *, s32, s32, u32, void *, u32, - OSMesgQueue *); +extern s32 osPiStartDma(OSIoMesg *, s32, s32, u32, void *, u32, OSMesgQueue *); extern void osCreatePiManager(OSPri, OSMesgQueue *, OSMesg *, s32); /* Video interface (Vi) */ diff --git a/src/audio/heap.c b/src/audio/heap.c index 38015ffe..9471c517 100644 --- a/src/audio/heap.c +++ b/src/audio/heap.c @@ -28,17 +28,17 @@ s8 gReverbDownsampleRate; u8 sReverbDownsampleRateLog; // never read #endif -struct SoundAllocPool gAudioSessionPool; -struct SoundAllocPool gAudioInitPool; -struct SoundAllocPool gNotesAndBuffersPool; +struct SoundAllocPool gAudioSessionPool = {}; +struct SoundAllocPool gAudioInitPool = {}; +struct SoundAllocPool gNotesAndBuffersPool = {}; u8 sAudioHeapPad[0x20]; // probably two unused pools -struct SoundAllocPool gSeqAndBankPool; -struct SoundAllocPool gPersistentCommonPool; -struct SoundAllocPool gTemporaryCommonPool; +struct SoundAllocPool gSeqAndBankPool = {}; +struct SoundAllocPool gPersistentCommonPool = {}; +struct SoundAllocPool gTemporaryCommonPool = {}; -struct SoundMultiPool gSeqLoadedPool; -struct SoundMultiPool gBankLoadedPool; -struct SoundMultiPool gUnusedLoadedPool; +struct SoundMultiPool gSeqLoadedPool = {}; +struct SoundMultiPool gBankLoadedPool = {}; +struct SoundMultiPool gUnusedLoadedPool = {}; #ifdef VERSION_SH struct Unk1Pool gUnkPool1; diff --git a/src/pc/ultra_reimplementation.c b/src/pc/ultra_reimplementation.c index 39992177..6e6d98e6 100644 --- a/src/pc/ultra_reimplementation.c +++ b/src/pc/ultra_reimplementation.c @@ -18,7 +18,6 @@ u64 osClockRate = 62500000; s32 osPiStartDma(UNUSED OSIoMesg *mb, UNUSED s32 priority, UNUSED s32 direction, uintptr_t devAddr, void *vAddr, size_t nbytes, UNUSED OSMesgQueue *mq) { - //printf("osPiStartDma: Copying %u bytes from %p to %p!\n", nbytes, (void *)devAddr, vAddr); memcpy(vAddr, (const void *) devAddr, nbytes); return 0; }