@@ -424,10 +424,13 @@ static void Find_CurTrack(const u8 *time)
424424static void generate_subq (const u8 * time )
425425{
426426 unsigned char start [3 ], next [3 ];
427- unsigned int this_s , start_s , next_s , pregap ;
427+ int this_s , start_s , next_s , pregap ;
428428 int relative_s ;
429429
430- cdra_getTD (cdr .CurTrack , start );
430+ if (cdr .CurTrack <= cdr .ResultTN [1 ])
431+ cdra_getTD (cdr .CurTrack , start );
432+ else
433+ memcpy (start , cdr .SetSectorEnd , 3 );
431434 if (cdr .CurTrack + 1 <= cdr .ResultTN [1 ]) {
432435 pregap = 150 ;
433436 cdra_getTD (cdr .CurTrack + 1 , next );
@@ -444,7 +447,7 @@ static void generate_subq(const u8 *time)
444447
445448 cdr .TrackChanged = FALSE;
446449
447- if (next_s - this_s < pregap ) {
450+ if (next_s - this_s < pregap && cdr . CurTrack <= cdr . ResultTN [ 1 ] ) {
448451 cdr .TrackChanged = TRUE;
449452 cdr .CurTrack ++ ;
450453 start_s = next_s ;
@@ -461,6 +464,8 @@ static void generate_subq(const u8 *time)
461464 & cdr .subq .Relative [1 ], & cdr .subq .Relative [2 ]);
462465
463466 cdr .subq .Track = itob (cdr .CurTrack );
467+ if (cdr .CurTrack > cdr .ResultTN [1 ]) // lead-out
468+ cdr .subq .Track = 0xaa ;
464469 cdr .subq .Relative [0 ] = itob (cdr .subq .Relative [0 ]);
465470 cdr .subq .Relative [1 ] = itob (cdr .subq .Relative [1 ]);
466471 cdr .subq .Relative [2 ] = itob (cdr .subq .Relative [2 ]);
@@ -1206,8 +1211,20 @@ void cdrInterrupt(void) {
12061211 CDR_LOG_I ("CdlID: %02x %02x %02x %02x\n" , cdr .Result [0 ],
12071212 cdr .Result [1 ], cdr .Result [2 ], cdr .Result [3 ]);
12081213
1209- /* This adds the string "PCSX" in Playstation bios boot screen */
1210- memcpy ((char * )& cdr .Result [4 ], "PCSX" , 4 );
1214+ /* 4-char string in Playstation bios boot screen */
1215+ if (Config .SlowBoot == 1 )
1216+ memcpy (& cdr .Result [4 ], "PCSX" , 4 );
1217+ else {
1218+ cdr .Result [4 ] = 'S' ;
1219+ cdr .Result [5 ] = 'C' ;
1220+ cdr .Result [6 ] = 'E' ;
1221+ if (Config .PsxType == PSX_TYPE_PAL )
1222+ cdr .Result [7 ] = 'E' ;
1223+ else if (CdromId [2 ] == 'P' || CdromId [2 ] == 'p' )
1224+ cdr .Result [7 ] = 'I' ;
1225+ else
1226+ cdr .Result [7 ] = 'A' ;
1227+ }
12111228 IrqStat = Complete ;
12121229 break ;
12131230
@@ -1231,6 +1248,13 @@ void cdrInterrupt(void) {
12311248 case CdlReadToc + CMD_WHILE_NOT_READY :
12321249 cdr .LocL [0 ] = LOCL_INVALID ;
12331250 second_resp_time = cdReadTime * 180 / 4 ;
1251+ if (!Config .HLE && Config .SlowBoot ) {
1252+ // hack: compensate cdrom being emulated too fast
1253+ // and bios finishing before the reverb decays
1254+ second_resp_time += cdReadTime * 75 * 2 ;
1255+ if ((psxRegs .pc >> 28 ) == 0x0b )
1256+ second_resp_time += cdReadTime * 75 * 3 ;
1257+ }
12341258 start_rotating = 1 ;
12351259 break ;
12361260
0 commit comments