Skip to content

Instantly share code, notes, and snippets.

@iconmaster5326
Last active November 27, 2025 17:29
Show Gist options
  • Select an option

  • Save iconmaster5326/94c25d2adf6479777307f313715ba75b to your computer and use it in GitHub Desktop.

Select an option

Save iconmaster5326/94c25d2adf6479777307f313715ba75b to your computer and use it in GitHub Desktop.

Revisions

  1. iconmaster5326 revised this gist Nov 27, 2025. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion rvdatax.ksy
    Original file line number Diff line number Diff line change
    @@ -1,5 +1,5 @@
    meta:
    id: world
    id: rvdatax
    endian: le
    doc: A `.rvdatax` file, used in Dragon Spirits.
    seq:
  2. iconmaster5326 revised this gist Nov 27, 2025. 1 changed file with 66 additions and 0 deletions.
    66 changes: 66 additions & 0 deletions rvdatax.ksy
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,66 @@
    meta:
    id: world
    endian: le
    doc: A `.rvdatax` file, used in Dragon Spirits.
    seq:
    - id: header
    doc: Header information?
    size: 3
    - id: num_entries
    doc: Number of entries.
    type: varnum
    - id: entries
    doc: Entries.
    type: entry
    repeat: expr
    repeat-expr: num_entries.value
    types:
    varnum:
    doc: A variable-length number.
    seq:
    - id: num_bytes
    doc: The number of bytes this number is.
    type: u1
    - id: bytes_1
    doc: The bytes composing this number.
    type: u1
    if: num_bytes == 0x01
    - id: bytes_2
    doc: The bytes composing this number.
    type: u2
    if: num_bytes == 0x02
    - id: bytes_4
    doc: The bytes composing this number.
    type: u4
    if: num_bytes == 0x04
    instances:
    value:
    value: |
    num_bytes == 0x00 ? 0 :
    num_bytes == 0x01 ? bytes_1 :
    num_bytes == 0x02 ? bytes_2 :
    num_bytes == 0x04 ? bytes_4 :
    (num_bytes - 5)
    entry:
    doc: A single entry in a file.
    seq:
    - id: magic1
    doc: Magic number.
    size: 4
    - id: name
    doc: The name of the entity.
    type: str
    encoding: UTF-8
    terminator: 0x22 # "
    consume: false
    - id: magic2
    doc: Magic number.
    size: 1
    - id: len_contents
    doc: The byte length of entry contents.
    type: varnum
    - id: contents
    doc: The contents of this entry.
    type: str
    encoding: UTF-8
    size: len_contents.value
  3. iconmaster5326 created this gist Nov 27, 2025.
    17 changes: 17 additions & 0 deletions png_to_rvdata2.py
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,17 @@
    # Run this in the root directory of a RPG Maker project.

    import os

    POSTFIX = ".png"
    RVDATA2_HEADER = b"\x85\xa1\x39\x38\x3f\xd3\x3d\x6d"

    for dirname, dirs, files in os.walk(os.path.join(os.curdir, "Graphics")):
    print(f"Walking through {dirname}...")
    for file in files:
    if file[-len(POSTFIX):] == POSTFIX:
    infilename = os.path.join(dirname, file)
    outfilename = infilename[:-len(POSTFIX)] + ".rvdata2"
    print(f"Converting {infilename} to {outfilename}!")
    with open(infilename, "rb") as infile:
    with open(outfilename, "wb") as outfile:
    outfile.write(RVDATA2_HEADER + infile.read()[len(RVDATA2_HEADER):])
    17 changes: 17 additions & 0 deletions rvdata2_to_png.py
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,17 @@
    # Run this in the root directory of a RPG Maker project.

    import os

    POSTFIX = ".rvdata2"
    PNG_HEADER = b"\x89\x50\x4e\x47\x0d\x0a\x1a\x0a"

    for dirname, dirs, files in os.walk(os.path.join(os.curdir, "Graphics")):
    print(f"Walking through {dirname}...")
    for file in files:
    if file[-len(POSTFIX):] == POSTFIX:
    infilename = os.path.join(dirname, file)
    outfilename = infilename[:-len(POSTFIX)] + ".png"
    print(f"Converting {infilename} to {outfilename}!")
    with open(infilename, "rb") as infile:
    with open(outfilename, "wb") as outfile:
    outfile.write(PNG_HEADER + infile.read()[len(PNG_HEADER):])