Merge remote-tracking branch 'libretro/master'

Signed-off-by: Rafael Kitover <rkitover@gmail.com>
This commit is contained in:
Rafael Kitover 2022-11-18 00:24:23 +00:00
commit 8f1b5dae90
No known key found for this signature in database
GPG Key ID: 08AB596679D86240
31 changed files with 2004 additions and 497 deletions

View File

@ -24,9 +24,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 *);

View File

@ -307,6 +307,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];
@ -425,6 +426,7 @@ bool utilWriteBMPFile(const char *fileName, int w, int h, uint8_t *pix)
return true;
}
#endif /* !__LIBRETRO__ */
extern bool cpuIsMultiBoot;

View File

@ -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 *);

View File

@ -218,6 +218,7 @@ void Gb_Apu::run_until_( blip_time_t end_time )
case 6:
// 128 Hz
square1.clock_sweep();
/* fallthrough */
case 0:
case 4:
// 256 Hz

View File

@ -1582,7 +1582,7 @@ void gbWriteMemory(uint16_t address, uint8_t value)
}
inBios = false;
}
}
} break;
// HDMA1
case 0x51: {
@ -1776,7 +1776,7 @@ void gbWriteMemory(uint16_t address, uint8_t value)
gbMemory[0xff70] = register_SVBK = value;
return;
}
}
} break;
case 0x75: {
gbMemory[0xff75] = 0x8f | value;
@ -4093,7 +4093,6 @@ bool gbReadSaveState(const char* name)
return res;
}
#endif // !__LIBRETRO__
bool gbWritePNGFile(const char* fileName)
{
@ -4108,6 +4107,7 @@ bool gbWriteBMPFile(const char* fileName)
return utilWriteBMPFile(fileName, 256, 224, pix);
return utilWriteBMPFile(fileName, 160, 144, pix);
}
#endif // !__LIBRETRO__
void gbCleanUp()
{
@ -5521,7 +5521,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;
@ -5589,7 +5589,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);
@ -5654,7 +5654,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
}
@ -5796,7 +5796,7 @@ bool gbReadSaveState(const uint8_t* data, unsigned)
gbMemoryMap[0x0d] = &gbWram[value * 0x1000];
}
gbSoundReadGame(data, version);
gbSoundReadGame(data);
if (gbCgbMode && gbSgbMode) {
gbSgbMode = 0;
@ -5829,27 +5829,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
@ -5858,6 +5838,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
@ -5874,6 +5864,7 @@ struct EmulatedSystem GBSystem = {
gbWritePNGFile,
// emuWriteBMP
gbWriteBMPFile,
#endif /* ! __LIBRETRO__ */
// emuUpdateCPSR
NULL,
// emuHasDebugger

View File

@ -99,7 +99,7 @@ void gbCheatsReadGameSkip(gzFile gzFile, int version)
}
}
}
#endif
#endif /* __LIBRETRO__ */
void gbCheatsSaveCheatList(const char* file)
{

View File

@ -1016,7 +1016,8 @@ mapperHuC3RTC gbRTCHuC3 = {
0, // DateTime
0, // WritingTime
0, // ModeFlag
0 // ClockShift
0, // ClockShift
{ 0 }
};
void memoryUpdateHuC3Latch() {

View 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);

View File

@ -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);

View 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, 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__

View File

@ -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);

View File

@ -1086,10 +1086,11 @@ int cheatsCheckKeys(uint32_t keys, uint32_t extended)
break;
case GSA_32_BIT_WRITE_IOREGS:
if (cheatsList[i].address <= 0x3FF) {
if (((cheatsList[i].address & 0x3FC) != 0x6) && ((cheatsList[i].address & 0x3FC) != 0x130))
ioMem[cheatsList[i].address & 0x3FC] = (cheatsList[i].value & 0xFFFF);
if ((((cheatsList[i].address & 0x3FC) + 2) != 0x6) && ((cheatsList[i].address & 0x3FC) + 2) != 0x130)
ioMem[(cheatsList[i].address & 0x3FC) + 2] = ((cheatsList[i].value >> 16) & 0xFFFF);
uint32_t cheat_addr = cheatsList[i].address & 0x3FC;
if ((cheat_addr != 6) && (cheat_addr != 0x130))
ioMem[cheat_addr] = (cheatsList[i].value & 0xFFFF);
if (((cheat_addr + 2) != 0x6) && (cheat_addr + 2) != 0x130)
ioMem[cheat_addr + 2] = ((cheatsList[i].value >> 16) & 0xFFFF);
}
break;
case GSA_8_BIT_IF_TRUE3:
@ -1352,6 +1353,7 @@ void cheatsDelete(int number, bool restore)
} else {
CPUWriteMemory(cheatsList[x].address, cheatsList[x].oldValue);
}
/* fallthrough */
case GSA_16_BIT_ROM_PATCH:
if (cheatsList[x].status & 1) {
cheatsList[x].status &= ~1;
@ -2823,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);
@ -2835,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);
@ -2850,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);
@ -2865,5 +2863,5 @@ void cheatsWriteByte(uint32_t address, uint8_t value)
}
debuggerWriteByte(address, value);
}
#endif
}
#endif

View File

@ -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;

View File

@ -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__

View File

@ -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);

View File

@ -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);
}

View File

@ -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);

View File

@ -595,7 +595,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;
@ -625,12 +625,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);
@ -667,9 +662,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 ...
@ -1276,6 +1271,7 @@ bool CPUReadBatteryFile(const char* fileName)
return true;
}
#ifndef __LIBRETRO__
bool CPUWritePNGFile(const char* fileName)
{
return utilWritePNGFile(fileName, 240, 160, pix);
@ -1285,6 +1281,7 @@ bool CPUWriteBMPFile(const char* fileName)
{
return utilWriteBMPFile(fileName, 240, 160, pix);
}
#endif /* !__LIBRETRO__ */
bool CPUIsZipFile(const char* file)
{
@ -2290,7 +2287,8 @@ void CPUSoftwareInterrupt(int comment)
break;
case 0x2A:
BIOS_SndDriverJmpTableCopy();
// let it go, because we don't really emulate this function
// let it go, because we don't really emulate this function
/* fallthrough */
default:
#ifdef GBA_LOGGING
if (systemVerbose & VERBOSE_SWI) {
@ -4284,6 +4282,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
@ -4292,18 +4300,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

View File

@ -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*);

View File

@ -155,7 +155,7 @@ static inline uint32_t CPUReadMemory(uint32_t address)
value = flashRead(address) * 0x01010101;
break;
}
// default
/* fallthrough */
default:
unreadable:
#ifdef GBA_LOGGING
@ -305,8 +305,7 @@ static inline uint32_t CPUReadHalfWord(uint32_t address)
value = flashRead(address) * 0x0101;
break;
}
break;
// default
/* fallthrough */
default:
unreadable:
if (cpuDmaHack) {
@ -432,7 +431,7 @@ static inline uint8_t CPUReadByte(uint32_t address)
case 0x8500:
return DowncastU8(systemGetSensorY() >> 8);
}
// default
/* fallthrough */
default:
unreadable:
#ifdef GBA_LOGGING
@ -652,7 +651,7 @@ static inline void CPUWriteHalfWord(uint32_t address, uint16_t value)
(*cpuSaveGameFunc)(address, (uint8_t)value);
break;
}
// fallthrough
/* fallthrough */
default:
unwritable:
#ifdef GBA_LOGGING

View File

@ -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()
{
@ -733,25 +736,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)
{
@ -801,31 +796,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__

View File

@ -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);

View File

@ -1194,14 +1194,14 @@ static void BIOS_SndDriver_b4c(uint32_t r0, uint32_t r1, uint32_t r2) // 0xb4c
static int32_t BIOS_SndDriver_3e4(uint32_t const r0a, uint32_t const r1a) // 0x3e4
{
int32_t r0 = r1a;
int32_t r1 = r0a;
int32_t r0 = (int32_t)r1a;
int32_t r1 = (int32_t)r0a;
uint32_t v5 = r0 & 0x80000000;
int32_t r12;
int32_t r2;
bool gtr;
if ((r1 & 0x80000000 & 0x80000000) != 0)
if ((r1 & 0x80000000) != 0)
r1 = -r1;
r12 = r0; //v5 ^ (r0 >> 32);
if (r0 < 0)
@ -1209,8 +1209,9 @@ static int32_t BIOS_SndDriver_3e4(uint32_t const r0a, uint32_t const r1a) // 0x3
r2 = r1;
do {
gtr = (r2 >= r0 >> 1);
if (r2 <= r0 >> 1)
int32_t r0_rsh = ((uint32_t)r0 >> 1);
gtr = (r2 >= r0_rsh);
if (r2 <= r0_rsh)
r2 *= 2;
} while (!gtr);
@ -1220,13 +1221,13 @@ static int32_t BIOS_SndDriver_3e4(uint32_t const r0a, uint32_t const r1a) // 0x3
r0 -= r2;
if (r2 == r1)
break;
r2 >>= 1;
r2 = ((uint32_t)r2 >> 1);
}
if ((r12 << 1) == 0)
return 0 - v5;
else
return v5;
return -v5;
return v5;
}
static void BIOS_SndDriverSub1(uint32_t p1) // 0x170a

View File

@ -456,7 +456,7 @@ void BIOS_EReader_ScanCard(int swi_num)
THUMB_PREFETCH
} else if ((swi_num == 0xE3) || (swi_num == 0xE5)) //Dotcode data
{
if (reg[0].I <= 0x10) {
if (((int)reg[0].I >= 0) && (reg[0].I <= 0x10)) {
if (decodestate == 0) {
for (i = 0x17; i >= 0; i--) {
if ((0x17 - i) < 8)

View File

@ -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

View File

@ -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)

File diff suppressed because it is too large Load Diff

View File

@ -1,4 +1,4 @@
/* Copyright (C) 2010-2018 The RetroArch team
/* Copyright (C) 2010-2020 The RetroArch team
*
* ---------------------------------------------------------------------------------------
* The following license statement only applies to this file (retro_inline.h).

View 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];
@ -59,7 +60,6 @@ static bool option_sndInterpolation = true;
static bool option_useBios = false;
static bool option_colorizerHack = false;
static bool option_forceRTCenable = false;
static bool option_showAdvancedOptions = false;
static double option_sndFiltering = 0.5;
static unsigned option_gbPalette = 0;
static bool option_lcdfilter = false;
@ -376,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)
@ -510,7 +511,8 @@ void retro_set_controller_port_device(unsigned port, unsigned device)
void retro_set_environment(retro_environment_t cb)
{
environ_cb = cb;
libretro_set_core_options(environ_cb);
bool categoriesSupported;
libretro_set_core_options(environ_cb, &categoriesSupported);
}
void retro_get_system_info(struct retro_system_info *info)
@ -970,7 +972,7 @@ static bool option_swapAnalogSticks;
static void update_variables(bool startup)
{
struct retro_variable var = {0};
struct retro_variable var = { NULL, NULL };
char key[256] = {0};
int disabled_layers = 0;
int sound_enabled = 0x30F;
@ -1205,39 +1207,6 @@ static void update_variables(bool startup)
else
ifb_filter_func = NULL;
var.key = "vbam_show_advanced_options";
var.value = NULL;
if (environ_cb(RETRO_ENVIRONMENT_GET_VARIABLE, &var) && var.value) {
bool newval = (!strcmp(var.value, "enabled")) ? true : false;
if ((option_showAdvancedOptions != newval) || startup) {
option_showAdvancedOptions = newval;
struct retro_core_option_display option_display;
unsigned i;
char options[][13] = {
"vbam_sound_1",
"vbam_sound_2",
"vbam_sound_3",
"vbam_sound_4",
"vbam_sound_5",
"vbam_sound_6",
"vbam_layer_1",
"vbam_layer_2",
"vbam_layer_3",
"vbam_layer_4",
"vbam_layer_5",
"vbam_layer_6",
"vbam_layer_7",
"vbam_layer_8"
};
option_display.visible = option_showAdvancedOptions;
for (i = 0; i < (sizeof(options) / sizeof(options[0])); i++) {
option_display.key = options[i];
environ_cb(RETRO_ENVIRONMENT_SET_CORE_OPTIONS_DISPLAY, &option_display);
}
}
}
// Hide some core options depending on rom image type
if (startup) {
unsigned i;
@ -1469,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;
}
@ -1709,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;

View File

@ -13,9 +13,10 @@
/*
********************************
* VERSION: 1.3
* VERSION: 2.0
********************************
*
* - 2.0: Add support for core options v2 interface
* - 1.3: Move translations to libretro_core_options_intl.h
* - libretro_core_options_intl.h includes BOM and utf-8
* fix for MSVC 2010-2013
@ -48,31 +49,43 @@ extern "C" {
* - Will be used as a fallback for any missing entries in
* frontend language definition */
struct retro_core_option_definition option_defs_us[] = {
{
"vbam_solarsensor",
"Solar Sensor Level",
"Adjusts simulated solar level in Boktai games. L2/R2 buttons can also be used to quickly change levels.",
{
{ "0", NULL },
{ "1", NULL },
{ "2", NULL },
{ "3", NULL },
{ "4", NULL },
{ "5", NULL },
{ "6", NULL },
{ "7", NULL },
{ "8", NULL },
{ "9", NULL },
{ "10", NULL },
{ NULL, NULL },
},
"0"
},
struct retro_core_option_v2_category option_cats_us[] = {
{
"system",
"System",
"Configure system options."
},
{
"video",
"Video",
"Configure video options."
},
{
"audio",
"Audio",
"Configure audio options."
},
{
"input",
"Input",
"Configure input options."
},
{
"advanced",
"Advanced options",
"Configure advanced options which can enable or disable sound channels and graphics layers."
},
{ NULL, NULL, NULL },
};
struct retro_core_option_v2_definition option_defs_us[] = {
{
"vbam_usebios",
"Use Official BIOS (If Available)",
NULL,
"Use official BIOS when available. Core needs to be restarted for changes to apply.",
NULL,
"system",
{
{ "disabled", NULL },
{ "enabled", NULL },
@ -83,7 +96,10 @@ struct retro_core_option_definition option_defs_us[] = {
{
"vbam_forceRTCenable",
"Force-Enable RTC",
NULL,
"Forces the internal real-time clock to be enabled regardless of rom. Usuable for rom patches that requires clock to be enabled (aka Pokemon).",
NULL,
"system",
{
{ "disabled", NULL },
{ "enabled", NULL },
@ -91,10 +107,124 @@ struct retro_core_option_definition option_defs_us[] = {
},
"disabled"
},
{
"vbam_gbHardware",
"(GB) Emulated Hardware (Needs Restart)",
NULL,
"Sets the Game Boy hardware type to emulate. Restart core to apply.",
NULL,
"system",
{
{ "gbc", "Game Boy Color" },
{ "auto", "Automatic" },
{ "sgb", "Super Game Boy" },
{ "gb", "Game Boy" },
{ "gba", "Game Boy Advance" },
{ "sgb2", "Super Game Boy 2" },
{ NULL, NULL },
},
"gbc"
},
{
"vbam_allowcolorizerhack",
"(GB) Enable Colorizer Hack (Needs Restart)",
NULL,
"Allows Colorizer hacked GB games (e.g. DX patched games) to normally run in GBC/GBA hardware type. This also disables the use of bios file. NOT RECOMMENDED for use on non-colorized games.",
NULL,
"system",
{
{ "disabled", NULL },
{ "enabled", NULL },
{ NULL, NULL },
},
"disabled"
},
{
"vbam_palettes",
"(GB) Color Palette",
NULL,
"Set Game Boy palettes to use.",
NULL,
"video",
{
{ "black and white", NULL },
{ "blue sea", NULL },
{ "dark knight", NULL },
{ "green forest", NULL },
{ "hot desert", NULL },
{ "pink dreams", NULL },
{ "wierd colors", NULL },
{ "original gameboy", NULL },
{ "gba sp", NULL },
{ NULL, NULL },
},
"standard"
},
{
"vbam_showborders",
"(GB) Show Borders",
NULL,
"When enabled, if loaded content is SGB compatible, this will show the border from the game if available.",
NULL,
"video",
{
{ "disabled", NULL },
{ "enabled", NULL },
{ "auto", NULL },
{ NULL, NULL },
},
"disabled"
},
{
"vbam_gbcoloroption",
"(GB) Color Correction",
NULL,
"Applies color correction which fixes colors in some games.",
NULL,
"video",
{
{ "disabled", NULL },
{ "enabled", NULL },
{ NULL, NULL },
},
"disabled"
},
{
"vbam_lcdfilter",
"LCD Color Filter",
NULL,
"Darkens the onscreen colors by applying a screen filter.",
NULL,
"video",
{
{ "disabled", NULL },
{ "enabled", NULL },
{ NULL, NULL },
},
"disabled"
},
{
"vbam_interframeblending",
"Interframe Blending",
NULL,
"Simulates LCD ghosting effects. 'Smart' attempts to detect screen flickering, and only performs a 50:50 mix on affected pixels, while 'Motion Blur' mimics natural LCD response times by combining multiple buffered frames. 'Smart' blending is required when playing games that aggressively exploit LCD ghosting for transparency effects (Wave Race, Chikyuu Kaihou Gun ZAS, F-Zero, the Boktai series...).",
NULL,
"video",
{
{ "disabled", NULL },
{ "smart", "Smart" },
{ "motion blur", "Motion Blur" },
{ NULL, NULL },
},
"disabled"
},
{
"vbam_soundinterpolation",
"Sound Interpolation",
NULL,
"Enable or disable sound filtering.",
NULL,
"audio",
{
{ "disabled", NULL },
{ "enabled", NULL },
@ -105,7 +235,10 @@ struct retro_core_option_definition option_defs_us[] = {
{
"vbam_soundfiltering",
"Sound Filtering",
NULL,
"Sets the amount of filtering to use. Higher value reduces higher frequencies.",
NULL,
"audio",
{
{ "0", NULL },
{ "1", NULL },
@ -122,100 +255,13 @@ struct retro_core_option_definition option_defs_us[] = {
},
"5"
},
{
"vbam_palettes",
"(GB) Color Palette",
"Set Game Boy palettes to use.",
{
{ "black and white", NULL },
{ "blue sea", NULL },
{ "dark knight", NULL },
{ "green forest", NULL },
{ "hot desert", NULL },
{ "pink dreams", NULL },
{ "wierd colors", NULL },
{ "original gameboy", NULL },
{ "gba sp", NULL },
{ NULL, NULL },
},
"standard"
},
{
"vbam_gbHardware",
"(GB) Emulated Hardware (Needs Restart)",
"Sets the Game Boy hardware type to emulate. Restart core to apply.",
{
{ "gbc", "Game Boy Color" },
{ "auto", "Automatic" },
{ "sgb", "Super Game Boy" },
{ "gb", "Game Boy" },
{ "gba", "Game Boy Advance" },
{ "sgb2", "Super Game Boy 2" },
{ NULL, NULL },
},
"gbc"
},
{
"vbam_allowcolorizerhack",
"(GB) Enable Colorizer Hack (Needs Restart)",
"Allows Colorizer hacked GB games (e.g. DX patched games) to normally run in GBC/GBA hardware type. This also disables the use of bios file. NOT RECOMMENDED for use on non-colorized games.",
{
{ "disabled", NULL },
{ "enabled", NULL },
{ NULL, NULL },
},
"disabled"
},
{
"vbam_showborders",
"(GB) Show Borders",
"When enabled, if loaded content is SGB compatible, this will show the border from the game if available.",
{
{ "disabled", NULL },
{ "enabled", NULL },
{ "auto", NULL },
{ NULL, NULL },
},
"disabled"
},
{
"vbam_gbcoloroption",
"(GB) Color Correction",
"Applies color correction which fixes colors in some games.",
{
{ "disabled", NULL },
{ "enabled", NULL },
{ NULL, NULL },
},
"disabled"
},
{
"vbam_lcdfilter",
"LCD Color Filter",
"Darkens the onscreen colors by applying a screen filter.",
{
{ "disabled", NULL },
{ "enabled", NULL },
{ NULL, NULL },
},
"disabled"
},
{
"vbam_interframeblending",
"Interframe Blending",
"Simulates LCD ghosting effects. 'Smart' attempts to detect screen flickering, and only performs a 50:50 mix on affected pixels, while 'Motion Blur' mimics natural LCD response times by combining multiple buffered frames. 'Smart' blending is required when playing games that aggressively exploit LCD ghosting for transparency effects (Wave Race, Chikyuu Kaihou Gun ZAS, F-Zero, the Boktai series...).",
{
{ "disabled", NULL },
{ "smart", "Smart" },
{ "motion blur", "Motion Blur" },
{ NULL, NULL },
},
"disabled"
},
{
"vbam_turboenable",
"Enable Turbo Buttons",
NULL,
"Enable or disable gamepad turbo buttons.",
NULL,
"input",
{
{ "disabled", NULL },
{ "enabled", NULL },
@ -226,7 +272,10 @@ struct retro_core_option_definition option_defs_us[] = {
{
"vbam_turbodelay",
"Turbo Delay (in frames)",
NULL,
"Repeat rate of turbo triggers in frames. Higher value triggers more.",
NULL,
"input",
{
{ "1", NULL },
{ "2", NULL },
@ -247,10 +296,36 @@ struct retro_core_option_definition option_defs_us[] = {
},
"3"
},
{
"vbam_solarsensor",
"Solar Sensor Level",
NULL,
"Adjusts simulated solar level in Boktai games. L2/R2 buttons can also be used to quickly change levels.",
NULL,
"input",
{
{ "0", NULL },
{ "1", NULL },
{ "2", NULL },
{ "3", NULL },
{ "4", NULL },
{ "5", NULL },
{ "6", NULL },
{ "7", NULL },
{ "8", NULL },
{ "9", NULL },
{ "10", NULL },
{ NULL, NULL },
},
"0"
},
{
"vbam_astick_deadzone",
"Sensors Deadzone (%)",
NULL,
"Set deadzone (in percent) of analog sticks.",
NULL,
"input",
{
{ "0", NULL },
{ "5", NULL },
@ -266,7 +341,10 @@ struct retro_core_option_definition option_defs_us[] = {
{
"vbam_gyro_sensitivity",
"Sensor Sensitivity (Gyroscope) (%)",
NULL,
"Default bind is left analog. Used to adjust sensitivity level for gyro-enabled games.",
NULL,
"input",
{
{ "10", NULL },
{ "15", NULL },
@ -298,7 +376,10 @@ struct retro_core_option_definition option_defs_us[] = {
{
"vbam_tilt_sensitivity",
"Sensor Sensitivity (Tilt) (%)",
NULL,
"Default bind is right analog. Used to adjust sensitivity level for gyro-enabled games.",
NULL,
"input",
{
{ "10", NULL },
{ "15", NULL },
@ -330,18 +411,10 @@ struct retro_core_option_definition option_defs_us[] = {
{
"vbam_swap_astick",
"Swap Left/Right Analog",
NULL,
"Swaps left and right analog stick function for gyro and tilt.",
{
{ "disabled", NULL },
{ "enabled", NULL },
{ NULL, NULL },
},
"disabled"
},
{
"vbam_show_advanced_options",
"Show Advanced Options",
"Show advanced options which can enable or disable sound channels and graphics layers.",
NULL,
"input",
{
{ "disabled", NULL },
{ "enabled", NULL },
@ -352,7 +425,10 @@ struct retro_core_option_definition option_defs_us[] = {
{
"vbam_sound_1",
"Sound Channel 1",
NULL,
"Enables or disables tone & sweep sound channel.",
NULL,
"advanced",
{
{ "disabled", NULL },
{ "enabled", NULL },
@ -363,7 +439,10 @@ struct retro_core_option_definition option_defs_us[] = {
{
"vbam_sound_2",
"Sound Channel 2",
NULL,
"Enables or disables tone sound channel.",
NULL,
"advanced",
{
{ "disabled", NULL },
{ "enabled", NULL },
@ -374,7 +453,10 @@ struct retro_core_option_definition option_defs_us[] = {
{
"vbam_sound_3",
"Sound Channel 3",
NULL,
"Enables or disables wave output sound channel.",
NULL,
"advanced",
{
{ "disabled", NULL },
{ "enabled", NULL },
@ -385,7 +467,10 @@ struct retro_core_option_definition option_defs_us[] = {
{
"vbam_sound_4",
"Sound Channel 4",
NULL,
"Enables or disables noise audio channel.",
NULL,
"advanced",
{
{ "disabled", NULL },
{ "enabled", NULL },
@ -396,7 +481,10 @@ struct retro_core_option_definition option_defs_us[] = {
{
"vbam_sound_5",
"Sound DMA Channel A",
NULL,
"Enables or disables DMA sound channel A.",
NULL,
"advanced",
{
{ "disabled", NULL },
{ "enabled", NULL },
@ -407,7 +495,10 @@ struct retro_core_option_definition option_defs_us[] = {
{
"vbam_sound_6",
"Sound DMA Channel B",
NULL,
"Enables or disables DMA sound channel B.",
NULL,
"advanced",
{
{ "disabled", NULL },
{ "enabled", NULL },
@ -418,7 +509,10 @@ struct retro_core_option_definition option_defs_us[] = {
{
"vbam_layer_1",
"Show Background Layer 1",
NULL,
"Shows or hides background layer 1.",
NULL,
"advanced",
{
{ "disabled", NULL },
{ "enabled", NULL },
@ -429,7 +523,10 @@ struct retro_core_option_definition option_defs_us[] = {
{
"vbam_layer_2",
"Show Background Layer 2",
NULL,
"Shows or hides background layer 2.",
NULL,
"advanced",
{
{ "disabled", NULL },
{ "enabled", NULL },
@ -440,7 +537,10 @@ struct retro_core_option_definition option_defs_us[] = {
{
"vbam_layer_3",
"Show Background Layer 3",
NULL,
"Shows or hides background layer 3.",
NULL,
"advanced",
{
{ "disabled", NULL },
{ "enabled", NULL },
@ -451,7 +551,10 @@ struct retro_core_option_definition option_defs_us[] = {
{
"vbam_layer_4",
"Show Background Layer 4",
NULL,
"Shows or hides background layer 4.",
NULL,
"advanced",
{
{ "disabled", NULL },
{ "enabled", NULL },
@ -462,7 +565,10 @@ struct retro_core_option_definition option_defs_us[] = {
{
"vbam_layer_5",
"Show Sprite Layer",
NULL,
"Shows or hides sprite layer.",
NULL,
"advanced",
{
{ "disabled", NULL },
{ "enabled", NULL },
@ -473,7 +579,10 @@ struct retro_core_option_definition option_defs_us[] = {
{
"vbam_layer_6",
"Show Window Layer 1",
NULL,
"Shows or hides window layer 1.",
NULL,
"advanced",
{
{ "disabled", NULL },
{ "enabled", NULL },
@ -484,7 +593,10 @@ struct retro_core_option_definition option_defs_us[] = {
{
"vbam_layer_7",
"Show Window Layer 2",
NULL,
"Shows or hides window layer 2.",
NULL,
"advanced",
{
{ "disabled", NULL },
{ "enabled", NULL },
@ -495,7 +607,10 @@ struct retro_core_option_definition option_defs_us[] = {
{
"vbam_layer_8",
"Show Sprite Window Layer",
NULL,
"Shows or hides sprite window layer.",
NULL,
"advanced",
{
{ "disabled", NULL },
{ "enabled", NULL },
@ -503,8 +618,12 @@ struct retro_core_option_definition option_defs_us[] = {
},
"enabled"
},
{ NULL, NULL, NULL, NULL, NULL, NULL, { { NULL, NULL } }, NULL },
};
{ NULL, NULL, NULL, {{0}}, NULL }
struct retro_core_options_v2 options_us = {
option_cats_us,
option_defs_us
};
/*
@ -514,8 +633,8 @@ struct retro_core_option_definition option_defs_us[] = {
*/
#ifndef HAVE_NO_LANGEXTRA
struct retro_core_option_definition *option_defs_intl[RETRO_LANGUAGE_LAST] = {
option_defs_us, /* RETRO_LANGUAGE_ENGLISH */
struct retro_core_options_v2 *options_intl[RETRO_LANGUAGE_LAST] = {
&options_us, /* RETRO_LANGUAGE_ENGLISH */
NULL, /* RETRO_LANGUAGE_JAPANESE */
NULL, /* RETRO_LANGUAGE_FRENCH */
NULL, /* RETRO_LANGUAGE_SPANISH */
@ -533,7 +652,7 @@ struct retro_core_option_definition *option_defs_intl[RETRO_LANGUAGE_LAST] = {
NULL, /* RETRO_LANGUAGE_VIETNAMESE */
NULL, /* RETRO_LANGUAGE_ARABIC */
NULL, /* RETRO_LANGUAGE_GREEK */
option_defs_tr, /* RETRO_LANGUAGE_TURKISH */
&options_tr, /* RETRO_LANGUAGE_TURKISH */
};
#endif
@ -551,39 +670,61 @@ struct retro_core_option_definition *option_defs_intl[RETRO_LANGUAGE_LAST] = {
* be as painless as possible for core devs)
*/
static INLINE void libretro_set_core_options(retro_environment_t environ_cb)
static INLINE void libretro_set_core_options(retro_environment_t environ_cb,
bool *categories_supported)
{
unsigned version = 0;
unsigned version = 0;
#ifndef HAVE_NO_LANGEXTRA
unsigned language = 0;
#endif
if (!environ_cb)
if (!environ_cb || !categories_supported)
return;
if (environ_cb(RETRO_ENVIRONMENT_GET_CORE_OPTIONS_VERSION, &version) && (version >= 1))
*categories_supported = false;
if (!environ_cb(RETRO_ENVIRONMENT_GET_CORE_OPTIONS_VERSION, &version))
version = 0;
if (version >= 2)
{
#ifndef HAVE_NO_LANGEXTRA
struct retro_core_options_intl core_options_intl;
unsigned language = 0;
struct retro_core_options_v2_intl core_options_intl;
core_options_intl.us = option_defs_us;
core_options_intl.us = &options_us;
core_options_intl.local = NULL;
if (environ_cb(RETRO_ENVIRONMENT_GET_LANGUAGE, &language) &&
(language < RETRO_LANGUAGE_LAST) && (language != RETRO_LANGUAGE_ENGLISH))
core_options_intl.local = option_defs_intl[language];
core_options_intl.local = options_intl[language];
environ_cb(RETRO_ENVIRONMENT_SET_CORE_OPTIONS_INTL, &core_options_intl);
*categories_supported = environ_cb(RETRO_ENVIRONMENT_SET_CORE_OPTIONS_V2_INTL,
&core_options_intl);
#else
environ_cb(RETRO_ENVIRONMENT_SET_CORE_OPTIONS, &option_defs_us);
*categories_supported = environ_cb(RETRO_ENVIRONMENT_SET_CORE_OPTIONS_V2,
&options_us);
#endif
}
else
{
size_t i;
size_t i, j;
size_t option_index = 0;
size_t num_options = 0;
struct retro_core_option_definition
*option_v1_defs_us = NULL;
#ifndef HAVE_NO_LANGEXTRA
size_t num_options_intl = 0;
struct retro_core_option_v2_definition
*option_defs_intl = NULL;
struct retro_core_option_definition
*option_v1_defs_intl = NULL;
struct retro_core_options_intl
core_options_v1_intl;
#endif
struct retro_variable *variables = NULL;
char **values_buf = NULL;
/* Determine number of options */
/* Determine total number of options */
while (true)
{
if (option_defs_us[num_options].key)
@ -592,86 +733,187 @@ static INLINE void libretro_set_core_options(retro_environment_t environ_cb)
break;
}
/* Allocate arrays */
variables = (struct retro_variable *)calloc(num_options + 1, sizeof(struct retro_variable));
values_buf = (char **)calloc(num_options, sizeof(char *));
if (!variables || !values_buf)
goto error;
/* Copy parameters from option_defs_us array */
for (i = 0; i < num_options; i++)
if (version >= 1)
{
const char *key = option_defs_us[i].key;
const char *desc = option_defs_us[i].desc;
const char *default_value = option_defs_us[i].default_value;
struct retro_core_option_value *values = option_defs_us[i].values;
size_t buf_len = 3;
size_t default_index = 0;
/* Allocate US array */
option_v1_defs_us = (struct retro_core_option_definition *)
calloc(num_options + 1, sizeof(struct retro_core_option_definition));
values_buf[i] = NULL;
if (desc)
/* Copy parameters from option_defs_us array */
for (i = 0; i < num_options; i++)
{
size_t num_values = 0;
struct retro_core_option_v2_definition *option_def_us = &option_defs_us[i];
struct retro_core_option_value *option_values = option_def_us->values;
struct retro_core_option_definition *option_v1_def_us = &option_v1_defs_us[i];
struct retro_core_option_value *option_v1_values = option_v1_def_us->values;
/* Determine number of values */
option_v1_def_us->key = option_def_us->key;
option_v1_def_us->desc = option_def_us->desc;
option_v1_def_us->info = option_def_us->info;
option_v1_def_us->default_value = option_def_us->default_value;
/* Values must be copied individually... */
while (option_values->value)
{
option_v1_values->value = option_values->value;
option_v1_values->label = option_values->label;
option_values++;
option_v1_values++;
}
}
#ifndef HAVE_NO_LANGEXTRA
if (environ_cb(RETRO_ENVIRONMENT_GET_LANGUAGE, &language) &&
(language < RETRO_LANGUAGE_LAST) && (language != RETRO_LANGUAGE_ENGLISH) &&
options_intl[language])
option_defs_intl = options_intl[language]->definitions;
if (option_defs_intl)
{
/* Determine number of intl options */
while (true)
{
if (values[num_values].value)
{
/* Check if this is the default value */
if (default_value)
if (strcmp(values[num_values].value, default_value) == 0)
default_index = num_values;
buf_len += strlen(values[num_values].value);
num_values++;
}
if (option_defs_intl[num_options_intl].key)
num_options_intl++;
else
break;
}
/* Build values string */
if (num_values > 0)
/* Allocate intl array */
option_v1_defs_intl = (struct retro_core_option_definition *)
calloc(num_options_intl + 1, sizeof(struct retro_core_option_definition));
/* Copy parameters from option_defs_intl array */
for (i = 0; i < num_options_intl; i++)
{
size_t j;
struct retro_core_option_v2_definition *option_def_intl = &option_defs_intl[i];
struct retro_core_option_value *option_values = option_def_intl->values;
struct retro_core_option_definition *option_v1_def_intl = &option_v1_defs_intl[i];
struct retro_core_option_value *option_v1_values = option_v1_def_intl->values;
buf_len += num_values - 1;
buf_len += strlen(desc);
option_v1_def_intl->key = option_def_intl->key;
option_v1_def_intl->desc = option_def_intl->desc;
option_v1_def_intl->info = option_def_intl->info;
option_v1_def_intl->default_value = option_def_intl->default_value;
values_buf[i] = (char *)calloc(buf_len, sizeof(char));
if (!values_buf[i])
goto error;
strcpy(values_buf[i], desc);
strcat(values_buf[i], "; ");
/* Default value goes first */
strcat(values_buf[i], values[default_index].value);
/* Add remaining values */
for (j = 0; j < num_values; j++)
/* Values must be copied individually... */
while (option_values->value)
{
if (j != default_index)
{
strcat(values_buf[i], "|");
strcat(values_buf[i], values[j].value);
}
option_v1_values->value = option_values->value;
option_v1_values->label = option_values->label;
option_values++;
option_v1_values++;
}
}
}
variables[i].key = key;
variables[i].value = values_buf[i];
core_options_v1_intl.us = option_v1_defs_us;
core_options_v1_intl.local = option_v1_defs_intl;
environ_cb(RETRO_ENVIRONMENT_SET_CORE_OPTIONS_INTL, &core_options_v1_intl);
#else
environ_cb(RETRO_ENVIRONMENT_SET_CORE_OPTIONS, option_v1_defs_us);
#endif
}
else
{
/* Allocate arrays */
variables = (struct retro_variable *)calloc(num_options + 1,
sizeof(struct retro_variable));
values_buf = (char **)calloc(num_options, sizeof(char *));
if (!variables || !values_buf)
goto error;
/* Copy parameters from option_defs_us array */
for (i = 0; i < num_options; i++)
{
const char *key = option_defs_us[i].key;
const char *desc = option_defs_us[i].desc;
const char *default_value = option_defs_us[i].default_value;
struct retro_core_option_value *values = option_defs_us[i].values;
size_t buf_len = 3;
size_t default_index = 0;
values_buf[i] = NULL;
if (desc)
{
size_t num_values = 0;
/* Determine number of values */
while (true)
{
if (values[num_values].value)
{
/* Check if this is the default value */
if (default_value)
if (strcmp(values[num_values].value, default_value) == 0)
default_index = num_values;
buf_len += strlen(values[num_values].value);
num_values++;
}
else
break;
}
/* Build values string */
if (num_values > 0)
{
buf_len += num_values - 1;
buf_len += strlen(desc);
values_buf[i] = (char *)calloc(buf_len, sizeof(char));
if (!values_buf[i])
goto error;
strcpy(values_buf[i], desc);
strcat(values_buf[i], "; ");
/* Default value goes first */
strcat(values_buf[i], values[default_index].value);
/* Add remaining values */
for (j = 0; j < num_values; j++)
{
if (j != default_index)
{
strcat(values_buf[i], "|");
strcat(values_buf[i], values[j].value);
}
}
}
}
variables[option_index].key = key;
variables[option_index].value = values_buf[i];
option_index++;
}
/* Set variables */
environ_cb(RETRO_ENVIRONMENT_SET_VARIABLES, variables);
}
/* Set variables */
environ_cb(RETRO_ENVIRONMENT_SET_VARIABLES, variables);
error:
/* Clean up */
if (option_v1_defs_us)
{
free(option_v1_defs_us);
option_v1_defs_us = NULL;
}
#ifndef HAVE_NO_LANGEXTRA
if (option_v1_defs_intl)
{
free(option_v1_defs_intl);
option_v1_defs_intl = NULL;
}
#endif
if (values_buf)
{
for (i = 0; i < num_options; i++)

View File

@ -73,31 +73,43 @@ extern "C" {
/* RETRO_LANGUAGE_TURKISH */
struct retro_core_option_definition option_defs_tr[] = {
{
"vbam_solarsensor",
"Solar Sensör Seviyesi",
"Boktai oyunlarında simüle güneş seviyesini ayarlar. L2 / R2 düğmeleri ayrıca seviyeleri hızlıca değiştirmek için de kullanılabilir.",
{
{ "0", NULL },
{ "1", NULL },
{ "2", NULL },
{ "3", NULL },
{ "4", NULL },
{ "5", NULL },
{ "6", NULL },
{ "7", NULL },
{ "8", NULL },
{ "9", NULL },
{ "10", NULL },
{ NULL, NULL },
},
"0"
},
struct retro_core_option_v2_category option_cats_tr[] = {
{
"system",
NULL,
NULL,
},
{
"video",
NULL,
NULL,
},
{
"audio",
NULL,
NULL,
},
{
"input",
NULL,
NULL,
},
{
"advanced",
NULL,
NULL,
},
{ NULL, NULL, NULL },
};
struct retro_core_option_v2_definition option_defs_tr[] = {
{
"vbam_usebios",
"Resmi BIOS'u kullanın (Varsa)",
NULL,
"Mümkün olduğunda resmi BIOS kullanın. Değişikliklerin uygulanabilmesi için çekirdeğin yeniden başlatılması gerekiyor.",
NULL,
"system",
{
{ "disabled", NULL },
{ "enabled", NULL },
@ -108,7 +120,92 @@ struct retro_core_option_definition option_defs_tr[] = {
{
"vbam_forceRTCenable",
"RTC'yi Etkinleştir",
NULL,
"RAM'den bağımsız olarak dahili gerçek zamanlı saati etkinleştirmeye zorlar. Saatin etkinleştirilmesini gerektiren rom yamalar için kullanılabilir (Pokemon gibi).",
NULL,
"system",
{
{ "disabled", NULL },
{ "enabled", NULL },
{ NULL, NULL },
},
"disabled"
},
{
"vbam_gbHardware",
"(GB) Öykünülmüş Donanım (Yeniden Başlatılması Gerekiyor)",
NULL,
"Game Boy donanım tipini taklit edecek şekilde ayarlar. Uygulamak için çekirdeği yeniden başlatın.",
NULL,
"system",
{
{ "gbc", "Game Boy Color" },
{ "auto", "Automatic" },
{ "sgb", "Super Game Boy" },
{ "gb", "Game Boy" },
{ "gba", "Game Boy Advance" },
{ "sgb2", "Super Game Boy 2" },
{ NULL, NULL },
},
"gbc"
},
{
"vbam_allowcolorizerhack",
"(GB) Colorizer Hack'i Etkinleştir (Yeniden Başlatılması Gerekiyor)",
NULL,
"Colorizer'ın saldırıya uğramış GB oyunlarının (örn. DX yamalı oyunlar) normalde GBC / GBA donanım türünde çalışmasına izin verir. Bu ayrıca bios dosyasının kullanımını da devre dışı bırakır. Renklendirilmemiş oyunlarda kullanılması tavsiye edilmez.",
NULL,
"system",
{
{ "disabled", NULL },
{ "enabled", NULL },
{ NULL, NULL },
},
"disabled"
},
{
"vbam_palettes",
"(GB) Renk Paleti",
NULL,
"Game Boy paletlerini kullanmak için ayarlayın.",
NULL,
"video",
{
{ "black and white", NULL },
{ "blue sea", NULL },
{ "dark knight", NULL },
{ "green forest", NULL },
{ "hot desert", NULL },
{ "pink dreams", NULL },
{ "wierd colors", NULL },
{ "original gameboy", NULL },
{ "gba sp", NULL },
{ NULL, NULL },
},
"standard"
},
{
"vbam_showborders",
"(GB) Sınırları Göster",
NULL,
"Etkinleştirildiğinde, yüklü içerik SGB uyumluysa, bu durum oyundaki sınırı gösterir.",
NULL,
"video",
{
{ "disabled", NULL },
{ "enabled", NULL },
{ "auto", NULL },
{ NULL, NULL },
},
"disabled"
},
{
"vbam_gbcoloroption",
"(GB) Renk Düzeltme",
NULL,
"Bazı oyunlarda renkleri düzelten renk düzeltmesini uygular.",
NULL,
"video",
{
{ "disabled", NULL },
{ "enabled", NULL },
@ -119,7 +216,10 @@ struct retro_core_option_definition option_defs_tr[] = {
{
"vbam_soundinterpolation",
"Ses Enterpolasyonu",
NULL,
"Ses filtresini etkinleştirin veya devre dışı bırakın.",
NULL,
"audio",
{
{ "disabled", NULL },
{ "enabled", NULL },
@ -130,7 +230,10 @@ struct retro_core_option_definition option_defs_tr[] = {
{
"vbam_soundfiltering",
"Ses Filtreleme",
NULL,
"Kullanılacak filtreleme miktarını ayarlar. Yüksek değer, yüksek frekansları azaltır.",
NULL,
"audio",
{
{ "0", NULL },
{ "1", NULL },
@ -147,77 +250,13 @@ struct retro_core_option_definition option_defs_tr[] = {
},
"5"
},
{
"vbam_palettes",
"(GB) Renk Paleti",
"Game Boy paletlerini kullanmak için ayarlayın.",
{
{ "black and white", NULL },
{ "blue sea", NULL },
{ "dark knight", NULL },
{ "green forest", NULL },
{ "hot desert", NULL },
{ "pink dreams", NULL },
{ "wierd colors", NULL },
{ "original gameboy", NULL },
{ "gba sp", NULL },
{ NULL, NULL },
},
"standard"
},
{
"vbam_gbHardware",
"(GB) Öykünülmüş Donanım (Yeniden Başlatılması Gerekiyor)",
"Game Boy donanım tipini taklit edecek şekilde ayarlar. Uygulamak için çekirdeği yeniden başlatın.",
{
{ "gbc", "Game Boy Color" },
{ "auto", "Automatic" },
{ "sgb", "Super Game Boy" },
{ "gb", "Game Boy" },
{ "gba", "Game Boy Advance" },
{ "sgb2", "Super Game Boy 2" },
{ NULL, NULL },
},
"gbc"
},
{
"vbam_allowcolorizerhack",
"(GB) Colorizer Hack'i Etkinleştir (Yeniden Başlatılması Gerekiyor)",
"Colorizer'ın saldırıya uğramış GB oyunlarının (örn. DX yamalı oyunlar) normalde GBC / GBA donanım türünde çalışmasına izin verir. Bu ayrıca bios dosyasının kullanımını da devre dışı bırakır. Renklendirilmemiş oyunlarda kullanılması tavsiye edilmez.",
{
{ "disabled", NULL },
{ "enabled", NULL },
{ NULL, NULL },
},
"disabled"
},
{
"vbam_showborders",
"(GB) Sınırları Göster",
"Etkinleştirildiğinde, yüklü içerik SGB uyumluysa, bu durum oyundaki sınırı gösterir.",
{
{ "disabled", NULL },
{ "enabled", NULL },
{ "auto", NULL },
{ NULL, NULL },
},
"disabled"
},
{
"vbam_gbcoloroption",
"(GB) Renk Düzeltme",
"Bazı oyunlarda renkleri düzelten renk düzeltmesini uygular.",
{
{ "disabled", NULL },
{ "enabled", NULL },
{ NULL, NULL },
},
"disabled"
},
{
"vbam_turboenable",
"Turbo Düğmelerini Etkinleştir",
NULL,
"Gamepad turbo düğmelerini etkinleştirin veya devre dışı bırakın.",
NULL,
"input",
{
{ "disabled", NULL },
{ "enabled", NULL },
@ -228,7 +267,10 @@ struct retro_core_option_definition option_defs_tr[] = {
{
"vbam_turbodelay",
"Turbo Gecikme (kare cinsinden)",
NULL,
"Karelerde turbo tetikleyicilerin oranını tekrarlayın. Daha yüksek değer daha fazla tetikler.",
NULL,
"input",
{
{ "1", NULL },
{ "2", NULL },
@ -249,10 +291,36 @@ struct retro_core_option_definition option_defs_tr[] = {
},
"3"
},
{
"vbam_solarsensor",
"Solar Sensör Seviyesi",
NULL,
"Boktai oyunlarında simüle güneş seviyesini ayarlar. L2 / R2 düğmeleri ayrıca seviyeleri hızlıca değiştirmek için de kullanılabilir.",
NULL,
"input",
{
{ "0", NULL },
{ "1", NULL },
{ "2", NULL },
{ "3", NULL },
{ "4", NULL },
{ "5", NULL },
{ "6", NULL },
{ "7", NULL },
{ "8", NULL },
{ "9", NULL },
{ "10", NULL },
{ NULL, NULL },
},
"0"
},
{
"vbam_astick_deadzone",
"Sensörlerin Ölü Bölgesi (%)",
NULL,
"Analog çubukların ölü bölgesini (yüzde olarak) ayarlayın.",
NULL,
"input",
{
{ "0", NULL },
{ "5", NULL },
@ -268,7 +336,10 @@ struct retro_core_option_definition option_defs_tr[] = {
{
"vbam_gyro_sensitivity",
"Sensör Hassasiyeti (Jiroskop) (%)",
NULL,
"Varsayılan konumlandırma, sol analogdur. Gyro özellikli oyunlar için hassasiyet seviyesini ayarlamak için kullanılır.",
NULL,
"input",
{
{ "10", NULL },
{ "15", NULL },
@ -300,7 +371,10 @@ struct retro_core_option_definition option_defs_tr[] = {
{
"vbam_tilt_sensitivity",
"Sensör Hassasiyeti (Eğim) (%)",
NULL,
"Varsayılan konumlandırma sağ analogdur. Gyro özellikli oyunlar için hassasiyet seviyesini ayarlamak için kullanılır.",
NULL,
"input",
{
{ "10", NULL },
{ "15", NULL },
@ -332,18 +406,10 @@ struct retro_core_option_definition option_defs_tr[] = {
{
"vbam_swap_astick",
"Sol / Sağ Analog Değiştirme",
NULL,
"Döndürme ve eğme için sola ve sağa analog çubuk işlevini değiştirir.",
{
{ "disabled", NULL },
{ "enabled", NULL },
{ NULL, NULL },
},
"disabled"
},
{
"vbam_show_advanced_options",
"Gelişmiş Ayarları Göster",
"Ses kanallarını ve grafik katmanlarını etkinleştirebilen veya devre dışı bırakabilen gelişmiş seçenekleri gösterin.",
NULL,
"input",
{
{ "disabled", NULL },
{ "enabled", NULL },
@ -354,7 +420,10 @@ struct retro_core_option_definition option_defs_tr[] = {
{
"vbam_sound_1",
"Ses Kanalı 1",
NULL,
"Tonlu ve tarama ses kanalını etkinleştirir veya devre dışı bırakır.",
NULL,
"advanced",
{
{ "disabled", NULL },
{ "enabled", NULL },
@ -365,7 +434,10 @@ struct retro_core_option_definition option_defs_tr[] = {
{
"vbam_sound_2",
"Ses Kanalı 2",
NULL,
"Tonlu ses kanalını etkinleştirir veya devre dışı bırakır.",
NULL,
"advanced",
{
{ "disabled", NULL },
{ "enabled", NULL },
@ -376,7 +448,10 @@ struct retro_core_option_definition option_defs_tr[] = {
{
"vbam_sound_3",
"Ses Kanalı 3",
NULL,
"Dalga çıkışı ses kanalını etkinleştirir veya devre dışı bırakır.",
NULL,
"advanced",
{
{ "disabled", NULL },
{ "enabled", NULL },
@ -387,7 +462,10 @@ struct retro_core_option_definition option_defs_tr[] = {
{
"vbam_sound_4",
"Ses Kanalı 4",
NULL,
"Gürültü ses kanalını etkinleştirir veya devre dışı bırakır.",
NULL,
"advanced",
{
{ "disabled", NULL },
{ "enabled", NULL },
@ -398,7 +476,10 @@ struct retro_core_option_definition option_defs_tr[] = {
{
"vbam_sound_5",
"DMA Ses Kanalı A",
NULL,
"DMA ses kanalı A'yı etkinleştirir veya devre dışı bırakır.",
NULL,
"advanced",
{
{ "disabled", NULL },
{ "enabled", NULL },
@ -409,7 +490,10 @@ struct retro_core_option_definition option_defs_tr[] = {
{
"vbam_sound_6",
"DMA Ses Kanalı B",
NULL,
"DMA ses kanalı B'yi etkinleştirir veya devre dışı bırakır.",
NULL,
"advanced",
{
{ "disabled", NULL },
{ "enabled", NULL },
@ -420,7 +504,10 @@ struct retro_core_option_definition option_defs_tr[] = {
{
"vbam_layer_1",
"Arka Plan Katmanını Göster 1",
NULL,
"1. arka plan katmanını gösterir veya gizler.",
NULL,
"advanced",
{
{ "disabled", NULL },
{ "enabled", NULL },
@ -431,7 +518,10 @@ struct retro_core_option_definition option_defs_tr[] = {
{
"vbam_layer_2",
"Arka Plan Katmanını Göster 2",
NULL,
"2. arka plan katmanını gösterir veya gizler.",
NULL,
"advanced",
{
{ "disabled", NULL },
{ "enabled", NULL },
@ -442,7 +532,10 @@ struct retro_core_option_definition option_defs_tr[] = {
{
"vbam_layer_3",
"Arka Plan Katmanını Göster 3",
NULL,
"3. arka plan katmanını gösterir veya gizler.",
NULL,
"advanced",
{
{ "disabled", NULL },
{ "enabled", NULL },
@ -453,7 +546,10 @@ struct retro_core_option_definition option_defs_tr[] = {
{
"vbam_layer_4",
"Arka Plan Katmanını Göster 4",
NULL,
"4. arka plan katmanını gösterir veya gizler.",
NULL,
"advanced",
{
{ "disabled", NULL },
{ "enabled", NULL },
@ -464,7 +560,10 @@ struct retro_core_option_definition option_defs_tr[] = {
{
"vbam_layer_5",
"Sprite Katmanını Göster",
NULL,
"Sprite katmanını gösterir veya gizler.",
NULL,
"advanced",
{
{ "disabled", NULL },
{ "enabled", NULL },
@ -475,7 +574,10 @@ struct retro_core_option_definition option_defs_tr[] = {
{
"vbam_layer_6",
"Pencere Katmanını Göster 1",
NULL,
"Pencere katmanı 1'i gösterir veya gizler.",
NULL,
"advanced",
{
{ "disabled", NULL },
{ "enabled", NULL },
@ -486,7 +588,10 @@ struct retro_core_option_definition option_defs_tr[] = {
{
"vbam_layer_7",
"Pencere Katmanını Göster 2",
NULL,
"Pencere katmanı 2'yi gösterir veya gizler.",
NULL,
"advanced",
{
{ "disabled", NULL },
{ "enabled", NULL },
@ -497,7 +602,10 @@ struct retro_core_option_definition option_defs_tr[] = {
{
"vbam_layer_8",
"Sprite Pencere Katmanını Göster",
NULL,
"Sprite pencere katmanını gösterir veya gizler.",
NULL,
"advanced",
{
{ "disabled", NULL },
{ "enabled", NULL },
@ -506,7 +614,12 @@ struct retro_core_option_definition option_defs_tr[] = {
"enabled"
},
{ NULL, NULL, NULL, {{0}}, NULL }
{ NULL, NULL, NULL, NULL, NULL, NULL, { { NULL, NULL } }, NULL },
};
struct retro_core_options_v2 options_tr = {
option_cats_tr,
option_defs_tr
};
#ifdef __cplusplus