Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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
2 changes: 1 addition & 1 deletion scripts/map/Map.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
13 changes: 7 additions & 6 deletions scripts/map/MapParser.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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/";
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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();
Expand Down
Loading