Skip to content

Commit

Permalink
update interface to use ISave methods
Browse files Browse the repository at this point in the history
  • Loading branch information
dingdongg committed Jun 19, 2024
1 parent ca401f9 commit fa8d7a8
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
5 changes: 2 additions & 3 deletions parser.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ func Parse(savefile []byte) ([]rom_reader.Pokemon, error) {
return []rom_reader.Pokemon{}, err
}

partyData := rom_reader.GetPartyPokemon(game.GetPartySection(), game.GetPartySize())
partyData := rom_reader.GetPartyPokemon(game)
return partyData, nil
}

Expand All @@ -23,6 +23,5 @@ func Write(savefile []byte, newBytes []req.WriteRequest) ([]byte, error) {
return []byte{}, err
}

chunk := game.GetLatestData()
return rom_writer.UpdatePartyPokemon(savefile, *chunk, newBytes)
return rom_writer.UpdatePartyPokemon(game, newBytes)
}
5 changes: 4 additions & 1 deletion rom_reader/rom_reader.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import (
"github.com/dingdongg/pkmn-rom-parser/v7/consts"
"github.com/dingdongg/pkmn-rom-parser/v7/crypt"
"github.com/dingdongg/pkmn-rom-parser/v7/data"
"github.com/dingdongg/pkmn-rom-parser/v7/sav"
"github.com/dingdongg/pkmn-rom-parser/v7/shuffler"
)

Expand Down Expand Up @@ -58,7 +59,9 @@ const (
)

// TODO: update function to use ISave methods instead
func GetPartyPokemon(ciphertext []byte, size uint32) []Pokemon {
func GetPartyPokemon(game sav.ISave) []Pokemon {
size := game.PartySize()
ciphertext := game.PartySection()
var party []Pokemon

for i := uint(0); i < uint(size); i++ {
Expand Down

0 comments on commit fa8d7a8

Please sign in to comment.