mirror of
https://github.com/kwsch/pk3DS.git
synced 2026-04-25 07:37:02 -05:00
Style updates
makes it easier to look at still looks yuck ;)
This commit is contained in:
parent
d95b4a5728
commit
e40d3ce554
|
|
@ -43,6 +43,7 @@ public int TransformBlock(byte[] inputBuffer, int inputOffset, int inputCount, b
|
|||
return inputCount;
|
||||
}
|
||||
}
|
||||
|
||||
public class AesCounter
|
||||
{
|
||||
public const int BufferSize = 0x400000; //4 MB Buffer
|
||||
|
|
@ -83,14 +84,14 @@ public ulong SwapBytes(ulong value)
|
|||
{
|
||||
ulong uvalue = value;
|
||||
ulong swapped =
|
||||
0x00000000000000FF & (uvalue >> 56)
|
||||
| 0x000000000000FF00 & (uvalue >> 40)
|
||||
| 0x0000000000FF0000 & (uvalue >> 24)
|
||||
| 0x00000000FF000000 & (uvalue >> 8)
|
||||
| 0x000000FF00000000 & (uvalue << 8)
|
||||
| 0x0000FF0000000000 & (uvalue << 24)
|
||||
| 0x00FF000000000000 & (uvalue << 40)
|
||||
| 0xFF00000000000000 & (uvalue << 56);
|
||||
(0x00000000000000FF & (uvalue >> 56))
|
||||
| (0x000000000000FF00 & (uvalue >> 40))
|
||||
| (0x0000000000FF0000 & (uvalue >> 24))
|
||||
| (0x00000000FF000000 & (uvalue >> 8))
|
||||
| (0x000000FF00000000 & (uvalue << 8))
|
||||
| (0x0000FF0000000000 & (uvalue << 24))
|
||||
| (0x00FF000000000000 & (uvalue << 40))
|
||||
| (0xFF00000000000000 & (uvalue << 56));
|
||||
return swapped;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -135,6 +135,7 @@ public static byte[] GetData(string path)
|
|||
using (var br = new BinaryReader(File.OpenRead(path)))
|
||||
return GetData(br);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Rips out the data portion of the ALYT, assuming the ALYT is partially valid.
|
||||
/// </summary>
|
||||
|
|
@ -144,6 +145,7 @@ public static byte[] GetData(byte[] data)
|
|||
using (var br = new BinaryReader(ms))
|
||||
return GetData(br);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Rips out the data portion of the ALYT, assuming the ALYT is partially valid.
|
||||
/// </summary>
|
||||
|
|
@ -152,6 +154,7 @@ public static byte[] GetData(Stream ms)
|
|||
using (var br = new BinaryReader(ms))
|
||||
return GetData(br);
|
||||
}
|
||||
|
||||
private static byte[] GetData(BinaryReader br)
|
||||
{
|
||||
if (br.BaseStream.Length <= 0x80)
|
||||
|
|
|
|||
|
|
@ -45,12 +45,14 @@ public class BLZCoder
|
|||
private int new_len;
|
||||
|
||||
private readonly ProgressBar pBar1;
|
||||
|
||||
private void initpBar(int max)
|
||||
{
|
||||
if (pBar1.InvokeRequired)
|
||||
pBar1.Invoke((MethodInvoker)delegate { pBar1.Minimum = 0; pBar1.Step = 1; pBar1.Value = 0; pBar1.Maximum = max; });
|
||||
else { pBar1.Minimum = 0; pBar1.Step = 1; pBar1.Value = 0; pBar1.Maximum = max; }
|
||||
}
|
||||
|
||||
private void setpBarPos(int pos)
|
||||
{
|
||||
if (pBar1.InvokeRequired)
|
||||
|
|
@ -71,7 +73,6 @@ public BLZCoder(string[] args, ProgressBar pBar = null)
|
|||
|
||||
if (args[0].Equals("-d"))
|
||||
cmd = CMD_DECODE;
|
||||
|
||||
else if (args[0].Equals("-en") || args[0].Equals("-en9"))
|
||||
{
|
||||
cmd = CMD_ENCODE;
|
||||
|
|
@ -105,6 +106,7 @@ public BLZCoder(string[] args, ProgressBar pBar = null)
|
|||
|
||||
Console.Write(Environment.NewLine + "Done" + Environment.NewLine);
|
||||
}
|
||||
|
||||
private static void Save(string filename, byte[] buffer, int length)
|
||||
{
|
||||
Array.Resize(ref buffer, length);
|
||||
|
|
@ -117,6 +119,7 @@ private static void Save(string filename, byte[] buffer, int length)
|
|||
Console.Write(Environment.NewLine + "Wrote to 'blz.bin' instead." + Environment.NewLine);
|
||||
}
|
||||
}
|
||||
|
||||
private static void BLZ_Decode(string filename)
|
||||
{
|
||||
try
|
||||
|
|
@ -134,6 +137,7 @@ private static void BLZ_Decode(string filename)
|
|||
catch (IOException e)
|
||||
{ Console.Write(Environment.NewLine + "File read error" + Environment.NewLine + e); }
|
||||
}
|
||||
|
||||
private static BLZResult BLZ_Decode(byte[] data)
|
||||
{
|
||||
int raw_len, len;
|
||||
|
|
@ -244,6 +248,7 @@ private static BLZResult BLZ_Decode(byte[] data)
|
|||
|
||||
return new BLZResult(raw_buffer, raw_len);
|
||||
}
|
||||
|
||||
private BLZResult BLZ_Encode(byte[] data, int mode)
|
||||
{
|
||||
new_len = 0;
|
||||
|
|
@ -263,6 +268,7 @@ private BLZResult BLZ_Encode(byte[] data, int mode)
|
|||
}
|
||||
return new BLZResult(pak_buffer, pak_len);
|
||||
}
|
||||
|
||||
private static byte[] prepareData(byte[] data)
|
||||
{
|
||||
int fs = data.Length;
|
||||
|
|
@ -272,6 +278,7 @@ private static byte[] prepareData(byte[] data)
|
|||
|
||||
return fb;
|
||||
}
|
||||
|
||||
private static void writeUnsigned(byte[] buffer, int offset, int value)
|
||||
{
|
||||
buffer[offset] = (byte)(value & 0xFF);
|
||||
|
|
@ -279,6 +286,7 @@ private static void writeUnsigned(byte[] buffer, int offset, int value)
|
|||
buffer[offset + 2] = (byte)((value >> 16) & 0xFF);
|
||||
buffer[offset + 3] = (byte)((value >> 24) & 0x7F);
|
||||
}
|
||||
|
||||
private void BLZ_Encode(string filename, int mode)
|
||||
{
|
||||
try
|
||||
|
|
@ -298,6 +306,7 @@ private void BLZ_Encode(string filename, int mode)
|
|||
catch (IOException e)
|
||||
{ Console.Write(Environment.NewLine + "File read error" + Environment.NewLine + e + Environment.NewLine); }
|
||||
}
|
||||
|
||||
private byte[] BLZ_Code(byte[] raw_buffer, int raw_len, int best)
|
||||
{
|
||||
int flg = 0;
|
||||
|
|
@ -308,7 +317,7 @@ private byte[] BLZ_Code(byte[] raw_buffer, int raw_len, int best)
|
|||
int pak_tmp = 0;
|
||||
int raw_tmp = raw_len;
|
||||
|
||||
int pak_len = raw_len + (raw_len + 7) / 8 + 11;
|
||||
int pak_len = raw_len + ((raw_len + 7) / 8) + 11;
|
||||
byte[] pak_buffer = new byte[pak_len];
|
||||
|
||||
int raw_new = raw_len;
|
||||
|
|
@ -459,6 +468,7 @@ public SearchPair(int l, int p)
|
|||
this.p = p;
|
||||
}
|
||||
}
|
||||
|
||||
private static SearchPair SEARCH(int p, IList<byte> raw_buffer, int raw, int raw_end)
|
||||
{
|
||||
int l = BLZ_THRESHOLD;
|
||||
|
|
@ -497,6 +507,7 @@ public BLZResult(byte[] raw_buffer, int raw_len)
|
|||
public readonly byte[] buffer;
|
||||
public readonly int length;
|
||||
}
|
||||
|
||||
private static void BLZ_Invert(byte[] buffer, int offset, int length)
|
||||
{
|
||||
int bottom = offset + length - 1;
|
||||
|
|
|
|||
|
|
@ -30,6 +30,7 @@ internal static void updateTB(RichTextBox RTB, string progress)
|
|||
}
|
||||
catch { }
|
||||
}
|
||||
|
||||
internal static int IndexOfBytes(byte[] array, byte[] pattern, int startIndex, int count)
|
||||
{
|
||||
int i = startIndex;
|
||||
|
|
@ -45,10 +46,12 @@ internal static int IndexOfBytes(byte[] array, byte[] pattern, int startIndex, i
|
|||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
internal static string getHexString(byte[] data)
|
||||
{
|
||||
return BitConverter.ToString(data).Replace("-", "");
|
||||
}
|
||||
|
||||
internal static byte[] StringToByteArray(string hex)
|
||||
{
|
||||
return Enumerable.Range(0, hex.Length)
|
||||
|
|
@ -99,12 +102,13 @@ internal static string[] verifyCRR(string PATH_CRR, string PATH_CRO)
|
|||
for (int i = 0; i < hashData.Length; i++)
|
||||
{
|
||||
byte[] crrEntryHash = new byte[0x20];
|
||||
Array.Copy(CRR, i * 0x20 + hashTableOffset, crrEntryHash, 0, 0x20);
|
||||
Array.Copy(CRR, (i * 0x20) + hashTableOffset, crrEntryHash, 0, 0x20);
|
||||
results[i] = "Hash @ {0} is " + (crrEntryHash.SequenceEqual(hashData[i]) ? "valid." : "invalid.");
|
||||
Array.Copy(hashData, 0, CRR, hashTableOffset + 0x20 * i, 0x20);
|
||||
Array.Copy(hashData, 0, CRR, hashTableOffset + (0x20 * i), 0x20);
|
||||
}
|
||||
return results;
|
||||
}
|
||||
|
||||
public static bool rehashCRR(string PATH_CRR, string PATH_CRO, bool saveCRO = true, bool saveCRR = true, RichTextBox TB_Progress = null, ProgressBar PB_Show = null)
|
||||
{
|
||||
// Get CRO files
|
||||
|
|
@ -175,7 +179,7 @@ public static bool rehashCRR(string PATH_CRR, string PATH_CRO, bool saveCRO = tr
|
|||
}
|
||||
// Store Hashes in CRR
|
||||
for (int i = 0; i < hashData.Length; i++)
|
||||
Array.Copy(hashData[i], 0, CRR, hashTableOffset + 0x20 * i, 0x20);
|
||||
Array.Copy(hashData[i], 0, CRR, hashTableOffset + (0x20 * i), 0x20);
|
||||
|
||||
updateTB(TB_Progress,
|
||||
updatedCTR > 0
|
||||
|
|
@ -194,6 +198,7 @@ public static bool rehashCRR(string PATH_CRR, string PATH_CRO, bool saveCRO = tr
|
|||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
internal static byte[] hashCRO(ref byte[] CRO)
|
||||
{
|
||||
// Allocate new byte array to store modified CRO
|
||||
|
|
@ -215,12 +220,13 @@ internal static byte[] hashCRO(ref byte[] CRO)
|
|||
return mySHA.ComputeHash(CRO, 0, 0x80);
|
||||
}
|
||||
|
||||
|
||||
public CRO(byte[] data)
|
||||
{
|
||||
Data = (byte[])data.Clone();
|
||||
}
|
||||
|
||||
private readonly byte[] Data;
|
||||
|
||||
private byte[] sha2Hash
|
||||
{
|
||||
get
|
||||
|
|
@ -236,6 +242,7 @@ private byte[] sha2Hash
|
|||
Array.Copy(value, Data, value.Length);
|
||||
}
|
||||
}
|
||||
|
||||
private string Magic => new string(Data.Skip(0x80).Take(4).Select(c => (char)c).ToArray());
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -113,6 +113,7 @@ public class CTRUtil
|
|||
|
||||
return NCCH;
|
||||
}
|
||||
|
||||
internal static NCSD setNCSD(NCCH NCCH, bool Card2,
|
||||
ProgressBar PB_Show = null, RichTextBox TB_Progress = null)
|
||||
{
|
||||
|
|
@ -126,7 +127,7 @@ public class CTRUtil
|
|||
header = new NCSD.Header {Signature = new byte[0x100], Magic = 0x4453434E}
|
||||
};
|
||||
ulong Length = 0x80 * 0x100000; // 128 MB
|
||||
while (Length <= NCCH.header.Size * MEDIA_UNIT_SIZE + 0x400000) //Extra 4 MB for potential save data
|
||||
while (Length <= (NCCH.header.Size * MEDIA_UNIT_SIZE) + 0x400000) //Extra 4 MB for potential save data
|
||||
{
|
||||
Length *= 2;
|
||||
}
|
||||
|
|
@ -194,6 +195,7 @@ public class CTRUtil
|
|||
//NCSD is Initialized
|
||||
return NCSD;
|
||||
}
|
||||
|
||||
internal static bool writeROM(NCSD NCSD, string SAVE_PATH,
|
||||
ProgressBar PB_Show = null, RichTextBox TB_Progress = null)
|
||||
{
|
||||
|
|
@ -223,14 +225,14 @@ public class CTRUtil
|
|||
break;
|
||||
case 1: //Exefs
|
||||
updateTB(TB_Progress, "Writing Exefs...");
|
||||
OutFileStream.Seek(0x4000 + NCSD.NCCH_Array[0].header.ExefsOffset * MEDIA_UNIT_SIZE, SeekOrigin.Begin);
|
||||
OutFileStream.Seek(0x4000 + (NCSD.NCCH_Array[0].header.ExefsOffset * MEDIA_UNIT_SIZE), SeekOrigin.Begin);
|
||||
byte[] OutExefs = new byte[NCSD.NCCH_Array[0].exefs.Data.Length];
|
||||
aesctr.TransformBlock(NCSD.NCCH_Array[0].exefs.Data, 0, NCSD.NCCH_Array[0].exefs.Data.Length, OutExefs, 0);
|
||||
OutFileStream.Write(OutExefs, 0, OutExefs.Length);
|
||||
break;
|
||||
case 2: //Romfs
|
||||
updateTB(TB_Progress, "Writing Romfs...");
|
||||
OutFileStream.Seek(0x4000 + NCSD.NCCH_Array[0].header.RomfsOffset * MEDIA_UNIT_SIZE, SeekOrigin.Begin);
|
||||
OutFileStream.Seek(0x4000 + (NCSD.NCCH_Array[0].header.RomfsOffset * MEDIA_UNIT_SIZE), SeekOrigin.Begin);
|
||||
using (FileStream InFileStream = new FileStream(NCSD.NCCH_Array[0].romfs.FileName, FileMode.Open, FileAccess.Read))
|
||||
{
|
||||
uint BUFFER_SIZE;
|
||||
|
|
@ -257,17 +259,17 @@ public class CTRUtil
|
|||
}
|
||||
}
|
||||
updateTB(TB_Progress, "Writing Logo...");
|
||||
OutFileStream.Seek(0x4000 + NCSD.NCCH_Array[0].header.LogoOffset * MEDIA_UNIT_SIZE, SeekOrigin.Begin);
|
||||
OutFileStream.Seek(0x4000 + (NCSD.NCCH_Array[0].header.LogoOffset * MEDIA_UNIT_SIZE), SeekOrigin.Begin);
|
||||
OutFileStream.Write(NCSD.NCCH_Array[0].logo, 0, NCSD.NCCH_Array[0].logo.Length);
|
||||
if (NCSD.NCCH_Array[0].plainregion.Length > 0)
|
||||
{
|
||||
updateTB(TB_Progress, "Writing Plain Region...");
|
||||
OutFileStream.Seek(0x4000 + NCSD.NCCH_Array[0].header.PlainRegionOffset * MEDIA_UNIT_SIZE, SeekOrigin.Begin);
|
||||
OutFileStream.Seek(0x4000 + (NCSD.NCCH_Array[0].header.PlainRegionOffset * MEDIA_UNIT_SIZE), SeekOrigin.Begin);
|
||||
OutFileStream.Write(NCSD.NCCH_Array[0].plainregion, 0, NCSD.NCCH_Array[0].plainregion.Length);
|
||||
}
|
||||
|
||||
//NCSD Padding
|
||||
OutFileStream.Seek(NCSD.header.OffsetSizeTable[NCSD.NCCH_Array.Count - 1].Offset * MEDIA_UNIT_SIZE + NCSD.header.OffsetSizeTable[NCSD.NCCH_Array.Count - 1].Size * MEDIA_UNIT_SIZE, SeekOrigin.Begin);
|
||||
OutFileStream.Seek((NCSD.header.OffsetSizeTable[NCSD.NCCH_Array.Count - 1].Offset * MEDIA_UNIT_SIZE) + (NCSD.header.OffsetSizeTable[NCSD.NCCH_Array.Count - 1].Size * MEDIA_UNIT_SIZE), SeekOrigin.Begin);
|
||||
ulong TotalLen = NCSD.header.MediaSize * MEDIA_UNIT_SIZE;
|
||||
byte[] Buffer = Enumerable.Repeat((byte)0xFF, 0x400000).ToArray();
|
||||
updateTB(TB_Progress, "Writing NCSD Padding...");
|
||||
|
|
@ -324,6 +326,7 @@ internal static bool isValid(string exeFS, string romFS, string exeheader, strin
|
|||
Exheader exh = new Exheader(exeheader);
|
||||
return !exh.isPokemon() || Card2;
|
||||
}
|
||||
|
||||
internal static void updateTB(RichTextBox RTB, string progress)
|
||||
{
|
||||
try
|
||||
|
|
@ -344,12 +347,13 @@ internal static void updateTB(RichTextBox RTB, string progress)
|
|||
}
|
||||
catch { }
|
||||
}
|
||||
|
||||
internal static ulong Align(ulong input, ulong alignsize)
|
||||
{
|
||||
ulong output = input;
|
||||
if (output % alignsize != 0)
|
||||
{
|
||||
output += alignsize - output % alignsize;
|
||||
output += alignsize - (output % alignsize);
|
||||
}
|
||||
return output;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -33,7 +33,7 @@ public DARC(byte[] Data = null)
|
|||
while ((c = (char) br.ReadUInt16()) > 0) s += c;
|
||||
|
||||
FileNameTable[i] = new NameTableEntry(offs, s);
|
||||
offs += (uint)s.Length * 2 + 2;
|
||||
offs += ((uint)s.Length * 2) + 2;
|
||||
}
|
||||
br.BaseStream.Position = Header.FileDataOffset;
|
||||
this.Data = br.ReadBytes((int)(Header.FileSize - Header.FileDataOffset));
|
||||
|
|
@ -57,6 +57,7 @@ public DARCHeader(BinaryReader br = null)
|
|||
FileTableLength = br.ReadUInt32();
|
||||
FileDataOffset = br.ReadUInt32();
|
||||
}
|
||||
|
||||
public string Signature;
|
||||
public ushort Endianness;
|
||||
public ushort HeaderSize;
|
||||
|
|
@ -66,6 +67,7 @@ public DARCHeader(BinaryReader br = null)
|
|||
public uint FileTableLength;
|
||||
public uint FileDataOffset;
|
||||
}
|
||||
|
||||
public class FileTableEntry
|
||||
{
|
||||
public FileTableEntry(BinaryReader br = null)
|
||||
|
|
@ -77,15 +79,18 @@ public FileTableEntry(BinaryReader br = null)
|
|||
DataOffset = br.ReadUInt32();
|
||||
DataLength = br.ReadUInt32();
|
||||
}
|
||||
|
||||
public uint NameOffset;
|
||||
public bool IsFolder;
|
||||
public uint DataOffset; // FOLDER: Parent Entry Index
|
||||
public uint DataLength; // FOLDER: Next Folder Index
|
||||
}
|
||||
|
||||
public class NameTableEntry
|
||||
{
|
||||
public uint NameOffset;
|
||||
public string FileName;
|
||||
|
||||
public NameTableEntry(uint offset, string fileName)
|
||||
{
|
||||
NameOffset = offset;
|
||||
|
|
@ -129,6 +134,7 @@ public static byte[] setDARC(DARC darc)
|
|||
return ms.ToArray();
|
||||
}
|
||||
}
|
||||
|
||||
public static DARC getDARC(string folderName)
|
||||
{
|
||||
// Package Folder into a DARC.
|
||||
|
|
@ -168,7 +174,6 @@ public static DARC getDARC(string folderName)
|
|||
string fileName = fi.Name;
|
||||
NameList.Add(new NameTableEntry(nameOffset, parentName));
|
||||
|
||||
|
||||
EntryList.Add(new FileTableEntry
|
||||
{
|
||||
DataOffset = (uint) Data.Length,
|
||||
|
|
@ -187,8 +192,8 @@ public static DARC getDARC(string folderName)
|
|||
int darcFileCount = NameList.Count;
|
||||
int NameListOffset = darcFileCount * 0xC;
|
||||
int NameListLength = (int)(nameOffset + NameListOffset);
|
||||
int DataOffset = NameListLength % 4 == 0 ? NameListLength : NameListLength + (4 - NameListLength % 4);
|
||||
Array.Resize(ref Data, Data.Length % 4 == 0 ? Data.Length : Data.Length + 4 - Data.Length % 4);
|
||||
int DataOffset = NameListLength % 4 == 0 ? NameListLength : NameListLength + (4 - (NameListLength % 4));
|
||||
Array.Resize(ref Data, Data.Length % 4 == 0 ? Data.Length : Data.Length + 4 - (Data.Length % 4));
|
||||
int FinalSize = DataOffset + Data.Length;
|
||||
|
||||
// Create New DARC
|
||||
|
|
@ -224,6 +229,7 @@ public static bool darc2files(string path, string folderName)
|
|||
try { return darc2files(File.ReadAllBytes(path), folderName); }
|
||||
catch (Exception) { return false; }
|
||||
}
|
||||
|
||||
public static bool darc2files(byte[] darc, string folderName)
|
||||
{
|
||||
// Save all contents of a DARC to a folder, assuming there's only 1 layer of folders.
|
||||
|
|
@ -266,6 +272,7 @@ public static bool darc2files(byte[] darc, string folderName)
|
|||
}
|
||||
catch (Exception) { return false; }
|
||||
}
|
||||
|
||||
public static bool files2darc(string folderName, bool delete = false, string originalDARC = null, string outFile = null)
|
||||
{
|
||||
// Save all contents of a folder to a darc.
|
||||
|
|
@ -313,11 +320,13 @@ public static int getDARCposition(byte[] data)
|
|||
{ pos += 4; if (pos >= data.Length) return -1; }
|
||||
return pos;
|
||||
}
|
||||
|
||||
public static bool insertFile(ref DARC orig, int index, string path)
|
||||
{
|
||||
try { return insertFile(ref orig, index, File.ReadAllBytes(path)); }
|
||||
catch (Exception) { return false; }
|
||||
}
|
||||
|
||||
public static bool insertFile(ref DARC orig, int index, byte[] data)
|
||||
{
|
||||
if (index < 0) return false;
|
||||
|
|
@ -344,6 +353,7 @@ public static bool insertFile(ref DARC orig, int index, byte[] data)
|
|||
}
|
||||
catch (Exception) { return false; }
|
||||
}
|
||||
|
||||
public static DARC insertFiles(DARC orig, string folderName)
|
||||
{
|
||||
string[] fileNames = new string[orig.Entries.Length];
|
||||
|
|
@ -364,7 +374,7 @@ public static DARC insertFiles(DARC orig, string folderName)
|
|||
insertFile(ref orig, index, file);
|
||||
}
|
||||
// Fix Data layout
|
||||
Array.Resize(ref orig.Data, orig.Data.Length % 4 == 0 ? orig.Data.Length : orig.Data.Length + 4 - orig.Data.Length % 4);
|
||||
Array.Resize(ref orig.Data, orig.Data.Length % 4 == 0 ? orig.Data.Length : orig.Data.Length + 4 - (orig.Data.Length % 4));
|
||||
orig.Header.FileSize = (uint)(orig.Data.Length + orig.Header.FileDataOffset);
|
||||
return orig;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -48,13 +48,14 @@ public static bool get(string inFile, string outPath)
|
|||
// New File Path
|
||||
outPath + Path.DirectorySeparatorChar + fileName + ".bin",
|
||||
// Get New Data from Offset after 0x200 Header.
|
||||
data.Skip(0x200 + BitConverter.ToInt32(data, 0x8 + 0x10 * i)).Take(BitConverter.ToInt32(data, 0xC + 0x10 * i)).ToArray()
|
||||
data.Skip(0x200 + BitConverter.ToInt32(data, 0x8 + (0x10 * i))).Take(BitConverter.ToInt32(data, 0xC + (0x10 * i))).ToArray()
|
||||
);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
catch { return false; }
|
||||
}
|
||||
|
||||
public static bool set(string[] files, string outFile)
|
||||
{
|
||||
if (files.Length > 10) { Console.WriteLine("Cannot package more than 10 files to exefs."); return false; }
|
||||
|
|
@ -76,13 +77,13 @@ public static bool set(string[] files, string outFile)
|
|||
|
||||
FileInfo fi = new FileInfo(files[i]);
|
||||
uint size = (uint)fi.Length;
|
||||
Array.Copy(BitConverter.GetBytes(offset), 0, headerData, 0x8 + i * 0x10, 0x4);
|
||||
Array.Copy(BitConverter.GetBytes(size), 0, headerData, 0xC + i * 0x10, 0x4);
|
||||
offset += 0x200 - size % 0x200 + size;
|
||||
Array.Copy(BitConverter.GetBytes(offset), 0, headerData, 0x8 + (i * 0x10), 0x4);
|
||||
Array.Copy(BitConverter.GetBytes(size), 0, headerData, 0xC + (i * 0x10), 0x4);
|
||||
offset += 0x200 - (size % 0x200) + size;
|
||||
|
||||
// Do the Bottom (Hashes)
|
||||
byte[] hash = sha.ComputeHash(File.ReadAllBytes(files[i]));
|
||||
Array.Copy(hash, 0, headerData, 0x200 - 0x20 * (i + 1), 0x20);
|
||||
Array.Copy(hash, 0, headerData, 0x200 - (0x20 * (i + 1)), 0x20);
|
||||
}
|
||||
|
||||
// Set in the Data
|
||||
|
|
@ -93,7 +94,7 @@ public static bool set(string[] files, string outFile)
|
|||
{
|
||||
using (MemoryStream loadFile = new MemoryStream(File.ReadAllBytes(s)))
|
||||
loadFile.CopyTo(newFile);
|
||||
new MemoryStream(new byte[0x200 - newFile.Length % 0x200]).CopyTo(newFile);
|
||||
new MemoryStream(new byte[0x200 - (newFile.Length % 0x200)]).CopyTo(newFile);
|
||||
}
|
||||
|
||||
File.WriteAllBytes(outFile, newFile.ToArray());
|
||||
|
|
@ -120,13 +121,13 @@ public void setData(string[] files)
|
|||
|
||||
FileInfo fi = new FileInfo(files[i]);
|
||||
uint size = (uint)fi.Length;
|
||||
Array.Copy(BitConverter.GetBytes(offset), 0, headerData, 0x8 + i * 0x10, 0x4);
|
||||
Array.Copy(BitConverter.GetBytes(size), 0, headerData, 0xC + i * 0x10, 0x4);
|
||||
offset += 0x200 - size % 0x200 + size;
|
||||
Array.Copy(BitConverter.GetBytes(offset), 0, headerData, 0x8 + (i * 0x10), 0x4);
|
||||
Array.Copy(BitConverter.GetBytes(size), 0, headerData, 0xC + (i * 0x10), 0x4);
|
||||
offset += 0x200 - (size % 0x200) + size;
|
||||
|
||||
// Do the Bottom (Hashes)
|
||||
byte[] hash = sha.ComputeHash(File.ReadAllBytes(files[i]));
|
||||
Array.Copy(hash, 0, headerData, 0x200 - 0x20 * (i + 1), 0x20);
|
||||
Array.Copy(hash, 0, headerData, 0x200 - (0x20 * (i + 1)), 0x20);
|
||||
}
|
||||
|
||||
// Set in the Data
|
||||
|
|
@ -137,7 +138,7 @@ public void setData(string[] files)
|
|||
{
|
||||
using (MemoryStream loadFile = new MemoryStream(File.ReadAllBytes(s)))
|
||||
loadFile.CopyTo(newFile);
|
||||
new MemoryStream(new byte[0x200 - newFile.Length % 0x200]).CopyTo(newFile);
|
||||
new MemoryStream(new byte[0x200 - (newFile.Length % 0x200)]).CopyTo(newFile);
|
||||
}
|
||||
|
||||
Data = newFile.ToArray();
|
||||
|
|
|
|||
|
|
@ -26,6 +26,7 @@ public byte[] GetSuperBlockHash()
|
|||
SHA256Managed sha = new SHA256Managed();
|
||||
return sha.ComputeHash(Data, 0, 0x400);
|
||||
}
|
||||
|
||||
public string GetSerial()
|
||||
{
|
||||
const string output = "CTR-P-";
|
||||
|
|
@ -40,7 +41,7 @@ public string GetSerial()
|
|||
{
|
||||
char lc = RecognizedGames[titleid].ToArray()[0].ToCharArray()[3];
|
||||
char lc2 = vars[1].ToCharArray()[3];
|
||||
if (lc2 == 'A' || lc2 == 'E' || lc2 == 'P' && lc == 'J') //Prefer games in order US, PAL, JP
|
||||
if (lc2 == 'A' || lc2 == 'E' || (lc2 == 'P' && lc == 'J')) //Prefer games in order US, PAL, JP
|
||||
{
|
||||
RecognizedGames[titleid] = vars.Skip(1).Take(2).ToArray();
|
||||
}
|
||||
|
|
@ -57,14 +58,17 @@ public bool isPokemon()
|
|||
{
|
||||
return isORAS() || isXY();
|
||||
}
|
||||
|
||||
public bool isORAS()
|
||||
{
|
||||
return (TitleID & 0xFFFFFFFF) >> 8 == 0x11C5 || (TitleID & 0xFFFFFFFF) >> 8 == 0x11C4;
|
||||
}
|
||||
|
||||
public bool isXY()
|
||||
{
|
||||
return (TitleID & 0xFFFFFFFF) >> 8 == 0x55D || (TitleID & 0xFFFFFFFF) >> 8 == 0x55E;
|
||||
}
|
||||
|
||||
public string GetPokemonSerial()
|
||||
{
|
||||
if (!isPokemon())
|
||||
|
|
|
|||
|
|
@ -18,6 +18,7 @@ public static string Guess(string path)
|
|||
ext = Guess(br);
|
||||
return ext;
|
||||
}
|
||||
|
||||
public static string Guess(byte[] data)
|
||||
{
|
||||
string ext;
|
||||
|
|
@ -25,6 +26,7 @@ public static string Guess(byte[] data)
|
|||
ext = Guess(br);
|
||||
return ext;
|
||||
}
|
||||
|
||||
public static string Guess(MemoryStream ms, bool start = true)
|
||||
{
|
||||
string ext;
|
||||
|
|
@ -32,6 +34,7 @@ public static string Guess(MemoryStream ms, bool start = true)
|
|||
ext = Guess(br, start);
|
||||
return ext;
|
||||
}
|
||||
|
||||
public static string Guess(BinaryReader br, bool start = true)
|
||||
{
|
||||
long position = br.BaseStream.Position; // Store current position to reset after.
|
||||
|
|
@ -69,7 +72,7 @@ public static bool GuessMini(BinaryReader br, out string ext)
|
|||
// check for 2char container extensions
|
||||
ushort magic = br.ReadUInt16();
|
||||
ushort count = br.ReadUInt16();
|
||||
br.BaseStream.Position = 4 + 4 * count;
|
||||
br.BaseStream.Position = 4 + (4 * count);
|
||||
if (br.ReadUInt32() == br.BaseStream.Length)
|
||||
{
|
||||
ext += (char)magic & 0xFF;
|
||||
|
|
@ -82,6 +85,7 @@ public static bool GuessMini(BinaryReader br, out string ext)
|
|||
|
||||
return ext.Length > 0;
|
||||
}
|
||||
|
||||
public static bool GuessHeaderedDARC(BinaryReader br, out string ext)
|
||||
{
|
||||
long position = br.BaseStream.Position; // Store current position to reset after.
|
||||
|
|
@ -90,7 +94,7 @@ public static bool GuessHeaderedDARC(BinaryReader br, out string ext)
|
|||
{
|
||||
byte[] magic = Encoding.ASCII.GetBytes(br.ReadChars(4));
|
||||
int count = BitConverter.ToUInt16(magic, 0);
|
||||
br.BaseStream.Position = position + 4 + 0x40 * count;
|
||||
br.BaseStream.Position = position + 4 + (0x40 * count);
|
||||
uint tableval = br.ReadUInt32();
|
||||
br.BaseStream.Position += 0x20 * tableval;
|
||||
while (br.PeekChar() == 0) // seek forward
|
||||
|
|
@ -104,6 +108,7 @@ public static bool GuessHeaderedDARC(BinaryReader br, out string ext)
|
|||
|
||||
return ext.Length > 0;
|
||||
}
|
||||
|
||||
public static bool GuessBCLIM(BinaryReader br, out string ext)
|
||||
{
|
||||
long position = br.BaseStream.Position; // Store current position to reset after.
|
||||
|
|
@ -124,6 +129,7 @@ public static bool GuessBCLIM(BinaryReader br, out string ext)
|
|||
|
||||
return ext.Length > 0;
|
||||
}
|
||||
|
||||
public static bool GuessLZ11(BinaryReader br, out string ext)
|
||||
{
|
||||
long position = br.BaseStream.Position; // Store current position to reset after.
|
||||
|
|
@ -144,6 +150,7 @@ public static bool GuessLZ11(BinaryReader br, out string ext)
|
|||
br.BaseStream.Position = position;
|
||||
return ext.Length > 0;
|
||||
}
|
||||
|
||||
public static bool Guess4CHAR(BinaryReader br, out string ext)
|
||||
{
|
||||
long position = br.BaseStream.Position; // Store current position to reset after.
|
||||
|
|
@ -163,6 +170,7 @@ public static bool Guess4CHAR(BinaryReader br, out string ext)
|
|||
br.BaseStream.Position = position;
|
||||
return false;
|
||||
}
|
||||
|
||||
public static bool Guess3CHAR(BinaryReader br, out string ext)
|
||||
{
|
||||
long position = br.BaseStream.Position; // Store current position to reset after.
|
||||
|
|
|
|||
|
|
@ -28,7 +28,6 @@ public class UnpackProgressedEventArgs : EventArgs
|
|||
public int Total { get; set; }
|
||||
}
|
||||
|
||||
|
||||
public static event EventHandler<FileCountDeterminedEventArgs> FileCountDetermined;
|
||||
public static event EventHandler<PackProgressedEventArgs> PackProgressed;
|
||||
public static event EventHandler<UnpackProgressedEventArgs> UnpackProgressed;
|
||||
|
|
@ -82,7 +81,7 @@ public static int garcPackMS(string folderPath, string garcPath, int version, in
|
|||
// Magic = new[] { 'O', 'T', 'A', 'F' },
|
||||
Entries = new FATO_Entry[packOrder.Length],
|
||||
EntryCount = (ushort) packOrder.Length,
|
||||
HeaderSize = 0xC + packOrder.Length*4,
|
||||
HeaderSize = 0xC + (packOrder.Length*4),
|
||||
Padding = 0xFFFF
|
||||
},
|
||||
fatb =
|
||||
|
|
@ -133,7 +132,7 @@ public static int garcPackMS(string folderPath, string garcPath, int version, in
|
|||
|
||||
// Assemble Entry
|
||||
FileInfo fi = new FileInfo(packOrder[i]);
|
||||
int actualLength = (int)(fi.Length % 4 == 0 ? fi.Length : fi.Length + 4 - fi.Length % 4);
|
||||
int actualLength = (int)(fi.Length % 4 == 0 ? fi.Length : fi.Length + 4 - (fi.Length % 4));
|
||||
garc.fatb.Entries[i].SubEntries[0].Start = od;
|
||||
garc.fatb.Entries[i].SubEntries[0].End = actualLength + garc.fatb.Entries[i].SubEntries[0].Start;
|
||||
garc.fatb.Entries[i].SubEntries[0].Length = (int)fi.Length;
|
||||
|
|
@ -169,7 +168,7 @@ public static int garcPackMS(string folderPath, string garcPath, int version, in
|
|||
|
||||
// Assemble Entry
|
||||
FileInfo fi = new FileInfo(s);
|
||||
int actualLength = (int)(fi.Length % 4 == 0 ? fi.Length : fi.Length + 4 - fi.Length % 4);
|
||||
int actualLength = (int)(fi.Length % 4 == 0 ? fi.Length : fi.Length + 4 - (fi.Length % 4));
|
||||
garc.fatb.Entries[i].SubEntries[fileNumber].Start = od;
|
||||
garc.fatb.Entries[i].SubEntries[fileNumber].End = actualLength + garc.fatb.Entries[i].SubEntries[fileNumber].Start;
|
||||
garc.fatb.Entries[i].SubEntries[fileNumber].Length = (int)fi.Length;
|
||||
|
|
@ -314,6 +313,7 @@ public static int garcPackMS(string folderPath, string garcPath, int version, in
|
|||
return filectr;
|
||||
}
|
||||
}
|
||||
|
||||
public static int garcUnpack(string garcPath, string outPath, bool skipDecompression)
|
||||
{
|
||||
if (!File.Exists(garcPath)) throw new FileNotFoundException("File does not exist");
|
||||
|
|
@ -338,7 +338,6 @@ public static int garcUnpack(string garcPath, string outPath, bool skipDecompres
|
|||
// Pull out all the files
|
||||
for (int o = 0; o < garc.fato.EntryCount; o++)
|
||||
{
|
||||
|
||||
var Entry = garc.fatb.Entries[o];
|
||||
// Set Entry File Name
|
||||
string fileName = o.ToString(format);
|
||||
|
|
@ -404,6 +403,7 @@ public static GARCFile unpackGARC(string path)
|
|||
{
|
||||
return unpackGARC(File.OpenRead(path));
|
||||
}
|
||||
|
||||
private static GARCFile unpackGARC(byte[] data)
|
||||
{
|
||||
GARCFile garc;
|
||||
|
|
@ -411,6 +411,7 @@ private static GARCFile unpackGARC(byte[] data)
|
|||
garc = unpackGARC(gd);
|
||||
return garc;
|
||||
}
|
||||
|
||||
private static GARCFile unpackGARC(Stream stream)
|
||||
{
|
||||
GARCFile garc = new GARCFile();
|
||||
|
|
@ -500,7 +501,7 @@ public static MemGARC packGARC(byte[][] data, int version, int contentpadnearest
|
|||
// Magic = new[] { 'O', 'T', 'A', 'F' },
|
||||
Entries = new FATO_Entry[data.Length],
|
||||
EntryCount = (ushort) data.Length,
|
||||
HeaderSize = 0xC + data.Length*4,
|
||||
HeaderSize = 0xC + (data.Length*4),
|
||||
Padding = 0xFFFF
|
||||
},
|
||||
fatb =
|
||||
|
|
@ -731,6 +732,7 @@ public lzGARC(byte[] data)
|
|||
}
|
||||
|
||||
private readonly GARCEntry[] Storage;
|
||||
|
||||
private class GARCEntry
|
||||
{
|
||||
public bool Accessed;
|
||||
|
|
@ -739,6 +741,7 @@ private class GARCEntry
|
|||
public readonly bool WasCompressed;
|
||||
|
||||
public GARCEntry() { }
|
||||
|
||||
public GARCEntry(byte[] data)
|
||||
{
|
||||
Data = data;
|
||||
|
|
@ -792,6 +795,7 @@ private byte[] getFile(int file, int subfile = 0)
|
|||
Array.Copy(Data, offset, data, 0, data.Length);
|
||||
return data;
|
||||
}
|
||||
|
||||
public byte[] this[int file]
|
||||
{
|
||||
get
|
||||
|
|
@ -811,6 +815,7 @@ private byte[] getFile(int file, int subfile = 0)
|
|||
Storage[file].Saved = true;
|
||||
}
|
||||
}
|
||||
|
||||
public byte[] Save()
|
||||
{
|
||||
byte[][] data = new byte[FileCount][];
|
||||
|
|
@ -858,6 +863,7 @@ public struct FATO
|
|||
|
||||
public FATO_Entry[] Entries;
|
||||
}
|
||||
|
||||
public struct FATO_Entry
|
||||
{
|
||||
public int Offset;
|
||||
|
|
@ -871,12 +877,14 @@ public struct FATB
|
|||
|
||||
public FATB_Entry[] Entries;
|
||||
}
|
||||
|
||||
public struct FATB_Entry
|
||||
{
|
||||
public uint Vector;
|
||||
public bool IsFolder;
|
||||
public FATB_SubEntry[] SubEntries;
|
||||
}
|
||||
|
||||
public struct FATB_SubEntry
|
||||
{
|
||||
public bool Exists;
|
||||
|
|
|
|||
|
|
@ -8,11 +8,13 @@ namespace pk3DS.Core.CTR
|
|||
public class BCLIM : BXLIM
|
||||
{
|
||||
public BCLIM(Stream data) => ReadBCLIM(data);
|
||||
|
||||
public BCLIM(byte[] data)
|
||||
{
|
||||
using (var ms = new MemoryStream(data))
|
||||
ReadBCLIM(ms);
|
||||
}
|
||||
|
||||
public BCLIM(string path)
|
||||
{
|
||||
var data = File.ReadAllBytes(path);
|
||||
|
|
@ -111,6 +113,7 @@ public static byte[] IMGToBCLIM(Image img, char fc)
|
|||
}
|
||||
return ms.ToArray();
|
||||
}
|
||||
|
||||
public static byte[] getBCLIM(string path, char fc)
|
||||
{
|
||||
byte[] byteArray = File.ReadAllBytes(path);
|
||||
|
|
@ -120,6 +123,7 @@ public static byte[] getBCLIM(string path, char fc)
|
|||
return IMGToBCLIM(img, fc);
|
||||
}
|
||||
}
|
||||
|
||||
public static Image makeBCLIM(string path, char fc)
|
||||
{
|
||||
byte[] bclim = getBCLIM(path, fc);
|
||||
|
|
@ -131,6 +135,7 @@ public static Image makeBCLIM(string path, char fc)
|
|||
|
||||
return makeBMP(newPath);
|
||||
}
|
||||
|
||||
public static Image makeBMP(string path, bool autosave = false, bool crop = true)
|
||||
{
|
||||
BCLIM bclim = analyze(path);
|
||||
|
|
@ -238,6 +243,7 @@ public static int write16BitColorPalette(Bitmap img, ref MemoryStream ms)
|
|||
}
|
||||
return 7;
|
||||
}
|
||||
|
||||
public static void writeGeneric(int format, Bitmap img, ref MemoryStream ms, bool rectangle = true)
|
||||
{
|
||||
BinaryWriter bz = new BinaryWriter(ms);
|
||||
|
|
@ -258,11 +264,12 @@ public static byte[] MakePixelData(byte[] input, ref int w, ref int h, XLIMOrien
|
|||
for (uint i = 0; i < pixels.Length / 4; i++)
|
||||
{
|
||||
var c = orienter.Get(i);
|
||||
var offset = c.X * 4 + c.Y * width;
|
||||
var offset = (c.X * 4) + (c.Y * width);
|
||||
Array.Copy(input, offset, pixels, i * 4, 4);
|
||||
}
|
||||
return pixels;
|
||||
}
|
||||
|
||||
public static byte[] getPixelData(Bitmap img, int format, bool rectangle = true)
|
||||
{
|
||||
int w = img.Width;
|
||||
|
|
@ -347,6 +354,7 @@ public static byte[] getPixelData(Bitmap img, int format, bool rectangle = true)
|
|||
return mz.ToArray();
|
||||
}
|
||||
}
|
||||
|
||||
public static int getColorCount(Bitmap img)
|
||||
{
|
||||
Color[] colors = new Color[img.Width * img.Height];
|
||||
|
|
@ -372,24 +380,29 @@ internal static byte GetL8(Color c)
|
|||
byte green = c.G;
|
||||
byte blue = c.B;
|
||||
// Luma (Y’) = 0.299 R’ + 0.587 G’ + 0.114 B’ from wikipedia
|
||||
return (byte)(((0x4CB2 * red + 0x9691 * green + 0x1D3E * blue) >> 16) & 0xFF);
|
||||
return (byte)((((0x4CB2 * red) + (0x9691 * green) + (0x1D3E * blue)) >> 16) & 0xFF);
|
||||
} // L8
|
||||
|
||||
internal static byte GetA8(Color c)
|
||||
{
|
||||
return c.A;
|
||||
} // A8
|
||||
|
||||
internal static byte GetLA4(Color c)
|
||||
{
|
||||
return (byte)(c.A / 0x11 + c.R / 0x11 << 4);
|
||||
return (byte)((c.A / 0x11) + (c.R / 0x11) << 4);
|
||||
} // LA4
|
||||
|
||||
internal static ushort GetLA8(Color c)
|
||||
{
|
||||
return (ushort)(c.A + (c.R << 8));
|
||||
} // LA8
|
||||
|
||||
internal static ushort GetHILO8(Color c)
|
||||
{
|
||||
return (ushort)(c.G + (c.R << 8));
|
||||
} // HILO8
|
||||
|
||||
internal static ushort GetRGB565(Color c)
|
||||
{
|
||||
int val = 0;
|
||||
|
|
@ -411,6 +424,7 @@ internal static ushort GetRGBA5551(Color c)
|
|||
|
||||
return v;
|
||||
}// RGBA5551
|
||||
|
||||
internal static ushort GetRGBA4444(Color c)
|
||||
{
|
||||
int val = 0;
|
||||
|
|
@ -420,6 +434,7 @@ internal static ushort GetRGBA4444(Color c)
|
|||
val += (c.R / 0x11) << 12;
|
||||
return (ushort)val;
|
||||
}// RGBA4444
|
||||
|
||||
internal static uint GetRGBA8888(Color c) // RGBA8888
|
||||
{
|
||||
uint val = 0;
|
||||
|
|
@ -433,7 +448,6 @@ internal static ushort GetRGBA4444(Color c)
|
|||
// Unit Conversion
|
||||
internal static byte convert8to5(int colorval)
|
||||
{
|
||||
|
||||
byte[] Convert8to5 = { 0x00,0x08,0x10,0x18,0x20,0x29,0x31,0x39,
|
||||
0x41,0x4A,0x52,0x5A,0x62,0x6A,0x73,0x7B,
|
||||
0x83,0x8B,0x94,0x9C,0xA4,0xAC,0xB4,0xBD,
|
||||
|
|
@ -453,6 +467,7 @@ public static BCLIM analyze(byte[] data, string shortPath)
|
|||
};
|
||||
return bclim;
|
||||
}
|
||||
|
||||
public static BCLIM analyze(string path)
|
||||
{
|
||||
byte[] data = File.ReadAllBytes(path);
|
||||
|
|
|
|||
|
|
@ -7,11 +7,13 @@ namespace pk3DS.Core.CTR
|
|||
public class BFLIM : BXLIM
|
||||
{
|
||||
public BFLIM(Stream data) => ReadBFLIM(data);
|
||||
|
||||
public BFLIM(byte[] data)
|
||||
{
|
||||
using (var ms = new MemoryStream(data))
|
||||
ReadBFLIM(ms);
|
||||
}
|
||||
|
||||
public BFLIM(string path)
|
||||
{
|
||||
var data = File.ReadAllBytes(path);
|
||||
|
|
|
|||
|
|
@ -43,7 +43,7 @@ public byte[] GetImageData(bool crop = true)
|
|||
continue;
|
||||
|
||||
var val = pixels[i];
|
||||
uint o = 4 * (coord.X + coord.Y * Footer.Width);
|
||||
uint o = 4 * (coord.X + (coord.Y * Footer.Width));
|
||||
array[o + 0] = (byte)(val & 0xFF);
|
||||
array[o + 1] = (byte)(val >> 8 & 0xFF);
|
||||
array[o + 2] = (byte)(val >> 16 & 0xFF);
|
||||
|
|
@ -56,6 +56,7 @@ public virtual uint[] GetPixels()
|
|||
{
|
||||
return PixelConverter.GetPixels(PixelData, Footer.Format).ToArray();
|
||||
}
|
||||
|
||||
public byte[] GetPixelsRaw()
|
||||
{
|
||||
var pix = GetPixels();
|
||||
|
|
|
|||
|
|
@ -9,12 +9,14 @@ public Coordinate(uint x, uint y)
|
|||
{
|
||||
X = x; Y = y;
|
||||
}
|
||||
|
||||
public void Transpose()
|
||||
{
|
||||
var tmp = X;
|
||||
X = Y;
|
||||
Y = tmp;
|
||||
}
|
||||
|
||||
public void Rotate90(uint height)
|
||||
{
|
||||
var tmp = X;
|
||||
|
|
|
|||
|
|
@ -40,7 +40,6 @@ public static IEnumerable<uint> GetPixels(byte[] raw, XLIMEncoding e)
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
internal static uint GetDecodedPixelValue(uint val, XLIMEncoding e)
|
||||
{
|
||||
byte a = byte.MaxValue, r = 0, g = 0, b = 0;
|
||||
|
|
@ -136,6 +135,7 @@ public static uint GetEncodedPixelValue(byte[] raw, int offset, int size)
|
|||
return raw[offset];
|
||||
}
|
||||
}
|
||||
|
||||
public static int GetBitsPerPixel(this XLIMEncoding e)
|
||||
{
|
||||
if (_32.Contains(e))
|
||||
|
|
@ -153,10 +153,12 @@ public static int GetBitsPerPixel(this XLIMEncoding e)
|
|||
{
|
||||
XLIMEncoding.RGBA8,
|
||||
};
|
||||
|
||||
private static readonly HashSet<XLIMEncoding> _24 = new HashSet<XLIMEncoding>
|
||||
{
|
||||
XLIMEncoding.RGBX8,
|
||||
};
|
||||
|
||||
private static readonly HashSet<XLIMEncoding> _16 = new HashSet<XLIMEncoding>
|
||||
{
|
||||
XLIMEncoding.LA8,
|
||||
|
|
@ -165,6 +167,7 @@ public static int GetBitsPerPixel(this XLIMEncoding e)
|
|||
XLIMEncoding.RGB5A1,
|
||||
XLIMEncoding.RGBA4,
|
||||
};
|
||||
|
||||
private static readonly HashSet<XLIMEncoding> _8 = new HashSet<XLIMEncoding>
|
||||
{
|
||||
XLIMEncoding.L8,
|
||||
|
|
|
|||
|
|
@ -12,6 +12,7 @@ internal static int gcm(int n, int m)
|
|||
{
|
||||
return (n + m - 1) / m * m;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Next Largest Power of 2
|
||||
/// </summary>
|
||||
|
|
|
|||
|
|
@ -19,6 +19,7 @@ public static long Decompress(string infile, string outfile)
|
|||
return Decompress(inStream, inStream.Length, outStream);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Decompresses the given stream, writing the decompressed data to the given output stream.
|
||||
/// Assumes <code>Supports(instream)</code> returns <code>true</code>.
|
||||
|
|
@ -302,7 +303,7 @@ internal static unsafe int Compress(Stream instream, long inLength, Stream outst
|
|||
// we do need to buffer the output, as the first byte indicates which blocks are compressed.
|
||||
// this version does not use a look-ahead, so we do not need to buffer more than 8 blocks at a time.
|
||||
// (a block is at most 4 bytes long)
|
||||
byte[] outbuffer = new byte[8 * 4 + 1];
|
||||
byte[] outbuffer = new byte[(8 * 4) + 1];
|
||||
outbuffer[0] = 0;
|
||||
int bufferlength = 1, bufferedBlocks = 0;
|
||||
int readBytes = 0;
|
||||
|
|
@ -417,7 +418,7 @@ internal static unsafe int CompressWithLA(Stream instream, long inLength, Stream
|
|||
// we do need to buffer the output, as the first byte indicates which blocks are compressed.
|
||||
// this version does not use a look-ahead, so we do not need to buffer more than 8 blocks at a time.
|
||||
// blocks are at most 4 bytes long.
|
||||
byte[] outbuffer = new byte[8 * 4 + 1];
|
||||
byte[] outbuffer = new byte[(8 * 4) + 1];
|
||||
outbuffer[0] = 0;
|
||||
int bufferlength = 1, bufferedBlocks = 0;
|
||||
int readBytes = 0;
|
||||
|
|
@ -438,7 +439,6 @@ internal static unsafe int CompressWithLA(Stream instream, long inLength, Stream
|
|||
bufferedBlocks = 0;
|
||||
}
|
||||
|
||||
|
||||
if (lengths[readBytes] == 1)
|
||||
{
|
||||
outbuffer[bufferlength++] = *(instart + readBytes++);
|
||||
|
|
@ -480,7 +480,6 @@ internal static unsafe int CompressWithLA(Stream instream, long inLength, Stream
|
|||
readBytes += lengths[readBytes];
|
||||
}
|
||||
|
||||
|
||||
bufferedBlocks++;
|
||||
}
|
||||
|
||||
|
|
@ -580,6 +579,7 @@ public InputTooLargeException()
|
|||
: base("The compression ratio is not high enough to fit the input "
|
||||
+ "in a single compressed file.") { }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// An exception that is thrown by the decompression functions when there
|
||||
/// is not enough data available in order to properly decompress the input.
|
||||
|
|
@ -610,6 +610,7 @@ public NotEnoughDataException(long currentOutSize, long totalOutSize)
|
|||
DesiredLength = totalOutSize;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// An exception thrown by the compression or decompression function, indicating that the
|
||||
/// given input length was too large for the given input stream.
|
||||
|
|
@ -624,6 +625,7 @@ public StreamTooShortException()
|
|||
+ "before the given amout of data was read.")
|
||||
{ }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// An exception indication that the input has more data than required in order
|
||||
/// to decompress it. This may indicate that more sub-files are present in the file.
|
||||
|
|
@ -706,6 +708,7 @@ public static unsafe int GetOccurrenceLength(byte* newPtr, int newLength, byte*
|
|||
return maxLength;
|
||||
}
|
||||
}
|
||||
|
||||
public static class IOUtils
|
||||
{
|
||||
#region byte[] <-> (u)int
|
||||
|
|
|
|||
|
|
@ -25,6 +25,7 @@ public class Header
|
|||
public ulong[] NCCHIdTable; //Size: 0x8;
|
||||
//public byte[] Padding2; //Size: 0x30;
|
||||
}
|
||||
|
||||
public class CardInfoHeader
|
||||
{
|
||||
public uint WritableAddress;
|
||||
|
|
@ -48,6 +49,7 @@ public class CardInfoNotes
|
|||
public byte[] Reserved3; //Size: 0xCD6;
|
||||
}
|
||||
}
|
||||
|
||||
public class NCCH_Meta
|
||||
{
|
||||
public uint Offset;
|
||||
|
|
@ -58,10 +60,11 @@ public ulong GetWritableAddress()
|
|||
{
|
||||
const ulong MEDIA_UNIT_SIZE = 0x200;
|
||||
return Card2
|
||||
? Align(header.OffsetSizeTable[NCCH_Array.Count - 1].Offset * NCCH.MEDIA_UNIT_SIZE
|
||||
+ header.OffsetSizeTable[NCCH_Array.Count - 1].Size * NCCH.MEDIA_UNIT_SIZE + 0x1000, 0x10000) / MEDIA_UNIT_SIZE
|
||||
? Align((header.OffsetSizeTable[NCCH_Array.Count - 1].Offset * NCCH.MEDIA_UNIT_SIZE)
|
||||
+ (header.OffsetSizeTable[NCCH_Array.Count - 1].Size * NCCH.MEDIA_UNIT_SIZE) + 0x1000, 0x10000) / MEDIA_UNIT_SIZE
|
||||
: 0x00000000FFFFFFFF;
|
||||
}
|
||||
|
||||
public void BuildHeader()
|
||||
{
|
||||
Data = new byte[0x4000];
|
||||
|
|
@ -71,13 +74,13 @@ public void BuildHeader()
|
|||
Array.Copy(BitConverter.GetBytes(header.TitleId), 0, Data, 0x108, 8);
|
||||
for (int i = 0; i < header.OffsetSizeTable.Length; i++)
|
||||
{
|
||||
Array.Copy(BitConverter.GetBytes(header.OffsetSizeTable[i].Offset), 0, Data, 0x120 + 8 * i, 4);
|
||||
Array.Copy(BitConverter.GetBytes(header.OffsetSizeTable[i].Size), 0, Data, 0x124 + 8 * i, 4);
|
||||
Array.Copy(BitConverter.GetBytes(header.OffsetSizeTable[i].Offset), 0, Data, 0x120 + (8 * i), 4);
|
||||
Array.Copy(BitConverter.GetBytes(header.OffsetSizeTable[i].Size), 0, Data, 0x124 + (8 * i), 4);
|
||||
}
|
||||
Array.Copy(header.flags, 0, Data, 0x188, header.flags.Length);
|
||||
for (int i = 0; i < header.NCCHIdTable.Length; i++)
|
||||
{
|
||||
Array.Copy(BitConverter.GetBytes(header.NCCHIdTable[i]), 0, Data, 0x190 + 8 * i, 8);
|
||||
Array.Copy(BitConverter.GetBytes(header.NCCHIdTable[i]), 0, Data, 0x190 + (8 * i), 8);
|
||||
}
|
||||
//CardInfoHeader
|
||||
Array.Copy(BitConverter.GetBytes(cardinfoheader.WritableAddress), 0, Data, 0x200, 4);
|
||||
|
|
@ -97,12 +100,13 @@ public void BuildHeader()
|
|||
Array.Copy(cardinfoheader.NCCH0Header, 0, Data, 0x1100, cardinfoheader.NCCH0Header.Length);
|
||||
Array.Copy(Enumerable.Repeat((byte)0xFF, 0x2E00).ToArray(), 0, Data, 0x1200, 0x2E00);
|
||||
}
|
||||
|
||||
internal static ulong Align(ulong input, ulong alignsize)
|
||||
{
|
||||
ulong output = input;
|
||||
if (output % alignsize != 0)
|
||||
{
|
||||
output += alignsize - output % alignsize;
|
||||
output += alignsize - (output % alignsize);
|
||||
}
|
||||
return output;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -25,7 +25,7 @@ public RomFS(string fn)
|
|||
uint mhlen = (uint)(fs.ReadByte() | (fs.ReadByte() << 8) | (fs.ReadByte() << 16) | (fs.ReadByte() << 24));
|
||||
SuperBlockLen = mhlen + 0x50;
|
||||
if (SuperBlockLen % 0x200 != 0)
|
||||
SuperBlockLen += 0x200 - SuperBlockLen % 0x200;
|
||||
SuperBlockLen += 0x200 - (SuperBlockLen % 0x200);
|
||||
byte[] superblock = new byte[SuperBlockLen];
|
||||
fs.Seek(0, SeekOrigin.Begin);
|
||||
fs.Read(superblock, 0, superblock.Length);
|
||||
|
|
@ -63,6 +63,7 @@ internal static void updateTB(RichTextBox RTB, string progress)
|
|||
}
|
||||
catch { }
|
||||
}
|
||||
|
||||
public static void BuildRomFS(string infile, string outfile, RichTextBox TB_Progress = null, ProgressBar PB_Show = null)
|
||||
{
|
||||
OutFile = outfile;
|
||||
|
|
@ -101,10 +102,11 @@ internal static ulong Align(ulong input, ulong alignsize)
|
|||
ulong output = input;
|
||||
if (output % alignsize != 0)
|
||||
{
|
||||
output += alignsize - output % alignsize;
|
||||
output += alignsize - (output % alignsize);
|
||||
}
|
||||
return output;
|
||||
}
|
||||
|
||||
internal static void MakeRomFSData(RomfsFile[] RomFiles, MemoryStream metadata, RichTextBox TB_Progress = null, ProgressBar PB_Show = null)
|
||||
{
|
||||
updateTB(TB_Progress, "Computing IVFC Header Data...");
|
||||
|
|
@ -233,6 +235,7 @@ internal static void MakeRomFSData(RomfsFile[] RomFiles, MemoryStream metadata,
|
|||
if (File.Exists(OutFile)) File.Delete(OutFile);
|
||||
File.Move(TempFile, OutFile);
|
||||
}
|
||||
|
||||
internal static void WriteBinary(string tempFile, string outFile, RichTextBox TB_Progress = null, ProgressBar PB_Show = null)
|
||||
{
|
||||
using (FileStream fs = new FileStream(outFile, FileMode.Create))
|
||||
|
|
@ -268,6 +271,7 @@ internal static void WriteBinary(string tempFile, string outFile, RichTextBox TB
|
|||
File.Delete(TempFile);
|
||||
updateTB(TB_Progress, "Wrote RomFS to path:" + Environment.NewLine + outFile);
|
||||
}
|
||||
|
||||
internal static string ByteArrayToString(IEnumerable<byte> input)
|
||||
{
|
||||
StringBuilder sb = new StringBuilder();
|
||||
|
|
@ -281,6 +285,7 @@ internal static void UpdateTB_Progress(string text, RichTextBox TB_Progress = nu
|
|||
{
|
||||
TB_Progress.Text += text + Environment.NewLine;
|
||||
}
|
||||
|
||||
internal static void BuildRomFSHeader(MemoryStream romfs_stream, RomfsFile[] Entries, string DIR)
|
||||
{
|
||||
ROOT_DIR = DIR;
|
||||
|
|
@ -291,6 +296,7 @@ internal static void BuildRomFSHeader(MemoryStream romfs_stream, RomfsFile[] Ent
|
|||
PopulateRomfs(MetaData, Entries);
|
||||
WriteMetaDataToStream(MetaData, romfs_stream);
|
||||
}
|
||||
|
||||
internal static void InitializeMetaData(Romfs_MetaData MetaData)
|
||||
{
|
||||
MetaData.InfoHeader = new Romfs_InfoHeader();
|
||||
|
|
@ -306,6 +312,7 @@ internal static void InitializeMetaData(Romfs_MetaData MetaData)
|
|||
MetaData.DirHashTable = new List<uint>();
|
||||
MetaData.FileHashTable = new List<uint>();
|
||||
}
|
||||
|
||||
internal static void CalcRomfsSize(Romfs_MetaData MetaData)
|
||||
{
|
||||
MetaData.DirNum = 1;
|
||||
|
|
@ -315,7 +322,7 @@ internal static void CalcRomfsSize(Romfs_MetaData MetaData)
|
|||
MetaData.M_DirHashTableEntry = GetHashTableEntryCount(MetaData.DirNum);
|
||||
MetaData.M_FileHashTableEntry = GetHashTableEntryCount(MetaData.FileNum);
|
||||
|
||||
uint MetaDataSize = (uint)Align(0x28 + MetaData.M_DirHashTableEntry * 4 + MetaData.M_DirTableLen + MetaData.M_FileHashTableEntry * 4 + MetaData.M_FileTableLen, PADDING_ALIGN);
|
||||
uint MetaDataSize = (uint)Align(0x28 + (MetaData.M_DirHashTableEntry * 4) + MetaData.M_DirTableLen + (MetaData.M_FileHashTableEntry * 4) + MetaData.M_FileTableLen, PADDING_ALIGN);
|
||||
for (int i = 0; i < MetaData.M_DirHashTableEntry; i++)
|
||||
MetaData.DirHashTable.Add(ROMFS_UNUSED_ENTRY);
|
||||
|
||||
|
|
@ -347,6 +354,7 @@ internal static void CalcRomfsSize(Romfs_MetaData MetaData)
|
|||
}
|
||||
MetaData.InfoHeader.DataOffset = MetaDataSize;
|
||||
}
|
||||
|
||||
internal static uint GetHashTableEntryCount(uint Entries)
|
||||
{
|
||||
uint count = Entries;
|
||||
|
|
@ -363,6 +371,7 @@ internal static uint GetHashTableEntryCount(uint Entries)
|
|||
}
|
||||
return count;
|
||||
}
|
||||
|
||||
internal static void CalcDirSize(Romfs_MetaData MetaData, DirectoryInfo dir)
|
||||
{
|
||||
if (MetaData.M_DirTableLen == 0)
|
||||
|
|
@ -381,6 +390,7 @@ internal static void CalcDirSize(Romfs_MetaData MetaData, DirectoryInfo dir)
|
|||
MetaData.FileNum += (uint)files.Length;
|
||||
MetaData.DirNum += (uint)SubDirectories.Length;
|
||||
}
|
||||
|
||||
internal static void PopulateRomfs(Romfs_MetaData MetaData, RomfsFile[] Entries)
|
||||
{
|
||||
//Recursively Add All Directories to DirectoryTable
|
||||
|
|
@ -394,6 +404,7 @@ internal static void PopulateRomfs(Romfs_MetaData MetaData, RomfsFile[] Entries)
|
|||
|
||||
//Thats it.
|
||||
}
|
||||
|
||||
internal static void PopulateHashTables(Romfs_MetaData MetaData)
|
||||
{
|
||||
for (int i = 0; i < MetaData.DirTable.DirectoryTable.Count; i++)
|
||||
|
|
@ -430,6 +441,7 @@ internal static void AddDirHashKey(Romfs_MetaData MetaData, int index)
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
internal static void AddFileHashKey(Romfs_MetaData MetaData, int index)
|
||||
{
|
||||
uint parent = MetaData.FileTable.FileTable[index].ParentDirOffset;
|
||||
|
|
@ -523,6 +535,7 @@ internal static void AddDir(Romfs_MetaData MetaData, DirectoryInfo Dir, uint par
|
|||
MetaData.DirTable.DirectoryTable[curindex].ChildOffset =
|
||||
MetaData.DirTable.DirectoryTable[childindex].Offset;
|
||||
}
|
||||
|
||||
internal static void AddFiles(Romfs_MetaData MetaData, RomfsFile[] Entries)
|
||||
{
|
||||
string PrevDirPath = "";
|
||||
|
|
@ -610,7 +623,7 @@ internal static void WriteMetaDataToStream(Romfs_MetaData MetaData, MemoryStream
|
|||
|
||||
//Padding
|
||||
while (stream.Position % PADDING_ALIGN != 0)
|
||||
stream.Write(new byte[PADDING_ALIGN - stream.Position % 0x10], 0, (int)(PADDING_ALIGN - stream.Position % 0x10));
|
||||
stream.Write(new byte[PADDING_ALIGN - (stream.Position % 0x10)], 0, (int)(PADDING_ALIGN - (stream.Position % 0x10)));
|
||||
//All Done.
|
||||
}
|
||||
|
||||
|
|
@ -623,6 +636,7 @@ internal static int GetRomfsDirEntry(Romfs_MetaData MetaData, string FullName)
|
|||
|
||||
return -1;
|
||||
}
|
||||
|
||||
internal static int GetRomfsDirEntry(Romfs_MetaData MetaData, uint Offset)
|
||||
{
|
||||
for (int i = 0; i < MetaData.DirTable.DirectoryTable.Count; i++)
|
||||
|
|
@ -631,6 +645,7 @@ internal static int GetRomfsDirEntry(Romfs_MetaData MetaData, uint Offset)
|
|||
|
||||
return -1;
|
||||
}
|
||||
|
||||
internal static int GetRomfsFileEntry(Romfs_MetaData MetaData, uint Offset)
|
||||
{
|
||||
for (int i = 0; i < MetaData.FileTable.FileTable.Count; i++)
|
||||
|
|
@ -657,25 +672,30 @@ public class Romfs_MetaData
|
|||
public uint FileTableLen;
|
||||
public uint M_FileTableLen;
|
||||
}
|
||||
|
||||
public struct Romfs_SectionHeader
|
||||
{
|
||||
public uint Offset;
|
||||
public uint Size;
|
||||
}
|
||||
|
||||
public struct Romfs_InfoHeader
|
||||
{
|
||||
public uint HeaderLength;
|
||||
public Romfs_SectionHeader[] Sections;
|
||||
public uint DataOffset;
|
||||
}
|
||||
|
||||
public class Romfs_DirTable
|
||||
{
|
||||
public List<Romfs_DirEntry> DirectoryTable;
|
||||
}
|
||||
|
||||
public class Romfs_FileTable
|
||||
{
|
||||
public List<Romfs_FileEntry> FileTable;
|
||||
}
|
||||
|
||||
public class Romfs_DirEntry
|
||||
{
|
||||
public uint ParentOffset;
|
||||
|
|
@ -687,6 +707,7 @@ public class Romfs_DirEntry
|
|||
public string FullName;
|
||||
public uint Offset;
|
||||
}
|
||||
|
||||
public class Romfs_FileEntry
|
||||
{
|
||||
public uint ParentDirOffset;
|
||||
|
|
@ -712,16 +733,19 @@ public static ulong GetDataBlockLength(RomfsFile[] files, ulong PreData)
|
|||
return files.Length == 0 ? PreData : PreData + files[files.Length - 1].Offset + files[files.Length - 1].Size;
|
||||
}
|
||||
}
|
||||
|
||||
public class IVFCInfo
|
||||
{
|
||||
public IVFCLevel[] Levels;
|
||||
}
|
||||
|
||||
public class IVFCLevel
|
||||
{
|
||||
public ulong HashOffset;
|
||||
public ulong DataLength;
|
||||
public uint BlockSize;
|
||||
}
|
||||
|
||||
public class FileNameTable
|
||||
{
|
||||
public List<FileInfo> NameEntryTable { get; }
|
||||
|
|
@ -745,6 +769,7 @@ internal void AddDirectory(DirectoryInfo dir)
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static class LayoutManager
|
||||
{
|
||||
public static Output[] Create(IEnumerable<Input> Input)
|
||||
|
|
@ -764,19 +789,22 @@ public static Output[] Create(IEnumerable<Input> Input)
|
|||
}
|
||||
return list.ToArray();
|
||||
}
|
||||
|
||||
private static ulong AlignInput(ulong input, ulong alignsize)
|
||||
{
|
||||
ulong output = input;
|
||||
if (output % alignsize != 0)
|
||||
output += alignsize - output % alignsize;
|
||||
output += alignsize - (output % alignsize);
|
||||
|
||||
return output;
|
||||
}
|
||||
|
||||
public class Input
|
||||
{
|
||||
public string FilePath;
|
||||
public uint AlignmentSize;
|
||||
}
|
||||
|
||||
public class Output
|
||||
{
|
||||
public string FilePath;
|
||||
|
|
|
|||
|
|
@ -43,6 +43,7 @@ public SARC()
|
|||
SFAT = new SFAT();
|
||||
SFNT = new SFNT();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a <see cref="SARC"/> from a file location.
|
||||
/// </summary>
|
||||
|
|
@ -56,6 +57,7 @@ public SARC(string path)
|
|||
ReadSARC();
|
||||
Valid = true;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a <see cref="SARC"/> from a provided stream.
|
||||
/// </summary>
|
||||
|
|
@ -67,6 +69,7 @@ public SARC(Stream fs)
|
|||
ReadSARC();
|
||||
Valid = true;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a <see cref="SARC"/> from a provided array.
|
||||
/// </summary>
|
||||
|
|
@ -122,6 +125,7 @@ public void SetFileInfo(string path)
|
|||
/// <param name="entry">Entry to fetch data for</param>
|
||||
/// <returns>Data array</returns>
|
||||
public byte[] GetData(SFATEntry entry) => GetData(entry.FileDataStart, entry.FileDataLength);
|
||||
|
||||
/// <summary>
|
||||
/// Overwrites the entry data, assuming the size is the exact same.
|
||||
/// </summary>
|
||||
|
|
@ -133,6 +137,7 @@ public void SetData(SFATEntry entry, byte[] data)
|
|||
throw new ArgumentException(nameof(data.Length));
|
||||
SetData(entry.FileDataStart, data);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Exports the entry data for a given <see cref="SFATEntry"/> at a provided path with its assigned <see cref="SFATEntry"/> file name via the <see cref="SFNT"/> name table.
|
||||
/// </summary>
|
||||
|
|
@ -190,6 +195,7 @@ private string GetFileName(int offset)
|
|||
string name = sb.ToString().Replace('/', Path.DirectorySeparatorChar);
|
||||
return name;
|
||||
}
|
||||
|
||||
private void SetFileName(int offset, string value)
|
||||
{
|
||||
var str = value.Replace(Path.DirectorySeparatorChar, '/');
|
||||
|
|
@ -199,6 +205,7 @@ private void SetFileName(int offset, string value)
|
|||
stream.WriteByte((byte)b);
|
||||
stream.WriteByte((byte)'\0');
|
||||
}
|
||||
|
||||
private byte[] GetData(int offset, int length)
|
||||
{
|
||||
byte[] fileBuffer = new byte[length];
|
||||
|
|
@ -206,6 +213,7 @@ private byte[] GetData(int offset, int length)
|
|||
stream.Read(fileBuffer, 0, length);
|
||||
return fileBuffer;
|
||||
}
|
||||
|
||||
private void SetData(int offset, byte[] data)
|
||||
{
|
||||
stream.Seek(offset + DataOffset, SeekOrigin.Begin);
|
||||
|
|
@ -228,6 +236,7 @@ public void Dispose()
|
|||
public class SFAT
|
||||
{
|
||||
public const string Identifier = nameof(SFAT);
|
||||
|
||||
/// <summary>
|
||||
/// The required <see cref="Magic"/> matches the first 4 bytes of the file data.
|
||||
/// </summary>
|
||||
|
|
@ -240,6 +249,7 @@ public class SFAT
|
|||
public List<SFATEntry> Entries;
|
||||
|
||||
public SFAT() { }
|
||||
|
||||
public SFAT(BinaryReader br)
|
||||
{
|
||||
Magic = new string(br.ReadChars(4));
|
||||
|
|
@ -255,12 +265,14 @@ public SFAT(BinaryReader br)
|
|||
Entries.Add(new SFATEntry(br));
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// <see cref="SARC"/> File Name Table
|
||||
/// </summary>
|
||||
public class SFNT
|
||||
{
|
||||
public const string Identifier = nameof(SFNT);
|
||||
|
||||
/// <summary>
|
||||
/// The required <see cref="Magic"/> matches the first 4 bytes of the file data.
|
||||
/// </summary>
|
||||
|
|
@ -272,6 +284,7 @@ public class SFNT
|
|||
public uint StringOffset;
|
||||
|
||||
public SFNT() { }
|
||||
|
||||
public SFNT(BinaryReader br)
|
||||
{
|
||||
Magic = new string(br.ReadChars(4));
|
||||
|
|
@ -283,6 +296,7 @@ public SFNT(BinaryReader br)
|
|||
StringOffset = (uint)br.BaseStream.Position;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// <see cref="SARC"/> File Access Table (<see cref="SFAT"/>) Entry
|
||||
/// </summary>
|
||||
|
|
|
|||
|
|
@ -20,10 +20,12 @@ public SMDH(byte[] data)
|
|||
{
|
||||
Read(new BinaryReader(new MemoryStream(data)));
|
||||
}
|
||||
|
||||
public SMDH(string path)
|
||||
{
|
||||
Read(new BinaryReader(File.OpenRead(path)));
|
||||
}
|
||||
|
||||
public void Read(BinaryReader br)
|
||||
{
|
||||
// Check to see if the first 4 bytes (magic) is valid.
|
||||
|
|
@ -41,6 +43,7 @@ public void Read(BinaryReader br)
|
|||
SmallIcon = new SmallIcon(br);
|
||||
LargeIcon = new LargeIcon(br);
|
||||
}
|
||||
|
||||
public byte[] Write()
|
||||
{
|
||||
using (var ms = new MemoryStream())
|
||||
|
|
@ -65,12 +68,14 @@ public class ApplicationInfo
|
|||
public string ShortDescription; //0x80
|
||||
public string LongDescription; //0x100
|
||||
public string Publisher; //0x80
|
||||
|
||||
public ApplicationInfo(BinaryReader br)
|
||||
{
|
||||
ShortDescription = Encoding.Unicode.GetString(br.ReadBytes(0x80)).TrimEnd('\0');
|
||||
LongDescription = Encoding.Unicode.GetString(br.ReadBytes(0x100)).TrimEnd('\0');
|
||||
Publisher = Encoding.Unicode.GetString(br.ReadBytes(0x80)).TrimEnd('\0');
|
||||
}
|
||||
|
||||
public void Write(BinaryWriter bw)
|
||||
{
|
||||
bw.Write(Encoding.Unicode.GetBytes(ShortDescription.PadRight(0x80/2, '\0')));
|
||||
|
|
@ -101,6 +106,7 @@ public enum RegionLockoutFlags : uint
|
|||
Korea = 0x20,
|
||||
Taiwan = 0x40
|
||||
}
|
||||
|
||||
public enum AppSettingsFlags : uint
|
||||
{
|
||||
Visible = 1,
|
||||
|
|
@ -114,6 +120,7 @@ public enum AppSettingsFlags : uint
|
|||
RecordUsage = 256,
|
||||
DisableSDSaveBackup = 512
|
||||
}
|
||||
|
||||
public ApplicationSettings(BinaryReader br)
|
||||
{
|
||||
GameRatings = br.ReadBytes(0x10);
|
||||
|
|
@ -126,6 +133,7 @@ public ApplicationSettings(BinaryReader br)
|
|||
AnimationDefaultFrame = br.ReadSingle();
|
||||
StreetPassID = br.ReadUInt32();
|
||||
}
|
||||
|
||||
public void Write(BinaryWriter bw)
|
||||
{
|
||||
bw.Write(GameRatings, 0, 0x10);
|
||||
|
|
@ -144,15 +152,18 @@ public class SmallIcon // 24x24
|
|||
{
|
||||
public Bitmap Icon;
|
||||
public byte[] Bytes;
|
||||
|
||||
public SmallIcon(BinaryReader br)
|
||||
{
|
||||
Bytes = br.ReadBytes(0x480);
|
||||
Icon = ImageUtil.GetBitmap(Bytes, 24, 24);
|
||||
}
|
||||
|
||||
public void Write(BinaryWriter bw)
|
||||
{
|
||||
bw.Write(Bytes);
|
||||
}
|
||||
|
||||
public bool ChangeIcon(Bitmap img)
|
||||
{
|
||||
if (img.Width != Icon.Width || img.Height != Icon.Height) return false;
|
||||
|
|
@ -166,15 +177,18 @@ public class LargeIcon // 48x48
|
|||
{
|
||||
public Bitmap Icon;
|
||||
public byte[] Bytes;
|
||||
|
||||
public LargeIcon(BinaryReader br)
|
||||
{
|
||||
Bytes = br.ReadBytes(0x1200);
|
||||
Icon = ImageUtil.GetBitmap(Bytes, 48, 48);
|
||||
}
|
||||
|
||||
public void Write(BinaryWriter bw)
|
||||
{
|
||||
bw.Write(Bytes);
|
||||
}
|
||||
|
||||
public bool ChangeIcon(Bitmap img)
|
||||
{
|
||||
if (img.Width != Icon.Width || img.Height != Icon.Height) return false;
|
||||
|
|
|
|||
|
|
@ -28,6 +28,7 @@ public void Save()
|
|||
Console.WriteLine($"Wrote {Reference.Name} to {Reference.Reference}");
|
||||
}
|
||||
}
|
||||
|
||||
public class lzGARCFile
|
||||
{
|
||||
private readonly GARC.lzGARC GARC;
|
||||
|
|
@ -64,6 +65,7 @@ public byte[][] Files
|
|||
get { return GARC[file]; }
|
||||
set { GARC[file] = value; }
|
||||
}
|
||||
|
||||
public void Save()
|
||||
{
|
||||
File.WriteAllBytes(Path, GARC.Save());
|
||||
|
|
|
|||
|
|
@ -19,6 +19,7 @@ private GARCReference(int file, string name, bool lv = false)
|
|||
FileNumber = file;
|
||||
LanguageVariant = lv;
|
||||
}
|
||||
|
||||
public GARCReference getRelativeGARC(int offset, string name = "")
|
||||
{
|
||||
return new GARCReference(FileNumber + offset, name);
|
||||
|
|
@ -51,6 +52,7 @@ public GARCReference getRelativeGARC(int offset, string name = "")
|
|||
new GARCReference(072, "gametext", true),
|
||||
new GARCReference(080, "storytext", true),
|
||||
};
|
||||
|
||||
public static readonly GARCReference[] GARCReference_AO =
|
||||
{
|
||||
new GARCReference(013, "encdata"),
|
||||
|
|
@ -77,6 +79,7 @@ public GARCReference getRelativeGARC(int offset, string name = "")
|
|||
new GARCReference(071, "gametext", true),
|
||||
new GARCReference(079, "storytext", true),
|
||||
};
|
||||
|
||||
public static readonly GARCReference[] GARCReference_SMDEMO =
|
||||
{
|
||||
new GARCReference(011, "move"),
|
||||
|
|
@ -98,6 +101,7 @@ public GARCReference getRelativeGARC(int offset, string name = "")
|
|||
new GARCReference(030, "gametext", true),
|
||||
new GARCReference(040, "storytext", true),
|
||||
};
|
||||
|
||||
private static readonly GARCReference[] GARCReference_SM =
|
||||
{
|
||||
new GARCReference(011, "move"),
|
||||
|
|
@ -128,6 +132,7 @@ public GARCReference getRelativeGARC(int offset, string name = "")
|
|||
new GARCReference(030, "gametext", true),
|
||||
new GARCReference(040, "storytext", true),
|
||||
};
|
||||
|
||||
private static readonly GARCReference[] GARCReference_USUM =
|
||||
{
|
||||
new GARCReference(011, "move"),
|
||||
|
|
@ -163,14 +168,17 @@ public GARCReference getRelativeGARC(int offset, string name = "")
|
|||
new[] {
|
||||
new GARCReference(082, "encdata"),
|
||||
}).ToArray();
|
||||
|
||||
public static readonly GARCReference[] GARCReference_MN = GARCReference_SM.Concat(
|
||||
new[] {
|
||||
new GARCReference(083, "encdata"),
|
||||
}).ToArray();
|
||||
|
||||
public static readonly GARCReference[] GARCReference_US = GARCReference_USUM.Concat(
|
||||
new[] {
|
||||
new GARCReference(082, "encdata"),
|
||||
}).ToArray();
|
||||
|
||||
public static readonly GARCReference[] GARCReference_UM = GARCReference_USUM.Concat(
|
||||
new[] {
|
||||
new GARCReference(083, "encdata"),
|
||||
|
|
|
|||
|
|
@ -47,6 +47,7 @@ public static void backupFiles(this GameConfig config, bool overwrite = false)
|
|||
|
||||
File.WriteAllText(Path.Combine(gameBackup, "bakinfo.txt"), "Backup created from the following location:" + Environment.NewLine + gamePath.FullName);
|
||||
}
|
||||
|
||||
private static void backupExeFS(GameConfig config, bool overwrite, string bak_exefs)
|
||||
{
|
||||
var files = Directory.GetFiles(config.ExeFS);
|
||||
|
|
@ -57,12 +58,13 @@ private static void backupExeFS(GameConfig config, bool overwrite, string bak_ex
|
|||
File.Copy(f, dest);
|
||||
}
|
||||
}
|
||||
|
||||
private static void backupGARC(GameConfig config, bool overwrite, string bak_a)
|
||||
{
|
||||
var files = config.Files.Select(file => file.Name);
|
||||
foreach (var f in files)
|
||||
{
|
||||
string GARC = config.getGARCFileName(f);
|
||||
string GARC = config.GetGARCFileName(f);
|
||||
string name = f + $" ({GARC.Replace(Path.DirectorySeparatorChar.ToString(), "")})";
|
||||
string src = Path.Combine(config.RomFS, GARC);
|
||||
string dest = Path.Combine(bak_a, name);
|
||||
|
|
@ -70,6 +72,7 @@ private static void backupGARC(GameConfig config, bool overwrite, string bak_a)
|
|||
File.Copy(src, dest);
|
||||
}
|
||||
}
|
||||
|
||||
private static void backupDLL(GameConfig config, bool overwrite, string bak_dll)
|
||||
{
|
||||
string path = config.RomFS;
|
||||
|
|
@ -138,6 +141,7 @@ public static string[] restoreFiles(this GameConfig config)
|
|||
var result = string.Join(Environment.NewLine, info);
|
||||
return new[] {result};
|
||||
}
|
||||
|
||||
private static int restoreExeFS(GameConfig config, string bak_exefs)
|
||||
{
|
||||
int count = 0;
|
||||
|
|
@ -155,13 +159,14 @@ private static int restoreExeFS(GameConfig config, string bak_exefs)
|
|||
}
|
||||
return count;
|
||||
}
|
||||
|
||||
private static int restoreGARC(GameConfig config, string bak_a)
|
||||
{
|
||||
int count = 0;
|
||||
var files = config.Files.Select(file => file.Name);
|
||||
foreach (var f in files)
|
||||
{
|
||||
string GARC = config.getGARCFileName(f);
|
||||
string GARC = config.GetGARCFileName(f);
|
||||
string name = f + $" ({GARC.Replace(Path.DirectorySeparatorChar.ToString(), "")})";
|
||||
string src = Path.Combine(config.RomFS, GARC);
|
||||
string dest = Path.Combine(bak_a, name);
|
||||
|
|
@ -175,6 +180,7 @@ private static int restoreGARC(GameConfig config, string bak_a)
|
|||
}
|
||||
return count;
|
||||
}
|
||||
|
||||
private static int restoreDLL(GameConfig config, string bak_dll)
|
||||
{
|
||||
int count = 0;
|
||||
|
|
|
|||
|
|
@ -58,12 +58,13 @@ public GameConfig(int fileCount)
|
|||
|
||||
Version = game;
|
||||
}
|
||||
|
||||
public GameConfig(GameVersion game)
|
||||
{
|
||||
Version = game;
|
||||
}
|
||||
|
||||
private void getGameData(GameVersion game)
|
||||
private void GetGameData(GameVersion game)
|
||||
{
|
||||
switch (game)
|
||||
{
|
||||
|
|
@ -89,7 +90,7 @@ private void getGameData(GameVersion game)
|
|||
case GameVersion.MN:
|
||||
case GameVersion.SM:
|
||||
Files = GARCReference.GARCReference_SN;
|
||||
if (new FileInfo(Path.Combine(RomFS, getGARCFileName("encdata"))).Length == 0)
|
||||
if (new FileInfo(Path.Combine(RomFS, GetGARCFileName("encdata"))).Length == 0)
|
||||
Files = GARCReference.GARCReference_MN;
|
||||
Variables = TextVariableCode.VariableCodes_SM;
|
||||
GameText = TextReference.GameText_SM;
|
||||
|
|
@ -98,21 +99,23 @@ private void getGameData(GameVersion game)
|
|||
case GameVersion.UM:
|
||||
case GameVersion.USUM:
|
||||
Files = GARCReference.GARCReference_US;
|
||||
if (new FileInfo(Path.Combine(RomFS, getGARCFileName("encdata"))).Length == 0)
|
||||
if (new FileInfo(Path.Combine(RomFS, GetGARCFileName("encdata"))).Length == 0)
|
||||
Files = GARCReference.GARCReference_UM;
|
||||
Variables = TextVariableCode.VariableCodes_SM;
|
||||
GameText = TextReference.GameText_USUM;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
public void Initialize(string romFSpath, string exeFSpath, int lang)
|
||||
{
|
||||
RomFS = romFSpath;
|
||||
ExeFS = exeFSpath;
|
||||
Language = lang;
|
||||
getGameData(Version);
|
||||
GetGameData(Version);
|
||||
InitializeAll();
|
||||
}
|
||||
|
||||
public void InitializeAll()
|
||||
{
|
||||
InitializePersonal();
|
||||
|
|
@ -121,14 +124,16 @@ public void InitializeAll()
|
|||
InitializeMoves();
|
||||
InitializeGameInfo();
|
||||
}
|
||||
|
||||
public void InitializePersonal()
|
||||
{
|
||||
GARCPersonal = getGARCData("personal");
|
||||
GARCPersonal = GetGARCData("personal");
|
||||
Personal = new PersonalTable(GARCPersonal.getFile(GARCPersonal.FileCount - 1), Version);
|
||||
}
|
||||
|
||||
public void InitializeLearnset()
|
||||
{
|
||||
GARCLearnsets = getGARCData("levelup");
|
||||
GARCLearnsets = GetGARCData("levelup");
|
||||
switch (Generation)
|
||||
{
|
||||
case 6:
|
||||
|
|
@ -139,14 +144,16 @@ public void InitializeLearnset()
|
|||
break;
|
||||
}
|
||||
}
|
||||
|
||||
public void InitializeGameText()
|
||||
{
|
||||
GARCGameText = getGARCData("gametext");
|
||||
GARCGameText = GetGARCData("gametext");
|
||||
GameTextStrings = GARCGameText.Files.Select(file => new TextFile(this, file, RemapCharacters).Lines).ToArray();
|
||||
}
|
||||
|
||||
public void InitializeMoves()
|
||||
{
|
||||
GARCMoves = getGARCData("move");
|
||||
GARCMoves = GetGARCData("move");
|
||||
switch (Generation)
|
||||
{
|
||||
case 6:
|
||||
|
|
@ -160,27 +167,32 @@ public void InitializeMoves()
|
|||
break;
|
||||
}
|
||||
}
|
||||
|
||||
private void InitializeGameInfo()
|
||||
{
|
||||
Info = new GameInfo(this);
|
||||
}
|
||||
public lzGARCFile getlzGARCData(string file)
|
||||
|
||||
public lzGARCFile GetlzGARCData(string file)
|
||||
{
|
||||
var gr = getGARCReference(file);
|
||||
gr = gr.LanguageVariant ? gr.getRelativeGARC(Language, gr.Name) : gr;
|
||||
return new lzGARCFile(getlzGARC(file), gr, getGARCPath(file));
|
||||
return new lzGARCFile(GetlzGARC(file), gr, getGARCPath(file));
|
||||
}
|
||||
public GARCFile getGARCData(string file, bool skipRelative = false)
|
||||
|
||||
public GARCFile GetGARCData(string file, bool skipRelative = false)
|
||||
{
|
||||
var gr = getGARCReference(file);
|
||||
if (gr.LanguageVariant && !skipRelative)
|
||||
gr = gr.getRelativeGARC(Language, gr.Name);
|
||||
return getGARCByReference(gr);
|
||||
return GetGARCByReference(gr);
|
||||
}
|
||||
public GARCFile getGARCByReference(GARCReference gr)
|
||||
|
||||
public GARCFile GetGARCByReference(GARCReference gr)
|
||||
{
|
||||
return new GARCFile(getMemGARC(gr.Name), gr, getGARCPath(gr.Name));
|
||||
return new GARCFile(GetMemGARC(gr.Name), gr, getGARCPath(gr.Name));
|
||||
}
|
||||
|
||||
private string getGARCPath(string file)
|
||||
{
|
||||
var gr = getGARCReference(file);
|
||||
|
|
@ -189,11 +201,12 @@ private string getGARCPath(string file)
|
|||
return Path.Combine(RomFS, subloc);
|
||||
}
|
||||
|
||||
private GARC.MemGARC getMemGARC(string file)
|
||||
private GARC.MemGARC GetMemGARC(string file)
|
||||
{
|
||||
return new GARC.MemGARC(File.ReadAllBytes(getGARCPath(file)));
|
||||
}
|
||||
private GARC.lzGARC getlzGARC(string file)
|
||||
|
||||
private GARC.lzGARC GetlzGARC(string file)
|
||||
{
|
||||
return new GARC.lzGARC(File.ReadAllBytes(getGARCPath(file)));
|
||||
}
|
||||
|
|
@ -204,19 +217,21 @@ private GARC.lzGARC getlzGARC(string file)
|
|||
public TextVariableCode getVariableCode(string name) { return Variables?.FirstOrDefault(v => v.Name == name); }
|
||||
public TextVariableCode getVariableName(int value) { return Variables?.FirstOrDefault(v => v.Code == value); }
|
||||
|
||||
private TextReference getGameText(TextName name) { return GameText?.FirstOrDefault(f => f.Name == name); }
|
||||
private TextReference GetGameText(TextName name) { return GameText?.FirstOrDefault(f => f.Name == name); }
|
||||
public TextData getTextData(TextName file) => new TextData(getText(file));
|
||||
|
||||
public string[] getText(TextName file)
|
||||
{
|
||||
return (string[])GameTextStrings[getGameText(file).Index].Clone();
|
||||
return (string[])GameTextStrings[GetGameText(file).Index].Clone();
|
||||
}
|
||||
public bool setText(TextName file, string[] strings)
|
||||
|
||||
public bool SetText(TextName file, string[] strings)
|
||||
{
|
||||
GameTextStrings[getGameText(file).Index] = strings;
|
||||
GameTextStrings[GetGameText(file).Index] = strings;
|
||||
return true;
|
||||
}
|
||||
|
||||
public string getGARCFileName(string requestedGARC)
|
||||
public string GetGARCFileName(string requestedGARC)
|
||||
{
|
||||
var garc = getGARCReference(requestedGARC);
|
||||
if (garc.LanguageVariant)
|
||||
|
|
@ -239,6 +254,7 @@ public string getGARCFileName(string requestedGARC)
|
|||
public bool USUM => Version == GameVersion.USUM;
|
||||
public int MaxSpeciesID => XY || ORAS ? Legal.MaxSpeciesID_6 : SM ? Legal.MaxSpeciesID_7_SM : Legal.MaxSpeciesID_7_USUM;
|
||||
public int GARCVersion => XY || ORAS ? GARC.VER_4 : GARC.VER_6;
|
||||
|
||||
public int Generation
|
||||
{
|
||||
get
|
||||
|
|
|
|||
|
|
@ -11,6 +11,7 @@ public static uint Advance(uint seed, int ctr)
|
|||
}
|
||||
return seed;
|
||||
}
|
||||
|
||||
public static uint Reverse(uint seed, int ctr)
|
||||
{
|
||||
for (int i = 0; i < ctr; i++)
|
||||
|
|
|
|||
|
|
@ -9,27 +9,40 @@ public enum GameVersion
|
|||
|
||||
// Version IDs, also stored in PKM structure
|
||||
/*Gen3*/ S = 1, R = 2, E = 3, FR = 4, LG = 5, CXD = 15,
|
||||
|
||||
/*Gen4*/ D = 10, P = 11, Pt = 12, HG = 7, SS = 8,
|
||||
|
||||
/*Gen5*/ W = 20, B = 21, W2 = 22, B2 = 23,
|
||||
|
||||
/*Gen6*/ X = 24, Y = 25, AS = 26, OR = 27,
|
||||
|
||||
/*Gen7*/ SN = 30, MN = 31, US = 32, UM = 33,
|
||||
|
||||
/* GO */ GO = 34,
|
||||
/* VC1*/ RD = 35, GN = 36, BU = 37, YW = 38, // GN = Blue for international release
|
||||
|
||||
/* VC2*/ GD = 39, SV = 40, C = 41, // Crystal is unused
|
||||
|
||||
// Not actually stored values, but assigned as properties.
|
||||
|
||||
// Game Groupings (SaveFile type)
|
||||
/*SAV1*/ RB, RBY,
|
||||
|
||||
/*SAV2*/ GS, GSC,
|
||||
|
||||
/*SAV3*/ RS, FRLG, RSBOX, COLO, XD,
|
||||
|
||||
/*SAV4*/ DP, HGSS, BATREV,
|
||||
|
||||
/*SAV5*/ BW, B2W2,
|
||||
|
||||
/*SAV6*/ XY, ORASDEMO, ORAS,
|
||||
|
||||
/*SAV7*/ SM, USUM,
|
||||
|
||||
// Extra Game Groupings (Generation)
|
||||
Gen1, Gen2, Gen3, Gen4, Gen5, Gen6, Gen7,
|
||||
|
||||
GBCartEraOnly,
|
||||
Stadium,
|
||||
Stadium2,
|
||||
|
|
|
|||
|
|
@ -47,10 +47,12 @@ public class TextData
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
public class TextReference
|
||||
{
|
||||
public readonly int Index;
|
||||
public readonly TextName Name;
|
||||
|
||||
private TextReference(int index, TextName name)
|
||||
{
|
||||
Index = index;
|
||||
|
|
@ -76,6 +78,7 @@ private TextReference(int index, TextName name)
|
|||
new TextReference(131, TextName.SuperTrainerNames),
|
||||
new TextReference(141, TextName.OPowerFlavor),
|
||||
};
|
||||
|
||||
public static readonly TextReference[] GameText_AO =
|
||||
{
|
||||
new TextReference(005, TextName.Forms),
|
||||
|
|
@ -95,6 +98,7 @@ private TextReference(int index, TextName name)
|
|||
new TextReference(154, TextName.SuperTrainerNames),
|
||||
new TextReference(165, TextName.OPowerFlavor),
|
||||
};
|
||||
|
||||
public static readonly TextReference[] GameText_SMDEMO =
|
||||
{
|
||||
new TextReference(020, TextName.ItemFlavor),
|
||||
|
|
@ -111,6 +115,7 @@ private TextReference(int index, TextName name)
|
|||
new TextReference(054, TextName.MoveFlavor),
|
||||
new TextReference(055, TextName.MoveNames),
|
||||
};
|
||||
|
||||
public static readonly TextReference[] GameText_SM =
|
||||
{
|
||||
new TextReference(035, TextName.ItemFlavor),
|
||||
|
|
@ -132,6 +137,7 @@ private TextReference(int index, TextName name)
|
|||
new TextReference(119, TextName.PokedexEntry1),
|
||||
new TextReference(120, TextName.PokedexEntry2)
|
||||
};
|
||||
|
||||
public static readonly TextReference[] GameText_USUM =
|
||||
{
|
||||
new TextReference(039, TextName.ItemFlavor),
|
||||
|
|
|
|||
|
|
@ -4,6 +4,7 @@ public class TextVariableCode
|
|||
{
|
||||
public readonly int Code;
|
||||
public readonly string Name;
|
||||
|
||||
private TextVariableCode(int code, string name)
|
||||
{
|
||||
Code = code;
|
||||
|
|
@ -61,6 +62,7 @@ private TextVariableCode(int code, string name)
|
|||
new TextVariableCode(0x0207, "NUM8"),
|
||||
new TextVariableCode(0x0208, "NUM9"),
|
||||
};
|
||||
|
||||
public static readonly TextVariableCode[] VariableCodes_AO =
|
||||
{
|
||||
new TextVariableCode(0xFF00, "COLOR"),
|
||||
|
|
@ -112,6 +114,7 @@ private TextVariableCode(int code, string name)
|
|||
new TextVariableCode(0x0207, "NUM8"),
|
||||
new TextVariableCode(0x0208, "NUM9"),
|
||||
};
|
||||
|
||||
public static readonly TextVariableCode[] VariableCodes_SM =
|
||||
{
|
||||
new TextVariableCode(0xFF00, "COLOR"),
|
||||
|
|
|
|||
|
|
@ -26,10 +26,12 @@ public static Bitmap GetBitmap(this BXLIM bflim, bool crop = true)
|
|||
var data = bflim.GetImageData(crop);
|
||||
return GetBitmap(data, bflim.Footer.Width, bflim.Footer.Height);
|
||||
}
|
||||
|
||||
public static Bitmap GetBitmap(byte[] data, int width, int height, int stride = 4, PixelFormat format = PixelFormat.Format32bppArgb)
|
||||
{
|
||||
return new Bitmap(width, height, stride, format, Marshal.UnsafeAddrOfPinnedArrayElement(data, 0));
|
||||
}
|
||||
|
||||
public static byte[] GetPixelData(Bitmap bitmap)
|
||||
{
|
||||
var argbData = new byte[bitmap.Width * bitmap.Height * 4];
|
||||
|
|
@ -113,7 +115,7 @@ private static Bitmap DecodeETC(IXLIMHeader bclim, Bitmap img, byte[] textureDat
|
|||
{
|
||||
for (int j = 0; j < h; j++)
|
||||
{
|
||||
int k = (j + i * img.Height) * 4;
|
||||
int k = (j + (i * img.Height)) * 4;
|
||||
img.SetPixel(i, j, Color.FromArgb(imgData[k + 3], imgData[k], imgData[k + 1], imgData[k + 2]));
|
||||
}
|
||||
}
|
||||
|
|
@ -134,8 +136,8 @@ private static Bitmap DecodeETC(IXLIMHeader bclim, Bitmap img, byte[] textureDat
|
|||
for (int j = 0; j < 8; j++)
|
||||
// Treat every 8 vertical pixels as 1 pixel for purposes of calculation, add to offset later.
|
||||
{
|
||||
int x1 = (x + y / 8 * h) % img2.Width; // Reshift x
|
||||
int y1 = (x + y / 8 * h) / img2.Width * 8; // Reshift y
|
||||
int x1 = (x + (y / 8 * h)) % img2.Width; // Reshift x
|
||||
int y1 = (x + (y / 8 * h)) / img2.Width * 8; // Reshift y
|
||||
img2.SetPixel(x1, y1 + j, img.GetPixel(x, y + j)); // Reswizzle
|
||||
}
|
||||
}
|
||||
|
|
@ -153,7 +155,7 @@ private static Bitmap DecodeETC(IXLIMHeader bclim, Bitmap img, byte[] textureDat
|
|||
// Treat every 8 vertical pixels as 1 pixel for purposes of calculation, add to offset later.
|
||||
{
|
||||
int x1 = x % img2.Width; // Reshift x
|
||||
int y1 = (x + y / 8 * h) / img2.Width * 8; // Reshift y
|
||||
int y1 = (x + (y / 8 * h)) / img2.Width * 8; // Reshift y
|
||||
img2.SetPixel(x1, y1 + j, img.GetPixel(x, y + j)); // Reswizzle
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -12,6 +12,7 @@ public static partial class Legal
|
|||
257, 282, 303, 306, 308, 310, 354, 359, 380, 381,
|
||||
445, 448, 460
|
||||
};
|
||||
|
||||
public static readonly ushort[] Mega_ORAS = Mega_XY.Concat(new ushort[]
|
||||
{
|
||||
015, 018, 094,
|
||||
|
|
@ -21,6 +22,7 @@ public static partial class Legal
|
|||
531,
|
||||
719
|
||||
}).ToArray();
|
||||
|
||||
public static readonly int[] SpecialClasses_XY =
|
||||
{
|
||||
#region Classes
|
||||
|
|
@ -77,6 +79,7 @@ public static partial class Legal
|
|||
177, // Leader
|
||||
#endregion
|
||||
};
|
||||
|
||||
public static readonly int[] SpecialClasses_ORAS =
|
||||
{
|
||||
#region Classes
|
||||
|
|
@ -127,6 +130,7 @@ public static partial class Legal
|
|||
279, // Pokémon Trainer
|
||||
#endregion
|
||||
};
|
||||
|
||||
public static readonly int[] SpecialClasses_SM =
|
||||
{
|
||||
#region Classes
|
||||
|
|
@ -205,6 +209,7 @@ public static partial class Legal
|
|||
184, // Battle Legend
|
||||
#endregion
|
||||
};
|
||||
|
||||
public static readonly int[] SpecialClasses_USUM =
|
||||
{
|
||||
#region Classes
|
||||
|
|
@ -304,6 +309,7 @@ public static partial class Legal
|
|||
222, // Pokémon Trainer
|
||||
#endregion
|
||||
};
|
||||
|
||||
public static readonly int[] Model_XY =
|
||||
{
|
||||
#region Models
|
||||
|
|
@ -323,6 +329,7 @@ public static partial class Legal
|
|||
175, // Lysandre (Mega Ring)
|
||||
#endregion
|
||||
};
|
||||
|
||||
public static readonly int[] Model_AO =
|
||||
{
|
||||
#region Models
|
||||
|
|
@ -341,6 +348,7 @@ public static partial class Legal
|
|||
279, // May (Mega Bracelet)
|
||||
#endregion
|
||||
};
|
||||
|
||||
public static readonly int[] Z_Moves =
|
||||
{
|
||||
622, 623, 624, 625, 626, 627, 628, 629, 630, 631, 632, 633, 634, 635, 636, 637, 638, 639, 640, 641, 642, 643, 644, 645, 646, 647, 648, 649, 650, 651, 652, 653, 654, 655, 656, 657, 658,
|
||||
|
|
@ -353,6 +361,7 @@ public static partial class Legal
|
|||
222, 235, 236, 238, 239, 240, 241, 349, 350, 351, 352, 356, 357, 358, 359, 360, 392, 396, 398, 400, 401, 403, 405, 409, 410, 412, 413, 414, 415, 416, 417, 418, 419, 435, 438, 439, 440,
|
||||
441, 447, 448, 449, 450, 451, 452, 467, 477, 478, 479, 480, 481, 482, 483, 484
|
||||
};
|
||||
|
||||
public static readonly int[] ImportantTrainers_USUM =
|
||||
{
|
||||
012, 013, 014, 023, 052, 074, 075, 076, 077, 078, 079, 089, 090, 131, 132, 138, 144, 146, 149, 153, 154, 156, 159, 160, 215, 216, 217, 218, 219, 220, 221, 222, 235, 236, 238, 239, 240,
|
||||
|
|
@ -360,12 +369,14 @@ public static partial class Legal
|
|||
496, 497, 498, 499, 500, 501, 502, 503, 504, 505, 506, 507, 508, 541, 542, 543, 555, 556, 557, 558, 559, 560, 561, 562, 572, 573, 578, 580, 582, 583, 623, 630, 644, 645, 647, 648, 649,
|
||||
650, 651, 652
|
||||
};
|
||||
|
||||
public static readonly int[] BasicStarters_6 =
|
||||
{
|
||||
001, 004, 007, 010, 013, 016, 029, 032, 041, 043, 060, 063, 066, 069, 074, 081, 092, 111, 116, 137, 147, 152, 155, 158, 172, 173, 174, 175, 179, 187, 220, 239, 240, 246, 252, 255, 258,
|
||||
265, 270, 273, 280, 287, 293, 298, 304, 328, 355, 363, 371, 374, 387, 390, 393, 396, 403, 406, 440, 443, 495, 498, 501, 506, 519, 524, 532, 535, 540, 543, 551, 574, 577, 582, 599, 602,
|
||||
607, 610, 633, 650, 653, 656, 661, 664, 669, 679, 704
|
||||
};
|
||||
|
||||
public static readonly int[] BasicStarters_7 = BasicStarters_6.Concat(new int[]
|
||||
{
|
||||
722, 725, 728, 731, 736, 761, 782, 789
|
||||
|
|
@ -389,11 +400,13 @@ public static partial class Legal
|
|||
637, 638, 639, 640, 641, 642, 643, 644, 645, 646, 647, 648, 649, 652, 655, 658, 660, 663, 666, 668, 671, 673, 675, 676, 678, 681, 683, 685, 687, 689, 691, 693, 695, 697, 699, 700, 701,
|
||||
702, 703, 706, 707, 709, 711, 713, 715, 716, 717, 718, 719, 720, 721
|
||||
};
|
||||
|
||||
public static readonly int[] FinalEvolutions_SM = FinalEvolutions_6.Concat(new int[]
|
||||
{
|
||||
724, 727, 730, 733, 735, 738, 740, 741, 743, 745, 746, 748, 750, 752, 754, 756, 758, 760, 763, 764, 765, 766, 768, 770, 771, 773, 774, 775, 776, 777, 779, 780, 781, 784, 785, 786, 787,
|
||||
788, 791, 792, 793, 794, 795, 796, 797, 798, 799, 800, 801, 802
|
||||
}).ToArray();
|
||||
|
||||
public static readonly int[] FinalEvolutions_USUM = FinalEvolutions_SM.Concat(new int[]
|
||||
{
|
||||
804, 805, 806, 807
|
||||
|
|
@ -408,10 +421,12 @@ public static partial class Legal
|
|||
144, 145, 146, 150, 151, 243, 244, 245, 249, 250, 251, 377, 378, 379, 380, 381, 382, 383, 384, 385, 386, 480, 481, 482, 483, 484, 485, 486, 487, 488, 489, 490, 491, 492, 493, 494, 638,
|
||||
639, 640, 641, 642, 643, 644, 645, 646, 647, 648, 649, 716, 717, 718, 719, 720, 721
|
||||
};
|
||||
|
||||
public static readonly int[] Legendary_Mythical_SM = Legendary_Mythical_6.Concat(new int[]
|
||||
{
|
||||
773, 785, 786, 787, 788, 791, 792, 793, 794, 795, 796, 797, 798, 799, 800, 801, 802
|
||||
}).ToArray();
|
||||
|
||||
public static readonly int[] Legendary_Mythical_USUM = Legendary_Mythical_SM.Concat(new int[]
|
||||
{
|
||||
804, 805, 806, 807
|
||||
|
|
@ -428,6 +443,7 @@ public static partial class Legal
|
|||
746, // Wishiwashi
|
||||
778, // Mimikyu
|
||||
};
|
||||
|
||||
public static readonly HashSet<int> BattleMegas = new HashSet<int>
|
||||
{
|
||||
// XY
|
||||
|
|
@ -447,6 +463,7 @@ public static partial class Legal
|
|||
// USUM
|
||||
800, // Ultra Necrozma
|
||||
};
|
||||
|
||||
public static readonly HashSet<int> BattlePrimals = new HashSet<int> { 382, 383 };
|
||||
public static HashSet<int> BattleExclusiveForms = new HashSet<int>(BattleForms.Concat(BattleMegas.Concat(BattlePrimals)));
|
||||
}
|
||||
|
|
|
|||
|
|
@ -228,6 +228,7 @@ public static partial class Legal
|
|||
#endregion
|
||||
|
||||
public static readonly int[] EggLocations6 = {60002, 30002};
|
||||
|
||||
public static readonly int[] ValidMet_XY =
|
||||
{
|
||||
006, 008, 009, 010, 012, 013, 014, 016, 017, 018, 020, 021, 022, 024, 026, 028, 029, 030, 032, 034, 035, 036,
|
||||
|
|
@ -236,6 +237,7 @@ public static partial class Legal
|
|||
100, 101, 102, 103, 104, 106, 108, 110, 112, 114, 116, 118, 120, 122, 124, 126, 128, 130, 132, 134, 135, 136,
|
||||
138, 140, 142, 144, 146, 148, 150, 152, 154, 156, 158, 160, 162, 164, 166, 168
|
||||
};
|
||||
|
||||
public static readonly int[] ValidMet_AO =
|
||||
{
|
||||
170, 172, 174, 176, 178, 180, 182, 184, 186, 188, 190, 192, 194, 196, 198,
|
||||
|
|
@ -244,6 +246,7 @@ public static partial class Legal
|
|||
288, 290, 292, 294, 296, 298, 300, 302, 304, 306, 308, 310, 312, 314, 316, 318, 320, 322, 324, 326, 328, 330,
|
||||
332, 334, 336, 338, 340, 342, 344, 346, 348, 350, 352, 354
|
||||
};
|
||||
|
||||
public static readonly int[] FriendSafari =
|
||||
{
|
||||
190, 206, 216, 506, 294, 352, 531, 572, 113, 132, 133, 235,
|
||||
|
|
@ -265,6 +268,7 @@ public static partial class Legal
|
|||
082, 303, 597, 205, 227, 375, 600, 437, 530, 707,
|
||||
098, 224, 400, 515, 008, 130, 195, 419, 061, 184, 657
|
||||
};
|
||||
|
||||
public static readonly int[] CosplayPikachuMoves = { 309, 556, 577, 604, 560, 0 };
|
||||
public static readonly int[] WildPokeballs6 = { 0x01, 0x02, 0x03, 0x04, 0x06, 0x07, 0x08, 0x09, 0x0A, 0x0B, 0x0C, 0x0D, 0x0E, 0x0F };
|
||||
|
||||
|
|
@ -291,6 +295,7 @@ public static partial class Legal
|
|||
|
||||
313, // Via Illumise
|
||||
};
|
||||
|
||||
public static readonly int[] Inherit_Safari =
|
||||
{
|
||||
016, 019, 020, 021, 022, 023, 024, 025, 027, 029, 035, 039, 041,
|
||||
|
|
@ -314,6 +319,7 @@ public static partial class Legal
|
|||
439, // Via Mr. Mime
|
||||
440, // Via Chansey
|
||||
};
|
||||
|
||||
public static readonly int[] Inherit_Dream =
|
||||
{
|
||||
010, 013, 016, 019, 021, 023, 027, 029, 037, 041, 043, 046, 048, 050, 052, 054, 056, 058, 060, 063, 066, 069,
|
||||
|
|
@ -343,6 +349,7 @@ public static partial class Legal
|
|||
// Via Incense Breeding
|
||||
298, 360, 406, 433, 438, 439, 440, 446, 458,
|
||||
};
|
||||
|
||||
public static readonly int[] Ban_DreamHidden =
|
||||
{
|
||||
311, // Plusle
|
||||
|
|
@ -354,6 +361,7 @@ public static partial class Legal
|
|||
356, // Dusclops
|
||||
477, // Dusknoir
|
||||
};
|
||||
|
||||
public static readonly int[] Ban_Gen3Ball =
|
||||
{
|
||||
252, 255, 258, //1 - Treeko, Torchic, Mudkip
|
||||
|
|
@ -367,6 +375,7 @@ public static partial class Legal
|
|||
497, 500, 503, //3
|
||||
566, 567, 696, 697, 698, 699 // Fossil Only obtain
|
||||
};
|
||||
|
||||
public static readonly int[] Ban_Gen3BallHidden =
|
||||
{
|
||||
// can have HA and can be in gen 3 ball as eggs but can not at same time.
|
||||
|
|
@ -382,6 +391,7 @@ public static partial class Legal
|
|||
710 + (3 << 11), //Pumpkaboo-Super
|
||||
711 + (3 << 11), //Gourgeist-Super
|
||||
};
|
||||
|
||||
public static readonly int[] Ban_Gen4Ball_6 =
|
||||
{
|
||||
152, 155, 158, //1 - Chikorita, Cyndaquil, Totodile
|
||||
|
|
@ -414,6 +424,7 @@ public static partial class Legal
|
|||
68, // {0} soared through the sky with {1} and went to many different places. {4} that {3}.
|
||||
69, // {1} asked {0} to dive. Down it went, deep into the ocean, to explore the bottom of the sea. {4} that {3}.
|
||||
};
|
||||
|
||||
public static readonly int[] Memory_NotAO =
|
||||
{
|
||||
11, // {0} went clothes shopping with {1}. {4} that {3}.
|
||||
|
|
@ -423,6 +434,7 @@ public static partial class Legal
|
|||
57, // {0} went to a nice restaurant with {1} and ate until it got totally full. {4} that {3}.
|
||||
62, // {0} saw itself in a mirror in a mirror cave that it went to with {1}. {4} that {3}.
|
||||
};
|
||||
|
||||
public static readonly int[][] MoveSpecificMemories =
|
||||
{
|
||||
new[] {
|
||||
|
|
@ -436,6 +448,7 @@ public static partial class Legal
|
|||
},
|
||||
new[] { 57, 19, 70, 15, 249, 127, 291}, // Move IDs
|
||||
};
|
||||
|
||||
public static readonly int[][] LocationsWithPKCenter =
|
||||
{
|
||||
new[] {
|
||||
|
|
@ -474,6 +487,7 @@ public static partial class Legal
|
|||
},
|
||||
new[] {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1}, // Region matching
|
||||
};
|
||||
|
||||
public static readonly HashSet<int> MemoryGeneral = new HashSet<int> { 1, 2, 3, 4, 19, 24, 31, 32, 33, 35, 36, 37, 38, 39, 42, 52, 59 };
|
||||
public static readonly HashSet<int> MemorySpecific = new HashSet<int> { 6 };
|
||||
public static readonly HashSet<int> MemoryMove = new HashSet<int> { 12, 16, 48, 49 };
|
||||
|
|
@ -498,6 +512,7 @@ public static partial class Legal
|
|||
05, 10, 05, 05, 15, 10, 05, 05, 05, 10, 10, 10, 10, 20, 25, 10, 20, 30, 25, 20, 20, 15, 20, 15, 20, 20, 10, 10, 10, 10, 10, 20, 10, 30, 15, 10, 10, 10, 20, 20, 05, 05, 05, 20, 10, 10, 20, 15, 20, 20,
|
||||
10, 20, 30, 10, 10, 40, 40, 30, 20, 40, 20, 20, 10, 10, 10, 10, 05, 10, 10, 05, 05,
|
||||
};
|
||||
|
||||
public static readonly int[] UnreleasedItems_6 =
|
||||
{
|
||||
005, // Safari Ball
|
||||
|
|
@ -536,6 +551,7 @@ public static partial class Legal
|
|||
590, // Relic Crown
|
||||
715, // Fairy Gem
|
||||
};
|
||||
|
||||
public static readonly bool[] ReleasedHeldItems_6 = Enumerable.Range(0, MaxItemID_6_AO+1).Select(i => HeldItem_AO.Contains((ushort)i) && !UnreleasedItems_6.Contains(i)).ToArray();
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -69,14 +69,17 @@ public static partial class Legal
|
|||
761, 762, 763, 764, 767, 768, 769, 770, 795, 796, 844, 849, 853, 854, 855, 856, 879, 880, 881, 882,
|
||||
883, 884, 904, 905, 906, 907, 908, 909, 910, 911, 912, 913, 914, 915, 916, 917, 918, 919, 920,
|
||||
};
|
||||
|
||||
internal static readonly ushort[] Pouch_Ball_SM = { // 08
|
||||
1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 492, 493, 494, 495, 496, 497, 498, 576,
|
||||
851
|
||||
};
|
||||
|
||||
internal static readonly ushort[] Pouch_Battle_SM = { // 16
|
||||
55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 577,
|
||||
846,
|
||||
};
|
||||
|
||||
internal static readonly ushort[] Pouch_Items_SM = Pouch_Regular_SM.Concat(Pouch_Ball_SM).Concat(Pouch_Battle_SM).ToArray();
|
||||
|
||||
internal static readonly ushort[] Pouch_Key_SM = {
|
||||
|
|
@ -84,6 +87,7 @@ public static partial class Legal
|
|||
705, 706, 765, 773, 797,
|
||||
841, 842, 843, 845, 847, 850, 857, 858, 860,
|
||||
};
|
||||
|
||||
internal static readonly ushort[] Pouch_TMHM_SM = { // 02
|
||||
328, 329, 330, 331, 332, 333, 334, 335, 336, 337, 338, 339, 340, 341, 342, 343, 344, 345,
|
||||
346, 347, 348, 349, 350, 351, 352, 353, 354, 355, 356, 357, 358, 359, 360, 361, 362, 363,
|
||||
|
|
@ -92,29 +96,37 @@ public static partial class Legal
|
|||
400, 401, 402, 403, 404, 405, 406, 407, 408, 409, 410, 411, 412, 413, 414, 415, 416, 417,
|
||||
418, 419, 618, 619, 620, 690, 691, 692, 693, 694,
|
||||
};
|
||||
|
||||
internal static readonly ushort[] Pouch_Medicine_SM = { // 32
|
||||
17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 65, 66, 67, 134,
|
||||
504, 565, 566, 567, 568, 569, 570, 591, 645, 708, 709,
|
||||
852,
|
||||
};
|
||||
|
||||
internal static readonly ushort[] Pouch_Berries_SM = {
|
||||
149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159, 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, 173, 174, 175, 176, 177, 178, 179, 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, 190, 191, 192, 193, 194, 195, 196, 197, 198, 199, 200, 201, 202, 203, 204, 205, 206, 207, 208, 209, 210, 211, 212,
|
||||
686, 687, 688,
|
||||
};
|
||||
|
||||
internal static readonly ushort[] Pouch_ZCrystal_SM = { // Bead
|
||||
807, 808, 809, 810, 811, 812, 813, 814, 815, 816, 817, 818, 819, 820, 821, 822, 823, 824, 825, 826, 827, 828, 829, 830, 831, 832, 833, 834, 835,
|
||||
};
|
||||
|
||||
internal static readonly ushort[] Pouch_ZCrystalHeld_SM = { // Piece
|
||||
776, 777, 778, 779, 780, 781, 782, 783, 784, 785, 786, 787, 788, 789, 790, 791, 792, 793, 794, 798, 799, 800, 801, 802, 803, 804, 805, 806, 836
|
||||
};
|
||||
|
||||
internal static readonly ushort[] Pouch_ZCrystal_USUM = { // Bead
|
||||
927, 928, 929, 930, 931, 932
|
||||
};
|
||||
|
||||
internal static readonly ushort[] Pouch_ZCrystalHeld_USUM = { // Piece
|
||||
921, 922, 923, 924, 925, 926
|
||||
};
|
||||
|
||||
internal static readonly ushort[] HeldItems_SM = new ushort[1].Concat(Pouch_Items_SM).Concat(Pouch_Berries_SM).Concat(Pouch_Medicine_SM).Concat(Pouch_ZCrystalHeld_SM).ToArray();
|
||||
internal static readonly ushort[] HeldItems_USUM = new ushort[1].Concat(HeldItems_SM).Concat(Pouch_ZCrystalHeld_USUM).ToArray();
|
||||
|
||||
internal static readonly int[] AlolanOriginForms =
|
||||
{
|
||||
019, // Rattata
|
||||
|
|
@ -220,6 +232,7 @@ public static partial class Legal
|
|||
105, // Marowak (Normal, Alolan, Totem)
|
||||
778, // Mimikyu (Normal, Busted, Totem, Totem_Busted)
|
||||
};
|
||||
|
||||
public static readonly HashSet<int> Totem_SM = new HashSet<int>
|
||||
{
|
||||
020, // Raticate
|
||||
|
|
@ -231,6 +244,7 @@ public static partial class Legal
|
|||
778, // Mimikyu
|
||||
784, // Kommo-o
|
||||
};
|
||||
|
||||
public static readonly HashSet<int> Totem_USUM = new HashSet<int>
|
||||
{
|
||||
020, // Raticate
|
||||
|
|
|
|||
|
|
@ -12,6 +12,7 @@ public class EggMoveRandomizer : IRandomizer
|
|||
private readonly MoveRandomizer moverand;
|
||||
private readonly GameConfig Config;
|
||||
private readonly EggMoves[] Sets;
|
||||
|
||||
public EggMoveRandomizer(GameConfig config, EggMoves[] sets)
|
||||
{
|
||||
Config = config;
|
||||
|
|
|
|||
|
|
@ -54,7 +54,6 @@ private void Trade(EvolutionSet evo, int i)
|
|||
v.Argument = 30;
|
||||
v.Method = 4; // trade -> level up
|
||||
}
|
||||
|
||||
else if (Config.Generation == 7 && v.Method == 5)
|
||||
{
|
||||
v.Level = 30;
|
||||
|
|
|
|||
|
|
@ -6,6 +6,7 @@ namespace pk3DS.Core.Randomizers
|
|||
public class FormRandomizer
|
||||
{
|
||||
private readonly GameConfig Game;
|
||||
|
||||
public FormRandomizer(GameConfig game)
|
||||
{
|
||||
Game = game;
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
namespace pk3DS.Core.Randomizers
|
||||
{
|
||||
/// <summary> Cyclical Shuffled Randomizer </summary>
|
||||
/// <remarks>
|
||||
/// <remarks>
|
||||
/// The shuffled list is iterated over, and reshuffled when exhausted.
|
||||
/// The list does not repeat values until the list is exhausted.
|
||||
/// </remarks>
|
||||
|
|
|
|||
|
|
@ -48,8 +48,10 @@ private void Randomize(Learnset set, int index)
|
|||
int[] levels = GetRandomLevels(set, moves.Length);
|
||||
|
||||
if (Learn4Level1)
|
||||
{
|
||||
for (int i = 0; i < Math.Min(4, levels.Length); ++i)
|
||||
levels[i] = 1;
|
||||
}
|
||||
|
||||
set.Moves = moves;
|
||||
set.Levels = levels;
|
||||
|
|
|
|||
|
|
@ -41,6 +41,7 @@ public void Execute()
|
|||
private int loopctr = 0;
|
||||
|
||||
public int[] GetRandomLearnset(int index, int movecount) => GetRandomLearnset(SpeciesStat[index].Types, movecount);
|
||||
|
||||
public int[] GetRandomLearnset(int[] Types, int movecount)
|
||||
{
|
||||
var oldSTABCount = rSTABCount;
|
||||
|
|
@ -49,7 +50,9 @@ public int[] GetRandomLearnset(int[] Types, int movecount)
|
|||
rSTABCount = oldSTABCount;
|
||||
return moves;
|
||||
}
|
||||
|
||||
public int[] GetRandomMoveset(int index, int movecount = 4) => GetRandomMoveset(SpeciesStat[index].Types, movecount);
|
||||
|
||||
public int[] GetRandomMoveset(int[] Types, int movecount = 4)
|
||||
{
|
||||
loopctr = 0;
|
||||
|
|
@ -73,6 +76,7 @@ private int[] GetRandomMoves(int[] Types, int movecount = 4)
|
|||
moves[i] = RandMove.Next();
|
||||
return moves;
|
||||
}
|
||||
|
||||
private int GetRandomSTABMove(int[] types)
|
||||
{
|
||||
int move;
|
||||
|
|
@ -80,6 +84,7 @@ private int GetRandomSTABMove(int[] types)
|
|||
while (!types.Contains(MoveData[move].Type));
|
||||
return move;
|
||||
}
|
||||
|
||||
private bool IsMovesetMeetingRequirements(int[] moves, int count)
|
||||
{
|
||||
if (rDMG && rDMGCount > moves.Count(move => MoveData[move].Category != 0))
|
||||
|
|
@ -116,13 +121,17 @@ public void ReorderMovesPower(IList<int> moves)
|
|||
141, // Leech Life
|
||||
|
||||
};
|
||||
|
||||
private static readonly GenericRandomizer first = new GenericRandomizer(firstMoves);
|
||||
|
||||
public int GetRandomFirstMoveAny()
|
||||
{
|
||||
first.Reset();
|
||||
return first.Next();
|
||||
}
|
||||
|
||||
public int GetRandomFirstMove(int index) => GetRandomFirstMove(SpeciesStat[index].Types);
|
||||
|
||||
public int GetRandomFirstMove(int[] types)
|
||||
{
|
||||
first.Reset();
|
||||
|
|
|
|||
|
|
@ -99,6 +99,7 @@ private void RandomizeTMHM(PersonalInfo z)
|
|||
|
||||
z.TMHM = tms;
|
||||
}
|
||||
|
||||
private void RandomizeTypeTutors(PersonalInfo z, int index)
|
||||
{
|
||||
var t = z.TypeTutors;
|
||||
|
|
@ -111,6 +112,7 @@ private void RandomizeTypeTutors(PersonalInfo z, int index)
|
|||
|
||||
z.TypeTutors = t;
|
||||
}
|
||||
|
||||
private void RandomizeSpecialTutors(PersonalInfo z)
|
||||
{
|
||||
var tutors = z.SpecialTutors;
|
||||
|
|
@ -119,6 +121,7 @@ private void RandomizeSpecialTutors(PersonalInfo z)
|
|||
tutor[i] = rnd.Next(0, 100) < LearnMoveTutorPercent;
|
||||
z.SpecialTutors = tutors;
|
||||
}
|
||||
|
||||
private void RandomizeAbilities(PersonalInfo z)
|
||||
{
|
||||
var abils = z.Abilities;
|
||||
|
|
@ -126,6 +129,7 @@ private void RandomizeAbilities(PersonalInfo z)
|
|||
abils[i] = GetRandomAbility();
|
||||
z.Abilities = abils;
|
||||
}
|
||||
|
||||
private void RandomizeEggGroups(PersonalInfo z)
|
||||
{
|
||||
var egg = z.EggGroups;
|
||||
|
|
@ -133,6 +137,7 @@ private void RandomizeEggGroups(PersonalInfo z)
|
|||
egg[1] = rnd.Next(0, 100) < SameEggGroupChance ? egg[0] : GetRandomEggGroup();
|
||||
z.EggGroups = egg;
|
||||
}
|
||||
|
||||
private void RandomizeHeldItems(PersonalInfo z)
|
||||
{
|
||||
var item = z.Items;
|
||||
|
|
@ -140,6 +145,7 @@ private void RandomizeHeldItems(PersonalInfo z)
|
|||
item[j] = GetRandomHeldItem();
|
||||
z.Items = item;
|
||||
}
|
||||
|
||||
private void RandomizeTypes(PersonalInfo z)
|
||||
{
|
||||
var t = z.Types;
|
||||
|
|
@ -147,6 +153,7 @@ private void RandomizeTypes(PersonalInfo z)
|
|||
t[1] = rnd.Next(0, 100) < SameTypeChance ? t[0] : GetRandomType();
|
||||
z.Types = t;
|
||||
}
|
||||
|
||||
private void RandomizeStats(PersonalInfo z)
|
||||
{
|
||||
// Fiddle with Base Stats, don't muck with Shedinja.
|
||||
|
|
@ -157,12 +164,13 @@ private void RandomizeStats(PersonalInfo z)
|
|||
{
|
||||
if (!StatsToRandomize[i])
|
||||
continue;
|
||||
var l = Math.Min(255, (int) (stats[i] * (1 - StatDeviation / 100)));
|
||||
var h = Math.Min(255, (int) (stats[i] * (1 + StatDeviation / 100)));
|
||||
var l = Math.Min(255, (int) (stats[i] * (1 - (StatDeviation / 100))));
|
||||
var h = Math.Min(255, (int) (stats[i] * (1 + (StatDeviation / 100))));
|
||||
stats[i] = Math.Max(5, rnd.Next(l, h));
|
||||
}
|
||||
z.Stats = stats;
|
||||
}
|
||||
|
||||
private void RandomShuffledStats(PersonalInfo z)
|
||||
{
|
||||
// Fiddle with Base Stats, don't muck with Shedinja.
|
||||
|
|
@ -178,12 +186,13 @@ private void RandomShuffledStats(PersonalInfo z)
|
|||
private int GetRandomEggGroup() => rnd.Next(1, eggGroupCount);
|
||||
private int GetRandomHeldItem() => Game.Info.HeldItems[rnd.Next(1, Game.Info.HeldItems.Length)];
|
||||
private readonly IList<int> BannedAbilities = new int[0];
|
||||
|
||||
private int GetRandomAbility()
|
||||
{
|
||||
const int WonderGuard = 25;
|
||||
int newabil;
|
||||
do newabil = rnd.Next(1, Game.Info.MaxAbilityID + 1);
|
||||
while (newabil == WonderGuard && !AllowWonderGuard || BannedAbilities.Contains(newabil));
|
||||
while ((newabil == WonderGuard && !AllowWonderGuard) || BannedAbilities.Contains(newabil));
|
||||
return newabil;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -73,6 +73,7 @@ public int GetRandomSpeciesType(int oldSpecies, int type)
|
|||
loopctr++;
|
||||
return newSpecies;
|
||||
}
|
||||
|
||||
private bool GetIsTypeMatch(int newSpecies, int type) => type == -1 || SpeciesStat[newSpecies].Types.Any(z => z == type) || loopctr > 9000;
|
||||
|
||||
public int GetRandomSpecies(int oldSpecies)
|
||||
|
|
@ -100,6 +101,7 @@ private bool IsSpeciesReplacementBad(int newSpecies, int currentSpecies)
|
|||
{
|
||||
return newSpecies == currentSpecies && loopctr < MaxSpeciesID * 10;
|
||||
}
|
||||
|
||||
private bool IsSpeciesEXPRateBad(PersonalInfo oldpkm, PersonalInfo pkm)
|
||||
{
|
||||
if (!rEXP)
|
||||
|
|
@ -107,6 +109,7 @@ private bool IsSpeciesEXPRateBad(PersonalInfo oldpkm, PersonalInfo pkm)
|
|||
// Experience Growth Rate matches
|
||||
return oldpkm.EXPGrowth != pkm.EXPGrowth;
|
||||
}
|
||||
|
||||
private bool IsSpeciesTypeBad(PersonalInfo oldpkm, PersonalInfo pkm)
|
||||
{
|
||||
if (!rType)
|
||||
|
|
@ -114,6 +117,7 @@ private bool IsSpeciesTypeBad(PersonalInfo oldpkm, PersonalInfo pkm)
|
|||
// Type has to be somewhat similar
|
||||
return !oldpkm.Types.Any(z => pkm.Types.Contains(z));
|
||||
}
|
||||
|
||||
private bool IsSpeciesBSTBad(PersonalInfo oldpkm, PersonalInfo pkm)
|
||||
{
|
||||
if (!rBST)
|
||||
|
|
@ -138,6 +142,7 @@ private int[] InitializeSpeciesList()
|
|||
|
||||
return list.Count == 0 ? RandomSpeciesList : list.ToArray();
|
||||
}
|
||||
|
||||
private void AddGen1Species(List<int> list)
|
||||
{
|
||||
list.AddRange(Enumerable.Range(1, 143)); // Bulbasaur - Snorlax
|
||||
|
|
@ -150,6 +155,7 @@ private void AddGen1Species(List<int> list)
|
|||
}
|
||||
if (E) list.Add(151); // Mew
|
||||
}
|
||||
|
||||
private void AddGen2Species(List<int> list)
|
||||
{
|
||||
list.AddRange(Enumerable.Range(152, 91)); // Chikorita - Blissey
|
||||
|
|
@ -162,6 +168,7 @@ private void AddGen2Species(List<int> list)
|
|||
}
|
||||
if (E) list.Add(251); // Celebi
|
||||
}
|
||||
|
||||
private void AddGen3Species(List<int> list)
|
||||
{
|
||||
list.AddRange(Enumerable.Range(252, 40)); // Treecko - Ninjask
|
||||
|
|
@ -170,24 +177,28 @@ private void AddGen3Species(List<int> list)
|
|||
if (L) list.AddRange(Enumerable.Range(377, 8)); // Regi, Lati, Mascot
|
||||
if (E) list.AddRange(Enumerable.Range(385, 2)); // Jirachi/Deoxys
|
||||
}
|
||||
|
||||
private void AddGen4Species(List<int> list)
|
||||
{
|
||||
list.AddRange(Enumerable.Range(387, 93)); // Turtwig - Rotom
|
||||
if (L) list.AddRange(Enumerable.Range(480, 9)); // Sinnoh Legends
|
||||
if (E) list.AddRange(Enumerable.Range(489, 5)); // Phione, Manaphy, Darkrai, Shaymin, Arceus
|
||||
}
|
||||
|
||||
private void AddGen5Species(List<int> list)
|
||||
{
|
||||
list.AddRange(Enumerable.Range(495, 143)); // Snivy - Volcarona
|
||||
if (L) list.AddRange(Enumerable.Range(638, 9)); // Unova Legends
|
||||
if (E) list.Add(494); list.AddRange(Enumerable.Range(647, 3)); // Victini, Keldeo, Meloetta, Genesect
|
||||
}
|
||||
|
||||
private void AddGen6Species(List<int> list)
|
||||
{
|
||||
list.AddRange(Enumerable.Range(650, 66)); // Chespin - Noivern
|
||||
if (L) list.AddRange(Enumerable.Range(716, 3)); // Kalos Legends
|
||||
if (E) list.AddRange(Enumerable.Range(719, 3)); // Diancie, Hoopa, Volcanion
|
||||
}
|
||||
|
||||
private void AddGen7Species(List<int> list)
|
||||
{
|
||||
list.AddRange(Enumerable.Range(722, 50)); // Rowlet - Pyukumuku
|
||||
|
|
@ -208,6 +219,7 @@ private void AddGen7Species(List<int> list)
|
|||
}
|
||||
|
||||
public int[] RandomSpeciesList => Enumerable.Range(1, MaxSpeciesID).ToArray();
|
||||
|
||||
private bool GetNewSpecies(int currentSpecies, PersonalInfo oldpkm, out int newSpecies)
|
||||
{
|
||||
newSpecies = RandSpec.Next();
|
||||
|
|
|
|||
|
|
@ -11,6 +11,7 @@ public static class StructConverter
|
|||
try { return (T)Marshal.PtrToStructure(handle.AddrOfPinnedObject(), typeof(T)); }
|
||||
finally { handle.Free(); }
|
||||
}
|
||||
|
||||
public static byte[] ToBytes<T>(this T obj) where T : struct
|
||||
{
|
||||
int size = Marshal.SizeOf(obj);
|
||||
|
|
|
|||
|
|
@ -10,6 +10,7 @@ public abstract class EggMoves
|
|||
|
||||
public abstract byte[] Write();
|
||||
}
|
||||
|
||||
public class EggMoves6 : EggMoves
|
||||
{
|
||||
public EggMoves6(byte[] data)
|
||||
|
|
@ -23,6 +24,7 @@ public EggMoves6(byte[] data)
|
|||
Moves[i] = br.ReadUInt16();
|
||||
}
|
||||
}
|
||||
|
||||
public static EggMoves[] getArray(byte[][] entries)
|
||||
{
|
||||
EggMoves[] data = new EggMoves[entries.Length];
|
||||
|
|
@ -30,6 +32,7 @@ public static EggMoves[] getArray(byte[][] entries)
|
|||
data[i] = new EggMoves6(entries[i]);
|
||||
return data;
|
||||
}
|
||||
|
||||
public override byte[] Write()
|
||||
{
|
||||
Count = Moves.Length;
|
||||
|
|
@ -45,6 +48,7 @@ public override byte[] Write()
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
public class EggMoves7 : EggMoves
|
||||
{
|
||||
public EggMoves7(byte[] data)
|
||||
|
|
@ -60,6 +64,7 @@ public EggMoves7(byte[] data)
|
|||
Moves[i] = br.ReadUInt16();
|
||||
}
|
||||
}
|
||||
|
||||
public static EggMoves[] getArray(byte[][] entries)
|
||||
{
|
||||
EggMoves[] data = new EggMoves[entries.Length];
|
||||
|
|
@ -67,6 +72,7 @@ public static EggMoves[] getArray(byte[][] entries)
|
|||
data[i] = new EggMoves7(entries[i]);
|
||||
return data;
|
||||
}
|
||||
|
||||
public override byte[] Write()
|
||||
{
|
||||
Count = Moves.Length;
|
||||
|
|
|
|||
|
|
@ -31,7 +31,7 @@ public class EncounterGift6
|
|||
|
||||
public bool ShinyLock {
|
||||
get => (Shiny & 2) != 0;
|
||||
set => Shiny = (byte)(Shiny & ~2 | (value ? 2 : 0));
|
||||
set => Shiny = (byte)((Shiny & ~2) | (value ? 2 : 0));
|
||||
}
|
||||
|
||||
public EncounterGift6(byte[] data, bool oras)
|
||||
|
|
@ -72,6 +72,7 @@ public EncounterGift6(byte[] data, bool oras)
|
|||
uLast = br.ReadByte();
|
||||
}
|
||||
}
|
||||
|
||||
public byte[] Write()
|
||||
{
|
||||
using (MemoryStream ms = new MemoryStream())
|
||||
|
|
|
|||
|
|
@ -18,11 +18,13 @@ public byte Form
|
|||
get => Data[0x2];
|
||||
set => Data[0x2] = value;
|
||||
}
|
||||
|
||||
public byte Level
|
||||
{
|
||||
get => Data[0x3];
|
||||
set => Data[0x3] = value;
|
||||
}
|
||||
|
||||
public int HeldItem
|
||||
{
|
||||
get
|
||||
|
|
@ -41,33 +43,37 @@ public int HeldItem
|
|||
public bool Shiny
|
||||
{
|
||||
get => (Data[0x6] & 1) >> 1 == 1;
|
||||
set => Data[0x6] = (byte)(Data[0x6] & ~1 | (value ? 1 : 0));
|
||||
set => Data[0x6] = (byte)((Data[0x6] & ~1) | (value ? 1 : 0));
|
||||
}
|
||||
|
||||
public bool ShinyLock
|
||||
{
|
||||
get => (Data[0x6] & 2) >> 1 == 1;
|
||||
set => Data[0x6] = (byte)(Data[0x6] & ~2 | (value ? 2 : 0));
|
||||
set => Data[0x6] = (byte)((Data[0x6] & ~2) | (value ? 2 : 0));
|
||||
}
|
||||
|
||||
public int Gender
|
||||
{
|
||||
get => (Data[0x6] & 0xC) >> 2;
|
||||
set => Data[0x6] = (byte)(Data[0x6] & ~0xC | ((value & 3) << 2));
|
||||
set => Data[0x6] = (byte)((Data[0x6] & ~0xC) | ((value & 3) << 2));
|
||||
}
|
||||
|
||||
public int Ability
|
||||
{
|
||||
get => (Data[0x6] & 0x70) >> 4;
|
||||
set => Data[0x6] = (byte)(Data[0x6] & ~0x70 | ((value & 7) << 4));
|
||||
set => Data[0x6] = (byte)((Data[0x6] & ~0x70) | ((value & 7) << 4));
|
||||
}
|
||||
|
||||
public bool IV3
|
||||
{
|
||||
get => (Data[0x7] & 1) >> 0 == 1;
|
||||
set => Data[0x7] = (byte)(Data[0x7] & ~1 | (value ? 1 : 0));
|
||||
set => Data[0x7] = (byte)((Data[0x7] & ~1) | (value ? 1 : 0));
|
||||
}
|
||||
|
||||
public bool IV3_1
|
||||
{
|
||||
get => (Data[0x7] & 2) >> 1 == 1;
|
||||
set => Data[0x7] = (byte)(Data[0x7] & ~2 | (value ? 2 : 0));
|
||||
set => Data[0x7] = (byte)((Data[0x7] & ~2) | (value ? 2 : 0));
|
||||
}
|
||||
|
||||
public EncounterStatic6(byte[] data) => Data = (byte[])data.Clone();
|
||||
|
|
|
|||
|
|
@ -17,11 +17,13 @@ public abstract class EvolutionSet
|
|||
public EvolutionMethod[] PossibleEvolutions;
|
||||
public abstract byte[] Write();
|
||||
}
|
||||
|
||||
public class EvolutionSet6 : EvolutionSet
|
||||
{
|
||||
private const int ENTRY_SIZE = 6;
|
||||
private const int ENTRY_COUNT = 8;
|
||||
public const int SIZE = ENTRY_COUNT * ENTRY_SIZE;
|
||||
|
||||
public EvolutionSet6(byte[] data)
|
||||
{
|
||||
if (data.Length != SIZE) return;
|
||||
|
|
@ -43,6 +45,7 @@ public EvolutionSet6(byte[] data)
|
|||
// PossibleEvolutions[i / SIZE].Level = 0;
|
||||
}
|
||||
}
|
||||
|
||||
public override byte[] Write()
|
||||
{
|
||||
using (MemoryStream ms = new MemoryStream())
|
||||
|
|
@ -58,11 +61,13 @@ public override byte[] Write()
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
public class EvolutionSet7 : EvolutionSet
|
||||
{
|
||||
private const int ENTRY_SIZE = 8;
|
||||
private const int ENTRY_COUNT = 8;
|
||||
public const int SIZE = ENTRY_COUNT * ENTRY_SIZE;
|
||||
|
||||
public EvolutionSet7(byte[] data)
|
||||
{
|
||||
if (data.Length != SIZE) return;
|
||||
|
|
@ -79,6 +84,7 @@ public EvolutionSet7(byte[] data)
|
|||
};
|
||||
}
|
||||
}
|
||||
|
||||
public override byte[] Write()
|
||||
{
|
||||
using (MemoryStream ms = new MemoryStream())
|
||||
|
|
|
|||
|
|
@ -32,6 +32,7 @@ public struct Item
|
|||
|
||||
[Category(Battle), Description("Routine # to call when used; 0=unusable.")]
|
||||
public byte EffectBattle { get; set; } // Battle Type
|
||||
|
||||
public byte _0xC { get; set; } // 0 or 1
|
||||
public byte _0xD { get; set; } // Classification (0-3 Battle, 4 Balls, 5 Mail)
|
||||
public byte Consumable { get; set; }
|
||||
|
|
|
|||
|
|
@ -12,14 +12,16 @@ public class Trainer
|
|||
public ushort[] Choices;
|
||||
|
||||
public Trainer() { }
|
||||
|
||||
public Trainer(byte[] data)
|
||||
{
|
||||
Class = BitConverter.ToUInt16(data, 0);
|
||||
Count = BitConverter.ToUInt16(data, 2);
|
||||
Choices = new ushort[Count];
|
||||
for (int i = 0; i < Count; i++)
|
||||
Choices[i] = BitConverter.ToUInt16(data, 4 + 2 * i);
|
||||
Choices[i] = BitConverter.ToUInt16(data, 4 + (2 * i));
|
||||
}
|
||||
|
||||
public byte[] Write()
|
||||
{
|
||||
using (var ms = new MemoryStream())
|
||||
|
|
@ -33,6 +35,7 @@ public byte[] Write()
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
public class Pokemon
|
||||
{
|
||||
public ushort Species;
|
||||
|
|
@ -58,7 +61,7 @@ public Pokemon(byte[] data)
|
|||
{
|
||||
Species = BitConverter.ToUInt16(data, 0);
|
||||
for (int i = 0; i < 4; i++)
|
||||
Moves[i] = BitConverter.ToUInt16(data, 2 + 2*i);
|
||||
Moves[i] = BitConverter.ToUInt16(data, 2 + (2 * i));
|
||||
EV = data[0xA];
|
||||
for (int i = 0; i < 6; i++)
|
||||
EVs[i] = ((EV >> i) & 1) == 1;
|
||||
|
|
@ -66,6 +69,7 @@ public Pokemon(byte[] data)
|
|||
Item = BitConverter.ToUInt16(data, 0xC);
|
||||
Form = BitConverter.ToUInt16(data, 0xE);
|
||||
}
|
||||
|
||||
public byte[] Write()
|
||||
{
|
||||
using (var ms = new MemoryStream())
|
||||
|
|
|
|||
|
|
@ -5,6 +5,7 @@ namespace pk3DS.Core.Structures
|
|||
public class MegaEvolutions
|
||||
{
|
||||
public ushort[] Form, Method, Argument, u6;
|
||||
|
||||
public MegaEvolutions(byte[] data)
|
||||
{
|
||||
if (data.Length < 0x10 || data.Length % 8 != 0) return;
|
||||
|
|
@ -21,6 +22,7 @@ public MegaEvolutions(byte[] data)
|
|||
u6[i] = br.ReadUInt16();
|
||||
}
|
||||
}
|
||||
|
||||
public byte[] Write()
|
||||
{
|
||||
using (MemoryStream ms = new MemoryStream())
|
||||
|
|
|
|||
|
|
@ -17,6 +17,7 @@ public class trdata6
|
|||
public byte Money;
|
||||
public ushort Prize;
|
||||
public Pokemon[] Team;
|
||||
|
||||
public trdata6(byte[] trData, byte[] trPoke, bool ORAS)
|
||||
{
|
||||
using (BinaryReader br = new BinaryReader(new MemoryStream(trData)))
|
||||
|
|
@ -49,6 +50,7 @@ public trdata6(byte[] trData, byte[] trPoke, bool ORAS)
|
|||
Team[i] = new Pokemon(TeamData[i], Item, Moves);
|
||||
}
|
||||
}
|
||||
|
||||
public byte[] Write()
|
||||
{
|
||||
using (MemoryStream ms = new MemoryStream())
|
||||
|
|
@ -78,6 +80,7 @@ public byte[] Write()
|
|||
return ms.ToArray();
|
||||
}
|
||||
}
|
||||
|
||||
public byte[] WriteTeam()
|
||||
{
|
||||
return Team.Aggregate(new byte[0], (i, pkm) => i.Concat(pkm.Write(Item, Moves)).ToArray());
|
||||
|
|
@ -117,6 +120,7 @@ public Pokemon(byte[] data, bool HasItem, bool HasMoves)
|
|||
Moves[i] = br.ReadUInt16();
|
||||
}
|
||||
}
|
||||
|
||||
public byte[] Write(bool HasItem, bool HasMoves)
|
||||
{
|
||||
using (MemoryStream ms = new MemoryStream())
|
||||
|
|
|
|||
|
|
@ -6,60 +6,72 @@ public class EncounterGift7 : EncounterStatic
|
|||
{
|
||||
public const int SIZE = 0x14;
|
||||
public readonly byte[] Data;
|
||||
|
||||
public EncounterGift7(byte[] data)
|
||||
{
|
||||
Data = data;
|
||||
}
|
||||
|
||||
public override int Species
|
||||
{
|
||||
get => BitConverter.ToUInt16(Data, 0x0);
|
||||
set => BitConverter.GetBytes((ushort)value).CopyTo(Data, 0x0);
|
||||
}
|
||||
|
||||
public int Form
|
||||
{
|
||||
get => Data[0x2];
|
||||
set => Data[0x2] = (byte)value;
|
||||
}
|
||||
|
||||
public int Level
|
||||
{
|
||||
get => Data[0x3];
|
||||
set => Data[0x3] = (byte)value;
|
||||
}
|
||||
|
||||
public int Gender
|
||||
{
|
||||
get => Data[0x4] & 1;
|
||||
set => Data[0x4] = (byte)(value & 1);
|
||||
}
|
||||
|
||||
public bool ShinyLock
|
||||
{
|
||||
get => (Data[0x4] & 2) != 0;
|
||||
set => Data[0x4] = (byte)((Data[0x4] & ~2) | (value ? 2 : 0));
|
||||
}
|
||||
|
||||
public sbyte Ability
|
||||
{
|
||||
get => (sbyte)Data[0x6];
|
||||
set => Data[0x6] = (byte)value;
|
||||
}
|
||||
|
||||
public sbyte Nature
|
||||
{
|
||||
get => (sbyte)Data[0x7];
|
||||
set => Data[0x7] = (byte)value;
|
||||
}
|
||||
|
||||
public override int HeldItem
|
||||
{
|
||||
get => BitConverter.ToUInt16(Data, 0x8);
|
||||
set => BitConverter.GetBytes((ushort)value).CopyTo(Data, 0x8);
|
||||
}
|
||||
|
||||
public bool IsEgg
|
||||
{
|
||||
get => Data[0xA] == 1;
|
||||
set => Data[0xA] = (byte)(value ? 1 : 0);
|
||||
}
|
||||
|
||||
public int SpecialMove
|
||||
{
|
||||
get => BitConverter.ToUInt16(Data, 0xC);
|
||||
set => BitConverter.GetBytes((ushort)value).CopyTo(Data, 0xC);
|
||||
}
|
||||
|
||||
public bool IV3 => (sbyte) Data[0xE] < 0 && (sbyte) Data[0xE] + 1 == -3;
|
||||
|
||||
public string GetSummary()
|
||||
|
|
|
|||
|
|
@ -7,25 +7,30 @@ public class EncounterStatic7 : EncounterStatic
|
|||
{
|
||||
public const int SIZE = 0x38;
|
||||
public readonly byte[] Data;
|
||||
|
||||
public EncounterStatic7(byte[] data)
|
||||
{
|
||||
Data = data;
|
||||
}
|
||||
|
||||
public override int Species
|
||||
{
|
||||
get => BitConverter.ToUInt16(Data, 0x0);
|
||||
set => BitConverter.GetBytes((ushort)value).CopyTo(Data, 0x0);
|
||||
}
|
||||
|
||||
public int Form
|
||||
{
|
||||
get => Data[0x2];
|
||||
set => Data[0x2] = (byte)value;
|
||||
}
|
||||
|
||||
public int Level
|
||||
{
|
||||
get => Data[0x3];
|
||||
set => Data[0x3] = (byte)value;
|
||||
}
|
||||
|
||||
public override int HeldItem
|
||||
{
|
||||
get
|
||||
|
|
@ -44,34 +49,39 @@ public override int HeldItem
|
|||
public bool Shiny
|
||||
{
|
||||
get => (Data[0x6] & 1) >> 1 == 1;
|
||||
set => Data[0x6] = (byte)(Data[0x6] & ~1 | (value ? 1 : 0));
|
||||
set => Data[0x6] = (byte)((Data[0x6] & ~1) | (value ? 1 : 0));
|
||||
}
|
||||
|
||||
public bool ShinyLock
|
||||
{
|
||||
get => (Data[0x6] & 2) >> 1 == 1;
|
||||
set => Data[0x6] = (byte)(Data[0x6] & ~2 | (value ? 2 : 0));
|
||||
set => Data[0x6] = (byte)((Data[0x6] & ~2) | (value ? 2 : 0));
|
||||
}
|
||||
|
||||
public int Gender
|
||||
{
|
||||
get => (Data[0x6] & 0xC) >> 2;
|
||||
set => Data[0x6] = (byte)(Data[0x6] & ~0xC | ((value & 3) << 2));
|
||||
set => Data[0x6] = (byte)((Data[0x6] & ~0xC) | ((value & 3) << 2));
|
||||
}
|
||||
|
||||
public int Ability
|
||||
{
|
||||
get => (Data[0x6] & 0x70) >> 4;
|
||||
set => Data[0x6] = (byte)(Data[0x6] & ~0x70 | ((value & 7) << 4));
|
||||
set => Data[0x6] = (byte)((Data[0x6] & ~0x70) | ((value & 7) << 4));
|
||||
}
|
||||
|
||||
public bool _7
|
||||
{
|
||||
get => (Data[0x7] & 1) >> 0 == 1;
|
||||
set => Data[0x7] = (byte)(Data[0x7] & ~1 | (value ? 1 : 0));
|
||||
set => Data[0x7] = (byte)((Data[0x7] & ~1) | (value ? 1 : 0));
|
||||
}
|
||||
|
||||
public bool _7_1
|
||||
{
|
||||
get => (Data[0x7] & 2) >> 1 == 1;
|
||||
set => Data[0x7] = (byte)(Data[0x7] & ~2 | (value ? 2 : 0));
|
||||
set => Data[0x7] = (byte)((Data[0x7] & ~2) | (value ? 2 : 0));
|
||||
}
|
||||
|
||||
public int Map
|
||||
{
|
||||
get => BitConverter.ToInt16(Data, 0x8) - 1;
|
||||
|
|
@ -92,9 +102,10 @@ public int[] RelearnMoves
|
|||
if (value.Length != 4)
|
||||
return;
|
||||
for (int i = 0; i < 4; i++)
|
||||
BitConverter.GetBytes((ushort)value[i]).CopyTo(Data, 0xC + i * 2);
|
||||
BitConverter.GetBytes((ushort)value[i]).CopyTo(Data, 0xC + (i * 2));
|
||||
}
|
||||
}
|
||||
|
||||
public int Nature
|
||||
{
|
||||
get => Data[0x14];
|
||||
|
|
@ -112,6 +123,7 @@ public int[] IVs
|
|||
Data[i + 0x15] = (byte)Convert.ToSByte(value[i]);
|
||||
}
|
||||
}
|
||||
|
||||
public int[] EVs
|
||||
{
|
||||
get => new int[] { Data[0x1B], Data[0x1C], Data[0x1D], Data[0x1E], Data[0x1F], Data[0x20] };
|
||||
|
|
@ -123,6 +135,7 @@ public int[] EVs
|
|||
Data[i + 0x1B] = (byte)value[i];
|
||||
}
|
||||
}
|
||||
|
||||
public int Aura
|
||||
{
|
||||
get => Data[0x25];
|
||||
|
|
|
|||
|
|
@ -7,22 +7,27 @@ public class EncounterTrade7 : EncounterStatic
|
|||
public const int SIZE = 0x34;
|
||||
|
||||
public readonly byte[] Data;
|
||||
|
||||
public EncounterTrade7(byte[] data)
|
||||
{
|
||||
Data = data;
|
||||
}
|
||||
|
||||
public override int Species
|
||||
{
|
||||
get { return BitConverter.ToUInt16(Data, 0x0); }
|
||||
set { BitConverter.GetBytes((ushort)value).CopyTo(Data, 0x0); }
|
||||
}
|
||||
|
||||
public int String1
|
||||
{
|
||||
get { return BitConverter.ToUInt16(Data, 0x2); }
|
||||
set { BitConverter.GetBytes((ushort)value).CopyTo(Data, 0x2); }
|
||||
}
|
||||
|
||||
public int Form { get { return Data[0x4]; } set { Data[0x4] = (byte)value; } }
|
||||
public int Level { get { return Data[0x5]; } set { Data[0x5] = (byte)value; } }
|
||||
|
||||
public int[] IVs
|
||||
{
|
||||
get
|
||||
|
|
@ -40,12 +45,14 @@ public int[] IVs
|
|||
Data[i + 0x6] = (byte)Convert.ToSByte(value[i]);
|
||||
}
|
||||
}
|
||||
|
||||
public int Ability { get { return Data[0xC]; } set { Data[0xC] = (byte)value; } }
|
||||
public int Nature { get { return Data[0xD]; } set { Data[0xD] = (byte)value; } }
|
||||
public int Gender { get { return Data[0xE]; } set { Data[0xE] = (byte)value; } }
|
||||
public int TID { get { return BitConverter.ToUInt16(Data, 0x10); } set { BitConverter.GetBytes((ushort)value).CopyTo(Data, 0x10); } }
|
||||
public int SID { get { return BitConverter.ToUInt16(Data, 0x12); } set { BitConverter.GetBytes((ushort)value).CopyTo(Data, 0x12); } }
|
||||
public uint ID { get { return BitConverter.ToUInt32(Data, 0x10); } set { BitConverter.GetBytes((ushort)value).CopyTo(Data, 0x10); } }
|
||||
|
||||
public override int HeldItem
|
||||
{
|
||||
get
|
||||
|
|
@ -60,11 +67,13 @@ public override int HeldItem
|
|||
BitConverter.GetBytes((short)value).CopyTo(Data, 0x14);
|
||||
}
|
||||
}
|
||||
|
||||
public int String2
|
||||
{
|
||||
get { return BitConverter.ToUInt16(Data, 0x18); }
|
||||
set { BitConverter.GetBytes((ushort)value).CopyTo(Data, 0x18); }
|
||||
}
|
||||
|
||||
public int trGender { get { return Data[0x1A]; } set { Data[0x1A] = (byte)value; } }
|
||||
|
||||
public ushort OT_Intensity { get { return BitConverter.ToUInt16(Data, 0x1C); } set { BitConverter.GetBytes((ushort)value).CopyTo(Data, 0x1C); } }
|
||||
|
|
|
|||
|
|
@ -12,14 +12,16 @@ public class Trainer
|
|||
public ushort[] Choices;
|
||||
|
||||
public Trainer() { }
|
||||
|
||||
public Trainer(byte[] data)
|
||||
{
|
||||
Class = BitConverter.ToUInt16(data, 0);
|
||||
Count = BitConverter.ToUInt16(data, 2);
|
||||
Choices = new ushort[Count];
|
||||
for (int i = 0; i < Count; i++)
|
||||
Choices[i] = BitConverter.ToUInt16(data, 4 + 2 * i);
|
||||
Choices[i] = BitConverter.ToUInt16(data, 4 + (2 * i));
|
||||
}
|
||||
|
||||
public byte[] Write()
|
||||
{
|
||||
using (var ms = new MemoryStream())
|
||||
|
|
@ -33,6 +35,7 @@ public byte[] Write()
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
public class Pokemon
|
||||
{
|
||||
public ushort Species;
|
||||
|
|
@ -58,7 +61,7 @@ public Pokemon(byte[] data)
|
|||
{
|
||||
Species = BitConverter.ToUInt16(data, 0);
|
||||
for (int i = 0; i < 4; i++)
|
||||
Moves[i] = BitConverter.ToUInt16(data, 2 + 2 * i);
|
||||
Moves[i] = BitConverter.ToUInt16(data, 2 + (2 * i));
|
||||
EV = data[0xA];
|
||||
for (int i = 0; i < 6; i++)
|
||||
EVs[i] = ((EV >> i) & 1) == 1;
|
||||
|
|
@ -66,6 +69,7 @@ public Pokemon(byte[] data)
|
|||
Item = BitConverter.ToUInt16(data, 0xC);
|
||||
Form = BitConverter.ToUInt16(data, 0xE);
|
||||
}
|
||||
|
||||
public byte[] Write()
|
||||
{
|
||||
using (var ms = new MemoryStream())
|
||||
|
|
|
|||
|
|
@ -16,6 +16,7 @@ public ZoneData7(byte[] data)
|
|||
{
|
||||
Data = (byte[])(data ?? new byte[SIZE]).Clone();
|
||||
}
|
||||
|
||||
public ZoneData7(byte[] data, int index)
|
||||
{
|
||||
Data = new byte[SIZE];
|
||||
|
|
@ -27,7 +28,7 @@ public ZoneData7(byte[] data, int index)
|
|||
get => BitConverter.ToInt32(Data, 0x1C);
|
||||
set => BitConverter.GetBytes(value).CopyTo(Data, 0x1C);
|
||||
}
|
||||
|
||||
|
||||
// Info Tracking
|
||||
public void SetZoneName(string[] locationList, int index)
|
||||
{
|
||||
|
|
@ -35,7 +36,6 @@ public void SetZoneName(string[] locationList, int index)
|
|||
Name = $"{index:000} - {LocationName}";
|
||||
}
|
||||
|
||||
|
||||
public static ZoneData7[] GetArray(byte[] zoneData)
|
||||
{
|
||||
ZoneData7[] zd = new ZoneData7[zoneData.Length / SIZE];
|
||||
|
|
@ -46,7 +46,7 @@ public static ZoneData7[] GetArray(byte[] zoneData)
|
|||
|
||||
public static ZoneData7[] GetZoneData7Array(byte[] zoneData, byte[] worldData, string[] locationList, byte[][] worlds)
|
||||
{
|
||||
var zones = ZoneData7.GetArray(zoneData);
|
||||
var zones = GetArray(zoneData);
|
||||
for (int i = 0; i < zones.Length; i++)
|
||||
{
|
||||
zones[i].WorldIndex = BitConverter.ToUInt16(worldData, i * 0x2);
|
||||
|
|
|
|||
|
|
@ -22,8 +22,9 @@ public trpoke7 Clone()
|
|||
public int Gender
|
||||
{
|
||||
get => Data[0] & 0x3;
|
||||
set => Data[0] = (byte)((Data[0] & 0xFC) | value & 0x3);
|
||||
set => Data[0] = (byte)((Data[0] & 0xFC) | (value & 0x3));
|
||||
}
|
||||
|
||||
public int Ability
|
||||
{
|
||||
get => (Data[0] >> 4) & 0x3;
|
||||
|
|
@ -69,6 +70,7 @@ public int[] IVs
|
|||
IV_SPA = value[3]; IV_SPD = value[4]; IV_SPE = value[5];
|
||||
}
|
||||
}
|
||||
|
||||
public int[] EVs
|
||||
{
|
||||
get => new[] { EV_HP, EV_ATK, EV_DEF, EV_SPA, EV_SPD, EV_SPE };
|
||||
|
|
@ -79,6 +81,7 @@ public int[] EVs
|
|||
EV_SPA = value[3]; EV_SPD = value[4]; EV_SPE = value[5];
|
||||
}
|
||||
}
|
||||
|
||||
public int[] Moves
|
||||
{
|
||||
get => new[] { Move1, Move2, Move3, Move4 };
|
||||
|
|
|
|||
|
|
@ -34,6 +34,7 @@ public int[] GetMoves(int maxLevel, int minLevel = 0)
|
|||
Array.Copy(Moves, start, result, 0, result.Length);
|
||||
return result;
|
||||
}
|
||||
|
||||
/// <summary>Returns the moves a Pokémon would have if it were encountered at the specified level.</summary>
|
||||
/// <remarks>In Generation 1, it is not possible to learn any moves lower than these encounter moves.</remarks>
|
||||
/// <param name="level">The level the Pokémon was encountered at.</param>
|
||||
|
|
@ -56,6 +57,7 @@ public int[] GetEncounterMoves(int level)
|
|||
}
|
||||
return (int[])moves;
|
||||
}
|
||||
|
||||
/// <summary>Returns the index of the lowest level move if the Pokémon were encountered at the specified level.</summary>
|
||||
/// <remarks>Helps determine the minimum level an encounter can be at.</remarks>
|
||||
/// <param name="level">The level the Pokémon was encountered at.</param>
|
||||
|
|
@ -78,13 +80,14 @@ public int GetLevelLearnMove(int move)
|
|||
return index < 0 ? index : Levels[index];
|
||||
}
|
||||
}
|
||||
|
||||
public class Learnset6 : Learnset
|
||||
{
|
||||
public Learnset6(byte[] data)
|
||||
{
|
||||
if (data.Length < 4 || data.Length % 4 != 0)
|
||||
{ Count = 0; Levels = new int[0]; Moves = new int[0]; return; }
|
||||
Count = data.Length / 4 - 1;
|
||||
Count = (data.Length / 4) - 1;
|
||||
Moves = new int[Count];
|
||||
Levels = new int[Count];
|
||||
using (var ms = new MemoryStream(data))
|
||||
|
|
@ -95,6 +98,7 @@ public Learnset6(byte[] data)
|
|||
Levels[i] = br.ReadInt16();
|
||||
}
|
||||
}
|
||||
|
||||
public override byte[] Write()
|
||||
{
|
||||
Count = (ushort)Moves.Length;
|
||||
|
|
@ -110,6 +114,7 @@ public override byte[] Write()
|
|||
return ms.ToArray();
|
||||
}
|
||||
}
|
||||
|
||||
public static Learnset[] GetArray(byte[][] entries)
|
||||
{
|
||||
Learnset[] data = new Learnset[entries.Length];
|
||||
|
|
|
|||
|
|
@ -63,6 +63,7 @@ protected static bool[] getBits(byte[] data)
|
|||
r[i] = (data[i/8] >> (i&7) & 0x1) == 1;
|
||||
return r;
|
||||
}
|
||||
|
||||
protected static byte[] setBits(bool[] bits)
|
||||
{
|
||||
byte[] data = new byte[bits.Length/8];
|
||||
|
|
@ -83,6 +84,7 @@ public int FormeIndex(int species, int forme)
|
|||
|
||||
return FormStatsIndex + forme - 1;
|
||||
}
|
||||
|
||||
public int RandomGender
|
||||
{
|
||||
get
|
||||
|
|
@ -100,6 +102,7 @@ public int RandomGender
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
public bool HasFormes => FormeCount > 1;
|
||||
public int BST => HP + ATK + DEF + SPE + SPA + SPD;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -5,6 +5,7 @@ namespace pk3DS.Core.Structures.PersonalInfo
|
|||
public class PersonalInfoORAS : PersonalInfoXY
|
||||
{
|
||||
public new const int SIZE = 0x50;
|
||||
|
||||
public PersonalInfoORAS(byte[] data)
|
||||
{
|
||||
if (data.Length != SIZE)
|
||||
|
|
@ -23,6 +24,7 @@ public PersonalInfoORAS(byte[] data)
|
|||
getBits(Data.Skip(0x4C).Take(0x04).ToArray()),
|
||||
};
|
||||
}
|
||||
|
||||
public override byte[] Write()
|
||||
{
|
||||
setBits(TMHM).CopyTo(Data, 0x28);
|
||||
|
|
|
|||
|
|
@ -6,6 +6,7 @@ namespace pk3DS.Core.Structures.PersonalInfo
|
|||
public class PersonalInfoSM : PersonalInfoXY
|
||||
{
|
||||
public new const int SIZE = 0x54;
|
||||
|
||||
public PersonalInfoSM(byte[] data)
|
||||
{
|
||||
if (data.Length != SIZE)
|
||||
|
|
@ -19,6 +20,7 @@ public PersonalInfoSM(byte[] data)
|
|||
getBits(Data.Skip(0x3C).Take(0x0A).ToArray()),
|
||||
};
|
||||
}
|
||||
|
||||
public override byte[] Write()
|
||||
{
|
||||
setBits(TMHM).CopyTo(Data, 0x28);
|
||||
|
|
|
|||
|
|
@ -7,6 +7,7 @@ public class PersonalInfoXY : PersonalInfo
|
|||
{
|
||||
protected PersonalInfoXY() { } // For ORAS
|
||||
public const int SIZE = 0x40;
|
||||
|
||||
public PersonalInfoXY(byte[] data)
|
||||
{
|
||||
if (data.Length != SIZE)
|
||||
|
|
@ -18,6 +19,7 @@ public PersonalInfoXY(byte[] data)
|
|||
TypeTutors = getBits(Data.Skip(0x38).Take(0x4).ToArray());
|
||||
// 0x3C-0x40 unknown
|
||||
}
|
||||
|
||||
public override byte[] Write()
|
||||
{
|
||||
setBits(TMHM).CopyTo(Data, 0x28);
|
||||
|
|
@ -31,6 +33,7 @@ public override byte[] Write()
|
|||
public override int SPE { get { return Data[0x03]; } set { Data[0x03] = (byte)value; } }
|
||||
public override int SPA { get { return Data[0x04]; } set { Data[0x04] = (byte)value; } }
|
||||
public override int SPD { get { return Data[0x05]; } set { Data[0x05] = (byte)value; } }
|
||||
|
||||
public override int[] Types
|
||||
{
|
||||
get { return new int[] { Data[0x06], Data[0x07] }; }
|
||||
|
|
@ -41,6 +44,7 @@ public override int[] Types
|
|||
Data[0x07] = (byte)value[1];
|
||||
}
|
||||
}
|
||||
|
||||
public override int CatchRate { get { return Data[0x08]; } set { Data[0x08] = (byte)value; } }
|
||||
public override int EvoStage { get { return Data[0x09]; } set { Data[0x09] = (byte)value; } }
|
||||
private int EVYield { get { return BitConverter.ToUInt16(Data, 0x0A); } set { BitConverter.GetBytes((ushort)value).CopyTo(Data, 0x0A); } }
|
||||
|
|
@ -50,6 +54,7 @@ public override int[] Types
|
|||
public override int EV_SPE { get { return EVYield >> 6 & 0x3; } set { EVYield = (EVYield & ~(0x3 << 6)) | (value & 0x3) << 6; } }
|
||||
public override int EV_SPA { get { return EVYield >> 8 & 0x3; } set { EVYield = (EVYield & ~(0x3 << 8)) | (value & 0x3) << 8; } }
|
||||
public override int EV_SPD { get { return EVYield >> 10 & 0x3; } set { EVYield = (EVYield & ~(0x3 << 10)) | (value & 0x3) << 10; } }
|
||||
|
||||
public override int[] Items
|
||||
{
|
||||
get { return new int[] { BitConverter.ToInt16(Data, 0xC), BitConverter.ToInt16(Data, 0xE), BitConverter.ToInt16(Data, 0x10) }; }
|
||||
|
|
@ -61,10 +66,12 @@ public override int[] Items
|
|||
BitConverter.GetBytes((short)value[2]).CopyTo(Data, 0x10);
|
||||
}
|
||||
}
|
||||
|
||||
public override int Gender { get { return Data[0x12]; } set { Data[0x12] = (byte)value; } }
|
||||
public override int HatchCycles { get { return Data[0x13]; } set { Data[0x13] = (byte)value; } }
|
||||
public override int BaseFriendship { get { return Data[0x14]; } set { Data[0x14] = (byte)value; } }
|
||||
public override int EXPGrowth { get { return Data[0x15]; } set { Data[0x15] = (byte)value; } }
|
||||
|
||||
public override int[] EggGroups
|
||||
{
|
||||
get { return new int[] { Data[0x16], Data[0x17] }; }
|
||||
|
|
@ -75,6 +82,7 @@ public override int[] EggGroups
|
|||
Data[0x17] = (byte)value[1];
|
||||
}
|
||||
}
|
||||
|
||||
public override int[] Abilities
|
||||
{
|
||||
get { return new int[] { Data[0x18], Data[0x19], Data[0x1A] }; }
|
||||
|
|
@ -86,6 +94,7 @@ public override int[] Abilities
|
|||
Data[0x1A] = (byte)value[2];
|
||||
}
|
||||
}
|
||||
|
||||
public override int EscapeRate { get { return Data[0x1B]; } set { Data[0x1B] = (byte)value; } }
|
||||
public override int FormStatsIndex { get { return BitConverter.ToUInt16(Data, 0x1C); } protected internal set { BitConverter.GetBytes((ushort)value).CopyTo(Data, 0x1C); } }
|
||||
public override int FormeSprite { get { return BitConverter.ToUInt16(Data, 0x1E); } set { BitConverter.GetBytes((ushort)value).CopyTo(Data, 0x1E); } }
|
||||
|
|
|
|||
|
|
@ -14,6 +14,7 @@ private static byte[][] splitBytes(byte[] data, int size)
|
|||
}
|
||||
return r;
|
||||
}
|
||||
|
||||
public PersonalTable(byte[] data, GameVersion format)
|
||||
{
|
||||
int size = 0;
|
||||
|
|
@ -55,6 +56,7 @@ public PersonalTable(byte[] data, GameVersion format)
|
|||
}
|
||||
|
||||
public readonly PersonalInfo[] Table;
|
||||
|
||||
public PersonalInfo this[int index]
|
||||
{
|
||||
get
|
||||
|
|
@ -77,12 +79,14 @@ public int[] getAbilities(int species, int forme)
|
|||
{ species = 0; Console.WriteLine("Requested out of bounds SpeciesID"); }
|
||||
return this[getFormeIndex(species, forme)].Abilities;
|
||||
}
|
||||
|
||||
public int getFormeIndex(int species, int forme)
|
||||
{
|
||||
if (species >= Table.Length)
|
||||
{ species = 0; Console.WriteLine("Requested out of bounds SpeciesID"); }
|
||||
return this[species].FormeIndex(species, forme);
|
||||
}
|
||||
|
||||
public PersonalInfo getFormeEntry(int species, int forme)
|
||||
{
|
||||
return this[getFormeIndex(species, forme)];
|
||||
|
|
@ -105,6 +109,7 @@ public string[][] getFormList(string[] species, int MaxSpecies)
|
|||
|
||||
return FormList;
|
||||
}
|
||||
|
||||
public string[] getPersonalEntryList(string[][] AltForms, string[] species, int MaxSpecies, out int[] baseForm, out int[] formVal)
|
||||
{
|
||||
string[] result = new string[Table.Length];
|
||||
|
|
@ -126,6 +131,7 @@ public string[] getPersonalEntryList(string[][] AltForms, string[] species, int
|
|||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
public int[] getSpeciesForm(int PersonalEntry, GameConfig config)
|
||||
{
|
||||
if (PersonalEntry < config.MaxSpeciesID) return new[] { PersonalEntry, 0 };
|
||||
|
|
|
|||
|
|
@ -40,6 +40,7 @@ public class Script
|
|||
((DecompressedLength - CompressedLength)/(decimal)DecompressedLength).ToString("p1");
|
||||
|
||||
public byte[] Raw;
|
||||
|
||||
public Script(byte[] data = null)
|
||||
{
|
||||
Raw = data ?? new byte[0];
|
||||
|
|
@ -48,6 +49,7 @@ public Script(byte[] data = null)
|
|||
if ((Raw[8] & 1) != 0)
|
||||
throw new ArgumentException("Multi-environment script!?");
|
||||
}
|
||||
|
||||
public byte[] Write()
|
||||
{
|
||||
return Raw;
|
||||
|
|
|
|||
|
|
@ -31,11 +31,13 @@ internal static byte[] decompressScript(byte[] data)
|
|||
return mn.ToArray();
|
||||
}
|
||||
}
|
||||
|
||||
internal static byte[] readCompressed(byte[] data, int pos)
|
||||
{
|
||||
byte[] c1 = data.Skip(pos).TakeWhile(b => b >> 7 > 0).ToArray(); // Take while >= 0x80
|
||||
return c1.Concat(data.Skip(pos + c1.Length).Take(1)).ToArray(); // Take another
|
||||
}
|
||||
|
||||
internal static byte[] decompressBytes(byte[] cb)
|
||||
{
|
||||
byte[] db = new byte[0];
|
||||
|
|
@ -120,6 +122,7 @@ internal static byte[] compressScript(byte[] data)
|
|||
return mn.ToArray();
|
||||
}
|
||||
}
|
||||
|
||||
internal static byte[] compressBytes(byte[] db)
|
||||
{
|
||||
short cmd = BitConverter.ToInt16(db, 0);
|
||||
|
|
@ -171,7 +174,7 @@ internal static byte[] compressBytes(byte[] db)
|
|||
{
|
||||
byte bits = (byte)((byte)dv & 0x7F); dv >>= 7; // Take off 7 bits at a time
|
||||
bitStorage |= (byte)(bits << (ctr*8)); // Write the 7 bits into storage
|
||||
bitStorage |= (byte)(1 << (7 + ctr++*8)); // continue reading flag
|
||||
bitStorage |= (byte)(1 << (7 + (ctr++*8))); // continue reading flag
|
||||
}
|
||||
byte[] compressedBits = BitConverter.GetBytes(bitStorage);
|
||||
|
||||
|
|
@ -191,11 +194,12 @@ internal static string[] getHexLines(byte[] data, int count = 4)
|
|||
{
|
||||
data = data ?? new byte[0];
|
||||
// Generates an x-byte wide space separated string array; leftovers included at the end.
|
||||
string[] s = new string[data.Length/count + (data.Length % count > 0 ? 1 : 0)];
|
||||
string[] s = new string[(data.Length/count) + (data.Length % count > 0 ? 1 : 0)];
|
||||
for (int i = 0; i < s.Length;i++)
|
||||
s[i] = BitConverter.ToString(data.Skip(i*count).Take(count).ToArray()).Replace('-', ' ');
|
||||
return s;
|
||||
}
|
||||
|
||||
internal static string[] getHexLines(uint[] data)
|
||||
{
|
||||
data = data ?? new uint[0];
|
||||
|
|
@ -205,6 +209,7 @@ internal static string[] getHexLines(uint[] data)
|
|||
s[i] = BitConverter.ToString(BitConverter.GetBytes(data[i])).Replace('-', ' ');
|
||||
return s;
|
||||
}
|
||||
|
||||
internal static byte[] getBytes(uint[] data)
|
||||
{
|
||||
return data.Aggregate(new byte[0], (current, t) => current.Concat(BitConverter.GetBytes(t)).ToArray());
|
||||
|
|
@ -426,7 +431,7 @@ internal static string[] parseScript(uint[] cmd, int sanity = -1)
|
|||
// sanity check range...
|
||||
// negative.. weird
|
||||
|
||||
int newOfs = line*4 + delta;
|
||||
int newOfs = (line * 4) + delta;
|
||||
op = $"{Commands[c]} => 0x{newOfs:X4} ({delta})";
|
||||
break;
|
||||
}
|
||||
|
|
@ -440,7 +445,7 @@ internal static string[] parseScript(uint[] cmd, int sanity = -1)
|
|||
}
|
||||
case 0x82: // JumpIfElse
|
||||
{
|
||||
var jOffset = i*4 -4; // todo: this may be the correct jump start point...
|
||||
var jOffset = (i * 4) - 4; // todo: this may be the correct jump start point...
|
||||
var count = cmd[i++]; // switch case table
|
||||
// sanity check
|
||||
|
||||
|
|
@ -451,14 +456,14 @@ internal static string[] parseScript(uint[] cmd, int sanity = -1)
|
|||
for (int j = 0; j < count; j++)
|
||||
{
|
||||
var jmp = (int)cmd[i++];
|
||||
var toOffset = (i-2)*4 + jmp;
|
||||
var toOffset = ((i-2)*4) + jmp;
|
||||
var ifValue = (int)cmd[i++];
|
||||
tree.Add($"\t{ifValue} => 0x{toOffset:X4} ({jmp})");
|
||||
}
|
||||
// Default
|
||||
{
|
||||
int jmp = (int)cmd[i++];
|
||||
var toOffset = (i-2)*4 + jmp;
|
||||
var toOffset = ((i-2)*4) + jmp;
|
||||
tree.Add($"\t{"*"} => 0x{toOffset:X4} ({jmp})");
|
||||
}
|
||||
|
||||
|
|
@ -575,7 +580,7 @@ internal static string[] parseScript(uint[] cmd, int sanity = -1)
|
|||
{
|
||||
// minimal sanity checks
|
||||
// can return error code 0x1C
|
||||
int newPos = i + (int)(1 + 2*(cmd[i]/4) + 1);
|
||||
int newPos = i + (int)(1 + (2 *(cmd[i]/4)) + 1);
|
||||
|
||||
op = eA(c, newPos);
|
||||
break;
|
||||
|
|
@ -636,7 +641,9 @@ internal static string eA(uint c, params int[] arr)
|
|||
string parameters = arr.Length == 0 ? "" : string.Join(", ", arr.Select(z => $"{(Math.Abs(z) < 100 ? z.ToString() : "0x"+z.ToString("X4"))}"));
|
||||
return $"{cmd}({parameters})";
|
||||
}
|
||||
|
||||
private static readonly Func<uint, float> getFloat = val => BitConverter.ToSingle(BitConverter.GetBytes(val), 0);
|
||||
|
||||
internal static string eF(uint c, params uint[] arr)
|
||||
{
|
||||
string cmd = Commands[c];
|
||||
|
|
|
|||
|
|
@ -31,14 +31,14 @@ public static Bitmap getGrid(int itemsize, int itemsPerRow, byte[] vals)
|
|||
byte[] itemColor = BitConverter.GetBytes(Colors[vals[i]]);
|
||||
for (int x = 0; x < itemsize * itemsize; x++)
|
||||
Buffer.BlockCopy(itemColor, 0, bmpData,
|
||||
(Y * itemsize + x % itemsize) * width * 4 + (X * itemsize + x / itemsize) * 4, 4);
|
||||
(((Y * itemsize) + (x % itemsize)) * width * 4) + (((X * itemsize) + (x / itemsize)) * 4), 4);
|
||||
}
|
||||
// slap on a grid
|
||||
byte[] gridColor = BitConverter.GetBytes(0x17000000);
|
||||
for (int i = 0; i < width * height; i++)
|
||||
if (i % itemsize == 0 || i / (itemsize * itemsPerRow) % itemsize == 0)
|
||||
Buffer.BlockCopy(gridColor, 0, bmpData,
|
||||
i / (itemsize * itemsPerRow) * width * 4 + i % (itemsize * itemsPerRow) * 4, 4);
|
||||
(i / (itemsize * itemsPerRow) * width * 4) + (i % (itemsize * itemsPerRow) * 4), 4);
|
||||
|
||||
// assemble image
|
||||
Bitmap b = new Bitmap(width, height, PixelFormat.Format32bppArgb);
|
||||
|
|
|
|||
|
|
@ -21,6 +21,7 @@ public static string GetTable<T>(IEnumerable<T> arr, IList<string> names, string
|
|||
|
||||
return string.Join(Environment.NewLine, list);
|
||||
}
|
||||
|
||||
public static string GetTable<T>(IEnumerable<T> arr) where T : new()
|
||||
{
|
||||
return string.Join(Environment.NewLine, GetTableRaw(arr));
|
||||
|
|
@ -30,6 +31,7 @@ private static IEnumerable<string> GetTableRaw<T>(IEnumerable<T> arr) where T :
|
|||
{
|
||||
return Table(arr).Select(row => string.Join(sep, row));
|
||||
}
|
||||
|
||||
private static IEnumerable<IEnumerable<string>> Table<T>(IEnumerable<T> arr) where T : new()
|
||||
{
|
||||
var type = typeof(T);
|
||||
|
|
@ -37,6 +39,7 @@ private static IEnumerable<IEnumerable<string>> Table<T>(IEnumerable<T> arr) whe
|
|||
foreach (var z in arr)
|
||||
yield return GetValues(z, type);
|
||||
}
|
||||
|
||||
private static IEnumerable<string> GetNames(Type type)
|
||||
{
|
||||
foreach (var z in type.GetProperties())
|
||||
|
|
@ -44,6 +47,7 @@ private static IEnumerable<string> GetNames(Type type)
|
|||
foreach (var z in type.GetFields())
|
||||
yield return z.Name;
|
||||
}
|
||||
|
||||
private static IEnumerable<string> GetValues(object obj, Type type)
|
||||
{
|
||||
foreach (var z in type.GetProperties())
|
||||
|
|
|
|||
|
|
@ -34,14 +34,16 @@ public TextFile(GameConfig config, byte[] data = null, bool remapChars = false)
|
|||
Config = config;
|
||||
RemapChars = remapChars;
|
||||
}
|
||||
|
||||
private GameConfig Config { get; set; }
|
||||
private bool RemapChars = true;
|
||||
private readonly bool RemapChars = true;
|
||||
private ushort TextSections { get { return BitConverter.ToUInt16(Data, 0x0); } set { BitConverter.GetBytes(value).CopyTo(Data, 0x0); } } // Always 0x0001
|
||||
private ushort LineCount { get { return BitConverter.ToUInt16(Data, 0x2); } set { BitConverter.GetBytes(value).CopyTo(Data, 0x2); } }
|
||||
private uint TotalLength { get { return BitConverter.ToUInt32(Data, 0x4); } set { BitConverter.GetBytes(value).CopyTo(Data, 0x4); } }
|
||||
private uint InitialKey { get { return BitConverter.ToUInt32(Data, 0x8); } set { BitConverter.GetBytes(value).CopyTo(Data, 0x8); } } // Always 0x00000000
|
||||
private uint SectionDataOffset { get { return BitConverter.ToUInt32(Data, 0xC); } set { BitConverter.GetBytes(value).CopyTo(Data, 0xC); } } // Always 0x0010
|
||||
private uint SectionLength { get { return BitConverter.ToUInt32(Data, (int)SectionDataOffset); } set { BitConverter.GetBytes(value).CopyTo(Data, SectionDataOffset); } }
|
||||
|
||||
private LineInfo[] LineOffsets
|
||||
{
|
||||
get
|
||||
|
|
@ -51,8 +53,8 @@ private LineInfo[] LineOffsets
|
|||
for (int i = 0; i < result.Length; i++)
|
||||
result[i] = new LineInfo
|
||||
{
|
||||
Offset = BitConverter.ToInt32(Data, i * 8 + sdo + 4) + sdo,
|
||||
Length = BitConverter.ToInt16(Data, i * 8 + sdo + 8)
|
||||
Offset = BitConverter.ToInt32(Data, (i * 8) + sdo + 4) + sdo,
|
||||
Length = BitConverter.ToInt16(Data, (i * 8) + sdo + 8)
|
||||
};
|
||||
return result;
|
||||
}
|
||||
|
|
@ -63,11 +65,12 @@ private LineInfo[] LineOffsets
|
|||
int sdo = (int)SectionDataOffset;
|
||||
for (int i = 0; i < value.Length; i++)
|
||||
{
|
||||
BitConverter.GetBytes(value[i].Offset).CopyTo(Data, i * 8 + sdo + 4);
|
||||
BitConverter.GetBytes(value[i].Length).CopyTo(Data, i * 8 + sdo + 8);
|
||||
BitConverter.GetBytes(value[i].Offset).CopyTo(Data, (i * 8) + sdo + 4);
|
||||
BitConverter.GetBytes(value[i].Length).CopyTo(Data, (i * 8) + sdo + 8);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private class LineInfo
|
||||
{
|
||||
public int Offset, Length;
|
||||
|
|
@ -118,19 +121,20 @@ public byte[][] LineData
|
|||
int bytesUsed = 0;
|
||||
for (int i = 0; i < lines.Length; i++)
|
||||
{
|
||||
lines[i] = new LineInfo {Offset = 4 + 8 * value.Length + bytesUsed, Length = value[i].Length / 2};
|
||||
lines[i] = new LineInfo {Offset = 4 + (8 * value.Length) + bytesUsed, Length = value[i].Length / 2};
|
||||
bytesUsed += value[i].Length;
|
||||
}
|
||||
|
||||
// Apply Line Data
|
||||
int sdo = (int)SectionDataOffset;
|
||||
Array.Resize(ref Data, sdo + 4 + 8 * value.Length + bytesUsed);
|
||||
Array.Resize(ref Data, sdo + 4 + (8 * value.Length) + bytesUsed);
|
||||
LineOffsets = lines;
|
||||
value.SelectMany(i => i).ToArray().CopyTo(Data, Data.Length - bytesUsed);
|
||||
TotalLength = SectionLength = (uint)(Data.Length - sdo);
|
||||
LineCount = (ushort)value.Length;
|
||||
}
|
||||
}
|
||||
|
||||
public string[] Lines
|
||||
{
|
||||
get => LineData.Select(z => getLineString(Config, z)).ToArray();
|
||||
|
|
@ -172,6 +176,7 @@ private static byte[] cryptLineData(byte[] data, ushort key)
|
|||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
private byte[] getLineData(GameConfig config, string line)
|
||||
{
|
||||
if (line == null)
|
||||
|
|
@ -223,6 +228,7 @@ private ushort TryRemapChar(ushort val)
|
|||
default: return val;
|
||||
}
|
||||
}
|
||||
|
||||
private ushort TryUnmapChar(ushort val)
|
||||
{
|
||||
if (!RemapChars)
|
||||
|
|
@ -262,6 +268,7 @@ private string getLineString(GameConfig config, byte[] data)
|
|||
}
|
||||
return s.ToString(); // Shouldn't get hit if the string is properly terminated.
|
||||
}
|
||||
|
||||
private string getVariableString(GameConfig config, byte[] data, ref int i)
|
||||
{
|
||||
var s = new StringBuilder();
|
||||
|
|
@ -300,6 +307,7 @@ private string getVariableString(GameConfig config, byte[] data, ref int i)
|
|||
s.Append("]");
|
||||
return s.ToString();
|
||||
}
|
||||
|
||||
private IEnumerable<ushort> getEscapeValues(char esc)
|
||||
{
|
||||
var vals = new List<ushort>();
|
||||
|
|
@ -313,6 +321,7 @@ private IEnumerable<ushort> getEscapeValues(char esc)
|
|||
default: throw new Exception("Invalid terminated line: \\" + esc);
|
||||
}
|
||||
}
|
||||
|
||||
private IEnumerable<ushort> getVariableValues(GameConfig config, string variable)
|
||||
{
|
||||
string[] split = variable.Split(' ');
|
||||
|
|
@ -339,6 +348,7 @@ private IEnumerable<ushort> getVariableValues(GameConfig config, string variable
|
|||
}
|
||||
return vals;
|
||||
}
|
||||
|
||||
private IEnumerable<ushort> getVariableParameters(GameConfig config, string text)
|
||||
{
|
||||
var vals = new List<ushort>();
|
||||
|
|
@ -374,6 +384,7 @@ private ushort getVariableNumber(GameConfig config, string variable)
|
|||
}
|
||||
catch { throw new ArgumentException("Variable parse error: " + variable); }
|
||||
}
|
||||
|
||||
private string getVariableString(GameConfig config, ushort variable)
|
||||
{
|
||||
var v = config.getVariableName(variable);
|
||||
|
|
@ -387,6 +398,7 @@ public static string[] getStrings(GameConfig config, byte[] data, bool remapChar
|
|||
try { t = new TextFile(config, data, remapChars); } catch { return null; }
|
||||
return t.Lines;
|
||||
}
|
||||
|
||||
public static byte[] getBytes(GameConfig config, string[] lines, bool remapChars = false)
|
||||
{
|
||||
return new TextFile (config, remapChars: remapChars) { Lines = lines }.Data;
|
||||
|
|
|
|||
|
|
@ -14,15 +14,18 @@ public static FileInfo GetNewestFile(DirectoryInfo directory)
|
|||
.OrderByDescending(f => f?.LastWriteTime ?? DateTime.MinValue)
|
||||
.FirstOrDefault();
|
||||
}
|
||||
|
||||
public static string NormalizePath(string path)
|
||||
{
|
||||
return Path.GetFullPath(new Uri(path).LocalPath)
|
||||
.TrimEnd(Path.DirectorySeparatorChar, Path.AltDirectorySeparatorChar);
|
||||
}
|
||||
|
||||
public static string CleanFileName(string fileName)
|
||||
{
|
||||
return Path.GetInvalidFileNameChars().Aggregate(fileName, (current, c) => current.Replace(c.ToString(), string.Empty));
|
||||
}
|
||||
|
||||
public static string TrimFromZero(string input)
|
||||
{
|
||||
int index = input.IndexOf('\0');
|
||||
|
|
@ -43,6 +46,7 @@ public static int ToInt32(string value)
|
|||
string val = value?.Replace(" ", "").Replace("_", "").Trim();
|
||||
return string.IsNullOrWhiteSpace(val) ? 0 : int.Parse(val);
|
||||
}
|
||||
|
||||
public static uint ToUInt32(string value)
|
||||
{
|
||||
string val = value?.Replace(" ", "").Replace("_", "").Trim();
|
||||
|
|
@ -78,7 +82,7 @@ public static string GuessExtension(BinaryReader br, string defaultExt, bool byp
|
|||
// check for 2char container extensions
|
||||
try
|
||||
{
|
||||
br.BaseStream.Position = position + 4 + 4 * count;
|
||||
br.BaseStream.Position = position + 4 + (4 * count);
|
||||
if (br.ReadUInt32() == br.BaseStream.Length)
|
||||
{
|
||||
ext += (char)magic[0] + (char)magic[1];
|
||||
|
|
@ -92,7 +96,7 @@ public static string GuessExtension(BinaryReader br, string defaultExt, bool byp
|
|||
try
|
||||
{
|
||||
count = BitConverter.ToUInt16(magic, 0);
|
||||
br.BaseStream.Position = position + 4 + 0x40 * count;
|
||||
br.BaseStream.Position = position + 4 + (0x40 * count);
|
||||
uint tableval = br.ReadUInt32();
|
||||
br.BaseStream.Position += 0x20 * tableval;
|
||||
while (br.PeekChar() == 0) // seek forward
|
||||
|
|
@ -121,7 +125,7 @@ public static string GuessExtension(BinaryReader br, string defaultExt, bool byp
|
|||
return defaultExt;
|
||||
for (int i = 0; i < magic.Length && i < 4; i++)
|
||||
{
|
||||
if (magic[i] >= 'a' && magic[i] <= 'z' || magic[i] >= 'A' && magic[i] <= 'Z'
|
||||
if ((magic[i] >= 'a' && magic[i] <= 'z') || (magic[i] >= 'A' && magic[i] <= 'Z')
|
||||
|| char.IsDigit((char)magic[i]))
|
||||
{
|
||||
ext += (char)magic[i];
|
||||
|
|
@ -142,11 +146,13 @@ public static string GuessExtension(BinaryReader br, string defaultExt, bool byp
|
|||
}
|
||||
catch { return defaultExt; }
|
||||
}
|
||||
|
||||
public static string GuessExtension(string path, bool bypass)
|
||||
{
|
||||
using (BinaryReader br = new BinaryReader(File.OpenRead(path)))
|
||||
return GuessExtension(br, "bin", bypass);
|
||||
}
|
||||
|
||||
public static uint Reverse(uint x)
|
||||
{
|
||||
uint y = 0;
|
||||
|
|
@ -158,6 +164,7 @@ public static uint Reverse(uint x)
|
|||
}
|
||||
return y;
|
||||
}
|
||||
|
||||
public static char[] Reverse(char[] charArray)
|
||||
{
|
||||
Array.Reverse(charArray);
|
||||
|
|
@ -189,6 +196,7 @@ public static string getHexString(byte[] data)
|
|||
{
|
||||
return BitConverter.ToString(data).Replace('-', ' ');
|
||||
}
|
||||
|
||||
public static void resizeJagged(ref byte[][] array, int size, int lowLen)
|
||||
{
|
||||
int oldSize = array?.Length ?? 0;
|
||||
|
|
@ -200,6 +208,7 @@ public static void resizeJagged(ref byte[][] array, int size, int lowLen)
|
|||
array[i] = new byte[lowLen];
|
||||
}
|
||||
}
|
||||
|
||||
public static byte[] StringToByteArray(string hex)
|
||||
{
|
||||
return Enumerable.Range(0, hex.Length)
|
||||
|
|
@ -207,6 +216,5 @@ public static byte[] StringToByteArray(string hex)
|
|||
.Select(x => Convert.ToByte(hex.Substring(x, 2), 16))
|
||||
.ToArray();
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -15,6 +15,7 @@ public static SARC analyzeSARC(string path)
|
|||
try { return new SARC(path); }
|
||||
catch { return new SARC(); }
|
||||
}
|
||||
|
||||
internal static ShuffleARC AnalyzeShuffle(string path)
|
||||
{
|
||||
ShuffleARC sharc = new ShuffleARC
|
||||
|
|
@ -60,6 +61,7 @@ internal static ShuffleARC AnalyzeShuffle(string path)
|
|||
}
|
||||
return sharc;
|
||||
}
|
||||
|
||||
internal static GAR analyzeGAR(string path)
|
||||
{
|
||||
GAR gar = new GAR
|
||||
|
|
@ -129,6 +131,7 @@ internal static GAR analyzeGAR(string path)
|
|||
}
|
||||
return gar;
|
||||
}
|
||||
|
||||
internal static DARC analyze(string path)
|
||||
{
|
||||
DARC darc = new DARC
|
||||
|
|
@ -204,6 +207,7 @@ internal static DARC analyze(string path)
|
|||
return darc;
|
||||
}
|
||||
}
|
||||
|
||||
internal static FARC analyzeFARC(string path)
|
||||
{
|
||||
FARC farc = new FARC
|
||||
|
|
@ -283,6 +287,7 @@ internal static FARC analyzeFARC(string path)
|
|||
farc.Extension = Path.GetExtension(path);
|
||||
return farc;
|
||||
}
|
||||
|
||||
internal static string Interpret(string path)
|
||||
{
|
||||
string fn = Path.GetFileName(path);
|
||||
|
|
@ -500,8 +505,8 @@ internal static void repackDARC(string path, string fileName, string outfolder =
|
|||
byte[] donorBytes = File.ReadAllBytes(donor);
|
||||
if (data.SequenceEqual(donorBytes.Take(data.Length)))
|
||||
{
|
||||
int headerLen = data.Length + BitConverter.ToInt32(donorBytes, data.Length)*0x20;
|
||||
headerLen += 0x80 - headerLen%0x80;
|
||||
int headerLen = data.Length + (BitConverter.ToInt32(donorBytes, data.Length)*0x20);
|
||||
headerLen += 0x80 - (headerLen % 0x80);
|
||||
data = donorBytes.Take(headerLen).ToArray();
|
||||
}
|
||||
else
|
||||
|
|
@ -530,6 +535,7 @@ internal static string FixMajoraChecksum(string path)
|
|||
File.WriteAllBytes(path, data);
|
||||
return "Corrected Majora Checksum to " + val.ToString("X4");
|
||||
}
|
||||
|
||||
internal static string ParseShuffleText(string path)
|
||||
{
|
||||
ShuffleText st = new ShuffleText
|
||||
|
|
@ -592,11 +598,13 @@ public struct FARC
|
|||
public string Extension;
|
||||
public Boolean valid;
|
||||
}
|
||||
|
||||
public struct FARCFileTable
|
||||
{
|
||||
public List<FARCFile> Files;
|
||||
public List<string> FileNames;
|
||||
}
|
||||
|
||||
public struct FARCFile
|
||||
{
|
||||
public uint NameOffset;
|
||||
|
|
@ -622,11 +630,13 @@ public class ShuffleARC
|
|||
public bool add100;
|
||||
public bool valid;
|
||||
}
|
||||
|
||||
public class ShuffleFile
|
||||
{
|
||||
public uint Offset;
|
||||
public uint Length;
|
||||
}
|
||||
|
||||
public class ShuffleText
|
||||
{
|
||||
public uint StringMetaOffset;
|
||||
|
|
@ -661,6 +671,7 @@ public class GAR
|
|||
public string Extension;
|
||||
public bool valid;
|
||||
}
|
||||
|
||||
public class GARFile
|
||||
{
|
||||
public string NameWithExtension;
|
||||
|
|
@ -691,11 +702,13 @@ public struct DARC
|
|||
public string Extension;
|
||||
public Boolean valid;
|
||||
}
|
||||
|
||||
public struct FileTable
|
||||
{
|
||||
public List<DarcFile> Files;
|
||||
public List<string> FileNames;
|
||||
}
|
||||
|
||||
public struct DarcFile
|
||||
{
|
||||
public ushort NameOffset; //
|
||||
|
|
|
|||
|
|
@ -76,11 +76,13 @@ internal static int[] getRandomItemList()
|
|||
671, 672, 673, 674, 675, 676, 677, 678, 679, 680, 681, 682, 683,
|
||||
684, 685, 686, 687, 688, 699, 704, 708, 709, 710, 711, 715,
|
||||
};
|
||||
|
||||
private static readonly int[] Items_HeldAO = Items_HeldXY.Concat(new[]
|
||||
{
|
||||
534, 535,
|
||||
752, 753, 754, 755, 756, 757, 758, 759, 760, 761, 762, 763, 764, 767, 768, 769, 770,
|
||||
}).ToArray();
|
||||
|
||||
private static readonly int[] Items_Ball =
|
||||
{
|
||||
000, 001, 002, 003, 004, 005, 006, 007, 008, 009, 010, 011, 012,
|
||||
|
|
@ -108,14 +110,17 @@ internal static int[] getRandomItemList()
|
|||
761, 762, 763, 764, 767, 768, 769, 770, 795, 796, 844, 849, 853, 854, 855, 856, 879, 880, 881, 882,
|
||||
883, 884, 904, 905, 906, 907, 908, 909, 910, 911, 912, 913, 914, 915, 916, 917, 918, 919, 920,
|
||||
};
|
||||
|
||||
internal static readonly ushort[] Pouch_Ball_SM = { // 08
|
||||
1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 492, 493, 494, 495, 496, 497, 498, 576,
|
||||
851
|
||||
};
|
||||
|
||||
internal static readonly ushort[] Pouch_Battle_SM = { // 16
|
||||
55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 577,
|
||||
846,
|
||||
};
|
||||
|
||||
internal static readonly ushort[] Pouch_Items_SM = Pouch_Regular_SM.Concat(Pouch_Ball_SM).Concat(Pouch_Battle_SM).ToArray();
|
||||
|
||||
internal static readonly ushort[] Pouch_Key_SM = {
|
||||
|
|
@ -123,6 +128,7 @@ internal static int[] getRandomItemList()
|
|||
705, 706, 765, 773, 797,
|
||||
841, 842, 843, 845, 847, 850, 857, 858, 860,
|
||||
};
|
||||
|
||||
internal static readonly ushort[] Pouch_TMHM_SM = { // 02
|
||||
328, 329, 330, 331, 332, 333, 334, 335, 336, 337, 338, 339, 340, 341, 342, 343, 344, 345,
|
||||
346, 347, 348, 349, 350, 351, 352, 353, 354, 355, 356, 357, 358, 359, 360, 361, 362, 363,
|
||||
|
|
@ -131,21 +137,26 @@ internal static int[] getRandomItemList()
|
|||
400, 401, 402, 403, 404, 405, 406, 407, 408, 409, 410, 411, 412, 413, 414, 415, 416, 417,
|
||||
418, 419, 618, 619, 620, 690, 691, 692, 693, 694,
|
||||
};
|
||||
|
||||
internal static readonly ushort[] Pouch_Medicine_SM = { // 32
|
||||
17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 65, 66, 67, 134,
|
||||
504, 565, 566, 567, 568, 569, 570, 591, 708, 709,
|
||||
852,
|
||||
};
|
||||
|
||||
internal static readonly ushort[] Pouch_Berries_SM = {
|
||||
149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159, 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, 173, 174, 175, 176, 177, 178, 179, 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, 190, 191, 192, 193, 194, 195, 196, 197, 198, 199, 200, 201, 202, 203, 204, 205, 206, 207, 208, 209, 210, 211, 212,
|
||||
686, 687, 688,
|
||||
};
|
||||
|
||||
internal static readonly ushort[] Pouch_ZCrystal_SM = { // Bead
|
||||
807, 808, 809, 810, 811, 812, 813, 814, 815, 816, 817, 818, 819, 820, 821, 822, 823, 824, 825, 826, 827, 828, 829, 830, 831, 832, 833, 834, 835,
|
||||
};
|
||||
|
||||
internal static readonly ushort[] Pouch_ZCrystalHeld_SM = { // Piece
|
||||
776, 777, 778, 779, 780, 781, 782, 783, 784, 785, 786, 787, 788, 789, 790, 791, 792, 793, 794, 798, 799, 800, 801, 802, 803, 804, 805, 806, 836
|
||||
};
|
||||
|
||||
internal static readonly ushort[] HeldItems_SM = new ushort[1].Concat(Pouch_Items_SM).Concat(Pouch_Berries_SM).Concat(Pouch_Medicine_SM).Concat(Pouch_ZCrystalHeld_SM).ToArray();
|
||||
internal static readonly ushort[] HeldItemsBuy_SM = new ushort[1].Concat(Pouch_Items_SM).Concat(Pouch_Medicine_SM).ToArray();
|
||||
#endregion
|
||||
|
|
|
|||
272
pk3DS/Main.Designer.cs
generated
272
pk3DS/Main.Designer.cs
generated
|
|
@ -102,19 +102,19 @@ private void InitializeComponent()
|
|||
this.FLP_CRO.SuspendLayout();
|
||||
this.Tab_Output.SuspendLayout();
|
||||
this.SuspendLayout();
|
||||
//
|
||||
//
|
||||
// TB_Path
|
||||
//
|
||||
this.TB_Path.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
|
||||
//
|
||||
this.TB_Path.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
|
||||
| System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.TB_Path.Location = new System.Drawing.Point(158, 3);
|
||||
this.TB_Path.Name = "TB_Path";
|
||||
this.TB_Path.ReadOnly = true;
|
||||
this.TB_Path.Size = new System.Drawing.Size(214, 20);
|
||||
this.TB_Path.TabIndex = 1;
|
||||
//
|
||||
//
|
||||
// L_Game
|
||||
//
|
||||
//
|
||||
this.L_Game.AutoSize = true;
|
||||
this.L_Game.ForeColor = System.Drawing.Color.Red;
|
||||
this.L_Game.Location = new System.Drawing.Point(157, 23);
|
||||
|
|
@ -122,18 +122,18 @@ private void InitializeComponent()
|
|||
this.L_Game.Size = new System.Drawing.Size(91, 13);
|
||||
this.L_Game.TabIndex = 2;
|
||||
this.L_Game.Text = "No Game Loaded";
|
||||
//
|
||||
//
|
||||
// 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.Bottom | System.Windows.Forms.AnchorStyles.Left)
|
||||
| System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.pBar1.Location = new System.Drawing.Point(12, 225);
|
||||
this.pBar1.Name = "pBar1";
|
||||
this.pBar1.Size = new System.Drawing.Size(360, 14);
|
||||
this.pBar1.TabIndex = 6;
|
||||
//
|
||||
//
|
||||
// B_OPower
|
||||
//
|
||||
//
|
||||
this.B_OPower.Location = new System.Drawing.Point(215, 32);
|
||||
this.B_OPower.Name = "B_OPower";
|
||||
this.B_OPower.Size = new System.Drawing.Size(100, 23);
|
||||
|
|
@ -141,9 +141,9 @@ private void InitializeComponent()
|
|||
this.B_OPower.Text = "O-Powers";
|
||||
this.B_OPower.UseVisualStyleBackColor = true;
|
||||
this.B_OPower.Click += new System.EventHandler(this.B_OPower_Click);
|
||||
//
|
||||
//
|
||||
// B_Pickup
|
||||
//
|
||||
//
|
||||
this.B_Pickup.Location = new System.Drawing.Point(109, 32);
|
||||
this.B_Pickup.Name = "B_Pickup";
|
||||
this.B_Pickup.Size = new System.Drawing.Size(100, 23);
|
||||
|
|
@ -151,9 +151,9 @@ private void InitializeComponent()
|
|||
this.B_Pickup.Text = "Pickup Items";
|
||||
this.B_Pickup.UseVisualStyleBackColor = true;
|
||||
this.B_Pickup.Click += new System.EventHandler(this.B_Pickup_Click);
|
||||
//
|
||||
//
|
||||
// B_Mart
|
||||
//
|
||||
//
|
||||
this.B_Mart.Location = new System.Drawing.Point(3, 32);
|
||||
this.B_Mart.Name = "B_Mart";
|
||||
this.B_Mart.Size = new System.Drawing.Size(100, 23);
|
||||
|
|
@ -161,9 +161,9 @@ private void InitializeComponent()
|
|||
this.B_Mart.Text = "Poké Mart";
|
||||
this.B_Mart.UseVisualStyleBackColor = true;
|
||||
this.B_Mart.Click += new System.EventHandler(this.B_Mart_Click);
|
||||
//
|
||||
//
|
||||
// B_MoveTutor
|
||||
//
|
||||
//
|
||||
this.B_MoveTutor.Location = new System.Drawing.Point(3, 3);
|
||||
this.B_MoveTutor.Name = "B_MoveTutor";
|
||||
this.B_MoveTutor.Size = new System.Drawing.Size(100, 23);
|
||||
|
|
@ -171,9 +171,9 @@ private void InitializeComponent()
|
|||
this.B_MoveTutor.Text = "Move Tutors";
|
||||
this.B_MoveTutor.UseVisualStyleBackColor = true;
|
||||
this.B_MoveTutor.Click += new System.EventHandler(this.B_MoveTutor_Click);
|
||||
//
|
||||
//
|
||||
// B_TMHM
|
||||
//
|
||||
//
|
||||
this.B_TMHM.Location = new System.Drawing.Point(109, 3);
|
||||
this.B_TMHM.Name = "B_TMHM";
|
||||
this.B_TMHM.Size = new System.Drawing.Size(100, 23);
|
||||
|
|
@ -181,9 +181,9 @@ private void InitializeComponent()
|
|||
this.B_TMHM.Text = "TMs/HMs";
|
||||
this.B_TMHM.UseVisualStyleBackColor = true;
|
||||
this.B_TMHM.Click += new System.EventHandler(this.B_TMHM_Click);
|
||||
//
|
||||
//
|
||||
// RTB_Status
|
||||
//
|
||||
//
|
||||
this.RTB_Status.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
this.RTB_Status.Location = new System.Drawing.Point(0, 0);
|
||||
this.RTB_Status.Name = "RTB_Status";
|
||||
|
|
@ -191,9 +191,9 @@ private void InitializeComponent()
|
|||
this.RTB_Status.Size = new System.Drawing.Size(352, 154);
|
||||
this.RTB_Status.TabIndex = 7;
|
||||
this.RTB_Status.Text = "";
|
||||
//
|
||||
//
|
||||
// menuStrip1
|
||||
//
|
||||
//
|
||||
this.menuStrip1.BackColor = System.Drawing.Color.Transparent;
|
||||
this.menuStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
|
||||
this.Menu_File,
|
||||
|
|
@ -204,34 +204,34 @@ private void InitializeComponent()
|
|||
this.menuStrip1.Size = new System.Drawing.Size(384, 24);
|
||||
this.menuStrip1.TabIndex = 9;
|
||||
this.menuStrip1.Text = "menuStrip1";
|
||||
//
|
||||
//
|
||||
// Menu_File
|
||||
//
|
||||
//
|
||||
this.Menu_File.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
|
||||
this.Menu_Open,
|
||||
this.Menu_Exit});
|
||||
this.Menu_File.Name = "Menu_File";
|
||||
this.Menu_File.Size = new System.Drawing.Size(37, 20);
|
||||
this.Menu_File.Text = "File";
|
||||
//
|
||||
//
|
||||
// Menu_Open
|
||||
//
|
||||
//
|
||||
this.Menu_Open.Name = "Menu_Open";
|
||||
this.Menu_Open.ShortcutKeys = ((System.Windows.Forms.Keys)((System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.O)));
|
||||
this.Menu_Open.Size = new System.Drawing.Size(155, 22);
|
||||
this.Menu_Open.Text = "&Open...";
|
||||
this.Menu_Open.Click += new System.EventHandler(this.B_Open_Click);
|
||||
//
|
||||
//
|
||||
// Menu_Exit
|
||||
//
|
||||
//
|
||||
this.Menu_Exit.Name = "Menu_Exit";
|
||||
this.Menu_Exit.ShortcutKeys = ((System.Windows.Forms.Keys)((System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.Q)));
|
||||
this.Menu_Exit.Size = new System.Drawing.Size(155, 22);
|
||||
this.Menu_Exit.Text = "&Exit";
|
||||
this.Menu_Exit.Click += new System.EventHandler(this.Menu_Exit_Click);
|
||||
//
|
||||
//
|
||||
// Menu_Tools
|
||||
//
|
||||
//
|
||||
this.Menu_Tools.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
|
||||
this.Menu_Restore,
|
||||
this.Menu_Misc,
|
||||
|
|
@ -241,17 +241,17 @@ private void InitializeComponent()
|
|||
this.Menu_Tools.Name = "Menu_Tools";
|
||||
this.Menu_Tools.Size = new System.Drawing.Size(47, 20);
|
||||
this.Menu_Tools.Text = "Tools";
|
||||
//
|
||||
//
|
||||
// Menu_Restore
|
||||
//
|
||||
//
|
||||
this.Menu_Restore.Enabled = false;
|
||||
this.Menu_Restore.Name = "Menu_Restore";
|
||||
this.Menu_Restore.Size = new System.Drawing.Size(184, 22);
|
||||
this.Menu_Restore.Text = "Restore Original Files";
|
||||
this.Menu_Restore.Click += new System.EventHandler(this.L_Game_Click);
|
||||
//
|
||||
//
|
||||
// Menu_Misc
|
||||
//
|
||||
//
|
||||
this.Menu_Misc.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
|
||||
this.unPackBCLIMToolStripMenuItem,
|
||||
this.Menu_BLZ,
|
||||
|
|
@ -260,41 +260,41 @@ private void InitializeComponent()
|
|||
this.Menu_Misc.Name = "Menu_Misc";
|
||||
this.Menu_Misc.Size = new System.Drawing.Size(184, 22);
|
||||
this.Menu_Misc.Text = "Misc Tools";
|
||||
//
|
||||
//
|
||||
// unPackBCLIMToolStripMenuItem
|
||||
//
|
||||
//
|
||||
this.unPackBCLIMToolStripMenuItem.Name = "unPackBCLIMToolStripMenuItem";
|
||||
this.unPackBCLIMToolStripMenuItem.ShortcutKeys = ((System.Windows.Forms.Keys)((System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.T)));
|
||||
this.unPackBCLIMToolStripMenuItem.Size = new System.Drawing.Size(216, 22);
|
||||
this.unPackBCLIMToolStripMenuItem.Text = "(un)Pack + BCLIM";
|
||||
this.unPackBCLIMToolStripMenuItem.Click += new System.EventHandler(this.L_SubTools_Click);
|
||||
//
|
||||
//
|
||||
// Menu_BLZ
|
||||
//
|
||||
//
|
||||
this.Menu_BLZ.Name = "Menu_BLZ";
|
||||
this.Menu_BLZ.ShortcutKeys = ((System.Windows.Forms.Keys)((System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.B)));
|
||||
this.Menu_BLZ.Size = new System.Drawing.Size(216, 22);
|
||||
this.Menu_BLZ.Text = "(de)Compress BLZ";
|
||||
this.Menu_BLZ.Click += new System.EventHandler(this.Menu_BLZ_Click);
|
||||
//
|
||||
//
|
||||
// Menu_LZ11
|
||||
//
|
||||
//
|
||||
this.Menu_LZ11.Name = "Menu_LZ11";
|
||||
this.Menu_LZ11.ShortcutKeys = ((System.Windows.Forms.Keys)((System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.L)));
|
||||
this.Menu_LZ11.Size = new System.Drawing.Size(216, 22);
|
||||
this.Menu_LZ11.Text = "(de)Compress LZ11";
|
||||
this.Menu_LZ11.Click += new System.EventHandler(this.Menu_LZ11_Click);
|
||||
//
|
||||
//
|
||||
// Menu_Shuffler
|
||||
//
|
||||
//
|
||||
this.Menu_Shuffler.Enabled = false;
|
||||
this.Menu_Shuffler.Name = "Menu_Shuffler";
|
||||
this.Menu_Shuffler.Size = new System.Drawing.Size(216, 22);
|
||||
this.Menu_Shuffler.Text = "GARC Shuffler";
|
||||
this.Menu_Shuffler.Click += new System.EventHandler(this.Menu_Shuffler_Click);
|
||||
//
|
||||
//
|
||||
// Menu_Rebuild
|
||||
//
|
||||
//
|
||||
this.Menu_Rebuild.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
|
||||
this.Menu_RomFS,
|
||||
this.Menu_ExeFS,
|
||||
|
|
@ -304,71 +304,71 @@ private void InitializeComponent()
|
|||
this.Menu_Rebuild.Name = "Menu_Rebuild";
|
||||
this.Menu_Rebuild.Size = new System.Drawing.Size(184, 22);
|
||||
this.Menu_Rebuild.Text = "Rebuild...";
|
||||
//
|
||||
//
|
||||
// Menu_RomFS
|
||||
//
|
||||
//
|
||||
this.Menu_RomFS.Enabled = false;
|
||||
this.Menu_RomFS.Name = "Menu_RomFS";
|
||||
this.Menu_RomFS.Size = new System.Drawing.Size(111, 22);
|
||||
this.Menu_RomFS.Text = "RomFS";
|
||||
this.Menu_RomFS.Click += new System.EventHandler(this.rebuildRomFS);
|
||||
//
|
||||
//
|
||||
// Menu_ExeFS
|
||||
//
|
||||
//
|
||||
this.Menu_ExeFS.Enabled = false;
|
||||
this.Menu_ExeFS.Name = "Menu_ExeFS";
|
||||
this.Menu_ExeFS.Size = new System.Drawing.Size(111, 22);
|
||||
this.Menu_ExeFS.Text = "ExeFS";
|
||||
this.Menu_ExeFS.Click += new System.EventHandler(this.rebuildExeFS);
|
||||
//
|
||||
//
|
||||
// Menu_CRO
|
||||
//
|
||||
//
|
||||
this.Menu_CRO.Enabled = false;
|
||||
this.Menu_CRO.Name = "Menu_CRO";
|
||||
this.Menu_CRO.Size = new System.Drawing.Size(111, 22);
|
||||
this.Menu_CRO.Text = "CRO";
|
||||
this.Menu_CRO.Click += new System.EventHandler(this.patchCRO_CRR);
|
||||
//
|
||||
//
|
||||
// Menu_3DS
|
||||
//
|
||||
//
|
||||
this.Menu_3DS.Enabled = false;
|
||||
this.Menu_3DS.Name = "Menu_3DS";
|
||||
this.Menu_3DS.Size = new System.Drawing.Size(111, 22);
|
||||
this.Menu_3DS.Text = ".3DS";
|
||||
this.Menu_3DS.Click += new System.EventHandler(this.B_Rebuild3DS_Click);
|
||||
//
|
||||
//
|
||||
// Menu_Patch
|
||||
//
|
||||
//
|
||||
this.Menu_Patch.Enabled = false;
|
||||
this.Menu_Patch.Name = "Menu_Patch";
|
||||
this.Menu_Patch.Size = new System.Drawing.Size(111, 22);
|
||||
this.Menu_Patch.Text = "Patch";
|
||||
this.Menu_Patch.Click += new System.EventHandler(this.B_Patch_Click);
|
||||
//
|
||||
//
|
||||
// Menu_SMDH
|
||||
//
|
||||
//
|
||||
this.Menu_SMDH.Name = "Menu_SMDH";
|
||||
this.Menu_SMDH.Size = new System.Drawing.Size(184, 22);
|
||||
this.Menu_SMDH.Text = "SMDH Editor (Icon)";
|
||||
this.Menu_SMDH.Click += new System.EventHandler(this.Menu_SMDH_Click);
|
||||
//
|
||||
//
|
||||
// randomizationToolStripMenuItem
|
||||
//
|
||||
//
|
||||
this.randomizationToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
|
||||
this.setInt32SeedToolStripMenuItem});
|
||||
this.randomizationToolStripMenuItem.Name = "randomizationToolStripMenuItem";
|
||||
this.randomizationToolStripMenuItem.Size = new System.Drawing.Size(184, 22);
|
||||
this.randomizationToolStripMenuItem.Text = "Randomization";
|
||||
//
|
||||
//
|
||||
// setInt32SeedToolStripMenuItem
|
||||
//
|
||||
//
|
||||
this.setInt32SeedToolStripMenuItem.Name = "setInt32SeedToolStripMenuItem";
|
||||
this.setInt32SeedToolStripMenuItem.Size = new System.Drawing.Size(146, 22);
|
||||
this.setInt32SeedToolStripMenuItem.Text = "Set int32 seed";
|
||||
this.setInt32SeedToolStripMenuItem.Click += new System.EventHandler(this.setInt32SeedToolStripMenuItem_Click);
|
||||
//
|
||||
//
|
||||
// Menu_Options
|
||||
//
|
||||
//
|
||||
this.Menu_Options.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
|
||||
this.Menu_Language,
|
||||
this.Menu_About,
|
||||
|
|
@ -376,17 +376,17 @@ private void InitializeComponent()
|
|||
this.Menu_Options.Name = "Menu_Options";
|
||||
this.Menu_Options.Size = new System.Drawing.Size(61, 20);
|
||||
this.Menu_Options.Text = "Options";
|
||||
//
|
||||
//
|
||||
// Menu_Language
|
||||
//
|
||||
//
|
||||
this.Menu_Language.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
|
||||
this.CB_Lang});
|
||||
this.Menu_Language.Name = "Menu_Language";
|
||||
this.Menu_Language.Size = new System.Drawing.Size(146, 22);
|
||||
this.Menu_Language.Text = "Language";
|
||||
//
|
||||
//
|
||||
// CB_Lang
|
||||
//
|
||||
//
|
||||
this.CB_Lang.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
|
||||
this.CB_Lang.Items.AddRange(new object[] {
|
||||
"カタカナ",
|
||||
|
|
@ -401,28 +401,28 @@ private void InitializeComponent()
|
|||
"漢字簡化方案"});
|
||||
this.CB_Lang.Name = "CB_Lang";
|
||||
this.CB_Lang.Size = new System.Drawing.Size(121, 23);
|
||||
this.CB_Lang.SelectedIndexChanged += new System.EventHandler(this.changeLanguage);
|
||||
//
|
||||
this.CB_Lang.SelectedIndexChanged += new System.EventHandler(this.ChangeLanguage);
|
||||
//
|
||||
// Menu_About
|
||||
//
|
||||
//
|
||||
this.Menu_About.Name = "Menu_About";
|
||||
this.Menu_About.ShortcutKeys = ((System.Windows.Forms.Keys)((System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.B)));
|
||||
this.Menu_About.ShowShortcutKeys = false;
|
||||
this.Menu_About.Size = new System.Drawing.Size(146, 22);
|
||||
this.Menu_About.Text = "A&bout pk3DS";
|
||||
this.Menu_About.Click += new System.EventHandler(this.L_About_Click);
|
||||
//
|
||||
//
|
||||
// Menu_GARCs
|
||||
//
|
||||
//
|
||||
this.Menu_GARCs.Name = "Menu_GARCs";
|
||||
this.Menu_GARCs.Size = new System.Drawing.Size(146, 22);
|
||||
this.Menu_GARCs.Text = "About GARCs";
|
||||
this.Menu_GARCs.Click += new System.EventHandler(this.L_GARCInfo_Click);
|
||||
//
|
||||
//
|
||||
// TC_RomFS
|
||||
//
|
||||
this.TC_RomFS.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
|
||||
| System.Windows.Forms.AnchorStyles.Left)
|
||||
//
|
||||
this.TC_RomFS.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.TC_RomFS.Controls.Add(this.Tab_RomFS);
|
||||
this.TC_RomFS.Controls.Add(this.Tab_ExeFS);
|
||||
|
|
@ -433,9 +433,9 @@ private void InitializeComponent()
|
|||
this.TC_RomFS.SelectedIndex = 0;
|
||||
this.TC_RomFS.Size = new System.Drawing.Size(360, 180);
|
||||
this.TC_RomFS.TabIndex = 11;
|
||||
//
|
||||
//
|
||||
// Tab_RomFS
|
||||
//
|
||||
//
|
||||
this.Tab_RomFS.Controls.Add(this.FLP_RomFS);
|
||||
this.Tab_RomFS.Location = new System.Drawing.Point(4, 22);
|
||||
this.Tab_RomFS.Name = "Tab_RomFS";
|
||||
|
|
@ -444,9 +444,9 @@ private void InitializeComponent()
|
|||
this.Tab_RomFS.TabIndex = 0;
|
||||
this.Tab_RomFS.Text = "RomFS";
|
||||
this.Tab_RomFS.UseVisualStyleBackColor = true;
|
||||
//
|
||||
//
|
||||
// FLP_RomFS
|
||||
//
|
||||
//
|
||||
this.FLP_RomFS.AutoScroll = true;
|
||||
this.FLP_RomFS.Controls.Add(this.B_GameText);
|
||||
this.FLP_RomFS.Controls.Add(this.B_StoryText);
|
||||
|
|
@ -468,9 +468,9 @@ private void InitializeComponent()
|
|||
this.FLP_RomFS.Name = "FLP_RomFS";
|
||||
this.FLP_RomFS.Size = new System.Drawing.Size(346, 148);
|
||||
this.FLP_RomFS.TabIndex = 13;
|
||||
//
|
||||
//
|
||||
// B_GameText
|
||||
//
|
||||
//
|
||||
this.B_GameText.Location = new System.Drawing.Point(3, 3);
|
||||
this.B_GameText.Name = "B_GameText";
|
||||
this.B_GameText.Size = new System.Drawing.Size(100, 23);
|
||||
|
|
@ -478,9 +478,9 @@ private void InitializeComponent()
|
|||
this.B_GameText.Text = "Game Text";
|
||||
this.B_GameText.UseVisualStyleBackColor = true;
|
||||
this.B_GameText.Click += new System.EventHandler(this.B_GameText_Click);
|
||||
//
|
||||
//
|
||||
// B_StoryText
|
||||
//
|
||||
//
|
||||
this.B_StoryText.Location = new System.Drawing.Point(109, 3);
|
||||
this.B_StoryText.Name = "B_StoryText";
|
||||
this.B_StoryText.Size = new System.Drawing.Size(100, 23);
|
||||
|
|
@ -488,9 +488,9 @@ private void InitializeComponent()
|
|||
this.B_StoryText.Text = "Story Text";
|
||||
this.B_StoryText.UseVisualStyleBackColor = true;
|
||||
this.B_StoryText.Click += new System.EventHandler(this.B_StoryText_Click);
|
||||
//
|
||||
//
|
||||
// B_Personal
|
||||
//
|
||||
//
|
||||
this.B_Personal.Location = new System.Drawing.Point(215, 3);
|
||||
this.B_Personal.Name = "B_Personal";
|
||||
this.B_Personal.Size = new System.Drawing.Size(100, 23);
|
||||
|
|
@ -498,9 +498,9 @@ private void InitializeComponent()
|
|||
this.B_Personal.Text = "Personal Stats";
|
||||
this.B_Personal.UseVisualStyleBackColor = true;
|
||||
this.B_Personal.Click += new System.EventHandler(this.B_Personal_Click);
|
||||
//
|
||||
//
|
||||
// B_Evolution
|
||||
//
|
||||
//
|
||||
this.B_Evolution.Location = new System.Drawing.Point(3, 32);
|
||||
this.B_Evolution.Name = "B_Evolution";
|
||||
this.B_Evolution.Size = new System.Drawing.Size(100, 23);
|
||||
|
|
@ -508,9 +508,9 @@ private void InitializeComponent()
|
|||
this.B_Evolution.Text = "Evolutions";
|
||||
this.B_Evolution.UseVisualStyleBackColor = true;
|
||||
this.B_Evolution.Click += new System.EventHandler(this.B_Evolution_Click);
|
||||
//
|
||||
//
|
||||
// B_LevelUp
|
||||
//
|
||||
//
|
||||
this.B_LevelUp.Location = new System.Drawing.Point(109, 32);
|
||||
this.B_LevelUp.Name = "B_LevelUp";
|
||||
this.B_LevelUp.Size = new System.Drawing.Size(100, 23);
|
||||
|
|
@ -518,9 +518,9 @@ private void InitializeComponent()
|
|||
this.B_LevelUp.Text = "Level Up Moves";
|
||||
this.B_LevelUp.UseVisualStyleBackColor = true;
|
||||
this.B_LevelUp.Click += new System.EventHandler(this.B_LevelUp_Click);
|
||||
//
|
||||
//
|
||||
// B_Wild
|
||||
//
|
||||
//
|
||||
this.B_Wild.Location = new System.Drawing.Point(215, 32);
|
||||
this.B_Wild.Name = "B_Wild";
|
||||
this.B_Wild.Size = new System.Drawing.Size(100, 23);
|
||||
|
|
@ -528,9 +528,9 @@ private void InitializeComponent()
|
|||
this.B_Wild.Text = "Wild Encounters";
|
||||
this.B_Wild.UseVisualStyleBackColor = true;
|
||||
this.B_Wild.Click += new System.EventHandler(this.B_Wild_Click);
|
||||
//
|
||||
//
|
||||
// B_MegaEvo
|
||||
//
|
||||
//
|
||||
this.B_MegaEvo.Location = new System.Drawing.Point(3, 61);
|
||||
this.B_MegaEvo.Name = "B_MegaEvo";
|
||||
this.B_MegaEvo.Size = new System.Drawing.Size(100, 23);
|
||||
|
|
@ -538,9 +538,9 @@ private void InitializeComponent()
|
|||
this.B_MegaEvo.Text = "Mega Evolutions";
|
||||
this.B_MegaEvo.UseVisualStyleBackColor = true;
|
||||
this.B_MegaEvo.Click += new System.EventHandler(this.B_MegaEvo_Click);
|
||||
//
|
||||
//
|
||||
// B_EggMove
|
||||
//
|
||||
//
|
||||
this.B_EggMove.Location = new System.Drawing.Point(109, 61);
|
||||
this.B_EggMove.Name = "B_EggMove";
|
||||
this.B_EggMove.Size = new System.Drawing.Size(100, 23);
|
||||
|
|
@ -548,9 +548,9 @@ private void InitializeComponent()
|
|||
this.B_EggMove.Text = "Egg Moves";
|
||||
this.B_EggMove.UseVisualStyleBackColor = true;
|
||||
this.B_EggMove.Click += new System.EventHandler(this.B_EggMove_Click);
|
||||
//
|
||||
//
|
||||
// B_Trainer
|
||||
//
|
||||
//
|
||||
this.B_Trainer.Location = new System.Drawing.Point(215, 61);
|
||||
this.B_Trainer.Name = "B_Trainer";
|
||||
this.B_Trainer.Size = new System.Drawing.Size(100, 23);
|
||||
|
|
@ -558,9 +558,9 @@ private void InitializeComponent()
|
|||
this.B_Trainer.Text = "Trainers";
|
||||
this.B_Trainer.UseVisualStyleBackColor = true;
|
||||
this.B_Trainer.Click += new System.EventHandler(this.B_Trainer_Click);
|
||||
//
|
||||
//
|
||||
// B_Maison
|
||||
//
|
||||
//
|
||||
this.B_Maison.Location = new System.Drawing.Point(3, 90);
|
||||
this.B_Maison.Name = "B_Maison";
|
||||
this.B_Maison.Size = new System.Drawing.Size(100, 23);
|
||||
|
|
@ -568,9 +568,9 @@ private void InitializeComponent()
|
|||
this.B_Maison.Text = "Battle Maison";
|
||||
this.B_Maison.UseVisualStyleBackColor = true;
|
||||
this.B_Maison.Click += new System.EventHandler(this.B_Maison_Click);
|
||||
//
|
||||
//
|
||||
// B_Royal
|
||||
//
|
||||
//
|
||||
this.B_Royal.Location = new System.Drawing.Point(109, 90);
|
||||
this.B_Royal.Name = "B_Royal";
|
||||
this.B_Royal.Size = new System.Drawing.Size(100, 23);
|
||||
|
|
@ -578,9 +578,9 @@ private void InitializeComponent()
|
|||
this.B_Royal.Text = "Battle Royal/Tree";
|
||||
this.B_Royal.UseVisualStyleBackColor = true;
|
||||
this.B_Royal.Click += new System.EventHandler(this.B_Maison_Click);
|
||||
//
|
||||
//
|
||||
// B_Item
|
||||
//
|
||||
//
|
||||
this.B_Item.Location = new System.Drawing.Point(215, 90);
|
||||
this.B_Item.Name = "B_Item";
|
||||
this.B_Item.Size = new System.Drawing.Size(100, 23);
|
||||
|
|
@ -588,9 +588,9 @@ private void InitializeComponent()
|
|||
this.B_Item.Text = "Item Stats";
|
||||
this.B_Item.UseVisualStyleBackColor = true;
|
||||
this.B_Item.Click += new System.EventHandler(this.B_Item_Click);
|
||||
//
|
||||
//
|
||||
// B_Move
|
||||
//
|
||||
//
|
||||
this.B_Move.Location = new System.Drawing.Point(3, 119);
|
||||
this.B_Move.Name = "B_Move";
|
||||
this.B_Move.Size = new System.Drawing.Size(100, 23);
|
||||
|
|
@ -598,9 +598,9 @@ private void InitializeComponent()
|
|||
this.B_Move.Text = "Move Stats";
|
||||
this.B_Move.UseVisualStyleBackColor = true;
|
||||
this.B_Move.Click += new System.EventHandler(this.B_Move_Click);
|
||||
//
|
||||
//
|
||||
// B_TitleScreen
|
||||
//
|
||||
//
|
||||
this.B_TitleScreen.Location = new System.Drawing.Point(109, 119);
|
||||
this.B_TitleScreen.Name = "B_TitleScreen";
|
||||
this.B_TitleScreen.Size = new System.Drawing.Size(100, 23);
|
||||
|
|
@ -608,9 +608,9 @@ private void InitializeComponent()
|
|||
this.B_TitleScreen.Text = "Title Screen";
|
||||
this.B_TitleScreen.UseVisualStyleBackColor = true;
|
||||
this.B_TitleScreen.Click += new System.EventHandler(this.B_TitleScreen_Click);
|
||||
//
|
||||
//
|
||||
// B_OWSE
|
||||
//
|
||||
//
|
||||
this.B_OWSE.Location = new System.Drawing.Point(215, 119);
|
||||
this.B_OWSE.Name = "B_OWSE";
|
||||
this.B_OWSE.Size = new System.Drawing.Size(100, 23);
|
||||
|
|
@ -618,9 +618,9 @@ private void InitializeComponent()
|
|||
this.B_OWSE.Text = "OWSE [Dev]";
|
||||
this.B_OWSE.UseVisualStyleBackColor = true;
|
||||
this.B_OWSE.Click += new System.EventHandler(this.B_OWSE_Click);
|
||||
//
|
||||
//
|
||||
// Tab_ExeFS
|
||||
//
|
||||
//
|
||||
this.Tab_ExeFS.Controls.Add(this.FLP_ExeFS);
|
||||
this.Tab_ExeFS.Location = new System.Drawing.Point(4, 22);
|
||||
this.Tab_ExeFS.Name = "Tab_ExeFS";
|
||||
|
|
@ -629,9 +629,9 @@ private void InitializeComponent()
|
|||
this.Tab_ExeFS.TabIndex = 1;
|
||||
this.Tab_ExeFS.Text = "ExeFS";
|
||||
this.Tab_ExeFS.UseVisualStyleBackColor = true;
|
||||
//
|
||||
//
|
||||
// FLP_ExeFS
|
||||
//
|
||||
//
|
||||
this.FLP_ExeFS.AutoScroll = true;
|
||||
this.FLP_ExeFS.Controls.Add(this.B_MoveTutor);
|
||||
this.FLP_ExeFS.Controls.Add(this.B_TMHM);
|
||||
|
|
@ -645,9 +645,9 @@ private void InitializeComponent()
|
|||
this.FLP_ExeFS.Name = "FLP_ExeFS";
|
||||
this.FLP_ExeFS.Size = new System.Drawing.Size(346, 148);
|
||||
this.FLP_ExeFS.TabIndex = 11;
|
||||
//
|
||||
//
|
||||
// B_TM
|
||||
//
|
||||
//
|
||||
this.B_TM.Location = new System.Drawing.Point(215, 3);
|
||||
this.B_TM.Name = "B_TM";
|
||||
this.B_TM.Size = new System.Drawing.Size(100, 23);
|
||||
|
|
@ -655,9 +655,9 @@ private void InitializeComponent()
|
|||
this.B_TM.Text = "TMs";
|
||||
this.B_TM.UseVisualStyleBackColor = true;
|
||||
this.B_TM.Click += new System.EventHandler(this.B_TMHM_Click);
|
||||
//
|
||||
//
|
||||
// B_ShinyRate
|
||||
//
|
||||
//
|
||||
this.B_ShinyRate.Location = new System.Drawing.Point(3, 61);
|
||||
this.B_ShinyRate.Name = "B_ShinyRate";
|
||||
this.B_ShinyRate.Size = new System.Drawing.Size(100, 23);
|
||||
|
|
@ -665,9 +665,9 @@ private void InitializeComponent()
|
|||
this.B_ShinyRate.Text = "Shiny Rate";
|
||||
this.B_ShinyRate.UseVisualStyleBackColor = true;
|
||||
this.B_ShinyRate.Click += new System.EventHandler(this.B_ShinyRate_Click);
|
||||
//
|
||||
//
|
||||
// Tab_CRO
|
||||
//
|
||||
//
|
||||
this.Tab_CRO.Controls.Add(this.FLP_CRO);
|
||||
this.Tab_CRO.Location = new System.Drawing.Point(4, 22);
|
||||
this.Tab_CRO.Name = "Tab_CRO";
|
||||
|
|
@ -675,9 +675,9 @@ private void InitializeComponent()
|
|||
this.Tab_CRO.TabIndex = 2;
|
||||
this.Tab_CRO.Text = "CRO";
|
||||
this.Tab_CRO.UseVisualStyleBackColor = true;
|
||||
//
|
||||
//
|
||||
// FLP_CRO
|
||||
//
|
||||
//
|
||||
this.FLP_CRO.Controls.Add(this.B_TypeChart);
|
||||
this.FLP_CRO.Controls.Add(this.B_Starter);
|
||||
this.FLP_CRO.Controls.Add(this.B_Gift);
|
||||
|
|
@ -688,9 +688,9 @@ private void InitializeComponent()
|
|||
this.FLP_CRO.Padding = new System.Windows.Forms.Padding(3);
|
||||
this.FLP_CRO.Size = new System.Drawing.Size(352, 154);
|
||||
this.FLP_CRO.TabIndex = 1;
|
||||
//
|
||||
//
|
||||
// B_TypeChart
|
||||
//
|
||||
//
|
||||
this.B_TypeChart.Location = new System.Drawing.Point(6, 6);
|
||||
this.B_TypeChart.Name = "B_TypeChart";
|
||||
this.B_TypeChart.Size = new System.Drawing.Size(100, 23);
|
||||
|
|
@ -698,9 +698,9 @@ private void InitializeComponent()
|
|||
this.B_TypeChart.Text = "Type Chart";
|
||||
this.B_TypeChart.UseVisualStyleBackColor = true;
|
||||
this.B_TypeChart.Click += new System.EventHandler(this.B_TypeChart_Click);
|
||||
//
|
||||
//
|
||||
// B_Starter
|
||||
//
|
||||
//
|
||||
this.B_Starter.Location = new System.Drawing.Point(112, 6);
|
||||
this.B_Starter.Name = "B_Starter";
|
||||
this.B_Starter.Size = new System.Drawing.Size(100, 23);
|
||||
|
|
@ -708,9 +708,9 @@ private void InitializeComponent()
|
|||
this.B_Starter.Text = "Starter Pokémon";
|
||||
this.B_Starter.UseVisualStyleBackColor = true;
|
||||
this.B_Starter.Click += new System.EventHandler(this.B_Starter_Click);
|
||||
//
|
||||
//
|
||||
// B_Gift
|
||||
//
|
||||
//
|
||||
this.B_Gift.Location = new System.Drawing.Point(218, 6);
|
||||
this.B_Gift.Name = "B_Gift";
|
||||
this.B_Gift.Size = new System.Drawing.Size(100, 23);
|
||||
|
|
@ -718,9 +718,9 @@ private void InitializeComponent()
|
|||
this.B_Gift.Text = "Gift Pokémon";
|
||||
this.B_Gift.UseVisualStyleBackColor = true;
|
||||
this.B_Gift.Click += new System.EventHandler(this.B_Gift_Click);
|
||||
//
|
||||
//
|
||||
// B_Static
|
||||
//
|
||||
//
|
||||
this.B_Static.Location = new System.Drawing.Point(6, 35);
|
||||
this.B_Static.Name = "B_Static";
|
||||
this.B_Static.Size = new System.Drawing.Size(100, 23);
|
||||
|
|
@ -728,9 +728,9 @@ private void InitializeComponent()
|
|||
this.B_Static.Text = "Static Encounters";
|
||||
this.B_Static.UseVisualStyleBackColor = true;
|
||||
this.B_Static.Click += new System.EventHandler(this.B_Static_Click);
|
||||
//
|
||||
//
|
||||
// Tab_Output
|
||||
//
|
||||
//
|
||||
this.Tab_Output.Controls.Add(this.RTB_Status);
|
||||
this.Tab_Output.Location = new System.Drawing.Point(4, 22);
|
||||
this.Tab_Output.Name = "Tab_Output";
|
||||
|
|
@ -738,17 +738,17 @@ private void InitializeComponent()
|
|||
this.Tab_Output.TabIndex = 3;
|
||||
this.Tab_Output.Text = "Output";
|
||||
this.Tab_Output.UseVisualStyleBackColor = true;
|
||||
//
|
||||
//
|
||||
// L_Status
|
||||
//
|
||||
//
|
||||
this.L_Status.Location = new System.Drawing.Point(203, 37);
|
||||
this.L_Status.Name = "L_Status";
|
||||
this.L_Status.Size = new System.Drawing.Size(163, 20);
|
||||
this.L_Status.TabIndex = 14;
|
||||
this.L_Status.TextAlign = System.Drawing.ContentAlignment.MiddleRight;
|
||||
//
|
||||
//
|
||||
// Main
|
||||
//
|
||||
//
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||
this.ClientSize = new System.Drawing.Size(384, 252);
|
||||
|
|
@ -763,7 +763,7 @@ private void InitializeComponent()
|
|||
this.Name = "Main";
|
||||
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
|
||||
this.Text = "pk3DS";
|
||||
this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.formClosing);
|
||||
this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.CloseForm);
|
||||
this.menuStrip1.ResumeLayout(false);
|
||||
this.menuStrip1.PerformLayout();
|
||||
this.TC_RomFS.ResumeLayout(false);
|
||||
|
|
|
|||
351
pk3DS/Main.cs
351
pk3DS/Main.cs
|
|
@ -59,6 +59,7 @@ public Main()
|
|||
if (File.Exists(RandSettings.FileName))
|
||||
RandSettings.Load(File.ReadAllLines(RandSettings.FileName));
|
||||
}
|
||||
|
||||
internal static GameConfig Config;
|
||||
public static string RomFSPath;
|
||||
public static string ExeFSPath;
|
||||
|
|
@ -75,19 +76,22 @@ private void L_About_Click(object sender, EventArgs e)
|
|||
{
|
||||
new About().ShowDialog();
|
||||
}
|
||||
|
||||
private void L_GARCInfo_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (RomFSPath == null)
|
||||
return;
|
||||
|
||||
string s = "Game Type: " + Config.Version + Environment.NewLine;
|
||||
s = Config.Files.Select(file => file.Name).Aggregate(s, (current, t) => current + string.Format(Environment.NewLine + "{0} - {1}", t, Config.getGARCFileName(t)));
|
||||
s = Config.Files.Select(file => file.Name).Aggregate(s, (current, t) => current + string.Format(Environment.NewLine + "{0} - {1}", t, Config.GetGARCFileName(t)));
|
||||
|
||||
if (DialogResult.Yes != WinFormsUtil.Prompt(MessageBoxButtons.YesNo, s, "Copy to Clipboard?")) return;
|
||||
if (DialogResult.Yes != WinFormsUtil.Prompt(MessageBoxButtons.YesNo, s, "Copy to Clipboard?"))
|
||||
return;
|
||||
|
||||
try { Clipboard.SetText(s); }
|
||||
catch { WinFormsUtil.Alert("Unable to copy to Clipboard."); }
|
||||
}
|
||||
|
||||
private void L_Game_Click(object sender, EventArgs e) => new EnhancedRestore(Config).ShowDialog();
|
||||
|
||||
private void B_Open_Click(object sender, EventArgs e)
|
||||
|
|
@ -96,7 +100,8 @@ private void B_Open_Click(object sender, EventArgs e)
|
|||
if (fbd.ShowDialog() == DialogResult.OK)
|
||||
openQuick(fbd.SelectedPath);
|
||||
}
|
||||
private void changeLanguage(object sender, EventArgs e)
|
||||
|
||||
private void ChangeLanguage(object sender, EventArgs e)
|
||||
{
|
||||
if (InvokeRequired)
|
||||
Invoke((MethodInvoker)delegate { Language = CB_Lang.SelectedIndex; });
|
||||
|
|
@ -121,13 +126,16 @@ private void changeLanguage(object sender, EventArgs e)
|
|||
Properties.Settings.Default.Language = Language;
|
||||
Properties.Settings.Default.Save();
|
||||
}
|
||||
|
||||
private void Menu_Exit_Click(object sender, EventArgs e)
|
||||
{
|
||||
Close();
|
||||
}
|
||||
private void formClosing(object sender, FormClosingEventArgs e)
|
||||
|
||||
private void CloseForm(object sender, FormClosingEventArgs e)
|
||||
{
|
||||
if (Config == null) return;
|
||||
if (Config == null)
|
||||
return;
|
||||
var g = Config.GARCGameText;
|
||||
string[][] files = Config.GameTextStrings;
|
||||
g.Files = files.Select(x => TextFile.getBytes(Config, x)).ToArray();
|
||||
|
|
@ -142,7 +150,8 @@ private void formClosing(object sender, FormClosingEventArgs e)
|
|||
|
||||
private void openQuick(string path)
|
||||
{
|
||||
if (threadActive()) return;
|
||||
if (threadActive())
|
||||
return;
|
||||
|
||||
if (!Directory.Exists(path)) // File
|
||||
{
|
||||
|
|
@ -169,7 +178,7 @@ private void openQuick(string path)
|
|||
if (dr == DialogResult.Cancel)
|
||||
return;
|
||||
bool recurse = dr == DialogResult.Yes;
|
||||
ToolsUI.openARC(path, pBar1, recurse);
|
||||
ToolsUI.OpenARC(path, pBar1, recurse);
|
||||
}
|
||||
}
|
||||
else // Directory
|
||||
|
|
@ -182,10 +191,10 @@ private void openQuick(string path)
|
|||
|
||||
// Find RomFS folder
|
||||
foreach (string f in folders.Where(f => new DirectoryInfo(f).Name.ToLower().Contains("rom") && Directory.Exists(f)))
|
||||
checkIfRomFS(f);
|
||||
CheckIfRomFS(f);
|
||||
// Find ExeFS folder
|
||||
foreach (string f in folders.Where(f => new DirectoryInfo(f).Name.ToLower().Contains("exe") && Directory.Exists(f)))
|
||||
checkIfExeFS(f);
|
||||
CheckIfExeFS(f);
|
||||
|
||||
if (count > 3)
|
||||
WinFormsUtil.Alert("pk3DS will function best if you keep your Game Files folder clean and free of unnecessary folders.");
|
||||
|
|
@ -195,7 +204,7 @@ private void openQuick(string path)
|
|||
Tab_ExeFS.Enabled = RomFSPath != null && ExeFSPath != null;
|
||||
if (RomFSPath != null)
|
||||
{
|
||||
toggleSubEditors();
|
||||
ToggleSubEditors();
|
||||
string newtext = $"Game Loaded: {Config.Version}";
|
||||
if (L_Game.Text != newtext && Directory.Exists("personal"))
|
||||
{ Directory.Delete("personal", true); } // Force reloading of personal data if the game is switched.
|
||||
|
|
@ -216,7 +225,7 @@ private void openQuick(string path)
|
|||
}
|
||||
|
||||
// Enable Rebuilding options if all files have been found
|
||||
checkIfExHeader(path);
|
||||
CheckIfExHeader(path);
|
||||
Menu_ExeFS.Enabled = ExeFSPath != null;
|
||||
Menu_RomFS.Enabled = Menu_Restore.Enabled = Menu_GARCs.Enabled = RomFSPath != null;
|
||||
Menu_Patch.Enabled = RomFSPath != null && ExeFSPath != null;
|
||||
|
|
@ -237,12 +246,14 @@ private void openQuick(string path)
|
|||
}
|
||||
}
|
||||
|
||||
private void toggleSubEditors()
|
||||
private void ToggleSubEditors()
|
||||
{
|
||||
// Hide all buttons
|
||||
foreach (var f in from TabPage t in TC_RomFS.TabPages from f in t.Controls.OfType<FlowLayoutPanel>() select f)
|
||||
{
|
||||
for (int i = f.Controls.Count - 1; i >= 0; i--)
|
||||
f.Controls.Remove(f.Controls[i]);
|
||||
}
|
||||
|
||||
B_MoveTutor.Visible = Config.ORAS; // Default false unless loaded
|
||||
|
||||
|
|
@ -273,6 +284,7 @@ private void toggleSubEditors()
|
|||
FLP_ExeFS.Controls.AddRange(exefs);
|
||||
FLP_CRO.Controls.AddRange(cro);
|
||||
}
|
||||
|
||||
private void updateGameInfo()
|
||||
{
|
||||
// 0 - JP
|
||||
|
|
@ -290,7 +302,8 @@ private void updateGameInfo()
|
|||
? "pk3DS" // nothing else
|
||||
: "pk3DS - " + SMDH.AppInfo[AILang[Language]].ShortDescription;
|
||||
}
|
||||
private static GameConfig checkGameType(string[] files)
|
||||
|
||||
private static GameConfig CheckGameType(string[] files)
|
||||
{
|
||||
try
|
||||
{
|
||||
|
|
@ -303,7 +316,8 @@ private static GameConfig checkGameType(string[] files)
|
|||
catch { }
|
||||
return null;
|
||||
}
|
||||
private bool checkIfRomFS(string path)
|
||||
|
||||
private bool CheckIfRomFS(string path)
|
||||
{
|
||||
string[] top = Directory.GetDirectories(path);
|
||||
FileInfo fi = new FileInfo(top[top.Length > 1 ? 1 : 0]);
|
||||
|
|
@ -311,7 +325,7 @@ private bool checkIfRomFS(string path)
|
|||
if (fi.Name == "a")
|
||||
{
|
||||
string[] files = Directory.GetFiles(path, "*", SearchOption.AllDirectories);
|
||||
var cfg = checkGameType(files);
|
||||
var cfg = CheckGameType(files);
|
||||
|
||||
if (cfg == null)
|
||||
{
|
||||
|
|
@ -329,10 +343,11 @@ private bool checkIfRomFS(string path)
|
|||
RomFSPath = null;
|
||||
return false;
|
||||
}
|
||||
private bool checkIfExeFS(string path)
|
||||
|
||||
private bool CheckIfExeFS(string path)
|
||||
{
|
||||
string[] files = Directory.GetFiles(path);
|
||||
if (files.Length == 1 && Path.GetFileName(files[0]).ToLower() == "exefs.bin")
|
||||
if (files.Length == 1 && string.Equals(Path.GetFileName(files[0]), "exefs.bin", StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
// Prompt if the user wants to unpack the ExeFS.
|
||||
if (DialogResult.Yes != WinFormsUtil.Prompt(MessageBoxButtons.YesNo, "Detected ExeFS binary.", "Unpack?"))
|
||||
|
|
@ -355,14 +370,12 @@ private bool checkIfExeFS(string path)
|
|||
FileInfo fi = new FileInfo(files[0]);
|
||||
if (!fi.Name.Contains("code"))
|
||||
{
|
||||
if (new FileInfo(files[1]).Name == "code.bin")
|
||||
{
|
||||
File.Move(files[1], Path.Combine(Path.GetDirectoryName(files[1]), ".code.bin"));
|
||||
files = Directory.GetFiles(path);
|
||||
fi = new FileInfo(files[0]);
|
||||
}
|
||||
else
|
||||
if (new FileInfo(files[1]).Name != "code.bin")
|
||||
return false;
|
||||
|
||||
File.Move(files[1], Path.Combine(Path.GetDirectoryName(files[1]), ".code.bin"));
|
||||
files = Directory.GetFiles(path);
|
||||
fi = new FileInfo(files[0]);
|
||||
}
|
||||
if (fi.Length % 0x200 != 0 && WinFormsUtil.Prompt(MessageBoxButtons.YesNo, "Detected Compressed code binary.", "Decompress? File will be replaced.") == DialogResult.Yes)
|
||||
new Thread(() => { threads++; new BLZCoder(new[] { "-d", files[0] }, pBar1); threads--; WinFormsUtil.Alert("Decompressed!"); }).Start();
|
||||
|
|
@ -370,25 +383,30 @@ private bool checkIfExeFS(string path)
|
|||
ExeFSPath = path;
|
||||
return true;
|
||||
}
|
||||
private bool checkIfExHeader(string path)
|
||||
|
||||
private bool CheckIfExHeader(string path)
|
||||
{
|
||||
ExHeaderPath = null;
|
||||
// Input folder path should contain the ExHeader.
|
||||
string[] files = Directory.GetFiles(path);
|
||||
foreach (string fp in from s in files let f = new FileInfo(s) where (f.Name.ToLower().StartsWith("exh") || f.Name.ToLower().StartsWith("decryptedexh")) && f.Length == 0x800 select s)
|
||||
foreach (string fp in from s in files let f = new FileInfo(s) where (f.Name.StartsWith("exh", StringComparison.OrdinalIgnoreCase) || f.Name.StartsWith("decryptedexh", StringComparison.OrdinalIgnoreCase)) && f.Length == 0x800 select s)
|
||||
ExHeaderPath = fp;
|
||||
|
||||
return ExHeaderPath != null;
|
||||
}
|
||||
|
||||
private bool threadActive()
|
||||
{
|
||||
if (threads <= 0) return false;
|
||||
if (threads <= 0)
|
||||
return false;
|
||||
WinFormsUtil.Alert("Please wait for all operations to finish first."); return true;
|
||||
}
|
||||
|
||||
private void tabMain_DragEnter(object sender, DragEventArgs e)
|
||||
{
|
||||
if (e.Data.GetDataPresent(DataFormats.FileDrop)) e.Effect = DragDropEffects.Copy;
|
||||
}
|
||||
|
||||
private void tabMain_DragDrop(object sender, DragEventArgs e)
|
||||
{
|
||||
string[] files = (string[])e.Data.GetData(DataFormats.FileDrop);
|
||||
|
|
@ -399,14 +417,17 @@ private void tabMain_DragDrop(object sender, DragEventArgs e)
|
|||
// RomFS Subform Items
|
||||
private void rebuildRomFS(object sender, EventArgs e)
|
||||
{
|
||||
if (threadActive()) return;
|
||||
if (RomFSPath == null) return;
|
||||
if (WinFormsUtil.Prompt(MessageBoxButtons.YesNo, "Rebuild RomFS?") != DialogResult.Yes) return;
|
||||
if (threadActive())
|
||||
return;
|
||||
if (RomFSPath == null)
|
||||
return;
|
||||
if (WinFormsUtil.Prompt(MessageBoxButtons.YesNo, "Rebuild RomFS?") != DialogResult.Yes)
|
||||
return;
|
||||
|
||||
SaveFileDialog sfd = new SaveFileDialog
|
||||
{
|
||||
FileName = HANSgameID != 0 ? HANSgameID.ToString("X8") + ".romfs" : "romfs.bin",
|
||||
Filter = "HANS RomFS|*.romfs" + "|Binary File|*.bin" + "|All Files|*.*"
|
||||
Filter = "HANS RomFS|*.romfs|Binary File|*.bin|All Files|*.*"
|
||||
};
|
||||
sfd.FilterIndex = HANSgameID != 0 ? 0 : sfd.Filter.Length - 1;
|
||||
|
||||
|
|
@ -425,9 +446,11 @@ private void rebuildRomFS(object sender, EventArgs e)
|
|||
}).Start();
|
||||
}
|
||||
}
|
||||
|
||||
private void B_GameText_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (threadActive()) return;
|
||||
if (threadActive())
|
||||
return;
|
||||
new Thread(() =>
|
||||
{
|
||||
var g = Config.GARCGameText;
|
||||
|
|
@ -437,18 +460,21 @@ private void B_GameText_Click(object sender, EventArgs e)
|
|||
g.Save();
|
||||
}).Start();
|
||||
}
|
||||
|
||||
private void B_StoryText_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (threadActive()) return;
|
||||
if (threadActive())
|
||||
return;
|
||||
new Thread(() =>
|
||||
{
|
||||
var g = Config.getGARCData("storytext");
|
||||
var g = Config.GetGARCData("storytext");
|
||||
string[][] files = g.Files.Select(file => new TextFile(Config, file).Lines).ToArray();
|
||||
Invoke((Action)(() => new TextEditor(files, "storytext").ShowDialog()));
|
||||
g.Files = TryWriteText(files, g);
|
||||
g.Save();
|
||||
}).Start();
|
||||
}
|
||||
|
||||
private static byte[][] TryWriteText(string[][] files, GARCFile g)
|
||||
{
|
||||
byte[][] data = new byte[files.Length][];
|
||||
|
|
@ -466,7 +492,7 @@ private static byte[][] TryWriteText(string[][] files, GARCFile g)
|
|||
data[i] = g.getFile(i);
|
||||
}
|
||||
}
|
||||
if (!errata.Any())
|
||||
if (errata.Count == 0)
|
||||
return data;
|
||||
|
||||
string[] options =
|
||||
|
|
@ -493,9 +519,11 @@ private static byte[][] TryWriteText(string[][] files, GARCFile g)
|
|||
|
||||
return data;
|
||||
}
|
||||
|
||||
private void B_Maison_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (threadActive()) return;
|
||||
if (threadActive())
|
||||
return;
|
||||
DialogResult dr;
|
||||
switch (Config.Generation)
|
||||
{
|
||||
|
|
@ -508,14 +536,15 @@ private void B_Maison_Click(object sender, EventArgs e)
|
|||
default:
|
||||
return;
|
||||
}
|
||||
if (dr == DialogResult.Cancel) return;
|
||||
if (dr == DialogResult.Cancel)
|
||||
return;
|
||||
|
||||
new Thread(() =>
|
||||
{
|
||||
bool super = dr == DialogResult.Yes;
|
||||
string c = super ? "S" : "N";
|
||||
var trdata = Config.getGARCData("maisontr"+c);
|
||||
var trpoke = Config.getGARCData("maisonpk"+c);
|
||||
var trdata = Config.GetGARCData("maisontr"+c);
|
||||
var trpoke = Config.GetGARCData("maisonpk"+c);
|
||||
byte[][] trd = trdata.Files;
|
||||
byte[][] trp = trpoke.Files;
|
||||
switch (Config.Generation)
|
||||
|
|
@ -533,9 +562,11 @@ private void B_Maison_Click(object sender, EventArgs e)
|
|||
trpoke.Save();
|
||||
}).Start();
|
||||
}
|
||||
|
||||
private void B_Personal_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (threadActive()) return;
|
||||
if (threadActive())
|
||||
return;
|
||||
new Thread(() =>
|
||||
{
|
||||
byte[][] d = Config.GARCPersonal.Files;
|
||||
|
|
@ -555,17 +586,18 @@ private void B_Personal_Click(object sender, EventArgs e)
|
|||
Config.GARCPersonal.Files = d;
|
||||
Config.GARCPersonal.Save();
|
||||
Config.InitializePersonal();
|
||||
|
||||
}).Start();
|
||||
}
|
||||
|
||||
private void B_Trainer_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (threadActive()) return;
|
||||
if (threadActive())
|
||||
return;
|
||||
new Thread(() =>
|
||||
{
|
||||
var trclass = Config.getGARCData("trclass");
|
||||
var trdata = Config.getGARCData("trdata");
|
||||
var trpoke = Config.getGARCData("trpoke");
|
||||
var trclass = Config.GetGARCData("trclass");
|
||||
var trdata = Config.GetGARCData("trdata");
|
||||
var trpoke = Config.GetGARCData("trpoke");
|
||||
byte[][] trc = trclass.Files;
|
||||
byte[][] trd = trdata.Files;
|
||||
byte[][] trp = trpoke.Files;
|
||||
|
|
@ -587,9 +619,11 @@ private void B_Trainer_Click(object sender, EventArgs e)
|
|||
trpoke.Save();
|
||||
}).Start();
|
||||
}
|
||||
|
||||
private void B_Wild_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (threadActive()) return;
|
||||
if (threadActive())
|
||||
return;
|
||||
new Thread(() =>
|
||||
{
|
||||
string[] files;
|
||||
|
|
@ -605,9 +639,9 @@ private void B_Wild_Click(object sender, EventArgs e)
|
|||
else return;
|
||||
|
||||
Invoke((MethodInvoker)delegate { Enabled = false; });
|
||||
fileGet(files, false);
|
||||
FileGet(files, false);
|
||||
Invoke(action);
|
||||
fileSet(files);
|
||||
FileSet(files);
|
||||
Invoke((MethodInvoker)delegate { Enabled = true; });
|
||||
break;
|
||||
case 7:
|
||||
|
|
@ -616,11 +650,11 @@ private void B_Wild_Click(object sender, EventArgs e)
|
|||
|
||||
files = new [] { "encdata", "zonedata", "worlddata" };
|
||||
updateStatus($"GARC Get: {files[0]}... ");
|
||||
var ed = Config.getlzGARCData(files[0]);
|
||||
var ed = Config.GetlzGARCData(files[0]);
|
||||
updateStatus($"GARC Get: {files[1]}... ");
|
||||
var zd = Config.getlzGARCData(files[1]);
|
||||
var zd = Config.GetlzGARCData(files[1]);
|
||||
updateStatus($"GARC Get: {files[2]}... ");
|
||||
var wd = Config.getlzGARCData(files[2]);
|
||||
var wd = Config.GetlzGARCData(files[2]);
|
||||
updateStatus("Running SMWE... ");
|
||||
action = () => new SMWE(ed, zd, wd).ShowDialog();
|
||||
Invoke(action);
|
||||
|
|
@ -636,11 +670,12 @@ private void B_Wild_Click(object sender, EventArgs e)
|
|||
}
|
||||
}).Start();
|
||||
}
|
||||
|
||||
private void B_OWSE_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (threadActive()) return;
|
||||
if (DialogResult.Yes != WinFormsUtil.Prompt(MessageBoxButtons.YesNo,
|
||||
"The OverWorld/Script Editor is not recommended for most users and is still a work-in-progress.", "Continue anyway?"))
|
||||
if (threadActive())
|
||||
return;
|
||||
if (DialogResult.Yes != WinFormsUtil.Prompt(MessageBoxButtons.YesNo, "The OverWorld/Script Editor is not recommended for most users and is still a work-in-progress.", "Continue anyway?"))
|
||||
return;
|
||||
switch (Config.Generation)
|
||||
{
|
||||
|
|
@ -652,6 +687,7 @@ private void B_OWSE_Click(object sender, EventArgs e)
|
|||
return;
|
||||
}
|
||||
}
|
||||
|
||||
private void runOWSE6()
|
||||
{
|
||||
Enabled = false;
|
||||
|
|
@ -660,11 +696,11 @@ private void runOWSE6()
|
|||
bool reload = ModifierKeys == Keys.Control || ModifierKeys == (Keys.Alt | Keys.Control);
|
||||
string[] files = {"encdata", "storytext", "mapGR", "mapMatrix"};
|
||||
if (reload || files.Sum(t => Directory.Exists(t) ? 0 : 1) != 0) // Dev bypass if all exist already
|
||||
fileGet(files, false);
|
||||
FileGet(files, false);
|
||||
|
||||
// Don't set any data back. Just view.
|
||||
{
|
||||
var g = Config.getGARCData("storytext");
|
||||
var g = Config.GetGARCData("storytext");
|
||||
string[][] tfiles = g.Files.Select(file => new TextFile(Config, file).Lines).ToArray();
|
||||
Invoke((Action)(() => new OWSE().Show()));
|
||||
Invoke((Action)(() => new TextEditor(tfiles, "storytext").Show()));
|
||||
|
|
@ -672,9 +708,10 @@ private void runOWSE6()
|
|||
Thread.Sleep(200);
|
||||
}
|
||||
Invoke((MethodInvoker) delegate { Enabled = true; });
|
||||
fileSet(files);
|
||||
FileSet(files);
|
||||
}).Start();
|
||||
}
|
||||
|
||||
private void runOWSE7()
|
||||
{
|
||||
Enabled = false;
|
||||
|
|
@ -682,13 +719,13 @@ private void runOWSE7()
|
|||
{
|
||||
var files = new[] { "encdata", "zonedata", "worlddata" };
|
||||
updateStatus($"GARC Get: {files[0]}... ");
|
||||
var ed = Config.getlzGARCData(files[0]);
|
||||
var ed = Config.GetlzGARCData(files[0]);
|
||||
updateStatus($"GARC Get: {files[1]}... ");
|
||||
var zd = Config.getlzGARCData(files[1]);
|
||||
var zd = Config.GetlzGARCData(files[1]);
|
||||
updateStatus($"GARC Get: {files[2]}... ");
|
||||
var wd = Config.getlzGARCData(files[2]);
|
||||
var wd = Config.GetlzGARCData(files[2]);
|
||||
|
||||
var g = Config.getGARCData("storytext");
|
||||
var g = Config.GetGARCData("storytext");
|
||||
string[][] tfiles = g.Files.Select(file => new TextFile(Config, file).Lines).ToArray();
|
||||
Invoke((Action)(() => new TextEditor(tfiles, "storytext").Show()));
|
||||
Invoke((Action)(() => new OWSE7(ed, zd, wd).Show()));
|
||||
|
|
@ -697,12 +734,14 @@ private void runOWSE7()
|
|||
Invoke((MethodInvoker)delegate { Enabled = true; });
|
||||
}).Start();
|
||||
}
|
||||
|
||||
private void B_Evolution_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (threadActive()) return;
|
||||
if (threadActive())
|
||||
return;
|
||||
new Thread(() =>
|
||||
{
|
||||
var g = Config.getGARCData("evolution");
|
||||
var g = Config.GetGARCData("evolution");
|
||||
byte[][] d = g.Files;
|
||||
switch (Config.Generation)
|
||||
{
|
||||
|
|
@ -717,12 +756,14 @@ private void B_Evolution_Click(object sender, EventArgs e)
|
|||
g.Save();
|
||||
}).Start();
|
||||
}
|
||||
|
||||
private void B_MegaEvo_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (threadActive()) return;
|
||||
if (threadActive())
|
||||
return;
|
||||
new Thread(() =>
|
||||
{
|
||||
var g = Config.getGARCData("megaevo");
|
||||
var g = Config.GetGARCData("megaevo");
|
||||
byte[][] d = g.Files;
|
||||
switch (Config.Generation)
|
||||
{
|
||||
|
|
@ -737,12 +778,14 @@ private void B_MegaEvo_Click(object sender, EventArgs e)
|
|||
g.Save();
|
||||
}).Start();
|
||||
}
|
||||
|
||||
private void B_Item_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (threadActive()) return;
|
||||
if (threadActive())
|
||||
return;
|
||||
new Thread(() =>
|
||||
{
|
||||
var g = Config.getGARCData("item");
|
||||
var g = Config.GetGARCData("item");
|
||||
byte[][] d = g.Files;
|
||||
switch (Config.Generation)
|
||||
{
|
||||
|
|
@ -757,9 +800,11 @@ private void B_Item_Click(object sender, EventArgs e)
|
|||
g.Save();
|
||||
}).Start();
|
||||
}
|
||||
|
||||
private void B_Move_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (threadActive()) return;
|
||||
if (threadActive())
|
||||
return;
|
||||
new Thread(() =>
|
||||
{
|
||||
var g = Config.GARCMoves;
|
||||
|
|
@ -782,9 +827,11 @@ private void B_Move_Click(object sender, EventArgs e)
|
|||
Config.InitializeMoves();
|
||||
}).Start();
|
||||
}
|
||||
|
||||
private void B_LevelUp_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (threadActive()) return;
|
||||
if (threadActive())
|
||||
return;
|
||||
new Thread(() =>
|
||||
{
|
||||
byte[][] d = Config.GARCLearnsets.Files;
|
||||
|
|
@ -802,12 +849,14 @@ private void B_LevelUp_Click(object sender, EventArgs e)
|
|||
Config.InitializeLearnset();
|
||||
}).Start();
|
||||
}
|
||||
|
||||
private void B_EggMove_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (threadActive()) return;
|
||||
if (threadActive())
|
||||
return;
|
||||
new Thread(() =>
|
||||
{
|
||||
var g = Config.getGARCData("eggmove");
|
||||
var g = Config.GetGARCData("eggmove");
|
||||
byte[][] d = g.Files;
|
||||
switch (Config.Generation)
|
||||
{
|
||||
|
|
@ -822,36 +871,41 @@ private void B_EggMove_Click(object sender, EventArgs e)
|
|||
g.Save();
|
||||
}).Start();
|
||||
}
|
||||
|
||||
private void B_TitleScreen_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (threadActive()) return;
|
||||
if (threadActive())
|
||||
return;
|
||||
new Thread(() =>
|
||||
{
|
||||
string[] files = { "titlescreen" };
|
||||
fileGet(files); // Compressed files exist, handled in the other form since there's so many
|
||||
FileGet(files); // Compressed files exist, handled in the other form since there's so many
|
||||
Invoke((Action)(() => new TitleScreenEditor6().ShowDialog()));
|
||||
fileSet(files);
|
||||
FileSet(files);
|
||||
}).Start();
|
||||
}
|
||||
// RomFS File Requesting Method Wrapper
|
||||
private void fileGet(string[] files, bool skipDecompression = true, bool skipGet = false)
|
||||
private void FileGet(string[] files, bool skipDecompression = true, bool skipGet = false)
|
||||
{
|
||||
if (skipGet || skipBoth) return;
|
||||
if (skipGet || skipBoth)
|
||||
return;
|
||||
foreach (string toEdit in files)
|
||||
{
|
||||
string GARC = Config.getGARCFileName(toEdit);
|
||||
string GARC = Config.GetGARCFileName(toEdit);
|
||||
updateStatus($"GARC Get: {toEdit} @ {GARC}... ");
|
||||
threadGet(Path.Combine(RomFSPath, GARC), toEdit, true, skipDecompression);
|
||||
while (threads > 0) Thread.Sleep(50);
|
||||
resetStatus();
|
||||
}
|
||||
}
|
||||
private void fileSet(IEnumerable<string> files, bool keep = false)
|
||||
|
||||
private void FileSet(IEnumerable<string> files, bool keep = false)
|
||||
{
|
||||
if (skipBoth) return;
|
||||
if (skipBoth)
|
||||
return;
|
||||
foreach (string toEdit in files)
|
||||
{
|
||||
string GARC = Config.getGARCFileName(toEdit);
|
||||
string GARC = Config.GetGARCFileName(toEdit);
|
||||
updateStatus($"GARC Set: {toEdit} @ {GARC}... ");
|
||||
threadSet(Path.Combine(RomFSPath, GARC), toEdit, 4); // 4 bytes for Gen6
|
||||
while (threads > 0) Thread.Sleep(50);
|
||||
|
|
@ -863,8 +917,10 @@ private void fileSet(IEnumerable<string> files, bool keep = false)
|
|||
// ExeFS Subform Items
|
||||
private void rebuildExeFS(object sender, EventArgs e)
|
||||
{
|
||||
if (ExeFSPath == null) return;
|
||||
if (WinFormsUtil.Prompt(MessageBoxButtons.YesNo, "Rebuild ExeFS?") != DialogResult.Yes) return;
|
||||
if (ExeFSPath == null)
|
||||
return;
|
||||
if (WinFormsUtil.Prompt(MessageBoxButtons.YesNo, "Rebuild ExeFS?") != DialogResult.Yes)
|
||||
return;
|
||||
|
||||
string[] files = Directory.GetFiles(ExeFSPath);
|
||||
int file = 0; if (files[1].Contains("code")) file = 1;
|
||||
|
|
@ -872,7 +928,7 @@ private void rebuildExeFS(object sender, EventArgs e)
|
|||
SaveFileDialog sfd = new SaveFileDialog
|
||||
{
|
||||
FileName = HANSgameID != 0 ? HANSgameID.ToString("X8") + ".exefs" : "exefs.bin",
|
||||
Filter = "HANS ExeFS|*.exefs" + "|Binary File|*.bin" + "|All Files|*.*"
|
||||
Filter = "HANS ExeFS|*.exefs|Binary File|*.bin|All Files|*.*"
|
||||
};
|
||||
sfd.FilterIndex = HANSgameID != 0 ? 0 : sfd.Filter.Length - 1;
|
||||
|
||||
|
|
@ -888,37 +944,40 @@ private void rebuildExeFS(object sender, EventArgs e)
|
|||
}).Start();
|
||||
}
|
||||
}
|
||||
|
||||
private void B_Pickup_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (threadActive()) return;
|
||||
if (threadActive())
|
||||
return;
|
||||
switch (Config.Generation)
|
||||
{
|
||||
case 6:
|
||||
if (ExeFSPath != null) new PickupEditor6().Show();
|
||||
break;
|
||||
case 7:
|
||||
var pickup = Config.getlzGARCData("pickup");
|
||||
var pickup = Config.GetlzGARCData("pickup");
|
||||
Invoke((Action)(() => new PickupEditor7(pickup).ShowDialog()));
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
private void B_TMHM_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (threadActive()) return;
|
||||
if (ExeFSPath != null)
|
||||
switch (Config.Generation)
|
||||
{
|
||||
case 6:
|
||||
new TMHMEditor6().Show();
|
||||
break;
|
||||
case 7:
|
||||
new TMEditor7().Show();
|
||||
break;
|
||||
}
|
||||
if (threadActive())
|
||||
return;
|
||||
if (ExeFSPath == null)
|
||||
return;
|
||||
switch (Config.Generation)
|
||||
{
|
||||
case 6: new TMHMEditor6().Show(); break;
|
||||
case 7: new TMEditor7().Show(); break;
|
||||
}
|
||||
}
|
||||
|
||||
private void B_Mart_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (threadActive()) return;
|
||||
if (threadActive())
|
||||
return;
|
||||
switch (Config.Generation)
|
||||
{
|
||||
case 6:
|
||||
|
|
@ -926,36 +985,44 @@ private void B_Mart_Click(object sender, EventArgs e)
|
|||
break;
|
||||
|
||||
case 7:
|
||||
if (threadActive()) return;
|
||||
if (DialogResult.Yes != WinFormsUtil.Prompt(MessageBoxButtons.YesNo,
|
||||
"CRO Editing causes crashes if you do not patch the RO module.", "In order to patch the RO module, your device must be running Custom Firmware (for example, Luma3DS).", "Continue anyway?"))
|
||||
if (threadActive())
|
||||
return;
|
||||
if (DialogResult.Yes != WinFormsUtil.Prompt(MessageBoxButtons.YesNo, "CRO Editing causes crashes if you do not patch the RO module.", "In order to patch the RO module, your device must be running Custom Firmware (for example, Luma3DS).", "Continue anyway?"))
|
||||
return;
|
||||
if (RomFSPath != null) (Config.USUM ? new MartEditor7UU() : (Form)new MartEditor7()).Show();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
private void B_MoveTutor_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (threadActive()) return;
|
||||
if (threadActive())
|
||||
return;
|
||||
if (Config.XY) { WinFormsUtil.Alert("No Tutors for X/Y."); return; } // Already disabled button...
|
||||
if (ExeFSPath != null) new TutorEditor6().Show();
|
||||
}
|
||||
|
||||
private void B_OPower_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (threadActive()) return;
|
||||
if (threadActive())
|
||||
return;
|
||||
if (ExeFSPath != null) new OPower().Show();
|
||||
}
|
||||
|
||||
private void B_ShinyRate_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (threadActive()) return;
|
||||
if (threadActive())
|
||||
return;
|
||||
if (ExeFSPath != null) new ShinyRate().ShowDialog();
|
||||
}
|
||||
|
||||
// CRO Subform Items
|
||||
private void patchCRO_CRR(object sender, EventArgs e)
|
||||
{
|
||||
if (threadActive()) return;
|
||||
if (RomFSPath == null) return;
|
||||
if (threadActive())
|
||||
return;
|
||||
if (RomFSPath == null)
|
||||
return;
|
||||
if (DialogResult.Yes != WinFormsUtil.Prompt(MessageBoxButtons.YesNo, "Rebuilding CRO/CRR is not necessary if you patch the RO module.", "Continue?"))
|
||||
return;
|
||||
new Thread(() =>
|
||||
|
|
@ -967,13 +1034,13 @@ private void patchCRO_CRR(object sender, EventArgs e)
|
|||
WinFormsUtil.Alert("CRO's and CRR have been updated.",
|
||||
"If you have made any modifications, it is required that the RSA Verification check be patched on the system in order for the modified CROs to load (ie, no file redirection like NTR's layeredFS).");
|
||||
}).Start();
|
||||
|
||||
}
|
||||
|
||||
private void B_Starter_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (threadActive()) return;
|
||||
if (DialogResult.Yes != WinFormsUtil.Prompt(MessageBoxButtons.YesNo,
|
||||
"CRO Editing causes crashes if you do not patch the RO module.", "In order to patch the RO module, your device must be running Custom Firmware (for example, Luma3DS).", "Continue anyway?"))
|
||||
if (threadActive())
|
||||
return;
|
||||
if (DialogResult.Yes != WinFormsUtil.Prompt(MessageBoxButtons.YesNo, "CRO Editing causes crashes if you do not patch the RO module.", "In order to patch the RO module, your device must be running Custom Firmware (for example, Luma3DS).", "Continue anyway?"))
|
||||
return;
|
||||
string CRO = Path.Combine(RomFSPath, "DllPoke3Select.cro");
|
||||
string CRO2 = Path.Combine(RomFSPath, "DllField.cro");
|
||||
|
|
@ -989,15 +1056,16 @@ private void B_Starter_Click(object sender, EventArgs e)
|
|||
}
|
||||
new StarterEditor6().ShowDialog();
|
||||
}
|
||||
|
||||
private void B_TypeChart_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (threadActive()) return;
|
||||
if (threadActive())
|
||||
return;
|
||||
|
||||
switch (Config.Generation)
|
||||
{
|
||||
case 6:
|
||||
if (DialogResult.Yes != WinFormsUtil.Prompt(MessageBoxButtons.YesNo,
|
||||
"CRO Editing causes crashes if you do not patch the RO module.", "In order to patch the RO module, your device must be running Custom Firmware (for example, Luma3DS).", "Continue anyway?"))
|
||||
if (DialogResult.Yes != WinFormsUtil.Prompt(MessageBoxButtons.YesNo, "CRO Editing causes crashes if you do not patch the RO module.", "In order to patch the RO module, your device must be running Custom Firmware (for example, Luma3DS).", "Continue anyway?"))
|
||||
return;
|
||||
string CRO = Path.Combine(RomFSPath, "DllBattle.cro");
|
||||
if (!File.Exists(CRO))
|
||||
|
|
@ -1010,14 +1078,14 @@ private void B_TypeChart_Click(object sender, EventArgs e)
|
|||
case 7:
|
||||
new TypeChart7().ShowDialog();
|
||||
break;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
private void B_Gift_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (threadActive()) return;
|
||||
if (DialogResult.Yes != WinFormsUtil.Prompt(MessageBoxButtons.YesNo,
|
||||
"CRO Editing causes crashes if you do not patch the RO module.", "In order to patch the RO module, your device must be running Custom Firmware (for example, Luma3DS).", "Continue anyway?"))
|
||||
if (threadActive())
|
||||
return;
|
||||
if (DialogResult.Yes != WinFormsUtil.Prompt(MessageBoxButtons.YesNo, "CRO Editing causes crashes if you do not patch the RO module.", "In order to patch the RO module, your device must be running Custom Firmware (for example, Luma3DS).", "Continue anyway?"))
|
||||
return;
|
||||
string CRO = Path.Combine(RomFSPath, "DllField.cro");
|
||||
if (!File.Exists(CRO))
|
||||
|
|
@ -1027,15 +1095,17 @@ private void B_Gift_Click(object sender, EventArgs e)
|
|||
}
|
||||
new GiftEditor6().ShowDialog();
|
||||
}
|
||||
|
||||
private void B_Static_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (threadActive()) return;
|
||||
if (threadActive())
|
||||
return;
|
||||
|
||||
if (Config.Generation == 7)
|
||||
{
|
||||
new Thread(() =>
|
||||
{
|
||||
var esg = Config.getGARCData("encounterstatic");
|
||||
var esg = Config.GetGARCData("encounterstatic");
|
||||
byte[][] es = esg.Files;
|
||||
|
||||
Invoke((Action)(() => new StaticEncounterEditor7(es).ShowDialog()));
|
||||
|
|
@ -1045,8 +1115,7 @@ private void B_Static_Click(object sender, EventArgs e)
|
|||
return;
|
||||
}
|
||||
|
||||
if (DialogResult.Yes != WinFormsUtil.Prompt(MessageBoxButtons.YesNo,
|
||||
"CRO Editing causes crashes if you do not patch the RO module.", "In order to patch the RO module, your device must be running Custom Firmware (for example, Luma3DS).", "Continue anyway?"))
|
||||
if (DialogResult.Yes != WinFormsUtil.Prompt(MessageBoxButtons.YesNo, "CRO Editing causes crashes if you do not patch the RO module.", "In order to patch the RO module, your device must be running Custom Firmware (for example, Luma3DS).", "Continue anyway?"))
|
||||
return;
|
||||
string CRO = Path.Combine(RomFSPath, "DllField.cro");
|
||||
if (!File.Exists(CRO))
|
||||
|
|
@ -1067,14 +1136,16 @@ private void B_Rebuild3DS_Click(object sender, EventArgs e)
|
|||
WinFormsUtil.Error("RomFS file count does not match the default game file count.");
|
||||
return;
|
||||
}
|
||||
if (threadActive()) return;
|
||||
if (threadActive())
|
||||
return;
|
||||
|
||||
SaveFileDialog sfd = new SaveFileDialog
|
||||
{
|
||||
FileName = "newROM.3ds",
|
||||
Filter = "Binary File|*.*"
|
||||
};
|
||||
if (sfd.ShowDialog() != DialogResult.OK) return;
|
||||
if (sfd.ShowDialog() != DialogResult.OK)
|
||||
return;
|
||||
string path = sfd.FileName;
|
||||
|
||||
new Thread(() =>
|
||||
|
|
@ -1092,14 +1163,17 @@ private void L_SubTools_Click(object sender, EventArgs e)
|
|||
{
|
||||
new ToolsUI().ShowDialog();
|
||||
}
|
||||
|
||||
private void B_Patch_Click(object sender, EventArgs e)
|
||||
{
|
||||
new Patch().ShowDialog();
|
||||
}
|
||||
|
||||
private void Menu_BLZ_Click(object sender, EventArgs e)
|
||||
{
|
||||
var ofd = new OpenFileDialog();
|
||||
if (DialogResult.OK != ofd.ShowDialog()) return;
|
||||
if (DialogResult.OK != ofd.ShowDialog())
|
||||
return;
|
||||
|
||||
string path = ofd.FileName;
|
||||
FileInfo fi = new FileInfo(path);
|
||||
|
|
@ -1111,10 +1185,12 @@ private void Menu_BLZ_Click(object sender, EventArgs e)
|
|||
else if (WinFormsUtil.Prompt(MessageBoxButtons.YesNo, "Detected Compressed Binary", "Decompress? File will be replaced.") == DialogResult.Yes)
|
||||
new Thread(() => { threads++; new BLZCoder(new[] { "-d", path }, pBar1); threads--; WinFormsUtil.Alert("Decompressed!"); }).Start();
|
||||
}
|
||||
|
||||
private void Menu_LZ11_Click(object sender, EventArgs e)
|
||||
{
|
||||
var ofd = new OpenFileDialog();
|
||||
if (DialogResult.OK != ofd.ShowDialog()) return;
|
||||
if (DialogResult.OK != ofd.ShowDialog())
|
||||
return;
|
||||
|
||||
string path = ofd.FileName;
|
||||
FileInfo fi = new FileInfo(path);
|
||||
|
|
@ -1144,10 +1220,12 @@ private void Menu_LZ11_Click(object sender, EventArgs e)
|
|||
threads--;
|
||||
}).Start();
|
||||
}
|
||||
|
||||
private void Menu_SMDH_Click(object sender, EventArgs e)
|
||||
{
|
||||
new Icon().ShowDialog();
|
||||
}
|
||||
|
||||
private void Menu_Shuffler_Click(object sender, EventArgs e)
|
||||
{
|
||||
new Shuffler().ShowDialog();
|
||||
|
|
@ -1163,7 +1241,7 @@ internal static string getGARCFileName(string requestedGARC, int lang)
|
|||
return garc.Reference;
|
||||
}
|
||||
|
||||
private bool getGARC(string infile, string outfolder, bool PB, bool bypassExt = false)
|
||||
private bool GetGARC(string infile, string outfolder, bool PB, bool bypassExt = false)
|
||||
{
|
||||
if (skipBoth && Directory.Exists(outfolder))
|
||||
{
|
||||
|
|
@ -1180,9 +1258,10 @@ private bool getGARC(string infile, string outfolder, bool PB, bool bypassExt =
|
|||
}
|
||||
catch (Exception e) { WinFormsUtil.Error("Could not get the GARC:", e.ToString()); threads--; return false; }
|
||||
}
|
||||
|
||||
private bool setGARC(string outfile, string infolder, int padBytes, bool PB)
|
||||
{
|
||||
if (skipBoth || ModifierKeys == Keys.Control && WinFormsUtil.Prompt(MessageBoxButtons.YesNo, "Cancel writing data back to GARC?") == DialogResult.Yes)
|
||||
if (skipBoth || (ModifierKeys == Keys.Control && WinFormsUtil.Prompt(MessageBoxButtons.YesNo, "Cancel writing data back to GARC?") == DialogResult.Yes))
|
||||
{ threads--; updateStatus("Aborted!", false); return false; }
|
||||
|
||||
try
|
||||
|
|
@ -1194,13 +1273,19 @@ private bool setGARC(string outfile, string infolder, int padBytes, bool PB)
|
|||
}
|
||||
catch (Exception e) { WinFormsUtil.Error("Could not set the GARC back:", e.ToString()); threads--; return false; }
|
||||
}
|
||||
|
||||
private void threadGet(string infile, string outfolder, bool PB = true, bool bypassExt = false)
|
||||
{
|
||||
threads++;
|
||||
if (Directory.Exists(outfolder)) try { Directory.Delete(outfolder, true); }
|
||||
if (Directory.Exists(outfolder))
|
||||
{
|
||||
try { Directory.Delete(outfolder, true); }
|
||||
catch { }
|
||||
new Thread(() => getGARC(infile, outfolder, PB, bypassExt)).Start();
|
||||
}
|
||||
|
||||
new Thread(() => GetGARC(infile, outfolder, PB, bypassExt)).Start();
|
||||
}
|
||||
|
||||
private void threadSet(string outfile, string infolder, int padBytes, bool PB = true)
|
||||
{
|
||||
threads++;
|
||||
|
|
@ -1214,6 +1299,7 @@ private void updateStatus(string status, bool preBreak = true)
|
|||
try
|
||||
{
|
||||
if (RTB_Status.InvokeRequired)
|
||||
{
|
||||
RTB_Status.Invoke((MethodInvoker)delegate
|
||||
{
|
||||
RTB_Status.AppendText(newtext);
|
||||
|
|
@ -1221,6 +1307,7 @@ private void updateStatus(string status, bool preBreak = true)
|
|||
RTB_Status.ScrollToCaret();
|
||||
L_Status.Text = RTB_Status.Lines.Last().Split(new[] {" @"}, StringSplitOptions.None)[0];
|
||||
});
|
||||
}
|
||||
else
|
||||
{
|
||||
RTB_Status.AppendText(newtext);
|
||||
|
|
@ -1231,15 +1318,15 @@ private void updateStatus(string status, bool preBreak = true)
|
|||
}
|
||||
catch { }
|
||||
}
|
||||
|
||||
private void resetStatus()
|
||||
{
|
||||
try
|
||||
{
|
||||
if (L_Status.InvokeRequired)
|
||||
L_Status.Invoke((MethodInvoker)delegate
|
||||
{
|
||||
L_Status.Text = "";
|
||||
});
|
||||
{
|
||||
L_Status.Invoke((MethodInvoker)(() => L_Status.Text = ""));
|
||||
}
|
||||
else
|
||||
{
|
||||
L_Status.Text = "";
|
||||
|
|
|
|||
|
|
@ -10,6 +10,7 @@ public About()
|
|||
InitializeComponent();
|
||||
RTB.Text = Properties.Resources.changelog;
|
||||
}
|
||||
|
||||
private void B_Close_Click(object sender, EventArgs e)
|
||||
{
|
||||
Close();
|
||||
|
|
|
|||
|
|
@ -79,6 +79,7 @@ public Exception Error
|
|||
UpdateExceptionDetailsMessage();
|
||||
}
|
||||
}
|
||||
|
||||
private Exception _error;
|
||||
|
||||
private void UpdateExceptionDetailsMessage()
|
||||
|
|
@ -129,6 +130,5 @@ private void B_Abort_Click(object sender, EventArgs e)
|
|||
DialogResult = DialogResult.Abort;
|
||||
Close();
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -62,6 +62,7 @@ internal static bool patchExeFS(string path, string[] oldstr, string[] newstr, s
|
|||
File.WriteAllText(outPath ?? path, text, Encoding.Unicode);
|
||||
return true;
|
||||
}
|
||||
|
||||
internal static string exportGARCs(string[] garcPaths, string[] newPaths, string parentRomFS, string patchFolder)
|
||||
{
|
||||
// Stuff files into new patch folder
|
||||
|
|
@ -127,12 +128,13 @@ private string[] getGARCs()
|
|||
sc.CopyTo(garcs, 0);
|
||||
return garcs.Distinct().ToArray();
|
||||
}
|
||||
|
||||
private string[] getPaths(string[] sc)
|
||||
{
|
||||
bool languages = CHK_Lang.Checked;
|
||||
StringCollection paths = new StringCollection();
|
||||
foreach (string s in sc)
|
||||
if (!languages || s != "gametext" && s != "storytext")
|
||||
if (!languages || (s != "gametext" && s != "storytext"))
|
||||
paths.Add(Main.getGARCFileName(s, Main.Language));
|
||||
else
|
||||
for (int l = 0; l < 8; l++)
|
||||
|
|
@ -148,6 +150,7 @@ private void B_CheckAll_Click(object sender, EventArgs e)
|
|||
for (int i = 0; i < CHKLB_GARCs.Items.Count; i++)
|
||||
CHKLB_GARCs.SetItemChecked(i, true);
|
||||
}
|
||||
|
||||
private void B_CheckNone_Click(object sender, EventArgs e)
|
||||
{
|
||||
for (int i = 0; i < CHKLB_GARCs.Items.Count; i++)
|
||||
|
|
|
|||
|
|
@ -87,7 +87,7 @@ private static IEnumerable<RestoreInfo> GetRestorableGarcs(GameConfig config, st
|
|||
var files = config.Files.Select(file => file.Name);
|
||||
foreach (var f in files)
|
||||
{
|
||||
string GARC = config.getGARCFileName(f);
|
||||
string GARC = config.GetGARCFileName(f);
|
||||
string name = $"{f} ({GARC.Replace(Path.DirectorySeparatorChar.ToString(), "")})";
|
||||
|
||||
string src = Path.Combine(config.RomFS, GARC);
|
||||
|
|
|
|||
|
|
@ -36,10 +36,12 @@ public EggMoveEditor6(byte[][] infiles)
|
|||
CB_Species.SelectedIndex = 0;
|
||||
RandSettings.GetFormSettings(this, groupBox1.Controls);
|
||||
}
|
||||
|
||||
private readonly byte[][] files;
|
||||
private int entry = -1;
|
||||
private readonly string[] movelist = Main.Config.getText(TextName.MoveNames);
|
||||
private bool dumping;
|
||||
|
||||
private void setupDGV()
|
||||
{
|
||||
string[] sortedmoves = (string[])movelist.Clone();
|
||||
|
|
@ -58,6 +60,7 @@ private void setupDGV()
|
|||
}
|
||||
|
||||
private EggMoves pkm = new EggMoves6(new byte[0]);
|
||||
|
||||
private void getList()
|
||||
{
|
||||
entry = WinFormsUtil.getIndex(CB_Species);
|
||||
|
|
@ -79,6 +82,7 @@ private void getList()
|
|||
|
||||
dgv.CancelEdit();
|
||||
}
|
||||
|
||||
private void setList()
|
||||
{
|
||||
if (entry < 1 || dumping) return;
|
||||
|
|
@ -125,6 +129,7 @@ private void B_RandAll_Click(object sender, EventArgs e)
|
|||
getList();
|
||||
WinFormsUtil.Alert("All Pokémon's Egg Moves have been randomized!", "Press the Dump button to see the new Egg Moves!");
|
||||
}
|
||||
|
||||
private void B_Dump_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (DialogResult.Yes != WinFormsUtil.Prompt(MessageBoxButtons.YesNo, "Dump all Egg Moves to Text File?"))
|
||||
|
|
@ -157,6 +162,7 @@ private void formClosing(object sender, FormClosingEventArgs e)
|
|||
setList();
|
||||
RandSettings.SetFormSettings(this, groupBox1.Controls);
|
||||
}
|
||||
|
||||
private void calcStats()
|
||||
{
|
||||
Move[] MoveData = Main.Config.Moves;
|
||||
|
|
|
|||
|
|
@ -75,6 +75,7 @@ public EvolutionEditor6(byte[][] infiles)
|
|||
CB_Species.SelectedIndex = 1;
|
||||
RandSettings.GetFormSettings(this, GB_Randomizer.Controls);
|
||||
}
|
||||
|
||||
private readonly byte[][] files;
|
||||
private readonly ComboBox[] pb;
|
||||
private readonly ComboBox[] rb;
|
||||
|
|
@ -87,6 +88,7 @@ public EvolutionEditor6(byte[][] infiles)
|
|||
private readonly string[] typelist = Main.Config.getText(TextName.Types);
|
||||
private bool dumping;
|
||||
private EvolutionSet evo = new EvolutionSet6(new byte[EvolutionSet6.SIZE]);
|
||||
|
||||
private void getList()
|
||||
{
|
||||
entry = Array.IndexOf(specieslist, CB_Species.Text);
|
||||
|
|
@ -103,6 +105,7 @@ private void getList()
|
|||
rb[i].SelectedIndex = evo.PossibleEvolutions[i].Species;
|
||||
}
|
||||
}
|
||||
|
||||
private void setList()
|
||||
{
|
||||
if (entry < 1 || dumping) return;
|
||||
|
|
@ -141,6 +144,7 @@ private void B_RandAll_Click(object sender, EventArgs e)
|
|||
|
||||
WinFormsUtil.Alert("All Pokémon's Evolutions have been randomized!");
|
||||
}
|
||||
|
||||
private void B_Trade_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (DialogResult.Yes != WinFormsUtil.Prompt(MessageBoxButtons.YesNo, "Remove all trade evolutions?", "Evolution methods will be altered so that evolutions will be possible with only one game."))
|
||||
|
|
@ -156,6 +160,7 @@ private void B_Trade_Click(object sender, EventArgs e)
|
|||
|
||||
WinFormsUtil.Alert("All trade evolutions have been removed!", "Trade evolutions will now occur after reaching a certain Level, or after leveling up while holding its appropriate trade item.");
|
||||
}
|
||||
|
||||
private void B_Dump_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (DialogResult.Yes != WinFormsUtil.Prompt(MessageBoxButtons.YesNo, "Dump all Evolutions to Text File?"))
|
||||
|
|
@ -234,6 +239,7 @@ private void changeMethod(object sender, EventArgs e)
|
|||
}
|
||||
pb[op].SelectedIndex = 0;
|
||||
}
|
||||
|
||||
private void changeInto(object sender, EventArgs e)
|
||||
{
|
||||
pic[Array.IndexOf(rb, sender as ComboBox)].Image = (Bitmap)Resources.ResourceManager.GetObject("_" + Array.IndexOf(specieslist, (sender as ComboBox).Text));
|
||||
|
|
|
|||
|
|
@ -75,9 +75,9 @@ private void InitializeComponent()
|
|||
this.PB_Map.SizeMode = System.Windows.Forms.PictureBoxSizeMode.AutoSize;
|
||||
this.PB_Map.TabIndex = 2;
|
||||
this.PB_Map.TabStop = false;
|
||||
this.PB_Map.DoubleClick += new System.EventHandler(this.dclickMap);
|
||||
this.PB_Map.MouseEnter += new System.EventHandler(this.focusPanel);
|
||||
this.PB_Map.MouseMove += new System.Windows.Forms.MouseEventHandler(this.hoverMap);
|
||||
this.PB_Map.DoubleClick += new System.EventHandler(this.DclickMap);
|
||||
this.PB_Map.MouseEnter += new System.EventHandler(this.FocusPanel);
|
||||
this.PB_Map.MouseMove += new System.Windows.Forms.MouseEventHandler(this.HoverMap);
|
||||
//
|
||||
// CHK_AutoDraw
|
||||
//
|
||||
|
|
|
|||
|
|
@ -19,12 +19,14 @@ public MapPermView()
|
|||
private readonly string[] MapGRs;
|
||||
private int mapScale = -1;
|
||||
public int DrawMap = -1;
|
||||
public void drawMap(int Map)
|
||||
|
||||
public void SetMap(int Map)
|
||||
{
|
||||
DrawMap = Map;
|
||||
PB_Map.Image = CHK_AutoDraw.Checked ? getMapImage(sliceArea: true) : null;
|
||||
PB_Map.Image = CHK_AutoDraw.Checked ? GetMapImage(sliceArea: true) : null;
|
||||
}
|
||||
public Bitmap getMapImage(bool crop = false, bool entity = true, bool sliceArea = false)
|
||||
|
||||
public Bitmap GetMapImage(bool crop = false, bool entity = true, bool sliceArea = false)
|
||||
{
|
||||
// Load MM
|
||||
byte[][] MM = Mini.UnpackMini(File.ReadAllBytes(MapMatrixes[DrawMap]), "MM");
|
||||
|
|
@ -51,13 +53,17 @@ public Bitmap getMapImage(bool crop = false, bool entity = true, bool sliceArea
|
|||
{
|
||||
int area = 40*mapScale;
|
||||
for (int x = 0; x < img.Width; x++)
|
||||
{
|
||||
for (int y = 0; y < img.Height; y++)
|
||||
{
|
||||
if (x % area == 0 || y % area == 0)
|
||||
img.SetPixel(x,y,Color.FromArgb(0x10,0xFF,0,0));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (entity && mapScale == 8)
|
||||
img = overlayEntities(img);
|
||||
img = OverlayEntities(img);
|
||||
|
||||
if (crop)
|
||||
img = WinFormsUtil.TrimBitmap(img);
|
||||
|
|
@ -67,7 +73,7 @@ public Bitmap getMapImage(bool crop = false, bool entity = true, bool sliceArea
|
|||
|
||||
internal static Bitmap baseImage;
|
||||
|
||||
private Bitmap overlayEntities(Bitmap img)
|
||||
private Bitmap OverlayEntities(Bitmap img)
|
||||
{
|
||||
const float opacity = 0.66f;
|
||||
// Overlay every... overworld entity
|
||||
|
|
@ -76,9 +82,13 @@ private Bitmap overlayEntities(Bitmap img)
|
|||
int x = e.X;
|
||||
int y = e.Y;
|
||||
for (int sx = 0; sx < e.WX; sx++) // Stretch X
|
||||
{
|
||||
for (int sy = 0; sy < e.WY; sy++) // Stretch Y
|
||||
{
|
||||
try { WinFormsUtil.LayerImage(img, Properties.Resources.F, (x + sx) * mapScale, (y + sy) * mapScale, opacity); }
|
||||
catch { }
|
||||
}
|
||||
}
|
||||
}
|
||||
foreach (var e in OWSE.CurrentZone.Entities.NPCs)
|
||||
{
|
||||
|
|
@ -92,27 +102,39 @@ private Bitmap overlayEntities(Bitmap img)
|
|||
int x = (int)e.PX; // shifted warps look weird
|
||||
int y = (int)e.PY; // shifted warps look weird
|
||||
for (int sx = 0; sx < e.Width; sx++) // Stretch X
|
||||
{
|
||||
for (int sy = 0; sy < e.Height; sy++) // Stretch Y
|
||||
{
|
||||
try { WinFormsUtil.LayerImage(img, Properties.Resources.W, (x + sx) * mapScale, (y + sy) * mapScale, opacity); }
|
||||
catch { }
|
||||
}
|
||||
}
|
||||
}
|
||||
foreach (var e in OWSE.CurrentZone.Entities.Triggers1)
|
||||
{
|
||||
int x = e.X;
|
||||
int y = e.Y;
|
||||
for (int sx = 0; sx < e.Width; sx++) // Stretch X
|
||||
{
|
||||
for (int sy = 0; sy < e.Height; sy++) // Stretch Y
|
||||
{
|
||||
try { WinFormsUtil.LayerImage(img, Properties.Resources.T1, (x + sx) * mapScale, (y + sy) * mapScale, opacity); }
|
||||
catch { }
|
||||
}
|
||||
}
|
||||
}
|
||||
foreach (var e in OWSE.CurrentZone.Entities.Triggers2)
|
||||
{
|
||||
int x = e.X;
|
||||
int y = e.Y;
|
||||
for (int sx = 0; sx < e.Width; sx++) // Stretch X
|
||||
{
|
||||
for (int sy = 0; sy < e.Height; sy++) // Stretch Y
|
||||
{
|
||||
try { WinFormsUtil.LayerImage(img, Properties.Resources.T2, (x + sx) * mapScale, (y + sy) * mapScale, opacity); }
|
||||
catch { }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Overlay Map Data
|
||||
|
|
@ -121,9 +143,13 @@ private Bitmap overlayEntities(Bitmap img)
|
|||
int x = (int)OWSE.CurrentZone.ZD.PX2;
|
||||
int y = (int)OWSE.CurrentZone.ZD.PY2;
|
||||
for (int sx = 0; sx < 1; sx++) // Stretch X
|
||||
{
|
||||
for (int sy = 0; sy < 1; sy++) // Stretch Y
|
||||
{
|
||||
try { WinFormsUtil.LayerImage(img, Properties.Resources.FLY, (x + sx) * mapScale, (y + sy) * mapScale, opacity/2); }
|
||||
catch { }
|
||||
}
|
||||
}
|
||||
}
|
||||
// Unknown
|
||||
//{
|
||||
|
|
@ -137,7 +163,7 @@ private Bitmap overlayEntities(Bitmap img)
|
|||
}
|
||||
|
||||
// UI
|
||||
private void hoverMap(object sender, MouseEventArgs e)
|
||||
private void HoverMap(object sender, MouseEventArgs e)
|
||||
{
|
||||
if (mapScale < 0)
|
||||
return;
|
||||
|
|
@ -151,10 +177,10 @@ private void hoverMap(object sender, MouseEventArgs e)
|
|||
int entryX = X/40;
|
||||
int entryY = Y/40;
|
||||
|
||||
int entry = entryY*(PB_Map.Image.Width/40/mapScale) + entryX;
|
||||
int entry = (entryY *(PB_Map.Image.Width/40/mapScale)) + entryX;
|
||||
int epX = X%40;
|
||||
int epY = Y%40;
|
||||
int tile = epY * 40 + epX;
|
||||
int tile = (epY * 40) + epX;
|
||||
try
|
||||
{
|
||||
var tileVal = OWSE.mm.Entries[entry] == null
|
||||
|
|
@ -165,10 +191,11 @@ private void hoverMap(object sender, MouseEventArgs e)
|
|||
}
|
||||
catch { }
|
||||
}
|
||||
|
||||
private void B_Redraw_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (DrawMap != -1)
|
||||
PB_Map.Image = getMapImage(sliceArea: true);
|
||||
PB_Map.Image = GetMapImage(sliceArea: true);
|
||||
}
|
||||
|
||||
private void MapPermView_FormClosing(object sender, FormClosingEventArgs e)
|
||||
|
|
@ -178,13 +205,13 @@ private void MapPermView_FormClosing(object sender, FormClosingEventArgs e)
|
|||
e.Cancel = true;
|
||||
}
|
||||
|
||||
private void focusPanel(object sender, EventArgs e)
|
||||
private void FocusPanel(object sender, EventArgs e)
|
||||
{
|
||||
if (ContainsFocus)
|
||||
PAN_MAP.Focus();
|
||||
}
|
||||
|
||||
private void dclickMap(object sender, EventArgs e)
|
||||
private void DclickMap(object sender, EventArgs e)
|
||||
{
|
||||
DialogResult dr = WinFormsUtil.Prompt(MessageBoxButtons.YesNoCancel, "Copy image to Clipboard?",
|
||||
"Yes: Map & Overworlds" + Environment.NewLine + "No: Map Only");
|
||||
|
|
|
|||
646
pk3DS/Subforms/Gen6/Experimental/OWSE.Designer.cs
generated
646
pk3DS/Subforms/Gen6/Experimental/OWSE.Designer.cs
generated
File diff suppressed because it is too large
Load Diff
|
|
@ -18,14 +18,15 @@ public OWSE()
|
|||
|
||||
// Script Drag&Drop
|
||||
AllowDrop = true;
|
||||
DragEnter += tabMain_DragEnter;
|
||||
DragDrop += tabMain_DragDrop;
|
||||
DragEnter += TabMain_DragEnter;
|
||||
DragDrop += TabMain_DragDrop;
|
||||
|
||||
// Finished
|
||||
openQuick(Directory.GetFiles("encdata"));
|
||||
OpenQuick(Directory.GetFiles("encdata"));
|
||||
mapView.Show();
|
||||
tb_Zone.SelectedIndex = 1; // Show Overworlds tab
|
||||
}
|
||||
|
||||
private readonly string[] gameLocations = Main.Config.getText(TextName.metlist_000000);
|
||||
private string[] filepaths;
|
||||
private string[] encdatapaths;
|
||||
|
|
@ -42,7 +43,7 @@ public OWSE()
|
|||
internal static MapMatrix mm;
|
||||
private readonly MapPermView mapView = new MapPermView();
|
||||
|
||||
private void openQuick(string[] encdata)
|
||||
private void OpenQuick(string[] encdata)
|
||||
{
|
||||
// Gather
|
||||
encdatapaths = encdata;
|
||||
|
|
@ -72,12 +73,14 @@ private void openQuick(string[] encdata)
|
|||
CB_LocationID_SelectedIndexChanged(null, null);
|
||||
NUD_WMap.Maximum = zdLocations.Length; // Cap map warp destinations to the amount of maps.
|
||||
}
|
||||
|
||||
private void B_Map_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (!mapView.Visible)
|
||||
mapView.Show();
|
||||
}
|
||||
private void closingForm(object sender, FormClosingEventArgs e)
|
||||
|
||||
private void ClosingForm(object sender, FormClosingEventArgs e)
|
||||
{
|
||||
// Close map view
|
||||
mapView.Close();
|
||||
|
|
@ -86,15 +89,16 @@ private void closingForm(object sender, FormClosingEventArgs e)
|
|||
|
||||
private void CB_LocationID_SelectedIndexChanged(object sender, EventArgs e)
|
||||
{
|
||||
setEntry();
|
||||
SetEntry();
|
||||
entry = CB_LocationID.SelectedIndex;
|
||||
getEntry();
|
||||
GetEntry();
|
||||
}
|
||||
private void getEntry()
|
||||
|
||||
private void GetEntry()
|
||||
{
|
||||
if (entry < 0) return;
|
||||
byte[] raw = File.ReadAllBytes(filepaths[entry]);
|
||||
locationData = Core.CTR.Mini.UnpackMini(raw, "ZO");
|
||||
locationData = Mini.UnpackMini(raw, "ZO");
|
||||
if (locationData == null) return;
|
||||
|
||||
// Read master ZD table
|
||||
|
|
@ -105,15 +109,15 @@ private void getEntry()
|
|||
CurrentZone = new Zone(locationData);
|
||||
// File 0 - ZoneData
|
||||
RTB_ZD.Lines = Scripts.getHexLines(locationData[0], 0x10);
|
||||
getZoneData();
|
||||
GetZoneData();
|
||||
|
||||
// File 1 - Overworld Setup & Script
|
||||
RTB_OWSC.Lines = Scripts.getHexLines(locationData[1], 0x10);
|
||||
getOWSData();
|
||||
GetOWSData();
|
||||
|
||||
// File 2 - Map Script
|
||||
RTB_MapSC.Lines = Scripts.getHexLines(locationData[2], 0x10);
|
||||
getScriptData();
|
||||
GetScriptData();
|
||||
|
||||
// File 3 - Encounters
|
||||
RTB_Encounter.Lines = Scripts.getHexLines(locationData[3], 0x10);
|
||||
|
|
@ -121,15 +125,16 @@ private void getEntry()
|
|||
// File 4 - ?? (ORAS Only?)
|
||||
RTB_File5.Lines = Scripts.getHexLines(locationData.Length <= 4 ? null : locationData[4], 0x10);
|
||||
}
|
||||
private void setEntry()
|
||||
|
||||
private void SetEntry()
|
||||
{
|
||||
if (entry < 0) return;
|
||||
if (debugToolDumping) return;
|
||||
|
||||
// Set the data back into the class object
|
||||
// Currently only the first two files.
|
||||
setZoneData(); // File 0
|
||||
setOWSData();
|
||||
SetZoneData(); // File 0
|
||||
SetOWSData();
|
||||
// setMSData();
|
||||
// setEncounterData();
|
||||
// if (Main.Config.ORAS)
|
||||
|
|
@ -151,7 +156,7 @@ private void setEntry()
|
|||
}
|
||||
|
||||
// Loading of Data
|
||||
private void getZoneData()
|
||||
private void GetZoneData()
|
||||
{
|
||||
L_ZDPreview.Text = "Text File: " + CurrentZone.ZD.TextFile
|
||||
+ Environment.NewLine + "Map File: " + CurrentZone.ZD.MapMatrix;
|
||||
|
|
@ -168,26 +173,27 @@ private void getZoneData()
|
|||
}
|
||||
|
||||
// Fetch Map Image
|
||||
mapView.drawMap(CurrentZone.ZD.MapMatrix);
|
||||
mapView.SetMap(CurrentZone.ZD.MapMatrix);
|
||||
}
|
||||
private void getOWSData()
|
||||
|
||||
private void GetOWSData()
|
||||
{
|
||||
// Reset Fields a little.
|
||||
RTB_F.Text = RTB_N.Text = RTB_W.Text = RTB_T1.Text = RTB_T2.Text = string.Empty;
|
||||
fEntry = nEntry = wEntry = tEntry = uEntry = -1;
|
||||
// Set Counters
|
||||
NUD_FurnCount.Value = CurrentZone.Entities.FurnitureCount; changeFurnitureCount(null, null);
|
||||
NUD_NPCCount.Value = CurrentZone.Entities.NPCCount; changeNPCCount(null, null);
|
||||
NUD_WarpCount.Value = CurrentZone.Entities.WarpCount; changeWarpCount(null, null);
|
||||
NUD_TrigCount.Value = CurrentZone.Entities.TriggerCount; changeTriggerCount(null, null);
|
||||
NUD_UnkCount.Value = CurrentZone.Entities.UnknownCount; changeUnkCount(null, null);
|
||||
NUD_FurnCount.Value = CurrentZone.Entities.FurnitureCount; ChangeFurnitureCount(null, null);
|
||||
NUD_NPCCount.Value = CurrentZone.Entities.NPCCount; ChangeNPCCount(null, null);
|
||||
NUD_WarpCount.Value = CurrentZone.Entities.WarpCount; ChangeWarpCount(null, null);
|
||||
NUD_TrigCount.Value = CurrentZone.Entities.TriggerCount; ChangeTriggerCount(null, null);
|
||||
NUD_UnkCount.Value = CurrentZone.Entities.UnknownCount; ChangeUnkCount(null, null);
|
||||
|
||||
// Collect/Load Data
|
||||
NUD_FE.Value = NUD_FE.Maximum < 0 ? -1 : 0; changeFurniture(null, null);
|
||||
NUD_NE.Value = NUD_NE.Maximum < 0 ? -1 : 0; changeNPC(null, null);
|
||||
NUD_WE.Value = NUD_WE.Maximum < 0 ? -1 : 0; changeWarp(null, null);
|
||||
NUD_TE.Value = NUD_TE.Maximum < 0 ? -1 : 0; changeTrigger1(null, null);
|
||||
NUD_UE.Value = NUD_UE.Maximum < 0 ? -1 : 0; changeTrigger2(null, null);
|
||||
NUD_FE.Value = NUD_FE.Maximum < 0 ? -1 : 0; ChangeFurniture(null, null);
|
||||
NUD_NE.Value = NUD_NE.Maximum < 0 ? -1 : 0; ChangeNPC(null, null);
|
||||
NUD_WE.Value = NUD_WE.Maximum < 0 ? -1 : 0; ChangeWarp(null, null);
|
||||
NUD_TE.Value = NUD_TE.Maximum < 0 ? -1 : 0; ChangeTrigger1(null, null);
|
||||
NUD_UE.Value = NUD_UE.Maximum < 0 ? -1 : 0; ChangeTrigger2(null, null);
|
||||
|
||||
// Process Scripts
|
||||
var script = CurrentZone.Entities.Script;
|
||||
|
|
@ -205,9 +211,12 @@ private void getOWSData()
|
|||
RTB_OSP.Lines = script.ParseScript.Concat(script.ParseMoves).ToArray();
|
||||
}
|
||||
else
|
||||
RTB_OWSCMD.Lines = RTB_OS.Lines = new[] {"No Data"};
|
||||
{
|
||||
RTB_OWSCMD.Lines = RTB_OS.Lines = new[] { "No Data" };
|
||||
}
|
||||
}
|
||||
private void getScriptData()
|
||||
|
||||
private void GetScriptData()
|
||||
{
|
||||
var script = CurrentZone.MapScript.Script;
|
||||
if (script.Raw.Length > 4)
|
||||
|
|
@ -224,33 +233,38 @@ private void getScriptData()
|
|||
RTB_MSP.Lines = script.ParseScript.Concat(script.ParseMoves).ToArray();
|
||||
}
|
||||
else
|
||||
{
|
||||
RTB_MSCMD.Lines = RTB_OS.Lines = new[] { "No Data" };
|
||||
}
|
||||
}
|
||||
private void setZoneData()
|
||||
|
||||
private void SetZoneData()
|
||||
{
|
||||
// Nothing, ZoneData is not currently researched enough.
|
||||
}
|
||||
private void setOWSData()
|
||||
|
||||
private void SetOWSData()
|
||||
{
|
||||
// Force all entities to be written back
|
||||
setFurniture();
|
||||
setNPC();
|
||||
setWarp();
|
||||
setTrigger1();
|
||||
setTrigger2();
|
||||
SetFurniture();
|
||||
SetNPC();
|
||||
SetWarp();
|
||||
SetTrigger1();
|
||||
SetTrigger2();
|
||||
}
|
||||
|
||||
// Overworld Viewing
|
||||
private int entry = -1;
|
||||
private int fEntry, nEntry, wEntry, tEntry, uEntry = -1;
|
||||
#region Enabling
|
||||
internal static void toggleEnable(NumericUpDown master, NumericUpDown slave, GroupBox display)
|
||||
internal static void ToggleEnable(NumericUpDown master, NumericUpDown slave, GroupBox display)
|
||||
{
|
||||
slave.Maximum = master.Value - 1;
|
||||
slave.Enabled = display.Visible = slave.Maximum > -1;
|
||||
slave.Minimum = slave.Enabled ? 0 : -1;
|
||||
}
|
||||
private void changeFurnitureCount(object sender, EventArgs e)
|
||||
|
||||
private void ChangeFurnitureCount(object sender, EventArgs e)
|
||||
{
|
||||
// Resize array
|
||||
int count = (int)NUD_FurnCount.Value;
|
||||
|
|
@ -259,9 +273,10 @@ private void changeFurnitureCount(object sender, EventArgs e)
|
|||
for (int i = 0; i < count; i++)
|
||||
CurrentZone.Entities.Furniture[i] = CurrentZone.Entities.Furniture[i] ?? new Zone.ZoneEntities.EntityFurniture();
|
||||
|
||||
toggleEnable(NUD_FurnCount, NUD_FE, GB_F);
|
||||
ToggleEnable(NUD_FurnCount, NUD_FE, GB_F);
|
||||
}
|
||||
private void changeNPCCount(object sender, EventArgs e)
|
||||
|
||||
private void ChangeNPCCount(object sender, EventArgs e)
|
||||
{
|
||||
// Resize array
|
||||
int count = (int)NUD_NPCCount.Value;
|
||||
|
|
@ -270,9 +285,10 @@ private void changeNPCCount(object sender, EventArgs e)
|
|||
for (int i = 0; i < count; i++)
|
||||
CurrentZone.Entities.NPCs[i] = CurrentZone.Entities.NPCs[i] ?? new Zone.ZoneEntities.EntityNPC();
|
||||
|
||||
toggleEnable(NUD_NPCCount, NUD_NE, GB_N);
|
||||
ToggleEnable(NUD_NPCCount, NUD_NE, GB_N);
|
||||
}
|
||||
private void changeWarpCount(object sender, EventArgs e)
|
||||
|
||||
private void ChangeWarpCount(object sender, EventArgs e)
|
||||
{
|
||||
// Resize array
|
||||
int count = (int)NUD_WarpCount.Value;
|
||||
|
|
@ -281,9 +297,10 @@ private void changeWarpCount(object sender, EventArgs e)
|
|||
for (int i = 0; i < count; i++)
|
||||
CurrentZone.Entities.Warps[i] = CurrentZone.Entities.Warps[i] ?? new Zone.ZoneEntities.EntityWarp();
|
||||
|
||||
toggleEnable(NUD_WarpCount, NUD_WE, GB_W);
|
||||
ToggleEnable(NUD_WarpCount, NUD_WE, GB_W);
|
||||
}
|
||||
private void changeTriggerCount(object sender, EventArgs e)
|
||||
|
||||
private void ChangeTriggerCount(object sender, EventArgs e)
|
||||
{
|
||||
// Resize array
|
||||
int count = (int)NUD_TrigCount.Value;
|
||||
|
|
@ -292,9 +309,10 @@ private void changeTriggerCount(object sender, EventArgs e)
|
|||
for (int i = 0; i < count; i++)
|
||||
CurrentZone.Entities.Triggers1[i] = CurrentZone.Entities.Triggers1[i] ?? new Zone.ZoneEntities.EntityTrigger1();
|
||||
|
||||
toggleEnable(NUD_TrigCount, NUD_TE, GB_T1);
|
||||
ToggleEnable(NUD_TrigCount, NUD_TE, GB_T1);
|
||||
}
|
||||
private void changeUnkCount(object sender, EventArgs e)
|
||||
|
||||
private void ChangeUnkCount(object sender, EventArgs e)
|
||||
{
|
||||
// Resize array
|
||||
int count = (int)NUD_UnkCount.Value;
|
||||
|
|
@ -303,18 +321,19 @@ private void changeUnkCount(object sender, EventArgs e)
|
|||
for (int i = 0; i < count; i++)
|
||||
CurrentZone.Entities.Triggers2[i] = CurrentZone.Entities.Triggers2[i] ?? new Zone.ZoneEntities.EntityTrigger2();
|
||||
|
||||
toggleEnable(NUD_UnkCount, NUD_UE, GB_T2);
|
||||
ToggleEnable(NUD_UnkCount, NUD_UE, GB_T2);
|
||||
}
|
||||
#endregion
|
||||
#region Updating
|
||||
private void changeFurniture(object sender, EventArgs e)
|
||||
private void ChangeFurniture(object sender, EventArgs e)
|
||||
{
|
||||
if (NUD_FE.Value < 0) return;
|
||||
setFurniture();
|
||||
SetFurniture();
|
||||
fEntry = (int)NUD_FE.Value;
|
||||
getFurniture();
|
||||
GetFurniture();
|
||||
}
|
||||
private void getFurniture()
|
||||
|
||||
private void GetFurniture()
|
||||
{
|
||||
if (NUD_FE.Value < 0) return;
|
||||
|
||||
|
|
@ -325,7 +344,8 @@ private void getFurniture()
|
|||
NUD_FWY.Value = Furniture.WY;
|
||||
RTB_F.Text = Util.getHexString(Furniture.Raw);
|
||||
}
|
||||
private void setFurniture()
|
||||
|
||||
private void SetFurniture()
|
||||
{
|
||||
if (NUD_FE.Value < 0) return;
|
||||
if (fEntry < 0) return;
|
||||
|
|
@ -337,14 +357,15 @@ private void setFurniture()
|
|||
FUrniture.WY = (int)NUD_FWY.Value;
|
||||
}
|
||||
|
||||
private void changeNPC(object sender, EventArgs e)
|
||||
private void ChangeNPC(object sender, EventArgs e)
|
||||
{
|
||||
if (NUD_NE.Value < 0) return;
|
||||
setNPC();
|
||||
SetNPC();
|
||||
nEntry = (int)NUD_NE.Value;
|
||||
getNPC();
|
||||
GetNPC();
|
||||
}
|
||||
private void getNPC()
|
||||
|
||||
private void GetNPC()
|
||||
{
|
||||
if (NUD_NE.Value < 0) return;
|
||||
var NPC = CurrentZone.Entities.NPCs[nEntry];
|
||||
|
|
@ -369,7 +390,8 @@ private void getNPC()
|
|||
|
||||
RTB_N.Text = Util.getHexString(NPC.Raw);
|
||||
}
|
||||
private void setNPC()
|
||||
|
||||
private void SetNPC()
|
||||
{
|
||||
if (NUD_NE.Value < 0) return;
|
||||
if (nEntry < 0) return;
|
||||
|
|
@ -388,14 +410,15 @@ private void setNPC()
|
|||
NPC.MovePermissions2 = (int)NUD_NMove2.Value;
|
||||
}
|
||||
|
||||
private void changeWarp(object sender, EventArgs e)
|
||||
private void ChangeWarp(object sender, EventArgs e)
|
||||
{
|
||||
if (NUD_WE.Value < 0) return;
|
||||
setWarp();
|
||||
SetWarp();
|
||||
wEntry = (int)NUD_WE.Value;
|
||||
getWarp();
|
||||
GetWarp();
|
||||
}
|
||||
private void getWarp()
|
||||
|
||||
private void GetWarp()
|
||||
{
|
||||
if (NUD_WE.Value < 0) return;
|
||||
|
||||
|
|
@ -412,7 +435,8 @@ private void getWarp()
|
|||
// Flavor Mods
|
||||
L_WarpDest.Text = zdLocations[Warp.DestinationMap];
|
||||
}
|
||||
private void setWarp()
|
||||
|
||||
private void SetWarp()
|
||||
{
|
||||
if (NUD_WE.Value < 0) return;
|
||||
if (wEntry < 0) return;
|
||||
|
|
@ -424,14 +448,15 @@ private void setWarp()
|
|||
Warp.Y = (int)NUD_WY.Value;
|
||||
}
|
||||
|
||||
private void changeTrigger1(object sender, EventArgs e)
|
||||
private void ChangeTrigger1(object sender, EventArgs e)
|
||||
{
|
||||
if (NUD_TE.Value < 0) return;
|
||||
setTrigger1();
|
||||
SetTrigger1();
|
||||
tEntry = (int)NUD_TE.Value;
|
||||
getTrigger1();
|
||||
GetTrigger1();
|
||||
}
|
||||
private void getTrigger1()
|
||||
|
||||
private void GetTrigger1()
|
||||
{
|
||||
if (NUD_TE.Value < 0) return;
|
||||
|
||||
|
|
@ -440,7 +465,8 @@ private void getTrigger1()
|
|||
NUD_T1Y.Value = Trigger1.Y;
|
||||
RTB_T1.Text = Util.getHexString(Trigger1.Raw);
|
||||
}
|
||||
private void setTrigger1()
|
||||
|
||||
private void SetTrigger1()
|
||||
{
|
||||
if (NUD_TE.Value < 0) return;
|
||||
if (tEntry < 0) return;
|
||||
|
|
@ -450,14 +476,15 @@ private void setTrigger1()
|
|||
Trigger1.Y = (int)NUD_T1Y.Value;
|
||||
}
|
||||
|
||||
private void changeTrigger2(object sender, EventArgs e)
|
||||
private void ChangeTrigger2(object sender, EventArgs e)
|
||||
{
|
||||
if (NUD_UE.Value < 0) return;
|
||||
setTrigger2();
|
||||
SetTrigger2();
|
||||
uEntry = (int)NUD_UE.Value;
|
||||
getTrigger2();
|
||||
GetTrigger2();
|
||||
}
|
||||
private void getTrigger2()
|
||||
|
||||
private void GetTrigger2()
|
||||
{
|
||||
if (NUD_UE.Value < 0) return;
|
||||
|
||||
|
|
@ -467,7 +494,8 @@ private void getTrigger2()
|
|||
NUD_T2Y.Value = Trigger2.Y;
|
||||
RTB_T2.Text = Util.getHexString(Trigger2.Raw);
|
||||
}
|
||||
private void setTrigger2()
|
||||
|
||||
private void SetTrigger2()
|
||||
{
|
||||
if (NUD_UE.Value < 0) return;
|
||||
if (uEntry < 0) return;
|
||||
|
|
@ -479,15 +507,10 @@ private void setTrigger2()
|
|||
#endregion
|
||||
|
||||
// Overworld User Enhancements
|
||||
private void changeNPC_ID(object sender, EventArgs e)
|
||||
{
|
||||
L_NID.ForeColor = NUD_NID.Value != NUD_NE.Value ? Color.Red : Color.Black;
|
||||
}
|
||||
private void changeNPC_Model(object sender, EventArgs e)
|
||||
{
|
||||
L_ModelAsHex.Text = "0x" + ((int)NUD_NModel.Value).ToString("X4");
|
||||
}
|
||||
private void dclickDestMap(object sender, EventArgs e)
|
||||
private void ChangeNPC_ID(object sender, EventArgs e) => L_NID.ForeColor = NUD_NID.Value != NUD_NE.Value ? Color.Red : Color.Black;
|
||||
private void ChangeNPC_Model(object sender, EventArgs e) => L_ModelAsHex.Text = "0x" + ((int)NUD_NModel.Value).ToString("X4");
|
||||
|
||||
private void DclickDestMap(object sender, EventArgs e)
|
||||
{
|
||||
var Tile = NUD_WTile.Value;
|
||||
CB_LocationID.SelectedIndex = (int)NUD_WMap.Value;
|
||||
|
|
@ -496,39 +519,38 @@ private void dclickDestMap(object sender, EventArgs e)
|
|||
catch
|
||||
{ try { NUD_WE.Value = 0; } catch { } }
|
||||
}
|
||||
private void changeWarp_X(object sender, EventArgs e)
|
||||
{
|
||||
L_WpX.Text = (NUD_WX.Value / 18).ToString();
|
||||
}
|
||||
private void changeWarp_Y(object sender, EventArgs e)
|
||||
{
|
||||
L_WpY.Text = (NUD_WY.Value / 18).ToString();
|
||||
}
|
||||
|
||||
private void ChangeWarp_X(object sender, EventArgs e) => L_WpX.Text = (NUD_WX.Value / 18).ToString();
|
||||
private void ChangeWarp_Y(object sender, EventArgs e) => L_WpY.Text = (NUD_WY.Value / 18).ToString();
|
||||
|
||||
// Script Handling
|
||||
private void B_HLCMD_Click(object sender, EventArgs e)
|
||||
{
|
||||
int ctr = WinFormsUtil.highlightText(RTB_OSP, "**", Color.Red) + WinFormsUtil.highlightText(RTB_MSP, "**", Color.Red) / 2;
|
||||
int ctr = WinFormsUtil.highlightText(RTB_OSP, "**", Color.Red) + (WinFormsUtil.highlightText(RTB_MSP, "**", Color.Red) / 2);
|
||||
WinFormsUtil.Alert($"{ctr} instance{(ctr > 1 ? "s" : "")} of \"*\" present.");
|
||||
}
|
||||
private void tabMain_DragEnter(object sender, DragEventArgs e)
|
||||
|
||||
private void TabMain_DragEnter(object sender, DragEventArgs e)
|
||||
{
|
||||
if (e.Data.GetDataPresent(DataFormats.FileDrop)) e.Effect = DragDropEffects.Copy;
|
||||
}
|
||||
private void tabMain_DragDrop(object sender, DragEventArgs e)
|
||||
|
||||
private void TabMain_DragDrop(object sender, DragEventArgs e)
|
||||
{
|
||||
string[] files = (string[])e.Data.GetData(DataFormats.FileDrop);
|
||||
string path = files[0]; // open first D&D
|
||||
if (new FileInfo(path).Length < 10000000)
|
||||
parseScriptInput(File.ReadAllBytes(path));
|
||||
ParseScriptInput(File.ReadAllBytes(path));
|
||||
}
|
||||
private void parseScriptInput(byte[] data)
|
||||
|
||||
private void ParseScriptInput(byte[] data)
|
||||
{
|
||||
Script scr = new Script(data);
|
||||
RTB_CompressedScript.Lines = Scripts.getHexLines(scr.CompressedBytes);
|
||||
System.Media.SystemSounds.Asterisk.Play();
|
||||
}
|
||||
private void pasteScript(object sender, EventArgs e)
|
||||
|
||||
private void PasteScript(object sender, EventArgs e)
|
||||
{
|
||||
// import data as bytes
|
||||
try
|
||||
|
|
@ -573,6 +595,7 @@ private void B_DumpFurniture_Click(object sender, EventArgs e)
|
|||
CB_LocationID.SelectedIndex = 0;
|
||||
debugToolDumping = false;
|
||||
}
|
||||
|
||||
private void B_DumpNPC_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (WinFormsUtil.Prompt(MessageBoxButtons.YesNoCancel, "Export all NPCs?") != DialogResult.Yes)
|
||||
|
|
@ -599,6 +622,7 @@ private void B_DumpNPC_Click(object sender, EventArgs e)
|
|||
CB_LocationID.SelectedIndex = 0;
|
||||
debugToolDumping = false;
|
||||
}
|
||||
|
||||
private void B_DumpWarp_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (WinFormsUtil.Prompt(MessageBoxButtons.YesNoCancel, "Export all Warps?") != DialogResult.Yes)
|
||||
|
|
@ -625,6 +649,7 @@ private void B_DumpWarp_Click(object sender, EventArgs e)
|
|||
CB_LocationID.SelectedIndex = 0;
|
||||
debugToolDumping = false;
|
||||
}
|
||||
|
||||
private void B_DumpTrigger_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (WinFormsUtil.Prompt(MessageBoxButtons.YesNoCancel, "Export all Triggers?") != DialogResult.Yes)
|
||||
|
|
@ -651,6 +676,7 @@ private void B_DumpTrigger_Click(object sender, EventArgs e)
|
|||
CB_LocationID.SelectedIndex = 0;
|
||||
debugToolDumping = false;
|
||||
}
|
||||
|
||||
private void B_DumpUnk_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (WinFormsUtil.Prompt(MessageBoxButtons.YesNoCancel, "Export all Unks?") != DialogResult.Yes)
|
||||
|
|
@ -677,6 +703,7 @@ private void B_DumpUnk_Click(object sender, EventArgs e)
|
|||
CB_LocationID.SelectedIndex = 0;
|
||||
debugToolDumping = false;
|
||||
}
|
||||
|
||||
private void B_DumpMaps_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (WinFormsUtil.Prompt(MessageBoxButtons.YesNoCancel, "Export all MapImages?") != DialogResult.Yes)
|
||||
|
|
@ -691,7 +718,7 @@ private void B_DumpMaps_Click(object sender, EventArgs e)
|
|||
for (int i = 0; i < CB_LocationID.Items.Count; i++)
|
||||
{
|
||||
mapView.DrawMap = i;
|
||||
Image img = mapView.getMapImage(crop: true);
|
||||
Image img = mapView.GetMapImage(crop: true);
|
||||
using (MemoryStream ms = new MemoryStream())
|
||||
{
|
||||
//error will throw from here
|
||||
|
|
@ -699,8 +726,8 @@ private void B_DumpMaps_Click(object sender, EventArgs e)
|
|||
byte[] data = ms.ToArray();
|
||||
File.WriteAllBytes(Path.Combine(folder, $"{zdLocations[i].Replace('?', '-')} ({i}).png"), data);
|
||||
}
|
||||
string l = mm.EntryList.Where(t => t != 0xFFFF).Aggregate("", (current, t) => current + t.ToString("000" + " "));
|
||||
result[i] = $"{i.ToString("000")}\t{CB_LocationID.Items[i]}\t{l}";
|
||||
string l = mm.EntryList.Where(t => t != 0xFFFF).Aggregate("", (current, t) => current + t.ToString("000 "));
|
||||
result[i] = $"{i:000}\t{CB_LocationID.Items[i]}\t{l}";
|
||||
}
|
||||
if (WinFormsUtil.Prompt(MessageBoxButtons.YesNoCancel, "Write Map parse output?") == DialogResult.Yes)
|
||||
File.WriteAllLines("MapLocations.txt", result);
|
||||
|
|
@ -708,6 +735,7 @@ private void B_DumpMaps_Click(object sender, EventArgs e)
|
|||
WinFormsUtil.Alert("All Map images have been dumped to " + folder + ".");
|
||||
debugToolDumping = false;
|
||||
}
|
||||
|
||||
private void B_DumpZD_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (WinFormsUtil.Prompt(MessageBoxButtons.YesNoCancel, "Export all ZD?") != DialogResult.Yes)
|
||||
|
|
@ -733,9 +761,9 @@ private void B_DumpZD_Click(object sender, EventArgs e)
|
|||
}
|
||||
|
||||
// Raw file editing
|
||||
private void changeRAWCheck(object sender, EventArgs e)
|
||||
private void ChangeRAWCheck(object sender, EventArgs e)
|
||||
{
|
||||
bool chk = (sender as CheckBox).Checked;
|
||||
bool chk = ((CheckBox)sender).Checked;
|
||||
foreach (NumericUpDown nud in GB_F.Controls.OfType<NumericUpDown>())
|
||||
nud.Enabled = !chk;
|
||||
foreach (NumericUpDown nud in GB_N.Controls.OfType<NumericUpDown>())
|
||||
|
|
@ -750,94 +778,99 @@ private void changeRAWCheck(object sender, EventArgs e)
|
|||
foreach (RichTextBox rtb in new[] {RTB_F, RTB_N, RTB_W, RTB_T1, RTB_T2})
|
||||
rtb.Visible = chk;
|
||||
}
|
||||
private void changeRAW_F(object sender, EventArgs e)
|
||||
|
||||
private void ChangeRAW_F(object sender, EventArgs e)
|
||||
{
|
||||
if (!(sender is RichTextBox) || !(sender as RichTextBox).Visible)
|
||||
if (!(sender is RichTextBox) || !((RichTextBox) sender).Visible)
|
||||
return;
|
||||
|
||||
try
|
||||
{
|
||||
byte[] data = Util.StringToByteArray((sender as RichTextBox).Text.Replace(Environment.NewLine, " ").Replace(" ", ""));
|
||||
byte[] data = Util.StringToByteArray(((RichTextBox) sender).Text.Replace(Environment.NewLine, " ").Replace(" ", ""));
|
||||
if (data.Length != Zone.ZoneEntities.EntityFurniture.Size)
|
||||
return;
|
||||
CurrentZone.Entities.Furniture[fEntry].Raw = data;
|
||||
getFurniture();
|
||||
GetFurniture();
|
||||
}
|
||||
catch
|
||||
{
|
||||
(sender as RichTextBox).Text = Util.getHexString(CurrentZone.Entities.Furniture[fEntry].Raw);
|
||||
((RichTextBox) sender).Text = Util.getHexString(CurrentZone.Entities.Furniture[fEntry].Raw);
|
||||
}
|
||||
}
|
||||
private void changeRAW_N(object sender, EventArgs e)
|
||||
|
||||
private void ChangeRAW_N(object sender, EventArgs e)
|
||||
{
|
||||
if (!(sender is RichTextBox) || !(sender as RichTextBox).Visible)
|
||||
if (!(sender is RichTextBox) || !((RichTextBox) sender).Visible)
|
||||
return;
|
||||
|
||||
try
|
||||
{
|
||||
byte[] data = Util.StringToByteArray((sender as RichTextBox).Text.Replace(Environment.NewLine, " ").Replace(" ", ""));
|
||||
byte[] data = Util.StringToByteArray(((RichTextBox) sender).Text.Replace(Environment.NewLine, " ").Replace(" ", ""));
|
||||
if (data.Length != Zone.ZoneEntities.EntityNPC.Size)
|
||||
return;
|
||||
CurrentZone.Entities.NPCs[nEntry].Raw = data;
|
||||
getNPC();
|
||||
GetNPC();
|
||||
}
|
||||
catch
|
||||
{
|
||||
(sender as RichTextBox).Text = Util.getHexString(CurrentZone.Entities.NPCs[nEntry].Raw);
|
||||
((RichTextBox) sender).Text = Util.getHexString(CurrentZone.Entities.NPCs[nEntry].Raw);
|
||||
}
|
||||
}
|
||||
private void changeRAW_W(object sender, EventArgs e)
|
||||
|
||||
private void ChangeRAW_W(object sender, EventArgs e)
|
||||
{
|
||||
if (!(sender is RichTextBox) || !(sender as RichTextBox).Visible)
|
||||
if (!(sender is RichTextBox) || !((RichTextBox) sender).Visible)
|
||||
return;
|
||||
|
||||
try
|
||||
{
|
||||
byte[] data = Util.StringToByteArray((sender as RichTextBox).Text.Replace(Environment.NewLine, " ").Replace(" ", ""));
|
||||
byte[] data = Util.StringToByteArray(((RichTextBox) sender).Text.Replace(Environment.NewLine, " ").Replace(" ", ""));
|
||||
if (data.Length != Zone.ZoneEntities.EntityWarp.Size)
|
||||
return;
|
||||
CurrentZone.Entities.Warps[wEntry].Raw = data;
|
||||
getWarp();
|
||||
GetWarp();
|
||||
}
|
||||
catch
|
||||
{
|
||||
(sender as RichTextBox).Text = Util.getHexString(CurrentZone.Entities.Warps[wEntry].Raw);
|
||||
((RichTextBox) sender).Text = Util.getHexString(CurrentZone.Entities.Warps[wEntry].Raw);
|
||||
}
|
||||
}
|
||||
private void changeRAW_T1(object sender, EventArgs e)
|
||||
|
||||
private void ChangeRAW_T1(object sender, EventArgs e)
|
||||
{
|
||||
if (!(sender is RichTextBox) || !(sender as RichTextBox).Visible)
|
||||
if (!(sender is RichTextBox) || !((RichTextBox) sender).Visible)
|
||||
return;
|
||||
|
||||
try
|
||||
{
|
||||
byte[] data = Util.StringToByteArray((sender as RichTextBox).Text.Replace(Environment.NewLine, " ").Replace(" ", ""));
|
||||
byte[] data = Util.StringToByteArray(((RichTextBox) sender).Text.Replace(Environment.NewLine, " ").Replace(" ", ""));
|
||||
if (data.Length != Zone.ZoneEntities.EntityTrigger1.Size)
|
||||
return;
|
||||
CurrentZone.Entities.Triggers1[tEntry].Raw = data;
|
||||
getTrigger1();
|
||||
GetTrigger1();
|
||||
}
|
||||
catch
|
||||
{
|
||||
(sender as RichTextBox).Text = Util.getHexString(CurrentZone.Entities.Triggers1[tEntry].Raw);
|
||||
((RichTextBox) sender).Text = Util.getHexString(CurrentZone.Entities.Triggers1[tEntry].Raw);
|
||||
}
|
||||
}
|
||||
private void changeRAW_T2(object sender, EventArgs e)
|
||||
|
||||
private void ChangeRAW_T2(object sender, EventArgs e)
|
||||
{
|
||||
if (!(sender is RichTextBox) || !(sender as RichTextBox).Visible)
|
||||
if (!(sender is RichTextBox) || !((RichTextBox) sender).Visible)
|
||||
return;
|
||||
|
||||
try
|
||||
{
|
||||
byte[] data = Util.StringToByteArray((sender as RichTextBox).Text.Replace(Environment.NewLine, " ").Replace(" ",""));
|
||||
byte[] data = Util.StringToByteArray(((RichTextBox) sender).Text.Replace(Environment.NewLine, " ").Replace(" ",""));
|
||||
if (data.Length != Zone.ZoneEntities.EntityTrigger2.Size)
|
||||
return;
|
||||
CurrentZone.Entities.Triggers2[uEntry].Raw = data;
|
||||
getTrigger2();
|
||||
GetTrigger2();
|
||||
}
|
||||
catch
|
||||
{
|
||||
(sender as RichTextBox).Text = Util.getHexString(CurrentZone.Entities.Triggers2[uEntry].Raw);
|
||||
((RichTextBox) sender).Text = Util.getHexString(CurrentZone.Entities.Triggers2[uEntry].Raw);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -849,32 +882,37 @@ private void B_ResetOverworlds_Click(object sender, EventArgs e)
|
|||
|
||||
// since scripts are not editable, just reset the overworld file.
|
||||
CurrentZone.Entities = new Zone.ZoneEntities(locationData[1]);
|
||||
getOWSData();
|
||||
GetOWSData();
|
||||
}
|
||||
|
||||
private void B_ResetFurniture_Click(object sender, EventArgs e)
|
||||
{
|
||||
CurrentZone.Entities.Furniture[fEntry].OriginalData.CopyTo(CurrentZone.Entities.Furniture[fEntry].Raw, 0);
|
||||
getFurniture();
|
||||
GetFurniture();
|
||||
}
|
||||
|
||||
private void B_ResetNPC_Click(object sender, EventArgs e)
|
||||
{
|
||||
CurrentZone.Entities.NPCs[nEntry].OriginalData.CopyTo(CurrentZone.Entities.NPCs[nEntry].Raw, 0);
|
||||
getNPC();
|
||||
GetNPC();
|
||||
}
|
||||
|
||||
private void B_ResetWarp_Click(object sender, EventArgs e)
|
||||
{
|
||||
CurrentZone.Entities.Warps[wEntry].OriginalData.CopyTo(CurrentZone.Entities.Warps[wEntry].Raw, 0);
|
||||
getWarp();
|
||||
GetWarp();
|
||||
}
|
||||
|
||||
private void B_ResetTrigger1_Click(object sender, EventArgs e)
|
||||
{
|
||||
CurrentZone.Entities.Triggers1[tEntry].OriginalData.CopyTo(CurrentZone.Entities.Triggers1[tEntry].Raw, 0);
|
||||
getTrigger1();
|
||||
GetTrigger1();
|
||||
}
|
||||
|
||||
private void B_ResetTrigger2_Click(object sender, EventArgs e)
|
||||
{
|
||||
CurrentZone.Entities.Triggers2[uEntry].OriginalData.CopyTo(CurrentZone.Entities.Triggers2[uEntry].Raw, 0);
|
||||
getTrigger2();
|
||||
GetTrigger2();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -238,7 +238,7 @@ public class CollisionObject
|
|||
public float F1 => _0 / 2;
|
||||
public float F2 => _1 * 80;
|
||||
public float F3 => _2 / 2;
|
||||
public float F4 => _3;
|
||||
public float F4 => _3 / 1;
|
||||
|
||||
public CollisionObject(byte[] data)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -68,6 +68,7 @@ public GiftEditor6()
|
|||
"Ability 2",
|
||||
"Hidden Ability",
|
||||
};
|
||||
|
||||
private void B_Save_Click(object sender, EventArgs e)
|
||||
{
|
||||
saveEntry();
|
||||
|
|
@ -75,10 +76,12 @@ private void B_Save_Click(object sender, EventArgs e)
|
|||
RandSettings.SetFormSettings(this, tabPage2.Controls);
|
||||
Close();
|
||||
}
|
||||
|
||||
private void B_Cancel_Click(object sender, EventArgs e)
|
||||
{
|
||||
Close();
|
||||
}
|
||||
|
||||
private void loadData()
|
||||
{
|
||||
FieldData = File.ReadAllBytes(FieldPath);
|
||||
|
|
@ -86,7 +89,7 @@ private void loadData()
|
|||
LB_Gifts.Items.Clear();
|
||||
for (int i = 0; i < GiftData.Length; i++)
|
||||
{
|
||||
GiftData[i] = new EncounterGift6(FieldData.Skip(fieldOffset + i * fieldSize).Take(fieldSize).ToArray(), Main.Config.ORAS);
|
||||
GiftData[i] = new EncounterGift6(FieldData.Skip(fieldOffset + (i * fieldSize)).Take(fieldSize).ToArray(), Main.Config.ORAS);
|
||||
LB_Gifts.Items.Add($"{i:00} - {specieslist[GiftData[i].Species]}");
|
||||
}
|
||||
foreach (var s in ability) CB_Ability.Items.Add(s);
|
||||
|
|
@ -101,6 +104,7 @@ private void loadData()
|
|||
loaded = true;
|
||||
LB_Gifts.SelectedIndex = 0;
|
||||
}
|
||||
|
||||
private void saveData()
|
||||
{
|
||||
// Check to see if a starter has been modified right before we write data.
|
||||
|
|
@ -121,7 +125,7 @@ private void saveData()
|
|||
|
||||
for (int i = 0; i < GiftData.Length; i++)
|
||||
{
|
||||
int offset = fieldOffset + i*fieldSize;
|
||||
int offset = fieldOffset + (i * fieldSize);
|
||||
|
||||
// Check too see if starters got modified
|
||||
if (Array.IndexOf(entries, i) > - 1 && BitConverter.ToUInt16(FieldData, offset) != GiftData[i].Species)
|
||||
|
|
@ -140,6 +144,7 @@ private void saveData()
|
|||
|
||||
private int entry = -1;
|
||||
private bool loaded;
|
||||
|
||||
private void changeIndex(object sender, EventArgs e)
|
||||
{
|
||||
if (LB_Gifts.SelectedIndex < 0)
|
||||
|
|
@ -151,6 +156,7 @@ private void changeIndex(object sender, EventArgs e)
|
|||
entry = LB_Gifts.SelectedIndex;
|
||||
loadEntry();
|
||||
}
|
||||
|
||||
private void loadEntry()
|
||||
{
|
||||
bool oldloaded = loaded;
|
||||
|
|
@ -177,6 +183,7 @@ private void loadEntry()
|
|||
|
||||
loaded |= oldloaded;
|
||||
}
|
||||
|
||||
private void saveEntry()
|
||||
{
|
||||
GiftData[entry].Species = (ushort)CB_Species.SelectedIndex;
|
||||
|
|
@ -305,6 +312,7 @@ private int[] GetRandomMega(out int species)
|
|||
{448, new[] {673}}, // Lucario @ Lucarionite
|
||||
{460, new[] {674}}, // Abomasnow @ Abomasite
|
||||
};
|
||||
|
||||
private static readonly Dictionary<int, int[]> MegaDictionaryAO = new Dictionary<int, int[]>
|
||||
{
|
||||
{015, new[] {770}}, // Beedrill @ Beedrillite
|
||||
|
|
@ -325,6 +333,7 @@ private int[] GetRandomMega(out int species)
|
|||
{531, new[] {757}}, // Audino @ Audinite
|
||||
{719, new[] {764}}, // Diancie @ Diancite
|
||||
};
|
||||
|
||||
private void changeSpecies(object sender, EventArgs e)
|
||||
{
|
||||
int index = LB_Gifts.SelectedIndex;
|
||||
|
|
|
|||
38
pk3DS/Subforms/Gen6/ItemEditor6.Designer.cs
generated
38
pk3DS/Subforms/Gen6/ItemEditor6.Designer.cs
generated
|
|
@ -35,30 +35,30 @@ private void InitializeComponent()
|
|||
this.CB_Item = new System.Windows.Forms.ComboBox();
|
||||
this.B_Table = new System.Windows.Forms.Button();
|
||||
this.SuspendLayout();
|
||||
//
|
||||
//
|
||||
// Grid
|
||||
//
|
||||
this.Grid.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
|
||||
| System.Windows.Forms.AnchorStyles.Left)
|
||||
//
|
||||
this.Grid.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.Grid.LineColor = System.Drawing.SystemColors.ControlDark;
|
||||
this.Grid.Location = new System.Drawing.Point(12, 94);
|
||||
this.Grid.Name = "Grid";
|
||||
this.Grid.Size = new System.Drawing.Size(316, 280);
|
||||
this.Grid.TabIndex = 52;
|
||||
//
|
||||
//
|
||||
// L_Index
|
||||
//
|
||||
//
|
||||
this.L_Index.AutoSize = true;
|
||||
this.L_Index.Location = new System.Drawing.Point(221, 14);
|
||||
this.L_Index.Name = "L_Index";
|
||||
this.L_Index.Size = new System.Drawing.Size(39, 13);
|
||||
this.L_Index.TabIndex = 51;
|
||||
this.L_Index.Text = "Index: ";
|
||||
//
|
||||
//
|
||||
// RTB
|
||||
//
|
||||
this.RTB.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
|
||||
//
|
||||
this.RTB.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
|
||||
| System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.RTB.Location = new System.Drawing.Point(11, 37);
|
||||
this.RTB.Name = "RTB";
|
||||
|
|
@ -66,18 +66,18 @@ private void InitializeComponent()
|
|||
this.RTB.Size = new System.Drawing.Size(316, 51);
|
||||
this.RTB.TabIndex = 50;
|
||||
this.RTB.Text = "";
|
||||
//
|
||||
//
|
||||
// L_Item
|
||||
//
|
||||
//
|
||||
this.L_Item.Location = new System.Drawing.Point(12, 10);
|
||||
this.L_Item.Name = "L_Item";
|
||||
this.L_Item.Size = new System.Drawing.Size(51, 21);
|
||||
this.L_Item.TabIndex = 49;
|
||||
this.L_Item.Text = "Item:";
|
||||
this.L_Item.TextAlign = System.Drawing.ContentAlignment.MiddleRight;
|
||||
//
|
||||
//
|
||||
// CB_Item
|
||||
//
|
||||
//
|
||||
this.CB_Item.AutoCompleteMode = System.Windows.Forms.AutoCompleteMode.SuggestAppend;
|
||||
this.CB_Item.AutoCompleteSource = System.Windows.Forms.AutoCompleteSource.ListItems;
|
||||
this.CB_Item.DropDownWidth = 120;
|
||||
|
|
@ -86,10 +86,10 @@ private void InitializeComponent()
|
|||
this.CB_Item.Name = "CB_Item";
|
||||
this.CB_Item.Size = new System.Drawing.Size(144, 21);
|
||||
this.CB_Item.TabIndex = 48;
|
||||
this.CB_Item.SelectedIndexChanged += new System.EventHandler(this.changeEntry);
|
||||
//
|
||||
this.CB_Item.SelectedIndexChanged += new System.EventHandler(this.ChangeEntry);
|
||||
//
|
||||
// B_Table
|
||||
//
|
||||
//
|
||||
this.B_Table.Location = new System.Drawing.Point(253, 94);
|
||||
this.B_Table.Name = "B_Table";
|
||||
this.B_Table.Size = new System.Drawing.Size(75, 23);
|
||||
|
|
@ -97,9 +97,9 @@ private void InitializeComponent()
|
|||
this.B_Table.Text = "Export Table";
|
||||
this.B_Table.UseVisualStyleBackColor = true;
|
||||
this.B_Table.Click += new System.EventHandler(this.B_Table_Click);
|
||||
//
|
||||
//
|
||||
// ItemEditor6
|
||||
//
|
||||
//
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||
this.ClientSize = new System.Drawing.Size(339, 381);
|
||||
|
|
@ -115,7 +115,7 @@ private void InitializeComponent()
|
|||
this.Name = "ItemEditor6";
|
||||
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent;
|
||||
this.Text = "Item Editor";
|
||||
this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.formClosing);
|
||||
this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.IsFormClosing);
|
||||
this.ResumeLayout(false);
|
||||
this.PerformLayout();
|
||||
|
||||
|
|
|
|||
|
|
@ -27,32 +27,37 @@ private void Setup()
|
|||
foreach (string s in itemlist) CB_Item.Items.Add(s);
|
||||
CB_Item.SelectedIndex = 1;
|
||||
}
|
||||
|
||||
private int entry = -1;
|
||||
private void changeEntry(object sender, EventArgs e)
|
||||
|
||||
private void ChangeEntry(object sender, EventArgs e)
|
||||
{
|
||||
setEntry();
|
||||
SetEntry();
|
||||
entry = CB_Item.SelectedIndex;
|
||||
L_Index.Text = "Index: " + entry.ToString("000");
|
||||
getEntry();
|
||||
GetEntry();
|
||||
}
|
||||
private void getEntry()
|
||||
|
||||
private void GetEntry()
|
||||
{
|
||||
if (entry < 1) return;
|
||||
Grid.SelectedObject = new Item(files[entry]);
|
||||
|
||||
RTB.Text = itemflavor[entry].Replace("\\n", Environment.NewLine);
|
||||
}
|
||||
private void setEntry()
|
||||
|
||||
private void SetEntry()
|
||||
{
|
||||
if (entry < 1) return;
|
||||
files[entry] = ((Item)Grid.SelectedObject).Write();
|
||||
}
|
||||
private void formClosing(object sender, FormClosingEventArgs e)
|
||||
|
||||
private void IsFormClosing(object sender, FormClosingEventArgs e)
|
||||
{
|
||||
setEntry();
|
||||
SetEntry();
|
||||
}
|
||||
|
||||
private int getItemMapOffset()
|
||||
private int GetItemMapOffset()
|
||||
{
|
||||
if (Main.ExeFSPath == null) { WinFormsUtil.Alert("No exeFS code to load."); return -1; }
|
||||
string[] exefsFiles = Directory.GetFiles(Main.ExeFSPath);
|
||||
|
|
|
|||
|
|
@ -46,6 +46,7 @@ public LevelUpEditor6(byte[][] infiles)
|
|||
private int entry = -1;
|
||||
private readonly string[] movelist = Main.Config.getText(TextName.MoveNames);
|
||||
private bool dumping;
|
||||
|
||||
private void setupDGV()
|
||||
{
|
||||
string[] sortedmoves = (string[])movelist.Clone();
|
||||
|
|
@ -72,6 +73,7 @@ private void setupDGV()
|
|||
}
|
||||
|
||||
private Learnset6 pkm;
|
||||
|
||||
private void getList()
|
||||
{
|
||||
entry = WinFormsUtil.getIndex(CB_Species);
|
||||
|
|
@ -96,6 +98,7 @@ private void getList()
|
|||
|
||||
dgv.CancelEdit();
|
||||
}
|
||||
|
||||
private void setList()
|
||||
{
|
||||
if (entry < 1 || dumping) return;
|
||||
|
|
@ -157,6 +160,7 @@ private void B_RandAll_Click(object sender, EventArgs e)
|
|||
getList();
|
||||
WinFormsUtil.Alert("All Pokémon's Level Up Moves have been randomized!", "Press the Dump button to see the new Level Up Moves!");
|
||||
}
|
||||
|
||||
private void B_Metronome_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (WinFormsUtil.Prompt(MessageBoxButtons.YesNo, "Play using Metronome Mode?", "This will modify learnsets to only have Metronome.") != DialogResult.Yes) return;
|
||||
|
|
@ -173,6 +177,7 @@ private void B_Metronome_Click(object sender, EventArgs e)
|
|||
CB_Species.SelectedIndex = 0;
|
||||
WinFormsUtil.Alert("All Pokémon now only know the move Metronome!");
|
||||
}
|
||||
|
||||
private void B_Dump_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (DialogResult.Yes != WinFormsUtil.Prompt(MessageBoxButtons.YesNo, "Dump all Level Up Moves to Text File?"))
|
||||
|
|
|
|||
|
|
@ -37,6 +37,7 @@ public MaisonEditor6(byte[][] trd, byte[][] trp, bool super)
|
|||
private int trEntry = -1;
|
||||
private int pkEntry = -1;
|
||||
private bool dumping;
|
||||
|
||||
private void Setup()
|
||||
{
|
||||
foreach (string s in trClass) CB_Class.Items.Add(s);
|
||||
|
|
@ -52,6 +53,7 @@ private void Setup()
|
|||
|
||||
CB_Trainer.SelectedIndex = 1;
|
||||
}
|
||||
|
||||
private void changeTrainer(object sender, EventArgs e)
|
||||
{
|
||||
setTrainer();
|
||||
|
|
@ -60,12 +62,14 @@ private void changeTrainer(object sender, EventArgs e)
|
|||
if (GB_Trainer.Enabled)
|
||||
LB_Choices.SelectedIndex = 0;
|
||||
}
|
||||
|
||||
private void changePokemon(object sender, EventArgs e)
|
||||
{
|
||||
setPokemon();
|
||||
pkEntry = CB_Pokemon.SelectedIndex;
|
||||
getPokemon();
|
||||
}
|
||||
|
||||
private void getTrainer()
|
||||
{
|
||||
if (trEntry < 0) return;
|
||||
|
|
@ -80,6 +84,7 @@ private void getTrainer()
|
|||
foreach (ushort Entry in tr.Choices)
|
||||
LB_Choices.Items.Add(Entry.ToString());
|
||||
}
|
||||
|
||||
private void setTrainer()
|
||||
{
|
||||
if (trEntry < 0 || !GB_Trainer.Enabled || dumping) return;
|
||||
|
|
@ -95,6 +100,7 @@ private void setTrainer()
|
|||
Array.Sort(tr.Choices);
|
||||
trFiles[trEntry] = tr.Write();
|
||||
}
|
||||
|
||||
private void getPokemon()
|
||||
{
|
||||
if (pkEntry < 0 || dumping) return;
|
||||
|
|
@ -117,6 +123,7 @@ private void getPokemon()
|
|||
CB_Species.SelectedIndex = pkm.Species; // Loaded last in order to refresh the sprite with all info.
|
||||
// Last 2 Bytes are unused.
|
||||
}
|
||||
|
||||
private void setPokemon()
|
||||
{
|
||||
if (pkEntry < 0 || dumping) return;
|
||||
|
|
@ -156,6 +163,7 @@ private void B_Remove_Click(object sender, EventArgs e)
|
|||
if (LB_Choices.SelectedIndex > -1 && GB_Trainer.Enabled)
|
||||
LB_Choices.Items.RemoveAt(LB_Choices.SelectedIndex);
|
||||
}
|
||||
|
||||
private void B_Set_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (LB_Choices.SelectedIndex <= -1 || !GB_Trainer.Enabled) return;
|
||||
|
|
@ -180,6 +188,7 @@ private void B_Set_Click(object sender, EventArgs e)
|
|||
// Set current index to the one just added.
|
||||
LB_Choices.SelectedIndex = Array.IndexOf(choiceList, toAdd);
|
||||
}
|
||||
|
||||
private void B_View_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (LB_Choices.SelectedIndex > -1 && GB_Trainer.Enabled)
|
||||
|
|
@ -221,6 +230,7 @@ private void DumpTRs_Click(object sender, EventArgs e)
|
|||
dumping = false;
|
||||
CB_Trainer.SelectedIndex = 0;
|
||||
}
|
||||
|
||||
private void B_DumpPKs_Click(object sender, EventArgs e)
|
||||
{
|
||||
string[] stats = {"HP", "ATK", "DEF", "Spe", "SpA", "SpD"};
|
||||
|
|
@ -242,7 +252,7 @@ private void B_DumpPKs_Click(object sender, EventArgs e)
|
|||
result += $"Move 4: {movelist[pk.Move4]}" + Environment.NewLine;
|
||||
|
||||
var EVstr = string.Join(",", pk.EVs.Select((iv, x) => iv ? stats[x] : string.Empty).Where(x => !string.IsNullOrWhiteSpace(x)));
|
||||
result += $"EV'd in: {(pk.EVs.Any() ? EVstr : "None")}" + Environment.NewLine;
|
||||
result += $"EV'd in: {(pk.EVs.Length > 0 ? EVstr : "None")}" + Environment.NewLine;
|
||||
|
||||
result += Environment.NewLine;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -110,6 +110,7 @@ private void getDataOffset(int index)
|
|||
for (int i = 0; i < index; i++)
|
||||
dataoffset += 2 * entries[i];
|
||||
}
|
||||
|
||||
private void setupDGV()
|
||||
{
|
||||
DataGridViewColumn dgvIndex = new DataGridViewTextBoxColumn();
|
||||
|
|
@ -134,12 +135,14 @@ private void setupDGV()
|
|||
}
|
||||
|
||||
private int entry = -1;
|
||||
|
||||
private void changeIndex(object sender, EventArgs e)
|
||||
{
|
||||
if (entry > -1) setList();
|
||||
entry = CB_Location.SelectedIndex;
|
||||
getList();
|
||||
}
|
||||
|
||||
private void getList()
|
||||
{
|
||||
dgv.Rows.Clear();
|
||||
|
|
@ -149,14 +152,15 @@ private void getList()
|
|||
for (int i = 0; i < count; i++)
|
||||
{
|
||||
dgv.Rows[i].Cells[0].Value = i.ToString();
|
||||
dgv.Rows[i].Cells[1].Value = itemlist[BitConverter.ToUInt16(data, dataoffset + 2 * i)];
|
||||
dgv.Rows[i].Cells[1].Value = itemlist[BitConverter.ToUInt16(data, dataoffset + (2 * i))];
|
||||
}
|
||||
}
|
||||
|
||||
private void setList()
|
||||
{
|
||||
int count = dgv.Rows.Count;
|
||||
for (int i = 0; i < count; i++)
|
||||
Array.Copy(BitConverter.GetBytes((ushort)Array.IndexOf(itemlist, dgv.Rows[i].Cells[1].Value)), 0, data, dataoffset + 2 * i, 2);
|
||||
Array.Copy(BitConverter.GetBytes((ushort)Array.IndexOf(itemlist, dgv.Rows[i].Cells[1].Value)), 0, data, dataoffset + (2 * i), 2);
|
||||
}
|
||||
|
||||
private void B_Save_Click(object sender, EventArgs e)
|
||||
|
|
@ -165,10 +169,12 @@ private void B_Save_Click(object sender, EventArgs e)
|
|||
File.WriteAllBytes(codebin, data);
|
||||
Close();
|
||||
}
|
||||
|
||||
private void B_Cancel_Click(object sender, EventArgs e)
|
||||
{
|
||||
Close();
|
||||
}
|
||||
|
||||
private void B_Randomize_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (DialogResult.Yes != WinFormsUtil.Prompt(MessageBoxButtons.YesNoCancel, "Randomize mart inventories?"))
|
||||
|
|
|
|||
|
|
@ -51,6 +51,7 @@ public partial class MegaEvoEditor6 : Form
|
|||
Setup();
|
||||
CB_Species.SelectedIndex = 0;
|
||||
}
|
||||
|
||||
private void Setup()
|
||||
{
|
||||
List<string> temp_list = new List<string>(specieslist);
|
||||
|
|
@ -88,6 +89,7 @@ private void Setup()
|
|||
|
||||
loaded = true;
|
||||
}
|
||||
|
||||
private void CHK_Changed(object sender, EventArgs e)
|
||||
{
|
||||
for (int i = 0; i < groupbox_spec.Length; i++)
|
||||
|
|
@ -103,6 +105,7 @@ private void changeIndex(object sender, EventArgs e)
|
|||
entry = (int)CB_Species.SelectedValue;
|
||||
getEntry();
|
||||
}
|
||||
|
||||
private void getEntry()
|
||||
{
|
||||
if (!loaded) return;
|
||||
|
|
@ -122,6 +125,7 @@ private void getEntry()
|
|||
forme_spec[i].SelectedIndex = me.Form[i];
|
||||
}
|
||||
}
|
||||
|
||||
private void setEntry()
|
||||
{
|
||||
if (entry < 1 || entry == 384) return; // Don't edit invalid / Rayquaza.
|
||||
|
|
@ -180,6 +184,7 @@ private void UpdateImage(PictureBox pb, int species, int form, int item, int gen
|
|||
}
|
||||
pb.Image = WinFormsUtil.getSprite(species, form, gender, item, Main.Config);
|
||||
}
|
||||
|
||||
private void formClosing(object sender, FormClosingEventArgs e)
|
||||
{
|
||||
setEntry();
|
||||
|
|
|
|||
274
pk3DS/Subforms/Gen6/MoveEditor6.Designer.cs
generated
274
pk3DS/Subforms/Gen6/MoveEditor6.Designer.cs
generated
|
|
@ -120,9 +120,9 @@ private void InitializeComponent()
|
|||
((System.ComponentModel.ISupportInitialize)(this.NUD_0x21)).BeginInit();
|
||||
this.groupBox1.SuspendLayout();
|
||||
this.SuspendLayout();
|
||||
//
|
||||
//
|
||||
// L_Type
|
||||
//
|
||||
//
|
||||
this.L_Type.AutoSize = true;
|
||||
this.L_Type.Location = new System.Drawing.Point(32, 38);
|
||||
this.L_Type.Name = "L_Type";
|
||||
|
|
@ -130,9 +130,9 @@ private void InitializeComponent()
|
|||
this.L_Type.TabIndex = 0;
|
||||
this.L_Type.Text = "Type:";
|
||||
this.L_Type.TextAlign = System.Drawing.ContentAlignment.MiddleRight;
|
||||
//
|
||||
//
|
||||
// CB_Move
|
||||
//
|
||||
//
|
||||
this.CB_Move.AutoCompleteMode = System.Windows.Forms.AutoCompleteMode.Suggest;
|
||||
this.CB_Move.AutoCompleteSource = System.Windows.Forms.AutoCompleteSource.ListItems;
|
||||
this.CB_Move.DropDownWidth = 120;
|
||||
|
|
@ -141,10 +141,10 @@ private void InitializeComponent()
|
|||
this.CB_Move.Name = "CB_Move";
|
||||
this.CB_Move.Size = new System.Drawing.Size(130, 21);
|
||||
this.CB_Move.TabIndex = 1;
|
||||
this.CB_Move.SelectedIndexChanged += new System.EventHandler(this.changeEntry);
|
||||
//
|
||||
this.CB_Move.SelectedIndexChanged += new System.EventHandler(this.ChangeEntry);
|
||||
//
|
||||
// L_Move
|
||||
//
|
||||
//
|
||||
this.L_Move.AutoSize = true;
|
||||
this.L_Move.Location = new System.Drawing.Point(33, 13);
|
||||
this.L_Move.Name = "L_Move";
|
||||
|
|
@ -152,27 +152,27 @@ private void InitializeComponent()
|
|||
this.L_Move.TabIndex = 2;
|
||||
this.L_Move.Text = "Move:";
|
||||
this.L_Move.TextAlign = System.Drawing.ContentAlignment.MiddleRight;
|
||||
//
|
||||
//
|
||||
// CB_Type
|
||||
//
|
||||
//
|
||||
this.CB_Type.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
|
||||
this.CB_Type.FormattingEnabled = true;
|
||||
this.CB_Type.Location = new System.Drawing.Point(71, 35);
|
||||
this.CB_Type.Name = "CB_Type";
|
||||
this.CB_Type.Size = new System.Drawing.Size(99, 21);
|
||||
this.CB_Type.TabIndex = 3;
|
||||
//
|
||||
//
|
||||
// CB_Category
|
||||
//
|
||||
//
|
||||
this.CB_Category.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
|
||||
this.CB_Category.FormattingEnabled = true;
|
||||
this.CB_Category.Location = new System.Drawing.Point(71, 58);
|
||||
this.CB_Category.Name = "CB_Category";
|
||||
this.CB_Category.Size = new System.Drawing.Size(99, 21);
|
||||
this.CB_Category.TabIndex = 4;
|
||||
//
|
||||
//
|
||||
// L_Category
|
||||
//
|
||||
//
|
||||
this.L_Category.AutoSize = true;
|
||||
this.L_Category.Location = new System.Drawing.Point(18, 61);
|
||||
this.L_Category.Name = "L_Category";
|
||||
|
|
@ -180,9 +180,9 @@ private void InitializeComponent()
|
|||
this.L_Category.TabIndex = 5;
|
||||
this.L_Category.Text = "Category:";
|
||||
this.L_Category.TextAlign = System.Drawing.ContentAlignment.MiddleRight;
|
||||
//
|
||||
//
|
||||
// L_BP
|
||||
//
|
||||
//
|
||||
this.L_BP.AutoSize = true;
|
||||
this.L_BP.Location = new System.Drawing.Point(26, 132);
|
||||
this.L_BP.Name = "L_BP";
|
||||
|
|
@ -190,9 +190,9 @@ private void InitializeComponent()
|
|||
this.L_BP.TabIndex = 7;
|
||||
this.L_BP.Text = "Power:";
|
||||
this.L_BP.TextAlign = System.Drawing.ContentAlignment.MiddleRight;
|
||||
//
|
||||
//
|
||||
// L_PP
|
||||
//
|
||||
//
|
||||
this.L_PP.AutoSize = true;
|
||||
this.L_PP.Location = new System.Drawing.Point(15, 174);
|
||||
this.L_PP.Name = "L_PP";
|
||||
|
|
@ -200,9 +200,9 @@ private void InitializeComponent()
|
|||
this.L_PP.TabIndex = 8;
|
||||
this.L_PP.Text = "Base PP:";
|
||||
this.L_PP.TextAlign = System.Drawing.ContentAlignment.MiddleRight;
|
||||
//
|
||||
//
|
||||
// L_Min
|
||||
//
|
||||
//
|
||||
this.L_Min.AutoSize = true;
|
||||
this.L_Min.Location = new System.Drawing.Point(236, 132);
|
||||
this.L_Min.Name = "L_Min";
|
||||
|
|
@ -210,9 +210,9 @@ private void InitializeComponent()
|
|||
this.L_Min.TabIndex = 10;
|
||||
this.L_Min.Text = "Min Hits:";
|
||||
this.L_Min.TextAlign = System.Drawing.ContentAlignment.MiddleRight;
|
||||
//
|
||||
//
|
||||
// L_Max
|
||||
//
|
||||
//
|
||||
this.L_Max.AutoSize = true;
|
||||
this.L_Max.Location = new System.Drawing.Point(233, 153);
|
||||
this.L_Max.Name = "L_Max";
|
||||
|
|
@ -220,18 +220,18 @@ private void InitializeComponent()
|
|||
this.L_Max.TabIndex = 12;
|
||||
this.L_Max.Text = "Max Hits:";
|
||||
this.L_Max.TextAlign = System.Drawing.ContentAlignment.MiddleRight;
|
||||
//
|
||||
//
|
||||
// L_Priority
|
||||
//
|
||||
//
|
||||
this.L_Priority.AutoSize = true;
|
||||
this.L_Priority.Location = new System.Drawing.Point(25, 195);
|
||||
this.L_Priority.Name = "L_Priority";
|
||||
this.L_Priority.Size = new System.Drawing.Size(41, 13);
|
||||
this.L_Priority.TabIndex = 17;
|
||||
this.L_Priority.Text = "Priority:";
|
||||
//
|
||||
//
|
||||
// NUD_HitMax
|
||||
//
|
||||
//
|
||||
this.NUD_HitMax.Location = new System.Drawing.Point(290, 151);
|
||||
this.NUD_HitMax.Maximum = new decimal(new int[] {
|
||||
6,
|
||||
|
|
@ -241,9 +241,9 @@ private void InitializeComponent()
|
|||
this.NUD_HitMax.Name = "NUD_HitMax";
|
||||
this.NUD_HitMax.Size = new System.Drawing.Size(30, 20);
|
||||
this.NUD_HitMax.TabIndex = 18;
|
||||
//
|
||||
//
|
||||
// NUD_HitMin
|
||||
//
|
||||
//
|
||||
this.NUD_HitMin.Location = new System.Drawing.Point(290, 130);
|
||||
this.NUD_HitMin.Maximum = new decimal(new int[] {
|
||||
6,
|
||||
|
|
@ -253,9 +253,9 @@ private void InitializeComponent()
|
|||
this.NUD_HitMin.Name = "NUD_HitMin";
|
||||
this.NUD_HitMin.Size = new System.Drawing.Size(30, 20);
|
||||
this.NUD_HitMin.TabIndex = 19;
|
||||
//
|
||||
//
|
||||
// NUD_Priority
|
||||
//
|
||||
//
|
||||
this.NUD_Priority.Location = new System.Drawing.Point(72, 193);
|
||||
this.NUD_Priority.Maximum = new decimal(new int[] {
|
||||
8,
|
||||
|
|
@ -270,9 +270,9 @@ private void InitializeComponent()
|
|||
this.NUD_Priority.Name = "NUD_Priority";
|
||||
this.NUD_Priority.Size = new System.Drawing.Size(35, 20);
|
||||
this.NUD_Priority.TabIndex = 20;
|
||||
//
|
||||
//
|
||||
// NUD_PP
|
||||
//
|
||||
//
|
||||
this.NUD_PP.Location = new System.Drawing.Point(72, 172);
|
||||
this.NUD_PP.Maximum = new decimal(new int[] {
|
||||
40,
|
||||
|
|
@ -282,9 +282,9 @@ private void InitializeComponent()
|
|||
this.NUD_PP.Name = "NUD_PP";
|
||||
this.NUD_PP.Size = new System.Drawing.Size(35, 20);
|
||||
this.NUD_PP.TabIndex = 21;
|
||||
//
|
||||
//
|
||||
// NUD_Power
|
||||
//
|
||||
//
|
||||
this.NUD_Power.Location = new System.Drawing.Point(72, 130);
|
||||
this.NUD_Power.Maximum = new decimal(new int[] {
|
||||
255,
|
||||
|
|
@ -294,9 +294,9 @@ private void InitializeComponent()
|
|||
this.NUD_Power.Name = "NUD_Power";
|
||||
this.NUD_Power.Size = new System.Drawing.Size(45, 20);
|
||||
this.NUD_Power.TabIndex = 22;
|
||||
//
|
||||
//
|
||||
// NUD_TurnMin
|
||||
//
|
||||
//
|
||||
this.NUD_TurnMin.Location = new System.Drawing.Point(290, 172);
|
||||
this.NUD_TurnMin.Maximum = new decimal(new int[] {
|
||||
15,
|
||||
|
|
@ -306,9 +306,9 @@ private void InitializeComponent()
|
|||
this.NUD_TurnMin.Name = "NUD_TurnMin";
|
||||
this.NUD_TurnMin.Size = new System.Drawing.Size(30, 20);
|
||||
this.NUD_TurnMin.TabIndex = 26;
|
||||
//
|
||||
//
|
||||
// L_TrapMin
|
||||
//
|
||||
//
|
||||
this.L_TrapMin.AutoSize = true;
|
||||
this.L_TrapMin.Location = new System.Drawing.Point(227, 174);
|
||||
this.L_TrapMin.Name = "L_TrapMin";
|
||||
|
|
@ -316,9 +316,9 @@ private void InitializeComponent()
|
|||
this.L_TrapMin.TabIndex = 23;
|
||||
this.L_TrapMin.Text = "Min Turns:";
|
||||
this.L_TrapMin.TextAlign = System.Drawing.ContentAlignment.MiddleRight;
|
||||
//
|
||||
//
|
||||
// NUD_TurnMax
|
||||
//
|
||||
//
|
||||
this.NUD_TurnMax.Location = new System.Drawing.Point(290, 193);
|
||||
this.NUD_TurnMax.Maximum = new decimal(new int[] {
|
||||
15,
|
||||
|
|
@ -328,9 +328,9 @@ private void InitializeComponent()
|
|||
this.NUD_TurnMax.Name = "NUD_TurnMax";
|
||||
this.NUD_TurnMax.Size = new System.Drawing.Size(30, 20);
|
||||
this.NUD_TurnMax.TabIndex = 25;
|
||||
//
|
||||
//
|
||||
// L_TrapMax
|
||||
//
|
||||
//
|
||||
this.L_TrapMax.AutoSize = true;
|
||||
this.L_TrapMax.Location = new System.Drawing.Point(224, 195);
|
||||
this.L_TrapMax.Name = "L_TrapMax";
|
||||
|
|
@ -338,9 +338,9 @@ private void InitializeComponent()
|
|||
this.L_TrapMax.TabIndex = 24;
|
||||
this.L_TrapMax.Text = "Max Turns:";
|
||||
this.L_TrapMax.TextAlign = System.Drawing.ContentAlignment.MiddleRight;
|
||||
//
|
||||
//
|
||||
// NUD_Recoil
|
||||
//
|
||||
//
|
||||
this.NUD_Recoil.Location = new System.Drawing.Point(184, 172);
|
||||
this.NUD_Recoil.Minimum = new decimal(new int[] {
|
||||
100,
|
||||
|
|
@ -350,9 +350,9 @@ private void InitializeComponent()
|
|||
this.NUD_Recoil.Name = "NUD_Recoil";
|
||||
this.NUD_Recoil.Size = new System.Drawing.Size(40, 20);
|
||||
this.NUD_Recoil.TabIndex = 34;
|
||||
//
|
||||
//
|
||||
// L_Recoil
|
||||
//
|
||||
//
|
||||
this.L_Recoil.AutoSize = true;
|
||||
this.L_Recoil.Location = new System.Drawing.Point(114, 174);
|
||||
this.L_Recoil.Name = "L_Recoil";
|
||||
|
|
@ -360,9 +360,9 @@ private void InitializeComponent()
|
|||
this.L_Recoil.TabIndex = 31;
|
||||
this.L_Recoil.Text = "Rec/Abs %:";
|
||||
this.L_Recoil.TextAlign = System.Drawing.ContentAlignment.MiddleRight;
|
||||
//
|
||||
//
|
||||
// NUD_Heal
|
||||
//
|
||||
//
|
||||
this.NUD_Heal.Location = new System.Drawing.Point(184, 151);
|
||||
this.NUD_Heal.Maximum = new decimal(new int[] {
|
||||
255,
|
||||
|
|
@ -372,9 +372,9 @@ private void InitializeComponent()
|
|||
this.NUD_Heal.Name = "NUD_Heal";
|
||||
this.NUD_Heal.Size = new System.Drawing.Size(40, 20);
|
||||
this.NUD_Heal.TabIndex = 33;
|
||||
//
|
||||
//
|
||||
// L_Heal
|
||||
//
|
||||
//
|
||||
this.L_Heal.AutoSize = true;
|
||||
this.L_Heal.Location = new System.Drawing.Point(135, 153);
|
||||
this.L_Heal.Name = "L_Heal";
|
||||
|
|
@ -382,9 +382,9 @@ private void InitializeComponent()
|
|||
this.L_Heal.TabIndex = 32;
|
||||
this.L_Heal.Text = "Heal %:";
|
||||
this.L_Heal.TextAlign = System.Drawing.ContentAlignment.MiddleRight;
|
||||
//
|
||||
//
|
||||
// NUD_CritStage
|
||||
//
|
||||
//
|
||||
this.NUD_CritStage.Location = new System.Drawing.Point(184, 193);
|
||||
this.NUD_CritStage.Maximum = new decimal(new int[] {
|
||||
6,
|
||||
|
|
@ -394,9 +394,9 @@ private void InitializeComponent()
|
|||
this.NUD_CritStage.Name = "NUD_CritStage";
|
||||
this.NUD_CritStage.Size = new System.Drawing.Size(30, 20);
|
||||
this.NUD_CritStage.TabIndex = 30;
|
||||
//
|
||||
//
|
||||
// L_CritStage
|
||||
//
|
||||
//
|
||||
this.L_CritStage.AutoSize = true;
|
||||
this.L_CritStage.Location = new System.Drawing.Point(122, 195);
|
||||
this.L_CritStage.Name = "L_CritStage";
|
||||
|
|
@ -404,9 +404,9 @@ private void InitializeComponent()
|
|||
this.L_CritStage.TabIndex = 27;
|
||||
this.L_CritStage.Text = "Crit Stage:";
|
||||
this.L_CritStage.TextAlign = System.Drawing.ContentAlignment.MiddleRight;
|
||||
//
|
||||
//
|
||||
// NUD_Flinch
|
||||
//
|
||||
//
|
||||
this.NUD_Flinch.Location = new System.Drawing.Point(184, 130);
|
||||
this.NUD_Flinch.Maximum = new decimal(new int[] {
|
||||
101,
|
||||
|
|
@ -416,9 +416,9 @@ private void InitializeComponent()
|
|||
this.NUD_Flinch.Name = "NUD_Flinch";
|
||||
this.NUD_Flinch.Size = new System.Drawing.Size(40, 20);
|
||||
this.NUD_Flinch.TabIndex = 29;
|
||||
//
|
||||
//
|
||||
// L_Flinch
|
||||
//
|
||||
//
|
||||
this.L_Flinch.AutoSize = true;
|
||||
this.L_Flinch.Location = new System.Drawing.Point(129, 132);
|
||||
this.L_Flinch.Name = "L_Flinch";
|
||||
|
|
@ -426,9 +426,9 @@ private void InitializeComponent()
|
|||
this.L_Flinch.TabIndex = 28;
|
||||
this.L_Flinch.Text = "Flinch %:";
|
||||
this.L_Flinch.TextAlign = System.Drawing.ContentAlignment.MiddleRight;
|
||||
//
|
||||
//
|
||||
// GB_Stat
|
||||
//
|
||||
//
|
||||
this.GB_Stat.Controls.Add(this.NUD_StatP3);
|
||||
this.GB_Stat.Controls.Add(this.NUD_StatP2);
|
||||
this.GB_Stat.Controls.Add(this.NUD_StatP1);
|
||||
|
|
@ -447,9 +447,9 @@ private void InitializeComponent()
|
|||
this.GB_Stat.TabIndex = 35;
|
||||
this.GB_Stat.TabStop = false;
|
||||
this.GB_Stat.Text = "Stat Stage Changes";
|
||||
//
|
||||
//
|
||||
// NUD_StatP3
|
||||
//
|
||||
//
|
||||
this.NUD_StatP3.Location = new System.Drawing.Point(165, 68);
|
||||
this.NUD_StatP3.Maximum = new decimal(new int[] {
|
||||
101,
|
||||
|
|
@ -459,9 +459,9 @@ private void InitializeComponent()
|
|||
this.NUD_StatP3.Name = "NUD_StatP3";
|
||||
this.NUD_StatP3.Size = new System.Drawing.Size(40, 20);
|
||||
this.NUD_StatP3.TabIndex = 44;
|
||||
//
|
||||
//
|
||||
// NUD_StatP2
|
||||
//
|
||||
//
|
||||
this.NUD_StatP2.Location = new System.Drawing.Point(165, 46);
|
||||
this.NUD_StatP2.Maximum = new decimal(new int[] {
|
||||
101,
|
||||
|
|
@ -471,9 +471,9 @@ private void InitializeComponent()
|
|||
this.NUD_StatP2.Name = "NUD_StatP2";
|
||||
this.NUD_StatP2.Size = new System.Drawing.Size(40, 20);
|
||||
this.NUD_StatP2.TabIndex = 43;
|
||||
//
|
||||
//
|
||||
// NUD_StatP1
|
||||
//
|
||||
//
|
||||
this.NUD_StatP1.Location = new System.Drawing.Point(165, 24);
|
||||
this.NUD_StatP1.Maximum = new decimal(new int[] {
|
||||
101,
|
||||
|
|
@ -483,9 +483,9 @@ private void InitializeComponent()
|
|||
this.NUD_StatP1.Name = "NUD_StatP1";
|
||||
this.NUD_StatP1.Size = new System.Drawing.Size(40, 20);
|
||||
this.NUD_StatP1.TabIndex = 42;
|
||||
//
|
||||
//
|
||||
// NUD_Stat2
|
||||
//
|
||||
//
|
||||
this.NUD_Stat2.Location = new System.Drawing.Point(127, 46);
|
||||
this.NUD_Stat2.Maximum = new decimal(new int[] {
|
||||
5,
|
||||
|
|
@ -500,9 +500,9 @@ private void InitializeComponent()
|
|||
this.NUD_Stat2.Name = "NUD_Stat2";
|
||||
this.NUD_Stat2.Size = new System.Drawing.Size(35, 20);
|
||||
this.NUD_Stat2.TabIndex = 41;
|
||||
//
|
||||
//
|
||||
// NUD_Stat3
|
||||
//
|
||||
//
|
||||
this.NUD_Stat3.Location = new System.Drawing.Point(127, 68);
|
||||
this.NUD_Stat3.Maximum = new decimal(new int[] {
|
||||
5,
|
||||
|
|
@ -517,9 +517,9 @@ private void InitializeComponent()
|
|||
this.NUD_Stat3.Name = "NUD_Stat3";
|
||||
this.NUD_Stat3.Size = new System.Drawing.Size(35, 20);
|
||||
this.NUD_Stat3.TabIndex = 40;
|
||||
//
|
||||
//
|
||||
// NUD_Stat1
|
||||
//
|
||||
//
|
||||
this.NUD_Stat1.Location = new System.Drawing.Point(127, 24);
|
||||
this.NUD_Stat1.Maximum = new decimal(new int[] {
|
||||
5,
|
||||
|
|
@ -534,63 +534,63 @@ private void InitializeComponent()
|
|||
this.NUD_Stat1.Name = "NUD_Stat1";
|
||||
this.NUD_Stat1.Size = new System.Drawing.Size(35, 20);
|
||||
this.NUD_Stat1.TabIndex = 39;
|
||||
//
|
||||
//
|
||||
// CB_Stat3
|
||||
//
|
||||
//
|
||||
this.CB_Stat3.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
|
||||
this.CB_Stat3.FormattingEnabled = true;
|
||||
this.CB_Stat3.Location = new System.Drawing.Point(27, 67);
|
||||
this.CB_Stat3.Name = "CB_Stat3";
|
||||
this.CB_Stat3.Size = new System.Drawing.Size(99, 21);
|
||||
this.CB_Stat3.TabIndex = 38;
|
||||
//
|
||||
//
|
||||
// CB_Stat2
|
||||
//
|
||||
//
|
||||
this.CB_Stat2.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
|
||||
this.CB_Stat2.FormattingEnabled = true;
|
||||
this.CB_Stat2.Location = new System.Drawing.Point(27, 45);
|
||||
this.CB_Stat2.Name = "CB_Stat2";
|
||||
this.CB_Stat2.Size = new System.Drawing.Size(99, 21);
|
||||
this.CB_Stat2.TabIndex = 37;
|
||||
//
|
||||
//
|
||||
// CB_Stat1
|
||||
//
|
||||
//
|
||||
this.CB_Stat1.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
|
||||
this.CB_Stat1.FormattingEnabled = true;
|
||||
this.CB_Stat1.Location = new System.Drawing.Point(27, 23);
|
||||
this.CB_Stat1.Name = "CB_Stat1";
|
||||
this.CB_Stat1.Size = new System.Drawing.Size(99, 21);
|
||||
this.CB_Stat1.TabIndex = 36;
|
||||
//
|
||||
//
|
||||
// L_Stage3
|
||||
//
|
||||
//
|
||||
this.L_Stage3.AutoSize = true;
|
||||
this.L_Stage3.Location = new System.Drawing.Point(5, 70);
|
||||
this.L_Stage3.Name = "L_Stage3";
|
||||
this.L_Stage3.Size = new System.Drawing.Size(16, 13);
|
||||
this.L_Stage3.TabIndex = 2;
|
||||
this.L_Stage3.Text = "3:";
|
||||
//
|
||||
//
|
||||
// L_Stage2
|
||||
//
|
||||
//
|
||||
this.L_Stage2.AutoSize = true;
|
||||
this.L_Stage2.Location = new System.Drawing.Point(5, 48);
|
||||
this.L_Stage2.Name = "L_Stage2";
|
||||
this.L_Stage2.Size = new System.Drawing.Size(16, 13);
|
||||
this.L_Stage2.TabIndex = 1;
|
||||
this.L_Stage2.Text = "2:";
|
||||
//
|
||||
//
|
||||
// L_Stage1
|
||||
//
|
||||
//
|
||||
this.L_Stage1.AutoSize = true;
|
||||
this.L_Stage1.Location = new System.Drawing.Point(5, 26);
|
||||
this.L_Stage1.Name = "L_Stage1";
|
||||
this.L_Stage1.Size = new System.Drawing.Size(16, 13);
|
||||
this.L_Stage1.TabIndex = 0;
|
||||
this.L_Stage1.Text = "1:";
|
||||
//
|
||||
//
|
||||
// L_Targeting
|
||||
//
|
||||
//
|
||||
this.L_Targeting.AutoSize = true;
|
||||
this.L_Targeting.Location = new System.Drawing.Point(173, 38);
|
||||
this.L_Targeting.Name = "L_Targeting";
|
||||
|
|
@ -598,9 +598,9 @@ private void InitializeComponent()
|
|||
this.L_Targeting.TabIndex = 36;
|
||||
this.L_Targeting.Text = "Targeting:";
|
||||
this.L_Targeting.TextAlign = System.Drawing.ContentAlignment.MiddleRight;
|
||||
//
|
||||
//
|
||||
// L_Influcts
|
||||
//
|
||||
//
|
||||
this.L_Influcts.AutoSize = true;
|
||||
this.L_Influcts.Location = new System.Drawing.Point(188, 60);
|
||||
this.L_Influcts.Name = "L_Influcts";
|
||||
|
|
@ -608,10 +608,10 @@ private void InitializeComponent()
|
|||
this.L_Influcts.TabIndex = 37;
|
||||
this.L_Influcts.Text = "Inflicts:";
|
||||
this.L_Influcts.TextAlign = System.Drawing.ContentAlignment.MiddleRight;
|
||||
//
|
||||
//
|
||||
// RTB
|
||||
//
|
||||
this.RTB.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
|
||||
//
|
||||
this.RTB.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
|
||||
| System.Windows.Forms.AnchorStyles.Left)));
|
||||
this.RTB.Location = new System.Drawing.Point(12, 324);
|
||||
this.RTB.Name = "RTB";
|
||||
|
|
@ -619,9 +619,9 @@ private void InitializeComponent()
|
|||
this.RTB.Size = new System.Drawing.Size(316, 51);
|
||||
this.RTB.TabIndex = 38;
|
||||
this.RTB.Text = "";
|
||||
//
|
||||
//
|
||||
// CB_Targeting
|
||||
//
|
||||
//
|
||||
this.CB_Targeting.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
|
||||
this.CB_Targeting.DropDownWidth = 150;
|
||||
this.CB_Targeting.FormattingEnabled = true;
|
||||
|
|
@ -629,9 +629,9 @@ private void InitializeComponent()
|
|||
this.CB_Targeting.Name = "CB_Targeting";
|
||||
this.CB_Targeting.Size = new System.Drawing.Size(99, 21);
|
||||
this.CB_Targeting.TabIndex = 39;
|
||||
//
|
||||
//
|
||||
// CB_Inflict
|
||||
//
|
||||
//
|
||||
this.CB_Inflict.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
|
||||
this.CB_Inflict.DropDownWidth = 150;
|
||||
this.CB_Inflict.FormattingEnabled = true;
|
||||
|
|
@ -639,9 +639,9 @@ private void InitializeComponent()
|
|||
this.CB_Inflict.Name = "CB_Inflict";
|
||||
this.CB_Inflict.Size = new System.Drawing.Size(99, 21);
|
||||
this.CB_Inflict.TabIndex = 40;
|
||||
//
|
||||
//
|
||||
// L_Inflict
|
||||
//
|
||||
//
|
||||
this.L_Inflict.AutoSize = true;
|
||||
this.L_Inflict.Location = new System.Drawing.Point(238, 81);
|
||||
this.L_Inflict.Name = "L_Inflict";
|
||||
|
|
@ -649,9 +649,9 @@ private void InitializeComponent()
|
|||
this.L_Inflict.TabIndex = 41;
|
||||
this.L_Inflict.Text = "Inflict %:";
|
||||
this.L_Inflict.TextAlign = System.Drawing.ContentAlignment.MiddleRight;
|
||||
//
|
||||
//
|
||||
// NUD_Inflict
|
||||
//
|
||||
//
|
||||
this.NUD_Inflict.Location = new System.Drawing.Point(287, 78);
|
||||
this.NUD_Inflict.Maximum = new decimal(new int[] {
|
||||
101,
|
||||
|
|
@ -661,9 +661,9 @@ private void InitializeComponent()
|
|||
this.NUD_Inflict.Name = "NUD_Inflict";
|
||||
this.NUD_Inflict.Size = new System.Drawing.Size(40, 20);
|
||||
this.NUD_Inflict.TabIndex = 42;
|
||||
//
|
||||
//
|
||||
// NUD_Effect
|
||||
//
|
||||
//
|
||||
this.NUD_Effect.Location = new System.Drawing.Point(150, 103);
|
||||
this.NUD_Effect.Maximum = new decimal(new int[] {
|
||||
65535,
|
||||
|
|
@ -673,9 +673,9 @@ private void InitializeComponent()
|
|||
this.NUD_Effect.Name = "NUD_Effect";
|
||||
this.NUD_Effect.Size = new System.Drawing.Size(50, 20);
|
||||
this.NUD_Effect.TabIndex = 44;
|
||||
//
|
||||
//
|
||||
// L_Effect
|
||||
//
|
||||
//
|
||||
this.L_Effect.AutoSize = true;
|
||||
this.L_Effect.Location = new System.Drawing.Point(106, 106);
|
||||
this.L_Effect.Name = "L_Effect";
|
||||
|
|
@ -683,9 +683,9 @@ private void InitializeComponent()
|
|||
this.L_Effect.TabIndex = 45;
|
||||
this.L_Effect.Text = "Effect:";
|
||||
this.L_Effect.TextAlign = System.Drawing.ContentAlignment.MiddleRight;
|
||||
//
|
||||
//
|
||||
// NUD_Accuracy
|
||||
//
|
||||
//
|
||||
this.NUD_Accuracy.Location = new System.Drawing.Point(72, 151);
|
||||
this.NUD_Accuracy.Maximum = new decimal(new int[] {
|
||||
101,
|
||||
|
|
@ -695,9 +695,9 @@ private void InitializeComponent()
|
|||
this.NUD_Accuracy.Name = "NUD_Accuracy";
|
||||
this.NUD_Accuracy.Size = new System.Drawing.Size(40, 20);
|
||||
this.NUD_Accuracy.TabIndex = 47;
|
||||
//
|
||||
//
|
||||
// L_Accuracy
|
||||
//
|
||||
//
|
||||
this.L_Accuracy.AutoSize = true;
|
||||
this.L_Accuracy.Location = new System.Drawing.Point(17, 153);
|
||||
this.L_Accuracy.Name = "L_Accuracy";
|
||||
|
|
@ -705,9 +705,9 @@ private void InitializeComponent()
|
|||
this.L_Accuracy.TabIndex = 46;
|
||||
this.L_Accuracy.Text = "Accur %:";
|
||||
this.L_Accuracy.TextAlign = System.Drawing.ContentAlignment.MiddleRight;
|
||||
//
|
||||
//
|
||||
// CB_Quality
|
||||
//
|
||||
//
|
||||
this.CB_Quality.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
|
||||
this.CB_Quality.DropDownWidth = 170;
|
||||
this.CB_Quality.FormattingEnabled = true;
|
||||
|
|
@ -715,9 +715,9 @@ private void InitializeComponent()
|
|||
this.CB_Quality.Name = "CB_Quality";
|
||||
this.CB_Quality.Size = new System.Drawing.Size(129, 21);
|
||||
this.CB_Quality.TabIndex = 48;
|
||||
//
|
||||
//
|
||||
// L_Quality
|
||||
//
|
||||
//
|
||||
this.L_Quality.AutoSize = true;
|
||||
this.L_Quality.Location = new System.Drawing.Point(20, 84);
|
||||
this.L_Quality.Name = "L_Quality";
|
||||
|
|
@ -725,9 +725,9 @@ private void InitializeComponent()
|
|||
this.L_Quality.TabIndex = 49;
|
||||
this.L_Quality.Text = "Qualities:";
|
||||
this.L_Quality.TextAlign = System.Drawing.ContentAlignment.MiddleRight;
|
||||
//
|
||||
//
|
||||
// L_0xB
|
||||
//
|
||||
//
|
||||
this.L_0xB.AutoSize = true;
|
||||
this.L_0xB.Location = new System.Drawing.Point(256, 101);
|
||||
this.L_0xB.Name = "L_0xB";
|
||||
|
|
@ -735,9 +735,9 @@ private void InitializeComponent()
|
|||
this.L_0xB.TabIndex = 50;
|
||||
this.L_0xB.Text = "0xB:";
|
||||
this.L_0xB.TextAlign = System.Drawing.ContentAlignment.MiddleRight;
|
||||
//
|
||||
//
|
||||
// NUD_0xB
|
||||
//
|
||||
//
|
||||
this.NUD_0xB.Location = new System.Drawing.Point(287, 99);
|
||||
this.NUD_0xB.Maximum = new decimal(new int[] {
|
||||
255,
|
||||
|
|
@ -747,9 +747,9 @@ private void InitializeComponent()
|
|||
this.NUD_0xB.Name = "NUD_0xB";
|
||||
this.NUD_0xB.Size = new System.Drawing.Size(40, 20);
|
||||
this.NUD_0xB.TabIndex = 51;
|
||||
//
|
||||
//
|
||||
// NUD_0x20
|
||||
//
|
||||
//
|
||||
this.NUD_0x20.Location = new System.Drawing.Point(282, 239);
|
||||
this.NUD_0x20.Maximum = new decimal(new int[] {
|
||||
255,
|
||||
|
|
@ -759,9 +759,9 @@ private void InitializeComponent()
|
|||
this.NUD_0x20.Name = "NUD_0x20";
|
||||
this.NUD_0x20.Size = new System.Drawing.Size(40, 20);
|
||||
this.NUD_0x20.TabIndex = 52;
|
||||
//
|
||||
//
|
||||
// NUD_0x21
|
||||
//
|
||||
//
|
||||
this.NUD_0x21.Location = new System.Drawing.Point(282, 261);
|
||||
this.NUD_0x21.Maximum = new decimal(new int[] {
|
||||
255,
|
||||
|
|
@ -771,9 +771,9 @@ private void InitializeComponent()
|
|||
this.NUD_0x21.Name = "NUD_0x21";
|
||||
this.NUD_0x21.Size = new System.Drawing.Size(40, 20);
|
||||
this.NUD_0x21.TabIndex = 53;
|
||||
//
|
||||
//
|
||||
// L_0x20
|
||||
//
|
||||
//
|
||||
this.L_0x20.AutoSize = true;
|
||||
this.L_0x20.Location = new System.Drawing.Point(232, 242);
|
||||
this.L_0x20.Name = "L_0x20";
|
||||
|
|
@ -781,9 +781,9 @@ private void InitializeComponent()
|
|||
this.L_0x20.TabIndex = 59;
|
||||
this.L_0x20.Text = "Flags 1:";
|
||||
this.L_0x20.TextAlign = System.Drawing.ContentAlignment.MiddleRight;
|
||||
//
|
||||
//
|
||||
// L_0x21
|
||||
//
|
||||
//
|
||||
this.L_0x21.AutoSize = true;
|
||||
this.L_0x21.Location = new System.Drawing.Point(233, 264);
|
||||
this.L_0x21.Name = "L_0x21";
|
||||
|
|
@ -791,9 +791,9 @@ private void InitializeComponent()
|
|||
this.L_0x21.TabIndex = 62;
|
||||
this.L_0x21.Text = "Flags 2:";
|
||||
this.L_0x21.TextAlign = System.Drawing.ContentAlignment.MiddleRight;
|
||||
//
|
||||
//
|
||||
// B_RandAll
|
||||
//
|
||||
//
|
||||
this.B_RandAll.Location = new System.Drawing.Point(333, 10);
|
||||
this.B_RandAll.Name = "B_RandAll";
|
||||
this.B_RandAll.Size = new System.Drawing.Size(98, 23);
|
||||
|
|
@ -801,9 +801,9 @@ private void InitializeComponent()
|
|||
this.B_RandAll.Text = "Randomize!";
|
||||
this.B_RandAll.UseVisualStyleBackColor = true;
|
||||
this.B_RandAll.Click += new System.EventHandler(this.B_RandAll_Click);
|
||||
//
|
||||
//
|
||||
// groupBox1
|
||||
//
|
||||
//
|
||||
this.groupBox1.Controls.Add(this.CHK_Category);
|
||||
this.groupBox1.Controls.Add(this.CHK_Type);
|
||||
this.groupBox1.Location = new System.Drawing.Point(333, 60);
|
||||
|
|
@ -812,9 +812,9 @@ private void InitializeComponent()
|
|||
this.groupBox1.TabIndex = 64;
|
||||
this.groupBox1.TabStop = false;
|
||||
this.groupBox1.Text = "Options";
|
||||
//
|
||||
//
|
||||
// CHK_Category
|
||||
//
|
||||
//
|
||||
this.CHK_Category.AutoSize = true;
|
||||
this.CHK_Category.Location = new System.Drawing.Point(6, 34);
|
||||
this.CHK_Category.Name = "CHK_Category";
|
||||
|
|
@ -822,9 +822,9 @@ private void InitializeComponent()
|
|||
this.CHK_Category.TabIndex = 1;
|
||||
this.CHK_Category.Text = "Category";
|
||||
this.CHK_Category.UseVisualStyleBackColor = true;
|
||||
//
|
||||
//
|
||||
// CHK_Type
|
||||
//
|
||||
//
|
||||
this.CHK_Type.AutoSize = true;
|
||||
this.CHK_Type.Location = new System.Drawing.Point(6, 19);
|
||||
this.CHK_Type.Name = "CHK_Type";
|
||||
|
|
@ -832,9 +832,9 @@ private void InitializeComponent()
|
|||
this.CHK_Type.TabIndex = 0;
|
||||
this.CHK_Type.Text = "Type";
|
||||
this.CHK_Type.UseVisualStyleBackColor = true;
|
||||
//
|
||||
//
|
||||
// B_Metronome
|
||||
//
|
||||
//
|
||||
this.B_Metronome.Location = new System.Drawing.Point(333, 33);
|
||||
this.B_Metronome.Name = "B_Metronome";
|
||||
this.B_Metronome.Size = new System.Drawing.Size(98, 23);
|
||||
|
|
@ -842,9 +842,9 @@ private void InitializeComponent()
|
|||
this.B_Metronome.Text = "Metronome Mode";
|
||||
this.B_Metronome.UseVisualStyleBackColor = true;
|
||||
this.B_Metronome.Click += new System.EventHandler(this.B_Metronome_Click);
|
||||
//
|
||||
//
|
||||
// B_Table
|
||||
//
|
||||
//
|
||||
this.B_Table.Location = new System.Drawing.Point(356, 117);
|
||||
this.B_Table.Name = "B_Table";
|
||||
this.B_Table.Size = new System.Drawing.Size(75, 23);
|
||||
|
|
@ -852,9 +852,9 @@ private void InitializeComponent()
|
|||
this.B_Table.Text = "Export Table";
|
||||
this.B_Table.UseVisualStyleBackColor = true;
|
||||
this.B_Table.Click += new System.EventHandler(this.B_Table_Click);
|
||||
//
|
||||
//
|
||||
// MoveEditor6
|
||||
//
|
||||
//
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||
this.ClientSize = new System.Drawing.Size(439, 381);
|
||||
|
|
@ -916,7 +916,7 @@ private void InitializeComponent()
|
|||
this.Name = "MoveEditor6";
|
||||
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent;
|
||||
this.Text = "Move Editor";
|
||||
this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.formClosing);
|
||||
this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.CloseForm);
|
||||
((System.ComponentModel.ISupportInitialize)(this.NUD_HitMax)).EndInit();
|
||||
((System.ComponentModel.ISupportInitialize)(this.NUD_HitMin)).EndInit();
|
||||
((System.ComponentModel.ISupportInitialize)(this.NUD_Priority)).EndInit();
|
||||
|
|
|
|||
|
|
@ -17,7 +17,8 @@ public MoveEditor6(byte[][] infiles)
|
|||
Setup();
|
||||
RandSettings.GetFormSettings(this, groupBox1.Controls);
|
||||
}
|
||||
private byte[][] files;
|
||||
|
||||
private readonly byte[][] files;
|
||||
private readonly string[] types = Main.Config.getText(TextName.Types);
|
||||
private readonly string[] moveflavor = Main.Config.getText(TextName.MoveFlavor);
|
||||
private readonly string[] movelist = Main.Config.getText(TextName.MoveNames);
|
||||
|
|
@ -45,6 +46,7 @@ public MoveEditor6(byte[][] infiles)
|
|||
"No DMG -> Inflict Status", "No DMG -> -Target/+User Stat", "No DMG | Heal User", "DMG | Inflict Status", "No DMG | STATUS | +Target Stat",
|
||||
"DMG | -Target Stat", "DMG | +User Stat", "DMG | Absorbs DMG", "One-Hit KO", "Affects Whole Field",
|
||||
"Affect One Side of the Field", "Forces Target to Switch", "Unique Effect", };
|
||||
|
||||
private void Setup()
|
||||
{
|
||||
foreach (string s in movelist) CB_Move.Items.Add(s);
|
||||
|
|
@ -61,20 +63,22 @@ private void Setup()
|
|||
CB_Move.Items.RemoveAt(0);
|
||||
CB_Move.SelectedIndex = 0;
|
||||
}
|
||||
|
||||
private int entry = -1;
|
||||
private void changeEntry(object sender, EventArgs e)
|
||||
|
||||
private void ChangeEntry(object sender, EventArgs e)
|
||||
{
|
||||
setEntry();
|
||||
SetEntry();
|
||||
entry = Array.IndexOf(movelist, CB_Move.Text);
|
||||
getEntry();
|
||||
GetEntry();
|
||||
}
|
||||
private void getEntry()
|
||||
|
||||
private void GetEntry()
|
||||
{
|
||||
if (entry < 1) return;
|
||||
byte[] data = files[entry];
|
||||
{
|
||||
string flavor = moveflavor[entry].Replace("\\n", Environment.NewLine);
|
||||
RTB.Text = flavor;
|
||||
RTB.Text = moveflavor[entry].Replace("\\n", Environment.NewLine);
|
||||
|
||||
CB_Type.SelectedIndex = data[0x00];
|
||||
CB_Quality.SelectedIndex = data[0x01];
|
||||
|
|
@ -119,7 +123,8 @@ private void getEntry()
|
|||
//NUD_0x23.Value = data[0x23]; // 0x23
|
||||
}
|
||||
}
|
||||
private void setEntry()
|
||||
|
||||
private void SetEntry()
|
||||
{
|
||||
if (entry < 1) return;
|
||||
byte[] data = files[entry];
|
||||
|
|
@ -168,9 +173,9 @@ private void B_Table_Click(object sender, EventArgs e)
|
|||
System.Media.SystemSounds.Asterisk.Play();
|
||||
}
|
||||
|
||||
private void formClosing(object sender, FormClosingEventArgs e)
|
||||
private void CloseForm(object sender, FormClosingEventArgs e)
|
||||
{
|
||||
setEntry();
|
||||
SetEntry();
|
||||
RandSettings.SetFormSettings(this, groupBox1.Controls);
|
||||
}
|
||||
|
||||
|
|
@ -199,6 +204,7 @@ private void B_RandAll_Click(object sender, EventArgs e)
|
|||
}
|
||||
WinFormsUtil.Alert("All Moves have been randomized!");
|
||||
}
|
||||
|
||||
private void B_Metronome_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (WinFormsUtil.Prompt(MessageBoxButtons.YesNo, "Play using Metronome Mode?", "This will set the Base PP for every other Move to 0!") != DialogResult.Yes) return;
|
||||
|
|
|
|||
|
|
@ -24,7 +24,7 @@ public OPower()
|
|||
|
||||
// Gather Data
|
||||
for (int i = 0; i < powerData.Length; i++)
|
||||
powerData[i] = exefsData.Skip(offset + 22 * i).Take(22).ToArray();
|
||||
powerData[i] = exefsData.Skip(offset + (22 * i)).Take(22).ToArray();
|
||||
|
||||
// Prepare View
|
||||
for (int i = 0; i < 10; i++) CB_SortOrder.Items.Add(i);
|
||||
|
|
@ -40,12 +40,14 @@ public OPower()
|
|||
private readonly string[] powerFlavor = Main.Config.getText(TextName.OPowerFlavor);
|
||||
|
||||
private int entry = -1;
|
||||
|
||||
private void changeEntry(object sender, EventArgs e)
|
||||
{
|
||||
setEntry();
|
||||
entry = CB_Item.SelectedIndex + 1;
|
||||
getEntry();
|
||||
}
|
||||
|
||||
private void getEntry()
|
||||
{
|
||||
if (entry < 1) return;
|
||||
|
|
@ -86,6 +88,7 @@ private void getEntry()
|
|||
NUD_Usability.Value = _01;
|
||||
NUD_2.Value = _02;
|
||||
}
|
||||
|
||||
private void setEntry()
|
||||
{
|
||||
if (entry < 1) return;
|
||||
|
|
@ -117,7 +120,7 @@ private void formClosing(object sender, FormClosingEventArgs e)
|
|||
setEntry();
|
||||
// Copy data back to storage
|
||||
for (int i = 0; i < powerData.Length; i++)
|
||||
Array.Copy(powerData[i], 0, exefsData, offset + i * powerData[i].Length, powerData[i].Length);
|
||||
Array.Copy(powerData[i], 0, exefsData, offset + (i * powerData[i].Length), powerData[i].Length);
|
||||
if (ModifierKeys != Keys.Control)
|
||||
File.WriteAllBytes(codebin, exefsData);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -172,6 +172,7 @@ private void CB_Species_SelectedIndexChanged(object sender, EventArgs e)
|
|||
entry = CB_Species.SelectedIndex;
|
||||
readEntry();
|
||||
}
|
||||
|
||||
private void ByteLimiter(object sender, EventArgs e)
|
||||
{
|
||||
if (!(sender is MaskedTextBox mtb))
|
||||
|
|
@ -184,6 +185,7 @@ private void ByteLimiter(object sender, EventArgs e)
|
|||
}
|
||||
|
||||
private PersonalInfo pkm;
|
||||
|
||||
private void readInfo()
|
||||
{
|
||||
pkm = Main.SpeciesStat[entry];
|
||||
|
|
@ -251,6 +253,7 @@ private void readInfo()
|
|||
CLB_ORASTutors.SetItemChecked(ctr++, pkm.SpecialTutors[i][b]);
|
||||
}
|
||||
}
|
||||
|
||||
private void readEntry()
|
||||
{
|
||||
readInfo();
|
||||
|
|
@ -268,13 +271,14 @@ private void readEntry()
|
|||
{
|
||||
Color c = rawImg.GetPixel(x, y);
|
||||
bigImg.SetPixel(2 * x, 2 * y, c);
|
||||
bigImg.SetPixel(2 * x + 1, 2 * y, c);
|
||||
bigImg.SetPixel(2 * x, 2 * y + 1, c);
|
||||
bigImg.SetPixel(2 * x + 1, 2 * y + 1, c);
|
||||
bigImg.SetPixel((2 * x) + 1, 2 * y, c);
|
||||
bigImg.SetPixel(2 * x, (2 * y) + 1, c);
|
||||
bigImg.SetPixel((2 * x) + 1, (2 * y) + 1, c);
|
||||
}
|
||||
}
|
||||
PB_MonSprite.Image = bigImg;
|
||||
}
|
||||
|
||||
private void savePersonal()
|
||||
{
|
||||
pkm.HP = Convert.ToByte(TB_BaseHP.Text);
|
||||
|
|
@ -328,6 +332,7 @@ private void savePersonal()
|
|||
for (int t = 0; t < len[i]; t++)
|
||||
pkm.SpecialTutors[i][t] = CLB_ORASTutors.GetItemChecked(ctr++);
|
||||
}
|
||||
|
||||
private void saveEntry()
|
||||
{
|
||||
savePersonal();
|
||||
|
|
@ -367,6 +372,7 @@ private void B_Randomize_Click(object sender, EventArgs e)
|
|||
readEntry();
|
||||
WinFormsUtil.Alert("Randomized all Pokémon Personal data entries according to specification!", "Press the Dump All button to view the new Personal data!");
|
||||
}
|
||||
|
||||
private void B_ModifyAll(object sender, EventArgs e)
|
||||
{
|
||||
if (WinFormsUtil.Prompt(MessageBoxButtons.YesNo, "Modify all? Cannot undo.", "Double check Modification settings in the Enhancements tab.") != DialogResult.Yes) return;
|
||||
|
|
@ -402,7 +408,9 @@ private void B_ModifyAll(object sender, EventArgs e)
|
|||
CB_Species.SelectedIndex = 1;
|
||||
WinFormsUtil.Alert("Modified all Pokémon Personal data entries according to specification!", "Press the Dump All button to view the new Personal data!");
|
||||
}
|
||||
|
||||
private bool dumping;
|
||||
|
||||
private void B_Dump_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (DialogResult.Yes != WinFormsUtil.Prompt(MessageBoxButtons.YesNo, "Dump all Personal Entries to Text File?"))
|
||||
|
|
@ -442,11 +450,13 @@ private void B_Dump_Click(object sender, EventArgs e)
|
|||
string path = sfd.FileName;
|
||||
File.WriteAllLines(path, lines, Encoding.Unicode);
|
||||
}
|
||||
|
||||
private void CHK_Stats_CheckedChanged(object sender, EventArgs e)
|
||||
{
|
||||
L_StatDev.Visible = NUD_StatDev.Visible = CHK_Stats.Checked;
|
||||
CHK_rHP.Enabled = CHK_rATK.Enabled = CHK_rDEF.Enabled = CHK_rSPA.Enabled = CHK_rSPD.Enabled = CHK_rSPE.Enabled = CHK_Stats.Checked;
|
||||
}
|
||||
|
||||
private void CHK_Ability_CheckedChanged(object sender, EventArgs e)
|
||||
{
|
||||
CHK_WGuard.Enabled = CHK_Ability.Checked;
|
||||
|
|
|
|||
|
|
@ -28,10 +28,12 @@ public PickupEditor6()
|
|||
private readonly int offset = Main.Config.ORAS ? 0x004872FC : 0x004455A8;
|
||||
private readonly byte[] data;
|
||||
private int dataoffset;
|
||||
|
||||
private void getDataOffset()
|
||||
{
|
||||
dataoffset = offset; // reset
|
||||
}
|
||||
|
||||
private void setupDGV()
|
||||
{
|
||||
dgvCommon.Columns.Clear(); dgvRare.Columns.Clear();
|
||||
|
|
@ -70,9 +72,9 @@ private void getList()
|
|||
|
||||
getDataOffset();
|
||||
for (int i = 0; i < 0x12; i++) // 0x12 Common
|
||||
common.Add(BitConverter.ToUInt16(data, dataoffset + 2 * i));
|
||||
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));
|
||||
rare.Add(BitConverter.ToUInt16(data, dataoffset + (2 * i)));
|
||||
|
||||
ushort[] clist = common.ToArray();
|
||||
ushort[] rlist = rare.ToArray();
|
||||
|
|
@ -80,8 +82,8 @@ private void getList()
|
|||
{ 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()
|
||||
{
|
||||
common = new List<ushort>();
|
||||
|
|
@ -96,9 +98,9 @@ private void setList()
|
|||
ushort[] rlist = rare.ToArray();
|
||||
|
||||
for (int i = 0; i < 0x12; i++)
|
||||
Array.Copy(BitConverter.GetBytes(clist[i]), 0, data, offset + 2 * i, 2);
|
||||
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 B_Save_Click(object sender, EventArgs e)
|
||||
|
|
@ -107,10 +109,12 @@ private void B_Save_Click(object sender, EventArgs e)
|
|||
File.WriteAllBytes(codebin, data);
|
||||
Close();
|
||||
}
|
||||
|
||||
private void B_Cancel_Click(object sender, EventArgs e)
|
||||
{
|
||||
Close();
|
||||
}
|
||||
|
||||
private void B_Randomize_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (DialogResult.Yes != WinFormsUtil.Prompt(MessageBoxButtons.YesNoCancel, "Randomize pickup lists?"))
|
||||
|
|
|
|||
786
pk3DS/Subforms/Gen6/RSTE.Designer.cs
generated
786
pk3DS/Subforms/Gen6/RSTE.Designer.cs
generated
File diff suppressed because it is too large
Load Diff
|
|
@ -16,6 +16,7 @@ namespace pk3DS
|
|||
public partial class RSTE : Form
|
||||
{
|
||||
private readonly LearnsetRandomizer learn = new LearnsetRandomizer(Main.Config, Main.Config.Learnsets);
|
||||
|
||||
public RSTE(byte[][] trc, byte[][] trd, byte[][] trp)
|
||||
{
|
||||
trclass = trc;
|
||||
|
|
@ -29,110 +30,23 @@ public RSTE(byte[][] trc, byte[][] trd, byte[][] trp)
|
|||
InitializeComponent();
|
||||
// String Fetching
|
||||
#region Combo Box Arrays
|
||||
trpk_pkm = new[]
|
||||
{
|
||||
CB_Pokemon_1_Pokemon,
|
||||
CB_Pokemon_2_Pokemon,
|
||||
CB_Pokemon_3_Pokemon,
|
||||
CB_Pokemon_4_Pokemon,
|
||||
CB_Pokemon_5_Pokemon,
|
||||
CB_Pokemon_6_Pokemon,
|
||||
};
|
||||
trpk_lvl = new[]
|
||||
{
|
||||
CB_Pokemon_1_Level,
|
||||
CB_Pokemon_2_Level,
|
||||
CB_Pokemon_3_Level,
|
||||
CB_Pokemon_4_Level,
|
||||
CB_Pokemon_5_Level,
|
||||
CB_Pokemon_6_Level,
|
||||
};
|
||||
trpk_item = new[]
|
||||
{
|
||||
CB_Pokemon_1_Item,
|
||||
CB_Pokemon_2_Item,
|
||||
CB_Pokemon_3_Item,
|
||||
CB_Pokemon_4_Item,
|
||||
CB_Pokemon_5_Item,
|
||||
CB_Pokemon_6_Item,
|
||||
};
|
||||
trpk_abil = new[]
|
||||
{
|
||||
CB_Pokemon_1_Ability,
|
||||
CB_Pokemon_2_Ability,
|
||||
CB_Pokemon_3_Ability,
|
||||
CB_Pokemon_4_Ability,
|
||||
CB_Pokemon_5_Ability,
|
||||
CB_Pokemon_6_Ability,
|
||||
};
|
||||
trpk_m1 = new[]
|
||||
{
|
||||
CB_Pokemon_1_Move_1,
|
||||
CB_Pokemon_2_Move_1,
|
||||
CB_Pokemon_3_Move_1,
|
||||
CB_Pokemon_4_Move_1,
|
||||
CB_Pokemon_5_Move_1,
|
||||
CB_Pokemon_6_Move_1,
|
||||
};
|
||||
trpk_m2 = new[]
|
||||
{
|
||||
CB_Pokemon_1_Move_2,
|
||||
CB_Pokemon_2_Move_2,
|
||||
CB_Pokemon_3_Move_2,
|
||||
CB_Pokemon_4_Move_2,
|
||||
CB_Pokemon_5_Move_2,
|
||||
CB_Pokemon_6_Move_2,
|
||||
};
|
||||
trpk_m3 = new[]
|
||||
{
|
||||
CB_Pokemon_1_Move_3,
|
||||
CB_Pokemon_2_Move_3,
|
||||
CB_Pokemon_3_Move_3,
|
||||
CB_Pokemon_4_Move_3,
|
||||
CB_Pokemon_5_Move_3,
|
||||
CB_Pokemon_6_Move_3,
|
||||
};
|
||||
trpk_m4 = new[]
|
||||
{
|
||||
CB_Pokemon_1_Move_4,
|
||||
CB_Pokemon_2_Move_4,
|
||||
CB_Pokemon_3_Move_4,
|
||||
CB_Pokemon_4_Move_4,
|
||||
CB_Pokemon_5_Move_4,
|
||||
CB_Pokemon_6_Move_4,
|
||||
};
|
||||
trpk_IV = new[]
|
||||
{
|
||||
CB_Pokemon_1_IVs,
|
||||
CB_Pokemon_2_IVs,
|
||||
CB_Pokemon_3_IVs,
|
||||
CB_Pokemon_4_IVs,
|
||||
CB_Pokemon_5_IVs,
|
||||
CB_Pokemon_6_IVs,
|
||||
};
|
||||
trpk_form = new[]
|
||||
{
|
||||
CB_Pokemon_1_Form,
|
||||
CB_Pokemon_2_Form,
|
||||
CB_Pokemon_3_Form,
|
||||
CB_Pokemon_4_Form,
|
||||
CB_Pokemon_5_Form,
|
||||
CB_Pokemon_6_Form,
|
||||
};
|
||||
trpk_gender = new[]
|
||||
{
|
||||
CB_Pokemon_1_Gender,
|
||||
CB_Pokemon_2_Gender,
|
||||
CB_Pokemon_3_Gender,
|
||||
CB_Pokemon_4_Gender,
|
||||
CB_Pokemon_5_Gender,
|
||||
CB_Pokemon_6_Gender,
|
||||
};
|
||||
trpk_pkm = new[] { CB_Pokemon_1_Pokemon, CB_Pokemon_2_Pokemon, CB_Pokemon_3_Pokemon, CB_Pokemon_4_Pokemon, CB_Pokemon_5_Pokemon, CB_Pokemon_6_Pokemon, };
|
||||
trpk_lvl = new[] { CB_Pokemon_1_Level, CB_Pokemon_2_Level, CB_Pokemon_3_Level, CB_Pokemon_4_Level, CB_Pokemon_5_Level, CB_Pokemon_6_Level, };
|
||||
trpk_item = new[] { CB_Pokemon_1_Item, CB_Pokemon_2_Item, CB_Pokemon_3_Item, CB_Pokemon_4_Item, CB_Pokemon_5_Item, CB_Pokemon_6_Item, };
|
||||
trpk_abil = new[] { CB_Pokemon_1_Ability, CB_Pokemon_2_Ability, CB_Pokemon_3_Ability, CB_Pokemon_4_Ability, CB_Pokemon_5_Ability, CB_Pokemon_6_Ability, };
|
||||
trpk_m1 = new[] { CB_Pokemon_1_Move_1, CB_Pokemon_2_Move_1, CB_Pokemon_3_Move_1, CB_Pokemon_4_Move_1, CB_Pokemon_5_Move_1, CB_Pokemon_6_Move_1, };
|
||||
trpk_m2 = new[] { CB_Pokemon_1_Move_2, CB_Pokemon_2_Move_2, CB_Pokemon_3_Move_2, CB_Pokemon_4_Move_2, CB_Pokemon_5_Move_2, CB_Pokemon_6_Move_2, };
|
||||
trpk_m3 = new[] { CB_Pokemon_1_Move_3, CB_Pokemon_2_Move_3, CB_Pokemon_3_Move_3, CB_Pokemon_4_Move_3, CB_Pokemon_5_Move_3, CB_Pokemon_6_Move_3, };
|
||||
trpk_m4 = new[] { CB_Pokemon_1_Move_4, CB_Pokemon_2_Move_4, CB_Pokemon_3_Move_4, CB_Pokemon_4_Move_4, CB_Pokemon_5_Move_4, CB_Pokemon_6_Move_4, };
|
||||
trpk_IV = new[] { CB_Pokemon_1_IVs, CB_Pokemon_2_IVs, CB_Pokemon_3_IVs, CB_Pokemon_4_IVs, CB_Pokemon_5_IVs, CB_Pokemon_6_IVs, };
|
||||
trpk_form = new[] { CB_Pokemon_1_Form, CB_Pokemon_2_Form, CB_Pokemon_3_Form, CB_Pokemon_4_Form, CB_Pokemon_5_Form, CB_Pokemon_6_Form, };
|
||||
trpk_gender = new[] { CB_Pokemon_1_Gender, CB_Pokemon_2_Gender, CB_Pokemon_3_Gender, CB_Pokemon_4_Gender, CB_Pokemon_5_Gender, CB_Pokemon_6_Gender, };
|
||||
#endregion
|
||||
Setup();
|
||||
}
|
||||
|
||||
private string[][] AltForms;
|
||||
internal static uint rnd32() => Util.rnd32();
|
||||
internal static uint Rand() => Util.rnd32();
|
||||
private bool start = true;
|
||||
private bool loading = true;
|
||||
private int index = -1;
|
||||
|
|
@ -164,18 +78,20 @@ public RSTE(byte[][] trc, byte[][] trd, byte[][] trp)
|
|||
#endregion
|
||||
|
||||
// Ability Loading
|
||||
private void refreshFormAbility(object sender, EventArgs e)
|
||||
private void RefreshFormAbility(object sender, EventArgs e)
|
||||
{
|
||||
int i = Array.IndexOf(trpk_form, sender as ComboBox);
|
||||
refreshPKMSlotAbility(i);
|
||||
RefreshPKMSlotAbility(i);
|
||||
}
|
||||
private void refreshSpeciesAbility(object sender, EventArgs e)
|
||||
|
||||
private void RefreshSpeciesAbility(object sender, EventArgs e)
|
||||
{
|
||||
int i = Array.IndexOf(trpk_pkm, sender as ComboBox);
|
||||
FormUtil.setForms(trpk_pkm[i].SelectedIndex, trpk_form[i], AltForms);
|
||||
refreshPKMSlotAbility(i);
|
||||
RefreshPKMSlotAbility(i);
|
||||
}
|
||||
private void refreshPKMSlotAbility(int slot)
|
||||
|
||||
private void RefreshPKMSlotAbility(int slot)
|
||||
{
|
||||
int previousAbility = trpk_abil[slot].SelectedIndex;
|
||||
|
||||
|
|
@ -192,10 +108,10 @@ private void refreshPKMSlotAbility(int slot)
|
|||
|
||||
trpk_abil[slot].SelectedIndex = previousAbility;
|
||||
|
||||
showTeams(slot);
|
||||
ShowTeams(slot);
|
||||
}
|
||||
// Set Loading
|
||||
private void changeTrainerType(object sender, EventArgs e)
|
||||
private void ChangeTrainerType(object sender, EventArgs e)
|
||||
{
|
||||
if (start || loading) return;
|
||||
int pkm = CB_numPokemon.SelectedIndex;
|
||||
|
|
@ -242,7 +158,7 @@ private void changeTrainerType(object sender, EventArgs e)
|
|||
}
|
||||
|
||||
// Dumping
|
||||
private string getTRSummary()
|
||||
private string GetTRSummary()
|
||||
{
|
||||
string toret = "======" + Environment.NewLine;
|
||||
|
||||
|
|
@ -270,20 +186,22 @@ private string getTRSummary()
|
|||
if (trpk_m4[i].SelectedIndex > 0) toret += " / " + trpk_m4[i].Text;
|
||||
toret += ")";
|
||||
}
|
||||
toret += " IVs: All " + Convert.ToInt32(trpk_IV[i].SelectedIndex) / 8;
|
||||
toret += " IVs: All " + (Convert.ToInt32(trpk_IV[i].SelectedIndex) / 8);
|
||||
toret += Environment.NewLine;
|
||||
}
|
||||
toret += Environment.NewLine;
|
||||
return toret;
|
||||
}
|
||||
|
||||
private bool dumping;
|
||||
|
||||
private void B_Dump_Click(object sender, EventArgs e)
|
||||
{
|
||||
string toret = ""; dumping = true;
|
||||
for (int i = 1; i < CB_TrainerID.Items.Count; i++)
|
||||
{
|
||||
CB_TrainerID.SelectedIndex = i;
|
||||
string tdata = getTRSummary();
|
||||
string tdata = GetTRSummary();
|
||||
toret += tdata;
|
||||
}
|
||||
SaveFileDialog sfd = new SaveFileDialog {FileName = "Battles.txt", Filter = "Text File|*.txt"};
|
||||
|
|
@ -299,12 +217,14 @@ private void B_Dump_Click(object sender, EventArgs e)
|
|||
|
||||
// Change Read/Write
|
||||
private trdata6 tr;
|
||||
private void changeTrainerIndex(object sender, EventArgs e)
|
||||
|
||||
private void ChangeTrainerIndex(object sender, EventArgs e)
|
||||
{
|
||||
if (!dumping && index > -1) writeFile();
|
||||
readFile(); // Load the new file.
|
||||
if (!dumping && index > -1) WriteFile();
|
||||
ReadFile(); // Load the new file.
|
||||
}
|
||||
private void readFile()
|
||||
|
||||
private void ReadFile()
|
||||
{
|
||||
if (start) return;
|
||||
index = CB_TrainerID.SelectedIndex;
|
||||
|
|
@ -331,7 +251,7 @@ private void readFile()
|
|||
checkBox_Healer.Checked = tr.Healer;
|
||||
CB_Money.SelectedIndex = tr.Money;
|
||||
CB_Prize.SelectedIndex = tr.Prize;
|
||||
|
||||
|
||||
// Load Pokemon Data
|
||||
for (int i = 0; i < tr.NumPokemon; i++)
|
||||
{
|
||||
|
|
@ -340,7 +260,7 @@ private void readFile()
|
|||
trpk_pkm[i].SelectedIndex = tr.Team[i].Species;
|
||||
FormUtil.setForms(tr.Team[i].Species, trpk_form[i], AltForms);
|
||||
trpk_form[i].SelectedIndex = tr.Team[i].Form % trpk_form[i].Items.Count; // stupid X/Y buggy edge cases (220 / 222)
|
||||
refreshPKMSlotAbility(i); // Repopulate Abilities
|
||||
RefreshPKMSlotAbility(i); // Repopulate Abilities
|
||||
|
||||
trpk_abil[i].SelectedIndex = tr.Team[i].Ability;
|
||||
trpk_gender[i].SelectedIndex = tr.Team[i].Gender;
|
||||
|
|
@ -352,17 +272,17 @@ private void readFile()
|
|||
trpk_m4[i].SelectedIndex = tr.Team[i].Moves[3];
|
||||
}
|
||||
loading = false;
|
||||
changeTrainerType(null, null); // Prompt cleaning update of PKM fields
|
||||
ChangeTrainerType(null, null); // Prompt cleaning update of PKM fields
|
||||
|
||||
// Refresh Team View
|
||||
if (!loading)
|
||||
{
|
||||
for (int i = 0; i < 6; i++) showTeams(i);
|
||||
for (int i = 0; i < 6; i++) ShowTeams(i);
|
||||
// showText(); // Commented out for now, have to figure out how text is assigned.
|
||||
}
|
||||
|
||||
}
|
||||
private void writeFile()
|
||||
|
||||
private void WriteFile()
|
||||
{
|
||||
// Set Trainer Data
|
||||
tr.Moves = checkBox_Moves.Checked;
|
||||
|
|
@ -370,7 +290,7 @@ private void writeFile()
|
|||
tr.Class = CB_Trainer_Class.SelectedIndex;
|
||||
tr.BattleType = (byte)CB_Battle_Type.SelectedIndex;
|
||||
tr.NumPokemon = (byte)CB_numPokemon.SelectedIndex;
|
||||
if (tr.NumPokemon == 0)
|
||||
if (tr.NumPokemon == 0)
|
||||
tr.NumPokemon = 1; // No empty teams!
|
||||
tr.Items[0] = (ushort)CB_Item_1.SelectedIndex;
|
||||
tr.Items[1] = (ushort)CB_Item_2.SelectedIndex;
|
||||
|
|
@ -400,35 +320,35 @@ private void writeFile()
|
|||
tr.Team[i].Moves[2] = (ushort)trpk_m3[i].SelectedIndex;
|
||||
tr.Team[i].Moves[3] = (ushort)trpk_m4[i].SelectedIndex;
|
||||
}
|
||||
byte[] trd = tr.Write();
|
||||
trdata[index] = trd;
|
||||
byte[] trp = tr.WriteTeam();
|
||||
trpoke[index] = trp;
|
||||
trdata[index] = tr.Write();
|
||||
trpoke[index] = tr.WriteTeam();
|
||||
}
|
||||
|
||||
// Image Displays
|
||||
private void changeTeam(object sender, EventArgs e)
|
||||
private void ChangeTeam(object sender, EventArgs e)
|
||||
{
|
||||
if (loading) return;
|
||||
|
||||
int gendSlot = Array.IndexOf(trpk_gender, sender as ComboBox);
|
||||
int itemSlot = Array.IndexOf(trpk_item, sender as ComboBox);
|
||||
showTeams(gendSlot < 0 ? itemSlot : gendSlot);
|
||||
ShowTeams(gendSlot < 0 ? itemSlot : gendSlot);
|
||||
}
|
||||
private void showTeams(int i)
|
||||
|
||||
private void ShowTeams(int i)
|
||||
{
|
||||
if (tr == null) return;
|
||||
if (i >= tr.Team.Length) { pba[i].Image = null; return; }
|
||||
Bitmap rawImg = WinFormsUtil.getSprite(tr.Team[i].Species, tr.Team[i].Form, tr.Team[i].Gender, tr.Team[i].Item, Main.Config);
|
||||
pba[i].Image = WinFormsUtil.scaleImage(rawImg, 2);
|
||||
}
|
||||
private void showText()
|
||||
|
||||
private void ShowText()
|
||||
{
|
||||
if (index * 2 >= trText.Length) return;
|
||||
TB_Text1.Text = trText[index * 2];
|
||||
TB_Text2.Text = trText[index * 2 + 1];
|
||||
TB_Text2.Text = trText[(index * 2) + 1];
|
||||
}
|
||||
|
||||
|
||||
private void Setup()
|
||||
{
|
||||
start = true;
|
||||
|
|
@ -511,18 +431,19 @@ private void Setup()
|
|||
CB_Battle_Type.Items.Add("Triple");
|
||||
CB_Battle_Type.Items.Add("Rotation");
|
||||
if (Main.Config.ORAS) CB_Battle_Type.Items.Add("Horde");
|
||||
megaEvos = Main.Config.ORAS
|
||||
? new[] { 15, 18, 80, 208, 254, 260, 302, 319, 323, 334, 362, 373, 376, 380, 381, 428, 475, 531, 719, 3, 6, 9, 65, 94, 115, 127, 130, 142, 150, 181, 212, 214, 229, 248, 257, 282, 303, 306, 308, 310, 354, 359, 445, 448, 460 }
|
||||
megaEvos = Main.Config.ORAS
|
||||
? new[] { 15, 18, 80, 208, 254, 260, 302, 319, 323, 334, 362, 373, 376, 380, 381, 428, 475, 531, 719, 3, 6, 9, 65, 94, 115, 127, 130, 142, 150, 181, 212, 214, 229, 248, 257, 282, 303, 306, 308, 310, 354, 359, 445, 448, 460 }
|
||||
: new[] { 3, 6, 9, 65, 94, 115, 127, 130, 142, 150, 181, 212, 214, 229, 248, 257, 282, 303, 306, 308, 310, 354, 359, 445, 448, 460 };
|
||||
|
||||
|
||||
CB_TrainerID.SelectedIndex = 1;
|
||||
start = false;
|
||||
readFile();
|
||||
ReadFile();
|
||||
}
|
||||
|
||||
public static bool rPKM, rSmart, rLevel, rMove, rMetronome, rNoMove, rForceHighPower, rAbility, rDiffAI,
|
||||
public static bool rPKM, rSmart, rLevel, rMove, rMetronome, rNoMove, rForceHighPower, rAbility, rDiffAI,
|
||||
rDiffIV, rClass, rGift, rItem, rDoRand, rRandomMegas, rGymE4Only,
|
||||
rTypeTheme, rTypeGymTrainers, rOnlySingles, rDMG, rSTAB, r6PKM, rForceFullyEvolved;
|
||||
|
||||
public static bool rNoFixedDamage;
|
||||
internal static bool[] rThemedClasses = { };
|
||||
private static string[] rTags;
|
||||
|
|
@ -537,6 +458,7 @@ private void Setup()
|
|||
private readonly Dictionary<string, int> TagTypes = new Dictionary<string, int>();
|
||||
public static int[] sL; // Random Species List
|
||||
public static decimal rGiftPercent, rLevelMultiplier, rMinPKM, rMaxPKM, rForceFullyEvolvedLevel, rForceHighPowerLevel;
|
||||
|
||||
private void B_Randomize_Click(object sender, EventArgs e)
|
||||
{
|
||||
rPKM = rMove = rMetronome = rAbility = rDiffAI = rDiffIV = rClass = rGift = rItem = rDoRand = false; // init to false
|
||||
|
|
@ -546,6 +468,7 @@ private void B_Randomize_Click(object sender, EventArgs e)
|
|||
if (rDoRand)
|
||||
Randomize();
|
||||
}
|
||||
|
||||
private void Randomize()
|
||||
{
|
||||
List<int> banned = new List<int> { 165, 621 }; // Struggle, Hyperspace Fury
|
||||
|
|
@ -571,22 +494,28 @@ private void Randomize()
|
|||
{
|
||||
if (mEvoTypes.Length < 13 && rTypeTheme)
|
||||
{
|
||||
WinFormsUtil.Alert("There are insufficient Types with at least one mega evolution to Guarantee story Mega Evos while keeping Type theming.",
|
||||
WinFormsUtil.Alert("There are insufficient Types with at least one mega evolution to Guarantee story Mega Evos while keeping Type theming.",
|
||||
"Re-Randomize Personal or don't choose both options."); return; }
|
||||
GymE4Types.AddRange(mEvoTypes);
|
||||
}
|
||||
else
|
||||
{
|
||||
GymE4Types.AddRange(Enumerable.Range(0, types.Length).ToArray());
|
||||
}
|
||||
|
||||
foreach (int t1 in rEnsureMEvo.Where(t1 => rTags[t1] != "" && !TagTypes.Keys.Contains(rTags[t1])))
|
||||
{
|
||||
int t;
|
||||
if (rTags[t1].Contains("GYM") || rTags[t1].Contains("ELITE") || rTags[t1].Contains("CHAMPION"))
|
||||
{
|
||||
t = GymE4Types[(int)(rnd32() % GymE4Types.Count)];
|
||||
t = GymE4Types[(int)(Rand() % GymE4Types.Count)];
|
||||
GymE4Types.Remove(t);
|
||||
}
|
||||
else
|
||||
t = mEvoTypes[rnd32() % mEvoTypes.Length];
|
||||
{
|
||||
t = mEvoTypes[Rand() % mEvoTypes.Length];
|
||||
}
|
||||
|
||||
TagTypes[rTags[t1]] = t;
|
||||
}
|
||||
foreach (string t1 in Tags)
|
||||
|
|
@ -596,11 +525,13 @@ private void Randomize()
|
|||
int t;
|
||||
if (t1.Contains("GYM") || t1.Contains("ELITE") || t1.Contains("CHAMPION"))
|
||||
{
|
||||
t = GymE4Types[(int)(rnd32() % GymE4Types.Count)];
|
||||
t = GymE4Types[(int)(Rand() % GymE4Types.Count)];
|
||||
GymE4Types.Remove(t);
|
||||
}
|
||||
else
|
||||
t = (int)(rnd32() % types.Length);
|
||||
{
|
||||
t = (int)(Rand() % types.Length);
|
||||
}
|
||||
|
||||
TagTypes[t1] = t;
|
||||
}
|
||||
|
|
@ -617,15 +548,14 @@ private void Randomize()
|
|||
// Trainer Type/Mega Evo
|
||||
int type = GetRandomType(i);
|
||||
bool mevo = rEnsureMEvo.Contains(i);
|
||||
bool typerand = rTypeTheme && !rGymE4Only ||
|
||||
rTypeTheme && rImportant[i] != null && ImportantClasses.Contains(rImportant[i]);
|
||||
bool typerand = (rTypeTheme && !rGymE4Only) || (rTypeTheme && rImportant[i] != null && ImportantClasses.Contains(rImportant[i]));
|
||||
rSpeciesRand.rType = typerand;
|
||||
|
||||
byte[] trd = trdata[i];
|
||||
byte[] trp = trpoke[i];
|
||||
var t = new trdata6(trd, trp, Main.Config.ORAS)
|
||||
{
|
||||
Moves = rMove || !rNoMove && checkBox_Moves.Checked,
|
||||
Moves = rMove || (!rNoMove && checkBox_Moves.Checked),
|
||||
Item = rItem || checkBox_Item.Checked
|
||||
};
|
||||
|
||||
|
|
@ -664,9 +594,13 @@ private static void RandomizeTeam(trdata6 t, MoveRandomizer move, LearnsetRandom
|
|||
}
|
||||
}
|
||||
else if (p == last && mevo)
|
||||
{
|
||||
stones = GetRandomMega(out species);
|
||||
}
|
||||
else
|
||||
{
|
||||
species = rSpeciesRand.GetRandomSpecies(pk.Species);
|
||||
}
|
||||
|
||||
pk.Species = (ushort)species;
|
||||
pk.Gender = 0; // Set Gender to Random
|
||||
|
|
@ -676,14 +610,14 @@ private static void RandomizeTeam(trdata6 t, MoveRandomizer move, LearnsetRandom
|
|||
if (rLevel)
|
||||
pk.Level = (ushort)Randomizer.getModifiedLevel(pk.Level, rLevelMultiplier);
|
||||
if (rAbility)
|
||||
pk.Ability = (int)(1 + rnd32() % 3);
|
||||
pk.Ability = (int)(1 + (Rand() % 3));
|
||||
if (rDiffIV)
|
||||
pk.IVs = 255;
|
||||
|
||||
if (mevo && p == last && stones != null)
|
||||
pk.Item = (ushort)stones[rnd32() % stones.Length];
|
||||
pk.Item = (ushort)stones[Rand() % stones.Length];
|
||||
else if (rItem)
|
||||
pk.Item = itemvals[rnd32() % itemvals.Length];
|
||||
pk.Item = itemvals[Rand() % itemvals.Length];
|
||||
|
||||
if (rForceFullyEvolved && pk.Level >= rForceFullyEvolvedLevel && !rFinalEvo.Contains(pk.Species))
|
||||
{
|
||||
|
|
@ -726,6 +660,7 @@ private static void RandomizeTeam(trdata6 t, MoveRandomizer move, LearnsetRandom
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
private static void SetMinMaxPKM(trdata6 t)
|
||||
{
|
||||
int lastPKM = Math.Max(t.NumPokemon - 1, 0); // 0,1-6 => 0-5 (never is 0)
|
||||
|
|
@ -757,6 +692,7 @@ private static void SetMinMaxPKM(trdata6 t)
|
|||
t.NumPokemon = (byte)rMaxPKM;
|
||||
}
|
||||
}
|
||||
|
||||
private static void SetFullParties(trdata6 t, bool important)
|
||||
{
|
||||
int lastPKM = Math.Max(t.NumPokemon - 1, 0); // 0,1-6 => 0-5 (never is 0)
|
||||
|
|
@ -768,7 +704,7 @@ private static void SetFullParties(trdata6 t, bool important)
|
|||
// 6 pkm for important trainers, skip the first rival battles
|
||||
if (!r6PKM || important)
|
||||
return;
|
||||
|
||||
|
||||
t.NumPokemon = 6;
|
||||
for (int f = lastPKM + 1; f < t.NumPokemon; f++)
|
||||
{
|
||||
|
|
@ -781,6 +717,7 @@ private static void SetFullParties(trdata6 t, bool important)
|
|||
};
|
||||
}
|
||||
}
|
||||
|
||||
private static void RandomizeTrainerAIClass(trdata6 t, string[] trClass)
|
||||
{
|
||||
if (rDiffAI)
|
||||
|
|
@ -788,7 +725,7 @@ private static void RandomizeTrainerAIClass(trdata6 t, string[] trClass)
|
|||
|
||||
if (rClass && rModelRestricted.Contains(t.Class) && !rIgnoreClass.Contains(t.Class)) // shuffle classes with 3D models
|
||||
{
|
||||
int randClass() => (int) (rnd32() % rModelRestricted.Length);
|
||||
int randClass() => (int) (Rand() % rModelRestricted.Length);
|
||||
t.Class = rModelRestricted[randClass()];
|
||||
}
|
||||
else
|
||||
|
|
@ -798,28 +735,31 @@ private static void RandomizeTrainerAIClass(trdata6 t, string[] trClass)
|
|||
&& !rIgnoreClass.Contains(t.Class) // Current class isn't a special class
|
||||
)
|
||||
{
|
||||
int randClass() => (int)(rnd32() % trClass.Length);
|
||||
int randClass() => (int)(Rand() % trClass.Length);
|
||||
int rv; do { rv = randClass(); }
|
||||
while (rIgnoreClass.Contains(rv) || trClass[rv].StartsWith("[~") || Main.Config.ORAS && (rv >= 0 && rv <= 63) || (rv >= 68 && rv <= 126)); // don't allow disallowed classes
|
||||
while (rIgnoreClass.Contains(rv) || trClass[rv].StartsWith("[~") || (Main.Config.ORAS && (rv >= 0 && rv <= 63)) || (rv >= 68 && rv <= 126)); // don't allow disallowed classes
|
||||
t.Class = rv;
|
||||
}
|
||||
}
|
||||
|
||||
private static void RandomizeTrainerPrizeItem(trdata6 t)
|
||||
{
|
||||
if (rGift && rnd32() % 100 < rGiftPercent)
|
||||
if (rGift && Rand() % 100 < rGiftPercent)
|
||||
{
|
||||
ushort[] items;
|
||||
uint rnd = rnd32() % 10;
|
||||
uint rnd = Rand() % 10;
|
||||
if (rnd < 2) // held item
|
||||
items = Main.Config.ORAS ? Legal.Pouch_Items_AO : Legal.Pouch_Items_XY;
|
||||
else if (rnd < 5) // medicine
|
||||
items = Main.Config.ORAS ? Legal.Pouch_Medicine_AO : Legal.Pouch_Medicine_XY;
|
||||
else // berry
|
||||
items = Legal.Pouch_Berry_XY;
|
||||
t.Prize = items[rnd32() % items.Length];
|
||||
t.Prize = items[Rand() % items.Length];
|
||||
}
|
||||
else if (rGift)
|
||||
{
|
||||
t.Prize = 0;
|
||||
}
|
||||
}
|
||||
|
||||
private string[] GetTagsORAS()
|
||||
|
|
@ -887,6 +827,7 @@ private string[] GetTagsORAS()
|
|||
}
|
||||
return tags;
|
||||
}
|
||||
|
||||
private string[] GetTagsXY()
|
||||
{
|
||||
string[] tags = Enumerable.Repeat("", trdata.Length).ToArray();
|
||||
|
|
@ -960,6 +901,7 @@ private string[] GetTagsXY()
|
|||
}
|
||||
return tags;
|
||||
}
|
||||
|
||||
private bool ImportantTrainers;
|
||||
public static SpeciesRandomizer rSpeciesRand;
|
||||
|
||||
|
|
@ -978,20 +920,23 @@ private void TagTrainer(string[] trTags, string tag, params int[] ids)
|
|||
}
|
||||
|
||||
private static Dictionary<int, int[]> MegaDictionary;
|
||||
|
||||
private static int[] GetRandomMega(out int species)
|
||||
{
|
||||
int rnd = Util.rand.Next(0, MegaDictionary.Count - 1);
|
||||
species = MegaDictionary.Keys.ElementAt(rnd);
|
||||
return MegaDictionary.Values.ElementAt(rnd);
|
||||
}
|
||||
|
||||
private int GetRandomType(int trainer)
|
||||
{
|
||||
if (rTags[trainer] != "")
|
||||
if (rTags[trainer] != "")
|
||||
return TagTypes[rTags[trainer]];
|
||||
if (!rEnsureMEvo.Contains(trainer))
|
||||
return (int)(rnd32()%types.Length);
|
||||
return mEvoTypes[rnd32() % mEvoTypes.Length];
|
||||
if (!rEnsureMEvo.Contains(trainer))
|
||||
return (int)(Rand()%types.Length);
|
||||
return mEvoTypes[Rand() % mEvoTypes.Length];
|
||||
}
|
||||
|
||||
private int[] GetMegaEvolvableTypes()
|
||||
{
|
||||
List<int> MEvoTypes = new List<int>();
|
||||
|
|
@ -1007,12 +952,12 @@ private int[] GetMegaEvolvableTypes()
|
|||
return MEvoTypes.ToArray();
|
||||
}
|
||||
|
||||
private void formClosing(object sender, FormClosingEventArgs e)
|
||||
private void IsFormClosing(object sender, FormClosingEventArgs e)
|
||||
{
|
||||
writeFile();
|
||||
WriteFile();
|
||||
}
|
||||
|
||||
private void gotoParty(object sender, EventArgs e)
|
||||
private void GotoParty(object sender, EventArgs e)
|
||||
{
|
||||
// When sprite is clicked, jump to that Pokémon.
|
||||
tabControl1.SelectedIndex = 1 + Array.IndexOf(new[]{PB_Team1, PB_Team2, PB_Team3, PB_Team4, PB_Team5, PB_Team6,}, sender as PictureBox);
|
||||
|
|
|
|||
|
|
@ -272,6 +272,7 @@ public RSWE()
|
|||
openQuick(Directory.GetFiles("encdata"));
|
||||
RandSettings.GetFormSettings(this, GB_Tweak.Controls);
|
||||
}
|
||||
|
||||
private readonly ComboBox[] spec;
|
||||
private readonly NumericUpDown[] min;
|
||||
private readonly NumericUpDown[] max;
|
||||
|
|
@ -305,6 +306,7 @@ private void RSWE_Load()
|
|||
//Preload Tabs
|
||||
PreloadTabs();
|
||||
}
|
||||
|
||||
internal static uint rnd32() => Util.rnd32();
|
||||
|
||||
private void openQuick(string[] encdata)
|
||||
|
|
@ -322,8 +324,8 @@ private void openQuick(string[] encdata)
|
|||
string name = Path.GetFileNameWithoutExtension(filepaths[f]);
|
||||
|
||||
int LocationNum = Convert.ToInt16(name.Substring(4, name.Length - 4));
|
||||
int indNum = LocationNum * 56 + 0x1C;
|
||||
string LocationName = metRS_00000[zonedata[indNum] + 0x100 * (zonedata[indNum + 1] & 1)];
|
||||
int indNum = (LocationNum * 56) + 0x1C;
|
||||
string LocationName = metRS_00000[zonedata[indNum] + (0x100 * (zonedata[indNum + 1] & 1))];
|
||||
LocationNames[f] = LocationNum.ToString("000") + " - " + LocationName;
|
||||
}
|
||||
CB_LocationID.DataSource = LocationNames;
|
||||
|
|
@ -359,7 +361,7 @@ private void parse(byte[] ed)
|
|||
for (int i = 0; i < max.Length; i++)
|
||||
{
|
||||
// Fetch Data
|
||||
Array.Copy(ed, offset + i * 4, slot, 0, 4);
|
||||
Array.Copy(ed, offset + (i * 4), slot, 0, 4);
|
||||
int[] data = pslot(slot);
|
||||
|
||||
// Load Data
|
||||
|
|
@ -379,6 +381,7 @@ private void parse(byte[] ed)
|
|||
File.WriteAllBytes(Path.Combine("encounter_ao", loc.ToString("000") + CB_LocationID.SelectedIndex.ToString("000") + ".bin"), edata);
|
||||
#endif
|
||||
}
|
||||
|
||||
private int[] pslot(byte[] slot) // Parse Slot to Bytes
|
||||
{
|
||||
int index = BitConverter.ToUInt16(slot, 0) & 0x7FF;
|
||||
|
|
@ -392,6 +395,7 @@ private void parse(byte[] ed)
|
|||
data[3] = hi;
|
||||
return data;
|
||||
}
|
||||
|
||||
private string parseslot(byte[] slot)
|
||||
{
|
||||
int index = BitConverter.ToUInt16(slot, 0) & 0x7FF;
|
||||
|
|
@ -403,6 +407,7 @@ private string parseslot(byte[] slot)
|
|||
if (form > 0) species += "-" + form;
|
||||
return species + ',' + min + ',' + max + ',';
|
||||
}
|
||||
|
||||
private byte[] MakeSlotData(int species, int f, int lo, int hi)
|
||||
{
|
||||
byte[] data = new byte[4];
|
||||
|
|
@ -411,6 +416,7 @@ private byte[] MakeSlotData(int species, int f, int lo, int hi)
|
|||
data[3] = (byte)hi;
|
||||
return data;
|
||||
}
|
||||
|
||||
private byte[] ConcatArrays(byte[] b1, byte[] b2)
|
||||
{
|
||||
byte[] concat = new byte[b1.Length + b2.Length];
|
||||
|
|
@ -464,12 +470,14 @@ private bool hasData()
|
|||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
private void PreloadTabs()
|
||||
{
|
||||
for (int i = 0; i < TabControl_EncounterData.TabPages.Count; i++)
|
||||
TabControl_EncounterData.TabPages[i].Show();
|
||||
TabControl_EncounterData.TabPages[0].Show();
|
||||
}
|
||||
|
||||
private void ClearData()
|
||||
{
|
||||
for (int i = 0; i < max.Length; i++)
|
||||
|
|
@ -481,6 +489,7 @@ private void ClearData()
|
|||
max[i].Value = 0;
|
||||
}
|
||||
}
|
||||
|
||||
private byte[] MakeEncounterData()
|
||||
{
|
||||
byte[] ed = new byte[0x102];
|
||||
|
|
@ -488,10 +497,11 @@ private byte[] MakeEncounterData()
|
|||
for (int i = 0; i < max.Length; i++)
|
||||
{
|
||||
byte[] data = MakeSlotData(spec[i].SelectedIndex, (int)form[i].Value, (int)min[i].Value, (int)max[i].Value);
|
||||
Array.Copy(data, 0, ed, offset + i * 4, 4);
|
||||
Array.Copy(data, 0, ed, offset + (i * 4), 4);
|
||||
}
|
||||
return ed;
|
||||
}
|
||||
|
||||
private string GetEncDataString()
|
||||
{
|
||||
string toret = "======" + Environment.NewLine;
|
||||
|
|
@ -544,6 +554,7 @@ private void B_Dump_Click(object sender, EventArgs e)
|
|||
string path = savetxt.FileName;
|
||||
File.WriteAllText(path, toret);
|
||||
}
|
||||
|
||||
private void B_Save_Click(object sender, EventArgs e)
|
||||
{
|
||||
int f = CB_LocationID.SelectedIndex;
|
||||
|
|
@ -640,7 +651,7 @@ private void B_Randomize_Click(object sender, EventArgs e)
|
|||
|
||||
// At most 18, but don't chew if there's only a few slots.
|
||||
int cons = list.Count(a => a != 0);
|
||||
int[] RandomList = new int[cons > 18 ? 18 - cons / 8 : cons];
|
||||
int[] RandomList = new int[cons > 18 ? 18 - (cons / 8) : cons];
|
||||
|
||||
// Fill Location List
|
||||
for (int s = 0; s < RandomList.Length; s++)
|
||||
|
|
@ -666,7 +677,7 @@ private void B_Randomize_Click(object sender, EventArgs e)
|
|||
if (CHK_HomogeneousHordes.Checked)
|
||||
for (int slot = max.Length - 15; slot < max.Length; slot++)
|
||||
{
|
||||
list[slot] = list[slot - hordeslot % 5];
|
||||
list[slot] = list[slot - (hordeslot % 5)];
|
||||
hordeslot++;
|
||||
}
|
||||
|
||||
|
|
@ -683,6 +694,7 @@ private void B_Randomize_Click(object sender, EventArgs e)
|
|||
Enabled = true;
|
||||
WinFormsUtil.Alert("Randomized all Wild Encounters according to specification!", "Press the Dump Tables button to view the new Wild Encounter information!");
|
||||
}
|
||||
|
||||
private int countUnique(int[] list)
|
||||
{
|
||||
int used = 0;
|
||||
|
|
@ -697,6 +709,7 @@ private int countUnique(int[] list)
|
|||
used += list.Skip(46).Take(15).Distinct().Count(a => a != 0);
|
||||
return used;
|
||||
}
|
||||
|
||||
private void setRandomForm(int slot, int species)
|
||||
{
|
||||
if (CHK_MegaForm.Checked && Main.SpeciesStat[species].FormeCount > 1 && Legal.Mega_ORAS.Contains((ushort)species))
|
||||
|
|
@ -724,6 +737,7 @@ private void setRandomForm(int slot, int species)
|
|||
else
|
||||
form[slot].Value = 0;
|
||||
}
|
||||
|
||||
private void ShuffleSlots(ref int[] list, int slC)
|
||||
{
|
||||
int[] input = (int[])list.Clone();
|
||||
|
|
@ -772,6 +786,7 @@ private void ShuffleSlots(ref int[] list, int slC)
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void swap(ref int a1, ref int a2)
|
||||
{
|
||||
var s1 = a1; var s2 = a2;
|
||||
|
|
|
|||
|
|
@ -43,30 +43,35 @@ public StarterEditor6()
|
|||
};
|
||||
Labels = new[] { L_Set1, L_Set2, L_Set3, L_Set4 };
|
||||
|
||||
Width = Main.Config.ORAS ? Width : Width/2 + 2;
|
||||
Width = Main.Config.ORAS ? Width : (Width / 2) + 2;
|
||||
loadData();
|
||||
RandSettings.GetFormSettings(this, groupBox1.Controls);
|
||||
}
|
||||
|
||||
private readonly string CROPath = Path.Combine(Main.RomFSPath, "DllPoke3Select.cro");
|
||||
private readonly string FieldPath = Path.Combine(Main.RomFSPath, "DllField.cro");
|
||||
private readonly string[] specieslist = Main.Config.getText(TextName.SpeciesNames);
|
||||
private readonly ComboBox[][] Choices;
|
||||
private readonly PictureBox[][] Previews;
|
||||
private readonly Label[] Labels;
|
||||
|
||||
private readonly string[] StarterSummary = Main.Config.ORAS
|
||||
? new[] { "Gen 3 Starters", "Gen 2 Starters", "Gen 4 Starters", "Gen 5 Starters" }
|
||||
: new[] { "Gen 6 Starters", "Gen 1 Starters" };
|
||||
|
||||
private byte[] Data;
|
||||
private byte[] FieldData;
|
||||
private readonly int Count = Main.Config.ORAS ? 4 : 2;
|
||||
private int offset;
|
||||
private static int[] BasicStarter;
|
||||
|
||||
private void B_Save_Click(object sender, EventArgs e)
|
||||
{
|
||||
saveData();
|
||||
RandSettings.SetFormSettings(this, groupBox1.Controls);
|
||||
Close();
|
||||
}
|
||||
|
||||
private void B_Cancel_Click(object sender, EventArgs e)
|
||||
{
|
||||
Close();
|
||||
|
|
@ -88,18 +93,19 @@ private void loadData()
|
|||
{
|
||||
foreach (string s in specieslist)
|
||||
Choices[i][j].Items.Add(s);
|
||||
int species = BitConverter.ToUInt16(Data, offset + (i*3 + j)*0x54);
|
||||
int species = BitConverter.ToUInt16(Data, offset + (((i * 3) + j)*0x54));
|
||||
Choices[i][j].SelectedIndex = species; // changing index prompts loading of sprite
|
||||
|
||||
Choices[i][j].Visible = Previews[i][j].Visible = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void saveData()
|
||||
{
|
||||
for (int i = 0; i < Count; i++)
|
||||
for (int j = 0; j < 3; j++)
|
||||
Array.Copy(BitConverter.GetBytes((ushort)Choices[i][j].SelectedIndex), 0, Data, offset + (i*3 + j)*0x54, 2);
|
||||
Array.Copy(BitConverter.GetBytes((ushort)Choices[i][j].SelectedIndex), 0, Data, offset + (((i * 3) + j)*0x54), 2);
|
||||
|
||||
// Set the choices back
|
||||
int fieldOffset = Main.Config.ORAS ? 0xF906C : 0xF805C;
|
||||
|
|
@ -120,7 +126,7 @@ private void saveData()
|
|||
|
||||
for (int i = 0; i < Count; i++)
|
||||
for (int j = 0; j < 3; j++)
|
||||
Array.Copy(BitConverter.GetBytes((ushort)Choices[i][j].SelectedIndex), 0, FieldData, fieldOffset + entries[i*3 + j]*fieldSize, 2);
|
||||
Array.Copy(BitConverter.GetBytes((ushort)Choices[i][j].SelectedIndex), 0, FieldData, fieldOffset + (entries[(i * 3) + j]*fieldSize), 2);
|
||||
|
||||
File.WriteAllBytes(CROPath, Data); // poke3
|
||||
File.WriteAllBytes(FieldPath, FieldData); // field
|
||||
|
|
@ -168,7 +174,7 @@ private void B_Randomize_Click(object sender, EventArgs e)
|
|||
// Assign Species
|
||||
for (int j = 0; j < 3; j++)
|
||||
{
|
||||
int oldSpecies = BitConverter.ToUInt16(Data, offset + (i * 3 + j) * 0x54);
|
||||
int oldSpecies = BitConverter.ToUInt16(Data, offset + (((i * 3) + j) * 0x54));
|
||||
if (CHK_BasicStarter.Checked)
|
||||
{
|
||||
int basic() => (int)(Util.rnd32() % BasicStarter.Length);
|
||||
|
|
|
|||
|
|
@ -111,7 +111,7 @@ private void InitializeComponent()
|
|||
this.LB_Encounters.Name = "LB_Encounters";
|
||||
this.LB_Encounters.Size = new System.Drawing.Size(110, 342);
|
||||
this.LB_Encounters.TabIndex = 468;
|
||||
this.LB_Encounters.SelectedIndexChanged += new System.EventHandler(this.changeIndex);
|
||||
this.LB_Encounters.SelectedIndexChanged += new System.EventHandler(this.ChangeIndex);
|
||||
//
|
||||
// B_RandAll
|
||||
//
|
||||
|
|
@ -219,7 +219,7 @@ private void InitializeComponent()
|
|||
this.CB_Species.Name = "CB_Species";
|
||||
this.CB_Species.Size = new System.Drawing.Size(136, 21);
|
||||
this.CB_Species.TabIndex = 506;
|
||||
this.CB_Species.SelectedIndexChanged += new System.EventHandler(this.changeSpecies);
|
||||
this.CB_Species.SelectedIndexChanged += new System.EventHandler(this.ChangeSpecies);
|
||||
//
|
||||
// L_Species
|
||||
//
|
||||
|
|
|
|||
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user