Merge branch 'master' into master

This commit is contained in:
Trivial-Man 2017-06-25 18:45:41 -06:00 committed by GitHub
commit d3834fff49
2263 changed files with 202731 additions and 484053 deletions

2
.gitignore vendored
View File

@ -71,3 +71,5 @@ ExternalCoreProjects/Virtu/bin/*.*
**/StyleCop.Cache
libsnes/vs2015/libsnes.VC.db
waterbox/**/*.wbx
waterbox/**/*.wbx.in

4
.gitmodules vendored
View File

@ -7,3 +7,7 @@
[submodule "libmupen64plus/mupen64plus-rsp-cxd4"]
path = libmupen64plus/mupen64plus-rsp-cxd4
url = https://github.com/TASVideos/mupen64plus-rsp-cxd4.git
[submodule "waterbox/snes9x"]
path = waterbox/snes9x
url = https://github.com/TASVideos/snes9x.git
branch = bizsnes

View File

@ -508,19 +508,110 @@
"P1 C": "Z, J1 B4, X1 Y",
"P1 L": "Q, J1 B5, X1 LeftShoulder",
"P1 R": "W, J1 B6, X1 RightShoulder",
"P2 Up": "",
"P2 Down": "",
"P2 Left": "",
"P2 Right": "",
"P2 Start": "",
"P2 Z": "",
"P2 Y": "",
"P2 X": "",
"P2 C": "",
"P2 B": "",
"P2 A": "",
"P2 L": "",
"P2 R": ""
"P1 Mouse Left": "WMouse L",
"P1 Mouse Center": "WMouse M",
"P1 Mouse Right": "WMouse R",
"P1 Escape": "Escape",
"P1 F1": "F1",
"P1 F2": "F2",
"P1 F3": "F3",
"P1 F4": "F4",
"P1 F5": "F5",
"P1 F6": "F6",
"P1 F7": "F7",
"P1 F8": "F8",
"P1 F9": "F9",
"P1 F10": "F10",
"P1 F11": "F11",
"P1 F12": "F12",
"P1 Grave`": "Grave",
"P1 1(One)": "D1",
"P1 2": "D2",
"P1 3": "D3",
"P1 4": "D4",
"P1 5": "D5",
"P1 6": "D6",
"P1 7": "D7",
"P1 8": "D8",
"P1 9": "D9",
"P1 0(Zero)": "D0",
"P1 Minus-": "Minus",
"P1 Equals=": "Equals",
"P1 Backslash\\": "Backslash",
"P1 Backspace": "Backspace",
"P1 Tab": "Tab",
"P1 Q": "Q",
"P1 W": "W",
"P1 E": "E",
"P1 R(Key)": "R",
"P1 T": "T",
"P1 Y(Key)": "Y",
"P1 U": "U",
"P1 I": "I",
"P1 O": "O",
"P1 P": "P",
"P1 LeftBracket[": "LeftBracket",
"P1 RightBracket]": "RightBracket",
"P1 Enter": "Return",
"P1 CapsLock": "CapsLock",
"P1 A(Key)": "A",
"P1 S": "S",
"P1 D": "D",
"P1 F": "F",
"P1 G": "G",
"P1 H": "H",
"P1 J": "J",
"P1 K": "K",
"P1 L(Key)": "L",
"P1 Semicolon;": "Semicolon",
"P1 Quote'": "Apostrophe",
"P1 LeftShift": "LeftShift",
"P1 Z(Key)": "Z",
"P1 X(Key)": "X",
"P1 C(Key)": "C",
"P1 V": "V",
"P1 B(Key)": "B",
"P1 N": "N",
"P1 M": "M",
"P1 Comma,": "Comma",
"P1 Period.": "Period",
"P1 Slash/": "Slash",
"P1 RightShift": "RightShift",
"P1 LeftCtrl": "LeftControl",
"P1 LeftAlt": "LeftAlt",
"P1 Space": "Space",
"P1 RightAlt": "RightAlt",
"P1 RightCtrl": "RightControl",
"P1 PrintScreen": "",
"P1 ScrollLock": "ScrollLock",
"P1 Pause": "Pause",
"P1 Insert": "Insert",
"P1 Delete": "Delete",
"P1 Home": "Home",
"P1 End": "End",
"P1 PageUp": "PageUp",
"P1 PageDown": "PageDown",
"P1 Up": "UpArrow",
"P1 Down": "DownArrow",
"P1 CursorLeft": "LeftArrow",
"P1 Right": "RightArrow",
"P1 NumLock": "NumberLock",
"P1 KeypadSlash(Divide)": "NumberPadSlash",
"P1 KeypadAsterisk(Multiply)": "NumberPadStar",
"P1 KeypadMinus": "NumberPadMinus",
"P1 KeypadHome/7": "NumberPad7",
"P1 KeypadUp/8": "NumberPad8",
"P1 KeypadPageup/9": "NumberPad9",
"P1 KeypadPlus": "NumberPadPlus",
"P1 KeypadLeft/4": "NumberPad4",
"P1 KeypadCenter/5": "NumberPad5",
"P1 KeypadRight/6": "NumberPad6",
"P1 KeypadEnd/1": "NumberPad1",
"P1 KeypadDown/2": "NumberPad2",
"P1 KeypadPagedown/3": "NumberPad3",
"P1 KeypadEnter": "NumberPadEnter",
"P1 KeypadInsert/0": "NumberPad0",
"P1 KeypadDelete": "NumberPadPeriod"
},
"PC Engine Controller": {
"Reset": "",
@ -854,6 +945,33 @@
"Caps Lock": "CapsLock",
"Previous Disk": "",
"Next Disk": ""
},
"VirtualBoy Controller": {
"L_Up": "UpArrow, X1 DpadUp, X1 LStickUp",
"L_Down": "DownArrow, X1 DpadDown, X1 LStickDown",
"L_Left": "LeftArrow, X1 DpadLeft, X1 LStickLeft",
"L_Right": "RightArrow, X1 DpadRight, X1 LStickRight",
"R_Up": "NumberPad8, X1 RStickUp",
"R_Down": "NumberPad2, X1 RStickDown",
"R_Left": "NumberPad4, X1 RStickLeft",
"R_Right": "NumberPad6, X1 RStickRight",
"B": "Z, X1 X",
"A": "X, X1 A",
"R": "W, X1 LeftShoulder",
"L": "E, X1 RightShoulder",
"Select": "Space, X1 Back",
"Start": "Return, X1 Start",
"Power": ""
},
"NeoGeo Portable Controller": {
"Up": "UpArrow, X1 DpadUp, X1 LStickUp",
"Down": "DownArrow, X1 DpadDown, X1 LStickDown",
"Left": "LeftArrow, X1 DpadLeft, X1 LStickLeft",
"Right": "RightArrow, X1 DpadRight, X1 LStickRight",
"B": "Z, J1 B1, X1 X",
"A": "X, J1 B2, X1 A",
"Option": "Return, J1 B10, X1 Start",
"Power": ""
}
},
"AllTrollersAutoFire": {
@ -1100,6 +1218,33 @@
"Caps Lock": "",
"Previous Disk": "",
"Next Disk": ""
},
"VirtualBoy Controller": {
"L_Up": "",
"L_Down": "",
"L_Left": "",
"L_Right": "",
"R_Up": "",
"R_Down": "",
"R_Left": "",
"R_Right": "",
"B": "",
"A": "",
"R": "",
"L": "",
"Select": "",
"Start": "",
"Power": ""
},
"NeoGeo Portable Controller": {
"Up": "",
"Down": "",
"Left": "",
"Right": "",
"B": "",
"A": "",
"Option": "",
"Power": ""
}
},
"AllTrollersAnalog": {
@ -1286,6 +1431,70 @@
"Mult": 1.0,
"Deadzone": 0.1
}
},
"VirtualBoy Controller": {},
"NeoGeo Portable Controller": {},
"Saturn Controller": {
"P1 Right Stick Horizontal": {
"Value": "X1 RightThumbX",
"Mult": 1.0,
"Deadzone": 0.1
},
"P1 Right Stick Vertical": {
"Value": "",
"Mult": 1.0,
"Deadzone": 0.1
},
"P1 Right Throttle": {
"Value": "X1 RightThumbY",
"Mult": 1.0,
"Deadzone": 0.1
},
"P1 Left Stick Horizontal": {
"Value": "X1 LeftThumbX",
"Mult": 1.0,
"Deadzone": 0.1
},
"P1 Left Stick Vertical": {
"Value": "X1 LeftThumbY",
"Mult": 1.0,
"Deadzone": 0.1
},
"P1 Left Throttle": {
"Value": "",
"Mult": 1.0,
"Deadzone": 0.1
},
"P1 Wheel": {
"Value": "X1 LeftThumbX",
"Mult": 1.0,
"Deadzone": 0.1
},
"P1 Stick Horizontal": {
"Value": "X1 LeftThumbX",
"Mult": 1.0,
"Deadzone": 0.1
},
"P1 Stick Vertical": {
"Value": "X1 LeftThumbY",
"Mult": 1.0,
"Deadzone": 0.1
},
"P1 Throttle": {
"Value": "X1 RightThumbX",
"Mult": 1.0,
"Deadzone": 0.1
},
"P1 X": {
"Value": "WMouse X",
"Mult": 1.0,
"Deadzone": 0.1
},
"P1 Y": {
"Value": "WMouse Y",
"Mult": 1.0,
"Deadzone": 0.1
}
}
}
}

View File

@ -81,7 +81,7 @@ A9FC2E46A38FD51EBDC25F6F261925F7CB6754F7 G Aladdin (Japan) SNES
DB4C5AE21420AA79F4519B542B03962A9293464D G Aladdin (Spain) SNES
48DDA773437CD755C31D2422F1DFD3A3FD6EE76B G Aladdin (USA) (Beta) SNES
BD5FEA18CE7456CC0231A39473927D8EA9C6589B G Aladdin (USA) SNES
A1A682F723573254046A8AF06B92FE408FC4207A G Albert Odyssey (Japan) (BS) SNES
A1A682F723573254046A8AF06B92FE408FC4207A B Albert Odyssey (Japan) (BS) SNES
525AC489230002E2E9294846154D962EF9A2B941 G Albert Odyssey (Japan) SNES
B3B78710000D467DC0304EFA0245D2CF7AE23D88 G Albert Odyssey 2 - Jashin no Taidou (Japan) SNES
DAC852EA9FF3141DE5DC6377307B16811F607008 G Alcahest (Japan) SNES
@ -3517,4 +3517,12 @@ F650083142D9F3EB2BF1B315B44D18077743FE17 G Zool no Yume Bouken (Japan) SNES
051C767B843FC4112E0B06C2F81B65ABBAC9E7FC G Zoop (USA) SNES
21286747D360C03E3BF86CD4504508CE55DEFF8F G Zootto Mahjong! (Japan) (NP) SNES
2EE76761E023F0C51FBBF4797C175A7C752E788C G Zootto Mahjong! - Event Version (Japan) (BS) SNES
8EC66C5DCDA3392C27BC532A06D726783C3A1565 G Zootto Mahjong! - Preview Ban (Japan) (BS) SNES
8EC66C5DCDA3392C27BC532A06D726783C3A1565 G Zootto Mahjong! - Preview Ban (Japan) (BS) SNES
;Junk
3064E664D34859649B67559F0ED0C2FFD6948031 B ActRaiser 2 (U) [b1] SNES
BD0C52940A96BF470AB383100A1EA0390B145453 B Addams Family, The - Pugsley's Scavenger Hunt (Beta) [b2] SNES
378D60AEA423F97DAF8314ADCD932F2E1B75A0DC B Addams Family, The - Pugsley's Scavenger Hunt (E) [t1] SNES
75CF0949C6D35FFA5856A11B3449F674038CD7DF B Aerobiz (U) [b1] SNES
CAAAC55BB9450BE2A1827DA1DA81807EC0941906 B Aladdin (Beta) [h1+C] SNES
4AA6D9BA00F80BC2D22ECE4EF9753864380A2B9D B Aladdin (Beta) [h3] SNES

View File

@ -1,8 +1,8 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x64'">
<DebugSymbols>true</DebugSymbols>
<OutputPath>..\output64\dll\</OutputPath>
<OutputPath>..\output\dll\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<DebugType>full</DebugType>
<PlatformTarget>x64</PlatformTarget>
@ -13,21 +13,22 @@
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
<CodeAnalysisRuleSetDirectories>;C:\Program Files (x86)\Microsoft Visual Studio 10.0\Team Tools\Static Analysis Tools\\Rule Sets</CodeAnalysisRuleSetDirectories>
<CodeAnalysisRuleDirectories>;C:\Program Files (x86)\Microsoft Visual Studio 10.0\Team Tools\Static Analysis Tools\FxCop\\Rules</CodeAnalysisRuleDirectories>
<Prefer32Bit>false</Prefer32Bit>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|x64'">
<OutputPath>..\output64\dll\</OutputPath>
<OutputPath>..\output\dll\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<Optimize>true</Optimize>
<DebugType>pdbonly</DebugType>
<PlatformTarget>x64</PlatformTarget>
<CodeAnalysisLogFile>..\output\dll\BizHawk.Client.ApiHawk.dll.CodeAnalysisLog.xml</CodeAnalysisLogFile>
<CodeAnalysisUseTypeNameInSuppression>true</CodeAnalysisUseTypeNameInSuppression>
<CodeAnalysisModuleSuppressionsFile>GlobalSuppressions.cs</CodeAnalysisModuleSuppressionsFile>
<ErrorReport>prompt</ErrorReport>
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
<CodeAnalysisRuleSetDirectories>;C:\Program Files (x86)\Microsoft Visual Studio 10.0\Team Tools\Static Analysis Tools\\Rule Sets</CodeAnalysisRuleSetDirectories>
<CodeAnalysisRuleDirectories>;C:\Program Files (x86)\Microsoft Visual Studio 10.0\Team Tools\Static Analysis Tools\FxCop\\Rules</CodeAnalysisRuleDirectories>
<DocumentationFile>..\output64\dll\BizHawk.Client.ApiHawk.XML</DocumentationFile>
<DocumentationFile>..\output\dll\BizHawk.Client.ApiHawk.XML</DocumentationFile>
<Prefer32Bit>false</Prefer32Bit>
</PropertyGroup>
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<PropertyGroup>
@ -38,51 +39,9 @@
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>BizHawk.Client.ApiHawk</RootNamespace>
<AssemblyName>BizHawk.Client.ApiHawk</AssemblyName>
<TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
<TargetFrameworkVersion>v4.6.1</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<PlatformTarget>x86</PlatformTarget>
<DocumentationFile>
</DocumentationFile>
</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>
<DocumentationFile>
</DocumentationFile>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x86'">
<DebugSymbols>true</DebugSymbols>
<OutputPath>..\output\dll\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<DebugType>full</DebugType>
<PlatformTarget>x86</PlatformTarget>
<ErrorReport>prompt</ErrorReport>
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
<DocumentationFile>
</DocumentationFile>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|x86'">
<OutputPath>..\output\dll\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<Optimize>true</Optimize>
<DebugType>pdbonly</DebugType>
<PlatformTarget>x86</PlatformTarget>
<ErrorReport>prompt</ErrorReport>
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
<DocumentationFile>..\output\dll\BizHawk.Client.ApiHawk.XML</DocumentationFile>
<TargetFrameworkProfile />
</PropertyGroup>
<ItemGroup>
<Reference Include="System" />

View File

@ -99,6 +99,13 @@ namespace BizHawk.Client.ApiHawk
case "WSWAN":
return CoreSystem.WonderSwan;
case "VB":
case "NGP":
case "DNGP":
case "O2":
case "SGB":
return 0; // like I give a shit
default:
throw new IndexOutOfRangeException(string.Format("{0} is missing in convert list", value));
}

View File

@ -27,6 +27,8 @@
PSP,
Playstation,
WonderSwan,
Libretro
Libretro,
VirtualBoy,
NeoGeoPocket
}
}

View File

@ -324,9 +324,10 @@ namespace BizHawk.Client.Common
public BinaryStateSaver(string path, bool notamovie = true) // notamovie is hack, really should have separate something
{
_zip = new IonicZipWriter(path, notamovie ? Global.Config.SaveStateCompressionLevelNormal : Global.Config.MovieCompressionLevel);
////_zip = new IonicZipWriter(path, notamovie ? Global.Config.SaveStateCompressionLevelNormal : Global.Config.MovieCompressionLevel);
////_zip = new SharpZipWriter(path, Global.Config.SaveStateCompressionLevelNormal);
////_zip = new SevenZipWriter(path, Global.Config.SaveStateCompressionLevelNormal);
_zip = new FrameworkZipWriter(path, notamovie ? Global.Config.SaveStateCompressionLevelNormal : Global.Config.MovieCompressionLevel);
if (notamovie)
{

View File

@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">x86</Platform>
@ -10,38 +10,17 @@
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>BizHawk.Client.Common</RootNamespace>
<AssemblyName>BizHawk.Client.Common</AssemblyName>
<TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
<TargetFrameworkVersion>v4.6.1</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|x86' ">
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>..\output\dll\</OutputPath>
<DefineConstants>TRACE;DEBUG;DOTNET20;UNMANAGED;COMPRESS;WINDOWS</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<PlatformTarget>x86</PlatformTarget>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|x86' ">
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>..\output\dll\</OutputPath>
<DefineConstants>TRACE;DOTNET20;UNMANAGED;COMPRESS;WINDOWS</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<PlatformTarget>x86</PlatformTarget>
<TargetFrameworkProfile />
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x64'">
<DebugSymbols>true</DebugSymbols>
<OutputPath>..\output64\dll\</OutputPath>
<OutputPath>..\output\dll\</OutputPath>
<DefineConstants>TRACE;DEBUG;DOTNET20;UNMANAGED;COMPRESS;WINDOWS</DefineConstants>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<DebugType>full</DebugType>
<PlatformTarget>x64</PlatformTarget>
<CodeAnalysisLogFile>..\output\dll\BizHawk.Client.Common.dll.CodeAnalysisLog.xml</CodeAnalysisLogFile>
<CodeAnalysisUseTypeNameInSuppression>true</CodeAnalysisUseTypeNameInSuppression>
<CodeAnalysisModuleSuppressionsFile>GlobalSuppressions.cs</CodeAnalysisModuleSuppressionsFile>
<ErrorReport>prompt</ErrorReport>
@ -51,15 +30,15 @@
<CodeAnalysisRuleDirectories>;C:\Program Files (x86)\Microsoft Visual Studio 10.0\Team Tools\Static Analysis Tools\FxCop\\Rules</CodeAnalysisRuleDirectories>
<CodeAnalysisIgnoreBuiltInRules>false</CodeAnalysisIgnoreBuiltInRules>
<CodeAnalysisFailOnMissingRules>false</CodeAnalysisFailOnMissingRules>
<Prefer32Bit>false</Prefer32Bit>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|x64'">
<OutputPath>..\output64\dll\</OutputPath>
<OutputPath>..\output\dll\</OutputPath>
<DefineConstants>TRACE;DOTNET20;UNMANAGED;COMPRESS;WINDOWS</DefineConstants>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<Optimize>true</Optimize>
<DebugType>pdbonly</DebugType>
<PlatformTarget>x64</PlatformTarget>
<CodeAnalysisLogFile>..\output\dll\BizHawk.Client.Common.dll.CodeAnalysisLog.xml</CodeAnalysisLogFile>
<CodeAnalysisUseTypeNameInSuppression>true</CodeAnalysisUseTypeNameInSuppression>
<CodeAnalysisModuleSuppressionsFile>GlobalSuppressions.cs</CodeAnalysisModuleSuppressionsFile>
<ErrorReport>prompt</ErrorReport>
@ -69,6 +48,7 @@
<CodeAnalysisRuleDirectories>;C:\Program Files (x86)\Microsoft Visual Studio 10.0\Team Tools\Static Analysis Tools\FxCop\\Rules</CodeAnalysisRuleDirectories>
<CodeAnalysisIgnoreBuiltInRules>false</CodeAnalysisIgnoreBuiltInRules>
<CodeAnalysisFailOnMissingRules>false</CodeAnalysisFailOnMissingRules>
<Prefer32Bit>false</Prefer32Bit>
</PropertyGroup>
<ItemGroup>
<Reference Include="ICSharpCode.SharpZipLib">
@ -87,6 +67,7 @@
<Reference Include="System" />
<Reference Include="System.Core" />
<Reference Include="System.Drawing" />
<Reference Include="System.IO.Compression" />
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="Microsoft.CSharp" />
@ -151,6 +132,8 @@
<Compile Include="ExceptionClasses.cs" />
<Compile Include="Extensions.cs" />
<Compile Include="FirmwareManager.cs" />
<Compile Include="FrameworkFastZipWriter.cs" />
<Compile Include="FrameworkZipWriter.cs" />
<Compile Include="Global.cs" />
<Compile Include="inputAdapters\AutoPattern.cs" />
<Compile Include="inputAdapters\BitwiseAdapters.cs" />
@ -191,6 +174,8 @@
<Compile Include="lua\LuaMemoryBase.cs" />
<Compile Include="lua\LuaSandbox.cs" />
<Compile Include="lua\NamedLuaFunction.cs" />
<Compile Include="miniz\LibMiniz.cs" />
<Compile Include="miniz\MinizZipWriter.cs" />
<Compile Include="movie\bk2\Bk2ControllerAdapter.cs" />
<Compile Include="movie\bk2\Bk2Header.cs" />
<Compile Include="movie\bk2\Bk2LogEntryGenerator.cs" />

View File

@ -0,0 +1,296 @@
using System;
using System.Collections.Generic;
using System.IO;
using System.IO.Compression;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace BizHawk.Client.Common
{
/// <summary>
/// this almost works, but it loses all of its speed advantages over FrameworkZipWriter from slow CRC calculation.
/// </summary>
public class FrameworkFastZipWriter : IZipWriter
{
private Stream _output;
private readonly CompressionLevel _level;
private byte[] _localHeader;
private List<byte[]> _endBlobs = new List<byte[]>();
private byte[] _fileHeaderTemplate;
private int _numEntries;
private bool _disposed;
private class CRC32Stream : Stream
{
// Lookup table for speed.
private static readonly uint[] Crc32Table;
static CRC32Stream()
{
Crc32Table = new uint[256];
for (uint i = 0; i < 256; ++i)
{
uint crc = i;
for (int j = 8; j > 0; --j)
{
if ((crc & 1) == 1)
{
crc = (crc >> 1) ^ 0xEDB88320;
}
else
{
crc >>= 1;
}
}
Crc32Table[i] = crc;
}
}
private uint _crc = 0xffffffff;
private int _count = 0;
private Stream _baseStream;
public int Size => _count;
public uint Crc => ~_crc;
public CRC32Stream(Stream baseStream)
{
_baseStream = baseStream;
}
private void CalculateByte(byte b)
{
_crc = (_crc >> 8) ^ Crc32Table[b ^ (_crc & 0xff)];
}
public override void Write(byte[] buffer, int offset, int count)
{
for (int i = offset; i < offset + count; i++)
{
CalculateByte(buffer[i]);
}
_count += count;
_baseStream.Write(buffer, offset, count);
}
public override void WriteByte(byte value)
{
CalculateByte(value);
_count++;
_baseStream.WriteByte(value);
}
public override void Flush()
{
}
public override long Seek(long offset, SeekOrigin origin)
{
throw new NotImplementedException();
}
public override void SetLength(long value)
{
throw new NotImplementedException();
}
public override int Read(byte[] buffer, int offset, int count)
{
throw new NotImplementedException();
}
public override bool CanRead => false;
public override bool CanSeek => false;
public override bool CanWrite => true;
public override long Length
{
get
{
throw new NotImplementedException();
}
}
public override long Position
{
get
{
throw new NotImplementedException();
}
set
{
throw new NotImplementedException();
}
}
}
public FrameworkFastZipWriter(string path, int compressionlevel)
{
_output = new FileStream(path, FileMode.Create, FileAccess.Write);
if (compressionlevel == 0)
throw new NotImplementedException();
//_level = CompressionLevel.NoCompression;
else if (compressionlevel < 5)
_level = CompressionLevel.Fastest;
else
_level = CompressionLevel.Optimal;
var dt = DateTime.Now;
var mtime = dt.Second >> 1
| dt.Minute << 5
| dt.Hour << 11;
var mdate = dt.Day
| dt.Month << 5
| (dt.Year - 1980) << 9;
var modifiedDate = new byte[]
{
(byte)(mtime & 0xff),
(byte)(mtime >> 8),
(byte)(mdate & 0xff),
(byte)(mdate >> 8)
};
_localHeader = new byte[]
{
0x50, 0x4b, 0x03, 0x04, // signature
0x14, 0x00, // version
0x08, 0x00, // flags: has data descriptor
0x08, 0x00, // method: deflate
modifiedDate[0], modifiedDate[1], // mod time
modifiedDate[2], modifiedDate[3], // mod date
0x00, 0x00, 0x00, 0x00, // crc32
0x00, 0x00, 0x00, 0x00, // compressed size
0x00, 0x00, 0x00, 0x00, // uncompressed size
0x00, 0x00, // filename length
0x00, 0x00, // extra field length
};
_fileHeaderTemplate = new byte[]
{
0x50, 0x4b, 0x01, 0x02, // signature
0x17, 0x03, // ??
0x14, 0x00, // version
0x08, 0x00, // flags: has data descriptor
0x08, 0x00, // method: deflate
modifiedDate[0], modifiedDate[1], // mod time
modifiedDate[2], modifiedDate[3], // mod date
0x00, 0x00, 0x00, 0x00, // crc32
0x00, 0x00, 0x00, 0x00, // compressed size
0x00, 0x00, 0x00, 0x00, // uncompressed size
0x00, 0x00, // filename length
0x00, 0x00, // extra field length
0x00, 0x00, // file comment length
0x00, 0x00, // disk #,
0x00, 0x00, // internal attributes
0x00, 0x00, 0x00, 0x00, // external attributes
0x00, 0x00, 0x00, 0x00, // local header offset
};
}
public void Dispose()
{
if (!_disposed)
{
WriteFooter();
_output.Dispose();
_output = null;
_disposed = true;
}
}
public void WriteItem(string name, Action<Stream> callback)
{
var nameb = Encoding.ASCII.GetBytes(name);
_localHeader[26] = (byte)nameb.Length;
_localHeader[27] = (byte)(nameb.Length >> 8);
var localHeaderOffset = (int)(_output.Position);
_output.Write(_localHeader, 0, _localHeader.Length);
_output.Write(nameb, 0, nameb.Length);
var fileStart = (int)(_output.Position);
var s2 = new DeflateStream(_output, _level, true);
var s3 = new CRC32Stream(s2);
callback(s3);
s2.Flush();
var fileEnd = (int)(_output.Position);
var crc = s3.Crc;
var compressedSize = fileEnd - fileStart;
var uncompressedSize = s3.Size;
var descriptor = new byte[]
{
(byte)crc,
(byte)(crc >> 8),
(byte)(crc >> 16),
(byte)(crc >> 24),
(byte)compressedSize,
(byte)(compressedSize >> 8),
(byte)(compressedSize >> 16),
(byte)(compressedSize >> 24),
(byte)uncompressedSize,
(byte)(uncompressedSize >> 8),
(byte)(uncompressedSize >> 16),
(byte)(uncompressedSize >> 24)
};
_output.Write(descriptor, 0, descriptor.Length);
var fileHeader = (byte[])_fileHeaderTemplate.Clone();
fileHeader[28] = (byte)nameb.Length;
fileHeader[29] = (byte)(nameb.Length >> 8);
Array.Copy(descriptor, 0, fileHeader, 16, 12);
fileHeader[42] = (byte)localHeaderOffset;
fileHeader[43] = (byte)(localHeaderOffset >> 8);
fileHeader[44] = (byte)(localHeaderOffset >> 16);
fileHeader[45] = (byte)(localHeaderOffset >> 24);
_endBlobs.Add(fileHeader);
_endBlobs.Add(nameb);
_numEntries++;
}
private void WriteFooter()
{
var centralHeaderOffset = (int)(_output.Position);
foreach (var blob in _endBlobs)
_output.Write(blob, 0, blob.Length);
var centralHeaderEnd = (int)(_output.Position);
var centralHeaderSize = centralHeaderEnd - centralHeaderOffset;
var footer = new byte[]
{
0x50, 0x4b, 0x05, 0x06, // signature
0x00, 0x00, // disk number
0x00, 0x00, // central record disk number
(byte)_numEntries, (byte)(_numEntries >> 8), // number of entries on disk
(byte)_numEntries, (byte)(_numEntries >> 8), // number of entries total
(byte)centralHeaderSize,
(byte)(centralHeaderSize >> 8),
(byte)(centralHeaderSize >> 16),
(byte)(centralHeaderSize >> 24), // central directory size
(byte)centralHeaderOffset,
(byte)(centralHeaderOffset >> 8),
(byte)(centralHeaderOffset >> 16),
(byte)(centralHeaderOffset >> 24), // central directory offset
0x07, 0x00, // comment length
0x42, 0x69, 0x7a, 0x48, 0x61, 0x77, 0x6b // comment
};
_output.Write(footer, 0, footer.Length);
}
}
}

View File

@ -0,0 +1,44 @@
using System;
using System.Collections.Generic;
using System.IO;
using System.IO.Compression;
using System.Linq;
using System.Text;
namespace BizHawk.Client.Common
{
public class FrameworkZipWriter : IZipWriter
{
private ZipArchive _archive;
private readonly CompressionLevel _level;
public FrameworkZipWriter(string path, int compressionlevel)
{
_archive = new ZipArchive(new FileStream(path, FileMode.Create, FileAccess.Write),
ZipArchiveMode.Create, false);
if (compressionlevel == 0)
_level = CompressionLevel.NoCompression;
else if (compressionlevel < 5)
_level = CompressionLevel.Fastest;
else
_level = CompressionLevel.Optimal;
}
public void WriteItem(string name, Action<Stream> callback)
{
using (var stream = _archive.CreateEntry(name, _level).Open())
{
callback(stream);
}
}
public void Dispose()
{
if (_archive != null)
{
_archive.Dispose();
_archive = null;
}
}
}
}

View File

@ -1,7 +1,7 @@
using System.Collections.Generic;
using BizHawk.Emulation.Common;
using BizHawk.Emulation.Cores.Nintendo.Gameboy;
using BizHawk.Emulation.Cores.Consoles.Nintendo.Gameboy;
using BizHawk.Emulation.Cores.Sega.MasterSystem;
// ReSharper disable StyleCop.SA1401
@ -112,7 +112,7 @@ namespace BizHawk.Client.Common
case "SNES":
return SystemInfo.SNES;
case "GB":
if ((Emulator as Gameboy).IsCGBMode())
if ((Emulator as IGameboyCommon).IsCGBMode())
{
return SystemInfo.GBC;
}
@ -144,6 +144,10 @@ namespace BizHawk.Client.Common
return SystemInfo.AppleII;
case "Libretro":
return SystemInfo.Libretro;
case "VB":
return SystemInfo.VirtualBoy;
case "NGP":
return SystemInfo.NeoGeoPocket;
}
}
}

View File

@ -7,6 +7,7 @@ using BizHawk.Common.StringExtensions;
using BizHawk.Emulation.Common;
using BizHawk.Emulation.Common.IEmulatorExtensions;
using BizHawk.Emulation.Cores.Nintendo.SNES;
using BizHawk.Emulation.Cores.Nintendo.SNES9X;
namespace BizHawk.Client.Common
{
@ -355,6 +356,11 @@ namespace BizHawk.Client.Common
name += "." + Global.Emulator.Attributes().CoreName;
}
if (Global.Emulator is Snes9x) // Keep snes9x savestate away from libsnes, we want to not be too tedious so bsnes names will just have the profile name not the core name
{
name += "." + Global.Emulator.Attributes().CoreName;
}
// Bsnes profiles have incompatible savestates so save the profile name
if (Global.Emulator is LibsnesCore)
{

View File

@ -22,6 +22,7 @@ using BizHawk.Emulation.Cores.Sony.PSX;
using BizHawk.Emulation.DiscSystem;
using GPGX64 = BizHawk.Emulation.Cores.Consoles.Sega.gpgx64;
using BizHawk.Emulation.Cores.Consoles.Sega.Saturn;
namespace BizHawk.Client.Common
{
@ -487,7 +488,15 @@ namespace BizHawk.Client.Common
case DiscType.TurboCD:
case DiscType.UnknownCDFS:
case DiscType.UnknownFormat:
game.System = "PCECD";
if (PreferredPlatformIsDefined(ext))
{
game.System = Global.Config.PreferredPlatformsForExtensions[ext];
}
else
{
game.System = "PCECD";
}
break;
}
}
@ -508,7 +517,9 @@ namespace BizHawk.Client.Common
break;
case "SAT":
nextEmulator = new Yabause(nextComm, disc, GetCoreSyncSettings<Yabause>());
//nextEmulator = new Yabause(nextComm, disc, GetCoreSyncSettings<Yabause>());
nextEmulator = new Saturnus(nextComm, new[] { disc }, Deterministic,
(Saturnus.Settings)GetCoreSettings<Saturnus>(), (Saturnus.SyncSettings)GetCoreSyncSettings<Saturnus>());
break;
case "PSP":
nextEmulator = new PSP(nextComm, file.Name);
@ -771,7 +782,7 @@ namespace BizHawk.Client.Common
break;
case "SNES":
if (Global.Config.SNES_InSnes9x && VersionInfo.DeveloperBuild)
if (Global.Config.SNES_InSnes9x)
{
core = CoreInventory.Instance["SNES", "Snes9x"];
}
@ -823,6 +834,7 @@ namespace BizHawk.Client.Common
case "GBC":
if (!Global.Config.GB_AsSGB)
{
//core = CoreInventory.Instance["GB", "Pizza Boy"];
core = CoreInventory.Instance["GB", "Gambatte"];
}
else

View File

@ -201,10 +201,6 @@ namespace BizHawk.Client.Common
});
}
}
catch
{
return false;
}
finally
{
bl.Dispose();
@ -212,41 +208,9 @@ namespace BizHawk.Client.Common
return true;
}
else // text mode
else
{
if (Global.MovieSession.HandleMovieLoadState(path))
{
using (var reader = new StreamReader(path))
{
core.LoadStateText(reader);
while (true)
{
var str = reader.ReadLine();
if (str == null)
{
break;
}
if (str.Trim() == "")
{
continue;
}
var args = str.Split(' ');
if (args[0] == "Framebuffer" && Global.Emulator.HasVideoProvider())
{
Global.Emulator.AsVideoProvider().GetVideoBuffer().ReadFromHex(args[1]);
}
}
}
return true;
}
else
{
return false;
}
return false;
}
}
}

View File

@ -174,10 +174,20 @@ namespace BizHawk.Client.Common
public static SystemInfo TI83 { get; } = new SystemInfo("TI - 83", CoreSystem.TI83, 1);
/// <summary>
/// Gets the <see cref="SystemInfo"/> instance for TI-83
/// Gets the <see cref="SystemInfo"/> instance for Wonderswan
/// </summary>
public static SystemInfo WonderSwan { get; } = new SystemInfo("WonderSwan", CoreSystem.WonderSwan, 1);
/// <summary>
/// Gets the <see cref="SystemInfo"/> instance for Virtual Boy
/// </summary>
public static SystemInfo VirtualBoy { get; } = new SystemInfo("Virtual Boy", CoreSystem.VirtualBoy, 1);
/// <summary>
/// Gets the <see cref="SystemInfo"/> instance for TI-83
/// </summary>
public static SystemInfo NeoGeoPocket { get; } = new SystemInfo("Neo-Geo Pocket", CoreSystem.NeoGeoPocket, 1);
#endregion Get SystemInfo
/// <summary>

View File

@ -46,6 +46,7 @@ namespace BizHawk.Client.Common
{ ".rom", "" },
{ ".iso", "" },
{ ".img", "" },
{ ".cue", "" }
};
// Path Settings ************************************/
@ -217,7 +218,7 @@ namespace BizHawk.Client.Common
// Savestate settings
public SaveStateTypeE SaveStateType = SaveStateTypeE.Default;
public const int DefaultSaveStateCompressionLevelNormal = 0;
public const int DefaultSaveStateCompressionLevelNormal = 1;
public int SaveStateCompressionLevelNormal = DefaultSaveStateCompressionLevelNormal;
public const int DefaultSaveStateCompressionLevelRewind = 0; // this isnt actually used yet
public int SaveStateCompressionLevelRewind = DefaultSaveStateCompressionLevelRewind; // this isnt actually used yet
@ -398,6 +399,7 @@ namespace BizHawk.Client.Common
public string AVICodecToken = "";
public int GifWriterFrameskip = 3;
public int GifWriterDelay = -1;
public bool VideoWriterAudioSync = true;
#region emulation core settings
@ -535,8 +537,8 @@ namespace BizHawk.Client.Common
// it hasn't been absorbed into the new system
public bool GB_AsSGB = false;
public bool NES_InQuickNES = true;
public bool SNES_InSnes9x = false;
public bool GBA_UsemGBA = false;
public bool SNES_InSnes9x = true;
public bool GBA_UsemGBA = true;
public bool A78_UseEmu7800 = true;
public bool CoreForcingViaGameDB = true;
public string LibretroCore;

View File

@ -344,6 +344,20 @@ namespace BizHawk.Client.Common
new PathEntry { System = "Libretro", SystemDisplayName = "Libretro", Type = "Save RAM", Path = Path.Combine(".", "SaveRAM"), Ordinal = 4 },
new PathEntry { System = "Libretro", SystemDisplayName = "Libretro", Type = "Screenshots", Path = Path.Combine(".", "Screenshots"), Ordinal = 5 },
new PathEntry { System = "Libretro", SystemDisplayName = "Libretro", Type = "Cheats", Path = Path.Combine(".", "Cheats"), Ordinal = 6 },
new PathEntry { System = "VB", SystemDisplayName = "VB", Type = "Base", Path = Path.Combine(".", "VB"), Ordinal = 0 },
new PathEntry { System = "VB", SystemDisplayName = "VB", Type = "ROM", Path = ".", Ordinal = 1 },
new PathEntry { System = "VB", SystemDisplayName = "VB", Type = "Savestates", Path = Path.Combine(".", "State"), Ordinal = 2 },
new PathEntry { System = "VB", SystemDisplayName = "VB", Type = "Save RAM", Path = Path.Combine(".", "SaveRAM"), Ordinal = 3 },
new PathEntry { System = "VB", SystemDisplayName = "VB", Type = "Screenshots", Path = Path.Combine(".", "Screenshots"), Ordinal = 4 },
new PathEntry { System = "VB", SystemDisplayName = "VB", Type = "Cheats", Path = Path.Combine(".", "Cheats"), Ordinal = 5 },
new PathEntry { System = "NGP", SystemDisplayName = "NGP", Type = "Base", Path = Path.Combine(".", "NGP"), Ordinal = 0 },
new PathEntry { System = "NGP", SystemDisplayName = "NGP", Type = "ROM", Path = ".", Ordinal = 1 },
new PathEntry { System = "NGP", SystemDisplayName = "NGP", Type = "Savestates", Path = Path.Combine(".", "State"), Ordinal = 2 },
new PathEntry { System = "NGP", SystemDisplayName = "NGP", Type = "Save RAM", Path = Path.Combine(".", "SaveRAM"), Ordinal = 3 },
new PathEntry { System = "NGP", SystemDisplayName = "NGP", Type = "Screenshots", Path = Path.Combine(".", "Screenshots"), Ordinal = 4 },
new PathEntry { System = "NGP", SystemDisplayName = "NGP", Type = "Cheats", Path = Path.Combine(".", "Cheats"), Ordinal = 5 },
};
}
}

View File

@ -135,11 +135,11 @@ namespace BizHawk.Client.Common
private bool N64CoreTypeDynarec()
{
if ((Emulator as N64)?.GetSyncSettings().Core == N64SyncSettings.CoreType.Dynarec)
{
Log("N64 Error: Memory callbacks are not implemented for Dynamic Recompiler core type\nUse Interpreter or Pure Interpreter\n");
return true;
}
//if ((Emulator as N64)?.GetSyncSettings().Core == N64SyncSettings.CoreType.Dynarec)
//{
// Log("N64 Error: Memory callbacks are not implemented for Dynamic Recompiler core type\nUse Interpreter or Pure Interpreter\n");
// return true;
//}
return false;
}

View File

@ -0,0 +1,53 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.InteropServices;
using System.Text;
using System.Threading.Tasks;
namespace BizHawk.Client.Common.Miniz
{
public static class LibMiniz
{
private const string DllName = "libminiz.dll";
private const CallingConvention CC = CallingConvention.Cdecl;
public enum mz_zip_flags : uint
{
MZ_ZIP_FLAG_CASE_SENSITIVE = 0x0100,
MZ_ZIP_FLAG_IGNORE_PATH = 0x0200,
MZ_ZIP_FLAG_COMPRESSED_DATA = 0x0400,
MZ_ZIP_FLAG_DO_NOT_SORT_CENTRAL_DIRECTORY = 0x0800
};
enum mz_compression_level : uint
{
MZ_NO_COMPRESSION = 0,
MZ_BEST_SPEED = 1,
MZ_BEST_COMPRESSION = 9,
MZ_UBER_COMPRESSION = 10,
MZ_DEFAULT_LEVEL = 6,
MZ_DEFAULT_COMPRESSION = unchecked((uint)-1)
};
[DllImport(DllName, CallingConvention = CC)]
public static extern bool mz_zip_writer_init_file(IntPtr pZip, string pFilename, long size_to_reserve_at_beginning);
// Adds the contents of a memory buffer to an archive. These functions record the current local time into the archive.
// To add a directory entry, call this method with an archive name ending in a forwardslash with empty buffer.
// level_and_flags - compression level (0-10, see MZ_BEST_SPEED, MZ_BEST_COMPRESSION, etc.) logically OR'd with zero or more mz_zip_flags, or just set to MZ_DEFAULT_COMPRESSION.
[DllImport(DllName, CallingConvention = CC)]
public static extern bool mz_zip_writer_add_mem(IntPtr pZip, string pArchive_name, byte[] pBuf, ulong buf_size, uint level_and_flags);
// Finalizes the archive by writing the central directory records followed by the end of central directory record.
// After an archive is finalized, the only valid call on the mz_zip_archive struct is mz_zip_writer_end().
// An archive must be manually finalized by calling this function for it to be valid.
[DllImport(DllName, CallingConvention = CC)]
public static extern bool mz_zip_writer_finalize_archive(IntPtr pZip);
// Ends archive writing, freeing all allocations, and closing the output file if mz_zip_writer_init_file() was used.
// Note for the archive to be valid, it must have been finalized before ending.
[DllImport(DllName, CallingConvention = CC)]
public static extern bool mz_zip_writer_end(IntPtr pZip);
}
}

View File

@ -0,0 +1,68 @@
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Runtime.InteropServices;
using System.Text;
using System.Threading.Tasks;
namespace BizHawk.Client.Common.Miniz
{
public class MinizZipWriter : IZipWriter
{
private IntPtr _zip;
private uint _flags;
private static readonly byte[] _shitcock = new byte[32 * 1024 * 1024];
public MinizZipWriter(string path, int compressionlevel)
{
_zip = Marshal.AllocHGlobal(128);
unsafe
{
var p = (int*)_zip;
for (int i = 0; i < 32; i++)
p[i] = 0;
}
if (!LibMiniz.mz_zip_writer_init_file(_zip, path, 0))
{
Marshal.FreeHGlobal(_zip);
_zip = IntPtr.Zero;
throw new InvalidOperationException("mz_zip_writer_init_file returned FALSE");
}
_flags = (uint)compressionlevel;
}
void IDisposable.Dispose()
{
Dispose();
GC.SuppressFinalize(this);
}
~MinizZipWriter()
{
Dispose();
}
private void Dispose()
{
if (_zip != IntPtr.Zero)
{
if (LibMiniz.mz_zip_writer_finalize_archive(_zip))
LibMiniz.mz_zip_writer_end(_zip);
Marshal.FreeHGlobal(_zip);
_zip = IntPtr.Zero;
}
}
public void WriteItem(string name, Action<Stream> callback)
{
lock (_shitcock)
{
var ms = new MemoryStream(_shitcock);
callback(ms);
if (!LibMiniz.mz_zip_writer_add_mem(_zip, name, _shitcock /*ms.GetBuffer()*/, (ulong)ms.Position, _flags))
throw new InvalidOperationException("mz_zip_writer_add_mem returned FALSE");
}
}
}
}

View File

@ -33,7 +33,7 @@ namespace BizHawk.Client.Common
["SG"] = (3579545 / 262.0 / 228.0), // 59.9227434043
["SG_PAL"] = (3546893 / 313.0 / 228.0), // 49.7014320946
["NGP"] = (6144000.0 / (515 * 198)), // 60.2530155928
["VBOY"] = (20000000.0 / (259 * 384 * 4)), // 50.2734877735
["VB"] = (20000000.0 / (259 * 384 * 4)), // 50.2734877735
["Lynx"] = 16000000.0 / (16 * 105 * 159), // 59.89817310572028
["WSWAN"] = (3072000.0 / (159 * 256)), // 75.4716981132
["GB"] = 262144.0 / 4389.0, // 59.7275005696

View File

@ -10,10 +10,18 @@ namespace BizHawk.Client.Common
get
{
var key = button.Replace("Key ", "");
if (key.StartsWith("P") && key.Length > 1 && key[1] >= '0' && key[1] <= '9')
if (key.StartsWith("P"))
{
key = key.Substring(3);
if (key.Length > 2 && key[1] == '1' && key[2] >= '0' && key[1] <= '9') // Hack to support 10-20 controllers, TODO: regex this thing instead
{
key = key.Substring(4);
}
else if (key.Length > 1 && key[1] >= '0' && key[1] <= '9')
{
key = key.Substring(3);
}
}
if (_systemOverrides.ContainsKey(Global.Emulator.SystemId) && _systemOverrides[Global.Emulator.SystemId].ContainsKey(key))
{
@ -293,6 +301,10 @@ namespace BizHawk.Client.Common
["Option 1"] = '1',
["Option 2"] = '2'
},
["NGP"] = new Dictionary<string, char>
{
["Option"] = 'O'
},
["AppleII"] = new Dictionary<string, char>
{
["Tab"] = 't' ,
@ -332,6 +344,17 @@ namespace BizHawk.Client.Common
["Red"] = 'R',
["Blue"] = 'B',
["Purple"] = 'P'
},
["VB"] = new Dictionary<string, char>
{
["L_Up"] = 'U',
["L_Down"] = 'D',
["L_Left"] = 'L',
["L_Right"] = 'R',
["R_Up"] = 'u',
["R_Down"] = 'd',
["R_Left"] = 'l',
["R_Right"] = 'r',
}
};
}

View File

@ -12,6 +12,7 @@ using BizHawk.Emulation.Common;
using BizHawk.Client.Common.MovieConversionExtensions;
using BizHawk.Emulation.Cores.Nintendo.SNES;
using BizHawk.Emulation.Cores.Nintendo.SNES9X;
namespace BizHawk.Client.Common
{
@ -1490,8 +1491,9 @@ namespace BizHawk.Client.Common
m.Header[HeaderKeys.PLATFORM] = platform;
var ss = new LibsnesCore.SnesSyncSettings { Profile = "Compatibility" };
var ss = new LibsnesCore.SnesSyncSettings();
m.SyncSettingsJson = ConfigService.SaveWithType(ss);
Global.Config.SNES_InSnes9x = true; // This could be annoying to a user if they don't notice we set this preference, but the alternative is for the movie import to fail to load the movie
return m;
}
@ -2324,9 +2326,9 @@ namespace BizHawk.Client.Common
r.Close();
fs.Close();
var ss = new LibsnesCore.SnesSyncSettings { Profile = "Compatibility" };
var ss = new Snes9x.SyncSettings();
m.SyncSettingsJson = ConfigService.SaveWithType(ss);
Global.Config.SNES_InSnes9x = true; // This could be annoying to a user if they don't notice we set this preference, but the alternative is for the movie import to fail to load the movie
return m;
}

View File

@ -80,8 +80,6 @@ namespace BizHawk.Client.Common
public void Uninitialize()
{
Clear();
if (_rewindThread != null)
{
_rewindThread.Dispose();
@ -94,6 +92,8 @@ namespace BizHawk.Client.Common
_rewindBuffer = null;
}
Clear();
RewindEnabled = false;
RewindFrequency = 0;
}

View File

@ -1,15 +1,14 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<StartupObject />
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x64'">
<DebugSymbols>true</DebugSymbols>
<OutputPath>..\output64\</OutputPath>
<OutputPath>..\output\</OutputPath>
<DefineConstants>TRACE;DEBUG;WINDOWS</DefineConstants>
<DebugType>full</DebugType>
<PlatformTarget>x64</PlatformTarget>
<CodeAnalysisLogFile>..\output\BizHawk.Client.DBMan.exe.CodeAnalysisLog.xml</CodeAnalysisLogFile>
<CodeAnalysisUseTypeNameInSuppression>true</CodeAnalysisUseTypeNameInSuppression>
<CodeAnalysisModuleSuppressionsFile>GlobalSuppressions.cs</CodeAnalysisModuleSuppressionsFile>
<UseVSHostingProcess>false</UseVSHostingProcess>
@ -18,14 +17,14 @@
<CodeAnalysisRuleSetDirectories>;C:\Program Files (x86)\Microsoft Visual Studio 10.0\Team Tools\Static Analysis Tools\\Rule Sets</CodeAnalysisRuleSetDirectories>
<CodeAnalysisRuleDirectories>;C:\Program Files (x86)\Microsoft Visual Studio 10.0\Team Tools\Static Analysis Tools\FxCop\\Rules</CodeAnalysisRuleDirectories>
<CodeAnalysisIgnoreBuiltInRules>true</CodeAnalysisIgnoreBuiltInRules>
<Prefer32Bit>false</Prefer32Bit>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|x64'">
<OutputPath>..\output64\</OutputPath>
<OutputPath>..\output\</OutputPath>
<DefineConstants>TRACE;WINDOWS</DefineConstants>
<Optimize>true</Optimize>
<DebugType>pdbonly</DebugType>
<PlatformTarget>x64</PlatformTarget>
<CodeAnalysisLogFile>..\output\BizHawk.Client.DBMan.exe.CodeAnalysisLog.xml</CodeAnalysisLogFile>
<CodeAnalysisUseTypeNameInSuppression>true</CodeAnalysisUseTypeNameInSuppression>
<CodeAnalysisModuleSuppressionsFile>GlobalSuppressions.cs</CodeAnalysisModuleSuppressionsFile>
<UseVSHostingProcess>false</UseVSHostingProcess>
@ -33,6 +32,7 @@
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
<CodeAnalysisRuleSetDirectories>;C:\Program Files (x86)\Microsoft Visual Studio 10.0\Team Tools\Static Analysis Tools\\Rule Sets</CodeAnalysisRuleSetDirectories>
<CodeAnalysisRuleDirectories>;C:\Program Files (x86)\Microsoft Visual Studio 10.0\Team Tools\Static Analysis Tools\FxCop\\Rules</CodeAnalysisRuleDirectories>
<Prefer32Bit>false</Prefer32Bit>
</PropertyGroup>
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<PropertyGroup>
@ -43,31 +43,10 @@
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>BizHawk.Client.DBMan</RootNamespace>
<AssemblyName>BizHawk.Client.DBMan</AssemblyName>
<TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
<TargetFrameworkVersion>v4.6.1</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<TargetFrameworkProfile />
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|x86' ">
<PlatformTarget>x86</PlatformTarget>
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>..\output\</OutputPath>
<DefineConstants>TRACE;DEBUG;WINDOWS</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<UseVSHostingProcess>false</UseVSHostingProcess>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|x86' ">
<PlatformTarget>x86</PlatformTarget>
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>..\output\</OutputPath>
<DefineConstants>TRACE;WINDOWS</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<UseVSHostingProcess>false</UseVSHostingProcess>
</PropertyGroup>
<ItemGroup>
<Reference Include="CSharp-SQLite">
<HintPath>.\CSharp-SQLite.dll</HintPath>
@ -138,11 +117,11 @@
</ProjectReference>
</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>
<!-- 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,7 +1,7 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Runtime Version:4.0.30319.18034
// Runtime Version:4.0.30319.42000
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
@ -12,7 +12,7 @@ namespace BizHawk.Client.DBMan.Properties {
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "11.0.0.0")]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "14.0.0.0")]
internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase {
private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings())));

View File

@ -1,3 +1,3 @@
<?xml version="1.0"?>
<configuration>
<startup><supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.0"/></startup></configuration>
<startup><supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.6.1"/></startup></configuration>

View File

@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">x86</Platform>
@ -10,7 +10,7 @@
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>BizHawk.Client.DiscoHawk</RootNamespace>
<AssemblyName>DiscoHawk</AssemblyName>
<TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
<TargetFrameworkVersion>v4.6.1</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<FileUpgradeFlags>
</FileUpgradeFlags>
@ -33,30 +33,6 @@
<BootstrapperEnabled>true</BootstrapperEnabled>
<TargetFrameworkProfile />
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|x86' ">
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>..\output\</OutputPath>
<DefineConstants>TRACE;DEBUG;WINDOWS</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<UseVSHostingProcess>false</UseVSHostingProcess>
<CodeAnalysisRuleSet>AllRules.ruleset</CodeAnalysisRuleSet>
<PlatformTarget>x86</PlatformTarget>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|x86' ">
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>..\output\</OutputPath>
<DefineConstants>TRACE;WINDOWS</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<UseVSHostingProcess>false</UseVSHostingProcess>
<PlatformTarget>x86</PlatformTarget>
<CodeAnalysisRuleSet>AllRules.ruleset</CodeAnalysisRuleSet>
</PropertyGroup>
<PropertyGroup>
<NoWin32Manifest>true</NoWin32Manifest>
</PropertyGroup>
@ -68,12 +44,11 @@
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x64'">
<DebugSymbols>true</DebugSymbols>
<OutputPath>..\output64\</OutputPath>
<OutputPath>..\output\</OutputPath>
<DefineConstants>TRACE;DEBUG;WINDOWS</DefineConstants>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<DebugType>full</DebugType>
<PlatformTarget>x64</PlatformTarget>
<CodeAnalysisLogFile>..\output\DiscoHawk.exe.CodeAnalysisLog.xml</CodeAnalysisLogFile>
<CodeAnalysisUseTypeNameInSuppression>true</CodeAnalysisUseTypeNameInSuppression>
<CodeAnalysisModuleSuppressionsFile>GlobalSuppressions.cs</CodeAnalysisModuleSuppressionsFile>
<UseVSHostingProcess>false</UseVSHostingProcess>
@ -84,14 +59,14 @@
<CodeAnalysisRuleDirectories>;C:\Program Files (x86)\Microsoft Visual Studio 10.0\Team Tools\Static Analysis Tools\FxCop\\Rules</CodeAnalysisRuleDirectories>
<CodeAnalysisIgnoreBuiltInRules>true</CodeAnalysisIgnoreBuiltInRules>
<CodeAnalysisFailOnMissingRules>false</CodeAnalysisFailOnMissingRules>
<Prefer32Bit>false</Prefer32Bit>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|x64'">
<OutputPath>..\output64\</OutputPath>
<OutputPath>..\output\</OutputPath>
<DefineConstants>TRACE;WINDOWS</DefineConstants>
<Optimize>true</Optimize>
<DebugType>pdbonly</DebugType>
<PlatformTarget>x64</PlatformTarget>
<CodeAnalysisLogFile>..\output\DiscoHawk.exe.CodeAnalysisLog.xml</CodeAnalysisLogFile>
<CodeAnalysisUseTypeNameInSuppression>true</CodeAnalysisUseTypeNameInSuppression>
<CodeAnalysisModuleSuppressionsFile>GlobalSuppressions.cs</CodeAnalysisModuleSuppressionsFile>
<UseVSHostingProcess>false</UseVSHostingProcess>
@ -102,6 +77,7 @@
<CodeAnalysisRuleDirectories>;C:\Program Files (x86)\Microsoft Visual Studio 10.0\Team Tools\Static Analysis Tools\FxCop\\Rules</CodeAnalysisRuleDirectories>
<CodeAnalysisIgnoreBuiltInRules>false</CodeAnalysisIgnoreBuiltInRules>
<CodeAnalysisFailOnMissingRules>false</CodeAnalysisFailOnMissingRules>
<Prefer32Bit>false</Prefer32Bit>
</PropertyGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
@ -193,6 +169,9 @@
<Name>BizHawk.Emulation.DiscSystem</Name>
</ProjectReference>
</ItemGroup>
<ItemGroup>
<None Include="app.config" />
</ItemGroup>
<PropertyGroup>
<PreBuildEvent Condition=" '$(OS)' == 'Windows_NT' ">"$(SolutionDir)subwcrev.bat" "$(ProjectDir)"</PreBuildEvent>
<PreBuildEvent Condition=" '$(OS)' != 'Windows_NT' ">"$(SolutionDir)subwcrev.sh" "$(ProjectDir)"</PreBuildEvent>

View File

@ -0,0 +1,3 @@
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<startup><supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.6.1"/></startup></configuration>

View File

@ -12,9 +12,11 @@ namespace BizHawk.Client.EmuHawk
{
private Bitmap _bmp;
public BmpVideoProvider(Bitmap bmp)
public BmpVideoProvider(Bitmap bmp, int vsyncnum, int vsyncden)
{
_bmp = bmp;
VsyncNumerator = vsyncnum;
VsyncDenominator = vsyncden;
}
public void Dispose()
@ -50,14 +52,8 @@ namespace BizHawk.Client.EmuHawk
public int BackgroundColor => 0;
public int VsyncNumerator
{
get { throw new InvalidOperationException(); }
}
public int VsyncNumerator { get; private set; }
public int VsyncDenominator
{
get { throw new InvalidOperationException(); }
}
public int VsyncDenominator { get; private set; }
}
}

View File

@ -47,7 +47,7 @@ namespace BizHawk.Client.EmuHawk
/// <param name="list">list of IVideoWriters to choose from</param>
/// <param name="owner">parent window</param>
/// <returns>user choice, or null on Cancel\Close\invalid</returns>
public static IVideoWriter DoVideoWriterChoserDlg(IEnumerable<VideoWriterInfo> list, IWin32Window owner, out int resizew, out int resizeh, out bool pad, out bool audiosync)
public static IVideoWriter DoVideoWriterChoserDlg(IEnumerable<VideoWriterInfo> list, IWin32Window owner, out int resizew, out int resizeh, out bool pad, ref bool audiosync)
{
VideoWriterChooserForm dlg = new VideoWriterChooserForm
{
@ -76,6 +76,7 @@ namespace BizHawk.Client.EmuHawk
c.Enabled = false;
}
dlg.checkBoxASync.Checked = audiosync;
DialogResult result = dlg.ShowDialog(owner);
IVideoWriter ret;

View File

@ -35,7 +35,7 @@
this.label3 = new System.Windows.Forms.Label();
this.label4 = new System.Windows.Forms.Label();
this.CoreInfoPanel = new System.Windows.Forms.Panel();
this.textBox1 = new System.Windows.Forms.TextBox();
//this.textBox1 = new System.Windows.Forms.TextBox();
this.VersionLabel = new System.Windows.Forms.Label();
this.btnCopyHash = new System.Windows.Forms.Button();
this.linkLabel2 = new System.Windows.Forms.LinkLabel();
@ -109,19 +109,6 @@
this.CoreInfoPanel.Name = "CoreInfoPanel";
this.CoreInfoPanel.Size = new System.Drawing.Size(423, 259);
this.CoreInfoPanel.TabIndex = 14;
//
// textBox1
//
this.textBox1.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.textBox1.Location = new System.Drawing.Point(13, 462);
this.textBox1.Multiline = true;
this.textBox1.Name = "textBox1";
this.textBox1.ReadOnly = true;
this.textBox1.Size = new System.Drawing.Size(423, 33);
this.textBox1.TabIndex = 16;
this.textBox1.Text = "jabo_direct3d8_patched.dll is distributed with the special permission of the auth" +
"or.";
//
// VersionLabel
//
@ -189,7 +176,7 @@
this.Controls.Add(this.linkLabel3);
this.Controls.Add(this.linkLabel2);
this.Controls.Add(this.btnCopyHash);
this.Controls.Add(this.textBox1);
//this.Controls.Add(this.textBox1);
this.Controls.Add(this.CoreInfoPanel);
this.Controls.Add(this.VersionLabel);
this.Controls.Add(this.label4);
@ -217,7 +204,7 @@
private System.Windows.Forms.Label label3;
private System.Windows.Forms.Label label4;
private System.Windows.Forms.Panel CoreInfoPanel;
private System.Windows.Forms.TextBox textBox1;
//private System.Windows.Forms.TextBox textBox1;
private System.Windows.Forms.Label VersionLabel;
private System.Windows.Forms.Button btnCopyHash;
private System.Windows.Forms.LinkLabel linkLabel2;

View File

@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">x86</Platform>
@ -10,7 +10,7 @@
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>BizHawk.Client.EmuHawk</RootNamespace>
<AssemblyName>EmuHawk</AssemblyName>
<TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
<TargetFrameworkVersion>v4.6.1</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<StartupObject>BizHawk.Client.EmuHawk.Program</StartupObject>
<IsWebBootstrapper>false</IsWebBootstrapper>
@ -36,42 +36,16 @@
<UseApplicationTrust>false</UseApplicationTrust>
<BootstrapperEnabled>true</BootstrapperEnabled>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|x86' ">
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>..\output\</OutputPath>
<DefineConstants>$(DefineConstants);DEBUG</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<PlatformTarget>x86</PlatformTarget>
<UseVSHostingProcess>false</UseVSHostingProcess>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<CodeAnalysisRuleSet>AllRules.ruleset</CodeAnalysisRuleSet>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|x86' ">
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>..\output\</OutputPath>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<PlatformTarget>x86</PlatformTarget>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<UseVSHostingProcess>false</UseVSHostingProcess>
<CodeAnalysisRuleSet>AllRules.ruleset</CodeAnalysisRuleSet>
<DefineConstants>WINDOWS</DefineConstants>
</PropertyGroup>
<PropertyGroup>
<NoWin32Manifest>true</NoWin32Manifest>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x64'">
<DebugSymbols>true</DebugSymbols>
<OutputPath>..\output64\</OutputPath>
<OutputPath>..\output\</OutputPath>
<DefineConstants>WINDOWS;DEBUG</DefineConstants>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<DebugType>full</DebugType>
<PlatformTarget>x64</PlatformTarget>
<CodeAnalysisLogFile>..\output\EmuHawk.exe.CodeAnalysisLog.xml</CodeAnalysisLogFile>
<CodeAnalysisUseTypeNameInSuppression>true</CodeAnalysisUseTypeNameInSuppression>
<CodeAnalysisModuleSuppressionsFile>GlobalSuppressions.cs</CodeAnalysisModuleSuppressionsFile>
<UseVSHostingProcess>false</UseVSHostingProcess>
@ -82,15 +56,15 @@
<CodeAnalysisRuleDirectories>;C:\Program Files (x86)\Microsoft Visual Studio 10.0\Team Tools\Static Analysis Tools\FxCop\\Rules</CodeAnalysisRuleDirectories>
<CodeAnalysisIgnoreBuiltInRules>true</CodeAnalysisIgnoreBuiltInRules>
<CodeAnalysisFailOnMissingRules>false</CodeAnalysisFailOnMissingRules>
<Prefer32Bit>false</Prefer32Bit>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|x64'">
<OutputPath>..\output64\</OutputPath>
<OutputPath>..\output\</OutputPath>
<DefineConstants>WINDOWS</DefineConstants>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<Optimize>true</Optimize>
<DebugType>pdbonly</DebugType>
<PlatformTarget>x64</PlatformTarget>
<CodeAnalysisLogFile>..\output\EmuHawk.exe.CodeAnalysisLog.xml</CodeAnalysisLogFile>
<CodeAnalysisUseTypeNameInSuppression>true</CodeAnalysisUseTypeNameInSuppression>
<CodeAnalysisModuleSuppressionsFile>GlobalSuppressions.cs</CodeAnalysisModuleSuppressionsFile>
<UseVSHostingProcess>false</UseVSHostingProcess>
@ -101,6 +75,7 @@
<CodeAnalysisRuleDirectories>;C:\Program Files (x86)\Microsoft Visual Studio 10.0\Team Tools\Static Analysis Tools\FxCop\\Rules</CodeAnalysisRuleDirectories>
<CodeAnalysisIgnoreBuiltInRules>true</CodeAnalysisIgnoreBuiltInRules>
<CodeAnalysisFailOnMissingRules>false</CodeAnalysisFailOnMissingRules>
<Prefer32Bit>false</Prefer32Bit>
</PropertyGroup>
<ItemGroup>
<Reference Include="GongShell">
@ -408,12 +383,6 @@
<Compile Include="config\N64\N64VideoPluginconfig.Designer.cs">
<DependentUpon>N64VideoPluginconfig.cs</DependentUpon>
</Compile>
<Compile Include="config\N64\NewN64PluginSettings.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="config\N64\NewN64PluginSettings.Designer.cs">
<DependentUpon>NewN64PluginSettings.cs</DependentUpon>
</Compile>
<Compile Include="config\NES\DataTableDictionaryBind.cs" />
<Compile Include="config\NES\NesControllerSettings.cs">
<SubType>Form</SubType>
@ -1215,6 +1184,7 @@
<Compile Include="tools\VirtualPads\schema\GenSchema.cs" />
<Compile Include="tools\VirtualPads\schema\IntvSchema.cs" />
<Compile Include="tools\VirtualPads\schema\LynxSchema.cs" />
<Compile Include="tools\VirtualPads\schema\NgpSchema.cs" />
<Compile Include="tools\VirtualPads\schema\PSXSchema.cs" />
<Compile Include="tools\VirtualPads\schema\SatSchema.cs" />
<Compile Include="tools\VirtualPads\schema\IVirtualPadSchema.cs" />
@ -1225,6 +1195,7 @@
<Compile Include="tools\VirtualPads\schema\SchemaAttributes.cs" />
<Compile Include="tools\VirtualPads\schema\SmsSchema.cs" />
<Compile Include="tools\VirtualPads\schema\SnesSchema.cs" />
<Compile Include="tools\VirtualPads\schema\VirtualBoySchema.cs" />
<Compile Include="tools\VirtualPads\schema\WonderSwanSchema.cs" />
<Compile Include="tools\VirtualPads\VirtualPad.cs">
<SubType>UserControl</SubType>
@ -1363,9 +1334,6 @@
<EmbeddedResource Include="config\N64\N64VideoPluginconfig.resx">
<DependentUpon>N64VideoPluginconfig.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="config\N64\NewN64PluginSettings.resx">
<DependentUpon>NewN64PluginSettings.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="config\NES\NesControllerSettings.resx">
<DependentUpon>NesControllerSettings.cs</DependentUpon>
</EmbeddedResource>
@ -1783,6 +1751,7 @@
</EmbeddedResource>
</ItemGroup>
<ItemGroup>
<None Include="app.config" />
<None Include="images\FindHS.png" />
</ItemGroup>
<ItemGroup>
@ -2109,6 +2078,7 @@
<None Include="images\LightOn.png" />
<None Include="images\Both.png" />
<None Include="config\ControllerImages\A78Joystick.png" />
<None Include="config\ControllerImages\VBoyController.png" />
<None Include="config\ControllerImages\IntVController.png" />
<None Include="config\ControllerImages\Lynx.png" />
<Content Include="config\ControllerImages\N64.png" />
@ -2137,6 +2107,7 @@
<None Include="images\ENE.png" />
<None Include="images\ESE.png" />
<None Include="images\5757344.png" />
<None Include="images\ControllerImages\NGPController.png" />
<Content Include="images\logo.ico" />
<None Include="images\Paste.png" />
<None Include="images\reboot.png" />

View File

@ -302,7 +302,7 @@ namespace BizHawk.Client.EmuHawk
out IntPtr ppavi,
ref AVISTREAMINFOW psi);
[StructLayout(LayoutKind.Sequential, Pack = 1)]
[StructLayout(LayoutKind.Sequential)]
public struct AVICOMPRESSOPTIONS
{
public int fccType;
@ -573,4 +573,4 @@ namespace BizHawk.Client.EmuHawk
}
}
}
}

View File

@ -36,10 +36,6 @@ namespace BizHawk.Client.EmuHawk.CoreExtensions
{
return Properties.Resources.bsnes;
}
else if (core is Yabause)
{
return Properties.Resources.yabause;
}
else if (core is Atari7800)
{
return Properties.Resources.emu7800;
@ -73,11 +69,6 @@ namespace BizHawk.Client.EmuHawk.CoreExtensions
var str = (!attributes.Released ? "(Experimental) " : "") +
attributes.CoreName;
if (core is LibsnesCore)
{
str += " (" + ((LibsnesCore)core).CurrentProfile + ")";
}
return str;
}
}

View File

@ -183,14 +183,19 @@
this.InputOverHkMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.HkOverInputMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.CoresSubMenu = new System.Windows.Forms.ToolStripMenuItem();
this.GBInSGBMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.NesInQuickNESMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.NesCoreSubMenu = new System.Windows.Forms.ToolStripMenuItem();
this.QuicknesCoreMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.NesCoreMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.CoreSNESSubMenu = new System.Windows.Forms.ToolStripMenuItem();
this.CorebsnesPerformanceMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.CorebsnesCompatibilityMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.CorebsnesAccuracyMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.Coresnes9xMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.gBAWithMGBAToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.CorebsnesMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.GbaCoreSubMenu = new System.Windows.Forms.ToolStripMenuItem();
this.VbaNextCoreMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.MgbaCoreMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.Atari7800CoreSubMenu = new System.Windows.Forms.ToolStripMenuItem();
this.Emu7800CoreMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.Atari7800HawkCoreMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.GBInSGBMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.toolStripMenuItem16 = new System.Windows.Forms.ToolStripSeparator();
this.allowGameDBCoreOverridesToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.toolStripSeparator8 = new System.Windows.Forms.ToolStripSeparator();
@ -312,15 +317,6 @@
this.PSXDiscControlsMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.PSXHashDiscsToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.SNESSubMenu = new System.Windows.Forms.ToolStripMenuItem();
this.SNESDisplayMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.SnesBg1MenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.SnesBg2MenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.SnesBg3MenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.SnesBg4MenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.SnesObj1MenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.SnesObj2MenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.SnesObj3MenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.SnesObj4MenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.SNESControllerConfigurationMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.toolStripSeparator18 = new System.Windows.Forms.ToolStripSeparator();
this.SnesGfxDebuggerMenuItem = new System.Windows.Forms.ToolStripMenuItem();
@ -359,6 +355,12 @@
this.C64SettingsMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.IntvSubMenu = new System.Windows.Forms.ToolStripMenuItem();
this.IntVControllerSettingsMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.sNESToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.preferencesToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.virtualBoyToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.preferencesToolStripMenuItem1 = new System.Windows.Forms.ToolStripMenuItem();
this.neoGeoPocketToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.preferencesToolStripMenuItem2 = new System.Windows.Forms.ToolStripMenuItem();
this.HelpSubMenu = new System.Windows.Forms.ToolStripMenuItem();
this.OnlineHelpMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.ForumsMenuItem = new System.Windows.Forms.ToolStripMenuItem();
@ -426,9 +428,6 @@
this.SavestateTypeDefaultContextMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.SavestateBinaryContextMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.SavestateTextContextMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.CoreSelectionContextSubMenu = new System.Windows.Forms.ToolStripMenuItem();
this.GBInSGBContextMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.NesInQuickNESContextMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.toolStripSeparator37 = new System.Windows.Forms.ToolStripSeparator();
this.toolStripMenuItem66 = new System.Windows.Forms.ToolStripMenuItem();
this.toolStripMenuItem67 = new System.Windows.Forms.ToolStripMenuItem();
@ -438,7 +437,6 @@
this.ShowMenuContextMenuSeparator = new System.Windows.Forms.ToolStripSeparator();
this.ShowMenuContextMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.timerMouseIdle = new System.Windows.Forms.Timer(this.components);
this.Atari7800WithEmu7800MenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.MainformMenu.SuspendLayout();
this.MainStatusBar.SuspendLayout();
this.MainFormContextMenu.SuspendLayout();
@ -472,11 +470,14 @@
this.AppleSubMenu,
this.C64SubMenu,
this.IntvSubMenu,
this.sNESToolStripMenuItem,
this.virtualBoyToolStripMenuItem,
this.neoGeoPocketToolStripMenuItem,
this.HelpSubMenu});
this.MainformMenu.LayoutStyle = System.Windows.Forms.ToolStripLayoutStyle.Flow;
this.MainformMenu.Location = new System.Drawing.Point(0, 0);
this.MainformMenu.Name = "MainformMenu";
this.MainformMenu.Size = new System.Drawing.Size(470, 61);
this.MainformMenu.Size = new System.Drawing.Size(470, 80);
this.MainformMenu.TabIndex = 0;
this.MainformMenu.Text = "menuStrip1";
this.MainformMenu.MenuActivate += new System.EventHandler(this.MainformMenu_MenuActivate);
@ -1794,11 +1795,11 @@
// CoresSubMenu
//
this.CoresSubMenu.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
this.GBInSGBMenuItem,
this.NesInQuickNESMenuItem,
this.NesCoreSubMenu,
this.CoreSNESSubMenu,
this.gBAWithMGBAToolStripMenuItem,
this.Atari7800WithEmu7800MenuItem,
this.GbaCoreSubMenu,
this.Atari7800CoreSubMenu,
this.GBInSGBMenuItem,
this.toolStripMenuItem16,
this.allowGameDBCoreOverridesToolStripMenuItem,
this.toolStripSeparator8,
@ -1809,6 +1810,100 @@
this.CoresSubMenu.Text = "Cores";
this.CoresSubMenu.DropDownOpened += new System.EventHandler(this.CoresSubMenu_DropDownOpened);
//
// NesCoreSubMenu
//
this.NesCoreSubMenu.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
this.QuicknesCoreMenuItem,
this.NesCoreMenuItem});
this.NesCoreSubMenu.Name = "NesCoreSubMenu";
this.NesCoreSubMenu.Size = new System.Drawing.Size(239, 22);
this.NesCoreSubMenu.Text = "NES";
this.NesCoreSubMenu.DropDownOpened += new System.EventHandler(this.NesCoreSubMenu_DropDownOpened);
//
// QuicknesCoreMenuItem
//
this.QuicknesCoreMenuItem.Name = "QuicknesCoreMenuItem";
this.QuicknesCoreMenuItem.Size = new System.Drawing.Size(152, 22);
this.QuicknesCoreMenuItem.Text = "QuickNES";
//
// NesCoreMenuItem
//
this.NesCoreMenuItem.Name = "NesCoreMenuItem";
this.NesCoreMenuItem.Size = new System.Drawing.Size(152, 22);
this.NesCoreMenuItem.Text = "NesHawk";
//
// CoreSNESSubMenu
//
this.CoreSNESSubMenu.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
this.Coresnes9xMenuItem,
this.CorebsnesMenuItem});
this.CoreSNESSubMenu.Name = "CoreSNESSubMenu";
this.CoreSNESSubMenu.Size = new System.Drawing.Size(239, 22);
this.CoreSNESSubMenu.Text = "SNES";
this.CoreSNESSubMenu.DropDownOpened += new System.EventHandler(this.CoreSNESSubMenu_DropDownOpened);
//
// Coresnes9xMenuItem
//
this.Coresnes9xMenuItem.Name = "Coresnes9xMenuItem";
this.Coresnes9xMenuItem.Size = new System.Drawing.Size(152, 22);
this.Coresnes9xMenuItem.Text = "Snes9x";
this.Coresnes9xMenuItem.Click += new System.EventHandler(this.CoreSnesToggle_Click);
//
// CorebsnesMenuItem
//
this.CorebsnesMenuItem.Name = "CorebsnesMenuItem";
this.CorebsnesMenuItem.Size = new System.Drawing.Size(152, 22);
this.CorebsnesMenuItem.Text = "BSNES";
this.CorebsnesMenuItem.Click += new System.EventHandler(this.CoreSnesToggle_Click);
//
// GbaCoreSubMenu
//
this.GbaCoreSubMenu.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
this.VbaNextCoreMenuItem,
this.MgbaCoreMenuItem});
this.GbaCoreSubMenu.Name = "GbaCoreSubMenu";
this.GbaCoreSubMenu.Size = new System.Drawing.Size(239, 22);
this.GbaCoreSubMenu.Text = "GBA";
this.GbaCoreSubMenu.DropDownOpened += new System.EventHandler(this.GbaCoreSubMenu_DropDownOpened);
//
// VbaNextCoreMenuItem
//
this.VbaNextCoreMenuItem.Name = "VbaNextCoreMenuItem";
this.VbaNextCoreMenuItem.Size = new System.Drawing.Size(152, 22);
this.VbaNextCoreMenuItem.Text = "VBA-Next";
this.VbaNextCoreMenuItem.Click += new System.EventHandler(this.GbaCorePick_Click);
//
// MgbaCoreMenuItem
//
this.MgbaCoreMenuItem.Name = "MgbaCoreMenuItem";
this.MgbaCoreMenuItem.Size = new System.Drawing.Size(152, 22);
this.MgbaCoreMenuItem.Text = "mGBA";
this.MgbaCoreMenuItem.Click += new System.EventHandler(this.GbaCorePick_Click);
//
// Atari7800CoreSubMenu
//
this.Atari7800CoreSubMenu.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
this.Emu7800CoreMenuItem,
this.Atari7800HawkCoreMenuItem});
this.Atari7800CoreSubMenu.Name = "Atari7800CoreSubMenu";
this.Atari7800CoreSubMenu.Size = new System.Drawing.Size(239, 22);
this.Atari7800CoreSubMenu.Text = "Atari 7800";
this.Atari7800CoreSubMenu.DropDownOpened += new System.EventHandler(this.Atari7800CoreSubMenu_DropDownOpened);
//
// Emu7800CoreMenuItem
//
this.Emu7800CoreMenuItem.Name = "Emu7800CoreMenuItem";
this.Emu7800CoreMenuItem.Size = new System.Drawing.Size(153, 22);
this.Emu7800CoreMenuItem.Text = "EMU7800";
this.Emu7800CoreMenuItem.Click += new System.EventHandler(this.Atari7800CorePick_Click);
//
// Atari7800HawkCoreMenuItem
//
this.Atari7800HawkCoreMenuItem.Name = "Atari7800HawkCoreMenuItem";
this.Atari7800HawkCoreMenuItem.Size = new System.Drawing.Size(153, 22);
this.Atari7800HawkCoreMenuItem.Text = "Atari7800Hawk";
this.Atari7800HawkCoreMenuItem.Click += new System.EventHandler(this.Atari7800CorePick_Click);
//
// GBInSGBMenuItem
//
this.GBInSGBMenuItem.Name = "GBInSGBMenuItem";
@ -1816,60 +1911,6 @@
this.GBInSGBMenuItem.Text = "GB in SGB";
this.GBInSGBMenuItem.Click += new System.EventHandler(this.GbInSgbMenuItem_Click);
//
// NesInQuickNESMenuItem
//
this.NesInQuickNESMenuItem.Name = "NesInQuickNESMenuItem";
this.NesInQuickNESMenuItem.Size = new System.Drawing.Size(239, 22);
this.NesInQuickNESMenuItem.Text = "NES with QuickNES";
this.NesInQuickNESMenuItem.Click += new System.EventHandler(this.NesInQuickNESMenuItem_Click);
//
// CoreSNESSubMenu
//
this.CoreSNESSubMenu.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
this.CorebsnesPerformanceMenuItem,
this.CorebsnesCompatibilityMenuItem,
this.CorebsnesAccuracyMenuItem,
this.Coresnes9xMenuItem});
this.CoreSNESSubMenu.Name = "CoreSNESSubMenu";
this.CoreSNESSubMenu.Size = new System.Drawing.Size(239, 22);
this.CoreSNESSubMenu.Text = "SNES";
this.CoreSNESSubMenu.DropDownOpened += new System.EventHandler(this.CoreSNESSubMenu_DropDownOpened);
//
// CorebsnesPerformanceMenuItem
//
this.CorebsnesPerformanceMenuItem.Name = "CorebsnesPerformanceMenuItem";
this.CorebsnesPerformanceMenuItem.Size = new System.Drawing.Size(177, 22);
this.CorebsnesPerformanceMenuItem.Text = "bsnes performance";
this.CorebsnesPerformanceMenuItem.Click += new System.EventHandler(this.CorebsnesPerformanceMenuItem_Click);
//
// CorebsnesCompatibilityMenuItem
//
this.CorebsnesCompatibilityMenuItem.Name = "CorebsnesCompatibilityMenuItem";
this.CorebsnesCompatibilityMenuItem.Size = new System.Drawing.Size(177, 22);
this.CorebsnesCompatibilityMenuItem.Text = "bsnes compatibility";
this.CorebsnesCompatibilityMenuItem.Click += new System.EventHandler(this.CorebsnesCompatibilityMenuItem_Click);
//
// CorebsnesAccuracyMenuItem
//
this.CorebsnesAccuracyMenuItem.Enabled = false;
this.CorebsnesAccuracyMenuItem.Name = "CorebsnesAccuracyMenuItem";
this.CorebsnesAccuracyMenuItem.Size = new System.Drawing.Size(177, 22);
this.CorebsnesAccuracyMenuItem.Text = "bsnes accuracy";
//
// Coresnes9xMenuItem
//
this.Coresnes9xMenuItem.Name = "Coresnes9xMenuItem";
this.Coresnes9xMenuItem.Size = new System.Drawing.Size(177, 22);
this.Coresnes9xMenuItem.Text = "Snes9x";
this.Coresnes9xMenuItem.Click += new System.EventHandler(this.CoreSnes9xMenuItem_Click);
//
// gBAWithMGBAToolStripMenuItem
//
this.gBAWithMGBAToolStripMenuItem.Name = "gBAWithMGBAToolStripMenuItem";
this.gBAWithMGBAToolStripMenuItem.Size = new System.Drawing.Size(239, 22);
this.gBAWithMGBAToolStripMenuItem.Text = "GBA with mGBA";
this.gBAWithMGBAToolStripMenuItem.Click += new System.EventHandler(this.GbaWithmGBAMenuItem_Click);
//
// toolStripMenuItem16
//
this.toolStripMenuItem16.Name = "toolStripMenuItem16";
@ -2510,7 +2551,7 @@
//
this.SMSenableBIOSToolStripMenuItem.Name = "SMSenableBIOSToolStripMenuItem";
this.SMSenableBIOSToolStripMenuItem.Size = new System.Drawing.Size(241, 22);
this.SMSenableBIOSToolStripMenuItem.Text = "Enable BIOS";
this.SMSenableBIOSToolStripMenuItem.Text = "Enable BIOS (Must be Enabled for TAS)";
this.SMSenableBIOSToolStripMenuItem.Click += new System.EventHandler(this.SmsBiosMenuItem_Click);
//
// SMSEnableFMChipMenuItem
@ -2819,7 +2860,6 @@
// SNESSubMenu
//
this.SNESSubMenu.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
this.SNESDisplayMenuItem,
this.SNESControllerConfigurationMenuItem,
this.toolStripSeparator18,
this.SnesGfxDebuggerMenuItem,
@ -2831,78 +2871,6 @@
this.SNESSubMenu.Text = "&SNES";
this.SNESSubMenu.DropDownOpened += new System.EventHandler(this.SNESSubMenu_DropDownOpened);
//
// SNESDisplayMenuItem
//
this.SNESDisplayMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
this.SnesBg1MenuItem,
this.SnesBg2MenuItem,
this.SnesBg3MenuItem,
this.SnesBg4MenuItem,
this.SnesObj1MenuItem,
this.SnesObj2MenuItem,
this.SnesObj3MenuItem,
this.SnesObj4MenuItem});
this.SNESDisplayMenuItem.Name = "SNESDisplayMenuItem";
this.SNESDisplayMenuItem.Size = new System.Drawing.Size(233, 22);
this.SNESDisplayMenuItem.Text = "Display";
this.SNESDisplayMenuItem.DropDownOpened += new System.EventHandler(this.SNESDisplayMenuItem_DropDownOpened);
//
// SnesBg1MenuItem
//
this.SnesBg1MenuItem.Name = "SnesBg1MenuItem";
this.SnesBg1MenuItem.Size = new System.Drawing.Size(103, 22);
this.SnesBg1MenuItem.Text = "BG 1";
this.SnesBg1MenuItem.Click += new System.EventHandler(this.SnesBg1MenuItem_Click);
//
// SnesBg2MenuItem
//
this.SnesBg2MenuItem.Name = "SnesBg2MenuItem";
this.SnesBg2MenuItem.Size = new System.Drawing.Size(103, 22);
this.SnesBg2MenuItem.Text = "BG 2";
this.SnesBg2MenuItem.Click += new System.EventHandler(this.SnesBg2MenuItem_Click);
//
// SnesBg3MenuItem
//
this.SnesBg3MenuItem.Name = "SnesBg3MenuItem";
this.SnesBg3MenuItem.Size = new System.Drawing.Size(103, 22);
this.SnesBg3MenuItem.Text = "BG 3";
this.SnesBg3MenuItem.Click += new System.EventHandler(this.SnesBg3MenuItem_Click);
//
// SnesBg4MenuItem
//
this.SnesBg4MenuItem.Name = "SnesBg4MenuItem";
this.SnesBg4MenuItem.Size = new System.Drawing.Size(103, 22);
this.SnesBg4MenuItem.Text = "BG 4";
this.SnesBg4MenuItem.Click += new System.EventHandler(this.SnesBg4MenuItem_Click);
//
// SnesObj1MenuItem
//
this.SnesObj1MenuItem.Name = "SnesObj1MenuItem";
this.SnesObj1MenuItem.Size = new System.Drawing.Size(103, 22);
this.SnesObj1MenuItem.Text = "OBJ 1";
this.SnesObj1MenuItem.Click += new System.EventHandler(this.SnesObj1MenuItem_Click);
//
// SnesObj2MenuItem
//
this.SnesObj2MenuItem.Name = "SnesObj2MenuItem";
this.SnesObj2MenuItem.Size = new System.Drawing.Size(103, 22);
this.SnesObj2MenuItem.Text = "OBJ 2";
this.SnesObj2MenuItem.Click += new System.EventHandler(this.SnesObj2MenuItem_Click);
//
// SnesObj3MenuItem
//
this.SnesObj3MenuItem.Name = "SnesObj3MenuItem";
this.SnesObj3MenuItem.Size = new System.Drawing.Size(103, 22);
this.SnesObj3MenuItem.Text = "OBJ 3";
this.SnesObj3MenuItem.Click += new System.EventHandler(this.SnesObj3MenuItem_Click);
//
// SnesObj4MenuItem
//
this.SnesObj4MenuItem.Name = "SnesObj4MenuItem";
this.SnesObj4MenuItem.Size = new System.Drawing.Size(103, 22);
this.SnesObj4MenuItem.Text = "OBJ 4";
this.SnesObj4MenuItem.Click += new System.EventHandler(this.SnesObj4MenuItem_Click);
//
// SNESControllerConfigurationMenuItem
//
this.SNESControllerConfigurationMenuItem.Image = global::BizHawk.Client.EmuHawk.Properties.Resources.GameController;
@ -3193,6 +3161,51 @@
this.IntVControllerSettingsMenuItem.Text = "Controller Settings...";
this.IntVControllerSettingsMenuItem.Click += new System.EventHandler(this.IntVControllerSettingsMenuItem_Click);
//
// sNESToolStripMenuItem
//
this.sNESToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
this.preferencesToolStripMenuItem});
this.sNESToolStripMenuItem.Name = "sNESToolStripMenuItem";
this.sNESToolStripMenuItem.Size = new System.Drawing.Size(46, 19);
this.sNESToolStripMenuItem.Text = "&SNES";
//
// preferencesToolStripMenuItem
//
this.preferencesToolStripMenuItem.Name = "preferencesToolStripMenuItem";
this.preferencesToolStripMenuItem.Size = new System.Drawing.Size(144, 22);
this.preferencesToolStripMenuItem.Text = "Preferences...";
this.preferencesToolStripMenuItem.Click += new System.EventHandler(this.preferencesToolStripMenuItem_Click);
//
// virtualBoyToolStripMenuItem
//
this.virtualBoyToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
this.preferencesToolStripMenuItem1});
this.virtualBoyToolStripMenuItem.Name = "virtualBoyToolStripMenuItem";
this.virtualBoyToolStripMenuItem.Size = new System.Drawing.Size(73, 19);
this.virtualBoyToolStripMenuItem.Text = "&VirtualBoy";
//
// preferencesToolStripMenuItem1
//
this.preferencesToolStripMenuItem1.Name = "preferencesToolStripMenuItem1";
this.preferencesToolStripMenuItem1.Size = new System.Drawing.Size(144, 22);
this.preferencesToolStripMenuItem1.Text = "Preferences...";
this.preferencesToolStripMenuItem1.Click += new System.EventHandler(this.preferencesToolStripMenuItem1_Click);
//
// neoGeoPocketToolStripMenuItem
//
this.neoGeoPocketToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
this.preferencesToolStripMenuItem2});
this.neoGeoPocketToolStripMenuItem.Name = "neoGeoPocketToolStripMenuItem";
this.neoGeoPocketToolStripMenuItem.Size = new System.Drawing.Size(101, 19);
this.neoGeoPocketToolStripMenuItem.Text = "&NeoGeo Pocket";
//
// preferencesToolStripMenuItem2
//
this.preferencesToolStripMenuItem2.Name = "preferencesToolStripMenuItem2";
this.preferencesToolStripMenuItem2.Size = new System.Drawing.Size(144, 22);
this.preferencesToolStripMenuItem2.Text = "Preferences...";
this.preferencesToolStripMenuItem2.Click += new System.EventHandler(this.preferencesToolStripMenuItem2_Click);
//
// HelpSubMenu
//
this.HelpSubMenu.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
@ -3509,7 +3522,7 @@
this.ShowMenuContextMenuSeparator,
this.ShowMenuContextMenuItem});
this.MainFormContextMenu.Name = "contextMenuStrip1";
this.MainFormContextMenu.Size = new System.Drawing.Size(217, 490);
this.MainFormContextMenu.Size = new System.Drawing.Size(217, 512);
this.MainFormContextMenu.Closing += new System.Windows.Forms.ToolStripDropDownClosingEventHandler(this.MainFormContextMenu_Closing);
this.MainFormContextMenu.Opening += new System.ComponentModel.CancelEventHandler(this.MainFormContextMenu_Opening);
//
@ -3668,7 +3681,6 @@
this.customizeToolStripMenuItem,
this.toolStripSeparator30,
this.SavestateTypeContextSubMenu,
this.CoreSelectionContextSubMenu,
this.toolStripSeparator37,
this.toolStripMenuItem66,
this.toolStripMenuItem67});
@ -3796,30 +3808,6 @@
this.SavestateTextContextMenuItem.Size = new System.Drawing.Size(112, 22);
this.SavestateTextContextMenuItem.Text = "&Text";
//
// CoreSelectionContextSubMenu
//
this.CoreSelectionContextSubMenu.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
this.GBInSGBContextMenuItem,
this.NesInQuickNESContextMenuItem});
this.CoreSelectionContextSubMenu.Name = "CoreSelectionContextSubMenu";
this.CoreSelectionContextSubMenu.Size = new System.Drawing.Size(159, 22);
this.CoreSelectionContextSubMenu.Text = "Core Selection";
this.CoreSelectionContextSubMenu.DropDownOpened += new System.EventHandler(this.CoreSelectionContextSubMenu_DropDownOpened);
//
// GBInSGBContextMenuItem
//
this.GBInSGBContextMenuItem.Name = "GBInSGBContextMenuItem";
this.GBInSGBContextMenuItem.Size = new System.Drawing.Size(163, 22);
this.GBInSGBContextMenuItem.Text = "GB in SGB";
this.GBInSGBContextMenuItem.Click += new System.EventHandler(this.GbInSgbMenuItem_Click);
//
// NesInQuickNESContextMenuItem
//
this.NesInQuickNESContextMenuItem.Name = "NesInQuickNESContextMenuItem";
this.NesInQuickNESContextMenuItem.Size = new System.Drawing.Size(163, 22);
this.NesInQuickNESContextMenuItem.Text = "NES in QuickNES";
this.NesInQuickNESContextMenuItem.Click += new System.EventHandler(this.NesInQuickNESMenuItem_Click);
//
// toolStripSeparator37
//
this.toolStripSeparator37.Name = "toolStripSeparator37";
@ -3882,13 +3870,6 @@
this.timerMouseIdle.Interval = 2000;
this.timerMouseIdle.Tick += new System.EventHandler(this.TimerMouseIdle_Tick);
//
// Atari7800WithEmu7800MenuItem
//
this.Atari7800WithEmu7800MenuItem.Name = "Atari7800WithEmu7800MenuItem";
this.Atari7800WithEmu7800MenuItem.Size = new System.Drawing.Size(239, 22);
this.Atari7800WithEmu7800MenuItem.Text = "Atari 7800 with Emu7800";
this.Atari7800WithEmu7800MenuItem.Click += new System.EventHandler(this.Atari7800WithEmu7800MenuItem_Click);
//
// MainForm
//
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.None;
@ -4121,15 +4102,6 @@
private System.Windows.Forms.ToolStripMenuItem SNESSubMenu;
private System.Windows.Forms.ToolStripMenuItem SnesGfxDebuggerMenuItem;
private System.Windows.Forms.ToolStripSeparator toolStripSeparator18;
private System.Windows.Forms.ToolStripMenuItem SNESDisplayMenuItem;
private System.Windows.Forms.ToolStripMenuItem SnesBg1MenuItem;
private System.Windows.Forms.ToolStripMenuItem SnesBg2MenuItem;
private System.Windows.Forms.ToolStripMenuItem SnesBg3MenuItem;
private System.Windows.Forms.ToolStripMenuItem SnesBg4MenuItem;
private System.Windows.Forms.ToolStripMenuItem SnesObj1MenuItem;
private System.Windows.Forms.ToolStripMenuItem SnesObj2MenuItem;
private System.Windows.Forms.ToolStripMenuItem SnesObj3MenuItem;
private System.Windows.Forms.ToolStripMenuItem SnesObj4MenuItem;
private System.Windows.Forms.ToolStripMenuItem HardResetMenuItem;
private System.Windows.Forms.ToolStripSeparator toolStripSeparator19;
private System.Windows.Forms.ToolStripMenuItem CaptureOSDMenuItem;
@ -4191,7 +4163,6 @@
private System.Windows.Forms.ToolStripMenuItem MovieSettingsMenuItem;
private System.Windows.Forms.ToolStripMenuItem CoresSubMenu;
private System.Windows.Forms.ToolStripMenuItem GBInSGBMenuItem;
private System.Windows.Forms.ToolStripMenuItem NesInQuickNESMenuItem;
private System.Windows.Forms.ToolStripMenuItem batchRunnerToolStripMenuItem;
private System.Windows.Forms.ToolStripMenuItem DisplayConfigMenuItem;
private System.Windows.Forms.ToolStripMenuItem PCEtileViewerToolStripMenuItem;
@ -4226,9 +4197,6 @@
private System.Windows.Forms.ToolStripMenuItem SavestateTypeDefaultContextMenuItem;
private System.Windows.Forms.ToolStripMenuItem SavestateBinaryContextMenuItem;
private System.Windows.Forms.ToolStripMenuItem SavestateTextContextMenuItem;
private System.Windows.Forms.ToolStripMenuItem CoreSelectionContextSubMenu;
private System.Windows.Forms.ToolStripMenuItem GBInSGBContextMenuItem;
private System.Windows.Forms.ToolStripMenuItem NesInQuickNESContextMenuItem;
private System.Windows.Forms.ToolStripSeparator toolStripSeparator37;
private System.Windows.Forms.ToolStripMenuItem toolStripMenuItem66;
private System.Windows.Forms.ToolStripMenuItem toolStripMenuItem67;
@ -4286,7 +4254,6 @@
private System.Windows.Forms.ToolStripMenuItem GBACoreSelectionSubMenu;
private System.Windows.Forms.ToolStripMenuItem GBAmGBAMenuItem;
private System.Windows.Forms.ToolStripMenuItem GBAVBANextMenuItem;
private System.Windows.Forms.ToolStripMenuItem gBAWithMGBAToolStripMenuItem;
private System.Windows.Forms.ToolStripMenuItem settingsToolStripMenuItem1;
private System.Windows.Forms.ToolStripMenuItem PSXHashDiscsToolStripMenuItem;
private System.Windows.Forms.Timer timerMouseIdle;
@ -4326,10 +4293,8 @@
private System.Windows.Forms.ToolStripMenuItem VSServiceSwitchMenuItem;
private System.Windows.Forms.ToolStripMenuItem VSSettingsMenuItem;
private System.Windows.Forms.ToolStripMenuItem CoreSNESSubMenu;
private System.Windows.Forms.ToolStripMenuItem CorebsnesPerformanceMenuItem;
private System.Windows.Forms.ToolStripMenuItem CorebsnesCompatibilityMenuItem;
private System.Windows.Forms.ToolStripMenuItem CorebsnesMenuItem;
private System.Windows.Forms.ToolStripMenuItem Coresnes9xMenuItem;
private System.Windows.Forms.ToolStripMenuItem CorebsnesAccuracyMenuItem;
private System.Windows.Forms.ToolStripMenuItem allowGameDBCoreOverridesToolStripMenuItem;
private System.Windows.Forms.ToolStripSeparator toolStripMenuItem16;
private System.Windows.Forms.ToolStripMenuItem IntvSubMenu;
@ -4338,6 +4303,20 @@
private System.Windows.Forms.ToolStripSeparator toolStripSeparator35;
private System.Windows.Forms.ToolStripMenuItem C64DisksSubMenu;
private System.Windows.Forms.ToolStripSeparator toolStripSeparator36;
private System.Windows.Forms.ToolStripMenuItem Atari7800WithEmu7800MenuItem;
private System.Windows.Forms.ToolStripMenuItem sNESToolStripMenuItem;
private System.Windows.Forms.ToolStripMenuItem preferencesToolStripMenuItem;
private System.Windows.Forms.ToolStripMenuItem virtualBoyToolStripMenuItem;
private System.Windows.Forms.ToolStripMenuItem preferencesToolStripMenuItem1;
private System.Windows.Forms.ToolStripMenuItem neoGeoPocketToolStripMenuItem;
private System.Windows.Forms.ToolStripMenuItem preferencesToolStripMenuItem2;
private System.Windows.Forms.ToolStripMenuItem NesCoreSubMenu;
private System.Windows.Forms.ToolStripMenuItem QuicknesCoreMenuItem;
private System.Windows.Forms.ToolStripMenuItem NesCoreMenuItem;
private System.Windows.Forms.ToolStripMenuItem GbaCoreSubMenu;
private System.Windows.Forms.ToolStripMenuItem VbaNextCoreMenuItem;
private System.Windows.Forms.ToolStripMenuItem MgbaCoreMenuItem;
private System.Windows.Forms.ToolStripMenuItem Atari7800CoreSubMenu;
private System.Windows.Forms.ToolStripMenuItem Emu7800CoreMenuItem;
private System.Windows.Forms.ToolStripMenuItem Atari7800HawkCoreMenuItem;
}
}

View File

@ -473,34 +473,29 @@ namespace BizHawk.Client.EmuHawk
return;
}
}
else if (Emulator is LibsnesCore)
else if (Emulator is Snes9x)
{
var snes = (LibsnesCore)Emulator;
if (snes.CurrentProfile == "Performance")
var box = new MsgBox(
"While the Snes9x core is faster, it is not nearly as accurate as bsnes. \nIt is recommended that you switch to the bsnes core for movie recording\nSwitch to bsnes?",
"Accuracy Warning",
MessageBoxIcon.Warning);
box.SetButtons(
new[] { "Switch", "Cancel" },
new[] { DialogResult.Yes, DialogResult.Cancel });
box.MaximumSize = new Size(475, 350);
box.SetMessageToAutoSize();
var result = box.ShowDialog();
if (result == DialogResult.Yes)
{
var box = new MsgBox(
"While the performance core is faster, it is not stable enough for movie recording\n\nSwitch to Compatibility?",
"Stability Warning",
MessageBoxIcon.Warning);
box.SetButtons(
new[] { "Switch", "Cancel" },
new[] { DialogResult.Yes, DialogResult.Cancel });
box.MaximumSize = new Size(450, 350);
box.SetMessageToAutoSize();
var result = box.ShowDialog();
if (result == DialogResult.Yes)
{
var ss = snes.GetSyncSettings();
ss.Profile = "Compatibility";
snes.PutSyncSettings(ss);
}
else if (result == DialogResult.Cancel)
{
return;
}
Global.Config.SNES_InSnes9x = false;
RebootCore();
}
else if (result == DialogResult.Cancel)
{
return;
}
}
@ -1189,94 +1184,82 @@ namespace BizHawk.Client.EmuHawk
UpdateKeyPriorityIcon();
}
private void GbInSgbMenuItem_Click(object sender, EventArgs e)
private void CoresSubMenu_DropDownOpened(object sender, EventArgs e)
{
Global.Config.GB_AsSGB ^= true;
if (!Emulator.IsNull())
{
FlagNeedsReboot();
}
Atari7800CoreSubMenu.Visible = VersionInfo.DeveloperBuild;
GBInSGBMenuItem.Checked = Global.Config.GB_AsSGB;
allowGameDBCoreOverridesToolStripMenuItem.Checked = Global.Config.CoreForcingViaGameDB;
}
private void NesInQuickNESMenuItem_Click(object sender, EventArgs e)
private void NesCoreSubMenu_DropDownOpened(object sender, EventArgs e)
{
QuicknesCoreMenuItem.Checked = Global.Config.NES_InQuickNES;
NesCoreMenuItem.Checked = !Global.Config.NES_InQuickNES;
}
private void NesCorePick_Click(object sender, EventArgs e)
{
Global.Config.NES_InQuickNES ^= true;
if (!Emulator.IsNull())
if (Emulator.SystemId == "NES")
{
FlagNeedsReboot();
}
}
private void CoresSubMenu_DropDownOpened(object sender, EventArgs e)
{
Atari7800WithEmu7800MenuItem.Visible = VersionInfo.DeveloperBuild; // Don't expose Atari7800Hawk in releases yet
GBInSGBMenuItem.Checked = Global.Config.GB_AsSGB;
NesInQuickNESMenuItem.Checked = Global.Config.NES_InQuickNES;
gBAWithMGBAToolStripMenuItem.Checked = Global.Config.GBA_UsemGBA;
Atari7800WithEmu7800MenuItem.Checked = Global.Config.A78_UseEmu7800;
allowGameDBCoreOverridesToolStripMenuItem.Checked = Global.Config.CoreForcingViaGameDB;
}
private void CoreSNESSubMenu_DropDownOpened(object sender, EventArgs e)
{
Coresnes9xMenuItem.Checked = Global.Config.SNES_InSnes9x;
Coresnes9xMenuItem.Visible = VersionInfo.DeveloperBuild;
LibsnesCore.SnesSyncSettings sss = (LibsnesCore.SnesSyncSettings)Global.Config.GetCoreSyncSettings<LibsnesCore>()
?? new LibsnesCore.SnesSyncSettings();
CorebsnesPerformanceMenuItem.Checked = sss.Profile == "Performance";
CorebsnesCompatibilityMenuItem.Checked = sss.Profile == "Compatibility";
CorebsnesMenuItem.Checked = !Global.Config.SNES_InSnes9x;
}
private void CorebsnesPerformanceMenuItem_Click(object sender, EventArgs e)
{
LibsnesCore.SnesSyncSettings sss = (LibsnesCore.SnesSyncSettings)Global.Config.GetCoreSyncSettings<LibsnesCore>()
?? new LibsnesCore.SnesSyncSettings();
string orig = sss.Profile;
sss.Profile = "Performance";
Global.Config.PutCoreSyncSettings<LibsnesCore>(sss);
if (Emulator is LibsnesCore && orig != sss.Profile)
{
FlagNeedsReboot();
}
}
private void CorebsnesCompatibilityMenuItem_Click(object sender, EventArgs e)
{
LibsnesCore.SnesSyncSettings sss = (LibsnesCore.SnesSyncSettings)Global.Config.GetCoreSyncSettings<LibsnesCore>()
?? new LibsnesCore.SnesSyncSettings();
string orig = sss.Profile;
sss.Profile = "Compatibility";
Global.Config.PutCoreSyncSettings<LibsnesCore>(sss);
if (Emulator is LibsnesCore && orig != sss.Profile)
{
FlagNeedsReboot();
}
}
private void CoreSnes9xMenuItem_Click(object sender, EventArgs e)
private void CoreSnesToggle_Click(object sender, EventArgs e)
{
Global.Config.SNES_InSnes9x ^= true;
if (Emulator is Snes9x || Emulator is LibsnesCore)
if (Emulator.SystemId == "SNES")
{
FlagNeedsReboot();
}
}
private void Atari7800WithEmu7800MenuItem_Click(object sender, EventArgs e)
private void GbaCoreSubMenu_DropDownOpened(object sender, EventArgs e)
{
VbaNextCoreMenuItem.Checked = Global.Config.GBA_UsemGBA;
MgbaCoreMenuItem.Checked = !Global.Config.GBA_UsemGBA;
}
private void GbaCorePick_Click(object sender, EventArgs e)
{
Global.Config.GBA_UsemGBA ^= true;
if (Emulator.SystemId == "GBA")
{
FlagNeedsReboot();
}
}
private void Atari7800CoreSubMenu_DropDownOpened(object sender, EventArgs e)
{
Emu7800CoreMenuItem.Checked = Global.Config.A78_UseEmu7800;
Atari7800HawkCoreMenuItem.Checked = !Global.Config.A78_UseEmu7800;
}
private void Atari7800CorePick_Click(object sender, EventArgs e)
{
Global.Config.A78_UseEmu7800 ^= true;
if (Emulator is A7800Hawk || Emulator is Atari7800)
if (Emulator.SystemId == "A78")
{
FlagNeedsReboot();
}
}
private void GbInSgbMenuItem_Click(object sender, EventArgs e)
{
Global.Config.GB_AsSGB ^= true;
if (!Emulator.IsNull())
{
FlagNeedsReboot();
}
@ -2106,71 +2089,6 @@ namespace BizHawk.Client.EmuHawk
SNESControllerConfigurationMenuItem.Enabled = !Global.MovieSession.Movie.IsActive;
}
private void SNESDisplayMenuItem_DropDownOpened(object sender, EventArgs e)
{
var s = ((LibsnesCore)Emulator).GetSettings();
SnesBg1MenuItem.Checked = s.ShowBG1_1;
SnesBg2MenuItem.Checked = s.ShowBG2_1;
SnesBg3MenuItem.Checked = s.ShowBG3_1;
SnesBg4MenuItem.Checked = s.ShowBG4_1;
SnesObj1MenuItem.Checked = s.ShowOBJ_0;
SnesObj2MenuItem.Checked = s.ShowOBJ_1;
SnesObj3MenuItem.Checked = s.ShowOBJ_2;
SnesObj4MenuItem.Checked = s.ShowOBJ_3;
SnesBg1MenuItem.ShortcutKeyDisplayString = Global.Config.HotkeyBindings["Toggle BG 1"].Bindings;
SnesBg2MenuItem.ShortcutKeyDisplayString = Global.Config.HotkeyBindings["Toggle BG 2"].Bindings;
SnesBg3MenuItem.ShortcutKeyDisplayString = Global.Config.HotkeyBindings["Toggle BG 3"].Bindings;
SnesBg4MenuItem.ShortcutKeyDisplayString = Global.Config.HotkeyBindings["Toggle BG 4"].Bindings;
SnesObj1MenuItem.ShortcutKeyDisplayString = Global.Config.HotkeyBindings["Toggle OBJ 1"].Bindings;
SnesObj2MenuItem.ShortcutKeyDisplayString = Global.Config.HotkeyBindings["Toggle OBJ 2"].Bindings;
SnesObj3MenuItem.ShortcutKeyDisplayString = Global.Config.HotkeyBindings["Toggle OBJ 3"].Bindings;
SnesObj4MenuItem.ShortcutKeyDisplayString = Global.Config.HotkeyBindings["Toggle OBJ 4"].Bindings;
}
private void SnesBg1MenuItem_Click(object sender, EventArgs e)
{
SNES_ToggleBG1();
}
private void SnesBg2MenuItem_Click(object sender, EventArgs e)
{
SNES_ToggleBG2();
}
private void SnesBg3MenuItem_Click(object sender, EventArgs e)
{
SNES_ToggleBG3();
}
private void SnesBg4MenuItem_Click(object sender, EventArgs e)
{
SNES_ToggleBG4();
}
private void SnesObj1MenuItem_Click(object sender, EventArgs e)
{
SNES_ToggleObj1();
}
private void SnesObj2MenuItem_Click(object sender, EventArgs e)
{
SNES_ToggleObj2();
}
private void SnesObj3MenuItem_Click(object sender, EventArgs e)
{
SNES_ToggleOBJ3();
}
private void SnesObj4MenuItem_Click(object sender, EventArgs e)
{
SNES_ToggleOBJ4();
}
private void SNESControllerConfigurationMenuItem_Click(object sender, EventArgs e)
{
new SNESControllerSettings().ShowDialog();
@ -2630,12 +2548,6 @@ namespace BizHawk.Client.EmuHawk
}
}
private void CoreSelectionContextSubMenu_DropDownOpened(object sender, EventArgs e)
{
GBInSGBContextMenuItem.Checked = Global.Config.GB_AsSGB;
NesInQuickNESContextMenuItem.Checked = Global.Config.NES_InQuickNES;
}
private void LoadLastRomContextMenuItem_Click(object sender, EventArgs e)
{
LoadRomFromRecent(Global.Config.RecentRoms.MostRecent);

View File

@ -611,28 +611,28 @@ namespace BizHawk.Client.EmuHawk
// SNES
case "Toggle BG 1":
SNES_ToggleBG1();
SNES_ToggleBg(1);
break;
case "Toggle BG 2":
SNES_ToggleBG2();
SNES_ToggleBg(2);
break;
case "Toggle BG 3":
SNES_ToggleBG3();
SNES_ToggleBg(3);
break;
case "Toggle BG 4":
SNES_ToggleBG4();
SNES_ToggleBg(4);
break;
case "Toggle OBJ 1":
SNES_ToggleObj1();
SNES_ToggleObj(1);
break;
case "Toggle OBJ 2":
SNES_ToggleObj2();
SNES_ToggleObj(2);
break;
case "Toggle OBJ 3":
SNES_ToggleOBJ3();
SNES_ToggleObj(3);
break;
case "Toggle OBJ 4":
SNES_ToggleOBJ4();
SNES_ToggleObj(4);
break;
// GB

View File

@ -30,6 +30,8 @@ using BizHawk.Client.EmuHawk.ToolExtensions;
using BizHawk.Client.EmuHawk.CoreExtensions;
using BizHawk.Client.ApiHawk;
using BizHawk.Emulation.Common.Base_Implementations;
using BizHawk.Emulation.Cores.Nintendo.SNES9X;
using BizHawk.Emulation.Cores.Consoles.SNK;
namespace BizHawk.Client.EmuHawk
{
@ -665,7 +667,7 @@ namespace BizHawk.Client.EmuHawk
public bool IsSeeking => PauseOnFrame.HasValue;
private bool IsTurboSeeking => PauseOnFrame.HasValue && Global.Config.TurboSeek;
private bool IsTurboing => Global.ClientControls["Turbo"] || IsTurboSeeking;
#endregion
@ -1257,173 +1259,122 @@ namespace BizHawk.Client.EmuHawk
private LibsnesCore AsSNES => Emulator as LibsnesCore;
// TODO: Clean Me!
private void SNES_ToggleBG1(bool? setto = null)
private void SNES_ToggleBg(int layer)
{
if (!(Emulator is LibsnesCore))
if (!(Emulator is LibsnesCore) && !(Emulator is Snes9x))
{
return;
}
var s = AsSNES.GetSettings();
if (setto.HasValue)
if (layer < 1 || layer > 4)
{
s.ShowBG1_1 = s.ShowBG1_0 = setto.Value;
}
else
{
s.ShowBG1_1 = s.ShowBG1_0 ^= true;
return;
}
AsSNES.PutSettings(s);
GlobalWin.OSD.AddMessage(s.ShowBG1_1 ? "BG 1 Layer On" : "BG 1 Layer Off");
bool result = false;
if (Emulator is LibsnesCore)
{
var s = ((LibsnesCore)Emulator).GetSettings();
switch (layer)
{
case 1:
result = s.ShowBG1_0 = s.ShowBG1_1 ^= true;
break;
case 2:
result = s.ShowBG2_0 = s.ShowBG2_1 ^= true;
break;
case 3:
result = s.ShowBG3_0 = s.ShowBG3_1 ^= true;
break;
case 4:
result = s.ShowBG4_0 = s.ShowBG4_1 ^= true;
break;
}
((LibsnesCore)Emulator).PutSettings(s);
}
else if (Emulator is Snes9x)
{
var s = ((Snes9x)Emulator).GetSettings();
switch (layer)
{
case 1:
result = s.ShowBg0 ^= true;
break;
case 2:
result = s.ShowBg1 ^= true;
break;
case 3:
result = s.ShowBg2 ^= true;
break;
case 4:
result = s.ShowBg3 ^= true;
break;
}
((Snes9x)Emulator).PutSettings(s);
}
GlobalWin.OSD.AddMessage($"BG {layer} Layer " + (result ? "On" : "Off"));
}
private void SNES_ToggleBG2(bool? setto = null)
private void SNES_ToggleObj(int layer)
{
if (!(Emulator is LibsnesCore))
if (!(Emulator is LibsnesCore) && !(Emulator is Snes9x))
{
return;
}
var s = AsSNES.GetSettings();
if (setto.HasValue)
{
s.ShowBG2_1 = s.ShowBG2_0 = setto.Value;
}
else
{
s.ShowBG2_1 = s.ShowBG2_0 ^= true;
}
AsSNES.PutSettings(s);
GlobalWin.OSD.AddMessage(s.ShowBG2_1 ? "BG 2 Layer On" : "BG 2 Layer Off");
}
private void SNES_ToggleBG3(bool? setto = null)
{
if (!(Emulator is LibsnesCore))
if (layer < 1 || layer > 4)
{
return;
}
var s = AsSNES.GetSettings();
if (setto.HasValue)
bool result = false;
if (Emulator is LibsnesCore)
{
s.ShowBG3_1 = s.ShowBG3_0 = setto.Value;
}
else
{
s.ShowBG3_1 = s.ShowBG3_0 ^= true;
}
var s = ((LibsnesCore)Emulator).GetSettings();
switch (layer)
{
case 1:
result = s.ShowOBJ_0 ^= true;
break;
case 2:
result = s.ShowOBJ_1 ^= true;
break;
case 3:
result = s.ShowOBJ_2 ^= true;
break;
case 4:
result = s.ShowOBJ_3 ^= true;
break;
}
AsSNES.PutSettings(s);
GlobalWin.OSD.AddMessage(s.ShowBG3_1 ? "BG 3 Layer On" : "BG 3 Layer Off");
}
private void SNES_ToggleBG4(bool? setto = null)
{
if (!(Emulator is LibsnesCore))
{
return;
((LibsnesCore)Emulator).PutSettings(s);
GlobalWin.OSD.AddMessage($"Obj {layer} Layer " + (result ? "On" : "Off"));
}
var s = AsSNES.GetSettings();
if (setto.HasValue)
else if (Emulator is Snes9x)
{
s.ShowBG4_1 = s.ShowBG4_0 = setto.Value;
}
else
{
s.ShowBG4_1 = s.ShowBG4_0 ^= true;
}
var s = ((Snes9x)Emulator).GetSettings();
switch (layer)
{
case 1:
result = s.ShowSprites0 ^= true;
break;
case 2:
result = s.ShowSprites1 ^= true;
break;
case 3:
result = s.ShowSprites2 ^= true;
break;
case 4:
result = s.ShowSprites3 ^= true;
break;
}
AsSNES.PutSettings(s);
GlobalWin.OSD.AddMessage(s.ShowBG4_1 ? "BG 4 Layer On" : "BG 4 Layer Off");
}
private void SNES_ToggleObj1(bool? setto = null)
{
if (!(Emulator is LibsnesCore))
{
return;
((Snes9x)Emulator).PutSettings(s);
GlobalWin.OSD.AddMessage($"Sprite {layer} Layer " + (result ? "On" : "Off"));
}
var s = AsSNES.GetSettings();
if (setto.HasValue)
{
s.ShowOBJ_0 = setto.Value;
}
else
{
s.ShowOBJ_0 ^= true;
}
AsSNES.PutSettings(s);
GlobalWin.OSD.AddMessage(s.ShowOBJ_0 ? "OBJ 1 Layer On" : "OBJ 1 Layer Off");
}
private void SNES_ToggleObj2(bool? setto = null)
{
if (!(Emulator is LibsnesCore))
{
return;
}
var s = AsSNES.GetSettings();
if (setto.HasValue)
{
s.ShowOBJ_1 = setto.Value;
}
else
{
s.ShowOBJ_1 ^= true;
}
AsSNES.PutSettings(s);
GlobalWin.OSD.AddMessage(s.ShowOBJ_1 ? "OBJ 2 Layer On" : "OBJ 2 Layer Off");
}
private void SNES_ToggleOBJ3(bool? setto = null)
{
if (!(Emulator is LibsnesCore))
{
return;
}
var s = AsSNES.GetSettings();
if (setto.HasValue)
{
s.ShowOBJ_2 = setto.Value;
}
else
{
s.ShowOBJ_2 ^= true;
}
AsSNES.PutSettings(s);
GlobalWin.OSD.AddMessage(s.ShowOBJ_2 ? "OBJ 3 Layer On" : "OBJ 3 Layer Off");
}
private void SNES_ToggleOBJ4(bool? setto = null)
{
if (!(Emulator is LibsnesCore))
{
return;
}
var s = AsSNES.GetSettings();
if (setto.HasValue)
{
s.ShowOBJ_3 = setto.Value;
}
else
{
s.ShowOBJ_3 ^= true;
}
AsSNES.PutSettings(s);
GlobalWin.OSD.AddMessage(s.ShowOBJ_3 ? "OBJ 4 Layer On" : "OBJ 4 Layer Off");
}
public bool RunLibretroCoreChooser()
@ -1685,7 +1636,7 @@ namespace BizHawk.Client.EmuHawk
// GBA meteor core might not know how big the saveram ought to be, so just send it the whole file
// GBA vba-next core will try to eat anything, regardless of size
if (Emulator is VBANext || Emulator is MGBAHawk)
if (Emulator is VBANext || Emulator is MGBAHawk || Emulator is NeoGeoPort)
{
sram = File.ReadAllBytes(PathManager.SaveRamPath(Global.Game));
}
@ -1749,7 +1700,7 @@ namespace BizHawk.Client.EmuHawk
{
writer.Write(saveram, 0, saveram.Length);
}
writer.Close();
}
}
@ -1797,6 +1748,9 @@ namespace BizHawk.Client.EmuHawk
AppleSubMenu.Visible = false;
C64SubMenu.Visible = false;
IntvSubMenu.Visible = false;
virtualBoyToolStripMenuItem.Visible = false;
sNESToolStripMenuItem.Visible = false;
neoGeoPocketToolStripMenuItem.Visible = false;
switch (system)
{
@ -1844,17 +1798,15 @@ namespace BizHawk.Client.EmuHawk
break;
case "SNES":
case "SGB":
// TODO: fix SNES9x here
if (Emulator is LibsnesCore)
{
SNESSubMenu.Text = ((LibsnesCore)Emulator).IsSGB ? "&SGB" : "&SNES";
SNESSubMenu.Visible = true;
}
else
else if (Emulator is Snes9x)
{
SNESSubMenu.Visible = false;
sNESToolStripMenuItem.Visible = true;
}
break;
case "Coleco":
ColecoSubMenu.Visible = true;
@ -1880,6 +1832,12 @@ namespace BizHawk.Client.EmuHawk
case "INTV":
IntvSubMenu.Visible = true;
break;
case "VB":
virtualBoyToolStripMenuItem.Visible = true;
break;
case "NGP":
neoGeoPocketToolStripMenuItem.Visible = true;
break;
}
}
@ -2123,7 +2081,7 @@ namespace BizHawk.Client.EmuHawk
if (VersionInfo.DeveloperBuild)
{
return FormatFilter(
"Rom Files", "*.nes;*.fds;*.unf;*.sms;*.gg;*.sg;*.pce;*.sgx;*.bin;*.smd;*.rom;*.a26;*.a78;*.lnx;*.m3u;*.cue;*.ccd;*.exe;*.gb;*.gbc;*.gba;*.gen;*.md;*.col;*.int;*.smc;*.sfc;*.prg;*.d64;*.g64;*.crt;*.tap;*.sgb;*.xml;*.z64;*.v64;*.n64;*.ws;*.wsc;*.dsk;*.do;*.po;*.psf;*.minipsf;*.nsf;%ARCH%",
"Rom Files", "*.nes;*.fds;*.unf;*.sms;*.gg;*.sg;*.pce;*.sgx;*.bin;*.smd;*.rom;*.a26;*.a78;*.lnx;*.m3u;*.cue;*.ccd;*.exe;*.gb;*.gbc;*.gba;*.gen;*.md;*.col;*.int;*.smc;*.sfc;*.prg;*.d64;*.g64;*.crt;*.tap;*.sgb;*.xml;*.z64;*.v64;*.n64;*.ws;*.wsc;*.dsk;*.do;*.po;*.vb;*.ngp;*.ngc;*.psf;*.minipsf;*.nsf;%ARCH%",
"Music Files", "*.psf;*.minipsf;*.sid;*.nsf",
"Disc Images", "*.cue;*.ccd;*.m3u",
"NES", "*.nes;*.fds;*.unf;*.nsf;%ARCH%",
@ -2149,11 +2107,13 @@ namespace BizHawk.Client.EmuHawk
"Nintendo 64", "*.z64;*.v64;*.n64",
"WonderSwan", "*.ws;*.wsc;%ARCH%",
"Apple II", "*.dsk;*.do;*.po;%ARCH%",
"Virtual Boy", "*.vb;%ARCH%",
"Neo Geo Pocket", "*.ngp;*.ngc;%ARCH%",
"All Files", "*.*");
}
return FormatFilter(
"Rom Files", "*.nes;*.fds;*.unf;*.sms;*.gg;*.sg;*.gb;*.gbc;*.gba;*.pce;*.sgx;*.bin;*.smd;*.gen;*.md;*.smc;*.sfc;*.a26;*.a78;*.lnx;*.col;*.int;*.rom;*.m3u;*.cue;*.ccd;*.sgb;*.z64;*.v64;*.n64;*.ws;*.wsc;*.xml;*.dsk;*.do;*.po;*.psf;*.prg;*.d64;*.g64;*.minipsf;*.nsf;%ARCH%",
"Rom Files", "*.nes;*.fds;*.unf;*.sms;*.gg;*.sg;*.gb;*.gbc;*.gba;*.pce;*.sgx;*.bin;*.smd;*.gen;*.md;*.smc;*.sfc;*.a26;*.a78;*.lnx;*.col;*.int;*.rom;*.m3u;*.cue;*.ccd;*.sgb;*.z64;*.v64;*.n64;*.ws;*.wsc;*.xml;*.dsk;*.do;*.po;*.psf;*.ngp;*.ngc;*.prg;*.d64;*.g64;*.minipsf;*.nsf;%ARCH%",
"Disc Images", "*.cue;*.ccd;*.m3u",
"NES", "*.nes;*.fds;*.unf;*.nsf;%ARCH%",
"Super NES", "*.smc;*.sfc;*.xml;%ARCH%",
@ -2175,6 +2135,8 @@ namespace BizHawk.Client.EmuHawk
"Genesis", "*.gen;*.md;*.smd;*.bin;*.cue;*.ccd;%ARCH%",
"WonderSwan", "*.ws;*.wsc;%ARCH%",
"Apple II", "*.dsk;*.do;*.po;%ARCH%",
"Virtual Boy", "*.vb;%ARCH%",
"Neo Geo Pocket", "*.ngp;*.ngc;%ARCH%",
"Commodore 64", "*.prg; *.d64, *.g64; *.crt; *.tap;%ARCH%",
"All Files", "*.*");
}
@ -3158,6 +3120,7 @@ namespace BizHawk.Client.EmuHawk
videowritername = Global.Config.VideoWriter;
}
_dumpaudiosync = Global.Config.VideoWriterAudioSync;
if (unattended && !string.IsNullOrEmpty(videowritername))
{
aw = VideoWriterInventory.GetVideoWriter(videowritername);
@ -3165,7 +3128,7 @@ namespace BizHawk.Client.EmuHawk
else
{
aw = VideoWriterChooserForm.DoVideoWriterChoserDlg(VideoWriterInventory.GetAllWriters(), this,
out _avwriterResizew, out _avwriterResizeh, out _avwriterpad, out _dumpaudiosync);
out _avwriterResizew, out _avwriterResizeh, out _avwriterpad, ref _dumpaudiosync);
}
if (aw == null)
@ -3402,7 +3365,7 @@ namespace BizHawk.Client.EmuHawk
}
}
output = new BmpVideoProvider(bmpout);
output = new BmpVideoProvider(bmpout, _currentVideoProvider.VsyncNumerator, _currentVideoProvider.VsyncDenominator);
disposableOutput = (IDisposable)output;
}
finally
@ -3538,7 +3501,7 @@ namespace BizHawk.Client.EmuHawk
public IOpenAdvanced OpenAdvanced { get; set; }
}
private LoadRomArgs _currentLoadRomArgs;
private LoadRomArgs _currentLoadRomArgs;
// Still needs a good bit of refactoring
public bool LoadRom(string path, LoadRomArgs args)
@ -4293,6 +4256,21 @@ namespace BizHawk.Client.EmuHawk
}
}
private void preferencesToolStripMenuItem1_Click(object sender, EventArgs e)
{
GenericCoreConfig.DoDialog(this, "VirtualBoy Settings");
}
private void preferencesToolStripMenuItem_Click(object sender, EventArgs e)
{
GenericCoreConfig.DoDialog(this, "Snes9x Settings");
}
private void preferencesToolStripMenuItem2_Click(object sender, EventArgs e)
{
GenericCoreConfig.DoDialog(this, "NeoPop Settings");
}
private bool Rewind(ref bool runFrame, long currentTimestamp, out bool returnToRecording)
{
var isRewinding = false;

View File

@ -69,11 +69,33 @@ namespace BizHawk.Client.EmuHawk.Properties {
return ((System.Drawing.Bitmap)(obj));
}
}
/// <summary>
/// Looks up a localized resource of type System.Drawing.Bitmap.
/// </summary>
internal static System.Drawing.Bitmap add {
internal static System.Drawing.Bitmap VBoyController {
get {
object obj = ResourceManager.GetObject("VBoyController", resourceCulture);
return ((System.Drawing.Bitmap)(obj));
}
}
/// <summary>
/// Looks up a localized resource of type System.Drawing.Bitmap.
/// </summary>
internal static System.Drawing.Bitmap NGPController
{
get
{
object obj = ResourceManager.GetObject("NGPController", resourceCulture);
return ((System.Drawing.Bitmap)(obj));
}
}
/// <summary>
/// Looks up a localized resource of type System.Drawing.Bitmap.
/// </summary>
internal static System.Drawing.Bitmap add {
get {
object obj = ResourceManager.GetObject("add", resourceCulture);
return ((System.Drawing.Bitmap)(obj));

View File

@ -142,6 +142,9 @@
<data name="A78Joystick" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\images\ControllerImages\A78Joystick.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="VBoyController" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\images\ControllerImages\VBoyController.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="cdlogger" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\images\cdlogger.ico;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
@ -1557,4 +1560,7 @@
<data name="WSW" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\images\WSW.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="NGPController" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\images\ControllerImages\NGPController.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
</root>

View File

@ -0,0 +1,3 @@
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<startup><supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.6.1"/></startup></configuration>

View File

@ -14,7 +14,7 @@ namespace BizHawk.Client.EmuHawk
{
public partial class ControllerConfig : Form
{
private const int MAXPLAYERS = 8;
private const int MaxPlayers = 12;
private static readonly Dictionary<string, Bitmap> ControllerImages = new Dictionary<string, Bitmap>();
private readonly ControllerDefinition _theDefinition;
@ -45,6 +45,8 @@ namespace BizHawk.Client.EmuHawk
ControllerImages.Add("PSX Gamepad Controller", Properties.Resources.PSX_Original_Controller);
ControllerImages.Add("PSX DualShock Controller", Properties.Resources.psx_dualshock);
ControllerImages.Add("Apple IIe Keyboard", Properties.Resources.AppleIIKeyboard);
ControllerImages.Add("VirtualBoy Controller", Properties.Resources.VBoyController);
ControllerImages.Add("NeoGeo Portable Controller", Properties.Resources.NGPController);
}
@ -107,7 +109,7 @@ namespace BizHawk.Client.EmuHawk
}
// split the list of all settings into buckets by player number
var buckets = new List<string>[MAXPLAYERS + 1];
var buckets = new List<string>[MaxPlayers + 1];
var categoryBuckets = new WorkingDictionary<string, List<string>>();
for (var i = 0; i < buckets.Length; i++)
{
@ -120,7 +122,7 @@ namespace BizHawk.Client.EmuHawk
foreach (var button in controllerButtons)
{
int i;
for (i = 1; i <= MAXPLAYERS; i++)
for (i = MaxPlayers; i > 0; i--)
{
if (button.StartsWith("P" + i))
{
@ -128,14 +130,19 @@ namespace BizHawk.Client.EmuHawk
}
}
if (i > MAXPLAYERS) // couldn't find
if (i > MaxPlayers) // couldn't find
{
i = 0;
}
if (categoryLabels.ContainsKey(button))
{
categoryBuckets[categoryLabels[button]].Add(button);
else buckets[i].Add(button);
}
else
{
buckets[i].Add(button);
}
}
if (buckets[0].Count == controllerButtons.Count)
@ -149,7 +156,7 @@ namespace BizHawk.Client.EmuHawk
var tt = new TabControl { Dock = DockStyle.Fill };
dest.Controls.Add(tt);
int pageidx = 0;
for (int i = 1; i <= MAXPLAYERS; i++)
for (int i = 1; i <= MaxPlayers; i++)
{
if (buckets[i].Count > 0)
{

View File

@ -28,7 +28,7 @@ namespace BizHawk.Client.EmuHawk
if (PlatformDropdown.SelectedIndex > 0)
{
return _availableSystems
.First(x => x.SystemId == PlatformDropdown.SelectedItem.ToString()).FullName;
.First(x => x.FullName == PlatformDropdown.SelectedItem.ToString()).SystemId;
}
return "";

View File

@ -74,7 +74,8 @@
this.propertyGrid1.PropertySort = System.Windows.Forms.PropertySort.NoSort;
this.propertyGrid1.Size = new System.Drawing.Size(306, 299);
this.propertyGrid1.TabIndex = 0;
this.propertyGrid1.ToolbarVisible = false;
this.propertyGrid1.ToolbarVisible = false;
this.propertyGrid1.PropertyValueChanged += new System.Windows.Forms.PropertyValueChangedEventHandler(this.propertyGrid1_PropertyValueChanged);
//
// tabPage2
//
@ -152,7 +153,6 @@
this.tabPage1.ResumeLayout(false);
this.tabPage2.ResumeLayout(false);
this.ResumeLayout(false);
}
#endregion

View File

@ -10,6 +10,7 @@ namespace BizHawk.Client.EmuHawk
private object _s;
private object _ss;
private bool _syncsettingschanged;
bool settingschanged = false;
private GenericCoreConfig(bool ignoresettings, bool ignoresyncsettings)
{
@ -58,10 +59,9 @@ namespace BizHawk.Client.EmuHawk
private void OkBtn_Click(object sender, EventArgs e)
{
var settable = new SettingsAdapter(Global.Emulator);
if (_s != null && settable.HasSettings)
if (_s != null && settingschanged)
{
settable.PutSettings(_s);
GlobalWin.MainForm.PutCoreSettings(_s);
}
if (_ss != null && _syncsettingschanged)
@ -114,5 +114,10 @@ namespace BizHawk.Client.EmuHawk
_syncsettingschanged = true;
}
}
private void propertyGrid1_PropertyValueChanged(object s, PropertyValueChangedEventArgs e)
{
settingschanged = true;
}
}
}

File diff suppressed because it is too large Load Diff

View File

@ -33,22 +33,6 @@ namespace BizHawk.Client.EmuHawk
"Custom"
};
private static readonly string[] ValidResolutionsJabo =
{
"320 x 240",
"400 x 300",
"512 x 384",
"640 x 480",
"800 x 600",
"1024 x 768",
"1152 x 864",
"1280 x 960",
"1600 x 1200",
"848 x 480",
"1024 x 576",
"1380 x 768"
};
private bool _programmaticallyChangingPluginComboBox = false;
public N64VideoPluginconfig()
@ -149,41 +133,11 @@ namespace BizHawk.Client.EmuHawk
case "Glide64mk2":
_ss.VideoPlugin = PluginType.GlideMk2;
break;
case "Jabo 1.6.1":
_ss.VideoPlugin = PluginType.Jabo;
break;
case "GLideN64":
_ss.VideoPlugin = PluginType.GLideN64;
break;
}
// Jabo
_ss.JaboPlugin.UseDefaultHacks = JaboUseForGameCheckbox.Checked;
_ss.JaboPlugin.clear_mode = JaboClearModeDropDown.SelectedItem
.ToString()
.GetEnumFromDescription<N64SyncSettings.N64JaboPluginSettings.Direct3DClearMode>();
_ss.JaboPlugin.anisotropic_level = JaboAnisotropicFilteringLevelDropdown.SelectedItem
.ToString()
.GetEnumFromDescription<N64SyncSettings.N64JaboPluginSettings.ANISOTROPIC_FILTERING_LEVEL>();
_ss.JaboPlugin.antialiasing_level = JaboAntialiasingLevelDropdown.SelectedItem
.ToString()
.GetEnumFromDescription<N64SyncSettings.N64JaboPluginSettings.ANTIALIASING_LEVEL>();
_ss.JaboPlugin.brightness = (int)JaboBrightnessBox.Value;
_ss.JaboPlugin.super2xsal = JaboSuper2xsalCheckbox.Checked;
_ss.JaboPlugin.texture_filter = JaboTextureFilterCheckbox.Checked;
_ss.JaboPlugin.adjust_aspect_ratio = JaboAdjustAspectRatioCheckbox.Checked;
_ss.JaboPlugin.legacy_pixel_pipeline = JaboLegacyPixelPipelineCheckbox.Checked;
_ss.JaboPlugin.alpha_blending = JaboAlphaBlendingCheckbox.Checked;
_ss.JaboPlugin.direct3d_transformation_pipeline = JaboDirect3DPipelineCheckbox.Checked;
_ss.JaboPlugin.z_compare = JaboZCompareCheckbox.Checked;
_ss.JaboPlugin.copy_framebuffer = JaboCopyFrameBufferCheckbox.Checked;
_ss.JaboPlugin.resolution_width = JaboResolutionWidthBox.ToRawInt().Value;
_ss.JaboPlugin.resolution_height = JaboResolutionHeightBox.ToRawInt().Value;
// Rice
_ss.RicePlugin.NormalAlphaBlender = RiceNormalAlphaBlender_CB.Checked;
_ss.RicePlugin.FastTextureLoading = RiceFastTextureLoading_CB.Checked;
@ -540,9 +494,6 @@ namespace BizHawk.Client.EmuHawk
case PluginType.Rice:
PluginComboBox.Text = "Rice";
break;
case PluginType.Jabo:
PluginComboBox.Text = "Jabo 1.6.1";
break;
case PluginType.GLideN64:
PluginComboBox.Text = "GLideN64";
break;
@ -566,29 +517,6 @@ namespace BizHawk.Client.EmuHawk
ShowCustomVideoResolutionControls();
}
// Jabo
JaboUseForGameCheckbox.Checked = _ss.JaboPlugin.UseDefaultHacks;
JaboClearModeDropDown
.PopulateFromEnum<N64SyncSettings.N64JaboPluginSettings.Direct3DClearMode>(_ss.JaboPlugin.clear_mode);
JaboResolutionWidthBox.Text = _ss.JaboPlugin.resolution_width.ToString();
JaboResolutionHeightBox.Text = _ss.JaboPlugin.resolution_height.ToString();
JaboUpdateHacksSection();
JaboAnisotropicFilteringLevelDropdown
.PopulateFromEnum<N64SyncSettings.N64JaboPluginSettings.ANISOTROPIC_FILTERING_LEVEL>(_ss.JaboPlugin.anisotropic_level);
JaboAntialiasingLevelDropdown
.PopulateFromEnum<N64SyncSettings.N64JaboPluginSettings.ANTIALIASING_LEVEL>(_ss.JaboPlugin.antialiasing_level);
JaboBrightnessBox.Value = _ss.JaboPlugin.brightness;
JaboSuper2xsalCheckbox.Checked = _ss.JaboPlugin.super2xsal;
JaboTextureFilterCheckbox.Checked = _ss.JaboPlugin.texture_filter;
JaboAdjustAspectRatioCheckbox.Checked = _ss.JaboPlugin.adjust_aspect_ratio;
JaboLegacyPixelPipelineCheckbox.Checked = _ss.JaboPlugin.legacy_pixel_pipeline;
JaboAlphaBlendingCheckbox.Checked = _ss.JaboPlugin.alpha_blending;
JaboDirect3DPipelineCheckbox.Checked = _ss.JaboPlugin.direct3d_transformation_pipeline;
JaboZCompareCheckbox.Checked = _ss.JaboPlugin.z_compare;
JaboCopyFrameBufferCheckbox.Checked = _ss.JaboPlugin.copy_framebuffer;
// Rice
RiceNormalAlphaBlender_CB.Checked = _ss.RicePlugin.NormalAlphaBlender;
RiceFastTextureLoading_CB.Checked = _ss.RicePlugin.FastTextureLoading;
@ -1223,18 +1151,10 @@ namespace BizHawk.Client.EmuHawk
oldSizeY = int.Parse(VideoResolutionYTextBox.Text);
}
if (PluginComboBox.Text == "Jabo 1.6.1")
{
// Change resolution list to jabo
VideoResolutionComboBox.Items.Clear();
VideoResolutionComboBox.Items.AddRange(ValidResolutionsJabo);
}
else
{
// Change resolution list to the rest
VideoResolutionComboBox.Items.Clear();
VideoResolutionComboBox.Items.AddRange(ValidResolutions);
}
// Change resolution list to the rest
VideoResolutionComboBox.Items.Clear();
VideoResolutionComboBox.Items.AddRange(ValidResolutions);
// If the given resolution is in the table, pick it.
// Otherwise find a best fit
@ -1272,15 +1192,7 @@ namespace BizHawk.Client.EmuHawk
if (bestFit < 0)
{
if (PluginComboBox.Text == "Jabo 1.6.1")
{
// Pick 8 to avoid picking the widescreen resolutions
VideoResolutionComboBox.SelectedIndex = 8;
}
else
{
VideoResolutionComboBox.SelectedIndex = VideoResolutionComboBox.Items.Count - 1;
}
VideoResolutionComboBox.SelectedIndex = VideoResolutionComboBox.Items.Count - 1;
}
else
{
@ -1289,26 +1201,6 @@ namespace BizHawk.Client.EmuHawk
}
}
private void JaboUseForGameCheckbox_CheckedChanged(object sender, EventArgs e)
{
JaboPerGameHacksGroupBox.Controls
.OfType<Control>()
.ToList()
.ForEach(c => c.Enabled = !JaboUseForGameCheckbox.Checked);
JaboUpdateHacksSection();
}
private void JaboUpdateHacksSection()
{
if (JaboUseForGameCheckbox.Checked)
{
JaboResolutionWidthBox.Text = GetIntFromDB("Jabo_Resolution_Width", -1).ToString();
JaboResolutionHeightBox.Text = GetIntFromDB("Jabo_Resolution_Height", -1).ToString();
JaboClearModeDropDown.SelectedItem = ((N64SyncSettings.N64JaboPluginSettings.Direct3DClearMode)GetIntFromDB("Jabo_Clear_Frame", 0)).GetDescription();
}
}
private void VideoResolutionComboBox_SelectedIndexChanged(object sender, EventArgs e)
{
if (VideoResolutionComboBox.Text == "Custom")

View File

@ -1,402 +0,0 @@
namespace BizHawk.Client.EmuHawk
{
partial class NewN64PluginSettings
{
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// Clean up any resources being used.
/// </summary>
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Windows Form Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(NewN64PluginSettings));
this.PluginTabs = new System.Windows.Forms.TabControl();
this.GlobalTab = new System.Windows.Forms.TabPage();
this.VideoResolutionYTextBox = new System.Windows.Forms.TextBox();
this.LabelVideoResolutionY = new System.Windows.Forms.Label();
this.VideoResolutionXTextBox = new System.Windows.Forms.TextBox();
this.LabelVideoResolutionX = new System.Windows.Forms.Label();
this.label49 = new System.Windows.Forms.Label();
this.RspTypeDropdown = new System.Windows.Forms.ComboBox();
this.label48 = new System.Windows.Forms.Label();
this.CoreTypeDropdown = new System.Windows.Forms.ComboBox();
this.label2 = new System.Windows.Forms.Label();
this.VideoResolutionComboBox = new System.Windows.Forms.ComboBox();
this.PluginComboBox = new System.Windows.Forms.ComboBox();
this.label1 = new System.Windows.Forms.Label();
this.RiceTab = new System.Windows.Forms.TabPage();
this.RicePropertyGrid = new System.Windows.Forms.PropertyGrid();
this.Glide64mk2 = new System.Windows.Forms.TabPage();
this.Glidemk2PropertyGrid = new System.Windows.Forms.PropertyGrid();
this.Glide64Tab = new System.Windows.Forms.TabPage();
this.GlidePropertyGrid = new System.Windows.Forms.PropertyGrid();
this.JaboTab = new System.Windows.Forms.TabPage();
this.JaboPropertyGrid = new System.Windows.Forms.PropertyGrid();
this.SaveBtn = new System.Windows.Forms.Button();
this.CancelBtn = new System.Windows.Forms.Button();
this.PluginTabs.SuspendLayout();
this.GlobalTab.SuspendLayout();
this.RiceTab.SuspendLayout();
this.Glide64mk2.SuspendLayout();
this.Glide64Tab.SuspendLayout();
this.JaboTab.SuspendLayout();
this.SuspendLayout();
//
// PluginTabs
//
this.PluginTabs.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
| System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.PluginTabs.Controls.Add(this.GlobalTab);
this.PluginTabs.Controls.Add(this.RiceTab);
this.PluginTabs.Controls.Add(this.Glide64mk2);
this.PluginTabs.Controls.Add(this.Glide64Tab);
this.PluginTabs.Controls.Add(this.JaboTab);
this.PluginTabs.Location = new System.Drawing.Point(12, 12);
this.PluginTabs.Name = "PluginTabs";
this.PluginTabs.SelectedIndex = 0;
this.PluginTabs.Size = new System.Drawing.Size(580, 468);
this.PluginTabs.TabIndex = 0;
//
// GlobalTab
//
this.GlobalTab.Controls.Add(this.VideoResolutionYTextBox);
this.GlobalTab.Controls.Add(this.LabelVideoResolutionY);
this.GlobalTab.Controls.Add(this.VideoResolutionXTextBox);
this.GlobalTab.Controls.Add(this.LabelVideoResolutionX);
this.GlobalTab.Controls.Add(this.label49);
this.GlobalTab.Controls.Add(this.RspTypeDropdown);
this.GlobalTab.Controls.Add(this.label48);
this.GlobalTab.Controls.Add(this.CoreTypeDropdown);
this.GlobalTab.Controls.Add(this.label2);
this.GlobalTab.Controls.Add(this.VideoResolutionComboBox);
this.GlobalTab.Controls.Add(this.PluginComboBox);
this.GlobalTab.Controls.Add(this.label1);
this.GlobalTab.Location = new System.Drawing.Point(4, 22);
this.GlobalTab.Name = "GlobalTab";
this.GlobalTab.Padding = new System.Windows.Forms.Padding(3);
this.GlobalTab.Size = new System.Drawing.Size(572, 442);
this.GlobalTab.TabIndex = 0;
this.GlobalTab.Text = "Global";
this.GlobalTab.UseVisualStyleBackColor = true;
//
// VideoResolutionYTextBox
//
this.VideoResolutionYTextBox.Location = new System.Drawing.Point(494, 91);
this.VideoResolutionYTextBox.MaxLength = 5;
this.VideoResolutionYTextBox.Name = "VideoResolutionYTextBox";
this.VideoResolutionYTextBox.Size = new System.Drawing.Size(35, 20);
this.VideoResolutionYTextBox.TabIndex = 108;
this.VideoResolutionYTextBox.TextAlign = System.Windows.Forms.HorizontalAlignment.Right;
this.VideoResolutionYTextBox.Visible = false;
//
// LabelVideoResolutionY
//
this.LabelVideoResolutionY.AutoSize = true;
this.LabelVideoResolutionY.Location = new System.Drawing.Point(447, 94);
this.LabelVideoResolutionY.Name = "LabelVideoResolutionY";
this.LabelVideoResolutionY.Size = new System.Drawing.Size(41, 13);
this.LabelVideoResolutionY.TabIndex = 107;
this.LabelVideoResolutionY.Text = "Height:";
this.LabelVideoResolutionY.Visible = false;
//
// VideoResolutionXTextBox
//
this.VideoResolutionXTextBox.Location = new System.Drawing.Point(402, 91);
this.VideoResolutionXTextBox.MaxLength = 5;
this.VideoResolutionXTextBox.Name = "VideoResolutionXTextBox";
this.VideoResolutionXTextBox.Size = new System.Drawing.Size(35, 20);
this.VideoResolutionXTextBox.TabIndex = 28;
this.VideoResolutionXTextBox.TextAlign = System.Windows.Forms.HorizontalAlignment.Right;
this.VideoResolutionXTextBox.Visible = false;
//
// LabelVideoResolutionX
//
this.LabelVideoResolutionX.AutoSize = true;
this.LabelVideoResolutionX.Location = new System.Drawing.Point(358, 94);
this.LabelVideoResolutionX.Name = "LabelVideoResolutionX";
this.LabelVideoResolutionX.Size = new System.Drawing.Size(38, 13);
this.LabelVideoResolutionX.TabIndex = 27;
this.LabelVideoResolutionX.Text = "Width:";
this.LabelVideoResolutionX.Visible = false;
//
// label49
//
this.label49.AutoSize = true;
this.label49.Location = new System.Drawing.Point(213, 13);
this.label49.Name = "label49";
this.label49.Size = new System.Drawing.Size(58, 13);
this.label49.TabIndex = 26;
this.label49.Text = "Rsp Plugin";
//
// RspTypeDropdown
//
this.RspTypeDropdown.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
this.RspTypeDropdown.FormattingEnabled = true;
this.RspTypeDropdown.Items.AddRange(new object[] {
"Pure Interpreter",
"Interpreter",
"DynaRec"});
this.RspTypeDropdown.Location = new System.Drawing.Point(216, 29);
this.RspTypeDropdown.Name = "RspTypeDropdown";
this.RspTypeDropdown.Size = new System.Drawing.Size(136, 21);
this.RspTypeDropdown.TabIndex = 25;
//
// label48
//
this.label48.AutoSize = true;
this.label48.Location = new System.Drawing.Point(17, 13);
this.label48.Name = "label48";
this.label48.Size = new System.Drawing.Size(56, 13);
this.label48.TabIndex = 24;
this.label48.Text = "Core Type";
//
// CoreTypeDropdown
//
this.CoreTypeDropdown.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
this.CoreTypeDropdown.FormattingEnabled = true;
this.CoreTypeDropdown.Items.AddRange(new object[] {
"Pure Interpreter",
"Interpreter",
"DynaRec"});
this.CoreTypeDropdown.Location = new System.Drawing.Point(20, 29);
this.CoreTypeDropdown.Name = "CoreTypeDropdown";
this.CoreTypeDropdown.Size = new System.Drawing.Size(136, 21);
this.CoreTypeDropdown.TabIndex = 19;
//
// label2
//
this.label2.AutoSize = true;
this.label2.Location = new System.Drawing.Point(213, 75);
this.label2.Name = "label2";
this.label2.Size = new System.Drawing.Size(87, 13);
this.label2.TabIndex = 23;
this.label2.Text = "Video Resolution";
//
// VideoResolutionComboBox
//
this.VideoResolutionComboBox.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
this.VideoResolutionComboBox.FormattingEnabled = true;
this.VideoResolutionComboBox.Items.AddRange(new object[] {
"320 x 240",
"400 x 300",
"480 x 360",
"512 x 384",
"640 x 480",
"800 x 600",
"1024 x 768",
"1152 x 864",
"1280 x 960",
"1400 x 1050",
"1600 x 1200",
"1920 x 1440",
"2048 x 1536",
"Custom"});
this.VideoResolutionComboBox.Location = new System.Drawing.Point(216, 91);
this.VideoResolutionComboBox.Name = "VideoResolutionComboBox";
this.VideoResolutionComboBox.Size = new System.Drawing.Size(136, 21);
this.VideoResolutionComboBox.TabIndex = 22;
this.VideoResolutionComboBox.SelectedIndexChanged += new System.EventHandler(this.VideoResolutionComboBox_SelectedIndexChanged);
//
// PluginComboBox
//
this.PluginComboBox.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
this.PluginComboBox.FormattingEnabled = true;
this.PluginComboBox.Items.AddRange(new object[] {
"Rice",
"Glide64",
"Glide64mk2",
"Jabo 1.6.1"});
this.PluginComboBox.Location = new System.Drawing.Point(20, 91);
this.PluginComboBox.Name = "PluginComboBox";
this.PluginComboBox.Size = new System.Drawing.Size(136, 21);
this.PluginComboBox.TabIndex = 21;
//
// label1
//
this.label1.AutoSize = true;
this.label1.Location = new System.Drawing.Point(17, 75);
this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(99, 13);
this.label1.TabIndex = 20;
this.label1.Text = "Active Video Plugin";
//
// RiceTab
//
this.RiceTab.Controls.Add(this.RicePropertyGrid);
this.RiceTab.Location = new System.Drawing.Point(4, 22);
this.RiceTab.Name = "RiceTab";
this.RiceTab.Padding = new System.Windows.Forms.Padding(3);
this.RiceTab.Size = new System.Drawing.Size(572, 442);
this.RiceTab.TabIndex = 1;
this.RiceTab.Text = "Rice";
this.RiceTab.UseVisualStyleBackColor = true;
//
// RicePropertyGrid
//
this.RicePropertyGrid.CategoryForeColor = System.Drawing.SystemColors.InactiveCaptionText;
this.RicePropertyGrid.Dock = System.Windows.Forms.DockStyle.Fill;
this.RicePropertyGrid.Location = new System.Drawing.Point(3, 3);
this.RicePropertyGrid.Name = "RicePropertyGrid";
this.RicePropertyGrid.PropertySort = System.Windows.Forms.PropertySort.NoSort;
this.RicePropertyGrid.Size = new System.Drawing.Size(566, 436);
this.RicePropertyGrid.TabIndex = 1;
this.RicePropertyGrid.ToolbarVisible = false;
//
// Glide64mk2
//
this.Glide64mk2.Controls.Add(this.Glidemk2PropertyGrid);
this.Glide64mk2.Location = new System.Drawing.Point(4, 22);
this.Glide64mk2.Name = "Glide64mk2";
this.Glide64mk2.Size = new System.Drawing.Size(572, 442);
this.Glide64mk2.TabIndex = 3;
this.Glide64mk2.Text = "Glide64mk2";
this.Glide64mk2.UseVisualStyleBackColor = true;
//
// Glidemk2PropertyGrid
//
this.Glidemk2PropertyGrid.CategoryForeColor = System.Drawing.SystemColors.InactiveCaptionText;
this.Glidemk2PropertyGrid.Dock = System.Windows.Forms.DockStyle.Fill;
this.Glidemk2PropertyGrid.Location = new System.Drawing.Point(0, 0);
this.Glidemk2PropertyGrid.Name = "Glidemk2PropertyGrid";
this.Glidemk2PropertyGrid.PropertySort = System.Windows.Forms.PropertySort.NoSort;
this.Glidemk2PropertyGrid.Size = new System.Drawing.Size(572, 442);
this.Glidemk2PropertyGrid.TabIndex = 2;
this.Glidemk2PropertyGrid.ToolbarVisible = false;
//
// Glide64Tab
//
this.Glide64Tab.Controls.Add(this.GlidePropertyGrid);
this.Glide64Tab.Location = new System.Drawing.Point(4, 22);
this.Glide64Tab.Name = "Glide64Tab";
this.Glide64Tab.Size = new System.Drawing.Size(572, 442);
this.Glide64Tab.TabIndex = 2;
this.Glide64Tab.Text = "Glide64";
this.Glide64Tab.UseVisualStyleBackColor = true;
//
// GlidePropertyGrid
//
this.GlidePropertyGrid.CategoryForeColor = System.Drawing.SystemColors.InactiveCaptionText;
this.GlidePropertyGrid.Dock = System.Windows.Forms.DockStyle.Fill;
this.GlidePropertyGrid.Location = new System.Drawing.Point(0, 0);
this.GlidePropertyGrid.Name = "GlidePropertyGrid";
this.GlidePropertyGrid.PropertySort = System.Windows.Forms.PropertySort.NoSort;
this.GlidePropertyGrid.Size = new System.Drawing.Size(572, 442);
this.GlidePropertyGrid.TabIndex = 3;
this.GlidePropertyGrid.ToolbarVisible = false;
//
// JaboTab
//
this.JaboTab.Controls.Add(this.JaboPropertyGrid);
this.JaboTab.Location = new System.Drawing.Point(4, 22);
this.JaboTab.Name = "JaboTab";
this.JaboTab.Size = new System.Drawing.Size(572, 442);
this.JaboTab.TabIndex = 4;
this.JaboTab.Text = "Jabo";
this.JaboTab.UseVisualStyleBackColor = true;
//
// JaboPropertyGrid
//
this.JaboPropertyGrid.CategoryForeColor = System.Drawing.SystemColors.InactiveCaptionText;
this.JaboPropertyGrid.Dock = System.Windows.Forms.DockStyle.Fill;
this.JaboPropertyGrid.Location = new System.Drawing.Point(0, 0);
this.JaboPropertyGrid.Name = "JaboPropertyGrid";
this.JaboPropertyGrid.PropertySort = System.Windows.Forms.PropertySort.NoSort;
this.JaboPropertyGrid.Size = new System.Drawing.Size(572, 442);
this.JaboPropertyGrid.TabIndex = 3;
this.JaboPropertyGrid.ToolbarVisible = false;
//
// SaveBtn
//
this.SaveBtn.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
this.SaveBtn.Location = new System.Drawing.Point(466, 486);
this.SaveBtn.Name = "SaveBtn";
this.SaveBtn.Size = new System.Drawing.Size(60, 23);
this.SaveBtn.TabIndex = 101;
this.SaveBtn.Text = "Save";
this.SaveBtn.UseVisualStyleBackColor = true;
this.SaveBtn.Click += new System.EventHandler(this.SaveBtn_Click);
//
// CancelBtn
//
this.CancelBtn.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
this.CancelBtn.DialogResult = System.Windows.Forms.DialogResult.Cancel;
this.CancelBtn.Location = new System.Drawing.Point(532, 486);
this.CancelBtn.Name = "CancelBtn";
this.CancelBtn.Size = new System.Drawing.Size(60, 23);
this.CancelBtn.TabIndex = 106;
this.CancelBtn.Text = "Cancel";
this.CancelBtn.UseVisualStyleBackColor = true;
this.CancelBtn.Click += new System.EventHandler(this.CancelBtn_Click);
//
// NewN64PluginSettings
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(604, 521);
this.Controls.Add(this.CancelBtn);
this.Controls.Add(this.SaveBtn);
this.Controls.Add(this.PluginTabs);
this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
this.Name = "NewN64PluginSettings";
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent;
this.Text = "New Plugin Settings";
this.Load += new System.EventHandler(this.NewN64PluginSettings_Load);
this.PluginTabs.ResumeLayout(false);
this.GlobalTab.ResumeLayout(false);
this.GlobalTab.PerformLayout();
this.RiceTab.ResumeLayout(false);
this.Glide64mk2.ResumeLayout(false);
this.Glide64Tab.ResumeLayout(false);
this.JaboTab.ResumeLayout(false);
this.ResumeLayout(false);
}
#endregion
private System.Windows.Forms.TabControl PluginTabs;
private System.Windows.Forms.TabPage GlobalTab;
private System.Windows.Forms.TabPage RiceTab;
private System.Windows.Forms.Button SaveBtn;
private System.Windows.Forms.Button CancelBtn;
private System.Windows.Forms.TabPage Glide64Tab;
private System.Windows.Forms.TabPage Glide64mk2;
private System.Windows.Forms.TabPage JaboTab;
private System.Windows.Forms.Label label49;
private System.Windows.Forms.ComboBox RspTypeDropdown;
private System.Windows.Forms.Label label48;
private System.Windows.Forms.ComboBox CoreTypeDropdown;
private System.Windows.Forms.Label label2;
private System.Windows.Forms.ComboBox VideoResolutionComboBox;
private System.Windows.Forms.ComboBox PluginComboBox;
private System.Windows.Forms.Label label1;
private System.Windows.Forms.PropertyGrid RicePropertyGrid;
private System.Windows.Forms.PropertyGrid Glidemk2PropertyGrid;
private System.Windows.Forms.PropertyGrid GlidePropertyGrid;
private System.Windows.Forms.PropertyGrid JaboPropertyGrid;
private System.Windows.Forms.Label LabelVideoResolutionX;
private System.Windows.Forms.TextBox VideoResolutionXTextBox;
private System.Windows.Forms.Label LabelVideoResolutionY;
private System.Windows.Forms.TextBox VideoResolutionYTextBox;
}
}

View File

@ -1,182 +0,0 @@
using System;
using System.Windows.Forms;
using BizHawk.Common.StringExtensions;
using BizHawk.Common.ReflectionExtensions;
using BizHawk.Emulation.Cores.Nintendo.N64;
using BizHawk.Client.Common;
using BizHawk.Client.EmuHawk.WinFormExtensions;
namespace BizHawk.Client.EmuHawk
{
public partial class NewN64PluginSettings : Form
{
private N64Settings _s;
private N64SyncSettings _ss;
public NewN64PluginSettings()
{
InitializeComponent();
}
private void CancelBtn_Click(object sender, EventArgs e)
{
DialogResult = DialogResult.Cancel;
Close();
}
private void SaveBtn_Click(object sender, EventArgs e)
{
if (VideoResolutionComboBox.Text != "Custom")
{
var videoSettings = VideoResolutionComboBox.SelectedItem.ToString();
var strArr = videoSettings.Split('x');
_s.VideoSizeX = int.Parse(strArr[0].Trim());
_s.VideoSizeY = int.Parse(strArr[1].Trim());
}
else
{
_s.VideoSizeX =
VideoResolutionXTextBox.Text.IsUnsigned() ?
int.Parse(VideoResolutionXTextBox.Text) : 320;
_s.VideoSizeY =
VideoResolutionYTextBox.Text.IsUnsigned() ?
int.Parse(VideoResolutionYTextBox.Text) : 240;
}
_ss.Core = CoreTypeDropdown.SelectedItem
.ToString()
.GetEnumFromDescription<N64SyncSettings.CoreType>();
_ss.Rsp = RspTypeDropdown.SelectedItem
.ToString()
.GetEnumFromDescription<N64SyncSettings.RspType>();
_ss.VideoPlugin = PluginComboBox.SelectedItem
.ToString()
.GetEnumFromDescription<PluginType>();
PutSettings(_s);
PutSyncSettings(_ss);
DialogResult = DialogResult.OK;
Close();
}
private void NewN64PluginSettings_Load(object sender, EventArgs e)
{
_s = GetSettings();
_ss = GetSyncSettings();
CoreTypeDropdown.PopulateFromEnum<N64SyncSettings.CoreType>(_ss.Core);
RspTypeDropdown.PopulateFromEnum<N64SyncSettings.RspType>(_ss.Rsp);
PluginComboBox.PopulateFromEnum<PluginType>(_ss.VideoPlugin);
VideoResolutionXTextBox.Text = _s.VideoSizeX.ToString();
VideoResolutionYTextBox.Text = _s.VideoSizeY.ToString();
var videoSetting = _s.VideoSizeX
+ " x "
+ _s.VideoSizeY;
var index = VideoResolutionComboBox.Items.IndexOf(videoSetting);
if (index >= 0)
{
VideoResolutionComboBox.SelectedIndex = index;
}
else if (PluginComboBox.SelectedIndex != 4)
{
VideoResolutionComboBox.SelectedIndex = 13;
ShowCustomVideoResolutionControls();
}
RicePropertyGrid.SelectedObject = _ss.RicePlugin;
Glidemk2PropertyGrid.SelectedObject = _ss.Glide64mk2Plugin;
GlidePropertyGrid.SelectedObject = _ss.GlidePlugin;
JaboPropertyGrid.SelectedObject = _ss.JaboPlugin;
}
#region Setting Get/Set
private static N64SyncSettings GetSyncSettings()
{
if (Global.Emulator is N64)
{
return ((N64)Global.Emulator).GetSyncSettings();
}
return (N64SyncSettings)Global.Config.GetCoreSyncSettings<N64>()
?? new N64SyncSettings();
}
private static N64Settings GetSettings()
{
if (Global.Emulator is N64)
{
return ((N64)Global.Emulator).GetSettings();
}
return (N64Settings)Global.Config.GetCoreSettings<N64>()
?? new N64Settings();
}
private static void PutSyncSettings(N64SyncSettings s)
{
if (Global.Emulator is N64)
{
GlobalWin.MainForm.PutCoreSyncSettings(s);
}
else
{
Global.Config.PutCoreSyncSettings<N64>(s);
}
}
private static void PutSettings(N64Settings s)
{
if (Global.Emulator is N64)
{
GlobalWin.MainForm.PutCoreSettings(s);
}
else
{
Global.Config.PutCoreSettings<N64>(s);
}
}
#endregion
private void VideoResolutionComboBox_SelectedIndexChanged(object sender, EventArgs e)
{
if (VideoResolutionComboBox.Text == "Custom")
{
ShowCustomVideoResolutionControls();
}
else
{
HideCustomVideoResolutionControls();
var newResolution = VideoResolutionComboBox.SelectedItem.ToString();
var strArr = newResolution.Split('x');
VideoResolutionXTextBox.Text = strArr[0].Trim();
VideoResolutionYTextBox.Text = strArr[1].Trim();
}
}
private void ShowCustomVideoResolutionControls()
{
LabelVideoResolutionX.Visible = true;
LabelVideoResolutionY.Visible = true;
VideoResolutionXTextBox.Visible = true;
VideoResolutionYTextBox.Visible = true;
}
private void HideCustomVideoResolutionControls()
{
LabelVideoResolutionX.Visible = false;
LabelVideoResolutionY.Visible = false;
VideoResolutionXTextBox.Visible = false;
VideoResolutionYTextBox.Visible = false;
}
}
}

File diff suppressed because it is too large Load Diff

View File

@ -87,19 +87,13 @@ namespace BizHawk.Client.EmuHawk
// N64
var n64Settings = GetSyncSettings<N64, N64SyncSettings>();
n64Settings.Rsp = N64SyncSettings.RspType.Rsp_Hle;
n64Settings.Core = N64SyncSettings.CoreType.Dynarec;
//n64Settings.Core = N64SyncSettings.CoreType.Dynarec;
n64Settings.Core = N64SyncSettings.CoreType.Interpret;
Global.Config.N64UseCircularAnalogConstraint = true;
PutSyncSettings<N64>(n64Settings);
// SNES
var snesSettings = GetSyncSettings<LibsnesCore, LibsnesCore.SnesSyncSettings>();
snesSettings.Profile = "Performance";
PutSyncSettings<LibsnesCore>(snesSettings);
// Saturn
var saturnSettings = GetSyncSettings<Yabause, Yabause.SaturnSyncSettings>();
saturnSettings.SkipBios = false;
PutSyncSettings<Yabause>(saturnSettings);
Global.Config.SNES_InSnes9x = true;
// Genesis
var genesisSettings = GetSyncSettings<GPGX, GPGX.GPGXSyncSettings>();
@ -108,7 +102,7 @@ namespace BizHawk.Client.EmuHawk
// SMS
var smsSettings = GetSyncSettings<SMS, SMS.SMSSyncSettings>();
smsSettings.UseBIOS = false;
smsSettings.UseBIOS = true;
PutSyncSettings<SMS>(smsSettings);
// Coleco
@ -142,20 +136,12 @@ namespace BizHawk.Client.EmuHawk
// N64
var n64Settings = GetSyncSettings<N64, N64SyncSettings>();
n64Settings.Rsp = N64SyncSettings.RspType.Rsp_Z64_hlevideo;
n64Settings.Core = N64SyncSettings.CoreType.Pure_Interpret;
Global.Config.N64UseCircularAnalogConstraint = true;
PutSyncSettings<N64>(n64Settings);
// SNES
var snesSettings = GetSyncSettings<LibsnesCore, LibsnesCore.SnesSyncSettings>();
snesSettings.Profile = "Compatibility";
PutSyncSettings<LibsnesCore>(snesSettings);
// Saturn
var saturnSettings = GetSyncSettings<Yabause, Yabause.SaturnSyncSettings>();
saturnSettings.SkipBios = false;
PutSyncSettings<Yabause>(saturnSettings);
Global.Config.SNES_InSnes9x = false;
// Genesis
var genesisSettings = GetSyncSettings<GPGX, GPGX.GPGXSyncSettings>();
@ -164,7 +150,7 @@ namespace BizHawk.Client.EmuHawk
// SMS
var smsSettings = GetSyncSettings<SMS, SMS.SMSSyncSettings>();
smsSettings.UseBIOS = false;
smsSettings.UseBIOS = true;
PutSyncSettings<SMS>(smsSettings);
// Coleco
@ -201,20 +187,12 @@ namespace BizHawk.Client.EmuHawk
// N64
var n64Settings = GetSyncSettings<N64, N64SyncSettings>();
n64Settings.Rsp = N64SyncSettings.RspType.Rsp_Z64_hlevideo;
n64Settings.Core = N64SyncSettings.CoreType.Pure_Interpret;
Global.Config.N64UseCircularAnalogConstraint = false;
PutSyncSettings<N64>(n64Settings);
// SNES
var snesSettings = GetSyncSettings<LibsnesCore, LibsnesCore.SnesSyncSettings>();
snesSettings.Profile = "Compatibility";
PutSyncSettings<LibsnesCore>(snesSettings);
// Saturn
var saturnSettings = GetSyncSettings<Yabause, Yabause.SaturnSyncSettings>();
saturnSettings.SkipBios = true;
PutSyncSettings<Yabause>(saturnSettings);
Global.Config.SNES_InSnes9x = false;
// Genesis
var genesisSettings = GetSyncSettings<GPGX, GPGX.GPGXSyncSettings>();
@ -223,7 +201,7 @@ namespace BizHawk.Client.EmuHawk
// SMS
var smsSettings = GetSyncSettings<SMS, SMS.SMSSyncSettings>();
smsSettings.UseBIOS = false;
smsSettings.UseBIOS = true;
PutSyncSettings<SMS>(smsSettings);
// Coleco
@ -266,14 +244,7 @@ namespace BizHawk.Client.EmuHawk
PutSyncSettings<N64>(n64Settings);
// SNES
var snesSettings = GetSyncSettings<LibsnesCore, LibsnesCore.SnesSyncSettings>();
snesSettings.Profile = "Compatibility";
PutSyncSettings<LibsnesCore>(snesSettings);
// Saturn
var saturnSettings = GetSyncSettings<Yabause, Yabause.SaturnSyncSettings>();
saturnSettings.SkipBios = true;
PutSyncSettings<Yabause>(saturnSettings);
Global.Config.SNES_InSnes9x = false;
// Genesis
var genesisSettings = GetSyncSettings<GPGX, GPGX.GPGXSyncSettings>();
@ -282,7 +253,7 @@ namespace BizHawk.Client.EmuHawk
// SMS
var smsSettings = GetSyncSettings<SMS, SMS.SMSSyncSettings>();
smsSettings.UseBIOS = false;
smsSettings.UseBIOS = true;
PutSyncSettings<SMS>(smsSettings);
// Coleco

File diff suppressed because it is too large Load Diff

View File

@ -36,7 +36,7 @@ namespace BizHawk.Client.EmuHawk
DiskBufferCheckbox.Checked = Global.Config.Rewind_OnDisk;
RewindIsThreadedCheckbox.Checked = Global.Config.Rewind_IsThreaded;
_stateSize = Global.Emulator.AsStatable().SaveStateBinary().Length;
BufferSizeUpDown.Value = Global.Config.Rewind_BufferSize;
BufferSizeUpDown.Value = Math.Max(Global.Config.Rewind_BufferSize, BufferSizeUpDown.Minimum);
_mediumStateSize = Global.Config.Rewind_MediumStateSize;
_largeStateSize = Global.Config.Rewind_LargeStateSize;

View File

@ -28,191 +28,213 @@
/// </summary>
private void InitializeComponent()
{
this.btnOk = new System.Windows.Forms.Button();
this.btnCancel = new System.Windows.Forms.Button();
this.rbCompatibility = new System.Windows.Forms.RadioButton();
this.groupBox1 = new System.Windows.Forms.GroupBox();
this.label2 = new System.Windows.Forms.Label();
this.rbAccuracy = new System.Windows.Forms.RadioButton();
this.rbPerformance = new System.Windows.Forms.RadioButton();
this.cbDoubleSize = new System.Windows.Forms.CheckBox();
this.lblDoubleSize = new System.Windows.Forms.Label();
this.cbForceDeterminism = new System.Windows.Forms.CheckBox();
this.label3 = new System.Windows.Forms.Label();
this.radioButton1 = new System.Windows.Forms.RadioButton();
this.cbCropSGBFrame = new System.Windows.Forms.CheckBox();
this.groupBox1.SuspendLayout();
this.SuspendLayout();
//
// btnOk
//
this.btnOk.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
this.btnOk.Location = new System.Drawing.Point(136, 308);
this.btnOk.Name = "btnOk";
this.btnOk.Size = new System.Drawing.Size(75, 23);
this.btnOk.TabIndex = 0;
this.btnOk.Text = "OK";
this.btnOk.UseVisualStyleBackColor = true;
this.btnOk.Click += new System.EventHandler(this.BtnOk_Click);
//
// btnCancel
//
this.btnCancel.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
this.btnCancel.DialogResult = System.Windows.Forms.DialogResult.Cancel;
this.btnCancel.Location = new System.Drawing.Point(217, 308);
this.btnCancel.Name = "btnCancel";
this.btnCancel.Size = new System.Drawing.Size(75, 23);
this.btnCancel.TabIndex = 1;
this.btnCancel.Text = "Cancel";
this.btnCancel.UseVisualStyleBackColor = true;
this.btnCancel.Click += new System.EventHandler(this.BtnCancel_Click);
//
// rbCompatibility
//
this.rbCompatibility.AutoSize = true;
this.rbCompatibility.Location = new System.Drawing.Point(6, 19);
this.rbCompatibility.Name = "rbCompatibility";
this.rbCompatibility.Size = new System.Drawing.Size(202, 17);
this.rbCompatibility.TabIndex = 2;
this.rbCompatibility.TabStop = true;
this.rbCompatibility.Text = "Compatibility (more debug tools work!)";
this.rbCompatibility.UseVisualStyleBackColor = true;
//
// groupBox1
//
this.groupBox1.Controls.Add(this.radioButton1);
this.groupBox1.Controls.Add(this.label2);
this.groupBox1.Controls.Add(this.rbAccuracy);
this.groupBox1.Controls.Add(this.rbPerformance);
this.groupBox1.Controls.Add(this.rbCompatibility);
this.groupBox1.Location = new System.Drawing.Point(12, 12);
this.groupBox1.Name = "groupBox1";
this.groupBox1.Size = new System.Drawing.Size(277, 108);
this.groupBox1.TabIndex = 3;
this.groupBox1.TabStop = false;
this.groupBox1.Text = "Core Selection";
//
// label2
//
this.label2.Location = new System.Drawing.Point(72, 85);
this.label2.Name = "label2";
this.label2.Size = new System.Drawing.Size(136, 21);
this.label2.TabIndex = 8;
this.label2.Text = "NOT SUPPORTED YET!";
//
// rbAccuracy
//
this.rbAccuracy.AutoSize = true;
this.rbAccuracy.Enabled = false;
this.rbAccuracy.Location = new System.Drawing.Point(6, 65);
this.rbAccuracy.Name = "rbAccuracy";
this.rbAccuracy.Size = new System.Drawing.Size(224, 17);
this.rbAccuracy.TabIndex = 4;
this.rbAccuracy.TabStop = true;
this.rbAccuracy.Text = "Accuracy (only to fix bugs in Compatibility!)";
this.rbAccuracy.UseVisualStyleBackColor = true;
this.rbAccuracy.CheckedChanged += new System.EventHandler(this.RbAccuracy_CheckedChanged);
//
// rbPerformance
//
this.rbPerformance.AutoSize = true;
this.rbPerformance.Location = new System.Drawing.Point(6, 42);
this.rbPerformance.Name = "rbPerformance";
this.rbPerformance.Size = new System.Drawing.Size(202, 17);
this.rbPerformance.TabIndex = 3;
this.rbPerformance.TabStop = true;
this.rbPerformance.Text = "Performance (only for casual gaming!)";
this.rbPerformance.UseVisualStyleBackColor = true;
//
// cbDoubleSize
//
this.cbDoubleSize.AutoSize = true;
this.cbDoubleSize.Location = new System.Drawing.Point(18, 130);
this.cbDoubleSize.Name = "cbDoubleSize";
this.cbDoubleSize.Size = new System.Drawing.Size(178, 17);
this.cbDoubleSize.TabIndex = 6;
this.cbDoubleSize.Text = "Always Double-Size Framebuffer";
this.cbDoubleSize.UseVisualStyleBackColor = true;
this.cbDoubleSize.CheckedChanged += new System.EventHandler(this.CbDoubleSize_CheckedChanged);
//
// lblDoubleSize
//
this.lblDoubleSize.Location = new System.Drawing.Point(36, 151);
this.lblDoubleSize.Name = "lblDoubleSize";
this.lblDoubleSize.Size = new System.Drawing.Size(254, 57);
this.lblDoubleSize.TabIndex = 7;
this.lblDoubleSize.Text = "Some games are changing the resolution constantly (e.g. SD3) so this option can f" +
this.btnOk = new System.Windows.Forms.Button();
this.btnCancel = new System.Windows.Forms.Button();
this.cbDoubleSize = new System.Windows.Forms.CheckBox();
this.lblDoubleSize = new System.Windows.Forms.Label();
this.radioButton1 = new System.Windows.Forms.RadioButton();
this.cbCropSGBFrame = new System.Windows.Forms.CheckBox();
this.groupBox1 = new System.Windows.Forms.GroupBox();
this.Obj1Checkbox = new System.Windows.Forms.CheckBox();
this.Obj2Checkbox = new System.Windows.Forms.CheckBox();
this.Obj3Checkbox = new System.Windows.Forms.CheckBox();
this.Obj4Checkbox = new System.Windows.Forms.CheckBox();
this.Bg1Checkbox = new System.Windows.Forms.CheckBox();
this.Bg2Checkbox = new System.Windows.Forms.CheckBox();
this.Bg3Checkbox = new System.Windows.Forms.CheckBox();
this.Bg4Checkbox = new System.Windows.Forms.CheckBox();
this.groupBox1.SuspendLayout();
this.SuspendLayout();
//
// btnOk
//
this.btnOk.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
this.btnOk.Location = new System.Drawing.Point(136, 288);
this.btnOk.Name = "btnOk";
this.btnOk.Size = new System.Drawing.Size(75, 23);
this.btnOk.TabIndex = 0;
this.btnOk.Text = "OK";
this.btnOk.UseVisualStyleBackColor = true;
this.btnOk.Click += new System.EventHandler(this.BtnOk_Click);
//
// btnCancel
//
this.btnCancel.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
this.btnCancel.DialogResult = System.Windows.Forms.DialogResult.Cancel;
this.btnCancel.Location = new System.Drawing.Point(217, 288);
this.btnCancel.Name = "btnCancel";
this.btnCancel.Size = new System.Drawing.Size(75, 23);
this.btnCancel.TabIndex = 1;
this.btnCancel.Text = "Cancel";
this.btnCancel.UseVisualStyleBackColor = true;
this.btnCancel.Click += new System.EventHandler(this.BtnCancel_Click);
//
// cbDoubleSize
//
this.cbDoubleSize.AutoSize = true;
this.cbDoubleSize.Location = new System.Drawing.Point(18, 20);
this.cbDoubleSize.Name = "cbDoubleSize";
this.cbDoubleSize.Size = new System.Drawing.Size(178, 17);
this.cbDoubleSize.TabIndex = 6;
this.cbDoubleSize.Text = "Always Double-Size Framebuffer";
this.cbDoubleSize.UseVisualStyleBackColor = true;
this.cbDoubleSize.CheckedChanged += new System.EventHandler(this.CbDoubleSize_CheckedChanged);
//
// lblDoubleSize
//
this.lblDoubleSize.Location = new System.Drawing.Point(36, 41);
this.lblDoubleSize.Name = "lblDoubleSize";
this.lblDoubleSize.Size = new System.Drawing.Size(254, 57);
this.lblDoubleSize.TabIndex = 7;
this.lblDoubleSize.Text = "Some games are changing the resolution constantly (e.g. SD3) so this option can f" +
"orce the SNES output to stay double-size always. NOTE: The Accuracy core runs as" +
" if this is selected.\r\n";
//
// cbForceDeterminism
//
this.cbForceDeterminism.AutoSize = true;
this.cbForceDeterminism.Location = new System.Drawing.Point(15, 234);
this.cbForceDeterminism.Name = "cbForceDeterminism";
this.cbForceDeterminism.Size = new System.Drawing.Size(113, 17);
this.cbForceDeterminism.TabIndex = 8;
this.cbForceDeterminism.Text = "Force Determinism";
this.cbForceDeterminism.UseVisualStyleBackColor = true;
this.cbForceDeterminism.CheckedChanged += new System.EventHandler(this.CbForceDeterminism_CheckedChanged);
//
// label3
//
this.label3.Location = new System.Drawing.Point(34, 258);
this.label3.Name = "label3";
this.label3.Size = new System.Drawing.Size(251, 41);
this.label3.TabIndex = 9;
this.label3.Text = "Guarantee deterministic emulation by savestating every frame. Don\'t TAS without i" +
"t! Only ~75% of runs sync without it, but speed boost is ~30%.";
//
// radioButton1
//
this.radioButton1.AutoSize = true;
this.radioButton1.Location = new System.Drawing.Point(37, 46);
this.radioButton1.Name = "radioButton1";
this.radioButton1.Size = new System.Drawing.Size(202, 17);
this.radioButton1.TabIndex = 9;
this.radioButton1.TabStop = true;
this.radioButton1.Text = "Performance (only for casual gaming!)";
this.radioButton1.UseVisualStyleBackColor = true;
//
// cbCropSGBFrame
//
this.cbCropSGBFrame.AutoSize = true;
this.cbCropSGBFrame.Location = new System.Drawing.Point(15, 211);
this.cbCropSGBFrame.Name = "cbCropSGBFrame";
this.cbCropSGBFrame.Size = new System.Drawing.Size(105, 17);
this.cbCropSGBFrame.TabIndex = 10;
this.cbCropSGBFrame.Text = "Crop SGB Frame";
this.cbCropSGBFrame.UseVisualStyleBackColor = true;
//
// SNESOptions
//
this.AcceptButton = this.btnOk;
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.CancelButton = this.btnCancel;
this.ClientSize = new System.Drawing.Size(304, 343);
this.Controls.Add(this.cbCropSGBFrame);
this.Controls.Add(this.label3);
this.Controls.Add(this.cbForceDeterminism);
this.Controls.Add(this.lblDoubleSize);
this.Controls.Add(this.cbDoubleSize);
this.Controls.Add(this.groupBox1);
this.Controls.Add(this.btnCancel);
this.Controls.Add(this.btnOk);
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog;
this.MaximizeBox = false;
this.MinimizeBox = false;
this.Name = "SNESOptions";
this.ShowIcon = false;
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent;
this.Text = "SNES Options";
this.Load += new System.EventHandler(this.SNESOptions_Load);
this.groupBox1.ResumeLayout(false);
this.groupBox1.PerformLayout();
this.ResumeLayout(false);
this.PerformLayout();
//
// radioButton1
//
this.radioButton1.AutoSize = true;
this.radioButton1.Location = new System.Drawing.Point(37, 46);
this.radioButton1.Name = "radioButton1";
this.radioButton1.Size = new System.Drawing.Size(202, 17);
this.radioButton1.TabIndex = 9;
this.radioButton1.TabStop = true;
this.radioButton1.Text = "Performance (only for casual gaming!)";
this.radioButton1.UseVisualStyleBackColor = true;
//
// cbCropSGBFrame
//
this.cbCropSGBFrame.AutoSize = true;
this.cbCropSGBFrame.Location = new System.Drawing.Point(15, 110);
this.cbCropSGBFrame.Name = "cbCropSGBFrame";
this.cbCropSGBFrame.Size = new System.Drawing.Size(105, 17);
this.cbCropSGBFrame.TabIndex = 10;
this.cbCropSGBFrame.Text = "Crop SGB Frame";
this.cbCropSGBFrame.UseVisualStyleBackColor = true;
//
// groupBox1
//
this.groupBox1.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
| System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.groupBox1.Controls.Add(this.Bg4Checkbox);
this.groupBox1.Controls.Add(this.Bg3Checkbox);
this.groupBox1.Controls.Add(this.Bg2Checkbox);
this.groupBox1.Controls.Add(this.Bg1Checkbox);
this.groupBox1.Controls.Add(this.Obj4Checkbox);
this.groupBox1.Controls.Add(this.Obj3Checkbox);
this.groupBox1.Controls.Add(this.Obj2Checkbox);
this.groupBox1.Controls.Add(this.Obj1Checkbox);
this.groupBox1.Location = new System.Drawing.Point(18, 142);
this.groupBox1.Name = "groupBox1";
this.groupBox1.Size = new System.Drawing.Size(274, 140);
this.groupBox1.TabIndex = 11;
this.groupBox1.TabStop = false;
this.groupBox1.Text = "Display";
//
// Obj1Checkbox
//
this.Obj1Checkbox.AutoSize = true;
this.Obj1Checkbox.Location = new System.Drawing.Point(21, 29);
this.Obj1Checkbox.Name = "Obj1Checkbox";
this.Obj1Checkbox.Size = new System.Drawing.Size(55, 17);
this.Obj1Checkbox.TabIndex = 0;
this.Obj1Checkbox.Text = "OBJ 1";
this.Obj1Checkbox.UseVisualStyleBackColor = true;
//
// Obj2Checkbox
//
this.Obj2Checkbox.AutoSize = true;
this.Obj2Checkbox.Location = new System.Drawing.Point(22, 52);
this.Obj2Checkbox.Name = "Obj2Checkbox";
this.Obj2Checkbox.Size = new System.Drawing.Size(55, 17);
this.Obj2Checkbox.TabIndex = 1;
this.Obj2Checkbox.Text = "OBJ 2";
this.Obj2Checkbox.UseVisualStyleBackColor = true;
//
// Obj3Checkbox
//
this.Obj3Checkbox.AutoSize = true;
this.Obj3Checkbox.Location = new System.Drawing.Point(21, 75);
this.Obj3Checkbox.Name = "Obj3Checkbox";
this.Obj3Checkbox.Size = new System.Drawing.Size(55, 17);
this.Obj3Checkbox.TabIndex = 2;
this.Obj3Checkbox.Text = "OBJ 3";
this.Obj3Checkbox.UseVisualStyleBackColor = true;
//
// Obj4Checkbox
//
this.Obj4Checkbox.AutoSize = true;
this.Obj4Checkbox.Location = new System.Drawing.Point(21, 98);
this.Obj4Checkbox.Name = "Obj4Checkbox";
this.Obj4Checkbox.Size = new System.Drawing.Size(55, 17);
this.Obj4Checkbox.TabIndex = 3;
this.Obj4Checkbox.Text = "OBJ 4";
this.Obj4Checkbox.UseVisualStyleBackColor = true;
//
// Bg1Checkbox
//
this.Bg1Checkbox.AutoSize = true;
this.Bg1Checkbox.Location = new System.Drawing.Point(150, 29);
this.Bg1Checkbox.Name = "Bg1Checkbox";
this.Bg1Checkbox.Size = new System.Drawing.Size(50, 17);
this.Bg1Checkbox.TabIndex = 4;
this.Bg1Checkbox.Text = "BG 1";
this.Bg1Checkbox.UseVisualStyleBackColor = true;
//
// Bg2Checkbox
//
this.Bg2Checkbox.AutoSize = true;
this.Bg2Checkbox.Location = new System.Drawing.Point(150, 52);
this.Bg2Checkbox.Name = "Bg2Checkbox";
this.Bg2Checkbox.Size = new System.Drawing.Size(50, 17);
this.Bg2Checkbox.TabIndex = 5;
this.Bg2Checkbox.Text = "BG 2";
this.Bg2Checkbox.UseVisualStyleBackColor = true;
//
// Bg3Checkbox
//
this.Bg3Checkbox.AutoSize = true;
this.Bg3Checkbox.Location = new System.Drawing.Point(150, 75);
this.Bg3Checkbox.Name = "Bg3Checkbox";
this.Bg3Checkbox.Size = new System.Drawing.Size(50, 17);
this.Bg3Checkbox.TabIndex = 6;
this.Bg3Checkbox.Text = "BG 3";
this.Bg3Checkbox.UseVisualStyleBackColor = true;
//
// Bg4Checkbox
//
this.Bg4Checkbox.AutoSize = true;
this.Bg4Checkbox.Location = new System.Drawing.Point(150, 98);
this.Bg4Checkbox.Name = "Bg4Checkbox";
this.Bg4Checkbox.Size = new System.Drawing.Size(50, 17);
this.Bg4Checkbox.TabIndex = 7;
this.Bg4Checkbox.Text = "BG 4";
this.Bg4Checkbox.UseVisualStyleBackColor = true;
//
// SNESOptions
//
this.AcceptButton = this.btnOk;
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.CancelButton = this.btnCancel;
this.ClientSize = new System.Drawing.Size(304, 323);
this.Controls.Add(this.groupBox1);
this.Controls.Add(this.cbCropSGBFrame);
this.Controls.Add(this.lblDoubleSize);
this.Controls.Add(this.cbDoubleSize);
this.Controls.Add(this.btnCancel);
this.Controls.Add(this.btnOk);
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog;
this.MaximizeBox = false;
this.MinimizeBox = false;
this.Name = "SNESOptions";
this.ShowIcon = false;
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent;
this.Text = "BSNES Options";
this.groupBox1.ResumeLayout(false);
this.groupBox1.PerformLayout();
this.ResumeLayout(false);
this.PerformLayout();
}
@ -220,16 +242,18 @@
private System.Windows.Forms.Button btnOk;
private System.Windows.Forms.Button btnCancel;
private System.Windows.Forms.RadioButton rbCompatibility;
private System.Windows.Forms.GroupBox groupBox1;
private System.Windows.Forms.RadioButton rbPerformance;
private System.Windows.Forms.CheckBox cbDoubleSize;
private System.Windows.Forms.Label lblDoubleSize;
private System.Windows.Forms.RadioButton rbAccuracy;
private System.Windows.Forms.Label label2;
private System.Windows.Forms.CheckBox cbForceDeterminism;
private System.Windows.Forms.Label label3;
private System.Windows.Forms.RadioButton radioButton1;
private System.Windows.Forms.CheckBox cbCropSGBFrame;
private System.Windows.Forms.GroupBox groupBox1;
private System.Windows.Forms.CheckBox Bg4Checkbox;
private System.Windows.Forms.CheckBox Bg3Checkbox;
private System.Windows.Forms.CheckBox Bg2Checkbox;
private System.Windows.Forms.CheckBox Bg1Checkbox;
private System.Windows.Forms.CheckBox Obj4Checkbox;
private System.Windows.Forms.CheckBox Obj3Checkbox;
private System.Windows.Forms.CheckBox Obj2Checkbox;
private System.Windows.Forms.CheckBox Obj1Checkbox;
}
}

View File

@ -22,58 +22,36 @@ namespace BizHawk.Client.EmuHawk
var dlg = new SNESOptions
{
AlwaysDoubleSize = s.AlwaysDoubleSize,
ForceDeterminism = s.ForceDeterminism,
CropSGBFrame = s.CropSGBFrame,
Profile = ss.Profile
ShowObj1 = s.ShowOBJ_0,
ShowObj2 = s.ShowOBJ_1,
ShowObj3 = s.ShowOBJ_2,
ShowObj4 = s.ShowOBJ_3,
ShowBg1 = s.ShowBG1_0,
ShowBg2 = s.ShowBG2_0,
ShowBg3 = s.ShowBG3_0,
ShowBg4 = s.ShowBG4_0
};
var result = dlg.ShowDialog(owner);
if (result == DialogResult.OK)
{
s.AlwaysDoubleSize = dlg.AlwaysDoubleSize;
s.ForceDeterminism = dlg.ForceDeterminism;
s.CropSGBFrame = dlg.CropSGBFrame;
ss.Profile = dlg.Profile;
s.ShowOBJ_0 = dlg.ShowObj1;
s.ShowOBJ_1 = dlg.ShowObj2;
s.ShowOBJ_2 = dlg.ShowObj3;
s.ShowOBJ_3 = dlg.ShowObj4;
s.ShowBG1_0 = s.ShowBG1_1 = dlg.ShowBg1;
s.ShowBG2_0 = s.ShowBG2_1 = dlg.ShowBg2;
s.ShowBG3_0 = s.ShowBG3_1 = dlg.ShowBg3;
s.ShowBG4_0 = s.ShowBG4_1 = dlg.ShowBg4;
GlobalWin.MainForm.PutCoreSettings(s);
GlobalWin.MainForm.PutCoreSyncSettings(ss);
}
}
private void SNESOptions_Load(object sender, EventArgs e)
{
rbAccuracy.Visible = label2.Visible = VersionInfo.DeveloperBuild;
}
private string Profile
{
get
{
if (rbCompatibility.Checked)
{
return "Compatibility";
}
if (rbPerformance.Checked)
{
return "Performance";
}
if (rbAccuracy.Checked)
{
return "Accuracy";
}
throw new InvalidOperationException();
}
set
{
rbCompatibility.Checked = value == "Compatibility";
rbPerformance.Checked = value == "Performance";
rbAccuracy.Checked = value == "Accuracy";
}
}
private bool AlwaysDoubleSize
{
get
@ -88,32 +66,29 @@ namespace BizHawk.Client.EmuHawk
}
}
private bool ForceDeterminism
{
get { return cbForceDeterminism.Checked; }
set { cbForceDeterminism.Checked = value; }
}
private bool CropSGBFrame
{
get { return cbCropSGBFrame.Checked; }
set { cbCropSGBFrame.Checked = value; }
}
void RefreshDoubleSizeOption()
private bool ShowObj1 { get { return Obj1Checkbox.Checked; } set { Obj1Checkbox.Checked = value; } }
private bool ShowObj2 { get { return Obj2Checkbox.Checked; } set { Obj2Checkbox.Checked = value; } }
private bool ShowObj3 { get { return Obj3Checkbox.Checked; } set { Obj3Checkbox.Checked = value; } }
private bool ShowObj4 { get { return Obj4Checkbox.Checked; } set { Obj4Checkbox.Checked = value; } }
private bool ShowBg1 { get { return Bg1Checkbox.Checked; } set { Bg1Checkbox.Checked = value; } }
private bool ShowBg2 { get { return Bg2Checkbox.Checked; } set { Bg2Checkbox.Checked = value; } }
private bool ShowBg3 { get { return Bg3Checkbox.Checked; } set { Bg3Checkbox.Checked = value; } }
private bool ShowBg4 { get { return Bg4Checkbox.Checked; } set { Bg4Checkbox.Checked = value; } }
private void RefreshDoubleSizeOption()
{
_suppressDoubleSize = true;
cbDoubleSize.Checked = !cbDoubleSize.Enabled || _userDoubleSizeOption;
_suppressDoubleSize = false;
}
private void RbAccuracy_CheckedChanged(object sender, EventArgs e)
{
cbDoubleSize.Enabled = !rbAccuracy.Checked;
lblDoubleSize.ForeColor = cbDoubleSize.Enabled ? System.Drawing.SystemColors.ControlText : System.Drawing.SystemColors.GrayText;
RefreshDoubleSizeOption();
}
private void CbDoubleSize_CheckedChanged(object sender, EventArgs e)
{
if (_suppressDoubleSize)
@ -124,10 +99,6 @@ namespace BizHawk.Client.EmuHawk
_userDoubleSizeOption = cbDoubleSize.Checked;
}
private void CbForceDeterminism_CheckedChanged(object sender, EventArgs e)
{
}
private void BtnOk_Click(object sender, EventArgs e)
{
DialogResult = DialogResult.OK;

Binary file not shown.

After

Width:  |  Height:  |  Size: 78 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 38 KiB

View File

@ -7,9 +7,10 @@ using System.Linq;
using System.Text;
using System.Windows.Forms;
using BizHawk.Client.Common;
using BizHawk.Emulation.Cores.Consoles.Sega.gpgx;
using System.Drawing.Imaging;
using BizHawk.Emulation.Common;
using BizHawk.Emulation.Cores.Consoles.Sega.gpgx64;
using BizHawk.Common;
namespace BizHawk.Client.EmuHawk
{
@ -18,7 +19,8 @@ namespace BizHawk.Client.EmuHawk
[RequiredService]
private GPGX Emu { get; set; }
private LibGPGX.VDPView View = new LibGPGX.VDPView();
private GPGX.VDPView View;
int palindex = 0;
protected override System.Drawing.Point ScrollToControl(System.Windows.Forms.Control activeControl)
@ -81,7 +83,7 @@ namespace BizHawk.Client.EmuHawk
bv.Refresh();
}
unsafe void DrawPalettes(int *pal)
unsafe void DrawPalettes(int* pal)
{
var lockdata = bmpViewPal.BMP.LockBits(new Rectangle(0, 0, 16, 4), ImageLockMode.WriteOnly, PixelFormat.Format32bppArgb);
int pitch = lockdata.Stride / sizeof(int);
@ -121,23 +123,24 @@ namespace BizHawk.Client.EmuHawk
public void NewUpdate(ToolFormUpdateType type) { }
public void UpdateValues()
public unsafe void UpdateValues()
{
if (Emu == null)
return;
Emu.UpdateVDPViewContext(View);
unsafe
using ((View = Emu.UpdateVDPViewContext()).EnterExit())
{
int* pal = (int*)View.ColorCache;
//for (int i = 0; i < 0x40; i++)
// pal[i] |= unchecked((int)0xff000000);
DrawPalettes(pal);
DrawTiles();
ushort *VRAMNT = (ushort*)View.VRAM;
byte *tiles = (byte*)View.PatternCache;
ushort* VRAMNT = (ushort*)View.VRAM;
byte* tiles = (byte*)View.PatternCache;
DrawNameTable(View.NTA, VRAMNT, tiles, pal, bmpViewNTA);
DrawNameTable(View.NTB, VRAMNT, tiles, pal, bmpViewNTB);
DrawNameTable(View.NTW, VRAMNT, tiles, pal, bmpViewNTW);
View = null;
}
}

File diff suppressed because it is too large Load Diff

View File

@ -8,7 +8,7 @@ using System.ComponentModel;
using BizHawk.Emulation.Common;
using BizHawk.Emulation.Common.IEmulatorExtensions;
using BizHawk.Emulation.Cores.Nintendo.SNES;
using BizHawk.Emulation.Cores.Nintendo.SNES9X;
using BizHawk.Client.Common;
using BizHawk.Client.Common.MovieConversionExtensions;
@ -300,39 +300,33 @@ namespace BizHawk.Client.EmuHawk
Mainform.PauseOnFrame = null;
Mainform.PauseEmulator();
// Start Scenario 0: bsnes in performance mode (copied from RecordMovieMenuItem_Click())
if (Emulator is LibsnesCore)
// Start Scenario 0: snes9x needs a nag (copied from RecordMovieMenuItem_Click())
if (Emulator is Snes9x)
{
var snes = (LibsnesCore)Emulator;
if (snes.CurrentProfile == "Performance")
var box = new CustomControls.MsgBox(
"While the Snes9x core is faster, it is not nearly as accurate as bsnes. \nIt is recommended that you switch to the bsnes core for movie recording\nSwitch to bsnes?",
"Accuracy Warning",
MessageBoxIcon.Warning);
box.SetButtons(
new[] { "Switch", "Cancel" },
new[] { DialogResult.Yes, DialogResult.Cancel });
box.MaximumSize = new Size(475, 350);
box.SetMessageToAutoSize();
var result = box.ShowDialog();
if (result == DialogResult.Yes)
{
var box = new CustomControls.MsgBox(
"While the performance core is faster, it is not stable enough for movie recording\n\nSwitch to Compatibility?",
"Stability Warning",
MessageBoxIcon.Warning);
box.SetButtons(
new[] { "Switch", "Cancel" },
new[] { DialogResult.Yes, DialogResult.Cancel });
box.MaximumSize = new Size(450, 350);
box.SetMessageToAutoSize();
var result = box.ShowDialog();
if (result == DialogResult.Yes)
{
var ss = snes.GetSyncSettings();
ss.Profile = "Compatibility";
snes.PutSyncSettings(ss);
Mainform.RebootCore();
}
else if (result == DialogResult.Cancel)
{
return false;
}
Global.Config.SNES_InSnes9x = false;
Mainform.RebootCore();
}
else if (result == DialogResult.Cancel)
{
return false;
}
}
// Start Scenario 1: A regular movie is active
if (Global.MovieSession.Movie.IsActive && !(Global.MovieSession.Movie is TasMovie))
{

View File

@ -84,6 +84,7 @@ namespace BizHawk.Client.EmuHawk
PadBox.Controls.Add(new VirtualPadAnalogStick
{
Name = button.Name,
SecondaryName = button.SecondaryNames.Any() ? button.SecondaryNames[0] : "",
Location = UIHelper.Scale(button.Location),
Size = UIHelper.Scale(new Size(180 + 79, 200 + 9)),
RangeX = new float[] { button.MinValue, button.MidValue, button.MaxValue },

View File

@ -40,12 +40,16 @@ namespace BizHawk.Client.EmuHawk
public float[] RangeX = new float[] { -128f, 0.0f, 127f };
public float[] RangeY = new float[] { -128f, 0.0f, 127f };
public string SecondaryName { get; set; }
private void VirtualPadAnalogStick_Load(object sender, EventArgs e)
{
AnalogStick.Name = Name;
AnalogStick.XName = Name;
AnalogStick.YName = Name.Replace("X", "Y"); // TODO: allow schema to dictate this but this is a convenient default
AnalogStick.YName = !string.IsNullOrEmpty(SecondaryName)
? SecondaryName
: Name.Replace("X", "Y"); // Fallback
AnalogStick.SetRangeX(RangeX);
AnalogStick.SetRangeY(RangeY);
@ -228,7 +232,7 @@ namespace BizHawk.Client.EmuHawk
manualR.ValueChanged -= polarNumericChangedEventHandler;
manualTheta.ValueChanged -= polarNumericChangedEventHandler;
manualR.Value = (decimal)Math.Sqrt(Math.Pow(AnalogStick.X - rangeAverageX, 2) + Math.Pow(AnalogStick.Y - rangeAverageY, 2));
manualR.Value = Math.Min(manualR.Value, (decimal)Math.Sqrt(Math.Pow(AnalogStick.X - rangeAverageX, 2) + Math.Pow(AnalogStick.Y - rangeAverageY, 2)));
manualTheta.Value = (decimal)(Math.Atan2(AnalogStick.Y - rangeAverageY, AnalogStick.X - rangeAverageX) * (180 / Math.PI));
manualR.ValueChanged += polarNumericChangedEventHandler;

View File

@ -0,0 +1,102 @@
using System.Collections.Generic;
using System.Drawing;
using BizHawk.Emulation.Common;
namespace BizHawk.Client.EmuHawk
{
[SchemaAttributes("NGP")]
public class NgpSchema : IVirtualPadSchema
{
public IEnumerable<PadSchema> GetPadSchemas(IEmulator core)
{
yield return StandardController();
yield return ConsoleButtons();
}
private static PadSchema StandardController()
{
return new PadSchema
{
IsConsole = false,
DefaultSize = new Size(174, 79),
Buttons = new[]
{
new PadSchema.ButtonSchema
{
Name = "Up",
DisplayName = "",
Icon = Properties.Resources.BlueUp,
Location = new Point(14, 12),
Type = PadSchema.PadInputType.Boolean
},
new PadSchema.ButtonSchema
{
Name = "Down",
DisplayName = "",
Icon = Properties.Resources.BlueDown,
Location = new Point(14, 56),
Type = PadSchema.PadInputType.Boolean
},
new PadSchema.ButtonSchema
{
Name = "Left",
DisplayName = "",
Icon = Properties.Resources.Back,
Location = new Point(2, 34),
Type = PadSchema.PadInputType.Boolean
},
new PadSchema.ButtonSchema
{
Name = "Right",
DisplayName = "",
Icon = Properties.Resources.Forward,
Location = new Point(24, 34),
Type = PadSchema.PadInputType.Boolean
},
new PadSchema.ButtonSchema
{
Name = "B",
DisplayName = "B",
Location = new Point(74, 34),
Type = PadSchema.PadInputType.Boolean
},
new PadSchema.ButtonSchema
{
Name = "A",
DisplayName = "A",
Location = new Point(98, 34),
Type = PadSchema.PadInputType.Boolean
},
new PadSchema.ButtonSchema
{
Name = "Option",
DisplayName = "O",
Location = new Point(146, 12),
Type = PadSchema.PadInputType.Boolean
}
}
};
}
private static PadSchema ConsoleButtons()
{
return new PadSchema
{
DisplayName = "Console",
IsConsole = true,
DefaultSize = new Size(75, 50),
Buttons = new[]
{
new PadSchema.ButtonSchema
{
Name = "Power",
DisplayName = "Power",
Location = new Point(10, 15),
Type = PadSchema.PadInputType.Boolean
}
}
};
}
}
}

View File

@ -1,7 +1,10 @@
using System.Collections.Generic;
using System.Drawing;
using System.Linq;
using System.Windows.Forms;
using BizHawk.Emulation.Common;
using BizHawk.Emulation.Cores.Consoles.Sega.Saturn;
namespace BizHawk.Client.EmuHawk
{
@ -10,9 +13,56 @@ namespace BizHawk.Client.EmuHawk
{
public IEnumerable<PadSchema> GetPadSchemas(IEmulator core)
{
yield return StandardController(1);
yield return StandardController(2);
yield return ConsoleButtons();
var ss = ((Saturnus)core).GetSyncSettings();
int totalPorts = (ss.Port1Multitap ? 6 : 1) + (ss.Port2Multitap ? 6 : 1);
var padSchemas = new SaturnusControllerDeck.Device[]
{
ss.Port1,
ss.Port2,
ss.Port3,
ss.Port4,
ss.Port5,
ss.Port6,
ss.Port7,
ss.Port8,
ss.Port9,
ss.Port10,
ss.Port11,
ss.Port12
}.Take(totalPorts)
.Where(p => p != SaturnusControllerDeck.Device.None)
.Select((p, i) => GenerateSchemaForPort(p, i + 1))
.Where(s => s != null)
.Concat(new[] { ConsoleButtons() });
return padSchemas;
}
private static PadSchema GenerateSchemaForPort(SaturnusControllerDeck.Device device, int controllerNum)
{
switch (device)
{
default:
case SaturnusControllerDeck.Device.None:
return null;
case SaturnusControllerDeck.Device.Gamepad:
return StandardController(controllerNum);
case SaturnusControllerDeck.Device.ThreeDeePad:
return ThreeDeeController(controllerNum);
case SaturnusControllerDeck.Device.Mouse:
return Mouse(controllerNum);
case SaturnusControllerDeck.Device.Wheel:
return Wheel(controllerNum);
case SaturnusControllerDeck.Device.Mission:
return MissionControl(controllerNum);
case SaturnusControllerDeck.Device.DualMission:
return DualMissionControl(controllerNum);
case SaturnusControllerDeck.Device.Keyboard:
MessageBox.Show("This peripheral is not supported yet");
return null;
}
}
private static PadSchema StandardController(int controller)
@ -20,7 +70,7 @@ namespace BizHawk.Client.EmuHawk
return new PadSchema
{
IsConsole = false,
DefaultSize = new Size(212, 90),
DefaultSize = new Size(500, 500),
Buttons = new[]
{
new PadSchema.ButtonSchema
@ -122,6 +172,435 @@ namespace BizHawk.Client.EmuHawk
};
}
private static PadSchema ThreeDeeController(int controller)
{
return new PadSchema
{
IsConsole = false,
DefaultSize = new Size(458, 285),
Buttons = new[]
{
new PadSchema.ButtonSchema
{
Name = "P" + controller + " Up",
DisplayName = "",
Icon = Properties.Resources.BlueUp,
Location = new Point(290, 77),
Type = PadSchema.PadInputType.Boolean
},
new PadSchema.ButtonSchema
{
Name = "P" + controller + " Down",
DisplayName = "",
Icon = Properties.Resources.BlueDown,
Location = new Point(290, 121),
Type = PadSchema.PadInputType.Boolean
},
new PadSchema.ButtonSchema
{
Name = "P" + controller + " Left",
DisplayName = "",
Icon = Properties.Resources.Back,
Location = new Point(278, 99),
Type = PadSchema.PadInputType.Boolean
},
new PadSchema.ButtonSchema
{
Name = "P" + controller + " Right",
DisplayName = "",
Icon = Properties.Resources.Forward,
Location = new Point(300, 99),
Type = PadSchema.PadInputType.Boolean
},
new PadSchema.ButtonSchema
{
Name = "P" + controller + " Start",
DisplayName = "S",
Location = new Point(334, 112),
Type = PadSchema.PadInputType.Boolean
},
new PadSchema.ButtonSchema
{
Name = "P" + controller + " A",
DisplayName = "A",
Location = new Point(366, 123),
Type = PadSchema.PadInputType.Boolean
},
new PadSchema.ButtonSchema
{
Name = "P" + controller + " B",
DisplayName = "B",
Location = new Point(390, 113),
Type = PadSchema.PadInputType.Boolean
},
new PadSchema.ButtonSchema
{
Name = "P" + controller + " C",
DisplayName = "C",
Location = new Point(414, 103),
Type = PadSchema.PadInputType.Boolean
},
new PadSchema.ButtonSchema
{
Name = "P" + controller + " X",
DisplayName = "X",
Location = new Point(366, 100),
Type = PadSchema.PadInputType.Boolean
},
new PadSchema.ButtonSchema
{
Name = "P" + controller + " Y",
DisplayName = "Y",
Location = new Point(390, 90),
Type = PadSchema.PadInputType.Boolean
},
new PadSchema.ButtonSchema
{
Name = "P" + controller + " Z",
DisplayName = "Z",
Location = new Point(414, 80),
Type = PadSchema.PadInputType.Boolean
},
new PadSchema.ButtonSchema
{
Name = $"P{controller} Stick Horizontal",
SecondaryNames = new[] { $"P{controller} StickVertical" },
MinValue = 0,
MidValue = 127,
MaxValue = 255,
MinValueSec = 0,
MidValueSec = 127,
MaxValueSec = 255,
DisplayName = "",
Location = new Point(6, 74),
Type = PadSchema.PadInputType.AnalogStick
},
new PadSchema.ButtonSchema
{
Name = $"P{controller} Left Shoulder",
DisplayName = "L",
Location = new Point(8, 12),
Type = PadSchema.PadInputType.FloatSingle,
TargetSize = new Size(128, 55),
MinValue = 0,
MaxValue = 255,
},
new PadSchema.ButtonSchema
{
Name = $"P{controller} Right Shoulder",
DisplayName = "L",
Location = new Point(328, 12),
Type = PadSchema.PadInputType.FloatSingle,
TargetSize = new Size(128, 55),
MinValue = 0,
MaxValue = 255,
}
}
};
}
private static PadSchema Mouse(int controller)
{
return new PadSchema
{
DisplayName = "Mouse",
IsConsole = false,
DefaultSize = new Size(375, 320),
Buttons = new[]
{
new PadSchema.ButtonSchema
{
Name = $"P{controller} X",
SecondaryNames = new[] { $"P{controller} Y" },
Location = new Point(14, 17),
Type = PadSchema.PadInputType.TargetedPair,
TargetSize = new Size(256, 256)
},
new PadSchema.ButtonSchema
{
Name = "P" + controller + " Mouse Left",
DisplayName = "Left",
Location = new Point(300, 17),
Type = PadSchema.PadInputType.Boolean
},
new PadSchema.ButtonSchema
{
Name = "P" + controller + " Mouse Center",
DisplayName = "Center",
Location = new Point(300, 47),
Type = PadSchema.PadInputType.Boolean
},
new PadSchema.ButtonSchema
{
Name = "P" + controller + " Mouse Right",
DisplayName = "Right",
Location = new Point(300, 77),
Type = PadSchema.PadInputType.Boolean
},
new PadSchema.ButtonSchema
{
Name = "P" + controller + " Start",
DisplayName = "Start",
Location = new Point(300, 107),
Type = PadSchema.PadInputType.Boolean
}
},
};
}
private static PadSchema Wheel(int controller)
{
return new PadSchema
{
DisplayName = "Wheel",
IsConsole = false,
DefaultSize = new Size(325, 100),
Buttons = new[]
{
new PadSchema.ButtonSchema
{
Name = $"P{controller} Wheel",
DisplayName = "Wheel",
Location = new Point(8, 12),
Type = PadSchema.PadInputType.FloatSingle,
TargetSize = new Size(128, 55),
MinValue = 0,
MaxValue = 255,
},
new PadSchema.ButtonSchema
{
Name = "P" + controller + " Up",
DisplayName = "",
Icon = Properties.Resources.BlueUp,
Location = new Point(150, 20),
Type = PadSchema.PadInputType.Boolean
},
new PadSchema.ButtonSchema
{
Name = "P" + controller + " Down",
DisplayName = "",
Icon = Properties.Resources.BlueDown,
Location = new Point(150, 43),
Type = PadSchema.PadInputType.Boolean
},
new PadSchema.ButtonSchema
{
Name = "P" + controller + " A",
DisplayName = "A",
Location = new Point(180, 63),
Type = PadSchema.PadInputType.Boolean
},
new PadSchema.ButtonSchema
{
Name = "P" + controller + " B",
DisplayName = "B",
Location = new Point(204, 53),
Type = PadSchema.PadInputType.Boolean
},
new PadSchema.ButtonSchema
{
Name = "P" + controller + " C",
DisplayName = "C",
Location = new Point(228, 43),
Type = PadSchema.PadInputType.Boolean
},
new PadSchema.ButtonSchema
{
Name = "P" + controller + " X",
DisplayName = "X",
Location = new Point(180, 40),
Type = PadSchema.PadInputType.Boolean
},
new PadSchema.ButtonSchema
{
Name = "P" + controller + " Y",
DisplayName = "Y",
Location = new Point(204, 30),
Type = PadSchema.PadInputType.Boolean
},
new PadSchema.ButtonSchema
{
Name = "P" + controller + " Z",
DisplayName = "Z",
Location = new Point(228, 20),
Type = PadSchema.PadInputType.Boolean
},
new PadSchema.ButtonSchema
{
Name = "P" + controller + " Start",
DisplayName = "Start",
Location = new Point(268, 20),
Type = PadSchema.PadInputType.Boolean
},
},
};
}
private static PadSchema MissionControl(int controller)
{
return new PadSchema
{
DisplayName = "Mission",
IsConsole = false,
DefaultSize = new Size(445, 230),
Buttons = new[]
{
new PadSchema.ButtonSchema
{
Name = "P" + controller + " Start",
DisplayName = "Start",
Location = new Point(45, 15),
Type = PadSchema.PadInputType.Boolean
},
new PadSchema.ButtonSchema
{
Name = "P" + controller + " L",
DisplayName = "L",
Location = new Point(5, 58),
Type = PadSchema.PadInputType.Boolean
},
new PadSchema.ButtonSchema
{
Name = "P" + controller + " R",
DisplayName = "R",
Location = new Point(105, 58),
Type = PadSchema.PadInputType.Boolean
},
new PadSchema.ButtonSchema
{
Name = "P" + controller + " X",
DisplayName = "X",
Location = new Point(30, 43),
Type = PadSchema.PadInputType.Boolean
},
new PadSchema.ButtonSchema
{
Name = "P" + controller + " Y",
DisplayName = "Y",
Location = new Point(55, 43),
Type = PadSchema.PadInputType.Boolean
},
new PadSchema.ButtonSchema
{
Name = "P" + controller + " Z",
DisplayName = "Z",
Location = new Point(80, 43),
Type = PadSchema.PadInputType.Boolean
},
new PadSchema.ButtonSchema
{
Name = "P" + controller + " A",
DisplayName = "A",
Location = new Point(30, 70),
Type = PadSchema.PadInputType.Boolean
},
new PadSchema.ButtonSchema
{
Name = "P" + controller + " B",
DisplayName = "B",
Location = new Point(55, 70),
Type = PadSchema.PadInputType.Boolean
},
new PadSchema.ButtonSchema
{
Name = "P" + controller + " C",
DisplayName = "C",
Location = new Point(80, 70),
Type = PadSchema.PadInputType.Boolean
},
new PadSchema.ButtonSchema
{
Name = $"P{controller} Stick Horizontal",
SecondaryNames = new[] { $"P{controller} Stick Vertical" },
MinValue = 0,
MidValue = 127,
MaxValue = 255,
MinValueSec = 0,
MidValueSec = 127,
MaxValueSec = 255,
DisplayName = "",
Location = new Point(185, 13),
Type = PadSchema.PadInputType.AnalogStick
},
new PadSchema.ButtonSchema
{
Name = "P" + controller + " Throttle",
DisplayName = "Throttle",
Location = new Point(135, 13),
Type = PadSchema.PadInputType.FloatSingle,
TargetSize = new Size(64, 178),
MinValue = 0,
MaxValue = 255,
Orientation = Orientation.Vertical
}
}
};
}
private static PadSchema DualMissionControl(int controller)
{
return new PadSchema
{
DisplayName = "Dual Mission",
IsConsole = false,
DefaultSize = new Size(680, 230),
Buttons = new[]
{
new PadSchema.ButtonSchema
{
Name = $"P{controller} Left Stick Horizontal",
SecondaryNames = new[] { $"P{controller} Left Stick Vertical" },
MinValue = 0,
MidValue = 127,
MaxValue = 255,
MinValueSec = 0,
MidValueSec = 127,
MaxValueSec = 255,
DisplayName = "",
Location = new Point(58, 13),
Type = PadSchema.PadInputType.AnalogStick
},
new PadSchema.ButtonSchema
{
Name = "P" + controller + " Left Throttle",
DisplayName = "Throttle",
Location = new Point(8, 13),
Type = PadSchema.PadInputType.FloatSingle,
TargetSize = new Size(64, 178),
MinValue = 0,
MaxValue = 255,
Orientation = Orientation.Vertical
},
new PadSchema.ButtonSchema
{
Name = $"P{controller} Right Stick Horizontal",
SecondaryNames = new[] { $"P{controller} Right StickVertical" },
MinValue = 0,
MidValue = 127,
MaxValue = 255,
MinValueSec = 0,
MidValueSec = 127,
MaxValueSec = 255,
DisplayName = "",
Location = new Point(400, 13),
Type = PadSchema.PadInputType.AnalogStick
},
new PadSchema.ButtonSchema
{
Name = "P" + controller + " Right Throttle",
DisplayName = "Throttle",
Location = new Point(350, 13),
Type = PadSchema.PadInputType.FloatSingle,
TargetSize = new Size(64, 178),
MinValue = 0,
MaxValue = 255,
Orientation = Orientation.Vertical
}
}
};
}
private static PadSchema ConsoleButtons()
{
return new PadSchema

View File

@ -3,6 +3,7 @@ using System.Drawing;
using BizHawk.Emulation.Common;
using BizHawk.Emulation.Cores.Nintendo.SNES;
using BizHawk.Emulation.Cores.Nintendo.SNES9X;
namespace BizHawk.Client.EmuHawk
{
@ -10,6 +11,49 @@ namespace BizHawk.Client.EmuHawk
public class SnesSchema : IVirtualPadSchema
{
public IEnumerable<PadSchema> GetPadSchemas(IEmulator core)
{
if (core is LibsnesCore)
{
return GetBsnesPadSchemas(core);
}
return GetSnes9xPadSchemas(core);
}
private IEnumerable<PadSchema> GetSnes9xPadSchemas(IEmulator core)
{
// Only standard controller is supported on the left port
yield return StandardController(1);
Snes9x.SyncSettings syncSettings = ((Snes9x)core).GetSyncSettings();
LibSnes9x.RightPortDevice rightPort = syncSettings.RightPort;
switch (rightPort)
{
default:
case LibSnes9x.RightPortDevice.Joypad:
yield return StandardController(2);
break;
case LibSnes9x.RightPortDevice.Justifier:
yield return Justifier(2);
break;
case LibSnes9x.RightPortDevice.Mouse:
yield return Mouse(2);
break;
case LibSnes9x.RightPortDevice.Multitap:
yield return StandardController(2);
yield return StandardController(3);
yield return StandardController(4);
yield return StandardController(5);
break;
case LibSnes9x.RightPortDevice.SuperScope:
yield return SuperScope(2);
break;
}
yield return ConsoleButtons();
}
private IEnumerable<PadSchema> GetBsnesPadSchemas(IEmulator core)
{
var syncsettings = ((LibsnesCore)core).GetSyncSettings();

View File

@ -0,0 +1,155 @@
using System.Collections.Generic;
using System.Drawing;
using BizHawk.Emulation.Common;
namespace BizHawk.Client.EmuHawk
{
[SchemaAttributes("VB")]
public class VirtualBoySchema : IVirtualPadSchema
{
public IEnumerable<PadSchema> GetPadSchemas(IEmulator core)
{
yield return StandardController();
yield return ConsoleButtons();
}
private static PadSchema StandardController()
{
return new PadSchema
{
IsConsole = false,
DefaultSize = new Size(222, 103),
Buttons = new[]
{
new PadSchema.ButtonSchema
{
Name = "L_Up",
DisplayName = "",
Icon = Properties.Resources.BlueUp,
Location = new Point(14, 36),
Type = PadSchema.PadInputType.Boolean
},
new PadSchema.ButtonSchema
{
Name = "L_Down",
DisplayName = "",
Icon = Properties.Resources.BlueDown,
Location = new Point(14, 80),
Type = PadSchema.PadInputType.Boolean
},
new PadSchema.ButtonSchema
{
Name = "L_Left",
DisplayName = "",
Icon = Properties.Resources.Back,
Location = new Point(2, 58),
Type = PadSchema.PadInputType.Boolean
},
new PadSchema.ButtonSchema
{
Name = "L_Right",
DisplayName = "",
Icon = Properties.Resources.Forward,
Location = new Point(24, 58),
Type = PadSchema.PadInputType.Boolean
},
new PadSchema.ButtonSchema
{
Name = "B",
DisplayName = "B",
Location = new Point(122, 58),
Type = PadSchema.PadInputType.Boolean
},
new PadSchema.ButtonSchema
{
Name = "A",
DisplayName = "A",
Location = new Point(146, 58),
Type = PadSchema.PadInputType.Boolean
},
new PadSchema.ButtonSchema
{
Name = "Select",
DisplayName = "s",
Location = new Point(52, 58),
Type = PadSchema.PadInputType.Boolean
},
new PadSchema.ButtonSchema
{
Name = "Start",
DisplayName = "S",
Location = new Point(74, 58),
Type = PadSchema.PadInputType.Boolean
},
new PadSchema.ButtonSchema
{
Name = "R_Up",
DisplayName = "",
Icon = Properties.Resources.BlueUp,
Location = new Point(188, 36),
Type = PadSchema.PadInputType.Boolean
},
new PadSchema.ButtonSchema
{
Name = "R_Down",
DisplayName = "",
Icon = Properties.Resources.BlueDown,
Location = new Point(188, 80),
Type = PadSchema.PadInputType.Boolean
},
new PadSchema.ButtonSchema
{
Name = "R_Left",
DisplayName = "",
Icon = Properties.Resources.Back,
Location = new Point(176, 58),
Type = PadSchema.PadInputType.Boolean
},
new PadSchema.ButtonSchema
{
Name = "R_Right",
DisplayName = "",
Icon = Properties.Resources.Forward,
Location = new Point(198, 58),
Type = PadSchema.PadInputType.Boolean
},
new PadSchema.ButtonSchema
{
Name = "L",
DisplayName = "L",
Location = new Point(24, 8),
Type = PadSchema.PadInputType.Boolean
},
new PadSchema.ButtonSchema
{
Name = "R",
DisplayName = "R",
Location = new Point(176, 8),
Type = PadSchema.PadInputType.Boolean
},
}
};
}
private static PadSchema ConsoleButtons()
{
return new PadSchema
{
DisplayName = "Console",
IsConsole = true,
DefaultSize = new Size(75, 50),
Buttons = new[]
{
new PadSchema.ButtonSchema
{
Name = "Power",
DisplayName = "Power",
Location = new Point(10, 15),
Type = PadSchema.PadInputType.Boolean
}
}
};
}
}
}

View File

@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.0"/>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.6.1"/>
</startup>
</configuration>

View File

@ -1,28 +1,27 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x64'">
<DebugSymbols>true</DebugSymbols>
<OutputPath>..\output64\</OutputPath>
<OutputPath>..\output\</OutputPath>
<DefineConstants>TRACE;DEBUG;WINDOWS</DefineConstants>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<DebugType>full</DebugType>
<PlatformTarget>x64</PlatformTarget>
<CodeAnalysisLogFile>..\output\MultiHawk.exe.CodeAnalysisLog.xml</CodeAnalysisLogFile>
<CodeAnalysisUseTypeNameInSuppression>true</CodeAnalysisUseTypeNameInSuppression>
<CodeAnalysisModuleSuppressionsFile>GlobalSuppressions.cs</CodeAnalysisModuleSuppressionsFile>
<ErrorReport>prompt</ErrorReport>
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
<CodeAnalysisRuleSetDirectories>;C:\Program Files (x86)\Microsoft Visual Studio 10.0\Team Tools\Static Analysis Tools\\Rule Sets</CodeAnalysisRuleSetDirectories>
<CodeAnalysisRuleDirectories>;C:\Program Files (x86)\Microsoft Visual Studio 10.0\Team Tools\Static Analysis Tools\FxCop\\Rules</CodeAnalysisRuleDirectories>
<Prefer32Bit>false</Prefer32Bit>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|x64'">
<OutputPath>..\output64\</OutputPath>
<OutputPath>..\output\</OutputPath>
<DefineConstants>TRACE;WINDOWS</DefineConstants>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<Optimize>true</Optimize>
<DebugType>pdbonly</DebugType>
<PlatformTarget>x64</PlatformTarget>
<CodeAnalysisLogFile>..\output\MultiHawk.exe.CodeAnalysisLog.xml</CodeAnalysisLogFile>
<CodeAnalysisUseTypeNameInSuppression>true</CodeAnalysisUseTypeNameInSuppression>
<CodeAnalysisModuleSuppressionsFile>GlobalSuppressions.cs</CodeAnalysisModuleSuppressionsFile>
<ErrorReport>prompt</ErrorReport>
@ -31,6 +30,7 @@
<CodeAnalysisIgnoreBuiltInRuleSets>true</CodeAnalysisIgnoreBuiltInRuleSets>
<CodeAnalysisRuleDirectories>;C:\Program Files (x86)\Microsoft Visual Studio 10.0\Team Tools\Static Analysis Tools\FxCop\\Rules</CodeAnalysisRuleDirectories>
<CodeAnalysisIgnoreBuiltInRules>true</CodeAnalysisIgnoreBuiltInRules>
<Prefer32Bit>false</Prefer32Bit>
</PropertyGroup>
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<PropertyGroup>
@ -41,31 +41,10 @@
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>BizHawk.Client.MultiHawk</RootNamespace>
<AssemblyName>MultiHawk</AssemblyName>
<TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
<TargetFrameworkVersion>v4.6.1</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<TargetFrameworkProfile />
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|x86' ">
<PlatformTarget>x86</PlatformTarget>
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>..\output\</OutputPath>
<DefineConstants>TRACE;DEBUG;WINDOWS</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|x86' ">
<PlatformTarget>x86</PlatformTarget>
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>..\output\</OutputPath>
<DefineConstants>TRACE;WINDOWS</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
</PropertyGroup>
<ItemGroup>
<Reference Include="Microsoft.VisualBasic" />
<Reference Include="Newtonsoft.Json, Version=4.5.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
@ -269,11 +248,11 @@
<None Include="images\restart.png" />
</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>
<!-- 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,7 +1,7 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Runtime Version:4.0.30319.34209
// Runtime Version:4.0.30319.42000
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
@ -12,7 +12,7 @@ namespace BizHawk.Client.MultiHawk.Properties {
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "12.0.0.0")]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "14.0.0.0")]
internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase {
private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings())));

View File

@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">x86</Platform>
@ -10,38 +10,17 @@
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>BizHawk.Common</RootNamespace>
<AssemblyName>BizHawk.Common</AssemblyName>
<TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
<TargetFrameworkVersion>v4.6.1</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|x86' ">
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>..\output\dll\</OutputPath>
<DefineConstants>TRACE;DEBUG;WINDOWS</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<PlatformTarget>x86</PlatformTarget>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|x86' ">
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>..\output\dll\</OutputPath>
<DefineConstants>TRACE;WINDOWS</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<PlatformTarget>x86</PlatformTarget>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<TargetFrameworkProfile />
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x64'">
<DebugSymbols>true</DebugSymbols>
<OutputPath>..\output64\dll\</OutputPath>
<OutputPath>..\output\dll\</OutputPath>
<DefineConstants>TRACE;DEBUG;WINDOWS</DefineConstants>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<DebugType>full</DebugType>
<PlatformTarget>x64</PlatformTarget>
<CodeAnalysisLogFile>..\output\dll\BizHawk.Common.dll.CodeAnalysisLog.xml</CodeAnalysisLogFile>
<CodeAnalysisUseTypeNameInSuppression>true</CodeAnalysisUseTypeNameInSuppression>
<CodeAnalysisModuleSuppressionsFile>GlobalSuppressions.cs</CodeAnalysisModuleSuppressionsFile>
<ErrorReport>prompt</ErrorReport>
@ -51,15 +30,15 @@
<CodeAnalysisRuleDirectories>;C:\Program Files (x86)\Microsoft Visual Studio 10.0\Team Tools\Static Analysis Tools\FxCop\\Rules</CodeAnalysisRuleDirectories>
<CodeAnalysisIgnoreBuiltInRules>true</CodeAnalysisIgnoreBuiltInRules>
<CodeAnalysisFailOnMissingRules>false</CodeAnalysisFailOnMissingRules>
<Prefer32Bit>false</Prefer32Bit>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|x64'">
<OutputPath>..\output64\dll\</OutputPath>
<OutputPath>..\output\dll\</OutputPath>
<DefineConstants>TRACE;WINDOWS</DefineConstants>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<Optimize>true</Optimize>
<DebugType>pdbonly</DebugType>
<PlatformTarget>x64</PlatformTarget>
<CodeAnalysisLogFile>..\output\dll\BizHawk.Common.dll.CodeAnalysisLog.xml</CodeAnalysisLogFile>
<CodeAnalysisUseTypeNameInSuppression>true</CodeAnalysisUseTypeNameInSuppression>
<CodeAnalysisModuleSuppressionsFile>GlobalSuppressions.cs</CodeAnalysisModuleSuppressionsFile>
<ErrorReport>prompt</ErrorReport>
@ -69,9 +48,11 @@
<CodeAnalysisRuleDirectories>;C:\Program Files (x86)\Microsoft Visual Studio 10.0\Team Tools\Static Analysis Tools\FxCop\\Rules</CodeAnalysisRuleDirectories>
<CodeAnalysisIgnoreBuiltInRules>true</CodeAnalysisIgnoreBuiltInRules>
<CodeAnalysisFailOnMissingRules>false</CodeAnalysisFailOnMissingRules>
<Prefer32Bit>false</Prefer32Bit>
</PropertyGroup>
<ItemGroup>
<Reference Include="System" />
<Reference Include="System.ComponentModel.DataAnnotations" />
<Reference Include="System.Core" />
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" />
@ -90,12 +71,18 @@
<Compile Include="BinaryQuickSerializer.cs" />
<Compile Include="Bit.cs" />
<Compile Include="BitReverse.cs" />
<Compile Include="BizInvoke\BizExvoker.cs" />
<Compile Include="BizInvoke\BizInvoker.cs" />
<Compile Include="BizInvoke\BizInvokeUtilities.cs" />
<Compile Include="BizInvoke\CallingConventionAdapter.cs" />
<Compile Include="BizInvoke\DynamicLibraryImportResolver.cs" />
<Compile Include="BizInvoke\MemoryBlock.cs" />
<Compile Include="BizInvoke\WaterboxUtils.cs" />
<Compile Include="Buffer.cs" />
<Compile Include="Colors.cs" />
<Compile Include="CustomCollections.cs" />
<Compile Include="DeepEquality.cs" />
<Compile Include="DescribableEnumConverter.cs" />
<Compile Include="Extensions\BufferExtensions.cs" />
<Compile Include="Extensions\CollectionExtensions.cs" />
<Compile Include="Extensions\IOExtensions.cs" />

View File

@ -0,0 +1,150 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Reflection;
using System.Reflection.Emit;
using System.Runtime.InteropServices;
using System.Text;
namespace BizHawk.Common.BizInvoke
{
public static class BizExvoker
{
/// <summary>
/// the assembly that all delegate types are placed in
/// </summary>
private static readonly AssemblyBuilder ImplAssemblyBuilder;
/// <summary>
/// the module that all delegate types are placed in
/// </summary>
private static readonly ModuleBuilder ImplModuleBuilder;
static BizExvoker()
{
var aname = new AssemblyName("BizExvokeProxyAssembly");
ImplAssemblyBuilder = AppDomain.CurrentDomain.DefineDynamicAssembly(aname, AssemblyBuilderAccess.Run);
ImplModuleBuilder = ImplAssemblyBuilder.DefineDynamicModule("BizExvokerModule");
}
/// <summary>
/// holds the delegate types for a type
/// </summary>
private class DelegateStorage
{
/// <summary>
/// the type that this storage was made for
/// </summary>
public Type OriginalType { get; }
/// <summary>
/// the type that the delegate types reside in
/// </summary>
public Type StorageType { get; }
public List<StoredDelegateInfo> DelegateTypes { get; } = new List<StoredDelegateInfo>();
public class StoredDelegateInfo
{
public MethodInfo Method { get; }
public Type DelegateType { get; }
public string EntryPointName { get; }
public StoredDelegateInfo(MethodInfo method, Type delegateType, string entryPointName)
{
Method = method;
DelegateType = delegateType;
EntryPointName = entryPointName;
}
}
public DelegateStorage(Type type)
{
var methods = type.GetMethods(BindingFlags.Instance | BindingFlags.Public)
.Select(m => new
{
Info = m,
Attr = m.GetCustomAttributes(true).OfType<BizExportAttribute>().FirstOrDefault()
})
.Where(a => a.Attr != null)
.ToList();
var typeBuilder = ImplModuleBuilder.DefineType(
"Bizhawk.BizExvokeHolder" + type.Name, TypeAttributes.Class | TypeAttributes.Public | TypeAttributes.Sealed);
foreach (var a in methods)
{
MethodBuilder unused;
var delegateType = BizInvokeUtilities.CreateDelegateType(a.Info, a.Attr.CallingConvention, typeBuilder, out unused).CreateType();
DelegateTypes.Add(new StoredDelegateInfo(a.Info, delegateType, a.Attr.EntryPoint ?? a.Info.Name));
}
StorageType = typeBuilder.CreateType();
OriginalType = type;
}
}
private class ExvokerImpl : IImportResolver
{
private readonly Dictionary<string, IntPtr> EntryPoints = new Dictionary<string, IntPtr>();
private readonly List<Delegate> Delegates = new List<Delegate>();
public ExvokerImpl(object o, DelegateStorage d, ICallingConventionAdapter a)
{
foreach (var sdt in d.DelegateTypes)
{
var del = Delegate.CreateDelegate(sdt.DelegateType, o, sdt.Method);
Delegates.Add(del); // prevent garbage collection of the delegate, which would invalidate the pointer
EntryPoints.Add(sdt.EntryPointName, a.GetFunctionPointerForDelegate(del));
}
}
public IntPtr Resolve(string entryPoint)
{
IntPtr ret;
EntryPoints.TryGetValue(entryPoint, out ret);
return ret;
}
}
static readonly Dictionary<Type, DelegateStorage> Impls = new Dictionary<Type, DelegateStorage>();
public static IImportResolver GetExvoker(object o, ICallingConventionAdapter a)
{
DelegateStorage ds;
lock (Impls)
{
var type = o.GetType();
if (!Impls.TryGetValue(type, out ds))
{
ds = new DelegateStorage(type);
Impls.Add(type, ds);
}
}
return new ExvokerImpl(o, ds, a);
}
}
/// <summary>
/// mark an instance method to be exported by BizExvoker
/// </summary>
[AttributeUsage(AttributeTargets.Method)]
public class BizExportAttribute : Attribute
{
public CallingConvention CallingConvention { get; }
/// <summary>
/// Gets or sets the name of entry point; if not given, the method's name is used
/// </summary>
public string EntryPoint { get; set; }
/// <summary>
/// Initializes a new instance of the <see cref="BizImportAttribute"/> class.
/// </summary>
/// <param name="c">unmanaged calling convention</param>
public BizExportAttribute(CallingConvention c)
{
CallingConvention = c;
}
}
}

View File

@ -0,0 +1,91 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Reflection;
using System.Reflection.Emit;
using System.Runtime.InteropServices;
using System.Text;
namespace BizHawk.Common.BizInvoke
{
public static class BizInvokeUtilities
{
/// <summary>
/// create a delegate type to match a method type
/// </summary>
/// <param name="method">the method to "clone"</param>
/// <param name="nativeCall">native calling convention to use</param>
/// <param name="enclosingType">the type to define this delegate type as a nested type on</param>
/// <param name="invokeMethod">the methodBuilder for the magic Invoke method on the resulting type</param>
/// <returns>the resulting typeBuilder</returns>
public static TypeBuilder CreateDelegateType(MethodInfo method, CallingConvention nativeCall, TypeBuilder enclosingType,
out MethodBuilder invokeMethod)
{
var paramInfos = method.GetParameters();
var paramTypes = paramInfos.Select(p => p.ParameterType).ToArray();
var returnType = method.ReturnType;
// create the delegate type
var delegateType = enclosingType.DefineNestedType(
"DelegateType" + method.Name,
TypeAttributes.Class | TypeAttributes.NestedPrivate | TypeAttributes.Sealed,
typeof(MulticastDelegate));
var delegateCtor = delegateType.DefineConstructor(
MethodAttributes.RTSpecialName | MethodAttributes.HideBySig | MethodAttributes.Public,
CallingConventions.Standard,
new[] { typeof(object), typeof(IntPtr) });
delegateCtor.SetImplementationFlags(MethodImplAttributes.Runtime | MethodImplAttributes.Managed);
var delegateInvoke = delegateType.DefineMethod(
"Invoke",
MethodAttributes.Public | MethodAttributes.HideBySig | MethodAttributes.NewSlot | MethodAttributes.Virtual,
returnType,
paramTypes);
// we have to project all of the attributes from the baseMethod to the delegateInvoke
// so for something like [Out], the interop engine will see it and use it
for (int i = 0; i < paramInfos.Length; i++)
{
var p = delegateInvoke.DefineParameter(i + 1, ParameterAttributes.None, paramInfos[i].Name);
foreach (var a in paramInfos[i].GetCustomAttributes(false))
{
p.SetCustomAttribute(GetAttributeBuilder(a));
}
}
{
var p = delegateInvoke.DefineParameter(0, ParameterAttributes.Retval, method.ReturnParameter.Name);
foreach (var a in method.ReturnParameter.GetCustomAttributes(false))
{
p.SetCustomAttribute(GetAttributeBuilder(a));
}
}
delegateInvoke.SetImplementationFlags(MethodImplAttributes.Runtime | MethodImplAttributes.Managed);
// add the [UnmanagedFunctionPointer] to the delegate so interop will know how to call it
var attr = new CustomAttributeBuilder(typeof(UnmanagedFunctionPointerAttribute).GetConstructor(new[] { typeof(CallingConvention) }), new object[] { nativeCall });
delegateType.SetCustomAttribute(attr);
invokeMethod = delegateInvoke;
return delegateType;
}
/// <summary>
/// get an attribute builder to clone an attribute to a delegate type
/// </summary>
private static CustomAttributeBuilder GetAttributeBuilder(object o)
{
// anything more clever we can do here?
var t = o.GetType();
if (t == typeof(OutAttribute) || t == typeof(InAttribute))
{
return new CustomAttributeBuilder(t.GetConstructor(Type.EmptyTypes), new object[0]);
}
throw new InvalidOperationException("Unknown parameter attribute " + t.Name);
}
}
}

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,248 @@
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Runtime.InteropServices;
using System.Text;
using System.Threading.Tasks;
namespace BizHawk.Common.BizInvoke
{
/// <summary>
/// create interop delegates and function pointers for a particular calling convention
/// </summary>
public interface ICallingConventionAdapter
{
IntPtr GetFunctionPointerForDelegate(Delegate d);
IntPtr GetArrivalFunctionPointer(IntPtr p, ParameterInfo pp, object lifetime);
Delegate GetDelegateForFunctionPointer(IntPtr p, Type delegateType);
IntPtr GetDepartureFunctionPointer(IntPtr p, ParameterInfo pp, object lifetime);
}
public static class CallingConventionAdapterExtensions
{
public static T GetDelegateForFunctionPointer<T>(this ICallingConventionAdapter a, IntPtr p)
where T: class
{
return (T)(object)a.GetDelegateForFunctionPointer(p, typeof(T));
}
}
public class ParameterInfo
{
public Type ReturnType { get; }
public IReadOnlyList<Type> ParameterTypes { get; }
public ParameterInfo(Type returnType, IEnumerable<Type> parameterTypes)
{
ReturnType = returnType;
ParameterTypes = parameterTypes.ToList().AsReadOnly();
}
public ParameterInfo(Type delegateType)
{
if (!typeof(Delegate).IsAssignableFrom(delegateType))
throw new InvalidOperationException("Must be a delegate type!");
var invoke = delegateType.GetMethod("Invoke");
ReturnType = invoke.ReturnType;
ParameterTypes = invoke.GetParameters().Select(p => p.ParameterType).ToList().AsReadOnly();
}
}
public static class CallingConventionAdapters
{
private class NativeConvention : ICallingConventionAdapter
{
public IntPtr GetArrivalFunctionPointer(IntPtr p, ParameterInfo pp, object lifetime)
{
return p;
}
public Delegate GetDelegateForFunctionPointer(IntPtr p, Type delegateType)
{
return Marshal.GetDelegateForFunctionPointer(p, delegateType);
}
public IntPtr GetDepartureFunctionPointer(IntPtr p, ParameterInfo pp, object lifetime)
{
return p;
}
public IntPtr GetFunctionPointerForDelegate(Delegate d)
{
return Marshal.GetFunctionPointerForDelegate(d);
}
}
/// <summary>
/// native (pass-through) calling convention
/// </summary>
public static ICallingConventionAdapter Native { get; } = new NativeConvention();
/// <summary>
/// convention appropriate for waterbox guests
/// </summary>
public static ICallingConventionAdapter Waterbox { get; } =
#if true
new NativeConvention();
#else
new SysVHostMsGuest();
#endif
private class SysVHostMsGuest : ICallingConventionAdapter
{
private const ulong Placeholder = 0xdeadbeeffeedface;
private const byte Padding = 0x06;
private const int BlockSize = 256;
private static readonly byte[][] Depart =
{
new byte[] { 0x55, 0x48, 0x89, 0xe5, 0x48, 0x83, 0xec, 0x20, 0x48, 0xb8, 0xce, 0xfa, 0xed, 0xfe, 0xef, 0xbe, 0xad, 0xde, 0xff, 0xd0, 0xc9, 0xc3, },
new byte[] { 0x55, 0x48, 0x89, 0xe5, 0x48, 0x83, 0xec, 0x30, 0x48, 0x89, 0x7d, 0xf8, 0x48, 0x8b, 0x55, 0xf8, 0x48, 0xb8, 0xce, 0xfa, 0xed, 0xfe, 0xef, 0xbe, 0xad, 0xde, 0x48, 0x89, 0xd1, 0xff, 0xd0, 0xc9, 0xc3, },
new byte[] { 0x55, 0x48, 0x89, 0xe5, 0x48, 0x83, 0xec, 0x30, 0x48, 0x89, 0x7d, 0xf8, 0x48, 0x89, 0x75, 0xf0, 0x48, 0x8b, 0x55, 0xf0, 0x48, 0x8b, 0x4d, 0xf8, 0x48, 0xb8, 0xce, 0xfa, 0xed, 0xfe, 0xef, 0xbe, 0xad, 0xde, 0xff, 0xd0, 0xc9, 0xc3, },
new byte[] { 0x55, 0x48, 0x89, 0xe5, 0x48, 0x83, 0xec, 0x40, 0x48, 0x89, 0x7d, 0xf8, 0x48, 0x89, 0x75, 0xf0, 0x48, 0x89, 0x55, 0xe8, 0x48, 0x8b, 0x75, 0xe8, 0x48, 0x8b, 0x55, 0xf0, 0x48, 0x8b, 0x4d, 0xf8, 0x48, 0xb8, 0xce, 0xfa, 0xed, 0xfe, 0xef, 0xbe, 0xad, 0xde, 0x49, 0x89, 0xf0, 0xff, 0xd0, 0xc9, 0xc3, },
new byte[] { 0x55, 0x48, 0x89, 0xe5, 0x48, 0x83, 0xec, 0x40, 0x48, 0x89, 0x7d, 0xf8, 0x48, 0x89, 0x75, 0xf0, 0x48, 0x89, 0x55, 0xe8, 0x48, 0x89, 0x4d, 0xe0, 0x48, 0x8b, 0x7d, 0xe0, 0x48, 0x8b, 0x75, 0xe8, 0x48, 0x8b, 0x55, 0xf0, 0x48, 0x8b, 0x4d, 0xf8, 0x48, 0xb8, 0xce, 0xfa, 0xed, 0xfe, 0xef, 0xbe, 0xad, 0xde, 0x49, 0x89, 0xf9, 0x49, 0x89, 0xf0, 0xff, 0xd0, 0xc9, 0xc3, },
new byte[] { 0x55, 0x48, 0x89, 0xe5, 0x48, 0x83, 0xec, 0x60, 0x48, 0x89, 0x7d, 0xf8, 0x48, 0x89, 0x75, 0xf0, 0x48, 0x89, 0x55, 0xe8, 0x48, 0x89, 0x4d, 0xe0, 0x4c, 0x89, 0x45, 0xd8, 0x48, 0x8b, 0x7d, 0xe0, 0x48, 0x8b, 0x75, 0xe8, 0x48, 0x8b, 0x55, 0xf0, 0x48, 0x8b, 0x4d, 0xf8, 0x48, 0x8b, 0x45, 0xd8, 0x48, 0x89, 0x44, 0x24, 0x20, 0x48, 0xb8, 0xce, 0xfa, 0xed, 0xfe, 0xef, 0xbe, 0xad, 0xde, 0x49, 0x89, 0xf9, 0x49, 0x89, 0xf0, 0xff, 0xd0, 0xc9, 0xc3, },
new byte[] { 0x55, 0x48, 0x89, 0xe5, 0x48, 0x83, 0xec, 0x60, 0x48, 0x89, 0x7d, 0xf8, 0x48, 0x89, 0x75, 0xf0, 0x48, 0x89, 0x55, 0xe8, 0x48, 0x89, 0x4d, 0xe0, 0x4c, 0x89, 0x45, 0xd8, 0x4c, 0x89, 0x4d, 0xd0, 0x48, 0x8b, 0x7d, 0xe0, 0x48, 0x8b, 0x75, 0xe8, 0x48, 0x8b, 0x55, 0xf0, 0x48, 0x8b, 0x4d, 0xf8, 0x48, 0x8b, 0x45, 0xd0, 0x48, 0x89, 0x44, 0x24, 0x28, 0x48, 0x8b, 0x45, 0xd8, 0x48, 0x89, 0x44, 0x24, 0x20, 0x48, 0xb8, 0xce, 0xfa, 0xed, 0xfe, 0xef, 0xbe, 0xad, 0xde, 0x49, 0x89, 0xf9, 0x49, 0x89, 0xf0, 0xff, 0xd0, 0xc9, 0xc3, },
};
private static readonly byte[][] Arrive =
{
new byte[] { 0x55, 0x48, 0x89, 0xe5, 0x48, 0x83, 0xec, 0x20, 0x48, 0xb8, 0xce, 0xfa, 0xed, 0xfe, 0xef, 0xbe, 0xad, 0xde, 0xff, 0xd0, 0xc9, 0xc3, },
new byte[] { 0x55, 0x48, 0x89, 0xe5, 0x48, 0x83, 0xec, 0x30, 0x48, 0x89, 0x7d, 0xf8, 0x48, 0x8b, 0x55, 0xf8, 0x48, 0xb8, 0xce, 0xfa, 0xed, 0xfe, 0xef, 0xbe, 0xad, 0xde, 0x48, 0x89, 0xd1, 0xff, 0xd0, 0xc9, 0xc3, },
new byte[] { 0x55, 0x48, 0x89, 0xe5, 0x48, 0x83, 0xec, 0x30, 0x48, 0x89, 0x7d, 0xf8, 0x48, 0x89, 0x75, 0xf0, 0x48, 0x8b, 0x55, 0xf0, 0x48, 0x8b, 0x4d, 0xf8, 0x48, 0xb8, 0xce, 0xfa, 0xed, 0xfe, 0xef, 0xbe, 0xad, 0xde, 0xff, 0xd0, 0xc9, 0xc3, },
new byte[] { 0x55, 0x48, 0x89, 0xe5, 0x48, 0x83, 0xec, 0x40, 0x48, 0x89, 0x7d, 0xf8, 0x48, 0x89, 0x75, 0xf0, 0x48, 0x89, 0x55, 0xe8, 0x48, 0x8b, 0x75, 0xe8, 0x48, 0x8b, 0x55, 0xf0, 0x48, 0x8b, 0x4d, 0xf8, 0x48, 0xb8, 0xce, 0xfa, 0xed, 0xfe, 0xef, 0xbe, 0xad, 0xde, 0x49, 0x89, 0xf0, 0xff, 0xd0, 0xc9, 0xc3, },
new byte[] { 0x55, 0x48, 0x89, 0xe5, 0x48, 0x83, 0xec, 0x40, 0x48, 0x89, 0x7d, 0xf8, 0x48, 0x89, 0x75, 0xf0, 0x48, 0x89, 0x55, 0xe8, 0x48, 0x89, 0x4d, 0xe0, 0x48, 0x8b, 0x7d, 0xe0, 0x48, 0x8b, 0x75, 0xe8, 0x48, 0x8b, 0x55, 0xf0, 0x48, 0x8b, 0x4d, 0xf8, 0x48, 0xb8, 0xce, 0xfa, 0xed, 0xfe, 0xef, 0xbe, 0xad, 0xde, 0x49, 0x89, 0xf9, 0x49, 0x89, 0xf0, 0xff, 0xd0, 0xc9, 0xc3, },
new byte[] { 0x55, 0x48, 0x89, 0xe5, 0x48, 0x83, 0xec, 0x60, 0x48, 0x89, 0x7d, 0xf8, 0x48, 0x89, 0x75, 0xf0, 0x48, 0x89, 0x55, 0xe8, 0x48, 0x89, 0x4d, 0xe0, 0x4c, 0x89, 0x45, 0xd8, 0x48, 0x8b, 0x7d, 0xe0, 0x48, 0x8b, 0x75, 0xe8, 0x48, 0x8b, 0x55, 0xf0, 0x48, 0x8b, 0x4d, 0xf8, 0x48, 0x8b, 0x45, 0xd8, 0x48, 0x89, 0x44, 0x24, 0x20, 0x48, 0xb8, 0xce, 0xfa, 0xed, 0xfe, 0xef, 0xbe, 0xad, 0xde, 0x49, 0x89, 0xf9, 0x49, 0x89, 0xf0, 0xff, 0xd0, 0xc9, 0xc3, },
new byte[] { 0x55, 0x48, 0x89, 0xe5, 0x48, 0x83, 0xec, 0x60, 0x48, 0x89, 0x7d, 0xf8, 0x48, 0x89, 0x75, 0xf0, 0x48, 0x89, 0x55, 0xe8, 0x48, 0x89, 0x4d, 0xe0, 0x4c, 0x89, 0x45, 0xd8, 0x4c, 0x89, 0x4d, 0xd0, 0x48, 0x8b, 0x7d, 0xe0, 0x48, 0x8b, 0x75, 0xe8, 0x48, 0x8b, 0x55, 0xf0, 0x48, 0x8b, 0x4d, 0xf8, 0x48, 0x8b, 0x45, 0xd0, 0x48, 0x89, 0x44, 0x24, 0x28, 0x48, 0x8b, 0x45, 0xd8, 0x48, 0x89, 0x44, 0x24, 0x20, 0x48, 0xb8, 0xce, 0xfa, 0xed, 0xfe, 0xef, 0xbe, 0xad, 0xde, 0x49, 0x89, 0xf9, 0x49, 0x89, 0xf0, 0xff, 0xd0, 0xc9, 0xc3, },
};
private static readonly int[] DepartPlaceholderIndices;
private static readonly int[] ArrivePlaceholderIndices;
private static int FindPlaceholderIndex(byte[] data)
{
return Enumerable.Range(0, data.Length - 7)
.Single(i => BitConverter.ToUInt64(data, i) == Placeholder);
}
static SysVHostMsGuest()
{
DepartPlaceholderIndices = Depart.Select(FindPlaceholderIndex).ToArray();
ArrivePlaceholderIndices = Arrive.Select(FindPlaceholderIndex).ToArray();
if (Depart.Any(b => b.Length > BlockSize) || Arrive.Any(b => b.Length > BlockSize))
throw new InvalidOperationException();
}
private readonly MemoryBlock _memory;
private readonly object _sync = new object();
private readonly WeakReference[] _refs;
public SysVHostMsGuest()
{
int size = 4 * 1024 * 1024;
_memory = new MemoryBlock((ulong)size);
_memory.Activate();
_refs = new WeakReference[size / BlockSize];
}
private int FindFreeIndex()
{
for (int i = 0; i < _refs.Length; i++)
{
if (_refs[i] == null || !_refs[i].IsAlive)
return i;
}
throw new InvalidOperationException("Out of Thunk memory");
}
private static void VerifyParameter(Type type)
{
if (type == typeof(float) || type == typeof(double))
throw new NotSupportedException("floating point not supported");
if (type == typeof(void) || type.IsPrimitive)
return;
if (type.IsByRef || type.IsClass)
return;
throw new NotSupportedException("Unknown type. Possibly supported?");
}
private static int VerifyDelegateSignature(ParameterInfo pp)
{
VerifyParameter(pp.ReturnType);
foreach (var ppp in pp.ParameterTypes)
VerifyParameter(ppp);
return pp.ParameterTypes.Count;
}
private void WriteThunk(byte[] data, int placeholderIndex, IntPtr p, int index)
{
_memory.Protect(_memory.Start, _memory.Size, MemoryBlock.Protection.RW);
var ss = _memory.GetStream(_memory.Start + (ulong)index * BlockSize, BlockSize, true);
ss.Write(data, 0, data.Length);
for (int i = data.Length; i < BlockSize; i++)
ss.WriteByte(Padding);
ss.Position = placeholderIndex;
var bw = new BinaryWriter(ss);
bw.Write((long)p);
_memory.Protect(_memory.Start, _memory.Size, MemoryBlock.Protection.RX);
}
private IntPtr GetThunkAddress(int index)
{
return Z.US(_memory.Start + (ulong)index * BlockSize);
}
private void SetLifetime(int index, object lifetime)
{
if (_refs[index] == null)
_refs[index] = new WeakReference(lifetime);
else
_refs[index].Target = lifetime;
}
public IntPtr GetFunctionPointerForDelegate(Delegate d)
{
return GetArrivalFunctionPointer(
Marshal.GetFunctionPointerForDelegate(d), new ParameterInfo(d.GetType()), d);
}
public IntPtr GetArrivalFunctionPointer(IntPtr p, ParameterInfo pp, object lifetime)
{
lock (_sync)
{
var index = FindFreeIndex();
var count = VerifyDelegateSignature(pp);
WriteThunk(Arrive[count], ArrivePlaceholderIndices[count], p, index);
SetLifetime(index, lifetime);
return GetThunkAddress(index);
}
}
public Delegate GetDelegateForFunctionPointer(IntPtr p, Type delegateType)
{
lock (_sync)
{
var index = FindFreeIndex();
var count = VerifyDelegateSignature(new ParameterInfo(delegateType));
WriteThunk(Depart[count], DepartPlaceholderIndices[count], p, index);
var ret = Marshal.GetDelegateForFunctionPointer(GetThunkAddress(index), delegateType);
SetLifetime(index, ret);
return ret;
}
}
public IntPtr GetDepartureFunctionPointer(IntPtr p, ParameterInfo pp, object lifetime)
{
lock (_sync)
{
var index = FindFreeIndex();
var count = VerifyDelegateSignature(pp);
WriteThunk(Depart[count], DepartPlaceholderIndices[count], p, index);
SetLifetime(index, lifetime);
return GetThunkAddress(index);
}
}
}
}
}

View File

@ -5,122 +5,45 @@ using System.Text;
using System.Runtime.InteropServices;
using System.IO;
namespace BizHawk.Emulation.Cores
namespace BizHawk.Common.BizInvoke
{
public static class Z
{
public static IntPtr US(ulong l)
{
if (IntPtr.Size == 8)
return (IntPtr)(long)l;
else
return (IntPtr)(int)l;
}
public static UIntPtr UU(ulong l)
{
if (UIntPtr.Size == 8)
return (UIntPtr)l;
else
return (UIntPtr)(uint)l;
}
public static IntPtr SS(long l)
{
if (IntPtr.Size == 8)
return (IntPtr)l;
else
return (IntPtr)(int)l;
}
public static UIntPtr SU(long l)
{
if (UIntPtr.Size == 8)
return (UIntPtr)(ulong)l;
else
return (UIntPtr)(uint)l;
}
}
public sealed class MemoryBlock : IDisposable
{
/// <summary>
/// system page size
/// </summary>
public static int PageSize { get; private set;}
/// <summary>
/// bitshift corresponding to PageSize
/// </summary>
private static readonly int PageShift;
/// <summary>
/// bitmask corresponding to PageSize
/// </summary>
private static readonly ulong PageMask;
static MemoryBlock()
{
int p = PageSize = Environment.SystemPageSize;
while (p != 1)
{
p >>= 1;
PageShift++;
}
PageMask = (ulong)(PageSize - 1);
}
/// <summary>
/// true if addr is aligned
/// </summary>
private static bool Aligned(ulong addr)
{
return (addr & PageMask) == 0;
}
/// <summary>
/// align address down to previous page boundary
/// </summary>
private static ulong AlignDown(ulong addr)
{
return addr & ~PageMask;
}
/// <summary>
/// align address up to next page boundary
/// </summary>
private static ulong AlignUp(ulong addr)
{
return ((addr - 1) | PageMask) + 1;
}
{
/// <summary>
/// starting address of the memory block
/// </summary>
public ulong Start { get; private set; }
public ulong Start { get; private set; }
/// <summary>
/// total size of the memory block
/// </summary>
public ulong Size { get; private set; }
public ulong Size { get; private set; }
/// <summary>
/// ending address of the memory block; equal to start + size
/// </summary>
public ulong End { get; private set; }
public ulong End { get; private set; }
/// <summary>
/// handle returned by CreateFileMapping
/// </summary>
private IntPtr _handle;
private IntPtr _handle;
/// <summary>
/// true if this is currently swapped in
/// </summary>
public bool Active { get; private set; }
public bool Active { get; private set; }
/// <summary>
/// stores last set memory protection value for each page
/// </summary>
private readonly Protection[] _pageData;
private readonly Protection[] _pageData;
/// <summary>
/// snapshot for XOR buffer
/// </summary>
private byte[] _snapshot;
public byte[] XorHash { get; private set; }
/// <summary>
/// get a page index within the block
/// </summary>
@ -129,17 +52,17 @@ namespace BizHawk.Emulation.Cores
if (addr < Start || addr >= End)
throw new ArgumentOutOfRangeException();
return (int)((addr - Start) >> PageShift);
}
return (int)((addr - Start) >> WaterboxUtils.PageShift);
}
/// <summary>
/// get a start address for a page index within the block
/// </summary>
private ulong GetStartAddr(int page)
{
return ((ulong)page << PageShift) + Start;
}
return ((ulong)page << WaterboxUtils.PageShift) + Start;
}
/// <summary>
/// allocate size bytes at any address
/// </summary>
@ -147,8 +70,8 @@ namespace BizHawk.Emulation.Cores
public MemoryBlock(ulong size)
: this(0, size)
{
}
}
/// <summary>
/// allocate size bytes starting at a particular address
/// </summary>
@ -156,11 +79,11 @@ namespace BizHawk.Emulation.Cores
/// <param name="size"></param>
public MemoryBlock(ulong start, ulong size)
{
if (!Aligned(start))
if (!WaterboxUtils.Aligned(start))
throw new ArgumentOutOfRangeException();
if (size == 0)
throw new ArgumentOutOfRangeException();
size = AlignUp(size);
size = WaterboxUtils.AlignUp(size);
_handle = Kernel32.CreateFileMapping(Kernel32.INVALID_HANDLE_VALUE, IntPtr.Zero,
Kernel32.FileMapProtection.PageExecuteReadWrite | Kernel32.FileMapProtection.SectionCommit, (uint)(size >> 32), (uint)size, null);
@ -171,8 +94,8 @@ namespace BizHawk.Emulation.Cores
End = start + size;
Size = size;
_pageData = new Protection[GetPage(End - 1) + 1];
}
}
/// <summary>
/// activate the memory block, swapping it in at the specified address
/// </summary>
@ -187,8 +110,8 @@ namespace BizHawk.Emulation.Cores
}
ProtectAll();
Active = true;
}
}
/// <summary>
/// deactivate the memory block, removing it from RAM but leaving it immediately available to swap back in
/// </summary>
@ -199,16 +122,16 @@ namespace BizHawk.Emulation.Cores
if (!Kernel32.UnmapViewOfFile(Z.US(Start)))
throw new InvalidOperationException("UnmapViewOfFile() returned NULL");
Active = false;
}
}
/// <summary>
/// Memory protection constant
/// </summary>
public enum Protection : byte
{
None, R, RW, RX
}
}
/// <summary>
/// Get a stream that can be used to read or write from part of the block. Does not check for or change Protect()!
/// </summary>
@ -216,11 +139,68 @@ namespace BizHawk.Emulation.Cores
{
if (start < Start)
throw new ArgumentOutOfRangeException(nameof(start));
if (start + length > End)
throw new ArgumentOutOfRangeException(nameof(length));
return new MemoryViewStream(!writer, writer, (long)start, (long)length, this);
}
/// <summary>
/// get a stream that can be used to read or write from part of the block.
/// both reads and writes will be XORed against an earlier recorded snapshot
/// </summary>
public Stream GetXorStream(ulong start, ulong length, bool writer)
{
if (start < Start)
throw new ArgumentOutOfRangeException(nameof(start));
if (start + length > End)
throw new ArgumentOutOfRangeException(nameof(length));
if (_snapshot == null)
throw new InvalidOperationException("No snapshot taken!");
return new MemoryViewXorStream(!writer, writer, (long)start, (long)length, this, _snapshot, (long)(start - Start));
}
/// <summary>
/// take a snapshot of the entire memory block's contents, for use in GetXorStream
/// </summary>
public void SaveXorSnapshot()
{
if (_snapshot != null)
throw new InvalidOperationException("Snapshot already taken");
if (!Active)
throw new InvalidOperationException("Not active");
// temporarily switch the entire block to `R`: in case some areas are unreadable, we don't want
// that to complicate things
Kernel32.MemoryProtection old;
if (!Kernel32.VirtualProtect(Z.UU(Start), Z.UU(Size), Kernel32.MemoryProtection.READONLY, out old))
throw new InvalidOperationException("VirtualProtect() returned FALSE!");
_snapshot = new byte[Size];
var ds = new MemoryStream(_snapshot, true);
var ss = GetStream(Start, Size, false);
ss.CopyTo(ds);
XorHash = WaterboxUtils.Hash(_snapshot);
ProtectAll();
}
/// <summary>
/// take a hash of the current full contents of the block, including unreadable areas
/// </summary>
/// <returns></returns>
public byte[] FullHash()
{
if (!Active)
throw new InvalidOperationException("Not active");
// temporarily switch the entire block to `R`
Kernel32.MemoryProtection old;
if (!Kernel32.VirtualProtect(Z.UU(Start), Z.UU(Size), Kernel32.MemoryProtection.READONLY, out old))
throw new InvalidOperationException("VirtualProtect() returned FALSE!");
var ret = WaterboxUtils.Hash(GetStream(Start, Size, false));
ProtectAll();
return ret;
}
private static Kernel32.MemoryProtection GetKernelMemoryProtectionValue(Protection prot)
@ -235,8 +215,8 @@ namespace BizHawk.Emulation.Cores
default: throw new ArgumentOutOfRangeException(nameof(prot));
}
return p;
}
}
/// <summary>
/// restore all recorded protections
/// </summary>
@ -256,8 +236,8 @@ namespace BizHawk.Emulation.Cores
ps = i + 1;
}
}
}
}
/// <summary>
/// set r/w/x protection on a portion of memory. rounded to encompassing pages
/// </summary>
@ -270,14 +250,17 @@ namespace BizHawk.Emulation.Cores
var p = GetKernelMemoryProtectionValue(prot);
for (int i = pstart; i <= pend; i++)
_pageData[i] = prot; // also store the value for later use
if (Active) // it's legal to Protect() if we're not active; the information is just saved for the next activation
_pageData[i] = prot; // also store the value for later use
if (Active) // it's legal to Protect() if we're not active; the information is just saved for the next activation
{
// TODO: if using another OS's memory protection calls, they must give the same non-aligned behavior
// as VirtualProtect, or this must be changed
var computedStart = WaterboxUtils.AlignDown(start);
var computedEnd = WaterboxUtils.AlignUp(start + length);
var computedLength = computedEnd - computedStart;
Kernel32.MemoryProtection old;
if (!Kernel32.VirtualProtect(Z.UU(start), Z.UU(length), p, out old))
if (!Kernel32.VirtualProtect(Z.UU(computedStart),
Z.UU(computedLength), p, out old))
throw new InvalidOperationException("VirtualProtect() returned FALSE!");
}
}
@ -324,38 +307,39 @@ namespace BizHawk.Emulation.Cores
private MemoryBlock _owner;
private bool _readable;
private bool _writable;
private readonly bool _readable;
private readonly bool _writable;
private long _length;
private long _pos;
private long _ptr;
private readonly long _ptr;
public override bool CanRead { get { return _readable; } }
public override bool CanSeek { get { return true; } }
public override bool CanWrite { get { return _writable; } }
public override bool CanRead => _readable;
public override bool CanSeek => true;
public override bool CanWrite => _writable;
public override void Flush() { }
public override long Length { get { return _length; } }
public override long Length => _length;
public override long Position
{
get { return _pos; } set
{
get { return _pos; }
set
{
if (value < 0 || value > _length)
throw new ArgumentOutOfRangeException();
_pos = value;
}
}
}
public override int Read(byte[] buffer, int offset, int count)
{
if (!_readable)
throw new InvalidOperationException();
if (count < 0 || count > buffer.Length)
if (count < 0 || count + offset > buffer.Length)
throw new ArgumentOutOfRangeException();
EnsureNotDisposed();
count = (int)Math.Min(count, _length - _pos);
Marshal.Copy(Z.SS(_ptr + _pos), buffer, 0, count);
Marshal.Copy(Z.SS(_ptr + _pos), buffer, offset, count);
_pos += count;
return count;
}
@ -367,7 +351,7 @@ namespace BizHawk.Emulation.Cores
{
default:
case SeekOrigin.Begin:
newpos = 0;
newpos = offset;
break;
case SeekOrigin.Current:
newpos = _pos + offset;
@ -389,15 +373,73 @@ namespace BizHawk.Emulation.Cores
{
if (!_writable)
throw new InvalidOperationException();
if (count < 0 || count > buffer.Length)
if (count < 0 || count + offset > buffer.Length)
throw new ArgumentOutOfRangeException();
if (count > _length - _pos)
throw new ArgumentOutOfRangeException();
EnsureNotDisposed();
count = (int)Math.Min(count, _length - _pos);
Marshal.Copy(buffer, 0, Z.SS(_ptr + _pos), count);
Marshal.Copy(buffer, offset, Z.SS(_ptr + _pos), count);
_pos += count;
}
}
private class MemoryViewXorStream : MemoryViewStream
{
public MemoryViewXorStream(bool readable, bool writable, long ptr, long length, MemoryBlock owner,
byte[] initial, long offset)
: base(readable, writable, ptr, length, owner)
{
_initial = initial;
_offset = (int)offset;
}
/// <summary>
/// the initial data to XOR against for both reading and writing
/// </summary>
private readonly byte[] _initial;
/// <summary>
/// offset into the XOR data that this stream is representing
/// </summary>
private readonly int _offset;
public override int Read(byte[] buffer, int offset, int count)
{
int pos = (int)Position;
count = base.Read(buffer, offset, count);
XorTransform(_initial, _offset + pos, buffer, offset, count);
return count;
}
public override void Write(byte[] buffer, int offset, int count)
{
int pos = (int)Position;
if (count < 0 || count + offset > buffer.Length)
throw new ArgumentOutOfRangeException();
if (count > Length - pos)
throw new ArgumentOutOfRangeException();
// is mutating the buffer passed to Stream.Write kosher?
XorTransform(_initial, _offset + pos, buffer, offset, count);
base.Write(buffer, offset, count);
}
private static unsafe void XorTransform(byte[] source, int sourceOffset, byte[] dest, int destOffset, int length)
{
// we don't do any bounds check because MemoryViewStream.Read and MemoryViewXorStream.Write already did it
// TODO: C compilers can make this pretty snappy, but can the C# jitter? Or do we need intrinsics
fixed (byte* _s = source, _d = dest)
{
byte* s = _s + sourceOffset;
byte* d = _d + destOffset;
byte* sEnd = s + length;
while (s < sEnd)
{
*d++ ^= *s++;
}
}
}
}
private static class Kernel32
{
[DllImport("kernel32.dll", SetLastError = true)]

View File

@ -0,0 +1,156 @@
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Security.Cryptography;
using System.Text;
namespace BizHawk.Common.BizInvoke
{
public static class WaterboxUtils
{
/// <summary>
/// copy `len` bytes from `src` to `dest`
/// </summary>
/// <param name="src"></param>
/// <param name="dst"></param>
/// <param name="len"></param>
public static void CopySome(Stream src, Stream dst, long len)
{
var buff = new byte[4096];
while (len > 0)
{
int r = src.Read(buff, 0, (int)Math.Min(len, 4096));
dst.Write(buff, 0, r);
len -= r;
}
}
public static byte[] Hash(byte[] data)
{
using (var h = SHA1.Create())
{
return h.ComputeHash(data);
}
}
public static byte[] Hash(Stream s)
{
using (var h = SHA1.Create())
{
return h.ComputeHash(s);
}
}
public static unsafe void ZeroMemory(IntPtr mem, long length)
{
byte* p = (byte*)mem;
byte* end = p + length;
while (p < end)
{
*p++ = 0;
}
}
public static long Timestamp()
{
return DateTime.UtcNow.Ticks;
}
/// <summary>
/// system page size
/// </summary>
public static int PageSize { get; private set; }
/// <summary>
/// bitshift corresponding to PageSize
/// </summary>
public static int PageShift { get; private set; }
/// <summary>
/// bitmask corresponding to PageSize
/// </summary>
public static ulong PageMask { get; private set; }
static WaterboxUtils()
{
int p = PageSize = Environment.SystemPageSize;
while (p != 1)
{
p >>= 1;
PageShift++;
}
PageMask = (ulong)(PageSize - 1);
}
/// <summary>
/// true if addr is aligned
/// </summary>
public static bool Aligned(ulong addr)
{
return (addr & PageMask) == 0;
}
/// <summary>
/// align address down to previous page boundary
/// </summary>
public static ulong AlignDown(ulong addr)
{
return addr & ~PageMask;
}
/// <summary>
/// align address up to next page boundary
/// </summary>
public static ulong AlignUp(ulong addr)
{
return ((addr - 1) | PageMask) + 1;
}
/// <summary>
/// return the minimum number of pages needed to hold size
/// </summary>
public static int PagesNeeded(ulong size)
{
return (int)((size + PageMask) >> PageShift);
}
}
// C# is annoying: arithmetic operators for native ints are not exposed.
// So we store them as long/ulong instead in many places, and use these helpers
// to convert to IntPtr when needed
public static class Z
{
public static IntPtr US(ulong l)
{
if (IntPtr.Size == 8)
return (IntPtr)(long)l;
else
return (IntPtr)(int)l;
}
public static UIntPtr UU(ulong l)
{
if (UIntPtr.Size == 8)
return (UIntPtr)l;
else
return (UIntPtr)(uint)l;
}
public static IntPtr SS(long l)
{
if (IntPtr.Size == 8)
return (IntPtr)l;
else
return (IntPtr)(int)l;
}
public static UIntPtr SU(long l)
{
if (UIntPtr.Size == 8)
return (UIntPtr)(ulong)l;
else
return (UIntPtr)(uint)l;
}
}
}

View File

@ -0,0 +1,75 @@
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.ComponentModel.DataAnnotations;
using System.Globalization;
using System.Linq;
using System.Reflection;
using System.Text;
using System.Threading.Tasks;
namespace BizHawk.Common
{
public class DescribableEnumConverter : EnumConverter
{
private Type enumType;
public DescribableEnumConverter(Type type) : base(type)
{
enumType = type;
}
public override bool CanConvertTo(ITypeDescriptorContext context, Type destType)
{
return destType == typeof(string);
}
public override object ConvertTo(ITypeDescriptorContext context, CultureInfo culture,
object value, Type destType)
{
var fi = enumType.GetField(Enum.GetName(enumType, value));
var attr = (DisplayAttribute)fi.GetCustomAttribute(typeof(DisplayAttribute));
if (attr != null)
return attr.Name;
else
return value.ToString();
}
public override bool CanConvertFrom(ITypeDescriptorContext context, Type srcType)
{
return srcType == typeof(string);
}
public override object ConvertFrom(ITypeDescriptorContext context, CultureInfo culture,
object value)
{
foreach (var fi in enumType.GetFields(BindingFlags.Public | BindingFlags.Static))
{
var attr = (DisplayAttribute)fi.GetCustomAttribute(typeof(DisplayAttribute));
if (attr != null && attr.Name.Equals(value))
return Enum.Parse(enumType, fi.Name);
}
return Enum.Parse(enumType, (string)value);
}
public override bool GetStandardValuesSupported(ITypeDescriptorContext context)
{
return true;
}
public override bool GetStandardValuesExclusive(ITypeDescriptorContext context)
{
return true;
}
public override StandardValuesCollection GetStandardValues(ITypeDescriptorContext context)
{
var ret = new List<object>();
foreach (var fi in enumType.GetFields(BindingFlags.Public | BindingFlags.Static))
{
ret.Add(fi.GetValue(null));
}
return new StandardValuesCollection(ret);
}
}
}

View File

@ -8,6 +8,7 @@ namespace BizHawk.Common.BufferExtensions
{
public static class BufferExtensions
{
[Obsolete] // do we know of any situation where SaveAsHexFast doesn't work?
public static void SaveAsHex(this byte[] buffer, TextWriter writer)
{
foreach (var b in buffer)
@ -39,6 +40,7 @@ namespace BizHawk.Common.BufferExtensions
writer.WriteLine();
}
[Obsolete] // do we know of any situation where SaveAsHexFast doesn't work?
public static void SaveAsHex(this byte[] buffer, TextWriter writer, int length)
{
for (int i = 0; i < length; i++)

View File

@ -1,4 +1,5 @@
using System;
using System.Collections.Generic;
namespace BizHawk.Common
{
@ -12,6 +13,12 @@ namespace BizHawk.Common
public static class ImportResolverExtensions
{
/// <summary>
/// Resolve an entry point and throw an exception if that resolution is NULL
/// </summary>
/// <param name="dll"></param>
/// <param name="entryPoint"></param>
/// <returns></returns>
public static IntPtr SafeResolve(this IImportResolver dll, string entryPoint)
{
var ret = dll.Resolve(entryPoint);
@ -23,4 +30,32 @@ namespace BizHawk.Common
return ret;
}
}
/// <summary>
/// compose multiple ImportResolvers, where subsequent ones takes precedence over earlier ones
/// </summary>
public class PatchImportResolver : IImportResolver
{
private readonly List<IImportResolver> _resolvers = new List<IImportResolver>();
public PatchImportResolver(params IImportResolver[] rr)
{
Add(rr);
}
public void Add(params IImportResolver[] rr)
{
_resolvers.AddRange(rr);
}
public IntPtr Resolve(string entryPoint)
{
for (int i = _resolvers.Count - 1; i >= 0; i--)
{
var ret = _resolvers[i].Resolve(entryPoint);
if (ret != IntPtr.Zero)
return ret;
}
return IntPtr.Zero;
}
}
}

View File

@ -1,8 +1,40 @@
namespace BizHawk.Common
using System;
namespace BizHawk.Common
{
public interface IMonitor
{
void Enter();
void Exit();
}
public static class MonitorExtensions
{
public static IDisposable EnterExit(this IMonitor m)
{
var ret = new EnterExitWrapper(m);
m.Enter();
return ret;
}
private class EnterExitWrapper : IDisposable
{
private readonly IMonitor _m;
private bool _disposed = false;
public EnterExitWrapper(IMonitor m)
{
_m = m;
}
public void Dispose()
{
if (!_disposed)
{
_m.Exit();
_disposed = true;
}
}
}
}
}

View File

@ -458,6 +458,14 @@ namespace BizHawk.Common
{
DeleteFileW(path + ":Zone.Identifier");
}
[DllImport("kernel32.dll")]
static extern bool IsDebuggerPresent();
public static bool IsDebuggerReallyPresent()
{
return IsDebuggerPresent();
}
}
}

View File

@ -165,7 +165,8 @@ namespace BizHawk.Emulation.Common
List<string> list = new List<string>(FloatControls);
list.AddRange(BoolButtons);
List<string>[] ret = new List<string>[9];
// starts with console buttons, then each plasyer's buttons individually
List<string>[] ret = new List<string>[PlayerCount + 1];
for (int i = 0; i < ret.Length; i++)
{
ret[i] = new List<string>();
@ -182,16 +183,18 @@ namespace BizHawk.Emulation.Common
public int PlayerNumber(string buttonName)
{
int player = 0;
if (buttonName.Length > 3 && buttonName.StartsWith("P") && char.IsNumber(buttonName[1]))
var match = PlayerRegex.Match(buttonName);
if (match.Success)
{
player = buttonName[1] - '0';
return int.Parse(match.Groups[1].Value);
}
else
{
return 0;
}
return player;
}
private static readonly Regex PlayerRegex = new Regex("^P(\\d) ");
private static readonly Regex PlayerRegex = new Regex("^P(\\d+) ");
public int PlayerCount
{
@ -199,9 +202,7 @@ namespace BizHawk.Emulation.Common
{
var allNames = FloatControls.Concat(BoolButtons).ToList();
var player = allNames
.Select(s => PlayerRegex.Match(s).Groups[1])
.Where(group => group.Success)
.Select(group => group.Value[0] - '0')
.Select(PlayerNumber)
.DefaultIfEmpty(0)
.Max();

View File

@ -1,4 +1,5 @@
using System;
using BizHawk.Common;
using System;
namespace BizHawk.Emulation.Common
{
@ -9,7 +10,8 @@ namespace BizHawk.Emulation.Common
public Func<long, byte> Peek
{
get { return _peek; } set { _peek = value; }
get { return _peek; }
set { _peek = value; }
}
public Action<long, byte> Poke
@ -134,6 +136,60 @@ namespace BizHawk.Emulation.Common
}
}
public unsafe class MemoryDomainIntPtrMonitor : MemoryDomain
{
public IntPtr Data { get; set; }
private readonly IMonitor _monitor;
public override byte PeekByte(long addr)
{
if ((ulong)addr < (ulong)Size)
{
using (_monitor.EnterExit())
{
return ((byte*)Data)[addr];
}
}
throw new ArgumentOutOfRangeException(nameof(addr));
}
public override void PokeByte(long addr, byte val)
{
if (Writable)
{
if ((ulong)addr < (ulong)Size)
{
using (_monitor.EnterExit())
{
((byte*)Data)[addr] = val;
}
}
else
{
throw new ArgumentOutOfRangeException(nameof(addr));
}
}
}
public void SetSize(long size)
{
Size = size;
}
public MemoryDomainIntPtrMonitor(string name, Endian endian, IntPtr data, long size, bool writable, int wordSize,
IMonitor monitor)
{
Name = name;
EndianType = endian;
Data = data;
Size = size;
Writable = writable;
WordSize = wordSize;
_monitor = monitor;
}
}
public unsafe class MemoryDomainIntPtrSwap16 : MemoryDomain
{
public IntPtr Data { get; set; }
@ -173,4 +229,53 @@ namespace BizHawk.Emulation.Common
WordSize = 2;
}
}
public unsafe class MemoryDomainIntPtrSwap16Monitor : MemoryDomain
{
public IntPtr Data { get; set; }
private readonly IMonitor _monitor;
public override byte PeekByte(long addr)
{
if ((ulong)addr < (ulong)Size)
{
using (_monitor.EnterExit())
{
return ((byte*)Data)[addr ^ 1];
}
}
throw new ArgumentOutOfRangeException(nameof(addr));
}
public override void PokeByte(long addr, byte val)
{
if (Writable)
{
if ((ulong)addr < (ulong)Size)
{
using (_monitor.EnterExit())
{
((byte*)Data)[addr ^ 1] = val;
}
}
else
{
throw new ArgumentOutOfRangeException(nameof(addr));
}
}
}
public MemoryDomainIntPtrSwap16Monitor(string name, Endian endian, IntPtr data, long size, bool writable,
IMonitor monitor)
{
Name = name;
EndianType = endian;
Data = data;
Size = size;
Writable = writable;
WordSize = 2;
_monitor = monitor;
}
}
}

View File

@ -1,8 +1,8 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x64'">
<DebugSymbols>true</DebugSymbols>
<OutputPath>..\output64\dll\</OutputPath>
<OutputPath>..\output\dll\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<DebugType>full</DebugType>
@ -17,9 +17,10 @@
<CodeAnalysisRuleDirectories>;C:\Program Files (x86)\Microsoft Visual Studio 10.0\Team Tools\Static Analysis Tools\FxCop\\Rules</CodeAnalysisRuleDirectories>
<CodeAnalysisIgnoreBuiltInRules>false</CodeAnalysisIgnoreBuiltInRules>
<CodeAnalysisFailOnMissingRules>false</CodeAnalysisFailOnMissingRules>
<Prefer32Bit>false</Prefer32Bit>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|x64'">
<OutputPath>..\output64\dll\</OutputPath>
<OutputPath>..\output\dll\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<Optimize>true</Optimize>
@ -35,6 +36,7 @@
<CodeAnalysisRuleDirectories>;C:\Program Files (x86)\Microsoft Visual Studio 10.0\Team Tools\Static Analysis Tools\FxCop\\Rules</CodeAnalysisRuleDirectories>
<CodeAnalysisIgnoreBuiltInRules>false</CodeAnalysisIgnoreBuiltInRules>
<CodeAnalysisFailOnMissingRules>false</CodeAnalysisFailOnMissingRules>
<Prefer32Bit>false</Prefer32Bit>
</PropertyGroup>
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<PropertyGroup>
@ -45,31 +47,10 @@
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>BizHawk.Emulation.Common</RootNamespace>
<AssemblyName>BizHawk.Emulation.Common</AssemblyName>
<TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
<TargetFrameworkVersion>v4.6.1</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<TargetFrameworkProfile />
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|x86' ">
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>..\output\dll\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<PlatformTarget>x86</PlatformTarget>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|x86' ">
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>..\output\dll\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<PlatformTarget>x86</PlatformTarget>
</PropertyGroup>
<ItemGroup>
<Reference Include="Newtonsoft.Json, Version=6.0.0.0, Culture=neutral, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>

View File

@ -331,6 +331,19 @@ namespace BizHawk.Emulation.Common
case ".DO":
game.System = "AppleII";
break;
case ".VB":
game.System = "VB";
break;
case ".NGP":
case ".NGC":
game.System = "NGP";
break;
case ".O2":
game.System = "O2";
break;
}
game.Name = Path.GetFileNameWithoutExtension(fileName)?.Replace('_', ' ');

View File

@ -30,6 +30,8 @@ namespace BizHawk.Emulation.Common
FirmwareAndOption("A3AF676991391A6DD716C79022D4947206B78164", 4096, "A78", "Bios_HSC", "7800highscore.bin", "Highscore Bios");
FirmwareAndOption("45BEDC4CBDEAC66C7DF59E9E599195C778D86A92", 8192, "Coleco", "Bios", "ColecoBios.bin", "Bios");
FirmwareAndOption("079a7ce93f3fd7d35e444b2fab16b1867c95e2c1", 66084, "SGB", "SPC", "sgb.spc", "Super Gameboy SPC");
var gbaNormal = File("300C20DF6731A33952DED8C436F7F186D25D3492", 16384, "gbabios.rom", "Bios (World)");
var gbaJDebug = File("AA98A2AD32B86106340665D1222D7D973A1361C7", 16384, "gbabios.rom", "Bios (J Debug)");
Firmware("GBA", "Bios", "Bios");
@ -70,6 +72,8 @@ namespace BizHawk.Emulation.Common
Option("SAT", "E", ss_100a_ue);
Option("SAT", "E", ss_100_j);
Option("SAT", "E", ss_101_j);
FirmwareAndOption("a67cd4f550751f8b91de2b8b74528ab4e0c11c77", 2 * 1024 * 1024, "SAT", "KOF95", "kof95.bin", "King of Fighters cartridge");
Firmware("SAT", "ULTRAMAN", "Ultraman cartridge");
var ti83_102 = File("CE08F6A808701FC6672230A790167EE485157561", 262144, "ti83_102.rom", "TI-83 Rom v1.02"); // ?? is this size correct?
var ti83_103 = File("8399E384804D8D29866CAA4C8763D7A61946A467", 262144, "ti83_103.rom", "TI-83 Rom v1.03"); // ?? is this size correct?
@ -198,6 +202,12 @@ namespace BizHawk.Emulation.Common
Firmware("AppleII", "DiskII", "DiskII.rom");
var appleII_DiskII = File("D4181C9F046AAFC3FB326B381BAAC809D9E38D16", 256, "DiskII.rom", "Disk II");
Option("AppleII", "DiskII", appleII_DiskII);
FirmwareAndOption("b2e1955d957a475de2411770452eff4ea19f4cee", 1024, "O2", "BIOS", "Odyssey2.bin", "Odyssey 2 Bios");
FirmwareAndOption("a6120aed50831c9c0d95dbdf707820f601d9452e", 1024, "O2", "BIOS-C52", "PhillipsC52.bin", "Phillips C52 Bios");
FirmwareAndOption("4ED31EC6B0B175BB109C0EB5FD3D193DA823339F", 256, "GB", "World", "GB_boot_ROM.gb", "Game Boy BIOS");
FirmwareAndOption("1293D68BF9643BC4F36954C1E80E38F39864528D", 2304, "GBC", "World", "GBC_boot_ROM.gb", "Game Boy Color BIOS");
}
// adds a defined firmware ID to the database
@ -329,4 +339,4 @@ namespace BizHawk.Emulation.Common
return found.FirstOrDefault();
}
} // static class FirmwareDatabase
}
}

View File

@ -2,13 +2,22 @@
namespace BizHawk.Emulation.Common
{
/// <summary>
/// Binary save and load state only without any trappings. At the moment, an emulator core should not implement this directly
/// </summary>
public interface IBinaryStateable
{
void SaveStateBinary(BinaryWriter writer);
void LoadStateBinary(BinaryReader reader);
}
/// <summary>
/// This service manages the logic of sending and receiving savestates from the core
/// If this service is available, client apps will expose features for making savestates and that utilize savestates (such as rewind))
/// If unavailable these options will not be exposed
/// Additionally many tools depend on savestates such as TAStudio, these will only be available if this service is implemented
/// </summary>
public interface IStatable : IEmulatorService
public interface IStatable : IBinaryStateable, IEmulatorService
{
/// <summary>
/// Gets a value indicating whether the core would rather give a binary savestate than a text one. Both must function regardless
@ -18,9 +27,6 @@ namespace BizHawk.Emulation.Common
void SaveStateText(TextWriter writer);
void LoadStateText(TextReader reader);
void SaveStateBinary(BinaryWriter writer);
void LoadStateBinary(BinaryReader reader);
/// <summary>
/// save state binary to a byte buffer
/// </summary>

View File

@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">x86</Platform>
@ -10,7 +10,7 @@
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>BizHawk.Emulation.Cores</RootNamespace>
<AssemblyName>BizHawk.Emulation.Cores</AssemblyName>
<TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
<TargetFrameworkVersion>v4.6.1</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<FileUpgradeFlags>
</FileUpgradeFlags>
@ -33,39 +33,13 @@
<BootstrapperEnabled>true</BootstrapperEnabled>
<TargetFrameworkProfile />
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|x86' ">
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>..\output\dll\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<PlatformTarget>x86</PlatformTarget>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<UseVSHostingProcess>false</UseVSHostingProcess>
<CodeAnalysisRuleSet>AllRules.ruleset</CodeAnalysisRuleSet>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|x86' ">
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>..\output\dll\</OutputPath>
<DefineConstants>TRACE;VS2010</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<PlatformTarget>x86</PlatformTarget>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<CodeAnalysisRuleSet>AllRules.ruleset</CodeAnalysisRuleSet>
<UseVSHostingProcess>false</UseVSHostingProcess>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x64'">
<DebugSymbols>true</DebugSymbols>
<OutputPath>..\output64\dll\</OutputPath>
<OutputPath>..\output\dll\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<DebugType>full</DebugType>
<PlatformTarget>x64</PlatformTarget>
<CodeAnalysisLogFile>..\output\dll\BizHawk.Emulation.Cores.dll.CodeAnalysisLog.xml</CodeAnalysisLogFile>
<CodeAnalysisUseTypeNameInSuppression>true</CodeAnalysisUseTypeNameInSuppression>
<CodeAnalysisModuleSuppressionsFile>GlobalSuppressions.cs</CodeAnalysisModuleSuppressionsFile>
<UseVSHostingProcess>false</UseVSHostingProcess>
@ -76,9 +50,10 @@
<CodeAnalysisRuleDirectories>;C:\Program Files (x86)\Microsoft Visual Studio 10.0\Team Tools\Static Analysis Tools\FxCop\\Rules</CodeAnalysisRuleDirectories>
<CodeAnalysisIgnoreBuiltInRules>false</CodeAnalysisIgnoreBuiltInRules>
<CodeAnalysisFailOnMissingRules>false</CodeAnalysisFailOnMissingRules>
<Prefer32Bit>false</Prefer32Bit>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|x64'">
<OutputPath>..\output64\dll\</OutputPath>
<OutputPath>..\output\dll\</OutputPath>
<DefineConstants>TRACE;VS2010</DefineConstants>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<Optimize>true</Optimize>
@ -95,6 +70,7 @@
<CodeAnalysisRuleDirectories>;C:\Program Files (x86)\Microsoft Visual Studio 10.0\Team Tools\Static Analysis Tools\FxCop\\Rules</CodeAnalysisRuleDirectories>
<CodeAnalysisIgnoreBuiltInRules>false</CodeAnalysisIgnoreBuiltInRules>
<CodeAnalysisFailOnMissingRules>false</CodeAnalysisFailOnMissingRules>
<Prefer32Bit>false</Prefer32Bit>
</PropertyGroup>
<ItemGroup>
<Reference Include="ELFSharp">
@ -110,7 +86,11 @@
<SpecificVersion>False</SpecificVersion>
<HintPath>..\References\OpenTK.dll</HintPath>
</Reference>
<Reference Include="PeNet">
<HintPath>..\References\PeNet.dll</HintPath>
</Reference>
<Reference Include="System" />
<Reference Include="System.ComponentModel.DataAnnotations" />
<Reference Include="System.Core">
<RequiredTargetFramework>3.5</RequiredTargetFramework>
</Reference>
@ -382,7 +362,7 @@
<Compile Include="Consoles\Atari\A7800Hawk\A7800Hawk.ISaveRam.cs">
<DependentUpon>A7800Hawk.cs</DependentUpon>
</Compile>
<Compile Include="Consoles\Atari\A7800Hawk\A7800Hawk.ISettable.cs">
<Compile Include="Consoles\Atari\A7800Hawk\A7800Hawk.ISettable.cs">
<DependentUpon>A7800Hawk.cs</DependentUpon>
</Compile>
<Compile Include="Consoles\Atari\A7800Hawk\A7800HawkControllerDeck.cs" />
@ -495,6 +475,8 @@
</Compile>
<Compile Include="Consoles\Intellivision\PSG.cs" />
<Compile Include="Consoles\Intellivision\STIC.cs" />
<Compile Include="Consoles\Magnavox\LibO2Em.cs" />
<Compile Include="Consoles\Magnavox\O2Em.cs" />
<Compile Include="Consoles\Nintendo\Gameboy\Gambatte.cs" />
<Compile Include="Consoles\Nintendo\Gameboy\Gambatte.ICodeDataLog.cs">
<DependentUpon>Gambatte.cs</DependentUpon>
@ -559,7 +541,10 @@
</Compile>
<Compile Include="Consoles\Nintendo\Gameboy\GBColors.cs" />
<Compile Include="Consoles\Nintendo\Gameboy\GBDisassembler.cs" />
<Compile Include="Consoles\Nintendo\Gameboy\IGameboyCommon.cs" />
<Compile Include="Consoles\Nintendo\Gameboy\LibGambatte.cs" />
<Compile Include="Consoles\Nintendo\Gameboy\LibPizza.cs" />
<Compile Include="Consoles\Nintendo\Gameboy\Pizza.cs" />
<Compile Include="Consoles\Nintendo\GBA\ArmV4Disassembler.cs" />
<Compile Include="Consoles\Nintendo\GBA\GBA.cs" />
<Compile Include="Consoles\Nintendo\GBA\IGBAGPUViewable.cs" />
@ -646,7 +631,6 @@
<Compile Include="Consoles\Nintendo\N64\N64SyncSettings.Controller.cs" />
<Compile Include="Consoles\Nintendo\N64\N64SyncSettings.Glide.cs" />
<Compile Include="Consoles\Nintendo\N64\N64SyncSettings.GlideMk2.cs" />
<Compile Include="Consoles\Nintendo\N64\N64SyncSettings.Jabo.cs" />
<Compile Include="Consoles\Nintendo\N64\N64SyncSettings.Rice.cs" />
<Compile Include="Consoles\Nintendo\N64\NativeApi\mupen64plusAudioApi.cs" />
<Compile Include="Consoles\Nintendo\N64\NativeApi\mupen64plusCoreApi.cs" />
@ -1022,6 +1006,8 @@
<Compile Include="Consoles\Nintendo\SNES\ScanlineHookManager.cs" />
<Compile Include="Consoles\Nintendo\SNES\SnesColors.cs" />
<Compile Include="Consoles\Nintendo\SNES\SNESGraphicsDecoder.cs" />
<Compile Include="Consoles\Nintendo\VB\LibVirtualBoyee.cs" />
<Compile Include="Consoles\Nintendo\VB\VirtualBoyee.cs" />
<Compile Include="Consoles\PC Engine\ADPCM.cs" />
<Compile Include="Consoles\PC Engine\MemoryMap.TurboCD.cs" />
<Compile Include="Consoles\PC Engine\MemoryMap.Populous.cs" />
@ -1143,29 +1129,9 @@
<Compile Include="Consoles\Sega\gpgx64\GPGXControlConverter.cs" />
<Compile Include="Consoles\Sega\gpgx64\LibGPGX.cs" />
<Compile Include="Consoles\Sega\Saturn\FilePiping.cs" />
<Compile Include="Consoles\Sega\Saturn\LibYabause.cs" />
<Compile Include="Consoles\Sega\Saturn\Yabause.cs" />
<Compile Include="Consoles\Sega\Saturn\Yabause.IDriveLight.cs">
<DependentUpon>Yabause.cs</DependentUpon>
</Compile>
<Compile Include="Consoles\Sega\Saturn\Yabause.IInputPollable.cs">
<DependentUpon>Yabause.cs</DependentUpon>
</Compile>
<Compile Include="Consoles\Sega\Saturn\Yabause.IMemoryDomains.cs">
<DependentUpon>Yabause.cs</DependentUpon>
</Compile>
<Compile Include="Consoles\Sega\Saturn\Yabause.ISaveram.cs">
<DependentUpon>Yabause.cs</DependentUpon>
</Compile>
<Compile Include="Consoles\Sega\Saturn\Yabause.ISettable.cs">
<DependentUpon>Yabause.cs</DependentUpon>
</Compile>
<Compile Include="Consoles\Sega\Saturn\Yabause.IStatable.cs">
<DependentUpon>Yabause.cs</DependentUpon>
</Compile>
<Compile Include="Consoles\Sega\Saturn\Yabause.ITraceable.cs">
<DependentUpon>Yabause.cs</DependentUpon>
</Compile>
<Compile Include="Consoles\Sega\Saturn\LibSaturnus.cs" />
<Compile Include="Consoles\Sega\Saturn\Saturnus.cs" />
<Compile Include="Consoles\Sega\Saturn\SaturnusControllerDeck.cs" />
<Compile Include="Consoles\Sega\SMS\SMS.cs" />
<Compile Include="Consoles\Sega\SMS\SMS.ICodeDataLogger.cs">
<DependentUpon>SMS.cs</DependentUpon>
@ -1206,6 +1172,9 @@
<Compile Include="Consoles\Sega\SMS\VDP.ModeTMS.cs" />
<Compile Include="Consoles\Sega\SMS\VDP.Mode4.cs" />
<Compile Include="Consoles\Sega\SMS\VDP.Tables.cs" />
<Compile Include="Consoles\SNK\DualNeoGeoPort.cs" />
<Compile Include="Consoles\SNK\LibNeoGeoPort.cs" />
<Compile Include="Consoles\SNK\NeoGeoPort.cs" />
<Compile Include="Consoles\Sony\PSP\PPSSPPDll.cs" />
<Compile Include="Consoles\Sony\PSP\PSP.cs" />
<Compile Include="Consoles\Sony\PSX\Octoshock.cs">
@ -1284,7 +1253,10 @@
<Compile Include="CPUs\Z80\Registers.cs" />
<Compile Include="CPUs\Z80\Tables.cs" />
<Compile Include="CPUs\Z80\Z80A.cs" />
<Compile Include="ElfRunner.cs" />
<Compile Include="SideBySideVideo.cs" />
<Compile Include="Sound\DualSyncSound.cs" />
<Compile Include="Waterbox\CustomSaverammer.cs" />
<Compile Include="Waterbox\ElfRunner.cs" />
<Compile Include="FileID.cs" />
<Compile Include="Consoles\PC Engine\MemoryMap.cs" />
<Compile Include="Consoles\PC Engine\MemoryMap.SF2.cs" />
@ -1306,7 +1278,9 @@
<Compile Include="Libretro\LibretroCoreSettings.cs" />
<Compile Include="Libretro\LibretroCore_Description.cs" />
<Compile Include="Libretro\LibretroCore_InputCallbacks.cs" />
<Compile Include="MemoryBlock.cs" />
<Compile Include="Waterbox\Heap.cs" />
<Compile Include="Waterbox\LibWaterboxCore.cs" />
<Compile Include="Waterbox\MapHeap.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="Sound\CDAudio.cs" />
<Compile Include="Sound\HuC6280PSG.cs" />
@ -1318,6 +1292,11 @@
<Compile Include="Sound\VRC6Alt.cs" />
<Compile Include="Sound\YM2413.cs" />
<Compile Include="Sound\YM2612.cs" />
<Compile Include="Waterbox\PeRunner.cs" />
<Compile Include="Waterbox\PeWrapper.cs" />
<Compile Include="Waterbox\Swappable.cs" />
<Compile Include="Waterbox\WaterboxCore.cs" />
<Compile Include="Waterbox\WaterboxUtils.cs" />
</ItemGroup>
<ItemGroup>
<Content Include="Consoles\Coleco\docs\CV-Sound.txt" />

View File

@ -0,0 +1,16 @@
using BizHawk.Common.BizInvoke;
using BizHawk.Emulation.Cores.Waterbox;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace BizHawk.Emulation.Cores.Consoles.Magnavox
{
public abstract class LibO2Em : LibWaterboxCore
{
[BizImport(CC)]
public abstract bool Init(byte[] rom, int romlen, byte[] bios, int bioslen);
}
}

View File

@ -0,0 +1,52 @@
using BizHawk.Emulation.Common;
using BizHawk.Emulation.Cores.Waterbox;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace BizHawk.Emulation.Cores.Consoles.Magnavox
{
[CoreAttributes("o2em", "", true, false, "", "", false)]
public class O2Em : WaterboxCore
{
private LibO2Em _core;
[CoreConstructor("O2")]
public O2Em(CoreComm comm, byte[] rom)
:base(comm, new Configuration
{
DefaultFpsNumerator = 60,
DefaultFpsDenominator = 1,
DefaultWidth = 320,
DefaultHeight = 240,
MaxSamples = 2048,
MaxWidth = 320,
MaxHeight = 240,
SystemId = "O2"
})
{
var bios = comm.CoreFileProvider.GetFirmware("O2", "BIOS", true);
_core = PreInit<LibO2Em>(new PeRunnerOptions
{
Filename = "o2em.wbx",
SbrkHeapSizeKB = 4 * 1024,
SealedHeapSizeKB = 4 * 1024,
InvisibleHeapSizeKB = 4 * 1024,
PlainHeapSizeKB = 4 * 1024,
});
if (!_core.Init(rom, rom.Length, bios, bios.Length))
throw new InvalidOperationException("Init() failed");
PostInit();
}
protected override LibWaterboxCore.FrameInfo FrameAdvancePrep(IController controller, bool render, bool rendersound)
{
return new LibWaterboxCore.FrameInfo();
}
}
}

View File

@ -132,5 +132,12 @@ namespace BizHawk.Emulation.Cores.Nintendo.GBA
[DllImport(dll, CallingConvention = cc)]
public static extern void BizGetRegisters(IntPtr ctx, int[] dest);
[DllImport(dll, CallingConvention = cc)]
public static extern void BizWriteBus(IntPtr ctx, uint addr, byte val);
[DllImport(dll, CallingConvention = cc)]
public static extern byte BizReadBus(IntPtr ctx, uint addr);
}
}

View File

@ -34,6 +34,28 @@ namespace BizHawk.Emulation.Cores.Nintendo.GBA
mm.Add(_sram = new MemoryDomainIntPtr("SRAM", le, IntPtr.Zero, 0, true, 4)); // size will be fixed in wireup
mm.Add(_cwram = new MemoryDomainDelegate("Combined WRAM", (256 + 32) * 1024, le, null, null, 4));
mm.Add(new MemoryDomainDelegate("System Bus", 0x10000000, le,
delegate (long addr)
{
var a = (uint)addr;
if (a >= 0x10000000)
{
throw new ArgumentOutOfRangeException();
}
return LibmGBA.BizReadBus(_core, a);
},
delegate (long addr, byte val)
{
var a = (uint)addr;
if (a >= 0x10000000)
{
throw new ArgumentOutOfRangeException();
}
LibmGBA.BizWriteBus(_core, a, val);
}, 4));
_memoryDomains = new MemoryDomainList(mm);
WireMemoryDomainPointers();
}
@ -55,7 +77,7 @@ namespace BizHawk.Emulation.Cores.Nintendo.GBA
// special combined ram memory domain
_cwram.Peek =
delegate(long addr)
delegate (long addr)
{
if (addr < 0 || addr >= (256 + 32) * 1024)
{
@ -70,7 +92,7 @@ namespace BizHawk.Emulation.Cores.Nintendo.GBA
return PeekWRAM(s.wram, addr);
};
_cwram.Poke =
delegate(long addr, byte val)
delegate (long addr, byte val)
{
if (addr < 0 || addr >= (256 + 32) * 1024)
{

View File

@ -3,7 +3,7 @@ using BizHawk.Emulation.Common;
namespace BizHawk.Emulation.Cores.Nintendo.GBA
{
[CoreAttributes("mGBA", "endrift", true, true, "0.5.0", "https://mgba.io/", false)]
[CoreAttributes("mGBA", "endrift", true, true, "0.6.0 (24ab81f8db7745586cef246be8957ad272aded9b)", "https://mgba.io/", false)]
[ServiceNotApplicable(typeof(IDriveLight), typeof(IRegionable))]
public partial class MGBAHawk : IEmulator, IVideoProvider, ISoundProvider, IGBAGPUViewable,
ISaveRam, IStatable, IInputPollable, ISettable<MGBAHawk.Settings, MGBAHawk.SyncSettings>,

View File

@ -95,8 +95,11 @@ namespace BizHawk.Emulation.Cores.Nintendo.Gameboy
{
if (GambatteState != IntPtr.Zero)
{
Console.WriteLine("disposing");
LibGambatte.gambatte_destroy(GambatteState);
Console.WriteLine("step2");
GambatteState = IntPtr.Zero;
Console.WriteLine("disposed");
}
DisposeSound();

View File

@ -80,6 +80,11 @@ namespace BizHawk.Emulation.Cores.Nintendo.Gameboy
public class GambatteSyncSettings
{
[DisplayName("Enable BIOS: WARNING: File must exist!")]
[Description("Boots game using system BIOS. Should be used for TASing")]
[DefaultValue(false)]
public bool EnableBIOS { get; set; }
[DisplayName("Force DMG Mode")]
[Description("Force the game to run on DMG hardware, even if it's detected as a CGB game. Relevant for games that are \"CGB Enhanced\" but do not require CGB.")]
[DefaultValue(false)]

View File

@ -1,116 +1,116 @@
using System;
using BizHawk.Emulation.Common;
namespace BizHawk.Emulation.Cores.Nintendo.Gameboy
{
public partial class Gameboy : ISoundProvider
{
public bool CanProvideAsync => false;
public void DiscardSamples()
{
_soundoutbuffcontains = 0;
}
public void GetSamplesSync(out short[] samples, out int nsamp)
{
samples = _soundoutbuff;
nsamp = _soundoutbuffcontains;
}
public void SetSyncMode(SyncSoundMode mode)
{
if (mode == SyncSoundMode.Async)
{
throw new NotSupportedException("Async mode is not supported.");
}
}
public SyncSoundMode SyncMode => SyncSoundMode.Sync;
public void GetSamplesAsync(short[] samples)
{
throw new InvalidOperationException("Async mode is not supported.");
}
internal bool Muted => _settings.Muted;
// sample pairs before resampling
private readonly short[] _soundbuff = new short[(35112 + 2064) * 2];
private int _soundoutbuffcontains = 0;
private readonly short[] _soundoutbuff = new short[2048];
private int _latchL = 0;
private int _latchR = 0;
private BlipBuffer _blipL, _blipR;
private uint _blipAccumulate;
private void ProcessSound(int nsamp)
{
for (uint i = 0; i < nsamp; i++)
{
int curr = _soundbuff[i * 2];
if (curr != _latchL)
{
int diff = _latchL - curr;
_latchL = curr;
_blipL.AddDelta(_blipAccumulate, diff);
}
curr = _soundbuff[(i * 2) + 1];
if (curr != _latchR)
{
int diff = _latchR - curr;
_latchR = curr;
_blipR.AddDelta(_blipAccumulate, diff);
}
_blipAccumulate++;
}
}
private void ProcessSoundEnd()
{
_blipL.EndFrame(_blipAccumulate);
_blipR.EndFrame(_blipAccumulate);
_blipAccumulate = 0;
_soundoutbuffcontains = _blipL.SamplesAvailable();
if (_soundoutbuffcontains != _blipR.SamplesAvailable())
{
throw new InvalidOperationException("Audio processing error");
}
_blipL.ReadSamplesLeft(_soundoutbuff, _soundoutbuffcontains);
_blipR.ReadSamplesRight(_soundoutbuff, _soundoutbuffcontains);
}
private void InitSound()
{
_blipL = new BlipBuffer(1024);
_blipL.SetRates(TICKSPERSECOND, 44100);
_blipR = new BlipBuffer(1024);
_blipR.SetRates(TICKSPERSECOND, 44100);
}
private void DisposeSound()
{
if (_blipL != null)
{
_blipL.Dispose();
_blipL = null;
}
if (_blipR != null)
{
_blipR.Dispose();
_blipR = null;
}
}
}
}
using System;
using BizHawk.Emulation.Common;
namespace BizHawk.Emulation.Cores.Nintendo.Gameboy
{
public partial class Gameboy : ISoundProvider
{
public bool CanProvideAsync => false;
public void DiscardSamples()
{
_soundoutbuffcontains = 0;
}
public void GetSamplesSync(out short[] samples, out int nsamp)
{
samples = _soundoutbuff;
nsamp = _soundoutbuffcontains;
}
public void SetSyncMode(SyncSoundMode mode)
{
if (mode == SyncSoundMode.Async)
{
throw new NotSupportedException("Async mode is not supported.");
}
}
public SyncSoundMode SyncMode => SyncSoundMode.Sync;
public void GetSamplesAsync(short[] samples)
{
throw new InvalidOperationException("Async mode is not supported.");
}
internal bool Muted => _settings.Muted;
// sample pairs before resampling
private readonly short[] _soundbuff = new short[(35112 + 2064) * 2];
private int _soundoutbuffcontains = 0;
private readonly short[] _soundoutbuff = new short[2048];
private int _latchL = 0;
private int _latchR = 0;
private BlipBuffer _blipL, _blipR;
private uint _blipAccumulate;
private void ProcessSound(int nsamp)
{
for (uint i = 0; i < nsamp; i++)
{
int curr = _soundbuff[i * 2];
if (curr != _latchL)
{
int diff = _latchL - curr;
_latchL = curr;
_blipL.AddDelta(_blipAccumulate, diff >> 2);
}
curr = _soundbuff[(i * 2) + 1];
if (curr != _latchR)
{
int diff = _latchR - curr;
_latchR = curr;
_blipR.AddDelta(_blipAccumulate, diff >> 2);
}
_blipAccumulate++;
}
}
private void ProcessSoundEnd()
{
_blipL.EndFrame(_blipAccumulate);
_blipR.EndFrame(_blipAccumulate);
_blipAccumulate = 0;
_soundoutbuffcontains = _blipL.SamplesAvailable();
if (_soundoutbuffcontains != _blipR.SamplesAvailable())
{
throw new InvalidOperationException("Audio processing error");
}
_blipL.ReadSamplesLeft(_soundoutbuff, _soundoutbuffcontains);
_blipR.ReadSamplesRight(_soundoutbuff, _soundoutbuffcontains);
}
private void InitSound()
{
_blipL = new BlipBuffer(1024);
_blipL.SetRates(TICKSPERSECOND, 44100);
_blipR = new BlipBuffer(1024);
_blipR.SetRates(TICKSPERSECOND, 44100);
}
private void DisposeSound()
{
if (_blipL != null)
{
_blipL.Dispose();
_blipL = null;
}
if (_blipR != null)
{
_blipR.Dispose();
_blipR = null;
}
}
}
}

View File

@ -2,6 +2,7 @@
using BizHawk.Common.BufferExtensions;
using BizHawk.Emulation.Common;
using BizHawk.Emulation.Cores.Consoles.Nintendo.Gameboy;
namespace BizHawk.Emulation.Cores.Nintendo.Gameboy
{
@ -17,7 +18,8 @@ namespace BizHawk.Emulation.Cores.Nintendo.Gameboy
portedUrl: "http://gambatte.sourceforge.net/")]
[ServiceNotApplicable(typeof(IDriveLight), typeof(IDriveLight))]
public partial class Gameboy : IEmulator, IVideoProvider, ISoundProvider, ISaveRam, IStatable, IInputPollable, ICodeDataLogger,
IBoardInfo, IDebuggable, ISettable<Gameboy.GambatteSettings, Gameboy.GambatteSyncSettings>
IBoardInfo, IDebuggable, ISettable<Gameboy.GambatteSettings, Gameboy.GambatteSyncSettings>,
IGameboyCommon
{
[CoreConstructor("GB", "GBC")]
public Gameboy(CoreComm comm, GameInfo game, byte[] file, object settings, object syncSettings, bool deterministic)
@ -50,6 +52,23 @@ namespace BizHawk.Emulation.Cores.Nintendo.Gameboy
throw new InvalidOperationException("gambatte_create() returned null???");
}
Console.WriteLine(game.System);
byte[] BiosRom;
if (game.System == "GB")
{
BiosRom = new byte[256];
BiosRom = comm.CoreFileProvider.GetFirmware("GB", "World", false);
}
else
{
BiosRom = new byte[2304];
BiosRom = comm.CoreFileProvider.GetFirmware("GBC", "World", false);
}
int bios_length = BiosRom == null ? 0 : BiosRom.Length;
try
{
_syncSettings = (GambatteSyncSettings)syncSettings ?? new GambatteSyncSettings();
@ -64,6 +83,25 @@ namespace BizHawk.Emulation.Cores.Nintendo.Gameboy
if (_syncSettings.ForceDMG)
{
flags |= LibGambatte.LoadFlags.FORCE_DMG;
// we need to change the BIOS to GB bios
if (game.System == "GBC")
{
BiosRom = null;
BiosRom = new byte[256];
BiosRom = comm.CoreFileProvider.GetFirmware("GB", "World", false);
}
}
if (_syncSettings.EnableBIOS && BiosRom == null)
{
throw new MissingFirmwareException("Boot Rom not found");
}
// to disable BIOS loading into gambatte, just set bios_length to 0
if (!_syncSettings.EnableBIOS)
{
bios_length = 0;
}
if (_syncSettings.GBACGB)
@ -76,7 +114,7 @@ namespace BizHawk.Emulation.Cores.Nintendo.Gameboy
flags |= LibGambatte.LoadFlags.MULTICART_COMPAT;
}
if (LibGambatte.gambatte_load(GambatteState, file, (uint)file.Length, GetCurrentTime(), flags) != 0)
if (LibGambatte.gambatte_load(GambatteState, file, (uint)file.Length, BiosRom, (uint)bios_length, GetCurrentTime(), flags) != 0)
{
throw new InvalidOperationException("gambatte_load() returned non-zero (is this not a gb or gbc rom?)");
}

View File

@ -0,0 +1,13 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace BizHawk.Emulation.Cores.Consoles.Nintendo.Gameboy
{
public interface IGameboyCommon
{
bool IsCGBMode();
}
}

Some files were not shown because too many files have changed in this diff Show More