Skip to main content

KH2Lib

This is the repository for a python library to assist with creating mods/codes to Kingdom Hearts 2 Final Mix +

Please create a GitHub issue if you have problems, or reach out to me on Discord (I'm in most of the kh2 modding related discords). Pull requests are also welcome!

The library can do the following (and more)

  • Extract/Patch/Repack KH2 iso's, (using KH2FM_Toolkit.exe)
  • Extract/Repack BAR files using openKH
  • Given a memdump of the running game, locate the offset where a given file is located
  • Given a source and modified file, generate codes to perform the changes in memory, without patching (useful for fast prototypes)
  • Provides lookup methods for objects (look up object id/name/mdlx based on just one of those)

To install run the following

pip install kh2lib

The library is most useful when used in conjunction with some other pieces of software, and detects their presence using the following environment variables

USE_KH2_EDITORENGINE - Is the path to the directory containing the openkh executables

example - C:\Users\12sam\Desktop\openkh

USE_KH2_GITPATH - Is the path to an extracted KH2 ISO

example - C:\Users\12sam\Desktop\Kingdom Hearts 2 Modding\ISO\export

USE_KH2_OUTPATH - Where the library should places created pnach files (usually the cheats folder of pcsx2)

example - C:\Users\12sam\Desktop\pcsx\PCSX2 1.6.0\cheats\F266B00B.pnach

USE_KH2_PATCHENGINEDIR - Is the path to a directory containing KH2FM_Toolkit.exe

example - C:\Users\12sam\Desktop\Kingdom Hearts 2 Modding\ISO

Usage

See the examples folder for examples on how to perform various tasks

Using KH2Lib - contains examples that demonstrate using various pieces of kh2lib functionality Other - Other useful scripts I made while researching different things, not exactly related to kh2lib functionality WIP - Work in Progress examples that may not work, or may be prototyping future features to kh2lib

Metadata

Release files for kh2lib 0.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Built distribution (wheel)

Table of built distributions (wheels) for kh2lib 0.2
File Interpreter ABI Platform Actions
kh2lib-0.2-py2.py3-none-any.whl Python 3, Python 2 none any Details for kh2lib-0.2-py2.py3-none-any.whl

Release files / kh2lib-0.2-py2.py3-none-any.whl

Download URL kh2lib-0.2-py2.py3-none-any.whl
Size 23.6 kB
Tags Python 2 Python 3
SHA-256 checksum
How to use checksums
c90a8d5dc9657a3d291f3d2fdd3d8718cc5fbe6e528bd372e3d01dea01b48661
BLAKE2b-256 checksum
How to use checksums
cb37eb6954474edacad0d374a37801a4a821cd9807e31db70e4ac3f86ef9edca
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/1.13.0 pkginfo/1.4.2 requests/2.21.0 setuptools/40.2.0 requests-toolbelt/0.9.1 tqdm/4.26.0 CPython/3.7.0

Security for kh2lib 0.2

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.2 This release

1 release file No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page