Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Magic Number header specific to Lorien file format for later reuse and saving file from FS crashs #314

Open
Popolon opened this issue Nov 24, 2024 · 0 comments
Labels
enhancement New feature or request

Comments

@Popolon
Copy link

Popolon commented Nov 24, 2024

Feature/enhancement description:

After looking at the source code , currently the file format start by a revision number and metadata, without indicating the kind of file.

A "Magic Number" is generally a 4 character ASCII text at start of the file that help to find it and determine the kind of file. Currently if the file extension is renamed and changed, there are no mean to know which kind of file its. Recovery and analysis tools also use magic number to discover files, for example PhotoRec (now inside TestDisk) that help to recover files on corrupted or (quick only) formatted filesystems. It will probably be used in the futur by software that want to reopen old file format no more maintained, as that's the case for 8-bit/16-bit era computers file format :).

Some examples of few Magic Numbers, the number and ASCII readability can vary depending on files:

  • PNG start with: 89 50 4e 47 .PNG
  • ELF executable: 7f 45 4c 46 .ELF
  • BMP file: 42 4d 98 48 BM.I
  • Zst compressed files use 6 chars: 28 b5 2f fd 04 58 (./..X
  • Zip: 50 4b 03 04 PK..
  • JPG use JFIF after 6 non-ASCII characters: ff d8 ff e0 00 10 4a 46 49 46 ......JFIF

Today, your files are created by Godot and contains the Godot magic number at start and end:

  • 47 43 50 46 GCPF
    Followed by file revision (1 in little endian)
  • 01 00 00 00
    ...
  • 47 43 50 46 GCPF

This will help to know that is a Godot generated file, recover the whole file, but not to know which Godot application is linked to this file format.

@Popolon Popolon added the enhancement New feature or request label Nov 24, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant