Skip to content

Commit

Permalink
Merges PRs for Coin-Op Beta Support and Display Modes Support (mattpa…
Browse files Browse the repository at this point in the history
…nnella#336)

* wip

* testing

* Added dynamic support for display modes

- Added support for a curated list of display modes that is based off of a json file
- Added support for a display mode selector that applies the selection to all cores

Note: The video.json file is reset after a core update happens.

* Added a maximum per the specs and a current count

* model update

* Display Modes Menu paging support

- Added paging to the display mode selector with next, prev, and quit
- Added prev and quit to core selector as well
- Condensed the Pocket Setup menu into sub menus since we were full

* wip

* Updated the readme and some extras names

* Added support for applying selected display modes to selected installed cores

* Added support for updating a installing select cores

* Made two hidden settings visible

- use local pocket extras
- use local display modes

* more progress

* remove jt stuff

* whatever

* refactoring

* more cleanup

* more

* sigh

* moved menu item

* Little bit of cleanup

* Display modes persistence

- Display modes will get saved in the core settings
- Display modes will be restored after a core gets updated
- Display modes will be reset on core reinstall

* readme

* Updated the readme files and switch the CLI for display modes to use curated

* Added missing using statement

* Little bit of clean up

* Fixed merge anomylies

* 3am code is perfect code

* fixed asset download

* local file api

* fix

* oops

* Fixed a logic issue on uninstall & moved logic for ignoring core instance jsons to a json file rather than code

* List beta cores as new when they leave beta

Closes mattpannella#317

* Reconfigured the menus

* need a user agent for the api

* uri encode the get string paramater

---------

Co-authored-by: Matt Pannella <[email protected]>
  • Loading branch information
hallem and mattpannella authored Sep 19, 2024
1 parent 0799e8b commit de441ff
Show file tree
Hide file tree
Showing 49 changed files with 1,447 additions and 804 deletions.
2 changes: 1 addition & 1 deletion CLI.md
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ pocket-extras Download Pocket Extras
-i, --info Shows the details for the specified 'name'
-l, --list Lists out all of the values for 'name' and their details
display-modes Enable all Display Modes
display-modes Enable the curated list of Display Modes for all cores
-p, --path Absolute path to install location
update-self Check for updates to pupdate
Expand Down
70 changes: 42 additions & 28 deletions MENU.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,44 +2,58 @@
2. Update Firmware
3. Select Cores
4. Download Assets
5. Backup Saves
5. Backup Saves & Memories
6. Pocket Setup
1. Jotego Analogizer Config
2. Download Platform Image Packs
3. Download Pocket Library Images
4. Download GameBoy Palettes
5. Generate Instance JSON Files (PC Engine CD)
6. Generate Game & Watch ROMs
7. Enable All Display Modes
8. Apply 8:7 Aspect Ratio to Super GameBoy cores
9. Restore 4:3 Aspect Ratio to Super GameBoy cores
10. Go Back
7. Pocket Maintenance
1. Reinstall All Cores
2. Reinstall Select Cores
3. Uninstall Select Cores
4. Remove JT Beta Keys
5. Prune Save States
1. Add Display Modes
1. Enable Recommended Display Modes
2. Enable Selected Display Modes for All Cores
3. Enable Selected Display Modes for Select Cores
2. Download Images and Palettes
1. Download Platform Image Packs
2. Download Pocket Library Images
3. Download GameBoy Palettes
3. Generate ROMs & JSON Files
1. Generate Instance JSON Files (PC Engine CD)
2. Generate Game & Watch ROMs
4. Super GameBoy Aspect Ratio
1. Apply 8:7 Aspect Ratio to Super GameBoy cores
2. Restore 4:3 Aspect Ratio to Super GameBoy cores
5. Jotego Analogizer Config
6. Go Back
7. Pocket Maintenance
1. Update Selected
2. Install Selected
3. Reinstall All Cores
4. Reinstall Select Cores
5. Uninstall Select Cores
6. Prune Save States
7. Go Back
8. Pocket Extras
1. Additional Assets
1. Download for Eric Lewis's Donkey Kong
1. Download extras for Eric Lewis's Donkey Kong
2. Download extras for Eric Lewis's Radar Scope
3. Download for Jotego's Bubble Bobble (jtbubl)
4. Download for Jotego's Capcom CPS 1 (jtcps1)
5. Download for Jotego's Capcom CPS 1.5 (jtcps15)
6. Download for Jotego's Capcom CPS 2 (jtcps2)
7. Download for Jotego's Pang / Super Pang (jtpang)
3. Download extras for Jotego's Bubble Bobble (jtbubl)
4. Download extras for Jotego's Capcom CPS 1 (jtcps1)
5. Download extras for Jotego's Capcom CPS 1.5 (jtcps15)
6. Download extras for Jotego's Capcom CPS 2 (jtcps2)
7. Download extras for Jotego's Pang / Super Pang (jtpang)
8. Go Back
2. Combination Platforms
1. Download Toaplan Version 2 Hardware Combination Core
2. Download Sega System 16 Combination Core
3. Go Back
2. Download Capcom Z80 Hardware Combination Core
3. Download Williams 6809 Combination Core
4. Download Sega System 16 Combination Core
5. Go Back
3. Variant Cores
1. Download Vectrex Extras
2. Download Super GameBoy 2
3. Download Super GameBoy 2: Vaperwave Edition
4. Go Back
2. Download Dig Dug II
3. Download Joust
4. Download Super GameBoy 2
5. Download Super GameBoy 2: Vaperwave Edition
6. Download Dual Aspect Ratio: Super GameBoy
7. Download Dual Aspect Ratio: Super GameBoy 2
8. Download Dual Aspect Ratio: Super GameBoy 2: Vaperwave Edition
9. Go Back
4. Go Back
9. Settings
10. Exit
68 changes: 49 additions & 19 deletions README.md

Large diffs are not rendered by default.

44 changes: 44 additions & 0 deletions display_modes.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
{
"display_modes": {
"all": [
{ "value": "0x10", "description": "CRT Trinitron" },
{ "value": "0x20", "description": "Greyscale LCD" },
{ "value": "0x30", "description": "Reflective Color LCD" },
{ "value": "0x40", "description": "Backlit Color LCD" },
{ "value": "0xE0", "description": "Pinball Neon Matrix" },
{ "value": "0xE1", "description": "Vacuum Fluorescent" }
],
"gb": [
{ "value": "0x21", "description": "Original GB DMG" },
{ "value": "0x22", "description": "Original GBP" },
{ "value": "0x23", "description": "Original GBP Light" }
],
"gbc": [
{ "value": "0x31", "description": "Original GBC LCD" },
{ "value": "0x32", "description": "Original GBC LCD+" }
],
"gba": [
{ "value": "0x41", "description": "Original GBA LCD" },
{ "value": "0x42", "description": "Original GBA SP 101" }
],
"gg": [
{ "value": "0x51", "description": "Original GG" },
{ "value": "0x52", "description": "Original GG+" }
],
"ngp": [
{ "value": "0x61", "description": "Original NGP" }
],
"ngpc": [
{ "value": "0x62", "description": "Original NGPC" },
{ "value": "0x63", "description": "Original NGPC+" }
],
"pce": [
{ "value": "0x71", "description": "TurboExpress" },
{ "value": "0x72", "description": "PC Engine LT" }
],
"lynx": [
{ "value": "0x81", "description": "Original Lynx" },
{ "value": "0x82", "description": "Original Lynx+" }
]
}
}
6 changes: 3 additions & 3 deletions pocket_extras.json
Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,7 @@
},
{
"id": "sgb-dual",
"name": "Super GameBoy - Dual Aspect Ratio",
"name": "Dual Aspect Ratio: Super GameBoy",
"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": [
Expand All @@ -210,7 +210,7 @@
},
{
"id": "sgb2-dual",
"name": "Super GameBoy 2 - Dual Aspect Ratio",
"name": "Dual Aspect Ratio: Super GameBoy 2",
"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": [
Expand All @@ -223,7 +223,7 @@
},
{
"id": "sgb2vw-dual",
"name": "Super GameBoy 2: Vaporwave Edition - Dual Aspect Ratio",
"name": "Dual Aspect Ratio: Super GameBoy 2: Vaporwave Edition",
"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": [
Expand Down
12 changes: 12 additions & 0 deletions pupdate.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,20 @@
<None Update="pocket_extras.json">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
<None Update="display_modes.json">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
<None Update="ignore_instance.json">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
</ItemGroup>
<ItemGroup>
<RuntimeHostConfigurationOption Include="System.Globalization.Invariant" Value="true" />
</ItemGroup>
<ItemGroup>
<Folder Include="pocket\Assets\" />
<Folder Include="pocket\Cores\" />
<Folder Include="pocket\Platforms\" />
<Folder Include="pocket\Presets\" />
</ItemGroup>
</Project>
10 changes: 5 additions & 5 deletions src/Program.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
using CommandLine;
using Pannella.Helpers;
using Pannella.Models;
using Pannella.Models.Events;
using Pannella.Options;
using Pannella.Services;

Expand Down Expand Up @@ -205,7 +206,7 @@ private static void Main(string[] args)
break;

case DisplayModesOptions:
EnableDisplayModes();
EnableDisplayModes(isCurated: true);
break;

case PruneMemoriesOptions options:
Expand Down Expand Up @@ -281,12 +282,11 @@ private static void coreUpdater_UpdateProcessComplete(object sender, UpdateProce
Console.WriteLine();
}

if (e.MissingBetaKeys.Count > 0)
if (e.MissingLicenses.Count > 0)
{
Console.WriteLine("Missing or incorrect JT Beta Key for the following cores:");
Console.WriteLine($"The {CoresService.BETA_KEY_FILENAME} or {CoresService.BETA_KEY_ALT_FILENAME} must be placed on the root of the SD card.");
Console.WriteLine("Missing or incorrect License file for the following cores:");

foreach (string core in e.MissingBetaKeys)
foreach (string core in e.MissingLicenses)
{
Console.WriteLine(core);
}
Expand Down
42 changes: 19 additions & 23 deletions src/helpers/ConsoleHelper.cs
Original file line number Diff line number Diff line change
@@ -1,33 +1,29 @@
using System.IO.Compression;

namespace Pannella.Helpers;

public class ConsoleHelper
{
public static void ShowProgressBar(int current, int total)
{
var progress = (double)current / (double)total;

var progressWidth = Console.WindowWidth - 14;
var progressBarWidth = (int)(progress * progressWidth);
var progressBar = new string('=', progressBarWidth);
var emptyProgressBar = new string(' ', progressWidth - progressBarWidth);

Console.Write($"\r{progressBar}{emptyProgressBar}] {(progress * 100):0.00}%");

if (current == total)
{
Console.CursorLeft = 0;
Console.Write(new string(' ', Console.WindowWidth));
Console.CursorLeft = 0;
Console.Write("\r");
}
}
// public static void ShowProgressBar(int current, int total)
// {
// var progress = (double)current / total;
// var progressWidth = Console.WindowWidth - 14;
// var progressBarWidth = (int)(progress * progressWidth);
// var progressBar = new string('=', progressBarWidth);
// var emptyProgressBar = new string(' ', progressWidth - progressBarWidth);
//
// Console.Write($"\r{progressBar}{emptyProgressBar}] {(progress * 100):0.00}%");
//
// if (current == total)
// {
// Console.CursorLeft = 0;
// Console.Write(new string(' ', Console.WindowWidth));
// Console.CursorLeft = 0;
// Console.Write("\r");
// }
// }

public static void ShowProgressBar(long current, long total)
{
var progress = (double)current / total;

var progressWidth = Console.WindowWidth - 14;
var progressBarWidth = (int)(progress * progressWidth);
var progressBar = new string('=', progressBarWidth);
Expand All @@ -43,4 +39,4 @@ public static void ShowProgressBar(long current, long total)
Console.Write("\r");
}
}
}
}
8 changes: 5 additions & 3 deletions src/helpers/ServiceHelper.cs
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
using Pannella.Models;
using Pannella.Models.Events;
using Pannella.Services;

namespace Pannella.Helpers;

public static class ServiceHelper
{
public static string UpdateDirectory { get; private set; } // move off this
public static string SettingsDirectory { get; private set; } //for retrodriven's app
public static string SettingsDirectory { get; private set; } // for retrodriven's app
public static string TempDirectory { get; private set; }
public static CoresService CoresService { get; private set; }
public static SettingsService SettingsService { get; private set ;}
Expand Down Expand Up @@ -34,6 +35,7 @@ public static void Initialize(string path, string settingsPath, EventHandler<Sta
AssetsService = new AssetsService(SettingsService.GetConfig().use_local_blacklist);
CoresService = new CoresService(path, SettingsService, ArchiveService, AssetsService);
SettingsService.InitializeCoreSettings(CoresService.Cores);
SettingsService.Save();
PlatformImagePacksService = new PlatformImagePacksService(path, SettingsService.GetConfig().github_token,
SettingsService.GetConfig().use_local_image_packs);
FirmwareService = new FirmwareService();
Expand All @@ -58,9 +60,9 @@ public static void Initialize(string path, string settingsPath, EventHandler<Sta
public static void ReloadSettings()
{
SettingsService = new SettingsService(SettingsDirectory, CoresService.Cores);
//reload the archive service, in case that setting has changed
// reload the archive service, in case that setting has changed
ArchiveService = new ArchiveService(SettingsService.GetConfig().archives,
SettingsService.GetConfig().crc_check, SettingsService.GetConfig().use_custom_archive);
SettingsService.GetConfig().crc_check, SettingsService.GetConfig().use_custom_archive);
CoresService = new CoresService(UpdateDirectory, SettingsService, ArchiveService, AssetsService);
CoresService.StatusUpdated += StatusUpdated;
}
Expand Down
Loading

0 comments on commit de441ff

Please sign in to comment.