mirror of
https://github.com/RaySollium99/picodrive.git
synced 2025-09-05 15:27:46 -04:00
bugfix, fd leak
git-svn-id: file:///home/notaz/opt/svn/PicoDrive@86 be3aeb3a-fb24-0410-a615-afba39da0efa
This commit is contained in:
parent
721cd3963f
commit
4696954094
6 changed files with 36 additions and 12 deletions
|
@ -216,6 +216,7 @@ static __inline void update_chips(void)
|
||||||
// delayed setting of DMNA bit (needed for Silpheed)
|
// delayed setting of DMNA bit (needed for Silpheed)
|
||||||
if (Pico_mcd->m.state_flags & 2) {
|
if (Pico_mcd->m.state_flags & 2) {
|
||||||
Pico_mcd->m.state_flags &= ~2;
|
Pico_mcd->m.state_flags &= ~2;
|
||||||
|
if (!(Pico_mcd->s68k_regs[3] & 4)) {
|
||||||
Pico_mcd->s68k_regs[3] |= 2;
|
Pico_mcd->s68k_regs[3] |= 2;
|
||||||
Pico_mcd->s68k_regs[3] &= ~1;
|
Pico_mcd->s68k_regs[3] &= ~1;
|
||||||
#ifdef USE_POLL_DETECT
|
#ifdef USE_POLL_DETECT
|
||||||
|
@ -224,6 +225,7 @@ static __inline void update_chips(void)
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -272,6 +272,9 @@ int emu_ReloadRom(void)
|
||||||
get_ext(romFileName, ext);
|
get_ext(romFileName, ext);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ((PicoMCD & 1) && Pico_mcd != NULL)
|
||||||
|
Stop_CD();
|
||||||
|
|
||||||
// check for MegaCD image
|
// check for MegaCD image
|
||||||
cd_state = emu_cd_check(&used_rom_name);
|
cd_state = emu_cd_check(&used_rom_name);
|
||||||
if (cd_state > 0) {
|
if (cd_state > 0) {
|
||||||
|
@ -837,9 +840,11 @@ static void RunEvents(unsigned int which)
|
||||||
{
|
{
|
||||||
if(which & 0x1800) { // save or load (but not both)
|
if(which & 0x1800) { // save or load (but not both)
|
||||||
int do_it = 1;
|
int do_it = 1;
|
||||||
if (!(which & 0x1000) && (currentConfig.EmuOpt & 0x200) && emu_check_save_file(state_slot)) {
|
if ( emu_check_save_file(state_slot) &&
|
||||||
|
(( (which & 0x1000) && (currentConfig.EmuOpt & 0x800)) || // load
|
||||||
|
(!(which & 0x1000) && (currentConfig.EmuOpt & 0x200))) ) { // save
|
||||||
unsigned long keys;
|
unsigned long keys;
|
||||||
blit("", "OVERWRITE SAVE? (Y=yes, X=no)");
|
blit("", (which & 0x1000) ? "LOAD STATE? (Y=yes, X=no)" : "OVERWRITE SAVE? (Y=yes, X=no)");
|
||||||
while( !((keys = gp2x_joystick_read(1)) & (GP2X_X|GP2X_Y)) )
|
while( !((keys = gp2x_joystick_read(1)) & (GP2X_X|GP2X_Y)) )
|
||||||
usleep(50*1024);
|
usleep(50*1024);
|
||||||
if (keys & GP2X_X) do_it = 0;
|
if (keys & GP2X_X) do_it = 0;
|
||||||
|
|
|
@ -20,7 +20,7 @@ typedef struct {
|
||||||
char lastRomFile[512];
|
char lastRomFile[512];
|
||||||
int EmuOpt; // LSb->MSb: use_sram, show_fps, enable_sound, gzip_saves,
|
int EmuOpt; // LSb->MSb: use_sram, show_fps, enable_sound, gzip_saves,
|
||||||
// squidgehack, no_save_cfg_on_exit, <unused>, 16_bit_mode
|
// squidgehack, no_save_cfg_on_exit, <unused>, 16_bit_mode
|
||||||
// craigix_ram, confirm_save, show_cd_leds
|
// craigix_ram, confirm_save, show_cd_leds, confirm_load
|
||||||
//
|
//
|
||||||
int PicoOpt; // used for config saving only, see Pico.h
|
int PicoOpt; // used for config saving only, see Pico.h
|
||||||
int PsndRate; // ditto
|
int PsndRate; // ditto
|
||||||
|
|
|
@ -956,7 +956,7 @@ static const char *region_name(unsigned int code)
|
||||||
static void draw_menu_options(int menu_sel)
|
static void draw_menu_options(int menu_sel)
|
||||||
{
|
{
|
||||||
int tl_x = 25, tl_y = 32, y;
|
int tl_x = 25, tl_y = 32, y;
|
||||||
char monostereo[8], strframeskip[8], *strrend, *strscaling;
|
char monostereo[8], strframeskip[8], *strrend, *strscaling, *strssconfirm;
|
||||||
|
|
||||||
strcpy(monostereo, (currentConfig.PicoOpt&0x08)?"stereo":"mono");
|
strcpy(monostereo, (currentConfig.PicoOpt&0x08)?"stereo":"mono");
|
||||||
if (currentConfig.Frameskip < 0)
|
if (currentConfig.Frameskip < 0)
|
||||||
|
@ -975,6 +975,12 @@ static void draw_menu_options(int menu_sel)
|
||||||
case 2: strscaling = "hw horiz. + vert."; break;
|
case 2: strscaling = "hw horiz. + vert."; break;
|
||||||
case 3: strscaling = "sw horizontal"; break;
|
case 3: strscaling = "sw horizontal"; break;
|
||||||
}
|
}
|
||||||
|
switch ((currentConfig.EmuOpt >> 9) & 5) {
|
||||||
|
default: strssconfirm = "OFF"; break;
|
||||||
|
case 1: strssconfirm = "writes"; break;
|
||||||
|
case 4: strssconfirm = "loads"; break;
|
||||||
|
case 5: strssconfirm = "both"; break;
|
||||||
|
}
|
||||||
|
|
||||||
y = tl_y;
|
y = tl_y;
|
||||||
//memset(gp2x_screen, 0, 320*240);
|
//memset(gp2x_screen, 0, 320*240);
|
||||||
|
@ -992,7 +998,7 @@ static void draw_menu_options(int menu_sel)
|
||||||
gp2x_text_out8(tl_x, (y+=10), "6 button pad %s", (currentConfig.PicoOpt&0x020)?"ON":"OFF"); // 9
|
gp2x_text_out8(tl_x, (y+=10), "6 button pad %s", (currentConfig.PicoOpt&0x020)?"ON":"OFF"); // 9
|
||||||
gp2x_text_out8(tl_x, (y+=10), "Genesis Region: %s", region_name(currentConfig.PicoRegion));
|
gp2x_text_out8(tl_x, (y+=10), "Genesis Region: %s", region_name(currentConfig.PicoRegion));
|
||||||
gp2x_text_out8(tl_x, (y+=10), "Use SRAM/BRAM savestates %s", (currentConfig.EmuOpt &0x001)?"ON":"OFF"); // 11
|
gp2x_text_out8(tl_x, (y+=10), "Use SRAM/BRAM savestates %s", (currentConfig.EmuOpt &0x001)?"ON":"OFF"); // 11
|
||||||
gp2x_text_out8(tl_x, (y+=10), "Confirm save overwrites %s", (currentConfig.EmuOpt &0x200)?"ON":"OFF"); // 12
|
gp2x_text_out8(tl_x, (y+=10), "Confirm savestate %s", strssconfirm); // 12
|
||||||
gp2x_text_out8(tl_x, (y+=10), "Save slot %i", state_slot); // 13
|
gp2x_text_out8(tl_x, (y+=10), "Save slot %i", state_slot); // 13
|
||||||
gp2x_text_out8(tl_x, (y+=10), "GP2X CPU clocks %iMhz", currentConfig.CPUclock);
|
gp2x_text_out8(tl_x, (y+=10), "GP2X CPU clocks %iMhz", currentConfig.CPUclock);
|
||||||
gp2x_text_out8(tl_x, (y+=10), "[Sega/Mega CD options]");
|
gp2x_text_out8(tl_x, (y+=10), "[Sega/Mega CD options]");
|
||||||
|
@ -1083,7 +1089,6 @@ static int menu_loop_options(void)
|
||||||
case 8: currentConfig.PicoOpt^=0x200; break;
|
case 8: currentConfig.PicoOpt^=0x200; break;
|
||||||
case 9: currentConfig.PicoOpt^=0x020; break;
|
case 9: currentConfig.PicoOpt^=0x020; break;
|
||||||
case 11: currentConfig.EmuOpt ^=0x001; break;
|
case 11: currentConfig.EmuOpt ^=0x001; break;
|
||||||
case 12: currentConfig.EmuOpt ^=0x200; break;
|
|
||||||
case 15: cd_menu_loop_options();
|
case 15: cd_menu_loop_options();
|
||||||
if (engineState == PGS_ReloadRom)
|
if (engineState == PGS_ReloadRom)
|
||||||
return 0; // test BIOS
|
return 0; // test BIOS
|
||||||
|
@ -1138,6 +1143,15 @@ static int menu_loop_options(void)
|
||||||
case 10:
|
case 10:
|
||||||
region_prevnext(inp & GP2X_RIGHT);
|
region_prevnext(inp & GP2X_RIGHT);
|
||||||
break;
|
break;
|
||||||
|
case 12: {
|
||||||
|
int n = ((currentConfig.EmuOpt>>9)&1) | ((currentConfig.EmuOpt>>10)&2);
|
||||||
|
n += (inp & GP2X_LEFT) ? -1 : 1;
|
||||||
|
if (n < 0) n = 0; else if (n > 3) n = 3;
|
||||||
|
n |= n << 1; n &= ~2;
|
||||||
|
currentConfig.EmuOpt &= ~0xa00;
|
||||||
|
currentConfig.EmuOpt |= n << 9;
|
||||||
|
break;
|
||||||
|
}
|
||||||
case 13:
|
case 13:
|
||||||
if (inp & GP2X_RIGHT) {
|
if (inp & GP2X_RIGHT) {
|
||||||
state_slot++; if (state_slot > 9) state_slot = 0;
|
state_slot++; if (state_slot > 9) state_slot = 0;
|
||||||
|
|
|
@ -402,7 +402,7 @@ int mmuunhack(void)
|
||||||
/* misc */
|
/* misc */
|
||||||
void spend_cycles(int c)
|
void spend_cycles(int c)
|
||||||
{
|
{
|
||||||
usleep(c/*/200*/);
|
usleep(c/200);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -227,6 +227,9 @@ Changelog
|
||||||
* Improved z80 timing, should fix some sound problems.
|
* Improved z80 timing, should fix some sound problems.
|
||||||
* Fixed a bug with sram register (fixes Phantasy Star 4).
|
* Fixed a bug with sram register (fixes Phantasy Star 4).
|
||||||
* Added code for PRG ram write protection register (Dungeon Explorer).
|
* Added code for PRG ram write protection register (Dungeon Explorer).
|
||||||
|
* The memory mode register change in 1.31 was unsafe and caused some glitches in
|
||||||
|
AH-3 Thunderstrike. Fixed.
|
||||||
|
* Fixed a file descriptor leak.
|
||||||
|
|
||||||
1.31
|
1.31
|
||||||
* Changed the way memory mode register is read (fixes Lunar 2, broken in 1.30).
|
* Changed the way memory mode register is read (fixes Lunar 2, broken in 1.30).
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue