diff --git a/BizHawk.Emulation.Cores/Consoles/NEC/PCFX/Tst.cs b/BizHawk.Emulation.Cores/Consoles/NEC/PCFX/Tst.cs index 1eda213036..ae28d2e614 100644 --- a/BizHawk.Emulation.Cores/Consoles/NEC/PCFX/Tst.cs +++ b/BizHawk.Emulation.Cores/Consoles/NEC/PCFX/Tst.cs @@ -67,11 +67,11 @@ namespace BizHawk.Emulation.Cores.Consoles.NEC.PCFX _core = PreInit(new PeRunnerOptions { Filename = "pcfx.wbx", - SbrkHeapSizeKB = 1024, - SealedHeapSizeKB = 4 * 1024, - InvisibleHeapSizeKB = 256, - PlainHeapSizeKB = 256, - MmapHeapSizeKB = 32 * 1024 + SbrkHeapSizeKB = 512, + SealedHeapSizeKB = 2 * 1024, + InvisibleHeapSizeKB = 4, + PlainHeapSizeKB = 4 * 1024, + MmapHeapSizeKB = 6 * 1024, }); SetCdCallbacks(); diff --git a/output/dll/pcfx.wbx.gz b/output/dll/pcfx.wbx.gz new file mode 100644 index 0000000000..a8d7576f4a Binary files /dev/null and b/output/dll/pcfx.wbx.gz differ diff --git a/waterbox/pcfx/.vscode/settings.json b/waterbox/pcfx/.vscode/settings.json index f561493b2c..ed2aea06d3 100644 --- a/waterbox/pcfx/.vscode/settings.json +++ b/waterbox/pcfx/.vscode/settings.json @@ -7,6 +7,9 @@ "*.inc": "cpp", "system_error": "cpp", "ios": "cpp", - "xiosbase": "cpp" + "xiosbase": "cpp", + "iosfwd": "cpp", + "xlocale": "cpp", + "xstring": "cpp" } } \ No newline at end of file diff --git a/waterbox/pcfx/Makefile b/waterbox/pcfx/Makefile index 3ff8fb18d8..9959b47ad4 100644 --- a/waterbox/pcfx/Makefile +++ b/waterbox/pcfx/Makefile @@ -4,7 +4,7 @@ CCFLAGS:= -I. -I../emulibc \ -Wall -Werror=pointer-to-int-cast -Werror=int-to-pointer-cast -Werror=implicit-function-declaration \ -std=c++0x -fomit-frame-pointer -fvisibility=hidden -fno-exceptions -fno-rtti \ -DLSB_FIRST \ - -O0 -g + -O3 -flto TARGET = pcfx.wbx @@ -29,8 +29,8 @@ $(TARGET).in: $(OBJS) @$(CC) -o $@ $(LDFLAGS) $(CCFLAGS) $(OBJS) ../emulibc/libemuhost.so $(TARGET): $(TARGET).in -# strip $< -o $@ -R /4 -R /14 -R /29 -R /41 -R /55 -R /67 -R /78 -R /89 -R /104 - cp $< $@ + strip $< -o $@ -R /4 -R /14 -R /29 -R /41 -R /55 -R /67 -R /78 -R /89 -R /104 +# cp $< $@ clean: rm -rf $(OBJ_DIR) diff --git a/waterbox/pcfx/pcfx.cpp b/waterbox/pcfx/pcfx.cpp index f9c3ec2bb4..96623ed54f 100644 --- a/waterbox/pcfx/pcfx.cpp +++ b/waterbox/pcfx/pcfx.cpp @@ -343,8 +343,8 @@ static MDFN_COLD void LoadCommon(std::vector *CDInterfaces, const uint8_ uint32 RAM_Map_Addresses[1] = {0x00000000}; uint32 BIOSROM_Map_Addresses[1] = {0xFFF00000}; - RAM = PCFX_V810.SetFastMap(RAM_Map_Addresses, 0x00200000, 1, _("RAM")); - BIOSROM = PCFX_V810.SetFastMap(BIOSROM_Map_Addresses, 0x00100000, 1, _("BIOS ROM")); + RAM = PCFX_V810.SetFastMap(RAM_Map_Addresses, 0x00200000, 1, _("RAM"), true); + BIOSROM = PCFX_V810.SetFastMap(BIOSROM_Map_Addresses, 0x00100000, 1, _("BIOS ROM"), false); memcpy(BIOSROM, bios, 1024 * 1024); @@ -356,7 +356,7 @@ static MDFN_COLD void LoadCommon(std::vector *CDInterfaces, const uint8_ FileStream FXSCSIFile(fxscsi_path, FileStream::MODE_READ); uint32 FXSCSI_Map_Addresses[1] = {0x80780000}; - FXSCSIROM = PCFX_V810.SetFastMap(FXSCSI_Map_Addresses, 0x0080000, 1, _("FX-SCSI ROM")); + FXSCSIROM = PCFX_V810.SetFastMap(FXSCSI_Map_Addresses, 0x0080000, 1, _("FX-SCSI ROM"), false); FXSCSIFile.read(FXSCSIROM, 1024 * 512); } diff --git a/waterbox/pcfx/v810/v810_cpu.cpp b/waterbox/pcfx/v810/v810_cpu.cpp index 94d326708b..0fd018cfc8 100644 --- a/waterbox/pcfx/v810/v810_cpu.cpp +++ b/waterbox/pcfx/v810/v810_cpu.cpp @@ -42,6 +42,7 @@ found freely through public domain sources. // CPU routines #include "../defs.h" +#include "../emulibc/emulibc.h" //#include "pcfx.h" //#include "debug.h" @@ -87,7 +88,6 @@ V810::V810() V810::~V810() { - Kill(); } INLINE void V810::RecalcIPendingCache(void) @@ -354,11 +354,6 @@ bool V810::Init(V810_Emu_Mode mode, bool vb_mode) return (TRUE); } -void V810::Kill(void) -{ - FastMapAllocList.clear(); -} - void V810::SetInt(int level) { assert(level >= -1 && level <= 15); @@ -367,7 +362,7 @@ void V810::SetInt(int level) RecalcIPendingCache(); } -uint8 *V810::SetFastMap(uint32 addresses[], uint32 length, unsigned int num_addresses, const char *name) +uint8 *V810::SetFastMap(uint32 addresses[], uint32 length, unsigned int num_addresses, const char *name, bool writable) { for (unsigned int i = 0; i < num_addresses; i++) { @@ -375,8 +370,7 @@ uint8 *V810::SetFastMap(uint32 addresses[], uint32 length, unsigned int num_addr } assert((length & (V810_FAST_MAP_PSIZE - 1)) == 0); - FastMapAllocList.emplace_back(std::unique_ptr(new uint8[length + V810_FAST_MAP_TRAMPOLINE_SIZE])); - uint8 *ret = FastMapAllocList.back().get(); + uint8 *ret = (uint8 *)(writable ? alloc_plain(length + V810_FAST_MAP_TRAMPOLINE_SIZE) : alloc_sealed(length + V810_FAST_MAP_TRAMPOLINE_SIZE)); for (unsigned int i = length; i < length + V810_FAST_MAP_TRAMPOLINE_SIZE; i += 2) { diff --git a/waterbox/pcfx/v810/v810_cpu.h b/waterbox/pcfx/v810/v810_cpu.h index dff584bbe4..1e3166a64e 100644 --- a/waterbox/pcfx/v810/v810_cpu.h +++ b/waterbox/pcfx/v810/v810_cpu.h @@ -160,7 +160,7 @@ class V810 void SetIOWriteHandlers(void MDFN_FASTCALL (*write8)(v810_timestamp_t &, uint32, uint8), void MDFN_FASTCALL (*write16)(v810_timestamp_t &, uint32, uint16), void MDFN_FASTCALL (*write32)(v810_timestamp_t &, uint32, uint32)) MDFN_COLD; // Length specifies the number of bytes to map in, at each location specified by addresses[] (for mirroring) - uint8 *SetFastMap(uint32 addresses[], uint32 length, unsigned int num_addresses, const char *name) MDFN_COLD; + uint8 *SetFastMap(uint32 addresses[], uint32 length, unsigned int num_addresses, const char *name, bool writable) MDFN_COLD; INLINE void ResetTS(v810_timestamp_t new_base_timestamp) { @@ -311,8 +311,6 @@ class V810 bool have_src_cache, have_dst_cache; uint8 *FastMap[(1ULL << 32) / V810_FAST_MAP_PSIZE]; - std::vector> FastMapAllocList; - #ifdef WANT_DEBUGGER void (*CPUHook)(const v810_timestamp_t timestamp, uint32 PC);