README.md
8737 bytes · Original / download
GameMaker Texture Repacking Tool
Room-aware Texture Page optimization developed for DeltaruneVita.
DeltaRepack
DeltaRepack rebuilds the Texture Page layout inside GameMaker data.win files to reduce the amount of texture memory that must be resident at the same time.
It was developed for DeltaruneVita, where large GameMaker atlases can be expensive on the PlayStation Vita even when a Room only uses a small portion of them.
Before
Few large atlases
↓
Rooms load unrelated texture data
↓
Higher working-set VRAM
After
More granular atlases
↓
Rooms load smaller, relevant texture sets
↓
Lower working-set VRAM
DeltaRepack does not include or distribute Deltarune game files. You must provide your own
data.win.
Example:

Features
- Global Texture Page Item repacking
- Room-aware texture usage analysis
- VRAM regression checks per Room
- Atlas sizes from
64x64to2048x2048 - TextureGroup-safe reconstruction
- Conservative handling of resources without known Room usage
- Fast packing for large clusters
- Raw source-pixel cropping
- Post-save reload and verification
- Recursive batch processing
- Original input preservation
- Reproducible Vita-specific GML optimizations
- Semantic Room/resource detection instead of hardcoded IDs
Why repack the data.win?
GameMaker may place unrelated resources in the same large Texture Page.
Room uses one sprite
↓
Sprite belongs to a 2048x2048 atlas
↓
The entire atlas becomes resident
DeltaRepack changes the layout itself so texture residency becomes more granular.
The goal is not to minimize the number of Texture Pages. An optimized build can contain more pages while still requiring much less memory per Room:
Original
fewer pages
+ larger atlases
+ more unrelated content loaded together
Repacked
more pages
+ smaller atlases
+ more specific residency
+ lower working set
Project structure
DeltaRepack/
├─ assets/
│ ├─ icon.png
│ ├─ logo_black.png
│ └─ logo_white.png
├─ chapters/
├─ rebuild/
├─ source/
├─ CHANGELOG_v1_6.md
└─ rebuild_data_win_v1_6.bat
chapters/
Place the source data.win files here.
chapters/
├─ 1/
│ └─ data.win
├─ 2/
│ └─ data.win
├─ 3/
│ └─ data.win
├─ 4/
│ └─ data.win
└─ 5/
└─ data.win
Nested variants are supported as well:
chapters/
├─ Original/
│ └─ chapter2/
│ └─ data.win
├─ PTBR/
│ └─ chapter2/
│ └─ data.win
└─ Spanish/
└─ chapter2/
└─ data.win
Their relative folder structure is preserved in rebuild/.
rebuild/
Generated files are written here. Files under chapters/ are not modified in place.
source/
Contains the rebuild scripts and required tooling.
assets/
Repository branding and documentation assets.
Usage
Run:
rebuild_data_win_v1_6.bat
You can process a single discovered folder or enter:
A
to recursively analyze and rebuild all data.win files found under chapters/.
Batch mode uses a single confirmation. If one item fails, processing stops at that item, previously completed outputs are preserved, and a report is generated at:
rebuild/batch_rebuild_report.txt
Repack pipeline
data.win
↓
Analyze Texture Pages / TPIs
↓
Map known Room usage
↓
Build repack clusters
↓
Pack into new atlas sizes
↓
TextureGroup safety checks
↓
Room VRAM regression gate
↓
Rebuild Texture Pages
↓
Reload and verify
↓
Apply approved Vita GML optimizations
↓
optimized data.win
Room-aware VRAM gate
DeltaRepack evaluates proposed atlas replacements against the Texture Pages actually required by known Rooms.
If a change would make a Room more expensive, the optimization can be rejected instead of silently introducing a regression.
v1.6 TextureGroup Room-aware gate
v1.6 improves validation for mixed TextureGroup atlases.
Previously, a conservative split could charge every replacement group to a Room:
Room uses mixed atlas
↓
split G005 + G006
↓
Room charged G005 + G006
Now DeltaRepack intersects the Room's actual texture items with the TPIs inside that atlas:
Room.texture_items
∩
atlas TPIs
↓
TextureGroups actually required
↓
charge only relevant replacements
If the RAW analysis cannot safely explain the atlas usage, the tool automatically falls back to the previous conservative behavior.
TextureGroup safety
TextureGroups are preserved during reconstruction.
If a proposed optimized atlas would incorrectly mix incompatible groups, it is split before the final output is accepted.
Unknown Room usage
Static analysis cannot discover every possible runtime texture reference.
Dynamic GML and indirect resource access mean:
"No known Room"
does not mean
"unused"
DeltaRepack preserves and handles these resources conservatively.
Raw texture reconstruction
Atlas pages are rebuilt from the original source pixels.
For each TPI, DeltaRepack crops its original source rectangle and places those pixels into the new atlas. The repack changes placement information such as:
TexturePage
SourceX
SourceY
while preserving the TPI's dimensions and target/bounding data.
This avoids scaling or re-rendering assets during reconstruction.
Fast packing
Large clusters use the fast packing path introduced in v1.5 to keep high-item-count rebuilds practical.
v1.6 retains this optimization together with:
- path-safe processing
- TextureGroup safety
- VRAM gate
- RAW CROP
- reload/verify
- original-file preservation
Reproducible Vita GML optimizations
After atlas reconstruction, DeltaRepack can apply approved GameMaker-side optimizations through:
source/apply_vita_gml_optimizations.csx
These patches are detected semantically through Room/resource/code names rather than numeric resource IDs, making them more suitable for Original and translated data.win variants.
Current examples include:
Chapter 2 — Cyber Rollercoaster
room_dw_cyber_rollercoaster
Limits scr_draw_sprite_tiled_area to the active camera region to avoid drawing distant tiled content unnecessarily.
Chapter 3 — Circle Zoom
obj_circlezoom
Reduces the intermediate surface from 640x480 / Room size to 320x240, updates its mask at 30 Hz, and composites it back at 2x.
The surface uses 25% of the original pixel count and updates on half as many frames.
After saving, the rebuilt file is reopened and the optimization pass is executed again to verify that the patches are idempotent.
DeltaCache
DeltaRepack only rebuilds the data.win.
For DeltaruneVita, the result can then be passed to DeltaCache, which generates the external runtime texture caches:
DeltaRepack
↓
optimized data.win
↓
DeltaCache
↓
.r444 + .bc3.pvr
Always generate caches from the exact rebuilt data.win they will be used with.
Requirements
- Windows
- Python
- UndertaleModTool / UndertaleModCLI
- scripts and dependencies under
source/
Do not redistribute third-party binaries unless their licenses allow it.
Game files
This repository must not contain:
- original
data.winfiles - extracted commercial Deltarune assets
- redistributed game content
Users must provide their own files from a legitimate installation.
Related project
DeltaRepack was created as part of the optimization work behind DeltaruneVita, focusing on adapting GameMaker texture residency to the memory constraints of the PlayStation Vita.
Disclaimer
Deltarune, GameMaker and PlayStation Vita are properties of their respective owners.
DeltaRepack is a community-developed tool and is not affiliated with or endorsed by those companies or rights holders.