Skip to content

Commit

Permalink
Fixed detection bug and unhandled exception bug
Browse files Browse the repository at this point in the history
  • Loading branch information
ClusterM committed Jan 12, 2017
1 parent b91d8b1 commit b805961
Show file tree
Hide file tree
Showing 8 changed files with 1,095 additions and 1,042 deletions.
735 changes: 384 additions & 351 deletions FelLib/Fel.cs

Large diffs are not rendered by default.

627 changes: 316 additions & 311 deletions FelLib/WinUSBNet/API/DeviceManagement.cs

Large diffs are not rendered by default.

6 changes: 3 additions & 3 deletions MainForm.cs
Expand Up @@ -294,7 +294,7 @@ int RecalculateSelectedGames()

private void buttonAddGames_Click(object sender, EventArgs e)
{
if (openFileDialogNes.ShowDialog() == System.Windows.Forms.DialogResult.OK)
if (openFileDialogNes.ShowDialog() == DialogResult.OK)
{
SaveConfig();
NesGame nesGame = null;
Expand All @@ -309,7 +309,7 @@ private void buttonAddGames_Click(object sender, EventArgs e)
catch (UnsupportedMapperException ex)
{
if (MessageBox.Show(this, string.Format(Resources.MapperNotSupported, Path.GetFileName(file), ex.ROM.Mapper), Resources.AreYouSure, MessageBoxButtons.YesNo, MessageBoxIcon.Warning)
== System.Windows.Forms.DialogResult.Yes)
== DialogResult.Yes)
nesGame = new NesGame(GamesDir, file, true);
else continue;
}
Expand All @@ -322,7 +322,7 @@ private void buttonAddGames_Click(object sender, EventArgs e)
}
}
LoadGames();
if (openFileDialogNes.FileNames.Length == 1)
if (nesGame != null && openFileDialogNes.FileNames.Length == 1)
{
for (int i = 1; i < checkedListBoxGames.Items.Count; i++)
if ((checkedListBoxGames.Items[i] as NesGame).Code == nesGame.Code)
Expand Down
20 changes: 16 additions & 4 deletions NesGame.cs
Expand Up @@ -27,6 +27,10 @@ public class NesGame
public string ReleaseDate;
public string Publisher;

const string DefaultReleaseDate = "1983-07-15";
const string DefaultArgs = "--guest-overscan-dimensions 0,0,9,3 --initial-fadein-durations 3,2 --volume 75 --enable-armet";
const string DefaultPublisher = "Nintendo";

private byte[] supportedMappers = new byte[] { 0, 1, 2, 3, 4, 5, 7, 9, 10 };

public NesGame(string path)
Expand All @@ -38,6 +42,14 @@ public NesGame(string path)
IconPath = Path.Combine(path, Code + ".png");
SmallIconPath = Path.Combine(path, Code + "_small.png");
if (!File.Exists(ConfigPath)) throw new Exception("Invalid game directory: " + path);

Name = Code;
Players = 1;
Simultaneous = false;
ReleaseDate = DefaultReleaseDate;
Args = DefaultArgs;
Publisher = DefaultPublisher;

var configLines = File.ReadAllLines(ConfigPath);
foreach (var line in configLines)
{
Expand Down Expand Up @@ -130,7 +142,7 @@ public void Save()
"SortRawTitle={5}\n" +
"SortRawPublisher={6}\n" +
"Copyright=hakchi2 ©2017 Alexey 'Cluster' Avdyukhin\n",
Code, Args, Name, Players, ReleaseDate, Name.ToLower(), Publisher.ToUpper(), Simultaneous ? 1 : 0));
Code, Args ?? DefaultArgs, Name ?? Code, Players, ReleaseDate ?? DefaultReleaseDate, (Name ?? Code).ToLower(), (Publisher ?? DefaultPublisher) .ToUpper(), Simultaneous ? 1 : 0));
}

public NesGame(string gamesDirectory, string nesFileName, bool ignoreMapper = false)
Expand Down Expand Up @@ -176,9 +188,9 @@ public NesGame(string gamesDirectory, string nesFileName, bool ignoreMapper = fa
Name = Regex.Replace(Name, @" ?\[.*?\]", string.Empty).Trim();
Name = Name.Replace(", The", "").Replace("_", " ").Replace(" ", " ").Trim();
Players = 1;
ReleaseDate = "1983-07-15";
Publisher = "Nintendo";
Args = "--guest-overscan-dimensions 0,0,9,3 --initial-fadein-durations 3,2 --volume 75 --enable-armet";
ReleaseDate = DefaultReleaseDate;
Publisher = DefaultPublisher;
Args = DefaultArgs;
IconPath = Path.Combine(GamePath, Code + ".png");
SmallIconPath = Path.Combine(GamePath, Code + "_small.png");
SetImage(Resources.blank);
Expand Down
72 changes: 36 additions & 36 deletions Properties/AssemblyInfo.cs
@@ -1,36 +1,36 @@
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;

// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("hakchi2")]
[assembly: AssemblyDescription("Based on hakchi by madmonkey\r\n\r\nSpecial thanks:\r\nPete Batard/Akeo for Zadig\r\npbatard for libwdi\r\nThomas Bleeker for WinUSBNet library\r\nNintendo for my childhood\r\n\r\nMy site: http://clusterrr.com\r\nE-mail: clusterrr@clusterrr.com\r\nPayPal for donations: clusterrr@clusterrr.com")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("Alexey 'Cluster' Avdyukhin")]
[assembly: AssemblyProduct("hakchi2")]
[assembly: AssemblyCopyright("Copyright © 2017")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]

// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]

// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("0ba69d0f-624e-42c9-be2a-925433b1ed42")]

// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("2.0.0.7")]
[assembly: AssemblyFileVersion("2.0.0.7")]
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;

// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("hakchi2")]
[assembly: AssemblyDescription("Based on hakchi by madmonkey\r\n\r\nSpecial thanks:\r\nPete Batard/Akeo for Zadig\r\npbatard for libwdi\r\nThomas Bleeker for WinUSBNet library\r\nNintendo for my childhood\r\n\r\nMy site: http://clusterrr.com\r\nE-mail: clusterrr@clusterrr.com\r\nPayPal for donations: clusterrr@clusterrr.com")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("Alexey 'Cluster' Avdyukhin")]
[assembly: AssemblyProduct("hakchi2")]
[assembly: AssemblyCopyright("Copyright © 2017")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]

// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]

// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("0ba69d0f-624e-42c9-be2a-925433b1ed42")]

// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("2.0.0.7")]
[assembly: AssemblyFileVersion("2.0.0.7")]
2 changes: 1 addition & 1 deletion Properties/Resources.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Properties/Resources.resx
Expand Up @@ -197,7 +197,7 @@
<value>Sorry, {0} uses mapper #{1} but this mapper is not supported by NES Mini and game probably will not start. Do you want to add this game anyway?</value>
</data>
<data name="MD5Failed" xml:space="preserve">
<value>Kernel dumped but MD5 checksum is unknown: {0}</value>
<value>Kernel dumped but MD5 checksum is unknown:</value>
</data>
<data name="MD5Failed2" xml:space="preserve">
<value>Maybe the kernel already patched or it's unknown revision. Please send this message to me (press Ctrl+C). Continue on your own risk.</value>
Expand Down

0 comments on commit b805961

Please sign in to comment.