Kai's GameCube modding library enabling C/C++ code injection into .dol executables.
Project description
Okay, what's Freighter?
Hey there, Kai here. Freighter is toolkit made for compiling C, C++, or ASM using DevkitPPC for injecting new code/data sections into GameCube/Wii *.dol executables. This is an extension of Yoshi2's C-Kit I worked on around middle of 2019 because I was abhorred with the methods modders used abusing C.
How do install?
Simply install using pip
on your console of choice:
Windows:
py -m pip install freighter
Unix & Such:
python3 -m pip install freighter
It should just install all of the necessary dependencies. It better..
What next?
Next just create a build.py
inside your work directory and import the Project
class.
Freighter does it's best to automatically fetch include and source directories so that you don't have to worry about passing those arguments to the compiler.
Example build.py
Better documentation will come.. when I feel like it.
from freighter import Project
# Pick your poison (compiler args)
common_args = [
"-O3",
"-fno-asynchronous-unwind-tables",
"-fno-exceptions",
]
gcc_args = [
"-std=c17", # The C standard to compile with
]
gpp_args = [
"-std=gnu++2b", # The C++ standard to compile with
]
ld_args = [
"-gc-sections", # Runs garbage collector on unused sections
# "-print-gc-sections", # Shows what symbols are getting thrown out
]
if __name__ == "__main__":
# Name your project and it's GameID
project = Project("MyMod", "GPVE01")
# Assign compiler args to the project
project.common_args = common_args
project.gcc_args = gcc_args
project.gpp_args = gpp_args
project.ld_args = ld_args
# Set the injection address for your code and data
project.set_base_address(0x80520E00)
# Setting an entry function is essential for -gc-sections to work it's magic. Make sure this function has
# C linkage
project.set_entry_function("Entry")
# If you're lucky to have a Codewarrior map, Freighter can append new symbols for debugging in Dolphin
project.set_symbol_map("GPVE01.map")
# You can manually define symbols in a linkerscript file.
project.add_linkerscript("c_symbols.ld")
# Freighter will attempt to automatically output a .map file to your Dolphin's Map folder if it can find it
# Add additional map outputs with this method
project.add_map_output("build/files/GPVE01.map")
project.add_gecko_folder("gecko/")
project.add_symbols_folder("symbols/")
# Freighter will attempt to auto import all source files within this folder
project.add_source_folder("source/")
# Freighter will remove these files added with add_source_folder
project.ignore_c_file("source/test.c")
project.ignore_cpp_file("source/test.cpp")
# You can also add source files explicitly if you want
project.add_asm_file("itWork.s")
project.add_c_file("uglyCode.c")
project.add_cpp_file("coolHacks.cpp")
# Write a b instruction that points to this symbol's address
# NOTE: Symbols with C-linkage (declared extern "C") don't need their parameters within ()
project.hook_branch("cringe", 0x800992C8)
# Write a bl to this symbol's address at each of these addresses
project.hook_branchlink("OnUpdateDoStuff(Game::BaseGameSection &)", 0x80102040, 0x8036D7E8, 0x80387F74)
# Write this symbol's address to a specific location. Useful for overriding vtable pointers.
project.hook_pointer("doMyStuffInstead(GameObject *, int)", 0x802B6708)
# Specify the input .dol file and build
project.build("pikmin2.dol", verbose=True, clean_up=True)
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 Distributions
File details
Details for the file freighter-0.0.1.tar.gz
.
File metadata
- Download URL: freighter-0.0.1.tar.gz
- Upload date:
- Size: 16.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.4.2 importlib_metadata/4.8.1 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.61.1 CPython/3.9.7
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | cc08c612278f47f03564ff0cb40661c54e919348402d478dc51ce573686d393d |
|
MD5 | dfe2cefdf2b1558c69c8f8d5e98b5efa |
|
BLAKE2b-256 | 8816d6598cd2f37b66741925e6e5ca1c99e4435118453f7ff1d4212eba41442f |
File details
Details for the file freighter-0.0.1-py3.9.egg
.
File metadata
- Download URL: freighter-0.0.1-py3.9.egg
- Upload date:
- Size: 33.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.4.2 importlib_metadata/4.8.1 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.61.1 CPython/3.9.7
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | da9751d71b4c98acedd14569cd1c6d14b1a25257dfe5e0c85ba8bf724c26209c |
|
MD5 | dabf42a159a70f2b7a3aa51ecdb04959 |
|
BLAKE2b-256 | 72bad9d995463464190e3713e5240dd2647d84c5d067973c1a5d1ba5791e8c8e |
File details
Details for the file freighter-0.0.1-py2.py3-none-any.whl
.
File metadata
- Download URL: freighter-0.0.1-py2.py3-none-any.whl
- Upload date:
- Size: 15.9 kB
- Tags: Python 2, Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.4.2 importlib_metadata/4.8.1 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.10.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 24763e29c9e2da4fb64874b91dbd8db23b12869466c92be020be655b0431b184 |
|
MD5 | a58fb9fc62cc63f0c528e3b1c7df2d3c |
|
BLAKE2b-256 | 40b65f24a249019d7ec256713631442d7efa428288bebcc4868d5cc8f7ba9152 |