revert back to r5156

This commit is contained in:
zeromus 2013-10-27 07:45:59 +00:00
parent ff72ae879e
commit 179dbd4124
28 changed files with 2874 additions and 2970 deletions

View File

@ -33,9 +33,6 @@
<AllowUnsafeBlocks>true</AllowUnsafeBlocks> <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>
<Reference Include="ICSharpCode.SharpZipLib">
<HintPath>..\ICSharpCode.SharpZipLib.dll</HintPath>
</Reference>
<Reference Include="Newtonsoft.Json"> <Reference Include="Newtonsoft.Json">
<HintPath>..\Newtonsoft.Json.dll</HintPath> <HintPath>..\Newtonsoft.Json.dll</HintPath>
</Reference> </Reference>
@ -85,11 +82,9 @@
<Compile Include="7z\SevenZipExtractorAsynchronous.cs" /> <Compile Include="7z\SevenZipExtractorAsynchronous.cs" />
<Compile Include="7z\SevenZipSfx.cs" /> <Compile Include="7z\SevenZipSfx.cs" />
<Compile Include="7z\StreamWrappers.cs" /> <Compile Include="7z\StreamWrappers.cs" />
<Compile Include="BinarySaveStates.cs" />
<Compile Include="config\Binding.cs" /> <Compile Include="config\Binding.cs" />
<Compile Include="config\Config.cs" /> <Compile Include="config\Config.cs" />
<Compile Include="config\ConfigService.cs" /> <Compile Include="config\ConfigService.cs" />
<Compile Include="ControllerBinding.cs" />
<Compile Include="CoreFileProvider.cs" /> <Compile Include="CoreFileProvider.cs" />
<Compile Include="FirmwareManager.cs" /> <Compile Include="FirmwareManager.cs" />
<Compile Include="Global.cs" /> <Compile Include="Global.cs" />
@ -105,24 +100,15 @@
<Compile Include="movie\MultitrackRecording.cs" /> <Compile Include="movie\MultitrackRecording.cs" />
<Compile Include="movie\Subtitle.cs" /> <Compile Include="movie\Subtitle.cs" />
<Compile Include="movie\SubtitleList.cs" /> <Compile Include="movie\SubtitleList.cs" />
<Compile Include="PathManager.cs" />
<Compile Include="Properties\AssemblyInfo.cs" /> <Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="RecentFiles.cs" /> <Compile Include="RecentFiles.cs" />
<Compile Include="helpers\StringHelpers.cs" /> <Compile Include="helpers\StringHelpers.cs" />
<Compile Include="RomGame.cs" /> <Compile Include="RomGame.cs" />
<Compile Include="SavestateManager.cs" />
<Compile Include="tools\Cheat.cs" /> <Compile Include="tools\Cheat.cs" />
<Compile Include="tools\CheatList.cs" /> <Compile Include="tools\CheatList.cs" />
<Compile Include="tools\RamSearchEngine.cs" />
<Compile Include="tools\Watch.cs" /> <Compile Include="tools\Watch.cs" />
<Compile Include="tools\WatchList.cs" />
<Compile Include="XmlGame.cs" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<ProjectReference Include="..\BizHawk.Common\BizHawk.Common.csproj">
<Project>{866F8D13-0678-4FF9-80A4-A3993FD4D8A3}</Project>
<Name>BizHawk.Common</Name>
</ProjectReference>
<ProjectReference Include="..\BizHawk.Emulation\BizHawk.Emulation.csproj"> <ProjectReference Include="..\BizHawk.Emulation\BizHawk.Emulation.csproj">
<Project>{197D4314-8A9F-49BA-977D-54ACEFAEB6BA}</Project> <Project>{197D4314-8A9F-49BA-977D-54ACEFAEB6BA}</Project>
<Name>BizHawk.Emulation</Name> <Name>BizHawk.Emulation</Name>

View File

@ -14,10 +14,5 @@
/// </summary> /// </summary>
public static MultitrackRewiringControllerAdapter MultitrackRewiringControllerAdapter = new MultitrackRewiringControllerAdapter(); public static MultitrackRewiringControllerAdapter MultitrackRewiringControllerAdapter = new MultitrackRewiringControllerAdapter();
public static MovieSession MovieSession = new MovieSession(); public static MovieSession MovieSession = new MovieSession();
/// <summary>
/// whether throttling is force-disabled by use of fast forward
/// </summary>
public static bool ForceNoThrottle;
} }
} }

View File

@ -1,55 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProductVersion>8.0.30703</ProductVersion>
<SchemaVersion>2.0</SchemaVersion>
<ProjectGuid>{866F8D13-0678-4FF9-80A4-A3993FD4D8A3}</ProjectGuid>
<OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>BizHawk.Common</RootNamespace>
<AssemblyName>BizHawk.Common</AssemblyName>
<TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<ItemGroup>
<Reference Include="System" />
<Reference Include="System.Core" />
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="Microsoft.CSharp" />
<Reference Include="System.Data" />
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
<Compile Include="MruStack.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="UndoHistory.cs" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.
<Target Name="BeforeBuild">
</Target>
<Target Name="AfterBuild">
</Target>
-->
</Project>

View File

@ -1,36 +0,0 @@
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("BizHawk.Common")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("Measurement Incorporated")]
[assembly: AssemblyProduct("BizHawk.Common")]
[assembly: AssemblyCopyright("Copyright © Measurement Incorporated 2013")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("f8e9ad29-89d8-478b-a699-ed3369703b6a")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]

View File

@ -583,12 +583,7 @@
<ItemGroup> <ItemGroup>
<Folder Include="Computers\Commodore64\Peripheral\" /> <Folder Include="Computers\Commodore64\Peripheral\" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup />
<ProjectReference Include="..\BizHawk.Common\BizHawk.Common.csproj">
<Project>{866F8D13-0678-4FF9-80A4-A3993FD4D8A3}</Project>
<Name>BizHawk.Common</Name>
</ProjectReference>
</ItemGroup>
<ItemGroup> <ItemGroup>
<None Include="Consoles\Atari\docs\stella.pdf" /> <None Include="Consoles\Atari\docs\stella.pdf" />
<None Include="Consoles\Coleco\docs\colecovision tech1.pdf" /> <None Include="Consoles\Coleco\docs\colecovision tech1.pdf" />

View File

@ -3,8 +3,6 @@ using System.Collections.Generic;
using System.Text; using System.Text;
using System.Diagnostics; using System.Diagnostics;
using BizHawk.Client.Common;
namespace BizHawk.MultiClient namespace BizHawk.MultiClient
{ {
/// <summary> /// <summary>

View File

@ -5,7 +5,7 @@ using System.Text;
using ICSharpCode.SharpZipLib.Zip; using ICSharpCode.SharpZipLib.Zip;
using System.IO; using System.IO;
namespace BizHawk.Client.Common namespace BizHawk.MultiClient
{ {
public class BinaryStateFileNames public class BinaryStateFileNames
{ {

View File

@ -84,6 +84,7 @@
</Reference> </Reference>
<Reference Include="System.DirectoryServices" /> <Reference Include="System.DirectoryServices" />
<Reference Include="System.Numerics" /> <Reference Include="System.Numerics" />
<Reference Include="System.Web" />
<Reference Include="System.Xml.Linq"> <Reference Include="System.Xml.Linq">
<RequiredTargetFramework>3.5</RequiredTargetFramework> <RequiredTargetFramework>3.5</RequiredTargetFramework>
</Reference> </Reference>
@ -152,6 +153,7 @@
<DependentUpon>VideoWriterChooserForm.cs</DependentUpon> <DependentUpon>VideoWriterChooserForm.cs</DependentUpon>
</Compile> </Compile>
<Compile Include="AVOut\WavWriter.cs" /> <Compile Include="AVOut\WavWriter.cs" />
<Compile Include="BinarySaveStates.cs" />
<Compile Include="BizBox.cs"> <Compile Include="BizBox.cs">
<SubType>Form</SubType> <SubType>Form</SubType>
</Compile> </Compile>
@ -230,6 +232,7 @@
<Compile Include="config\PathInfo.Designer.cs"> <Compile Include="config\PathInfo.Designer.cs">
<DependentUpon>PathInfo.cs</DependentUpon> <DependentUpon>PathInfo.cs</DependentUpon>
</Compile> </Compile>
<Compile Include="config\PathManager.cs" />
<Compile Include="config\RewindConfig.cs"> <Compile Include="config\RewindConfig.cs">
<SubType>Form</SubType> <SubType>Form</SubType>
</Compile> </Compile>
@ -280,6 +283,7 @@
<Compile Include="DisplayManager\DisplayManager.cs" /> <Compile Include="DisplayManager\DisplayManager.cs" />
<Compile Include="DisplayManager\Filters\Hq2x.cs" /> <Compile Include="DisplayManager\Filters\Hq2x.cs" />
<Compile Include="GlobalWinF.cs" /> <Compile Include="GlobalWinF.cs" />
<Compile Include="Input\ControllerBinding.cs" />
<Compile Include="Input\GamePad.cs" Condition=" '$(OS)' == 'Windows_NT' " /> <Compile Include="Input\GamePad.cs" Condition=" '$(OS)' == 'Windows_NT' " />
<Compile Include="Input\GamePad360.cs" /> <Compile Include="Input\GamePad360.cs" />
<Compile Include="Input\Input.cs" /> <Compile Include="Input\Input.cs" />
@ -340,6 +344,7 @@
<Compile Include="movie\SubtitleMaker.Designer.cs"> <Compile Include="movie\SubtitleMaker.Designer.cs">
<DependentUpon>SubtitleMaker.cs</DependentUpon> <DependentUpon>SubtitleMaker.cs</DependentUpon>
</Compile> </Compile>
<Compile Include="MruStack.cs" />
<Compile Include="NameStateForm.cs"> <Compile Include="NameStateForm.cs">
<SubType>Form</SubType> <SubType>Form</SubType>
</Compile> </Compile>
@ -499,6 +504,7 @@
<Compile Include="tools\N64\N64VideoPluginconfig.Designer.cs"> <Compile Include="tools\N64\N64VideoPluginconfig.Designer.cs">
<DependentUpon>N64VideoPluginconfig.cs</DependentUpon> <DependentUpon>N64VideoPluginconfig.cs</DependentUpon>
</Compile> </Compile>
<Compile Include="tools\NES\MovieConvert.cs" />
<Compile Include="tools\NES\NameTableViewer.cs"> <Compile Include="tools\NES\NameTableViewer.cs">
<SubType>Component</SubType> <SubType>Component</SubType>
</Compile> </Compile>
@ -721,6 +727,7 @@
<Compile Include="tools\Watch\RamSearch.Designer.cs"> <Compile Include="tools\Watch\RamSearch.Designer.cs">
<DependentUpon>RamSearch.cs</DependentUpon> <DependentUpon>RamSearch.cs</DependentUpon>
</Compile> </Compile>
<Compile Include="tools\Watch\RamSearchEngine.cs" />
<Compile Include="tools\Watch\RamWatch.cs"> <Compile Include="tools\Watch\RamWatch.cs">
<SubType>Form</SubType> <SubType>Form</SubType>
</Compile> </Compile>
@ -733,9 +740,12 @@
<Compile Include="tools\Watch\WatchEditor.Designer.cs"> <Compile Include="tools\Watch\WatchEditor.Designer.cs">
<DependentUpon>WatchEditor.cs</DependentUpon> <DependentUpon>WatchEditor.cs</DependentUpon>
</Compile> </Compile>
<Compile Include="tools\Watch\WatchHistory.cs" />
<Compile Include="tools\Watch\WatchList.cs" />
<Compile Include="tools\Watch\WatchValueBox.cs"> <Compile Include="tools\Watch\WatchValueBox.cs">
<SubType>Component</SubType> <SubType>Component</SubType>
</Compile> </Compile>
<Compile Include="XmlGame.cs" />
<EmbeddedResource Include="AVOut\FFmpegWriterForm.resx"> <EmbeddedResource Include="AVOut\FFmpegWriterForm.resx">
<DependentUpon>FFmpegWriterForm.cs</DependentUpon> <DependentUpon>FFmpegWriterForm.cs</DependentUpon>
</EmbeddedResource> </EmbeddedResource>
@ -971,6 +981,7 @@
<DesignTimeSharedInput>True</DesignTimeSharedInput> <DesignTimeSharedInput>True</DesignTimeSharedInput>
</Compile> </Compile>
<Compile Include="Properties\svnrev.cs" /> <Compile Include="Properties\svnrev.cs" />
<Compile Include="SavestateManager.cs" />
<Compile Include="Throttle.cs" /> <Compile Include="Throttle.cs" />
<Compile Include="tools\InputPrompt.cs"> <Compile Include="tools\InputPrompt.cs">
<SubType>Form</SubType> <SubType>Form</SubType>
@ -999,10 +1010,6 @@
<Project>{24A0AA3C-B25F-4197-B23D-476D6462DBA0}</Project> <Project>{24A0AA3C-B25F-4197-B23D-476D6462DBA0}</Project>
<Name>BizHawk.Client.Common</Name> <Name>BizHawk.Client.Common</Name>
</ProjectReference> </ProjectReference>
<ProjectReference Include="..\BizHawk.Common\BizHawk.Common.csproj">
<Project>{866F8D13-0678-4FF9-80A4-A3993FD4D8A3}</Project>
<Name>BizHawk.Common</Name>
</ProjectReference>
<ProjectReference Include="..\BizHawk.Emulation\BizHawk.Emulation.csproj"> <ProjectReference Include="..\BizHawk.Emulation\BizHawk.Emulation.csproj">
<Project>{197D4314-8A9F-49BA-977D-54ACEFAEB6BA}</Project> <Project>{197D4314-8A9F-49BA-977D-54ACEFAEB6BA}</Project>
<Name>BizHawk.Emulation</Name> <Name>BizHawk.Emulation</Name>

View File

@ -22,6 +22,11 @@ namespace BizHawk.MultiClient
public static Controller NullControls; public static Controller NullControls;
public static AutofireController AutofireNullControls; public static AutofireController AutofireNullControls;
/// <summary>
/// whether throttling is force-disabled by use of fast forward
/// </summary>
public static bool ForceNoThrottle;
//the movie will be spliced inbetween these if it is present //the movie will be spliced inbetween these if it is present
public static CopyControllerAdapter MovieInputSourceAdapter = new CopyControllerAdapter(); public static CopyControllerAdapter MovieInputSourceAdapter = new CopyControllerAdapter();
public static CopyControllerAdapter MovieOutputHardpoint = new CopyControllerAdapter(); public static CopyControllerAdapter MovieOutputHardpoint = new CopyControllerAdapter();

View File

@ -2,7 +2,9 @@
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq; using System.Linq;
namespace BizHawk.Client.Common using BizHawk.Client.Common;
namespace BizHawk.MultiClient
{ {
public class Controller : IController public class Controller : IController
{ {

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -189,7 +189,7 @@ namespace BizHawk.MultiClient
{ {
ShowConsole(); ShowConsole();
//PsxApi.StdioFixes(); //PsxApi.StdioFixes();
DisplayLogWindowMenuItem.Checked = true; displayLogWindowToolStripMenuItem.Checked = true;
} }
throttle = new Throttle(); throttle = new Throttle();
@ -429,7 +429,7 @@ namespace BizHawk.MultiClient
} }
else else
{ {
DisplayStatusBarMenuItem.Checked = true; displayStatusBarToolStripMenuItem.Checked = true;
} }
if (Global.Config.StartPaused) if (Global.Config.StartPaused)
@ -625,7 +625,7 @@ namespace BizHawk.MultiClient
{ {
bool fastforward = GlobalWinF.ClientControls["Fast Forward"] || FastForward; bool fastforward = GlobalWinF.ClientControls["Fast Forward"] || FastForward;
bool superfastforward = GlobalWinF.ClientControls["Turbo"]; bool superfastforward = GlobalWinF.ClientControls["Turbo"];
Global.ForceNoThrottle = unthrottled || fastforward; GlobalWinF.ForceNoThrottle = unthrottled || fastforward;
// realtime throttle is never going to be so exact that using a double here is wrong // realtime throttle is never going to be so exact that using a double here is wrong
throttle.SetCoreFps(Global.Emulator.CoreComm.VsyncRate); throttle.SetCoreFps(Global.Emulator.CoreComm.VsyncRate);
@ -1228,9 +1228,10 @@ namespace BizHawk.MultiClient
} }
else if (file.Extension.ToLower() == ".xml") else if (file.Extension.ToLower() == ".xml")
{ {
try var XMLG = XmlGame.Create(file);
if (XMLG != null)
{ {
var XMLG = XmlGame.Create(file); // if load fails, are we supposed to retry as a bsnes XML????????
game = XMLG.GI; game = XMLG.GI;
switch (game.System) switch (game.System)
@ -1255,11 +1256,9 @@ namespace BizHawk.MultiClient
default: default:
return false; return false;
} }
} }
catch(Exception ex) // if load fails, are we supposed to retry as a bsnes XML????????
{
System.Windows.Forms.MessageBox.Show(ex.ToString(), "XMLGame Load Error");
}
} }
else // most extensions else // most extensions
{ {
@ -3207,7 +3206,7 @@ namespace BizHawk.MultiClient
//sends an alt+mnemonic combination //sends an alt+mnemonic combination
void SendAltKeyChar(char c) void SendAltKeyChar(char c)
{ {
typeof(ToolStrip).InvokeMember("ProcessMnemonicInternal", System.Reflection.BindingFlags.NonPublic | System.Reflection.BindingFlags.InvokeMethod | System.Reflection.BindingFlags.Instance, null, MainformMenu, new object[] { c }); typeof(ToolStrip).InvokeMember("ProcessMnemonicInternal", System.Reflection.BindingFlags.NonPublic | System.Reflection.BindingFlags.InvokeMethod | System.Reflection.BindingFlags.Instance, null, menuStrip1, new object[] { c });
} }
string FormatFilter(params string[] args) string FormatFilter(params string[] args)
@ -4033,19 +4032,19 @@ namespace BizHawk.MultiClient
private void ShowConsole() private void ShowConsole()
{ {
LogConsole.ShowConsole(); LogConsole.ShowConsole();
LogWindowAsConsoleMenuItem.Enabled = false; logWindowAsConsoleToolStripMenuItem.Enabled = false;
} }
private void HideConsole() private void HideConsole()
{ {
LogConsole.HideConsole(); LogConsole.HideConsole();
LogWindowAsConsoleMenuItem.Enabled = true; logWindowAsConsoleToolStripMenuItem.Enabled = true;
} }
public void notifyLogWindowClosing() public void notifyLogWindowClosing()
{ {
DisplayLogWindowMenuItem.Checked = false; displayLogWindowToolStripMenuItem.Checked = false;
LogWindowAsConsoleMenuItem.Enabled = true; logWindowAsConsoleToolStripMenuItem.Enabled = true;
} }
private void MainForm_Load(object sender, EventArgs e) private void MainForm_Load(object sender, EventArgs e)
@ -4284,6 +4283,16 @@ namespace BizHawk.MultiClient
} }
} }
private void configToolStripMenuItem_DropDownOpened(object sender, EventArgs e)
{
controllersToolStripMenuItem.Enabled = !(Global.Emulator is NullEmulator);
}
private void firmwaresToolStripMenuItem_Click(object sender, EventArgs e)
{
new FirmwaresConfig().Show();
}
private void menuStrip1_Leave(object sender, EventArgs e) private void menuStrip1_Leave(object sender, EventArgs e)
{ {
GlobalWinF.DisplayManager.NeedsToPaint = true; GlobalWinF.DisplayManager.NeedsToPaint = true;
@ -4318,65 +4327,5 @@ namespace BizHawk.MultiClient
{ {
CloseROM(clearSRAM: true); CloseROM(clearSRAM: true);
} }
public void ToggleBackgroundInput()
{
Global.Config.AcceptBackgroundInput ^= true;
if (Global.Config.AcceptBackgroundInput)
{
GlobalWinF.OSD.AddMessage("Background Input enabled");
}
else
{
GlobalWinF.OSD.AddMessage("Background Input disabled");
}
}
public void LimitFrameRateMessage()
{
if (Global.Config.ClockThrottle)
{
GlobalWinF.OSD.AddMessage("Framerate limiting on");
}
else
{
GlobalWinF.OSD.AddMessage("Framerate limiting off");
}
}
public void ClickSpeedItem(int num)
{
if ((ModifierKeys & Keys.Control) != 0) SetSpeedPercentAlternate(num);
else SetSpeedPercent(num);
}
public void VsyncMessage()
{
if (Global.Config.VSyncThrottle)
{
GlobalWinF.OSD.AddMessage("Display Vsync is set to on");
}
else
{
GlobalWinF.OSD.AddMessage("Display Vsync is set to off");
}
}
public void MinimizeFrameskipMessage()
{
if (Global.Config.AutoMinimizeSkipping)
{
GlobalWinF.OSD.AddMessage("Autominimizing set to on");
}
else
{
GlobalWinF.OSD.AddMessage("Autominimizing set to off");
}
}
public void FrameSkipMessage()
{
GlobalWinF.OSD.AddMessage("Frameskipping set to " + Global.Config.FrameSkip.ToString());
}
} }
} }

View File

@ -117,7 +117,7 @@
<resheader name="writer"> <resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value> <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader> </resheader>
<metadata name="MainformMenu.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"> <metadata name="menuStrip1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>17, 17</value> <value>17, 17</value>
</metadata> </metadata>
<assembly alias="System.Drawing" name="System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" /> <assembly alias="System.Drawing" name="System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />

View File

@ -1,4 +1,4 @@
namespace BizHawk.Common namespace BizHawk.MultiClient
{ {
public class MruStack<T> public class MruStack<T>
{ {

View File

@ -392,7 +392,7 @@ namespace BizHawk.MultiClient
{ {
get get
{ {
if (Global.ForceNoThrottle) if (GlobalWinF.ForceNoThrottle)
return false; return false;
return Global.Config.VSyncThrottle || Global.Config.VSync; return Global.Config.VSyncThrottle || Global.Config.VSync;
} }

View File

@ -1,8 +1,10 @@
using System.IO; using System.IO;
namespace BizHawk.Client.Common using BizHawk.Client.Common;
namespace BizHawk.MultiClient
{ {
public class SavestateManager class SavestateManager
{ {
private readonly bool[] slots = new bool[10]; private readonly bool[] slots = new bool[10];
private readonly bool[] redo = new bool[10]; private readonly bool[] redo = new bool[10];
@ -30,9 +32,7 @@ namespace BizHawk.Client.Common
} }
} }
public bool HasSavestateSlots public bool HasSavestateSlots()
{
get
{ {
Update(); Update();
for (int x = 0; x < 10; x++) for (int x = 0; x < 10; x++)
@ -41,7 +41,6 @@ namespace BizHawk.Client.Common
} }
return false; return false;
} }
}
public bool HasSlot(int slot) public bool HasSlot(int slot)
{ {

View File

@ -208,7 +208,7 @@ namespace BizHawk.MultiClient
samplesProvided = 2 * nsampgot; samplesProvided = 2 * nsampgot;
if (!Global.ForceNoThrottle) if (!GlobalWinF.ForceNoThrottle)
while (samplesNeeded < samplesProvided) while (samplesNeeded < samplesProvided)
{ {
System.Threading.Thread.Sleep((samplesProvided - samplesNeeded) / 88); // let audio clock control sleep time System.Threading.Thread.Sleep((samplesProvided - samplesNeeded) / 88); // let audio clock control sleep time

View File

@ -5,7 +5,9 @@ using System.Text;
using System.IO; using System.IO;
using System.Xml; using System.Xml;
namespace BizHawk.Client.Common using BizHawk.Client.Common;
namespace BizHawk.MultiClient
{ {
public class XmlGame public class XmlGame
{ {
@ -94,9 +96,10 @@ namespace BizHawk.Client.Common
} }
return ret; return ret;
} }
catch(Exception ex) catch (Exception e)
{ {
throw new InvalidOperationException(ex.ToString()); System.Windows.Forms.MessageBox.Show(e.ToString(), "XMLGame Load Error");
return null;
} }
} }

View File

@ -3,13 +3,17 @@ using System.Linq;
using System.IO; using System.IO;
using System.Reflection; using System.Reflection;
namespace BizHawk.Client.Common using BizHawk.Client.Common;
namespace BizHawk.MultiClient
{ {
public static class PathManager public static class PathManager
{ {
public static string GetExeDirectoryAbsolute() public static string GetExeDirectoryAbsolute()
{ {
return AppDomain.CurrentDomain.BaseDirectory; var uri = new Uri(Assembly.GetEntryAssembly().GetName().CodeBase);
string module = uri.LocalPath + System.Web.HttpUtility.UrlDecode(uri.Fragment);
return Path.GetDirectoryName(module);
} }
/// <summary> /// <summary>

View File

@ -0,0 +1,40 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace BizHawk.MultiClient.movie
{
public static class MovieConvert
{
public static void ConvertFCM(string path)
{
}
public static void ConvertMMV(string path)
{
}
public static void ConvertMCM(string path)
{
}
public static void ConvertSMV(string path)
{
}
public static void ConvertGMV(string path)
{
}
public static void ConvertVBM(string path)
{
}
}
}

View File

@ -11,55 +11,6 @@ namespace BizHawk.MultiClient
{ {
class ToolHelpers class ToolHelpers
{ {
public static FileInfo GetWatchFileFromUser(string currentFile)
{
var ofd = new OpenFileDialog();
if (!String.IsNullOrWhiteSpace(currentFile))
{
ofd.FileName = Path.GetFileNameWithoutExtension(currentFile);
}
ofd.InitialDirectory = PathManager.MakeAbsolutePath(Global.Config.PathEntries.WatchPath, null);
ofd.Filter = "Watch Files (*.wch)|*.wch|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 GetWatchSaveFileFromUser(string currentFile)
{
var sfd = new SaveFileDialog();
if (!String.IsNullOrWhiteSpace(currentFile))
{
sfd.FileName = Path.GetFileNameWithoutExtension(currentFile);
sfd.InitialDirectory = Path.GetDirectoryName(currentFile);
}
else if (!(Global.Emulator is NullEmulator))
{
sfd.FileName = PathManager.FilesystemSafeName(Global.Game);
sfd.InitialDirectory = PathManager.MakeAbsolutePath(Global.Config.PathEntries.WatchPath, null);
}
else
{
sfd.FileName = "NULL";
sfd.InitialDirectory = PathManager.MakeAbsolutePath(Global.Config.PathEntries.WatchPath, null);
}
sfd.Filter = "Watch Files (*.wch)|*.wch|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);
return file;
}
public static FileInfo GetCheatFileFromUser(string currentFile) public static FileInfo GetCheatFileFromUser(string currentFile)
{ {
var ofd = new OpenFileDialog(); var ofd = new OpenFileDialog();

View File

@ -19,15 +19,19 @@ namespace BizHawk.MultiClient
/// </summary> /// </summary>
public partial class RamSearch : Form public partial class RamSearch : Form
{ {
//TODO: DoSearch grabs the state of widgets and passes it to the engine before running, so rip out code that is attempting to keep the state up to date through change events public const string ADDRESS = "AddressColumn";
public const string VALUE = "ValueColumn";
public const string PREV = "PrevColumn";
public const string CHANGES = "ChangesColumn";
public const string DIFF = "DiffColumn";
private readonly Dictionary<string, int> DefaultColumnWidths = new Dictionary<string, int> private readonly Dictionary<string, int> DefaultColumnWidths = new Dictionary<string, int>
{ {
{ WatchList.ADDRESS, 60 }, { ADDRESS, 60 },
{ WatchList.VALUE, 59 }, { VALUE, 59 },
{ WatchList.PREV, 59 }, { PREV, 59 },
{ WatchList.CHANGES, 55 }, { CHANGES, 55 },
{ WatchList.DIFF, 59 }, { DIFF, 59 },
}; };
private string CurrentFileName = String.Empty; private string CurrentFileName = String.Empty;
@ -170,19 +174,19 @@ namespace BizHawk.MultiClient
string columnName = WatchListView.Columns[column].Name; string columnName = WatchListView.Columns[column].Name;
switch (columnName) switch (columnName)
{ {
case WatchList.ADDRESS: case ADDRESS:
text = Searches[index].AddressString; text = Searches[index].AddressString;
break; break;
case WatchList.VALUE: case VALUE:
text = Searches[index].ValueString; text = Searches[index].ValueString;
break; break;
case WatchList.PREV: case PREV:
text = Searches[index].PreviousStr; text = Searches[index].PreviousStr;
break; break;
case WatchList.CHANGES: case CHANGES:
text = Searches[index].ChangeCount.ToString(); text = Searches[index].ChangeCount.ToString();
break; break;
case WatchList.DIFF: case DIFF:
text = Searches[index].Diff; text = Searches[index].Diff;
break; break;
} }
@ -409,39 +413,10 @@ namespace BizHawk.MultiClient
} }
} }
private RamSearchEngine.ComparisonOperator Operator
{
get
{
if (NotEqualToRadio.Checked) return RamSearchEngine.ComparisonOperator.NotEqual;
else if (LessThanRadio.Checked) return RamSearchEngine.ComparisonOperator.LessThan;
else if (GreaterThanRadio.Checked) return RamSearchEngine.ComparisonOperator.GreaterThan;
else if (LessThanOrEqualToRadio.Checked) return RamSearchEngine.ComparisonOperator.LessThanEqual;
else if (GreaterThanOrEqualToRadio.Checked) return RamSearchEngine.ComparisonOperator.GreaterThanEqual;
else if (DifferentByRadio.Checked) return RamSearchEngine.ComparisonOperator.DifferentBy;
else return RamSearchEngine.ComparisonOperator.Equal;
}
}
private RamSearchEngine.Compare Compare
{
get
{
if (SpecificValueRadio.Checked) return RamSearchEngine.Compare.SpecificValue;
else if (SpecificAddressRadio.Checked) return RamSearchEngine.Compare.SpecificAddress;
else if (NumberOfChangesRadio.Checked) return RamSearchEngine.Compare.Changes;
else if (DifferenceRadio.Checked) return RamSearchEngine.Compare.Difference;
else return RamSearchEngine.Compare.Previous;
}
}
public void DoSearch() public void DoSearch()
{ {
Searches.CompareValue = CompareToValue; Searches.CompareValue = CompareToValue;
Searches.DifferentBy = DifferentByValue; Searches.DifferentBy = DifferentByValue;
Searches.Operator = Operator;
Searches.CompareTo = Compare;
int removed = Searches.DoSearch(); int removed = Searches.DoSearch();
SetTotal(); SetTotal();
WatchListView.ItemCount = Searches.Count; WatchListView.ItemCount = Searches.Count;
@ -540,11 +515,11 @@ namespace BizHawk.MultiClient
private void LoadColumnInfo() private void LoadColumnInfo()
{ {
WatchListView.Columns.Clear(); WatchListView.Columns.Clear();
ToolHelpers.AddColumn(WatchListView, WatchList.ADDRESS, true, GetColumnWidth(WatchList.ADDRESS)); ToolHelpers.AddColumn(WatchListView, ADDRESS, true, GetColumnWidth(ADDRESS));
ToolHelpers.AddColumn(WatchListView, WatchList.VALUE, true, GetColumnWidth(WatchList.VALUE)); ToolHelpers.AddColumn(WatchListView, VALUE, true, GetColumnWidth(VALUE));
ToolHelpers.AddColumn(WatchListView, WatchList.PREV, Global.Config.RamSearchShowPrevColumn, GetColumnWidth(WatchList.PREV)); ToolHelpers.AddColumn(WatchListView, PREV, Global.Config.RamSearchShowPrevColumn, GetColumnWidth(PREV));
ToolHelpers.AddColumn(WatchListView, WatchList.CHANGES, Global.Config.RamSearchShowChangeColumn, GetColumnWidth(WatchList.CHANGES)); ToolHelpers.AddColumn(WatchListView, CHANGES, Global.Config.RamSearchShowChangeColumn, GetColumnWidth(CHANGES));
ToolHelpers.AddColumn(WatchListView, WatchList.DIFF, Global.Config.RamSearchShowDiffColumn, GetColumnWidth(WatchList.DIFF)); ToolHelpers.AddColumn(WatchListView, DIFF, Global.Config.RamSearchShowDiffColumn, GetColumnWidth(DIFF));
ColumnPositions(); ColumnPositions();
} }
@ -567,34 +542,34 @@ namespace BizHawk.MultiClient
private void SaveColumnInfo() private void SaveColumnInfo()
{ {
if (WatchListView.Columns[WatchList.ADDRESS] != null) if (WatchListView.Columns[ADDRESS] != null)
{ {
Global.Config.RamSearchColumnIndexes[WatchList.ADDRESS] = WatchListView.Columns[WatchList.ADDRESS].DisplayIndex; Global.Config.RamSearchColumnIndexes[ADDRESS] = WatchListView.Columns[ADDRESS].DisplayIndex;
Global.Config.RamSearchColumnWidths[WatchList.ADDRESS] = WatchListView.Columns[WatchList.ADDRESS].Width; Global.Config.RamSearchColumnWidths[ADDRESS] = WatchListView.Columns[ADDRESS].Width;
} }
if (WatchListView.Columns[WatchList.VALUE] != null) if (WatchListView.Columns[VALUE] != null)
{ {
Global.Config.RamSearchColumnIndexes[WatchList.VALUE] = WatchListView.Columns[WatchList.VALUE].DisplayIndex; Global.Config.RamSearchColumnIndexes[VALUE] = WatchListView.Columns[VALUE].DisplayIndex;
Global.Config.RamSearchColumnWidths[WatchList.VALUE] = WatchListView.Columns[WatchList.VALUE].Width; Global.Config.RamSearchColumnWidths[VALUE] = WatchListView.Columns[VALUE].Width;
} }
if (WatchListView.Columns[WatchList.PREV] != null) if (WatchListView.Columns[PREV] != null)
{ {
Global.Config.RamSearchColumnIndexes[WatchList.PREV] = WatchListView.Columns[WatchList.PREV].DisplayIndex; Global.Config.RamSearchColumnIndexes[PREV] = WatchListView.Columns[PREV].DisplayIndex;
Global.Config.RamSearchColumnWidths[WatchList.PREV] = WatchListView.Columns[WatchList.PREV].Width; Global.Config.RamSearchColumnWidths[PREV] = WatchListView.Columns[PREV].Width;
} }
if (WatchListView.Columns[WatchList.CHANGES] != null) if (WatchListView.Columns[CHANGES] != null)
{ {
Global.Config.RamSearchColumnIndexes[WatchList.CHANGES] = WatchListView.Columns[WatchList.CHANGES].DisplayIndex; Global.Config.RamSearchColumnIndexes[CHANGES] = WatchListView.Columns[CHANGES].DisplayIndex;
Global.Config.RamSearchColumnWidths[WatchList.CHANGES] = WatchListView.Columns[WatchList.CHANGES].Width; Global.Config.RamSearchColumnWidths[CHANGES] = WatchListView.Columns[CHANGES].Width;
} }
if (WatchListView.Columns[WatchList.DIFF] != null) if (WatchListView.Columns[DIFF] != null)
{ {
Global.Config.RamSearchColumnIndexes[WatchList.DIFF] = WatchListView.Columns[WatchList.DIFF].DisplayIndex; Global.Config.RamSearchColumnIndexes[DIFF] = WatchListView.Columns[DIFF].DisplayIndex;
Global.Config.RamSearchColumnWidths[WatchList.DIFF] = WatchListView.Columns[WatchList.DIFF].Width; Global.Config.RamSearchColumnWidths[DIFF] = WatchListView.Columns[DIFF].Width;
} }
} }
@ -725,7 +700,7 @@ namespace BizHawk.MultiClient
DifferenceRadio.Enabled = true; DifferenceRadio.Enabled = true;
DifferentByBox.Enabled = true; DifferentByBox.Enabled = true;
ClearChangeCountsToolBarItem.Enabled = true; ClearChangeCountsToolBarItem.Enabled = true;
WatchListView.Columns[WatchList.CHANGES].Width = Global.Config.RamSearchColumnWidths[WatchList.CHANGES]; WatchListView.Columns[CHANGES].Width = Global.Config.RamSearchColumnWidths[CHANGES];
SetReboot(true); SetReboot(true);
} }
@ -748,8 +723,8 @@ namespace BizHawk.MultiClient
PreviousValueRadio.Checked = true; PreviousValueRadio.Checked = true;
} }
Global.Config.RamSearchColumnWidths[WatchList.CHANGES] = WatchListView.Columns[WatchList.CHANGES].Width; Global.Config.RamSearchColumnWidths[CHANGES] = WatchListView.Columns[CHANGES].Width;
WatchListView.Columns[WatchList.CHANGES].Width = 0; WatchListView.Columns[CHANGES].Width = 0;
SetReboot(true); SetReboot(true);
} }
@ -871,15 +846,15 @@ namespace BizHawk.MultiClient
{ {
default: default:
return String.Empty; return String.Empty;
case WatchList.ADDRESS: case ADDRESS:
return Searches[index].AddressString; return Searches[index].AddressString;
case WatchList.VALUE: case VALUE:
return Searches[index].ValueString; return Searches[index].ValueString;
case WatchList.PREV: case PREV:
return Searches[index].PreviousStr; return Searches[index].PreviousStr;
case WatchList.CHANGES: case CHANGES:
return Searches[index].ChangeCount.ToString(); return Searches[index].ChangeCount.ToString();
case WatchList.DIFF: case DIFF:
return Searches[index].Diff; return Searches[index].Diff;
} }
} }
@ -936,7 +911,7 @@ namespace BizHawk.MultiClient
private void OpenMenuItem_Click(object sender, EventArgs e) private void OpenMenuItem_Click(object sender, EventArgs e)
{ {
LoadWatchFile( LoadWatchFile(
ToolHelpers.GetWatchFileFromUser(String.Empty), WatchList.GetFileFromUser(String.Empty),
sender == AppendFileMenuItem, sender == AppendFileMenuItem,
sender == TruncateFromFileMenuItem sender == TruncateFromFileMenuItem
); );
@ -953,24 +928,12 @@ namespace BizHawk.MultiClient
watches.Add(Searches[i]); watches.Add(Searches[i]);
} }
if (!String.IsNullOrWhiteSpace(watches.CurrentFileName))
{
if (watches.Save()) if (watches.Save())
{ {
CurrentFileName = watches.CurrentFileName; CurrentFileName = watches.CurrentFileName;
MessageLabel.Text = Path.GetFileName(CurrentFileName) + " saved"; MessageLabel.Text = Path.GetFileName(CurrentFileName) + " saved";
} }
} }
else
{
bool result = watches.SaveAs(ToolHelpers.GetWatchSaveFileFromUser(watches.CurrentFileName));
if (result)
{
MessageLabel.Text = Path.GetFileName(CurrentFileName) + " saved";
Global.Config.RecentWatches.Add(watches.CurrentFileName);
}
}
}
} }
private void SaveAsMenuItem_Click(object sender, EventArgs e) private void SaveAsMenuItem_Click(object sender, EventArgs e)
@ -982,7 +945,7 @@ namespace BizHawk.MultiClient
watches.Add(Searches[i]); watches.Add(Searches[i]);
} }
if (watches.SaveAs(ToolHelpers.GetWatchSaveFileFromUser(watches.CurrentFileName))) if (watches.SaveAs())
{ {
CurrentFileName = watches.CurrentFileName; CurrentFileName = watches.CurrentFileName;
MessageLabel.Text = Path.GetFileName(CurrentFileName) + " saved"; MessageLabel.Text = Path.GetFileName(CurrentFileName) + " saved";
@ -1160,10 +1123,6 @@ namespace BizHawk.MultiClient
if (Searches.CanUndo) if (Searches.CanUndo)
{ {
Searches.Undo(); Searches.Undo();
SetTotal();
WatchListView.ItemCount = Searches.Count;
ToggleSearchDependentToolBarItems();
forcePreviewClear = true;
UpdateUndoToolBarButtons(); UpdateUndoToolBarButtons();
} }
} }
@ -1173,10 +1132,6 @@ namespace BizHawk.MultiClient
if (Searches.CanRedo) if (Searches.CanRedo)
{ {
Searches.Redo(); Searches.Redo();
SetTotal();
WatchListView.ItemCount = Searches.Count;
ToggleSearchDependentToolBarItems();
forcePreviewClear = true;
UpdateUndoToolBarButtons(); UpdateUndoToolBarButtons();
} }
} }
@ -1319,11 +1274,11 @@ namespace BizHawk.MultiClient
Global.Config.RamSearchShowPrevColumn = true; Global.Config.RamSearchShowPrevColumn = true;
Global.Config.RamSearchShowDiffColumn = false; Global.Config.RamSearchShowDiffColumn = false;
WatchListView.Columns[WatchList.ADDRESS].Width = DefaultColumnWidths[WatchList.ADDRESS]; WatchListView.Columns[ADDRESS].Width = DefaultColumnWidths[ADDRESS];
WatchListView.Columns[WatchList.VALUE].Width = DefaultColumnWidths[WatchList.VALUE]; WatchListView.Columns[VALUE].Width = DefaultColumnWidths[VALUE];
//WatchListView.Columns[WatchList.PREV].Width = DefaultColumnWidths[WatchList.PREV]; //WatchListView.Columns[PREV].Width = DefaultColumnWidths[PREV];
WatchListView.Columns[WatchList.CHANGES].Width = DefaultColumnWidths[WatchList.CHANGES]; WatchListView.Columns[CHANGES].Width = DefaultColumnWidths[CHANGES];
//WatchListView.Columns[WatchList.DIFF].Width = DefaultColumnWidths[WatchList.DIFF]; //WatchListView.Columns[DIFF].Width = DefaultColumnWidths[DIFF];
Global.Config.RamSearchSaveWindowPosition = true; Global.Config.RamSearchSaveWindowPosition = true;
Global.Config.RamSearchAlwaysOnTop = TopMost = false; Global.Config.RamSearchAlwaysOnTop = TopMost = false;
@ -1676,11 +1631,11 @@ namespace BizHawk.MultiClient
private void WatchListView_ColumnReordered(object sender, ColumnReorderedEventArgs e) private void WatchListView_ColumnReordered(object sender, ColumnReorderedEventArgs e)
{ {
Global.Config.RamSearchColumnIndexes[WatchList.ADDRESS] = WatchListView.Columns[WatchList.ADDRESS].DisplayIndex; Global.Config.RamSearchColumnIndexes[ADDRESS] = WatchListView.Columns[ADDRESS].DisplayIndex;
Global.Config.RamSearchColumnIndexes[WatchList.VALUE] = WatchListView.Columns[WatchList.VALUE].DisplayIndex; Global.Config.RamSearchColumnIndexes[VALUE] = WatchListView.Columns[VALUE].DisplayIndex;
Global.Config.RamSearchColumnIndexes[WatchList.PREV] = WatchListView.Columns[WatchList.ADDRESS].DisplayIndex; Global.Config.RamSearchColumnIndexes[PREV] = WatchListView.Columns[ADDRESS].DisplayIndex;
Global.Config.RamSearchColumnIndexes[WatchList.CHANGES] = WatchListView.Columns[WatchList.CHANGES].DisplayIndex; Global.Config.RamSearchColumnIndexes[CHANGES] = WatchListView.Columns[CHANGES].DisplayIndex;
Global.Config.RamSearchColumnIndexes[WatchList.DIFF] = WatchListView.Columns[WatchList.DIFF].DisplayIndex; Global.Config.RamSearchColumnIndexes[DIFF] = WatchListView.Columns[DIFF].DisplayIndex;
} }
private void WatchListView_Enter(object sender, EventArgs e) private void WatchListView_Enter(object sender, EventArgs e)

View File

@ -6,9 +6,9 @@ using System.Linq;
using System.Text; using System.Text;
using System.Threading.Tasks; using System.Threading.Tasks;
using BizHawk.Common; using BizHawk.Client.Common;
namespace BizHawk.Client.Common namespace BizHawk.MultiClient
{ {
//TODO: move me //TODO: move me
//http://stackoverflow.com/questions/1766328/can-linq-use-binary-search-when-the-collection-is-ordered //http://stackoverflow.com/questions/1766328/can-linq-use-binary-search-when-the-collection-is-ordered
@ -49,6 +49,8 @@ namespace BizHawk.Client.Common
public class RamSearchEngine public class RamSearchEngine
{ {
public enum ComparisonOperator { Equal, GreaterThan, GreaterThanEqual, LessThan, LessThanEqual, NotEqual, DifferentBy }; public enum ComparisonOperator { Equal, GreaterThan, GreaterThanEqual, LessThan, LessThanEqual, NotEqual, DifferentBy };
public enum Compare { Previous, SpecificValue, SpecificAddress, Changes, Difference } public enum Compare { Previous, SpecificValue, SpecificAddress, Changes, Difference }
@ -59,7 +61,7 @@ namespace BizHawk.Client.Common
private List<IMiniWatch> _watchList = new List<IMiniWatch>(); private List<IMiniWatch> _watchList = new List<IMiniWatch>();
private Settings _settings = new Settings(); private Settings _settings = new Settings();
private UndoHistory<IMiniWatch> _history = new UndoHistory<IMiniWatch>(true); private WatchHistory _history = new WatchHistory(true);
private bool _keepHistory = true; private bool _keepHistory = true;
public RamSearchEngine(Settings settings) public RamSearchEngine(Settings settings)
@ -406,7 +408,7 @@ namespace BizHawk.Client.Common
{ {
switch(column) switch(column)
{ {
case WatchList.ADDRESS: case RamSearch.ADDRESS:
if (reverse) if (reverse)
{ {
_watchList = _watchList.OrderByDescending(x => x.Address).ToList(); _watchList = _watchList.OrderByDescending(x => x.Address).ToList();
@ -416,7 +418,7 @@ namespace BizHawk.Client.Common
_watchList = _watchList.OrderBy(x => x.Address).ToList(); _watchList = _watchList.OrderBy(x => x.Address).ToList();
} }
break; break;
case WatchList.VALUE: case RamSearch.VALUE:
if (reverse) if (reverse)
{ {
_watchList = _watchList.OrderByDescending(x => GetValue(x.Address)).ToList(); _watchList = _watchList.OrderByDescending(x => GetValue(x.Address)).ToList();
@ -426,7 +428,7 @@ namespace BizHawk.Client.Common
_watchList = _watchList.OrderBy(x => GetValue(x.Address)).ToList(); _watchList = _watchList.OrderBy(x => GetValue(x.Address)).ToList();
} }
break; break;
case WatchList.PREV: case RamSearch.PREV:
if (reverse) if (reverse)
{ {
_watchList = _watchList.OrderByDescending(x => x.Previous).ToList(); _watchList = _watchList.OrderByDescending(x => x.Previous).ToList();
@ -436,7 +438,7 @@ namespace BizHawk.Client.Common
_watchList = _watchList.OrderBy(x => x.Previous).ToList(); _watchList = _watchList.OrderBy(x => x.Previous).ToList();
} }
break; break;
case WatchList.CHANGES: case RamSearch.CHANGES:
if (_settings.Mode == Settings.SearchMode.Detailed) if (_settings.Mode == Settings.SearchMode.Detailed)
{ {
if (reverse) if (reverse)
@ -455,7 +457,7 @@ namespace BizHawk.Client.Common
} }
} }
break; break;
case WatchList.DIFF: case RamSearch.DIFF:
if (reverse) if (reverse)
{ {
_watchList = _watchList.OrderByDescending(x => (GetValue(x.Address) - x.Previous)).ToList(); _watchList = _watchList.OrderByDescending(x => (GetValue(x.Address) - x.Previous)).ToList();
@ -497,7 +499,7 @@ namespace BizHawk.Client.Common
{ {
if (_keepHistory) if (_keepHistory)
{ {
_watchList = _history.Undo().ToList(); _watchList = _history.Undo();
} }
} }
@ -505,7 +507,7 @@ namespace BizHawk.Client.Common
{ {
if (_keepHistory) if (_keepHistory)
{ {
_watchList = _history.Redo().ToList(); _watchList = _history.Redo();
} }
} }

View File

@ -737,16 +737,6 @@ namespace BizHawk.MultiClient
WatchListView.Refresh(); WatchListView.Refresh();
} }
private void SaveAs()
{
bool result = Watches.SaveAs(ToolHelpers.GetWatchSaveFileFromUser(Watches.CurrentFileName));
if (result)
{
UpdateMessageLabel(saved: true);
Global.Config.RecentWatches.Add(Watches.CurrentFileName);
}
}
#region Winform Events #region Winform Events
private void NewRamWatch_Load(object sender, EventArgs e) private void NewRamWatch_Load(object sender, EventArgs e)
@ -793,27 +783,25 @@ namespace BizHawk.MultiClient
private void openToolStripMenuItem_Click(object sender, EventArgs e) private void openToolStripMenuItem_Click(object sender, EventArgs e)
{ {
bool append = sender == appendFileToolStripMenuItem; bool append = sender == appendFileToolStripMenuItem;
LoadWatchFile(ToolHelpers.GetWatchFileFromUser(Watches.CurrentFileName), append); LoadWatchFile(WatchList.GetFileFromUser(Watches.CurrentFileName), append);
} }
private void saveToolStripMenuItem_Click(object sender, EventArgs e) private void saveToolStripMenuItem_Click(object sender, EventArgs e)
{
if (!String.IsNullOrWhiteSpace(Watches.CurrentFileName))
{ {
if (Watches.Save()) if (Watches.Save())
{ {
UpdateMessageLabel(saved: true); UpdateMessageLabel(saved: true);
} }
} }
else
{
SaveAs();
}
}
private void saveAsToolStripMenuItem_Click(object sender, EventArgs e) private void saveAsToolStripMenuItem_Click(object sender, EventArgs e)
{ {
SaveAs(); bool result = Watches.SaveAs();
if (result)
{
UpdateMessageLabel(saved: true);
Global.Config.RecentWatches.Add(Watches.CurrentFileName);
}
} }
private void recentToolStripMenuItem_DropDownOpened(object sender, EventArgs e) private void recentToolStripMenuItem_DropDownOpened(object sender, EventArgs e)

View File

@ -1,21 +1,20 @@
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq; using System.Linq;
namespace BizHawk.Common namespace BizHawk.MultiClient
{ {
public class UndoHistory<T> public class WatchHistory
{ {
private List<List<T>> _history = new List<List<T>>(); private List<List<RamSearchEngine.IMiniWatch>> _history = new List<List<RamSearchEngine.IMiniWatch>>();
private int curPos; //1-based private int curPos; //1-based
public bool Enabled { get; private set; } public bool Enabled { get; private set; }
public UndoHistory(bool enabled) public WatchHistory(bool enabled)
{ {
Enabled = enabled; Enabled = enabled;
} }
public UndoHistory(IEnumerable<T> newState, bool enabled) public WatchHistory(List<RamSearchEngine.IMiniWatch> newState, bool enabled)
{ {
AddState(newState); AddState(newState);
Enabled = enabled; Enabled = enabled;
@ -23,7 +22,7 @@ namespace BizHawk.Common
public void Clear() public void Clear()
{ {
_history = new List<List<T>>(); _history = new List<List<RamSearchEngine.IMiniWatch>>();
curPos = 0; curPos = 0;
} }
@ -42,7 +41,7 @@ namespace BizHawk.Common
get { return Enabled && _history.Any(); } get { return Enabled && _history.Any(); }
} }
public void AddState(IEnumerable<T> newState) public void AddState(List<RamSearchEngine.IMiniWatch> newState)
{ {
if (Enabled) if (Enabled)
{ {
@ -54,12 +53,12 @@ namespace BizHawk.Common
} }
} }
_history.Add(newState.ToList()); _history.Add(newState);
curPos = _history.Count; curPos = _history.Count;
} }
} }
public IEnumerable<T> Undo() public List<RamSearchEngine.IMiniWatch> Undo()
{ {
if (CanUndo && Enabled) if (CanUndo && Enabled)
{ {
@ -72,7 +71,7 @@ namespace BizHawk.Common
} }
} }
public IEnumerable<T> Redo() public List<RamSearchEngine.IMiniWatch> Redo()
{ {
if (CanRedo && Enabled) if (CanRedo && Enabled)
{ {

View File

@ -4,11 +4,16 @@ using System.Globalization;
using System.IO; using System.IO;
using System.Linq; using System.Linq;
using System.Text; using System.Text;
using System.Windows.Forms;
namespace BizHawk.Client.Common using BizHawk.Client.Common;
namespace BizHawk.MultiClient
{ {
public class WatchList : IEnumerable<Watch> public class WatchList : IEnumerable<Watch>
{ {
public const string ADDRESS = "AddressColumn"; public const string ADDRESS = "AddressColumn";
public const string VALUE = "ValueColumn"; public const string VALUE = "ValueColumn";
public const string PREV = "PrevColumn"; public const string PREV = "PrevColumn";
@ -292,6 +297,26 @@ namespace BizHawk.Client.Common
public string CurrentFileName { get { return _currentFilename; } set { _currentFilename = value; } } public string CurrentFileName { get { return _currentFilename; } set { _currentFilename = value; } }
public bool Changes { get; set; } public bool Changes { get; set; }
public bool Save()
{
bool result;
if (!String.IsNullOrWhiteSpace(CurrentFileName))
{
result = SaveFile();
}
else
{
result = SaveAs();
}
if (result)
{
Changes = false;
}
return result;
}
public bool Load(string path, bool append) public bool Load(string path, bool append)
{ {
bool result = LoadFile(path, append); bool result = LoadFile(path, append);
@ -321,7 +346,7 @@ namespace BizHawk.Client.Common
} }
} }
public bool Save() private bool SaveFile()
{ {
if (String.IsNullOrWhiteSpace(CurrentFileName)) if (String.IsNullOrWhiteSpace(CurrentFileName))
{ {
@ -355,12 +380,13 @@ namespace BizHawk.Client.Common
return true; return true;
} }
public bool SaveAs(FileInfo file) public bool SaveAs()
{ {
var file = GetSaveFileFromUser(CurrentFileName);
if (file != null) if (file != null)
{ {
CurrentFileName = file.FullName; CurrentFileName = file.FullName;
return Save(); return SaveFile();
} }
else else
{ {
@ -520,6 +546,53 @@ namespace BizHawk.Client.Common
return 0; return 0;
} }
public static FileInfo GetFileFromUser(string currentFile)
{
var ofd = new OpenFileDialog();
if (currentFile.Length > 0)
ofd.FileName = Path.GetFileNameWithoutExtension(currentFile);
ofd.InitialDirectory = PathManager.MakeAbsolutePath(Global.Config.PathEntries.WatchPath, null);
ofd.Filter = "Watch Files (*.wch)|*.wch|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 GetSaveFileFromUser(string currentFile)
{
var sfd = new SaveFileDialog();
if (currentFile.Length > 0)
{
sfd.FileName = Path.GetFileNameWithoutExtension(currentFile);
sfd.InitialDirectory = Path.GetDirectoryName(currentFile);
}
else if (!(Global.Emulator is NullEmulator))
{
sfd.FileName = PathManager.FilesystemSafeName(Global.Game);
sfd.InitialDirectory = PathManager.MakeAbsolutePath(Global.Config.PathEntries.WatchPath, null);
}
else
{
sfd.FileName = "NULL";
sfd.InitialDirectory = PathManager.MakeAbsolutePath(Global.Config.PathEntries.WatchPath, null);
}
sfd.Filter = "Watch Files (*.wch)|*.wch|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);
return file;
}
#endregion #endregion
} }
} }

View File

@ -11,8 +11,6 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "BizHawk.PCE_Debugger", "Biz
EndProject EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "BizHawk.Client.Common", "BizHawk.Client.Common\BizHawk.Client.Common.csproj", "{24A0AA3C-B25F-4197-B23D-476D6462DBA0}" Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "BizHawk.Client.Common", "BizHawk.Client.Common\BizHawk.Client.Common.csproj", "{24A0AA3C-B25F-4197-B23D-476D6462DBA0}"
EndProject EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "BizHawk.Common", "BizHawk.Common\BizHawk.Common.csproj", "{866F8D13-0678-4FF9-80A4-A3993FD4D8A3}"
EndProject
Global Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU Debug|Any CPU = Debug|Any CPU
@ -91,18 +89,6 @@ Global
{24A0AA3C-B25F-4197-B23D-476D6462DBA0}.Release|Mixed Platforms.Build.0 = Release|Any CPU {24A0AA3C-B25F-4197-B23D-476D6462DBA0}.Release|Mixed Platforms.Build.0 = Release|Any CPU
{24A0AA3C-B25F-4197-B23D-476D6462DBA0}.Release|Win32.ActiveCfg = Release|Any CPU {24A0AA3C-B25F-4197-B23D-476D6462DBA0}.Release|Win32.ActiveCfg = Release|Any CPU
{24A0AA3C-B25F-4197-B23D-476D6462DBA0}.Release|x86.ActiveCfg = Release|Any CPU {24A0AA3C-B25F-4197-B23D-476D6462DBA0}.Release|x86.ActiveCfg = Release|Any CPU
{866F8D13-0678-4FF9-80A4-A3993FD4D8A3}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{866F8D13-0678-4FF9-80A4-A3993FD4D8A3}.Debug|Any CPU.Build.0 = Debug|Any CPU
{866F8D13-0678-4FF9-80A4-A3993FD4D8A3}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU
{866F8D13-0678-4FF9-80A4-A3993FD4D8A3}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU
{866F8D13-0678-4FF9-80A4-A3993FD4D8A3}.Debug|Win32.ActiveCfg = Debug|Any CPU
{866F8D13-0678-4FF9-80A4-A3993FD4D8A3}.Debug|x86.ActiveCfg = Debug|Any CPU
{866F8D13-0678-4FF9-80A4-A3993FD4D8A3}.Release|Any CPU.ActiveCfg = Release|Any CPU
{866F8D13-0678-4FF9-80A4-A3993FD4D8A3}.Release|Any CPU.Build.0 = Release|Any CPU
{866F8D13-0678-4FF9-80A4-A3993FD4D8A3}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU
{866F8D13-0678-4FF9-80A4-A3993FD4D8A3}.Release|Mixed Platforms.Build.0 = Release|Any CPU
{866F8D13-0678-4FF9-80A4-A3993FD4D8A3}.Release|Win32.ActiveCfg = Release|Any CPU
{866F8D13-0678-4FF9-80A4-A3993FD4D8A3}.Release|x86.ActiveCfg = Release|Any CPU
EndGlobalSection EndGlobalSection
GlobalSection(SolutionProperties) = preSolution GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE HideSolutionNode = FALSE