mirror of
https://github.com/kwsch/pk3DS.git
synced 2026-09-08 01:55:37 -05:00
@@ -7,10 +7,9 @@ public static class StructConverter
|
||||
{
|
||||
public static T ToStructure<T>(this byte[] bytes) where T : struct
|
||||
{
|
||||
GCHandle handle = GCHandle.Alloc(bytes, GCHandleType.Pinned);
|
||||
T obj = (T)Marshal.PtrToStructure(handle.AddrOfPinnedObject(), typeof(T));
|
||||
handle.Free();
|
||||
return obj;
|
||||
var handle = GCHandle.Alloc(bytes, GCHandleType.Pinned);
|
||||
try { return (T)Marshal.PtrToStructure(handle.AddrOfPinnedObject(), typeof(T)); }
|
||||
finally { handle.Free(); }
|
||||
}
|
||||
public static byte[] ToBytes<T>(this T obj) where T : struct
|
||||
{
|
||||
|
||||
@@ -781,6 +781,7 @@ private void B_Move_Click(object sender, EventArgs e)
|
||||
break;
|
||||
}
|
||||
g.Save();
|
||||
Config.InitializeMoves();
|
||||
}).Start();
|
||||
}
|
||||
private void B_LevelUp_Click(object sender, EventArgs e)
|
||||
@@ -788,8 +789,7 @@ private void B_LevelUp_Click(object sender, EventArgs e)
|
||||
if (threadActive()) return;
|
||||
new Thread(() =>
|
||||
{
|
||||
var g = Config.getGARCData("levelup");
|
||||
byte[][] d = g.Files;
|
||||
byte[][] d = Config.GARCLearnsets.Files;
|
||||
switch (Config.Generation)
|
||||
{
|
||||
case 6:
|
||||
@@ -799,8 +799,9 @@ private void B_LevelUp_Click(object sender, EventArgs e)
|
||||
Invoke((Action)(() => new LevelUpEditor7(d).ShowDialog()));
|
||||
break;
|
||||
}
|
||||
g.Files = d;
|
||||
g.Save();
|
||||
Config.GARCLearnsets.Files = d;
|
||||
Config.GARCLearnsets.Save();
|
||||
Config.InitializePersonal();
|
||||
}).Start();
|
||||
}
|
||||
private void B_EggMove_Click(object sender, EventArgs e)
|
||||
|
||||
Reference in New Issue
Block a user