Skip to content

Updated to work with texture and cosmetic editor tools#5

Open
heisthecat31 wants to merge 9 commits intoEchoTools:mainfrom
heisthecat31:main
Open

Updated to work with texture and cosmetic editor tools#5
heisthecat31 wants to merge 9 commits intoEchoTools:mainfrom
heisthecat31:main

Conversation

@heisthecat31
Copy link
Contributor

No description provided.

added extra format options and improved detection or something i dont know
there was too much so ill list what i remember;

updated texconv to add extra format and better detection,

added --export command in evrtools to extract just textures or tints

added better repacking from my own version of evrfiletools
# Changelog

## New Feature: Quick Repack (`--quick`)

### Purpose
The `--quick` flag (Quick Repack) is designed to drastically reduce the time required to apply mods to Echo VR. Instead of rebuilding the entire package set (which can take several minutes and requires significant disk space), Quick Repack modifies the game files in-place by appending only the changed data.

### How it Works

1.  **Manifest Backup & Restoration**:
    *   On the first run, the tool creates a backup of the original manifest (`.bak`).
    *   On subsequent runs, it **always loads the manifest from the backup**. This ensures that every repack operation starts from the clean, original game state. This prevents the game packages from growing indefinitely or creating an endless chain of new package files (e.g., `_3`, `_4`, `_5`...) when applying mods multiple times.

2.  **Smart Package Management**:
    *   The tool identifies the "safe" base packages (e.g., `_0`, `_1`, `_2`) that contain the original game data.
    *   It targets the next available package index (e.g., `_3`) for writing modified files.
    *   If a previous mod package exists (e.g., `_3`), the tool effectively overwrites/updates it by resetting the manifest state to the backup before appending new data.

3.  **In-Place Modification**:
    *   Modified files are compressed and appended to the end of the active package file.
    *   The manifest is updated to point to these new locations for the modified files, while keeping references to original files unchanged.
    *   This avoids the need to read, decompress, and re-write the gigabytes of unmodified game data.

4.  **Safety Mechanisms**:
    *   **Truncation**: If the manifest references package files that do not exist on disk (e.g., from a previous failed run or manual deletion), the tool automatically truncates the manifest to match the actual files present.
    *   **Size Checks**: The tool calculates offsets based on the actual file size on disk to ensure data integrity.

### Usage
```bash
evrtools -mode build -package <NAME> -data "<GAME_DATA_DIR>" -input "<MOD_DIR>" -output "dummy" -quick -force
@heisthecat31
Copy link
Contributor Author

trust me --quick is worth it

# Updates

1. **`pkg/manifest/repack.go` (`QuickRepack`)**: Fixed out-of-bounds `manifest.Frames` truncation logic. Previously, `QuickRepack` incorrectly determined `lastUsedFrameIdx` by iterating over `FrameContents` and then truncated `manifest.Frames` to that specific index + 1. This accidentally dropped approximately 1,200 valid but unlinked frames from the back of the manifest structure.
   - Deleting the unlinked frames is what caused the manifest to shrink by ~20KB on repack.
   - Truncating these frames shifted the indices, causing the runtime engine to decompress the 0-byte package terminators where it expected valid game block allocations. Feeding zero bytes to ZStandard triggers the `Corrupted block detected` and `Unknown frame descriptor` errors in `czstdcompression.cpp`.
   - Replaced this behavior with a safe loop that checks and drops only the `CompressedData == 0` terminators starting from the end of the `manifest.Frames` slice.

2. **`pkg/manifest/repack.go` (`Repack`)**: Fixed out-of-bounds EOF skip behavior on `Len=0` pseudo frames. In the original `48037dc70b0ecab2` game manifest, there are exactly 3 out-of-bounds padding/dummy frames around index 10301 with length parameters set to zero but large offset and compressed size definitions.
   - When building a new package via `evrtools build` these 3 frames failed the data boundary checks in `ReadAt` and were therefore assigned `res.shouldSkip = true`. Dropping these frames deleted 48 bytes from the uncompressed manifest binary layout and re-aligned internal indexes contrary to the game's strict data design format.
   - Changed the behavior to intercept `v.Length == 0` blocks prior to discarding and pass them silently with empty definitions. This faithfully preserves the out-of-bounds indices so Echo VR processes the manifest identically.
thesprockee added a commit that referenced this pull request Mar 14, 2026
…RGBA output

Add decoders for R8_UNORM (grayscale), R8G8B8A8, B8G8R8A8 (sRGB and
Typeless), and R11G11B10_FLOAT packed format with IEEE partial-precision
float conversion.

Fix RGB565 bit expansion to use proper bit-replication instead of
the lossy multiply-divide method. Add sRGB linear-space interpolation
for BC1/BC3 decompression (correct per DDS spec). Change output image
type from image.RGBA (premultiplied) to image.NRGBA (non-premultiplied),
which is correct for texture data with alpha channels.

Based on work by heisthecat31 in PR #5, cleaned up and tested.

Co-Authored-By: he_is_the_cat <heisthecat31@users.noreply.github.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
thesprockee added a commit that referenced this pull request Mar 14, 2026
…RGBA output (#17)

Add decoders for R8_UNORM (grayscale), R8G8B8A8, B8G8R8A8 (sRGB and
Typeless), and R11G11B10_FLOAT packed format with IEEE partial-precision
float conversion.

Fix RGB565 bit expansion to use proper bit-replication instead of
the lossy multiply-divide method. Add sRGB linear-space interpolation
for BC1/BC3 decompression (correct per DDS spec). Change output image
type from image.RGBA (premultiplied) to image.NRGBA (non-premultiplied),
which is correct for texture data with alpha channels.

Based on work by heisthecat31 in PR #5, cleaned up and tested.

Co-authored-by: he_is_the_cat <heisthecat31@users.noreply.github.com>
Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant