static int DISPLAY (const char *line) { if (matchstr (&line, "ON")) clear_inhibit_frame (IHF_SCROLLLOCK); else if (matchstr (&line, "OFF")) set_inhibit_frame (IHF_SCROLLLOCK); else if (matchstr (&line, "TOGGLE")) toggle_inhibit_frame (IHF_SCROLLLOCK); else return RC_ERROR; return RC_OK; }
/* * Here's where all the action takes place! */ void real_main (int argc, char **argv) { show_version (); #if defined (NATMEM_OFFSET) if (NATMEM_OFFSET == 0 && sizeof (void*) < 8) { write_log ("NATMEM_OFFSET is 0; I hope you used 'uae-preloader' to load me, or else ...\n"); } #endif #ifdef FILESYS currprefs.mountinfo = changed_prefs.mountinfo = &options_mountinfo; #endif restart_program = 1; #ifdef _WIN32 sprintf (restart_config, "%sConfigurations\\", start_path); #endif strcat (restart_config, OPTIONSFILENAME); /* Initial state is stopped */ uae_target_state = UAE_STATE_STOPPED; while (uae_target_state != UAE_STATE_QUITTING) { int want_gui; set_state (uae_target_state); do_preinit_machine (argc, argv); /* Should we open the GUI? TODO: This mess needs to go away */ want_gui = currprefs.start_gui; if (restart_program == 2) want_gui = 0; else if (restart_program == 3) want_gui = 1; changed_prefs = currprefs; if (want_gui) { /* Handle GUI at start-up */ int err = gui_open (); if (err >= 0) { do { gui_handle_events (); uae_msleep (10); } while (!uae_state_change_pending ()); } else if (err == - 1) { if (restart_program == 3) { restart_program = 0; uae_quit (); } } else uae_quit (); currprefs = changed_prefs; fix_options (); inputdevice_init (); } restart_program = 0; if (uae_target_state == UAE_STATE_QUITTING) break; uae_target_state = UAE_STATE_COLD_START; /* Start emulator proper. */ if (!do_init_machine ()) break; while (uae_target_state != UAE_STATE_QUITTING && uae_target_state != UAE_STATE_STOPPED) { /* Reset */ set_state (uae_target_state); do_reset_machine (uae_state == UAE_STATE_COLD_START); /* Running */ uae_target_state = UAE_STATE_RUNNING; /* * Main Loop */ do { set_state (uae_target_state); /* Run emulator. */ do_run_machine (); if (uae_target_state == UAE_STATE_PAUSED) { /* Paused */ set_state (uae_target_state); audio_pause (); /* While UAE is paused we have to handle * input events, etc. ourselves. */ do { gui_handle_events (); handle_events (); /* Manually pump input device */ inputdevicefunc_keyboard.read (); inputdevicefunc_mouse.read (); inputdevicefunc_joystick.read (); inputdevice_handle_inputcode (); /* Don't busy wait. */ uae_msleep (10); } while (!uae_state_change_pending ()); audio_resume (); } } while (uae_target_state == UAE_STATE_RUNNING); /* * End of Main Loop * * We're no longer running or paused. */ set_inhibit_frame (IHF_QUIT_PROGRAM); #ifdef FILESYS /* Ensure any cached changes to virtual filesystem are flushed before * resetting or exitting. */ filesys_prepare_reset (); #endif } /* while (!QUITTING && !STOPPED) */ do_exit_machine (); /* TODO: This stuff is a hack. What we need to do is * check whether a config GUI is available. If not, * then quit. */ restart_program = 3; } zfile_exit (); }