Make some adjustments as recommended in PR #179

This commit is contained in:
Ryan Myers
2021-12-02 13:37:35 -05:00
parent e0226cc295
commit e49832bf03
4 changed files with 28 additions and 33 deletions
+15 -15
View File
@@ -70,25 +70,25 @@ typedef struct SCClient_s {
OSMesgQueue *msgQ; /* where to send the frame msg */
} OSScClient;
/* 0x7C8 bytes - Side note, I'm seeing 0x288 now... */
/* 0x288 bytes */
typedef struct {
/* 0x00 */ OSScMsg retraceMsg;
/* 0x20 */ OSScMsg prenmiMsg;
/* 0x40 */ OSMesgQueue interruptQ;
/* 0x68 */ OSMesg intBuf[OS_SC_MAX_MESGS]; //0x8 per OsMesg
/* 0xA8 */ OSMesgQueue cmdQ;
/* 0xD0 */ OSMesg cmdMsgBuf[OS_SC_MAX_MESGS]; //0x8 per OsMesg
/* 0x110 */ OSThread thread;
/* 0x2D8 */ OSScClient *clientList;
/* 0x2F0 */ OSScTask *audioListHead;
/* 0x3A0 */ OSScTask *gfxListHead;
/* 0x450 */ OSScTask *audioListTail;
/* 0x500 */ OSScTask *gfxListTail;
/* 0x5B0 */ OSScTask *curRSPTask;
/* 0x660 */ OSScTask *curRDPTask;
/* 0x710 */ OSScTask *unkTask; //Rare added?
/* 0x7C0 */ u32 frameCount;
/* 0x7C4 */ s32 doAudio;
/* 0x58 */ OSMesg intBuf[OS_SC_MAX_MESGS]; //0x8 per OSMesg
/* 0x78 */ OSMesgQueue cmdQ;
/* 0x90 */ OSMesg cmdMsgBuf[OS_SC_MAX_MESGS]; //0x8 per OSMesg
/* 0xB0 */ OSThread thread;
/* 0x260 */ OSScClient *clientList;
/* 0x264 */ OSScTask *audioListHead;
/* 0x268 */ OSScTask *gfxListHead;
/* 0x26C */ OSScTask *audioListTail;
/* 0x270 */ OSScTask *gfxListTail;
/* 0x274 */ OSScTask *curRSPTask;
/* 0x278 */ OSScTask *curRDPTask;
/* 0x27C */ OSScTask *unkTask; //Rare added?
/* 0x280 */ u32 frameCount;
/* 0x284 */ s32 doAudio;
} OSSched;
typedef struct{
+2 -2
View File
@@ -11,7 +11,7 @@
/************ .bss ************/
OSIoMesg gAssetsDmaIoMesg;
OSMesg gDmaMesgBuf[1];
OSMesg gDmaMesgBuf[1]; //Seems to only work as an array of 1 for some reason.
OSMesgQueue gDmaMesgQueue;
OSMesg gPIMesgBuf[16];
OSMesgQueue gPIMesgQueue;
@@ -175,7 +175,7 @@ s32 get_size_of_asset_section(u32 assetIndex) {
* Copies data from the game cartridge to a ram address.
*/
void dmacopy(u32 romOffset, u32 ramAddress, s32 numBytes) {
OSMesg dmaMesgBuf[1];
OSMesg dmaMesgBuf[1]; //Seems to only work as an array of 1 for some reason.
s32 numBytesToDMA;
osInvalDCache(ramAddress, numBytes);
+11 -14
View File
@@ -157,8 +157,7 @@ GLOBAL_ASM("asm/non_matchings/unknown_003260/func_80002DF8.s")
*****************************************************************************/
#if 0
#define DMA_BUFFER_LENGTH 0x400
s32 __amDMA(s32 addr, s32 len, void *state)
{
s32 __amDMA(s32 addr, s32 len, void *state) {
void *foundBuffer;
s32 delta, addrEnd, buffEnd;
AMDMABuffer *dmaPtr, *lastDmaPtr;
@@ -170,14 +169,12 @@ s32 __amDMA(s32 addr, s32 len, void *state)
/* first check to see if a currently existing buffer contains the
sample that you need. */
while(dmaPtr)
{
while(dmaPtr) {
buffEnd = dmaPtr->startAddr + DMA_BUFFER_LENGTH;
if(dmaPtr->startAddr > addr) /* since buffers are ordered */
break; /* abort if past possible */
else if(addrEnd <= buffEnd) /* yes, found a buffer with samples */
{
else if(addrEnd <= buffEnd) { /* yes, found a buffer with samples */
dmaPtr->lastFrame = audFrameCt; /* mark it used */
foundBuffer = dmaPtr->ptr + addr - dmaPtr->startAddr;
return (int) osVirtualToPhysical(foundBuffer);
@@ -195,27 +192,27 @@ s32 __amDMA(s32 addr, s32 len, void *state)
* if you get here and dmaPtr is null, send back the a bogus
* pointer, it's better than nothing
*/
if(!dmaPtr)
return osVirtualToPhysical(dmaState.firstUsed);
if(!dmaPtr) {
return osVirtualToPhysical(dmaState.firstUsed);
}
dmaState.firstFree = (AMDMABuffer*)dmaPtr->node.next;
alUnlink((ALLink*)dmaPtr);
/* add it to the used list */
if(lastDmaPtr) /* if you have other dmabuffers used, add this one */
{ /* to the list, after the last one checked above */
if(lastDmaPtr) { /* if you have other dmabuffers used, add this one */
/* to the list, after the last one checked above */
alLink((ALLink*)dmaPtr,(ALLink*)lastDmaPtr);
}
else if(dmaState.firstUsed) /* if this buffer is before any others */
{ /* jam at begining of list */
else if(dmaState.firstUsed) { /* if this buffer is before any others */
/* jam at begining of list */
lastDmaPtr = dmaState.firstUsed;
dmaState.firstUsed = dmaPtr;
dmaPtr->node.next = (ALLink*)lastDmaPtr;
dmaPtr->node.prev = 0;
lastDmaPtr->node.prev = (ALLink*)dmaPtr;
}
else /* no buffers in list, this is the first one */
{
else { /* no buffers in list, this is the first one */
dmaState.firstUsed = dmaPtr;
dmaPtr->node.next = 0;
dmaPtr->node.prev = 0;
-2
View File
@@ -208,8 +208,6 @@ void init_framebuffer(s32 index) {
}
gVideoFbWidths[index] = gVideoModeResolutions[gVideoModeIndex & 7].width;
gVideoFbHeights[index] = gVideoModeResolutions[gVideoModeIndex & 7].height;
// TODO: All of the gVideoFramebuffers values are suspicious and probably not the right code.
// The 0x3F is coincidentally sizeof(gVideoModeResolutions) - 1, but that might just be a coincidence
if (gVideoModeIndex >= 2) {
gVideoFramebuffers[index] = allocate_from_main_pool_safe((HIGH_RES_SCREEN_WIDTH * HIGH_RES_SCREEN_HEIGHT * 2) + 0x30, COLOR_TAG_WHITE);
gVideoFramebuffers[index] = (u16 *)(((s32)gVideoFramebuffers[index] + 0x3F) & ~0x3F);