--- uae/src/main.c 2018/04/24 17:05:35 1.1.1.17 +++ uae/src/main.c 2018/04/24 17:14:16 1.1.1.20 @@ -25,14 +25,13 @@ #include "disk.h" #include "debug.h" #include "xwin.h" -#include "joystick.h" +#include "inputdevice.h" #include "keybuf.h" #include "gui.h" #include "zfile.h" #include "autoconf.h" #include "osemu.h" #include "osdep/exectasks.h" -#include "compiler.h" #include "picasso96.h" #include "bsdsocket.h" #include "uaeexe.h" @@ -95,6 +94,7 @@ void default_prefs (struct uae_prefs *p) p->start_gui = 1; p->start_debugger = 0; + p->leds_on_screen = 1; p->unknown_lines = 0; /* Note to porters: please don't change any of these options! UAE is supposed @@ -105,14 +105,15 @@ void default_prefs (struct uae_prefs *p) p->serial_demand = 0; p->parallel_demand = 0; - p->jport0 = 2; - p->jport1 = 0; + p->jport0 = JSEM_MICE; + p->jport1 = JSEM_JOYS; + p->keyboard_lang = KBD_LANG_US; p->emul_accuracy = 2; p->test_drawing_speed = 0; p->produce_sound = 0; - p->stereo = 0; + p->sound_stereo = 0; p->sound_bits = DEFAULT_SOUND_BITS; p->sound_freq = DEFAULT_SOUND_FREQ; p->sound_minbsiz = DEFAULT_SOUND_MINB; @@ -147,7 +148,6 @@ void default_prefs (struct uae_prefs *p) p->immediate_blits = 0; p->collision_level = 1; - p->fast_copper = 1; strcpy (p->df[0], "df0.adf"); strcpy (p->df[1], "df1.adf"); @@ -180,6 +180,7 @@ void default_prefs (struct uae_prefs *p) p->nr_floppies = 4; p->mountinfo = alloc_mountinfo (); + inputdevice_default_prefs (p); } void fixup_prefs_dimensions (struct uae_prefs *prefs) @@ -255,7 +256,7 @@ static void fix_options (void) err = 1; } #endif - + if (currprefs.produce_sound < 0 || currprefs.produce_sound > 3) { write_log ("Bad value for -S parameter: enable value must be within 0..3\n"); currprefs.produce_sound = 0; @@ -298,10 +299,13 @@ static void fix_options (void) int quit_program = 0; -void uae_reset (void) +void uae_reset (int hardreset) { - if (quit_program == 0) + if (quit_program == 0) { quit_program = -2; + if (hardreset) + quit_program = -3; + } } void uae_quit (void) @@ -310,24 +314,6 @@ void uae_quit (void) quit_program = -1; } -const char *gameport_state (int nr) -{ - if (JSEM_ISJOY0 (nr, &currprefs) && nr_joysticks > 0) - return "using joystick #0"; - else if (JSEM_ISJOY1 (nr, &currprefs) && nr_joysticks > 1) - return "using joystick #1"; - else if (JSEM_ISMOUSE (nr, &currprefs)) - return "using mouse"; - else if (JSEM_ISNUMPAD (nr, &currprefs)) - return "using numeric pad as joystick"; - else if (JSEM_ISCURSOR (nr, &currprefs)) - return "using cursor keys as joystick"; - else if (JSEM_ISSOMEWHEREELSE (nr, &currprefs)) - return "using T/F/H/B/Alt as joystick"; - - return "not connected"; -} - #ifndef DONT_PARSE_CMDLINE void usage (void) @@ -420,15 +406,20 @@ void reset_all_systems (void) void do_start_program (void) { + if (quit_program == -1) + return; + inputdevice_updateconfig (&currprefs); + /* Do a reset on startup. Whether this is elegant is debatable. */ - quit_program = 2; + if (quit_program >= 0) + quit_program = 2; m68k_go (1); } void do_leave_program (void) { graphics_leave (); - close_joystick (); + inputdevice_close (); close_sound (); dump_counts (); serial_exit (); @@ -461,7 +452,7 @@ void real_main (int argc, char **argv) #endif default_prefs (&currprefs); - + if (! graphics_setup ()) { exit (1); } @@ -469,7 +460,6 @@ void real_main (int argc, char **argv) rtarea_init (); hardfile_install (); scsidev_install (); - ahi_install (); parse_cmdline_and_init_file (argc, argv); @@ -479,7 +469,7 @@ void real_main (int argc, char **argv) write_log ("Sound driver unavailable: Sound output disabled\n"); currprefs.produce_sound = 0; } - init_joystick (); + inputdevice_init (); changed_prefs = currprefs; no_gui = ! currprefs.start_gui; @@ -521,7 +511,6 @@ void real_main (int argc, char **argv) reset_frame_rate_hack (); init_m68k(); /* must come after reset_frame_rate_hack (); */ - compiler_init (); gui_update (); if (graphics_init ()) {