Merge branch 'master' into MoreUnixMonoCompatWork

# Conflicts:
#	BizHawk.Client.EmuHawk/Program.cs
#	BizHawk.Common/BizInvoke/MemoryBlock.cs
This commit is contained in:
adelikat 2019-11-03 16:09:22 -06:00
commit e4e10646bf
27 changed files with 127 additions and 74 deletions

View File

@ -410,7 +410,7 @@ namespace BizHawk.Client.Common
#if true
if (!IsSubfolder(parentPath, absolutePath)) return absolutePath;
return OSTailoredCode.CurrentOS == OSTailoredCode.DistinctOS.Windows
return OSTailoredCode.IsWindows()
? absolutePath.Replace(parentPath, ".")
: "./" + OSTailoredCode.SimpleSubshell("realpath", $"--relative-to=\"{parentPath}\" \"{absolutePath}\"", $"invalid path {absolutePath} or missing realpath binary");
#else // written for Unix port but may be useful for .NET Core
@ -441,7 +441,7 @@ namespace BizHawk.Client.Common
/// <remarks>Algorithm for Windows taken from https://stackoverflow.com/a/7710620/7467292</remarks>
public static bool IsSubfolder(string parentPath, string childPath)
{
if (OSTailoredCode.CurrentOS == OSTailoredCode.DistinctOS.Windows)
if (OSTailoredCode.IsWindows())
{
var parentUri = new Uri(parentPath);

View File

@ -348,7 +348,7 @@ namespace BizHawk.Client.Common
/// warning: we dont even want to deal with changing this at runtime. but we want it changed here for config purposes. so dont check this variable. check in GlobalWin or something like that.
/// force DX for Windows and GDI+ for Unix when a new config is generated
/// </remarks>
public EDispMethod DispMethod = OSTailoredCode.CurrentOS == OSTailoredCode.DistinctOS.Windows
public EDispMethod DispMethod = OSTailoredCode.IsWindows()
? EDispMethod.SlimDX9
: EDispMethod.GdiPlus;
@ -378,7 +378,7 @@ namespace BizHawk.Client.Common
public int DispCropBottom = 0;
// Sound options
public ESoundOutputMethod SoundOutputMethod = OSTailoredCode.CurrentOS == OSTailoredCode.DistinctOS.Windows
public ESoundOutputMethod SoundOutputMethod = OSTailoredCode.IsWindows()
? ESoundOutputMethod.DirectSound
: ESoundOutputMethod.OpenAL; // force OpenAL for Unix when config is generated
public bool SoundEnabled = true;

View File

@ -43,30 +43,26 @@ namespace BizHawk.Client.Common
return true;
}
if (OSTailoredCode.CurrentOS == OSTailoredCode.DistinctOS.Windows)
if (OSTailoredCode.IsWindows())
{
// WARNING: setting the current directory is SLOW!!! security checks for some reason.
// so we're bypassing it with windows hacks
fixed (byte* pstr = &System.Text.Encoding.Unicode.GetBytes($"{target}\0")[0])
return SetCurrentDirectoryW(pstr);
}
else
if (System.IO.Directory.Exists(_currentDirectory)) // race condition for great justice
{
if (System.IO.Directory.Exists(_currentDirectory)) // race condition for great justice
{
Environment.CurrentDirectory = _currentDirectory; // thats right, you can't set a directory as current that doesnt exist because .net's got to do SENSELESS SLOW-ASS SECURITY CHECKS on it and it can't do that on a NONEXISTENT DIRECTORY
return true;
}
else
{
return false;
}
Environment.CurrentDirectory = _currentDirectory; // that's right, you can't set a directory as current that doesnt exist because .net's got to do SENSELESS SLOW-ASS SECURITY CHECKS on it and it can't do that on a NONEXISTENT DIRECTORY
return true;
}
return false;
}
private string CoolGetCurrentDirectory()
{
if (OSTailoredCode.CurrentOS == OSTailoredCode.DistinctOS.Windows)
if (OSTailoredCode.IsWindows())
{
// GUESS WHAT!
// .NET DOES A SECURITY CHECK ON THE DIRECTORY WE JUST RETRIEVED
@ -76,10 +72,8 @@ namespace BizHawk.Client.Common
fixed (byte* pBuf = &buf[0])
return System.Text.Encoding.Unicode.GetString(buf, 0, 2 * (int) GetCurrentDirectoryW(32767, pBuf));
}
else
{
return Environment.CurrentDirectory;
}
return Environment.CurrentDirectory;
}
private void Sandbox(Action callback, Action exceptionCallback)

View File

@ -86,7 +86,7 @@ namespace BizHawk.Client.EmuHawk
try
{
_ffmpeg = OSTailoredCode.ConstructSubshell(
OSTailoredCode.CurrentOS == OSTailoredCode.DistinctOS.Windows
OSTailoredCode.IsWindows()
? Path.Combine(PathManager.GetDllDirectory(), "ffmpeg.exe")
: "ffmpeg",
$"-y -f nut -i - {_token.Commandline} \"{_baseName}{(_segment == 0 ? string.Empty : $"_{_segment}")}{_ext}\"",

View File

@ -83,7 +83,7 @@ namespace BizHawk.Client.EmuHawk
SetStyle(ControlStyles.Opaque, true);
SetStyle(ControlStyles.OptimizedDoubleBuffer, true);
if (OSTailoredCode.CurrentOS == OSTailoredCode.DistinctOS.Windows)
if (OSTailoredCode.IsWindows())
{
_renderer = new GdiRenderer();
}

View File

@ -128,7 +128,7 @@ namespace BizHawk.Client.EmuHawk
public static void Initialize()
{
if (OSTailoredCode.CurrentOS == OSTailoredCode.DistinctOS.Windows)
if (OSTailoredCode.IsWindows())
{
KeyInput.Initialize();
IPCKeyInput.Initialize();
@ -145,7 +145,7 @@ namespace BizHawk.Client.EmuHawk
public static void Cleanup()
{
if (OSTailoredCode.CurrentOS == OSTailoredCode.DistinctOS.Windows)
if (OSTailoredCode.IsWindows())
{
KeyInput.Cleanup();
GamePad.Cleanup();
@ -339,10 +339,10 @@ namespace BizHawk.Client.EmuHawk
{
while (true)
{
var keyEvents = OSTailoredCode.CurrentOS == OSTailoredCode.DistinctOS.Windows
var keyEvents = OSTailoredCode.IsWindows()
? KeyInput.Update().Concat(IPCKeyInput.Update())
: OTK_Keyboard.Update();
if (OSTailoredCode.CurrentOS == OSTailoredCode.DistinctOS.Windows)
if (OSTailoredCode.IsWindows())
{
GamePad.UpdateAll();
GamePad360.UpdateAll();

View File

@ -1436,7 +1436,7 @@ namespace BizHawk.Client.EmuHawk
private void RamSearchMenuItem_Click(object sender, EventArgs e)
{
var ramSearch = GlobalWin.Tools.Load<RamSearch>();
if (OSTailoredCode.CurrentOS != OSTailoredCode.DistinctOS.Windows)
if (!OSTailoredCode.IsWindows())
{
// this is apparently needed for weird mono-forms-on-different-thread issues
// don't do .Show() within Load<T>() for RamSearch - instead put an instance of it here on MainForm, then show here

View File

@ -165,11 +165,13 @@ namespace BizHawk.Client.EmuHawk
Database.LoadDatabase(Path.Combine(PathManager.GetExeDirectoryAbsolute(), "gamedb", "gamedb.txt"));
// TODO GL - a lot of disorganized wiring-up here
CGC.CGCBinPath = OSTailoredCode.CurrentOS == OSTailoredCode.DistinctOS.Windows
CGC.CGCBinPath = OSTailoredCode.IsWindows()
? Path.Combine(PathManager.GetDllDirectory(), "cgc.exe")
: "cgc"; // installed separately (via package manager or from https://developer.nvidia.com/cg-toolkit-download), look in $PATH
PresentationPanel = new PresentationPanel();
PresentationPanel.GraphicsControl.MainWindow = true;
PresentationPanel = new PresentationPanel
{
GraphicsControl = {MainWindow = true}
};
GlobalWin.DisplayManager = new DisplayManager(PresentationPanel);
Controls.Add(PresentationPanel);
Controls.SetChildIndex(PresentationPanel, 0);
@ -1047,7 +1049,7 @@ namespace BizHawk.Client.EmuHawk
// (this could be determined with more work; other side affects of the fullscreen mode include: corrupted TaskBar, no modal boxes on top of GL control, no screenshots)
// At any rate, we can solve this by adding a 1px black border around the GL control
// Please note: It is important to do this before resizing things, otherwise momentarily a GL control without WS_BORDER will be at the magic dimensions and cause the flakeout
if (OSTailoredCode.CurrentOS == OSTailoredCode.DistinctOS.Windows
if (OSTailoredCode.IsWindows()
&& Global.Config.DispFullscreenHacks
&& Global.Config.DispMethod == Config.EDispMethod.OpenGL)
{
@ -1076,7 +1078,7 @@ namespace BizHawk.Client.EmuHawk
WindowState = FormWindowState.Normal;
if (OSTailoredCode.CurrentOS == OSTailoredCode.DistinctOS.Windows)
if (OSTailoredCode.IsWindows())
{
// do this even if DispFullscreenHacks aren't enabled, to restore it in case it changed underneath us or something
Padding = new Padding(0);

View File

@ -21,7 +21,7 @@ namespace BizHawk.Client.EmuHawk
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
if (EXE_PROJECT.OSTailoredCode.CurrentOS == EXE_PROJECT.OSTailoredCode.DistinctOS.Windows)
if (EXE_PROJECT.OSTailoredCode.IsWindows())
{
var libLoader = EXE_PROJECT.OSTailoredCode.LinkedLibManager;
@ -83,7 +83,7 @@ namespace BizHawk.Client.EmuHawk
private static int Main(string[] args)
{
var exitCode = SubMain(args);
if (EXE_PROJECT.OSTailoredCode.CurrentOS == EXE_PROJECT.OSTailoredCode.DistinctOS.Linux)
if (EXE_PROJECT.OSTailoredCode.IsLinux())
{
Console.WriteLine("BizHawk has completed its shutdown routines, killing process...");
Process.GetCurrentProcess().Kill();
@ -99,7 +99,7 @@ namespace BizHawk.Client.EmuHawk
// and there was a TypeLoadException before the first line of SubMain was reached (some static ColorType init?)
// zero 25-dec-2012 - only do for public builds. its annoying during development
// and don't bother when installed from a package manager i.e. not Windows --yoshi
if (!VersionInfo.DeveloperBuild && EXE_PROJECT.OSTailoredCode.CurrentOS == EXE_PROJECT.OSTailoredCode.DistinctOS.Windows)
if (!VersionInfo.DeveloperBuild && EXE_PROJECT.OSTailoredCode.IsWindows())
{
var thisversion = typeof(Program).Assembly.GetName().Version;
var utilversion = Assembly.Load(new AssemblyName("Bizhawk.Client.Common")).GetName().Version;
@ -150,7 +150,10 @@ namespace BizHawk.Client.EmuHawk
GlobalWin.GLManager = GLManager.Instance;
//now create the "GL" context for the display method. we can reuse the IGL_TK context if opengl display method is chosen
REDO_DISPMETHOD:
if (!EXE_PROJECT.OSTailoredCode.IsWindows())
Global.Config.DispMethod = Config.EDispMethod.GdiPlus;
REDO_DISPMETHOD:
if (Global.Config.DispMethod == Config.EDispMethod.GdiPlus)
GlobalWin.GL = new Bizware.BizwareGL.Drivers.GdiPlus.IGL_GdiPlus();
else if (Global.Config.DispMethod == Config.EDispMethod.SlimDX9)
@ -195,7 +198,7 @@ REDO_DISPMETHOD:
goto REDO_DISPMETHOD;
}
if (EXE_PROJECT.OSTailoredCode.CurrentOS == EXE_PROJECT.OSTailoredCode.DistinctOS.Windows)
if (EXE_PROJECT.OSTailoredCode.IsWindows())
{
//WHY do we have to do this? some intel graphics drivers (ig7icd64.dll 10.18.10.3304 on an unknown chip on win8.1) are calling SetDllDirectory() for the process, which ruins stuff.
//The relevant initialization happened just before in "create IGL context".
@ -316,7 +319,7 @@ REDO_DISPMETHOD:
//so.. we're going to resort to something really bad.
//avert your eyes.
var configPath = Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), "config.ini");
if (EXE_PROJECT.OSTailoredCode.CurrentOS == EXE_PROJECT.OSTailoredCode.DistinctOS.Windows // LuaInterface is not currently working on Mono
if (EXE_PROJECT.OSTailoredCode.IsWindows() // LuaInterface is not currently working on Mono
&& File.Exists(configPath)
&& (Array.Find(File.ReadAllLines(configPath), line => line.Contains(" \"UseNLua\": ")) ?? string.Empty)
.Contains("false"))

View File

@ -45,7 +45,7 @@ namespace BizHawk.Client.EmuHawk
public int Duration { get; set; } = 0; //TODO implementation
}
private static readonly IScreenBlankTimer _screenBlankTimer = OSTailoredCode.CurrentOS == OSTailoredCode.DistinctOS.Windows
private static readonly IScreenBlankTimer _screenBlankTimer = OSTailoredCode.IsWindows()
? (IScreenBlankTimer) new Win32ScreenBlankTimer()
: new UnixScreenBlankTimer();

View File

@ -23,7 +23,7 @@ namespace BizHawk.Client.EmuHawk
public Sound(IntPtr mainWindowHandle)
{
if (OSTailoredCode.CurrentOS == OSTailoredCode.DistinctOS.Windows)
if (OSTailoredCode.IsWindows())
{
if (Global.Config.SoundOutputMethod == Config.ESoundOutputMethod.OpenAL)
_outputDevice = new OpenALSoundOutput(this);

View File

@ -160,7 +160,7 @@ namespace BizHawk.Client.EmuHawk
return ms;
}
}
static PlatformSpecificSysTimer sysTimer = OSTailoredCode.CurrentOS == OSTailoredCode.DistinctOS.Windows
static readonly PlatformSpecificSysTimer sysTimer = OSTailoredCode.IsWindows()
? (PlatformSpecificSysTimer) new WinSysTimer()
: new UnixMonoSysTimer();
static uint TimeBeginPeriod(uint ms)

View File

@ -93,7 +93,7 @@ namespace BizHawk.Client.EmuHawk
RefreshAspectRatioOptions();
if (OSTailoredCode.CurrentOS != OSTailoredCode.DistinctOS.Windows)
if (!OSTailoredCode.IsWindows())
{
// Disable SlimDX on Unix
rbD3D9.Enabled = false;

View File

@ -356,15 +356,18 @@ namespace BizHawk.Client.EmuHawk
DoScan();
}
private void tbbOpenFolder_Click(object sender, EventArgs e)
{
var frmWares = PathManager.MakeAbsolutePath(Global.Config.PathEntries.FirmwaresPathFragment, null);
if (OSTailoredCode.CurrentOS != OSTailoredCode.DistinctOS.Windows && !Directory.Exists(frmWares))
private void tbbOpenFolder_Click(object sender, EventArgs e)
{
var frmWares = PathManager.MakeAbsolutePath(Global.Config.PathEntries.FirmwaresPathFragment, null);
if (!OSTailoredCode.IsWindows() && !Directory.Exists(frmWares))
{
Directory.CreateDirectory(frmWares);
System.Diagnostics.Process.Start(frmWares);
}
}
private void lvFirmwares_KeyDown(object sender, KeyEventArgs e)
System.Diagnostics.Process.Start(frmWares);
}
private void lvFirmwares_KeyDown(object sender, KeyEventArgs e)
{
if (e.KeyCode == Keys.C && e.Control && !e.Alt && !e.Shift)
{

View File

@ -67,7 +67,11 @@ namespace BizHawk.Client.EmuHawk
protected override void OnMouseClick(MouseEventArgs e)
{
if (OSTailoredCode.CurrentOS == OSTailoredCode.DistinctOS.Windows) HideCaret(Handle);
if (OSTailoredCode.IsWindows())
{
HideCaret(Handle);
}
base.OnMouseClick(e);
}
@ -259,7 +263,10 @@ namespace BizHawk.Client.EmuHawk
protected override void OnGotFocus(EventArgs e)
{
if (OSTailoredCode.CurrentOS == OSTailoredCode.DistinctOS.Windows) HideCaret(Handle);
if (OSTailoredCode.IsWindows())
{
HideCaret(Handle);
}
}
protected override bool ProcessCmdKey(ref Message msg, Keys keyData)

View File

@ -26,7 +26,7 @@ namespace BizHawk.Client.EmuHawk
cbEnableRWFF.Checked = Global.Config.SoundEnabledRWFF;
cbMuteFrameAdvance.Checked = Global.Config.MuteFrameAdvance;
if (OSTailoredCode.CurrentOS != OSTailoredCode.DistinctOS.Windows)
if (!OSTailoredCode.IsWindows())
{
// Disable DirectSound and XAudio2 on Mono
rbOutputMethodDirectSound.Enabled = false;
@ -88,7 +88,7 @@ namespace BizHawk.Client.EmuHawk
private void PopulateDeviceList()
{
IEnumerable<string> deviceNames = Enumerable.Empty<string>();
if (OSTailoredCode.CurrentOS == OSTailoredCode.DistinctOS.Windows)
if (OSTailoredCode.IsWindows())
{
if (rbOutputMethodDirectSound.Checked) deviceNames = DirectSoundSoundOutput.GetDeviceNames();
if (rbOutputMethodXAudio2.Checked) deviceNames = XAudio2SoundOutput.GetDeviceNames();

View File

@ -185,7 +185,7 @@ namespace BizHawk.Client.EmuHawk
}
var currentScripts = LuaImp?.ScriptList; // Temp fix for now
LuaImp = OSTailoredCode.CurrentOS == OSTailoredCode.DistinctOS.Windows
LuaImp = OSTailoredCode.IsWindows()
? (PlatformEmuLuaLibrary)new EmuLuaLibrary(Emulator.ServiceProvider)
: (PlatformEmuLuaLibrary)new NotReallyLuaLibrary();
if (currentScripts != null)

View File

@ -268,7 +268,7 @@ namespace BizHawk.Client.EmuHawk
/// <remarks>Algorithm for Windows taken from https://stackoverflow.com/a/485516/7467292</remarks>
public static string GetRelativePath(string fromPath, string toPath)
{
if (OSTailoredCode.CurrentOS == OSTailoredCode.DistinctOS.Windows)
if (OSTailoredCode.IsWindows())
{
Win32.FileAttributes fromAttr = GetPathAttribute(fromPath);
Win32.FileAttributes toAttr = GetPathAttribute(toPath);

View File

@ -157,8 +157,7 @@ namespace BizHawk.Client.EmuHawk
}
newTool.Restart();
if (OSTailoredCode.CurrentOS != OSTailoredCode.DistinctOS.Windows
&& newTool is RamSearch)
if (!OSTailoredCode.IsWindows() && newTool is RamSearch)
{
// the mono winforms implementation is buggy, skip to the return statement and call Show in MainForm instead
}
@ -750,7 +749,7 @@ namespace BizHawk.Client.EmuHawk
{
if (!ServiceInjector.IsAvailable(Global.Emulator.ServiceProvider, tool)
|| !lazyAsmTypes.Value.Contains(tool.AssemblyQualifiedName) // not a tool
|| (tool == typeof(LuaConsole) && OSTailoredCode.CurrentOS != OSTailoredCode.DistinctOS.Windows)) // simply doesn't work (for now)
|| (tool == typeof(LuaConsole) && !OSTailoredCode.IsWindows())) // simply doesn't work (for now)
{
return false;
}

View File

@ -10,11 +10,23 @@ namespace BizHawk.Common
{
public static class OSTailoredCode
{
/// <remarks>macOS doesn't use <see cref="PlatformID.MacOSX">PlatformID.MacOSX</see></remarks>
/// <remarks>
/// macOS doesn't use <see cref="PlatformID.MacOSX">PlatformID.MacOSX</see>
/// </remarks>
public static readonly DistinctOS CurrentOS = Environment.OSVersion.Platform == PlatformID.Unix
? SimpleSubshell("uname", "-s", "Can't determine OS") == "Darwin" ? DistinctOS.macOS : DistinctOS.Linux
: DistinctOS.Windows;
public static bool IsWindows()
{
return CurrentOS == DistinctOS.Windows;
}
public static bool IsLinux()
{
return CurrentOS == DistinctOS.Linux;
}
private static readonly Lazy<ILinkedLibManager> _LinkedLibManager = new Lazy<ILinkedLibManager>(() =>
{
switch (CurrentOS)
@ -141,13 +153,11 @@ namespace BizHawk.Common
/// <remarks>OS is implicit and needs to be checked at callsite</remarks>
public static string SimpleSubshell(string cmd, string args, string noOutputMsg)
{
using (var proc = ConstructSubshell(cmd, args))
{
proc.Start();
var stdout = proc.StandardOutput;
if (stdout.EndOfStream) throw new Exception($"{noOutputMsg} ({cmd} wrote nothing to stdout)");
return stdout.ReadLine();
}
using var proc = ConstructSubshell(cmd, args);
proc.Start();
var stdout = proc.StandardOutput;
if (stdout.EndOfStream) throw new Exception($"{noOutputMsg} ({cmd} wrote nothing to stdout)");
return stdout.ReadLine();
}
}
}

View File

@ -86,16 +86,21 @@ namespace BizHawk.Common
catch
{
}
if(fis != null)
{
foreach (var fi in fis)
{
try
{
if (OSTailoredCode.CurrentOS == OSTailoredCode.DistinctOS.Windows)
if (OSTailoredCode.IsWindows())
{
DeleteFileW(fi.FullName); // SHUT. UP. THE. EXCEPTIONS.
}
else
{
fi.Delete();
}
}
catch
{
@ -107,7 +112,7 @@ namespace BizHawk.Common
}
}
// try not to slam the filesystem too hard, we dont want this to cause any hiccups
// try not to slam the filesystem too hard, we don't want this to cause any hiccups
Thread.Sleep(5000);
}
}

View File

@ -211,6 +211,7 @@
<s:Boolean x:Key="/Default/UserDictionary/Words/=Fairchild/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=Famtasia/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=FCEU/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=ffmpeg/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=frameadvance/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=FCEUX/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=feos/@EntryIndexedValue">True</s:Boolean>
@ -274,6 +275,7 @@
<s:Boolean x:Key="/Default/UserDictionary/Words/=Statable/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=Stateable/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=subframe/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=Subshell/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=Syncless/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=taseditor/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=tasproj/@EntryIndexedValue">True</s:Boolean>

View File

@ -8,9 +8,18 @@ namespace Jellyfish.Virtu
{
public sealed partial class Cpu : MachineComponent
{
public Cpu() { }
public Cpu()
{
InitializeOpCodeDelegates();
}
public Cpu(Machine machine) :
base(machine)
{
InitializeOpCodeDelegates();
}
private void InitializeOpCodeDelegates()
{
ExecuteOpCode65N02 = new Action[OpCodeCount]
{
@ -3434,7 +3443,6 @@ namespace Jellyfish.Virtu
}
#endregion
[JsonIgnore]
public bool Is65C02 { get { return _is65C02; } set { _is65C02 = value; _executeOpCode = _is65C02 ? ExecuteOpCode65C02 : ExecuteOpCode65N02; } }
public bool IsThrottled { get; set; }
public int Multiplier { get; set; }
@ -3452,7 +3460,9 @@ namespace Jellyfish.Virtu
private Memory _memory;
[JsonIgnore]
private bool _is65C02;
[JsonIgnore]
private Action[] _executeOpCode;
[JsonIgnore]

View File

@ -1,4 +1,5 @@
using System;
using Newtonsoft.Json;
using System;
namespace Jellyfish.Virtu
{
@ -6,7 +7,9 @@ namespace Jellyfish.Virtu
{
private const int OpCodeCount = 256;
[JsonIgnore]
private Action[] ExecuteOpCode65N02;
[JsonIgnore]
private Action[] ExecuteOpCode65C02;
private const int PC = 0x01;

View File

@ -13,11 +13,20 @@ namespace Jellyfish.Virtu
public sealed partial class Memory : MachineComponent
{
public Memory() { }
public Memory()
{
InitializeWriteDelegates();
}
public Memory(Machine machine, byte[] appleIIe) :
base(machine)
{
_appleIIe = appleIIe;
InitializeWriteDelegates();
}
private void InitializeWriteDelegates()
{
WriteRamModeBankRegion = new Action<int, byte>[Video.ModeCount][][];
for (int mode = 0; mode < Video.ModeCount; mode++)
{
@ -26,7 +35,6 @@ namespace Jellyfish.Virtu
new Action<int, byte>[RegionCount], new Action<int, byte>[RegionCount]
};
}
WriteRamModeBankRegion[Video.Mode0][BankMain][Region0407] = WriteRamMode0MainRegion0407;
WriteRamModeBankRegion[Video.Mode0][BankMain][Region080B] = WriteRamMode0MainRegion080B;
WriteRamModeBankRegion[Video.Mode1][BankMain][Region0407] = WriteRamMode1MainRegion0407;
@ -2133,10 +2141,15 @@ namespace Jellyfish.Virtu
public MonitorType Monitor { get; private set; }
public int VideoMode { get { return StateVideoMode[_state & StateVideo]; } }
[JsonIgnore]
private Action<int, byte> _writeIoRegionC0C0;
[JsonIgnore]
private Action<int, byte> _writeIoRegionC1C7;
[JsonIgnore]
private Action<int, byte> _writeIoRegionC3C3;
[JsonIgnore]
private Action<int, byte> _writeIoRegionC8CF;
[JsonIgnore]
private Action<int, byte> _writeRomRegionD0FF;
[JsonIgnore]

View File

@ -1,4 +1,5 @@
using System;
using Newtonsoft.Json;
using System;
namespace Jellyfish.Virtu
{
@ -101,6 +102,7 @@ namespace Jellyfish.Virtu
Video.ModeC, Video.ModeD, Video.Mode1, Video.Mode2, Video.ModeE, Video.ModeF, Video.Mode1, Video.Mode2
};
[JsonIgnore]
private Action<int, byte>[][][] WriteRamModeBankRegion;
}
}

Binary file not shown.