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.
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()
}