Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docs: add some extra signatures #44

Merged
merged 1 commit into from
Oct 22, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 7 additions & 2 deletions cmd/magic/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -52,18 +52,23 @@ func writeNewFiles(internal map[models.System][]models.Entry) error {

// Create the json files
d, err := os.Getwd()
md := fmt.Sprintf("%s/docs/signatures", d)
jsons := fmt.Sprintf("%s/pkg/io/resources", d)
if err != nil {
return err
}
j, err := os.Create(fmt.Sprintf("%s/%s.json", jsons, strings.ToLower(k.String())))
if err != nil {
return err
}
j, err := os.Create(fmt.Sprintf("%s/%s.json", d, strings.ToLower(k.String())))
if err := io.SaveInternal(j, v); err != nil {
_ = j.Close()
return err
}
_ = j.Close()

// Create the .md files
m, err := os.Create(fmt.Sprintf("%s/%s.md", d, strings.ToLower(k.String())))
m, err := os.Create(fmt.Sprintf("%s/%s.md", md, strings.ToLower(k.String())))
if err != nil {
return err
}
Expand Down
2 changes: 2 additions & 0 deletions docs/signatures/gba.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# Game Boy Advance CRC32s, cartridge signatures, and magic numbers

## Advance Wars

- CRC32: `0x26fd0fc9`
Expand Down
6 changes: 6 additions & 0 deletions docs/signatures/sms.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
# Sega Master System CRC32s, cartridge signatures, and magic numbers

## Choplifter

- CRC32: `0x4a21c15f`
- Signature: `0xa42d8baf`
- Magic Number: `0x198c`

## Double Dragon

- CRC32: `0xf4f848c2`
Expand Down
2 changes: 1 addition & 1 deletion pkg/io/io.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ import (
"github.com/g026r/pocket-toolkit/pkg/util"
)

// TODO: Uncomment this once I have a more complete dataset //go:embed resources/*.json
//go:embed resources/*.json
var jsons embed.FS

const (
Expand Down
7 changes: 7 additions & 0 deletions pkg/io/resources/sms.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,11 @@
[
{
"system": 4,
"name": "Choplifter",
"crc": "0x4a21c15f",
"signature": "0xa42d8baf",
"magic": "0x198c"
},
{
"system": 4,
"name": "Double Dragon",
Expand Down
20 changes: 12 additions & 8 deletions pkg/ui/menus.go
Original file line number Diff line number Diff line change
Expand Up @@ -57,11 +57,11 @@ var (
)

// menuItem is used for each menu that isn't a game list
// text represents the text to display
// key is the result that should be checked to determine the item selected
type menuItem struct {
// text represents the text to display
text string
key menuKey
// key is the unique value used to determine the item selected
key menuKey
}

func (m menuItem) FilterValue() string {
Expand Down Expand Up @@ -251,8 +251,10 @@ type itemDelegate struct{}
func (d itemDelegate) Height() int { return 1 }
func (d itemDelegate) Spacing() int { return 0 }

// We're not using Update to process key presses as we need to update the Model in some cases & we don't have access to it.
func (d itemDelegate) Update(_ tea.Msg, _ *list.Model) tea.Cmd { return nil }
func (d itemDelegate) Update(_ tea.Msg, _ *list.Model) tea.Cmd {
// We're not using Update to process key presses as we need to update the Model in some cases & we don't have access to it.
return nil
}
func (d itemDelegate) Render(w goio.Writer, m list.Model, index int, listItem list.Item) {
i, ok := listItem.(fmt.Stringer)
if !ok {
Expand Down Expand Up @@ -303,9 +305,11 @@ type configDelegate struct {
func (d configDelegate) Height() int { return 1 }
func (d configDelegate) Spacing() int { return 0 }

// While we could conceivably use Update for the config menu, as we have a pointer to the object being updated, we're not
// just to keep the menu processing code all in one spot
func (d configDelegate) Update(_ tea.Msg, _ *list.Model) tea.Cmd { return nil }
func (d configDelegate) Update(_ tea.Msg, _ *list.Model) tea.Cmd {
// While we could conceivably use Update for the config menu, as we have a pointer to the object being updated, we're not
// going to sole to keep the menu processing code all in one spot
return nil
}
func (d configDelegate) Render(w goio.Writer, m list.Model, index int, listItem list.Item) {
i, ok := listItem.(menuItem)
if !ok {
Expand Down
Loading