README with logo and screenshots, separate test save profile, real minimum macOS version

This commit is contained in:
CRTkafa 2026-10-16 04:05:08 +08:00
parent 6fe22ef2a3
commit a60684e5dc
6 changed files with 112 additions and 37 deletions

131
README.md
View file

@ -1,22 +1,53 @@
# Spy Mouse for macOS <p align="center">
<img src="docs/images/logo.png" alt="Spy Mouse" width="320">
</p>
Runs the original Android release of Spy Mouse (EA / Firemint, v1.0.5) natively on a Mac. <p align="center">
The game's own `libSpyMouse.so` (32-bit ARM) is executed on an emulated ARM1176 CPU (Unicorn), <b>The original Android release of Spy Mouse (EA / Firemint, 2011), running natively on macOS.</b><br>
and the Android platform it expects is provided on the host: Mouse, keyboard, any window size, fullscreen.
</p>
- `src/core.cpp`: guest memory, CPU engines per thread, HLE call dispatch (SVC thunks) <p align="center">
- `src/elf.cpp`: ELF loader and relocations <img src="docs/images/menu.jpg" alt="Main menu at 16:9" width="49%">
- `src/libc.cpp`: bionic libc, libm, liblog, pthread (threads run on real host threads) <img src="docs/images/gameplay.jpg" alt="A level at 16:9" width="49%">
- `src/gl.cpp`: OpenGL ES 1.1 to desktop OpenGL 2.1 </p>
- `src/jni.cpp`: a small fake Java VM (activity, assets, AudioTrack, display, storage)
- `src/video.mm`: intro/outro videos through AVFoundation
- `src/main.cpp`: window, input, Android lifecycle (separate UI and GL threads, like Android)
No game files are in this repository. Put your own copy in `game/`: Spy Mouse was removed from the stores in 2015 and its 32-bit ARM builds no longer run on current phones or
on any Mac. This project is a loader: it runs the game's own `libSpyMouse.so` from the Android APK, unmodified, on an
emulated ARM CPU and provides the Android platform the game expects. The game logic, levels, art and sound are the
original ones; nothing of the game is reimplemented.
**No game files are included.** You need your own copy of the Android version.
## How it works
| Part | File | What it does |
| --- | --- | --- |
| CPU | `src/core.cpp` | Unicorn (ARM1176 with VFP short vectors) runs the ARM code; one engine per guest thread and call depth |
| Loader | `src/elf.cpp` | Maps the ELF, applies relocations, links imports to host functions |
| libc | `src/libc.cpp` | Bionic libc, libm, liblog and pthread on top of macOS (guest threads are real host threads) |
| Graphics | `src/gl.cpp` | OpenGL ES 1.1 to desktop OpenGL 2.1, multisampled surface |
| Java | `src/jni.cpp` | A small JNI environment with the classes the game calls (activity, assets, AudioTrack, display, storage, keyboard) |
| Video | `src/video.mm` | The intro and outro videos through AVFoundation |
| Web view | `src/browser.mm` | The in-game help and legal pages through WKWebView |
| App | `src/main.cpp` | Window, input, Android lifecycle with separate UI and GL threads, as on Android |
The Java side was decompiled to check that every call behaves like the original (touch throttling, video view
sizing, web view callbacks, back key). Network features (Origin, leaderboards) report no connection, since EA's servers
are gone.
## Requirements
- A Mac with Apple Silicon. The app bundles Homebrew's libraries, so it runs on the macOS version it was built on
and later
- Homebrew packages: `unicorn`, `sdl3`, `cmake`
- Spy Mouse for Android 1.0.5 (`com.ea.spymouse_carrier`): the APK and its downloaded data
Put the game in `game/`:
``` ```
game/apk/ the unzipped APK (lib/armeabi/libSpyMouse.so, assets/) game/apk/ the unzipped APK (lib/armeabi/libSpyMouse.so, assets/)
game/data/ the downloaded game data (res/, res_960x640/) game/data/ the downloaded data (res/, res_960x640/)
``` ```
## Build and run ## Build and run
@ -27,27 +58,57 @@ tools/make_app.sh
open "dist/Spy Mouse.app" open "dist/Spy Mouse.app"
``` ```
## Controls `tools/make_app.sh` builds a self-contained, ad-hoc signed app with the dylibs and your game files inside.
- Mouse: tap, drag and draw paths (the game's touch input)
- WASD or arrow keys: walk. The port touches the player sprite (found from the game's own draw calls) and
keeps a finger just ahead of it in the held direction, so the game receives a normal drawn path
- Esc or right click: Android Back (pause in a level, back in menus); other keys go to the game's physical-keyboard input
- P: pause / resume, R: retry. They press the game's own buttons where they were last drawn (found from the
textures in the draw calls), so they follow the game's layout at any window size
- The cursor hides while you steer with the keyboard and after a few idle seconds in fullscreen
- Window size, position and fullscreen are remembered (`window.txt` in the save folder)
- Rendering is 4x multisampled (`--msaa N` to change)
- Cmd+F, F11 or Alt+Enter: fullscreen; Cmd+W or Cmd+Q: quit (the game saves first)
- Any window size or aspect ratio: the game gets a surface of the window's pixel size and lays itself out for it,
like an Android device with that screen; resizing sends a surface change
Saves and the log go to `~/Library/Application Support/SpyMouse/`. Saves and the log go to `~/Library/Application Support/SpyMouse/`.
## Testing ## Controls
`--headless` runs without showing a window. `--control DIR` accepts commands written to `DIR/cmd` | Input | Action |
(`tap X Y`, `drag X1 Y1 X2 Y2 [frames]`, `wait N`, `shot NAME`, `pause`, `resume`, `quit`), see `tools/ctl.sh`. | --- | --- |
Input that goes through the real SDL event path: `click X Y`, `mdrag X1 Y1 X2 Y2 [frames]`, `press SDLKEY` (window points); | Mouse | Tap, drag and draw paths (the game's touch input) |
`resize W H`, `key ANDROIDKEY`. | WASD / arrow keys | Walk. The player sprite is found from the game's draw calls and a path is drawn just ahead of it |
Other flags: `--size WxH`, `--surface-scale S`, `--skip-video`, `--frames N`, `--shot F1,F2`, `--gl-trace`, `--check-present`, `--verbose`. | Esc / right click | Android Back: pause in a level, back in menus |
| P | Pause / resume |
| R | Retry the level |
| Cmd+F, F11, Alt+Enter | Fullscreen |
| Cmd+W, Cmd+Q | Quit (the game saves first) |
P and R press the game's own buttons where they are drawn, so they follow the layout at any window size.
## Display
The game renders at the window's pixel size (Retina included) and lays itself out for any aspect ratio, like an
Android device with that screen. Resizing the window sends a surface change. Rendering is 4x multisampled, and the
window size, position and fullscreen state are remembered.
## Status
Tested in hidden-window runs with silent audio: boot, intro video, menus (options, achievements, stats, help,
credits, backpack, dossiers), levels of world 1, being caught, retry, results, saving and loading,
pause and resume, window resizing at 3:2, 16:10, 16:9 and 4:3, mouse, keyboard steering and shortcuts.
Not done:
- Later worlds have not been played through by the test harness
- No frame-by-frame comparison against a real Android device
- Multi-touch: a Mac has one pointer
## Testing harness
`--headless` runs without a window, without audio and with its own save profile, and stops after `--max-seconds`.
`--control DIR` reads commands from `DIR/cmd` (see `tools/ctl.sh`):
- Touch: `tap X Y`, `drag X1 Y1 X2 Y2 [frames]`
- Real input path (window points): `click X Y`, `mdrag X1 Y1 X2 Y2 [frames]`, `press SDLKEY`
- Other: `wait N`, `shot NAME`, `resize W H`, `key ANDROIDKEY`, `pause`, `resume`, `quit`
Other flags: `--size WxH`, `--surface-scale S`, `--msaa N`, `--save-dir DIR`, `--skip-video`, `--frames N`,
`--shot F1,F2`, `--gl-trace`, `--check-present`, `--track-log`, `--verbose`.
## Legal
This is an unofficial project, not affiliated with or endorsed by Electronic Arts or Firemint.
Spy Mouse is a trademark of Firemint Pty Ltd. The logo and screenshots in `docs/images` show the original game
and belong to their owners. The repository contains no game code or assets; the loader only runs a copy you provide.
Third-party code: [TLSF](https://github.com/mattconte/tlsf) (BSD) in `third_party/tlsf`.

BIN
docs/images/gameplay.jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 202 KiB

BIN
docs/images/logo.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 59 KiB

BIN
docs/images/menu.jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 307 KiB

View file

@ -201,6 +201,7 @@ int main(int argc, char** argv) {
else if (a == "--max-seconds") opt.max_seconds = atoi(next().c_str()); else if (a == "--max-seconds") opt.max_seconds = atoi(next().c_str());
else if (a == "--size") { sscanf(next().c_str(), "%dx%d", &opt.win_w, &opt.win_h); opt.size_given = true; } else if (a == "--size") { sscanf(next().c_str(), "%dx%d", &opt.win_w, &opt.win_h); opt.size_given = true; }
else if (a == "--msaa") opt.msaa = atoi(next().c_str()); else if (a == "--msaa") opt.msaa = atoi(next().c_str());
else if (a == "--save-dir") next(); // handled before startup
else if (a == "--surface-scale") opt.surface_scale = atof(next().c_str()); else if (a == "--surface-scale") opt.surface_scale = atof(next().c_str());
else if (a == "--gl-trace") gl_set_trace(true); else if (a == "--gl-trace") gl_set_trace(true);
} }
@ -215,6 +216,15 @@ int main(int argc, char** argv) {
} }
const char* home = getenv("HOME"); const char* home = getenv("HOME");
g_save_dir = std::string(home ? home : "/tmp") + "/Library/Application Support/SpyMouse"; g_save_dir = std::string(home ? home : "/tmp") + "/Library/Application Support/SpyMouse";
// Test runs never touch the player's saves: --headless uses its own profile unless --save-dir is given.
for (int k = 1; k < argc; k++) {
if (!strcmp(argv[k], "--save-dir") && k + 1 < argc) g_save_dir = argv[k + 1];
else if (!strcmp(argv[k], "--headless")) {
bool explicit_dir = false;
for (int j = 1; j < argc; j++) if (!strcmp(argv[j], "--save-dir")) explicit_dir = true;
if (!explicit_dir) g_save_dir += "/test-profile";
}
}
fs::create_directories(g_save_dir); fs::create_directories(g_save_dir);
log_open(g_save_dir + "/spymouse.log"); log_open(g_save_dir + "/spymouse.log");
if (game_dir.empty()) { logf("game data not found (expected game/apk and game/data)"); return 2; } if (game_dir.empty()) { logf("game data not found (expected game/apk and game/data)"); return 2; }

View file

@ -39,7 +39,11 @@ for s in 16 32 128 256; do cp "$ICONSET/icon_$((s*2))x$((s*2)).png" "$ICONSET/ic
rm "$ICONSET/icon_64x64.png" rm "$ICONSET/icon_64x64.png"
iconutil -c icns "$ICONSET" -o "$APP/Contents/Resources/AppIcon.icns" iconutil -c icns "$ICONSET" -o "$APP/Contents/Resources/AppIcon.icns"
cat > "$APP/Contents/Info.plist" <<'PLIST' # the app needs the newest macOS any of its binaries was built for
MINOS=$(for f in "$APP/Contents/MacOS/spymouse" "$APP"/Contents/Frameworks/*.dylib; do
otool -l "$f" | awk '/LC_BUILD_VERSION/{f=1} f&&/minos/{print $2; f=0}'; done | sort -V | tail -1)
cat > "$APP/Contents/Info.plist" <<PLIST
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0"> <plist version="1.0">
@ -52,7 +56,7 @@ cat > "$APP/Contents/Info.plist" <<'PLIST'
<key>CFBundlePackageType</key><string>APPL</string> <key>CFBundlePackageType</key><string>APPL</string>
<key>CFBundleShortVersionString</key><string>1.0.5</string> <key>CFBundleShortVersionString</key><string>1.0.5</string>
<key>CFBundleVersion</key><string>1</string> <key>CFBundleVersion</key><string>1</string>
<key>LSMinimumSystemVersion</key><string>13.0</string> <key>LSMinimumSystemVersion</key><string>$MINOS</string>
<key>NSHighResolutionCapable</key><true/> <key>NSHighResolutionCapable</key><true/>
<key>LSApplicationCategoryType</key><string>public.app-category.puzzle-games</string> <key>LSApplicationCategoryType</key><string>public.app-category.puzzle-games</string>
</dict> </dict>