Commit 04774942 authored by Libretro-Admin's avatar Libretro-Admin
Browse files

Convert libretro files to C

parent a6afde4f
......@@ -36,13 +36,13 @@ endif
SOURCES_CXX := \
$(CORE_DIR)/tlcs900h.cpp \
$(CORE_DIR)/flash.cpp \
$(CORE_DIR)/graphics.cpp \
$(CORE_DIR)/libretro/libretro.cpp \
$(CORE_DIR)/libretro/log.cpp
$(CORE_DIR)/graphics.cpp
SOURCES_C += \
$(CORE_DIR)/main.c \
$(CORE_DIR)/input.c \
$(CORE_DIR)/libretro/libretro.c \
$(CORE_DIR)/libretro/log.c \
$(CORE_DIR)/race-memory.c \
$(CORE_DIR)/ngpBios.c \
$(CORE_DIR)/state.c \
......
......@@ -639,7 +639,7 @@ void flashChipWrite(unsigned int addr, unsigned char data)
}
/* this should be called when a ROM is unloaded */
void flashShutdown(void)
extern "C" void flashShutdown(void)
{
writeSaveGameFile();
}
......
......@@ -27,13 +27,13 @@ void vectFlashWrite(unsigned char chip, unsigned int to,
unsigned char *fromAddr, unsigned int numBytes);
void vectFlashErase(unsigned char chip, unsigned char blockNum);
void vectFlashChipErase(unsigned char chip);
void flashShutdown(void);
#ifdef __cplusplus
extern "C" {
#endif
void setFlashSize(unsigned int romSize);
unsigned char flashReadInfo(unsigned int addr);
void flashShutdown(void);
#ifdef __cplusplus
}
#endif
......
......@@ -379,7 +379,7 @@ void palette_init16(DWORD dwRBitMask, DWORD dwGBitMask, DWORD dwBBitMask)
* Most interface functions seem to use camel case,
* so do the same here...
*/
void graphicsSetDarkFilterLevel(unsigned filterLevel)
extern "C" void graphicsSetDarkFilterLevel(unsigned filterLevel)
{
unsigned prev_dark_filter_level = dark_filter_level;
......
......@@ -30,13 +30,13 @@
extern "C" {
#endif
BOOL graphics_init(void);
void graphics_paint(void);
void graphicsSetDarkFilterLevel(unsigned filterLevel);
#ifdef __cplusplus
}
#endif
void graphics_paint(void);
/* new renderer (NeoGeo Pocket (Color)) */
void myGraphicsBlitLine(unsigned char render);
void graphicsSetDarkFilterLevel(unsigned filterLevel);
/*
* adventure vision stuff
......
......@@ -38,7 +38,7 @@ static retro_input_state_t input_state_cb;
/* core options */
static int RETRO_SAMPLE_RATE = 44100;
ngp_screen* screen;
struct ngp_screen* screen;
int setting_ngp_language; /* 0x6F87 - language */
int gfx_hacks;
int tipo_consola; /* 0x6F91 - OS version */
......@@ -46,9 +46,13 @@ static bool libretro_supports_input_bitmasks;
char retro_save_directory[2048];
struct map { unsigned retro; unsigned ngp; };
struct map
{
unsigned retro;
unsigned ngp;
};
static map btn_map[] = {
static struct map btn_map[] = {
{ RETRO_DEVICE_ID_JOYPAD_A, 0x20 },
{ RETRO_DEVICE_ID_JOYPAD_B, 0x10 },
{ RETRO_DEVICE_ID_JOYPAD_RIGHT, 0x08 },
......@@ -92,7 +96,7 @@ static void check_variables(void)
var.value = NULL;
if (environ_cb(RETRO_ENVIRONMENT_GET_VARIABLE, &var) && var.value)
dark_filter_level = static_cast<unsigned>(atoi(var.value));
dark_filter_level = (unsigned)(atoi(var.value));
graphicsSetDarkFilterLevel(dark_filter_level);
}
void retro_init(void)
......@@ -166,7 +170,7 @@ static unsigned get_race_input_bitmasks(void)
unsigned i = 0;
unsigned res = 0;
unsigned ret = input_state_cb(0, RETRO_DEVICE_JOYPAD, 0, RETRO_DEVICE_ID_JOYPAD_MASK);
for (i = 0; i < sizeof(btn_map) / sizeof(map); i++)
for (i = 0; i < sizeof(btn_map) / sizeof(struct map); i++)
res |= (ret & (1 << btn_map[i].retro)) ? btn_map[i].ngp : 0;
return res;
}
......@@ -175,7 +179,7 @@ static unsigned get_race_input(void)
{
unsigned i = 0;
unsigned res = 0;
for (i = 0; i < sizeof(btn_map) / sizeof(map); i++)
for (i = 0; i < sizeof(btn_map) / sizeof(struct map); i++)
res |= input_state_cb(0, RETRO_DEVICE_JOYPAD, 0, btn_map[i].retro) ? btn_map[i].ngp : 0;
return res;
}
......@@ -208,9 +212,7 @@ static bool race_initialize_system(const char* gamepath)
return true;
}
void retro_set_controller_port_device(unsigned, unsigned)
{
}
void retro_set_controller_port_device(unsigned a, unsigned b) { }
void retro_get_system_info(struct retro_system_info *info)
{
......@@ -311,7 +313,7 @@ bool retro_load_game(const struct retro_game_info *info)
environ_cb(RETRO_ENVIRONMENT_SET_INPUT_DESCRIPTORS, desc);
screen = (ngp_screen*)calloc(1, sizeof(*screen));
screen = (struct ngp_screen*)calloc(1, sizeof(*screen));
if (!screen)
return false;
......@@ -348,7 +350,7 @@ bool retro_load_game(const struct retro_game_info *info)
return true;
}
bool retro_load_game_special(unsigned, const struct retro_game_info*, size_t)
bool retro_load_game_special(unsigned a, const struct retro_game_info *b, size_t c)
{
return false;
}
......
......@@ -3,8 +3,16 @@
#include "libretro.h"
#ifdef __cplusplus
extern "C" {
#endif
void init_log(retro_environment_t environ_cb);
void handle_error( const char* error );
void handle_info( const char* info );
#ifdef __cplusplus
}
#endif
#endif
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment