mirror of
https://github.com/R-YaTian/TinkeDSi.git
synced 2025-06-18 16:45:43 -04:00
Add a basic hex viewer for mono
This commit is contained in:
parent
5419a249c7
commit
581845a0dd
@ -874,10 +874,7 @@ namespace Tinke
|
||||
listFile.Items[6].SubItems.Add(accion.Get_RelativePath(selectFile.id, "", accion.Root));
|
||||
toolStripOpenAs.Enabled = true;
|
||||
|
||||
if (isMono)
|
||||
btnHex.Enabled = false;
|
||||
else
|
||||
btnHex.Enabled = true;
|
||||
btnHex.Enabled = true;
|
||||
|
||||
if (selectFile.format != Format.Unknown)
|
||||
btnSee.Enabled = true;
|
||||
@ -1045,17 +1042,23 @@ namespace Tinke
|
||||
private void btnHex_Click(object sender, EventArgs e)
|
||||
{
|
||||
sFile file = accion.Selected_File();
|
||||
VisorHex hex = new VisorHex(accion.Save_File(file), file.id,
|
||||
file.name == "rom.nds" ? false : true);
|
||||
string filePath = accion.Save_File(file);
|
||||
Form hex;
|
||||
|
||||
if (!isMono) {
|
||||
hex = new VisorHex(filePath, file.id, file.name != "rom.nds");
|
||||
hex.FormClosed += hex_FormClosed;
|
||||
} else {
|
||||
hex = new VisorHexBasic(filePath, 0, file.size);
|
||||
}
|
||||
|
||||
hex.Text += " - " + file.name;
|
||||
hex.Show();
|
||||
hex.FormClosed += new FormClosedEventHandler(hex_FormClosed);
|
||||
}
|
||||
void hex_FormClosed(object sender, FormClosedEventArgs e)
|
||||
{
|
||||
VisorHex hex = (VisorHex)sender;
|
||||
if (hex.Edited)
|
||||
VisorHex hex = sender as VisorHex;
|
||||
if (sender != null && hex.Edited)
|
||||
accion.Change_File(hex.FileID, hex.NewFile);
|
||||
}
|
||||
|
||||
|
@ -310,6 +310,15 @@
|
||||
<DependentUpon>Settings.settings</DependentUpon>
|
||||
<DesignTimeSharedInput>True</DesignTimeSharedInput>
|
||||
</Compile>
|
||||
<Compile Include="VisorHexBasic.cs">
|
||||
<SubType>Form</SubType>
|
||||
</Compile>
|
||||
<Compile Include="VisorHexBasic.Designer.cs">
|
||||
<DependentUpon>VisorHexBasic.cs</DependentUpon>
|
||||
</Compile>
|
||||
<EmbeddedResource Include="VisorHexBasic.resx">
|
||||
<DependentUpon>VisorHexBasic.cs</DependentUpon>
|
||||
</EmbeddedResource>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\Be.Windows.Forms.HexBox\Be.Windows.Forms.HexBox.csproj">
|
||||
@ -391,11 +400,11 @@
|
||||
</ItemGroup>
|
||||
<ItemGroup />
|
||||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
|
||||
<!-- 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>
|
||||
</Project>
|
||||
|
80
Tinke/VisorHexBasic.Designer.cs
generated
Normal file
80
Tinke/VisorHexBasic.Designer.cs
generated
Normal file
@ -0,0 +1,80 @@
|
||||
namespace Tinke
|
||||
{
|
||||
partial class VisorHexBasic
|
||||
{
|
||||
/// <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(VisorHex));
|
||||
this.txtHex = new System.Windows.Forms.TextBox();
|
||||
this.vScrollBar1 = new System.Windows.Forms.VScrollBar();
|
||||
this.SuspendLayout();
|
||||
//
|
||||
// txtHex
|
||||
//
|
||||
this.txtHex.BorderStyle = System.Windows.Forms.BorderStyle.None;
|
||||
this.txtHex.Dock = System.Windows.Forms.DockStyle.Left;
|
||||
this.txtHex.Font = new System.Drawing.Font("Consolas", 11F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
|
||||
this.txtHex.Location = new System.Drawing.Point(0, 0);
|
||||
this.txtHex.Multiline = true;
|
||||
this.txtHex.Name = "txtHex";
|
||||
this.txtHex.Size = new System.Drawing.Size(795, 272);
|
||||
this.txtHex.TabIndex = 2;
|
||||
//
|
||||
// vScrollBar1
|
||||
//
|
||||
this.vScrollBar1.Dock = System.Windows.Forms.DockStyle.Right;
|
||||
this.vScrollBar1.Location = new System.Drawing.Point(790, 0);
|
||||
this.vScrollBar1.Name = "vScrollBar1";
|
||||
this.vScrollBar1.Size = new System.Drawing.Size(19, 272);
|
||||
this.vScrollBar1.TabIndex = 3;
|
||||
this.vScrollBar1.Scroll += new System.Windows.Forms.ScrollEventHandler(this.vScrollBar1_Scroll);
|
||||
//
|
||||
// VisorHex
|
||||
//
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||
this.ClientSize = new System.Drawing.Size(809, 272);
|
||||
this.Controls.Add(this.vScrollBar1);
|
||||
this.Controls.Add(this.txtHex);
|
||||
this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
|
||||
this.MinimizeBox = false;
|
||||
this.MinimumSize = new System.Drawing.Size(825, 38);
|
||||
this.Name = "VisorHex";
|
||||
this.Text = "S41";
|
||||
this.ResumeLayout(false);
|
||||
this.PerformLayout();
|
||||
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
private System.Windows.Forms.TextBox txtHex;
|
||||
private System.Windows.Forms.VScrollBar vScrollBar1;
|
||||
|
||||
|
||||
}
|
||||
}
|
86
Tinke/VisorHexBasic.cs
Normal file
86
Tinke/VisorHexBasic.cs
Normal file
@ -0,0 +1,86 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Data;
|
||||
using System.Drawing;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Windows.Forms;
|
||||
using System.IO;
|
||||
|
||||
namespace Tinke
|
||||
{
|
||||
public partial class VisorHexBasic : Form
|
||||
{
|
||||
string file;
|
||||
UInt32 offset;
|
||||
UInt32 size;
|
||||
|
||||
public VisorHexBasic(string file, UInt32 offset, UInt32 size)
|
||||
{
|
||||
InitializeComponent();
|
||||
this.Text = Tools.Helper.GetTranslation("Sistema", "S41");
|
||||
|
||||
this.file = file;
|
||||
this.offset = offset;
|
||||
this.size = size;
|
||||
|
||||
vScrollBar1.Maximum = (int)size / 0x10;
|
||||
Show_Hex(0);
|
||||
|
||||
txtHex.Select(0, 0);
|
||||
txtHex.HideSelection = false;
|
||||
this.Resize += new System.EventHandler(this.VisorHex_Resize);
|
||||
}
|
||||
|
||||
public void Clear()
|
||||
{
|
||||
txtHex.Text = "";
|
||||
}
|
||||
|
||||
private void vScrollBar1_Scroll(object sender, ScrollEventArgs e)
|
||||
{
|
||||
Show_Hex(e.NewValue);
|
||||
}
|
||||
|
||||
private void Show_Hex(int pos)
|
||||
{
|
||||
BinaryReader br = new BinaryReader(File.OpenRead(file));
|
||||
br.BaseStream.Position = offset + pos * 16;
|
||||
|
||||
txtHex.ReadOnly = true;
|
||||
txtHex.Text = "Offset 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F\r\n\r\n";
|
||||
|
||||
for (int i = 0; i < txtHex.Height / 17; i++)
|
||||
{
|
||||
if (br.BaseStream.Length == br.BaseStream.Position ||
|
||||
br.BaseStream.Position >= offset + size)
|
||||
break;
|
||||
|
||||
string text, ascii; text = ascii = "";
|
||||
|
||||
for (int j = 0; j < 0x10; j++)
|
||||
{
|
||||
if (br.BaseStream.Position == offset + size)
|
||||
break;
|
||||
|
||||
byte value = br.ReadByte();
|
||||
string c = String.Format("{0:X}", value);
|
||||
text += (c.Length == 2 ? c : '0' + c) + ' ';
|
||||
ascii += (value > 0x1F && value < 0x7F ? Char.ConvertFromUtf32(value).ToString() + ' ' : ". ");
|
||||
}
|
||||
txtHex.Text += "0x" + String.Format("{0:X}", (i + pos) * 16).PadLeft(8, '0') + " " + text.PadRight(52, ' ') + ascii + "\r\n";
|
||||
text = "";
|
||||
ascii = "";
|
||||
}
|
||||
|
||||
br.Close();
|
||||
}
|
||||
|
||||
private void VisorHex_Resize(object sender, EventArgs e)
|
||||
{
|
||||
txtHex.Width = this.Width - 30;
|
||||
Show_Hex(vScrollBar1.Value);
|
||||
}
|
||||
}
|
||||
}
|
145
Tinke/VisorHexBasic.resx
Normal file
145
Tinke/VisorHexBasic.resx
Normal file
@ -0,0 +1,145 @@
|
||||
<?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>
|
||||
<assembly alias="System.Drawing" name="System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
|
||||
<data name="$this.Icon" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||
<value>
|
||||
AAABAAEAEBAAAAAAIABoBAAAFgAAACgAAAAQAAAAIAAAAAEAIAAAAAAAAAQAAAAAAAAAAAAAAAAAAAAA
|
||||
AAD///8A////ALtqNGu6ZTC8u2Yx7bpmMPe6ZjD3umYw97plMPe6ZS/3uWUu97llLve5ZC73uWQu77di
|
||||
LL23Yi5j////AP///wC8aTPe+PHq8vfs3/32697/9ure//bq3P/26tz/+vPr//rz6//68ur//Pfz//z4
|
||||
9P3+/v3wt2Aq1f///wD///8Av3E49fXr3/79v2j//L1n//u+Zf/8vmT//L5k//y9Yv/7vWP/+7xh//y+
|
||||
YP/8vGL//fv4/blkLfP///8A////AMF4PPf37eP//cJu///YoP//157//9ab///XmP//1pb//9aV///V
|
||||
lP//1JP/+75l//v39P+7ZzH3Qj042UhCPNlLPjH+WFRP/7aGQv89MCD/QTUk/zcrG/87LBX/97NS//ez
|
||||
Uv/3slH/97JP//eyT//8+fX/v28292NbVP+nmo3/cGde/0U/Ov+tnJH/XFVO/5aKf/9mXlb/GxkY//zk
|
||||
0f/84s7//OLM//vgyf/74cj//fr3/8F2O/dxaF//wbar/3lwZv9iXFb/uqmc/25mXf+9saX/fnRq/zMu
|
||||
K//95dP//OTR//zizf/74cv/++HJ//v38v/FfD/3dWxj+MS5r/+nmo3/gHpz/9bDtP9sY1z/u6+k/6aY
|
||||
i/9TTUb//eXT//vk0P/748z/+t/H//rfxv/68ur/xoBC92ZeVu9pYVj/Vk9I/01JRv+MgHf/QDs3/0ZC
|
||||
PP89ODP/LCgl//zk0f/74cz/+uDH//ndw//43ML/+vTt/8aCRfc+OTSFW1RN/7CgkP9pXVH/hnRl/2NY
|
||||
Tv+qmIj/WlFK/4V5bv/74cz/+t/H//jcwv/22r3/9ti7//r07//Gg0b3lYl9HWZeVvOFeG//SkE7/5WG
|
||||
ev9WSkD/koN0/09HQP/kz7v/+uDI//jcwv/11rv/89S1//HSs//49PD/xIJG93VsYw+YjICPnI+D/1JM
|
||||
R//Lt6f/VE1H/5CFef+ajH//9d3G//ndxP/22bz/9Onf//fy7P/79/P/9e/p/8J+Rfv///8Akod7Endt
|
||||
Yv91bWX/3ci1/29mXv9sYln/++LL//ngyP/43ML/9da6//37+P/85s3/+uXJ/+K2hP+/eUKm////AP//
|
||||
/wDFiEvq+vby/Prgx//74cn/++LJ//vgyP/538X/+NvB//TWuP//+/j/9ti0/+Gwff/bkmT2tGs+B///
|
||||
/wD///8AxIVJw/fy7Oz49O78+PTt//jz7f/48+3/+PPt//jy7P/38uz/8ubX/+Kyff/blGX1s2g7B///
|
||||
/wD///8A////AMF9RGDIi027yIxP7siMT/bIjE/3yIxP98iNT/fJjE/3x4tP98WJS9TEdjuRs2g8Bv//
|
||||
/wD///8AwAAAAMAAAADAAAAAwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAgAAAAMAA
|
||||
AADAAQAAwAMAAA==
|
||||
</value>
|
||||
</data>
|
||||
</root>
|
12
compile.sh
12
compile.sh
@ -6,20 +6,20 @@ BUILD_DIR="$TINKE_DIR/build"
|
||||
|
||||
# Ask for release or debug configuration
|
||||
echo "Choose the configuration. Press '1' for Release and '2' for Debug: "
|
||||
select rd in "R" "D"; do
|
||||
select rd in "Release" "Debug"; do
|
||||
case $rd in
|
||||
R) CONF="Release"; break;;
|
||||
D) CONF="Debug"; break;;
|
||||
Release) CONF="Release"; break;;
|
||||
Debug) CONF="Debug"; break;;
|
||||
esac
|
||||
done
|
||||
|
||||
# Ask for 64 or 32 bits.
|
||||
echo
|
||||
echo "Choose the platform. Press '1' for x86 or '2' for x64: "
|
||||
select pl in "1" "2"; do
|
||||
select pl in "x86" "x64"; do
|
||||
case $pl in
|
||||
1) PLAT="x86"; break;;
|
||||
2) PLAT="x64"; break;;
|
||||
x86) PLAT="x86"; break;;
|
||||
x64) PLAT="x64"; break;;
|
||||
esac
|
||||
done
|
||||
echo
|
||||
|
Loading…
Reference in New Issue
Block a user