Nearly entire codebase is C now - except for mempatcher.cpp

This commit is contained in:
twinaphex 2020-10-04 14:52:39 +02:00
parent d18b0d906b
commit 6980175b2b
9 changed files with 44 additions and 49 deletions

View File

@ -18,15 +18,13 @@ INCFLAGS += -I$(LIBRETRO_COMM_DIR)/include/compat/msvc
endif
ifneq ($(HAVE_GRIFFIN),1)
SOURCES_CXX += \
$(CORE_EMU_DIR)/gfx.cpp \
$(CORE_EMU_DIR)/wswan-memory.cpp \
$(CORE_EMU_DIR)/sound.cpp
SOURCES_C += \
$(CORE_EMU_DIR)/sound.c \
$(CORE_EMU_DIR)/interrupt.c \
$(CORE_EMU_DIR)/rtc.c \
$(CORE_EMU_DIR)/tcache.c \
$(CORE_EMU_DIR)/gfx.c \
$(CORE_EMU_DIR)/wswan-memory.c \
$(CORE_EMU_DIR)/v30mz.c \
$(CORE_EMU_DIR)/eeprom.c
endif

View File

@ -115,8 +115,7 @@ extern "C" void MDFNMP_Kill(void)
}
}
void MDFNMP_AddRAM(uint32 size, uint32 A, uint8 *RAM)
extern "C" void MDFNMP_AddRAM(uint32 size, uint32 A, uint8 *RAM)
{
uint32 AB = A / PageSize;

View File

@ -24,12 +24,12 @@ void MDFNMP_InstallReadPatches(void);
bool MDFNMP_Init(uint32 ps, uint32 numpages);
void MDFNMP_AddRAM(uint32 size, uint32 address, uint8 *RAM);
#ifdef __cplusplus
}
#endif
void MDFNMP_AddRAM(uint32 size, uint32 address, uint8 *RAM);
void MDFNMP_RemoveReadPatches(void);

View File

@ -63,7 +63,7 @@ static uint16 VBTimerPeriod;
static uint16 HBCounter, VBCounter;
static uint8 VideoMode;
extern "C" void WSwan_GfxInit(void)
void WSwan_GfxInit(void)
{
LayerEnabled = 7; // BG, FG, sprites
}
@ -121,7 +121,7 @@ void WSwan_GfxWrite(uint32 A, uint8 V)
}
}
extern "C" uint8 WSwan_GfxRead(uint32 A)
uint8 WSwan_GfxRead(uint32 A)
{
if(A >= 0x1C && A <= 0x1F)
{
@ -176,7 +176,7 @@ extern "C" uint8 WSwan_GfxRead(uint32 A)
return 0;
}
extern "C" bool wsExecuteLine(MDFN_Surface *surface, bool skip)
bool wsExecuteLine(MDFN_Surface *surface, bool skip)
{
bool ret = false;
@ -270,7 +270,7 @@ void WSwan_SetLayerEnableMask(uint64 mask)
LayerEnabled = mask;
}
extern "C" void WSwan_SetPixelFormat(int depth)
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)
}
extern "C" void WSwan_GfxReset(void)
void WSwan_GfxReset(void)
{
unsigned u0, u1;
@ -649,7 +649,7 @@ extern "C" void WSwan_GfxReset(void)
}
extern "C" int WSwan_GfxStateAction(StateMem *sm, int load, int data_only)
int WSwan_GfxStateAction(StateMem *sm, int load, int data_only)
{
SFORMAT StateRegs[] =
{

View File

@ -4,6 +4,10 @@
#include "../state.h"
#include "../video.h"
#ifdef __cplusplus
extern "C" {
#endif
extern uint8 wsTCache[512*64]; //tiles cache
extern uint8 wsTCacheFlipped[512*64]; //tiles cache (H flip)
extern uint8 wsTCacheUpdate[512]; //tiles cache flags
@ -11,9 +15,6 @@ extern uint8 wsTCache2[512*64]; //tiles cache
extern uint8 wsTCacheFlipped2[512*64]; //tiles cache (H flip)
extern uint8 wsTCacheUpdate2[512]; //tiles cache flags
#ifdef __cplusplus
extern "C" {
#endif
extern uint8 wsTileRow[8]; //extracted 8 pixels (tile row)
extern int wsVMode; //Video Mode
@ -35,22 +36,14 @@ uint8 WSwan_GfxRead(uint32 A);
int WSwan_GfxStateAction(StateMem *sm, int load, int data_only);
#ifdef __cplusplus
}
#endif
void wsScanline(uint16 *target, int depth);
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_GfxWrite(uint32 A, uint8 V);
void WSwan_GfxWSCPaletteRAMWrite(uint32 ws_offset, uint8 data);
void WSwan_SetLayerEnableMask(uint64 mask);
#ifdef WANT_DEBUGGER
@ -58,4 +51,9 @@ void WSwan_GfxSetGraphicsDecode(MDFN_Surface *surface, int line, int which, int
uint32 WSwan_GfxGetRegister(const std::string &oname, std::string *special);
#endif
#ifdef __cplusplus
}
#endif
#endif

View File

@ -331,7 +331,7 @@ uint8 WSwan_SoundRead(uint32 A)
return(0);
}
extern "C" int32 WSwan_SoundFlush(int16 *SoundBuf, const int32 MaxSoundFrames)
int32 WSwan_SoundFlush(int16 *SoundBuf, const int32 MaxSoundFrames)
{
int32 FrameCount = 0;
@ -366,7 +366,7 @@ static void RedoVolume(void)
Blip_Synth_set_volume(&WaveSynth, eff_volume, 256);
}
extern "C" void WSwan_SoundInit(void)
void WSwan_SoundInit(void)
{
unsigned i;
for(i = 0; i < 2; i++)
@ -380,7 +380,7 @@ extern "C" void WSwan_SoundInit(void)
RedoVolume();
}
extern "C" void WSwan_SoundKill(void)
void WSwan_SoundKill(void)
{
int i;
for(i = 0; i < 2; i++)
@ -389,7 +389,7 @@ extern "C" void WSwan_SoundKill(void)
}
}
extern "C" bool WSwan_SetSoundRate(uint32 rate)
bool WSwan_SetSoundRate(uint32 rate)
{
unsigned i;
for(i = 0; i < 2; i++)
@ -398,7 +398,7 @@ extern "C" bool WSwan_SetSoundRate(uint32 rate)
return(true);
}
extern "C" int WSwan_SoundStateAction(StateMem *sm, int load, int data_only)
int WSwan_SoundStateAction(StateMem *sm, int load, int data_only)
{
SFORMAT StateRegs[] =
{
@ -445,7 +445,7 @@ extern "C" int WSwan_SoundStateAction(StateMem *sm, int load, int data_only)
return(1);
}
extern "C" void WSwan_SoundReset(void)
void WSwan_SoundReset(void)
{
unsigned y,ch;

View File

@ -18,9 +18,6 @@ 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);
@ -28,4 +25,8 @@ void WSwan_SoundWrite(uint32, uint8);
uint8 WSwan_SoundRead(uint32);
void WSwan_SoundCheckRAMWrite(uint32 A);
#ifdef __cplusplus
}
#endif
#endif

View File

@ -62,9 +62,9 @@ static uint8 CommControl, CommData;
static bool language;
extern "C" uint16 WSButtonStatus;
uint16 WSButtonStatus;
extern "C" void WSwan_writemem20(uint32 A, uint8 V)
void WSwan_writemem20(uint32 A, uint8 V)
{
uint32 offset = A & 0xffff;
uint32 bank = (A>>16) & 0xF;
@ -86,7 +86,7 @@ extern "C" void WSwan_writemem20(uint32 A, uint8 V)
}
}
extern "C" uint8 WSwan_readmem20(uint32 A)
uint8 WSwan_readmem20(uint32 A)
{
uint8 bank_num;
uint32 offset = A & 0xFFFF;
@ -188,7 +188,7 @@ void WSwan_CheckSoundDMA(void)
}
}
extern "C" uint8 WSwan_readport(uint32 number)
uint8 WSwan_readport(uint32 number)
{
number &= 0xFF;
@ -256,7 +256,7 @@ extern "C" uint8 WSwan_readport(uint32 number)
return(0);
}
extern "C" void WSwan_writeport(uint32 IOPort, uint8 V)
void WSwan_writeport(uint32 IOPort, uint8 V)
{
IOPort &= 0xFF;
@ -497,14 +497,14 @@ void WSwan_MemorySetRegister(const unsigned int id, uint32 value)
#endif
extern "C" void WSwan_MemoryKill(void)
void WSwan_MemoryKill(void)
{
if(wsSRAM)
free(wsSRAM);
wsSRAM = NULL;
}
extern "C" void WSwan_MemoryInit(bool lang, bool IsWSC, uint32 ssize, bool SkipSaveLoad)
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 @@ extern "C" void WSwan_MemoryInit(bool lang, bool IsWSC, uint32 ssize, bool SkipS
MDFNMP_AddRAM(sram_size, 0x10000, wsSRAM);
}
extern "C" void WSwan_MemoryReset(void)
void WSwan_MemoryReset(void)
{
memset(wsRAM, 0, 65536);
@ -575,7 +575,7 @@ extern "C" void WSwan_MemoryReset(void)
CommData = 0;
}
extern "C" int WSwan_MemoryStateAction(StateMem *sm, int load, int data_only)
int WSwan_MemoryStateAction(StateMem *sm, int load, int data_only)
{
SFORMAT StateRegs[] =
{

View File

@ -35,14 +35,13 @@ 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);
#ifdef __cplusplus
}
#endif
#endif