diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 0000000..a166a8d --- /dev/null +++ b/.gitattributes @@ -0,0 +1,5 @@ +# Text files are checked out with LF on Windows too: the tests compare what +# the app writes, byte for byte, with texts written in the code. +* text=auto eol=lf +# The add-on lists keep the CRLF line ends they were published with. +addons/*.csv -text diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 3118f03..09926f9 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -17,3 +17,20 @@ jobs: - run: cargo fmt --check - run: cargo clippy --workspace --all-targets -- -D warnings - run: cargo test --workspace + + # The backend and `cr` on Windows, ahead of the Windows app; the GTK + # crates are left out. + windows: + runs-on: windows-2025 + steps: + - uses: actions/checkout@v4 + - uses: dtolnay/rust-toolchain@stable + with: + components: clippy + - run: cargo clippy -p cr-formats -p cr-store -p cr-i18n -p cr-cli --all-targets -- -D warnings + - run: cargo test --no-fail-fast -p cr-formats -p cr-store -p cr-i18n -p cr-cli + - run: cargo build --release -p cr-cli + - uses: actions/upload-artifact@v4 + with: + name: cr-windows-x64 + path: target/release/cr.exe diff --git a/Cargo.lock b/Cargo.lock index 58a6f66..f1d293f 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -136,6 +136,7 @@ dependencies = [ "cr-i18n", "image", "thiserror", + "windows-sys 0.61.2", ] [[package]] @@ -363,7 +364,7 @@ dependencies = [ "gobject-sys", "libc", "system-deps", - "windows-sys", + "windows-sys 0.59.0", ] [[package]] @@ -967,6 +968,12 @@ version = "0.1.12" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a28ac98ddc8b9274cb41bb4d9d4d5c425b6020c50c46f25559911905610b4a88" +[[package]] +name = "windows-link" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f0805222e57f7521d6a62e36fa9163bc891acd422f971defe97d64e70d0a4fe5" + [[package]] name = "windows-sys" version = "0.59.0" @@ -976,6 +983,15 @@ dependencies = [ "windows-targets", ] +[[package]] +name = "windows-sys" +version = "0.61.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ae137229bcbd6cdf0f7b80a31df61766145077ddf49416a728b02cb3921ff3fc" +dependencies = [ + "windows-link", +] + [[package]] name = "windows-targets" version = "0.52.6" diff --git a/README.md b/README.md index 2e59ae1..cd96f85 100644 --- a/README.md +++ b/README.md @@ -59,8 +59,10 @@ preserved by the Internet Archive: 2. **1.0 (now).** The release candidate was confirmed stable on Fedora 45 beta, Ubuntu 26.10, Bazzite, Arch Linux and CachyOS, and became 1.0.0: a faithful replacement for the original program. -3. **Windows and macOS.** Then come Windows and macOS builds, on the same - backend. +3. **Windows 11 (in progress).** A Windows 11 version in this repository, + with a native WinUI 3 interface written in Rust over the same backend, + distributed through the Microsoft Store. From then on every feature + ships on Linux and Windows together. 4. **New features.** From then on the app improves on the original and moves away from it, step by step, until it no longer needs the original program's files to work. @@ -343,9 +345,9 @@ when and why each was decided. ### Platform and setup -- **Linux only, no Wine.** The app is a native GTK 4 program. Windows and - macOS versions come after 1.0; the backend - crates have no GTK dependency so they can be built then. +- **Linux only, no Wine.** The app is a native GTK 4 program. A Windows 11 + version is being made over the same backend, which is already built + and tested on Windows. - **No installation of the original needed.** Extract Data from CD… copies what the app uses from the CD, its ISO image (read directly, with no mounting) or an existing installation into a local data folder. The @@ -620,8 +622,8 @@ CORERULES_DIR="$HOME/.wine/drive_c/Program Files/AD&D Core Rules 2.0" cargo test | `cr-gtk` | The GNOME app | | `cr-addons` | Core Rules Community Add-ons Collection, the add-ons and their installer | -The backend crates have no GTK dependency so macOS and Windows front ends -can reuse them later. +The backend crates have no GTK dependency, and CI builds and tests them +on Windows too, for the Windows 11 app that comes next. ### Languages diff --git a/crates/cr-cli/src/main.rs b/crates/cr-cli/src/main.rs index f123792..97e27fb 100644 --- a/crates/cr-cli/src/main.rs +++ b/crates/cr-cli/src/main.rs @@ -53,7 +53,38 @@ const COMMANDS: [&str; 17] = [ "delete", ]; -const USAGE: &str = "usage: +/// The data package folder as the usage text names it +/// ([`cr_store::DATA_PACKAGE_SHOWN`], which `concat!` cannot take). +#[cfg(not(windows))] +macro_rules! data_dir { + () => { + "~/.local/share/corerules/data" + }; +} +#[cfg(windows)] +macro_rules! data_dir { + () => { + r"Documents\Core Rules\data" + }; +} + +/// Where an installation is looked for after the data package: a Wine +/// prefix, except on Windows. +#[cfg(not(windows))] +macro_rules! wine_fallback { + () => { + ", else the installation in the Wine prefix" + }; +} +#[cfg(windows)] +macro_rules! wine_fallback { + () => { + "" + }; +} + +const USAGE: &str = concat!( + "usage: cr extract-data SOURCE [DEST_DIR] copy what the app uses out of a Core Rules 2.0 or Expansion CD into a data package, as Extract @@ -61,7 +92,9 @@ const USAGE: &str = "usage: image, the mounted CD, an installation (the folder holding Database/) or a Wine prefix; DEST_DIR, which must not exist, defaults to - ~/.local/share/corerules/data while that is + ", + data_dir!(), + " while that is free, else a corerules-data-EDITION folder next to it (the Expansion takes the data folder over from 2.0 data, which moves there) @@ -201,12 +234,19 @@ Core Rules 2.0 installations are read-only: new content (characters, NPCs, treasure, encounters, records and packages) follows the Expansion, and 2.0 content is brought over with cr import. -Without INSTALL_DIR, the data package in ~/.local/share/corerules/data -is used, else the installation in the Wine prefix. +Without INSTALL_DIR, the data package in ", + data_dir!(), + " +is used", + wine_fallback!(), + ". An Expansion INSTALL_DIR that cannot be written to (a mounted CD or ISO -image) is copied into ~/.local/share/corerules/data once, as -cr extract-data does, and whatever a command saves goes into that copy."; +image) is copied into ", + data_dir!(), + " once, as +cr extract-data does, and whatever a command saves goes into that copy." +); /// Writes to standard output. A closed pipe exits with success, as a /// program killed by SIGPIPE would quietly stop; any other write error @@ -254,7 +294,7 @@ fn main() -> ExitCode { // folder: the data package or the Wine installation is used. // A path that is not there is an error, not a reason to use the // default data. - if let Some(dir) = args.get(1).filter(|d| d.contains('/')) + if let Some(dir) = args.get(1).filter(|d| d.contains(std::path::is_separator)) && !std::path::Path::new(dir).exists() { eprintln!("cr: {dir}: no such folder"); @@ -264,7 +304,14 @@ fn main() -> ExitCode { Some(dir) => (Installation::open(dir), &args[2..]), None => ( Installation::discover().ok_or_else(|| { - cr_store::Error::NotAnInstallation(cr_store::DEFAULT_WINE_PATH.into()) + // Windows has no Wine prefix: the data package is the only + // place looked in. + let looked = if cfg!(windows) { + cr_store::data_package_dir().unwrap_or_default() + } else { + cr_store::DEFAULT_WINE_PATH.into() + }; + cr_store::Error::NotAnInstallation(looked) }), &args[1..], ), diff --git a/crates/cr-store/Cargo.toml b/crates/cr-store/Cargo.toml index 9dde6e8..1fef0a3 100644 --- a/crates/cr-store/Cargo.toml +++ b/crates/cr-store/Cargo.toml @@ -13,3 +13,6 @@ cr-i18n.workspace = true thiserror.workspace = true color_quant.workspace = true image.workspace = true + +[target.'cfg(windows)'.dependencies] +windows-sys = { version = "0.61", features = ["Win32_Foundation", "Win32_System_Com", "Win32_UI_Shell"] } diff --git a/crates/cr-store/src/extract.rs b/crates/cr-store/src/extract.rs index c942624..884315c 100644 --- a/crates/cr-store/src/extract.rs +++ b/crates/cr-store/src/extract.rs @@ -394,8 +394,9 @@ impl Extraction { It holds TSR/Wizards of the Coast content from your own copy of AD&D Core\n\ Rules 2.0. Keep it for your own use; do not redistribute it.\n\ \n\ - The app finds it in ~/.local/share/corerules/data (or open this folder with\n\ + The app finds it in {shown} (or open this folder with\n\ \"Open Folder…\"). Characters and user databases you edit are saved here.\n", + shown = crate::DATA_PACKAGE_SHOWN, edition = self.edition.id(), root = self.root_display(), year = date.year, @@ -450,7 +451,8 @@ mod tests { fn walk(dir: &Path, base: &Path, found: &mut Vec) { for e in fs::read_dir(dir).unwrap() { let p = e.unwrap().path(); - let rel = p.strip_prefix(base).unwrap().to_string_lossy().into_owned(); + let rel = p.strip_prefix(base).unwrap().to_string_lossy(); + let rel = rel.replace('\\', "/"); if p.is_dir() { found.push(format!("{rel}/")); walk(&p, base, found); diff --git a/crates/cr-store/src/lib.rs b/crates/cr-store/src/lib.rs index 70268e4..ef81614 100644 --- a/crates/cr-store/src/lib.rs +++ b/crates/cr-store/src/lib.rs @@ -67,7 +67,9 @@ fn not_an_installation(path: &Path) -> String { pub type Result = std::result::Result; -/// Where Extract Data from CD… (`cr extract-data`) puts the data package. +/// Where Extract Data from CD… (`cr extract-data`) puts the data package: +/// `$XDG_DATA_HOME/corerules/data`, else `~/.local/share/corerules/data`. +#[cfg(not(windows))] pub fn data_package_dir() -> Option { let data = std::env::var_os("XDG_DATA_HOME") .filter(|d| !d.is_empty()) @@ -76,6 +78,54 @@ pub fn data_package_dir() -> Option { Some(data.join("corerules").join("data")) } +/// Where Extract Data from CD… (`cr extract-data`) puts the data package: +/// `Core Rules\data` in the user's Documents folder. A packaged (MSIX) app +/// writes there directly, so the characters stay when the app is +/// uninstalled, where AppData would be removed with it. +#[cfg(windows)] +pub fn data_package_dir() -> Option { + Some(documents_dir()?.join("Core Rules").join("data")) +} + +/// The Documents folder as Windows knows it, which may have been moved +/// (into OneDrive, say) and whose name may be translated. +#[cfg(windows)] +fn documents_dir() -> Option { + use std::os::windows::ffi::OsStringExt; + use windows_sys::Win32::System::Com::CoTaskMemFree; + use windows_sys::Win32::UI::Shell::{ + FOLDERID_Documents, KF_FLAG_DEFAULT, SHGetKnownFolderPath, + }; + + let mut path = std::ptr::null_mut(); + // SAFETY: on success `path` is a NUL-terminated UTF-16 string; it is + // freed with CoTaskMemFree whether the call succeeds or not, as the + // documentation of SHGetKnownFolderPath asks. + unsafe { + let result = SHGetKnownFolderPath( + &FOLDERID_Documents, + KF_FLAG_DEFAULT as _, + std::ptr::null_mut(), + &mut path, + ); + let dir = (result == 0 && !path.is_null()).then(|| { + let len = (0..).take_while(|&i| *path.add(i) != 0).count(); + PathBuf::from(std::ffi::OsString::from_wide(std::slice::from_raw_parts( + path, len, + ))) + }); + CoTaskMemFree(path as _); + dir + } +} + +/// [`data_package_dir`] the way texts for the user name it. +#[cfg(not(windows))] +pub const DATA_PACKAGE_SHOWN: &str = "~/.local/share/corerules/data"; +/// [`data_package_dir`] the way texts for the user name it. +#[cfg(windows)] +pub const DATA_PACKAGE_SHOWN: &str = r"Documents\Core Rules\data"; + /// Folder where the installer puts Core Rules inside a Wine prefix. pub const DEFAULT_WINE_PATH: &str = "drive_c/Program Files/AD&D Core Rules 2.0"; @@ -93,15 +143,18 @@ impl Installation { } /// Looks for the data package made by Extract Data from CD… in the app's - /// data folder (`$XDG_DATA_HOME/corerules/data`, else - /// `~/.local/share/corerules/data`), then for an installation in the - /// usual Wine prefix (`$WINEPREFIX`, else `~/.wine`). + /// data folder ([`data_package_dir`]), then, except on Windows, for an + /// installation in the usual Wine prefix (`$WINEPREFIX`, else + /// `~/.wine`). pub fn discover() -> Option { if let Some(dir) = data_package_dir() && let Ok(install) = Self::open(dir) { return Some(install); } + if cfg!(windows) { + return None; + } let prefix = std::env::var_os("WINEPREFIX") .map(PathBuf::from) .or_else(|| std::env::var_os("HOME").map(|h| Path::new(&h).join(".wine")))?; @@ -196,9 +249,14 @@ fn can_write_in(dir: &Path) -> bool { } fn find_entry(dir: &Path, name: &str) -> Option { - let exact = dir.join(name); - if exact.exists() { - return Some(exact); + // On Windows every spelling exists, and the shortcut would give back + // the one asked for; the folder is read for the name as it is on disk, + // the one the original and Linux see. + if !cfg!(windows) { + let exact = dir.join(name); + if exact.exists() { + return Some(exact); + } } fs::read_dir(dir) .ok()? diff --git a/crates/cr-store/src/tables/tests.rs b/crates/cr-store/src/tables/tests.rs index 96c6806..0e56f09 100644 --- a/crates/cr-store/src/tables/tests.rs +++ b/crates/cr-store/src/tables/tests.rs @@ -806,7 +806,18 @@ impl CaptureInstall { .unwrap(); } } else { + #[cfg(unix)] std::os::unix::fs::symlink(entry.path(), root.join(&name)).unwrap(); + // Windows needs Developer Mode or an administrator, as on CI. + #[cfg(windows)] + { + let link = root.join(&name); + if entry.file_type().unwrap().is_dir() { + std::os::windows::fs::symlink_dir(entry.path(), link).unwrap(); + } else { + std::os::windows::fs::symlink_file(entry.path(), link).unwrap(); + } + } } } let install = Installation::open(&root).unwrap(); diff --git a/crates/cr-store/tests/common/mod.rs b/crates/cr-store/tests/common/mod.rs new file mode 100644 index 0000000..73af203 --- /dev/null +++ b/crates/cr-store/tests/common/mod.rs @@ -0,0 +1,23 @@ +//! What the integration tests share. + +use std::io; +use std::path::Path; + +/// Makes `link` a symbolic link to the file or folder `original`, so a +/// scratch installation uses the original's data without copying it. +#[cfg(unix)] +pub fn symlink(original: impl AsRef, link: impl AsRef) -> io::Result<()> { + std::os::unix::fs::symlink(original, link) +} + +/// Makes `link` a symbolic link to the file or folder `original`, so a +/// scratch installation uses the original's data without copying it. +/// Windows needs Developer Mode or an administrator for it, as on CI. +#[cfg(windows)] +pub fn symlink(original: impl AsRef, link: impl AsRef) -> io::Result<()> { + if original.as_ref().is_dir() { + std::os::windows::fs::symlink_dir(original, link) + } else { + std::os::windows::fs::symlink_file(original, link) + } +} diff --git a/crates/cr-store/tests/export.rs b/crates/cr-store/tests/export.rs index 4fe3e13..8946469 100644 --- a/crates/cr-store/tests/export.rs +++ b/crates/cr-store/tests/export.rs @@ -10,6 +10,8 @@ //! temporary copy of `before` next to a link to the installation's //! `Database`. Without the variables they pass without checking. +mod common; + use std::fs; use std::path::{Path, PathBuf}; @@ -52,7 +54,7 @@ fn scratch(test: &str) -> Option { let root = std::env::temp_dir().join(format!("cr-export-{test}-{}", std::process::id())); let _ = fs::remove_dir_all(&root); fs::create_dir_all(&root).unwrap(); - std::os::unix::fs::symlink(original.path("Database")?, root.join("Database")).unwrap(); + common::symlink(original.path("Database")?, root.join("Database")).unwrap(); for folder in ["UserDbas", "Chars"] { copy_dir( &golden.join("import/before").join(folder), diff --git a/crates/cr-store/tests/help.rs b/crates/cr-store/tests/help.rs index 31aaf12..b9069b2 100644 --- a/crates/cr-store/tests/help.rs +++ b/crates/cr-store/tests/help.rs @@ -2,6 +2,8 @@ //! installation): every one reads, and every topic its contents file //! lists is found. +mod common; + use std::path::Path; use cr_formats::winhelp::{Item, Link, Macro}; @@ -255,7 +257,7 @@ fn user_copy(test: &str) -> Option<(std::path::PathBuf, Installation)> { std::fs::create_dir_all(root.join("UserDbas")).unwrap(); for name in ["Database", "Help", "Bitmaps"] { if let Some(path) = original.path(name) { - std::os::unix::fs::symlink(path, root.join(name)).unwrap(); + common::symlink(path, root.join(name)).unwrap(); } } for entry in std::fs::read_dir(original.path("UserDbas").unwrap()).unwrap() { diff --git a/crates/cr-store/tests/new_character.rs b/crates/cr-store/tests/new_character.rs index 86651a4..8df3e63 100644 --- a/crates/cr-store/tests/new_character.rs +++ b/crates/cr-store/tests/new_character.rs @@ -2,6 +2,8 @@ //! powers, with `CORERULES_DIR` (an Expansion installation) on a scratch //! copy of its `UserDbas` and `Chars`. +mod common; + use std::fs; use std::path::PathBuf; @@ -29,7 +31,7 @@ fn scratch(test: &str) -> Option { let root = std::env::temp_dir().join(format!("cr-user-races-{test}-{}", std::process::id())); let _ = fs::remove_dir_all(&root); fs::create_dir_all(root.join("UserDbas")).unwrap(); - std::os::unix::fs::symlink(original.path("Database")?, root.join("Database")).unwrap(); + common::symlink(original.path("Database")?, root.join("Database")).unwrap(); for entry in fs::read_dir(original.path("UserDbas")?).unwrap() { let entry = entry.unwrap(); if entry.file_type().unwrap().is_file() { diff --git a/crates/cr-store/tests/npc.rs b/crates/cr-store/tests/npc.rs index 8f77ddd..6970e5e 100644 --- a/crates/cr-store/tests/npc.rs +++ b/crates/cr-store/tests/npc.rs @@ -9,6 +9,8 @@ //! (when present); a Core Rules 2.0 installation makes no NPCs. Without //! them (or with another golden folder) the tests pass without checking. +mod common; + use std::fs; use std::path::{Path, PathBuf}; @@ -702,7 +704,7 @@ fn with_parts(install: &Installation, parts: &Path, test: &str) -> WithParts { for entry in fs::read_dir(install.root()).unwrap() { let entry = entry.unwrap(); if entry.file_name() != "UserDbas" { - std::os::unix::fs::symlink(entry.path(), root.join(entry.file_name())).unwrap(); + common::symlink(entry.path(), root.join(entry.file_name())).unwrap(); } } let user = install.path("UserDbas").unwrap(); diff --git a/crates/cr-store/tests/party.rs b/crates/cr-store/tests/party.rs index 2410446..34b0354 100644 --- a/crates/cr-store/tests/party.rs +++ b/crates/cr-store/tests/party.rs @@ -8,6 +8,8 @@ //! copy of `*_before` next to links to the installation's `Database` and a //! copy of its `UserDbas`. Without the variables they pass without checking. +mod common; + use std::fs; use std::path::{Path, PathBuf}; @@ -49,7 +51,7 @@ fn scratch(test: &str) -> Option { let root = std::env::temp_dir().join(format!("cr-party-{test}-{}", std::process::id())); let _ = fs::remove_dir_all(&root); fs::create_dir_all(&root).unwrap(); - std::os::unix::fs::symlink(original.path("Database")?, root.join("Database")).unwrap(); + common::symlink(original.path("Database")?, root.join("Database")).unwrap(); copy_dir(&original.path("UserDbas")?, &root.join("UserDbas")); copy_dir( &golden.join(format!("{prefix}_before")), @@ -218,8 +220,8 @@ fn chars_copy(test: &str) -> Option<(PathBuf, Installation)> { let root = std::env::temp_dir().join(format!("cr-index-{test}-{}", std::process::id())); let _ = fs::remove_dir_all(&root); fs::create_dir_all(&root).unwrap(); - std::os::unix::fs::symlink(original.path("Database")?, root.join("Database")).unwrap(); - std::os::unix::fs::symlink(original.path("UserDbas")?, root.join("UserDbas")).unwrap(); + common::symlink(original.path("Database")?, root.join("Database")).unwrap(); + common::symlink(original.path("UserDbas")?, root.join("UserDbas")).unwrap(); copy_dir(&original.path("Chars")?, &root.join("Chars")); let install = Installation::open(&root).unwrap(); Some((root, install)) diff --git a/crates/cr-store/tests/sheet_options.rs b/crates/cr-store/tests/sheet_options.rs index 189f30f..a44a193 100644 --- a/crates/cr-store/tests/sheet_options.rs +++ b/crates/cr-store/tests/sheet_options.rs @@ -5,6 +5,8 @@ //! character's options are saved there and read back. Without it, or on //! Core Rules 2.0, the tests pass without checking. +mod common; + use std::fs; use std::path::{Path, PathBuf}; @@ -39,7 +41,7 @@ fn scratch(test: &str) -> Option { let root = std::env::temp_dir().join(format!("cr-sheet-options-{test}-{}", std::process::id())); let _ = fs::remove_dir_all(&root); fs::create_dir_all(&root).unwrap(); - std::os::unix::fs::symlink(original.path("Database")?, root.join("Database")).unwrap(); + common::symlink(original.path("Database")?, root.join("Database")).unwrap(); if let Some(user) = original.path("UserDbas") { copy_dir(&user, &root.join("UserDbas")); } diff --git a/crates/cr-store/tests/userdb.rs b/crates/cr-store/tests/userdb.rs index c431e47..62bd5db 100644 --- a/crates/cr-store/tests/userdb.rs +++ b/crates/cr-store/tests/userdb.rs @@ -10,6 +10,8 @@ //! `AllowedU.dat`, 2.0's (`ev/`) otherwise. Without the variables the //! tests pass without checking. +mod common; + use std::fs; use std::path::PathBuf; @@ -52,7 +54,7 @@ fn scratch(test: &str) -> Option { let root = std::env::temp_dir().join(format!("cr-userdb-golden-{test}-{}", std::process::id())); let _ = fs::remove_dir_all(&root); fs::create_dir_all(root.join("UserDbas")).unwrap(); - std::os::unix::fs::symlink(&database, root.join("Database")).unwrap(); + common::symlink(&database, root.join("Database")).unwrap(); for entry in fs::read_dir(&user).unwrap() { let entry = entry.unwrap(); if entry.file_type().unwrap().is_file() { diff --git a/docs/decisions.md b/docs/decisions.md index 7c98a4e..c5c8f12 100644 --- a/docs/decisions.md +++ b/docs/decisions.md @@ -28,6 +28,7 @@ log is complete. | S10 | 2026-10-19 | Where the original finds a help topic by a fixed name (psionic disciplines, fighting styles, weapon groups, three monsters), the app does the same, with those names in its code. | Names used as fair use, decided by Wagner Brahm. | PR #30 | | S11 | 2026-10-20 | Parity rule: only what was explicitly taken out of scope stays out; everything else the original does must be replicated, or given an equivalent. | Decided by Wagner Brahm while the kit rules were being done. | Phase 1 (PRs #32 to #74) | | S12 | 2026-10-24 | After 1.0 the app improves on the original and moves away from it step by step, until it no longer needs the original's files to work. | Decided by Wagner Brahm with the release candidate. | [Roadmap](roadmap.md) | +| S13 | 2026-10-25 | One repository for every version: the Windows version lives in `brahm/corerules` next to the Linux one, and from then on a feature ships only when it works in every maintained version, Windows 11 included. Rules and data stay in the backend; logic shared by the interfaces moves into a crate of its own, and CI checks that both interfaces have the same actions. | Decided by Wagner Brahm when the Windows port was planned. | [Roadmap](roadmap.md#step-2-windows-11-in-progress) | ## Left out on purpose @@ -110,3 +111,7 @@ Reported during testing and kept, because the original does the same: | P14 | 2026-10-24 | The add-ons AppImage is also published as the file itself on GitHub Packages, in its Maven registry (`io.github.brahm:corerules-community-addons`), since GitHub Packages has no registry for plain files; the OCI artifact on ghcr.io and the addons release stay, the release being the direct download link. | Decided by Wagner Brahm, 1.0.0 | | P15 | 2026-10-24 | Publishing on Flathub is dropped from the plan, after a review of Flathub's current requirements. The Flatpak is still built, tested and attached to every release. Windows and macOS come right after 1.0, and the backend stays free of GTK until then. | Decided by Wagner Brahm, [Roadmap](roadmap.md) | | P16 | 2026-10-25 | The Flatpak is also distributed from the project's own signed Flatpak repository, published with the landing page on GitHub Pages (`https://brahm.github.io/corerules/flatpak/`), instead of Flathub. It holds the latest final release and is rebuilt from that release's `.flatpak` after every final release; the `.flatpak` files name the repository, so they update from it too. The signing key is the `FLATPAK_GPG_PRIVATE_KEY` secret. | Decided by Wagner Brahm, [README](../README.md#the-flatpak-repository) | +| P17 | 2026-10-25 | The Windows 11 version has a native WinUI 3 interface following Microsoft's design guidelines, written in Rust with windows-reactor (the WinUI 3 library of the windows-rs project) over the same backend, in a new crate `cr-win`; there is no fallback to another language. This answers the GTK-or-native question of the first plan. | Decided by Wagner Brahm, [Roadmap](roadmap.md#step-2-windows-11-in-progress) | +| P18 | 2026-10-25 | Windows builds are distributed as an MSIX package through the Microsoft Store, with a free individual developer account: the Store signs the package, so Windows does not warn. A self-signed or unsigned package is not used. The product Core Rules was reserved on 2026-10-25. | Decided by Wagner Brahm, [Roadmap](roadmap.md#step-2-windows-11-in-progress) | +| P19 | 2026-10-25 | On Windows the data package lives in `Core Rules\data` in the user's Documents folder (as Windows reports it, OneDrive included), not in AppData, which a packaged app loses when it is uninstalled. | Decided by Wagner Brahm | +| P20 | 2026-10-25 | The Community Add-ons Collection comes to Windows after the first Windows release, as a package the Windows app imports instead of an installer of its own. | Decided by Wagner Brahm | diff --git a/docs/roadmap.md b/docs/roadmap.md index 13f250f..c5b536d 100644 --- a/docs/roadmap.md +++ b/docs/roadmap.md @@ -22,8 +22,9 @@ Community Add-ons Collection as its own AppImage, version 1.0.0. The the project's own Flatpak repository, which gets each final release (decision P16). -The next step is Windows and macOS (step 2). Publishing on Flathub was -dropped from the plan (decision P15). No issue is open on GitHub. +The Windows 11 version (step 2) has started: its first phase, the +backend and `cr` built and tested on Windows, is done. Publishing on +Flathub was dropped from the plan (decision P15). ## The original plan (2026-10-09) @@ -38,9 +39,9 @@ taken out of scope. | 3. Minimal GTK app | Library, sheet, creation wizard, rules browser, printing and PDF | Done. The dice roller was dropped (S6) | | 4. Generators | Encounters, treasure, NPCs, monsters, custom tables | Done | | 5. Maps and Expansion | Map Maker II and Campaign Mapper, Expansion classes, Flathub, pt-BR | Expansion classes and translations (six languages) done; maps dropped (S6); Flathub dropped (P15) | -| 6. macOS and Windows | Other platforms over the same backend | Moved after 1.0 (P15) | +| 6. macOS and Windows | Other platforms over the same backend | Moved after 1.0 (P15); Windows 11 is step 2 after 1.0 | -## The revised plan (2026-10-17 to 2026-10-24) +## The revised plan (2026-10-17 to 2026-10-25) | Phase | Content | Status | | --- | --- | --- | @@ -100,34 +101,93 @@ Done on 2026-10-24: Wagner Brahm's friends ran 1.0.0-rc2 on Fedora 45 beta, Ubuntu 26.10, Bazzite, Arch Linux and CachyOS, found nothing wrong, and Wagner Brahm gave the go-ahead (decision P13). -### Step 2: Windows and macOS - -The original plan kept `cr-formats` and `cr-store` free of GTK for this, and -they still are. - -1. **Backend on every platform.** Add Windows and macOS runners to CI for - the backend crates and `cr` (`cargo test` and `cargo build`). This finds - path, file system and line ending problems before any interface work. -2. **Choose the interface.** At the start of this step, as the first plan - said: ship the existing GTK 4 and libadwaita app on both platforms, or - write native interfaces over the backend through a C API (`cr-ffi`). - GTK 4 reuses the whole app and its translations and is the faster path; - native interfaces fit each platform better and cost a new front end per - platform. -3. **Platform details.** The data folder (`%APPDATA%`, `~/Library/Application - Support`), Extract Data from CD… with drive letters and `/Volumes`, - opening an installation of the original (which on Windows may run on the - same machine, with its files under `Program Files` and possibly in the - UAC VirtualStore), printing and PDF, the help window, the interface - language from the system settings. -4. **Packages.** An installer for Windows (MSI or MSIX) and a `.dmg` with an - app bundle for macOS, built and started by the release workflow as the - Linux packages are. -5. **Signing.** Without code signing, Windows SmartScreen and macOS - Gatekeeper warn or block the app. Signing needs a certificate for - Windows and an Apple Developer account for notarization, both paid. - -Needs Wagner Brahm: the choice of interface, and whether to pay for signing. +### Step 2: Windows 11 (in progress) + +Decided by Wagner Brahm on 2026-10-25 (decisions S13 and P17 to P20): the +Windows version lives in this repository, next to the Linux one, and from +then on every feature ships in every maintained version, Windows 11 +included. Its interface is a native WinUI 3 interface that follows +Microsoft's design guidelines, written in Rust with windows-reactor, the +WinUI 3 library of the windows-rs project, over the same backend. It is +distributed as an MSIX package through the Microsoft Store, which signs it. +macOS is not part of this step. + +How the two versions stay the same: + +- Rules and data live only in `cr-store`; an interface shows them and calls + it. +- Logic that is in `cr-gtk` today moves into a new shared crate, `cr-app` + (screen state, checks, warnings, actions; no GTK and no Windows), before + its screen is ported. The character sheet's PDF is made there in pure + Rust, so both systems write the same file. +- Every action has one name, like the `sheet.pdf` that `cr-gtk` already + uses; a test fails when an action exists in one interface and not in the + other. +- Both interfaces take their texts from `cr-i18n`, whose test already fails + on a missing translation. +- CI runs on Ubuntu and on Windows for every pull request, and one `v*` tag + makes the Linux packages and the MSIX in the same release workflow. + +The phases run in order: + +1. **Backend on Windows (done).** A Windows job in CI lints and tests + `cr-formats`, `cr-store`, `cr-i18n` and `cr`, and builds `cr.exe`. The + tests link the original's data the same way on both systems, text files + are checked out with LF on Windows too, and the data package lives in + `Core Rules\data` in the user's Documents folder, which a packaged app + writes to directly, so uninstalling the app keeps the characters. +2. **Prototype of `cr-win`.** In Portuguese and packaged as an MSIX: the + character list with search, a page of the New Character assistant, an + editing form, a confirmation dialog, opening an `.xpx` file and printing + the sheet. Whatever blocks it is solved in `cr-win` or taken to + windows-rs before the rest is ported. +3. **Parity groundwork.** `cr-app`, the shared PDF and the test of action + names. +4. **Porting the screens.** The library and the sheet, character creation, + editing, the generators, the user database editors, packages, Extract + Data from CD…, help, Settings and About. +5. **Package and Store.** The release workflow builds and tests the MSIX; + a beta goes to a closed group through the Microsoft Store. +6. **Release with Windows**, once the beta's users confirm it, with the + same version and tag as Linux. The Community Add-ons Collection follows + as a package the Windows app imports. + +The interface follows Windows 11's patterns rather than GNOME's: settings +cards with combo boxes, number boxes and toggle switches for the forms, +ContentDialog for dialogs, a NavigationView for the sections, the title bar +with a CommandBar, InfoBar for notices, Settings (with About inside) at the +foot of the navigation, the system's light, dark and high-contrast themes +and the Mica backdrop. + +Platform details: + +- **Data folder:** `Documents\Core Rules\data` (decision P19), where + Linux has `~/.local/share/corerules/data`. +- **The original on the same machine:** its installation under + `Program Files (x86)` or `Program Files`, and what it saved into the UAC + VirtualStore (`%LOCALAPPDATA%\VirtualStore`) when Windows kept it from + writing there. +- **Extract Data from CD…:** the CD by its drive letter, an ISO image read + directly or mounted by File Explorer, or an installation. +- **Printing:** the Windows print dialog, drawing the same layout as + `cr-store::sheet` with Direct2D. +- **Help:** the app's own help window, since Windows 11 has no WinHelp + reader either. +- **Language:** the Windows display language or Preferences, with the same + catalogs. +- **`cr`:** `cr.exe` inside the same package, reached from a terminal + through an MSIX alias. + +Distribution: the Microsoft Store's individual developer account is free +since September 2025 and the Store signs the MSIX after certification, so +Windows SmartScreen and Smart App Control do not warn. A self-signed or +unsigned package is not used: Windows blocks it for anyone who has not +trusted its certificate by hand. The product Core Rules was reserved on +2026-10-25; the Store drops a reservation not used within three months, so +it may need to be reserved again before submission. + +Needs Wagner Brahm: approving the prototype (phase 2) and confirming the +beta (phase 5). ### Step 3: new features, and independence from the original @@ -157,7 +217,7 @@ independence goes (step 3.3). ## Decisions pending -- GTK 4 or native interfaces on Windows and macOS, and code signing +- Approving the Windows prototype and confirming the Windows beta (step 2). - The first features after 1.0, and the source of rules content without the discs (step 3). diff --git a/site/index.html b/site/index.html index fcfc626..389ba28 100644 --- a/site/index.html +++ b/site/index.html @@ -154,7 +154,7 @@

Everything the original did

The library

Races, classes, kits, items, spells, psionic powers and monsters, with their pictures and icons, and the Core Rules books in a reader with search.

Faithful files

Characters, monsters, encounters and packages made in either program open in the other. Results were compared with files the original wrote.

Six languages

English, Português (Brasil), Español, Italiano, Français and Deutsch.

-

Any Linux

.deb for Ubuntu, .rpm for Fedora, pacman for Arch, CachyOS and Omarchy, a Flatpak and an AppImage for Bazzite and every other distribution. Windows and macOS come next.

+

Any Linux

.deb for Ubuntu, .rpm for Fedora, pacman for Arch, CachyOS and Omarchy, a Flatpak and an AppImage for Bazzite and every other distribution. A Windows 11 version comes next.