notaz.gp2x.de
/
picodrive.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
SVP stubs
[picodrive.git]
/
Pico
/
Cart.c
diff --git
a/Pico/Cart.c
b/Pico/Cart.c
index
cf71f24
..
34a497e
100644
(file)
--- 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)
\r
{
\r
if (read_pos != cso->fpos_in)
\r
if (block != cso->block_in_buff)
\r
{
\r
if (read_pos != cso->fpos_in)
\r
- { fseek(stream->file, read_pos, SEEK_SET); printf("seek %i\n", read_pos); }
\r
+ fseek(stream->file, read_pos, SEEK_SET);
\r
rret = fread(cso->in_buff, 1, read_len, stream->file);
\r
cso->fpos_in = read_pos + rret;
\r
if (rret != read_len) {
\r
rret = fread(cso->in_buff, 1, read_len, stream->file);
\r
cso->fpos_in = read_pos + rret;
\r
if (rret != read_len) {
\r
@@
-400,7
+400,6
@@
static int DecodeSmd(unsigned char *data,int len)
static unsigned char *cd_realloc(void *old, int filesize)
\r
{
\r
unsigned char *rom;
\r
static unsigned char *cd_realloc(void *old, int filesize)
\r
{
\r
unsigned char *rom;
\r
- dprintf("sizeof(mcd_state): %i", sizeof(mcd_state));
\r
rom=realloc(old, sizeof(mcd_state));
\r
if (rom) memset(rom+0x20000, 0, sizeof(mcd_state)-0x20000);
\r
return rom;
\r
rom=realloc(old, sizeof(mcd_state));
\r
if (rom) memset(rom+0x20000, 0, sizeof(mcd_state)-0x20000);
\r
return rom;
\r
@@
-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
\r
if((filesize&0x3fff)==0x200) alloc_size+=0x200;
\r
else if(alloc_size-filesize < 4) alloc_size+=4; // padding for out-of-bound exec protection
\r
alloc_size&=~0x7ffff; // use alloc size of multiples of 512K, so that memhandlers could be set up more efficiently
\r
if((filesize&0x3fff)==0x200) alloc_size+=0x200;
\r
else if(alloc_size-filesize < 4) alloc_size+=4; // padding for out-of-bound exec protection
\r
- //dprintf("alloc_size: %x\n", alloc_size);
\r
\r
// Allocate space for the rom plus padding
\r
rom=(unsigned char *)malloc(alloc_size);
\r
\r
// Allocate space for the rom plus padding
\r
rom=(unsigned char *)malloc(alloc_size);
\r
@@
-548,10
+546,12
@@
void PicoCartDetect(void)
Pico.m.sram_reg |= 4;
\r
} else {
\r
// normal SRAM
\r
Pico.m.sram_reg |= 4;
\r
} else {
\r
// normal SRAM
\r
- SRam.start = PicoRead32(0x1B4) &
0xFFFF00
;
\r
+ SRam.start = PicoRead32(0x1B4) &
~0xff
;
\r
SRam.end = PicoRead32(0x1B8) | 1;
\r
sram_size = SRam.end - SRam.start + 1;
\r
}
\r
SRam.end = PicoRead32(0x1B8) | 1;
\r
sram_size = SRam.end - SRam.start + 1;
\r
}
\r
+ SRam.start &= ~0xff000000;
\r
+ SRam.end &= ~0xff000000;
\r
Pico.m.sram_reg |= 0x10; // SRAM was detected
\r
}
\r
if (sram_size <= 0)
\r
Pico.m.sram_reg |= 0x10; // SRAM was detected
\r
}
\r
if (sram_size <= 0)
\r
@@
-632,5
+632,13
@@
void PicoCartDetect(void)
// Unusual region 'code'
\r
if (rom_strcmp(0x1f0, "EUROPE") == 0)
\r
*(int *) (Pico.rom+0x1f0) = 0x20204520;
\r
// Unusual region 'code'
\r
if (rom_strcmp(0x1f0, "EUROPE") == 0)
\r
*(int *) (Pico.rom+0x1f0) = 0x20204520;
\r
+
\r
+ // SVP detection
\r
+ if (name_cmp("Virtua Racing") == 0)
\r
+ {
\r
+ PicoSVPInit();
\r
+ PicoRead16Hook = PicoSVPRead16;
\r
+ PicoWrite8Hook = PicoSVPWrite8;
\r
+ }
\r
}
\r
\r
}
\r
\r