mirror of
https://github.com/bsnes-emu/bsnes.git
synced 2025-08-20 01:01:48 +02:00
Update to v094r24 release.
byuu says: Finally!! Compilation works once again on Windows. However, it's pretty buggy. Modality isn't really working right, you can still poke at other windows, but when you select ListView items, they redraw as empty boxes (need to process WM_DRAWITEM before checking modality.) The program crashes when you close it (probably a ruby driver's term() function, that's what it usually is.) The Layout::setEnabled(false) call isn't working right, so you get that annoying chiming sound and cursor movement when mapping keyboard keys to game inputs. The column sizing seems off a bit on first display for the Hotkeys tab. And probably lots more.
This commit is contained in:
@@ -8,7 +8,7 @@ struct InputMouseRawInput {
|
||||
bool mouseAcquired = false;
|
||||
|
||||
struct Mouse {
|
||||
HID::Mouse hid;
|
||||
shared_pointer<HID::Mouse> hid{new HID::Mouse};
|
||||
|
||||
signed relativeX = 0;
|
||||
signed relativeY = 0;
|
||||
@@ -16,7 +16,7 @@ struct InputMouseRawInput {
|
||||
bool buttons[5] = {0};
|
||||
} ms;
|
||||
|
||||
bool acquire() {
|
||||
auto acquire() -> bool {
|
||||
if(mouseAcquired == false) {
|
||||
mouseAcquired = true;
|
||||
ShowCursor(false);
|
||||
@@ -24,17 +24,17 @@ struct InputMouseRawInput {
|
||||
return true;
|
||||
}
|
||||
|
||||
bool unacquire() {
|
||||
auto unacquire() -> bool {
|
||||
if(mouseAcquired == true) {
|
||||
mouseAcquired = false;
|
||||
ReleaseCapture();
|
||||
ClipCursor(NULL);
|
||||
ClipCursor(nullptr);
|
||||
ShowCursor(true);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
bool acquired() {
|
||||
auto acquired() -> bool {
|
||||
if(mouseAcquired == true) {
|
||||
SetFocus((HWND)handle);
|
||||
SetCapture((HWND)handle);
|
||||
@@ -45,7 +45,7 @@ struct InputMouseRawInput {
|
||||
return GetCapture() == (HWND)handle;
|
||||
}
|
||||
|
||||
void update(RAWINPUT* input) {
|
||||
auto update(RAWINPUT* input) -> void {
|
||||
if((input->data.mouse.usFlags & 1) == MOUSE_MOVE_RELATIVE) {
|
||||
ms.relativeX += input->data.mouse.lLastX;
|
||||
ms.relativeY += input->data.mouse.lLastY;
|
||||
@@ -67,14 +67,14 @@ struct InputMouseRawInput {
|
||||
if(input->data.mouse.usButtonFlags & RI_MOUSE_BUTTON_5_UP ) ms.buttons[4] = 0;
|
||||
}
|
||||
|
||||
void assign(unsigned groupID, unsigned inputID, int16_t value) {
|
||||
auto& group = ms.hid.group[groupID];
|
||||
if(group.input[inputID].value == value) return;
|
||||
if(input.onChange) input.onChange(ms.hid, groupID, inputID, group.input[inputID].value, value);
|
||||
group.input[inputID].value = value;
|
||||
auto assign(unsigned groupID, unsigned inputID, int16_t value) -> void {
|
||||
auto& group = ms.hid->group(groupID);
|
||||
if(group.input(inputID).value() == value) return;
|
||||
if(input.onChange) input.onChange(ms.hid, groupID, inputID, group.input(inputID).value(), value);
|
||||
group.input(inputID).setValue(value);
|
||||
}
|
||||
|
||||
void poll(vector<HID::Device*>& devices) {
|
||||
auto poll(vector<shared_pointer<HID::Device>>& devices) -> void {
|
||||
assign(HID::Mouse::GroupID::Axis, 0, ms.relativeX);
|
||||
assign(HID::Mouse::GroupID::Axis, 1, ms.relativeY);
|
||||
assign(HID::Mouse::GroupID::Axis, 2, ms.relativeZ);
|
||||
@@ -91,29 +91,29 @@ struct InputMouseRawInput {
|
||||
ms.relativeY = 0;
|
||||
ms.relativeZ = 0;
|
||||
|
||||
devices.append(&ms.hid);
|
||||
devices.append(ms.hid);
|
||||
}
|
||||
|
||||
bool init(uintptr_t handle) {
|
||||
auto init(uintptr_t handle) -> bool {
|
||||
this->handle = handle;
|
||||
|
||||
ms.hid.id = 2;
|
||||
ms.hid->setID(2);
|
||||
|
||||
ms.hid.axis().append({"X"});
|
||||
ms.hid.axis().append({"Y"});
|
||||
ms.hid.axis().append({"Z"});
|
||||
ms.hid->axes().append("X");
|
||||
ms.hid->axes().append("Y");
|
||||
ms.hid->axes().append("Z");
|
||||
|
||||
ms.hid.button().append({"Left"});
|
||||
ms.hid.button().append({"Middle"});
|
||||
ms.hid.button().append({"Right"});
|
||||
ms.hid.button().append({"Up"});
|
||||
ms.hid.button().append({"Down"});
|
||||
ms.hid->buttons().append("Left");
|
||||
ms.hid->buttons().append("Middle");
|
||||
ms.hid->buttons().append("Right");
|
||||
ms.hid->buttons().append("Up");
|
||||
ms.hid->buttons().append("Down");
|
||||
|
||||
rawinput.updateMouse = {&InputMouseRawInput::update, this};
|
||||
return true;
|
||||
}
|
||||
|
||||
void term() {
|
||||
auto term() -> void {
|
||||
unacquire();
|
||||
}
|
||||
};
|
||||
|
Reference in New Issue
Block a user