Convert Figma logo to code with AI

kwsch logoPKHeX

Pokémon Save File Editor

3,970
752
3,970
5

Top Related Projects

Database project of box and inventory sprites from the Pokémon core series games

4,614

The Pokémon API

1,475

more than you ever wanted to know about Pokémon

Pokémon battle simulator.

Quick Overview

PKHeX is a Pokémon save file editor and manipulation tool. It allows users to modify and manage save files from various Pokémon games across different platforms. PKHeX provides a user-friendly interface for editing Pokémon data, items, and other game-related information.

Pros

  • Supports a wide range of Pokémon games from multiple generations
  • Offers a comprehensive set of editing features for Pokémon, items, and game data
  • Regularly updated to support new game releases and features
  • Open-source project with an active community

Cons

  • Can be used to create illegitimate Pokémon, potentially impacting competitive play
  • Requires some knowledge of Pokémon game mechanics to use effectively
  • May void warranty or violate terms of service for online features if used improperly
  • Learning curve for advanced features and functionality

Code Examples

// Load a save file
var sav = SaveUtil.GetVariantSAV(File.ReadAllBytes("path/to/save.sav"));

// Get the first Pokémon in the party
var pokemon = sav.GetPartySlot(0);

// Modify the Pokémon's level
pokemon.CurrentLevel = 50;

// Save changes back to the file
File.WriteAllBytes("path/to/modified_save.sav", sav.Write());
// Create a new Pokémon
var pk = sav.BlankPKM;
pk.Species = (int)Species.Pikachu;
pk.Move1 = (int)Move.ThunderBolt;
pk.Gender = 0; // Male

// Add the Pokémon to the first empty box slot
sav.SetBoxSlot(pk, 0, 0);
// Modify player information
sav.OT = "New Trainer Name";
sav.TID = 12345;
sav.SID = 54321;

// Add items to the bag
sav.SetInventoryPouch(InventoryType.Items, new[] { new InventoryItem(1, 99) }); // 99 Poké Balls

Getting Started

To use PKHeX in your C# project:

  1. Clone the repository: git clone https://github.com/kwsch/PKHeX.git
  2. Open the solution in Visual Studio
  3. Build the project
  4. Reference the PKHeX.Core dll in your project
  5. Use the following namespaces:
using PKHeX.Core;
using System.IO;

// Your code here
var sav = SaveUtil.GetVariantSAV(File.ReadAllBytes("path/to/save.sav"));
// Continue with save file manipulation

Competitor Comparisons

Database project of box and inventory sprites from the Pokémon core series games

Pros of pokesprite

  • Focused specifically on Pokémon sprites and icons
  • Lightweight and easy to integrate into web projects
  • Includes a wide variety of Pokémon forms and variations

Cons of pokesprite

  • Limited functionality compared to PKHeX's comprehensive features
  • Not designed for save file editing or game data manipulation
  • Less frequent updates and smaller community support

Code Comparison

PKHeX (C#):

public class PKM
{
    public int Species { get; set; }
    public int Form { get; set; }
    public bool IsShiny { get; set; }
}

pokesprite (JavaScript):

const pokesprite = require('pokesprite');
const sprite = pokesprite.getPokemon('pikachu', {gender: 'female'});
console.log(sprite.path);

Summary

PKHeX is a comprehensive Pokémon save file editor with extensive features for game data manipulation. It's written in C# and has a large, active community.

pokesprite, on the other hand, is a lightweight JavaScript library focused on providing Pokémon sprites and icons for web projects. It offers easy integration but has limited functionality compared to PKHeX.

While PKHeX is ideal for advanced Pokémon game editing, pokesprite is better suited for developers looking to add Pokémon imagery to their web applications quickly and easily.

4,614

The Pokémon API

Pros of pokeapi

  • Provides a RESTful API for easy access to Pokémon data
  • Comprehensive database covering various aspects of the Pokémon universe
  • Well-documented and suitable for integration into various applications

Cons of pokeapi

  • Limited to data retrieval; doesn't offer save file editing capabilities
  • Requires internet connectivity for data access
  • May have rate limits or usage restrictions

Code Comparison

pokeapi (Python client example):

import requests

response = requests.get('https://pokeapi.co/api/v2/pokemon/pikachu')
data = response.json()
print(f"Name: {data['name']}, Height: {data['height']}")

PKHeX (C# save file editing example):

using PKHeX.Core;

var sav = SaveUtil.GetBlankSAV(GameVersion.SW, "Player");
var pk = sav.GetLegalFromTemplate(new ShowdownSet("Pikachu"));
sav.SetBoxSlotAtIndex(pk, 0, 0);

Key Differences

  • pokeapi focuses on providing Pokémon data through an API, while PKHeX is a save file editor for Pokémon games
  • PKHeX offers more advanced features for modifying game data, while pokeapi is primarily for data retrieval
  • pokeapi is language-agnostic and can be used with various programming languages, whereas PKHeX is a C# application
1,475

more than you ever wanted to know about Pokémon

Pros of Pokedex

  • More comprehensive Pokémon data coverage, including detailed information on moves, abilities, and items
  • Better suited for building Pokémon-related applications and websites
  • Actively maintained with regular updates to include new Pokémon and game data

Cons of Pokedex

  • Less focused on save file editing and manipulation
  • May require more setup and integration for specific use cases
  • Lacks GUI, primarily a data repository

Code Comparison

PKHeX (C#):

public class PKM
{
    public int Species { get; set; }
    public int Level { get; set; }
    public int HP { get; set; }
    // More properties and methods...
}

Pokedex (Python):

class Pokemon:
    def __init__(self, id, name, types):
        self.id = id
        self.name = name
        self.types = types
    # More attributes and methods...

The code snippets show that PKHeX focuses on Pokémon data structures for save file manipulation, while Pokedex provides a more general-purpose Pokémon data model. PKHeX uses C# for its implementation, which is suitable for desktop applications, while Pokedex uses Python, making it more accessible for web and data analysis projects.

Pokémon battle simulator.

Pros of Pokemon Showdown

  • Web-based platform accessible from any device with a browser
  • Supports multiplayer battles and a large active community
  • Implements a wide range of competitive formats and rulesets

Cons of Pokemon Showdown

  • Limited to battle simulation, lacks Pokémon management features
  • Doesn't interact with official game data or save files

Code Comparison

PKHeX (C#):

public class PKM
{
    public int Species { get; set; }
    public int Nature { get; set; }
    public int[] EVs { get; set; }
    public int[] IVs { get; set; }
}

Pokemon Showdown (JavaScript):

class Pokemon {
  constructor(species, nature, evs, ivs) {
    this.species = species;
    this.nature = nature;
    this.evs = evs;
    this.ivs = ivs;
  }
}

Summary

PKHeX is a save editor and Pokémon management tool for official games, while Pokemon Showdown is a battle simulator. PKHeX offers more comprehensive Pokémon editing features and interacts with game data, but is limited to desktop use. Pokemon Showdown provides accessible online battles and a large community, but lacks save file integration. The code structures reflect their different focuses, with PKHeX using more complex data types for game compatibility and Pokemon Showdown using simpler objects for battle simulation.

Convert Figma logo designs to code with AI

Visual Copilot

Introducing Visual Copilot: A new AI model to turn Figma designs to high quality code using your components.

Try Visual Copilot

README

PKHeX

License

Pokémon core series save editor, programmed in C#.

Supports the following files:

  • Save files ("main", *.sav, *.dsv, *.dat, *.gci, *.bin)
  • GameCube Memory Card files (*.raw, *.bin) containing GC Pokémon savegames.
  • Individual Pokémon entity files (.pk*, *.ck3, *.xk3, *.pb7, *.sk2, *.bk4, *.rk4)
  • Mystery Gift files (*.pgt, *.pcd, *.pgf, .wc*) including conversion to .pk*
  • Importing GO Park entities (*.gp1) including conversion to .pb7
  • Importing teams from Decrypted 3DS Battle Videos
  • Transferring from one generation to another, converting formats along the way.

Data is displayed in a view which can be edited and saved. The interface can be translated with resource/external text files so that different languages can be supported.

Pokémon Showdown sets and QR codes can be imported/exported to assist in sharing.

PKHeX expects save files that are not encrypted with console-specific keys. Use a savedata manager to import and export savedata from the console (Checkpoint, save_manager, JKSM, or SaveDataFiler).

We do not support or condone cheating at the expense of others. Do not use significantly hacked Pokémon in battle or in trades with those who are unaware hacked Pokémon are in use.

Screenshots

Main Window

Building

PKHeX is a Windows Forms application which requires .NET 9.0.

The executable can be built with any compiler that supports C# 13.

Build Configurations

Use the Debug or Release build configurations when building. There isn't any platform specific code to worry about!

Dependencies

PKHeX's QR code generation code is taken from QRCoder, which is licensed under the MIT license.

PKHeX's shiny sprite collection is taken from pokesprite, which is licensed under the MIT license.

PKHeX's Pokémon Legends: Arceus sprite collection is taken from the National Pokédex - Icon Dex project and its abundance of collaborators and contributors.

IDE

PKHeX can be opened with IDEs such as Visual Studio by opening the .sln or .csproj file.