notaz.gp2x.de
/
pcsx_rearmed.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Implement fix from Mednafen for Fantastic Pinball Kyuutenkai.
[pcsx_rearmed.git]
/
libpcsxcore
/
psxmem.c
diff --git
a/libpcsxcore/psxmem.c
b/libpcsxcore/psxmem.c
index
caa0d65
..
2f427ac
100644
(file)
--- a/
libpcsxcore/psxmem.c
+++ b/
libpcsxcore/psxmem.c
@@
-31,10
+31,20
@@
#include "memmap.h"
#include "memmap.h"
+#ifdef USE_LIBRETRO_VFS
+#include <streams/file_stream_transforms.h>
+#endif
+
#ifndef MAP_ANONYMOUS
#define MAP_ANONYMOUS MAP_ANON
#endif
#ifndef MAP_ANONYMOUS
#define MAP_ANONYMOUS MAP_ANON
#endif
+#ifndef NDEBUG
+#include "debug.h"
+#else
+void DebugCheckBP(u32 address, enum breakpoint_types type) {}
+#endif
+
void *(*psxMapHook)(unsigned long addr, size_t size, int is_fixed,
enum psxMapTag tag);
void (*psxUnmapHook)(void *ptr, size_t size, enum psxMapTag tag);
void *(*psxMapHook)(unsigned long addr, size_t size, int is_fixed,
enum psxMapTag tag);
void (*psxUnmapHook)(void *ptr, size_t size, enum psxMapTag tag);
@@
-42,7
+52,16
@@
void (*psxUnmapHook)(void *ptr, size_t size, enum psxMapTag tag);
void *psxMap(unsigned long addr, size_t size, int is_fixed,
enum psxMapTag tag)
{
void *psxMap(unsigned long addr, size_t size, int is_fixed,
enum psxMapTag tag)
{
+#ifdef LIGHTREC
+#ifdef MAP_FIXED_NOREPLACE
+ int flags = MAP_PRIVATE | MAP_ANONYMOUS | MAP_FIXED_NOREPLACE;
+#else
int flags = MAP_PRIVATE | MAP_ANONYMOUS | MAP_FIXED;
int flags = MAP_PRIVATE | MAP_ANONYMOUS | MAP_FIXED;
+#endif
+#else
+ int flags = MAP_PRIVATE | MAP_ANONYMOUS;
+#endif
+
int try_ = 0;
unsigned long mask;
void *req, *ret;
int try_ = 0;
unsigned long mask;
void *req, *ret;
@@
-135,7
+154,14
@@
int psxMemInit() {
memset(psxMemRLUT, 0, 0x10000 * sizeof(void *));
memset(psxMemWLUT, 0, 0x10000 * sizeof(void *));
memset(psxMemRLUT, 0, 0x10000 * sizeof(void *));
memset(psxMemWLUT, 0, 0x10000 * sizeof(void *));
+#ifdef LIGHTREC
psxM = psxMap(0x30000000, 0x00210000, 1, MAP_TAG_RAM);
psxM = psxMap(0x30000000, 0x00210000, 1, MAP_TAG_RAM);
+ if (psxM == NULL)
+ psxM = psxMap(0x70000000, 0x00210000, 1, MAP_TAG_RAM);
+
+#else
+ psxM = psxMap(0x80000000, 0x00210000, 1, MAP_TAG_RAM);
+#endif
#ifndef RAM_FIXED
if (psxM == NULL)
psxM = psxMap(0x77000000, 0x00210000, 0, MAP_TAG_RAM);
#ifndef RAM_FIXED
if (psxM == NULL)
psxM = psxMap(0x77000000, 0x00210000, 0, MAP_TAG_RAM);
@@
-146,8
+172,18
@@
int psxMemInit() {
}
psxP = &psxM[0x200000];
}
psxP = &psxM[0x200000];
+#ifdef LIGHTREC
psxH = psxMap(0x4f800000, 0x10000, 0, MAP_TAG_OTHER);
psxH = psxMap(0x4f800000, 0x10000, 0, MAP_TAG_OTHER);
+ if (psxH == NULL)
+ psxH = psxMap(0x8f800000, 0x10000, 0, MAP_TAG_OTHER);
+
psxR = psxMap(0x4fc00000, 0x80000, 0, MAP_TAG_OTHER);
psxR = psxMap(0x4fc00000, 0x80000, 0, MAP_TAG_OTHER);
+ if (psxR == NULL)
+ psxR = psxMap(0x8fc00000, 0x80000, 0, MAP_TAG_OTHER);
+#else
+ psxH = psxMap(0x1f800000, 0x10000, 0, MAP_TAG_OTHER);
+ psxR = psxMap(0x1fc00000, 0x80000, 0, MAP_TAG_OTHER);
+#endif
if (psxMemRLUT == NULL || psxMemWLUT == NULL ||
psxR == NULL || psxP == NULL || psxH == NULL) {
if (psxMemRLUT == NULL || psxMemWLUT == NULL ||
psxR == NULL || psxP == NULL || psxH == NULL) {
@@
-189,6
+225,8
@@
void psxMemReset() {
memset(psxM, 0, 0x00200000);
memset(psxP, 0xff, 0x00010000);
memset(psxM, 0, 0x00200000);
memset(psxP, 0xff, 0x00010000);
+ Config.HLE = TRUE;
+
if (strcmp(Config.Bios, "HLE") != 0) {
sprintf(bios, "%s/%s", Config.BiosDir, Config.Bios);
f = fopen(bios, "rb");
if (strcmp(Config.Bios, "HLE") != 0) {
sprintf(bios, "%s/%s", Config.BiosDir, Config.Bios);
f = fopen(bios, "rb");
@@
-196,13
+234,15
@@
void psxMemReset() {
if (f == NULL) {
SysMessage(_("Could not open BIOS:\"%s\". Enabling HLE Bios!\n"), bios);
memset(psxR, 0, 0x80000);
if (f == NULL) {
SysMessage(_("Could not open BIOS:\"%s\". Enabling HLE Bios!\n"), bios);
memset(psxR, 0, 0x80000);
- Config.HLE = TRUE;
} else {
} else {
- fread(psxR, 1, 0x80000, f);
+ if (fread(psxR, 1, 0x80000, f) == 0x80000) {
+ Config.HLE = FALSE;
+ } else {
+ SysMessage(_("The selected BIOS:\"%s\" is of wrong size. Enabling HLE Bios!\n"), bios);
+ }
fclose(f);
fclose(f);
- Config.HLE = FALSE;
}
}
- }
else Config.HLE = TRUE;
+ }
}
void psxMemShutdown() {
}
void psxMemShutdown() {