Merge branch 'master' of https://git01.codeplex.com/forks/24kwakahana/addoptionforpsxexe into 24kwakahana/AddOptionForPsxExe

This commit is contained in:
edgbla 2016-10-22 18:28:28 +04:00
commit 50d3996251
2 changed files with 28 additions and 3 deletions

View file

@ -519,7 +519,9 @@ int Load(const char *ExePath) {
return retval;
}
static void LoadBin( unsigned long addr, char* filename ) {
static int LoadBin( unsigned long addr, char* filename ) {
int result = -1;
FILE *f;
long len;
unsigned long mem = addr & 0x001fffff;
@ -531,11 +533,21 @@ static void LoadBin( unsigned long addr, char* filename ) {
len = ftell(f);
fseek(f,0,SEEK_SET);
if( len + mem < 0x00200000 ) {
if( psxM )
fread(psxM + mem, len, 1, f);
if( psxM ) {
int readsize = fread(psxM + mem, len, 1, f);
if( readsize == len )
result = 0;
}
}
fclose(f);
}
if( result == 0 )
SysPrintf(_("ng Load Bin file: [0x%08x] : %s\n"), addr, filename );
else
SysPrintf(_("ok Load Bin file: [0x%08x] : %s\n"), addr, filename );
return result;
}
int LoadLdrFile(const char *LdrPath ) {

View file

@ -115,10 +115,21 @@ void psxMemReset() {
// Load BIOS
if (strcmp(Config.Bios, "HLE") != 0) {
/*
sprintf(temp, "%s/%s", Config.BiosDir, Config.Bios);
strcat( strcat( bios, GetAppPath() ), temp );
f = fopen(bios, "rb");
*/
//AppPath's priority is high.
const char* apppath = GetAppPath();
if( strlen(apppath) > 0 )
strcat( strcat( strcat( bios, GetAppPath() ), "bios\\"), Config.Bios );
else
sprintf(bios, "%s/%s", Config.BiosDir, Config.Bios);
f = fopen(bios, "rb");
if (f == NULL) {
SysMessage(_("Could not open BIOS:\"%s\". Enabling HLE Bios!\n"), bios);
@ -128,6 +139,8 @@ void psxMemReset() {
fread(psxR, 1, 0x80000, f);
fclose(f);
Config.HLE = FALSE;
SysPrintf(_("Loaded BIOS: %s\n"), bios );
}
} else Config.HLE = TRUE;
}