Closed Ryzee119 closed 4 years ago
I think the underlying type of enum in C is int, so I guess your compiler isn't wrong. I think a good solution is to keep the definition as lcd_mode : 2
, but change the enum declaration to defines instead.
Would you be able to test this potential fix for me please? https://github.com/deltabeard/Peanut-GB/compare/bug/lcd_bitfields I tested it working with Pokemon Gold with the SDL2 example. Many thanks.
I can confirm that this fix works Thank you!
On some compilers lcd_mode enum is assumed
int
(I dont know why?) and notunsigned int
. Therefore the bitfield should be large enough to encompass the sign bithttps://github.com/deltabeard/Peanut-GB/blob/1ad02b57cd93600ea7899ec416ae95635b4160a6/peanut_gb.h#L376-L382
lcd_mode : 2
should belcd_mode : 3
?Currently I get warnings like this
warning: implicit truncation from 'int' to bit-field changes value from 3 to -1 [-Wbitfield-constant-conversion] gb->lcd_mode = LCD_TRANSFER;
and the screen is not rendered