go-nanoarch/cfuncs.go

108 lines
2.8 KiB
Go
Raw Permalink Normal View History

2018-04-18 15:57:08 +00:00
package main
/*
#include "libretro.h"
2018-04-18 15:57:08 +00:00
#include <stdbool.h>
2018-04-27 08:24:05 +00:00
#include <stdarg.h>
#include <stdio.h>
2018-04-18 15:57:08 +00:00
void bridge_retro_init(void *f) {
return ((void (*)(void))f)();
}
void bridge_retro_deinit(void *f) {
return ((void (*)(void))f)();
}
unsigned bridge_retro_api_version(void *f) {
return ((unsigned (*)(void))f)();
}
2018-04-20 04:48:36 +00:00
void bridge_retro_get_system_info(void *f, struct retro_system_info *si) {
return ((void (*)(struct retro_system_info *))f)(si);
}
void bridge_retro_get_system_av_info(void *f, struct retro_system_av_info *si) {
return ((void (*)(struct retro_system_av_info *))f)(si);
}
bool bridge_retro_set_environment(void *f, void *callback) {
return ((bool (*)(retro_environment_t))f)((retro_environment_t)callback);
}
void bridge_retro_set_video_refresh(void *f, void *callback) {
((bool (*)(retro_video_refresh_t))f)((retro_video_refresh_t)callback);
}
2018-04-19 16:06:52 +00:00
void bridge_retro_set_input_poll(void *f, void *callback) {
((bool (*)(retro_input_poll_t))f)((retro_input_poll_t)callback);
}
2018-04-19 16:15:16 +00:00
void bridge_retro_set_input_state(void *f, void *callback) {
((bool (*)(retro_input_state_t))f)((retro_input_state_t)callback);
}
void bridge_retro_set_audio_sample(void *f, void *callback) {
((bool (*)(retro_audio_sample_t))f)((retro_audio_sample_t)callback);
}
void bridge_retro_set_audio_sample_batch(void *f, void *callback) {
((bool (*)(retro_audio_sample_batch_t))f)((retro_audio_sample_batch_t)callback);
}
bool bridge_retro_load_game(void *f, struct retro_game_info *gi) {
return ((bool (*)(struct retro_game_info *))f)(gi);
}
void bridge_retro_unload_game(void *f) {
return ((void (*)(void))f)();
}
2018-04-20 06:08:56 +00:00
void bridge_retro_run(void *f) {
return ((void (*)(void))f)();
}
2018-04-18 15:57:08 +00:00
bool coreEnvironment_cgo(unsigned cmd, void *data) {
bool coreEnvironment(unsigned, void*);
return coreEnvironment(cmd, data);
}
void coreVideoRefresh_cgo(void *data, unsigned width, unsigned height, size_t pitch) {
void coreVideoRefresh(void*, unsigned, unsigned, size_t);
return coreVideoRefresh(data, width, height, pitch);
}
2018-04-19 16:06:52 +00:00
void coreInputPoll_cgo() {
void coreInputPoll();
return coreInputPoll();
}
2018-04-19 16:15:16 +00:00
int16_t coreInputState_cgo(unsigned port, unsigned device, unsigned index, unsigned id) {
int16_t coreInputState(unsigned, unsigned, unsigned, unsigned);
return coreInputState(port, device, index, id);
}
void coreAudioSample_cgo(int16_t left, int16_t right) {
void coreAudioSample(int16_t, int16_t);
coreAudioSample(left, right);
}
size_t coreAudioSampleBatch_cgo(const int16_t *data, size_t frames) {
2018-04-19 16:33:27 +00:00
size_t coreAudioSampleBatch(const int16_t*, size_t);
return coreAudioSampleBatch(data, frames);
}
2018-04-27 08:24:05 +00:00
void coreLog_cgo(enum retro_log_level level, const char *fmt, ...) {
char msg[4096] = {0};
va_list va;
va_start(va, fmt);
vsnprintf(msg, sizeof(msg), fmt, va);
va_end(va);
void coreLog(enum retro_log_level level, const char *msg);
coreLog(level, msg);
2018-04-19 16:46:46 +00:00
}
2018-04-18 15:57:08 +00:00
*/
import "C"