-Subproject commit 215e7ed2510e191664b611a578ffb987cf4fdab3
+Subproject commit 63f173a2509a27f9ae156ad6ee798d76dec0ad6b
extern int iXAPitch;
extern int iVolume;
-int ready_to_go, g_resetting;
+int ready_to_go, g_emu_want_quit, g_emu_resetting;
unsigned long gpuDisp;
char cfgfile_basename[MAXPATHLEN];
int state_slot;
return 0;
}
+void emu_core_ask_exit(void)
+{
+ stop = 1;
+ g_emu_want_quit = 1;
+}
+
#ifndef NO_FRONTEND
static void create_profile_dir(const char *directory) {
char path[MAXPATHLEN];
pl_start_watchdog();
- while (1)
+ while (!g_emu_want_quit)
{
stop = 0;
emu_action = SACTION_NONE;
do_emu_action();
}
+ printf("Exit..\n");
+ ClosePlugins();
+ SysClose();
+ menu_finish();
+ plat_finish();
+
return 0;
}
// so we need to prevent updateLace() call..
void *real_lace = GPU_updateLace;
GPU_updateLace = dummy_lace;
- g_resetting = 1;
+ g_emu_resetting = 1;
// reset can run code, timing must be set
pl_timing_prepare(Config.PsxType);
CDR_stop();
GPU_updateLace = real_lace;
- g_resetting = 0;
+ g_emu_resetting = 0;
}
void SysClose() {
StopDebugger();
- if (emuLog != NULL) fclose(emuLog);
+ if (emuLog != NULL && emuLog != stdout && emuLog != stderr) {
+ fclose(emuLog);
+ emuLog = NULL;
+ }
}
void SysUpdate() {
}
-void OnFile_Exit() {
- printf("OnFile_Exit\n");
- SysClose();
-#ifndef NO_FRONTEND
- menu_finish();
- plat_finish();
- exit(0);
-#endif
-}
-
int get_state_filename(char *buf, int size, int i) {
return get_gameid_filename(buf, size,
"." STATES_DIR "%.32s-%.9s.%3.3d", i);
}
static void SignalExit(int sig) {
- ClosePlugins();
- OnFile_Exit();
+ emu_core_ask_exit();
}
#define PARSEPATH(dst, src) \
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1307 USA
*/
-#ifndef __LINUX_H__
-#define __LINUX_H__
+#ifndef __FRONTEND_MAIN_H__
+#define __FRONTEND_MAIN_H__
#include "config.h"
int emu_core_preinit(void);
int emu_core_init(void);
+void emu_core_ask_exit(void);
+
void emu_set_default_config(void);
void emu_on_new_cd(int show_hud_msg);
void set_cd_image(const char *fname);
extern unsigned long gpuDisp;
-extern int ready_to_go, g_resetting;
+extern int ready_to_go, g_emu_want_quit, g_emu_resetting;
extern char hud_msg[64];
extern int hud_new_msg;
SACTION_SWITCH_DISPMODE,
SACTION_FAST_FORWARD,
SACTION_SCREENSHOT,
- SACTION_VOLUME_UP,
+ SACTION_VOLUME_UP, // 10
SACTION_VOLUME_DOWN,
SACTION_MINIMIZE,
SACTION_TOGGLE_FPS,
emu_action = action_;
}
-#endif /* __LINUX_H__ */
+#endif /* __FRONTEND_MAIN_H__ */
// ------------ main menu ------------
static menu_entry e_menu_main[];
-void OnFile_Exit();
static void draw_frame_main(void)
{
in_menu_wait(PBTN_MOK|PBTN_MBACK, NULL, 70);
break;
case MA_MAIN_EXIT:
- OnFile_Exit();
- break;
+ emu_core_ask_exit();
+ return 1;
default:
lprintf("%s: something unknown selected\n", __FUNCTION__);
break;
do {
me_loop_d(e_menu_main, &sel, NULL, draw_frame_main);
- } while (!ready_to_go);
+ } while (!ready_to_go && !g_emu_want_quit);
/* wait until menu, ok, back is released */
while (in_menu_wait_any(NULL, 50) & (PBTN_MENU|PBTN_MOK|PBTN_MBACK))
return plat_sdl_change_video_mode(w, h, 0);
}
+static void quit_cb(void)
+{
+ emu_core_ask_exit();
+}
+
void plat_init(void)
{
int ret;
pl_rearmed_cbs.only_16bpp = 1;
bgr_to_uyvy_init();
+ plat_sdl_quit_cb = quit_cb;
}
void plat_finish(void)
struct timeval now;
int diff, usadj;
- if (g_resetting)
+ if (g_emu_resetting)
return;
vsync_cnt++;