LIBRETRO: remove _t suffix from int types

This commit is contained in:
Giovanni Cascione 2023-10-21 17:32:01 +02:00
parent b0de3e786c
commit d836ec97ed
8 changed files with 81 additions and 80 deletions

View File

@ -32,7 +32,7 @@ const char * retro_get_save_dir(void);
bool retro_setting_get_timing_inaccuracies_enabled(void);
float retro_setting_get_frame_rate(void);
uint16_t retro_setting_get_sample_rate(void);
uint16 retro_setting_get_sample_rate(void);
int retro_setting_get_analog_deadzone(void);
bool retro_setting_get_analog_response_is_quadratic(void);
float retro_setting_get_mouse_speed(void);

View File

@ -251,12 +251,12 @@ static struct retro_input_descriptor retro_input_desc[] = {
void mapper_poll_device(void);
bool mapper_set_device_keys(unsigned int retro_device_id, const char *retro_key_value);
uint8_t mapper_get_device_key_status(unsigned int retro_device_id);
int16_t mapper_get_device_key_value(unsigned int retro_device_id);
int16_t mapper_get_device_key_retro_id(unsigned int retro_device_id);
int16_t mapper_get_device_key_scummvm_id(unsigned int retro_device_id);
int8_t mapper_get_mapper_key_index(int16_t key_retro_id, uint8_t start_index = 0);
uint8_t mapper_get_mapper_key_status(int16_t key_retro_id);
int16_t mapper_get_mapper_key_value(int16_t key_retro_id);
uint8 mapper_get_device_key_status(unsigned int retro_device_id);
int16 mapper_get_device_key_value(unsigned int retro_device_id);
int16 mapper_get_device_key_retro_id(unsigned int retro_device_id);
int16 mapper_get_device_key_scummvm_id(unsigned int retro_device_id);
int8 mapper_get_mapper_key_index(int16 key_retro_id, uint8 start_index = 0);
uint8 mapper_get_mapper_key_status(int16 key_retro_id);
int16 mapper_get_mapper_key_value(int16 key_retro_id);
#endif // LIBRETRO_MAPPER_H

View File

@ -76,7 +76,7 @@ private:
float _inverse_acceleration_time;
uint32 _startTime;
uint8 _threadSwitchCaller;
uint8_t _cursorStatus;
uint8 _cursorStatus;
Common::String s_systemDir;
Common::String s_saveDir;
static Common::List<Common::Event> _events;
@ -169,12 +169,12 @@ private:
/* Inputs */
public:
void processInputs(void);
static void processKeyEvent(bool down, unsigned keycode, uint32_t character, uint16_t key_modifiers);
static void processKeyEvent(bool down, unsigned keycode, uint32 character, uint16 key_modifiers);
void setShakePos(int shakeXOffset, int shakeYOffset) override {}
private:
void updateMouseXY(float deltaAcc, float * cumulativeXYAcc, int doing_x);
void getMouseXYFromAnalog(bool is_x, int16_t coor);
void getMouseXYFromButton(bool is_x, int16_t sign);
void getMouseXYFromAnalog(bool is_x, int16 coor);
void getMouseXYFromButton(bool is_x, int16 sign);
};
#endif

View File

@ -103,8 +103,8 @@ static uint16 sample_rate = 0;
static uint16 samples_per_frame = 0; // length in samples per frame
static size_t samples_per_frame_buffer_size = 0;
static int16_t *sound_buffer = NULL; // pointer to output buffer
static int16_t *sound_buffer_empty = NULL; // pointer to zeroed output buffer, to regulate GUI FPS
static int16 *sound_buffer = NULL; // pointer to output buffer
static int16 *sound_buffer_empty = NULL; // pointer to zeroed output buffer, to regulate GUI FPS
static bool input_bitmask_supported = false;
static bool updating_variables = false;
@ -123,10 +123,10 @@ static void log_scummvm_exit_code(void) {
static void audio_buffer_init(uint16 sample_rate, uint16 frame_rate) {
samples_per_frame = sample_rate / frame_rate;
samples_per_frame_buffer_size = samples_per_frame << sizeof(int16_t);
samples_per_frame_buffer_size = samples_per_frame << sizeof(int16);
sound_buffer = sound_buffer ? (int16_t *)realloc(sound_buffer, samples_per_frame_buffer_size) : (int16_t *)malloc(samples_per_frame_buffer_size);
sound_buffer_empty = sound_buffer_empty ? (int16_t *)realloc(sound_buffer_empty, samples_per_frame_buffer_size) : (int16_t *)malloc(samples_per_frame_buffer_size);
sound_buffer = sound_buffer ? (int16 *)realloc(sound_buffer, samples_per_frame_buffer_size) : (int16 *)malloc(samples_per_frame_buffer_size);
sound_buffer_empty = sound_buffer_empty ? (int16 *)realloc(sound_buffer_empty, samples_per_frame_buffer_size) : (int16 *)malloc(samples_per_frame_buffer_size);
if (sound_buffer && sound_buffer_empty) {
memset(sound_buffer, 0, samples_per_frame_buffer_size);
@ -1045,9 +1045,9 @@ void retro_run(void) {
}
if (audio_status & AUDIO_STATUS_MUTE)
audio_batch_cb((int16_t *) sound_buffer_empty, samples_per_frame_buffer_size >> sizeof(int16_t));
audio_batch_cb((int16 *) sound_buffer_empty, samples_per_frame_buffer_size >> sizeof(int16));
else
audio_batch_cb((int16_t *) sound_buffer, samples_count);
audio_batch_cb((int16 *) sound_buffer, samples_count);
current_frame++;

View File

@ -21,14 +21,14 @@
struct retro_keymap mapper_keys[RETRO_DEVICE_ID_JOYPAD_LAST] = {0};
static int16_t mapper_digital_buttons_status = 0;
static uint32_t mapper_digital_buttons_prev_status = 0;
static int16_t mapper_analog_stick_status [2][2] = {0};
static int16 mapper_digital_buttons_status = 0;
static uint32 mapper_digital_buttons_prev_status = 0;
static int16 mapper_analog_stick_status [2][2] = {0};
void mapper_poll_device(void) {
//Store previous on/off status
mapper_digital_buttons_prev_status = mapper_digital_buttons_status;
for (int8_t i = RETRO_DEVICE_ID_JOYPAD_ANALOG; i < RETRO_DEVICE_ID_JOYPAD_LAST; i++)
for (int8 i = RETRO_DEVICE_ID_JOYPAD_ANALOG; i < RETRO_DEVICE_ID_JOYPAD_LAST; i++)
mapper_digital_buttons_prev_status |= mapper_get_device_key_value(i) ? 1 << i : 0;
//Get current status
@ -38,17 +38,17 @@ void mapper_poll_device(void) {
if (retro_get_input_bitmask_supported())
mapper_digital_buttons_status = retro_input_cb(0, RETRO_DEVICE_JOYPAD, 0, RETRO_DEVICE_ID_JOYPAD_MASK);
else
for (int8_t i = 0; i < RETRO_DEVICE_ID_JOYPAD_ANALOG; i++)
for (int8 i = 0; i < RETRO_DEVICE_ID_JOYPAD_ANALOG; i++)
mapper_digital_buttons_status |= (retro_input_cb(0, RETRO_DEVICE_JOYPAD, 0, i) << i);
//Store analog sticks (analog) status
for (int8_t i = 0; i < 2; i++)
for (int8_t j = 0; j < 2; j++)
for (int8 i = 0; i < 2; i++)
for (int8 j = 0; j < 2; j++)
mapper_analog_stick_status[i][j] = retro_input_cb(0, RETRO_DEVICE_ANALOG, i, j);
}
static int16_t mapper_get_retro_key_index(const char *retro_key_value) {
uint16_t i = 0;
static int16 mapper_get_retro_key_index(const char *retro_key_value) {
uint16 i = 0;
while (retro_keys[i].retro_id != RETROK_LAST) {
if (strcmp(retro_keys[i].value, retro_key_value) == 0)
return i;
@ -57,8 +57,8 @@ static int16_t mapper_get_retro_key_index(const char *retro_key_value) {
return -1;
}
int8_t mapper_get_mapper_key_index(int16_t key_retro_id, uint8_t start_index) {
uint8_t i = start_index;
int8 mapper_get_mapper_key_index(int16 key_retro_id, uint8 start_index) {
uint8 i = start_index;
while (i < RETRO_DEVICE_ID_JOYPAD_LAST - 1) {
if (mapper_keys[i].retro_id == key_retro_id)
return i;
@ -68,7 +68,7 @@ int8_t mapper_get_mapper_key_index(int16_t key_retro_id, uint8_t start_index) {
}
bool mapper_set_device_keys(unsigned int retro_device_id, const char *retro_key_value) {
int16_t retro_key_index = mapper_get_retro_key_index(retro_key_value);
int16 retro_key_index = mapper_get_retro_key_index(retro_key_value);
if (retro_key_index > -1 && retro_device_id < RETRO_DEVICE_ID_JOYPAD_LAST) {
mapper_keys[retro_device_id] = retro_keys[retro_key_index];
return true;
@ -76,12 +76,12 @@ bool mapper_set_device_keys(unsigned int retro_device_id, const char *retro_key_
return false;
}
int16_t mapper_get_device_key_value(unsigned int retro_device_id) {
int16 mapper_get_device_key_value(unsigned int retro_device_id) {
if (retro_device_id < RETRO_DEVICE_ID_JOYPAD_ANALOG) {
return (mapper_digital_buttons_status & (1 << retro_device_id)) > 0;
} else if (retro_device_id < RETRO_DEVICE_ID_JOYPAD_LAST) {
int16_t res;
int16_t sign;
int16 res;
int16 sign;
switch (retro_device_id) {
case RETRO_DEVICE_ID_JOYPAD_LU:
res = mapper_analog_stick_status[RETRO_DEVICE_INDEX_ANALOG_LEFT][RETRO_DEVICE_ID_ANALOG_Y];
@ -124,16 +124,16 @@ int16_t mapper_get_device_key_value(unsigned int retro_device_id) {
return 0;
}
uint8_t mapper_get_device_key_status(unsigned int retro_device_id) {
uint8_t status = mapper_get_device_key_value(retro_device_id) ? 1 << RETRO_DEVICE_KEY_STATUS : 0;
uint8 mapper_get_device_key_status(unsigned int retro_device_id) {
uint8 status = mapper_get_device_key_value(retro_device_id) ? 1 << RETRO_DEVICE_KEY_STATUS : 0;
status |= (mapper_digital_buttons_prev_status & (1 << retro_device_id)) ? 1 << RETRO_DEVICE_KEY_PREV_STATUS : 0;
status |= ((status & (1 << RETRO_DEVICE_KEY_STATUS)) > 0) == ((status & (1 << RETRO_DEVICE_KEY_PREV_STATUS)) > 0) ? 0 : 1 << RETRO_DEVICE_KEY_CHANGED;
return status;
}
int16_t mapper_get_mapper_key_value(int16_t retro_key_retro_id) {
int16_t result = 0;
int8_t retro_key_index = 0;
int16 mapper_get_mapper_key_value(int16 retro_key_retro_id) {
int16 result = 0;
int8 retro_key_index = 0;
while (retro_key_index > -1) {
retro_key_index = mapper_get_mapper_key_index(retro_key_retro_id, retro_key_index);
if (retro_key_index > -1) {
@ -145,9 +145,9 @@ int16_t mapper_get_mapper_key_value(int16_t retro_key_retro_id) {
return result;
}
uint8_t mapper_get_mapper_key_status(int16_t retro_key_retro_id) {
uint8_t status = 0;
int8_t retro_key_index = 0;
uint8 mapper_get_mapper_key_status(int16 retro_key_retro_id) {
uint8 status = 0;
int8 retro_key_index = 0;
while (retro_key_index > -1) {
retro_key_index = mapper_get_mapper_key_index(retro_key_retro_id, retro_key_index);
if (retro_key_index > -1) {
@ -158,10 +158,10 @@ uint8_t mapper_get_mapper_key_status(int16_t retro_key_retro_id) {
return status;
}
int16_t mapper_get_device_key_retro_id(unsigned int retro_device_id) {
int16 mapper_get_device_key_retro_id(unsigned int retro_device_id) {
return mapper_keys[retro_device_id].retro_id;
}
int16_t mapper_get_device_key_scummvm_id(unsigned int retro_device_id) {
int16 mapper_get_device_key_scummvm_id(unsigned int retro_device_id) {
return mapper_keys[retro_device_id].scummvm_id;
}

View File

@ -31,8 +31,8 @@ static INLINE void blit_uint8_uint16_fast(Graphics::Surface &aOut, const Graphic
if (i >= aOut.h)
continue;
uint8_t *const in = (uint8_t *)aIn.getPixels() + (i * aIn.w);
uint16_t *const out = (uint16_t *)aOut.getPixels() + (i * aOut.w);
uint8 *const in = (uint8 *)aIn.getPixels() + (i * aIn.w);
uint16 *const out = (uint16 *)aOut.getPixels() + (i * aOut.w);
for (int j = 0; j < aIn.w; j++) {
if (j >= aOut.w)
@ -40,7 +40,7 @@ static INLINE void blit_uint8_uint16_fast(Graphics::Surface &aOut, const Graphic
uint8 r, g, b;
const uint8_t val = in[j];
const uint8 val = in[j];
// if(val != 0xFFFFFFFF)
{
if (aIn.format.bytesPerPixel == 1) {
@ -62,8 +62,8 @@ static INLINE void blit_uint32_uint16(Graphics::Surface &aOut, const Graphics::S
if (i >= aOut.h)
continue;
uint32_t *const in = (uint32_t *)aIn.getPixels() + (i * aIn.w);
uint16_t *const out = (uint16_t *)aOut.getPixels() + (i * aOut.w);
uint32 *const in = (uint32 *)aIn.getPixels() + (i * aIn.w);
uint16 *const out = (uint16 *)aOut.getPixels() + (i * aOut.w);
for (int j = 0; j < aIn.w; j++) {
if (j >= aOut.w)
@ -71,7 +71,7 @@ static INLINE void blit_uint32_uint16(Graphics::Surface &aOut, const Graphics::S
uint8 r, g, b;
// const uint32_t val = in[j];
// const uint32 val = in[j];
// if(val != 0xFFFFFFFF)
{
aIn.format.colorToRGB(in[j], r, g, b);
@ -86,8 +86,8 @@ static INLINE void blit_uint16_uint16(Graphics::Surface &aOut, const Graphics::S
if (i >= aOut.h)
continue;
uint16_t *const in = (uint16_t *)aIn.getPixels() + (i * aIn.w);
uint16_t *const out = (uint16_t *)aOut.getPixels() + (i * aOut.w);
uint16 *const in = (uint16 *)aIn.getPixels() + (i * aIn.w);
uint16 *const out = (uint16 *)aOut.getPixels() + (i * aOut.w);
for (int j = 0; j < aIn.w; j++) {
if (j >= aOut.w)
@ -95,7 +95,7 @@ static INLINE void blit_uint16_uint16(Graphics::Surface &aOut, const Graphics::S
uint8 r, g, b;
// const uint16_t val = in[j];
// const uint16 val = in[j];
// if(val != 0xFFFFFFFF)
{
aIn.format.colorToRGB(in[j], r, g, b);
@ -110,8 +110,8 @@ static void blit_uint8_uint16(Graphics::Surface &aOut, const Graphics::Surface &
if ((i + aY) < 0 || (i + aY) >= aOut.h)
continue;
uint8_t *const in = (uint8_t *)aIn.getPixels() + (i * aIn.w);
uint16_t *const out = (uint16_t *)aOut.getPixels() + ((i + aY) * aOut.w);
uint8 *const in = (uint8 *)aIn.getPixels() + (i * aIn.w);
uint16 *const out = (uint16 *)aOut.getPixels() + ((i + aY) * aOut.w);
for (int j = 0; j < aIn.w; j++) {
if ((j + aX) < 0 || (j + aX) >= aOut.w)
@ -119,7 +119,7 @@ static void blit_uint8_uint16(Graphics::Surface &aOut, const Graphics::Surface &
uint8 r, g, b;
const uint8_t val = in[j];
const uint8 val = in[j];
if (val != aKeyColor) {
unsigned char *col = aColors.getColor(val);
r = *col++;
@ -136,8 +136,8 @@ static void blit_uint16_uint16(Graphics::Surface &aOut, const Graphics::Surface
if ((i + aY) < 0 || (i + aY) >= aOut.h)
continue;
uint16_t *const in = (uint16_t *)aIn.getPixels() + (i * aIn.w);
uint16_t *const out = (uint16_t *)aOut.getPixels() + ((i + aY) * aOut.w);
uint16 *const in = (uint16 *)aIn.getPixels() + (i * aIn.w);
uint16 *const out = (uint16 *)aOut.getPixels() + ((i + aY) * aOut.w);
for (int j = 0; j < aIn.w; j++) {
if ((j + aX) < 0 || (j + aX) >= aOut.w)
@ -145,7 +145,7 @@ static void blit_uint16_uint16(Graphics::Surface &aOut, const Graphics::Surface
uint8 r, g, b;
const uint16_t val = in[j];
const uint16 val = in[j];
if (val != aKeyColor) {
aIn.format.colorToRGB(in[j], r, g, b);
out[j + aX] = aOut.format.RGBToColor(r, g, b);
@ -159,8 +159,8 @@ static void blit_uint32_uint16(Graphics::Surface &aOut, const Graphics::Surface
if ((i + aY) < 0 || (i + aY) >= aOut.h)
continue;
uint32_t *const in = (uint32_t *)aIn.getPixels() + (i * aIn.w);
uint16_t *const out = (uint16_t *)aOut.getPixels() + ((i + aY) * aOut.w);
uint32 *const in = (uint32 *)aIn.getPixels() + (i * aIn.w);
uint16 *const out = (uint16 *)aOut.getPixels() + ((i + aY) * aOut.w);
for (int j = 0; j < aIn.w; j++) {
if ((j + aX) < 0 || (j + aX) >= aOut.w)
@ -168,9 +168,9 @@ static void blit_uint32_uint16(Graphics::Surface &aOut, const Graphics::Surface
uint8 in_a, in_r, in_g, in_b;
uint8 out_r, out_g, out_b;
uint32_t blend_r, blend_g, blend_b;
uint32 blend_r, blend_g, blend_b;
const uint32_t val = in[j];
const uint32 val = in[j];
if (val != aKeyColor) {
aIn.format.colorToARGB(in[j], in_a, in_r, in_g, in_b);
@ -188,8 +188,8 @@ static void blit_uint32_uint16(Graphics::Surface &aOut, const Graphics::Surface
}
}
static INLINE void copyRectToSurface(uint8_t *pixels, int out_pitch, const uint8_t *src, int pitch, int x, int y, int w, int h, int out_bpp) {
uint8_t *dst = pixels + y * out_pitch + x * out_bpp;
static INLINE void copyRectToSurface(uint8 *pixels, int out_pitch, const uint8 *src, int pitch, int x, int y, int w, int h, int out_bpp) {
uint8 *dst = pixels + y * out_pitch + x * out_bpp;
do {
memcpy(dst, src, w * out_bpp);
@ -262,8 +262,8 @@ Graphics::PixelFormat OSystem_libretro::getScreenFormat() const {
}
void OSystem_libretro::copyRectToScreen(const void *buf, int pitch, int x, int y, int w, int h) {
const uint8_t *src = (const uint8_t *)buf;
uint8_t *pix = (uint8_t *)_gameScreen.getPixels();
const uint8 *src = (const uint8 *)buf;
uint8 *pix = (uint8 *)_gameScreen.getPixels();
copyRectToSurface(pix, _gameScreen.pitch, src, pitch, x, y, w, h, _gameScreen.format.bytesPerPixel);
}
@ -337,8 +337,8 @@ void OSystem_libretro::grabOverlay(Graphics::Surface &surface) {
}
void OSystem_libretro::copyRectToOverlay(const void *buf, int pitch, int x, int y, int w, int h) {
const uint8_t *src = (const uint8_t *)buf;
uint8_t *pix = (uint8_t *)_overlay.getPixels();
const uint8 *src = (const uint8 *)buf;
uint8 *pix = (uint8 *)_overlay.getPixels();
copyRectToSurface(pix, _overlay.pitch, src, pitch, x, y, w, h, _overlay.format.bytesPerPixel);
}

View File

@ -17,10 +17,11 @@
#define FORBIDDEN_SYMBOL_EXCEPTION_strcpy
#define FORBIDDEN_SYMBOL_EXCEPTION_strcat
//#include "backends/platform/libretro/include/config.h"
#include "backends/platform/libretro/include/libretro-defs.h"
#include "backends/platform/libretro/include/libretro-core.h"
#include "backends/platform/libretro/include/libretro-os.h"
#include "backends/platform/libretro/include/libretro-mapper.h"
#include "backends/platform/libretro/include/libretro-core.h"
void OSystem_libretro::updateMouseXY(float deltaAcc, float *cumulativeXYAcc, int doing_x) {
int *mouseXY;
@ -58,10 +59,10 @@ void OSystem_libretro::updateMouseXY(float deltaAcc, float *cumulativeXYAcc, int
*relMouseXY = (int)deltaAcc;
}
void OSystem_libretro::getMouseXYFromAnalog(bool is_x, int16_t coor) {
void OSystem_libretro::getMouseXYFromAnalog(bool is_x, int16 coor) {
int16_t sign = (coor > 0) - (coor < 0);
uint16_t abs_coor = abs(coor);
int16 sign = (coor > 0) - (coor < 0);
uint16 abs_coor = abs(coor);
float *mouseAcc;
if (abs_coor < retro_setting_get_analog_deadzone()) return;
@ -83,7 +84,7 @@ void OSystem_libretro::getMouseXYFromAnalog(bool is_x, int16_t coor) {
updateMouseXY(sign * analog_amplitude * _adjusted_cursor_speed, mouseAcc, is_x);
}
void OSystem_libretro::getMouseXYFromButton(bool is_x, int16_t sign) {
void OSystem_libretro::getMouseXYFromButton(bool is_x, int16 sign) {
float *dpadVel;
float *dpadAcc;
@ -111,7 +112,7 @@ void OSystem_libretro::getMouseXYFromButton(bool is_x, int16_t sign) {
}
void OSystem_libretro::processInputs(void) {
int16_t x, y;
int16 x, y;
float analog_amplitude_x, analog_amplitude_y;
float deltaAcc;
bool down;
@ -119,7 +120,7 @@ void OSystem_libretro::processInputs(void) {
int key_flags = 0;
int retropad_value = 0;
static const uint32_t retroButtons[2] = {RETRO_DEVICE_ID_MOUSE_LEFT, RETRO_DEVICE_ID_MOUSE_RIGHT};
static const uint32 retroButtons[2] = {RETRO_DEVICE_ID_MOUSE_LEFT, RETRO_DEVICE_ID_MOUSE_RIGHT};
static const Common::EventType eventID[2][2] = {{Common::EVENT_LBUTTONDOWN, Common::EVENT_LBUTTONUP}, {Common::EVENT_RBUTTONDOWN, Common::EVENT_RBUTTONUP}};
_cursorStatus = 0;
@ -192,12 +193,12 @@ void OSystem_libretro::processInputs(void) {
}
// Handle keyboard buttons
for (uint8_t i = 0; i < sizeof(key_modifiers) / sizeof(key_modifiers[0]); i++) {
for (uint8 i = 0; i < sizeof(key_modifiers) / sizeof(key_modifiers[0]); i++) {
if (mapper_get_mapper_key_value(key_modifiers[i][0]))
key_flags |= key_modifiers[i][1];
}
for (uint8_t i = 0; i < RETRO_DEVICE_ID_JOYPAD_LAST; i++) {
for (uint8 i = 0; i < RETRO_DEVICE_ID_JOYPAD_LAST; i++) {
if (mapper_get_device_key_retro_id(i) <= 0)
continue;
retropad_value = mapper_get_device_key_status(i);
@ -311,7 +312,7 @@ void OSystem_libretro::processInputs(void) {
}
}
void OSystem_libretro::processKeyEvent(bool down, unsigned keycode, uint32_t character, uint16_t key_modifiers) {
void OSystem_libretro::processKeyEvent(bool down, unsigned keycode, uint32 character, uint16 key_modifiers) {
int _keyflags = 0;
_keyflags |= (key_modifiers & RETROKMOD_CTRL) ? Common::KBD_CTRL : 0;
_keyflags |= (key_modifiers & RETROKMOD_ALT) ? Common::KBD_ALT : 0;

View File

@ -22,7 +22,7 @@
#define EMU_WAITING (1 << 0)
#define MAIN_WAITING (1 << 1)
#define EMU_EXITED (1 << 2)
static uint8_t status = EMU_WAITING | MAIN_WAITING;
static uint8 status = EMU_WAITING | MAIN_WAITING;
static int scummvm_res = -1;
#ifdef USE_LIBCO