// cheat funcs are destructive, need a copy..
strncpy(buf, code, sizeof(buf));
buf[sizeof(buf) - 1] = 0;
-
+
//Prepare buffered cheat for PCSX's AddCheat fucntion.
int cursor=0;
int nonhexdec=0;
}
cursor++;
}
-
+
if (index < NumCheats)
ret = EditCheat(index, "", buf);
}
else{
//not yet running
-
+
//bootlogo display hack
if (found_bios) {
var.value = "NULL";
struct retro_variable var = { .key="pcsx_rearmed_memcard2", .value=NULL };
static const char CARD2_FILE[] = "pcsx-card2.mcd";
- McdDisable[0] = 0;
- // Disable memcard 2 by default
- McdDisable[1] = 1;
+ // Memcard2 will be handled and is re-enabled if needed using core
+ // operations.
+ // Memcard1 is handled by libretro, doing this will set core to
+ // skip file io operations for memcard1 like SaveMcd
+ snprintf(Config.Mcd1, sizeof(Config.Mcd1), "none");
+ snprintf(Config.Mcd2, sizeof(Config.Mcd2), "none");
init_memcard(Mcd1Data);
// Memcard 2 is managed by the emulator on the filesystem,
// There is no need to initialize Mcd2Data like Mcd1Data.
psxUnmapHook = pl_vita_munmap;
#endif
ret = emu_core_preinit();
-#ifdef _3DS
+#ifdef _3DS
/* emu_core_preinit sets the cpu to dynarec */
if(!__ctr_svchax)
Config.Cpu = CPU_INTERPRETER;
#else
vout_buf = malloc(VOUT_MAX_WIDTH * VOUT_MAX_HEIGHT * 2);
#endif
-
+
vout_buf_ptr = vout_buf;
loadPSXBios();
#include "psxbios.h"
#include "psxhw.h"
#include "gpu.h"
+#include "sio.h"
#include <zlib.h>
#undef SysPrintf
static TCB Thread[8];
static int CurThread = 0;
static FileDesc FDesc[32];
-static u32 card_active_chan;
+static u32 card_active_chan = 0;
boolean hleSoftCall = FALSE;
}
void psxBios__card_info() { // ab
+ u8 ret, port;
#ifdef PSXBIOS_LOG
PSXBIOS_LOG("psxBios_%s: %x\n", biosA0n[0xab], a0);
#endif
card_active_chan = a0;
+ port = card_active_chan >> 4;
+
+ switch (port) {
+ case 0x0:
+ case 0x1:
+ ret = 0x2;
+ if (McdDisable[port & 1])
+ ret = 0x8;
+ break;
+ default:
+#ifdef PSXBIOS_LOG
+ PSXBIOS_LOG("psxBios_%s: UNKNOWN PORT 0x%x\n", biosA0n[0xab], card_active_chan);
+#endif
+ ret = 0x11;
+ break;
+ }
+
+ if (McdDisable[0] && McdDisable[1])
+ ret = 0x8;
// DeliverEvent(0x11, 0x2); // 0xf0000011, 0x0004
- DeliverEvent(0x81, 0x2); // 0xf4000001, 0x0004
+// DeliverEvent(0x81, 0x2); // 0xf4000001, 0x0004
+ DeliverEvent(0x81, ret); // 0xf4000001, 0x0004
v0 = 1; pc0 = ra;
}
CardState = -1;
CurThread = 0;
memset(FDesc, 0, sizeof(FDesc));
+ card_active_chan = 0;
psxMu32ref(0x0150) = SWAPu32(0x160);
psxMu32ref(0x0154) = SWAPu32(0x320);
}
McdDisable[mcd - 1] = 0;
+#ifdef HAVE_LIBRETRO
+ // memcard1 is handled by libretro
+ if (mcd == 1)
+ return;
+#endif
+
if (str == NULL || strcmp(str, "none") == 0) {
McdDisable[mcd - 1] = 1;
return;
#define MCD_SIZE (1024 * 8 * 16)
extern char Mcd1Data[MCD_SIZE], Mcd2Data[MCD_SIZE];
+extern char McdDisable[2];
void sioWrite8(unsigned char value);
void sioWriteStat16(unsigned short value);