Update branch for: Add mappable DEBUG button

This commit is contained in:
irdkwia 2023-06-07 03:31:36 +02:00 committed by irdkwia
parent a72b79a55a
commit 8ac33e2748
7 changed files with 137 additions and 17 deletions

View File

@ -1156,10 +1156,10 @@ void NDS::CheckKeyIRQ(u32 cpu, u32 oldkey, u32 newkey)
void NDS::SetKeyMask(u32 mask)
{
u32 key_lo = mask & 0x3FF;
u32 key_hi = (mask >> 10) & 0x3;
u32 key_hi = ((mask >> 10) & 0x3) | ((mask >> 9) & 0x8);
u32 oldkey = KeyInput;
KeyInput &= 0xFFFCFC00;
KeyInput &= 0xFFF4FC00;
KeyInput |= key_lo | (key_hi << 16);
CheckKeyIRQ(0, oldkey, KeyInput);

View File

@ -29,8 +29,8 @@ namespace Config
{
using namespace melonDS;
int KeyMapping[12];
int JoyMapping[12];
int KeyMapping[13];
int JoyMapping[13];
int HKKeyMapping[HK_MAX];
int HKJoyMapping[HK_MAX];
@ -182,6 +182,7 @@ ConfigEntry ConfigFile[] =
{"Key_L", 0, &KeyMapping[9], -1, true},
{"Key_X", 0, &KeyMapping[10], -1, true},
{"Key_Y", 0, &KeyMapping[11], -1, true},
{"Key_Debug", 0, &KeyMapping[12], -1, true},
{"Joy_A", 0, &JoyMapping[0], -1, true},
{"Joy_B", 0, &JoyMapping[1], -1, true},
@ -195,6 +196,7 @@ ConfigEntry ConfigFile[] =
{"Joy_L", 0, &JoyMapping[9], -1, true},
{"Joy_X", 0, &JoyMapping[10], -1, true},
{"Joy_Y", 0, &JoyMapping[11], -1, true},
{"Joy_Debug", 0, &JoyMapping[12], -1, true},
{"HKKey_Lid", 0, &HKKeyMapping[HK_Lid], -1, true},
{"HKKey_Mic", 0, &HKKeyMapping[HK_Mic], -1, true},

View File

@ -82,8 +82,8 @@ struct CameraConfig
};
extern int KeyMapping[12];
extern int JoyMapping[12];
extern int KeyMapping[13];
extern int JoyMapping[13];
extern int HKKeyMapping[HK_MAX];
extern int HKJoyMapping[HK_MAX];

View File

@ -40,9 +40,9 @@ u32 InputMask;
void Init()
{
KeyInputMask = 0xFFF;
JoyInputMask = 0xFFF;
InputMask = 0xFFF;
KeyInputMask = 0x1FFF;
JoyInputMask = 0x1FFF;
InputMask = 0x1FFF;
KeyHotkeyMask = 0;
JoyHotkeyMask = 0;
@ -103,7 +103,7 @@ void KeyPress(QKeyEvent* event)
if (event->modifiers() != Qt::KeypadModifier)
keyKP &= ~event->modifiers();
for (int i = 0; i < 12; i++)
for (int i = 0; i < 13; i++)
if (keyKP == Config::KeyMapping[i])
KeyInputMask &= ~(1<<i);
@ -119,7 +119,7 @@ void KeyRelease(QKeyEvent* event)
if (event->modifiers() != Qt::KeypadModifier)
keyKP &= ~event->modifiers();
for (int i = 0; i < 12; i++)
for (int i = 0; i < 13; i++)
if (keyKP == Config::KeyMapping[i])
KeyInputMask |= (1<<i);
@ -208,10 +208,10 @@ void Process()
OpenJoystick();
}
JoyInputMask = 0xFFF;
JoyInputMask = 0x1FFF;
if (Joystick)
{
for (int i = 0; i < 12; i++)
for (int i = 0; i < 13; i++)
if (JoystickButtonDown(Config::JoyMapping[i]))
JoyInputMask &= ~(1 << i);
}

View File

@ -35,8 +35,8 @@
using namespace melonDS;
InputConfigDialog* InputConfigDialog::currentDlg = nullptr;
const int dskeyorder[12] = {0, 1, 10, 11, 5, 4, 6, 7, 9, 8, 2, 3};
const char* dskeylabels[12] = {"A", "B", "X", "Y", "Left", "Right", "Up", "Down", "L", "R", "Select", "Start"};
const int dskeyorder[13] = {0, 1, 10, 11, 5, 4, 6, 7, 9, 8, 2, 3, 12};
const char* dskeylabels[13] = {"A", "B", "X", "Y", "Left", "Right", "Up", "Down", "L", "R", "Select", "Start", "Debug"};
InputConfigDialog::InputConfigDialog(QWidget* parent) : QDialog(parent), ui(new Ui::InputConfigDialog)
{

View File

@ -25,7 +25,7 @@
#include "Config.h"
static constexpr int keypad_num = 12;
static constexpr int keypad_num = 13;
static constexpr std::initializer_list<int> hk_addons =
{
@ -123,7 +123,7 @@ private:
Ui::InputConfigDialog* ui;
int keypadKeyMap[12], keypadJoyMap[12];
int keypadKeyMap[13], keypadJoyMap[13];
int addonsKeyMap[hk_addons.size()], addonsJoyMap[hk_addons.size()];
int hkGeneralKeyMap[hk_general.size()], hkGeneralJoyMap[hk_general.size()];
};

View File

@ -618,6 +618,65 @@
<property name="spacing">
<number>3</number>
</property>
<item alignment="Qt::AlignHCenter">
<widget class="QGroupBox" name="grp_Debug">
<property name="title">
<string/>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
<layout class="QVBoxLayout" name="buttonDebugHorizontalLayout">
<property name="spacing">
<number>3</number>
</property>
<property name="leftMargin">
<number>3</number>
</property>
<property name="topMargin">
<number>3</number>
</property>
<property name="rightMargin">
<number>3</number>
</property>
<property name="bottomMargin">
<number>3</number>
</property>
<item>
<widget class="QLabel" name="label_Debug">
<property name="text">
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;&lt;span style=&quot; font-weight:600;&quot;&gt;DEBUG&lt;/span&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="btnKeyDebug">
<property name="minimumSize">
<size>
<width>70</width>
<height>0</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>68</width>
<height>16777215</height>
</size>
</property>
<property name="styleSheet">
<string notr="true">min-width: 68px;</string>
</property>
<property name="text">
<string>DEBUG</string>
</property>
</widget>
</item>
</layout>
</widget>
</item>
<item alignment="Qt::AlignHCenter">
<widget class="QGroupBox" name="grp_Select">
<property name="title">
@ -2048,6 +2107,65 @@
<property name="spacing">
<number>3</number>
</property>
<item alignment="Qt::AlignHCenter">
<widget class="QGroupBox" name="grp_Debug_2">
<property name="title">
<string/>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
<layout class="QVBoxLayout" name="buttonDebugHorizontalLayout_2">
<property name="spacing">
<number>3</number>
</property>
<property name="leftMargin">
<number>3</number>
</property>
<property name="topMargin">
<number>3</number>
</property>
<property name="rightMargin">
<number>3</number>
</property>
<property name="bottomMargin">
<number>3</number>
</property>
<item>
<widget class="QLabel" name="label_Debug_2">
<property name="text">
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;&lt;span style=&quot; font-weight:600;&quot;&gt;DEBUG&lt;/span&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="btnJoyDebug">
<property name="minimumSize">
<size>
<width>70</width>
<height>0</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>68</width>
<height>16777215</height>
</size>
</property>
<property name="styleSheet">
<string notr="true">min-width: 68px;</string>
</property>
<property name="text">
<string>DEBUG</string>
</property>
</widget>
</item>
</layout>
</widget>
</item>
<item alignment="Qt::AlignHCenter">
<widget class="QGroupBox" name="grp_Select_2">
<property name="title">