Wrap functions unused by LIBRETRO

This commit is contained in:
negativeExponent 2022-10-07 14:21:29 +08:00
parent 7c25d64d69
commit 3158b73d69
8 changed files with 25 additions and 17 deletions

View File

@ -175,6 +175,7 @@ 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
@ -297,6 +298,7 @@ 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)
{ {
@ -312,6 +314,7 @@ void utilPutWord(uint8_t *p, uint16_t value)
*p = (value >> 8) & 255; *p = (value >> 8) & 255;
} }
#ifndef __LIBRETRO__
bool utilWriteBMPFile(const char *fileName, int w, int h, uint8_t *pix) bool utilWriteBMPFile(const char *fileName, int w, int h, uint8_t *pix)
{ {
uint8_t writeBuffer[512 * 3]; uint8_t writeBuffer[512 * 3];
@ -430,6 +433,7 @@ bool utilWriteBMPFile(const char *fileName, int w, int h, uint8_t *pix)
return true; return true;
} }
#endif /* !__LIBRETRO__ */
extern bool cpuIsMultiBoot; extern bool cpuIsMultiBoot;

View File

@ -26,8 +26,10 @@ std::string get_xdg_user_config_home();
std::string get_xdg_user_data_home(); std::string get_xdg_user_data_home();
void utilReadScreenPixels(uint8_t *dest, int w, int h); void utilReadScreenPixels(uint8_t *dest, int w, int h);
#ifndef __LIBRETRO__
bool utilWritePNGFile(const char *, int, int, uint8_t *); bool utilWritePNGFile(const char *, int, int, uint8_t *);
bool utilWriteBMPFile(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); void utilApplyIPS(const char *ips, uint8_t **rom, int *size);
bool utilIsGBAImage(const char *); bool utilIsGBAImage(const char *);
bool utilIsGBImage(const char *); bool utilIsGBImage(const char *);

View File

@ -4064,7 +4064,6 @@ bool gbReadSaveState(const char* name)
return res; return res;
} }
#endif // !__LIBRETRO__
bool gbWritePNGFile(const char* fileName) bool gbWritePNGFile(const char* fileName)
{ {
@ -4079,6 +4078,7 @@ bool gbWriteBMPFile(const char* fileName)
return utilWriteBMPFile(fileName, 256, 224, pix); return utilWriteBMPFile(fileName, 256, 224, pix);
return utilWriteBMPFile(fileName, 160, 144, pix); return utilWriteBMPFile(fileName, 160, 144, pix);
} }
#endif // !__LIBRETRO__
void gbCleanUp() void gbCleanUp()
{ {
@ -5841,10 +5841,15 @@ 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
// emuUpdateCPSR // emuUpdateCPSR
NULL, NULL,
// emuHasDebugger // emuHasDebugger

View File

@ -2823,9 +2823,9 @@ static uint8_t cheatsGetType(uint32_t address)
} }
#endif #endif
#ifdef BKPT_SUPPORT
void cheatsWriteMemory(uint32_t address, uint32_t value) void cheatsWriteMemory(uint32_t address, uint32_t value)
{ {
#ifdef BKPT_SUPPORT
if (cheatsNumber == 0) { if (cheatsNumber == 0) {
int type = cheatsGetType(address); int type = cheatsGetType(address);
uint32_t oldValue = debuggerReadMemory(address); uint32_t oldValue = debuggerReadMemory(address);
@ -2835,12 +2835,10 @@ void cheatsWriteMemory(uint32_t address, uint32_t value)
} }
debuggerWriteMemory(address, value); debuggerWriteMemory(address, value);
} }
#endif
} }
void cheatsWriteHalfWord(uint32_t address, uint16_t value) void cheatsWriteHalfWord(uint32_t address, uint16_t value)
{ {
#ifdef BKPT_SUPPORT
if (cheatsNumber == 0) { if (cheatsNumber == 0) {
int type = cheatsGetType(address); int type = cheatsGetType(address);
uint16_t oldValue = debuggerReadHalfWord(address); uint16_t oldValue = debuggerReadHalfWord(address);
@ -2850,12 +2848,10 @@ void cheatsWriteHalfWord(uint32_t address, uint16_t value)
} }
debuggerWriteHalfWord(address, value); debuggerWriteHalfWord(address, value);
} }
#endif
} }
void cheatsWriteByte(uint32_t address, uint8_t value) void cheatsWriteByte(uint32_t address, uint8_t value)
{ {
#ifdef BKPT_SUPPORT
if (cheatsNumber == 0) { if (cheatsNumber == 0) {
int type = cheatsGetType(address); int type = cheatsGetType(address);
uint8_t oldValue = debuggerReadByte(address); uint8_t oldValue = debuggerReadByte(address);
@ -2865,5 +2861,5 @@ void cheatsWriteByte(uint32_t address, uint8_t value)
} }
debuggerWriteByte(address, value); debuggerWriteByte(address, value);
} }
#endif
} }
#endif

View File

@ -33,9 +33,11 @@ void cheatsReadGameSkip(gzFile file, int version);
void cheatsSaveCheatList(const char* file); void cheatsSaveCheatList(const char* file);
bool cheatsLoadCheatList(const char* file); bool cheatsLoadCheatList(const char* file);
#endif #endif
#ifdef BKPT_SUPPORT
void cheatsWriteMemory(uint32_t address, uint32_t value); void cheatsWriteMemory(uint32_t address, uint32_t value);
void cheatsWriteHalfWord(uint32_t address, uint16_t value); void cheatsWriteHalfWord(uint32_t address, uint16_t value);
void cheatsWriteByte(uint32_t address, uint8_t value); void cheatsWriteByte(uint32_t address, uint8_t value);
#endif
int cheatsCheckKeys(uint32_t keys, uint32_t extended); int cheatsCheckKeys(uint32_t keys, uint32_t extended);
extern int cheatsNumber; extern int cheatsNumber;

View File

@ -1259,6 +1259,7 @@ bool CPUReadBatteryFile(const char* fileName)
return true; return true;
} }
#ifndef __LIBRETRO__
bool CPUWritePNGFile(const char* fileName) bool CPUWritePNGFile(const char* fileName)
{ {
return utilWritePNGFile(fileName, 240, 160, pix); return utilWritePNGFile(fileName, 240, 160, pix);
@ -1268,6 +1269,7 @@ bool CPUWriteBMPFile(const char* fileName)
{ {
return utilWriteBMPFile(fileName, 240, 160, pix); return utilWriteBMPFile(fileName, 240, 160, pix);
} }
#endif /* !__LIBRETRO__ */
bool CPUIsZipFile(const char* file) bool CPUIsZipFile(const char* file)
{ {
@ -4266,10 +4268,15 @@ struct EmulatedSystem GBASystem = {
#endif #endif
// emuWriteMemState // emuWriteMemState
CPUWriteMemState, CPUWriteMemState,
#ifdef __LIBRETRO__
NULL, // emuWritePNG
NULL, // emuWriteBMP
#else
// emuWritePNG // emuWritePNG
CPUWritePNGFile, CPUWritePNGFile,
// emuWriteBMP // emuWriteBMP
CPUWriteBMPFile, CPUWriteBMPFile,
#endif
// emuUpdateCPSR // emuUpdateCPSR
CPUUpdateCPSR, CPUUpdateCPSR,
// emuHasDebugger // emuHasDebugger

View File

@ -43,11 +43,6 @@ bool cpuIsMultiBoot = false;
const char* loadDotCodeFile; const char* loadDotCodeFile;
const char* saveDotCodeFile; 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) void utilPutDword(uint8_t* p, uint32_t value)
{ {
*p++ = value & 255; *p++ = value & 255;
@ -62,11 +57,6 @@ void utilPutWord(uint8_t* p, uint16_t value)
*p = (value >> 8) & 255; *p = (value >> 8) & 255;
} }
bool utilWriteBMPFile(const char* fileName, int w, int h, uint8_t* pix)
{
return false;
}
extern bool cpuIsMultiBoot; extern bool cpuIsMultiBoot;
bool utilIsGBAImage(const char* file) bool utilIsGBAImage(const char* file)

View File

@ -48,6 +48,7 @@ static retro_input_poll_t poll_cb;
static retro_input_state_t input_cb; static retro_input_state_t input_cb;
static retro_environment_t environ_cb; static retro_environment_t environ_cb;
static retro_set_rumble_state_t rumble_cb; static retro_set_rumble_state_t rumble_cb;
static retro_audio_sample_t audio_cb;
retro_audio_sample_batch_t audio_batch_cb; retro_audio_sample_batch_t audio_batch_cb;
static char retro_system_directory[2048]; 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) 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) void retro_set_audio_sample_batch(retro_audio_sample_batch_t cb)