OSDN Git Service

[UI][Qt][OSD] Joystick-To-Keyboard: Add "1235" feature.Useful for DELPHIS (for FM... upstream_20181209
authorK.Ohta <whatisthis.sowhat@gmail.com>
Mon, 17 Dec 2018 18:30:41 +0000 (03:30 +0900)
committerK.Ohta <whatisthis.sowhat@gmail.com>
Mon, 17 Dec 2018 18:30:41 +0000 (03:30 +0900)
source/src/config.h
source/src/qt/emuutils/CMakeLists.txt
source/src/qt/gui/csp_qt_gui.ts
source/src/qt/gui/dropdown_joykey.cpp
source/src/qt/gui/dropdown_joykey.h
source/src/qt/osd_input.cpp
source/src/res/i18n/ja/csp_qt_gui.qm

index 9281e1e..5ebb7ef 100644 (file)
@@ -272,7 +272,7 @@ typedef struct {
        #if defined(USE_FIXED_CONFIG) || defined(USE_JOYSTICK)
                int joy_buttons[4][16];
                bool use_joy_to_key;
-               int joy_to_key_type;
+               int joy_to_key_type; // Note: ADD "1235" as type 3.20181218 K.O
                bool joy_to_key_numpad5;
                int joy_to_key_buttons[16];
        #endif
index ccc564d..84595be 100644 (file)
@@ -13,7 +13,7 @@ set(s_qt_emuutils_srcs
 
 QT5_WRAP_CPP(s_qt_emuutils_headers_MOC ${s_qt_emuutils_headers})
        
-SET(THIS_LIB_VERSION 2.14.2
+SET(THIS_LIB_VERSION 2.15.0
 
 add_definitions(-D__LIBEMU_UTIL_VERSION=\"libCSPemu_utils.${THIS_LIB_VERSION}\")
 
index 72d901f..8a423d5 100644 (file)
         <translation>2468 + 1379</translation>
     </message>
     <message>
-        <location filename="dropdown_joykey.cpp" line="52"/>
+        <location filename="dropdown_joykey.cpp" line="36"/>
+        <source>1235</source>
+        <translation>1235</translation>
+    </message>
+    <message>
+        <location filename="dropdown_joykey.cpp" line="56"/>
         <source>Joykey Type:</source>
         <oldsource>&lt;B&gt;Joykey Type:&lt;/B&gt;</oldsource>
         <translation>ジョイスティック→キーボード&#x3000;変換方式:</translation>
     </message>
     <message>
-        <location filename="dropdown_joykey.cpp" line="62"/>
+        <location filename="dropdown_joykey.cpp" line="68"/>
         <source>Physical Buttons:</source>
         <oldsource>&lt;B&gt;Physical Buttons:&lt;/B&gt;</oldsource>
         <translation>物理ボタン:</translation>
index c03b15b..e968cc7 100644 (file)
@@ -33,6 +33,7 @@ CSP_DropDownJoykey::CSP_DropDownJoykey(QWidget *parent, QStringList *lst, USING_
        QRadioButton *joykey_type_cursor = new QRadioButton(QApplication::translate("JoykeyDialog", "Cursor keys", 0), this);
        QRadioButton *joykey_type_2468 = new QRadioButton(QApplication::translate("JoykeyDialog", "2468", 0), this);
        QRadioButton *joykey_type_1379 = new QRadioButton(QApplication::translate("JoykeyDialog", "2468 + 1379", 0), this);
+       QRadioButton *joykey_type_1235 = new QRadioButton(QApplication::translate("JoykeyDialog", "1235", 0), this);
 
        switch(p_config->joy_to_key_type) {
        case 0:
@@ -44,6 +45,9 @@ CSP_DropDownJoykey::CSP_DropDownJoykey(QWidget *parent, QStringList *lst, USING_
        case 2:
                joykey_type_1379->setChecked(true);
                break;
+       case 3:
+               joykey_type_1235->setChecked(true);
+               break;
        default:
                joykey_type_cursor->setChecked(true);
                p_config->joy_to_key_type = 0;
@@ -52,15 +56,17 @@ CSP_DropDownJoykey::CSP_DropDownJoykey(QWidget *parent, QStringList *lst, USING_
        QLabel *label_joykey_type = new QLabel(QApplication::translate("JoykeyDialog", "Joykey Type:", 0), this);
        layout->addWidget(label_joykey_type, 1, 0, Qt::AlignLeft);
        layout->addWidget(joykey_type_cursor, 2, 0, Qt::AlignLeft);
-       layout->addWidget(joykey_type_2468, 3, 0, Qt::AlignLeft);
-       layout->addWidget(joykey_type_1379, 4, 0, Qt::AlignLeft);
+       layout->addWidget(joykey_type_2468, 2, 1, Qt::AlignLeft);
+       layout->addWidget(joykey_type_1379, 3, 0, Qt::AlignLeft);
+       layout->addWidget(joykey_type_1235, 3, 1, Qt::AlignLeft);
 
        connect(joykey_type_cursor, SIGNAL(clicked()), this, SLOT(do_set_type_cursor()));
        connect(joykey_type_2468, SIGNAL(clicked()), this, SLOT(do_set_type_2468()));
        connect(joykey_type_1379, SIGNAL(clicked()), this, SLOT(do_set_type_1379()));
+       connect(joykey_type_1235, SIGNAL(clicked()), this, SLOT(do_set_type_1235()));
        
        QLabel *label_buttons = new QLabel(QApplication::translate("JoykeyDialog", "Physical Buttons:", 0), this);
-       layout->addWidget(label_buttons, 5, 0, Qt::AlignLeft);
+       layout->addWidget(label_buttons, 4, 0, Qt::AlignLeft);
 
        _TCHAR tmps[32];
        QString nm;
@@ -71,8 +77,8 @@ CSP_DropDownJoykey::CSP_DropDownJoykey(QWidget *parent, QStringList *lst, USING_
                snprintf(tmps, 32, "Button#%02d to:", i + 1);
                nm = QString::fromUtf8(tmps);
                label_button[i]->setText(nm);
-               layout->addWidget(label_button[i], (i / 4) * 2 + 6 + 0, i % 4, Qt::AlignLeft);
-               layout->addWidget(js_button[i], (i / 4) * 2 + 6 + 1, i % 4, Qt::AlignLeft);
+               layout->addWidget(label_button[i], (i / 4) * 2 + 5 + 0, i % 4, Qt::AlignLeft);
+               layout->addWidget(js_button[i], (i / 4) * 2 + 5 + 1, i % 4, Qt::AlignLeft);
        }
 
 
@@ -105,3 +111,8 @@ void CSP_DropDownJoykey::do_set_type_1379()
        p_config->joy_to_key_type = 2;
 }
 
+void CSP_DropDownJoykey::do_set_type_1235()
+{
+       p_config->joy_to_key_type = 3;
+}
+
index 818e652..baea15a 100644 (file)
@@ -41,6 +41,7 @@ public slots:
        void do_set_type_cursor();
        void do_set_type_2468();
        void do_set_type_1379();
+       void do_set_type_1235();
 
 signals:
        
index 6f2001c..9361c32 100644 (file)
@@ -161,6 +161,13 @@ void OSD_BASE::update_input()
                        case 0x01       : status[VK_NUMPAD8] = 1; break; // up
                        case 0x01 + 0x08: status[VK_NUMPAD9] = 1; break; // up-right
                        }
+               } else if(p_config->joy_to_key_type == 3) { // 1235                     
+                       static const int vk[] = {VK_NUMPAD5, VK_NUMPAD2, VK_NUMPAD1, VK_NUMPAD3};
+                       for(int i = 0; i < 4; i++) {
+                               if(joy_status[0] & (1 << i)) {
+                                       status[vk[i]] = 1;
+                               }
+                       }
                }
                if(p_config->joy_to_key_type == 1 || p_config->joy_to_key_type == 2) {
                        // numpad key
@@ -170,7 +177,16 @@ void OSD_BASE::update_input()
                                        numpad_5_pressed = true;
                                }
                        }
+               } else if(p_config->joy_to_key_type == 3) {
+                       // numpad key
+                       if(p_config->joy_to_key_numpad5 && !(joy_status[0] & 0x0f)) {
+                               if(!numpad_5_pressed) {
+                                       status[VK_NUMPAD8] = 1;
+                                       numpad_5_pressed = true;
+                               }
+                       }
                }
+
                for(int i = 0; i < 16; i++) {
                        if(joy_status[0] & (1 << (i + 4))) {
                                if(p_config->joy_to_key_buttons[i] < 0 && -p_config->joy_to_key_buttons[i] < 256) {
@@ -186,8 +202,14 @@ void OSD_BASE::update_input()
                                                // do not keep key pressed
                                                if(p_config->joy_to_key_numpad5 && (i >= VK_NUMPAD1 && i <= VK_NUMPAD9)) {
                                                        key_status[i] = KEY_KEEP_FRAMES;
-                                                       if(numpad_5_pressed && (i != VK_NUMPAD5)) {
-                                                               numpad_5_pressed = false;
+                                                       if(p_config->joy_to_key_type == 3) {
+                                                               if(numpad_5_pressed && (i != VK_NUMPAD8)) {
+                                                                       numpad_5_pressed = false;
+                                                               }
+                                                       } else if((p_config->joy_to_key_type == 1) || (p_config->joy_to_key_type == 2)) {
+                                                               if(numpad_5_pressed && (i != VK_NUMPAD5)) {
+                                                                       numpad_5_pressed = false;
+                                                               }
                                                        }
                                                }
                                        }
index b0b6c66..7be6070 100644 (file)
Binary files a/source/src/res/i18n/ja/csp_qt_gui.qm and b/source/src/res/i18n/ja/csp_qt_gui.qm differ