diff --git a/BizHawk.Emulation.Cores/Computers/MSX/LibMSX.cs b/BizHawk.Emulation.Cores/Computers/MSX/LibMSX.cs index 3137f4e5aa..648ddcc81d 100644 --- a/BizHawk.Emulation.Cores/Computers/MSX/LibMSX.cs +++ b/BizHawk.Emulation.Cores/Computers/MSX/LibMSX.cs @@ -6,7 +6,7 @@ using System.Text; namespace BizHawk.Emulation.Cores.Computers.MSX { /// - /// static bindings into MSXHAWK.dll + /// static bindings into MSXHawk.dll /// public static class LibMSX { diff --git a/BizHawk.Emulation.Cores/Computers/MSX/MSX.IEmulator.cs b/BizHawk.Emulation.Cores/Computers/MSX/MSX.IEmulator.cs index 821df02750..2331e539aa 100644 --- a/BizHawk.Emulation.Cores/Computers/MSX/MSX.IEmulator.cs +++ b/BizHawk.Emulation.Cores/Computers/MSX/MSX.IEmulator.cs @@ -157,10 +157,10 @@ namespace BizHawk.Emulation.Cores.Computers.MSX return _vidbuffer; } - public int VirtualWidth => 160; - public int VirtualHeight => 144; - public int BufferWidth => 160; - public int BufferHeight => 144; + public int VirtualWidth => 256; + public int VirtualHeight => 192; + public int BufferWidth => 256; + public int BufferHeight => 192; public int BackgroundColor => unchecked((int)0xFF000000); public int VsyncNumerator => _frameHz; public int VsyncDenominator => 1; diff --git a/BizHawk.Emulation.Cores/Computers/MSX/MSX.cs b/BizHawk.Emulation.Cores/Computers/MSX/MSX.cs index 4f72453bae..f747c6afec 100644 --- a/BizHawk.Emulation.Cores/Computers/MSX/MSX.cs +++ b/BizHawk.Emulation.Cores/Computers/MSX/MSX.cs @@ -27,8 +27,6 @@ namespace BizHawk.Emulation.Cores.Computers.MSX Array.Resize(ref RomData, ((RomData.Length / BankSize) + 1) * BankSize); } - byte[] Bios = null; - byte[] Basic = null; Bios = comm.CoreFileProvider.GetFirmware("MSX", "bios", true, "BIOS Not Found, Cannot Load"); Basic = comm.CoreFileProvider.GetFirmware("MSX", "basic", true, "BIOS Not Found, Cannot Load"); @@ -68,8 +66,8 @@ namespace BizHawk.Emulation.Cores.Computers.MSX IntPtr MSX_Pntr { get; set; } = IntPtr.Zero; byte[] MSX_core = new byte[0x20000]; - public byte[] _bios; - public byte[] _basic; + public static byte[] Bios; + public static byte[] Basic; // Constants private const int BankSize = 16384; diff --git a/libHawk/MSXHawk/MSXHawk/MSXHawk.cpp b/libHawk/MSXHawk/MSXHawk/MSXHawk.cpp index a7753893df..e7432bbcfa 100644 --- a/libHawk/MSXHawk/MSXHawk/MSXHawk.cpp +++ b/libHawk/MSXHawk/MSXHawk/MSXHawk.cpp @@ -21,6 +21,10 @@ MSXHawk_EXPORT MSXCore* MSX_create() // free the memory from the core pointer MSXHawk_EXPORT void MSX_destroy(MSXCore* p) { + delete p->MemMap.bios_rom; + delete p->MemMap.basic_rom; + delete p->MemMap.rom_1; + delete p->MemMap.rom_2; std::free(p); } diff --git a/libHawk/MSXHawk/MSXHawk/Memory.h b/libHawk/MSXHawk/MSXHawk/Memory.h index 83dbf9089b..f296ff7f23 100644 --- a/libHawk/MSXHawk/MSXHawk/Memory.h +++ b/libHawk/MSXHawk/MSXHawk/Memory.h @@ -52,18 +52,27 @@ namespace MSXHawk void remap(); + // NOTE: only called from source when both are available and of correct size (0x4000) void Load_BIOS(uint8_t* bios, uint8_t* basic) { - bios_rom = bios; - basic_rom = basic; + bios_rom = new uint8_t[0x4000]; + basic_rom = new uint8_t[0x4000]; + + memcpy(bios_rom, bios, 0x4000); + memcpy(basic_rom, basic, 0x4000); } void Load_ROM(uint8_t* ext_rom_1, uint32_t ext_rom_size_1, uint32_t ext_rom_mapper_1, uint8_t* ext_rom_2, uint32_t ext_rom_size_2, uint32_t ext_rom_mapper_2) { - rom_1 = ext_rom_1; + rom_1 = new uint8_t[ext_rom_size_1]; + rom_2 = new uint8_t[ext_rom_size_2]; + + memcpy(rom_1, ext_rom_1, ext_rom_size_1); + memcpy(rom_2, ext_rom_2, ext_rom_size_2); + rom_size_1 = ext_rom_size_1 / 0x4000; rom_mapper_1 = ext_rom_mapper_1; - rom_2 = ext_rom_2; + rom_size_2 = ext_rom_size_2 / 0x4000; rom_mapper_2 = ext_rom_mapper_2;