Closed hazelwarez closed 1 year ago
Great thanks for catching this! I'll do a quick check later and merge this in. I suspect the issue also exists with the gb editor which I can address.
I confirmed the bug you found, nice job noticing that.
Unfortunately this patch doesn't seem to work correctly (at least on Firefox & Chrome), it looks liketoString(16)
doesn't do what you'd expect on uint8array elements when iterating with map. Here's the patch I used to test
everdrive_gba_v16_theme_patch.ips.zip
Looks like .map
on a typed array creates a new array of the same type - https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/TypedArray/map
Fixed in https://github.com/orangeglo/everdrive-gba-editor/commit/b3d8fbd5f580d57d40b8c1ce5dd2cec9c3caa7ff , thanks again for noticing this issue
offsetStr
will be incorrect when the second or third byte value is < 16 (that is, results in a hex string with only a single digit).This becomes an issue due to the predefined offset
0x6A08
being read as the single byte0x8
and converted to a hex string without adding a padding zero. In other words, the array[0, 106, 8]
ends up as the number1704
(0x6A8
) rather than27144
(0x6A08
). It is then skipped when the callbackvalToState[d.offset]
evaluates toundefined
and is never called.This fix also adds an additional
0
to the first byte value0x6
which is ignored byparseInt
and does not change the value.