Merge pull request #111 from negativeExponent/fix_warnings
Fix warnings and more cleanups
This commit is contained in:
commit
655cfb929d
|
@ -20,9 +20,9 @@ struct EmulatedSystem {
|
|||
bool (*emuWriteBattery)(const char *);
|
||||
#ifdef __LIBRETRO__
|
||||
// load state
|
||||
bool (*emuReadState)(const uint8_t *, unsigned);
|
||||
bool (*emuReadState)(const uint8_t *);
|
||||
// load state
|
||||
unsigned (*emuWriteState)(uint8_t *, unsigned);
|
||||
unsigned (*emuWriteState)(uint8_t *);
|
||||
#else
|
||||
// load state
|
||||
bool (*emuReadState)(const char *);
|
||||
|
|
|
@ -312,6 +312,7 @@ void utilPutWord(uint8_t *p, uint16_t value)
|
|||
*p = (value >> 8) & 255;
|
||||
}
|
||||
|
||||
#ifndef __LIBRETRO__
|
||||
bool utilWriteBMPFile(const char *fileName, int w, int h, uint8_t *pix)
|
||||
{
|
||||
uint8_t writeBuffer[512 * 3];
|
||||
|
@ -430,6 +431,7 @@ bool utilWriteBMPFile(const char *fileName, int w, int h, uint8_t *pix)
|
|||
|
||||
return true;
|
||||
}
|
||||
#endif /* !__LIBRETRO__ */
|
||||
|
||||
extern bool cpuIsMultiBoot;
|
||||
|
||||
|
|
|
@ -26,8 +26,10 @@ std::string get_xdg_user_config_home();
|
|||
std::string get_xdg_user_data_home();
|
||||
|
||||
void utilReadScreenPixels(uint8_t *dest, int w, int h);
|
||||
#ifndef __LIBRETRO__
|
||||
bool utilWritePNGFile(const char *, int, int, uint8_t *);
|
||||
bool utilWriteBMPFile(const char *, int, int, uint8_t *);
|
||||
#endif
|
||||
void utilApplyIPS(const char *ips, uint8_t **rom, int *size);
|
||||
bool utilIsGBAImage(const char *);
|
||||
bool utilIsGBImage(const char *);
|
||||
|
|
|
@ -4064,7 +4064,6 @@ bool gbReadSaveState(const char* name)
|
|||
|
||||
return res;
|
||||
}
|
||||
#endif // !__LIBRETRO__
|
||||
|
||||
bool gbWritePNGFile(const char* fileName)
|
||||
{
|
||||
|
@ -4079,6 +4078,7 @@ bool gbWriteBMPFile(const char* fileName)
|
|||
return utilWriteBMPFile(fileName, 256, 224, pix);
|
||||
return utilWriteBMPFile(fileName, 160, 144, pix);
|
||||
}
|
||||
#endif // !__LIBRETRO__
|
||||
|
||||
void gbCleanUp()
|
||||
{
|
||||
|
@ -5492,7 +5492,7 @@ bool gbLoadRomData(const char* data, unsigned size)
|
|||
#ifdef __LIBRETRO__
|
||||
#include <stddef.h>
|
||||
|
||||
unsigned int gbWriteSaveState(uint8_t* data, unsigned)
|
||||
unsigned int gbWriteSaveState(uint8_t* data)
|
||||
{
|
||||
uint8_t* orig = data;
|
||||
|
||||
|
@ -5560,7 +5560,7 @@ unsigned int gbWriteSaveState(uint8_t* data, unsigned)
|
|||
return (ptrdiff_t)data - (ptrdiff_t)orig;
|
||||
}
|
||||
|
||||
bool gbReadSaveState(const uint8_t* data, unsigned)
|
||||
bool gbReadSaveState(const uint8_t* data)
|
||||
{
|
||||
int version = utilReadIntMem(data);
|
||||
|
||||
|
@ -5625,7 +5625,7 @@ bool gbReadSaveState(const uint8_t* data, unsigned)
|
|||
utilReadMem(&IFF, data, 2);
|
||||
|
||||
if (gbSgbMode) {
|
||||
gbSgbReadGame(data, version);
|
||||
gbSgbReadGame(data);
|
||||
} else {
|
||||
gbSgbMask = 0; // loading a game at the wrong time causes no display
|
||||
}
|
||||
|
@ -5767,7 +5767,7 @@ bool gbReadSaveState(const uint8_t* data, unsigned)
|
|||
gbMemoryMap[0x0d] = &gbWram[value * 0x1000];
|
||||
}
|
||||
|
||||
gbSoundReadGame(data, version);
|
||||
gbSoundReadGame(data);
|
||||
|
||||
if (gbCgbMode && gbSgbMode) {
|
||||
gbSgbMode = 0;
|
||||
|
@ -5800,27 +5800,7 @@ bool gbReadSaveState(const uint8_t* data, unsigned)
|
|||
|
||||
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
|
||||
|
@ -5845,6 +5835,7 @@ struct EmulatedSystem GBSystem = {
|
|||
gbWritePNGFile,
|
||||
// emuWriteBMP
|
||||
gbWriteBMPFile,
|
||||
#endif /* ! __LIBRETRO__ */
|
||||
// emuUpdateCPSR
|
||||
NULL,
|
||||
// emuHasDebugger
|
||||
|
|
|
@ -99,7 +99,7 @@ void gbCheatsReadGameSkip(gzFile gzFile, int version)
|
|||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
#endif /* __LIBRETRO__ */
|
||||
|
||||
void gbCheatsSaveCheatList(const char* file)
|
||||
{
|
||||
|
|
|
@ -896,7 +896,7 @@ void gbSgbSaveGame(uint8_t*& data)
|
|||
utilWriteMem(data, gbSgbATFList, 45 * 20 * 18);
|
||||
}
|
||||
|
||||
void gbSgbReadGame(const uint8_t*& data, int version)
|
||||
void gbSgbReadGame(const uint8_t*& data)
|
||||
{
|
||||
utilReadDataMem(data, gbSgbSaveStructV3);
|
||||
|
||||
|
|
|
@ -10,7 +10,7 @@ void gbSgbDoBitTransfer(uint8_t);
|
|||
void gbSgbRenderBorder();
|
||||
#ifdef __LIBRETRO__
|
||||
void gbSgbSaveGame(uint8_t*&);
|
||||
void gbSgbReadGame(const uint8_t*&, int);
|
||||
void gbSgbReadGame(const uint8_t*&);
|
||||
#else
|
||||
void gbSgbSaveGame(gzFile);
|
||||
void gbSgbReadGame(gzFile, int version);
|
||||
|
|
|
@ -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, int version)
|
||||
#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__
|
||||
|
|
|
@ -70,7 +70,7 @@ extern int soundTicks; // Number of 16.8 MHz clocks until gbSoundTick() will be
|
|||
// Saves/loads emulator state
|
||||
#ifdef __LIBRETRO__
|
||||
void gbSoundSaveGame(uint8_t*&);
|
||||
void gbSoundReadGame(const uint8_t*&, int);
|
||||
void gbSoundReadGame(const uint8_t*&);
|
||||
#else
|
||||
void gbSoundSaveGame(gzFile out);
|
||||
void gbSoundReadGame(int version, gzFile in);
|
||||
|
|
|
@ -2825,9 +2825,9 @@ static uint8_t cheatsGetType(uint32_t address)
|
|||
}
|
||||
#endif
|
||||
|
||||
#ifdef BKPT_SUPPORT
|
||||
void cheatsWriteMemory(uint32_t address, uint32_t value)
|
||||
{
|
||||
#ifdef BKPT_SUPPORT
|
||||
if (cheatsNumber == 0) {
|
||||
int type = cheatsGetType(address);
|
||||
uint32_t oldValue = debuggerReadMemory(address);
|
||||
|
@ -2837,12 +2837,10 @@ void cheatsWriteMemory(uint32_t address, uint32_t value)
|
|||
}
|
||||
debuggerWriteMemory(address, value);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
void cheatsWriteHalfWord(uint32_t address, uint16_t value)
|
||||
{
|
||||
#ifdef BKPT_SUPPORT
|
||||
if (cheatsNumber == 0) {
|
||||
int type = cheatsGetType(address);
|
||||
uint16_t oldValue = debuggerReadHalfWord(address);
|
||||
|
@ -2852,12 +2850,10 @@ void cheatsWriteHalfWord(uint32_t address, uint16_t value)
|
|||
}
|
||||
debuggerWriteHalfWord(address, value);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
void cheatsWriteByte(uint32_t address, uint8_t value)
|
||||
{
|
||||
#ifdef BKPT_SUPPORT
|
||||
if (cheatsNumber == 0) {
|
||||
int type = cheatsGetType(address);
|
||||
uint8_t oldValue = debuggerReadByte(address);
|
||||
|
@ -2867,5 +2863,5 @@ void cheatsWriteByte(uint32_t address, uint8_t value)
|
|||
}
|
||||
debuggerWriteByte(address, value);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
|
|
|
@ -33,9 +33,11 @@ void cheatsReadGameSkip(gzFile file, int version);
|
|||
void cheatsSaveCheatList(const char* file);
|
||||
bool cheatsLoadCheatList(const char* file);
|
||||
#endif
|
||||
#ifdef BKPT_SUPPORT
|
||||
void cheatsWriteMemory(uint32_t address, uint32_t value);
|
||||
void cheatsWriteHalfWord(uint32_t address, uint16_t value);
|
||||
void cheatsWriteByte(uint32_t address, uint8_t value);
|
||||
#endif
|
||||
int cheatsCheckKeys(uint32_t keys, uint32_t extended);
|
||||
|
||||
extern int cheatsNumber;
|
||||
|
|
|
@ -51,16 +51,11 @@ void eepromSaveGame(uint8_t*& data)
|
|||
utilWriteMem(data, eepromData, SIZE_EEPROM_8K);
|
||||
}
|
||||
|
||||
void eepromReadGame(const uint8_t*& data, int version)
|
||||
void eepromReadGame(const uint8_t*& data)
|
||||
{
|
||||
utilReadDataMem(data, eepromSaveData);
|
||||
if (version >= SAVE_GAME_VERSION_3) {
|
||||
eepromSize = utilReadIntMem(data);
|
||||
utilReadMem(eepromData, data, SIZE_EEPROM_8K);
|
||||
} else {
|
||||
// prior to 0.7.1, only 4K EEPROM was supported
|
||||
eepromSize = SIZE_EEPROM_512;
|
||||
}
|
||||
eepromSize = utilReadIntMem(data);
|
||||
utilReadMem(eepromData, data, SIZE_EEPROM_8K);
|
||||
}
|
||||
|
||||
#else // !__LIBRETRO__
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
|
||||
#ifdef __LIBRETRO__
|
||||
extern void eepromSaveGame(uint8_t*& data);
|
||||
extern void eepromReadGame(const uint8_t*& data, int version);
|
||||
extern void eepromReadGame(const uint8_t*& data);
|
||||
#else // !__LIBRETRO__
|
||||
extern void eepromSaveGame(gzFile _gzFile);
|
||||
extern void eepromReadGame(gzFile _gzFile, int version);
|
||||
|
|
|
@ -228,7 +228,7 @@ void flashSaveGame(uint8_t*& data)
|
|||
utilWriteDataMem(data, flashSaveData3);
|
||||
}
|
||||
|
||||
void flashReadGame(const uint8_t*& data, int)
|
||||
void flashReadGame(const uint8_t*& data)
|
||||
{
|
||||
utilReadDataMem(data, flashSaveData3);
|
||||
}
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
|
||||
#ifdef __LIBRETRO__
|
||||
extern void flashSaveGame(uint8_t*& data);
|
||||
extern void flashReadGame(const uint8_t*& data, int);
|
||||
extern void flashReadGame(const uint8_t*& data);
|
||||
#else
|
||||
extern void flashSaveGame(gzFile _gzFile);
|
||||
extern void flashReadGame(gzFile _gzFile, int version);
|
||||
|
|
|
@ -578,7 +578,7 @@ void CPUUpdateRenderBuffers(bool force)
|
|||
#ifdef __LIBRETRO__
|
||||
#include <stddef.h>
|
||||
|
||||
unsigned int CPUWriteState(uint8_t* data, unsigned size)
|
||||
unsigned int CPUWriteState(uint8_t* data)
|
||||
{
|
||||
uint8_t* orig = data;
|
||||
|
||||
|
@ -608,12 +608,7 @@ unsigned int CPUWriteState(uint8_t* data, unsigned size)
|
|||
return (ptrdiff_t)data - (ptrdiff_t)orig;
|
||||
}
|
||||
|
||||
bool CPUWriteMemState(char* memory, int available, long& reserved)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
bool CPUReadState(const uint8_t* data, unsigned size)
|
||||
bool CPUReadState(const uint8_t* data)
|
||||
{
|
||||
// Don't really care about version.
|
||||
int version = utilReadIntMem(data);
|
||||
|
@ -650,9 +645,9 @@ bool CPUReadState(const uint8_t* data, unsigned size)
|
|||
utilReadMem(pix, data, SIZE_PIX);
|
||||
utilReadMem(ioMem, data, SIZE_IOMEM);
|
||||
|
||||
eepromReadGame(data, version);
|
||||
flashReadGame(data, version);
|
||||
soundReadGame(data, version);
|
||||
eepromReadGame(data);
|
||||
flashReadGame(data);
|
||||
soundReadGame(data);
|
||||
rtcReadGame(data);
|
||||
|
||||
//// Copypasta stuff ...
|
||||
|
@ -1259,6 +1254,7 @@ bool CPUReadBatteryFile(const char* fileName)
|
|||
return true;
|
||||
}
|
||||
|
||||
#ifndef __LIBRETRO__
|
||||
bool CPUWritePNGFile(const char* fileName)
|
||||
{
|
||||
return utilWritePNGFile(fileName, 240, 160, pix);
|
||||
|
@ -1268,6 +1264,7 @@ bool CPUWriteBMPFile(const char* fileName)
|
|||
{
|
||||
return utilWriteBMPFile(fileName, 240, 160, pix);
|
||||
}
|
||||
#endif /* !__LIBRETRO__ */
|
||||
|
||||
bool CPUIsZipFile(const char* file)
|
||||
{
|
||||
|
@ -4251,6 +4248,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
|
||||
|
@ -4259,18 +4266,15 @@ struct EmulatedSystem GBASystem = {
|
|||
CPUReadState,
|
||||
// emuWriteState
|
||||
CPUWriteState,
|
||||
// emuReadMemState
|
||||
#ifdef __LIBRETRO__
|
||||
NULL,
|
||||
#else
|
||||
// emuReadMemState
|
||||
CPUReadMemState,
|
||||
#endif
|
||||
// emuWriteMemState
|
||||
CPUWriteMemState,
|
||||
// emuWritePNG
|
||||
CPUWritePNGFile,
|
||||
// emuWriteBMP
|
||||
CPUWriteBMPFile,
|
||||
#endif
|
||||
// emuUpdateCPSR
|
||||
CPUUpdateCPSR,
|
||||
// emuHasDebugger
|
||||
|
|
|
@ -136,7 +136,7 @@ extern void CPUUpdateRenderBuffers(bool);
|
|||
extern bool CPUReadMemState(char*, int);
|
||||
extern bool CPUWriteMemState(char*, int);
|
||||
#ifdef __LIBRETRO__
|
||||
extern bool CPUReadState(const uint8_t*, unsigned);
|
||||
extern bool CPUReadState(const uint8_t*);
|
||||
extern unsigned int CPUWriteState(uint8_t* data, unsigned int size);
|
||||
#else
|
||||
extern bool CPUReadState(const char*);
|
||||
|
|
|
@ -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, int version)
|
||||
#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__
|
||||
|
|
|
@ -78,7 +78,7 @@ extern int soundTicks;
|
|||
// Saves/loads emulator state
|
||||
#ifdef __LIBRETRO__
|
||||
void soundSaveGame(uint8_t*&);
|
||||
void soundReadGame(const uint8_t*& in, int version);
|
||||
void soundReadGame(const uint8_t*& in);
|
||||
#else
|
||||
void soundSaveGame(gzFile);
|
||||
void soundReadGame(gzFile, int version);
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -43,11 +43,6 @@ bool cpuIsMultiBoot = false;
|
|||
const char* loadDotCodeFile;
|
||||
const char* saveDotCodeFile;
|
||||
|
||||
bool utilWritePNGFile(const char* fileName, int w, int h, uint8_t* pix)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
void utilPutDword(uint8_t* p, uint32_t value)
|
||||
{
|
||||
*p++ = value & 255;
|
||||
|
@ -62,11 +57,6 @@ void utilPutWord(uint8_t* p, uint16_t value)
|
|||
*p = (value >> 8) & 255;
|
||||
}
|
||||
|
||||
bool utilWriteBMPFile(const char* fileName, int w, int h, uint8_t* pix)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
extern bool cpuIsMultiBoot;
|
||||
|
||||
bool utilIsGBAImage(const char* file)
|
||||
|
|
|
@ -48,6 +48,7 @@ static retro_input_poll_t poll_cb;
|
|||
static retro_input_state_t input_cb;
|
||||
static retro_environment_t environ_cb;
|
||||
static retro_set_rumble_state_t rumble_cb;
|
||||
static retro_audio_sample_t audio_cb;
|
||||
retro_audio_sample_batch_t audio_batch_cb;
|
||||
|
||||
static char retro_system_directory[2048];
|
||||
|
@ -375,6 +376,7 @@ void retro_set_video_refresh(retro_video_refresh_t cb)
|
|||
|
||||
void retro_set_audio_sample(retro_audio_sample_t cb)
|
||||
{
|
||||
audio_cb = cb;
|
||||
}
|
||||
|
||||
void retro_set_audio_sample_batch(retro_audio_sample_batch_t cb)
|
||||
|
@ -1436,14 +1438,14 @@ size_t retro_serialize_size(void)
|
|||
bool retro_serialize(void* data, size_t size)
|
||||
{
|
||||
if (size == serialize_size)
|
||||
return core->emuWriteState((uint8_t*)data, size);
|
||||
return core->emuWriteState((uint8_t*)data);
|
||||
return false;
|
||||
}
|
||||
|
||||
bool retro_unserialize(const void* data, size_t size)
|
||||
{
|
||||
if (size == serialize_size)
|
||||
return core->emuReadState((uint8_t*)data, size);
|
||||
return core->emuReadState((uint8_t*)data);
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -1676,7 +1678,7 @@ bool retro_load_game(const struct retro_game_info *game)
|
|||
update_input_descriptors(); // Initialize input descriptors and info
|
||||
update_variables(false);
|
||||
uint8_t* state_buf = (uint8_t*)malloc(2000000);
|
||||
serialize_size = core->emuWriteState(state_buf, 2000000);
|
||||
serialize_size = core->emuWriteState(state_buf);
|
||||
free(state_buf);
|
||||
|
||||
emulating = 1;
|
||||
|
|
Loading…
Reference in New Issue