X-Git-Url: https://notaz.gp2x.de/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=libpcsxcore%2Fmisc.c;h=3d1647102104209aede928ef76ac91572ec6455a;hb=7c3332fbf8ea98bf43f5de9e966bbae77dd9f61d;hp=bba81b1e8bf8b25d7ceae37ea70a9022c3e15f04;hpb=457a46ec7a3f8fe28ee4ccc23236b940461d2aae;p=pcsx_rearmed.git diff --git a/libpcsxcore/misc.c b/libpcsxcore/misc.c index bba81b1e..3d164710 100644 --- a/libpcsxcore/misc.c +++ b/libpcsxcore/misc.c @@ -144,30 +144,6 @@ int GetCdromFile(u8 *mdir, u8 *time, char *filename) { return retval; } -static const unsigned int gpu_ctl_def[] = { - 0x00000000, 0x01000000, 0x03000000, 0x04000000, - 0x05000800, 0x06c60260, 0x0703fc10, 0x08000027, -}; - -static const unsigned int gpu_data_def[] = { - 0xe100360b, 0xe2000000, 0xe3000800, 0xe4077e7f, - 0xe5001000, 0xe6000000, - 0x02000000, 0x00000000, 0x01ff03ff, -}; - -void BiosLikeGPUSetup() -{ - int i; - - for (i = 0; i < sizeof(gpu_ctl_def) / sizeof(gpu_ctl_def[0]); i++) - GPU_writeStatus(gpu_ctl_def[i]); - - for (i = 0; i < sizeof(gpu_data_def) / sizeof(gpu_data_def[0]); i++) - GPU_writeData(gpu_data_def[i]); - - HW_GPU_STATUS |= SWAP32(PSXGPU_nBUSY); -} - static void SetBootRegs(u32 pc, u32 gp, u32 sp) { //printf("%s %08x %08x %08x\n", __func__, pc, gp, sp); @@ -176,6 +152,10 @@ static void SetBootRegs(u32 pc, u32 gp, u32 sp) psxRegs.pc = pc; psxRegs.GPR.n.gp = gp; psxRegs.GPR.n.sp = sp ? sp : 0x801fff00; + psxRegs.GPR.n.fp = psxRegs.GPR.n.sp; + + psxRegs.GPR.n.t0 = psxRegs.GPR.n.sp; // mimic A(43) + psxRegs.GPR.n.t3 = pc; psxCpu->Notify(R3000ACPU_NOTIFY_AFTER_LOAD, NULL); } @@ -271,7 +251,7 @@ int LoadCdrom() { memcpy(&tmpHead, buf + 12, sizeof(EXE_HEADER)); - SysPrintf("manual booting '%s'\n", exename); + SysPrintf("manual booting '%s' pc=%x\n", exename, SWAP32(tmpHead.pc0)); sp = SWAP32(tmpHead.s_addr); if (cnf_stack) sp = cnf_stack; @@ -281,7 +261,7 @@ int LoadCdrom() { tmpHead.t_addr = SWAP32(tmpHead.t_addr); psxCpu->Clear(tmpHead.t_addr, tmpHead.t_size / 4); - psxCpu->Reset(); + //psxCpu->Reset(); // Read the rest of the main executable while (tmpHead.t_size & ~2047) { @@ -308,6 +288,9 @@ int LoadCdromFile(const char *filename, EXE_HEADER *head) { u32 size, addr; void *mem; + if (filename == INVALID_PTR) + return -1; + p1 = filename; if ((p2 = strchr(p1, ':'))) p1 = p2 + 1; @@ -331,11 +314,11 @@ int LoadCdromFile(const char *filename, EXE_HEADER *head) { READTRACK(); memcpy(head, buf + 12, sizeof(EXE_HEADER)); - size = head->t_size; - addr = head->t_addr; + size = SWAP32(head->t_size); + addr = SWAP32(head->t_addr); psxCpu->Clear(addr, size / 4); - psxCpu->Reset(); + //psxCpu->Reset(); while (size & ~2047) { incTime();