Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/ClusterM/hakchi2.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlexey 'Cluster' Avdyukhin <clusterrr@clusterrr.com>2018-03-20 20:36:00 +0300
committerAlexey 'Cluster' Avdyukhin <clusterrr@clusterrr.com>2018-03-20 20:36:00 +0300
commita1590b08308921b95656046224bc3dd75131b42c (patch)
tree98440677ec33d24858450df9f1401bbec90b2957
parentf1bd4ab0679dd02c8a28e763ada4e7ed34322c81 (diff)
Life View tool for remote debug
-rw-r--r--LifeViewForm.Designer.cs65
-rw-r--r--LifeViewForm.cs56
-rw-r--r--LifeViewForm.resx120
-rw-r--r--MainForm.cs50
-rw-r--r--Properties/AssemblyInfo.cs4
-rw-r--r--WorkerForm.cs8
-rw-r--r--hakchi_gui.csproj13
7 files changed, 287 insertions, 29 deletions
diff --git a/LifeViewForm.Designer.cs b/LifeViewForm.Designer.cs
new file mode 100644
index 00000000..59f514ca
--- /dev/null
+++ b/LifeViewForm.Designer.cs
@@ -0,0 +1,65 @@
+namespace com.clusterrr.hakchi_gui
+{
+ partial class LifeViewForm
+ {
+ /// <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()
+ {
+ this.pictureBox = new System.Windows.Forms.PictureBox();
+ ((System.ComponentModel.ISupportInitialize)(this.pictureBox)).BeginInit();
+ this.SuspendLayout();
+ //
+ // pictureBox
+ //
+ this.pictureBox.Dock = System.Windows.Forms.DockStyle.Fill;
+ this.pictureBox.Location = new System.Drawing.Point(0, 0);
+ this.pictureBox.Name = "pictureBox";
+ this.pictureBox.Size = new System.Drawing.Size(618, 304);
+ this.pictureBox.SizeMode = System.Windows.Forms.PictureBoxSizeMode.Zoom;
+ this.pictureBox.TabIndex = 0;
+ this.pictureBox.TabStop = false;
+ //
+ // LifeViewForm
+ //
+ this.AutoScaleDimensions = new System.Drawing.SizeF(9F, 20F);
+ this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
+ this.ClientSize = new System.Drawing.Size(618, 304);
+ this.Controls.Add(this.pictureBox);
+ this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.SizableToolWindow;
+ this.Name = "LifeViewForm";
+ this.Text = "Life View";
+ this.TopMost = true;
+ this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.LifeViewForm_FormClosing);
+ ((System.ComponentModel.ISupportInitialize)(this.pictureBox)).EndInit();
+ this.ResumeLayout(false);
+
+ }
+
+ #endregion
+
+ private System.Windows.Forms.PictureBox pictureBox;
+ }
+} \ No newline at end of file
diff --git a/LifeViewForm.cs b/LifeViewForm.cs
new file mode 100644
index 00000000..0597f12c
--- /dev/null
+++ b/LifeViewForm.cs
@@ -0,0 +1,56 @@
+using System;
+using System.Collections.Generic;
+using System.ComponentModel;
+using System.Data;
+using System.Diagnostics;
+using System.Drawing;
+using System.Linq;
+using System.Text;
+using System.Threading;
+using System.Windows.Forms;
+
+namespace com.clusterrr.hakchi_gui
+{
+ public partial class LifeViewForm : Form
+ {
+ Thread screenShotThread;
+
+ public LifeViewForm()
+ {
+ InitializeComponent();
+ screenShotThread = new Thread(screenShotLoop);
+ screenShotThread.Start();
+ }
+
+ void screenShotLoop()
+ {
+ while (true)
+ {
+ try
+ {
+ var screenshot = WorkerForm.TakeScreenshot(false);
+ Invoke(new Action(delegate ()
+ {
+ pictureBox.Image = screenshot;
+ }));
+ }
+ catch (ThreadAbortException)
+ {
+ screenShotThread = null;
+ return;
+ }
+ catch (Exception ex)
+ {
+ Debug.WriteLine("Error: " + ex.Message + ex.StackTrace);
+ Thread.Sleep(1000);
+ }
+ }
+ }
+
+ private void LifeViewForm_FormClosing(object sender, FormClosingEventArgs e)
+ {
+ if (screenShotThread != null)
+ screenShotThread.Abort();
+ }
+ }
+}
diff --git a/LifeViewForm.resx b/LifeViewForm.resx
new file mode 100644
index 00000000..5ea0895e
--- /dev/null
+++ b/LifeViewForm.resx
@@ -0,0 +1,120 @@
+<?xml version="1.0" encoding="utf-8"?>
+<root>
+ <!--
+ Microsoft ResX Schema
+
+ Version 2.0
+
+ The primary goals of this format is to allow a simple XML format
+ that is mostly human readable. The generation and parsing of the
+ various data types are done through the TypeConverter classes
+ associated with the data types.
+
+ Example:
+
+ ... ado.net/XML headers & schema ...
+ <resheader name="resmimetype">text/microsoft-resx</resheader>
+ <resheader name="version">2.0</resheader>
+ <resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
+ <resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
+ <data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
+ <data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
+ <data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
+ <value>[base64 mime encoded serialized .NET Framework object]</value>
+ </data>
+ <data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
+ <value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
+ <comment>This is a comment</comment>
+ </data>
+
+ There are any number of "resheader" rows that contain simple
+ name/value pairs.
+
+ Each data row contains a name, and value. The row also contains a
+ type or mimetype. Type corresponds to a .NET class that support
+ text/value conversion through the TypeConverter architecture.
+ Classes that don't support this are serialized and stored with the
+ mimetype set.
+
+ The mimetype is used for serialized objects, and tells the
+ ResXResourceReader how to depersist the object. This is currently not
+ extensible. For a given mimetype the value must be set accordingly:
+
+ Note - application/x-microsoft.net.object.binary.base64 is the format
+ that the ResXResourceWriter will generate, however the reader can
+ read any of the formats listed below.
+
+ mimetype: application/x-microsoft.net.object.binary.base64
+ value : The object must be serialized with
+ : System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
+ : and then encoded with base64 encoding.
+
+ mimetype: application/x-microsoft.net.object.soap.base64
+ value : The object must be serialized with
+ : System.Runtime.Serialization.Formatters.Soap.SoapFormatter
+ : and then encoded with base64 encoding.
+
+ mimetype: application/x-microsoft.net.object.bytearray.base64
+ value : The object must be serialized into a byte array
+ : using a System.ComponentModel.TypeConverter
+ : and then encoded with base64 encoding.
+ -->
+ <xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
+ <xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
+ <xsd:element name="root" msdata:IsDataSet="true">
+ <xsd:complexType>
+ <xsd:choice maxOccurs="unbounded">
+ <xsd:element name="metadata">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="value" type="xsd:string" minOccurs="0" />
+ </xsd:sequence>
+ <xsd:attribute name="name" use="required" type="xsd:string" />
+ <xsd:attribute name="type" type="xsd:string" />
+ <xsd:attribute name="mimetype" type="xsd:string" />
+ <xsd:attribute ref="xml:space" />
+ </xsd:complexType>
+ </xsd:element>
+ <xsd:element name="assembly">
+ <xsd:complexType>
+ <xsd:attribute name="alias" type="xsd:string" />
+ <xsd:attribute name="name" type="xsd:string" />
+ </xsd:complexType>
+ </xsd:element>
+ <xsd:element name="data">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
+ <xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
+ </xsd:sequence>
+ <xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
+ <xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
+ <xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
+ <xsd:attribute ref="xml:space" />
+ </xsd:complexType>
+ </xsd:element>
+ <xsd:element name="resheader">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
+ </xsd:sequence>
+ <xsd:attribute name="name" type="xsd:string" use="required" />
+ </xsd:complexType>
+ </xsd:element>
+ </xsd:choice>
+ </xsd:complexType>
+ </xsd:element>
+ </xsd:schema>
+ <resheader name="resmimetype">
+ <value>text/microsoft-resx</value>
+ </resheader>
+ <resheader name="version">
+ <value>2.0</value>
+ </resheader>
+ <resheader name="reader">
+ <value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
+ </resheader>
+ <resheader name="writer">
+ <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
+ </resheader>
+</root> \ No newline at end of file
diff --git a/MainForm.cs b/MainForm.cs
index d6b2c9de..b62161cb 100644
--- a/MainForm.cs
+++ b/MainForm.cs
@@ -1711,31 +1711,37 @@ namespace com.clusterrr.hakchi_gui
{
if (WaitingClovershellForm.WaitForDevice(this))
{
- var screenshot = WorkerForm.TakeScreenshot();
- var screenshotPath = Path.Combine(Path.GetTempPath(), Path.GetRandomFileName() + ".png");
- screenshot.Save(screenshotPath, ImageFormat.Png);
- var showProcess = new Process()
+ if (Control.ModifierKeys != Keys.Shift)
{
- StartInfo = new ProcessStartInfo()
- {
- FileName = screenshotPath
- }
- };
- showProcess.Start();
- new Thread(delegate ()
- {
- try
+ var screenshot = WorkerForm.TakeScreenshot();
+ var screenshotPath = Path.Combine(Path.GetTempPath(), Path.GetRandomFileName() + ".png");
+ screenshot.Save(screenshotPath, ImageFormat.Png);
+ var showProcess = new Process()
{
- Thread.Sleep(5000);
- showProcess.WaitForExit();
- }
- catch { }
- try
+ StartInfo = new ProcessStartInfo()
+ {
+ FileName = screenshotPath
+ }
+ };
+ showProcess.Start();
+ new Thread(delegate ()
{
- File.Delete(screenshotPath);
- }
- catch { }
- }).Start();
+ try
+ {
+ Thread.Sleep(5000);
+ showProcess.WaitForExit();
+ }
+ catch { }
+ try
+ {
+ File.Delete(screenshotPath);
+ }
+ catch { }
+ }).Start();
+ } else // Shift pressed
+ {
+ new LifeViewForm().ShowDialog();
+ }
}
}
catch (Exception ex)
diff --git a/Properties/AssemblyInfo.cs b/Properties/AssemblyInfo.cs
index 3b5ec96d..1fa29091 100644
--- a/Properties/AssemblyInfo.cs
+++ b/Properties/AssemblyInfo.cs
@@ -33,6 +33,6 @@ using System.Resources;
// 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.30.15")]
-[assembly: AssemblyFileVersion("2.0.30.15")]
+[assembly: AssemblyVersion("2.0.30.16")]
+[assembly: AssemblyFileVersion("2.0.30.16")]
[assembly: NeutralResourcesLanguageAttribute("en-US")]
diff --git a/WorkerForm.cs b/WorkerForm.cs
index 1d97593a..8b80a3d2 100644
--- a/WorkerForm.cs
+++ b/WorkerForm.cs
@@ -1120,14 +1120,16 @@ namespace com.clusterrr.hakchi_gui
return MainForm.ConsoleType.Unknown;
}
- public static Image TakeScreenshot()
+ public static Image TakeScreenshot(bool pauseUI = true)
{
var clovershell = MainForm.Clovershell;
var screenshot = new Bitmap(1280, 720, PixelFormat.Format24bppRgb);
var rawStream = new MemoryStream();
- clovershell.ExecuteSimple("hakchi uipause");
+ if (pauseUI)
+ clovershell.ExecuteSimple("hakchi uipause");
clovershell.Execute("cat /dev/fb0", null, rawStream, null, 1000, true);
- clovershell.ExecuteSimple("hakchi uiresume");
+ if (pauseUI)
+ clovershell.ExecuteSimple("hakchi uiresume");
var raw = rawStream.ToArray();
BitmapData data = screenshot.LockBits(
new Rectangle(0, 0, screenshot.Width, screenshot.Height),
diff --git a/hakchi_gui.csproj b/hakchi_gui.csproj
index ca44aaa0..07421598 100644
--- a/hakchi_gui.csproj
+++ b/hakchi_gui.csproj
@@ -31,8 +31,8 @@
<PublisherName>Alexey %27Cluster%27 Avdyukhin</PublisherName>
<CreateWebPageOnPublish>true</CreateWebPageOnPublish>
<WebPage>index.html</WebPage>
- <ApplicationRevision>15</ApplicationRevision>
- <ApplicationVersion>2.0.30.15</ApplicationVersion>
+ <ApplicationRevision>16</ApplicationRevision>
+ <ApplicationVersion>2.0.30.16</ApplicationVersion>
<UseApplicationTrust>false</UseApplicationTrust>
<CreateDesktopShortcut>true</CreateDesktopShortcut>
<PublishWizardCompleted>true</PublishWizardCompleted>
@@ -152,6 +152,12 @@
<Compile Include="GameGenie\GameGenieFormatException.cs" />
<Compile Include="GameGenie\GameGenieNotFoundException.cs" />
<Compile Include="GameGenie\GameGeniePatcherSnes.cs" />
+ <Compile Include="LifeViewForm.cs">
+ <SubType>Form</SubType>
+ </Compile>
+ <Compile Include="LifeViewForm.Designer.cs">
+ <DependentUpon>LifeViewForm.cs</DependentUpon>
+ </Compile>
<Compile Include="SelectConsoleDialog.cs">
<SubType>Form</SubType>
</Compile>
@@ -597,6 +603,9 @@
<EmbeddedResource Include="ImageGooglerForm.pt-BR.resx">
<DependentUpon>ImageGooglerForm.cs</DependentUpon>
</EmbeddedResource>
+ <EmbeddedResource Include="LifeViewForm.resx">
+ <DependentUpon>LifeViewForm.cs</DependentUpon>
+ </EmbeddedResource>
<EmbeddedResource Include="MainForm.hu-HU.resx">
<DependentUpon>MainForm.cs</DependentUpon>
</EmbeddedResource>