mirror of
https://github.com/kwsch/pk3DS.git
synced 2026-10-02 05:46:47 -05:00
Minor Refactoring
Quite a few clean improvements too...
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
using System;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.IO;
|
||||
|
||||
namespace pk3DS
|
||||
{
|
||||
|
||||
@@ -1,8 +1,6 @@
|
||||
using System;
|
||||
using System.IO;
|
||||
using System.Windows.Forms;
|
||||
using System.Threading;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace pk3DS
|
||||
{
|
||||
|
||||
@@ -1,9 +1,4 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
|
||||
namespace pk3DS
|
||||
namespace pk3DS
|
||||
{
|
||||
class Legal
|
||||
{
|
||||
|
||||
58
pk3DS/Main.Designer.cs
generated
58
pk3DS/Main.Designer.cs
generated
@@ -53,6 +53,7 @@ private void InitializeComponent()
|
||||
this.B_Mart = new System.Windows.Forms.Button();
|
||||
this.B_MoveTutor = new System.Windows.Forms.Button();
|
||||
this.B_TMHM = new System.Windows.Forms.Button();
|
||||
this.RTB_Status = new System.Windows.Forms.RichTextBox();
|
||||
this.GB_RomFS.SuspendLayout();
|
||||
this.GB_ExeFS.SuspendLayout();
|
||||
this.SuspendLayout();
|
||||
@@ -97,7 +98,7 @@ private void InitializeComponent()
|
||||
this.GB_RomFS.Location = new System.Drawing.Point(12, 67);
|
||||
this.GB_RomFS.Name = "GB_RomFS";
|
||||
this.GB_RomFS.Size = new System.Drawing.Size(430, 110);
|
||||
this.GB_RomFS.TabIndex = 2;
|
||||
this.GB_RomFS.TabIndex = 5;
|
||||
this.GB_RomFS.TabStop = false;
|
||||
this.GB_RomFS.Text = "RomFS Editing Tools";
|
||||
//
|
||||
@@ -106,7 +107,7 @@ private void InitializeComponent()
|
||||
this.B_Maison.Location = new System.Drawing.Point(112, 77);
|
||||
this.B_Maison.Name = "B_Maison";
|
||||
this.B_Maison.Size = new System.Drawing.Size(100, 23);
|
||||
this.B_Maison.TabIndex = 11;
|
||||
this.B_Maison.TabIndex = 5;
|
||||
this.B_Maison.Text = "Maison Editor";
|
||||
this.B_Maison.UseVisualStyleBackColor = true;
|
||||
this.B_Maison.Click += new System.EventHandler(this.B_Maison_Click);
|
||||
@@ -136,7 +137,7 @@ private void InitializeComponent()
|
||||
this.B_StoryText.Location = new System.Drawing.Point(6, 48);
|
||||
this.B_StoryText.Name = "B_StoryText";
|
||||
this.B_StoryText.Size = new System.Drawing.Size(100, 23);
|
||||
this.B_StoryText.TabIndex = 8;
|
||||
this.B_StoryText.TabIndex = 1;
|
||||
this.B_StoryText.Text = "Story Text Editor";
|
||||
this.B_StoryText.UseVisualStyleBackColor = true;
|
||||
this.B_StoryText.Click += new System.EventHandler(this.B_StoryText_Click);
|
||||
@@ -146,7 +147,7 @@ private void InitializeComponent()
|
||||
this.B_Item.Location = new System.Drawing.Point(218, 77);
|
||||
this.B_Item.Name = "B_Item";
|
||||
this.B_Item.Size = new System.Drawing.Size(100, 23);
|
||||
this.B_Item.TabIndex = 7;
|
||||
this.B_Item.TabIndex = 8;
|
||||
this.B_Item.Text = "Item Editor";
|
||||
this.B_Item.UseVisualStyleBackColor = true;
|
||||
this.B_Item.Click += new System.EventHandler(this.B_Item_Click);
|
||||
@@ -156,7 +157,7 @@ private void InitializeComponent()
|
||||
this.B_Move.Location = new System.Drawing.Point(324, 77);
|
||||
this.B_Move.Name = "B_Move";
|
||||
this.B_Move.Size = new System.Drawing.Size(100, 23);
|
||||
this.B_Move.TabIndex = 6;
|
||||
this.B_Move.TabIndex = 11;
|
||||
this.B_Move.Text = "Move Editor";
|
||||
this.B_Move.UseVisualStyleBackColor = true;
|
||||
this.B_Move.Click += new System.EventHandler(this.B_Move_Click);
|
||||
@@ -166,7 +167,7 @@ private void InitializeComponent()
|
||||
this.B_Evolution.Location = new System.Drawing.Point(218, 19);
|
||||
this.B_Evolution.Name = "B_Evolution";
|
||||
this.B_Evolution.Size = new System.Drawing.Size(100, 23);
|
||||
this.B_Evolution.TabIndex = 5;
|
||||
this.B_Evolution.TabIndex = 6;
|
||||
this.B_Evolution.Text = "Evolution Editor";
|
||||
this.B_Evolution.UseVisualStyleBackColor = true;
|
||||
this.B_Evolution.Click += new System.EventHandler(this.B_Evolution_Click);
|
||||
@@ -176,7 +177,7 @@ private void InitializeComponent()
|
||||
this.B_Personal.Location = new System.Drawing.Point(112, 19);
|
||||
this.B_Personal.Name = "B_Personal";
|
||||
this.B_Personal.Size = new System.Drawing.Size(100, 23);
|
||||
this.B_Personal.TabIndex = 4;
|
||||
this.B_Personal.TabIndex = 3;
|
||||
this.B_Personal.Text = "Personal Editor";
|
||||
this.B_Personal.UseVisualStyleBackColor = true;
|
||||
this.B_Personal.Click += new System.EventHandler(this.B_Personal_Click);
|
||||
@@ -186,7 +187,7 @@ private void InitializeComponent()
|
||||
this.B_MegaEvo.Location = new System.Drawing.Point(218, 48);
|
||||
this.B_MegaEvo.Name = "B_MegaEvo";
|
||||
this.B_MegaEvo.Size = new System.Drawing.Size(100, 23);
|
||||
this.B_MegaEvo.TabIndex = 3;
|
||||
this.B_MegaEvo.TabIndex = 7;
|
||||
this.B_MegaEvo.Text = "Mega Evo Editor";
|
||||
this.B_MegaEvo.UseVisualStyleBackColor = true;
|
||||
this.B_MegaEvo.Click += new System.EventHandler(this.B_MegaEvo_Click);
|
||||
@@ -196,7 +197,7 @@ private void InitializeComponent()
|
||||
this.B_Wild.Location = new System.Drawing.Point(112, 48);
|
||||
this.B_Wild.Name = "B_Wild";
|
||||
this.B_Wild.Size = new System.Drawing.Size(100, 23);
|
||||
this.B_Wild.TabIndex = 2;
|
||||
this.B_Wild.TabIndex = 4;
|
||||
this.B_Wild.Text = "Wild Editor";
|
||||
this.B_Wild.UseVisualStyleBackColor = true;
|
||||
this.B_Wild.Click += new System.EventHandler(this.B_Wild_Click);
|
||||
@@ -206,7 +207,7 @@ private void InitializeComponent()
|
||||
this.B_Trainer.Location = new System.Drawing.Point(6, 77);
|
||||
this.B_Trainer.Name = "B_Trainer";
|
||||
this.B_Trainer.Size = new System.Drawing.Size(100, 23);
|
||||
this.B_Trainer.TabIndex = 1;
|
||||
this.B_Trainer.TabIndex = 2;
|
||||
this.B_Trainer.Text = "Trainer Editor";
|
||||
this.B_Trainer.UseVisualStyleBackColor = true;
|
||||
this.B_Trainer.Click += new System.EventHandler(this.B_Trainer_Click);
|
||||
@@ -238,7 +239,7 @@ private void InitializeComponent()
|
||||
this.CB_Lang.Location = new System.Drawing.Point(321, 40);
|
||||
this.CB_Lang.Name = "CB_Lang";
|
||||
this.CB_Lang.Size = new System.Drawing.Size(121, 21);
|
||||
this.CB_Lang.TabIndex = 3;
|
||||
this.CB_Lang.TabIndex = 4;
|
||||
this.CB_Lang.SelectedIndexChanged += new System.EventHandler(this.changeLanguage);
|
||||
//
|
||||
// L_Lang
|
||||
@@ -248,7 +249,7 @@ private void InitializeComponent()
|
||||
this.L_Lang.Location = new System.Drawing.Point(257, 43);
|
||||
this.L_Lang.Name = "L_Lang";
|
||||
this.L_Lang.Size = new System.Drawing.Size(58, 13);
|
||||
this.L_Lang.TabIndex = 4;
|
||||
this.L_Lang.TabIndex = 3;
|
||||
this.L_Lang.Text = "Language:";
|
||||
//
|
||||
// L_Game
|
||||
@@ -258,13 +259,13 @@ private void InitializeComponent()
|
||||
this.L_Game.Location = new System.Drawing.Point(15, 43);
|
||||
this.L_Game.Name = "L_Game";
|
||||
this.L_Game.Size = new System.Drawing.Size(91, 13);
|
||||
this.L_Game.TabIndex = 5;
|
||||
this.L_Game.TabIndex = 2;
|
||||
this.L_Game.Text = "No Game Loaded";
|
||||
this.L_Game.Click += new System.EventHandler(this.L_Game_Click);
|
||||
//
|
||||
// pBar1
|
||||
//
|
||||
this.pBar1.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)
|
||||
this.pBar1.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
|
||||
| System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.pBar1.Location = new System.Drawing.Point(12, 241);
|
||||
this.pBar1.Name = "pBar1";
|
||||
@@ -283,6 +284,8 @@ private void InitializeComponent()
|
||||
//
|
||||
// GB_ExeFS
|
||||
//
|
||||
this.GB_ExeFS.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
|
||||
| System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.GB_ExeFS.Controls.Add(this.B_Pickup);
|
||||
this.GB_ExeFS.Controls.Add(this.B_Mart);
|
||||
this.GB_ExeFS.Controls.Add(this.B_MoveTutor);
|
||||
@@ -291,7 +294,7 @@ private void InitializeComponent()
|
||||
this.GB_ExeFS.Location = new System.Drawing.Point(12, 184);
|
||||
this.GB_ExeFS.Name = "GB_ExeFS";
|
||||
this.GB_ExeFS.Size = new System.Drawing.Size(430, 50);
|
||||
this.GB_ExeFS.TabIndex = 8;
|
||||
this.GB_ExeFS.TabIndex = 6;
|
||||
this.GB_ExeFS.TabStop = false;
|
||||
this.GB_ExeFS.Text = "ExeFS Editing Tools";
|
||||
//
|
||||
@@ -300,7 +303,7 @@ private void InitializeComponent()
|
||||
this.B_Pickup.Location = new System.Drawing.Point(6, 19);
|
||||
this.B_Pickup.Name = "B_Pickup";
|
||||
this.B_Pickup.Size = new System.Drawing.Size(100, 23);
|
||||
this.B_Pickup.TabIndex = 3;
|
||||
this.B_Pickup.TabIndex = 0;
|
||||
this.B_Pickup.Text = "Pickup Editor";
|
||||
this.B_Pickup.UseVisualStyleBackColor = true;
|
||||
this.B_Pickup.Click += new System.EventHandler(this.B_Pickup_Click);
|
||||
@@ -320,7 +323,7 @@ private void InitializeComponent()
|
||||
this.B_MoveTutor.Location = new System.Drawing.Point(324, 19);
|
||||
this.B_MoveTutor.Name = "B_MoveTutor";
|
||||
this.B_MoveTutor.Size = new System.Drawing.Size(100, 23);
|
||||
this.B_MoveTutor.TabIndex = 1;
|
||||
this.B_MoveTutor.TabIndex = 3;
|
||||
this.B_MoveTutor.Text = "Move Tutor Editor";
|
||||
this.B_MoveTutor.UseVisualStyleBackColor = true;
|
||||
this.B_MoveTutor.Click += new System.EventHandler(this.B_MoveTutor_Click);
|
||||
@@ -330,16 +333,29 @@ private void InitializeComponent()
|
||||
this.B_TMHM.Location = new System.Drawing.Point(112, 19);
|
||||
this.B_TMHM.Name = "B_TMHM";
|
||||
this.B_TMHM.Size = new System.Drawing.Size(100, 23);
|
||||
this.B_TMHM.TabIndex = 0;
|
||||
this.B_TMHM.TabIndex = 1;
|
||||
this.B_TMHM.Text = "TM/HM Editor";
|
||||
this.B_TMHM.UseVisualStyleBackColor = true;
|
||||
this.B_TMHM.Click += new System.EventHandler(this.B_TMHM_Click);
|
||||
//
|
||||
// RTB_Status
|
||||
//
|
||||
this.RTB_Status.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
|
||||
| System.Windows.Forms.AnchorStyles.Left)
|
||||
| System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.RTB_Status.Location = new System.Drawing.Point(12, 263);
|
||||
this.RTB_Status.Name = "RTB_Status";
|
||||
this.RTB_Status.ReadOnly = true;
|
||||
this.RTB_Status.Size = new System.Drawing.Size(430, 150);
|
||||
this.RTB_Status.TabIndex = 7;
|
||||
this.RTB_Status.Text = "";
|
||||
//
|
||||
// Main
|
||||
//
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||
this.ClientSize = new System.Drawing.Size(454, 262);
|
||||
this.ClientSize = new System.Drawing.Size(454, 422);
|
||||
this.Controls.Add(this.RTB_Status);
|
||||
this.Controls.Add(this.GB_ExeFS);
|
||||
this.Controls.Add(this.L_About);
|
||||
this.Controls.Add(this.pBar1);
|
||||
@@ -349,7 +365,8 @@ private void InitializeComponent()
|
||||
this.Controls.Add(this.GB_RomFS);
|
||||
this.Controls.Add(this.TB_Path);
|
||||
this.Controls.Add(this.B_Open);
|
||||
this.MaximumSize = new System.Drawing.Size(470, 300);
|
||||
this.MaximizeBox = false;
|
||||
this.MaximumSize = new System.Drawing.Size(470, 700);
|
||||
this.MinimumSize = new System.Drawing.Size(470, 300);
|
||||
this.Name = "Main";
|
||||
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
|
||||
@@ -389,6 +406,7 @@ private void InitializeComponent()
|
||||
private System.Windows.Forms.Button B_Mart;
|
||||
private System.Windows.Forms.Button B_MoveTutor;
|
||||
private System.Windows.Forms.Button B_TMHM;
|
||||
public System.Windows.Forms.RichTextBox RTB_Status;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
578
pk3DS/Main.cs
578
pk3DS/Main.cs
@@ -1,13 +1,7 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Data;
|
||||
using System.Drawing;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Windows.Forms;
|
||||
using System.IO;
|
||||
using System.Threading;
|
||||
using System.Windows.Forms;
|
||||
|
||||
namespace pk3DS
|
||||
{
|
||||
@@ -15,9 +9,13 @@ public partial class Main : Form
|
||||
{
|
||||
public Main()
|
||||
{
|
||||
// Initialize the Main Form
|
||||
InitializeComponent();
|
||||
|
||||
// Set the Current Language to English
|
||||
CB_Lang.SelectedIndex = 2;
|
||||
// restoreGARCs(true, "gametext", "storytext", "personal", "trpoke", "trdata", "evolution", "megaevo", "levelup", "eggmove", "item", "move", "maisonpkS", "maisontrS", "maisonpkN", "maisontrN");
|
||||
|
||||
// Prepare DragDrop Functionality
|
||||
this.AllowDrop = GB_RomFS.AllowDrop = TB_Path.AllowDrop = true;
|
||||
this.DragEnter += tabMain_DragEnter;
|
||||
this.DragDrop += tabMain_DragDrop;
|
||||
@@ -25,7 +23,12 @@ public Main()
|
||||
GB_RomFS.DragDrop += tabMain_DragDrop;
|
||||
TB_Path.DragEnter += tabMain_DragEnter;
|
||||
TB_Path.DragDrop += tabMain_DragDrop;
|
||||
|
||||
// Rebuilding Functionality
|
||||
// GB_RomFS.Click += rebuildRomFS; // Not tested, need some verification first.
|
||||
GB_ExeFS.Click += rebuildExeFS;
|
||||
|
||||
// Reload Previous Editing Files if the file exists
|
||||
if (File.Exists("config.ini"))
|
||||
{
|
||||
string path = File.ReadAllText("config.ini");
|
||||
@@ -38,12 +41,86 @@ public Main()
|
||||
public volatile int threads = 0;
|
||||
private static string[] allGARCs = { "gametext", "storytext", "personal", "trpoke", "trdata", "evolution", "megaevo", "levelup", "eggmove", "item", "move", "maisonpkS", "maisontrS", "maisonpkN", "maisontrN" };
|
||||
|
||||
// Main Form Methods
|
||||
private void L_About_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (ModifierKeys == Keys.Control && RomFS != null)
|
||||
{
|
||||
string s = "Game Type: " + ((oras) ? "ORAS" : "XY") + Environment.NewLine;
|
||||
for (int i = 0; i < allGARCs.Length; i++)
|
||||
s += String.Format(Environment.NewLine + "{0} - {1}", allGARCs[i], getGARCFileName(allGARCs[i]));
|
||||
if (DialogResult.Yes == Util.Prompt(MessageBoxButtons.YesNo, s, "Copy to Clipboard?"))
|
||||
try { Clipboard.SetText(s); }
|
||||
catch { Util.Alert("Unable to copy to Clipboard."); }
|
||||
}
|
||||
else
|
||||
Util.Alert
|
||||
(
|
||||
"pk3DS: A package of Pokémon X/Y/OR/AS tools by various contributors.",
|
||||
|
||||
"GARCTool (Backbone): Kaphotics" + Environment.NewLine +
|
||||
"Text Editing (xytext): Kaphotics" + Environment.NewLine +
|
||||
"Wild Editor (**WE): SciresM & Kaphotics" + Environment.NewLine +
|
||||
"Trainer Editor (**TE): SciresM, Kaphotics, and KazoWAR" + Environment.NewLine +
|
||||
"Personal Editor: SciresM" + Environment.NewLine +
|
||||
"Mega Evolution Editor (MEE): Huntereb & SciresM",
|
||||
|
||||
"After integrating standalone tools, the following editors were implemented:" + Environment.NewLine +
|
||||
"Evolutions, Moves, Items, Maison, and ExeFS Editors: Kaphotics",
|
||||
|
||||
"Big thanks to the ProjectPokemon community!"
|
||||
);
|
||||
}
|
||||
private void L_Game_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (GB_RomFS.Enabled && RomFS != null && ModifierKeys == Keys.Control)
|
||||
if (DialogResult.Yes == Util.Prompt(MessageBoxButtons.YesNo, "Restore Original Files?"))
|
||||
restoreGARCs(oras, allGARCs);
|
||||
}
|
||||
private void B_Open_Click(object sender, EventArgs e)
|
||||
{
|
||||
FolderBrowserDialog fbd = new FolderBrowserDialog();
|
||||
if (fbd.ShowDialog() == DialogResult.OK)
|
||||
openQuick(fbd.SelectedPath);
|
||||
}
|
||||
private void changeLanguage(object sender, EventArgs e)
|
||||
{
|
||||
if (!GB_RomFS.Enabled) return;
|
||||
new Thread(() =>
|
||||
{
|
||||
// Gather the Text Language Strings
|
||||
updateStatus(String.Format("GARC Get: {0} @ {1}... ", "gametext", getGARCFileName("gametext")));
|
||||
threadGet(RomFS + getGARCFileName("gametext"), "gametext", true, true);
|
||||
while (threads > 0) Thread.Sleep(50);
|
||||
if (!Directory.Exists("personal"))
|
||||
{
|
||||
updateStatus(String.Format("GARC Get: {0} @ {1}... ", "personal", getGARCFileName("personal")));
|
||||
threadGet(RomFS + getGARCFileName("personal"), "personal", true, true);
|
||||
}
|
||||
}).Start();
|
||||
}
|
||||
private void formClosing(object sender, FormClosingEventArgs e)
|
||||
{
|
||||
updateStatus("Saving data and closing the program...");
|
||||
if (TB_Path.Text.Length > 0) File.WriteAllText("config.ini", TB_Path.Text);
|
||||
if (!GB_RomFS.Enabled) return; // No data/threads need to be addressed if we haven't loaded anything.
|
||||
// Set the GameText back as other forms may have edited it.
|
||||
try
|
||||
{
|
||||
updateStatus(String.Format("GARC Get: {0} @ {1}... ", "gametext", getGARCFileName("gametext")));
|
||||
threadSet(RomFS + getGARCFileName("gametext"), "gametext", false);
|
||||
while (threads > 0) Thread.Sleep(100);
|
||||
|
||||
Thread.Sleep(200); // Small gap between beeps for faster computers.
|
||||
|
||||
updateStatus(String.Format("GARC Get: {0} @ {1}... ", "personal", getGARCFileName("personal")));
|
||||
threadSet(RomFS + getGARCFileName("personal"), "personal", false);
|
||||
while (threads > 0) Thread.Sleep(100);
|
||||
}
|
||||
catch { }
|
||||
if (Directory.Exists("gametext")) Directory.Delete("gametext", true);
|
||||
if (Directory.Exists("personal")) Directory.Delete("personal", true);
|
||||
}
|
||||
private void openQuick(string path)
|
||||
{
|
||||
FileInfo fi = new FileInfo(path);
|
||||
@@ -65,7 +142,7 @@ private void openQuick(string path)
|
||||
int count = folders.Length;
|
||||
if (count != 2 && count != 1) return; // Only want exefs & romfs (can have exheader there too, it's not a folder)
|
||||
{
|
||||
// first file should be 'exe'
|
||||
// First file should be 'exe'
|
||||
if (new FileInfo(folders[0]).Name.ToLower().Contains("exe") && Directory.Exists(folders[0]))
|
||||
checkIfExeFS(folders[0]);
|
||||
if (new FileInfo(folders[count - 1]).Name.ToLower().Contains("rom") && Directory.Exists(folders[count - 1]))
|
||||
@@ -73,7 +150,7 @@ private void openQuick(string path)
|
||||
|
||||
GB_RomFS.Enabled = (RomFS != null);
|
||||
GB_ExeFS.Enabled = (RomFS != null && ExeFS != null);
|
||||
B_MoveTutor.Enabled = oras; // default false unless loaded
|
||||
B_MoveTutor.Enabled = oras; // Default false unless loaded
|
||||
if (RomFS != null)
|
||||
{ L_Game.Text = (oras) ? "Game Loaded: ORAS" : "Game Loaded: XY"; TB_Path.Text = path; }
|
||||
else if (ExeFS != null)
|
||||
@@ -81,7 +158,14 @@ private void openQuick(string path)
|
||||
else
|
||||
{ L_Game.Text = "No Game Loaded"; TB_Path.Text = ""; }
|
||||
|
||||
changeLanguage(null, null); // Trigger Text Loading
|
||||
if (RomFS != null)
|
||||
{
|
||||
// Trigger Data Loading
|
||||
updateStatus("Data found! Loading persistent data for subforms...", false);
|
||||
changeLanguage(null, null);
|
||||
}
|
||||
|
||||
// Method finished.
|
||||
System.Media.SystemSounds.Asterisk.Play();
|
||||
}
|
||||
}
|
||||
@@ -141,16 +225,30 @@ private void tabMain_DragDrop(object sender, DragEventArgs e)
|
||||
}
|
||||
|
||||
// RomFS Subform Items
|
||||
private void rebuildRomFS(object sender, EventArgs e)
|
||||
{
|
||||
if (RomFS != null)
|
||||
{
|
||||
if (Util.Prompt(MessageBoxButtons.YesNo, "Rebuild RomFS?") == DialogResult.Yes)
|
||||
{
|
||||
SaveFileDialog sfd = new SaveFileDialog();
|
||||
sfd.FileName = "romfs.bin";
|
||||
sfd.Filter = "Binary File|*.*";
|
||||
if (sfd.ShowDialog() == DialogResult.OK)
|
||||
{ new Thread(() => { threads++; RomFSTool.BuildRomFS(RomFS, null, pBar1); threads--; }).Start(); }
|
||||
}
|
||||
}
|
||||
}
|
||||
private void B_GameText_Click(object sender, EventArgs e)
|
||||
{
|
||||
new Thread(() =>
|
||||
{
|
||||
string toEdit = "gametext";
|
||||
string GARC = getGARCFileName(toEdit);
|
||||
// threadGet(RomFS + getGARCFileName(toEdit), toEdit); // We don't need this because loading and changing language does it for us.
|
||||
|
||||
// Persistent data; file already fetched.
|
||||
Invoke((Action)(() => { new xytext(Directory.GetFiles(toEdit)).ShowDialog(); }));
|
||||
// When closed, create a new thread to set the GARC back.
|
||||
// Persistent data; folder not deleted.
|
||||
updateStatus(String.Format("GARC Set: {0} @ {1}... ", toEdit, GARC));
|
||||
threadSet(RomFS + GARC, toEdit);
|
||||
}).Start();
|
||||
}
|
||||
@@ -159,18 +257,9 @@ private void B_StoryText_Click(object sender, EventArgs e)
|
||||
if (threads > 0) { Util.Alert("Please wait for all operations to finish first."); return; }
|
||||
new Thread(() =>
|
||||
{
|
||||
string toEdit = "storytext";
|
||||
string GARC = getGARCFileName(toEdit);
|
||||
threadGet(RomFS + GARC, toEdit, true, true);
|
||||
while (threads > 0) // Let threads complete
|
||||
Thread.Sleep(100);
|
||||
|
||||
Invoke((Action)(() => { new xytext(Directory.GetFiles(toEdit)).ShowDialog(); }));
|
||||
// When closed, create a new thread to set the GARC back.
|
||||
threadSet(RomFS + GARC, toEdit);
|
||||
while (threads > 0) // Let threads complete
|
||||
Thread.Sleep(100);
|
||||
if (Directory.Exists(toEdit)) Directory.Delete(toEdit, true);
|
||||
fileGet("storytext");
|
||||
Invoke((Action)(() => { new xytext(Directory.GetFiles("storytext")).ShowDialog(); }));
|
||||
fileSet("storytext");
|
||||
}).Start();
|
||||
}
|
||||
private void B_Maison_Click(object sender, EventArgs e)
|
||||
@@ -180,33 +269,12 @@ private void B_Maison_Click(object sender, EventArgs e)
|
||||
if (dr == DialogResult.Cancel) return;
|
||||
|
||||
new Thread(() =>
|
||||
{
|
||||
bool super = (dr == DialogResult.Yes);
|
||||
string mtr = (super) ? "maisontrS" : "maisontrN";
|
||||
string mtrGARC = getGARCFileName(mtr);
|
||||
threadGet(RomFS + mtrGARC, mtr, true, true);
|
||||
while (threads > 0) // Let threads complete
|
||||
Thread.Sleep(50);
|
||||
|
||||
string mpk = (super) ? "maisonpkS" : "maisonpkN";
|
||||
string mpkGARC = getGARCFileName(mpk);
|
||||
threadGet(RomFS + mpkGARC, mpk, true, true);
|
||||
while (threads > 0) // Let threads complete
|
||||
Thread.Sleep(50);
|
||||
|
||||
Invoke((Action)(() => { new Maison(super).ShowDialog(); }));
|
||||
|
||||
threadSet(RomFS + mtrGARC, mtr);
|
||||
while (threads > 0) // Let threads complete
|
||||
Thread.Sleep(100);
|
||||
if (Directory.Exists(mtr)) Directory.Delete(mtr, true);
|
||||
|
||||
threadSet(RomFS + mpkGARC, mpk);
|
||||
while (threads > 0) // Let threads complete
|
||||
Thread.Sleep(100);
|
||||
if (Directory.Exists(mpk)) Directory.Delete(mpk, true);
|
||||
|
||||
}).Start();
|
||||
{
|
||||
bool super = (dr == DialogResult.Yes);
|
||||
fileGet((super) ? "maisontrS" : "maisontrN", (super) ? "maisonpkS" : "maisonpkN");
|
||||
Invoke((Action)(() => { new Maison(super).ShowDialog(); }));
|
||||
fileGet((super) ? "maisontrS" : "maisontrN", (super) ? "maisonpkS" : "maisonpkN");
|
||||
}).Start();
|
||||
}
|
||||
private void B_Personal_Click(object sender, EventArgs e)
|
||||
{
|
||||
@@ -215,16 +283,11 @@ private void B_Personal_Click(object sender, EventArgs e)
|
||||
{
|
||||
string toEdit = "personal";
|
||||
string GARC = getGARCFileName(toEdit);
|
||||
threadGet(RomFS + GARC, toEdit, true, true);
|
||||
while (threads > 0) // Let threads complete
|
||||
Thread.Sleep(100);
|
||||
|
||||
// Persistent data; file already fetched.
|
||||
Invoke((Action)(() => { new Personal().ShowDialog(); }));
|
||||
// When closed, create a new thread to set the GARC back.
|
||||
// Persistent data; folder not deleted.
|
||||
updateStatus(String.Format("GARC Set: {0} @ {1}... ", toEdit, GARC));
|
||||
threadSet(RomFS + GARC, toEdit);
|
||||
while (threads > 0) // Let threads complete
|
||||
Thread.Sleep(100);
|
||||
if (Directory.Exists(toEdit)) Directory.Delete(toEdit, true);
|
||||
}).Start();
|
||||
}
|
||||
private void B_Trainer_Click(object sender, EventArgs e)
|
||||
@@ -232,36 +295,9 @@ private void B_Trainer_Click(object sender, EventArgs e)
|
||||
if (threads > 0) { Util.Alert("Please wait for all operations to finish first."); return; }
|
||||
new Thread(() =>
|
||||
{
|
||||
string trdata = "trdata";
|
||||
string trdataGARC = getGARCFileName(trdata);
|
||||
threadGet(RomFS + trdataGARC, trdata, true, true);
|
||||
while (threads > 0) // Let threads complete
|
||||
Thread.Sleep(50);
|
||||
|
||||
string trpoke = "trpoke";
|
||||
string trpokeGARC = getGARCFileName(trpoke);
|
||||
threadGet(RomFS + trpokeGARC, trpoke, true, true);
|
||||
while (threads > 0) // Let threads complete
|
||||
Thread.Sleep(50);
|
||||
|
||||
string personal = "personal";
|
||||
string personalGARC = getGARCFileName(personal);
|
||||
threadGet(RomFS + personalGARC, personal, true, true);
|
||||
while (threads > 0) // Let threads complete
|
||||
Thread.Sleep(100);
|
||||
|
||||
fileGet("trdata", "trpoke");
|
||||
Invoke((Action)(() => { new RSTE().ShowDialog(); }));
|
||||
// When closed, create a new thread to set the GARC back.
|
||||
|
||||
threadSet(RomFS + trdataGARC, trdata);
|
||||
while (threads > 0) // Let threads complete
|
||||
Thread.Sleep(100);
|
||||
if (Directory.Exists(trdata)) Directory.Delete(trdata, true);
|
||||
|
||||
threadSet(RomFS + trpokeGARC, trpoke);
|
||||
while (threads > 0) // Let threads complete
|
||||
Thread.Sleep(100);
|
||||
if (Directory.Exists(trpoke)) Directory.Delete(trpoke, true);
|
||||
fileSet("trdata", "trpoke");
|
||||
}).Start();
|
||||
}
|
||||
private void B_Wild_Click(object sender, EventArgs e)
|
||||
@@ -269,28 +305,10 @@ private void B_Wild_Click(object sender, EventArgs e)
|
||||
if (threads > 0) { Util.Alert("Please wait for all operations to finish first."); return; }
|
||||
new Thread(() =>
|
||||
{
|
||||
string personal = "personal";
|
||||
string personalGARC = getGARCFileName(personal);
|
||||
threadGet(RomFS + personalGARC, personal, true, true);
|
||||
while (threads > 0) // Let threads complete
|
||||
Thread.Sleep(50);
|
||||
|
||||
string encdata = "encdata";
|
||||
string encdataGARC = getGARCFileName(encdata);
|
||||
threadGet(RomFS + encdataGARC, encdata, true, false);
|
||||
while (threads > 0) // Let threads complete
|
||||
Thread.Sleep(50);
|
||||
|
||||
if (oras)
|
||||
{ Invoke((Action)(() => { new RSWE().ShowDialog(); })); }
|
||||
else
|
||||
{ Invoke((Action)(() => { new XYWE().ShowDialog(); })); }
|
||||
// When closed, create a new thread to set the GARC back.
|
||||
|
||||
threadSet(RomFS + encdataGARC, encdata);
|
||||
while (threads > 0) // Let threads complete
|
||||
Thread.Sleep(100);
|
||||
if (Directory.Exists(encdata)) Directory.Delete(encdata, true);
|
||||
fileGet("encdata");
|
||||
if (oras) { Invoke((Action)(() => { new RSWE().ShowDialog(); })); }
|
||||
else { Invoke((Action)(() => { new XYWE().ShowDialog(); })); }
|
||||
fileSet("encdata");
|
||||
}).Start();
|
||||
}
|
||||
private void B_Evolution_Click(object sender, EventArgs e)
|
||||
@@ -298,18 +316,9 @@ private void B_Evolution_Click(object sender, EventArgs e)
|
||||
if (threads > 0) { Util.Alert("Please wait for all operations to finish first."); return; }
|
||||
new Thread(() =>
|
||||
{
|
||||
string toEdit = "evolution";
|
||||
string GARC = getGARCFileName(toEdit);
|
||||
threadGet(RomFS + GARC, toEdit, true, true);
|
||||
while (threads > 0) // Let threads complete
|
||||
Thread.Sleep(100);
|
||||
|
||||
fileGet("evolution");
|
||||
Invoke((Action)(() => { new Evolution().ShowDialog(); }));
|
||||
// When closed, create a new thread to set the GARC back.
|
||||
threadSet(RomFS + GARC, toEdit);
|
||||
while (threads > 0) // Let threads complete
|
||||
Thread.Sleep(100);
|
||||
if (Directory.Exists(toEdit)) Directory.Delete(toEdit, true);
|
||||
fileSet("evolution");
|
||||
}).Start();
|
||||
}
|
||||
private void B_MegaEvo_Click(object sender, EventArgs e)
|
||||
@@ -317,25 +326,9 @@ private void B_MegaEvo_Click(object sender, EventArgs e)
|
||||
if (threads > 0) { Util.Alert("Please wait for all operations to finish first."); return; }
|
||||
new Thread(() =>
|
||||
{
|
||||
string megaevo = "megaevo";
|
||||
string GARC = getGARCFileName(megaevo);
|
||||
threadGet(RomFS + GARC, megaevo, true, true);
|
||||
while (threads > 0) // Let threads complete
|
||||
Thread.Sleep(50);
|
||||
|
||||
string personal = "personal";
|
||||
string personalGARC = getGARCFileName(personal);
|
||||
threadGet(RomFS + personalGARC, personal, true, true);
|
||||
while (threads > 0) // Let threads complete
|
||||
Thread.Sleep(50);
|
||||
|
||||
fileGet("megaevo");
|
||||
Invoke((Action)(() => { new MEE().ShowDialog(); }));
|
||||
// When closed, create a new thread to set the GARC back.
|
||||
|
||||
threadSet(RomFS + GARC, megaevo);
|
||||
while (threads > 0) // Let threads complete
|
||||
Thread.Sleep(50);
|
||||
if (Directory.Exists(megaevo)) Directory.Delete(megaevo, true);
|
||||
fileSet("megaevo");
|
||||
}).Start();
|
||||
}
|
||||
private void B_Item_Click(object sender, EventArgs e)
|
||||
@@ -343,19 +336,9 @@ private void B_Item_Click(object sender, EventArgs e)
|
||||
if (threads > 0) { Util.Alert("Please wait for all operations to finish first."); return; }
|
||||
new Thread(() =>
|
||||
{
|
||||
string toEdit = "item";
|
||||
string GARC = getGARCFileName(toEdit);
|
||||
threadGet(RomFS + GARC, toEdit, true, true);
|
||||
while (threads > 0) // Let threads complete
|
||||
Thread.Sleep(100);
|
||||
|
||||
fileGet("item");
|
||||
Invoke((Action)(() => { new Item().ShowDialog(); }));
|
||||
|
||||
// When closed, create a new thread to set the GARC back.
|
||||
threadSet(RomFS + GARC, toEdit);
|
||||
while (threads > 0) // Let threads complete
|
||||
Thread.Sleep(100);
|
||||
if (Directory.Exists(toEdit)) Directory.Delete(toEdit, true);
|
||||
fileSet("item");
|
||||
}).Start();
|
||||
}
|
||||
private void B_Move_Click(object sender, EventArgs e)
|
||||
@@ -363,19 +346,9 @@ private void B_Move_Click(object sender, EventArgs e)
|
||||
if (threads > 0) { Util.Alert("Please wait for all operations to finish first."); return; }
|
||||
new Thread(() =>
|
||||
{
|
||||
string toEdit = "move";
|
||||
string GARC = getGARCFileName(toEdit);
|
||||
threadGet(RomFS + GARC, toEdit, true, true);
|
||||
while (threads > 0) // Let threads complete
|
||||
Thread.Sleep(100);
|
||||
|
||||
fileGet("move");
|
||||
Invoke((Action)(() => { new Moves().ShowDialog(); }));
|
||||
|
||||
// When closed, create a new thread to set the GARC back.
|
||||
threadSet(RomFS + GARC, toEdit);
|
||||
while (threads > 0) // Let threads complete
|
||||
Thread.Sleep(100);
|
||||
if (Directory.Exists(toEdit)) Directory.Delete(toEdit, true);
|
||||
fileSet("move");
|
||||
}).Start();
|
||||
}
|
||||
private void B_LevelUp_Click(object sender, EventArgs e)
|
||||
@@ -383,18 +356,9 @@ private void B_LevelUp_Click(object sender, EventArgs e)
|
||||
if (threads > 0) { Util.Alert("Please wait for all operations to finish first."); return; }
|
||||
new Thread(() =>
|
||||
{
|
||||
string toEdit = "levelup";
|
||||
string GARC = getGARCFileName(toEdit);
|
||||
threadGet(RomFS + GARC, toEdit, true, true);
|
||||
while (threads > 0) // Let threads complete
|
||||
Thread.Sleep(100);
|
||||
|
||||
fileGet("levelup");
|
||||
Invoke((Action)(() => { new LevelUp().ShowDialog(); }));
|
||||
// When closed, create a new thread to set the GARC back.
|
||||
threadSet(RomFS + GARC, toEdit);
|
||||
while (threads > 0) // Let threads complete
|
||||
Thread.Sleep(100);
|
||||
if (Directory.Exists(toEdit)) Directory.Delete(toEdit, true);
|
||||
fileSet("levelup");
|
||||
}).Start();
|
||||
}
|
||||
private void B_EggMove_Click(object sender, EventArgs e)
|
||||
@@ -402,22 +366,58 @@ private void B_EggMove_Click(object sender, EventArgs e)
|
||||
if (threads > 0) { Util.Alert("Please wait for all operations to finish first."); return; }
|
||||
new Thread(() =>
|
||||
{
|
||||
string toEdit = "eggmove";
|
||||
string GARC = getGARCFileName(toEdit);
|
||||
threadGet(RomFS + GARC, toEdit, true, true);
|
||||
while (threads > 0) // Let threads complete
|
||||
Thread.Sleep(100);
|
||||
|
||||
fileGet("eggmove");
|
||||
Invoke((Action)(() => { new EggMove().ShowDialog(); }));
|
||||
// When closed, create a new thread to set the GARC back.
|
||||
threadSet(RomFS + GARC, toEdit);
|
||||
while (threads > 0) // Let threads complete
|
||||
Thread.Sleep(100);
|
||||
if (Directory.Exists(toEdit)) Directory.Delete(toEdit, true);
|
||||
fileSet("eggmove");
|
||||
}).Start();
|
||||
}
|
||||
// RomFS File Requesting Method Wrapper
|
||||
private void fileGet(params string[] files)
|
||||
{
|
||||
foreach (string toEdit in files)
|
||||
{
|
||||
string GARC = getGARCFileName(toEdit);
|
||||
updateStatus(String.Format("GARC Get: {0} @ {1}... ", toEdit, GARC));
|
||||
threadGet(RomFS + GARC, toEdit, true, true);
|
||||
while (threads > 0) Thread.Sleep(50);
|
||||
}
|
||||
}
|
||||
private void fileSet(params string[] files)
|
||||
{
|
||||
foreach (string toEdit in files)
|
||||
{
|
||||
string GARC = getGARCFileName(toEdit);
|
||||
updateStatus(String.Format("GARC Set: {0} @ {1}... ", toEdit, GARC));
|
||||
threadSet(RomFS + GARC, toEdit);
|
||||
while (threads > 0) Thread.Sleep(50);
|
||||
if (Directory.Exists(toEdit)) Directory.Delete(toEdit, true);
|
||||
}
|
||||
}
|
||||
|
||||
// ExeFS Subform Items
|
||||
private void rebuildExeFS(object sender, EventArgs e)
|
||||
{
|
||||
if (ExeFS != null)
|
||||
if (Util.Prompt(MessageBoxButtons.YesNo, "Rebuild ExeFS?") == DialogResult.Yes)
|
||||
{
|
||||
string[] files = Directory.GetFiles(ExeFS);
|
||||
int file = 0; if (files[1].Contains("code")) file = 1;
|
||||
SaveFileDialog sfd = new SaveFileDialog();
|
||||
sfd.FileName = "exefs.bin";
|
||||
sfd.Filter = "Binary File|*.*";
|
||||
if (sfd.ShowDialog() == DialogResult.OK)
|
||||
{
|
||||
new Thread(() =>
|
||||
{
|
||||
threads++;
|
||||
new blz.BLZCoder(new string[] { "-en", files[file] }, pBar1);
|
||||
Util.Alert("Compressed!");
|
||||
ExeFSTool.set(Directory.GetFiles(ExeFS), sfd.FileName);
|
||||
threads--;
|
||||
}).Start();
|
||||
}
|
||||
}
|
||||
}
|
||||
private void B_Pickup_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (threads > 0) { Util.Alert("Please wait for all operations to finish first."); return; }
|
||||
@@ -441,40 +441,6 @@ private void B_MoveTutor_Click(object sender, EventArgs e)
|
||||
}
|
||||
|
||||
// GARC Requests
|
||||
public bool getGARC(string infile, string outfolder, bool PB, bool bypassExt = false)
|
||||
{
|
||||
try
|
||||
{
|
||||
bool success = GARCTool.garcUnpack(infile, outfolder, bypassExt, (PB) ? pBar1 : null, null, true, bypassExt);
|
||||
Console.WriteLine("Get Status: " + success.ToString());
|
||||
threads--;
|
||||
return success;
|
||||
}
|
||||
catch (Exception e) { Util.Error("Could not get the GARC:", e.ToString()); threads--; return false; }
|
||||
}
|
||||
public bool setGARC(string outfile, string infolder, bool PB)
|
||||
{
|
||||
try
|
||||
{
|
||||
bool success = GARCTool.garcPackMS(infolder, outfile, (PB) ? pBar1 : null, null, true);
|
||||
Console.WriteLine("Set Status: " + success.ToString());
|
||||
threads--;
|
||||
return success;
|
||||
}
|
||||
catch (Exception e) { Util.Error("Could not set the GARC back:", e.ToString()); threads--; return false; }
|
||||
}
|
||||
public void threadGet(string infile, string outfolder, bool PB = true, bool bypassExt = false)
|
||||
{
|
||||
if (Directory.Exists(outfolder)) try { Directory.Delete(outfolder, true); }
|
||||
catch { }
|
||||
Thread thread = new Thread(() => getGARC(infile, outfolder, PB, bypassExt));
|
||||
thread.Start(); threads++;
|
||||
}
|
||||
public void threadSet(string outfile, string infolder, bool PB = true)
|
||||
{
|
||||
Thread thread = new Thread(() => setGARC(outfile, infolder, PB));
|
||||
thread.Start(); threads++;
|
||||
}
|
||||
public string getGARCFileName(string requestedGARC)
|
||||
{
|
||||
int lang = 0;
|
||||
@@ -485,25 +451,65 @@ public string getGARCFileName(string requestedGARC)
|
||||
string ans = "";
|
||||
switch (requestedGARC)
|
||||
{
|
||||
case "encdata": ans = (oras) ? getFileName(0, 1, 3) : getFileName(0, 1, 2); break;
|
||||
case "gametext": ans = (oras) ? getFileName(0, 7, 1 + lang) : getFileName(0, 7, 2 + lang); break;
|
||||
case "storytext": ans = (oras) ? getFileName(0, 7 + ((lang + 9) / 10), (10 + (lang + 9)) % 10) : getFileName(0, 8, lang); break;
|
||||
case "trdata": ans = (oras) ? getFileName(0, 3, 6) : getFileName(0, 3, 8); break;
|
||||
case "trpoke": ans = (oras) ? getFileName(0, 3, 8) : getFileName(0, 4, 0); break;
|
||||
case "move": ans = (oras) ? getFileName(1, 8, 9) : getFileName(2, 1, 2); break;
|
||||
case "eggmove": ans = (oras) ? getFileName(1, 9, 0) : getFileName(2, 1, 3); break;
|
||||
case "levelup": ans = (oras) ? getFileName(1, 9, 1) : getFileName(2, 1, 4); break;
|
||||
case "evolution": ans = (oras) ? getFileName(1, 9, 2) : getFileName(2, 1, 5); break;
|
||||
case "megaevo": ans = (oras) ? getFileName(1, 9, 3) : getFileName(2, 1, 6); break;
|
||||
case "personal": ans = (oras) ? getFileName(1, 9, 5) : getFileName(2, 1, 8); break;
|
||||
case "item": ans = (oras) ? getFileName(1, 9, 7) : getFileName(2, 2, 0); break;
|
||||
case "maisonpkN": ans = (oras) ? getFileName(1, 8, 2) : getFileName(2, 0, 3); break;
|
||||
case "maisontrN": ans = (oras) ? getFileName(1, 8, 3) : getFileName(2, 0, 4); break;
|
||||
case "maisonpkS": ans = (oras) ? getFileName(1, 8, 4) : getFileName(2, 0, 5); break;
|
||||
case "maisontrS": ans = (oras) ? getFileName(1, 8, 5) : getFileName(2, 0, 6); break;
|
||||
case "encdata": ans = (oras) ? getGARCPath(0, 1, 3) : getGARCPath(0, 1, 2); break;
|
||||
case "trdata": ans = (oras) ? getGARCPath(0, 3, 6) : getGARCPath(0, 3, 8); break;
|
||||
case "trpoke": ans = (oras) ? getGARCPath(0, 3, 8) : getGARCPath(0, 4, 0); break;
|
||||
case "gametext": ans = (oras) ? getGARCPath(0, 7, 1 + lang) : getGARCPath(0, 7, 2 + lang); break;
|
||||
case "storytext": ans = (oras) ? getGARCPath(0, 7 + ((lang + 9) / 10), (10 + (lang + 9)) % 10) : getGARCPath(0, 8, lang); break;
|
||||
case "maisonpkN": ans = (oras) ? getGARCPath(1, 8, 2) : getGARCPath(2, 0, 3); break;
|
||||
case "maisontrN": ans = (oras) ? getGARCPath(1, 8, 3) : getGARCPath(2, 0, 4); break;
|
||||
case "maisonpkS": ans = (oras) ? getGARCPath(1, 8, 4) : getGARCPath(2, 0, 5); break;
|
||||
case "maisontrS": ans = (oras) ? getGARCPath(1, 8, 5) : getGARCPath(2, 0, 6); break;
|
||||
case "move": ans = (oras) ? getGARCPath(1, 8, 9) : getGARCPath(2, 1, 2); break;
|
||||
case "eggmove": ans = (oras) ? getGARCPath(1, 9, 0) : getGARCPath(2, 1, 3); break;
|
||||
case "levelup": ans = (oras) ? getGARCPath(1, 9, 1) : getGARCPath(2, 1, 4); break;
|
||||
case "evolution": ans = (oras) ? getGARCPath(1, 9, 2) : getGARCPath(2, 1, 5); break;
|
||||
case "megaevo": ans = (oras) ? getGARCPath(1, 9, 3) : getGARCPath(2, 1, 6); break;
|
||||
case "personal": ans = (oras) ? getGARCPath(1, 9, 5) : getGARCPath(2, 1, 8); break;
|
||||
case "item": ans = (oras) ? getGARCPath(1, 9, 7) : getGARCPath(2, 2, 0); break;
|
||||
}
|
||||
return ans;
|
||||
}
|
||||
public string getGARCPath(int A, int B, int C)
|
||||
{
|
||||
return Path.DirectorySeparatorChar + "a" + Path.DirectorySeparatorChar + A.ToString() + Path.DirectorySeparatorChar + B.ToString() + Path.DirectorySeparatorChar + C.ToString();
|
||||
}
|
||||
public bool getGARC(string infile, string outfolder, bool PB, bool bypassExt = false)
|
||||
{
|
||||
try
|
||||
{
|
||||
bool success = GARCTool.garcUnpack(infile, outfolder, bypassExt, (PB) ? pBar1 : null, null, true, bypassExt);
|
||||
updateStatus(String.Format(success ? "Success!" : "Failed!"), false);
|
||||
threads--;
|
||||
return success;
|
||||
}
|
||||
catch (Exception e) { Util.Error("Could not get the GARC:", e.ToString()); threads--; return false; }
|
||||
}
|
||||
public bool setGARC(string outfile, string infolder, bool PB)
|
||||
{
|
||||
try
|
||||
{
|
||||
bool success = GARCTool.garcPackMS(infolder, outfile, (PB) ? pBar1 : null, null, true);
|
||||
threads--;
|
||||
updateStatus(String.Format(success ? "Success!" : "Failed!"), false);
|
||||
return success;
|
||||
}
|
||||
catch (Exception e) { Util.Error("Could not set the GARC back:", e.ToString()); threads--; return false; }
|
||||
}
|
||||
public void threadGet(string infile, string outfolder, bool PB = true, bool bypassExt = false)
|
||||
{
|
||||
threads++;
|
||||
if (Directory.Exists(outfolder)) try { Directory.Delete(outfolder, true); }
|
||||
catch { }
|
||||
Thread thread = new Thread(() => getGARC(infile, outfolder, PB, bypassExt));
|
||||
thread.Start();
|
||||
}
|
||||
public void threadSet(string outfile, string infolder, bool PB = true)
|
||||
{
|
||||
threads++;
|
||||
Thread thread = new Thread(() => setGARC(outfile, infolder, PB));
|
||||
thread.Start();
|
||||
}
|
||||
public void backupGARCs(bool overwrite, params string[] g)
|
||||
{
|
||||
if (!Directory.Exists("backup")) Directory.CreateDirectory("backup");
|
||||
@@ -532,7 +538,7 @@ internal static string[] getText(int file)
|
||||
{
|
||||
return xytext.getStringsFromFile("gametext" + Path.DirectorySeparatorChar + file.ToString("000") + ".bin");
|
||||
}
|
||||
public bool setText(int file, string[] strings)
|
||||
internal static bool setText(int file, string[] strings)
|
||||
{
|
||||
byte[] data = xytext.getBytesForFile(strings);
|
||||
string path = "text" + Path.DirectorySeparatorChar + file.ToString("000") + ".bin";
|
||||
@@ -540,102 +546,16 @@ public bool setText(int file, string[] strings)
|
||||
return true;
|
||||
}
|
||||
|
||||
private void changeLanguage(object sender, EventArgs e)
|
||||
// Update RichTextBox
|
||||
public void updateStatus(string status, bool preBreak = true)
|
||||
{
|
||||
if (!GB_RomFS.Enabled) return;
|
||||
// Gather the Text Language Strings
|
||||
threadGet(RomFS + getGARCFileName("gametext"), "gametext", true, true);
|
||||
}
|
||||
private string getFileName(int A, int B, int C)
|
||||
{
|
||||
return Path.DirectorySeparatorChar + "a" + Path.DirectorySeparatorChar + A.ToString() + Path.DirectorySeparatorChar + B.ToString() + Path.DirectorySeparatorChar + C.ToString();
|
||||
}
|
||||
|
||||
private void formClosing(object sender, FormClosingEventArgs e)
|
||||
{
|
||||
this.Hide();
|
||||
if (TB_Path.Text.Length > 0) File.WriteAllText("config.ini", TB_Path.Text);
|
||||
if (!GB_RomFS.Enabled) return; // No data/threads need to be addressed if we haven't loaded anything.
|
||||
// Set the GameText back as other forms may have edited it.
|
||||
try
|
||||
{
|
||||
threadSet(RomFS + getGARCFileName("gametext"), "gametext", false);
|
||||
if (Directory.Exists("personal")) threadSet(RomFS + getGARCFileName("personal"), "personal", false);
|
||||
int timeout = 0; // Time out after 7 seconds.
|
||||
while (threads > 0 && timeout++ < 70)
|
||||
Thread.Sleep(100);
|
||||
if (RTB_Status.InvokeRequired)
|
||||
RTB_Status.Invoke((MethodInvoker)delegate { RTB_Status.AppendText(((preBreak) ? Environment.NewLine : "") + status); });
|
||||
else RTB_Status.AppendText(status + Environment.NewLine);
|
||||
}
|
||||
catch { }
|
||||
if (Directory.Exists("gametext")) Directory.Delete("gametext", true);
|
||||
if (Directory.Exists("personal")) Directory.Delete("personal", true);
|
||||
if (Directory.Exists("temp")) Directory.Delete("temp", true);
|
||||
}
|
||||
private void L_About_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (ModifierKeys == Keys.Control && RomFS != null)
|
||||
{
|
||||
string s = "Game Type: " + ((oras) ? "ORAS" : "XY") + Environment.NewLine ;
|
||||
for (int i = 0; i < allGARCs.Length; i++)
|
||||
s += String.Format(Environment.NewLine + "{0} - {1}", allGARCs[i], getGARCFileName(allGARCs[i]));
|
||||
if (DialogResult.Yes == Util.Prompt(MessageBoxButtons.YesNo, s, "Copy to Clipboard?"))
|
||||
try { Clipboard.SetText(s); } catch { Util.Alert("Unable to copy to Clipboard."); }
|
||||
}
|
||||
else
|
||||
Util.Alert(
|
||||
"pk3DS: A package of Pokémon X/Y/OR/AS tools by various contributors.",
|
||||
"GARCTool (Backbone): Kaphotics" + Environment.NewLine +
|
||||
"Text Editing (xytext): Kaphotics" + Environment.NewLine +
|
||||
"Wild Editor (**WE): SciresM & Kaphotics" + Environment.NewLine +
|
||||
"Trainer Editor (**TE): SciresM, Kaphotics, and KazoWAR" + Environment.NewLine +
|
||||
"Personal Editor: SciresM" + Environment.NewLine +
|
||||
"Mega Evolution Editor (MEE): Huntereb & SciresM" + Environment.NewLine +
|
||||
"Evolutions, Moves, Items, ExeFS, and Maison Editor: Kaphotics" + Environment.NewLine +
|
||||
"Big thanks to the ProjectPokemon community!");
|
||||
}
|
||||
|
||||
private void rebuildExeFS(object sender, EventArgs e)
|
||||
{
|
||||
if (ExeFS != null)
|
||||
if (Util.Prompt(MessageBoxButtons.YesNo, "Rebuild ExeFS?") == DialogResult.Yes)
|
||||
{
|
||||
string[] files = Directory.GetFiles(ExeFS);
|
||||
int file = 0; if (files[1].Contains("code")) file = 1;
|
||||
SaveFileDialog sfd = new SaveFileDialog();
|
||||
sfd.FileName = "exefs.bin";
|
||||
sfd.Filter = "Binary File|*.*";
|
||||
if (sfd.ShowDialog() == DialogResult.OK)
|
||||
{
|
||||
new Thread(() =>
|
||||
{
|
||||
threads++;
|
||||
new blz.BLZCoder(new string[] { "-en", files[file] }, pBar1);
|
||||
Util.Alert("Compressed!");
|
||||
ExeFSTool.set(Directory.GetFiles(ExeFS), sfd.FileName);
|
||||
threads--;
|
||||
}).Start();
|
||||
}
|
||||
}
|
||||
}
|
||||
private void rebuildRomFS(object sender, EventArgs e)
|
||||
{
|
||||
if (RomFS != null)
|
||||
{
|
||||
if (Util.Prompt(MessageBoxButtons.YesNo, "Rebuild RomFS?") == DialogResult.Yes)
|
||||
{
|
||||
SaveFileDialog sfd = new SaveFileDialog();
|
||||
sfd.FileName = "romfs.bin";
|
||||
sfd.Filter = "Binary File|*.*";
|
||||
if (sfd.ShowDialog() == DialogResult.OK)
|
||||
{ new Thread(() => { threads++; RomFSTool.BuildRomFS(RomFS, null, pBar1); threads--; }).Start(); }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void L_Game_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (GB_RomFS.Enabled && RomFS != null && ModifierKeys == Keys.Control)
|
||||
if (DialogResult.Yes == Util.Prompt(MessageBoxButtons.YesNo, "Restore Original Files?"))
|
||||
restoreGARCs(oras, allGARCs);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -192,6 +192,9 @@
|
||||
<metadata name="B_TMHM.Locked" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>True</value>
|
||||
</metadata>
|
||||
<metadata name="RTB_Status.Locked" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>True</value>
|
||||
</metadata>
|
||||
<metadata name="$this.Locked" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>True</value>
|
||||
</metadata>
|
||||
|
||||
@@ -1,6 +1,4 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Windows.Forms;
|
||||
|
||||
namespace pk3DS
|
||||
|
||||
@@ -1,7 +1,4 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Linq;
|
||||
|
||||
namespace pk3DS
|
||||
{
|
||||
|
||||
@@ -1,13 +1,10 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Data;
|
||||
using System.Drawing;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Security.Cryptography;
|
||||
using System.Windows.Forms;
|
||||
using System.Text;
|
||||
using System.Threading;
|
||||
using System.Windows.Forms;
|
||||
|
||||
namespace pk3DS
|
||||
{
|
||||
|
||||
1
pk3DS/Subforms/EggMove.Designer.cs
generated
1
pk3DS/Subforms/EggMove.Designer.cs
generated
@@ -98,6 +98,7 @@ private void InitializeComponent()
|
||||
this.Controls.Add(this.L_Species);
|
||||
this.Controls.Add(this.CB_Species);
|
||||
this.Controls.Add(this.dgv);
|
||||
this.MaximizeBox = false;
|
||||
this.MinimumSize = new System.Drawing.Size(322, 450);
|
||||
this.Name = "EggMove";
|
||||
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent;
|
||||
|
||||
@@ -1,12 +1,7 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Data;
|
||||
using System.Drawing;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Windows.Forms;
|
||||
using System.IO;
|
||||
using System.Windows.Forms;
|
||||
|
||||
namespace pk3DS
|
||||
{
|
||||
@@ -15,7 +10,7 @@ public partial class EggMove : Form
|
||||
public EggMove()
|
||||
{
|
||||
InitializeComponent();
|
||||
|
||||
|
||||
specieslist[0] = movelist[0] = "";
|
||||
Array.Resize(ref specieslist, 722);
|
||||
|
||||
@@ -131,7 +126,7 @@ private void B_Dump_Click(object sender, EventArgs e)
|
||||
string path = sfd.FileName;
|
||||
File.WriteAllText(path, result, System.Text.Encoding.Unicode);
|
||||
}
|
||||
dumping = false;
|
||||
dumping = false;
|
||||
}
|
||||
|
||||
private void formClosing(object sender, FormClosingEventArgs e)
|
||||
@@ -139,4 +134,4 @@ private void formClosing(object sender, FormClosingEventArgs e)
|
||||
setList();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,12 +1,8 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Data;
|
||||
using System.Drawing;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Windows.Forms;
|
||||
using System.IO;
|
||||
using System.Windows.Forms;
|
||||
|
||||
namespace pk3DS
|
||||
{
|
||||
@@ -184,7 +180,7 @@ private void B_Dump_Click(object sender, EventArgs e)
|
||||
string path = sfd.FileName;
|
||||
File.WriteAllText(path, result, System.Text.Encoding.Unicode);
|
||||
}
|
||||
dumping = false;
|
||||
dumping = false;
|
||||
}
|
||||
|
||||
private void formClosing(object sender, FormClosingEventArgs e)
|
||||
@@ -235,5 +231,4 @@ private void changeInto(object sender, EventArgs e)
|
||||
pic[Array.IndexOf(rb, sender as ComboBox)].Image = (Bitmap)Properties.Resources.ResourceManager.GetObject("_" + Array.IndexOf(specieslist, (sender as ComboBox).Text));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,12 +1,6 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Data;
|
||||
using System.Drawing;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Windows.Forms;
|
||||
using System.IO;
|
||||
using System.Windows.Forms;
|
||||
|
||||
namespace pk3DS
|
||||
{
|
||||
@@ -22,7 +16,7 @@ public Item()
|
||||
string[] files = Directory.GetFiles("item");
|
||||
string[] itemlist = Main.getText((Main.oras) ? 114 : 96);
|
||||
string[] itemflavor = Main.getText((Main.oras) ? 117 : 99);
|
||||
|
||||
|
||||
private void Setup()
|
||||
{
|
||||
foreach (string s in itemlist) CB_Item.Items.Add(s);
|
||||
@@ -65,4 +59,4 @@ private void changePrice(object sender, EventArgs e)
|
||||
MT_Sell.Text = ((Math.Min(Util.ToUInt32(MT_Price) / 10, 0x7FFF)) * 10 / 2).ToString();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
1
pk3DS/Subforms/LevelUp.Designer.cs
generated
1
pk3DS/Subforms/LevelUp.Designer.cs
generated
@@ -99,6 +99,7 @@ private void InitializeComponent()
|
||||
this.Controls.Add(this.L_Species);
|
||||
this.Controls.Add(this.CB_Species);
|
||||
this.Controls.Add(this.dgv);
|
||||
this.MaximizeBox = false;
|
||||
this.MinimumSize = new System.Drawing.Size(322, 450);
|
||||
this.Name = "LevelUp";
|
||||
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent;
|
||||
|
||||
@@ -1,12 +1,7 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Data;
|
||||
using System.Drawing;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Windows.Forms;
|
||||
using System.IO;
|
||||
using System.Windows.Forms;
|
||||
|
||||
namespace pk3DS
|
||||
{
|
||||
@@ -135,7 +130,7 @@ private void B_RandAll_Click(object sender, EventArgs e)
|
||||
|
||||
int[] firstMoves = new int[] { 1, 40, 52, 55, 64, 71, 84, 98, 122, 141 };
|
||||
// Pound, Poison Sting, Ember, Water Gun, Peck, Absorb, Thunder Shock, Quick Attack, Lick, Leech Life
|
||||
|
||||
|
||||
for (int i = 0; i < CB_Species.Items.Count; i++)
|
||||
{
|
||||
CB_Species.SelectedIndex = i; // Get new Species
|
||||
|
||||
1
pk3DS/Subforms/MEE.Designer.cs
generated
1
pk3DS/Subforms/MEE.Designer.cs
generated
@@ -406,6 +406,7 @@ private void InitializeComponent()
|
||||
this.Controls.Add(this.CHK_MEvo1);
|
||||
this.Controls.Add(this.GB_MEvo2);
|
||||
this.Controls.Add(this.GB_MEvo1);
|
||||
this.MaximizeBox = false;
|
||||
this.MaximumSize = new System.Drawing.Size(430, 250);
|
||||
this.MinimumSize = new System.Drawing.Size(430, 250);
|
||||
this.Name = "MEE";
|
||||
|
||||
@@ -1,13 +1,9 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Data;
|
||||
using System.Drawing;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows.Forms;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Windows.Forms;
|
||||
|
||||
namespace pk3DS
|
||||
{
|
||||
@@ -23,7 +19,7 @@ public partial class MEE : Form
|
||||
private ComboBox[] forme_spec, item_spec;
|
||||
private CheckBox[] checkbox_spec;
|
||||
private PictureBox[][] picturebox_spec;
|
||||
private List<cbItem> monNames;
|
||||
private List<Util.cbItem> monNames;
|
||||
private bool loaded = false;
|
||||
private string[][] AltForms;
|
||||
int entry = -1;
|
||||
@@ -39,7 +35,7 @@ public partial class MEE : Form
|
||||
specieslist[32] += "♂"; specieslist[29] += "♀";
|
||||
AltForms = Personal.getFormList(personalData, Main.oras, specieslist, forms, types, itemlist);
|
||||
|
||||
groupbox_spec = new GroupBox[] {GB_MEvo1,GB_MEvo2,GB_MEvo3};
|
||||
groupbox_spec = new GroupBox[] { GB_MEvo1, GB_MEvo2, GB_MEvo3 };
|
||||
item_spec = new ComboBox[] { CB_Item1, CB_Item2, CB_Item3 };
|
||||
forme_spec = new ComboBox[] { CB_Forme1, CB_Forme2, CB_Forme3 };
|
||||
checkbox_spec = new CheckBox[] { CHK_MEvo1, CHK_MEvo2, CHK_MEvo3 };
|
||||
@@ -50,12 +46,12 @@ public partial class MEE : Form
|
||||
}
|
||||
private void Setup()
|
||||
{
|
||||
monNames = new List<cbItem>();
|
||||
monNames = new List<Util.cbItem>();
|
||||
List<string> temp_list = new List<string>(specieslist);
|
||||
temp_list.Sort();
|
||||
foreach (string mon in temp_list)
|
||||
{
|
||||
cbItem ncbi = new cbItem();
|
||||
Util.cbItem ncbi = new Util.cbItem();
|
||||
ncbi.Text = mon;
|
||||
ncbi.Value = Array.IndexOf(specieslist, mon);
|
||||
monNames.Add(ncbi);
|
||||
@@ -65,29 +61,29 @@ private void Setup()
|
||||
|
||||
List<string> items = new List<string>(itemlist);
|
||||
List<string> sorted_items = new List<string>(itemlist);
|
||||
List<cbItem>[] item_lists = new List<cbItem>[item_spec.Length];
|
||||
List<Util.cbItem>[] item_lists = new List<Util.cbItem>[item_spec.Length];
|
||||
for (int i = 0; i < item_lists.Length; i++)
|
||||
item_lists[i] = new List<cbItem>();
|
||||
item_lists[i] = new List<Util.cbItem>();
|
||||
|
||||
sorted_items.Sort();
|
||||
for (int i = 0; i < items.Count; i++)
|
||||
{
|
||||
int index = items.IndexOf(sorted_items[i]);
|
||||
{
|
||||
cbItem ncbi = new cbItem();
|
||||
Util.cbItem ncbi = new Util.cbItem();
|
||||
if (sorted_items[i] == "???") continue; // Don't allow stubbed items.
|
||||
ncbi.Text = sorted_items[i] + " - " + index.ToString("000");
|
||||
ncbi.Value = index;
|
||||
foreach (List<cbItem> l in item_lists)
|
||||
foreach (List<Util.cbItem> l in item_lists)
|
||||
l.Add(ncbi);
|
||||
}
|
||||
items[index] = "";
|
||||
}
|
||||
for (int i = 0; i < item_spec.Length; i++)
|
||||
{
|
||||
item_spec[i].DataSource = item_lists[i];
|
||||
item_spec[i].ValueMember = "Value";
|
||||
item_spec[i].DisplayMember = "Text";
|
||||
item_spec[i].DataSource = item_lists[i];
|
||||
item_spec[i].SelectedValue = 0;
|
||||
}
|
||||
|
||||
@@ -95,9 +91,9 @@ private void Setup()
|
||||
}
|
||||
private void CHK_Changed(object sender, EventArgs e)
|
||||
{
|
||||
for (int i = 0; i < groupbox_spec.Length;i++ )
|
||||
for (int i = 0; i < groupbox_spec.Length; i++)
|
||||
{
|
||||
groupbox_spec[i].Enabled = ((CheckBox)(checkbox_spec[i])).Checked;
|
||||
groupbox_spec[i].Enabled = checkbox_spec[i].Checked;
|
||||
Update_PBs(i);
|
||||
}
|
||||
}
|
||||
@@ -115,7 +111,7 @@ private void getEntry()
|
||||
{
|
||||
if (Main.oras && entry == 384 && !dumping) // Current Mon is Rayquaza
|
||||
Util.Alert("Rayquaza is special and uses a different activator for its evolution. If it knows Dragon Ascent, it can Mega Evolve", "Don't edit its evolution table if you want to keep this functionality.");
|
||||
|
||||
|
||||
byte[] data = File.ReadAllBytes(files[entry]);
|
||||
|
||||
foreach (ComboBox CB in forme_spec)
|
||||
@@ -139,12 +135,12 @@ private void setEntry()
|
||||
byte[] data = File.ReadAllBytes(path);
|
||||
for (int i = 0; i < 3; i++)
|
||||
{
|
||||
bool isChecked = ((CheckBox)checkbox_spec[i]).Checked;
|
||||
bool isChecked = checkbox_spec[i].Checked;
|
||||
Array.Copy(BitConverter.GetBytes(isChecked ? (ushort)1 : (ushort)0), 0, data, 2 + i * 8, 2);
|
||||
if (isChecked)
|
||||
{
|
||||
int item = (int)(item_spec[i].SelectedValue);
|
||||
int form = (ushort)forme_spec[i].SelectedIndex;
|
||||
int form = forme_spec[i].SelectedIndex;
|
||||
Array.Copy(BitConverter.GetBytes((ushort)item), 0, data, 4 + i * 8, 2);
|
||||
Array.Copy(BitConverter.GetBytes((ushort)form), 0, data, i * 8, 2);
|
||||
}
|
||||
@@ -166,13 +162,13 @@ private void Update_PBs(object sender, EventArgs e)
|
||||
CheckBox CB = (CheckBox)checkbox_spec[i];
|
||||
if (CB.Checked)
|
||||
{
|
||||
UpdateImage(picturebox_spec[0][i], entry, 0, (int)((ComboBox)item_spec[i]).SelectedValue, 0, false);
|
||||
UpdateImage(picturebox_spec[1][i], entry, (int)((ComboBox)forme_spec[i]).SelectedIndex, (int)((ComboBox)item_spec[i]).SelectedValue, 0, false);
|
||||
UpdateImage(picturebox_spec[0][i], entry, 0, (int)(item_spec[i]).SelectedValue, 0, false);
|
||||
UpdateImage(picturebox_spec[1][i], entry, (int)(forme_spec[i]).SelectedIndex, (int)(item_spec[i]).SelectedValue, 0, false);
|
||||
}
|
||||
else
|
||||
{
|
||||
UpdateImage(picturebox_spec[0][i], 0, 0, (int)((ComboBox)item_spec[i]).SelectedValue, 0, false);
|
||||
UpdateImage(picturebox_spec[1][i], 0, 0, (int)((ComboBox)item_spec[i]).SelectedValue, 0, false);
|
||||
UpdateImage(picturebox_spec[0][i], 0, 0, (int)(item_spec[i]).SelectedValue, 0, false);
|
||||
UpdateImage(picturebox_spec[1][i], 0, 0, (int)(item_spec[i]).SelectedValue, 0, false);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -181,31 +177,20 @@ private void Update_PBs(int i)
|
||||
{
|
||||
if (loaded)
|
||||
{
|
||||
CheckBox CB = (CheckBox)checkbox_spec[i];
|
||||
if (CB.Checked)
|
||||
{
|
||||
UpdateImage(picturebox_spec[0][i], entry, 0, (int)((ComboBox)item_spec[i]).SelectedValue, 0, false);
|
||||
UpdateImage(picturebox_spec[1][i], entry, (int)((ComboBox)forme_spec[i]).SelectedIndex, (int)((ComboBox)item_spec[i]).SelectedValue, 0, false);
|
||||
}
|
||||
else
|
||||
{
|
||||
UpdateImage(picturebox_spec[0][i], 0, 0, (int)((ComboBox)item_spec[i]).SelectedValue, 0, false);
|
||||
UpdateImage(picturebox_spec[1][i], 0, 0, (int)((ComboBox)item_spec[i]).SelectedValue, 0, false);
|
||||
}
|
||||
CheckBox CB = (CheckBox)checkbox_spec[i];
|
||||
if (CB.Checked)
|
||||
{
|
||||
UpdateImage(picturebox_spec[0][i], entry, 0, (int)(item_spec[i]).SelectedValue, 0, false);
|
||||
UpdateImage(picturebox_spec[1][i], entry, (int)(forme_spec[i]).SelectedIndex, (int)(item_spec[i]).SelectedValue, 0, false);
|
||||
}
|
||||
else
|
||||
{
|
||||
UpdateImage(picturebox_spec[0][i], 0, 0, (int)(item_spec[i]).SelectedValue, 0, false);
|
||||
UpdateImage(picturebox_spec[1][i], 0, 0, (int)(item_spec[i]).SelectedValue, 0, false);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public class cbItem
|
||||
{
|
||||
public string Text { get; set; }
|
||||
public int Value { get; set; }
|
||||
|
||||
public override string ToString()
|
||||
{
|
||||
return Text;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private void UpdateImage(PictureBox bpkx, int species, int form, int item, int gender, bool shiny)
|
||||
{
|
||||
string file = "";
|
||||
@@ -271,11 +256,9 @@ private void B_Dump_Click(object sender, EventArgs e)
|
||||
|
||||
System.Media.SystemSounds.Asterisk.Play();
|
||||
if (sfd.ShowDialog() == DialogResult.OK)
|
||||
{
|
||||
string path = sfd.FileName;
|
||||
File.WriteAllText(path, result, System.Text.Encoding.Unicode);
|
||||
}
|
||||
dumping = false;
|
||||
File.WriteAllText(sfd.FileName, result, System.Text.Encoding.Unicode);
|
||||
|
||||
dumping = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,12 +1,8 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Data;
|
||||
using System.Drawing;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Windows.Forms;
|
||||
using System.IO;
|
||||
using System.Windows.Forms;
|
||||
|
||||
namespace pk3DS
|
||||
{
|
||||
@@ -63,7 +59,7 @@ private void changeTrainer(object sender, EventArgs e)
|
||||
private void changePokemon(object sender, EventArgs e)
|
||||
{
|
||||
setPokemon();
|
||||
pkEntry = CB_Pokemon.SelectedIndex;
|
||||
pkEntry = CB_Pokemon.SelectedIndex;
|
||||
getPokemon();
|
||||
}
|
||||
private void getTrainer()
|
||||
@@ -103,7 +99,7 @@ private void getPokemon()
|
||||
{
|
||||
if (pkEntry < 0 || dumping) return;
|
||||
byte[] data = File.ReadAllBytes(pkFiles[pkEntry]);
|
||||
|
||||
|
||||
// Get
|
||||
CB_Species.SelectedIndex = BitConverter.ToUInt16(data, 0);
|
||||
CB_Move1.SelectedIndex = BitConverter.ToUInt16(data, 2);
|
||||
@@ -136,7 +132,7 @@ private void setPokemon()
|
||||
Array.Copy(BitConverter.GetBytes((ushort)((int)CB_Move3.SelectedIndex)), 0, data, 6, 2);
|
||||
Array.Copy(BitConverter.GetBytes((ushort)((int)CB_Move4.SelectedIndex)), 0, data, 8, 2);
|
||||
int EVs = 0;
|
||||
EVs |= (CHK_HP.Checked) ? 1 << 0 : 0;
|
||||
EVs |= (CHK_HP.Checked) ? 1 << 0 : 0;
|
||||
EVs |= (CHK_ATK.Checked) ? 1 << 1 : 0;
|
||||
EVs |= (CHK_DEF.Checked) ? 1 << 2 : 0;
|
||||
EVs |= (CHK_Spe.Checked) ? 1 << 3 : 0;
|
||||
@@ -257,7 +253,7 @@ private void B_DumpPKs_Click(object sender, EventArgs e)
|
||||
result += (CHK_Spe.Checked) ? "Spe, " : "";
|
||||
result += Environment.NewLine;
|
||||
|
||||
result += Environment.NewLine;
|
||||
result += Environment.NewLine;
|
||||
}
|
||||
}
|
||||
SaveFileDialog sfd = new SaveFileDialog();
|
||||
@@ -274,4 +270,4 @@ private void B_DumpPKs_Click(object sender, EventArgs e)
|
||||
CB_Trainer.SelectedIndex = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
1
pk3DS/Subforms/Mart.Designer.cs
generated
1
pk3DS/Subforms/Mart.Designer.cs
generated
@@ -78,6 +78,7 @@ private void InitializeComponent()
|
||||
this.Controls.Add(this.L_Mart);
|
||||
this.Controls.Add(this.dgv);
|
||||
this.Controls.Add(this.CB_Location);
|
||||
this.MaximizeBox = false;
|
||||
this.MaximumSize = new System.Drawing.Size(340, 400);
|
||||
this.MinimumSize = new System.Drawing.Size(340, 400);
|
||||
this.Name = "Mart";
|
||||
|
||||
@@ -1,12 +1,6 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Data;
|
||||
using System.Drawing;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Windows.Forms;
|
||||
using System.IO;
|
||||
using System.Windows.Forms;
|
||||
|
||||
namespace pk3DS
|
||||
{
|
||||
@@ -101,4 +95,4 @@ private void formClosing(object sender, FormClosingEventArgs e)
|
||||
File.WriteAllBytes(codebin, data);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,12 +1,6 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Data;
|
||||
using System.Drawing;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Windows.Forms;
|
||||
using System.IO;
|
||||
using System.Windows.Forms;
|
||||
|
||||
namespace pk3DS
|
||||
{
|
||||
@@ -98,7 +92,7 @@ private void getEntry()
|
||||
NUD_Effect.Value = BitConverter.ToUInt16(data, 0x10);
|
||||
NUD_Recoil.Value = (sbyte)data[0x12];
|
||||
NUD_Heal.Value = data[0x13];
|
||||
|
||||
|
||||
CB_Targeting.SelectedIndex = data[0x14];
|
||||
CB_Stat1.SelectedIndex = data[0x15];
|
||||
CB_Stat2.SelectedIndex = data[0x16];
|
||||
@@ -106,9 +100,9 @@ private void getEntry()
|
||||
NUD_Stat1.Value = (sbyte)data[0x18];
|
||||
NUD_Stat2.Value = (sbyte)data[0x19];
|
||||
NUD_Stat3.Value = (sbyte)data[0x1A];
|
||||
NUD_StatP1.Value = data[0x1B];
|
||||
NUD_StatP2.Value = data[0x1C];
|
||||
NUD_StatP3.Value = data[0x1D];
|
||||
NUD_StatP1.Value = data[0x1B];
|
||||
NUD_StatP2.Value = data[0x1C];
|
||||
NUD_StatP3.Value = data[0x1D];
|
||||
|
||||
// Unknown (Bitflag Related for stuff like Contact and Extra Move Effects)
|
||||
NUD_0x20.Value = data[0x20]; // 0x20
|
||||
@@ -179,7 +173,7 @@ private void B_RandAll_Click(object sender, EventArgs e)
|
||||
|
||||
// Change Damage Category if Not Status
|
||||
if (CB_Category.SelectedIndex > 0) // Not Status
|
||||
CB_Category.SelectedIndex = rnd.Next(1, 3);
|
||||
CB_Category.SelectedIndex = rnd.Next(1, 3);
|
||||
|
||||
// Change Move Type
|
||||
CB_Type.SelectedIndex = rnd.Next(0, 18);
|
||||
@@ -187,4 +181,4 @@ private void B_RandAll_Click(object sender, EventArgs e)
|
||||
Util.Alert("Moves have been randomized!");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,12 +1,7 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Data;
|
||||
using System.Drawing;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Windows.Forms;
|
||||
using System.IO;
|
||||
using System.Windows.Forms;
|
||||
|
||||
namespace pk3DS
|
||||
{
|
||||
@@ -19,7 +14,7 @@ public Personal()
|
||||
ability_boxes = new ComboBox[] { CB_Ability1, CB_Ability2, CB_Ability3 };
|
||||
typing_boxes = new ComboBox[] { CB_Type1, CB_Type2 };
|
||||
eggGroup_boxes = new ComboBox[] { CB_EggGroup1, CB_EggGroup2 };
|
||||
byte_boxes = new MaskedTextBox[] { TB_BaseHP, TB_BaseATK, TB_BaseDEF, TB_BaseSPA, TB_BaseSPD, TB_BaseSPE, TB_Gender, TB_HatchCycles, TB_Friendship, TB_CatchRate };
|
||||
byte_boxes = new MaskedTextBox[] { TB_BaseHP, TB_BaseATK, TB_BaseDEF, TB_BaseSPA, TB_BaseSPD, TB_BaseSPE, TB_Gender, TB_HatchCycles, TB_Friendship, TB_CatchRate };
|
||||
ev_boxes = new MaskedTextBox[] { TB_HPEVs, TB_ATKEVs, TB_DEFEVs, TB_SPEEVs, TB_SPAEVs, TB_SPDEVs };
|
||||
|
||||
data = File.ReadAllBytes(paths[paths.Length - 1]); // Load last to data.
|
||||
@@ -148,7 +143,7 @@ private void Setup()
|
||||
CB_Color.Items.Add(co);
|
||||
|
||||
foreach (string eg in EXPGroups)
|
||||
CB_EXPGroup.Items.Add(eg);
|
||||
CB_EXPGroup.Items.Add(eg);
|
||||
}
|
||||
|
||||
private void CB_Species_SelectedIndexChanged(object sender, EventArgs e)
|
||||
@@ -315,9 +310,9 @@ private void saveEntry()
|
||||
edits[8] = Convert.ToByte(TB_CatchRate.Text);
|
||||
edits[9] = Convert.ToByte(TB_Stage.Text);
|
||||
|
||||
Array.Copy(BitConverter.GetBytes((ushort)CB_HeldItem1.SelectedIndex),0, edits, 0xC,2);
|
||||
Array.Copy(BitConverter.GetBytes((ushort)CB_HeldItem2.SelectedIndex),0, edits, 0xE,2);
|
||||
Array.Copy(BitConverter.GetBytes((ushort)CB_HeldItem3.SelectedIndex),0, edits, 0x10,2);
|
||||
Array.Copy(BitConverter.GetBytes((ushort)CB_HeldItem1.SelectedIndex), 0, edits, 0xC, 2);
|
||||
Array.Copy(BitConverter.GetBytes((ushort)CB_HeldItem2.SelectedIndex), 0, edits, 0xE, 2);
|
||||
Array.Copy(BitConverter.GetBytes((ushort)CB_HeldItem3.SelectedIndex), 0, edits, 0x10, 2);
|
||||
|
||||
edits[0x12] = Convert.ToByte(TB_Gender.Text);
|
||||
edits[0x13] = Convert.ToByte(TB_HatchCycles.Text);
|
||||
@@ -350,22 +345,22 @@ private void saveEntry()
|
||||
for (int j = 0; j < 8; j++)
|
||||
if (i * 8 + j < CLB_TMHM.Items.Count)
|
||||
if (CLB_TMHM.GetItemChecked(i * 8 + j))
|
||||
edits[0x28+i] |= (byte)(1<<j);
|
||||
edits[0x28 + i] |= (byte)(1 << j);
|
||||
|
||||
uint tutors = 0;
|
||||
for (int t = 0; t < 8; t++)
|
||||
if (t < CLB_MoveTutors.Items.Count && CLB_MoveTutors.GetItemChecked(t))
|
||||
tutors |= (uint)(1<<t);
|
||||
tutors |= (uint)(1 << t);
|
||||
|
||||
Array.Copy(BitConverter.GetBytes(tutors), 0, edits, 0x38, 4);
|
||||
|
||||
if (mode == "ORAS")
|
||||
{
|
||||
uint[] tutorm = new uint[4];
|
||||
int ofs=0;
|
||||
int ofs = 0;
|
||||
for (int j = 0; j < tutor1.Length; j++)
|
||||
if (CLB_OrasTutors.GetItemChecked(ofs++))
|
||||
tutorm[0] |= (uint)(1<<j);
|
||||
tutorm[0] |= (uint)(1 << j);
|
||||
|
||||
for (int j = 0; j < tutor2.Length; j++)
|
||||
if (CLB_OrasTutors.GetItemChecked(ofs++))
|
||||
@@ -410,7 +405,7 @@ private void B_Randomize_Click(object sender, EventArgs e)
|
||||
int TMPercent = 35; // Average Learnable TMs is 35.260.
|
||||
ushort[] itemlist = (Main.oras) ? Legal.Pouch_Items_ORAS : Legal.Pouch_Items_XY;
|
||||
ushort[] berrylist = Legal.Pouch_Berry_XY;
|
||||
Array.Resize(ref itemlist, itemlist.Length + berrylist.Length);
|
||||
Array.Resize(ref itemlist, itemlist.Length + berrylist.Length);
|
||||
Array.Copy(berrylist, 0, itemlist, itemlist.Length - berrylist.Length, berrylist.Length);
|
||||
|
||||
int itemlen = itemlist.Length;
|
||||
@@ -439,16 +434,16 @@ private void B_Randomize_Click(object sender, EventArgs e)
|
||||
if (Convert.ToByte(byte_boxes[0].Text) == 1)
|
||||
CB_Ability1.SelectedIndex = CB_Ability2.SelectedIndex = CB_Ability3.SelectedIndex = 25;
|
||||
else
|
||||
for (int z = 0; z < 6; z++)
|
||||
byte_boxes[z].Text =
|
||||
Math.Max(
|
||||
5,
|
||||
rnd.Next
|
||||
(
|
||||
Convert.ToByte(byte_boxes[z].Text) * 3 / 4,
|
||||
(byte)Convert.ToByte(byte_boxes[z].Text) * 5 / 4)
|
||||
)
|
||||
.ToString("000");
|
||||
for (int z = 0; z < 6; z++)
|
||||
byte_boxes[z].Text =
|
||||
Math.Max(
|
||||
5,
|
||||
rnd.Next
|
||||
(
|
||||
Convert.ToByte(byte_boxes[z].Text) * 3 / 4,
|
||||
(byte)Convert.ToByte(byte_boxes[z].Text) * 5 / 4)
|
||||
)
|
||||
.ToString("000");
|
||||
|
||||
// EV yield stays the same...
|
||||
|
||||
@@ -458,7 +453,7 @@ private void B_Randomize_Click(object sender, EventArgs e)
|
||||
CB_HeldItem3.SelectedIndex = (CB_HeldItem3.SelectedIndex > 0) ? itemlist[rnd.Next(1, itemlen)] : 0;
|
||||
|
||||
// Type
|
||||
if (rnd.Next(0,100) < 50) // 50% chance to have either Single or Dual Typing
|
||||
if (rnd.Next(0, 100) < 50) // 50% chance to have either Single or Dual Typing
|
||||
CB_Type1.SelectedIndex = CB_Type2.SelectedIndex = rnd.Next(0, typelen);
|
||||
else
|
||||
{
|
||||
@@ -472,7 +467,7 @@ private void B_Randomize_Click(object sender, EventArgs e)
|
||||
bool dumping = false;
|
||||
private void B_Dump_Click(object sender, EventArgs e)
|
||||
{
|
||||
|
||||
|
||||
if (DialogResult.Yes != Util.Prompt(MessageBoxButtons.YesNo, "Dump all Personal Entries to Text File?"))
|
||||
return;
|
||||
|
||||
@@ -486,7 +481,7 @@ private void B_Dump_Click(object sender, EventArgs e)
|
||||
result += String.Format("Base Stats: {0}.{1}.{2}.{3}.{4}.{5} (BST: {6})", TB_BaseHP.Text, TB_BaseATK.Text, TB_BaseDEF.Text, TB_BaseSPA.Text, TB_BaseSPD.Text, TB_BaseSPE.Text, bst) + Environment.NewLine;
|
||||
result += String.Format("EV Yield: {0}.{1}.{2}.{3}.{4}.{5}", TB_HPEVs.Text, TB_ATKEVs.Text, TB_DEFEVs.Text, TB_SPAEVs.Text, TB_SPDEVs.Text, TB_SPEEVs.Text) + Environment.NewLine;
|
||||
result += String.Format("Abilities: {0} (1) | {1} (2) | {2} (H)", CB_Ability1.Text, CB_Ability2.Text, CB_Ability3.Text) + Environment.NewLine;
|
||||
|
||||
|
||||
result += String.Format(((CB_Type1.SelectedIndex != CB_Type2.SelectedIndex) ? "Type: {0} / {1}" : "Type: {0}"), CB_Type1.Text, CB_Type2.Text);
|
||||
|
||||
result += String.Format("Item 1 (50%): {0}", CB_HeldItem1.Text) + Environment.NewLine;
|
||||
@@ -506,7 +501,7 @@ private void B_Dump_Click(object sender, EventArgs e)
|
||||
string path = sfd.FileName;
|
||||
File.WriteAllText(path, result, System.Text.Encoding.Unicode);
|
||||
}
|
||||
dumping = false;
|
||||
dumping = false;
|
||||
}
|
||||
|
||||
private void formClosing(object sender, FormClosingEventArgs e)
|
||||
|
||||
1
pk3DS/Subforms/Pickup.Designer.cs
generated
1
pk3DS/Subforms/Pickup.Designer.cs
generated
@@ -113,6 +113,7 @@ private void InitializeComponent()
|
||||
this.Controls.Add(this.dgvRare);
|
||||
this.Controls.Add(this.L_TM);
|
||||
this.Controls.Add(this.dgvCommon);
|
||||
this.MaximizeBox = false;
|
||||
this.MaximumSize = new System.Drawing.Size(520, 670);
|
||||
this.MinimumSize = new System.Drawing.Size(520, 370);
|
||||
this.Name = "Pickup";
|
||||
|
||||
@@ -1,12 +1,7 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Data;
|
||||
using System.Drawing;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Windows.Forms;
|
||||
using System.IO;
|
||||
using System.Windows.Forms;
|
||||
|
||||
namespace pk3DS
|
||||
{
|
||||
@@ -36,7 +31,7 @@ private void getDataOffset()
|
||||
}
|
||||
private void setupDGV()
|
||||
{
|
||||
dgvCommon.Columns.Clear(); dgvRare.Columns.Clear();
|
||||
dgvCommon.Columns.Clear(); dgvRare.Columns.Clear();
|
||||
DataGridViewColumn dgvIndex = new DataGridViewTextBoxColumn();
|
||||
{
|
||||
dgvIndex.HeaderText = "Index";
|
||||
@@ -63,7 +58,7 @@ private void setupDGV()
|
||||
|
||||
List<ushort> common = new List<ushort>();
|
||||
List<ushort> rare = new List<ushort>();
|
||||
|
||||
|
||||
private void getList()
|
||||
{
|
||||
common = new List<ushort>();
|
||||
@@ -75,14 +70,14 @@ private void getList()
|
||||
common.Add(BitConverter.ToUInt16(data, dataoffset + 2 * i));
|
||||
for (int i = 0x12; i < 0x12 + 0xB; i++) // 0xB Rare
|
||||
rare.Add(BitConverter.ToUInt16(data, dataoffset + 2 * i));
|
||||
|
||||
|
||||
ushort[] clist = common.ToArray();
|
||||
ushort[] rlist = rare.ToArray();
|
||||
for (int i = 0; i < clist.Length; i++)
|
||||
{ dgvCommon.Rows.Add(); dgvCommon.Rows[i].Cells[0].Value = i.ToString(); dgvCommon.Rows[i].Cells[1].Value = itemlist[clist[i]]; }
|
||||
for (int i = 0; i < rlist.Length; i++)
|
||||
{ dgvRare.Rows.Add(); dgvRare.Rows[i].Cells[0].Value = i.ToString(); dgvRare.Rows[i].Cells[1].Value = itemlist[rlist[i]]; }
|
||||
|
||||
|
||||
}
|
||||
private void setList()
|
||||
{
|
||||
@@ -100,7 +95,7 @@ private void setList()
|
||||
for (int i = 0; i < 0x12; i++)
|
||||
Array.Copy(BitConverter.GetBytes(clist[i]), 0, data, offset + 2 * i, 2);
|
||||
for (int i = 0x12; i < 0x12 + 0xB; i++)
|
||||
Array.Copy(BitConverter.GetBytes(rlist[i - 0x12]), 0, data, offset + 2 * i, 2);
|
||||
Array.Copy(BitConverter.GetBytes(rlist[i - 0x12]), 0, data, offset + 2 * i, 2);
|
||||
}
|
||||
|
||||
private void formClosing(object sender, FormClosingEventArgs e)
|
||||
@@ -109,4 +104,4 @@ private void formClosing(object sender, FormClosingEventArgs e)
|
||||
File.WriteAllBytes(codebin, data);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
1
pk3DS/Subforms/RSTE.Designer.cs
generated
1
pk3DS/Subforms/RSTE.Designer.cs
generated
@@ -2064,6 +2064,7 @@ private void InitializeComponent()
|
||||
this.Controls.Add(this.CB_TrainerID);
|
||||
this.Controls.Add(this.tabControl1);
|
||||
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle;
|
||||
this.MaximizeBox = false;
|
||||
this.Name = "RSTE";
|
||||
this.Text = "Trainer Editor";
|
||||
this.tabControl1.ResumeLayout(false);
|
||||
|
||||
@@ -1,12 +1,7 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Data;
|
||||
using System.Drawing;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Windows.Forms;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Windows.Forms;
|
||||
|
||||
namespace pk3DS
|
||||
{
|
||||
@@ -15,7 +10,7 @@ public partial class RSTE : Form
|
||||
public RSTE()
|
||||
{
|
||||
Array.Resize(ref specieslist, 722);
|
||||
|
||||
|
||||
InitializeComponent();
|
||||
// String Fetching
|
||||
#region Combo Box Arrays
|
||||
@@ -273,7 +268,7 @@ private void B_Dump_Click(object sender, EventArgs e)
|
||||
SaveFileDialog sfd = new SaveFileDialog();
|
||||
sfd.FileName = "Battles.txt";
|
||||
sfd.Filter = "Text File|*.txt";
|
||||
|
||||
|
||||
System.Media.SystemSounds.Asterisk.Play();
|
||||
if (sfd.ShowDialog() == DialogResult.OK)
|
||||
{
|
||||
@@ -299,7 +294,7 @@ private void readFile()
|
||||
if (index == 0) return;
|
||||
|
||||
// Load Trainer Data
|
||||
using (BinaryReader br = new BinaryReader((Stream) File.OpenRead(trdatapaths[index])))
|
||||
using (BinaryReader br = new BinaryReader((Stream)File.OpenRead(trdatapaths[index])))
|
||||
{
|
||||
// load trainer data
|
||||
tabControl1.Enabled = true;
|
||||
@@ -416,7 +411,7 @@ private void writeFile()
|
||||
bw.Write((ushort)trpk_m4[i].SelectedIndex);
|
||||
}
|
||||
}
|
||||
File.WriteAllBytes(trpokepaths[index],ms.ToArray());
|
||||
File.WriteAllBytes(trpokepaths[index], ms.ToArray());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,14 +1,7 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Data;
|
||||
using System.Drawing;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Windows.Forms;
|
||||
using System.Threading;
|
||||
using System.IO;
|
||||
using System.Globalization;
|
||||
using System.Linq;
|
||||
using System.Windows.Forms;
|
||||
|
||||
namespace pk3DS
|
||||
{
|
||||
@@ -658,4 +651,4 @@ private void B_Randomize_Click(object sender, EventArgs e)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
1
pk3DS/Subforms/TMHM.Designer.cs
generated
1
pk3DS/Subforms/TMHM.Designer.cs
generated
@@ -91,6 +91,7 @@ private void InitializeComponent()
|
||||
this.Controls.Add(this.dgvHM);
|
||||
this.Controls.Add(this.L_TM);
|
||||
this.Controls.Add(this.dgvTM);
|
||||
this.MaximizeBox = false;
|
||||
this.MaximumSize = new System.Drawing.Size(520, 670);
|
||||
this.MinimumSize = new System.Drawing.Size(520, 370);
|
||||
this.Name = "TMHM";
|
||||
|
||||
@@ -1,12 +1,7 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Data;
|
||||
using System.Drawing;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Windows.Forms;
|
||||
using System.IO;
|
||||
using System.Windows.Forms;
|
||||
|
||||
namespace pk3DS
|
||||
{
|
||||
@@ -36,7 +31,7 @@ private void getDataOffset()
|
||||
}
|
||||
private void setupDGV()
|
||||
{
|
||||
dgvTM.Columns.Clear(); dgvHM.Columns.Clear();
|
||||
dgvTM.Columns.Clear(); dgvHM.Columns.Clear();
|
||||
DataGridViewColumn dgvIndex = new DataGridViewTextBoxColumn();
|
||||
{
|
||||
dgvIndex.HeaderText = "Index";
|
||||
@@ -63,7 +58,7 @@ private void setupDGV()
|
||||
|
||||
List<ushort> tms = new List<ushort>();
|
||||
List<ushort> hms = new List<ushort>();
|
||||
|
||||
|
||||
private void getList()
|
||||
{
|
||||
tms = new List<ushort>();
|
||||
@@ -91,9 +86,9 @@ private void getList()
|
||||
ushort[] tmlist = tms.ToArray();
|
||||
ushort[] hmlist = hms.ToArray();
|
||||
for (int i = 0; i < tmlist.Length; i++)
|
||||
{ dgvTM.Rows.Add(); dgvTM.Rows[i].Cells[0].Value = (i+1).ToString(); dgvTM.Rows[i].Cells[1].Value = movelist[tmlist[i]]; }
|
||||
{ dgvTM.Rows.Add(); dgvTM.Rows[i].Cells[0].Value = (i + 1).ToString(); dgvTM.Rows[i].Cells[1].Value = movelist[tmlist[i]]; }
|
||||
for (int i = 0; i < hmlist.Length; i++)
|
||||
{ dgvHM.Rows.Add(); dgvHM.Rows[i].Cells[0].Value = (i+1).ToString(); dgvHM.Rows[i].Cells[1].Value = movelist[hmlist[i]]; }
|
||||
{ dgvHM.Rows.Add(); dgvHM.Rows[i].Cells[0].Value = (i + 1).ToString(); dgvHM.Rows[i].Cells[1].Value = movelist[hmlist[i]]; }
|
||||
}
|
||||
private void setList()
|
||||
{
|
||||
@@ -123,7 +118,7 @@ private void setList()
|
||||
{
|
||||
for (int i = 97; i < 105; i++)
|
||||
Array.Copy(BitConverter.GetBytes(tmlist[i - 5]), 0, data, offset + 2 * i, 2);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void formClosing(object sender, FormClosingEventArgs e)
|
||||
@@ -132,4 +127,4 @@ private void formClosing(object sender, FormClosingEventArgs e)
|
||||
File.WriteAllBytes(codebin, data);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,10 +1,4 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Data;
|
||||
using System.Drawing;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Windows.Forms;
|
||||
|
||||
namespace pk3DS
|
||||
|
||||
1
pk3DS/Subforms/Tutors.Designer.cs
generated
1
pk3DS/Subforms/Tutors.Designer.cs
generated
@@ -78,6 +78,7 @@ private void InitializeComponent()
|
||||
this.Controls.Add(this.L_Mart);
|
||||
this.Controls.Add(this.dgv);
|
||||
this.Controls.Add(this.CB_Location);
|
||||
this.MaximizeBox = false;
|
||||
this.MaximumSize = new System.Drawing.Size(340, 600);
|
||||
this.MinimumSize = new System.Drawing.Size(340, 400);
|
||||
this.Name = "Tutors";
|
||||
|
||||
@@ -1,12 +1,6 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Data;
|
||||
using System.Drawing;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Windows.Forms;
|
||||
using System.IO;
|
||||
using System.Windows.Forms;
|
||||
|
||||
namespace pk3DS
|
||||
{
|
||||
@@ -96,4 +90,4 @@ private void formClosing(object sender, FormClosingEventArgs e)
|
||||
File.WriteAllBytes(codebin, data);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,14 +1,7 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Data;
|
||||
using System.Drawing;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Windows.Forms;
|
||||
using System.Threading;
|
||||
using System.IO;
|
||||
using System.Globalization;
|
||||
using System.Linq;
|
||||
using System.Windows.Forms;
|
||||
|
||||
namespace pk3DS
|
||||
{
|
||||
@@ -339,7 +332,7 @@ private void openQuick(string[] encdata)
|
||||
CB_LocationID.Enabled = true;
|
||||
CB_LocationID_SelectedIndexChanged(null, null);
|
||||
}
|
||||
|
||||
|
||||
private bool hasData()
|
||||
{
|
||||
for (int i = 0; i < max.Length; i++)
|
||||
@@ -396,12 +389,10 @@ private string parseslot(byte[] slot)
|
||||
int min = slot[2];
|
||||
int max = slot[3];
|
||||
string species = specieslist[index];
|
||||
if (form > 0) species += "-"+form.ToString();
|
||||
if (form > 0) species += "-" + form.ToString();
|
||||
return species + ',' + min + ',' + max + ',';
|
||||
}
|
||||
|
||||
|
||||
|
||||
private void CB_LocationID_SelectedIndexChanged(object sender, EventArgs e)
|
||||
{
|
||||
int f = CB_LocationID.SelectedIndex;
|
||||
@@ -497,7 +488,7 @@ private void PreloadTabs(object sender, EventArgs e)
|
||||
for (int i = 0; i < this.TabControl_EncounterData.TabPages.Count; i++)
|
||||
{
|
||||
this.TabControl_EncounterData.TabPages[i].Show();
|
||||
Console.WriteLine("Loading Tab "+(i+1).ToString("0")+".");
|
||||
Console.WriteLine("Loading Tab " + (i + 1).ToString("0") + ".");
|
||||
}
|
||||
this.TabControl_EncounterData.TabPages[0].Show();
|
||||
}
|
||||
@@ -517,7 +508,7 @@ private void B_Randomize_Click(object sender, EventArgs e)
|
||||
// Nonrepeating List Start
|
||||
int[] sL = Randomizer.RandomSpeciesList;
|
||||
int ctr = 0;
|
||||
|
||||
|
||||
for (int i = 0; i < CB_LocationID.Items.Count; i++) // for every location
|
||||
{
|
||||
CB_LocationID.SelectedIndex = i;
|
||||
@@ -615,7 +606,5 @@ private string GetEncDataString()
|
||||
toret += "No encounters found." + Environment.NewLine + Environment.NewLine;
|
||||
return toret;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
1
pk3DS/Subforms/XYWE.designer.cs
generated
1
pk3DS/Subforms/XYWE.designer.cs
generated
@@ -27715,6 +27715,7 @@ private void InitializeComponent()
|
||||
this.Controls.Add(this.B_Save);
|
||||
this.Controls.Add(this.CB_LocationID);
|
||||
this.Controls.Add(this.TabControl_EncounterData);
|
||||
this.MaximizeBox = false;
|
||||
this.MaximumSize = new System.Drawing.Size(964, 454);
|
||||
this.MinimumSize = new System.Drawing.Size(964, 454);
|
||||
this.Name = "XYWE";
|
||||
|
||||
@@ -1,8 +1,7 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text.RegularExpressions;
|
||||
using System.Windows.Forms;
|
||||
using System.IO;
|
||||
using System.Windows.Forms;
|
||||
|
||||
namespace pk3DS
|
||||
{
|
||||
@@ -44,8 +43,8 @@ private void dumpTXT_Click(object sender, EventArgs e)
|
||||
if (data != null)
|
||||
foreach (string line in data)
|
||||
{
|
||||
if (newline)
|
||||
tw.WriteLine(line.Replace("\\n\\n"," ").Replace("\\n", " ").Replace("\\c", "").Replace("\\r", "")); // Strip out formatting
|
||||
if (newline)
|
||||
tw.WriteLine(line.Replace("\\n\\n", " ").Replace("\\n", " ").Replace("\\c", "").Replace("\\r", "")); // Strip out formatting
|
||||
else
|
||||
tw.WriteLine(line);
|
||||
}
|
||||
@@ -64,7 +63,7 @@ private void changeEntry(object sender, EventArgs e)
|
||||
if (bin != null)
|
||||
File.WriteAllBytes(files[entry], bin);
|
||||
}
|
||||
|
||||
|
||||
// Reset
|
||||
entry = CB_Entry.SelectedIndex;
|
||||
string file = files[entry];
|
||||
@@ -148,7 +147,7 @@ private void B_RemoveLine_Click(object sender, EventArgs e)
|
||||
int currentRow = dgv.CurrentRow.Index;
|
||||
if (currentRow < dgv.Rows.Count - 1)
|
||||
{
|
||||
if ((ModifierKeys != Keys.Control) && DialogResult.Yes != Util.Prompt(MessageBoxButtons.YesNo, "Deleting a row above other lines will shift all subsequent lines.", "Continue?"))
|
||||
if ((ModifierKeys != Keys.Control) && DialogResult.Yes != Util.Prompt(MessageBoxButtons.YesNo, "Deleting a row above other lines will shift all subsequent lines.", "Continue?"))
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -373,9 +372,9 @@ internal static ushort getVariableBytes(string varType, ref List<ushort> args, b
|
||||
default: varVal = Convert.ToUInt16(variable, 16); break;
|
||||
}
|
||||
if (!noArgs)
|
||||
// Set arguments in.
|
||||
for (int i = 0; i < arguments.Length; i++)
|
||||
args.Add(Convert.ToUInt16(arguments[i], 16));
|
||||
// Set arguments in.
|
||||
for (int i = 0; i < arguments.Length; i++)
|
||||
args.Add(Convert.ToUInt16(arguments[i], 16));
|
||||
|
||||
// All done.
|
||||
return varVal;
|
||||
@@ -412,7 +411,7 @@ internal static void encryptVar(BinaryWriter bw, string line, ref int i, ref ush
|
||||
string varCMD = line.Substring(i + 1, bracket);
|
||||
i += bracket + 1; // Advance the index to the end of the bracket.
|
||||
|
||||
string[] split = varCMD.Split(' ');
|
||||
string[] split = varCMD.Split(' ');
|
||||
string varMethod = split[0]; // Returns VAR or WAIT or ~
|
||||
string varType = (split.Length > 1) ? varCMD.Substring(varMethod.Length + 1) : ""; // Returns the remainder of the var command data.
|
||||
ushort varValue = 0;
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Globalization;
|
||||
using System.Drawing;
|
||||
using System.IO;
|
||||
using System.Windows.Forms;
|
||||
using System.Drawing.Imaging;
|
||||
using System.Globalization;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Text.RegularExpressions;
|
||||
using System.Windows.Forms;
|
||||
|
||||
namespace pk3DS
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user