Move uniqueId from CustomSong to SongInstance
This commit is contained in:
parent
6144c64f18
commit
29f08bc9be
1
.gitignore
vendored
1
.gitignore
vendored
@ -396,5 +396,6 @@ FodyWeavers.xsd
|
||||
|
||||
# JetBrains Rider
|
||||
*.sln.iml
|
||||
.idea
|
||||
|
||||
TakoTako/Executables/TJAConvert.exe
|
@ -379,29 +379,29 @@ public class MusicPatch
|
||||
if (isTjaSong)
|
||||
{
|
||||
// For TJAs, we need to hash the TJA file.
|
||||
song.uniqueId = song.tjaFileHash;
|
||||
song.UniqueId = song.tjaFileHash;
|
||||
|
||||
if (song.uniqueId == 0)
|
||||
if (song.UniqueId == 0)
|
||||
throw new Exception("Converted TJA had no hash.");
|
||||
}
|
||||
else
|
||||
{
|
||||
// For official songs, we can just use the hash of the song internal name.
|
||||
song.uniqueId = (int)(MurmurHash2.Hash(song.id) & 0xFFFF_FFF);
|
||||
song.UniqueId = (int)(MurmurHash2.Hash(song.id) & 0xFFFF_FFF);
|
||||
}
|
||||
|
||||
if (song.uniqueId <= SaveDataMax)
|
||||
song.uniqueId += SaveDataMax;
|
||||
if (song.UniqueId <= SaveDataMax)
|
||||
song.UniqueId += SaveDataMax;
|
||||
|
||||
if (uniqueIdToSong.ContainsKey(song.uniqueId))
|
||||
if (uniqueIdToSong.ContainsKey(song.UniqueId))
|
||||
{
|
||||
throw new Exception($"Song \"{song.id}\" has collision with \"{uniqueIdToSong[song.uniqueId].id}\", bailing out...");
|
||||
throw new Exception($"Song \"{song.id}\" has collision with \"{uniqueIdToSong[song.UniqueId].id}\", bailing out...");
|
||||
}
|
||||
|
||||
customSongsList.Add(song);
|
||||
idToSong[song.id] = song;
|
||||
uniqueIdToSong[song.uniqueId] = song;
|
||||
Log.LogInfo($"Added{(isTjaSong ? " TJA" : "")} Song {song.songName.text}({song.uniqueId})");
|
||||
uniqueIdToSong[song.UniqueId] = song;
|
||||
Log.LogInfo($"Added{(isTjaSong ? " TJA" : "")} Song {song.songName.text}({song.UniqueId})");
|
||||
}
|
||||
}
|
||||
|
||||
@ -463,7 +463,7 @@ public class MusicPatch
|
||||
continue;
|
||||
|
||||
musicInfoAccessors.Add(new MusicDataInterface.MusicInfoAccesser(
|
||||
song.uniqueId,
|
||||
song.UniqueId, // From SongInstance, as we always recalculate it now
|
||||
song.id,
|
||||
$"song_{song.id}",
|
||||
song.order,
|
||||
@ -1884,5 +1884,6 @@ public class MusicPatch
|
||||
{
|
||||
public string FolderPath;
|
||||
public string SongName;
|
||||
public int UniqueId;
|
||||
}
|
||||
}
|
@ -204,7 +204,6 @@ namespace TJAConvert
|
||||
{
|
||||
var musicInfo = new CustomSong
|
||||
{
|
||||
uniqueId = metadata.Title.GetHashCode(),
|
||||
id = tjaHash.ToString(),
|
||||
order = 0,
|
||||
genreNo = (int) metadata.Genre,
|
||||
|
@ -11,7 +11,6 @@ namespace TakoTako.Common
|
||||
public class CustomSong
|
||||
{
|
||||
// Song Details
|
||||
[DataMember] public int uniqueId;
|
||||
[DataMember] public string id;
|
||||
[DataMember] public int order;
|
||||
[DataMember] public int genreNo;
|
||||
|
Loading…
Reference in New Issue
Block a user