Introducing a new way to review your PRs.

Read the announcement

crmne / spotifast

Spotify, native and fast. One lightweight Rust app for your whole library, local playback, and Spotify Connect on Linux, macOS, and Windows.

View on GitHub

19 documents · Updated Nov 18, 2026

docs / skin-engine-and-winamp-compatibility

Skin engine and Winamp compatibility

The skin engine lets the mini player wear classic Winamp skins and Windows Media Player skins while keeping playback, playlists, equalizer controls, and visualizations connected to Spotifast. It turns skin files into a common appearance and interaction model, then keeps slow file work, picture decoding, script execution, and preview generation away from the main UI path.

Appearance system

The skin system has two related paths. Classic Winamp skins provide fixed bitmap art and configuration files. Windows Media Player skins provide views, pictures, and scripts that describe a small interactive application. Both paths end in the same mini-player experience and share skin selection, scaling, previews, and player-facing actions.

The broader skins and visualizations page explains where skins fit in the product. The MilkDrop visualization runtime page covers the separate visualization engine that can appear inside a skin.

flowchart LR
    A[Skin archive or folder] --> B[Identify skin family]
    B --> C[Load appearance data]
    C --> D{Skin family}
    D --> E[Classic Winamp layout and sprites]
    D --> F[WMP views, pictures, and scripts]
    E --> G[Mini player windows]
    F --> G
    C --> H[Settings skin card preview]
    G <--> I[Playback, queue, equalizer, and visualization state]

Skin discovery and selection

The skin catalog is the bridge between files on disk and the skin choice stored in settings. It lists supported archives and unpacked skin folders, sorts them for display, identifies whether each item is Winamp or Windows Media Player format, and adds the built-in and shipped skins to the same catalog.

The supported archive names are .wsz, .wmz, and .zip. A zip file is classified from its contents rather than its extension. An unpacked folder is accepted when the engine finds the expected skin files within its bounded search depth. Dropping a supported archive on the player installs it into the skin folder before the normal load path uses it.

Selecting a card starts an asynchronous load. The active skin replaces the current appearance only after the load result is ready. Skin-specific WMP preferences are kept beside the skin files so panel state can return when that skin is used again.

References: src/winamp.rs• L33-90 src/winamp.rs• L348-417 src/winamp.rs• L419-568 src/…/mod.rs• L117-216

Classic Winamp skin model

The classic path reproduces the fixed Winamp 2 window model. A skin supplies bitmap sheets for the main player, title bar, controls, sliders, digits, text, playlist, equalizer, and generic windows. Shared layout rules place those pieces into the main player and its attached windows.

Missing sheets do not make the whole skin unusable. The engine uses compatible substitutes where Winamp did, then uses the built-in skin for other gaps. Short sheets are drawn only where pixels exist. This keeps older or incomplete skins usable while preserving their supplied art.

References: src/…/mod.rs• L218-365 src/…/layout.rs• L30-167 src/…/sprites.rs• L7-89 src/…/mod.rs• L142-209

Skin configuration and window shape

Classic configuration files adjust the parts that bitmap sheets cannot express. pledit.txt sets playlist colors and font metadata. viscolor.txt supplies the visualizer palette. region.txt describes non-rectangular window shapes, so transparent corners remain outside the window and do not receive clicks.

These settings affect both the main classic player and its related surfaces. Playlist colors also theme menus, while visualizer colors are used when the classic display or a skin-hosted visualizer needs a fallback rendering.

References: src/…/config.rs• L89-103 src/…/config.rs• L167-228 src/…/config.rs• L244-285 src/…/mod.rs• L350-457

Skin fonts and text rendering

Classic skins carry a small bitmap font for the short labels and displays that define the Winamp look. The font uses a limited character set, folds lower-case and many accented Latin characters into available shapes, and uses a question-mark shape for characters it cannot represent.

Longer playlist text uses a pixel-aligned system face with fallbacks. This keeps the playlist readable when a skin font cannot cover a script, and it lets the marquee switch to the same borrowed face instead of showing a string of replacement marks. Text remains aligned to the skin scale rather than adopting the normal application text scale.

References: src/…/font.rs• L1-88 src/system_fonts.rs• L12-55 src/…/pixel_text.rs• L19-43 src/…/mod.rs• L1277-1375

Windows Media Player skin engine

The WMP path treats a skin as a view definition plus a set of pictures and scripts. The definition describes views and elements such as buttons, sliders, text, lists, effects, and video areas. Scripts can move or fade elements, switch views, open panels, respond to input, and save skin preferences.

The engine exposes a limited player model to scripts. Reads come from current playback and queue state. Writes become player actions such as play, seek, volume, shuffle, repeat, equalizer changes, or playlist selection. Requests for files, URLs, dialogs, or external programs do not leave the skin sandbox. A skin may open more than one view, and views that are separate in WMP become separate player windows here.

References: src/…/mod.rs• L1-19 src/…/runtime.rs• L69-127 src/…/host.rs• L1-7 src/…/host.rs• L841-1030 src/…/wmp.rs• L52-96

WMP pictures and scripts

WMP pictures are loaded when a view needs them. The engine supports still images, animated GIF frames, transparency colors, clipping images, mapping images, tiled backgrounds, and image strips used by custom sliders. While a picture is still loading, the view can draw without it and request another frame when it arrives.

Scripts run with per-handler time and memory limits. A handler that repeatedly exceeds its budget is disabled, while other skin handlers continue. This lets a broken intro or animation fail locally instead of blocking the player. The same live view and paint rules are used by the real window and by the preview renderer.

References: src/…/picture.rs• L1-7 src/…/picture.rs• L299-366 src/…/picture.rs• L473-580 src/…/runtime.rs• L22-29 src/…/runtime.rs• L275-358

Skin previews and cards

Settings skin cards show a representative picture without making the settings window wait for a full skin to load. Classic previews compose the main Winamp window from its sheets. WMP previews start the skin engine with a sample player state, allow its opening behavior and requested pictures to settle, and rasterize the resulting view.

Preview work runs in background threads and is cached as PNG data. The cache key changes when the skin file name, size, or modification time changes, so replacing a skin creates a new preview. Visible cards get priority, decoded images are uploaded to the UI in small batches, and old textures are released when the cache grows too large. A skin with no useful visible result receives a failed-card state rather than blocking the catalog.

References: src/…/preview.rs• L1-9 src/…/preview.rs• L71-117 src/…/preview.rs• L187-333 src/skin_previews.rs• L1-10 src/skin_previews.rs• L146-187 src/skin_previews.rs• L392-555

Winamp window integration

The classic player uses integer nearest-neighbor scaling so skin pixels stay sharp. Classic Winamp skins default to a larger remembered-size appearance, while WMP skins default to one screen pixel per skin pixel. A user-selected scale from 1x through 4x applies to both families.

The classic path attaches the equalizer, playlist, and optional MilkDrop panel below the main window. The generic window art comes from the skin when available and from the built-in skin otherwise. WMP views control their own size and can create additional borderless windows. Both paths pass input back through the skin model while the app keeps ownership of playback and window actions.

References: src/winamp.rs• L17-28 src/winamp.rs• L223-261 src/…/mod.rs• L55-99 src/…/mod.rs• L350-457 src/…/wmp.rs• L98-212

Change checklist

When these files or sections are changed, remember to consider these:

  • Changes to the archive classifier must stay aligned with the files accepted by the skin loader and the files accepted by drag-and-drop installation.
  • Changes to classic layout or sprite coordinates must be reflected in both live drawing and classic preview composition.
  • Changes to WMP paint rules must be checked against hit testing and the software preview rasterizer because they must agree on visible and clickable areas.
  • Changes to skin scale or window size must cover both classic stacked windows and WMP child views.
  • Changes to WMP host properties or commands must preserve the contract between script-visible state, emitted player actions, and saved skin preferences.
  • Changes to preview cache identity or texture limits must preserve refresh behavior when a skin is replaced or removed.

Important failure modes

TriggerConsequenceGuard
Archive is not a readable zip, is encrypted, or uses unsupported compressionThe item may be listed but fails when selectedThe archive reader rejects unsupported entries and reports a skin load error
Classic skin has missing or undersized sheetsSome controls or states are absent or borrowedSheet fallback and sprite clipping preserve the rest of the skin
Skin contains modern Winamp skin.xml data instead of classic sheetsThe skin cannot be drawn by the classic pathThe loader reports modern Winamp skins as unsupported
WMP definition has no usable viewThe skin cannot open a player window or previewWMP parsing requires at least one view
WMP script loops or exceeds its run budgetOne handler stops responding, or a preview stops before settlingPer-handler budgets and repeated-overrun disabling limit the damage
Skin hides or closes its only view during previewThe settings card has no useful imagePreview generation returns a failed result and leaves the app usable
Skin requests unsupported external features such as URLs or file dialogsThe request has no effectThe script host keeps those operations inside the sandbox

Key files

FileWhy to read it
src/…/mod.rsDefines the common skin model, load paths, fallback behavior, and Winamp/WMP classification boundary.
src/winamp.rsConnects skin choices, asynchronous loading, scaling, preferences, textures, and preview state to the player.
src/…/mod.rsShows how classic skins become the player window, attached panels, controls, and visualizer surfaces.
src/…/config.rsExplains playlist colors, visualizer colors, and shaped classic windows.
src/…/sprites.rs and src/…/layout.rsDefine the shared classic Winamp art vocabulary and fixed placement model.
src/…/mod.rs and src/…/runtime.rsDefine WMP skin data and the runtime model for views, scripts, animations, and player events.
src/…/host.rs and src/…/paint.rsShow the script-to-player contract and the common rules for drawing and hit testing WMP views.
src/…/preview.rs and src/skin_previews.rsExplain how previews are rendered, cached, prioritized, and attached to Settings cards.
src/…/wmp.rsShows how WMP views become the primary and child windows of the mini player.