Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ Thumbs.db
# Claude Code - local settings excluded, hooks tracked
.claude/settings.local.json

# Original NAAP Flash-based reference simulation (not tracked)
# Local decompile output (and any accidental NAAP re-clones). Upstream sources: ../Baseline/Astronomy/
NAAP/

# Flash decompilation tooling (npm run decompile) — downloaded FFDec
Expand Down
2 changes: 1 addition & 1 deletion CLAUDE.md
Original file line number Diff line number Diff line change
Expand Up @@ -77,5 +77,5 @@ npm run lint && npm run check && npm run build && npm test
## Development notes

- **`VariableStarPhotometryConstants.ts`** uses nested frozen `as const` groups (`FIELD`, `APERTURE`, `TIME`, `LAYOUT`, `PDM`) instead of a flat namespace — intentional for five distinct concerns; still no magic numbers in model/view code.
- **`npm run decompile`** extracts NAAP Flash ActionScript via JPEXS FFDec into gitignored `NAAP/decompiled/` — read-only reference.
- **`npm run decompile`** extracts NAAP Flash ActionScript via JPEXS FFDec from `../Baseline/Astronomy/flash-animations` into gitignored `NAAP/decompiled/`.
- After `npm run build`, the sim is installable offline via Workbox (`dist/manifest.webmanifest`).
15 changes: 15 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,21 @@ A SceneryStack port of the [NAAP Variable Star Photometry Lab](https://astro.unl
- English, French, and Spanish localization
- Progressive Web App (installable, offline-capable)

### NAAP reference sources

Upstream Flash / AIR / React NAAP sources live in the sibling
[`Baseline`](https://github.com/OpenPhysics/Baseline) repo under `Astronomy/`
(see `baselines.json`). Clone Baseline with the fleet bootstrap, then:

```bash
(cd ../Baseline && ./scripts/fetch-baselines.sh)
```

`npm run decompile` reads `.swf` files from
`../Baseline/Astronomy/flash-animations` and writes ActionScript into the
sim-local gitignored `NAAP/decompiled/` (requires Java; one-time
`npm run decompile -- --setup`).

## Quick Start

```bash
Expand Down
17 changes: 15 additions & 2 deletions scripts/decompile-flash.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
* decompile-flash.ts
*
* Extract readable ActionScript (and optionally assets) from the original NAAP
* Flash sources under `NAAP/`, so the ported Variable Star Photometry sim can be
* Flash sources under `../Baseline/Astronomy/flash-animations/` (sibling Baseline repo), so the ported Variable Star Photometry sim can be
* checked against the real implementation. See PORTING_PLAN.md → "Flash simulator
* inventory".
*
Expand Down Expand Up @@ -36,7 +36,18 @@ import { inflateRawSync } from "node:zlib";

const here = dirname(fileURLToPath(import.meta.url));
const repoRoot = resolve(here, "..");
const flashRoot = join(repoRoot, "NAAP", "flash-animations", "flashdev2");
const flashRoot = resolve(repoRoot, "..", "Baseline", "Astronomy", "flash-animations", "flashdev2");

/** Fail fast when the Baseline sibling checkout (or fetch) is missing. */
function ensureFlashRoot(): void {
if (!existsSync(flashRoot)) {
fail(
`NAAP Flash sources not found at:\n ${flashRoot}\n` +
`Clone OpenPhysics/Baseline as a sibling of this sim, then:\n` +
` (cd ../Baseline && ./scripts/fetch-baselines.sh --only Astronomy/flash-animations)`,
);
}
}

/**
* Latest canonical SWFs whose ActionScript informs the port (used by --all).
Expand Down Expand Up @@ -438,6 +449,8 @@ async function main(): Promise<void> {
return;
}

ensureFlashRoot();

const movies = resolveTargets(opts);
if (movies.length === 0) {
fail("No .swf targets resolved. Check the paths, or run with --help.");
Expand Down