ref: 77a5b944f6846b83582dc467d16b71d2a5a538ec
parent: 5a78ffea7388a6ef0b522aaa7636c64f21459ae7
author: allkern <lisandroaalarcon@gmail.com>
date: Mon Aug 5 07:48:41 EDT 2024
Fixed resample buffer overflow Fixed GetTN (fixes Disney's Hercules Action Game (USA))
--- a/compat.txt
+++ b/compat.txt
@@ -6,8 +6,8 @@
CTR - Crash Team Racing (USA) *16 (regression)
Fixed: Crash Bash (USA) *1 (2989bb6)
Fixed: Crime Crackers (Japan) *20 (e145a4e)
-Disney's Hercules Action Game (USA) *22
-Disney's The Emperor's New Groove (USA).cue *22
+ Fixed: Disney's Hercules Action Game (USA) *22
+ Fixed: Disney's The Emperor's New Groove (USA).cue *22
Fixed: Doom (All) *4 (e145a4e)
Fixed: Elder Gate (Japan) *1 (2989bb6)
Fixed: Fear Effect (USA) (Disc 1) *3
@@ -14,8 +14,8 @@
Fixed: Final Doom (All) *4 (e145a4e)
Fixed: Final Fantasy IX (USA) (Disc 1) *22
Fixed: Gran Turismo 2 - Music at the Speed of Sound - The Album (USA) (Bonus PlayStation Disc) *19 (regression)
-Hello Kitty - Cube Frenzy (USA) *22
-Initial D (Japan) *3 (regression)
+ Fixed: Hello Kitty - Cube Frenzy (USA) *22 (FMVs are very slow though)
+ Fixed: Initial D (Japan) *22
Fixed: Konami 80's Arcade Gallery (Japan) *1 (2989bb6)
Nagano Winter Olympics '98 (USA) *18
Need for Speed II (USA) *17
@@ -38,7 +38,7 @@
Fixed: Time Gal & Ninja Hayate (Japan) (En,Ja) (Disc 2) (Ninja Hayate) *9
Fixed: Tokimeki Memorial 2 (Japan) *1 (2989bb6)
Fixed: Tomb Raider (USA) *8 (e145a4e)
-Tony Hawk's Pro Skater (USA) *10
+ Fixed: Tony Hawk's Pro Skater (USA) *22
Vib-Ribbon (Japan) *8
WipeOut (USA) *7
Fixed: Yu-Gi-Oh! Forbidden Memories (USA) *1 (2989bb6)
@@ -65,7 +65,7 @@
*19 Hangs on CdlSetloc deadloop
*20 GetlocP loop hangs
*21 Hangs after 0-sized CDROM DMA
-*22 MDEC corruption (need to fix ASAP)
+*22 MDEC corruption (fixed, XA resample buffer overflow)
Graphical issues:
Most graphical issues (black models, 1-pixel seams, polygon explosions, etc.) have been fixed!
--- a/psx/dev/cdrom/cdrom.h
+++ b/psx/dev/cdrom/cdrom.h
@@ -39,8 +39,10 @@
#define XA_STEREO_SAMPLES 2016 // Samples per sector
#define XA_MONO_SAMPLES 4032 // Samples per sector
-#define XA_STEREO_RESAMPLE_SIZE 2352 // 2352 * 2
-#define XA_MONO_RESAMPLE_SIZE 4704 // 4704 * 2
+#define XA_STEREO_RESAMPLE_SIZE 2352 // 2352
+#define XA_MONO_RESAMPLE_SIZE 4704 // 4704
+#define XA_STEREO_RESAMPLE_MAX_SIZE 4704 // 2352 * 2 (because of 18KHz mode)
+#define XA_MONO_RESAMPLE_MAX_SIZE 9408 // 4704 * 2 (because of 18KHz mode)
#define XA_UPSAMPLE_SIZE 28224 // 4032 * 7
#define XA_RINGBUF_SIZE 32
@@ -252,9 +254,9 @@
int16_t xa_right_buf[XA_STEREO_SAMPLES];
int16_t xa_mono_buf[XA_MONO_SAMPLES];
int16_t xa_upsample_buf[XA_UPSAMPLE_SIZE];
- int16_t xa_left_resample_buf[XA_STEREO_RESAMPLE_SIZE];
- int16_t xa_right_resample_buf[XA_STEREO_RESAMPLE_SIZE];
- int16_t xa_mono_resample_buf[XA_MONO_RESAMPLE_SIZE];
+ int16_t xa_left_resample_buf[XA_STEREO_RESAMPLE_MAX_SIZE];
+ int16_t xa_right_resample_buf[XA_STEREO_RESAMPLE_MAX_SIZE];
+ int16_t xa_mono_resample_buf[XA_MONO_RESAMPLE_MAX_SIZE];
} psx_cdrom_t;
enum {--- a/psx/dev/cdrom/impl.c
+++ b/psx/dev/cdrom/impl.c
@@ -484,7 +484,7 @@
queue_push(cdrom->response, 1);
queue_push(cdrom->response, ITOB(tn));
- cdrom_pause(cdrom);
+ cdrom_restore_state(cdrom);
}
void cdrom_cmd_gettd(psx_cdrom_t* cdrom) {--
⑨