mirror of
https://github.com/kwsch/pk3DS.git
synced 2026-10-02 05:46:47 -05:00
Continued refactoring
Shifting away from unpacking every garc file to disk storage (instead operate with RAM)
This commit is contained in:
@@ -137,7 +137,9 @@ public void InitializeMoves()
|
||||
}
|
||||
public GARCFile getGARCData(string file)
|
||||
{
|
||||
return new GARCFile(getMemGARC(file), getGARCReference(file), getGARCPath(file));
|
||||
var gr = getGARCReference(file);
|
||||
gr = gr.LanguageVariant ? gr.getRelativeGARC(Language, gr.Name) : gr;
|
||||
return new GARCFile(getMemGARC(file), gr, getGARCPath(file));
|
||||
}
|
||||
private string getGARCPath(string file)
|
||||
{
|
||||
|
||||
@@ -607,19 +607,23 @@ private void B_Move_Click(object sender, EventArgs e)
|
||||
if (threadActive()) return;
|
||||
new Thread(() =>
|
||||
{
|
||||
string[] files = { "move" };
|
||||
fileGet(files);
|
||||
var g = Config.GARCMoves;
|
||||
byte[][] Moves;
|
||||
switch (Config.Generation)
|
||||
{
|
||||
case 6:
|
||||
Invoke((Action)(() => new MoveEditor6().ShowDialog()));
|
||||
bool mini = Config.ORAS;
|
||||
Moves = mini ? CTR.mini.unpackMini(g.getFile(0), "WD") : g.Files;
|
||||
Invoke((Action)(() => new MoveEditor6(Moves).ShowDialog()));
|
||||
g.Files = mini ? new[] { CTR.mini.packMini(Moves, "WD") } : Moves;
|
||||
break;
|
||||
case 7:
|
||||
Invoke((Action)(() => new MoveEditor7().ShowDialog()));
|
||||
Moves = CTR.mini.unpackMini(g.getFile(0), "WD");
|
||||
Invoke((Action)(() => new MoveEditor7(Moves).ShowDialog()));
|
||||
g.Files = new[] {CTR.mini.packMini(Moves, "WD")};
|
||||
break;
|
||||
}
|
||||
Invoke((Action)(() => new MoveEditor6().ShowDialog()));
|
||||
fileSet(files);
|
||||
g.Save();
|
||||
}).Start();
|
||||
}
|
||||
private void B_LevelUp_Click(object sender, EventArgs e)
|
||||
@@ -627,18 +631,19 @@ private void B_LevelUp_Click(object sender, EventArgs e)
|
||||
if (threadActive()) return;
|
||||
new Thread(() =>
|
||||
{
|
||||
string[] files = { "levelup", "move" };
|
||||
fileGet(files);
|
||||
var g = Config.getGARCData("levelup");
|
||||
byte[][] d = g.Files;
|
||||
switch (Config.Generation)
|
||||
{
|
||||
case 6:
|
||||
Invoke((Action)(() => new LevelUpEditor6().ShowDialog()));
|
||||
Invoke((Action)(() => new LevelUpEditor6(d).ShowDialog()));
|
||||
break;
|
||||
case 7:
|
||||
Invoke((Action)(() => new LevelUpEditor7().ShowDialog()));
|
||||
Invoke((Action)(() => new LevelUpEditor7(d).ShowDialog()));
|
||||
break;
|
||||
}
|
||||
fileSet(files);
|
||||
g.Files = d;
|
||||
g.Save();
|
||||
}).Start();
|
||||
}
|
||||
private void B_EggMove_Click(object sender, EventArgs e)
|
||||
@@ -646,18 +651,19 @@ private void B_EggMove_Click(object sender, EventArgs e)
|
||||
if (threadActive()) return;
|
||||
new Thread(() =>
|
||||
{
|
||||
string[] files = { "eggmove", "move" };
|
||||
fileGet(files);
|
||||
var g = Config.getGARCData("eggmove");
|
||||
byte[][] d = g.Files;
|
||||
switch (Config.Generation)
|
||||
{
|
||||
case 6:
|
||||
Invoke((Action)(() => new EggMoveEditor6().ShowDialog()));
|
||||
Invoke((Action)(() => new EggMoveEditor6(d).ShowDialog()));
|
||||
break;
|
||||
case 7:
|
||||
Invoke((Action)(() => new EggMoveEditor7().ShowDialog()));
|
||||
Invoke((Action)(() => new EggMoveEditor7(d).ShowDialog()));
|
||||
break;
|
||||
}
|
||||
fileSet(files);
|
||||
g.Files = d;
|
||||
g.Save();
|
||||
}).Start();
|
||||
}
|
||||
private void B_TitleScreen_Click(object sender, EventArgs e)
|
||||
|
||||
@@ -12,9 +12,10 @@ namespace pk3DS
|
||||
{
|
||||
public partial class EggMoveEditor6 : Form
|
||||
{
|
||||
public EggMoveEditor6()
|
||||
public EggMoveEditor6(byte[][] infiles)
|
||||
{
|
||||
InitializeComponent();
|
||||
files = infiles;
|
||||
string[] specieslist = Main.getText(TextName.SpeciesNames);
|
||||
specieslist[0] = movelist[0] = "";
|
||||
|
||||
@@ -31,7 +32,7 @@ public EggMoveEditor6()
|
||||
CB_Species.DataSource = newlist;
|
||||
CB_Species.SelectedIndex = 0;
|
||||
}
|
||||
private readonly string[] files = Directory.GetFiles("eggmove");
|
||||
private readonly byte[][] files;
|
||||
private readonly byte[] data = File.ReadAllBytes(Directory.GetFiles("personal", "*.*", SearchOption.TopDirectoryOnly).Last());
|
||||
private int entry = -1;
|
||||
private readonly string[] movelist = Main.getText(TextName.MoveNames);
|
||||
@@ -63,10 +64,10 @@ private void getList()
|
||||
PB_MonSprite.Image = (Bitmap)Resources.ResourceManager.GetObject(filename);
|
||||
|
||||
dgv.Rows.Clear();
|
||||
byte[] input = File.ReadAllBytes(files[entry]);
|
||||
byte[] input = files[entry];
|
||||
if (input.Length == 0) return;
|
||||
pkm = new EggMoves6(input);
|
||||
if (pkm.Count < 1) { File.WriteAllBytes(files[entry], new byte[0]); return; }
|
||||
if (pkm.Count < 1) { files[entry] = new byte[0]; return; }
|
||||
dgv.Rows.Add(pkm.Count);
|
||||
|
||||
// Fill Entries
|
||||
@@ -86,7 +87,7 @@ private void setList()
|
||||
}
|
||||
pkm.Moves = moves.ToArray();
|
||||
|
||||
File.WriteAllBytes(files[entry], pkm.Write());
|
||||
files[entry] = pkm.Write();
|
||||
}
|
||||
|
||||
private void changeEntry(object sender, EventArgs e)
|
||||
@@ -115,7 +116,7 @@ private void B_RandAll_Click(object sender, EventArgs e)
|
||||
banned = banned.Concat(new[] { 165, 621 }).ToArray(); // Struggle, Hyperspace Fury
|
||||
|
||||
// Move Stats
|
||||
Move[] moveTypes = MoveEditor6.getMoves();
|
||||
Move[] moveTypes = Main.Config.Moves;
|
||||
|
||||
// Personal Stats
|
||||
byte[] personalData = File.ReadAllBytes(Directory.GetFiles("personal").Last());
|
||||
@@ -193,7 +194,7 @@ private void formClosing(object sender, FormClosingEventArgs e)
|
||||
}
|
||||
private void calcStats()
|
||||
{
|
||||
Move[] MoveData = MoveEditor6.getMoves();
|
||||
Move[] MoveData = Main.Config.Moves;
|
||||
|
||||
byte[] personalData = File.ReadAllBytes(Directory.GetFiles("personal").Last());
|
||||
|
||||
@@ -204,7 +205,7 @@ private void calcStats()
|
||||
int species = 0;
|
||||
for (int i = 0; i < Main.Config.MaxSpeciesID; i++)
|
||||
{
|
||||
byte[] movedata = File.ReadAllBytes(files[i]);
|
||||
byte[] movedata = files[i];
|
||||
if (movedata.Length <= 2) continue;
|
||||
int movecount = BitConverter.ToUInt16(movedata, 0);
|
||||
if (movecount == 65535 || movecount < 0)
|
||||
|
||||
@@ -12,9 +12,10 @@ namespace pk3DS
|
||||
{
|
||||
public partial class LevelUpEditor6 : Form
|
||||
{
|
||||
public LevelUpEditor6()
|
||||
public LevelUpEditor6(byte[][] infiles)
|
||||
{
|
||||
InitializeComponent();
|
||||
files = infiles;
|
||||
string[] species = Main.getText(TextName.SpeciesNames);
|
||||
string[][] AltForms = Main.Config.Personal.getFormList(species, Main.Config.MaxSpeciesID);
|
||||
int[] baseForm, formVal;
|
||||
@@ -36,7 +37,8 @@ public LevelUpEditor6()
|
||||
CB_Species.DataSource = newlist;
|
||||
CB_Species.SelectedIndex = 0;
|
||||
}
|
||||
private readonly string[] files = Directory.GetFiles("levelup");
|
||||
|
||||
private readonly byte[][] files;
|
||||
private readonly byte[] data = File.ReadAllBytes(Directory.GetFiles("personal", "*.*", SearchOption.TopDirectoryOnly).Last());
|
||||
private int entry = -1;
|
||||
private readonly string[] movelist = Main.getText(TextName.MoveNames);
|
||||
@@ -76,8 +78,8 @@ private void getList()
|
||||
PB_MonSprite.Image = (Bitmap)Resources.ResourceManager.GetObject(filename);
|
||||
|
||||
dgv.Rows.Clear();
|
||||
byte[] input = File.ReadAllBytes(files[entry]);
|
||||
if (input.Length <= 4) { File.WriteAllBytes(files[entry], BitConverter.GetBytes(-1)); return; }
|
||||
byte[] input = files[entry];
|
||||
if (input.Length <= 4) { files[entry] = BitConverter.GetBytes(-1); return; }
|
||||
pkm = new Learnset6(input);
|
||||
|
||||
dgv.Rows.Add(pkm.Count);
|
||||
@@ -111,7 +113,7 @@ private void setList()
|
||||
}
|
||||
pkm.Moves = moves.ToArray();
|
||||
pkm.Levels = levels.ToArray();
|
||||
File.WriteAllBytes(files[entry], pkm.Write());
|
||||
files[entry] = pkm.Write();
|
||||
}
|
||||
|
||||
private void changeEntry(object sender, EventArgs e)
|
||||
@@ -143,7 +145,7 @@ private void B_RandAll_Click(object sender, EventArgs e)
|
||||
banned = banned.Concat(new[] { 165, 621 }).ToArray(); // Struggle, Hyperspace Fury
|
||||
|
||||
// Move Stats
|
||||
Move[] moveTypes = MoveEditor6.getMoves();
|
||||
Move[] moveTypes = Main.Config.Moves;
|
||||
|
||||
// Personal Stats
|
||||
byte[] personalData = File.ReadAllBytes(Directory.GetFiles("personal").Last());
|
||||
@@ -240,7 +242,7 @@ private void CHK_TypeBias_CheckedChanged(object sender, EventArgs e)
|
||||
|
||||
public void calcStats() // Debug Function
|
||||
{
|
||||
Move[] MoveData = MoveEditor6.getMoves();
|
||||
Move[] MoveData = Main.Config.Moves;
|
||||
|
||||
byte[] personalData = File.ReadAllBytes(Directory.GetFiles("personal").Last());
|
||||
|
||||
@@ -250,7 +252,7 @@ private void CHK_TypeBias_CheckedChanged(object sender, EventArgs e)
|
||||
int stab = 0;
|
||||
for (int i = 0; i < Main.Config.MaxSpeciesID; i++)
|
||||
{
|
||||
byte[] movedata = File.ReadAllBytes(files[i]);
|
||||
byte[] movedata = files[i];
|
||||
int movecount = (movedata.Length - 4) / 4;
|
||||
if (movecount == 65535)
|
||||
continue;
|
||||
|
||||
@@ -6,11 +6,9 @@ namespace pk3DS
|
||||
{
|
||||
public partial class MoveEditor6 : Form
|
||||
{
|
||||
public MoveEditor6()
|
||||
public MoveEditor6(byte[][] infiles)
|
||||
{
|
||||
if (Main.Config.ORAS)
|
||||
CTR.mini.unpackMini(Directory.GetFiles("move")[0], "WD");
|
||||
|
||||
files = infiles;
|
||||
movelist[0] = "";
|
||||
sortedmoves = (string[])movelist.Clone();
|
||||
Array.Sort(sortedmoves);
|
||||
@@ -18,7 +16,7 @@ public MoveEditor6()
|
||||
InitializeComponent();
|
||||
Setup();
|
||||
}
|
||||
private string[] files = Directory.GetFiles("move");
|
||||
private byte[][] files;
|
||||
private readonly string[] types = Main.getText(TextName.Types);
|
||||
private readonly string[] moveflavor = Main.getText(TextName.MoveFlavor);
|
||||
private readonly string[] movelist = Main.getText(TextName.MoveNames);
|
||||
@@ -61,7 +59,6 @@ private void Setup()
|
||||
CB_Inflict.Items.Add("Special");
|
||||
|
||||
CB_Move.Items.RemoveAt(0);
|
||||
files = Directory.GetFiles("move");
|
||||
CB_Move.SelectedIndex = 0;
|
||||
}
|
||||
private int entry = -1;
|
||||
@@ -74,7 +71,7 @@ private void changeEntry(object sender, EventArgs e)
|
||||
private void getEntry()
|
||||
{
|
||||
if (entry < 1) return;
|
||||
byte[] data = File.ReadAllBytes(files[entry]);
|
||||
byte[] data = files[entry];
|
||||
{
|
||||
string flavor = moveflavor[entry].Replace("\\n", Environment.NewLine);
|
||||
RTB.Text = flavor;
|
||||
@@ -125,7 +122,7 @@ private void getEntry()
|
||||
private void setEntry()
|
||||
{
|
||||
if (entry < 1) return;
|
||||
byte[] data = File.ReadAllBytes(files[entry]);
|
||||
byte[] data = files[entry];
|
||||
{
|
||||
data[0x00] = (byte)CB_Type.SelectedIndex;
|
||||
data[0x01] = (byte)CB_Quality.SelectedIndex;
|
||||
@@ -161,14 +158,11 @@ private void setEntry()
|
||||
data[0x21] = (byte)NUD_0x21.Value;
|
||||
// end, the other bytes aren't used.
|
||||
}
|
||||
File.WriteAllBytes(files[entry], data);
|
||||
files[entry] = data;
|
||||
}
|
||||
private void formClosing(object sender, FormClosingEventArgs e)
|
||||
{
|
||||
setEntry();
|
||||
|
||||
if (Main.Config.ORAS)
|
||||
CTR.mini.packMini("move", "WD", "0", ".bin");
|
||||
}
|
||||
|
||||
private void B_RandAll_Click(object sender, EventArgs e)
|
||||
@@ -190,20 +184,5 @@ private void B_RandAll_Click(object sender, EventArgs e)
|
||||
}
|
||||
Util.Alert("Moves have been randomized!");
|
||||
}
|
||||
|
||||
internal static Move[] getMoves()
|
||||
{
|
||||
if (Main.Config.ORAS)
|
||||
CTR.mini.unpackMini(Directory.GetFiles("move")[0], "WD");
|
||||
string[] f2 = Directory.GetFiles("move");
|
||||
Move[] moves = new Move[f2.Length];
|
||||
for (int i = 0; i < f2.Length; i++)
|
||||
moves[i] = new Move(File.ReadAllBytes(f2[i]));
|
||||
|
||||
if (Main.Config.ORAS)
|
||||
CTR.mini.packMini("move", "WD", "0", ".bin");
|
||||
|
||||
return moves;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -557,7 +557,7 @@ private void Randomize()
|
||||
List<int> GymE4Types = new List<int>();
|
||||
|
||||
// Fetch Move Stats for more difficult randomization
|
||||
var moveData = MoveEditor6.getMoves();
|
||||
var moveData = Main.Config.Moves;
|
||||
int[] moveList = Enumerable.Range(1, movelist.Length - 1).ToArray();
|
||||
int mctr = 0;
|
||||
Util.Shuffle(moveList);
|
||||
|
||||
@@ -12,9 +12,10 @@ namespace pk3DS
|
||||
{
|
||||
public partial class EggMoveEditor7 : Form
|
||||
{
|
||||
public EggMoveEditor7()
|
||||
public EggMoveEditor7(byte[][] infiles)
|
||||
{
|
||||
InitializeComponent();
|
||||
files = infiles;
|
||||
string[] species = Main.getText(TextName.SpeciesNames);
|
||||
string[][] AltForms = Main.Config.Personal.getFormList(species, Main.Config.MaxSpeciesID);
|
||||
string[] specieslist = Main.Config.Personal.getPersonalEntryList(AltForms, species, Main.Config.MaxSpeciesID, out baseForms, out formVal);
|
||||
@@ -37,7 +38,7 @@ public EggMoveEditor7()
|
||||
|
||||
CB_Species.SelectedIndex = 0;
|
||||
}
|
||||
private readonly string[] files = Directory.GetFiles("eggmove");
|
||||
private readonly byte[][] files;
|
||||
private int entry = -1;
|
||||
private readonly string[] movelist = Main.getText(TextName.MoveNames);
|
||||
private bool dumping;
|
||||
@@ -73,10 +74,10 @@ private void getList()
|
||||
PB_MonSprite.Image = (Bitmap)Resources.ResourceManager.GetObject(filename);
|
||||
|
||||
dgv.Rows.Clear();
|
||||
byte[] input = File.ReadAllBytes(files[entry]);
|
||||
byte[] input = files[entry];
|
||||
pkm = new EggMoves7(input);
|
||||
NUD_FormTable.Value = pkm.FormTableIndex;
|
||||
if (pkm.Count < 1) { File.WriteAllBytes(files[entry], new byte[0]); return; }
|
||||
if (pkm.Count < 1) { files[entry] = new byte[0]; return; }
|
||||
dgv.Rows.Add(pkm.Count);
|
||||
|
||||
// Fill Entries
|
||||
@@ -96,7 +97,7 @@ private void setList()
|
||||
}
|
||||
pkm.Moves = moves.ToArray();
|
||||
|
||||
File.WriteAllBytes(files[entry], pkm.Write());
|
||||
files[entry] = pkm.Write();
|
||||
}
|
||||
|
||||
private void changeEntry(object sender, EventArgs e)
|
||||
@@ -117,7 +118,7 @@ private void B_RandAll_Click(object sender, EventArgs e)
|
||||
int[] banned = new[] { 165, 621, 464 }.Concat(Legal.Z_Moves).ToArray(); // Struggle, Hyperspace Fury, Dark Void
|
||||
|
||||
// Move Stats
|
||||
Move[] moveTypes = MoveEditor6.getMoves();
|
||||
Move[] moveTypes = Main.Config.Moves;
|
||||
|
||||
// Set up Randomized Moves
|
||||
int[] randomMoves = Enumerable.Range(1, movelist.Length - 1).Select(i => i).ToArray();
|
||||
@@ -188,14 +189,14 @@ private void B_Goto_Click(object sender, EventArgs e)
|
||||
|
||||
private void calcStats()
|
||||
{
|
||||
Move[] MoveData = MoveEditor6.getMoves();
|
||||
Move[] MoveData = Main.Config.Moves;
|
||||
int movectr = 0;
|
||||
int max = 0;
|
||||
int spec = 0;
|
||||
int stab = 0;
|
||||
for (int i = 0; i < Main.Config.MaxSpeciesID; i++)
|
||||
{
|
||||
byte[] movedata = File.ReadAllBytes(files[i]);
|
||||
byte[] movedata = files[i];
|
||||
int movecount = BitConverter.ToUInt16(movedata, 2);
|
||||
if (movecount == 65535)
|
||||
continue;
|
||||
|
||||
@@ -12,9 +12,10 @@ namespace pk3DS
|
||||
{
|
||||
public partial class LevelUpEditor7 : Form
|
||||
{
|
||||
public LevelUpEditor7()
|
||||
public LevelUpEditor7(byte[][] infiles)
|
||||
{
|
||||
InitializeComponent();
|
||||
files = infiles;
|
||||
string[] species = Main.getText(TextName.SpeciesNames);
|
||||
string[][] AltForms = Main.Config.Personal.getFormList(species, Main.Config.MaxSpeciesID);
|
||||
string[] specieslist = Main.Config.Personal.getPersonalEntryList(AltForms, species, Main.Config.MaxSpeciesID, out baseForms, out formVal);
|
||||
@@ -35,7 +36,8 @@ public LevelUpEditor7()
|
||||
CB_Species.DataSource = newlist;
|
||||
CB_Species.SelectedIndex = 0;
|
||||
}
|
||||
private readonly string[] files = Directory.GetFiles("levelup");
|
||||
|
||||
private readonly byte[][] files;
|
||||
private int entry = -1;
|
||||
private readonly string[] movelist = Main.getText(TextName.MoveNames);
|
||||
private bool dumping;
|
||||
@@ -78,8 +80,8 @@ private void getList()
|
||||
PB_MonSprite.Image = (Bitmap)Resources.ResourceManager.GetObject(filename);
|
||||
|
||||
dgv.Rows.Clear();
|
||||
byte[] input = File.ReadAllBytes(files[entry]);
|
||||
if (input.Length <= 4) { File.WriteAllBytes(files[entry], BitConverter.GetBytes(-1)); return; }
|
||||
byte[] input = files[entry];
|
||||
if (input.Length <= 4) { files[entry] = BitConverter.GetBytes(-1); return; }
|
||||
pkm = new Learnset7(input);
|
||||
|
||||
dgv.Rows.Add(pkm.Count);
|
||||
@@ -113,7 +115,7 @@ private void setList()
|
||||
}
|
||||
pkm.Moves = moves.ToArray();
|
||||
pkm.Levels = levels.ToArray();
|
||||
File.WriteAllBytes(files[entry], pkm.Write());
|
||||
files[entry] = pkm.Write();
|
||||
}
|
||||
|
||||
private void changeEntry(object sender, EventArgs e)
|
||||
@@ -137,7 +139,7 @@ private void B_RandAll_Click(object sender, EventArgs e)
|
||||
int[] banned = new[] { 165, 621, 464 }.Concat(Legal.Z_Moves).ToArray(); // Struggle, Hyperspace Fury, Dark Void
|
||||
|
||||
// Move Stats
|
||||
Move[] moveTypes = MoveEditor6.getMoves();
|
||||
Move[] moveTypes = Main.Config.Moves;
|
||||
|
||||
// Set up Randomized Moves
|
||||
int[] randomMoves = Enumerable.Range(1, movelist.Length - 1).Select(i => i).ToArray();
|
||||
@@ -224,14 +226,14 @@ private void CHK_TypeBias_CheckedChanged(object sender, EventArgs e)
|
||||
|
||||
public void calcStats() // Debug Function
|
||||
{
|
||||
Move[] MoveData = MoveEditor6.getMoves();
|
||||
Move[] MoveData = Main.Config.Moves;
|
||||
int movectr = 0;
|
||||
int max = 0;
|
||||
int spec = 0;
|
||||
int stab = 0;
|
||||
for (int i = 0; i < Main.Config.MaxSpeciesID; i++)
|
||||
{
|
||||
byte[] movedata = File.ReadAllBytes(files[i]);
|
||||
byte[] movedata = files[i];
|
||||
int movecount = (movedata.Length - 4) / 4;
|
||||
if (movecount == 65535)
|
||||
continue;
|
||||
|
||||
@@ -6,9 +6,9 @@ namespace pk3DS
|
||||
{
|
||||
public partial class MoveEditor7 : Form
|
||||
{
|
||||
public MoveEditor7()
|
||||
public MoveEditor7(byte[][] infiles)
|
||||
{
|
||||
CTR.mini.unpackMini(Directory.GetFiles("move")[0], "WD");
|
||||
files = infiles;
|
||||
|
||||
movelist[0] = "";
|
||||
sortedmoves = (string[])movelist.Clone();
|
||||
@@ -17,7 +17,7 @@ public MoveEditor7()
|
||||
InitializeComponent();
|
||||
Setup();
|
||||
}
|
||||
private string[] files = Directory.GetFiles("move");
|
||||
private byte[][] files;
|
||||
private readonly string[] types = Main.getText(TextName.Types);
|
||||
private readonly string[] moveflavor = Main.getText(TextName.MoveFlavor);
|
||||
private readonly string[] movelist = Main.getText(TextName.MoveNames);
|
||||
@@ -60,7 +60,6 @@ private void Setup()
|
||||
CB_Inflict.Items.Add("Special");
|
||||
|
||||
CB_Move.Items.RemoveAt(0);
|
||||
files = Directory.GetFiles("move");
|
||||
CB_Move.SelectedIndex = 0;
|
||||
}
|
||||
private int entry = -1;
|
||||
@@ -73,7 +72,7 @@ private void changeEntry(object sender, EventArgs e)
|
||||
private void getEntry()
|
||||
{
|
||||
if (entry < 1) return;
|
||||
byte[] data = File.ReadAllBytes(files[entry]);
|
||||
byte[] data = files[entry];
|
||||
{
|
||||
string flavor = moveflavor[entry].Replace("\\n", Environment.NewLine);
|
||||
RTB.Text = flavor;
|
||||
@@ -124,7 +123,7 @@ private void getEntry()
|
||||
private void setEntry()
|
||||
{
|
||||
if (entry < 1) return;
|
||||
byte[] data = File.ReadAllBytes(files[entry]);
|
||||
byte[] data = files[entry];
|
||||
{
|
||||
data[0x00] = (byte)CB_Type.SelectedIndex;
|
||||
data[0x01] = (byte)CB_Quality.SelectedIndex;
|
||||
@@ -160,14 +159,11 @@ private void setEntry()
|
||||
data[0x21] = (byte)NUD_0x21.Value;
|
||||
// end, the other bytes aren't used.
|
||||
}
|
||||
File.WriteAllBytes(files[entry], data);
|
||||
files[entry] = data;
|
||||
}
|
||||
private void formClosing(object sender, FormClosingEventArgs e)
|
||||
{
|
||||
setEntry();
|
||||
|
||||
if (Main.Config.ORAS)
|
||||
CTR.mini.packMini("move", "WD", "0", ".bin");
|
||||
}
|
||||
|
||||
private void B_RandAll_Click(object sender, EventArgs e)
|
||||
@@ -189,19 +185,5 @@ private void B_RandAll_Click(object sender, EventArgs e)
|
||||
}
|
||||
Util.Alert("Moves have been randomized!");
|
||||
}
|
||||
|
||||
internal static Move[] getMoves()
|
||||
{
|
||||
CTR.mini.unpackMini(Directory.GetFiles("move")[0], "WD");
|
||||
string[] f2 = Directory.GetFiles("move");
|
||||
Move[] moves = new Move[f2.Length];
|
||||
for (int i = 0; i < f2.Length; i++)
|
||||
moves[i] = new Move(File.ReadAllBytes(f2[i]));
|
||||
|
||||
if (Main.Config.ORAS)
|
||||
CTR.mini.packMini("move", "WD", "0", ".bin");
|
||||
|
||||
return moves;
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user