Skip to content

Commit

Permalink
Loads of char assets; Track panel saving; better pre-RB3 support
Browse files Browse the repository at this point in the history
  • Loading branch information
ihatecompvir committed Jan 11, 2025
1 parent ce8c55d commit 83ea523
Show file tree
Hide file tree
Showing 33 changed files with 1,501 additions and 374 deletions.
47 changes: 47 additions & 0 deletions MiloEditor/MainForm.cs
Original file line number Diff line number Diff line change
Expand Up @@ -367,6 +367,7 @@ private void MiloSceneItemsTree_NodeMouseClick(object sender, TreeNodeMouseClick
contextMenu.Items.Add(new ToolStripMenuItem("Duplicate Directory", SystemIcons.Information.ToBitmap(), (s, ev) => DuplicateDirectory(e.Node)));
contextMenu.Items.Add(new ToolStripMenuItem("Rename Directory", SystemIcons.Information.ToBitmap(), (s, ev) => RenameDirectory(e.Node)));
contextMenu.Items.Add(new ToolStripMenuItem("Merge Directory", SystemIcons.Information.ToBitmap(), (s, ev) => MergeDirectory(e.Node)));
contextMenu.Items.Add(new ToolStripMenuItem("Export Directory", SystemIcons.Information.ToBitmap(), (s, ev) => ExportDirectory(e.Node)));
contextMenu.Items.Add(new ToolStripSeparator());
contextMenu.Items.Add(new ToolStripMenuItem("Add Inlined Subdirectory", SystemIcons.Information.ToBitmap(), (s, ev) => AddInlinedSubdirectory(e.Node)));
contextMenu.Items.Add(new ToolStripSeparator());
Expand Down Expand Up @@ -581,6 +582,52 @@ private void MergeDirectory(TreeNode node)
PopulateListWithEntries();
}
}

private void ExportDirectory(TreeNode node)
{
// get directory from node
DirectoryMeta dirEntry = (DirectoryMeta)node.Tag;

if (dirEntry != null)
{

// bring up the milo save options dialog
MiloSaveOptionsForm miloSaveOptionsForm = new MiloSaveOptionsForm();
miloSaveOptionsForm.ShowDialog();

if (miloSaveOptionsForm.DialogResult == DialogResult.OK)
{
SaveFileDialog saveFileDialog = new SaveFileDialog
{
Filter = "Milo Scenes|*.milo_ps2;*.milo_xbox;*.milo_ps3;*.milo_wii;*.milo_pc;*.rnd;*.rnd_ps2;*.rnd_xbox;*.rnd_gc;*.kr",
Title = "Save Milo Scene As...",
FileName = dirEntry.name
};

// create a milofile to serialize
MiloFile file = new MiloFile(dirEntry);
file.endian = currentMiloScene.endian;

if (saveFileDialog.ShowDialog() == DialogResult.OK)
{
file.Save(saveFileDialog.FileName, miloSaveOptionsForm.compressionType, 0x810, Endian.LittleEndian, miloSaveOptionsForm.useBigEndian ? Endian.BigEndian : Endian.LittleEndian);
MessageBox.Show("Milo scene saved to " + saveFileDialog.FileName + " successfully!", "Success", MessageBoxButtons.OK, MessageBoxIcon.Information);
}
else
{
return;
}
}
else
{
return;
}
}
else
{
MessageBox.Show("No Milo scene loaded to save!", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
}
}
private void ExtractAsset(TreeNode node)
{
// create a file save dialog
Expand Down
42 changes: 22 additions & 20 deletions MiloLib/Assets/Band/BandCrowdMeterDir.cs
Original file line number Diff line number Diff line change
Expand Up @@ -136,36 +136,38 @@ public override void Write(EndianWriter writer, bool standalone, DirectoryMeta p
}
return;
}

if (!entry.isProxy)
else
{
if (revision < 3)
if (!entry.isProxy)
{
writer.WriteUInt32((uint)groups.Count);
foreach (var group in groups)
if (revision < 3)
{
Symbol.Write(writer, group);
writer.WriteUInt32((uint)groups.Count);
foreach (var group in groups)
{
Symbol.Write(writer, group);
}
}
}

if (revision >= 2)
{
writer.WriteUInt32((uint)colors.Count);
foreach (var color in colors)
if (revision >= 2)
{
color.Write(writer);
writer.WriteUInt32((uint)colors.Count);
foreach (var color in colors)
{
color.Write(writer);
}
}
}

}
if (revision >= 1)
writer.WriteFloat(peakValue);
}
if (revision >= 1)
writer.WriteFloat(peakValue);

base.Write(writer, false, parent, entry);
base.Write(writer, false, parent, entry);

if (standalone)
{
writer.WriteBlock(new byte[4] { 0xAD, 0xDE, 0xAD, 0xDE });
if (standalone)
{
writer.WriteBlock(new byte[4] { 0xAD, 0xDE, 0xAD, 0xDE });
}
}
}

Expand Down
5 changes: 0 additions & 5 deletions MiloLib/Assets/Band/BandCrowdMeterIcon.cs
Original file line number Diff line number Diff line change
Expand Up @@ -45,11 +45,6 @@ public BandCrowdMeterIcon Read(EndianReader reader, bool standalone, DirectoryMe
if (BitConverter.IsLittleEndian) (revision, altRevision) = ((ushort)(combinedRevision & 0xFFFF), (ushort)(combinedRevision >> 16 & 0xFFFF));
else (altRevision, revision) = ((ushort)(combinedRevision & 0xFFFF), (ushort)(combinedRevision >> 16 & 0xFFFF));

if (revision > 0)
{
throw new UnsupportedAssetRevisionException("CrowdMeterDir", revision);
}

base.Read(reader, false, parent, entry);

if (standalone)
Expand Down
3 changes: 3 additions & 0 deletions MiloLib/Assets/Band/BandStarDisplay.cs
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,9 @@ public override void Write(EndianWriter writer, bool standalone, DirectoryMeta p
{
writer.WriteUInt32(BitConverter.IsLittleEndian ? (uint)(altRevision << 16 | revision) : (uint)(revision << 16 | altRevision));

if (entry != null && entry.isProxy)
Symbol.Write(writer, starType);

base.Write(writer, false, parent, entry);

if (standalone)
Expand Down
4 changes: 2 additions & 2 deletions MiloLib/Assets/Band/UI/BandButton.cs
Original file line number Diff line number Diff line change
Expand Up @@ -138,8 +138,8 @@ public override void Write(EndianWriter writer, bool standalone, DirectoryMeta p
{
if (revision <= 4)
{
trans.Write(writer, false, parent, entry);
draw.Write(writer, false, parent, entry);
trans.Write(writer, false, true);
draw.Write(writer, false, true);
}
else
{
Expand Down
Loading

0 comments on commit 83ea523

Please sign in to comment.