The stock glue screens are the default; native ones are dev-only (#1462)
The stock 1.12 GlueXML screens are now the default in every build: login, realm list, character select and create. benilla's native screens run only in a dev build with `WOW_GLUE_NATIVE=1`, or under the rig and capture runs, which still drive them, until the native screens are deleted. `WOW_GLUE_STOCK` is gone. On the way: - An unattended reconnect re-dials the kept realm and lists the roster. Under the stock screens it stalled at the realm list. - `WOW_CHARSELECT_PICK` selects on the stock screen. - `smoke.sh` counts the stock run's VMs and fonts. The stock screens fix the native screens' defects listed below. Tests cover the switch, the pick and the reconnect. Live: smoke, a kick and re-entry, the player build's boot. Part of #856. Fixes #849 Fixes #850 Fixes #834 Fixes #812 Fixes #360 Fixes #463 Fixes #79 Fixes #977 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -115,31 +115,6 @@ pub(crate) use probes::{
|
||||
ProbeGlueLuaPlugin, ProbeHoverPlugin, ProbeKeyPlugin, ProbeLuaPlugin, ProbeResizePlugin,
|
||||
RevealAuditPlugin, SchedCensusPlugin, StallPlugin, TrailCensusPlugin, UnitVisualsPlugin,
|
||||
};
|
||||
/// A probe that reads the native screens' rosters (the park's own, and the one re-sent after a
|
||||
/// create or delete) cannot run under `WOW_GLUE_STOCK=1`, where the screen asks for its own and the
|
||||
/// probe would sit until its timeout. Refuse it where it is requested: an error at plugin build,
|
||||
/// and the exit of a driverless run ([`crate::run_mode::fatal_when_driverless`]), at the first
|
||||
/// frame. `true` means the probe must not install.
|
||||
pub(crate) fn refuse_under_stock(app: &mut App, probe: &'static str) -> bool {
|
||||
refuse_if_stock(app, probe, crate::ui_script::glue::GlueStock::from_env().0)
|
||||
}
|
||||
|
||||
fn refuse_if_stock(app: &mut App, probe: &'static str, stock: bool) -> bool {
|
||||
if !stock {
|
||||
return false;
|
||||
}
|
||||
error!(
|
||||
"probe: {probe} reads the native screens' rosters and cannot run under WOW_GLUE_STOCK=1; \
|
||||
unset one of them"
|
||||
);
|
||||
if crate::run_mode::fatal_when_driverless(&format!("{probe} under WOW_GLUE_STOCK=1")) {
|
||||
app.add_systems(Startup, |mut exit: MessageWriter<AppExit>| {
|
||||
exit.write(AppExit::error());
|
||||
});
|
||||
}
|
||||
true
|
||||
}
|
||||
|
||||
pub(crate) use scenarios::ui_opted_in;
|
||||
use scenarios::GlueScreen;
|
||||
use scenarios::{
|
||||
@@ -1079,14 +1054,14 @@ fn drive_capture(
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod refuse_tests {
|
||||
use super::*;
|
||||
|
||||
/// A native-only probe installs under the native screens and is refused under the stock ones.
|
||||
mod glue_capture_tests {
|
||||
/// `ui_script::glue` puts the native screens up for a glue capture by its name's `glue-`
|
||||
/// prefix, so every glue capture carries it and no other capture does.
|
||||
#[test]
|
||||
fn a_native_only_probe_is_refused_under_the_stock_screens() {
|
||||
let mut app = App::new();
|
||||
assert!(!refuse_if_stock(&mut app, "WOW_RIG", false));
|
||||
assert!(refuse_if_stock(&mut app, "WOW_RIG", true));
|
||||
fn the_glue_captures_and_only_they_are_named_glue() {
|
||||
assert!(super::GLUE_SCENARIOS
|
||||
.iter()
|
||||
.all(|g| g.name.starts_with("glue-")));
|
||||
assert!(!super::SCENARIOS.iter().any(|s| s.name.starts_with("glue-")));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,7 +3,8 @@
|
||||
//! [`CharRequest::Create`], logs the `SMSG_CHAR_CREATE` result byte, then deletes the new
|
||||
//! character and logs that result too, unless `WOW_PROBE_CHARCREATE_KEEP=1`. Run it without
|
||||
//! `WOW_CHAR`, which would enter the world; the switches are `docs/CONTRIBUTING.md`, "Running it
|
||||
//! unattended".
|
||||
//! unattended". It reads the park's own rosters, so it puts the native glue screens up
|
||||
//! (`ui_script::glue::NATIVE_INSTRUMENTS`).
|
||||
|
||||
use benilla_protocol::{messages, CharAction, CharCreateReq};
|
||||
use bevy::prelude::*;
|
||||
@@ -21,9 +22,6 @@ impl Plugin for ProbeCharCreatePlugin {
|
||||
else {
|
||||
return; // inert without a valid env spec
|
||||
};
|
||||
if super::refuse_under_stock(app, "WOW_PROBE_CHARCREATE") {
|
||||
return;
|
||||
}
|
||||
let keep = std::env::var("WOW_PROBE_CHARCREATE_KEEP").as_deref() == Ok("1");
|
||||
app.insert_resource(CharCreateProbe {
|
||||
req,
|
||||
|
||||
@@ -74,7 +74,7 @@ pub(crate) const PROBE_VARS: &[ProbeVar] = &[
|
||||
},
|
||||
ProbeVar {
|
||||
name: "WOW_PROBE_GLUE_LUA",
|
||||
purpose: "\"<chunk>\" — under WOW_GLUE_STOCK=1, run a Lua chunk once in the stock glue VM (press the login screen's buttons headlessly)",
|
||||
purpose: "\"<chunk>\" — run a Lua chunk once in the stock glue VM (press the login screen's buttons headlessly)",
|
||||
wall_clock: true,
|
||||
},
|
||||
ProbeVar {
|
||||
|
||||
@@ -29,6 +29,9 @@
|
||||
//! the world DB. Applying gear unequips all 19 slots before it equips
|
||||
//! (`ObjectMgr.cpp:12079-12117`), so re-dressing a body leaves the old set in its bags or mailed;
|
||||
//! a fresh rig-named character starts with empty bags.
|
||||
//!
|
||||
//! The rig picks, creates and deletes through the park's own rosters, so a rig run puts the
|
||||
//! native glue screens up (`ui_script::glue::NATIVE_INSTRUMENTS`).
|
||||
|
||||
use benilla_protocol::{messages, CharAction, CharCreateReq};
|
||||
use bevy::prelude::*;
|
||||
@@ -73,9 +76,6 @@ impl Plugin for ProbeRigPlugin {
|
||||
else {
|
||||
return; // inert without a parseable spec (parse() has already said why)
|
||||
};
|
||||
if super::refuse_under_stock(app, "WOW_RIG") {
|
||||
return;
|
||||
}
|
||||
info!("rig: {}", spec.describe());
|
||||
// Publish the claim on the character pick, so the roster knows the pick is spoken for.
|
||||
if let Some(name) = rig_char_name(&spec) {
|
||||
|
||||
@@ -365,10 +365,10 @@ fn fire_probe_lua(
|
||||
}
|
||||
}
|
||||
|
||||
/// `WOW_PROBE_GLUE_LUA="<chunk>"`: under `WOW_GLUE_STOCK=1`, runs the chunk once in the stock
|
||||
/// glue VM `WOW_PROBE_GLUE_LUA_AT` seconds (default 10) into the run, to press the login screen's
|
||||
/// buttons headlessly; `WOW_PROBE_GLUE_SHOT=<path>` then saves one PNG
|
||||
/// `WOW_PROBE_GLUE_SHOT_AFTER` seconds (default 1) later. The chunk is never logged: it may carry
|
||||
/// `WOW_PROBE_GLUE_LUA="<chunk>"`: runs the chunk once in the stock glue VM
|
||||
/// `WOW_PROBE_GLUE_LUA_AT` seconds (default 10) into the run, to press the login screen's buttons
|
||||
/// headlessly; `WOW_PROBE_GLUE_SHOT=<path>` then saves one PNG `WOW_PROBE_GLUE_SHOT_AFTER` seconds
|
||||
/// (default 1) later. The chunk is never logged: it may carry
|
||||
/// a typed password.
|
||||
pub(crate) struct ProbeGlueLuaPlugin;
|
||||
|
||||
|
||||
@@ -37,7 +37,7 @@ const HORDE: [u8; 4] = [2, 5, 6, 8]; // Orc, Scourge, Tauren, Troll
|
||||
const INITIAL_FACING: f32 = -15.0 * std::f32::consts::PI / 180.0;
|
||||
|
||||
/// The character-creation screen and its selection state, on the native screens alone: under
|
||||
/// `WOW_GLUE_STOCK=1` the stock `CharacterCreate` is a glue screen of the glue VM, and the app
|
||||
/// the stock screens the stock `CharacterCreate` is a glue screen of the glue VM, and the app
|
||||
/// never enters [`ClientState::CharCreate`].
|
||||
pub(crate) struct CharCreatePlugin;
|
||||
|
||||
|
||||
@@ -14,13 +14,13 @@ use benilla_protocol::CharAction;
|
||||
use bevy::prelude::*;
|
||||
|
||||
use crate::client_state::ClientState;
|
||||
use crate::glue_session::roster::{send_pick, Roster};
|
||||
use crate::glue_session::roster::Roster;
|
||||
use crate::glue_strings::GlueStrings;
|
||||
|
||||
use crate::net::{CharActionResultMessage, CharPick, CharacterLoginFailedMessage};
|
||||
use crate::net::{CharActionResultMessage, CharacterLoginFailedMessage};
|
||||
|
||||
/// The native character-select screen. All of it runs on the native screens alone: under
|
||||
/// `WOW_GLUE_STOCK=1` the stock `CharacterSelect` stands in its place, and the session it shows is
|
||||
/// the stock screens the stock `CharacterSelect` stands in its place, and the session it shows is
|
||||
/// [`crate::glue_session`]'s.
|
||||
pub(crate) struct CharSelectPlugin;
|
||||
|
||||
@@ -62,7 +62,6 @@ impl Plugin for CharSelectPlugin {
|
||||
// The one `GlueDialog`: here, the refused login and the refused delete.
|
||||
crate::glue::dialog::drive_glue_dialog,
|
||||
debug_select_addons,
|
||||
debug_select_walk,
|
||||
addons::drive_addons_panel,
|
||||
refresh::refresh_list,
|
||||
refresh::refresh_banner_and_buttons,
|
||||
@@ -185,72 +184,6 @@ pub(crate) fn char_delete_refusal_text(strings: &GlueStrings, code: u8) -> Optio
|
||||
Some(strings.text(key, fallback))
|
||||
}
|
||||
|
||||
/// The select walk (`WOW_CHARSELECT_WALK=<period_s>[:<enter_after_s>]`): select each row in turn,
|
||||
/// one per `period_s`, logging each step with its time; with `enter_after_s`, press Enter World
|
||||
/// that long after the last step.
|
||||
fn debug_select_walk(
|
||||
mut roster: ResMut<Roster>,
|
||||
pick: Res<CharPick>,
|
||||
time: Res<Time>,
|
||||
mut plan: Local<Option<(f32, Option<f32>)>>,
|
||||
mut next_at: Local<Option<f32>>,
|
||||
mut row: Local<usize>,
|
||||
mut done: Local<bool>,
|
||||
) {
|
||||
if *done {
|
||||
return;
|
||||
}
|
||||
let (period, enter_after) = *plan.get_or_insert_with(|| {
|
||||
let Ok(spec) = std::env::var("WOW_CHARSELECT_WALK") else {
|
||||
return (f32::INFINITY, None);
|
||||
};
|
||||
let (p, e) = spec.split_once(':').unwrap_or((spec.as_str(), ""));
|
||||
(
|
||||
p.trim().parse::<f32>().unwrap_or(3.0),
|
||||
e.trim().parse::<f32>().ok(),
|
||||
)
|
||||
});
|
||||
if !period.is_finite() {
|
||||
*done = true;
|
||||
return;
|
||||
}
|
||||
if roster.chars.is_empty() {
|
||||
return;
|
||||
}
|
||||
let now = time.elapsed_secs();
|
||||
let at = *next_at.get_or_insert(now + period);
|
||||
if now < at {
|
||||
return;
|
||||
}
|
||||
if *row < roster.chars.len() {
|
||||
let i = *row;
|
||||
*row += 1;
|
||||
let c = &roster.chars[i];
|
||||
info!(
|
||||
"char select: WALK t={now:.3} → row {i} ({}, race {}, class {})",
|
||||
c.name, c.race, c.class
|
||||
);
|
||||
roster.select(Some(i));
|
||||
// The last row waits `enter_after`, so the entry starts from a settled screen.
|
||||
*next_at = Some(
|
||||
now + if *row == roster.chars.len() {
|
||||
enter_after.unwrap_or(period)
|
||||
} else {
|
||||
period
|
||||
},
|
||||
);
|
||||
return;
|
||||
}
|
||||
*done = true;
|
||||
if enter_after.is_none() {
|
||||
return;
|
||||
}
|
||||
if let Some((guid, name)) = roster.selected_char().map(|c| (c.guid, c.name.clone())) {
|
||||
info!("char select: WALK t={now:.3} → ENTER WORLD as {name}");
|
||||
send_pick(&mut roster, &pick, guid);
|
||||
}
|
||||
}
|
||||
|
||||
/// When the select screen came up, present only while it is; the screen's timed instruments
|
||||
/// measure from it.
|
||||
#[derive(Resource, Clone, Copy)]
|
||||
|
||||
@@ -582,8 +582,8 @@ pub(crate) mod schedule_tests {
|
||||
})
|
||||
}
|
||||
|
||||
/// The glue booth has one feeder per switch: under `WOW_GLUE_STOCK=1` only the glue VM's
|
||||
/// writes `GluePreview`, and off it only the native screens' do. A writer of neither kind is
|
||||
/// The glue booth has one feeder per switch: under the stock screens only the glue VM's
|
||||
/// writes `GluePreview`, and under the native ones only the native screens' do. A writer of neither kind is
|
||||
/// named here with why it cannot run against the other.
|
||||
#[test]
|
||||
fn the_glue_preview_has_one_feeder_per_switch() {
|
||||
@@ -740,7 +740,7 @@ pub(crate) mod schedule_tests {
|
||||
out
|
||||
}
|
||||
|
||||
/// Under `WOW_GLUE_STOCK=1` nothing of the native glue screens runs, in any schedule: every
|
||||
/// Under the stock screens nothing of the native glue screens runs, in any schedule: every
|
||||
/// system of their modules, and every system that writes their dialog or reads, writes or
|
||||
/// filters for their trees or state, carries the `native_glue` gate. What the stock screens
|
||||
/// need of the session lives in `glue_session`, which tells a native screen what it decided by
|
||||
@@ -1453,7 +1453,7 @@ pub(crate) mod schedule_tests {
|
||||
assert!(stale.is_empty(), "stale rows:\n {}", stale.join("\n "));
|
||||
}
|
||||
|
||||
/// The `Startup` VM, the stock glue's under `WOW_GLUE_STOCK=1`, is built after the glyph cache:
|
||||
/// The `Startup` VM, the stock glue's, is built after the glyph cache:
|
||||
/// its first screen sizes frames by measured text in the show (`TOSFrameHeader` off
|
||||
/// `TOSFrameTitle:GetWidth()`, `AccountLogin.lua`), which with no cache measures 0.
|
||||
#[test]
|
||||
|
||||
@@ -421,7 +421,7 @@ fn to_select_on_roster(
|
||||
// behind the screen's back is abandoned.
|
||||
let now = LoginAbandon::now(abandon.as_deref());
|
||||
let (mut edge, mut stale) = (false, false);
|
||||
let generations: Vec<u64> = if stock.is_some_and(|s| s.0) {
|
||||
let generations: Vec<u64> = if crate::ui_script::glue::is_stock(stock.as_deref()) {
|
||||
msgs.read().for_each(drop);
|
||||
auths.read().map(|m| m.generation).collect()
|
||||
} else {
|
||||
|
||||
@@ -9,6 +9,7 @@ pub(crate) mod logout_smoke;
|
||||
pub(crate) mod queue;
|
||||
pub(crate) mod realm;
|
||||
pub(crate) mod realm_smoke;
|
||||
mod reconnect;
|
||||
pub(crate) mod roster;
|
||||
mod roundtrip;
|
||||
|
||||
@@ -29,6 +30,12 @@ impl Plugin for GlueSessionPlugin {
|
||||
.in_set(edges::SessionEdges)
|
||||
.after(benilla_world::schedule::WorldStage::Net),
|
||||
)
|
||||
.add_systems(
|
||||
Update,
|
||||
reconnect::answer_reconnect
|
||||
.run_if(crate::ui_script::glue::stock_glue)
|
||||
.after(edges::SessionEdges),
|
||||
)
|
||||
// After the UI tick, the glue manager's frame and the session's edges, in one chain:
|
||||
// on the stock screens each reads the frames those moved and presses their verbs.
|
||||
.add_systems(
|
||||
|
||||
@@ -0,0 +1,125 @@
|
||||
//! An unattended run's reconnect on the stock screens: the session lost while a pick is kept for it
|
||||
//! ([`crate::net::DisconnectedMessage`]'s `session_over` false), the login resubmitted
|
||||
//! ([`super::login`]), the run answers the realm list with the realm it was on and asks the
|
||||
//! roster, which the roster policy answers with the kept pick ([`super::roster`]).
|
||||
//!
|
||||
//! No glue screen stands to make these asks: the character is still in the world, the world's VM
|
||||
//! up and the glue torn down, so the stock screens' connect and their `GetCharacterListUpdate`
|
||||
//! never run. The reference has no reconnect at all (a lost session is `DISCONNECTED_FROM_SERVER`);
|
||||
//! the native screens' realm and roster policies answer every park on their own.
|
||||
|
||||
use bevy::prelude::*;
|
||||
|
||||
use super::roster::Roster;
|
||||
use crate::net::{
|
||||
CharPick, CharRequest, LoginAbandon, RealmChoice, RealmListMessage, RealmRequest,
|
||||
WorldAuthMessage,
|
||||
};
|
||||
|
||||
/// Answer the realm list and the character park of a reconnect while a pick is kept: the realm the
|
||||
/// session was on, as the list now holds it, then the roster ask.
|
||||
pub(super) fn answer_reconnect(
|
||||
roster: Res<Roster>,
|
||||
mut lists: MessageReader<RealmListMessage>,
|
||||
mut auths: MessageReader<WorldAuthMessage>,
|
||||
choice: Res<RealmChoice>,
|
||||
pick: Res<CharPick>,
|
||||
abandon: Option<Res<LoginAbandon>>,
|
||||
) {
|
||||
let kept = roster.pending_pick.is_some();
|
||||
for list in lists.read() {
|
||||
if !kept || list.failed {
|
||||
continue;
|
||||
}
|
||||
let Some(name) = roster.realm.as_ref().map(|r| r.name.as_str()) else {
|
||||
continue;
|
||||
};
|
||||
match list.realms.iter().find(|r| r.name == name) {
|
||||
Some(realm) => {
|
||||
info!("reconnect: dialing {name} again for the kept pick");
|
||||
let _ = choice.0.send(RealmRequest::Enter {
|
||||
realm: realm.clone(),
|
||||
generation: LoginAbandon::now(abandon.as_deref()),
|
||||
});
|
||||
}
|
||||
None => warn!("reconnect: {name} is not on the realm list — the pick is not re-made"),
|
||||
}
|
||||
}
|
||||
if auths.read().last().is_some() && kept {
|
||||
let _ = pick.0.send(CharRequest::Enumerate);
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use super::*;
|
||||
|
||||
use crate::glue_session::roster::test_character;
|
||||
|
||||
fn realm(name: &str) -> benilla_protocol::RealmInfo {
|
||||
benilla_protocol::RealmInfo {
|
||||
name: name.into(),
|
||||
address: "127.0.0.1:8085".into(),
|
||||
population: 1.0,
|
||||
characters: 1,
|
||||
realm_type: 0,
|
||||
flags: 0,
|
||||
category: 1,
|
||||
id: 0,
|
||||
}
|
||||
}
|
||||
|
||||
type Rx<T> = crossbeam_channel::Receiver<T>;
|
||||
|
||||
fn reconnect_app(pending: bool) -> (App, Rx<RealmRequest>, Rx<CharRequest>) {
|
||||
let (realm_tx, realm_rx) = crossbeam_channel::unbounded();
|
||||
let (pick_tx, pick_rx) = crossbeam_channel::unbounded();
|
||||
let mut roster = if pending {
|
||||
Roster::with_pending_pick(vec![test_character(7, "Seven")], 7)
|
||||
} else {
|
||||
Roster::with_chars(vec![test_character(7, "Seven")])
|
||||
};
|
||||
roster.realm = Some(realm("Beta"));
|
||||
let mut app = App::new();
|
||||
app.insert_resource(roster)
|
||||
.insert_resource(RealmChoice(realm_tx.into()))
|
||||
.insert_resource(CharPick(pick_tx.into()))
|
||||
.add_message::<RealmListMessage>()
|
||||
.add_message::<WorldAuthMessage>()
|
||||
.add_systems(Update, answer_reconnect);
|
||||
(app, realm_rx, pick_rx)
|
||||
}
|
||||
|
||||
fn reconnect(app: &mut App) {
|
||||
app.world_mut().write_message(RealmListMessage {
|
||||
realms: vec![realm("Alpha"), realm("Beta")],
|
||||
failed: false,
|
||||
});
|
||||
app.update();
|
||||
app.world_mut().write_message(WorldAuthMessage {
|
||||
realm: realm("Beta"),
|
||||
epoch: 2,
|
||||
generation: 0,
|
||||
});
|
||||
app.update();
|
||||
}
|
||||
|
||||
/// With a pick kept, the reconnect dials the realm the session was on and asks the roster
|
||||
/// the pick is re-made from; with none, a realm list and an authentication ask nothing, as at
|
||||
/// a first login, where the stock screens make both asks.
|
||||
#[test]
|
||||
fn a_kept_pick_dials_its_realm_and_asks_the_roster() {
|
||||
let (mut app, realms, picks) = reconnect_app(true);
|
||||
reconnect(&mut app);
|
||||
assert!(matches!(
|
||||
realms.try_recv(),
|
||||
Ok(RealmRequest::Enter { realm, .. }) if realm.name == "Beta"
|
||||
));
|
||||
assert!(matches!(picks.try_recv(), Ok(CharRequest::Enumerate)));
|
||||
|
||||
let (mut app, realms, picks) = reconnect_app(false);
|
||||
reconnect(&mut app);
|
||||
assert!(realms.try_recv().is_err());
|
||||
assert!(picks.try_recv().is_err());
|
||||
}
|
||||
}
|
||||
@@ -11,16 +11,30 @@ use crate::ui_script::glue::{StockGlueProbe, StockVm};
|
||||
|
||||
// ── The roster and pick policy ──────────────────────────────────────────────────────────────────
|
||||
|
||||
/// The run's own pick (`WOW_CHAR`, `WOW_RIG`) on the stock screens, by guid, until their select
|
||||
/// screen stands to take it ([`enter_run_pick`]).
|
||||
/// What the run's own pick presses on the stock select screen.
|
||||
#[derive(Clone, Copy, PartialEq, Eq, Debug)]
|
||||
enum PickAct {
|
||||
/// Select the row and stay on the screen (`WOW_CHARSELECT_PICK`).
|
||||
Select,
|
||||
/// Select the row and press Enter World (`WOW_CHAR`).
|
||||
Enter,
|
||||
}
|
||||
|
||||
/// The run's own pick on the stock screens, by guid, until their select screen stands to take it
|
||||
/// ([`enter_run_pick`]).
|
||||
#[derive(Resource, Default)]
|
||||
pub(crate) struct RunPick(Option<u64>);
|
||||
pub(crate) struct RunPick(Option<(u64, PickAct)>);
|
||||
|
||||
#[cfg(test)]
|
||||
impl RunPick {
|
||||
/// The pick armed for `guid`, as the roster policy arms it on the stock screens.
|
||||
/// The entry armed for `guid`, as the roster policy arms `WOW_CHAR` on the stock screens.
|
||||
pub(crate) fn armed(guid: u64) -> Self {
|
||||
RunPick(Some(guid))
|
||||
RunPick(Some((guid, PickAct::Enter)))
|
||||
}
|
||||
|
||||
/// The selection armed for `guid`, as the roster policy arms `WOW_CHARSELECT_PICK`.
|
||||
pub(crate) fn selecting(guid: u64) -> Self {
|
||||
RunPick(Some((guid, PickAct::Select)))
|
||||
}
|
||||
}
|
||||
|
||||
@@ -238,6 +252,7 @@ pub(super) fn apply_roster_policy(
|
||||
rig: Option<Res<crate::run_mode::RigCharacter>>,
|
||||
mut exit: MessageWriter<AppExit>,
|
||||
) {
|
||||
let stock = crate::ui_script::glue::is_stock(stock.as_deref());
|
||||
if !roster.env_read {
|
||||
roster.env_read = true;
|
||||
// `WOW_RIG` outranks `WOW_CHAR`: the rig may have to create its character first, which
|
||||
@@ -285,7 +300,8 @@ pub(super) fn apply_roster_policy(
|
||||
info!("char select: {CVAR_LAST_CHARACTER} selects row {row} ({who})");
|
||||
roster.select(Some(row));
|
||||
}
|
||||
// `WOW_CHARSELECT_PICK=<name>` selects that row and stays on the screen.
|
||||
// `WOW_CHARSELECT_PICK=<name>` selects that row and stays on the screen: on the stock
|
||||
// screens through their own selection, once they hold this roster.
|
||||
if let Ok(name) = std::env::var("WOW_CHARSELECT_PICK") {
|
||||
match roster
|
||||
.chars
|
||||
@@ -294,7 +310,11 @@ pub(super) fn apply_roster_policy(
|
||||
{
|
||||
Some(row) => {
|
||||
info!("char select: WOW_CHARSELECT_PICK={name} — selecting row {row}");
|
||||
roster.select(Some(row));
|
||||
if stock {
|
||||
run_pick.0 = Some((roster.chars[row].guid, PickAct::Select));
|
||||
} else {
|
||||
roster.select(Some(row));
|
||||
}
|
||||
}
|
||||
None => warn!("char select: WOW_CHARSELECT_PICK={name} not on this account"),
|
||||
}
|
||||
@@ -310,9 +330,9 @@ pub(super) fn apply_roster_policy(
|
||||
{
|
||||
Some(c) => {
|
||||
let guid = c.guid;
|
||||
if stock.as_deref().is_some_and(|s| s.0) {
|
||||
if stock {
|
||||
info!("char select: WOW_CHAR={name} — fast path, by Enter World");
|
||||
run_pick.0 = Some(guid);
|
||||
run_pick.0 = Some((guid, PickAct::Enter));
|
||||
} else {
|
||||
info!("char select: WOW_CHAR={name} — fast path");
|
||||
send_pick(&mut roster, &pick, guid);
|
||||
@@ -345,15 +365,22 @@ pub(crate) fn press_enter_world(vm: StockVm, row: usize) {
|
||||
));
|
||||
}
|
||||
|
||||
/// Select `row` (0-based) on the stock select screen, as a click on it does
|
||||
/// (`CharacterSelectButton_OnClick` → `CharacterSelect_SelectCharacter`), whose `SelectCharacter`
|
||||
/// reaches the engine's selection (`0x473470`).
|
||||
fn press_select(vm: StockVm, row: usize) {
|
||||
vm.press(&format!("CharacterSelect_SelectCharacter({})", row + 1));
|
||||
}
|
||||
|
||||
/// The run's own pick on the stock screens ([`RunPick`]): once their select screen stands with the
|
||||
/// roster loaded into it (`0x4724d0`), the row is pressed into the world through the screen's
|
||||
/// Enter World ([`press_enter_world`]), never sent past it.
|
||||
/// roster loaded into it (`0x4724d0`), the row is selected ([`press_select`]) or pressed into the
|
||||
/// world through the screen's Enter World ([`press_enter_world`]), never sent past it.
|
||||
pub(crate) fn enter_run_pick(
|
||||
roster: Res<Roster>,
|
||||
mut run_pick: ResMut<RunPick>,
|
||||
stock: StockGlueProbe,
|
||||
) {
|
||||
let Some(guid) = run_pick.0 else {
|
||||
let Some((guid, act)) = run_pick.0 else {
|
||||
return;
|
||||
};
|
||||
let Some(vm) = stock.vm().filter(|vm| vm.frame_visible("CharacterSelect")) else {
|
||||
@@ -368,7 +395,10 @@ pub(crate) fn enter_run_pick(
|
||||
return;
|
||||
}
|
||||
run_pick.0 = None;
|
||||
press_enter_world(vm, row);
|
||||
match act {
|
||||
PickAct::Select => press_select(vm, row),
|
||||
PickAct::Enter => press_enter_world(vm, row),
|
||||
}
|
||||
}
|
||||
|
||||
/// A `Character` with only its identity filled in.
|
||||
|
||||
@@ -3,9 +3,9 @@
|
||||
//! runs over either glue screen set.
|
||||
//!
|
||||
//! "Roster has arrived" counts the roster, not its characters: an account with none reaches select
|
||||
//! all the same. Under `WOW_GLUE_STOCK=1` the stock screens are driven through their own verbs in
|
||||
//! the glue VM (`SetGlueScreen("charcreate")`, `CharacterCreate_Back`) and their frames are read,
|
||||
//! since the app's [`ClientState`] does not follow the stock create screen.
|
||||
//! all the same. The stock screens are driven through their own verbs in the glue VM
|
||||
//! (`SetGlueScreen("charcreate")`, `CharacterCreate_Back`) and their frames are read, since the
|
||||
//! app's [`ClientState`] does not follow the stock create screen.
|
||||
|
||||
use bevy::prelude::*;
|
||||
|
||||
@@ -218,11 +218,12 @@ mod tests {
|
||||
}
|
||||
|
||||
/// The system counts the roster message, not the characters in it: an empty one at select
|
||||
/// sends the app to create.
|
||||
/// sends the app to create, on the native screens, whose arm moves the state.
|
||||
#[test]
|
||||
fn the_system_takes_an_empty_roster_message_for_arrival() {
|
||||
let mut app = App::new();
|
||||
app.add_plugins((MinimalPlugins, bevy::state::app::StatesPlugin))
|
||||
.insert_resource(crate::ui_script::glue::GlueStock(false))
|
||||
.insert_state(ClientState::CharSelect)
|
||||
.init_resource::<Roster>()
|
||||
.add_message::<CharListMessage>()
|
||||
|
||||
@@ -20,7 +20,7 @@
|
||||
//! is dialled again for a query after it (`0x5b2200`), and names no screen; only `ConnectToRealm` (`0x46b210`) drops the world connection, once a realm is
|
||||
//! chosen. So the character park serves the list in place and Cancel there does nothing.
|
||||
//!
|
||||
//! Under `WOW_GLUE_STOCK=1` the stock `RealmList` and its verbs take the list instead
|
||||
//! Under the stock screens the stock `RealmList` and its verbs take the list instead
|
||||
//! ([`crate::ui_script::glue_mgr`]), and none of this runs; the stock connect takes the same
|
||||
//! [`RunModeRealm`].
|
||||
|
||||
|
||||
@@ -32,7 +32,7 @@ const GLUE_MUSIC_FADE_OUT_MS: u64 = 3000;
|
||||
pub(crate) struct GlueSound(pub(crate) &'static str);
|
||||
|
||||
/// The stock glue screens' music verbs, which drive the theme in place of the native screens'
|
||||
/// start-on-entry under `WOW_GLUE_STOCK=1`.
|
||||
/// start-on-entry.
|
||||
#[derive(Message, Clone, Debug, PartialEq, Eq)]
|
||||
pub(crate) enum GlueMusicRequest {
|
||||
/// `PlayGlueMusic(file)` (`0x45aeb0`): the same file still streaming plays on; another stops
|
||||
|
||||
@@ -1,7 +1,8 @@
|
||||
//! The stock glue screens, behind `WOW_GLUE_STOCK=1` in a dev build: the player's own
|
||||
//! `GlueXML.toc` off the patch chain, run into a glue VM ([`UiScript::new_glue`]) that stands in
|
||||
//! the world while no character is in it, where the boot VM otherwise stands. The native screens
|
||||
//! stay the default and, under the switch, keep driving the network unseen.
|
||||
//! The stock glue screens: the player's own `GlueXML.toc` off the patch chain, run into a glue VM
|
||||
//! ([`UiScript::new_glue`]) that stands in the world while no character is in it, where the boot VM
|
||||
//! otherwise stands. They are the glue screens of every run but a dev build's
|
||||
//! `WOW_GLUE_NATIVE=1` ([`GlueStock::from_env`]), which puts up the native screens until they are
|
||||
//! deleted.
|
||||
//!
|
||||
//! The reference's glue builder (`0x46a7b0`) resets the Lua state on a rebuild (`0x46a87b`; the
|
||||
//! cold first build, `0x46a505`, passes 0 and skips it), registers the glue functions
|
||||
@@ -33,26 +34,85 @@ use benilla_ui::script::{ScriptValue, UiScript};
|
||||
|
||||
use super::reference_ui;
|
||||
|
||||
/// The switch's variable.
|
||||
const SWITCH: &str = "WOW_GLUE_STOCK";
|
||||
/// The dev switch that puts the native glue screens up instead of the stock ones.
|
||||
const NATIVE_SWITCH: &str = "WOW_GLUE_NATIVE";
|
||||
|
||||
/// Whether this run puts the stock glue screens up, read once at plugin build: a dev build with
|
||||
/// `WOW_GLUE_STOCK=1`. A player build never does.
|
||||
#[derive(Resource, Default, Clone, Copy)]
|
||||
/// The instruments outside the native screens' modules that still drive them, which a dev run
|
||||
/// that names one puts up: the rig and the create probe (`capture::probe_rig`,
|
||||
/// `capture::probe_charcreate`) create, delete and pick through the park's own enumerations, which
|
||||
/// the stock screen replaces with its own ask, and the glue captures (`WOW_CAPTURE=glue-…`,
|
||||
/// `capture::scenarios::GLUE_SCENARIOS`) photograph and feed the native screens.
|
||||
const NATIVE_INSTRUMENTS: [&str; 2] = ["WOW_RIG", "WOW_PROBE_CHARCREATE"];
|
||||
|
||||
/// The native screens' own instruments, inert under the stock screens: named in a warning when a
|
||||
/// run sets one without [`NATIVE_SWITCH`].
|
||||
const NATIVE_ONLY: [&str; 10] = [
|
||||
"WOW_LOGIN_SMOKE",
|
||||
"WOW_CHARSELECT_DIALOG",
|
||||
"WOW_CHARSELECT_ADDONS",
|
||||
"WOW_CHARSELECT_SHOT_OUT",
|
||||
"WOW_CHARSELECT_SHOT_AT",
|
||||
"WOW_CHARCREATE_NAME",
|
||||
"WOW_CHARCREATE_SHOT",
|
||||
"WOW_CHARCREATE_PICK",
|
||||
"WOW_CHARCREATE_DIALS",
|
||||
"WOW_CHARCREATE_SHOT_OUT",
|
||||
];
|
||||
|
||||
/// Whether this run puts the stock glue screens up, read once at plugin build. Absent, as in a
|
||||
/// test's partial app, it reads as stock, the default ([`is_stock`]).
|
||||
#[derive(Resource, Clone, Copy)]
|
||||
pub(crate) struct GlueStock(pub(crate) bool);
|
||||
|
||||
impl GlueStock {
|
||||
/// The switch as this process has it.
|
||||
pub(crate) fn from_env() -> Self {
|
||||
Self(
|
||||
crate::run_mode::dev_affordances()
|
||||
&& std::env::var(SWITCH).ok().as_deref() == Some("1"),
|
||||
)
|
||||
impl Default for GlueStock {
|
||||
fn default() -> Self {
|
||||
Self(true)
|
||||
}
|
||||
}
|
||||
|
||||
/// The stock glue screens as a dev instrument reaches them, so no instrument names the VM: the
|
||||
/// switch, and through [`StockVm`] the glue VM's frames and verbs.
|
||||
impl GlueStock {
|
||||
/// The switch as this process has it: stock, except in a dev build whose environment asks for
|
||||
/// the native screens ([`native_asked`]). A player build always stands on the stock screens.
|
||||
pub(crate) fn from_env() -> Self {
|
||||
if !crate::run_mode::dev_affordances() {
|
||||
return Self(true);
|
||||
}
|
||||
let var = |k: &str| std::env::var(k).ok();
|
||||
let asked = native_asked(var);
|
||||
match &asked {
|
||||
Some(why) => info!("glue: {why}: the native glue screens stand this run"),
|
||||
None => {
|
||||
for k in NATIVE_ONLY.into_iter().filter(|k| var(k).is_some()) {
|
||||
warn!("glue: {k} drives the native glue screens and does nothing under the stock ones; set {NATIVE_SWITCH}=1 for it");
|
||||
}
|
||||
}
|
||||
}
|
||||
Self(asked.is_none())
|
||||
}
|
||||
}
|
||||
|
||||
/// What in a dev run's environment asks for the native screens, if anything: the switch, or an
|
||||
/// instrument that still drives them ([`NATIVE_INSTRUMENTS`], a glue capture).
|
||||
fn native_asked(var: impl Fn(&str) -> Option<String>) -> Option<String> {
|
||||
if var(NATIVE_SWITCH).as_deref() == Some("1") {
|
||||
return Some(format!("{NATIVE_SWITCH}=1"));
|
||||
}
|
||||
if let Some(name) = var("WOW_CAPTURE").filter(|n| n.starts_with("glue-")) {
|
||||
return Some(format!("WOW_CAPTURE={name} photographs the native screens"));
|
||||
}
|
||||
NATIVE_INSTRUMENTS
|
||||
.into_iter()
|
||||
.find(|k| var(k).is_some())
|
||||
.map(|k| format!("{k} drives the native screens' roster"))
|
||||
}
|
||||
|
||||
/// The stock screens stand: the resource says so, or is absent and the default holds.
|
||||
pub(crate) fn is_stock(stock: Option<&GlueStock>) -> bool {
|
||||
stock.is_none_or(|s| s.0)
|
||||
}
|
||||
|
||||
/// The stock glue screens as a dev instrument reaches them, so no instrument names the VM: which
|
||||
/// screens stand, and through [`StockVm`] the glue VM's frames and verbs.
|
||||
#[derive(bevy::ecs::system::SystemParam)]
|
||||
pub(crate) struct StockGlueProbe<'w> {
|
||||
stock: Option<Res<'w, GlueStock>>,
|
||||
@@ -60,10 +120,11 @@ pub(crate) struct StockGlueProbe<'w> {
|
||||
}
|
||||
|
||||
impl StockGlueProbe<'_> {
|
||||
/// The glue VM, `None` with the switch off. With it on and the glue VM not standing (the
|
||||
/// world's VM, or a build that failed), a [`StockVm`] that shows nothing and presses nothing.
|
||||
/// The glue VM, `None` under the native screens. With the stock screens and the glue VM not
|
||||
/// standing (the world's VM, or a build that failed), a [`StockVm`] that shows nothing and
|
||||
/// presses nothing.
|
||||
pub(crate) fn vm(&self) -> Option<StockVm<'_>> {
|
||||
self.stock.as_deref().is_some_and(|s| s.0).then(|| {
|
||||
is_stock(self.stock.as_deref()).then(|| {
|
||||
StockVm(
|
||||
self.script
|
||||
.as_deref()
|
||||
@@ -114,23 +175,24 @@ impl StockVm<'_> {
|
||||
}
|
||||
}
|
||||
|
||||
/// Run condition: the stock glue screens are up, the switch on and no character in the world.
|
||||
/// Run condition: the stock glue screens are up, they stand this run and no character is in the
|
||||
/// world.
|
||||
pub(crate) fn glue_ui_up(
|
||||
stock: Option<Res<GlueStock>>,
|
||||
state: Option<Res<State<crate::client_state::ClientState>>>,
|
||||
) -> bool {
|
||||
stock.is_some_and(|s| s.0)
|
||||
is_stock(stock.as_deref())
|
||||
&& state.is_none_or(|s| *s.get() != crate::client_state::ClientState::InWorld)
|
||||
}
|
||||
|
||||
/// Run condition: the switch is on, whether or not a character is in the world.
|
||||
/// Run condition: the stock screens stand this run, whether or not a character is in the world.
|
||||
pub(crate) fn stock_glue(stock: Option<Res<GlueStock>>) -> bool {
|
||||
stock.is_some_and(|s| s.0)
|
||||
is_stock(stock.as_deref())
|
||||
}
|
||||
|
||||
/// Run condition: the native glue screens draw and take input, the switch off.
|
||||
/// Run condition: the native glue screens draw and take input, a dev run having asked for them.
|
||||
pub(crate) fn native_glue(stock: Option<Res<GlueStock>>) -> bool {
|
||||
!stock.is_some_and(|s| s.0)
|
||||
!is_stock(stock.as_deref())
|
||||
}
|
||||
|
||||
/// The glue screen `SET_GLUE_SCREEN` names, `GlueParent.lua`'s `GlueScreenInfo` key.
|
||||
@@ -441,6 +503,30 @@ mod tests {
|
||||
assert_eq!(nil_call("x.lua:1: bad argument #1"), None);
|
||||
}
|
||||
|
||||
/// The stock screens stand unless a dev run asks for the native ones, by the switch or by an
|
||||
/// instrument that still drives them; any other value of the switch leaves the stock screens up.
|
||||
#[test]
|
||||
fn the_native_screens_stand_only_when_a_dev_run_asks() {
|
||||
let env = |pairs: &'static [(&'static str, &'static str)]| {
|
||||
move |k: &str| {
|
||||
pairs
|
||||
.iter()
|
||||
.find(|(name, _)| *name == k)
|
||||
.map(|(_, v)| v.to_string())
|
||||
}
|
||||
};
|
||||
assert_eq!(native_asked(env(&[])), None);
|
||||
assert_eq!(native_asked(env(&[("WOW_GLUE_NATIVE", "0")])), None);
|
||||
assert!(native_asked(env(&[("WOW_GLUE_NATIVE", "1")])).is_some());
|
||||
assert!(native_asked(env(&[("WOW_RIG", "60")])).is_some());
|
||||
assert!(native_asked(env(&[("WOW_PROBE_CHARCREATE", "Zz")])).is_some());
|
||||
assert!(native_asked(env(&[("WOW_CAPTURE", "glue-login")])).is_some());
|
||||
assert_eq!(native_asked(env(&[("WOW_CAPTURE", "water-noon")])), None);
|
||||
assert!(is_stock(None), "absent, the default holds");
|
||||
assert!(is_stock(Some(&GlueStock::default())));
|
||||
assert!(!is_stock(Some(&GlueStock(false))));
|
||||
}
|
||||
|
||||
/// The stock GlueXML loads into the glue VM, `FRAMES_LOADED` fires and the login screen goes
|
||||
/// up, and a few frames run: every screen's frame exists, and the only Lua errors are calls
|
||||
/// of the glue functions [`UNBUILT_CALLED`] names, each of which is still unbuilt and still
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
//! The glue manager, `CGlueMgr` host side, under `WOW_GLUE_STOCK=1`: the screen-state machine of
|
||||
//! The glue manager, `CGlueMgr` host side, under the stock glue screens: the screen-state machine of
|
||||
//! `CGlueMgr::Update` (`0x46b930`, `screenState` at `0xb41da0`) over the login engine. The IO
|
||||
//! thread's parks and [`crate::glue_session::login`]'s policy still do the network; this maps their
|
||||
//! messages onto the reference's screen states and fires the glue events the stock GlueXML answers:
|
||||
@@ -1815,7 +1815,7 @@ pub(crate) fn read_agreements(cvars: &crate::cvars::Cvars) -> [NoticeState; 4] {
|
||||
/// The glue manager's frame: the login engine's news, the per-frame arms, then the events into the
|
||||
/// glue VM and its slots seeded. The verbs ran in their own calls ([`GlueHost`]); what is left of
|
||||
/// them here is the effects they leave for the frame and the calls a VM made before it was seated.
|
||||
/// Runs under `WOW_GLUE_STOCK=1` only.
|
||||
/// Runs under the stock screens only.
|
||||
///
|
||||
/// No borrow of the manager is held across a call into the VM that can run a handler.
|
||||
#[allow(clippy::too_many_arguments)]
|
||||
|
||||
@@ -4194,7 +4194,6 @@ fn entry_app(refuse: bool) -> (App, fake::World) {
|
||||
// The roster the IO thread already published, as the session's edges took it.
|
||||
w.insert_resource(crate::glue_session::roster::Roster::with_chars(roster3()));
|
||||
w.init_resource::<crate::glue_session::roster::RunPick>();
|
||||
w.init_resource::<crate::glue::dialog::GlueDialog>();
|
||||
}
|
||||
app.add_plugins(bevy::state::app::StatesPlugin)
|
||||
.insert_state(ClientState::CharSelect)
|
||||
@@ -4384,6 +4383,40 @@ fn the_runs_own_stock_pick_goes_through_enter_world() {
|
||||
);
|
||||
}
|
||||
|
||||
/// The run's own selection (`WOW_CHARSELECT_PICK`) on the stock screens is the screen's own: once
|
||||
/// it has its roster, the row is selected as a click selects it, and the screen stays up.
|
||||
#[test]
|
||||
fn the_runs_own_stock_selection_selects_on_the_screen() {
|
||||
let _ = benilla_formats::wow_data_or_skip!();
|
||||
let _l = crate::local_state::test_env::ENV_LOCK
|
||||
.lock()
|
||||
.unwrap_or_else(std::sync::PoisonError::into_inner);
|
||||
let (_home, _guard) = addon_home("run-select");
|
||||
let (mut app, world) = entry_app(false);
|
||||
app.world_mut()
|
||||
.insert_resource(crate::glue_session::roster::RunPick::selecting(0x12));
|
||||
app.add_systems(
|
||||
Update,
|
||||
crate::glue_session::roster::enter_run_pick.after(drive_glue_mgr),
|
||||
);
|
||||
app.update();
|
||||
assert_eq!(
|
||||
vm(&app)
|
||||
.eval::<i64>("return CharacterSelect.selectedIndex")
|
||||
.unwrap(),
|
||||
2,
|
||||
"the armed row, Bravo"
|
||||
);
|
||||
for _ in 0..3 {
|
||||
app.update();
|
||||
}
|
||||
assert_ne!(mgr(&app).state, ScreenState::EnterWorld);
|
||||
assert_eq!(client_state(&app), ClientState::CharSelect);
|
||||
assert!(world
|
||||
.bodies(benilla_protocol::messages::opcode::CMSG_PLAYER_LOGIN)
|
||||
.is_empty());
|
||||
}
|
||||
|
||||
/// A refused login (vmangos's result 1) that lands once the client is in the world comes back to
|
||||
/// the stock select in state 9, on a glue rebuilt with the link and the server carried over: the
|
||||
/// screen's own list ask sends nothing (`0x46b880`), state 9's frame opens `OKAY` with
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
//! The UI session's lifecycle, all edges and nothing per-frame: `Startup` installs a boot VM
|
||||
//! (strings and emote tokens), or the stock glue screens' VM under `WOW_GLUE_STOCK=1`; world entry
|
||||
//! (strings and emote tokens) under the native screens, else the stock glue screens' VM; world entry
|
||||
//! builds a fresh VM and loads the in-game UI and every addon onto it; leaving the world runs the
|
||||
//! reference's shutdown tail and installs the glue-side VM again; `ReloadUI()` is the two edges
|
||||
//! back to back without leaving the world.
|
||||
@@ -25,9 +25,7 @@ pub(crate) fn setup_script(world: &mut World) {
|
||||
/// by [`new_vm`]) falls back to the park's own enumeration instead of waiting on a screen that
|
||||
/// never asks.
|
||||
pub(super) fn install_glue_side_vm(world: &mut World, screen: &str) {
|
||||
let stock_asked = world
|
||||
.get_resource::<super::glue::GlueStock>()
|
||||
.is_some_and(|s| s.0);
|
||||
let stock_asked = super::glue::is_stock(world.get_resource::<super::glue::GlueStock>());
|
||||
let stock_up = if stock_asked {
|
||||
install_glue_vm(world, screen)
|
||||
} else {
|
||||
@@ -35,7 +33,7 @@ pub(super) fn install_glue_side_vm(world: &mut World, screen: &str) {
|
||||
false
|
||||
};
|
||||
if stock_asked && !stock_up {
|
||||
error!("ui_script: WOW_GLUE_STOCK=1 but the stock glue VM did not come up with its character select screen; the roster is fetched at the park");
|
||||
error!("ui_script: the stock glue VM did not come up with its character select screen; the roster is fetched at the park");
|
||||
}
|
||||
if let Some(policy) = world.get_resource::<crate::net::RosterPolicy>() {
|
||||
policy
|
||||
@@ -1331,7 +1329,7 @@ mod tests {
|
||||
);
|
||||
}
|
||||
|
||||
/// Under `WOW_GLUE_STOCK=1` the world holds the glue VM where it holds a boot VM, at startup
|
||||
/// Under the stock screens the world holds the glue VM where it holds a boot VM, at startup
|
||||
/// on the login screen (`0x402b65`) and back from the world on the screen the exit enters
|
||||
/// (`0x402090`); a `ReloadUI()` never builds the glue.
|
||||
#[test]
|
||||
|
||||
@@ -16,7 +16,7 @@ use benilla_world::schedule::WorldStage;
|
||||
pub(crate) mod addons;
|
||||
mod content;
|
||||
pub(crate) mod extract;
|
||||
/// The stock glue screens behind `WOW_GLUE_STOCK=1`.
|
||||
/// The stock glue screens, and the switch to the native ones.
|
||||
pub(crate) mod glue;
|
||||
/// The stock create screen's catalog off the host's DBC catalogs.
|
||||
pub(crate) mod glue_create;
|
||||
|
||||
@@ -80,12 +80,26 @@ fn hermetic_addon(
|
||||
(tmp, capture, benilla_home)
|
||||
}
|
||||
|
||||
/// The world after `Startup` ([`super::setup_script`]): a boot VM, no frames.
|
||||
/// The world after `Startup` ([`super::setup_script`]): the stock glue VM at the login screen.
|
||||
fn booted_world() -> World {
|
||||
booted_world_on(None)
|
||||
}
|
||||
|
||||
/// The world after `Startup` under the native screens: a boot VM, no frames, standing at the
|
||||
/// character screen as no stock VM does (a `SetCVar`, a frame of in-game events). Goes with the
|
||||
/// native screens.
|
||||
fn native_booted_world() -> World {
|
||||
booted_world_on(Some(crate::ui_script::glue::GlueStock(false)))
|
||||
}
|
||||
|
||||
fn booted_world_on(switch: Option<crate::ui_script::glue::GlueStock>) -> World {
|
||||
let mut world = World::new();
|
||||
world.init_resource::<super::AddOnIdentity>();
|
||||
world.init_resource::<crate::minimap::MinimapZoom>();
|
||||
world.init_resource::<super::ReloadUiPending>();
|
||||
if let Some(switch) = switch {
|
||||
world.insert_resource(switch);
|
||||
}
|
||||
super::setup_script(&mut world);
|
||||
world
|
||||
}
|
||||
@@ -285,7 +299,7 @@ fn the_realm_cvars_are_read_only_to_lua_only_in_the_world() {
|
||||
.lock()
|
||||
.unwrap_or_else(std::sync::PoisonError::into_inner);
|
||||
let (tmp, _c, _h) = hermetic_probe("readonly");
|
||||
let mut world = booted_world();
|
||||
let mut world = native_booted_world();
|
||||
world.init_resource::<super::LeavingWorldArmed>();
|
||||
let set = |world: &World, chunk: &str| {
|
||||
let s = world.non_send_resource::<benilla_ui::script::UiScript>();
|
||||
@@ -331,7 +345,7 @@ fn a_shutdown_with_no_world_fires_logout_without_leaving_world() {
|
||||
.lock()
|
||||
.unwrap_or_else(std::sync::PoisonError::into_inner);
|
||||
let (tmp, _c, _h) = hermetic_probe("quitsplit");
|
||||
let mut world = booted_world();
|
||||
let mut world = native_booted_world();
|
||||
let script = world
|
||||
.remove_non_send_resource::<benilla_ui::script::UiScript>()
|
||||
.expect("a boot VM is live at the character screen");
|
||||
@@ -1121,6 +1135,8 @@ fn unit_feed_app() -> (App, crossbeam_channel::Receiver<crate::net::ClientComman
|
||||
app.init_resource::<crate::ui_guild::GuildState>();
|
||||
app.add_message::<crate::creature_anim::SwingImpact>();
|
||||
app.add_message::<crate::net::WorldEnterCascadeMessage>();
|
||||
// The boot VM, which takes the probe's in-game events before the entry load.
|
||||
app.insert_resource(crate::ui_script::glue::GlueStock(false));
|
||||
super::setup_script(app.world_mut());
|
||||
(app, rx)
|
||||
}
|
||||
|
||||
@@ -135,6 +135,9 @@ out of scope is closed with the reason.
|
||||
command and logs the reply as `net: server says`. An account named `probe` and digits is
|
||||
shielded: every world entry sends `.cheat god on`, `.die` clears it for a death test, and
|
||||
`WOW_GOD=off` leaves it off.
|
||||
- The glue screens are the stock GlueXML. `WOW_GLUE_NATIVE=1` puts up the native ones in a
|
||||
dev build until they are deleted; a rig, `WOW_PROBE_CHARCREATE` and a glue capture still drive
|
||||
them, so each puts them up on its own.
|
||||
- A trace is `WOW_MOVE_TRACE=<file>`, filtered with `WOW_MOVE_TRACE_TAGS` (`"move,snd,in"`) and
|
||||
ended by `WOW_PROBE_EXIT_AT=<seconds>`; grep it for the `rly` and `snd` lines.
|
||||
- To sniff the wire, trace the tags `in` and `out` (`WOW_MOVE_TRACE_TAGS="in,out"`): one line
|
||||
|
||||
+1
-1
@@ -426,7 +426,7 @@ Each entry is the first sentence of a `Deviation:` comment, linking to where it
|
||||
- The reference writes none (its file opens with a blank line); ours names the file, because players open this folder. ([`src/ui_script/addons.rs:752`](../crates/benilla-app/src/ui_script/addons.rs#L752))
|
||||
- The reference then re-reads the aspect (`0x492f13`), and on a change of 0.001 or more calls `0x491380`, which sets the reload trigger (`[0xb4b3f4]`) when the script-context check `0x494a50(0xa)` allows it; here a resize re-lays out the live UI, the chat bubbles' window-derived `BubbleGeometry` with it, because the window resizes freely and a reload on each resize would tear down every addon's state mid-play. ([`src/ui_script/extract/mod.rs:522`](../crates/benilla-app/src/ui_script/extract/mod.rs#L522))
|
||||
- The V-plate border is resampled sharp to the quad's physical size rather than GPU-magnified, so its 1 px bevel stays crisp; keyed by that size, so only a resize re-rasterises it. ([`src/ui_script/extract/mod.rs:1390`](../crates/benilla-app/src/ui_script/extract/mod.rs#L1390))
|
||||
- No signature or digest check (`0x46a90b`, `0x46a9d3`, `0x401560(9)`), so the chain's toc always loads and `FRAMES_LOADED` follows, because the check verifies Blizzard's signature with a key carried in the client binary, which benilla does not ship, and a modified interface file is loaded rather than refused. ([`src/ui_script/glue.rs:16`](../crates/benilla-app/src/ui_script/glue.rs#L16))
|
||||
- No signature or digest check (`0x46a90b`, `0x46a9d3`, `0x401560(9)`), so the chain's toc always loads and `FRAMES_LOADED` follows, because the check verifies Blizzard's signature with a key carried in the client binary, which benilla does not ship, and a modified interface file is loaded rather than refused. ([`src/ui_script/glue.rs:17`](../crates/benilla-app/src/ui_script/glue.rs#L17))
|
||||
- The reference's handler completes whichever operation is current; here only the character list's does, in state 3, and a reply of another cause (a roster nothing of the screen asked for) or of another link (before a realm change) completes nothing. ([`src/ui_script/glue_mgr.rs:1386`](../crates/benilla-app/src/ui_script/glue_mgr.rs#L1386))
|
||||
- The files are under `benilla-config/Logs/`, since the install is read-only. ([`src/ui_script/load_log.rs:5`](../crates/benilla-app/src/ui_script/load_log.rs#L5))
|
||||
- `FULLSCREEN_QUADS_RESEAT` re-sizes the full-screen quads, which the stock files size only in their OnLoads, because a resize here keeps the loaded UI and the blackout would stop short of the new screen. ([`src/ui_script/manifest.rs:64`](../crates/benilla-app/src/ui_script/manifest.rs#L64))
|
||||
|
||||
+14
-15
@@ -178,7 +178,7 @@
|
||||
- `WOW_BOOTH_LOG` — benilla-app/src/portrait/mod.rs
|
||||
- `WOW_CAM_CHANGED` — benilla-app/src/perf/mod.rs
|
||||
- `WOW_CAM_DUMP` — benilla-app/src/player/camera.rs
|
||||
- `WOW_CAPTURE` — benilla-app/src/capture/mod.rs, benilla-app/src/capture/scenarios.rs, benilla-app/src/char_select/addons.rs, benilla-app/src/cvars/mod.rs, benilla-app/src/glue_session/login.rs, benilla-app/src/lib.rs, benilla-app/src/local_state.rs, benilla-app/src/name_persist.rs, benilla-app/src/net.rs, benilla-app/src/player/camera_saved.rs, benilla-app/src/run_mode.rs, benilla-app/src/sound/mod.rs, benilla-app/src/ui_chat/settings.rs, benilla-app/src/ui_chat/tests.rs, benilla-app/src/ui_macro/tests.rs, benilla-app/src/ui_saved.rs, benilla-app/src/ui_script/addons.rs, benilla-app/src/ui_script/layer_tests.rs, benilla-app/src/ui_script/mod.rs, benilla-app/src/ui_script/world_entry_tests.rs, benilla-app/src/video.rs, benilla-world/src/bgwin.rs, benilla-world/src/clouds/mod.rs, benilla-world/src/dev_state.rs
|
||||
- `WOW_CAPTURE` — benilla-app/src/capture/mod.rs, benilla-app/src/capture/scenarios.rs, benilla-app/src/char_select/addons.rs, benilla-app/src/cvars/mod.rs, benilla-app/src/glue_session/login.rs, benilla-app/src/lib.rs, benilla-app/src/local_state.rs, benilla-app/src/name_persist.rs, benilla-app/src/net.rs, benilla-app/src/player/camera_saved.rs, benilla-app/src/run_mode.rs, benilla-app/src/sound/mod.rs, benilla-app/src/ui_chat/settings.rs, benilla-app/src/ui_chat/tests.rs, benilla-app/src/ui_macro/tests.rs, benilla-app/src/ui_saved.rs, benilla-app/src/ui_script/addons.rs, benilla-app/src/ui_script/glue.rs, benilla-app/src/ui_script/layer_tests.rs, benilla-app/src/ui_script/mod.rs, benilla-app/src/ui_script/world_entry_tests.rs, benilla-app/src/video.rs, benilla-world/src/bgwin.rs, benilla-world/src/clouds/mod.rs, benilla-world/src/dev_state.rs
|
||||
- `WOW_CAPTURE_AGE` — benilla-app/src/capture/mod.rs
|
||||
- `WOW_CAPTURE_DEADLINE` — benilla-app/src/capture/mod.rs
|
||||
- `WOW_CAPTURE_OUT` — benilla-app/src/capture/mod.rs
|
||||
@@ -187,18 +187,17 @@
|
||||
- `WOW_CAPTURE_UI` — benilla-app/src/capture/scenarios.rs, benilla-app/src/ui_script/mod.rs, benilla-app/src/video.rs
|
||||
- `WOW_CAST_TRACE` — benilla-app/src/net.rs
|
||||
- `WOW_CHAR` — benilla-app/src/capture/probe_mail.rs, benilla-app/src/cvars/mod.rs, benilla-app/src/glue_session/login.rs, benilla-app/src/glue_session/realm_smoke.rs, benilla-app/src/glue_session/roster.rs, benilla-app/src/net.rs, benilla-app/src/run_mode.rs
|
||||
- `WOW_CHARCREATE_DIALS` — benilla-app/src/char_create/mod.rs
|
||||
- `WOW_CHARCREATE_NAME` — benilla-app/src/char_create/mod.rs
|
||||
- `WOW_CHARCREATE_PICK` — benilla-app/src/capture/mod.rs, benilla-app/src/char_create/mod.rs
|
||||
- `WOW_CHARCREATE_SHOT` — benilla-app/src/char_create/mod.rs, benilla-world/src/bgwin.rs
|
||||
- `WOW_CHARCREATE_SHOT_OUT` — benilla-app/src/char_create/mod.rs
|
||||
- `WOW_CHARSELECT_ADDONS` — benilla-app/src/char_select/mod.rs
|
||||
- `WOW_CHARSELECT_DIALOG` — benilla-app/src/char_select/mod.rs
|
||||
- `WOW_CHARCREATE_DIALS` — benilla-app/src/char_create/mod.rs, benilla-app/src/ui_script/glue.rs
|
||||
- `WOW_CHARCREATE_NAME` — benilla-app/src/char_create/mod.rs, benilla-app/src/ui_script/glue.rs
|
||||
- `WOW_CHARCREATE_PICK` — benilla-app/src/capture/mod.rs, benilla-app/src/char_create/mod.rs, benilla-app/src/ui_script/glue.rs
|
||||
- `WOW_CHARCREATE_SHOT` — benilla-app/src/char_create/mod.rs, benilla-app/src/ui_script/glue.rs, benilla-world/src/bgwin.rs
|
||||
- `WOW_CHARCREATE_SHOT_OUT` — benilla-app/src/char_create/mod.rs, benilla-app/src/ui_script/glue.rs
|
||||
- `WOW_CHARSELECT_ADDONS` — benilla-app/src/char_select/mod.rs, benilla-app/src/ui_script/glue.rs
|
||||
- `WOW_CHARSELECT_DIALOG` — benilla-app/src/char_select/mod.rs, benilla-app/src/ui_script/glue.rs
|
||||
- `WOW_CHARSELECT_PICK` — benilla-app/src/cvars/mod.rs, benilla-app/src/glue_session/roster.rs
|
||||
- `WOW_CHARSELECT_SHOT` — benilla-world/src/bgwin.rs
|
||||
- `WOW_CHARSELECT_SHOT_AT` — benilla-app/src/char_select/mod.rs
|
||||
- `WOW_CHARSELECT_SHOT_OUT` — benilla-app/src/char_select/mod.rs
|
||||
- `WOW_CHARSELECT_WALK` — benilla-app/src/char_select/mod.rs
|
||||
- `WOW_CHARSELECT_SHOT_AT` — benilla-app/src/char_select/mod.rs, benilla-app/src/ui_script/glue.rs
|
||||
- `WOW_CHARSELECT_SHOT_OUT` — benilla-app/src/char_select/mod.rs, benilla-app/src/ui_script/glue.rs
|
||||
- `WOW_CLAMP_COST` — benilla-app/src/net/motion/spline.rs
|
||||
- `WOW_CLAMP_SEAT` — benilla-app/src/net/motion/spline.rs
|
||||
- `WOW_CLAMP_TRACE` — benilla-app/src/net/motion/spline.rs
|
||||
@@ -266,8 +265,8 @@
|
||||
- `WOW_FX_UP` — benilla-app/src/capture/mod.rs
|
||||
- `WOW_FX_YAW` — benilla-app/src/capture/mod.rs
|
||||
- `WOW_GHOST_PROBE` — benilla-app/src/death/mod.rs
|
||||
- `WOW_GLUE_NATIVE` — benilla-app/src/ui_script/glue.rs
|
||||
- `WOW_GLUE_ROUNDTRIP` — benilla-app/src/glue_session/roundtrip.rs, benilla-world/src/bgwin.rs
|
||||
- `WOW_GLUE_STOCK` — benilla-app/src/ui_script/glue.rs
|
||||
- `WOW_GLYPH_CACHE` — benilla-app/src/ui_text/engine/gpu.rs
|
||||
- `WOW_GM` — benilla-app/src/probe_shield.rs
|
||||
- `WOW_GOD` — benilla-app/src/preflight.rs, benilla-app/src/probe_shield.rs
|
||||
@@ -308,7 +307,7 @@
|
||||
- `WOW_LIVE_SHOT_EVERY` — benilla-app/src/capture/live_shot.rs
|
||||
- `WOW_LOGIN_SHOT` — benilla-world/src/bgwin.rs
|
||||
- `WOW_LOGIN_SHOT_OUT` — benilla-app/src/glue_session/login.rs
|
||||
- `WOW_LOGIN_SMOKE` — benilla-app/src/glue_session/login.rs, benilla-app/src/glue_session/roster.rs, benilla-app/src/login/smoke.rs, benilla-world/src/bgwin.rs
|
||||
- `WOW_LOGIN_SMOKE` — benilla-app/src/glue_session/login.rs, benilla-app/src/glue_session/roster.rs, benilla-app/src/login/smoke.rs, benilla-app/src/ui_script/glue.rs, benilla-world/src/bgwin.rs
|
||||
- `WOW_LOGIN_SMOKE_HOLD` — benilla-app/src/login/smoke.rs
|
||||
- `WOW_LOGOUT_SMOKE` — benilla-app/src/glue_session/logout_smoke.rs, benilla-world/src/bgwin.rs
|
||||
- `WOW_MAP` — benilla-app/src/capture/mod.rs, benilla-world/src/world_map.rs
|
||||
@@ -405,7 +404,7 @@
|
||||
- `WOW_PROBE_BINDER` — benilla-app/src/dev.rs
|
||||
- `WOW_PROBE_BOOK` — benilla-app/src/dev.rs
|
||||
- `WOW_PROBE_CAM` — benilla-app/src/capture/probe_cam.rs
|
||||
- `WOW_PROBE_CHARCREATE` — benilla-app/src/capture/probe_charcreate.rs, benilla-app/src/dev.rs
|
||||
- `WOW_PROBE_CHARCREATE` — benilla-app/src/capture/probe_charcreate.rs, benilla-app/src/dev.rs, benilla-app/src/ui_script/glue.rs
|
||||
- `WOW_PROBE_CHARCREATE_KEEP` — benilla-app/src/capture/probe_charcreate.rs
|
||||
- `WOW_PROBE_CHARTER` — benilla-app/src/dev.rs
|
||||
- `WOW_PROBE_CHAT` — benilla-app/src/capture/probes/act.rs, benilla-app/src/dev.rs
|
||||
@@ -458,7 +457,7 @@
|
||||
- `WOW_RES_CENSUS` — benilla-app/src/perf/census.rs
|
||||
- `WOW_RESIZE` — benilla-app/src/capture/mod.rs
|
||||
- `WOW_REVEAL` — benilla-app/src/capture/probes/reveal.rs, benilla-app/src/dev.rs
|
||||
- `WOW_RIG` — benilla-app/src/capture/mod.rs, benilla-app/src/capture/probe_rig.rs, benilla-app/src/dev.rs, benilla-app/src/glue_session/login.rs, benilla-app/src/glue_session/realm_smoke.rs, benilla-app/src/local_state.rs, benilla-app/src/net.rs, benilla-app/src/probe_shield.rs, benilla-app/src/run_mode.rs, benilla-world/src/bgwin.rs
|
||||
- `WOW_RIG` — benilla-app/src/capture/probe_rig.rs, benilla-app/src/dev.rs, benilla-app/src/glue_session/login.rs, benilla-app/src/glue_session/realm_smoke.rs, benilla-app/src/local_state.rs, benilla-app/src/net.rs, benilla-app/src/probe_shield.rs, benilla-app/src/run_mode.rs, benilla-app/src/ui_script/glue.rs, benilla-world/src/bgwin.rs
|
||||
- `WOW_RIG_CENSUS` — benilla-world/src/rig_palette.rs
|
||||
- `WOW_RIG_COST` — benilla-world/src/rig_palette.rs
|
||||
- `WOW_RIG_SKIN` — benilla-assets/src/materials.rs
|
||||
|
||||
+11
-7
@@ -136,20 +136,24 @@ panics="$(printf '%s\n' "$plain" | grep -cE 'panicked at')"
|
||||
|
||||
# A marker counts once per edge it fires on. Each world entry builds a world VM beside the
|
||||
# character screen's glue VM (the reference's `0x490bd0`/`0x48fbf0` pair), so the VM marker counts
|
||||
# twice per login; half that means an entry adopted the glue VM and its spent `VmMemo`s.
|
||||
sessions=2 # world entries in this walk
|
||||
vms=$((sessions * 2)) # …and the Lua states they cost: a glue VM and a world VM each
|
||||
# twice per login; half that means an entry adopted the glue VM and its spent `VmMemo`s. One more
|
||||
# is built once at startup: the boot strings beside the glue VM, read for the slash-command table
|
||||
# (`ui_chat::commands::build_slash_commands`).
|
||||
sessions=2 # world entries in this walk
|
||||
vms=$((sessions * 2 + 1)) # …and the Lua states they cost: a glue VM and a world VM each
|
||||
for marker in "new VM, session"; do
|
||||
n="$(printf '%s\n' "$plain" | grep -cF "$marker")"
|
||||
printf ' %-24s %s\n' "$marker" "$n"
|
||||
[ "$n" -eq "$vms" ] ||
|
||||
fail "'$marker' happened $n time(s), expected $vms — one per VM built, two per login; \
|
||||
$sessions would mean the entry adopted the character screen's VM and inherited its spent VmMemos"
|
||||
fail "'$marker' happened $n time(s), expected $vms — one per VM built, two per login and \
|
||||
the startup strings; $((sessions + 1)) would mean the entry adopted the character screen's VM and \
|
||||
inherited its spent VmMemos"
|
||||
done
|
||||
# The in-game UI, `FrameXML.toc`'s `Fonts.xml` included, and the key-binding commands (the core's
|
||||
# `Bindings.xml`, loaded after the toc) build once per login; one count for two logins means the
|
||||
# second reused the first's frame tree.
|
||||
for marker in "Fonts.xml loaded" "UIParent.xml loaded" "commands registered"; do
|
||||
# second reused the first's frame tree. The `Fonts.xml` marker names its folder: the glue's
|
||||
# `GlueFonts.xml` ends the same way.
|
||||
for marker in 'FrameXML\Fonts.xml loaded' "UIParent.xml loaded" "commands registered"; do
|
||||
n="$(printf '%s\n' "$plain" | grep -cF "$marker")"
|
||||
printf ' %-24s %s\n' "$marker" "$n"
|
||||
[ "$n" -eq "$sessions" ] ||
|
||||
|
||||
Reference in New Issue
Block a user