Skip to content

Commit

Permalink
Fix song index bug in stage and song managers
Browse files Browse the repository at this point in the history
  • Loading branch information
libertyernie committed Feb 8, 2016
1 parent 68e4dde commit 852a336
Show file tree
Hide file tree
Showing 7 changed files with 23 additions and 13 deletions.
4 changes: 2 additions & 2 deletions BrawlManagerLib/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -32,5 +32,5 @@
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("3.7.0.0")]
[assembly: AssemblyFileVersion("3.7.0.0")]
[assembly: AssemblyVersion("3.7.1.0")]
[assembly: AssemblyFileVersion("3.7.1.0")]
2 changes: 1 addition & 1 deletion BrawlManagerLib/Songs/SongNameBar.Designer.cs

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

18 changes: 14 additions & 4 deletions BrawlManagerLib/Songs/SongNameBar.cs
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,8 @@ public class SongIndexEntry {
public ushort ID;
public int Index;

public SongIndexEntry(SndBgmTitleEntryNode node) {
this.ID = (ushort)(int)node.ID;
this.Index = node.Index;
public override string ToString() {
return ID.ToString("X4") + " --> " + Index;
}
}
private List<SongIndexEntry> common2_titledata;
Expand Down Expand Up @@ -107,7 +106,10 @@ public String findInfoFile() {
using (var node = NodeFactory.FromFile(null, tempfile)) {
foreach (ResourceNode child in node.Children) {
if (child is SndBgmTitleDataNode) {
common2_titledata = child.Children.Select(n => new SongIndexEntry((SndBgmTitleEntryNode)n)).ToList();
common2_titledata = child.Children.Select(n => new SongIndexEntry() {
ID = (ushort)(int)((SndBgmTitleEntryNode)n).ID,
Index = ((SndBgmTitleEntryNode)n).SongTitleIndex
}).ToList();
break;
}
}
Expand All @@ -116,6 +118,13 @@ public String findInfoFile() {
if (common2_titledata.Count > 0) break;
}

if (common2_titledata.Count == 0) {
common2_titledata = SongIDMap.Songs.Where(s => s.InfoPacIndex != null).Select(s => new SongIndexEntry() {
ID = s.ID,
Index = s.InfoPacIndex ?? 0
}).ToList();
}

tempfile = Path.GetTempFileName();
if (new FileInfo("MiscData[140].msbin").Exists) {
_currentFile = "MiscData[140].msbin";
Expand Down Expand Up @@ -247,6 +256,7 @@ private void button2_Click(object sender, EventArgs e) {
}

public int GetInfoPacIndex(ushort id) {
Console.WriteLine("++" + id.ToString("X4") + "++");
return common2_titledata.Where(c => c.ID == id).Select(c => c.Index).DefaultIfEmpty(-1).First();
}

Expand Down
2 changes: 1 addition & 1 deletion SongManager/BrawlSongManager.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Brawl Song Manager 3.7 - February 2016
Brawl Song Manager 3.7.1 - February 2016
Copyright © 2016 libertyernie
http://lakora.us/brawl/songmanager

Expand Down
4 changes: 2 additions & 2 deletions SongManager/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -32,5 +32,5 @@
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("3.7.0.0")]
[assembly: AssemblyFileVersion("3.7.0.0")]
[assembly: AssemblyVersion("3.7.1.0")]
[assembly: AssemblyFileVersion("3.7.1.0")]
2 changes: 1 addition & 1 deletion StageManager/BrawlStageManager.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Brawl Stage Manager 3.7 - February 2016
Brawl Stage Manager 3.7.1 - February 2016
Copyright © 2016 libertyernie
http://lakora.us/brawl/stagemanager

Expand Down
4 changes: 2 additions & 2 deletions StageManager/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -32,5 +32,5 @@
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("3.7.0.0")]
[assembly: AssemblyFileVersion("3.7.0.0")]
[assembly: AssemblyVersion("3.7.1.0")]
[assembly: AssemblyFileVersion("3.7.1.0")]

0 comments on commit 852a336

Please sign in to comment.