mirror of
				https://github.com/coop-deluxe/sm64coopdx.git
				synced 2025-10-30 08:01:01 +00:00 
			
		
		
		
	Merge in small changes. (#63)
This commit is contained in:
		
							parent
							
								
									a31ddaff9d
								
							
						
					
					
						commit
						f51f1d6c4a
					
				
					 8 changed files with 24 additions and 16 deletions
				
			
		| 
						 | 
					@ -618,6 +618,14 @@ void Print(const char *aFmt, Args... aArgs) {
 | 
				
			||||||
    aGfxData->mErrorCount++; \
 | 
					    aGfxData->mErrorCount++; \
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#if DEBUG
 | 
				
			||||||
 | 
					#define PrintDebug(...) { Print(__VA_ARGS__); }
 | 
				
			||||||
 | 
					#define PrintDebugNoNewLine(...) { PrintNoNewLine(__VA_ARGS__); }
 | 
				
			||||||
 | 
					#else
 | 
				
			||||||
 | 
					#define PrintDebug(...)
 | 
				
			||||||
 | 
					#define PrintDebugNoNewLine(...)
 | 
				
			||||||
 | 
					#endif
 | 
				
			||||||
 | 
					
 | 
				
			||||||
template <typename... Args>
 | 
					template <typename... Args>
 | 
				
			||||||
SysPath fstring(const char *aFmt, Args... aArgs) {
 | 
					SysPath fstring(const char *aFmt, Args... aArgs) {
 | 
				
			||||||
    char buffer[1024];
 | 
					    char buffer[1024];
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -23,12 +23,14 @@ void DynOS_Actor_AddCustom(const SysPath &aFilename, const char *aActorName) {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    GfxData *_GfxData = DynOS_Actor_LoadFromBinary(aFilename, actorName, aFilename);
 | 
					    GfxData *_GfxData = DynOS_Actor_LoadFromBinary(aFilename, actorName, aFilename);
 | 
				
			||||||
    if (!_GfxData) {
 | 
					    if (!_GfxData) {
 | 
				
			||||||
 | 
					        Print("  ERROR: Couldn't load Actor Binary \"%s\" from \"%s\"", actorName, aPackFolder.c_str());
 | 
				
			||||||
        free(actorName);
 | 
					        free(actorName);
 | 
				
			||||||
        return;
 | 
					        return;
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    void* geoLayout = (*(_GfxData->mGeoLayouts.end() - 1))->mData;
 | 
					    void* geoLayout = (*(_GfxData->mGeoLayouts.end() - 1))->mData;
 | 
				
			||||||
    if (!geoLayout) {
 | 
					    if (!geoLayout) {
 | 
				
			||||||
 | 
					        Print("  ERROR: Couldn't load geo layout for \"%s\"", actorName);
 | 
				
			||||||
        free(actorName);
 | 
					        free(actorName);
 | 
				
			||||||
        return;
 | 
					        return;
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -136,8 +136,9 @@ static void _RelocateGraphNodePointers(struct GraphNode *aHead, u64 aOffset) {
 | 
				
			||||||
    } while (_Node != aHead);
 | 
					    } while (_Node != aHead);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					static Array<Pair<void *, void *>> sLoadedGraphNodes = {};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
void *DynOS_Geo_GetGraphNode(const void *aGeoLayout, bool aKeepInMemory) {
 | 
					void *DynOS_Geo_GetGraphNode(const void *aGeoLayout, bool aKeepInMemory) {
 | 
				
			||||||
    static Array<Pair<void *, void *>> sLoadedGraphNodes;
 | 
					 | 
				
			||||||
    if (aKeepInMemory) {
 | 
					    if (aKeepInMemory) {
 | 
				
			||||||
        s32 _LoadedGraphNodeIndex = sLoadedGraphNodes.FindIf([&aGeoLayout](const Pair<void *, void *> &aLoadedGraphNode) { return aLoadedGraphNode.first == aGeoLayout; });
 | 
					        s32 _LoadedGraphNodeIndex = sLoadedGraphNodes.FindIf([&aGeoLayout](const Pair<void *, void *> &aLoadedGraphNode) { return aLoadedGraphNode.first == aGeoLayout; });
 | 
				
			||||||
        if (_LoadedGraphNodeIndex != -1) {
 | 
					        if (_LoadedGraphNodeIndex != -1) {
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -76,8 +76,7 @@ typedef struct {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/* Functions */
 | 
					/* Functions */
 | 
				
			||||||
 | 
					
 | 
				
			||||||
s32 osPiStartDma(OSIoMesg *mb, s32 priority, s32 direction, uintptr_t devAddr, void *vAddr,
 | 
					s32 osPiStartDma(OSIoMesg *mb, s32 priority, s32 direction, uintptr_t devAddr, void *vAddr, size_t nbytes, OSMesgQueue *mq);
 | 
				
			||||||
                 size_t nbytes, OSMesgQueue *mq);
 | 
					 | 
				
			||||||
void osCreatePiManager(OSPri pri, OSMesgQueue *cmdQ, OSMesg *cmdBuf, s32 cmdMsgCnt);
 | 
					void osCreatePiManager(OSPri pri, OSMesgQueue *cmdQ, OSMesg *cmdBuf, s32 cmdMsgCnt);
 | 
				
			||||||
OSMesgQueue *osPiGetCmdQueue(void);
 | 
					OSMesgQueue *osPiGetCmdQueue(void);
 | 
				
			||||||
s32 osPiWriteIo(uintptr_t devAddr, u32 data);
 | 
					s32 osPiWriteIo(uintptr_t devAddr, u32 data);
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -665,8 +665,7 @@ extern s32        osPiRawReadIo(u32, u32 *);
 | 
				
			||||||
extern s32        osPiRawStartDma(s32, u32, void *, u32);
 | 
					extern s32        osPiRawStartDma(s32, u32, void *, u32);
 | 
				
			||||||
extern s32        osPiWriteIo(u32, u32);
 | 
					extern s32        osPiWriteIo(u32, u32);
 | 
				
			||||||
extern s32        osPiReadIo(u32, u32 *);
 | 
					extern s32        osPiReadIo(u32, u32 *);
 | 
				
			||||||
extern s32        osPiStartDma(OSIoMesg *, s32, s32, u32, void *, u32,
 | 
					extern s32        osPiStartDma(OSIoMesg *, s32, s32, u32, void *, u32, OSMesgQueue *);
 | 
				
			||||||
                     OSMesgQueue *);
 | 
					 | 
				
			||||||
extern void        osCreatePiManager(OSPri, OSMesgQueue *, OSMesg *, s32);
 | 
					extern void        osCreatePiManager(OSPri, OSMesgQueue *, OSMesg *, s32);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/* Video interface (Vi) */
 | 
					/* Video interface (Vi) */
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -28,17 +28,17 @@ s8 gReverbDownsampleRate;
 | 
				
			||||||
u8 sReverbDownsampleRateLog; // never read
 | 
					u8 sReverbDownsampleRateLog; // never read
 | 
				
			||||||
#endif
 | 
					#endif
 | 
				
			||||||
 | 
					
 | 
				
			||||||
struct SoundAllocPool gAudioSessionPool;
 | 
					struct SoundAllocPool gAudioSessionPool = {};
 | 
				
			||||||
struct SoundAllocPool gAudioInitPool;
 | 
					struct SoundAllocPool gAudioInitPool = {};
 | 
				
			||||||
struct SoundAllocPool gNotesAndBuffersPool;
 | 
					struct SoundAllocPool gNotesAndBuffersPool = {};
 | 
				
			||||||
u8 sAudioHeapPad[0x20]; // probably two unused pools
 | 
					u8 sAudioHeapPad[0x20]; // probably two unused pools
 | 
				
			||||||
struct SoundAllocPool gSeqAndBankPool;
 | 
					struct SoundAllocPool gSeqAndBankPool = {};
 | 
				
			||||||
struct SoundAllocPool gPersistentCommonPool;
 | 
					struct SoundAllocPool gPersistentCommonPool = {};
 | 
				
			||||||
struct SoundAllocPool gTemporaryCommonPool;
 | 
					struct SoundAllocPool gTemporaryCommonPool = {};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
struct SoundMultiPool gSeqLoadedPool;
 | 
					struct SoundMultiPool gSeqLoadedPool = {};
 | 
				
			||||||
struct SoundMultiPool gBankLoadedPool;
 | 
					struct SoundMultiPool gBankLoadedPool = {};
 | 
				
			||||||
struct SoundMultiPool gUnusedLoadedPool;
 | 
					struct SoundMultiPool gUnusedLoadedPool = {};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#ifdef VERSION_SH
 | 
					#ifdef VERSION_SH
 | 
				
			||||||
struct Unk1Pool gUnkPool1;
 | 
					struct Unk1Pool gUnkPool1;
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -18,7 +18,6 @@ u64 osClockRate = 62500000;
 | 
				
			||||||
s32 osPiStartDma(UNUSED OSIoMesg *mb, UNUSED s32 priority, UNUSED s32 direction,
 | 
					s32 osPiStartDma(UNUSED OSIoMesg *mb, UNUSED s32 priority, UNUSED s32 direction,
 | 
				
			||||||
                 uintptr_t devAddr, void *vAddr, size_t nbytes,
 | 
					                 uintptr_t devAddr, void *vAddr, size_t nbytes,
 | 
				
			||||||
                 UNUSED OSMesgQueue *mq) {
 | 
					                 UNUSED OSMesgQueue *mq) {
 | 
				
			||||||
    //printf("osPiStartDma: Copying %u bytes from %p to %p!\n", nbytes, (void *)devAddr, vAddr);
 | 
					 | 
				
			||||||
    memcpy(vAddr, (const void *) devAddr, nbytes);
 | 
					    memcpy(vAddr, (const void *) devAddr, nbytes);
 | 
				
			||||||
    return 0;
 | 
					    return 0;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		
		Reference in a new issue