X-Git-Url: https://notaz.gp2x.de/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=Pico%2FCart.c;h=34a497ea9cd9577fea3df20351da72d357cba3e7;hb=f53f286a8b48d19c65e83f90d00aa47e8e87c889;hp=cf71f24f155daaf289918ab98cc63371099a71fb;hpb=71de3cd9bb3cad7630df5b1d2a0e56475995b025;p=picodrive.git diff --git a/Pico/Cart.c b/Pico/Cart.c index cf71f24..34a497e 100644 --- a/Pico/Cart.c +++ b/Pico/Cart.c @@ -250,7 +250,7 @@ size_t pm_read(void *ptr, size_t bytes, pm_file *stream) if (block != cso->block_in_buff) { if (read_pos != cso->fpos_in) - { fseek(stream->file, read_pos, SEEK_SET); printf("seek %i\n", read_pos); } + fseek(stream->file, read_pos, SEEK_SET); rret = fread(cso->in_buff, 1, read_len, stream->file); cso->fpos_in = read_pos + rret; if (rret != read_len) { @@ -400,7 +400,6 @@ static int DecodeSmd(unsigned char *data,int len) static unsigned char *cd_realloc(void *old, int filesize) { unsigned char *rom; - dprintf("sizeof(mcd_state): %i", sizeof(mcd_state)); rom=realloc(old, sizeof(mcd_state)); if (rom) memset(rom+0x20000, 0, sizeof(mcd_state)-0x20000); return rom; @@ -418,7 +417,6 @@ static unsigned char *PicoCartAlloc(int filesize) alloc_size&=~0x7ffff; // use alloc size of multiples of 512K, so that memhandlers could be set up more efficiently if((filesize&0x3fff)==0x200) alloc_size+=0x200; else if(alloc_size-filesize < 4) alloc_size+=4; // padding for out-of-bound exec protection - //dprintf("alloc_size: %x\n", alloc_size); // Allocate space for the rom plus padding rom=(unsigned char *)malloc(alloc_size); @@ -548,10 +546,12 @@ void PicoCartDetect(void) Pico.m.sram_reg |= 4; } else { // normal SRAM - SRam.start = PicoRead32(0x1B4) & 0xFFFF00; + SRam.start = PicoRead32(0x1B4) & ~0xff; SRam.end = PicoRead32(0x1B8) | 1; sram_size = SRam.end - SRam.start + 1; } + SRam.start &= ~0xff000000; + SRam.end &= ~0xff000000; Pico.m.sram_reg |= 0x10; // SRAM was detected } if (sram_size <= 0) @@ -632,5 +632,13 @@ void PicoCartDetect(void) // Unusual region 'code' if (rom_strcmp(0x1f0, "EUROPE") == 0) *(int *) (Pico.rom+0x1f0) = 0x20204520; + + // SVP detection + if (name_cmp("Virtua Racing") == 0) + { + PicoSVPInit(); + PicoRead16Hook = PicoSVPRead16; + PicoWrite8Hook = PicoSVPWrite8; + } }