X-Git-Url: https://notaz.gp2x.de/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=pico%2Fcart.c;h=8ac330ad56cd4d839df16dfb4d2886d563fcaef1;hb=b4db550e41b2aa277f570d7bff890c8e8ee1831f;hp=42d081721160c267921691193e7a532c6bbd23cc;hpb=a2b8c5a54568093b247ced39f0754cbb30324830;p=picodrive.git diff --git a/pico/cart.c b/pico/cart.c index 42d0817..8ac330a 100644 --- a/pico/cart.c +++ b/pico/cart.c @@ -439,6 +439,9 @@ static unsigned char *PicoCartAlloc(int filesize, int is_sms) if (filesize > (1 << s)) s++; rom_alloc_size = 1 << s; + // be sure we can cover all address space + if (rom_alloc_size < 0x10000) + rom_alloc_size = 0x10000; } else { // make alloc size at least sizeof(mcd_state), @@ -592,6 +595,17 @@ int PicoCartInsert(unsigned char *rom, unsigned int romsize, const char *carthw_ return 0; } +int PicoCartResize(int newsize) +{ + void *tmp = plat_mremap(Pico.rom, rom_alloc_size, newsize); + if (tmp == NULL) + return -1; + + Pico.rom = tmp; + rom_alloc_size = newsize; + return 0; +} + void PicoCartUnload(void) { if (PicoCartUnloadHook != NULL) {