libretro: Cleanup some #ifdefs
This commit is contained in:
parent
1d4dacc6f9
commit
1606ea7482
|
@ -2,15 +2,12 @@
|
||||||
#define SYSTEM_H
|
#define SYSTEM_H
|
||||||
|
|
||||||
#ifndef __LIBRETRO__
|
#ifndef __LIBRETRO__
|
||||||
|
#include <zlib.h>
|
||||||
#include "common/cstdint.h"
|
#include "common/cstdint.h"
|
||||||
#else
|
#else
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifndef __LIBRETRO__
|
|
||||||
#include <zlib.h>
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#define winlog log
|
#define winlog log
|
||||||
|
|
||||||
class SoundDriver;
|
class SoundDriver;
|
||||||
|
|
|
@ -16,22 +16,18 @@
|
||||||
|
|
||||||
#define MAX_CHEATS 16384
|
#define MAX_CHEATS 16384
|
||||||
|
|
||||||
#ifndef __LIBRETRO__
|
|
||||||
extern bool cpuIsMultiBoot;
|
extern bool cpuIsMultiBoot;
|
||||||
extern bool mirroringEnable;
|
extern bool mirroringEnable;
|
||||||
extern bool parseDebug;
|
extern bool parseDebug;
|
||||||
extern bool speedHack;
|
extern bool speedHack;
|
||||||
extern bool speedup;
|
extern bool speedup;
|
||||||
#endif
|
|
||||||
extern char *rewindMemory;
|
extern char *rewindMemory;
|
||||||
extern const char *aviRecordDir;
|
extern const char *aviRecordDir;
|
||||||
extern const char *biosFileNameGB;
|
extern const char *biosFileNameGB;
|
||||||
extern const char *biosFileNameGBA;
|
extern const char *biosFileNameGBA;
|
||||||
extern const char *biosFileNameGBC;
|
extern const char *biosFileNameGBC;
|
||||||
#ifndef __LIBRETRO__
|
|
||||||
extern const char *loadDotCodeFile;
|
extern const char *loadDotCodeFile;
|
||||||
extern const char *saveDotCodeFile;
|
extern const char *saveDotCodeFile;
|
||||||
#endif
|
|
||||||
extern const char *linkHostAddr;
|
extern const char *linkHostAddr;
|
||||||
extern const char *movieRecordDir;
|
extern const char *movieRecordDir;
|
||||||
extern const char *romDirGB;
|
extern const char *romDirGB;
|
||||||
|
@ -50,11 +46,9 @@ extern int autoPatch;
|
||||||
extern int autoSaveLoadCheatList;
|
extern int autoSaveLoadCheatList;
|
||||||
extern int aviRecording;
|
extern int aviRecording;
|
||||||
extern int captureFormat;
|
extern int captureFormat;
|
||||||
#ifndef __LIBRETRO__
|
|
||||||
extern int cheatsEnabled;
|
extern int cheatsEnabled;
|
||||||
extern int cpuDisableSfx;
|
extern int cpuDisableSfx;
|
||||||
extern int cpuSaveType;
|
extern int cpuSaveType;
|
||||||
#endif
|
|
||||||
extern int dinputKeyFocus;
|
extern int dinputKeyFocus;
|
||||||
extern int disableMMX;
|
extern int disableMMX;
|
||||||
extern int disableStatusMessages;
|
extern int disableStatusMessages;
|
||||||
|
@ -80,10 +74,8 @@ extern int glFilter;
|
||||||
extern int ifbType;
|
extern int ifbType;
|
||||||
extern int joypadDefault;
|
extern int joypadDefault;
|
||||||
extern int languageOption;
|
extern int languageOption;
|
||||||
#ifndef __LIBRETRO__
|
|
||||||
extern int layerEnable;
|
extern int layerEnable;
|
||||||
extern int layerSettings;
|
extern int layerSettings;
|
||||||
#endif
|
|
||||||
extern int linkAuto;
|
extern int linkAuto;
|
||||||
extern int linkHacks;
|
extern int linkHacks;
|
||||||
extern int linkMode;
|
extern int linkMode;
|
||||||
|
@ -101,9 +93,7 @@ extern int optPrintUsage;
|
||||||
extern int paused;
|
extern int paused;
|
||||||
extern int pauseWhenInactive;
|
extern int pauseWhenInactive;
|
||||||
extern int recentFreeze;
|
extern int recentFreeze;
|
||||||
#ifndef __LIBRETRO__
|
|
||||||
extern int renderedFrames;
|
extern int renderedFrames;
|
||||||
#endif
|
|
||||||
extern int rewindCount;
|
extern int rewindCount;
|
||||||
extern int rewindCounter;
|
extern int rewindCounter;
|
||||||
extern int rewindPos;
|
extern int rewindPos;
|
||||||
|
@ -111,10 +101,8 @@ extern int rewindSaveNeeded;
|
||||||
extern int rewindTimer;
|
extern int rewindTimer;
|
||||||
extern int rewindTopPos;
|
extern int rewindTopPos;
|
||||||
// extern int romSize;
|
// extern int romSize;
|
||||||
#ifndef __LIBRETRO__
|
|
||||||
extern int rtcEnabled;
|
extern int rtcEnabled;
|
||||||
extern int saveType;
|
extern int saveType;
|
||||||
#endif
|
|
||||||
extern int screenMessage;
|
extern int screenMessage;
|
||||||
extern int sensorX;
|
extern int sensorX;
|
||||||
extern int sensorY;
|
extern int sensorY;
|
||||||
|
@ -123,9 +111,7 @@ extern int showSpeed;
|
||||||
extern int showSpeedTransparent;
|
extern int showSpeedTransparent;
|
||||||
extern int sizeX;
|
extern int sizeX;
|
||||||
extern int sizeY;
|
extern int sizeY;
|
||||||
#ifndef __LIBRETRO__
|
|
||||||
extern int skipBios;
|
extern int skipBios;
|
||||||
#endif
|
|
||||||
extern int skipSaveGameBattery;
|
extern int skipSaveGameBattery;
|
||||||
extern int skipSaveGameCheats;
|
extern int skipSaveGameCheats;
|
||||||
extern int soundRecording;
|
extern int soundRecording;
|
||||||
|
@ -135,9 +121,7 @@ extern int surfaceSizeX;
|
||||||
extern int surfaceSizeY;
|
extern int surfaceSizeY;
|
||||||
extern int threadPriority;
|
extern int threadPriority;
|
||||||
extern int tripleBuffering;
|
extern int tripleBuffering;
|
||||||
#ifndef __LIBRETRO__
|
|
||||||
extern int useBios;
|
extern int useBios;
|
||||||
#endif
|
|
||||||
extern int useBiosFileGB;
|
extern int useBiosFileGB;
|
||||||
extern int useBiosFileGBA;
|
extern int useBiosFileGBA;
|
||||||
extern int useBiosFileGBC;
|
extern int useBiosFileGBC;
|
||||||
|
|
|
@ -1,11 +1,7 @@
|
||||||
#ifndef CHEATS_H
|
#ifndef CHEATS_H
|
||||||
#define CHEATS_H
|
#define CHEATS_H
|
||||||
|
|
||||||
#ifndef __LIBRETRO__
|
|
||||||
#include "../common/ConfigManager.h"
|
#include "../common/ConfigManager.h"
|
||||||
#else
|
|
||||||
#include "../src/libretro/UtilRetro.h"
|
|
||||||
#endif
|
|
||||||
|
|
||||||
struct CheatsData {
|
struct CheatsData {
|
||||||
int code;
|
int code;
|
||||||
|
|
|
@ -72,7 +72,9 @@ void eepromReadGame(const uint8_t*& data, int version)
|
||||||
eepromSize = 512;
|
eepromSize = 512;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#else
|
|
||||||
|
#else // !__LIBRETRO__
|
||||||
|
|
||||||
void eepromSaveGame(gzFile gzFile)
|
void eepromSaveGame(gzFile gzFile)
|
||||||
{
|
{
|
||||||
utilWriteData(gzFile, eepromSaveData);
|
utilWriteData(gzFile, eepromSaveData);
|
||||||
|
|
|
@ -12,20 +12,17 @@
|
||||||
#ifdef __LIBRETRO__
|
#ifdef __LIBRETRO__
|
||||||
extern void eepromSaveGame(uint8_t*& data);
|
extern void eepromSaveGame(uint8_t*& data);
|
||||||
extern void eepromReadGame(const uint8_t*& data, int version);
|
extern void eepromReadGame(const uint8_t*& data, int version);
|
||||||
#else
|
extern uint8_t* eepromData;
|
||||||
|
#else // !__LIBRETRO__
|
||||||
extern void eepromSaveGame(gzFile _gzFile);
|
extern void eepromSaveGame(gzFile _gzFile);
|
||||||
extern void eepromReadGame(gzFile _gzFile, int version);
|
extern void eepromReadGame(gzFile _gzFile, int version);
|
||||||
extern void eepromReadGameSkip(gzFile _gzFile, int version);
|
extern void eepromReadGameSkip(gzFile _gzFile, int version);
|
||||||
|
extern uint8_t eepromData[0x2000];
|
||||||
#endif
|
#endif
|
||||||
extern int eepromRead(uint32_t address);
|
extern int eepromRead(uint32_t address);
|
||||||
extern void eepromWrite(uint32_t address, uint8_t value);
|
extern void eepromWrite(uint32_t address, uint8_t value);
|
||||||
extern void eepromInit();
|
extern void eepromInit();
|
||||||
extern void eepromReset();
|
extern void eepromReset();
|
||||||
#ifdef __LIBRETRO__
|
|
||||||
extern uint8_t* eepromData;
|
|
||||||
#else
|
|
||||||
extern uint8_t eepromData[0x2000];
|
|
||||||
#endif
|
|
||||||
extern bool eepromInUse;
|
extern bool eepromInUse;
|
||||||
extern int eepromSize;
|
extern int eepromSize;
|
||||||
|
|
||||||
|
|
|
@ -82,7 +82,8 @@ void flashReadGame(const uint8_t*& data, int)
|
||||||
{
|
{
|
||||||
utilReadDataMem(data, flashSaveData3);
|
utilReadDataMem(data, flashSaveData3);
|
||||||
}
|
}
|
||||||
#else
|
|
||||||
|
#else // !__LIBRETRO__
|
||||||
void flashSaveGame(gzFile gzFile)
|
void flashSaveGame(gzFile gzFile)
|
||||||
{
|
{
|
||||||
utilWriteData(gzFile, flashSaveData3);
|
utilWriteData(gzFile, flashSaveData3);
|
||||||
|
|
|
@ -3,30 +3,26 @@
|
||||||
|
|
||||||
#ifndef __LIBRETRO__
|
#ifndef __LIBRETRO__
|
||||||
#include "../common/cstdint.h"
|
#include "../common/cstdint.h"
|
||||||
|
#include <zlib.h>
|
||||||
#else
|
#else
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include <zlib.h>
|
|
||||||
|
|
||||||
#define FLASH_128K_SZ 0x20000
|
#define FLASH_128K_SZ 0x20000
|
||||||
|
|
||||||
#ifdef __LIBRETRO__
|
#ifdef __LIBRETRO__
|
||||||
extern void flashSaveGame(uint8_t*& data);
|
extern void flashSaveGame(uint8_t*& data);
|
||||||
extern void flashReadGame(const uint8_t*& data, int);
|
extern void flashReadGame(const uint8_t*& data, int);
|
||||||
|
extern uint8_t* flashSaveMemory;
|
||||||
#else
|
#else
|
||||||
extern void flashSaveGame(gzFile _gzFile);
|
extern void flashSaveGame(gzFile _gzFile);
|
||||||
extern void flashReadGame(gzFile _gzFile, int version);
|
extern void flashReadGame(gzFile _gzFile, int version);
|
||||||
extern void flashReadGameSkip(gzFile _gzFile, int version);
|
extern void flashReadGameSkip(gzFile _gzFile, int version);
|
||||||
|
extern uint8_t flashSaveMemory[FLASH_128K_SZ];
|
||||||
#endif
|
#endif
|
||||||
extern uint8_t flashRead(uint32_t address);
|
extern uint8_t flashRead(uint32_t address);
|
||||||
extern void flashWrite(uint32_t address, uint8_t byte);
|
extern void flashWrite(uint32_t address, uint8_t byte);
|
||||||
extern void flashDelayedWrite(uint32_t address, uint8_t byte);
|
extern void flashDelayedWrite(uint32_t address, uint8_t byte);
|
||||||
#ifdef __LIBRETRO__
|
|
||||||
extern uint8_t* flashSaveMemory;
|
|
||||||
#else
|
|
||||||
extern uint8_t flashSaveMemory[FLASH_128K_SZ];
|
|
||||||
#endif
|
|
||||||
extern void flashSaveDecide(uint32_t address, uint8_t byte);
|
extern void flashSaveDecide(uint32_t address, uint8_t byte);
|
||||||
extern void flashReset();
|
extern void flashReset();
|
||||||
extern void flashSetSize(int size);
|
extern void flashSetSize(int size);
|
||||||
|
|
|
@ -7,11 +7,7 @@
|
||||||
#include "../NLS.h"
|
#include "../NLS.h"
|
||||||
#include "../System.h"
|
#include "../System.h"
|
||||||
#include "../Util.h"
|
#include "../Util.h"
|
||||||
#ifndef __LIBRETRO__
|
|
||||||
#include "../common/ConfigManager.h"
|
#include "../common/ConfigManager.h"
|
||||||
#else
|
|
||||||
#include "../src/libretro/UtilRetro.h"
|
|
||||||
#endif
|
|
||||||
#include "Cheats.h"
|
#include "Cheats.h"
|
||||||
#include "EEprom.h"
|
#include "EEprom.h"
|
||||||
#include "Flash.h"
|
#include "Flash.h"
|
||||||
|
|
|
@ -10,11 +10,7 @@
|
||||||
#include "../NLS.h"
|
#include "../NLS.h"
|
||||||
#include "../System.h"
|
#include "../System.h"
|
||||||
#include "../Util.h"
|
#include "../Util.h"
|
||||||
#ifndef __LIBRETRO__
|
|
||||||
#include "../common/ConfigManager.h"
|
#include "../common/ConfigManager.h"
|
||||||
#else
|
|
||||||
#include "../src/libretro/UtilRetro.h"
|
|
||||||
#endif
|
|
||||||
#include "Cheats.h"
|
#include "Cheats.h"
|
||||||
#include "EEprom.h"
|
#include "EEprom.h"
|
||||||
#include "Flash.h"
|
#include "Flash.h"
|
||||||
|
@ -887,7 +883,7 @@ DEFINE_IMM5_INSN(IMM5_ASR, 10)
|
||||||
static INSN_REGPARM void thumb##BASE##_6(uint32_t opcode) { THREEARG_INSN(OP, 6); } \
|
static INSN_REGPARM void thumb##BASE##_6(uint32_t opcode) { THREEARG_INSN(OP, 6); } \
|
||||||
static INSN_REGPARM void thumb##BASE##_7(uint32_t opcode) { THREEARG_INSN(OP, 7); }
|
static INSN_REGPARM void thumb##BASE##_7(uint32_t opcode) { THREEARG_INSN(OP, 7); }
|
||||||
|
|
||||||
#define DEFINE_IMM3_INSN(OP, BASE) \
|
#define DEFINE_IMM3_INSN(OP, BASE) \
|
||||||
static INSN_REGPARM void thumb##BASE##_0(uint32_t opcode) { THREEARG_INSN(OP##_0, 0); } \
|
static INSN_REGPARM void thumb##BASE##_0(uint32_t opcode) { THREEARG_INSN(OP##_0, 0); } \
|
||||||
static INSN_REGPARM void thumb##BASE##_1(uint32_t opcode) { THREEARG_INSN(OP, 1); } \
|
static INSN_REGPARM void thumb##BASE##_1(uint32_t opcode) { THREEARG_INSN(OP, 1); } \
|
||||||
static INSN_REGPARM void thumb##BASE##_2(uint32_t opcode) { THREEARG_INSN(OP, 2); } \
|
static INSN_REGPARM void thumb##BASE##_2(uint32_t opcode) { THREEARG_INSN(OP, 2); } \
|
||||||
|
|
209
src/gba/GBA.cpp
209
src/gba/GBA.cpp
|
@ -10,11 +10,7 @@
|
||||||
#include "../NLS.h"
|
#include "../NLS.h"
|
||||||
#include "../System.h"
|
#include "../System.h"
|
||||||
#include "../Util.h"
|
#include "../Util.h"
|
||||||
#ifndef __LIBRETRO__
|
|
||||||
#include "../common/ConfigManager.h"
|
#include "../common/ConfigManager.h"
|
||||||
#else
|
|
||||||
#include "../src/libretro/UtilRetro.h"
|
|
||||||
#endif
|
|
||||||
#include "../common/Port.h"
|
#include "../common/Port.h"
|
||||||
#include "Cheats.h"
|
#include "Cheats.h"
|
||||||
#include "EEprom.h"
|
#include "EEprom.h"
|
||||||
|
@ -582,7 +578,7 @@ void CPUUpdateRenderBuffers(bool force)
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef __LIBRETRO__
|
#ifdef __LIBRETRO__
|
||||||
#include <cstddef>
|
#include <stddef.h>
|
||||||
|
|
||||||
unsigned int CPUWriteState(uint8_t* data, unsigned size)
|
unsigned int CPUWriteState(uint8_t* data, unsigned size)
|
||||||
{
|
{
|
||||||
|
@ -603,11 +599,7 @@ unsigned int CPUWriteState(uint8_t* data, unsigned size)
|
||||||
utilWriteMem(data, workRAM, 0x40000);
|
utilWriteMem(data, workRAM, 0x40000);
|
||||||
utilWriteMem(data, vram, 0x20000);
|
utilWriteMem(data, vram, 0x20000);
|
||||||
utilWriteMem(data, oam, 0x400);
|
utilWriteMem(data, oam, 0x400);
|
||||||
#ifdef __LIBRETRO__
|
|
||||||
utilWriteMem(data, pix, 4 * 240 * 160);
|
utilWriteMem(data, pix, 4 * 240 * 160);
|
||||||
#else
|
|
||||||
utilWriteMem(data, pix, 4 * 241 * 162);
|
|
||||||
#endif
|
|
||||||
utilWriteMem(data, ioMem, 0x400);
|
utilWriteMem(data, ioMem, 0x400);
|
||||||
|
|
||||||
eepromSaveGame(data);
|
eepromSaveGame(data);
|
||||||
|
@ -622,7 +614,83 @@ bool CPUWriteMemState(char* memory, int available, long& reserved)
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
#else
|
|
||||||
|
bool CPUReadState(const uint8_t* data, unsigned size)
|
||||||
|
{
|
||||||
|
// Don't really care about version.
|
||||||
|
int version = utilReadIntMem(data);
|
||||||
|
if (version != SAVE_GAME_VERSION)
|
||||||
|
return false;
|
||||||
|
|
||||||
|
char romname[16];
|
||||||
|
utilReadMem(romname, data, 16);
|
||||||
|
if (memcmp(&rom[0xa0], romname, 16) != 0)
|
||||||
|
return false;
|
||||||
|
|
||||||
|
// Don't care about use bios ...
|
||||||
|
utilReadIntMem(data);
|
||||||
|
|
||||||
|
utilReadMem(®[0], data, sizeof(reg));
|
||||||
|
|
||||||
|
utilReadDataMem(data, saveGameStruct);
|
||||||
|
|
||||||
|
stopState = utilReadIntMem(data) ? true : false;
|
||||||
|
|
||||||
|
IRQTicks = utilReadIntMem(data);
|
||||||
|
if (IRQTicks > 0)
|
||||||
|
intState = true;
|
||||||
|
else {
|
||||||
|
intState = false;
|
||||||
|
IRQTicks = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
utilReadMem(internalRAM, data, 0x8000);
|
||||||
|
utilReadMem(paletteRAM, data, 0x400);
|
||||||
|
utilReadMem(workRAM, data, 0x40000);
|
||||||
|
utilReadMem(vram, data, 0x20000);
|
||||||
|
utilReadMem(oam, data, 0x400);
|
||||||
|
utilReadMem(pix, data, 4 * 240 * 160);
|
||||||
|
utilReadMem(ioMem, data, 0x400);
|
||||||
|
|
||||||
|
eepromReadGame(data, version);
|
||||||
|
flashReadGame(data, version);
|
||||||
|
soundReadGame(data, version);
|
||||||
|
rtcReadGame(data);
|
||||||
|
|
||||||
|
//// Copypasta stuff ...
|
||||||
|
// set pointers!
|
||||||
|
layerEnable = layerSettings & DISPCNT;
|
||||||
|
|
||||||
|
CPUUpdateRender();
|
||||||
|
|
||||||
|
// CPU Update Render Buffers set to true
|
||||||
|
CLEAR_ARRAY(line0);
|
||||||
|
CLEAR_ARRAY(line1);
|
||||||
|
CLEAR_ARRAY(line2);
|
||||||
|
CLEAR_ARRAY(line3);
|
||||||
|
// End of CPU Update Render Buffers set to true
|
||||||
|
|
||||||
|
CPUUpdateWindow0();
|
||||||
|
CPUUpdateWindow1();
|
||||||
|
gbaSaveType = 0;
|
||||||
|
SetSaveType(saveType);
|
||||||
|
if (eepromInUse)
|
||||||
|
gbaSaveType = 3;
|
||||||
|
|
||||||
|
systemSaveUpdateCounter = SYSTEM_SAVE_NOT_UPDATED;
|
||||||
|
if (armState) {
|
||||||
|
ARM_PREFETCH;
|
||||||
|
} else {
|
||||||
|
THUMB_PREFETCH;
|
||||||
|
}
|
||||||
|
|
||||||
|
CPUUpdateRegister(0x204, CPUReadHalfWordQuick(0x4000204));
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
#else // !__LIBRETRO__
|
||||||
|
|
||||||
static bool CPUWriteState(gzFile gzFile)
|
static bool CPUWriteState(gzFile gzFile)
|
||||||
{
|
{
|
||||||
utilWriteInt(gzFile, SAVE_GAME_VERSION);
|
utilWriteInt(gzFile, SAVE_GAME_VERSION);
|
||||||
|
@ -645,11 +713,7 @@ static bool CPUWriteState(gzFile gzFile)
|
||||||
utilGzWrite(gzFile, workRAM, 0x40000);
|
utilGzWrite(gzFile, workRAM, 0x40000);
|
||||||
utilGzWrite(gzFile, vram, 0x20000);
|
utilGzWrite(gzFile, vram, 0x20000);
|
||||||
utilGzWrite(gzFile, oam, 0x400);
|
utilGzWrite(gzFile, oam, 0x400);
|
||||||
#ifdef __LIBRETRO__
|
|
||||||
utilGzWrite(gzFile, pix, 4 * 240 * 160);
|
|
||||||
#else
|
|
||||||
utilGzWrite(gzFile, pix, 4 * 241 * 162);
|
utilGzWrite(gzFile, pix, 4 * 241 * 162);
|
||||||
#endif
|
|
||||||
utilGzWrite(gzFile, ioMem, 0x400);
|
utilGzWrite(gzFile, ioMem, 0x400);
|
||||||
|
|
||||||
eepromSaveGame(gzFile);
|
eepromSaveGame(gzFile);
|
||||||
|
@ -699,110 +763,7 @@ bool CPUWriteMemState(char* memory, int available, long& reserved)
|
||||||
|
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef __LIBRETRO__
|
|
||||||
bool CPUReadState(const uint8_t* data, unsigned size)
|
|
||||||
{
|
|
||||||
// Don't really care about version.
|
|
||||||
int version = utilReadIntMem(data);
|
|
||||||
if (version != SAVE_GAME_VERSION)
|
|
||||||
return false;
|
|
||||||
|
|
||||||
char romname[16];
|
|
||||||
utilReadMem(romname, data, 16);
|
|
||||||
if (memcmp(&rom[0xa0], romname, 16) != 0)
|
|
||||||
return false;
|
|
||||||
|
|
||||||
// Don't care about use bios ...
|
|
||||||
utilReadIntMem(data);
|
|
||||||
|
|
||||||
utilReadMem(®[0], data, sizeof(reg));
|
|
||||||
|
|
||||||
utilReadDataMem(data, saveGameStruct);
|
|
||||||
|
|
||||||
stopState = utilReadIntMem(data) ? true : false;
|
|
||||||
|
|
||||||
IRQTicks = utilReadIntMem(data);
|
|
||||||
if (IRQTicks > 0)
|
|
||||||
intState = true;
|
|
||||||
else {
|
|
||||||
intState = false;
|
|
||||||
IRQTicks = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
utilReadMem(internalRAM, data, 0x8000);
|
|
||||||
utilReadMem(paletteRAM, data, 0x400);
|
|
||||||
utilReadMem(workRAM, data, 0x40000);
|
|
||||||
utilReadMem(vram, data, 0x20000);
|
|
||||||
utilReadMem(oam, data, 0x400);
|
|
||||||
#ifdef __LIBRETRO__
|
|
||||||
utilReadMem(pix, data, 4 * 240 * 160);
|
|
||||||
#else
|
|
||||||
utilReadMem(pix, data, 4 * 241 * 162);
|
|
||||||
#endif
|
|
||||||
utilReadMem(ioMem, data, 0x400);
|
|
||||||
|
|
||||||
eepromReadGame(data, version);
|
|
||||||
flashReadGame(data, version);
|
|
||||||
soundReadGame(data, version);
|
|
||||||
rtcReadGame(data);
|
|
||||||
|
|
||||||
//// Copypasta stuff ...
|
|
||||||
// set pointers!
|
|
||||||
layerEnable = layerSettings & DISPCNT;
|
|
||||||
|
|
||||||
CPUUpdateRender();
|
|
||||||
|
|
||||||
// CPU Update Render Buffers set to true
|
|
||||||
CLEAR_ARRAY(line0);
|
|
||||||
CLEAR_ARRAY(line1);
|
|
||||||
CLEAR_ARRAY(line2);
|
|
||||||
CLEAR_ARRAY(line3);
|
|
||||||
// End of CPU Update Render Buffers set to true
|
|
||||||
|
|
||||||
CPUUpdateWindow0();
|
|
||||||
CPUUpdateWindow1();
|
|
||||||
gbaSaveType = 0;
|
|
||||||
switch (saveType) {
|
|
||||||
case 0:
|
|
||||||
cpuSaveGameFunc = flashSaveDecide;
|
|
||||||
break;
|
|
||||||
case 1:
|
|
||||||
cpuSaveGameFunc = sramWrite;
|
|
||||||
gbaSaveType = 1;
|
|
||||||
break;
|
|
||||||
case 2:
|
|
||||||
cpuSaveGameFunc = flashWrite;
|
|
||||||
gbaSaveType = 2;
|
|
||||||
break;
|
|
||||||
case 3:
|
|
||||||
break;
|
|
||||||
case 5:
|
|
||||||
gbaSaveType = 5;
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
#ifdef CELL_VBA_DEBUG
|
|
||||||
systemMessage(MSG_UNSUPPORTED_SAVE_TYPE,
|
|
||||||
N_("Unsupported save type %d"), saveType);
|
|
||||||
#endif
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
if (eepromInUse)
|
|
||||||
gbaSaveType = 3;
|
|
||||||
|
|
||||||
systemSaveUpdateCounter = SYSTEM_SAVE_NOT_UPDATED;
|
|
||||||
if (armState) {
|
|
||||||
ARM_PREFETCH;
|
|
||||||
} else {
|
|
||||||
THUMB_PREFETCH;
|
|
||||||
}
|
|
||||||
|
|
||||||
CPUUpdateRegister(0x204, CPUReadHalfWordQuick(0x4000204));
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
#else
|
|
||||||
static bool CPUReadState(gzFile gzFile)
|
static bool CPUReadState(gzFile gzFile)
|
||||||
{
|
{
|
||||||
int version = utilReadInt(gzFile);
|
int version = utilReadInt(gzFile);
|
||||||
|
@ -866,14 +827,10 @@ static bool CPUReadState(gzFile gzFile)
|
||||||
utilGzRead(gzFile, workRAM, 0x40000);
|
utilGzRead(gzFile, workRAM, 0x40000);
|
||||||
utilGzRead(gzFile, vram, 0x20000);
|
utilGzRead(gzFile, vram, 0x20000);
|
||||||
utilGzRead(gzFile, oam, 0x400);
|
utilGzRead(gzFile, oam, 0x400);
|
||||||
#ifdef __LIBRETRO__
|
|
||||||
utilGzRead(gzFile, pix, 4 * 240 * 160);
|
|
||||||
#else
|
|
||||||
if (version < SAVE_GAME_VERSION_6)
|
if (version < SAVE_GAME_VERSION_6)
|
||||||
utilGzRead(gzFile, pix, 4 * 240 * 160);
|
utilGzRead(gzFile, pix, 4 * 240 * 160);
|
||||||
else
|
else
|
||||||
utilGzRead(gzFile, pix, 4 * 241 * 162);
|
utilGzRead(gzFile, pix, 4 * 241 * 162);
|
||||||
#endif
|
|
||||||
utilGzRead(gzFile, ioMem, 0x400);
|
utilGzRead(gzFile, ioMem, 0x400);
|
||||||
|
|
||||||
if (skipSaveGameBattery) {
|
if (skipSaveGameBattery) {
|
||||||
|
@ -1610,11 +1567,8 @@ int CPULoadRom(const char* szFile)
|
||||||
CPUCleanUp();
|
CPUCleanUp();
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
#ifdef __LIBRETRO__
|
|
||||||
pix = (uint8_t*)calloc(1, 4 * 240 * 160);
|
|
||||||
#else
|
|
||||||
pix = (uint8_t*)calloc(1, 4 * 241 * 162);
|
pix = (uint8_t*)calloc(1, 4 * 241 * 162);
|
||||||
#endif
|
|
||||||
if (pix == NULL) {
|
if (pix == NULL) {
|
||||||
systemMessage(MSG_OUT_OF_MEMORY, N_("Failed to allocate memory for %s"),
|
systemMessage(MSG_OUT_OF_MEMORY, N_("Failed to allocate memory for %s"),
|
||||||
"PIX");
|
"PIX");
|
||||||
|
@ -1706,11 +1660,8 @@ int CPULoadRomData(const char* data, int size)
|
||||||
CPUCleanUp();
|
CPUCleanUp();
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
#ifdef __LIBRETRO__
|
|
||||||
pix = (uint8_t*)calloc(1, 4 * 240 * 160);
|
pix = (uint8_t*)calloc(1, 4 * 240 * 160);
|
||||||
#else
|
|
||||||
pix = (uint8_t*)calloc(1, 4 * 241 * 162);
|
|
||||||
#endif
|
|
||||||
if (pix == NULL) {
|
if (pix == NULL) {
|
||||||
systemMessage(MSG_OUT_OF_MEMORY, N_("Failed to allocate memory for %s"),
|
systemMessage(MSG_OUT_OF_MEMORY, N_("Failed to allocate memory for %s"),
|
||||||
"PIX");
|
"PIX");
|
||||||
|
|
|
@ -17,6 +17,7 @@
|
||||||
|
|
||||||
#include "SoundRetro.h"
|
#include "SoundRetro.h"
|
||||||
#include "libretro.h"
|
#include "libretro.h"
|
||||||
|
|
||||||
unsigned g_audio_frames;
|
unsigned g_audio_frames;
|
||||||
extern retro_audio_sample_batch_t audio_batch_cb;
|
extern retro_audio_sample_batch_t audio_batch_cb;
|
||||||
|
|
||||||
|
|
|
@ -6,6 +6,7 @@
|
||||||
#include "System.h"
|
#include "System.h"
|
||||||
#include "Util.h"
|
#include "Util.h"
|
||||||
#include "common/Port.h"
|
#include "common/Port.h"
|
||||||
|
#include "common/ConfigManager.h"
|
||||||
#include "gba/Flash.h"
|
#include "gba/Flash.h"
|
||||||
#include "gba/GBA.h"
|
#include "gba/GBA.h"
|
||||||
#include "gba/Globals.h"
|
#include "gba/Globals.h"
|
||||||
|
@ -14,44 +15,52 @@
|
||||||
#include "gb/gbGlobals.h"
|
#include "gb/gbGlobals.h"
|
||||||
#include "gba/gbafilter.h"
|
#include "gba/gbafilter.h"
|
||||||
|
|
||||||
#include "UtilRetro.h"
|
|
||||||
|
|
||||||
#ifndef _MSC_VER
|
#ifndef _MSC_VER
|
||||||
#include <strings.h>
|
#include <strings.h>
|
||||||
#define _stricmp strcasecmp
|
#define _stricmp strcasecmp
|
||||||
#endif // ! _MSC_VER
|
#endif // ! _MSC_VER
|
||||||
|
|
||||||
|
// Because Configmanager was introduced, this has to be done.
|
||||||
|
int rtcEnabled = 0;
|
||||||
|
int cpuDisableSfx = 0;
|
||||||
|
int skipBios = 0;
|
||||||
|
int saveType = 0;
|
||||||
|
int cpuSaveType = 0;
|
||||||
|
int skipSaveGameBattery = 0;
|
||||||
|
int skipSaveGameCheats = 0;
|
||||||
|
int useBios = 0;
|
||||||
|
int cheatsEnabled = 1;
|
||||||
|
int layerSettings = 0xff00;
|
||||||
|
int layerEnable = 0xff00;
|
||||||
|
bool speedup = false;
|
||||||
|
bool parseDebug = false;
|
||||||
|
bool speedHack = false;
|
||||||
|
bool mirroringEnable = false;
|
||||||
|
bool cpuIsMultiBoot = false;
|
||||||
|
|
||||||
|
const char* loadDotCodeFile;
|
||||||
|
const char* saveDotCodeFile;
|
||||||
|
|
||||||
extern int systemColorDepth;
|
extern int systemColorDepth;
|
||||||
extern int systemRedShift;
|
extern int systemRedShift;
|
||||||
extern int systemGreenShift;
|
extern int systemGreenShift;
|
||||||
extern int systemBlueShift;
|
extern int systemBlueShift;
|
||||||
|
|
||||||
// Because Configmanager was introduced, this has to be done.
|
|
||||||
|
|
||||||
const char* loadDotCodeFile;
|
|
||||||
const char* saveDotCodeFile;
|
|
||||||
|
|
||||||
int cheatsEnabled = true;
|
|
||||||
int saveType = 0;
|
|
||||||
int skipBios = 0;
|
|
||||||
int rtcEnabled;
|
|
||||||
int frameSkip = 1;
|
|
||||||
bool speedup = false;
|
|
||||||
bool cpuIsMultiBoot = false;
|
|
||||||
int cpuDisableSfx = false;
|
|
||||||
bool parseDebug = true;
|
|
||||||
int layerSettings = 0xff00;
|
|
||||||
int layerEnable = 0xff00;
|
|
||||||
bool speedHack = false;
|
|
||||||
int cpuSaveType = 0;
|
|
||||||
int useBios = 0;
|
|
||||||
bool mirroringEnable = true;
|
|
||||||
bool skipSaveGameBattery = false;
|
|
||||||
bool skipSaveGameCheats = false;
|
|
||||||
|
|
||||||
extern uint16_t systemColorMap16[0x10000];
|
extern uint16_t systemColorMap16[0x10000];
|
||||||
extern uint32_t systemColorMap32[0x10000];
|
extern uint32_t systemColorMap32[0x10000];
|
||||||
|
|
||||||
|
const char gb_image_header[] =
|
||||||
|
{
|
||||||
|
static_cast<const char>
|
||||||
|
(
|
||||||
|
0xce, 0xed, 0x66, 0x66, 0xcc, 0x0d, 0x00, 0x0b, 0x03, 0x73, 0x00,
|
||||||
|
0x83, 0x00, 0x0c, 0x00, 0x0d, 0x00, 0x08, 0x11, 0x1f, 0x88, 0x89,
|
||||||
|
0x00, 0x0e, 0xdc, 0xcc, 0x6e, 0xe6, 0xdd, 0xdd, 0xd9, 0x99, 0xbb,
|
||||||
|
0xbb, 0x67, 0x63, 0x6e, 0x0e, 0xec, 0xcc, 0xdd, 0xdc, 0x99, 0x9f,
|
||||||
|
0xbb, 0xb9, 0x33, 0x3e
|
||||||
|
)
|
||||||
|
};
|
||||||
|
|
||||||
bool utilWritePNGFile(const char* fileName, int w, int h, uint8_t* pix)
|
bool utilWritePNGFile(const char* fileName, int w, int h, uint8_t* pix)
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
|
|
|
@ -1,35 +0,0 @@
|
||||||
#ifndef _VBA_UTIL_RETRO_H
|
|
||||||
#define _VBA_UTIL_RETRO_H
|
|
||||||
|
|
||||||
extern bool speedup;
|
|
||||||
extern int cheatsEnabled;
|
|
||||||
extern int useBios;
|
|
||||||
extern int skipBios;
|
|
||||||
extern int synchronize;
|
|
||||||
extern int cpuDisableSfx;
|
|
||||||
extern bool cpuIsMultiBoot;
|
|
||||||
extern bool parseDebug;
|
|
||||||
extern bool speedHack;
|
|
||||||
extern bool mirroringEnable;
|
|
||||||
extern int rtcEnabled;
|
|
||||||
|
|
||||||
extern const char *loadDotCodeFile;
|
|
||||||
extern const char *saveDotCodeFile;
|
|
||||||
|
|
||||||
extern bool skipSaveGameBattery;
|
|
||||||
extern bool skipSaveGameCheats;
|
|
||||||
#define MAX_CHEATS 100
|
|
||||||
|
|
||||||
const char gb_image_header[] =
|
|
||||||
{
|
|
||||||
static_cast<const char>
|
|
||||||
(
|
|
||||||
0xce, 0xed, 0x66, 0x66, 0xcc, 0x0d, 0x00, 0x0b, 0x03, 0x73, 0x00,
|
|
||||||
0x83, 0x00, 0x0c, 0x00, 0x0d, 0x00, 0x08, 0x11, 0x1f, 0x88, 0x89,
|
|
||||||
0x00, 0x0e, 0xdc, 0xcc, 0x6e, 0xe6, 0xdd, 0xdd, 0xd9, 0x99, 0xbb,
|
|
||||||
0xbb, 0x67, 0x63, 0x6e, 0x0e, 0xec, 0xcc, 0xdd, 0xdc, 0x99, 0x9f,
|
|
||||||
0xbb, 0xb9, 0x33, 0x3e
|
|
||||||
)
|
|
||||||
};
|
|
||||||
|
|
||||||
#endif // _VBA_UTIL_RETRO_H
|
|
|
@ -1,17 +0,0 @@
|
||||||
#include "configmanager.h"
|
|
||||||
int cheatsEnabled = true;
|
|
||||||
int saveType = 0;
|
|
||||||
int layerEnable = 0xff00;
|
|
||||||
int layerSettings = 0xff00;
|
|
||||||
bool parseDebug = true;
|
|
||||||
bool cpuIsMultiBoot = false;
|
|
||||||
int cpuDisableSfx = false;
|
|
||||||
bool mirroringEnable = true;
|
|
||||||
int skipBios = 0;
|
|
||||||
bool speedup = false;
|
|
||||||
bool speedHack = false;
|
|
||||||
const char* loadDotCodeFile;
|
|
||||||
const char* saveDotCodeFile;
|
|
||||||
int useBios = 0;
|
|
||||||
int rtcEnabled;
|
|
||||||
int cpuSaveType = 0;
|
|
|
@ -1,15 +0,0 @@
|
||||||
extern bool cpuIsMultiBoot;
|
|
||||||
extern int cpuDisableSfx;
|
|
||||||
extern int cpuSaveType;
|
|
||||||
extern bool mirroringEnable;
|
|
||||||
extern bool parseDebug;
|
|
||||||
extern bool speedHack;
|
|
||||||
extern bool speedup;
|
|
||||||
extern int cheatsEnabled;
|
|
||||||
extern int layerEnable;
|
|
||||||
extern int layerSettings;
|
|
||||||
extern int skipBios;
|
|
||||||
extern int useBios;
|
|
||||||
extern const char *loadDotCodeFile;
|
|
||||||
extern const char *saveDotCodeFile;
|
|
||||||
extern int rtcEnabled;
|
|
|
@ -15,6 +15,7 @@
|
||||||
#include "../apu/Gb_Apu.h"
|
#include "../apu/Gb_Apu.h"
|
||||||
#include "../apu/Gb_Oscs.h"
|
#include "../apu/Gb_Oscs.h"
|
||||||
#include "../common/Port.h"
|
#include "../common/Port.h"
|
||||||
|
#include "../common/ConfigManager.h"
|
||||||
#include "../gba/Cheats.h"
|
#include "../gba/Cheats.h"
|
||||||
#include "../gba/EEprom.h"
|
#include "../gba/EEprom.h"
|
||||||
#include "../gba/Flash.h"
|
#include "../gba/Flash.h"
|
||||||
|
@ -37,7 +38,7 @@ static retro_input_state_t input_cb;
|
||||||
retro_audio_sample_batch_t audio_batch_cb;
|
retro_audio_sample_batch_t audio_batch_cb;
|
||||||
static retro_environment_t environ_cb;
|
static retro_environment_t environ_cb;
|
||||||
|
|
||||||
bool enableRtc;
|
static bool enableRtc;
|
||||||
static bool can_dupe;
|
static bool can_dupe;
|
||||||
unsigned device_type = 0;
|
unsigned device_type = 0;
|
||||||
int emulating = 0;
|
int emulating = 0;
|
||||||
|
@ -64,8 +65,8 @@ int systemFrameSkip = 0;
|
||||||
int systemSaveUpdateCounter = SYSTEM_SAVE_NOT_UPDATED;
|
int systemSaveUpdateCounter = SYSTEM_SAVE_NOT_UPDATED;
|
||||||
int systemSpeed = 0;
|
int systemSpeed = 0;
|
||||||
|
|
||||||
uint64_t startTime = 0;
|
//uint64_t startTime = 0;
|
||||||
uint32_t renderedFrames = 0;
|
//uint32_t renderedFrames = 0;
|
||||||
|
|
||||||
void (*dbgOutput)(const char* s, uint32_t addr);
|
void (*dbgOutput)(const char* s, uint32_t addr);
|
||||||
void (*dbgSignal)(int sig, int number);
|
void (*dbgSignal)(int sig, int number);
|
||||||
|
@ -466,6 +467,7 @@ static void gba_init(void)
|
||||||
if (flashSize == 0x10000 || flashSize == 0x20000)
|
if (flashSize == 0x10000 || flashSize == 0x20000)
|
||||||
flashSetSize(flashSize);
|
flashSetSize(flashSize);
|
||||||
|
|
||||||
|
rtcEnabled = enableRtc;
|
||||||
if (enableRtc)
|
if (enableRtc)
|
||||||
rtcEnable(enableRtc);
|
rtcEnable(enableRtc);
|
||||||
|
|
||||||
|
@ -870,6 +872,7 @@ uint32_t systemReadJoypad(int which)
|
||||||
bool systemReadJoypads() { return true; }
|
bool systemReadJoypads() { return true; }
|
||||||
|
|
||||||
void systemUpdateMotionSensor() {}
|
void systemUpdateMotionSensor() {}
|
||||||
|
|
||||||
uint8_t systemGetSensorDarkness() { return 0; }
|
uint8_t systemGetSensorDarkness() { return 0; }
|
||||||
|
|
||||||
void systemCartridgeRumble(bool)
|
void systemCartridgeRumble(bool)
|
||||||
|
|
Loading…
Reference in New Issue