mirror of
https://github.com/R-YaTian/TinkeDSi.git
synced 2025-06-18 08:35:35 -04:00
* Export palletes to Gimp 2.8 format (.pal)
* Check for duplicated colors in palettes * Fixed problems writing raw images * Fixed problem with 5x5 texel texture format * Fixed problem with images inside /cha folder in 999 * Fixed problems in Inazuma11 with encryption * Fixed problems in Layton plugin with text files * Improved Ninokuni plugin * Overlay9 table is now updated while compiling new rom
This commit is contained in:
parent
b5b5c877dd
commit
f0d54993d6
@ -51,8 +51,11 @@ namespace Ekona
|
||||
|
||||
String Search_File(int id); // Search file by id
|
||||
sFile Search_File(short id);
|
||||
sFolder Search_File(string name);
|
||||
Byte[] Get_Bytes(string path, int offset, int length);
|
||||
|
||||
sFolder Search_Folder(int id);
|
||||
|
||||
string Get_Language();
|
||||
string Get_LangXML();
|
||||
|
||||
|
@ -545,56 +545,14 @@ namespace Ekona.Images
|
||||
if (px == Color.Transparent && id == -1)
|
||||
id = 0;
|
||||
|
||||
// Try to find the nearest color
|
||||
decimal min_distance = (decimal)Math.Sqrt(3) * 255; // Set the max distance
|
||||
double module = Math.Sqrt(px.R * px.R + px.G * px.G + px.B * px.B);
|
||||
int curr_id = -1;
|
||||
for (int c = 1; c < newp.Length && id == -1; c++)
|
||||
{
|
||||
double modulec = Math.Sqrt(newp[c].R * newp[c].R + newp[c].G * newp[c].G + newp[c].B * newp[c].B);
|
||||
decimal distance = (decimal)Math.Abs(module - modulec);
|
||||
|
||||
if (distance < min_distance)
|
||||
{
|
||||
min_distance = distance;
|
||||
curr_id = c;
|
||||
}
|
||||
}
|
||||
|
||||
if (id == -1 && min_distance <= threshold)
|
||||
id = curr_id;
|
||||
|
||||
// If still it doesn't found the color try with the first one, usually is transparent so for this reason we leave it to the end
|
||||
if (id == -1)
|
||||
{
|
||||
double modulec = Math.Sqrt(newp[0].R * newp[0].R + newp[0].G * newp[0].G + newp[0].B * newp[0].B);
|
||||
decimal distance = (decimal)Math.Abs(module - modulec);
|
||||
|
||||
if (distance <= threshold)
|
||||
id = 0;
|
||||
}
|
||||
|
||||
if (id == -1)
|
||||
{
|
||||
// If the color is not found, maybe is that the pixel own to another cell (overlapping cells).
|
||||
// For this reason, there are two ways to do that:
|
||||
// 1º Get the original hidden color from the original file <- In mind
|
||||
// 2º Set this pixel as transparent to show the pixel from the other cell (tiles[i] = 0) <- Done!
|
||||
|
||||
if (notfound.Count == 0)
|
||||
Console.WriteLine("The following colors couldn't been found!");
|
||||
Console.WriteLine(px.ToString() + " at " + i.ToString() + " (distance: " + min_distance.ToString() + ')');
|
||||
notfound.Add(px);
|
||||
|
||||
tiles[i] = 0;
|
||||
continue;
|
||||
}
|
||||
id = FindNextColor(px, newp);
|
||||
|
||||
tiles[i] = (byte)id;
|
||||
}
|
||||
|
||||
//if (notfound.Count > 0)
|
||||
// throw new NotSupportedException("Color not found in the original palette!");
|
||||
if (notfound.Count > 0)
|
||||
throw new NotSupportedException("Color not found in the original palette!");
|
||||
|
||||
if (format == ColorFormat.colors16)
|
||||
tiles = Helper.BitsConverter.Bits4ToByte(tiles);
|
||||
@ -620,6 +578,53 @@ namespace Ekona.Images
|
||||
return offset;
|
||||
}
|
||||
|
||||
public static int FindNextColor(Color c, Color[] palette, decimal threshold = 0)
|
||||
{
|
||||
int id = -1;
|
||||
|
||||
decimal min_distance = (decimal)Math.Sqrt(3) * 255; // Set the max distance
|
||||
double module = Math.Sqrt(c.R * c.R + c.G * c.G + c.B * c.B);
|
||||
for (int i = 1; i < palette.Length; i++)
|
||||
{
|
||||
double modulec = Math.Sqrt(palette[i].R * palette[i].R + palette[i].G * palette[i].G + palette[i].B * palette[i].B);
|
||||
decimal distance = (decimal)Math.Abs(module - modulec);
|
||||
|
||||
if (distance < min_distance)
|
||||
{
|
||||
min_distance = distance;
|
||||
id = i;
|
||||
}
|
||||
}
|
||||
|
||||
if (min_distance > threshold) // If the distance it's bigger than wanted
|
||||
id = -1;
|
||||
|
||||
// If still it doesn't found the color try with the first one, usually is transparent so for this reason we leave it to the end
|
||||
if (id == -1)
|
||||
{
|
||||
double modulec = Math.Sqrt(palette[0].R * palette[0].R + palette[0].G * palette[0].G + palette[0].B * palette[0].B);
|
||||
decimal distance = (decimal)Math.Abs(module - modulec);
|
||||
|
||||
if (distance <= threshold)
|
||||
id = 0;
|
||||
}
|
||||
|
||||
if (id == -1)
|
||||
{
|
||||
// If the color is not found, maybe is that the pixel own to another cell (overlapping cells).
|
||||
// For this reason, there are two ways to do that:
|
||||
// 1º Get the original hidden color from the original file <- In mind
|
||||
// 2º Set this pixel as transparent to show the pixel from the other cell (tiles[i] = 0) <- Done!
|
||||
// If there isn't overlapping cells, throw exception <- In mind
|
||||
|
||||
Console.Write("Color not found: ");
|
||||
Console.WriteLine(c.ToString() + " (distance: " + min_distance.ToString() + ')');
|
||||
|
||||
id = 0;
|
||||
}
|
||||
|
||||
return id;
|
||||
}
|
||||
public static void Indexed_Image(Bitmap img, ColorFormat cf, out byte[] tiles, out Color[] palette)
|
||||
{
|
||||
// It's a slow method but it should work always
|
||||
|
@ -30,6 +30,7 @@ namespace Ekona.Images.Formats
|
||||
{
|
||||
public class PaletteWin : PaletteBase
|
||||
{
|
||||
bool gimp_error; // Error of Gimp, it reads the first colors at 0x1C instead of 0x18
|
||||
public PaletteWin(string file) : base()
|
||||
{
|
||||
Read(file);
|
||||
@ -78,6 +79,7 @@ namespace Ekona.Images.Formats
|
||||
bw.Write((uint)palette[0].Length * 4 + 4); // data_size = file_length - 0x14
|
||||
bw.Write((ushort)0x0300); // version = 00 03
|
||||
bw.Write((ushort)(palette[0].Length)); // num_colors
|
||||
if (gimp_error) bw.Write((uint)0x00); // Error in Gimp 2.8
|
||||
for (int i = 0; i < palette[0].Length; i++)
|
||||
{
|
||||
bw.Write(palette[0][i].R);
|
||||
@ -90,5 +92,11 @@ namespace Ekona.Images.Formats
|
||||
bw.Close();
|
||||
}
|
||||
|
||||
|
||||
public bool Gimp_Error
|
||||
{
|
||||
get { return gimp_error; }
|
||||
set { gimp_error = value; }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -32,6 +32,7 @@ namespace Ekona.Images
|
||||
{
|
||||
|
||||
#region Variable definition
|
||||
protected IPluginHost pluginHost; // Optional
|
||||
protected string fileName;
|
||||
protected int id;
|
||||
bool loaded;
|
||||
@ -71,6 +72,18 @@ namespace Ekona.Images
|
||||
|
||||
Read(file);
|
||||
}
|
||||
public ImageBase(string file, int id, IPluginHost pluginHost, string fileName = "")
|
||||
{
|
||||
this.id = id;
|
||||
this.pluginHost = pluginHost;
|
||||
if (fileName == "")
|
||||
this.fileName = Path.GetFileName(file);
|
||||
else
|
||||
this.fileName = fileName;
|
||||
|
||||
Read(file);
|
||||
}
|
||||
|
||||
|
||||
public Image Get_Image(PaletteBase palette)
|
||||
{
|
||||
@ -123,7 +136,7 @@ namespace Ekona.Images
|
||||
}
|
||||
|
||||
zoom = 1;
|
||||
startByte = 0;
|
||||
//startByte = 0;
|
||||
loaded = true;
|
||||
|
||||
bpp = 8;
|
||||
|
@ -30,6 +30,7 @@ namespace Ekona.Images
|
||||
{
|
||||
|
||||
#region Variables
|
||||
protected IPluginHost pluginHost;
|
||||
protected int id;
|
||||
protected string fileName;
|
||||
bool loaded;
|
||||
@ -57,6 +58,17 @@ namespace Ekona.Images
|
||||
|
||||
Read(fileIn);
|
||||
}
|
||||
public MapBase(string fileIn, int id, IPluginHost pluginHost, string fileName = "")
|
||||
{
|
||||
this.pluginHost = pluginHost;
|
||||
this.id = id;
|
||||
if (fileName == "")
|
||||
this.fileName = System.IO.Path.GetFileName(fileIn);
|
||||
else
|
||||
this.fileName = fileName;
|
||||
|
||||
Read(fileIn);
|
||||
}
|
||||
public MapBase(NTFS[] mapInfo, bool editable, int width = 0, int height = 0, string fileName = "")
|
||||
{
|
||||
this.fileName = fileName;
|
||||
|
@ -30,6 +30,7 @@ namespace Ekona.Images
|
||||
public abstract class PaletteBase
|
||||
{
|
||||
#region Variables
|
||||
protected IPluginHost pluginHost;
|
||||
protected String fileName;
|
||||
protected int id;
|
||||
bool loaded;
|
||||
@ -53,6 +54,17 @@ namespace Ekona.Images
|
||||
this.fileName = fileName;
|
||||
Set_Palette(pal, editable);
|
||||
}
|
||||
public PaletteBase(string fileIn, int id, IPluginHost pluginHost, string fileName = "")
|
||||
{
|
||||
this.pluginHost = pluginHost;
|
||||
if (fileName == "")
|
||||
this.fileName = System.IO.Path.GetFileName(fileIn);
|
||||
else
|
||||
this.fileName = fileName;
|
||||
this.id = id;
|
||||
|
||||
Read(fileIn);
|
||||
}
|
||||
public PaletteBase(string fileIn, int id, string fileName = "")
|
||||
{
|
||||
if (fileName == "")
|
||||
@ -64,6 +76,7 @@ namespace Ekona.Images
|
||||
Read(fileIn);
|
||||
}
|
||||
|
||||
|
||||
public abstract void Read(string fileIn);
|
||||
public abstract void Write(string fileOut);
|
||||
|
||||
@ -249,6 +262,15 @@ namespace Ekona.Images
|
||||
startByte = 0;
|
||||
}
|
||||
|
||||
public bool Has_DuplicatedColors(int index)
|
||||
{
|
||||
for (int i = 0; i < palette[index].Length; i++)
|
||||
for (int j = 0; j < palette[index].Length; j++)
|
||||
if (j != i && palette[index][i] == palette[index][j])
|
||||
return true;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
#region Properties
|
||||
public int StartByte
|
||||
|
@ -77,6 +77,8 @@ namespace Ekona.Images
|
||||
numFillColors.Value = 16;
|
||||
else
|
||||
numFillColors.Value = 256;
|
||||
|
||||
checkDuplicated.Checked = palette.Has_DuplicatedColors(0);
|
||||
}
|
||||
private void ReadLanguage()
|
||||
{
|
||||
@ -108,6 +110,7 @@ namespace Ekona.Images
|
||||
private void numericPalette_ValueChanged(object sender, EventArgs e)
|
||||
{
|
||||
picPalette.Image = palette.Get_Image((int)numericPalette.Value);
|
||||
checkDuplicated.Checked = palette.Has_DuplicatedColors((int)numericPalette.Value);
|
||||
}
|
||||
private void numericStartByte_ValueChanged(object sender, EventArgs e)
|
||||
{
|
||||
@ -116,6 +119,7 @@ namespace Ekona.Images
|
||||
|
||||
numericPalette.Maximum = palette.NumberOfPalettes - 1;
|
||||
label3.Text = translation[0] + (palette.NumberOfPalettes - 1).ToString();
|
||||
checkDuplicated.Checked = palette.Has_DuplicatedColors((int)numericPalette.Value);
|
||||
}
|
||||
private void comboDepth_SelectedIndexChanged(object sender, EventArgs e)
|
||||
{
|
||||
@ -131,6 +135,7 @@ namespace Ekona.Images
|
||||
numFillColors.Value = 16;
|
||||
else
|
||||
numFillColors.Value = 256;
|
||||
checkDuplicated.Checked = palette.Has_DuplicatedColors((int)numericPalette.Value);
|
||||
}
|
||||
|
||||
private void picPalette_MouseClick(object sender, MouseEventArgs e)
|
||||
@ -186,23 +191,25 @@ namespace Ekona.Images
|
||||
o.AddExtension = true;
|
||||
o.CheckPathExists = true;
|
||||
o.DefaultExt = ".pal";
|
||||
o.Filter = "Windows Palette (*.pal)|*.pal|" +
|
||||
"Portable Network Graphics (*.png)|*.png|" +
|
||||
"Adobe COlor (*.aco)|*.aco";
|
||||
o.Filter = "Windows Palette for Gimp 2.8 (*.pal)|*.pal|" +
|
||||
"Windows Palette (*.pal)|*.pal|" +
|
||||
"Portable Network Graphics (*.png)|*.png|" +
|
||||
"Adobe COlor (*.aco)|*.aco";
|
||||
o.OverwritePrompt = true;
|
||||
o.FileName = palette.FileName;
|
||||
|
||||
if (o.ShowDialog() != DialogResult.OK)
|
||||
return;
|
||||
|
||||
if (o.FilterIndex == 2)
|
||||
if (o.FilterIndex == 3)
|
||||
picPalette.Image.Save(o.FileName, System.Drawing.Imaging.ImageFormat.Png);
|
||||
else if (o.FilterIndex == 1)
|
||||
else if (o.FilterIndex == 1 || o.FilterIndex == 2)
|
||||
{
|
||||
Formats.PaletteWin palwin = new Formats.PaletteWin(palette.Palette[(int)numericPalette.Value]);
|
||||
if (o.FilterIndex == 1) palwin.Gimp_Error = true;
|
||||
palwin.Write(o.FileName);
|
||||
}
|
||||
else if (o.FilterIndex == 3)
|
||||
else if (o.FilterIndex == 4)
|
||||
{
|
||||
Formats.ACO palaco = new Formats.ACO(palette.Palette[(int)numericPalette.Value]);
|
||||
palaco.Write(o.FileName);
|
||||
@ -275,6 +282,7 @@ namespace Ekona.Images
|
||||
palette.FillColors((int)numFillColors.Value, (int)numericPalette.Value);
|
||||
Write_File();
|
||||
picPalette.Image = palette.Get_Image((int)numericPalette.Value);
|
||||
checkDuplicated.Checked = palette.Has_DuplicatedColors((int)numericPalette.Value);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
14
Ekona/Images/PaletteControl.designer.cs
generated
14
Ekona/Images/PaletteControl.designer.cs
generated
@ -64,6 +64,7 @@ namespace Ekona.Images
|
||||
this.label5 = new System.Windows.Forms.Label();
|
||||
this.numFillColors = new System.Windows.Forms.NumericUpDown();
|
||||
this.btnFillColors = new System.Windows.Forms.Button();
|
||||
this.checkDuplicated = new System.Windows.Forms.CheckBox();
|
||||
((System.ComponentModel.ISupportInitialize)(this.picPalette)).BeginInit();
|
||||
((System.ComponentModel.ISupportInitialize)(this.numericPalette)).BeginInit();
|
||||
((System.ComponentModel.ISupportInitialize)(this.numericStartByte)).BeginInit();
|
||||
@ -243,12 +244,24 @@ namespace Ekona.Images
|
||||
this.btnFillColors.UseVisualStyleBackColor = true;
|
||||
this.btnFillColors.Click += new System.EventHandler(this.btnFillColors_Click);
|
||||
//
|
||||
// checkDuplicated
|
||||
//
|
||||
this.checkDuplicated.AutoSize = true;
|
||||
this.checkDuplicated.Enabled = false;
|
||||
this.checkDuplicated.Location = new System.Drawing.Point(166, 72);
|
||||
this.checkDuplicated.Name = "checkDuplicated";
|
||||
this.checkDuplicated.Size = new System.Drawing.Size(128, 17);
|
||||
this.checkDuplicated.TabIndex = 17;
|
||||
this.checkDuplicated.Text = "Has duplicated colors";
|
||||
this.checkDuplicated.UseVisualStyleBackColor = true;
|
||||
//
|
||||
// PaletteControl
|
||||
//
|
||||
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.checkDuplicated);
|
||||
this.Controls.Add(this.btnFillColors);
|
||||
this.Controls.Add(this.numFillColors);
|
||||
this.Controls.Add(this.label5);
|
||||
@ -296,5 +309,6 @@ namespace Ekona.Images
|
||||
private System.Windows.Forms.Label label5;
|
||||
private System.Windows.Forms.NumericUpDown numFillColors;
|
||||
private System.Windows.Forms.Button btnFillColors;
|
||||
private System.Windows.Forms.CheckBox checkDuplicated;
|
||||
}
|
||||
}
|
||||
|
@ -144,8 +144,8 @@ namespace Ekona.Images
|
||||
public class RawImage : ImageBase
|
||||
{
|
||||
// Unknown data - Needed to write the file
|
||||
byte[] prev_data;
|
||||
byte[] next_data;
|
||||
byte[] prev_data, post_data;
|
||||
byte[] ori_data;
|
||||
|
||||
public RawImage(String file, int id, TileForm form, ColorFormat format,
|
||||
bool editable, int offset, int size, string fileName = "") : base()
|
||||
@ -188,15 +188,22 @@ namespace Ekona.Images
|
||||
int offset, int fileSize)
|
||||
{
|
||||
BinaryReader br = new BinaryReader(File.OpenRead(fileIn));
|
||||
prev_data = br.ReadBytes(offset); // Save the previous data to write them then.
|
||||
prev_data = br.ReadBytes(offset);
|
||||
|
||||
if (fileSize <= 0)
|
||||
if (fileSize <= offset)
|
||||
fileSize = (int)br.BaseStream.Length;
|
||||
if (fileSize + offset >= br.BaseStream.Length)
|
||||
offset = (int)br.BaseStream.Length - fileSize;
|
||||
if (fileSize <= offset)
|
||||
fileSize = (int)br.BaseStream.Length;
|
||||
|
||||
ori_data = br.ReadBytes(fileSize);
|
||||
post_data = br.ReadBytes((int)(br.BaseStream.Length - br.BaseStream.Position));
|
||||
|
||||
br.BaseStream.Position = offset;
|
||||
|
||||
// Read the tiles
|
||||
Byte[] tiles = br.ReadBytes(fileSize);
|
||||
|
||||
next_data = br.ReadBytes((int)(br.BaseStream.Length - fileSize)); // Save the next data to write them then
|
||||
br.Close();
|
||||
|
||||
Set_Tiles(tiles, 0x0100, 0x00C0, format, form, editable);
|
||||
@ -230,12 +237,16 @@ namespace Ekona.Images
|
||||
|
||||
public override void Write(string fileOut, PaletteBase palette)
|
||||
{
|
||||
int image_size = Width * Height * BPP / 8;
|
||||
|
||||
BinaryWriter bw = new BinaryWriter(File.OpenWrite(fileOut));
|
||||
|
||||
bw.Write(prev_data);
|
||||
for (int i = 0; i < StartByte; i++)
|
||||
bw.Write(ori_data[i]);
|
||||
bw.Write(Tiles);
|
||||
bw.Write(next_data);
|
||||
|
||||
for (int i = image_size + StartByte; i < ori_data.Length; i++)
|
||||
bw.Write(ori_data[i]);
|
||||
bw.Write(post_data);
|
||||
bw.Flush();
|
||||
bw.Close();
|
||||
}
|
||||
|
@ -29,6 +29,7 @@ namespace Ekona.Images
|
||||
public abstract class SpriteBase
|
||||
{
|
||||
#region Variables
|
||||
protected IPluginHost pluginHost;
|
||||
protected string fileName;
|
||||
protected int id;
|
||||
bool loaded;
|
||||
@ -88,6 +89,18 @@ namespace Ekona.Images
|
||||
|
||||
Read(file);
|
||||
}
|
||||
public SpriteBase(string file, int id, IPluginHost pluginHost, string fileName = "")
|
||||
{
|
||||
this.pluginHost = pluginHost;
|
||||
if (fileName == "")
|
||||
this.fileName = Path.GetFileName(file);
|
||||
else
|
||||
this.fileName = fileName;
|
||||
this.id = id;
|
||||
|
||||
Read(file);
|
||||
}
|
||||
|
||||
|
||||
public abstract void Read(string fileIn);
|
||||
public abstract void Write(string fileOut, ImageBase image, PaletteBase palette);
|
||||
|
@ -594,7 +594,7 @@ namespace _3DModels
|
||||
|
||||
#region Get color from Texel and mode values
|
||||
Color color = Color.Black;
|
||||
if (palette.Length < 4)
|
||||
if (palette.Length < 4 && pal_mode != 1 && pal_mode != 3)
|
||||
goto Draw;
|
||||
|
||||
switch (pal_mode)
|
||||
|
@ -20,6 +20,7 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
using System.Drawing;
|
||||
using System.IO;
|
||||
using Ekona;
|
||||
|
||||
@ -57,7 +58,7 @@ namespace _3DModels
|
||||
{
|
||||
sBTX0 btx = BTX0.Read(file.path, file.id, pluginHost);
|
||||
|
||||
// Extract texture to temp folder
|
||||
Bitmap[] tex = new Bitmap[btx.texture.texInfo.num_objs];
|
||||
for (int i = 0; i < btx.texture.texInfo.num_objs; i++)
|
||||
{
|
||||
string fileOut = pluginHost.Get_TempFolder() + Path.DirectorySeparatorChar +
|
||||
@ -66,8 +67,10 @@ namespace _3DModels
|
||||
fileOut = pluginHost.Get_TempFolder() + Path.DirectorySeparatorChar + Path.GetRandomFileName() +
|
||||
'_' + btx.texture.texInfo.names[i] + ".png";
|
||||
|
||||
BTX0.GetTexture(pluginHost, btx, i).Save(fileOut);
|
||||
tex[i] = BTX0.GetTexture(pluginHost, btx, i);
|
||||
tex[i].Save(fileOut);
|
||||
}
|
||||
pluginHost.Set_Object(tex);
|
||||
}
|
||||
}
|
||||
public System.Windows.Forms.Control Show_Info(sFile file)
|
||||
|
@ -280,7 +280,7 @@ namespace _3DModels
|
||||
|
||||
#region Get color from Texel and mode values
|
||||
Color color = Color.Black;
|
||||
if (palette.Length < 4)
|
||||
if (palette.Length < 4 && pal_mode != 1 && pal_mode != 3)
|
||||
goto Draw;
|
||||
|
||||
switch (pal_mode)
|
||||
|
@ -51,8 +51,8 @@ namespace _999HRPERDOOR
|
||||
return Format.FullImage;
|
||||
if (ext == "AT6P")
|
||||
return Format.Compressed;
|
||||
if (file.name.EndsWith(".at6p"))
|
||||
return Format.FullImage;
|
||||
//if (file.name.EndsWith(".at6p"))
|
||||
// return Format.FullImage;
|
||||
|
||||
return Format.Unknown;
|
||||
}
|
||||
@ -61,8 +61,8 @@ namespace _999HRPERDOOR
|
||||
{
|
||||
if (file.id >= 0x13EF && file.id <= 0x1500)
|
||||
new SIR0_Sprite(pluginHost, file.path, file.id, file.name);
|
||||
if (file.name.EndsWith(".at6p"))
|
||||
new SIR0_Image(pluginHost, file.path, file.id, file.name);
|
||||
//if (file.name.EndsWith(".at6p"))
|
||||
// new SIR0_Image(pluginHost, file.path, file.id, file.name);
|
||||
}
|
||||
public System.Windows.Forms.Control Show_Info(sFile file)
|
||||
{
|
||||
|
@ -31,11 +31,10 @@ namespace _999HRPERDOOR
|
||||
public class SIR0_Sprite : SpriteBase
|
||||
{
|
||||
SIR0_Info info;
|
||||
IPluginHost pluginHost;
|
||||
|
||||
public SIR0_Sprite(IPluginHost pluginHost, string file, int id, string fileName = "") : base(file, id, fileName)
|
||||
public SIR0_Sprite(IPluginHost pluginHost, string file, int id, string fileName = "")
|
||||
: base(file, id, pluginHost, fileName)
|
||||
{
|
||||
this.pluginHost = pluginHost;
|
||||
}
|
||||
|
||||
public override void Read(string file)
|
||||
@ -134,11 +133,9 @@ namespace _999HRPERDOOR
|
||||
|
||||
public class SIR0_Image : ImageBase
|
||||
{
|
||||
IPluginHost pluginHost;
|
||||
|
||||
public SIR0_Image(IPluginHost pluginHost, string file, int id, string fileName = "") : base(file, id, fileName)
|
||||
public SIR0_Image(IPluginHost pluginHost, string file, int id, string fileName = "")
|
||||
: base(file, id, pluginHost, fileName)
|
||||
{
|
||||
this.pluginHost = pluginHost;
|
||||
}
|
||||
|
||||
public override void Read(string fileIn)
|
||||
|
@ -62,7 +62,6 @@ namespace INAZUMA11
|
||||
}
|
||||
public static void Encrypt_Item(string fileIn, string fileout)
|
||||
{
|
||||
BinaryWriter bw = new BinaryWriter(File.OpenWrite(fileout));
|
||||
byte[] data = File.ReadAllBytes(fileIn);
|
||||
|
||||
for (int i = 0; i < 0x400; i++)
|
||||
|
@ -172,7 +172,7 @@ namespace INAZUMA11
|
||||
|
||||
if (gameCode == "BOEJ" && file.id == 0x110)
|
||||
{
|
||||
Encryption.Encrypt_Item(file.path, fileout);
|
||||
Encryption.Encrypt_Item(unpacked.files[0].path, fileout);
|
||||
return fileout;
|
||||
}
|
||||
|
||||
|
@ -67,7 +67,7 @@ namespace LAYTON
|
||||
return Format.FullImage;
|
||||
else if (file.id == 0x0B73)
|
||||
return Format.System; // Dummy, it was text to test the puzzle system, nothing interesing and not used
|
||||
else if (file.name.EndsWith(".txt"))
|
||||
else if (file.name.EndsWith(".TXT"))
|
||||
return Format.Text;
|
||||
break;
|
||||
|
||||
|
@ -181,7 +181,7 @@ namespace LAYTON
|
||||
string text = ""; // Makes the compiler happy (siempre deseé poner eso :) )
|
||||
text = Convertir_Especiales(txtBox.Text,false);
|
||||
|
||||
string tempFile = Path.GetTempFileName();
|
||||
string tempFile = pluginHost.Get_TempFile();
|
||||
File.WriteAllText(tempFile, text);
|
||||
pluginHost.ChangeFile(id, tempFile);
|
||||
}
|
||||
|
@ -151,8 +151,7 @@ namespace NINOKUNI
|
||||
|
||||
return text;
|
||||
}
|
||||
|
||||
public static string Reformat(string text, int nIndent)
|
||||
public static string Reformat(string text, int nIndent, bool nr)
|
||||
{
|
||||
if (nIndent < 2)
|
||||
return "";
|
||||
@ -160,8 +159,16 @@ namespace NINOKUNI
|
||||
|
||||
if (text.Contains("\n"))
|
||||
{
|
||||
text = text.Remove(0, nIndent + 2);
|
||||
text = text.Remove(text.Length - nIndent);
|
||||
if (nr)
|
||||
{
|
||||
text = text.Remove(0, nIndent + 2);
|
||||
text = text.Remove(text.Length - nIndent);
|
||||
}
|
||||
else
|
||||
{
|
||||
text = text.Remove(0, nIndent + 1);
|
||||
text = text.Remove(text.Length - nIndent + 1);
|
||||
}
|
||||
text = text.Replace("\n" + s, "\n");
|
||||
}
|
||||
text = text.Replace('【', '<');
|
||||
@ -233,5 +240,26 @@ namespace NINOKUNI
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public static string Read_String(byte[] data)
|
||||
{
|
||||
string text = new String(Encoding.GetEncoding("shift_jis").GetChars(data));
|
||||
text = Helper.SJISToLatin(text.Replace("\0", ""));
|
||||
return text;
|
||||
}
|
||||
public static byte[] Write_String(string text, uint size)
|
||||
{
|
||||
byte[] d, t;
|
||||
|
||||
d = Encoding.GetEncoding("shift_jis").GetBytes(Helper.LatinToSJIS(text));
|
||||
t = new byte[size];
|
||||
if (d.Length > size)
|
||||
System.Windows.Forms.MessageBox.Show("Invalid text. It's so big\n" + text);
|
||||
else
|
||||
Array.Copy(d, t, d.Length);
|
||||
|
||||
d = null;
|
||||
return t;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -76,15 +76,27 @@ namespace NINOKUNI
|
||||
else if (file.name.EndsWith(".txt"))
|
||||
return Format.Text; // Subtitles
|
||||
else if (ext == "TMAP")
|
||||
return Format.Pack;
|
||||
return Format.FullImage;
|
||||
else if (ext == "spdl")
|
||||
return Format.Pack;
|
||||
else if (file.name == "arm9.bin")
|
||||
return Format.System;
|
||||
else if (Text.TextControl.IsSupported(file.id))
|
||||
return Format.Text;
|
||||
else if (ext == "WMAP")
|
||||
return Format.Pack;
|
||||
|
||||
return Format.Unknown;
|
||||
}
|
||||
|
||||
public void Read(sFile file)
|
||||
{
|
||||
//// BMP images
|
||||
//string fileOut = pluginHost.Get_TempFolder() + Path.DirectorySeparatorChar + file.name + ".png";
|
||||
//System.Drawing.Image img = System.Drawing.Image.FromFile(file.path);
|
||||
//img.Save(fileOut, System.Drawing.Imaging.ImageFormat.Png);
|
||||
//img.Dispose();
|
||||
//img = null;
|
||||
}
|
||||
public System.Windows.Forms.Control Show_Info(sFile file)
|
||||
{
|
||||
@ -100,6 +112,13 @@ namespace NINOKUNI
|
||||
return new MQuestText(pluginHost, file.path, file.id);
|
||||
else if (file.name.EndsWith(".txt"))
|
||||
return new SubtitleControl(pluginHost, file.path, file.id);
|
||||
else if (file.name == "arm9.bin")
|
||||
return new MainWin(pluginHost);
|
||||
else if (file.name.EndsWith(".tmap"))
|
||||
return new TMAPcontrol(file, pluginHost);
|
||||
|
||||
if (Text.TextControl.IsSupported(file.id))
|
||||
return new Text.TextControl(pluginHost, file);
|
||||
|
||||
return new System.Windows.Forms.Control();
|
||||
}
|
||||
@ -137,10 +156,10 @@ namespace NINOKUNI
|
||||
return NPCK.Unpack(file.path, file.name);
|
||||
else if (ext == "KPCN")
|
||||
return KPCN.Unpack(file.path, file.name);
|
||||
else if (ext == "TMAP")
|
||||
return TMAP.Unpack(file.path, file.name);
|
||||
else if (ext == "spdl")
|
||||
return SPDL.Unpack(file);
|
||||
else if (ext == "WMAP")
|
||||
return WMAP.Unpack(file.path, file.name);
|
||||
|
||||
return new sFolder();
|
||||
}
|
||||
|
97
Plugins/NINOKUNI/NINOKUNI/MainWin.Designer.cs
generated
Normal file
97
Plugins/NINOKUNI/NINOKUNI/MainWin.Designer.cs
generated
Normal file
@ -0,0 +1,97 @@
|
||||
namespace NINOKUNI
|
||||
{
|
||||
partial class MainWin
|
||||
{
|
||||
/// <summary>
|
||||
/// Variable del diseñador requerida.
|
||||
/// </summary>
|
||||
private System.ComponentModel.IContainer components = null;
|
||||
|
||||
/// <summary>
|
||||
/// Limpiar los recursos que se estén utilizando.
|
||||
/// </summary>
|
||||
/// <param name="disposing">true si los recursos administrados se deben eliminar; false en caso contrario, false.</param>
|
||||
protected override void Dispose(bool disposing)
|
||||
{
|
||||
if (disposing && (components != null))
|
||||
{
|
||||
components.Dispose();
|
||||
}
|
||||
base.Dispose(disposing);
|
||||
}
|
||||
|
||||
#region Código generado por el Diseñador de componentes
|
||||
|
||||
/// <summary>
|
||||
/// Método necesario para admitir el Diseñador. No se puede modificar
|
||||
/// el contenido del método con el editor de código.
|
||||
/// </summary>
|
||||
private void InitializeComponent()
|
||||
{
|
||||
this.btnSelectPath = new System.Windows.Forms.Button();
|
||||
this.label1 = new System.Windows.Forms.Label();
|
||||
this.txtPath = new System.Windows.Forms.TextBox();
|
||||
this.btnCompile = new System.Windows.Forms.Button();
|
||||
this.SuspendLayout();
|
||||
//
|
||||
// btnSelectPath
|
||||
//
|
||||
this.btnSelectPath.Location = new System.Drawing.Point(434, 3);
|
||||
this.btnSelectPath.Name = "btnSelectPath";
|
||||
this.btnSelectPath.Size = new System.Drawing.Size(75, 23);
|
||||
this.btnSelectPath.TabIndex = 0;
|
||||
this.btnSelectPath.Text = "Select path";
|
||||
this.btnSelectPath.UseVisualStyleBackColor = true;
|
||||
this.btnSelectPath.Click += new System.EventHandler(this.btnSelectPath_Click);
|
||||
//
|
||||
// label1
|
||||
//
|
||||
this.label1.AutoSize = true;
|
||||
this.label1.Location = new System.Drawing.Point(3, 8);
|
||||
this.label1.Name = "label1";
|
||||
this.label1.Size = new System.Drawing.Size(32, 13);
|
||||
this.label1.TabIndex = 1;
|
||||
this.label1.Text = "Path:";
|
||||
//
|
||||
// txtPath
|
||||
//
|
||||
this.txtPath.Location = new System.Drawing.Point(67, 5);
|
||||
this.txtPath.Name = "txtPath";
|
||||
this.txtPath.Size = new System.Drawing.Size(361, 20);
|
||||
this.txtPath.TabIndex = 2;
|
||||
this.txtPath.Text = "G:\\nds\\projects\\ninokuni\\Compilación";
|
||||
//
|
||||
// btnCompile
|
||||
//
|
||||
this.btnCompile.Location = new System.Drawing.Point(278, 31);
|
||||
this.btnCompile.Name = "btnCompile";
|
||||
this.btnCompile.Size = new System.Drawing.Size(150, 87);
|
||||
this.btnCompile.TabIndex = 3;
|
||||
this.btnCompile.Text = "Compile";
|
||||
this.btnCompile.UseVisualStyleBackColor = true;
|
||||
this.btnCompile.Click += new System.EventHandler(this.btnCompile_Click);
|
||||
//
|
||||
// MainWin
|
||||
//
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||
this.BackColor = System.Drawing.Color.Transparent;
|
||||
this.Controls.Add(this.btnCompile);
|
||||
this.Controls.Add(this.txtPath);
|
||||
this.Controls.Add(this.label1);
|
||||
this.Controls.Add(this.btnSelectPath);
|
||||
this.Name = "MainWin";
|
||||
this.Size = new System.Drawing.Size(512, 512);
|
||||
this.ResumeLayout(false);
|
||||
this.PerformLayout();
|
||||
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
private System.Windows.Forms.Button btnSelectPath;
|
||||
private System.Windows.Forms.Label label1;
|
||||
private System.Windows.Forms.TextBox txtPath;
|
||||
private System.Windows.Forms.Button btnCompile;
|
||||
}
|
||||
}
|
299
Plugins/NINOKUNI/NINOKUNI/MainWin.cs
Normal file
299
Plugins/NINOKUNI/NINOKUNI/MainWin.cs
Normal file
@ -0,0 +1,299 @@
|
||||
// ----------------------------------------------------------------------
|
||||
// <copyright file="MainWin.cs" company="none">
|
||||
|
||||
// Copyright (C) 2012
|
||||
//
|
||||
// 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
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
//
|
||||
// </copyright>
|
||||
|
||||
// <author>pleoNeX</author>
|
||||
// <email>benito356@gmail.com</email>
|
||||
// <date>28/08/2012 1:30:43</date>
|
||||
// -----------------------------------------------------------------------
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Drawing;
|
||||
using System.Data;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Windows.Forms;
|
||||
using System.IO;
|
||||
using System.Xml.Linq;
|
||||
using Ekona;
|
||||
|
||||
namespace NINOKUNI
|
||||
{
|
||||
public partial class MainWin : UserControl
|
||||
{
|
||||
IPluginHost pluginHost;
|
||||
char slash = Path.DirectorySeparatorChar;
|
||||
string xmlconf;
|
||||
string xmlImport;
|
||||
|
||||
public MainWin()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
public MainWin(IPluginHost pluginHost)
|
||||
{
|
||||
InitializeComponent();
|
||||
this.pluginHost = pluginHost;
|
||||
|
||||
xmlconf = Application.StartupPath + slash + "Plugins" + slash + "Ninokuni.xml";
|
||||
xmlImport = Application.StartupPath + slash + "Plugins" + slash + "Ninokuni" + slash + "ImportFiles.xml";
|
||||
XDocument doc = XDocument.Load(xmlconf);
|
||||
txtPath.Text = doc.Element("GameConfig").Element("Config").Element("CompilePath").Value;
|
||||
doc = null;
|
||||
}
|
||||
|
||||
private void btnCompile_Click(object sender, EventArgs e)
|
||||
{
|
||||
txtPath.BackColor = Color.Red;
|
||||
|
||||
Compile_Events(txtPath.Text + slash + "Events" + slash);
|
||||
Compile_MiniText(txtPath.Text + slash + "Minitextos" + slash);
|
||||
Change_Scripts(txtPath.Text + slash + "Scripts" + slash);
|
||||
Compile_Subs(txtPath.Text + slash + "Subs" + slash);
|
||||
Change_Fonts(txtPath.Text + slash + "Fuentes" + slash);
|
||||
Change_System(txtPath.Text + slash + "ftc" + slash);
|
||||
Change_Files(@"C:\Users\Benito\Documents\My Dropbox\Ninokuni español\Imágenes\Traducidas");
|
||||
|
||||
txtPath.BackColor = Color.LightGreen;
|
||||
}
|
||||
|
||||
void Compile_Events(string path)
|
||||
{
|
||||
string fout;
|
||||
string fin;
|
||||
|
||||
string mainQuest = path + "MainQuest.xml";
|
||||
if (File.Exists(mainQuest))
|
||||
{
|
||||
fout = pluginHost.Get_TempFile();
|
||||
fin = pluginHost.Search_File(0xF76);
|
||||
MQuestText mqc = new MQuestText(pluginHost, fin, 0xF76);
|
||||
mqc.Import(mainQuest);
|
||||
mqc.Write(fout);
|
||||
pluginHost.ChangeFile(0xF76, fout);
|
||||
}
|
||||
|
||||
if (Directory.Exists(path + "SubQuest"))
|
||||
{
|
||||
string[] sub = Directory.GetFiles(path + "SubQuest", "*.xml", SearchOption.TopDirectoryOnly);
|
||||
sFolder subf = pluginHost.Search_Folder(0xF07E);
|
||||
for (int i = 0; i < subf.files.Count; i++)
|
||||
{
|
||||
string cfile = Array.Find(sub, a => Path.GetFileNameWithoutExtension(a) == subf.files[i].name);
|
||||
if (cfile == null)
|
||||
continue;
|
||||
|
||||
string tempsub = Save_File(subf.files[i]);
|
||||
fout = pluginHost.Get_TempFile();
|
||||
|
||||
SQcontrol sqc = new SQcontrol(pluginHost, tempsub, subf.files[i].id);
|
||||
SQ sq = sqc.Read(tempsub);
|
||||
sqc.Import_XML(cfile, ref sq);
|
||||
sqc.Write(fout, sq);
|
||||
|
||||
pluginHost.ChangeFile(subf.files[i].id, fout);
|
||||
}
|
||||
}
|
||||
|
||||
string scenario = path + "Scenario.xml";
|
||||
if (File.Exists(scenario))
|
||||
{
|
||||
fout = pluginHost.Get_TempFile();
|
||||
fin = pluginHost.Search_File(0xFF2);
|
||||
ScenarioText st = new ScenarioText(pluginHost, fin, 0xFF2);
|
||||
st.Import(scenario);
|
||||
st.Write(fout);
|
||||
pluginHost.ChangeFile(0xFF2, fout);
|
||||
}
|
||||
|
||||
string system = path + "System.xml";
|
||||
if (File.Exists(system))
|
||||
{
|
||||
fout = pluginHost.Get_TempFile();
|
||||
fin = pluginHost.Search_File(0xFF4);
|
||||
SystemText st = new SystemText(fin, 0xFF4, pluginHost);
|
||||
st.Import(system);
|
||||
st.Write(fout);
|
||||
pluginHost.ChangeFile(0xFF4, fout);
|
||||
}
|
||||
}
|
||||
void Compile_MiniText(string path)
|
||||
{
|
||||
foreach (string file in Directory.GetFiles(path))
|
||||
{
|
||||
if (Path.GetExtension(file) != ".xml")
|
||||
continue;
|
||||
|
||||
sFile cfile = pluginHost.Search_File(Path.GetFileNameWithoutExtension(file) + ".dat").files[0];
|
||||
string temp_in = Save_File(cfile);
|
||||
string temp_out = pluginHost.Get_TempFile();
|
||||
|
||||
IText itext = NINOKUNI.Text.TextControl.Create_IText(cfile.id);
|
||||
itext.Read(temp_in);
|
||||
itext.Import(file);
|
||||
itext.Write(temp_out);
|
||||
|
||||
pluginHost.ChangeFile(cfile.id, temp_out);
|
||||
}
|
||||
}
|
||||
void Change_Scripts(string path)
|
||||
{
|
||||
if (Directory.Exists(path + "Map"))
|
||||
{
|
||||
sFolder map = pluginHost.Search_Folder(0xF119);
|
||||
string[] map_xmls = Directory.GetFiles(path + "Map", "*.bin", SearchOption.TopDirectoryOnly);
|
||||
for (int i = 0; i < map.files.Count; i++)
|
||||
{
|
||||
string smap = Array.Find(map_xmls, a => Path.GetFileName(a) == map.files[i].name);
|
||||
if (smap == null)
|
||||
continue;
|
||||
|
||||
pluginHost.ChangeFile(map.files[i].id, smap);
|
||||
}
|
||||
}
|
||||
|
||||
// Mini-script
|
||||
if (!Directory.Exists(path + "Mini"))
|
||||
return;
|
||||
|
||||
sFolder btuto = pluginHost.Search_Folder(0xF02E);
|
||||
string[] dirs = Directory.GetDirectories(path + "Mini");
|
||||
for (int i = 0; i < btuto.folders.Count; i++)
|
||||
{
|
||||
string cdir = Array.Find(dirs, a => new DirectoryInfo(a).Name == btuto.folders[i].name);
|
||||
if (cdir == null)
|
||||
continue;
|
||||
|
||||
sFolder cfol = btuto.folders[i];
|
||||
string[] cfiles = Directory.GetFiles(cdir, "*.bin", SearchOption.TopDirectoryOnly);
|
||||
for (int j = 0; j < cfol.files.Count; j++)
|
||||
{
|
||||
string cf = Array.Find(cfiles, a => Path.GetFileName(a) == cfol.files[j].name);
|
||||
if (cf == null)
|
||||
continue;
|
||||
|
||||
pluginHost.ChangeFile(cfol.files[j].id, cf);
|
||||
}
|
||||
}
|
||||
}
|
||||
void Compile_Subs(string path)
|
||||
{
|
||||
string[] files = Directory.GetFiles(path);
|
||||
for (int i = 0; i < files.Length; i++)
|
||||
{
|
||||
string name = Path.GetFileNameWithoutExtension(files[i]) + ".txt";
|
||||
sFile cfile = pluginHost.Search_File(name).files[0];
|
||||
string tempFile = Save_File(cfile);
|
||||
string fout = pluginHost.Get_TempFile();
|
||||
|
||||
SubtitleControl sc = new SubtitleControl(pluginHost, tempFile, cfile.id);
|
||||
sc.ImportXML(files[i]);
|
||||
sc.Write(fout);
|
||||
|
||||
pluginHost.ChangeFile(cfile.id, fout);
|
||||
}
|
||||
}
|
||||
void Change_Fonts(string path)
|
||||
{
|
||||
string[] files = Directory.GetFiles(path);
|
||||
sFolder fonts = pluginHost.Search_Folder(0xF081);
|
||||
for (int i = 0; i < fonts.files.Count; i++)
|
||||
{
|
||||
string cf = Array.Find(files, a => Path.GetFileName(a) == fonts.files[i].name);
|
||||
if (cf == null)
|
||||
continue;
|
||||
|
||||
pluginHost.ChangeFile(fonts.files[i].id, cf);
|
||||
}
|
||||
}
|
||||
void Change_System(string path)
|
||||
{
|
||||
string[] files = Directory.GetFiles(path);
|
||||
sFolder ftc = pluginHost.Search_Folder(0xF378);
|
||||
for (int i = 0; i < ftc.files.Count; i++)
|
||||
{
|
||||
string cf = Array.Find(files, a => Path.GetFileName(a) == ftc.files[i].name);
|
||||
if (cf == null)
|
||||
continue;
|
||||
|
||||
if (ftc.files[i].name == "arm9.bin")
|
||||
{
|
||||
byte[] d = File.ReadAllBytes(cf);
|
||||
byte[] size = BitConverter.GetBytes((uint)new FileInfo(cf).Length);
|
||||
d[0xB9C] = size[0];
|
||||
d[0xB9D] = size[1];
|
||||
d[0xB9E] = size[2];
|
||||
File.WriteAllBytes(cf, d);
|
||||
}
|
||||
|
||||
pluginHost.ChangeFile(ftc.files[i].id, cf);
|
||||
}
|
||||
}
|
||||
void Change_Files(string path)
|
||||
{
|
||||
XDocument doc = XDocument.Load(xmlImport);
|
||||
XElement root = doc.Element("NinoImport");
|
||||
|
||||
foreach (XElement e in root.Elements("File"))
|
||||
{
|
||||
int id = Convert.ToInt32(e.Attribute("ID").Value, 16);
|
||||
string file_path = path + e.Value;
|
||||
if (File.Exists(file_path))
|
||||
pluginHost.ChangeFile(id, file_path);
|
||||
else
|
||||
Console.WriteLine("File not found " + file_path + " (" + id.ToString("X") + ')');
|
||||
}
|
||||
|
||||
root = null;
|
||||
doc = null;
|
||||
}
|
||||
|
||||
String Save_File(sFile file)
|
||||
{
|
||||
String outFile = pluginHost.Get_TempFile();
|
||||
if (File.Exists(outFile))
|
||||
File.Delete(outFile);
|
||||
|
||||
BinaryReader br = new BinaryReader(File.OpenRead(file.path));
|
||||
br.BaseStream.Position = file.offset;
|
||||
File.WriteAllBytes(outFile, br.ReadBytes((int)file.size));
|
||||
br.Close();
|
||||
|
||||
return outFile;
|
||||
}
|
||||
|
||||
private void btnSelectPath_Click(object sender, EventArgs e)
|
||||
{
|
||||
FolderBrowserDialog o = new FolderBrowserDialog();
|
||||
o.Description = "Select the folder with the translated files.";
|
||||
if (o.ShowDialog() != DialogResult.OK)
|
||||
return;
|
||||
|
||||
txtPath.Text = o.SelectedPath;
|
||||
o.Dispose();
|
||||
o = null;
|
||||
|
||||
XDocument doc = XDocument.Load(xmlconf);
|
||||
doc.Element("GameConfig").Element("Config").Element("CompilePath").Value = txtPath.Text;
|
||||
doc.Save(xmlconf);
|
||||
doc = null;
|
||||
}
|
||||
}
|
||||
}
|
@ -51,71 +51,105 @@
|
||||
<DependentUpon>BMPControl.cs</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Helper.cs" />
|
||||
<Compile Include="KPCN.cs" />
|
||||
<Compile Include="Pack\KPCN.cs" />
|
||||
<Compile Include="Main.cs" />
|
||||
<Compile Include="MQuestText.cs">
|
||||
<Compile Include="MainWin.cs">
|
||||
<SubType>UserControl</SubType>
|
||||
</Compile>
|
||||
<Compile Include="MQuestText.Designer.cs">
|
||||
<Compile Include="MainWin.Designer.cs">
|
||||
<DependentUpon>MainWin.cs</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Pack\WMAP.cs" />
|
||||
<Compile Include="Text\BattleHelp.cs" />
|
||||
<Compile Include="Text\BlockText.cs" />
|
||||
<Compile Include="Text\DownloadParam.cs" />
|
||||
<Compile Include="Text\DungeonList.cs" />
|
||||
<Compile Include="Text\MQuestText.cs">
|
||||
<SubType>UserControl</SubType>
|
||||
</Compile>
|
||||
<Compile Include="Text\MQuestText.Designer.cs">
|
||||
<DependentUpon>MQuestText.cs</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="NPCK.cs" />
|
||||
<Compile Include="Pack\NPCK.cs" />
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
<Compile Include="Properties\Resources.Designer.cs">
|
||||
<AutoGen>True</AutoGen>
|
||||
<DesignTime>True</DesignTime>
|
||||
<DependentUpon>Resources.resx</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="ScenarioText.cs">
|
||||
<Compile Include="Text\ScenarioText.cs">
|
||||
<SubType>UserControl</SubType>
|
||||
</Compile>
|
||||
<Compile Include="ScenarioText.Designer.cs">
|
||||
<Compile Include="Text\ScenarioText.Designer.cs">
|
||||
<DependentUpon>ScenarioText.cs</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="SPDL.cs" />
|
||||
<Compile Include="SQcontrol.cs">
|
||||
<Compile Include="Text\IText.cs" />
|
||||
<Compile Include="Pack\SPDL.cs" />
|
||||
<Compile Include="Text\SQcontrol.cs">
|
||||
<SubType>UserControl</SubType>
|
||||
</Compile>
|
||||
<Compile Include="SQcontrol.Designer.cs">
|
||||
<Compile Include="Text\SQcontrol.Designer.cs">
|
||||
<DependentUpon>SQcontrol.cs</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="SubtitleControl.cs">
|
||||
<Compile Include="Text\StageInfoData.cs" />
|
||||
<Compile Include="Text\SubtitleControl.cs">
|
||||
<SubType>UserControl</SubType>
|
||||
</Compile>
|
||||
<Compile Include="SubtitleControl.Designer.cs">
|
||||
<Compile Include="Text\SubtitleControl.Designer.cs">
|
||||
<DependentUpon>SubtitleControl.cs</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="SystemText.cs">
|
||||
<Compile Include="Text\SystemText.cs">
|
||||
<SubType>UserControl</SubType>
|
||||
</Compile>
|
||||
<Compile Include="SystemText.Designer.cs">
|
||||
<Compile Include="Text\SystemText.Designer.cs">
|
||||
<DependentUpon>SystemText.cs</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="TMAP.cs" />
|
||||
<Compile Include="Text\TextControl.cs">
|
||||
<SubType>UserControl</SubType>
|
||||
</Compile>
|
||||
<Compile Include="Text\TextControl.Designer.cs">
|
||||
<DependentUpon>TextControl.cs</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="TMAPcontrol.cs">
|
||||
<SubType>UserControl</SubType>
|
||||
</Compile>
|
||||
<Compile Include="TMAPcontrol.Designer.cs">
|
||||
<DependentUpon>TMAPcontrol.cs</DependentUpon>
|
||||
</Compile>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<EmbeddedResource Include="BMPControl.resx">
|
||||
<DependentUpon>BMPControl.cs</DependentUpon>
|
||||
</EmbeddedResource>
|
||||
<EmbeddedResource Include="MQuestText.resx">
|
||||
<EmbeddedResource Include="MainWin.resx">
|
||||
<DependentUpon>MainWin.cs</DependentUpon>
|
||||
</EmbeddedResource>
|
||||
<EmbeddedResource Include="Text\MQuestText.resx">
|
||||
<DependentUpon>MQuestText.cs</DependentUpon>
|
||||
</EmbeddedResource>
|
||||
<EmbeddedResource Include="Properties\Resources.resx">
|
||||
<Generator>ResXFileCodeGenerator</Generator>
|
||||
<LastGenOutput>Resources.Designer.cs</LastGenOutput>
|
||||
</EmbeddedResource>
|
||||
<EmbeddedResource Include="ScenarioText.resx">
|
||||
<EmbeddedResource Include="Text\ScenarioText.resx">
|
||||
<DependentUpon>ScenarioText.cs</DependentUpon>
|
||||
</EmbeddedResource>
|
||||
<EmbeddedResource Include="SQcontrol.resx">
|
||||
<EmbeddedResource Include="Text\SQcontrol.resx">
|
||||
<DependentUpon>SQcontrol.cs</DependentUpon>
|
||||
</EmbeddedResource>
|
||||
<EmbeddedResource Include="SubtitleControl.resx">
|
||||
<EmbeddedResource Include="Text\SubtitleControl.resx">
|
||||
<DependentUpon>SubtitleControl.cs</DependentUpon>
|
||||
</EmbeddedResource>
|
||||
<EmbeddedResource Include="SystemText.resx">
|
||||
<EmbeddedResource Include="Text\SystemText.resx">
|
||||
<DependentUpon>SystemText.cs</DependentUpon>
|
||||
</EmbeddedResource>
|
||||
<EmbeddedResource Include="Text\TextControl.resx">
|
||||
<DependentUpon>TextControl.cs</DependentUpon>
|
||||
</EmbeddedResource>
|
||||
<EmbeddedResource Include="TMAPcontrol.resx">
|
||||
<DependentUpon>TMAPcontrol.cs</DependentUpon>
|
||||
</EmbeddedResource>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="Resources\page_white_edit.png" />
|
||||
@ -130,7 +164,17 @@
|
||||
<Content Include="Ninokuni.xml">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</Content>
|
||||
<Content Include="Ninokuni\font10.xml">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</Content>
|
||||
<Content Include="Ninokuni\font12.xml">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</Content>
|
||||
<Content Include="Ninokuni\ImportFiles.xml">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</Content>
|
||||
</ItemGroup>
|
||||
<ItemGroup />
|
||||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
|
||||
Other similar extension points exist, see Microsoft.Common.targets.
|
||||
|
@ -54,4 +54,7 @@
|
||||
<S03>Écrire l'archive</S03>
|
||||
</SQcontrol>
|
||||
</Français>
|
||||
<Config>
|
||||
<CompilePath></CompilePath>
|
||||
</Config>
|
||||
</GameConfig>
|
||||
|
69
Plugins/NINOKUNI/NINOKUNI/Ninokuni/ImportFiles.xml
Normal file
69
Plugins/NINOKUNI/NINOKUNI/Ninokuni/ImportFiles.xml
Normal file
@ -0,0 +1,69 @@
|
||||
<?xml version="1.0" encoding="utf-8" ?>
|
||||
<NinoImport>
|
||||
<File ID="238">\Battle\imd\CmdMenuBtn.n3d</File>
|
||||
<File ID="23C">\Battle\imd\ParamWindow.n3d</File>
|
||||
<File ID="25D">\Battle\Result\BattleResultBG_S.n2d</File>
|
||||
<File ID="246D">\Skybattle\Interface\Retry.n2d</File>
|
||||
<File ID="2495">\Skybattle\Result\bg_a.n2d</File>
|
||||
<File ID="2496">\Skybattle\Result\bg_b.n2d</File>
|
||||
<File ID="2ABF">\UI\Common\cancell.n2d</File>
|
||||
<File ID="2AD6">\UI\Common\MapGauge00.n2d</File>
|
||||
<File ID="2AE6">\UI\Common\titlebutton.n2d</File>
|
||||
<File ID="2E2C">\UI\Menu-Skin-2\CheckSheet\bg_b.n2d</File>
|
||||
<File ID="2E2D">\UI\Menu-Skin-2\CheckSheet\bg_c.n2d</File>
|
||||
<File ID="2E31">\UI\Menu-Skin-2\CheckSheet\button.n2d</File>
|
||||
<File ID="2E32">\UI\Menu-Skin-2\CheckSheet\button2.n2d</File>
|
||||
<File ID="2E33">\UI\Menu-Skin-2\CheckSheet\button3.n2d</File>
|
||||
<File ID="2E34">\UI\Menu-Skin-2\CheckSheet\category.n2d</File>
|
||||
<File ID="2E35">\UI\Menu-Skin-2\CheckSheet\day.n2d</File>
|
||||
<File ID="2E3A">\UI\Menu-Skin-2\CheckSheet\result.n2d</File>
|
||||
<File ID="2E3D">\UI\Menu-Skin-2\CheckSheet\title.n2d</File>
|
||||
<File ID="2E3E">\UI\Menu-Skin-2\CheckSheet\win0.n2d</File>
|
||||
<File ID="2E52">\UI\Menu-Skin-2\ConnectExchange\bg_a.n2d</File>
|
||||
<File ID="2E53">\UI\Menu-Skin-2\ConnectExchange\bg_a2.n2d</File>
|
||||
<File ID="2E57">\UI\Menu-Skin-2\ConnectExchange\button.n2d</File>
|
||||
<File ID="2E45">\UI\Menu-Skin-2\ConnectBattle\bg_a.n2d</File>
|
||||
<File ID="2E47">\UI\Menu-Skin-2\ConnectBattle\bg_b.n2d</File>
|
||||
<File ID="2E48">\UI\Menu-Skin-2\ConnectBattle\button.n2d</File>
|
||||
<File ID="2E4A">\UI\Menu-Skin-2\ConnectBattle\table.n2d</File>
|
||||
<File ID="2E4D">\UI\Menu-Skin-2\ConnectBattleMenu\bg_b.n2d</File>
|
||||
<File ID="2E4E">\UI\Menu-Skin-2\ConnectBattleMenu\button.n2d</File>
|
||||
<File ID="2E59">\UI\Menu-Skin-2\DLImagen\bg_b.n2d</File>
|
||||
<File ID="2E5A">\UI\Menu-Skin-2\DLImagen\button.n2d</File>
|
||||
<File ID="2E5C">\UI\Menu-Skin-2\Download\bg_c.n2d</File>
|
||||
<File ID="2E5D">\UI\Menu-Skin-2\Download\bg_e.n2d</File>
|
||||
<File ID="2E5F">\UI\Menu-Skin-2\Download\bg_g.n2d</File>
|
||||
<File ID="2E60">\UI\Menu-Skin-2\Download\bg_h.n2d</File>
|
||||
<File ID="2E61">\UI\Menu-Skin-2\Download\bg_title.n2d</File>
|
||||
<File ID="2E62">\UI\Menu-Skin-2\Download\bottun2.n2d</File>
|
||||
<File ID="2E64">\UI\Menu-Skin-2\Download\Synthesis.n2d</File>
|
||||
<File ID="2E67">\UI\Menu-Skin-2\Dungeon List\bg_a.n2d</File>
|
||||
<File ID="2E69">\UI\Menu-Skin-2\Dungeon List\bg_a_window.n2d</File>
|
||||
<File ID="2E68">\UI\Menu-Skin-2\Dungeon List\bg_a2.n2d</File>
|
||||
<File ID="2E6A">\UI\Menu-Skin-2\Dungeon List\button.n2d</File>
|
||||
<File ID="2E6B">\UI\Menu-Skin-2\Dungeon List\clear.n2d</File>
|
||||
<File ID="2E6C">\UI\Menu-Skin-2\Dungeon List\MonsterList.n2d</File>
|
||||
<File ID="2E6F">\UI\Menu-Skin-2\Dungeon List\title.n2d</File>
|
||||
<File ID="2E75">\UI\Menu-Skin-2\Dungeon List 2\bg_a_window.n2d</File>
|
||||
<File ID="2E72">\UI\Menu-Skin-2\Dungeon List 2\bg_a2.n2d</File>
|
||||
<File ID="2E74">\UI\Menu-Skin-2\Dungeon List 2\bg_a3_window.n2d</File>
|
||||
<File ID="2E76">\UI\Menu-Skin-2\Dungeon List 2\bg_b.n2d</File>
|
||||
<File ID="2E77">\UI\Menu-Skin-2\Dungeon List 2\button.n2d</File>
|
||||
<File ID="2E79">\UI\Menu-Skin-2\Dungeon List 2\minimap.n2d</File>
|
||||
<File ID="2E7A">\UI\Menu-Skin-2\Dungeon List 2\MonsterList.n2d</File>
|
||||
<File ID="2E7D">\UI\Menu-Skin-2\Egghistory\bg_b.n2d</File>
|
||||
<File ID="2E7F">\UI\Menu-Skin-2\Egghome\bg_b.n2d</File>
|
||||
<File ID="2E81">\UI\Menu-Skin-2\Egghome\button.n2d</File>
|
||||
<File ID="2E82">\UI\Menu-Skin-2\Eggmenu\baloon.n2d</File>
|
||||
<File ID="2E83">\UI\Menu-Skin-2\Eggmenu\bg_a.n2d</File>
|
||||
<File ID="2E85">\UI\Menu-Skin-2\Eggmenu\button.n2d</File>
|
||||
<File ID="2E86">\UI\Menu-Skin-2\Eggprofile\bg_a.n2d</File>
|
||||
<File ID="2E87">\UI\Menu-Skin-2\Eggprofile\bg_b.n2d</File>
|
||||
<File ID="2E88">\UI\Menu-Skin-2\Eggprofile\bg_title.n2d</File>
|
||||
<File ID="2E89">\UI\Menu-Skin-2\Eggprofile\button.n2d</File>
|
||||
<File ID="2E8A">\UI\Menu-Skin-2\EquipImagen\bg_a.n2d</File>
|
||||
<File ID="2E8B">\UI\Menu-Skin-2\EquipImagen\bg_b.n2d</File>
|
||||
<File ID="2E8D">\UI\Menu-Skin-2\EquipImagen\button.n2d</File>
|
||||
<File ID="313E">\UI\Talk\Skin\2\popbutton.n2d</File>
|
||||
<File ID="313F">\UI\Talk\Skin\2\popbutton2.n2d</File>
|
||||
</NinoImport>
|
3725
Plugins/NINOKUNI/NINOKUNI/Ninokuni/font10.xml
Normal file
3725
Plugins/NINOKUNI/NINOKUNI/Ninokuni/font10.xml
Normal file
File diff suppressed because it is too large
Load Diff
3681
Plugins/NINOKUNI/NINOKUNI/Ninokuni/font12.xml
Normal file
3681
Plugins/NINOKUNI/NINOKUNI/Ninokuni/font12.xml
Normal file
File diff suppressed because it is too large
Load Diff
72
Plugins/NINOKUNI/NINOKUNI/Pack/WMAP.cs
Normal file
72
Plugins/NINOKUNI/NINOKUNI/Pack/WMAP.cs
Normal file
@ -0,0 +1,72 @@
|
||||
// ----------------------------------------------------------------------
|
||||
// <copyright file="WMAP.cs" company="none">
|
||||
|
||||
// Copyright (C) 2012
|
||||
//
|
||||
// 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
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
//
|
||||
// </copyright>
|
||||
|
||||
// <author>pleoNeX</author>
|
||||
// <email>benito356@gmail.com</email>
|
||||
// <date>01/09/2012 20:16:49</date>
|
||||
// -----------------------------------------------------------------------
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.IO;
|
||||
using Ekona;
|
||||
|
||||
namespace NINOKUNI
|
||||
{
|
||||
public static class WMAP
|
||||
{
|
||||
static uint HEADER = 0x50414d57; // "WMAP"
|
||||
|
||||
public static sFolder Unpack(string fileIn, string name)
|
||||
{
|
||||
name = Path.GetFileNameWithoutExtension(name);
|
||||
|
||||
BinaryReader br = new BinaryReader(File.OpenRead(fileIn));
|
||||
sFolder unpack = new sFolder();
|
||||
unpack.files = new List<sFile>();
|
||||
|
||||
if (br.ReadUInt32() != HEADER)
|
||||
{
|
||||
br.Close();
|
||||
br = null;
|
||||
throw new FormatException("Invalid header!");
|
||||
}
|
||||
|
||||
uint num_files = br.ReadUInt32();
|
||||
br.ReadUInt32(); // Unknown 1
|
||||
br.ReadUInt32(); // Unknown 2
|
||||
|
||||
for (int i = 0; i < num_files; i++)
|
||||
{
|
||||
sFile cfile = new sFile();
|
||||
cfile.name = name + '_' + i.ToString() + ".bin";
|
||||
cfile.offset = br.ReadUInt32();
|
||||
cfile.size = br.ReadUInt32();
|
||||
cfile.path = fileIn;
|
||||
unpack.files.Add(cfile);
|
||||
}
|
||||
|
||||
br.Close();
|
||||
br = null;
|
||||
return unpack;
|
||||
}
|
||||
}
|
||||
}
|
@ -27,43 +27,172 @@ using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.IO;
|
||||
using System.Drawing;
|
||||
using Ekona;
|
||||
|
||||
namespace NINOKUNI
|
||||
{
|
||||
public static class TMAP
|
||||
public class TMAP
|
||||
{
|
||||
uint tile_width;
|
||||
uint tile_height;
|
||||
Bitmap[][] tiles;
|
||||
|
||||
public static sFolder Unpack(string file, string name)
|
||||
int id;
|
||||
string fileName;
|
||||
IPluginHost pluginHost;
|
||||
|
||||
public TMAP(sFile cfile, IPluginHost pluginHost)
|
||||
{
|
||||
BinaryReader br = new BinaryReader(File.OpenRead(file));
|
||||
sFolder unpack = new sFolder();
|
||||
unpack.files = new List<sFile>();
|
||||
this.id = cfile.id;
|
||||
this.fileName = Path.GetFileNameWithoutExtension(cfile.name);
|
||||
this.pluginHost = pluginHost;
|
||||
|
||||
Read(cfile.path);
|
||||
}
|
||||
~TMAP()
|
||||
{
|
||||
for (int i = 0; i < tiles.Length; i++)
|
||||
{
|
||||
for (int j = 0; j < tiles[i].Length; j++)
|
||||
{
|
||||
if (tiles[i][j] is Bitmap)
|
||||
tiles[i][j].Dispose();
|
||||
tiles[i][j] = null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void Read(string fileIn)
|
||||
{
|
||||
BinaryReader br = new BinaryReader(File.OpenRead(fileIn));
|
||||
|
||||
char[] type = br.ReadChars(4);
|
||||
uint unk1 = br.ReadUInt32();
|
||||
uint unk2 = br.ReadUInt32();
|
||||
uint unk3 = br.ReadUInt32();
|
||||
|
||||
uint numfiles = (br.ReadUInt32() - 0x10) / 8;
|
||||
br.BaseStream.Position = 0x10;
|
||||
|
||||
for (int i = 0; i < numfiles; i++)
|
||||
if (new String(type) != "TMAP")
|
||||
{
|
||||
sFile newFile = new sFile();
|
||||
newFile.name = name + '_' + i.ToString() + ".bin";
|
||||
newFile.offset = br.ReadUInt32();
|
||||
newFile.size = br.ReadUInt32();
|
||||
newFile.path = file;
|
||||
br.Close();
|
||||
br = null;
|
||||
throw new FormatException("Invalid header!");
|
||||
}
|
||||
|
||||
if (newFile.offset == 0 || newFile.size == 0)
|
||||
continue;
|
||||
uint imgs_layer = br.ReadUInt32(); // Number of images per layer
|
||||
tile_width = br.ReadUInt32(); // Number of horizontal images
|
||||
tile_height = br.ReadUInt32(); // Number of vertical images
|
||||
|
||||
unpack.files.Add(newFile);
|
||||
// Layer 1: background
|
||||
// Layer 2: layer 1 (it's printed after print the NPC and player, it's over the player)
|
||||
// Layer 3: layer 2
|
||||
// Layer 4: Collision
|
||||
|
||||
tiles = new Bitmap[4][];
|
||||
for (int l = 0; l < 4; l++)
|
||||
{
|
||||
// For each layer get al the files
|
||||
tiles[l] = new Bitmap[imgs_layer];
|
||||
for (int i = 0; i < imgs_layer; i++)
|
||||
{
|
||||
// Read FAT
|
||||
br.BaseStream.Position = 0x10 + l * imgs_layer * 8 + i * 8;
|
||||
uint offset = br.ReadUInt32();
|
||||
uint size = br.ReadUInt32();
|
||||
|
||||
if (offset == 0x00 || size == 0x00)
|
||||
continue;
|
||||
|
||||
// Read file
|
||||
br.BaseStream.Position = offset;
|
||||
byte[] data = br.ReadBytes((int)size);
|
||||
|
||||
string tempFile = null;
|
||||
if (data[0] == 0x11 || data[0] == 0x30) // Decompress it, LZ11 for BTX0 and RLE for BMP
|
||||
{
|
||||
pluginHost.Decompress(data);
|
||||
sFolder f = pluginHost.Get_Files();
|
||||
if (!(f.files is List<sFile>) || f.files.Count != 1) // Check if the decompression fails
|
||||
{
|
||||
Console.WriteLine("Problem decompressing file -> l: {0}, i: {1}", l.ToString(), i.ToString());
|
||||
continue;
|
||||
}
|
||||
tempFile = f.files[0].path;
|
||||
|
||||
// Check if the decomprsesion fails
|
||||
data = File.ReadAllBytes(tempFile);
|
||||
if (data[0] == 0x11 || data[0] == 0x30)
|
||||
continue;
|
||||
}
|
||||
else
|
||||
{
|
||||
tempFile = pluginHost.Get_TempFile();
|
||||
File.WriteAllBytes(tempFile, data);
|
||||
}
|
||||
|
||||
// Get image
|
||||
string header = new string(Encoding.ASCII.GetChars(data, 0, 4));
|
||||
if (header == "BTX0")
|
||||
{
|
||||
// Call to the 3D plugin to get a bitmap from the texture
|
||||
string[] param = { tempFile, "_3DModels.Main", "", "BTX0" };
|
||||
pluginHost.Call_Plugin(param, -1, 0);
|
||||
if (pluginHost.Get_Object() is Bitmap[])
|
||||
{
|
||||
tiles[l][i] = ((Bitmap[])pluginHost.Get_Object())[0];
|
||||
pluginHost.Set_Object(null);
|
||||
}
|
||||
else
|
||||
Console.WriteLine("Problem getting bitmap image -> l: {0}, i: {1}", l.ToString(), i.ToString());
|
||||
}
|
||||
else if (header.StartsWith("BM")) // BMP file
|
||||
{
|
||||
try { tiles[l][i] = (Bitmap)Image.FromFile(tempFile); }
|
||||
catch { }
|
||||
}
|
||||
else
|
||||
Console.WriteLine("Unknown file -> l: {0}, i: {1}", l.ToString(), i.ToString());
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
br.Close();
|
||||
return unpack;
|
||||
br = null;
|
||||
}
|
||||
|
||||
public Bitmap Get_Map(int layer)
|
||||
{
|
||||
if (layer > 3 || layer < 0)
|
||||
return null;
|
||||
|
||||
int width, height, tile_size;
|
||||
if (layer != 3)
|
||||
tile_size = 64;
|
||||
else
|
||||
tile_size = 32;
|
||||
width = (int)tile_width * tile_size;
|
||||
height = (int)tile_height * tile_size;
|
||||
|
||||
Bitmap map = new Bitmap(width, height);
|
||||
Graphics graphic = Graphics.FromImage(map);
|
||||
|
||||
int x = 0, y = height - tile_size;
|
||||
for (int i = 0; i < tiles[layer].Length; i++)
|
||||
{
|
||||
if (tiles[layer][i] != null)
|
||||
graphic.DrawImageUnscaled(tiles[layer][i], x, y);
|
||||
|
||||
y -= tile_size;
|
||||
if (y < 0)
|
||||
{
|
||||
y = height - tile_size;
|
||||
x += tile_size;
|
||||
}
|
||||
}
|
||||
|
||||
graphic = null;
|
||||
return map;
|
||||
}
|
||||
|
||||
public String FileName
|
||||
{
|
||||
get { return fileName; }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
148
Plugins/NINOKUNI/NINOKUNI/TMAPcontrol.Designer.cs
generated
Normal file
148
Plugins/NINOKUNI/NINOKUNI/TMAPcontrol.Designer.cs
generated
Normal file
@ -0,0 +1,148 @@
|
||||
namespace NINOKUNI
|
||||
{
|
||||
partial class TMAPcontrol
|
||||
{
|
||||
/// <summary>
|
||||
/// Variable del diseñador requerida.
|
||||
/// </summary>
|
||||
private System.ComponentModel.IContainer components = null;
|
||||
|
||||
/// <summary>
|
||||
/// Limpiar los recursos que se estén utilizando.
|
||||
/// </summary>
|
||||
/// <param name="disposing">true si los recursos administrados se deben eliminar; false en caso contrario, false.</param>
|
||||
protected override void Dispose(bool disposing)
|
||||
{
|
||||
if (disposing && (components != null))
|
||||
{
|
||||
components.Dispose();
|
||||
}
|
||||
base.Dispose(disposing);
|
||||
}
|
||||
|
||||
#region Código generado por el Diseñador de componentes
|
||||
|
||||
/// <summary>
|
||||
/// Método necesario para admitir el Diseñador. No se puede modificar
|
||||
/// el contenido del método con el editor de código.
|
||||
/// </summary>
|
||||
private void InitializeComponent()
|
||||
{
|
||||
this.picMap = new System.Windows.Forms.PictureBox();
|
||||
this.numLayer = new System.Windows.Forms.NumericUpDown();
|
||||
this.label1 = new System.Windows.Forms.Label();
|
||||
this.btnSave = new System.Windows.Forms.Button();
|
||||
this.panel1 = new System.Windows.Forms.Panel();
|
||||
this.numPicMode = new System.Windows.Forms.NumericUpDown();
|
||||
this.label2 = new System.Windows.Forms.Label();
|
||||
((System.ComponentModel.ISupportInitialize)(this.picMap)).BeginInit();
|
||||
((System.ComponentModel.ISupportInitialize)(this.numLayer)).BeginInit();
|
||||
this.panel1.SuspendLayout();
|
||||
((System.ComponentModel.ISupportInitialize)(this.numPicMode)).BeginInit();
|
||||
this.SuspendLayout();
|
||||
//
|
||||
// picMap
|
||||
//
|
||||
this.picMap.Location = new System.Drawing.Point(0, 0);
|
||||
this.picMap.Name = "picMap";
|
||||
this.picMap.Size = new System.Drawing.Size(502, 480);
|
||||
this.picMap.SizeMode = System.Windows.Forms.PictureBoxSizeMode.AutoSize;
|
||||
this.picMap.TabIndex = 0;
|
||||
this.picMap.TabStop = false;
|
||||
//
|
||||
// numLayer
|
||||
//
|
||||
this.numLayer.Location = new System.Drawing.Point(48, 3);
|
||||
this.numLayer.Maximum = new decimal(new int[] {
|
||||
3,
|
||||
0,
|
||||
0,
|
||||
0});
|
||||
this.numLayer.Name = "numLayer";
|
||||
this.numLayer.Size = new System.Drawing.Size(60, 20);
|
||||
this.numLayer.TabIndex = 1;
|
||||
this.numLayer.ValueChanged += new System.EventHandler(this.numLayer_ValueChanged);
|
||||
//
|
||||
// label1
|
||||
//
|
||||
this.label1.AutoSize = true;
|
||||
this.label1.Location = new System.Drawing.Point(3, 5);
|
||||
this.label1.Name = "label1";
|
||||
this.label1.Size = new System.Drawing.Size(36, 13);
|
||||
this.label1.TabIndex = 2;
|
||||
this.label1.Text = "Layer:";
|
||||
//
|
||||
// btnSave
|
||||
//
|
||||
this.btnSave.Location = new System.Drawing.Point(428, 3);
|
||||
this.btnSave.Name = "btnSave";
|
||||
this.btnSave.Size = new System.Drawing.Size(80, 23);
|
||||
this.btnSave.TabIndex = 4;
|
||||
this.btnSave.Text = "Save";
|
||||
this.btnSave.UseVisualStyleBackColor = true;
|
||||
this.btnSave.Click += new System.EventHandler(this.btnSave_Click);
|
||||
//
|
||||
// panel1
|
||||
//
|
||||
this.panel1.AutoScroll = true;
|
||||
this.panel1.Controls.Add(this.picMap);
|
||||
this.panel1.Location = new System.Drawing.Point(6, 29);
|
||||
this.panel1.Name = "panel1";
|
||||
this.panel1.Size = new System.Drawing.Size(502, 480);
|
||||
this.panel1.TabIndex = 5;
|
||||
//
|
||||
// numPicMode
|
||||
//
|
||||
this.numPicMode.Location = new System.Drawing.Point(237, 3);
|
||||
this.numPicMode.Maximum = new decimal(new int[] {
|
||||
4,
|
||||
0,
|
||||
0,
|
||||
0});
|
||||
this.numPicMode.Name = "numPicMode";
|
||||
this.numPicMode.Size = new System.Drawing.Size(60, 20);
|
||||
this.numPicMode.TabIndex = 6;
|
||||
this.numPicMode.ValueChanged += new System.EventHandler(this.numPicMode_ValueChanged);
|
||||
//
|
||||
// label2
|
||||
//
|
||||
this.label2.AutoSize = true;
|
||||
this.label2.Location = new System.Drawing.Point(159, 5);
|
||||
this.label2.Name = "label2";
|
||||
this.label2.Size = new System.Drawing.Size(72, 13);
|
||||
this.label2.TabIndex = 7;
|
||||
this.label2.Text = "Picture mode:";
|
||||
//
|
||||
// TMAPcontrol
|
||||
//
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||
this.Controls.Add(this.label2);
|
||||
this.Controls.Add(this.numPicMode);
|
||||
this.Controls.Add(this.panel1);
|
||||
this.Controls.Add(this.btnSave);
|
||||
this.Controls.Add(this.label1);
|
||||
this.Controls.Add(this.numLayer);
|
||||
this.Name = "TMAPcontrol";
|
||||
this.Size = new System.Drawing.Size(512, 512);
|
||||
((System.ComponentModel.ISupportInitialize)(this.picMap)).EndInit();
|
||||
((System.ComponentModel.ISupportInitialize)(this.numLayer)).EndInit();
|
||||
this.panel1.ResumeLayout(false);
|
||||
this.panel1.PerformLayout();
|
||||
((System.ComponentModel.ISupportInitialize)(this.numPicMode)).EndInit();
|
||||
this.ResumeLayout(false);
|
||||
this.PerformLayout();
|
||||
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
private System.Windows.Forms.PictureBox picMap;
|
||||
private System.Windows.Forms.NumericUpDown numLayer;
|
||||
private System.Windows.Forms.Label label1;
|
||||
private System.Windows.Forms.Button btnSave;
|
||||
private System.Windows.Forms.Panel panel1;
|
||||
private System.Windows.Forms.NumericUpDown numPicMode;
|
||||
private System.Windows.Forms.Label label2;
|
||||
}
|
||||
}
|
84
Plugins/NINOKUNI/NINOKUNI/TMAPcontrol.cs
Normal file
84
Plugins/NINOKUNI/NINOKUNI/TMAPcontrol.cs
Normal file
@ -0,0 +1,84 @@
|
||||
// ----------------------------------------------------------------------
|
||||
// <copyright file="TMAPcontrol.cs" company="none">
|
||||
|
||||
// Copyright (C) 2012
|
||||
//
|
||||
// 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
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
//
|
||||
// </copyright>
|
||||
|
||||
// <author>pleoNeX</author>
|
||||
// <email>benito356@gmail.com</email>
|
||||
// <date>02/09/2012 3:53:19</date>
|
||||
// -----------------------------------------------------------------------
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Drawing;
|
||||
using System.Data;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Windows.Forms;
|
||||
using Ekona;
|
||||
|
||||
namespace NINOKUNI
|
||||
{
|
||||
public partial class TMAPcontrol : UserControl
|
||||
{
|
||||
TMAP tmap;
|
||||
IPluginHost pluginHost;
|
||||
|
||||
public TMAPcontrol()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
public TMAPcontrol(sFile cfile, IPluginHost pluginHost)
|
||||
{
|
||||
InitializeComponent();
|
||||
|
||||
this.pluginHost = pluginHost;
|
||||
tmap = new TMAP(cfile, pluginHost);
|
||||
numLayer_ValueChanged(null, null);
|
||||
}
|
||||
~TMAPcontrol()
|
||||
{
|
||||
tmap = null;
|
||||
}
|
||||
|
||||
private void numLayer_ValueChanged(object sender, EventArgs e)
|
||||
{
|
||||
picMap.Image = tmap.Get_Map((int)numLayer.Value);
|
||||
}
|
||||
private void btnSave_Click(object sender, EventArgs e)
|
||||
{
|
||||
SaveFileDialog o = new SaveFileDialog();
|
||||
o.AddExtension = true;
|
||||
o.DefaultExt = ".png";
|
||||
o.FileName = tmap.FileName + ".png";
|
||||
o.Filter = "Portable Net Graphic (*.png)|*.png";
|
||||
if (o.ShowDialog() != DialogResult.OK)
|
||||
return;
|
||||
|
||||
picMap.Image.Save(o.FileName, System.Drawing.Imaging.ImageFormat.Png);
|
||||
|
||||
o.Dispose();
|
||||
o = null;
|
||||
}
|
||||
|
||||
private void numPicMode_ValueChanged(object sender, EventArgs e)
|
||||
{
|
||||
picMap.SizeMode = (PictureBoxSizeMode)numPicMode.Value;
|
||||
}
|
||||
}
|
||||
}
|
131
Plugins/NINOKUNI/NINOKUNI/Text/BattleHelp.cs
Normal file
131
Plugins/NINOKUNI/NINOKUNI/Text/BattleHelp.cs
Normal file
@ -0,0 +1,131 @@
|
||||
// ----------------------------------------------------------------------
|
||||
// <copyright file="BattleHelp.cs" company="none">
|
||||
|
||||
// Copyright (C) 2012
|
||||
//
|
||||
// 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
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
//
|
||||
// </copyright>
|
||||
|
||||
// <author>pleoNeX</author>
|
||||
// <email>benito356@gmail.com</email>
|
||||
// <date>28/08/2012 12:23:36</date>
|
||||
// -----------------------------------------------------------------------
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.IO;
|
||||
using System.Xml;
|
||||
|
||||
namespace NINOKUNI.Text
|
||||
{
|
||||
class BattleHelp : IText
|
||||
{
|
||||
Encoding enc = Encoding.GetEncoding("shift_jis");
|
||||
string[] text;
|
||||
|
||||
public void Read(string fileIn)
|
||||
{
|
||||
BinaryReader br = new BinaryReader(File.OpenRead(fileIn));
|
||||
|
||||
ushort num_block = br.ReadUInt16();
|
||||
text = new string[num_block];
|
||||
|
||||
for (int i = 0; i < num_block; i++)
|
||||
{
|
||||
text[i] = new String(enc.GetChars(br.ReadBytes(0x80)));
|
||||
text[i] = text[i].Replace("\0", "");
|
||||
text[i] = text[i].Replace("\\n", "\n");
|
||||
text[i] = Helper.SJISToLatin(text[i]);
|
||||
}
|
||||
|
||||
br.Close();
|
||||
br = null;
|
||||
}
|
||||
public void Write(string fileOut)
|
||||
{
|
||||
BinaryWriter bw = new BinaryWriter(File.OpenWrite(fileOut));
|
||||
|
||||
bw.Write((ushort)text.Length);
|
||||
|
||||
byte[] t, d;
|
||||
for (int i = 0; i < text.Length; i++)
|
||||
{
|
||||
t = enc.GetBytes(Helper.LatinToSJIS(text[i].Replace("\n", "\\n")));
|
||||
d = new byte[0x80];
|
||||
|
||||
if (t.Length >= 0x80)
|
||||
System.Windows.Forms.MessageBox.Show("Invalid " + i.ToString() + " text. It's so big.");
|
||||
else
|
||||
Array.Copy(t, d, t.Length);
|
||||
|
||||
bw.Write(d);
|
||||
}
|
||||
t = d = null;
|
||||
|
||||
bw.Flush();
|
||||
bw.Close();
|
||||
bw = null;
|
||||
}
|
||||
|
||||
public void Import(string fileIn)
|
||||
{
|
||||
XmlDocument doc = new XmlDocument();
|
||||
doc.Load(fileIn);
|
||||
|
||||
XmlNode root = doc.GetElementsByTagName("BattleHelp")[0];
|
||||
List<string> items = new List<string>();
|
||||
for (int i = 0; i < text.Length; i++)
|
||||
{
|
||||
if (root.ChildNodes[i].NodeType != XmlNodeType.Element)
|
||||
continue;
|
||||
|
||||
string t = root.ChildNodes[i].InnerText;
|
||||
t = Helper.Reformat(t, 4, false);
|
||||
items.Add(t);
|
||||
}
|
||||
text = items.ToArray();
|
||||
items.Clear();
|
||||
items = null;
|
||||
|
||||
root = null;
|
||||
doc = null;
|
||||
}
|
||||
public void Export(string fileOut)
|
||||
{
|
||||
XmlDocument doc = new XmlDocument();
|
||||
doc.AppendChild(doc.CreateXmlDeclaration("1.0", "utf-8", null));
|
||||
|
||||
XmlElement root = doc.CreateElement("BattleHelp");
|
||||
for (int i = 0; i < text.Length; i++)
|
||||
{
|
||||
XmlElement e = doc.CreateElement("String");
|
||||
e.InnerText = Helper.Format(text[i], 4);
|
||||
root.AppendChild(e);
|
||||
e = null;
|
||||
}
|
||||
|
||||
doc.AppendChild(root);
|
||||
root = null;
|
||||
doc.Save(fileOut);
|
||||
doc = null;
|
||||
}
|
||||
|
||||
public string[] Get_Text()
|
||||
{
|
||||
return text;
|
||||
}
|
||||
}
|
||||
}
|
161
Plugins/NINOKUNI/NINOKUNI/Text/BlockText.cs
Normal file
161
Plugins/NINOKUNI/NINOKUNI/Text/BlockText.cs
Normal file
@ -0,0 +1,161 @@
|
||||
// ----------------------------------------------------------------------
|
||||
// <copyright file="BlockText.cs" company="none">
|
||||
|
||||
// Copyright (C) 2012
|
||||
//
|
||||
// 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
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
//
|
||||
// </copyright>
|
||||
|
||||
// <author>pleoNeX</author>
|
||||
// <email>benito356@gmail.com</email>
|
||||
// <date>30/08/2012 2:07:37</date>
|
||||
// -----------------------------------------------------------------------
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.IO;
|
||||
using System.Xml;
|
||||
|
||||
namespace NINOKUNI.Text
|
||||
{
|
||||
public class BlockText : IText
|
||||
{
|
||||
sBlock[] blocks;
|
||||
bool hasNumBlock, encoded, wOriginal;
|
||||
int textSize, dataSize;
|
||||
string fileName;
|
||||
|
||||
public BlockText(bool hasNumBlock, bool encoded, bool wOriginal, int textSize, int dataSize, string fileName)
|
||||
{
|
||||
this.hasNumBlock = hasNumBlock;
|
||||
this.encoded = encoded;
|
||||
this.wOriginal = wOriginal;
|
||||
this.textSize = textSize;
|
||||
this.dataSize = dataSize;
|
||||
this.fileName = fileName;
|
||||
}
|
||||
|
||||
public void Read(string fileIn)
|
||||
{
|
||||
if (encoded)
|
||||
{
|
||||
byte[] d = File.ReadAllBytes(fileIn);
|
||||
for (int i = 0; i < d.Length; i++)
|
||||
d[i] = (byte)~d[i];
|
||||
File.WriteAllBytes(fileIn, d);
|
||||
}
|
||||
|
||||
BinaryReader br = new BinaryReader(File.OpenRead(fileIn));
|
||||
|
||||
uint num_block = 0;
|
||||
if (hasNumBlock)
|
||||
num_block = br.ReadUInt16();
|
||||
else
|
||||
num_block = (uint)(br.BaseStream.Length / (textSize + dataSize));
|
||||
|
||||
blocks = new sBlock[num_block];
|
||||
for (int i = 0; i < num_block; i++)
|
||||
{
|
||||
blocks[i].text = Helper.Read_String(br.ReadBytes(textSize));
|
||||
blocks[i].data = br.ReadBytes(dataSize);
|
||||
}
|
||||
|
||||
br.Close();
|
||||
br = null;
|
||||
}
|
||||
public void Write(string fileOut)
|
||||
{
|
||||
BinaryWriter bw = new BinaryWriter(File.OpenWrite(fileOut));
|
||||
|
||||
if (hasNumBlock)
|
||||
bw.Write((ushort)blocks.Length);
|
||||
|
||||
for (int i = 0; i < blocks.Length; i++)
|
||||
{
|
||||
bw.Write(Helper.Write_String(blocks[i].text, (uint)textSize));
|
||||
bw.Write(blocks[i].data);
|
||||
}
|
||||
|
||||
bw.Flush();
|
||||
bw.Close();
|
||||
bw = null;
|
||||
|
||||
if (encoded)
|
||||
{
|
||||
byte[] d = File.ReadAllBytes(fileOut);
|
||||
for (int i = 0; i < d.Length; i++)
|
||||
d[i] = (byte)~d[i];
|
||||
File.WriteAllBytes(fileOut, d);
|
||||
}
|
||||
}
|
||||
|
||||
public void Import(string fileIn)
|
||||
{
|
||||
XmlDocument doc = new XmlDocument();
|
||||
doc.Load(fileIn);
|
||||
|
||||
XmlNode root = doc.GetElementsByTagName(fileName.Replace(" ", "_"))[0];
|
||||
int i = 0;
|
||||
foreach (XmlNode e in root.ChildNodes)
|
||||
{
|
||||
if (e.NodeType != XmlNodeType.Element || e.Name != "String")
|
||||
continue;
|
||||
|
||||
if (i >= blocks.Length)
|
||||
break;
|
||||
|
||||
blocks[i++].text = Helper.Reformat(e.InnerText, 4, false);
|
||||
}
|
||||
|
||||
root = null;
|
||||
doc = null;
|
||||
}
|
||||
public void Export(string fileOut)
|
||||
{
|
||||
XmlDocument doc = new XmlDocument();
|
||||
doc.AppendChild(doc.CreateXmlDeclaration("1.0", "utf-8", null));
|
||||
|
||||
XmlElement root = doc.CreateElement(fileName.Replace(" ", "_"));
|
||||
for (int i = 0; i < blocks.Length; i++)
|
||||
{
|
||||
XmlElement e = doc.CreateElement("String");
|
||||
e.InnerText = Helper.Format(blocks[i].text, 4);
|
||||
if (wOriginal && !blocks[i].text.Contains('\n'))
|
||||
e.SetAttribute("Original", blocks[i].text);
|
||||
root.AppendChild(e);
|
||||
e = null;
|
||||
}
|
||||
|
||||
doc.AppendChild(root);
|
||||
doc.Save(fileOut);
|
||||
root = null;
|
||||
doc = null;
|
||||
}
|
||||
|
||||
public string[] Get_Text()
|
||||
{
|
||||
string[] t = new string[blocks.Length];
|
||||
for (int i = 0; i < blocks.Length; i++) t[i] = blocks[i].text;
|
||||
return t;
|
||||
}
|
||||
|
||||
struct sBlock
|
||||
{
|
||||
public string text;
|
||||
public byte[] data;
|
||||
}
|
||||
}
|
||||
}
|
135
Plugins/NINOKUNI/NINOKUNI/Text/DownloadParam.cs
Normal file
135
Plugins/NINOKUNI/NINOKUNI/Text/DownloadParam.cs
Normal file
@ -0,0 +1,135 @@
|
||||
// ----------------------------------------------------------------------
|
||||
// <copyright file="DownloadParam.cs" company="none">
|
||||
|
||||
// Copyright (C) 2012
|
||||
//
|
||||
// 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
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
//
|
||||
// </copyright>
|
||||
|
||||
// <author>pleoNeX</author>
|
||||
// <email>benito356@gmail.com</email>
|
||||
// <date>30/08/2012 1:52:18</date>
|
||||
// -----------------------------------------------------------------------
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.IO;
|
||||
using System.Xml;
|
||||
|
||||
namespace NINOKUNI.Text
|
||||
{
|
||||
class DownloadParam : IText
|
||||
{
|
||||
Encoding enc = Encoding.GetEncoding("shift_jis");
|
||||
sDownloadParam[] dp;
|
||||
|
||||
public void Read(string fileIn)
|
||||
{
|
||||
BinaryReader br = new BinaryReader(File.OpenRead(fileIn));
|
||||
|
||||
ushort num_block = br.ReadUInt16();
|
||||
dp = new sDownloadParam[num_block];
|
||||
for (int i = 0; i < num_block; i++)
|
||||
{
|
||||
dp[i].unk1 = br.ReadUInt16();
|
||||
dp[i].unk2 = br.ReadUInt16();
|
||||
dp[i].text = new String(enc.GetChars(br.ReadBytes(0x30)));
|
||||
dp[i].text = Helper.SJISToLatin(dp[i].text.Replace("\0", ""));
|
||||
}
|
||||
|
||||
br.Close();
|
||||
br = null;
|
||||
}
|
||||
public void Write(string fileOut)
|
||||
{
|
||||
BinaryWriter bw = new BinaryWriter(File.OpenWrite(fileOut));
|
||||
|
||||
bw.Write((ushort)dp.Length);
|
||||
byte[] d, t;
|
||||
for (int i = 0; i < dp.Length; i++)
|
||||
{
|
||||
bw.Write(dp[i].unk1);
|
||||
bw.Write(dp[i].unk2);
|
||||
|
||||
d = enc.GetBytes(Helper.LatinToSJIS(dp[i].text));
|
||||
t = new byte[0x30];
|
||||
if (d.Length >= 0x30)
|
||||
System.Windows.Forms.MessageBox.Show("Invalid " + i.ToString() + " text. It's so big");
|
||||
else
|
||||
Array.Copy(d, t, d.Length);
|
||||
|
||||
bw.Write(t);
|
||||
}
|
||||
d = t = null;
|
||||
|
||||
bw.Flush();
|
||||
bw.Close();
|
||||
bw = null;
|
||||
}
|
||||
|
||||
public void Import(string fileIn)
|
||||
{
|
||||
XmlDocument doc = new XmlDocument();
|
||||
doc.Load(fileIn);
|
||||
|
||||
XmlNode root = doc.GetElementsByTagName("DownloadParam")[0];
|
||||
int i = 0;
|
||||
foreach (XmlNode e in root.ChildNodes)
|
||||
{
|
||||
if (e.NodeType != XmlNodeType.Element || e.Name != "String")
|
||||
continue;
|
||||
|
||||
dp[i++].text = Helper.Reformat(e.InnerText, 4, false);
|
||||
}
|
||||
|
||||
root = null;
|
||||
doc = null;
|
||||
}
|
||||
public void Export(string fileOut)
|
||||
{
|
||||
XmlDocument doc = new XmlDocument();
|
||||
doc.AppendChild(doc.CreateXmlDeclaration("1.0", "utf-8", null));
|
||||
|
||||
XmlElement root = doc.CreateElement("DownloadParam");
|
||||
for (int i = 0; i < dp.Length; i++)
|
||||
{
|
||||
XmlElement e = doc.CreateElement("String");
|
||||
e.InnerText = Helper.Format(dp[i].text, 4);
|
||||
root.AppendChild(e);
|
||||
e = null;
|
||||
}
|
||||
|
||||
doc.AppendChild(root);
|
||||
doc.Save(fileOut);
|
||||
root = null;
|
||||
doc = null;
|
||||
}
|
||||
|
||||
public string[] Get_Text()
|
||||
{
|
||||
string[] t = new string[dp.Length];
|
||||
for (int i = 0; i < t.Length; i++) t[i] = dp[i].text;
|
||||
return t;
|
||||
}
|
||||
|
||||
struct sDownloadParam
|
||||
{
|
||||
public ushort unk1;
|
||||
public ushort unk2; // ID?
|
||||
public string text; // 0x30 bytes
|
||||
}
|
||||
}
|
||||
}
|
173
Plugins/NINOKUNI/NINOKUNI/Text/DungeonList.cs
Normal file
173
Plugins/NINOKUNI/NINOKUNI/Text/DungeonList.cs
Normal file
@ -0,0 +1,173 @@
|
||||
// ----------------------------------------------------------------------
|
||||
// <copyright file="DungeonList.cs" company="none">
|
||||
|
||||
// Copyright (C) 2012
|
||||
//
|
||||
// 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
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
//
|
||||
// </copyright>
|
||||
|
||||
// <author>pleoNeX</author>
|
||||
// <email>benito356@gmail.com</email>
|
||||
// <date>30/08/2012 2:05:39</date>
|
||||
// -----------------------------------------------------------------------
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.IO;
|
||||
using System.Xml;
|
||||
|
||||
namespace NINOKUNI.Text
|
||||
{
|
||||
class DungeonList : IText
|
||||
{
|
||||
Encoding enc = Encoding.GetEncoding("shift_jis");
|
||||
sDungeonList[] dl;
|
||||
|
||||
public void Read(string fileIn)
|
||||
{
|
||||
BinaryReader br = new BinaryReader(File.OpenRead(fileIn));
|
||||
|
||||
ushort num_block = br.ReadUInt16();
|
||||
ushort num_subTotal = br.ReadUInt16();
|
||||
dl = new sDungeonList[num_block];
|
||||
|
||||
for (int i = 0; i < num_block; i++)
|
||||
{
|
||||
dl[i].title =Helper.Read_String(br.ReadBytes(0x40));
|
||||
|
||||
ushort num_sub = br.ReadUInt16();
|
||||
dl[i].entries = new sDungeonList_Entry[num_sub];
|
||||
for (int j = 0; j < num_sub; j++)
|
||||
{
|
||||
dl[i].entries[j].text = Helper.Read_String(br.ReadBytes(0x40));
|
||||
dl[i].entries[j].script_name = Helper.Read_String(br.ReadBytes(0x08));
|
||||
}
|
||||
}
|
||||
|
||||
br.Close();
|
||||
br = null;
|
||||
}
|
||||
public void Write(string fileOut)
|
||||
{
|
||||
BinaryWriter bw = new BinaryWriter(File.OpenWrite(fileOut));
|
||||
|
||||
bw.Write((ushort)dl.Length);
|
||||
ushort num_subTotal = 0;
|
||||
for (int i = 0; i < dl.Length; i++) num_subTotal += (ushort)dl[i].entries.Length;
|
||||
bw.Write(num_subTotal);
|
||||
|
||||
for (int i = 0; i < dl.Length; i++)
|
||||
{
|
||||
bw.Write(Helper.Write_String(dl[i].title, 0x40));
|
||||
bw.Write((ushort)dl[i].entries.Length);
|
||||
|
||||
for (int j = 0; j < dl[i].entries.Length; j++)
|
||||
{
|
||||
bw.Write(Helper.Write_String(dl[i].entries[j].text, 0x40));
|
||||
bw.Write(Helper.Write_String(dl[i].entries[j].script_name, 0x08));
|
||||
}
|
||||
}
|
||||
|
||||
bw.Flush();
|
||||
bw.Close();
|
||||
bw = null;
|
||||
}
|
||||
|
||||
public void Import(string fileIn)
|
||||
{
|
||||
XmlDocument doc = new XmlDocument();
|
||||
doc.Load(fileIn);
|
||||
|
||||
XmlNode root = doc.GetElementsByTagName("DungeonList")[0];
|
||||
int i = 0;
|
||||
foreach (XmlNode b in root.ChildNodes)
|
||||
{
|
||||
if (b.NodeType != XmlNodeType.Element || b.Name != "Block")
|
||||
continue;
|
||||
|
||||
int j = 0;
|
||||
foreach (XmlNode e in b.ChildNodes)
|
||||
{
|
||||
if (e.NodeType != XmlNodeType.Element)
|
||||
continue;
|
||||
|
||||
if (e.Name == "Title") dl[i].title = Helper.Reformat(e.InnerText, 6, false);
|
||||
else if (e.Name == "Message") dl[i].entries[j++].text = Helper.Reformat(e.InnerText, 8, false);
|
||||
}
|
||||
i++;
|
||||
}
|
||||
|
||||
root = null;
|
||||
doc = null;
|
||||
}
|
||||
public void Export(string fileOut)
|
||||
{
|
||||
XmlDocument doc = new XmlDocument();
|
||||
doc.AppendChild(doc.CreateXmlDeclaration("1.0", "utf-8", null));
|
||||
|
||||
XmlElement root = doc.CreateElement("DungeonList");
|
||||
for (int i = 0; i < dl.Length; i++)
|
||||
{
|
||||
XmlElement b = doc.CreateElement("Block");
|
||||
XmlElement title = doc.CreateElement("Title");
|
||||
title.InnerText = Helper.Format(dl[i].title, 6);
|
||||
b.AppendChild(title);
|
||||
|
||||
for (int j = 0; j < dl[i].entries.Length; j++)
|
||||
{
|
||||
XmlElement msg = doc.CreateElement("Message");
|
||||
msg.InnerText = Helper.Format(dl[i].entries[j].text, 8);
|
||||
msg.SetAttribute("Script", dl[i].entries[j].script_name);
|
||||
b.AppendChild(msg);
|
||||
}
|
||||
root.AppendChild(b);
|
||||
}
|
||||
|
||||
doc.AppendChild(root);
|
||||
root = null;
|
||||
doc.Save(fileOut);
|
||||
doc = null;
|
||||
}
|
||||
|
||||
public string[] Get_Text()
|
||||
{
|
||||
List<string> t = new List<string>();
|
||||
for (int i = 0; i < dl.Length; i++)
|
||||
{
|
||||
for (int j = 0; j < dl[i].entries.Length; j++)
|
||||
{
|
||||
string text = "Title (" + i.ToString() + "): " + dl[i].title;
|
||||
text += "\n\nMessage:\n" + dl[i].entries[j].text;
|
||||
text += "\n\nScript: " + dl[i].entries[j].script_name;
|
||||
t.Add(text);
|
||||
}
|
||||
}
|
||||
|
||||
return t.ToArray();
|
||||
}
|
||||
|
||||
struct sDungeonList
|
||||
{
|
||||
public string title;
|
||||
public sDungeonList_Entry[] entries;
|
||||
}
|
||||
struct sDungeonList_Entry
|
||||
{
|
||||
public string text;
|
||||
public string script_name;
|
||||
}
|
||||
}
|
||||
}
|
42
Plugins/NINOKUNI/NINOKUNI/Text/IText.cs
Normal file
42
Plugins/NINOKUNI/NINOKUNI/Text/IText.cs
Normal file
@ -0,0 +1,42 @@
|
||||
// ----------------------------------------------------------------------
|
||||
// <copyright file="ScriptBase.cs" company="none">
|
||||
|
||||
// Copyright (C) 2012
|
||||
//
|
||||
// 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
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
//
|
||||
// </copyright>
|
||||
|
||||
// <author>pleoNeX</author>
|
||||
// <email>benito356@gmail.com</email>
|
||||
// <date>28/08/2012 12:03:28</date>
|
||||
// -----------------------------------------------------------------------
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
|
||||
namespace NINOKUNI
|
||||
{
|
||||
public interface IText
|
||||
{
|
||||
void Read(string fileIn);
|
||||
void Write(string fileOut);
|
||||
|
||||
void Import(string fileIn);
|
||||
void Export(string fileOut);
|
||||
|
||||
string[] Get_Text();
|
||||
}
|
||||
}
|
@ -40,7 +40,6 @@ namespace NINOKUNI
|
||||
string fileName;
|
||||
MainQuest mq_old;
|
||||
MainQuest mq;
|
||||
Encoding enc;
|
||||
|
||||
public MQuestText()
|
||||
{
|
||||
@ -52,7 +51,6 @@ namespace NINOKUNI
|
||||
this.id = id;
|
||||
this.pluginHost = pluginHost;
|
||||
fileName = Path.GetFileNameWithoutExtension(file).Substring(12);
|
||||
enc = Encoding.GetEncoding("shift_jis");
|
||||
|
||||
mq = ReadFile(file);
|
||||
mq_old = ReadFile(file);
|
||||
@ -97,7 +95,7 @@ namespace NINOKUNI
|
||||
br.Close();
|
||||
return mq;
|
||||
}
|
||||
private void Write(string fileOut)
|
||||
public void Write(string fileOut)
|
||||
{
|
||||
BinaryWriter bw = new BinaryWriter(File.OpenWrite(fileOut));
|
||||
|
||||
@ -112,7 +110,7 @@ namespace NINOKUNI
|
||||
for (int e = 0; e < mq.blocks[i].elements.Length; e++)
|
||||
{
|
||||
bw.Write(mq.blocks[i].elements[e].size);
|
||||
bw.Write(enc.GetBytes(Helper.LatinToSJIS(mq.blocks[i].elements[e].text)));
|
||||
bw.Write(Encoding.GetEncoding("shift_jis").GetBytes(Helper.LatinToSJIS(mq.blocks[i].elements[e].text)));
|
||||
}
|
||||
bw.Write((byte)0x00);
|
||||
}
|
||||
@ -120,13 +118,13 @@ namespace NINOKUNI
|
||||
bw.Flush();
|
||||
bw.Close();
|
||||
}
|
||||
private void Update_Block(ref MainQuest.Block block)
|
||||
public void Update_Block(ref MainQuest.Block block)
|
||||
{
|
||||
ushort size = 0;
|
||||
for (int i = 0; i < block.elements.Length; i++)
|
||||
{
|
||||
MainQuest.Block.Element e = block.elements[i];
|
||||
e.size = (ushort)enc.GetByteCount(Helper.LatinToSJIS(e.text));
|
||||
e.size = (ushort)Encoding.GetEncoding("shift_jis").GetByteCount(Helper.LatinToSJIS(e.text));
|
||||
block.elements[i] = e;
|
||||
|
||||
size += (ushort)(e.size + 2);
|
||||
@ -156,6 +154,34 @@ namespace NINOKUNI
|
||||
lblSizeTrans.Text = "";
|
||||
}
|
||||
|
||||
public void Import(string file)
|
||||
{
|
||||
XmlDocument doc = new XmlDocument();
|
||||
doc.Load(file);
|
||||
|
||||
XmlNode root = doc.ChildNodes[1];
|
||||
for (int i = 0; i < root.ChildNodes.Count; i++)
|
||||
{
|
||||
XmlNode block = root.ChildNodes[i];
|
||||
mq.blocks[i].id = Convert.ToUInt32(block.Attributes["ID"].Value, 16);
|
||||
|
||||
for (int j = 0; j < block.ChildNodes.Count; j++)
|
||||
{
|
||||
string text = block.ChildNodes[j].InnerText;
|
||||
if (text.Contains("\n"))
|
||||
{
|
||||
text = text.Remove(0, 7);
|
||||
text = text.Remove(text.Length - 5);
|
||||
text = text.Replace("\n ", "\n");
|
||||
}
|
||||
text = text.Replace('【', '<');
|
||||
text = text.Replace('】', '>');
|
||||
|
||||
mq.blocks[i].elements[j].text = text;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void btnExport_Click(object sender, EventArgs e)
|
||||
{
|
||||
SaveFileDialog o = new SaveFileDialog();
|
||||
@ -210,30 +236,7 @@ namespace NINOKUNI
|
||||
if (o.ShowDialog() != DialogResult.OK)
|
||||
return;
|
||||
|
||||
XmlDocument doc = new XmlDocument();
|
||||
doc.Load(o.FileName);
|
||||
|
||||
XmlNode root = doc.ChildNodes[1];
|
||||
for (int i = 0; i < root.ChildNodes.Count; i++)
|
||||
{
|
||||
XmlNode block = root.ChildNodes[i];
|
||||
mq.blocks[i].id = Convert.ToUInt32(block.Attributes["ID"].Value, 16);
|
||||
|
||||
for (int j = 0; j < block.ChildNodes.Count; j++)
|
||||
{
|
||||
string text = block.ChildNodes[j].InnerText;
|
||||
if (text.Contains("\n"))
|
||||
{
|
||||
text = text.Remove(0, 7);
|
||||
text = text.Remove(text.Length - 5);
|
||||
text = text.Replace("\n ", "\n");
|
||||
}
|
||||
text = text.Replace('【', '<');
|
||||
text = text.Replace('】', '>');
|
||||
|
||||
mq.blocks[i].elements[j].text = text;
|
||||
}
|
||||
}
|
||||
Import(o.FileName);
|
||||
numBlock_ValueChanged(null, null);
|
||||
|
||||
// Write file
|
@ -66,8 +66,8 @@ namespace NINOKUNI
|
||||
{
|
||||
// Test method to know if it's working with all the files
|
||||
// it could be useful later to import all of them in one time (batch mode)
|
||||
string folder = @"G:\projects\ninokuni\Quest\";
|
||||
string[] files = Directory.GetFiles(folder);
|
||||
string folder = @"G:\nds\projects\ninokuni\Quest\";
|
||||
string[] files = Directory.GetFiles(folder, "*.sq");
|
||||
|
||||
for (int i = 0; i < files.Length; i++)
|
||||
{
|
||||
@ -79,7 +79,7 @@ namespace NINOKUNI
|
||||
Write(temp_sq, temp);
|
||||
|
||||
if (!Compare(files[i], temp_sq))
|
||||
MessageBox.Show("Test");
|
||||
MessageBox.Show("Test " + files[i]);
|
||||
File.Delete(temp_sq);
|
||||
}
|
||||
MessageBox.Show("Final");
|
||||
@ -115,7 +115,7 @@ namespace NINOKUNI
|
||||
catch { throw new NotSupportedException("There was an error reading the language file"); }
|
||||
}
|
||||
|
||||
private SQ Read(string file)
|
||||
public SQ Read(string file)
|
||||
{
|
||||
BinaryReader br = new BinaryReader(File.OpenRead(file));
|
||||
SQ original = new SQ();
|
||||
@ -153,9 +153,9 @@ namespace NINOKUNI
|
||||
br.Close();
|
||||
return original;
|
||||
}
|
||||
private void Write(string fileOut, SQ translated)
|
||||
public void Write(string fileOut, SQ translated)
|
||||
{
|
||||
Update_Blocks();
|
||||
Update_Blocks(ref translated);
|
||||
BinaryWriter bw = new BinaryWriter(File.OpenWrite(fileOut));
|
||||
|
||||
bw.Write(translated.id);
|
||||
@ -187,7 +187,7 @@ namespace NINOKUNI
|
||||
bw.Flush();
|
||||
bw.Close();
|
||||
}
|
||||
private void Update_Blocks()
|
||||
private void Update_Blocks(ref SQ translated)
|
||||
{
|
||||
for (int i = 0; i < translated.sblocks.Length; i++)
|
||||
translated.sblocks[i].size = (ushort)enc.GetByteCount(Helper.LatinToSJIS(translated.sblocks[i].text));
|
||||
@ -271,17 +271,16 @@ namespace NINOKUNI
|
||||
doc.AppendChild(root);
|
||||
doc.Save(fileOut);
|
||||
}
|
||||
private void Import_XML(string fileIn, ref SQ translated)
|
||||
public void Import_XML(string fileIn, ref SQ translated)
|
||||
{
|
||||
XmlDocument doc = new XmlDocument();
|
||||
doc.Load(fileIn);
|
||||
XDocument doc = XDocument.Load(fileIn);
|
||||
XElement root = doc.Element("SubQuest");
|
||||
|
||||
XmlNode root = doc.ChildNodes[1];
|
||||
|
||||
XmlNode sBlocks = root.ChildNodes[0];
|
||||
for (int i = 0; i < sBlocks.ChildNodes.Count; i++)
|
||||
XElement sBlocks = root.Element("StartBlocks");
|
||||
int i = 0;
|
||||
foreach (XElement e in sBlocks.Elements("String"))
|
||||
{
|
||||
string text = sBlocks.ChildNodes[i].InnerText;
|
||||
string text = e.Value;
|
||||
if (text.Contains("\n"))
|
||||
{
|
||||
text = text.Remove(0, 7);
|
||||
@ -291,13 +290,14 @@ namespace NINOKUNI
|
||||
text = text.Replace('【', '<');
|
||||
text = text.Replace('】', '>');
|
||||
|
||||
translated.sblocks[i].text = text;
|
||||
translated.sblocks[i++].text = text;
|
||||
}
|
||||
|
||||
XmlNode fBlocks = root.ChildNodes[1];
|
||||
for (int i = 0; i < fBlocks.ChildNodes.Count; i++)
|
||||
XElement fBlocks = root.Element("FinalBlocks");
|
||||
i = 0;
|
||||
foreach (XElement e in fBlocks.Elements("String"))
|
||||
{
|
||||
string text = fBlocks.ChildNodes[i].InnerText;
|
||||
string text = e.Value;
|
||||
if (text.Contains("\n"))
|
||||
{
|
||||
text = text.Remove(0, 7);
|
||||
@ -307,8 +307,13 @@ namespace NINOKUNI
|
||||
text = text.Replace('【', '<');
|
||||
text = text.Replace('】', '>');
|
||||
|
||||
translated.fblocks[i].text = text;
|
||||
translated.fblocks[i++].text = text;
|
||||
}
|
||||
|
||||
sBlocks = null;
|
||||
fBlocks = null;
|
||||
root = null;
|
||||
doc = null;
|
||||
}
|
||||
private void btnSave_Click(object sender, EventArgs e)
|
||||
{
|
@ -111,7 +111,7 @@ namespace NINOKUNI
|
||||
br.Close();
|
||||
return sce;
|
||||
}
|
||||
private void Write(string fileOut)
|
||||
public void Write(string fileOut)
|
||||
{
|
||||
Update_Block();
|
||||
if (File.Exists(fileOut))
|
||||
@ -279,23 +279,7 @@ namespace NINOKUNI
|
||||
if (o.ShowDialog() != DialogResult.OK)
|
||||
return;
|
||||
|
||||
XmlDocument doc = new XmlDocument();
|
||||
doc.Load(o.FileName);
|
||||
|
||||
XmlNode root = doc.ChildNodes[1];
|
||||
for (int i = 0; i < root.ChildNodes.Count; i++)
|
||||
{
|
||||
string text = root.ChildNodes[i].InnerText;
|
||||
if (text.Contains("\n"))
|
||||
{
|
||||
text = text.Remove(0, 5);
|
||||
text = text.Remove(text.Length - 3);
|
||||
text = text.Replace("\n ", "\n");
|
||||
}
|
||||
|
||||
sce.blocks[0].elements[i].id = Convert.ToUInt32(root.ChildNodes[i].Attributes["ID"].Value, 16);
|
||||
sce.blocks[0].elements[i].text = text;
|
||||
}
|
||||
Import(o.FileName);
|
||||
numericBlock_ValueChanged(null, null);
|
||||
|
||||
// Write file
|
||||
@ -337,6 +321,26 @@ namespace NINOKUNI
|
||||
doc.AppendChild(root);
|
||||
doc.Save(o.FileName);
|
||||
}
|
||||
public void Import(string file)
|
||||
{
|
||||
XmlDocument doc = new XmlDocument();
|
||||
doc.Load(file);
|
||||
|
||||
XmlNode root = doc.ChildNodes[1];
|
||||
for (int i = 0; i < root.ChildNodes.Count; i++)
|
||||
{
|
||||
string text = root.ChildNodes[i].InnerText;
|
||||
if (text.Contains("\n"))
|
||||
{
|
||||
text = text.Remove(0, 5);
|
||||
text = text.Remove(text.Length - 3);
|
||||
text = text.Replace("\n ", "\n");
|
||||
}
|
||||
|
||||
sce.blocks[0].elements[i].id = Convert.ToUInt32(root.ChildNodes[i].Attributes["ID"].Value, 16);
|
||||
sce.blocks[0].elements[i].text = text;
|
||||
}
|
||||
}
|
||||
|
||||
private void txtNew_TextChanged(object sender, EventArgs e)
|
||||
{
|
129
Plugins/NINOKUNI/NINOKUNI/Text/StageInfoData.cs
Normal file
129
Plugins/NINOKUNI/NINOKUNI/Text/StageInfoData.cs
Normal file
@ -0,0 +1,129 @@
|
||||
// ----------------------------------------------------------------------
|
||||
// <copyright file="StageInfoData.cs" company="none">
|
||||
|
||||
// Copyright (C) 2012
|
||||
//
|
||||
// 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
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
//
|
||||
// </copyright>
|
||||
|
||||
// <author>pleoNeX</author>
|
||||
// <email>benito356@gmail.com</email>
|
||||
// <date>29/08/2012 23:51:00</date>
|
||||
// -----------------------------------------------------------------------
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.IO;
|
||||
using System.Xml;
|
||||
|
||||
namespace NINOKUNI.Text
|
||||
{
|
||||
class StageInfoData : IText
|
||||
{
|
||||
Encoding enc = Encoding.GetEncoding("shift_jis");
|
||||
sStageInfoData[] sid;
|
||||
|
||||
public void Read(string fileIn)
|
||||
{
|
||||
BinaryReader br = new BinaryReader(File.OpenRead(fileIn));
|
||||
|
||||
uint num_block = br.ReadUInt32();
|
||||
sid = new sStageInfoData[num_block];
|
||||
for (int i = 0; i < num_block; i++)
|
||||
{
|
||||
sid[i].index = br.ReadUInt32();
|
||||
uint size = br.ReadUInt32();
|
||||
sid[i].text = new String(enc.GetChars(br.ReadBytes((int)size)));
|
||||
sid[i].text = Helper.SJISToLatin(sid[i].text.Replace("\0", ""));
|
||||
}
|
||||
|
||||
br.Close();
|
||||
br = null;
|
||||
}
|
||||
public void Write(string fileOut)
|
||||
{
|
||||
BinaryWriter bw = new BinaryWriter(File.OpenWrite(fileOut));
|
||||
|
||||
bw.Write(sid.Length);
|
||||
for (int i = 0; i < sid.Length; i++)
|
||||
{
|
||||
string t = Helper.LatinToSJIS(sid[i].text) + '\0';
|
||||
bw.Write(sid[i].index);
|
||||
bw.Write(enc.GetByteCount(t));
|
||||
bw.Write(enc.GetBytes(t));
|
||||
}
|
||||
|
||||
bw.Flush();
|
||||
bw.Close();
|
||||
bw = null;
|
||||
}
|
||||
|
||||
public void Import(string fileIn)
|
||||
{
|
||||
XmlDocument doc = new XmlDocument();
|
||||
doc.Load(fileIn);
|
||||
|
||||
XmlNode root = doc.GetElementsByTagName("Comment_StageInfoData")[0];
|
||||
int j = 0;
|
||||
for (int i = 0; i < root.ChildNodes.Count; i++)
|
||||
{
|
||||
if (root.ChildNodes[i].NodeType != XmlNodeType.Element || root.ChildNodes[i].Name != "String")
|
||||
continue;
|
||||
|
||||
if (i >= sid.Length)
|
||||
break;
|
||||
|
||||
sid[j++].text = Helper.Reformat(root.ChildNodes[i].InnerText, 4, false);
|
||||
}
|
||||
|
||||
root = null;
|
||||
doc = null;
|
||||
}
|
||||
public void Export(string fileOut)
|
||||
{
|
||||
XmlDocument doc = new XmlDocument();
|
||||
doc.AppendChild(doc.CreateXmlDeclaration("1.0", "utf-8", null));
|
||||
|
||||
XmlElement root = doc.CreateElement("Comment_StageInfoData");
|
||||
for (int i = 0; i < sid.Length; i++)
|
||||
{
|
||||
XmlElement e = doc.CreateElement("String");
|
||||
e.InnerText = Helper.Format(sid[i].text, 4);
|
||||
root.AppendChild(e);
|
||||
e = null;
|
||||
}
|
||||
|
||||
|
||||
doc.AppendChild(root);
|
||||
doc.Save(fileOut);
|
||||
root = null;
|
||||
doc = null;
|
||||
}
|
||||
|
||||
public string[] Get_Text()
|
||||
{
|
||||
string[] t = new string[sid.Length];
|
||||
for (int i = 0; i < t.Length; i++) t[i] = sid[i].text;
|
||||
return t;
|
||||
}
|
||||
|
||||
struct sStageInfoData
|
||||
{
|
||||
public uint index;
|
||||
public string text;
|
||||
}
|
||||
}
|
||||
}
|
@ -104,7 +104,7 @@ namespace NINOKUNI
|
||||
|
||||
return subs.ToArray();
|
||||
}
|
||||
private void Write(string file)
|
||||
public void Write(string file)
|
||||
{
|
||||
string text = "";
|
||||
|
||||
@ -274,7 +274,7 @@ namespace NINOKUNI
|
||||
doc.AppendChild(root);
|
||||
doc.Save(xml);
|
||||
}
|
||||
private void ImportXML(string xml)
|
||||
public void ImportXML(string xml)
|
||||
{
|
||||
List<Subtitle> subs = new List<Subtitle>();
|
||||
|
||||
@ -292,7 +292,7 @@ namespace NINOKUNI
|
||||
{
|
||||
case "Text":
|
||||
sub.type = SubType.Text;
|
||||
sub.data = Helper.Reformat(n.InnerText, 4).Replace("\r\n", "\n");
|
||||
sub.data = Helper.Reformat(n.InnerText, 4, true).Replace("\r\n", "\n");
|
||||
|
||||
// Check for errors
|
||||
if (!Helper.Check(sub.data, 0))
|
||||
@ -311,7 +311,7 @@ namespace NINOKUNI
|
||||
break;
|
||||
case "Comment":
|
||||
sub.type = SubType.Comment;
|
||||
sub.data = Helper.Reformat(n.InnerText, 4).Replace("\r\n", "\n");
|
||||
sub.data = Helper.Reformat(n.InnerText, 4, true).Replace("\r\n", "\n");
|
||||
break;
|
||||
case "Voice":
|
||||
sub.type = SubType.Voice;
|
120
Plugins/NINOKUNI/NINOKUNI/Text/SubtitleControl.resx
Normal file
120
Plugins/NINOKUNI/NINOKUNI/Text/SubtitleControl.resx
Normal file
@ -0,0 +1,120 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<root>
|
||||
<!--
|
||||
Microsoft ResX Schema
|
||||
|
||||
Version 2.0
|
||||
|
||||
The primary goals of this format is to allow a simple XML format
|
||||
that is mostly human readable. The generation and parsing of the
|
||||
various data types are done through the TypeConverter classes
|
||||
associated with the data types.
|
||||
|
||||
Example:
|
||||
|
||||
... ado.net/XML headers & schema ...
|
||||
<resheader name="resmimetype">text/microsoft-resx</resheader>
|
||||
<resheader name="version">2.0</resheader>
|
||||
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
|
||||
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
|
||||
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
|
||||
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
|
||||
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
|
||||
<value>[base64 mime encoded serialized .NET Framework object]</value>
|
||||
</data>
|
||||
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
|
||||
<comment>This is a comment</comment>
|
||||
</data>
|
||||
|
||||
There are any number of "resheader" rows that contain simple
|
||||
name/value pairs.
|
||||
|
||||
Each data row contains a name, and value. The row also contains a
|
||||
type or mimetype. Type corresponds to a .NET class that support
|
||||
text/value conversion through the TypeConverter architecture.
|
||||
Classes that don't support this are serialized and stored with the
|
||||
mimetype set.
|
||||
|
||||
The mimetype is used for serialized objects, and tells the
|
||||
ResXResourceReader how to depersist the object. This is currently not
|
||||
extensible. For a given mimetype the value must be set accordingly:
|
||||
|
||||
Note - application/x-microsoft.net.object.binary.base64 is the format
|
||||
that the ResXResourceWriter will generate, however the reader can
|
||||
read any of the formats listed below.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.binary.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.soap.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.bytearray.base64
|
||||
value : The object must be serialized into a byte array
|
||||
: using a System.ComponentModel.TypeConverter
|
||||
: and then encoded with base64 encoding.
|
||||
-->
|
||||
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
||||
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
|
||||
<xsd:element name="root" msdata:IsDataSet="true">
|
||||
<xsd:complexType>
|
||||
<xsd:choice maxOccurs="unbounded">
|
||||
<xsd:element name="metadata">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" use="required" type="xsd:string" />
|
||||
<xsd:attribute name="type" type="xsd:string" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="assembly">
|
||||
<xsd:complexType>
|
||||
<xsd:attribute name="alias" type="xsd:string" />
|
||||
<xsd:attribute name="name" type="xsd:string" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="data">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
|
||||
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="resheader">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:choice>
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:schema>
|
||||
<resheader name="resmimetype">
|
||||
<value>text/microsoft-resx</value>
|
||||
</resheader>
|
||||
<resheader name="version">
|
||||
<value>2.0</value>
|
||||
</resheader>
|
||||
<resheader name="reader">
|
||||
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<resheader name="writer">
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
</root>
|
@ -82,7 +82,7 @@ namespace NINOKUNI
|
||||
br.Close();
|
||||
return s;
|
||||
}
|
||||
private void Write(string fileOut)
|
||||
public void Write(string fileOut)
|
||||
{
|
||||
BinaryWriter bw = new BinaryWriter(File.OpenWrite(fileOut));
|
||||
|
||||
@ -131,27 +131,7 @@ namespace NINOKUNI
|
||||
if (o.ShowDialog() != DialogResult.OK)
|
||||
return;
|
||||
|
||||
XmlDocument doc = new XmlDocument();
|
||||
doc.Load(o.FileName);
|
||||
|
||||
XmlNode root = doc.ChildNodes[1];
|
||||
for (int i = 0; i < root.ChildNodes.Count; i++)
|
||||
{
|
||||
XmlNode el = root.ChildNodes[i];
|
||||
systext.elements[i].id = Convert.ToUInt32(el.Attributes["ID"].Value, 16);
|
||||
|
||||
string text = el.InnerText;
|
||||
if (text.Contains("\n"))
|
||||
{
|
||||
text = text.Remove(0, 5);
|
||||
text = text.Remove(text.Length - 3);
|
||||
text = text.Replace("\n ", "\n");
|
||||
}
|
||||
text = text.Replace('【', '<');
|
||||
text = text.Replace('】', '>');
|
||||
|
||||
systext.elements[i].text = text;
|
||||
}
|
||||
Import(o.FileName);
|
||||
numElement_ValueChanged(null, null);
|
||||
|
||||
// Write file
|
||||
@ -199,6 +179,30 @@ namespace NINOKUNI
|
||||
Write(fileOut);
|
||||
pluginHost.ChangeFile(id, fileOut);
|
||||
}
|
||||
public void Import(string file)
|
||||
{
|
||||
XmlDocument doc = new XmlDocument();
|
||||
doc.Load(file);
|
||||
|
||||
XmlNode root = doc.ChildNodes[1];
|
||||
for (int i = 0; i < root.ChildNodes.Count; i++)
|
||||
{
|
||||
XmlNode el = root.ChildNodes[i];
|
||||
systext.elements[i].id = Convert.ToUInt32(el.Attributes["ID"].Value, 16);
|
||||
|
||||
string text = el.InnerText;
|
||||
if (text.Contains("\n"))
|
||||
{
|
||||
text = text.Remove(0, 5);
|
||||
text = text.Remove(text.Length - 3);
|
||||
text = text.Replace("\n ", "\n");
|
||||
}
|
||||
text = text.Replace('【', '<');
|
||||
text = text.Replace('】', '>');
|
||||
|
||||
systext.elements[i].text = text;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
120
Plugins/NINOKUNI/NINOKUNI/Text/SystemText.resx
Normal file
120
Plugins/NINOKUNI/NINOKUNI/Text/SystemText.resx
Normal file
@ -0,0 +1,120 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<root>
|
||||
<!--
|
||||
Microsoft ResX Schema
|
||||
|
||||
Version 2.0
|
||||
|
||||
The primary goals of this format is to allow a simple XML format
|
||||
that is mostly human readable. The generation and parsing of the
|
||||
various data types are done through the TypeConverter classes
|
||||
associated with the data types.
|
||||
|
||||
Example:
|
||||
|
||||
... ado.net/XML headers & schema ...
|
||||
<resheader name="resmimetype">text/microsoft-resx</resheader>
|
||||
<resheader name="version">2.0</resheader>
|
||||
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
|
||||
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
|
||||
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
|
||||
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
|
||||
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
|
||||
<value>[base64 mime encoded serialized .NET Framework object]</value>
|
||||
</data>
|
||||
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
|
||||
<comment>This is a comment</comment>
|
||||
</data>
|
||||
|
||||
There are any number of "resheader" rows that contain simple
|
||||
name/value pairs.
|
||||
|
||||
Each data row contains a name, and value. The row also contains a
|
||||
type or mimetype. Type corresponds to a .NET class that support
|
||||
text/value conversion through the TypeConverter architecture.
|
||||
Classes that don't support this are serialized and stored with the
|
||||
mimetype set.
|
||||
|
||||
The mimetype is used for serialized objects, and tells the
|
||||
ResXResourceReader how to depersist the object. This is currently not
|
||||
extensible. For a given mimetype the value must be set accordingly:
|
||||
|
||||
Note - application/x-microsoft.net.object.binary.base64 is the format
|
||||
that the ResXResourceWriter will generate, however the reader can
|
||||
read any of the formats listed below.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.binary.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.soap.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.bytearray.base64
|
||||
value : The object must be serialized into a byte array
|
||||
: using a System.ComponentModel.TypeConverter
|
||||
: and then encoded with base64 encoding.
|
||||
-->
|
||||
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
||||
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
|
||||
<xsd:element name="root" msdata:IsDataSet="true">
|
||||
<xsd:complexType>
|
||||
<xsd:choice maxOccurs="unbounded">
|
||||
<xsd:element name="metadata">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" use="required" type="xsd:string" />
|
||||
<xsd:attribute name="type" type="xsd:string" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="assembly">
|
||||
<xsd:complexType>
|
||||
<xsd:attribute name="alias" type="xsd:string" />
|
||||
<xsd:attribute name="name" type="xsd:string" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="data">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
|
||||
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="resheader">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:choice>
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:schema>
|
||||
<resheader name="resmimetype">
|
||||
<value>text/microsoft-resx</value>
|
||||
</resheader>
|
||||
<resheader name="version">
|
||||
<value>2.0</value>
|
||||
</resheader>
|
||||
<resheader name="reader">
|
||||
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<resheader name="writer">
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
</root>
|
163
Plugins/NINOKUNI/NINOKUNI/Text/TextControl.Designer.cs
generated
Normal file
163
Plugins/NINOKUNI/NINOKUNI/Text/TextControl.Designer.cs
generated
Normal file
@ -0,0 +1,163 @@
|
||||
// ----------------------------------------------------------------------
|
||||
// <copyright file="TextControl.Designer.cs" company="none">
|
||||
|
||||
// Copyright (C) 2012
|
||||
//
|
||||
// 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
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
//
|
||||
// </copyright>
|
||||
|
||||
// <author>pleoNeX</author>
|
||||
// <email>benito356@gmail.com</email>
|
||||
// <date>28/08/2012 12:23:45</date>
|
||||
// -----------------------------------------------------------------------
|
||||
namespace NINOKUNI.Text
|
||||
{
|
||||
partial class TextControl
|
||||
{
|
||||
/// <summary>
|
||||
/// Variable del diseñador requerida.
|
||||
/// </summary>
|
||||
private System.ComponentModel.IContainer components = null;
|
||||
|
||||
/// <summary>
|
||||
/// Limpiar los recursos que se estén utilizando.
|
||||
/// </summary>
|
||||
/// <param name="disposing">true si los recursos administrados se deben eliminar; false en caso contrario, false.</param>
|
||||
protected override void Dispose(bool disposing)
|
||||
{
|
||||
if (disposing && (components != null))
|
||||
{
|
||||
components.Dispose();
|
||||
}
|
||||
base.Dispose(disposing);
|
||||
}
|
||||
|
||||
#region Código generado por el Diseñador de componentes
|
||||
|
||||
/// <summary>
|
||||
/// Método necesario para admitir el Diseñador. No se puede modificar
|
||||
/// el contenido del método con el editor de código.
|
||||
/// </summary>
|
||||
private void InitializeComponent()
|
||||
{
|
||||
this.btnExport = new System.Windows.Forms.Button();
|
||||
this.btnImport = new System.Windows.Forms.Button();
|
||||
this.label1 = new System.Windows.Forms.Label();
|
||||
this.txtBlock = new System.Windows.Forms.TextBox();
|
||||
this.numBlock = new System.Windows.Forms.NumericUpDown();
|
||||
this.label2 = new System.Windows.Forms.Label();
|
||||
this.label3 = new System.Windows.Forms.Label();
|
||||
((System.ComponentModel.ISupportInitialize)(this.numBlock)).BeginInit();
|
||||
this.SuspendLayout();
|
||||
//
|
||||
// btnExport
|
||||
//
|
||||
this.btnExport.Location = new System.Drawing.Point(343, 469);
|
||||
this.btnExport.Name = "btnExport";
|
||||
this.btnExport.Size = new System.Drawing.Size(80, 40);
|
||||
this.btnExport.TabIndex = 0;
|
||||
this.btnExport.Text = "Export";
|
||||
this.btnExport.UseVisualStyleBackColor = true;
|
||||
this.btnExport.Click += new System.EventHandler(this.btnExport_Click);
|
||||
//
|
||||
// btnImport
|
||||
//
|
||||
this.btnImport.Location = new System.Drawing.Point(429, 469);
|
||||
this.btnImport.Name = "btnImport";
|
||||
this.btnImport.Size = new System.Drawing.Size(80, 40);
|
||||
this.btnImport.TabIndex = 1;
|
||||
this.btnImport.Text = "Import";
|
||||
this.btnImport.UseVisualStyleBackColor = true;
|
||||
this.btnImport.Click += new System.EventHandler(this.btnImport_Click);
|
||||
//
|
||||
// label1
|
||||
//
|
||||
this.label1.AutoSize = true;
|
||||
this.label1.Location = new System.Drawing.Point(3, 0);
|
||||
this.label1.Name = "label1";
|
||||
this.label1.Size = new System.Drawing.Size(31, 13);
|
||||
this.label1.TabIndex = 2;
|
||||
this.label1.Text = "Text:";
|
||||
//
|
||||
// txtBlock
|
||||
//
|
||||
this.txtBlock.Location = new System.Drawing.Point(3, 16);
|
||||
this.txtBlock.Multiline = true;
|
||||
this.txtBlock.Name = "txtBlock";
|
||||
this.txtBlock.ReadOnly = true;
|
||||
this.txtBlock.Size = new System.Drawing.Size(506, 326);
|
||||
this.txtBlock.TabIndex = 3;
|
||||
//
|
||||
// numBlock
|
||||
//
|
||||
this.numBlock.Location = new System.Drawing.Point(82, 348);
|
||||
this.numBlock.Maximum = new decimal(new int[] {
|
||||
65535,
|
||||
0,
|
||||
0,
|
||||
0});
|
||||
this.numBlock.Name = "numBlock";
|
||||
this.numBlock.Size = new System.Drawing.Size(60, 20);
|
||||
this.numBlock.TabIndex = 4;
|
||||
this.numBlock.ValueChanged += new System.EventHandler(this.numBlock_ValueChanged);
|
||||
//
|
||||
// label2
|
||||
//
|
||||
this.label2.AutoSize = true;
|
||||
this.label2.Location = new System.Drawing.Point(3, 350);
|
||||
this.label2.Name = "label2";
|
||||
this.label2.Size = new System.Drawing.Size(73, 13);
|
||||
this.label2.TabIndex = 5;
|
||||
this.label2.Text = "Current block:";
|
||||
//
|
||||
// label3
|
||||
//
|
||||
this.label3.AutoSize = true;
|
||||
this.label3.Location = new System.Drawing.Point(148, 350);
|
||||
this.label3.Name = "label3";
|
||||
this.label3.Size = new System.Drawing.Size(25, 13);
|
||||
this.label3.TabIndex = 6;
|
||||
this.label3.Text = "of 0";
|
||||
//
|
||||
// TextControl
|
||||
//
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||
this.Controls.Add(this.label3);
|
||||
this.Controls.Add(this.label2);
|
||||
this.Controls.Add(this.numBlock);
|
||||
this.Controls.Add(this.txtBlock);
|
||||
this.Controls.Add(this.label1);
|
||||
this.Controls.Add(this.btnImport);
|
||||
this.Controls.Add(this.btnExport);
|
||||
this.Name = "TextControl";
|
||||
this.Size = new System.Drawing.Size(512, 512);
|
||||
((System.ComponentModel.ISupportInitialize)(this.numBlock)).EndInit();
|
||||
this.ResumeLayout(false);
|
||||
this.PerformLayout();
|
||||
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
private System.Windows.Forms.Button btnExport;
|
||||
private System.Windows.Forms.Button btnImport;
|
||||
private System.Windows.Forms.Label label1;
|
||||
private System.Windows.Forms.TextBox txtBlock;
|
||||
private System.Windows.Forms.NumericUpDown numBlock;
|
||||
private System.Windows.Forms.Label label2;
|
||||
private System.Windows.Forms.Label label3;
|
||||
}
|
||||
}
|
158
Plugins/NINOKUNI/NINOKUNI/Text/TextControl.cs
Normal file
158
Plugins/NINOKUNI/NINOKUNI/Text/TextControl.cs
Normal file
@ -0,0 +1,158 @@
|
||||
// ----------------------------------------------------------------------
|
||||
// <copyright file="TextControl.cs" company="none">
|
||||
|
||||
// Copyright (C) 2012
|
||||
//
|
||||
// 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
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
//
|
||||
// </copyright>
|
||||
|
||||
// <author>pleoNeX</author>
|
||||
// <email>benito356@gmail.com</email>
|
||||
// <date>28/08/2012 12:18:58</date>
|
||||
// -----------------------------------------------------------------------
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Drawing;
|
||||
using System.Data;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Windows.Forms;
|
||||
using Ekona;
|
||||
|
||||
namespace NINOKUNI.Text
|
||||
{
|
||||
public partial class TextControl : UserControl
|
||||
{
|
||||
// To support a new file create the class and add it to Create_IText
|
||||
IText itext;
|
||||
IPluginHost pluginHost;
|
||||
string[] text;
|
||||
int id;
|
||||
string fileName;
|
||||
|
||||
public TextControl()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
public TextControl(IPluginHost pluginHost, sFile file)
|
||||
{
|
||||
if (!IsSupported(file.id))
|
||||
throw new NotSupportedException();
|
||||
|
||||
InitializeComponent();
|
||||
this.pluginHost = pluginHost;
|
||||
this.id = file.id;
|
||||
this.fileName = System.IO.Path.GetFileNameWithoutExtension(file.name);
|
||||
|
||||
itext = Create_IText(id);
|
||||
itext.Read(file.path);
|
||||
text = itext.Get_Text();
|
||||
|
||||
numBlock.Maximum = text.Length - 1;
|
||||
label3.Text = "of " + numBlock.Maximum.ToString();
|
||||
numBlock_ValueChanged(null, null);
|
||||
}
|
||||
|
||||
public static IText Create_IText(int id)
|
||||
{
|
||||
IText it = null;
|
||||
switch (id)
|
||||
{
|
||||
case 0x69: it = new BattleHelp(); break;
|
||||
case 0x243F: it = new StageInfoData(); break;
|
||||
case 0x2A8D: it = new DownloadParam(); break;
|
||||
case 0x2A8E: it = new DungeonList(); break;
|
||||
|
||||
case 0x6A: it = new BlockText(true, false, false, 0x30, 0x50, "DebugBattleSettings"); break;
|
||||
case 0x2A94: it = new BlockText(false, false, false, 0x40, 0, "ImagenArea"); break;
|
||||
case 0x2A95: it = new BlockText(false, false, true, 0x08, 0, "ImagenName"); break;
|
||||
case 0x2A96: it = new BlockText(true, true, true, 0x10, 0xA4, "ImagenParam"); break;
|
||||
case 0x2A97: it = new BlockText(false, false, false, 0x100, 0, "ImagenText"); break;
|
||||
case 0x2A98: it = new BlockText(false, false, false, 0x72, 0, "EquipGetInfo"); break;
|
||||
case 0x2A99: it = new BlockText(false, false, false, 0xC4, 0, "EquipItemInfo"); break;
|
||||
case 0x2A9A: it = new BlockText(false, false, false, 0x51, 0, "EquipItemLinkInfo"); break;
|
||||
case 0x2A9B: it = new BlockText(true, true, true, 0x20, 0x30, "EquipItemParam"); break;
|
||||
case 0x2A9C: it = new BlockText(false, false, false, 0x72, 0, "ItemGetInfo"); break;
|
||||
case 0x2A9D: it = new BlockText(false, false, false, 0xC4, 0, "ItemInfo"); break;
|
||||
case 0x2A9E: it = new BlockText(false, false, false, 0x51, 0, "ItemLinkInfo"); break;
|
||||
case 0x2A9F: it = new BlockText(true, true, true, 0x20, 0x4C, "ItemParam"); break;
|
||||
case 0x2AA0: it = new BlockText(false, false, false, 0x72, 0, "SpItemGetInfo"); break;
|
||||
case 0x2AA1: it = new BlockText(false, false, false, 0xC4, 0, "SpItemInfo"); break;
|
||||
case 0x2AA2: it = new BlockText(true, true, true, 0x20, 0x10, "SpItemParam"); break;
|
||||
case 0x2AA3: it = new BlockText(true, false, false, 0xC4, 0, "MagicInfo"); break;
|
||||
case 0x2AA4: it = new BlockText(true, false, true, 0x12, 0x2E, "MagicParam"); break;
|
||||
case 0x2AA6: it = new BlockText(true, false, true, 0x11, 0x2C, "PlayerName"); break;
|
||||
case 0x2AAB: it = new BlockText(true, false, false, 0xC4, 0, "SkillInfo"); break;
|
||||
case 0x2AAC: it = new BlockText(true, false, true, 0x12, 0x2A, "SkillParam"); break;
|
||||
|
||||
default: it = null; break;
|
||||
}
|
||||
return it;
|
||||
}
|
||||
public static bool IsSupported(int id)
|
||||
{
|
||||
if (Create_IText(id) == null)
|
||||
return false;
|
||||
else
|
||||
return true;
|
||||
}
|
||||
|
||||
private void numBlock_ValueChanged(object sender, EventArgs e)
|
||||
{
|
||||
txtBlock.Text = text[(int)numBlock.Value].Replace("\n", "\r\n");
|
||||
}
|
||||
|
||||
private void btnExport_Click(object sender, EventArgs e)
|
||||
{
|
||||
SaveFileDialog o = new SaveFileDialog();
|
||||
o.AddExtension = true;
|
||||
o.DefaultExt = ".xml";
|
||||
o.Filter = "eXtensive Markup Language (*.xml)|*.xml";
|
||||
o.FileName = fileName + ".xml";
|
||||
if (o.ShowDialog() != DialogResult.OK)
|
||||
return;
|
||||
|
||||
itext.Export(o.FileName);
|
||||
|
||||
o.Dispose();
|
||||
o = null;
|
||||
}
|
||||
private void btnImport_Click(object sender, EventArgs e)
|
||||
{
|
||||
OpenFileDialog o = new OpenFileDialog();
|
||||
o.AddExtension = true;
|
||||
o.DefaultExt = ".xml";
|
||||
o.Filter = "eXtensive Markup Language (*.xml)|*.xml";
|
||||
o.FileName = fileName + ".xml";
|
||||
if (o.ShowDialog() != DialogResult.OK)
|
||||
return;
|
||||
|
||||
itext.Import(o.FileName);
|
||||
|
||||
string outFile = pluginHost.Get_TempFile();
|
||||
itext.Write(outFile);
|
||||
pluginHost.ChangeFile(id, outFile);
|
||||
|
||||
o.Dispose();
|
||||
o = null;
|
||||
|
||||
text = itext.Get_Text();
|
||||
numBlock.Maximum = text.Length - 1;
|
||||
label3.Text = "of " + numBlock.Maximum.ToString();
|
||||
numBlock_ValueChanged(null, null);
|
||||
}
|
||||
}
|
||||
}
|
120
Plugins/NINOKUNI/NINOKUNI/Text/TextControl.resx
Normal file
120
Plugins/NINOKUNI/NINOKUNI/Text/TextControl.resx
Normal file
@ -0,0 +1,120 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<root>
|
||||
<!--
|
||||
Microsoft ResX Schema
|
||||
|
||||
Version 2.0
|
||||
|
||||
The primary goals of this format is to allow a simple XML format
|
||||
that is mostly human readable. The generation and parsing of the
|
||||
various data types are done through the TypeConverter classes
|
||||
associated with the data types.
|
||||
|
||||
Example:
|
||||
|
||||
... ado.net/XML headers & schema ...
|
||||
<resheader name="resmimetype">text/microsoft-resx</resheader>
|
||||
<resheader name="version">2.0</resheader>
|
||||
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
|
||||
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
|
||||
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
|
||||
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
|
||||
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
|
||||
<value>[base64 mime encoded serialized .NET Framework object]</value>
|
||||
</data>
|
||||
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
|
||||
<comment>This is a comment</comment>
|
||||
</data>
|
||||
|
||||
There are any number of "resheader" rows that contain simple
|
||||
name/value pairs.
|
||||
|
||||
Each data row contains a name, and value. The row also contains a
|
||||
type or mimetype. Type corresponds to a .NET class that support
|
||||
text/value conversion through the TypeConverter architecture.
|
||||
Classes that don't support this are serialized and stored with the
|
||||
mimetype set.
|
||||
|
||||
The mimetype is used for serialized objects, and tells the
|
||||
ResXResourceReader how to depersist the object. This is currently not
|
||||
extensible. For a given mimetype the value must be set accordingly:
|
||||
|
||||
Note - application/x-microsoft.net.object.binary.base64 is the format
|
||||
that the ResXResourceWriter will generate, however the reader can
|
||||
read any of the formats listed below.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.binary.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.soap.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.bytearray.base64
|
||||
value : The object must be serialized into a byte array
|
||||
: using a System.ComponentModel.TypeConverter
|
||||
: and then encoded with base64 encoding.
|
||||
-->
|
||||
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
||||
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
|
||||
<xsd:element name="root" msdata:IsDataSet="true">
|
||||
<xsd:complexType>
|
||||
<xsd:choice maxOccurs="unbounded">
|
||||
<xsd:element name="metadata">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" use="required" type="xsd:string" />
|
||||
<xsd:attribute name="type" type="xsd:string" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="assembly">
|
||||
<xsd:complexType>
|
||||
<xsd:attribute name="alias" type="xsd:string" />
|
||||
<xsd:attribute name="name" type="xsd:string" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="data">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
|
||||
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="resheader">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:choice>
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:schema>
|
||||
<resheader name="resmimetype">
|
||||
<value>text/microsoft-resx</value>
|
||||
</resheader>
|
||||
<resheader name="version">
|
||||
<value>2.0</value>
|
||||
</resheader>
|
||||
<resheader name="reader">
|
||||
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<resheader name="writer">
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
</root>
|
@ -62,6 +62,8 @@ namespace Tinke
|
||||
pluginHost.event_SearchFile2 += new Func<int, sFile>(SearchSave_File);
|
||||
pluginHost.event_PluginList += new Func<string[]>(Get_PluginsList);
|
||||
pluginHost.event_CallPlugin += new Func<string[],int,int,object>(Call_Plugin);
|
||||
pluginHost.event_SearchFolder += new Func<int, sFolder>(Search_Folder);
|
||||
pluginHost.event_SearchFileN += new Func<string, sFolder>(Search_FileName);
|
||||
Load_Plugins();
|
||||
}
|
||||
public void Dispose()
|
||||
|
@ -98,6 +98,19 @@ namespace Tinke.Nitro
|
||||
return overlays;
|
||||
}
|
||||
|
||||
public static void Write_Y9(BinaryWriter bw, BinaryReader br, sFile[] overlays)
|
||||
{
|
||||
for (int i = 0; i < overlays.Length; i++)
|
||||
{
|
||||
bw.Write(br.ReadBytes(0x1C));
|
||||
byte[] d = BitConverter.GetBytes(overlays[i].size);
|
||||
bw.Write(d[0]);
|
||||
bw.Write(d[1]);
|
||||
bw.Write(d[2]);
|
||||
br.BaseStream.Position += 3;
|
||||
bw.Write(br.ReadByte());
|
||||
}
|
||||
}
|
||||
|
||||
public static void EscribirOverlays(string salida, List<sFile> overlays, string romFile)
|
||||
{
|
||||
|
@ -99,11 +99,14 @@ namespace Tinke
|
||||
public String Search_File(int id) { return event_SearchFile(id); }
|
||||
public event Func<int, sFile> event_SearchFile2;
|
||||
public sFile Search_File(short id) { return event_SearchFile2(id); }
|
||||
public event Func<string, sFolder> event_SearchFileN;
|
||||
public sFolder Search_File(string name) { return event_SearchFileN(name); }
|
||||
public Byte[] Get_Bytes(string path, int offset, int length)
|
||||
{
|
||||
return Tools.Helper.Get_Bytes(offset, length, path);
|
||||
}
|
||||
|
||||
public event Func<int, sFolder> event_SearchFolder;
|
||||
public sFolder Search_Folder(int id) { return event_SearchFolder(id); }
|
||||
|
||||
public string Get_LanguageFolder()
|
||||
{
|
||||
@ -138,10 +141,11 @@ namespace Tinke
|
||||
}
|
||||
public void Decompress(byte[] data)
|
||||
{
|
||||
string temp = System.IO.Path.GetTempFileName();
|
||||
string temp = Get_TempFile();
|
||||
System.IO.File.WriteAllBytes(temp, data);
|
||||
DescompressEvent(temp);
|
||||
System.IO.File.Delete(temp);
|
||||
try { System.IO.File.Delete(temp); }
|
||||
catch { }
|
||||
}
|
||||
public void Compress(string filein, string fileout, FormatCompress format) { DSDecmp.Main.Compress(filein, fileout, format); }
|
||||
|
||||
|
@ -1432,7 +1432,7 @@ namespace Tinke
|
||||
// ARM9 Overlays Tables
|
||||
br = new BinaryReader(File.OpenRead(y9.path));
|
||||
br.BaseStream.Position = y9.offset;
|
||||
bw.Write(br.ReadBytes((int)y9.size));
|
||||
Nitro.Overlay.Write_Y9(bw, br, ov9.ToArray());
|
||||
bw.Flush();
|
||||
br.Close();
|
||||
header.ARM9overlayOffset = currPos;
|
||||
|
Loading…
Reference in New Issue
Block a user