Hey all, thanks for reading. Today is my first attempt at getting some
hands on with Ruby. So far so good, but I’m having a slight issue I hope
to clear up.
Anyways, I decided to write a SRAM save file editor for a popular
GameBoy game. Problem is for some reason putc is writing 2 bytes when
ever I try to write 0x0A. It instead writes 0D 0A into the file.
Heres my code (go easy, first attempt at Ruby ever xD )
printf("Enter new item value from the list above: ")
@NewItemB = STDIN.gets.chomp #1
@NewItemB = @NewItemB.hex
@SaveFile.pos = “0x405”.hex
@SaveFile.putc @NewItemB #2
If I type “a” at the gets for #1, once it gets to #2 is putc’s 0D 0A.
If I enter 0-9 or B-F it works just fine, the problem seems to only be
with A. For the past few hours I’ve been scratching my head. I have no
clue why it is doing that, when other values work just fine.
Any help is greatly appreciated, it’s not a crucial project by any
means. Just a learning experience.
Thanks in advance for your help!