Add working changes
This commit is contained in:
parent
23563b168f
commit
84c3d68db2
20 changed files with 7882 additions and 89 deletions
|
@ -166,14 +166,14 @@ public virtual void Write()
|
|||
// Set House TownID & Name
|
||||
if (Owner != null)
|
||||
{
|
||||
if (offsets.OwningPlayerName != -1 && offsets.TownId != -1)
|
||||
if (offsets.OwningPlayerName != -1 && offsets.TownId != -1 && Data.TownId == 0)
|
||||
{
|
||||
Data.TownId =
|
||||
saveData.ReadUInt16(saveData.SaveDataStartOffset + Save.SaveInstance.SaveInfo.SaveOffsets.TownId,
|
||||
saveData.IsBigEndian); // Might not be UInt16 in all games
|
||||
}
|
||||
|
||||
if (offsets.OwningPlayerName != -1 && offsets.TownName != -1)
|
||||
if (offsets.OwningPlayerName != -1 && offsets.TownName != -1 && Data.TownName == string.Empty)
|
||||
{
|
||||
Data.TownName = saveData.ReadString(
|
||||
saveData.SaveDataStartOffset + Save.SaveInstance.SaveInfo.SaveOffsets.TownName,
|
||||
|
|
|
@ -24,6 +24,12 @@ public Player(int index)
|
|||
{
|
||||
Index = index;
|
||||
}
|
||||
public Player(int index, SaveType type, int offset)
|
||||
{
|
||||
Index = index;
|
||||
Offset = offset;
|
||||
Offsets = PlayerInfo.GetPlayerInfo(type);
|
||||
}
|
||||
|
||||
public Player(int offset, int idx)
|
||||
{
|
||||
|
|
636
ACSE.Core/Saves/GCIFile.cs
Normal file
636
ACSE.Core/Saves/GCIFile.cs
Normal file
|
@ -0,0 +1,636 @@
|
|||
using ACSE.Core.Utilities;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
|
||||
namespace ACSE.Core.Saves
|
||||
{
|
||||
public class GCIFile
|
||||
{
|
||||
public string SystemID; // 1
|
||||
public string TitleID; // 2
|
||||
public RegionalFlag RegionCode; // 1
|
||||
public string VendorID; // 2
|
||||
public ImageKey imageKey; // 1
|
||||
public string FileName; // 32
|
||||
|
||||
public int LastModified; // 4
|
||||
public int ImageOffset; // 4
|
||||
public byte[] IconFormat; // 2
|
||||
public byte[] AnimationRate; // 2
|
||||
public Permissions Perms; // 1
|
||||
public byte CopyCount; // 1
|
||||
public short BlockIndex; // 2
|
||||
public short FileSize; // 2
|
||||
|
||||
public int DescriptionOffset; // 4
|
||||
|
||||
public string Description;
|
||||
public Banner BannerImage; // CI8 or RGB5A3
|
||||
public Icon icon;
|
||||
|
||||
public byte[] SaveData;
|
||||
|
||||
private byte[] buffer; // Remainder
|
||||
|
||||
|
||||
public const int HEADER_LENGTH = 64;
|
||||
|
||||
|
||||
public static GCIFile read(string filename)
|
||||
{
|
||||
GCIFile file = new GCIFile();
|
||||
|
||||
using(FileStream fs = File.OpenRead(filename))
|
||||
{
|
||||
using(BinaryReader br = new BinaryReader(fs))
|
||||
{
|
||||
file.SystemID = new string(br.ReadChars(1));
|
||||
file.TitleID = new string(br.ReadChars(2));
|
||||
file.RegionCode = (RegionalFlag)br.ReadChar();
|
||||
file.VendorID = new string(br.ReadChars(2));
|
||||
br.ReadByte(); // Skip Byte because it is reserved, and does nothing that we know of
|
||||
file.imageKey = (ImageKey)br.ReadByte();
|
||||
file.FileName = new string(br.ReadChars(32));
|
||||
file.LastModified = br.ReadInt32();
|
||||
file.ImageOffset = br.ReadInt32();
|
||||
file.IconFormat = br.ReadBytes(2);
|
||||
file.AnimationRate = br.ReadBytes(2);
|
||||
file.Perms = (Permissions)br.ReadByte();
|
||||
file.CopyCount = br.ReadByte();
|
||||
file.BlockIndex = br.ReadInt16();
|
||||
file.FileSize = br.ReadInt16();
|
||||
br.ReadBytes(2);
|
||||
file.DescriptionOffset = br.ReadInt32();
|
||||
|
||||
file.buffer = br.ReadBytes((int)(fs.Length - fs.Position));
|
||||
}
|
||||
}
|
||||
|
||||
file.Description = Encoding.ASCII.GetString(file.buffer.Skip(file.DescriptionOffset).Take(64).ToArray());
|
||||
|
||||
int position = file.ImageOffset;
|
||||
if(!file.imageKey.isRGB5A3())
|
||||
{
|
||||
throw new Exception("CI8 file format is not supported");
|
||||
}
|
||||
if(file.imageKey.hasBanner())
|
||||
{
|
||||
if(file.imageKey.isRGB5A3())
|
||||
file.BannerImage = Banner.ReadRGB5A3(file.buffer.Skip(file.ImageOffset).ToArray(), ref position);
|
||||
File.WriteAllBytes(filename + ".bnr", file.BannerImage.Serialize());
|
||||
}
|
||||
file.icon = new Icon(file.IconFormat);
|
||||
file.icon.Deserialize(file.buffer.Skip(position).ToArray(), ref position);
|
||||
File.WriteAllBytes(filename + ".gcico", file.icon.Serialize());
|
||||
|
||||
file.SaveData = file.buffer.Skip(position).ToArray();
|
||||
|
||||
|
||||
|
||||
return file;
|
||||
}
|
||||
|
||||
public string GetCommonGameID()
|
||||
{
|
||||
return $"{SystemID}{TitleID}{RegionCode}";
|
||||
}
|
||||
private GCIFile()
|
||||
{
|
||||
|
||||
}
|
||||
/// <summary>
|
||||
/// Generates a fresh GCIFile
|
||||
/// </summary>
|
||||
public GCIFile(string SysID, string TID, RegionalFlag region)
|
||||
{
|
||||
SystemID = SysID;
|
||||
TitleID = TID;
|
||||
RegionCode = region;
|
||||
|
||||
VendorID = "CF";
|
||||
|
||||
imageKey = ImageKey.ContinuousNoBannerRGB5A3;
|
||||
LastModified = 0;
|
||||
ImageOffset = 65;
|
||||
Perms = Permissions.FullPrivate;
|
||||
CopyCount = 0;
|
||||
BlockIndex = 0;
|
||||
FileSize = 0x10;
|
||||
|
||||
Description = "A generated save data file";
|
||||
icon = Icon.Random(1);
|
||||
IconFormat = icon.GetBitMask();
|
||||
|
||||
AnimationRate = new byte[2];
|
||||
|
||||
|
||||
DescriptionOffset = 0;
|
||||
|
||||
}
|
||||
|
||||
public GCIFile(string GameCode) :
|
||||
this(GameCode.Substring(0, 1), GameCode.Substring(1, 2), (RegionalFlag)GameCode.Substring(3, 1).ToCharArray()[0])
|
||||
{
|
||||
}
|
||||
|
||||
public void write(string filename)
|
||||
{
|
||||
using (UtilityWriter writer = new UtilityWriter(filename))
|
||||
{
|
||||
writer.Write(Encoding.ASCII.GetBytes(SystemID));
|
||||
writer.Write(Encoding.ASCII.GetBytes(TitleID));
|
||||
writer.Write((char)RegionCode);
|
||||
writer.Write(Encoding.ASCII.GetBytes(VendorID));
|
||||
writer.Write((byte)imageKey);
|
||||
FileName = filename;
|
||||
writer.Write(Encoding.ASCII.GetBytes(Path.GetFileNameWithoutExtension(FileName)));
|
||||
writer.Write(LastModified);
|
||||
writer.Write(ImageOffset);
|
||||
writer.Write(IconFormat);
|
||||
writer.Write(AnimationRate);
|
||||
writer.Write((byte)Perms);
|
||||
writer.Write(CopyCount);
|
||||
writer.Write(BlockIndex);
|
||||
writer.Write(FileSize);
|
||||
writer.Write(DescriptionOffset);
|
||||
|
||||
writer.Seek(HEADER_LENGTH + DescriptionOffset, SeekOrigin.Begin);
|
||||
byte[] desc = Encoding.ASCII.GetBytes(Description.Trim());
|
||||
writer.Write(desc);
|
||||
writer.Write(0x00); // NUL terminator.
|
||||
// Write zeros for the remaining bytes.
|
||||
int desclen = desc.Length + 1;
|
||||
int diff = 64 - desclen;
|
||||
writer.Write(new byte[diff]);
|
||||
|
||||
writer.Seek(HEADER_LENGTH + ImageOffset, SeekOrigin.Begin);
|
||||
|
||||
if (imageKey.hasBanner())
|
||||
writer.Write(BannerImage.Serialize());
|
||||
|
||||
writer.Write(icon.Serialize());
|
||||
writer.Write(SaveData);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
public enum RegionalFlag
|
||||
{
|
||||
Japan = 'J',
|
||||
USA = 'E',
|
||||
Europe = 'P',
|
||||
Australia = 'U'
|
||||
}
|
||||
|
||||
|
||||
public enum Permissions : byte
|
||||
{
|
||||
FullPrivate = 0x00,
|
||||
FullPublic = 0x04,
|
||||
MoveOnlyPrivate = 0x08,
|
||||
MoveOnlyPublic = 0x0C,
|
||||
CopyPrivate = 0x10,
|
||||
CopyPublic = 0x14,
|
||||
Private = 0x18,
|
||||
Public = 0x1C
|
||||
}
|
||||
|
||||
public enum ImageKey : byte
|
||||
{
|
||||
ContinuousNoBannerRGB5A3 = 0x00,
|
||||
ContinuousBannerCI8 = 0x01,
|
||||
ContinuousBannerRGB5A3 = 0x02,
|
||||
ContinuousNoBannerCI8 = 0x03,
|
||||
AlternatingNoBannerRGB5A3 = 0x04,
|
||||
AlternatingBannerCI8 = 0x05,
|
||||
AlternatingBannerRGB5A3 = 0x06,
|
||||
AlternatingNoBannerCI8 = 0x07
|
||||
}
|
||||
|
||||
|
||||
public static class ImageKeyExtensions
|
||||
{
|
||||
public static bool hasBanner(this ImageKey key)
|
||||
{
|
||||
if (key == ImageKey.ContinuousBannerCI8 || key == ImageKey.ContinuousBannerRGB5A3 || key == ImageKey.AlternatingBannerCI8 || key == ImageKey.AlternatingBannerRGB5A3)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
else return false;
|
||||
}
|
||||
|
||||
public static bool isRGB5A3(this ImageKey key)
|
||||
{
|
||||
if(key == ImageKey.ContinuousNoBannerRGB5A3 || key == ImageKey.ContinuousBannerRGB5A3 || key == ImageKey.AlternatingNoBannerRGB5A3 || key == ImageKey.AlternatingBannerRGB5A3 )
|
||||
{
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public static byte IndexOf(this GColor[] map, GColor entry)
|
||||
{
|
||||
byte idx = 0;
|
||||
foreach(GColor C in map)
|
||||
{
|
||||
if (C.Equals(entry)) return idx;
|
||||
|
||||
idx++;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
public class GColor
|
||||
{
|
||||
public bool IsTranslucent { get; set; } = false;
|
||||
public byte TransparencyLevel { get; set; } = 0;
|
||||
public byte Red { get; set; }
|
||||
public byte Green { get; set; }
|
||||
public byte Blue { get; set; }
|
||||
|
||||
public GColor(bool isTranslucent, byte transparencyLevel, byte red, byte green, byte blue)
|
||||
{
|
||||
IsTranslucent = isTranslucent;
|
||||
TransparencyLevel = transparencyLevel;
|
||||
Red = red;
|
||||
Green = green;
|
||||
Blue = blue;
|
||||
}
|
||||
|
||||
public void SetColor(float alpha, byte red, byte green, byte blue)
|
||||
{
|
||||
IsTranslucent = alpha < 1.0f;
|
||||
TransparencyLevel = IsTranslucent ? (byte)(alpha * 7) : (byte)0;
|
||||
Red = red;
|
||||
Green = green;
|
||||
Blue = blue;
|
||||
}
|
||||
|
||||
public ushort Serialize()
|
||||
{
|
||||
ushort colorValue = (ushort)(
|
||||
(IsTranslucent ? 0x8000 : 0) |
|
||||
(IsTranslucent ? (TransparencyLevel << 11) : 0) |
|
||||
(Red << 6) |
|
||||
(Green << 1) |
|
||||
(Blue >> 4)
|
||||
);
|
||||
|
||||
return colorValue;
|
||||
}
|
||||
|
||||
public static GColor Deserialize(ushort value)
|
||||
{
|
||||
bool isTranslucent = (value & 0x8000) != 0;
|
||||
byte transparencyLevel = (byte)((isTranslucent) ? ((value >> 11) & 0x07) : 0);
|
||||
byte red = (byte)((value >> 6) & 0x1F);
|
||||
byte green = (byte)((value >> 1) & 0x1F);
|
||||
byte blue = (byte)(((value & 0x01) << 4) | ((value >> 5) & 0x0F));
|
||||
|
||||
return new GColor(isTranslucent, transparencyLevel, red, green, blue);
|
||||
}
|
||||
|
||||
public byte[] SerializeToBytes()
|
||||
{
|
||||
ushort colorValue = Serialize();
|
||||
byte[] bytes = BitConverter.GetBytes(colorValue);
|
||||
if (BitConverter.IsLittleEndian)
|
||||
Array.Reverse(bytes);
|
||||
return bytes;
|
||||
}
|
||||
|
||||
public static GColor DeserializeFromBytes(byte[] bytes)
|
||||
{
|
||||
if (bytes.Length != 2)
|
||||
throw new ArgumentException("Input byte array must be exactly 2 bytes.");
|
||||
|
||||
if (BitConverter.IsLittleEndian)
|
||||
Array.Reverse(bytes);
|
||||
|
||||
return Deserialize( BitConverter.ToUInt16(bytes, 0) );
|
||||
}
|
||||
|
||||
public static GColor Random(bool randomAlpha=false)
|
||||
{
|
||||
GColor c = new GColor(false, 0, 0, 0, 0);
|
||||
Random rng = new Random(0xFF);
|
||||
if(randomAlpha)
|
||||
{
|
||||
c.IsTranslucent = rng.Next(3) > 1 ? true : false;
|
||||
if(c.IsTranslucent)
|
||||
{
|
||||
c.TransparencyLevel = (byte)rng.Next(255);
|
||||
}
|
||||
}
|
||||
|
||||
c.Red = (byte)rng.Next(255);
|
||||
c.Green = (byte)rng.Next(255);
|
||||
c.Blue = (byte)rng.Next(255);
|
||||
|
||||
return c;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
public abstract class GImage
|
||||
{
|
||||
public abstract byte[] Serialize();
|
||||
public abstract void Deserialize(byte[] bytes, ref int position);
|
||||
}
|
||||
|
||||
// REFERENCE: https://web.archive.org/web/20080823102548/http://members.iinet.net.au/~theimp/gci/GameCube%20GCI%20&%20GCP%20Memory%20Card%20Save%20File%20Format%20Specifications.pdf
|
||||
|
||||
|
||||
|
||||
public enum ColorChannel
|
||||
{
|
||||
Red = 0,
|
||||
Green = 1,
|
||||
Blue = 2
|
||||
}
|
||||
|
||||
public class RGBTile : ITile
|
||||
{
|
||||
public GColor[,] Pixels { get; set; }
|
||||
|
||||
public RGBTile()
|
||||
{
|
||||
Pixels = new GColor[4, 4];
|
||||
}
|
||||
|
||||
public byte[] Serialize()
|
||||
{
|
||||
byte[] serializedBytes = new byte[32]; // 4x4 pixels * 2 bytes each = 32 bytes
|
||||
|
||||
for (int row = 0; row < 4; row++)
|
||||
{
|
||||
for (int col = 0; col < 4; col++)
|
||||
{
|
||||
byte[] pixelBytes = Pixels[row, col].SerializeToBytes();
|
||||
Buffer.BlockCopy(pixelBytes, 0, serializedBytes, row * 16 + col * 2, 2);
|
||||
}
|
||||
}
|
||||
|
||||
return serializedBytes;
|
||||
}
|
||||
|
||||
public void Deserialize(byte[] bytes, ref int position)
|
||||
{
|
||||
if (bytes.Length != 32)
|
||||
throw new ArgumentException("Input byte array must be exactly 32 bytes.");
|
||||
|
||||
RGBTile tile = new RGBTile();
|
||||
|
||||
for (int row = 0; row < 4; row++)
|
||||
{
|
||||
for (int col = 0; col < 4; col++)
|
||||
{
|
||||
byte[] pixelBytes = new byte[2];
|
||||
Buffer.BlockCopy(bytes, row * 16 + col * 2, pixelBytes, 0, 2);
|
||||
tile.Pixels[row,col] = GColor.DeserializeFromBytes(pixelBytes);
|
||||
|
||||
position += 2;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
public interface ITile
|
||||
{
|
||||
public byte[] Serialize();
|
||||
public void Deserialize(byte[] bytes, ref int position);
|
||||
}
|
||||
public class Banner : GImage
|
||||
{
|
||||
public ITile[,] Tiles { get; set; }
|
||||
|
||||
public Banner(int rows, int columns, ITileFactory tileFactory)
|
||||
{
|
||||
Tiles = new ITile[rows, columns];
|
||||
|
||||
for (int row = 0; row < rows; row++)
|
||||
{
|
||||
for (int col = 0; col < columns; col++)
|
||||
{
|
||||
Tiles[row, col] = tileFactory.CreateTile();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static Banner ReadRGB5A3(byte[] bytes, ref int position)
|
||||
{
|
||||
var bnr = new Banner(24, 8, new RGBTileFactory());
|
||||
bnr.Deserialize(bytes, ref position);
|
||||
return bnr;
|
||||
}
|
||||
|
||||
public override byte[] Serialize()
|
||||
{
|
||||
List<byte> serializedBytes = new List<byte>();
|
||||
|
||||
foreach (var tile in Tiles)
|
||||
{
|
||||
serializedBytes.AddRange(tile.Serialize());
|
||||
}
|
||||
|
||||
return serializedBytes.ToArray();
|
||||
}
|
||||
|
||||
public override void Deserialize(byte[] bytes, ref int position)
|
||||
{
|
||||
int tileByteSize = BytesPerTile(); // Calculate the size of each tile in bytes
|
||||
int currentIndex = 0;
|
||||
|
||||
foreach (var tile in Tiles)
|
||||
{
|
||||
byte[] tileBytes = new byte[tileByteSize];
|
||||
Array.Copy(bytes, currentIndex, tileBytes, 0, tileByteSize);
|
||||
tile.Deserialize(tileBytes, ref position);
|
||||
|
||||
currentIndex += tileByteSize;
|
||||
}
|
||||
}
|
||||
|
||||
private int BytesPerTile()
|
||||
{
|
||||
// Calculate the size of a single tile in bytes based on the implementation of Serialize()
|
||||
ITile sampleTile = Tiles[0, 0];
|
||||
byte[] sampleBytes = sampleTile.Serialize();
|
||||
return sampleBytes.Length;
|
||||
}
|
||||
}
|
||||
public interface ITileFactory
|
||||
{
|
||||
ITile CreateTile();
|
||||
}
|
||||
|
||||
public class RGBTileFactory : ITileFactory
|
||||
{
|
||||
public ITile CreateTile()
|
||||
{
|
||||
return new RGBTile();
|
||||
}
|
||||
}
|
||||
|
||||
public class IconFrame : GImage
|
||||
{
|
||||
public GColor[,] Pixels { get; set; }
|
||||
|
||||
public bool IsRGB5A3
|
||||
{
|
||||
get; // Hardcoded for now. Will be possible to set this and change to CI8 in the future
|
||||
} = true;
|
||||
public IconFrame()
|
||||
{
|
||||
Pixels = new GColor[32, 32];
|
||||
}
|
||||
|
||||
public override byte[] Serialize()
|
||||
{
|
||||
List<byte> serializedBytes = new List<byte>();
|
||||
|
||||
for (int row = 0; row < 32; row++)
|
||||
{
|
||||
for (int col = 0; col < 32; col++)
|
||||
{
|
||||
serializedBytes.AddRange(Pixels[row, col].SerializeToBytes());
|
||||
}
|
||||
}
|
||||
|
||||
return serializedBytes.ToArray();
|
||||
}
|
||||
|
||||
public override void Deserialize(byte[] bytes, ref int position)
|
||||
{
|
||||
int currentIndex = 0;
|
||||
|
||||
for (int row = 0; row < 32; row++)
|
||||
{
|
||||
for (int col = 0; col < 32; col++)
|
||||
{
|
||||
byte b1 = bytes[currentIndex++];
|
||||
byte b2 = bytes[currentIndex++];
|
||||
Pixels[row, col] = GColor.DeserializeFromBytes(new byte[] { b1, b2 });
|
||||
|
||||
position += 2;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static IconFrame Random()
|
||||
{
|
||||
IconFrame frame = new IconFrame();
|
||||
for(int row=0;row<32;row++)
|
||||
{
|
||||
for(int col=0; col<32; col++)
|
||||
{
|
||||
frame.Pixels[row, col] = GColor.Random();
|
||||
}
|
||||
}
|
||||
|
||||
return frame;
|
||||
}
|
||||
}
|
||||
|
||||
public class Icon
|
||||
{
|
||||
public IconFrame[] Frames { get; set; } = new IconFrame[8];
|
||||
|
||||
int cur_frames = 0;
|
||||
short format; // Two bytes. Each frame takes 2 bit pairs. If a bit pair is set to 00b, then it indicates that there is no frame (such as situations where there is less than eight frames). Any other value controls the color format for the frame - 01b is for CI8 with a shared color palette after the last frame, 10b is for RGB5A3, and 11b is for CI8 with a unique color palette after itself.It is perfectly possible to mix frame color formats.
|
||||
|
||||
// We are not implementing CI8 currently!
|
||||
|
||||
public Icon(byte[] iconFormat)
|
||||
{
|
||||
format = BitConverter.ToInt16(iconFormat,0);
|
||||
}
|
||||
|
||||
public byte[] Serialize()
|
||||
{
|
||||
List<byte> serializedBytes = new List<byte>();
|
||||
|
||||
foreach (var frame in Frames)
|
||||
{
|
||||
if(frame!=null)
|
||||
serializedBytes.AddRange(frame.Serialize());
|
||||
}
|
||||
|
||||
return serializedBytes.ToArray();
|
||||
}
|
||||
|
||||
public void Deserialize(byte[] bytes, ref int position)
|
||||
{
|
||||
int frameByteSize = BytesPerFrame(); // Calculate the size of each frame in bytes
|
||||
int currentIndex = 0;
|
||||
|
||||
while (currentIndex < bytes.Length && cur_frames < 8)
|
||||
{
|
||||
// Check if the current bit pair is not 00b, indicating a valid frame format
|
||||
if (((format >> (cur_frames * 2)) & 0x3) != 0)
|
||||
{
|
||||
IconFrame frame = new IconFrame();
|
||||
byte[] frameBytes = new byte[frameByteSize];
|
||||
Array.Copy(bytes, currentIndex, frameBytes, 0, frameByteSize);
|
||||
|
||||
frame.Deserialize(frameBytes, ref position);
|
||||
Frames[cur_frames] = frame;
|
||||
}
|
||||
|
||||
currentIndex += frameByteSize;
|
||||
cur_frames++;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private int BytesPerFrame()
|
||||
{
|
||||
// Calculate the size of a single frame in bytes based on the implementation of Serialize()
|
||||
IconFrame sampleFrame = new IconFrame();
|
||||
byte[] sampleBytes = sampleFrame.Serialize();
|
||||
return sampleBytes.Length;
|
||||
}
|
||||
|
||||
public static Icon Random(int numFrames = 1)
|
||||
{
|
||||
Icon icn = new Icon(new byte[2]);
|
||||
for(int i=0;i < numFrames;i++)
|
||||
icn.Frames[i] = IconFrame.Random();
|
||||
|
||||
return icn;
|
||||
}
|
||||
|
||||
public byte[] GetBitMask()
|
||||
{
|
||||
byte[] ret = new byte[2];
|
||||
short mask = 0;
|
||||
|
||||
for (int i = 0; i < Frames.Length; i++)
|
||||
{
|
||||
if (Frames[i] != null)
|
||||
{
|
||||
if (Frames[i].IsRGB5A3)
|
||||
{
|
||||
mask |= (short)(2 << (i * 2)); // Set the corresponding bit pair for RGB5A3 frames
|
||||
}else
|
||||
{
|
||||
mask |= (short)(1 << (i * 2)); // Set the corresponding bit pair for CI8 frames
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
ret = BitConverter.GetBytes(mask);
|
||||
return ret;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -9,6 +9,8 @@
|
|||
using ACSE.Core.Saves.Checksums;
|
||||
using ACSE.Core.Town.Acres;
|
||||
using ACSE.Core.Utilities;
|
||||
using ACSE.Core.Generators;
|
||||
using System.Threading;
|
||||
|
||||
namespace ACSE.Core.Saves
|
||||
{
|
||||
|
@ -59,7 +61,7 @@ public sealed class Save
|
|||
public readonly SaveType SaveType;
|
||||
public readonly SaveGeneration SaveGeneration;
|
||||
public readonly SaveInfo SaveInfo;
|
||||
public readonly byte[] SaveData;
|
||||
public byte[] SaveData = new byte[0];
|
||||
public readonly int SaveDataStartOffset;
|
||||
public string FullSavePath;
|
||||
public string SavePath;
|
||||
|
@ -149,7 +151,143 @@ public Acre SelectedAcre
|
|||
private readonly BinaryReader _saveReader;
|
||||
private BinaryWriter _saveWriter;
|
||||
private readonly bool _byteswap = false;
|
||||
public bool isNew = false;
|
||||
private GCIFile GameCubeFile { get; set; }
|
||||
|
||||
|
||||
public static Save Initialize(SaveType gen, string code)
|
||||
{
|
||||
Save ret = new Save(gen, code);
|
||||
ret.isNew = true;
|
||||
|
||||
Player X = newPlayer;
|
||||
ret.Write(ret.SaveInfo.SaveOffsets.TownId, X.Data.TownIdentifier);
|
||||
ret.Write(ret.SaveInfo.SaveOffsets.TownName, X.Data.TownName);
|
||||
|
||||
ret.SaveName = "Newtown";
|
||||
|
||||
House updateHouse = newPlayerHouse(X);
|
||||
updateHouse.Write();
|
||||
X.House = updateHouse;
|
||||
|
||||
X.Write();
|
||||
ret._selectedPlayer = X;
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
public static House newPlayerHouse(Player player)
|
||||
{
|
||||
House ret = new House();
|
||||
ret.Owner = player;
|
||||
ret.Offset = SaveInstance.SaveDataStartOffset + SaveInstance.SaveInfo.SaveOffsets.HouseData;
|
||||
|
||||
ret.Data.Bed = new Item();
|
||||
ret.Data.TownId = player.Data.TownIdentifier;
|
||||
ret.Data.TownName = player.Data.TownName;
|
||||
ret.Data.OwningPlayerId = player.Data.Identifier;
|
||||
ret.Data.OwningPlayerName = player.Data.Name;
|
||||
ret.Data.Rooms = new Room[1];
|
||||
ret.Data.Rooms[0] = new Room();
|
||||
ret.Data.Rooms[0].Name = player.Data.Name + "'s room";
|
||||
ret.Data.Rooms[0].Layers = new Layer[1];
|
||||
ret.Data.Rooms[0].Wallpaper = new Item();
|
||||
ret.Data.Rooms[0].Carpet = new Item();
|
||||
ret.Data.Rooms[0].Layers = new Layer[1];
|
||||
ret.Data.Rooms[0].Layers[0] = new Layer();
|
||||
ret.Data.Rooms[0].Layers[0].Parent = ret.Data.Rooms[0];
|
||||
ret.Data.Rooms[0].Layers[0].Items = new Furniture[0];
|
||||
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
public static Player newPlayer
|
||||
{
|
||||
get
|
||||
{
|
||||
|
||||
Player newPlayer = new Player(0, Save.SaveInstance.SaveType, SaveInstance.SaveDataStartOffset + SaveInstance.SaveInfo.SaveOffsets.PlayerStart);
|
||||
newPlayer.Data = new PlayerData();
|
||||
newPlayer.Exists = true;
|
||||
newPlayer.Data.Shirt = new Item(); // Update this later!!!
|
||||
newPlayer.Data.HeldItem = new Item();
|
||||
newPlayer.Data.InventoryBackground = new Item();
|
||||
newPlayer.Data.Pockets = new Inventory(new uint[newPlayer.Offsets.PocketsCount]);
|
||||
newPlayer.Data.Birthday = new AcDate();
|
||||
newPlayer.Data.Bed = new Item();
|
||||
newPlayer.Data.Debt = 20000;
|
||||
newPlayer.Data.Gender = 1;
|
||||
newPlayer.Data.Hat = new Item();
|
||||
newPlayer.Data.NewLeafDebt = new Encryption.NewLeafInt32(20000);
|
||||
newPlayer.Data.Pants = new Item();
|
||||
newPlayer.Data.Shoes = new Item();
|
||||
newPlayer.Data.Socks = new Item();
|
||||
newPlayer.Data.Wetsuit = new Item();
|
||||
|
||||
|
||||
newPlayer.Data.TownIdentifier = Utility.RandomIdentifier();
|
||||
newPlayer.Data.Identifier = Utility.RandomIdentifier();
|
||||
|
||||
newPlayer.Data.Name = "Player1";
|
||||
newPlayer.Data.TownName = "Newtown";
|
||||
|
||||
return newPlayer;
|
||||
}
|
||||
}
|
||||
private Save(SaveType gen, string code)
|
||||
{
|
||||
|
||||
SaveInstance = this;
|
||||
|
||||
SaveGeneration = SaveDataManager.GetSaveGeneration(gen);
|
||||
SaveType = SaveType.AnimalCrossing;
|
||||
switch (gen)
|
||||
{
|
||||
case SaveType.AnimalCrossing:
|
||||
{
|
||||
SaveExtension = ".gci";
|
||||
|
||||
GameCubeFile = new GCIFile(code);
|
||||
GameCubeFile.Perms = Permissions.Private;
|
||||
GameCubeFile.icon = Icon.Random(1);
|
||||
GameCubeFile.Description = "Newtown - Town Data";
|
||||
|
||||
SaveDataStartOffset = 0;
|
||||
break;
|
||||
}
|
||||
case SaveType.WildWorld:
|
||||
{
|
||||
SaveExtension = ".sav";
|
||||
|
||||
break;
|
||||
}
|
||||
case SaveType.CityFolk:
|
||||
{
|
||||
SaveExtension = ".bin";
|
||||
|
||||
break;
|
||||
}
|
||||
case SaveType.NewLeaf:
|
||||
{
|
||||
SaveExtension = ".dat";
|
||||
|
||||
break;
|
||||
}
|
||||
case SaveType.ACSwitch:
|
||||
{
|
||||
SaveExtension = ".bin";
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
SaveInfo = SaveDataManager.GetSaveInfo(SaveType);
|
||||
SaveId = SaveDataManager.GetGameId(SaveType);
|
||||
SaveDataStartOffset = SaveDataManager.GetSaveDataOffset(SaveId.ToLower(), SaveExtension?.Replace(".", "").ToLower());
|
||||
|
||||
|
||||
//SaveData = SaveDataManager.GetEmptyData(this, code);
|
||||
}
|
||||
public Save(string filePath, bool createBackup = false)
|
||||
{
|
||||
if (File.Exists(filePath))
|
||||
|
@ -175,21 +313,38 @@ public Save(string filePath, bool createBackup = false)
|
|||
}
|
||||
return;
|
||||
}
|
||||
|
||||
_saveReader = new BinaryReader(_saveFile);
|
||||
|
||||
SaveData = _saveReader.ReadBytes((int)_saveFile.Length);
|
||||
_byteswap = this.IsByteSwapped();
|
||||
if (_byteswap)
|
||||
{
|
||||
SaveData = SaveDataManager.ByteSwap(SaveData); // Only byteswap the working data.
|
||||
}
|
||||
_saveReader.Close();
|
||||
_saveFile.Close();
|
||||
_saveReader.Dispose();
|
||||
_saveFile.Dispose();
|
||||
|
||||
SaveType = this.GetSaveType();
|
||||
|
||||
|
||||
SaveExtension = Path.GetExtension(filePath);
|
||||
SaveType = SaveDataManager.GetSaveType(this);
|
||||
switch(SaveType)
|
||||
{
|
||||
case SaveType.AnimalCrossing:
|
||||
{
|
||||
|
||||
GameCubeFile = GCIFile.read(filePath);
|
||||
SaveData = GameCubeFile.SaveData;
|
||||
break;
|
||||
}
|
||||
}
|
||||
SaveGeneration = SaveDataManager.GetSaveGeneration(SaveType);
|
||||
FullSavePath = filePath;
|
||||
SaveName = Path.GetFileNameWithoutExtension(filePath);
|
||||
SavePath = Path.GetDirectoryName(filePath) + Path.DirectorySeparatorChar;
|
||||
SaveExtension = Path.GetExtension(filePath);
|
||||
|
||||
SaveId = SaveDataManager.GetGameId(SaveType);
|
||||
SaveDataStartOffset = SaveDataManager.GetSaveDataOffset(SaveId.ToLower(), SaveExtension?.Replace(".", "").ToLower());
|
||||
SaveInfo = SaveDataManager.GetSaveInfo(SaveType);
|
||||
|
@ -197,10 +352,6 @@ public Save(string filePath, bool createBackup = false)
|
|||
if (SaveType == SaveType.WildWorld || SaveGeneration == SaveGeneration.N3DS)
|
||||
IsBigEndian = false;
|
||||
|
||||
_saveReader.Close();
|
||||
_saveFile.Close();
|
||||
_saveReader.Dispose();
|
||||
_saveFile.Dispose();
|
||||
|
||||
SaveInstance = this;
|
||||
}
|
||||
|
@ -213,22 +364,36 @@ public Save(string filePath, bool createBackup = false)
|
|||
public void Flush()
|
||||
{
|
||||
var fullSaveName = SavePath + Path.DirectorySeparatorChar + SaveName + SaveExtension;
|
||||
_saveFile = new FileStream(fullSaveName, FileMode.OpenOrCreate);
|
||||
_saveWriter = new BinaryWriter(_saveFile);
|
||||
File.Delete(fullSaveName);
|
||||
Thread.Sleep(1000);
|
||||
//_saveFile = new FileStream(fullSaveName, FileMode.OpenOrCreate);
|
||||
//_saveWriter = new BinaryWriter(_saveFile);
|
||||
|
||||
//SaveData = Utility.ensureCapacity(SaveData, (SaveDataStartOffset + SaveInfo.SaveOffsets.SaveSize) * 2);
|
||||
|
||||
switch (SaveType)
|
||||
{
|
||||
case SaveType.DoubutsuNoMoriPlus:
|
||||
case SaveType.AnimalCrossing:
|
||||
case SaveType.DoubutsuNoMoriEPlus:
|
||||
case SaveType.AnimalForestEPlus:
|
||||
|
||||
GameCubeFile.Description = SelectedPlayer.Data.TownName + " Town Data";
|
||||
|
||||
//Write(0x40, "Animal Crossing");
|
||||
//Write(0x60, _selectedPlayer.Data.TownName + " Town Data");
|
||||
Write(SaveDataStartOffset + SaveInfo.SaveOffsets.Checksum,
|
||||
new UInt16BEChecksum().Calculate(
|
||||
SaveData.Skip(SaveDataStartOffset).Take(SaveInfo.SaveOffsets.SaveSize).ToArray(),
|
||||
(uint) SaveInfo.SaveOffsets.Checksum), IsBigEndian);
|
||||
|
||||
SaveData.Skip(SaveDataStartOffset).Take(SaveInfo.SaveOffsets.SaveSize).ToArray().CopyTo(
|
||||
SaveData,
|
||||
SaveDataStartOffset + SaveInfo.SaveOffsets.SaveSize);
|
||||
GameCubeFile.SaveData = SaveData;
|
||||
|
||||
GameCubeFile.write(fullSaveName);
|
||||
|
||||
//SaveData.Skip(SaveDataStartOffset).Take(SaveInfo.SaveOffsets.SaveSize).ToArray().CopyTo(
|
||||
// SaveData,
|
||||
// SaveDataStartOffset + SaveInfo.SaveOffsets.SaveSize);
|
||||
break;
|
||||
case SaveType.WildWorld:
|
||||
Write(SaveDataStartOffset + SaveInfo.SaveOffsets.Checksum,
|
||||
|
@ -357,7 +522,7 @@ public void Flush()
|
|||
break;
|
||||
}
|
||||
|
||||
_saveWriter.Write(SaveType == SaveType.DoubutsuNoMori && _byteswap
|
||||
/*_saveWriter.Write(SaveType == SaveType.DoubutsuNoMori && _byteswap
|
||||
? SaveDataManager.ByteSwap(SaveData)
|
||||
: SaveData); // Doubutsu no Mori is dword byteswapped
|
||||
_saveWriter.Flush();
|
||||
|
@ -366,7 +531,9 @@ public void Flush()
|
|||
_saveWriter.Close();
|
||||
_saveFile.Close();
|
||||
_saveWriter.Dispose();
|
||||
_saveFile.Dispose();
|
||||
_saveFile.Dispose();*/
|
||||
|
||||
|
||||
ChangesMade = false;
|
||||
}
|
||||
|
||||
|
@ -387,6 +554,7 @@ public void Close(bool save)
|
|||
public void Write(int offset, byte value, bool includeStartOffset = false)
|
||||
{
|
||||
if (includeStartOffset) offset += SaveDataStartOffset;
|
||||
SaveData = Utility.ensureCapacity(SaveData, offset);
|
||||
SaveData[offset] = value;
|
||||
}
|
||||
|
||||
|
@ -396,6 +564,7 @@ public void Write(int offset, sbyte value, bool includeStartOffset = false) =>
|
|||
public void Write(int offset, byte[] value, bool includeStartOffset = false)
|
||||
{
|
||||
if (includeStartOffset) offset += SaveDataStartOffset;
|
||||
SaveData = Utility.ensureCapacity(SaveData, offset + value.Length);
|
||||
Buffer.BlockCopy(value, 0, SaveData, offset, value.Length);
|
||||
}
|
||||
|
||||
|
@ -476,6 +645,7 @@ public void Write(int offset, string value, int maxLength = 0, bool includeStart
|
|||
if (includeStartOffset) offset += SaveDataStartOffset;
|
||||
|
||||
var stringByteBuff = AcString.GetBytes(value, maxLength);
|
||||
SaveData = Utility.ensureCapacity(SaveData, offset + stringByteBuff.Length);
|
||||
Buffer.BlockCopy(stringByteBuff, 0, SaveData, offset, stringByteBuff.Length);
|
||||
}
|
||||
|
||||
|
@ -500,6 +670,7 @@ public void FindAndReplaceByteArray(in byte[] oldarr, in byte[] newarr, int end
|
|||
public byte ReadByte(int offset, bool includeStartOffset = false)
|
||||
{
|
||||
if (includeStartOffset) offset += SaveDataStartOffset;
|
||||
SaveData = Utility.ensureCapacity(SaveData, offset);
|
||||
return SaveData[offset];
|
||||
}
|
||||
|
||||
|
@ -508,6 +679,7 @@ public byte[] ReadByteArray(int offset, int count, bool reversed = false,
|
|||
{
|
||||
if (includeStartOffset) offset += SaveDataStartOffset;
|
||||
|
||||
SaveData = Utility.ensureCapacity(SaveData, offset + count);
|
||||
var data = new byte[count];
|
||||
if (reversed)
|
||||
{
|
||||
|
@ -530,6 +702,7 @@ public ushort ReadUInt16(int offset, bool reversed = false, bool includeStartOff
|
|||
{
|
||||
if (includeStartOffset) offset += SaveDataStartOffset;
|
||||
|
||||
SaveData = Utility.ensureCapacity(SaveData, offset+2);
|
||||
var value = BitConverter.ToUInt16(SaveData, offset);
|
||||
if (reversed)
|
||||
value = value.Reverse();
|
||||
|
@ -541,6 +714,7 @@ public ushort[] ReadUInt16Array(int offset, int count, bool reversed = false,
|
|||
{
|
||||
if (includeStartOffset) offset += SaveDataStartOffset;
|
||||
|
||||
SaveData = Utility.ensureCapacity(SaveData, offset + (count*2));
|
||||
var returnedValues = new ushort[count];
|
||||
for (var i = 0; i < count; i++)
|
||||
returnedValues[i] = ReadUInt16(offset + i * 2, reversed);
|
||||
|
@ -551,6 +725,7 @@ public uint ReadUInt32(int offset, bool reversed = false, bool includeStartOffse
|
|||
{
|
||||
if (includeStartOffset) offset += SaveDataStartOffset;
|
||||
|
||||
SaveData = Utility.ensureCapacity(SaveData, offset+4);
|
||||
var value = BitConverter.ToUInt32(SaveData, offset);
|
||||
if (reversed)
|
||||
value = value.Reverse();
|
||||
|
@ -562,6 +737,7 @@ public uint[] ReadUInt32Array(int offset, int count, bool reversed = false,
|
|||
{
|
||||
if (includeStartOffset) offset += SaveDataStartOffset;
|
||||
|
||||
SaveData = Utility.ensureCapacity(SaveData, offset + (count*4));
|
||||
var returnedValues = new uint[count];
|
||||
for (var i = 0; i < count; i++)
|
||||
returnedValues[i] = ReadUInt32(offset + i * 4, reversed);
|
||||
|
@ -572,6 +748,7 @@ public ulong ReadUInt64(int offset, bool reversed = false, bool includeStartOffs
|
|||
{
|
||||
if (includeStartOffset) offset += SaveDataStartOffset;
|
||||
|
||||
SaveData = Utility.ensureCapacity(SaveData, (offset*8));
|
||||
var value = BitConverter.ToUInt64(SaveData, offset);
|
||||
if (reversed)
|
||||
value = value.Reverse();
|
||||
|
@ -584,6 +761,9 @@ public string ReadString(int offset, int length, bool includeStartOffset = false
|
|||
public string ReadAsciiString(int offset, int length = -1, bool includeStartOffset = false)
|
||||
{
|
||||
if (includeStartOffset) offset += SaveDataStartOffset;
|
||||
SaveData = Utility.ensureCapacity(SaveData, offset + length);
|
||||
|
||||
|
||||
if (length >= 0) return Encoding.ASCII.GetString(SaveData, offset, length);
|
||||
|
||||
var outString = "";
|
||||
|
@ -602,6 +782,7 @@ public string[] ReadStringArray(int offset, int length, int count, bool includeS
|
|||
{
|
||||
if (includeStartOffset) offset += SaveDataStartOffset;
|
||||
var stringArray = new string[count];
|
||||
SaveData = Utility.ensureCapacity(SaveData, offset + (length * count));
|
||||
for (var i = 0; i < count; i++)
|
||||
stringArray[i] = ReadString(offset + i * length, length);
|
||||
return stringArray;
|
||||
|
@ -611,6 +792,7 @@ public string[] ReadStringArrayWithVariedLengths(int offset, int count, byte end
|
|||
bool includeStartOffset = false)
|
||||
{
|
||||
if (includeStartOffset) offset += SaveDataStartOffset;
|
||||
SaveData = Utility.ensureCapacity(SaveData, offset + count);
|
||||
var stringArray = new string[count];
|
||||
var lastOffset = 0;
|
||||
for (var i = 0; i < count; i++)
|
||||
|
@ -627,5 +809,6 @@ public string[] ReadStringArrayWithVariedLengths(int offset, int count, byte end
|
|||
}
|
||||
return stringArray;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
@ -2,6 +2,7 @@
|
|||
using System.Collections.Generic;
|
||||
using System.Globalization;
|
||||
using System.IO;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Text;
|
||||
using ACSE.Core.Debug;
|
||||
using ACSE.Core.Items;
|
||||
|
@ -73,7 +74,7 @@ public enum SaveFileDataOffset
|
|||
nafjfla = 0,
|
||||
nafjsta = 0, // iQue Animal Forest
|
||||
gafjgci = 0x2040, // Doubutsu_no_Mori_Plus
|
||||
gafegci = 0x26040,
|
||||
gafegci = 0, // Because a proper GCI file implementation exists now.
|
||||
gafegcs = 0x26150,
|
||||
gaferaw = 0x30000,
|
||||
gaejgci = 0x10040, // Doubutsu_no_Mori_e_Plus
|
||||
|
@ -555,8 +556,175 @@ public static byte[] ByteSwap(in byte[] saveData)
|
|||
/// <returns>Is byteswapped</returns>
|
||||
public static bool IsByteSwapped(this Save save) => save.ReadAsciiString(4, 4) == "JFAN";
|
||||
|
||||
public static byte[] GetEmptyData(this Save save, string gameIDCode)
|
||||
{
|
||||
byte[] ret = null;
|
||||
switch(save.SaveType)
|
||||
{
|
||||
case SaveType.DoubutsuNoMori:
|
||||
case SaveType.DongwuSenlin:
|
||||
{
|
||||
ret = new byte[20000];
|
||||
if(save.SaveType == SaveType.DongwuSenlin)
|
||||
{
|
||||
// Set position 0xF980 to 0x0001
|
||||
ret.Write(0xF980, (UInt16)0x0001);
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
case SaveType.DoubutsuNoMoriPlus:
|
||||
case SaveType.DoubutsuNoMoriEPlus:
|
||||
case SaveType.AnimalForestEPlus:
|
||||
case SaveType.AnimalCrossing:
|
||||
{
|
||||
ret = new byte[0x72040];
|
||||
|
||||
|
||||
ret.Write(0, gameIDCode.ToUpper());
|
||||
ret.Write(0x40, "Animal Crossing");
|
||||
ret.Write(0x60, "Town Data");
|
||||
|
||||
break;
|
||||
}
|
||||
case SaveType.WildWorld:
|
||||
{
|
||||
ret = new byte[0x40000];
|
||||
ret.Write(0x1E40, "EMDA");
|
||||
break;
|
||||
}
|
||||
case SaveType.CityFolk:
|
||||
{
|
||||
ret = new byte[0x47A0DA];
|
||||
break;
|
||||
}
|
||||
case SaveType.NewLeaf:
|
||||
{
|
||||
ret = new byte[0x80000];
|
||||
break;
|
||||
}
|
||||
case SaveType.WelcomeAmiibo:
|
||||
{
|
||||
ret = new byte[0x89B00];
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
#region Data Manipulators
|
||||
private static int SaveDataStartOffset
|
||||
{
|
||||
get
|
||||
{
|
||||
return Save.SaveInstance.SaveDataStartOffset;
|
||||
}
|
||||
}
|
||||
public static void Write(this byte[] SaveData, int offset, byte value, bool includeStartOffset = false)
|
||||
{
|
||||
if (includeStartOffset) offset += SaveDataStartOffset;
|
||||
SaveData = Utility.ensureCapacity(SaveData, offset);
|
||||
SaveData[offset] = value;
|
||||
}
|
||||
|
||||
public static void Write(this byte[] SaveData, int offset, sbyte value, bool includeStartOffset = false) =>
|
||||
SaveData.Write(offset, (byte)value, includeStartOffset);
|
||||
|
||||
public static void Write(this byte[] SaveData, int offset, byte[] value, bool includeStartOffset = false)
|
||||
{
|
||||
if (includeStartOffset) offset += SaveDataStartOffset;
|
||||
SaveData = Utility.ensureCapacity(SaveData, offset + value.Length);
|
||||
Buffer.BlockCopy(value, 0, SaveData, offset, value.Length);
|
||||
}
|
||||
|
||||
public static void Write(this byte[] SaveData, int offset, sbyte[] value, bool includeStartOffset = false) =>
|
||||
SaveData.Write(offset, (byte[])(Array)value, includeStartOffset);
|
||||
|
||||
public static void Write(this byte[] SaveData, int offset, ushort value, bool? reversed = false, bool includeStartOffset = false, bool IsBigEndian=false)
|
||||
{
|
||||
if (includeStartOffset) offset += SaveDataStartOffset;
|
||||
if (reversed == null && IsBigEndian || reversed != null && reversed.Value) value = value.Reverse();
|
||||
|
||||
SaveData.Write(offset, BitConverter.GetBytes(value));
|
||||
}
|
||||
|
||||
public static void Write(this byte[] SaveData, int offset, short value, bool? reversed = false, bool includeStartOffset = false) =>
|
||||
SaveData.Write(offset, (ushort)value, reversed, includeStartOffset);
|
||||
|
||||
public static void Write(this byte[] SaveData, int offset, uint value, bool? reversed = false, bool includeStartOffset = false, bool IsBigEndian = false)
|
||||
{
|
||||
if (includeStartOffset) offset += SaveDataStartOffset;
|
||||
if (reversed == null && IsBigEndian || reversed != null && reversed.Value) value = value.Reverse();
|
||||
|
||||
SaveData.Write(offset, BitConverter.GetBytes(value));
|
||||
}
|
||||
|
||||
public static void Write(this byte[] SaveData, int offset, int value, bool? reversed = false, bool includeStartOffset = false) =>
|
||||
SaveData.Write(offset, (uint)value, reversed, includeStartOffset);
|
||||
|
||||
public static void Write(this byte[] SaveData, int offset, ulong value, bool? reversed = false, bool includeStartOffset = false, bool IsBigEndian = false)
|
||||
{
|
||||
if (includeStartOffset) offset += SaveDataStartOffset;
|
||||
if (reversed == null && IsBigEndian || reversed != null && reversed.Value) value = value.Reverse();
|
||||
|
||||
SaveData.Write(offset, BitConverter.GetBytes(value));
|
||||
}
|
||||
|
||||
public static void Write(this byte[] SaveData, int offset, long value, bool? reversed = false, bool includeStartOffset = false) =>
|
||||
SaveData.Write(offset, (ulong)value, reversed, includeStartOffset);
|
||||
|
||||
public static void Write(this byte[] SaveData, int offset, ushort[] value, bool? reversed = false, bool includeStartOffset = false)
|
||||
{
|
||||
foreach (var data in value)
|
||||
{
|
||||
SaveData.Write(offset, data, reversed, includeStartOffset);
|
||||
offset += 2;
|
||||
}
|
||||
}
|
||||
|
||||
public static void Write(this byte[] SaveData, int offset, short[] value, bool? reversed = false, bool includeStartOffset = false) =>
|
||||
SaveData.Write(offset, (ushort[])(Array)value, reversed, includeStartOffset);
|
||||
|
||||
public static void Write(this byte[] SaveData, int offset, uint[] value, bool? reversed = false, bool includeStartOffset = false)
|
||||
{
|
||||
foreach (var data in value)
|
||||
{
|
||||
SaveData.Write(offset, data, reversed, includeStartOffset);
|
||||
offset += 4;
|
||||
}
|
||||
}
|
||||
|
||||
public static void Write(this byte[] SaveData, int offset, int[] value, bool? reversed = false, bool includeStartOffset = false) =>
|
||||
SaveData.Write(offset, (uint[])(Array)value, reversed, includeStartOffset);
|
||||
|
||||
public static void Write(this byte[] SaveData, int offset, ulong[] value, bool? reversed = false, bool includeStartOffset = false)
|
||||
{
|
||||
foreach (var data in value)
|
||||
{
|
||||
SaveData.Write(offset, data, reversed, includeStartOffset);
|
||||
offset += 8;
|
||||
}
|
||||
}
|
||||
|
||||
public static void Write(this byte[] SaveData, int offset, long[] value, bool? reversed = false, bool includeStartOffset = false) =>
|
||||
SaveData.Write(offset, (ulong[])(Array)value, reversed, includeStartOffset);
|
||||
|
||||
public static void Write(this byte[] SaveData, int offset, string value, int maxLength = 0, bool includeStartOffset = false)
|
||||
{
|
||||
if (includeStartOffset) offset += SaveDataStartOffset;
|
||||
|
||||
var stringByteBuff = AcString.GetBytes(value, maxLength);
|
||||
SaveData = Utility.ensureCapacity(SaveData, offset + stringByteBuff.Length);
|
||||
Buffer.BlockCopy(stringByteBuff, 0, SaveData, offset, stringByteBuff.Length);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
public static SaveType GetSaveType(this Save save)
|
||||
{
|
||||
|
||||
|
||||
switch (save.SaveData.Length) // TODO: look for a better way to differentiate the iQue version from the N64 version.
|
||||
{
|
||||
case 0x20000:
|
||||
|
|
|
@ -551,13 +551,20 @@ internal static class CharacterSets
|
|||
public class AcString
|
||||
{
|
||||
public string String = "";
|
||||
private static SaveType _saveType;
|
||||
private static SaveType _saveType
|
||||
{
|
||||
get
|
||||
{
|
||||
return Save.SaveInstance.SaveType;
|
||||
}
|
||||
}
|
||||
private static string[] _charDictionary;
|
||||
|
||||
public AcString(byte[] stringBuffer, SaveType saveType)
|
||||
|
||||
private static void initDictionary()
|
||||
{
|
||||
_saveType = saveType;
|
||||
switch (saveType)
|
||||
|
||||
switch (_saveType)
|
||||
{
|
||||
case SaveType.DoubutsuNoMori:
|
||||
case SaveType.DoubutsuNoMoriPlus:
|
||||
|
@ -575,6 +582,11 @@ public AcString(byte[] stringBuffer, SaveType saveType)
|
|||
_charDictionary = null;
|
||||
break;
|
||||
}
|
||||
}
|
||||
public AcString(byte[] stringBuffer, SaveType saveType)
|
||||
{
|
||||
//_saveType = saveType;
|
||||
initDictionary();
|
||||
|
||||
if (_charDictionary != null)
|
||||
{
|
||||
|
@ -619,6 +631,7 @@ public AcString(byte[] stringBuffer, SaveType saveType)
|
|||
|
||||
public static byte[] GetBytes(string String, int maxSize = 0)
|
||||
{
|
||||
initDictionary();
|
||||
var i = 0;
|
||||
switch (_saveType)
|
||||
{
|
||||
|
|
|
@ -306,5 +306,144 @@ public static void FloodFillFurnitureArray(ref Furniture[] items, int itemsPerRo
|
|||
previousPoints[idx] = 1;
|
||||
}
|
||||
}
|
||||
|
||||
public static ushort RandomIdentifier()
|
||||
{
|
||||
Random rng = new Random(0xFFFF);
|
||||
return (ushort)rng.Next();
|
||||
}
|
||||
|
||||
public static byte[] ensureCapacity(byte[] array, int length)
|
||||
{
|
||||
byte[] arr;
|
||||
if (array.Length < length)
|
||||
{
|
||||
arr = array;
|
||||
array = new byte[length + 16];
|
||||
Array.Copy(arr, array, arr.Length);
|
||||
|
||||
arr = array;
|
||||
}
|
||||
else arr = array;
|
||||
|
||||
return arr;
|
||||
}
|
||||
|
||||
public static int? getSeed()
|
||||
{
|
||||
return Environment.TickCount;
|
||||
}
|
||||
}
|
||||
|
||||
public class UtilityWriter : BinaryWriter
|
||||
{
|
||||
public UtilityWriter(string filename) : base(new FileStream(filename, FileMode.OpenOrCreate))
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public override void Write(bool value)
|
||||
{
|
||||
base.Write(value);
|
||||
Flush();
|
||||
}
|
||||
public override void Write(byte value)
|
||||
{
|
||||
base.Write(value);
|
||||
Flush();
|
||||
}
|
||||
public override void Write(byte[] buffer)
|
||||
{
|
||||
base.Write(buffer);
|
||||
Flush();
|
||||
}
|
||||
|
||||
public override void Write(byte[] buffer, int index, int count)
|
||||
{
|
||||
base.Write(buffer, index, count);
|
||||
Flush();
|
||||
}
|
||||
|
||||
public override void Write(char ch)
|
||||
{
|
||||
base.Write(ch);
|
||||
Flush();
|
||||
}
|
||||
public override void Write(char[] chars)
|
||||
{
|
||||
base.Write(chars);
|
||||
Flush();
|
||||
}
|
||||
public override void Write(char[] chars, int index, int count)
|
||||
{
|
||||
base.Write(chars, index, count);
|
||||
Flush();
|
||||
}
|
||||
|
||||
public override void Write(decimal value)
|
||||
{
|
||||
base.Write(value);
|
||||
Flush();
|
||||
}
|
||||
|
||||
public override void Write(double value)
|
||||
{
|
||||
base.Write(value);
|
||||
Flush();
|
||||
}
|
||||
|
||||
public override void Write(float value)
|
||||
{
|
||||
base.Write(value);
|
||||
Flush();
|
||||
}
|
||||
|
||||
public override void Write(int value)
|
||||
{
|
||||
base.Write(value);
|
||||
Flush();
|
||||
}
|
||||
|
||||
public override void Write(long value)
|
||||
{
|
||||
base.Write(value);
|
||||
Flush();
|
||||
}
|
||||
|
||||
public override void Write(sbyte value)
|
||||
{
|
||||
base.Write(value);
|
||||
Flush();
|
||||
}
|
||||
|
||||
public override void Write(short value)
|
||||
{
|
||||
base.Write(value);
|
||||
Flush();
|
||||
}
|
||||
|
||||
public override void Write(string value)
|
||||
{
|
||||
base.Write(value);
|
||||
Flush();
|
||||
}
|
||||
|
||||
public override void Write(uint value)
|
||||
{
|
||||
base.Write(value);
|
||||
Flush();
|
||||
}
|
||||
|
||||
public override void Write(ulong value)
|
||||
{
|
||||
base.Write(value);
|
||||
Flush();
|
||||
}
|
||||
|
||||
public override void Write(ushort value)
|
||||
{
|
||||
base.Write(value);
|
||||
Flush();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -9,7 +9,7 @@
|
|||
<OutputType>WinExe</OutputType>
|
||||
<RootNamespace>ACSE.WinForms</RootNamespace>
|
||||
<AssemblyName>ACSE</AssemblyName>
|
||||
<TargetFrameworkVersion>v4.7.2</TargetFrameworkVersion>
|
||||
<TargetFrameworkVersion>v4.8.1</TargetFrameworkVersion>
|
||||
<FileAlignment>512</FileAlignment>
|
||||
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
|
||||
<Deterministic>true</Deterministic>
|
||||
|
@ -56,6 +56,9 @@
|
|||
<PropertyGroup>
|
||||
<ApplicationIcon>ACSE_Logo_2.ico</ApplicationIcon>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup>
|
||||
<StartupObject>ACSE.WinForms.Program</StartupObject>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="Costura, Version=3.1.6.0, Culture=neutral, PublicKeyToken=9919ef960d84173d, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Costura.Fody.3.1.6\lib\net46\Costura.dll</HintPath>
|
||||
|
@ -180,6 +183,12 @@
|
|||
<Compile Include="MailEditorForm\MailEditorForm.Designer.cs">
|
||||
<DependentUpon>MailEditorForm.cs</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="MainForm\NewGamecubePrompt.cs">
|
||||
<SubType>Form</SubType>
|
||||
</Compile>
|
||||
<Compile Include="MainForm\NewGamecubePrompt.Designer.cs">
|
||||
<DependentUpon>NewGamecubePrompt.cs</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="SecureValueForm\SecureValueForm.cs">
|
||||
<SubType>Form</SubType>
|
||||
</Compile>
|
||||
|
@ -234,6 +243,9 @@
|
|||
<EmbeddedResource Include="MailEditorForm\MailEditorForm.resx">
|
||||
<DependentUpon>MailEditorForm.cs</DependentUpon>
|
||||
</EmbeddedResource>
|
||||
<EmbeddedResource Include="MainForm\NewGamecubePrompt.resx">
|
||||
<DependentUpon>NewGamecubePrompt.cs</DependentUpon>
|
||||
</EmbeddedResource>
|
||||
<EmbeddedResource Include="SecureValueForm\SecureValueForm.resx">
|
||||
<DependentUpon>SecureValueForm.cs</DependentUpon>
|
||||
</EmbeddedResource>
|
||||
|
@ -5741,24 +5753,22 @@
|
|||
<Error Condition="!Exists('..\packages\Fody.3.2.16\build\Fody.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\Fody.3.2.16\build\Fody.targets'))" />
|
||||
</Target>
|
||||
<Import Project="..\packages\Fody.3.2.16\build\Fody.targets" Condition="Exists('..\packages\Fody.3.2.16\build\Fody.targets')" />
|
||||
|
||||
<PropertyGroup Condition="'$([System.Runtime.InteropServices.RuntimeInformation]::IsOSPlatform($([System.Runtime.InteropServices.OSPlatform]::Windows)))'">
|
||||
<PostBuildEvent>del $(TargetDir)Newtonsoft.Json.xml
|
||||
<PropertyGroup Condition="'$([System.Runtime.InteropServices.RuntimeInformation]::IsOSPlatform($([System.Runtime.InteropServices.OSPlatform]::Windows)))'">
|
||||
<PostBuildEvent>del $(TargetDir)Newtonsoft.Json.xml
|
||||
del $(TargetDir)$(TargetName).pdb
|
||||
del $(TargetDir)$(TargetName).exe.config
|
||||
</PostBuildEvent>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$([System.Runtime.InteropServices.RuntimeInformation]::IsOSPlatform($([System.Runtime.InteropServices.OSPlatform]::Linux)))'">
|
||||
<PostBuildEvent>rm $(TargetDir)Newtonsoft.Json.xml
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$([System.Runtime.InteropServices.RuntimeInformation]::IsOSPlatform($([System.Runtime.InteropServices.OSPlatform]::Linux)))'">
|
||||
<PostBuildEvent>rm $(TargetDir)Newtonsoft.Json.xml
|
||||
rm $(TargetDir)$(TargetName).pdb
|
||||
rm $(TargetDir)$(TargetName).exe.config
|
||||
</PostBuildEvent>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$([System.Runtime.InteropServices.RuntimeInformation]::IsOSPlatform($([System.Runtime.InteropServices.OSPlatform]::OSX)))'">
|
||||
<PostBuildEvent>rm $(TargetDir)Newtonsoft.Json.xml
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$([System.Runtime.InteropServices.RuntimeInformation]::IsOSPlatform($([System.Runtime.InteropServices.OSPlatform]::OSX)))'">
|
||||
<PostBuildEvent>rm $(TargetDir)Newtonsoft.Json.xml
|
||||
rm $(TargetDir)$(TargetName).pdb
|
||||
rm $(TargetDir)$(TargetName).exe.config
|
||||
</PostBuildEvent>
|
||||
</PropertyGroup>
|
||||
|
||||
</PropertyGroup>
|
||||
</Project>
|
|
@ -6,7 +6,7 @@
|
|||
</sectionGroup>
|
||||
</configSections>
|
||||
<startup>
|
||||
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.7.2"/>
|
||||
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.8.1"/>
|
||||
</startup>
|
||||
<userSettings>
|
||||
<ACSE.WinForms.Properties.Settings>
|
||||
|
|
|
@ -88,6 +88,7 @@ internal static (string, bool) GetBackupFileName(Save saveFile)
|
|||
|
||||
public bool CreateBackup()
|
||||
{
|
||||
if (_save.isNew) return false;
|
||||
// TODO: Do we want to store the date-time in the backup name?
|
||||
var backupsDirectory = GetBackupDirectory();
|
||||
if (!backupsDirectory.Exists) return false;
|
||||
|
|
2
ACSE.WinForms/ItemColorSettings.Designer.cs
generated
2
ACSE.WinForms/ItemColorSettings.Designer.cs
generated
|
@ -12,7 +12,7 @@ namespace ACSE.WinForms {
|
|||
|
||||
|
||||
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
|
||||
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "16.0.0.0")]
|
||||
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "17.7.0.0")]
|
||||
internal sealed partial class ItemColorSettings : global::System.Configuration.ApplicationSettingsBase {
|
||||
|
||||
private static ItemColorSettings defaultInstance = ((ItemColorSettings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new ItemColorSettings())));
|
||||
|
|
159
ACSE.WinForms/MainForm/MainForm.Designer.cs
generated
159
ACSE.WinForms/MainForm/MainForm.Designer.cs
generated
|
@ -33,12 +33,10 @@ private void InitializeComponent()
|
|||
this.components = new System.ComponentModel.Container();
|
||||
System.Windows.Forms.TabPage patternsTab;
|
||||
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(MainForm));
|
||||
this.patternNameTextBox = new System.Windows.Forms.PlaceholderTextBox();
|
||||
this.paletteIndexLabel = new System.Windows.Forms.Label();
|
||||
this.palettePreviousButton = new System.Windows.Forms.Button();
|
||||
this.paletteNextButton = new System.Windows.Forms.Button();
|
||||
this.patternEditorPanel = new System.Windows.Forms.Panel();
|
||||
this.patternEditorPictureBox = new ACSE.WinForms.Controls.PictureBoxWithInterpolationMode();
|
||||
this.patternEditorPreviewPanel = new System.Windows.Forms.Panel();
|
||||
this.patternGroupTabControl = new System.Windows.Forms.TabControl();
|
||||
this.player1Tab = new System.Windows.Forms.TabPage();
|
||||
|
@ -274,14 +272,21 @@ private void InitializeComponent()
|
|||
this.loadingPanel = new System.Windows.Forms.Panel();
|
||||
this.label45 = new System.Windows.Forms.Label();
|
||||
this.infoTip = new System.Windows.Forms.ToolTip(this.components);
|
||||
this.itemIdTextBox = new System.Windows.Forms.PlaceholderTextBox();
|
||||
this.itemIdLabel = new System.Windows.Forms.Label();
|
||||
this.StatusLabel = new System.Windows.Forms.TextBox();
|
||||
this.itemSelection = new System.Windows.Forms.Button();
|
||||
this.newToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.gameCubeToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.dSToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.wiiToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.dSToolStripMenuItem1 = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.switchToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.itemIdTextBox = new System.Windows.Forms.PlaceholderTextBox();
|
||||
this.patternNameTextBox = new System.Windows.Forms.PlaceholderTextBox();
|
||||
this.patternEditorPictureBox = new ACSE.WinForms.Controls.PictureBoxWithInterpolationMode();
|
||||
patternsTab = new System.Windows.Forms.TabPage();
|
||||
patternsTab.SuspendLayout();
|
||||
this.patternEditorPanel.SuspendLayout();
|
||||
((System.ComponentModel.ISupportInitialize)(this.patternEditorPictureBox)).BeginInit();
|
||||
this.patternGroupTabControl.SuspendLayout();
|
||||
((System.ComponentModel.ISupportInitialize)(this.paletteColorSelectedPictureBox)).BeginInit();
|
||||
((System.ComponentModel.ISupportInitialize)(this.paletteSelectionPictureBox)).BeginInit();
|
||||
|
@ -319,6 +324,7 @@ private void InitializeComponent()
|
|||
this.pictureContextMenu.SuspendLayout();
|
||||
((System.ComponentModel.ISupportInitialize)(this.acreHeightTrackBar)).BeginInit();
|
||||
this.loadingPanel.SuspendLayout();
|
||||
((System.ComponentModel.ISupportInitialize)(this.patternEditorPictureBox)).BeginInit();
|
||||
this.SuspendLayout();
|
||||
//
|
||||
// patternsTab
|
||||
|
@ -339,18 +345,6 @@ private void InitializeComponent()
|
|||
patternsTab.Text = "Patterns";
|
||||
patternsTab.UseVisualStyleBackColor = true;
|
||||
//
|
||||
// patternNameTextBox
|
||||
//
|
||||
this.patternNameTextBox.Anchor = System.Windows.Forms.AnchorStyles.None;
|
||||
this.patternNameTextBox.Location = new System.Drawing.Point(415, 538);
|
||||
this.patternNameTextBox.MaxLength = 16;
|
||||
this.patternNameTextBox.Name = "patternNameTextBox";
|
||||
this.patternNameTextBox.PlaceholderText = "Pattern Name";
|
||||
this.patternNameTextBox.PlaceholderTextColor = System.Drawing.Color.Gray;
|
||||
this.patternNameTextBox.Size = new System.Drawing.Size(100, 20);
|
||||
this.patternNameTextBox.TabIndex = 0;
|
||||
this.patternNameTextBox.TextChanged += new System.EventHandler(this.PatternEditorNameBox_TextChanged);
|
||||
//
|
||||
// paletteIndexLabel
|
||||
//
|
||||
this.paletteIndexLabel.Anchor = System.Windows.Forms.AnchorStyles.None;
|
||||
|
@ -392,23 +386,6 @@ private void InitializeComponent()
|
|||
this.patternEditorPanel.Size = new System.Drawing.Size(513, 513);
|
||||
this.patternEditorPanel.TabIndex = 16;
|
||||
//
|
||||
// patternEditorPictureBox
|
||||
//
|
||||
this.patternEditorPictureBox.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Stretch;
|
||||
this.patternEditorPictureBox.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
this.patternEditorPictureBox.InterpolationMode = System.Drawing.Drawing2D.InterpolationMode.Default;
|
||||
this.patternEditorPictureBox.Location = new System.Drawing.Point(0, 0);
|
||||
this.patternEditorPictureBox.Name = "patternEditorPictureBox";
|
||||
this.patternEditorPictureBox.Size = new System.Drawing.Size(513, 513);
|
||||
this.patternEditorPictureBox.SizeMode = System.Windows.Forms.PictureBoxSizeMode.StretchImage;
|
||||
this.patternEditorPictureBox.TabIndex = 0;
|
||||
this.patternEditorPictureBox.TabStop = false;
|
||||
this.patternEditorPictureBox.UseInternalInterpolationSetting = false;
|
||||
this.patternEditorPictureBox.MouseDown += new System.Windows.Forms.MouseEventHandler(this.PatternEditorBoxMouseDown);
|
||||
this.patternEditorPictureBox.MouseLeave += new System.EventHandler(this.PatternEditorBoxMouseLeave);
|
||||
this.patternEditorPictureBox.MouseMove += new System.Windows.Forms.MouseEventHandler(this.PatternEditorBoxMouseMove);
|
||||
this.patternEditorPictureBox.MouseUp += new System.Windows.Forms.MouseEventHandler(this.PatternEditorBoxMouseUp);
|
||||
//
|
||||
// patternEditorPreviewPanel
|
||||
//
|
||||
this.patternEditorPreviewPanel.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
|
||||
|
@ -513,6 +490,7 @@ private void InitializeComponent()
|
|||
// fileToolStripMenuItem
|
||||
//
|
||||
this.fileToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
|
||||
this.newToolStripMenuItem,
|
||||
this.openToolStripMenuItem,
|
||||
this.openDolphinSaveFileToolStripMenuItem,
|
||||
this.openCitraSaveFileToolStripMenuItem,
|
||||
|
@ -2832,21 +2810,6 @@ private void InitializeComponent()
|
|||
this.label45.TabIndex = 15;
|
||||
this.label45.Text = "Loading...";
|
||||
//
|
||||
// itemIdTextBox
|
||||
//
|
||||
this.itemIdTextBox.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
|
||||
this.itemIdTextBox.Enabled = false;
|
||||
this.itemIdTextBox.Location = new System.Drawing.Point(132, 620);
|
||||
this.itemIdTextBox.Name = "itemIdTextBox";
|
||||
this.itemIdTextBox.PlaceholderText = "Item ID";
|
||||
this.itemIdTextBox.PlaceholderTextColor = System.Drawing.Color.Gray;
|
||||
this.itemIdTextBox.Size = new System.Drawing.Size(46, 20);
|
||||
this.itemIdTextBox.TabIndex = 78;
|
||||
this.itemIdTextBox.TextAlign = System.Windows.Forms.HorizontalAlignment.Center;
|
||||
this.infoTip.SetToolTip(this.itemIdTextBox, "The hexadecimal Item ID. Example: A31C");
|
||||
this.itemIdTextBox.TextChanged += new System.EventHandler(this.CurrentItemIdTextChanged);
|
||||
this.itemIdTextBox.Leave += new System.EventHandler(this.CurrentItemIdLostFocus);
|
||||
//
|
||||
// itemIdLabel
|
||||
//
|
||||
this.itemIdLabel.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
|
||||
|
@ -2881,6 +2844,98 @@ private void InitializeComponent()
|
|||
this.itemSelection.UseVisualStyleBackColor = true;
|
||||
this.itemSelection.Click += new System.EventHandler(this.itemSelection_Click_1);
|
||||
//
|
||||
// newToolStripMenuItem
|
||||
//
|
||||
this.newToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
|
||||
this.gameCubeToolStripMenuItem,
|
||||
this.dSToolStripMenuItem,
|
||||
this.wiiToolStripMenuItem,
|
||||
this.dSToolStripMenuItem1,
|
||||
this.switchToolStripMenuItem});
|
||||
this.newToolStripMenuItem.Name = "newToolStripMenuItem";
|
||||
this.newToolStripMenuItem.Size = new System.Drawing.Size(196, 22);
|
||||
this.newToolStripMenuItem.Text = "New";
|
||||
this.newToolStripMenuItem.Click += new System.EventHandler(this.newToolStripMenuItem_Click);
|
||||
//
|
||||
// gameCubeToolStripMenuItem
|
||||
//
|
||||
this.gameCubeToolStripMenuItem.Name = "gameCubeToolStripMenuItem";
|
||||
this.gameCubeToolStripMenuItem.Size = new System.Drawing.Size(180, 22);
|
||||
this.gameCubeToolStripMenuItem.Text = "GameCube";
|
||||
this.gameCubeToolStripMenuItem.Click += new System.EventHandler(this.gameCubeToolStripMenuItem_Click);
|
||||
//
|
||||
// dSToolStripMenuItem
|
||||
//
|
||||
this.dSToolStripMenuItem.Name = "dSToolStripMenuItem";
|
||||
this.dSToolStripMenuItem.Size = new System.Drawing.Size(180, 22);
|
||||
this.dSToolStripMenuItem.Text = "DS";
|
||||
this.dSToolStripMenuItem.Click += new System.EventHandler(this.dSToolStripMenuItem_Click);
|
||||
//
|
||||
// wiiToolStripMenuItem
|
||||
//
|
||||
this.wiiToolStripMenuItem.Name = "wiiToolStripMenuItem";
|
||||
this.wiiToolStripMenuItem.Size = new System.Drawing.Size(180, 22);
|
||||
this.wiiToolStripMenuItem.Text = "Wii";
|
||||
this.wiiToolStripMenuItem.Click += new System.EventHandler(this.wiiToolStripMenuItem_Click);
|
||||
//
|
||||
// dSToolStripMenuItem1
|
||||
//
|
||||
this.dSToolStripMenuItem1.Name = "dSToolStripMenuItem1";
|
||||
this.dSToolStripMenuItem1.Size = new System.Drawing.Size(180, 22);
|
||||
this.dSToolStripMenuItem1.Text = "3DS";
|
||||
this.dSToolStripMenuItem1.Click += new System.EventHandler(this.dSToolStripMenuItem1_Click);
|
||||
//
|
||||
// switchToolStripMenuItem
|
||||
//
|
||||
this.switchToolStripMenuItem.Name = "switchToolStripMenuItem";
|
||||
this.switchToolStripMenuItem.Size = new System.Drawing.Size(180, 22);
|
||||
this.switchToolStripMenuItem.Text = "Switch";
|
||||
this.switchToolStripMenuItem.Click += new System.EventHandler(this.switchToolStripMenuItem_Click);
|
||||
//
|
||||
// itemIdTextBox
|
||||
//
|
||||
this.itemIdTextBox.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
|
||||
this.itemIdTextBox.Enabled = false;
|
||||
this.itemIdTextBox.Location = new System.Drawing.Point(132, 620);
|
||||
this.itemIdTextBox.Name = "itemIdTextBox";
|
||||
this.itemIdTextBox.PlaceholderText = "Item ID";
|
||||
this.itemIdTextBox.PlaceholderTextColor = System.Drawing.Color.Gray;
|
||||
this.itemIdTextBox.Size = new System.Drawing.Size(46, 20);
|
||||
this.itemIdTextBox.TabIndex = 78;
|
||||
this.itemIdTextBox.TextAlign = System.Windows.Forms.HorizontalAlignment.Center;
|
||||
this.infoTip.SetToolTip(this.itemIdTextBox, "The hexadecimal Item ID. Example: A31C");
|
||||
this.itemIdTextBox.TextChanged += new System.EventHandler(this.CurrentItemIdTextChanged);
|
||||
this.itemIdTextBox.Leave += new System.EventHandler(this.CurrentItemIdLostFocus);
|
||||
//
|
||||
// patternNameTextBox
|
||||
//
|
||||
this.patternNameTextBox.Anchor = System.Windows.Forms.AnchorStyles.None;
|
||||
this.patternNameTextBox.Location = new System.Drawing.Point(415, 538);
|
||||
this.patternNameTextBox.MaxLength = 16;
|
||||
this.patternNameTextBox.Name = "patternNameTextBox";
|
||||
this.patternNameTextBox.PlaceholderText = "Pattern Name";
|
||||
this.patternNameTextBox.PlaceholderTextColor = System.Drawing.Color.Gray;
|
||||
this.patternNameTextBox.Size = new System.Drawing.Size(100, 20);
|
||||
this.patternNameTextBox.TabIndex = 0;
|
||||
this.patternNameTextBox.TextChanged += new System.EventHandler(this.PatternEditorNameBox_TextChanged);
|
||||
//
|
||||
// patternEditorPictureBox
|
||||
//
|
||||
this.patternEditorPictureBox.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Stretch;
|
||||
this.patternEditorPictureBox.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
this.patternEditorPictureBox.InterpolationMode = System.Drawing.Drawing2D.InterpolationMode.Default;
|
||||
this.patternEditorPictureBox.Location = new System.Drawing.Point(0, 0);
|
||||
this.patternEditorPictureBox.Name = "patternEditorPictureBox";
|
||||
this.patternEditorPictureBox.Size = new System.Drawing.Size(513, 513);
|
||||
this.patternEditorPictureBox.SizeMode = System.Windows.Forms.PictureBoxSizeMode.StretchImage;
|
||||
this.patternEditorPictureBox.TabIndex = 0;
|
||||
this.patternEditorPictureBox.TabStop = false;
|
||||
this.patternEditorPictureBox.UseInternalInterpolationSetting = false;
|
||||
this.patternEditorPictureBox.MouseDown += new System.Windows.Forms.MouseEventHandler(this.PatternEditorBoxMouseDown);
|
||||
this.patternEditorPictureBox.MouseLeave += new System.EventHandler(this.PatternEditorBoxMouseLeave);
|
||||
this.patternEditorPictureBox.MouseMove += new System.Windows.Forms.MouseEventHandler(this.PatternEditorBoxMouseMove);
|
||||
this.patternEditorPictureBox.MouseUp += new System.Windows.Forms.MouseEventHandler(this.PatternEditorBoxMouseUp);
|
||||
//
|
||||
// MainForm
|
||||
//
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
|
||||
|
@ -2912,7 +2967,6 @@ private void InitializeComponent()
|
|||
patternsTab.ResumeLayout(false);
|
||||
patternsTab.PerformLayout();
|
||||
this.patternEditorPanel.ResumeLayout(false);
|
||||
((System.ComponentModel.ISupportInitialize)(this.patternEditorPictureBox)).EndInit();
|
||||
this.patternGroupTabControl.ResumeLayout(false);
|
||||
((System.ComponentModel.ISupportInitialize)(this.paletteColorSelectedPictureBox)).EndInit();
|
||||
((System.ComponentModel.ISupportInitialize)(this.paletteSelectionPictureBox)).EndInit();
|
||||
|
@ -2961,6 +3015,7 @@ private void InitializeComponent()
|
|||
((System.ComponentModel.ISupportInitialize)(this.acreHeightTrackBar)).EndInit();
|
||||
this.loadingPanel.ResumeLayout(false);
|
||||
this.loadingPanel.PerformLayout();
|
||||
((System.ComponentModel.ISupportInitialize)(this.patternEditorPictureBox)).EndInit();
|
||||
this.ResumeLayout(false);
|
||||
this.PerformLayout();
|
||||
|
||||
|
@ -3213,5 +3268,11 @@ private void InitializeComponent()
|
|||
private System.Windows.Forms.ToolStripSeparator toolStripSeparator3;
|
||||
private System.Windows.Forms.CheckBox PartTimeJobCheckBox;
|
||||
private System.Windows.Forms.Button itemSelection;
|
||||
private System.Windows.Forms.ToolStripMenuItem newToolStripMenuItem;
|
||||
private System.Windows.Forms.ToolStripMenuItem gameCubeToolStripMenuItem;
|
||||
private System.Windows.Forms.ToolStripMenuItem dSToolStripMenuItem;
|
||||
private System.Windows.Forms.ToolStripMenuItem wiiToolStripMenuItem;
|
||||
private System.Windows.Forms.ToolStripMenuItem dSToolStripMenuItem1;
|
||||
private System.Windows.Forms.ToolStripMenuItem switchToolStripMenuItem;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1262,6 +1262,14 @@ await Task.Run(() =>
|
|||
}
|
||||
|
||||
_selectedPlayer = _players.FirstOrNull(o => o.Exists);
|
||||
|
||||
|
||||
if(_selectedPlayer == null && SaveFile.isNew)
|
||||
{
|
||||
_selectedPlayer = Save.newPlayer;
|
||||
_players[0] = _selectedPlayer;
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
progressBar1.Value = 40;
|
||||
|
@ -4942,7 +4950,14 @@ private void StatueCheckBoxCheckedChanged(object sender, EventArgs e)
|
|||
private void GenerateRandomTownToolStripMenuItemClick(object sender, EventArgs e)
|
||||
{
|
||||
if (_loading || SaveFile == null) return;
|
||||
int? seed = !string.IsNullOrWhiteSpace(_seedBox.Text) ? (int)long.Parse(_seedBox.Text) : Environment.TickCount;
|
||||
int? seed = !string.IsNullOrWhiteSpace(_seedBox.Text) ? (int)long.Parse(_seedBox.Text) : Utility.getSeed();
|
||||
|
||||
|
||||
GenerateRandomTown(seed);
|
||||
}
|
||||
|
||||
private void GenerateRandomTown(int? seed)
|
||||
{
|
||||
|
||||
switch (SaveFile.SaveGeneration)
|
||||
{
|
||||
|
@ -5109,6 +5124,62 @@ private void itemSelection_Click_1(object sender, EventArgs e)
|
|||
SetCurrentItem(_itemSelectionDialog.SelectedItem);
|
||||
}
|
||||
|
||||
private void gameCubeToolStripMenuItem_Click(object sender, EventArgs e)
|
||||
{
|
||||
tpInit(SaveType.AnimalCrossing);
|
||||
}
|
||||
NewGamecubePrompt SV;
|
||||
SaveType gen;
|
||||
private async void tpInit(SaveType gen)
|
||||
{
|
||||
this.gen = gen;
|
||||
string code = "";
|
||||
SV = new NewGamecubePrompt();
|
||||
SV.connectButtonEvent(onGameCodeReceived);
|
||||
|
||||
SV.Show();
|
||||
|
||||
|
||||
}
|
||||
|
||||
private async void onGameCodeReceived(object sender, EventArgs e)
|
||||
{
|
||||
string code = SV.getValue();
|
||||
await SetupEditor(Save.Initialize(gen, code));
|
||||
|
||||
|
||||
while (_loading) { }
|
||||
GenerateRandomTown(Utility.getSeed());
|
||||
|
||||
SV.Hide();
|
||||
SV = null;
|
||||
}
|
||||
|
||||
private void dSToolStripMenuItem_Click(object sender, EventArgs e)
|
||||
{
|
||||
tpInit(SaveType.WildWorld);
|
||||
}
|
||||
|
||||
private void wiiToolStripMenuItem_Click(object sender, EventArgs e)
|
||||
{
|
||||
tpInit(SaveType.CityFolk);
|
||||
}
|
||||
|
||||
private void dSToolStripMenuItem1_Click(object sender, EventArgs e)
|
||||
{
|
||||
tpInit(SaveType.NewLeaf);
|
||||
}
|
||||
|
||||
private void switchToolStripMenuItem_Click(object sender, EventArgs e)
|
||||
{
|
||||
tpInit(SaveType.ACSwitch);
|
||||
}
|
||||
|
||||
private void newToolStripMenuItem_Click(object sender, EventArgs e)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
private void UpdateNewLeafOrdinances()
|
||||
{
|
||||
if (SaveFile == null || _loading || SaveFile.SaveGeneration != SaveGeneration.N3DS) return;
|
||||
|
|
164
ACSE.WinForms/MainForm/NewGamecubePrompt.Designer.cs
generated
Normal file
164
ACSE.WinForms/MainForm/NewGamecubePrompt.Designer.cs
generated
Normal file
|
@ -0,0 +1,164 @@
|
|||
namespace ACSE.WinForms
|
||||
{
|
||||
partial class NewGamecubePrompt
|
||||
{
|
||||
/// <summary>
|
||||
/// Required designer variable.
|
||||
/// </summary>
|
||||
private System.ComponentModel.IContainer components = null;
|
||||
|
||||
/// <summary>
|
||||
/// Clean up any resources being used.
|
||||
/// </summary>
|
||||
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
|
||||
protected override void Dispose(bool disposing)
|
||||
{
|
||||
if (disposing && (components != null))
|
||||
{
|
||||
components.Dispose();
|
||||
}
|
||||
base.Dispose(disposing);
|
||||
}
|
||||
|
||||
#region Windows Form Designer generated code
|
||||
|
||||
/// <summary>
|
||||
/// Required method for Designer support - do not modify
|
||||
/// the contents of this method with the code editor.
|
||||
/// </summary>
|
||||
private void InitializeComponent()
|
||||
{
|
||||
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(NewGamecubePrompt));
|
||||
this.saveFileDialog1 = new System.Windows.Forms.SaveFileDialog();
|
||||
this.button1 = new System.Windows.Forms.Button();
|
||||
this.comboBox1 = new System.Windows.Forms.ComboBox();
|
||||
this.label1 = new System.Windows.Forms.Label();
|
||||
this.textBox1 = new System.Windows.Forms.TextBox();
|
||||
this.label2 = new System.Windows.Forms.Label();
|
||||
this.label3 = new System.Windows.Forms.Label();
|
||||
this.textBox2 = new System.Windows.Forms.TextBox();
|
||||
this.label4 = new System.Windows.Forms.Label();
|
||||
this.SuspendLayout();
|
||||
//
|
||||
// button1
|
||||
//
|
||||
this.button1.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.button1.Location = new System.Drawing.Point(182, 131);
|
||||
this.button1.Name = "button1";
|
||||
this.button1.Size = new System.Drawing.Size(140, 55);
|
||||
this.button1.TabIndex = 0;
|
||||
this.button1.Text = "Submit";
|
||||
this.button1.UseVisualStyleBackColor = true;
|
||||
//
|
||||
// comboBox1
|
||||
//
|
||||
this.comboBox1.FormattingEnabled = true;
|
||||
this.comboBox1.Items.AddRange(new object[] {
|
||||
"E",
|
||||
"J",
|
||||
"P",
|
||||
"U"});
|
||||
this.comboBox1.Location = new System.Drawing.Point(129, 87);
|
||||
this.comboBox1.Name = "comboBox1";
|
||||
this.comboBox1.Size = new System.Drawing.Size(189, 21);
|
||||
this.comboBox1.Sorted = true;
|
||||
this.comboBox1.TabIndex = 1;
|
||||
this.comboBox1.Text = "E";
|
||||
this.comboBox1.TextUpdate += new System.EventHandler(this.onChange);
|
||||
//
|
||||
// label1
|
||||
//
|
||||
this.label1.AutoSize = true;
|
||||
this.label1.Font = new System.Drawing.Font("Microsoft Sans Serif", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
|
||||
this.label1.Location = new System.Drawing.Point(12, 85);
|
||||
this.label1.Name = "label1";
|
||||
this.label1.Size = new System.Drawing.Size(68, 20);
|
||||
this.label1.TabIndex = 2;
|
||||
this.label1.Text = "Region :";
|
||||
//
|
||||
// textBox1
|
||||
//
|
||||
this.textBox1.Enabled = false;
|
||||
this.textBox1.Location = new System.Drawing.Point(129, 12);
|
||||
this.textBox1.Name = "textBox1";
|
||||
this.textBox1.ReadOnly = true;
|
||||
this.textBox1.Size = new System.Drawing.Size(189, 20);
|
||||
this.textBox1.TabIndex = 3;
|
||||
this.textBox1.Text = "G";
|
||||
this.textBox1.TextChanged += new System.EventHandler(this.onChange);
|
||||
//
|
||||
// label2
|
||||
//
|
||||
this.label2.AutoSize = true;
|
||||
this.label2.Font = new System.Drawing.Font("Microsoft Sans Serif", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
|
||||
this.label2.Location = new System.Drawing.Point(12, 10);
|
||||
this.label2.Name = "label2";
|
||||
this.label2.Size = new System.Drawing.Size(113, 20);
|
||||
this.label2.TabIndex = 4;
|
||||
this.label2.Text = "Console Code:";
|
||||
//
|
||||
// label3
|
||||
//
|
||||
this.label3.AutoSize = true;
|
||||
this.label3.Font = new System.Drawing.Font("Microsoft Sans Serif", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
|
||||
this.label3.Location = new System.Drawing.Point(12, 46);
|
||||
this.label3.Name = "label3";
|
||||
this.label3.Size = new System.Drawing.Size(63, 20);
|
||||
this.label3.TabIndex = 6;
|
||||
this.label3.Text = "Title ID:";
|
||||
//
|
||||
// textBox2
|
||||
//
|
||||
this.textBox2.Location = new System.Drawing.Point(129, 48);
|
||||
this.textBox2.Name = "textBox2";
|
||||
this.textBox2.Size = new System.Drawing.Size(189, 20);
|
||||
this.textBox2.TabIndex = 5;
|
||||
this.textBox2.Text = "AF";
|
||||
this.textBox2.TextChanged += new System.EventHandler(this.onChange);
|
||||
//
|
||||
// label4
|
||||
//
|
||||
this.label4.AutoSize = true;
|
||||
this.label4.Location = new System.Drawing.Point(13, 147);
|
||||
this.label4.Name = "label4";
|
||||
this.label4.Size = new System.Drawing.Size(144, 39);
|
||||
this.label4.TabIndex = 7;
|
||||
this.label4.Text = "USA - E\r\nEurope - P (or U for Australia)\r\nJapan - J";
|
||||
//
|
||||
// NewGamecubePrompt
|
||||
//
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||
this.ClientSize = new System.Drawing.Size(334, 198);
|
||||
this.Controls.Add(this.label4);
|
||||
this.Controls.Add(this.label3);
|
||||
this.Controls.Add(this.textBox2);
|
||||
this.Controls.Add(this.label2);
|
||||
this.Controls.Add(this.textBox1);
|
||||
this.Controls.Add(this.label1);
|
||||
this.Controls.Add(this.comboBox1);
|
||||
this.Controls.Add(this.button1);
|
||||
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.Fixed3D;
|
||||
this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
|
||||
this.MaximizeBox = false;
|
||||
this.MinimizeBox = false;
|
||||
this.Name = "NewGamecubePrompt";
|
||||
this.Text = "Create New Game - GAFE";
|
||||
this.ResumeLayout(false);
|
||||
this.PerformLayout();
|
||||
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
private System.Windows.Forms.SaveFileDialog saveFileDialog1;
|
||||
private System.Windows.Forms.Button button1;
|
||||
private System.Windows.Forms.ComboBox comboBox1;
|
||||
private System.Windows.Forms.Label label1;
|
||||
private System.Windows.Forms.TextBox textBox1;
|
||||
private System.Windows.Forms.Label label2;
|
||||
private System.Windows.Forms.Label label3;
|
||||
private System.Windows.Forms.TextBox textBox2;
|
||||
private System.Windows.Forms.Label label4;
|
||||
}
|
||||
}
|
39
ACSE.WinForms/MainForm/NewGamecubePrompt.cs
Normal file
39
ACSE.WinForms/MainForm/NewGamecubePrompt.cs
Normal file
|
@ -0,0 +1,39 @@
|
|||
using ACSE.Core.Saves;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Data;
|
||||
using System.Drawing;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows.Forms;
|
||||
using static System.Windows.Forms.VisualStyles.VisualStyleElement;
|
||||
|
||||
namespace ACSE.WinForms
|
||||
{
|
||||
public partial class NewGamecubePrompt : Form
|
||||
{
|
||||
public NewGamecubePrompt()
|
||||
{
|
||||
InitializeComponent();
|
||||
|
||||
}
|
||||
|
||||
|
||||
internal void connectButtonEvent(EventHandler theEvent)
|
||||
{
|
||||
button1.Click += theEvent;
|
||||
}
|
||||
|
||||
internal string getValue()
|
||||
{
|
||||
return $"{textBox1.Text}{textBox2.Text}{comboBox1.Text}";
|
||||
}
|
||||
|
||||
private void onChange(object sender, EventArgs e)
|
||||
{
|
||||
Text = $"Create New Game - {getValue()}";
|
||||
}
|
||||
}
|
||||
}
|
6296
ACSE.WinForms/MainForm/NewGamecubePrompt.resx
Normal file
6296
ACSE.WinForms/MainForm/NewGamecubePrompt.resx
Normal file
File diff suppressed because it is too large
Load diff
2
ACSE.WinForms/Properties/Resources.Designer.cs
generated
2
ACSE.WinForms/Properties/Resources.Designer.cs
generated
|
@ -19,7 +19,7 @@ namespace ACSE.WinForms.Properties {
|
|||
// class via a tool like ResGen or Visual Studio.
|
||||
// To add or remove a member, edit your .ResX file then rerun ResGen
|
||||
// with the /str option, or rebuild your VS project.
|
||||
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "16.0.0.0")]
|
||||
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "17.0.0.0")]
|
||||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
|
||||
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
|
||||
internal class Resources {
|
||||
|
|
2
ACSE.WinForms/Properties/Settings.Designer.cs
generated
2
ACSE.WinForms/Properties/Settings.Designer.cs
generated
|
@ -12,7 +12,7 @@ namespace ACSE.WinForms.Properties {
|
|||
|
||||
|
||||
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
|
||||
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "16.0.0.0")]
|
||||
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "17.7.0.0")]
|
||||
internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase {
|
||||
|
||||
private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings())));
|
||||
|
|
|
@ -17,6 +17,12 @@ public void Set_Secure_NAND_Value(ulong value)
|
|||
textBox1.Text = value.ToString("X16");
|
||||
}
|
||||
|
||||
|
||||
internal void disconnectDefaultAction()
|
||||
{
|
||||
button1.Click -= button1_Click;
|
||||
}
|
||||
|
||||
private void button1_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (MainForm.SaveFile != null && (MainForm.SaveFile.SaveGeneration == SaveGeneration.N3DS))
|
||||
|
|
|
@ -9,7 +9,7 @@
|
|||
<AppDesignerFolder>Properties</AppDesignerFolder>
|
||||
<RootNamespace>ACSE.Tests</RootNamespace>
|
||||
<AssemblyName>ACSE.Tests</AssemblyName>
|
||||
<TargetFrameworkVersion>v4.7.2</TargetFrameworkVersion>
|
||||
<TargetFrameworkVersion>v4.8.1</TargetFrameworkVersion>
|
||||
<FileAlignment>512</FileAlignment>
|
||||
<ProjectTypeGuids>{3AC096D0-A1C2-E12C-1390-A8335801FDAB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
|
||||
<VisualStudioVersion Condition="'$(VisualStudioVersion)' == ''">15.0</VisualStudioVersion>
|
||||
|
|
Loading…
Reference in a new issue