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