Cleanup more libretro-specific branches
This commit is contained in:
parent
1c95df1212
commit
e2f3a64143
|
@ -175,7 +175,6 @@ void utilReadScreenPixels(uint8_t *dest, int w, int h)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifndef __LIBRETRO__
|
|
||||||
bool utilWritePNGFile(const char *fileName, int w, int h, uint8_t *pix)
|
bool utilWritePNGFile(const char *fileName, int w, int h, uint8_t *pix)
|
||||||
{
|
{
|
||||||
#ifndef NO_PNG
|
#ifndef NO_PNG
|
||||||
|
@ -298,7 +297,6 @@ bool utilWritePNGFile(const char *fileName, int w, int h, uint8_t *pix)
|
||||||
return false;
|
return false;
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
#endif /* !__LIBRETRO__ */
|
|
||||||
|
|
||||||
void utilPutDword(uint8_t *p, uint32_t value)
|
void utilPutDword(uint8_t *p, uint32_t value)
|
||||||
{
|
{
|
||||||
|
|
|
@ -5800,27 +5800,7 @@ bool gbReadSaveState(const uint8_t* data)
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
#endif /* __LIBRETRO__ */
|
||||||
bool gbWriteMemSaveState(char*, int, long&)
|
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool gbReadMemSaveState(char*, int)
|
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool gbReadBatteryFile(const char*)
|
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool gbWriteBatteryFile(const char*)
|
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
struct EmulatedSystem GBSystem = {
|
struct EmulatedSystem GBSystem = {
|
||||||
// emuMain
|
// emuMain
|
||||||
|
@ -5829,6 +5809,16 @@ struct EmulatedSystem GBSystem = {
|
||||||
gbReset,
|
gbReset,
|
||||||
// emuCleanUp
|
// emuCleanUp
|
||||||
gbCleanUp,
|
gbCleanUp,
|
||||||
|
#ifdef __LIBRETRO__
|
||||||
|
NULL, // emuReadBattery
|
||||||
|
NULL, // emuWriteBattery
|
||||||
|
gbReadSaveState, // emuReadState
|
||||||
|
gbWriteSaveState, // emuWriteState
|
||||||
|
NULL, // emuReadMemState
|
||||||
|
NULL, // emuWriteMemState
|
||||||
|
NULL, // emuWritePNG
|
||||||
|
NULL, // emuWriteBMP
|
||||||
|
#else
|
||||||
// emuReadBattery
|
// emuReadBattery
|
||||||
gbReadBatteryFile,
|
gbReadBatteryFile,
|
||||||
// emuWriteBattery
|
// emuWriteBattery
|
||||||
|
@ -5841,15 +5831,11 @@ struct EmulatedSystem GBSystem = {
|
||||||
gbReadMemSaveState,
|
gbReadMemSaveState,
|
||||||
// emuWriteMemState
|
// emuWriteMemState
|
||||||
gbWriteMemSaveState,
|
gbWriteMemSaveState,
|
||||||
#ifdef __LIBRETRO__
|
|
||||||
NULL, // emuWritePNG
|
|
||||||
NULL, // emuWriteBMP
|
|
||||||
#else
|
|
||||||
// emuWritePNG
|
// emuWritePNG
|
||||||
gbWritePNGFile,
|
gbWritePNGFile,
|
||||||
// emuWriteBMP
|
// emuWriteBMP
|
||||||
gbWriteBMPFile,
|
gbWriteBMPFile,
|
||||||
#endif
|
#endif /* ! __LIBRETRO__ */
|
||||||
// emuUpdateCPSR
|
// emuUpdateCPSR
|
||||||
NULL,
|
NULL,
|
||||||
// emuHasDebugger
|
// emuHasDebugger
|
||||||
|
|
|
@ -99,7 +99,7 @@ void gbCheatsReadGameSkip(gzFile gzFile, int version)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
#endif /* __LIBRETRO__ */
|
||||||
|
|
||||||
void gbCheatsSaveCheatList(const char* file)
|
void gbCheatsSaveCheatList(const char* file)
|
||||||
{
|
{
|
||||||
|
|
|
@ -393,7 +393,7 @@ static void gbSoundReadGameOld(int version, gzFile gzFile)
|
||||||
|
|
||||||
memcpy(&s.regs[0x20], &gbMemory[0xFF30], 0x10); // wave
|
memcpy(&s.regs[0x20], &gbMemory[0xFF30], 0x10); // wave
|
||||||
}
|
}
|
||||||
#endif
|
#endif // ! __LIBRETRO__
|
||||||
|
|
||||||
// New state format
|
// New state format
|
||||||
static variable_desc gb_state[] = {
|
static variable_desc gb_state[] = {
|
||||||
|
@ -429,11 +429,8 @@ static variable_desc gb_state[] = {
|
||||||
{ NULL, 0 }
|
{ NULL, 0 }
|
||||||
};
|
};
|
||||||
|
|
||||||
#ifdef __LIBRETRO__
|
#ifndef __LIBRETRO__
|
||||||
void gbSoundSaveGame(uint8_t*& out)
|
|
||||||
#else
|
|
||||||
void gbSoundSaveGame(gzFile out)
|
void gbSoundSaveGame(gzFile out)
|
||||||
#endif
|
|
||||||
{
|
{
|
||||||
gb_apu->save_state(&state.apu);
|
gb_apu->save_state(&state.apu);
|
||||||
|
|
||||||
|
@ -441,31 +438,43 @@ void gbSoundSaveGame(gzFile out)
|
||||||
memset(dummy_state, 0, sizeof dummy_state);
|
memset(dummy_state, 0, sizeof dummy_state);
|
||||||
|
|
||||||
state.version = 1;
|
state.version = 1;
|
||||||
#ifdef __LIBRETRO__
|
|
||||||
utilWriteDataMem(out, gb_state);
|
|
||||||
#else
|
|
||||||
utilWriteData(out, gb_state);
|
utilWriteData(out, gb_state);
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef __LIBRETRO__
|
|
||||||
void gbSoundReadGame(const uint8_t*& in)
|
|
||||||
#else
|
|
||||||
void gbSoundReadGame(int version, gzFile in)
|
void gbSoundReadGame(int version, gzFile in)
|
||||||
#endif
|
|
||||||
{
|
{
|
||||||
// Prepare APU and default state
|
// Prepare APU and default state
|
||||||
reset_apu();
|
reset_apu();
|
||||||
gb_apu->save_state(&state.apu);
|
gb_apu->save_state(&state.apu);
|
||||||
|
|
||||||
#ifdef __LIBRETRO__
|
|
||||||
utilReadDataMem(in, gb_state);
|
|
||||||
#else
|
|
||||||
if (version > 11)
|
if (version > 11)
|
||||||
utilReadData(in, gb_state);
|
utilReadData(in, gb_state);
|
||||||
else
|
else
|
||||||
gbSoundReadGameOld(version, in);
|
gbSoundReadGameOld(version, in);
|
||||||
#endif
|
|
||||||
|
|
||||||
gb_apu->load_state(state.apu);
|
gb_apu->load_state(state.apu);
|
||||||
}
|
}
|
||||||
|
#endif // ! __LIBRETRO__
|
||||||
|
|
||||||
|
#ifdef __LIBRETRO__
|
||||||
|
void gbSoundSaveGame(uint8_t*& out)
|
||||||
|
{
|
||||||
|
gb_apu->save_state(&state.apu);
|
||||||
|
|
||||||
|
// Be sure areas for expansion get written as zero
|
||||||
|
memset(dummy_state, 0, sizeof dummy_state);
|
||||||
|
|
||||||
|
state.version = 1;
|
||||||
|
utilWriteDataMem(out, gb_state);
|
||||||
|
}
|
||||||
|
|
||||||
|
void gbSoundReadGame(const uint8_t*& in)
|
||||||
|
{
|
||||||
|
// Prepare APU and default state
|
||||||
|
reset_apu();
|
||||||
|
gb_apu->save_state(&state.apu);
|
||||||
|
|
||||||
|
utilReadDataMem(in, gb_state);
|
||||||
|
gb_apu->load_state(state.apu);
|
||||||
|
}
|
||||||
|
#endif // __LIBRETRO__
|
||||||
|
|
|
@ -4247,6 +4247,16 @@ struct EmulatedSystem GBASystem = {
|
||||||
CPUReset,
|
CPUReset,
|
||||||
// emuCleanUp
|
// emuCleanUp
|
||||||
CPUCleanUp,
|
CPUCleanUp,
|
||||||
|
#ifdef __LIBRETRO__
|
||||||
|
NULL, // emuReadBattery
|
||||||
|
NULL, // emuReadState
|
||||||
|
CPUReadState, // emuReadState
|
||||||
|
CPUWriteState, // emuWriteState
|
||||||
|
NULL, // emuReadMemState
|
||||||
|
NULL, // emuWriteMemState
|
||||||
|
NULL, // emuWritePNG
|
||||||
|
NULL, // emuWriteBMP
|
||||||
|
#else
|
||||||
// emuReadBattery
|
// emuReadBattery
|
||||||
CPUReadBatteryFile,
|
CPUReadBatteryFile,
|
||||||
// emuWriteBattery
|
// emuWriteBattery
|
||||||
|
@ -4255,19 +4265,10 @@ struct EmulatedSystem GBASystem = {
|
||||||
CPUReadState,
|
CPUReadState,
|
||||||
// emuWriteState
|
// emuWriteState
|
||||||
CPUWriteState,
|
CPUWriteState,
|
||||||
#ifdef __LIBRETRO__
|
|
||||||
NULL, // emuReadMemState
|
|
||||||
NULL, // emuWriteMemState
|
|
||||||
#else
|
|
||||||
// emuReadMemState
|
// emuReadMemState
|
||||||
CPUReadMemState,
|
CPUReadMemState,
|
||||||
// emuWriteMemState
|
// emuWriteMemState
|
||||||
CPUWriteMemState,
|
CPUWriteMemState,
|
||||||
#endif
|
|
||||||
#ifdef __LIBRETRO__
|
|
||||||
NULL, // emuWritePNG
|
|
||||||
NULL, // emuWriteBMP
|
|
||||||
#else
|
|
||||||
// emuWritePNG
|
// emuWritePNG
|
||||||
CPUWritePNGFile,
|
CPUWritePNGFile,
|
||||||
// emuWriteBMP
|
// emuWriteBMP
|
||||||
|
|
|
@ -337,13 +337,16 @@ static void end_frame(blip_time_t time)
|
||||||
stereo_buffer->end_frame(time);
|
stereo_buffer->end_frame(time);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef __LIBRETRO__
|
||||||
void flush_samples(Multi_Buffer* buffer)
|
void flush_samples(Multi_Buffer* buffer)
|
||||||
{
|
{
|
||||||
#ifdef __LIBRETRO__
|
|
||||||
int numSamples = buffer->read_samples((blip_sample_t*)soundFinalWave, buffer->samples_avail());
|
int numSamples = buffer->read_samples((blip_sample_t*)soundFinalWave, buffer->samples_avail());
|
||||||
soundDriver->write(soundFinalWave, numSamples);
|
soundDriver->write(soundFinalWave, numSamples);
|
||||||
systemOnWriteDataToSoundBuffer(soundFinalWave, numSamples);
|
systemOnWriteDataToSoundBuffer(soundFinalWave, numSamples);
|
||||||
|
}
|
||||||
#else
|
#else
|
||||||
|
void flush_samples(Multi_Buffer* buffer)
|
||||||
|
{
|
||||||
// We want to write the data frame by frame to support legacy audio drivers
|
// We want to write the data frame by frame to support legacy audio drivers
|
||||||
// that don't use the length parameter of the write method.
|
// that don't use the length parameter of the write method.
|
||||||
// TODO: Update the Win32 audio drivers (DS, OAL, XA2), and flush all the
|
// TODO: Update the Win32 audio drivers (DS, OAL, XA2), and flush all the
|
||||||
|
@ -365,8 +368,8 @@ void flush_samples(Multi_Buffer* buffer)
|
||||||
soundDriver->write(soundFinalWave, soundBufferLen);
|
soundDriver->write(soundFinalWave, soundBufferLen);
|
||||||
systemOnWriteDataToSoundBuffer(soundFinalWave, soundBufferLen);
|
systemOnWriteDataToSoundBuffer(soundFinalWave, soundBufferLen);
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
#endif // ! __LIBRETRO__
|
||||||
|
|
||||||
static void apply_filtering()
|
static void apply_filtering()
|
||||||
{
|
{
|
||||||
|
@ -726,25 +729,17 @@ static variable_desc gba_state[] = {
|
||||||
{ NULL, 0 }
|
{ NULL, 0 }
|
||||||
};
|
};
|
||||||
|
|
||||||
#ifdef __LIBRETRO__
|
#ifndef __LIBRETRO__
|
||||||
void soundSaveGame(uint8_t*& out)
|
|
||||||
#else
|
|
||||||
void soundSaveGame(gzFile out)
|
void soundSaveGame(gzFile out)
|
||||||
#endif
|
|
||||||
{
|
{
|
||||||
gb_apu->save_state(&state.apu);
|
gb_apu->save_state(&state.apu);
|
||||||
|
|
||||||
// Be sure areas for expansion get written as zero
|
// Be sure areas for expansion get written as zero
|
||||||
memset(dummy_state, 0, sizeof dummy_state);
|
memset(dummy_state, 0, sizeof dummy_state);
|
||||||
|
|
||||||
#ifdef __LIBRETRO__
|
|
||||||
utilWriteDataMem(out, gba_state);
|
|
||||||
#else
|
|
||||||
utilWriteData(out, gba_state);
|
utilWriteData(out, gba_state);
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifndef __LIBRETRO__
|
|
||||||
// Reads and discards count bytes from in
|
// Reads and discards count bytes from in
|
||||||
static void skip_read(gzFile in, int count)
|
static void skip_read(gzFile in, int count)
|
||||||
{
|
{
|
||||||
|
@ -794,31 +789,49 @@ static void soundReadGameOld(gzFile in, int version)
|
||||||
|
|
||||||
(void)utilReadInt(in); // ignore quality
|
(void)utilReadInt(in); // ignore quality
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
|
||||||
#ifdef __LIBRETRO__
|
|
||||||
void soundReadGame(const uint8_t*& in)
|
|
||||||
#else
|
|
||||||
void soundReadGame(gzFile in, int version)
|
void soundReadGame(gzFile in, int version)
|
||||||
#endif
|
|
||||||
{
|
{
|
||||||
// Prepare APU and default state
|
// Prepare APU and default state
|
||||||
reset_apu();
|
reset_apu();
|
||||||
gb_apu->save_state(&state.apu);
|
gb_apu->save_state(&state.apu);
|
||||||
|
|
||||||
#ifdef __LIBRETRO__
|
|
||||||
utilReadDataMem(in, gba_state);
|
|
||||||
#else
|
|
||||||
if (version > SAVE_GAME_VERSION_9)
|
if (version > SAVE_GAME_VERSION_9)
|
||||||
utilReadData(in, gba_state);
|
utilReadData(in, gba_state);
|
||||||
else
|
else
|
||||||
soundReadGameOld(in, version);
|
soundReadGameOld(in, version);
|
||||||
#endif
|
|
||||||
|
|
||||||
gb_apu->load_state(state.apu);
|
gb_apu->load_state(state.apu);
|
||||||
write_SGCNT0_H(READ16LE(&ioMem[SGCNT0_H]) & 0x770F);
|
write_SGCNT0_H(READ16LE(&ioMem[SGCNT0_H]) & 0x770F);
|
||||||
|
|
||||||
apply_muting();
|
apply_muting();
|
||||||
}
|
}
|
||||||
|
#endif // !__LIBRETRO__
|
||||||
|
|
||||||
|
#ifdef __LIBRETRO__
|
||||||
|
void soundSaveGame(uint8_t*& out)
|
||||||
|
{
|
||||||
|
gb_apu->save_state(&state.apu);
|
||||||
|
|
||||||
|
// Be sure areas for expansion get written as zero
|
||||||
|
memset(dummy_state, 0, sizeof dummy_state);
|
||||||
|
|
||||||
|
utilWriteDataMem(out, gba_state);
|
||||||
|
}
|
||||||
|
|
||||||
|
void soundReadGame(const uint8_t*& in)
|
||||||
|
{
|
||||||
|
// Prepare APU and default state
|
||||||
|
reset_apu();
|
||||||
|
gb_apu->save_state(&state.apu);
|
||||||
|
|
||||||
|
utilReadDataMem(in, gba_state);
|
||||||
|
|
||||||
|
gb_apu->load_state(state.apu);
|
||||||
|
write_SGCNT0_H(READ16LE(&ioMem[SGCNT0_H]) & 0x770F);
|
||||||
|
|
||||||
|
apply_muting();
|
||||||
|
}
|
||||||
|
#endif // __LIBRETRO__
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
LIBRETRO_COMMON := $(CORE_DIR)/libretro/libretro-common
|
LIBRETRO_COMMON := $(CORE_DIR)/libretro/libretro-common
|
||||||
INCFLAGS := -I$(CORE_DIR) -I$(LIBRETRO_COMMON)/include
|
INCFLAGS := -I$(CORE_DIR) -I$(LIBRETRO_COMMON)/include
|
||||||
VBA_DEFINES := -D__LIBRETRO__ -DFINAL_VERSION -DC_CORE -DNO_DEBUGGER
|
VBA_DEFINES := -D__LIBRETRO__ -DFINAL_VERSION -DC_CORE -DNO_DEBUGGER
|
||||||
|
VBA_DEFINES += -DNO_PNG
|
||||||
|
|
||||||
ifeq ($(TILED_RENDERING), 1)
|
ifeq ($(TILED_RENDERING), 1)
|
||||||
VBA_DEFINES += -DTILED_RENDERING
|
VBA_DEFINES += -DTILED_RENDERING
|
||||||
|
|
Loading…
Reference in New Issue