Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- void ProcessDma3Requests(void)
- {
- // NOTE: the fillerA member of the DMA struct is actually u32 value;
- // NOTE: gUnknown_0300001C is just a pointer inside the gDma3Requests structure, not a true symbol; feel free to remove
- u16 total_size;
- if (gDma3ManagerLocked)
- return;
- total_size = 0;
- while (gDma3Requests[gDma3RequestCursor].size)
- {
- total_size += gDma3Requests[gDma3RequestCursor].size;
- if (total_size > 0xA000)
- return; // don't do too much at once
- if (REG_VCOUNT > 224)
- return;// we're about to leave vblank, stop
- switch (gDma3Requests[gDma3RequestCursor].mode)
- {
- case 1: // regular 32-bit copy
- while (gDma3Requests[gDma3RequestCursor].size > 0x1000)
- {
- DmaCopy32(3, gDma3Requests[gDma3RequestCursor].src, gDma3Requests[gDma3RequestCursor].dest, 0x1000);
- gDma3Requests[gDma3RequestCursor].src += 0x1000 >> 2;
- gDma3Requests[gDma3RequestCursor].dest += 0x1000 >> 2;
- gDma3Requests[gDma3RequestCursor].size -= 0x1000;
- }
- DmaCopy32(3, gDma3Requests[gDma3RequestCursor].src, gDma3Requests[gDma3RequestCursor].dest, gDma3Requests[gDma3RequestCursor].size);
- break;
- case 2: // repeat a single 32-bit value across RAM
- while (gDma3Requests[gDma3RequestCursor].size > 0x1000)
- {
- DmaFill32(3, gDma3Requests[gDma3RequestCursor].value, gDma3Requests[gDma3RequestCursor].dest, 0x1000);
- gDma3Requests[gDma3RequestCursor].dest += 0x1000 >> 2;
- gDma3Requests[gDma3RequestCursor].size -= 0x1000;
- }
- DmaFill32(3, gDma3Requests[gDma3RequestCursor].value, gDma3Requests[gDma3RequestCursor].dest, gDma3Requests[gDma3RequestCursor].size);
- break;
- case 3: // regular 16-bit copy
- while (gDma3Requests[gDma3RequestCursor].size > 0x1000)
- {
- DmaCopy16(3, gDma3Requests[gDma3RequestCursor].src, gDma3Requests[gDma3RequestCursor].dest, 0x1000);
- gDma3Requests[gDma3RequestCursor].src += 0x1000 >> 1;
- gDma3Requests[gDma3RequestCursor].dest += 0x1000 >> 1;
- gDma3Requests[gDma3RequestCursor].size -= 0x1000;
- }
- DmaCopy16(3, gDma3Requests[gDma3RequestCursor].src, gDma3Requests[gDma3RequestCursor].dest, gDma3Requests[gDma3RequestCursor].size);
- break;
- case 4: // repeat a single 16-bit value across RAM
- while (gDma3Requests[gDma3RequestCursor].size > 0x1000)
- {
- DmaFill16(3, gDma3Requests[gDma3RequestCursor].value, gDma3Requests[gDma3RequestCursor].dest, 0x1000);
- gDma3Requests[gDma3RequestCursor].dest += 0x1000 >> 1;
- gDma3Requests[gDma3RequestCursor].size -= 0x1000;
- }
- DmaFill16(3, gDma3Requests[gDma3RequestCursor].value, gDma3Requests[gDma3RequestCursor].dest, gDma3Requests[gDma3RequestCursor].size);
- break;
- }
- gDma3Requests[gDma3RequestCursor].src = NULL;
- gDma3Requests[gDma3RequestCursor].dest = NULL;
- gDma3Requests[gDma3RequestCursor].size = 0;
- gDma3Requests[gDma3RequestCursor].mode = 0;
- gDma3Requests[gDma3RequestCursor].value = 0;
- gDma3RequestCursor ++;
- if (gDma3RequestCursor >= 0x80)
- gDma3RequestCursor = 0;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement