mirror of
https://github.com/libretro/RetroArch
synced 2025-01-30 03:32:46 +00:00
Fix some style nits.
This commit is contained in:
parent
ee12266a2b
commit
f3e487557e
30
driver.h
30
driver.h
@ -79,12 +79,12 @@ typedef struct video_info
|
||||
|
||||
typedef struct audio_driver
|
||||
{
|
||||
void* (*init)(const char* device, unsigned rate, unsigned latency);
|
||||
ssize_t (*write)(void* data, const void* buf, size_t size);
|
||||
bool (*stop)(void* data);
|
||||
bool (*start)(void* data);
|
||||
void (*set_nonblock_state)(void* data, bool toggle); // Should we care about blocking in audio thread? Fast forwarding.
|
||||
void (*free)(void* data);
|
||||
void *(*init)(const char *device, unsigned rate, unsigned latency);
|
||||
ssize_t (*write)(void *data, const void *buf, size_t size);
|
||||
bool (*stop)(void *data);
|
||||
bool (*start)(void *data);
|
||||
void (*set_nonblock_state)(void *data, bool toggle); // Should we care about blocking in audio thread? Fast forwarding.
|
||||
void (*free)(void *data);
|
||||
bool (*use_float)(void *data); // Defines if driver will take standard floating point samples, or int16_t samples.
|
||||
const char *ident;
|
||||
} audio_driver_t;
|
||||
@ -110,25 +110,25 @@ typedef struct audio_driver
|
||||
|
||||
typedef struct input_driver
|
||||
{
|
||||
void* (*init)(void);
|
||||
void (*poll)(void* data);
|
||||
int16_t (*input_state)(void* data, const struct snes_keybind **snes_keybinds, bool port, unsigned device, unsigned index, unsigned id);
|
||||
bool (*key_pressed)(void* data, int key);
|
||||
void (*free)(void* data);
|
||||
void *(*init)(void);
|
||||
void (*poll)(void *data);
|
||||
int16_t (*input_state)(void *data, const struct snes_keybind **snes_keybinds, bool port, unsigned device, unsigned index, unsigned id);
|
||||
bool (*key_pressed)(void *data, int key);
|
||||
void (*free)(void *data);
|
||||
const char *ident;
|
||||
} input_driver_t;
|
||||
|
||||
typedef struct video_driver
|
||||
{
|
||||
void* (*init)(const video_info_t *video, const input_driver_t **input, void **input_data);
|
||||
void *(*init)(const video_info_t *video, const input_driver_t **input, void **input_data);
|
||||
// Should the video driver act as an input driver as well? :) The video init might preinitialize an input driver to override the settings in case the video driver relies on input driver for event handling, e.g.
|
||||
bool (*frame)(void* data, const void* frame, unsigned width, unsigned height, unsigned pitch, const char *msg); // msg is for showing a message on the screen along with the video frame.
|
||||
void (*set_nonblock_state)(void* data, bool toggle); // Should we care about syncing to vblank? Fast forwarding.
|
||||
bool (*frame)(void *data, const void *frame, unsigned width, unsigned height, unsigned pitch, const char *msg); // msg is for showing a message on the screen along with the video frame.
|
||||
void (*set_nonblock_state)(void *data, bool toggle); // Should we care about syncing to vblank? Fast forwarding.
|
||||
// Is the window still active?
|
||||
bool (*alive)(void *data);
|
||||
bool (*focus)(void *data); // Does the window have focus?
|
||||
bool (*xml_shader)(void *data, const char *path); // Sets XML-shader. Might not be implemented.
|
||||
void (*free)(void* data);
|
||||
void (*free)(void *data);
|
||||
const char *ident;
|
||||
} video_driver_t;
|
||||
|
||||
|
@ -14,16 +14,17 @@
|
||||
*/
|
||||
|
||||
#include "fifo_buffer.h"
|
||||
#include <stdint.h>
|
||||
|
||||
struct fifo_buffer
|
||||
{
|
||||
char *buffer;
|
||||
uint8_t *buffer;
|
||||
size_t bufsize;
|
||||
size_t first;
|
||||
size_t end;
|
||||
};
|
||||
|
||||
fifo_buffer_t* fifo_new(size_t size)
|
||||
fifo_buffer_t *fifo_new(size_t size)
|
||||
{
|
||||
fifo_buffer_t *buf = calloc(1, sizeof(*buf));
|
||||
if (buf == NULL)
|
||||
@ -40,13 +41,13 @@ fifo_buffer_t* fifo_new(size_t size)
|
||||
return buf;
|
||||
}
|
||||
|
||||
void fifo_free(fifo_buffer_t* buffer)
|
||||
void fifo_free(fifo_buffer_t *buffer)
|
||||
{
|
||||
free(buffer->buffer);
|
||||
free(buffer);
|
||||
}
|
||||
|
||||
size_t fifo_read_avail(fifo_buffer_t* buffer)
|
||||
size_t fifo_read_avail(fifo_buffer_t *buffer)
|
||||
{
|
||||
size_t first = buffer->first;
|
||||
size_t end = buffer->end;
|
||||
@ -55,7 +56,7 @@ size_t fifo_read_avail(fifo_buffer_t* buffer)
|
||||
return end - first;
|
||||
}
|
||||
|
||||
size_t fifo_write_avail(fifo_buffer_t* buffer)
|
||||
size_t fifo_write_avail(fifo_buffer_t *buffer)
|
||||
{
|
||||
size_t first = buffer->first;
|
||||
size_t end = buffer->end;
|
||||
@ -65,7 +66,7 @@ size_t fifo_write_avail(fifo_buffer_t* buffer)
|
||||
return (buffer->bufsize - 1) - (end - first);
|
||||
}
|
||||
|
||||
void fifo_write(fifo_buffer_t* buffer, const void* in_buf, size_t size)
|
||||
void fifo_write(fifo_buffer_t *buffer, const void *in_buf, size_t size)
|
||||
{
|
||||
size_t first_write = size;
|
||||
size_t rest_write = 0;
|
||||
@ -77,13 +78,13 @@ void fifo_write(fifo_buffer_t* buffer, const void* in_buf, size_t size)
|
||||
|
||||
memcpy(buffer->buffer + buffer->end, in_buf, first_write);
|
||||
if (rest_write > 0)
|
||||
memcpy(buffer->buffer, (const char*)in_buf + first_write, rest_write);
|
||||
memcpy(buffer->buffer, (const uint8_t*)in_buf + first_write, rest_write);
|
||||
|
||||
buffer->end = (buffer->end + size) % buffer->bufsize;
|
||||
}
|
||||
|
||||
|
||||
void fifo_read(fifo_buffer_t* buffer, void* in_buf, size_t size)
|
||||
void fifo_read(fifo_buffer_t *buffer, void *in_buf, size_t size)
|
||||
{
|
||||
size_t first_read = size;
|
||||
size_t rest_read = 0;
|
||||
@ -93,9 +94,9 @@ void fifo_read(fifo_buffer_t* buffer, void* in_buf, size_t size)
|
||||
rest_read = size - first_read;
|
||||
}
|
||||
|
||||
memcpy(in_buf, (const char*)buffer->buffer + buffer->first, first_read);
|
||||
memcpy(in_buf, (const uint8_t*)buffer->buffer + buffer->first, first_read);
|
||||
if (rest_read > 0)
|
||||
memcpy((char*)in_buf + first_read, buffer->buffer, rest_read);
|
||||
memcpy((uint8_t*)in_buf + first_read, buffer->buffer, rest_read);
|
||||
|
||||
buffer->first = (buffer->first + size) % buffer->bufsize;
|
||||
}
|
||||
|
@ -26,11 +26,11 @@
|
||||
typedef struct fifo_buffer fifo_buffer_t;
|
||||
#endif
|
||||
|
||||
fifo_buffer_t* fifo_new(size_t size);
|
||||
void fifo_write(fifo_buffer_t* buffer, const void* in_buf, size_t size);
|
||||
void fifo_read(fifo_buffer_t* buffer, void* in_buf, size_t size);
|
||||
void fifo_free(fifo_buffer_t* buffer);
|
||||
size_t fifo_read_avail(fifo_buffer_t* buffer);
|
||||
size_t fifo_write_avail(fifo_buffer_t* buffer);
|
||||
fifo_buffer_t *fifo_new(size_t size);
|
||||
void fifo_write(fifo_buffer_t *buffer, const void *in_buf, size_t size);
|
||||
void fifo_read(fifo_buffer_t *buffer, void *in_buf, size_t size);
|
||||
void fifo_free(fifo_buffer_t *buffer);
|
||||
size_t fifo_read_avail(fifo_buffer_t *buffer);
|
||||
size_t fifo_write_avail(fifo_buffer_t *buffer);
|
||||
|
||||
#endif
|
||||
|
Loading…
x
Reference in New Issue
Block a user