diff --git a/cmd/magic/main.go b/cmd/magic/main.go index 6b1cafa..f5c0af3 100644 --- a/cmd/magic/main.go +++ b/cmd/magic/main.go @@ -52,10 +52,15 @@ 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 @@ -63,7 +68,7 @@ func writeNewFiles(internal map[models.System][]models.Entry) error { _ = 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 } diff --git a/docs/signatures/gba.md b/docs/signatures/gba.md index 47c285d..b2ddb99 100644 --- a/docs/signatures/gba.md +++ b/docs/signatures/gba.md @@ -1,3 +1,5 @@ +# Game Boy Advance CRC32s, cartridge signatures, and magic numbers + ## Advance Wars - CRC32: `0x26fd0fc9` diff --git a/docs/signatures/sms.md b/docs/signatures/sms.md index 41f12d4..eecc574 100644 --- a/docs/signatures/sms.md +++ b/docs/signatures/sms.md @@ -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` diff --git a/pkg/io/io.go b/pkg/io/io.go index da8d133..9c1b83b 100644 --- a/pkg/io/io.go +++ b/pkg/io/io.go @@ -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 ( diff --git a/pkg/io/resources/sms.json b/pkg/io/resources/sms.json index 2c229b2..5dfa5b4 100644 --- a/pkg/io/resources/sms.json +++ b/pkg/io/resources/sms.json @@ -1,4 +1,11 @@ [ + { + "system": 4, + "name": "Choplifter", + "crc": "0x4a21c15f", + "signature": "0xa42d8baf", + "magic": "0x198c" + }, { "system": 4, "name": "Double Dragon", diff --git a/pkg/ui/menus.go b/pkg/ui/menus.go index 28a2973..e59259e 100644 --- a/pkg/ui/menus.go +++ b/pkg/ui/menus.go @@ -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 { @@ -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 { @@ -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 {