aboutsummaryrefslogtreecommitdiff
path: root/libpcsxcore
diff options
context:
space:
mode:
authornotaz2012-11-13 01:27:47 +0200
committernotaz2012-11-13 01:27:47 +0200
commit96bef96ff61e7dae69cc793c310fcbf2698a38db (patch)
treea40ec9d2f23749939d1f49cca11ee2756440b8d3 /libpcsxcore
parentd5c08ed34ac422bafb933eed8ef5a30e8ed2dc5e (diff)
downloadpcsx_rearmed-96bef96ff61e7dae69cc793c310fcbf2698a38db.tar.gz
pcsx_rearmed-96bef96ff61e7dae69cc793c310fcbf2698a38db.tar.bz2
pcsx_rearmed-96bef96ff61e7dae69cc793c310fcbf2698a38db.zip
workaround pandora hugetlb bug, revert this later
Diffstat (limited to 'libpcsxcore')
-rw-r--r--libpcsxcore/misc.c20
1 files changed, 18 insertions, 2 deletions
diff --git a/libpcsxcore/misc.c b/libpcsxcore/misc.c
index aee6e3c..27b9499 100644
--- a/libpcsxcore/misc.c
+++ b/libpcsxcore/misc.c
@@ -409,6 +409,22 @@ static int PSXGetFileType(FILE *f) {
return INVALID_EXE;
}
+// temporary pandora workaround..
+// FIXME: remove
+size_t fread_to_ram(void *ptr, size_t size, size_t nmemb, FILE *stream)
+{
+ void *tmp;
+ size_t ret = 0;
+
+ tmp = malloc(size * nmemb);
+ if (tmp) {
+ ret = fread(tmp, size, nmemb, stream);
+ memcpy(ptr, tmp, size * nmemb);
+ free(tmp);
+ }
+ return ret;
+}
+
int Load(const char *ExePath) {
FILE *tmpFile;
EXE_HEADER tmpHead;
@@ -435,7 +451,7 @@ int Load(const char *ExePath) {
mem = PSXM(section_address);
if (mem != NULL) {
fseek(tmpFile, 0x800, SEEK_SET);
- fread(mem, section_size, 1, tmpFile);
+ fread_to_ram(mem, section_size, 1, tmpFile);
psxCpu->Clear(section_address, section_size / 4);
}
fclose(tmpFile);
@@ -461,7 +477,7 @@ int Load(const char *ExePath) {
#endif
mem = PSXM(section_address);
if (mem != NULL) {
- fread(mem, section_size, 1, tmpFile);
+ fread_to_ram(mem, section_size, 1, tmpFile);
psxCpu->Clear(section_address, section_size / 4);
}
break;