Skip to content

Commit

Permalink
Blacklist and Image Packs update
Browse files Browse the repository at this point in the history
- Added the "bios_1_0_usa.pce" file from the PC Engine CD core alternate file names to the blacklist because it doesn't exist (per discord conversations)
- Added the blacklist check to the alternate file names logic
- Added ifdef statements around both the blacklist and image packs logic to load the JSON files locally when in DEBUG mode
  • Loading branch information
hallem committed Feb 9, 2024
1 parent 7a83b1f commit 66568a5
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 3 deletions.
3 changes: 2 additions & 1 deletion blacklist.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,5 +16,6 @@
"HDD-3.hdf",
"HDD-4.hdf",
"beta.bin",
"mpu.bin"
"mpu.bin",
"bios_1_0_usa.pce"
]
6 changes: 6 additions & 0 deletions pupdate.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,12 @@
</ItemGroup>
<ItemGroup>
<None Include=".editorconfig" />
<None Update="blacklist.json">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
<None Update="image_packs.json">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
</ItemGroup>
<ItemGroup>
<RuntimeHostConfigurationOption Include="System.Globalization.Invariant" Value="true" />
Expand Down
3 changes: 1 addition & 2 deletions src/models/Core.cs
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,6 @@ public async Task<Dictionary<string, object>> DownloadAssets()
if (slot.filename != null && !slot.filename.EndsWith(".sav") &&
!GlobalHelper.Blacklist.Contains(slot.filename))
{

if (slot.IsCoreSpecific())
{
path = Path.Combine(platformPath, this.identifier);
Expand All @@ -212,7 +211,7 @@ public async Task<Dictionary<string, object>> DownloadAssets()

if (slot.alternate_filenames != null)
{
files.AddRange(slot.alternate_filenames);
files.AddRange(slot.alternate_filenames.Where(f => !GlobalHelper.Blacklist.Contains(f)));
}

foreach (string f in files)
Expand Down
4 changes: 4 additions & 0 deletions src/services/AssetsService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,11 @@ public static void BackupSaves(string directory, string backupLocation)

public static async Task<string[]> GetBlacklist()
{
#if DEBUG
string json = await File.ReadAllTextAsync("blacklist.json");
#else
string json = await HttpHelper.Instance.GetHTML(BLACKLIST);
#endif
string[] files = JsonSerializer.Deserialize<string[]>(json);

return files ?? Array.Empty<string>();
Expand Down
4 changes: 4 additions & 0 deletions src/services/ImagePacksService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,11 @@ public static class ImagePacksService

public static async Task<ImagePack[]> GetImagePacks()
{
#if DEBUG
string json = await File.ReadAllTextAsync("image_packs.json");
#else
string json = await HttpHelper.Instance.GetHTML(END_POINT);
#endif
ImagePack[] packs = JsonSerializer.Deserialize<ImagePack[]>(json);

return packs ?? Array.Empty<ImagePack>();
Expand Down

0 comments on commit 66568a5

Please sign in to comment.