From f73d02b2478b65317b67ea87dc19f412275e63b8 Mon Sep 17 00:00:00 2001 From: duysqubix Date: Sun, 1 Oct 2023 21:25:43 -0500 Subject: [PATCH] Commit Message: "Commented out binary read/write operations in cartridge 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. --- internal/cartridge/cartridge.go | 8 ++++---- internal/motherboard/input.go | 17 ++++++++--------- 2 files changed, 12 insertions(+), 13 deletions(-) diff --git a/internal/cartridge/cartridge.go b/internal/cartridge/cartridge.go index 66d00b6..f613b58 100644 --- a/internal/cartridge/cartridge.go +++ b/internal/cartridge/cartridge.go @@ -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 @@ -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 diff --git a/internal/motherboard/input.go b/internal/motherboard/input.go index f2f1997..0779328 100644 --- a/internal/motherboard/input.go +++ b/internal/motherboard/input.go @@ -2,7 +2,6 @@ package motherboard import ( "bytes" - "encoding/binary" "github.com/duysqubix/gobc/internal" ) @@ -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 }