bsnes icon indicating copy to clipboard operation
bsnes copied to clipboard

Uninitialized use of local variable in bsmemory.cpp

Open CasualPokePlayer opened this issue 2 years ago • 2 comments

https://github.com/bsnes-emu/bsnes/blob/5cefce5c08f74cfc80eee3f82a32d846144e5277/bsnes/sfc/slot/bsmemory/bsmemory.cpp#L319-L329

Not sure what was the actual intent behind this. Was it so address may be "reused" each iteration? (so hoping that it starts at 0 and keeps the value of the previous iteration cycle, i.e. like if address was defined above the loop and set to 0, this appears to be what compilers output anyways?). Or was it actually meant to always start at 0 for each iteration cycle? (so a simple = 0 would give the intended behavior).

CasualPokePlayer avatar Mar 22 '23 11:03 CasualPokePlayer

That's a good question.

Searching the web for "LH28F800SUT" I found a datasheet that confirmed that 0x99 0xd0 was the sequence to request the "Upload Device Information" operation. However, the datasheet doesn't describe what it does, nor does fullsnes or this SNESdev thread where nocash and Near are talking about BS-X datapacks.

I assume Near figured it out based on actually tinkering with a data pack and figuring out what it was doing.

Screwtapello avatar Mar 22 '23 13:03 Screwtapello

Well, there are quite a few guesses and unknowns mentioned in the comments, so I think it's safe to conclude that it's not a mature or fully debugged piece of code.

Does any games break if you move the uint8 declaration outside the loop?

jeffythedragonslayer avatar Jun 11 '23 03:06 jeffythedragonslayer