Skip to content

Commit

Permalink
Add extractor for GFLXPack (switch pokemon pack)
Browse files Browse the repository at this point in the history
  • Loading branch information
Reisyukaku committed Nov 14, 2019
1 parent 42c4181 commit df532ad
Show file tree
Hide file tree
Showing 11 changed files with 355 additions and 213 deletions.
60 changes: 33 additions & 27 deletions SPICA.Rendering/Properties/Resources.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion SPICA.Rendering/SPICA.Rendering.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>SPICA.Rendering</RootNamespace>
<AssemblyName>SPICA.Rendering</AssemblyName>
<TargetFrameworkVersion>v4.6.2</TargetFrameworkVersion>
<TargetFrameworkVersion>v4.7.1</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<TargetFrameworkProfile />
</PropertyGroup>
Expand Down
2 changes: 1 addition & 1 deletion SPICA.WinForms/App.config
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
</sectionGroup>
</configSections>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.6.2"/>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.7.1"/>
</startup>
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
Expand Down
88 changes: 54 additions & 34 deletions SPICA.WinForms/FrmMain.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

28 changes: 28 additions & 0 deletions SPICA.WinForms/FrmMain.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
using SPICA.Formats;
using SPICA.Formats.CtrH3D;
using SPICA.Formats.CtrH3D.Animation;
using SPICA.Formats.GFLX;
using SPICA.Rendering;
using SPICA.WinForms.Formats;
using SPICA.WinForms.GUI;
Expand All @@ -14,6 +15,7 @@
using System;
using System.Collections.Generic;
using System.Drawing;
using System.IO;
using System.Linq;
using System.Windows.Forms;

Expand Down Expand Up @@ -304,6 +306,20 @@ private void MenuShowSide_Click(object sender, EventArgs e)
{
ToggleSide();
}

private void GFPAKExtractorToolStripMenuItem_Click(object sender, EventArgs e)
{
OpenFileDialog ofd = new OpenFileDialog();
ofd.Filter = "GameFreak Pak|*.gfpak";
ofd.Title = "Select package";
if (ofd.ShowDialog() == DialogResult.OK) {
FolderBrowserDialog folder = new FolderBrowserDialog();
folder.Description = "Select folder to extract to";
if (folder.ShowDialog() == DialogResult.OK) {
ExtractGfpak(ofd.FileName, folder.SelectedPath);
}
}
}
#endregion

#region Tool buttons and Menus
Expand Down Expand Up @@ -373,6 +389,17 @@ private void ToolButtonExport_Click(object sender, EventArgs e)
FileIO.Export(Scene, TexturesList.SelectedIndex);
}

private void ExtractGfpak(string pak, string outPath) {
GFLXPack gfpak = new GFLXPack(pak);
for (int i = 0; i < gfpak.FileCnt; i++) {
using (BinaryWriter bw = new BinaryWriter(new FileStream(outPath + "/" + gfpak.GetName(i) + ".bin", FileMode.CreateNew))) {
byte[] file = gfpak.GetFile(i);
bw.Write(file);
bw.Close();
}
}
}

private void Open(bool MergeMode)
{
IgnoreClicks = true;
Expand Down Expand Up @@ -745,5 +772,6 @@ private void AnimSeekBar_MouseUp(object sender, MouseEventArgs e)
AnimGrp.Continue();
}
#endregion

}
}
Loading

0 comments on commit df532ad

Please sign in to comment.