diff options
author | NoCodeLeftBehind <jmcode@gmail.com> | 2017-02-07 08:13:55 +0300 |
---|---|---|
committer | NoCodeLeftBehind <jmcode@gmail.com> | 2017-02-07 08:13:55 +0300 |
commit | 6354057dc15d60a4ade0eba8552d76eb886897f3 (patch) | |
tree | 7df7db15b1fb811f33ab3e62ed6a1b99f9f7ec66 | |
parent | ce6ae26792393c8f31fa52c32b404afb66207c8e (diff) |
Improved artwork detection
Added support for an "art" folder (within the main application folder)
into which the user can place a cover art set in .png or .jpg format.
When the user adds a game, hakchi2 will look in the "art" folder for a
cover art filename that matches the ROM filename. If hakchi2 finds a
match, it will automatically use that cover art for the added game.
-rw-r--r-- | NesGame.cs | 9 | ||||
-rw-r--r-- | art/README.txt | 1 | ||||
-rw-r--r-- | hakchi_gui.csproj | 3 |
3 files changed, 13 insertions, 0 deletions
@@ -311,6 +311,15 @@ namespace com.clusterrr.hakchi_gui imagePath = Path.Combine(Path.GetDirectoryName(nesFileName), Path.GetFileNameWithoutExtension(nesFileName) + ".jpg");
if (File.Exists(imagePath))
cover = Image.FromFile(imagePath);
+
+ var artDirectory = Path.Combine(Path.GetDirectoryName(Application.ExecutablePath), "art");
+ Directory.CreateDirectory(artDirectory);
+ imagePath = Path.Combine(artDirectory, Path.GetFileNameWithoutExtension(nesFileName) + ".png");
+ if (File.Exists(imagePath))
+ cover = Image.FromFile(imagePath);
+ imagePath = Path.Combine(artDirectory, Path.GetFileNameWithoutExtension(nesFileName) + ".jpg");
+ if (File.Exists(imagePath))
+ cover = Image.FromFile(imagePath);
}
if (cover != null)
SetImage(cover, ConfigIni.EightBitPngCompression);
diff --git a/art/README.txt b/art/README.txt new file mode 100644 index 00000000..a2d5faa0 --- /dev/null +++ b/art/README.txt @@ -0,0 +1 @@ +Copy your cover art set here in .png or .jpg format, and hakchi2 will look here when adding games. If it finds a cover art filename that matches the ROM filename, hakchi2 will automatically use that cover art for that game. diff --git a/hakchi_gui.csproj b/hakchi_gui.csproj index 1dc719bb..66768504 100644 --- a/hakchi_gui.csproj +++ b/hakchi_gui.csproj @@ -302,6 +302,9 @@ <EmbeddedResource Include="WorkerForm.resx">
<DependentUpon>WorkerForm.cs</DependentUpon>
</EmbeddedResource>
+ <None Include="art\README.txt">
+ <CopyToOutputDirectory>Always</CopyToOutputDirectory>
+ </None>
<None Include="data\fes1.bin">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
|