]> git.unchartedbackwaters.co.uk Git - francis/winuae.git/commitdiff
default_prefs reset check.
authorToni Wilen <twilen@winuae.net>
Wed, 10 Feb 2016 14:30:50 +0000 (16:30 +0200)
committerToni Wilen <twilen@winuae.net>
Wed, 10 Feb 2016 14:30:50 +0000 (16:30 +0200)
cfgfile.cpp
consolehook.cpp
include/inputdevice.h
include/options.h
inputdevice.cpp
main.cpp

index 87ac95f9a569378fd2ed4dfdb399eb9fa16c0e4c..678dafc3a4dd100d6d1af04f10ff805e8da24836 100644 (file)
@@ -1585,7 +1585,7 @@ void cfgfile_save_options (struct zfile *f, struct uae_prefs *p, int type)
        cfgfile_write_str (f, _T("gfx_colour_mode"), colormode1[p->color_mode]);
        cfgfile_write_bool(f, _T("gfx_blacker_than_black"), p->gfx_blackerthanblack);
        cfgfile_dwrite_bool(f, _T("gfx_monochrome"), p->gfx_grayscale);
-       cfgfile_write_str(f, _T("gfx_atari_palette_fix"), threebitcolors[p->gfx_threebitcolors]);
+       cfgfile_dwrite_str(f, _T("gfx_atari_palette_fix"), threebitcolors[p->gfx_threebitcolors]);
        cfgfile_dwrite_bool (f, _T("gfx_black_frame_insertion"), p->lightboost_strobo);
        cfgfile_write_str (f, _T("gfx_api"), filterapi[p->gfx_api]);
        cfgfile_dwrite (f, _T("gfx_horizontal_tweak"), _T("%d"), p->gfx_extrawidth);
@@ -6036,14 +6036,14 @@ static void default_prefs_mini (struct uae_prefs *p, int type)
 
 #include "sounddep/sound.h"
 
-void default_prefs (struct uae_prefs *p, int type)
+void default_prefs (struct uae_prefs *p, bool reset, int type)
 {
        int i;
        int roms[] = { 6, 7, 8, 9, 10, 14, 5, 4, 3, 2, 1, -1 };
        TCHAR zero = 0;
        struct zfile *f;
 
-       reset_inputdevice_config (p);
+       reset_inputdevice_config (p, reset);
        memset (p, 0, sizeof (*p));
        _tcscpy (p->description, _T("UAE default configuration"));
        p->config_hardware_path[0] = 0;
@@ -6082,8 +6082,10 @@ void default_prefs (struct uae_prefs *p, int type)
        p->jports[1].id = -1;
        p->jports[2].id = -1;
        p->jports[3].id = -1;
-       inputdevice_joyport_config_store(p, _T("mouse"), 0, -1, 0);
-       inputdevice_joyport_config_store(p, _T("kbd1"), 1, -1, 0);
+       if (reset) {
+               inputdevice_joyport_config_store(p, _T("mouse"), 0, -1, 0);
+               inputdevice_joyport_config_store(p, _T("kbd1"), 1, -1, 0);
+       }
        p->keyboard_lang = KBD_LANG_US;
 
        p->produce_sound = 3;
index c427b5781e0cf0b1c7fa34a3a4d0ea98aed93ae0..25a05597c4d5b93b849637aba137168796d2f835 100644 (file)
@@ -21,7 +21,7 @@ void consolehook_config (struct uae_prefs *p)
        struct uaedev_config_info ci = { 0 };
        int roms[] = { 15, 31, 16, 46, -1 };
 
-       default_prefs (p, 0);
+       default_prefs (p, true, 0);
        //p->headless = 1;
        p->produce_sound = 0;
        p->gfx_resolution = 0;
index 20d270a20e952480213f6fbebf8ceebd2ef9891c..38ba7c57b8b0a0ecf09224ee1ab48edecbcbf138 100644 (file)
@@ -179,6 +179,7 @@ extern int inputdevice_set_mapping (int devnum, int num, const TCHAR *name, TCHA
 extern int inputdevice_get_mapping (int devnum, int num, uae_u64 *pflags, int *port, TCHAR *name, TCHAR *custom, int sub);
 extern void inputdevice_copyconfig (struct uae_prefs *src, struct uae_prefs *dst);
 extern void inputdevice_copy_single_config (struct uae_prefs *p, int src, int dst, int devnum, int selectedwidget);
+extern void inputdevice_copyjports(struct uae_prefs *srcprefs, struct uae_prefs *dstprefs);
 extern void inputdevice_swap_ports (struct uae_prefs *p, int devnum);
 extern void inputdevice_swap_compa_ports (struct uae_prefs *p, int portswap);
 extern void inputdevice_config_change (void);
@@ -280,7 +281,7 @@ extern void inputdevice_reset (void);
 
 extern void write_inputdevice_config (struct uae_prefs *p, struct zfile *f);
 extern void read_inputdevice_config (struct uae_prefs *p, const TCHAR *option, TCHAR *value);
-extern void reset_inputdevice_config (struct uae_prefs *pr);
+extern void reset_inputdevice_config (struct uae_prefs *pr, bool reset);
 extern int inputdevice_joyport_config(struct uae_prefs *p, const TCHAR *value1, const TCHAR *value2, int portnum, int mode, int type, bool candefault);
 extern void inputdevice_joyport_config_store(struct uae_prefs *p, const TCHAR *value, int portnum, int mode, int type);
 extern int inputdevice_getjoyportdevice (int port, int val);
index 36a3c30bce2e6534304e036dd1abd2243bcc8666..2da006aa08a4321dba5cba4c19a5c35076733488 100644 (file)
@@ -755,7 +755,7 @@ extern void error_log (const TCHAR*, ...);
 extern TCHAR *get_error_log (void);
 extern bool is_error_log (void);
 
-extern void default_prefs (struct uae_prefs *, int);
+extern void default_prefs (struct uae_prefs *, bool, int);
 extern void discard_prefs (struct uae_prefs *, int);
 
 int parse_cmdline_option (struct uae_prefs *, TCHAR, const TCHAR*);
index 2284ac43b24cf1076f33326baa31f81f499d5960..0f5a69ea3adaa02fd8b72bd9909ffe5259a908e6 100644 (file)
@@ -1016,17 +1016,19 @@ static void reset_inputdevice_config_temp(void)
        temp_uid.lastdevtype = -1;
 }
 
-void reset_inputdevice_config (struct uae_prefs *prefs)
+void reset_inputdevice_config (struct uae_prefs *prefs, bool reset)
 {
        for (int i = 0; i < MAX_INPUT_SETTINGS; i++)
                reset_inputdevice_slot (prefs, i);
        reset_inputdevice_config_temp();
 
-       for (int i = 0; i < MAX_JPORTS; i++) {
-               struct jport_config *jp = &jport_config_store[i];
-               memset(jp, 0, sizeof(struct jport_config));
+       if (reset) {
+               for (int i = 0; i < MAX_JPORTS; i++) {
+                       struct jport_config *jp = &jport_config_store[i];
+                       memset(jp, 0, sizeof(struct jport_config));
+               }
+               inputdevice_store_clear();
        }
-       inputdevice_store_clear();
 }
 
 static void set_kbr_default_event (struct uae_input_device *kbr, struct uae_input_device_kbr_default *trans, int num)
@@ -2315,6 +2317,7 @@ static void inputdevice_mh_abs (int x, int y, uae_u32 buttonbits)
                }
 #endif
        }
+#if 0
        if (uaeboard_bank.baseaddr) {
                uae_u8 tmp[16];
 
@@ -2403,8 +2406,10 @@ static void inputdevice_mh_abs (int x, int y, uae_u32 buttonbits)
                        p[1] |= 4;
                }
        }
+#endif
 }
 
+#if 0
 void mousehack_write(int reg, uae_u16 val)
 {
        switch (reg)
@@ -2417,7 +2422,7 @@ void mousehack_write(int reg, uae_u16 val)
                break;
        }
 }
-
+#endif
 
 #if 0
 static void inputdevice_mh_abs_v36 (int x, int y)
@@ -6552,12 +6557,10 @@ static void resetinput (void)
        }
 }
 
-void inputdevice_updateconfig_internal (struct uae_prefs *srcprefs, struct uae_prefs *dstprefs)
+void inputdevice_copyjports(struct uae_prefs *srcprefs, struct uae_prefs *dstprefs)
 {
-       keyboard_default = keyboard_default_table[currprefs.input_keyboard_type];
-
        for (int i = 0; i < MAX_JPORTS; i++) {
-               copyjport (srcprefs, dstprefs, i);
+               copyjport(srcprefs, dstprefs, i);
        }
        if (srcprefs) {
                for (int i = 0; i < MAX_JPORTS_CUSTOM; i++) {
@@ -6565,6 +6568,13 @@ void inputdevice_updateconfig_internal (struct uae_prefs *srcprefs, struct uae_p
                }
        }
 
+}
+
+void inputdevice_updateconfig_internal (struct uae_prefs *srcprefs, struct uae_prefs *dstprefs)
+{
+       keyboard_default = keyboard_default_table[currprefs.input_keyboard_type];
+
+       inputdevice_copyjports(srcprefs, dstprefs);
        resetinput ();
 
        joysticks = dstprefs->joystick_settings[dstprefs->input_selected_setting];
index 4b2630b6978db245a76f8c828817ebfa7774a82a..723b71f5c56c558e588b76d269b064494e26f5ee 100644 (file)
--- a/main.cpp
+++ b/main.cpp
@@ -1041,7 +1041,7 @@ static int real_main2 (int argc, TCHAR **argv)
 #endif
        set_config_changed ();
        if (restart_config[0]) {
-               default_prefs (&currprefs, 0);
+               default_prefs (&currprefs, true, 0);
                fixup_prefs (&currprefs, true);
        }