Some rewrites to libretro_version_1.c

This commit is contained in:
twinaphex 2014-09-23 04:42:49 +02:00
parent 63680ca5b4
commit 5769275eb4
2 changed files with 20 additions and 9 deletions

View File

@ -17,6 +17,7 @@
#include "boolean.h" #include "boolean.h"
#include "libretro.h" #include "libretro.h"
#include "retro.h"
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>
#include <string.h> #include <string.h>
@ -226,16 +227,26 @@ static size_t audio_sample_batch_rewind(const int16_t *data, size_t frames)
return frames; return frames;
} }
void retro_set_default_callbacks(struct retro_callbacks* cbs) void retro_set_default_callbacks(void *data)
{ {
cbs->frame_cb = video_frame; struct retro_callbacks *cbs = (struct retro_callbacks*)data;
cbs->sample_cb = audio_sample;
if (!cbs)
return;
cbs->frame_cb = video_frame;
cbs->sample_cb = audio_sample;
cbs->sample_batch_cb = audio_sample_batch; cbs->sample_batch_cb = audio_sample_batch;
cbs->state_cb = input_state; cbs->state_cb = input_state;
} }
void retro_init_libretro_cbs(struct retro_callbacks* cbs) void retro_init_libretro_cbs(void *data)
{ {
struct retro_callbacks *cbs = (struct retro_callbacks*)data;
if (!cbs)
return;
pretro_set_video_refresh(video_frame); pretro_set_video_refresh(video_frame);
pretro_set_audio_sample(audio_sample); pretro_set_audio_sample(audio_sample);
pretro_set_audio_sample_batch(audio_sample_batch); pretro_set_audio_sample_batch(audio_sample_batch);

View File

@ -20,16 +20,16 @@
#include "libretro.h" #include "libretro.h"
struct retro_callbacks typedef struct retro_callbacks
{ {
retro_video_refresh_t frame_cb; retro_video_refresh_t frame_cb;
retro_audio_sample_t sample_cb; retro_audio_sample_t sample_cb;
retro_audio_sample_batch_t sample_batch_cb; retro_audio_sample_batch_t sample_batch_cb;
retro_input_state_t state_cb; retro_input_state_t state_cb;
}; } retro_callbacks_t;
void retro_init_libretro_cbs(struct retro_callbacks* cbs); void retro_init_libretro_cbs(void *data);
void retro_set_default_callbacks(struct retro_callbacks* cbs); void retro_set_default_callbacks(void *data);
void retro_set_rewind_callbacks(void); void retro_set_rewind_callbacks(void);
#endif #endif