diff --git a/scripts/map/Map.cs b/scripts/map/Map.cs index 15218a2..22374ce 100644 --- a/scripts/map/Map.cs +++ b/scripts/map/Map.cs @@ -147,7 +147,7 @@ public Map(string folderPath, Note[] data = null, string id = null, string artis VideoBuffer = videoBuffer; Notes = data ?? []; Length = length ?? Notes[^1].Millisecond; - Name = id?.Replace(" ", "_") ?? new Regex("[^a-zA-Z0-9_-]").Replace($"{Mappers.Stringify()}_{PrettyTitle}".Replace(" ", "_"), ""); + Name = Path.GetFileNameWithoutExtension(FolderPath); AudioExt = (AudioBuffer != null && Encoding.UTF8.GetString(AudioBuffer[0..4]) == "OggS") ? "ogg" : "mp3"; MapManager.Sanitize(this); diff --git a/scripts/map/MapParser.cs b/scripts/map/MapParser.cs index f1a2b32..66325a6 100644 --- a/scripts/map/MapParser.cs +++ b/scripts/map/MapParser.cs @@ -70,12 +70,12 @@ await Task.Run(() => public static void ExportEncode(Map map) { /* - The reason we re-decode it is because the cut down map cache's map list does not - have the buffers to save time and memory. So if we decode it, we can get the - buffers without having to deal with other annoying shit + The reason we re-decode it is because the cut down map cache's map list does not + have the buffers to save time and memory. So if we decode it, we can get the + buffers without having to deal with other annoying shit - -fog - */ + -fog + */ Map decodedMap = Decode(map.FolderPath); string exportPath = $"{Constants.USER_FOLDER}/export/"; @@ -157,7 +157,6 @@ public static void Encode(Map map, bool logBenchmark = false) 1 byte OR int32; y */ - File.WriteAllText(Path.Combine(mapFolderPath, "metadata.json"), map.EncodeMeta()); using var stream = File.Create(Path.Combine(mapFolderPath, "objects.phxmo")); // using BinaryWriter bw = new BinaryWriter(stream); @@ -209,6 +208,8 @@ void addAsset(string name, byte[] buffer) if (map.CoverBuffer != null) addAsset($"cover.png", map.CoverBuffer); if (map.VideoBuffer != null) addAsset($"video.mp4", map.VideoBuffer); + File.WriteAllText(Path.Combine(mapFolderPath, "metadata.json"), map.EncodeMeta()); + byte[] hash = Misc.HashFiles([Path.Combine(mapFolderPath, "metadata.json"), Path.Combine(mapFolderPath, "objects.phxmo")]); map.MetadataObjectHash = BitConverter.ToString(hash).Replace("-", "").ToLower();