Skip to content

Commit

Permalink
v6 release
Browse files Browse the repository at this point in the history
  • Loading branch information
dingdongg committed Jun 16, 2024
1 parent 55160f6 commit c6b6bbd
Show file tree
Hide file tree
Showing 15 changed files with 41 additions and 41 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ Application used to parse in-game information in generation IV/V Pokemon games.

## Installation
```sh
go get github.com/dingdongg/pkmn-rom-parser/v5
go get github.com/dingdongg/pkmn-rom-parser/v6
```

## Usage
Expand Down
2 changes: 1 addition & 1 deletion crypt/crypt.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import (
"encoding/binary"
"log"

"github.com/dingdongg/pkmn-rom-parser/v5/prng"
"github.com/dingdongg/pkmn-rom-parser/v6/prng"
)

// Computes a checksum via the CRC16-CCITT algorithm on the given data
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
module github.com/dingdongg/pkmn-rom-parser/v5
module github.com/dingdongg/pkmn-rom-parser/v6

go 1.22.3

Expand Down
2 changes: 1 addition & 1 deletion items/items.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import (
"strconv"
"strings"

"github.com/dingdongg/pkmn-rom-parser/v5/path_resolver"
"github.com/dingdongg/pkmn-rom-parser/v6/path_resolver"
)

// fetch item names and cache in RAM to prevent multiple file IO operations
Expand Down
12 changes: 6 additions & 6 deletions parser.go
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
package parser

import (
"github.com/dingdongg/pkmn-rom-parser/v5/consts"
"github.com/dingdongg/pkmn-rom-parser/v5/rom_reader"
"github.com/dingdongg/pkmn-rom-parser/v5/rom_writer"
"github.com/dingdongg/pkmn-rom-parser/v5/rom_writer/req"
"github.com/dingdongg/pkmn-rom-parser/v5/validator"
"github.com/dingdongg/pkmn-rom-parser/v5/validator/locator"
"github.com/dingdongg/pkmn-rom-parser/v6/consts"
"github.com/dingdongg/pkmn-rom-parser/v6/rom_reader"
"github.com/dingdongg/pkmn-rom-parser/v6/rom_writer"
"github.com/dingdongg/pkmn-rom-parser/v6/rom_writer/req"
"github.com/dingdongg/pkmn-rom-parser/v6/validator"
"github.com/dingdongg/pkmn-rom-parser/v6/validator/locator"
)

func Parse(savefile []byte) ([]rom_reader.Pokemon, error) {
Expand Down
10 changes: 5 additions & 5 deletions rom_reader/rom_reader.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@ import (
"encoding/binary"
"log"

"github.com/dingdongg/pkmn-rom-parser/v5/char"
"github.com/dingdongg/pkmn-rom-parser/v5/consts"
"github.com/dingdongg/pkmn-rom-parser/v5/crypt"
"github.com/dingdongg/pkmn-rom-parser/v5/data"
"github.com/dingdongg/pkmn-rom-parser/v5/shuffler"
"github.com/dingdongg/pkmn-rom-parser/v6/char"
"github.com/dingdongg/pkmn-rom-parser/v6/consts"
"github.com/dingdongg/pkmn-rom-parser/v6/crypt"
"github.com/dingdongg/pkmn-rom-parser/v6/data"
"github.com/dingdongg/pkmn-rom-parser/v6/shuffler"
)

type Stats struct {
Expand Down
2 changes: 1 addition & 1 deletion rom_reader/rom_reader_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import (
"os"
"testing"

"github.com/dingdongg/pkmn-rom-parser/v5/consts"
"github.com/dingdongg/pkmn-rom-parser/v6/consts"
"github.com/google/go-cmp/cmp"
)

Expand Down
12 changes: 6 additions & 6 deletions rom_writer/req/impl.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ import (
"fmt"
"log"

"github.com/dingdongg/pkmn-rom-parser/v5/char"
"github.com/dingdongg/pkmn-rom-parser/v5/data"
"github.com/dingdongg/pkmn-rom-parser/v6/char"
"github.com/dingdongg/pkmn-rom-parser/v6/data"
)

func (wr WriteRequest) WriteItem(itemName string) {
Expand Down Expand Up @@ -80,15 +80,15 @@ func (wev WriteEffortValue) Bytes() ([]byte, error) {
func (wiv WriteIndivValue) Bytes() ([]byte, error) {
buf := uint32(0)
stats := [6]uint{wiv.Hp, wiv.Attack, wiv.Defense, wiv.Speed, wiv.SpAttack, wiv.SpDefense}

for i, s := range stats {
if s > 31 {
return []byte{} , fmt.Errorf("individual value must be <= 31")
return []byte{}, fmt.Errorf("individual value must be <= 31")
}
masked := s & 0b11111
buf |= uint32(masked << (i * 5))
}

res := make([]byte, 4)
binary.LittleEndian.PutUint32(res, buf)
return res, nil
Expand Down Expand Up @@ -139,4 +139,4 @@ func (ws WriteString) Bytes() ([]byte, error) {
}

return res, nil
}
}
4 changes: 2 additions & 2 deletions rom_writer/req/req.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ package req
import (
"fmt"

"github.com/dingdongg/pkmn-rom-parser/v5/consts"
"github.com/dingdongg/pkmn-rom-parser/v5/shuffler"
"github.com/dingdongg/pkmn-rom-parser/v6/consts"
"github.com/dingdongg/pkmn-rom-parser/v6/shuffler"
)

const (
Expand Down
16 changes: 8 additions & 8 deletions rom_writer/req/req_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ import (
"encoding/binary"
"testing"

"github.com/dingdongg/pkmn-rom-parser/v5/char"
"github.com/dingdongg/pkmn-rom-parser/v5/tutil"
"github.com/dingdongg/pkmn-rom-parser/v6/char"
"github.com/dingdongg/pkmn-rom-parser/v6/tutil"
)

var templates = tutil.GetTemplates()
Expand Down Expand Up @@ -80,7 +80,7 @@ func TestWriteBattleStats(t *testing.T) {
wr := NewWriteRequest(0)
stats := [6]uint{65535, 0, 124, 7000, 333, 255}
wr.WriteBattleStats(stats[0], stats[1], stats[2], stats[4], stats[5], stats[3])

res, ok := wr.Contents[BATTLE_STATS]

if !ok {
Expand All @@ -98,7 +98,7 @@ func TestWriteBattleStats(t *testing.T) {

for i := 0; i < len(byteForm); i += 2 {
t.Logf("index %d\n", i)
expected := stats[i / 2]
expected := stats[i/2]
actual := binary.LittleEndian.Uint16(byteForm[i : i+2])
if actual != uint16(expected) {
t.Fatalf(templates.UintHex, expected, actual)
Expand Down Expand Up @@ -169,7 +169,7 @@ func TestWriteIV(t *testing.T) {

func TestWriteNicknameTooLong(t *testing.T) {
wr := NewWriteRequest(0)
name := "way too long of a anme";
name := "way too long of a anme"
wr.WriteNickname(name)

res, ok := wr.Contents[NICKNAME]
Expand Down Expand Up @@ -212,15 +212,15 @@ func TestWriteNickname(t *testing.T) {
}
}

nullTerminator := binary.LittleEndian.Uint16(byteForm[len(name)*2 : len(name)*2+2])
nullTerminator := binary.LittleEndian.Uint16(byteForm[len(name)*2 : len(name)*2+2])
if nullTerminator != 65535 {
t.Fatalf(templates.UintHex, 65535, nullTerminator)
}

zerosIndex := len(name) * 2 + 2
zerosIndex := len(name)*2 + 2
for i := zerosIndex; i < 22; i++ {
if byteForm[i] != 0 {
t.Fatalf(templates.Uint, 0, byteForm[i])
}
}
}
}
10 changes: 5 additions & 5 deletions rom_writer/rom_writer.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@ import (
"encoding/binary"
"fmt"

"github.com/dingdongg/pkmn-rom-parser/v5/consts"
"github.com/dingdongg/pkmn-rom-parser/v5/crypt"
"github.com/dingdongg/pkmn-rom-parser/v5/rom_writer/req"
"github.com/dingdongg/pkmn-rom-parser/v5/shuffler"
"github.com/dingdongg/pkmn-rom-parser/v5/validator"
"github.com/dingdongg/pkmn-rom-parser/v6/consts"
"github.com/dingdongg/pkmn-rom-parser/v6/crypt"
"github.com/dingdongg/pkmn-rom-parser/v6/rom_writer/req"
"github.com/dingdongg/pkmn-rom-parser/v6/shuffler"
"github.com/dingdongg/pkmn-rom-parser/v6/validator"
)

/*
Expand Down
2 changes: 1 addition & 1 deletion shuffler/shuffler.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import (
"fmt"
"strings"

"github.com/dingdongg/pkmn-rom-parser/v5/consts"
"github.com/dingdongg/pkmn-rom-parser/v6/consts"
)

// from https://projectpokemon.org/home/docs/gen-4/pkm-structure-r65/
Expand Down
2 changes: 1 addition & 1 deletion shuffler/shuffler_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package shuffler
import (
"testing"

"github.com/dingdongg/pkmn-rom-parser/v5/consts"
"github.com/dingdongg/pkmn-rom-parser/v6/consts"
)

func TestGetUnshuffledPos(t *testing.T) {
Expand Down
2 changes: 1 addition & 1 deletion validator/locator/locator.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package locator

import "github.com/dingdongg/pkmn-rom-parser/v5/validator"
import "github.com/dingdongg/pkmn-rom-parser/v6/validator"

// return address to the start of the latest save chunk
// REQUIREMENT: savefile must be the entire .SAV file
Expand Down
2 changes: 1 addition & 1 deletion validator/validator.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import (
"errors"
"fmt"

"github.com/dingdongg/pkmn-rom-parser/v5/crypt"
"github.com/dingdongg/pkmn-rom-parser/v6/crypt"
)

/*
Expand Down

0 comments on commit c6b6bbd

Please sign in to comment.