Merged all components into a stand-alone exe
This commit is contained in:
parent
89943b425a
commit
b47736fae1
6 changed files with 82 additions and 28 deletions
|
@ -19,7 +19,7 @@ using Mesen.GUI.Forms.NetPlay;
|
|||
|
||||
namespace Mesen.GUI.Forms
|
||||
{
|
||||
public partial class frmMain : Form
|
||||
public partial class frmMain : BaseForm
|
||||
{
|
||||
private InteropEmu.NotificationListener _notifListener;
|
||||
private Thread _emuThread;
|
||||
|
@ -32,8 +32,6 @@ namespace Mesen.GUI.Forms
|
|||
_romToLoad = args[0];
|
||||
}
|
||||
|
||||
Application.ThreadException += Application_ThreadException;
|
||||
Directory.SetCurrentDirectory(Path.GetDirectoryName(Application.ExecutablePath));
|
||||
InitializeComponent();
|
||||
}
|
||||
|
||||
|
@ -62,10 +60,6 @@ namespace Mesen.GUI.Forms
|
|||
UpdateMenus();
|
||||
UpdateRecentFiles();
|
||||
|
||||
if(!DesignMode) {
|
||||
Icon = Properties.Resources.MesenIcon;
|
||||
}
|
||||
|
||||
if(_romToLoad != null) {
|
||||
LoadROM(this._romToLoad);
|
||||
}
|
||||
|
@ -190,11 +184,6 @@ namespace Mesen.GUI.Forms
|
|||
dxViewer.Size = new Size(size.Width, size.Height);
|
||||
}
|
||||
|
||||
private void Application_ThreadException(object sender, ThreadExceptionEventArgs e)
|
||||
{
|
||||
MessageBox.Show(e.Exception.ToString(), "Unexpected Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
}
|
||||
|
||||
private void _notifListener_OnNotification(InteropEmu.NotificationEventArgs e)
|
||||
{
|
||||
if(e.NotificationType == InteropEmu.ConsoleNotificationType.GameLoaded) {
|
||||
|
|
|
@ -309,6 +309,7 @@
|
|||
<Compile Include="InteropEmu.cs" />
|
||||
<Compile Include="Program.cs" />
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
<Compile Include="ResourceManager.cs" />
|
||||
<Compile Include="RuntimeChecker.cs" />
|
||||
<Compile Include="SingleInstance.cs" />
|
||||
<EmbeddedResource Include="Controls\ctrlTrackbar.resx">
|
||||
|
@ -423,6 +424,15 @@
|
|||
<DependentUpon>Resources.resx</DependentUpon>
|
||||
<DesignTime>True</DesignTime>
|
||||
</Compile>
|
||||
<EmbeddedResource Include="..\Windows\Resources\Roboto.12.spritefont">
|
||||
<Link>Dependencies\Roboto.12.spritefont</Link>
|
||||
</EmbeddedResource>
|
||||
<EmbeddedResource Include="..\Windows\Resources\Roboto.9.spritefont">
|
||||
<Link>Dependencies\Roboto.9.spritefont</Link>
|
||||
</EmbeddedResource>
|
||||
<EmbeddedResource Include="..\Windows\Resources\Toast.dds">
|
||||
<Link>Dependencies\Toast.dds</Link>
|
||||
</EmbeddedResource>
|
||||
<None Include="Properties\Settings.settings">
|
||||
<Generator>SettingsSingleFileGenerator</Generator>
|
||||
<LastGenOutput>Settings.Designer.cs</LastGenOutput>
|
||||
|
@ -437,6 +447,18 @@
|
|||
<None Include="App.config" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<EmbeddedResource Include="$(OutputPath)\BlipBuffer.dll">
|
||||
<Link>Dependencies\BlipBuffer.dll</Link>
|
||||
</EmbeddedResource>
|
||||
<EmbeddedResource Include="$(OutputPath)\NesNtsc.dll">
|
||||
<Link>Dependencies\NesNtsc.dll</Link>
|
||||
</EmbeddedResource>
|
||||
<EmbeddedResource Include="$(OutputPath)\WinMesen.dll">
|
||||
<Link>Dependencies\WinMesen.dll</Link>
|
||||
</EmbeddedResource>
|
||||
<EmbeddedResource Include="..\Windows\Resources\MesenIcon.bmp">
|
||||
<Link>Dependencies\MesenIcon.bmp</Link>
|
||||
</EmbeddedResource>
|
||||
<Content Include="Icon.ico" />
|
||||
<None Include="Resources\help.png" />
|
||||
<None Include="Resources\Close.png" />
|
||||
|
|
|
@ -1,11 +1,13 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows.Forms;
|
||||
using Mesen.GUI.Config;
|
||||
|
||||
namespace Mesen.GUI
|
||||
{
|
||||
|
@ -15,12 +17,22 @@ namespace Mesen.GUI
|
|||
[return: MarshalAs(UnmanagedType.Bool)]
|
||||
private static extern bool SetForegroundWindow(IntPtr hWnd);
|
||||
|
||||
private static void Application_ThreadException(object sender, ThreadExceptionEventArgs e)
|
||||
{
|
||||
MessageBox.Show(e.Exception.ToString(), "Unexpected Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The main entry point for the application.
|
||||
/// </summary>
|
||||
[STAThread]
|
||||
static void Main(string[] args)
|
||||
private static void Main(string[] args)
|
||||
{
|
||||
Application.ThreadException += Application_ThreadException;
|
||||
|
||||
Directory.SetCurrentDirectory(ConfigManager.HomeFolder);
|
||||
ResourceManager.ExtractResources();
|
||||
|
||||
if(!RuntimeChecker.TestDll()) {
|
||||
return;
|
||||
}
|
||||
|
|
40
GUI.NET/ResourceManager.cs
Normal file
40
GUI.NET/ResourceManager.cs
Normal file
|
@ -0,0 +1,40 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using Mesen.GUI.Config;
|
||||
|
||||
namespace Mesen.GUI
|
||||
{
|
||||
class ResourceManager
|
||||
{
|
||||
private static void ExtractResource(string resourceName, string filename)
|
||||
{
|
||||
if(!System.IO.File.Exists(filename)) {
|
||||
System.Reflection.Assembly a = System.Reflection.Assembly.GetExecutingAssembly();
|
||||
using(Stream s = a.GetManifestResourceStream(resourceName)) {
|
||||
byte[] buffer = new byte[s.Length];
|
||||
s.Read(buffer, 0, (int)s.Length);
|
||||
File.WriteAllBytes(Path.Combine(ConfigManager.HomeFolder, filename), buffer);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static void ExtractResources()
|
||||
{
|
||||
Directory.CreateDirectory(Path.Combine(ConfigManager.HomeFolder, "Resources"));
|
||||
|
||||
//Extract all needed files
|
||||
ExtractResource("Mesen.GUI.Dependencies.WinMesen.dll", "WinMesen.dll");
|
||||
ExtractResource("Mesen.GUI.Dependencies.BlipBuffer.dll", "BlipBuffer.dll");
|
||||
ExtractResource("Mesen.GUI.Dependencies.NesNtsc.dll", "NesNtsc.dll");
|
||||
|
||||
ExtractResource("Mesen.GUI.Dependencies.MesenIcon.bmp", Path.Combine("Resources", "MesenIcon.bmp"));
|
||||
ExtractResource("Mesen.GUI.Dependencies.Roboto.12.spritefont", Path.Combine("Resources", "Roboto.12.spritefont"));
|
||||
ExtractResource("Mesen.GUI.Dependencies.Roboto.9.spritefont", Path.Combine("Resources", "Roboto.9.spritefont"));
|
||||
ExtractResource("Mesen.GUI.Dependencies.Toast.dds", Path.Combine("Resources", "Toast.dds"));
|
||||
}
|
||||
}
|
||||
}
|
7
NES.sln
7
NES.sln
|
@ -7,7 +7,6 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Core", "Core\Core.vcxproj",
|
|||
ProjectSection(ProjectDependencies) = postProject
|
||||
{B5330148-E8C7-46BA-B54E-69BE59EA337D} = {B5330148-E8C7-46BA-B54E-69BE59EA337D}
|
||||
{CF35D78C-F710-41D2-968F-C46ACCFF6F07} = {CF35D78C-F710-41D2-968F-C46ACCFF6F07}
|
||||
{7761E790-B42C-4179-8550-8365FF9EB23E} = {7761E790-B42C-4179-8550-8365FF9EB23E}
|
||||
{65DB72B1-A45A-4475-90C1-60596B3ABEB3} = {65DB72B1-A45A-4475-90C1-60596B3ABEB3}
|
||||
EndProjectSection
|
||||
EndProject
|
||||
|
@ -19,9 +18,14 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "GUI.NET", "GUI.NET\GUI.NET.
|
|||
EndProjectSection
|
||||
EndProject
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Windows", "Windows\Windows.vcxproj", "{7761E790-B42C-4179-8550-8365FF9EB23E}"
|
||||
ProjectSection(ProjectDependencies) = postProject
|
||||
{B5330148-E8C7-46BA-B54E-69BE59EA337D} = {B5330148-E8C7-46BA-B54E-69BE59EA337D}
|
||||
{78FEF1A1-6DF1-4CBB-A373-AE6FA7CE5CE0} = {78FEF1A1-6DF1-4CBB-A373-AE6FA7CE5CE0}
|
||||
EndProjectSection
|
||||
EndProject
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "InteropDLL", "InteropDLL\InteropDLL.vcxproj", "{37749BB2-FA78-4EC9-8990-5628FC0BBA19}"
|
||||
ProjectSection(ProjectDependencies) = postProject
|
||||
{B5330148-E8C7-46BA-B54E-69BE59EA337D} = {B5330148-E8C7-46BA-B54E-69BE59EA337D}
|
||||
{7761E790-B42C-4179-8550-8365FF9EB23E} = {7761E790-B42C-4179-8550-8365FF9EB23E}
|
||||
{78FEF1A1-6DF1-4CBB-A373-AE6FA7CE5CE0} = {78FEF1A1-6DF1-4CBB-A373-AE6FA7CE5CE0}
|
||||
EndProjectSection
|
||||
|
@ -101,6 +105,7 @@ Global
|
|||
{CF35D78C-F710-41D2-968F-C46ACCFF6F07}.Debug|x86.ActiveCfg = Debug|Win32
|
||||
{CF35D78C-F710-41D2-968F-C46ACCFF6F07}.Debug|x86.Build.0 = Debug|Win32
|
||||
{CF35D78C-F710-41D2-968F-C46ACCFF6F07}.Release|x64.ActiveCfg = Release|x64
|
||||
{CF35D78C-F710-41D2-968F-C46ACCFF6F07}.Release|x64.Build.0 = Release|x64
|
||||
{CF35D78C-F710-41D2-968F-C46ACCFF6F07}.Release|x86.ActiveCfg = Release|Win32
|
||||
{CF35D78C-F710-41D2-968F-C46ACCFF6F07}.Release|x86.Build.0 = Release|Win32
|
||||
{2A607369-8B5D-494A-9E40-C5DC8D821AA3}.Debug|x64.ActiveCfg = Debug|x64
|
||||
|
|
|
@ -264,20 +264,6 @@
|
|||
<DeploymentContent>false</DeploymentContent>
|
||||
</Image>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Content Include="Resources\MesenIcon.bmp">
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
</Content>
|
||||
<Content Include="Resources\Roboto.12.spritefont">
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
</Content>
|
||||
<Content Include="Resources\Roboto.9.spritefont">
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
</Content>
|
||||
<Content Include="Resources\Toast.dds">
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
</Content>
|
||||
</ItemGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
||||
<ImportGroup Label="ExtensionTargets">
|
||||
</ImportGroup>
|
||||
|
|
Loading…
Add table
Reference in a new issue