Switch Bizhawk Client from console to winforms application; make "Show Log Window" a user-togglable option

This commit is contained in:
beirich 2011-07-09 19:54:24 +00:00
parent b25193ef84
commit 1496c9eb1d
6 changed files with 1731 additions and 1673 deletions

View File

@ -6,7 +6,7 @@
<ProductVersion>9.0.30729</ProductVersion>
<SchemaVersion>2.0</SchemaVersion>
<ProjectGuid>{DD448B37-BA3F-4544-9754-5406E8094723}</ProjectGuid>
<OutputType>Exe</OutputType>
<OutputType>WinExe</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>BizHawk.MultiClient</RootNamespace>
<AssemblyName>BizHawk.MultiClient</AssemblyName>
@ -138,6 +138,7 @@
<Compile Include="Input\ControllerBinding.cs" />
<Compile Include="Input\GamePad.cs" />
<Compile Include="Input\Input.cs" />
<Compile Include="LogConsole.cs" />
<Compile Include="movie\EditCommentsForm.cs">
<SubType>Form</SubType>
</Compile>

View File

@ -105,6 +105,7 @@
public bool EnableBackupMovies = true;
public bool HotkeyConfigAutoTab = true;
public bool InputConfigAutoTab = true;
public bool ShowLogWindow = false;
// Run-Control settings
public int FrameProgressDelayMs = 500; //how long until a frame advance hold turns into a frame progress?

View File

@ -0,0 +1,38 @@
using System;
using System.ComponentModel;
using System.Diagnostics;
using System.IO;
using System.Runtime.InteropServices;
using System.Windows.Forms;
namespace BizHawk.MultiClient
{
static class LogConsole
{
[DllImport("kernel32.dll", SetLastError = true)]
static extern bool AllocConsole();
[DllImport("kernel32.dll", SetLastError = true)]
static extern bool FreeConsole();
public static bool ConsoleVisible { get; private set; }
public static void ShowConsole()
{
if (ConsoleVisible) return;
AllocConsole();
ConsoleVisible = true;
var sout = new StreamWriter(Console.OpenStandardOutput());
sout.AutoFlush = true;
Console.SetOut(sout);
}
public static void HideConsole()
{
if (ConsoleVisible == false) return;
FreeConsole();
Console.SetOut(TextWriter.Null);
ConsoleVisible = false;
}
}
}

File diff suppressed because it is too large Load Diff

View File

@ -1,16 +1,8 @@
using System;
using System.Threading;
using System.Drawing;
using System.Drawing.Imaging;
using System.IO;
using System.Runtime.InteropServices;
using System.Windows.Forms;
using BizHawk.Core;
using BizHawk.Emulation.Consoles.Sega;
using BizHawk.Emulation.Consoles.TurboGrafx;
using BizHawk.Emulation.Consoles.Calculator;
using BizHawk.Emulation.Consoles.Gameboy;
using BizHawk.Emulation.Consoles.Nintendo;
namespace BizHawk.MultiClient
{
@ -915,5 +907,15 @@ namespace BizHawk.MultiClient
{
StopUserMovie();
}
private void displayLogWindowToolStripMenuItem_Click(object sender, EventArgs e)
{
Global.Config.ShowLogWindow ^= true;
displayLogWindowToolStripMenuItem.Checked = Global.Config.ShowLogWindow;
if (Global.Config.ShowLogWindow)
LogConsole.ShowConsole();
else
LogConsole.HideConsole();
}
}
}

View File

@ -69,7 +69,13 @@ namespace BizHawk.MultiClient
public MainForm(string[] args)
{
InitializeComponent();
UpdateStatusSlots();
if (Global.Config.ShowLogWindow)
{
LogConsole.ShowConsole();
displayLogWindowToolStripMenuItem.Checked = true;
}
UpdateStatusSlots();
//in order to allow late construction of this database, we hook up a delegate here to dearchive the data and provide it on demand
//we could background thread this later instead if we wanted to be real clever
NES.BootGodDB.GetDatabaseBytes = () =>