Skip to content

Commit

Permalink
plaform ps2+psp, fix display out of sync on hotkey save/load
Browse files Browse the repository at this point in the history
  • Loading branch information
irixxxx committed Oct 15, 2024
1 parent 4be2e8c commit 593c299
Show file tree
Hide file tree
Showing 8 changed files with 32 additions and 4 deletions.
1 change: 1 addition & 0 deletions platform/common/emu.c
Original file line number Diff line number Diff line change
Expand Up @@ -1251,6 +1251,7 @@ static void run_events_ui(unsigned int which)
emu_save_load_game((which & PEV_STATE_LOAD) ? 1 : 0, 0);
PicoStateProgressCB = NULL;
}
plat_status_msg_busy_done();
}
if (which & PEV_SWITCH_RND)
{
Expand Down
1 change: 1 addition & 0 deletions platform/common/emu.h
Original file line number Diff line number Diff line change
Expand Up @@ -191,6 +191,7 @@ void plat_finish(void);
/* used before things blocking for a while (these funcs redraw on return) */
void plat_status_msg_busy_first(const char *msg);
void plat_status_msg_busy_next(const char *msg);
void plat_status_msg_busy_done(void);
void plat_status_msg_clear(void);

void plat_video_toggle_renderer(int change, int menu_call);
Expand Down
4 changes: 4 additions & 0 deletions platform/gp2x/emu.c
Original file line number Diff line number Diff line change
Expand Up @@ -544,6 +544,10 @@ void plat_status_msg_busy_first(const char *msg)
plat_status_msg_busy_next(msg);
}

void plat_status_msg_busy_done(void)
{
}

static void vid_reset_mode(void)
{
int gp2x_mode = 16;
Expand Down
4 changes: 4 additions & 0 deletions platform/linux/emu.c
Original file line number Diff line number Diff line change
Expand Up @@ -311,6 +311,10 @@ void plat_status_msg_busy_first(const char *msg)
plat_status_msg_busy_next(msg);
}

void plat_status_msg_busy_done(void)
{
}

void plat_update_volume(int has_changed, int is_up)
{
}
Expand Down
4 changes: 4 additions & 0 deletions platform/pandora/plat.c
Original file line number Diff line number Diff line change
Expand Up @@ -244,6 +244,10 @@ void plat_status_msg_busy_first(const char *msg)
plat_status_msg_busy_next(msg);
}

void plat_status_msg_busy_done(void)
{
}

void plat_update_volume(int has_changed, int is_up)
{
}
Expand Down
12 changes: 10 additions & 2 deletions platform/ps2/emu.c
Original file line number Diff line number Diff line change
Expand Up @@ -941,21 +941,29 @@ void plat_finish(void) {
video_deinit();
}

/* display emulator status messages before holding emulation */
/* display emulator status messages while holding emulation */
void plat_status_msg_busy_first(const char *msg)
{
// stop sound to make sure silence is played
pemu_sound_stop();
plat_status_msg_busy_next(msg);
}

void plat_status_msg_busy_next(const char *msg)
{
plat_status_msg_clear();
pemu_finalize_frame("", msg);
// flip twice since our gskit pipeline has one frame delay
plat_video_flip();
plat_video_flip();
emu_status_msg("");
reset_timing = 1;
}

void plat_status_msg_busy_done(void)
{
pemu_sound_start();
}

/* clear status message area */
void plat_status_msg_clear(void)
{
Expand Down
4 changes: 2 additions & 2 deletions platform/ps2/plat.c
Original file line number Diff line number Diff line change
Expand Up @@ -156,9 +156,9 @@ void plat_wait_till_us(unsigned int us_to)
{
// TODO hsync depends on NTSC/PAL (15750/15625 Hz), it however doesn't
// matter if it falls a bit short, the while loop will catch the rest
unsigned hsyncs = (us_to - plat_get_ticks_us()) * 15620 / 1000000;
int hsyncs = (us_to - plat_get_ticks_us()) * 15620 / 1000000;

if (hsyncs && SetAlarm(hsyncs, alarm_cb, (void *)GetThreadId()) >= 0)
if (hsyncs > 0 && SetAlarm(hsyncs, alarm_cb, (void *)GetThreadId()) >= 0)
SleepThread();
while ((int)(us_to - plat_get_ticks_us()) > 0)
RotateThreadReadyQueue(0);
Expand Down
6 changes: 6 additions & 0 deletions platform/psp/emu.c
Original file line number Diff line number Diff line change
Expand Up @@ -759,11 +759,17 @@ void plat_status_msg_busy_next(const char *msg)
{
plat_status_msg_clear();
pemu_finalize_frame("", msg);
// flip twice since our GU pipeline has one frame delay
plat_video_flip();
plat_video_flip();
emu_status_msg("");
reset_timing = 1;
}

void plat_status_msg_busy_done(void)
{
}

/* clear status message area */
void plat_status_msg_clear(void)
{
Expand Down

0 comments on commit 593c299

Please sign in to comment.