Replace vramcpy with tonccpy

This commit is contained in:
RocketRobz 2022-01-02 18:24:25 -07:00
parent 862fee8e68
commit 99624643f2

View File

@ -28,6 +28,7 @@
#include <fat.h>
#include "load_bin.h"
#include "tonccpy.h"
#ifndef _NO_BOOTSTUB_
#include "bootstub_bin.h"
@ -119,18 +120,6 @@ static void writeAddr (data_t *mem, addr_t offset, addr_t value) {
((addr_t*)mem)[offset/sizeof(addr_t)] = value;
}
static void vramcpy (void* dst, const void* src, int len)
{
u16* dst16 = (u16*)dst;
u16* src16 = (u16*)src;
//dmaCopy(src, dst, len);
for ( ; len > 0; len -= 2) {
*dst16++ = *src16++;
}
}
static addr_t quickFind (const data_t* data, const data_t* search, size_t dataLen, size_t searchLen) {
const int* dataChunk = (const int*) data;
int searchChunk = ((const int*)search)[0];
@ -212,7 +201,7 @@ static bool dldiPatchLoader (data_t *binData, u32 binSize, bool clearBSS)
// Remember how much space is actually reserved
pDH[DO_allocatedSpace] = pAH[DO_allocatedSpace];
// Copy the DLDI patch into the application
vramcpy (pAH, pDH, dldiFileSize);
tonccpy (pAH, pDH, dldiFileSize);
// Fix the section pointers in the header
writeAddr (pAH, DO_text_start, readAddr (pAH, DO_text_start) + relocationOffset);
@ -260,7 +249,7 @@ static bool dldiPatchLoader (data_t *binData, u32 binSize, bool clearBSS)
if (clearBSS && (pDH[DO_fixSections] & FIX_BSS)) {
// Initialise the BSS to 0, only if the disc is being re-inited
memset (&pAH[readAddr(pDH, DO_bss_start) - ddmemStart] , 0, readAddr(pDH, DO_bss_end) - readAddr(pDH, DO_bss_start));
toncset (&pAH[readAddr(pDH, DO_bss_start) - ddmemStart] , 0, readAddr(pDH, DO_bss_end) - readAddr(pDH, DO_bss_start));
}
return true;
@ -279,7 +268,7 @@ int runNds (const void* loader, u32 loaderSize, u32 cluster, bool initDisc, bool
// Direct CPU access to VRAM bank C
VRAM_C_CR = VRAM_ENABLE | VRAM_C_LCD;
// Load the loader/patcher into the correct address
vramcpy (LCDC_BANK_C, loader, loaderSize);
tonccpy (LCDC_BANK_C, loader, loaderSize);
// Set the parameters for the loader
// STORED_FILE_CLUSTER = cluster;