Skip to content

Commit

Permalink
Update NitroPacker to allow for better Docker container deletion (#320)
Browse files Browse the repository at this point in the history
  • Loading branch information
jonko0493 authored Jan 14, 2024
1 parent dbb115d commit 81a03a7
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 32 deletions.
12 changes: 3 additions & 9 deletions src/SerialLoops.Lib/ProjectSettings.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,11 @@

namespace SerialLoops.Lib
{
public class ProjectSettings
public class ProjectSettings(NdsProjectFile file, ILogger log)
{
public NdsProjectFile File { get; }
public NdsProjectFile File { get; } = file;
private BannerV1 Banner => File.RomInfo.Banner.Banner;
private readonly ILogger _log;
private readonly ILogger _log = log;

public string Name {
get => Banner.GameName[0];
Expand Down Expand Up @@ -58,11 +58,5 @@ public SKBitmap Icon
Banner.Pltt = grp.PaletteData.ToArray();
}
}
public ProjectSettings(NdsProjectFile file, ILogger log)
{
File = file;
_log = log;
}

}
}
8 changes: 4 additions & 4 deletions src/SerialLoops.Lib/SerialLoops.Lib.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,11 @@

<ItemGroup>
<PackageReference Include="BunLabs.NAudio.Flac" Version="2.0.1" />
<PackageReference Include="HarfBuzzSharp.NativeAssets.Linux" Version="7.3.0" />
<PackageReference Include="HarfBuzzSharp.NativeAssets.macOS" Version="7.3.0" />
<PackageReference Include="HaruhiChokuretsuLib" Version="0.35.2" />
<PackageReference Include="HarfBuzzSharp.NativeAssets.Linux" Version="7.3.0.1" />
<PackageReference Include="HarfBuzzSharp.NativeAssets.macOS" Version="7.3.0.1" />
<PackageReference Include="HaruhiChokuretsuLib" Version="0.35.3" />
<PackageReference Include="NAudio.Vorbis" Version="1.5.0" />
<PackageReference Include="NitroPacker.Core" Version="2.4.3" />
<PackageReference Include="NitroPacker.Core" Version="2.4.4" />
<PackageReference Include="NLayer" Version="1.15.0" />
<PackageReference Include="NLayer.NAudioSupport" Version="1.4.0" />
<PackageReference Include="QuikGraph" Version="2.5.0" />
Expand Down
22 changes: 3 additions & 19 deletions src/SerialLoops/Dialogs/AsmHacksDialog.cs
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ public class AsmHacksDialog : Dialog
{
private const int NUM_OVERLAYS = 26;

private Dictionary<HackFile, SelectedHackParameter[]> _selectedHackParameters = new();
private Dictionary<HackFile, SelectedHackParameter[]> _selectedHackParameters = [];
private AsmHack _currentHack;

public AsmHacksDialog(Project project, Config config, ILogger log)
Expand Down Expand Up @@ -200,8 +200,6 @@ public AsmHacksDialog(Project project, Config config, ILogger log)
log.LogException($"Failed to read ARM9 from '{arm9Path}'", ex);
}
List<string> dockerContainerNames = ["sl-arm9-container"];
try
{
LoopyProgressTracker tracker = new();
Expand All @@ -210,7 +208,7 @@ public AsmHacksDialog(Project project, Config config, ILogger log)
ARM9AsmHack.Insert(Path.Combine(project.BaseDirectory, "src"), arm9, 0x02005ECC, config.UseDocker ? config.DevkitArmDockerTag : string.Empty,
(object sender, DataReceivedEventArgs e) => { log.Log(e.Data); ((IProgressTracker)tracker).Focus(e.Data, 1); },
(object sender, DataReceivedEventArgs e) => log.LogWarning(e.Data),
devkitArmPath: config.DevkitArmPath, dockerContainerName: dockerContainerNames.Last());
devkitArmPath: config.DevkitArmPath);
}, () => {}, tracker, "Patching ARM9");
}
catch (Exception ex)
Expand Down Expand Up @@ -262,15 +260,13 @@ public AsmHacksDialog(Project project, Config config, ILogger log)
{
try
{
dockerContainerNames.Add($"sl-overlay-container{i}");
LoopyProgressTracker tracker = new();
ProgressDialog _ = new(() =>
{
OverlayAsmHack.Insert(overlaySourceDir, overlays[i], newRomInfoPath, config.UseDocker ? config.DevkitArmDockerTag : string.Empty,
(object sender, DataReceivedEventArgs e) => { log.Log(e.Data); ((IProgressTracker)tracker).Focus(e.Data, 1); },
(object sender, DataReceivedEventArgs e) => log.LogWarning(e.Data),
devkitArmPath: config.DevkitArmPath, dockerContainerName: dockerContainerNames.Last());
devkitArmPath: config.DevkitArmPath);
}, () => { }, tracker, $"Patching Overlay {overlays[i].Name}");
}
catch (Exception ex)
Expand Down Expand Up @@ -333,18 +329,6 @@ public AsmHacksDialog(Project project, Config config, ILogger log)
}
}
if (config.UseDocker)
{
Process.Start(new ProcessStartInfo
{
FileName = "docker",
Arguments = $"rm {string.Join(' ', dockerContainerNames)}",
UseShellExecute = false,
RedirectStandardError = true,
RedirectStandardOutput = true,
});
}
Close();
};

Expand Down

0 comments on commit 81a03a7

Please sign in to comment.