Skip to content

The backend for PokEditor v3, a Pokémon gen 4 editing tool

Notifications You must be signed in to change notification settings

turtleisaac/PokEditor-Core

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 

Repository files navigation

PokEditor-Core

Author: Turtleisaac

This library provides functionality for reading and writing various forms of game data for the Gen 4 Pokémon games and serves as the backend for PokEditor v3, my Gen 4 hacking tool.

Feel free to use this library for your own projects relating to the Gen 4 Pokémon games, given that you provide credit to me.

Dependencies

Nds4j, my library for interacting with, reading, editing, and writing the general proprietary Nintendo DS file formats, is required.

If you go to build PokEditor-Core yourself, please place your own legally obtained Pokémon HeartGold ROM in the root directory of the repo and name it "HeartGold.nds", and a Platinum ROM named "Platinum.nds". These will be accessed as part of the unit tests.

Usage

As this is a library, there is nothing for you to run in terms of a JAR file or Main method. You need to write all the code to make use of my library yourself.

When you go to use PokEditor-Core, the first thing your program needs to do is define which game you are using, so it knows which set of file paths it needs to use.

// create a NintendoDsRom object using something like NintendoDsRom.fromFile(<path to rom>)
NintendoDsRom rom = NintendoDsRom.fromFile("path to rom");
Game game = Game.parseBaseRom(rom.getGameCode());
GameFiles.initialize(game);
TextFiles.initialize(game);
GameCodeBinaries.initialize(game);
Tables.initialize(game);

Once you have ran the four initialize methods, your code can make use of the library without much further pain. Here is an example which works with species personal data:

byte[] file = rom.getFileByName(GameFiles.PERSONAL.getPath());
Narc personalNarc = new Narc(file);
Map<GameFiles, Narc> narcMap = new HashMap<>();
narcMap.put(GameFiles.PERSONAL, personalNarc);


MainCodeFile arm9 = rom.loadArm9();
Map<GameCodeBinaries, CodeBinary> codeBinaries = Collections.singletonMap(GameCodeBinaries.ARM9, arm9);

PersonalParser parser = new PersonalParser();
List<PersonalData> data = parser.generateDataList(narcMap, codeBinaries);

PersonalData turtwig = data.get(493);
turtwig.setAtk(255); // turtwig will now have a base attack stat of 255
narcMap = parser.processDataList(data, codeBinaries);

personalNarc = narcMap.get(GameFiles.PERSONAL);
rom.setFileByName(GameFiles.PERSONAL.getPath(), personalNarc.save());

// save the modified ROM to disk
rom.saveToFile("output rom path", false);

Troubleshooting

If you are having trouble building PokEditor-Core, make sure you have a "HeartGold.nds" and "Platinum.nds" ROM in the root directory of your local repo, as these are needed for the unit tests.

Additionally, there are some sources which need to be generated by maven/antlr4 which don't always get generated and compiled for some reason, so try running mvn generate-sources in the terminal/command-line from within the repo root to get those to appear. You may need to mark the directory src/main/generated-sources as a generated sources root afterwards.

About

The backend for PokEditor v3, a Pokémon gen 4 editing tool

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published