Partial Python port of CodeWalker.GameFiles for YMAP, YTYP and RPF workflows.
Project description
FiveFury
FiveFury is a Python library for GTA V asset workflows.
It provides practical support for:
YMAPread/writeYTYPread/writeRPF7 OPENarchives and nested.rpfZIP -> RPFandRPF -> ZIP- fast asset indexing with
GameFileCache
Installation
pip install fivefury
For local development from a checkout:
pip install -e .
Python 3.11+ is required.
Quick Start
Create a YMAP
from fivefury import Entity, Ymap
ymap = Ymap(name="example_map")
ymap.add_entity(
Entity(
archetype_name="prop_tree_pine_01",
guid=1,
position=(0.0, 0.0, 0.0),
rotation=(0.0, 0.0, 0.0, 1.0),
lod_dist=150.0,
)
)
ymap.recalculate_extents()
ymap.recalculate_flags()
ymap.save("example_map.ymap")
If you want an internal resource path, set ymap.resource_name before saving.
Load a YMAP
from pathlib import Path
from fivefury import Ymap
ymap = Ymap.from_bytes(Path("example_map.ymap").read_bytes())
print(len(ymap.entities))
print(ymap.flags, ymap.content_flags)
Create a YTYP
from fivefury import Archetype, ParticleEffectExtension, Ytyp
ytyp = Ytyp(name="example_types")
archetype = Archetype(
name="prop_tree_pine_01",
lod_dist=150.0,
asset_type=0,
bb_min=(-1.5, -1.5, -0.5),
bb_max=(1.5, 1.5, 8.0),
bs_centre=(0.0, 0.0, 3.5),
bs_radius=5.0,
)
archetype.add_extension(
ParticleEffectExtension(
name="fx_tree",
fx_name="scr_wheel_burnout",
fx_type=2,
scale=0.8,
)
)
ytyp.add_archetype(archetype)
ytyp.save("example_types.ytyp")
Pack Assets into an RPF
from fivefury import Entity, Ymap, create_rpf
ymap = Ymap(name="packed_map")
ymap.add_entity(Entity(archetype_name="prop_tree_pine_01", position=(0.0, 0.0, 0.0), lod_dist=120.0))
ymap.recalculate_extents()
ymap.recalculate_flags()
archive = create_rpf("mods.rpf")
archive.add("stream/packed_map.ymap", ymap)
archive.add("docs/readme.txt", b"hello from fivefury")
archive.save("mods.rpf")
Convert between ZIP and RPF
from fivefury import rpf_to_zip, zip_to_rpf
zip_to_rpf("unpacked_mod_folder", "packed_mod.rpf")
rpf_to_zip("packed_mod.rpf", "packed_mod.zip")
Directories ending in .rpf are packed as nested archives.
GameFileCache
Scan a Game Installation
from fivefury import GameFileCache
cache = GameFileCache(
r"C:\Program Files (x86)\Steam\steamapps\common\Grand Theft Auto V",
scan_workers=8,
max_loaded_files=16,
)
cache.scan_game(use_index_cache=True)
print(cache.asset_count)
print(cache.stats_by_kind())
GameFileCache indexes loose files and archive contents, then loads supported formats lazily.
Control DLC and Scan Scope
from fivefury import GameFileCache
cache = GameFileCache(
r"C:\Program Files (x86)\Steam\steamapps\common\Grand Theft Auto V",
dlc_level="mpbattle",
exclude_folders="mods;scratch",
load_audio=False,
load_vehicles=True,
load_peds=True,
)
cache.scan_game(use_index_cache=True)
Useful scan options:
dlc_level: limit active DLCsexclude_folders: ignore folders by prefixload_audio: skip audio-related assets during scanload_vehicles: skip vehicle-related assets during scanload_peds: skip ped-related assets during scanuse_index_cache: reuse the persisted scan index for faster startup
Look Up Assets by Name and Type
asset = cache.get_asset("prop_tree_pine_01", kind=".ydr")
print(asset.path)
print(asset.short_name_hash)
You can iterate the cache directly:
for asset in cache:
print(asset.path, asset.kind)
Or iterate a specific kind:
for ydr in cache.iter_kind(".ydr"):
print(ydr.path)
Read and Extract Assets
from pathlib import Path
asset = cache.get_asset("prop_tree_pine_01", kind=".ydr")
data = cache.read_bytes(asset, logical=True)
out_path = cache.extract_asset(asset, Path("prop_tree_pine_01.ydr"))
print(len(data))
print(out_path)
Common access patterns:
get_asset(...): resolve one asset by path, name or hashread_bytes(...): get bytes directlyget_file(...): build a lazyGameFilewrapperextract_asset(...): write the asset to disk
Extraction defaults to standalone file output.
For resource assets such as YDR, YDD, YFT, YTD, YMAP and YTYP, this produces a valid standalone RSC7 file.
If you want the logical payload instead:
cache.extract_asset("prop_tree_pine_01", "prop_tree_pine_01_payload.ydr", logical=True)
Type Dictionaries
GameFileCache exposes lazy type dictionaries keyed by shortNameHash.
from fivefury import jenk_hash
ydr = cache.YdrDict[jenk_hash("prop_tree_pine_01")]
ytd = cache.YtdDict[jenk_hash("vehshare")]
ybn = cache.YbnDict[jenk_hash("v_carshowroom")]
Available dictionaries include YdrDict, YddDict, YtdDict, YmapDict, YtypDict, YftDict, YbnDict, YcdDict, YptDict, YndDict, YnvDict, YedDict, YwrDict, YvrDict, RelDict and Gxt2Dict.
Archetype Lookup
GameFileCache also builds a lazy global archetype lookup from indexed YTYP files.
archetype = cache.get_archetype("prop_tree_pine_01")
print(archetype.name)
for archetype in cache.iter_archetypes():
print(archetype.name)
Global Hash Resolver
from fivefury import register_name, register_names_file, resolve_hash, jenk_hash
register_name("prop_tree_pine_01")
register_names_file("common_names.txt")
print(resolve_hash(jenk_hash("prop_tree_pine_01")))
The resolver is shared and optional. It is useful for display, lookups and tooling.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file fivefury-0.1.0.tar.gz.
File metadata
- Download URL: fivefury-0.1.0.tar.gz
- Upload date:
- Size: 409.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.14.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
51971f105ac7c96b07e4306e3195832229db6f6e0f143f4137268f79ffbbaa8b
|
|
| MD5 |
82b03715533ec6f7d27fd0267694d85e
|
|
| BLAKE2b-256 |
2f31d4b2a6dd5a2f412dd4e6cb72606e471096fc199a83b679eca534b55cf89e
|
File details
Details for the file fivefury-0.1.0-cp311-abi3-win_amd64.whl.
File metadata
- Download URL: fivefury-0.1.0-cp311-abi3-win_amd64.whl
- Upload date:
- Size: 450.3 kB
- Tags: CPython 3.11+, Windows x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.14.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
a49f44787af360d3c8257968cfed1d2dd26450006e0a1a80f3e6dbe445449d82
|
|
| MD5 |
1c57e70e80db698c736db2a1c320261a
|
|
| BLAKE2b-256 |
204867080179e0a8545e20ae903abe08272b8293d714d87635b5bd793c9d53cd
|