Skip to content

Commit 7186cc0

Browse files
committed
Merge branch 'master' into libretro
2 parents 9059485 + 2f8f99f commit 7186cc0

File tree

13 files changed

+302
-759
lines changed

13 files changed

+302
-759
lines changed

frontend/libpicofe

frontend/libretro.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2878,6 +2878,8 @@ static void update_variables(bool in_flight)
28782878
Config.SlowBoot = 0;
28792879
if (strcmp(var.value, "enabled") == 0)
28802880
Config.SlowBoot = 1;
2881+
else if (strcmp(var.value, "enabled_no_pcsx") == 0)
2882+
Config.SlowBoot = 2;
28812883
}
28822884
}
28832885

frontend/libretro_core_options.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -145,6 +145,7 @@ struct retro_core_option_v2_definition option_defs_us[] = {
145145
{
146146
{ "disabled", NULL },
147147
{ "enabled", NULL },
148+
{ "enabled_no_pcsx", "ON, w/o PCSXtm" },
148149
{ NULL, NULL },
149150
},
150151
"disabled",

frontend/menu.c

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -787,12 +787,6 @@ static unsigned short fname2color(const char *fname)
787787
static void draw_savestate_bg(int slot);
788788

789789
#define MENU_ALIGN_LEFT
790-
#ifndef HAVE_PRE_ARMV7 // assume hires device
791-
#define MENU_X2 1
792-
#else
793-
#define MENU_X2 0
794-
#endif
795-
796790
#include "libpicofe/menu.c"
797791

798792
// a bit of black magic here
@@ -1541,6 +1535,7 @@ static int menu_loop_plugin_spu(int id, int keys)
15411535
}
15421536

15431537
static const char *men_gpu_dithering[] = { "OFF", "ON", "Force", NULL };
1538+
static const char *men_bios_boot[] = { "OFF", "ON", "ON w/o PCSX", NULL };
15441539

15451540
static const char h_bios[] = "HLE is simulated BIOS. BIOS selection is saved in\n"
15461541
"savestates and can't be changed there. Must save\n"
@@ -1602,9 +1597,12 @@ static int menu_loop_pluginsel_options(int id, int keys)
16021597
return 0;
16031598
}
16041599

1600+
static int slowboot_sel;
1601+
16051602
static menu_entry e_menu_plugin_options[] =
16061603
{
16071604
mee_enum_h ("BIOS", 0, bios_sel, bioses, h_bios),
1605+
mee_enum ("BIOS logo (slow boot)", 0, slowboot_sel, men_bios_boot),
16081606
mee_enum ("GPU Dithering", 0, pl_rearmed_cbs.dithering, men_gpu_dithering),
16091607
mee_enum_h ("GPU plugin", 0, gpu_plugsel, gpu_plugins, h_plugin_gpu),
16101608
mee_enum_h ("SPU plugin", 0, spu_plugsel, spu_plugins, h_plugin_spu),
@@ -1618,7 +1616,9 @@ static menu_entry e_menu_main2[];
16181616
static int menu_loop_plugin_options(int id, int keys)
16191617
{
16201618
static int sel = 0;
1619+
slowboot_sel = Config.SlowBoot;
16211620
me_loop(e_menu_plugin_options, &sel);
1621+
Config.SlowBoot = slowboot_sel;
16221622

16231623
// sync BIOS/plugins
16241624
snprintf(Config.Bios, sizeof(Config.Bios), "%s", bioses[bios_sel]);
@@ -2141,7 +2141,7 @@ static int run_bios(void)
21412141
ready_to_go = 0;
21422142
if (reload_plugins(NULL) != 0)
21432143
return -1;
2144-
Config.SlowBoot = 1;
2144+
Config.SlowBoot = 2;
21452145
SysReset();
21462146
Config.SlowBoot = origSlowBoot;
21472147

@@ -2672,7 +2672,7 @@ void menu_init(void)
26722672
cpu_clock_st = cpu_clock = plat_target_cpu_clock_get();
26732673

26742674
scan_bios_plugins();
2675-
menu_init_base();
2675+
menu_init_base_scale(g_menuscreen_w >= 640 && g_menuscreen_h >= 480 ? 2 : 1);
26762676

26772677
menu_set_defconfig();
26782678
menu_load_config(0);

libpcsxcore/cdrom-async.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,9 @@ static int c11_threads_cb_wrapper(void *cb)
8989
#include "../frontend/libretro-rthreads.h"
9090
#endif
9191

92+
#ifdef HAVE_LIBRETRO
9293
#include "retro_timers.h"
94+
#endif
9395

9496
struct cached_buf {
9597
u32 lba;
@@ -151,8 +153,10 @@ static void lbacache_do(u32 lba)
151153
memcpy(acdrom.buf_cache[i].buf_sub, buf_sub, sizeof(buf_sub));
152154
}
153155
slock_unlock(acdrom.buf_lock);
156+
#ifdef HAVE_LIBRETRO
154157
if (g_cd_handle)
155158
retro_sleep(0); // why does the main thread stall without this?
159+
#endif
156160
}
157161

158162
static int lbacache_get(unsigned int lba, void *buf, void *sub_buf)

libpcsxcore/cdrom.c

Lines changed: 29 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -424,10 +424,13 @@ static void Find_CurTrack(const u8 *time)
424424
static 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

libpcsxcore/psxcommon.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,7 @@ typedef struct {
132132
boolean Cdda;
133133
boolean CHD_Precache; /* loads disk image into memory, works with CHD only. */
134134
boolean HLE;
135-
boolean SlowBoot;
135+
uint8_t SlowBoot; // 0 = off, 1 = on, 2 = on, no PCSX 'ad'
136136
boolean Debug;
137137
boolean PsxOut;
138138
boolean icache_emulation;

0 commit comments

Comments
 (0)