c64-ready 3.2.0 → 3.3.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (61) hide show
  1. package/README.md +24 -1
  2. package/bin/serve.mjs +41 -133
  3. package/dist/assets/ActionBiker-CWiKt9dn.js +1 -0
  4. package/dist/assets/Panther-D558qV3B.js +1 -0
  5. package/dist/assets/RainbowIslands-CgoxK_qP.js +1 -0
  6. package/dist/assets/RoadRunner-DR_cGZ-h.js +1 -0
  7. package/dist/assets/RocnRope-DrUGJ0pW.js +1 -0
  8. package/dist/assets/Thrust-rDKv3Thu.js +1 -0
  9. package/dist/assets/index-C84W-vN0.js +318 -0
  10. package/dist/assets/src-CNh6UV6R.js +2 -0
  11. package/dist/index.html +19 -4
  12. package/dist-ts/player/c64-player.d.ts +8 -0
  13. package/dist-ts/player/c64-player.d.ts.map +1 -1
  14. package/dist-ts/player/c64-player.js +14 -1
  15. package/dist-ts/player/c64-player.js.map +1 -1
  16. package/dist-ts/player/canvas-renderer.js +1 -1
  17. package/dist-ts/player/display-layout.d.ts +40 -0
  18. package/dist-ts/player/display-layout.d.ts.map +1 -0
  19. package/dist-ts/player/display-layout.js +76 -0
  20. package/dist-ts/player/display-layout.js.map +1 -0
  21. package/dist-ts/player/ui-controller.d.ts +15 -2
  22. package/dist-ts/player/ui-controller.d.ts.map +1 -1
  23. package/dist-ts/player/ui-controller.js +209 -93
  24. package/dist-ts/player/ui-controller.js.map +1 -1
  25. package/dist-ts/player/ultimate-bridge.d.ts +41 -0
  26. package/dist-ts/player/ultimate-bridge.d.ts.map +1 -0
  27. package/dist-ts/player/ultimate-bridge.js +117 -0
  28. package/dist-ts/player/ultimate-bridge.js.map +1 -0
  29. package/dist-ts/player/ultimate-panel.d.ts +32 -0
  30. package/dist-ts/player/ultimate-panel.d.ts.map +1 -0
  31. package/dist-ts/player/ultimate-panel.js +258 -0
  32. package/dist-ts/player/ultimate-panel.js.map +1 -0
  33. package/package.json +1 -1
  34. package/src/headless/agent-cli.mjs +7 -0
  35. package/src/headless/player-server.mjs +197 -0
  36. package/src/main.ts +5 -1
  37. package/src/player/canvas-renderer.ts +1 -1
  38. package/src/player/display-layout.ts +109 -0
  39. package/src/player/ui-controller.ts +226 -93
  40. package/dist/assets/RainbowIslands-BjfmJB8z.js +0 -1
  41. package/dist/assets/index-B8DSjPqI.js +0 -243
  42. package/dist/assets/src-_trgwTvp.js +0 -2
  43. /package/dist/assets/{BeachHead-CuSwFD4k.js → BeachHead-BLcSLEEh.js} +0 -0
  44. /package/dist/assets/{ChuckieEgg-CPqBnAOF.js → ChuckieEgg-Bv2nxhYv.js} +0 -0
  45. /package/dist/assets/{ForbiddenForest-DsQ9jsc8.js → ForbiddenForest-CWEFgjVq.js} +0 -0
  46. /package/dist/assets/{Galaga-Cutc3p9s.js → Galaga-DknmKlo5.js} +0 -0
  47. /package/dist/assets/{Gribbly-DdZ_hHFt.js → Gribbly-nFVwULpF.js} +0 -0
  48. /package/dist/assets/{Hercules-vZYKm7GG.js → Hercules-Dbx_KaEi.js} +0 -0
  49. /package/dist/assets/{LegendOfWilf-CxSMOjsj.js → LegendOfWilf-BBW1Y7LQ.js} +0 -0
  50. /package/dist/assets/{MariosCementFactory-z0IZ0q30.js → MariosCementFactory-DtpgUfFO.js} +0 -0
  51. /package/dist/assets/{MoleAttack-buC6ChYy.js → MoleAttack-D_2aAX2V.js} +0 -0
  52. /package/dist/assets/{MunchyWorm-D2Zv7i0Q.js → MunchyWorm-BqWD5x4j.js} +0 -0
  53. /package/dist/assets/{ParkPatrol-CVj7hyoB.js → ParkPatrol-9pwc_jcb.js} +0 -0
  54. /package/dist/assets/{PottyPigeon-0SYpIUBa.js → PottyPigeon-CZnjIrGr.js} +0 -0
  55. /package/dist/assets/{Stix-BU-qUCeC.js → Stix-o2hS_Ekr.js} +0 -0
  56. /package/dist/assets/{Tilt-C5KtKisF.js → Tilt-BKb_k_R2.js} +0 -0
  57. /package/dist/assets/{UpNDown-CATRO7Mz.js → UpNDown-BQXEmKfk.js} +0 -0
  58. /package/dist/assets/{Uridium-DanS2KoH.js → Uridium-9u86vh1V.js} +0 -0
  59. /package/dist/assets/{VegetablesDeluxe-C41ViimS.js → VegetablesDeluxe-DbmngV50.js} +0 -0
  60. /package/dist/assets/{marked.esm-fTuuvbcB.js → marked.esm-DhpYx7TE.js} +0 -0
  61. /package/dist/assets/{purify.es-CRM-GE0Y.js → purify.es-CWuqV7zK.js} +0 -0
package/README.md CHANGED
@@ -73,6 +73,9 @@ npx -p c64-ready c64-agent game.prg --frames 250 --screenshot shot.png --screen
73
73
  npx -p c64-ready c64-agent game.prg --symbols game.sym --at 100:joy2=fire --break on_fire
74
74
  ```
75
75
 
76
+ To hand the result to a person, `npx c64-ready game.prg --open` boots the browser
77
+ player straight into it.
78
+
76
79
  See [Agent CLI](docs/AGENT_CLI.md) for every option. For ready-made Claude Code /
77
80
  Agent Skills, see [c64-skills](https://github.com/hayesmaker/c64-skills).
78
81
 
@@ -410,11 +413,31 @@ Open the URL printed to the terminal in any modern browser:
410
413
  ➜ Local: http://localhost:5173/c64-ready/
411
414
  ```
412
415
 
416
+ #### Play your own build
417
+
418
+ Pass a `.prg`, `.d64`, `.crt` or `.c64` snapshot and the player boots straight into it.
419
+ No drag and drop is needed:
420
+
421
+ ```zsh
422
+ npx c64-ready build/main.prg --open
423
+ ```
424
+
425
+ ```
426
+ Game: /home/you/mygame/build/main.prg (reload the page after rebuilding)
427
+ ➜ Local: http://localhost:5173/c64-ready/?game=/c64-ready/local/main.prg
428
+ ```
429
+
430
+ The file is read from disk on every page load, so the dev loop is: rebuild, then refresh
431
+ the browser. Only that one file is served. Controls: the arrow keys are the joystick,
432
+ Z or left Ctrl fires, and gamepads work too.
433
+
413
434
  **Options:**
414
435
 
415
436
  | Flag | Default | Description |
416
437
  | ------------ | --------- | ----------------------------------------------------------------- |
417
- | `--port <n>` | `5173` | HTTP port to listen on |
438
+ | `[file]` | | Game file to boot into (`.prg`, `.d64`, `.crt`, `.c64`) |
439
+ | `--open` | off | Open the player in your default browser |
440
+ | `--port <n>` | `5173` | HTTP port to listen on (`0` picks any free port) |
418
441
  | `--host` | localhost | Bind to `0.0.0.0` so the player is reachable on the local network |
419
442
  | `--help` | | Print usage |
420
443
 
package/bin/serve.mjs CHANGED
@@ -5,166 +5,74 @@
5
5
  /**
6
6
  * c64-ready — browser player CLI
7
7
  *
8
- * Serves the pre-built C64 browser player from the package's dist/ directory
9
- * using a lightweight static HTTP server. Open the printed URL in any modern
10
- * browser to play.
8
+ * Serves the pre-built C64 browser player from the package's dist/ directory. Pass a
9
+ * game file to boot the player straight into it.
11
10
  *
12
11
  * Usage:
13
- * c64-ready [options]
14
- *
15
- * Options:
16
- * --port <n> HTTP port to listen on (default: 5173)
17
- * --host Bind to 0.0.0.0 instead of localhost
18
- * --help Show this help
12
+ * c64-ready [game-file] [--port <n>] [--host] [--open] [--help]
19
13
  *
20
14
  * Examples:
21
- * # Serve on default port (installed globally or via npx)
22
15
  * npx c64-ready
23
- *
24
- * # Custom port, accessible on the local network
16
+ * npx c64-ready build/main.prg --open
25
17
  * npx c64-ready --port 8080 --host
26
18
  */
27
19
 
28
- import { createServer } from 'http';
29
- import { createReadStream, existsSync, statSync } from 'fs';
30
- import { extname, join, resolve, normalize } from 'path';
31
- import { fileURLToPath } from 'url';
32
-
33
- const __dirname = fileURLToPath(new URL('.', import.meta.url));
34
- const PKG_ROOT = resolve(__dirname, '..');
35
-
36
- // ---------------------------------------------------------------------------
37
- // Arg parsing
38
- // ---------------------------------------------------------------------------
39
- const argv = process.argv.slice(2);
40
-
41
- if (argv.includes('--help') || argv.includes('-h')) {
42
- console.log(`
43
- c64-ready — headless-free browser player
44
-
45
- Usage:
46
- c64-ready [--port <n>] [--host] [--help]
47
-
48
- Options:
49
- --port <n> HTTP port (default: 5173)
50
- --host Bind to 0.0.0.0 so the player is reachable on your LAN
51
- --help Show this help
20
+ import { existsSync } from 'node:fs';
21
+ import { join, resolve } from 'node:path';
22
+ import { fileURLToPath } from 'node:url';
23
+ import {
24
+ HELP,
25
+ parseServeArgs,
26
+ createPlayerServer,
27
+ playerPath,
28
+ openInBrowser,
29
+ } from '../src/headless/player-server.mjs';
30
+
31
+ const PKG_ROOT = resolve(fileURLToPath(new URL('.', import.meta.url)), '..');
32
+ // Vite builds the app to dist/ with base '/c64-ready/'; dist/index.html is the entry point.
33
+ const DIST_DIR = join(PKG_ROOT, 'dist');
52
34
 
53
- Examples:
54
- npx c64-ready
55
- npx c64-ready --port 8080 --host
56
- `.trim());
35
+ let opts;
36
+ try {
37
+ opts = parseServeArgs(process.argv.slice(2));
38
+ } catch (e) {
39
+ console.error(`c64-ready: ${e.message} (see --help)`);
40
+ process.exit(1);
41
+ }
42
+ if (opts.help) {
43
+ console.log(HELP);
57
44
  process.exit(0);
58
45
  }
59
46
 
60
- const portIdx = argv.indexOf('--port');
61
- const port = portIdx !== -1 ? parseInt(argv[portIdx + 1], 10) : 5173;
62
- const bindAll = argv.includes('--host');
63
- const hostname = bindAll ? '0.0.0.0' : '127.0.0.1';
64
-
65
- // ---------------------------------------------------------------------------
66
- // Locate the built dist/ directory
67
- // ---------------------------------------------------------------------------
68
- // Vite builds to dist/ with base '/c64-ready/'.
69
- // The real app entry point is dist/index.html — assets are at dist/assets/*.
70
- // dist/c64-ready/ is just the public/c64-ready/ static folder copied verbatim;
71
- // it is NOT the built app.
72
- const DIST_DIR = join(PKG_ROOT, 'dist');
73
- const APP_ENTRY = join(DIST_DIR, 'index.html');
74
-
75
- if (!existsSync(APP_ENTRY)) {
47
+ if (!existsSync(join(DIST_DIR, 'index.html'))) {
76
48
  console.error(
77
- `Error: built player not found at ${APP_ENTRY}\n` +
78
- `Run \`npm run build\` inside the c64-ready package first, or install a published release.`,
49
+ `Error: built player not found at ${join(DIST_DIR, 'index.html')}\n` +
50
+ 'Run `npm run build` inside the c64-ready package first, or install a published release.',
79
51
  );
80
52
  process.exit(1);
81
53
  }
82
54
 
83
- // ---------------------------------------------------------------------------
84
- // MIME types
85
- // ---------------------------------------------------------------------------
86
- const MIME = {
87
- '.html': 'text/html; charset=utf-8',
88
- '.js': 'application/javascript',
89
- '.mjs': 'application/javascript',
90
- '.ts': 'application/javascript',
91
- '.css': 'text/css',
92
- '.wasm': 'application/wasm',
93
- '.svg': 'image/svg+xml',
94
- '.png': 'image/png',
95
- '.gif': 'image/gif',
96
- '.ico': 'image/x-icon',
97
- '.crt': 'application/octet-stream',
98
- '.d64': 'application/octet-stream',
99
- '.json': 'application/json',
100
- '.ttf': 'font/ttf',
101
- '.map': 'application/json',
102
- };
103
-
104
- // ---------------------------------------------------------------------------
105
- // Static server
106
- // ---------------------------------------------------------------------------
107
- const server = createServer((req, res) => {
108
- // Strip query string and decode URI
109
- let urlPath = decodeURIComponent((req.url ?? '/').split('?')[0]);
110
-
111
- // Route the app root: /, /c64-ready, /c64-ready/ → dist/index.html
112
- if (
113
- urlPath === '/' ||
114
- urlPath === '/c64-ready' ||
115
- urlPath === '/c64-ready/'
116
- ) {
117
- res.writeHead(200, { 'Content-Type': 'text/html; charset=utf-8' });
118
- createReadStream(APP_ENTRY).pipe(res);
119
- return;
120
- }
121
-
122
- // All other requests are resolved against dist/ directly.
123
- // Vite bakes base='/c64-ready/' into all asset URLs, so strip that prefix
124
- // before resolving so the path maps into dist/ correctly:
125
- // /c64-ready/assets/index-xxx.js → dist/assets/index-xxx.js
126
- // /c64.wasm → dist/c64.wasm
127
- const stripped = urlPath.startsWith('/c64-ready/') ? urlPath.slice('/c64-ready/'.length) : urlPath;
128
- const relative = stripped.startsWith('/') ? stripped.slice(1) : stripped;
129
- const filePath = resolve(DIST_DIR, normalize(relative));
130
-
131
- // Path traversal guard
132
- if (!filePath.startsWith(DIST_DIR)) {
133
- res.writeHead(403);
134
- res.end('Forbidden');
135
- return;
136
- }
137
-
138
- if (!existsSync(filePath) || !statSync(filePath).isFile()) {
139
- // SPA fallback for any unmatched path
140
- res.writeHead(200, { 'Content-Type': 'text/html; charset=utf-8' });
141
- createReadStream(APP_ENTRY).pipe(res);
142
- return;
143
- }
55
+ const server = createPlayerServer({ distDir: DIST_DIR, gameFile: opts.file });
144
56
 
145
- const ext = extname(filePath).toLowerCase();
146
- const mime = MIME[ext] ?? 'application/octet-stream';
147
- res.writeHead(200, { 'Content-Type': mime });
148
- createReadStream(filePath).pipe(res);
149
- });
150
-
151
- server.listen(port, hostname, () => {
152
- const displayHost = bindAll ? '0.0.0.0' : 'localhost';
57
+ server.listen(opts.port, opts.host ? '0.0.0.0' : '127.0.0.1', () => {
58
+ const { port } = server.address();
59
+ const url = `http://localhost:${port}${playerPath(opts.file)}`;
153
60
  console.log(`\n C64 Ready player is running.\n`);
154
- console.log(` ➜ Local: http://localhost:${port}/c64-ready/`);
155
- if (bindAll) {
156
- console.log(` ➜ Network: http://${displayHost}:${port}/c64-ready/`);
61
+ if (opts.file) console.log(` Game: ${opts.file} (reload the page after rebuilding)`);
62
+ console.log(` ➜ Local: ${url}`);
63
+ if (opts.host) {
64
+ console.log(` ➜ Network: http://<this-machine's-ip>:${port}${playerPath(opts.file)}`);
157
65
  }
158
- console.log(`\n Open the URL above in a modern browser.\n`);
66
+ console.log(`\n Controls: arrow keys = joystick, Z or left Ctrl = fire, gamepads work too.`);
159
67
  console.log(` Press Ctrl+C to stop.\n`);
68
+ if (opts.open) openInBrowser(url);
160
69
  });
161
70
 
162
71
  server.on('error', (err) => {
163
72
  if (err.code === 'EADDRINUSE') {
164
- console.error(`Error: port ${port} is already in use. Try --port <other>`);
73
+ console.error(`Error: port ${opts.port} is already in use. Try --port <other> (or --port 0).`);
165
74
  } else {
166
75
  console.error('Server error:', err.message);
167
76
  }
168
77
  process.exit(1);
169
78
  });
170
-
@@ -0,0 +1 @@
1
+ import{t as e}from"./src-DX0rJQsE.js";import{n as t,t as n}from"./string-utils-CMVABfx0.js";var r=1899,i=19121,a=19122,o=19123,s=29,c=17953,l=17945,u=510,d=251,f=87,p=55,m=11,h=class{static ultimate={pollIntervalMs:1e3,memoryRanges:[{address:r,length:1,label:`Lives`},{address:i,length:3,label:`Score`},{address:s,length:1,label:`New Game`},{address:c,length:1,label:`Item Count`},{address:l,length:1,label:`Fuel Gauge`},{address:u,length:1,label:`Completed`}]};static get ultimateMemoryRanges(){return this.ultimate.memoryRanges}constructor({gameId:t,user:r,cheevosSet:i={cheevos:[]},poppedCheevos:a=[],popCheevo:o=async()=>{},postScore:s=async()=>({})}){this.name=`Action Biker`,console.log(`${this.name}::Loaded`,t),this._popCheevo=o,this.postScore=s,this.user=r,this.gameId=t,this.watcher=e(),this.cheevosSet=i,this.cheevosMap=i.cheevos.map((e,t)=>{let r=a.some(t=>t.achievement._id===e._id),i=()=>{};switch(n(e.title)){case`dontRideWithoutOne`:i=()=>this.cpuReadNS(c)===1;break;case`hellForLeathers`:i=()=>this.cpuReadNS(c)===2;break;case`passedYourTheory`:i=()=>this.cpuReadNS(c)===3;break;case`metalGear`:i=()=>this.cpuReadNS(c)===4;break;case`kidGloves`:i=()=>this.cpuReadNS(c)===5;break;case`nightRider`:i=()=>this.cpuReadNS(c)===6;break;case`petrolGauge`:i=()=>this.cpuReadNS(c)===7;break;case`gasGuzzler`:i=()=>this.cpuReadNS(c)===8&&this.cpuReadNS(l)===f;break;case`allTooledUp`:i=()=>this.cpuReadNS(c)===9;break;case`puddleOfMud`:i=()=>this.cpuReadNS(c)===10;break;case`illBeBack`:i=()=>this.cpuReadNS(c)===11;break;case`needForSpeed`:i=()=>this.cpuReadNS(c)>=12&&this.cpuReadNS(d)===m;break;case`thirstyWork`:i=()=>this.cpuReadNS(c)===13;break;case`hyperVisor`:i=()=>this.cpuReadNS(c)===14;break;case`highEmissionZone`:i=()=>this.cpuReadNS(c)===15;break;case`whereAreTheBrakes`:i=()=>this.cpuReadNS(c)===16;break;case`speedos`:i=()=>this.cpuReadNS(c)===17;break;case`masterOfTheLamps`:i=()=>this.cpuReadNS(c)===18;break;case`jamieOliveOil`:i=()=>this.cpuReadNS(c)===19;break;case`turboCharged`:i=()=>this.cpuReadNS(c)===20;break;case`onlyFins`:i=()=>this.cpuReadNS(c)===21;break;case`youveGotThemUseThem`:i=()=>this.cpuReadNS(c)===22;break;case`mirrorSignalManoevre`:i=()=>this.cpuReadNS(c)===23;break;case`tommyTutone`:i=()=>this.cpuReadNS(c)===24;break;case`raiseReflectors`:i=()=>this.cpuReadNS(c)===25;break;case`aToZ`:i=()=>this.cpuReadNS(c)===26;break;case`twistedElectricStarter`:i=()=>this.cpuReadNS(c)===27;break;case`packedTheSkips`:i=()=>this.cpuReadNS(c)===28;break;case`104GoodBuddy`:i=()=>this.cpuReadNS(c)===29;break;case`whiteStripes`:i=()=>this.cpuReadNS(c)===30;break;case`skiSunday`:i=()=>this.cpuReadNS(c)===31;break;case`safetyFirst`:i=()=>this.cpuReadNS(c)===32;break;case`lightFog`:i=()=>this.cpuReadNS(c)===33;break;case`goForASpeedRun`:i=()=>this.cpuReadNS(c)===34;break;case`kickstart`:i=()=>this.cpuReadNS(c)===35;break;case`gunsNRoses`:i=()=>this.cpuReadNS(c)===36;break;case`ginAndTonic`:i=()=>this.cpuReadNS(c)===37;break;case`revs`:i=()=>this.cpuReadNS(c)===38;break;case`didntWeHaveOneAlready`:i=()=>this.cpuReadNS(c)===39;break;case`noTickets`:i=()=>this.cpuReadNS(c)===40;break;case`noSecondPrize`:i=()=>this.gameCompleted();break}return{title:e.title,message:e.description,isPopped:r,check:i,cheevoId:e._id}}),this.resetGameVars()}resetGameVars(){this.score=0,this.lives=0,this.isGameOver=!0}newGameVars(){this.isGameOver=!1,this.score=this.getScore(),this.lives=this.getLives(),console.log(`Start New Game`,this.score,this.lives)}getScore(){let e=t(o,this),n=t(a,this),r=t(i,this);return parseInt(e+n+r,10)}getIsDead(){return this.cpuReadNS(s)===0}getLives(){return this.cpuReadNS(r)-48}newGameCheck(){return this.isGameOver&&this.getLives()>=5&&this.cpuReadNS(s)>=6}gameCompleted(){return this.cpuReadNS(c)===40&&this.cpuReadNS(u)===p}execute(){let e=this.getScore();e!==this.score&&(this.score=e,console.log(`score=`,this.score)),this.newGameCheck()&&(this.newGameVars(),this.watcher.dispatch(`newGame`,{}));let t=this.getLives();t!==this.lives&&(this.lives=t),(!this.isGameOver&&this.gameCompleted()||t===0&&this.getIsDead()&&!this.isGameOver)&&(this.isGameOver=!0,this.watcher.dispatch(`gameOver`,{score:this.score}),this.postScore(this.gameId,this.score,this.user.id,this.user.username).then(e=>{console.log(`Score posted successfully`,e),this.watcher.dispatch(`cheevo`,{title:`Score Submit Success`,message:`Your score of ${this.score} has been submitted to the ${this.name} Leaderboard!`})})),this.cheevosMap.forEach(e=>{!e.isPopped&&e.check()&&(e.isPopped=!0,console.log(`Pop Cheevo::`,e.title,e.message),this.popCheevo(e.cheevoId))})}async popCheevo(e){let t=await this._popCheevo(this.cheevosSet._id,this.user.id,e);console.log(`res popCheevo`,t),this.watcher.dispatch(`cheevo`,{title:t.achievement.title,message:t.achievement.description,thumbnailUrl:t.thumbnailUrl})}};export{h as default};
@@ -0,0 +1 @@
1
+ import{t as e}from"./src-DX0rJQsE.js";import{t}from"./string-utils-CMVABfx0.js";var n=16,r=38,i=39,a=33834,o=8,s=6,c=class{static ultimate={pollIntervalMs:250,memoryRanges:[{address:n,length:1,label:`Lives`},{address:r,length:2,label:`Playing / game over flags`},{address:a,length:o,label:`Score`}]};static get ultimateMemoryRanges(){return this.ultimate.memoryRanges}constructor({gameId:t,user:n,cheevosSet:r={cheevos:[]},poppedCheevos:i=[],popCheevo:a=async()=>{},postScore:o=async()=>({})}){this.name=`Panther`,console.log(`${this.name}::Loaded`,t),this._popCheevo=a,this.postScore=o,this.user=n,this.gameId=t,this.watcher=e(),this.cheevosSet=r,this.cheevosMap=this.buildCheevosMap(r.cheevos,i),this.resetGameVars()}resetGameVars(){this.score=0,this.highScore=0,this.lives=0,this.isGameOver=!0}newGameVars(){this.isGameOver=!1,this.score=this.getScore(),this.lives=this.getLives(),console.log(`${this.name}::Start New Game`,this.score,this.lives)}getScore(){let e=0;for(let t=0;t<o;t++)e=e*10+this.cpuReadNS(a+t);return e}getLives(){return this.cpuReadNS(n)}getIsPlaying(){return this.cpuReadNS(r)===1}getIsGameOverFlag(){return this.cpuReadNS(i)!==0}newGameCheck(){let e=this.getLives();return this.isGameOver&&this.getIsPlaying()&&!this.getIsGameOverFlag()&&e>0&&e<=s&&this.getScore()===0}restartCheck(e,t){return!this.isGameOver&&(e<this.score||e===0&&t===s&&this.lives<s)}gameOverCheck(){return!this.isGameOver&&(this.getLives()===0||this.getIsGameOverFlag())}execute(){if(this.newGameCheck()&&(this.newGameVars(),this.watcher.dispatch(`newGame`,{})),this.isGameOver)return;let e=this.getScore(),t=this.getLives();if(this.restartCheck(e,t)){console.log(`${this.name}::Restarted`,this.score),this.newGameVars(),this.watcher.dispatch(`newGame`,{}),this.watcher.dispatch(`livesChange`,{lives:this.lives});return}if(e!==this.score&&(this.score=e),t!==this.lives&&(this.lives=t,this.watcher.dispatch(`livesChange`,{lives:this.lives})),this.gameOverCheck()){this.isGameOver=!0;let e=this.score>this.highScore?this.score:0;e&&(this.highScore=this.score),this.watcher.dispatch(`gameOver`,{score:this.score,highScore:e});let t=this.score;this.postScore(this.gameId,t,this.user.id,this.user.username).then(()=>{this.watcher.dispatch(`cheevo`,{title:`Score Submit Success`,message:`Your score of ${t} has been submitted to the ${this.name} Leaderboard!`})})}this.checkCheevos()}buildCheevosMap(e,n){return e.map(e=>{let r=n.some(t=>t.achievement._id===e._id),i=()=>!1;switch(t(e.title)){}return{title:e.title,message:e.description,isPopped:r,check:i,cheevoId:e._id}})}checkCheevos(){this.cheevosMap.forEach(e=>{!e.isPopped&&e.check()&&(e.isPopped=!0,this.popCheevo(e.cheevoId))})}async popCheevo(e){let t=await this._popCheevo(this.cheevosSet._id,this.user.id,e);this.watcher.dispatch(`cheevo`,{title:t.achievement.title,message:t.achievement.description,thumbnailUrl:t.thumbnailUrl})}};export{c as default};
@@ -0,0 +1 @@
1
+ import{t as e}from"./src-DX0rJQsE.js";import{n as t,t as n}from"./string-utils-CMVABfx0.js";var r=4443,i=4444,a=4445,o=4446,s=4448,c=4454,l=4453,u=255,d=161,f=20,p=173,m=174,h=6323,g=78,_=79,v=168,y=2612,b=38,x=1784,S=16,C=64,w=128,T=1,E=4,D=61,O=26,k=class{static ultimate={pollIntervalMs:1e3,memoryRanges:[{address:r,length:4,label:`Score`},{address:s,length:1,label:`Lives`},{address:c,length:1,label:`Round`},{address:l,length:1,label:`Island`},{address:p,length:2,label:`DiamondOrder`},{address:h,length:1,label:`Credits`},{address:g,length:2,label:`Powerups`},{address:v,length:2,label:`IslandFlag`},{address:b,length:1,label:`RoundEndFlag`},{address:y,length:1,label:`CoinOpFlag`},{address:x,length:2,label:`GoodEndingMarkers`}]};static get ultimateMemoryRanges(){return this.ultimate.memoryRanges}constructor({gameId:t,user:r,cheevosSet:i={cheevos:[]},poppedCheevos:a=[],popCheevo:o=async()=>{},postScore:s=async()=>({})}){this.name=`Rainbow Islands (LOCAL)`,console.log(`${this.name} - LIVE`,t),this._popCheevo=o,this.postScore=s,this.user=r,this.gameId=t,this.watcher=e(),this.resetGameVars(),this.cheevosSet=i,this.cheevosMap=i.cheevos.map(e=>{let t=a.some(t=>t.achievement._id===e._id),r;switch(n(e.title)){case`potOfGold`:r=()=>this.score>=25e4;break;case`bigFood`:r=()=>this.score>=5e5;break;case`bigWhoop`:r=()=>this.score>=1e6;break;case`bugSpray`:r=()=>this.islandNumber===1;break;case`helikopterHelikopter`:r=()=>this.islandNumber===2;break;case`doTheMash`:r=()=>this.islandNumber===3;break;case`toyStory`:r=()=>this.islandNumber===4;break;case`revengeOnDoh`:r=()=>this.islandNumber===5;break;case`theDroidsYourLookingFor`:r=()=>this.islandNumber===6;break;case`endOfTheRainbow`:r=()=>this.islandNumber===7;break;case`perfectCollection`:r=()=>this.cpuReadNS(m)===0&&this.cpuReadNS(p)===0&&this.islandNumber===0;break;case`the1cc`:r=()=>this.islandNumber===7&&this.getCredits()===this.startingCredits;break;case`needForSpeed`:r=()=>(this.cpuReadNS(_)&C)>=C;break;case`redPotionMastery`:r=()=>(this.cpuReadNS(_)&T)>=T;break;case`yellowPotionMastery`:r=()=>(this.cpuReadNS(_)&E)===E;break;case`bookOfWings`:r=()=>(this.cpuReadNS(_)&w)===w;break;case`shilverDoor`:r=()=>this.shilverDoorCollected;break;case`birdsOfAFeather`:r=()=>(this.cpuReadNS(_)&S)===S;break;case`coinOp`:r=()=>this.finalCoinCollected;break;case`rainbowVeteran`:r=()=>this.getPermanentPowerupCount()>=2;break;case`rainbowElite`:r=()=>this.getPermanentPowerupCount()>=3;break;case`rainbowUltimateMaster`:r=()=>this.getPermanentPowerupCount()>=4;break;case`goodEnding`:r=()=>this.cpuReadNS(4453)===161&&this.cpuReadNS(4454)===20&&this.cpuReadNS(1784)===12&&this.cpuReadNS(1785)===12;break;case`wingsOfDeath`:r=()=>this.diedWithWings;break;default:break}return{title:e.title,message:e.description,isPopped:t,check:r||(()=>!1),cheevoId:e._id}}),console.log(`CheevosMap::`,this.cheevosMap)}resetGameVars(){this.score=0,this.lives=u,this.isGameOver=!0,this.isGameInProgress=!1,this.scoreSubmitted=!1,this.roundNumber=0,this.islandNumber=0,this.startingCredits=0,this.finalCoinPresent=!1,this.finalCoinCollected=!1,this.shilverDoorCollected=!1,this.hadWingsPowerUp=!1,this.diedWithWings=!1}newGameVars(){this.isGameOver=!1,this.isGameInProgress=!0,this.score=this.getScore(),this.lives=this.getLives(),this.scoreSubmitted=!1,this.roundNumber=0,this.islandNumber=0,this.startingCredits=this.getCredits(),this.finalCoinPresent=!1,this.finalCoinCollected=!1,this.shilverDoorCollected=!1,this.hadWingsPowerUp=!1,this.diedWithWings=!1,console.log(`Started New Game`,this.score,this.lives)}getScore(){let e=t(r,this),n=t(i,this),s=t(a,this),c=t(o,this);return parseInt(e+n+s+c,10)}getIsland(){return this.cpuReadNS(l)}getRound(){return this.cpuReadNS(c)}getLives(){return this.cpuReadNS(s)}hasWingsPowerUp(){return(this.cpuReadNS(g)&w)===w||(this.cpuReadNS(_)&w)===w}getPermanentPowerupCount(){let e=this.cpuReadNS(_),t=0;return(e&C)===C&&(t+=1),(e&T)===T&&(t+=1),(e&E)===E&&(t+=1),(e&w)===w&&(t+=1),(e&S)===S&&(t+=1),this.shilverDoorCollected&&(t+=1),this.finalCoinCollected&&(t+=1),t}newGameCheck(){let e=this.getLives();return this.isGameOver&&e===2&&this.cpuReadNS(p)===6}endGameCheck(){return this.isGameInProgress&&(this.getLives()===u||this.gameCompleteCheck())}gameCompleteCheck(){return this.cpuReadNS(l)===d&&this.cpuReadNS(c)===f}execute(){this.newGameCheck()&&(this.newGameVars(),this.watcher.dispatch(`newGame`,{}));let e=this.hasWingsPowerUp(),t=this.getLives();if(t!==this.lives&&(!this.isGameOver&&this.isGameInProgress&&(t<this.lives||t===u)&&(this.hadWingsPowerUp||e)&&(this.diedWithWings=!0),this.lives=t,console.log(`${this.name}.lives=`,this.lives)),this.hadWingsPowerUp=e,this.endGameCheck()){if(this.isGameOver=!0,this.isGameInProgress=!1,this.scoreSubmitted)return;this.scoreSubmitted=!0,this.watcher.dispatch(`gameOver`,{score:this.score}),this.postScore(this.gameId,this.score,this.user.id,this.user.username).then(e=>{console.log(`Score posted successfully`,e),this.watcher.dispatch(`cheevo`,{title:`Score Submit Success`,message:`Your score of ${this.score} has been submitted to the ${this.name} Leaderboard!`})})}if(this.isGameOver){this.checkCheevos(e=>e.title===`Wings of Death`);return}let n=this.getScore();n!==this.score&&!this.isGameOver&&(this.score=n);let r=this.getRound();r!==this.roundNumber&&(this.roundNumber=r);let i=this.getIsland();i!==this.islandNumber&&(console.log(`New Island .islandNumber=${this.islandNumber}`,this.roundNumber),this.islandNumber=i),this.cpuReadNS(y)===D&&this.cpuReadNS(b)===O&&(this.finalCoinPresent=!0),this.finalCoinPresent&&this.cpuReadNS(y)===0&&(this.finalCoinCollected=!0),this.roundNumber===19&&this.cpuReadNS(v)===5&&(this.shilverDoorCollected=!0),this.checkCheevos()}checkCheevos(e=()=>!0){this.cheevosMap.forEach(t=>{e(t)&&!t.isPopped&&t.check()&&(t.isPopped=!0,console.log(`Pop Cheevo::`,t.title,t.message),this.popCheevo(t.cheevoId))})}async popCheevo(e){let t=await this._popCheevo(this.cheevosSet._id,this.user.id,e);console.log(`res popCheevo`,t),this.watcher.dispatch(`cheevo`,{title:t.achievement.title,message:t.achievement.description,thumbnailUrl:t.thumbnailUrl})}getCredits(){return this.cpuReadNS(h)===0}};export{k as default};
@@ -0,0 +1 @@
1
+ import{t as e}from"./src-DX0rJQsE.js";import{t}from"./string-utils-CMVABfx0.js";var n=107,r=8,i=181,a=235,o=32918,s=5,c=class{static ultimate={pollIntervalMs:250,memoryRanges:[{address:n,length:r,label:`Score`},{address:i,length:1,label:`Lives`},{address:a,length:1,label:`Play screen off`},{address:o,length:1,label:`Demo mode`}]};static get ultimateMemoryRanges(){return this.ultimate.memoryRanges}constructor({gameId:t,user:n,cheevosSet:r={cheevos:[]},poppedCheevos:i=[],popCheevo:a=async()=>{},postScore:o=async()=>({})}){this.name=`Road Runner`,console.log(`${this.name}::Loaded`,t),this._popCheevo=a,this.postScore=o,this.user=n,this.gameId=t,this.watcher=e(),this.cheevosSet=r,this.cheevosMap=this.buildCheevosMap(r.cheevos,i),this.resetGameVars()}resetGameVars(){this.score=0,this.highScore=0,this.lives=0,this.isGameOver=!0}newGameVars(){this.isGameOver=!1,this.score=this.getScore(),this.lives=this.getLives(),console.log(`${this.name}::Start New Game`,this.score,this.lives)}getScore(){let e=0;for(let t=0;t<r;t++)e=e*10+this.cpuReadNS(n+t);return e}getLives(){return this.cpuReadNS(i)}getIsPlayScreen(){return this.cpuReadNS(a)===0}getIsDemoMode(){return this.cpuReadNS(o)!==0}newGameCheck(){return this.isGameOver&&!this.getIsDemoMode()&&this.getIsPlayScreen()&&this.getLives()===s&&this.getScore()===0}gameOverCheck(){return!this.isGameOver&&this.getLives()===0}execute(){if(this.newGameCheck()&&(this.newGameVars(),this.watcher.dispatch(`newGame`,{})),this.isGameOver)return;let e=this.getScore();e!==this.score&&(this.score=e);let t=this.getLives();if(t!==this.lives&&(this.lives=t,this.watcher.dispatch(`livesChange`,{lives:this.lives})),this.gameOverCheck()){this.isGameOver=!0;let e=this.score>this.highScore?this.score:0;e&&(this.highScore=this.score),this.watcher.dispatch(`gameOver`,{score:this.score,highScore:e});let t=this.score;this.postScore(this.gameId,t,this.user.id,this.user.username).then(()=>{this.watcher.dispatch(`cheevo`,{title:`Score Submit Success`,message:`Your score of ${t} has been submitted to the ${this.name} Leaderboard!`})})}this.checkCheevos()}buildCheevosMap(e,n){return e.map(e=>{let r=n.some(t=>t.achievement._id===e._id),i=()=>!1;switch(t(e.title)){}return{title:e.title,message:e.description,isPopped:r,check:i,cheevoId:e._id}})}checkCheevos(){this.cheevosMap.forEach(e=>{!e.isPopped&&e.check()&&(e.isPopped=!0,this.popCheevo(e.cheevoId))})}async popCheevo(e){let t=await this._popCheevo(this.cheevosSet._id,this.user.id,e);this.watcher.dispatch(`cheevo`,{title:t.achievement.title,message:t.achievement.description,thumbnailUrl:t.thumbnailUrl})}};export{c as default};
@@ -0,0 +1 @@
1
+ import{t as e}from"./src-DX0rJQsE.js";var t=23234,n=23326,r=[0,1,2,64,65,66],i=3,a=8,o=7709,s=3,c=new Map([[56,108,198,198,198,108,56,0],[24,56,24,24,24,24,60,0],[60,70,198,12,112,192,254,0],[60,102,6,60,6,102,60,0],[12,28,60,108,204,254,12,0],[252,192,192,120,12,12,248,0],[60,66,192,252,198,198,124,0],[126,102,102,12,12,24,24,0],[120,196,228,120,158,134,124,0],[124,198,198,126,6,12,120,0]].map((e,t)=>[e.join(`,`),t])),l=class{static ultimate={pollIntervalMs:1e3,memoryRanges:[{address:23232,length:192,label:`HUD sprites`},{address:o,length:1,label:`Game over`}]};static get ultimateMemoryRanges(){return this.ultimate.memoryRanges}constructor({gameId:t,user:n,cheevosSet:r={cheevos:[]},poppedCheevos:i=[],popCheevo:a=async()=>{},postScore:o=async()=>({})}){this.name=`RocnRope`,console.log(`${this.name} - DEV`,t),this._popCheevo=a,this.postScore=o,this.user=n,this.gameId=t,this.watcher=e(),this.resetGameVars(),this.cheevosSet=r,this.cheevosMap=r.cheevos.map(e=>{let t=i.some(t=>t.achievement._id===e._id);return{title:e.title,message:e.description,isPopped:t,check:(()=>!1),cheevoId:e._id}}),console.log(`CheevosMap::`,this.cheevosMap)}resetGameVars(){this.score=0,this.lives=0,this.isGameOver=!0,this.isGameInProgress=!1,this.scoreSubmitted=!1}newGameVars(e){this.isGameOver=!1,this.isGameInProgress=!0,this.score=e.score,this.lives=e.lives,this.scoreSubmitted=!1,console.log(`Started New Game`,this.score,this.lives)}readDigit(e){let t=[];for(let n=0;n<a;n++)t.push(this.cpuReadNS(e+n*i));return c.get(t.join(`,`))??null}readHud(){let e=this.readDigit(t);if(e===null)return null;let i=0;for(let e of r){let t=this.readDigit(n+e);if(t===null)return null;i=i*10+t}return{score:i,lives:e}}getIsGameOverFlag(){return this.cpuReadNS(o)!==0}newGameCheck(e){return this.isGameOver&&!this.getIsGameOverFlag()&&e!==null&&e.lives===s&&e.score===0}endGameCheck(){return this.isGameInProgress&&this.getIsGameOverFlag()}execute(){let e=this.readHud();if(this.newGameCheck(e)&&(this.newGameVars(e),this.watcher.dispatch(`newGame`,{})),this.isGameInProgress&&e&&(e.lives!==this.lives&&(this.lives=e.lives,console.log(`${this.name}.lives=`,this.lives)),e.score!==this.score&&(this.score=e.score)),this.endGameCheck()){if(this.isGameOver=!0,this.isGameInProgress=!1,this.scoreSubmitted)return;this.scoreSubmitted=!0,this.watcher.dispatch(`gameOver`,{score:this.score}),this.postScore(this.gameId,this.score,this.user.id,this.user.username).then(e=>{console.log(`Score posted successfully`,e),this.watcher.dispatch(`cheevo`,{title:`Score Submit Success`,message:`Your score of ${this.score} has been submitted to the ${this.name} Leaderboard!`})})}this.isGameOver||this.checkCheevos()}checkCheevos(e=()=>!0){this.cheevosMap.forEach(t=>{e(t)&&!t.isPopped&&t.check()&&(t.isPopped=!0,console.log(`Pop Cheevo::`,t.title,t.message),this.popCheevo(t.cheevoId))})}async popCheevo(e){let t=await this._popCheevo(this.cheevosSet._id,this.user.id,e);console.log(`res popCheevo`,t),this.watcher.dispatch(`cheevo`,{title:t.achievement.title,message:t.achievement.description,thumbnailUrl:t.thumbnailUrl})}};export{l as default};
@@ -0,0 +1 @@
1
+ import{t as e}from"./src-DX0rJQsE.js";import{n as t,t as n}from"./string-utils-CMVABfx0.js";var r=384,i=385,a=386,o=37891,s=37890,c=99,l=3,u=class{static ultimate={pollIntervalMs:250,memoryRanges:[{address:c,length:1,label:`Demo mode`},{address:r,length:3,label:`Score`},{address:s,length:2,label:`Fuel empty and lives`}]};static get ultimateMemoryRanges(){return this.ultimate.memoryRanges}constructor({gameId:t,user:n,cheevosSet:r={cheevos:[]},poppedCheevos:i=[],popCheevo:a=async()=>{},postScore:o=async()=>({})}){this.name=`Thrust`,console.log(`${this.name}::Loaded`,t),this._popCheevo=a,this.postScore=o,this.user=n,this.gameId=t,this.watcher=e(),this.cheevosSet=r,this.cheevosMap=this.buildCheevosMap(r.cheevos,i),this.resetGameVars()}resetGameVars(){this.score=0,this.highScore=0,this.lives=0,this.isGameOver=!0}newGameVars(){this.isGameOver=!1,this.score=this.getScore(),this.lives=this.getLives(),console.log(`${this.name}::Start New Game`,this.score,this.lives)}getScore(){let e=t(a,this),n=t(i,this),o=t(r,this);return parseInt(e+n+o,10)*10}getLivesByte(){return this.cpuReadNS(o)}getLives(){let e=this.getLivesByte();return e&128?0:parseInt(e.toString(16),10)}getIsDemoMode(){return this.cpuReadNS(c)!==0}getIsOutOfFuel(){return this.cpuReadNS(s)!==0}newGameCheck(){return this.isGameOver&&!this.getIsDemoMode()&&this.getLivesByte()===l&&!this.getIsOutOfFuel()&&this.getScore()===0}gameOverCheck(){return!this.isGameOver&&((this.getLivesByte()&128)!=0||this.getIsOutOfFuel()||this.getIsDemoMode())}execute(){if(this.newGameCheck()&&(this.newGameVars(),this.watcher.dispatch(`newGame`,{})),this.isGameOver)return;let e=this.getScore();!this.getIsDemoMode()&&e!==this.score&&(this.score=e);let t=this.getLives();if(t!==this.lives&&(this.lives=t,this.watcher.dispatch(`livesChange`,{lives:this.lives})),this.gameOverCheck()){if(this.isGameOver=!0,this.score===0)return;let e=this.score>this.highScore?this.score:0;e&&(this.highScore=this.score),this.watcher.dispatch(`gameOver`,{score:this.score,highScore:e});let t=this.score;this.postScore(this.gameId,t,this.user.id,this.user.username).then(()=>{this.watcher.dispatch(`cheevo`,{title:`Score Submit Success`,message:`Your score of ${t} has been submitted to the ${this.name} Leaderboard!`})})}this.checkCheevos()}buildCheevosMap(e,t){return e.map(e=>{let r=t.some(t=>t.achievement._id===e._id),i=()=>!1;switch(n(e.title)){}return{title:e.title,message:e.description,isPopped:r,check:i,cheevoId:e._id}})}checkCheevos(){this.cheevosMap.forEach(e=>{!e.isPopped&&e.check()&&(e.isPopped=!0,this.popCheevo(e.cheevoId))})}async popCheevo(e){let t=await this._popCheevo(this.cheevosSet._id,this.user.id,e);this.watcher.dispatch(`cheevo`,{title:t.achievement.title,message:t.achievement.description,thumbnailUrl:t.thumbnailUrl})}};export{u as default};