From 5a1cfa475f4a8ead993150ba0f506e22f156c273 Mon Sep 17 00:00:00 2001 From: negativeExponent Date: Sat, 28 Dec 2019 09:22:32 +0800 Subject: [PATCH] Input: Selective updates based on latest source --- mednafen/pce_fast/input.cpp | 18 +++++++----------- mednafen/pce_fast/input.h | 2 +- 2 files changed, 8 insertions(+), 12 deletions(-) diff --git a/mednafen/pce_fast/input.cpp b/mednafen/pce_fast/input.cpp index 4db306b..2713442 100644 --- a/mednafen/pce_fast/input.cpp +++ b/mednafen/pce_fast/input.cpp @@ -51,11 +51,11 @@ void PCEINPUT_Init(void) SyncSettings(); } -void PCEINPUT_SetInput(int port, const char *type, void *ptr) +void PCEINPUT_SetInput(unsigned port, const char *type, uint8 *ptr) { - if(!strcasecmp(type, "gamepad")) + if(!strcmp(type, "gamepad")) InputTypes[port] = 1; - else if(!strcasecmp(type, "mouse")) + else if(!strcmp(type, "mouse")) InputTypes[port] = 2; else InputTypes[port] = 0; @@ -82,9 +82,9 @@ void INPUT_Frame(void) } else if(InputTypes[x] == 2) { - mouse_x[x] += (int32)MDFN_de32lsb(data_ptr[x] + 0); - mouse_y[x] += (int32)MDFN_de32lsb(data_ptr[x] + 4); - pce_mouse_button[x] = *(uint8 *)(data_ptr[x] + 8); + mouse_x[x] += (int16)MDFN_de16lsb(data_ptr[x] + 0); + mouse_y[x] += (int16)MDFN_de16lsb(data_ptr[x] + 2); + pce_mouse_button[x] = *(uint8 *)(data_ptr[x] + 4); } } } @@ -148,11 +148,7 @@ uint8 INPUT_Read(unsigned int A) } else { - if(pce_mouse_button[tmp_ri] & 1) - ret ^= 0x3; //pce_mouse_button[tmp_ri]; - - if(pce_mouse_button[tmp_ri] & 0x2) - ret ^= 0x8; + ret ^= pce_mouse_button[tmp_ri] & 0xF; } } else diff --git a/mednafen/pce_fast/input.h b/mednafen/pce_fast/input.h index 3fc208b..3c3dac4 100644 --- a/mednafen/pce_fast/input.h +++ b/mednafen/pce_fast/input.h @@ -3,7 +3,7 @@ void PCEINPUT_Init(void); void PCEINPUT_SettingChanged(const char *name); -void PCEINPUT_SetInput(int port, const char *type, void *ptr); +void PCEINPUT_SetInput(unsigned port, const char *type, uint8 *ptr); uint8 INPUT_Read(unsigned int A); void INPUT_Write(unsigned int A, uint8 V); void INPUT_Frame(void);