Skip to content

Commit

Permalink
Fix scene export error
Browse files Browse the repository at this point in the history
  • Loading branch information
petfriendamy committed Dec 18, 2024
1 parent a9ad21e commit 56424be
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 8 deletions.
3 changes: 2 additions & 1 deletion src/FFText.cs
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ public class FFText : IComparable
'∞', '±', '≤', '≥', '¥', 'µ', '∂', 'Σ', 'Π', 'π', '⌡', 'ª', 'º', 'Ω', 'æ', 'ø',
'¿', '¡', '¬', '√', 'ƒ', '≈', '∆', '«', '»', '…', '?', 'À', 'Ã', 'Õ', 'Œ', 'œ',
'–', '—', '“', '”', '‘', '’', '÷', '◊', 'ÿ', 'Ÿ', '⁄', '¤', '‹', '›', 'fi', 'fl',
'■', '▪', '‚', '„', '‰', 'Â', 'Ê', 'Ë', 'Á', 'È', 'í', 'î', 'ï', 'ì', 'Ó', 'Ô',
'■', '▪', '‚', '„', '‰', 'Â', 'Ê', 'Ë', 'Á', 'È', 'Í', 'Î', 'Ï', 'Ì', 'Ó', 'Ô',
' ', 'Ò', 'Ù', 'Û'
}.AsReadOnly();

Expand Down Expand Up @@ -207,6 +207,7 @@ public byte[] GetBytes(ParameterTypes type = ParameterTypes.String)
switch (type)
{
case ParameterTypes.OneByte:
case ParameterTypes.ReadWrite:
singleByte[0] = (byte)ToInt();
return singleByte;
case ParameterTypes.TwoByte:
Expand Down
6 changes: 3 additions & 3 deletions src/KernelEditor/KernelChunkExportForm.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ public KernelChunkExportForm(Kernel kernel)
{
InitializeComponent();
this.kernel = kernel;
checkBoxes = new CheckBox[Kernel.SECTION_COUNT]
{
checkBoxes =
[
checkBoxChunk1, checkBoxChunk2, checkBoxChunk3, checkBoxChunk4,
checkBoxChunk5, checkBoxChunk6, checkBoxChunk7, checkBoxChunk8,
checkBoxChunk9, checkBoxChunk10, checkBoxChunk11, checkBoxChunk12,
Expand All @@ -21,7 +21,7 @@ public KernelChunkExportForm(Kernel kernel)
checkBoxChunk21, checkBoxChunk22, checkBoxChunk23, checkBoxChunk24,
checkBoxChunk25, checkBoxChunk26, checkBoxChunk27

};
];
}

private void KernelChunkExportForm_Load(object sender, EventArgs e)
Expand Down
8 changes: 4 additions & 4 deletions src/SceneEditor/Scene.cs
Original file line number Diff line number Diff line change
Expand Up @@ -457,15 +457,15 @@ public byte[] GetRawData()
{
atk = AttackList[i];
if (atk == null) { writer.Write(HexParser.NULL_OFFSET_16_BIT); }
else { writer.Write(atk.Index); }
else { writer.Write((ushort)atk.Index); }
}
for (i = 0; i < ATTACK_COUNT; ++i)
{
atk = AttackList[i];
if (atk == null) { writer.Write(HexParser.GetNullBlock(NAME_LENGTH)); }
else
{
writer.Write(new FFText(atk.Name, NAME_LENGTH).GetBytes());
writer.Write(new FFText(atk.Name).GetBytes(NAME_LENGTH));
}
}
}
Expand Down Expand Up @@ -535,8 +535,8 @@ public byte[] GetRawData()
}

//return a copy of the newly updated data
var copy = new byte[rawData.Length];
Array.Copy(rawData, copy, rawData.Length);
var copy = new byte[UNCOMPRESSED_BLOCK_SIZE];
Array.Copy(rawData, copy, UNCOMPRESSED_BLOCK_SIZE);
return copy;
}
catch (Exception ex)
Expand Down
3 changes: 3 additions & 0 deletions src/SceneEditor/SceneExportForm.cs
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@ private async void buttonExport_Click(object sender, EventArgs e)
{
groupBoxExport.Enabled = false;
buttonExport.Enabled = false;
processing = true;
await ExportScene(selectedScene, path);
progressBarSaving.Value = 100;
success = true;
Expand Down Expand Up @@ -122,6 +123,8 @@ private async void buttonExport_Click(object sender, EventArgs e)
catch (Exception ex)
{
MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
groupBoxExport.Enabled = true;
buttonExport.Enabled = true;
progressBarSaving.Value = 0;
processing = false;
}
Expand Down

0 comments on commit 56424be

Please sign in to comment.