#define READTRACK() \
if (CDR_readTrack(time) == -1) return -1; \
- buf = CDR_getBuffer(); \
- if (buf == NULL) return -1; else CheckPPFCache(buf, time[0], time[1], time[2]);
+ buf = (void *)CDR_getBuffer(); \
+ if (buf == NULL) return -1; \
+ else CheckPPFCache((u8 *)buf, time[0], time[1], time[2]);
#define READDIR(_dir) \
READTRACK(); \
READTRACK(); \
memcpy(_dir + 2048, buf + 12, 2048);
-int GetCdromFile(u8 *mdir, u8 *time, s8 *filename) {
+int GetCdromFile(u8 *mdir, u8 *time, char *filename) {
struct iso_directory_record *dir;
- char ddir[4096];
+ u8 ddir[4096];
u8 *buf;
int i;
struct iso_directory_record *dir;
u8 time[4], *buf;
u8 mdir[4096];
- s8 exename[256];
+ char exename[256];
// not the best place to do it, but since BIOS boot logo killer
// is just below, do it here
if (GetCdromFile(mdir, time, exename) == -1) {
sscanf((char *)buf + 12, "BOOT = cdrom:%256s", exename);
if (GetCdromFile(mdir, time, exename) == -1) {
- char *ptr = strstr(buf + 12, "cdrom:");
+ char *ptr = strstr((char *)buf + 12, "cdrom:");
if (ptr != NULL) {
ptr += 6;
while (*ptr == '\\' || *ptr == '/') ptr++;
int LoadCdromFile(const char *filename, EXE_HEADER *head) {
struct iso_directory_record *dir;
u8 time[4],*buf;
- u8 mdir[4096], exename[256];
+ u8 mdir[4096];
+ char exename[256];
u32 size, addr;
+ void *mem;
sscanf(filename, "cdrom:\\%256s", exename);
incTime();
READTRACK();
- memcpy((void *)PSXM(addr), buf + 12, 2048);
+ mem = PSXM(addr);
+ if (mem)
+ memcpy(mem, buf + 12, 2048);
size -= 2048;
addr += 2048;
int CheckCdrom() {
struct iso_directory_record *dir;
- unsigned char time[4], *buf;
+ unsigned char time[4];
+ char *buf;
unsigned char mdir[4096];
char exename[256];
int i, c;
if (GetCdromFile(mdir, time, "SYSTEM.CNF;1") != -1) {
READTRACK();
- sscanf((char *)buf + 12, "BOOT = cdrom:\\%256s", exename);
+ sscanf(buf + 12, "BOOT = cdrom:\\%256s", exename);
if (GetCdromFile(mdir, time, exename) == -1) {
- sscanf((char *)buf + 12, "BOOT = cdrom:%256s", exename);
+ sscanf(buf + 12, "BOOT = cdrom:%256s", exename);
if (GetCdromFile(mdir, time, exename) == -1) {
char *ptr = strstr(buf + 12, "cdrom:"); // possibly the executable is in some subdir
if (ptr != NULL) {