Skip to content

PlayStation texture deswizzle (no upstream reference yet) #130

Open

Description

@fatal10110

Description

#33 names "Switch / Xbox360 / PS4-style swizzle". Its PR does the Xbox 360 byte swap (AssetStudio) and the Switch deswizzle (UnityPy). PlayStation textures are not handled. Console builds can store them tiled, but neither AssetStudio nor UnityPy deswizzles PS4/PS5 (or PS Vita) textures. So there is no MIT upstream to port and no oracle to take goldens from (R12), and no fixture editor here can build for PlayStation either. If such a texture is tiled, it currently decodes as if it were stored linear.

This is on-demand work, like the other game/console items in M6+. Start it only when there is a real consumer, and a reference to port that is MIT or compatibly licensed.

Tasks

  • Find a permissively licensed PS4/PS5 texture tiling reference and an oracle able to produce goldens for it
  • Deswizzle PlayStation textures in decodeTexture2D by platform, the way Platform byte-swaps and vertical flip #33 does Switch
  • Until then, consider whether a PlayStation texture should throw UnsupportedError rather than decode as linear (R9)

Acceptance

  • A PS4 texture decodes to the same RGBA as the chosen oracle, or is refused with UnsupportedError

Plan: docs/unity-asset-reader-plan.md. Behavior source of truth: Razviar/assetstudio (MIT). Golden oracle: UnityPy (MIT). MIT-derivative port: keep upstream copyright notices. Do not copy or import @arkntools/unity-js (AGPL-3.0), tests included. No C# compiled to WASM - C# is reference only, hand-ported to TS; WASM is built from C/C++ only (plan D2). Layout: npm-workspaces monorepo under packages/; dependencies point feature package -> core only (plan D7/D8, rules R13/R14).

Activity

  1. fatal10110 commented on Sep 27, 2026

    @fatal10110
    OwnerAuthor

    Update from #131, following the maintainer's decision: the third task is decided and done. decodeTexture2D now throws UnsupportedError("texture platform", …) for any BuildTarget.PS4 (31) or BuildTarget.PS5 (44) texture (R9), in refuseTiledPlatform in packages/texture/src/platform.ts (commit e10db76). It refuses linear PlayStation textures too, since nothing in the file tells them apart from tiled ones. PS3 and PS Vita are not refused. When this issue lands, detiling replaces that refusal; the test to update is platform.test.ts › "PS4 and PS5 textures are refused until they can be detiled (#130, R9)".

  2. fatal10110 commented on Sep 27, 2026

    @fatal10110
    OwnerAuthor

    Note from the re-review of PR #131: the PS4/PS5 refusal also blocks PS4 Crunch textures. A Crunch stream is unpacked on the CPU and cannot be stored tiled, so this issue could lift the refusal for Crunch formats first.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    area:textureTexture and sprite decodingbacklogOn-demand, no named consumer yet

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions