Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ark + midi enhancements #22

Merged
merged 6 commits into from
May 22, 2024
Merged
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
17 changes: 15 additions & 2 deletions Src/Apps/ArkHelper/Apps/PatchCreatorApp.cs
Original file line number Diff line number Diff line change
Expand Up @@ -45,12 +45,21 @@ public void Parse(PatchCreatorOptions op)
var hdrFileName = new FileInfo(op.InputPath).Name;
var isUppercase = Path
.GetFileNameWithoutExtension(hdrFileName)
.All(c => char.IsUpper(c));
.All(char.IsAsciiLetterUpper);

var genDirName = isUppercase
? "GEN"
: "gen";

// Use upper case if any file names do
var genDirNameInternal = ark
.Entries
.Any(x => x.FileName
.Where(char.IsAsciiLetter)
.All(char.IsAsciiLetterUpper))
? "GEN"
: "gen";

var arkExt = isUppercase
? ".ARK"
: ".ark";
Expand Down Expand Up @@ -79,6 +88,10 @@ public void Parse(PatchCreatorOptions op)
ark.AddAdditionalPart(fullPartPath);
}
}
else
{
Log.Warning("Using inplace edit");
}

var files = Directory.GetFiles(op.ArkFilesPath, "*", SearchOption.AllDirectories);

Expand Down Expand Up @@ -114,7 +127,7 @@ public void Parse(PatchCreatorOptions op)
internalPath = $"{internalPath.Substring(0, internalPath.Length - 1)}b";

if (!genPathedFile.IsMatch(internalPath))
internalPath = internalPath.Insert(internalPath.LastIndexOf('/'), $"/{genDirName}");
internalPath = internalPath.Insert(internalPath.LastIndexOf('/'), $"/{genDirNameInternal}");

// Creates temp dtb file
inputFilePath = ScriptHelper.ConvertDtaToDtb(file, tempDir, ark.Encrypted, (int)ark.Version);
Expand Down
2 changes: 1 addition & 1 deletion Src/Apps/P9SongTool/Helpers/MidiHelper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ protected virtual MidiFile ParseBaseMidi(string midPath)
}

Log.Information("Using \"{MidPath}\" as base .mid file", midPath);
return new MidiFile(midPath);
return new MidiFile(midPath, strictChecking: false);
}

protected virtual List<(long tickPos, decimal framePos, int mpq)> CreateTempoMap()
Expand Down
6 changes: 3 additions & 3 deletions Src/Core/Mackiloha/Ark/ArkEntry.cs
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ private bool IsValidPath(string text, bool directory = false)

public string Extension => (!FileName.Contains('.')) ? "" : FileName.Remove(0, FileName.LastIndexOf('.') + 1);

public override bool Equals(object obj) => (obj is ArkEntry) && ((obj as ArkEntry).FullPath == this.FullPath);
public override int GetHashCode() => FullPath.GetHashCode();
public override string ToString() => $"{FullPath}";
public override bool Equals(object obj) => (obj is ArkEntry arkEntry) && string.Equals(arkEntry.FullPath, FullPath, StringComparison.InvariantCultureIgnoreCase);
public override int GetHashCode() => string.GetHashCode(FullPath, StringComparison.InvariantCultureIgnoreCase);
public override string ToString() => FullPath;
}
2 changes: 1 addition & 1 deletion version.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
1.3.1
1.3.2