Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
120 changes: 120 additions & 0 deletions CHANGELOG.md

Large diffs are not rendered by default.

6 changes: 6 additions & 0 deletions mage/App.config
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,12 @@
<setting name="MFglobalBookmarks" serializeAs="String">
<value />
</setting>
<setting name="musiclistsPath" serializeAs="String">
<value />
</setting>
<setting name="musiclistName" serializeAs="String">
<value />
</setting>
</mage.Properties.Settings>
</userSettings>
<runtime>
Expand Down
137 changes: 99 additions & 38 deletions mage/Editors/FormHeader.Designer.cs

Large diffs are not rendered by default.

86 changes: 86 additions & 0 deletions mage/Editors/FormHeader.cs
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,18 @@ public partial class FormHeader : Form
private ByteStream romStream;
private bool loading;
private Status status;
private bool syncingMusic;

// constructor
public FormHeader(FormMain main)
{
InitializeComponent();

LoadMusicComboobox();

comboBoxMuslist.SelectedIndexChanged += comboBoxMuslist_SelectedIndexChanged;
textBox_music.TextChanged += textBox_music_TextChanged;

//Theming
ThemeSwitcher.ChangeTheme(Controls, this);
ThemeSwitcher.InjectPaintOverrides(Controls);
Expand All @@ -42,6 +48,85 @@ public FormHeader(FormMain main)

comboBox_area.SelectedIndex = main.Room.AreaID;
comboBox_room.SelectedIndex = main.Room.RoomID;

}

private void LoadMusicComboobox()
{
comboBoxMuslist.Items.Clear();

string text = Muslist.ReadSelectedMusiclist();

if (string.IsNullOrWhiteSpace(text))
return;

string[] lines = text.Split(
new[] { "\r\n", "\n" },
StringSplitOptions.None
);

foreach (string rawLine in lines)
{
string name = rawLine.Trim();

if (name == "")
name = "(blank)";

comboBoxMuslist.Items.Add(name);
}
}

private void UpdateMusicDropdownFromTextbox()
{
if (syncingMusic)
return;

syncingMusic = true;

try
{
ushort musicId = Hex.ToUshort(textBox_music.Text);
int index = musicId;

if (index >= 0 && index < comboBoxMuslist.Items.Count)
comboBoxMuslist.SelectedIndex = index;
else
comboBoxMuslist.SelectedIndex = -1;
}
catch
{
comboBoxMuslist.SelectedIndex = -1;
}

syncingMusic = false;
}

private void comboBoxMuslist_SelectedIndexChanged(object sender, EventArgs e)
{
if (syncingMusic)
return;

if (comboBoxMuslist.SelectedIndex == -1)
return;

syncingMusic = true;

textBox_music.Text = Hex.ToString((ushort)comboBoxMuslist.SelectedIndex);

syncingMusic = false;

if (!loading)
status.ChangeMade();
}

private void textBox_music_TextChanged(object sender, EventArgs e)
{
UpdateMusicDropdownFromTextbox();

if (loading)
return;

status.ChangeMade();
}

private void comboBox_area_SelectedIndexChanged(object sender, EventArgs e)
Expand Down Expand Up @@ -140,6 +225,7 @@ public void FillValues()
textBox_effect.Text = Hex.ToString(effect);
textBox_effectYpos.Text = Hex.ToString(effectY);
textBox_music.Text = Hex.ToString(music);
UpdateMusicDropdownFromTextbox();

lbl_offset.Text = $"Offset: {Hex.ToString(offset)}";

Expand Down
2 changes: 1 addition & 1 deletion mage/Editors/FormHeader.resx
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@
<value>17, 17</value>
</metadata>
<metadata name="$this.TrayHeight" type="System.Int32, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>58</value>
<value>25</value>
</metadata>
<assembly alias="System.Drawing" name="System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
<data name="$this.Icon" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
Expand Down
8 changes: 8 additions & 0 deletions mage/FormMain.cs
Original file line number Diff line number Diff line change
Expand Up @@ -287,6 +287,10 @@ private void InitializeSettings()
Sound.SoundPacksPath = Settings.Default.soundPackPath;
Sound.SoundPackName = Settings.Default.soundPackName;

//Music list paths
Muslist.MusiclistsPath = Settings.Default.musiclistsPath;
Muslist.MusiclistName = Settings.Default.musiclistName;

// Bookmarks
try { ZMGlobalBookmarks = BookmarkManager.DeserializeCollections(Settings.Default.ZMglobalBookmarks); }
catch { ZMGlobalBookmarks = new(); }
Expand Down Expand Up @@ -341,6 +345,10 @@ private void SaveSettings()
Settings.Default.soundPackPath = Sound.SoundPacksPath;
Settings.Default.soundPackName = Sound.SoundPackName;

//Music lists
Settings.Default.musiclistsPath = Muslist.MusiclistsPath;
Settings.Default.musiclistName = Muslist.MusiclistName;

//Bookmarks
Settings.Default.ZMglobalBookmarks = BookmarkManager.SerializeCollections(ZMGlobalBookmarks);
Settings.Default.MFglobalBookmarks = BookmarkManager.SerializeCollections(MFGlobalBookmarks);
Expand Down
1 change: 1 addition & 0 deletions mage/Options/PageLists.cs
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ public static class PageLists
new() { Name = "Soundpacks", Page = new PageSoundpacks(), RequiresROM = false },
new() { Name = "Updates", Page = new PageUpdates(), RequiresROM = false },
new() { Name = "Advanced", Page = new PageAdvanced(), RequiresROM=false },
new() { Name = "Music Lists", Page = new PageMusiclists(), RequiresROM=false },
};

public static List<OptionsPage> ProjectOptionsPages = new()
Expand Down
159 changes: 159 additions & 0 deletions mage/Options/PagesApplication/PageMusiclists.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading