mirror of
https://github.com/Rosalie241/RMG.git
synced 2026-07-11 01:24:01 +02:00
more fixes....
This commit is contained in:
@@ -323,6 +323,13 @@ EXPORT m64p_error CALL CoreDoCommand(m64p_command Command, int ParamInt, void *P
|
||||
y = (ParamInt >> 16) & 0xffff;
|
||||
event_mouse_move(x, y);
|
||||
return M64ERR_SUCCESS;
|
||||
case M64CMD_SET_MOUSE_BUTTON:
|
||||
if (!g_EmulatorRunning)
|
||||
return M64ERR_INVALID_STATE;
|
||||
x = ParamInt & 0xffff;
|
||||
y = (ParamInt >> 16) & 0xffff;
|
||||
event_mouse_button(x, y);
|
||||
return M64ERR_SUCCESS;
|
||||
case M64CMD_SET_FRAME_CALLBACK:
|
||||
*(void**)&g_FrameCallback = ParamPtr;
|
||||
return M64ERR_SUCCESS;
|
||||
|
||||
@@ -266,6 +266,7 @@ typedef void (*ptr_ReadController)(int Control, unsigned char *Command);
|
||||
typedef void (*ptr_SDL_KeyDown)(int keymod, int keysym);
|
||||
typedef void (*ptr_SDL_KeyUp)(int keymod, int keysym);
|
||||
typedef void (*ptr_MouseMove)(int x, int y);
|
||||
typedef void (*ptr_MouseButton)(int left, int right);
|
||||
typedef void (*ptr_RenderCallback)(void);
|
||||
typedef void (*ptr_SendVRUWord)(uint16_t length, uint16_t *word, uint8_t lang);
|
||||
typedef void (*ptr_SetMicState)(int state);
|
||||
@@ -280,6 +281,7 @@ EXPORT void CALL ReadController(int Control, unsigned char *Command);
|
||||
EXPORT void CALL SDL_KeyDown(int keymod, int keysym);
|
||||
EXPORT void CALL SDL_KeyUp(int keymod, int keysym);
|
||||
EXPORT void CALL MouseMove(int x, int y);
|
||||
EXPORT void CALL MouseButton(int left, int right);
|
||||
EXPORT void CALL RenderCallback(void);
|
||||
EXPORT void CALL SendVRUWord(uint16_t length, uint16_t *word, uint8_t lang);
|
||||
EXPORT void CALL SetMicState(int state);
|
||||
|
||||
+2
-1
@@ -172,7 +172,8 @@ typedef enum {
|
||||
M64CMD_ROM_SET_SETTINGS,
|
||||
M64CMD_DISK_OPEN,
|
||||
M64CMD_DISK_CLOSE,
|
||||
M64CMD_SET_MOUSE_MOVE
|
||||
M64CMD_SET_MOUSE_MOVE,
|
||||
M64CMD_SET_MOUSE_BUTTON
|
||||
} m64p_command;
|
||||
|
||||
typedef struct {
|
||||
|
||||
@@ -712,6 +712,15 @@ void event_mouse_move(int x, int y)
|
||||
}
|
||||
}
|
||||
|
||||
void event_mouse_button(int left, int right)
|
||||
{
|
||||
if (input.mouseButton != NULL)
|
||||
{
|
||||
input.mouseButton(left, right);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
int event_gameshark_active(void)
|
||||
{
|
||||
return GamesharkActive;
|
||||
|
||||
@@ -27,6 +27,7 @@ extern void event_initialize(void);
|
||||
extern void event_sdl_keydown(int keysym, int keymod);
|
||||
extern void event_sdl_keyup(int keysym, int keymod);
|
||||
extern void event_mouse_move(int x, int y);
|
||||
extern void event_mouse_button(int left, int right);
|
||||
extern int event_gameshark_active(void);
|
||||
extern void event_set_gameshark(int active);
|
||||
|
||||
|
||||
+3
-1
@@ -102,6 +102,7 @@ static const input_plugin_functions dummy_input = {
|
||||
dummyinput_SDL_KeyDown,
|
||||
dummyinput_SDL_KeyUp,
|
||||
NULL,
|
||||
NULL,
|
||||
dummyinput_RenderCallback
|
||||
};
|
||||
|
||||
@@ -404,7 +405,8 @@ static m64p_error plugin_connect_input(m64p_dynlib_handle plugin_handle)
|
||||
DebugMessage(M64MSG_WARNING, "Input plugin does not contain VRU support.");
|
||||
}
|
||||
|
||||
if (!GET_FUNC(ptr_MouseMove, input.mouseMove, "MouseMove"))
|
||||
if (!GET_FUNC(ptr_MouseMove, input.mouseMove, "MouseMove") ||
|
||||
!GET_FUNC(ptr_MouseMove, input.mouseButton, "MouseButton"))
|
||||
{
|
||||
DebugMessage(M64MSG_WARNING, "Input plugin does not contain mouse support.");
|
||||
}
|
||||
|
||||
@@ -101,6 +101,7 @@ typedef struct _input_plugin_functions
|
||||
ptr_SDL_KeyDown keyDown;
|
||||
ptr_SDL_KeyUp keyUp;
|
||||
ptr_MouseMove mouseMove;
|
||||
ptr_MouseButton mouseButton;
|
||||
ptr_RenderCallback renderCallback;
|
||||
ptr_SendVRUWord sendVRUWord;
|
||||
ptr_SetMicState setMicState;
|
||||
|
||||
@@ -170,10 +170,10 @@ typedef enum {
|
||||
M64CMD_NETPLAY_CLOSE,
|
||||
M64CMD_PIF_OPEN,
|
||||
M64CMD_ROM_SET_SETTINGS,
|
||||
M64CMD_SET_MOUSE_MOVE,
|
||||
M64CMD_SET_MOUSE_BUTTON,
|
||||
M64CMD_DISK_OPEN,
|
||||
M64CMD_DISK_CLOSE
|
||||
M64CMD_DISK_CLOSE,
|
||||
M64CMD_SET_MOUSE_MOVE,
|
||||
M64CMD_SET_MOUSE_BUTTON
|
||||
} m64p_command;
|
||||
|
||||
typedef struct {
|
||||
|
||||
@@ -73,6 +73,9 @@ MainDialog::MainDialog(QWidget* parent, Thread::SDLThread* sdlThread, bool romCo
|
||||
controllerWidget->AddInputDevice("Voice Recognition Unit", (int)InputDeviceType::EmulateVRU);
|
||||
}
|
||||
#endif // VRU
|
||||
// TODO: shouldn't this be specific to 1 port??
|
||||
controllerWidget->AddInputDevice("Mouse", (int)InputDeviceType::Mouse);
|
||||
|
||||
controllerWidget->AddInputDevice("None", (int)InputDeviceType::None);
|
||||
controllerWidget->AddInputDevice("Automatic", (int)InputDeviceType::Automatic);
|
||||
controllerWidget->AddInputDevice("Keyboard", (int)InputDeviceType::Keyboard);
|
||||
@@ -114,8 +117,9 @@ void MainDialog::openInputDevice(QString deviceName, int deviceNum)
|
||||
Widget::ControllerWidget* controllerWidget;
|
||||
controllerWidget = this->controllerWidgets.at(this->tabWidget->currentIndex());
|
||||
|
||||
// we don't need to open a keyboard or VRU
|
||||
// we don't need to open a mouse, keyboard or VRU
|
||||
if (deviceNum == (int)InputDeviceType::None ||
|
||||
deviceNum == (int)InputDeviceType::Mouse ||
|
||||
deviceNum == (int)InputDeviceType::Keyboard ||
|
||||
deviceNum == (int)InputDeviceType::EmulateVRU)
|
||||
{
|
||||
@@ -240,6 +244,7 @@ void MainDialog::on_ControllerWidget_CurrentInputDeviceChanged(ControllerWidget*
|
||||
|
||||
// only open device when needed
|
||||
if (deviceNum != (int)InputDeviceType::None &&
|
||||
deviceNum != (int)InputDeviceType::Mouse &&
|
||||
deviceNum != (int)InputDeviceType::Keyboard &&
|
||||
deviceNum != (int)InputDeviceType::EmulateVRU)
|
||||
{
|
||||
@@ -306,6 +311,7 @@ void MainDialog::on_tabWidget_currentChanged(int index)
|
||||
|
||||
// only open device when needed
|
||||
if (deviceNum != (int)InputDeviceType::None &&
|
||||
deviceNum != (int)InputDeviceType::Mouse &&
|
||||
deviceNum != (int)InputDeviceType::Keyboard &&
|
||||
deviceNum != (int)InputDeviceType::EmulateVRU)
|
||||
{
|
||||
|
||||
@@ -85,6 +85,7 @@ void ControllerImageWidget::SetMouseMode(bool value)
|
||||
if (this->isMouseMode != value)
|
||||
{
|
||||
this->isMouseMode = value;
|
||||
this->needImageUpdate = true;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -726,6 +726,7 @@ void ControllerWidget::on_inputDeviceComboBox_currentIndexChanged(int value)
|
||||
int deviceNum = this->inputDeviceComboBox->itemData(value).toInt();
|
||||
|
||||
this->ClearControllerImage();
|
||||
this->controllerImageWidget->SetMouseMode((deviceNum == (int)InputDeviceType::Mouse));
|
||||
|
||||
if (this->isCurrentDeviceNotFound())
|
||||
{
|
||||
@@ -1443,7 +1444,7 @@ void ControllerWidget::on_MainDialog_SdlEvent(SDL_Event* event)
|
||||
case SDL_MOUSEBUTTONDOWN:
|
||||
case SDL_MOUSEBUTTONUP:
|
||||
{ // mouse button press
|
||||
if (this->inputTypeComboBox->currentIndex() != 1)
|
||||
if (this->inputDeviceComboBox->currentIndex() != 0)
|
||||
{ // no mouse
|
||||
return;
|
||||
}
|
||||
@@ -1643,7 +1644,6 @@ void ControllerWidget::LoadSettings(QString sectionQString, bool loadUserProfile
|
||||
}
|
||||
|
||||
this->deadZoneSlider->setValue(CoreSettingsGetIntValue(SettingsID::Input_Deadzone, section));
|
||||
this->inputTypeComboBox->setCurrentIndex(CoreSettingsGetIntValue(SettingsID::Input_InputType, section));
|
||||
this->optionsDialogSettings.RemoveDuplicateMappings = CoreSettingsGetBoolValue(SettingsID::Input_RemoveDuplicateMappings, section);
|
||||
this->optionsDialogSettings.ControllerPak = CoreSettingsGetIntValue(SettingsID::Input_Pak, section);
|
||||
this->optionsDialogSettings.GameboyRom = CoreSettingsGetStringValue(SettingsID::Input_GameboyRom, section);
|
||||
@@ -1699,9 +1699,6 @@ void ControllerWidget::LoadSettings(QString sectionQString, bool loadUserProfile
|
||||
|
||||
// force refresh some UI elements
|
||||
this->CheckInputDeviceSettings(sectionQString);
|
||||
|
||||
// TODO: is this correct?
|
||||
this->on_inputTypeComboBox_currentIndexChanged(this->inputTypeComboBox->currentIndex());
|
||||
this->on_deadZoneSlider_valueChanged(this->deadZoneSlider->value());
|
||||
this->setPluggedIn(this->IsPluggedIn());
|
||||
}
|
||||
@@ -1843,7 +1840,6 @@ void ControllerWidget::SaveSettings(QString section)
|
||||
this->GetCurrentInputDevice(deviceName, deviceNum, true);
|
||||
|
||||
CoreSettingsSetValue(SettingsID::Input_PluggedIn, sectionStr, this->IsPluggedIn());
|
||||
CoreSettingsSetValue(SettingsID::Input_InputType, sectionStr, this->inputTypeComboBox->currentIndex());
|
||||
CoreSettingsSetValue(SettingsID::Input_DeviceName, sectionStr, deviceName.toStdString());
|
||||
CoreSettingsSetValue(SettingsID::Input_DeviceNum, sectionStr, deviceNum);
|
||||
CoreSettingsSetValue(SettingsID::Input_Deadzone, sectionStr, this->deadZoneSlider->value());
|
||||
|
||||
@@ -37,7 +37,7 @@
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="sizeAdjustPolicy">
|
||||
<enum>QComboBox::AdjustToContents</enum>
|
||||
<enum>QComboBox::SizeAdjustPolicy::AdjustToContents</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
@@ -73,7 +73,7 @@
|
||||
<item>
|
||||
<spacer name="horizontalSpacer_8">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
<enum>Qt::Orientation::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
@@ -83,29 +83,6 @@
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QGroupBox" name="groupBox_7">
|
||||
<property name="title">
|
||||
<string>Device Type</string>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_4">
|
||||
<item>
|
||||
<widget class="QComboBox" name="inputTypeComboBox">
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Controller</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Mouse</string>
|
||||
</property>
|
||||
</item>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QGroupBox" name="groupBox_4">
|
||||
<property name="sizePolicy">
|
||||
@@ -127,7 +104,7 @@
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="sizeAdjustPolicy">
|
||||
<enum>QComboBox::AdjustToContents</enum>
|
||||
<enum>QComboBox::SizeAdjustPolicy::AdjustToContents</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
@@ -150,7 +127,7 @@
|
||||
<item>
|
||||
<spacer name="horizontalSpacer_4">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
<enum>Qt::Orientation::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
@@ -181,10 +158,10 @@
|
||||
<number>100</number>
|
||||
</property>
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
<enum>Qt::Orientation::Horizontal</enum>
|
||||
</property>
|
||||
<property name="tickPosition">
|
||||
<enum>QSlider::TicksBelow</enum>
|
||||
<enum>QSlider::TickPosition::TicksBelow</enum>
|
||||
</property>
|
||||
<property name="tickInterval">
|
||||
<number>10</number>
|
||||
@@ -201,7 +178,7 @@
|
||||
<item>
|
||||
<spacer name="horizontalSpacer">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
<enum>Qt::Orientation::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
@@ -216,7 +193,7 @@
|
||||
<item>
|
||||
<spacer name="verticalSpacer_3">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
<enum>Qt::Orientation::Vertical</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
@@ -648,10 +625,10 @@
|
||||
<number>100</number>
|
||||
</property>
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
<enum>Qt::Orientation::Horizontal</enum>
|
||||
</property>
|
||||
<property name="tickPosition">
|
||||
<enum>QSlider::TicksBelow</enum>
|
||||
<enum>QSlider::TickPosition::TicksBelow</enum>
|
||||
</property>
|
||||
<property name="tickInterval">
|
||||
<number>15</number>
|
||||
@@ -664,7 +641,7 @@
|
||||
<item>
|
||||
<spacer name="verticalSpacer_2">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
<enum>Qt::Orientation::Vertical</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
@@ -686,7 +663,7 @@
|
||||
<item>
|
||||
<spacer name="horizontalSpacer_5">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
<enum>Qt::Orientation::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
@@ -729,7 +706,7 @@
|
||||
<item>
|
||||
<spacer name="horizontalSpacer_7">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
<enum>Qt::Orientation::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
@@ -776,7 +753,7 @@
|
||||
<item>
|
||||
<spacer name="horizontalSpacer_6">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
<enum>Qt::Orientation::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
@@ -809,7 +786,7 @@
|
||||
<item>
|
||||
<spacer name="horizontalSpacer_10">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
<enum>Qt::Orientation::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
@@ -857,7 +834,7 @@
|
||||
<item>
|
||||
<spacer name="horizontalSpacer_2">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
<enum>Qt::Orientation::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
@@ -905,7 +882,7 @@
|
||||
<item>
|
||||
<spacer name="horizontalSpacer_11">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
<enum>Qt::Orientation::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
@@ -924,7 +901,7 @@
|
||||
<item>
|
||||
<spacer name="verticalSpacer_4">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
<enum>Qt::Orientation::Vertical</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
@@ -1253,7 +1230,7 @@
|
||||
<item>
|
||||
<spacer name="verticalSpacer">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
<enum>Qt::Orientation::Vertical</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
@@ -1289,7 +1266,7 @@
|
||||
<item>
|
||||
<spacer name="horizontalSpacer_3">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
<enum>Qt::Orientation::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
|
||||
+19
-15
@@ -1245,7 +1245,8 @@ EXPORT void CALL GetKeys(int Control, BUTTONS* Keys)
|
||||
{
|
||||
profile->LastDeviceCheckTime = currentTime;
|
||||
|
||||
if (profile->DeviceNum != (int)InputDeviceType::Keyboard)
|
||||
if (profile->DeviceNum != (int)InputDeviceType::Mouse &&
|
||||
profile->DeviceNum != (int)InputDeviceType::Keyboard)
|
||||
{
|
||||
if (profile->InputDevice.IsOpeningDevice())
|
||||
{
|
||||
@@ -1285,7 +1286,7 @@ EXPORT void CALL GetKeys(int Control, BUTTONS* Keys)
|
||||
if (Control == 0)
|
||||
{
|
||||
// mouse
|
||||
if (profile->DeviceType == InputDeviceType::Mouse)
|
||||
if (profile->DeviceNum == (int)InputDeviceType::Mouse)
|
||||
{ // n64 mouse
|
||||
l_MouseMutex.lock();
|
||||
|
||||
@@ -1296,24 +1297,20 @@ EXPORT void CALL GetKeys(int Control, BUTTONS* Keys)
|
||||
if (!l_MouseMovements.empty())
|
||||
{
|
||||
// calculate how much the mouse has moved
|
||||
const int x = l_MouseMovements.front().x - l_MouseMovements.back().x;
|
||||
const int y = l_MouseMovements.front().y - l_MouseMovements.back().y;
|
||||
// TODO: sensitivity
|
||||
const int x = (l_MouseMovements.back().x - l_MouseMovements.front().x) * 5;
|
||||
const int y = (l_MouseMovements.front().y - l_MouseMovements.back().y) * 5;
|
||||
|
||||
// set axis state
|
||||
Keys->X_AXIS = -x;
|
||||
Keys->Y_AXIS = y;
|
||||
|
||||
// TODO: is this clamping correct?
|
||||
Keys->X_AXIS = x < 0 ? std::max(x, -N64_AXIS_PEAK) : std::min(x, N64_AXIS_PEAK);;
|
||||
Keys->Y_AXIS = y < 0 ? std::max(y, -N64_AXIS_PEAK) : std::min(y, N64_AXIS_PEAK);
|
||||
|
||||
l_MouseMovements.clear();
|
||||
}
|
||||
|
||||
l_MouseMutex.unlock();
|
||||
|
||||
// request front-end to reset mouse position
|
||||
if (l_ResetMousPositionCallback != nullptr)
|
||||
{
|
||||
l_ResetMousPositionCallback();
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
}
|
||||
@@ -1417,14 +1414,21 @@ EXPORT void CALL SDL_KeyUp(int keymod, int keysym)
|
||||
|
||||
EXPORT void CALL MouseMove(int x, int y)
|
||||
{
|
||||
l_MouseMutex.lock();
|
||||
if (!l_MouseMutex.try_lock())
|
||||
{
|
||||
return;
|
||||
}
|
||||
l_MouseMovements.push_back({x, y});
|
||||
l_MouseMutex.unlock();
|
||||
}
|
||||
|
||||
EXPORT void CALL MouseButton(int left, int right)
|
||||
{
|
||||
l_MouseMutex.lock();
|
||||
if (!l_MouseMutex.try_lock())
|
||||
{
|
||||
return;
|
||||
}
|
||||
std::cout << "MouseButton" << std::endl;
|
||||
l_MouseButtonState[0] = left;
|
||||
l_MouseButtonState[1] = right;
|
||||
l_MouseMutex.unlock();
|
||||
|
||||
@@ -50,10 +50,6 @@ private:
|
||||
signals:
|
||||
void OnCoreDebugCallback(QList<CoreCallbackMessage> callbackMessages);
|
||||
void OnCoreStateCallback(CoreStateCallbackType type, int value);
|
||||
|
||||
signals:
|
||||
void OnCoreDebugCallback(CoreDebugMessageType type, QString context, QString message);
|
||||
void OnResetMousePositionCallback(void);
|
||||
};
|
||||
|
||||
#endif // RMG_CALLBACKS_HPP
|
||||
|
||||
@@ -90,7 +90,7 @@ bool MainWindow::Init(QApplication* app, bool showUI, bool launchROM)
|
||||
this->coreCallBacks = new CoreCallbacks(this);
|
||||
|
||||
// connect signals early due to pending debug callbacks
|
||||
//connect(coreCallBacks, &CoreCallbacks::OnCoreDebugCallback, this, &MainWindow::on_Core_DebugCallback);
|
||||
connect(coreCallBacks, &CoreCallbacks::OnCoreDebugCallback, this, &MainWindow::on_Core_DebugCallback);
|
||||
connect(coreCallBacks, &CoreCallbacks::OnCoreStateCallback, this, &MainWindow::on_Core_StateCallback);
|
||||
connect(app, &QGuiApplication::applicationStateChanged, this, &MainWindow::on_QGuiApplication_applicationStateChanged);
|
||||
|
||||
@@ -1316,13 +1316,13 @@ void MainWindow::on_EventFilter_MouseMoved(QMouseEvent *event)
|
||||
return;
|
||||
}
|
||||
|
||||
int x = event->globalPosition().x();
|
||||
int y = event->globalPosition().y();
|
||||
int x = event->position().x();
|
||||
int y = event->position().y();
|
||||
|
||||
CoreSetMouseMove(x, y);
|
||||
|
||||
}
|
||||
|
||||
#include <iostream>
|
||||
void MainWindow::on_EventFilter_MouseButtonPressed(QMouseEvent *event)
|
||||
{
|
||||
if (!CoreIsEmulationRunning())
|
||||
@@ -1334,6 +1334,8 @@ void MainWindow::on_EventFilter_MouseButtonPressed(QMouseEvent *event)
|
||||
this->ui_LeftMouseButtonState = (event->button() == Qt::MouseButton::LeftButton ? 1 : this->ui_LeftMouseButtonState);
|
||||
this->ui_RightMouseButtonState = (event->button() == Qt::MouseButton::RightButton ? 1 : this->ui_RightMouseButtonState);
|
||||
|
||||
std::cout << "on_EventFilter_MouseButtonPressed" << std::endl;
|
||||
|
||||
CoreSetMouseButton(this->ui_LeftMouseButtonState, this->ui_RightMouseButtonState);
|
||||
}
|
||||
|
||||
@@ -1347,6 +1349,7 @@ void MainWindow::on_EventFilter_MouseButtonReleased(QMouseEvent *event)
|
||||
|
||||
this->ui_LeftMouseButtonState = (event->button() == Qt::MouseButton::LeftButton ? 0 : this->ui_LeftMouseButtonState);
|
||||
this->ui_RightMouseButtonState = (event->button() == Qt::MouseButton::RightButton ? 0 : this->ui_RightMouseButtonState);
|
||||
std::cout << "on_EventFilter_MouseButtonReleased" << std::endl;
|
||||
|
||||
CoreSetMouseButton(this->ui_LeftMouseButtonState, this->ui_RightMouseButtonState);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user