Skip to content

Commit

Permalink
Pocket Extras Updates (mattpannella#323)
Browse files Browse the repository at this point in the history
* Fixed an issue with a pocket extra for the Capcom Z80

The combo core for the Capcom Z80 was failing on Jotego rename since it wasn't apart of the master list of cores. Added logic to not go through the rename if it's an extra.

Closes mattpannella#322

* Update .gitignore

* Added support for new Williams Combination Core

- Added support for dyreschlock's new Williams Combination Core
- fixed an issues with double logging statements
  • Loading branch information
hallem authored Sep 6, 2024
1 parent b2a8036 commit 82099fe
Show file tree
Hide file tree
Showing 6 changed files with 135 additions and 23 deletions.
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,13 @@
##
## Get latest from https://github.com/github/gitignore/blob/master/VisualStudio.gitignore

/pocket/
/Assets/
/Cores/
/Platforms/
/Saves/
Spiritualized_*_readme.txt


# User-specific files
*.rsuser
*.suo
Expand Down
87 changes: 83 additions & 4 deletions pocket_extras.json
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,19 @@
"github_repository": "pocket-extras",
"github_asset_prefix": "pocket-extras-jtcz80_c"
},
{
"id": "williams_c",
"name": "Williams 6809 Combination Core",
"description": "Combines 3 of Obsidian's cores into a single platform with multiple cores. It combines Robotron, Joust, and Defender. This allows you to play them all from a single entry in your Pocket menu. You do not need to have them installed prior to using this.",
"type": "combination_platform",
"core_identifiers": [
"obsidian.Williams6809"
],
"has_placeholders": true,
"github_user": "dyreschlock",
"github_repository": "pocket-extras",
"github_asset_prefix": "pocket-extras-williams_c"
},
{
"id": "vectrex",
"name": "Vectrex Extras",
Expand All @@ -131,6 +144,30 @@
"github_repository": "jts16_complete",
"github_asset_prefix": "jts16_complete"
},
{
"id": "digdug2",
"name": "Dig Dug II",
"description": "Installs a core based of off the obsidian.Druaga core for just the Dig Dug II game. You do not need to have the Druaga core installed prior to using this.",
"type": "variant_core",
"core_identifiers": [
"obsidian.DigDug2"
],
"github_user": "hallem",
"github_repository": "pocket-extras",
"github_asset_prefix": "digdug2.zip"
},
{
"id": "Joust",
"name": "Joust",
"description": "Installs a core based of off the obsidian.Robotron core for the Joust game. You do not need to have the Robotron core installed prior to using this.",
"type": "variant_core",
"core_identifiers": [
"obsidian.Joust"
],
"github_user": "hallem",
"github_repository": "pocket-extras",
"github_asset_prefix": "joust.zip"
},
{
"id": "sgb2",
"name": "Super GameBoy 2",
Expand All @@ -140,8 +177,8 @@
"Spiritualized.SuperGB2"
],
"github_user": "hallem",
"github_repository": "openFPGA-Super-GB",
"github_asset_prefix": "super-gameboy-extras-sgb2.zip"
"github_repository": "pocket-extras",
"github_asset_prefix": "sgb2.zip"
},
{
"id": "sgb2vw",
Expand All @@ -152,8 +189,50 @@
"Spiritualized.SuperGB2.VW"
],
"github_user": "hallem",
"github_repository": "openFPGA-Super-GB",
"github_asset_prefix": "super-gameboy-extras-sgb2vw.zip",
"github_repository": "pocket-extras",
"github_asset_prefix": "sgb2vw.zip",
"additional_links": [
"https://www.romhacking.net/hacks/6449/"
]
},
{
"id": "sgb-dual",
"name": "Super GameBoy - Dual Aspect Ratio",
"description": "Installs two cores based of off the Spiritiualized.SuperGB core, one for each aspect ratio (4:3, 8:7). You do not need to have the Super GameBoy core installed prior to using this.",
"type": "variant_core",
"core_identifiers": [
"Spiritualized.SuperGB",
"Spiritualized.SuperGB.8x7"
],
"github_user": "hallem",
"github_repository": "pocket-extras",
"github_asset_prefix": "sgb-dual.zip"
},
{
"id": "sgb2-dual",
"name": "Super GameBoy 2 - Dual Aspect Ratio",
"description": "Installs two cores based of off the Spiritiualized.SuperGB core for the Super GameBoy 2 rom, one for each aspect ratio (4:3, 8:7). You do not need to have the Super GameBoy core installed prior to using this.",
"type": "variant_core",
"core_identifiers": [
"Spiritualized.SuperGB2",
"Spiritualized.SuperGB2.8x7"
],
"github_user": "hallem",
"github_repository": "pocket-extras",
"github_asset_prefix": "sgb2-dual.zip"
},
{
"id": "sgb2vw-dual",
"name": "Super GameBoy 2: Vaporwave Edition - Dual Aspect Ratio",
"description": "Installs two cores based of off the Spiritualized.SuperGB core for the Super GameBoy 2: Vaporwave Edition rom hack, one for each aspect ratio (4:3, 8:7). You do not need to have the Super GameBoy or Super GameBoy 2 core installed prior to using this.",
"type": "variant_core",
"core_identifiers": [
"Spiritualized.SuperGB2.VW",
"Spiritualized.SuperGB2.VW.8x7"
],
"github_user": "hallem",
"github_repository": "pocket-extras",
"github_asset_prefix": "sgb2vw-dual.zip",
"additional_links": [
"https://www.romhacking.net/hacks/6449/"
]
Expand Down
3 changes: 2 additions & 1 deletion src/partials/Program.PocketLibraryImages.cs
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,9 @@ private static void DownloadPockLibraryImages()

try
{
Console.WriteLine("Downloading library images...");
ServiceHelper.ArchiveService.DownloadArchiveFile(archive, archiveFile, ServiceHelper.TempDirectory);
Console.WriteLine("Installing...");
Console.WriteLine("Installing library images...");

if (Directory.Exists(extractPath))
Directory.Delete(extractPath, true);
Expand Down
2 changes: 0 additions & 2 deletions src/services/ArchiveService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -151,9 +151,7 @@ public bool DownloadArchiveFile(SettingsArchive archive, ArchiveFile archiveFile

do
{
WriteMessage($"Downloading '{archiveFile.name}'");
HttpHelper.Instance.DownloadFile(url, destinationFileName, 600);
WriteMessage($"Finished downloading '{archiveFile.name}'");
count++;
}
while (count < 3 && !ValidateChecksum(destinationFileName, archiveFile));
Expand Down
6 changes: 5 additions & 1 deletion src/services/CoreUpdaterService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,11 @@ public void RunUpdates(string[] ids = null, bool clean = false)
}

results = this.coresService.DownloadAssets(core);
JotegoRename(core);

if (!coreSettings.pocket_extras)
{
JotegoRename(core);
}

installedAssets.AddRange(results["installed"] as List<string>);
skippedAssets.AddRange(results["skipped"] as List<string>);
Expand Down
58 changes: 44 additions & 14 deletions src/services/CoresService.Extras.cs
Original file line number Diff line number Diff line change
Expand Up @@ -94,24 +94,54 @@ private void DownloadPocketExtrasPlatform(PocketExtra pocketExtra, string path,
if (pocketExtra.has_placeholders)
{
var placeFiles = Directory.GetFiles(extractPath, "PLACE_*", SearchOption.AllDirectories);
var renameFiles = Directory.GetFiles(extractPath, "RENAME_*", SearchOption.AllDirectories);

if (!placeFiles.Any())
throw new FileNotFoundException("Core RBF_R file locators not found.");

WriteMessage("Downloading core file placeholders...");

foreach (var placeFile in placeFiles)
if (placeFiles.Length > 0)
{
string contents = File.ReadAllText(placeFile);
Uri uri = new Uri(contents);
string placeFileName = Path.GetFileName(uri.LocalPath);
string localPlaceFileName = Path.Combine(Path.GetDirectoryName(placeFile)!, placeFileName);
WriteMessage("Downloading core file placeholders...");

WriteMessage($"Downloading '{placeFileName}'");
HttpHelper.Instance.DownloadFile(uri.ToString(), localPlaceFileName);
WriteMessage("Download complete.");
foreach (var placeFile in placeFiles)
{
string contents = File.ReadAllText(placeFile);
Uri uri = new Uri(contents);
string placeFileName = Path.GetFileName(uri.LocalPath);
string localPlaceFileName = Path.Combine(Path.GetDirectoryName(placeFile)!, placeFileName);

File.Delete(placeFile);
WriteMessage($"Downloading: '{placeFileName}'");
HttpHelper.Instance.DownloadFile(uri.ToString(), localPlaceFileName);
WriteMessage("Download complete.");

File.Delete(placeFile);
}
}
else if (renameFiles.Length > 0)
{
WriteMessage("Downloading & renaming core file placeholders...");

foreach (var renameFile in renameFiles)
{
string renameFileName = Path.GetFileNameWithoutExtension(renameFile);
// 111111111122222222223333
// 0123456789012345678901234567890123
// RENAME_BITSTREAM_TO_DEFENDER_RBF_R
int extensionIndex = renameFileName.LastIndexOf("_RBF_R", StringComparison.InvariantCulture);
string renamedFileName = renameFileName.Substring(20, extensionIndex - 20).ToLowerInvariant() + ".rbf_r";

string contents = File.ReadAllText(renameFile);
Uri uri = new Uri(contents);
string urlFileName = Path.GetFileName(uri.LocalPath);
string localRenameFileName = Path.Combine(Path.GetDirectoryName(renameFile)!, renamedFileName);

WriteMessage($"Downloading '{renamedFileName}'");
HttpHelper.Instance.DownloadFile(uri.ToString(), localRenameFileName);
WriteMessage("Download complete.");

File.Delete(renameFile);
}
}
else
{
throw new FileNotFoundException("Core RBF_R file locators not found.");
}
}

Expand Down

0 comments on commit 82099fe

Please sign in to comment.