• R/O
  • HTTP
  • SSH
  • HTTPS

common_source_project-fm7: Commit

Common Source Code Project for Qt (a.k.a for FM-7).


Commit MetaInfo

Revisionee880845ec85aa431df3c7a937611e9c20dd591d (tree)
Time2018-12-18 03:30:41
AuthorK.Ohta <whatisthis.sowhat@gmai...>
CommiterK.Ohta

Log Message

[UI][Qt][OSD] Joystick-To-Keyboard: Add "1235" feature.Useful for DELPHIS (for FM-8/7) etc.

Change Summary

Incremental Difference

--- a/source/src/config.h
+++ b/source/src/config.h
@@ -272,7 +272,7 @@ typedef struct {
272272 #if defined(USE_FIXED_CONFIG) || defined(USE_JOYSTICK)
273273 int joy_buttons[4][16];
274274 bool use_joy_to_key;
275- int joy_to_key_type;
275+ int joy_to_key_type; // Note: ADD "1235" as type 3.20181218 K.O
276276 bool joy_to_key_numpad5;
277277 int joy_to_key_buttons[16];
278278 #endif
--- a/source/src/qt/emuutils/CMakeLists.txt
+++ b/source/src/qt/emuutils/CMakeLists.txt
@@ -13,7 +13,7 @@ set(s_qt_emuutils_srcs
1313
1414 QT5_WRAP_CPP(s_qt_emuutils_headers_MOC ${s_qt_emuutils_headers})
1515
16-SET(THIS_LIB_VERSION 2.14.2)
16+SET(THIS_LIB_VERSION 2.15.0)
1717
1818 add_definitions(-D__LIBEMU_UTIL_VERSION=\"libCSPemu_utils.${THIS_LIB_VERSION}\")
1919
--- a/source/src/qt/gui/csp_qt_gui.ts
+++ b/source/src/qt/gui/csp_qt_gui.ts
@@ -38,13 +38,18 @@
3838 <translation>2468 + 1379</translation>
3939 </message>
4040 <message>
41- <location filename="dropdown_joykey.cpp" line="52"/>
41+ <location filename="dropdown_joykey.cpp" line="36"/>
42+ <source>1235</source>
43+ <translation>1235</translation>
44+ </message>
45+ <message>
46+ <location filename="dropdown_joykey.cpp" line="56"/>
4247 <source>Joykey Type:</source>
4348 <oldsource>&lt;B&gt;Joykey Type:&lt;/B&gt;</oldsource>
4449 <translation>ジョイスティック→キーボード&#x3000;変換方式:</translation>
4550 </message>
4651 <message>
47- <location filename="dropdown_joykey.cpp" line="62"/>
52+ <location filename="dropdown_joykey.cpp" line="68"/>
4853 <source>Physical Buttons:</source>
4954 <oldsource>&lt;B&gt;Physical Buttons:&lt;/B&gt;</oldsource>
5055 <translation>物理ボタン:</translation>
--- a/source/src/qt/gui/dropdown_joykey.cpp
+++ b/source/src/qt/gui/dropdown_joykey.cpp
@@ -33,6 +33,7 @@ CSP_DropDownJoykey::CSP_DropDownJoykey(QWidget *parent, QStringList *lst, USING_
3333 QRadioButton *joykey_type_cursor = new QRadioButton(QApplication::translate("JoykeyDialog", "Cursor keys", 0), this);
3434 QRadioButton *joykey_type_2468 = new QRadioButton(QApplication::translate("JoykeyDialog", "2468", 0), this);
3535 QRadioButton *joykey_type_1379 = new QRadioButton(QApplication::translate("JoykeyDialog", "2468 + 1379", 0), this);
36+ QRadioButton *joykey_type_1235 = new QRadioButton(QApplication::translate("JoykeyDialog", "1235", 0), this);
3637
3738 switch(p_config->joy_to_key_type) {
3839 case 0:
@@ -44,6 +45,9 @@ CSP_DropDownJoykey::CSP_DropDownJoykey(QWidget *parent, QStringList *lst, USING_
4445 case 2:
4546 joykey_type_1379->setChecked(true);
4647 break;
48+ case 3:
49+ joykey_type_1235->setChecked(true);
50+ break;
4751 default:
4852 joykey_type_cursor->setChecked(true);
4953 p_config->joy_to_key_type = 0;
@@ -52,15 +56,17 @@ CSP_DropDownJoykey::CSP_DropDownJoykey(QWidget *parent, QStringList *lst, USING_
5256 QLabel *label_joykey_type = new QLabel(QApplication::translate("JoykeyDialog", "Joykey Type:", 0), this);
5357 layout->addWidget(label_joykey_type, 1, 0, Qt::AlignLeft);
5458 layout->addWidget(joykey_type_cursor, 2, 0, Qt::AlignLeft);
55- layout->addWidget(joykey_type_2468, 3, 0, Qt::AlignLeft);
56- layout->addWidget(joykey_type_1379, 4, 0, Qt::AlignLeft);
59+ layout->addWidget(joykey_type_2468, 2, 1, Qt::AlignLeft);
60+ layout->addWidget(joykey_type_1379, 3, 0, Qt::AlignLeft);
61+ layout->addWidget(joykey_type_1235, 3, 1, Qt::AlignLeft);
5762
5863 connect(joykey_type_cursor, SIGNAL(clicked()), this, SLOT(do_set_type_cursor()));
5964 connect(joykey_type_2468, SIGNAL(clicked()), this, SLOT(do_set_type_2468()));
6065 connect(joykey_type_1379, SIGNAL(clicked()), this, SLOT(do_set_type_1379()));
66+ connect(joykey_type_1235, SIGNAL(clicked()), this, SLOT(do_set_type_1235()));
6167
6268 QLabel *label_buttons = new QLabel(QApplication::translate("JoykeyDialog", "Physical Buttons:", 0), this);
63- layout->addWidget(label_buttons, 5, 0, Qt::AlignLeft);
69+ layout->addWidget(label_buttons, 4, 0, Qt::AlignLeft);
6470
6571 _TCHAR tmps[32];
6672 QString nm;
@@ -71,8 +77,8 @@ CSP_DropDownJoykey::CSP_DropDownJoykey(QWidget *parent, QStringList *lst, USING_
7177 snprintf(tmps, 32, "Button#%02d to:", i + 1);
7278 nm = QString::fromUtf8(tmps);
7379 label_button[i]->setText(nm);
74- layout->addWidget(label_button[i], (i / 4) * 2 + 6 + 0, i % 4, Qt::AlignLeft);
75- layout->addWidget(js_button[i], (i / 4) * 2 + 6 + 1, i % 4, Qt::AlignLeft);
80+ layout->addWidget(label_button[i], (i / 4) * 2 + 5 + 0, i % 4, Qt::AlignLeft);
81+ layout->addWidget(js_button[i], (i / 4) * 2 + 5 + 1, i % 4, Qt::AlignLeft);
7682 }
7783
7884
@@ -105,3 +111,8 @@ void CSP_DropDownJoykey::do_set_type_1379()
105111 p_config->joy_to_key_type = 2;
106112 }
107113
114+void CSP_DropDownJoykey::do_set_type_1235()
115+{
116+ p_config->joy_to_key_type = 3;
117+}
118+
--- a/source/src/qt/gui/dropdown_joykey.h
+++ b/source/src/qt/gui/dropdown_joykey.h
@@ -41,6 +41,7 @@ public slots:
4141 void do_set_type_cursor();
4242 void do_set_type_2468();
4343 void do_set_type_1379();
44+ void do_set_type_1235();
4445
4546 signals:
4647
--- a/source/src/qt/osd_input.cpp
+++ b/source/src/qt/osd_input.cpp
@@ -161,6 +161,13 @@ void OSD_BASE::update_input()
161161 case 0x01 : status[VK_NUMPAD8] = 1; break; // up
162162 case 0x01 + 0x08: status[VK_NUMPAD9] = 1; break; // up-right
163163 }
164+ } else if(p_config->joy_to_key_type == 3) { // 1235
165+ static const int vk[] = {VK_NUMPAD5, VK_NUMPAD2, VK_NUMPAD1, VK_NUMPAD3};
166+ for(int i = 0; i < 4; i++) {
167+ if(joy_status[0] & (1 << i)) {
168+ status[vk[i]] = 1;
169+ }
170+ }
164171 }
165172 if(p_config->joy_to_key_type == 1 || p_config->joy_to_key_type == 2) {
166173 // numpad key
@@ -170,7 +177,16 @@ void OSD_BASE::update_input()
170177 numpad_5_pressed = true;
171178 }
172179 }
180+ } else if(p_config->joy_to_key_type == 3) {
181+ // numpad key
182+ if(p_config->joy_to_key_numpad5 && !(joy_status[0] & 0x0f)) {
183+ if(!numpad_5_pressed) {
184+ status[VK_NUMPAD8] = 1;
185+ numpad_5_pressed = true;
186+ }
187+ }
173188 }
189+
174190 for(int i = 0; i < 16; i++) {
175191 if(joy_status[0] & (1 << (i + 4))) {
176192 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()
186202 // do not keep key pressed
187203 if(p_config->joy_to_key_numpad5 && (i >= VK_NUMPAD1 && i <= VK_NUMPAD9)) {
188204 key_status[i] = KEY_KEEP_FRAMES;
189- if(numpad_5_pressed && (i != VK_NUMPAD5)) {
190- numpad_5_pressed = false;
205+ if(p_config->joy_to_key_type == 3) {
206+ if(numpad_5_pressed && (i != VK_NUMPAD8)) {
207+ numpad_5_pressed = false;
208+ }
209+ } else if((p_config->joy_to_key_type == 1) || (p_config->joy_to_key_type == 2)) {
210+ if(numpad_5_pressed && (i != VK_NUMPAD5)) {
211+ numpad_5_pressed = false;
212+ }
191213 }
192214 }
193215 }
Binary files a/source/src/res/i18n/ja/csp_qt_gui.qm and b/source/src/res/i18n/ja/csp_qt_gui.qm differ
Show on old repository browser