Skip to content

Go library that can read and modify Pokémon Emerald save files

Notifications You must be signed in to change notification settings

huderlem/gomons

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

gomons

This is a Go library that can read and modify Pokémon Emerald save files. It is very much a work in progress, but contributions are welcome. Currently, it only supports save files generated by the no$gba emulator.

Example Usage

Here is a full working example that does some basic reading and modification.

package main

import (
	"bufio"
	"fmt"
	"os"

	"github.com/huderlem/gomons/gen3"
)

func main() {
	gameSave, _ := gen3.LoadSaveFile("pokeemerald.sav")
	if err := gameSave.CheckCorruption(); err != nil {
		// Save file is corrupted.
		return
	}

	// Print the player's name.
	fmt.Println(gameSave.GetPlayerName())

	// Give the player 9,999 money.
	gameSave.SetMoney(9999)

	// Save the modified save file to disk.
	f, _ := os.Create("pokeemerald.modified.sav")
	defer f.Close()
	fileWriter := bufio.NewWriter(f)
	gameSave.Write(fileWriter)
	fileWriter.Flush()
}

About

Go library that can read and modify Pokémon Emerald save files

Topics

Resources

Stars

Watchers

Forks

Languages