Fixed UB in screen
This commit is contained in:
parent
8f1766f096
commit
fa4da132b9
|
@ -31,8 +31,8 @@ screen_2bpp(Uint8 *layer, Uint8 *addr, Uint16 x1, Uint16 y1, Uint16 color, int f
|
||||||
int row, w = uxn_screen.width, h = uxn_screen.height, opaque = (color % 5);
|
int row, w = uxn_screen.width, h = uxn_screen.height, opaque = (color % 5);
|
||||||
Uint16 y, ymod = (fy < 0 ? 7 : 0), ymax = y1 + ymod + fy * 8;
|
Uint16 y, ymod = (fy < 0 ? 7 : 0), ymax = y1 + ymod + fy * 8;
|
||||||
Uint16 x, xmod = (fx > 0 ? 7 : 0), xmax = x1 + xmod - fx * 8;
|
Uint16 x, xmod = (fx > 0 ? 7 : 0), xmax = x1 + xmod - fx * 8;
|
||||||
for(y = y1 + ymod; y != ymax; y += fy) {
|
for(y = y1 + ymod; y != ymax; y += fy, addr++) {
|
||||||
int c = *addr++ | (*(addr + 7) << 8);
|
int c = (addr[8] << 8) | addr[0];
|
||||||
if(y < h)
|
if(y < h)
|
||||||
for(x = x1 + xmod, row = y * w; x != xmax; x -= fx, c >>= 1) {
|
for(x = x1 + xmod, row = y * w; x != xmax; x -= fx, c >>= 1) {
|
||||||
Uint8 ch = (c & 1) | ((c >> 7) & 2);
|
Uint8 ch = (c & 1) | ((c >> 7) & 2);
|
||||||
|
|
|
@ -270,7 +270,7 @@ main(int argc, char **argv)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
if(argv[i][0] == '-' && argv[i][1] == 'v') {
|
if(argv[i][0] == '-' && argv[i][1] == 'v') {
|
||||||
fprintf(stdout, "Uxn11 - Varvara Emulator, 20 Jan 2023.\n");
|
fprintf(stdout, "Uxn11 - Varvara Emulator, 14 Feb 2023.\n");
|
||||||
i++;
|
i++;
|
||||||
}
|
}
|
||||||
if(!system_boot(&u, (Uint8 *)calloc(0x10000 * RAM_PAGES, sizeof(Uint8)), argv[i++])) {
|
if(!system_boot(&u, (Uint8 *)calloc(0x10000 * RAM_PAGES, sizeof(Uint8)), argv[i++])) {
|
||||||
|
|
Loading…
Reference in New Issue