From d8afe7b8a7f4e5c359a2d347f0dd182575cf66fc Mon Sep 17 00:00:00 2001 From: notaz Date: Fri, 7 Aug 2009 14:11:03 +0000 Subject: [PATCH] bugfix + some tweaks git-svn-id: file:///home/notaz/opt/svn/PicoDrive@737 be3aeb3a-fb24-0410-a615-afba39da0efa --- pico/sound/sound.c | 7 ++++--- platform/common/emu.c | 3 ++- platform/linux/in_evdev.c | 10 ++++++++++ 3 files changed, 16 insertions(+), 4 deletions(-) diff --git a/pico/sound/sound.c b/pico/sound/sound.c index daf62b0..2b61fc9 100644 --- a/pico/sound/sound.c +++ b/pico/sound/sound.c @@ -131,14 +131,15 @@ void PsndRerate(int preserve_state) } if (preserve_state) { - state = malloc(0x200); + state = malloc(0x204); if (state == NULL) return; - memcpy(state, YM2612GetRegs(), 0x200); + ym2612_pack_state(); + memcpy(state, YM2612GetRegs(), 0x204); } YM2612Init(Pico.m.pal ? OSC_PAL/7 : OSC_NTSC/7, PsndRate); if (preserve_state) { // feed it back it's own registers, just like after loading state - memcpy(YM2612GetRegs(), state, 0x200); + memcpy(YM2612GetRegs(), state, 0x204); ym2612_unpack_state(); if ((PicoAHW & PAHW_MCD) && !(Pico_mcd->s68k_regs[0x36] & 1) && (Pico_mcd->scd.Status_CDC & 1)) cdda_start_play(); diff --git a/platform/common/emu.c b/platform/common/emu.c index becc0c2..4341d6a 100644 --- a/platform/common/emu.c +++ b/platform/common/emu.c @@ -643,7 +643,8 @@ int emu_read_config(int game, int no_defaults) // read global config, and apply game_def.cfg on top make_config_cfg(cfg); config_readsect(cfg, NULL); - ret = config_readsect("game_def.cfg", sect); + emu_make_path(cfg, "game_def.cfg", sizeof(cfg)); + ret = config_readsect(cfg, sect); } if (ret == 0) diff --git a/platform/linux/in_evdev.c b/platform/linux/in_evdev.c index 4e23677..7866015 100644 --- a/platform/linux/in_evdev.c +++ b/platform/linux/in_evdev.c @@ -317,6 +317,16 @@ static void in_evdev_set_blocking(void *drv_data, int y) perror("in_evdev: F_GETFL fcntl failed"); return; } + + if (flags & O_NONBLOCK) { + /* flush the event queue */ + struct input_event ev; + do { + ret = read(dev->fd, &ev, sizeof(ev)); + } + while (ret == sizeof(ev)); + } + if (y) flags &= ~O_NONBLOCK; else -- 2.39.2