mirror of
https://github.com/citra-emu/citra.git
synced 2024-11-23 15:00:09 +00:00
Working WASD in citra_qt
This commit is contained in:
parent
85f31fdfc5
commit
4865be9cef
@ -7,6 +7,7 @@
|
|||||||
#include "core/core.h"
|
#include "core/core.h"
|
||||||
#include "core/loader.h"
|
#include "core/loader.h"
|
||||||
#include "core/hw/hw.h"
|
#include "core/hw/hw.h"
|
||||||
|
#include "core/hw/user_input.h"
|
||||||
|
|
||||||
#include "video_core/video_core.h"
|
#include "video_core/video_core.h"
|
||||||
|
|
||||||
@ -119,6 +120,8 @@ GRenderWindow::GRenderWindow(QWidget* parent) : QWidget(parent), emu_thread(this
|
|||||||
setLayout(layout);
|
setLayout(layout);
|
||||||
|
|
||||||
BackupGeometry();
|
BackupGeometry();
|
||||||
|
|
||||||
|
buttonReg = 0x0;
|
||||||
}
|
}
|
||||||
|
|
||||||
GRenderWindow::~GRenderWindow()
|
GRenderWindow::~GRenderWindow()
|
||||||
@ -198,6 +201,25 @@ void GRenderWindow::keyPressEvent(QKeyEvent* event)
|
|||||||
if (!key_processed)
|
if (!key_processed)
|
||||||
QWidget::keyPressEvent(event);
|
QWidget::keyPressEvent(event);
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
if (event->key() == Qt::Key_W)
|
||||||
|
{
|
||||||
|
buttonReg |= USER_INPUT::PAD_UP;
|
||||||
|
}
|
||||||
|
else if (event->key() == Qt::Key_A)
|
||||||
|
{
|
||||||
|
buttonReg |= USER_INPUT::PAD_LEFT;
|
||||||
|
}
|
||||||
|
else if (event->key() == Qt::Key_S)
|
||||||
|
{
|
||||||
|
buttonReg |= USER_INPUT::PAD_DOWN;
|
||||||
|
}
|
||||||
|
else if (event->key() == Qt::Key_D)
|
||||||
|
{
|
||||||
|
buttonReg |= USER_INPUT::PAD_RIGHT;
|
||||||
|
}
|
||||||
|
USER_INPUT::setButtonReg(buttonReg);
|
||||||
}
|
}
|
||||||
|
|
||||||
void GRenderWindow::keyReleaseEvent(QKeyEvent* event)
|
void GRenderWindow::keyReleaseEvent(QKeyEvent* event)
|
||||||
@ -211,4 +233,23 @@ void GRenderWindow::keyReleaseEvent(QKeyEvent* event)
|
|||||||
if (!key_processed)
|
if (!key_processed)
|
||||||
QWidget::keyPressEvent(event);
|
QWidget::keyPressEvent(event);
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
if (event->key() == Qt::Key_W)
|
||||||
|
{
|
||||||
|
buttonReg &= 0xffffffff ^ USER_INPUT::PAD_UP;
|
||||||
|
}
|
||||||
|
else if (event->key() == Qt::Key_A)
|
||||||
|
{
|
||||||
|
buttonReg &= 0xffffffff ^ USER_INPUT::PAD_LEFT;
|
||||||
|
}
|
||||||
|
else if (event->key() == Qt::Key_S)
|
||||||
|
{
|
||||||
|
buttonReg &= 0xffffffff ^ USER_INPUT::PAD_DOWN;
|
||||||
|
}
|
||||||
|
else if (event->key() == Qt::Key_D)
|
||||||
|
{
|
||||||
|
buttonReg &= 0xffffffff ^ USER_INPUT::PAD_RIGHT;
|
||||||
|
}
|
||||||
|
USER_INPUT::setButtonReg(buttonReg);
|
||||||
}
|
}
|
@ -10,7 +10,7 @@ namespace USER_INPUT {
|
|||||||
|
|
||||||
template <typename T>
|
template <typename T>
|
||||||
inline void Write(u32 addr, const T data) {
|
inline void Write(u32 addr, const T data) {
|
||||||
ERROR_LOG(NDMA, "unknown Write%d 0x%08X @ 0x%08X", sizeof(data) * 8, data, addr);
|
ERROR_LOG(USER_INPUT, "unknown Write%d 0x%08X @ 0x%08X", sizeof(data) * 8, data, addr);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Explicitly instantiate template functions because we aren't defining this in the header:
|
// Explicitly instantiate template functions because we aren't defining this in the header:
|
||||||
@ -26,7 +26,7 @@ namespace USER_INPUT {
|
|||||||
template void Write<u8>(u32 addr, const u8 data);
|
template void Write<u8>(u32 addr, const u8 data);
|
||||||
|
|
||||||
void setButtonReg(u32 buttonData) {
|
void setButtonReg(u32 buttonData) {
|
||||||
Write<u32>(PADDR_BUTTONS, buttonData);
|
Memory::Write32(PADDR_BUTTONS, buttonData);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Update hardware
|
/// Update hardware
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "common/common_types.h"
|
#include "common/common_types.h"
|
||||||
|
#include "core\mem_map.h"
|
||||||
|
|
||||||
|
|
||||||
namespace USER_INPUT {
|
namespace USER_INPUT {
|
||||||
@ -40,6 +41,8 @@ namespace USER_INPUT {
|
|||||||
template <typename T>
|
template <typename T>
|
||||||
inline void Write(u32 addr, const T data);
|
inline void Write(u32 addr, const T data);
|
||||||
|
|
||||||
|
void setButtonReg(u32 buttonData);
|
||||||
|
|
||||||
/// Update hardware
|
/// Update hardware
|
||||||
void Update();
|
void Update();
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user