From 1c216573b226b10957137705c2d7a5d42520222b Mon Sep 17 00:00:00 2001 From: Tom Ball Date: Wed, 21 Aug 2024 12:05:22 -0700 Subject: [PATCH] move code into sim directory --- libs/arcadeshield/init.ts | 2 - libs/arcadeshield/sim/arcadegamepad.h | 49 ------------------- .../sim/state.ts => sim/state/arcadeshield.ts | 12 +++-- .../arcadeshield/sim => sim/state}/bitmap.ts | 0 4 files changed, 9 insertions(+), 54 deletions(-) delete mode 100644 libs/arcadeshield/sim/arcadegamepad.h rename libs/arcadeshield/sim/state.ts => sim/state/arcadeshield.ts (80%) rename {libs/arcadeshield/sim => sim/state}/bitmap.ts (100%) diff --git a/libs/arcadeshield/init.ts b/libs/arcadeshield/init.ts index 65f5cfdb772..a23006fce02 100644 --- a/libs/arcadeshield/init.ts +++ b/libs/arcadeshield/init.ts @@ -23,8 +23,6 @@ namespace screen { namespace _screen_internal { //% shim=pxt::updateScreen function updateScreen(img: Bitmap): void { } - //% shim=pxt::updateStats - function updateStats(msg: string): void { } export function createScreen() { const img = bitmap.create( diff --git a/libs/arcadeshield/sim/arcadegamepad.h b/libs/arcadeshield/sim/arcadegamepad.h deleted file mode 100644 index bcfe4577511..00000000000 --- a/libs/arcadeshield/sim/arcadegamepad.h +++ /dev/null @@ -1,49 +0,0 @@ -// Autogenerated C header file for Arcade Gamepad -#ifndef _JACDAC_SPEC_ARCADE_GAMEPAD_H -#define _JACDAC_SPEC_ARCADE_GAMEPAD_H 1 - -#define JD_SERVICE_CLASS_ARCADE_GAMEPAD 0x1deaa06e - -// enum Button (uint8_t) -#define JD_ARCADE_GAMEPAD_BUTTON_LEFT 0x1 -#define JD_ARCADE_GAMEPAD_BUTTON_UP 0x2 -#define JD_ARCADE_GAMEPAD_BUTTON_RIGHT 0x3 -#define JD_ARCADE_GAMEPAD_BUTTON_DOWN 0x4 -#define JD_ARCADE_GAMEPAD_BUTTON_A 0x5 -#define JD_ARCADE_GAMEPAD_BUTTON_B 0x6 -#define JD_ARCADE_GAMEPAD_BUTTON_MENU 0x7 -#define JD_ARCADE_GAMEPAD_BUTTON_SELECT 0x8 -#define JD_ARCADE_GAMEPAD_BUTTON_RESET 0x9 -#define JD_ARCADE_GAMEPAD_BUTTON_EXIT 0xa - -/** - * Indicates which buttons are currently active (pressed). - * `pressure` should be `0xff` for digital buttons, and proportional for analog ones. - */ -#define JD_ARCADE_GAMEPAD_REG_BUTTONS JD_REG_READING -typedef struct jd_arcade_gamepad_buttons { - uint8_t button; // Button - uint8_t pressure; // ratio u0.8 -} jd_arcade_gamepad_buttons_t; - - -/** - * Constant. Indicates number of players supported and which buttons are present on the controller. - */ -#define JD_ARCADE_GAMEPAD_REG_AVAILABLE_BUTTONS 0x180 -typedef struct jd_arcade_gamepad_available_buttons { - uint8_t button[0]; // Button -} jd_arcade_gamepad_available_buttons_t; - - -/** - * Argument: button Button (uint8_t). Emitted when button goes from inactive to active. - */ -#define JD_ARCADE_GAMEPAD_EV_DOWN JD_EV_ACTIVE - -/** - * Argument: button Button (uint8_t). Emitted when button goes from active to inactive. - */ -#define JD_ARCADE_GAMEPAD_EV_UP JD_EV_INACTIVE - -#endif diff --git a/libs/arcadeshield/sim/state.ts b/sim/state/arcadeshield.ts similarity index 80% rename from libs/arcadeshield/sim/state.ts rename to sim/state/arcadeshield.ts index fa446d69348..7870bfb4fee 100644 --- a/libs/arcadeshield/sim/state.ts +++ b/sim/state/arcadeshield.ts @@ -50,7 +50,13 @@ namespace pxsim { runId: this.runId, value: b } - control.simmessages.send("arcadeshield", Buffer.fromUTF8(JSON.stringify(msg)), false) + Runtime.postMessage({ + type: 'serial', + data: "TODO", // this.serialOutBuffer + id: runtime.id, + sim: true + }) + // control.simmessages.send("arcadeshield", Buffer.fromUTF8(JSON.stringify(msg)), false) } setPalette(buf: RefBuffer) { @@ -60,7 +66,7 @@ namespace pxsim { runId: this.runId, data: buf.data.toString() } - control.simmessages.send("arcadeshield", Buffer.fromUTF8(JSON.stringify(msg)), false) + // TODO control.simmessages.send("arcadeshield", Buffer.fromUTF8(JSON.stringify(msg)), false) } updateStats(s: string) { @@ -74,7 +80,7 @@ namespace pxsim { runId: this.runId, data: img.data.toString() } - control.simmessages.send("arcadeshield", Buffer.fromUTF8(JSON.stringify(msg)), false) + // TODO control.simmessages.send("arcadeshield", Buffer.fromUTF8(JSON.stringify(msg)), false) } } diff --git a/libs/arcadeshield/sim/bitmap.ts b/sim/state/bitmap.ts similarity index 100% rename from libs/arcadeshield/sim/bitmap.ts rename to sim/state/bitmap.ts