From 11504d854a44435f1d80d760161b7e04c1d9d7eb Mon Sep 17 00:00:00 2001 From: "SND\\weimingzhi_cp" Date: Wed, 19 Jan 2011 03:59:33 +0000 Subject: [PATCH] notaz: - fix firstfile() return value - it should only return dir when finds a match, and bufile macro already does that. (Patch #8118). - firstfile delivers an event on real bios, so do that (Patch #8119). - implement psxBios__card_chan (Patch #8120). git-svn-id: https://pcsxr.svn.codeplex.com/svn/pcsxr@62183 e17a0e51-4ae3-4d35-97c3-1a29b211df97 --- AUTHORS | 1 + libpcsxcore/psxbios.c | 30 ++++++++++++++++++++++-------- 2 files changed, 23 insertions(+), 8 deletions(-) diff --git a/AUTHORS b/AUTHORS index 3ca14b53..45339648 100644 --- a/AUTHORS +++ b/AUTHORS @@ -28,6 +28,7 @@ PCSX-Reloaded Authors/Contributors: avlex (Help on xcode project) Gabriele Gorla (MDEC decoder) maggix (Snow Leopard compile fix) NeToU (Bugfix) + notaz (Various psxbios fixes) Peter Collingbourne (Various core/psxbios fixes) siveritas (Bugfix) shalma (GTE Divider, many core improvements, sound plugin fixes) diff --git a/libpcsxcore/psxbios.c b/libpcsxcore/psxbios.c index f77b809e..c10f8a1b 100644 --- a/libpcsxcore/psxbios.c +++ b/libpcsxcore/psxbios.c @@ -21,8 +21,6 @@ * Internal simulated HLE BIOS. */ -// TODO: implement all system calls, count the exact CPU cycles of system calls. - #include "psxbios.h" #include "psxhw.h" @@ -256,6 +254,7 @@ static int CardState = -1; static TCB Thread[8]; static int CurThread = 0; static FileDesc FDesc[32]; +static u32 card_active_chan = 0; boolean hleSoftCall = FALSE; @@ -1239,6 +1238,8 @@ void psxBios__card_info() { // ab PSXBIOS_LOG("psxBios_%s: %x\n", biosA0n[0xab], a0); #endif + card_active_chan = a0; + // DeliverEvent(0x11, 0x2); // 0xf0000011, 0x0004 DeliverEvent(0x81, 0x2); // 0xf4000001, 0x0004 @@ -1250,6 +1251,8 @@ void psxBios__card_load() { // ac PSXBIOS_LOG("psxBios_%s: %x\n", biosA0n[0xac], a0); #endif + card_active_chan = a0; + // DeliverEvent(0x11, 0x2); // 0xf0000011, 0x0004 DeliverEvent(0x81, 0x2); // 0xf4000001, 0x0004 @@ -1868,13 +1871,12 @@ void psxBios_firstfile() { // 42 nfile = 1; if (!strncmp(Ra0, "bu00", 4)) { bufile(1); - v0 = _dir; + } else if (!strncmp(Ra0, "bu10", 4)) { + bufile(2); } - if (!strncmp(Ra0, "bu10", 4)) { - bufile(2); - v0 = _dir; - } + // firstfile() calls _card_read() internally, so deliver it's event + DeliverEvent(0x11, 0x2); pc0 = ra; } @@ -2024,6 +2026,7 @@ void psxBios__card_write() { // 0x4e PSXBIOS_LOG("psxBios_%s: %x,%x,%x\n", biosB0n[0x4e], a0, a1, a2); #endif + card_active_chan = a0; port = a0 >> 4; if (port == 0) { @@ -2047,6 +2050,7 @@ void psxBios__card_read() { // 0x4f PSXBIOS_LOG("psxBios_%s\n", biosB0n[0x4f]); #endif + card_active_chan = a0; port = a0 >> 4; if (port == 0) { @@ -2128,6 +2132,15 @@ void psxBios_GetB0Table() { // 57 v0 = 0x874; pc0 = ra; } +void psxBios__card_chan() { // 0x58 +#ifdef PSXBIOS_LOG + PSXBIOS_LOG("psxBios_%s\n", biosB0n[0x58]); +#endif + + v0 = card_active_chan; + pc0 = ra; +} + void psxBios_ChangeClearPad() { // 5b #ifdef PSXBIOS_LOG PSXBIOS_LOG("psxBios_%s: %x\n", biosB0n[0x5b], a0); @@ -2485,7 +2498,7 @@ void psxBiosInit() { //biosB0[0x55] = psxBios__get_error; biosB0[0x56] = psxBios_GetC0Table; biosB0[0x57] = psxBios_GetB0Table; - //biosB0[0x58] = psxBios__card_chan; + biosB0[0x58] = psxBios__card_chan; //biosB0[0x59] = psxBios_sys_b0_59; //biosB0[0x5a] = psxBios_sys_b0_5a; biosB0[0x5b] = psxBios_ChangeClearPad; @@ -2820,4 +2833,5 @@ void psxBiosFreeze(int Mode) { bfreezes(Thread); bfreezel(&CurThread); bfreezes(FDesc); + bfreezel(&card_active_chan); }