@@ -65,6 +65,7 @@ static u32 readNum = 0;
65
65
static bool alreadySetMpu = false;
66
66
67
67
static bool flagsSet = false;
68
+ static bool hgssFix = false;
68
69
extern u32 ROMinRAM ;
69
70
extern u32 ROM_TID ;
70
71
extern u32 ARM9_LEN ;
@@ -280,6 +281,7 @@ int cardRead (u32* cacheStruct) {
280
281
|| (ROM_TID & 0x00FFFFFF ) == 0x475049 ) // Pokemon SoulSilver
281
282
{
282
283
cacheSlots = HGSS_CACHE_SLOTS ; // Use smaller cache size to avoid timing issues
284
+ hgssFix = true;
283
285
}
284
286
else if (consoleModel > 0 ) cacheSlots = dev_CACHE_SLOTS ;
285
287
@@ -320,10 +322,10 @@ int cardRead (u32* cacheStruct) {
320
322
321
323
accessCounter ++ ;
322
324
323
- processAsyncCommand ();
325
+ if (! hgssFix ) processAsyncCommand ();
324
326
325
327
if (page == src && len > _128KB_READ_SIZE && dst < 0x02700000 && dst > 0x02000000 && ((u32 )dst )%4 == 0 ) {
326
- getAsyncSector ();
328
+ if (! hgssFix ) getAsyncSector ();
327
329
328
330
// read directly at arm7 level
329
331
commandRead = 0x025FFB08 ;
@@ -347,7 +349,7 @@ int cardRead (u32* cacheStruct) {
347
349
u32 nextSector = sector + _128KB_READ_SIZE ;
348
350
// read max CACHE_READ_SIZE via the main RAM cache
349
351
if (slot == -1 ) {
350
- getAsyncSector ();
352
+ if (! hgssFix ) getAsyncSector ();
351
353
352
354
// send a command to the arm7 to fill the RAM cache
353
355
commandRead = 0x025FFB08 ;
@@ -370,20 +372,22 @@ int cardRead (u32* cacheStruct) {
370
372
371
373
updateDescriptor (slot , sector );
372
374
373
- triggerAsyncPrefetch (nextSector );
375
+ if (! hgssFix ) triggerAsyncPrefetch (nextSector );
374
376
} else {
375
- if (cacheCounter [slot ] == 0x0FFFFFFF ) {
376
- // prefetch successfull
377
- getAsyncSector ();
378
-
379
- triggerAsyncPrefetch (nextSector );
380
- } else {
381
- int i ;
382
- for (i = 0 ; i < 10 ; i ++ ) {
383
- if (asyncQueue [i ]== sector ) {
384
- // prefetch successfull
385
- triggerAsyncPrefetch (nextSector );
386
- break ;
377
+ if (!hgssFix ) {
378
+ if (cacheCounter [slot ] == 0x0FFFFFFF ) {
379
+ // prefetch successfull
380
+ getAsyncSector ();
381
+
382
+ triggerAsyncPrefetch (nextSector );
383
+ } else {
384
+ int i ;
385
+ for (i = 0 ; i < 10 ; i ++ ) {
386
+ if (asyncQueue [i ]== sector ) {
387
+ // prefetch successfull
388
+ triggerAsyncPrefetch (nextSector );
389
+ break ;
390
+ }
387
391
}
388
392
}
389
393
}
0 commit comments