[Libretro] fix some input issues due to more recent api changes

This commit is contained in:
CasualPokePlayer 2022-05-05 02:46:13 -07:00
parent 25fb816988
commit b72590066f
5 changed files with 63 additions and 27 deletions

Binary file not shown.

Binary file not shown.

View File

@ -42,7 +42,6 @@ public:
std::memset(lightGun, 0, sizeof (lightGun));
std::memset(analog, 0, sizeof (analog));
std::memset(pointer, 0, sizeof (pointer));
std::memset(sensorAccelerometer, 0, sizeof (sensorAccelerometer));
}
static void RetroLog(RETRO_LOG level, const char* fmt, ...) {
@ -443,9 +442,6 @@ public:
case RETRO_DEVICE::POINTER:
assert(id < sizeof (pointer));
return pointer[id];
case RETRO_DEVICE::SENSOR_ACCELEROMETER:
assert(id < sizeof (sensorAccelerometer));
return sensorAccelerometer[id];
default:
__builtin_unreachable();
}
@ -519,9 +515,6 @@ public:
case RETRO_DEVICE::POINTER:
std::memcpy(pointer, input, sizeof (pointer));
break;
case RETRO_DEVICE::SENSOR_ACCELEROMETER:
std::memcpy(sensorAccelerometer, input, sizeof (sensorAccelerometer));
break;
default:
__builtin_unreachable();
}
@ -565,7 +558,6 @@ private:
s16 lightGun[static_cast<u32>(RETRO_DEVICE_ID_LIGHTGUN::LAST)];
s16 analog[static_cast<u32>(RETRO_DEVICE_ID_ANALOG::LAST)];
s16 pointer[static_cast<u32>(RETRO_DEVICE_ID_POINTER::LAST)];
s16 sensorAccelerometer[static_cast<u32>(RETRO_DEVICE_ID_SENSOR_ACCELEROMETER::LAST)];
};
static CallbackHandler * gCbHandler = nullptr;

View File

@ -69,7 +69,6 @@ enum class RETRO_DEVICE {
LIGHTGUN = 4,
ANALOG = 5,
POINTER = 6,
SENSOR_ACCELEROMETER = 7,
LAST,
};
@ -77,6 +76,7 @@ enum class RETRO_DEVICE {
enum class RETRO_DEVICE_ID_ANALOG {
X = 0,
Y = 1,
BUTTON = 2,
LAST,
};
@ -86,6 +86,13 @@ enum class RETRO_DEVICE_ID_MOUSE {
Y = 1,
LEFT = 2,
RIGHT = 3,
WHEELUP = 4,
WHEELDOWN = 5,
MIDDLE = 6,
HORIZ_WHEELUP = 7,
HORIZ_WHEELDOWN = 8,
BUTTON_4 = 9,
BUTTON_5 = 10,
LAST,
};
@ -98,6 +105,16 @@ enum class RETRO_DEVICE_ID_LIGHTGUN {
TURBO = 4,
PAUSE = 5,
START = 6,
SELECT = 7,
AUX_C = 8,
DPAD_UP = 9,
DPAD_DOWN = 10,
DPAD_LEFT = 11,
DPAD_RIGHT = 12,
SCREEN_X = 13,
SCREEN_Y = 14,
IS_OFFSCREEN = 15,
RELOAD = 16,
LAST,
};
@ -106,6 +123,7 @@ enum class RETRO_DEVICE_ID_POINTER {
X = 0,
Y = 1,
PRESSED = 2,
COUNT = 3,
LAST,
};
@ -268,14 +286,6 @@ enum class RETRO_MOD {
SCROLLLOCK = 64,
};
enum class RETRO_DEVICE_ID_SENSOR_ACCELEROMETER {
X = 0,
Y = 1,
Z = 2,
LAST,
};
enum class RETRO_DEVICE_ID_JOYPAD {
B = 0,
Y = 1,
@ -297,6 +307,18 @@ enum class RETRO_DEVICE_ID_JOYPAD {
LAST,
};
enum class RETRO_SENSOR {
ACCELEROMETER_X = 0,
ACCELEROMETER_Y = 1,
ACCELEROMETER_Z = 2,
GYROSCOPE_X = 3,
GYROSCOPE_Y = 4,
GYROSCOPE_Z = 5,
ILLUMINANCE = 6,
LAST,
};
enum class RETRO_PIXEL_FORMAT {
ZRGB1555 = 0,
XRGB8888 = 1,

View File

@ -18,7 +18,6 @@ namespace BizHawk.Emulation.Cores.Libretro
LIGHTGUN = 4,
ANALOG = 5,
POINTER = 6,
SENSOR_ACCELEROMETER = 7,
LAST,
}
@ -28,6 +27,7 @@ namespace BizHawk.Emulation.Cores.Libretro
// LEFT / RIGHT?
X = 0,
Y = 1,
BUTTON = 2,
LAST,
}
@ -38,6 +38,13 @@ namespace BizHawk.Emulation.Cores.Libretro
Y = 1,
LEFT = 2,
RIGHT = 3,
WHEELUP = 4,
WHEELDOWN = 5,
MIDDLE = 6,
HORIZ_WHEELUP = 7,
HORIZ_WHEELDOWN = 8,
BUTTON_4 = 9,
BUTTON_5 = 10,
LAST,
}
@ -51,6 +58,16 @@ namespace BizHawk.Emulation.Cores.Libretro
TURBO = 4,
PAUSE = 5,
START = 6,
SELECT = 7,
AUX_C = 8,
DPAD_UP = 9,
DPAD_DOWN = 10,
DPAD_LEFT = 11,
DPAD_RIGHT = 12,
SCREEN_X = 13,
SCREEN_Y = 14,
IS_OFFSCREEN = 15,
RELOAD = 16,
LAST,
}
@ -60,6 +77,7 @@ namespace BizHawk.Emulation.Cores.Libretro
X = 0,
Y = 1,
PRESSED = 2,
COUNT = 3,
LAST,
}
@ -225,15 +243,6 @@ namespace BizHawk.Emulation.Cores.Libretro
SCROLLLOCK = 64,
}
public enum RETRO_DEVICE_ID_SENSOR_ACCELEROMETER
{
X = 0,
Y = 1,
Z = 2,
LAST,
}
public enum RETRO_DEVICE_ID_JOYPAD
{
B = 0,
@ -256,6 +265,19 @@ namespace BizHawk.Emulation.Cores.Libretro
LAST,
}
public enum RETRO_SENSOR
{
ACCELEROMETER_X = 0,
ACCELEROMETER_Y = 1,
ACCELEROMETER_Z = 2,
GYROSCOPE_X = 3,
GYROSCOPE_Y = 4,
GYROSCOPE_Z = 5,
ILLUMINANCE = 6,
LAST,
}
public enum RETRO_REGION : uint
{
NTSC = 0,