+ return 0;
+}
+
+static void psxMemFreeMap(void)
+{
+ psxUnmap(psxM, 0x00210000, MAP_TAG_RAM); psxM = NULL;
+ psxUnmap(psxH, 0x10000, MAP_TAG_OTHER); psxH = NULL;
+ psxUnmap(psxR, 0x80000, MAP_TAG_OTHER); psxR = NULL;
+}
+
+int psxMemInit(void)
+{
+ unsigned int i;
+ int ret;
+
+ if (LIGHTREC_CUSTOM_MAP)
+ ret = lightrec_init_mmap();
+ else
+ ret = psxMemInitMap();
+ if (ret) {
+ SysMessage(_("Error allocating memory!"));
+ psxMemShutdown();
+ return -1;
+ }
+
+ psxMemRLUT = (u8 **)malloc(0x10000 * sizeof(void *));
+ psxMemWLUT = (u8 **)malloc(0x10000 * sizeof(void *));
+
+ if (psxMemRLUT == NULL || psxMemWLUT == NULL) {
+ SysMessage(_("Error allocating memory!"));
+ psxMemShutdown();
+ return -1;
+ }
+
+ memset(psxMemRLUT, 0xff, 0x10000 * sizeof(void *));
+ memset(psxMemWLUT, 0xff, 0x10000 * sizeof(void *));
+