mirror of
https://github.com/libretro/beetle-wswan-libretro.git
synced 2025-02-17 06:37:46 +00:00
Convert libretro.cpp to C
This commit is contained in:
parent
6e2262499f
commit
ae14e86d15
@ -71,11 +71,11 @@ endif
|
||||
ifneq ($(HAVE_GRIFFIN), 1)
|
||||
SOURCES_CXX += \
|
||||
$(MEDNAFEN_DIR)/mempatcher.cpp \
|
||||
$(CORE_DIR)/libretro.cpp
|
||||
|
||||
SOURCES_C += \
|
||||
$(MEDNAFEN_DIR)/state.c \
|
||||
$(MEDNAFEN_DIR)/settings.c
|
||||
$(MEDNAFEN_DIR)/settings.c \
|
||||
$(CORE_DIR)/libretro.c
|
||||
|
||||
ifneq ($(STATIC_LINKING), 1)
|
||||
SOURCES_C += \
|
||||
|
@ -317,7 +317,7 @@ static void SetInput(int port, const char *type, void *ptr)
|
||||
if(!port) chee = (uint8 *)ptr;
|
||||
}
|
||||
|
||||
extern "C" int StateAction(StateMem *sm, int load, int data_only)
|
||||
int StateAction(StateMem *sm, int load, int data_only)
|
||||
{
|
||||
if(!v30mz_StateAction(sm, load, data_only))
|
||||
return(0);
|
||||
@ -571,7 +571,7 @@ void retro_reset(void)
|
||||
DoSimpleCommand(MDFN_MSC_RESET);
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
@ -988,9 +988,9 @@ size_t retro_get_memory_size(unsigned type)
|
||||
}
|
||||
|
||||
void retro_cheat_reset(void) { }
|
||||
void retro_cheat_set(unsigned, bool, const char *) { }
|
||||
void retro_cheat_set(unsigned a, bool b, const char *c) { }
|
||||
|
||||
void MDFND_MidSync(const EmulateSpecStruct *) { }
|
||||
void MDFND_MidSync(const EmulateSpecStruct *a) { }
|
||||
void MDFN_MidLineUpdate(EmulateSpecStruct *espec, int y)
|
||||
{
|
||||
#if 0
|
@ -84,7 +84,7 @@ struct CheatFormatInfoStruct
|
||||
{
|
||||
unsigned NumFormats;
|
||||
|
||||
CheatFormatStruct *Formats;
|
||||
struct CheatFormatStruct *Formats;
|
||||
};
|
||||
|
||||
// Miscellaneous system/simple commands(power, reset, dip switch toggles, coin insert, etc.)
|
||||
|
@ -95,7 +95,7 @@ static void RebuildSubCheats(void)
|
||||
}
|
||||
}
|
||||
|
||||
bool MDFNMP_Init(uint32 ps, uint32 numpages)
|
||||
extern "C" bool MDFNMP_Init(uint32 ps, uint32 numpages)
|
||||
{
|
||||
PageSize = ps;
|
||||
NumPages = numpages;
|
||||
@ -106,7 +106,7 @@ bool MDFNMP_Init(uint32 ps, uint32 numpages)
|
||||
return(1);
|
||||
}
|
||||
|
||||
void MDFNMP_Kill(void)
|
||||
extern "C" void MDFNMP_Kill(void)
|
||||
{
|
||||
if(RAMPtrs)
|
||||
{
|
||||
@ -130,7 +130,7 @@ void MDFNMP_AddRAM(uint32 size, uint32 A, uint8 *RAM)
|
||||
}
|
||||
}
|
||||
|
||||
void MDFNMP_InstallReadPatches(void)
|
||||
extern "C" void MDFNMP_InstallReadPatches(void)
|
||||
{
|
||||
if(!CheatsActive) return;
|
||||
|
||||
@ -175,12 +175,12 @@ static int AddCheatEntry(char *name, char *conditions, uint32 addr, uint64 val,
|
||||
return(1);
|
||||
}
|
||||
|
||||
void MDFN_LoadGameCheats(void *override_ptr)
|
||||
extern "C" void MDFN_LoadGameCheats(void *override_ptr)
|
||||
{
|
||||
RebuildSubCheats();
|
||||
}
|
||||
|
||||
void MDFN_FlushGameCheats(int nosave)
|
||||
extern "C" void MDFN_FlushGameCheats(int nosave)
|
||||
{
|
||||
std::vector<CHEATF>::iterator chit;
|
||||
|
||||
@ -375,7 +375,7 @@ static bool TestConditions(const char *string)
|
||||
return(passed);
|
||||
}
|
||||
|
||||
void MDFNMP_ApplyPeriodicCheats(void)
|
||||
extern "C" void MDFNMP_ApplyPeriodicCheats(void)
|
||||
{
|
||||
std::vector<CHEATF>::iterator chit;
|
||||
|
||||
|
@ -12,13 +12,25 @@ typedef struct __SUBCHEAT
|
||||
|
||||
extern bool SubCheatsOn;
|
||||
|
||||
bool MDFNMP_Init(uint32 ps, uint32 numpages);
|
||||
void MDFNMP_AddRAM(uint32 size, uint32 address, uint8 *RAM);
|
||||
void MDFNMP_Kill(void);
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
void MDFNMP_InstallReadPatches(void);
|
||||
void MDFNMP_RemoveReadPatches(void);
|
||||
void MDFNMP_Kill(void);
|
||||
|
||||
void MDFNMP_ApplyPeriodicCheats(void);
|
||||
|
||||
void MDFNMP_InstallReadPatches(void);
|
||||
|
||||
bool MDFNMP_Init(uint32 ps, uint32 numpages);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
void MDFNMP_AddRAM(uint32 size, uint32 address, uint8 *RAM);
|
||||
|
||||
void MDFNMP_RemoveReadPatches(void);
|
||||
|
||||
|
||||
#endif
|
||||
|
@ -197,7 +197,7 @@ void WSwan_EEPROMWrite(uint32_t A, uint8_t V)
|
||||
}
|
||||
}
|
||||
|
||||
void WSwan_EEPROMReset(void)
|
||||
extern "C" void WSwan_EEPROMReset(void)
|
||||
{
|
||||
iEEPROM_Command = EEPROM_Command = 0;
|
||||
iEEPROM_Address = EEPROM_Address = 0;
|
||||
@ -239,7 +239,7 @@ void WSwan_EEPROMInit(const char *Name, const uint16_t BYear, const uint8_t BMon
|
||||
iEEPROM[0x375] = Blood;
|
||||
}
|
||||
|
||||
int WSwan_EEPROMStateAction(StateMem *sm, int load, int data_only)
|
||||
extern "C" int WSwan_EEPROMStateAction(StateMem *sm, int load, int data_only)
|
||||
{
|
||||
SFORMAT StateRegs[] =
|
||||
{
|
||||
|
@ -5,10 +5,19 @@
|
||||
|
||||
#include "../state.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
void WSwan_EEPROMReset(void);
|
||||
int WSwan_EEPROMStateAction(StateMem *sm, int load, int data_only);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
uint8_t WSwan_EEPROMRead(uint32_t A);
|
||||
void WSwan_EEPROMWrite(uint32_t A, uint8_t V);
|
||||
int WSwan_EEPROMStateAction(StateMem *sm, int load, int data_only);
|
||||
void WSwan_EEPROMReset(void);
|
||||
void WSwan_EEPROMInit(const char *Name, const uint16_t BYear, const uint8_t BMonth, const uint8_t BDay, const uint8_t Sex, const uint8_t Blood);
|
||||
|
||||
#endif
|
||||
|
@ -63,7 +63,7 @@ static uint16 VBTimerPeriod;
|
||||
static uint16 HBCounter, VBCounter;
|
||||
static uint8 VideoMode;
|
||||
|
||||
void WSwan_GfxInit(void)
|
||||
extern "C" void WSwan_GfxInit(void)
|
||||
{
|
||||
LayerEnabled = 7; // BG, FG, sprites
|
||||
}
|
||||
@ -176,7 +176,7 @@ uint8 WSwan_GfxRead(uint32 A)
|
||||
return 0;
|
||||
}
|
||||
|
||||
bool wsExecuteLine(MDFN_Surface *surface, bool skip)
|
||||
extern "C" bool wsExecuteLine(MDFN_Surface *surface, bool skip)
|
||||
{
|
||||
bool ret = false;
|
||||
|
||||
@ -270,7 +270,7 @@ void WSwan_SetLayerEnableMask(uint64 mask)
|
||||
LayerEnabled = mask;
|
||||
}
|
||||
|
||||
void WSwan_SetPixelFormat(int depth)
|
||||
extern "C" void WSwan_SetPixelFormat(int depth)
|
||||
{
|
||||
unsigned r, g, b, i;
|
||||
for(r = 0; r < 16; r++)
|
||||
@ -601,7 +601,7 @@ void wsScanline(uint16 *target, int depth)
|
||||
}
|
||||
|
||||
|
||||
void WSwan_GfxReset(void)
|
||||
extern "C" void WSwan_GfxReset(void)
|
||||
{
|
||||
unsigned u0, u1;
|
||||
|
||||
@ -649,7 +649,7 @@ void WSwan_GfxReset(void)
|
||||
|
||||
}
|
||||
|
||||
int WSwan_GfxStateAction(StateMem *sm, int load, int data_only)
|
||||
extern "C" int WSwan_GfxStateAction(StateMem *sm, int load, int data_only)
|
||||
{
|
||||
SFORMAT StateRegs[] =
|
||||
{
|
||||
|
@ -22,6 +22,16 @@ void wsGetTile(uint32,uint32,int,int,int);
|
||||
void wsSetVideo(int, bool);
|
||||
void WSWan_TCacheInvalidByAddr(uint32);
|
||||
|
||||
bool wsExecuteLine(MDFN_Surface *surface, bool skip);
|
||||
|
||||
void WSwan_SetPixelFormat(int depth);
|
||||
|
||||
void WSwan_GfxInit(void);
|
||||
|
||||
void WSwan_GfxReset(void);
|
||||
|
||||
int WSwan_GfxStateAction(StateMem *sm, int load, int data_only);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
@ -33,18 +43,13 @@ extern uint32 dx_r,dx_g,dx_b,dx_sr,dx_sg,dx_sb;
|
||||
extern uint32 dx_bits,dx_pitch,cmov,dx_linewidth_blit,dx_buffer_line;
|
||||
|
||||
|
||||
void WSwan_SetPixelFormat(int depth);
|
||||
|
||||
void WSwan_GfxInit(void);
|
||||
void WSwan_GfxReset(void);
|
||||
void WSwan_GfxWrite(uint32 A, uint8 V);
|
||||
uint8 WSwan_GfxRead(uint32 A);
|
||||
void WSwan_GfxWSCPaletteRAMWrite(uint32 ws_offset, uint8 data);
|
||||
|
||||
bool wsExecuteLine(MDFN_Surface *surface, bool skip);
|
||||
|
||||
void WSwan_SetLayerEnableMask(uint64 mask);
|
||||
int WSwan_GfxStateAction(StateMem *sm, int load, int data_only);
|
||||
|
||||
#ifdef WANT_DEBUGGER
|
||||
void WSwan_GfxSetGraphicsDecode(MDFN_Surface *surface, int line, int which, int xscroll, int yscroll, int pbn);
|
||||
|
@ -331,8 +331,7 @@ uint8 WSwan_SoundRead(uint32 A)
|
||||
return(0);
|
||||
}
|
||||
|
||||
|
||||
int32 WSwan_SoundFlush(int16 *SoundBuf, const int32 MaxSoundFrames)
|
||||
extern "C" int32 WSwan_SoundFlush(int16 *SoundBuf, const int32 MaxSoundFrames)
|
||||
{
|
||||
int32 FrameCount = 0;
|
||||
|
||||
@ -367,7 +366,7 @@ static void RedoVolume(void)
|
||||
Blip_Synth_set_volume(&WaveSynth, eff_volume, 256);
|
||||
}
|
||||
|
||||
void WSwan_SoundInit(void)
|
||||
extern "C" void WSwan_SoundInit(void)
|
||||
{
|
||||
unsigned i;
|
||||
for(i = 0; i < 2; i++)
|
||||
@ -381,7 +380,7 @@ void WSwan_SoundInit(void)
|
||||
RedoVolume();
|
||||
}
|
||||
|
||||
void WSwan_SoundKill(void)
|
||||
extern "C" void WSwan_SoundKill(void)
|
||||
{
|
||||
int i;
|
||||
for(i = 0; i < 2; i++)
|
||||
@ -390,7 +389,7 @@ void WSwan_SoundKill(void)
|
||||
}
|
||||
}
|
||||
|
||||
bool WSwan_SetSoundRate(uint32 rate)
|
||||
extern "C" bool WSwan_SetSoundRate(uint32 rate)
|
||||
{
|
||||
unsigned i;
|
||||
for(i = 0; i < 2; i++)
|
||||
@ -399,7 +398,7 @@ bool WSwan_SetSoundRate(uint32 rate)
|
||||
return(true);
|
||||
}
|
||||
|
||||
int WSwan_SoundStateAction(StateMem *sm, int load, int data_only)
|
||||
extern "C" int WSwan_SoundStateAction(StateMem *sm, int load, int data_only)
|
||||
{
|
||||
SFORMAT StateRegs[] =
|
||||
{
|
||||
@ -446,7 +445,7 @@ int WSwan_SoundStateAction(StateMem *sm, int load, int data_only)
|
||||
return(1);
|
||||
}
|
||||
|
||||
void WSwan_SoundReset(void)
|
||||
extern "C" void WSwan_SoundReset(void)
|
||||
{
|
||||
unsigned y,ch;
|
||||
|
||||
|
@ -3,17 +3,29 @@
|
||||
|
||||
#include "../state.h"
|
||||
|
||||
int32 WSwan_SoundFlush(int16 *SoundBuf, const int32 MaxSoundFrames);
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
void WSwan_SoundInit(void);
|
||||
void WSwan_SoundKill(void);
|
||||
void WSwan_SetSoundMultiplier(double multiplier);
|
||||
|
||||
void WSwan_SoundReset(void);
|
||||
|
||||
bool WSwan_SetSoundRate(uint32 rate);
|
||||
|
||||
int32 WSwan_SoundFlush(int16 *SoundBuf, const int32 MaxSoundFrames);
|
||||
|
||||
void WSwan_SoundKill(void);
|
||||
|
||||
int WSwan_SoundStateAction(StateMem *sm, int load, int data_only);
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
void WSwan_SetSoundMultiplier(double multiplier);
|
||||
|
||||
void WSwan_SoundWrite(uint32, uint8);
|
||||
uint8 WSwan_SoundRead(uint32);
|
||||
void WSwan_SoundReset(void);
|
||||
void WSwan_SoundCheckRAMWrite(uint32 A);
|
||||
|
||||
#endif
|
||||
|
@ -130,7 +130,7 @@ static INLINE void i_real_popf(void)
|
||||
|
||||
/***************************************************************************/
|
||||
|
||||
void v30mz_init(uint8 (*readmem20)(uint32), void (*writemem20)(uint32,uint8), uint8 (*readport)(uint32), void (*writeport)(uint32, uint8))
|
||||
extern "C" void v30mz_init(uint8 (*readmem20)(uint32), void (*writemem20)(uint32,uint8), uint8 (*readport)(uint32), void (*writeport)(uint32, uint8))
|
||||
{
|
||||
cpu_readmem20 = readmem20;
|
||||
cpu_writemem20 = writemem20;
|
||||
@ -139,7 +139,7 @@ void v30mz_init(uint8 (*readmem20)(uint32), void (*writemem20)(uint32,uint8), ui
|
||||
cpu_writeport = writeport;
|
||||
}
|
||||
|
||||
void v30mz_reset(void)
|
||||
extern "C" void v30mz_reset(void)
|
||||
{
|
||||
unsigned i;
|
||||
const BREGS reg_name[8] = { AL, CL, DL, BL, AH, CH, DH, BH };
|
||||
@ -1008,7 +1008,7 @@ unsigned v30mz_get_reg(int regnum)
|
||||
|
||||
void nec_set_irq_line(int irqline, int state);
|
||||
|
||||
void v30mz_set_reg(int regnum, unsigned val)
|
||||
extern "C" void v30mz_set_reg(int regnum, unsigned val)
|
||||
{
|
||||
switch( regnum )
|
||||
{
|
||||
@ -1139,7 +1139,7 @@ void v30mz_execute(int cycles)
|
||||
|
||||
}
|
||||
|
||||
int v30mz_StateAction(StateMem *sm, int load, int data_only)
|
||||
extern "C" int v30mz_StateAction(StateMem *sm, int load, int data_only)
|
||||
{
|
||||
uint16 PSW;
|
||||
|
||||
|
@ -28,21 +28,21 @@ extern uint32 v30mz_timestamp;
|
||||
|
||||
/* Public functions */
|
||||
void v30mz_execute(int cycles);
|
||||
void v30mz_set_reg(int, unsigned);
|
||||
unsigned v30mz_get_reg(int regnum);
|
||||
void v30mz_reset(void);
|
||||
void v30mz_init(uint8 (*readmem20)(uint32), void (*writemem20)(uint32,uint8), uint8 (*readport)(uint32), void (*writeport)(uint32, uint8));
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
void v30mz_init(uint8 (*readmem20)(uint32), void (*writemem20)(uint32,uint8), uint8 (*readport)(uint32), void (*writeport)(uint32, uint8));
|
||||
void v30mz_set_reg(int, unsigned);
|
||||
void v30mz_reset(void);
|
||||
void v30mz_int(uint32 vector, bool IgnoreIF);
|
||||
int v30mz_StateAction(StateMem *sm, int load, int data_only);
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
int v30mz_StateAction(StateMem *sm, int load, int data_only);
|
||||
|
||||
|
||||
#ifdef WANT_DEBUGGER
|
||||
|
@ -64,7 +64,7 @@ static bool language;
|
||||
|
||||
extern uint16 WSButtonStatus;
|
||||
|
||||
void WSwan_writemem20(uint32 A, uint8 V)
|
||||
extern "C" void WSwan_writemem20(uint32 A, uint8 V)
|
||||
{
|
||||
uint32 offset = A & 0xffff;
|
||||
uint32 bank = (A>>16) & 0xF;
|
||||
@ -86,7 +86,7 @@ void WSwan_writemem20(uint32 A, uint8 V)
|
||||
}
|
||||
}
|
||||
|
||||
uint8 WSwan_readmem20(uint32 A)
|
||||
extern "C" uint8 WSwan_readmem20(uint32 A)
|
||||
{
|
||||
uint8 bank_num;
|
||||
uint32 offset = A & 0xFFFF;
|
||||
@ -188,7 +188,7 @@ void WSwan_CheckSoundDMA(void)
|
||||
}
|
||||
}
|
||||
|
||||
uint8 WSwan_readport(uint32 number)
|
||||
extern "C" uint8 WSwan_readport(uint32 number)
|
||||
{
|
||||
number &= 0xFF;
|
||||
|
||||
@ -256,7 +256,7 @@ uint8 WSwan_readport(uint32 number)
|
||||
return(0);
|
||||
}
|
||||
|
||||
void WSwan_writeport(uint32 IOPort, uint8 V)
|
||||
extern "C" void WSwan_writeport(uint32 IOPort, uint8 V)
|
||||
{
|
||||
IOPort &= 0xFF;
|
||||
|
||||
@ -497,14 +497,14 @@ void WSwan_MemorySetRegister(const unsigned int id, uint32 value)
|
||||
|
||||
#endif
|
||||
|
||||
void WSwan_MemoryKill(void)
|
||||
extern "C" void WSwan_MemoryKill(void)
|
||||
{
|
||||
if(wsSRAM)
|
||||
free(wsSRAM);
|
||||
wsSRAM = NULL;
|
||||
}
|
||||
|
||||
void WSwan_MemoryInit(bool lang, bool IsWSC, uint32 ssize, bool SkipSaveLoad)
|
||||
extern "C" void WSwan_MemoryInit(bool lang, bool IsWSC, uint32 ssize, bool SkipSaveLoad)
|
||||
{
|
||||
const uint16 byear = MDFN_GetSettingUI("wswan.byear");
|
||||
const uint8 bmonth = MDFN_GetSettingUI("wswan.bmonth");
|
||||
@ -545,7 +545,7 @@ void WSwan_MemoryInit(bool lang, bool IsWSC, uint32 ssize, bool SkipSaveLoad)
|
||||
MDFNMP_AddRAM(sram_size, 0x10000, wsSRAM);
|
||||
}
|
||||
|
||||
void WSwan_MemoryReset(void)
|
||||
extern "C" void WSwan_MemoryReset(void)
|
||||
{
|
||||
memset(wsRAM, 0, 65536);
|
||||
|
||||
@ -575,7 +575,7 @@ void WSwan_MemoryReset(void)
|
||||
CommData = 0;
|
||||
}
|
||||
|
||||
int WSwan_MemoryStateAction(StateMem *sm, int load, int data_only)
|
||||
extern "C" int WSwan_MemoryStateAction(StateMem *sm, int load, int data_only)
|
||||
{
|
||||
SFORMAT StateRegs[] =
|
||||
{
|
||||
|
@ -18,18 +18,29 @@ extern uint8 wsEEPROM[2048];
|
||||
extern uint8 *wsSRAM;
|
||||
extern uint32 wsRAMSize;
|
||||
|
||||
uint8 WSwan_readmem20(uint32);
|
||||
void WSwan_writemem20(uint32 address,uint8 data);
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
void WSwan_MemoryInit(bool lang, bool IsWSC, uint32 ssize, bool SkipSaveLoad);
|
||||
void WSwan_MemoryKill(void);
|
||||
|
||||
void WSwan_CheckSoundDMA(void);
|
||||
int WSwan_MemoryStateAction(StateMem *sm, int load, int data_only);
|
||||
void WSwan_MemoryReset(void);
|
||||
uint8 WSwan_readmem20(uint32);
|
||||
void WSwan_writemem20(uint32 address,uint8 data);
|
||||
|
||||
void WSwan_writeport(uint32 IOPort, uint8 V);
|
||||
uint8 WSwan_readport(uint32 number);
|
||||
|
||||
void WSwan_MemoryReset(void);
|
||||
int WSwan_MemoryStateAction(StateMem *sm, int load, int data_only);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
void WSwan_CheckSoundDMA(void);
|
||||
|
||||
uint32 WSwan_MemoryGetRegister(const unsigned int id, char *special, const uint32 special_len);
|
||||
void WSwan_MemorySetRegister(const unsigned int id, uint32 value);
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user