mirror of
https://github.com/kwsch/pk3DS.git
synced 2026-08-27 20:26:04 -05:00
Revert implicit byte cast
similar to earlier pkNX/pkhex commit; this wasn't an intended c# feature
This commit is contained in:
@@ -155,9 +155,9 @@ internal static NCSD SetNCSD(NCCH NCCH, bool Card2, RichTextBox TB_Progress = nu
|
||||
}
|
||||
NCSD.Header.flags = new byte[0x8];
|
||||
NCSD.Header.flags[0] = 0; // 0-255 seconds of waiting for save writing.
|
||||
NCSD.Header.flags[3] = NCSD.Card2 ? 2 : 1; // Media Card Device: 1 = NOR Flash, 2 = None, 3 = BT
|
||||
NCSD.Header.flags[3] = NCSD.Card2 ? (byte)2 : (byte)1; // Media Card Device: 1 = NOR Flash, 2 = None, 3 = BT
|
||||
NCSD.Header.flags[4] = 1; // Media Platform Index: 1 = CTR
|
||||
NCSD.Header.flags[5] = NCSD.Card2 ? 2 : 1; // Media Type Index: 0 = Inner Device, 1 = Card1, 2 = Card2, 3 = Extended Device
|
||||
NCSD.Header.flags[5] = NCSD.Card2 ? (byte)2 : (byte)1; // Media Type Index: 0 = Inner Device, 1 = Card1, 2 = Card2, 3 = Extended Device
|
||||
NCSD.Header.flags[6] = 0; // Media Unit Size. Same as NCCH.
|
||||
NCSD.Header.flags[7] = 0; // Old Media Card Device.
|
||||
NCSD.Header.NCCHIdTable = new ulong[8];
|
||||
|
||||
@@ -63,7 +63,7 @@ public override int HeldItem
|
||||
public bool IsEgg
|
||||
{
|
||||
get => Data[0xA] == 1;
|
||||
set => Data[0xA] = value ? 1 : 0;
|
||||
set => Data[0xA] = value ? (byte)1 : (byte)0;
|
||||
}
|
||||
|
||||
public int SpecialMove
|
||||
|
||||
@@ -33,7 +33,7 @@ public TrainerData7(byte[] tr = null, byte[] tp = null)
|
||||
public int Item4 { get => BitConverter.ToUInt16(trdata, 0x0A); set => BitConverter.GetBytes((ushort)value).CopyTo(trdata, 0x0A); }
|
||||
|
||||
public int AI { get => trdata[0x0C]; set => trdata[0x0C] = (byte)value; }
|
||||
public bool Flag { get => trdata[0x0D] == 1; set => trdata[0x0D] = value ? 1 : 0; }
|
||||
public bool Flag { get => trdata[0x0D] == 1; set => trdata[0x0D] = value ? (byte)1 : (byte)0; }
|
||||
public int Money { get => trdata[0x11]; set => trdata[0x11] = (byte)value; }
|
||||
|
||||
public void Write(out byte[] tr, out byte[] pk)
|
||||
|
||||
@@ -34,6 +34,6 @@ public override byte[] Write()
|
||||
public int SpecialZ_Item { get => BitConverter.ToUInt16(Data, 0x4C); set => BitConverter.GetBytes((ushort)value).CopyTo(Data, 0x4C); }
|
||||
public int SpecialZ_BaseMove { get => BitConverter.ToUInt16(Data, 0x4E); set => BitConverter.GetBytes((ushort)value).CopyTo(Data, 0x4E); }
|
||||
public int SpecialZ_ZMove { get => BitConverter.ToUInt16(Data, 0x50); set => BitConverter.GetBytes((ushort)value).CopyTo(Data, 0x50); }
|
||||
public bool LocalVariant { get => Data[0x52] == 1; set => Data[0x52] = value ? 1 : 0; }
|
||||
public bool LocalVariant { get => Data[0x52] == 1; set => Data[0x52] = value ? (byte)1 : (byte)0; }
|
||||
}
|
||||
}
|
||||
|
||||
@@ -132,7 +132,7 @@ private void SetEntry()
|
||||
{
|
||||
if (me.Method[i] > 1)
|
||||
return; // Shouldn't hit this.
|
||||
me.Method[i] = checkbox_spec[i].Checked ? 1 : 0;
|
||||
me.Method[i] = checkbox_spec[i].Checked ? (byte)1 : (byte)0;
|
||||
me.Argument[i] = (ushort)WinFormsUtil.GetIndex(item_spec[i]);
|
||||
me.Form[i] = (ushort)forme_spec[i].SelectedIndex;
|
||||
}
|
||||
|
||||
@@ -139,11 +139,11 @@ private void InsertFile(string path)
|
||||
{
|
||||
if (DialogResult.Yes != WinFormsUtil.Prompt(MessageBoxButtons.YesNo, "Overwrite image?"))
|
||||
return;
|
||||
byte[] data = File.ReadAllBytes(path);
|
||||
byte[] bclim;
|
||||
|
||||
if (Path.GetExtension(path) == ".bclim") // bclim opened
|
||||
{
|
||||
byte[] data = File.ReadAllBytes(path);
|
||||
var img = BCLIM.Analyze(data, path);
|
||||
if (img.Width != PB_Image.Width || img.Height != PB_Image.Height)
|
||||
{
|
||||
@@ -155,8 +155,7 @@ private void InsertFile(string path)
|
||||
}
|
||||
else // image
|
||||
{
|
||||
using Stream BitmapStream = new MemoryStream(data);
|
||||
Image img = Image.FromStream(BitmapStream);
|
||||
Image img = Image.FromFile(path);
|
||||
if (img.Width != PB_Image.Width || img.Height != PB_Image.Height)
|
||||
{
|
||||
WinFormsUtil.Alert("Image sizes do not match.",
|
||||
|
||||
@@ -132,7 +132,7 @@ private void SetEntry()
|
||||
{
|
||||
if (me.Method[i] > 1)
|
||||
return; // Shouldn't hit this.
|
||||
me.Method[i] = checkbox_spec[i].Checked ? 1 : 0;
|
||||
me.Method[i] = checkbox_spec[i].Checked ? (byte)1 : (byte)0;
|
||||
me.Argument[i] = (ushort)WinFormsUtil.GetIndex(item_spec[i]);
|
||||
me.Form[i] = (ushort)forme_spec[i].SelectedIndex;
|
||||
}
|
||||
|
||||
@@ -117,7 +117,7 @@ private void B_Save_Click(object sender, EventArgs e)
|
||||
{
|
||||
WriteCodePatch();
|
||||
if (CHK_EverythingShiny.Enabled)
|
||||
exefsData[alwaysIndex] = CHK_EverythingShiny.Checked ? 0xEA : 0x0A;
|
||||
exefsData[alwaysIndex] = CHK_EverythingShiny.Checked ? (byte)0xEA : (byte)0x0A;
|
||||
File.WriteAllBytes(codebin, exefsData);
|
||||
Close();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user