diff --git a/.gitmodules b/.gitmodules index 1a7f6dd4ac..727d674d00 100644 --- a/.gitmodules +++ b/.gitmodules @@ -31,9 +31,6 @@ [submodule "waterbox/llvm-project"] path = waterbox/llvm-project url = https://github.com/llvm/llvm-project.git -[submodule "waterbox/dobie/dobiestation"] - path = waterbox/dobie/dobiestation - url = https://github.com/nattthebear/DobieStation.git [submodule "submodules/libdarm"] path = submodules/libdarm url = https://github.com/jbremer/darm.git diff --git a/README.md b/README.md index df8c640656..0a63ea6a75 100644 --- a/README.md +++ b/README.md @@ -315,7 +315,6 @@ There are also works-in-progress for: * Amstrad CPC (home-grown core) * Fairchild Channel F (home-grown core) * [MAME](https://mamedev.org) -* Playstation 2 via [Dobiestation](https://github.com/PSI-Rockin/DobieStation) * others maybe ([candidates](https://gitlab.com/TASVideos/BizHawk/snippets/1890492)) Please don't bother core devs about these WIPs unless you're looking to contribute in some way. diff --git a/src/BizHawk.Client.EmuHawk/MainForm.Events.cs b/src/BizHawk.Client.EmuHawk/MainForm.Events.cs index 6128b4ca85..ab1d69bed5 100644 --- a/src/BizHawk.Client.EmuHawk/MainForm.Events.cs +++ b/src/BizHawk.Client.EmuHawk/MainForm.Events.cs @@ -61,7 +61,6 @@ using BizHawk.Emulation.Cores.Nintendo.SubNESHawk; using BizHawk.Emulation.Cores.PCEngine; using BizHawk.Emulation.Cores.Sega.GGHawkLink; using BizHawk.Emulation.Cores.Sega.MasterSystem; -using BizHawk.Emulation.Cores.Sony.PS2; using BizHawk.Emulation.Cores.Sony.PSX; using BizHawk.Emulation.Cores.Waterbox; using BizHawk.Emulation.Cores.WonderSwan; @@ -2805,9 +2804,6 @@ namespace BizHawk.Client.EmuHawk // Cygne items.Add(CreateCoreSubmenu(VSystemCategory.Handhelds, CoreNames.Cygne, CreateGenericCoreConfigItem(CoreNames.Cygne))); - // DobieStation - items.Add(CreateCoreSubmenu(VSystemCategory.Consoles, CoreNames.DobieStation, CreateGenericCoreConfigItem(CoreNames.DobieStation))); - // Emu83 items.Add(CreateCoreSubmenu(VSystemCategory.Other, CoreNames.Emu83, CreateSettingsItem("Palette...", (_, _) => OpenTI83PaletteSettingsDialog(GetSettingsAdapterFor())))); diff --git a/src/BizHawk.Emulation.Cores/Consoles/Sony/PS2/DobieStation.cs b/src/BizHawk.Emulation.Cores/Consoles/Sony/PS2/DobieStation.cs deleted file mode 100644 index a199d583eb..0000000000 --- a/src/BizHawk.Emulation.Cores/Consoles/Sony/PS2/DobieStation.cs +++ /dev/null @@ -1,201 +0,0 @@ -using System; -using System.Runtime.InteropServices; -using BizHawk.Common; -using BizHawk.Emulation.Common; -using BizHawk.Emulation.Cores.Waterbox; -using BizHawk.Emulation.DiscSystem; - -namespace BizHawk.Emulation.Cores.Sony.PS2 -{ - [PortedCore(CoreNames.DobieStation, "PSI", "fa33778b056aa32", "https://github.com/PSI-Rockin/DobieStation", isReleased: false)] - public unsafe class DobieStation : WaterboxCore, ISettable - { - private readonly LibDobieStation _core; - [CoreConstructor(VSystemID.Raw.PS2)] - public DobieStation(CoreLoadParameters lp) - :base(lp.Comm, new Configuration - { - MaxWidth = 640, - MaxHeight = 480, - DefaultWidth = 640, - DefaultHeight = 480, - DefaultFpsNumerator = 294912000, - DefaultFpsDenominator = 4920115, - MaxSamples = 1024, - SystemId = VSystemID.Raw.PS2, - }) - { - if (lp.Discs.Count != 1) - { - throw new InvalidOperationException("Must load a CD or DVD with PS2 core!"); - } - ControllerDefinition = DualShock; - _syncSettings = lp.SyncSettings ?? new DobieSyncSettings(); - _syncSettingsActual = lp.SyncSettings ?? new DobieSyncSettings(); - - _disc = new DiscSectorReader(lp.Discs[0].DiscData); - _cdCallback = ReadCd; - _core = PreInit(new WaterboxOptions - { - Filename = "dobie.wbx", - SbrkHeapSizeKB = 64 * 1024, - SealedHeapSizeKB = 4 * 1024, - InvisibleHeapSizeKB = 4 * 1024, - PlainHeapSizeKB = 256, - MmapHeapSizeKB = 2 * 1024 * 1024, - SkipCoreConsistencyCheck = lp.Comm.CorePreferences.HasFlag(CoreComm.CorePreferencesFlags.WaterboxCoreConsistencyCheck), - SkipMemoryConsistencyCheck = lp.Comm.CorePreferences.HasFlag(CoreComm.CorePreferencesFlags.WaterboxMemoryConsistencyCheck), - }, new[] { _cdCallback }); - - var bios = lp.Comm.CoreFileProvider.GetFirmwareOrThrow(new("PS2", "BIOS")); - _exe.AddReadonlyFile(new byte[0x840000], "MEMCARD0"); - - var worked = _core.Initialize(bios, - (ulong)(lp.Discs[0].DiscData.Session1.Tracks[2].LBA - lp.Discs[0].DiscData.Session1.Tracks[1].LBA) * 2048, - _cdCallback, - _syncSettingsActual.GetNativeSettings() - ); - - if (!worked) - { - throw new InvalidOperationException("Initialize failed!"); - } - - _exe.RemoveReadonlyFile("MEMCARD0"); - - PostInit(); - - _resampler = new SpeexResampler((SpeexResampler.Quality)6, 480, 441, 48000, 44100, null, this); - _serviceProvider.Register(_resampler); - } - - private SpeexResampler _resampler; - - public override void Dispose() - { - base.Dispose(); - if (_resampler != null) - { - _resampler.Dispose(); - _resampler = null; - } - } - - private readonly LibDobieStation.CdCallback _cdCallback; - private readonly DiscSectorReader _disc; - private void ReadCd(ulong sector, byte* dest) - { - var tmp = new byte[2048]; - _disc.ReadLBA_2048((int)sector, tmp, 0); - Marshal.Copy(tmp, 0, (IntPtr)dest, 2048); - } - - protected override LibWaterboxCore.FrameInfo FrameAdvancePrep(IController controller, bool render, bool rendersound) - { - var ret = new LibDobieStation.FrameInfo(); - for (int i = 0; i < DualShock.BoolButtons.Count; i++) - { - if (controller.IsPressed(DualShock.BoolButtons[i])) - { - ret.Buttons |= 1u << i; - } - } - for (int i = 0; i < DualShock.Axes.Count; i++) - { - ret.Axes |= (uint)controller.AxisValue(DualShock.Axes[i]) << (i * 8); - } - return ret; - } - protected override void FrameAdvancePost() - { - // DobieStation core kicks back 0 values sometimes. Not sure what they mean, no image produced? - // Easiest to just fix them here. - if (BufferWidth == 0) - BufferWidth = 640; - if (BufferHeight == 0) - BufferHeight = 480; - } - - public object GetSettings() => new object(); - public PutSettingsDirtyBits PutSettings(object o) => PutSettingsDirtyBits.None; - - private DobieSyncSettings _syncSettings; - private readonly DobieSyncSettings _syncSettingsActual; - - public DobieSyncSettings GetSyncSettings() - { - return _syncSettings.Clone(); - } - - public PutSettingsDirtyBits PutSyncSettings(DobieSyncSettings o) - { - _syncSettings = o; - return DobieSyncSettings.NeedsReboot(_syncSettings, _syncSettingsActual) - ? PutSettingsDirtyBits.RebootCore - : PutSettingsDirtyBits.None; - } - - private static readonly ControllerDefinition DualShock = new ControllerDefinition("PS2 DualShock") - { - BoolButtons = - { - "SELECT", - "L3", - "R3", - "START", - "UP", - "RIGHT", - "DOWN", - "LEFT", - "L2", - "R2", - "L1", - "R1", - "TRIANGLE", - "CIRCLE", - "CROSS", - "SQUARE", - }, - Axes = - { - { "RIGHT X", new AxisSpec(0.RangeTo(255), 128) }, - { "RIGHT Y", new AxisSpec(0.RangeTo(255), 128) }, - { "LEFT X", new AxisSpec(0.RangeTo(255), 128) }, - { "LEFT Y", new AxisSpec(0.RangeTo(255), 128) }, - } - }.MakeImmutable(); - - public class DobieSyncSettings - { - public enum CpuMode - { - Jit, - Interpreter - } - - public CpuMode EEMode { get; set;} - public CpuMode VU0Mode { get; set; } - public CpuMode VU1Mode { get; set; } - - public static bool NeedsReboot(DobieSyncSettings x, DobieSyncSettings y) - { - return !DeepEquality.DeepEquals(x, y); - } - - public DobieSyncSettings Clone() - { - return (DobieSyncSettings)MemberwiseClone(); - } - - public LibDobieStation.SyncSettings GetNativeSettings() - { - return new LibDobieStation.SyncSettings - { - EEJit = EEMode == CpuMode.Jit, - VU0Jit = VU0Mode == CpuMode.Jit, - VU1Jit = VU1Mode == CpuMode.Jit - }; - } - } - } -} diff --git a/src/BizHawk.Emulation.Cores/Consoles/Sony/PS2/LibDobieStation.cs b/src/BizHawk.Emulation.Cores/Consoles/Sony/PS2/LibDobieStation.cs deleted file mode 100644 index 9da7db097f..0000000000 --- a/src/BizHawk.Emulation.Cores/Consoles/Sony/PS2/LibDobieStation.cs +++ /dev/null @@ -1,29 +0,0 @@ -using System.Runtime.InteropServices; -using BizHawk.BizInvoke; -using BizHawk.Emulation.Cores.Waterbox; - -namespace BizHawk.Emulation.Cores.Sony.PS2 -{ - public abstract class LibDobieStation : LibWaterboxCore - { - [StructLayout(LayoutKind.Sequential)] - public new class FrameInfo : LibWaterboxCore.FrameInfo - { - public uint Buttons; - public uint Axes; - } - - [StructLayout(LayoutKind.Sequential)] - public class SyncSettings - { - public bool EEJit; - public bool VU0Jit; - public bool VU1Jit; - } - - public unsafe delegate void CdCallback(ulong sector, byte* dest); - - [BizImport(CC)] - public abstract bool Initialize(byte[] bios, ulong cdLength, CdCallback cdCallback, SyncSettings syncSettings); - } -} diff --git a/src/BizHawk.Emulation.Cores/CoreNames.cs b/src/BizHawk.Emulation.Cores/CoreNames.cs index 8c6befef44..5515d316bd 100644 --- a/src/BizHawk.Emulation.Cores/CoreNames.cs +++ b/src/BizHawk.Emulation.Cores/CoreNames.cs @@ -19,10 +19,9 @@ namespace BizHawk.Emulation.Cores public const string ColecoHawk = "ColecoHawk"; public const string CPCHawk = "CPCHawk"; public const string Cygne = "Cygne/Mednafen"; - public const string DobieStation = "DobieStation"; public const string Emu83 = "Emu83"; public const string Faust = "Faust"; - public const string Gambatte = "Gambatte"; + public const string Gambatte = "Gambatte"; public const string GambatteLink = "GambatteLink"; public const string GbHawk = "GBHawk"; public const string GBHawkLink = "GBHawkLink"; @@ -53,7 +52,7 @@ namespace BizHawk.Emulation.Cores public const string Snes9X = "Snes9x"; public const string SubGbHawk = "SubGBHawk"; public const string SubNesHawk = "SubNESHawk"; - public const string TI83Hawk = "TI83Hawk"; + public const string TI83Hawk = "TI83Hawk"; public const string TIC80 = "TIC-80"; public const string TST = "T. S. T."; public const string TurboNyma = "TurboNyma"; diff --git a/waterbox/dobie/Makefile b/waterbox/dobie/Makefile deleted file mode 100644 index bf2e5f5d50..0000000000 --- a/waterbox/dobie/Makefile +++ /dev/null @@ -1,107 +0,0 @@ -CXXFLAGS := \ - -Wall -Werror=int-to-pointer-cast \ - -std=c++14 -fomit-frame-pointer -fno-rtti \ - -Wno-reorder -Wno-unused-value \ - -Idobiestation/ext/libdeflate \ - -Dprivate=public - -CCFLAGS := \ - -Wall -Wundef -Wpedantic -Wdeclaration-after-statement -Wmissing-prototypes -Wstrict-prototypes -Wvla \ - -D_ANSI_SOURCE \ - -Idobiestation/ext/libdeflate \ - -Idobiestation/ext/libdeflate/common - -TARGET = dobie.wbx - -CORE_SRCS = \ - audio/utils.cpp \ - ee/bios_hle.cpp \ - ee/cop0.cpp \ - ee/cop1.cpp \ - ee/cop2.cpp \ - ee/dmac.cpp \ - ee/ee_jit.cpp \ - ee/ee_jit64.cpp \ - ee/ee_jit64_cop2.cpp \ - ee/ee_jit64_fpu.cpp \ - ee/ee_jit64_fpu_avx.cpp \ - ee/ee_jit64_gpr.cpp \ - ee/ee_jit64_mmi.cpp \ - ee/ee_jittrans.cpp \ - ee/emotion.cpp \ - ee/emotion_fpu.cpp \ - ee/emotion_mmi.cpp \ - ee/emotion_special.cpp \ - ee/emotion_vu0.cpp \ - ee/emotionasm.cpp \ - ee/emotiondisasm.cpp \ - ee/emotioninterpreter.cpp \ - ee/intc.cpp \ - ee/ipu/chromtable.cpp \ - ee/ipu/codedblockpattern.cpp \ - ee/ipu/dct_coeff.cpp \ - ee/ipu/dct_coeff_table0.cpp \ - ee/ipu/dct_coeff_table1.cpp \ - ee/ipu/ipu.cpp \ - ee/ipu/ipu_fifo.cpp \ - ee/ipu/lumtable.cpp \ - ee/ipu/mac_addr_inc.cpp \ - ee/ipu/mac_b_pic.cpp \ - ee/ipu/mac_i_pic.cpp \ - ee/ipu/mac_p_pic.cpp \ - ee/ipu/motioncode.cpp \ - ee/ipu/vlc_table.cpp \ - ee/timers.cpp \ - ee/vif.cpp \ - ee/vu.cpp \ - ee/vu_disasm.cpp \ - ee/vu_interpreter.cpp \ - ee/vu_jit.cpp \ - ee/vu_jit64.cpp \ - ee/vu_jittrans.cpp \ - emulator.cpp \ - errors.cpp \ - gif.cpp \ - gs.cpp \ - gscontext.cpp \ - gsmem.cpp \ - gsregisters.cpp \ - gsthread.cpp \ - iop/cdvd/bincuereader.cpp \ - iop/cdvd/cdvd.cpp \ - iop/cdvd/cso_reader.cpp \ - iop/cdvd/iso_reader.cpp \ - iop/firewire.cpp \ - iop/gamepad.cpp \ - iop/iop.cpp \ - iop/iop_cop0.cpp \ - iop/iop_dma.cpp \ - iop/iop_intc.cpp \ - iop/iop_interpreter.cpp \ - iop/iop_timers.cpp \ - iop/memcard.cpp \ - iop/sio2.cpp \ - iop/spu/spu.cpp \ - iop/spu/spu_adpcm.cpp \ - iop/spu/spu_envelope.cpp \ - iop/spu/spu_tables.cpp \ - jitcommon/emitter64.cpp \ - jitcommon/ir_block.cpp \ - jitcommon/ir_instr.cpp \ - jitcommon/jitcache.cpp \ - scheduler.cpp \ - serialize.cpp \ - sif.cpp \ - tests/iop/alu.cpp - -DEFLATE_SRCS = \ - lib/aligned_malloc.c \ - lib/deflate_decompress.c \ - lib/x86/cpu_features.c - -SRCS = \ - $(addprefix dobiestation/src/core/,$(CORE_SRCS)) \ - $(addprefix dobiestation/ext/libdeflate/,$(DEFLATE_SRCS)) \ - cinterface.cpp - -include ../common.mak diff --git a/waterbox/dobie/cinterface.cpp b/waterbox/dobie/cinterface.cpp deleted file mode 100644 index 412db5be61..0000000000 --- a/waterbox/dobie/cinterface.cpp +++ /dev/null @@ -1,184 +0,0 @@ -#include "../emulibc/emulibc.h" -#include "../emulibc/waterboxcore.h" -#include -#include "dobiestation/src/core/emulator.hpp" -#include "dobiestation/src/core/iop/cdvd/cdvd_container.hpp" - - -static size_t cd_length; -static void (*cdcallback)(size_t sector, uint8_t* dest); -static size_t cd_pos; - -class DVD: public CDVD_Container -{ - virtual bool open(std::string name) override - { - return true; - } - virtual void close() override {} - virtual size_t read(uint8_t* buff, size_t bytes) - { - uint8_t* buff_end = buff + bytes; - if (cd_pos % 2048 != 0) - { - auto offset = cd_pos % 2048; - auto nread = std::min(2048 - offset, bytes); - uint8_t tmp[2048]; - cdcallback(cd_pos / 2048, tmp); - memcpy(buff, tmp + offset, nread); - buff += nread; - cd_pos += nread; - } - while (buff_end >= buff + 2048) - { - cdcallback(cd_pos / 2048, buff); - buff += 2048; - cd_pos += 2048; - } - if (buff_end > buff) - { - auto nread = buff_end - buff; - uint8_t tmp[2048]; - cdcallback(cd_pos / 2048, tmp); - memcpy(buff, tmp, nread); - cd_pos += nread; - } - return bytes; - } - virtual void seek(size_t pos, std::ios::seekdir whence) override - { - cd_pos = pos * 2048; - } - virtual bool is_open() override - { - return true; - } - virtual size_t get_size() override - { - return cd_length; - } -}; - - -struct MyFrameInfo: public FrameInfo -{ - uint32_t Buttons; - uint32_t Axes; -}; - -Emulator* emu; - -struct SyncSettings -{ - bool EEJit; - bool VU0Jit; - bool VU1Jit; -}; - -ECL_EXPORT bool Initialize( - const uint8_t* bios, - size_t cd_length_, - void (*cdcallback_)(size_t sector, uint8_t* dest), - const SyncSettings& syncSettings -) -{ - cd_length = cd_length_; - cdcallback = cdcallback_; - emu = new Emulator(); - emu->reset(); - emu->set_skip_BIOS_hack(LOAD_DISC); - emu->load_BIOS(bios); - emu->load_memcard(0, "MEMCARD0"); - if (!emu->load_CDVD_Container("", std::unique_ptr(new DVD()))) - return false; - emu->set_ee_mode(syncSettings.EEJit ? JIT : INTERPRETER); - printf("EE Mode: %s\n", syncSettings.EEJit ? "JIT" : "INTERPRETER"); - emu->set_vu0_mode(syncSettings.VU0Jit ? JIT : INTERPRETER); - printf("VU0 Mode: %s\n", syncSettings.VU0Jit ? "JIT" : "INTERPRETER"); - emu->set_vu1_mode(syncSettings.VU1Jit ? JIT : INTERPRETER); - printf("VU1 Mode: %s\n", syncSettings.VU1Jit ? "JIT" : "INTERPRETER"); - emu->set_wav_output(true); - return true; -} - -static int16_t* audio_pos; -void hacky_enqueue_audio(stereo_sample s) -{ - *audio_pos++ = s.left; - *audio_pos++ = s.right; -} - -bool hacky_lag_flag; -void (*hacky_input_callback)(); - -ECL_EXPORT void FrameAdvance(MyFrameInfo& f) -{ - for (auto i = 0; i < 16; i++) - { - if (f.Buttons & 1 << i) - { - emu->press_button((PAD_BUTTON)i); - } - else - { - emu->release_button((PAD_BUTTON)i); - } - } - for (auto i = 0; i < 4; i++) - { - emu->update_joystick((JOYSTICK)(i >> 1), (JOYSTICK_AXIS)(i & 1), f.Axes >> (i * 8)); - } - audio_pos = f.SoundBuffer; - hacky_lag_flag = true; - emu->run(); - f.Lagged = hacky_lag_flag; - emu->get_inner_resolution(f.Width, f.Height); - { - const uint32_t* src = emu->get_framebuffer(); - const uint32_t* srcend = src + f.Width * f.Height; - uint32_t* dst = f.VideoBuffer; - while (src < srcend) - { - *dst = *src; - std::swap(((uint8_t*)dst)[2], ((uint8_t*)dst)[0]); - src++; - dst++; - } - } - - f.Samples = (audio_pos - f.SoundBuffer) / 2; - audio_pos = nullptr; -} - -ECL_EXPORT void GetMemoryAreas(MemoryArea *m) -{ - m[0].Data = emu->RDRAM; - m[0].Name = "RDRAM"; - m[0].Size = 1024 * 1024 * 32; - m[0].Flags = MEMORYAREA_FLAGS_WRITABLE | MEMORYAREA_FLAGS_WORDSIZE4 | MEMORYAREA_FLAGS_PRIMARY; - - m[1].Data = emu->IOP_RAM; - m[1].Name = "IOP_RAM"; - m[1].Size = 1024 * 1024 * 2; - m[1].Flags = MEMORYAREA_FLAGS_WRITABLE | MEMORYAREA_FLAGS_WORDSIZE4; - - m[2].Data = emu->BIOS; - m[2].Name = "BIOS"; - m[2].Size = 1024 * 1024 * 4; - m[2].Flags = MEMORYAREA_FLAGS_WORDSIZE4; - - m[3].Data = emu->SPU_RAM; - m[3].Name = "SPU_RAM"; - m[3].Size = 1024 * 1024 * 2; - m[3].Flags = MEMORYAREA_FLAGS_WRITABLE | MEMORYAREA_FLAGS_WORDSIZE4; - - m[4].Data = emu->memcard.mem; - m[4].Name = "MEMCARD0"; - m[4].Size = 0x840000; - m[4].Flags = MEMORYAREA_FLAGS_WRITABLE | MEMORYAREA_FLAGS_WORDSIZE1 | MEMORYAREA_FLAGS_SAVERAMMABLE; -} - -ECL_EXPORT void SetInputCallback(void (*callback)()) -{ - hacky_input_callback = callback; -} diff --git a/waterbox/dobie/dobiestation b/waterbox/dobie/dobiestation deleted file mode 160000 index b736d7d566..0000000000 --- a/waterbox/dobie/dobiestation +++ /dev/null @@ -1 +0,0 @@ -Subproject commit b736d7d5668aa2e52705faabb1e32fbfaff4c3ce