OSDN Git Service

[VM][BMJr][Qt] Input all of keys even using Qt.See bmjr.txt .
authorK.Ohta <whatisthis.sowhat@gmail.com>
Thu, 10 Mar 2016 13:49:25 +0000 (22:49 +0900)
committerK.Ohta <whatisthis.sowhat@gmail.com>
Thu, 10 Mar 2016 13:49:25 +0000 (22:49 +0900)
doc/ToDo.ja.txt
doc/VMs/bmjr.txt
source/src/qt/osd_input.cpp
source/src/vm/bmjr/memory.cpp

index e7e8448..4ae5da4 100644 (file)
@@ -27,6 +27,7 @@ To Do (今後やろうと思うこと) 2016-03-06 K.Ohta
 *出来た>[Qt] WindowsXP等での警告の消し方をドキュメントに追加 https://support.microsoft.com/en-us/kb/310519
 *出来た。要変更(コンソール側の)フォントサイズ。>[Qt][Windows] ログの漢字が文字化けするのの解消
 *出来た>[Qt] 音量に関するダイアログ等
+[FM7][FM8] グリーンモニタ機能の実装(Request from Anna_Wu).
 
 以下、レスポンス関連
 ※http://hanabi.2ch.net/test/read.cgi/i4004/1430836648/528
index 5efecf3..c8e30d4 100644 (file)
@@ -10,6 +10,7 @@
 
 --- Key maps
 
+Win32 upstream Version:
        Virtual         PC
        --------------------------------
        EISUU           Left Ctrl
        KANA            Right Ctrl
        KANAKIGOU       Right Shift
 
+Qt Version (includes Windows):
+       Virtual         PC
+       --------------------------------
+       EISUU           Left Ctrl
+       EIKIGOU         Left Shift
+       KANA            Kana
+       KANAKIGOU       Right Windows
 ----------------------------------------
 TAKEDA, toshiya
 t-takeda@m1.interq.or.jp
index b145c6c..b2241f9 100644 (file)
@@ -226,130 +226,75 @@ void OSD::update_input()
 
 void OSD::key_down(int code, bool repeat)
 {
-       bool keep_frames = false;
-       if(code == VK_SHIFT){
-#ifndef USE_SHIFT_NUMPAD_KEY
-               if(GetAsyncKeyState(VK_SHIFT) & 0x8000) {
-                        key_status[VK_LSHIFT] = 0x80;
-                        key_status[VK_RSHIFT] = 0x80;
-                        key_status[VK_SHIFT] = 0x80;
+       if(code == VK_SHIFT) {
+               if(!(key_status[VK_LSHIFT] & 0x80) && (GetAsyncKeyState(VK_LSHIFT) & 0x8000)) {
+                       code = VK_LSHIFT;
+               } else if(!(key_status[VK_RSHIFT] & 0x80) && (GetAsyncKeyState(VK_RSHIFT) & 0x8000)) {
+                       code = VK_RSHIFT;
+               } else {
+                       return;
                }
-#endif
-       } else if(code == VK_LSHIFT){
-#ifndef USE_SHIFT_NUMPAD_KEY
-               if(GetAsyncKeyState(VK_LSHIFT) & 0x8000) key_status[VK_LSHIFT] = 0x80;
-#endif
-       } else if(code == VK_RSHIFT){
-#ifndef USE_SHIFT_NUMPAD_KEY
-               if(GetAsyncKeyState(VK_RSHIFT) & 0x8000) key_status[VK_RSHIFT] = 0x80;
-#endif
        } else if(code == VK_CONTROL) {
-               if(GetAsyncKeyState(VK_CONTROL) & 0x8000) {
-                       key_status[VK_LCONTROL] = 0x80;
-                       key_status[VK_RCONTROL] = 0x80;
-                       key_status[VK_CONTROL] = 0x80;
+               if(!(key_status[VK_LCONTROL] & 0x80) && (GetAsyncKeyState(VK_LCONTROL) & 0x8000)) {
+                       code = VK_LCONTROL;
+               } else if(!(key_status[VK_RCONTROL] & 0x80) && (GetAsyncKeyState(VK_RCONTROL) & 0x8000)) {
+                       code = VK_RCONTROL;
+               } else {
+                       return;
                }
-       } else if(code == VK_LCONTROL) {
-               if(GetAsyncKeyState(VK_LCONTROL) & 0x8000) key_status[VK_LCONTROL] = 0x80;
-       } else if(code == VK_RCONTROL) {
-               if(GetAsyncKeyState(VK_RCONTROL) & 0x8000) key_status[VK_RCONTROL] = 0x80;
        } else if(code == VK_MENU) {
-               if(GetAsyncKeyState(VK_MENU) & 0x8000) {
-                       key_status[VK_LMENU] = 0x80;
-                       key_status[VK_RMENU] = 0x80;
-                       key_status[VK_MENU] = 0x80;
+               if(!(key_status[VK_LMENU] & 0x80) && (GetAsyncKeyState(VK_LMENU) & 0x8000)) {
+                       code = VK_LMENU;
+               } else if(!(key_status[VK_RMENU] & 0x80) && (GetAsyncKeyState(VK_RMENU) & 0x8000)) {
+                       code = VK_RMENU;
+               } else {
+                       return;
                }
-       } else if(code == VK_LMENU) {
-               if(GetAsyncKeyState(VK_LMENU) & 0x8000) key_status[VK_LMENU] = 0x80;
-       } else if(code == VK_RMENU) {
-               if(GetAsyncKeyState(VK_RMENU) & 0x8000) key_status[VK_RMENU] = 0x80;
-       } else if(code == 0xf0) {
-               code = VK_CAPITAL;
-               keep_frames = true;
-       } else if(code == 0xf2) {
-               code = VK_KANA;
-               keep_frames = true;
-       } else if(code == 0xf3 || code == 0xf4) {
-               code = VK_KANJI;
-               keep_frames = true;
        }
-
-# ifdef USE_SHIFT_NUMPAD_KEY
-       if(code == VK_SHIFT) {
+#ifdef USE_SHIFT_NUMPAD_KEY
+       if(code == VK_LSHIFT) {
                key_shift_pressed = true;
-               key_shift_released = false;
-               return;
+                       return;
        } else if(numpad_table[code] != 0) {
                if(key_shift_pressed || key_shift_released) {
                        key_converted[code] = 1;
                        key_shift_pressed = true;
-                       key_shift_released = false;
                        code = numpad_table[code];
                }
        }
 #endif
-
-       if(!(code == VK_CONTROL || code == VK_MENU || code == VK_SHIFT || code == VK_LSHIFT || code == VK_RSHIFT)) {
-               code = keycode_conv[code];
-       }
-       
-#ifdef DONT_KEEEP_KEY_PRESSED
-       if(!(code == VK_CONTROL || code == VK_MENU || code == VK_SHIFT || code == VK_LSHIFT || code == VK_RSHIFT)) {
-               key_status[code] = KEY_KEEP_FRAMES;
-       } else
-#endif
-     
-       key_status[code] = keep_frames ? KEY_KEEP_FRAMES : 0x80;
-#ifdef NOTIFY_KEY_DOWN
-       if(keep_frames) {
-               repeat = false;
-       }
-       vm->key_down(code, repeat);
-#endif
+       key_down_native(code, repeat);
 }
 
 void OSD::key_up(int code)
 {
        if(code == VK_SHIFT) {
-#ifndef USE_SHIFT_NUMPAD_KEY
-               if(!(GetAsyncKeyState(VK_SHIFT) & 0x8000)) {
-                       key_status[VK_LSHIFT] &= 0x7f;
-                       key_status[VK_RSHIFT] &= 0x7f;
-                       key_status[VK_SHIFT] &= 0x7f;
+               if((key_status[VK_LSHIFT] & 0x80) && !(GetAsyncKeyState(VK_LSHIFT) & 0x8000)) {
+                       code = VK_LSHIFT;
+               } else if((key_status[VK_RSHIFT] & 0x80) && !(GetAsyncKeyState(VK_RSHIFT) & 0x8000)) {
+                       code = VK_RSHIFT;
+               } else {
+                       return;
                }
-#endif
-       } else if(code == VK_LSHIFT) {
-#ifndef USE_SHIFT_NUMPAD_KEY
-               if(!(GetAsyncKeyState(VK_LSHIFT) & 0x8000)) key_status[VK_LSHIFT] &= 0x7f;
-#endif
-       } else if(code == VK_RSHIFT) {
-#ifndef USE_SHIFT_NUMPAD_KEY
-               if(!(GetAsyncKeyState(VK_RSHIFT) & 0x8000)) key_status[VK_RSHIFT] &= 0x7f;
-#endif
        } else if(code == VK_CONTROL) {
-               if(!(GetAsyncKeyState(VK_CONTROL) & 0x8000)) {
-                       key_status[VK_LCONTROL] &= 0x7f;
-                       key_status[VK_RCONTROL] &= 0x7f;
-                       key_status[VK_CONTROL] &= 0x7f;
+               if((key_status[VK_LCONTROL] & 0x80) && !(GetAsyncKeyState(VK_LCONTROL) & 0x8000)) {
+                       code = VK_LCONTROL;
+               } else if((key_status[VK_RCONTROL] & 0x80) && !(GetAsyncKeyState(VK_RCONTROL) & 0x8000)) {
+                       code = VK_RCONTROL;
+               } else {
+                       return;
                }
-       } else if(code == VK_LCONTROL) {
-               if(!(GetAsyncKeyState(VK_LCONTROL) & 0x8000)) key_status[VK_LCONTROL] &= 0x7f;
-       } else if(code == VK_RCONTROL) {
-               if(!(GetAsyncKeyState(VK_RCONTROL) & 0x8000)) key_status[VK_RCONTROL] &= 0x7f;
        } else if(code == VK_MENU) {
-               if(!(GetAsyncKeyState(VK_MENU) & 0x8000)) {
-                       key_status[VK_LMENU] &= 0x7f;
-                       key_status[VK_RMENU] &= 0x7f;
-                       key_status[VK_MENU] &= 0x7f;
+               if((key_status[VK_LMENU] & 0x80) && !(GetAsyncKeyState(VK_LMENU) & 0x8000)) {
+                       code = VK_LMENU;
+               } else if((key_status[VK_RMENU] & 0x80) && !(GetAsyncKeyState(VK_RMENU) & 0x8000)) {
+                       code = VK_RMENU;
+               } else {
+                       return;
                }
-       } else if(code == VK_LMENU) {
-               if(!(GetAsyncKeyState(VK_LMENU) & 0x8000)) key_status[VK_LMENU] &= 0x7f;
-       } else if(code == VK_RMENU) {
-               if(!(GetAsyncKeyState(VK_RMENU) & 0x8000)) key_status[VK_RMENU] &= 0x7f;
        }
-
 #ifdef USE_SHIFT_NUMPAD_KEY
-       if((code == VK_SHIFT) || (code == VK_RSHIFT) || (code == VK_LSHIFT)) {
+       if(code == VK_LSHIFT) {
                key_shift_pressed = false;
                key_shift_released = true;
                return;
@@ -357,17 +302,11 @@ void OSD::key_up(int code)
                key_converted[code] = 0;
                code = numpad_table[code];
        }
-   
-#endif
-       if(!(code == VK_CONTROL || code == VK_MENU || code == VK_SHIFT || code == VK_LSHIFT || code == VK_RSHIFT)) {
-               code = keycode_conv[code];
-       }
-       key_status[code] &= 0x7f;
-#ifdef NOTIFY_KEY_DOWN
-       vm->key_up(code);
 #endif
+       key_up_native(code);
 }
 
+
 void OSD::key_down_native(int code, bool repeat)
 {
        bool keep_frames = false;
index a35a79c..7d7b5ef 100644 (file)
@@ -244,11 +244,20 @@ void MEMORY::event_frame()
                if(key_stat[key_table[key_column][2]]) key_data &= ~0x04;
                if(key_stat[key_table[key_column][3]]) key_data &= ~0x08;
        }
+
+#if defined(_USE_QT)
+       // If same as bm2, not effect below keys at Qt version.
+       if(key_stat[VK_LCONTROL]) key_data &= ~0x10; // \89p\90\94     -> LCTRL
+       if(key_stat[VK_LSHIFT]) key_data &= ~0x20; // \89p\8bL\8d\86   -> L-SHIFT
+       if(key_stat[VK_RWIN]) key_data &= ~0x40; // \83J\83i\8bL\8d\86 -> R-Win
+       if(key_stat[VK_KANA]) key_data &= ~0x80; // \83J\83i     -> \83J\83^\83J\83i\82Ð\82ç\82ª\82È
+#else
        // this is same as "\93ú\97§\83x\81[\83V\83b\83N\83}\83X\83^\81[Jr.(MB-6885)\83G\83~\83\85\83\8c\81[\83^ bm2"
        if(key_stat[0xa2]) key_data &= ~0x10; // \89p\90\94     -> L-CTRL
        if(key_stat[0xa0]) key_data &= ~0x20; // \89p\8bL\8d\86   -> L-SHIFT
        if(key_stat[0xa1]) key_data &= ~0x40; // \83J\83i\8bL\8d\86 -> R-SHIFT
        if(key_stat[0xa3]) key_data &= ~0x80; // \83J\83i     -> R-CTRL
+#endif 
 }
 
 void MEMORY::key_down(int code)