X-Git-Url: https://notaz.gp2x.de/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=pico%2Fcart.c;h=debb8a2c048142a63b8ae3468806b3def92f3a02;hb=30f0fdd42279a99893034a5d21b64439536c60aa;hp=42d081721160c267921691193e7a532c6bbd23cc;hpb=a2b8c5a54568093b247ced39f0754cbb30324830;p=picodrive.git diff --git a/pico/cart.c b/pico/cart.c index 42d0817..debb8a2 100644 --- a/pico/cart.c +++ b/pico/cart.c @@ -1,11 +1,11 @@ -// This is part of Pico Library - -// (c) Copyright 2004 Dave, All rights reserved. -// (c) Copyright 2006-2007, Grazvydas "notaz" Ignotas -// Free for non-commercial use. - -// For commercial use, separate licencing terms must be obtained. - +/* + * PicoDrive + * (c) Copyright Dave, 2004 + * (C) notaz, 2006-2010 + * + * This work is licensed under the terms of MAME license. + * See COPYING file in the top-level directory. + */ #include "pico_int.h" #include "../zlib/zlib.h" @@ -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), @@ -455,7 +458,7 @@ static unsigned char *PicoCartAlloc(int filesize, int is_sms) // Allocate space for the rom plus padding // use special address for 32x dynarec - rom = plat_mmap(0x02000000, rom_alloc_size); + rom = plat_mmap(0x02000000, rom_alloc_size, 0, 0); return rom; } @@ -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) { @@ -809,6 +823,8 @@ static void parse_carthw(const char *carthw_cfg, int *fill_sram) carthw_realtec_startup(); else if (strcmp(p, "radica_mapper") == 0) carthw_radica_startup(); + else if (strcmp(p, "piersolar_mapper") == 0) + carthw_pier_startup(); else if (strcmp(p, "prot_lk3") == 0) carthw_prot_lk3_startup(); else {