Skip to content

Commit c00f2a8

Browse files
committed
Fix startup crash
1 parent 2688afb commit c00f2a8

File tree

4 files changed

+32
-43
lines changed

4 files changed

+32
-43
lines changed

LuteBot/PartitionsForm.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -656,7 +656,7 @@ public async void saveMultipleSongsToolStripMenuItem_Click(object sender, EventA
656656
public async void trainToolStripMenuItem_Click(object sender, EventArgs e)
657657
{
658658
var trainingForm = new NeuralNetworkForm(tsm, this);
659-
trainingForm.ShowDialog(this);
659+
trainingForm.Show(this);
660660

661661
}
662662

LuteBot/UI/LuteBotForm.cs

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -334,6 +334,17 @@ public async Task CheckUpdates(bool ignoreSettings = false)
334334

335335
public bool IsLuteModInstalled()
336336
{
337+
var inputIniPath = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData), "Mordhau", "Saved", "Config", "WindowsClient", "Input.ini");
338+
if (File.Exists(inputIniPath) && string.IsNullOrEmpty(ConfigManager.GetProperty(PropertyItem.MordhauInputIniLocation)))
339+
{
340+
Config.ConfigManager.SetProperty(Config.PropertyItem.MordhauInputIniLocation, inputIniPath);
341+
Config.ConfigManager.SaveConfig();
342+
}
343+
else
344+
inputIniPath = ConfigManager.GetProperty(PropertyItem.MordhauInputIniLocation);
345+
// If the file exists, save it into config... this doesn't really go here... oh well.
346+
347+
337348
if (string.IsNullOrWhiteSpace(MordhauPakPath))
338349
{
339350
return true; // They have disabled installs or otherwise didn't input the path correctly, so don't check
@@ -348,13 +359,13 @@ public bool IsLuteModInstalled()
348359
}
349360
// Just check for the lutemod pak in CustomPaks, if they messed it up beyond that they can click the install button themselves, this is just to prompt them to install if necessary
350361
var pakPath = Path.Combine(MordhauPakPath, lutemodPakName);
351-
if (File.Exists(pakPath))
362+
if (File.Exists(pakPath) && !string.IsNullOrWhiteSpace(inputIniPath))
352363
{
353-
// Actually. If they have it, we should check engine.ini for the bad line, and if it's there, recommend install
354-
string engineIniPath = Path.Combine(Path.GetDirectoryName(ConfigManager.GetProperty(PropertyItem.MordhauInputIniLocation)), "Engine.ini");
355-
356364
try
357365
{
366+
// Actually. If they have it, we should check engine.ini for the bad line, and if it's there, recommend install
367+
string engineIniPath = Path.Combine(Path.GetDirectoryName(inputIniPath), "Engine.ini");
368+
358369
var content = File.ReadAllText(engineIniPath);
359370
return !content.Contains(removeFromEngine);
360371
}

LuteBot/UI/NeuralNetworkForm.cs

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -355,7 +355,7 @@ private async Task TrainNetwork(int numPerfect, float percentForSuccess, int par
355355
if (tsm.MidiTracks.All(t => t.Value.Active))
356356
{
357357
// Actually, I think the flute track may not have the appropriate data...
358-
var tempNeuralCandidates = tsm.MidiChannels.Values.Where(c => c.Id != 9).ToArray();
358+
var tempNeuralCandidates = tsm.MidiChannels.Values.ToArray();
359359
foreach (var ca in tempNeuralCandidates)
360360
{
361361
ca.Active = tsm.DataDictionary[1].MidiChannels.Where(c => c.Id == ca.Id).Single().Active;
@@ -414,8 +414,8 @@ private async Task TrainNetwork(int numPerfect, float percentForSuccess, int par
414414

415415
var orderedCandidates = neuralCandidates.OrderBy(c => random.Next());
416416
var numTestCandidates = (int)(orderedCandidates.Count() * 0.3f);
417-
var neuralTrainingCandidates = orderedCandidates.Skip(numTestCandidates);
418-
var neuralTestCandidates = orderedCandidates.Take(numTestCandidates);
417+
var neuralTrainingCandidates = orderedCandidates.Skip(numTestCandidates).ToArray();
418+
var neuralTestCandidates = orderedCandidates.Take(numTestCandidates).ToArray();
419419

420420
int numTestsCorrect = 0;
421421
int numActualTestsCorrect = 0;
@@ -632,9 +632,14 @@ private async Task TrainNetwork(int numPerfect, float percentForSuccess, int par
632632
//await Task.Delay(0); // Let the form live between iterations
633633
}
634634
});
635+
float invokeTotal = costTotal;
636+
int numTestCorrect = numActualTestsCorrect;
637+
int numTrainingCorrect = numTestsCorrect;
638+
Interlocked.Increment(ref i);
639+
int trainingNum = i;
635640
BeginInvoke((MethodInvoker)delegate
636641
{
637-
richTextBox1.AppendText($"\n{numActualTestsCorrect}/{neuralTestCandidates.Count()} ({(float)numActualTestsCorrect / neuralTestCandidates.Count() * 100}%) tests correct; {percentForSuccess}% {numPerfect} times in a row to finish. Training Set: {numTestsCorrect}/{neuralCandidates.Count()}\nTraining #{i++} - TotalCost: {costTotal} (This number should go down eventually)");
642+
richTextBox1.AppendText($"\n{numTestCorrect}/{neuralTestCandidates.Length} ({(float)numTestCorrect / neuralTestCandidates.Length * 100}%) tests correct; {percentForSuccess}% {numPerfect} times in a row to finish. Training Set: {numTrainingCorrect}/{neuralTrainingCandidates.Length}\nTraining #{trainingNum} - TotalCost: {invokeTotal} (This number should go down eventually)");
638643
richTextBox1.ScrollToCaret();
639644
progressBarTraining.Value = numActualTestsCorrect;
640645
});

ReleaseNotes.txt

Lines changed: 7 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -1,44 +1,17 @@
11
Version 3.6.1
22

3-
- Maybe fix startup crashes for Epic users
3+
- Fixed startup crash for new users
4+
- Fixed incorrect numbers and percentages being displayed in Neural Network training
5+
- Added Neural Network pause/resume during training; it saves when paused
6+
- Added crash reporting back
47
- LuteMod 2.61
58
- Re-enabled loading of voice config settings
69
- Fixed issue where playing sometimes pauses itself immediately
710

811
Version 3.6.0
912

1013
- Major rework of LuteBot and LuteMod note handling and configuration
11-
- LuteMod now sounds much better on most songs; it now respects note durations and the order of Tracks, which you can set in LuteBot by clicking and dragging tracks (not channels)
12-
- LuteBot now uses a different library for loading midis, to hopefully have fewer midis that fail
13-
- 'Notes Per Chord' was removed because it is obsolete; LuteMod now plays midis well even when all tracks are enabled for all instruments, trimming is not necessary
14-
- LuteMod now forces a server update when playing each note, so should sound better across the network
15-
- Added keybindings menu to LuteMod, accessible by entering "~Keybinds" in chat
14+
See previous release notes for more information
1615

17-
- Warning: Old partitions will no longer play correctly on flute. Select all your partitions (select the first one, scroll to the bottom, hold shift, click the last one) and use the new 'Resave' button to reload them all with note durations
18-
19-
Details:
20-
21-
- Added default path for Epic Mordhau install
22-
- Revamped LuteBot UI (More revamp later)
23-
- Added validation that Mordhau is closed before installing LuteMod
24-
- Simplified MIDI loading process to save directly to LuteMod as soon as they're loaded, with options to edit afterward
25-
- Added note duration and track ordering to LuteBot/LuteMod Partitions
26-
- Use Track Selection and click+drag tracks up or down; tracks at the top have priority
27-
- Higher priority tracks can interrupt lower priority tracks
28-
- Lower priority tracks can't play until the higher priority notes are done playing
29-
- Lutes ignore these restrictions but still play the highest priority tracks first
30-
- Track priority is ordered by the flute-estimation AI by default
31-
- LuteMod updated to 2.6 to handle this new system
32-
- LuteMod now also forces server update to help ensure all your notes are heard, and has improved timing
33-
- Cleans up most songs by prioritizing track order (on lute and flute), and playing multiple flute tracks no longer sounds like a trainwreck
34-
- Added keybindings menu to LuteMod; Enter "~Keybinds" in the chat to open it
35-
- Removed unused/broken functionality; LuteBot no longer supports Rust, Scrap Mechanic, Time Sync, Playlists, Soundboards, or Midi playback
36-
- Use older versions if necessary (use a real Midi player for Midi playback)
37-
- Removed LuteBot's ability to play through Mordhau Console (and its related hotkeys and settings) to prevent confusion. LuteMod should be used instead, check the Help button for more information
38-
- Swapped MIDI parsing engine to use DryWetMidi (should be more consistent and with less lockups and failures)
39-
- Track Filtering now scales based on tempo to show 30s by default
40-
- Maybe fixed concurrency issue when training the AI with more than one CPU Core
41-
- Fixed many potential memory leaks in LuteBot
42-
- Partitions are loaded in Track Selection when a single one is selected
43-
- Guild library form now supports adding multiple songs at once
44-
- Guild library form has better error reporting
16+
**NOTE** You need to Re-save your partitions (with the new button) for them to play correctly in the new version
17+
**NOTE** Use "~Keybinds" in chat to set keybindings, they are no longer tied to Mordhau bindings

0 commit comments

Comments
 (0)