Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
63 commits
Select commit Hold shift + click to select a range
85e417d
A few changes to WinForms stuff
PlatinumLucario Sep 4, 2022
ccdf3a9
Added GTK3 project
PlatinumLucario Sep 4, 2022
7d54bf9
Added MenuBar and methods
PlatinumLucario Sep 9, 2022
566ac66
Added Buttons, SpinButton and Scales
PlatinumLucario Sep 11, 2022
6a5c7b7
Added TreeListView, sequences kinda working, but still needs more work
PlatinumLucario Sep 12, 2022
d98f61f
Added Wii support, opens SWD and SMD in separate dialogs
PlatinumLucario Jan 29, 2023
b6b7b07
Using Gir.Core to make a GTK4 UI
PlatinumLucario Jul 4, 2023
4bec866
Removed SDL2-CS and portaudio-sharp projects.
PlatinumLucario Jul 8, 2023
f90058c
MP2K Engine is now useable in GTK4 GUI
PlatinumLucario Aug 3, 2023
277c1e7
Pause and Stop buttons are now usable
PlatinumLucario Aug 5, 2023
24a950a
A few adjustments
PlatinumLucario Aug 25, 2023
9a74e18
Fixed an issue where local SWD wasn't being read, and where it tries …
PlatinumLucario Nov 11, 2023
3db6e14
Amending previous commit
PlatinumLucario Nov 11, 2023
fbc1322
More fixes, more failsafes implemented,
PlatinumLucario Nov 13, 2023
5c13c54
Sync with net-6 branch
PlatinumLucario Nov 19, 2023
037dccb
Merging conflicts
PlatinumLucario Nov 19, 2023
f274d74
Another sync with net-6 branch (didn't realise it wasn't up to date)
PlatinumLucario Nov 19, 2023
2b9db7c
Merge branch 'new-gui-experimental' of https://github.com/PlatinumLuc…
PlatinumLucario Nov 19, 2023
b3e547b
Merged the changes from the net-6 branch properly this time
PlatinumLucario Nov 19, 2023
8a7b7b8
Repairing changes, fixing repo and updating code for new GUI
PlatinumLucario Nov 19, 2023
b1cf476
Merging upstream with this branch
PlatinumLucario Nov 20, 2023
0d6df32
Staged changes applied and adjustments
PlatinumLucario Nov 20, 2023
326094d
SWDB and SMDB playback is now fully functional
PlatinumLucario Dec 17, 2023
cf24612
Proper support for sample looping
PlatinumLucario Dec 22, 2023
54e0b22
Accurate BaseTimer pitch for Wii DSE
PlatinumLucario Dec 27, 2023
4ec3e3d
Small adjustments to Wii BaseTimer
PlatinumLucario Dec 28, 2023
b0d14fb
[MP2K] Sonic Advance 2
Kermalis Feb 5, 2024
f2c0375
Updated nuget packages
PlatinumLucario Feb 28, 2024
22c6051
Merged changes with upstream net6 branch
PlatinumLucario Feb 28, 2024
56ec3fb
Added PortAudio backend
PlatinumLucario Feb 28, 2024
33b2443
PortAudio buffers are now functional
PlatinumLucario Jul 12, 2024
9e3fdc7
Merged new audio backend (PortAudio)
PlatinumLucario Jul 12, 2024
d245937
Repaired GTK4 GUI
PlatinumLucario Jul 13, 2024
f2a0276
Some fixes
PlatinumLucario Jul 19, 2024
e220aea
Some minor updates and experiments
PlatinumLucario Sep 10, 2024
6ada169
Fixed position bar issues
PlatinumLucario Nov 21, 2024
1f8bff0
New Sequence List and Playlist
PlatinumLucario Dec 24, 2024
e847981
Bug fixes - Legacy GUI (WinForms)
PlatinumLucario Dec 29, 2024
0bdd924
Added Piano
PlatinumLucario Dec 28, 2024
2c741b2
Added Track Info widget, and some changes
PlatinumLucario Jan 8, 2025
be4a7ef
New custom Velocity Bars, and detachable widgets!
PlatinumLucario Jan 12, 2025
ed24f7a
Added Track Viewer and other changes
PlatinumLucario Jan 13, 2025
2a0de94
Adjustable tempo controls
PlatinumLucario Jan 13, 2025
e3f89b9
Added native dependencies, and other fixes
PlatinumLucario Jan 21, 2025
4a142c7
Updated README
PlatinumLucario Jan 21, 2025
6d850b7
WinForms (Legacy UI) update
PlatinumLucario Jan 26, 2025
036d550
Major Improvements
PlatinumLucario Feb 1, 2025
ae59707
Timer bug fixes on Linux
PlatinumLucario Feb 3, 2025
15c9f3b
Some improvements to the code
PlatinumLucario Mar 11, 2025
28bef59
Bug fix and GlobalConfig RefreshRate removal
PlatinumLucario Mar 12, 2025
f9727d3
Merge branch 'wii-dse-support' into new-gui-experimental
PlatinumLucario Mar 12, 2025
1303282
FlexibleDialogs, DSE improvements and more!
PlatinumLucario Apr 22, 2025
4a20a11
Slight improvements and to begin adding known DSE commands
PlatinumLucario May 10, 2025
ac71470
Bug fix
PlatinumLucario May 11, 2025
abec9be
Added Preferences window
PlatinumLucario May 25, 2025
0785125
Improvements to the playlist widget
PlatinumLucario Jun 2, 2025
0669592
Critical bug fix
PlatinumLucario Jun 9, 2025
4edacb0
Bug fix and beginning of MiniAudio implementation
PlatinumLucario Sep 9, 2025
116cfed
New Audio Backend added! It's MiniAudio!
PlatinumLucario Sep 13, 2025
af4ad20
DSE - Updated commands
PlatinumLucario Sep 18, 2025
28c51ed
Updated many SWD params
PlatinumLucario Sep 18, 2025
6bdb7b7
Updated and fixed RIFF Wave writing issues
PlatinumLucario Sep 21, 2025
85357b0
HUGE COMMIT!!! Restored missing stuff from GBAMS
PlatinumLucario Oct 2, 2025
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
Original file line number Diff line number Diff line change
@@ -1,27 +1,28 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net7.0-windows</TargetFramework>
<TargetFramework>net10.0-windows</TargetFramework>
<EnableWindowsTargeting>true</EnableWindowsTargeting>
<OutputType>WinExe</OutputType>
<LangVersion>latest</LangVersion>
<RootNamespace>Kermalis.VGMusicStudio.WinForms</RootNamespace>
<Nullable>enable</Nullable>
<UseWindowsForms>true</UseWindowsForms>
<UseWPF>true</UseWPF> <!--Needed for the taskbar-->
<OutputPath>..\Build</OutputPath>
<OutputPath>..\Build\WinForms</OutputPath>

<Authors>Kermalis</Authors>
<Copyright>Kermalis</Copyright>
<Product>VG Music Studio</Product>
<Title>VG Music Studio</Title>
<AssemblyName>VG Music Studio</AssemblyName>
<Version>0.3.0</Version>
<ApplicationIcon>Properties\Icon.ico</ApplicationIcon>
<ApplicationIcon>..\Icons\Icon.ico</ApplicationIcon>
<ProduceReferenceAssembly>False</ProduceReferenceAssembly>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="EndianBinaryIO" Version="2.1.0" /> <!--Only used for VGMSDebug right now-->
<PackageReference Include="EndianBinaryIO" Version="2.1.1" /> <!--Only used for VGMSDebug right now-->

<!--These 3 are .NET framework 4.6.1 but still work-->
<PackageReference Include="Microsoft.WindowsAPICodePack-Core" Version="1.1.0.2">
Expand Down
131 changes: 131 additions & 0 deletions (Deprecated) VG Music Studio - WinForms/AssemblerDialog.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,131 @@
using Kermalis.VGMusicStudio.Core;
using Kermalis.VGMusicStudio.Core.GBA;
using Kermalis.VGMusicStudio.Core.Properties;
using Kermalis.VGMusicStudio.Core.Util;
using Kermalis.VGMusicStudio.WinForms.Util;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.IO;
using System.Linq;
using System.Windows.Forms;

namespace Kermalis.VGMusicStudio.WinForms;

[DesignerCategory("")]
internal class AssemblerDialog : ThemedForm
{
private Assembler? _assembler;
private readonly LoadedSong _song = (LoadedSong)Engine.Instance!.Player.LoadedSong!;
private readonly ThemedButton _previewButton;
private readonly ValueTextBox _offsetValueBox;
private readonly ThemedLabel _sizeLabel;
private readonly ThemedTextBox _headerLabelTextBox;
private readonly DataGridView _addedDefsGrid;

public AssemblerDialog()
{
var openButton = new ThemedButton
{
Location = new Point(150, 0),
Text = Strings.AssemblerOpenFile
};
openButton.Click += OpenASM;
_previewButton = new ThemedButton
{
Enabled = false,
Location = new Point(150, 50),
Size = new Size(120, 23),
Text = Strings.AssemblerPreviewSong
};
_previewButton.Click += PreviewSong;
_sizeLabel = new ThemedLabel
{
Location = new Point(0, 100),
Size = new Size(150, 23)
};
_offsetValueBox = new ValueTextBox
{
Hexadecimal = true,
Maximum = Engine.Instance!.Config.ROM!.LongLength - 1
};
_headerLabelTextBox = new ThemedTextBox { Location = new Point(0, 50), Size = new Size(150, 22) };
_addedDefsGrid = new DataGridView
{
ColumnCount = 2,
Location = new Point(0, 150),
MultiSelect = false
};
_addedDefsGrid.Columns[0].Name = Strings.AssemblerDefinition;
_addedDefsGrid.Columns[1].Name = Strings.AssemblerValue;
_addedDefsGrid.Columns[1].DefaultCellStyle.NullValue = "0";
_addedDefsGrid.Rows.Add(["voicegroup000", $"0x{Engine.Instance!.Player.LoadedSong!.Bank.Offset + GBAUtils.CARTRIDGE_OFFSET:X7}"]);
_addedDefsGrid.CellValueChanged += AddedDefsGrid_CellValueChanged;

Controls.AddRange(new Control[] { openButton, _previewButton, _sizeLabel, _offsetValueBox, _headerLabelTextBox, _addedDefsGrid });
FormBorderStyle = FormBorderStyle.FixedDialog;
MaximizeBox = false;
Size = new Size(600, 400);
Text = $"VG Music Studio ― {Strings.AssemblerTitle}";
}

void AddedDefsGrid_CellValueChanged(object? sender, DataGridViewCellEventArgs e)
{
DataGridViewCell cell = _addedDefsGrid.Rows[e.RowIndex].Cells[e.ColumnIndex];
if (cell.Value == null)
{
return;
}

if (e.ColumnIndex == 0)
{
if (char.IsDigit(cell.Value.ToString()![0]))
{
FlexibleMessageBox.Show(Strings.AssemblerErrorDefinitionDigit, Strings.ErrorTitleAssembler, MessageBoxButtons.OK, MessageBoxIcon.Error);
cell.Value = cell.Value.ToString()!.Substring(1);
}
}
else
{
if (!ConfigUtils.TryParseValue(cell.Value.ToString()!, 0, long.MaxValue, out long val))
{
FlexibleMessageBox.Show(string.Format(Strings.AssemblerErrorInvalidValue, cell.Value), Strings.ErrorTitleAssembler, MessageBoxButtons.OK, MessageBoxIcon.Error);
cell.Value = null;
}
}
}
void PreviewSong(object? sender, EventArgs e)
{
((MainForm)Owner!).PreviewSong(_song, Path.GetFileName(_assembler!.FileName));
}
void OpenASM(object? sender, EventArgs e)
{
var d = new OpenFileDialog { Title = Strings.TitleOpenASM, Filter = $"{Strings.FilterOpenASM}|*.s" };
if (d.ShowDialog() != DialogResult.OK)
{
return;
}

try
{
var s = new Dictionary<string, int>();
foreach (DataGridViewRow r in _addedDefsGrid.Rows.Cast<DataGridViewRow>())
{
if (r.Cells[0].Value == null || r.Cells[1].Value == null)
{
continue;
}
s.Add(r.Cells[0].Value.ToString()!, (int)ConfigUtils.ParseValue(nameof(r.Index), r.Cells[1].Value.ToString()!, 0, long.MaxValue));
}
_song.OpenASM(_assembler = new Assembler(d.FileName, (int)(GBAUtils.CARTRIDGE_OFFSET + _offsetValueBox.Value), EndianBinaryIO.Endianness.LittleEndian, s),
_headerLabelTextBox.Text = Assembler.FixLabel(Path.GetFileNameWithoutExtension(d.FileName)));
_sizeLabel.Text = string.Format(Strings.AssemblerSizeInBytes, _assembler.BinaryLength);
_previewButton.Enabled = true;
}
catch (Exception ex)
{
FlexibleMessageBox.Show(ex.Message, Strings.ErrorTitleAssembler, MessageBoxButtons.OK, MessageBoxIcon.Error);
}
}
}
104 changes: 104 additions & 0 deletions (Deprecated) VG Music Studio - WinForms/MIDIConverterDialog.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,104 @@
using Kermalis.MIDI;
using Kermalis.VGMusicStudio.Core;
using Kermalis.VGMusicStudio.Core.GBA;
using Kermalis.VGMusicStudio.Core.GBA.AlphaDream;
using Kermalis.VGMusicStudio.Core.GBA.MP2K;
using Kermalis.VGMusicStudio.Core.Properties;
using Kermalis.VGMusicStudio.WinForms.Properties;
using Kermalis.VGMusicStudio.WinForms.Util;
using PlatinumLucario.MIDI.GBA.MP2K;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Diagnostics;
using System.Drawing;
using System.IO;
using System.Windows.Forms;

namespace Kermalis.VGMusicStudio.WinForms;

[DesignerCategory("")]
class MIDIConverterDialog : ThemedForm
{
private readonly LoadedSong _song = (LoadedSong)Engine.Instance!.Player.LoadedSong!;
private string? _midiFilePath;
private readonly ThemedButton _previewButton;
private readonly ValueTextBox _offsetValueBox;

public MIDIConverterDialog()
{
var openButton = new ThemedButton
{
Location = new Point(150, 0),
Text = Strings.MIDIConverterOpenFile
};
openButton.Click += OpenMIDI;
_previewButton = new ThemedButton
{
Enabled = false,
Location = new Point(150, 50),
Size = new Size(120, 23),
Text = Strings.MIDIConverterPreviewSong
};
_previewButton.Click += PreviewSong;
_offsetValueBox = new ValueTextBox
{
Hexadecimal = true,
Maximum = Engine.Instance!.Config.ROM!.Length - 1,
Value = Engine.Instance.Player.LoadedSong!.Bank.Offset
};

Controls.AddRange([openButton, _previewButton, _offsetValueBox]);
FormBorderStyle = FormBorderStyle.FixedDialog;
MaximizeBox = false;
Size = new Size(600, 400);
Text = $"VG Music Studio ― {Strings.MIDIConverterTitle}";
}

private void PreviewSong(object? sender, EventArgs e)
{
((MainForm)Owner!).PreviewSong(_song, Path.GetFileName(_midiFilePath)!);
}
private void OpenMIDI(object? sender, EventArgs e)
{
string? inFile = WinFormsUtils.CreateLoadDialog(".mid", Strings.MenuOpenMIDI, Strings.FilterOpenMIDI + " (*.mid;*.midi)|*.mid;*.midi" );
if (inFile is null)
{
return;
}

try
{
_midiFilePath = inFile;
switch (Engine.Instance)
{
case MP2KEngine:
{
MP2KConverter converter = new(new MIDIFile(new FileStream(inFile, FileMode.Open)));
string asmFilePath = Path.ChangeExtension(Path.GetFullPath(_midiFilePath), "s");
string asmFileName = Path.GetFileName(asmFilePath);
converter.SaveAsASM(asmFilePath);
// var process = new Process
// {
// StartInfo = new ProcessStartInfo
// {
// FileName = "midi2agb.exe",
// Arguments = string.Format("\"{0}\" \"{1}\"", _midiFilePath, "temp.s")
// }
// };
// process.Start();
// process.WaitForExit();
var asm = new Assembler(asmFileName, GBAUtils.CARTRIDGE_CAPACITY, EndianBinaryIO.Endianness.LittleEndian, new Dictionary<string, int> { { "voicegroup000", (int)(GBAUtils.CARTRIDGE_CAPACITY + _offsetValueBox.Value) } });
File.Delete(asmFileName);
_song.OpenASM(asm, Path.GetFileNameWithoutExtension(asmFilePath));
break;
}
}
_previewButton.Enabled = true;
}
catch (Exception ex)
{
FlexibleMessageBox.Show(string.Format(Strings.MIDIConverterError, Environment.NewLine + ex.Message), Strings.MIDIConverterTitleError, MessageBoxButtons.OK, MessageBoxIcon.Error);
}
}
}
Loading