Skip to content

Commit

Permalink
Display Modes Updates (mattpannella#349)
Browse files Browse the repository at this point in the history
* Display Modes Updates

- Added the ability to reset the display modes back to the core specified list without having to reinstall the core.
- Added the ability to control the way display modes are added. They can now be merged with the existing core specified list or the core specified list can be overwritten.
- Added the ability to exclude cores from the display_modes.json file. Specifically for the Spiritualized.GB core not supporting the GB display modes.
- Ignored the display modes property on serialization when null
- Added an optional description element to the Analogue Video Display Mode object. Note: This does not break the Pocket's ability to read the video.json file.
- Added a sort order to the display_modes.json to help with merging the recommended list with the existing list
- Migrated the Setting Service GetConfig() to a Config Property

* Documentation Update
  • Loading branch information
hallem authored Oct 7, 2024
1 parent 9a9948c commit 94de782
Show file tree
Hide file tree
Showing 32 changed files with 511 additions and 141 deletions.
5 changes: 4 additions & 1 deletion MENU.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,13 @@
4. Download Assets
5. Backup Saves & Memories
6. Pocket Setup
1. Add Display Modes
1. Manage Display Modes
1. Enable Recommended Display Modes
2. Enable Selected Display Modes for All Cores
3. Enable Selected Display Modes for Select Cores
4. Reset All Customized Display Modes
5. Reset Selected Customized Display Modes
6. Change Display Modes Option Setting
2. Download Images and Palettes
1. Download Platform Image Packs
2. Download Pocket Library Images
Expand Down
25 changes: 20 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ For a full view of the interactive console menu, see [here](MENU.md).
[GameBoy Palettes](#pocket-setup---download-gameboy-palettes) |
[PC Engine CD](#pocket-setup---generating-instance-json-files-pc-engine-cd) |
[Game & Watch](#pocket-setup---generate-game--watch-roms) |
[Display Modes](#pocket-setup---enable-all-display-modes) |
[Display Modes](#pocket-setup---display-modes) |
[Super GameBoy Aspect Ratio](#pocket-setup---super-gameboy-aspect-ratio) |
[Pocket Maintenance](#pocket-maintenance---reinstall-or-uninstall-cores) |
[Pocket Extras](#pocket-extras) |
Expand Down Expand Up @@ -93,6 +93,24 @@ This presents you with a list of all of the supported display modes and lets you

This presents you with a list of all of the supported display modes and lets you select which ones you want to apply. Next, you'll be asked to select which of your installed cores you want to apply the display modes to. Then it applies those display modes to the cores you have selected.

- Reset All Customized Display Modes

This will reset all of the cores with customized display modes back to the original list that was specified by the core.

- Reset Selected Customized Display Modes

This will reset the selected cores with customized display modes back to the original list that was specified by the core.

- Change Display Modes Option Setting

This will prompt you to ask how you want to apply the display modes to the cores, with 3 options:
- Merge
- Selecting this will merge the selected or recommended display modes with the ones specified by the core.
- Overwrite
- Selecting this will overwrite the display modes specified by the core with the selected or recommended ones.
- Ask
- Selecting this will ask you if you want to merge or overwrite the core specified display modes with the selected or recommended ones each time you run it.

### Pocket Setup - Download Platform Image Packs

This will present you with a list of available image packs and automatically download and extract it to the Platforms/_images directory for you
Expand Down Expand Up @@ -153,10 +171,6 @@ Should look like this:

Now just run the menu option in the updater and it will build your games

### Pocket Setup - Enable All Display Modes

This will enable all of the Pocket Display Modes for the openFPGA cores.

### Pocket Setup - Super GameBoy Aspect Ratio

This allows you to apply the 8:7 aspect ratio to any of the Super GameBoy cores you may have installed. When selected you will be asked which cores you want to do this for.
Expand Down Expand Up @@ -225,6 +239,7 @@ This contains a list of alternate core setups. These take existing cores and mak
| config.archive_name | The account on archive.org that the app will use to check for Assets |
| config.github_token | The app will use this when making API calls to GitHub |
| config.download_new_cores | This will be set automatically by the `Select Cores` menu item. It can be set to "yes", "no", or "ask" |
| config.display_modes_option | This will be set automatically by any of the `Display Modes` menu items. It can be set to "merge", "overwrite", or "ask" |
| config.custom_archive | You can set a custom URL here, if you don't want to use the default. `index` is a relative path to the index of your custom site's files. This is not required, but it's needed for CRC checking. If you have CRC checking enabled, the setting will be ignored unless this provides the necessary format. It must match the output of archive.org's json endpoint. https://archive.org/developers/md-read.html |
| config.backup_saves | Set this to `true` if you want your Saves directory to be backed up automatically during `Update All` |
| config.backup_saves_location | Put the absolute path to the backup location here to backup your `Saves` directory to. This defaults to `Backups` in the current directory when not set. |
Expand Down
135 changes: 113 additions & 22 deletions display_modes.json
Original file line number Diff line number Diff line change
@@ -1,44 +1,135 @@
{
"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" }
{
"value": "0x10",
"order": 17,
"description": "CRT Trinitron"
},
{
"value": "0x20",
"order": 18,
"description": "Greyscale LCD"
},
{
"value": "0x30",
"order": 19,
"description": "Reflective Color LCD"
},
{
"value": "0x40",
"order": 20,
"description": "Backlit Color LCD"
},
{
"value": "0xE0",
"order": 21,
"description": "Pinball Neon Matrix"
},
{
"value": "0xE1",
"order": 22,
"description": "Vacuum Fluorescent"
}
],
"gb": [
{ "value": "0x21", "description": "Original GB DMG" },
{ "value": "0x22", "description": "Original GBP" },
{ "value": "0x23", "description": "Original GBP Light" }
{
"value": "0x21",
"order": 1,
"description": "Original GB DMG (Requires Core Response)",
"exclude_cores": [ "Spiritualized.GB" ]
},
{
"value": "0x22",
"order": 2,
"description": "Original GBP (Requires Core Response)",
"exclude_cores": [ "Spiritualized.GB" ]
},
{
"value": "0x23",
"order": 3,
"description": "Original GBP Light (Requires Core Response)",
"exclude_cores": [ "Spiritualized.GB" ]
}
],
"gbc": [
{ "value": "0x31", "description": "Original GBC LCD" },
{ "value": "0x32", "description": "Original GBC LCD+" }
{
"value": "0x31",
"order": 4,
"description": "Original GBC LCD"
},
{
"value": "0x32",
"order": 5,
"description": "Original GBC LCD+"
}
],
"gba": [
{ "value": "0x41", "description": "Original GBA LCD" },
{ "value": "0x42", "description": "Original GBA SP 101" }
{
"value": "0x41",
"order": 6,
"description": "Original GBA LCD"
},
{
"value": "0x42",
"order": 7,
"description": "Original GBA SP 101"
}
],
"gg": [
{ "value": "0x51", "description": "Original GG" },
{ "value": "0x52", "description": "Original GG+" }
{
"value": "0x51",
"order": 8,
"description": "Original GG"
},
{
"value": "0x52",
"order": 9,
"description": "Original GG+"
}
],
"jtngp": [
{ "value": "0x61", "description": "Original NGP" }
{
"value": "0x61",
"order": 10,
"description": "Original NGP"
}
],
"jtngpc": [
{ "value": "0x62", "description": "Original NGPC" },
{ "value": "0x63", "description": "Original NGPC+" }
{
"value": "0x62",
"order": 11,
"description": "Original NGPC"
},
{
"value": "0x63",
"order": 12,
"description": "Original NGPC+"
}
],
"pce": [
{ "value": "0x71", "description": "TurboExpress" },
{ "value": "0x72", "description": "PC Engine LT" }
{
"value": "0x71",
"order": 13,
"description": "TurboExpress"
},
{
"value": "0x72",
"order": 14,
"description": "PC Engine LT"
}
],
"lynx": [
{ "value": "0x81", "description": "Original Lynx" },
{ "value": "0x82", "description": "Original Lynx+" }
{
"value": "0x81",
"order": 15,
"description": "Original Lynx"
},
{
"value": "0x82",
"order": 16,
"description": "Original Lynx+"
}
]
}
}
1 change: 1 addition & 0 deletions pupdate.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@
<Folder Include="pocket\Assets\" />
<Folder Include="pocket\Cores\" />
<Folder Include="pocket\Platforms\" />
<Folder Include="pocket\Platforms\_images\" />
<Folder Include="pocket\Presets\" />
</ItemGroup>
</Project>
4 changes: 2 additions & 2 deletions src/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ private static void Main(string[] args)
{
case MenuOptions options:
if (!options.SkipUpdate)
CheckForUpdates(ServiceHelper.UpdateDirectory, false, args, ServiceHelper.SettingsService.GetConfig().auto_install_updates);
CheckForUpdates(ServiceHelper.UpdateDirectory, false, args, ServiceHelper.SettingsService.Config.auto_install_updates);
else
enableMissingCores = true;
break;
Expand Down Expand Up @@ -149,7 +149,7 @@ private static void Main(string[] args)

if (options.Save)
{
var config = ServiceHelper.SettingsService.GetConfig();
var config = ServiceHelper.SettingsService.Config;

config.backup_saves = true;
config.backup_saves_location = options.BackupPath;
Expand Down
16 changes: 8 additions & 8 deletions src/helpers/ServiceHelper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -28,15 +28,15 @@ public static void Initialize(string path, string settingsPath, EventHandler<Sta
UpdateDirectory = path;
SettingsDirectory = settingsPath;
SettingsService = new SettingsService(settingsPath);
ArchiveService = new ArchiveService(SettingsService.GetConfig().archives,
SettingsService.GetConfig().crc_check, SettingsService.GetConfig().use_custom_archive);
TempDirectory = SettingsService.GetConfig().temp_directory ?? UpdateDirectory;
AssetsService = new AssetsService(SettingsService.GetConfig().use_local_blacklist);
ArchiveService = new ArchiveService(SettingsService.Config.archives,
SettingsService.Config.crc_check, SettingsService.Config.use_custom_archive);
TempDirectory = SettingsService.Config.temp_directory ?? UpdateDirectory;
AssetsService = new AssetsService(SettingsService.Config.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);
PlatformImagePacksService = new PlatformImagePacksService(path, SettingsService.Config.github_token,
SettingsService.Config.use_local_image_packs);
FirmwareService = new FirmwareService();

if (statusUpdated != null)
Expand All @@ -60,8 +60,8 @@ public static void ReloadSettings()
{
SettingsService = new SettingsService(SettingsDirectory, CoresService.Cores);
// 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);
ArchiveService = new ArchiveService(SettingsService.Config.archives,
SettingsService.Config.crc_check, SettingsService.Config.use_custom_archive);
CoresService = new CoresService(UpdateDirectory, SettingsService, ArchiveService, AssetsService);
CoresService.StatusUpdated += StatusUpdated;
}
Expand Down
10 changes: 10 additions & 0 deletions src/models/Analogue/Video/AnalogueDisplayMode.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,16 @@
using Newtonsoft.Json;

namespace Pannella.Models.Analogue.Video;

public class DisplayMode
{
public string id { get; set; }

[JsonProperty(DefaultValueHandling = DefaultValueHandling.Ignore)]
public string description { get; set; }

public override string ToString()
{
return $"{this.id} {this.description}";
}
}
3 changes: 3 additions & 0 deletions src/models/Analogue/Video/AnalogueVideo.cs
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
using Newtonsoft.Json;

namespace Pannella.Models.Analogue.Video;

public class Video
Expand All @@ -6,5 +8,6 @@ public class Video

public List<ScalerMode> scaler_modes { get; set; }

[JsonProperty(DefaultValueHandling = DefaultValueHandling.Ignore)]
public List<DisplayMode> display_modes { get; set; }
}
5 changes: 4 additions & 1 deletion src/models/DisplayModes/DisplayMode.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,12 @@ public class DisplayMode
{
public string value { get; set; }
public string description { get; set; }
public int order { get; set; }

public List<string> exclude_cores { get; set; } = new();

public override string ToString()
{
return value;
return $"{this.value} - {this.order} - {this.description}";
}
}
5 changes: 5 additions & 0 deletions src/models/Settings/Config.cs
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@ public class Config

public string download_new_cores { get; set; }

public string display_modes_option { get; set; }

[Description("Build game JSON files for supported cores during 'Update All'")]
public bool build_instance_jsons { get; set; } = true;

Expand Down Expand Up @@ -56,6 +58,9 @@ public class Config

public string patreon_email_address { get; set; } = null;

[Description("Adds a description element to the video.json display modes (non-breaking)")]
public bool add_display_mode_description_to_video_json { get; set; } = false;

[JsonProperty(DefaultValueHandling = DefaultValueHandling.Ignore)]
//[Description("Use a local cores.json file for the inventory")]
public bool use_local_cores_inventory { get; set; } = false;
Expand Down
Loading

0 comments on commit 94de782

Please sign in to comment.