{ "info": { "author": "Stephen Bunn", "author_email": "stephen@bunn.io", "bugtrack_url": null, "classifiers": [ "Development Status :: 2 - Pre-Alpha", "Intended Audience :: Developers", "License :: OSI Approved :: GNU General Public License v3 (GPLv3)", "Natural Language :: English", "Operating System :: MacOS :: MacOS X", "Operating System :: Microsoft :: Windows", "Operating System :: POSIX", "Programming Language :: Python :: 3.6", "Topic :: Software Development :: Build Tools", "Topic :: Software Development :: Disassemblers", "Topic :: Software Development :: Pre-processors", "Topic :: Utilities" ], "description": ".. image:: https://github.com/stephen-bunn/bethesda-structs/raw/master/docs/source/_static/img/logo.png\n :alt: Bethesda Structs Logo\n :width: 800\n :align: center\n\n.. image:: https://img.shields.io/pypi/v/bethesda-structs.svg\n :target: https://pypi.org/project/bethesda-structs/\n :alt: PyPi Status\n\n.. image:: https://img.shields.io/pypi/pyversions/bethesda-structs.svg\n :target: https://pypi.org/project/bethesda-structs/\n :alt: Supported Versions\n\n.. image:: https://img.shields.io/github/license/stephen-bunn/bethesda-structs.svg\n :target: https://github.com/stephen-bunn/bethesda-structs/blob/master/LICENSE\n :alt: License\n\n.. image:: https://travis-ci.org/stephen-bunn/bethesda-structs.svg?branch=master\n :target: https://travis-ci.org/stephen-bunn/bethesda-structs\n :alt: Build Status\n\n.. image:: https://img.shields.io/readthedocs/bethesda-structs.svg\n :target: https://bethesda-structs.readthedocs.io/\n :alt: Documentation Status\n\n.. image:: https://api.codacy.com/project/badge/Grade/2546de38602c41aebddd94843760f968\n :target: https://www.codacy.com/app/stephen-bunn/bethesda-structs?utm_source=github.com&utm_medium=referral&utm_content=stephen-bunn/bethesda-structs&utm_campaign=Badge_Grade\n :alt: Codacy Grade\n\n.. image:: https://img.shields.io/badge/Say%20Thanks-!-1EAEDB.svg\n :target: https://saythanks.io/to/stephen-bunn\n :alt: Say Thanks!\n\n.. image:: https://badge.waffle.io/stephen-bunn/bethesda-structs.svg?columns=all\n :target: https://waffle.io/stephen-bunn/bethesda-structs\n :alt: Waffle.io\n\n----------\n\nAbout\n-----\n| *Modding Bethesda's games can be a fine-art.*\n| This package intends to provide **clean** and **accessible** methods for parsing and understanding Bethesda's filetypes.\n\n*For example:*\n\nThere are so many \"unarchiver\" tools for Bethesda's archives (``.bsa`` and ``.ba2``), but no *good* programmatic way to read these filetypes.\nUsing this package, understanding **every little detail** about an archive is simple and straight-forward (see `BSA Usage`_ and `BA2 Usage`_).\n\nFor more advanced usage and information, `check out the documentation `_.\n\n | The supported filetypes are **parsers** not **writers**.\n | *We do not currently support the writing of archives or plugins.*\n\n\nInstallation\n------------\nBecause this is glorious Python, installing ``bethesda-structs`` should be super-duper simple.\n\nUsing PyPi\n''''''''''\nThe fastest and quickest way to install this packages is by simply using `pipenv `_ (or if you're oldschool `pip `_).\n\n.. code-block:: bash\n\n $ pipenv install bethesda-structs\n\n\nUsing Git\n'''''''''\nYou can install this package using Git by simply cloning the repo and building the package yourself!\n\n.. code-block:: bash\n\n $ git clone https://github.com/stephen-bunn/bethesda-structs.git\n $ pipenv install --dev\n $ pipenv run python setup.py install\n\n\nUsage\n-----\n| Using ``bethesda-structs`` is designed to be straight-forward and intuitive.\n| Below are some short examples of parsing various filetypes.\n\n\n.. _ESP Usage:\n\nESP\n'''\n| The ability to parse plugin files is super helpful for understanding the additions and changes that are made to the game.\n| Currently the **only** other real tool that can expose this information to you is `TESEdit `_ and its sibling applications.\n\nThis package aims to provide simple, programmatic access to the in-depth details of a plugin!\n\n Because of how long it takes to build complete subrecord parers for a given plugin version, the **only** currently supported plugins are:\n\n - ``FNVPlugin`` - Fallout: New Vegas (*partial*)\n - ``F03Plugin`` - Fallout 3 (*partial and experimental*)\n\n>>> from bethesda_structs.plugin.fnv import FNVPlugin\n>>> plugin = FNVPlugin.parse_file('/media/sf_VMShared/esp/fnv/NVWillow.esp')\n>>> print(plugin)\nFNVPlugin(filepath='/media/sf_VMShared/esp/fnv/NVWillow.esp')\n>>>\n>>> # print plugin header (is a record)\n...\n>>> print(plugin.container.header)\nContainer:\n type = u'TES4' (total 4)\n data_size = 163\n flags = Container:\n master = True\n id = 0\n revision = 0\n version = 15\n data = b'HEDR\\x0c\\x00\\x1f\\x85\\xab?\\x97\\x12\\x00\\x00#\\xad'... (truncated, total 163)\n subrecords = ListContainer:\n Container:\n type = u'HEDR' (total 4)\n data_size = 12\n data = b'\\x1f\\x85\\xab?\\x97\\x12\\x00\\x00#\\xad\\r\\x00' (total 12)\n parsed = Container:\n value = Container:\n version = 1.340000033378601\n num_records = 4759\n next_object_id = 896291\n description = u'Header' (total 6)\n Container:\n type = u'CNAM' (total 4)\n data_size = 9\n data = b'llamaRCA\\x00' (total 9)\n parsed = Container:\n value = u'llamaRCA' (total 8)\n description = u'Author' (total 6)\n Container:\n type = u'SNAM' (total 4)\n data_size = 16\n data = b'NVWillow v.1.10\\x00' (total 16)\n parsed = Container:\n value = u'NVWillow v.1.10' (total 15)\n description = u'Description' (total 11)\n Container:\n type = u'MAST' (total 4)\n data_size = 14\n data = b'FalloutNV.esm\\x00' (total 14)\n parsed = Container:\n value = u'FalloutNV.esm' (total 13)\n description = u'Master Plugin' (total 13)\n Container:\n type = u'DATA' (total 4)\n data_size = 8\n data = b'\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00' (total 8)\n parsed = Container:\n value = 0\n description = u'File Size' (total 9)\n Container:\n type = u'ONAM' (total 4)\n data_size = 68\n data = b'V\\xe3\\x0c\\x00\\xc3\\xe3\\x0c\\x00\\xc4\\xe3\\x0c\\x00\\xc5\\xe3\\x0c\\x00'... (truncated, total 68)\n parsed = Container:\n value = ListContainer:\n 844630\n 844739\n 844740\n 844741\n 1372461\n 1372463\n 1383111\n 1385321\n 1387301\n 1387302\n 1387303\n 1387304\n 1387906\n 1457771\n 1479505\n 1520201\n 1544392\n description = u'Overridden Records' (total 18)\n>>>\n>>> # iterate over KEYM records (only 1 in this plugin)\n...\n>>> for record in plugin.iter_records('KEYM'):\n... print(record)\n...\nContainer:\n type = u'KEYM' (total 4)\n data_size = 279\n flags = Container:\n id = 17415634\n revision = 0\n version = 15\n data = b'EDID\\x17\\x00WillowNova'... (truncated, total 279)\n subrecords = ListContainer:\n Container:\n type = u'EDID' (total 4)\n data_size = 23\n data = b'WillowNovacBunga'... (truncated, total 23)\n parsed = Container:\n value = u'WillowNovacBungalowKey' (total 22)\n description = u'Editor ID' (total 9)\n Container:\n type = u'OBND' (total 4)\n data_size = 12\n data = b'\\xff\\xff\\xfc\\xff\\x00\\x00\\x01\\x00\\x04\\x00\\x00\\x00' (total 12)\n parsed = Container:\n value = Container:\n X1 = -1\n Y1 = -4\n Z1 = 0\n X2 = 1\n Y2 = 4\n Z2 = 0\n description = u'Object Bounds' (total 13)\n Container:\n type = u'FULL' (total 4)\n data_size = 27\n data = b'Dino Dee-lite Bu'... (truncated, total 27)\n parsed = Container:\n value = u'Dino Dee-lite Bungalow Key' (total 26)\n description = u'Name' (total 4)\n Container:\n type = u'MODL' (total 4)\n data_size = 23\n data = b'Clutter\\\\Key01Dir'... (truncated, total 23)\n parsed = Container:\n value = u'Clutter\\\\Key01Dirty.NIF' (total 22)\n description = u'Model Filename' (total 14)\n Container:\n type = u'ICON' (total 4)\n data_size = 48\n data = b'Interface\\\\Icons\\\\'... (truncated, total 48)\n parsed = Container:\n value = u'Interface\\\\Icons\\\\PipboyImages\\\\Ite'... (truncated, total 47)\n description = u'Large Icon Filename' (total 19)\n Container:\n type = u'MICO' (total 4)\n data_size = 66\n data = b'Interface\\\\Icons\\\\'... (truncated, total 66)\n parsed = Container:\n value = u'Interface\\\\Icons\\\\PipboyImages_sma'... (truncated, total 65)\n description = u'Small Icon Filename' (total 19)\n Container:\n type = u'SCRI' (total 4)\n data_size = 4\n data = b'T.\\n\\x01' (total 4)\n parsed = Container:\n value = FormID(form_id=17444436, forms=['SCPT'])\n description = u'Script' (total 6)\n Container:\n type = u'YNAM' (total 4)\n data_size = 4\n data = b'\\xbb\\x10\\x07\\x00' (total 4)\n parsed = Container:\n value = FormID(form_id=463035, forms=['SOUN'])\n description = u'Sound - Pick Up' (total 15)\n Container:\n type = u'ZNAM' (total 4)\n data_size = 4\n data = b'\\xbc\\x10\\x07\\x00' (total 4)\n parsed = Container:\n value = FormID(form_id=463036, forms=['SOUN'])\n description = u'Sound - Drop' (total 12)\n Container:\n type = u'DATA' (total 4)\n data_size = 8\n data = b'\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00' (total 8)\n parsed = Container:\n value = Container:\n value = 0\n weight = 0.0\n description = u'Data' (total 4)\n\n\n.. _BSA Usage:\n\nBSA\n'''\nBethesda's default archive structure.\n\n>>> from bethesda_structs.archive.bsa import BSAArchive\n>>> archive = BSAArchive.parse_file('/media/sf_VMShared/bsa/Campfire.bsa')\n>>> print(archive)\nBSAArchive(filepath=PosixPath('/media/sf_VMShared/bsa/Campfire.bsa'))\n>>>\n>>> # print archive header\n...\n>>> print(archive.container.header)\nContainer:\n magic = b'BSA\\x00' (total 4)\n version = 105\n directory_offset = 36\n archive_flags = Container:\n directories_named = True\n files_named = True\n directory_count = 4\n file_count = 493\n directory_names_length = 50\n file_names_length = 14839\n file_flags = Container:\n>>>\n>>> # print last directory block, containing 1 file record\n...\n>>> print(archive.container.directory_blocks[-1])\nContainer:\n name = u'meshes\\\\mps\\x00' (total 11)\n file_records = ListContainer:\n Container:\n hash = 16183754957220078963\n size = 2384\n offset = 25094933\n>>>\n>>> # print archived filenames (only first 5, 488 more)\n...\n>>> print(archive.container.file_names)\nListContainer:\n _camp_objectplacementindicatorthread01.psc\n _camp_objectplacementindicatorthread02.psc\n _camp_objectplacementindicatorthread03.psc\n _camp_tentsitlayscript.psc\n campcampfire.psc\n ...\n>>>\n>>> # extract archive to directory\n...\n>>> archive.extract('/home/USER/Downloads')\n\n\n.. _BA2 Usage:\n\nBA2\n'''\n| Bethesda's second archive structure (used in Fallout 4).\n| BTDX archives (BA2) are harder to extract than their previous version BA2.\n\nThe two available archive subtypes are both supported.\n\nGeneral (``GNRL``)\n~~~~~~~~~~~~~~~~~~\nUsed to store generic files in a compressed/bundled file.\n\n>>> from bethesda_structs.archive.btdx import BTDXArchive\n>>> archive = BTDXArchive.parse_file('/media/sf_VMShared/ba2/CheatTerminal - Main.ba2')\n>>> print(archive)\nBTDXArchive(filepath=PosixPath('/media/sf_VMShared/ba2/CheatTerminal - Main.ba2'))\n>>>\n>>> # print archive header\n...\n>>> print(archive.container.header)\nContainer:\n magic = b'BTDX' (total 4)\n version = 1\n type = u'GNRL' (total 4)\n file_count = 982\n names_offset = 3600179\n>>>\n>>> # print first archive file entry\n...\n>>> print(archive.container.files[0])\nContainer:\n hash = 153050373\n ext = u'pex' (total 3)\n directory_hash = 1081231424\n offset = 35376\n packed_size = 0\n unpacked_size = 887\n>>>\n>>> # extract archive to directory\n...\n>>> archive.extract('/home/USER/Downloads')\n\n\nDirect Draw (``DX10``)\n~~~~~~~~~~~~~~~~~~~~~~\nUsed to store (specifically) Microsoft Direct Draw textures.\n\n>>> from bethesda_structs.archive.btdx import BTDXArchive\n>>> archive = BTDXArchive.parse_file('/media/sf_VMShared/ba2/AK74m - Textures.ba2')\n>>> print(archive)\nBTDXArchive(filepath=PosixPath('/media/sf_VMShared/ba2/AK74m - Textures.ba2'))\n>>>\n>>> # print archive header\n...\n>>> print(archive.container.header)\nContainer:\n magic = b'BTDX' (total 4)\n version = 1\n type = u'DX10' (total 4)\n file_count = 116\n names_offset = 329069673\n>>>\n>>> # print first archive file entry\n...\n>>> print(archive.container.files[0])\nContainer:\n header = Container:\n hash = 362144756\n ext = u'dds' (total 3)\n directory_hash = 1416395408\n chunks_count = 4\n chunk_header_size = 24\n height = 2048\n width = 2048\n mips_count = 12\n format = 99\n chunks = ListContainer:\n Container:\n offset = 11136\n packed_size = 2714729\n unpacked_size = 4194304\n start_mip = 0\n end_mip = 0\n Container:\n offset = 2725865\n packed_size = 840614\n unpacked_size = 1048576\n start_mip = 1\n end_mip = 1\n Container:\n offset = 3566479\n packed_size = 217598\n unpacked_size = 262144\n start_mip = 2\n end_mip = 2\n Container:\n offset = 3784077\n packed_size = 71579\n unpacked_size = 87408\n start_mip = 3\n end_mip = 11\n>>>\n>>> # extract archive to directory\n...\n>>> archive.extract('/home/USER/Downloads')", "description_content_type": "", "docs_url": null, "download_url": "", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/stephen-bunn/bethesda-structs", "keywords": "bethesda,filetype,structures,archive,python36,construct", "license": "MIT License", "maintainer": "", "maintainer_email": "", "name": "bethesda-structs", "package_url": "https://pypi.org/project/bethesda-structs/", "platform": "", "project_url": "https://pypi.org/project/bethesda-structs/", "project_urls": { "Homepage": "https://github.com/stephen-bunn/bethesda-structs" }, "release_url": "https://pypi.org/project/bethesda-structs/0.1.4/", "requires_dist": null, "requires_python": ">=3.6", "summary": "A parser for Bethesda's file formats", "version": "0.1.4" }, "last_serial": 5696330, "releases": { "0.0.0": [ { "comment_text": "", "digests": { "md5": "a3695ef7528663ddd5482717fcf9f2c3", "sha256": "3775b391b74b3b5197cebfd52ee41ffca4b34da38df8db06fbf48c5630704fb1" }, "downloads": -1, "filename": "bethesda-structs-0.0.0.tar.gz", "has_sig": false, "md5_digest": "a3695ef7528663ddd5482717fcf9f2c3", "packagetype": "sdist", "python_version": "source", "requires_python": ">=3.6", "size": 30324, "upload_time": "2017-12-19T18:11:24", "url": "https://files.pythonhosted.org/packages/8a/ec/4e5ff5ef58dae494d261a775dbd427dcd9f7e31ead8273a82dc7e3e28d85/bethesda-structs-0.0.0.tar.gz" } ], "0.0.1": [ { "comment_text": "", "digests": { "md5": "77e00c2831332e1c7687de5b4649b82e", "sha256": "44390cdbac6f724b59e984805cd6943f0cbcee467a8b9dbb0cc307b70632c6d7" }, "downloads": -1, "filename": "bethesda-structs-0.0.1.tar.gz", "has_sig": false, "md5_digest": "77e00c2831332e1c7687de5b4649b82e", "packagetype": "sdist", "python_version": "source", "requires_python": ">=3.6", "size": 30414, "upload_time": "2018-01-12T16:46:40", "url": "https://files.pythonhosted.org/packages/c6/c3/de43779cfd54e52fe7d49fa648c22fe933d088d988377acf3f59c14ce1cb/bethesda-structs-0.0.1.tar.gz" } ], "0.1.3": [ { "comment_text": "", "digests": { "md5": "69711b65fc0f11e97d4035154679ef95", "sha256": "861e86ed3464a74195f3c1d24cd3561c3d8d09ed64f147cc82fe87eab4726682" }, "downloads": -1, "filename": "bethesda-structs-0.1.3.tar.gz", "has_sig": false, "md5_digest": "69711b65fc0f11e97d4035154679ef95", "packagetype": "sdist", "python_version": "source", "requires_python": ">=3.6", "size": 42892, "upload_time": "2018-04-24T20:53:35", "url": "https://files.pythonhosted.org/packages/e4/8d/79a69f150a620be9c715e4c5ed72bc1b92108f7fcad90940ca8f08fcf808/bethesda-structs-0.1.3.tar.gz" } ], "0.1.4": [ { "comment_text": "", "digests": { "md5": "a1f01449ff62a94cbc4c0f82d6a0eec6", "sha256": "024f994e35b034b3833b319335c58a3a8b18b6063d5364536daafd3aca5c6c48" }, "downloads": -1, "filename": "bethesda-structs-0.1.4.tar.gz", "has_sig": false, "md5_digest": "a1f01449ff62a94cbc4c0f82d6a0eec6", "packagetype": "sdist", "python_version": "source", "requires_python": ">=3.6", "size": 44497, "upload_time": "2019-08-19T01:42:58", "url": "https://files.pythonhosted.org/packages/ac/d8/2b6970d4568096743ec25f9fe73dd44f95b6ba29573606238cec6e4a28de/bethesda-structs-0.1.4.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "a1f01449ff62a94cbc4c0f82d6a0eec6", "sha256": "024f994e35b034b3833b319335c58a3a8b18b6063d5364536daafd3aca5c6c48" }, "downloads": -1, "filename": "bethesda-structs-0.1.4.tar.gz", "has_sig": false, "md5_digest": "a1f01449ff62a94cbc4c0f82d6a0eec6", "packagetype": "sdist", "python_version": "source", "requires_python": ">=3.6", "size": 44497, "upload_time": "2019-08-19T01:42:58", "url": "https://files.pythonhosted.org/packages/ac/d8/2b6970d4568096743ec25f9fe73dd44f95b6ba29573606238cec6e4a28de/bethesda-structs-0.1.4.tar.gz" } ] }