X-Git-Url: https://notaz.gp2x.de/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=libpcsxcore%2Fmisc.c;h=e3d227ab713fbb4567c34a6be036ae11b9ca9846;hb=0a2601833173a2516afb4d87f1157b59e55e96f1;hp=b02ac6f2a2bc756c2731165b7079f3b6afe179ed;hpb=3558dd33fb337a29fb6c57a5e88a473153e6202e;p=pcsx_rearmed.git diff --git a/libpcsxcore/misc.c b/libpcsxcore/misc.c index b02ac6f2..e3d227ab 100644 --- a/libpcsxcore/misc.c +++ b/libpcsxcore/misc.c @@ -58,14 +58,7 @@ struct iso_directory_record { void mmssdd( char *b, char *p ) { int m, s, d; -#if defined(__arm__) - unsigned char *u = (void *)b; - int block = (u[3] << 24) | (u[2] << 16) | (u[1] << 8) | u[0]; -#elif defined(__BIGENDIAN__) - int block = (b[0] & 0xff) | ((b[1] & 0xff) << 8) | ((b[2] & 0xff) << 16) | (b[3] << 24); -#else - int block = *((int*)b); -#endif + int block = SWAP32(*((uint32_t*) b)); block += 150; m = block / 4500; // minutes @@ -254,7 +247,7 @@ int LoadCdrom() { incTime(); READTRACK(); - if (ptr != NULL) memcpy(ptr, buf+12, 2048); + if (ptr != INVALID_PTR) memcpy(ptr, buf+12, 2048); tmpHead.t_size -= 2048; tmpHead.t_addr += 2048; @@ -300,7 +293,7 @@ int LoadCdromFile(const char *filename, EXE_HEADER *head) { READTRACK(); mem = PSXM(addr); - if (mem) + if (mem != INVALID_PTR) memcpy(mem, buf + 12, 2048); size -= 2048; @@ -489,7 +482,7 @@ int Load(const char *ExePath) { section_address = SWAP32(tmpHead.t_addr); section_size = SWAP32(tmpHead.t_size); mem = PSXM(section_address); - if (mem != NULL) { + if (mem != INVALID_PTR) { fseek(tmpFile, 0x800, SEEK_SET); fread_to_ram(mem, section_size, 1, tmpFile); psxCpu->Clear(section_address, section_size / 4); @@ -518,7 +511,7 @@ int Load(const char *ExePath) { EMU_LOG("Loading %08X bytes from %08X to %08X\n", section_size, ftell(tmpFile), section_address); #endif mem = PSXM(section_address); - if (mem != NULL) { + if (mem != INVALID_PTR) { fread_to_ram(mem, section_size, 1, tmpFile); psxCpu->Clear(section_address, section_size / 4); } @@ -624,7 +617,7 @@ int SaveState(const char *file) { new_dyna_before_save(); - if (drc_is_lightrec()) + if (drc_is_lightrec() && Config.Cpu != CPU_INTERPRETER) lightrec_plugin_prepare_save_state(); SaveFuncs.write(f, (void *)PcsxHeader, 32); @@ -724,7 +717,7 @@ int LoadState(const char *file) { GPU_freeze(0, gpufP); free(gpufP); if (HW_GPU_STATUS == 0) - HW_GPU_STATUS = GPU_readStatus(); + HW_GPU_STATUS = SWAP32(GPU_readStatus()); // spu SaveFuncs.read(f, &Size, 4);