|
1 | 1 | # CPCJS |
2 | 2 |
|
3 | | -CPCJS est le port navigateur de [Caprice32](https://github.com/ColinPitrat/caprice32). |
4 | | -Le cœur C++ original est compilé en WebAssembly et JavaScript avec Emscripten; |
5 | | -SDL2 relie l’écran, le son, le clavier et les manettes aux API du navigateur. |
| 3 | +**[Play CPCJS online](https://smichea.github.io/cpcjs/)** |
6 | 4 |
|
7 | | -Formats acceptés: DSK, SNA, CDT, VOC, CPR, IPF, RAW et ZIP. |
| 5 | +CPCJS is a browser port of [Caprice32](https://github.com/ColinPitrat/caprice32). |
| 6 | +The original C++ core is compiled to WebAssembly and JavaScript with Emscripten; |
| 7 | +SDL2 connects video, audio, keyboard, and controller support to browser APIs. |
8 | 8 |
|
9 | | -## Prérequis |
| 9 | +Supported formats: DSK, SNA, CDT, VOC, CPR, IPF, RAW, and ZIP. |
10 | 10 |
|
11 | | -- Emscripten (`em++` dans le `PATH`) |
12 | | -- Node.js 18 ou supérieur |
13 | | -- les sources Caprice32 dans `../caprice32`, ou leur chemin dans |
| 11 | +## Requirements |
| 12 | + |
| 13 | +- Emscripten (`em++` available in `PATH`) |
| 14 | +- Node.js 18 or later |
| 15 | +- the Caprice32 sources in `../caprice32`, or their location provided through |
14 | 16 | `CAPRICE32_DIR` |
15 | 17 |
|
16 | | -Sur Ubuntu/Debian, Emscripten peut être installé avec: |
| 18 | +On Ubuntu or Debian, Emscripten can be installed with: |
17 | 19 |
|
18 | 20 | ```sh |
19 | 21 | sudo apt install emscripten |
20 | 22 | ``` |
21 | 23 |
|
22 | | -## Construire et jouer |
| 24 | +## Build and run |
23 | 25 |
|
24 | 26 | ```sh |
25 | 27 | npm run build |
26 | 28 | npm run serve |
27 | 29 | ``` |
28 | 30 |
|
29 | | -Ouvrir ensuite <http://localhost:8080>, choisir une image de jeu, puis cliquer |
30 | | -dans l’écran pour donner le focus au clavier. Le son démarre après cette action |
31 | | -utilisateur, conformément aux règles des navigateurs. |
| 31 | +Open <http://localhost:8080>, select a game image, and click the screen to give |
| 32 | +the emulator keyboard focus. Audio starts after this user interaction, as |
| 33 | +required by browser autoplay policies. |
32 | 34 |
|
33 | | -Le build produit `public/emulator/caprice32.js`, `caprice32.wasm` et le paquet de |
34 | | -données préchargé. Ces artefacts ne sont pas versionnés. Le navigateur doit être |
35 | | -servi via HTTP; ouvrir directement `index.html` avec `file://` ne fonctionne pas. |
| 35 | +The build creates `public/emulator/caprice32.js`, `caprice32.wasm`, and the |
| 36 | +preloaded data package. These artifacts are not committed. The application must |
| 37 | +be served over HTTP; opening `index.html` directly through `file://` does not |
| 38 | +work. |
36 | 39 |
|
37 | | -## Contrôles |
| 40 | +## Controls |
38 | 41 |
|
39 | | -- clavier CPC: clavier physique |
40 | | -- joystick: flèches, `Z` et `X` |
41 | | -- menu Caprice32: `F1` |
42 | | -- plein écran: bouton de l’interface ou `Ctrl` + `Entrée` |
| 42 | +- CPC keyboard: physical keyboard |
| 43 | +- joystick: arrow keys, `Z`, and `X` |
| 44 | +- Caprice32 menu: `F1` |
| 45 | +- fullscreen: interface button or `Ctrl` + `Enter` |
43 | 46 |
|
44 | | -Pour changer de disque après le démarrage, utilisez le menu Caprice32 (`F1`). |
45 | | -Pour démarrer directement avec une autre image, rechargez la page. |
| 47 | +To change disks after startup, use the Caprice32 menu (`F1`). To start directly |
| 48 | +with another image, reload the page. |
46 | 49 |
|
47 | | -## Jeux locaux et catalogue hébergé |
| 50 | +## Local games and hosted catalog |
48 | 51 |
|
49 | | -Le bouton **Choisir un jeu** propose deux sources: |
| 52 | +The **Choose a game** button offers two sources: |
50 | 53 |
|
51 | | -- une image CPC présente sur l'appareil de l'utilisateur; |
52 | | -- un jeu du catalogue hébergé dans `public/games/`. |
| 54 | +- a CPC image stored on the user's device; |
| 55 | +- a game from the catalog hosted in `public/games/`. |
53 | 56 |
|
54 | | -Les jeux hébergés suivent la convention `nom-du-jeu.<format>` en minuscules, |
55 | | -avec un identifiant stable, une empreinte SHA-256 et un lien vers l'autorisation |
56 | | -de redistribution dans `public/games/catalog.json`. Le navigateur contrôle |
57 | | -l'empreinte du fichier avant de le lancer. |
| 57 | +Hosted games use lowercase `game-name.<format>` filenames, a stable identifier, |
| 58 | +a SHA-256 digest, and a link to the redistribution permission in |
| 59 | +`public/games/catalog.json`. The browser verifies the file digest before |
| 60 | +launching it. |
58 | 61 |
|
59 | | -Le catalogue contient actuellement cinq jeux Design Design Software distribués |
60 | | -avec l'autorisation de Simon Brattel et les sept jeux CPC du Vortex Emulation |
61 | | -Package. Ce dernier reste hébergé sous la forme de son archive originale; le |
62 | | -navigateur en extrait uniquement le jeu sélectionné en mémoire. Un autre jeu ne |
63 | | -doit être ajouté que si son titulaire autorise explicitement la |
64 | | -**redistribution**. Une mention « abandonware », un téléchargement gratuit ou |
65 | | -une page permettant de jouer en ligne ne suffisent pas. La provenance, les |
66 | | -conditions et le schéma sont documentés dans `public/games/README.md`. |
| 62 | +The catalog currently contains five Design Design Software games distributed |
| 63 | +with permission from Simon Brattel and the seven CPC games from the Vortex |
| 64 | +Emulation Package. The Vortex package remains hosted as its unmodified original |
| 65 | +archive; the browser extracts only the selected game in memory. Another game |
| 66 | +must not be added unless its rights holder explicitly permits |
| 67 | +**redistribution**. An “abandonware” label, a free download, or a page that |
| 68 | +allows online play is not sufficient. Provenance, terms, and the catalog schema |
| 69 | +are documented in `public/games/README.md`. |
67 | 70 |
|
68 | 71 | ## Tests |
69 | 72 |
|
70 | | -Installer Chromium pour Playwright une première fois, puis lancer la suite: |
| 73 | +Install Chromium for Playwright once, then run the suite: |
71 | 74 |
|
72 | 75 | ```sh |
73 | 76 | npm install |
74 | 77 | npx playwright install chromium |
75 | 78 | npm test |
76 | 79 | ``` |
77 | 80 |
|
78 | | -`npm test` reconstruit le module WebAssembly, puis valide dans un vrai Chromium |
79 | | -headless les deux parcours suivants: |
| 81 | +`npm test` rebuilds the WebAssembly module and validates these flows in a real |
| 82 | +headless Chromium instance: |
80 | 83 |
|
81 | | -- démarrage du CPC 6128 sans image, affichage vidéo et progression des frames; |
82 | | -- chargement de l’image disque de test, saisie de `RUN"HELLO` et exécution du |
83 | | - programme BASIC jusqu’à la modification effective de l’écran et la sortie |
84 | | - exacte `Hello, World !` sur le port imprimante émulé. |
| 84 | +- booting the CPC 6128 without an image, with active video and frame progress; |
| 85 | +- loading the test disk image, entering `RUN"HELLO`, and running the BASIC |
| 86 | + program until the screen changes and the emulated printer port outputs the |
| 87 | + exact text `Hello, World !`; |
| 88 | +- downloading and starting a standalone game from the hosted catalog; |
| 89 | +- extracting and starting a Vortex game in memory from the original archive; |
| 90 | +- selecting the interface language from the browser locale and persisting a |
| 91 | + manual language change. |
85 | 92 |
|
86 | | -La fixture est issue des tests intégrés GPL-2.0 de Caprice32. Ces scénarios |
87 | | -valident le pipeline navigateur de bout en bout; ils ne signifient pas encore |
88 | | -que l’ensemble du catalogue de jeux CPC est compatible. |
| 93 | +The fixture comes from Caprice32's GPL-2.0 integration tests. These scenarios |
| 94 | +validate the browser pipeline end to end; they do not imply compatibility with |
| 95 | +the entire CPC software catalog. |
89 | 96 |
|
90 | | -## Déployer manuellement sur GitHub Pages |
| 97 | +## Manual deployment to GitHub Pages |
91 | 98 |
|
92 | | -Une seule fois, ouvrir **Settings → Pages → Build and deployment** dans le |
93 | | -dépôt GitHub et choisir **GitHub Actions** comme source. |
| 99 | +For the initial setup, open **Settings → Pages → Build and deployment** in the |
| 100 | +GitHub repository and select **GitHub Actions** as the source. |
94 | 101 |
|
95 | | -Pour chaque déploiement: |
| 102 | +For each deployment: |
96 | 103 |
|
97 | | -1. ouvrir l’onglet **Actions** du dépôt; |
98 | | -2. choisir le workflow **Deploy to GitHub Pages**; |
99 | | -3. cliquer sur **Run workflow**, sélectionner la branche à publier, puis |
100 | | - confirmer avec **Run workflow**. |
| 104 | +1. open the repository's **Actions** tab; |
| 105 | +2. select the **Deploy to GitHub Pages** workflow; |
| 106 | +3. click **Run workflow**, select the branch to publish, and confirm with |
| 107 | + **Run workflow**. |
101 | 108 |
|
102 | | -Le workflow reconstruit Caprice32 en WebAssembly, publie le contenu de |
103 | | -`public/` et affiche l’URL du site dans le job `deploy`. Il est uniquement |
104 | | -déclenché à la demande et ne déploie rien automatiquement lors d’un push. |
| 109 | +The workflow rebuilds Caprice32 as WebAssembly, publishes the contents of |
| 110 | +`public/`, and reports the site URL in the `deploy` job. It only runs when |
| 111 | +manually triggered and does not deploy automatically after a push. |
105 | 112 |
|
106 | | -## Licence |
| 113 | +## License |
107 | 114 |
|
108 | | -Caprice32 et ce port sont distribués sous GPL-2.0. Les ROM incluses dans le |
109 | | -dépôt Caprice32 sont empaquetées au moment du build. Les jeux tiers de |
110 | | -`public/games/` conservent leur copyright et ne sont pas couverts par la GPL; |
111 | | -leurs conditions sont documentées dans ce répertoire. |
| 115 | +Caprice32 and this port are distributed under GPL-2.0. The ROMs included in the |
| 116 | +Caprice32 repository are packaged during the build. Third-party games in |
| 117 | +`public/games/` retain their copyright and are not covered by the GPL; their |
| 118 | +terms are documented in that directory. |
0 commit comments