Use key mappings in desktop Qt frontend

This commit is contained in:
Zetro 2013-09-04 22:38:45 +02:00
parent ea2de859b5
commit 43f78b5d5a
3 changed files with 3 additions and 41 deletions

View file

@ -15,6 +15,7 @@
#include "Core/Config.h" #include "Core/Config.h"
#include "ConsoleListener.h" #include "ConsoleListener.h"
#include "base/display.h" #include "base/display.h"
#include "base/NKCodeFromQt.h"
#include "GPU/GPUInterface.h" #include "GPU/GPUInterface.h"
#include "QtHost.h" #include "QtHost.h"
@ -35,8 +36,6 @@ MainWindow::MainWindow(QWidget *parent) :
{ {
ui->setupUi(this); ui->setupUi(this);
controls = new Controls(this);
host = new QtHost(this); host = new QtHost(this);
emugl = ui->widget; emugl = ui->widget;
emugl->init(&input_state); emugl->init(&input_state);
@ -89,19 +88,6 @@ void MainWindow::Update()
{ {
emugl->updateGL(); emugl->updateGL();
for (int i = 0; i < controllistCount; i++)
{
if (pressedKeys.contains(controllist[i].key) ||
input_state.pad_buttons_down & controllist[i].emu_id)
__CtrlButtonDown(controllist[i].psp_id);
else
__CtrlButtonUp(controllist[i].psp_id);
}
__CtrlSetAnalogX(clamp1(input_state.pad_lstick_x), 0);
__CtrlSetAnalogY(clamp1(input_state.pad_lstick_y), 0);
__CtrlSetAnalogX(clamp1(input_state.pad_rstick_x), 1);
__CtrlSetAnalogY(clamp1(input_state.pad_rstick_y), 1);
if (lastUIState != globalUIState) { if (lastUIState != globalUIState) {
lastUIState = globalUIState; lastUIState = globalUIState;
UpdateMenus(); UpdateMenus();
@ -197,12 +183,12 @@ void MainWindow::keyPressEvent(QKeyEvent *e)
return; return;
} }
pressedKeys.insert(e->key()); NativeKey(KeyInput(DEVICE_ID_KEYBOARD, KeyMapRawQttoNative.find(e->key())->second, KEY_DOWN));
} }
void MainWindow::keyReleaseEvent(QKeyEvent *e) void MainWindow::keyReleaseEvent(QKeyEvent *e)
{ {
pressedKeys.remove(e->key()); NativeKey(KeyInput(DEVICE_ID_KEYBOARD, KeyMapRawQttoNative.find(e->key())->second, KEY_UP));
} }
/* SLOTS */ /* SLOTS */
@ -452,11 +438,6 @@ void MainWindow::on_action_OptionsIgnoreIllegalReadsWrites_triggered()
UpdateMenus(); UpdateMenus();
} }
void MainWindow::on_action_OptionsControls_triggered()
{
controls->show();
}
void MainWindow::on_action_AFOff_triggered() void MainWindow::on_action_AFOff_triggered()
{ {
g_Config.iAnisotropyLevel = 0; g_Config.iAnisotropyLevel = 0;

View file

@ -10,7 +10,6 @@
#include "debugger_memory.h" #include "debugger_memory.h"
#include "debugger_memorytex.h" #include "debugger_memorytex.h"
#include "debugger_displaylist.h" #include "debugger_displaylist.h"
#include "controls.h"
class QtEmuGL; class QtEmuGL;
namespace Ui { namespace Ui {
@ -79,9 +78,6 @@ private slots:
void on_action_OptionsFastMemory_triggered(); void on_action_OptionsFastMemory_triggered();
void on_action_OptionsIgnoreIllegalReadsWrites_triggered(); void on_action_OptionsIgnoreIllegalReadsWrites_triggered();
// Controls
void on_action_OptionsControls_triggered();
// Video // Video
void on_action_AFOff_triggered(); void on_action_AFOff_triggered();
void on_action_AF2x_triggered(); void on_action_AF2x_triggered();
@ -155,9 +151,6 @@ private:
Debugger_Memory *memoryWindow; Debugger_Memory *memoryWindow;
Debugger_MemoryTex *memoryTexWindow; Debugger_MemoryTex *memoryTexWindow;
Debugger_DisplayList *displaylistWindow; Debugger_DisplayList *displaylistWindow;
Controls *controls;
QSet<int> pressedKeys;
}; };
#endif // MAINWINDOW_H #endif // MAINWINDOW_H

View file

@ -178,12 +178,6 @@
<addaction name="action_OptionsDisplayRawFramebuffer"/> <addaction name="action_OptionsDisplayRawFramebuffer"/>
<addaction name="actionFrameskip"/> <addaction name="actionFrameskip"/>
</widget> </widget>
<widget class="QMenu" name="menuControls">
<property name="title">
<string>Co&amp;ntrols</string>
</property>
<addaction name="action_OptionsControls"/>
</widget>
<widget class="QMenu" name="menuCore"> <widget class="QMenu" name="menuCore">
<property name="title"> <property name="title">
<string>&amp;Core</string> <string>&amp;Core</string>
@ -196,7 +190,6 @@
<addaction name="separator"/> <addaction name="separator"/>
</widget> </widget>
<addaction name="menuCore"/> <addaction name="menuCore"/>
<addaction name="menuControls"/>
<addaction name="menuVideo"/> <addaction name="menuVideo"/>
<addaction name="action_Sound"/> <addaction name="action_Sound"/>
<addaction name="separator"/> <addaction name="separator"/>
@ -357,11 +350,6 @@
<string>Ctrl+M</string> <string>Ctrl+M</string>
</property> </property>
</action> </action>
<action name="action_OptionsControls">
<property name="text">
<string>&amp;Keyboard</string>
</property>
</action>
<action name="action_OptionsFullScreen"> <action name="action_OptionsFullScreen">
<property name="text"> <property name="text">
<string>&amp;Toggle fullscreen</string> <string>&amp;Toggle fullscreen</string>