X-Git-Url: https://notaz.gp2x.de/cgi-bin/gitweb.cgi?p=pcsx_rearmed.git;a=blobdiff_plain;f=libpcsxcore%2Fmisc.c;h=27b9499320da8ccaaef269a0d13cc121bd5dc2aa;hp=2fe5600a10127c1d3e9a3abbd921954be4ab810a;hb=448bbcae9cc8f72f2e1d893c6ae8e071ca2b7aa9;hpb=f3a78e7ea779e6187d571056e0c97823b09a7bb0 diff --git a/libpcsxcore/misc.c b/libpcsxcore/misc.c index 2fe5600a..27b94993 100644 --- a/libpcsxcore/misc.c +++ b/libpcsxcore/misc.c @@ -364,6 +364,9 @@ int CheckCdrom() { } } + if (CdromId[0] == '\0') + strcpy(CdromId, "SLUS99999"); + if (Config.PsxAuto) { // autodetect system (pal or ntsc) if (CdromId[2] == 'e' || CdromId[2] == 'E') Config.PsxType = PSX_TYPE_PAL; // pal @@ -406,6 +409,22 @@ static int PSXGetFileType(FILE *f) { return INVALID_EXE; } +// temporary pandora workaround.. +// FIXME: remove +size_t fread_to_ram(void *ptr, size_t size, size_t nmemb, FILE *stream) +{ + void *tmp; + size_t ret = 0; + + tmp = malloc(size * nmemb); + if (tmp) { + ret = fread(tmp, size, nmemb, stream); + memcpy(ptr, tmp, size * nmemb); + free(tmp); + } + return ret; +} + int Load(const char *ExePath) { FILE *tmpFile; EXE_HEADER tmpHead; @@ -432,7 +451,7 @@ int Load(const char *ExePath) { mem = PSXM(section_address); if (mem != NULL) { fseek(tmpFile, 0x800, SEEK_SET); - fread(mem, section_size, 1, tmpFile); + fread_to_ram(mem, section_size, 1, tmpFile); psxCpu->Clear(section_address, section_size / 4); } fclose(tmpFile); @@ -458,7 +477,7 @@ int Load(const char *ExePath) { #endif mem = PSXM(section_address); if (mem != NULL) { - fread(mem, section_size, 1, tmpFile); + fread_to_ram(mem, section_size, 1, tmpFile); psxCpu->Clear(section_address, section_size / 4); } break;