Move Cheat and CheatList to Client.Common and refator a bunch of things as a result

This commit is contained in:
adelikat 2013-10-20 18:02:43 +00:00
parent 17f5c63273
commit 59386b59f1
73 changed files with 755 additions and 658 deletions

View File

@ -52,6 +52,8 @@
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="RecentFiles.cs" />
<Compile Include="helpers\StringHelpers.cs" />
<Compile Include="tools\Cheat.cs" />
<Compile Include="tools\CheatList.cs" />
<Compile Include="tools\Watch.cs" />
</ItemGroup>
<ItemGroup>

View File

@ -2,7 +2,9 @@
{
public static class Global
{
public static IEmulator Emulator;
public static Config Config;
public static GameInfo Game;
public static CheatList CheatList;
}
}

View File

@ -3,9 +3,7 @@ using System.Collections.Generic;
using System.Linq;
using System.Text;
using BizHawk.Client.Common;
namespace BizHawk.MultiClient
namespace BizHawk.Client.Common
{
public class Cheat
{

View File

@ -4,17 +4,15 @@ using System.Globalization;
using System.IO;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using BizHawk.Client.Common;
namespace BizHawk.MultiClient
namespace BizHawk.Client.Common
{
public class CheatList : IEnumerable<Cheat>
{
private List<Cheat> _cheatList = new List<Cheat>();
private string _currentFileName = String.Empty;
private bool _changes = false;
private string _defaultFileName = String.Empty;
public CheatList() { }
@ -47,7 +45,7 @@ namespace BizHawk.MultiClient
/// <returns></returns>
public bool AttemptToLoadCheatFile()
{
var file = new FileInfo(GenerateDefaultFilename());
var file = new FileInfo(_defaultFileName);
if (file.Exists)
{
@ -79,12 +77,12 @@ namespace BizHawk.MultiClient
get { return _cheatList.Count(x => x.Enabled); }
}
public void NewList()
public void NewList(string defaultFileName)
{
_defaultFileName = defaultFileName;
_cheatList.Clear();
_currentFileName = String.Empty;
_changes = false;
ToolHelpers.UpdateCheatRelatedTools();
}
public void Update()
@ -104,7 +102,6 @@ namespace BizHawk.MultiClient
}
_changes = true;
ToolHelpers.UpdateCheatRelatedTools();
}
public void Insert(int index, Cheat c)
@ -119,14 +116,12 @@ namespace BizHawk.MultiClient
}
_changes = true;
ToolHelpers.UpdateCheatRelatedTools();
}
public void Remove(Cheat c)
{
_changes = true;
_cheatList.Remove(c);
ToolHelpers.UpdateCheatRelatedTools();
}
public void Remove(Watch w)
@ -137,7 +132,6 @@ namespace BizHawk.MultiClient
{
_changes = true;
_cheatList.Remove(cheat);
ToolHelpers.UpdateCheatRelatedTools();
}
}
@ -148,7 +142,6 @@ namespace BizHawk.MultiClient
{
_cheatList.Remove(cheat);
}
ToolHelpers.UpdateCheatRelatedTools();
}
public bool Changes
@ -160,21 +153,18 @@ namespace BizHawk.MultiClient
{
_changes = true;
_cheatList.Clear();
ToolHelpers.UpdateCheatRelatedTools();
}
public void DisableAll()
{
_changes = true;
_cheatList.ForEach(x => x.Disable());
ToolHelpers.UpdateCheatRelatedTools();
}
public void EnableAll()
{
_changes = true;
_cheatList.ForEach(x => x.Enable());
ToolHelpers.UpdateCheatRelatedTools();
}
public bool IsActive(MemoryDomain domain, int address)
@ -202,7 +192,7 @@ namespace BizHawk.MultiClient
{
if (String.IsNullOrWhiteSpace(_currentFileName))
{
_currentFileName = GenerateDefaultFilename();
_currentFileName = _defaultFileName;
}
SaveFile(_currentFileName);
@ -218,20 +208,61 @@ namespace BizHawk.MultiClient
{
if (String.IsNullOrWhiteSpace(_currentFileName))
{
_currentFileName = GenerateDefaultFilename();
_currentFileName = _defaultFileName;
}
return SaveFile(_currentFileName);
}
public bool SaveAs()
public bool SaveFile(string path)
{
var file = GetSaveFileFromUser();
if (file != null)
try
{
return SaveFile(file.FullName);
FileInfo file = new FileInfo(path);
if (file.Directory != null && !file.Directory.Exists)
{
file.Directory.Create();
}
using (StreamWriter sw = new StreamWriter(path))
{
StringBuilder sb = new StringBuilder();
foreach (var cheat in _cheatList)
{
if (cheat.IsSeparator)
{
sb.AppendLine("----");
}
else
{
//Set to hex for saving
Watch.DisplayType type = cheat.Type;
cheat.SetType(Watch.DisplayType.Hex);
sb
.Append(cheat.AddressStr).Append('\t')
.Append(cheat.ValueStr).Append('\t')
.Append(cheat.Compare.HasValue ? cheat.Compare.Value.ToString() : "N").Append('\t')
.Append(cheat.Domain != null ? cheat.Domain.Name : String.Empty).Append('\t')
.Append(cheat.Enabled ? '1' : '0').Append('\t')
.Append(cheat.Name).Append('\t')
.Append(cheat.SizeAsChar).Append('\t')
.Append(cheat.TypeAsChar).Append('\t')
.Append(cheat.BigEndian.Value ? '1' : '0').Append('\t')
.AppendLine();
}
}
sw.WriteLine(sb.ToString());
}
_changes = false;
_currentFileName = path;
Global.Config.RecentCheats.Add(_currentFileName);
return true;
}
else
catch
{
return false;
}
@ -297,7 +328,7 @@ namespace BizHawk.MultiClient
{
COMPARE = Int32.Parse(vals[2], NumberStyles.HexNumber);
}
DOMAIN = ToolHelpers.DomainByName(vals[3]);
DOMAIN = DomainByName(vals[3]);
ENABLED = vals[4] == "1";
NAME = vals[5];
@ -329,7 +360,6 @@ namespace BizHawk.MultiClient
}
}
GlobalWinF.MainForm.UpdateCheatStatus();
return true;
}
@ -342,7 +372,7 @@ namespace BizHawk.MultiClient
{
switch (column)
{
case Cheats.NAME:
case NAME:
if (reverse)
{
_cheatList = _cheatList
@ -358,7 +388,7 @@ namespace BizHawk.MultiClient
.ToList();
}
break;
case Cheats.ADDRESS:
case ADDRESS:
if (reverse)
{
_cheatList = _cheatList
@ -374,7 +404,7 @@ namespace BizHawk.MultiClient
.ToList();
}
break;
case Cheats.VALUE:
case VALUE:
if (reverse)
{
_cheatList = _cheatList
@ -392,7 +422,7 @@ namespace BizHawk.MultiClient
.ToList();
}
break;
case Cheats.COMPARE:
case COMPARE:
if (reverse)
{
_cheatList = _cheatList
@ -410,7 +440,7 @@ namespace BizHawk.MultiClient
.ToList();
}
break;
case Cheats.ON:
case ON:
if (reverse)
{
_cheatList = _cheatList
@ -428,7 +458,7 @@ namespace BizHawk.MultiClient
.ToList();
}
break;
case Cheats.DOMAIN:
case DOMAIN:
if (reverse)
{
_cheatList = _cheatList
@ -446,7 +476,7 @@ namespace BizHawk.MultiClient
.ToList();
}
break;
case Cheats.SIZE:
case SIZE:
if (reverse)
{
_cheatList = _cheatList
@ -464,7 +494,7 @@ namespace BizHawk.MultiClient
.ToList();
}
break;
case Cheats.ENDIAN:
case ENDIAN:
if (reverse)
{
_cheatList = _cheatList
@ -482,7 +512,7 @@ namespace BizHawk.MultiClient
.ToList();
}
break;
case Cheats.TYPE:
case TYPE:
if (reverse)
{
_cheatList = _cheatList
@ -503,131 +533,32 @@ namespace BizHawk.MultiClient
}
}
#region privates
#region Privates
private string GenerateDefaultFilename()
private static MemoryDomain DomainByName(string name)
{
PathEntry pathEntry = Global.Config.PathEntries[GlobalWinF.Emulator.SystemId, "Cheats"];
if (pathEntry == null)
//Attempts to find the memory domain by name, if it fails, it defaults to index 0
foreach (MemoryDomain domain in Global.Emulator.MemoryDomains)
{
pathEntry = Global.Config.PathEntries[GlobalWinF.Emulator.SystemId, "Base"];
}
string path = PathManager.MakeAbsolutePath(pathEntry.Path, GlobalWinF.Emulator.SystemId);
var f = new FileInfo(path);
if (f.Directory != null && f.Directory.Exists == false)
{
f.Directory.Create();
}
return Path.Combine(path, PathManager.FilesystemSafeName(Global.Game) + ".cht");
}
private bool SaveFile(string path)
{
try
{
FileInfo file = new FileInfo(path);
if (file.Directory != null && !file.Directory.Exists)
if (domain.Name == name)
{
file.Directory.Create();
return domain;
}
using (StreamWriter sw = new StreamWriter(path))
{
StringBuilder sb = new StringBuilder();
foreach (var cheat in _cheatList)
{
if (cheat.IsSeparator)
{
sb.AppendLine("----");
}
else
{
//Set to hex for saving
Watch.DisplayType type = cheat.Type;
cheat.SetType(Watch.DisplayType.Hex);
sb
.Append(cheat.AddressStr).Append('\t')
.Append(cheat.ValueStr).Append('\t')
.Append(cheat.Compare.HasValue ? cheat.Compare.Value.ToString() : "N").Append('\t')
.Append(cheat.Domain != null ? cheat.Domain.Name : String.Empty).Append('\t')
.Append(cheat.Enabled ? '1' : '0').Append('\t')
.Append(cheat.Name).Append('\t')
.Append(cheat.SizeAsChar).Append('\t')
.Append(cheat.TypeAsChar).Append('\t')
.Append(cheat.BigEndian.Value ? '1' : '0').Append('\t')
.AppendLine();
}
}
sw.WriteLine(sb.ToString());
}
_changes = false;
_currentFileName = path;
Global.Config.RecentCheats.Add(_currentFileName);
return true;
}
catch
{
return false;
}
return Global.Emulator.MainMemory;
}
#endregion
#region File Handling
public static FileInfo GetFileFromUser(string currentFile)
{
var ofd = new OpenFileDialog();
if (!String.IsNullOrWhiteSpace(currentFile))
{
ofd.FileName = Path.GetFileNameWithoutExtension(currentFile);
}
ofd.InitialDirectory = PathManager.GetCheatsPath(Global.Game);
ofd.Filter = "Cheat Files (*.cht)|*.cht|All Files|*.*";
ofd.RestoreDirectory = true;
GlobalWinF.Sound.StopSound();
var result = ofd.ShowDialog();
GlobalWinF.Sound.StartSound();
if (result != DialogResult.OK)
return null;
var file = new FileInfo(ofd.FileName);
return file;
}
private FileInfo GetSaveFileFromUser()
{
var sfd = new SaveFileDialog();
if (!String.IsNullOrWhiteSpace(_currentFileName))
{
sfd.FileName = Path.GetFileNameWithoutExtension(_currentFileName);
}
else if (!(GlobalWinF.Emulator is NullEmulator))
{
sfd.FileName = PathManager.FilesystemSafeName(Global.Game);
}
sfd.InitialDirectory = PathManager.GetCheatsPath(Global.Game);
sfd.Filter = "Cheat Files (*.cht)|*.cht|All Files|*.*";
sfd.RestoreDirectory = true;
GlobalWinF.Sound.StopSound();
var result = sfd.ShowDialog();
GlobalWinF.Sound.StartSound();
if (result != DialogResult.OK)
{
return null;
}
var file = new FileInfo(sfd.FileName);
Global.Config.LastRomPath = file.DirectoryName;
return file;
}
#endregion
public const string NAME = "NamesColumn";
public const string ADDRESS = "AddressColumn";
public const string VALUE = "ValueColumn";
public const string COMPARE = "CompareColumn";
public const string ON = "OnColumn";
public const string DOMAIN = "DomainColumn";
public const string SIZE = "SizeColumn";
public const string ENDIAN = "EndianColumn";
public const string TYPE = "DisplayTypeColumn";
}
}

View File

@ -87,8 +87,8 @@ namespace BizHawk.MultiClient
private void buttonAuto_Click(object sender, EventArgs e)
{
numericTextBoxW.Text = GlobalWinF.Emulator.CoreComm.NominalWidth.ToString();
numericTextBoxH.Text = GlobalWinF.Emulator.CoreComm.NominalHeight.ToString();
numericTextBoxW.Text = Global.Emulator.CoreComm.NominalWidth.ToString();
numericTextBoxH.Text = Global.Emulator.CoreComm.NominalHeight.ToString();
}
private void buttonOK_Click(object sender, EventArgs e)

View File

@ -276,20 +276,40 @@
<DependentUpon>SoundConfig.cs</DependentUpon>
</Compile>
<Compile Include="CoreFileProvider.cs" />
<Compile Include="CustomControls\FolderBrowserDialogEx.cs" />
<Compile Include="CustomControls\HexTextBox.cs" />
<Compile Include="CustomControls\InputConfigBase.cs" />
<Compile Include="CustomControls\MiscControls.cs" />
<Compile Include="CustomControls\QuickProgressPopup.cs" />
<Compile Include="CustomControls\FolderBrowserDialogEx.cs">
<SubType>Component</SubType>
</Compile>
<Compile Include="CustomControls\HexTextBox.cs">
<SubType>Component</SubType>
</Compile>
<Compile Include="CustomControls\InputConfigBase.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="CustomControls\MiscControls.cs">
<SubType>Component</SubType>
</Compile>
<Compile Include="CustomControls\QuickProgressPopup.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="CustomControls\QuickProgressPopup.Designer.cs">
<DependentUpon>QuickProgressPopup.cs</DependentUpon>
</Compile>
<Compile Include="CustomControls\SmartTextBoxControl.cs" />
<Compile Include="CustomControls\TextDebugView.cs" />
<Compile Include="CustomControls\ToolStripEx.cs" />
<Compile Include="CustomControls\SmartTextBoxControl.cs">
<SubType>Component</SubType>
</Compile>
<Compile Include="CustomControls\TextDebugView.cs">
<SubType>Component</SubType>
</Compile>
<Compile Include="CustomControls\ToolStripEx.cs">
<SubType>Component</SubType>
</Compile>
<Compile Include="CustomControls\Util.cs" />
<Compile Include="CustomControls\ViewportPanel.cs" />
<Compile Include="CustomControls\VirtualListView.cs" />
<Compile Include="CustomControls\ViewportPanel.cs">
<SubType>Component</SubType>
</Compile>
<Compile Include="CustomControls\VirtualListView.cs">
<SubType>Component</SubType>
</Compile>
<Compile Include="CustomControls\Win32.cs" />
<Compile Include="DisplayManager\DisplayManager.cs" />
<Compile Include="DisplayManager\Filters\Hq2x.cs" />
@ -375,7 +395,6 @@
</Compile>
<Compile Include="Program.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="tools\Cheats\Cheat.cs" />
<Compile Include="tools\Cheats\CheatEdit.cs">
<SubType>UserControl</SubType>
</Compile>
@ -388,7 +407,6 @@
<Compile Include="tools\Cheats\CheatForm.Designer.cs">
<DependentUpon>CheatForm.cs</DependentUpon>
</Compile>
<Compile Include="tools\Cheats\CheatList.cs" />
<Compile Include="tools\GBA\GBAGPUView.cs">
<SubType>Form</SubType>
</Compile>

View File

@ -345,7 +345,7 @@ namespace BizHawk.MultiClient
if (GlobalWinF.MovieSession.Movie.IsFinished)
{
StringBuilder s = new StringBuilder();
s.Append(GlobalWinF.Emulator.Frame);
s.Append(Global.Emulator.Frame);
s.Append('/');
if (GlobalWinF.MovieSession.Movie.Frames.HasValue)
{
@ -361,7 +361,7 @@ namespace BizHawk.MultiClient
else if (GlobalWinF.MovieSession.Movie.IsPlaying)
{
StringBuilder s = new StringBuilder();
s.Append(GlobalWinF.Emulator.Frame);
s.Append(Global.Emulator.Frame);
s.Append('/');
if (GlobalWinF.MovieSession.Movie.Frames.HasValue)
{
@ -375,17 +375,17 @@ namespace BizHawk.MultiClient
}
else if (GlobalWinF.MovieSession.Movie.IsRecording)
{
return GlobalWinF.Emulator.Frame.ToString();
return Global.Emulator.Frame.ToString();
}
else
{
return GlobalWinF.Emulator.Frame.ToString();
return Global.Emulator.Frame.ToString();
}
}
private string MakeLagCounter()
{
return GlobalWinF.Emulator.LagCount.ToString();
return Global.Emulator.LagCount.ToString();
}
private List<UIMessage> messages = new List<UIMessage>(5);
@ -489,7 +489,7 @@ namespace BizHawk.MultiClient
}
else
{
s = new StringBuilder(GlobalWinF.MovieSession.Movie.GetInput(GlobalWinF.Emulator.Frame - 1));
s = new StringBuilder(GlobalWinF.MovieSession.Movie.GetInput(Global.Emulator.Frame - 1));
}
s.Replace(".", " ").Replace("|", "").Replace(" 000, 000", " ");
@ -561,7 +561,7 @@ namespace BizHawk.MultiClient
{
string counter = MakeLagCounter();
if (GlobalWinF.Emulator.IsLagFrame)
if (Global.Emulator.IsLagFrame)
{
float x = GetX(g, Global.Config.DispLagx, Global.Config.DispLaganchor, AlertFont, counter);
float y = GetY(g, Global.Config.DispLagy, Global.Config.DispLaganchor, AlertFont, counter);
@ -626,7 +626,7 @@ namespace BizHawk.MultiClient
if (GlobalWinF.MovieSession.Movie.IsActive && Global.Config.DisplaySubtitles)
{
List<Subtitle> s = GlobalWinF.MovieSession.Movie.Subtitles.GetSubtitles(GlobalWinF.Emulator.Frame);
List<Subtitle> s = GlobalWinF.MovieSession.Movie.Subtitles.GetSubtitles(Global.Emulator.Frame);
if (s == null)
{
return;

View File

@ -18,9 +18,8 @@ namespace BizHawk.MultiClient
public static IRenderer RenderPanel;
public static OSDManager OSD = new OSDManager();
public static DisplayManager DisplayManager = new DisplayManager();
public static IEmulator Emulator;
public static CoreComm CoreComm;
public static CheatList CheatList;
public static Controller NullControls;
public static AutofireController AutofireNullControls;

View File

@ -214,7 +214,7 @@ namespace BizHawk.MultiClient
{
if (autofire)
{
int a = (GlobalWinF.Emulator.Frame - buttonStarts[button]) % (On + Off);
int a = (Global.Emulator.Frame - buttonStarts[button]) % (On + Off);
if (a < On)
return buttons[button];
else
@ -254,7 +254,7 @@ namespace BizHawk.MultiClient
foreach (var bound_button in kvp.Value)
{
if (buttons[kvp.Key] == false && controller[bound_button])
buttonStarts[kvp.Key] = GlobalWinF.Emulator.Frame;
buttonStarts[kvp.Key] = Global.Emulator.Frame;
}
}

View File

@ -30,7 +30,7 @@ namespace BizHawk.MultiClient
private void DumpStatus_Click(object sender, EventArgs e)
{
string details = GlobalWinF.Emulator.CoreComm.RomStatusDetails;
string details = Global.Emulator.CoreComm.RomStatusDetails;
if (string.IsNullOrEmpty(details)) return;
GlobalWinF.Sound.StopSound();
LogWindow.ShowReport("Dump Status Report", details, this);
@ -441,7 +441,7 @@ namespace BizHawk.MultiClient
private void OpenControllerConfig()
{
ControllerConfig c = new ControllerConfig(GlobalWinF.Emulator.ControllerDefinition);
ControllerConfig c = new ControllerConfig(Global.Emulator.ControllerDefinition);
c.ShowDialog();
if (c.DialogResult == DialogResult.OK)
{
@ -638,9 +638,9 @@ namespace BizHawk.MultiClient
virtualPadToolStripMenuItem.ShortcutKeyDisplayString = Global.Config.HotkeyBindings["Virtual Pad"].Bindings;
traceLoggerToolStripMenuItem.ShortcutKeyDisplayString = Global.Config.HotkeyBindings["Trace Logger"].Bindings;
toolBoxToolStripMenuItem.Enabled = !ToolBox1.IsHandleCreated || ToolBox1.IsDisposed;
traceLoggerToolStripMenuItem.Enabled = GlobalWinF.Emulator.CoreComm.CpuTraceAvailable;
traceLoggerToolStripMenuItem.Enabled = Global.Emulator.CoreComm.CpuTraceAvailable;
cheatsToolStripMenuItem.Enabled = !(GlobalWinF.Emulator is NullEmulator);
cheatsToolStripMenuItem.Enabled = !(Global.Emulator is NullEmulator);
}
private void saveSlotToolStripMenuItem_DropDownOpened(object sender, EventArgs e)
@ -673,13 +673,13 @@ namespace BizHawk.MultiClient
private void autoloadVirtualKeyboardToolStripMenuItem_Click(object sender, EventArgs e)
{
if (!(GlobalWinF.Emulator is TI83)) return;
if (!(Global.Emulator is TI83)) return;
Global.Config.TI83autoloadKeyPad ^= true;
}
private void keypadToolStripMenuItem_Click(object sender, EventArgs e)
{
if (!(GlobalWinF.Emulator is TI83))
if (!(Global.Emulator is TI83))
return;
LoadTI83KeyPad();
}
@ -861,7 +861,7 @@ namespace BizHawk.MultiClient
for (int x = 0; x < GlobalWinF.MovieSession.Movie.Subtitles.Count; x++)
{
sub = GlobalWinF.MovieSession.Movie.Subtitles.GetSubtitleByIndex(x);
if (GlobalWinF.Emulator.Frame == sub.Frame)
if (Global.Emulator.Frame == sub.Frame)
{
index = x;
break;
@ -869,7 +869,7 @@ namespace BizHawk.MultiClient
}
if (index < 0)
{
sub = new Subtitle { Frame = GlobalWinF.Emulator.Frame };
sub = new Subtitle { Frame = Global.Emulator.Frame };
}
s.sub = sub;
@ -1433,11 +1433,11 @@ namespace BizHawk.MultiClient
{
rebootCoreToolStripMenuItem.Enabled = !IsNullEmulator();
resetToolStripMenuItem.Enabled = GlobalWinF.Emulator.ControllerDefinition.BoolButtons.Contains("Reset") &&
resetToolStripMenuItem.Enabled = Global.Emulator.ControllerDefinition.BoolButtons.Contains("Reset") &&
(!GlobalWinF.MovieSession.Movie.IsPlaying || GlobalWinF.MovieSession.Movie.IsFinished);
hardResetToolStripMenuItem.Enabled = GlobalWinF.Emulator.ControllerDefinition.BoolButtons.Contains("Power") &&
hardResetToolStripMenuItem.Enabled = Global.Emulator.ControllerDefinition.BoolButtons.Contains("Power") &&
(!GlobalWinF.MovieSession.Movie.IsPlaying || GlobalWinF.MovieSession.Movie.IsFinished);
pauseToolStripMenuItem.Checked = EmulatorPaused;
@ -1553,7 +1553,7 @@ namespace BizHawk.MultiClient
public void UpdateCheatStatus()
{
if (GlobalWinF.CheatList.ActiveCount > 0)
if (Global.CheatList.ActiveCount > 0)
{
CheatStatus.ToolTipText = "Cheats are currently active";
CheatStatus.Image = Properties.Resources.Freeze;
@ -1599,10 +1599,10 @@ namespace BizHawk.MultiClient
private void bWToolStripMenuItem_Click(object sender, EventArgs e)
{
if (GlobalWinF.Emulator is Atari2600)
if (Global.Emulator is Atari2600)
{
Global.Config.Atari2600_BW ^= true;
((Atari2600)GlobalWinF.Emulator).SetBw(Global.Config.Atari2600_BW);
((Atari2600)Global.Emulator).SetBw(Global.Config.Atari2600_BW);
if (Global.Config.Atari2600_BW)
GlobalWinF.OSD.AddMessage("Setting to Black and White Switch to On");
else
@ -1612,10 +1612,10 @@ namespace BizHawk.MultiClient
private void p0DifficultyToolStripMenuItem_Click(object sender, EventArgs e)
{
if (GlobalWinF.Emulator is Atari2600)
if (Global.Emulator is Atari2600)
{
Global.Config.Atari2600_LeftDifficulty ^= true;
((Atari2600)GlobalWinF.Emulator).SetP0Diff(Global.Config.Atari2600_BW);
((Atari2600)Global.Emulator).SetP0Diff(Global.Config.Atari2600_BW);
if (Global.Config.Atari2600_LeftDifficulty)
GlobalWinF.OSD.AddMessage("Setting Left Difficulty to B");
else
@ -1625,10 +1625,10 @@ namespace BizHawk.MultiClient
private void rightDifficultyToolStripMenuItem_Click(object sender, EventArgs e)
{
if (GlobalWinF.Emulator is Atari2600)
if (Global.Emulator is Atari2600)
{
Global.Config.Atari2600_RightDifficulty ^= true;
((Atari2600)GlobalWinF.Emulator).SetP1Diff(Global.Config.Atari2600_BW);
((Atari2600)Global.Emulator).SetP1Diff(Global.Config.Atari2600_BW);
if (Global.Config.Atari2600_RightDifficulty)
GlobalWinF.OSD.AddMessage("Setting Right Difficulty to B");
else
@ -1686,7 +1686,7 @@ namespace BizHawk.MultiClient
public void SNES_ToggleBG1(bool? setto = null)
{
if (GlobalWinF.Emulator is LibsnesCore)
if (Global.Emulator is LibsnesCore)
{
if (setto.HasValue)
{
@ -1711,7 +1711,7 @@ namespace BizHawk.MultiClient
public void SNES_ToggleBG2(bool? setto = null)
{
if (GlobalWinF.Emulator is LibsnesCore)
if (Global.Emulator is LibsnesCore)
{
if (setto.HasValue)
{
@ -1735,7 +1735,7 @@ namespace BizHawk.MultiClient
public void SNES_ToggleBG3(bool? setto = null)
{
if (GlobalWinF.Emulator is LibsnesCore)
if (Global.Emulator is LibsnesCore)
{
if (setto.HasValue)
{
@ -1759,7 +1759,7 @@ namespace BizHawk.MultiClient
public void SNES_ToggleBG4(bool? setto = null)
{
if (GlobalWinF.Emulator is LibsnesCore)
if (Global.Emulator is LibsnesCore)
{
if (setto.HasValue)
{
@ -1783,7 +1783,7 @@ namespace BizHawk.MultiClient
public void SNES_ToggleOBJ1(bool? setto = null)
{
if (GlobalWinF.Emulator is LibsnesCore)
if (Global.Emulator is LibsnesCore)
{
if (setto.HasValue)
{
@ -1807,7 +1807,7 @@ namespace BizHawk.MultiClient
public void SNES_ToggleOBJ2(bool? setto = null)
{
if (GlobalWinF.Emulator is LibsnesCore)
if (Global.Emulator is LibsnesCore)
{
if (setto.HasValue)
{
@ -1831,7 +1831,7 @@ namespace BizHawk.MultiClient
public void SNES_ToggleOBJ3(bool? setto = null)
{
if (GlobalWinF.Emulator is LibsnesCore)
if (Global.Emulator is LibsnesCore)
{
if (setto.HasValue)
{
@ -1855,7 +1855,7 @@ namespace BizHawk.MultiClient
public void SNES_ToggleOBJ4(bool? setto = null)
{
if (GlobalWinF.Emulator is LibsnesCore)
if (Global.Emulator is LibsnesCore)
{
if (setto.HasValue)
{
@ -2122,7 +2122,7 @@ namespace BizHawk.MultiClient
{
var ofd = new OpenFileDialog
{
InitialDirectory = PathManager.GetRomsPath(GlobalWinF.Emulator.SystemId),
InitialDirectory = PathManager.GetRomsPath(Global.Emulator.SystemId),
Multiselect = true,
Filter = FormatFilter(
"Movie Files", "*.fm2;*.mc2;*.mcm;*.mmv;*.gmv;*.vbm;*.lsmv;*.fcm;*.fmv;*.vmv;*.nmv;*.smv;*.zmv;",
@ -2189,8 +2189,9 @@ namespace BizHawk.MultiClient
}
else if (ext.ToUpper() == ".CHT")
{
GlobalWinF.CheatList.Load(filePaths[0], false);
Global.CheatList.Load(filePaths[0], false);
LoadCheatsWindow();
ToolHelpers.UpdateCheatRelatedTools();
}
else if (ext.ToUpper() == ".WCH")
{
@ -2363,9 +2364,9 @@ namespace BizHawk.MultiClient
private void changeDMGPalettesToolStripMenuItem_Click(object sender, EventArgs e)
{
if (GlobalWinF.Emulator is Gameboy)
if (Global.Emulator is Gameboy)
{
var g = GlobalWinF.Emulator as Gameboy;
var g = Global.Emulator as Gameboy;
if (g.IsCGBMode())
{
if (GBtools.CGBColorChooserForm.DoCGBColorChooserFormDialog(this))
@ -2392,7 +2393,7 @@ namespace BizHawk.MultiClient
private void sNESToolStripMenuItem_DropDownOpened(object sender, EventArgs e)
{
if ((GlobalWinF.Emulator as LibsnesCore).IsSGB)
if ((Global.Emulator as LibsnesCore).IsSGB)
{
loadGBInSGBToolStripMenuItem.Visible = true;
loadGBInSGBToolStripMenuItem.Checked = Global.Config.GB_AsSGB;
@ -2617,14 +2618,14 @@ namespace BizHawk.MultiClient
{
try
{
(GlobalWinF.Emulator as TI83).LinkPort.SendFileToCalc(File.OpenRead(OFD.FileName), true);
(Global.Emulator as TI83).LinkPort.SendFileToCalc(File.OpenRead(OFD.FileName), true);
}
catch (IOException ex)
{
string Message = string.Format("Invalid file format. Reason: {0} \nForce transfer? This may cause the calculator to crash.", ex.Message);
if (MessageBox.Show(Message, "Upload Failed", MessageBoxButtons.YesNoCancel, MessageBoxIcon.Question) == System.Windows.Forms.DialogResult.Yes)
(GlobalWinF.Emulator as TI83).LinkPort.SendFileToCalc(File.OpenRead(OFD.FileName), false);
(Global.Emulator as TI83).LinkPort.SendFileToCalc(File.OpenRead(OFD.FileName), false);
}
}
}

View File

@ -14,8 +14,8 @@ namespace BizHawk.MultiClient
{
if (GlobalWinF.MovieSession.Movie.IsPlaying)
{
GlobalWinF.MovieSession.Movie.ClearFrame(GlobalWinF.Emulator.Frame);
GlobalWinF.OSD.AddMessage("Scrubbed input at frame " + GlobalWinF.Emulator.Frame.ToString());
GlobalWinF.MovieSession.Movie.ClearFrame(Global.Emulator.Frame);
GlobalWinF.OSD.AddMessage("Scrubbed input at frame " + Global.Emulator.Frame.ToString());
}
}
@ -42,7 +42,7 @@ namespace BizHawk.MultiClient
if (GlobalWinF.MovieSession.Movie.StartsFromSavestate)
{
LoadStateFile(GlobalWinF.MovieSession.Movie.Filename, Path.GetFileName(GlobalWinF.MovieSession.Movie.Filename));
GlobalWinF.Emulator.ResetFrameCounter();
Global.Emulator.ResetFrameCounter();
}
if (record)
{
@ -92,10 +92,10 @@ namespace BizHawk.MultiClient
public void RecordMovie()
{
// put any BEETA quality cores here
if (GlobalWinF.Emulator is Emulation.Consoles.Nintendo.GBA.GBA ||
GlobalWinF.Emulator is Emulation.Consoles.Sega.Genesis ||
GlobalWinF.Emulator is Emulation.Consoles.Sega.Saturn.Yabause ||
GlobalWinF.Emulator is Emulation.Consoles.Sony.PSP.PSP)
if (Global.Emulator is Emulation.Consoles.Nintendo.GBA.GBA ||
Global.Emulator is Emulation.Consoles.Sega.Genesis ||
Global.Emulator is Emulation.Consoles.Sega.Saturn.Yabause ||
Global.Emulator is Emulation.Consoles.Sony.PSP.PSP)
{
var result = MessageBox.Show
(this, "Thanks for using Bizhawk! The emulation core you have selected " +
@ -116,7 +116,7 @@ namespace BizHawk.MultiClient
if (GlobalWinF.MovieSession.Movie.StartsFromSavestate)
{
LoadStateFile(GlobalWinF.MovieSession.Movie.Filename, Path.GetFileName(GlobalWinF.MovieSession.Movie.Filename));
GlobalWinF.Emulator.ResetFrameCounter();
Global.Emulator.ResetFrameCounter();
}
GlobalWinF.MovieSession.Movie.StartPlayback();
SetMainformMovieInfo();
@ -277,7 +277,7 @@ namespace BizHawk.MultiClient
else if (GlobalWinF.MovieSession.Movie.IsFinished)
{
if (GlobalWinF.Emulator.Frame < GlobalWinF.MovieSession.Movie.Frames) //This scenario can happen from rewinding (suddenly we are back in the movie, so hook back up to the movie
if (Global.Emulator.Frame < GlobalWinF.MovieSession.Movie.Frames) //This scenario can happen from rewinding (suddenly we are back in the movie, so hook back up to the movie
{
GlobalWinF.MovieSession.Movie.SwitchToPlay();
GlobalWinF.MovieSession.LatchInputFromLog();
@ -290,13 +290,13 @@ namespace BizHawk.MultiClient
else if (GlobalWinF.MovieSession.Movie.IsPlaying)
{
if (GlobalWinF.Emulator.Frame >= GlobalWinF.MovieSession.Movie.Frames)
if (Global.Emulator.Frame >= GlobalWinF.MovieSession.Movie.Frames)
{
if (TAStudio1.IsHandleCreated && !TAStudio1.IsDisposed)
{
GlobalWinF.MovieSession.Movie.CaptureState();
GlobalWinF.MovieSession.LatchInputFromLog();
GlobalWinF.MovieSession.Movie.CommitFrame(GlobalWinF.Emulator.Frame, GlobalWinF.MovieOutputHardpoint);
GlobalWinF.MovieSession.Movie.CommitFrame(Global.Emulator.Frame, GlobalWinF.MovieOutputHardpoint);
}
else
{
@ -320,7 +320,7 @@ namespace BizHawk.MultiClient
if (!mg.IsEmpty)
{
GlobalWinF.MovieSession.LatchInputFromPlayer(GlobalWinF.MovieInputSourceAdapter);
GlobalWinF.MovieSession.Movie.PokeFrame(GlobalWinF.Emulator.Frame, mg.GetControllersAsMnemonic());
GlobalWinF.MovieSession.Movie.PokeFrame(Global.Emulator.Frame, mg.GetControllersAsMnemonic());
}
else
{
@ -343,14 +343,14 @@ namespace BizHawk.MultiClient
}
//the movie session makes sure that the correct input has been read and merged to its MovieControllerAdapter;
//this has been wired to Global.MovieOutputHardpoint in RewireInputChain
GlobalWinF.MovieSession.Movie.CommitFrame(GlobalWinF.Emulator.Frame, GlobalWinF.MovieOutputHardpoint);
GlobalWinF.MovieSession.Movie.CommitFrame(Global.Emulator.Frame, GlobalWinF.MovieOutputHardpoint);
}
}
//On movie load, these need to be set based on the contents of the movie file
private void SetSyncDependentSettings()
{
switch (GlobalWinF.Emulator.SystemId)
switch (Global.Emulator.SystemId)
{
case "Coleco":
string str = GlobalWinF.MovieSession.Movie.Header.GetHeaderLine(MovieHeader.SKIPBIOS);

View File

@ -390,9 +390,9 @@ namespace BizHawk.MultiClient
//log a frame
if (LastState != null && GlobalWinF.Emulator.Frame % RewindFrequency == 0)
if (LastState != null && Global.Emulator.Frame % RewindFrequency == 0)
{
byte[] CurrentState = GlobalWinF.Emulator.SaveStateBinary();
byte[] CurrentState = Global.Emulator.SaveStateBinary();
RewindThread.Capture(CurrentState);
}
}
@ -419,7 +419,7 @@ namespace BizHawk.MultiClient
public void DoRewindSettings()
{
// This is the first frame. Capture the state, and put it in LastState for future deltas to be compared against.
LastState = GlobalWinF.Emulator.SaveStateBinary();
LastState = Global.Emulator.SaveStateBinary();
int state_size = 0;
if (LastState.Length >= Global.Config.Rewind_LargeStateSize)
@ -572,7 +572,7 @@ namespace BizHawk.MultiClient
bool fullstate = reader.ReadBoolean();
if (fullstate)
{
GlobalWinF.Emulator.LoadStateBinary(reader);
Global.Emulator.LoadStateBinary(reader);
}
else
{
@ -590,7 +590,7 @@ namespace BizHawk.MultiClient
}
reader.Close();
output.Position = 0;
GlobalWinF.Emulator.LoadStateBinary(new BinaryReader(output));
Global.Emulator.LoadStateBinary(new BinaryReader(output));
}
}

View File

@ -138,7 +138,26 @@ namespace BizHawk.MultiClient
public void Cheats_Restart()
{
if (_cheats != null) _cheats.Restart();
else GlobalWinF.CheatList.NewList();
else Global.CheatList.NewList(GenerateDefaultCheatFilename());
ToolHelpers.UpdateCheatRelatedTools();
}
public string GenerateDefaultCheatFilename()
{
PathEntry pathEntry = Global.Config.PathEntries[Global.Emulator.SystemId, "Cheats"];
if (pathEntry == null)
{
pathEntry = Global.Config.PathEntries[Global.Emulator.SystemId, "Base"];
}
string path = PathManager.MakeAbsolutePath(pathEntry.Path, Global.Emulator.SystemId);
var f = new FileInfo(path);
if (f.Directory != null && f.Directory.Exists == false)
{
f.Directory.Create();
}
return Path.Combine(path, PathManager.FilesystemSafeName(Global.Game) + ".cht");
}
#if WINDOWS
@ -176,7 +195,7 @@ namespace BizHawk.MultiClient
FFMpeg.FFMpegPath = PathManager.MakeProgramRelativePath(Global.Config.FFMpegPath);
GlobalWinF.CheatList = new CheatList();
Global.CheatList = new CheatList();
UpdateStatusSlots();
UpdateKeyPriorityIcon();
@ -204,7 +223,7 @@ namespace BizHawk.MultiClient
Closing += (o, e) =>
{
GlobalWinF.CheatList.SaveOnClose();
Global.CheatList.SaveOnClose();
CloseGame();
GlobalWinF.MovieSession.Movie.Stop();
CloseTools();
@ -226,7 +245,7 @@ namespace BizHawk.MultiClient
InitControls();
GlobalWinF.CoreComm = new CoreComm();
SyncCoreCommInputSignals();
GlobalWinF.Emulator = new NullEmulator(GlobalWinF.CoreComm);
Global.Emulator = new NullEmulator(GlobalWinF.CoreComm);
GlobalWinF.ActiveController = GlobalWinF.NullControls;
GlobalWinF.AutoFireController = GlobalWinF.AutofireNullControls;
GlobalWinF.AutofireStickyXORAdapter.SetOnOffPatternFromConfig();
@ -350,23 +369,23 @@ namespace BizHawk.MultiClient
{
LoadCheatsWindow();
}
if (Global.Config.AutoLoadNESPPU && GlobalWinF.Emulator is NES)
if (Global.Config.AutoLoadNESPPU && Global.Emulator is NES)
{
LoadNESPPU();
}
if (Global.Config.AutoLoadNESNameTable && GlobalWinF.Emulator is NES)
if (Global.Config.AutoLoadNESNameTable && Global.Emulator is NES)
{
LoadNESNameTable();
}
if (Global.Config.AutoLoadNESDebugger && GlobalWinF.Emulator is NES)
if (Global.Config.AutoLoadNESDebugger && Global.Emulator is NES)
{
LoadNESDebugger();
}
if (Global.Config.NESGGAutoload && GlobalWinF.Emulator is NES)
if (Global.Config.NESGGAutoload && Global.Emulator is NES)
{
LoadGameGenieEC();
}
if (Global.Config.AutoLoadGBGPUView && GlobalWinF.Emulator is Gameboy)
if (Global.Config.AutoLoadGBGPUView && Global.Emulator is Gameboy)
{
LoadGBGPUView();
}
@ -382,11 +401,11 @@ namespace BizHawk.MultiClient
{
OpenLuaConsole();
}
if (Global.Config.PCEBGViewerAutoload && GlobalWinF.Emulator is PCEngine)
if (Global.Config.PCEBGViewerAutoload && Global.Emulator is PCEngine)
{
LoadPCEBGViewer();
}
if (Global.Config.AutoLoadSNESGraphicsDebugger && GlobalWinF.Emulator is LibsnesCore)
if (Global.Config.AutoLoadSNESGraphicsDebugger && Global.Emulator is LibsnesCore)
{
LoadSNESGraphicsDebugger();
}
@ -608,9 +627,9 @@ namespace BizHawk.MultiClient
GlobalWinF.ForceNoThrottle = unthrottled || fastforward;
// realtime throttle is never going to be so exact that using a double here is wrong
throttle.SetCoreFps(GlobalWinF.Emulator.CoreComm.VsyncRate);
throttle.SetCoreFps(Global.Emulator.CoreComm.VsyncRate);
throttle.signal_paused = EmulatorPaused || GlobalWinF.Emulator is NullEmulator;
throttle.signal_paused = EmulatorPaused || Global.Emulator is NullEmulator;
throttle.signal_unthrottle = unthrottled || superfastforward;
if (fastforward)
@ -793,7 +812,7 @@ namespace BizHawk.MultiClient
public bool IsNullEmulator()
{
return GlobalWinF.Emulator is NullEmulator;
return Global.Emulator is NullEmulator;
}
private string DisplayNameForSystem(string system)
@ -893,7 +912,7 @@ namespace BizHawk.MultiClient
break;
case "SNES":
case "SGB":
if ((GlobalWinF.Emulator as LibsnesCore).IsSGB)
if ((Global.Emulator as LibsnesCore).IsSGB)
sNESToolStripMenuItem.Text = "&SGB";
else
sNESToolStripMenuItem.Text = "&SNES";
@ -916,7 +935,7 @@ namespace BizHawk.MultiClient
nESSpeicalToolStripMenuItem.Visible = true;
nESSpeicalToolStripMenuItem.DropDownItems.Add(name, null, delegate
{
if (GlobalWinF.Emulator.ControllerDefinition.BoolButtons.Contains(button))
if (Global.Emulator.ControllerDefinition.BoolButtons.Contains(button))
{
if (!GlobalWinF.MovieSession.Movie.IsPlaying || GlobalWinF.MovieSession.Movie.IsFinished)
{
@ -932,7 +951,7 @@ namespace BizHawk.MultiClient
// ugly and hacky
nESSpeicalToolStripMenuItem.Visible = false;
nESSpeicalToolStripMenuItem.DropDownItems.Clear();
var ss = GlobalWinF.Emulator.ControllerDefinition.BoolButtons;
var ss = Global.Emulator.ControllerDefinition.BoolButtons;
if (ss.Contains("FDS Eject"))
NESSpeicalMenuAdd("Eject Disk", "FDS Eject", "FDS Disk Ejected.");
for (int i = 0; i < 16; i++)
@ -950,7 +969,7 @@ namespace BizHawk.MultiClient
void SaturnSetPrefs(Emulation.Consoles.Sega.Saturn.Yabause e = null)
{
if (e == null)
e = GlobalWinF.Emulator as Emulation.Consoles.Sega.Saturn.Yabause;
e = Global.Emulator as Emulation.Consoles.Sega.Saturn.Yabause;
if (Global.Config.SaturnUseGL != e.GLMode)
{
@ -1014,15 +1033,15 @@ namespace BizHawk.MultiClient
void SyncControls()
{
var def = GlobalWinF.Emulator.ControllerDefinition;
var def = Global.Emulator.ControllerDefinition;
GlobalWinF.ActiveController = BindToDefinition(def, Global.Config.AllTrollers, Global.Config.AllTrollersAnalog);
GlobalWinF.AutoFireController = BindToDefinitionAF(def, Global.Config.AllTrollersAutoFire);
// allow propogating controls that are in the current controller definition but not in the prebaked one
// these two lines shouldn't be required anymore under the new system?
GlobalWinF.ActiveController.ForceType(new ControllerDefinition(GlobalWinF.Emulator.ControllerDefinition));
GlobalWinF.ClickyVirtualPadController.Type = new ControllerDefinition(GlobalWinF.Emulator.ControllerDefinition);
GlobalWinF.ActiveController.ForceType(new ControllerDefinition(Global.Emulator.ControllerDefinition));
GlobalWinF.ClickyVirtualPadController.Type = new ControllerDefinition(Global.Emulator.ControllerDefinition);
RewireInputChain();
}
@ -1043,7 +1062,7 @@ namespace BizHawk.MultiClient
GlobalWinF.MovieInputSourceAdapter.Source = GlobalWinF.ForceOffAdaptor;
GlobalWinF.ControllerOutput.Source = GlobalWinF.MovieOutputHardpoint;
GlobalWinF.Emulator.Controller = GlobalWinF.ControllerOutput;
Global.Emulator.Controller = GlobalWinF.ControllerOutput;
GlobalWinF.MovieSession.MovieControllerAdapter.Type = GlobalWinF.MovieInputSourceAdapter.Type;
//connect the movie session before MovieOutputHardpoint if it is doing anything
@ -1538,8 +1557,8 @@ namespace BizHawk.MultiClient
if (nextEmulator == null) throw new Exception("No core could load the rom.");
CloseGame();
GlobalWinF.Emulator.Dispose();
GlobalWinF.Emulator = nextEmulator;
Global.Emulator.Dispose();
Global.Emulator = nextEmulator;
GlobalWinF.CoreComm = nextComm;
Global.Game = game;
SyncCoreCommInputSignals();
@ -1553,7 +1572,7 @@ namespace BizHawk.MultiClient
if (game.System == "NES")
{
NES nes = GlobalWinF.Emulator as NES;
NES nes = Global.Emulator as NES;
if (nes.GameName != null)
Global.Game.Name = nes.GameName;
Global.Game.Status = nes.RomStatus;
@ -1563,18 +1582,18 @@ namespace BizHawk.MultiClient
Text = DisplayNameForSystem(game.System) + " - " + game.Name;
ResetRewindBuffer();
if (GlobalWinF.Emulator.CoreComm.RomStatusDetails == null)
if (Global.Emulator.CoreComm.RomStatusDetails == null)
{
GlobalWinF.Emulator.CoreComm.RomStatusDetails =
Global.Emulator.CoreComm.RomStatusDetails =
string.Format("{0}\r\nSHA1:{1}\r\nMD5:{2}\r\n",
game.Name,
Util.BytesToHexString(System.Security.Cryptography.SHA1.Create().ComputeHash(rom.RomData)),
Util.BytesToHexString(System.Security.Cryptography.MD5.Create().ComputeHash(rom.RomData)));
}
if (GlobalWinF.Emulator.BoardName != null)
if (Global.Emulator.BoardName != null)
{
Console.WriteLine("Core reported BoardID: \"{0}\"", GlobalWinF.Emulator.BoardName);
Console.WriteLine("Core reported BoardID: \"{0}\"", Global.Emulator.BoardName);
}
//restarts the lua console if a different rom is loaded.
@ -1616,7 +1635,7 @@ namespace BizHawk.MultiClient
if (Global.Config.LoadCheatFileByGame)
{
if (GlobalWinF.CheatList.AttemptToLoadCheatFile())
if (Global.CheatList.AttemptToLoadCheatFile())
{
ToolHelpers.UpdateCheatRelatedTools();
GlobalWinF.OSD.AddMessage("Cheats file loaded");
@ -1654,20 +1673,20 @@ namespace BizHawk.MultiClient
else if (Global.Config.SoundThrottle)
{
// for sound throttle, use sync mode
GlobalWinF.Emulator.EndAsyncSound();
GlobalWinF.Sound.SetSyncInputPin(GlobalWinF.Emulator.SyncSoundProvider);
Global.Emulator.EndAsyncSound();
GlobalWinF.Sound.SetSyncInputPin(Global.Emulator.SyncSoundProvider);
}
else
{
// for vsync\clock throttle modes, use async
if (!GlobalWinF.Emulator.StartAsyncSound())
if (!Global.Emulator.StartAsyncSound())
{
// if the core doesn't support async mode, use a standard vecna wrapper
GlobalWinF.Sound.SetAsyncInputPin(new Emulation.Sound.MetaspuAsync(GlobalWinF.Emulator.SyncSoundProvider, Emulation.Sound.ESynchMethod.ESynchMethod_V));
GlobalWinF.Sound.SetAsyncInputPin(new Emulation.Sound.MetaspuAsync(Global.Emulator.SyncSoundProvider, Emulation.Sound.ESynchMethod.ESynchMethod_V));
}
else
{
GlobalWinF.Sound.SetAsyncInputPin(GlobalWinF.Emulator.SoundProvider);
GlobalWinF.Sound.SetAsyncInputPin(Global.Emulator.SoundProvider);
}
}
}
@ -1677,7 +1696,7 @@ namespace BizHawk.MultiClient
DumpStatus.Image = Properties.Resources.Blank;
DumpStatus.ToolTipText = "";
if (GlobalWinF.Emulator == null) return;
if (Global.Emulator == null) return;
if (Global.Game == null) return;
var status = Global.Game.Status;
@ -1722,8 +1741,8 @@ namespace BizHawk.MultiClient
DumpStatus.Image = Properties.Resources.GreenCheck;
annotation = "Verified good dump";
}
if (!string.IsNullOrEmpty(GlobalWinF.Emulator.CoreComm.RomStatusAnnotation))
annotation = GlobalWinF.Emulator.CoreComm.RomStatusAnnotation;
if (!string.IsNullOrEmpty(Global.Emulator.CoreComm.RomStatusAnnotation))
annotation = Global.Emulator.CoreComm.RomStatusAnnotation;
DumpStatus.ToolTipText = annotation;
}
@ -1736,17 +1755,17 @@ namespace BizHawk.MultiClient
{
byte[] sram;
// GBA core might not know how big the saveram ought to be, so just send it the whole file
if (GlobalWinF.Emulator is GBA)
if (Global.Emulator is GBA)
{
sram = File.ReadAllBytes(PathManager.SaveRamPath(Global.Game));
}
else
{
sram = new byte[GlobalWinF.Emulator.ReadSaveRam().Length];
sram = new byte[Global.Emulator.ReadSaveRam().Length];
using (var reader = new BinaryReader(new FileStream(PathManager.SaveRamPath(Global.Game), FileMode.Open, FileAccess.Read)))
reader.Read(sram, 0, sram.Length);
}
GlobalWinF.Emulator.StoreSaveRam(sram);
Global.Emulator.StoreSaveRam(sram);
}
catch (IOException) { }
}
@ -1772,7 +1791,7 @@ namespace BizHawk.MultiClient
var writer = new BinaryWriter(new FileStream(path, FileMode.Create, FileAccess.Write));
var saveram = GlobalWinF.Emulator.ReadSaveRam();
var saveram = Global.Emulator.ReadSaveRam();
// this assumes that the default state of the core's sram is 0-filled, so don't do
// int len = Util.SaveRamBytesUsed(saveram);
@ -2149,7 +2168,7 @@ namespace BizHawk.MultiClient
double frameAdvanceTimestampDelta = (now - FrameAdvanceTimestamp).TotalMilliseconds;
bool frameProgressTimeElapsed = Global.Config.FrameProgressDelayMs < frameAdvanceTimestampDelta;
if (Global.Config.SkipLagFrame && GlobalWinF.Emulator.IsLagFrame && frameProgressTimeElapsed)
if (Global.Config.SkipLagFrame && Global.Emulator.IsLagFrame && frameProgressTimeElapsed)
{
runFrame = true;
}
@ -2271,10 +2290,10 @@ namespace BizHawk.MultiClient
coreskipaudio = GlobalWinF.ClientControls["Turbo"] && CurrAviWriter == null;
//=======================================
GlobalWinF.CheatList.Pulse();
GlobalWinF.Emulator.FrameAdvance(!throttle.skipnextframe || CurrAviWriter != null, !coreskipaudio);
Global.CheatList.Pulse();
Global.Emulator.FrameAdvance(!throttle.skipnextframe || CurrAviWriter != null, !coreskipaudio);
GlobalWinF.DisplayManager.NeedsToPaint = true;
GlobalWinF.CheatList.Pulse();
Global.CheatList.Pulse();
//=======================================
if (!PauseAVI)
@ -2282,7 +2301,7 @@ namespace BizHawk.MultiClient
AVIFrameAdvance();
}
if (GlobalWinF.Emulator.IsLagFrame && Global.Config.AutofireLagFrames)
if (Global.Emulator.IsLagFrame && Global.Config.AutofireLagFrames)
{
GlobalWinF.AutoFireController.IncrementStarts();
}
@ -2382,7 +2401,7 @@ namespace BizHawk.MultiClient
private unsafe Image MakeScreenshotImage()
{
var video = GlobalWinF.Emulator.VideoProvider;
var video = Global.Emulator.VideoProvider;
var image = new Bitmap(video.BufferWidth, video.BufferHeight, PixelFormat.Format32bppArgb);
//TODO - replace with BitmapBuffer
@ -2395,7 +2414,7 @@ namespace BizHawk.MultiClient
{
int col = framebuf[(y * video.BufferWidth) + x];
if (GlobalWinF.Emulator is TI83)
if (Global.Emulator is TI83)
{
if (col == 0)
col = Color.Black.ToArgb();
@ -2476,16 +2495,16 @@ namespace BizHawk.MultiClient
public void SaveStateFile(string filename, string name, bool fromLua)
{
if (Global.Config.SaveStateType == Config.SaveStateTypeE.Text ||
(Global.Config.SaveStateType == Config.SaveStateTypeE.Default && !GlobalWinF.Emulator.BinarySaveStatesPreferred))
(Global.Config.SaveStateType == Config.SaveStateTypeE.Default && !Global.Emulator.BinarySaveStatesPreferred))
{
// text mode savestates
var writer = new StreamWriter(filename);
GlobalWinF.Emulator.SaveStateText(writer);
Global.Emulator.SaveStateText(writer);
HandleMovieSaveState(writer);
if (Global.Config.SaveScreenshotWithStates)
{
writer.Write("Framebuffer ");
GlobalWinF.Emulator.VideoProvider.GetVideoBuffer().SaveAsHex(writer);
Global.Emulator.VideoProvider.GetVideoBuffer().SaveAsHex(writer);
}
writer.Close();
//DateTime end = DateTime.UtcNow;
@ -2501,7 +2520,7 @@ namespace BizHawk.MultiClient
delegate(Stream s)
{
BinaryWriter bw = new BinaryWriter(s);
GlobalWinF.Emulator.SaveStateBinary(bw);
Global.Emulator.SaveStateBinary(bw);
bw.Flush();
});
if (Global.Config.SaveScreenshotWithStates)
@ -2509,7 +2528,7 @@ namespace BizHawk.MultiClient
bs.PutFrameBuffer(
delegate(Stream s)
{
var buff = GlobalWinF.Emulator.VideoProvider.GetVideoBuffer();
var buff = Global.Emulator.VideoProvider.GetVideoBuffer();
BinaryWriter bw = new BinaryWriter(s);
bw.Write(buff);
bw.Flush();
@ -2522,7 +2541,7 @@ namespace BizHawk.MultiClient
{
StreamWriter sw = new StreamWriter(s);
// this never should have been a core's responsibility
sw.WriteLine("Frame {0}", GlobalWinF.Emulator.Frame);
sw.WriteLine("Frame {0}", Global.Emulator.Frame);
HandleMovieSaveState(sw);
sw.Flush();
});
@ -2585,7 +2604,7 @@ namespace BizHawk.MultiClient
delegate(Stream s)
{
BinaryReader br = new BinaryReader(s);
GlobalWinF.Emulator.LoadStateBinary(br);
Global.Emulator.LoadStateBinary(br);
});
bw.GetFrameBuffer(
@ -2593,7 +2612,7 @@ namespace BizHawk.MultiClient
{
BinaryReader br = new BinaryReader(s);
int i;
var buff = GlobalWinF.Emulator.VideoProvider.GetVideoBuffer();
var buff = Global.Emulator.VideoProvider.GetVideoBuffer();
try
{
for (i = 0; i < buff.Length; i++)
@ -2623,7 +2642,7 @@ namespace BizHawk.MultiClient
{
using (var reader = new StreamReader(path))
{
GlobalWinF.Emulator.LoadStateText(reader);
Global.Emulator.LoadStateText(reader);
while (true)
{
@ -2634,7 +2653,7 @@ namespace BizHawk.MultiClient
string[] args = str.Split(' ');
if (args[0] == "Framebuffer")
{
GlobalWinF.Emulator.VideoProvider.GetVideoBuffer().ReadFromHex(args[1]);
Global.Emulator.VideoProvider.GetVideoBuffer().ReadFromHex(args[1]);
}
}
@ -2785,7 +2804,7 @@ namespace BizHawk.MultiClient
public void LoadNesSoundConfig()
{
if (GlobalWinF.Emulator is NES)
if (Global.Emulator is NES)
{
if (!NesSound.IsHandleCreated || NesSound.IsDisposed)
{
@ -2800,7 +2819,7 @@ namespace BizHawk.MultiClient
public void LoadGameGenieEC()
{
if (GlobalWinF.Emulator is NES)
if (Global.Emulator is NES)
{
if (!NESgg.IsHandleCreated || NESgg.IsDisposed)
{
@ -2810,7 +2829,7 @@ namespace BizHawk.MultiClient
else
NESgg.Focus();
}
else if (GlobalWinF.Emulator is LibsnesCore)
else if (Global.Emulator is LibsnesCore)
{
if (!SNESgg.IsHandleCreated || SNESgg.IsDisposed)
{
@ -2820,7 +2839,7 @@ namespace BizHawk.MultiClient
else
SNESgg.Focus();
}
else if ((GlobalWinF.Emulator.SystemId == "GB") || (Global.Game.System == "GG"))
else if ((Global.Emulator.SystemId == "GB") || (Global.Game.System == "GG"))
{
if (!GBgg.IsHandleCreated || GBgg.IsDisposed)
{
@ -2830,7 +2849,7 @@ namespace BizHawk.MultiClient
else
GBgg.Focus();
}
else if (GlobalWinF.Emulator is Genesis)
else if (Global.Emulator is Genesis)
{
if (!Gengg.IsHandleCreated || Gengg.IsDisposed)
{
@ -2867,7 +2886,7 @@ namespace BizHawk.MultiClient
public void LoadTraceLogger()
{
if (GlobalWinF.Emulator.CoreComm.CpuTraceAvailable)
if (Global.Emulator.CoreComm.CpuTraceAvailable)
{
if (!TraceLogger1.IsHandleCreated || TraceLogger1.IsDisposed)
{
@ -3081,7 +3100,7 @@ namespace BizHawk.MultiClient
private void Render()
{
var video = GlobalWinF.Emulator.VideoProvider;
var video = Global.Emulator.VideoProvider;
if (video.BufferHeight != lastHeight || video.BufferWidth != lastWidth)
{
lastWidth = video.BufferWidth;
@ -3089,7 +3108,7 @@ namespace BizHawk.MultiClient
FrameBufferResized();
}
GlobalWinF.DisplayManager.UpdateSource(GlobalWinF.Emulator.VideoProvider);
GlobalWinF.DisplayManager.UpdateSource(Global.Emulator.VideoProvider);
}
public void FrameBufferResized()
@ -3097,7 +3116,7 @@ namespace BizHawk.MultiClient
// run this entire thing exactly twice, since the first resize may adjust the menu stacking
for (int i = 0; i < 2; i++)
{
var video = GlobalWinF.Emulator.VideoProvider;
var video = Global.Emulator.VideoProvider;
int zoom = Global.Config.TargetZoomFactor;
var area = Screen.FromControl(this).WorkingArea;
@ -3207,7 +3226,7 @@ namespace BizHawk.MultiClient
int LastOpenRomFilter;
private void OpenROM()
{
var ofd = new OpenFileDialog { InitialDirectory = PathManager.GetRomsPath(GlobalWinF.Emulator.SystemId) };
var ofd = new OpenFileDialog { InitialDirectory = PathManager.GetRomsPath(Global.Emulator.SystemId) };
//"Rom Files|*.NES;*.SMS;*.GG;*.SG;*.PCE;*.SGX;*.GB;*.BIN;*.SMD;*.ROM;*.ZIP;*.7z|NES (*.NES)|*.NES|Master System|*.SMS;*.GG;*.SG;*.ZIP;*.7z|PC Engine|*.PCE;*.SGX;*.ZIP;*.7z|Gameboy|*.GB;*.ZIP;*.7z|TI-83|*.rom|Archive Files|*.zip;*.7z|Savestate|*.state|All Files|*.*";
//adelikat: ugly design for this, I know
@ -3279,7 +3298,7 @@ namespace BizHawk.MultiClient
private void CloseGame(bool clearSRAM = false)
{
if (Global.Config.AutoSavestates && GlobalWinF.Emulator is NullEmulator == false)
if (Global.Config.AutoSavestates && Global.Emulator is NullEmulator == false)
{
SaveState("Auto");
}
@ -3293,16 +3312,16 @@ namespace BizHawk.MultiClient
GlobalWinF.OSD.AddMessage("SRAM cleared.");
}
}
else if (GlobalWinF.Emulator.SaveRamModified)
else if (Global.Emulator.SaveRamModified)
{
SaveRam();
}
StopAVI();
GlobalWinF.Emulator.Dispose();
Global.Emulator.Dispose();
GlobalWinF.CoreComm = new CoreComm();
SyncCoreCommInputSignals();
GlobalWinF.Emulator = new NullEmulator(GlobalWinF.CoreComm);
Global.Emulator = new NullEmulator(GlobalWinF.CoreComm);
GlobalWinF.ActiveController = GlobalWinF.NullControls;
GlobalWinF.AutoFireController = GlobalWinF.AutofireNullControls;
GlobalWinF.MovieSession.Movie.Stop();
@ -3315,7 +3334,7 @@ namespace BizHawk.MultiClient
CloseGame(clearSRAM);
GlobalWinF.CoreComm = new CoreComm();
SyncCoreCommInputSignals();
GlobalWinF.Emulator = new NullEmulator(GlobalWinF.CoreComm);
Global.Emulator = new NullEmulator(GlobalWinF.CoreComm);
Global.Game = GameInfo.GetNullGame();
RewireSound();
@ -3505,7 +3524,7 @@ namespace BizHawk.MultiClient
private void SoftReset()
{
//is it enough to run this for one frame? maybe..
if (GlobalWinF.Emulator.ControllerDefinition.BoolButtons.Contains("Reset"))
if (Global.Emulator.ControllerDefinition.BoolButtons.Contains("Reset"))
{
if (!GlobalWinF.MovieSession.Movie.IsPlaying || GlobalWinF.MovieSession.Movie.IsFinished)
{
@ -3518,7 +3537,7 @@ namespace BizHawk.MultiClient
private void HardReset()
{
//is it enough to run this for one frame? maybe..
if (GlobalWinF.Emulator.ControllerDefinition.BoolButtons.Contains("Power"))
if (Global.Emulator.ControllerDefinition.BoolButtons.Contains("Power"))
{
if (!GlobalWinF.MovieSession.Movie.IsPlaying || GlobalWinF.MovieSession.Movie.IsFinished)
{
@ -3722,11 +3741,11 @@ namespace BizHawk.MultiClient
try
{
aw.SetMovieParameters(GlobalWinF.Emulator.CoreComm.VsyncNum, GlobalWinF.Emulator.CoreComm.VsyncDen);
aw.SetMovieParameters(Global.Emulator.CoreComm.VsyncNum, Global.Emulator.CoreComm.VsyncDen);
if (avwriter_resizew > 0 && avwriter_resizeh > 0)
aw.SetVideoParameters(avwriter_resizew, avwriter_resizeh);
else
aw.SetVideoParameters(GlobalWinF.Emulator.VideoProvider.BufferWidth, GlobalWinF.Emulator.VideoProvider.BufferHeight);
aw.SetVideoParameters(Global.Emulator.VideoProvider.BufferWidth, Global.Emulator.VideoProvider.BufferHeight);
aw.SetAudioParameters(44100, 2, 16);
// select codec token
@ -3755,7 +3774,7 @@ namespace BizHawk.MultiClient
else
{
var sfd = new SaveFileDialog();
if (!(GlobalWinF.Emulator is NullEmulator))
if (!(Global.Emulator is NullEmulator))
{
sfd.FileName = PathManager.FilesystemSafeName(Global.Game);
sfd.InitialDirectory = PathManager.MakeAbsolutePath(Global.Config.PathEntries.AVPath, null);
@ -3795,10 +3814,10 @@ namespace BizHawk.MultiClient
}
// do sound rewire. the plan is to eventually have AVI writing support syncsound input, but it doesn't for the moment
if (!GlobalWinF.Emulator.StartAsyncSound())
AviSoundInput = new Emulation.Sound.MetaspuAsync(GlobalWinF.Emulator.SyncSoundProvider, Emulation.Sound.ESynchMethod.ESynchMethod_V);
if (!Global.Emulator.StartAsyncSound())
AviSoundInput = new Emulation.Sound.MetaspuAsync(Global.Emulator.SyncSoundProvider, Emulation.Sound.ESynchMethod.ESynchMethod_V);
else
AviSoundInput = GlobalWinF.Emulator.SoundProvider;
AviSoundInput = Global.Emulator.SoundProvider;
DumpProxy = new Emulation.Sound.MetaspuSoundProvider(Emulation.Sound.ESynchMethod.ESynchMethod_V);
SoundRemainder = 0;
RewireSound();
@ -3849,10 +3868,10 @@ namespace BizHawk.MultiClient
{
if (CurrAviWriter != null)
{
long nsampnum = 44100 * (long)GlobalWinF.Emulator.CoreComm.VsyncDen + SoundRemainder;
long nsamp = nsampnum / GlobalWinF.Emulator.CoreComm.VsyncNum;
long nsampnum = 44100 * (long)Global.Emulator.CoreComm.VsyncDen + SoundRemainder;
long nsamp = nsampnum / Global.Emulator.CoreComm.VsyncNum;
// exactly remember fractional parts of an audio sample
SoundRemainder = nsampnum % GlobalWinF.Emulator.CoreComm.VsyncNum;
SoundRemainder = nsampnum % Global.Emulator.CoreComm.VsyncNum;
short[] temp = new short[nsamp * 2];
AviSoundInput.GetSamples(temp);
@ -3868,9 +3887,9 @@ namespace BizHawk.MultiClient
bmpin = CaptureOSD();
else
{
bmpin = new Bitmap(GlobalWinF.Emulator.VideoProvider.BufferWidth, GlobalWinF.Emulator.VideoProvider.BufferHeight, PixelFormat.Format32bppArgb);
bmpin = new Bitmap(Global.Emulator.VideoProvider.BufferWidth, Global.Emulator.VideoProvider.BufferHeight, PixelFormat.Format32bppArgb);
var lockdata = bmpin.LockBits(new Rectangle(0, 0, bmpin.Width, bmpin.Height), ImageLockMode.WriteOnly, PixelFormat.Format32bppArgb);
System.Runtime.InteropServices.Marshal.Copy(GlobalWinF.Emulator.VideoProvider.GetVideoBuffer(), 0, lockdata.Scan0, bmpin.Width * bmpin.Height);
System.Runtime.InteropServices.Marshal.Copy(Global.Emulator.VideoProvider.GetVideoBuffer(), 0, lockdata.Scan0, bmpin.Width * bmpin.Height);
bmpin.UnlockBits(lockdata);
}
Bitmap bmpout = new Bitmap(avwriter_resizew, avwriter_resizeh, PixelFormat.Format32bppArgb);
@ -3884,7 +3903,7 @@ namespace BizHawk.MultiClient
if (Global.Config.AVI_CaptureOSD)
output = new AVOut.BmpVideoProvder(CaptureOSD());
else
output = GlobalWinF.Emulator.VideoProvider;
output = Global.Emulator.VideoProvider;
}
CurrAviWriter.AddFrame(output);
@ -3998,11 +4017,11 @@ namespace BizHawk.MultiClient
}
// this size can be different for showing off stretching or filters
captureosd_rvp.Width = GlobalWinF.Emulator.VideoProvider.BufferWidth;
captureosd_rvp.Height = GlobalWinF.Emulator.VideoProvider.BufferHeight;
captureosd_rvp.Width = Global.Emulator.VideoProvider.BufferWidth;
captureosd_rvp.Height = Global.Emulator.VideoProvider.BufferHeight;
GlobalWinF.DisplayManager.UpdateSourceEx(GlobalWinF.Emulator.VideoProvider, captureosd_srp);
GlobalWinF.DisplayManager.UpdateSourceEx(Global.Emulator.VideoProvider, captureosd_srp);
Bitmap ret = (Bitmap)captureosd_rvp.GetBitmap().Clone();
@ -4129,7 +4148,7 @@ namespace BizHawk.MultiClient
public void SetNESSoundChannels()
{
NES nes = GlobalWinF.Emulator as NES;
NES nes = Global.Emulator as NES;
nes.SetSquare1(Global.Config.NESSquare1);
nes.SetSquare2(Global.Config.NESSquare2);
nes.SetTriangle(Global.Config.NESTriangle);
@ -4156,7 +4175,7 @@ namespace BizHawk.MultiClient
else
Array.Copy(sram, Global.Emulator.ReadSaveRam, Global.Emulator.ReadSaveRam.Length);
*/
GlobalWinF.Emulator.ClearSaveRam();
Global.Emulator.ClearSaveRam();
}
catch { }
}
@ -4193,13 +4212,13 @@ namespace BizHawk.MultiClient
{
if (StatusSlot0.Visible)
{
if (GlobalWinF.Emulator.CoreComm.UsesDriveLed)
if (Global.Emulator.CoreComm.UsesDriveLed)
{
if (!StatusBarLedLight.Visible)
{
StatusBarLedLight.Visible = true;
}
if (GlobalWinF.Emulator.CoreComm.DriveLED)
if (Global.Emulator.CoreComm.DriveLED)
{
StatusBarLedLight.Image = Properties.Resources.LightOn;
}
@ -4265,7 +4284,7 @@ namespace BizHawk.MultiClient
private void configToolStripMenuItem_DropDownOpened(object sender, EventArgs e)
{
controllersToolStripMenuItem.Enabled = !(GlobalWinF.Emulator is NullEmulator);
controllersToolStripMenuItem.Enabled = !(Global.Emulator is NullEmulator);
}
private void firmwaresToolStripMenuItem_Click(object sender, EventArgs e)

View File

@ -16,7 +16,7 @@ namespace BizHawk.MultiClient
public void Update()
{
if (Global.Game == null || GlobalWinF.Emulator == null)
if (Global.Game == null || Global.Emulator == null)
{
for (int x = 0; x < 10; x++)
slots[x] = false;

View File

@ -117,7 +117,7 @@ namespace BizHawk.MultiClient
}
if (buckets[0].Count > 0)
{
if (GlobalWinF.Emulator.SystemId == "C64") //This is a kludge, if there starts to be more exceptions to this pattern, we will need a more robust solution
if (Global.Emulator.SystemId == "C64") //This is a kludge, if there starts to be more exceptions to this pattern, we will need a more robust solution
{
tt.TabPages.Add("Keyboard");
}

View File

@ -70,17 +70,17 @@ namespace BizHawk.MultiClient
private void SetMaxXY()
{
XNumeric.Maximum = GlobalWinF.Emulator.VideoProvider.BufferWidth - 12;
YNumeric.Maximum = GlobalWinF.Emulator.VideoProvider.BufferHeight - 12;
PositionPanel.Size = new Size(GlobalWinF.Emulator.VideoProvider.BufferWidth + 2, GlobalWinF.Emulator.VideoProvider.BufferHeight + 2);
XNumeric.Maximum = Global.Emulator.VideoProvider.BufferWidth - 12;
YNumeric.Maximum = Global.Emulator.VideoProvider.BufferHeight - 12;
PositionPanel.Size = new Size(Global.Emulator.VideoProvider.BufferWidth + 2, Global.Emulator.VideoProvider.BufferHeight + 2);
int width;
if (GlobalWinF.Emulator.VideoProvider.BufferWidth > 128)
width = GlobalWinF.Emulator.VideoProvider.BufferWidth + 44;
if (Global.Emulator.VideoProvider.BufferWidth > 128)
width = Global.Emulator.VideoProvider.BufferWidth + 44;
else
width = 128 + 44;
PositionGroupBox.Size = new Size(width, GlobalWinF.Emulator.VideoProvider.BufferHeight + 52);
PositionGroupBox.Size = new Size(width, Global.Emulator.VideoProvider.BufferHeight + 52);
}
private void SetColorBox()

View File

@ -33,7 +33,7 @@ namespace BizHawk.MultiClient
DiskBufferCheckbox.Checked = Global.Config.Rewind_OnDisk;
RewindIsThreadedCheckbox.Checked = Global.Config.Rewind_IsThreaded;
StateSize = GlobalWinF.Emulator.SaveStateBinary().Length;
StateSize = Global.Emulator.SaveStateBinary().Length;
BufferSizeUpDown.Value = Global.Config.Rewind_BufferSize;
MediumStateSize = Global.Config.Rewind_MediumStateSize;
@ -266,7 +266,7 @@ namespace BizHawk.MultiClient
}
else
{
avg_state_size = GlobalWinF.Emulator.SaveStateBinary().Length;
avg_state_size = Global.Emulator.SaveStateBinary().Length;
}
}
else

View File

@ -309,7 +309,7 @@ namespace BizHawk.MultiClient
{
if (stickySet.Contains(button))
{
int a = (GlobalWinF.Emulator.Frame - buttonStarts[button]) % (On + Off);
int a = (Global.Emulator.Frame - buttonStarts[button]) % (On + Off);
if (a < On)
return this[button];
else
@ -333,7 +333,7 @@ namespace BizHawk.MultiClient
{
int a = (GlobalWinF.Emulator.Frame - buttonStarts[button]) % (On + Off);
int a = (Global.Emulator.Frame - buttonStarts[button]) % (On + Off);
if (a < On)
{
source ^= true;

View File

@ -565,7 +565,7 @@ namespace BizHawk.MultiClient
{
if (StateCapturing)
{
byte[] state = GlobalWinF.Emulator.SaveStateBinary();
byte[] state = Global.Emulator.SaveStateBinary();
Log.AddState(state);
GC.Collect();
}
@ -577,11 +577,11 @@ namespace BizHawk.MultiClient
{
return;
}
if (frame <= GlobalWinF.Emulator.Frame)
if (frame <= Global.Emulator.Frame)
{
if (frame <= Log.StateFirstIndex)
{
GlobalWinF.Emulator.LoadStateBinary(new BinaryReader(new MemoryStream(Log.InitState)));
Global.Emulator.LoadStateBinary(new BinaryReader(new MemoryStream(Log.InitState)));
if (GlobalWinF.MainForm.EmulatorPaused && frame > 0)
{
GlobalWinF.MainForm.UnpauseEmulator();
@ -596,19 +596,19 @@ namespace BizHawk.MultiClient
{
if (frame == 0)
{
GlobalWinF.Emulator.LoadStateBinary(new BinaryReader(new MemoryStream(Log.InitState)));
Global.Emulator.LoadStateBinary(new BinaryReader(new MemoryStream(Log.InitState)));
}
else
{
//frame-1 because we need to go back an extra frame and then run a frame, otherwise the display doesn't get updated.
GlobalWinF.Emulator.LoadStateBinary(new BinaryReader(new MemoryStream(Log.GetState(frame - 1))));
Global.Emulator.LoadStateBinary(new BinaryReader(new MemoryStream(Log.GetState(frame - 1))));
GlobalWinF.MainForm.UpdateFrame = true;
}
}
}
else if (frame <= Log.StateLastIndex)
{
GlobalWinF.Emulator.LoadStateBinary(new BinaryReader(new MemoryStream(Log.GetState(frame - 1))));
Global.Emulator.LoadStateBinary(new BinaryReader(new MemoryStream(Log.GetState(frame - 1))));
GlobalWinF.MainForm.UpdateFrame = true;
}
else
@ -630,10 +630,10 @@ namespace BizHawk.MultiClient
//this allows users to restore a movie with any savestate from that "timeline"
if (Global.Config.VBAStyleMovieLoadState)
{
if (GlobalWinF.Emulator.Frame < Log.Length)
if (Global.Emulator.Frame < Log.Length)
{
Log.TruncateMovie(GlobalWinF.Emulator.Frame);
Log .TruncateStates(GlobalWinF.Emulator.Frame);
Log.TruncateMovie(Global.Emulator.Frame);
Log .TruncateStates(Global.Emulator.Frame);
}
}
changes = true;

View File

@ -1,6 +1,8 @@
using System.Collections.Generic;
using System.IO;
using BizHawk.Client.Common;
namespace BizHawk.MultiClient
{
/// <summary>
@ -81,23 +83,23 @@ namespace BizHawk.MultiClient
public void AddState(byte[] state)
{
if (GlobalWinF.Emulator.Frame == 0)
if (Global.Emulator.Frame == 0)
{
InitState = state;
}
if (GlobalWinF.Emulator.Frame < StateFirstIndex)
if (Global.Emulator.Frame < StateFirstIndex)
{
_state_records.Clear();
_state_records.Add(new StateRecord(GlobalWinF.Emulator.Frame, state));
_state_records.Add(new StateRecord(Global.Emulator.Frame, state));
}
if (GlobalWinF.Emulator.Frame > StateLastIndex)
if (Global.Emulator.Frame > StateLastIndex)
{
if (StateSizeInBytes + state.Length > MAXSTATERECORDSIZE)
{
// Discard the oldest state to save space.
_state_records.RemoveAt(0);
}
_state_records.Add(new StateRecord(GlobalWinF.Emulator.Frame,state));
_state_records.Add(new StateRecord(Global.Emulator.Frame,state));
}
}
@ -231,7 +233,7 @@ namespace BizHawk.MultiClient
{
Index = index;
State = state;
Lagged = GlobalWinF.Emulator.IsLagFrame;
Lagged = Global.Emulator.IsLagFrame;
}
public readonly int Index;

View File

@ -227,7 +227,7 @@ namespace BizHawk.MultiClient
{
get
{
switch (GlobalWinF.Emulator.SystemId)
switch (Global.Emulator.SystemId)
{
default:
case "NULL":

View File

@ -1,4 +1,6 @@
namespace BizHawk.MultiClient
using BizHawk.Client.Common;
namespace BizHawk.MultiClient
{
public class MovieSession
{
@ -29,7 +31,7 @@
/// </summary>
public void LatchInputFromLog()
{
string loggedFrame = Movie.GetInput(GlobalWinF.Emulator.Frame);
string loggedFrame = Movie.GetInput(Global.Emulator.Frame);
MovieControllerAdapter.SetControllersAsMnemonic(loggedFrame);
}
}

View File

@ -78,45 +78,45 @@ namespace BizHawk.MultiClient
MovieToRecord.Header.SetHeaderLine(MovieHeader.GAMENAME, "NULL");
}
if (GlobalWinF.Emulator.BoardName != null)
if (Global.Emulator.BoardName != null)
{
MovieToRecord.Header.SetHeaderLine(MovieHeader.BOARDNAME, GlobalWinF.Emulator.BoardName);
MovieToRecord.Header.SetHeaderLine(MovieHeader.BOARDNAME, Global.Emulator.BoardName);
}
if (GlobalWinF.Emulator is Gameboy)
if (Global.Emulator is Gameboy)
{
MovieToRecord.Header.SetHeaderLine(MovieHeader.GB_FORCEDMG, Global.Config.GB_ForceDMG.ToString());
MovieToRecord.Header.SetHeaderLine(MovieHeader.GB_GBA_IN_CGB, Global.Config.GB_GBACGB.ToString());
}
if (GlobalWinF.Emulator is LibsnesCore)
if (Global.Emulator is LibsnesCore)
{
MovieToRecord.Header.SetHeaderLine(MovieHeader.SGB, ((GlobalWinF.Emulator) as LibsnesCore).IsSGB.ToString());
if ((GlobalWinF.Emulator as LibsnesCore).DisplayType == DisplayType.PAL)
MovieToRecord.Header.SetHeaderLine(MovieHeader.SGB, ((Global.Emulator) as LibsnesCore).IsSGB.ToString());
if ((Global.Emulator as LibsnesCore).DisplayType == DisplayType.PAL)
{
MovieToRecord.Header.SetHeaderLine(MovieHeader.PAL, "1");
}
}
else if (GlobalWinF.Emulator is SMS)
else if (Global.Emulator is SMS)
{
if ((GlobalWinF.Emulator as SMS).DisplayType == DisplayType.PAL)
if ((Global.Emulator as SMS).DisplayType == DisplayType.PAL)
{
MovieToRecord.Header.SetHeaderLine(MovieHeader.PAL, "1");
}
}
else if (GlobalWinF.Emulator is NES)
else if (Global.Emulator is NES)
{
if ((GlobalWinF.Emulator as NES).DisplayType == DisplayType.PAL)
if ((Global.Emulator as NES).DisplayType == DisplayType.PAL)
{
MovieToRecord.Header.SetHeaderLine(MovieHeader.PAL, "1");
}
}
else if (GlobalWinF.Emulator is ColecoVision)
else if (Global.Emulator is ColecoVision)
{
MovieToRecord.Header.SetHeaderLine(MovieHeader.SKIPBIOS, Global.Config.ColecoSkipBiosIntro.ToString());
}
else if (GlobalWinF.Emulator is N64)
else if (Global.Emulator is N64)
{
MovieToRecord.Header.SetHeaderLine(MovieHeader.VIDEOPLUGIN, Global.Config.N64VidPlugin);
@ -143,7 +143,7 @@ namespace BizHawk.MultiClient
MovieToRecord.StartsFromSavestate = true;
var temppath = path;
var writer = new StreamWriter(temppath);
GlobalWinF.Emulator.SaveStateText(writer);
Global.Emulator.SaveStateText(writer);
writer.Close();
var file = new FileInfo(temppath);

View File

@ -33,9 +33,9 @@ namespace BizHawk.MultiClient
private void CheatEdit_Load(object sender, EventArgs e)
{
if (GlobalWinF.Emulator != null)
if (Global.Emulator != null)
{
ToolHelpers.PopulateMemoryDomainDropdown(ref DomainDropDown, GlobalWinF.Emulator.MainMemory);
ToolHelpers.PopulateMemoryDomainDropdown(ref DomainDropDown, Global.Emulator.MainMemory);
}
SetFormToDefault();
}
@ -81,9 +81,9 @@ namespace BizHawk.MultiClient
NameBox.Text = String.Empty;
if (GlobalWinF.Emulator != null)
if (Global.Emulator != null)
{
AddressBox.SetHexProperties(GlobalWinF.Emulator.MainMemory.Size);
AddressBox.SetHexProperties(Global.Emulator.MainMemory.Size);
}
ValueBox.ByteSize =

View File

@ -86,23 +86,23 @@ namespace BizHawk.MultiClient
private void UpdateListView()
{
CheatListView.ItemCount = GlobalWinF.CheatList.Count;
TotalLabel.Text = GlobalWinF.CheatList.CheatCount.ToString()
+ (GlobalWinF.CheatList.CheatCount == 1 ? " cheat " : " cheats ")
+ GlobalWinF.CheatList.ActiveCount.ToString() + " active";
CheatListView.ItemCount = Global.CheatList.Count;
TotalLabel.Text = Global.CheatList.CheatCount.ToString()
+ (Global.CheatList.CheatCount == 1 ? " cheat " : " cheats ")
+ Global.CheatList.ActiveCount.ToString() + " active";
}
public void LoadFileFromRecent(string path)
{
bool ask_result = true;
if (GlobalWinF.CheatList.Changes)
if (Global.CheatList.Changes)
{
ask_result = AskSave();
}
if (ask_result)
{
bool load_result = GlobalWinF.CheatList.Load(path, append: false);
bool load_result = Global.CheatList.Load(path, append: false);
if (!load_result)
{
ToolHelpers.HandleLoadError(Global.Config.RecentWatches, path);
@ -112,6 +112,7 @@ namespace BizHawk.MultiClient
Global.Config.RecentWatches.Add(path);
UpdateListView();
UpdateMessageLabel();
ToolHelpers.UpdateCheatRelatedTools();
}
}
}
@ -122,11 +123,11 @@ namespace BizHawk.MultiClient
if (saved)
{
message = Path.GetFileName(GlobalWinF.CheatList.CurrentFileName) + " saved.";
message = Path.GetFileName(Global.CheatList.CurrentFileName) + " saved.";
}
else
{
message = Path.GetFileName(GlobalWinF.CheatList.CurrentFileName) + (GlobalWinF.CheatList.Changes ? " *" : String.Empty);
message = Path.GetFileName(Global.CheatList.CurrentFileName) + (Global.CheatList.Changes ? " *" : String.Empty);
}
MessageLabel.Text = message;
@ -139,14 +140,14 @@ namespace BizHawk.MultiClient
return true;
}
if (GlobalWinF.CheatList.Changes)
if (Global.CheatList.Changes)
{
GlobalWinF.Sound.StopSound();
DialogResult result = MessageBox.Show("Save Changes?", "Cheats", MessageBoxButtons.YesNoCancel, MessageBoxIcon.Question, MessageBoxDefaultButton.Button3);
GlobalWinF.Sound.StartSound();
if (result == DialogResult.Yes)
{
GlobalWinF.CheatList.Save();
Global.CheatList.Save();
}
else if (result == DialogResult.No)
{
@ -166,21 +167,35 @@ namespace BizHawk.MultiClient
if (file != null)
{
bool result = true;
if (GlobalWinF.CheatList.Changes)
if (Global.CheatList.Changes)
{
result = AskSave();
}
if (result)
{
GlobalWinF.CheatList.Load(file.FullName, append);
Global.CheatList.Load(file.FullName, append);
UpdateListView();
UpdateMessageLabel();
Global.Config.RecentCheats.Add(GlobalWinF.CheatList.CurrentFileName);
Global.Config.RecentCheats.Add(Global.CheatList.CurrentFileName);
ToolHelpers.UpdateCheatRelatedTools();
}
}
}
private bool SaveAs()
{
var file = ToolHelpers.GetCheatSaveFileFromUser(Global.CheatList.CurrentFileName);
if (file != null)
{
return Global.CheatList.SaveFile(file.FullName);
}
else
{
return false;
}
}
private void NewCheatForm_Load(object sender, EventArgs e)
{
LoadConfigSettings();
@ -204,18 +219,19 @@ namespace BizHawk.MultiClient
{
GameGenieToolbarSeparator.Visible =
LoadGameGenieToolbarItem.Visible =
((GlobalWinF.Emulator is NES)
|| (GlobalWinF.Emulator is Genesis)
|| (GlobalWinF.Emulator.SystemId == "GB")
((Global.Emulator is NES)
|| (Global.Emulator is Genesis)
|| (Global.Emulator.SystemId == "GB")
|| (Global.Game.System == "GG")
|| (GlobalWinF.Emulator is LibsnesCore));
|| (Global.Emulator is LibsnesCore));
}
private void AddCheat()
{
GlobalWinF.CheatList.Add(CheatEditor.Cheat);
Global.CheatList.Add(CheatEditor.Cheat);
UpdateListView();
UpdateMessageLabel();
ToolHelpers.UpdateCheatRelatedTools();
}
private void EditCheat()
@ -279,7 +295,7 @@ namespace BizHawk.MultiClient
private void CheatListView_QueryItemText(int index, int column, out string text)
{
text = "";
if (index >= GlobalWinF.CheatList.Count || GlobalWinF.CheatList[index].IsSeparator)
if (index >= Global.CheatList.Count || Global.CheatList[index].IsSeparator)
{
return;
}
@ -289,44 +305,44 @@ namespace BizHawk.MultiClient
switch (columnName)
{
case NAME:
text = GlobalWinF.CheatList[index].Name;
text = Global.CheatList[index].Name;
break;
case ADDRESS:
text = GlobalWinF.CheatList[index].AddressStr;
text = Global.CheatList[index].AddressStr;
break;
case VALUE:
text = GlobalWinF.CheatList[index].ValueStr;
text = Global.CheatList[index].ValueStr;
break;
case COMPARE:
text = GlobalWinF.CheatList[index].CompareStr;
text = Global.CheatList[index].CompareStr;
break;
case ON:
text = GlobalWinF.CheatList[index].Enabled ? "*" : "";
text = Global.CheatList[index].Enabled ? "*" : "";
break;
case DOMAIN:
text = GlobalWinF.CheatList[index].Domain.Name;
text = Global.CheatList[index].Domain.Name;
break;
case SIZE:
text = GlobalWinF.CheatList[index].Size.ToString();
text = Global.CheatList[index].Size.ToString();
break;
case ENDIAN:
text = GlobalWinF.CheatList[index].BigEndian.Value ? "Big" : "Little";
text = Global.CheatList[index].BigEndian.Value ? "Big" : "Little";
break;
case TYPE:
text = Watch.DisplayTypeToString(GlobalWinF.CheatList[index].Type);
text = Watch.DisplayTypeToString(Global.CheatList[index].Type);
break;
}
}
private void CheatListView_QueryItemBkColor(int index, int column, ref Color color)
{
if (index < GlobalWinF.CheatList.Count)
if (index < Global.CheatList.Count)
{
if (GlobalWinF.CheatList[index].IsSeparator)
if (Global.CheatList[index].IsSeparator)
{
color = BackColor;
}
else if (GlobalWinF.CheatList[index].Enabled)
else if (Global.CheatList[index].Enabled)
{
color = Color.LightCyan;
}
@ -356,9 +372,9 @@ namespace BizHawk.MultiClient
{
foreach (int index in SelectedIndices)
{
if (!GlobalWinF.CheatList[index].IsSeparator)
if (!Global.CheatList[index].IsSeparator)
{
selected.Add(GlobalWinF.CheatList[index]);
selected.Add(Global.CheatList[index]);
}
}
}
@ -384,9 +400,9 @@ namespace BizHawk.MultiClient
foreach (int index in indices)
{
var cheat = GlobalWinF.CheatList[index];
GlobalWinF.CheatList.Remove(GlobalWinF.CheatList[index]);
GlobalWinF.CheatList.Insert(index - 1, cheat);
var cheat = Global.CheatList[index];
Global.CheatList.Remove(Global.CheatList[index]);
Global.CheatList.Insert(index - 1, cheat);
}
UpdateMessageLabel();
@ -404,6 +420,7 @@ namespace BizHawk.MultiClient
}
UpdateListView();
ToolHelpers.UpdateCheatRelatedTools();
}
private void MoveDown()
@ -416,12 +433,12 @@ namespace BizHawk.MultiClient
foreach (int index in indices)
{
var cheat = GlobalWinF.CheatList[index];
var cheat = Global.CheatList[index];
if (index < GlobalWinF.CheatList.Count - 1)
if (index < Global.CheatList.Count - 1)
{
GlobalWinF.CheatList.Remove(GlobalWinF.CheatList[index]);
GlobalWinF.CheatList.Insert(index + 1, cheat);
Global.CheatList.Remove(Global.CheatList[index]);
Global.CheatList.Insert(index + 1, cheat);
}
}
@ -440,6 +457,7 @@ namespace BizHawk.MultiClient
}
UpdateListView();
ToolHelpers.UpdateCheatRelatedTools();
}
private void Remove()
@ -448,7 +466,7 @@ namespace BizHawk.MultiClient
{
foreach (int index in SelectedIndices)
{
GlobalWinF.CheatList.Remove(GlobalWinF.CheatList[SelectedIndices[0]]); //SelectedIndices[0] used since each iteration will make this the correct list index
Global.CheatList.Remove(Global.CheatList[SelectedIndices[0]]); //SelectedIndices[0] used since each iteration will make this the correct list index
}
CheatListView.SelectedIndices.Clear();
}
@ -460,7 +478,7 @@ namespace BizHawk.MultiClient
{
SelectedCheats.ForEach(x => x.Toggle());
ToolHelpers.UpdateCheatRelatedTools();
GlobalWinF.CheatList.FlagChanges();
Global.CheatList.FlagChanges();
}
private void SaveColumnInfo()
@ -545,16 +563,17 @@ namespace BizHawk.MultiClient
private void NewList()
{
bool result = true;
if (GlobalWinF.CheatList.Changes)
if (Global.CheatList.Changes)
{
result = AskSave();
}
if (result)
{
GlobalWinF.CheatList.NewList();
Global.CheatList.NewList(GlobalWinF.MainForm.GenerateDefaultCheatFilename());
UpdateListView();
UpdateMessageLabel();
ToolHelpers.UpdateCheatRelatedTools();
}
}
@ -564,7 +583,7 @@ namespace BizHawk.MultiClient
private void FileSubMenu_DropDownOpened(object sender, EventArgs e)
{
SaveMenuItem.Enabled = GlobalWinF.CheatList.Changes;
SaveMenuItem.Enabled = Global.CheatList.Changes;
}
private void RecentSubMenu_DropDownOpened(object sender, EventArgs e)
@ -583,14 +602,14 @@ namespace BizHawk.MultiClient
private void OpenMenuItem_Click(object sender, EventArgs e)
{
bool append = sender == AppendMenuItem;
LoadFile(CheatList.GetFileFromUser(GlobalWinF.CheatList.CurrentFileName), append);
LoadFile(ToolHelpers.GetCheatFileFromUser(Global.CheatList.CurrentFileName), append);
}
private void SaveMenuItem_Click(object sender, EventArgs e)
{
if (GlobalWinF.CheatList.Changes)
if (Global.CheatList.Changes)
{
if (GlobalWinF.CheatList.Save())
if (Global.CheatList.Save())
{
UpdateMessageLabel(saved: true);
}
@ -603,7 +622,7 @@ namespace BizHawk.MultiClient
private void SaveAsMenuItem_Click(object sender, EventArgs e)
{
if (GlobalWinF.CheatList.SaveAs())
if (SaveAs())
{
UpdateMessageLabel(saved: true);
}
@ -627,15 +646,15 @@ namespace BizHawk.MultiClient
ToggleMenuItem.Enabled =
SelectedIndices.Any();
DisableAllCheatsMenuItem.Enabled = GlobalWinF.CheatList.ActiveCount > 0;
DisableAllCheatsMenuItem.Enabled = Global.CheatList.ActiveCount > 0;
GameGenieSeparator.Visible =
OpenGameGenieEncoderDecoderMenuItem.Visible =
((GlobalWinF.Emulator is NES)
|| (GlobalWinF.Emulator is Genesis)
|| (GlobalWinF.Emulator.SystemId == "GB")
((Global.Emulator is NES)
|| (Global.Emulator is Genesis)
|| (Global.Emulator.SystemId == "GB")
|| (Global.Game.System == "GG")
|| (GlobalWinF.Emulator is LibsnesCore));
|| (Global.Emulator is LibsnesCore));
}
private void RemoveCheatMenuItem_Click(object sender, EventArgs e)
@ -649,27 +668,29 @@ namespace BizHawk.MultiClient
{
foreach (int index in CheatListView.SelectedIndices)
{
GlobalWinF.CheatList.Add(new Cheat(GlobalWinF.CheatList[index]));
Global.CheatList.Add(new Cheat(Global.CheatList[index]));
}
}
UpdateListView();
UpdateMessageLabel();
ToolHelpers.UpdateCheatRelatedTools();
}
private void InsertSeparatorMenuItem_Click(object sender, EventArgs e)
{
if (SelectedIndices.Any())
{
GlobalWinF.CheatList.Insert(SelectedIndices.Max(), Cheat.Separator);
Global.CheatList.Insert(SelectedIndices.Max(), Cheat.Separator);
}
else
{
GlobalWinF.CheatList.Add(Cheat.Separator);
Global.CheatList.Add(Cheat.Separator);
}
UpdateListView();
UpdateMessageLabel();
ToolHelpers.UpdateCheatRelatedTools();
}
private void MoveUpMenuItem_Click(object sender, EventArgs e)
@ -684,7 +705,7 @@ namespace BizHawk.MultiClient
private void SelectAllMenuItem_Click(object sender, EventArgs e)
{
for (int i = 0; i < GlobalWinF.CheatList.Count; i++)
for (int i = 0; i < Global.CheatList.Count; i++)
{
CheatListView.SelectItem(i, true);
}
@ -697,7 +718,8 @@ namespace BizHawk.MultiClient
private void DisableAllCheatsMenuItem_Click(object sender, EventArgs e)
{
GlobalWinF.CheatList.DisableAll();
Global.CheatList.DisableAll();
ToolHelpers.UpdateCheatRelatedTools();
}
private void OpenGameGenieEncoderDecoderMenuItem_Click(object sender, EventArgs e)
@ -914,7 +936,7 @@ namespace BizHawk.MultiClient
_sortReverse = false;
}
GlobalWinF.CheatList.Sort(column.Name, _sortReverse);
Global.CheatList.Sort(column.Name, _sortReverse);
_sortedColumn = column.Name;
_sortReverse ^= true;
@ -943,7 +965,7 @@ namespace BizHawk.MultiClient
RemoveContextMenuItem.Enabled =
SelectedCheats.Any();
DisableAllContextMenuItem.Enabled = GlobalWinF.CheatList.ActiveCount > 0;
DisableAllContextMenuItem.Enabled = Global.CheatList.ActiveCount > 0;
}
#endregion

View File

@ -80,9 +80,9 @@ namespace BizHawk.MultiClient.GBtools
public void Restart()
{
if (GlobalWinF.Emulator is Emulation.Consoles.GB.Gameboy)
if (Global.Emulator is Emulation.Consoles.GB.Gameboy)
{
gb = GlobalWinF.Emulator as Emulation.Consoles.GB.Gameboy;
gb = Global.Emulator as Emulation.Consoles.GB.Gameboy;
cgb = gb.IsCGBMode();
_lcdc = 0;
if (!gb.GetGPUMemoryAreas(out vram, out bgpal, out sppal, out oam))

View File

@ -348,7 +348,7 @@ namespace BizHawk.MultiClient
private void AddCheatClick(object sender, EventArgs e)
{
if ((GlobalWinF.Emulator.SystemId == "GB") || (Global.Game.System == "GG"))
if ((Global.Emulator.SystemId == "GB") || (Global.Game.System == "GG"))
{
string NAME = String.Empty;
int ADDRESS = 0;
@ -391,9 +391,9 @@ namespace BizHawk.MultiClient
}
}
for (int i = 0; i < GlobalWinF.Emulator.MemoryDomains.Count; i++)
for (int i = 0; i < Global.Emulator.MemoryDomains.Count; i++)
{
if (GlobalWinF.Emulator.MemoryDomains[i].ToString() == "System Bus")
if (Global.Emulator.MemoryDomains[i].ToString() == "System Bus")
{
sysBusIndex = i;
break;
@ -401,18 +401,20 @@ namespace BizHawk.MultiClient
}
Watch watch = Watch.GenerateWatch(
GlobalWinF.Emulator.MemoryDomains[sysBusIndex],
Global.Emulator.MemoryDomains[sysBusIndex],
ADDRESS,
Watch.WatchSize.Byte,
Watch.DisplayType.Hex,
NAME,
false);
GlobalWinF.CheatList.Add(new Cheat(
Global.CheatList.Add(new Cheat(
watch,
VALUE,
COMPARE,
enabled: true));
ToolHelpers.UpdateCheatRelatedTools();
}
}

View File

@ -3,6 +3,8 @@ using System.Drawing;
using System.Windows.Forms;
using BizHawk.MultiClient.GBtools;
using BizHawk.Client.Common;
namespace BizHawk.MultiClient.GBAtools
{
public partial class GBAGPUView : Form
@ -673,7 +675,7 @@ namespace BizHawk.MultiClient.GBAtools
public void Restart()
{
gba = GlobalWinF.Emulator as Emulation.Consoles.Nintendo.GBA.GBA;
gba = Global.Emulator as Emulation.Consoles.Nintendo.GBA.GBA;
if (gba != null)
{
gba.GetGPUMemoryAreas(out vram, out palram, out oam, out mmio);

View File

@ -224,7 +224,7 @@ namespace BizHawk.MultiClient
private void addcheatbt_Click(object sender, EventArgs e)
{
if (GlobalWinF.Emulator is Genesis)
if (Global.Emulator is Genesis)
{
string NAME;
int ADDRESS = 0;
@ -255,16 +255,16 @@ namespace BizHawk.MultiClient
VALUE = ValueBox.ToRawInt();
}
for (int i = 0; i < GlobalWinF.Emulator.MemoryDomains.Count; i++)
for (int i = 0; i < Global.Emulator.MemoryDomains.Count; i++)
{
if (GlobalWinF.Emulator.MemoryDomains[i].ToString() == "Rom Data")
if (Global.Emulator.MemoryDomains[i].ToString() == "Rom Data")
{
romDataDomainIndex = i;
}
}
Watch watch = Watch.GenerateWatch(
GlobalWinF.Emulator.MemoryDomains[romDataDomainIndex],
Global.Emulator.MemoryDomains[romDataDomainIndex],
ADDRESS,
Watch.WatchSize.Word,
Watch.DisplayType.Hex,
@ -272,12 +272,14 @@ namespace BizHawk.MultiClient
bigEndian: true
);
GlobalWinF.CheatList.Add(new Cheat(
Global.CheatList.Add(new Cheat(
watch,
VALUE,
compare: null,
enabled: true
));
ToolHelpers.UpdateCheatRelatedTools();
}
}

View File

@ -259,9 +259,9 @@ namespace BizHawk.MultiClient
private int? GetDomainInt(string name)
{
for (int i = 0; i < GlobalWinF.Emulator.MemoryDomains.Count; i++)
for (int i = 0; i < Global.Emulator.MemoryDomains.Count; i++)
{
if (GlobalWinF.Emulator.MemoryDomains[i].Name == name)
if (Global.Emulator.MemoryDomains[i].Name == name)
{
return i;
}
@ -457,9 +457,9 @@ namespace BizHawk.MultiClient
//<zeromus> THIS IS HORRIBLE.
Domain = ROMDomain;
}
else if (pos < GlobalWinF.Emulator.MemoryDomains.Count) //Sanity check
else if (pos < Global.Emulator.MemoryDomains.Count) //Sanity check
{
SetMemoryDomain(GlobalWinF.Emulator.MemoryDomains[pos]);
SetMemoryDomain(Global.Emulator.MemoryDomains[pos]);
}
SetHeader();
UpdateGroupBoxTitle();
@ -471,7 +471,7 @@ namespace BizHawk.MultiClient
private void UpdateGroupBoxTitle()
{
string memoryDomain = Domain.ToString();
string systemID = GlobalWinF.Emulator.SystemId;
string systemID = Global.Emulator.SystemId;
int addresses = Domain.Size / DataSize;
string addressesString = "0x" + string.Format("{0:X8}", addresses).TrimStart('0');
//if ((addresses & 0x3FF) == 0)
@ -484,11 +484,11 @@ namespace BizHawk.MultiClient
{
memoryDomainsToolStripMenuItem.DropDownItems.Clear();
for (int i = 0; i < GlobalWinF.Emulator.MemoryDomains.Count; i++)
for (int i = 0; i < Global.Emulator.MemoryDomains.Count; i++)
{
if (GlobalWinF.Emulator.MemoryDomains[i].Size > 0)
if (Global.Emulator.MemoryDomains[i].Size > 0)
{
string str = GlobalWinF.Emulator.MemoryDomains[i].ToString();
string str = Global.Emulator.MemoryDomains[i].ToString();
var item = new ToolStripMenuItem { Text = str };
{
int z = i;
@ -835,7 +835,7 @@ namespace BizHawk.MultiClient
private bool IsFrozen(int address)
{
return GlobalWinF.CheatList.IsActive(Domain, address);
return Global.CheatList.IsActive(Domain, address);
}
private void ToggleFreeze()
@ -868,10 +868,11 @@ namespace BizHawk.MultiClient
{
if (address >= 0)
{
var cheats = GlobalWinF.CheatList.Where(x => x.Contains(address)).ToList();
GlobalWinF.CheatList.RemoveRange(cheats);
var cheats = Global.CheatList.Where(x => x.Contains(address)).ToList();
Global.CheatList.RemoveRange(cheats);
}
MemoryViewerBox.Refresh();
ToolHelpers.UpdateCheatRelatedTools();
}
private Watch.WatchSize WatchSize
@ -912,7 +913,7 @@ namespace BizHawk.MultiClient
String.Empty,
BigEndian);
GlobalWinF.CheatList.Add(new Cheat(
Global.CheatList.Add(new Cheat(
watch,
watch.Value.Value,
compare: null,
@ -999,13 +1000,13 @@ namespace BizHawk.MultiClient
{
var sfd = new SaveFileDialog();
if (!(GlobalWinF.Emulator is NullEmulator))
if (!(Global.Emulator is NullEmulator))
sfd.FileName = PathManager.FilesystemSafeName(Global.Game);
else
sfd.FileName = "MemoryDump";
sfd.InitialDirectory = PathManager.GetPlatformBase(GlobalWinF.Emulator.SystemId);
sfd.InitialDirectory = PathManager.GetPlatformBase(Global.Emulator.SystemId);
sfd.Filter = "Text (*.txt)|*.txt|All Files|*.*";
sfd.RestoreDirectory = true;
@ -1036,13 +1037,13 @@ namespace BizHawk.MultiClient
{
var sfd = new SaveFileDialog();
if (!(GlobalWinF.Emulator is NullEmulator))
if (!(Global.Emulator is NullEmulator))
sfd.FileName = PathManager.FilesystemSafeName(Global.Game);
else
sfd.FileName = "MemoryDump";
sfd.InitialDirectory = PathManager.GetPlatformBase(GlobalWinF.Emulator.SystemId);
sfd.InitialDirectory = PathManager.GetPlatformBase(Global.Emulator.SystemId);
sfd.Filter = GetSaveFileFilter();
sfd.RestoreDirectory = true;
@ -1209,7 +1210,7 @@ namespace BizHawk.MultiClient
private void MemoryViewerBox_Paint(object sender, PaintEventArgs e)
{
var activeCheats = GlobalWinF.CheatList.Where(x => x.Enabled);
var activeCheats = Global.CheatList.Where(x => x.Enabled);
foreach (var cheat in activeCheats)
{
if (IsVisible(cheat.Address.Value))
@ -1234,7 +1235,7 @@ namespace BizHawk.MultiClient
Rectangle textrect = new Rectangle(textpoint, new Size((8 * DataSize), fontHeight));
if (GlobalWinF.CheatList.IsActive(Domain, addressHighlighted))
if (Global.CheatList.IsActive(Domain, addressHighlighted))
{
e.Graphics.FillRectangle(new SolidBrush(Global.Config.HexHighlightFreezeColor), rect);
e.Graphics.FillRectangle(new SolidBrush(Global.Config.HexHighlightFreezeColor), textrect);
@ -1256,7 +1257,7 @@ namespace BizHawk.MultiClient
Rectangle textrect = new Rectangle(textpoint, new Size(8, fontHeight));
if (GlobalWinF.CheatList.IsActive(Domain, address))
if (Global.CheatList.IsActive(Domain, address))
{
e.Graphics.FillRectangle(new SolidBrush(Global.Config.HexHighlightFreezeColor), rect);
e.Graphics.FillRectangle(new SolidBrush(Global.Config.HexHighlightFreezeColor), textrect);
@ -1692,10 +1693,10 @@ namespace BizHawk.MultiClient
private void IncrementAddress(int address)
{
if (GlobalWinF.CheatList.IsActive(Domain, address))
if (Global.CheatList.IsActive(Domain, address))
{
GlobalWinF.CheatList.FirstOrDefault(x => x.Domain == Domain && x.Address == address).Increment();
GlobalWinF.CheatList.FlagChanges();
Global.CheatList.FirstOrDefault(x => x.Domain == Domain && x.Address == address).Increment();
Global.CheatList.FlagChanges();
}
else
{
@ -1730,10 +1731,10 @@ namespace BizHawk.MultiClient
private void DecrementAddress(int address)
{
if (GlobalWinF.CheatList.IsActive(Domain, address))
if (Global.CheatList.IsActive(Domain, address))
{
GlobalWinF.CheatList.FirstOrDefault(x => x.Domain == Domain && x.Address == address).Decrement();
GlobalWinF.CheatList.FlagChanges();
Global.CheatList.FirstOrDefault(x => x.Domain == Domain && x.Address == address).Decrement();
Global.CheatList.FlagChanges();
}
else
{

View File

@ -909,7 +909,7 @@ namespace BizHawk.MultiClient
sfd.FileName = Path.GetFileNameWithoutExtension(currentSessionFile);
sfd.InitialDirectory = Path.GetDirectoryName(currentSessionFile);
}
else if (!(GlobalWinF.Emulator is NullEmulator))
else if (!(Global.Emulator is NullEmulator))
{
sfd.FileName = PathManager.FilesystemSafeName(Global.Game);
sfd.InitialDirectory = PathManager.GetLuaPath();

View File

@ -853,8 +853,8 @@ namespace BizHawk.MultiClient
Graphics GetGraphics()
{
var g = luaSurface.GetGraphics();
int tx = GlobalWinF.Emulator.CoreComm.ScreenLogicalOffsetX;
int ty = GlobalWinF.Emulator.CoreComm.ScreenLogicalOffsetY;
int tx = Global.Emulator.CoreComm.ScreenLogicalOffsetX;
int ty = Global.Emulator.CoreComm.ScreenLogicalOffsetY;
if (tx != 0 || ty != 0)
{
var transform = g.Transform;
@ -900,8 +900,8 @@ namespace BizHawk.MultiClient
}
else
{
dx -= GlobalWinF.Emulator.CoreComm.ScreenLogicalOffsetX;
dy -= GlobalWinF.Emulator.CoreComm.ScreenLogicalOffsetY;
dx -= Global.Emulator.CoreComm.ScreenLogicalOffsetX;
dy -= Global.Emulator.CoreComm.ScreenLogicalOffsetY;
}
// blah hacks
dx *= client_getwindowsize();
@ -1255,12 +1255,12 @@ namespace BizHawk.MultiClient
// TODO: error handling for argument count mismatch
private void emu_setrenderplanes_do(object[] lua_p)
{
if (GlobalWinF.Emulator is NES)
if (Global.Emulator is NES)
{
GlobalWinF.CoreComm.NES_ShowOBJ = Global.Config.NESDispSprites = (bool)lua_p[0];
GlobalWinF.CoreComm.NES_ShowBG = Global.Config.NESDispBackground = (bool)lua_p[1];
}
else if (GlobalWinF.Emulator is Emulation.Consoles.TurboGrafx.PCEngine)
else if (Global.Emulator is Emulation.Consoles.TurboGrafx.PCEngine)
{
GlobalWinF.CoreComm.PCE_ShowOBJ1 = Global.Config.PCEDispOBJ1 = (bool)lua_p[0];
GlobalWinF.CoreComm.PCE_ShowBG1 = Global.Config.PCEDispBG1 = (bool)lua_p[1];
@ -1270,7 +1270,7 @@ namespace BizHawk.MultiClient
GlobalWinF.CoreComm.PCE_ShowBG2 = Global.Config.PCEDispBG2 = (bool)lua_p[3];
}
}
else if (GlobalWinF.Emulator is Emulation.Consoles.Sega.SMS)
else if (Global.Emulator is Emulation.Consoles.Sega.SMS)
{
GlobalWinF.CoreComm.SMS_ShowOBJ = Global.Config.SMSDispOBJ = (bool)lua_p[0];
GlobalWinF.CoreComm.SMS_ShowBG = Global.Config.SMSDispBG = (bool)lua_p[1];
@ -1322,7 +1322,7 @@ namespace BizHawk.MultiClient
public int emu_framecount()
{
return GlobalWinF.Emulator.Frame;
return Global.Emulator.Frame;
}
public void emu_frameskip(object num_frames)
@ -1349,12 +1349,12 @@ namespace BizHawk.MultiClient
public string emu_getsystemid()
{
return GlobalWinF.Emulator.SystemId;
return Global.Emulator.SystemId;
}
public bool emu_islagged()
{
return GlobalWinF.Emulator.IsLagFrame;
return Global.Emulator.IsLagFrame;
}
public bool emu_ispaused()
@ -1364,7 +1364,7 @@ namespace BizHawk.MultiClient
public int emu_lagcount()
{
return GlobalWinF.Emulator.LagCount;
return Global.Emulator.LagCount;
}
public void emu_limitframerate(object boolean)
@ -1405,7 +1405,7 @@ namespace BizHawk.MultiClient
{
if (luaf != null)
{
GlobalWinF.Emulator.CoreComm.InputCallback = delegate()
Global.Emulator.CoreComm.InputCallback = delegate()
{
try
{
@ -1420,7 +1420,7 @@ namespace BizHawk.MultiClient
};
}
else
GlobalWinF.Emulator.CoreComm.InputCallback = null;
Global.Emulator.CoreComm.InputCallback = null;
}
public void emu_pause()
@ -1607,8 +1607,8 @@ namespace BizHawk.MultiClient
_addr = LuaInt(address);
}
GlobalWinF.Emulator.CoreComm.MemoryCallbackSystem.ReadAddr = _addr;
GlobalWinF.Emulator.CoreComm.MemoryCallbackSystem.SetReadCallback(delegate(uint addr)
Global.Emulator.CoreComm.MemoryCallbackSystem.ReadAddr = _addr;
Global.Emulator.CoreComm.MemoryCallbackSystem.SetReadCallback(delegate(uint addr)
{
try
{
@ -1625,7 +1625,7 @@ namespace BizHawk.MultiClient
}
else
{
GlobalWinF.Emulator.CoreComm.MemoryCallbackSystem.SetReadCallback(null);
Global.Emulator.CoreComm.MemoryCallbackSystem.SetReadCallback(null);
}
}
@ -1644,8 +1644,8 @@ namespace BizHawk.MultiClient
_addr = LuaInt(address);
}
GlobalWinF.Emulator.CoreComm.MemoryCallbackSystem.WriteAddr = _addr;
GlobalWinF.Emulator.CoreComm.MemoryCallbackSystem.SetWriteCallback(delegate(uint addr)
Global.Emulator.CoreComm.MemoryCallbackSystem.WriteAddr = _addr;
Global.Emulator.CoreComm.MemoryCallbackSystem.SetWriteCallback(delegate(uint addr)
{
try
{
@ -1661,7 +1661,7 @@ namespace BizHawk.MultiClient
}
else
{
GlobalWinF.Emulator.CoreComm.MemoryCallbackSystem.SetWriteCallback(null);
Global.Emulator.CoreComm.MemoryCallbackSystem.SetWriteCallback(null);
}
}
@ -2351,12 +2351,12 @@ namespace BizHawk.MultiClient
private uint MM_R_U8(int addr)
{
return GlobalWinF.Emulator.MainMemory.PeekByte(addr);
return Global.Emulator.MainMemory.PeekByte(addr);
}
private void MM_W_U8(int addr, uint v)
{
GlobalWinF.Emulator.MainMemory.PokeByte(addr, (byte)v);
Global.Emulator.MainMemory.PokeByte(addr, (byte)v);
}
private int U2S(uint u, int size)
@ -2371,7 +2371,7 @@ namespace BizHawk.MultiClient
public string mainmemory_getname()
{
return GlobalWinF.Emulator.MainMemory.Name;
return Global.Emulator.MainMemory.Name;
}
public uint mainmemory_readbyte(object lua_addr)
@ -2389,7 +2389,7 @@ namespace BizHawk.MultiClient
for (int i = addr; i <= last_addr; i++)
{
string a = String.Format("{0:X2}", i);
byte v = GlobalWinF.Emulator.MainMemory.PeekByte(i);
byte v = Global.Emulator.MainMemory.PeekByte(i);
string vs = String.Format("{0:X2}", (int)v);
table[a] = vs;
}
@ -2399,7 +2399,7 @@ namespace BizHawk.MultiClient
public float mainmemory_readfloat(object lua_addr, bool bigendian)
{
int addr = LuaInt(lua_addr);
uint val = GlobalWinF.Emulator.MainMemory.PeekDWord(addr, bigendian ? Endian.Big : Endian.Little);
uint val = Global.Emulator.MainMemory.PeekDWord(addr, bigendian ? Endian.Big : Endian.Little);
byte[] bytes = BitConverter.GetBytes(val);
float _float = BitConverter.ToSingle(bytes, 0);
@ -2420,7 +2420,7 @@ namespace BizHawk.MultiClient
int a = LuaInt(address);
int v = LuaInt(memoryblock[address]);
GlobalWinF.Emulator.MainMemory.PokeByte(a, (byte)v);
Global.Emulator.MainMemory.PokeByte(a, (byte)v);
}
}
@ -2430,7 +2430,7 @@ namespace BizHawk.MultiClient
float dv = (float)(double)lua_v;
byte[] bytes = BitConverter.GetBytes(dv);
uint v = BitConverter.ToUInt32(bytes, 0);
GlobalWinF.Emulator.MainMemory.PokeDWord(addr, v, bigendian ? Endian.Big : Endian.Little);
Global.Emulator.MainMemory.PokeDWord(addr, v, bigendian ? Endian.Big : Endian.Little);
}
@ -2672,29 +2672,29 @@ namespace BizHawk.MultiClient
private uint M_R_U8(int addr)
{
return GlobalWinF.Emulator.MemoryDomains[CurrentMemoryDomain].PeekByte(addr);
return Global.Emulator.MemoryDomains[CurrentMemoryDomain].PeekByte(addr);
}
private void M_W_U8(int addr, uint v)
{
GlobalWinF.Emulator.MemoryDomains[CurrentMemoryDomain].PokeByte(addr, (byte)v);
Global.Emulator.MemoryDomains[CurrentMemoryDomain].PokeByte(addr, (byte)v);
}
#endregion
public string memory_getmemorydomainlist()
{
return GlobalWinF.Emulator.MemoryDomains.Aggregate("", (current, t) => current + (t.Name + '\n'));
return Global.Emulator.MemoryDomains.Aggregate("", (current, t) => current + (t.Name + '\n'));
}
public string memory_getcurrentmemorydomain()
{
return GlobalWinF.Emulator.MemoryDomains[CurrentMemoryDomain].Name;
return Global.Emulator.MemoryDomains[CurrentMemoryDomain].Name;
}
public int memory_getcurrentmemorydomainsize()
{
return GlobalWinF.Emulator.MemoryDomains[CurrentMemoryDomain].Size;
return Global.Emulator.MemoryDomains[CurrentMemoryDomain].Size;
}
public uint memory_readbyte(object lua_addr)
@ -2706,7 +2706,7 @@ namespace BizHawk.MultiClient
public float memory_readfloat(object lua_addr, bool bigendian)
{
int addr = LuaInt(lua_addr);
uint val = GlobalWinF.Emulator.MemoryDomains[CurrentMemoryDomain].PeekDWord(addr, bigendian ? Endian.Big : Endian.Little);
uint val = Global.Emulator.MemoryDomains[CurrentMemoryDomain].PeekDWord(addr, bigendian ? Endian.Big : Endian.Little);
byte[] bytes = BitConverter.GetBytes(val);
float _float = BitConverter.ToSingle(bytes, 0);
@ -2726,7 +2726,7 @@ namespace BizHawk.MultiClient
float dv = (float)(double)lua_v;
byte[] bytes = BitConverter.GetBytes(dv);
uint v = BitConverter.ToUInt32(bytes, 0);
GlobalWinF.Emulator.MemoryDomains[CurrentMemoryDomain].PokeDWord(addr, v, bigendian ? Endian.Big : Endian.Little);
Global.Emulator.MemoryDomains[CurrentMemoryDomain].PokeDWord(addr, v, bigendian ? Endian.Big : Endian.Little);
}
public bool memory_usememorydomain(object lua_input)
@ -2734,9 +2734,9 @@ namespace BizHawk.MultiClient
if (lua_input.GetType() != typeof(string))
return false;
for (int x = 0; x < GlobalWinF.Emulator.MemoryDomains.Count; x++)
for (int x = 0; x < Global.Emulator.MemoryDomains.Count; x++)
{
if (GlobalWinF.Emulator.MemoryDomains[x].Name == lua_input.ToString())
if (Global.Emulator.MemoryDomains[x].Name == lua_input.ToString())
{
CurrentMemoryDomain = x;
return true;
@ -3037,26 +3037,28 @@ namespace BizHawk.MultiClient
public void nes_addgamegenie(string code)
{
if (GlobalWinF.Emulator is NES)
if (Global.Emulator is NES)
{
NESGameGenie gg = new NESGameGenie();
gg.DecodeGameGenieCode(code);
if (gg.Address.HasValue && gg.Value.HasValue)
{
Watch watch = Watch.GenerateWatch(
GlobalWinF.Emulator.MemoryDomains[1],
Global.Emulator.MemoryDomains[1],
gg.Address.Value,
Watch.WatchSize.Byte,
Watch.DisplayType.Hex,
code,
false);
GlobalWinF.CheatList.Add(new Cheat(
Global.CheatList.Add(new Cheat(
watch,
gg.Value.Value,
gg.Compare,
enabled: true));
}
ToolHelpers.UpdateCheatRelatedTools();
}
}
@ -3106,33 +3108,35 @@ namespace BizHawk.MultiClient
public void nes_removegamegenie(string code)
{
if (GlobalWinF.Emulator is NES)
if (Global.Emulator is NES)
{
NESGameGenie gg = new NESGameGenie();
gg.DecodeGameGenieCode(code);
if (gg.Address.HasValue && gg.Value.HasValue)
{
var cheats = GlobalWinF.CheatList.Where(x => x.Address == gg.Address);
GlobalWinF.CheatList.RemoveRange(cheats);
var cheats = Global.CheatList.Where(x => x.Address == gg.Address);
Global.CheatList.RemoveRange(cheats);
}
ToolHelpers.UpdateCheatRelatedTools();
}
}
public void nes_setallowmorethaneightsprites(bool allow)
{
Global.Config.NESAllowMoreThanEightSprites = allow;
if (GlobalWinF.Emulator is NES)
if (Global.Emulator is NES)
{
(GlobalWinF.Emulator as NES).CoreComm.NES_UnlimitedSprites = allow;
(Global.Emulator as NES).CoreComm.NES_UnlimitedSprites = allow;
}
}
public void nes_setclipleftandright(bool leftandright)
{
Global.Config.NESClipLeftAndRight = leftandright;
if (GlobalWinF.Emulator is NES)
if (Global.Emulator is NES)
{
(GlobalWinF.Emulator as NES).SetClipLeftAndRight(leftandright);
(Global.Emulator as NES).SetClipLeftAndRight(leftandright);
}
}
@ -3182,17 +3186,17 @@ namespace BizHawk.MultiClient
Global.Config.NTSC_NESBottomLine = last;
}
if (GlobalWinF.Emulator is NES)
if (Global.Emulator is NES)
{
if (pal)
{
(GlobalWinF.Emulator as NES).PAL_FirstDrawLine = first;
(GlobalWinF.Emulator as NES).PAL_LastDrawLine = last;
(Global.Emulator as NES).PAL_FirstDrawLine = first;
(Global.Emulator as NES).PAL_LastDrawLine = last;
}
else
{
(GlobalWinF.Emulator as NES).NTSC_FirstDrawLine = first;
(GlobalWinF.Emulator as NES).NTSC_LastDrawLine = last;
(Global.Emulator as NES).NTSC_FirstDrawLine = first;
(Global.Emulator as NES).NTSC_LastDrawLine = last;
}
}
}

View File

@ -565,7 +565,7 @@ namespace BizHawk.MultiClient
sfd.FileName = Path.GetFileNameWithoutExtension(currentFile);
sfd.InitialDirectory = Path.GetDirectoryName(currentFile);
}
else if (!(GlobalWinF.Emulator is NullEmulator))
else if (!(Global.Emulator is NullEmulator))
{
sfd.FileName = PathManager.FilesystemSafeName(Global.Game);
sfd.InitialDirectory = PathManager.GetLuaPath();

View File

@ -40,9 +40,9 @@ namespace BizHawk.MultiClient
public void Restart()
{
if (!(GlobalWinF.Emulator is NES)) Close();
if (!(Global.Emulator is NES)) Close();
if (!IsHandleCreated || IsDisposed) return;
_nes = GlobalWinF.Emulator as NES;
_nes = Global.Emulator as NES;
}
public void UpdateValues()
@ -80,7 +80,7 @@ namespace BizHawk.MultiClient
private void NESDebugger_Load(object sender, EventArgs e)
{
LoadConfigSettings();
_nes = GlobalWinF.Emulator as NES;
_nes = Global.Emulator as NES;
}
private void LoadConfigSettings()

View File

@ -353,7 +353,7 @@ namespace BizHawk.MultiClient
private void AddCheatClick()
{
if (GlobalWinF.Emulator is NES)
if (Global.Emulator is NES)
{
if (String.IsNullOrWhiteSpace(AddressBox.Text) || (String.IsNullOrWhiteSpace(ValueBox.Text)))
{
@ -361,7 +361,7 @@ namespace BizHawk.MultiClient
}
Watch watch = Watch.GenerateWatch(
GlobalWinF.Emulator.MemoryDomains[1], /*System Bus*/
Global.Emulator.MemoryDomains[1], /*System Bus*/
AddressBox.ToRawInt(),
Watch.WatchSize.Byte,
Watch.DisplayType.Hex,
@ -374,7 +374,7 @@ namespace BizHawk.MultiClient
compare = CompareBox.ToRawInt();
}
GlobalWinF.CheatList.Add(new Cheat(
Global.CheatList.Add(new Cheat(
watch,
ValueBox.ToRawInt(),
compare,

View File

@ -24,7 +24,7 @@ namespace BizHawk.MultiClient
private void NESGraphicsConfig_Load(object sender, EventArgs e)
{
nes = GlobalWinF.Emulator as NES;
nes = Global.Emulator as NES;
LoadStuff();
}

View File

@ -37,7 +37,7 @@ namespace BizHawk.MultiClient
if (now == false)
{
if (GlobalWinF.Emulator.Frame % RefreshRate.Value != 0) return;
if (Global.Emulator.Frame % RefreshRate.Value != 0) return;
}
BitmapData bmpdata = NameTableView.Nametables.LockBits(new Rectangle(0, 0, 512, 480), ImageLockMode.WriteOnly, PixelFormat.Format32bppArgb);
@ -107,15 +107,15 @@ namespace BizHawk.MultiClient
public void UpdateValues()
{
if (!IsHandleCreated || IsDisposed) return;
if (!(GlobalWinF.Emulator is NES)) return;
NES.PPU ppu = (GlobalWinF.Emulator as NES).ppu;
if (!(Global.Emulator is NES)) return;
NES.PPU ppu = (Global.Emulator as NES).ppu;
ppu.NTViewCallback = Callback;
}
public void Restart()
{
if (!(GlobalWinF.Emulator is NES)) Close();
_nes = GlobalWinF.Emulator as NES;
if (!(Global.Emulator is NES)) Close();
_nes = Global.Emulator as NES;
Generate(true);
}
@ -124,7 +124,7 @@ namespace BizHawk.MultiClient
if (Global.Config.NESNameTableSaveWindowPosition && Global.Config.NESNameTableWndx >= 0 && Global.Config.NESNameTableWndy >= 0)
Location = new Point(Global.Config.NESNameTableWndx, Global.Config.NESNameTableWndy);
_nes = GlobalWinF.Emulator as NES;
_nes = Global.Emulator as NES;
RefreshRate.Value = Global.Config.NESNameTableRefreshRate;
Generate(true);
}

View File

@ -52,9 +52,9 @@ namespace BizHawk.MultiClient
public void Restart()
{
if (!(GlobalWinF.Emulator is NES)) Close();
if (!(Global.Emulator is NES)) Close();
if (!IsHandleCreated || IsDisposed) return;
_nes = GlobalWinF.Emulator as NES;
_nes = Global.Emulator as NES;
Generate(true);
}
@ -101,7 +101,7 @@ namespace BizHawk.MultiClient
{
if (!IsHandleCreated || IsDisposed) return;
if (GlobalWinF.Emulator.Frame % RefreshRate.Value == 0 || now)
if (Global.Emulator.Frame % RefreshRate.Value == 0 || now)
{
bool Changed = CheckChange();
@ -233,14 +233,14 @@ namespace BizHawk.MultiClient
public void UpdateValues()
{
if (!IsHandleCreated || IsDisposed) return;
if (!(GlobalWinF.Emulator is NES)) return;
if (!(Global.Emulator is NES)) return;
_nes.ppu.PPUViewCallback = Callback;
}
private void NESPPU_Load(object sender, EventArgs e)
{
LoadConfigSettings();
_nes = GlobalWinF.Emulator as NES;
_nes = Global.Emulator as NES;
ClearDetails();
RefreshRate.Value = Global.Config.NESPPURefreshRate;
Generate(true);

View File

@ -22,7 +22,7 @@ namespace BizHawk.MultiClient
public unsafe void Generate()
{
if (GlobalWinF.Emulator.Frame % RefreshRate.Value != 0) return;
if (Global.Emulator.Frame % RefreshRate.Value != 0) return;
VDC vdc = VDCtype == 0 ? pce.VDC1 : pce.VDC2;
@ -67,18 +67,18 @@ namespace BizHawk.MultiClient
public void Restart()
{
if (!IsHandleCreated || IsDisposed) return;
if (!(GlobalWinF.Emulator is PCEngine))
if (!(Global.Emulator is PCEngine))
{
Close();
return;
}
pce = GlobalWinF.Emulator as PCEngine;
pce = Global.Emulator as PCEngine;
}
public void UpdateValues()
{
if (!IsHandleCreated || IsDisposed) return;
if (!(GlobalWinF.Emulator is PCEngine)) return;
if (!(Global.Emulator is PCEngine)) return;
Generate();
}
@ -97,7 +97,7 @@ namespace BizHawk.MultiClient
private void PCEBGViewer_Load(object sender, EventArgs e)
{
pce = GlobalWinF.Emulator as PCEngine;
pce = Global.Emulator as PCEngine;
LoadConfigSettings();
if (Global.Config.PCEBGViewerRefreshRate >= RefreshRate.Minimum && Global.Config.PCEBGViewerRefreshRate <= RefreshRate.Maximum)
{

View File

@ -293,7 +293,7 @@ namespace BizHawk.MultiClient
private void AddCheat_Click(object sender, EventArgs e)
{
if (GlobalWinF.Emulator is LibsnesCore)
if (Global.Emulator is LibsnesCore)
{
string NAME;
int ADDRESS = 0;
@ -323,9 +323,9 @@ namespace BizHawk.MultiClient
VALUE = (byte)(int.Parse(ValueBox.Text, NumberStyles.HexNumber));
}
for (int i = 0; i < GlobalWinF.Emulator.MemoryDomains.Count; i++)
for (int i = 0; i < Global.Emulator.MemoryDomains.Count; i++)
{
if (GlobalWinF.Emulator.MemoryDomains[i].ToString() == "BUS")
if (Global.Emulator.MemoryDomains[i].ToString() == "BUS")
{
sysBusIndex = i;
break;
@ -333,7 +333,7 @@ namespace BizHawk.MultiClient
}
Watch watch = Watch.GenerateWatch(
GlobalWinF.Emulator.MemoryDomains[sysBusIndex],
Global.Emulator.MemoryDomains[sysBusIndex],
ADDRESS,
Watch.WatchSize.Byte,
Watch.DisplayType.Hex,
@ -341,12 +341,14 @@ namespace BizHawk.MultiClient
bigEndian: false
);
GlobalWinF.CheatList.Add(new Cheat(
Global.CheatList.Add(new Cheat(
watch,
VALUE,
compare: null,
enabled: true
));
ToolHelpers.UpdateCheatRelatedTools();
}
}

View File

@ -154,7 +154,7 @@ namespace BizHawk.MultiClient
void SyncCore()
{
LibsnesCore core = GlobalWinF.Emulator as LibsnesCore;
LibsnesCore core = Global.Emulator as LibsnesCore;
if (currentSnesCore != core && currentSnesCore != null)
{
currentSnesCore.ScanlineHookManager.Unregister(this);

View File

@ -76,7 +76,7 @@ namespace BizHawk.MultiClient
TASView.BlazingFast = false;
}
if (GlobalWinF.Emulator.Frame < stopOnFrame)
if (Global.Emulator.Frame < stopOnFrame)
{
GlobalWinF.MainForm.PressFrameAdvance = true;
}
@ -120,7 +120,7 @@ namespace BizHawk.MultiClient
color = Color.LightGreen;
}
}
if (index == GlobalWinF.Emulator.Frame)
if (index == Global.Emulator.Frame)
{
if (color != Color.LightBlue)
{
@ -146,12 +146,12 @@ namespace BizHawk.MultiClient
private void DisplayList()
{
TASView.ItemCount = GlobalWinF.MovieSession.Movie.RawFrames;
if (GlobalWinF.MovieSession.Movie.Frames == GlobalWinF.Emulator.Frame && GlobalWinF.MovieSession.Movie.StateLastIndex == GlobalWinF.Emulator.Frame - 1)
if (GlobalWinF.MovieSession.Movie.Frames == Global.Emulator.Frame && GlobalWinF.MovieSession.Movie.StateLastIndex == Global.Emulator.Frame - 1)
{
//If we're at the end of the movie add one to show the cursor as a blank frame
TASView.ItemCount++;
}
TASView.ensureVisible(GlobalWinF.Emulator.Frame - 1);
TASView.ensureVisible(Global.Emulator.Frame - 1);
}
public void Restart()
@ -262,14 +262,14 @@ namespace BizHawk.MultiClient
if (GlobalWinF.MovieSession.Movie.IsFinished || !GlobalWinF.MovieSession.Movie.IsActive)
{
GlobalWinF.MainForm.Rewind(1);
if (GlobalWinF.Emulator.Frame <= GlobalWinF.MovieSession.Movie.Frames)
if (Global.Emulator.Frame <= GlobalWinF.MovieSession.Movie.Frames)
{
GlobalWinF.MovieSession.Movie.SwitchToPlay();
}
}
else
{
GlobalWinF.MovieSession.Movie.RewindToFrame(GlobalWinF.Emulator.Frame - 1);
GlobalWinF.MovieSession.Movie.RewindToFrame(Global.Emulator.Frame - 1);
}
UpdateValues();
}
@ -311,7 +311,7 @@ namespace BizHawk.MultiClient
private void RewindToBeginning_Click(object sender, EventArgs e)
{
GlobalWinF.MainForm.Rewind(GlobalWinF.Emulator.Frame);
GlobalWinF.MainForm.Rewind(Global.Emulator.Frame);
DisplayList();
}
@ -480,7 +480,7 @@ namespace BizHawk.MultiClient
if (e.Delta > 0) //Scroll up
{
GlobalWinF.MovieSession.Movie.RewindToFrame(GlobalWinF.Emulator.Frame - 1);
GlobalWinF.MovieSession.Movie.RewindToFrame(Global.Emulator.Frame - 1);
}
else if (e.Delta < 0) //Scroll down
{

View File

@ -95,7 +95,7 @@ namespace BizHawk.MultiClient
public void Restart()
{
if (!(GlobalWinF.Emulator is TI83))
if (!(Global.Emulator is TI83))
Close();
if (!IsHandleCreated || IsDisposed) return;
}

View File

@ -32,7 +32,7 @@ namespace BizHawk.MultiClient
private void HideShowIcons()
{
if (GlobalWinF.Emulator is NES)
if (Global.Emulator is NES)
{
NESPPU.Visible = true;
NESDebugger.Visible = true;
@ -47,7 +47,7 @@ namespace BizHawk.MultiClient
NESNameTable.Visible = false;
}
if (GlobalWinF.Emulator is TI83)
if (Global.Emulator is TI83)
{
KeypadTool.Visible = true;
}
@ -56,7 +56,7 @@ namespace BizHawk.MultiClient
KeypadTool.Visible = false;
}
if (GlobalWinF.Emulator is LibsnesCore)
if (Global.Emulator is LibsnesCore)
{
SNESGraphicsDebuggerButton.Visible = true;
SNESGameGenie.Visible = true;
@ -133,7 +133,7 @@ namespace BizHawk.MultiClient
private void KeyPadTool_Click(object sender, EventArgs e)
{
if (GlobalWinF.Emulator is TI83)
if (Global.Emulator is TI83)
{
GlobalWinF.MainForm.LoadTI83KeyPad();
}
@ -146,7 +146,7 @@ namespace BizHawk.MultiClient
private void SNESGraphicsDebuggerButton_Click(object sender, EventArgs e)
{
if (GlobalWinF.Emulator is LibsnesCore)
if (Global.Emulator is LibsnesCore)
{
GlobalWinF.MainForm.LoadSNESGraphicsDebugger();
}

View File

@ -1,5 +1,6 @@
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using System.Windows.Forms;
@ -10,6 +11,53 @@ namespace BizHawk.MultiClient
{
class ToolHelpers
{
public static FileInfo GetCheatFileFromUser(string currentFile)
{
var ofd = new OpenFileDialog();
if (!String.IsNullOrWhiteSpace(currentFile))
{
ofd.FileName = Path.GetFileNameWithoutExtension(currentFile);
}
ofd.InitialDirectory = PathManager.GetCheatsPath(Global.Game);
ofd.Filter = "Cheat Files (*.cht)|*.cht|All Files|*.*";
ofd.RestoreDirectory = true;
GlobalWinF.Sound.StopSound();
var result = ofd.ShowDialog();
GlobalWinF.Sound.StartSound();
if (result != DialogResult.OK)
return null;
var file = new FileInfo(ofd.FileName);
return file;
}
public static FileInfo GetCheatSaveFileFromUser(string currentFile)
{
var sfd = new SaveFileDialog();
if (!String.IsNullOrWhiteSpace(currentFile))
{
sfd.FileName = Path.GetFileNameWithoutExtension(currentFile);
}
else if (!(Global.Emulator is NullEmulator))
{
sfd.FileName = PathManager.FilesystemSafeName(Global.Game);
}
sfd.InitialDirectory = PathManager.GetCheatsPath(Global.Game);
sfd.Filter = "Cheat Files (*.cht)|*.cht|All Files|*.*";
sfd.RestoreDirectory = true;
GlobalWinF.Sound.StopSound();
var result = sfd.ShowDialog();
GlobalWinF.Sound.StartSound();
if (result != DialogResult.OK)
{
return null;
}
var file = new FileInfo(sfd.FileName);
Global.Config.LastRomPath = file.DirectoryName;
return file;
}
public static ToolStripMenuItem GenerateAutoLoadItem(RecentFiles recent)
{
var auto = new ToolStripMenuItem { Text = "&Auto-Load", Checked = recent.AutoLoad };
@ -62,10 +110,10 @@ namespace BizHawk.MultiClient
{
var items = new List<ToolStripMenuItem>();
if (GlobalWinF.Emulator.MemoryDomains.Any())
if (Global.Emulator.MemoryDomains.Any())
{
int counter = 0;
foreach (var domain in GlobalWinF.Emulator.MemoryDomains)
foreach (var domain in Global.Emulator.MemoryDomains)
{
string temp = domain.ToString();
var item = new ToolStripMenuItem { Text = temp };
@ -94,9 +142,9 @@ namespace BizHawk.MultiClient
public static void PopulateMemoryDomainDropdown(ref ComboBox dropdown, MemoryDomain startDomain)
{
dropdown.Items.Clear();
if (GlobalWinF.Emulator.MemoryDomains.Count > 0)
if (Global.Emulator.MemoryDomains.Count > 0)
{
foreach (var domain in GlobalWinF.Emulator.MemoryDomains)
foreach (var domain in Global.Emulator.MemoryDomains)
{
var result = dropdown.Items.Add(domain.ToString());
if (domain.Name == startDomain.Name)
@ -118,7 +166,7 @@ namespace BizHawk.MultiClient
public static void UnfreezeAll()
{
GlobalWinF.CheatList.DisableAll();
Global.CheatList.DisableAll();
UpdateCheatRelatedTools();
}
@ -128,7 +176,7 @@ namespace BizHawk.MultiClient
{
if (!watch.IsSeparator)
{
GlobalWinF.CheatList.Add(
Global.CheatList.Add(
new Cheat(watch, watch.Value.Value, compare: null, enabled: true)
);
}
@ -143,7 +191,7 @@ namespace BizHawk.MultiClient
{
if (!watch.IsSeparator)
{
GlobalWinF.CheatList.Remove(watch);
Global.CheatList.Remove(watch);
}
}
@ -160,7 +208,7 @@ namespace BizHawk.MultiClient
public static MemoryDomain DomainByName(string name)
{
//Attempts to find the memory domain by name, if it fails, it defaults to index 0
foreach (MemoryDomain domain in GlobalWinF.Emulator.MemoryDomains)
foreach (MemoryDomain domain in Global.Emulator.MemoryDomains)
{
if (domain.Name == name)
{
@ -168,7 +216,7 @@ namespace BizHawk.MultiClient
}
}
return GlobalWinF.Emulator.MainMemory;
return Global.Emulator.MainMemory;
}
public static void AddColumn(ListView listView, string columnName, bool enabled, int columnWidth)

View File

@ -80,10 +80,10 @@ namespace BizHawk.MultiClient
}
else
{
if (GlobalWinF.Emulator.CoreComm.CpuTraceAvailable)
if (Global.Emulator.CoreComm.CpuTraceAvailable)
{
ClearList();
TraceView.Columns[0].Text = GlobalWinF.Emulator.CoreComm.TraceHeader;
TraceView.Columns[0].Text = Global.Emulator.CoreComm.TraceHeader;
}
else
{

View File

@ -3,6 +3,8 @@ using System.Drawing;
using System.Windows.Forms;
using System.Text;
using BizHawk.Client.Common;
namespace BizHawk.MultiClient
{
class VirtualPadA26 : VirtualPad
@ -144,7 +146,7 @@ namespace BizHawk.MultiClient
private void Buttons_CheckedChanged(object sender, EventArgs e)
{
if (GlobalWinF.Emulator.SystemId != "A26" && GlobalWinF.Emulator.SystemId != "C64") return;
if (Global.Emulator.SystemId != "A26" && Global.Emulator.SystemId != "C64") return;
if (sender == PU)
GlobalWinF.StickyXORAdapter.SetSticky(Controller + " Up", PU.Checked);
else if (sender == PD)
@ -159,7 +161,7 @@ namespace BizHawk.MultiClient
public override void Clear()
{
if (GlobalWinF.Emulator.SystemId != "A26" && GlobalWinF.Emulator.SystemId != "C64") return;
if (Global.Emulator.SystemId != "A26" && Global.Emulator.SystemId != "C64") return;
if (PU.Checked) GlobalWinF.StickyXORAdapter.SetSticky(Controller + " Up", false);

View File

@ -3,6 +3,8 @@ using System.Drawing;
using System.Windows.Forms;
using System.Text;
using BizHawk.Client.Common;
namespace BizHawk.MultiClient
{
class VirtualPadA26Control : VirtualPad
@ -98,7 +100,7 @@ namespace BizHawk.MultiClient
private void Buttons_CheckedChanged(object sender, EventArgs e)
{
if (GlobalWinF.Emulator.SystemId != "A26") return;
if (Global.Emulator.SystemId != "A26") return;
else if (sender == B1)
{
GlobalWinF.StickyXORAdapter.SetSticky("Reset", B1.Checked);
@ -127,7 +129,7 @@ namespace BizHawk.MultiClient
public override void Clear()
{
if (GlobalWinF.Emulator.SystemId != "A26") return;
if (Global.Emulator.SystemId != "A26") return;
if (B1.Checked) GlobalWinF.StickyXORAdapter.SetSticky("Reset", false);
if (B2.Checked) GlobalWinF.StickyXORAdapter.SetSticky("Pause", false);

View File

@ -2,6 +2,8 @@
using System.Text;
using System.Windows.Forms;
using BizHawk.Client.Common;
namespace BizHawk.MultiClient
{
public partial class VirtualPadA78 : UserControl, IVirtualPad
@ -71,7 +73,7 @@ namespace BizHawk.MultiClient
private void Buttons_CheckedChanged(object sender, EventArgs e)
{
if (GlobalWinF.Emulator.SystemId != "A78")
if (Global.Emulator.SystemId != "A78")
{
return;
}
@ -103,7 +105,7 @@ namespace BizHawk.MultiClient
public void Clear()
{
if (GlobalWinF.Emulator.SystemId != "A78") return;
if (Global.Emulator.SystemId != "A78") return;
if (PU.Checked) GlobalWinF.StickyXORAdapter.SetSticky(Controller + " Up", false);

View File

@ -2,6 +2,8 @@
using System.Text;
using System.Windows.Forms;
using BizHawk.Client.Common;
namespace BizHawk.MultiClient
{
public partial class VirtualPadA78Control : UserControl, IVirtualPad
@ -70,7 +72,7 @@ namespace BizHawk.MultiClient
private void Buttons_CheckedChanged(object sender, EventArgs e)
{
if (GlobalWinF.Emulator.SystemId != "A78")
if (Global.Emulator.SystemId != "A78")
{
return;
}
@ -94,7 +96,7 @@ namespace BizHawk.MultiClient
public void Clear()
{
if (GlobalWinF.Emulator.SystemId != "A78") return;
if (Global.Emulator.SystemId != "A78") return;
if (B1.Checked) GlobalWinF.StickyXORAdapter.SetSticky("Power", false);
if (B2.Checked) GlobalWinF.StickyXORAdapter.SetSticky("Reset", false);

View File

@ -2,6 +2,8 @@
using System.Text;
using System.Windows.Forms;
using BizHawk.Client.Common;
namespace BizHawk.MultiClient
{
public partial class VirtualPadC64Keyboard : UserControl , IVirtualPad
@ -13,7 +15,7 @@ namespace BizHawk.MultiClient
private void Buttons_CheckedChanged(object sender, EventArgs e)
{
if (GlobalWinF.Emulator.SystemId != "C64")
if (Global.Emulator.SystemId != "C64")
{
return;
}
@ -337,7 +339,7 @@ namespace BizHawk.MultiClient
public void Clear()
{
if (GlobalWinF.Emulator.SystemId != "C64")
if (Global.Emulator.SystemId != "C64")
{
return;
}

View File

@ -2,6 +2,8 @@
using System.Text;
using System.Windows.Forms;
using BizHawk.Client.Common;
namespace BizHawk.MultiClient
{
public partial class VirtualPadColeco : UserControl , IVirtualPad
@ -105,7 +107,7 @@ namespace BizHawk.MultiClient
private void Buttons_CheckedChanged(object sender, EventArgs e)
{
if (GlobalWinF.Emulator.SystemId != "Coleco") return;
if (Global.Emulator.SystemId != "Coleco") return;
if (sender == PU)
GlobalWinF.StickyXORAdapter.SetSticky(Controller + " Up", PU.Checked);
else if (sender == PD)
@ -147,7 +149,7 @@ namespace BizHawk.MultiClient
public void Clear()
{
if (GlobalWinF.Emulator.SystemId != "Coleco") return;
if (Global.Emulator.SystemId != "Coleco") return;
if (PU.Checked) GlobalWinF.StickyXORAdapter.SetSticky(Controller + " Up", false);

View File

@ -57,7 +57,7 @@ namespace BizHawk.MultiClient
private void LoadPads()
{
switch (GlobalWinF.Emulator.SystemId)
switch (Global.Emulator.SystemId)
{
case "A26":
VirtualPadA26 ataripad1 = new VirtualPadA26 {Location = new Point(8, 19), Controller = "P1"};
@ -208,7 +208,7 @@ namespace BizHawk.MultiClient
}
//Hack for now
if (GlobalWinF.Emulator.SystemId == "C64")
if (Global.Emulator.SystemId == "C64")
{
if (Width < 505)
{
@ -256,10 +256,10 @@ namespace BizHawk.MultiClient
if (GlobalWinF.MovieSession.Movie.IsPlaying && !GlobalWinF.MovieSession.Movie.IsFinished)
{
string str = GlobalWinF.MovieSession.Movie.GetInput(GlobalWinF.Emulator.Frame);
string str = GlobalWinF.MovieSession.Movie.GetInput(Global.Emulator.Frame);
if (Global.Config.TASUpdatePads && str != "")
{
switch (GlobalWinF.Emulator.SystemId)
switch (Global.Emulator.SystemId)
{
case "NES":
Pads[0].SetButtons(str.Substring(3, 8));
@ -372,7 +372,7 @@ namespace BizHawk.MultiClient
public void BumpAnalogValue(int? dx, int? dy)
{
//TODO: make an analog flag in virtualpads that have it, and check the virtualpads loaded, instead of doing this hardcoded
if (GlobalWinF.Emulator is N64)
if (Global.Emulator is N64)
{
(Pads[0] as VirtualPadN64).FudgeAnalog(dx, dy);

View File

@ -3,6 +3,8 @@ using System.Drawing;
using System.Windows.Forms;
using System.Text;
using BizHawk.Client.Common;
namespace BizHawk.MultiClient
{
public class VirtualPadGB : VirtualPad
@ -195,7 +197,7 @@ namespace BizHawk.MultiClient
private void Buttons_CheckedChanged(object sender, EventArgs e)
{
if (GlobalWinF.Emulator.SystemId != "GB")
if (Global.Emulator.SystemId != "GB")
{
return;
}
@ -235,7 +237,7 @@ namespace BizHawk.MultiClient
public override void Clear()
{
if (GlobalWinF.Emulator.SystemId != "GB") return;
if (Global.Emulator.SystemId != "GB") return;
if (PU.Checked) GlobalWinF.StickyXORAdapter.SetSticky("Up", false);

View File

@ -3,6 +3,8 @@ using System.Drawing;
using System.Windows.Forms;
using System.Text;
using BizHawk.Client.Common;
namespace BizHawk.MultiClient
{
class VirtualPadGBA : VirtualPad
@ -227,7 +229,7 @@ namespace BizHawk.MultiClient
private void Buttons_CheckedChanged(object sender, EventArgs e)
{
if (GlobalWinF.Emulator.SystemId != "GBA") return;
if (Global.Emulator.SystemId != "GBA") return;
if (sender == PU)
GlobalWinF.StickyXORAdapter.SetSticky("Up", PU.Checked);
else if (sender == PD)
@ -252,7 +254,7 @@ namespace BizHawk.MultiClient
public override void Clear()
{
if (GlobalWinF.Emulator.SystemId != "GBA") return;
if (Global.Emulator.SystemId != "GBA") return;
if (PU.Checked) GlobalWinF.StickyXORAdapter.SetSticky("Up", false);
if (PD.Checked) GlobalWinF.StickyXORAdapter.SetSticky("Down", false);

View File

@ -3,6 +3,8 @@ using System.Drawing;
using System.Windows.Forms;
using System.Text;
using BizHawk.Client.Common;
namespace BizHawk.MultiClient
{
public class VirtualPadGBControl : VirtualPad
@ -87,7 +89,7 @@ namespace BizHawk.MultiClient
private void Buttons_CheckedChanged(object sender, EventArgs e)
{
if (GlobalWinF.Emulator.SystemId != "GB")
if (Global.Emulator.SystemId != "GB")
{
return;
}
@ -107,7 +109,7 @@ namespace BizHawk.MultiClient
public override void Clear()
{
if (GlobalWinF.Emulator.SystemId != "GB")
if (Global.Emulator.SystemId != "GB")
{
return;
}

View File

@ -3,6 +3,8 @@ using System.Drawing;
using System.Windows.Forms;
using System.Text;
using BizHawk.Client.Common;
namespace BizHawk.MultiClient
{
class VirtualPadGen3Button : VirtualPad
@ -191,7 +193,7 @@ namespace BizHawk.MultiClient
private void Buttons_CheckedChanged(object sender, EventArgs e)
{
if (GlobalWinF.Emulator.SystemId != "GEN") return;
if (Global.Emulator.SystemId != "GEN") return;
if (sender == PU)
GlobalWinF.StickyXORAdapter.SetSticky(Controller + " Up", PU.Checked);
else if (sender == PD)
@ -212,7 +214,7 @@ namespace BizHawk.MultiClient
public override void Clear()
{
if (GlobalWinF.Emulator.SystemId != "GEN") return;
if (Global.Emulator.SystemId != "GEN") return;
if (PU.Checked) GlobalWinF.StickyXORAdapter.SetSticky(Controller + " Up", false);
if (PD.Checked) GlobalWinF.StickyXORAdapter.SetSticky(Controller + " Down", false);

View File

@ -74,7 +74,7 @@ namespace BizHawk.MultiClient
public void Clear()
{
if (GlobalWinF.Emulator.SystemId != "N64") return;
if (Global.Emulator.SystemId != "N64") return;
foreach (var button in Buttons)
{

View File

@ -3,6 +3,8 @@ using System.Drawing;
using System.Windows.Forms;
using System.Text;
using BizHawk.Client.Common;
namespace BizHawk.MultiClient
{
public class VirtualPadN64Control : VirtualPad
@ -110,7 +112,7 @@ namespace BizHawk.MultiClient
private void Buttons_CheckedChanged(object sender, EventArgs e)
{
if (GlobalWinF.Emulator.SystemId != "N64")
if (Global.Emulator.SystemId != "N64")
{
return;
}
@ -134,7 +136,7 @@ namespace BizHawk.MultiClient
public override void Clear()
{
if (GlobalWinF.Emulator.SystemId != "N64") return;
if (Global.Emulator.SystemId != "N64") return;
B1.Checked = false;
B2.Checked = false;

View File

@ -3,6 +3,8 @@ using System.Drawing;
using System.Windows.Forms;
using System.Text;
using BizHawk.Client.Common;
namespace BizHawk.MultiClient
{
public class VirtualPadNES : VirtualPad
@ -194,7 +196,7 @@ namespace BizHawk.MultiClient
private void Buttons_CheckedChanged(object sender, EventArgs e)
{
if (GlobalWinF.Emulator.SystemId != "NES") return;
if (Global.Emulator.SystemId != "NES") return;
if (sender == PU)
GlobalWinF.StickyXORAdapter.SetSticky(Controller + " Up", PU.Checked);
else if (sender == PD)
@ -215,7 +217,7 @@ namespace BizHawk.MultiClient
public override void Clear()
{
if (GlobalWinF.Emulator.SystemId != "NES") return;
if (Global.Emulator.SystemId != "NES") return;
if (PU.Checked) GlobalWinF.StickyXORAdapter.SetSticky(Controller + " Up", false);
if (PD.Checked) GlobalWinF.StickyXORAdapter.SetSticky(Controller + " Down", false);

View File

@ -3,6 +3,8 @@ using System.Drawing;
using System.Windows.Forms;
using System.Text;
using BizHawk.Client.Common;
namespace BizHawk.MultiClient
{
public class VirtualPadNESControl : VirtualPad
@ -110,7 +112,7 @@ namespace BizHawk.MultiClient
private void Buttons_CheckedChanged(object sender, EventArgs e)
{
if (GlobalWinF.Emulator.SystemId != "NES")
if (Global.Emulator.SystemId != "NES")
{
return;
}
@ -134,7 +136,7 @@ namespace BizHawk.MultiClient
public override void Clear()
{
if (GlobalWinF.Emulator.SystemId != "NES") return;
if (Global.Emulator.SystemId != "NES") return;
B1.Checked = false;
B2.Checked = false;

View File

@ -3,6 +3,8 @@ using System.Drawing;
using System.Windows.Forms;
using System.Text;
using BizHawk.Client.Common;
namespace BizHawk.MultiClient
{
public class VirtualPadPCE : VirtualPad
@ -194,7 +196,7 @@ namespace BizHawk.MultiClient
private void Buttons_CheckedChanged(object sender, EventArgs e)
{
if (GlobalWinF.Emulator.SystemId != "PCE") return;
if (Global.Emulator.SystemId != "PCE") return;
if (sender == PU)
GlobalWinF.StickyXORAdapter.SetSticky(Controller + " Up", PU.Checked);
else if (sender == PD)
@ -215,7 +217,7 @@ namespace BizHawk.MultiClient
public override void Clear()
{
if (GlobalWinF.Emulator.SystemId != "PCE" && GlobalWinF.Emulator.SystemId != "PCECD" && GlobalWinF.Emulator.SystemId != "SGX") return;
if (Global.Emulator.SystemId != "PCE" && Global.Emulator.SystemId != "PCECD" && Global.Emulator.SystemId != "SGX") return;
if (PU.Checked) GlobalWinF.StickyXORAdapter.SetSticky(Controller + " Up", false);
if (PD.Checked) GlobalWinF.StickyXORAdapter.SetSticky(Controller + " Down", false);

View File

@ -3,6 +3,8 @@ using System.Drawing;
using System.Windows.Forms;
using System.Text;
using BizHawk.Client.Common;
namespace BizHawk.MultiClient
{
public class VirtualPadSMS : VirtualPad
@ -164,7 +166,7 @@ namespace BizHawk.MultiClient
private void Buttons_CheckedChanged(object sender, EventArgs e)
{
if (GlobalWinF.Emulator.SystemId != "SMS" && GlobalWinF.Emulator.SystemId != "GG" && GlobalWinF.Emulator.SystemId != "SG") return;
if (Global.Emulator.SystemId != "SMS" && Global.Emulator.SystemId != "GG" && Global.Emulator.SystemId != "SG") return;
if (sender == PU)
GlobalWinF.StickyXORAdapter.SetSticky(Controller + " Up", PU.Checked);
@ -182,7 +184,7 @@ namespace BizHawk.MultiClient
public override void Clear()
{
if (GlobalWinF.Emulator.SystemId != "SMS" && GlobalWinF.Emulator.SystemId != "GG" && GlobalWinF.Emulator.SystemId != "SG") return;
if (Global.Emulator.SystemId != "SMS" && Global.Emulator.SystemId != "GG" && Global.Emulator.SystemId != "SG") return;
if (PU.Checked) GlobalWinF.StickyXORAdapter.SetSticky(Controller + " Up", false);
if (PD.Checked) GlobalWinF.StickyXORAdapter.SetSticky(Controller + " Down", false);

View File

@ -3,6 +3,8 @@ using System.Drawing;
using System.Windows.Forms;
using System.Text;
using BizHawk.Client.Common;
namespace BizHawk.MultiClient
{
public class VirtualPadSMSControl : VirtualPad
@ -98,7 +100,7 @@ namespace BizHawk.MultiClient
private void Buttons_CheckedChanged(object sender, EventArgs e)
{
if (GlobalWinF.Emulator.SystemId != "SMS" && GlobalWinF.Emulator.SystemId != "GG" && GlobalWinF.Emulator.SystemId != "SG") return;
if (Global.Emulator.SystemId != "SMS" && Global.Emulator.SystemId != "GG" && Global.Emulator.SystemId != "SG") return;
else if (sender == B1)
{
@ -120,7 +122,7 @@ namespace BizHawk.MultiClient
public override void Clear()
{
if (GlobalWinF.Emulator.SystemId != "SMS" && GlobalWinF.Emulator.SystemId != "GG" && GlobalWinF.Emulator.SystemId != "SG") return;
if (Global.Emulator.SystemId != "SMS" && Global.Emulator.SystemId != "GG" && Global.Emulator.SystemId != "SG") return;
if (B1.Checked) GlobalWinF.StickyXORAdapter.SetSticky("Pause", false);
if (B2.Checked) GlobalWinF.StickyXORAdapter.SetSticky("Reset", false);

View File

@ -3,6 +3,8 @@ using System.Drawing;
using System.Windows.Forms;
using System.Text;
using BizHawk.Client.Common;
namespace BizHawk.MultiClient
{
public class VirtualPadSNES : VirtualPad
@ -259,7 +261,7 @@ namespace BizHawk.MultiClient
private void Buttons_CheckedChanged(object sender, EventArgs e)
{
if (GlobalWinF.Emulator.SystemId != "SNES")
if (Global.Emulator.SystemId != "SNES")
{
return;
}
@ -316,7 +318,7 @@ namespace BizHawk.MultiClient
public override void Clear()
{
if (GlobalWinF.Emulator.SystemId != "SNES")
if (Global.Emulator.SystemId != "SNES")
{
return;
}

View File

@ -3,6 +3,8 @@ using System.Drawing;
using System.Windows.Forms;
using System.Text;
using BizHawk.Client.Common;
namespace BizHawk.MultiClient
{
public class VirtualPadSNESControl : VirtualPad
@ -120,7 +122,7 @@ namespace BizHawk.MultiClient
private void Buttons_CheckedChanged(object sender, EventArgs e)
{
if (GlobalWinF.Emulator.SystemId != "SNES")
if (Global.Emulator.SystemId != "SNES")
{
return;
}
@ -152,7 +154,7 @@ namespace BizHawk.MultiClient
public override void Clear()
{
if (GlobalWinF.Emulator.SystemId != "SNES")
if (Global.Emulator.SystemId != "SNES")
{
return;
}

View File

@ -2,6 +2,8 @@
using System.Text;
using System.Windows.Forms;
using BizHawk.Client.Common;
namespace BizHawk.MultiClient
{
public partial class VirtualPadSaturn : UserControl, IVirtualPad
@ -79,7 +81,7 @@ namespace BizHawk.MultiClient
public void Clear()
{
if (GlobalWinF.Emulator.SystemId != "SAT") return;
if (Global.Emulator.SystemId != "SAT") return;
if (PU.Checked) GlobalWinF.StickyXORAdapter.SetSticky(Controller + " Up", false);
if (PD.Checked) GlobalWinF.StickyXORAdapter.SetSticky(Controller + " Down", false);
@ -137,7 +139,7 @@ namespace BizHawk.MultiClient
private void Buttons_CheckedChanged(object sender, EventArgs e)
{
if (GlobalWinF.Emulator.SystemId != "SAT")
if (Global.Emulator.SystemId != "SAT")
{
return;
}

View File

@ -2,6 +2,8 @@
using System.Text;
using System.Windows.Forms;
using BizHawk.Client.Common;
namespace BizHawk.MultiClient
{
public partial class VirtualPadSaturnControl : UserControl, IVirtualPad
@ -71,7 +73,7 @@ namespace BizHawk.MultiClient
private void Buttons_CheckedChanged(object sender, EventArgs e)
{
if (GlobalWinF.Emulator.SystemId != "SAT")
if (Global.Emulator.SystemId != "SAT")
{
return;
}
@ -87,7 +89,7 @@ namespace BizHawk.MultiClient
public void Clear()
{
if (GlobalWinF.Emulator.SystemId != "SAT") return;
if (Global.Emulator.SystemId != "SAT") return;
if (B1.Checked) GlobalWinF.StickyXORAdapter.SetSticky("Power", false);
if (B2.Checked) GlobalWinF.StickyXORAdapter.SetSticky("Reset", false);

View File

@ -109,7 +109,7 @@ namespace BizHawk.MultiClient
SpecificValueBox.Type = Settings.Type;
MessageLabel.Text = String.Empty;
SpecificAddressBox.MaxLength = IntHelpers.GetNumDigits(GlobalWinF.Emulator.MainMemory.Size);
SpecificAddressBox.MaxLength = IntHelpers.GetNumDigits(Global.Emulator.MainMemory.Size);
HardSetSizeDropDown(Settings.Size);
PopulateTypeDropDown();
HardSetDisplayTypeDropDown(Settings.Type);
@ -133,7 +133,7 @@ namespace BizHawk.MultiClient
{
Color nextColor = Color.White;
bool isCheat = GlobalWinF.CheatList.IsActive(Settings.Domain, Searches[index].Address.Value);
bool isCheat = Global.CheatList.IsActive(Settings.Domain, Searches[index].Address.Value);
bool isWeeded = Global.Config.RamSearchPreviewMode && !forcePreviewClear && Searches.Preview(Searches[index].Address.Value);
if (isCheat)
@ -237,7 +237,7 @@ namespace BizHawk.MultiClient
{
if (!IsHandleCreated || IsDisposed) return;
Settings.Domain = GlobalWinF.Emulator.MainMemory;
Settings.Domain = Global.Emulator.MainMemory;
MessageLabel.Text = "Search restarted";
DoDomainSizeCheck();
NewSearch();
@ -486,14 +486,14 @@ namespace BizHawk.MultiClient
private void SetPlatformAndMemoryDomainLabel()
{
MemDomainLabel.Text = GlobalWinF.Emulator.SystemId + " " + Searches.Domain.Name;
MemDomainLabel.Text = Global.Emulator.SystemId + " " + Searches.Domain.Name;
}
private void SetMemoryDomain(int pos)
{
if (pos < GlobalWinF.Emulator.MemoryDomains.Count) //Sanity check
if (pos < Global.Emulator.MemoryDomains.Count) //Sanity check
{
Settings.Domain = GlobalWinF.Emulator.MemoryDomains[pos];
Settings.Domain = Global.Emulator.MemoryDomains[pos];
SetDomainLabel();
SetReboot(true);
SpecificAddressBox.MaxLength = IntHelpers.GetNumDigits(Settings.Domain.Size);
@ -1175,7 +1175,7 @@ namespace BizHawk.MultiClient
{
if (!watch.IsSeparator)
{
if (!GlobalWinF.CheatList.IsActive(watch.Domain, watch.Address.Value))
if (!Global.CheatList.IsActive(watch.Domain, watch.Address.Value))
{
allCheats = false;
}
@ -1335,14 +1335,14 @@ namespace BizHawk.MultiClient
ViewInHexEditorContextMenuItem.Visible =
SelectedIndices.Count > 0;
UnfreezeAllContextMenuItem.Visible = GlobalWinF.CheatList.ActiveCount > 0;
UnfreezeAllContextMenuItem.Visible = Global.CheatList.ActiveCount > 0;
ContextMenuSeparator3.Visible = (SelectedIndices.Count > 0) || (GlobalWinF.CheatList.ActiveCount > 0);
ContextMenuSeparator3.Visible = (SelectedIndices.Count > 0) || (Global.CheatList.ActiveCount > 0);
bool allCheats = true;
foreach (int index in SelectedIndices)
{
if (!GlobalWinF.CheatList.IsActive(Settings.Domain, Searches[index].Address.Value))
if (!Global.CheatList.IsActive(Settings.Domain, Searches[index].Address.Value))
{
allCheats = false;
}

View File

@ -1020,7 +1020,7 @@ namespace BizHawk.MultiClient
public Settings()
{
switch (GlobalWinF.Emulator.SystemId)
switch (Global.Emulator.SystemId)
{
case "N64":
Mode = SearchMode.Fast;
@ -1069,7 +1069,7 @@ namespace BizHawk.MultiClient
break;
}
Domain = GlobalWinF.Emulator.MainMemory;
Domain = Global.Emulator.MainMemory;
CheckMisAligned = false;
PreviousType = Watch.PreviousType.LastSearch;
}

View File

@ -34,7 +34,7 @@ namespace BizHawk.MultiClient
private int defaultWidth;
private int defaultHeight;
private readonly WatchList Watches = new WatchList(GlobalWinF.Emulator.MainMemory);
private readonly WatchList Watches = new WatchList(Global.Emulator.MainMemory);
private string _sortedColumn = "";
private bool _sortReverse = false;
@ -66,7 +66,7 @@ namespace BizHawk.MultiClient
{
for (int x = 0; x < Watches.Count; x++)
{
bool alert = Watches[x].IsSeparator ? false : GlobalWinF.CheatList.IsActive(Watches[x].Domain, Watches[x].Address.Value);
bool alert = Watches[x].IsSeparator ? false : Global.CheatList.IsActive(Watches[x].Domain, Watches[x].Address.Value);
GlobalWinF.OSD.AddGUIText(
Watches[x].ToString(),
Global.Config.DispRamWatchx,
@ -139,9 +139,9 @@ namespace BizHawk.MultiClient
private int GetDomainPos(string name)
{
//Attempts to find the memory domain by name, if it fails, it defaults to index 0
for (int i = 0; i < GlobalWinF.Emulator.MemoryDomains.Count; i++)
for (int i = 0; i < Global.Emulator.MemoryDomains.Count; i++)
{
if (GlobalWinF.Emulator.MemoryDomains[i].Name == name)
if (Global.Emulator.MemoryDomains[i].Name == name)
{
return i;
}
@ -271,7 +271,7 @@ namespace BizHawk.MultiClient
{
color = BackColor;
}
else if (GlobalWinF.CheatList.IsActive(Watches.Domain, Watches[index].Address.Value))
else if (Global.CheatList.IsActive(Watches.Domain, Watches[index].Address.Value))
{
color = Color.LightCyan;
}
@ -329,7 +329,7 @@ namespace BizHawk.MultiClient
private void SetPlatformAndMemoryDomainLabel()
{
MemDomainLabel.Text = GlobalWinF.Emulator.SystemId + " " + Watches.Domain.Name;
MemDomainLabel.Text = Global.Emulator.SystemId + " " + Watches.Domain.Name;
}
private void NewWatchList(bool suppressAsk)
@ -397,9 +397,9 @@ namespace BizHawk.MultiClient
private void SetMemoryDomain(int pos)
{
if (pos < GlobalWinF.Emulator.MemoryDomains.Count) //Sanity check
if (pos < Global.Emulator.MemoryDomains.Count) //Sanity check
{
Watches.Domain = GlobalWinF.Emulator.MemoryDomains[pos];
Watches.Domain = Global.Emulator.MemoryDomains[pos];
}
SetPlatformAndMemoryDomainLabel();
@ -899,7 +899,7 @@ namespace BizHawk.MultiClient
{
if (!watch.IsSeparator)
{
if (!GlobalWinF.CheatList.IsActive(watch.Domain, watch.Address.Value))
if (!Global.CheatList.IsActive(watch.Domain, watch.Address.Value))
{
allCheats = false;
}
@ -1110,7 +1110,7 @@ namespace BizHawk.MultiClient
{
if (!Watches[i].IsSeparator)
{
if (!GlobalWinF.CheatList.IsActive(Watches[i].Domain, Watches[i].Address.Value))
if (!Global.CheatList.IsActive(Watches[i].Domain, Watches[i].Address.Value))
{
allCheats = false;
}
@ -1133,7 +1133,7 @@ namespace BizHawk.MultiClient
ShowDiffContextMenuItem.Text = Global.Config.RamWatchShowDiffColumn ? "Hide difference value" : "Show difference value";
ShowDomainContextMenuItem.Text = Global.Config.RamWatchShowDomainColumn ? "Hide domain" : "Show domain";
UnfreezeAllContextMenuItem.Visible = GlobalWinF.CheatList.ActiveCount > 0;
UnfreezeAllContextMenuItem.Visible = Global.CheatList.ActiveCount > 0;
ViewInHexEditorContextMenuItem.Visible = SelectedWatches.Count == 1;
}

View File

@ -94,7 +94,7 @@ namespace BizHawk.MultiClient
_watchList.AddRange(watches);
}
_mode = mode;
ToolHelpers.PopulateMemoryDomainDropdown(ref DomainDropDown, domain ?? GlobalWinF.Emulator.MainMemory);
ToolHelpers.PopulateMemoryDomainDropdown(ref DomainDropDown, domain ?? Global.Emulator.MainMemory);
SetTitle();
}
@ -119,7 +119,7 @@ namespace BizHawk.MultiClient
{
if (!_loading)
{
var domain = GlobalWinF.Emulator.MemoryDomains.FirstOrDefault(d => d.Name == DomainDropDown.SelectedItem.ToString());
var domain = Global.Emulator.MemoryDomains.FirstOrDefault(d => d.Name == DomainDropDown.SelectedItem.ToString());
if (domain != null)
{
AddressBox.SetHexProperties(domain.Size);
@ -177,8 +177,8 @@ namespace BizHawk.MultiClient
}
}
var domain = GlobalWinF.Emulator.MemoryDomains.FirstOrDefault(d => d.Name == DomainDropDown.SelectedItem.ToString()) ??
GlobalWinF.Emulator.MainMemory;
var domain = Global.Emulator.MemoryDomains.FirstOrDefault(d => d.Name == DomainDropDown.SelectedItem.ToString()) ??
Global.Emulator.MainMemory;
BigEndianCheckBox.Checked = domain.Endian == Endian.Big;
}
@ -198,7 +198,7 @@ namespace BizHawk.MultiClient
{
default:
case Mode.New:
var domain = GlobalWinF.Emulator.MemoryDomains.FirstOrDefault(d => d.Name == DomainDropDown.SelectedItem.ToString());
var domain = Global.Emulator.MemoryDomains.FirstOrDefault(d => d.Name == DomainDropDown.SelectedItem.ToString());
var address = AddressBox.ToRawInt();
var notes = NotesBox.Text;
var type = Watch.StringToDisplayType(DisplayTypeDropDown.SelectedItem.ToString());

View File

@ -349,7 +349,7 @@ namespace BizHawk.MultiClient
StringBuilder sb = new StringBuilder();
sb
.Append("Domain ").AppendLine(_domain.Name)
.Append("SystemID ").AppendLine(GlobalWinF.Emulator.SystemId);
.Append("SystemID ").AppendLine(Global.Emulator.SystemId);
foreach (Watch w in _watchList)
{
@ -451,7 +451,7 @@ namespace BizHawk.MultiClient
//Temporary, rename if kept
int addr;
bool bigEndian;
MemoryDomain memDomain = GlobalWinF.Emulator.MainMemory;
MemoryDomain memDomain = Global.Emulator.MainMemory;
string temp = line.Substring(0, line.IndexOf('\t'));
try
@ -496,7 +496,7 @@ namespace BizHawk.MultiClient
startIndex = line.IndexOf('\t') + 1;
line = line.Substring(startIndex, line.Length - startIndex); //Domain
temp = line.Substring(0, line.IndexOf('\t'));
memDomain = GlobalWinF.Emulator.MemoryDomains[GetDomainPos(temp)];
memDomain = Global.Emulator.MemoryDomains[GetDomainPos(temp)];
}
startIndex = line.IndexOf('\t') + 1;
@ -510,7 +510,7 @@ namespace BizHawk.MultiClient
type,
notes,
bigEndian));
_domain = GlobalWinF.Emulator.MemoryDomains[GetDomainPos(domain)];
_domain = Global.Emulator.MemoryDomains[GetDomainPos(domain)];
}
}
@ -529,9 +529,9 @@ namespace BizHawk.MultiClient
private static int GetDomainPos(string name)
{
//Attempts to find the memory domain by name, if it fails, it defaults to index 0
for (int x = 0; x < GlobalWinF.Emulator.MemoryDomains.Count; x++)
for (int x = 0; x < Global.Emulator.MemoryDomains.Count; x++)
{
if (GlobalWinF.Emulator.MemoryDomains[x].Name == name)
if (Global.Emulator.MemoryDomains[x].Name == name)
return x;
}
return 0;
@ -563,7 +563,7 @@ namespace BizHawk.MultiClient
sfd.FileName = Path.GetFileNameWithoutExtension(currentFile);
sfd.InitialDirectory = Path.GetDirectoryName(currentFile);
}
else if (!(GlobalWinF.Emulator is NullEmulator))
else if (!(Global.Emulator is NullEmulator))
{
sfd.FileName = PathManager.FilesystemSafeName(Global.Game);
sfd.InitialDirectory = PathManager.MakeAbsolutePath(Global.Config.PathEntries.WatchPath, null);