Reintroduce apps/arcade and the ten game crates that were ripped out of
the fork (assets, audio, blocks, coedit, gen, net, pkg, render, script,
session), from makepad-internal/dev. Reconcile against the fork's layout:
- makepad-game-sim/math come from the fork's existing libs/sim + sim/math;
the copied internal libs/game/{sim,math} are dropped and the kept game
crates plus arcade point at ../../sim and ../../sim/math.
- arcade AI is rewritten off the removed makepad-ai agent API onto the
makepad-ai-hub headless ChatProvider worker (example/cad pattern):
AiWorker{send,cancel,poll}, ai_worker_loop driving
ClaudeApiChatProvider(ClaudeCli), AiWorkerEvent availability/delta/
done/error mapped into the chat feed and authoring land_edit, with
main.rs send_message/cancel_request/event-drain rebuilt around it.
- the game-script sandbox is adapted to the fork's jailed splash storage:
every isolate gets mod.fs = splash_storage jail; splaes splash_storage
set_root_for_heap is now public so the ScriptHost (or Splash) can grant
a per-game jail root. ENT font: build.rs/dispatch.rs entities fill new
fork sim Entity/Part fields via ..Default::default(); world_raycast now
borrows mutably and returns the material id.
cargo check -p makepad-arcade and the game + arcade test suites pass.
33 lines
1.4 KiB
Rust
33 lines
1.4 KiB
Rust
//! Decode cost and memory across a pack, for the Quest budget.
|
|
use makepad_game_audio as audio;
|
|
use std::time::Instant;
|
|
fn main() {
|
|
let a: Vec<String> = std::env::args().collect();
|
|
let files = walk(&a[1]);
|
|
let (mut n, mut bin, mut pcm, mut fr) = (0usize, 0usize, 0usize, 0usize);
|
|
let t0 = Instant::now();
|
|
let mut worst = (0f64, String::new());
|
|
for f in &files {
|
|
let Ok(b) = std::fs::read(f) else { continue };
|
|
let t = Instant::now();
|
|
let Ok(p) = audio::decode(&b) else { continue };
|
|
let ms = t.elapsed().as_secs_f64() * 1000.0;
|
|
if ms > worst.0 { worst = (ms, f.rsplit('/').next().unwrap_or(f).to_string()); }
|
|
n += 1; bin += b.len(); pcm += p.samples.len() * 4; fr += p.frames();
|
|
}
|
|
let total = t0.elapsed().as_secs_f64() * 1000.0;
|
|
println!("decoded {n} files in {total:.0} ms ({:.2} ms/file avg)", total / n.max(1) as f64);
|
|
println!("slowest {:.2} ms {}", worst.0, worst.1);
|
|
println!("compressed {:.1} MB -> f32 PCM {:.1} MB ({fr} frames)",
|
|
bin as f64 / 1048576.0, pcm as f64 / 1048576.0);
|
|
}
|
|
fn walk(dir: &str) -> Vec<String> {
|
|
let mut out = Vec::new();
|
|
let Ok(rd) = std::fs::read_dir(dir) else { return out };
|
|
for e in rd.flatten() {
|
|
let p = e.path();
|
|
if p.is_dir() { out.extend(walk(&p.to_string_lossy())) }
|
|
else if p.extension().map(|x| x == "ogg").unwrap_or(false) { out.push(p.to_string_lossy().into_owned()) }
|
|
}
|
|
out
|
|
}
|