Skip to content
View in the app

A better way to browse. Learn more.

ResHax

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.
Help us keep the site running.
Zero Tolerance for Disrespect

[Godot V3 PCK Files Modding] Need more Information for Texture Replacement Script

Featured Replies

  • Localization

Hello!

Out of boredom, I decided to replace texture from a Godot game, in this case Slot or Not, by using Python but failing and failing over again exhausted me.

My script has data and their MD5 hash code replacement, and data header change. I doubt that something doesn’t work or they are others data somewhere. I also think even if both WebP data from Godot and PIL are working, their data processing are different thus incompatible. Not even replacing them with PNG data works. I suspect there is a checksum for PCK somewhere.

I compared its PCK file with Super Mario 127’s. Although the WebP data for CTEX and STEX are the same, the data pointers in SM127 are at the start of the file, after the header; SoN are at the bottom. The PCK for V1 is documented in Xentax wiki but not for V3. It may be small but this comparison shouldn’t be dismissed.

GodotPCKFileComparaison-SuperMario127andSlotorNot.thumb.png.f02ce3dc7e790ad66a39aa3f300b98e5.png

What I need:

  • If there is a checksum for PCK, where it is?
  • The Bytes leading to the data header thus making the Python script adaptable
  • If the WebP data is the issue, a better understanding of Godot’s WebP data

Feel free to reply if you find anything!


Slot or Not (PCK File V3) 

son PCK File.zip

Godot Picture Replacer Script (Work in progress) 

Godot Pictures Replacer Script.py

Note for the creator of Slot Or Not, you don’t have to turn it into an moddable game. The game need its own resource to be good game. I do this because why not and for research purpose.


Knowledge

GODOT PCK FILE FORMAT (Little Endian)
(From Slot or Not)
HEADER (112 Bytes)
	4 Bytes = Signature ("GDPC")
	4 Bytes = 03 00 00 00 (Engine Version)
	4 Bytes = 04 00 00 00 (Major)
	4 Bytes = 05 00 00 00 (Minor)
	4 Bytes = 00 00 00 00 (Revision)
	4 Bytes = 02 00 00 00
	4 Bytes = 70 00 00 00 (First File Pointer)
	4 Bytes = 00 00 00 00
	4 Bytes = File Numbers
	4 x 19 Bytes = 00s (Reserved)

DATA HEADER (Found at the last part of the file)
	4 Bytes = Length of Path, Including the 00s
	X Bytes = Path Name + 00s (If not divisible by 4)
	8 Bytes = Data Pointer - 112
	8 Bytes = File Size
	16 Bytes = Data MD5 Checksum
	4 Bytes = 00 00 00 00

GODOT CTEX FILE FORMAT (Little Endian)
For WebP Format
{
	4 Bytes = String GTS2
	4 Bytes = Use Alpha or Not (01 = Yes; 00 = No)
	4 Bytes = Height
	4 Bytes = Width
	4 Bytes = 00 00 00 0D
	4 Bytes = FF FF FF FF
	4 x 3 Bytes = 00s (Reserved?)
	4 Bytes = 02 00 00 00
	2 Bytes = Height
	2 Bytes = Width
	4 Bytes = 00s
	4 Bytes = 05 00 00 00
	4 Bytes = Data Size after this Byte

	4 Bytes = String RIFF
	4 Bytes = WebP Data Size after this Byte

	8 Bytes = WEBPVP8L / Tag for Loseless Encoded Image Data
	4 Bytes = Data Size (or Data Size - 1 if WebP Chunk ends with 00) (Rest of the File)

	X Bytes = WEBP VP8L Chunk (On Python, the settings are Loseless = True, EXIF = False)

	0-15 Bytes = 00 for Fill Up if the CTex Data Size isn't a divisible of 16
}

[NOTE: You can get the WebP data by removing the GTS2 Header.]

For PNG Format
{
	X Bytes = PNG File Data
	0-15 Bytes = 00 for Fill Up if the CTex Data Size isn't a divisible of 16
}

X Bytes = String for [Remap], Settings, Path, Texture, Vram
X Bytes = 00s (if the length the String isn’t a divisible of 16)

 

  • 4 weeks later...
  • Author
  • Localization
On 12/17/2025 at 11:23 PM, ikskoks said:

Godot is open source. No need to do an extensive research on this

https://github.com/godotengine/godot/blob/master/core/io/pck_packer.cpp

Hello Ikskoks! Thank again for the reply.

I tried hard to mentally process the code you send but C++ isn't my cup of tea. And I am confused to some part because it doesn't match with the Slot or Not pck file. And when I changed file base offset (green square in the screenshot), it gives this message in verbose:

Corrupted header in binary project.binary (not ECFG)

Without changing it, there is no message in the terminal but the game doesn't show up.

As this script is written on 2014, it matches better for SM127 (files directories are after the PCK header) than SoN (there are at the bottom), I believe it must be a customize pck file or from a recent Godot version GitHub doesn't show. I am missing something?

The reason why I show my research is to prove that I am doing something than trowing a problem to let others solve. It shows how I am understanding things.

I believe I can edit game with Python without using the engine. Bonus point for its data analyze perk!

Create an account or sign in to comment

Account

Navigation

Search

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.