200sc / bebop

bebop wire format in Go
Apache License 2.0
71 stars 5 forks source link

Mismatching opcodes #29

Closed merlindru closed 2 years ago

merlindru commented 2 years ago

The opcodes generated using rainway's JS bebop-tools are in little-endian, the ones generated using this lib are in big-endian (which might make more sense?)

Either way, this means that they mismatch by default. What's a good solution for this problem? Do we even need* a solution?!

*currently, I'm shifting them around manually so they're either all little-endian or all big-endian

200sc commented 2 years ago

Happy to look into this!

This looks like it only applies to string op codes?

bebop:
[opcode("IKEA")]
message RequestCatalog {
...
}

[opcode(0x31323334)]
readonly struct RequestResponse {
...
}

rainway js: (bebopc 2.4.2)

export const RequestCatalog = {
  opcode: 0x41454B49,

export const RequestResponse = {
  opcode: 0x31323334,

200sc: (main branch):

const RequestCatalogOpCode = 0x494b4541

const RequestResponseOpCode = 0x31323334

I think we should treat this as a bug and patch it; the wiki page that rainway refers to (https://en.wikipedia.org/wiki/FourCC) is honestly not clear to me; they attest that avc1 is encoded both little and big endian at different parts of the page. So while I think there's an argument one is clearer than another, if rainway is already doing it in one way, we should emulate that.