Add ability to select Basic ROM (Atmos / Oric-1) via settings, URL parameter, and programs.json#4
Open
lxpollitt wants to merge 3 commits intolanceewing:masterfrom
Open
Conversation
- Add .wrangler/ (Cloudflare Workers local cache) to .gitignore so it doesn't clutter working trees when using wrangler dev. - Flip gradlew's mode bit from 0644 to 0755 so a fresh clone on a Unix-like system can run ./gradlew without a chmod step first.
Adds the ability to choose between Oric ROMs (Atmos BASIC 1.1 default, Oric-1 BASIC 1.0). A settings cog on the home screen opens a dialog for the user's default ROM, applied when loading local files (drag-drop / file picker). Curated entries in programs.json can also declare their required ROM via a new optional "rom" field. - New RomConfig class centralises ROM Option list and the resolveRom() policy used by all three platforms. - New optional AppConfigItem.rom field for programs.json entries. - New DialogHandler.promptForOption, implemented natively on all three platforms: HTML <select> via dialog.js on GWT, JOptionPane on Desktop, AlertDialog.setSingleChoiceItems on Android. - Settings cog on the home screen opens the new dialog. - All three JOricRunner implementations now use RomConfig.resolveRom(). - basic10.rom (Oric-1 BASIC 1.0) added to assets/roms/.
Allows URLs like https://oric.games/?rom=oric1#/basic or https://oric.games/?rom=oric1&url=... to request a specific ROM for the program being launched. Primarily for sharing links to games that need a specific Oric model. The parameter applies only on direct-load URLs (hash route or ?url=); ?rom= on a bare home screen URL is ignored. Unknown values silently fall back to the default. - captureRomParamFromUrl() in GwtJOricRunner reads ?rom= at page load when a direct-load indicator is present. - RomConfig.setUrlRomParam() / takeUrlRomParam() provide the capture / consume API (lenient about trailing-slash typos). - resolveRom() consults the URL param first, ahead of the curator's rom field and the persisted preference. - clearUrl() strips ?rom= when the user exits back to home (matches existing ?url= cleanup). - README updated to document the parameter. Also fixes a pre-existing bug in the URL rebuild during program start. The old conditional added a '/' before '#' when the URL didn't end in '/', which was correct for URLs without a query string but corrupted query values when one was present (the '/' would be concatenated into the last parameter). setPath(\"/\") guarantees the path-boundary '/' is already in place, so the conditional is unnecessary — simplified to always append \"#/<slug>\".
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Background motivation: I have multiple games I'm currently restoring from old tapes which I would like to share, but some of them do not run well with Atmos Basic 1.1 ROM, due to subtle differences compared to the original Oric-1 Basic 1.0 ROM.
This PR adds the ability to run games with either the Atmos (Basic 1.1, default) or Oric-1 (Basic 1.0) ROM, so programs that need a specific Oric model can be loaded cleanly. It's designed to be extensible if desired in the future - adding more ROMs in future should be straightforward appends to
RomConfig.OPTIONSwith the ROM file placed inassets/roms/.Three ways to specify a ROM
Each has a clearly-defined scope:
?rom=URL parameter - per-launch override for URLs that launch an individual program (#/slugor?url=). Intended for sharing links to games that need a specific Oric model. Ignored on plain home-screen URLs.romfield inprograms.json- optional per-program property; lets curators specify the ROM for a program that needs one without affecting user settings. No existing entries changed, but available for future as needed.Commits
Split into three logical commits for easier review:
.gitignore; flipgradlew's executable bit so a fresh clone can run./gradlewwithoutchmod.RomConfig,AppConfigItem.rom,DialogHandler.promptForOption(with native implementations on all three platforms: HTML<select>viadialog.json GWT, SwingJOptionPane.showInputDialogon Desktop,AlertDialog.Builder.setSingleChoiceItemson Android), and the gear icon + settings dialog on the home screen.?rom=URL parameter - per-launch override, documented in the README. Also fixes a pre-existing bug in the URL rebuild during program start: the conditional that inserted/before#was correct for URLs without a query string, but corrupted query values when one was present (the/would be concatenated into the last query parameter). Only revealed by this PR because?rom=made query strings common on that code path.New ROM file
assets/roms/basic10.rom(Oric-1 BASIC 1.0) source from defence-force.org, same source convention as the existingbasic11b.rom.Testing
#/slugand?url=). Built in programsromfield exercised by temporarily adding it to aprograms.jsonentry.JOptionPane.showInputDialog) but has not been directly run. I was unable to test the changes due to issue on macOS where UI buttons cause a spinning beach ball on click (reproduced on unmodifiedupstream/master). The Desktop ROM-selection changes in this PR are small and symmetric with the GWT and Android implementations but recommend worth a sanity check by someone with a working Desktop setup.AlertDialog.Builder.setSingleChoiceItems) but not directly run as I don't an Android device.