From 60cf0fcf61b20eed515819ecfd302c208ba88e57 Mon Sep 17 00:00:00 2001 From: "SND\\weimingzhi_cp" Date: Wed, 22 Sep 2010 01:50:23 +0000 Subject: only load the net yaroze library when running EXE. git-svn-id: https://pcsxr.svn.codeplex.com/svn/pcsxr@57503 e17a0e51-4ae3-4d35-97c3-1a29b211df97 --- libpcsxcore/gpu.h | 17 ++++++++++++++++ libpcsxcore/misc.c | 17 ++++++++++++++++ libpcsxcore/psxcommon.c | 17 ---------------- libpcsxcore/psxdma.h | 4 +--- libpcsxcore/psxmem.c | 52 ++++++++++++++++++++++++------------------------- 5 files changed, 61 insertions(+), 46 deletions(-) (limited to 'libpcsxcore') diff --git a/libpcsxcore/gpu.h b/libpcsxcore/gpu.h index 429dd3a2..fd02701d 100644 --- a/libpcsxcore/gpu.h +++ b/libpcsxcore/gpu.h @@ -1 +1,18 @@ +#ifndef __GPU_H__ +#define __GPU_H__ + +#ifdef __cplusplus +extern "C" +{ +#endif + int gpuReadStatus(); + +void psxDma2(u32 madr, u32 bcr, u32 chcr); +void gpuInterrupt(); + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/libpcsxcore/misc.c b/libpcsxcore/misc.c index 8b9780f6..ef315214 100644 --- a/libpcsxcore/misc.c +++ b/libpcsxcore/misc.c @@ -372,6 +372,21 @@ static int PSXGetFileType(FILE *f) { return INVALID_EXE; } +static void LoadLibPS() { + char buf[MAXPATHLEN]; + FILE *f; + + // Load Net Yaroze runtime library (if exists) + sprintf(buf, "%s/libps.exe", Config.BiosDir); + f = fopen(buf, "rb"); + + if (f != NULL) { + fseek(f, 0x800, SEEK_SET); + fread(psxM + 0x10000, 0x61000, 1, f); + fclose(f); + } +} + int Load(const char *ExePath) { FILE *tmpFile; EXE_HEADER tmpHead; @@ -388,6 +403,8 @@ int Load(const char *ExePath) { SysPrintf(_("Error opening file: %s.\n"), ExePath); retval = -1; } else { + LoadLibPS(); + type = PSXGetFileType(tmpFile); switch (type) { case PSX_EXE: diff --git a/libpcsxcore/psxcommon.c b/libpcsxcore/psxcommon.c index 797625a7..f118c2db 100644 --- a/libpcsxcore/psxcommon.c +++ b/libpcsxcore/psxcommon.c @@ -34,28 +34,11 @@ int EmuInit() { return psxInit(); } -static void LoadLibPS() { - char buf[MAXPATHLEN]; - FILE *f; - - // Load Net Yaroze runtime library (if exists) - sprintf(buf, "%s/libps.exe", Config.BiosDir); - f = fopen(buf, "rb"); - - if (f != NULL) { - fseek(f, 0x800, SEEK_SET); - fread(psxM + 0x10000, 0x61000, 1, f); - fclose(f); - } -} - void EmuReset() { FreeCheatSearchResults(); FreeCheatSearchMem(); psxReset(); - - LoadLibPS(); } void EmuShutdown() { diff --git a/libpcsxcore/psxdma.h b/libpcsxcore/psxdma.h index 326e5d42..d356995d 100644 --- a/libpcsxcore/psxdma.h +++ b/libpcsxcore/psxdma.h @@ -62,12 +62,10 @@ extern "C" { /* DMA5 = N/A (PIO) */ - -void psxDma2(u32 madr, u32 bcr, u32 chcr); + void psxDma3(u32 madr, u32 bcr, u32 chcr); void psxDma4(u32 madr, u32 bcr, u32 chcr); void psxDma6(u32 madr, u32 bcr, u32 chcr); -void gpuInterrupt(); void spuInterrupt(); void mdec0Interrupt(); void gpuotcInterrupt(); diff --git a/libpcsxcore/psxmem.c b/libpcsxcore/psxmem.c index aa405ca6..feb69b4f 100644 --- a/libpcsxcore/psxmem.c +++ b/libpcsxcore/psxmem.c @@ -111,7 +111,7 @@ void psxMemReset() { memset(psxM, 0, 0x00200000); memset(psxP, 0, 0x00010000); - + // Load BIOS if (strcmp(Config.Bios, "HLE") != 0) { sprintf(bios, "%s/%s", Config.BiosDir, Config.Bios); @@ -126,7 +126,7 @@ void psxMemReset() { fclose(f); Config.HLE = FALSE; } - } else Config.HLE = TRUE; + } else Config.HLE = TRUE; } void psxMemShutdown() { @@ -141,10 +141,10 @@ static int writeok = 1; u8 psxMemRead8(u32 mem) { char *p; - u32 t; - - - psxRegs.cycle += 2; + u32 t; + + + psxRegs.cycle += 2; t = mem >> 16; @@ -172,10 +172,10 @@ u16 psxMemRead16(u32 mem) { char *p; u32 t; - - psxRegs.cycle += 2; - - + + psxRegs.cycle += 2; + + t = mem >> 16; if (t == 0x1f80) { if (mem < 0x1f801000) @@ -201,10 +201,10 @@ u32 psxMemRead32(u32 mem) { char *p; u32 t; - - psxRegs.cycle += 2; - - + + psxRegs.cycle += 2; + + t = mem >> 16; if (t == 0x1f80) { if (mem < 0x1f801000) @@ -230,10 +230,10 @@ void psxMemWrite8(u32 mem, u8 value) { char *p; u32 t; - - psxRegs.cycle += 2; - - + + psxRegs.cycle += 2; + + t = mem >> 16; if (t == 0x1f80) { if (mem < 0x1f801000) @@ -261,10 +261,10 @@ void psxMemWrite16(u32 mem, u16 value) { char *p; u32 t; - - psxRegs.cycle += 2; - - + + psxRegs.cycle += 2; + + t = mem >> 16; if (t == 0x1f80) { if (mem < 0x1f801000) @@ -292,10 +292,10 @@ void psxMemWrite32(u32 mem, u32 value) { char *p; u32 t; - - psxRegs.cycle += 2; - - + + psxRegs.cycle += 2; + + // if ((mem&0x1fffff) == 0x71E18 || value == 0x48088800) SysPrintf("t2fix!!\n"); t = mem >> 16; if (t == 0x1f80) { -- cgit v1.2.3