X-Git-Url: https://notaz.gp2x.de/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=libpcsxcore%2Fmisc.c;h=3d1647102104209aede928ef76ac91572ec6455a;hb=86c70511f865fa7b01fe0147f1c891b8fbc10a97;hp=252e1c8c7e77460766d94a897597603d396968e0;hpb=dc4fa8bcd7d8fb9ccd6c742a350f69e0683350e0;p=pcsx_rearmed.git diff --git a/libpcsxcore/misc.c b/libpcsxcore/misc.c index 252e1c8c..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) { @@ -304,10 +284,19 @@ int LoadCdromFile(const char *filename, EXE_HEADER *head) { u8 time[4],*buf; u8 mdir[4096]; char exename[256]; + const char *p1, *p2; u32 size, addr; void *mem; - sscanf(filename, "cdrom:\\%255s", exename); + if (filename == INVALID_PTR) + return -1; + + p1 = filename; + if ((p2 = strchr(p1, ':'))) + p1 = p2 + 1; + while (*p1 == '\\') + p1++; + snprintf(exename, sizeof(exename), "%s", p1); time[0] = itob(0); time[1] = itob(2); time[2] = itob(0x10); @@ -325,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();