... | ... |
@@ -24,12 +24,6 @@ static Uint8 blending[5][16] = { |
24 | 24 |
{2, 3, 1, 2, 2, 3, 1, 2, 2, 3, 1, 2, 2, 3, 1, 2}, |
25 | 25 |
{1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 0, 1, 1, 1, 1, 0}}; |
26 | 26 |
|
27 |
-static Uint16 |
|
28 |
-ppu_row(Ppu *p, Uint16 x, Uint16 y) |
|
29 |
-{ |
|
30 |
- return (y % 8) + ((x / 8 + y / 8 * p->width / 8) * 16); |
|
31 |
-} |
|
32 |
- |
|
33 | 27 |
static void |
34 | 28 |
ppu_clear(Ppu *p) |
35 | 29 |
{ |
... | ... |
@@ -46,9 +40,22 @@ Uint8 |
46 | 40 |
ppu_read(Ppu *p, Uint16 x, Uint16 y) |
47 | 41 |
{ |
48 | 42 |
int row = (x + y * p->width) / 0x2; |
49 |
- int shift = (1 - (x & 0x1)) * 0x4; |
|
50 | 43 |
|
51 |
- return p->pixels[row] & 0x3; |
|
44 |
+ if(x % 2) { |
|
45 |
+ if(p->pixels[row] & 0x0c) { |
|
46 |
+ return (p->pixels[row] >> 0x2) & 0x3; |
|
47 |
+ } else { |
|
48 |
+ return (p->pixels[row] >> 0x0) & 0x3; |
|
49 |
+ } |
|
50 |
+ } else { |
|
51 |
+ if(p->pixels[row] & 0xc0) { |
|
52 |
+ return (p->pixels[row] >> 0x6) & 0x3; |
|
53 |
+ } else { |
|
54 |
+ return (p->pixels[row] >> 0x4) & 0x3; |
|
55 |
+ } |
|
56 |
+ } |
|
57 |
+ |
|
58 |
+ return 0; |
|
52 | 59 |
} |
53 | 60 |
|
54 | 61 |
void |
... | ... |
@@ -65,6 +72,7 @@ ppu_write(Ppu *p, Uint8 layer, Uint16 x, Uint16 y, Uint8 color) |
65 | 72 |
next |= color << (4 + (layer * 2)); |
66 | 73 |
} |
67 | 74 |
p->pixels[row] = next; |
75 |
+ p->reqdraw = 1; |
|
68 | 76 |
} |
69 | 77 |
|
70 | 78 |
void |