Skip to content

Regalia v1.1.1

Choose a tag to compare

@YDW99 YDW99 released this 05 Jul 20:12
· 16 commits to main since this release
4aed18e

What's Changed

Full Changelog: v1.1.0...v1.1.1


🚀 Regalia v1.1.1 — Release Notes

Version: 1.1.1 · versionCode: 111 · Date: 2026-07-05
Engine: Stockfish 18 (arm64-v8a-dotprod, native build)
Min Android: 5.0 (API 21) · Target: Android 15 (API 35)


Overview

Regalia is a standalone, open-source chess app for Android — play offline against Stockfish 18, analyze your games, and explore openings. No account, no network, no tracking. Features full Chess960 (Fischer Random Chess) support, bilingual Chinese/English UI, personified move animations, and a comprehensive review/statistics system.

v1.1.1 is a quality-hardening release built on top of v1.1.0 (versionCode 110). While the version number increments, the focus is entirely on bug fixes, robustness, and architectural cleanup — no new user-facing features were added. Instead, 8 revision phases (Phase 59–66) were executed, each driven by user feedback and first-principles code audits.


What's New in v1.1.1

🔧 Bug Fixes

# Fix Impact
1 Duplicate every-5-moves PGN annotation — re-exporting an imported PGN no longer duplicates [%eval] / eval-description annotations. Whitespace-tolerant regex dedup. PGN round-trip fidelity
2 Step-0 eval not cachedonEngineEval now caches stale callbacks for the original step even when the user navigates before the callback arrives. The eval trend chart's data point at step 0 is no longer missing. Review mode correctness
3 Resignation/timeout comments hardcoded English — PGN comments now follow the app's global language (T() with new i18n keys). Bilingual PGN export
4 "Analyze All" sometimes incomplete — batch session decoupled from reviewStep via _reviewAnalyzeStep / _reviewAnalyzeGen / _evalRequestBatchGen. User navigation during batch no longer invalidates in-flight callbacks. Review analysis reliability
5 Visual annotation [%csl]/[%cal] PGN pollutionTRUE root cause found and fixed: reviewStates from a previous game's review session was not cleared in _resetGameUIState(), causing _computeAndCacheVisualAnnotations to use the old game's board state at the same move index. Fix: clear reviewStates on every new-game entry + gate the shortcut on reviewMode === true. PGN export correctness
6 Imported PGN not saving to PGN cache — pure-import games (no live moves) now save the original PGN text, preserving all comments/tags/NAGs. PGN cache manager
7 _savePGNYes timing bug — async export dialog could be open when the new game started. Fix: poll _pgnExportDialogActive before executing the pending action. Export flow reliability
8 Writer lock inconsistencycleanupEngineResources() / shutdown() / cleanupFailedEngine() now use _writerLock (consistent with Phase 58 heartbeat path). Engine concurrency safety
9 onRenderProcessGone infinite loop — crash-count backoff (max 3 recreates per 60s window). OEM ROM resilience
10 Integer_bitcount negative-input infinite loopn >>> 0 unsigned coercion. Defensive guard

🆕 New Features (minor)

  • Export annotation dialog — when exporting PGN (copy / file / cache save), a dialog asks whether to include special annotations ([%csl]/[%cal]/[%eval]/eval descriptions). Three options: "Yes, include special annotations" / "No, exclude special annotations" / Cancel. Supports Android back-button and haptic feedback.
  • Statistics board navigation buttons⏮ ◀ ▶ ⏭ below the stats board, context-aware (mainline vs variation).
  • Initial-position eval annotation — now a separate {} comment before the first move (not attached to white's first move).
  • Step-0 eval annotation[Initial position] prefix, deduped on re-export.

🏗️ Architectural Improvements

  • Centralized cache clearing_resetGameUIState() now clears 25+ state variables including _reviewEvalCache, _ecoRecCache, _pvCache, _visualAnnotationsCache, reviewStates, _preReviewSnapshot, setupHistory, and 7 dialog visibility flags. All 5 new-game entry points call it uniformly.
  • imported flag on visual annotations — distinguishes human-authored PGN annotations (imported=true) from auto-generated UI display aids (imported=false). Only imported=true entries are exported to PGN.
  • includeAnnotations parameter on _buildPGNString() — user-controlled annotation inclusion.
  • _requestBatchEval() — decoupled batch eval requests with generation counter, surviving user navigation and engine restarts.
  • _writerLock unification — all engineWriter access now goes through _writerLock, eliminating lock-inconsistency races.
  • Stale-state audit — following the reviewStates bug, audited all global state for similar patterns. Found and fixed _preReviewSnapshot, setupHistory/setupRedoStack, and 7 dialog flags not being cleared.

Phase-by-Phase Changelog

Phase 59 — Version bump + 4 bug fixes + analyze-all rewrite

  • Version bumped to versionCode=111, versionName="1.1.1"
  • Fix duplicate every-5-moves PGN [%eval] annotation (dedup via whitespace-tolerant regex)
  • Fix step-0 eval not cached (stale callbacks now cached for original step)
  • Add initial-position annotation to first move's {} comment with [Initial position] prefix
  • Fix resignation/timeout comments hardcoded English → T() i18n
  • First-principles rewrite of "Analyze All" batch logic: _reviewAnalyzeStep / _reviewAnalyzeGen / _evalRequestBatchGen decoupled from reviewStep

Phase 60 — Audit-driven fixes + stats board navigation

  • StockfishNative.java writer-close paths unified to _writerLock
  • Integer_bitcount() unsigned coercion
  • onRenderProcessGone() crash-count backoff (3/60s)
  • normalizeTagValue() tab filtering
  • Render-error page i18n (render_error_title key)
  • Navigation buttons (⏮ ◀ ▶ ⏭) below stats board (mainline/variation context-aware)
  • Static HTML export strips nav buttons (FEN-only); full-PGN export keeps them

Phase 61 — Cache pollution fix + PGN cache save + annotation move

  • _resetGameUIState() now centrally clears ALL game-related caches (15+ variables)
  • All 5 new-game entry points call _resetGameUIState() uniformly
  • _pgnCacheSaveCurrent() distinguishes pure-import vs live-play games
  • Initial-position eval annotation moved to separate {} comment before first move
  • Stats-page PGN sync verified

Phase 62 — Visual annotation imported flag

  • _visualAnnotationsCache entries now include imported boolean
  • Auto-generated annotations: imported=false (UI display aids, not exported)
  • Imported PGN annotations: imported=true (human-authored, exported)
  • _buildPGNString() only exports imported=true entries

Phase 63 — Export annotation dialog

  • _buildPGNString() accepts includeAnnotations parameter
  • _showPGNExportAnnotationDialog() shown before copy/export/cache-save
  • Three options: Yes / No / Cancel
  • 4 new i18n keys (bilingual zh/en)

Phase 64 — TRUE root cause fix: stale reviewStates

  • Root cause: _computeAndCacheVisualAnnotations used reviewStates[moveIdx+1] as a shortcut, but reviewStates from a previous game's review session was not cleared in _resetGameUIState()
  • Fix: clear reviewStates/reviewMode/reviewStep/reviewBaseState in _resetGameUIState()
  • Defense-in-depth: gate reviewStates shortcut on reviewMode === true
  • Export dialog text update: 💾 emoji, "特殊注释" / "special annotations" terminology

Phase 65 — Dialog back-button + haptics + stale-state audit

  • Export dialog: Android back-button support (equivalent to Cancel)
  • All dialog buttons: explicit HapticManager.fire('BUTTON_PRESS')
  • Stale-state audit: _preReviewSnapshot, setupHistory/setupRedoStack, 7 dialog flags — all now cleared
  • Overlay click-outside fixed: callback(null) (cancel) instead of callback(false) (No)

Phase 66 — Strict full-codebase audit

  • Bug fix: _savePGNYes timing (async dialog polling)
  • Redundancy: 2 stale console.log removals
  • Clarity: openStatsPage explicit includeAnnotations=true
  • Audit confirmation: all caches, flags, and declarations verified correct

Key Features

♟️ Chess Engine

  • Stockfish 18 (arm64-v8a-dotprod native build) — world-class engine
  • 8 difficulty levels (Lv.1–6 by ELO, Lv.7 Skill Level, Lv.8 Custom)
  • Real-time eval bar with depth, seldepth, nodes, NPS, and WDL
  • MultiPV analysis with 🌿Line variation display
  • Pondering support

🎨 User Interface

  • Bilingual Chinese / English (toggle with one tap, persisted)
  • Dark / Light mode (auto-follows system setting)
  • Personified move animations — each piece type has unique motion characteristics
  • Personified sound effects — each piece type has matching timbre
  • Control heatmap — per-square control visualization with SVG arrows
  • Eval trend chart — SVG line chart with pixel-perfect progress-bar alignment
  • Review mode — full game replay with per-step eval, visual annotations, and critical-move markers

📝 PGN Support

  • Full PGN import/export (1994 spec compliant)
  • [%eval] / [%csl] / [%cal] / [%emt] / [%clk] annotation support
  • Every-5-moves eval descriptions (bilingual, White-perspective)
  • Initial-position eval annotation (separate {} before first move)
  • Export dialog: user chooses whether to include special annotations
  • PGN cache manager (📚) — save/load games to app-private storage
  • Variations (RAV) import/export with 🌿Line display

🎯 Chess960

  • Full Fischer Random Chess support
  • SP-ID generation, Shredder-FEN notation
  • Chess960 castling rules (including edge cases)
  • ECO opening book disabled in Chess960 mode

📊 Statistics Page

  • Full-screen stats with board, PGN text, and computed metrics
  • Navigation buttons (⏮ ◀ ▶ ⏭) with mainline/variation context awareness
  • Material balance, move quality (brilliant/good/blunder), eval trend
  • Time management analysis (from [%emt] / [%clk])
  • Visual annotation statistics
  • HTML export (full-PGN interactive / FEN-only static)

🔒 Privacy & Security

  • Fully offline — no network, no account, no tracking
  • No analytics, no crash reporting to remote servers
  • Local crash protection with recovery UI
  • Root detection (informational only)
  • TLS 1.2+ enforcement for tablebase API (if ever used)
  • usesCleartextTraffic="false", allowBackup="false"

Downloads

File Description Size
Regalia-v1.1.1-release.apk Release APK (v1+v2+v3 signed, arm64-v8a) ~75 MB
Regalia-v1.1.1-manual-zh.html Chinese user manual ~820 KB
Regalia-v1.1.1-manual-en.html English user manual ~920 KB

APK Signature

✅ v1 scheme (JAR signing): true
✅ v2 scheme (APK Signature Scheme v2): true
✅ v3 scheme (APK Signature Scheme v3): true

Build from Source

Prerequisites

Component Version
JDK 21 (Temurin 21.0.5+11)
Android SDK build-tools 34.0.0, platforms android-35
NDK 27.2.12479018
CMake 3.22.1
Stockfish 18 arm64-v8a-dotprod binary (not included in source tarball)

Steps

# 1. Extract source
tar -xzf Regalia-v1.1.1-src.tar.gz
cd Regalia-v1.1.1-src

# 2. Place Stockfish engine
mkdir -p src/main/jniLibs/arm64-v8a
cp <path-to-stockfish-android-armv8-dotprod> src/main/jniLibs/arm64-v8a/libstockfish.so
chmod +x src/main/jniLibs/arm64-v8a/libstockfish.so

# 3. Configure SDK
echo "sdk.dir=<path-to-android-sdk>" > local.properties

# 4. Generate debug keystore (for signing)
keytool -genkeypair -v -keystore ../debug.keystore \
  -storepass android -alias debug -keypass android \
  -keyalg RSA -keysize 2048 -validity 36500 \
  -dname "CN=Regalia, OU=Dev, O=Regalia, L=Beijing, ST=Beijing, C=CN"

# 5. Build chess.html (merge JS modules)
python3 build-chess.py

# 6. Build APK
./gradlew clean assembleRelease --no-daemon --console=plain

# 7. Verify signing
<android-sdk>/build-tools/34.0.0/apksigner verify --verbose \
  /tmp/regalia_build/Regalia/outputs/apk/release/Regalia-release.apk

See BUILDING.md for full details.


License

Regalia is a combined work under dual licensing:

Component License
Original application code (UI, WebView, services, build scripts) AGPL v3
DroidFish-derived code (engine management, game logic, PGN parsing) GPL v3
Stockfish 18 engine binary GPL v3
ECO opening data CC0 (data) / AGPL v3 (code)

Per GPL v3 Section 13, these licenses are compatible for combination. Since AGPL v3 imposes stricter network-interaction provisions, its obligations effectively extend to the entire combined work.

Source code: https://github.com/YDW99/Regalia


Credits

Third-Party Components

Project Use License
Stockfish Chess engine (Stockfish 18, arm64-v8a-dotprod) GPL v3
DroidFish Engine management, game logic, PGN parsing, UI patterns GPL v3
lichess-org/chess-openings ECO opening classification data CC0
Lichess Tablebase API Endgame tablebase queries (optional, requires network) Public API

AI-GEN Declaration

All source files, documentation, and manuals in this project are marked with:

AI-GEN: AI assisted — This code/document was AI-assisted and has been reviewed for GPL v3 / AGPL v3 compliance.


Previous Releases

Version versionCode Highlights
v1.1.0 110 Green-arrow redefinition, Chess960 castling fix, review scroll fixes, every-5-moves PGN eval annotation, stopLatch TOCTOU race fix, heartbeat deadlock fix
v1.0.9 109 PGN single-line parse fix, "extra kings" board corruption fix, eval chart blue-red palette unification
v1.0.8 108 Personified move animations & sound effects, light mode support, Stockfish 18 dotprod integration, 30 development phases
v1.0.7 107 Code-quality maintenance, quick toolbar, setup-mode manual markers, LRU eval cache, virtual list
v1.0.6 106 Chess960 ECO suppression, PGN FEN round-trip, per-move stats selection
v1.0.5 105 Sensor-fusion board anti-shake, notch/cutout adaptation, phase analysis
v1.0.4 104 Chess960 mode, Time Control, PGN import/export, control heatmap, visual annotations, Web Worker pool, PGN cache manager, player rename, bilingual UI, resign

Regalia v1.1.1 — Built with care for chess enthusiasts who value privacy, offline capability, and open source.

AI-GEN: AI assisted — This release note was AI-assisted and has been reviewed for AGPL v3 compliance.


AI-GEN