Skip to content

Commit

Permalink
Commit Message: "Commented out binary read/write operations in cartri…
Browse files Browse the repository at this point in the history
…dge and input modules"

Added:
- No new features added.

Changed:
- Commented out binary.Write operation for RomBanksCount in Serialize function in cartridge.go.
- Commented out binary.Read operation for RomBanksCount in Deserialize function in cartridge.go.
- Commented out binary.Write operations for directional and standard in Serialize function in input.go.
- Commented out binary.Read operations for directional and standard in Deserialize function in input.go.

Removed:
- Removed import statement for "encoding/binary" in input.go.
  • Loading branch information
duysqubix committed Oct 2, 2023
1 parent 6c1ac78 commit f73d02b
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 13 deletions.
8 changes: 4 additions & 4 deletions internal/cartridge/cartridge.go
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ func (c *Cartridge) Serialize() *bytes.Buffer {
// binary.Write(buf, binary.LittleEndian, bank)
// }

binary.Write(buf, binary.LittleEndian, c.RomBanksCount) // ROM Bank Count
// binary.Write(buf, binary.LittleEndian, c.RomBanksCount) // ROM Bank Count
binary.Write(buf, binary.LittleEndian, c.RomBankSelected) // ROM Bank Selected

binary.Write(buf, binary.LittleEndian, c.RamBanks) // RAM
Expand All @@ -140,9 +140,9 @@ func (c *Cartridge) Serialize() *bytes.Buffer {
func (c *Cartridge) Deserialize(data *bytes.Buffer) error {
// Read the data from the buffer

if err := binary.Read(data, binary.LittleEndian, &c.RomBanksCount); err != nil {
return err
}
// if err := binary.Read(data, binary.LittleEndian, &c.RomBanksCount); err != nil {
// return err
// }

if err := binary.Read(data, binary.LittleEndian, &c.RomBankSelected); err != nil {
return err
Expand Down
17 changes: 8 additions & 9 deletions internal/motherboard/input.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ package motherboard

import (
"bytes"
"encoding/binary"

"github.com/duysqubix/gobc/internal"
)
Expand Down Expand Up @@ -43,19 +42,19 @@ type Input struct {

func (i *Input) Serialize() *bytes.Buffer {
buf := new(bytes.Buffer)
binary.Write(buf, binary.LittleEndian, i.directional)
binary.Write(buf, binary.LittleEndian, i.standard)
// binary.Write(buf, binary.LittleEndian, i.directional)
// binary.Write(buf, binary.LittleEndian, i.standard)
return buf
}

func (i *Input) Deserialize(data *bytes.Buffer) error {
// Read the data from the buffer
if err := binary.Read(data, binary.LittleEndian, &i.directional); err != nil {
return err
}
if err := binary.Read(data, binary.LittleEndian, &i.standard); err != nil {
return err
}
// if err := binary.Read(data, binary.LittleEndian, &i.directional); err != nil {
// return err
// }
// if err := binary.Read(data, binary.LittleEndian, &i.standard); err != nil {
// return err
// }

return nil
}
Expand Down

0 comments on commit f73d02b

Please sign in to comment.