*** Añadido nueva ventana para editar la cabecera y banner de la ROM

* Traducidos mensajes de la clase Compresiones y demás plugins
* Corregidos tamaños de controles para las traducciones
* Documentado plugin SDAT y limpieza de código
* Añadida opción importar archivos WAV -> STRM en SDAT
* Añadido indicador de codificación UTF-8 0xBBEF
* Solucionado problema al extraer archivos descomprimidos (elegir entre carpeta o archivo)
This commit is contained in:
Benito Palacios 2011-08-16 13:12:00 +00:00
parent 402149d05e
commit cc7733f230
66 changed files with 3094 additions and 833 deletions

View File

@ -3,60 +3,19 @@ using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.IO;
using System.Xml.Linq;
namespace Compresion
{
public static class Basico
{
const int N = 4096, F = 18;
const byte THRESHOLD = 2;
const int NIL = N;
const int LZ77_TAG = 0x10, LZSS_TAG = 0x11, RLE_TAG = 0x30, HUFF_TAG = 0x20, NONE_TAG = 0x00;
#region method: DecompressFolder
public static void DecompressFolder(string inflr, string outflr)
{
if (!outflr.EndsWith("/") && !outflr.EndsWith("\\"))
outflr += "/";
StreamWriter sw = null;
if (!Directory.Exists(inflr))
{
Console.WriteLine("No such file or folder: " + inflr);
return;
}
string[] files = Directory.GetFiles(inflr);
foreach (string fname in files)
try
{
Decompress(Utils.makeSlashes(fname), outflr);
}
catch (Exception e)
{
if (sw == null)
sw = new StreamWriter(new FileStream(outflr + "lzsslog.txt", FileMode.Create));
Console.WriteLine(e.Message);
sw.WriteLine(e.Message);
string copied = fname.Replace(inflr, outflr);
if (!File.Exists(copied))
File.Copy(fname, copied);
}
Console.WriteLine("Done decompressing files in folder " + inflr);
if (sw != null)
{
Console.WriteLine("Errors have been logged to " + outflr + "lzsslog.txt");
sw.Flush();
sw.Close();
}
}
#endregion
#region Method: Decompress
public static void Decompress(string filein, string fileout)
{
FileStream fstr = File.OpenRead(filein);
if (fstr.Length > int.MaxValue)
throw new Exception("Files larger than " + int.MaxValue.ToString() + " cannot be decompressed by this program.");
throw new Exception(ObtenerTraduccion("Compression").Element("S00").Value);
BinaryReader br = new BinaryReader(fstr);
byte tag = br.ReadByte();
@ -82,7 +41,7 @@ namespace Compresion
}
catch (Exception e)
{
Console.WriteLine("Could not properly decompress {0:s};", filein);
Console.WriteLine(ObtenerTraduccion("Compression").Element("S15").Value, filein);
Console.WriteLine(e.Message);
Console.WriteLine(e.StackTrace);
}
@ -91,7 +50,7 @@ namespace Compresion
{
FileStream fstr = File.OpenRead(filein);
if (fstr.Length > int.MaxValue)
throw new Exception("Files larger than " + int.MaxValue.ToString() + " cannot be decompressed by this program.");
throw new Exception(ObtenerTraduccion("Compression").Element("S00").Value);
BinaryReader br = new BinaryReader(fstr);
br.BaseStream.Seek(0x4, SeekOrigin.Begin); // A veces la etiqueta está en la posición 0x4
@ -118,11 +77,30 @@ namespace Compresion
}
catch (Exception e)
{
Console.WriteLine("Could not properly decompress {0:s};", filein);
Console.WriteLine(ObtenerTraduccion("Compression").Element("S15").Value, filein);
Console.WriteLine(e.Message);
Console.WriteLine(e.StackTrace);
}
}
#endregion
internal static XElement ObtenerTraduccion(string arbol)
{
XElement xml = XElement.Load(System.Windows.Forms.Application.StartupPath + Path.DirectorySeparatorChar + "Tinke.xml");
string idioma = xml.Element("Options").Element("Language").Value;
xml = null;
foreach (string langFile in Directory.GetFiles(System.Windows.Forms.Application.StartupPath + Path.DirectorySeparatorChar + "langs"))
{
if (!langFile.EndsWith(".xml"))
continue;
xml = XElement.Load(langFile);
if (xml.Attribute("name").Value == idioma)
break;
}
return xml.Element(arbol);
}
}
}

View File

@ -37,6 +37,7 @@
</Reference>
<Reference Include="System" />
<Reference Include="System.Core" />
<Reference Include="System.Windows.Forms" />
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="System.Data" />

View File

@ -8,13 +8,8 @@ namespace Compresion
{
public static class Huffman
{
const int N = 4096, F = 18;
const byte THRESHOLD = 2;
const int NIL = N;
const int LZ77_TAG = 0x10, LZSS_TAG = 0x11, RLE_TAG = 0x30, HUFF_TAG = 0x20, NONE_TAG = 0x00;
#region Huffman
public static void DecompressHuffman(String filename, String fileout)
{
/*
@ -36,7 +31,7 @@ namespace Compresion
Compressed Bitstream (stored in units of 32bits)
Bit0-31 Node Bits (Bit31=First Bit) (0=Node0, 1=Node1)
*/
System.Xml.Linq.XElement xml = Basico.ObtenerTraduccion("Compression");
BinaryReader br = new BinaryReader(File.OpenRead(filename));
byte firstByte = br.ReadByte();
@ -47,11 +42,11 @@ namespace Compresion
{
br.BaseStream.Seek(0x4, SeekOrigin.Begin);
if (br.ReadByte() != HUFF_TAG)
throw new InvalidDataException(String.Format("Invalid huffman comressed file; invalid tag {0:x}", firstByte));
throw new InvalidDataException(String.Format(xml.Element("S08").Value, firstByte));
}
if (dataSize != 8 && dataSize != 4)
throw new InvalidDataException(String.Format("Unhandled dataSize {0:x}", dataSize));
throw new InvalidDataException(String.Format(xml.Element("S09").Value, dataSize));
int decomp_size = 0;
for (int i = 0; i < 3; i++)
@ -59,7 +54,7 @@ namespace Compresion
decomp_size |= br.ReadByte() << (i * 8);
}
#region Descompresión
#region Decompress
byte treeSize = br.ReadByte();
HuffTreeNode.maxInpos = 4 + (treeSize + 1) * 2;
@ -88,7 +83,7 @@ namespace Compresion
}
catch (IndexOutOfRangeException e)
{
throw new IndexOutOfRangeException("not enough data.", e);
throw new IndexOutOfRangeException(xml.Element("S0A").Value, e);
}
while (codestr.Length > 0)
{
@ -115,7 +110,7 @@ namespace Compresion
codestr += Utils.uint_to_bits(indata[++idx]);
codestr = codestr.Replace("0", "");
if (codestr.Length > 0)
Console.WriteLine("too much data; str={0:s}, idx={1:g}/{2:g}", codestr, idx, indata.Length);
Console.WriteLine(xml.Element("S0B").Value, codestr, idx, indata.Length);
}
byte[] realout;
@ -126,7 +121,7 @@ namespace Compresion
{
if ((outdata[i * 2] & 0xF0) > 0
|| (outdata[i * 2 + 1] & 0xF0) > 0)
throw new Exception("first 4 bits of data should be 0 if dataSize = 4");
throw new Exception(xml.Element("S0C").Value);
realout[i] = (byte)((outdata[i * 2] << 4) | outdata[i * 2 + 1]);
}
}
@ -141,12 +136,10 @@ namespace Compresion
bw.Flush();
bw.Close();
Console.WriteLine("Huffman decompressed {0:s}", filename);
Console.WriteLine(xml.Element("S0D").Value, filename);
br.Close();
}
#endregion
}
class HuffTreeNode

View File

@ -5,21 +5,17 @@ using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.IO;
using System.Xml.Linq;
namespace Compresion
{
public static class LZ77
{
static int MAX_OUTSIZE = 0x200000;
const int N = 4096, F = 18;
const byte THRESHOLD = 2;
const int NIL = N;
static bool showAlways = true;
const int LZ77_TAG = 0x10, LZSS_TAG = 0x11, RLE_TAG = 0x30, HUFF_TAG = 0x20, NONE_TAG = 0x00;
#region tag 0x10 LZ77
public static void DecompressLZ77(string filein, string fileout)
{
/* Data header (32bit)
@ -36,9 +32,11 @@ namespace Compresion
Bit 4-7 Number of bytes to copy (minus 3)
Bit 8-15 Disp LSBs
*/
XElement xml = Basico.ObtenerTraduccion("Compression");
FileStream fstr = new FileStream(filein, FileMode.Open);
if (fstr.Length > int.MaxValue)
throw new Exception("Archivos más grandes de 2GB no pueden ser archivos RLE-comprimidos.");
throw new Exception(xml.Element("S00").Value);
BinaryReader br = new BinaryReader(fstr);
long decomp_size = 0, curr_size = 0;
@ -51,20 +49,20 @@ namespace Compresion
{
br.BaseStream.Seek(0x4, SeekOrigin.Begin);
if (br.ReadByte() != LZ77_TAG)
throw new InvalidDataException(String.Format("El archivo {0:s} no es un archivo LZ77 válido", filein));
throw new InvalidDataException(String.Format(xml.Element("S01").Value, filein));
}
for (i = 0; i < 3; i++)
decomp_size += br.ReadByte() << (i * 8);
if (decomp_size > MAX_OUTSIZE)
throw new Exception(String.Format("{0:s} será más largo que 0x{1:x} (0x{2:x}) y no puede ser descomprimido.", filein, MAX_OUTSIZE, decomp_size));
throw new Exception(String.Format(xml.Element("S02").Value, filein, MAX_OUTSIZE, decomp_size));
else if (decomp_size == 0)
for (i = 0; i < 4; i++)
decomp_size += br.ReadByte() << (i * 8);
if (decomp_size > MAX_OUTSIZE << 8)
throw new Exception(String.Format("{0:s} será más largo que 0x{1:x} (0x{2:x}) y no puede ser descomprimido.", filein, MAX_OUTSIZE, decomp_size));
throw new Exception(String.Format(xml.Element("S02").Value, filein, MAX_OUTSIZE, decomp_size));
if (showAlways)
Console.WriteLine("Descomprimiendo {0:s}. (outsize: 0x{1:x})", filein, decomp_size);
Console.WriteLine(xml.Element("S03").Value, filein, decomp_size);
#region decompress
@ -81,39 +79,28 @@ namespace Compresion
{
disp = 0;
try { b = br.ReadByte(); }
catch (EndOfStreamException) { throw new Exception("Datos incompletos"); }
catch (EndOfStreamException) { throw new Exception(xml.Element("S04").Value); }
n = b >> 4;
disp = (b & 0x0F) << 8;
try { disp |= br.ReadByte(); }
catch (EndOfStreamException) { throw new Exception("Datos incompletos"); }
catch (EndOfStreamException) { throw new Exception(xml.Element("S04").Value); }
n += 3;
cdest = curr_size;
//Console.WriteLine("disp: 0x{0:x}", disp);
if (disp > curr_size)
throw new Exception("Cannot go back more than already written");
throw new Exception(xml.Element("S05").Value);
for (j = 0; j < n; j++)
outdata[curr_size++] = outdata[cdest - disp - 1 + j];
//curr_size += len;
if (curr_size > decomp_size)
{
//throw new Exception(String.Format("File {0:s} is not a valid LZ77 file; actual output size > output size in header", filein));
//Console.WriteLine(String.Format("File {0:s} is not a valid LZ77 file; actual output size > output size in header; {1:x} > {2:x}.", filein, curr_size, decomp_size));
break;
}
}
else
{
try { b = br.ReadByte(); }
catch (EndOfStreamException) { break; }// throw new Exception("Incomplete data"); }
catch (EndOfStreamException) { break; }
try { outdata[curr_size++] = b; }
catch (IndexOutOfRangeException) { if (b == 0) break; }
//curr_size++;
if (curr_size > decomp_size)
{
//throw new Exception(String.Format("File {0:s} is not a valid LZ77 file; actual output size > output size in header", filein));
//Console.WriteLine(String.Format("File {0:s} is not a valid LZ77 file; actual output size > output size in header; {1:x} > {2:x}", filein, curr_size, decomp_size));
break;
}
}
}
@ -122,7 +109,7 @@ namespace Compresion
try
{
while (br.ReadByte() == 0) { } // if we read a non-zero, print that there is still some data
Console.WriteLine("Too many data in file; current INPOS = {0:x}", br.BaseStream.Position - 1);
Console.WriteLine(xml.Element("S06").Value, br.BaseStream.Position - 1);
}
catch (EndOfStreamException) { }
@ -137,10 +124,9 @@ namespace Compresion
fstr.Close();
fstr.Dispose();
Console.WriteLine("LZ77 Descomprimido " + filein);
Console.WriteLine(xml.Element("S07").Value,filein);
}
#endregion
}
}

View File

@ -9,14 +9,10 @@ namespace Compresion
public static class LZSS
{
static int MAX_OUTSIZE = 0x200000;
const int N = 4096, F = 18;
const byte THRESHOLD = 2;
const int NIL = N;
static bool showAlways = true;
const int LZ77_TAG = 0x10, LZSS_TAG = 0x11, RLE_TAG = 0x30, HUFF_TAG = 0x20, NONE_TAG = 0x00;
#region tag 0x11 LZSS
public static void Decompress11LZS(string filein, string fileout)
{
/* Data header (32bit)
@ -47,9 +43,10 @@ namespace Compresion
Bit 12-23 Disp
*/
System.Xml.Linq.XElement xml = Basico.ObtenerTraduccion("Compression");
FileStream fstr = new FileStream(filein, FileMode.Open);
if (fstr.Length > int.MaxValue)
throw new Exception("Filer larger than 2GB cannot be LZSS-compressed files.");
throw new Exception(xml.Element("S00").Value);
BinaryReader br = new BinaryReader(fstr);
int decomp_size = 0, curr_size = 0;
@ -64,20 +61,20 @@ namespace Compresion
{
br.BaseStream.Seek(0x4, SeekOrigin.Begin);
if (br.ReadByte() != LZSS_TAG)
throw new InvalidDataException(String.Format("File {0:s} is not a valid LZSS-11 file", filein));
throw new InvalidDataException(String.Format(xml.Element("S0E").Value, filein));
}
for (i = 0; i < 3; i++)
decomp_size += br.ReadByte() << (i * 8);
if (decomp_size > MAX_OUTSIZE)
throw new Exception(String.Format("{0:s} will be larger than 0x{1:x} (0x{2:x}) and will not be decompressed.", filein, MAX_OUTSIZE, decomp_size));
throw new Exception(String.Format(xml.Element("S02").Value, filein, MAX_OUTSIZE, decomp_size));
else if (decomp_size == 0)
for (i = 0; i < 4; i++)
decomp_size += br.ReadByte() << (i * 8);
if (decomp_size > MAX_OUTSIZE << 8)
throw new Exception(String.Format("{0:s} will be larger than 0x{1:x} (0x{2:x}) and will not be decompressed.", filein, MAX_OUTSIZE, decomp_size));
throw new Exception(String.Format(xml.Element("S02").Value, filein, MAX_OUTSIZE, decomp_size));
if (showAlways)
Console.WriteLine("Decompressing {0:s}. (outsize: 0x{1:x})", filein, decomp_size);
Console.WriteLine(xml.Element("S03").Value, filein, decomp_size);
byte[] outdata = new byte[decomp_size];
@ -94,7 +91,7 @@ namespace Compresion
if (flag)
{
try { b1 = br.ReadByte(); }
catch (EndOfStreamException) { throw new Exception("Incomplete data"); }
catch (EndOfStreamException) { throw new Exception(xml.Element("S04").Value); }
switch (b1 >> 4)
{
@ -107,13 +104,13 @@ namespace Compresion
len = b1 << 4;
try { bt = br.ReadByte(); }
catch (EndOfStreamException) { throw new Exception("Incomplete data"); }
catch (EndOfStreamException) { throw new Exception(xml.Element("S04").Value); }
len |= bt >> 4;
len += 0x11;
disp = (bt & 0x0F) << 8;
try { b2 = br.ReadByte(); }
catch (EndOfStreamException) { throw new Exception("Incomplete data"); }
catch (EndOfStreamException) { throw new Exception(xml.Element("S04").Value); }
disp |= b2;
break;
#endregion
@ -127,7 +124,7 @@ namespace Compresion
// 10 04 92 3F => disp = 0x23F, len = 0x149 + 0x11 = 0x15A
try { bt = br.ReadByte(); b2 = br.ReadByte(); b3 = br.ReadByte(); }
catch (EndOfStreamException) { throw new Exception("Incomplete data"); }
catch (EndOfStreamException) { throw new Exception(xml.Element("S04").Value); }
len = (b1 & 0xF) << 12; // len = b000
len |= bt << 4; // len = bcd0
@ -149,14 +146,14 @@ namespace Compresion
disp = (b1 & 0x0F) << 8;
try { b2 = br.ReadByte(); }
catch (EndOfStreamException) { throw new Exception("Incomplete data"); }
catch (EndOfStreamException) { throw new Exception(xml.Element("S04").Value); }
disp |= b2;
break;
#endregion
}
if (disp > curr_size)
throw new Exception("Cannot go back more than already written");
throw new Exception(xml.Element("S05").Value);
cdest = curr_size;
@ -165,20 +162,16 @@ namespace Compresion
if (curr_size > decomp_size)
{
//throw new Exception(String.Format("File {0:s} is not a valid LZ77 file; actual output size > output size in header", filein));
//Console.WriteLine(String.Format("File {0:s} is not a valid LZ77 file; actual output size > output size in header; {1:x} > {2:x}.", filein, curr_size, decomp_size));
break;
}
}
else
{
try { outdata[curr_size++] = br.ReadByte(); }
catch (EndOfStreamException) { break; }// throw new Exception("Incomplete data"); }
catch (EndOfStreamException) { break; }
if (curr_size > decomp_size)
{
//throw new Exception(String.Format("File {0:s} is not a valid LZ77 file; actual output size > output size in header", filein));
//Console.WriteLine(String.Format("File {0:s} is not a valid LZ77 file; actual output size > output size in header; {1:x} > {2:x}", filein, curr_size, decomp_size));
break;
}
}
@ -189,7 +182,7 @@ namespace Compresion
try
{
while (br.ReadByte() == 0) { } // if we read a non-zero, print that there is still some data
Console.WriteLine("Too much data in file; current INPOS = {0:x}", br.BaseStream.Position - 1);
Console.WriteLine(xml.Element("S06").Value, br.BaseStream.Position - 1);
}
catch (EndOfStreamException) { }
@ -202,9 +195,7 @@ namespace Compresion
fstr.Close();
fstr.Dispose();
Console.WriteLine("LZSS-11 Decompressed " + filein);
Console.WriteLine(xml.Element("S0F").Value, filein);
}
#endregion
}
}

View File

@ -8,18 +8,14 @@ namespace Compresion
{
public static class None
{
const int N = 4096, F = 18;
const byte THRESHOLD = 2;
const int NIL = N;
const int LZ77_TAG = 0x10, LZSS_TAG = 0x11, RLE_TAG = 0x30, HUFF_TAG = 0x20, NONE_TAG = 0x00;
#region None
public static void DecompressNone(string filein, string outflr)
public static void DecompressNone(string filein, string fileout)
{
System.Xml.Linq.XElement xml = Basico.ObtenerTraduccion("Compression");
FileStream fstr = new FileStream(filein, FileMode.Open);
if (fstr.Length > int.MaxValue)
throw new Exception("Filer larger than 2GB cannot be NONE-compressed files.");
throw new Exception(xml.Element("S00").Value);
BinaryReader br = new BinaryReader(fstr);
long decomp_size = 0;
@ -29,48 +25,24 @@ namespace Compresion
{
br.BaseStream.Seek(0x4, SeekOrigin.Begin);
if (br.ReadByte() != NONE_TAG)
throw new InvalidDataException(String.Format("File {0:s} is not a valid NONE file, it does not have the NONE-tag as first byte", filein));
throw new InvalidDataException(String.Format(xml.Element("S12").Value, filein));
}
for (i = 0; i < 3; i++)
decomp_size += br.ReadByte() << (i * 8);
if (decomp_size != fstr.Length - 0x04)
throw new InvalidDataException("File {0:s} is not a valid NONE file, the decompression size shold be the file size - 4");
#region save
string ext = "";
char c;
for (i = 0; i < 4; i++)
if (char.IsLetterOrDigit(c = (char)br.ReadByte()))
ext += c;
else
break;
if (ext.Length == 0)
ext = "dat";
ext = "." + ext;
br.BaseStream.Position -= i == 4 ? 4 : i + 1;
filein = filein.Replace("\\", "/");
outflr = outflr.Replace("\\", "/");
string outfname = filein.Substring(filein.LastIndexOf("/") + 1);
outfname = outfname.Substring(0, outfname.LastIndexOf('.'));
if (!outflr.EndsWith("/"))
outflr += "/";
while (File.Exists(outflr + outfname + ext))
outfname += "_";
BinaryWriter bw = new BinaryWriter(new FileStream(outflr + outfname + ext, FileMode.CreateNew));
throw new InvalidDataException(xml.Element("S13").Value);
BinaryWriter bw = new BinaryWriter(new FileStream(fileout, FileMode.Create));
bw.Write(br.ReadBytes((int)decomp_size));
bw.Flush();
bw.Close();
#endregion
br.Close();
fstr.Close();
fstr.Dispose();
Console.WriteLine("NONE-decompressed {0:s}", filein);
Console.WriteLine(xml.Element("S14").Value, filein);
}
#endregion
}
}

View File

@ -6,7 +6,7 @@ using System.Runtime.InteropServices;
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("Compresiones")]
[assembly: AssemblyDescription("Soporte a compresiones LZ77, LZSS, Huffman y RLE")]
[assembly: AssemblyDescription("Compression LZ77, LZSS, Huffman y RLE")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("Tinke")]
@ -32,5 +32,5 @@ using System.Runtime.InteropServices;
// 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("1.5.0.0")]
[assembly: AssemblyFileVersion("1.5.0.0")]
[assembly: AssemblyVersion("1.6.0.0")]
[assembly: AssemblyFileVersion("1.6.0.0")]

View File

@ -9,14 +9,10 @@ namespace Compresion
public static class RLE
{
static int MAX_OUTSIZE = 0x200000;
const int N = 4096, F = 18;
const byte THRESHOLD = 2;
const int NIL = N;
static bool showAlways = true;
const int LZ77_TAG = 0x10, LZSS_TAG = 0x11, RLE_TAG = 0x30, HUFF_TAG = 0x20, NONE_TAG = 0x00;
#region RLE
public static void DecompressRLE(string filein, string fileout)
{
/* SWI 14h (GBA/NDS7/NDS9) - RLUnCompWram
@ -40,9 +36,10 @@ namespace Compresion
Return: No return value, Data written to destination address.*/
System.Xml.Linq.XElement xml = Basico.ObtenerTraduccion("Compression");
FileStream fstr = new FileStream(filein, FileMode.Open);
if (fstr.Length > int.MaxValue)
throw new Exception("Files larger than 2GB cannot be RLE-compressed files.");
throw new Exception(xml.Element("S00").Value);
BinaryReader br = new BinaryReader(fstr);
long decomp_size = 0, curr_size = 0;
@ -54,15 +51,15 @@ namespace Compresion
{
br.BaseStream.Seek(0x4, SeekOrigin.Begin);
if (br.ReadByte() != RLE_TAG)
throw new InvalidDataException(String.Format("File {0:s} is not a valid RLE file", filein));
throw new InvalidDataException(String.Format(xml.Element("S10").Value, filein));
}
for (i = 0; i < 3; i++)
decomp_size += br.ReadByte() << (i * 8);
if (decomp_size > MAX_OUTSIZE)
throw new Exception(String.Format("{0:s} will be larger than 0x{1:x} and will not be decompressed.", filein, MAX_OUTSIZE));
throw new Exception(String.Format(xml.Element("S02").Value, filein, MAX_OUTSIZE));
if (showAlways)
Console.WriteLine("Decompressing {0:s}. (outsize: 0x{1:x})", filein, decomp_size);
Console.WriteLine(xml.Element("S03").Value, filein, decomp_size);
#region decompress
byte[] outdata = new byte[decomp_size];
@ -111,9 +108,8 @@ namespace Compresion
fstr.Close();
fstr.Dispose();
Console.WriteLine("RLE decompressed " + filein);
Console.WriteLine(xml.Element("S11").Value, filein);
}
#endregion
}
}

View File

@ -9,7 +9,6 @@ namespace Compresion
public static class Utils
{
#region helper methods
public static string byte_to_bits(byte b)
{
string o = "";
@ -48,6 +47,5 @@ namespace Compresion
}
return sbout.ToString();
}
#endregion
}
}

View File

@ -48,6 +48,7 @@
//
// pictureBox1
//
this.pictureBox1.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
this.pictureBox1.Location = new System.Drawing.Point(5, 295);
this.pictureBox1.Name = "pictureBox1";
this.pictureBox1.Size = new System.Drawing.Size(256, 215);
@ -68,7 +69,7 @@
this.btnSave.Image = global::LAYTON.Properties.Resources.picture_save;
this.btnSave.Location = new System.Drawing.Point(268, 434);
this.btnSave.Name = "btnSave";
this.btnSave.Size = new System.Drawing.Size(89, 34);
this.btnSave.Size = new System.Drawing.Size(117, 34);
this.btnSave.TabIndex = 5;
this.btnSave.Text = "S03";
this.btnSave.TextImageRelation = System.Windows.Forms.TextImageRelation.ImageBeforeText;
@ -80,7 +81,7 @@
this.btnSaveAni.Image = global::LAYTON.Properties.Resources.picture_go;
this.btnSaveAni.Location = new System.Drawing.Point(268, 474);
this.btnSaveAni.Name = "btnSaveAni";
this.btnSaveAni.Size = new System.Drawing.Size(89, 34);
this.btnSaveAni.Size = new System.Drawing.Size(117, 34);
this.btnSaveAni.TabIndex = 6;
this.btnSaveAni.Text = "S04";
this.btnSaveAni.TextImageRelation = System.Windows.Forms.TextImageRelation.ImageBeforeText;

View File

@ -48,7 +48,7 @@
this.btnSave.Image = global::LAYTON.Properties.Resources.picture_save;
this.btnSave.Location = new System.Drawing.Point(4, 462);
this.btnSave.Name = "btnSave";
this.btnSave.Size = new System.Drawing.Size(100, 45);
this.btnSave.Size = new System.Drawing.Size(130, 45);
this.btnSave.TabIndex = 1;
this.btnSave.Text = "S03";
this.btnSave.TextImageRelation = System.Windows.Forms.TextImageRelation.ImageBeforeText;

View File

@ -67,7 +67,7 @@
// lblNPartes
//
this.lblNPartes.AutoSize = true;
this.lblNPartes.Location = new System.Drawing.Point(4, 61);
this.lblNPartes.Location = new System.Drawing.Point(1, 58);
this.lblNPartes.Name = "lblNPartes";
this.lblNPartes.Size = new System.Drawing.Size(26, 13);
this.lblNPartes.TabIndex = 37;
@ -75,9 +75,9 @@
//
// txtNPartes
//
this.txtNPartes.Location = new System.Drawing.Point(60, 58);
this.txtNPartes.Location = new System.Drawing.Point(100, 55);
this.txtNPartes.Name = "txtNPartes";
this.txtNPartes.Size = new System.Drawing.Size(100, 20);
this.txtNPartes.Size = new System.Drawing.Size(60, 20);
this.txtNPartes.TabIndex = 38;
//
// lblTamanoImg
@ -91,16 +91,16 @@
//
// txtTamanoImg
//
this.txtTamanoImg.Location = new System.Drawing.Point(240, 3);
this.txtTamanoImg.Location = new System.Drawing.Point(280, 3);
this.txtTamanoImg.Name = "txtTamanoImg";
this.txtTamanoImg.Size = new System.Drawing.Size(100, 20);
this.txtTamanoImg.Size = new System.Drawing.Size(60, 20);
this.txtTamanoImg.TabIndex = 46;
//
// txtImgs
//
this.txtImgs.Location = new System.Drawing.Point(60, 3);
this.txtImgs.Location = new System.Drawing.Point(100, 3);
this.txtImgs.Name = "txtImgs";
this.txtImgs.Size = new System.Drawing.Size(100, 20);
this.txtImgs.Size = new System.Drawing.Size(60, 20);
this.txtImgs.TabIndex = 40;
//
// lblImgs
@ -115,7 +115,7 @@
// lblAncho
//
this.lblAncho.AutoSize = true;
this.lblAncho.Location = new System.Drawing.Point(3, 36);
this.lblAncho.Location = new System.Drawing.Point(1, 32);
this.lblAncho.Name = "lblAncho";
this.lblAncho.Size = new System.Drawing.Size(26, 13);
this.lblAncho.TabIndex = 41;
@ -123,15 +123,15 @@
//
// txtAlto
//
this.txtAlto.Location = new System.Drawing.Point(240, 29);
this.txtAlto.Location = new System.Drawing.Point(280, 29);
this.txtAlto.Name = "txtAlto";
this.txtAlto.Size = new System.Drawing.Size(100, 20);
this.txtAlto.Size = new System.Drawing.Size(60, 20);
this.txtAlto.TabIndex = 43;
//
// lblAlto
//
this.lblAlto.AutoSize = true;
this.lblAlto.Location = new System.Drawing.Point(168, 32);
this.lblAlto.Location = new System.Drawing.Point(166, 32);
this.lblAlto.Name = "lblAlto";
this.lblAlto.Size = new System.Drawing.Size(26, 13);
this.lblAlto.TabIndex = 44;
@ -139,15 +139,15 @@
//
// txtAncho
//
this.txtAncho.Location = new System.Drawing.Point(62, 29);
this.txtAncho.Location = new System.Drawing.Point(100, 29);
this.txtAncho.Name = "txtAncho";
this.txtAncho.Size = new System.Drawing.Size(100, 20);
this.txtAncho.Size = new System.Drawing.Size(60, 20);
this.txtAncho.TabIndex = 42;
//
// lblName
//
this.lblName.AutoSize = true;
this.lblName.Location = new System.Drawing.Point(168, 61);
this.lblName.Location = new System.Drawing.Point(166, 58);
this.lblName.Name = "lblName";
this.lblName.Size = new System.Drawing.Size(26, 13);
this.lblName.TabIndex = 48;
@ -155,9 +155,9 @@
//
// txtName
//
this.txtName.Location = new System.Drawing.Point(240, 58);
this.txtName.Location = new System.Drawing.Point(280, 55);
this.txtName.Name = "txtName";
this.txtName.Size = new System.Drawing.Size(100, 20);
this.txtName.Size = new System.Drawing.Size(60, 20);
this.txtName.TabIndex = 49;
//
// InfoImage

View File

@ -112,9 +112,9 @@
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
<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=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
</root>

View File

@ -58,7 +58,7 @@
//
// txtAltoP
//
this.txtAltoP.Location = new System.Drawing.Point(250, 30);
this.txtAltoP.Location = new System.Drawing.Point(249, 27);
this.txtAltoP.Name = "txtAltoP";
this.txtAltoP.Size = new System.Drawing.Size(75, 20);
this.txtAltoP.TabIndex = 42;
@ -75,7 +75,7 @@
// lblAltoP
//
this.lblAltoP.AutoSize = true;
this.lblAltoP.Location = new System.Drawing.Point(182, 34);
this.lblAltoP.Location = new System.Drawing.Point(182, 30);
this.lblAltoP.Name = "lblAltoP";
this.lblAltoP.Size = new System.Drawing.Size(26, 13);
this.lblAltoP.TabIndex = 41;
@ -108,7 +108,7 @@
//
// txtPosY
//
this.txtPosY.Location = new System.Drawing.Point(249, 56);
this.txtPosY.Location = new System.Drawing.Point(249, 53);
this.txtPosY.Name = "txtPosY";
this.txtPosY.Size = new System.Drawing.Size(75, 20);
this.txtPosY.TabIndex = 44;
@ -123,7 +123,7 @@
// lblPosY
//
this.lblPosY.AutoSize = true;
this.lblPosY.Location = new System.Drawing.Point(182, 58);
this.lblPosY.Location = new System.Drawing.Point(182, 56);
this.lblPosY.Name = "lblPosY";
this.lblPosY.Size = new System.Drawing.Size(26, 13);
this.lblPosY.TabIndex = 46;
@ -132,7 +132,7 @@
// lblPosX
//
this.lblPosX.AutoSize = true;
this.lblPosX.Location = new System.Drawing.Point(3, 59);
this.lblPosX.Location = new System.Drawing.Point(3, 58);
this.lblPosX.Name = "lblPosX";
this.lblPosX.Size = new System.Drawing.Size(26, 13);
this.lblPosX.TabIndex = 47;

View File

@ -112,9 +112,9 @@
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
<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=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
</root>

View File

@ -59,10 +59,10 @@
//
// txtNImgs
//
this.txtNImgs.Location = new System.Drawing.Point(234, 19);
this.txtNImgs.Location = new System.Drawing.Point(277, 19);
this.txtNImgs.Name = "txtNImgs";
this.txtNImgs.ReadOnly = true;
this.txtNImgs.Size = new System.Drawing.Size(100, 20);
this.txtNImgs.Size = new System.Drawing.Size(80, 20);
this.txtNImgs.TabIndex = 42;
//
// groupBox1
@ -100,10 +100,10 @@
//
// txtTipo
//
this.txtTipo.Location = new System.Drawing.Point(43, 19);
this.txtTipo.Location = new System.Drawing.Point(81, 19);
this.txtTipo.Name = "txtTipo";
this.txtTipo.ReadOnly = true;
this.txtTipo.Size = new System.Drawing.Size(100, 20);
this.txtTipo.Size = new System.Drawing.Size(80, 20);
this.txtTipo.TabIndex = 44;
//
// InfoPicture

View File

@ -112,9 +112,9 @@
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
<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=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
</root>

View File

@ -1,6 +1,6 @@

Microsoft Visual Studio Solution File, Format Version 11.00
# Visual C# Express 2010
# Visual Studio 2010
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SDAT", "SDAT\SDAT.csproj", "{2194A598-DFC2-4C02-B60E-3D21367E81C2}"
EndProject
Global

View File

@ -1,5 +1,5 @@
/*
* Copyright (C) 2011 rafael1193
* Copyright (C) 2011
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@ -16,8 +16,6 @@
*
* Programador: rafael1193, pleonex
*
* Fecha: 16/07/2011
*
*/
using System;
using System.Collections.Generic;
@ -26,9 +24,17 @@ using System.Text;
namespace SDAT
{
internal static class AdpcmDecompressor
/// <summary>
/// Operations with the AD-PCM compression
/// </summary>
public static class Compression_ADPCM
{
public static byte[] DecompressADPCM(byte[] data)
/// <summary>
/// Decompress an array data of bytes using AD-PCM compression
/// </summary>
/// <param name="data">Data to be decompress</param>
/// <returns>Data decompressed</returns>
public static byte[] Decompress_ADPCM(byte[] data)
{
List<byte> resul = new List<byte>();
@ -88,7 +94,13 @@ namespace SDAT
return resul.ToArray();
}
/// <summary>
/// Decompress a block of bytes (used in the STRM data)
/// </summary>
/// <param name="data">Bytes to be decompressed</param>
/// <param name="sample"></param>
/// <param name="stepindex"></param>
/// <returns>Bytes decompressed</returns>
public static byte[] DecompressBlock_ADPCM(byte[] datos, int sample = 0, int stepindex = 0)
{
if (datos.Length < 4)
@ -121,7 +133,7 @@ namespace SDAT
#endregion
byte[] data = new byte[datos.Length - 4];
Array.Copy(datos, 4, data, 0, datos.Length - 4);
Array.Copy(datos, 4, data, 0, data.Length);
data = Bit8ToBit4(data);
int difference, newSample = sample;
@ -160,7 +172,7 @@ namespace SDAT
}
static byte[] Bit8ToBit4(byte[] data)
private static byte[] Bit8ToBit4(byte[] data)
{
List<byte> bit4 = new List<byte>();

View File

@ -27,11 +27,11 @@ using System.Runtime.InteropServices;
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("SDAT")]
[assembly: AssemblyDescription("Archivos de sonido SDAT")]
[assembly: AssemblyDescription("Sound files SDAT")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("Tinke")]
[assembly: AssemblyCopyright("Copyright © 2011")]
[assembly: AssemblyCopyright("rafael1193, pleoNeX")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]

View File

@ -0,0 +1,70 @@
//------------------------------------------------------------------------------
// <auto-generated>
// Este código fue generado por una herramienta.
// Versión de runtime:4.0.30319.235
//
// Los cambios en este archivo podrían causar un comportamiento incorrecto y se perderán si
// se vuelve a generar el código.
// </auto-generated>
//------------------------------------------------------------------------------
namespace SDAT.Properties {
using System;
/// <summary>
/// Clase de recurso con establecimiento inflexible de tipos, para buscar cadenas traducidas, etc.
/// </summary>
// StronglyTypedResourceBuilder generó automáticamente esta clase
// a través de una herramienta como ResGen o Visual Studio.
// Para agregar o quitar un miembro, edite el archivo .ResX y, a continuación, vuelva a ejecutar ResGen
// con la opción /str o vuelva a generar su proyecto de VS.
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
internal class Resources {
private static global::System.Resources.ResourceManager resourceMan;
private static global::System.Globalization.CultureInfo resourceCulture;
[global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
internal Resources() {
}
/// <summary>
/// Devuelve la instancia de ResourceManager almacenada en caché utilizada por esta clase.
/// </summary>
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
internal static global::System.Resources.ResourceManager ResourceManager {
get {
if (object.ReferenceEquals(resourceMan, null)) {
global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("SDAT.Properties.Resources", typeof(Resources).Assembly);
resourceMan = temp;
}
return resourceMan;
}
}
/// <summary>
/// Reemplaza la propiedad CurrentUICulture del subproceso actual para todas las
/// búsquedas de recursos mediante esta clase de recurso con establecimiento inflexible de tipos.
/// </summary>
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
internal static global::System.Globalization.CultureInfo Culture {
get {
return resourceCulture;
}
set {
resourceCulture = value;
}
}
internal static System.Drawing.Bitmap sound_add {
get {
object obj = ResourceManager.GetObject("sound_add", resourceCulture);
return ((System.Drawing.Bitmap)(obj));
}
}
}
}

View File

@ -0,0 +1,124 @@
<?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.Windows.Forms" name="System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
<data name="sound_add" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\sound_add.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
</root>

Binary file not shown.

After

Width:  |  Height:  |  Size: 684 B

View File

@ -15,8 +15,6 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* Programador: pleoNeX
* Programa utilizado: Visual Studio 2010
* Fecha: 24/06/2011
*
*/
using System;
@ -57,13 +55,14 @@ namespace SDAT
{
this.archivo = archivo;
return new iSDAT(Informacion(), pluginHost);
return new iSDAT(Informacion(id), pluginHost);
}
#endregion
private sSDAT Informacion()
private sSDAT Informacion(int id)
{
sSDAT sdat = new sSDAT();
sdat.id = id;
sdat.archivo = Path.GetTempFileName();
File.Copy(archivo, sdat.archivo, true);
BinaryReader br = new BinaryReader(new FileStream(archivo, FileMode.Open));
@ -381,8 +380,10 @@ namespace SDAT
br.Close();
Console.WriteLine("Lectura de archivo SDAT completa:");
Console.WriteLine("\tArchivos totales: <b>" + sdat.files.header.nSounds.ToString() + "</b>");
System.Xml.Linq.XElement xml = System.Xml.Linq.XElement.Load(Application.StartupPath + "\\Plugins\\SDATLang.xml");
xml = xml.Element(pluginHost.Get_Language()).Element("Messages");
Console.WriteLine(xml.Element("S00").Value);
Console.WriteLine(xml.Element("S01").Value, sdat.files.header.nSounds.ToString());
FileSystem(ref sdat);
@ -476,7 +477,6 @@ namespace SDAT
sdat.files.root = root;
}
private void Asignar_Datos(ref sSDAT sdat)
{
int nFile = 0;
@ -605,17 +605,6 @@ namespace SDAT
nFile++;
}
}
public void Leer(string archivo)
{
throw new NotImplementedException();
}
public Control Show_Info(string archivo)
{
throw new NotImplementedException();
}
}
public struct Folder
@ -648,6 +637,7 @@ namespace SDAT
public struct sSDAT
{
public String archivo;
public int id;
public Header generico;
public Cabecera cabecera;
public Symbol symbol;

View File

@ -22,6 +22,8 @@
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<DocumentationFile>
</DocumentationFile>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>pdbonly</DebugType>
@ -52,6 +54,11 @@
<Compile Include="iSDAT.Designer.cs">
<DependentUpon>iSDAT.cs</DependentUpon>
</Compile>
<Compile Include="Properties\Resources.Designer.cs">
<AutoGen>True</AutoGen>
<DesignTime>True</DesignTime>
<DependentUpon>Resources.resx</DependentUpon>
</Compile>
<Compile Include="SDAT.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="STRM.cs" />
@ -63,8 +70,13 @@
<EmbeddedResource Include="iSDAT.resx">
<DependentUpon>iSDAT.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="Properties\Resources.resx">
<Generator>ResXFileCodeGenerator</Generator>
<LastGenOutput>Resources.Designer.cs</LastGenOutput>
</EmbeddedResource>
</ItemGroup>
<ItemGroup>
<None Include="Resources\sound_add.png" />
<Content Include="SDATLang.xml">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>

View File

@ -13,7 +13,13 @@
<S08>Extraer</S08>
<S09>Guardar MIDI</S09>
<S0A>Guardar WAV</S0A>
<S0B>Importar</S0B>
<S0C>Guardar SDAT</S0C>
</iSDAT>
<Messages>
<S00>Lectura de archivos SDAT completa</S00>
<S01>Archivos totales: <b>{0}</b></S01>
</Messages>
</Español>
<English>
<iSDAT>
@ -28,7 +34,13 @@
<S08>Extract</S08>
<S09>Save MIDI</S09>
<S0A>Save WAV</S0A>
</iSDAT>
<S0B>Import</S0B>
<S0C>Save SDAT</S0C>
</iSDAT>
<Messages>
<S00>SDAT reading completed</S00>
<S01>Files: <b>{0}</b></S01>
</Messages>
</English>
<Français>
<iSDAT>
@ -43,6 +55,12 @@
<S08>Extraire</S08>
<S09>Sauver MIDI</S09>
<S0A>Sauver WAV</S0A>
<S0B>Importer</S0B>
<S0C>Sauver SDAT</S0C>
</iSDAT>
<Messages>
<S00>SDAT reading completed</S00>
<S01>Files: <b>{0}</b></S01>
</Messages>
</Français>
</Language>

View File

@ -1,5 +1,5 @@
/*
* Copyright (C) 2011 rafael1193
* Copyright (C) 2011
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@ -14,9 +14,7 @@
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* Programador: rafael1193
*
* Fecha: 16/07/2011
* Programador: rafael1193, pleoNeX
*
*/
@ -28,14 +26,22 @@ using System.IO;
namespace SDAT
{
class STRM
/// <summary>
/// Operations with STRM files
/// </summary>
public static class STRM
{
public static sSTRM LeerArchivo(string path)
/// <summary>
/// Read a STRM file and return the structure
/// </summary>
/// <param name="path">File to read</param>
/// <returns>Structure from the file</returns>
public static sSTRM Read(string path)
{
sSTRM strm = new sSTRM();
BinaryReader br = new BinaryReader(File.OpenRead(path));
// Genérico
// Common header
strm.cabecera.id = br.ReadChars(4);
strm.cabecera.constant = br.ReadUInt32();
strm.cabecera.fileSize = br.ReadUInt32();
@ -67,10 +73,14 @@ namespace SDAT
return strm;
}
public static void EscribirArchivo(sSTRM strm, string path)
/// <summary>
/// Write a STRM structure to a file
/// </summary>
/// <param name="strm">STRM structure to write</param>
/// <param name="path">File to write</param>
public static void Write(sSTRM strm, string path)
{
/*System.IO.FileStream fs = null;
System.IO.FileStream fs = null;
System.IO.BinaryWriter bw = null;
try
@ -78,35 +88,37 @@ namespace SDAT
fs = new System.IO.FileStream(path, System.IO.FileMode.Create);
bw = new System.IO.BinaryWriter(fs);
//Escribir File
bw.Write(Encoding.ASCII.GetBytes(strm.file.type));
bw.Write(strm.file.magic);
bw.Write(strm.file.nFileSize);
bw.Write(strm.file.nSize);
bw.Write(strm.file.nBlock);
// Common header
bw.Write(Encoding.ASCII.GetBytes(strm.cabecera.id));
bw.Write(strm.cabecera.constant);
bw.Write(strm.cabecera.fileSize);
bw.Write(strm.cabecera.headerSize);
bw.Write(strm.cabecera.nBlocks);
//Escribir Header
bw.Write(Encoding.ASCII.GetBytes(strm.head.type));
bw.Write(strm.head.nSize);
bw.Write(strm.head.nWaveType);
bw.Write(strm.head.bLoop);
bw.Write(strm.head.nChannel);
bw.Write(strm.head.nSampleRate);
bw.Write(strm.head.nTime);
bw.Write(strm.head.nLoopOffset);
bw.Write(strm.head.nSample);
bw.Write(strm.head.nDataOffset);
bw.Write(strm.head.nBlock);
bw.Write(strm.head.nBlockLen);
bw.Write(strm.head.nBlockSample);
bw.Write(strm.head.nLastBlockLen);
bw.Write(strm.head.nLastBlockSample);
// HEAD section
bw.Write(Encoding.ASCII.GetBytes(strm.head.id));
bw.Write(strm.head.size);
bw.Write(strm.head.waveType);
bw.Write(strm.head.loop);
bw.Write(strm.head.channels);
bw.Write(strm.head.sampleRate);
bw.Write(strm.head.time);
bw.Write(strm.head.loopOffset);
bw.Write(strm.head.nSamples);
bw.Write(strm.head.dataOffset);
bw.Write(strm.head.nBlocks);
bw.Write(strm.head.blockLen);
bw.Write(strm.head.blockSample);
bw.Write(strm.head.lastBlocklen);
bw.Write(strm.head.lastBlockSample);
bw.Write(strm.head.reserved);
//Escribir Data
bw.Write(Encoding.ASCII.GetBytes(strm.data.type));
bw.Write(strm.data.nSize);
// DATA section
bw.Write(Encoding.ASCII.GetBytes(strm.data.id));
bw.Write(strm.data.size);
bw.Write(strm.data.data);
bw.Flush();
}
catch (Exception ex)
{
@ -114,33 +126,42 @@ namespace SDAT
}
finally
{
if (fs != null) fs.Close();
if (bw != null) bw.Close();
}*/
if (fs != null) fs.Close();
}
}
public static WAV.ArchivoWAV ConvertirAWAV(sSTRM strm, bool loop)
/// <summary>
/// Convert a STRM structure to a WAV structure
/// </summary>
/// <param name="strm">STRM structure to convert</param>
/// <param name="loop">If true, the new WAV data will start in the loop offset</param>
/// <returns>WAV structure converted</returns>
public static sWAV ConvertToWAV(sSTRM strm, bool loop)
{
WAV.ArchivoWAV wav = new WAV.ArchivoWAV();
sWAV wav = new sWAV();
// Get the audio data
if (strm.head.channels == 2)
{
strm.data.leftChannel = SepararCanales(strm.data.data, strm.head.nBlocks, strm.head.blockLen,
// Get both channels and convert it to PCM-16
strm.data.leftChannel = DivideChannels(strm.data.data, strm.head.nBlocks, strm.head.blockLen,
strm.head.lastBlocklen, true, strm.head.waveType);
strm.data.rightChannel = SepararCanales(strm.data.data, strm.head.nBlocks, strm.head.blockLen,
strm.data.rightChannel = DivideChannels(strm.data.data, strm.head.nBlocks, strm.head.blockLen,
strm.head.lastBlocklen, false, strm.head.waveType);
Array.Clear(strm.data.data, 0, strm.data.data.Length); // Borramos datos no necesarios
Array.Clear(strm.data.data, 0, strm.data.data.Length);
if (loop && strm.head.waveType == 0) // 8 bits per sample
strm.data.data = AlternarCanales(strm.data.leftChannel, strm.data.rightChannel, (int)strm.head.loopOffset);
strm.data.data = MergeChannels(strm.data.leftChannel, strm.data.rightChannel, (int)strm.head.loopOffset);
else if (loop) // 16 bits per sample
strm.data.data = AlternarCanales(strm.data.leftChannel, strm.data.rightChannel, (int)strm.head.loopOffset * 2);
strm.data.data = MergeChannels(strm.data.leftChannel, strm.data.rightChannel, (int)strm.head.loopOffset * 2);
else // No loop
strm.data.data = AlternarCanales(strm.data.leftChannel, strm.data.rightChannel);
strm.data.data = MergeChannels(strm.data.leftChannel, strm.data.rightChannel);
}
else if (strm.head.channels == 1)
{
strm.data.data = ObtenerCanal(strm.data.data, strm.head.nBlocks, strm.head.blockLen,
// Get the channel and convert it to PCM-16
strm.data.data = MonoChannel(strm.data.data, strm.head.nBlocks, strm.head.blockLen,
strm.head.lastBlocklen, strm.head.waveType);
if (strm.head.waveType == 0 && loop) // 8 bits per sample
@ -157,23 +178,85 @@ namespace SDAT
}
}
if (strm.head.waveType == 0)
{
wav = WAV.GenerarWAVPCM(strm.head.channels, strm.head.sampleRate, 8, strm.data.data);
}
else if (strm.head.waveType == 1)
{
wav = WAV.GenerarWAVPCM(strm.head.channels, strm.head.sampleRate, 16, strm.data.data);
}
// Create the WAV structure from the STRM data
wav = WAV.Create_WAV(strm.head.channels, strm.head.sampleRate, (ushort)(strm.head.waveType == 0 ? 8 : 16),
strm.data.data);
else if (strm.head.waveType >= 2)
{
wav = WAV.GenerarWAVADPCM(strm.head.channels, strm.head.sampleRate, 16, strm.data.data);
}
return wav;
}
/// <summary>
/// Convert a WAV structure to a STRM structure
/// </summary>
/// <param name="wav">WAV structure to convert</param>
/// <returns>STRM structure converted</returns>
public static sSTRM ConvertToSTRM(sWAV wav)
{
if (wav.wave.fmt.audioFormat != WaveFormat.WAVE_FORMAT_PCM)
throw new NotSupportedException();
static byte[] SepararCanales(byte[] data, uint nBlocks, uint blockLen, uint lastBlockLen, bool leftChannel, int waveType)
sSTRM strm = new sSTRM();
strm.cabecera.id = "STRM".ToArray();
strm.cabecera.constant = 0x0100FEFF;
strm.cabecera.headerSize = 0x10;
strm.cabecera.nBlocks = 0x02;
strm.head.id = "HEAD".ToArray();
strm.head.size = 0x50;
strm.head.waveType = 1;
strm.head.loop = 0;
strm.head.channels = wav.wave.fmt.numChannels;
strm.head.sampleRate = (ushort)wav.wave.fmt.sampleRate;
strm.head.time = (ushort)(1.0 / strm.head.sampleRate * 1.6756991e+7 / 32);
strm.head.loopOffset = 0x00;
strm.head.dataOffset = 0x68;
strm.head.reserved = new Byte[32];
strm.data.id = "DATA".ToArray();
if (wav.wave.fmt.numChannels == 2)
{
strm.data.leftChannel = DivideChannels(wav.wave.data.data, true, 0);
strm.data.rightChannel = DivideChannels(wav.wave.data.data, false, 0);
byte[][] leftBlock = CreateBlocks(strm.data.leftChannel);
byte[][] rigthBlock = CreateBlocks(strm.data.rightChannel);
strm.data.data = MergeBlocks(leftBlock, rigthBlock);
strm.head.blockLen = (uint)leftBlock[0].Length;
strm.head.blockSample = strm.head.blockLen / 2;
strm.head.lastBlocklen = (uint)leftBlock[leftBlock.Length - 1].Length;
strm.head.lastBlockSample = strm.head.lastBlocklen / 2;
strm.head.nBlocks = (uint)leftBlock.Length;
strm.head.nSamples = strm.head.nBlocks * 0x100 + strm.head.lastBlockSample;
}
else
{
byte[][] blocks = CreateBlocks(wav.wave.data.data);
strm.head.blockLen = (uint)blocks[0].Length;
strm.head.blockSample = strm.head.blockLen / 2;
strm.head.lastBlocklen = (uint)blocks[blocks.Length - 1].Length;
strm.head.lastBlockSample = strm.head.lastBlocklen / 2;
strm.head.nBlocks = (uint)blocks.Length;
strm.head.nSamples = strm.head.nBlocks * 0x100 + strm.head.lastBlockSample;
strm.data.data = wav.wave.data.data;
}
strm.data.size = (uint)strm.data.data.Length + 0x08;
strm.cabecera.fileSize = strm.data.size + strm.head.size + strm.cabecera.headerSize;
return strm;
}
#region STRM to WAV methods
/// <summary>
/// Get one channels converted to PCM-16 from the audio data
/// </summary>
/// <param name="data">Audio data with two channels</param>
/// <param name="nBlocks">Numbers of blocks in the audio data</param>
/// <param name="blockLen">Block length in the audio data</param>
/// <param name="lastBlockLen">Length of the last block</param>
/// <param name="leftChannel">If true, return the left channel, else return the right channel</param>
/// <param name="waveType">The wavetype of the audio data (compression)</param>
/// <returns>Data of the channel</returns>
static byte[] DivideChannels(byte[] data, uint nBlocks, uint blockLen, uint lastBlockLen, bool leftChannel, int waveType)
{
List<byte> resultado = new List<byte>();
List<byte> datos = new List<byte>();
@ -187,7 +270,7 @@ namespace SDAT
datos.CopyTo(i * (int)blockLen * 2 + j, blockData, 0, (int)blockLen);
if (waveType == 2)
resultado.AddRange(AdpcmDecompressor.DecompressBlock_ADPCM(blockData, BitConverter.ToInt16(blockData, 0), BitConverter.ToInt16(blockData, 2)));
resultado.AddRange(Compression_ADPCM.DecompressBlock_ADPCM(blockData, BitConverter.ToInt16(blockData, 0), BitConverter.ToInt16(blockData, 2)));
else if (waveType == 1)
resultado.AddRange(blockData);
else if (waveType == 0)
@ -198,7 +281,7 @@ namespace SDAT
datos.CopyTo((int)(nBlocks - 1) * (int)blockLen * 2 + j, blockData, 0, (int)lastBlockLen);
if (waveType == 2)
resultado.AddRange(AdpcmDecompressor.DecompressBlock_ADPCM(blockData, BitConverter.ToInt16(blockData, 0), BitConverter.ToInt16(blockData, 2)));
resultado.AddRange(Compression_ADPCM.DecompressBlock_ADPCM(blockData, BitConverter.ToInt16(blockData, 0), BitConverter.ToInt16(blockData, 2)));
else if (waveType == 1)
resultado.AddRange(blockData);
else if (waveType == 0)
@ -206,7 +289,14 @@ namespace SDAT
return resultado.ToArray();
}
static byte[] AlternarCanales(byte[] leftChannel, byte[] rightChannel, int loopSample = 0)
/// <summary>
/// Create audio data from two channels
/// </summary>
/// <param name="leftChannel">Audio data from the left channel</param>
/// <param name="rightChannel">Audio data from the right channel</param>
/// <param name="loopSample">Sample where the audio data will start (used in loops)</param>
/// <returns>Audio data</returns>
static byte[] MergeChannels(byte[] leftChannel, byte[] rightChannel, int loopSample = 0)
{
List<byte> resultado = new List<byte>();
@ -223,7 +313,16 @@ namespace SDAT
return resultado.ToArray();
}
static byte[] ObtenerCanal(byte[] data, uint nBlocks, uint blockLen, uint lastBlockLen, int waveType)
/// <summary>
/// Get the channel data converted to PCM-16 from mono audio data
/// </summary>
/// <param name="data">Data to convert</param>
/// <param name="nBlocks">Number of blocks</param>
/// <param name="blockLen">Block length</param>
/// <param name="lastBlockLen">Last block length</param>
/// <param name="waveType">Wavetype of the audio data (compression)</param>
/// <returns>Channel data</returns>
static byte[] MonoChannel(byte[] data, uint nBlocks, uint blockLen, uint lastBlockLen, int waveType)
{
List<byte> resultado = new List<byte>();
List<byte> datos = new List<byte>();
@ -236,7 +335,7 @@ namespace SDAT
datos.CopyTo(i * (int)blockLen, blockData, 0, (int)blockLen);
if (waveType == 2)
resultado.AddRange(AdpcmDecompressor.DecompressBlock_ADPCM(blockData, BitConverter.ToInt16(blockData, 0), BitConverter.ToInt16(blockData, 2)));
resultado.AddRange(Compression_ADPCM.DecompressBlock_ADPCM(blockData, BitConverter.ToInt16(blockData, 0), BitConverter.ToInt16(blockData, 2)));
else if (waveType == 1)
resultado.AddRange(blockData);
else if (waveType == 0)
@ -253,7 +352,7 @@ namespace SDAT
resultado.AddRange(blockData);
return resultado.ToArray();
}
resultado.AddRange(AdpcmDecompressor.DecompressBlock_ADPCM(blockData, BitConverter.ToInt16(blockData, 0), BitConverter.ToInt16(blockData, 2)));
resultado.AddRange(Compression_ADPCM.DecompressBlock_ADPCM(blockData, BitConverter.ToInt16(blockData, 0), BitConverter.ToInt16(blockData, 2)));
}
else if (waveType == 1)
resultado.AddRange(blockData);
@ -262,6 +361,78 @@ namespace SDAT
return resultado.ToArray();
}
#endregion
#region WAV to STRM methods
/// <summary>
/// Divide the channels of PCM-16 audio data
/// </summary>
/// <param name="data">PCM-16 audio data</param>
/// <param name="leftChannel">If true, returns the audio data of the left channel, else the right channel</param>
/// <param name="waveType">The wave type of the audio data (compression)</param>
/// <returns>A channel audio data</returns>
static byte[] DivideChannels(byte[] data, bool leftChannel, int waveType)
{
List<Byte> channel = new List<byte>();
// TODO: Add compressions (AD-PCM ,PCM-8)
for (int i = (leftChannel ? 0 : 2); i < data.Length; i += 4)
{
channel.Add(data[i]);
channel.Add(data[i + 1]);
}
return channel.ToArray();
}
/// <summary>
/// Create a block data from audio data. Default length 512 bytes, 256 samples.
/// </summary>
/// <param name="channel">Channel audio data</param>
/// <returns>Block data</returns>
static byte[][] CreateBlocks(byte[] channel)
{
List<Byte[]> blocks = new List<Byte[]>();
int nBlocks = channel.Length / 0x200;
int lastBlockLength = channel.Length % 0x200;
Byte[] block = new Byte[0x200];
for (int i = 0; i < nBlocks; i++)
{
block = new Byte[0x200];
Array.Copy(channel, i * 0x200, block, 0, 0x200);
blocks.Add(block);
}
block = new Byte[lastBlockLength];
Array.Copy(channel, nBlocks * 0x200, block, 0, lastBlockLength);
blocks.Add(block);
return blocks.ToArray();
}
/// <summary>
/// Merge blocks of two channels.
/// </summary>
/// <param name="leftChannel">Left channel block</param>
/// <param name="rightChannel">Right channel block</param>
/// <returns>Return the audio data</returns>
static byte[] MergeBlocks(byte[][] leftChannel, byte[][] rightChannel)
{
List<byte> data = new List<byte>();
for (int i = 0; i < leftChannel.Length; i++)
{
data.AddRange(leftChannel[i]);
data.AddRange(rightChannel[i]);
}
return data.ToArray();
}
#endregion
/// <summary>
/// Convert PCM-8 audio data to PCM-16 audio data
/// </summary>
/// <param name="data">PCM-8 bytes</param>
/// <returns>PCM-16 bytes</returns>
static byte[] PCM8(byte[] data)
{
byte[] resul = new byte[data.Length];
@ -273,49 +444,51 @@ namespace SDAT
return resul;
}
}
/// <summary>
/// Structure of a STRM file
/// </summary>
public struct sSTRM
{
public Cabecera cabecera;
public HEAD head;
public DATA data;
public struct sSTRM
public struct Cabecera
{
public Cabecera cabecera;
public HEAD head;
public DATA data;
public struct Cabecera
{
public char[] id;
public uint constant;
public uint fileSize;
public ushort headerSize;
public ushort nBlocks;
}
public struct HEAD
{
public char[] id;
public uint size;
public byte waveType;
public byte loop;
public ushort channels;
public ushort sampleRate;
public ushort time;
public uint loopOffset;
public uint nSamples;
public uint dataOffset;
public uint nBlocks;
public uint blockLen;
public uint blockSample;
public uint lastBlocklen;
public uint lastBlockSample;
// Reserved[32] always 0
}
public struct DATA
{
public char[] id;
public uint size;
public byte[] leftChannel;
public byte[] rightChannel;
public byte[] data;
}
public char[] id;
public uint constant;
public uint fileSize;
public ushort headerSize;
public ushort nBlocks;
}
public struct HEAD
{
public char[] id;
public uint size;
public byte waveType;
public byte loop;
public ushort channels;
public ushort sampleRate;
public ushort time;
public uint loopOffset;
public uint nSamples;
public uint dataOffset;
public uint nBlocks;
public uint blockLen;
public uint blockSample;
public uint lastBlocklen;
public uint lastBlockSample;
public byte[] reserved; // 32 bytes. Always 0
}
public struct DATA
{
public char[] id;
public uint size;
public byte[] leftChannel;
public byte[] rightChannel;
public byte[] data;
}
}
}

View File

@ -16,8 +16,6 @@
*
* Programador: rafael1193
*
* Fecha: 15/07/2011
*
*/
using System;
@ -25,29 +23,36 @@ using System.Text;
namespace SDAT
{
/// <summary>
/// Operations with SWAR files
/// </summary>
class SWAR
{
public static ArchivoSWAR LeerArchivo(string path)
/// <summary>
/// Read a SWAR file and return a SWAR structure
/// </summary>
/// <param name="path">File to read</param>
/// <returns>Structure of the file</returns>
public static sSWAR Read(string path)
{
/***Lectura del archivo SWAR***/
System.IO.FileStream fs = null;
System.IO.BinaryReader br = null;
ArchivoSWAR swar = new ArchivoSWAR();
sSWAR swar = new sSWAR();
try
{
fs = new System.IO.FileStream(path, System.IO.FileMode.Open);
br = new System.IO.BinaryReader(fs);
//Leer Header
// Common header
swar.header.type = Encoding.ASCII.GetChars(br.ReadBytes(4));
swar.header.magic = br.ReadUInt32();
swar.header.nFileSize = br.ReadUInt32();
swar.header.nSize = br.ReadUInt16();
swar.header.nBlock = br.ReadUInt16();
//Leer Data
// DATA section
swar.data.type = Encoding.ASCII.GetChars(br.ReadBytes(4));
swar.data.nSize = br.ReadUInt32();
swar.data.reserved = new uint[8];
@ -57,11 +62,11 @@ namespace SDAT
swar.data.nOffset = new uint[swar.data.nSample];
for (int i = 0; i < swar.data.nSample; i++) { swar.data.nOffset[i] = br.ReadUInt32(); }
swar.data.samples = new ArchivoSWAR.Data.Sample[swar.data.nSample];
swar.data.samples = new sSWAR.Data.Sample[swar.data.nSample];
for (uint i = 0; i < swar.data.nSample; i++)
{
//Leer Info
// INFO structure
swar.data.samples[i].info.nWaveType = br.ReadByte();
swar.data.samples[i].info.bLoop = br.ReadByte();
swar.data.samples[i].info.nSampleRate = br.ReadUInt16();
@ -69,17 +74,17 @@ namespace SDAT
swar.data.samples[i].info.nLoopOffset = br.ReadUInt16();
swar.data.samples[i].info.nNonLoopLen = br.ReadUInt32();
//Calcular tamaño de data
// Calculation of data size
if (i < swar.data.nOffset.Length - 1)
{
swar.data.samples[i].data = new byte[swar.data.nOffset[i + 1] - swar.data.nOffset[i] - /*tamaño de SWAVInfo ->*/12];
swar.data.samples[i].data = new byte[swar.data.nOffset[i + 1] - swar.data.nOffset[i] - /*SWAVInfo size ->*/12];
}
else
{
swar.data.samples[i].data = new byte[br.BaseStream.Length - swar.data.nOffset[i] - /*tamaño de SWAVInfo ->*/12];
swar.data.samples[i].data = new byte[br.BaseStream.Length - swar.data.nOffset[i] - /*SWAVInfo size ->*/12];
}
//Leer data
// Read DATA
for (uint j = 0; j < swar.data.samples[i].data.Length; j++)
{
swar.data.samples[i].data[j] = br.ReadByte();
@ -100,13 +105,18 @@ namespace SDAT
return swar;
}
public static SWAV.ArchivoSWAV[] ConvertirASWAV(ArchivoSWAR swar)
/// <summary>
/// Decompress the SWAR file in SWAV files.
/// </summary>
/// <param name="swar">SWAR structure to decompress</param>
/// <returns>All the SWAV that are in it</returns>
public static sSWAV[] ConvertToSWAV(sSWAR swar)
{
SWAV.ArchivoSWAV[] swav = new SWAV.ArchivoSWAV[swar.data.samples.Length];
sSWAV[] swav = new sSWAV[swar.data.samples.Length];
for (int i = 0; i < swav.Length; i++)
{
swav[i] = new SWAV.ArchivoSWAV();
swav[i] = new sSWAV();
swav[i].data.data = swar.data.samples[i].data;
swav[i].data.info = swar.data.samples[i].info;
@ -121,42 +131,38 @@ namespace SDAT
}
return swav;
}
public struct ArchivoSWAR
{
public Header header;
public Data data;
public struct Header
{
public char[] type; // 'SWAR'
public uint magic; // 0x0100feff
public uint nFileSize; // Size of this SWAR file
public ushort nSize; // Size of this structure = 16
public ushort nBlock; // Number of Blocks = 1
}
public struct Data
{
public char[] type; // 'DATA'
public uint nSize; // Size of this structure
public uint[] reserved; // 8 reserved 0s, for use in runtime
public uint nSample; // Number of Samples
public uint[] nOffset; // array of offsets of samples
public Sample[] samples;
public struct Sample
{
public SWAV.ArchivoSWAV.Data.SWAVInfo info;
public byte[] data;
}
}
}
}
/// <summary>
/// Structure of a SWAR file
/// </summary>
public struct sSWAR
{
public Header header;
public Data data;
public struct Header
{
public char[] type; // 'SWAR'
public uint magic; // 0x0100feff
public uint nFileSize; // Size of this SWAR file
public ushort nSize; // Size of this structure = 16
public ushort nBlock; // Number of Blocks = 1
}
public struct Data
{
public char[] type; // 'DATA'
public uint nSize; // Size of this structure
public uint[] reserved; // 8 reserved 0s, for use in runtime
public uint nSample; // Number of Samples
public uint[] nOffset; // array of offsets of samples
public Sample[] samples;
public struct Sample
{
public sSWAV.Data.SWAVInfo info;
public byte[] data;
}
}
}
}

View File

@ -16,8 +16,6 @@
*
* Programador: rafael1193
*
* Fecha: 11/07/2011
*
*/
using System;
@ -27,13 +25,13 @@ namespace SDAT
{
class SWAV
{
public static ArchivoSWAV LeerArchivo(string path)
public static sSWAV LeerArchivo(string path)
{
/***Lectura del archivo SWAV***/
System.IO.FileStream fs = null;
System.IO.BinaryReader br = null;
ArchivoSWAV swav = new ArchivoSWAV();
sSWAV swav = new sSWAV();
try
{
@ -80,7 +78,7 @@ namespace SDAT
return swav;
}
public static void EscribirArchivo(ArchivoSWAV swav, string path)
public static void EscribirArchivo(sSWAV swav, string path)
{
System.IO.FileStream fs = null;
System.IO.BinaryWriter bw = null;
@ -123,26 +121,24 @@ namespace SDAT
}
}
public static WAV.ArchivoWAV ConvertirAWAV(ArchivoSWAV swav)
public static sWAV ConvertirAWAV(sSWAV swav)
{
WAV.ArchivoWAV wav = new WAV.ArchivoWAV();
sWAV wav = new sWAV();
if (swav.data.info.nWaveType == 0)
{
swav.data.data = PCM8(swav.data.data);
wav = WAV.GenerarWAVPCM(1, swav.data.info.nSampleRate, 8, swav.data.data);
wav = WAV.Create_WAV(1, swav.data.info.nSampleRate, 8, swav.data.data);
}
if (swav.data.info.nWaveType == 1)
else if (swav.data.info.nWaveType == 1)
{
wav = WAV.GenerarWAVPCM(1, swav.data.info.nSampleRate, 16, swav.data.data);
wav = WAV.Create_WAV(1, swav.data.info.nSampleRate, 16, swav.data.data);
}
if (swav.data.info.nWaveType >= 2)
else if (swav.data.info.nWaveType >= 2)
{
swav.data.data = AdpcmDecompressor.DecompressADPCM(swav.data.data);
wav = WAV.GenerarWAVADPCM(1,33000, 16, swav.data.data);
swav.data.data = Compression_ADPCM.Decompress_ADPCM(swav.data.data);
wav = WAV.Create_WAV(1, 33000, 16, swav.data.data);
}
return wav;
}
@ -157,37 +153,37 @@ namespace SDAT
return resul;
}
}
public struct ArchivoSWAV
public struct sSWAV
{
public Header header;
public Data data;
public struct Header
{
public Header header;
public Data data;
public char[] type; // 'SWAV'
public uint magic; // 0x0100feff
public uint nFileSize; // Size of this SWAV file
public ushort nSize; // Size of this structure = 16
public ushort nBlock; // Number of Blocks = 1
}
public struct Data
{
public char[] type; // 'DATA'
public uint nSize; // Size of this structure
public SWAVInfo info; // info about the sample
public byte[] data; // array of binary data
public struct Header
// info about the sample
public struct SWAVInfo
{
public char[] type; // 'SWAV'
public uint magic; // 0x0100feff
public uint nFileSize; // Size of this SWAV file
public ushort nSize; // Size of this structure = 16
public ushort nBlock; // Number of Blocks = 1
}
public struct Data
{
public char[] type; // 'DATA'
public uint nSize; // Size of this structure
public SWAVInfo info; // info about the sample
public byte[] data; // array of binary data
// info about the sample
public struct SWAVInfo
{
public byte nWaveType; // 0 = PCM8, 1 = PCM16, 2 = (IMA-)ADPCM
public byte bLoop; // Loop flag = TRUE|FALSE
public ushort nSampleRate; // Sampling Rate
public ushort nTime; // (ARM7_CLOCK / nSampleRate) [ARM7_CLOCK: 33.513982MHz / 2 = 1.6756991 E +7]
public ushort nLoopOffset; // Loop Offset (expressed in words (32-bits))
public uint nNonLoopLen; // Non Loop Length (expressed in words (32-bits))
}
public byte nWaveType; // 0 = PCM8, 1 = PCM16, 2 = (IMA-)ADPCM
public byte bLoop; // Loop flag = TRUE|FALSE
public ushort nSampleRate; // Sampling Rate
public ushort nTime; // (ARM7_CLOCK / nSampleRate) [ARM7_CLOCK: 33.513982MHz / 2 = 1.6756991 E +7]
public ushort nLoopOffset; // Loop Offset (expressed in words (32-bits))
public uint nNonLoopLen; // Non Loop Length (expressed in words (32-bits))
}
}
}

View File

@ -1,5 +1,5 @@
/*
* Copyright (C) 2011 rafael1193
* Copyright (C) 2011
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@ -14,47 +14,86 @@
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* Programador: rafael1193
*
* Fecha: 15/07/2011
* Programador: rafael1193, pleoNeX
*
*/
using System;
using System.IO;
using System.Text;
namespace SDAT
{
class WAV
/// <summary>
/// Static class with WAV files operations
/// </summary>
public static class WAV
{
public static void EscribirArchivo(ArchivoWAV wr, string path)
/// <summary>
/// Read a wave file and return its structure.
/// </summary>
/// <param name="filein">File to read</param>
/// <returns>Structure of the wave file</returns>
public static sWAV Read(string filein)
{
System.IO.FileStream fs = null;
System.IO.BinaryWriter bw = null;
sWAV wav = new sWAV();
BinaryReader br = new BinaryReader(File.OpenRead(filein));
// RIFF header
wav.chunkID = br.ReadChars(4);
wav.chunkSize = br.ReadUInt32();
wav.format = br.ReadChars(4);
// fmt sub-chunk
wav.wave.fmt.chunkID = br.ReadChars(4);
wav.wave.fmt.chunkSize = br.ReadUInt32();
wav.wave.fmt.audioFormat = (WaveFormat)br.ReadUInt16();
wav.wave.fmt.numChannels = br.ReadUInt16();
wav.wave.fmt.sampleRate = br.ReadUInt32();
wav.wave.fmt.byteRate = br.ReadUInt32();
wav.wave.fmt.blockAlign = br.ReadUInt16();
wav.wave.fmt.bitsPerSample = br.ReadUInt16();
// data sub-chunk
wav.wave.data.chunkID = br.ReadChars(4);
wav.wave.data.chunkSize = br.ReadUInt32();
wav.wave.data.data = br.ReadBytes((int)wav.wave.data.chunkSize - 0x08);
br.Close();
return wav;
}
/// <summary>
/// Write a WAV structure to a WAV file
/// </summary>
/// <param name="wav">WAV structu to write</param>
/// <param name="fileout">File where the structure will be written</param>
public static void Write(sWAV wav, string fileout)
{
FileStream fs = null;
BinaryWriter bw = null;
try
{
fs = new System.IO.FileStream(path, System.IO.FileMode.Create);
bw = new System.IO.BinaryWriter(fs);
fs = new FileStream(fileout, System.IO.FileMode.Create);
bw = new BinaryWriter(fs);
bw.Write(System.Text.Encoding.ASCII.GetBytes(wr.chunkID));
bw.Write(wr.chunkSize);
bw.Write(System.Text.Encoding.ASCII.GetBytes(wr.format));
bw.Write(System.Text.Encoding.ASCII.GetBytes(wr.wave.fmt.chunkID));
bw.Write(wr.wave.fmt.chunkSize);
bw.Write(Convert.ToUInt16(wr.wave.fmt.audioFormat));
bw.Write(wr.wave.fmt.numChannels);
bw.Write(wr.wave.fmt.sampleRate);
bw.Write(wr.wave.fmt.byteRate);
bw.Write(wr.wave.fmt.blockAlign);
bw.Write(wr.wave.fmt.bitsPerSample);
bw.Write(System.Text.Encoding.ASCII.GetBytes(wr.wave.data.chunkID));
bw.Write(wr.wave.data.chunkSize);
bw.Write(wr.wave.data.data);
bw.Write(Encoding.ASCII.GetBytes(wav.chunkID));
bw.Write(wav.chunkSize);
bw.Write(Encoding.ASCII.GetBytes(wav.format));
bw.Write(Encoding.ASCII.GetBytes(wav.wave.fmt.chunkID));
bw.Write(wav.wave.fmt.chunkSize);
bw.Write(Convert.ToUInt16(wav.wave.fmt.audioFormat));
bw.Write(wav.wave.fmt.numChannels);
bw.Write(wav.wave.fmt.sampleRate);
bw.Write(wav.wave.fmt.byteRate);
bw.Write(wav.wave.fmt.blockAlign);
bw.Write(wav.wave.fmt.bitsPerSample);
bw.Write(Encoding.ASCII.GetBytes(wav.wave.data.chunkID));
bw.Write(wav.wave.data.chunkSize);
bw.Write(wav.wave.data.data);
bw.Flush();
}
catch (Exception ex)
{
System.Console.WriteLine(ex.Message.ToString());
Console.WriteLine(ex.Message.ToString());
}
finally
{
@ -64,123 +103,79 @@ namespace SDAT
}
public static ArchivoWAV GenerarWAVPCM(ushort numChannels, uint sampleRate, ushort bitsPerSample, byte[] data)
/// <summary>
/// Create a WAV structure using PCM audio format
/// </summary>
/// <param name="numChannels">Number of channels</param>
/// <param name="sampleRate">Sample rate</param>
/// <param name="bitsPerSample">Bits per sample</param>
/// <param name="data">Audio data</param>
/// <returns>New wav structure</returns>
public static sWAV Create_WAV(ushort numChannels, uint sampleRate, ushort bitsPerSample, byte[] data)
{
ArchivoWAV archivo = new ArchivoWAV();
sWAV wav = new sWAV();
archivo.chunkID = new char[] { 'R', 'I', 'F', 'F' };
archivo.format = new char[] { 'W', 'A', 'V', 'E' };
wav.chunkID = new char[] { 'R', 'I', 'F', 'F' };
wav.format = new char[] { 'W', 'A', 'V', 'E' };
archivo.wave.fmt.chunkID = new char[] { 'f', 'm', 't', ' ' };
archivo.wave.fmt.chunkSize = 16;
archivo.wave.fmt.audioFormat = ArchivoWAV.WaveChunk.FmtChunk.WaveFormat.WAVE_FORMAT_PCM;
archivo.wave.fmt.numChannels = numChannels;
archivo.wave.fmt.sampleRate = sampleRate;
archivo.wave.fmt.bitsPerSample = bitsPerSample;
archivo.wave.fmt.byteRate = archivo.wave.fmt.sampleRate * archivo.wave.fmt.bitsPerSample * archivo.wave.fmt.numChannels / 8;
archivo.wave.fmt.blockAlign = (ushort)(archivo.wave.fmt.numChannels * archivo.wave.fmt.bitsPerSample / (ushort)(8));
wav.wave.fmt.chunkID = new char[] { 'f', 'm', 't', '\x20' };
wav.wave.fmt.chunkSize = 16;
wav.wave.fmt.audioFormat = WaveFormat.WAVE_FORMAT_PCM;
wav.wave.fmt.numChannels = numChannels;
wav.wave.fmt.sampleRate = sampleRate;
wav.wave.fmt.bitsPerSample = bitsPerSample;
wav.wave.fmt.byteRate = wav.wave.fmt.sampleRate * wav.wave.fmt.bitsPerSample * wav.wave.fmt.numChannels / 8;
wav.wave.fmt.blockAlign = (ushort)(wav.wave.fmt.numChannels * wav.wave.fmt.bitsPerSample / (ushort)(8));
archivo.wave.data.chunkID = new char[] { 'd', 'a', 't', 'a' };
archivo.wave.data.chunkSize = (uint)data.Length;
archivo.wave.data.data = new byte[data.Length];
archivo.wave.data.data = data;
wav.wave.data.chunkID = new char[] { 'd', 'a', 't', 'a' };
wav.wave.data.chunkSize = (uint)data.Length;
wav.wave.data.data = new byte[data.Length];
wav.wave.data.data = data;
archivo.chunkSize = 4 + (8 + archivo.wave.fmt.chunkSize) + (8 + archivo.wave.data.chunkSize);
wav.chunkSize = (uint)(0x24 + data.Length);
return archivo;
return wav;
}
}
public static ArchivoWAV GenerarWAVADPCM(ushort numChannels, uint sampleRate, ushort bitsPerSample, byte[] data)
public struct sWAV
{
public char[] chunkID;
public uint chunkSize;
public char[] format;
public WaveChunk wave;
public struct WaveChunk
{
ArchivoWAV archivo = new ArchivoWAV();
public FmtChunk fmt;
public DataChunk data;
if (numChannels == 1)
public struct FmtChunk
{
archivo.chunkID = new char[] { 'R', 'I', 'F', 'F' };
archivo.format = new char[] { 'W', 'A', 'V', 'E' };
archivo.wave.fmt.chunkID = new char[] { 'f', 'm', 't', ' ' };
archivo.wave.fmt.chunkSize = 16;
archivo.wave.fmt.audioFormat = ArchivoWAV.WaveChunk.FmtChunk.WaveFormat.WAVE_FORMAT_PCM;
archivo.wave.fmt.numChannels = numChannels;
archivo.wave.fmt.sampleRate = sampleRate;
archivo.wave.fmt.bitsPerSample = bitsPerSample;
archivo.wave.fmt.byteRate = archivo.wave.fmt.sampleRate * archivo.wave.fmt.bitsPerSample * archivo.wave.fmt.numChannels / 8;
archivo.wave.fmt.blockAlign = (ushort)(archivo.wave.fmt.numChannels * archivo.wave.fmt.bitsPerSample / (ushort)(8));
archivo.wave.data.chunkID = new char[] { 'd', 'a', 't', 'a' };
archivo.wave.data.chunkSize = (uint)data.Length;
archivo.wave.data.data = new byte[data.Length];
archivo.wave.data.data = data;
archivo.chunkSize = 4 + (8 + archivo.wave.fmt.chunkSize) + (8 + archivo.wave.data.chunkSize);
public char[] chunkID;
public uint chunkSize;
public WaveFormat audioFormat;
public ushort numChannels;
public uint sampleRate;
public uint byteRate;
public ushort blockAlign;
public ushort bitsPerSample;
}
if (numChannels == 2)
public struct DataChunk
{
archivo.chunkID = new char[] { 'R', 'I', 'F', 'F' };
archivo.format = new char[] { 'W', 'A', 'V', 'E' };
archivo.wave.fmt.chunkID = new char[] { 'f', 'm', 't', ' ' };
archivo.wave.fmt.chunkSize = 16;
archivo.wave.fmt.audioFormat = ArchivoWAV.WaveChunk.FmtChunk.WaveFormat.WAVE_FORMAT_PCM;
archivo.wave.fmt.numChannels = numChannels;
archivo.wave.fmt.sampleRate = sampleRate;
archivo.wave.fmt.bitsPerSample = bitsPerSample;
archivo.wave.fmt.byteRate = archivo.wave.fmt.sampleRate * archivo.wave.fmt.bitsPerSample * archivo.wave.fmt.numChannels / 8;
archivo.wave.fmt.blockAlign = (ushort)(archivo.wave.fmt.numChannels * archivo.wave.fmt.bitsPerSample / (ushort)(8));
archivo.wave.data.chunkID = new char[] { 'd', 'a', 't', 'a' };
archivo.wave.data.chunkSize = (uint)data.Length;
archivo.wave.data.data = new byte[data.Length];
archivo.wave.data.data = data;
archivo.chunkSize = (uint)(0x24 + data.Length);
}
return archivo;
}
public struct ArchivoWAV
{
public char[] chunkID;
public uint chunkSize;
public char[] format;
public WaveChunk wave;
public struct WaveChunk
{
public FmtChunk fmt;
public DataChunk data;
public struct FmtChunk
{
public char[] chunkID;
public uint chunkSize;
public WaveFormat audioFormat;
public ushort numChannels;
public uint sampleRate;
public uint byteRate;
public ushort blockAlign;
public ushort bitsPerSample;
public enum WaveFormat : ushort
{
WAVE_FORMAT_PCM = 0x0001,
IBM_FORMAT_ADPCM = 0x0002,
IBM_FORMAT_MULAW = 0x0007,
IBM_FORMAT_ALAW = 0x0006,
WAVE_FORMAT_EXTENSIBLE = 0xFFFE
}
}
public struct DataChunk
{
public char[] chunkID;
public uint chunkSize;
public byte[] data;
}
public char[] chunkID;
public uint chunkSize;
public byte[] data;
}
}
}
public enum WaveFormat : ushort
{
WAVE_FORMAT_PCM = 0x0001,
IBM_FORMAT_ADPCM = 0x0002,
IBM_FORMAT_MULAW = 0x0007,
IBM_FORMAT_ALAW = 0x0006,
WAVE_FORMAT_EXTENSIBLE = 0xFFFE
}
}

View File

@ -67,6 +67,8 @@ namespace SDAT
this.btnStop = new System.Windows.Forms.Button();
this.btnUncompress = new System.Windows.Forms.Button();
this.checkLoop = new System.Windows.Forms.CheckBox();
this.btnImport = new System.Windows.Forms.Button();
this.btnCreate = new System.Windows.Forms.Button();
this.SuspendLayout();
//
// treeFiles
@ -128,7 +130,7 @@ namespace SDAT
this.btnExtract.Enabled = false;
this.btnExtract.ImageIndex = 3;
this.btnExtract.ImageList = this.imageList;
this.btnExtract.Location = new System.Drawing.Point(251, 472);
this.btnExtract.Location = new System.Drawing.Point(251, 431);
this.btnExtract.Name = "btnExtract";
this.btnExtract.Size = new System.Drawing.Size(100, 35);
this.btnExtract.TabIndex = 2;
@ -165,7 +167,7 @@ namespace SDAT
// btnMidi
//
this.btnMidi.Enabled = false;
this.btnMidi.Location = new System.Drawing.Point(408, 432);
this.btnMidi.Location = new System.Drawing.Point(407, 390);
this.btnMidi.Name = "btnMidi";
this.btnMidi.Size = new System.Drawing.Size(99, 35);
this.btnMidi.TabIndex = 5;
@ -189,7 +191,7 @@ namespace SDAT
this.btnUncompress.Enabled = false;
this.btnUncompress.ImageKey = "package.png";
this.btnUncompress.ImageList = this.imageList;
this.btnUncompress.Location = new System.Drawing.Point(251, 432);
this.btnUncompress.Location = new System.Drawing.Point(251, 391);
this.btnUncompress.Name = "btnUncompress";
this.btnUncompress.Size = new System.Drawing.Size(100, 34);
this.btnUncompress.TabIndex = 7;
@ -202,19 +204,45 @@ namespace SDAT
//
this.checkLoop.AutoSize = true;
this.checkLoop.Enabled = false;
this.checkLoop.Location = new System.Drawing.Point(252, 409);
this.checkLoop.Location = new System.Drawing.Point(251, 368);
this.checkLoop.Name = "checkLoop";
this.checkLoop.Size = new System.Drawing.Size(45, 17);
this.checkLoop.TabIndex = 8;
this.checkLoop.Text = "S06";
this.checkLoop.UseVisualStyleBackColor = true;
//
// btnImport
//
this.btnImport.Enabled = false;
this.btnImport.Image = global::SDAT.Properties.Resources.sound_add;
this.btnImport.Location = new System.Drawing.Point(407, 431);
this.btnImport.Name = "btnImport";
this.btnImport.Size = new System.Drawing.Size(99, 35);
this.btnImport.TabIndex = 9;
this.btnImport.Text = "S0B";
this.btnImport.TextImageRelation = System.Windows.Forms.TextImageRelation.ImageBeforeText;
this.btnImport.UseVisualStyleBackColor = true;
this.btnImport.Click += new System.EventHandler(this.btnImport_Click);
//
// btnCreate
//
this.btnCreate.Enabled = false;
this.btnCreate.Location = new System.Drawing.Point(251, 472);
this.btnCreate.Name = "btnCreate";
this.btnCreate.Size = new System.Drawing.Size(100, 34);
this.btnCreate.TabIndex = 10;
this.btnCreate.Text = "S0C";
this.btnCreate.UseVisualStyleBackColor = true;
this.btnCreate.Click += new System.EventHandler(this.btnCreate_Click);
//
// iSDAT
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.BackColor = System.Drawing.Color.Transparent;
this.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
this.Controls.Add(this.btnCreate);
this.Controls.Add(this.btnImport);
this.Controls.Add(this.checkLoop);
this.Controls.Add(this.btnUncompress);
this.Controls.Add(this.btnStop);
@ -245,5 +273,7 @@ namespace SDAT
private System.Windows.Forms.Button btnStop;
private System.Windows.Forms.Button btnUncompress;
private System.Windows.Forms.CheckBox checkLoop;
private System.Windows.Forms.Button btnImport;
private System.Windows.Forms.Button btnCreate;
}
}

View File

@ -15,7 +15,6 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* Programador: pleoNeX
* Programa utilizado: Visual Studio 2010
*
*/
@ -56,7 +55,7 @@ namespace SDAT
this.sdat = sdat;
this.pluginHost = pluginHost;
LeerIdioma();
ReadLanguage();
treeFiles.Nodes.Add(CarpetaToNodo(sdat.files.root));
treeFiles.Nodes[0].Expand();
@ -66,7 +65,7 @@ namespace SDAT
lastFileID++;
lastFolderID++;
}
private void LeerIdioma()
private void ReadLanguage()
{
System.Xml.Linq.XElement xml = System.Xml.Linq.XElement.Load(Application.StartupPath + "\\Plugins\\SDATLang.xml");
xml = xml.Element(pluginHost.Get_Language());
@ -83,9 +82,11 @@ namespace SDAT
btnExtract.Text = xml.Element("S08").Value;
btnMidi.Text = xml.Element("S09").Value;
btnWav.Text = xml.Element("S0A").Value;
btnImport.Text = xml.Element("S0B").Value;
btnCreate.Text = xml.Element("S0C").Value;
}
#region Administración de carpetas
#region System folder administration
private TreeNode CarpetaToNodo(Folder carpeta)
{
TreeNode currNode = new TreeNode();
@ -145,6 +146,7 @@ namespace SDAT
btnReproducir.Enabled = false;
btnWav.Enabled = false;
btnMidi.Enabled = false;
btnImport.Enabled = false;
btnUncompress.Enabled = false;
if (listProp.Items[0].SubItems.Count == 2)
for (int i = 0; i < listProp.Items.Count; i++)
@ -171,7 +173,10 @@ namespace SDAT
btnUncompress.Enabled = true;
}
if (fileSelect.type == FormatSound.STRM)
{
checkLoop.Enabled = true;
btnImport.Enabled = true;
}
}
else
{
@ -291,8 +296,47 @@ namespace SDAT
{
return String.Compare(f1.name, f2.name);
}
public void ChangeFile(int id, Sound fileChanged, Folder currFolder)
{
if (currFolder.files is List<Sound>)
{
for (int i = 0; i < currFolder.files.Count; i++)
{
if (currFolder.files[i].id == id)
{
currFolder.files[i] = fileChanged;
}
}
}
if (currFolder.folders is List<Folder>)
foreach (Folder subFolder in currFolder.folders)
ChangeFile(id, fileChanged, subFolder);
}
public void ChangeFile(int id, string newFilePath)
{
Sound newFile = new Sound();
Sound oldFile = SearchFile(id, sdat.files.root);
newFile.name = oldFile.name;
newFile.id = (ushort)id;
newFile.offset = 0x00;
newFile.path = newFilePath;
newFile.type = oldFile.type;
newFile.size = (uint)new FileInfo(newFilePath).Length;
ChangeFile(id, newFile, sdat.files.root);
}
#endregion
private void btnCreate_Click(object sender, EventArgs e)
{
String fileout = pluginHost.Get_TempFolder() + Path.DirectorySeparatorChar + Path.GetRandomFileName();
Save_NewSDAT(fileout);
pluginHost.ChangeFile(sdat.id, fileout);
}
private void btnExtract_Click(object sender, EventArgs e)
{
int id = Convert.ToInt32(treeFiles.SelectedNode.Tag);
@ -355,7 +399,7 @@ namespace SDAT
btnUncompress.Enabled = false;
string swar = SaveSelectedFile();
SWAV.ArchivoSWAV[] archivos = SWAR.ConvertirASWAV(SWAR.LeerArchivo(swar));
sSWAV[] archivos = SWAR.ConvertToSWAV(SWAR.Read(swar));
string[] swav = new string[archivos.Length];
Folder carpeta = new Folder();
@ -396,6 +440,41 @@ namespace SDAT
treeFiles.SelectedNode.Expand();
}
private void btnImport_Click(object sender, EventArgs e)
{
Sound selectedFile = SearchFile();
String fileout = pluginHost.Get_TempFolder() + Path.DirectorySeparatorChar + Path.GetRandomFileName();
OpenFileDialog o = new OpenFileDialog();
o.CheckFileExists = true;
o.AddExtension = true;
o.DefaultExt = "wav";
o.Filter = "WAVE audio format (*.wav)|*.wav";
if (o.ShowDialog() != DialogResult.OK)
return;
String filein = o.FileName;
switch (selectedFile.type)
{
case FormatSound.STRM:
sWAV wav = WAV.Read(filein);
sSTRM strm = STRM.ConvertToSTRM(wav);
STRM.Write(strm, fileout);
break;
case FormatSound.SSEQ:
case FormatSound.SSAR:
case FormatSound.SBNK:
case FormatSound.SWAV:
case FormatSound.SWAR:
default:
break;
}
if (!File.Exists(fileout))
return;
ChangeFile((int)selectedFile.id, fileout);
}
private void btnWav_Click(object sender, EventArgs e)
{
@ -403,7 +482,7 @@ namespace SDAT
SaveFileDialog o = new SaveFileDialog();
o.FileName = SearchFile().name;
o.Filter = "Sonido WAVE (*.wav)|*.wav";
o.Filter = "WAVE (*.wav)|*.wav";
if (o.ShowDialog() == DialogResult.OK)
{
string wavSaved = o.FileName;
@ -411,10 +490,10 @@ namespace SDAT
switch(SearchFile().type)
{
case FormatSound.SWAV:
WAV.EscribirArchivo(SWAV.ConvertirAWAV(SWAV.LeerArchivo(sound)), wavSaved);
WAV.Write(SWAV.ConvertirAWAV(SWAV.LeerArchivo(sound)), wavSaved);
break;
case FormatSound.STRM:
WAV.EscribirArchivo(STRM.ConvertirAWAV(STRM.LeerArchivo(sound), false), wavSaved);
WAV.Write(STRM.ConvertToWAV(STRM.Read(sound), false), wavSaved);
break;
}
}
@ -440,11 +519,11 @@ namespace SDAT
switch(SearchFile().type)
{
case FormatSound.SWAV:
WAV.EscribirArchivo(SWAV.ConvertirAWAV(SWAV.LeerArchivo(sound)), wavFile);
WAV.Write(SWAV.ConvertirAWAV(SWAV.LeerArchivo(sound)), wavFile);
break;
case FormatSound.STRM:
WAV.EscribirArchivo(STRM.ConvertirAWAV(STRM.LeerArchivo(sound), false), wavFile);
WAV.EscribirArchivo(STRM.ConvertirAWAV(STRM.LeerArchivo(sound), true), loopFile);
WAV.Write(STRM.ConvertToWAV(STRM.Read(sound), false), wavFile);
WAV.Write(STRM.ConvertToWAV(STRM.Read(sound), true), loopFile);
break;
}
@ -506,6 +585,9 @@ namespace SDAT
return file;
}
private void Save_NewSDAT(string fileout)
{
}
}
}

View File

@ -125,7 +125,7 @@
AAEAAAD/////AQAAAAAAAAAMAgAAAFdTeXN0ZW0uV2luZG93cy5Gb3JtcywgVmVyc2lvbj00LjAuMC4w
LCBDdWx0dXJlPW5ldXRyYWwsIFB1YmxpY0tleVRva2VuPWI3N2E1YzU2MTkzNGUwODkFAQAAACZTeXN0
ZW0uV2luZG93cy5Gb3Jtcy5JbWFnZUxpc3RTdHJlYW1lcgEAAAAERGF0YQcCAgAAAAkDAAAADwMAAAAM
EQAAAk1TRnQBSQFMAgEBCQEAAUABAAFAAQABEAEAARABAAT/AQkBAAj/AUIBTQE2AQQGAAE2AQQCAAEo
EQAAAk1TRnQBSQFMAgEBCQEAAXABAAFwAQABEAEAARABAAT/AQkBAAj/AUIBTQE2AQQGAAE2AQQCAAEo
AwABQAMAATADAAEBAQABCAYAAQwYAAGAAgABgAMAAoABAAGAAwABgAEAAYABAAKAAgADwAEAAcAB3AHA
AQAB8AHKAaYBAAEzBQABMwEAATMBAAEzAQACMwIAAxYBAAMcAQADIgEAAykBAANVAQADTQEAA0IBAAM5
AQABgAF8Af8BAAJQAf8BAAGTAQAB1gEAAf8B7AHMAQABxgHWAe8BAAHWAucBAAGQAakBrQIAAf8BMwMA

View File

@ -18,6 +18,9 @@
<S09>Mensaje:</S09>
<S0A></S0A>
<S0B>No</S0B>
<S0C>Detectado archivo de texto <b>MESGbmg1</b>. Analizando...</S0C>
<S0D>Contiene {0} mensajes.</S0D>
<S0E>Datos desconocidos {0}, {1}</S0E>
</BMG>
</Español>
<English>
@ -38,6 +41,9 @@
<S09>Message:</S09>
<S0A>Yes</S0A>
<S0B>No</S0B>
<S0C>File text <b>MESGbmg1</b> detected.</S0C>
<S0D>There are {0} messages.</S0D>
<S0E>Unknown data: {0}, {1}</S0E>
</BMG>
</English>
<Français>
@ -58,6 +64,9 @@
<S09>Message :</S09>
<S0A>Oui</S0A>
<S0B>Non</S0B>
<S0C>File text <b>MESGbmg1</b> detected.</S0C>
<S0D>There are {0} messages.</S0D>
<S0E>Unknown data: {0}, {1}</S0E>
</BMG>
</Français>
</Language>

View File

@ -9,18 +9,21 @@ namespace TXT
{
public class bmg
{
IPluginHost iPluginHost;
IPluginHost pluginHost;
string archivo;
public bmg(IPluginHost iPluginHost, string file)
{
this.iPluginHost = iPluginHost;
this.pluginHost = iPluginHost;
this.archivo = file;
}
public System.Windows.Forms.Control ShowInfo()
{
Console.WriteLine("Detectado archivo de texto <b>MESGbmg1</b>. Analizando...");
System.Xml.Linq.XElement xml = System.Xml.Linq.XElement.Load(System.Windows.Forms.Application.StartupPath + "\\Plugins\\TXTLang.xml");
xml = xml.Element(pluginHost.Get_Language()).Element("BMG");
Console.WriteLine(xml.Element("S0C").Value);
sBMG bmg = new sBMG();
BinaryReader br = new BinaryReader(new FileStream(archivo, FileMode.Open));
@ -42,11 +45,11 @@ namespace TXT
bmg.inf1.magicID = br.ReadChars(4);
bmg.inf1.length = br.ReadUInt32();
bmg.inf1.nMsg = br.ReadUInt16();
Console.WriteLine("Contiene {0} mensajes", bmg.inf1.nMsg.ToString());
Console.WriteLine(xml.Element("S0D").Value, bmg.inf1.nMsg.ToString());
bmg.inf1.offsetLength = br.ReadUInt16();
bmg.inf1.unknown1 = br.ReadUInt16();
bmg.inf1.unknown2 = br.ReadUInt16();
Console.WriteLine("Datos desconocidos {0}, {1}", bmg.inf1.unknown1, bmg.inf1.unknown2);
Console.WriteLine(xml.Element("S0E").Value, bmg.inf1.unknown1, bmg.inf1.unknown2);
bmg.inf1.offset = new uint[bmg.inf1.nMsg];
if (bmg.inf1.offsetLength == 0x08)
@ -101,7 +104,7 @@ namespace TXT
}
br.Close();
return new iBMG(iPluginHost, bmg);
return new iBMG(pluginHost, bmg);
}
public System.Windows.Forms.Control ShowInfo_BigEndian()
{
@ -176,7 +179,7 @@ namespace TXT
}
br.Close();
return new iBMG(iPluginHost, bmg);
return new iBMG(pluginHost, bmg);
}
}

View File

@ -30,9 +30,14 @@ namespace TXT
txtBox.Text = Descodificar(Encoding.Unicode);
comboEncod.SelectedIndex = 1;
}
else
else if (BitConverter.ToUInt16(text, 0) == 0xBBEF)
{
txtBox.Text = Descodificar(Encoding.UTF8);
comboEncod.SelectedIndex = 4;
}
else
{
txtBox.Text = Descodificar(Encoding.UTF7);
comboEncod.SelectedIndex = 0;
}

View File

@ -387,8 +387,10 @@ namespace Tinke
NCLR paleta = Imagen_NCLR.Leer_Basico(tempFile, idSelect);
pluginHost.Set_NCLR(paleta);
File.Delete(tempFile);
return new iNCLR(paleta, pluginHost);
iNCLR control = new iNCLR(paleta, pluginHost);
control.btnImport.Enabled = false;
return control;
}
else if (formato == Formato.Imagen)
{

View File

@ -256,9 +256,9 @@ namespace Tinke
this.label8.Font = new System.Drawing.Font("Consolas", 10F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.label8.Location = new System.Drawing.Point(36, 314);
this.label8.Name = "label8";
this.label8.Size = new System.Drawing.Size(336, 17);
this.label8.Size = new System.Drawing.Size(352, 17);
this.label8.TabIndex = 19;
this.label8.Text = "ana1is1a rafael1193 go11um Odnetnin I";
this.label8.Text = "ana1is1a rafael1193 go11um Odnetnin I";
//
// lblTrad
//
@ -274,7 +274,7 @@ namespace Tinke
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(435, 340);
this.ClientSize = new System.Drawing.Size(498, 340);
this.Controls.Add(this.lblTrad);
this.Controls.Add(this.label8);
this.Controls.Add(this.label7);

940
Tinke/EditRomInfo.Designer.cs generated Normal file
View File

@ -0,0 +1,940 @@
namespace Tinke
{
partial class EditRomInfo
{
/// <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(EditRomInfo));
this.groupHeader = new System.Windows.Forms.GroupBox();
this.lblEncryptionSeed = new System.Windows.Forms.Label();
this.numericEncryptionSeed = new System.Windows.Forms.NumericUpDown();
this.lblDebugRamAddress = new System.Windows.Forms.Label();
this.numericDebugRamAddress = new System.Windows.Forms.NumericUpDown();
this.lblDebugSize = new System.Windows.Forms.Label();
this.numericDebugSize = new System.Windows.Forms.NumericUpDown();
this.lblDebugRomOffset = new System.Windows.Forms.Label();
this.numericDebugRomOffset = new System.Windows.Forms.NumericUpDown();
this.lblArm7Autoload = new System.Windows.Forms.Label();
this.numericArm7Autoload = new System.Windows.Forms.NumericUpDown();
this.lblArm9Autoload = new System.Windows.Forms.Label();
this.numericArm9Autoload = new System.Windows.Forms.NumericUpDown();
this.txtReserved2 = new System.Windows.Forms.TextBox();
this.lblReserved2 = new System.Windows.Forms.Label();
this.lblReserved3 = new System.Windows.Forms.Label();
this.numericReserved3 = new System.Windows.Forms.NumericUpDown();
this.lblSecureDisable = new System.Windows.Forms.Label();
this.numericSecureDisable = new System.Windows.Forms.NumericUpDown();
this.lblRomTimeout = new System.Windows.Forms.Label();
this.numericRomTimeout = new System.Windows.Forms.NumericUpDown();
this.btnShowMakerCode = new System.Windows.Forms.Button();
this.lblFlagsInit = new System.Windows.Forms.Label();
this.numericFlagsInit = new System.Windows.Forms.NumericUpDown();
this.lblFlagsRead = new System.Windows.Forms.Label();
this.numericFlagsRead = new System.Windows.Forms.NumericUpDown();
this.lblArm7Ram = new System.Windows.Forms.Label();
this.numericArm7Ram = new System.Windows.Forms.NumericUpDown();
this.lblArm7Entry = new System.Windows.Forms.Label();
this.numericArm7Entry = new System.Windows.Forms.NumericUpDown();
this.lblArm9Ram = new System.Windows.Forms.Label();
this.numericArm9Ram = new System.Windows.Forms.NumericUpDown();
this.lblArm9Entry = new System.Windows.Forms.Label();
this.numericArm9Entry = new System.Windows.Forms.NumericUpDown();
this.lblInternalFlag = new System.Windows.Forms.Label();
this.numericInternalFlag = new System.Windows.Forms.NumericUpDown();
this.numericROMVer = new System.Windows.Forms.NumericUpDown();
this.lblROMVer = new System.Windows.Forms.Label();
this.txtReserved = new System.Windows.Forms.TextBox();
this.lblReserved = new System.Windows.Forms.Label();
this.lblUnitCode = new System.Windows.Forms.Label();
this.numericUnitCode = new System.Windows.Forms.NumericUpDown();
this.lblMakerCode = new System.Windows.Forms.Label();
this.txtMakerCode = new System.Windows.Forms.TextBox();
this.lblGameCode = new System.Windows.Forms.Label();
this.txtGameCode = new System.Windows.Forms.TextBox();
this.txtGameTitle = new System.Windows.Forms.TextBox();
this.lblGameTitle = new System.Windows.Forms.Label();
this.groupBanner = new System.Windows.Forms.GroupBox();
this.numericBanVer = new System.Windows.Forms.NumericUpDown();
this.txtBanReserved = new System.Windows.Forms.TextBox();
this.txtTitles = new System.Windows.Forms.TextBox();
this.lblBanReserved = new System.Windows.Forms.Label();
this.lblBanTitles = new System.Windows.Forms.Label();
this.comboBanTitles = new System.Windows.Forms.ComboBox();
this.lblBanVer = new System.Windows.Forms.Label();
this.btnImage = new System.Windows.Forms.Button();
this.txtImage = new System.Windows.Forms.TextBox();
this.btnSave = new System.Windows.Forms.Button();
this.btnCancel = new System.Windows.Forms.Button();
this.groupHeader.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.numericEncryptionSeed)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.numericDebugRamAddress)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.numericDebugSize)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.numericDebugRomOffset)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.numericArm7Autoload)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.numericArm9Autoload)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.numericReserved3)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.numericSecureDisable)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.numericRomTimeout)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.numericFlagsInit)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.numericFlagsRead)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.numericArm7Ram)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.numericArm7Entry)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.numericArm9Ram)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.numericArm9Entry)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.numericInternalFlag)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.numericROMVer)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.numericUnitCode)).BeginInit();
this.groupBanner.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.numericBanVer)).BeginInit();
this.SuspendLayout();
//
// groupHeader
//
this.groupHeader.Controls.Add(this.lblEncryptionSeed);
this.groupHeader.Controls.Add(this.numericEncryptionSeed);
this.groupHeader.Controls.Add(this.lblDebugRamAddress);
this.groupHeader.Controls.Add(this.numericDebugRamAddress);
this.groupHeader.Controls.Add(this.lblDebugSize);
this.groupHeader.Controls.Add(this.numericDebugSize);
this.groupHeader.Controls.Add(this.lblDebugRomOffset);
this.groupHeader.Controls.Add(this.numericDebugRomOffset);
this.groupHeader.Controls.Add(this.lblArm7Autoload);
this.groupHeader.Controls.Add(this.numericArm7Autoload);
this.groupHeader.Controls.Add(this.lblArm9Autoload);
this.groupHeader.Controls.Add(this.numericArm9Autoload);
this.groupHeader.Controls.Add(this.txtReserved2);
this.groupHeader.Controls.Add(this.lblReserved2);
this.groupHeader.Controls.Add(this.lblReserved3);
this.groupHeader.Controls.Add(this.numericReserved3);
this.groupHeader.Controls.Add(this.lblSecureDisable);
this.groupHeader.Controls.Add(this.numericSecureDisable);
this.groupHeader.Controls.Add(this.lblRomTimeout);
this.groupHeader.Controls.Add(this.numericRomTimeout);
this.groupHeader.Controls.Add(this.btnShowMakerCode);
this.groupHeader.Controls.Add(this.lblFlagsInit);
this.groupHeader.Controls.Add(this.numericFlagsInit);
this.groupHeader.Controls.Add(this.lblFlagsRead);
this.groupHeader.Controls.Add(this.numericFlagsRead);
this.groupHeader.Controls.Add(this.lblArm7Ram);
this.groupHeader.Controls.Add(this.numericArm7Ram);
this.groupHeader.Controls.Add(this.lblArm7Entry);
this.groupHeader.Controls.Add(this.numericArm7Entry);
this.groupHeader.Controls.Add(this.lblArm9Ram);
this.groupHeader.Controls.Add(this.numericArm9Ram);
this.groupHeader.Controls.Add(this.lblArm9Entry);
this.groupHeader.Controls.Add(this.numericArm9Entry);
this.groupHeader.Controls.Add(this.lblInternalFlag);
this.groupHeader.Controls.Add(this.numericInternalFlag);
this.groupHeader.Controls.Add(this.numericROMVer);
this.groupHeader.Controls.Add(this.lblROMVer);
this.groupHeader.Controls.Add(this.txtReserved);
this.groupHeader.Controls.Add(this.lblReserved);
this.groupHeader.Controls.Add(this.lblUnitCode);
this.groupHeader.Controls.Add(this.numericUnitCode);
this.groupHeader.Controls.Add(this.lblMakerCode);
this.groupHeader.Controls.Add(this.txtMakerCode);
this.groupHeader.Controls.Add(this.lblGameCode);
this.groupHeader.Controls.Add(this.txtGameCode);
this.groupHeader.Controls.Add(this.txtGameTitle);
this.groupHeader.Controls.Add(this.lblGameTitle);
this.groupHeader.Location = new System.Drawing.Point(1, 12);
this.groupHeader.Name = "groupHeader";
this.groupHeader.Size = new System.Drawing.Size(589, 448);
this.groupHeader.TabIndex = 2;
this.groupHeader.TabStop = false;
this.groupHeader.Text = "S03";
//
// lblEncryptionSeed
//
this.lblEncryptionSeed.AutoSize = true;
this.lblEncryptionSeed.Location = new System.Drawing.Point(282, 343);
this.lblEncryptionSeed.Name = "lblEncryptionSeed";
this.lblEncryptionSeed.Size = new System.Drawing.Size(26, 13);
this.lblEncryptionSeed.TabIndex = 46;
this.lblEncryptionSeed.Text = "S27";
//
// numericEncryptionSeed
//
this.numericEncryptionSeed.Hexadecimal = true;
this.numericEncryptionSeed.Location = new System.Drawing.Point(472, 340);
this.numericEncryptionSeed.Maximum = new decimal(new int[] {
255,
0,
0,
0});
this.numericEncryptionSeed.Name = "numericEncryptionSeed";
this.numericEncryptionSeed.Size = new System.Drawing.Size(100, 20);
this.numericEncryptionSeed.TabIndex = 45;
this.numericEncryptionSeed.ValueChanged += new System.EventHandler(this.numericEncryptionSeed_ValueChanged);
//
// lblDebugRamAddress
//
this.lblDebugRamAddress.AutoSize = true;
this.lblDebugRamAddress.Location = new System.Drawing.Point(280, 317);
this.lblDebugRamAddress.Name = "lblDebugRamAddress";
this.lblDebugRamAddress.Size = new System.Drawing.Size(26, 13);
this.lblDebugRamAddress.TabIndex = 44;
this.lblDebugRamAddress.Text = "S25";
//
// numericDebugRamAddress
//
this.numericDebugRamAddress.Hexadecimal = true;
this.numericDebugRamAddress.Location = new System.Drawing.Point(472, 314);
this.numericDebugRamAddress.Maximum = new decimal(new int[] {
-1,
0,
0,
0});
this.numericDebugRamAddress.Name = "numericDebugRamAddress";
this.numericDebugRamAddress.Size = new System.Drawing.Size(100, 20);
this.numericDebugRamAddress.TabIndex = 43;
this.numericDebugRamAddress.ValueChanged += new System.EventHandler(this.numericDebugRamAddress_ValueChanged);
//
// lblDebugSize
//
this.lblDebugSize.AutoSize = true;
this.lblDebugSize.Location = new System.Drawing.Point(280, 291);
this.lblDebugSize.Name = "lblDebugSize";
this.lblDebugSize.Size = new System.Drawing.Size(26, 13);
this.lblDebugSize.TabIndex = 42;
this.lblDebugSize.Text = "S24";
//
// numericDebugSize
//
this.numericDebugSize.Hexadecimal = true;
this.numericDebugSize.Location = new System.Drawing.Point(472, 288);
this.numericDebugSize.Maximum = new decimal(new int[] {
-1,
0,
0,
0});
this.numericDebugSize.Name = "numericDebugSize";
this.numericDebugSize.Size = new System.Drawing.Size(100, 20);
this.numericDebugSize.TabIndex = 41;
this.numericDebugSize.ValueChanged += new System.EventHandler(this.numericDebugSize_ValueChanged);
//
// lblDebugRomOffset
//
this.lblDebugRomOffset.AutoSize = true;
this.lblDebugRomOffset.Location = new System.Drawing.Point(280, 265);
this.lblDebugRomOffset.Name = "lblDebugRomOffset";
this.lblDebugRomOffset.Size = new System.Drawing.Size(26, 13);
this.lblDebugRomOffset.TabIndex = 40;
this.lblDebugRomOffset.Text = "S23";
//
// numericDebugRomOffset
//
this.numericDebugRomOffset.Hexadecimal = true;
this.numericDebugRomOffset.Location = new System.Drawing.Point(472, 262);
this.numericDebugRomOffset.Maximum = new decimal(new int[] {
-1,
0,
0,
0});
this.numericDebugRomOffset.Name = "numericDebugRomOffset";
this.numericDebugRomOffset.Size = new System.Drawing.Size(100, 20);
this.numericDebugRomOffset.TabIndex = 39;
this.numericDebugRomOffset.ValueChanged += new System.EventHandler(this.numericDebugRomOffset_ValueChanged);
//
// lblArm7Autoload
//
this.lblArm7Autoload.AutoSize = true;
this.lblArm7Autoload.Location = new System.Drawing.Point(282, 112);
this.lblArm7Autoload.Name = "lblArm7Autoload";
this.lblArm7Autoload.Size = new System.Drawing.Size(26, 13);
this.lblArm7Autoload.TabIndex = 38;
this.lblArm7Autoload.Text = "S22";
//
// numericArm7Autoload
//
this.numericArm7Autoload.Hexadecimal = true;
this.numericArm7Autoload.Location = new System.Drawing.Point(472, 109);
this.numericArm7Autoload.Maximum = new decimal(new int[] {
-1,
0,
0,
0});
this.numericArm7Autoload.Name = "numericArm7Autoload";
this.numericArm7Autoload.Size = new System.Drawing.Size(100, 20);
this.numericArm7Autoload.TabIndex = 37;
this.numericArm7Autoload.ValueChanged += new System.EventHandler(this.numericArm7Autoload_ValueChanged);
//
// lblArm9Autoload
//
this.lblArm9Autoload.AutoSize = true;
this.lblArm9Autoload.Location = new System.Drawing.Point(282, 86);
this.lblArm9Autoload.Name = "lblArm9Autoload";
this.lblArm9Autoload.Size = new System.Drawing.Size(26, 13);
this.lblArm9Autoload.TabIndex = 36;
this.lblArm9Autoload.Text = "S21";
//
// numericArm9Autoload
//
this.numericArm9Autoload.Hexadecimal = true;
this.numericArm9Autoload.Location = new System.Drawing.Point(472, 83);
this.numericArm9Autoload.Maximum = new decimal(new int[] {
-1,
0,
0,
0});
this.numericArm9Autoload.Name = "numericArm9Autoload";
this.numericArm9Autoload.Size = new System.Drawing.Size(100, 20);
this.numericArm9Autoload.TabIndex = 35;
this.numericArm9Autoload.ValueChanged += new System.EventHandler(this.numericArm9Autoload_ValueChanged);
//
// txtReserved2
//
this.txtReserved2.CharacterCasing = System.Windows.Forms.CharacterCasing.Upper;
this.txtReserved2.Location = new System.Drawing.Point(284, 160);
this.txtReserved2.MaxLength = 112;
this.txtReserved2.Multiline = true;
this.txtReserved2.Name = "txtReserved2";
this.txtReserved2.Size = new System.Drawing.Size(299, 62);
this.txtReserved2.TabIndex = 34;
this.txtReserved2.Leave += new System.EventHandler(this.txtReserved2_Leave);
//
// lblReserved2
//
this.lblReserved2.AutoSize = true;
this.lblReserved2.Location = new System.Drawing.Point(281, 140);
this.lblReserved2.Name = "lblReserved2";
this.lblReserved2.Size = new System.Drawing.Size(26, 13);
this.lblReserved2.TabIndex = 33;
this.lblReserved2.Text = "S20";
//
// lblReserved3
//
this.lblReserved3.AutoSize = true;
this.lblReserved3.Location = new System.Drawing.Point(281, 237);
this.lblReserved3.Name = "lblReserved3";
this.lblReserved3.Size = new System.Drawing.Size(26, 13);
this.lblReserved3.TabIndex = 32;
this.lblReserved3.Text = "S1F";
//
// numericReserved3
//
this.numericReserved3.Hexadecimal = true;
this.numericReserved3.Location = new System.Drawing.Point(472, 234);
this.numericReserved3.Maximum = new decimal(new int[] {
-1,
0,
0,
0});
this.numericReserved3.Name = "numericReserved3";
this.numericReserved3.Size = new System.Drawing.Size(100, 20);
this.numericReserved3.TabIndex = 31;
this.numericReserved3.ValueChanged += new System.EventHandler(this.numericReserved3_ValueChanged);
//
// lblSecureDisable
//
this.lblSecureDisable.AutoSize = true;
this.lblSecureDisable.Location = new System.Drawing.Point(281, 60);
this.lblSecureDisable.Name = "lblSecureDisable";
this.lblSecureDisable.Size = new System.Drawing.Size(27, 13);
this.lblSecureDisable.TabIndex = 30;
this.lblSecureDisable.Text = "S1E";
//
// numericSecureDisable
//
this.numericSecureDisable.Hexadecimal = true;
this.numericSecureDisable.Location = new System.Drawing.Point(472, 57);
this.numericSecureDisable.Maximum = new decimal(new int[] {
-1,
2147483647,
0,
0});
this.numericSecureDisable.Name = "numericSecureDisable";
this.numericSecureDisable.Size = new System.Drawing.Size(100, 20);
this.numericSecureDisable.TabIndex = 29;
this.numericSecureDisable.ValueChanged += new System.EventHandler(this.numericSecureDisable_ValueChanged);
//
// lblRomTimeout
//
this.lblRomTimeout.AutoSize = true;
this.lblRomTimeout.Location = new System.Drawing.Point(281, 34);
this.lblRomTimeout.Name = "lblRomTimeout";
this.lblRomTimeout.Size = new System.Drawing.Size(28, 13);
this.lblRomTimeout.TabIndex = 28;
this.lblRomTimeout.Text = "S1D";
//
// numericRomTimeout
//
this.numericRomTimeout.Hexadecimal = true;
this.numericRomTimeout.Location = new System.Drawing.Point(472, 31);
this.numericRomTimeout.Maximum = new decimal(new int[] {
65535,
0,
0,
0});
this.numericRomTimeout.Name = "numericRomTimeout";
this.numericRomTimeout.Size = new System.Drawing.Size(100, 20);
this.numericRomTimeout.TabIndex = 27;
this.numericRomTimeout.ValueChanged += new System.EventHandler(this.numericRomTimeout_ValueChanged);
//
// btnShowMakerCode
//
this.btnShowMakerCode.Location = new System.Drawing.Point(324, 408);
this.btnShowMakerCode.Name = "btnShowMakerCode";
this.btnShowMakerCode.Size = new System.Drawing.Size(169, 34);
this.btnShowMakerCode.TabIndex = 26;
this.btnShowMakerCode.Text = "S1C";
this.btnShowMakerCode.UseVisualStyleBackColor = true;
this.btnShowMakerCode.Click += new System.EventHandler(this.btnShowMakerCode_Click);
//
// lblFlagsInit
//
this.lblFlagsInit.AutoSize = true;
this.lblFlagsInit.Location = new System.Drawing.Point(6, 392);
this.lblFlagsInit.Name = "lblFlagsInit";
this.lblFlagsInit.Size = new System.Drawing.Size(27, 13);
this.lblFlagsInit.TabIndex = 25;
this.lblFlagsInit.Text = "S1B";
//
// numericFlagsInit
//
this.numericFlagsInit.Hexadecimal = true;
this.numericFlagsInit.Location = new System.Drawing.Point(175, 391);
this.numericFlagsInit.Maximum = new decimal(new int[] {
-1,
0,
0,
0});
this.numericFlagsInit.Name = "numericFlagsInit";
this.numericFlagsInit.Size = new System.Drawing.Size(100, 20);
this.numericFlagsInit.TabIndex = 24;
this.numericFlagsInit.ValueChanged += new System.EventHandler(this.numericFlagsInit_ValueChanged);
//
// lblFlagsRead
//
this.lblFlagsRead.AutoSize = true;
this.lblFlagsRead.Location = new System.Drawing.Point(6, 366);
this.lblFlagsRead.Name = "lblFlagsRead";
this.lblFlagsRead.Size = new System.Drawing.Size(27, 13);
this.lblFlagsRead.TabIndex = 23;
this.lblFlagsRead.Text = "S1A";
//
// numericFlagsRead
//
this.numericFlagsRead.Hexadecimal = true;
this.numericFlagsRead.Location = new System.Drawing.Point(175, 365);
this.numericFlagsRead.Maximum = new decimal(new int[] {
-1,
0,
0,
0});
this.numericFlagsRead.Name = "numericFlagsRead";
this.numericFlagsRead.Size = new System.Drawing.Size(100, 20);
this.numericFlagsRead.TabIndex = 22;
this.numericFlagsRead.ValueChanged += new System.EventHandler(this.numericFlagsRead_ValueChanged);
//
// lblArm7Ram
//
this.lblArm7Ram.AutoSize = true;
this.lblArm7Ram.Location = new System.Drawing.Point(6, 340);
this.lblArm7Ram.Name = "lblArm7Ram";
this.lblArm7Ram.Size = new System.Drawing.Size(26, 13);
this.lblArm7Ram.TabIndex = 21;
this.lblArm7Ram.Text = "S19";
//
// numericArm7Ram
//
this.numericArm7Ram.Hexadecimal = true;
this.numericArm7Ram.Location = new System.Drawing.Point(175, 339);
this.numericArm7Ram.Maximum = new decimal(new int[] {
-1,
0,
0,
0});
this.numericArm7Ram.Name = "numericArm7Ram";
this.numericArm7Ram.Size = new System.Drawing.Size(100, 20);
this.numericArm7Ram.TabIndex = 20;
this.numericArm7Ram.ValueChanged += new System.EventHandler(this.numericArm7Ram_ValueChanged);
//
// lblArm7Entry
//
this.lblArm7Entry.AutoSize = true;
this.lblArm7Entry.Location = new System.Drawing.Point(6, 314);
this.lblArm7Entry.Name = "lblArm7Entry";
this.lblArm7Entry.Size = new System.Drawing.Size(26, 13);
this.lblArm7Entry.TabIndex = 19;
this.lblArm7Entry.Text = "S18";
//
// numericArm7Entry
//
this.numericArm7Entry.Hexadecimal = true;
this.numericArm7Entry.Location = new System.Drawing.Point(175, 313);
this.numericArm7Entry.Maximum = new decimal(new int[] {
-1,
0,
0,
0});
this.numericArm7Entry.Name = "numericArm7Entry";
this.numericArm7Entry.Size = new System.Drawing.Size(100, 20);
this.numericArm7Entry.TabIndex = 18;
this.numericArm7Entry.ValueChanged += new System.EventHandler(this.numericArm7Entry_ValueChanged);
//
// lblArm9Ram
//
this.lblArm9Ram.AutoSize = true;
this.lblArm9Ram.Location = new System.Drawing.Point(6, 288);
this.lblArm9Ram.Name = "lblArm9Ram";
this.lblArm9Ram.Size = new System.Drawing.Size(26, 13);
this.lblArm9Ram.TabIndex = 17;
this.lblArm9Ram.Text = "S17";
//
// numericArm9Ram
//
this.numericArm9Ram.Hexadecimal = true;
this.numericArm9Ram.Location = new System.Drawing.Point(175, 287);
this.numericArm9Ram.Maximum = new decimal(new int[] {
-1,
0,
0,
0});
this.numericArm9Ram.Name = "numericArm9Ram";
this.numericArm9Ram.Size = new System.Drawing.Size(100, 20);
this.numericArm9Ram.TabIndex = 16;
this.numericArm9Ram.ValueChanged += new System.EventHandler(this.numericArm9Ram_ValueChanged);
//
// lblArm9Entry
//
this.lblArm9Entry.AutoSize = true;
this.lblArm9Entry.Location = new System.Drawing.Point(6, 262);
this.lblArm9Entry.Name = "lblArm9Entry";
this.lblArm9Entry.Size = new System.Drawing.Size(26, 13);
this.lblArm9Entry.TabIndex = 15;
this.lblArm9Entry.Text = "S16";
//
// numericArm9Entry
//
this.numericArm9Entry.Hexadecimal = true;
this.numericArm9Entry.Location = new System.Drawing.Point(175, 261);
this.numericArm9Entry.Maximum = new decimal(new int[] {
-1,
0,
0,
0});
this.numericArm9Entry.Name = "numericArm9Entry";
this.numericArm9Entry.Size = new System.Drawing.Size(100, 20);
this.numericArm9Entry.TabIndex = 14;
this.numericArm9Entry.ValueChanged += new System.EventHandler(this.numericArm9Entry_ValueChanged);
//
// lblInternalFlag
//
this.lblInternalFlag.AutoSize = true;
this.lblInternalFlag.Location = new System.Drawing.Point(6, 236);
this.lblInternalFlag.Name = "lblInternalFlag";
this.lblInternalFlag.Size = new System.Drawing.Size(26, 13);
this.lblInternalFlag.TabIndex = 13;
this.lblInternalFlag.Text = "S15";
//
// numericInternalFlag
//
this.numericInternalFlag.Hexadecimal = true;
this.numericInternalFlag.Location = new System.Drawing.Point(175, 235);
this.numericInternalFlag.Maximum = new decimal(new int[] {
255,
0,
0,
0});
this.numericInternalFlag.Name = "numericInternalFlag";
this.numericInternalFlag.Size = new System.Drawing.Size(100, 20);
this.numericInternalFlag.TabIndex = 12;
this.numericInternalFlag.ValueChanged += new System.EventHandler(this.numericInternalFlag_ValueChanged);
//
// numericROMVer
//
this.numericROMVer.Hexadecimal = true;
this.numericROMVer.Location = new System.Drawing.Point(175, 208);
this.numericROMVer.Maximum = new decimal(new int[] {
255,
0,
0,
0});
this.numericROMVer.Name = "numericROMVer";
this.numericROMVer.Size = new System.Drawing.Size(100, 20);
this.numericROMVer.TabIndex = 11;
this.numericROMVer.ValueChanged += new System.EventHandler(this.numericROMVer_ValueChanged);
//
// lblROMVer
//
this.lblROMVer.AutoSize = true;
this.lblROMVer.Location = new System.Drawing.Point(6, 209);
this.lblROMVer.Name = "lblROMVer";
this.lblROMVer.Size = new System.Drawing.Size(26, 13);
this.lblROMVer.TabIndex = 10;
this.lblROMVer.Text = "S14";
//
// txtReserved
//
this.txtReserved.CharacterCasing = System.Windows.Forms.CharacterCasing.Upper;
this.txtReserved.Location = new System.Drawing.Point(9, 158);
this.txtReserved.MaxLength = 18;
this.txtReserved.Multiline = true;
this.txtReserved.Name = "txtReserved";
this.txtReserved.Size = new System.Drawing.Size(266, 37);
this.txtReserved.TabIndex = 9;
this.txtReserved.Leave += new System.EventHandler(this.txtReserved_Leave);
//
// lblReserved
//
this.lblReserved.AutoSize = true;
this.lblReserved.Location = new System.Drawing.Point(6, 139);
this.lblReserved.Name = "lblReserved";
this.lblReserved.Size = new System.Drawing.Size(26, 13);
this.lblReserved.TabIndex = 8;
this.lblReserved.Text = "S13";
//
// lblUnitCode
//
this.lblUnitCode.AutoSize = true;
this.lblUnitCode.Location = new System.Drawing.Point(6, 111);
this.lblUnitCode.Name = "lblUnitCode";
this.lblUnitCode.Size = new System.Drawing.Size(26, 13);
this.lblUnitCode.TabIndex = 7;
this.lblUnitCode.Text = "S12";
//
// numericUnitCode
//
this.numericUnitCode.Hexadecimal = true;
this.numericUnitCode.Location = new System.Drawing.Point(175, 110);
this.numericUnitCode.Maximum = new decimal(new int[] {
255,
0,
0,
0});
this.numericUnitCode.Name = "numericUnitCode";
this.numericUnitCode.Size = new System.Drawing.Size(100, 20);
this.numericUnitCode.TabIndex = 6;
this.numericUnitCode.ValueChanged += new System.EventHandler(this.numericUnitCode_ValueChanged);
//
// lblMakerCode
//
this.lblMakerCode.AutoSize = true;
this.lblMakerCode.Location = new System.Drawing.Point(6, 86);
this.lblMakerCode.Name = "lblMakerCode";
this.lblMakerCode.Size = new System.Drawing.Size(26, 13);
this.lblMakerCode.TabIndex = 5;
this.lblMakerCode.Text = "S11";
//
// txtMakerCode
//
this.txtMakerCode.CharacterCasing = System.Windows.Forms.CharacterCasing.Upper;
this.txtMakerCode.Location = new System.Drawing.Point(175, 84);
this.txtMakerCode.MaxLength = 2;
this.txtMakerCode.Name = "txtMakerCode";
this.txtMakerCode.Size = new System.Drawing.Size(100, 20);
this.txtMakerCode.TabIndex = 4;
this.txtMakerCode.TextChanged += new System.EventHandler(this.txtMakerCode_TextChanged);
//
// lblGameCode
//
this.lblGameCode.AutoSize = true;
this.lblGameCode.Location = new System.Drawing.Point(6, 60);
this.lblGameCode.Name = "lblGameCode";
this.lblGameCode.Size = new System.Drawing.Size(26, 13);
this.lblGameCode.TabIndex = 3;
this.lblGameCode.Text = "S10";
//
// txtGameCode
//
this.txtGameCode.CharacterCasing = System.Windows.Forms.CharacterCasing.Upper;
this.txtGameCode.Location = new System.Drawing.Point(175, 58);
this.txtGameCode.MaxLength = 4;
this.txtGameCode.Name = "txtGameCode";
this.txtGameCode.Size = new System.Drawing.Size(100, 20);
this.txtGameCode.TabIndex = 2;
this.txtGameCode.TextChanged += new System.EventHandler(this.txtGameCode_TextChanged);
//
// txtGameTitle
//
this.txtGameTitle.CharacterCasing = System.Windows.Forms.CharacterCasing.Upper;
this.txtGameTitle.Location = new System.Drawing.Point(175, 31);
this.txtGameTitle.MaxLength = 12;
this.txtGameTitle.Name = "txtGameTitle";
this.txtGameTitle.Size = new System.Drawing.Size(100, 20);
this.txtGameTitle.TabIndex = 1;
this.txtGameTitle.TextChanged += new System.EventHandler(this.txtGameTitle_TextChanged);
//
// lblGameTitle
//
this.lblGameTitle.AutoSize = true;
this.lblGameTitle.Location = new System.Drawing.Point(6, 33);
this.lblGameTitle.Name = "lblGameTitle";
this.lblGameTitle.Size = new System.Drawing.Size(26, 13);
this.lblGameTitle.TabIndex = 0;
this.lblGameTitle.Text = "S0F";
//
// groupBanner
//
this.groupBanner.Controls.Add(this.numericBanVer);
this.groupBanner.Controls.Add(this.txtBanReserved);
this.groupBanner.Controls.Add(this.txtTitles);
this.groupBanner.Controls.Add(this.lblBanReserved);
this.groupBanner.Controls.Add(this.lblBanTitles);
this.groupBanner.Controls.Add(this.comboBanTitles);
this.groupBanner.Controls.Add(this.lblBanVer);
this.groupBanner.Controls.Add(this.btnImage);
this.groupBanner.Controls.Add(this.txtImage);
this.groupBanner.Location = new System.Drawing.Point(596, 12);
this.groupBanner.Name = "groupBanner";
this.groupBanner.Size = new System.Drawing.Size(198, 337);
this.groupBanner.TabIndex = 3;
this.groupBanner.TabStop = false;
this.groupBanner.Text = "S04";
//
// numericBanVer
//
this.numericBanVer.Hexadecimal = true;
this.numericBanVer.Location = new System.Drawing.Point(96, 83);
this.numericBanVer.Maximum = new decimal(new int[] {
65535,
0,
0,
0});
this.numericBanVer.Name = "numericBanVer";
this.numericBanVer.Size = new System.Drawing.Size(84, 20);
this.numericBanVer.TabIndex = 9;
//
// txtBanReserved
//
this.txtBanReserved.CharacterCasing = System.Windows.Forms.CharacterCasing.Upper;
this.txtBanReserved.Location = new System.Drawing.Point(9, 252);
this.txtBanReserved.MaxLength = 83;
this.txtBanReserved.Multiline = true;
this.txtBanReserved.Name = "txtBanReserved";
this.txtBanReserved.Size = new System.Drawing.Size(171, 75);
this.txtBanReserved.TabIndex = 8;
this.txtBanReserved.Leave += new System.EventHandler(this.txtBanReserved_Leave);
//
// txtTitles
//
this.txtTitles.Location = new System.Drawing.Point(9, 159);
this.txtTitles.MaxLength = 50;
this.txtTitles.Multiline = true;
this.txtTitles.Name = "txtTitles";
this.txtTitles.Size = new System.Drawing.Size(171, 62);
this.txtTitles.TabIndex = 7;
this.txtTitles.TextChanged += new System.EventHandler(this.txtTitles_TextChanged);
//
// lblBanReserved
//
this.lblBanReserved.AutoSize = true;
this.lblBanReserved.Location = new System.Drawing.Point(6, 236);
this.lblBanReserved.Name = "lblBanReserved";
this.lblBanReserved.Size = new System.Drawing.Size(27, 13);
this.lblBanReserved.TabIndex = 6;
this.lblBanReserved.Text = "S0E";
//
// lblBanTitles
//
this.lblBanTitles.AutoSize = true;
this.lblBanTitles.Location = new System.Drawing.Point(6, 115);
this.lblBanTitles.Name = "lblBanTitles";
this.lblBanTitles.Size = new System.Drawing.Size(26, 13);
this.lblBanTitles.TabIndex = 5;
this.lblBanTitles.Text = "S07";
//
// comboBanTitles
//
this.comboBanTitles.AutoCompleteMode = System.Windows.Forms.AutoCompleteMode.SuggestAppend;
this.comboBanTitles.AutoCompleteSource = System.Windows.Forms.AutoCompleteSource.ListItems;
this.comboBanTitles.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
this.comboBanTitles.FormattingEnabled = true;
this.comboBanTitles.Items.AddRange(new object[] {
"S08",
"S09",
"S0A",
"S0B",
"S0C",
"S0D"});
this.comboBanTitles.Location = new System.Drawing.Point(9, 131);
this.comboBanTitles.Name = "comboBanTitles";
this.comboBanTitles.Size = new System.Drawing.Size(171, 21);
this.comboBanTitles.TabIndex = 4;
this.comboBanTitles.SelectedIndexChanged += new System.EventHandler(this.comboBanTitles_SelectedIndexChanged);
//
// lblBanVer
//
this.lblBanVer.AutoSize = true;
this.lblBanVer.Location = new System.Drawing.Point(6, 85);
this.lblBanVer.Name = "lblBanVer";
this.lblBanVer.Size = new System.Drawing.Size(26, 13);
this.lblBanVer.TabIndex = 2;
this.lblBanVer.Text = "S06";
//
// btnImage
//
this.btnImage.Image = global::Tinke.Properties.Resources.picture_edit;
this.btnImage.Location = new System.Drawing.Point(96, 20);
this.btnImage.Name = "btnImage";
this.btnImage.Size = new System.Drawing.Size(84, 45);
this.btnImage.TabIndex = 1;
this.btnImage.Text = "S05";
this.btnImage.TextImageRelation = System.Windows.Forms.TextImageRelation.ImageBeforeText;
this.btnImage.UseVisualStyleBackColor = true;
this.btnImage.Click += new System.EventHandler(this.btnImage_Click);
//
// txtImage
//
this.txtImage.Location = new System.Drawing.Point(6, 33);
this.txtImage.Name = "txtImage";
this.txtImage.ReadOnly = true;
this.txtImage.Size = new System.Drawing.Size(83, 20);
this.txtImage.TabIndex = 0;
//
// btnSave
//
this.btnSave.DialogResult = System.Windows.Forms.DialogResult.OK;
this.btnSave.Image = global::Tinke.Properties.Resources.accept;
this.btnSave.Location = new System.Drawing.Point(692, 430);
this.btnSave.Name = "btnSave";
this.btnSave.Size = new System.Drawing.Size(90, 30);
this.btnSave.TabIndex = 0;
this.btnSave.Text = "S01";
this.btnSave.TextImageRelation = System.Windows.Forms.TextImageRelation.ImageBeforeText;
this.btnSave.UseVisualStyleBackColor = true;
this.btnSave.Click += new System.EventHandler(this.btnSave_Click);
//
// btnCancel
//
this.btnCancel.DialogResult = System.Windows.Forms.DialogResult.Cancel;
this.btnCancel.Image = global::Tinke.Properties.Resources.cancel;
this.btnCancel.Location = new System.Drawing.Point(596, 430);
this.btnCancel.Name = "btnCancel";
this.btnCancel.Size = new System.Drawing.Size(90, 30);
this.btnCancel.TabIndex = 1;
this.btnCancel.Text = "S02";
this.btnCancel.TextImageRelation = System.Windows.Forms.TextImageRelation.ImageBeforeText;
this.btnCancel.UseVisualStyleBackColor = true;
this.btnCancel.Click += new System.EventHandler(this.btnCancel_Click);
//
// EditRomInfo
//
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Inherit;
this.BackColor = System.Drawing.SystemColors.GradientInactiveCaption;
this.ClientSize = new System.Drawing.Size(794, 472);
this.Controls.Add(this.groupBanner);
this.Controls.Add(this.groupHeader);
this.Controls.Add(this.btnCancel);
this.Controls.Add(this.btnSave);
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog;
this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
this.MaximizeBox = false;
this.Name = "EditRomInfo";
this.Text = "S00";
this.groupHeader.ResumeLayout(false);
this.groupHeader.PerformLayout();
((System.ComponentModel.ISupportInitialize)(this.numericEncryptionSeed)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.numericDebugRamAddress)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.numericDebugSize)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.numericDebugRomOffset)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.numericArm7Autoload)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.numericArm9Autoload)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.numericReserved3)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.numericSecureDisable)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.numericRomTimeout)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.numericFlagsInit)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.numericFlagsRead)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.numericArm7Ram)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.numericArm7Entry)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.numericArm9Ram)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.numericArm9Entry)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.numericInternalFlag)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.numericROMVer)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.numericUnitCode)).EndInit();
this.groupBanner.ResumeLayout(false);
this.groupBanner.PerformLayout();
((System.ComponentModel.ISupportInitialize)(this.numericBanVer)).EndInit();
this.ResumeLayout(false);
}
#endregion
private System.Windows.Forms.Button btnSave;
private System.Windows.Forms.Button btnCancel;
private System.Windows.Forms.GroupBox groupHeader;
private System.Windows.Forms.GroupBox groupBanner;
private System.Windows.Forms.Button btnImage;
private System.Windows.Forms.TextBox txtImage;
private System.Windows.Forms.Label lblBanTitles;
private System.Windows.Forms.ComboBox comboBanTitles;
private System.Windows.Forms.Label lblBanVer;
private System.Windows.Forms.Label lblBanReserved;
private System.Windows.Forms.TextBox txtBanReserved;
private System.Windows.Forms.TextBox txtTitles;
private System.Windows.Forms.NumericUpDown numericBanVer;
private System.Windows.Forms.Label lblMakerCode;
private System.Windows.Forms.TextBox txtMakerCode;
private System.Windows.Forms.Label lblGameCode;
private System.Windows.Forms.TextBox txtGameCode;
private System.Windows.Forms.TextBox txtGameTitle;
private System.Windows.Forms.Label lblGameTitle;
private System.Windows.Forms.Label lblUnitCode;
private System.Windows.Forms.NumericUpDown numericUnitCode;
private System.Windows.Forms.TextBox txtReserved;
private System.Windows.Forms.Label lblReserved;
private System.Windows.Forms.Label lblInternalFlag;
private System.Windows.Forms.NumericUpDown numericInternalFlag;
private System.Windows.Forms.NumericUpDown numericROMVer;
private System.Windows.Forms.Label lblROMVer;
private System.Windows.Forms.Label lblArm9Entry;
private System.Windows.Forms.NumericUpDown numericArm9Entry;
private System.Windows.Forms.Label lblArm7Ram;
private System.Windows.Forms.NumericUpDown numericArm7Ram;
private System.Windows.Forms.Label lblArm7Entry;
private System.Windows.Forms.NumericUpDown numericArm7Entry;
private System.Windows.Forms.Label lblArm9Ram;
private System.Windows.Forms.NumericUpDown numericArm9Ram;
private System.Windows.Forms.Label lblFlagsInit;
private System.Windows.Forms.NumericUpDown numericFlagsInit;
private System.Windows.Forms.Label lblFlagsRead;
private System.Windows.Forms.NumericUpDown numericFlagsRead;
private System.Windows.Forms.Label lblSecureDisable;
private System.Windows.Forms.NumericUpDown numericSecureDisable;
private System.Windows.Forms.Label lblRomTimeout;
private System.Windows.Forms.NumericUpDown numericRomTimeout;
private System.Windows.Forms.Button btnShowMakerCode;
private System.Windows.Forms.Label lblReserved3;
private System.Windows.Forms.NumericUpDown numericReserved3;
private System.Windows.Forms.TextBox txtReserved2;
private System.Windows.Forms.Label lblReserved2;
private System.Windows.Forms.Label lblArm7Autoload;
private System.Windows.Forms.NumericUpDown numericArm7Autoload;
private System.Windows.Forms.Label lblArm9Autoload;
private System.Windows.Forms.NumericUpDown numericArm9Autoload;
private System.Windows.Forms.Label lblDebugSize;
private System.Windows.Forms.NumericUpDown numericDebugSize;
private System.Windows.Forms.Label lblDebugRomOffset;
private System.Windows.Forms.NumericUpDown numericDebugRomOffset;
private System.Windows.Forms.Label lblDebugRamAddress;
private System.Windows.Forms.NumericUpDown numericDebugRamAddress;
private System.Windows.Forms.Label lblEncryptionSeed;
private System.Windows.Forms.NumericUpDown numericEncryptionSeed;
}
}

404
Tinke/EditRomInfo.cs Normal file
View File

@ -0,0 +1,404 @@
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 EditRomInfo : Form
{
Nitro.Estructuras.ROMHeader header;
Nitro.Estructuras.Banner banner;
public EditRomInfo()
{
InitializeComponent();
}
public EditRomInfo(Nitro.Estructuras.ROMHeader header, Nitro.Estructuras.Banner banner)
{
InitializeComponent();
ReadLanguage();
this.header = header;
this.banner = banner;
LoadValues();
comboBanTitles.SelectedIndex = 0;
}
private void ReadLanguage()
{
System.Xml.Linq.XElement xml = Tools.Helper.ObtenerTraduccion("EditRomInfo");
this.Text = xml.Element("S00").Value;
btnSave.Text = xml.Element("S01").Value;
btnCancel.Text = xml.Element("S02").Value;
groupHeader.Text = xml.Element("S03").Value;
groupBanner.Text = xml.Element("S04").Value;
btnImage.Text = xml.Element("S05").Value;
lblBanVer.Text = xml.Element("S06").Value;
lblBanTitles.Text = xml.Element("S07").Value;
comboBanTitles.Items[0] = xml.Element("S08").Value;
comboBanTitles.Items[1] = xml.Element("S09").Value;
comboBanTitles.Items[2] = xml.Element("S0A").Value;
comboBanTitles.Items[3] = xml.Element("S0B").Value;
comboBanTitles.Items[4] = xml.Element("S0C").Value;
comboBanTitles.Items[5] = xml.Element("S0D").Value;
lblBanReserved.Text = xml.Element("S0E").Value;
lblGameTitle.Text = xml.Element("S0F").Value;
lblGameCode.Text = xml.Element("S10").Value;
lblMakerCode.Text = xml.Element("S11").Value;
lblUnitCode.Text = xml.Element("S12").Value;
lblReserved.Text = xml.Element("S13").Value;
lblROMVer.Text = xml.Element("S14").Value;
lblInternalFlag.Text = xml.Element("S15").Value;
lblArm9Entry.Text = xml.Element("S16").Value;
lblArm9Ram.Text = xml.Element("S17").Value;
lblArm7Entry.Text = xml.Element("S18").Value;
lblArm7Ram.Text = xml.Element("S19").Value;
lblFlagsRead.Text = xml.Element("S1A").Value;
lblFlagsInit.Text = xml.Element("S1B").Value;
btnShowMakerCode.Text = xml.Element("S1C").Value;
lblRomTimeout.Text = xml.Element("S1D").Value;
lblSecureDisable.Text = xml.Element("S1E").Value;
lblReserved3.Text = xml.Element("S1F").Value;
lblReserved2.Text = xml.Element("S20").Value;
lblArm9Autoload.Text = xml.Element("S21").Value;
lblArm7Autoload.Text = xml.Element("S22").Value;
lblDebugRomOffset.Text = xml.Element("S23").Value;
lblDebugSize.Text = xml.Element("S24").Value;
lblDebugRamAddress.Text = xml.Element("S25").Value;
lblEncryptionSeed.Text = xml.Element("S27").Value;
}
private void LoadValues()
{
#region Set banner values
numericBanVer.Value = banner.version;
txtBanReserved.Text = BitConverter.ToString(banner.reserved);
txtTitles.Text = banner.japaneseTitle;
#endregion
#region Set header values
txtGameTitle.Text = new String(header.gameTitle);
txtGameCode.Text = new String(header.gameCode);
txtMakerCode.Text = new String(header.makerCode);
numericUnitCode.Value = header.unitCode;
txtReserved.Text = BitConverter.ToString(header.reserved);
numericROMVer.Value = header.ROMversion;
numericInternalFlag.Value = header.internalFlags;
numericArm9Entry.Value = header.ARM9entryAddress;
numericArm9Ram.Value = header.ARM9ramAddress;
numericArm7Entry.Value = header.ARM7entryAddress;
numericArm7Ram.Value = header.ARM7ramAddress;
numericFlagsRead.Value = header.flagsRead;
numericFlagsInit.Value = header.flagsInit;
numericRomTimeout.Value = header.ROMtimeout;
numericSecureDisable.Value = header.secureDisable;
numericArm9Autoload.Value = header.ARM9autoload;
numericArm7Autoload.Value = header.ARM7autoload;
txtReserved2.Text = BitConverter.ToString(header.reserved2);
numericReserved3.Value = header.reserved3;
numericDebugRamAddress.Value = header.debug_ramAddress;
numericDebugRomOffset.Value = header.debug_romOffset;
numericDebugSize.Value = header.debug_size;
#endregion
}
public Nitro.Estructuras.ROMHeader Header
{
get { return header; }
}
public Nitro.Estructuras.Banner Banner
{
get { return banner; }
}
private void btnSave_Click(object sender, EventArgs e)
{
// Calculate the new CRCs
// Banner CRC
string tempBanner = Path.GetTempFileName();
Nitro.NDS.EscribirBanner(tempBanner, banner);
BinaryReader br = new BinaryReader(File.OpenRead(tempBanner));
br.BaseStream.Position = 0x20;
banner.CRC16 = (ushort)Tools.CRC16.Calcular(br.ReadBytes(0x820));
banner.checkCRC = true;
br.Close();
File.Delete(tempBanner);
// Header CRC
string tempHeader = Path.GetTempFileName();
Nitro.NDS.EscribirCabecera(tempHeader, header, nintendoLogo);
br = new BinaryReader(File.OpenRead(tempHeader));
header.headerCRC16 = (ushort)Tools.CRC16.Calcular(br.ReadBytes(0x15E));
header.headerCRC = true;
br.Close();
File.Delete(tempHeader);
this.DialogResult = System.Windows.Forms.DialogResult.OK;
this.Close();
}
private void btnCancel_Click(object sender, EventArgs e)
{
this.DialogResult = System.Windows.Forms.DialogResult.Cancel;
this.Close();
}
// Control events
private void txtBanReserved_Leave(object sender, EventArgs e)
{
banner.reserved = StringToBytes(txtBanReserved.Text, 28);
txtBanReserved.Text = BitConverter.ToString(banner.reserved);
}
private void txtReserved_Leave(object sender, EventArgs e)
{
header.reserved = StringToBytes(txtReserved.Text, 9);
txtReserved.Text = BitConverter.ToString(header.reserved);
}
private void txtReserved2_Leave(object sender, EventArgs e)
{
header.reserved2 = StringToBytes(txtReserved2.Text, 56);
txtReserved2.Text = BitConverter.ToString(header.reserved2);
}
private void txtTitles_TextChanged(object sender, EventArgs e)
{
switch (comboBanTitles.SelectedIndex)
{
case 0:
banner.japaneseTitle = txtTitles.Text;
break;
case 1:
banner.englishTitle = txtTitles.Text;
break;
case 2:
banner.frenchTitle = txtTitles.Text;
break;
case 3:
banner.germanTitle = txtTitles.Text;
break;
case 4:
banner.italianTitle = txtTitles.Text;
break;
case 5:
banner.spanishTitle = txtTitles.Text;
break;
}
}
private void comboBanTitles_SelectedIndexChanged(object sender, EventArgs e)
{
switch (comboBanTitles.SelectedIndex)
{
case 0:
txtTitles.Text = banner.japaneseTitle;
break;
case 1:
txtTitles.Text = banner.englishTitle;
break;
case 2:
txtTitles.Text = banner.frenchTitle;
break;
case 3:
txtTitles.Text = banner.germanTitle;
break;
case 4:
txtTitles.Text = banner.italianTitle;
break;
case 5:
txtTitles.Text = banner.spanishTitle;
break;
}
}
private void btnImage_Click(object sender, EventArgs e)
{
OpenFileDialog o = new OpenFileDialog();
o.CheckFileExists = true;
o.DefaultExt = "bmp";
o.Filter = "BitMaP (*.bmp)|*.bmp";
if (o.ShowDialog() == System.Windows.Forms.DialogResult.OK)
{
try
{
PluginInterface.NCGR tile = Imagen_NCGR.BitmapToTile(o.FileName, PluginInterface.Orden_Tiles.Horizontal);
if (tile.rahc.depth == ColorDepth.Depth8Bit)
throw new NotSupportedException(Tools.Helper.ObtenerTraduccion("EditRomInfo", "S26"));
banner.tileData = Convertir.TilesToBytes(tile.rahc.tileData.tiles);
banner.tileData = Tools.Helper.Bits4ToBits8Rev(banner.tileData);
banner.palette = Convertir.ColorToBGR555(Imagen_NCLR.BitmapToPalette(o.FileName).pltt.paletas[0].colores);
txtImage.BackColor = Color.LightGreen;
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
txtImage.BackColor = Color.Magenta;
}
finally { txtImage.Text = System.IO.Path.GetFileName(o.FileName); }
}
}
private void txtGameTitle_TextChanged(object sender, EventArgs e)
{
header.gameTitle = txtGameTitle.Text.ToCharArray();
}
private void txtGameCode_TextChanged(object sender, EventArgs e)
{
for (int i = 0; i < txtGameCode.Text.Length; i++)
if (!Char.IsLetterOrDigit(txtGameCode.Text, i))
return;
header.gameCode = txtGameCode.Text.ToCharArray();
}
private void txtMakerCode_TextChanged(object sender, EventArgs e)
{
for (int i = 0; i < txtMakerCode.Text.Length; i++)
if (!Char.IsLetterOrDigit(txtMakerCode.Text, i))
return;
header.makerCode = txtMakerCode.Text.ToCharArray();
}
private void numericUnitCode_ValueChanged(object sender, EventArgs e)
{
header.unitCode = (byte)numericUnitCode.Value;
}
private void numericROMVer_ValueChanged(object sender, EventArgs e)
{
header.ROMversion = (byte)numericROMVer.Value;
}
private void numericInternalFlag_ValueChanged(object sender, EventArgs e)
{
header.internalFlags = (byte)numericInternalFlag.Value;
}
private void numericArm9Entry_ValueChanged(object sender, EventArgs e)
{
header.ARM9entryAddress = (uint)numericArm9Entry.Value;
}
private void numericArm9Ram_ValueChanged(object sender, EventArgs e)
{
header.ARM9ramAddress = (uint)numericArm9Ram.Value;
}
private void numericArm7Entry_ValueChanged(object sender, EventArgs e)
{
header.ARM7entryAddress = (uint)numericArm7Entry.Value;
}
private void numericArm7Ram_ValueChanged(object sender, EventArgs e)
{
header.ARM7ramAddress = (uint)numericArm7Ram.Value;
}
private void numericFlagsRead_ValueChanged(object sender, EventArgs e)
{
header.flagsRead = (uint)numericFlagsRead.Value;
}
private void numericFlagsInit_ValueChanged(object sender, EventArgs e)
{
header.flagsInit = (uint)numericFlagsInit.Value;
}
private void numericRomTimeout_ValueChanged(object sender, EventArgs e)
{
header.ROMtimeout = (ushort)numericRomTimeout.Value;
}
private void numericSecureDisable_ValueChanged(object sender, EventArgs e)
{
header.secureDisable = (ulong)numericSecureDisable.Value;
}
private void numericArm9Autoload_ValueChanged(object sender, EventArgs e)
{
header.ARM9autoload = (uint)numericArm9Autoload.Value;
}
private void numericArm7Autoload_ValueChanged(object sender, EventArgs e)
{
header.ARM7autoload = (uint)numericArm7Autoload.Value;
}
private void numericReserved3_ValueChanged(object sender, EventArgs e)
{
header.reserved3 = (uint)numericReserved3.Value;
}
private void numericDebugRomOffset_ValueChanged(object sender, EventArgs e)
{
header.debug_romOffset = (uint)numericDebugRomOffset.Value;
}
private void numericDebugSize_ValueChanged(object sender, EventArgs e)
{
header.debug_size = (uint)numericDebugSize.Value;
}
private void numericDebugRamAddress_ValueChanged(object sender, EventArgs e)
{
header.debug_ramAddress = (uint)numericDebugRamAddress.Value;
}
private void numericEncryptionSeed_ValueChanged(object sender, EventArgs e)
{
header.encryptionSeed = (byte)numericEncryptionSeed.Value;
}
// Helper methods
private byte[] StringToBytes(string text, int num_bytes)
{
string hexText = text.Replace("-", "");
hexText = hexText.PadRight(num_bytes * 2, '0');
List<Byte> hex = new List<byte>();
for (int i = 0; i < hexText.Length; i += 2)
hex.Add(Convert.ToByte(hexText.Substring(i, 2), 16));
return hex.ToArray();
}
byte[] nintendoLogo = {
0x24, 0xFF, 0xAE, 0x51, 0x69, 0x9A, 0xA2, 0x21, 0x3D, 0x84, 0x82, 0x0A,
0x84, 0xE4, 0x09, 0xAD, 0x11, 0x24, 0x8B, 0x98, 0xC0, 0x81, 0x7F, 0x21,
0xA3, 0x52, 0xBE, 0x19, 0x93, 0x09, 0xCE, 0x20, 0x10, 0x46, 0x4A, 0x4A,
0xF8, 0x27, 0x31, 0xEC, 0x58, 0xC7, 0xE8, 0x33, 0x82, 0xE3, 0xCE, 0xBF,
0x85, 0xF4, 0xDF, 0x94, 0xCE, 0x4B, 0x09, 0xC1, 0x94, 0x56, 0x8A, 0xC0,
0x13, 0x72, 0xA7, 0xFC, 0x9F, 0x84, 0x4D, 0x73, 0xA3, 0xCA, 0x9A, 0x61,
0x58, 0x97, 0xA3, 0x27, 0xFC, 0x03, 0x98, 0x76, 0x23, 0x1D, 0xC7, 0x61,
0x03, 0x04, 0xAE, 0x56, 0xBF, 0x38, 0x84, 0x00, 0x40, 0xA7, 0x0E, 0xFD,
0xFF, 0x52, 0xFE, 0x03, 0x6F, 0x95, 0x30, 0xF1, 0x97, 0xFB, 0xC0, 0x85,
0x60, 0xD6, 0x80, 0x25, 0xA9, 0x63, 0xBE, 0x03, 0x01, 0x4E, 0x38, 0xE2,
0xF9, 0xA2, 0x34, 0xFF, 0xBB, 0x3E, 0x03, 0x44, 0x78, 0x00, 0x90, 0xCB,
0x88, 0x11, 0x3A, 0x94, 0x65, 0xC0, 0x7C, 0x63, 0x87, 0xF0, 0x3C, 0xAF,
0xD6, 0x25, 0xE4, 0x8B, 0x38, 0x0A, 0xAC, 0x72, 0x21, 0xD4, 0xF8, 0x07
};
private void btnShowMakerCode_Click(object sender, EventArgs e)
{
System.Xml.Linq.XElement xml = Tools.Helper.ObtenerTraduccion("EditRomInfo");
Form ven = new Form();
ven.AutoScroll = true;
ven.BackColor = SystemColors.GradientInactiveCaption;
ven.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle;
ven.ShowIcon = false;
ven.ShowInTaskbar = false;
ven.MaximizeBox = false;
ven.MinimizeBox = false;
ven.Size = new System.Drawing.Size(300, 700);
ListView list = new ListView();
list.Dock = DockStyle.Fill;
list.View = View.Details;
ColumnHeader columnCode = new ColumnHeader();
columnCode.Text = xml.Element("S28").Value;
ColumnHeader columnCompany = new ColumnHeader();
columnCompany.Text = xml.Element("S29").Value;
list.Columns.Add(columnCode);
list.Columns.Add(columnCompany);
foreach (String code in Nitro.Estructuras.makerCode.Keys)
{
list.Items.Add(code);
list.Items[list.Items.Count - 1].SubItems.Add(Nitro.Estructuras.makerCode[code]);
}
list.AutoResizeColumns(ColumnHeaderAutoResizeStyle.ColumnContent);
list.AutoResizeColumn(0, ColumnHeaderAutoResizeStyle.HeaderSize);
ven.Controls.Add(list);
ven.Text = xml.Element("S2A").Value;
ven.Show();
}
}
}

145
Tinke/EditRomInfo.resx Normal file
View 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////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP//
/wD///8A////ABNAWP8VQl7/JWmc/yx2tP87i7qt////AP///wD///8A////AP///wD///8A////AP//
/wD///8A////AP///wASQln/XZzU/6bP9f+pz+z/SIvB/yx2tP////8A////AP///wD///8A////AP//
/wD///8A////AP///wD///8AHm2T/8vj+f9hquz/QJjo/xVnwv8WYKr/LHa0/////wD///8A////AP//
/wD///8A////AP///wD///8A////AB5tk//I4fL/0ef6/zR9tf8xmcP/bcTc/0qcz/80g8f/////AP//
/wD///8A////AP///wD///8A////AP///wAgY5ggJom5/7DL4f9nqcj/YNz1/0TW9P+O7vr/XbTm/zuP
2f////8A////AP///wD///8A////AP///wD///8A////AP///wAmibn/vuby/7P0/P9g3PX/RNb0/47u
+v9dtOb/O4/Z/////wD///8A////AP///wD///8A////AP///wD///8A////ACeQv//D7fj/s/T8/2Dc
9f9E1vT/ju76/1205v87j9n/////AP///wD///8A////AP///wD///8A////AP///wD///8AL7rk/8Pt
+P+z9Pz/YNz1/0TW9P+O7vr/XbTm/zuP2f////8A////AP///wD///8A////AP///wD///8A////AP//
/wAvuuT/w+34/7P0/P9g3PX/RNb0/47u+v9dtOb/O4/Z/////wD///8A////AP///wD///8A////AP//
/wD///8A////AC+65P/D7fj/s/T8/2jZ9f9vz/P/WZ3Q/3Or3f9Pkcn/////AP///wD///8A////AP//
/wD///8A////AP///wD///8AL7rk/8Pt+P+o4vj/bK7d/6XP9P+lz/T/vdv3/1OTy/f///8A////AP//
/wD///8A////AP///wD///8A////AP///wAvuuT/p9T0/8Xh+P/M4/n/zOP5/73b9/9PkMn9////AP//
/wD///8A////AP///wD///8A////AP///wD///8A////AFCo2f9qpdj/yeH3/8vj+P9Clcr/MYLCrv//
/wD///8A////AP///wD///8A////AP///wD///8A////AP///wAvuuQJT6rb6lCTyv1OkMj/L53S3zWk
3hn///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP//
/wD///8A//8AAIP/AACB/wAAgP8AAIB/AACAPwAA4B8AAPAPAAD4BwAA/AMAAP4BAAD/AAAA/4AAAP/A
AAD/wAAA//8AAA==
</value>
</data>
</root>

View File

@ -163,8 +163,7 @@ namespace Tinke
List<byte> resul = new List<byte>();
for (int i = 0; i < tiles.Length; i++)
for (int j = 0; j < 64; j++)
resul.Add(tiles[i][j]);
resul.AddRange(tiles[i]);
return resul.ToArray();
}

View File

@ -28,15 +28,15 @@
/// </summary>
private void InitializeComponent()
{
System.Windows.Forms.ListViewItem listViewItem9 = new System.Windows.Forms.ListViewItem(new string[] {
System.Windows.Forms.ListViewItem listViewItem1 = new System.Windows.Forms.ListViewItem(new string[] {
"S07"}, -1, System.Drawing.Color.Empty, System.Drawing.Color.Empty, new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0))));
System.Windows.Forms.ListViewItem listViewItem10 = new System.Windows.Forms.ListViewItem("S08");
System.Windows.Forms.ListViewItem listViewItem11 = new System.Windows.Forms.ListViewItem("S09");
System.Windows.Forms.ListViewItem listViewItem12 = new System.Windows.Forms.ListViewItem("S0A");
System.Windows.Forms.ListViewItem listViewItem13 = new System.Windows.Forms.ListViewItem("S0B");
System.Windows.Forms.ListViewItem listViewItem14 = new System.Windows.Forms.ListViewItem("S0C");
System.Windows.Forms.ListViewItem listViewItem15 = new System.Windows.Forms.ListViewItem("S0D");
System.Windows.Forms.ListViewItem listViewItem16 = new System.Windows.Forms.ListViewItem("S0E");
System.Windows.Forms.ListViewItem listViewItem2 = new System.Windows.Forms.ListViewItem("S08");
System.Windows.Forms.ListViewItem listViewItem3 = new System.Windows.Forms.ListViewItem("S09");
System.Windows.Forms.ListViewItem listViewItem4 = new System.Windows.Forms.ListViewItem("S0A");
System.Windows.Forms.ListViewItem listViewItem5 = new System.Windows.Forms.ListViewItem("S0B");
System.Windows.Forms.ListViewItem listViewItem6 = new System.Windows.Forms.ListViewItem("S0C");
System.Windows.Forms.ListViewItem listViewItem7 = new System.Windows.Forms.ListViewItem("S0D");
System.Windows.Forms.ListViewItem listViewItem8 = new System.Windows.Forms.ListViewItem("S0E");
this.imgBox = new System.Windows.Forms.PictureBox();
this.groupBox1 = new System.Windows.Forms.GroupBox();
this.listProp = new System.Windows.Forms.ListView();
@ -92,14 +92,14 @@
this.columnValor});
this.listProp.Dock = System.Windows.Forms.DockStyle.Fill;
this.listProp.Items.AddRange(new System.Windows.Forms.ListViewItem[] {
listViewItem9,
listViewItem10,
listViewItem11,
listViewItem12,
listViewItem13,
listViewItem14,
listViewItem15,
listViewItem16});
listViewItem1,
listViewItem2,
listViewItem3,
listViewItem4,
listViewItem5,
listViewItem6,
listViewItem7,
listViewItem8});
this.listProp.Location = new System.Drawing.Point(3, 16);
this.listProp.Name = "listProp";
this.listProp.Size = new System.Drawing.Size(241, 237);
@ -130,17 +130,17 @@
//
this.comboCelda.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
this.comboCelda.FormattingEnabled = true;
this.comboCelda.Location = new System.Drawing.Point(46, 263);
this.comboCelda.Location = new System.Drawing.Point(73, 263);
this.comboCelda.Name = "comboCelda";
this.comboCelda.Size = new System.Drawing.Size(210, 21);
this.comboCelda.Size = new System.Drawing.Size(183, 21);
this.comboCelda.TabIndex = 3;
this.comboCelda.SelectedIndexChanged += new System.EventHandler(this.comboCelda_SelectedIndexChanged);
//
// btnTodos
//
this.btnTodos.Location = new System.Drawing.Point(46, 290);
this.btnTodos.Location = new System.Drawing.Point(73, 290);
this.btnTodos.Name = "btnTodos";
this.btnTodos.Size = new System.Drawing.Size(210, 23);
this.btnTodos.Size = new System.Drawing.Size(183, 23);
this.btnTodos.TabIndex = 4;
this.btnTodos.Text = "S02";
this.btnTodos.UseVisualStyleBackColor = true;
@ -152,7 +152,7 @@
this.btnSave.ImageAlign = System.Drawing.ContentAlignment.MiddleLeft;
this.btnSave.Location = new System.Drawing.Point(6, 483);
this.btnSave.Name = "btnSave";
this.btnSave.Size = new System.Drawing.Size(75, 26);
this.btnSave.Size = new System.Drawing.Size(86, 26);
this.btnSave.TabIndex = 5;
this.btnSave.Text = "S03";
this.btnSave.TextImageRelation = System.Windows.Forms.TextImageRelation.ImageBeforeText;
@ -228,9 +228,9 @@
// btnBgdTrans
//
this.btnBgdTrans.Enabled = false;
this.btnBgdTrans.Location = new System.Drawing.Point(202, 332);
this.btnBgdTrans.Location = new System.Drawing.Point(176, 321);
this.btnBgdTrans.Name = "btnBgdTrans";
this.btnBgdTrans.Size = new System.Drawing.Size(51, 35);
this.btnBgdTrans.Size = new System.Drawing.Size(80, 35);
this.btnBgdTrans.TabIndex = 29;
this.btnBgdTrans.Text = "S18";
this.btnBgdTrans.UseVisualStyleBackColor = true;
@ -239,7 +239,7 @@
// pictureBgd
//
this.pictureBgd.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
this.pictureBgd.Location = new System.Drawing.Point(161, 332);
this.pictureBgd.Location = new System.Drawing.Point(135, 322);
this.pictureBgd.Name = "pictureBgd";
this.pictureBgd.Size = new System.Drawing.Size(35, 35);
this.pictureBgd.SizeMode = System.Windows.Forms.PictureBoxSizeMode.StretchImage;
@ -248,9 +248,9 @@
//
// btnBgd
//
this.btnBgd.Location = new System.Drawing.Point(46, 332);
this.btnBgd.Location = new System.Drawing.Point(6, 322);
this.btnBgd.Name = "btnBgd";
this.btnBgd.Size = new System.Drawing.Size(78, 35);
this.btnBgd.Size = new System.Drawing.Size(118, 35);
this.btnBgd.TabIndex = 27;
this.btnBgd.Text = "S17";
this.btnBgd.UseVisualStyleBackColor = true;

View File

@ -125,7 +125,7 @@ namespace Tinke
0,
0,
0});
this.numericWidth.Location = new System.Drawing.Point(50, 269);
this.numericWidth.Location = new System.Drawing.Point(65, 269);
this.numericWidth.Maximum = new decimal(new int[] {
65536,
0,
@ -157,7 +157,7 @@ namespace Tinke
// label2
//
this.label2.AutoSize = true;
this.label2.Location = new System.Drawing.Point(143, 271);
this.label2.Location = new System.Drawing.Point(129, 271);
this.label2.Name = "label2";
this.label2.Size = new System.Drawing.Size(26, 13);
this.label2.TabIndex = 3;
@ -237,7 +237,7 @@ namespace Tinke
this.btnBgdTrans.Enabled = false;
this.btnBgdTrans.Location = new System.Drawing.Point(158, 347);
this.btnBgdTrans.Name = "btnBgdTrans";
this.btnBgdTrans.Size = new System.Drawing.Size(50, 35);
this.btnBgdTrans.Size = new System.Drawing.Size(78, 35);
this.btnBgdTrans.TabIndex = 22;
this.btnBgdTrans.Text = "S20";
this.btnBgdTrans.UseVisualStyleBackColor = true;
@ -257,7 +257,7 @@ namespace Tinke
//
this.btnBgd.Location = new System.Drawing.Point(9, 347);
this.btnBgd.Name = "btnBgd";
this.btnBgd.Size = new System.Drawing.Size(75, 35);
this.btnBgd.Size = new System.Drawing.Size(102, 35);
this.btnBgd.TabIndex = 20;
this.btnBgd.Text = "S1F";
this.btnBgd.UseVisualStyleBackColor = true;
@ -333,16 +333,16 @@ namespace Tinke
this.comboBox1.Items.AddRange(new object[] {
"S16",
"S17"});
this.comboBox1.Location = new System.Drawing.Point(115, 295);
this.comboBox1.Location = new System.Drawing.Point(117, 295);
this.comboBox1.Name = "comboBox1";
this.comboBox1.Size = new System.Drawing.Size(121, 21);
this.comboBox1.Size = new System.Drawing.Size(119, 21);
this.comboBox1.TabIndex = 10;
this.comboBox1.SelectedIndexChanged += new System.EventHandler(this.comboBox1_SelectedIndexChanged);
//
// label4
//
this.label4.AutoSize = true;
this.label4.Location = new System.Drawing.Point(143, 245);
this.label4.Location = new System.Drawing.Point(129, 245);
this.label4.Name = "label4";
this.label4.Size = new System.Drawing.Size(31, 13);
this.label4.TabIndex = 9;
@ -353,7 +353,7 @@ namespace Tinke
this.btnSave.Image = global::Tinke.Properties.Resources.picture_save;
this.btnSave.Location = new System.Drawing.Point(9, 474);
this.btnSave.Name = "btnSave";
this.btnSave.Size = new System.Drawing.Size(79, 32);
this.btnSave.Size = new System.Drawing.Size(96, 32);
this.btnSave.TabIndex = 6;
this.btnSave.Text = "S15";
this.btnSave.TextImageRelation = System.Windows.Forms.TextImageRelation.ImageBeforeText;
@ -383,7 +383,7 @@ namespace Tinke
//
// numericStart
//
this.numericStart.Location = new System.Drawing.Point(50, 243);
this.numericStart.Location = new System.Drawing.Point(65, 243);
this.numericStart.Maximum = new decimal(new int[] {
65535,
0,

View File

@ -28,11 +28,11 @@
/// </summary>
private void InitializeComponent()
{
System.Windows.Forms.ListViewItem listViewItem11 = new System.Windows.Forms.ListViewItem("S05");
System.Windows.Forms.ListViewItem listViewItem12 = new System.Windows.Forms.ListViewItem("S06");
System.Windows.Forms.ListViewItem listViewItem13 = new System.Windows.Forms.ListViewItem("S07");
System.Windows.Forms.ListViewItem listViewItem14 = new System.Windows.Forms.ListViewItem("S08");
System.Windows.Forms.ListViewItem listViewItem15 = new System.Windows.Forms.ListViewItem("S09");
System.Windows.Forms.ListViewItem listViewItem1 = new System.Windows.Forms.ListViewItem("S05");
System.Windows.Forms.ListViewItem listViewItem2 = new System.Windows.Forms.ListViewItem("S06");
System.Windows.Forms.ListViewItem listViewItem3 = new System.Windows.Forms.ListViewItem("S07");
System.Windows.Forms.ListViewItem listViewItem4 = new System.Windows.Forms.ListViewItem("S08");
System.Windows.Forms.ListViewItem listViewItem5 = new System.Windows.Forms.ListViewItem("S09");
this.paletaBox = new System.Windows.Forms.PictureBox();
this.nPaleta = new System.Windows.Forms.NumericUpDown();
this.label1 = new System.Windows.Forms.Label();
@ -67,9 +67,9 @@
//
// nPaleta
//
this.nPaleta.Location = new System.Drawing.Point(78, 182);
this.nPaleta.Location = new System.Drawing.Point(123, 182);
this.nPaleta.Name = "nPaleta";
this.nPaleta.Size = new System.Drawing.Size(82, 20);
this.nPaleta.Size = new System.Drawing.Size(37, 20);
this.nPaleta.TabIndex = 2;
this.nPaleta.ValueChanged += new System.EventHandler(this.nPaleta_ValueChanged);
//
@ -84,9 +84,9 @@
//
// btnShow
//
this.btnShow.Location = new System.Drawing.Point(326, 166);
this.btnShow.Location = new System.Drawing.Point(346, 166);
this.btnShow.Name = "btnShow";
this.btnShow.Size = new System.Drawing.Size(180, 30);
this.btnShow.Size = new System.Drawing.Size(160, 30);
this.btnShow.TabIndex = 4;
this.btnShow.Text = "S0B";
this.btnShow.UseVisualStyleBackColor = true;
@ -109,11 +109,11 @@
this.columnValor});
this.listProp.Dock = System.Windows.Forms.DockStyle.Top;
this.listProp.Items.AddRange(new System.Windows.Forms.ListViewItem[] {
listViewItem11,
listViewItem12,
listViewItem13,
listViewItem14,
listViewItem15});
listViewItem1,
listViewItem2,
listViewItem3,
listViewItem4,
listViewItem5});
this.listProp.Location = new System.Drawing.Point(3, 16);
this.listProp.Name = "listProp";
this.listProp.Size = new System.Drawing.Size(261, 134);
@ -136,7 +136,7 @@
this.btnSave.Image = global::Tinke.Properties.Resources.picture_save;
this.btnSave.Location = new System.Drawing.Point(245, 166);
this.btnSave.Name = "btnSave";
this.btnSave.Size = new System.Drawing.Size(75, 30);
this.btnSave.Size = new System.Drawing.Size(95, 30);
this.btnSave.TabIndex = 6;
this.btnSave.Text = "S0A";
this.btnSave.TextImageRelation = System.Windows.Forms.TextImageRelation.ImageBeforeText;
@ -158,18 +158,18 @@
this.groupModificar.Controls.Add(this.btnConverter);
this.groupModificar.Controls.Add(this.label2);
this.groupModificar.Controls.Add(this.numericStartByte);
this.groupModificar.Location = new System.Drawing.Point(289, 226);
this.groupModificar.Location = new System.Drawing.Point(245, 226);
this.groupModificar.Name = "groupModificar";
this.groupModificar.Size = new System.Drawing.Size(217, 101);
this.groupModificar.Size = new System.Drawing.Size(261, 93);
this.groupModificar.TabIndex = 8;
this.groupModificar.TabStop = false;
this.groupModificar.Text = "S11";
//
// btnImport
//
this.btnImport.Location = new System.Drawing.Point(107, 54);
this.btnImport.Location = new System.Drawing.Point(149, 54);
this.btnImport.Name = "btnImport";
this.btnImport.Size = new System.Drawing.Size(95, 30);
this.btnImport.Size = new System.Drawing.Size(106, 30);
this.btnImport.TabIndex = 3;
this.btnImport.Text = "S13";
this.btnImport.TextImageRelation = System.Windows.Forms.TextImageRelation.ImageBeforeText;
@ -180,7 +180,7 @@
//
this.btnConverter.Location = new System.Drawing.Point(6, 54);
this.btnConverter.Name = "btnConverter";
this.btnConverter.Size = new System.Drawing.Size(95, 30);
this.btnConverter.Size = new System.Drawing.Size(137, 30);
this.btnConverter.TabIndex = 2;
this.btnConverter.Text = "S14";
this.btnConverter.UseVisualStyleBackColor = true;
@ -197,7 +197,7 @@
//
// numericStartByte
//
this.numericStartByte.Location = new System.Drawing.Point(107, 22);
this.numericStartByte.Location = new System.Drawing.Point(160, 22);
this.numericStartByte.Name = "numericStartByte";
this.numericStartByte.Size = new System.Drawing.Size(95, 20);
this.numericStartByte.TabIndex = 0;
@ -243,9 +243,9 @@
private System.Windows.Forms.Button btnSave;
private System.Windows.Forms.Label lblRGB;
private System.Windows.Forms.GroupBox groupModificar;
private System.Windows.Forms.Button btnImport;
private System.Windows.Forms.Button btnConverter;
private System.Windows.Forms.Label label2;
private System.Windows.Forms.NumericUpDown numericStartByte;
internal System.Windows.Forms.Button btnImport;
}
}

View File

@ -144,6 +144,66 @@ namespace Tinke.Nitro
Console.WriteLine(Tools.Helper.ObtenerTraduccion("Messages", "S09"), new FileInfo(salida).Length);
}
public static void EscribirCabecera(string salida, Estructuras.ROMHeader cabecera, byte[] nintendoLogo)
{
BinaryWriter bw = new BinaryWriter(new FileStream(salida, FileMode.Create));
Console.Write(Tools.Helper.ObtenerTraduccion("Messages", "S0A"));
bw.Write(cabecera.gameTitle);
bw.Write(cabecera.gameCode);
bw.Write(cabecera.makerCode);
bw.Write(cabecera.unitCode);
bw.Write(cabecera.encryptionSeed);
bw.Write((byte)(Math.Log(cabecera.tamaño, 2) - 20));
bw.Write(cabecera.reserved);
bw.Write(cabecera.ROMversion);
bw.Write(cabecera.internalFlags);
bw.Write(cabecera.ARM9romOffset);
bw.Write(cabecera.ARM9entryAddress);
bw.Write(cabecera.ARM9ramAddress);
bw.Write(cabecera.ARM9size);
bw.Write(cabecera.ARM7romOffset);
bw.Write(cabecera.ARM7entryAddress);
bw.Write(cabecera.ARM7ramAddress);
bw.Write(cabecera.ARM7size);
bw.Write(cabecera.fileNameTableOffset);
bw.Write(cabecera.fileNameTableSize);
bw.Write(cabecera.FAToffset);
bw.Write(cabecera.FATsize);
bw.Write(cabecera.ARM9overlayOffset);
bw.Write(cabecera.ARM9overlaySize);
bw.Write(cabecera.ARM7overlayOffset);
bw.Write(cabecera.ARM7overlaySize);
bw.Write(cabecera.flagsRead);
bw.Write(cabecera.flagsInit);
bw.Write(cabecera.bannerOffset);
bw.Write(cabecera.secureCRC16);
bw.Write(cabecera.ROMtimeout);
bw.Write(cabecera.ARM9autoload);
bw.Write(cabecera.ARM7autoload);
bw.Write(cabecera.secureDisable);
bw.Write(cabecera.ROMsize);
bw.Write(cabecera.headerSize);
bw.Write(cabecera.reserved2);
bw.Write(nintendoLogo);
bw.Write(cabecera.logoCRC16);
bw.Write(cabecera.headerCRC16);
bw.Write(cabecera.debug_romOffset);
bw.Write(cabecera.debug_size);
bw.Write(cabecera.debug_ramAddress);
bw.Write(cabecera.reserved3);
bw.Flush();
int relleno = (int)(cabecera.headerSize - bw.BaseStream.Length);
for (int i = 0; i < relleno; i++)
bw.Write((byte)0x00);
bw.Flush();
bw.Close();
Console.WriteLine(Tools.Helper.ObtenerTraduccion("Messages", "S09"), new FileInfo(salida).Length);
}
public static Estructuras.Banner LeerBanner(string file, UInt32 offset)
{
@ -325,6 +385,7 @@ namespace Tinke.Nitro
diccionario.Add("18", "Hudson Entertainment");
diccionario.Add("36", "Codemasters");
diccionario.Add("41", "Ubisoft");
diccionario.Add("4F", "Eidos");
diccionario.Add("4Q", "Disney Interactive Studios");
diccionario.Add("52", "Activision");
diccionario.Add("5D", "Midway");
@ -343,6 +404,7 @@ namespace Tinke.Nitro
diccionario.Add("AF", "Namco");
diccionario.Add("FH", "Foreign Media Games");
diccionario.Add("FK", "The Game Factory");
diccionario.Add("FR", "dtp young");
diccionario.Add("G9", "D3Publisher of America");
diccionario.Add("GD", "SQUARE ENIX");
diccionario.Add("GN", "Oxygen Interactive");
@ -367,8 +429,11 @@ namespace Tinke.Nitro
diccionario.Add("RM", "rondomedia");
diccionario.Add("RT", "RTL Games");
diccionario.Add("TK", "Tasuke");
diccionario.Add("TR", "Tetris Online");
diccionario.Add("TV", "Tivola Publishing");
diccionario.Add("VP", "Virgin Play");
diccionario.Add("WP", "White Park Bay");
diccionario.Add("WR", "WB Games");
diccionario.Add("WR", "Warner Bros");
}
private static void Rellenar_UnitCodes()
{

View File

@ -60,6 +60,13 @@ namespace Tinke.Properties {
}
}
internal static System.Drawing.Bitmap accept {
get {
object obj = ResourceManager.GetObject("accept", resourceCulture);
return ((System.Drawing.Bitmap)(obj));
}
}
internal static System.Drawing.Bitmap calculator {
get {
object obj = ResourceManager.GetObject("calculator", resourceCulture);
@ -67,6 +74,13 @@ namespace Tinke.Properties {
}
}
internal static System.Drawing.Bitmap cancel {
get {
object obj = ResourceManager.GetObject("cancel", resourceCulture);
return ((System.Drawing.Bitmap)(obj));
}
}
internal static System.Drawing.Bitmap disk {
get {
object obj = ResourceManager.GetObject("disk", resourceCulture);
@ -88,6 +102,20 @@ namespace Tinke.Properties {
}
}
internal static System.Drawing.Bitmap pencil {
get {
object obj = ResourceManager.GetObject("pencil", resourceCulture);
return ((System.Drawing.Bitmap)(obj));
}
}
internal static System.Drawing.Bitmap picture_edit {
get {
object obj = ResourceManager.GetObject("picture_edit", resourceCulture);
return ((System.Drawing.Bitmap)(obj));
}
}
internal static System.Drawing.Bitmap picture_go {
get {
object obj = ResourceManager.GetObject("picture_go", resourceCulture);
@ -102,13 +130,6 @@ namespace Tinke.Properties {
}
}
internal static System.Drawing.Bitmap splash1080pc2011 {
get {
object obj = ResourceManager.GetObject("splash1080pc2011", resourceCulture);
return ((System.Drawing.Bitmap)(obj));
}
}
internal static System.Drawing.Bitmap zoom {
get {
object obj = ResourceManager.GetObject("zoom", resourceCulture);

View File

@ -118,8 +118,11 @@
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<assembly alias="System.Windows.Forms" name="System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
<data name="splash1080pc2011" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\splash1080pc20111.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
<data name="accept" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\accept.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="cancel" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\cancel.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="disk" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\disk.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
@ -133,14 +136,19 @@
<data name="calculator" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\calculator.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="pencil" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\pencil.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="picture_go" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\picture_go.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="picture_save" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\picture_save.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="zoom" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\zoom.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<assembly alias="System.Windows.Forms" name="System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
<data name="picture_go" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\picture_go.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
<data name="picture_edit" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\picture_edit.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
</root>

BIN
Tinke/Resources/accept.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 781 B

BIN
Tinke/Resources/cancel.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 587 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 783 B

BIN
Tinke/Resources/pencil.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 450 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 826 B

View File

@ -188,11 +188,12 @@ namespace Tinke
this.label2 = new System.Windows.Forms.Label();
this.comboBannerLang = new System.Windows.Forms.ComboBox();
this.txtBannerTitle = new System.Windows.Forms.TextBox();
this.picIcon = new System.Windows.Forms.PictureBox();
this.listInfo = new System.Windows.Forms.ListView();
this.columnPosicion = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
this.columnCampo = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
this.columnValor = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
this.btnEdit = new System.Windows.Forms.Button();
this.picIcon = new System.Windows.Forms.PictureBox();
this.groupBanner.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.picIcon)).BeginInit();
this.SuspendLayout();
@ -331,15 +332,6 @@ namespace Tinke
this.txtBannerTitle.Size = new System.Drawing.Size(182, 85);
this.txtBannerTitle.TabIndex = 3;
//
// picIcon
//
this.picIcon.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
this.picIcon.Location = new System.Drawing.Point(9, 19);
this.picIcon.Name = "picIcon";
this.picIcon.Size = new System.Drawing.Size(32, 32);
this.picIcon.TabIndex = 0;
this.picIcon.TabStop = false;
//
// listInfo
//
this.listInfo.Activation = System.Windows.Forms.ItemActivation.OneClick;
@ -417,6 +409,27 @@ namespace Tinke
this.columnValor.Text = "S0E";
this.columnValor.Width = 214;
//
// btnEdit
//
this.btnEdit.Image = global::Tinke.Properties.Resources.pencil;
this.btnEdit.Location = new System.Drawing.Point(500, 313);
this.btnEdit.Name = "btnEdit";
this.btnEdit.Size = new System.Drawing.Size(90, 30);
this.btnEdit.TabIndex = 8;
this.btnEdit.Text = "S3B";
this.btnEdit.TextImageRelation = System.Windows.Forms.TextImageRelation.ImageBeforeText;
this.btnEdit.UseVisualStyleBackColor = true;
this.btnEdit.Click += new System.EventHandler(this.btnEdit_Click);
//
// picIcon
//
this.picIcon.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
this.picIcon.Location = new System.Drawing.Point(9, 19);
this.picIcon.Name = "picIcon";
this.picIcon.Size = new System.Drawing.Size(32, 32);
this.picIcon.TabIndex = 0;
this.picIcon.TabStop = false;
//
// RomInfo
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
@ -424,6 +437,7 @@ namespace Tinke
this.BackColor = System.Drawing.SystemColors.GradientInactiveCaption;
this.ClientSize = new System.Drawing.Size(694, 472);
this.ControlBox = false;
this.Controls.Add(this.btnEdit);
this.Controls.Add(this.groupBanner);
this.Controls.Add(this.listInfo);
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle;
@ -460,5 +474,6 @@ namespace Tinke
private System.Windows.Forms.ColumnHeader columnValor;
private System.Windows.Forms.Label lblGameTitle;
private System.Windows.Forms.CheckBox checkTrans;
private System.Windows.Forms.Button btnEdit;
}
}

View File

@ -128,6 +128,7 @@ namespace Tinke
listInfo.Items[40].SubItems[1].Text = xml.Element("S37").Value;
listInfo.Items[41].SubItems[1].Text = xml.Element("S38").Value;
checkTrans.Text = xml.Element("S3A").Value;
btnEdit.Text = xml.Element("S3B").Value;
}
private void Mostrar_Informacion(Nitro.Estructuras.ROMHeader cabecera, Nitro.Estructuras.Banner banner)
@ -135,6 +136,11 @@ namespace Tinke
this.cabecera = cabecera;
this.banner = banner;
// Remove older values
if (listInfo.Items[0].SubItems.Count == 3)
for (int i = 0; i < listInfo.Items.Count; i++)
listInfo.Items[i].SubItems.RemoveAt(2);
#region Muestra la información de la cabecera
listInfo.Items[0].SubItems.Add(new String(cabecera.gameTitle));
listInfo.Items[1].SubItems.Add(new string(cabecera.gameCode));
@ -232,7 +238,7 @@ namespace Tinke
o.OverwritePrompt = true;
o.Filter = "Imagen Bitmap (*.bmp)|*.bmp";
if (o.ShowDialog() == System.Windows.Forms.DialogResult.OK)
picIcon.Image.Save(o.FileName);
picIcon.Image.Save(o.FileName, System.Drawing.Imaging.ImageFormat.Bmp);
}
private void comboBannerLang_SelectedIndexChanged(object sender, EventArgs e)
{
@ -270,5 +276,23 @@ namespace Tinke
else
picIcon.Image = picBanner;
}
private void btnEdit_Click(object sender, EventArgs e)
{
EditRomInfo editor = new EditRomInfo(cabecera, banner);
editor.FormClosed += new FormClosedEventHandler(editor_FormClosed);
editor.Show();
}
void editor_FormClosed(object sender, FormClosedEventArgs e)
{
EditRomInfo editor = (EditRomInfo)sender;
if (editor.DialogResult != System.Windows.Forms.DialogResult.OK)
return;
cabecera = editor.Header;
banner = editor.Banner;
Mostrar_Informacion(cabecera, banner);
}
}
}

View File

@ -181,20 +181,20 @@ namespace Tinke
treeSystem.Nodes[0].Expand();
Get_SupportedFiles();
DateTime t10 = DateTime.Now;
DateTime t9 = DateTime.Now;
DateTime finalTime = DateTime.Now;
Console.Write("<br><u>Cálculo de tiempos:</u><ul><font size=\"2\" face=\"consolas\">");
Console.WriteLine("<li>Tiempo {0}: {1}</li>", "total", (finalTime - startTime).ToString());
Console.WriteLine("<li>Tiempo {0}: {1}</li>", "en obtener cabecera", (t1 - startTime).ToString());
Console.WriteLine("<li>Tiempo {0}: {1}</li>", "inicializar Acciones", (t2 - t1).ToString());
Console.WriteLine("<li>Tiempo {0}: {1}</li>", "en leer FNT", (t3 - t2).ToString());
Console.WriteLine("<li>Tiempo {0}: {1}</li>", "añadir archivos del sistema", (t4 - t3).ToString());
Console.WriteLine("<li>Tiempo {0}: {1}</li>", "en leer FAT", (t5 - t4).ToString());
Console.WriteLine("<li>Tiempo {0}: {1}</li>", "en asignar ROOT", (t6 - t5).ToString());
Console.WriteLine("<li>Tiempo {0}: {1}</li>", "en obtener los formatos", (t7 - t6).ToString());
Console.WriteLine("<li>Tiempo {0}: {1}</li>", "en jerarquizar el árbol", (t8 - t7).ToString());
Console.WriteLine("<li>Tiempo {0}: {1}</li>", "obtener el porcentaje de archivos soportados", (t10 - t8).ToString());
XElement xml = Tools.Helper.ObtenerTraduccion("Messages");
Console.Write("<br><u>" + xml.Element("S0F").Value + "</u><ul><font size=\"2\" face=\"consolas\">");
Console.WriteLine("<li>" + xml.Element("S10").Value + (t9 - startTime).ToString() + "</li>");
Console.WriteLine("<li>" + xml.Element("S11").Value + (t1 - startTime).ToString() + "</li>");
Console.WriteLine("<li>" + xml.Element("S12").Value + (t2 - t1).ToString() + "</li>");
Console.WriteLine("<li>" + xml.Element("S13").Value + (t3 - t2).ToString() + "</li>");
Console.WriteLine("<li>" + xml.Element("S14").Value + (t4 - t3).ToString() + "</li>");
Console.WriteLine("<li>" + xml.Element("S15").Value + (t5 - t4).ToString() + "</li>");
Console.WriteLine("<li>" + xml.Element("S16").Value + (t6 - t5).ToString() + "</li>");
Console.WriteLine("<li>" + xml.Element("S17").Value + (t7 - t6).ToString() + "</li>");
Console.WriteLine("<li>" + xml.Element("S18").Value + (t8 - t7).ToString() + "</li>");
Console.WriteLine("<li>" + xml.Element("S19").Value + (t9 - t8).ToString() + "</li>");
Console.Write("</font></ul><br>");
}
private void ReadFiles(string[] files)
@ -358,6 +358,8 @@ namespace Tinke
btnSaveROM.Text = xml.Element("S33").Value;
toolStripMenuComprimido.Text = xml.Element("S2A").Value;
toolStripAbrirTexto.Text = xml.Element("S26").Value;
toolStripFAT1.Text = xml.Element("S3D").Value;
toolStripFAT2.Text = xml.Element("S3E").Value;
}
private void ToolStripLang_Click(Object sender, EventArgs e)
{
@ -838,7 +840,18 @@ namespace Tinke
private void btnExtraer_Click(object sender, EventArgs e)
{
if (Convert.ToUInt16(treeSystem.SelectedNode.Tag) < 0xF000)
ExtractFile();
{
if ((String)accion.Select_File().tag == "Descomprimido")
{
if (MessageBox.Show(Tools.Helper.ObtenerTraduccion("Sistema", "S3B"), "", MessageBoxButtons.YesNo,
MessageBoxIcon.Question) == System.Windows.Forms.DialogResult.Yes)
ExtractFolder();
else
ExtractFile();
}
else
ExtractFile();
}
else
ExtractFolder();
}

View File

@ -58,7 +58,6 @@
// SplashScreen
//
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Inherit;
this.BackgroundImage = global::Tinke.Properties.Resources.splash1080pc2011;
resources.ApplyResources(this, "$this");
this.ControlBox = false;
this.Controls.Add(this.label2);

View File

@ -151,6 +151,12 @@
<Compile Include="Debug.Designer.cs">
<DependentUpon>Debug.cs</DependentUpon>
</Compile>
<Compile Include="EditRomInfo.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="EditRomInfo.Designer.cs">
<DependentUpon>EditRomInfo.cs</DependentUpon>
</Compile>
<Compile Include="Espera.cs">
<SubType>Form</SubType>
</Compile>
@ -234,6 +240,9 @@
<EmbeddedResource Include="Debug.resx">
<DependentUpon>Debug.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="EditRomInfo.resx">
<DependentUpon>EditRomInfo.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="Espera.resx">
<DependentUpon>Espera.cs</DependentUpon>
</EmbeddedResource>
@ -337,6 +346,11 @@
</Content>
<Content Include="nintendo-ds.ico" />
<Content Include="Nitro\MakerCodes.txt" />
<None Include="Resources\picture_edit.png" />
<None Include="Resources\image_edit.png" />
<None Include="Resources\pencil.png" />
<None Include="Resources\cancel.png" />
<None Include="Resources\accept.png" />
<None Include="Resources\picture_go.png" />
<None Include="Resources\page_white_text.png" />
<None Include="Resources\splash1080pc20111.png" />

View File

@ -51,10 +51,8 @@ namespace Tinke.Tools
for (int i = 0; i < bytes.Length; i++)
{
string hex = DecToHex(bytes[i]);
bits[i * 2] = (byte)HexToSingleDec(hex[1]);
bits[i * 2 + 1] = (byte)HexToSingleDec(hex[0]);
bits[i * 2 + 1] = (byte)((bytes[i] & 0xF0) >> 4);
bits[i * 2] = (byte)(bytes[i] & 0x0F);
}
return bits;
@ -68,148 +66,23 @@ namespace Tinke.Tools
{
byte[] bits = new byte[2];
string hex = DecToHex(Byte);
bits[0] = (byte)HexToSingleDec(hex[0]);
bits[1] = (byte)HexToSingleDec(hex[1]);
bits[0] = (byte)(Byte & 0x0F);
bits[1] = (byte)((Byte & 0xF0) >> 4);
return bits;
}
/// <summary>
/// Convierte números decimales a hexadecimales.
/// </summary>
/// <param name="x">Número decimal.</param>
/// <returns>Número hexadecimal en string para que no se autoconvierta a decimal.</returns>
public static string DecToHex(int x)
public static byte[] Bits4ToBits8Rev(byte[] bytes)
{
List<Byte> bit8 = new List<byte>();
if (x < 10) { return '0' + x.ToString(); }
else if (x < 16) { return '0' + DecToSingleHex(x).ToString(); }
else
for (int i = 0; i < bytes.Length; i += 2)
{
string y = "";
do
{
y = DecToSingleHex((x / 16)) + y;
x = x % 16;
} while (x > 15);
if (x < 10) { return y + x.ToString(); }
else { return y + DecToSingleHex(x); }
}
}
/// <summary>
/// Convierte los números decimales a la letra correspondiente en hexadecimal
/// </summary>
/// <param name="x">número decimal</param>
/// <returns>Letra hexadecimal</returns>
public static char DecToSingleHex(int x)
{
switch (x)
{
case 10:
return 'A';
case 11:
return 'B';
case 12:
return 'C';
case 13:
return 'D';
case 14:
return 'E';
case 15:
return 'F';
case 9:
return '9';
case 8:
return '8';
case 7:
return '7';
case 6:
return '6';
case 5:
return '5';
case 4:
return '4';
case 3:
return '3';
case 2:
return '2';
case 1:
return '1';
default:
return '0';
}
}
/// <summary>
/// Convierte de hexadecimal a decimal
/// </summary>
/// <param name="x">número hexadecimal</param>
/// <returns>número decimal</returns>
public static int HexToSingleDec(char x)
{
switch (x)
{
case 'A':
return 10;
case 'B':
return 11;
case 'C':
return 12;
case 'D':
return 13;
case 'E':
return 14;
case 'F':
return 15;
case '1':
return 1;
case '2':
return 2;
case '3':
return 3;
case '4':
return 4;
case '5':
return 5;
case '6':
return 6;
case '7':
return 7;
case '8':
return 8;
case '9':
return 9;
case '0':
return 0;
default:
return 0;
}
}
/// <summary>
/// Convierte un número hexadecimal en decimal
/// </summary>
/// <param name="hex">número hexadecimal</param>
/// <returns>número decimal</returns>
public static int HexToDec(string hex)
{
int resultado = 0;
int[] numeros = new int[hex.Length];
double j = 0;
for (int i = 0; i < hex.Length; i++)
numeros[i] = HexToSingleDec(hex[i]);
for (int i = numeros.Length - 1; i >= 0; i--)
{
resultado += numeros[i] * (int)Math.Pow(2, j);
j += 4;
byte byte1 = bytes[i];
byte byte2 = (byte)(bytes[i + 1] << 4);
bit8.Add((byte)(byte1 + byte2));
}
return resultado;
return bit8.ToArray();
}
public static string BytesToBits(byte[] bytes)

View File

@ -41,7 +41,7 @@
this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
this.MaximizeBox = false;
this.Name = "Visor";
this.Text = "Información completa de archivos";
this.Text = "S3C";
this.ResumeLayout(false);
}

View File

@ -14,6 +14,8 @@ namespace Tinke
public Visor()
{
InitializeComponent();
this.Text = Tools.Helper.ObtenerTraduccion("Sistema", "S3C");
}
}
}

View File

@ -112,12 +112,12 @@
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
<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=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
<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=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
<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

View File

@ -68,6 +68,13 @@
Are you sure you want exit? All the changes will be lost.
</S39>
<S3A>Warning</S3A>
<S3B>
Do you want to export the uncompressed folder instead of
the compress file?
</S3B>
<S3C>Full file information</S3C>
<S3D>Type 1</S3D>
<S3E>Type 2</S3E>
</Sistema>
<RomInfo>
<S01>Game information</S01>
@ -128,6 +135,7 @@
<S38>Reserved</S38>
<S39>Invalid</S39>
<S3A>Transparency</S3A>
<S3B>Edit</S3B>
</RomInfo>
<Autores>
<S01>About</S01>
@ -175,6 +183,17 @@
<br>The new ROM will be saved in: {0}</br>
</S0D>
<S0E>Export log</S0E>
<S0F>Time log:</S0F>
<S10>Total time:</S10>
<S11>Time reading header:</S11>
<S12>Time starting variable from Acciones.cs:</S12>
<S13>Time reading FNT:</S13>
<S14>Time adding system files:</S14>
<S15>Time reading FAT:</S15>
<S16>Time setting ROOT:</S16>
<S17>Time getting format files:</S17>
<S18>Time creating tree files:</S18>
<S19>Time recognizing files:</S19>
</Messages>
<NCLR>
<S01># palette:</S01>
@ -302,4 +321,82 @@
<S1D>Animations</S1D>
<S1E>Double-click to the animation to see it in full size</S1E>
</NANR>
<Compression>
<!-- LZ77 -->
<S00>Size is over the limit (>2GB).</S00>
<S01>File {0:s} is not a valid LZ77 file.</S01>
<S02>{0:s} will be larger than 0x{1:x} (0x{2:x}) and will not be decompressed</S02>
<S03>Decompressing {0:s}. Decompressed size 0x{1:x}</S03>
<S04>Incompleted data.</S04>
<S05>Cannot go back more than already written</S05>
<S06>Too many data in file; current INPOS = {0:x}</S06>
<S07>LZ77 file decompressed {0:s}</S07>
<!-- HUFFMAN -->
<S08>Invalid huffman compressed file; invalid tag {0:x}</S08>
<S09>Invalid size data {0:x}</S09>
<S0A>Incompleted data</S0A>
<S0B>Too many data, str={0:s}, idx={1:g}/{2:g}</S0B>
<S0C>First 4 bits of data should be 0 if dataSize = 4</S0C>
<S0D>HUFFMAN file decompressed {0:s}</S0D>
<!-- LZSS -->
<S0E>File {0:s} is not a valid LZSS-11 compressed file.</S0E>
<S0F>LZSS-11 file decompressed {0:s}</S0F>
<!-- RLE -->
<S10>File {0:s} is not a valid RLE compressed file.</S10>
<S11>RLE file decompressed {0:s}</S11>
<!-- NONE -->
<S12>File {0:s} is not a valid NONE file, it does not have the NONE-tag as first byte</S12>
<S13>File {0:s} is not a valid NONE file, the decompression size shold be the file size - 4</S13>
<S14>NONE file decompressed {0:s}</S14>
<!-- Basico -->
<S15>The file couldn't been decompressed correctly {0:s}</S15>
</Compression>
<EditRomInfo>
<S00>Header and banner editor</S00>
<S01>Save</S01>
<S02>Cancelr</S02>
<S03>Header</S03>
<S04>Banner</S04>
<S05>Change icon</S05>
<S06>Version:</S06>
<S07>Game titles:</S07>
<S08>Japanese</S08>
<S09>English</S09>
<S0A>French</S0A>
<S0B>German</S0B>
<S0C>Italian</S0C>
<S0D>Spanish</S0D>
<S0E>Reserved (28 bytes Hexadecimal):</S0E>
<S0F>Game title:</S0F>
<S10>Game code:</S10>
<S11>Maker code:</S11>
<S12>Device code:</S12>
<S13>Reserved (9 bytes Hexadecimal):</S13>
<S14>ROM version:</S14>
<S15>Internal flags:</S15>
<S16>ARM9 entry address:</S16>
<S17>ARM9 load address:</S17>
<S18>ARM7 entry address:</S18>
<S19>ARM7 load address:</S19>
<S1A>Normal card control register settings:</S1A>
<S1B>Secure card control register settings:</S1B>
<S1C>Show all maker codes</S1C>
<S1D>Secure transfer timeout:</S1D>
<S1E>Secure disable:</S1E>
<S1F>Reserved 3 (4 bytes Hexadecimal):</S1F>
<S20>Reserved 2 (56 bytes Hexadecimal):</S20>
<S21>ARM9 autoload:</S21>
<S22>ARM7 autoload:</S22>
<S23>Debug ROM offset:</S23>
<S24>Debug length:</S24>
<S25>Debug RAM offset:</S25>
<S26>
The image must be saved with 4bpp depth.
The selected image is 8bpp and can not be imported.
</S26>
<S27>Encryption seed:</S27>
<S28>Code</S28>
<S29>Company</S29>
<S2A>Company codes</S2A>
</EditRomInfo>
</Language>

View File

@ -69,6 +69,13 @@
todos los cambios.
</S39>
<S3A>Advertencia</S3A>
<S3B>
¿Desea exportar la carpeta descomprimida en lugar
del archivo comprimido?
</S3B>
<S3C>Información completa de archivos</S3C>
<S3D>Tipo 1</S3D>
<S3E>Tipo 2</S3E>
</Sistema>
<RomInfo>
<S01>Información de la ROM</S01>
@ -129,6 +136,7 @@
<S38>Reservado</S38>
<S39>Inválido</S39>
<S3A>Transparencia</S3A>
<S3B>Editar</S3B>
</RomInfo>
<Autores>
<S01>Acerca de</S01>
@ -179,6 +187,17 @@
<br>La nueva ROM se guardará en: {0}</br>
</S0D>
<S0E>Exportar log</S0E>
<S0F>Cálculo de tiempos:</S0F>
<S10>Tiempo total:</S10>
<S11>Tiempo en obtener cabecera:</S11>
<S12>Tiempo en inicializar Acciones.cs:</S12>
<S13>Tiempo en leer FNT:</S13>
<S14>Tiempo en añadir archivos del sistema:</S14>
<S15>Tiempo en leer FAT:</S15>
<S16>Tiempo en asignar ROOT:</S16>
<S17>Tiempo en obtener los formatos:</S17>
<S18>Tiempo en jerarquizar el árbol:</S18>
<S19>Tiempo en obtener el porcentaje de archivos soportados:</S19>
</Messages>
<NCLR>
<S01>Nº de paleta:</S01>
@ -309,4 +328,82 @@
<S1D>Animaciones</S1D>
<S1E>Haz doble click en la animación para verla a tamaño real.</S1E>
</NANR>
<Compression>
<!-- LZ77-->
<S00>Tamaño máximo excedido (>2GB).</S00>
<S01>El archivo {0:s} no tiene una compresión LZ77 válida.</S01>
<S02>El archivo {0:s} excede el tamaño máximo 0x{1:x} (0x{2:x}) y no puede ser descomprimido.</S02>
<S03>Descomprimiendo {0:s}. Tamaño descomprimido 0x{1:x}</S03>
<S04>Datos incompletos.</S04>
<S05>No se puede retroceder más. Fallo al descomprimir.</S05>
<S06>Demasiados datos en el archivo. Posición actual = {0:x}</S06>
<S07>Archivo LZ77 descomprimido {0:s}</S07>
<!-- HUFFMAN -->
<S08>Archivo con compresión huffman inválida, Tag {0:x}</S08>
<S09>Tamaño de datos no soportado {0:x}</S09>
<S0A>Faltan datos</S0A>
<S0B>Hay demasiados datos; str={0:s}, idx={1:g}/{2:g}</S0B>
<S0C>Los primeros 4 bits de datos deberían ser 0 si dataSize = 4</S0C>
<S0D>Archivo HUFFMAN descomprimido {0:s}</S0D>
<!-- LZSS -->
<S0E>El archivo {0:s} no tiene una compresión LZSS-11 válida.</S0E>
<S0F>Archivo LZSS-11 descomprimido {0:s}</S0F>
<!-- RLE -->
<S10>El archivo {0:s} no tiene una compresión RLE válida.</S10>
<S11>Archivo RLE descomprimido {0:s}</S11>
<!-- NONE -->
<S12>El archivo {0:s} no tiene tag válido como primer byte</S12>
<S13>El archivo {0:s} no es un archivo NONE válido, el tamaño descomprimido debería ser "tamaño del archivo - 4"</S13>
<S14>Archivo NONE descomprimido {0:s}</S14>
<!-- Basico -->
<S15>El archivo no pudo ser descomprimido correctamente {0:s}</S15>
</Compression>
<EditRomInfo>
<S00>Editar cabecera y banner del juego</S00>
<S01>Aceptar</S01>
<S02>Cancelar</S02>
<S03>Cabecera</S03>
<S04>Banner</S04>
<S05>Cambiar icono</S05>
<S06>Versión:</S06>
<S07>Títulos del juego:</S07>
<S08>Japonés</S08>
<S09>Inglés</S09>
<S0A>Francés</S0A>
<S0B>Alemán</S0B>
<S0C>Italiano</S0C>
<S0D>Español</S0D>
<S0E>Reservado (28 bytes en Hexadecimal):</S0E>
<S0F>Título del juego:</S0F>
<S10>Código del juego:</S10>
<S11>Código de la compañía:</S11>
<S12>Código de la consola:</S12>
<S13>Reservado (9 bytes en Hexadecimal):</S13>
<S14>Versión de la ROM:</S14>
<S15>Indicadores internos:</S15>
<S16>ARM9 entry address:</S16>
<S17>ARM9 load address:</S17>
<S18>ARM7 entry address:</S18>
<S19>ARM7 load address:</S19>
<S1A>Ajuste de control normales:</S1A>
<S1B>Ajuste de seguridad normales:</S1B>
<S1C>Mostrar todos los códigos de las compañías</S1C>
<S1D>ROM timeout:</S1D>
<S1E>Seguridad deshabilitada:</S1E>
<S1F>Reservado 3 (4 bytes en Hexadecimal):</S1F>
<S20>Reservado 2 (56 bytes en Hexadecimal):</S20>
<S21>ARM9 autoload:</S21>
<S22>ARM7 autoload:</S22>
<S23>Offset de debug de la ROM:</S23>
<S24>Tamaño de debug:</S24>
<S25>Offset de la RAM de debug:</S25>
<S26>
La imagen se debe guardar con profundidad 4bpp.
La imagen importada en 8bpp y por tanto no se puede importar.
</S26>
<S27>Encryption seed:</S27>
<S28>Código</S28>
<S29>Compañía</S29>
<S2A>Códigos de las compañías</S2A>
</EditRomInfo>
</Language>

View File

@ -68,6 +68,13 @@
Êtes-vous sûr de vouloir quitter ? Toutes les modifications seront perdues.
</S39>
<S3A>Attention</S3A>
<S3B>
Do you want to export the uncompressed folder instead of
the compress file?
</S3B>
<S3C>Full file information</S3C>
<S3D>Type 1</S3D>
<S3E>Type 2</S3E>
</Sistema>
<RomInfo>
<S01>Informations de la ROM</S01>
@ -128,6 +135,7 @@
<S38>Réservé</S38>
<S39>Non valide</S39>
<S3A>Transparence</S3A>
<S3B>Edit</S3B>
</RomInfo>
<Autores>
<S01>À propos de</S01>
@ -172,6 +180,17 @@
<br>La nouvelle ROM a été sauvegardée dans : {0}</br>
</S0D>
<S0E>Exporter registre</S0E>
<S0F>Time log:</S0F>
<S10>Total time:</S10>
<S11>Time reading header:</S11>
<S12>Time starting variable from Acciones.cs:</S12>
<S13>Time reading FNT:</S13>
<S14>Time adding system files:</S14>
<S15>Time reading FAT:</S15>
<S16>Time setting ROOT:</S16>
<S17>Time getting format files:</S17>
<S18>Time creating tree files:</S18>
<S19>Time recognizing files:</S19>
</Messages>
<NCLR>
<S01>Nombre de la palette :</S01>
@ -190,13 +209,16 @@
<S0E>Nombre étrange de sections ? : </S0E>
<S0F>palettes trouvées</S0F>
<S10>couleurs.</S10>
<S11>Modify</S11>
<S12>Start byte:</S12>
<S13>Import</S13>
<S14>Change the depth</S14>
<S11>Modifier</S11>
<S12>Octet de départ :</S12>
<S13>Importer</S13>
<S14>Changer la profondeur</S14>
</NCLR>
<NCGR>
<S01>Faites un double clique sur l'image pour la voir en taille réelle.</S01>
<S01>
Faites un double clique sur l'image pour la voir en
taille réelle.
</S01>
<S02>Propriétés</S02>
<S03>Position</S03>
<S04>Champ</S04>
@ -231,7 +253,7 @@
<S21>Importer</S21>
</NCGR>
<NCER>
<S01>Banques:</S01>
<S01>Banques :</S01>
<S02>Montrer toutes les banques</S02>
<S03>Enregistrer</S03>
<S04>Propriétés</S04>
@ -264,8 +286,8 @@
<S1F>Longueur</S1F>
<S20>Hauteur</S20>
<S21>Numéro de palette</S21>
<S22>Original tile offset</S22>
<S23>Fixed tile offset</S23>
<S22>Offset tuile originale</S22>
<S23>Offset tuile fixée</S23>
</NCER>
<NANR>
<S01>Intervalle :</S01>
@ -299,4 +321,82 @@
<S1D>Animations</S1D>
<S1E>Faites un double clique sur l'image pour la voir en taille réelle.</S1E>
</NANR>
<Compression>
<!-- LZ77 -->
<S00>Size is over the limit (>2GB).</S00>
<S01>File {0:s} is not a valid LZ77 file.</S01>
<S02>{0:s} will be larger than 0x{1:x} (0x{2:x}) and will not be decompressed</S02>
<S03>Decompressing {0:s}. Decompressed size 0x{1:x}</S03>
<S04>Incompleted data.</S04>
<S05>Cannot go back more than already written</S05>
<S06>Too many data in file; current INPOS = {0:x}</S06>
<S07>LZ77 file decompressed {0:s}</S07>
<!-- HUFFMAN -->
<S08>Invalid huffman compressed file; invalid tag {0:x}</S08>
<S09>Invalid size data {0:x}</S09>
<S0A>Incompleted data</S0A>
<S0B>Too many data, str={0:s}, idx={1:g}/{2:g}</S0B>
<S0C>First 4 bits of data should be 0 if dataSize = 4</S0C>
<S0D>HUFFMAN file decompressed {0:s}</S0D>
<!-- LZSS -->
<S0E>File {0:s} is not a valid LZSS-11 compressed file.</S0E>
<S0F>LZSS-11 file decompressed {0:s}</S0F>
<!-- RLE -->
<S10>File {0:s} is not a valid RLE compressed file.</S10>
<S11>RLE file decompressed {0:s}</S11>
<!-- NONE -->
<S12>File {0:s} is not a valid NONE file, it does not have the NONE-tag as first byte</S12>
<S13>File {0:s} is not a valid NONE file, the decompression size shold be the file size - 4</S13>
<S14>NONE file decompressed {0:s}</S14>
<!-- Basico -->
<S15>The file couldn't been decompressed correctly {0:s}</S15>
</Compression>
<EditRomInfo>
<S00>Header and banner editor</S00>
<S01>Save</S01>
<S02>Cancel</S02>
<S03>Header</S03>
<S04>Bannière</S04>
<S05>Changer icone</S05>
<S06>Version :</S06>
<S07>Titres du jeu :</S07>
<S08>Japonais</S08>
<S09>Anglais</S09>
<S0A>Français</S0A>
<S0B>Allemand</S0B>
<S0C>Italien</S0C>
<S0D>Espagnol</S0D>
<S0E>Réservé (28 bytes Hexadecimal):</S0E>
<S0F>Titre du jeu :</S0F>
<S10>Code du jeu :</S10>
<S11>Code du créateur :</S11>
<S12>Code de console :</S12>
<S13>Réservé (9 bytes Hexadecimal) :</S13>
<S14>Version de la ROM :</S14>
<S15>Indicateurs internes :</S15>
<S16>Adresse entrée ARM9 :</S16>
<S17>Adresse chargée ARM9 :</S17>
<S18>Adresse entrée ARM7 :</S18>
<S19>Adresse chargée ARM7 :</S19>
<S1A>Ajustements de contrôle normales :</S1A>
<S1B>Ajustements de sécurité normales :</S1B>
<S1C>Show all maker codes</S1C>
<S1D>Délai de transfert sécurisé :</S1D>
<S1E>Sécurité désactivée :</S1E>
<S1F>Réservé 3 (4 bytes Hexadecimal) :</S1F>
<S20>Réservé 2 (56 bytes Hexadecimal) :</S20>
<S21>Auto-charger ARM9 :</S21>
<S22>Auto-charger ARM7 :</S22>
<S23>Offset de debug de la ROM :</S23>
<S24>Taille de debug :</S24>
<S25>Offset de la RAM de debug :</S25>
<S26>
The image must be saved with 4bpp depth.
The selected image is 8bpp and can not be imported.
</S26>
<S27>Encryption seed:</S27>
<S28>Code</S28>
<S29>Company</S29>
<S2A>Company codes</S2A>
</EditRomInfo>
</Language>

View File

@ -1,5 +1,7 @@
0.7.4 (public release):
*** Import BitMaP images and convert it to NCLR,NCGR,NSCR files
*** Header and banner editor
*** WAV to STRM converter
* New methods and functions in IPluginHost interface
* Add new file format in "Open As..." -> Extract FAT (files with offsets at the beggining)
* Add new file format in "Open As..." -> Text