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
37 changes: 33 additions & 4 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name: Release

# Pushing a tag such as v0.2.0 builds OpenRAGE for Linux (.tar.gz and
# AppImage) and Windows (.zip) and publishes a GitHub release with them and
# Pushing a tag such as v0.2.0 builds OpenRAGE for Linux (.tar.gz, AppImage
# and Flatpak) and Windows (.zip) and publishes a GitHub release with them and
# their SHA-256 checksums.
# "Run workflow" (manual) builds the same archives without publishing, to
# try a release first. Tests are not repeated here: CI runs them on every
Expand Down Expand Up @@ -77,7 +77,7 @@ jobs:
7z a -tzip "out/$dir.zip" "$dir" > /dev/null
else
cp target/release/openrage target/release/openrage-gui "$dir/"
cp packaging/openrage.desktop packaging/openrage.png "$dir/"
cp packaging/openrage.desktop packaging/openrage.png packaging/openrage-mime.xml "$dir/"
tar czf "out/$dir.tar.gz" "$dir"
fi
- name: AppImage
Expand Down Expand Up @@ -114,8 +114,37 @@ jobs:
path: out/*
if-no-files-found: error

publish:
# The Flatpak, from the Linux archive built above (nothing is compiled again).
flatpak:
needs: build
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v5
- uses: actions/download-artifact@v4
with:
name: linux-x86_64
path: linux
- name: Install Flatpak and the runtime
run: |
sudo apt-get update
sudo apt-get install -y flatpak
flatpak remote-add --user --if-not-exists flathub https://dl.flathub.org/repo/flathub.flatpakrepo
flatpak install --user -y --noninteractive flathub org.freedesktop.Platform//26.08
- name: Build the Flatpak
run: |
ref="${GITHUB_REF_NAME//\//-}"
version=$(grep -m1 '^version' Cargo.toml | cut -d'"' -f2)
mkdir -p unpacked out
tar xzf "linux/openrage-${ref}-linux-x86_64.tar.gz" -C unpacked
packaging/flatpak/build.sh "unpacked/openrage-${ref}-linux-x86_64" "$version" "out/openrage-${ref}-x86_64.flatpak"
- uses: actions/upload-artifact@v4
with:
name: flatpak
path: out/*.flatpak
if-no-files-found: error

publish:
needs: [build, flatpak]
if: startsWith(github.ref, 'refs/tags/')
runs-on: ubuntu-latest
steps:
Expand Down
24 changes: 12 additions & 12 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

18 changes: 9 additions & 9 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ resolver = "3"
members = ["crates/*"]

[workspace.package]
version = "0.4.0"
version = "0.5.0"
edition = "2024"
license = "GPL-3.0-only"
repository = "https://github.com/Two-Play/openrage"
Expand All @@ -13,14 +13,14 @@ authors = ["OpenRAGE contributors"]
rust-version = "1.99"

[workspace.dependencies]
rage-core = { path = "crates/rage-core", version = "0.4.0" }
rage-crypto = { path = "crates/rage-crypto", version = "0.4.0" }
rage-tfit2 = { path = "crates/rage-tfit2", version = "0.4.0" }
rage-rpf = { path = "crates/rage-rpf", version = "0.4.0", features = ["rdr2"] }
rage-index = { path = "crates/rage-index", version = "0.4.0" }
rage-mods = { path = "crates/rage-mods", version = "0.4.0" }
rage-resource = { path = "crates/rage-resource", version = "0.4.0" }
rage-formats = { path = "crates/rage-formats", version = "0.4.0" }
rage-core = { path = "crates/rage-core", version = "0.5.0" }
rage-crypto = { path = "crates/rage-crypto", version = "0.5.0" }
rage-tfit2 = { path = "crates/rage-tfit2", version = "0.5.0" }
rage-rpf = { path = "crates/rage-rpf", version = "0.5.0", features = ["rdr2"] }
rage-index = { path = "crates/rage-index", version = "0.5.0" }
rage-mods = { path = "crates/rage-mods", version = "0.5.0" }
rage-resource = { path = "crates/rage-resource", version = "0.5.0" }
rage-formats = { path = "crates/rage-formats", version = "0.5.0" }

aes = "0.8"
anyhow = "1"
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ edit game text and install `.oiv` packages — compatible with OpenIV's `mods` f

OpenIV's last release was in January 2022. OpenRAGE picks up where it left off and stays compatible with it.

- **Explorer and search:** archives, even nested ones, open like folders; names, hashes and full text of the whole game in milliseconds.
- **Explorer and search:** archives, even nested ones, open like folders, as a list or as icons; names, hashes and full text of the whole game in milliseconds.
- **Every major format:** textures, models, audio, animations, metadata as XML, collisions, paths, nav meshes, cutscenes, scripts, game text.
- **Coming from OpenIV?** Your `mods` folder and `.oiv` packages work as they are ([how to switch](https://two-play.github.io/openrage/getting-started/#coming-from-openiv)).
- **Mods, safely:** changes go to OpenIV's `mods` folder, never into your game files; every change and every `.oiv` package can be undone.
Expand Down Expand Up @@ -69,7 +69,7 @@ More screenshots and all features: **[two-play.github.io/openrage](https://two-p

## Installation

Download the [latest release](https://github.com/Two-Play/openrage/releases/latest) for Linux (AppImage or `.tar.gz`) or Windows (`.zip`) and start `openrage-gui`. On first start it finds your game and sets up the keys. Step by step: **[Getting started](https://two-play.github.io/openrage/getting-started/)**.
Download the [latest release](https://github.com/Two-Play/openrage/releases/latest) for Linux (AppImage, Flatpak or `.tar.gz`) or Windows (`.zip`) and start `openrage-gui`. On first start it finds your game and sets up the keys. Step by step: **[Getting started](https://two-play.github.io/openrage/getting-started/)**.

To build from source (Rust, pinned in `rust-toolchain.toml`; on Linux also the fontconfig, xkbcommon, Wayland and ALSA development packages):

Expand Down
12 changes: 12 additions & 0 deletions crates/openrage-app/src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,10 @@ pub struct Config {
pub accent: Option<String>,
/// Show the change history in its own window (default) instead of the file list.
pub history_window: Option<bool>,
/// GUI text size in percent (100 = normal).
pub text_size: Option<u32>,
/// GUI file list view: `list`, `icons` or `large-icons`.
pub file_view: Option<String>,
/// Enabled plugins with the permissions the user granted them:
/// `(id, "perm+perm")` (see `crate::plugins`).
pub plugins: Vec<(String, String)>,
Expand Down Expand Up @@ -60,6 +64,8 @@ impl Config {
"theme" => cfg.theme = Some(v.to_owned()),
"accent" => cfg.accent = Some(v.to_owned()),
"history_window" => cfg.history_window = Some(v == "true"),
"text_size" => cfg.text_size = v.parse().ok(),
"file_view" => cfg.file_view = Some(v.to_owned()),
"write_in_game" => cfg.write_in_game.push(PathBuf::from(v)),
"asi_hint_off" => cfg.asi_hint_off.push(PathBuf::from(v)),
"plugin" => {
Expand Down Expand Up @@ -102,6 +108,12 @@ impl Config {
if let Some(h) = self.history_window {
text.push_str(&format!("history_window={h}\n"));
}
if let Some(t) = self.text_size {
text.push_str(&format!("text_size={t}\n"));
}
if let Some(v) = &self.file_view {
text.push_str(&format!("file_view={v}\n"));
}
for g in &self.write_in_game {
text.push_str(&format!("write_in_game={}\n", g.display()));
}
Expand Down
16 changes: 15 additions & 1 deletion crates/openrage-gui/src/accent.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
//! The accent color (View → Accent color): the widget style's, OpenRAGE
//! orange (the logo's) or one of the user's choice. Every window gets it when
//! it opens and when it changes; it is saved in the settings as `accent`.
//! The text size (View → Text size) travels the same way.

use std::cell::Cell;

Expand All @@ -10,9 +11,21 @@ use crate::Theme;

thread_local! {
static CURRENT: Cell<(i32, Color)> = const { Cell::new((0, Color::from_rgb_u8(0xc2, 0x41, 0x0c))) };
/// The text size (View → Text size), 1.0 = normal; saved as `text_size`.
static TEXT_SCALE: Cell<f32> = const { Cell::new(1.0) };
}

/// Applies the current accent to a window.
/// Sets the text size (applying it is up to the caller, like the accent).
pub fn set_text_scale(scale: f32) {
TEXT_SCALE.with(|c| c.set(scale.clamp(0.75, 1.6)));
}

/// The text size setting in percent.
pub fn text_size_setting() -> u32 {
(TEXT_SCALE.with(Cell::get) * 100.0).round() as u32
}

/// Applies the current accent and text size to a window.
pub fn apply<T>(win: &T)
where
T: ComponentHandle,
Expand All @@ -22,6 +35,7 @@ where
let theme = win.global::<Theme>();
theme.set_accent_custom(color);
theme.set_accent_mode(mode);
theme.set_text_scale(TEXT_SCALE.with(Cell::get));
}

/// Sets the current accent (applying it is up to the caller).
Expand Down
35 changes: 35 additions & 0 deletions crates/openrage-gui/src/callbacks.rs
Original file line number Diff line number Diff line change
Expand Up @@ -472,6 +472,24 @@ fn wire_settings(ui: &AppWindow) {
xmlview::set_accent();
history::set_accent();
});
let w = ui.as_weak();
ui.on_text_scale_chosen(move |scale| {
accent::set_text_scale(scale);
with_app(|a| a.cfg.text_size = Some(accent::text_size_setting()));
if let Some(ui) = w.upgrade() {
save_settings(&ui);
accent::apply(&ui);
}
viewer::set_accent();
editor::set_accent();
xmlview::set_accent();
history::set_accent();
});
let w = ui.as_weak();
ui.on_view_mode_changed(move |mode| {
with_app(|a| a.cfg.file_view = Some(view_name(mode).to_owned()));
with_ui(&w, save_settings);
});
ui.on_color_hex(accent::hex_string);
ui.on_parse_hex(|s| accent::parse_hex(&s).unwrap_or(slint::Color::from_argb_u8(0, 0, 0, 0)));
let w = ui.as_weak();
Expand Down Expand Up @@ -679,6 +697,23 @@ pub(crate) fn theme_name(mode: i32) -> &'static str {
}
}

/// The file list view of the setting `file_view`: 0 list, 1 icons, 2 large icons.
pub(crate) fn view_mode(name: Option<&str>) -> i32 {
match name {
Some("icons") => 1,
Some("large-icons") => 2,
_ => 0,
}
}

fn view_name(mode: i32) -> &'static str {
match mode {
1 => "icons",
2 => "large-icons",
_ => "list",
}
}

pub(crate) fn theme_mode(name: Option<&str>) -> i32 {
match name {
Some("light") => 1,
Expand Down
10 changes: 8 additions & 2 deletions crates/openrage-gui/src/debug.rs
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,15 @@ pub(crate) fn debug_snapshot(ui: &AppWindow) {
if std::env::var("OPENRAGE_CONFIRM_PLUGIN").is_ok() && ui.get_plugin_pkg_visible() {
ui.invoke_plugin_pkg_confirm();
}
// `OPENRAGE_FIELD=search|filter`: unfold that field.
match std::env::var("OPENRAGE_FIELD").as_deref() {
Ok("search") => ui.invoke_open_search(),
Ok("filter") => ui.invoke_open_filter(),
_ => {}
}
if let Ok(page) = std::env::var("OPENRAGE_SETTINGS") {
ui.set_settings_scroll_end(page == "plugins");
ui.invoke_open_settings();
let tab = ["appearance", "game", "behaviour", "plugins"].iter().position(|t| *t == page).unwrap_or(0);
ui.invoke_open_settings_at(tab as i32);
}
// `OPENRAGE_ABOUT=<tab>` opens the About dialog on that tab (0–2).
if let Ok(tab) = std::env::var("OPENRAGE_ABOUT") {
Expand Down
8 changes: 6 additions & 2 deletions crates/openrage-gui/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -147,8 +147,10 @@ fn main() -> anyhow::Result<()> {
let ui = AppWindow::new()?;
// Wayland shows a window's icon only through its app id and the desktop
// entry of the same name (`openrage.desktop`, icon `openrage`); X11 uses
// it as WM_CLASS. Must be set before the first window is shown.
if let Err(e) = slint::set_xdg_app_id("openrage") {
// it as WM_CLASS. Must be set before the first window is shown. In the
// Flatpak the desktop entry is named after the Flatpak's id.
let app_id = std::env::var("FLATPAK_ID").unwrap_or_else(|_| "openrage".to_owned());
if let Err(e) = slint::set_xdg_app_id(&app_id) {
eprintln!("app id: {e}");
}
let cfg = Config::load();
Expand Down Expand Up @@ -212,7 +214,9 @@ fn main() -> anyhow::Result<()> {
ui.set_theme_mode(with_app(|a| theme_mode(a.cfg.theme.as_deref())));
let (mode, color) = with_app(|a| accent::from_setting(a.cfg.accent.as_deref()));
accent::set(mode, color);
accent::set_text_scale(with_app(|a| a.cfg.text_size.unwrap_or(100)) as f32 / 100.0);
accent::apply(&ui);
ui.set_view_mode(with_app(|a| view_mode(a.cfg.file_view.as_deref())));
ui.set_history_in_window(with_app(|a| a.cfg.history_window.unwrap_or(true)));
let languages: Vec<SharedString> =
std::iter::once("All languages".into()).chain(LANGUAGES.iter().map(|l| capitalize(l).into())).collect();
Expand Down
Loading
Loading