Click to start
CLICK TO START
Inside the executables ↓

Two executables and a joypad

miChera ships as two Xbox programs. cracktro.xbe (title “Kaleido Demoplayer”) is a 25-second C64-style intro: a Rob Hubbard SID tune, a bitmap-font scroller and a wave of “LOADING DEMO” copies. When it is done it reboots into demoplayer.xbe. That is the same “pompom” engine as Harry Boterham and Bi-Won: embedded Python 2.2 running d:\demos\demo\pompom.py against a library of C++ effect classes.

What is new is where the timing comes from. Bi-Won hangs its effects on instruments in a tracker module. miChera's script has every addMapping line commented out. Instead the engine replays recorded_events, a performance on the joypad recorded against the music: A and B flash the tunnel and grow ribbons, X cuts the camera, and the left trigger is held down like a dimmer.

Linked
28 Aug 2004
Xbox SDK
XDK 5849
Show length
3:56
Recorded events
4,513

The show, end to end

  1. Cracktrocracktro.xbe starts a native render thread (0x198b0) and loads the SID in it. The main thread calls Sleep(25000).
  2. RelaunchThe main thread then calls XLaunchNewImage("d:\demoplayer.xbe") (0x4e420). About a second of black while the Xbox reboots.
  3. Loadingdemoplayer.xbe shows data\demoplayer\loading.jpg while Python starts and the scenes decompress.
  4. pompom.pyThe scheduler runs 203.5 seconds of jobs: logo, title, overlays, then the butterfly finale through a blur.
  5. FadeThere is no end screen. The recorded left trigger is held at full from 200 s and dims every mesh to black.

The code after XLaunchNewImage in the cracktro still loads recorded_events, preloads the demo and draws “PRESS BACK TO START DEMO”. It never runs, because XLaunchNewImage does not return. The cracktro was built from the demoplayer source tree (its debug path is d:\newcode2\Copy (2) of trunk\…), and that leftover code shows it.

Where the bytes go

Both executables were linked on 28 August 2004, 58 minutes apart, with the same XDK 5849 libraries. The cracktro has 65 KB more code than the demoplayer, for its render thread, the SID player and the font renderer. It also has a $$XTIMAGE section that holds the dashboard tile. Everything else is the same set of Microsoft libraries.

Sectiondemoplayer.xbecracktro.xbeWhat it is
.text1,442,4601,507,772engine, Python 2.2, effect classes; cracktro adds its thread and the SID player
.data (on disk)168,008228,472initialised data
.rdata171,948179,124constants, strings, SWIG tables
DSOUND D3D D3DX XGRPH573,160573,144XDK sound and graphics
WMADEC XMV XPP DOLBY339,184339,184XDK codecs (WMA plays beginn.wma)
$$XTIMAGE–67,584dashboard tile, the red “KALEIDO” K
file2,736,1282,936,832

Sizes in bytes, raw size on disk. .XTLID (4,496 bytes each) is left out. The demoplayer's debug path is d:\newcode2\trunk\demoplayer\scripts\Release\demoplayer.exe. The release files are dated December 2005, sixteen months after the link timestamps. script/demoscript.py, the SWIG wrapper that lists the C++ classes Python can see, is the same as Bi-Won's, line for line.

The cracktro

The cracktro runs its own loop and uses no Python. It clears to (0.3, 0.3, 0.4) and steps a clock by 0.035 every 50 Hz frame. It draws with PixelClassic.pck, a 512×512 bitmap font. The layout code is at 0x5d570.

  • Scroller. The text is “HELLOS LIMP NINJA FANS! YOU ARE WATCHING A _REALTIME_ CRACKTRO…”, at scale 0.06. With T = 1.4t, it sits at x = 2.5 − T + 0.5 sin T: it moves right to left, and the sine makes it surge and stall. A copy in 60% black at (+0.05, −0.05) is its shadow.
  • LOADING DEMO. Eleven copies sit at x = 2i − 1 and y = 0.7 sin(2.7i + 1.1232t). Copies with a positive cosine go into the font renderer that is flushed last, so half the wave passes in front of the scroller and half behind it.
  • Music. rob_hubbard-commando.sid is a PSID of Commando (Rob Hubbard, 1985 Elite) with init at $5000 and play at $5012, ticked at 50 Hz. Browsers can't play SID, so tools/sid.py runs the 6502 player and a simple 6581 model offline and writes cracktro.mp3. Its waveform matches the capture's audio at a constant offset (correlation 0.76–0.82), so the Xbox plays it at exactly 50 Hz.
  • Font format. u32 PNG length and the PNG atlas, then the size×256, then 256 entries: present flag, x0 y0 x1 y1, x and y offset, and an advance. The advance is stored even for missing glyphs. Kerning triples follow, up to −1; PixelClassic has none.
Dashboard tile: a red pixel K on grey with the word KALEIDO
The $$XTIMAGE tile, 128×128, which the dashboard shows for “Kaleido Demoplayer”. The demoplayer has no tile.

No sync track: a recorded joypad

In Bi-Won the engine fires an event whenever a mapped instrument plays a note. miChera plays WMA, which has no notes, so the events had to come from somewhere else. demos/demo/recorded_events (129,790 bytes) is a list of serialised pompom::Event records. Each one is f32 time, i32 channel, i32 state (0 down, 2 analog value, 1 up), f32 value, f32 1.0, i32 button and a length-prefixed name. The file is grouped by button rather than sorted by time. The names are the ones the mappings had while it was recorded, which is why pompom.py can listen for "donker1" with no mapping in place.

ButtonNamePressesWhenWhat the script does
Alogo12.97 sstarts the “limp ninja” logo scrolling
XbutX116.48 scuts from Camera02 to Camera01, restarts the scene clock, shows the title
Adonker16718.5–189.9 sflashes Torus01 black; after 156 s also blurs the finale
Bdonker26421.4–183.8 sflashes Torus02 black
Bcurves29364.5–188.7 sgrows the black ribbons Line01–05
Acurves130132.0–188.7 sgrows the blue additive ribbons BLine06–09
left trigger–110–203.5 sanalog: every mesh colour target becomes 1 − value
right trigger, X, Y, B–15recorded but unused

The same two buttons appear under several names, and the presses overlap in time. The file looks like several passes, each recorded with its own mapping, merged into one. The trigger is the only analog control the script reads, through getEvent(EC_NOTE_CONTROL, 0, 6, event). The code around it carries two Dutch comments. One says it worked a moment ago. The other says the author will eat their shoe if it works. It does work. The dimming as the tunnel first appears, the blackout at 160–167 s, the long fade from 185 s and the final blackout are all the trigger.

Swept against onsets in the music, the presses land best about 0.4 s after a beat, which is a human reaction time. The recording was played in by hand, not quantised.

How a frame is made

The script schedules one 3D scene in the SI_A slot (apending, 3–203.5 s) and four jobs in SI_SUPER. There is no SI_POST job. The scheduler (around 0x5c742) chains slots through their in inputs. It walks each node's in connections and plugs the previous slot's output into the first free one; “Input `in` already in use” is its error message. That wiring decides the look of the finale:

CustomOver, a ripple and a second blur are built and never scheduled. pompom.py.bak is the same script loading raimo.lzma instead of ding.lzma.

Ribbons from splines

The new engine feature is the curve mesh. The 3ds Max exporter writes each spline as a degenerate strip: every vertex twice, with opposite normals, and an arc-length parameter from 0 to 1 in a third vertex stream (TRIS flag 4). The vertex shader (MSHD flag 0x200) pushes each copy sideways along normalize(view × N), so the strip opens into a camera-facing ribbon. Its half-width at arc length s is

clamp((length − s) / taper, 0, 1) · width · (1 + bumpAmplitude · sin(bumpFreq · (length − s)))

The five terms are llObject sliders: curveTaper, curveLength, curveWidth, curveBumpAmplitude and curveBumpFreq. Their defaults are 0.2, 0, 1, 0 and 0 (constructor 0x152fb0). A ribbon of length 0 is invisible, so all ten are hidden until the script calls them. On a curves press a ribbon springs to a random length (mode 2, damping 0.4) and stays there until the next press, steps its width to 2–4, and starts rippling with frequency 5 and amplitude 0.6. These sliders tick while their constants are uploaded, once per drawn part (0x6b0b1–0x6b1e3), the same as the colour sliders.

The opaque ribbons are black because their material has zero diffuse. The Cg compiler folded it into a multiply by a register holding 0 (mul r0.x, r0.y, r4.y).

The two scenes, up close

The two .lzma files are 3ds Max exports, drawn here with the demo's own shaders and draw order but with a camera you control. Drag to orbit, scroll or pinch to zoom, double-click to reframe. Pick one of the scene's cameras to see what the demo sees. Ribbons draws every spline at full length. Untick it to see the scene as the engine loads it, with the splines invisible.

Drag to orbit · scroll to zoom
0.00 s

Checked against a capture of the original

The video capture (640×480, 25 fps, 4:08) shows the whole show from the dashboard launch to a black screen. Each pair below is the capture on the left and this reconstruction on the right at the same moment. The reconstruction is aligned to two points in the capture: the cracktro's first frame (2.66 s) and demo time 0 (32.56 s).

Six pairs of frames, capture left and reconstruction right: cracktro scroller, logo scroller, title, ribbons in the tunnel, butterfly over the blurred tunnel, finale
Cracktro at 9.3 s; demo at 10, 25, 110, 158 and 175 s. Ribbon lengths and widths are random (frand), and the original random sequence can't be recovered, so the ribbons differ in detail. The camera, scheduling, fades and blur follow the capture.
CracktroFirst frame at 2.66 s, SID audio from 3.13 s, last frame at 27.6 s: the 25 s Sleep. The scroller enters 0.80 s after the first frame, which confirms 0.035 per frame at 50 Hz.
RelaunchBlack 27.75–28.7 s, then loading.jpg until the demo's first frame.
Demo clockt = 0 at 32.56 s. The tunnel appears at 35.54 s (t = 3), and the camera cuts to the title at 49.08 s (t = 16.5). The WMA starts at 33.10 s by cross-correlation.
Frame rateThe logo moves 0.0085 per frame and crosses the capture at 132.5 px/s, about 48.7 frames/s. That is a PAL 50 Hz loop that drops the odd frame. The reconstruction steps at exactly 50 Hz.
Audio lagBoth programs sound about 0.47 s behind their picture in the capture, by the same amount. That points at the capture chain rather than the code, so the reconstruction starts sound and picture together.
The endThe trigger's fade is black by about 232.7 s (t ≈ 200). end.png (“the end, made with pompom”) is in the data folder but is never shown.

Odds and ends

  • Unused files. tune.XM (a MadTracker 2 module), CYBERNOI.DAT (an Amiga PowerPacker PP20 file), font.pck (byte-identical to systemfont.pck), end.png, overlay1–3 and 5–8, limp_ninja.png (the script loads the TGA), and tietenpoepdrol.png, a 512×384 credits card with four names and Dutch one-liners.
  • The 16.5 s boundary. The engine counts a job as active while start ≤ t ≤ end, and only the first active job of a slot is drawn. With exact 50 Hz frame times the X press falls in the frame where the logo job is still active, and the title would never appear. The original clock is a float and evidently missed the exact value. The reconstruction treats a job's end as exclusive.
  • Colour sliders. Each mesh's red/green/blue sliders ease towards their target and relax back to 1 (fpd 0.999). A press of A or B therefore flashes a torus black, and it recovers over about a second.
  • ding.lzma's textures were exported from I:\evoke\butterflytexture.jpg.
  • Seeded randomness. frand is replaced by an MSVC-style LCG with a fixed seed, so the reconstruction is the same on every run and can seek.

Method

Static analysis only. The XBEs were parsed with tools/xbeinfo.py and disassembled with Capstone. Behaviour was read from the code: FixedSlider update 0x65b30, ImageSeq, Scene render, the scheduler, the curve-constant upload, and the cracktro thread. The Python side is a line-by-line port of pompom.py and lib/util.py (js/sim.js). The scene format, shaders and fonts were decoded from the files (js/scene.js, js/sceneshader.js). Timings come from frame-by-frame measurement and audio cross-correlation against the capture.

Keys: space pause, ←/→ 5 s, D skip to the demo, R restart, L 640×480. URL options: ?skip starts at the demo, ?t= freezes at a demo time, ?show= at a show time, ?seed= changes the random seed.