Skip to content

ThomasJRyan/dk64_lib

Repository files navigation

DK64 Lib

A library for extracting data from a Donkey Kong 64 ROM

Installation

pip install dk64-lib

Examples

Text data

from dk64_lib.rom import Rom
rom = Rom("Donkey Kong 64 (USA).z64")

for text_line in rom.text_tables[0].text_lines:
    print(text_line.text)

# WELCOME TO THE BONUS STAGE!
# HIT AS MANY KREMLINGS AS YOU CAN! PRESS a_button TO FIRE A MELON.
# KEEP THE TURTLES SPINNING BY FEEDING THE SNAKES MELONS. PRESS a_button TO FIRE A MELON.
# LINE UP FOUR BANANAS TO WIN THE JACKPOT! PRESS a_button TO SPIN AND STOP THE REELS.
# RELOAD!
# HURRY!
# ...

Geometry data

Export every supported asset type to organized folders:

from dk64_lib.rom import Rom
rom = Rom("Donkey Kong 64 (USA).z64")

rom.export_all("dk64_export")

Export every map to GLB for Blender-friendly textured geometry:

from dk64_lib.rom import Rom
rom = Rom("Donkey Kong 64 (USA).z64")

rom.export_geometries("dk64_export/geometries")

Export every map to OBJ with MTL files and PNG texture assets:

from dk64_lib.rom import Rom
rom = Rom("Donkey Kong 64 (USA).z64")

rom.export_geometries("dk64_export/geometries", geometry_format="obj")

Export every map to separate glTF, binary, and PNG files:

from dk64_lib.rom import Rom
rom = Rom("Donkey Kong 64 (USA).z64")

rom.export_geometries("dk64_export/geometries", geometry_format="gltf")

Export every map to DAE with PNG texture assets:

from dk64_lib.rom import Rom
rom = Rom("Donkey Kong 64 (USA).z64")

rom.export_geometries("dk64_export/geometries", geometry_format="dae")

Export a single map as textured OBJ:

from dk64_lib.rom import Rom
rom = Rom("Donkey Kong 64 (USA).z64")

rom.geometry_tables[0].save_to_obj("0.obj")

Export a single map as textured GLB or glTF:

from dk64_lib.rom import Rom
rom = Rom("Donkey Kong 64 (USA).z64")

rom.geometry_tables[0].save_to_glb("0.glb")
rom.geometry_tables[0].save_to_gltf("0.gltf")

Export a single map as textured DAE:

from dk64_lib.rom import Rom
rom = Rom("Donkey Kong 64 (USA).z64")

rom.geometry_tables[0].save_to_dae("0.dae")

Export a legacy geometry-only OBJ:

from dk64_lib.rom import Rom
rom = Rom("Donkey Kong 64 (USA).z64")

rom.geometry_tables[0].save_to_obj("0.obj", include_textures=False)

To-do

  • Expand textured geometry export format coverage and texture-state accuracy
  • Extract models and convert to objs
  • Extract audio and convert to some sort of audio file
  • Extract everything else

Credits

This project builds on the combined DK64 research, documentation, and tooling efforts of many people over many years. A key reference is the shared DK64 documentation spreadsheet.

Special thanks to Ballaam, GloriousLiar, 2dos, Bismuth, and Zeldaboy14.

About

Python library for exporting DK64 assets

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Contributors

Languages