]> git.unchartedbackwaters.co.uk Git - francis/winuae.git/commitdiff
keyboard connected -option.
authorToni Wilen <twilen@winuae.net>
Sun, 6 Nov 2016 14:56:56 +0000 (16:56 +0200)
committerToni Wilen <twilen@winuae.net>
Sun, 6 Nov 2016 14:56:56 +0000 (16:56 +0200)
cfgfile.cpp
cia.cpp
include/cia.h
include/options.h

index d60deb24a97b918253bd0f46bd316f29097bc8cb..fa99557dbb1b08785feed7258af0abb2c837cb58 100644 (file)
@@ -2187,6 +2187,7 @@ void cfgfile_save_options (struct zfile *f, struct uae_prefs *p, int type)
        cfgfile_write_bool(f, _T("fm801_pci"), p->obs_sound_fm801);
 #endif
 
+       cfgfile_dwrite_bool(f, _T("keyboard_connected"), p->keyboard_connected);
        cfgfile_write_str (f, _T("kbd_lang"), (p->keyboard_lang == KBD_LANG_DE ? _T("de")
                : p->keyboard_lang == KBD_LANG_DK ? _T("dk")
                : p->keyboard_lang == KBD_LANG_ES ? _T("es")
@@ -3438,6 +3439,7 @@ static int cfgfile_parse_host (struct uae_prefs *p, TCHAR *option, TCHAR *value)
                return 1;
        }
 
+
        if (_tcscmp (option, _T("kbd_lang")) == 0) {
                KbdLang l;
                if ((l = KBD_LANG_DE, strcasecmp (value, _T("de")) == 0)
@@ -4718,6 +4720,7 @@ static int cfgfile_parse_hardware (struct uae_prefs *p, const TCHAR *option, TCH
                || cfgfile_yesno(option, value, _T("gfxcard_hardware_vblank"), &p->rtg_hardwareinterrupt)
                || cfgfile_yesno(option, value, _T("gfxcard_hardware_sprite"), &p->rtg_hardwaresprite)
                || cfgfile_yesno(option, value, _T("synchronize_clock"), &p->tod_hack)
+               || cfgfile_yesno(option, value, _T("keyboard_connected"), &p->keyboard_connected)
 
                || cfgfile_yesno (option, value, _T("kickshifter"), &p->kickshifter)
                || cfgfile_yesno (option, value, _T("ks_write_enabled"), &p->rom_readwrite)
@@ -6718,6 +6721,7 @@ void default_prefs (struct uae_prefs *p, bool reset, int type)
                inputdevice_joyport_config_store(p, _T("kbd1"), 1, -1, 0);
        }
        p->keyboard_lang = KBD_LANG_US;
+       p->keyboard_connected = true;
 
        p->produce_sound = 3;
        p->sound_stereo = SND_STEREO;
@@ -7076,8 +7080,8 @@ static void buildin_default_prefs (struct uae_prefs *p)
        p->bogomem_size = 0x00080000;
        p->z3chipmem_size = 0;
        for (int i = 0; i < MAX_RAM_BOARDS; i++) {
-               p->fastmem[i].size = 0;
-               p->z3fastmem[i].size = 0;
+               memset(p->fastmem, 0, sizeof(struct ramboard));
+               memset(p->z3fastmem, 0, sizeof(struct ramboard));
        }
        for (int i = 0; i < MAX_RTG_BOARDS; i++) {
                p->rtgboards[i].rtgmem_size = 0x00000000;
diff --git a/cia.cpp b/cia.cpp
index 8d469addc4261f83ce0febe37e2ce3aeb932627d..e07a762990ba5e1273b1f1da604077c03a13dfc1 100644 (file)
--- a/cia.cpp
+++ b/cia.cpp
@@ -795,28 +795,41 @@ void CIAB_tod_handler (int hoffset)
        }
 }
 
+void keyboard_connected(void)
+{
+       kbstate = 0;
+       kblostsynccnt = 0;
+       resetwarning_phase = 0;
+}
+
 static void check_keyboard(void)
 {
-       if ((keys_available () || kbstate < 3) && !kblostsynccnt ) {
-               switch (kbstate)
-               {
-                       case 0:
-                               kbcode = 0; /* powerup resync */
-                               kbstate++;
-                               break;
-                       case 1:
-                               setcode (AK_INIT_POWERUP);
-                               kbstate++;
-                               break;
-                       case 2:
-                               setcode (AK_TERM_POWERUP);
-                               kbstate++;
-                               break;
-                       case 3:
-                               kbcode = ~get_next_key ();
-                               break;
-               }
-               keyreq ();
+       if (currprefs.keyboard_connected) {
+               if ((keys_available () || kbstate < 3) && !kblostsynccnt ) {
+                       switch (kbstate)
+                       {
+                               case 0:
+                                       kbcode = 0; /* powerup resync */
+                                       kbstate++;
+                                       break;
+                               case 1:
+                                       setcode (AK_INIT_POWERUP);
+                                       kbstate++;
+                                       break;
+                               case 2:
+                                       setcode (AK_TERM_POWERUP);
+                                       kbstate++;
+                                       break;
+                               case 3:
+                                       kbcode = ~get_next_key ();
+                                       break;
+                       }
+                       keyreq ();
+               }
+       } else {
+               while (keys_available()) {
+                       get_next_key();
+               }
        }
 }
 
@@ -832,7 +845,7 @@ void CIA_hsync_posthandler (bool ciahsync, bool dotod)
 
                if (currprefs.tod_hack && ciaatodon)
                        do_tod_hack (dotod);
-       } else {
+       } else if (currprefs.keyboard_connected) {
                // custom hsync
                if (resetwarning_phase) {
                        resetwarning_check ();
index 1b7e17694a61244711d4cd2613381567b1d84f9a..dc29ac9d492ccb476e41d4c3274a7277127572f3 100644 (file)
@@ -36,4 +36,6 @@ extern int parallel_direct_read_status (uae_u8*);
 
 extern void rtc_hardreset (void);
 
+extern void keyboard_connected(void);
+
 #endif /* UAE_CIA_H */
index e48a793df42ec32a07f2006a486e71b52ac19074..c390e29ea18b0872dc995546450295b79540d549 100644 (file)
@@ -506,6 +506,7 @@ struct uae_prefs {
        bool immediate_blits;
        int waiting_blits;
        unsigned int chipset_mask;
+       bool keyboard_connected;
        bool ntscmode;
        bool genlock;
        int genlock_image;