+.+ Change name "PluginInterface" to "Ekona"

+.+ Clean code from Ekona, Tinke and some plugins
** Change IGamePlugin and IPlugin interface.
* Fixed problem with the batch compiler
* Improved autosize in RawImages
* Fixed problem importing Horizontal images without map
* Added Import button in Palette control
* Fixed problem in 999 plugin with cha sprite images
* Fixed problem with AnimationControl when no animation
This commit is contained in:
Benito Palacios 2012-07-04 01:38:33 +00:00
parent 92809a47ac
commit 34e4eefe31
255 changed files with 3440 additions and 4194 deletions

View File

@ -16,8 +16,8 @@ IF errorlevel 2 goto start
RMDIR /S /Q "%cd%\build" RMDIR /S /Q "%cd%\build"
REM Create the plugin DLL needed for the plugins (pluginInterface) REM Create the plugin DLL needed for the plugins (Ekona)
%windir%\microsoft.net\framework\v4.0.30319\msbuild Tinke.sln /v:minimal /p:Configuration=%conf%;TarjetFrameworkVersion=v3.5 "/p:Platform=%plat%" %windir%\microsoft.net\framework\v4.0.30319\msbuild Tinke.sln /v:minimal /p:Configuration=Debug;TarjetFrameworkVersion=v3.5 "/p:Platform=%plat%"
REM Compiling program REM Compiling program
%windir%\microsoft.net\framework\v4.0.30319\msbuild Tinke.sln /v:minimal /p:Configuration=%conf%;TarjetFrameworkVersion=v3.5 "/p:Platform=%plat%" "/p:OutputPath=%CD%\build\" %windir%\microsoft.net\framework\v4.0.30319\msbuild Tinke.sln /v:minimal /p:Configuration=%conf%;TarjetFrameworkVersion=v3.5 "/p:Platform=%plat%" "/p:OutputPath=%CD%\build\"

View File

@ -22,8 +22,8 @@ IF /I "%ans%"=="N" (GOTO start
RMDIR /S /Q "%cd%\build" RMDIR /S /Q "%cd%\build"
REM Create the plugin DLL needed for the plugins (pluginInterface) REM Create the plugin DLL needed for the plugins (Ekona)
%windir%\microsoft.net\framework\v4.0.30319\msbuild Tinke.sln /v:minimal /p:Configuration=%conf%;TarjetFrameworkVersion=v3.5 "/p:Platform=%plat%" %windir%\microsoft.net\framework\v4.0.30319\msbuild Tinke.sln /v:minimal /p:Configuration=Debug;TarjetFrameworkVersion=v3.5 "/p:Platform=%plat%"
REM Compiling program REM Compiling program
%windir%\microsoft.net\framework\v4.0.30319\msbuild Tinke.sln /v:minimal /p:Configuration=%conf%;TarjetFrameworkVersion=v3.5 "/p:Platform=%plat%" "/p:OutputPath=%CD%\build\" %windir%\microsoft.net\framework\v4.0.30319\msbuild Tinke.sln /v:minimal /p:Configuration=%conf%;TarjetFrameworkVersion=v3.5 "/p:Platform=%plat%" "/p:OutputPath=%CD%\build\"

View File

@ -8,8 +8,8 @@
<ProjectGuid>{736010D3-F72F-4C56-B8D2-2EDD1B8F3A87}</ProjectGuid> <ProjectGuid>{736010D3-F72F-4C56-B8D2-2EDD1B8F3A87}</ProjectGuid>
<OutputType>Library</OutputType> <OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder> <AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>PluginInterface</RootNamespace> <RootNamespace>Ekona</RootNamespace>
<AssemblyName>PluginInterface</AssemblyName> <AssemblyName>Ekona</AssemblyName>
<TargetFrameworkVersion>v3.5</TargetFrameworkVersion> <TargetFrameworkVersion>v3.5</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment> <FileAlignment>512</FileAlignment>
<AllowUnsafeBlocks>False</AllowUnsafeBlocks> <AllowUnsafeBlocks>False</AllowUnsafeBlocks>
@ -54,8 +54,11 @@
<ItemGroup> <ItemGroup>
<Compile Include="Helper\BinaryReaderBE.cs" /> <Compile Include="Helper\BinaryReaderBE.cs" />
<Compile Include="Helper\BinaryWriterBE.cs" /> <Compile Include="Helper\BinaryWriterBE.cs" />
<Compile Include="Helper\BitsConverter.cs" />
<Compile Include="Helper\CRC.cs" />
<Compile Include="Images\Actions.cs" /> <Compile Include="Images\Actions.cs" />
<Compile Include="Images\Formats\ACO.cs" /> <Compile Include="Images\Formats\ACO.cs" />
<Compile Include="Images\Formats\APNG.cs" />
<Compile Include="Images\Formats\Bitmap.cs" /> <Compile Include="Images\Formats\Bitmap.cs" />
<Compile Include="Images\Dialogs\OAMEditor.cs"> <Compile Include="Images\Dialogs\OAMEditor.cs">
<SubType>Form</SubType> <SubType>Form</SubType>

View File

@ -26,7 +26,7 @@ using System;
using System.Linq; using System.Linq;
using System.IO; using System.IO;
namespace PluginInterface.Helper namespace Ekona.Helper
{ {
// Not finished // Not finished
public class BinaryReaderBE : BinaryReader public class BinaryReaderBE : BinaryReader

View File

@ -26,7 +26,7 @@ using System;
using System.Linq; using System.Linq;
using System.IO; using System.IO;
namespace PluginInterface.Helper namespace Ekona.Helper
{ {
// Not finished // Not finished
public class BinaryWriterBE : BinaryWriter public class BinaryWriterBE : BinaryWriter

View File

@ -0,0 +1,133 @@
// ----------------------------------------------------------------------
// <copyright file="BitConverter.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>24/06/2012 14:28:44</date>
// -----------------------------------------------------------------------
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace Ekona.Helper
{
public static class BitsConverter
{
// From Byte
public static Byte[] ByteToBits(Byte data)
{
List<Byte> bits = new List<byte>();
for (int j = 7; j >= 0; j--)
bits.Add((byte)((data >> j) & 1));
return bits.ToArray();
}
public static Byte[] ByteToBit2(Byte data)
{
Byte[] bit2 = new byte[4];
bit2[0] = (byte)(data & 0x3);
bit2[1] = (byte)((data >> 2) & 0x3);
bit2[2] = (byte)((data >> 4) & 0x3);
bit2[3] = (byte)((data >> 6) & 0x3);
return bit2;
}
public static Byte[] ByteToBit4(Byte data)
{
Byte[] bit4 = new Byte[2];
bit4[0] = (byte)(data & 0x0F);
bit4[1] = (byte)((data & 0xF0) >> 4);
return bit4;
}
public static Byte[] BytesToBit4(Byte[] data)
{
byte[] bit4 = new byte[data.Length * 2];
for (int i = 0; i < data.Length; i++)
{
byte[] b4 = ByteToBit4(data[i]);
bit4[i * 2] = b4[0];
bit4[i * 2 + 1] = b4[1];
}
return bit4;
}
public static String BytesToHexString(Byte[] bytes)
{
string result = "";
for (int i = 0; i < bytes.Length; i++)
result += String.Format("{0:X}", bytes[i]);
return result;
}
// To Byte
public static Byte[] BitsToBytes(Byte[] bits)
{
List<Byte> bytes = new List<byte>();
for (int i = 0; i < bits.Length; i += 8)
{
Byte newByte = 0;
int b = 0;
for (int j = 7; j >= 0; j--, b++)
{
newByte += (byte)(bits[i + b] << j);
}
bytes.Add(newByte);
}
return bytes.ToArray();
}
public static Byte Bit4ToByte(Byte[] data)
{
return (byte)(data[0] + (data[1] << 4));
}
public static Byte Bit4ToByte(Byte b1, Byte b2)
{
return (byte)(b1 + (b2 << 4));
}
public static Byte[] Bits4ToByte(Byte[] data)
{
byte[] b = new byte[data.Length / 2];
for (int i = 0; i < data.Length; i += 2)
b[i / 2] = Bit4ToByte(data[i], data[i + 1]);
return b;
}
public static Byte[] StringToBytes(String text, int num_bytes)
{
string hexText = text.Replace("-", "");
hexText = hexText.PadRight(num_bytes * 2, '0');
List<Byte> hex = new List<byte>();
for (int i = 0; i < hexText.Length; i += 2)
hex.Add(Convert.ToByte(hexText.Substring(i, 2), 16));
return hex.ToArray();
}
}
}

View File

@ -1,35 +1,37 @@
/* // ----------------------------------------------------------------------
* Copyright (C) 2011 pleoNeX // <copyright file="CRC.cs" company="none">
*
* This program is free software: you can redistribute it and/or modify // Copyright (C) 2012
* it under the terms of the GNU General Public License as published by //
* the Free Software Foundation, either version 3 of the License, or // This program is free software: you can redistribute it and/or modify
* (at your option) any later version. // it under the terms of the GNU General Public License as published by
* // the Free Software Foundation, either version 3 of the License, or
* This program is distributed in the hope that it will be useful, // (at your option) any later version.
* but WITHOUT ANY WARRANTY; without even the implied warranty of //
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // This program is distributed in the hope that it will be useful,
* GNU General Public License for more details. // but WITHOUT ANY WARRANTY; without even the implied warranty of
* // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* You should have received a copy of the GNU General Public License // GNU General Public License for more details.
* along with this program. If not, see <http://www.gnu.org/licenses/>. //
* // You should have received a copy of the GNU General Public License
* Programador: pleoNeX // along with this program. If not, see <http://www.gnu.org/licenses/>.
* Programa utilizado: Microsoft Visual C# 2010 Express //
* Fecha: 28/06/2011 // </copyright>
*
*/ // <author>pleoNeX</author>
// <email>benito356@gmail.com</email>
// <date>24/06/2012 14:45:49</date>
// -----------------------------------------------------------------------
using System; using System;
using System.Collections; using System.Collections;
using System.IO; using System.IO;
using System.Security.Cryptography;
using System.Text; using System.Text;
namespace Tinke.Tools namespace Ekona.Helper
{ {
public static class CRC16 public static class CRC16
{ {
public static UInt32 Calcular(byte[] bytes, UInt32 init = 0xFFFF) public static UInt32 Calculate(byte[] bytes, UInt32 init = 0xFFFF)
{ {
UInt32 crc = init; UInt32 crc = init;
@ -80,10 +82,10 @@ namespace Tinke.Tools
public static class CRC32 public static class CRC32
{ {
// Obtenido de: http://www.codeproject.com/KB/cs/PngUtil.aspx gracias a Paul Young // Code from: http://www.codeproject.com/KB/cs/PngUtil.aspx credits to Paul Young
/// <summary> /// <summary>
/// Crea la tabla CRC para calcular el CRC de 32-bit /// Create the CRC-32 table
/// </summary> /// </summary>
private static void CreateCrcTable() private static void CreateCrcTable()
{ {
@ -114,11 +116,11 @@ namespace Tinke.Tools
static bool IsTableCreated = false; static bool IsTableCreated = false;
/// <summary> /// <summary>
/// Calcula el CRC del buffer /// Calculate the CRC from the buffer
/// </summary> /// </summary>
/// <param name="buffer">Los datos con los que se calcula el CRC</param> /// <param name="buffer">Data to calculate the CRC32</param>
/// <returns>Array de 4-bytes con el resultado</returns> /// <returns>4 bytes with the CRC32 code</returns>
public static byte[] Calcular(byte[] buffer) public static byte[] Calculate(byte[] buffer)
{ {
uint data = 0xFFFFFFFF; uint data = 0xFFFFFFFF;
int n; int n;

88
Ekona/IGamePlugin.cs Normal file
View File

@ -0,0 +1,88 @@
// ----------------------------------------------------------------------
// <copyright file="IGamePlugin.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>24/06/2012 15:01:36</date>
// -----------------------------------------------------------------------
using System.Windows.Forms;
namespace Ekona
{
/// <summary>
/// Inteface to support one or more games
/// </summary>
public interface IGamePlugin
{
/// <summary>
/// First method to be called.
/// <param name="pluginHost">Class with common and necessary methods</param>
/// <param name="gameCode">String with the game code</param>
void Initialize(IPluginHost pluginHost, string gameCode);
/// <summary>
/// It returns if this game is compatible using the game code
/// </summary>
/// <returns>True or false</returns>
bool IsCompatible();
/// <summary>
/// Get the file format
/// </summary>
/// <param name="file">
/// File info.
/// Normally, the path value will be the rom file.
/// </param>
/// <param name="magic">First four bytes of the file</param>
/// <returns>File format</returns>
Format Get_Format(sFile file, byte[] magic);
/// <summary>
/// This method is called when the user click on button "view", it will return a control with the file information
/// </summary>
/// <param name="file">File to analyze. It's not the same variable as used internally.</param>
/// <returns>Control that will be displayed</returns>
Control Show_Info(sFile file);
/// <summary>
/// This method will be called when the user double click a file.
/// It's used for a fast reading,
/// ie: double click the palette file instead of click on the button View if you want to see the next image.
/// It should call the methods Set_Palette, Set_Image, Set_Map.... in pluginHost.
/// </summary>
/// <param name="file">File to analyze. It's not the same variable as used internally.</param>
void Read(sFile file);
/// <summary>
/// It will be called when the user click on button "Unpack".
/// </summary>
/// <param name="file">File to unpack. It's not the same variable as used internally.</param>
/// <returns>sFolder variable with files to show in the tree interface</returns>
sFolder Unpack(sFile file);
/// <summary>
/// It will be called when the user click on button "Pack"
/// </summary>
/// <param name="unpacked">sFolder variable with all the unpacked files to pack</param>
/// <param name="file">Original pack file. It's not the same variable as used internally.</param>
/// <returns>Path where the new pack file is</returns>
string Pack(ref sFolder unpacked, sFile file);
}
}

82
Ekona/IPlugin.cs Normal file
View File

@ -0,0 +1,82 @@
// ----------------------------------------------------------------------
// <copyright file="IPlugin.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>24/06/2012 15:01:47</date>
// -----------------------------------------------------------------------
using System.Windows.Forms;
namespace Ekona
{
/// <summary>
/// IPlugin interface to support a file format
/// </summary>
public interface IPlugin
{
/// <summary>
/// First method to be called. It passes the class IPluginHost
/// </summary>
/// <param name="pluginHost">Class with common and necessary methods</param>
void Initialize(IPluginHost pluginHost);
/// <summary>
/// Get the file format
/// </summary>
/// <param name="file">
/// File info. It's the same variable as used internally.
/// Normally, the path value will be the rom file.
/// </param>
/// <param name="magic">First four bytes of the file</param>
/// <returns>File format</returns>
Format Get_Format(sFile file, byte[] magic);
/// <summary>
/// This method is called when the user click on button "view", it will return a control with the file information
/// </summary>
/// <param name="file">File to analyze. It's not the same variable as used internally.</param>
/// <returns>Control that will be displayed</returns>
Control Show_Info(sFile file);
/// <summary>
/// This methos will be called when the user double click a file.
/// It's used for a fast reading,
/// ie: double click the palette file instead of click on the button View if you want to see the next image.
/// It should call the methods Set_Palette, Set_Image, Set_Sprite.... in pluginHost.
/// </summary>
/// <param name="file">File to analyze. It's not the same variable as used internally.</param>
void Read(sFile file);
/// <summary>
/// It will be called when the user click on button "Unpack".
/// </summary>
/// <param name="file">File to unpack. It's not the same variable as used internally.</param>
/// <returns>sFolder variable with files to show in the tree interface</returns>
sFolder Unpack(sFile file);
/// <summary>
/// It will be called when the user click on button "Pack"
/// </summary>
/// <param name="unpacked">sFolder variable with all the unpacked files to pack</param>
/// <param name="file">Original pack file. It's not the same variable as used internally.</param>
/// <returns>Path where the new pack file is</returns>
string Pack(ref sFolder unpacked, sFile file);
}
}

View File

@ -22,9 +22,9 @@ using System.Collections.Generic;
using System.Linq; using System.Linq;
using System.Text; using System.Text;
using System.Drawing; using System.Drawing;
using PluginInterface.Images; using Ekona.Images;
namespace PluginInterface namespace Ekona
{ {
public interface IPluginHost public interface IPluginHost
{ {
@ -41,20 +41,6 @@ namespace PluginInterface
void Set_Palette(PaletteBase palette); void Set_Palette(PaletteBase palette);
void Set_Map(MapBase map); void Set_Map(MapBase map);
void Set_Sprite(SpriteBase sprite); void Set_Sprite(SpriteBase sprite);
Byte[][] MergeImage(Byte[][] originalTile, Byte[][] newTiles, int startTile);
Color[][] Palette_4bppTo8bpp(Color[][] palette);
Color[][] Palette_8bppTo4bpp(Color[][] palette);
Bitmap Bitmaps_NCLR(Color[] colors);
Bitmap Bitmap_NTFT(NTFT tiles, Color[][] palette, TileForm tileOrder, int startTile, int tilesX, int tilesY, int zoom = 1);
Size Get_OAMSize(byte byte1, byte byte2);
Byte[] BytesToBits(byte[] bytes);
Byte[] BitsToBytes(byte[] bits);
Byte[] Bit4ToBit8(byte[] bits4);
Byte[] Bit8ToBit4(byte[] bits8);
string[] PluginList(); string[] PluginList();
Object Call_Plugin(string[] param, int id, int action); Object Call_Plugin(string[] param, int id, int action);
@ -69,11 +55,14 @@ namespace PluginInterface
string Get_Language(); string Get_Language();
string Get_LangXML(); string Get_LangXML();
string Get_LanguageFolder();
string Get_TempFile();
string Get_TempFolder(); string Get_TempFolder();
void Set_TempFolder(string newPath); void Set_TempFolder(string newPath);
void Restore_TempFolder(); void Restore_TempFolder();
void Decompress(string file); void Decompress(string file);
void Decompress(byte[] data); void Decompress(byte[] data);
void Compress(string filein, string fileout, FormatCompress format); void Compress(string filein, string fileout, FormatCompress format);
@ -84,15 +73,5 @@ namespace PluginInterface
/// <param name="id">The id of the file to change</param> /// <param name="id">The id of the file to change</param>
/// <param name="newFile">The path where the new file is</param> /// <param name="newFile">The path where the new file is</param>
void ChangeFile(int id, string newFile); void ChangeFile(int id, string newFile);
/// <summary>
/// Save an animation in a APNG file (Firefox supported)
/// </summary>
/// <param name="salida">The path of the output file</param>
/// <param name="frames">All frames (path of files or bitmaps)</param>
/// <param name="delay">The delay between frames (delay/1000)</param>
/// <param name="loops">The number of loops (if 0 = infinite)</param>
void Create_APNG(string outFile, Bitmap[] frames, int delay, int loops);
void Create_APNG(string outFile, String[] frames, int delay, int loops);
} }
} }

View File

@ -25,7 +25,7 @@ using System.Drawing;
using System.Runtime.InteropServices; using System.Runtime.InteropServices;
using System.Drawing.Imaging; using System.Drawing.Imaging;
namespace PluginInterface.Images namespace Ekona.Images
{ {
public enum TileForm public enum TileForm
@ -404,7 +404,7 @@ namespace PluginInterface.Images
case ColorFormat.colors2: case ColorFormat.colors2:
if (data.Length <= (pos / 8)) break; if (data.Length <= (pos / 8)) break;
byte bit1 = data[pos / 8]; byte bit1 = data[pos / 8];
index = ByteToBits(bit1)[pos % 8]; index = Helper.BitsConverter.ByteToBits(bit1)[pos % 8];
if (palette.Length > index) if (palette.Length > index)
color = palette[index]; color = palette[index];
pos++; pos++;
@ -412,7 +412,7 @@ namespace PluginInterface.Images
case ColorFormat.colors4: case ColorFormat.colors4:
if (data.Length <= (pos / 4)) break; if (data.Length <= (pos / 4)) break;
byte bit2 = data[pos / 4]; byte bit2 = data[pos / 4];
index = ByteToBit2(bit2)[pos % 4]; index = Helper.BitsConverter.ByteToBit2(bit2)[pos % 4];
if (palette.Length > index) if (palette.Length > index)
color = palette[index]; color = palette[index];
pos++; pos++;
@ -420,7 +420,7 @@ namespace PluginInterface.Images
case ColorFormat.colors16: case ColorFormat.colors16:
if (data.Length <= (pos / 2)) break; if (data.Length <= (pos / 2)) break;
byte bit4 = data[pos / 2]; byte bit4 = data[pos / 2];
index = ByteToBit4(bit4)[pos % 2]; index = Helper.BitsConverter.ByteToBit4(bit4)[pos % 2];
if (palette.Length > index) if (palette.Length > index)
color = palette[index]; color = palette[index];
pos++; pos++;
@ -516,65 +516,6 @@ namespace PluginInterface.Images
return horizontal; return horizontal;
} }
public static Byte[] ByteToBits(Byte data)
{
List<Byte> bits = new List<byte>();
for (int j = 7; j >= 0; j--)
bits.Add((byte)((data >> j) & 1));
return bits.ToArray();
}
public static Byte[] ByteToBit2(Byte data)
{
Byte[] bit2 = new byte[4];
bit2[0] = (byte)(data & 0x3);
bit2[1] = (byte)((data >> 2) & 0x3);
bit2[2] = (byte)((data >> 4) & 0x3);
bit2[3] = (byte)((data >> 6) & 0x3);
return bit2;
}
public static Byte[] ByteToBit4(Byte data)
{
Byte[] bit4 = new Byte[2];
bit4[0] = (byte)(data & 0x0F);
bit4[1] = (byte)((data & 0xF0) >> 4);
return bit4;
}
public static Byte[] ByteToBit4(Byte[] data)
{
byte[] bit4 = new byte[data.Length * 2];
for (int i = 0; i < data.Length; i++)
{
byte[] b4 = ByteToBit4(data[i]);
bit4[i * 2] = b4[0];
bit4[i * 2 + 1] = b4[1];
}
return bit4;
}
public static Byte Bit4ToByte(Byte[] data)
{
return (byte)(data[0] + (data[1] << 4));
}
public static Byte Bit4ToByte(Byte b1, Byte b2)
{
return (byte)(b1 + (b2 << 4));
}
public static Byte[] Bits4ToByte(Byte[] data)
{
byte[] b = new byte[data.Length / 2];
for (int i = 0; i < data.Length; i += 2)
b[i / 2] = Bit4ToByte(data[i], data[i + 1]);
return b;
}
public static int Remove_DuplicatedColors(ref Color[] palette, ref byte[] tiles) public static int Remove_DuplicatedColors(ref Color[] palette, ref byte[] tiles)
{ {
List<Color> colors = new List<Color>(); List<Color> colors = new List<Color>();
@ -618,7 +559,7 @@ namespace PluginInterface.Images
public static void Change_Color(ref byte[] tiles, int oldIndex, int newIndex, ColorFormat format) public static void Change_Color(ref byte[] tiles, int oldIndex, int newIndex, ColorFormat format)
{ {
if (format == ColorFormat.colors16) // Yeah, I should improve it if (format == ColorFormat.colors16) // Yeah, I should improve it
tiles = ByteToBit4(tiles); tiles = Helper.BitsConverter.BytesToBit4(tiles);
for (int i = 0; i < tiles.Length; i++) for (int i = 0; i < tiles.Length; i++)
{ {
@ -629,12 +570,12 @@ namespace PluginInterface.Images
} }
if (format == ColorFormat.colors16) if (format == ColorFormat.colors16)
tiles = Bits4ToByte(tiles); tiles = Helper.BitsConverter.Bits4ToByte(tiles);
} }
public static void Swap_Color(ref byte[] tiles, ref Color[] palette, int oldIndex, int newIndex, ColorFormat format) public static void Swap_Color(ref byte[] tiles, ref Color[] palette, int oldIndex, int newIndex, ColorFormat format)
{ {
if (format == ColorFormat.colors16) // Yeah, I should improve it if (format == ColorFormat.colors16) // Yeah, I should improve it
tiles = ByteToBit4(tiles); tiles = Helper.BitsConverter.BytesToBit4(tiles);
Color old_color = palette[oldIndex]; Color old_color = palette[oldIndex];
palette[oldIndex] = palette[newIndex]; palette[oldIndex] = palette[newIndex];
@ -649,7 +590,7 @@ namespace PluginInterface.Images
} }
if (format == ColorFormat.colors16) if (format == ColorFormat.colors16)
tiles = Bits4ToByte(tiles); tiles = Helper.BitsConverter.Bits4ToByte(tiles);
} }
public static void Replace_Color(ref byte[] tiles, int oldIndex, int newIndex) public static void Replace_Color(ref byte[] tiles, int oldIndex, int newIndex)
{ {
@ -662,7 +603,7 @@ namespace PluginInterface.Images
public static void Swap_Palette(ref byte[] tiles, Color[] newp, Color[] oldp, ColorFormat format) public static void Swap_Palette(ref byte[] tiles, Color[] newp, Color[] oldp, ColorFormat format)
{ {
if (format == ColorFormat.colors16) // Yeah, I should improve it if (format == ColorFormat.colors16) // Yeah, I should improve it
tiles = ByteToBit4(tiles); tiles = Helper.BitsConverter.BytesToBit4(tiles);
else if (format != ColorFormat.colors256) else if (format != ColorFormat.colors256)
return; return;
@ -679,7 +620,7 @@ namespace PluginInterface.Images
} }
if (format == ColorFormat.colors16) if (format == ColorFormat.colors16)
tiles = Bits4ToByte(tiles); tiles = Helper.BitsConverter.Bits4ToByte(tiles);
} }
public static uint Add_Image(ref byte[] data, byte[] newData, uint blockSize) public static uint Add_Image(ref byte[] data, byte[] newData, uint blockSize)
@ -1069,7 +1010,7 @@ namespace PluginInterface.Images
if (image) if (image)
{ {
ImageBase cell_img = new TestImage(img.PluginHost); ImageBase cell_img = new TestImage();
cell_img.Set_Tiles((byte[])img.Tiles.Clone(), bank.oams[i].width, bank.oams[i].height, img.FormatColor, cell_img.Set_Tiles((byte[])img.Tiles.Clone(), bank.oams[i].width, bank.oams[i].height, img.FormatColor,
img.FormTile, false); img.FormTile, false);
cell_img.StartByte = (int)tileOffset * 0x20; cell_img.StartByte = (int)tileOffset * 0x20;
@ -1133,7 +1074,7 @@ namespace PluginInterface.Images
public static Byte[] Get_OAMdata(OAM oam, byte[] image, ColorFormat format) public static Byte[] Get_OAMdata(OAM oam, byte[] image, ColorFormat format)
{ {
if (format == ColorFormat.colors16) if (format == ColorFormat.colors16)
image = ByteToBit4(image); image = Helper.BitsConverter.BytesToBit4(image);
List<byte> data = new List<byte>(); List<byte> data = new List<byte>();
int y1 = 128 + oam.obj0.yOffset; int y1 = 128 + oam.obj0.yOffset;
@ -1148,7 +1089,7 @@ namespace PluginInterface.Images
data.Add(image[wt + ht * 512]); data.Add(image[wt + ht * 512]);
if (format == ColorFormat.colors16) if (format == ColorFormat.colors16)
return Bits4ToByte(data.ToArray()); return Helper.BitsConverter.Bits4ToByte(data.ToArray());
else else
return data.ToArray(); return data.ToArray();
} }

View File

@ -17,7 +17,7 @@
* By: pleoNeX * By: pleoNeX
* *
*/ */
namespace PluginInterface.Images.Dialogs namespace Ekona.Images.Dialogs
{ {
partial class OAMEditor partial class OAMEditor
{ {

View File

@ -26,7 +26,7 @@ using System.Linq;
using System.Text; using System.Text;
using System.Windows.Forms; using System.Windows.Forms;
namespace PluginInterface.Images.Dialogs namespace Ekona.Images.Dialogs
{ {
public partial class OAMEditor : Form public partial class OAMEditor : Form
{ {

View File

@ -27,7 +27,7 @@ using System.Drawing;
using System.IO; using System.IO;
using System.Linq; using System.Linq;
namespace PluginInterface.Images.Formats namespace Ekona.Images.Formats
{ {
/// <summary> /// <summary>
/// Adobe COlor /// Adobe COlor
@ -35,13 +35,13 @@ namespace PluginInterface.Images.Formats
/// </summary> /// </summary>
public class ACO : PaletteBase public class ACO : PaletteBase
{ {
public ACO(IPluginHost pluginHost, string file) public ACO(string file)
: base(pluginHost) : base()
{ {
Read(file); Read(file);
} }
public ACO(IPluginHost pluginHost, Color[] colors) public ACO(Color[] colors)
: base(pluginHost) : base()
{ {
Set_Palette(new Color[][] { colors }, true); Set_Palette(new Color[][] { colors }, true);
} }

View File

@ -1,44 +1,54 @@
/* // ----------------------------------------------------------------------
* Copyright (C) 2011 pleoNeX // <copyright file="APNG.cs" company="none">
*
* This program is free software: you can redistribute it and/or modify // Copyright (C) 2012
* it under the terms of the GNU General Public License as published by //
* the Free Software Foundation, either version 3 of the License, or // This program is free software: you can redistribute it and/or modify
* (at your option) any later version. // it under the terms of the GNU General Public License as published by
* // the Free Software Foundation, either version 3 of the License, or
* This program is distributed in the hope that it will be useful, // (at your option) any later version.
* but WITHOUT ANY WARRANTY; without even the implied warranty of //
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // This program is distributed in the hope that it will be useful,
* GNU General Public License for more details. // but WITHOUT ANY WARRANTY; without even the implied warranty of
* // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* You should have received a copy of the GNU General Public License // GNU General Public License for more details.
* along with this program. If not, see <http://www.gnu.org/licenses/>. //
* // You should have received a copy of the GNU General Public License
* Programador: pleoNeX // along with this program. If not, see <http://www.gnu.org/licenses/>.
* Programa utilizado: Microsoft Visual C# 2010 Express //
* Fecha: 27/06/2011 // </copyright>
*
*/ // <author>pleoNeX</author>
// <email>benito356@gmail.com</email>
// <date>24/06/2012 14:47:38</date>
// -----------------------------------------------------------------------
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq; using System.Linq;
using System.Text; using System.Text;
using System.IO; using System.IO;
namespace Tinke.Tools namespace Ekona.Images.Formats
{ {
public static class APNG public static class APNG
{ {
// Obtenido de: // Info from:
// https://wiki.mozilla.org/APNG_Specification // https://wiki.mozilla.org/APNG_Specification
// http://www.w3.org/TR/PNG/ // http://www.w3.org/TR/PNG/
public static void Crear_APNG(string[] pngs, string apng, int delay, int loops) /// <summary>
/// Save an animation in a APNG file (Firefox supported)
/// </summary>
/// <param name="pngs">All frames (path of files or bitmaps)</param>
/// <param name="apng">The path of the output file</param>
/// <param name="delay">The delay between frames (delay/1000)</param>
/// <param name="loops">The number of loops (if 0 = infinite)</param>
public static void Create(string[] pngs, string apng, int delay, int loops)
{ {
byte[] pngSignature = new byte[] { 137, 80, 78, 71, 13, 10, 26, 10 }; byte[] pngSignature = new byte[] { 137, 80, 78, 71, 13, 10, 26, 10 };
IHDR ihdr = Leer_IHDR(pngs[0]); IHDR ihdr = Read_IHDR(pngs[0]);
#region Sección acTL #region Section acTL
acTL actl = new acTL(); acTL actl = new acTL();
actl.length = BitConverter.GetBytes(8).Reverse().ToArray(); actl.length = BitConverter.GetBytes(8).Reverse().ToArray();
actl.id = Encoding.ASCII.GetBytes(new char[] { 'a', 'c', 'T', 'L' }); actl.id = Encoding.ASCII.GetBytes(new char[] { 'a', 'c', 'T', 'L' });
@ -48,36 +58,36 @@ namespace Tinke.Tools
stream.AddRange(actl.id); stream.AddRange(actl.id);
stream.AddRange(actl.num_frames); stream.AddRange(actl.num_frames);
stream.AddRange(actl.num_plays); stream.AddRange(actl.num_plays);
actl.crc = CRC32.Calcular(stream.ToArray()); actl.crc = Helper.CRC32.Calculate(stream.ToArray());
stream.Clear(); stream.Clear();
#endregion #endregion
List<fcTL> fctl = new List<fcTL>(); List<fcTL> fctl = new List<fcTL>();
List<fdAT> fdat = new List<fdAT>(); List<fdAT> fdat = new List<fdAT>();
int i = 0; int i = 0;
fctl.Add(Leer_fcTL(pngs[0], i, delay)); fctl.Add(Read_fcTL(pngs[0], i, delay));
i++; i++;
byte[] IDAT = Leer_IDAT(pngs[0]); byte[] IDAT = Read_IDAT(pngs[0]);
foreach (string png in pngs) foreach (string png in pngs)
{ {
if (png == pngs[0]) if (png == pngs[0])
continue; continue;
fctl.Add(Leer_fcTL(png, i, delay)); fctl.Add(Read_fcTL(png, i, delay));
i++; i++;
fdat.Add(Leer_fdAT(png, i)); fdat.Add(Read_fdAT(png, i));
i++; i++;
} }
IEND iend = new IEND(); IEND iend = new IEND();
iend.id = Encoding.ASCII.GetBytes(new char[] { 'I', 'E', 'N', 'D' }); iend.id = Encoding.ASCII.GetBytes(new char[] { 'I', 'E', 'N', 'D' });
iend.length = BitConverter.GetBytes(0); iend.length = BitConverter.GetBytes(0);
iend.crc = CRC32.Calcular(iend.id); iend.crc = Helper.CRC32.Calculate(iend.id);
Escribir(apng, pngSignature, ihdr, actl, IDAT, fctl.ToArray(), fdat.ToArray(), iend); Write(apng, pngSignature, ihdr, actl, IDAT, fctl.ToArray(), fdat.ToArray(), iend);
} }
public static void Crear_APNG(System.Drawing.Bitmap[] pngs, string apng, int delay, int loops) public static void Create(System.Drawing.Bitmap[] pngs, string apng, int delay, int loops)
{ {
string[] files = new string[pngs.Length]; string[] files = new string[pngs.Length];
@ -87,12 +97,12 @@ namespace Tinke.Tools
pngs[i].Save(files[i]); pngs[i].Save(files[i]);
} }
Crear_APNG(files, apng, delay, loops); Create(files, apng, delay, loops);
for (int i = 0; i < files.Length; i++) for (int i = 0; i < files.Length; i++)
File.Delete(files[i]); File.Delete(files[i]);
} }
private static void Escribir(string apng, byte[] signature, IHDR ihdr, acTL actl, byte[] idat, private static void Write(string apng, byte[] signature, IHDR ihdr, acTL actl, byte[] idat,
fcTL[] fctl, fdAT[] fdat, IEND iend) fcTL[] fctl, fdAT[] fdat, IEND iend)
{ {
BinaryWriter bw = new BinaryWriter(new FileStream(apng, FileMode.Create)); BinaryWriter bw = new BinaryWriter(new FileStream(apng, FileMode.Create));
@ -161,7 +171,7 @@ namespace Tinke.Tools
bw.Close(); bw.Close();
} }
private static IHDR Leer_IHDR(string png) private static IHDR Read_IHDR(string png)
{ {
BinaryReader br = new BinaryReader(new FileStream(png, FileMode.Open)); BinaryReader br = new BinaryReader(new FileStream(png, FileMode.Open));
br.BaseStream.Position = 0x08; br.BaseStream.Position = 0x08;
@ -181,7 +191,7 @@ namespace Tinke.Tools
br.Close(); br.Close();
return ihdr; return ihdr;
} }
private static fcTL Leer_fcTL(string png, int seq, int delay) private static fcTL Read_fcTL(string png, int seq, int delay)
{ {
BinaryReader br = new BinaryReader(new FileStream(png, FileMode.Open)); BinaryReader br = new BinaryReader(new FileStream(png, FileMode.Open));
br.BaseStream.Position = 0x10; br.BaseStream.Position = 0x10;
@ -210,13 +220,13 @@ namespace Tinke.Tools
stream.AddRange(fctl.delay_den); stream.AddRange(fctl.delay_den);
stream.Add(fctl.dispose_op); stream.Add(fctl.dispose_op);
stream.Add(fctl.blend_op); stream.Add(fctl.blend_op);
fctl.crc = CRC32.Calcular(stream.ToArray()); fctl.crc = Helper.CRC32.Calculate(stream.ToArray());
stream.Clear(); stream.Clear();
br.Close(); br.Close();
return fctl; return fctl;
} }
private static byte[] Leer_IDAT(string png) private static byte[] Read_IDAT(string png)
{ {
BinaryReader br = new BinaryReader(new FileStream(png, FileMode.Open)); BinaryReader br = new BinaryReader(new FileStream(png, FileMode.Open));
byte[] buffer; byte[] buffer;
@ -240,7 +250,7 @@ namespace Tinke.Tools
br.Close(); br.Close();
return buffer; return buffer;
} }
private static fdAT Leer_fdAT(string png, int i) private static fdAT Read_fdAT(string png, int i)
{ {
BinaryReader br = new BinaryReader(new FileStream(png, FileMode.Open)); BinaryReader br = new BinaryReader(new FileStream(png, FileMode.Open));
fdAT fdat = new fdAT(); fdAT fdat = new fdAT();
@ -268,7 +278,7 @@ namespace Tinke.Tools
stream.AddRange(fdat.id); stream.AddRange(fdat.id);
stream.AddRange(fdat.sequence_number); stream.AddRange(fdat.sequence_number);
stream.AddRange(fdat.data); stream.AddRange(fdat.data);
fdat.crc = CRC32.Calcular(stream.ToArray()); fdat.crc = Helper.CRC32.Calculate(stream.ToArray());
br.Close(); br.Close();
return fdat; return fdat;

View File

@ -29,13 +29,13 @@ using System.Text;
using System.IO; using System.IO;
using System.Drawing; using System.Drawing;
namespace PluginInterface.Images.Formats namespace Ekona.Images.Formats
{ {
public class BMP : ImageBase public class BMP : ImageBase
{ {
PaletteBase palette; PaletteBase palette;
public BMP(IPluginHost pluginHost, string file) : base(pluginHost, file, -1) { } public BMP(IPluginHost pluginHost, string file) : base(file, -1) { }
public override void Read(string fileIn) public override void Read(string fileIn)
{ {
@ -80,7 +80,7 @@ namespace PluginInterface.Images.Formats
// Get the colors with BGR555 encoding (not all colours from bitmap are allowed) // Get the colors with BGR555 encoding (not all colours from bitmap are allowed)
byte[] temp = Actions.ColorToBGR555(colors[0]); byte[] temp = Actions.ColorToBGR555(colors[0]);
colors[0] = Actions.BGR555ToColor(temp); colors[0] = Actions.BGR555ToColor(temp);
palette = new RawPalette(pluginHost, colors, false, format); palette = new RawPalette(colors, false, format);
byte[] tiles = new byte[width * height]; byte[] tiles = new byte[width * height];
br.BaseStream.Position = offsetImagen; br.BaseStream.Position = offsetImagen;
@ -109,7 +109,7 @@ namespace PluginInterface.Images.Formats
} }
br.ReadBytes((int)(divisor - ((float)width / 2))); br.ReadBytes((int)(divisor - ((float)width / 2)));
} }
tiles = pluginHost.Bit4ToBit8(tiles); tiles = Helper.BitsConverter.Bits4ToByte(tiles);
break; break;
case 8: case 8:
divisor = (int)width; divisor = (int)width;

View File

@ -26,15 +26,15 @@ using System;
using System.IO; using System.IO;
using System.Drawing; using System.Drawing;
namespace PluginInterface.Images.Formats namespace Ekona.Images.Formats
{ {
public class PaletteWin : PaletteBase public class PaletteWin : PaletteBase
{ {
public PaletteWin(IPluginHost pluginHost, string file) : base(pluginHost) public PaletteWin(string file) : base()
{ {
Read(file); Read(file);
} }
public PaletteWin(IPluginHost pluginHost, Color[] colors) : base(pluginHost) public PaletteWin(Color[] colors) : base()
{ {
Set_Palette(new Color[][] { colors }, true); Set_Palette(new Color[][] { colors }, true);
} }

View File

@ -26,7 +26,7 @@ using System.Drawing.Imaging;
using System.IO; using System.IO;
using System.Windows.Forms; using System.Windows.Forms;
namespace PluginInterface.Images namespace Ekona.Images
{ {
public abstract class ImageBase public abstract class ImageBase
{ {
@ -34,7 +34,6 @@ namespace PluginInterface.Images
#region Variable definition #region Variable definition
protected string fileName; protected string fileName;
protected int id; protected int id;
protected IPluginHost pluginHost;
bool loaded; bool loaded;
Byte[] original; Byte[] original;
@ -53,21 +52,22 @@ namespace PluginInterface.Images
Object obj; Object obj;
#endregion #endregion
public ImageBase(IPluginHost pluginHost) public ImageBase()
{ {
this.pluginHost = pluginHost;
} }
public ImageBase(IPluginHost pluginHost, Byte[] tiles, int width, int height, ColorFormat format, public ImageBase(Byte[] tiles, int width, int height, ColorFormat format,
TileForm tileForm, bool editable) TileForm tileForm, bool editable, string fileName = "")
{ {
this.pluginHost = pluginHost; this.fileName = fileName;
Set_Tiles(tiles, width, height, format, tileForm, editable); Set_Tiles(tiles, width, height, format, tileForm, editable);
} }
public ImageBase(IPluginHost pluginHost, string file, int id) public ImageBase(string file, int id, string fileName = "")
{ {
this.pluginHost = pluginHost;
this.id = id; this.id = id;
this.fileName = Path.GetFileName(file); if (fileName == "")
this.fileName = Path.GetFileName(file);
else
this.fileName = fileName;
Read(file); Read(file);
} }
@ -186,6 +186,7 @@ namespace PluginInterface.Images
public String FileName public String FileName
{ {
get { return fileName; } get { return fileName; }
set { fileName = value; }
} }
public bool Loaded public bool Loaded
{ {
@ -195,10 +196,6 @@ namespace PluginInterface.Images
{ {
get { return canEdit; } get { return canEdit; }
} }
public IPluginHost PluginHost
{
get { return pluginHost; }
}
public int Zoom public int Zoom
{ {
@ -285,8 +282,8 @@ namespace PluginInterface.Images
public class TestImage : ImageBase public class TestImage : ImageBase
{ {
public TestImage(IPluginHost pluginHost) public TestImage()
: base(pluginHost) : base()
{ {
} }

View File

@ -22,10 +22,10 @@ using System.Drawing;
using System.Windows.Forms; using System.Windows.Forms;
using System.IO; using System.IO;
using System.Xml.Linq; using System.Xml.Linq;
using PluginInterface.Images.Formats; using Ekona.Images.Formats;
//using FotochohForTinke; //using FotochohForTinke;
namespace PluginInterface.Images namespace Ekona.Images
{ {
public partial class ImageControl : UserControl public partial class ImageControl : UserControl
{ {
@ -414,12 +414,13 @@ namespace PluginInterface.Images
pal = palette.Palette[(int)numPal.Value]; pal = palette.Palette[(int)numPal.Value];
} }
// Create a map file and convert the tiles to Horizontal form // If the tile form is horizontal convert to it
if (isMap) if (image.FormTile == TileForm.Horizontal || isMap)
{
tiles = Actions.HorizontalToLineal(tiles, bitmap.Width, bitmap.Height, image.BPP, 8); tiles = Actions.HorizontalToLineal(tiles, bitmap.Width, bitmap.Height, image.BPP, 8);
// Create a map file
if (isMap)
map.Set_Map(Actions.Create_Map(ref tiles, image.BPP), map.CanEdit, bitmap.Width, bitmap.Height); map.Set_Map(Actions.Create_Map(ref tiles, image.BPP), map.CanEdit, bitmap.Width, bitmap.Height);
}
// Set the data // Set the data
image.Set_Tiles(tiles, bitmap.Width, bitmap.Height, image.FormatColor, TileForm.Lineal, image.CanEdit, 8); image.Set_Tiles(tiles, bitmap.Width, bitmap.Height, image.FormatColor, TileForm.Lineal, image.CanEdit, 8);

View File

@ -17,7 +17,7 @@
* Programador: pleoNeX * Programador: pleoNeX
* *
*/ */
namespace PluginInterface.Images namespace Ekona.Images
{ {
partial class ImageControl partial class ImageControl
{ {

View File

@ -24,13 +24,12 @@ using System.Text;
using System.IO; using System.IO;
using System.Drawing; using System.Drawing;
namespace PluginInterface.Images namespace Ekona.Images
{ {
public abstract class MapBase public abstract class MapBase
{ {
#region Variables #region Variables
protected IPluginHost pluginHost;
protected int id; protected int id;
protected string fileName; protected string fileName;
bool loaded; bool loaded;
@ -45,21 +44,22 @@ namespace PluginInterface.Images
Object obj; Object obj;
#endregion #endregion
public MapBase(IPluginHost pluginHost) public MapBase()
{ {
this.pluginHost = pluginHost;
} }
public MapBase(IPluginHost pluginHost, string fileIn, int id) public MapBase(string fileIn, int id, string fileName = "")
{ {
this.pluginHost = pluginHost;
this.id = id; this.id = id;
this.fileName = System.IO.Path.GetFileName(fileIn); if (fileName == "")
this.fileName = System.IO.Path.GetFileName(fileIn);
else
this.fileName = fileName;
Read(fileIn); Read(fileIn);
} }
public MapBase(IPluginHost pluginHost, NTFS[] mapInfo, bool editable, int width = 0, int height = 0) public MapBase(NTFS[] mapInfo, bool editable, int width = 0, int height = 0, string fileName = "")
{ {
this.pluginHost = pluginHost; this.fileName = fileName;
Set_Map(mapInfo, editable, width, height); Set_Map(mapInfo, editable, width, height);
} }
@ -75,7 +75,7 @@ namespace PluginInterface.Images
NTFS[] currMap = (NTFS[])map.Clone(); NTFS[] currMap = (NTFS[])map.Clone();
tiles = Actions.Apply_Map(currMap, image.Tiles, out tile_pal, image.BPP, image.TileSize); tiles = Actions.Apply_Map(currMap, image.Tiles, out tile_pal, image.BPP, image.TileSize);
ImageBase newImage = new TestImage(pluginHost); ImageBase newImage = new TestImage();
newImage.Set_Tiles(tiles, image.Width, image.Height, image.FormatColor, image.FormTile, image.CanEdit, image.TileSize); newImage.Set_Tiles(tiles, image.Width, image.Height, image.FormatColor, image.FormTile, image.CanEdit, image.TileSize);
newImage.TilesPalette = tile_pal; newImage.TilesPalette = tile_pal;
newImage.Zoom = image.Zoom; newImage.Zoom = image.Zoom;
@ -145,6 +145,7 @@ namespace PluginInterface.Images
public String FileName public String FileName
{ {
get { return fileName; } get { return fileName; }
set { fileName = value; }
} }
public bool Loaded public bool Loaded
{ {

View File

@ -25,14 +25,13 @@ using System.IO;
using System.Drawing; using System.Drawing;
using System.Windows.Forms; using System.Windows.Forms;
namespace PluginInterface.Images namespace Ekona.Images
{ {
public abstract class PaletteBase public abstract class PaletteBase
{ {
#region Variables #region Variables
protected String fileName; protected String fileName;
protected int id; protected int id;
protected IPluginHost pluginHost;
bool loaded; bool loaded;
Byte[] original; Byte[] original;
@ -45,20 +44,21 @@ namespace PluginInterface.Images
protected Object obj; protected Object obj;
#endregion #endregion
public PaletteBase(IPluginHost pluginHost) public PaletteBase()
{ {
this.pluginHost = pluginHost;
loaded = false; loaded = false;
} }
public PaletteBase(IPluginHost pluginHost, Color[][] pal, bool editable) public PaletteBase(Color[][] pal, bool editable, string fileName = "")
{ {
this.pluginHost = pluginHost; this.fileName = fileName;
Set_Palette(pal, editable); Set_Palette(pal, editable);
} }
public PaletteBase(IPluginHost pluginHost, string fileIn, int id) public PaletteBase(string fileIn, int id, string fileName = "")
{ {
this.pluginHost = pluginHost; if (fileName == "")
this.fileName = System.IO.Path.GetFileName(fileIn); this.fileName = System.IO.Path.GetFileName(fileIn);
else
this.fileName = fileName;
this.id = id; this.id = id;
Read(fileIn); Read(fileIn);
@ -276,6 +276,7 @@ namespace PluginInterface.Images
public String FileName public String FileName
{ {
get { return fileName; } get { return fileName; }
set { fileName = value; }
} }
public int ID public int ID
{ {

View File

@ -28,7 +28,7 @@ using System.Windows.Forms;
using System.IO; using System.IO;
using System.Xml.Linq; using System.Xml.Linq;
namespace PluginInterface.Images namespace Ekona.Images
{ {
public partial class PaletteControl : UserControl public partial class PaletteControl : UserControl
{ {
@ -80,6 +80,7 @@ namespace PluginInterface.Images
try try
{ {
XElement xml = XElement.Load(pluginHost.Get_LangXML()); XElement xml = XElement.Load(pluginHost.Get_LangXML());
xml = xml.Element("Ekona");
xml = xml.Element("PaletteControl"); xml = xml.Element("PaletteControl");
label1.Text = xml.Element("S01").Value; label1.Text = xml.Element("S01").Value;
@ -185,21 +186,55 @@ namespace PluginInterface.Images
picPalette.Image.Save(o.FileName, System.Drawing.Imaging.ImageFormat.Png); picPalette.Image.Save(o.FileName, System.Drawing.Imaging.ImageFormat.Png);
else if (o.FilterIndex == 1) else if (o.FilterIndex == 1)
{ {
Formats.PaletteWin palwin = new Formats.PaletteWin(pluginHost, palette.Palette[(int)numericPalette.Value]); Formats.PaletteWin palwin = new Formats.PaletteWin(palette.Palette[(int)numericPalette.Value]);
palwin.Write(o.FileName); palwin.Write(o.FileName);
} }
else if (o.FilterIndex == 3) else if (o.FilterIndex == 3)
{ {
Formats.ACO palaco = new Formats.ACO(pluginHost, palette.Palette[(int)numericPalette.Value]); Formats.ACO palaco = new Formats.ACO(palette.Palette[(int)numericPalette.Value]);
palaco.Write(o.FileName); palaco.Write(o.FileName);
} }
} }
private void btnImport_Click(object sender, EventArgs e) private void btnImport_Click(object sender, EventArgs e)
{ {
// TODO OpenFileDialog o = new OpenFileDialog();
//String fileOut = pluginHost.Get_TempFolder() + Path.DirectorySeparatorChar + Path.GetRandomFileName() + palette.FileName; o.CheckFileExists = true;
//palette.Write(fileOut); o.Filter = "All supported formats|*.pal;*.aco;*.png;*.bmp;*.jpg;*.jpeg;*.tif;*.tiff;*.gif;*.ico;*.icon|" +
//pluginHost.ChangeFile(palette.ID, fileOut); "Windows Palette (*.pal)|*.pal|" +
"Adobe COlor (*.aco)|*.aco|" +
"Palette from image|*.png;*.bmp;*.jpg;*.jpeg;*.tif;*.tiff;*.gif;*.ico;*.icon";
if (o.ShowDialog() != DialogResult.OK)
return;
string ext = Path.GetExtension(o.FileName).ToLower();
PaletteBase newpal;
if (ext == "pal")
newpal = new Formats.PaletteWin(o.FileName);
else if (ext == "aco")
newpal = new Formats.ACO(o.FileName);
else
{
byte[] tiles;
Color[] newcol;
Actions.Indexed_Image((Bitmap)Image.FromFile(o.FileName), palette.Depth, out tiles, out newcol);
newpal = new RawPalette(newcol, palette.CanEdit, palette.Depth);
}
if (newpal != null)
palette.Set_Palette(newpal);
// Write the file
if (palette.ID > 0)
{
try
{
String fileOut = pluginHost.Get_TempFolder() + Path.DirectorySeparatorChar + Path.GetRandomFileName() + palette.FileName;
palette.Write(fileOut);
pluginHost.ChangeFile(palette.ID, fileOut);
}
catch (Exception ex) { MessageBox.Show("Error writing new palette:\n" + ex.Message); };
}
} }
private void checkHex_CheckedChanged(object sender, EventArgs e) private void checkHex_CheckedChanged(object sender, EventArgs e)

View File

@ -17,7 +17,7 @@
* By: pleoNeX * By: pleoNeX
* *
*/ */
namespace PluginInterface.Images namespace Ekona.Images
{ {
partial class PaletteControl partial class PaletteControl
{ {
@ -125,7 +125,6 @@ namespace PluginInterface.Images
// //
// btnImport // btnImport
// //
this.btnImport.Enabled = false;
this.btnImport.Location = new System.Drawing.Point(429, 3); this.btnImport.Location = new System.Drawing.Point(429, 3);
this.btnImport.Name = "btnImport"; this.btnImport.Name = "btnImport";
this.btnImport.Size = new System.Drawing.Size(80, 40); this.btnImport.Size = new System.Drawing.Size(80, 40);
@ -133,7 +132,6 @@ namespace PluginInterface.Images
this.btnImport.Text = "S04"; this.btnImport.Text = "S04";
this.btnImport.TextImageRelation = System.Windows.Forms.TextImageRelation.ImageBeforeText; this.btnImport.TextImageRelation = System.Windows.Forms.TextImageRelation.ImageBeforeText;
this.btnImport.UseVisualStyleBackColor = true; this.btnImport.UseVisualStyleBackColor = true;
this.btnImport.Visible = false;
this.btnImport.Click += new System.EventHandler(this.btnImport_Click); this.btnImport.Click += new System.EventHandler(this.btnImport_Click);
// //
// label2 // label2

View File

@ -30,7 +30,7 @@ using System.IO;
using System.Drawing; using System.Drawing;
using System.Windows.Forms; using System.Windows.Forms;
namespace PluginInterface.Images namespace Ekona.Images
{ {
public class RawPalette : PaletteBase public class RawPalette : PaletteBase
{ {
@ -38,34 +38,36 @@ namespace PluginInterface.Images
byte[] prev_data; byte[] prev_data;
byte[] next_data; byte[] next_data;
public RawPalette(IPluginHost pluginHost, string file, int id, public RawPalette(string file, int id, bool editable, ColorFormat depth, int offset, int size, string fileName = "")
bool editable, ColorFormat depth, int offset, int size) : base()
: base(pluginHost)
{ {
this.pluginHost = pluginHost; if (fileName == "")
this.fileName = System.IO.Path.GetFileName(file); this.fileName = System.IO.Path.GetFileName(file);
else
this.fileName = fileName;
this.id = id; this.id = id;
Read(file, editable, depth, offset, size); Read(file, editable, depth, offset, size);
} }
public RawPalette(IPluginHost pluginHost, Color[][] colors, bool editable, ColorFormat depth) public RawPalette(Color[][] colors, bool editable, ColorFormat depth, string fileName = "")
: base(pluginHost) : base()
{ {
this.pluginHost = pluginHost; this.fileName = fileName;
Set_Palette(colors, depth, editable); Set_Palette(colors, depth, editable);
} }
public RawPalette(IPluginHost pluginHost, Color[] colors, bool editable, ColorFormat depth) public RawPalette(Color[] colors, bool editable, ColorFormat depth, string fileName = "")
: base(pluginHost) : base()
{ {
this.pluginHost = pluginHost; this.fileName = fileName;
Set_Palette(new Color[][] {colors}, depth, editable); Set_Palette(new Color[][] { colors }, depth, editable);
} }
public RawPalette(IPluginHost pluginHost, string file, int id, public RawPalette(string file, int id, bool editable, int offset, int size, string fileName = "")
bool editable, int offset, int size) : base()
: base(pluginHost)
{ {
this.pluginHost = pluginHost; if (fileName == "")
this.fileName = System.IO.Path.GetFileName(file); this.fileName = System.IO.Path.GetFileName(file);
else
this.fileName = fileName;
this.id = id; this.id = id;
Read(file, editable, offset, size); Read(file, editable, offset, size);
@ -145,31 +147,35 @@ namespace PluginInterface.Images
byte[] prev_data; byte[] prev_data;
byte[] next_data; byte[] next_data;
public RawImage(IPluginHost pluginHost, String file, int id, TileForm form, ColorFormat format, public RawImage(String file, int id, TileForm form, ColorFormat format,
bool editable, int offset, int size) : base(pluginHost) bool editable, int offset, int size, string fileName = "") : base()
{ {
this.pluginHost = pluginHost;
this.id = id; this.id = id;
this.fileName = Path.GetFileName(file); if (fileName == "")
this.fileName = Path.GetFileName(file);
else
this.fileName = fileName;
Read(file, form, format, editable, offset, size); Read(file, form, format, editable, offset, size);
} }
public RawImage(IPluginHost pluginHost, String file, int id, TileForm form, ColorFormat format, public RawImage(String file, int id, TileForm form, ColorFormat format,
int width, int height, bool editable, int offset, int size) : base(pluginHost) int width, int height, bool editable, int offset, int size, string fileName = "") : base()
{ {
this.pluginHost = pluginHost;
this.id = id; this.id = id;
this.fileName = Path.GetFileName(file); if (fileName == "")
this.fileName = Path.GetFileName(file);
else
this.fileName = fileName;
Read(file, form, format, editable, offset, size); Read(file, form, format, editable, offset, size);
this.Width = width; this.Width = width;
this.Height = height; this.Height = height;
} }
public RawImage(IPluginHost pluginHost, byte[] tiles, TileForm form, ColorFormat format, int width, int height, public RawImage(byte[] tiles, TileForm form, ColorFormat format, int width, int height,
bool editable) bool editable, string fileName = "")
: base(pluginHost) : base()
{ {
this.pluginHost = pluginHost; this.fileName = fileName;
Set_Tiles(tiles, width, height, format, form, editable); Set_Tiles(tiles, width, height, format, form, editable);
} }
@ -191,21 +197,35 @@ namespace PluginInterface.Images
Byte[] tiles = br.ReadBytes(fileSize); Byte[] tiles = br.ReadBytes(fileSize);
next_data = br.ReadBytes((int)(br.BaseStream.Length - fileSize)); // Save the next data to write them then 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);
#region Calculate the image size #region Calculate the image size
int width = (fileSize < 0x100 ? fileSize : 0x0100); int width, height;
int height = fileSize / width; int num_pix = fileSize * 8 / BPP;
// If the image it's a square
if (Math.Pow((int)(Math.Sqrt(num_pix)), 2) == num_pix)
width = height = (int)Math.Sqrt(num_pix);
else
{
width = (fileSize < 0x100 ? fileSize : 0x0100);
height = fileSize / width;
}
if (height == 0) if (height == 0)
height = 1; height = 1;
if (width == 0)
if (fileSize == 512) width = 1;
width = height = 32; if (form == TileForm.Horizontal && height < 8)
height = 8;
if (form == TileForm.Horizontal && width < 8)
width = 8;
#endregion #endregion
br.Close(); Width = width;
Height = height;
Set_Tiles(tiles, width, height, format, form, editable);
} }
public override void Write(string fileOut, PaletteBase palette) public override void Write(string fileOut, PaletteBase palette)
@ -227,18 +247,19 @@ namespace PluginInterface.Images
byte[] prev_data; byte[] prev_data;
byte[] next_data; byte[] next_data;
public RawMap(IPluginHost pluginHost, string file, int id, public RawMap(string file, int id, int offset, int size, bool editable, string fileName = "")
int offset, int size, bool editable) : base()
: base(pluginHost)
{ {
this.pluginHost = pluginHost;
this.id = id; this.id = id;
this.fileName = System.IO.Path.GetFileName(file); if (fileName == "")
this.fileName = System.IO.Path.GetFileName(file);
else
this.fileName = fileName;
Read(file, offset, size, editable); Read(file, offset, size, editable);
} }
public RawMap(IPluginHost pluginHost, NTFS[] map, int width, int height, bool editable) public RawMap(NTFS[] map, int width, int height, bool editable, string fileName = "")
: base(pluginHost, map, editable, width, height) : base(map, editable, width, height, fileName)
{ {
} }
@ -263,11 +284,8 @@ namespace PluginInterface.Images
next_data = br.ReadBytes((int)(br.BaseStream.Length - file_size)); next_data = br.ReadBytes((int)(br.BaseStream.Length - file_size));
int width = (map.Length * 8 >= 0x100 ? 0x100 : map.Length * 8);
int height = (map.Length / (width / 8)) * 8;
br.Close(); br.Close();
Set_Map(map, editable, width, height); Set_Map(map, editable);
} }
public override void Write(string fileOut, ImageBase image, PaletteBase palette) public override void Write(string fileOut, ImageBase image, PaletteBase palette)

View File

@ -24,14 +24,13 @@ using System.Text;
using System.IO; using System.IO;
using System.Drawing; using System.Drawing;
namespace PluginInterface.Images namespace Ekona.Images
{ {
public abstract class SpriteBase public abstract class SpriteBase
{ {
#region Variables #region Variables
protected string fileName; protected string fileName;
protected int id; protected int id;
protected IPluginHost pluginHost;
bool loaded; bool loaded;
bool canEdit; bool canEdit;
@ -46,6 +45,7 @@ namespace PluginInterface.Images
public String FileName public String FileName
{ {
get { return fileName; } get { return fileName; }
set { fileName = value; }
} }
public int ID public int ID
{ {
@ -74,14 +74,15 @@ namespace PluginInterface.Images
} }
#endregion #endregion
public SpriteBase(IPluginHost pluginHost) public SpriteBase()
{ {
this.pluginHost = pluginHost;
} }
public SpriteBase(IPluginHost pluginHost, string file, int id) public SpriteBase(string file, int id, string fileName = "")
{ {
this.pluginHost = pluginHost; if (fileName == "")
this.fileName = Path.GetFileName(file); this.fileName = Path.GetFileName(file);
else
this.fileName = fileName;
this.id = id; this.id = id;
Read(file); Read(file);

View File

@ -22,9 +22,9 @@ using System.Drawing;
using System.Xml.Linq; using System.Xml.Linq;
using System.IO; using System.IO;
using System.Windows.Forms; using System.Windows.Forms;
using PluginInterface.Images.Formats; using Ekona.Images.Formats;
namespace PluginInterface.Images namespace Ekona.Images
{ {
public partial class SpriteControl : UserControl public partial class SpriteControl : UserControl
{ {

View File

@ -22,7 +22,7 @@
// <email>benito356@gmail.com</email> // <email>benito356@gmail.com</email>
// <date>28/04/2012 14:29:12</date> // <date>28/04/2012 14:29:12</date>
// ----------------------------------------------------------------------- // -----------------------------------------------------------------------
namespace PluginInterface.Images namespace Ekona.Images
{ {
partial class SpriteControl partial class SpriteControl
{ {

View File

@ -5,8 +5,8 @@ using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following // General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information // set of attributes. Change these attribute values to modify the information
// associated with an assembly. // associated with an assembly.
[assembly: AssemblyTitle("PluginInterface")] [assembly: AssemblyTitle("Ekona")]
[assembly: AssemblyDescription("Interface for plugins")] [assembly: AssemblyDescription("Romhacking library")]
[assembly: AssemblyConfiguration("")] [assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")] [assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("Tinke")] [assembly: AssemblyProduct("Tinke")]
@ -32,5 +32,5 @@ using System.Runtime.InteropServices;
// You can specify all the values or you can default the Build and Revision Numbers // You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below: // by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")] // [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("6.0.0.0")] [assembly: AssemblyVersion("7.0.0.0")]
[assembly: AssemblyFileVersion("6.0.0.0")] [assembly: AssemblyFileVersion("7.0.0.0")]

View File

@ -1,14 +1,14 @@
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
// <auto-generated> // <auto-generated>
// Este código fue generado por una herramienta. // Este código fue generado por una herramienta.
// Versión de runtime:4.0.30319.261 // Versión de runtime:4.0.30319.269
// //
// Los cambios en este archivo podrían causar un comportamiento incorrecto y se perderán si // Los cambios en este archivo podrían causar un comportamiento incorrecto y se perderán si
// se vuelve a generar el código. // se vuelve a generar el código.
// </auto-generated> // </auto-generated>
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
namespace PluginInterface.Properties { namespace Ekona.Properties {
using System; using System;
@ -39,7 +39,7 @@ namespace PluginInterface.Properties {
internal static global::System.Resources.ResourceManager ResourceManager { internal static global::System.Resources.ResourceManager ResourceManager {
get { get {
if (object.ReferenceEquals(resourceMan, null)) { if (object.ReferenceEquals(resourceMan, null)) {
global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("PluginInterface.Properties.Resources", typeof(Resources).Assembly); global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("Ekona.Properties.Resources", typeof(Resources).Assembly);
resourceMan = temp; resourceMan = temp;
} }
return resourceMan; return resourceMan;

View File

@ -22,7 +22,7 @@ using System.Collections.Generic;
using System.Drawing; using System.Drawing;
using System.Windows.Forms; using System.Windows.Forms;
namespace PluginInterface namespace Ekona
{ {
public struct sFile public struct sFile
{ {
@ -91,7 +91,7 @@ namespace PluginInterface
public byte[] nPalette; // Number of the palette that this tile uses public byte[] nPalette; // Number of the palette that this tile uses
} }
public struct Header // Generic Header public struct NitroHeader // Generic Header in Nitro formats
{ {
public char[] id; public char[] id;
public UInt16 endianess; // 0xFFFE -> little endian public UInt16 endianess; // 0xFFFE -> little endian

View File

@ -1,83 +0,0 @@
/*
* Copyright (C) 2011 pleoNeX
*
* 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/>.
*
* by pleoNeX
*
*/
using System.Windows.Forms;
namespace PluginInterface
{
/// <summary>
/// Inteface to support one or more games
/// </summary>
public interface IGamePlugin
{
/// <summary>
/// First method to be called.
/// <param name="pluginHost">Class with common and necessary methods</param>
/// <param name="gameCode">String with the game code</param>
void Initialize(IPluginHost pluginHost, string gameCode);
/// <summary>
/// It returns if this game is compatible using the game code
/// </summary>
/// <returns>True or false</returns>
bool IsCompatible();
/// <summary>
/// Get the file format
/// </summary>
/// <param name="fileName">The file name</param>
/// <param name="magic">First four bytes of the file</param>
/// <param name="id">File ID</param>
/// <returns>File format</returns>
Format Get_Format(string fileName, byte[] magic, int id);
/// <summary>
/// This method is called when the user click on button "view", it will return a control with the file information
/// </summary>
/// <param name="file">File to analyze</param>
/// <param name="id">File ID</param>
/// <returns>Control that will be displayed</returns>
Control Show_Info(string file, int id);
/// <summary>
/// This methos will be called when the user double click a file.
/// It's used for a fast reading,
/// ie: double click the palette file instead of click on the button View if you want to see the next image.
/// It should call the methods Set_NCLR, Set_NANR, Set_Objects.... in pluginHost.
/// </summary>
/// <param name="file">File to analyze</param>
/// <param name="id">File ID</param>
void Read(string file, int id);
/// <summary>
/// It will be called when the user click on button "Unpack".
/// </summary>
/// <param name="file">File path where the file to unpack is</param>
/// <param name="id">File ID</param>
/// <returns>sFolder variable with files to show in the tree interface</returns>
sFolder Unpack(string file, int id);
/// <summary>
/// It will be called when the user click on button "Pack"
/// </summary>
/// <param name="unpacked">sFolder variable with all the unpacked files to pack</param>
/// <param name="file">Path where the original pack file is</param>
/// <param name="id">Pack file ID</param>
/// <returns>Path where the new pack file is</returns>
string Pack(ref sFolder unpacked, string file, int id);
}
}

View File

@ -1,75 +0,0 @@
/*
* Copyright (C) 2011 pleoNeX
*
* 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/>.
*
* by pleoNeX
*
*/
using System.Windows.Forms;
namespace PluginInterface
{
/// <summary>
/// IPlugin interface to support a file format
/// </summary>
public interface IPlugin
{
/// <summary>
/// First method to be called. It passes the class IPluginHost
/// </summary>
/// <param name="pluginHost">Class with common and necessary methods</param>
void Initialize(IPluginHost pluginHost);
/// <summary>
/// Get the file format
/// </summary>
/// <param name="fileName">The file name</param>
/// <param name="magic">First four bytes of the file</param>
/// <param name="id">ID to do operation using PluginHost with the file</param>
/// <returns>File format</returns>
Format Get_Format(string fileName, byte[] magic, int id);
/// <summary>
/// This method is called when the user click on button "view", it will return a control with the file information
/// </summary>
/// <param name="file">File to analyze</param>
/// <param name="id">File ID</param>
/// <returns>Control that will be displayed</returns>
Control Show_Info(string file, int id);
/// <summary>
/// This methos will be called when the user double click a file.
/// It's used for a fast reading,
/// ie: double click the palette file instead of click on the button View if you want to see the next image.
/// It should call the methods Set_NCLR, Set_NANR, Set_Objects.... in pluginHost.
/// </summary>
/// <param name="file">File to analyze</param>
/// <param name="id">File ID</param>
void Read(string file, int id);
/// <summary>
/// It will be called when the user click on button "Unpack".
/// </summary>
/// <param name="file">File path where the file to unpack is</param>
/// <param name="id">File ID</param>
/// <returns>sFolder variable with files to show in the tree interface</returns>
sFolder Unpack(string file);
/// <summary>
/// It will be called when the user click on button "Pack"
/// </summary>
/// <param name="unpacked">sFolder variable with all the unpacked files to pack</param>
/// <param name="file">Path where the original pack file is</param>
/// <returns>Path where the new pack file is</returns>
string Pack(ref sFolder unpacked, string file);
}
}

View File

@ -32,6 +32,9 @@
<WarningLevel>4</WarningLevel> <WarningLevel>4</WarningLevel>
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>
<Reference Include="Ekona">
<HintPath>..\..\..\Ekona\bin\Debug\Ekona.dll</HintPath>
</Reference>
<Reference Include="OpenTK, Version=1.0.0.0, Culture=neutral, PublicKeyToken=bad199fe84eb3df4, processorArchitecture=MSIL"> <Reference Include="OpenTK, Version=1.0.0.0, Culture=neutral, PublicKeyToken=bad199fe84eb3df4, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion> <SpecificVersion>False</SpecificVersion>
<HintPath>..\OpenTK.dll</HintPath> <HintPath>..\OpenTK.dll</HintPath>
@ -42,9 +45,6 @@
<HintPath>..\OpenTK.GLControl.dll</HintPath> <HintPath>..\OpenTK.GLControl.dll</HintPath>
<Private>False</Private> <Private>False</Private>
</Reference> </Reference>
<Reference Include="PluginInterface">
<HintPath>..\..\..\PluginInterface\bin\Debug\PluginInterface.dll</HintPath>
</Reference>
<Reference Include="System" /> <Reference Include="System" />
<Reference Include="System.Data" /> <Reference Include="System.Data" />
<Reference Include="System.Drawing" /> <Reference Include="System.Drawing" />

View File

@ -23,7 +23,7 @@ using System.Linq;
using System.Text; using System.Text;
using System.Drawing; using System.Drawing;
using System.IO; using System.IO;
using PluginInterface; using Ekona;
using OpenTK; using OpenTK;
using OpenTK.Graphics.OpenGL; using OpenTK.Graphics.OpenGL;

View File

@ -24,8 +24,8 @@ using System.Text;
using System.IO; using System.IO;
using System.Windows.Forms; using System.Windows.Forms;
using System.Drawing; using System.Drawing;
using PluginInterface; using Ekona;
using PluginInterface.Images; using Ekona.Images;
// Copied from: // Copied from:
// http://llref.emutalk.net/docs/?file=xml/btx0.xml#xml-doc // http://llref.emutalk.net/docs/?file=xml/btx0.xml#xml-doc
@ -501,7 +501,7 @@ namespace _3DModels
{ {
Bitmap imagen = new Bitmap(info.width, info.height); Bitmap imagen = new Bitmap(info.width, info.height);
if (info.format == 3) // 16-color 4 bits if (info.format == 3) // 16-color 4 bits
data = pluginHost.Bit8ToBit4(data); data = Ekona.Helper.BitsConverter.BytesToBit4(data);
else if (info.format == 2) // 4-color 2 bits else if (info.format == 2) // 4-color 2 bits
data = Bit8ToBit2(data); data = Bit8ToBit2(data);

View File

@ -21,7 +21,7 @@ using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Text; using System.Text;
using System.IO; using System.IO;
using PluginInterface; using Ekona;
namespace _3DModels namespace _3DModels
{ {
@ -35,7 +35,7 @@ namespace _3DModels
this.pluginHost = pluginHost; this.pluginHost = pluginHost;
} }
public Format Get_Format(string nombre, byte[] magic, int id) public Format Get_Format(sFile file, byte[] magic)
{ {
string ext = new String(Encoding.ASCII.GetChars(magic)); string ext = new String(Encoding.ASCII.GetChars(magic));
@ -47,21 +47,21 @@ namespace _3DModels
return Format.Unknown; return Format.Unknown;
} }
public void Read(string file, int id) public void Read(sFile file)
{ {
BinaryReader br = new BinaryReader(File.OpenRead(file)); BinaryReader br = new BinaryReader(File.OpenRead(file.path));
string ext = new String(br.ReadChars(4)); string ext = new String(br.ReadChars(4));
br.Close(); br.Close();
if (ext == "BTX0") if (ext == "BTX0")
{ {
sBTX0 btx = BTX0.Read(file, id, pluginHost); sBTX0 btx = BTX0.Read(file.path, file.id, pluginHost);
// Extract texture to temp folder // Extract texture to temp folder
for (int i = 0; i < btx.texture.texInfo.num_objs; i++) for (int i = 0; i < btx.texture.texInfo.num_objs; i++)
{ {
string fileOut = pluginHost.Get_TempFolder() + Path.DirectorySeparatorChar + string fileOut = pluginHost.Get_TempFolder() + Path.DirectorySeparatorChar +
Path.GetFileName(file).Substring(12) + '_' + btx.texture.texInfo.names[i] + ".png"; file.name + '_' + btx.texture.texInfo.names[i] + ".png";
if (File.Exists(fileOut)) if (File.Exists(fileOut))
fileOut = pluginHost.Get_TempFolder() + Path.DirectorySeparatorChar + Path.GetRandomFileName() + fileOut = pluginHost.Get_TempFolder() + Path.DirectorySeparatorChar + Path.GetRandomFileName() +
'_' + btx.texture.texInfo.names[i] + ".png"; '_' + btx.texture.texInfo.names[i] + ".png";
@ -70,20 +70,20 @@ namespace _3DModels
} }
} }
} }
public System.Windows.Forms.Control Show_Info(string file, int id) public System.Windows.Forms.Control Show_Info(sFile file)
{ {
BinaryReader br = new BinaryReader(File.OpenRead(file)); BinaryReader br = new BinaryReader(File.OpenRead(file.path));
string ext = new String(br.ReadChars(4)); string ext = new String(br.ReadChars(4));
br.Close(); br.Close();
if (ext == "BTX0") if (ext == "BTX0")
{ {
btx = BTX0.Read(file, id, pluginHost); btx = BTX0.Read(file.path, file.id, pluginHost);
return new TextureControl(pluginHost, btx); return new TextureControl(pluginHost, btx);
} }
else if (ext == "BMD0") else if (ext == "BMD0")
{ {
sBMD0 bmd = BMD0.Read(file, id, pluginHost); sBMD0 bmd = BMD0.Read(file.path, file.id, pluginHost);
if (bmd.header.numSect == 2) if (bmd.header.numSect == 2)
return new ModelControl(pluginHost, bmd); return new ModelControl(pluginHost, bmd);
@ -96,7 +96,7 @@ namespace _3DModels
return new System.Windows.Forms.Control(); return new System.Windows.Forms.Control();
} }
public String Pack(ref sFolder unpacked, string file) { return null; } public String Pack(ref sFolder unpacked, sFile file) { return null; }
public sFolder Unpack(string file) { return new sFolder(); } public sFolder Unpack(sFile file) { return new sFolder(); }
} }
} }

View File

@ -26,7 +26,7 @@ using System.Data;
using System.Linq; using System.Linq;
using System.Text; using System.Text;
using System.Windows.Forms; using System.Windows.Forms;
using PluginInterface; using Ekona;
using OpenTK; using OpenTK;
using OpenTK.Graphics.OpenGL; using OpenTK.Graphics.OpenGL;

View File

@ -26,8 +26,8 @@ using System.Linq;
using System.Text; using System.Text;
using System.IO; using System.IO;
using System.Windows.Forms; using System.Windows.Forms;
using PluginInterface; using Ekona;
using PluginInterface.Images; using Ekona.Images;
namespace _3DModels namespace _3DModels
{ {
@ -174,7 +174,7 @@ namespace _3DModels
picTex.Image = Draw_Texture(tile_data, texInfo, palette); picTex.Image = Draw_Texture(tile_data, texInfo, palette);
Clipboard.SetImage(picTex.Image); Clipboard.SetImage(picTex.Image);
PaletteBase p = new RawPalette(pluginHost, new Color[][] { palette }, false, ColorFormat.colors256); PaletteBase p = new RawPalette(new Color[][] { palette }, false, ColorFormat.colors256);
picPalette.Image = p.Get_Image(0); picPalette.Image = p.Get_Image(0);
Info(num_tex, num_pal); Info(num_tex, num_pal);
@ -187,7 +187,7 @@ namespace _3DModels
Bitmap imagen = new Bitmap(info.width, info.height); Bitmap imagen = new Bitmap(info.width, info.height);
if (info.format == 3) // 16-color 4 bits if (info.format == 3) // 16-color 4 bits
data = pluginHost.Bit8ToBit4(data); data = Ekona.Helper.BitsConverter.BytesToBit4(data);
else if (info.format == 2) // 4-color 2 bits else if (info.format == 2) // 4-color 2 bits
data = Bit8ToBit2(data); data = Bit8ToBit2(data);

View File

@ -32,9 +32,8 @@
<WarningLevel>4</WarningLevel> <WarningLevel>4</WarningLevel>
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>
<Reference Include="PluginInterface, Version=2.2.0.0, Culture=neutral, processorArchitecture=MSIL"> <Reference Include="Ekona">
<SpecificVersion>False</SpecificVersion> <HintPath>..\..\..\Ekona\bin\Debug\Ekona.dll</HintPath>
<HintPath>..\..\..\PluginInterface\bin\Debug\PluginInterface.dll</HintPath>
</Reference> </Reference>
<Reference Include="System" /> <Reference Include="System" />
<Reference Include="System.Data" /> <Reference Include="System.Data" />

View File

@ -21,7 +21,7 @@ using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Text; using System.Text;
using System.IO; using System.IO;
using PluginInterface; using Ekona;
namespace _999HRPERDOOR namespace _999HRPERDOOR
{ {
@ -43,46 +43,45 @@ namespace _999HRPERDOOR
return false; return false;
} }
public Format Get_Format(string nombre, byte[] magic, int id) public Format Get_Format(sFile file, byte[] magic)
{ {
string ext = new String(Encoding.ASCII.GetChars(magic)); string ext = new String(Encoding.ASCII.GetChars(magic));
if (id >= 0x13EF && id <= 0x1500) if (file.id >= 0x13EF && file.id <= 0x1500)
return Format.FullImage; return Format.FullImage;
if (ext == "AT6P") if (ext == "AT6P")
return Format.Compressed; return Format.Compressed;
if (nombre.EndsWith(".at6p")) if (file.name.EndsWith(".at6p"))
return Format.FullImage; return Format.FullImage;
return Format.Unknown; return Format.Unknown;
} }
public void Read(string archivo, int id) public void Read(sFile file)
{ {
if (id >= 0x13EF && id <= 0x1500) if (file.id >= 0x13EF && file.id <= 0x1500)
new SIR0_Sprite(pluginHost, archivo, id); new SIR0_Sprite(pluginHost, file.path, file.id, file.name);
if (archivo.EndsWith(".at6p")) if (file.name.EndsWith(".at6p"))
new SIR0_Image(pluginHost, archivo, id); new SIR0_Image(pluginHost, file.path, file.id, file.name);
} }
public System.Windows.Forms.Control Show_Info(string archivo, int id) public System.Windows.Forms.Control Show_Info(sFile file)
{ {
Read(archivo, id); Read(file);
if (id >= 0x13EF && id <= 0x1500) if (file.id >= 0x13EF && file.id <= 0x1500)
return new PluginInterface.Images.SpriteControl(pluginHost); return new Ekona.Images.SpriteControl(pluginHost);
if (archivo.EndsWith(".at6p")) if (file.name.EndsWith(".at6p"))
return new PluginInterface.Images.ImageControl(pluginHost, false); return new Ekona.Images.ImageControl(pluginHost, false);
return new System.Windows.Forms.Control(); return new System.Windows.Forms.Control();
} }
public String Pack(ref sFolder unpacked, string file, int id) { return null; } public String Pack(ref sFolder unpacked, sFile file) { return null; }
public sFolder Unpack(string file, int id) public sFolder Unpack(sFile file)
{ {
string tempFile = pluginHost.Get_TempFolder() + Path.DirectorySeparatorChar + string tempFile = pluginHost.Get_TempFile();
Path.GetFileNameWithoutExtension(file).Substring(12) + ".at6p";
byte[] data = File.ReadAllBytes(file); byte[] data = File.ReadAllBytes(file.path);
byte[] decrypted = AT6P.Decrypt(data); byte[] decrypted = AT6P.Decrypt(data);
File.WriteAllBytes(tempFile, decrypted); File.WriteAllBytes(tempFile, decrypted);
@ -90,7 +89,7 @@ namespace _999HRPERDOOR
unpack.files = new List<sFile>(); unpack.files = new List<sFile>();
sFile newFile = new sFile(); sFile newFile = new sFile();
newFile.name = Path.GetFileName(tempFile); newFile.name = file.name;
newFile.offset = 0; newFile.offset = 0;
newFile.path = tempFile; newFile.path = tempFile;
newFile.size = (uint)decrypted.Length; newFile.size = (uint)decrypted.Length;

View File

@ -23,16 +23,20 @@ using System.Linq;
using System.Text; using System.Text;
using System.IO; using System.IO;
using System.Drawing; using System.Drawing;
using PluginInterface; using Ekona;
using PluginInterface.Images; using Ekona.Images;
namespace _999HRPERDOOR namespace _999HRPERDOOR
{ {
public class SIR0_Sprite : SpriteBase public class SIR0_Sprite : SpriteBase
{ {
SIR0_Info info; SIR0_Info info;
IPluginHost pluginHost;
public SIR0_Sprite(IPluginHost pluginHost, string file, int id) : base(pluginHost, file, id) { } public SIR0_Sprite(IPluginHost pluginHost, string file, int id, string fileName = "") : base(file, id, fileName)
{
this.pluginHost = pluginHost;
}
public override void Read(string file) public override void Read(string file)
{ {
@ -41,7 +45,7 @@ namespace _999HRPERDOOR
PaletteBase palette; PaletteBase palette;
ImageBase image; ImageBase image;
PluginInterface.Images.Bank bank; Ekona.Images.Bank bank;
// Read header // Read header
char[] file_id = br.ReadChars(4); char[] file_id = br.ReadChars(4);
@ -87,13 +91,13 @@ namespace _999HRPERDOOR
br.BaseStream.Position = info.info3.palette_offset; br.BaseStream.Position = info.info3.palette_offset;
Color[][] colors = new Color[1][]; Color[][] colors = new Color[1][];
colors[0] = Actions.BGR555ToColor(br.ReadBytes(0x200)); colors[0] = Actions.BGR555ToColor(br.ReadBytes(0x200));
palette = new RawPalette(pluginHost, colors, false, ColorFormat.colors256); palette = new RawPalette(colors, false, ColorFormat.colors256);
// Read tiles // Read tiles
br.BaseStream.Position = info.info3.tile_offset; br.BaseStream.Position = info.info3.tile_offset;
byte[] tiles = new byte[info.info3.tile_size]; byte[] tiles = new byte[info.info3.tile_size];
tiles = br.ReadBytes((int)info.info3.tile_size); tiles = br.ReadBytes((int)info.info3.tile_size);
image = new RawImage(pluginHost, tiles, TileForm.Lineal, ColorFormat.colors256, 0x40, image = new RawImage(tiles, TileForm.Lineal, ColorFormat.colors256, 0x40,
(int)(info.info3.tile_size / 0x40), false); (int)(info.info3.tile_size / 0x40), false);
// Read cell info // Read cell info
@ -104,7 +108,7 @@ namespace _999HRPERDOOR
bank_size = info.info1.info3_offset - info.info3.cell_offset - 0x06; bank_size = info.info1.info3_offset - info.info3.cell_offset - 0x06;
br.BaseStream.Position = info.info3.cell_offset; br.BaseStream.Position = info.info3.cell_offset;
bank = new PluginInterface.Images.Bank(); bank = new Ekona.Images.Bank();
bank.oams = new OAM[bank_size / 0x0A]; bank.oams = new OAM[bank_size / 0x0A];
for (int i = 0; i < bank.oams.Length; i++) for (int i = 0; i < bank.oams.Length; i++)
{ {
@ -112,10 +116,10 @@ namespace _999HRPERDOOR
bank.oams[i].height = br.ReadUInt16(); bank.oams[i].height = br.ReadUInt16();
bank.oams[i].obj1.xOffset = br.ReadUInt16() - 0x80; bank.oams[i].obj1.xOffset = br.ReadUInt16() - 0x80;
bank.oams[i].obj0.yOffset = br.ReadUInt16() - 0x80; bank.oams[i].obj0.yOffset = br.ReadUInt16() - 0x80;
bank.oams[i].obj2.tileOffset = (uint)(br.ReadUInt16() / 0x40); bank.oams[i].obj2.tileOffset = (uint)(br.ReadUInt16() / 0x20);
bank.oams[i].num_cell = (ushort)i; bank.oams[i].num_cell = (ushort)i;
} }
Set_Banks(new PluginInterface.Images.Bank[] { bank }, 0, false); Set_Banks(new Ekona.Images.Bank[] { bank }, 0, false);
br.Close(); br.Close();
pluginHost.Set_Palette(palette); pluginHost.Set_Palette(palette);
@ -130,7 +134,12 @@ namespace _999HRPERDOOR
public class SIR0_Image : ImageBase public class SIR0_Image : ImageBase
{ {
public SIR0_Image(IPluginHost pluginHost, string file, int id) : base(pluginHost, file, id) { } IPluginHost pluginHost;
public SIR0_Image(IPluginHost pluginHost, string file, int id, string fileName = "") : base(file, id, fileName)
{
this.pluginHost = pluginHost;
}
public override void Read(string fileIn) public override void Read(string fileIn)
{ {
@ -149,7 +158,7 @@ namespace _999HRPERDOOR
br.BaseStream.Position = paletteOffset; br.BaseStream.Position = paletteOffset;
Color[] colors = Actions.BGR555ToColor(br.ReadBytes(0x200)); Color[] colors = Actions.BGR555ToColor(br.ReadBytes(0x200));
RawPalette palette = new RawPalette(pluginHost, new Color[][] { colors }, false, ColorFormat.colors256); RawPalette palette = new RawPalette(new Color[][] { colors }, false, ColorFormat.colors256);
pluginHost.Set_Palette(palette); pluginHost.Set_Palette(palette);
br.Close(); br.Close();

View File

@ -34,8 +34,9 @@
<WarningLevel>4</WarningLevel> <WarningLevel>4</WarningLevel>
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>
<Reference Include="PluginInterface"> <Reference Include="Ekona, Version=7.0.0.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\..\..\PluginInterface\bin\Debug\PluginInterface.dll</HintPath> <SpecificVersion>False</SpecificVersion>
<HintPath>..\..\..\Ekona\bin\Debug\Ekona.dll</HintPath>
</Reference> </Reference>
<Reference Include="System" /> <Reference Include="System" />
<Reference Include="System.Core" /> <Reference Include="System.Core" />

View File

@ -22,14 +22,14 @@ using System.Collections.Generic;
using System.Linq; using System.Linq;
using System.Text; using System.Text;
using System.IO; using System.IO;
using PluginInterface; using Ekona;
using PluginInterface.Images; using Ekona.Images;
namespace AI_IGO_DS namespace AI_IGO_DS
{ {
public class ANCG : ImageBase public class ANCG : ImageBase
{ {
public ANCG(IPluginHost pluginHost, string file, int id) : base(pluginHost, file, id) { } public ANCG(string file, int id, string fileName = "") : base(file, id, fileName) { }
public override void Read(string fileIn) public override void Read(string fileIn)
{ {
@ -41,7 +41,6 @@ namespace AI_IGO_DS
br.Close(); br.Close();
Set_Tiles(tiles, 0x40, tiles.Length / 0x20, ColorFormat.colors16, TileForm.Horizontal, false); Set_Tiles(tiles, 0x40, tiles.Length / 0x20, ColorFormat.colors16, TileForm.Horizontal, false);
pluginHost.Set_Image(this);
} }
public override void Write(string fileOut, PaletteBase palette) public override void Write(string fileOut, PaletteBase palette)
{ {

View File

@ -23,14 +23,14 @@ using System.Linq;
using System.Text; using System.Text;
using System.IO; using System.IO;
using System.Drawing; using System.Drawing;
using PluginInterface; using Ekona;
using PluginInterface.Images; using Ekona.Images;
namespace AI_IGO_DS namespace AI_IGO_DS
{ {
public class ANCL : PaletteBase public class ANCL : PaletteBase
{ {
public ANCL(IPluginHost pluginHost, string file, int id) : base(pluginHost, file, id) { } public ANCL(string file, int id, string fileName = "") : base(file, id, fileName) { }
public override void Read(string file) public override void Read(string file)
{ {
@ -45,7 +45,6 @@ namespace AI_IGO_DS
br.Close(); br.Close();
Set_Palette(colors, false); Set_Palette(colors, false);
pluginHost.Set_Palette(this);
} }
public override void Write(string fileOut) public override void Write(string fileOut)
{ {

View File

@ -22,14 +22,14 @@ using System.Collections.Generic;
using System.Linq; using System.Linq;
using System.Text; using System.Text;
using System.IO; using System.IO;
using PluginInterface; using Ekona;
using PluginInterface.Images; using Ekona.Images;
namespace AI_IGO_DS namespace AI_IGO_DS
{ {
public class ANSC : MapBase public class ANSC : MapBase
{ {
public ANSC(IPluginHost pluginHost, string file, int id) : base(pluginHost, file, id) { } public ANSC(string file, int id, string fileName = "") : base(file, id, fileName) { }
public override void Read(string fileIn) public override void Read(string fileIn)
{ {
@ -43,7 +43,6 @@ namespace AI_IGO_DS
br.Close(); br.Close();
Set_Map(map, false, 0x100, 0xB0); Set_Map(map, false, 0x100, 0xB0);
pluginHost.Set_Map(this);
} }
public override void Write(string fileOut, ImageBase image, PaletteBase palette) public override void Write(string fileOut, ImageBase image, PaletteBase palette)
{ {

View File

@ -22,15 +22,15 @@ using System.Collections.Generic;
using System.Linq; using System.Linq;
using System.Text; using System.Text;
using System.IO; using System.IO;
using PluginInterface; using Ekona;
using PluginInterface.Images; using Ekona.Images;
namespace AI_IGO_DS namespace AI_IGO_DS
{ {
public class ATEX : ImageBase public class ATEX : ImageBase
{ {
public ATEX(IPluginHost pluginHost, string file, int id) : base(pluginHost, file, id) { } public ATEX(string file, int id, string fileName = "") : base(file, id, fileName) { }
public override void Read(string fileIn) public override void Read(string fileIn)
{ {
@ -44,8 +44,7 @@ namespace AI_IGO_DS
Byte[] tiles = br.ReadBytes((int)tiles_size); Byte[] tiles = br.ReadBytes((int)tiles_size);
br.Close(); br.Close();
Set_Tiles(tiles, width, height, depth, PluginInterface.Images.TileForm.Lineal, false); Set_Tiles(tiles, width, height, depth, Ekona.Images.TileForm.Lineal, false);
pluginHost.Set_Image(this);
} }
public override void Write(string fileOut, PaletteBase palette) public override void Write(string fileOut, PaletteBase palette)
{ {

View File

@ -24,25 +24,28 @@ using System.Text;
using System.IO; using System.IO;
using System.Drawing; using System.Drawing;
using System.Windows.Forms; using System.Windows.Forms;
using PluginInterface; using Ekona;
using PluginInterface.Images; using Ekona.Images;
namespace AI_IGO_DS namespace AI_IGO_DS
{ {
public class BIN public class BIN
{ {
IPluginHost pluginHost;
int id; int id;
string fileName;
bool hasMap; bool hasMap;
MapBase[] maps; MapBase[] maps;
ImageBase image; ImageBase image;
PaletteBase palette; PaletteBase palette;
public BIN(IPluginHost pluginHost, string file, int id) public BIN(string file, int id, string fileName = "")
{ {
this.pluginHost = pluginHost;
this.id = id; this.id = id;
if (fileName == "")
this.fileName = Path.GetFileName(file);
else
this.fileName = fileName;
Read(file); Read(file);
} }
@ -105,7 +108,7 @@ namespace AI_IGO_DS
uint tCabeceraSize = br.ReadUInt32() * 4; uint tCabeceraSize = br.ReadUInt32() * 4;
uint tSize = br.ReadUInt32() * 4; uint tSize = br.ReadUInt32() * 4;
byte[] tiles = br.ReadBytes((int)(tSize - 0x08)); byte[] tiles = br.ReadBytes((int)(tSize - 0x08));
image = new RawImage(pluginHost, tiles, TileForm.Horizontal, depth, 0x40, tiles.Length / 0x40, false); image = new RawImage(tiles, TileForm.Horizontal, depth, 0x40, tiles.Length / 0x40, false, fileName);
// Map // Map
if (mapOffset == 0x00) if (mapOffset == 0x00)
@ -136,13 +139,13 @@ namespace AI_IGO_DS
for (int j = 0; j < map.Length; j++) for (int j = 0; j < map.Length; j++)
map[j] = Actions.MapInfo(br.ReadUInt16()); map[j] = Actions.MapInfo(br.ReadUInt16());
maps[i] = new RawMap(pluginHost, map, width, height, false); maps[i] = new RawMap(map, width, height, false, fileName);
} }
End: End:
br.Close(); br.Close();
palette = new RawPalette(pluginHost, colors, false, depth); palette = new RawPalette(colors, false, depth, fileName);
} }
public Size Get_Size(int index) public Size Get_Size(int index)

View File

@ -26,7 +26,7 @@ using System.Linq;
using System.Text; using System.Text;
using System.Xml.Linq; using System.Xml.Linq;
using System.Windows.Forms; using System.Windows.Forms;
using PluginInterface; using Ekona;
namespace AI_IGO_DS namespace AI_IGO_DS
{ {

View File

@ -22,8 +22,8 @@ using System.Collections.Generic;
using System.Linq; using System.Linq;
using System.Text; using System.Text;
using System.Windows.Forms; using System.Windows.Forms;
using PluginInterface; using Ekona;
using PluginInterface.Images; using Ekona.Images;
namespace AI_IGO_DS namespace AI_IGO_DS
{ {
@ -44,65 +44,75 @@ namespace AI_IGO_DS
return false; return false;
} }
public Format Get_Format(string nombre, byte[] magic, int id) public Format Get_Format(sFile file, byte[] magic)
{ {
nombre = nombre.ToUpper(); if (file.name.ToUpper().EndsWith(".ANCL"))
if (nombre.EndsWith(".ANCL"))
return Format.Palette; return Format.Palette;
else if (nombre.EndsWith(".ANCG")) else if (file.name.ToUpper().EndsWith(".ANCG"))
return Format.Tile; return Format.Tile;
else if (nombre.EndsWith(".ATEX")) else if (file.name.ToUpper().EndsWith(".ATEX"))
return Format.Tile; return Format.Tile;
else if (nombre.EndsWith(".ANSC")) else if (file.name.ToUpper().EndsWith(".ANSC"))
return Format.Map; return Format.Map;
else if (nombre.EndsWith("FAT.BIN") || nombre.EndsWith("FNT.BIN") || nombre.EndsWith("ARM9.BIN") || else if (file.name.ToUpper().EndsWith("FAT.BIN") || file.name.ToUpper().EndsWith("FNT.BIN") ||
nombre.EndsWith("ARM7.BIN")) file.name.ToUpper().EndsWith("ARM9.BIN") || file.name.ToUpper().EndsWith("ARM7.BIN"))
return Format.System; return Format.System;
else if (nombre.EndsWith(".BIN") || nombre.EndsWith(".R00")) else if (file.name.ToUpper().EndsWith(".BIN") || file.name.ToUpper().EndsWith(".R00"))
return Format.FullImage; return Format.FullImage;
return Format.Unknown; return Format.Unknown;
} }
public void Read(string archivo, int id) public void Read(sFile file)
{ {
if (archivo.ToUpper().EndsWith(".ANCL")) if (file.name.ToUpper().EndsWith(".ANCL"))
new ANCL(pluginHost, archivo, id); {
else if (archivo.ToUpper().EndsWith(".ANCG")) ANCL ancl = new ANCL(file.path, file.id, file.name);
new ANCG(pluginHost, archivo, id); pluginHost.Set_Palette(ancl);
else if (archivo.ToUpper().EndsWith(".ANSC")) }
new ANSC(pluginHost, archivo, id); else if (file.name.ToUpper().EndsWith(".ANCG"))
else if (archivo.ToUpper().EndsWith(".ATEX")) {
new ATEX(pluginHost, archivo, id); ANCG ancg = new ANCG(file.path, file.id, file.name);
pluginHost.Set_Image(ancg);
}
else if (file.name.ToUpper().EndsWith(".ANSC"))
{
ANSC ansc = new ANSC(file.path, file.id, file.name);
pluginHost.Set_Map(ansc);
}
else if (file.name.ToUpper().EndsWith(".ATEX"))
{
ATEX atex = new ATEX(file.path, file.id, file.name);
pluginHost.Set_Image(atex);
}
} }
public Control Show_Info(string archivo, int id) public Control Show_Info(sFile file)
{ {
Read(archivo, id); Read(file);
if (archivo.ToUpper().EndsWith(".ANCL")) if (file.name.ToUpper().EndsWith(".ANCL"))
return new PaletteControl(pluginHost, pluginHost.Get_Palette()); return new PaletteControl(pluginHost, pluginHost.Get_Palette());
if (archivo.ToUpper().EndsWith(".ANCG") && pluginHost.Get_Palette().Loaded) if (file.name.ToUpper().EndsWith(".ANCG") && pluginHost.Get_Palette().Loaded)
return new ImageControl(pluginHost, pluginHost.Get_Image(), pluginHost.Get_Palette()); return new ImageControl(pluginHost, pluginHost.Get_Image(), pluginHost.Get_Palette());
if (archivo.ToUpper().EndsWith(".ANSC") && pluginHost.Get_Palette().Loaded && pluginHost.Get_Image().Loaded) if (file.name.ToUpper().EndsWith(".ANSC") && pluginHost.Get_Palette().Loaded && pluginHost.Get_Image().Loaded)
return new ImageControl(pluginHost, pluginHost.Get_Image(), pluginHost.Get_Palette(), pluginHost.Get_Map()); return new ImageControl(pluginHost, pluginHost.Get_Image(), pluginHost.Get_Palette(), pluginHost.Get_Map());
if (archivo.ToUpper().EndsWith(".ATEX") && pluginHost.Get_Palette().Loaded) if (file.name.ToUpper().EndsWith(".ATEX") && pluginHost.Get_Palette().Loaded)
return new ImageControl(pluginHost, pluginHost.Get_Image(), pluginHost.Get_Palette()); return new ImageControl(pluginHost, pluginHost.Get_Image(), pluginHost.Get_Palette());
if (archivo.ToUpper().EndsWith(".BIN") && !archivo.EndsWith("fat.bin") && !archivo.EndsWith("fnt.bin") && if (file.name.ToUpper().EndsWith(".BIN") && !file.name.ToUpper().EndsWith("fat.bin") && !file.name.ToUpper().EndsWith("fnt.bin") &&
!archivo.EndsWith("arm9.bin") && !archivo.EndsWith("arm7.bin")) !file.name.ToUpper().EndsWith("arm9.bin") && !file.name.ToUpper().EndsWith("arm7.bin"))
return new BinControl(pluginHost, new BIN(pluginHost, archivo, id)); return new BinControl(pluginHost, new BIN(file.path, file.id, file.name));
if (archivo.ToUpper().EndsWith(".R00")) if (file.name.ToUpper().EndsWith(".R00"))
return new R00(pluginHost, archivo, id).Get_Control(); return new R00(pluginHost, file.path, file.id).Get_Control();
return new Control(); return new Control();
} }
public String Pack(ref sFolder unpacked, string file, int id) { return null; } public String Pack(ref sFolder unpacked, sFile file) { return null; }
public sFolder Unpack(string file, int id) { return new sFolder(); } public sFolder Unpack(sFile file) { return new sFolder(); }
} }
} }

View File

@ -24,8 +24,8 @@ using System.Text;
using System.IO; using System.IO;
using System.Drawing; using System.Drawing;
using System.Windows.Forms; using System.Windows.Forms;
using PluginInterface; using Ekona;
using PluginInterface.Images; using Ekona.Images;
namespace AI_IGO_DS namespace AI_IGO_DS
{ {
@ -33,8 +33,9 @@ namespace AI_IGO_DS
{ {
PaletteBase palette; PaletteBase palette;
ImageBase image; ImageBase image;
IPluginHost pluginHost;
public R00(IPluginHost pluginHost, string file, int id) : base(pluginHost, file, id) { } public R00(IPluginHost pluginHost, string file, int id, string fileName = "") : base(file, id, fileName) { this.pluginHost = pluginHost; }
public Control Get_Control() public Control Get_Control()
{ {
@ -57,7 +58,7 @@ namespace AI_IGO_DS
Color[][] colors = new Color[1][]; Color[][] colors = new Color[1][];
colors[0] = Actions.BGR555ToColor(br.ReadBytes((int)(pSize - 0x08))); colors[0] = Actions.BGR555ToColor(br.ReadBytes((int)(pSize - 0x08)));
palette = new RawPalette(pluginHost, colors, false, ColorFormat.colors256); palette = new RawPalette(colors, false, ColorFormat.colors256);
// Image data // Image data
br.BaseStream.Position = tileOffset; br.BaseStream.Position = tileOffset;
@ -65,7 +66,7 @@ namespace AI_IGO_DS
uint tSize = br.ReadUInt32() * 4; uint tSize = br.ReadUInt32() * 4;
byte[] tiles = br.ReadBytes((int)(tSize - 0x08)); byte[] tiles = br.ReadBytes((int)(tSize - 0x08));
image = new RawImage(pluginHost, tiles, TileForm.Horizontal, ColorFormat.colors256, 256, 192, false); image = new RawImage(tiles, TileForm.Horizontal, ColorFormat.colors256, 256, 192, false);
// Map // Map
br.BaseStream.Position = mapOffset; br.BaseStream.Position = mapOffset;

View File

@ -32,8 +32,9 @@
<WarningLevel>4</WarningLevel> <WarningLevel>4</WarningLevel>
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>
<Reference Include="PluginInterface"> <Reference Include="Ekona, Version=7.0.0.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\..\..\Tinke rev112\Tinke\PluginInterface.dll</HintPath> <SpecificVersion>False</SpecificVersion>
<HintPath>..\..\..\Ekona\bin\Debug\Ekona.dll</HintPath>
</Reference> </Reference>
<Reference Include="System" /> <Reference Include="System" />
<Reference Include="System.Data" /> <Reference Include="System.Data" />

View File

@ -22,7 +22,7 @@ using System.Collections.Generic;
using System.Linq; using System.Linq;
using System.Text; using System.Text;
using System.IO; using System.IO;
using PluginInterface; using Ekona;
namespace BLOODBAHAMUT namespace BLOODBAHAMUT
{ {

View File

@ -20,7 +20,7 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Text; using System.Text;
using PluginInterface; using Ekona;
namespace BLOODBAHAMUT namespace BLOODBAHAMUT
{ {
@ -42,34 +42,34 @@ namespace BLOODBAHAMUT
return false; return false;
} }
public Format Get_Format(string fileName, byte[] magic, int id) public Format Get_Format(sFile file, byte[] magic)
{ {
if (fileName.ToUpper().EndsWith(".DPK")) if (file.name.ToUpper().EndsWith(".DPK"))
return Format.Pack; return Format.Pack;
return Format.Unknown; return Format.Unknown;
} }
public string Pack(ref sFolder unpacked, string file, int id) public string Pack(ref sFolder unpacked, sFile file)
{ {
if (file.ToUpper().EndsWith(".DPK")) if (file.name.ToUpper().EndsWith(".DPK"))
return DPK.Pack(ref unpacked, file, id); return DPK.Pack(ref unpacked, file.path, file.id);
return null; return null;
} }
public sFolder Unpack(string file, int id) public sFolder Unpack(sFile file)
{ {
if (file.ToUpper().EndsWith(".DPK")) if (file.name.ToUpper().EndsWith(".DPK"))
return DPK.Unpack(file, pluginHost); return DPK.Unpack(file.path, pluginHost);
return new sFolder(); return new sFolder();
} }
public void Read(string file, int id) public void Read(sFile file)
{ {
} }
public System.Windows.Forms.Control Show_Info(string file, int id) public System.Windows.Forms.Control Show_Info(sFile file)
{ {
return new System.Windows.Forms.Control(); return new System.Windows.Forms.Control();
} }

View File

@ -60,9 +60,9 @@
<ErrorReport>prompt</ErrorReport> <ErrorReport>prompt</ErrorReport>
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>
<Reference Include="PluginInterface, Version=1.0.0.0, Culture=neutral, processorArchitecture=MSIL"> <Reference Include="Ekona, Version=7.0.0.0, Culture=neutral, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion> <SpecificVersion>False</SpecificVersion>
<HintPath>..\..\..\PluginInterface\bin\Debug\PluginInterface.dll</HintPath> <HintPath>..\..\..\Ekona\bin\Debug\Ekona.dll</HintPath>
</Reference> </Reference>
<Reference Include="System" /> <Reference Include="System" />
<Reference Include="System.Core" /> <Reference Include="System.Core" />

View File

@ -24,7 +24,7 @@ using System.Text;
using System.IO; using System.IO;
using System.Windows.Forms; using System.Windows.Forms;
using System.Drawing; using System.Drawing;
using PluginInterface; using Ekona;
namespace Common namespace Common
{ {

View File

@ -26,7 +26,7 @@ using System.Linq;
using System.Text; using System.Text;
using System.IO; using System.IO;
using System.Windows.Forms; using System.Windows.Forms;
using PluginInterface; using Ekona;
namespace Common namespace Common
{ {

View File

@ -21,7 +21,7 @@ using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq; using System.Linq;
using System.Text; using System.Text;
using PluginInterface; using Ekona;
using System.Windows.Forms; using System.Windows.Forms;
using System.Drawing; using System.Drawing;
using System.IO; using System.IO;

View File

@ -24,7 +24,7 @@ using System.Text;
using System.IO; using System.IO;
using System.Windows.Forms; using System.Windows.Forms;
using System.Drawing; using System.Drawing;
using PluginInterface; using Ekona;
namespace Common namespace Common
{ {

View File

@ -24,8 +24,8 @@ using System.Text;
using System.Windows.Forms; using System.Windows.Forms;
using System.Drawing; using System.Drawing;
using System.IO; using System.IO;
using PluginInterface; using Ekona;
using PluginInterface.Images; using Ekona.Images;
namespace Common namespace Common
{ {

View File

@ -21,7 +21,7 @@ using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq; using System.Linq;
using System.Text; using System.Text;
using PluginInterface; using Ekona;
using System.Windows.Forms; using System.Windows.Forms;
namespace Common namespace Common
@ -30,16 +30,15 @@ namespace Common
{ {
IPluginHost pluginHost; IPluginHost pluginHost;
public Format Get_Format(string nombre, byte[] magic, int id) public Format Get_Format(sFile file, byte[] magic)
{ {
nombre = nombre.ToUpper();
string ext = new String(Encoding.ASCII.GetChars(magic)); string ext = new String(Encoding.ASCII.GetChars(magic));
if (nombre.EndsWith(".TGA") || nombre.EndsWith(".JPG") || nombre.EndsWith(".PNG")) if (file.name.ToUpper().EndsWith(".TGA") || file.name.ToUpper().EndsWith(".JPG") || file.name.ToUpper().EndsWith(".PNG"))
return Format.FullImage; return Format.FullImage;
else if (nombre.EndsWith(".BMP") && magic[0] == 'B' && magic[1] == 'M') else if (file.name.ToUpper().EndsWith(".BMP") && magic[0] == 'B' && magic[1] == 'M')
return Format.FullImage; return Format.FullImage;
else if (nombre.EndsWith(".WAV") || ext == "RIFF") else if (file.name.ToUpper().EndsWith(".WAV") || ext == "RIFF")
return Format.Sound; return Format.Sound;
return Format.Unknown; return Format.Unknown;
@ -50,32 +49,30 @@ namespace Common
this.pluginHost = pluginHost; this.pluginHost = pluginHost;
} }
public void Read(string archivo, int id) public void Read(sFile file) { }
public Control Show_Info(sFile file)
{ {
} System.IO.BinaryReader br = new System.IO.BinaryReader(System.IO.File.OpenRead(file.path));
public Control Show_Info(string archivo, int id)
{
System.IO.BinaryReader br = new System.IO.BinaryReader(System.IO.File.OpenRead(archivo));
string ext = ""; string ext = "";
try { ext = new String(br.ReadChars(4)); } try { ext = new String(br.ReadChars(4)); }
catch { } catch { }
br.Close(); br.Close();
if (archivo.ToUpper().EndsWith(".TGA")) if (file.name.ToUpper().EndsWith(".TGA"))
return new TGA(pluginHost, archivo).Show_Info(); return new TGA(pluginHost, file.path).Show_Info();
else if (archivo.ToUpper().EndsWith(".JPG")) else if (file.name.ToUpper().EndsWith(".JPG"))
return new JPG(pluginHost, archivo).Show_Info(); return new JPG(pluginHost, file.path).Show_Info();
else if (archivo.ToUpper().EndsWith(".PNG")) else if (file.name.ToUpper().EndsWith(".PNG"))
return new PNG(pluginHost, archivo).Show_Info(); return new PNG(pluginHost, file.path).Show_Info();
else if (archivo.ToUpper().EndsWith(".WAV") || ext == "RIFF") else if (file.name.ToUpper().EndsWith(".WAV") || ext == "RIFF")
return new WAV(pluginHost, archivo).Show_Info(); return new WAV(pluginHost, file.path).Show_Info();
else if (archivo.ToUpper().EndsWith(".BMP")) else if (file.name.ToUpper().EndsWith(".BMP"))
return new BMP(pluginHost, archivo).Show_Info(); return new BMP(pluginHost, file.path).Show_Info();
return new Control(); return new Control();
} }
public string Pack(ref sFolder unpacked, string file) { return null; } public string Pack(ref sFolder unpacked, sFile file) { return null; }
public sFolder Unpack(string file) { return new sFolder(); } public sFolder Unpack(sFile file) { return new sFolder(); }
} }
} }

View File

@ -21,7 +21,7 @@ using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq; using System.Linq;
using System.Text; using System.Text;
using PluginInterface; using Ekona;
using System.Windows.Forms; using System.Windows.Forms;
namespace Common namespace Common

View File

@ -26,7 +26,7 @@ using System.Linq;
using System.Text; using System.Text;
using System.Windows.Forms; using System.Windows.Forms;
using System.IO; using System.IO;
using PluginInterface; using Ekona;
namespace Common namespace Common
{ {

View File

@ -22,7 +22,7 @@ using System.Collections.Generic;
using System.Linq; using System.Linq;
using System.Text; using System.Text;
using System.IO; using System.IO;
using PluginInterface; using Ekona;
namespace DBK_ULTIMATE namespace DBK_ULTIMATE
{ {
@ -30,9 +30,6 @@ namespace DBK_ULTIMATE
{ {
public static sFolder Unpack_archiveDBK(IPluginHost pluginHost, string file) public static sFolder Unpack_archiveDBK(IPluginHost pluginHost, string file)
{ {
string packFile = pluginHost.Get_TempFolder() + Path.DirectorySeparatorChar + "pack_" + Path.GetFileName(file);
File.Copy(file, packFile, true);
BinaryReader br = new BinaryReader(File.OpenRead(file)); BinaryReader br = new BinaryReader(File.OpenRead(file));
sFolder unpacked = new sFolder(); sFolder unpacked = new sFolder();
unpacked.files = new List<sFile>(); unpacked.files = new List<sFile>();
@ -74,7 +71,7 @@ namespace DBK_ULTIMATE
for (int i = 0; i < unpacked.folders[f].files.Capacity; i++) // Read all files, the id start at 0 for (int i = 0; i < unpacked.folders[f].files.Capacity; i++) // Read all files, the id start at 0
{ {
sFile newFile = new sFile(); sFile newFile = new sFile();
newFile.path = packFile; newFile.path = file;
uint name_length = br.ReadUInt32(); uint name_length = br.ReadUInt32();
uint name_offset = 0x00; uint name_offset = 0x00;
@ -120,7 +117,7 @@ namespace DBK_ULTIMATE
for (int i = 0; i < unpacked.folders[f].folders[f2].files.Capacity; i++) // Read all files, the id start at 0 for (int i = 0; i < unpacked.folders[f].folders[f2].files.Capacity; i++) // Read all files, the id start at 0
{ {
sFile newFile = new sFile(); sFile newFile = new sFile();
newFile.path = packFile; newFile.path = file;
uint name_length = br.ReadUInt32(); uint name_length = br.ReadUInt32();
uint name_offset = 0x00; uint name_offset = 0x00;

View File

@ -32,8 +32,9 @@
<WarningLevel>4</WarningLevel> <WarningLevel>4</WarningLevel>
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>
<Reference Include="PluginInterface"> <Reference Include="Ekona, Version=7.0.0.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\..\..\PluginInterface\bin\Debug\PluginInterface.dll</HintPath> <SpecificVersion>False</SpecificVersion>
<HintPath>..\..\..\Ekona\bin\Debug\Ekona.dll</HintPath>
</Reference> </Reference>
<Reference Include="System" /> <Reference Include="System" />
<Reference Include="System.Data" /> <Reference Include="System.Data" />

View File

@ -20,7 +20,7 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Text; using System.Text;
using PluginInterface; using Ekona;
namespace DBK_ULTIMATE namespace DBK_ULTIMATE
{ {
@ -43,29 +43,27 @@ namespace DBK_ULTIMATE
} }
public Format Get_Format(string fileName, byte[] magic, int id) public Format Get_Format(sFile file, byte[] magic)
{ {
if (fileName == "archiveDBK.dsa") if (file.name == "archiveDBK.dsa")
return Format.Pack; return Format.Pack;
return Format.Unknown; return Format.Unknown;
} }
public void Read(string file, int id) public void Read(sFile file) { }
{ public System.Windows.Forms.Control Show_Info(sFile file)
}
public System.Windows.Forms.Control Show_Info(string file, int id)
{ {
return new System.Windows.Forms.Control(); return new System.Windows.Forms.Control();
} }
public sFolder Unpack(string file, int id) public sFolder Unpack(sFile file)
{ {
if (System.IO.Path.GetFileName(file) == "110archiveDBK.dsa") if (file.name == "archiveDBK.dsa")
return Archive.Unpack_archiveDBK(pluginHost, file); return Archive.Unpack_archiveDBK(pluginHost, file.path);
return new sFolder(); return new sFolder();
} }
public string Pack(ref sFolder unpacked, string file, int id) { return null; } public string Pack(ref sFolder unpacked, sFile file) { return null; }
} }
} }

View File

@ -32,8 +32,9 @@
<WarningLevel>4</WarningLevel> <WarningLevel>4</WarningLevel>
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>
<Reference Include="PluginInterface"> <Reference Include="Ekona, Version=7.0.0.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\..\..\PluginInterface\bin\Debug\PluginInterface.dll</HintPath> <SpecificVersion>False</SpecificVersion>
<HintPath>..\..\..\Ekona\bin\Debug\Ekona.dll</HintPath>
</Reference> </Reference>
<Reference Include="System" /> <Reference Include="System" />
<Reference Include="System.Data" /> <Reference Include="System.Data" />

View File

@ -25,7 +25,7 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Text; using System.Text;
using PluginInterface; using Ekona;
namespace DEATHNOTEDS namespace DEATHNOTEDS
{ {
@ -47,32 +47,32 @@ namespace DEATHNOTEDS
return false; return false;
} }
public Format Get_Format(string fileName, byte[] magic, int id) public Format Get_Format(sFile file, byte[] magic)
{ {
if (gameCode == "YDNJ" && id == 0x1) if (gameCode == "YDNJ" && file.id == 0x1)
return Format.Pack; return Format.Pack;
return Format.Unknown; return Format.Unknown;
} }
public string Pack(ref sFolder unpacked, string file, int id) public string Pack(ref sFolder unpacked, sFile file)
{ {
System.Windows.Forms.MessageBox.Show("TODO ;)\nIf you need it please contact with me"); System.Windows.Forms.MessageBox.Show("TODO ;)\nIf you need it please contact with me");
return ""; return "";
} }
public sFolder Unpack(string file, int id) public sFolder Unpack(sFile file)
{ {
if (gameCode == "YDNJ" && id == 0x01) if (gameCode == "YDNJ" && file.id == 0x01)
return Packs.Unpack_data(file); return Packs.Unpack_data(file);
return new sFolder(); return new sFolder();
} }
public void Read(string file, int id) public void Read(sFile file)
{ {
} }
public System.Windows.Forms.Control Show_Info(string file, int id) public System.Windows.Forms.Control Show_Info(sFile file)
{ {
return new System.Windows.Forms.Control(); return new System.Windows.Forms.Control();
} }

View File

@ -27,26 +27,26 @@ using System.Collections.Generic;
using System.Linq; using System.Linq;
using System.Text; using System.Text;
using System.IO; using System.IO;
using PluginInterface; using Ekona;
namespace DEATHNOTEDS namespace DEATHNOTEDS
{ {
public static class Packs public static class Packs
{ {
public static sFolder Unpack_data(string file) public static sFolder Unpack_data(sFile file)
{ {
sFolder unpacked = new sFolder(); sFolder unpacked = new sFolder();
unpacked.files = new List<sFile>(); unpacked.files = new List<sFile>();
BinaryReader br = new BinaryReader(File.OpenRead(file)); BinaryReader br = new BinaryReader(File.OpenRead(file.path));
uint num_files = br.ReadUInt32(); uint num_files = br.ReadUInt32();
for (int i = 0; i < num_files; i++) for (int i = 0; i < num_files; i++)
{ {
sFile newFile = new sFile(); sFile newFile = new sFile();
newFile.name = "File " + i.ToString(); newFile.name = Path.GetFileNameWithoutExtension(file.name) + '_' + i.ToString() + ".bin";
newFile.offset = br.ReadUInt32() * 4; newFile.offset = br.ReadUInt32() * 4;
newFile.size = br.ReadUInt32(); newFile.size = br.ReadUInt32();
newFile.path = file; newFile.path = file.path;
unpacked.files.Add(newFile); unpacked.files.Add(newFile);
} }

View File

@ -29,7 +29,7 @@ using System.Drawing;
using System.Data; using System.Data;
using System.Text; using System.Text;
using System.Windows.Forms; using System.Windows.Forms;
using PluginInterface; using Ekona;
namespace DSDecmp namespace DSDecmp
{ {

View File

@ -78,9 +78,9 @@
</EmbeddedResource> </EmbeddedResource>
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<ProjectReference Include="..\..\..\PluginInterface\PluginInterface.csproj"> <ProjectReference Include="..\..\..\Ekona\Ekona.csproj">
<Project>{736010D3-F72F-4C56-B8D2-2EDD1B8F3A87}</Project> <Project>{736010D3-F72F-4C56-B8D2-2EDD1B8F3A87}</Project>
<Name>PluginInterface</Name> <Name>Ekona</Name>
</ProjectReference> </ProjectReference>
</ItemGroup> </ItemGroup>
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" /> <Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />

View File

@ -5,7 +5,7 @@ using DSDecmp.Formats.Nitro;
using DSDecmp.Formats; using DSDecmp.Formats;
using System.IO; using System.IO;
using System.Xml.Linq; using System.Xml.Linq;
using PluginInterface; using Ekona;
namespace DSDecmp namespace DSDecmp
{ {

View File

@ -32,9 +32,9 @@
<WarningLevel>4</WarningLevel> <WarningLevel>4</WarningLevel>
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>
<Reference Include="PluginInterface, Version=4.0.0.0, Culture=neutral, processorArchitecture=MSIL"> <Reference Include="Ekona, Version=7.0.0.0, Culture=neutral, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion> <SpecificVersion>False</SpecificVersion>
<HintPath>..\..\..\PluginInterface\bin\Debug\PluginInterface.dll</HintPath> <HintPath>..\..\..\Ekona\bin\Debug\Ekona.dll</HintPath>
</Reference> </Reference>
<Reference Include="System" /> <Reference Include="System" />
<Reference Include="System.Core" /> <Reference Include="System.Core" />

View File

@ -23,7 +23,7 @@ using System.Linq;
using System.Text; using System.Text;
using System.IO; using System.IO;
using System.Windows.Forms; using System.Windows.Forms;
using PluginInterface; using Ekona;
namespace EDGEWORTH namespace EDGEWORTH
{ {
@ -34,17 +34,15 @@ namespace EDGEWORTH
public bool IsCompatible() public bool IsCompatible()
{ {
if (gameCode == "C32P" || gameCode == "C32J") if (gameCode == "C32P" || gameCode == "C32J" || gameCode == "C32E")
return true; return true;
return false; return false;
} }
public Format Get_Format(string nombre, byte[] magic, int id) public Format Get_Format(sFile file, byte[] magic)
{ {
nombre = nombre.ToUpper(); if (file.name.ToUpper() == "ROMFILE.BIN")
if (nombre == "ROMFILE.BIN")
return Format.Pack; return Format.Pack;
return Format.Unknown; return Format.Unknown;
@ -56,19 +54,19 @@ namespace EDGEWORTH
this.gameCode = gameCode; this.gameCode = gameCode;
} }
public void Read(string archivo, int id) public void Read(sFile file)
{ {
} }
public Control Show_Info(string archivo, int id) public Control Show_Info(sFile file)
{ {
return new Control(); return new Control();
} }
public string Pack(ref sFolder unpacked, string file, int id) public string Pack(ref sFolder unpacked, sFile file)
{ {
if (file.ToUpper().EndsWith("ROMFILE.BIN")) if (file.name.ToUpper().EndsWith("ROMFILE.BIN"))
{ {
String packFile = pluginHost.Get_TempFolder() + Path.DirectorySeparatorChar + "pack_romfile.bin"; String packFile = pluginHost.Get_TempFile();
if (File.Exists(packFile)) if (File.Exists(packFile))
File.Delete(packFile); File.Delete(packFile);
@ -78,9 +76,9 @@ namespace EDGEWORTH
return null; return null;
} }
public sFolder Unpack(string file, int id) public sFolder Unpack(sFile file)
{ {
if (file.ToUpper().EndsWith("ROMFILE.BIN")) if (file.name.ToUpper().EndsWith("ROMFILE.BIN"))
{ {
System.Threading.Thread waiting = new System.Threading.Thread(ThreadWait); System.Threading.Thread waiting = new System.Threading.Thread(ThreadWait);
String lang = ""; String lang = "";
@ -93,7 +91,7 @@ namespace EDGEWORTH
catch { throw new NotSupportedException("There was an error reading the language file"); } catch { throw new NotSupportedException("There was an error reading the language file"); }
waiting.Start(lang); waiting.Start(lang);
sFolder desc = PACK.Unpack(file, pluginHost); sFolder desc = PACK.Unpack(file.path, pluginHost);
waiting.Abort(); waiting.Abort();
return desc; return desc;

View File

@ -22,7 +22,7 @@ using System.Collections.Generic;
using System.Linq; using System.Linq;
using System.Text; using System.Text;
using System.IO; using System.IO;
using PluginInterface; using Ekona;
namespace EDGEWORTH namespace EDGEWORTH
{ {
@ -30,8 +30,6 @@ namespace EDGEWORTH
{ {
public static sFolder Unpack(string file, IPluginHost pluginHost) public static sFolder Unpack(string file, IPluginHost pluginHost)
{ {
String romFile = pluginHost.Get_TempFolder() + Path.DirectorySeparatorChar + Path.GetRandomFileName();
File.Copy(file, romFile, true);
BinaryReader br = new BinaryReader(File.OpenRead(file)); BinaryReader br = new BinaryReader(File.OpenRead(file));
sFolder unpacked = new sFolder(); sFolder unpacked = new sFolder();
unpacked.files = new List<sFile>(); unpacked.files = new List<sFile>();
@ -47,7 +45,7 @@ namespace EDGEWORTH
sFile newFile = new sFile(); sFile newFile = new sFile();
newFile.name = "File " + i.ToString() + ".bin"; newFile.name = "File " + i.ToString() + ".bin";
newFile.offset = startOffset + 4; newFile.offset = startOffset + 4;
newFile.path = romFile; newFile.path = file;
newFile.size = br.ReadUInt32(); newFile.size = br.ReadUInt32();
br.BaseStream.Position = currPos; br.BaseStream.Position = currPos;

View File

@ -25,7 +25,7 @@ using System.Data;
using System.Linq; using System.Linq;
using System.Text; using System.Text;
using System.Windows.Forms; using System.Windows.Forms;
using PluginInterface; using Ekona;
namespace Fonts namespace Fonts
{ {

View File

@ -32,9 +32,9 @@
<WarningLevel>4</WarningLevel> <WarningLevel>4</WarningLevel>
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>
<Reference Include="PluginInterface, Version=2.2.0.0, Culture=neutral, processorArchitecture=MSIL"> <Reference Include="Ekona, Version=7.0.0.0, Culture=neutral, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion> <SpecificVersion>False</SpecificVersion>
<HintPath>..\..\..\PluginInterface\bin\Debug\PluginInterface.dll</HintPath> <HintPath>..\..\..\Ekona\bin\Debug\Ekona.dll</HintPath>
</Reference> </Reference>
<Reference Include="System" /> <Reference Include="System" />
<Reference Include="System.Data" /> <Reference Include="System.Data" />

View File

@ -20,7 +20,7 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Text; using System.Text;
using PluginInterface; using Ekona;
namespace Fonts namespace Fonts
{ {
@ -32,7 +32,7 @@ namespace Fonts
{ {
this.pluginHost = pluginHost; this.pluginHost = pluginHost;
} }
public Format Get_Format(string nombre, byte[] magic, int id) public Format Get_Format(sFile file, byte[] magic)
{ {
string ext = new String(Encoding.ASCII.GetChars(magic)); string ext = new String(Encoding.ASCII.GetChars(magic));
@ -42,24 +42,24 @@ namespace Fonts
return Format.Unknown; return Format.Unknown;
} }
public void Read(string archivo, int id) public void Read(sFile file)
{ {
} }
public System.Windows.Forms.Control Show_Info(string archivo, int id) public System.Windows.Forms.Control Show_Info(sFile file)
{ {
System.IO.BinaryReader br = new System.IO.BinaryReader(System.IO.File.OpenRead(archivo)); System.IO.BinaryReader br = new System.IO.BinaryReader(System.IO.File.OpenRead(file.path));
string ext = new String(br.ReadChars(4)); string ext = new String(br.ReadChars(4));
br.Close(); br.Close();
if (ext == "NFTR" || ext == "RTFN") if (ext == "NFTR" || ext == "RTFN")
{ {
return new FontControl(pluginHost, NFTR.Read(archivo, id, pluginHost.Get_Language())); return new FontControl(pluginHost, NFTR.Read(file.path, file.id, pluginHost.Get_Language()));
} }
return new System.Windows.Forms.Control(); return new System.Windows.Forms.Control();
} }
public String Pack(ref sFolder unpacked, string file) { return null; } public String Pack(ref sFolder unpacked, sFile file) { return null; }
public sFolder Unpack(string file) { return new sFolder(); } public sFolder Unpack(sFile file) { return new sFolder(); }
} }
} }

View File

@ -24,7 +24,7 @@ using System.Text;
using System.IO; using System.IO;
using System.Drawing; using System.Drawing;
using System.Xml.Linq; using System.Xml.Linq;
using PluginInterface; using Ekona;
namespace Fonts namespace Fonts
{ {

View File

@ -32,9 +32,9 @@
<WarningLevel>4</WarningLevel> <WarningLevel>4</WarningLevel>
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>
<Reference Include="PluginInterface, Version=3.0.0.0, Culture=neutral, processorArchitecture=MSIL"> <Reference Include="Ekona, Version=7.0.0.0, Culture=neutral, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion> <SpecificVersion>False</SpecificVersion>
<HintPath>..\..\..\PluginInterface\bin\Debug\PluginInterface.dll</HintPath> <HintPath>..\..\..\Ekona\bin\Debug\Ekona.dll</HintPath>
</Reference> </Reference>
<Reference Include="System" /> <Reference Include="System" />
<Reference Include="System.Data" /> <Reference Include="System.Data" />

View File

@ -20,7 +20,7 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Text; using System.Text;
using PluginInterface; using Ekona;
namespace GYAKUKEN namespace GYAKUKEN
{ {
@ -42,13 +42,13 @@ namespace GYAKUKEN
return false; return false;
} }
public Format Get_Format(string fileName, byte[] magic, int id) public Format Get_Format(sFile file, byte[] magic)
{ {
uint offset = BitConverter.ToUInt32(magic, 0); uint offset = BitConverter.ToUInt32(magic, 0);
if (fileName.ToUpper().EndsWith(".BIN")) if (file.name.ToUpper().EndsWith(".BIN"))
return Format.Pack; return Format.Pack;
else if (fileName.ToUpper().EndsWith(".DBIN") && IsPack2(fileName) && offset == 0x0C) else if (file.name.ToUpper().EndsWith(".DBIN") && IsPack2(file.name) && offset == 0x0C)
return Format.Pack; return Format.Pack;
return Format.Unknown; return Format.Unknown;
@ -56,14 +56,14 @@ namespace GYAKUKEN
private bool IsPack2(string name) private bool IsPack2(string name)
{ {
List<string> pack2 = new List<string>(); List<string> pack2 = new List<string>();
pack2.Add("48bustup.bin"); pack2.Add("bustup.bin");
pack2.Add("50cutobj.bin"); pack2.Add("cutobj.bin");
pack2.Add("52idcom.bin"); pack2.Add("idcom.bin");
pack2.Add("54logic_keyword.bin"); pack2.Add("logic_keyword.bin");
pack2.Add("60mapchar.bin"); pack2.Add("mapchar.bin");
pack2.Add("87cutobj_local.bin"); pack2.Add("cutobj_local.bin");
pack2.Add("88idlocal.bin"); pack2.Add("idlocal.bin");
pack2.Add("89logic_keyword_local.bin"); pack2.Add("logic_keyword_local.bin");
foreach (string folder in pack2) foreach (string folder in pack2)
if (name.StartsWith(folder)) if (name.StartsWith(folder))
@ -72,28 +72,27 @@ namespace GYAKUKEN
return false; return false;
} }
public void Read(string file, int id) public void Read(sFile file)
{ {
} }
public System.Windows.Forms.Control Show_Info(sFile file)
public System.Windows.Forms.Control Show_Info(string file, int id)
{ {
return new System.Windows.Forms.Control(); return new System.Windows.Forms.Control();
} }
public sFolder Unpack(string file, int id) public sFolder Unpack(sFile file)
{ {
if (gameCode == "BXOJ") if (gameCode == "BXOJ")
{ {
if (file.ToUpper().EndsWith(".BIN")) if (file.name.ToUpper().EndsWith(".BIN"))
return PACK.Unpack(pluginHost, file); return PACK.Unpack(pluginHost, file);
else if (file.ToUpper().EndsWith(".DBIN")) else if (file.name.ToUpper().EndsWith(".DBIN"))
return PACK.Unpack2(pluginHost, file); return PACK.Unpack2(pluginHost, file);
} }
return new sFolder(); return new sFolder();
} }
public String Pack(ref sFolder unpacked, string file, int id) public String Pack(ref sFolder unpacked, sFile file)
{ {
return null; return null;
} }

View File

@ -22,7 +22,7 @@ using System.Collections.Generic;
using System.Linq; using System.Linq;
using System.Text; using System.Text;
using System.IO; using System.IO;
using PluginInterface; using Ekona;
namespace GYAKUKEN namespace GYAKUKEN
{ {
@ -31,12 +31,9 @@ namespace GYAKUKEN
/// </summary> /// </summary>
public static class PACK public static class PACK
{ {
public static sFolder Unpack(IPluginHost pluginHost, string file) public static sFolder Unpack(IPluginHost pluginHost, sFile file)
{ {
string packFile = pluginHost.Get_TempFolder() + Path.DirectorySeparatorChar + "pack_" + Path.GetFileName(file); BinaryReader br = new BinaryReader(File.OpenRead(file.path));
File.Copy(file, packFile, true);
BinaryReader br = new BinaryReader(File.OpenRead(file));
sFolder unpack = new sFolder(); sFolder unpack = new sFolder();
unpack.files = new List<sFile>(); unpack.files = new List<sFile>();
@ -52,9 +49,9 @@ namespace GYAKUKEN
break; break;
sFile currFile = new sFile(); sFile currFile = new sFile();
currFile.name = Path.GetFileName(file) + '_' + i.ToString() + ".dbin"; currFile.name = file.name + '_' + i.ToString() + ".dbin";
currFile.offset = currOffset; currFile.offset = currOffset;
currFile.path = packFile; currFile.path = file.path;
currOffset = br.ReadUInt32(); currOffset = br.ReadUInt32();
currFile.size = currOffset - currFile.offset; currFile.size = currOffset - currFile.offset;
@ -66,12 +63,9 @@ namespace GYAKUKEN
br.Close(); br.Close();
return unpack; return unpack;
} }
public static sFolder Unpack2(IPluginHost pluginHost, string file) public static sFolder Unpack2(IPluginHost pluginHost, sFile file)
{ {
string packFile = pluginHost.Get_TempFolder() + Path.DirectorySeparatorChar + "pack_" + Path.GetFileName(file); BinaryReader br = new BinaryReader(File.OpenRead(file.path));
File.Copy(file, packFile, true);
BinaryReader br = new BinaryReader(File.OpenRead(file));
sFolder unpack = new sFolder(); sFolder unpack = new sFolder();
unpack.files = new List<sFile>(); unpack.files = new List<sFile>();
@ -81,7 +75,7 @@ namespace GYAKUKEN
for (int i = 0; i < num_files; i++) for (int i = 0; i < num_files; i++)
{ {
sFile currFile = new sFile(); sFile currFile = new sFile();
currFile.name = "File" + i.ToString(); currFile.name = file.name + i.ToString();
if (i == 0) if (i == 0)
currFile.name += ".ncer"; currFile.name += ".ncer";
else if (i == 1) else if (i == 1)
@ -89,7 +83,7 @@ namespace GYAKUKEN
else if (i == 2) else if (i == 2)
currFile.name += ".ncgr"; currFile.name += ".ncgr";
currFile.offset = br.ReadUInt32(); currFile.offset = br.ReadUInt32();
currFile.path = packFile; currFile.path = file.path;
if (i + 1 == num_files) // Last file if (i + 1 == num_files) // Last file
currFile.size = (uint)br.BaseStream.Length - currFile.offset; currFile.size = (uint)br.BaseStream.Length - currFile.offset;

View File

@ -31,8 +31,9 @@
<WarningLevel>4</WarningLevel> <WarningLevel>4</WarningLevel>
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>
<Reference Include="PluginInterface"> <Reference Include="Ekona, Version=7.0.0.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\..\..\PluginInterface\bin\Debug\PluginInterface.dll</HintPath> <SpecificVersion>False</SpecificVersion>
<HintPath>..\..\..\Ekona\bin\Debug\Ekona.dll</HintPath>
</Reference> </Reference>
<Reference Include="System" /> <Reference Include="System" />
<Reference Include="System.Core" /> <Reference Include="System.Core" />

View File

@ -25,14 +25,16 @@
using System; using System;
using System.IO; using System.IO;
using System.Drawing; using System.Drawing;
using PluginInterface; using Ekona;
using PluginInterface.Images; using Ekona.Images;
namespace HETALIA namespace HETALIA
{ {
class IMY : ImageBase class IMY : ImageBase
{ {
public IMY(IPluginHost pluginHost, string file, int id) : base(pluginHost, file, id) { } IPluginHost pluginHost;
public IMY(IPluginHost pluginHost, string file, int id, string fileName = "") : base(file, id, fileName) { this.pluginHost = pluginHost; }
public override void Read(string fileIn) public override void Read(string fileIn)
{ {
@ -60,7 +62,7 @@ namespace HETALIA
byte[] pal = new byte[num_colors * 2]; byte[] pal = new byte[num_colors * 2];
Array.Copy(data, 0x20, pal, 0, pal.Length); Array.Copy(data, 0x20, pal, 0, pal.Length);
Color[] colors = Actions.BGR555ToColor(pal); Color[] colors = Actions.BGR555ToColor(pal);
RawPalette palette = new RawPalette(pluginHost, new Color[][] { colors }, false, format); RawPalette palette = new RawPalette(new Color[][] { colors }, false, format);
pluginHost.Set_Palette(palette); pluginHost.Set_Palette(palette);
pluginHost.Set_Image(this); pluginHost.Set_Image(this);

View File

@ -24,14 +24,16 @@
// ----------------------------------------------------------------------- // -----------------------------------------------------------------------
using System; using System;
using System.IO; using System.IO;
using PluginInterface; using Ekona;
using PluginInterface.Images; using Ekona.Images;
namespace HETALIA namespace HETALIA
{ {
class MAP : MapBase class MAP : MapBase
{ {
public MAP(IPluginHost pluginHost, string file, int id) : base(pluginHost, file, id) { } IPluginHost pluginHost;
public MAP(IPluginHost pluginHost, string file, int id, string fileName = "") : base(file, id, fileName) { this.pluginHost = pluginHost; }
public override void Read(string fileIn) public override void Read(string fileIn)
{ {
@ -59,7 +61,6 @@ namespace HETALIA
for (int i = 0; i < map.Length; i++) for (int i = 0; i < map.Length; i++)
{ {
map[i] = Actions.MapInfo(br.ReadUInt16()); map[i] = Actions.MapInfo(br.ReadUInt16());
//map[i].nTile--;
map[i].nPalette = 0; map[i].nPalette = 0;
} }
@ -71,14 +72,16 @@ namespace HETALIA
string imy_file = pluginHost.Get_TempFolder() + Path.DirectorySeparatorChar + Path.GetRandomFileName(); string imy_file = pluginHost.Get_TempFolder() + Path.DirectorySeparatorChar + Path.GetRandomFileName();
File.WriteAllBytes(imy_file, imy); File.WriteAllBytes(imy_file, imy);
// Read the file // Read the file
new IMY(pluginHost, imy_file, id); new IMY(pluginHost, imy_file, id, fileName);
// Change some image parameters // Change some image parameters
ImageBase img = pluginHost.Get_Image(); ImageBase img = pluginHost.Get_Image();
int tile_size = tile_width * tile_height * img.BPP / 8; int tile_size = tile_width * tile_height * img.BPP / 8;
// Set a zero tile in the beggining
byte[] newTiles = new byte[img.Tiles.Length + tile_size]; byte[] newTiles = new byte[img.Tiles.Length + tile_size];
Array.Copy(img.Tiles, 0, newTiles, tile_size, img.Tiles.Length); Array.Copy(img.Tiles, 0, newTiles, tile_size, img.Tiles.Length);
img.Set_Tiles(newTiles); img.Set_Tiles(newTiles);
img.TileSize = tile_width; img.TileSize = tile_width;
img.FormTile = TileForm.Horizontal; img.FormTile = TileForm.Horizontal;
pluginHost.Set_Image(img); pluginHost.Set_Image(img);

View File

@ -24,7 +24,7 @@
// ----------------------------------------------------------------------- // -----------------------------------------------------------------------
using System; using System;
using System.Text; using System.Text;
using PluginInterface; using Ekona;
namespace HETALIA namespace HETALIA
{ {
@ -46,11 +46,11 @@ namespace HETALIA
return false; return false;
} }
public Format Get_Format(string fileName, byte[] magic, int id) public Format Get_Format(sFile file, byte[] magic)
{ {
string ext = new String(Encoding.ASCII.GetChars(magic)); string ext = new String(Encoding.ASCII.GetChars(magic));
if (id == 0x01) if (file.id == 0x01)
return Format.Pack; return Format.Pack;
if (ext == "MAP\0" || ext == "IMY\0") if (ext == "MAP\0" || ext == "IMY\0")
return Format.FullImage; return Format.FullImage;
@ -58,32 +58,32 @@ namespace HETALIA
return Format.Unknown; return Format.Unknown;
} }
public string Pack(ref sFolder unpacked, string file, int id) public string Pack(ref sFolder unpacked, sFile file)
{ {
return null; return null;
} }
public sFolder Unpack(string file, int id) public sFolder Unpack(sFile file)
{ {
if (id == 0x01) if (file.id == 0x01)
return HETALIA.Pack.DATA.Unpack(file); return HETALIA.Pack.DATA.Unpack(file);
return new sFolder(); return new sFolder();
} }
public void Read(string file, int id) public void Read(sFile file)
{ {
} }
public System.Windows.Forms.Control Show_Info(string file, int id) public System.Windows.Forms.Control Show_Info(sFile file)
{ {
if (file.EndsWith(".IMY")) if (file.name.EndsWith(".IMY"))
{ {
new IMY(pluginHost, file, id); new IMY(pluginHost, file.path, file.id);
return new PluginInterface.Images.ImageControl(pluginHost, false); return new Ekona.Images.ImageControl(pluginHost, false);
} }
else if (file.EndsWith(".MAP")) else if (file.name.EndsWith(".MAP"))
{ {
new MAP(pluginHost, file, id); new MAP(pluginHost, file.path, file.id);
return new PluginInterface.Images.ImageControl(pluginHost, true); return new Ekona.Images.ImageControl(pluginHost, true);
} }
return new System.Windows.Forms.Control(); return new System.Windows.Forms.Control();

View File

@ -25,15 +25,15 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.IO; using System.IO;
using PluginInterface; using Ekona;
namespace HETALIA.Pack namespace HETALIA.Pack
{ {
public static class DATA public static class DATA
{ {
public static sFolder Unpack(string fileIn) public static sFolder Unpack(sFile file)
{ {
BinaryReader br = new BinaryReader(File.OpenRead(fileIn)); BinaryReader br = new BinaryReader(File.OpenRead(file.path));
sFolder unpack = new sFolder(); sFolder unpack = new sFolder();
unpack.files = new List<sFile>(); unpack.files = new List<sFile>();
@ -43,10 +43,10 @@ namespace HETALIA.Pack
for (int i = 0; i < num_files; i++) for (int i = 0; i < num_files; i++)
{ {
sFile newFile = new sFile(); sFile newFile = new sFile();
newFile.name = "File" + i.ToString() + '.'; newFile.name = "File_" + i.ToString() + '.';
newFile.size = br.ReadUInt32(); newFile.size = br.ReadUInt32();
newFile.offset = br.ReadUInt32(); newFile.offset = br.ReadUInt32();
newFile.path = fileIn; newFile.path = file.path;
long currPos = br.BaseStream.Position; long currPos = br.BaseStream.Position;
br.BaseStream.Position = newFile.offset; br.BaseStream.Position = newFile.offset;

View File

@ -26,7 +26,7 @@ using System;
using System.Text; using System.Text;
using System.IO; using System.IO;
using System.Windows.Forms; using System.Windows.Forms;
using PluginInterface; using Ekona;
namespace INAZUMA11 namespace INAZUMA11
{ {

View File

@ -26,7 +26,7 @@ using System;
using System.Text; using System.Text;
using System.IO; using System.IO;
using System.Windows.Forms; using System.Windows.Forms;
using PluginInterface; using Ekona;
namespace INAZUMA11 namespace INAZUMA11
{ {

View File

@ -32,9 +32,9 @@
<WarningLevel>4</WarningLevel> <WarningLevel>4</WarningLevel>
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>
<Reference Include="PluginInterface, Version=5.1.0.0, Culture=neutral, processorArchitecture=MSIL"> <Reference Include="Ekona, Version=7.0.0.0, Culture=neutral, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion> <SpecificVersion>False</SpecificVersion>
<HintPath>..\..\..\PluginInterface\bin\Debug\PluginInterface.dll</HintPath> <HintPath>..\..\..\Ekona\bin\Debug\Ekona.dll</HintPath>
</Reference> </Reference>
<Reference Include="System" /> <Reference Include="System" />
<Reference Include="System.Data" /> <Reference Include="System.Data" />

View File

@ -27,7 +27,7 @@ using System.Collections.Generic;
using System.Text; using System.Text;
using System.Windows.Forms; using System.Windows.Forms;
using System.IO; using System.IO;
using PluginInterface; using Ekona;
namespace INAZUMA11 namespace INAZUMA11
{ {
@ -43,6 +43,10 @@ namespace INAZUMA11
} }
public bool IsCompatible() public bool IsCompatible()
{ {
// Inazuma Eleven 1
if (gameCode == "YEES")
return true;
if (gameCode == "BEBJ" || gameCode == "BOEJ" || gameCode == "BEEJ" || if (gameCode == "BEBJ" || gameCode == "BOEJ" || gameCode == "BEEJ" ||
gameCode == "YEEP" || gameCode == "YEEJ" || gameCode == "BE8J" || gameCode == "YEEP" || gameCode == "YEEJ" || gameCode == "BE8J" ||
gameCode == "BEZJ" || gameCode == "BEBP" || gameCode == "BEEP") gameCode == "BEZJ" || gameCode == "BEBP" || gameCode == "BEEP")
@ -51,52 +55,57 @@ namespace INAZUMA11
return false; return false;
} }
public Format Get_Format(string fileName, byte[] magic, int id) public Format Get_Format(sFile file, byte[] magic)
{ {
string ext = new string(Encoding.ASCII.GetChars(magic)); string ext = new string(Encoding.ASCII.GetChars(magic));
// Pack files // Pack files
if ((fileName.ToUpper().EndsWith(".PAC_") || fileName.ToUpper().EndsWith(".PAC")) && BitConverter.ToUInt32(magic, 0) < 0x100) if ((file.name.ToUpper().EndsWith(".PAC_") || file.name.ToUpper().EndsWith(".PAC")) && BitConverter.ToUInt32(magic, 0) < 0x100)
return Format.Pack; return Format.Pack;
else if (fileName.ToUpper().EndsWith(".PKB")) else if (file.name.ToUpper().EndsWith(".PKB"))
return Format.Pack; return Format.Pack;
else if (fileName.ToUpper().EndsWith(".PKH")) else if (file.name.ToUpper().EndsWith(".PKH"))
return Format.System; return Format.System;
else if (fileName.ToUpper().EndsWith(".SPF_") && ext == "SFP\0") else if (file.name.ToUpper().EndsWith(".SPF_") && ext == "SFP\0")
return Format.Pack; return Format.Pack;
else if (fileName.ToUpper().EndsWith(".SPD")) else if (file.name.ToUpper().EndsWith(".SPD"))
return Format.Pack; return Format.Pack;
else if (fileName.ToUpper().EndsWith(".SPL")) else if (file.name.ToUpper().EndsWith(".SPL"))
return Format.System; return Format.System;
// Text files // Text files
// TODO: Include more gameCodes here and in Show_Info
switch (gameCode) switch (gameCode)
{ {
case "YEES":
if (file.id >= 0x01B6 && file.id <= 0x01CA) return Format.Text;
if (file.id == 0x619) return Format.Text;
if (file.id == 0x61A) return Format.Text;
if (file.id == 0xC0) return Format.Text;
break;
case "BEBP": case "BEBP":
if (id >= 0x13F && id <= 0x161) return Format.Text; if (file.id >= 0x13F && file.id <= 0x161) return Format.Text;
if (id == 0xD8) return Format.Text; if (file.id == 0xD8) return Format.Text;
if (id == 0x387) return Format.Text; if (file.id == 0x387) return Format.Text;
if (id == 0x388) return Format.Text; if (file.id == 0x388) return Format.Text;
break; break;
} }
return Format.Unknown; return Format.Unknown;
} }
public sFolder Unpack(string file, int id) public sFolder Unpack(sFile file)
{ {
if (file.ToUpper().EndsWith(".PAC_") || file.ToUpper().EndsWith(".PAC")) if (file.name.ToUpper().EndsWith(".PAC_") || file.name.ToUpper().EndsWith(".PAC"))
return PAC.Unpack(file); return PAC.Unpack(file);
if (file.ToUpper().EndsWith(".SPF_")) if (file.name.ToUpper().EndsWith(".SPF_"))
return SFP.Unpack(file); return SFP.Unpack(file.path);
if (file.ToUpper().EndsWith(".PKB")) if (file.name.ToUpper().EndsWith(".PKB"))
{ {
string pkh = pluginHost.Search_File(id + 1); sFile pkh = pluginHost.Search_File((short)(file.id + 1));
if (Path.GetFileNameWithoutExtension(pkh).Substring(12) != if (pkh.name != file.name)
Path.GetFileNameWithoutExtension(file).Substring(12))
{ {
Console.WriteLine("Error searching header file"); Console.WriteLine("Error searching header file");
return new sFolder(); return new sFolder();
@ -105,27 +114,25 @@ namespace INAZUMA11
return PKB.Unpack(file, pkh); return PKB.Unpack(file, pkh);
} }
if (file.ToUpper().EndsWith(".SPD")) if (file.name.ToUpper().EndsWith(".SPD"))
{ {
string spl = pluginHost.Search_File(id + 1); sFile spl = pluginHost.Search_File((short)(file.id + 1));
if (Path.GetFileNameWithoutExtension(spl).Substring(12) != if (spl.name != file.name)
Path.GetFileNameWithoutExtension(file).Substring(12))
{ {
Console.WriteLine("Error searching header file"); Console.WriteLine("Error searching header file");
return new sFolder(); return new sFolder();
} }
return SFP.Unpack(file, spl); return SFP.Unpack(file.path, spl.path);
} }
return new sFolder(); return new sFolder();
} }
public string Pack(ref sFolder unpacked, string file, int id) public string Pack(ref sFolder unpacked, sFile file)
{ {
string fileout = pluginHost.Get_TempFolder() + Path.DirectorySeparatorChar + string fileout = pluginHost.Get_TempFile();
Path.GetRandomFileName() + Path.GetFileName(file);
if (file.ToUpper().EndsWith(".PAC_") || file.ToUpper().EndsWith(".PAC")) if (file.name.ToUpper().EndsWith(".PAC_") || file.name.ToUpper().EndsWith(".PAC"))
{ {
Console.WriteLine("Packing to " + fileout); Console.WriteLine("Packing to " + fileout);
PAC.Pack(ref unpacked, fileout); PAC.Pack(ref unpacked, fileout);
@ -135,18 +142,26 @@ namespace INAZUMA11
return null; return null;
} }
public void Read(string file, int id) public void Read(sFile file)
{ {
} }
public Control Show_Info(string file, int id) public Control Show_Info(sFile file)
{ {
switch (gameCode) switch (gameCode)
{ {
// Inazuma11 - Spanish
case "YEES":
if (file.id >= 0x01B6 && file.id <= 0x01CA) return new SubtitlesControl(file.path, pluginHost, file.id);
if (file.id == 0x619) return new BlogpostControl(file.path, file.id, pluginHost);
if (file.id == 0x61A) return new BlogresControl(file.path, file.id, pluginHost);
if (file.id == 0xC0) return new USearchControl(file.path, file.id, pluginHost);
break;
case "BEBP": case "BEBP":
if (id >= 0x13F && id <= 0x161) return new SubtitlesControl(file, pluginHost, id); if (file.id >= 0x13F && file.id <= 0x161) return new SubtitlesControl(file.path, pluginHost, file.id);
if (id == 0xD8) return new USearchControl(file, id, pluginHost); if (file.id == 0xD8) return new USearchControl(file.path, file.id, pluginHost);
if (id == 0x387) return new BlogpostControl(file, id, pluginHost); if (file.id == 0x387) return new BlogpostControl(file.path, file.id, pluginHost);
if (id == 0x388) return new BlogresControl(file, id, pluginHost); if (file.id == 0x388) return new BlogresControl(file.path, file.id, pluginHost);
break; break;
} }
return new Control(); return new Control();

View File

@ -27,29 +27,28 @@ using System.Collections.Generic;
using System.Linq; using System.Linq;
using System.Text; using System.Text;
using System.IO; using System.IO;
using PluginInterface; using Ekona;
namespace INAZUMA11 namespace INAZUMA11
{ {
public static class PAC public static class PAC
{ {
public static sFolder Unpack(string file) public static sFolder Unpack(sFile file)
{ {
BinaryReader br = new BinaryReader(File.OpenRead(file)); BinaryReader br = new BinaryReader(File.OpenRead(file.path));
sFolder unpacked = new sFolder(); sFolder unpacked = new sFolder();
unpacked.files = new List<sFile>(); unpacked.files = new List<sFile>();
bool images = true; bool images = true;
string parent_name = Path.GetFileNameWithoutExtension(file).Substring(12);
uint num_files = br.ReadUInt32(); uint num_files = br.ReadUInt32();
for (int i = 0; i < num_files; i++) for (int i = 0; i < num_files; i++)
{ {
sFile newFile = new sFile(); sFile newFile = new sFile();
newFile.name = parent_name + " - " + i.ToString(); newFile.name = file.name + " - " + i.ToString();
newFile.offset = br.ReadUInt32(); newFile.offset = br.ReadUInt32();
newFile.size = br.ReadUInt32(); newFile.size = br.ReadUInt32();
newFile.path = file; newFile.path = file.path;
if ((num_files == 3 || num_files == 2 || num_files == 4) && images) if ((num_files == 3 || num_files == 2 || num_files == 4) && images)
{ {
@ -139,9 +138,9 @@ namespace INAZUMA11
public static class PKB public static class PKB
{ {
public static sFolder Unpack(string pkb, string pkh) public static sFolder Unpack(sFile pkb, sFile pkh)
{ {
BinaryReader br = new BinaryReader(File.OpenRead(pkh)); BinaryReader br = new BinaryReader(File.OpenRead(pkh.path));
string type = new String(Encoding.ASCII.GetChars(br.ReadBytes(8))); string type = new String(Encoding.ASCII.GetChars(br.ReadBytes(8)));
br.Close(); br.Close();
@ -151,10 +150,10 @@ namespace INAZUMA11
return Unpack_PKH2(pkb, pkh); return Unpack_PKH2(pkb, pkh);
} }
public static sFolder Unpack_PKH1(string pkb, string pkh) public static sFolder Unpack_PKH1(sFile pkb, sFile pkh)
{ {
// Fixed problem with some files thanks to ouioui2003 // Fixed problem with some files thanks to ouioui2003
BinaryReader br = new BinaryReader(File.OpenRead(pkh)); BinaryReader br = new BinaryReader(File.OpenRead(pkh.path));
sFolder unpacked = new sFolder(); sFolder unpacked = new sFolder();
unpacked.files = new List<sFile>(); unpacked.files = new List<sFile>();
@ -175,10 +174,10 @@ namespace INAZUMA11
br.ReadUInt32(); // Unknown, ID¿? br.ReadUInt32(); // Unknown, ID¿?
sFile newFile = new sFile(); sFile newFile = new sFile();
newFile.name = "File" + i.ToString() + ".pac_"; newFile.name = pkb.name + '_' + i.ToString() + ".pac_";
newFile.offset = br.ReadUInt32(); newFile.offset = br.ReadUInt32();
newFile.size = br.ReadUInt32(); newFile.size = br.ReadUInt32();
newFile.path = pkb; newFile.path = pkb.path;
unpacked.files.Add(newFile); unpacked.files.Add(newFile);
} }
@ -190,10 +189,10 @@ namespace INAZUMA11
br.ReadUInt32(); // Unknown, ID¿? br.ReadUInt32(); // Unknown, ID¿?
sFile newFile = new sFile(); sFile newFile = new sFile();
newFile.name = "File" + i.ToString() + ".pac_"; newFile.name = pkb.name + '_' + i.ToString() + ".pac_";
newFile.offset = (uint)i * block_length; newFile.offset = (uint)i * block_length;
newFile.size = block_length; newFile.size = block_length;
newFile.path = pkb; newFile.path = pkb.path;
unpacked.files.Add(newFile); unpacked.files.Add(newFile);
} }
@ -202,9 +201,9 @@ namespace INAZUMA11
br.Close(); br.Close();
return unpacked; return unpacked;
} }
public static sFolder Unpack_PKH2(string pkb, string pkh) public static sFolder Unpack_PKH2(sFile pkb, sFile pkh)
{ {
BinaryReader br = new BinaryReader(File.OpenRead(pkh)); BinaryReader br = new BinaryReader(File.OpenRead(pkh.path));
sFolder unpacked = new sFolder(); sFolder unpacked = new sFolder();
unpacked.files = new List<sFile>(); unpacked.files = new List<sFile>();
@ -215,10 +214,10 @@ namespace INAZUMA11
br.ReadUInt32(); // Unknown - ID¿? br.ReadUInt32(); // Unknown - ID¿?
sFile newFile = new sFile(); sFile newFile = new sFile();
newFile.name = "File " + i.ToString() + ".pac_"; newFile.name = pkb.name + '_' + i.ToString() + ".pac_";
newFile.offset = br.ReadUInt32(); newFile.offset = br.ReadUInt32();
newFile.size = br.ReadUInt32(); newFile.size = br.ReadUInt32();
newFile.path = pkb; newFile.path = pkb.path;
br.ReadUInt32(); // First four bytes that indicates the type of compression and the final size br.ReadUInt32(); // First four bytes that indicates the type of compression and the final size

View File

@ -27,7 +27,7 @@ using System.Collections.Generic;
using System.Text; using System.Text;
using System.IO; using System.IO;
using System.Windows.Forms; using System.Windows.Forms;
using PluginInterface; using Ekona;
namespace INAZUMA11 namespace INAZUMA11
{ {

View File

@ -26,7 +26,7 @@ using System;
using System.Text; using System.Text;
using System.IO; using System.IO;
using System.Windows.Forms; using System.Windows.Forms;
using PluginInterface; using Ekona;
namespace INAZUMA11 namespace INAZUMA11
{ {

Some files were not shown because too many files have changed in this diff Show More