diff --git a/Makefile b/Makefile index d794c007..41955ed1 100644 --- a/Makefile +++ b/Makefile @@ -34,14 +34,18 @@ SDLDIR=src/sdl DMGDIR=src/gb RESAMPLEDIR=src/libresample-0.1.3/src -ASMOBJ=${MAINDIR}/hq3x_16${OE} ${MAINDIR}/hq3x_32${OE} ${MAINDIR}/hq4x_16${OE} ${MAINDIR}/hq4x_32${OE} -CALTERNOBJ= + +ASMOBJ=${MAINDIR}/hq3x_16${OE} ${MAINDIR}/hq3x_32${OE} ${MAINDIR}/hq4x_16${OE} ${MAINDIR}/hq4x_32${OE} \ +${MAINDIR}/hq3x32${OE} + +CALTERNOBJ=${MAINDIR}/hq3x16c${OE} ${MAINDIR}/hq3x32c${OE} ${MAINDIR}/hq4x16c${OE} ${MAINDIR}/hq4x32c${OE} \ +${MAINDIR}/hq_shared32${OE} MAINOBJ=${MAINDIR}/2xSaI${OE} ${MAINDIR}/admame${OE} ${MAINDIR}/agbprint${OE} ${MAINDIR}/armdis${OE} \ ${MAINDIR}/bilinear${OE} ${MAINDIR}/bios${OE} ${MAINDIR}/Cheats${OE} ${MAINDIR}/CheatSearch${OE} \ ${MAINDIR}/EEprom${OE} ${MAINDIR}/elf${OE} ${MAINDIR}/Flash${OE} ${MAINDIR}/GBA${OE} \ ${MAINDIR}/gbafilter${OE} ${MAINDIR}/Gfx${OE} ${MAINDIR}/Globals${OE} ${MAINDIR}/interframe${OE} \ -${MAINDIR}/hq2x${OE} ${MAINDIR}/Mode0${OE} \ +${MAINDIR}/hq2x${OE} ${MAINDIR}/Mode0${OE} \ ${MAINDIR}/Mode1${OE} ${MAINDIR}/Mode2${OE} ${MAINDIR}/Mode3${OE} ${MAINDIR}/Mode4${OE} \ ${MAINDIR}/Mode5${OE} ${MAINDIR}/motionblur${OE} ${MAINDIR}/pixel${OE} ${MAINDIR}/portable${OE} \ ${MAINDIR}/remote${OE} ${MAINDIR}/RTC${OE} ${MAINDIR}/scanline${OE} ${MAINDIR}/simpleFilter${OE} \ @@ -55,7 +59,7 @@ ${DMGDIR}/gbSound${OE} SDLOBJ=${SDLDIR}/debugger${OE} ${SDLDIR}/SDL${OE} ${SDLDIR}/dummy${OE} -OBJECTS=${MAINOBJ} ${DMGOBJ} ${SDLOBJ} +OBJECTS=${MAINOBJ} ${DMGOBJ} ${SDLOBJ} ${CALTERNOBJ} LIB=${RESAMPLEDIR}/filterkit${OE} ${RESAMPLEDIR}/resample${OE} ${RESAMPLEDIR}/resamplesubs${OE} .SUFFIXES: .c .cpp .asm diff --git a/src/hq2x.dat b/src/hq2x.dat index a9cba209..28a67c4f 100644 --- a/src/hq2x.dat +++ b/src/hq2x.dat @@ -32,90 +32,90 @@ * This effect is a rewritten implementation of the hq effect made by Maxim Stepin */ -case 0 : -case 1 : -case 4 : -case 5 : -case 32 : -case 33 : -case 36 : -case 37 : -case 128 : -case 129 : -case 132 : -case 133 : -case 160 : -case 161 : -case 164 : -case 165 : +case 0 : +case 1 : +case 4 : +case 5 : +case 32 : +case 33 : +case 36 : +case 37 : +case 128 : +case 129 : +case 132 : +case 133 : +case 160 : +case 161 : +case 164 : +case 165 : { P(0, 0) = I3(2, 1, 1, 4, 1, 3); P(1, 0) = I3(2, 1, 1, 4, 1, 5); P(0, 1) = I3(2, 1, 1, 4, 3, 7); P(1, 1) = I3(2, 1, 1, 4, 5, 7); } break; -case 2 : -case 34 : -case 130 : -case 162 : +case 2 : +case 34 : +case 130 : +case 162 : { P(0, 0) = I3(2, 1, 1, 4, 0, 3); P(1, 0) = I3(2, 1, 1, 4, 2, 5); P(0, 1) = I3(2, 1, 1, 4, 3, 7); P(1, 1) = I3(2, 1, 1, 4, 5, 7); } break; -case 3 : -case 35 : -case 131 : -case 163 : +case 3 : +case 35 : +case 131 : +case 163 : { P(0, 0) = I2(3, 1, 4, 3); P(1, 0) = I3(2, 1, 1, 4, 2, 5); P(0, 1) = I3(2, 1, 1, 4, 3, 7); P(1, 1) = I3(2, 1, 1, 4, 5, 7); } break; -case 6 : -case 38 : -case 134 : -case 166 : +case 6 : +case 38 : +case 134 : +case 166 : { P(0, 0) = I3(2, 1, 1, 4, 0, 3); P(1, 0) = I2(3, 1, 4, 5); P(0, 1) = I3(2, 1, 1, 4, 3, 7); P(1, 1) = I3(2, 1, 1, 4, 5, 7); } break; -case 7 : -case 39 : -case 135 : -case 167 : +case 7 : +case 39 : +case 135 : +case 167 : { P(0, 0) = I2(3, 1, 4, 3); P(1, 0) = I2(3, 1, 4, 5); P(0, 1) = I3(2, 1, 1, 4, 3, 7); P(1, 1) = I3(2, 1, 1, 4, 5, 7); } break; -case 8 : -case 12 : -case 136 : -case 140 : +case 8 : +case 12 : +case 136 : +case 140 : { P(0, 0) = I3(2, 1, 1, 4, 0, 1); P(1, 0) = I3(2, 1, 1, 4, 1, 5); P(0, 1) = I3(2, 1, 1, 4, 6, 7); P(1, 1) = I3(2, 1, 1, 4, 5, 7); } break; -case 9 : -case 13 : -case 137 : -case 141 : +case 9 : +case 13 : +case 137 : +case 141 : { P(0, 0) = I2(3, 1, 4, 1); P(1, 0) = I3(2, 1, 1, 4, 1, 5); P(0, 1) = I3(2, 1, 1, 4, 6, 7); P(1, 1) = I3(2, 1, 1, 4, 5, 7); } break; -case 10 : -case 138 : +case 10 : +case 138 : { P(1, 0) = I3(2, 1, 1, 4, 2, 5); P(0, 1) = I3(2, 1, 1, 4, 6, 7); @@ -126,8 +126,8 @@ if (MUL) { P(0, 0) = I3(2, 1, 1, 4, 1, 3); } } break; -case 11 : -case 139 : +case 11 : +case 139 : { P(1, 0) = I3(2, 1, 1, 4, 2, 5); P(0, 1) = I3(2, 1, 1, 4, 6, 7); @@ -138,8 +138,8 @@ if (MUL) { P(0, 0) = I3(2, 1, 1, 4, 1, 3); } } break; -case 14 : -case 142 : +case 14 : +case 142 : { P(0, 1) = I3(2, 1, 1, 4, 6, 7); P(1, 1) = I3(2, 1, 1, 4, 5, 7); @@ -151,8 +151,8 @@ if (MUL) { P(1, 0) = I3(5, 2, 1, 4, 1, 5); } } break; -case 15 : -case 143 : +case 15 : +case 143 : { P(0, 1) = I3(2, 1, 1, 4, 6, 7); P(1, 1) = I3(2, 1, 1, 4, 5, 7); @@ -164,18 +164,18 @@ if (MUL) { P(1, 0) = I3(5, 2, 1, 4, 1, 5); } } break; -case 16 : -case 17 : -case 48 : -case 49 : +case 16 : +case 17 : +case 48 : +case 49 : { P(0, 0) = I3(2, 1, 1, 4, 1, 3); P(1, 0) = I3(2, 1, 1, 4, 1, 2); P(0, 1) = I3(2, 1, 1, 4, 3, 7); P(1, 1) = I3(2, 1, 1, 4, 7, 8); } break; -case 18 : -case 50 : +case 18 : +case 50 : { P(0, 0) = I3(2, 1, 1, 4, 0, 3); P(0, 1) = I3(2, 1, 1, 4, 3, 7); @@ -186,8 +186,8 @@ if (MUR) { P(1, 0) = I3(2, 1, 1, 4, 1, 5); } } break; -case 19 : -case 51 : +case 19 : +case 51 : { P(0, 1) = I3(2, 1, 1, 4, 3, 7); P(1, 1) = I3(2, 1, 1, 4, 7, 8); @@ -199,18 +199,18 @@ if (MUR) { P(1, 0) = I3(3, 3, 2, 1, 5, 4); } } break; -case 20 : -case 21 : -case 52 : -case 53 : +case 20 : +case 21 : +case 52 : +case 53 : { P(0, 0) = I3(2, 1, 1, 4, 1, 3); P(1, 0) = I2(3, 1, 4, 1); P(0, 1) = I3(2, 1, 1, 4, 3, 7); P(1, 1) = I3(2, 1, 1, 4, 7, 8); } break; -case 22 : -case 54 : +case 22 : +case 54 : { P(0, 0) = I3(2, 1, 1, 4, 0, 3); P(0, 1) = I3(2, 1, 1, 4, 3, 7); @@ -221,8 +221,8 @@ if (MUR) { P(1, 0) = I3(2, 1, 1, 4, 1, 5); } } break; -case 23 : -case 55 : +case 23 : +case 55 : { P(0, 1) = I3(2, 1, 1, 4, 3, 7); P(1, 1) = I3(2, 1, 1, 4, 7, 8); @@ -234,22 +234,22 @@ if (MUR) { P(1, 0) = I3(3, 3, 2, 1, 5, 4); } } break; -case 24 : +case 24 : { P(0, 0) = I3(2, 1, 1, 4, 0, 1); P(1, 0) = I3(2, 1, 1, 4, 1, 2); P(0, 1) = I3(2, 1, 1, 4, 6, 7); P(1, 1) = I3(2, 1, 1, 4, 7, 8); } break; -case 25 : +case 25 : { P(0, 0) = I2(3, 1, 4, 1); P(1, 0) = I3(2, 1, 1, 4, 1, 2); P(0, 1) = I3(2, 1, 1, 4, 6, 7); P(1, 1) = I3(2, 1, 1, 4, 7, 8); } break; -case 26 : -case 31 : +case 26 : +case 31 : { P(0, 1) = I3(2, 1, 1, 4, 6, 7); P(1, 1) = I3(2, 1, 1, 4, 7, 8); @@ -264,7 +264,7 @@ if (MUR) { P(1, 0) = I3(2, 1, 1, 4, 1, 5); } } break; -case 27 : +case 27 : { P(1, 0) = I2(3, 1, 4, 2); P(0, 1) = I3(2, 1, 1, 4, 6, 7); @@ -275,21 +275,21 @@ if (MUL) { P(0, 0) = I3(2, 1, 1, 4, 1, 3); } } break; -case 28 : +case 28 : { P(0, 0) = I3(2, 1, 1, 4, 0, 1); P(1, 0) = I2(3, 1, 4, 1); P(0, 1) = I3(2, 1, 1, 4, 6, 7); P(1, 1) = I3(2, 1, 1, 4, 7, 8); } break; -case 29 : +case 29 : { P(0, 0) = I2(3, 1, 4, 1); P(1, 0) = I2(3, 1, 4, 1); P(0, 1) = I3(2, 1, 1, 4, 6, 7); P(1, 1) = I3(2, 1, 1, 4, 7, 8); } break; -case 30 : +case 30 : { P(0, 0) = I2(3, 1, 4, 0); P(0, 1) = I3(2, 1, 1, 4, 6, 7); @@ -300,28 +300,28 @@ if (MUR) { P(1, 0) = I3(2, 1, 1, 4, 1, 5); } } break; -case 40 : -case 44 : -case 168 : -case 172 : +case 40 : +case 44 : +case 168 : +case 172 : { P(0, 0) = I3(2, 1, 1, 4, 0, 1); P(1, 0) = I3(2, 1, 1, 4, 1, 5); P(0, 1) = I2(3, 1, 4, 7); P(1, 1) = I3(2, 1, 1, 4, 5, 7); } break; -case 41 : -case 45 : -case 169 : -case 173 : +case 41 : +case 45 : +case 169 : +case 173 : { P(0, 0) = I2(3, 1, 4, 1); P(1, 0) = I3(2, 1, 1, 4, 1, 5); P(0, 1) = I2(3, 1, 4, 7); P(1, 1) = I3(2, 1, 1, 4, 5, 7); } break; -case 42 : -case 170 : +case 42 : +case 170 : { P(1, 0) = I3(2, 1, 1, 4, 2, 5); P(1, 1) = I3(2, 1, 1, 4, 5, 7); @@ -333,8 +333,8 @@ if (MUL) { P(0, 1) = I3(5, 2, 1, 4, 3, 7); } } break; -case 43 : -case 171 : +case 43 : +case 171 : { P(1, 0) = I3(2, 1, 1, 4, 2, 5); P(1, 1) = I3(2, 1, 1, 4, 5, 7); @@ -346,8 +346,8 @@ if (MUL) { P(0, 1) = I3(5, 2, 1, 4, 3, 7); } } break; -case 46 : -case 174 : +case 46 : +case 174 : { P(1, 0) = I2(3, 1, 4, 5); P(0, 1) = I2(3, 1, 4, 7); @@ -358,8 +358,8 @@ if (MUL) { P(0, 0) = I3(6, 1, 1, 4, 1, 3); } } break; -case 47 : -case 175 : +case 47 : +case 175 : { P(1, 0) = I2(3, 1, 4, 5); P(0, 1) = I2(3, 1, 4, 7); @@ -370,21 +370,21 @@ if (MUL) { P(0, 0) = I3(14, 1, 1, 4, 1, 3); } } break; -case 56 : +case 56 : { P(0, 0) = I3(2, 1, 1, 4, 0, 1); P(1, 0) = I3(2, 1, 1, 4, 1, 2); P(0, 1) = I2(3, 1, 4, 7); P(1, 1) = I3(2, 1, 1, 4, 7, 8); } break; -case 57 : +case 57 : { P(0, 0) = I2(3, 1, 4, 1); P(1, 0) = I3(2, 1, 1, 4, 1, 2); P(0, 1) = I2(3, 1, 4, 7); P(1, 1) = I3(2, 1, 1, 4, 7, 8); } break; -case 58 : +case 58 : { P(0, 1) = I2(3, 1, 4, 7); P(1, 1) = I3(2, 1, 1, 4, 7, 8); @@ -399,7 +399,7 @@ if (MUR) { P(1, 0) = I3(6, 1, 1, 4, 1, 5); } } break; -case 59 : +case 59 : { P(0, 1) = I2(3, 1, 4, 7); P(1, 1) = I3(2, 1, 1, 4, 7, 8); @@ -414,21 +414,21 @@ if (MUR) { P(1, 0) = I3(6, 1, 1, 4, 1, 5); } } break; -case 60 : +case 60 : { P(0, 0) = I3(2, 1, 1, 4, 0, 1); P(1, 0) = I2(3, 1, 4, 1); P(0, 1) = I2(3, 1, 4, 7); P(1, 1) = I3(2, 1, 1, 4, 7, 8); } break; -case 61 : +case 61 : { P(0, 0) = I2(3, 1, 4, 1); P(1, 0) = I2(3, 1, 4, 1); P(0, 1) = I2(3, 1, 4, 7); P(1, 1) = I3(2, 1, 1, 4, 7, 8); } break; -case 62 : +case 62 : { P(0, 0) = I2(3, 1, 4, 0); P(0, 1) = I2(3, 1, 4, 7); @@ -439,7 +439,7 @@ if (MUR) { P(1, 0) = I3(2, 1, 1, 4, 1, 5); } } break; -case 63 : +case 63 : { P(0, 1) = I2(3, 1, 4, 7); P(1, 1) = I3(2, 1, 1, 4, 7, 8); @@ -454,46 +454,46 @@ if (MUR) { P(1, 0) = I3(2, 1, 1, 4, 1, 5); } } break; -case 64 : -case 65 : -case 68 : -case 69 : +case 64 : +case 65 : +case 68 : +case 69 : { P(0, 0) = I3(2, 1, 1, 4, 1, 3); P(1, 0) = I3(2, 1, 1, 4, 1, 5); P(0, 1) = I3(2, 1, 1, 4, 3, 6); P(1, 1) = I3(2, 1, 1, 4, 5, 8); } break; -case 66 : +case 66 : { P(0, 0) = I3(2, 1, 1, 4, 0, 3); P(1, 0) = I3(2, 1, 1, 4, 2, 5); P(0, 1) = I3(2, 1, 1, 4, 3, 6); P(1, 1) = I3(2, 1, 1, 4, 5, 8); } break; -case 67 : +case 67 : { P(0, 0) = I2(3, 1, 4, 3); P(1, 0) = I3(2, 1, 1, 4, 2, 5); P(0, 1) = I3(2, 1, 1, 4, 3, 6); P(1, 1) = I3(2, 1, 1, 4, 5, 8); } break; -case 70 : +case 70 : { P(0, 0) = I3(2, 1, 1, 4, 0, 3); P(1, 0) = I2(3, 1, 4, 5); P(0, 1) = I3(2, 1, 1, 4, 3, 6); P(1, 1) = I3(2, 1, 1, 4, 5, 8); } break; -case 71 : +case 71 : { P(0, 0) = I2(3, 1, 4, 3); P(1, 0) = I2(3, 1, 4, 5); P(0, 1) = I3(2, 1, 1, 4, 3, 6); P(1, 1) = I3(2, 1, 1, 4, 5, 8); } break; -case 72 : -case 76 : +case 72 : +case 76 : { P(0, 0) = I3(2, 1, 1, 4, 0, 1); P(1, 0) = I3(2, 1, 1, 4, 1, 5); @@ -504,8 +504,8 @@ if (MDL) { P(0, 1) = I3(2, 1, 1, 4, 3, 7); } } break; -case 73 : -case 77 : +case 73 : +case 77 : { P(1, 0) = I3(2, 1, 1, 4, 1, 5); P(1, 1) = I3(2, 1, 1, 4, 5, 8); @@ -517,8 +517,8 @@ if (MDL) { P(0, 1) = I3(3, 3, 2, 3, 7, 4); } } break; -case 74 : -case 107 : +case 74 : +case 107 : { P(1, 0) = I3(2, 1, 1, 4, 2, 5); P(1, 1) = I3(2, 1, 1, 4, 5, 8); @@ -533,7 +533,7 @@ if (MUL) { P(0, 0) = I3(2, 1, 1, 4, 1, 3); } } break; -case 75 : +case 75 : { P(1, 0) = I3(2, 1, 1, 4, 2, 5); P(0, 1) = I2(3, 1, 4, 6); @@ -544,7 +544,7 @@ if (MUL) { P(0, 0) = I3(2, 1, 1, 4, 1, 3); } } break; -case 78 : +case 78 : { P(1, 0) = I2(3, 1, 4, 5); P(1, 1) = I3(2, 1, 1, 4, 5, 8); @@ -559,7 +559,7 @@ if (MUL) { P(0, 0) = I3(6, 1, 1, 4, 1, 3); } } break; -case 79 : +case 79 : { P(1, 0) = I2(3, 1, 4, 5); P(1, 1) = I3(2, 1, 1, 4, 5, 8); @@ -574,8 +574,8 @@ if (MUL) { P(0, 0) = I3(2, 1, 1, 4, 1, 3); } } break; -case 80 : -case 81 : +case 80 : +case 81 : { P(0, 0) = I3(2, 1, 1, 4, 1, 3); P(1, 0) = I3(2, 1, 1, 4, 1, 2); @@ -586,8 +586,8 @@ if (MDR) { P(1, 1) = I3(2, 1, 1, 4, 5, 7); } } break; -case 82 : -case 214 : +case 82 : +case 214 : { P(0, 0) = I3(2, 1, 1, 4, 0, 3); P(0, 1) = I3(2, 1, 1, 4, 3, 6); @@ -602,7 +602,7 @@ if (MUR) { P(1, 0) = I3(2, 1, 1, 4, 1, 5); } } break; -case 83 : +case 83 : { P(0, 0) = I2(3, 1, 4, 3); P(0, 1) = I3(2, 1, 1, 4, 3, 6); @@ -617,8 +617,8 @@ if (MUR) { P(1, 0) = I3(6, 1, 1, 4, 1, 5); } } break; -case 84 : -case 85 : +case 84 : +case 85 : { P(0, 0) = I3(2, 1, 1, 4, 1, 3); P(0, 1) = I3(2, 1, 1, 4, 3, 6); @@ -630,7 +630,7 @@ if (MDR) { P(1, 1) = I3(3, 3, 2, 5, 7, 4); } } break; -case 86 : +case 86 : { P(0, 0) = I3(2, 1, 1, 4, 0, 3); P(0, 1) = I3(2, 1, 1, 4, 3, 6); @@ -641,7 +641,7 @@ if (MUR) { P(1, 0) = I3(2, 1, 1, 4, 1, 5); } } break; -case 87 : +case 87 : { P(0, 0) = I2(3, 1, 4, 3); P(0, 1) = I3(2, 1, 1, 4, 3, 6); @@ -656,8 +656,8 @@ if (MUR) { P(1, 0) = I3(2, 1, 1, 4, 1, 5); } } break; -case 88 : -case 248 : +case 88 : +case 248 : { P(0, 0) = I3(2, 1, 1, 4, 0, 1); P(1, 0) = I3(2, 1, 1, 4, 1, 2); @@ -672,7 +672,7 @@ if (MDR) { P(1, 1) = I3(2, 1, 1, 4, 5, 7); } } break; -case 89 : +case 89 : { P(0, 0) = I2(3, 1, 4, 1); P(1, 0) = I3(2, 1, 1, 4, 1, 2); @@ -687,7 +687,7 @@ if (MDR) { P(1, 1) = I3(6, 1, 1, 4, 5, 7); } } break; -case 90 : +case 90 : { if (MDL) { P(0, 1) = I2(3, 1, 4, 6); @@ -710,7 +710,7 @@ if (MUR) { P(1, 0) = I3(6, 1, 1, 4, 1, 5); } } break; -case 91 : +case 91 : { if (MDL) { P(0, 1) = I2(3, 1, 4, 6); @@ -733,7 +733,7 @@ if (MUR) { P(1, 0) = I3(6, 1, 1, 4, 1, 5); } } break; -case 92 : +case 92 : { P(0, 0) = I3(2, 1, 1, 4, 0, 1); P(1, 0) = I2(3, 1, 4, 1); @@ -748,7 +748,7 @@ if (MDR) { P(1, 1) = I3(6, 1, 1, 4, 5, 7); } } break; -case 93 : +case 93 : { P(0, 0) = I2(3, 1, 4, 1); P(1, 0) = I2(3, 1, 4, 1); @@ -763,7 +763,7 @@ if (MDR) { P(1, 1) = I3(6, 1, 1, 4, 5, 7); } } break; -case 94 : +case 94 : { if (MDL) { P(0, 1) = I2(3, 1, 4, 6); @@ -786,7 +786,7 @@ if (MUR) { P(1, 0) = I3(2, 1, 1, 4, 1, 5); } } break; -case 95 : +case 95 : { P(0, 1) = I2(3, 1, 4, 6); P(1, 1) = I2(3, 1, 4, 8); @@ -801,46 +801,46 @@ if (MUR) { P(1, 0) = I3(2, 1, 1, 4, 1, 5); } } break; -case 96 : -case 97 : -case 100 : -case 101 : +case 96 : +case 97 : +case 100 : +case 101 : { P(0, 0) = I3(2, 1, 1, 4, 1, 3); P(1, 0) = I3(2, 1, 1, 4, 1, 5); P(0, 1) = I2(3, 1, 4, 3); P(1, 1) = I3(2, 1, 1, 4, 5, 8); } break; -case 98 : +case 98 : { P(0, 0) = I3(2, 1, 1, 4, 0, 3); P(1, 0) = I3(2, 1, 1, 4, 2, 5); P(0, 1) = I2(3, 1, 4, 3); P(1, 1) = I3(2, 1, 1, 4, 5, 8); } break; -case 99 : +case 99 : { P(0, 0) = I2(3, 1, 4, 3); P(1, 0) = I3(2, 1, 1, 4, 2, 5); P(0, 1) = I2(3, 1, 4, 3); P(1, 1) = I3(2, 1, 1, 4, 5, 8); } break; -case 102 : +case 102 : { P(0, 0) = I3(2, 1, 1, 4, 0, 3); P(1, 0) = I2(3, 1, 4, 5); P(0, 1) = I2(3, 1, 4, 3); P(1, 1) = I3(2, 1, 1, 4, 5, 8); } break; -case 103 : +case 103 : { P(0, 0) = I2(3, 1, 4, 3); P(1, 0) = I2(3, 1, 4, 5); P(0, 1) = I2(3, 1, 4, 3); P(1, 1) = I3(2, 1, 1, 4, 5, 8); } break; -case 104 : -case 108 : +case 104 : +case 108 : { P(0, 0) = I3(2, 1, 1, 4, 0, 1); P(1, 0) = I3(2, 1, 1, 4, 1, 5); @@ -851,8 +851,8 @@ if (MDL) { P(0, 1) = I3(2, 1, 1, 4, 3, 7); } } break; -case 105 : -case 109 : +case 105 : +case 109 : { P(1, 0) = I3(2, 1, 1, 4, 1, 5); P(1, 1) = I3(2, 1, 1, 4, 5, 8); @@ -864,7 +864,7 @@ if (MDL) { P(0, 1) = I3(3, 3, 2, 3, 7, 4); } } break; -case 106 : +case 106 : { P(0, 0) = I2(3, 1, 4, 0); P(1, 0) = I3(2, 1, 1, 4, 2, 5); @@ -875,7 +875,7 @@ if (MDL) { P(0, 1) = I3(2, 1, 1, 4, 3, 7); } } break; -case 110 : +case 110 : { P(0, 0) = I2(3, 1, 4, 0); P(1, 0) = I2(3, 1, 4, 5); @@ -886,7 +886,7 @@ if (MDL) { P(0, 1) = I3(2, 1, 1, 4, 3, 7); } } break; -case 111 : +case 111 : { P(1, 0) = I2(3, 1, 4, 5); P(1, 1) = I3(2, 1, 1, 4, 5, 8); @@ -901,8 +901,8 @@ if (MUL) { P(0, 0) = I3(14, 1, 1, 4, 1, 3); } } break; -case 112 : -case 113 : +case 112 : +case 113 : { P(0, 0) = I3(2, 1, 1, 4, 1, 3); P(1, 0) = I3(2, 1, 1, 4, 1, 2); @@ -914,7 +914,7 @@ if (MDR) { P(1, 1) = I3(3, 3, 2, 5, 7, 4); } } break; -case 114 : +case 114 : { P(0, 0) = I3(2, 1, 1, 4, 0, 3); P(0, 1) = I2(3, 1, 4, 3); @@ -929,7 +929,7 @@ if (MUR) { P(1, 0) = I3(6, 1, 1, 4, 1, 5); } } break; -case 115 : +case 115 : { P(0, 0) = I2(3, 1, 4, 3); P(0, 1) = I2(3, 1, 4, 3); @@ -944,8 +944,8 @@ if (MUR) { P(1, 0) = I3(6, 1, 1, 4, 1, 5); } } break; -case 116 : -case 117 : +case 116 : +case 117 : { P(0, 0) = I3(2, 1, 1, 4, 1, 3); P(1, 0) = I2(3, 1, 4, 1); @@ -956,7 +956,7 @@ if (MDR) { P(1, 1) = I3(6, 1, 1, 4, 5, 7); } } break; -case 118 : +case 118 : { P(0, 0) = I3(2, 1, 1, 4, 0, 3); P(0, 1) = I2(3, 1, 4, 3); @@ -967,7 +967,7 @@ if (MUR) { P(1, 0) = I3(2, 1, 1, 4, 1, 5); } } break; -case 119 : +case 119 : { P(0, 1) = I2(3, 1, 4, 3); P(1, 1) = I2(3, 1, 4, 8); @@ -979,7 +979,7 @@ if (MUR) { P(1, 0) = I3(3, 3, 2, 1, 5, 4); } } break; -case 120 : +case 120 : { P(0, 0) = I3(2, 1, 1, 4, 0, 1); P(1, 0) = I3(2, 1, 1, 4, 1, 2); @@ -990,7 +990,7 @@ if (MDL) { P(0, 1) = I3(2, 1, 1, 4, 3, 7); } } break; -case 121 : +case 121 : { P(0, 0) = I2(3, 1, 4, 1); P(1, 0) = I3(2, 1, 1, 4, 1, 2); @@ -1005,7 +1005,7 @@ if (MDR) { P(1, 1) = I3(6, 1, 1, 4, 5, 7); } } break; -case 122 : +case 122 : { if (MDL) { P(0, 1) = I1(4); @@ -1028,7 +1028,7 @@ if (MUR) { P(1, 0) = I3(6, 1, 1, 4, 1, 5); } } break; -case 123 : +case 123 : { P(1, 0) = I2(3, 1, 4, 2); P(1, 1) = I2(3, 1, 4, 8); @@ -1043,7 +1043,7 @@ if (MUL) { P(0, 0) = I3(2, 1, 1, 4, 1, 3); } } break; -case 124 : +case 124 : { P(0, 0) = I3(2, 1, 1, 4, 0, 1); P(1, 0) = I2(3, 1, 4, 1); @@ -1054,7 +1054,7 @@ if (MDL) { P(0, 1) = I3(2, 1, 1, 4, 3, 7); } } break; -case 125 : +case 125 : { P(1, 0) = I2(3, 1, 4, 1); P(1, 1) = I2(3, 1, 4, 8); @@ -1066,7 +1066,7 @@ if (MDL) { P(0, 1) = I3(3, 3, 2, 3, 7, 4); } } break; -case 126 : +case 126 : { P(0, 0) = I2(3, 1, 4, 0); P(1, 1) = I2(3, 1, 4, 8); @@ -1081,7 +1081,7 @@ if (MUR) { P(1, 0) = I3(2, 1, 1, 4, 1, 5); } } break; -case 127 : +case 127 : { P(1, 1) = I2(3, 1, 4, 8); if (MDL) { @@ -1100,18 +1100,18 @@ if (MUR) { P(1, 0) = I3(2, 1, 1, 4, 1, 5); } } break; -case 144 : -case 145 : -case 176 : -case 177 : +case 144 : +case 145 : +case 176 : +case 177 : { P(0, 0) = I3(2, 1, 1, 4, 1, 3); P(1, 0) = I3(2, 1, 1, 4, 1, 2); P(0, 1) = I3(2, 1, 1, 4, 3, 7); P(1, 1) = I2(3, 1, 4, 7); } break; -case 146 : -case 178 : +case 146 : +case 178 : { P(0, 0) = I3(2, 1, 1, 4, 0, 3); P(0, 1) = I3(2, 1, 1, 4, 3, 7); @@ -1123,8 +1123,8 @@ if (MUR) { P(1, 1) = I3(5, 2, 1, 4, 5, 7); } } break; -case 147 : -case 179 : +case 147 : +case 179 : { P(0, 0) = I2(3, 1, 4, 3); P(0, 1) = I3(2, 1, 1, 4, 3, 7); @@ -1135,18 +1135,18 @@ if (MUR) { P(1, 0) = I3(6, 1, 1, 4, 1, 5); } } break; -case 148 : -case 149 : -case 180 : -case 181 : +case 148 : +case 149 : +case 180 : +case 181 : { P(0, 0) = I3(2, 1, 1, 4, 1, 3); P(1, 0) = I2(3, 1, 4, 1); P(0, 1) = I3(2, 1, 1, 4, 3, 7); P(1, 1) = I2(3, 1, 4, 7); } break; -case 150 : -case 182 : +case 150 : +case 182 : { P(0, 0) = I3(2, 1, 1, 4, 0, 3); P(0, 1) = I3(2, 1, 1, 4, 3, 7); @@ -1158,8 +1158,8 @@ if (MUR) { P(1, 1) = I3(5, 2, 1, 4, 5, 7); } } break; -case 151 : -case 183 : +case 151 : +case 183 : { P(0, 0) = I2(3, 1, 4, 3); P(0, 1) = I3(2, 1, 1, 4, 3, 7); @@ -1170,21 +1170,21 @@ if (MUR) { P(1, 0) = I3(14, 1, 1, 4, 1, 5); } } break; -case 152 : +case 152 : { P(0, 0) = I3(2, 1, 1, 4, 0, 1); P(1, 0) = I3(2, 1, 1, 4, 1, 2); P(0, 1) = I3(2, 1, 1, 4, 6, 7); P(1, 1) = I2(3, 1, 4, 7); } break; -case 153 : +case 153 : { P(0, 0) = I2(3, 1, 4, 1); P(1, 0) = I3(2, 1, 1, 4, 1, 2); P(0, 1) = I3(2, 1, 1, 4, 6, 7); P(1, 1) = I2(3, 1, 4, 7); } break; -case 154 : +case 154 : { P(0, 1) = I3(2, 1, 1, 4, 6, 7); P(1, 1) = I2(3, 1, 4, 7); @@ -1199,7 +1199,7 @@ if (MUR) { P(1, 0) = I3(6, 1, 1, 4, 1, 5); } } break; -case 155 : +case 155 : { P(1, 0) = I2(3, 1, 4, 2); P(0, 1) = I3(2, 1, 1, 4, 6, 7); @@ -1210,21 +1210,21 @@ if (MUL) { P(0, 0) = I3(2, 1, 1, 4, 1, 3); } } break; -case 156 : +case 156 : { P(0, 0) = I3(2, 1, 1, 4, 0, 1); P(1, 0) = I2(3, 1, 4, 1); P(0, 1) = I3(2, 1, 1, 4, 6, 7); P(1, 1) = I2(3, 1, 4, 7); } break; -case 157 : +case 157 : { P(0, 0) = I2(3, 1, 4, 1); P(1, 0) = I2(3, 1, 4, 1); P(0, 1) = I3(2, 1, 1, 4, 6, 7); P(1, 1) = I2(3, 1, 4, 7); } break; -case 158 : +case 158 : { P(0, 1) = I3(2, 1, 1, 4, 6, 7); P(1, 1) = I2(3, 1, 4, 7); @@ -1239,7 +1239,7 @@ if (MUR) { P(1, 0) = I3(2, 1, 1, 4, 1, 5); } } break; -case 159 : +case 159 : { P(0, 1) = I3(2, 1, 1, 4, 6, 7); P(1, 1) = I2(3, 1, 4, 7); @@ -1254,21 +1254,21 @@ if (MUR) { P(1, 0) = I3(14, 1, 1, 4, 1, 5); } } break; -case 184 : +case 184 : { P(0, 0) = I3(2, 1, 1, 4, 0, 1); P(1, 0) = I3(2, 1, 1, 4, 1, 2); P(0, 1) = I2(3, 1, 4, 7); P(1, 1) = I2(3, 1, 4, 7); } break; -case 185 : +case 185 : { P(0, 0) = I2(3, 1, 4, 1); P(1, 0) = I3(2, 1, 1, 4, 1, 2); P(0, 1) = I2(3, 1, 4, 7); P(1, 1) = I2(3, 1, 4, 7); } break; -case 186 : +case 186 : { P(0, 1) = I2(3, 1, 4, 7); P(1, 1) = I2(3, 1, 4, 7); @@ -1283,7 +1283,7 @@ if (MUR) { P(1, 0) = I3(6, 1, 1, 4, 1, 5); } } break; -case 187 : +case 187 : { P(1, 0) = I2(3, 1, 4, 2); P(1, 1) = I2(3, 1, 4, 7); @@ -1295,21 +1295,21 @@ if (MUL) { P(0, 1) = I3(5, 2, 1, 4, 3, 7); } } break; -case 188 : +case 188 : { P(0, 0) = I3(2, 1, 1, 4, 0, 1); P(1, 0) = I2(3, 1, 4, 1); P(0, 1) = I2(3, 1, 4, 7); P(1, 1) = I2(3, 1, 4, 7); } break; -case 189 : +case 189 : { P(0, 0) = I2(3, 1, 4, 1); P(1, 0) = I2(3, 1, 4, 1); P(0, 1) = I2(3, 1, 4, 7); P(1, 1) = I2(3, 1, 4, 7); } break; -case 190 : +case 190 : { P(0, 0) = I2(3, 1, 4, 0); P(0, 1) = I2(3, 1, 4, 7); @@ -1321,7 +1321,7 @@ if (MUR) { P(1, 1) = I3(5, 2, 1, 4, 5, 7); } } break; -case 191 : +case 191 : { P(0, 1) = I2(3, 1, 4, 7); P(1, 1) = I2(3, 1, 4, 7); @@ -1336,46 +1336,46 @@ if (MUR) { P(1, 0) = I3(14, 1, 1, 4, 1, 5); } } break; -case 192 : -case 193 : -case 196 : -case 197 : +case 192 : +case 193 : +case 196 : +case 197 : { P(0, 0) = I3(2, 1, 1, 4, 1, 3); P(1, 0) = I3(2, 1, 1, 4, 1, 5); P(0, 1) = I3(2, 1, 1, 4, 3, 6); P(1, 1) = I2(3, 1, 4, 5); } break; -case 194 : +case 194 : { P(0, 0) = I3(2, 1, 1, 4, 0, 3); P(1, 0) = I3(2, 1, 1, 4, 2, 5); P(0, 1) = I3(2, 1, 1, 4, 3, 6); P(1, 1) = I2(3, 1, 4, 5); } break; -case 195 : +case 195 : { P(0, 0) = I2(3, 1, 4, 3); P(1, 0) = I3(2, 1, 1, 4, 2, 5); P(0, 1) = I3(2, 1, 1, 4, 3, 6); P(1, 1) = I2(3, 1, 4, 5); } break; -case 198 : +case 198 : { P(0, 0) = I3(2, 1, 1, 4, 0, 3); P(1, 0) = I2(3, 1, 4, 5); P(0, 1) = I3(2, 1, 1, 4, 3, 6); P(1, 1) = I2(3, 1, 4, 5); } break; -case 199 : +case 199 : { P(0, 0) = I2(3, 1, 4, 3); P(1, 0) = I2(3, 1, 4, 5); P(0, 1) = I3(2, 1, 1, 4, 3, 6); P(1, 1) = I2(3, 1, 4, 5); } break; -case 200 : -case 204 : +case 200 : +case 204 : { P(0, 0) = I3(2, 1, 1, 4, 0, 1); P(1, 0) = I3(2, 1, 1, 4, 1, 5); @@ -1387,8 +1387,8 @@ if (MDL) { P(1, 1) = I3(5, 2, 1, 4, 7, 5); } } break; -case 201 : -case 205 : +case 201 : +case 205 : { P(0, 0) = I2(3, 1, 4, 1); P(1, 0) = I3(2, 1, 1, 4, 1, 5); @@ -1399,7 +1399,7 @@ if (MDL) { P(0, 1) = I3(6, 1, 1, 4, 3, 7); } } break; -case 202 : +case 202 : { P(1, 0) = I3(2, 1, 1, 4, 2, 5); P(1, 1) = I2(3, 1, 4, 5); @@ -1414,7 +1414,7 @@ if (MUL) { P(0, 0) = I3(6, 1, 1, 4, 1, 3); } } break; -case 203 : +case 203 : { P(1, 0) = I3(2, 1, 1, 4, 2, 5); P(0, 1) = I2(3, 1, 4, 6); @@ -1425,7 +1425,7 @@ if (MUL) { P(0, 0) = I3(2, 1, 1, 4, 1, 3); } } break; -case 206 : +case 206 : { P(1, 0) = I2(3, 1, 4, 5); P(1, 1) = I2(3, 1, 4, 5); @@ -1440,7 +1440,7 @@ if (MUL) { P(0, 0) = I3(6, 1, 1, 4, 1, 3); } } break; -case 207 : +case 207 : { P(0, 1) = I2(3, 1, 4, 6); P(1, 1) = I2(3, 1, 4, 5); @@ -1452,8 +1452,8 @@ if (MUL) { P(1, 0) = I3(5, 2, 1, 4, 1, 5); } } break; -case 208 : -case 209 : +case 208 : +case 209 : { P(0, 0) = I3(2, 1, 1, 4, 1, 3); P(1, 0) = I3(2, 1, 1, 4, 1, 2); @@ -1464,7 +1464,7 @@ if (MDR) { P(1, 1) = I3(2, 1, 1, 4, 5, 7); } } break; -case 210 : +case 210 : { P(0, 0) = I3(2, 1, 1, 4, 0, 3); P(1, 0) = I2(3, 1, 4, 2); @@ -1475,7 +1475,7 @@ if (MDR) { P(1, 1) = I3(2, 1, 1, 4, 5, 7); } } break; -case 211 : +case 211 : { P(0, 0) = I2(3, 1, 4, 3); P(1, 0) = I2(3, 1, 4, 2); @@ -1486,8 +1486,8 @@ if (MDR) { P(1, 1) = I3(2, 1, 1, 4, 5, 7); } } break; -case 212 : -case 213 : +case 212 : +case 213 : { P(0, 0) = I3(2, 1, 1, 4, 1, 3); P(0, 1) = I3(2, 1, 1, 4, 3, 6); @@ -1499,7 +1499,7 @@ if (MDR) { P(1, 1) = I3(3, 3, 2, 5, 7, 4); } } break; -case 215 : +case 215 : { P(0, 0) = I2(3, 1, 4, 3); P(0, 1) = I3(2, 1, 1, 4, 3, 6); @@ -1514,7 +1514,7 @@ if (MUR) { P(1, 0) = I3(14, 1, 1, 4, 1, 5); } } break; -case 216 : +case 216 : { P(0, 0) = I3(2, 1, 1, 4, 0, 1); P(1, 0) = I3(2, 1, 1, 4, 1, 2); @@ -1525,7 +1525,7 @@ if (MDR) { P(1, 1) = I3(2, 1, 1, 4, 5, 7); } } break; -case 217 : +case 217 : { P(0, 0) = I2(3, 1, 4, 1); P(1, 0) = I3(2, 1, 1, 4, 1, 2); @@ -1536,7 +1536,7 @@ if (MDR) { P(1, 1) = I3(2, 1, 1, 4, 5, 7); } } break; -case 218 : +case 218 : { if (MDL) { P(0, 1) = I2(3, 1, 4, 6); @@ -1559,7 +1559,7 @@ if (MUR) { P(1, 0) = I3(6, 1, 1, 4, 1, 5); } } break; -case 219 : +case 219 : { P(1, 0) = I2(3, 1, 4, 2); P(0, 1) = I2(3, 1, 4, 6); @@ -1574,7 +1574,7 @@ if (MUL) { P(0, 0) = I3(2, 1, 1, 4, 1, 3); } } break; -case 220 : +case 220 : { P(0, 0) = I3(2, 1, 1, 4, 0, 1); P(1, 0) = I2(3, 1, 4, 1); @@ -1589,7 +1589,7 @@ if (MDR) { P(1, 1) = I3(2, 1, 1, 4, 5, 7); } } break; -case 221 : +case 221 : { P(0, 0) = I2(3, 1, 4, 1); P(0, 1) = I2(3, 1, 4, 6); @@ -1601,7 +1601,7 @@ if (MDR) { P(1, 1) = I3(3, 3, 2, 5, 7, 4); } } break; -case 222 : +case 222 : { P(0, 0) = I2(3, 1, 4, 0); P(0, 1) = I2(3, 1, 4, 6); @@ -1616,7 +1616,7 @@ if (MUR) { P(1, 0) = I3(2, 1, 1, 4, 1, 5); } } break; -case 223 : +case 223 : { P(0, 1) = I2(3, 1, 4, 6); if (MDR) { @@ -1635,46 +1635,46 @@ if (MUR) { P(1, 0) = I3(14, 1, 1, 4, 1, 5); } } break; -case 224 : -case 225 : -case 228 : -case 229 : +case 224 : +case 225 : +case 228 : +case 229 : { P(0, 0) = I3(2, 1, 1, 4, 1, 3); P(1, 0) = I3(2, 1, 1, 4, 1, 5); P(0, 1) = I2(3, 1, 4, 3); P(1, 1) = I2(3, 1, 4, 5); } break; -case 226 : +case 226 : { P(0, 0) = I3(2, 1, 1, 4, 0, 3); P(1, 0) = I3(2, 1, 1, 4, 2, 5); P(0, 1) = I2(3, 1, 4, 3); P(1, 1) = I2(3, 1, 4, 5); } break; -case 227 : +case 227 : { P(0, 0) = I2(3, 1, 4, 3); P(1, 0) = I3(2, 1, 1, 4, 2, 5); P(0, 1) = I2(3, 1, 4, 3); P(1, 1) = I2(3, 1, 4, 5); } break; -case 230 : +case 230 : { P(0, 0) = I3(2, 1, 1, 4, 0, 3); P(1, 0) = I2(3, 1, 4, 5); P(0, 1) = I2(3, 1, 4, 3); P(1, 1) = I2(3, 1, 4, 5); } break; -case 231 : +case 231 : { P(0, 0) = I2(3, 1, 4, 3); P(1, 0) = I2(3, 1, 4, 5); P(0, 1) = I2(3, 1, 4, 3); P(1, 1) = I2(3, 1, 4, 5); } break; -case 232 : -case 236 : +case 232 : +case 236 : { P(0, 0) = I3(2, 1, 1, 4, 0, 1); P(1, 0) = I3(2, 1, 1, 4, 1, 5); @@ -1686,8 +1686,8 @@ if (MDL) { P(1, 1) = I3(5, 2, 1, 4, 7, 5); } } break; -case 233 : -case 237 : +case 233 : +case 237 : { P(0, 0) = I2(3, 1, 4, 1); P(1, 0) = I3(2, 1, 1, 4, 1, 5); @@ -1698,7 +1698,7 @@ if (MDL) { P(0, 1) = I3(14, 1, 1, 4, 3, 7); } } break; -case 234 : +case 234 : { P(1, 0) = I3(2, 1, 1, 4, 2, 5); P(1, 1) = I2(3, 1, 4, 5); @@ -1713,7 +1713,7 @@ if (MUL) { P(0, 0) = I3(6, 1, 1, 4, 1, 3); } } break; -case 235 : +case 235 : { P(1, 0) = I3(2, 1, 1, 4, 2, 5); P(1, 1) = I2(3, 1, 4, 5); @@ -1728,7 +1728,7 @@ if (MUL) { P(0, 0) = I3(2, 1, 1, 4, 1, 3); } } break; -case 238 : +case 238 : { P(0, 0) = I2(3, 1, 4, 0); P(1, 0) = I2(3, 1, 4, 5); @@ -1740,7 +1740,7 @@ if (MDL) { P(1, 1) = I3(5, 2, 1, 4, 7, 5); } } break; -case 239 : +case 239 : { P(1, 0) = I2(3, 1, 4, 5); P(1, 1) = I2(3, 1, 4, 5); @@ -1755,8 +1755,8 @@ if (MUL) { P(0, 0) = I3(14, 1, 1, 4, 1, 3); } } break; -case 240 : -case 241 : +case 240 : +case 241 : { P(0, 0) = I3(2, 1, 1, 4, 1, 3); P(1, 0) = I3(2, 1, 1, 4, 1, 2); @@ -1768,7 +1768,7 @@ if (MDR) { P(1, 1) = I3(3, 3, 2, 5, 7, 4); } } break; -case 242 : +case 242 : { P(0, 0) = I3(2, 1, 1, 4, 0, 3); P(0, 1) = I2(3, 1, 4, 3); @@ -1783,7 +1783,7 @@ if (MUR) { P(1, 0) = I3(6, 1, 1, 4, 1, 5); } } break; -case 243 : +case 243 : { P(0, 0) = I2(3, 1, 4, 3); P(1, 0) = I2(3, 1, 4, 2); @@ -1795,8 +1795,8 @@ if (MDR) { P(1, 1) = I3(3, 3, 2, 5, 7, 4); } } break; -case 244 : -case 245 : +case 244 : +case 245 : { P(0, 0) = I3(2, 1, 1, 4, 1, 3); P(1, 0) = I2(3, 1, 4, 1); @@ -1807,7 +1807,7 @@ if (MDR) { P(1, 1) = I3(14, 1, 1, 4, 5, 7); } } break; -case 246 : +case 246 : { P(0, 0) = I3(2, 1, 1, 4, 0, 3); P(0, 1) = I2(3, 1, 4, 3); @@ -1822,7 +1822,7 @@ if (MUR) { P(1, 0) = I3(2, 1, 1, 4, 1, 5); } } break; -case 247 : +case 247 : { P(0, 0) = I2(3, 1, 4, 3); P(0, 1) = I2(3, 1, 4, 3); @@ -1837,7 +1837,7 @@ if (MUR) { P(1, 0) = I3(14, 1, 1, 4, 1, 5); } } break; -case 249 : +case 249 : { P(0, 0) = I2(3, 1, 4, 1); P(1, 0) = I3(2, 1, 1, 4, 1, 2); @@ -1852,7 +1852,7 @@ if (MDR) { P(1, 1) = I3(2, 1, 1, 4, 5, 7); } } break; -case 250 : +case 250 : { P(0, 0) = I2(3, 1, 4, 0); P(1, 0) = I2(3, 1, 4, 2); @@ -1867,7 +1867,7 @@ if (MDR) { P(1, 1) = I3(2, 1, 1, 4, 5, 7); } } break; -case 251 : +case 251 : { P(1, 0) = I2(3, 1, 4, 2); if (MDL) { @@ -1886,7 +1886,7 @@ if (MUL) { P(0, 0) = I3(2, 1, 1, 4, 1, 3); } } break; -case 252 : +case 252 : { P(0, 0) = I3(2, 1, 1, 4, 0, 1); P(1, 0) = I2(3, 1, 4, 1); @@ -1901,7 +1901,7 @@ if (MDR) { P(1, 1) = I3(14, 1, 1, 4, 5, 7); } } break; -case 253 : +case 253 : { P(0, 0) = I2(3, 1, 4, 1); P(1, 0) = I2(3, 1, 4, 1); @@ -1916,7 +1916,7 @@ if (MDR) { P(1, 1) = I3(14, 1, 1, 4, 5, 7); } } break; -case 254 : +case 254 : { P(0, 0) = I2(3, 1, 4, 0); if (MDL) { @@ -1935,7 +1935,7 @@ if (MUR) { P(1, 0) = I3(2, 1, 1, 4, 1, 5); } } break; -case 255 : +case 255 : { if (MDL) { P(0, 1) = I1(4); diff --git a/src/hq3x16c.cpp b/src/hq3x16c.cpp new file mode 100644 index 00000000..9c1b3926 --- /dev/null +++ b/src/hq3x16c.cpp @@ -0,0 +1,28 @@ +/* + VisualBoyAdvance - a Game Boy & Game Boy Advance emulator + + Copyright (C) 1999 - 2003 Forgotten + Copyright (C) 2003 - 2004 Forgotten and the VBA development team + Copyright (C) 2005 - 2006 VBA development team + + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA +*/ + +#define _HQ3X +#define _16BIT +#include "hqxx.h" +#undef _16BIT +#undef _HQ3X diff --git a/src/hq3x32c.cpp b/src/hq3x32c.cpp new file mode 100644 index 00000000..3e40a768 --- /dev/null +++ b/src/hq3x32c.cpp @@ -0,0 +1,28 @@ +/* + VisualBoyAdvance - a Game Boy & Game Boy Advance emulator + + Copyright (C) 1999 - 2003 Forgotten + Copyright (C) 2003 - 2004 Forgotten and the VBA development team + Copyright (C) 2005 - 2006 VBA development team + + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA +*/ + +#define _HQ3X +#define _32BIT +#include "hqxx.h" +#undef _32BIT +#undef _HQ3X diff --git a/src/hq3x_pattern.h b/src/hq3x_pattern.h new file mode 100644 index 00000000..ef182337 --- /dev/null +++ b/src/hq3x_pattern.h @@ -0,0 +1,3639 @@ +/* + VisualBoyAdvance - a Game Boy & Game Boy Advance emulator + + Copyright (C) 1999 - 2003 Forgotten + Copyright (C) 2003 - 2004 Forgotten and the VBA development team + Copyright (C) 2005 - 2006 VBA development team + + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA +*/ + +switch(pattern) +{ +case 0: +case 1: +case 4: +case 32: +case 128: +case 5: +case 132: +case 160: +case 33: +case 129: +case 36: +case 133: +case 164: +case 161: +case 37: +case 165: + { + PIXEL00_2 + PIXEL01_1 + PIXEL02_2 + PIXEL10_1 + PIXEL11 + PIXEL12_1 + PIXEL20_2 + PIXEL21_1 + PIXEL22_2 + break; + } +case 2: +case 34: +case 130: +case 162: + { + PIXEL00_1M + PIXEL01_C + PIXEL02_1M + PIXEL10_1 + PIXEL11 + PIXEL12_1 + PIXEL20_2 + PIXEL21_1 + PIXEL22_2 + break; + } +case 16: +case 17: +case 48: +case 49: + { + PIXEL00_2 + PIXEL01_1 + PIXEL02_1M + PIXEL10_1 + PIXEL11 + PIXEL12_C + PIXEL20_2 + PIXEL21_1 + PIXEL22_1M + break; + } +case 64: +case 65: +case 68: +case 69: + { + PIXEL00_2 + PIXEL01_1 + PIXEL02_2 + PIXEL10_1 + PIXEL11 + PIXEL12_1 + PIXEL20_1M + PIXEL21_C + PIXEL22_1M + break; + } +case 8: +case 12: +case 136: +case 140: + { + PIXEL00_1M + PIXEL01_1 + PIXEL02_2 + PIXEL10_C + PIXEL11 + PIXEL12_1 + PIXEL20_1M + PIXEL21_1 + PIXEL22_2 + break; + } +case 3: +case 35: +case 131: +case 163: + { + PIXEL00_1L + PIXEL01_C + PIXEL02_1M + PIXEL10_1 + PIXEL11 + PIXEL12_1 + PIXEL20_2 + PIXEL21_1 + PIXEL22_2 + break; + } +case 6: +case 38: +case 134: +case 166: + { + PIXEL00_1M + PIXEL01_C + PIXEL02_1R + PIXEL10_1 + PIXEL11 + PIXEL12_1 + PIXEL20_2 + PIXEL21_1 + PIXEL22_2 + break; + } +case 20: +case 21: +case 52: +case 53: + { + PIXEL00_2 + PIXEL01_1 + PIXEL02_1U + PIXEL10_1 + PIXEL11 + PIXEL12_C + PIXEL20_2 + PIXEL21_1 + PIXEL22_1M + break; + } +case 144: +case 145: +case 176: +case 177: + { + PIXEL00_2 + PIXEL01_1 + PIXEL02_1M + PIXEL10_1 + PIXEL11 + PIXEL12_C + PIXEL20_2 + PIXEL21_1 + PIXEL22_1D + break; + } +case 192: +case 193: +case 196: +case 197: + { + PIXEL00_2 + PIXEL01_1 + PIXEL02_2 + PIXEL10_1 + PIXEL11 + PIXEL12_1 + PIXEL20_1M + PIXEL21_C + PIXEL22_1R + break; + } +case 96: +case 97: +case 100: +case 101: + { + PIXEL00_2 + PIXEL01_1 + PIXEL02_2 + PIXEL10_1 + PIXEL11 + PIXEL12_1 + PIXEL20_1L + PIXEL21_C + PIXEL22_1M + break; + } +case 40: +case 44: +case 168: +case 172: + { + PIXEL00_1M + PIXEL01_1 + PIXEL02_2 + PIXEL10_C + PIXEL11 + PIXEL12_1 + PIXEL20_1D + PIXEL21_1 + PIXEL22_2 + break; + } +case 9: +case 13: +case 137: +case 141: + { + PIXEL00_1U + PIXEL01_1 + PIXEL02_2 + PIXEL10_C + PIXEL11 + PIXEL12_1 + PIXEL20_1M + PIXEL21_1 + PIXEL22_2 + break; + } +case 18: +case 50: + { + PIXEL00_1M + + if (Diff(c[2], c[6])) + { + PIXEL01_C + PIXEL02_1M + PIXEL12_C + } + else + { + PIXEL01_3 + PIXEL02_4 + PIXEL12_3 + } + PIXEL10_1 + PIXEL11 + PIXEL20_2 + PIXEL21_1 + PIXEL22_1M + break; + } +case 80: +case 81: + { + PIXEL00_2 + PIXEL01_1 + PIXEL02_1M + PIXEL10_1 + PIXEL11 + PIXEL20_1M + if (Diff(c[6], c[8])) + { + PIXEL12_C + PIXEL21_C + PIXEL22_1M + } + else + { + PIXEL12_3 + PIXEL21_3 + PIXEL22_4 + } + break; + } +case 72: +case 76: + { + PIXEL00_1M + PIXEL01_1 + PIXEL02_2 + PIXEL11 + PIXEL12_1 + if (Diff(c[8], c[4])) + { + PIXEL10_C + PIXEL20_1M + PIXEL21_C + } + else + { + PIXEL10_3 + PIXEL20_4 + PIXEL21_3 + } + PIXEL22_1M + break; + } +case 10: +case 138: + { + if (Diff(c[4], c[2])) + { + PIXEL00_1M + PIXEL01_C + PIXEL10_C + } + else + { + PIXEL00_4 + PIXEL01_3 + PIXEL10_3 + } + PIXEL02_1M + PIXEL11 + PIXEL12_1 + PIXEL20_1M + PIXEL21_1 + PIXEL22_2 + break; + } +case 66: + { + PIXEL00_1M + PIXEL01_C + PIXEL02_1M + PIXEL10_1 + PIXEL11 + PIXEL12_1 + PIXEL20_1M + PIXEL21_C + PIXEL22_1M + break; + } +case 24: + { + PIXEL00_1M + PIXEL01_1 + PIXEL02_1M + PIXEL10_C + PIXEL11 + PIXEL12_C + PIXEL20_1M + PIXEL21_1 + PIXEL22_1M + break; + } +case 7: +case 39: +case 135: + { + PIXEL00_1L + PIXEL01_C + PIXEL02_1R + PIXEL10_1 + PIXEL11 + PIXEL12_1 + PIXEL20_2 + PIXEL21_1 + PIXEL22_2 + break; + } +case 148: +case 149: +case 180: + { + PIXEL00_2 + PIXEL01_1 + PIXEL02_1U + PIXEL10_1 + PIXEL11 + PIXEL12_C + PIXEL20_2 + PIXEL21_1 + PIXEL22_1D + break; + } +case 224: +case 228: +case 225: + { + PIXEL00_2 + PIXEL01_1 + PIXEL02_2 + PIXEL10_1 + PIXEL11 + PIXEL12_1 + PIXEL20_1L + PIXEL21_C + PIXEL22_1R + break; + } +case 41: +case 169: +case 45: + { + PIXEL00_1U + PIXEL01_1 + PIXEL02_2 + PIXEL10_C + PIXEL11 + PIXEL12_1 + PIXEL20_1D + PIXEL21_1 + PIXEL22_2 + break; + } +case 22: +case 54: + { + PIXEL00_1M + if (Diff(c[2], c[6])) + { + PIXEL01_C + PIXEL02_C + PIXEL12_C + } + else + { + PIXEL01_3 + PIXEL02_4 + PIXEL12_3 + } + PIXEL10_1 + PIXEL11 + PIXEL20_2 + PIXEL21_1 + PIXEL22_1M + break; + } +case 208: +case 209: + { + PIXEL00_2 + PIXEL01_1 + PIXEL02_1M + PIXEL10_1 + PIXEL11 + PIXEL20_1M + if (Diff(c[6], c[8])) + { + PIXEL12_C + PIXEL21_C + PIXEL22_C + } + else + { + PIXEL12_3 + PIXEL21_3 + PIXEL22_4 + } + break; + } +case 104: +case 108: + { + PIXEL00_1M + PIXEL01_1 + PIXEL02_2 + PIXEL11 + PIXEL12_1 + if (Diff(c[8], c[4])) + { + PIXEL10_C + PIXEL20_C + PIXEL21_C + } + else + { + PIXEL10_3 + PIXEL20_4 + PIXEL21_3 + } + PIXEL22_1M + break; + } +case 11: +case 139: + { + if (Diff(c[4], c[2])) + { + PIXEL00_C + PIXEL01_C + PIXEL10_C + } + else + { + PIXEL00_4 + PIXEL01_3 + PIXEL10_3 + } + PIXEL02_1M + PIXEL11 + PIXEL12_1 + PIXEL20_1M + PIXEL21_1 + PIXEL22_2 + break; + } +case 19: +case 51: + { + if (Diff(c[2], c[6])) + { + PIXEL00_1L + PIXEL01_C + PIXEL02_1M + PIXEL12_C + } + else + { + PIXEL00_2 + PIXEL01_6 + PIXEL02_5 + PIXEL12_1 + } + PIXEL10_1 + PIXEL11 + PIXEL20_2 + PIXEL21_1 + PIXEL22_1M + break; + } +case 146: +case 178: + { + if (Diff(c[2], c[6])) + { + PIXEL01_C + PIXEL02_1M + PIXEL12_C + PIXEL22_1D + } + else + { + PIXEL01_1 + PIXEL02_5 + PIXEL12_6 + PIXEL22_2 + } + PIXEL00_1M + PIXEL10_1 + PIXEL11 + PIXEL20_2 + PIXEL21_1 + break; + } +case 84: +case 85: + { + if (Diff(c[6], c[8])) + { + PIXEL02_1U + PIXEL12_C + PIXEL21_C + PIXEL22_1M + } + else + { + PIXEL02_2 + PIXEL12_6 + PIXEL21_1 + PIXEL22_5 + } + PIXEL00_2 + PIXEL01_1 + PIXEL10_1 + PIXEL11 + PIXEL20_1M + break; + } +case 112: +case 113: + { + if (Diff(c[6], c[8])) + { + PIXEL12_C + PIXEL20_1L + PIXEL21_C + PIXEL22_1M + } + else + { + PIXEL12_1 + PIXEL20_2 + PIXEL21_6 + PIXEL22_5 + } + PIXEL00_2 + PIXEL01_1 + PIXEL02_1M + PIXEL10_1 + PIXEL11 + break; + } +case 200: +case 204: + { + if (Diff(c[8], c[4])) + { + PIXEL10_C + PIXEL20_1M + PIXEL21_C + PIXEL22_1R + } + else + { + PIXEL10_1 + PIXEL20_5 + PIXEL21_6 + PIXEL22_2 + } + PIXEL00_1M + PIXEL01_1 + PIXEL02_2 + PIXEL11 + PIXEL12_1 + break; + } +case 73: +case 77: + { + if (Diff(c[8], c[4])) + { + PIXEL00_1U + PIXEL10_C + PIXEL20_1M + PIXEL21_C + } + else + { + PIXEL00_2 + PIXEL10_6 + PIXEL20_5 + PIXEL21_1 + } + PIXEL01_1 + PIXEL02_2 + PIXEL11 + PIXEL12_1 + PIXEL22_1M + break; + } +case 42: +case 170: + { + if (Diff(c[4], c[2])) + { + PIXEL00_1M + PIXEL01_C + PIXEL10_C + PIXEL20_1D + } + else + { + PIXEL00_5 + PIXEL01_1 + PIXEL10_6 + PIXEL20_2 + } + PIXEL02_1M + PIXEL11 + PIXEL12_1 + PIXEL21_1 + PIXEL22_2 + break; + } +case 14: +case 142: + { + if (Diff(c[4], c[2])) + { + PIXEL00_1M + PIXEL01_C + PIXEL02_1R + PIXEL10_C + } + else + { + PIXEL00_5 + PIXEL01_6 + PIXEL02_2 + PIXEL10_1 + } + PIXEL11 + PIXEL12_1 + PIXEL20_1M + PIXEL21_1 + PIXEL22_2 + break; + } +case 67: + { + PIXEL00_1L + PIXEL01_C + PIXEL02_1M + PIXEL10_1 + PIXEL11 + PIXEL12_1 + PIXEL20_1M + PIXEL21_C + PIXEL22_1M + break; + } +case 70: + { + PIXEL00_1M + PIXEL01_C + PIXEL02_1R + PIXEL10_1 + PIXEL11 + PIXEL12_1 + PIXEL20_1M + PIXEL21_C + PIXEL22_1M + break; + } +case 28: + { + PIXEL00_1M + PIXEL01_1 + PIXEL02_1U + PIXEL10_C + PIXEL11 + PIXEL12_C + PIXEL20_1M + PIXEL21_1 + PIXEL22_1M + break; + } +case 152: + { + PIXEL00_1M + PIXEL01_1 + PIXEL02_1M + PIXEL10_C + PIXEL11 + PIXEL12_C + PIXEL20_1M + PIXEL21_1 + PIXEL22_1D + break; + } +case 194: + { + PIXEL00_1M + PIXEL01_C + PIXEL02_1M + PIXEL10_1 + PIXEL11 + PIXEL12_1 + PIXEL20_1M + PIXEL21_C + PIXEL22_1R + break; + } +case 98: + { + PIXEL00_1M + PIXEL01_C + PIXEL02_1M + PIXEL10_1 + PIXEL11 + PIXEL12_1 + PIXEL20_1L + PIXEL21_C + PIXEL22_1M + break; + } +case 56: + { + PIXEL00_1M + PIXEL01_1 + PIXEL02_1M + PIXEL10_C + PIXEL11 + PIXEL12_C + PIXEL20_1D + PIXEL21_1 + PIXEL22_1M + break; + } +case 25: + { + PIXEL00_1U + PIXEL01_1 + PIXEL02_1M + PIXEL10_C + PIXEL11 + PIXEL12_C + PIXEL20_1M + PIXEL21_1 + PIXEL22_1M + break; + } +case 26: +case 31: + { + if (Diff(c[4], c[2])) + { + PIXEL00_C + PIXEL10_C + } + else + { + PIXEL00_4 + PIXEL10_3 + } + PIXEL01_C + if (Diff(c[2], c[6])) + { + PIXEL02_C + PIXEL12_C + } + else + { + PIXEL02_4 + PIXEL12_3 + } + PIXEL11 + PIXEL20_1M + PIXEL21_1 + PIXEL22_1M + break; + } +case 82: +case 214: + { + PIXEL00_1M + if (Diff(c[2], c[6])) + { + PIXEL01_C + PIXEL02_C + } + else + { + PIXEL01_3 + PIXEL02_4 + } + PIXEL10_1 + PIXEL11 + PIXEL12_C + PIXEL20_1M + if (Diff(c[6], c[8])) + { + PIXEL21_C + PIXEL22_C + } + else + { + PIXEL21_3 + PIXEL22_4 + } + break; + } +case 88: +case 248: + { + PIXEL00_1M + PIXEL01_1 + PIXEL02_1M + PIXEL11 + if (Diff(c[8], c[4])) + { + PIXEL10_C + PIXEL20_C + } + else + { + PIXEL10_3 + PIXEL20_4 + } + PIXEL21_C + if (Diff(c[6], c[8])) + { + PIXEL12_C + PIXEL22_C + } + else + { + PIXEL12_3 + PIXEL22_4 + } + break; + } +case 74: +case 107: + { + if (Diff(c[4], c[2])) + { + PIXEL00_C + PIXEL01_C + } + else + { + PIXEL00_4 + PIXEL01_3 + } + PIXEL02_1M + PIXEL10_C + PIXEL11 + PIXEL12_1 + if (Diff(c[8], c[4])) + { + PIXEL20_C + PIXEL21_C + } + else + { + PIXEL20_4 + PIXEL21_3 + } + PIXEL22_1M + break; + } +case 27: + { + if (Diff(c[4], c[2])) + { + PIXEL00_C + PIXEL01_C + PIXEL10_C + } + else + { + PIXEL00_4 + PIXEL01_3 + PIXEL10_3 + } + PIXEL02_1M + PIXEL11 + PIXEL12_C + PIXEL20_1M + PIXEL21_1 + PIXEL22_1M + break; + } +case 86: + { + PIXEL00_1M + if (Diff(c[2], c[6])) + { + PIXEL01_C + PIXEL02_C + PIXEL12_C + } + else + { + PIXEL01_3 + PIXEL02_4 + PIXEL12_3 + } + PIXEL10_1 + PIXEL11 + PIXEL20_1M + PIXEL21_C + PIXEL22_1M + break; + } +case 216: + { + PIXEL00_1M + PIXEL01_1 + PIXEL02_1M + PIXEL10_C + PIXEL11 + PIXEL20_1M + if (Diff(c[6], c[8])) + { + PIXEL12_C + PIXEL21_C + PIXEL22_C + } + else + { + PIXEL12_3 + PIXEL21_3 + PIXEL22_4 + } + break; + } +case 106: + { + PIXEL00_1M + PIXEL01_C + PIXEL02_1M + PIXEL11 + PIXEL12_1 + if (Diff(c[8], c[4])) + { + PIXEL10_C + PIXEL20_C + PIXEL21_C + } + else + { + PIXEL10_3 + PIXEL20_4 + PIXEL21_3 + } + PIXEL22_1M + break; + } +case 30: + { + PIXEL00_1M + if (Diff(c[2], c[6])) + { + PIXEL01_C + PIXEL02_C + PIXEL12_C + } + else + { + PIXEL01_3 + PIXEL02_4 + PIXEL12_3 + } + PIXEL10_C + PIXEL11 + PIXEL20_1M + PIXEL21_1 + PIXEL22_1M + break; + } +case 210: + { + PIXEL00_1M + PIXEL01_C + PIXEL02_1M + PIXEL10_1 + PIXEL11 + PIXEL20_1M + if (Diff(c[6], c[8])) + { + PIXEL12_C + PIXEL21_C + PIXEL22_C + } + else + { + PIXEL12_3 + PIXEL21_3 + PIXEL22_4 + } + break; + } +case 120: + { + PIXEL00_1M + PIXEL01_1 + PIXEL02_1M + PIXEL11 + PIXEL12_C + if (Diff(c[8], c[4])) + { + PIXEL10_C + PIXEL20_C + PIXEL21_C + } + else + { + PIXEL10_3 + PIXEL20_4 + PIXEL21_3 + } + PIXEL22_1M + break; + } +case 75: + { + if (Diff(c[4], c[2])) + { + PIXEL00_C + PIXEL01_C + PIXEL10_C + } + else + { + PIXEL00_4 + PIXEL01_3 + PIXEL10_3 + } + PIXEL02_1M + PIXEL11 + PIXEL12_1 + PIXEL20_1M + PIXEL21_C + PIXEL22_1M + break; + } +case 29: + { + PIXEL00_1U + PIXEL01_1 + PIXEL02_1U + PIXEL10_C + PIXEL11 + PIXEL12_C + PIXEL20_1M + PIXEL21_1 + PIXEL22_1M + break; + } +case 198: + { + PIXEL00_1M + PIXEL01_C + PIXEL02_1R + PIXEL10_1 + PIXEL11 + PIXEL12_1 + PIXEL20_1M + PIXEL21_C + PIXEL22_1R + break; + } +case 184: + { + PIXEL00_1M + PIXEL01_1 + PIXEL02_1M + PIXEL10_C + PIXEL11 + PIXEL12_C + PIXEL20_1D + PIXEL21_1 + PIXEL22_1D + break; + } +case 99: + { + PIXEL00_1L + PIXEL01_C + PIXEL02_1M + PIXEL10_1 + PIXEL11 + PIXEL12_1 + PIXEL20_1L + PIXEL21_C + PIXEL22_1M + break; + } +case 57: + { + PIXEL00_1U + PIXEL01_1 + PIXEL02_1M + PIXEL10_C + PIXEL11 + PIXEL12_C + PIXEL20_1D + PIXEL21_1 + PIXEL22_1M + break; + } +case 71: + { + PIXEL00_1L + PIXEL01_C + PIXEL02_1R + PIXEL10_1 + PIXEL11 + PIXEL12_1 + PIXEL20_1M + PIXEL21_C + PIXEL22_1M + break; + } +case 156: + { + PIXEL00_1M + PIXEL01_1 + PIXEL02_1U + PIXEL10_C + PIXEL11 + PIXEL12_C + PIXEL20_1M + PIXEL21_1 + PIXEL22_1D + break; + } +case 226: + { + PIXEL00_1M + PIXEL01_C + PIXEL02_1M + PIXEL10_1 + PIXEL11 + PIXEL12_1 + PIXEL20_1L + PIXEL21_C + PIXEL22_1R + break; + } +case 60: + { + PIXEL00_1M + PIXEL01_1 + PIXEL02_1U + PIXEL10_C + PIXEL11 + PIXEL12_C + PIXEL20_1D + PIXEL21_1 + PIXEL22_1M + break; + } +case 195: + { + PIXEL00_1L + PIXEL01_C + PIXEL02_1M + PIXEL10_1 + PIXEL11 + PIXEL12_1 + PIXEL20_1M + PIXEL21_C + PIXEL22_1R + break; + } +case 102: + { + PIXEL00_1M + PIXEL01_C + PIXEL02_1R + PIXEL10_1 + PIXEL11 + PIXEL12_1 + PIXEL20_1L + PIXEL21_C + PIXEL22_1M + break; + } +case 153: + { + PIXEL00_1U + PIXEL01_1 + PIXEL02_1M + PIXEL10_C + PIXEL11 + PIXEL12_C + PIXEL20_1M + PIXEL21_1 + PIXEL22_1D + break; + } +case 58: + { + if (Diff(c[4], c[2])) + { + PIXEL00_1M + } + else + { + PIXEL00_2 + } + PIXEL01_C + if (Diff(c[2], c[6])) + { + PIXEL02_1M + } + else + { + PIXEL02_2 + } + PIXEL10_C + PIXEL11 + PIXEL12_C + PIXEL20_1D + PIXEL21_1 + PIXEL22_1M + break; + } +case 83: + { + PIXEL00_1L + PIXEL01_C + if (Diff(c[2], c[6])) + { + PIXEL02_1M + } + else + { + PIXEL02_2 + } + PIXEL10_1 + PIXEL11 + PIXEL12_C + PIXEL20_1M + PIXEL21_C + if (Diff(c[6], c[8])) + { + PIXEL22_1M + } + else + { + PIXEL22_2 + } + break; + } +case 92: + { + PIXEL00_1M + PIXEL01_1 + PIXEL02_1U + PIXEL10_C + PIXEL11 + PIXEL12_C + if (Diff(c[8], c[4])) + { + PIXEL20_1M + } + else + { + PIXEL20_2 + } + PIXEL21_C + if (Diff(c[6], c[8])) + { + PIXEL22_1M + } + else + { + PIXEL22_2 + } + break; + } +case 202: + { + if (Diff(c[4], c[2])) + { + PIXEL00_1M + } + else + { + PIXEL00_2 + } + PIXEL01_C + PIXEL02_1M + PIXEL10_C + PIXEL11 + PIXEL12_1 + if (Diff(c[8], c[4])) + { + PIXEL20_1M + } + else + { + PIXEL20_2 + } + PIXEL21_C + PIXEL22_1R + break; + } +case 78: + { + if (Diff(c[4], c[2])) + { + PIXEL00_1M + } + else + { + PIXEL00_2 + } + PIXEL01_C + PIXEL02_1R + PIXEL10_C + PIXEL11 + PIXEL12_1 + if (Diff(c[8], c[4])) + { + PIXEL20_1M + } + else + { + PIXEL20_2 + } + PIXEL21_C + PIXEL22_1M + break; + } +case 154: + { + if (Diff(c[4], c[2])) + { + PIXEL00_1M + } + else + { + PIXEL00_2 + } + PIXEL01_C + if (Diff(c[2], c[6])) + { + PIXEL02_1M + } + else + { + PIXEL02_2 + } + PIXEL10_C + PIXEL11 + PIXEL12_C + PIXEL20_1M + PIXEL21_1 + PIXEL22_1D + break; + } +case 114: + { + PIXEL00_1M + PIXEL01_C + if (Diff(c[2], c[6])) + { + PIXEL02_1M + } + else + { + PIXEL02_2 + } + PIXEL10_1 + PIXEL11 + PIXEL12_C + PIXEL20_1L + PIXEL21_C + if (Diff(c[6], c[8])) + { + PIXEL22_1M + } + else + { + PIXEL22_2 + } + break; + } +case 89: + { + PIXEL00_1U + PIXEL01_1 + PIXEL02_1M + PIXEL10_C + PIXEL11 + PIXEL12_C + if (Diff(c[8], c[4])) + { + PIXEL20_1M + } + else + { + PIXEL20_2 + } + PIXEL21_C + if (Diff(c[6], c[8])) + { + PIXEL22_1M + } + else + { + PIXEL22_2 + } + break; + } +case 90: + { + if (Diff(c[4], c[2])) + { + PIXEL00_1M + } + else + { + PIXEL00_2 + } + PIXEL01_C + if (Diff(c[2], c[6])) + { + PIXEL02_1M + } + else + { + PIXEL02_2 + } + PIXEL10_C + PIXEL11 + PIXEL12_C + if (Diff(c[8], c[4])) + { + PIXEL20_1M + } + else + { + PIXEL20_2 + } + PIXEL21_C + if (Diff(c[6], c[8])) + { + PIXEL22_1M + } + else + { + PIXEL22_2 + } + break; + } +case 55: +case 23: + { + if (Diff(c[2], c[6])) + { + PIXEL00_1L + PIXEL01_C + PIXEL02_C + PIXEL12_C + } + else + { + PIXEL00_2 + PIXEL01_6 + PIXEL02_5 + PIXEL12_1 + } + PIXEL10_1 + PIXEL11 + PIXEL20_2 + PIXEL21_1 + PIXEL22_1M + break; + } +case 182: +case 150: + { + if (Diff(c[2], c[6])) + { + PIXEL01_C + PIXEL02_C + PIXEL12_C + PIXEL22_1D + } + else + { + PIXEL01_1 + PIXEL02_5 + PIXEL12_6 + PIXEL22_2 + } + PIXEL00_1M + PIXEL10_1 + PIXEL11 + PIXEL20_2 + PIXEL21_1 + break; + } +case 213: +case 212: + { + if (Diff(c[6], c[8])) + { + PIXEL02_1U + PIXEL12_C + PIXEL21_C + PIXEL22_C + } + else + { + PIXEL02_2 + PIXEL12_6 + PIXEL21_1 + PIXEL22_5 + } + PIXEL00_2 + PIXEL01_1 + PIXEL10_1 + PIXEL11 + PIXEL20_1M + break; + } +case 241: +case 240: + { + if (Diff(c[6], c[8])) + { + PIXEL12_C + PIXEL20_1L + PIXEL21_C + PIXEL22_C + } + else + { + PIXEL12_1 + PIXEL20_2 + PIXEL21_6 + PIXEL22_5 + } + PIXEL00_2 + PIXEL01_1 + PIXEL02_1M + PIXEL10_1 + PIXEL11 + break; + } +case 236: +case 232: + { + if (Diff(c[8], c[4])) + { + PIXEL10_C + PIXEL20_C + PIXEL21_C + PIXEL22_1R + } + else + { + PIXEL10_1 + PIXEL20_5 + PIXEL21_6 + PIXEL22_2 + } + PIXEL00_1M + PIXEL01_1 + PIXEL02_2 + PIXEL11 + PIXEL12_1 + break; + } +case 109: +case 105: + { + if (Diff(c[8], c[4])) + { + PIXEL00_1U + PIXEL10_C + PIXEL20_C + PIXEL21_C + } + else + { + PIXEL00_2 + PIXEL10_6 + PIXEL20_5 + PIXEL21_1 + } + PIXEL01_1 + PIXEL02_2 + PIXEL11 + PIXEL12_1 + PIXEL22_1M + break; + } +case 171: +case 43: + { + if (Diff(c[4], c[2])) + { + PIXEL00_C + PIXEL01_C + PIXEL10_C + PIXEL20_1D + } + else + { + PIXEL00_5 + PIXEL01_1 + PIXEL10_6 + PIXEL20_2 + } + PIXEL02_1M + PIXEL11 + PIXEL12_1 + PIXEL21_1 + PIXEL22_2 + break; + } +case 143: +case 15: + { + if (Diff(c[4], c[2])) + { + PIXEL00_C + PIXEL01_C + PIXEL02_1R + PIXEL10_C + } + else + { + PIXEL00_5 + PIXEL01_6 + PIXEL02_2 + PIXEL10_1 + } + PIXEL11 + PIXEL12_1 + PIXEL20_1M + PIXEL21_1 + PIXEL22_2 + break; + } +case 124: + { + PIXEL00_1M + PIXEL01_1 + PIXEL02_1U + PIXEL11 + PIXEL12_C + if (Diff(c[8], c[4])) + { + PIXEL10_C + PIXEL20_C + PIXEL21_C + } + else + { + PIXEL10_3 + PIXEL20_4 + PIXEL21_3 + } + PIXEL22_1M + break; + } +case 203: + { + if (Diff(c[4], c[2])) + { + PIXEL00_C + PIXEL01_C + PIXEL10_C + } + else + { + PIXEL00_4 + PIXEL01_3 + PIXEL10_3 + } + PIXEL02_1M + PIXEL11 + PIXEL12_1 + PIXEL20_1M + PIXEL21_C + PIXEL22_1R + break; + } +case 62: + { + PIXEL00_1M + if (Diff(c[2], c[6])) + { + PIXEL01_C + PIXEL02_C + PIXEL12_C + } + else + { + PIXEL01_3 + PIXEL02_4 + PIXEL12_3 + } + PIXEL10_C + PIXEL11 + PIXEL20_1D + PIXEL21_1 + PIXEL22_1M + break; + } +case 211: + { + PIXEL00_1L + PIXEL01_C + PIXEL02_1M + PIXEL10_1 + PIXEL11 + PIXEL20_1M + if (Diff(c[6], c[8])) + { + PIXEL12_C + PIXEL21_C + PIXEL22_C + } + else + { + PIXEL12_3 + PIXEL21_3 + PIXEL22_4 + } + break; + } +case 118: + { + PIXEL00_1M + if (Diff(c[2], c[6])) + { + PIXEL01_C + PIXEL02_C + PIXEL12_C + } + else + { + PIXEL01_3 + PIXEL02_4 + PIXEL12_3 + } + PIXEL10_1 + PIXEL11 + PIXEL20_1L + PIXEL21_C + PIXEL22_1M + break; + } +case 217: + { + PIXEL00_1U + PIXEL01_1 + PIXEL02_1M + PIXEL10_C + PIXEL11 + PIXEL20_1M + if (Diff(c[6], c[8])) + { + PIXEL12_C + PIXEL21_C + PIXEL22_C + } + else + { + PIXEL12_3 + PIXEL21_3 + PIXEL22_4 + } + break; + } +case 110: + { + PIXEL00_1M + PIXEL01_C + PIXEL02_1R + PIXEL11 + PIXEL12_1 + if (Diff(c[8], c[4])) + { + PIXEL10_C + PIXEL20_C + PIXEL21_C + } + else + { + PIXEL10_3 + PIXEL20_4 + PIXEL21_3 + } + PIXEL22_1M + break; + } +case 155: + { + if (Diff(c[4], c[2])) + { + PIXEL00_C + PIXEL01_C + PIXEL10_C + } + else + { + PIXEL00_4 + PIXEL01_3 + PIXEL10_3 + } + PIXEL02_1M + PIXEL11 + PIXEL12_C + PIXEL20_1M + PIXEL21_1 + PIXEL22_1D + break; + } +case 188: + { + PIXEL00_1M + PIXEL01_1 + PIXEL02_1U + PIXEL10_C + PIXEL11 + PIXEL12_C + PIXEL20_1D + PIXEL21_1 + PIXEL22_1D + break; + } +case 185: + { + PIXEL00_1U + PIXEL01_1 + PIXEL02_1M + PIXEL10_C + PIXEL11 + PIXEL12_C + PIXEL20_1D + PIXEL21_1 + PIXEL22_1D + break; + } +case 61: + { + PIXEL00_1U + PIXEL01_1 + PIXEL02_1U + PIXEL10_C + PIXEL11 + PIXEL12_C + PIXEL20_1D + PIXEL21_1 + PIXEL22_1M + break; + } +case 157: + { + PIXEL00_1U + PIXEL01_1 + PIXEL02_1U + PIXEL10_C + PIXEL11 + PIXEL12_C + PIXEL20_1M + PIXEL21_1 + PIXEL22_1D + break; + } +case 103: + { + PIXEL00_1L + PIXEL01_C + PIXEL02_1R + PIXEL10_1 + PIXEL11 + PIXEL12_1 + PIXEL20_1L + PIXEL21_C + PIXEL22_1M + break; + } +case 227: + { + PIXEL00_1L + PIXEL01_C + PIXEL02_1M + PIXEL10_1 + PIXEL11 + PIXEL12_1 + PIXEL20_1L + PIXEL21_C + PIXEL22_1R + break; + } +case 230: + { + PIXEL00_1M + PIXEL01_C + PIXEL02_1R + PIXEL10_1 + PIXEL11 + PIXEL12_1 + PIXEL20_1L + PIXEL21_C + PIXEL22_1R + break; + } +case 199: + { + PIXEL00_1L + PIXEL01_C + PIXEL02_1R + PIXEL10_1 + PIXEL11 + PIXEL12_1 + PIXEL20_1M + PIXEL21_C + PIXEL22_1R + break; + } +case 220: + { + PIXEL00_1M + PIXEL01_1 + PIXEL02_1U + PIXEL10_C + PIXEL11 + if (Diff(c[8], c[4])) + { + PIXEL20_1M + } + else + { + PIXEL20_2 + } + if (Diff(c[6], c[8])) + { + PIXEL12_C + PIXEL21_C + PIXEL22_C + } + else + { + PIXEL12_3 + PIXEL21_3 + PIXEL22_4 + } + break; + } +case 158: + { + if (Diff(c[4], c[2])) + { + PIXEL00_1M + } + else + { + PIXEL00_2 + } + if (Diff(c[2], c[6])) + { + PIXEL01_C + PIXEL02_C + PIXEL12_C + } + else + { + PIXEL01_3 + PIXEL02_4 + PIXEL12_3 + } + PIXEL10_C + PIXEL11 + PIXEL20_1M + PIXEL21_1 + PIXEL22_1D + break; + } +case 234: + { + if (Diff(c[4], c[2])) + { + PIXEL00_1M + } + else + { + PIXEL00_2 + } + PIXEL01_C + PIXEL02_1M + PIXEL11 + PIXEL12_1 + if (Diff(c[8], c[4])) + { + PIXEL10_C + PIXEL20_C + PIXEL21_C + } + else + { + PIXEL10_3 + PIXEL20_4 + PIXEL21_3 + } + PIXEL22_1R + break; + } +case 242: + { + PIXEL00_1M + PIXEL01_C + if (Diff(c[2], c[6])) + { + PIXEL02_1M + } + else + { + PIXEL02_2 + } + PIXEL10_1 + PIXEL11 + PIXEL20_1L + if (Diff(c[6], c[8])) + { + PIXEL12_C + PIXEL21_C + PIXEL22_C + } + else + { + PIXEL12_3 + PIXEL21_3 + PIXEL22_4 + } + break; + } +case 59: + { + if (Diff(c[4], c[2])) + { + PIXEL00_C + PIXEL01_C + PIXEL10_C + } + else + { + PIXEL00_4 + PIXEL01_3 + PIXEL10_3 + } + if (Diff(c[2], c[6])) + { + PIXEL02_1M + } + else + { + PIXEL02_2 + } + PIXEL11 + PIXEL12_C + PIXEL20_1D + PIXEL21_1 + PIXEL22_1M + break; + } +case 121: + { + PIXEL00_1U + PIXEL01_1 + PIXEL02_1M + PIXEL11 + PIXEL12_C + if (Diff(c[8], c[4])) + { + PIXEL10_C + PIXEL20_C + PIXEL21_C + } + else + { + PIXEL10_3 + PIXEL20_4 + PIXEL21_3 + } + if (Diff(c[6], c[8])) + { + PIXEL22_1M + } + else + { + PIXEL22_2 + } + break; + } +case 87: + { + PIXEL00_1L + if (Diff(c[2], c[6])) + { + PIXEL01_C + PIXEL02_C + PIXEL12_C + } + else + { + PIXEL01_3 + PIXEL02_4 + PIXEL12_3 + } + PIXEL10_1 + PIXEL11 + PIXEL20_1M + PIXEL21_C + if (Diff(c[6], c[8])) + { + PIXEL22_1M + } + else + { + PIXEL22_2 + } + break; + } +case 79: + { + if (Diff(c[4], c[2])) + { + PIXEL00_C + PIXEL01_C + PIXEL10_C + } + else + { + PIXEL00_4 + PIXEL01_3 + PIXEL10_3 + } + PIXEL02_1R + PIXEL11 + PIXEL12_1 + if (Diff(c[8], c[4])) + { + PIXEL20_1M + } + else + { + PIXEL20_2 + } + PIXEL21_C + PIXEL22_1M + break; + } +case 122: + { + if (Diff(c[4], c[2])) + { + PIXEL00_1M + } + else + { + PIXEL00_2 + } + PIXEL01_C + if (Diff(c[2], c[6])) + { + PIXEL02_1M + } + else + { + PIXEL02_2 + } + PIXEL11 + PIXEL12_C + if (Diff(c[8], c[4])) + { + PIXEL10_C + PIXEL20_C + PIXEL21_C + } + else + { + PIXEL10_3 + PIXEL20_4 + PIXEL21_3 + } + if (Diff(c[6], c[8])) + { + PIXEL22_1M + } + else + { + PIXEL22_2 + } + break; + } +case 94: + { + if (Diff(c[4], c[2])) + { + PIXEL00_1M + } + else + { + PIXEL00_2 + } + if (Diff(c[2], c[6])) + { + PIXEL01_C + PIXEL02_C + PIXEL12_C + } + else + { + PIXEL01_3 + PIXEL02_4 + PIXEL12_3 + } + PIXEL10_C + PIXEL11 + if (Diff(c[8], c[4])) + { + PIXEL20_1M + } + else + { + PIXEL20_2 + } + PIXEL21_C + if (Diff(c[6], c[8])) + { + PIXEL22_1M + } + else + { + PIXEL22_2 + } + break; + } +case 218: + { + if (Diff(c[4], c[2])) + { + PIXEL00_1M + } + else + { + PIXEL00_2 + } + PIXEL01_C + if (Diff(c[2], c[6])) + { + PIXEL02_1M + } + else + { + PIXEL02_2 + } + PIXEL10_C + PIXEL11 + if (Diff(c[8], c[4])) + { + PIXEL20_1M + } + else + { + PIXEL20_2 + } + if (Diff(c[6], c[8])) + { + PIXEL12_C + PIXEL21_C + PIXEL22_C + } + else + { + PIXEL12_3 + PIXEL21_3 + PIXEL22_4 + } + break; + } +case 91: + { + if (Diff(c[4], c[2])) + { + PIXEL00_C + PIXEL01_C + PIXEL10_C + } + else + { + PIXEL00_4 + PIXEL01_3 + PIXEL10_3 + } + if (Diff(c[2], c[6])) + { + PIXEL02_1M + } + else + { + PIXEL02_2 + } + PIXEL11 + PIXEL12_C + if (Diff(c[8], c[4])) + { + PIXEL20_1M + } + else + { + PIXEL20_2 + } + PIXEL21_C + if (Diff(c[6], c[8])) + { + PIXEL22_1M + } + else + { + PIXEL22_2 + } + break; + } +case 229: + { + PIXEL00_2 + PIXEL01_1 + PIXEL02_2 + PIXEL10_1 + PIXEL11 + PIXEL12_1 + PIXEL20_1L + PIXEL21_C + PIXEL22_1R + break; + } +case 167: + { + PIXEL00_1L + PIXEL01_C + PIXEL02_1R + PIXEL10_1 + PIXEL11 + PIXEL12_1 + PIXEL20_2 + PIXEL21_1 + PIXEL22_2 + break; + } +case 173: + { + PIXEL00_1U + PIXEL01_1 + PIXEL02_2 + PIXEL10_C + PIXEL11 + PIXEL12_1 + PIXEL20_1D + PIXEL21_1 + PIXEL22_2 + break; + } +case 181: + { + PIXEL00_2 + PIXEL01_1 + PIXEL02_1U + PIXEL10_1 + PIXEL11 + PIXEL12_C + PIXEL20_2 + PIXEL21_1 + PIXEL22_1D + break; + } +case 186: + { + if (Diff(c[4], c[2])) + { + PIXEL00_1M + } + else + { + PIXEL00_2 + } + PIXEL01_C + if (Diff(c[2], c[6])) + { + PIXEL02_1M + } + else + { + PIXEL02_2 + } + PIXEL10_C + PIXEL11 + PIXEL12_C + PIXEL20_1D + PIXEL21_1 + PIXEL22_1D + break; + } +case 115: + { + PIXEL00_1L + PIXEL01_C + if (Diff(c[2], c[6])) + { + PIXEL02_1M + } + else + { + PIXEL02_2 + } + PIXEL10_1 + PIXEL11 + PIXEL12_C + PIXEL20_1L + PIXEL21_C + if (Diff(c[6], c[8])) + { + PIXEL22_1M + } + else + { + PIXEL22_2 + } + break; + } +case 93: + { + PIXEL00_1U + PIXEL01_1 + PIXEL02_1U + PIXEL10_C + PIXEL11 + PIXEL12_C + if (Diff(c[8], c[4])) + { + PIXEL20_1M + } + else + { + PIXEL20_2 + } + PIXEL21_C + if (Diff(c[6], c[8])) + { + PIXEL22_1M + } + else + { + PIXEL22_2 + } + break; + } +case 206: + { + if (Diff(c[4], c[2])) + { + PIXEL00_1M + } + else + { + PIXEL00_2 + } + PIXEL01_C + PIXEL02_1R + PIXEL10_C + PIXEL11 + PIXEL12_1 + if (Diff(c[8], c[4])) + { + PIXEL20_1M + } + else + { + PIXEL20_2 + } + PIXEL21_C + PIXEL22_1R + break; + } +case 205: +case 201: + { + PIXEL00_1U + PIXEL01_1 + PIXEL02_2 + PIXEL10_C + PIXEL11 + PIXEL12_1 + if (Diff(c[8], c[4])) + { + PIXEL20_1M + } + else + { + PIXEL20_2 + } + PIXEL21_C + PIXEL22_1R + break; + } +case 174: +case 46: + { + if (Diff(c[4], c[2])) + { + PIXEL00_1M + } + else + { + PIXEL00_2 + } + PIXEL01_C + PIXEL02_1R + PIXEL10_C + PIXEL11 + PIXEL12_1 + PIXEL20_1D + PIXEL21_1 + PIXEL22_2 + break; + } +case 179: +case 147: + { + PIXEL00_1L + PIXEL01_C + if (Diff(c[2], c[6])) + { + PIXEL02_1M + } + else + { + PIXEL02_2 + } + PIXEL10_1 + PIXEL11 + PIXEL12_C + PIXEL20_2 + PIXEL21_1 + PIXEL22_1D + break; + } +case 117: +case 116: + { + PIXEL00_2 + PIXEL01_1 + PIXEL02_1U + PIXEL10_1 + PIXEL11 + PIXEL12_C + PIXEL20_1L + PIXEL21_C + if (Diff(c[6], c[8])) + { + PIXEL22_1M + } + else + { + PIXEL22_2 + } + break; + } +case 189: + { + PIXEL00_1U + PIXEL01_1 + PIXEL02_1U + PIXEL10_C + PIXEL11 + PIXEL12_C + PIXEL20_1D + PIXEL21_1 + PIXEL22_1D + break; + } +case 231: + { + PIXEL00_1L + PIXEL01_C + PIXEL02_1R + PIXEL10_1 + PIXEL11 + PIXEL12_1 + PIXEL20_1L + PIXEL21_C + PIXEL22_1R + break; + } +case 126: + { + PIXEL00_1M + if (Diff(c[2], c[6])) + { + PIXEL01_C + PIXEL02_C + PIXEL12_C + } + else + { + PIXEL01_3 + PIXEL02_4 + PIXEL12_3 + } + PIXEL11 + if (Diff(c[8], c[4])) + { + PIXEL10_C + PIXEL20_C + PIXEL21_C + } + else + { + PIXEL10_3 + PIXEL20_4 + PIXEL21_3 + } + PIXEL22_1M + break; + } +case 219: + { + if (Diff(c[4], c[2])) + { + PIXEL00_C + PIXEL01_C + PIXEL10_C + } + else + { + PIXEL00_4 + PIXEL01_3 + PIXEL10_3 + } + PIXEL02_1M + PIXEL11 + PIXEL20_1M + if (Diff(c[6], c[8])) + { + PIXEL12_C + PIXEL21_C + PIXEL22_C + } + else + { + PIXEL12_3 + PIXEL21_3 + PIXEL22_4 + } + break; + } +case 125: + { + if (Diff(c[8], c[4])) + { + PIXEL00_1U + PIXEL10_C + PIXEL20_C + PIXEL21_C + } + else + { + PIXEL00_2 + PIXEL10_6 + PIXEL20_5 + PIXEL21_1 + } + PIXEL01_1 + PIXEL02_1U + PIXEL11 + PIXEL12_C + PIXEL22_1M + break; + } +case 221: + { + if (Diff(c[6], c[8])) + { + PIXEL02_1U + PIXEL12_C + PIXEL21_C + PIXEL22_C + } + else + { + PIXEL02_2 + PIXEL12_6 + PIXEL21_1 + PIXEL22_5 + } + PIXEL00_1U + PIXEL01_1 + PIXEL10_C + PIXEL11 + PIXEL20_1M + break; + } +case 207: + { + if (Diff(c[4], c[2])) + { + PIXEL00_C + PIXEL01_C + PIXEL02_1R + PIXEL10_C + } + else + { + PIXEL00_5 + PIXEL01_6 + PIXEL02_2 + PIXEL10_1 + } + PIXEL11 + PIXEL12_1 + PIXEL20_1M + PIXEL21_C + PIXEL22_1R + break; + } +case 238: + { + if (Diff(c[8], c[4])) + { + PIXEL10_C + PIXEL20_C + PIXEL21_C + PIXEL22_1R + } + else + { + PIXEL10_1 + PIXEL20_5 + PIXEL21_6 + PIXEL22_2 + } + PIXEL00_1M + PIXEL01_C + PIXEL02_1R + PIXEL11 + PIXEL12_1 + break; + } +case 190: + { + if (Diff(c[2], c[6])) + { + PIXEL01_C + PIXEL02_C + PIXEL12_C + PIXEL22_1D + } + else + { + PIXEL01_1 + PIXEL02_5 + PIXEL12_6 + PIXEL22_2 + } + PIXEL00_1M + PIXEL10_C + PIXEL11 + PIXEL20_1D + PIXEL21_1 + break; + } +case 187: + { + if (Diff(c[4], c[2])) + { + PIXEL00_C + PIXEL01_C + PIXEL10_C + PIXEL20_1D + } + else + { + PIXEL00_5 + PIXEL01_1 + PIXEL10_6 + PIXEL20_2 + } + PIXEL02_1M + PIXEL11 + PIXEL12_C + PIXEL21_1 + PIXEL22_1D + break; + } +case 243: + { + if (Diff(c[6], c[8])) + { + PIXEL12_C + PIXEL20_1L + PIXEL21_C + PIXEL22_C + } + else + { + PIXEL12_1 + PIXEL20_2 + PIXEL21_6 + PIXEL22_5 + } + PIXEL00_1L + PIXEL01_C + PIXEL02_1M + PIXEL10_1 + PIXEL11 + break; + } +case 119: + { + if (Diff(c[2], c[6])) + { + PIXEL00_1L + PIXEL01_C + PIXEL02_C + PIXEL12_C + } + else + { + PIXEL00_2 + PIXEL01_6 + PIXEL02_5 + PIXEL12_1 + } + PIXEL10_1 + PIXEL11 + PIXEL20_1L + PIXEL21_C + PIXEL22_1M + break; + } +case 237: +case 233: + { + PIXEL00_1U + PIXEL01_1 + PIXEL02_2 + PIXEL10_C + PIXEL11 + PIXEL12_1 + if (Diff(c[8], c[4])) + { + PIXEL20_C + } + else + { + PIXEL20_2 + } + PIXEL21_C + PIXEL22_1R + break; + } +case 175: +case 47: + { + if (Diff(c[4], c[2])) + { + PIXEL00_C + } + else + { + PIXEL00_2 + } + PIXEL01_C + PIXEL02_1R + PIXEL10_C + PIXEL11 + PIXEL12_1 + PIXEL20_1D + PIXEL21_1 + PIXEL22_2 + break; + } +case 183: +case 151: + { + PIXEL00_1L + PIXEL01_C + if (Diff(c[2], c[6])) + { + PIXEL02_C + } + else + { + PIXEL02_2 + } + PIXEL10_1 + PIXEL11 + PIXEL12_C + PIXEL20_2 + PIXEL21_1 + PIXEL22_1D + break; + } +case 245: +case 244: + { + PIXEL00_2 + PIXEL01_1 + PIXEL02_1U + PIXEL10_1 + PIXEL11 + PIXEL12_C + PIXEL20_1L + PIXEL21_C + if (Diff(c[6], c[8])) + { + PIXEL22_C + } + else + { + PIXEL22_2 + } + break; + } +case 250: + { + PIXEL00_1M + PIXEL01_C + PIXEL02_1M + PIXEL11 + if (Diff(c[8], c[4])) + { + PIXEL10_C + PIXEL20_C + } + else + { + PIXEL10_3 + PIXEL20_4 + } + PIXEL21_C + if (Diff(c[6], c[8])) + { + PIXEL12_C + PIXEL22_C + } + else + { + PIXEL12_3 + PIXEL22_4 + } + break; + } +case 123: + { + if (Diff(c[4], c[2])) + { + PIXEL00_C + PIXEL01_C + } + else + { + PIXEL00_4 + PIXEL01_3 + } + PIXEL02_1M + PIXEL10_C + PIXEL11 + PIXEL12_C + if (Diff(c[8], c[4])) + { + PIXEL20_C + PIXEL21_C + } + else + { + PIXEL20_4 + PIXEL21_3 + } + PIXEL22_1M + break; + } +case 95: + { + if (Diff(c[4], c[2])) + { + PIXEL00_C + PIXEL10_C + } + else + { + PIXEL00_4 + PIXEL10_3 + } + PIXEL01_C + if (Diff(c[2], c[6])) + { + PIXEL02_C + PIXEL12_C + } + else + { + PIXEL02_4 + PIXEL12_3 + } + PIXEL11 + PIXEL20_1M + PIXEL21_C + PIXEL22_1M + break; + } +case 222: + { + PIXEL00_1M + if (Diff(c[2], c[6])) + { + PIXEL01_C + PIXEL02_C + } + else + { + PIXEL01_3 + PIXEL02_4 + } + PIXEL10_C + PIXEL11 + PIXEL12_C + PIXEL20_1M + if (Diff(c[6], c[8])) + { + PIXEL21_C + PIXEL22_C + } + else + { + PIXEL21_3 + PIXEL22_4 + } + break; + } +case 252: + { + PIXEL00_1M + PIXEL01_1 + PIXEL02_1U + PIXEL11 + PIXEL12_C + if (Diff(c[8], c[4])) + { + PIXEL10_C + PIXEL20_C + } + else + { + PIXEL10_3 + PIXEL20_4 + } + PIXEL21_C + if (Diff(c[6], c[8])) + { + PIXEL22_C + } + else + { + PIXEL22_2 + } + break; + } +case 249: + { + PIXEL00_1U + PIXEL01_1 + PIXEL02_1M + PIXEL10_C + PIXEL11 + if (Diff(c[8], c[4])) + { + PIXEL20_C + } + else + { + PIXEL20_2 + } + PIXEL21_C + if (Diff(c[6], c[8])) + { + PIXEL12_C + PIXEL22_C + } + else + { + PIXEL12_3 + PIXEL22_4 + } + break; + } +case 235: + { + if (Diff(c[4], c[2])) + { + PIXEL00_C + PIXEL01_C + } + else + { + PIXEL00_4 + PIXEL01_3 + } + PIXEL02_1M + PIXEL10_C + PIXEL11 + PIXEL12_1 + if (Diff(c[8], c[4])) + { + PIXEL20_C + } + else + { + PIXEL20_2 + } + PIXEL21_C + PIXEL22_1R + break; + } +case 111: + { + if (Diff(c[4], c[2])) + { + PIXEL00_C + } + else + { + PIXEL00_2 + } + PIXEL01_C + PIXEL02_1R + PIXEL10_C + PIXEL11 + PIXEL12_1 + if (Diff(c[8], c[4])) + { + PIXEL20_C + PIXEL21_C + } + else + { + PIXEL20_4 + PIXEL21_3 + } + PIXEL22_1M + break; + } +case 63: + { + if (Diff(c[4], c[2])) + { + PIXEL00_C + } + else + { + PIXEL00_2 + } + PIXEL01_C + if (Diff(c[2], c[6])) + { + PIXEL02_C + PIXEL12_C + } + else + { + PIXEL02_4 + PIXEL12_3 + } + PIXEL10_C + PIXEL11 + PIXEL20_1D + PIXEL21_1 + PIXEL22_1M + break; + } +case 159: + { + if (Diff(c[4], c[2])) + { + PIXEL00_C + PIXEL10_C + } + else + { + PIXEL00_4 + PIXEL10_3 + } + PIXEL01_C + if (Diff(c[2], c[6])) + { + PIXEL02_C + } + else + { + PIXEL02_2 + } + PIXEL11 + PIXEL12_C + PIXEL20_1M + PIXEL21_1 + PIXEL22_1D + break; + } +case 215: + { + PIXEL00_1L + PIXEL01_C + if (Diff(c[2], c[6])) + { + PIXEL02_C + } + else + { + PIXEL02_2 + } + PIXEL10_1 + PIXEL11 + PIXEL12_C + PIXEL20_1M + if (Diff(c[6], c[8])) + { + PIXEL21_C + PIXEL22_C + } + else + { + PIXEL21_3 + PIXEL22_4 + } + break; + } +case 246: + { + PIXEL00_1M + if (Diff(c[2], c[6])) + { + PIXEL01_C + PIXEL02_C + } + else + { + PIXEL01_3 + PIXEL02_4 + } + PIXEL10_1 + PIXEL11 + PIXEL12_C + PIXEL20_1L + PIXEL21_C + if (Diff(c[6], c[8])) + { + PIXEL22_C + } + else + { + PIXEL22_2 + } + break; + } +case 254: + { + PIXEL00_1M + if (Diff(c[2], c[6])) + { + PIXEL01_C + PIXEL02_C + } + else + { + PIXEL01_3 + PIXEL02_4 + } + PIXEL11 + if (Diff(c[8], c[4])) + { + PIXEL10_C + PIXEL20_C + } + else + { + PIXEL10_3 + PIXEL20_4 + } + if (Diff(c[6], c[8])) + { + PIXEL12_C + PIXEL21_C + PIXEL22_C + } + else + { + PIXEL12_3 + PIXEL21_3 + PIXEL22_2 + } + break; + } +case 253: + { + PIXEL00_1U + PIXEL01_1 + PIXEL02_1U + PIXEL10_C + PIXEL11 + PIXEL12_C + if (Diff(c[8], c[4])) + { + PIXEL20_C + } + else + { + PIXEL20_2 + } + PIXEL21_C + if (Diff(c[6], c[8])) + { + PIXEL22_C + } + else + { + PIXEL22_2 + } + break; + } +case 251: + { + if (Diff(c[4], c[2])) + { + PIXEL00_C + PIXEL01_C + } + else + { + PIXEL00_4 + PIXEL01_3 + } + PIXEL02_1M + PIXEL11 + if (Diff(c[8], c[4])) + { + PIXEL10_C + PIXEL20_C + PIXEL21_C + } + else + { + PIXEL10_3 + PIXEL20_2 + PIXEL21_3 + } + if (Diff(c[6], c[8])) + { + PIXEL12_C + PIXEL22_C + } + else + { + PIXEL12_3 + PIXEL22_4 + } + break; + } +case 239: + { + if (Diff(c[4], c[2])) + { + PIXEL00_C + } + else + { + PIXEL00_2 + } + PIXEL01_C + PIXEL02_1R + PIXEL10_C + PIXEL11 + PIXEL12_1 + if (Diff(c[8], c[4])) + { + PIXEL20_C + } + else + { + PIXEL20_2 + } + PIXEL21_C + PIXEL22_1R + break; + } +case 127: + { + if (Diff(c[4], c[2])) + { + PIXEL00_C + PIXEL01_C + PIXEL10_C + } + else + { + PIXEL00_2 + PIXEL01_3 + PIXEL10_3 + } + if (Diff(c[2], c[6])) + { + PIXEL02_C + PIXEL12_C + } + else + { + PIXEL02_4 + PIXEL12_3 + } + PIXEL11 + if (Diff(c[8], c[4])) + { + PIXEL20_C + PIXEL21_C + } + else + { + PIXEL20_4 + PIXEL21_3 + } + PIXEL22_1M + break; + } +case 191: + { + if (Diff(c[4], c[2])) + { + PIXEL00_C + } + else + { + PIXEL00_2 + } + PIXEL01_C + if (Diff(c[2], c[6])) + { + PIXEL02_C + } + else + { + PIXEL02_2 + } + PIXEL10_C + PIXEL11 + PIXEL12_C + PIXEL20_1D + PIXEL21_1 + PIXEL22_1D + break; + } +case 223: + { + if (Diff(c[4], c[2])) + { + PIXEL00_C + PIXEL10_C + } + else + { + PIXEL00_4 + PIXEL10_3 + } + if (Diff(c[2], c[6])) + { + PIXEL01_C + PIXEL02_C + PIXEL12_C + } + else + { + PIXEL01_3 + PIXEL02_2 + PIXEL12_3 + } + PIXEL11 + PIXEL20_1M + if (Diff(c[6], c[8])) + { + PIXEL21_C + PIXEL22_C + } + else + { + PIXEL21_3 + PIXEL22_4 + } + break; + } +case 247: + { + PIXEL00_1L + PIXEL01_C + if (Diff(c[2], c[6])) + { + PIXEL02_C + } + else + { + PIXEL02_2 + } + PIXEL10_1 + PIXEL11 + PIXEL12_C + PIXEL20_1L + PIXEL21_C + if (Diff(c[6], c[8])) + { + PIXEL22_C + } + else + { + PIXEL22_2 + } + break; + } +case 255: + { + if (Diff(c[4], c[2])) + { + PIXEL00_C + } + else + { + PIXEL00_2 + } + PIXEL01_C + if (Diff(c[2], c[6])) + { + PIXEL02_C + } + else + { + PIXEL02_2 + } + PIXEL10_C + PIXEL11 + PIXEL12_C + if (Diff(c[8], c[4])) + { + PIXEL20_C + } + else + { + PIXEL20_2 + } + PIXEL21_C + if (Diff(c[6], c[8])) + { + PIXEL22_C + } + else + { + PIXEL22_2 + } + break; + } +} diff --git a/src/hq4x16c.cpp b/src/hq4x16c.cpp new file mode 100644 index 00000000..6d4e0a4e --- /dev/null +++ b/src/hq4x16c.cpp @@ -0,0 +1,28 @@ +/* + VisualBoyAdvance - a Game Boy & Game Boy Advance emulator + + Copyright (C) 1999 - 2003 Forgotten + Copyright (C) 2003 - 2004 Forgotten and the VBA development team + Copyright (C) 2005 - 2006 VBA development team + + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA +*/ + +#define _HQ4X +#define _16BIT +#include "hqxx.h" +#undef _16BIT +#undef _HQ4X diff --git a/src/hq4x32c.cpp b/src/hq4x32c.cpp new file mode 100644 index 00000000..a48350fa --- /dev/null +++ b/src/hq4x32c.cpp @@ -0,0 +1,28 @@ +/* + VisualBoyAdvance - a Game Boy & Game Boy Advance emulator + + Copyright (C) 1999 - 2003 Forgotten + Copyright (C) 2003 - 2004 Forgotten and the VBA development team + Copyright (C) 2005 - 2006 VBA development team + + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA +*/ + +#define _HQ4X +#define _32BIT +#include "hqxx.h" +#undef _32BIT +#undef _HQ4X diff --git a/src/hq4x_pattern.h b/src/hq4x_pattern.h new file mode 100644 index 00000000..2a709c47 --- /dev/null +++ b/src/hq4x_pattern.h @@ -0,0 +1,4997 @@ +/* + VisualBoyAdvance - a Game Boy & Game Boy Advance emulator + + Copyright (C) 1999 - 2003 Forgotten + Copyright (C) 2003 - 2004 Forgotten and the VBA development team + Copyright (C) 2005 - 2006 VBA development team + + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA +*/ + +switch(pattern) +{ +case 0: +case 1: +case 4: +case 32: +case 128: +case 5: +case 132: +case 160: +case 33: +case 129: +case 36: +case 133: +case 164: +case 161: +case 37: +case 165: + { + PIXEL00_20 + PIXEL01_60 + PIXEL02_60 + PIXEL03_20 + PIXEL10_60 + PIXEL11_70 + PIXEL12_70 + PIXEL13_60 + PIXEL20_60 + PIXEL21_70 + PIXEL22_70 + PIXEL23_60 + PIXEL30_20 + PIXEL31_60 + PIXEL32_60 + PIXEL33_20 + break; + } +case 2: +case 34: +case 130: +case 162: + { + PIXEL00_80 + PIXEL01_10 + PIXEL02_10 + PIXEL03_80 + PIXEL10_61 + PIXEL11_30 + PIXEL12_30 + PIXEL13_61 + PIXEL20_60 + PIXEL21_70 + PIXEL22_70 + PIXEL23_60 + PIXEL30_20 + PIXEL31_60 + PIXEL32_60 + PIXEL33_20 + break; + } +case 16: +case 17: +case 48: +case 49: + { + PIXEL00_20 + PIXEL01_60 + PIXEL02_61 + PIXEL03_80 + PIXEL10_60 + PIXEL11_70 + PIXEL12_30 + PIXEL13_10 + PIXEL20_60 + PIXEL21_70 + PIXEL22_30 + PIXEL23_10 + PIXEL30_20 + PIXEL31_60 + PIXEL32_61 + PIXEL33_80 + break; + } +case 64: +case 65: +case 68: +case 69: + { + PIXEL00_20 + PIXEL01_60 + PIXEL02_60 + PIXEL03_20 + PIXEL10_60 + PIXEL11_70 + PIXEL12_70 + PIXEL13_60 + PIXEL20_61 + PIXEL21_30 + PIXEL22_30 + PIXEL23_61 + PIXEL30_80 + PIXEL31_10 + PIXEL32_10 + PIXEL33_80 + break; + } +case 8: +case 12: +case 136: +case 140: + { + PIXEL00_80 + PIXEL01_61 + PIXEL02_60 + PIXEL03_20 + PIXEL10_10 + PIXEL11_30 + PIXEL12_70 + PIXEL13_60 + PIXEL20_10 + PIXEL21_30 + PIXEL22_70 + PIXEL23_60 + PIXEL30_80 + PIXEL31_61 + PIXEL32_60 + PIXEL33_20 + break; + } +case 3: +case 35: +case 131: +case 163: + { + PIXEL00_81 + PIXEL01_31 + PIXEL02_10 + PIXEL03_80 + PIXEL10_81 + PIXEL11_31 + PIXEL12_30 + PIXEL13_61 + PIXEL20_60 + PIXEL21_70 + PIXEL22_70 + PIXEL23_60 + PIXEL30_20 + PIXEL31_60 + PIXEL32_60 + PIXEL33_20 + break; + } +case 6: +case 38: +case 134: +case 166: + { + PIXEL00_80 + PIXEL01_10 + PIXEL02_32 + PIXEL03_82 + PIXEL10_61 + PIXEL11_30 + PIXEL12_32 + PIXEL13_82 + PIXEL20_60 + PIXEL21_70 + PIXEL22_70 + PIXEL23_60 + PIXEL30_20 + PIXEL31_60 + PIXEL32_60 + PIXEL33_20 + break; + } +case 20: +case 21: +case 52: +case 53: + { + PIXEL00_20 + PIXEL01_60 + PIXEL02_81 + PIXEL03_81 + PIXEL10_60 + PIXEL11_70 + PIXEL12_31 + PIXEL13_31 + PIXEL20_60 + PIXEL21_70 + PIXEL22_30 + PIXEL23_10 + PIXEL30_20 + PIXEL31_60 + PIXEL32_61 + PIXEL33_80 + break; + } +case 144: +case 145: +case 176: +case 177: + { + PIXEL00_20 + PIXEL01_60 + PIXEL02_61 + PIXEL03_80 + PIXEL10_60 + PIXEL11_70 + PIXEL12_30 + PIXEL13_10 + PIXEL20_60 + PIXEL21_70 + PIXEL22_32 + PIXEL23_32 + PIXEL30_20 + PIXEL31_60 + PIXEL32_82 + PIXEL33_82 + break; + } +case 192: +case 193: +case 196: +case 197: + { + PIXEL00_20 + PIXEL01_60 + PIXEL02_60 + PIXEL03_20 + PIXEL10_60 + PIXEL11_70 + PIXEL12_70 + PIXEL13_60 + PIXEL20_61 + PIXEL21_30 + PIXEL22_31 + PIXEL23_81 + PIXEL30_80 + PIXEL31_10 + PIXEL32_31 + PIXEL33_81 + break; + } +case 96: +case 97: +case 100: +case 101: + { + PIXEL00_20 + PIXEL01_60 + PIXEL02_60 + PIXEL03_20 + PIXEL10_60 + PIXEL11_70 + PIXEL12_70 + PIXEL13_60 + PIXEL20_82 + PIXEL21_32 + PIXEL22_30 + PIXEL23_61 + PIXEL30_82 + PIXEL31_32 + PIXEL32_10 + PIXEL33_80 + break; + } +case 40: +case 44: +case 168: +case 172: + { + PIXEL00_80 + PIXEL01_61 + PIXEL02_60 + PIXEL03_20 + PIXEL10_10 + PIXEL11_30 + PIXEL12_70 + PIXEL13_60 + PIXEL20_31 + PIXEL21_31 + PIXEL22_70 + PIXEL23_60 + PIXEL30_81 + PIXEL31_81 + PIXEL32_60 + PIXEL33_20 + break; + } +case 9: +case 13: +case 137: +case 141: + { + PIXEL00_82 + PIXEL01_82 + PIXEL02_60 + PIXEL03_20 + PIXEL10_32 + PIXEL11_32 + PIXEL12_70 + PIXEL13_60 + PIXEL20_10 + PIXEL21_30 + PIXEL22_70 + PIXEL23_60 + PIXEL30_80 + PIXEL31_61 + PIXEL32_60 + PIXEL33_20 + break; + } +case 18: +case 50: + { + PIXEL00_80 + PIXEL01_10 + if (Diff(c[2], c[6])) + { + PIXEL02_10 + PIXEL03_80 + PIXEL12_30 + PIXEL13_10 + } + else + { + PIXEL02_50 + PIXEL03_50 + PIXEL12_0 + PIXEL13_50 + } + PIXEL10_61 + PIXEL11_30 + PIXEL20_60 + PIXEL21_70 + PIXEL22_30 + PIXEL23_10 + PIXEL30_20 + PIXEL31_60 + PIXEL32_61 + PIXEL33_80 + break; + } +case 80: +case 81: + { + PIXEL00_20 + PIXEL01_60 + PIXEL02_61 + PIXEL03_80 + PIXEL10_60 + PIXEL11_70 + PIXEL12_30 + PIXEL13_10 + PIXEL20_61 + PIXEL21_30 + if (Diff(c[6], c[8])) + { + PIXEL22_30 + PIXEL23_10 + PIXEL32_10 + PIXEL33_80 + } + else + { + PIXEL22_0 + PIXEL23_50 + PIXEL32_50 + PIXEL33_50 + } + PIXEL30_80 + PIXEL31_10 + break; + } +case 72: +case 76: + { + PIXEL00_80 + PIXEL01_61 + PIXEL02_60 + PIXEL03_20 + PIXEL10_10 + PIXEL11_30 + PIXEL12_70 + PIXEL13_60 + if (Diff(c[8], c[4])) + { + PIXEL20_10 + PIXEL21_30 + PIXEL30_80 + PIXEL31_10 + } + else + { + PIXEL20_50 + PIXEL21_0 + PIXEL30_50 + PIXEL31_50 + } + PIXEL22_30 + PIXEL23_61 + PIXEL32_10 + PIXEL33_80 + break; + } +case 10: +case 138: + { + if (Diff(c[4], c[2])) + { + PIXEL00_80 + PIXEL01_10 + PIXEL10_10 + PIXEL11_30 + } + else + { + PIXEL00_50 + PIXEL01_50 + PIXEL10_50 + PIXEL11_0 + } + PIXEL02_10 + PIXEL03_80 + PIXEL12_30 + PIXEL13_61 + PIXEL20_10 + PIXEL21_30 + PIXEL22_70 + PIXEL23_60 + PIXEL30_80 + PIXEL31_61 + PIXEL32_60 + PIXEL33_20 + break; + } +case 66: + { + PIXEL00_80 + PIXEL01_10 + PIXEL02_10 + PIXEL03_80 + PIXEL10_61 + PIXEL11_30 + PIXEL12_30 + PIXEL13_61 + PIXEL20_61 + PIXEL21_30 + PIXEL22_30 + PIXEL23_61 + PIXEL30_80 + PIXEL31_10 + PIXEL32_10 + PIXEL33_80 + break; + } +case 24: + { + PIXEL00_80 + PIXEL01_61 + PIXEL02_61 + PIXEL03_80 + PIXEL10_10 + PIXEL11_30 + PIXEL12_30 + PIXEL13_10 + PIXEL20_10 + PIXEL21_30 + PIXEL22_30 + PIXEL23_10 + PIXEL30_80 + PIXEL31_61 + PIXEL32_61 + PIXEL33_80 + break; + } +case 7: +case 39: +case 135: + { + PIXEL00_81 + PIXEL01_31 + PIXEL02_32 + PIXEL03_82 + PIXEL10_81 + PIXEL11_31 + PIXEL12_32 + PIXEL13_82 + PIXEL20_60 + PIXEL21_70 + PIXEL22_70 + PIXEL23_60 + PIXEL30_20 + PIXEL31_60 + PIXEL32_60 + PIXEL33_20 + break; + } +case 148: +case 149: +case 180: + { + PIXEL00_20 + PIXEL01_60 + PIXEL02_81 + PIXEL03_81 + PIXEL10_60 + PIXEL11_70 + PIXEL12_31 + PIXEL13_31 + PIXEL20_60 + PIXEL21_70 + PIXEL22_32 + PIXEL23_32 + PIXEL30_20 + PIXEL31_60 + PIXEL32_82 + PIXEL33_82 + break; + } +case 224: +case 228: +case 225: + { + PIXEL00_20 + PIXEL01_60 + PIXEL02_60 + PIXEL03_20 + PIXEL10_60 + PIXEL11_70 + PIXEL12_70 + PIXEL13_60 + PIXEL20_82 + PIXEL21_32 + PIXEL22_31 + PIXEL23_81 + PIXEL30_82 + PIXEL31_32 + PIXEL32_31 + PIXEL33_81 + break; + } +case 41: +case 169: +case 45: + { + PIXEL00_82 + PIXEL01_82 + PIXEL02_60 + PIXEL03_20 + PIXEL10_32 + PIXEL11_32 + PIXEL12_70 + PIXEL13_60 + PIXEL20_31 + PIXEL21_31 + PIXEL22_70 + PIXEL23_60 + PIXEL30_81 + PIXEL31_81 + PIXEL32_60 + PIXEL33_20 + break; + } +case 22: +case 54: + { + PIXEL00_80 + PIXEL01_10 + if (Diff(c[2], c[6])) + { + PIXEL02_0 + PIXEL03_0 + PIXEL13_0 + } + else + { + PIXEL02_50 + PIXEL03_50 + PIXEL13_50 + } + PIXEL10_61 + PIXEL11_30 + PIXEL12_0 + PIXEL20_60 + PIXEL21_70 + PIXEL22_30 + PIXEL23_10 + PIXEL30_20 + PIXEL31_60 + PIXEL32_61 + PIXEL33_80 + break; + } +case 208: +case 209: + { + PIXEL00_20 + PIXEL01_60 + PIXEL02_61 + PIXEL03_80 + PIXEL10_60 + PIXEL11_70 + PIXEL12_30 + PIXEL13_10 + PIXEL20_61 + PIXEL21_30 + PIXEL22_0 + if (Diff(c[6], c[8])) + { + PIXEL23_0 + PIXEL32_0 + PIXEL33_0 + } + else + { + PIXEL23_50 + PIXEL32_50 + PIXEL33_50 + } + PIXEL30_80 + PIXEL31_10 + break; + } +case 104: +case 108: + { + PIXEL00_80 + PIXEL01_61 + PIXEL02_60 + PIXEL03_20 + PIXEL10_10 + PIXEL11_30 + PIXEL12_70 + PIXEL13_60 + if (Diff(c[8], c[4])) + { + PIXEL20_0 + PIXEL30_0 + PIXEL31_0 + } + else + { + PIXEL20_50 + PIXEL30_50 + PIXEL31_50 + } + PIXEL21_0 + PIXEL22_30 + PIXEL23_61 + PIXEL32_10 + PIXEL33_80 + break; + } +case 11: +case 139: + { + if (Diff(c[4], c[2])) + { + PIXEL00_0 + PIXEL01_0 + PIXEL10_0 + } + else + { + PIXEL00_50 + PIXEL01_50 + PIXEL10_50 + } + PIXEL02_10 + PIXEL03_80 + PIXEL11_0 + PIXEL12_30 + PIXEL13_61 + PIXEL20_10 + PIXEL21_30 + PIXEL22_70 + PIXEL23_60 + PIXEL30_80 + PIXEL31_61 + PIXEL32_60 + PIXEL33_20 + break; + } +case 19: +case 51: + { + if (Diff(c[2], c[6])) + { + PIXEL00_81 + PIXEL01_31 + PIXEL02_10 + PIXEL03_80 + PIXEL12_30 + PIXEL13_10 + } + else + { + PIXEL00_12 + PIXEL01_14 + PIXEL02_83 + PIXEL03_50 + PIXEL12_70 + PIXEL13_21 + } + PIXEL10_81 + PIXEL11_31 + PIXEL20_60 + PIXEL21_70 + PIXEL22_30 + PIXEL23_10 + PIXEL30_20 + PIXEL31_60 + PIXEL32_61 + PIXEL33_80 + break; + } +case 146: +case 178: + { + PIXEL00_80 + PIXEL01_10 + if (Diff(c[2], c[6])) + { + PIXEL02_10 + PIXEL03_80 + PIXEL12_30 + PIXEL13_10 + PIXEL23_32 + PIXEL33_82 + } + else + { + PIXEL02_21 + PIXEL03_50 + PIXEL12_70 + PIXEL13_83 + PIXEL23_13 + PIXEL33_11 + } + PIXEL10_61 + PIXEL11_30 + PIXEL20_60 + PIXEL21_70 + PIXEL22_32 + PIXEL30_20 + PIXEL31_60 + PIXEL32_82 + break; + } +case 84: +case 85: + { + PIXEL00_20 + PIXEL01_60 + PIXEL02_81 + if (Diff(c[6], c[8])) + { + PIXEL03_81 + PIXEL13_31 + PIXEL22_30 + PIXEL23_10 + PIXEL32_10 + PIXEL33_80 + } + else + { + PIXEL03_12 + PIXEL13_14 + PIXEL22_70 + PIXEL23_83 + PIXEL32_21 + PIXEL33_50 + } + PIXEL10_60 + PIXEL11_70 + PIXEL12_31 + PIXEL20_61 + PIXEL21_30 + PIXEL30_80 + PIXEL31_10 + break; + } +case 112: +case 113: + { + PIXEL00_20 + PIXEL01_60 + PIXEL02_61 + PIXEL03_80 + PIXEL10_60 + PIXEL11_70 + PIXEL12_30 + PIXEL13_10 + PIXEL20_82 + PIXEL21_32 + if (Diff(c[6], c[8])) + { + PIXEL22_30 + PIXEL23_10 + PIXEL30_82 + PIXEL31_32 + PIXEL32_10 + PIXEL33_80 + } + else + { + PIXEL22_70 + PIXEL23_21 + PIXEL30_11 + PIXEL31_13 + PIXEL32_83 + PIXEL33_50 + } + break; + } +case 200: +case 204: + { + PIXEL00_80 + PIXEL01_61 + PIXEL02_60 + PIXEL03_20 + PIXEL10_10 + PIXEL11_30 + PIXEL12_70 + PIXEL13_60 + if (Diff(c[8], c[4])) + { + PIXEL20_10 + PIXEL21_30 + PIXEL30_80 + PIXEL31_10 + PIXEL32_31 + PIXEL33_81 + } + else + { + PIXEL20_21 + PIXEL21_70 + PIXEL30_50 + PIXEL31_83 + PIXEL32_14 + PIXEL33_12 + } + PIXEL22_31 + PIXEL23_81 + break; + } +case 73: +case 77: + { + if (Diff(c[8], c[4])) + { + PIXEL00_82 + PIXEL10_32 + PIXEL20_10 + PIXEL21_30 + PIXEL30_80 + PIXEL31_10 + } + else + { + PIXEL00_11 + PIXEL10_13 + PIXEL20_83 + PIXEL21_70 + PIXEL30_50 + PIXEL31_21 + } + PIXEL01_82 + PIXEL02_60 + PIXEL03_20 + PIXEL11_32 + PIXEL12_70 + PIXEL13_60 + PIXEL22_30 + PIXEL23_61 + PIXEL32_10 + PIXEL33_80 + break; + } +case 42: +case 170: + { + if (Diff(c[4], c[2])) + { + PIXEL00_80 + PIXEL01_10 + PIXEL10_10 + PIXEL11_30 + PIXEL20_31 + PIXEL30_81 + } + else + { + PIXEL00_50 + PIXEL01_21 + PIXEL10_83 + PIXEL11_70 + PIXEL20_14 + PIXEL30_12 + } + PIXEL02_10 + PIXEL03_80 + PIXEL12_30 + PIXEL13_61 + PIXEL21_31 + PIXEL22_70 + PIXEL23_60 + PIXEL31_81 + PIXEL32_60 + PIXEL33_20 + break; + } +case 14: +case 142: + { + if (Diff(c[4], c[2])) + { + PIXEL00_80 + PIXEL01_10 + PIXEL02_32 + PIXEL03_82 + PIXEL10_10 + PIXEL11_30 + } + else + { + PIXEL00_50 + PIXEL01_83 + PIXEL02_13 + PIXEL03_11 + PIXEL10_21 + PIXEL11_70 + } + PIXEL12_32 + PIXEL13_82 + PIXEL20_10 + PIXEL21_30 + PIXEL22_70 + PIXEL23_60 + PIXEL30_80 + PIXEL31_61 + PIXEL32_60 + PIXEL33_20 + break; + } +case 67: + { + PIXEL00_81 + PIXEL01_31 + PIXEL02_10 + PIXEL03_80 + PIXEL10_81 + PIXEL11_31 + PIXEL12_30 + PIXEL13_61 + PIXEL20_61 + PIXEL21_30 + PIXEL22_30 + PIXEL23_61 + PIXEL30_80 + PIXEL31_10 + PIXEL32_10 + PIXEL33_80 + break; + } +case 70: + { + PIXEL00_80 + PIXEL01_10 + PIXEL02_32 + PIXEL03_82 + PIXEL10_61 + PIXEL11_30 + PIXEL12_32 + PIXEL13_82 + PIXEL20_61 + PIXEL21_30 + PIXEL22_30 + PIXEL23_61 + PIXEL30_80 + PIXEL31_10 + PIXEL32_10 + PIXEL33_80 + break; + } +case 28: + { + PIXEL00_80 + PIXEL01_61 + PIXEL02_81 + PIXEL03_81 + PIXEL10_10 + PIXEL11_30 + PIXEL12_31 + PIXEL13_31 + PIXEL20_10 + PIXEL21_30 + PIXEL22_30 + PIXEL23_10 + PIXEL30_80 + PIXEL31_61 + PIXEL32_61 + PIXEL33_80 + break; + } +case 152: + { + PIXEL00_80 + PIXEL01_61 + PIXEL02_61 + PIXEL03_80 + PIXEL10_10 + PIXEL11_30 + PIXEL12_30 + PIXEL13_10 + PIXEL20_10 + PIXEL21_30 + PIXEL22_32 + PIXEL23_32 + PIXEL30_80 + PIXEL31_61 + PIXEL32_82 + PIXEL33_82 + break; + } +case 194: + { + PIXEL00_80 + PIXEL01_10 + PIXEL02_10 + PIXEL03_80 + PIXEL10_61 + PIXEL11_30 + PIXEL12_30 + PIXEL13_61 + PIXEL20_61 + PIXEL21_30 + PIXEL22_31 + PIXEL23_81 + PIXEL30_80 + PIXEL31_10 + PIXEL32_31 + PIXEL33_81 + break; + } +case 98: + { + PIXEL00_80 + PIXEL01_10 + PIXEL02_10 + PIXEL03_80 + PIXEL10_61 + PIXEL11_30 + PIXEL12_30 + PIXEL13_61 + PIXEL20_82 + PIXEL21_32 + PIXEL22_30 + PIXEL23_61 + PIXEL30_82 + PIXEL31_32 + PIXEL32_10 + PIXEL33_80 + break; + } +case 56: + { + PIXEL00_80 + PIXEL01_61 + PIXEL02_61 + PIXEL03_80 + PIXEL10_10 + PIXEL11_30 + PIXEL12_30 + PIXEL13_10 + PIXEL20_31 + PIXEL21_31 + PIXEL22_30 + PIXEL23_10 + PIXEL30_81 + PIXEL31_81 + PIXEL32_61 + PIXEL33_80 + break; + } +case 25: + { + PIXEL00_82 + PIXEL01_82 + PIXEL02_61 + PIXEL03_80 + PIXEL10_32 + PIXEL11_32 + PIXEL12_30 + PIXEL13_10 + PIXEL20_10 + PIXEL21_30 + PIXEL22_30 + PIXEL23_10 + PIXEL30_80 + PIXEL31_61 + PIXEL32_61 + PIXEL33_80 + break; + } +case 26: +case 31: + { + if (Diff(c[4], c[2])) + { + PIXEL00_0 + PIXEL01_0 + PIXEL10_0 + } + else + { + PIXEL00_50 + PIXEL01_50 + PIXEL10_50 + } + if (Diff(c[2], c[6])) + { + PIXEL02_0 + PIXEL03_0 + PIXEL13_0 + } + else + { + PIXEL02_50 + PIXEL03_50 + PIXEL13_50 + } + PIXEL11_0 + PIXEL12_0 + PIXEL20_10 + PIXEL21_30 + PIXEL22_30 + PIXEL23_10 + PIXEL30_80 + PIXEL31_61 + PIXEL32_61 + PIXEL33_80 + break; + } +case 82: +case 214: + { + PIXEL00_80 + PIXEL01_10 + if (Diff(c[2], c[6])) + { + PIXEL02_0 + PIXEL03_0 + PIXEL13_0 + } + else + { + PIXEL02_50 + PIXEL03_50 + PIXEL13_50 + } + PIXEL10_61 + PIXEL11_30 + PIXEL12_0 + PIXEL20_61 + PIXEL21_30 + PIXEL22_0 + if (Diff(c[6], c[8])) + { + PIXEL23_0 + PIXEL32_0 + PIXEL33_0 + } + else + { + PIXEL23_50 + PIXEL32_50 + PIXEL33_50 + } + PIXEL30_80 + PIXEL31_10 + break; + } +case 88: +case 248: + { + PIXEL00_80 + PIXEL01_61 + PIXEL02_61 + PIXEL03_80 + PIXEL10_10 + PIXEL11_30 + PIXEL12_30 + PIXEL13_10 + if (Diff(c[8], c[4])) + { + PIXEL20_0 + PIXEL30_0 + PIXEL31_0 + } + else + { + PIXEL20_50 + PIXEL30_50 + PIXEL31_50 + } + PIXEL21_0 + PIXEL22_0 + if (Diff(c[6], c[8])) + { + PIXEL23_0 + PIXEL32_0 + PIXEL33_0 + } + else + { + PIXEL23_50 + PIXEL32_50 + PIXEL33_50 + } + break; + } +case 74: +case 107: + { + if (Diff(c[4], c[2])) + { + PIXEL00_0 + PIXEL01_0 + PIXEL10_0 + } + else + { + PIXEL00_50 + PIXEL01_50 + PIXEL10_50 + } + PIXEL02_10 + PIXEL03_80 + PIXEL11_0 + PIXEL12_30 + PIXEL13_61 + if (Diff(c[8], c[4])) + { + PIXEL20_0 + PIXEL30_0 + PIXEL31_0 + } + else + { + PIXEL20_50 + PIXEL30_50 + PIXEL31_50 + } + PIXEL21_0 + PIXEL22_30 + PIXEL23_61 + PIXEL32_10 + PIXEL33_80 + break; + } +case 27: + { + if (Diff(c[4], c[2])) + { + PIXEL00_0 + PIXEL01_0 + PIXEL10_0 + } + else + { + PIXEL00_50 + PIXEL01_50 + PIXEL10_50 + } + PIXEL02_10 + PIXEL03_80 + PIXEL11_0 + PIXEL12_30 + PIXEL13_10 + PIXEL20_10 + PIXEL21_30 + PIXEL22_30 + PIXEL23_10 + PIXEL30_80 + PIXEL31_61 + PIXEL32_61 + PIXEL33_80 + break; + } +case 86: + { + PIXEL00_80 + PIXEL01_10 + if (Diff(c[2], c[6])) + { + PIXEL02_0 + PIXEL03_0 + PIXEL13_0 + } + else + { + PIXEL02_50 + PIXEL03_50 + PIXEL13_50 + } + PIXEL10_61 + PIXEL11_30 + PIXEL12_0 + PIXEL20_61 + PIXEL21_30 + PIXEL22_30 + PIXEL23_10 + PIXEL30_80 + PIXEL31_10 + PIXEL32_10 + PIXEL33_80 + break; + } +case 216: + { + PIXEL00_80 + PIXEL01_61 + PIXEL02_61 + PIXEL03_80 + PIXEL10_10 + PIXEL11_30 + PIXEL12_30 + PIXEL13_10 + PIXEL20_10 + PIXEL21_30 + PIXEL22_0 + if (Diff(c[6], c[8])) + { + PIXEL23_0 + PIXEL32_0 + PIXEL33_0 + } + else + { + PIXEL23_50 + PIXEL32_50 + PIXEL33_50 + } + PIXEL30_80 + PIXEL31_10 + break; + } +case 106: + { + PIXEL00_80 + PIXEL01_10 + PIXEL02_10 + PIXEL03_80 + PIXEL10_10 + PIXEL11_30 + PIXEL12_30 + PIXEL13_61 + if (Diff(c[8], c[4])) + { + PIXEL20_0 + PIXEL30_0 + PIXEL31_0 + } + else + { + PIXEL20_50 + PIXEL30_50 + PIXEL31_50 + } + PIXEL21_0 + PIXEL22_30 + PIXEL23_61 + PIXEL32_10 + PIXEL33_80 + break; + } +case 30: + { + PIXEL00_80 + PIXEL01_10 + if (Diff(c[2], c[6])) + { + PIXEL02_0 + PIXEL03_0 + PIXEL13_0 + } + else + { + PIXEL02_50 + PIXEL03_50 + PIXEL13_50 + } + PIXEL10_10 + PIXEL11_30 + PIXEL12_0 + PIXEL20_10 + PIXEL21_30 + PIXEL22_30 + PIXEL23_10 + PIXEL30_80 + PIXEL31_61 + PIXEL32_61 + PIXEL33_80 + break; + } +case 210: + { + PIXEL00_80 + PIXEL01_10 + PIXEL02_10 + PIXEL03_80 + PIXEL10_61 + PIXEL11_30 + PIXEL12_30 + PIXEL13_10 + PIXEL20_61 + PIXEL21_30 + PIXEL22_0 + if (Diff(c[6], c[8])) + { + PIXEL23_0 + PIXEL32_0 + PIXEL33_0 + } + else + { + PIXEL23_50 + PIXEL32_50 + PIXEL33_50 + } + PIXEL30_80 + PIXEL31_10 + break; + } +case 120: + { + PIXEL00_80 + PIXEL01_61 + PIXEL02_61 + PIXEL03_80 + PIXEL10_10 + PIXEL11_30 + PIXEL12_30 + PIXEL13_10 + if (Diff(c[8], c[4])) + { + PIXEL20_0 + PIXEL30_0 + PIXEL31_0 + } + else + { + PIXEL20_50 + PIXEL30_50 + PIXEL31_50 + } + PIXEL21_0 + PIXEL22_30 + PIXEL23_10 + PIXEL32_10 + PIXEL33_80 + break; + } +case 75: + { + if (Diff(c[4], c[2])) + { + PIXEL00_0 + PIXEL01_0 + PIXEL10_0 + } + else + { + PIXEL00_50 + PIXEL01_50 + PIXEL10_50 + } + PIXEL02_10 + PIXEL03_80 + PIXEL11_0 + PIXEL12_30 + PIXEL13_61 + PIXEL20_10 + PIXEL21_30 + PIXEL22_30 + PIXEL23_61 + PIXEL30_80 + PIXEL31_10 + PIXEL32_10 + PIXEL33_80 + break; + } +case 29: + { + PIXEL00_82 + PIXEL01_82 + PIXEL02_81 + PIXEL03_81 + PIXEL10_32 + PIXEL11_32 + PIXEL12_31 + PIXEL13_31 + PIXEL20_10 + PIXEL21_30 + PIXEL22_30 + PIXEL23_10 + PIXEL30_80 + PIXEL31_61 + PIXEL32_61 + PIXEL33_80 + break; + } +case 198: + { + PIXEL00_80 + PIXEL01_10 + PIXEL02_32 + PIXEL03_82 + PIXEL10_61 + PIXEL11_30 + PIXEL12_32 + PIXEL13_82 + PIXEL20_61 + PIXEL21_30 + PIXEL22_31 + PIXEL23_81 + PIXEL30_80 + PIXEL31_10 + PIXEL32_31 + PIXEL33_81 + break; + } +case 184: + { + PIXEL00_80 + PIXEL01_61 + PIXEL02_61 + PIXEL03_80 + PIXEL10_10 + PIXEL11_30 + PIXEL12_30 + PIXEL13_10 + PIXEL20_31 + PIXEL21_31 + PIXEL22_32 + PIXEL23_32 + PIXEL30_81 + PIXEL31_81 + PIXEL32_82 + PIXEL33_82 + break; + } +case 99: + { + PIXEL00_81 + PIXEL01_31 + PIXEL02_10 + PIXEL03_80 + PIXEL10_81 + PIXEL11_31 + PIXEL12_30 + PIXEL13_61 + PIXEL20_82 + PIXEL21_32 + PIXEL22_30 + PIXEL23_61 + PIXEL30_82 + PIXEL31_32 + PIXEL32_10 + PIXEL33_80 + break; + } +case 57: + { + PIXEL00_82 + PIXEL01_82 + PIXEL02_61 + PIXEL03_80 + PIXEL10_32 + PIXEL11_32 + PIXEL12_30 + PIXEL13_10 + PIXEL20_31 + PIXEL21_31 + PIXEL22_30 + PIXEL23_10 + PIXEL30_81 + PIXEL31_81 + PIXEL32_61 + PIXEL33_80 + break; + } +case 71: + { + PIXEL00_81 + PIXEL01_31 + PIXEL02_32 + PIXEL03_82 + PIXEL10_81 + PIXEL11_31 + PIXEL12_32 + PIXEL13_82 + PIXEL20_61 + PIXEL21_30 + PIXEL22_30 + PIXEL23_61 + PIXEL30_80 + PIXEL31_10 + PIXEL32_10 + PIXEL33_80 + break; + } +case 156: + { + PIXEL00_80 + PIXEL01_61 + PIXEL02_81 + PIXEL03_81 + PIXEL10_10 + PIXEL11_30 + PIXEL12_31 + PIXEL13_31 + PIXEL20_10 + PIXEL21_30 + PIXEL22_32 + PIXEL23_32 + PIXEL30_80 + PIXEL31_61 + PIXEL32_82 + PIXEL33_82 + break; + } +case 226: + { + PIXEL00_80 + PIXEL01_10 + PIXEL02_10 + PIXEL03_80 + PIXEL10_61 + PIXEL11_30 + PIXEL12_30 + PIXEL13_61 + PIXEL20_82 + PIXEL21_32 + PIXEL22_31 + PIXEL23_81 + PIXEL30_82 + PIXEL31_32 + PIXEL32_31 + PIXEL33_81 + break; + } +case 60: + { + PIXEL00_80 + PIXEL01_61 + PIXEL02_81 + PIXEL03_81 + PIXEL10_10 + PIXEL11_30 + PIXEL12_31 + PIXEL13_31 + PIXEL20_31 + PIXEL21_31 + PIXEL22_30 + PIXEL23_10 + PIXEL30_81 + PIXEL31_81 + PIXEL32_61 + PIXEL33_80 + break; + } +case 195: + { + PIXEL00_81 + PIXEL01_31 + PIXEL02_10 + PIXEL03_80 + PIXEL10_81 + PIXEL11_31 + PIXEL12_30 + PIXEL13_61 + PIXEL20_61 + PIXEL21_30 + PIXEL22_31 + PIXEL23_81 + PIXEL30_80 + PIXEL31_10 + PIXEL32_31 + PIXEL33_81 + break; + } +case 102: + { + PIXEL00_80 + PIXEL01_10 + PIXEL02_32 + PIXEL03_82 + PIXEL10_61 + PIXEL11_30 + PIXEL12_32 + PIXEL13_82 + PIXEL20_82 + PIXEL21_32 + PIXEL22_30 + PIXEL23_61 + PIXEL30_82 + PIXEL31_32 + PIXEL32_10 + PIXEL33_80 + break; + } +case 153: + { + PIXEL00_82 + PIXEL01_82 + PIXEL02_61 + PIXEL03_80 + PIXEL10_32 + PIXEL11_32 + PIXEL12_30 + PIXEL13_10 + PIXEL20_10 + PIXEL21_30 + PIXEL22_32 + PIXEL23_32 + PIXEL30_80 + PIXEL31_61 + PIXEL32_82 + PIXEL33_82 + break; + } +case 58: + { + if (Diff(c[4], c[2])) + { + PIXEL00_80 + PIXEL01_10 + PIXEL10_10 + PIXEL11_30 + } + else + { + PIXEL00_20 + PIXEL01_12 + PIXEL10_11 + PIXEL11_0 + } + if (Diff(c[2], c[6])) + { + PIXEL02_10 + PIXEL03_80 + PIXEL12_30 + PIXEL13_10 + } + else + { + PIXEL02_11 + PIXEL03_20 + PIXEL12_0 + PIXEL13_12 + } + PIXEL20_31 + PIXEL21_31 + PIXEL22_30 + PIXEL23_10 + PIXEL30_81 + PIXEL31_81 + PIXEL32_61 + PIXEL33_80 + break; + } +case 83: + { + PIXEL00_81 + PIXEL01_31 + if (Diff(c[2], c[6])) + { + PIXEL02_10 + PIXEL03_80 + PIXEL12_30 + PIXEL13_10 + } + else + { + PIXEL02_11 + PIXEL03_20 + PIXEL12_0 + PIXEL13_12 + } + PIXEL10_81 + PIXEL11_31 + PIXEL20_61 + PIXEL21_30 + if (Diff(c[6], c[8])) + { + PIXEL22_30 + PIXEL23_10 + PIXEL32_10 + PIXEL33_80 + } + else + { + PIXEL22_0 + PIXEL23_11 + PIXEL32_12 + PIXEL33_20 + } + PIXEL30_80 + PIXEL31_10 + break; + } +case 92: + { + PIXEL00_80 + PIXEL01_61 + PIXEL02_81 + PIXEL03_81 + PIXEL10_10 + PIXEL11_30 + PIXEL12_31 + PIXEL13_31 + if (Diff(c[8], c[4])) + { + PIXEL20_10 + PIXEL21_30 + PIXEL30_80 + PIXEL31_10 + } + else + { + PIXEL20_12 + PIXEL21_0 + PIXEL30_20 + PIXEL31_11 + } + if (Diff(c[6], c[8])) + { + PIXEL22_30 + PIXEL23_10 + PIXEL32_10 + PIXEL33_80 + } + else + { + PIXEL22_0 + PIXEL23_11 + PIXEL32_12 + PIXEL33_20 + } + break; + } +case 202: + { + if (Diff(c[4], c[2])) + { + PIXEL00_80 + PIXEL01_10 + PIXEL10_10 + PIXEL11_30 + } + else + { + PIXEL00_20 + PIXEL01_12 + PIXEL10_11 + PIXEL11_0 + } + PIXEL02_10 + PIXEL03_80 + PIXEL12_30 + PIXEL13_61 + if (Diff(c[8], c[4])) + { + PIXEL20_10 + PIXEL21_30 + PIXEL30_80 + PIXEL31_10 + } + else + { + PIXEL20_12 + PIXEL21_0 + PIXEL30_20 + PIXEL31_11 + } + PIXEL22_31 + PIXEL23_81 + PIXEL32_31 + PIXEL33_81 + break; + } +case 78: + { + if (Diff(c[4], c[2])) + { + PIXEL00_80 + PIXEL01_10 + PIXEL10_10 + PIXEL11_30 + } + else + { + PIXEL00_20 + PIXEL01_12 + PIXEL10_11 + PIXEL11_0 + } + PIXEL02_32 + PIXEL03_82 + PIXEL12_32 + PIXEL13_82 + if (Diff(c[8], c[4])) + { + PIXEL20_10 + PIXEL21_30 + PIXEL30_80 + PIXEL31_10 + } + else + { + PIXEL20_12 + PIXEL21_0 + PIXEL30_20 + PIXEL31_11 + } + PIXEL22_30 + PIXEL23_61 + PIXEL32_10 + PIXEL33_80 + break; + } +case 154: + { + if (Diff(c[4], c[2])) + { + PIXEL00_80 + PIXEL01_10 + PIXEL10_10 + PIXEL11_30 + } + else + { + PIXEL00_20 + PIXEL01_12 + PIXEL10_11 + PIXEL11_0 + } + if (Diff(c[2], c[6])) + { + PIXEL02_10 + PIXEL03_80 + PIXEL12_30 + PIXEL13_10 + } + else + { + PIXEL02_11 + PIXEL03_20 + PIXEL12_0 + PIXEL13_12 + } + PIXEL20_10 + PIXEL21_30 + PIXEL22_32 + PIXEL23_32 + PIXEL30_80 + PIXEL31_61 + PIXEL32_82 + PIXEL33_82 + break; + } +case 114: + { + PIXEL00_80 + PIXEL01_10 + if (Diff(c[2], c[6])) + { + PIXEL02_10 + PIXEL03_80 + PIXEL12_30 + PIXEL13_10 + } + else + { + PIXEL02_11 + PIXEL03_20 + PIXEL12_0 + PIXEL13_12 + } + PIXEL10_61 + PIXEL11_30 + PIXEL20_82 + PIXEL21_32 + if (Diff(c[6], c[8])) + { + PIXEL22_30 + PIXEL23_10 + PIXEL32_10 + PIXEL33_80 + } + else + { + PIXEL22_0 + PIXEL23_11 + PIXEL32_12 + PIXEL33_20 + } + PIXEL30_82 + PIXEL31_32 + break; + } +case 89: + { + PIXEL00_82 + PIXEL01_82 + PIXEL02_61 + PIXEL03_80 + PIXEL10_32 + PIXEL11_32 + PIXEL12_30 + PIXEL13_10 + if (Diff(c[8], c[4])) + { + PIXEL20_10 + PIXEL21_30 + PIXEL30_80 + PIXEL31_10 + } + else + { + PIXEL20_12 + PIXEL21_0 + PIXEL30_20 + PIXEL31_11 + } + if (Diff(c[6], c[8])) + { + PIXEL22_30 + PIXEL23_10 + PIXEL32_10 + PIXEL33_80 + } + else + { + PIXEL22_0 + PIXEL23_11 + PIXEL32_12 + PIXEL33_20 + } + break; + } +case 90: + { + if (Diff(c[4], c[2])) + { + PIXEL00_80 + PIXEL01_10 + PIXEL10_10 + PIXEL11_30 + } + else + { + PIXEL00_20 + PIXEL01_12 + PIXEL10_11 + PIXEL11_0 + } + if (Diff(c[2], c[6])) + { + PIXEL02_10 + PIXEL03_80 + PIXEL12_30 + PIXEL13_10 + } + else + { + PIXEL02_11 + PIXEL03_20 + PIXEL12_0 + PIXEL13_12 + } + if (Diff(c[8], c[4])) + { + PIXEL20_10 + PIXEL21_30 + PIXEL30_80 + PIXEL31_10 + } + else + { + PIXEL20_12 + PIXEL21_0 + PIXEL30_20 + PIXEL31_11 + } + if (Diff(c[6], c[8])) + { + PIXEL22_30 + PIXEL23_10 + PIXEL32_10 + PIXEL33_80 + } + else + { + PIXEL22_0 + PIXEL23_11 + PIXEL32_12 + PIXEL33_20 + } + break; + } +case 55: +case 23: + { + if (Diff(c[2], c[6])) + { + PIXEL00_81 + PIXEL01_31 + PIXEL02_0 + PIXEL03_0 + PIXEL12_0 + PIXEL13_0 + } + else + { + PIXEL00_12 + PIXEL01_14 + PIXEL02_83 + PIXEL03_50 + PIXEL12_70 + PIXEL13_21 + } + PIXEL10_81 + PIXEL11_31 + PIXEL20_60 + PIXEL21_70 + PIXEL22_30 + PIXEL23_10 + PIXEL30_20 + PIXEL31_60 + PIXEL32_61 + PIXEL33_80 + break; + } +case 182: +case 150: + { + PIXEL00_80 + PIXEL01_10 + if (Diff(c[2], c[6])) + { + PIXEL02_0 + PIXEL03_0 + PIXEL12_0 + PIXEL13_0 + PIXEL23_32 + PIXEL33_82 + } + else + { + PIXEL02_21 + PIXEL03_50 + PIXEL12_70 + PIXEL13_83 + PIXEL23_13 + PIXEL33_11 + } + PIXEL10_61 + PIXEL11_30 + PIXEL20_60 + PIXEL21_70 + PIXEL22_32 + PIXEL30_20 + PIXEL31_60 + PIXEL32_82 + break; + } +case 213: +case 212: + { + PIXEL00_20 + PIXEL01_60 + PIXEL02_81 + if (Diff(c[6], c[8])) + { + PIXEL03_81 + PIXEL13_31 + PIXEL22_0 + PIXEL23_0 + PIXEL32_0 + PIXEL33_0 + } + else + { + PIXEL03_12 + PIXEL13_14 + PIXEL22_70 + PIXEL23_83 + PIXEL32_21 + PIXEL33_50 + } + PIXEL10_60 + PIXEL11_70 + PIXEL12_31 + PIXEL20_61 + PIXEL21_30 + PIXEL30_80 + PIXEL31_10 + break; + } +case 241: +case 240: + { + PIXEL00_20 + PIXEL01_60 + PIXEL02_61 + PIXEL03_80 + PIXEL10_60 + PIXEL11_70 + PIXEL12_30 + PIXEL13_10 + PIXEL20_82 + PIXEL21_32 + if (Diff(c[6], c[8])) + { + PIXEL22_0 + PIXEL23_0 + PIXEL30_82 + PIXEL31_32 + PIXEL32_0 + PIXEL33_0 + } + else + { + PIXEL22_70 + PIXEL23_21 + PIXEL30_11 + PIXEL31_13 + PIXEL32_83 + PIXEL33_50 + } + break; + } +case 236: +case 232: + { + PIXEL00_80 + PIXEL01_61 + PIXEL02_60 + PIXEL03_20 + PIXEL10_10 + PIXEL11_30 + PIXEL12_70 + PIXEL13_60 + if (Diff(c[8], c[4])) + { + PIXEL20_0 + PIXEL21_0 + PIXEL30_0 + PIXEL31_0 + PIXEL32_31 + PIXEL33_81 + } + else + { + PIXEL20_21 + PIXEL21_70 + PIXEL30_50 + PIXEL31_83 + PIXEL32_14 + PIXEL33_12 + } + PIXEL22_31 + PIXEL23_81 + break; + } +case 109: +case 105: + { + if (Diff(c[8], c[4])) + { + PIXEL00_82 + PIXEL10_32 + PIXEL20_0 + PIXEL21_0 + PIXEL30_0 + PIXEL31_0 + } + else + { + PIXEL00_11 + PIXEL10_13 + PIXEL20_83 + PIXEL21_70 + PIXEL30_50 + PIXEL31_21 + } + PIXEL01_82 + PIXEL02_60 + PIXEL03_20 + PIXEL11_32 + PIXEL12_70 + PIXEL13_60 + PIXEL22_30 + PIXEL23_61 + PIXEL32_10 + PIXEL33_80 + break; + } +case 171: +case 43: + { + if (Diff(c[4], c[2])) + { + PIXEL00_0 + PIXEL01_0 + PIXEL10_0 + PIXEL11_0 + PIXEL20_31 + PIXEL30_81 + } + else + { + PIXEL00_50 + PIXEL01_21 + PIXEL10_83 + PIXEL11_70 + PIXEL20_14 + PIXEL30_12 + } + PIXEL02_10 + PIXEL03_80 + PIXEL12_30 + PIXEL13_61 + PIXEL21_31 + PIXEL22_70 + PIXEL23_60 + PIXEL31_81 + PIXEL32_60 + PIXEL33_20 + break; + } +case 143: +case 15: + { + if (Diff(c[4], c[2])) + { + PIXEL00_0 + PIXEL01_0 + PIXEL02_32 + PIXEL03_82 + PIXEL10_0 + PIXEL11_0 + } + else + { + PIXEL00_50 + PIXEL01_83 + PIXEL02_13 + PIXEL03_11 + PIXEL10_21 + PIXEL11_70 + } + PIXEL12_32 + PIXEL13_82 + PIXEL20_10 + PIXEL21_30 + PIXEL22_70 + PIXEL23_60 + PIXEL30_80 + PIXEL31_61 + PIXEL32_60 + PIXEL33_20 + break; + } +case 124: + { + PIXEL00_80 + PIXEL01_61 + PIXEL02_81 + PIXEL03_81 + PIXEL10_10 + PIXEL11_30 + PIXEL12_31 + PIXEL13_31 + if (Diff(c[8], c[4])) + { + PIXEL20_0 + PIXEL30_0 + PIXEL31_0 + } + else + { + PIXEL20_50 + PIXEL30_50 + PIXEL31_50 + } + PIXEL21_0 + PIXEL22_30 + PIXEL23_10 + PIXEL32_10 + PIXEL33_80 + break; + } +case 203: + { + if (Diff(c[4], c[2])) + { + PIXEL00_0 + PIXEL01_0 + PIXEL10_0 + } + else + { + PIXEL00_50 + PIXEL01_50 + PIXEL10_50 + } + PIXEL02_10 + PIXEL03_80 + PIXEL11_0 + PIXEL12_30 + PIXEL13_61 + PIXEL20_10 + PIXEL21_30 + PIXEL22_31 + PIXEL23_81 + PIXEL30_80 + PIXEL31_10 + PIXEL32_31 + PIXEL33_81 + break; + } +case 62: + { + PIXEL00_80 + PIXEL01_10 + if (Diff(c[2], c[6])) + { + PIXEL02_0 + PIXEL03_0 + PIXEL13_0 + } + else + { + PIXEL02_50 + PIXEL03_50 + PIXEL13_50 + } + PIXEL10_10 + PIXEL11_30 + PIXEL12_0 + PIXEL20_31 + PIXEL21_31 + PIXEL22_30 + PIXEL23_10 + PIXEL30_81 + PIXEL31_81 + PIXEL32_61 + PIXEL33_80 + break; + } +case 211: + { + PIXEL00_81 + PIXEL01_31 + PIXEL02_10 + PIXEL03_80 + PIXEL10_81 + PIXEL11_31 + PIXEL12_30 + PIXEL13_10 + PIXEL20_61 + PIXEL21_30 + PIXEL22_0 + if (Diff(c[6], c[8])) + { + PIXEL23_0 + PIXEL32_0 + PIXEL33_0 + } + else + { + PIXEL23_50 + PIXEL32_50 + PIXEL33_50 + } + PIXEL30_80 + PIXEL31_10 + break; + } +case 118: + { + PIXEL00_80 + PIXEL01_10 + if (Diff(c[2], c[6])) + { + PIXEL02_0 + PIXEL03_0 + PIXEL13_0 + } + else + { + PIXEL02_50 + PIXEL03_50 + PIXEL13_50 + } + PIXEL10_61 + PIXEL11_30 + PIXEL12_0 + PIXEL20_82 + PIXEL21_32 + PIXEL22_30 + PIXEL23_10 + PIXEL30_82 + PIXEL31_32 + PIXEL32_10 + PIXEL33_80 + break; + } +case 217: + { + PIXEL00_82 + PIXEL01_82 + PIXEL02_61 + PIXEL03_80 + PIXEL10_32 + PIXEL11_32 + PIXEL12_30 + PIXEL13_10 + PIXEL20_10 + PIXEL21_30 + PIXEL22_0 + if (Diff(c[6], c[8])) + { + PIXEL23_0 + PIXEL32_0 + PIXEL33_0 + } + else + { + PIXEL23_50 + PIXEL32_50 + PIXEL33_50 + } + PIXEL30_80 + PIXEL31_10 + break; + } +case 110: + { + PIXEL00_80 + PIXEL01_10 + PIXEL02_32 + PIXEL03_82 + PIXEL10_10 + PIXEL11_30 + PIXEL12_32 + PIXEL13_82 + if (Diff(c[8], c[4])) + { + PIXEL20_0 + PIXEL30_0 + PIXEL31_0 + } + else + { + PIXEL20_50 + PIXEL30_50 + PIXEL31_50 + } + PIXEL21_0 + PIXEL22_30 + PIXEL23_61 + PIXEL32_10 + PIXEL33_80 + break; + } +case 155: + { + if (Diff(c[4], c[2])) + { + PIXEL00_0 + PIXEL01_0 + PIXEL10_0 + } + else + { + PIXEL00_50 + PIXEL01_50 + PIXEL10_50 + } + PIXEL02_10 + PIXEL03_80 + PIXEL11_0 + PIXEL12_30 + PIXEL13_10 + PIXEL20_10 + PIXEL21_30 + PIXEL22_32 + PIXEL23_32 + PIXEL30_80 + PIXEL31_61 + PIXEL32_82 + PIXEL33_82 + break; + } +case 188: + { + PIXEL00_80 + PIXEL01_61 + PIXEL02_81 + PIXEL03_81 + PIXEL10_10 + PIXEL11_30 + PIXEL12_31 + PIXEL13_31 + PIXEL20_31 + PIXEL21_31 + PIXEL22_32 + PIXEL23_32 + PIXEL30_81 + PIXEL31_81 + PIXEL32_82 + PIXEL33_82 + break; + } +case 185: + { + PIXEL00_82 + PIXEL01_82 + PIXEL02_61 + PIXEL03_80 + PIXEL10_32 + PIXEL11_32 + PIXEL12_30 + PIXEL13_10 + PIXEL20_31 + PIXEL21_31 + PIXEL22_32 + PIXEL23_32 + PIXEL30_81 + PIXEL31_81 + PIXEL32_82 + PIXEL33_82 + break; + } +case 61: + { + PIXEL00_82 + PIXEL01_82 + PIXEL02_81 + PIXEL03_81 + PIXEL10_32 + PIXEL11_32 + PIXEL12_31 + PIXEL13_31 + PIXEL20_31 + PIXEL21_31 + PIXEL22_30 + PIXEL23_10 + PIXEL30_81 + PIXEL31_81 + PIXEL32_61 + PIXEL33_80 + break; + } +case 157: + { + PIXEL00_82 + PIXEL01_82 + PIXEL02_81 + PIXEL03_81 + PIXEL10_32 + PIXEL11_32 + PIXEL12_31 + PIXEL13_31 + PIXEL20_10 + PIXEL21_30 + PIXEL22_32 + PIXEL23_32 + PIXEL30_80 + PIXEL31_61 + PIXEL32_82 + PIXEL33_82 + break; + } +case 103: + { + PIXEL00_81 + PIXEL01_31 + PIXEL02_32 + PIXEL03_82 + PIXEL10_81 + PIXEL11_31 + PIXEL12_32 + PIXEL13_82 + PIXEL20_82 + PIXEL21_32 + PIXEL22_30 + PIXEL23_61 + PIXEL30_82 + PIXEL31_32 + PIXEL32_10 + PIXEL33_80 + break; + } +case 227: + { + PIXEL00_81 + PIXEL01_31 + PIXEL02_10 + PIXEL03_80 + PIXEL10_81 + PIXEL11_31 + PIXEL12_30 + PIXEL13_61 + PIXEL20_82 + PIXEL21_32 + PIXEL22_31 + PIXEL23_81 + PIXEL30_82 + PIXEL31_32 + PIXEL32_31 + PIXEL33_81 + break; + } +case 230: + { + PIXEL00_80 + PIXEL01_10 + PIXEL02_32 + PIXEL03_82 + PIXEL10_61 + PIXEL11_30 + PIXEL12_32 + PIXEL13_82 + PIXEL20_82 + PIXEL21_32 + PIXEL22_31 + PIXEL23_81 + PIXEL30_82 + PIXEL31_32 + PIXEL32_31 + PIXEL33_81 + break; + } +case 199: + { + PIXEL00_81 + PIXEL01_31 + PIXEL02_32 + PIXEL03_82 + PIXEL10_81 + PIXEL11_31 + PIXEL12_32 + PIXEL13_82 + PIXEL20_61 + PIXEL21_30 + PIXEL22_31 + PIXEL23_81 + PIXEL30_80 + PIXEL31_10 + PIXEL32_31 + PIXEL33_81 + break; + } +case 220: + { + PIXEL00_80 + PIXEL01_61 + PIXEL02_81 + PIXEL03_81 + PIXEL10_10 + PIXEL11_30 + PIXEL12_31 + PIXEL13_31 + if (Diff(c[8], c[4])) + { + PIXEL20_10 + PIXEL21_30 + PIXEL30_80 + PIXEL31_10 + } + else + { + PIXEL20_12 + PIXEL21_0 + PIXEL30_20 + PIXEL31_11 + } + PIXEL22_0 + if (Diff(c[6], c[8])) + { + PIXEL23_0 + PIXEL32_0 + PIXEL33_0 + } + else + { + PIXEL23_50 + PIXEL32_50 + PIXEL33_50 + } + break; + } +case 158: + { + if (Diff(c[4], c[2])) + { + PIXEL00_80 + PIXEL01_10 + PIXEL10_10 + PIXEL11_30 + } + else + { + PIXEL00_20 + PIXEL01_12 + PIXEL10_11 + PIXEL11_0 + } + if (Diff(c[2], c[6])) + { + PIXEL02_0 + PIXEL03_0 + PIXEL13_0 + } + else + { + PIXEL02_50 + PIXEL03_50 + PIXEL13_50 + } + PIXEL12_0 + PIXEL20_10 + PIXEL21_30 + PIXEL22_32 + PIXEL23_32 + PIXEL30_80 + PIXEL31_61 + PIXEL32_82 + PIXEL33_82 + break; + } +case 234: + { + if (Diff(c[4], c[2])) + { + PIXEL00_80 + PIXEL01_10 + PIXEL10_10 + PIXEL11_30 + } + else + { + PIXEL00_20 + PIXEL01_12 + PIXEL10_11 + PIXEL11_0 + } + PIXEL02_10 + PIXEL03_80 + PIXEL12_30 + PIXEL13_61 + if (Diff(c[8], c[4])) + { + PIXEL20_0 + PIXEL30_0 + PIXEL31_0 + } + else + { + PIXEL20_50 + PIXEL30_50 + PIXEL31_50 + } + PIXEL21_0 + PIXEL22_31 + PIXEL23_81 + PIXEL32_31 + PIXEL33_81 + break; + } +case 242: + { + PIXEL00_80 + PIXEL01_10 + if (Diff(c[2], c[6])) + { + PIXEL02_10 + PIXEL03_80 + PIXEL12_30 + PIXEL13_10 + } + else + { + PIXEL02_11 + PIXEL03_20 + PIXEL12_0 + PIXEL13_12 + } + PIXEL10_61 + PIXEL11_30 + PIXEL20_82 + PIXEL21_32 + PIXEL22_0 + if (Diff(c[6], c[8])) + { + PIXEL23_0 + PIXEL32_0 + PIXEL33_0 + } + else + { + PIXEL23_50 + PIXEL32_50 + PIXEL33_50 + } + PIXEL30_82 + PIXEL31_32 + break; + } +case 59: + { + if (Diff(c[4], c[2])) + { + PIXEL00_0 + PIXEL01_0 + PIXEL10_0 + } + else + { + PIXEL00_50 + PIXEL01_50 + PIXEL10_50 + } + if (Diff(c[2], c[6])) + { + PIXEL02_10 + PIXEL03_80 + PIXEL12_30 + PIXEL13_10 + } + else + { + PIXEL02_11 + PIXEL03_20 + PIXEL12_0 + PIXEL13_12 + } + PIXEL11_0 + PIXEL20_31 + PIXEL21_31 + PIXEL22_30 + PIXEL23_10 + PIXEL30_81 + PIXEL31_81 + PIXEL32_61 + PIXEL33_80 + break; + } +case 121: + { + PIXEL00_82 + PIXEL01_82 + PIXEL02_61 + PIXEL03_80 + PIXEL10_32 + PIXEL11_32 + PIXEL12_30 + PIXEL13_10 + if (Diff(c[8], c[4])) + { + PIXEL20_0 + PIXEL30_0 + PIXEL31_0 + } + else + { + PIXEL20_50 + PIXEL30_50 + PIXEL31_50 + } + PIXEL21_0 + if (Diff(c[6], c[8])) + { + PIXEL22_30 + PIXEL23_10 + PIXEL32_10 + PIXEL33_80 + } + else + { + PIXEL22_0 + PIXEL23_11 + PIXEL32_12 + PIXEL33_20 + } + break; + } +case 87: + { + PIXEL00_81 + PIXEL01_31 + if (Diff(c[2], c[6])) + { + PIXEL02_0 + PIXEL03_0 + PIXEL13_0 + } + else + { + PIXEL02_50 + PIXEL03_50 + PIXEL13_50 + } + PIXEL10_81 + PIXEL11_31 + PIXEL12_0 + PIXEL20_61 + PIXEL21_30 + if (Diff(c[6], c[8])) + { + PIXEL22_30 + PIXEL23_10 + PIXEL32_10 + PIXEL33_80 + } + else + { + PIXEL22_0 + PIXEL23_11 + PIXEL32_12 + PIXEL33_20 + } + PIXEL30_80 + PIXEL31_10 + break; + } +case 79: + { + if (Diff(c[4], c[2])) + { + PIXEL00_0 + PIXEL01_0 + PIXEL10_0 + } + else + { + PIXEL00_50 + PIXEL01_50 + PIXEL10_50 + } + PIXEL02_32 + PIXEL03_82 + PIXEL11_0 + PIXEL12_32 + PIXEL13_82 + if (Diff(c[8], c[4])) + { + PIXEL20_10 + PIXEL21_30 + PIXEL30_80 + PIXEL31_10 + } + else + { + PIXEL20_12 + PIXEL21_0 + PIXEL30_20 + PIXEL31_11 + } + PIXEL22_30 + PIXEL23_61 + PIXEL32_10 + PIXEL33_80 + break; + } +case 122: + { + if (Diff(c[4], c[2])) + { + PIXEL00_80 + PIXEL01_10 + PIXEL10_10 + PIXEL11_30 + } + else + { + PIXEL00_20 + PIXEL01_12 + PIXEL10_11 + PIXEL11_0 + } + if (Diff(c[2], c[6])) + { + PIXEL02_10 + PIXEL03_80 + PIXEL12_30 + PIXEL13_10 + } + else + { + PIXEL02_11 + PIXEL03_20 + PIXEL12_0 + PIXEL13_12 + } + if (Diff(c[8], c[4])) + { + PIXEL20_0 + PIXEL30_0 + PIXEL31_0 + } + else + { + PIXEL20_50 + PIXEL30_50 + PIXEL31_50 + } + PIXEL21_0 + if (Diff(c[6], c[8])) + { + PIXEL22_30 + PIXEL23_10 + PIXEL32_10 + PIXEL33_80 + } + else + { + PIXEL22_0 + PIXEL23_11 + PIXEL32_12 + PIXEL33_20 + } + break; + } +case 94: + { + if (Diff(c[4], c[2])) + { + PIXEL00_80 + PIXEL01_10 + PIXEL10_10 + PIXEL11_30 + } + else + { + PIXEL00_20 + PIXEL01_12 + PIXEL10_11 + PIXEL11_0 + } + if (Diff(c[2], c[6])) + { + PIXEL02_0 + PIXEL03_0 + PIXEL13_0 + } + else + { + PIXEL02_50 + PIXEL03_50 + PIXEL13_50 + } + PIXEL12_0 + if (Diff(c[8], c[4])) + { + PIXEL20_10 + PIXEL21_30 + PIXEL30_80 + PIXEL31_10 + } + else + { + PIXEL20_12 + PIXEL21_0 + PIXEL30_20 + PIXEL31_11 + } + if (Diff(c[6], c[8])) + { + PIXEL22_30 + PIXEL23_10 + PIXEL32_10 + PIXEL33_80 + } + else + { + PIXEL22_0 + PIXEL23_11 + PIXEL32_12 + PIXEL33_20 + } + break; + } +case 218: + { + if (Diff(c[4], c[2])) + { + PIXEL00_80 + PIXEL01_10 + PIXEL10_10 + PIXEL11_30 + } + else + { + PIXEL00_20 + PIXEL01_12 + PIXEL10_11 + PIXEL11_0 + } + if (Diff(c[2], c[6])) + { + PIXEL02_10 + PIXEL03_80 + PIXEL12_30 + PIXEL13_10 + } + else + { + PIXEL02_11 + PIXEL03_20 + PIXEL12_0 + PIXEL13_12 + } + if (Diff(c[8], c[4])) + { + PIXEL20_10 + PIXEL21_30 + PIXEL30_80 + PIXEL31_10 + } + else + { + PIXEL20_12 + PIXEL21_0 + PIXEL30_20 + PIXEL31_11 + } + PIXEL22_0 + if (Diff(c[6], c[8])) + { + PIXEL23_0 + PIXEL32_0 + PIXEL33_0 + } + else + { + PIXEL23_50 + PIXEL32_50 + PIXEL33_50 + } + break; + } +case 91: + { + if (Diff(c[4], c[2])) + { + PIXEL00_0 + PIXEL01_0 + PIXEL10_0 + } + else + { + PIXEL00_50 + PIXEL01_50 + PIXEL10_50 + } + if (Diff(c[2], c[6])) + { + PIXEL02_10 + PIXEL03_80 + PIXEL12_30 + PIXEL13_10 + } + else + { + PIXEL02_11 + PIXEL03_20 + PIXEL12_0 + PIXEL13_12 + } + PIXEL11_0 + if (Diff(c[8], c[4])) + { + PIXEL20_10 + PIXEL21_30 + PIXEL30_80 + PIXEL31_10 + } + else + { + PIXEL20_12 + PIXEL21_0 + PIXEL30_20 + PIXEL31_11 + } + if (Diff(c[6], c[8])) + { + PIXEL22_30 + PIXEL23_10 + PIXEL32_10 + PIXEL33_80 + } + else + { + PIXEL22_0 + PIXEL23_11 + PIXEL32_12 + PIXEL33_20 + } + break; + } +case 229: + { + PIXEL00_20 + PIXEL01_60 + PIXEL02_60 + PIXEL03_20 + PIXEL10_60 + PIXEL11_70 + PIXEL12_70 + PIXEL13_60 + PIXEL20_82 + PIXEL21_32 + PIXEL22_31 + PIXEL23_81 + PIXEL30_82 + PIXEL31_32 + PIXEL32_31 + PIXEL33_81 + break; + } +case 167: + { + PIXEL00_81 + PIXEL01_31 + PIXEL02_32 + PIXEL03_82 + PIXEL10_81 + PIXEL11_31 + PIXEL12_32 + PIXEL13_82 + PIXEL20_60 + PIXEL21_70 + PIXEL22_70 + PIXEL23_60 + PIXEL30_20 + PIXEL31_60 + PIXEL32_60 + PIXEL33_20 + break; + } +case 173: + { + PIXEL00_82 + PIXEL01_82 + PIXEL02_60 + PIXEL03_20 + PIXEL10_32 + PIXEL11_32 + PIXEL12_70 + PIXEL13_60 + PIXEL20_31 + PIXEL21_31 + PIXEL22_70 + PIXEL23_60 + PIXEL30_81 + PIXEL31_81 + PIXEL32_60 + PIXEL33_20 + break; + } +case 181: + { + PIXEL00_20 + PIXEL01_60 + PIXEL02_81 + PIXEL03_81 + PIXEL10_60 + PIXEL11_70 + PIXEL12_31 + PIXEL13_31 + PIXEL20_60 + PIXEL21_70 + PIXEL22_32 + PIXEL23_32 + PIXEL30_20 + PIXEL31_60 + PIXEL32_82 + PIXEL33_82 + break; + } +case 186: + { + if (Diff(c[4], c[2])) + { + PIXEL00_80 + PIXEL01_10 + PIXEL10_10 + PIXEL11_30 + } + else + { + PIXEL00_20 + PIXEL01_12 + PIXEL10_11 + PIXEL11_0 + } + if (Diff(c[2], c[6])) + { + PIXEL02_10 + PIXEL03_80 + PIXEL12_30 + PIXEL13_10 + } + else + { + PIXEL02_11 + PIXEL03_20 + PIXEL12_0 + PIXEL13_12 + } + PIXEL20_31 + PIXEL21_31 + PIXEL22_32 + PIXEL23_32 + PIXEL30_81 + PIXEL31_81 + PIXEL32_82 + PIXEL33_82 + break; + } +case 115: + { + PIXEL00_81 + PIXEL01_31 + if (Diff(c[2], c[6])) + { + PIXEL02_10 + PIXEL03_80 + PIXEL12_30 + PIXEL13_10 + } + else + { + PIXEL02_11 + PIXEL03_20 + PIXEL12_0 + PIXEL13_12 + } + PIXEL10_81 + PIXEL11_31 + PIXEL20_82 + PIXEL21_32 + if (Diff(c[6], c[8])) + { + PIXEL22_30 + PIXEL23_10 + PIXEL32_10 + PIXEL33_80 + } + else + { + PIXEL22_0 + PIXEL23_11 + PIXEL32_12 + PIXEL33_20 + } + PIXEL30_82 + PIXEL31_32 + break; + } +case 93: + { + PIXEL00_82 + PIXEL01_82 + PIXEL02_81 + PIXEL03_81 + PIXEL10_32 + PIXEL11_32 + PIXEL12_31 + PIXEL13_31 + if (Diff(c[8], c[4])) + { + PIXEL20_10 + PIXEL21_30 + PIXEL30_80 + PIXEL31_10 + } + else + { + PIXEL20_12 + PIXEL21_0 + PIXEL30_20 + PIXEL31_11 + } + if (Diff(c[6], c[8])) + { + PIXEL22_30 + PIXEL23_10 + PIXEL32_10 + PIXEL33_80 + } + else + { + PIXEL22_0 + PIXEL23_11 + PIXEL32_12 + PIXEL33_20 + } + break; + } +case 206: + { + if (Diff(c[4], c[2])) + { + PIXEL00_80 + PIXEL01_10 + PIXEL10_10 + PIXEL11_30 + } + else + { + PIXEL00_20 + PIXEL01_12 + PIXEL10_11 + PIXEL11_0 + } + PIXEL02_32 + PIXEL03_82 + PIXEL12_32 + PIXEL13_82 + if (Diff(c[8], c[4])) + { + PIXEL20_10 + PIXEL21_30 + PIXEL30_80 + PIXEL31_10 + } + else + { + PIXEL20_12 + PIXEL21_0 + PIXEL30_20 + PIXEL31_11 + } + PIXEL22_31 + PIXEL23_81 + PIXEL32_31 + PIXEL33_81 + break; + } +case 205: +case 201: + { + PIXEL00_82 + PIXEL01_82 + PIXEL02_60 + PIXEL03_20 + PIXEL10_32 + PIXEL11_32 + PIXEL12_70 + PIXEL13_60 + if (Diff(c[8], c[4])) + { + PIXEL20_10 + PIXEL21_30 + PIXEL30_80 + PIXEL31_10 + } + else + { + PIXEL20_12 + PIXEL21_0 + PIXEL30_20 + PIXEL31_11 + } + PIXEL22_31 + PIXEL23_81 + PIXEL32_31 + PIXEL33_81 + break; + } +case 174: +case 46: + { + if (Diff(c[4], c[2])) + { + PIXEL00_80 + PIXEL01_10 + PIXEL10_10 + PIXEL11_30 + } + else + { + PIXEL00_20 + PIXEL01_12 + PIXEL10_11 + PIXEL11_0 + } + PIXEL02_32 + PIXEL03_82 + PIXEL12_32 + PIXEL13_82 + PIXEL20_31 + PIXEL21_31 + PIXEL22_70 + PIXEL23_60 + PIXEL30_81 + PIXEL31_81 + PIXEL32_60 + PIXEL33_20 + break; + } +case 179: +case 147: + { + PIXEL00_81 + PIXEL01_31 + if (Diff(c[2], c[6])) + { + PIXEL02_10 + PIXEL03_80 + PIXEL12_30 + PIXEL13_10 + } + else + { + PIXEL02_11 + PIXEL03_20 + PIXEL12_0 + PIXEL13_12 + } + PIXEL10_81 + PIXEL11_31 + PIXEL20_60 + PIXEL21_70 + PIXEL22_32 + PIXEL23_32 + PIXEL30_20 + PIXEL31_60 + PIXEL32_82 + PIXEL33_82 + break; + } +case 117: +case 116: + { + PIXEL00_20 + PIXEL01_60 + PIXEL02_81 + PIXEL03_81 + PIXEL10_60 + PIXEL11_70 + PIXEL12_31 + PIXEL13_31 + PIXEL20_82 + PIXEL21_32 + if (Diff(c[6], c[8])) + { + PIXEL22_30 + PIXEL23_10 + PIXEL32_10 + PIXEL33_80 + } + else + { + PIXEL22_0 + PIXEL23_11 + PIXEL32_12 + PIXEL33_20 + } + PIXEL30_82 + PIXEL31_32 + break; + } +case 189: + { + PIXEL00_82 + PIXEL01_82 + PIXEL02_81 + PIXEL03_81 + PIXEL10_32 + PIXEL11_32 + PIXEL12_31 + PIXEL13_31 + PIXEL20_31 + PIXEL21_31 + PIXEL22_32 + PIXEL23_32 + PIXEL30_81 + PIXEL31_81 + PIXEL32_82 + PIXEL33_82 + break; + } +case 231: + { + PIXEL00_81 + PIXEL01_31 + PIXEL02_32 + PIXEL03_82 + PIXEL10_81 + PIXEL11_31 + PIXEL12_32 + PIXEL13_82 + PIXEL20_82 + PIXEL21_32 + PIXEL22_31 + PIXEL23_81 + PIXEL30_82 + PIXEL31_32 + PIXEL32_31 + PIXEL33_81 + break; + } +case 126: + { + PIXEL00_80 + PIXEL01_10 + if (Diff(c[2], c[6])) + { + PIXEL02_0 + PIXEL03_0 + PIXEL13_0 + } + else + { + PIXEL02_50 + PIXEL03_50 + PIXEL13_50 + } + PIXEL10_10 + PIXEL11_30 + PIXEL12_0 + if (Diff(c[8], c[4])) + { + PIXEL20_0 + PIXEL30_0 + PIXEL31_0 + } + else + { + PIXEL20_50 + PIXEL30_50 + PIXEL31_50 + } + PIXEL21_0 + PIXEL22_30 + PIXEL23_10 + PIXEL32_10 + PIXEL33_80 + break; + } +case 219: + { + if (Diff(c[4], c[2])) + { + PIXEL00_0 + PIXEL01_0 + PIXEL10_0 + } + else + { + PIXEL00_50 + PIXEL01_50 + PIXEL10_50 + } + PIXEL02_10 + PIXEL03_80 + PIXEL11_0 + PIXEL12_30 + PIXEL13_10 + PIXEL20_10 + PIXEL21_30 + PIXEL22_0 + if (Diff(c[6], c[8])) + { + PIXEL23_0 + PIXEL32_0 + PIXEL33_0 + } + else + { + PIXEL23_50 + PIXEL32_50 + PIXEL33_50 + } + PIXEL30_80 + PIXEL31_10 + break; + } +case 125: + { + if (Diff(c[8], c[4])) + { + PIXEL00_82 + PIXEL10_32 + PIXEL20_0 + PIXEL21_0 + PIXEL30_0 + PIXEL31_0 + } + else + { + PIXEL00_11 + PIXEL10_13 + PIXEL20_83 + PIXEL21_70 + PIXEL30_50 + PIXEL31_21 + } + PIXEL01_82 + PIXEL02_81 + PIXEL03_81 + PIXEL11_32 + PIXEL12_31 + PIXEL13_31 + PIXEL22_30 + PIXEL23_10 + PIXEL32_10 + PIXEL33_80 + break; + } +case 221: + { + PIXEL00_82 + PIXEL01_82 + PIXEL02_81 + if (Diff(c[6], c[8])) + { + PIXEL03_81 + PIXEL13_31 + PIXEL22_0 + PIXEL23_0 + PIXEL32_0 + PIXEL33_0 + } + else + { + PIXEL03_12 + PIXEL13_14 + PIXEL22_70 + PIXEL23_83 + PIXEL32_21 + PIXEL33_50 + } + PIXEL10_32 + PIXEL11_32 + PIXEL12_31 + PIXEL20_10 + PIXEL21_30 + PIXEL30_80 + PIXEL31_10 + break; + } +case 207: + { + if (Diff(c[4], c[2])) + { + PIXEL00_0 + PIXEL01_0 + PIXEL02_32 + PIXEL03_82 + PIXEL10_0 + PIXEL11_0 + } + else + { + PIXEL00_50 + PIXEL01_83 + PIXEL02_13 + PIXEL03_11 + PIXEL10_21 + PIXEL11_70 + } + PIXEL12_32 + PIXEL13_82 + PIXEL20_10 + PIXEL21_30 + PIXEL22_31 + PIXEL23_81 + PIXEL30_80 + PIXEL31_10 + PIXEL32_31 + PIXEL33_81 + break; + } +case 238: + { + PIXEL00_80 + PIXEL01_10 + PIXEL02_32 + PIXEL03_82 + PIXEL10_10 + PIXEL11_30 + PIXEL12_32 + PIXEL13_82 + if (Diff(c[8], c[4])) + { + PIXEL20_0 + PIXEL21_0 + PIXEL30_0 + PIXEL31_0 + PIXEL32_31 + PIXEL33_81 + } + else + { + PIXEL20_21 + PIXEL21_70 + PIXEL30_50 + PIXEL31_83 + PIXEL32_14 + PIXEL33_12 + } + PIXEL22_31 + PIXEL23_81 + break; + } +case 190: + { + PIXEL00_80 + PIXEL01_10 + if (Diff(c[2], c[6])) + { + PIXEL02_0 + PIXEL03_0 + PIXEL12_0 + PIXEL13_0 + PIXEL23_32 + PIXEL33_82 + } + else + { + PIXEL02_21 + PIXEL03_50 + PIXEL12_70 + PIXEL13_83 + PIXEL23_13 + PIXEL33_11 + } + PIXEL10_10 + PIXEL11_30 + PIXEL20_31 + PIXEL21_31 + PIXEL22_32 + PIXEL30_81 + PIXEL31_81 + PIXEL32_82 + break; + } +case 187: + { + if (Diff(c[4], c[2])) + { + PIXEL00_0 + PIXEL01_0 + PIXEL10_0 + PIXEL11_0 + PIXEL20_31 + PIXEL30_81 + } + else + { + PIXEL00_50 + PIXEL01_21 + PIXEL10_83 + PIXEL11_70 + PIXEL20_14 + PIXEL30_12 + } + PIXEL02_10 + PIXEL03_80 + PIXEL12_30 + PIXEL13_10 + PIXEL21_31 + PIXEL22_32 + PIXEL23_32 + PIXEL31_81 + PIXEL32_82 + PIXEL33_82 + break; + } +case 243: + { + PIXEL00_81 + PIXEL01_31 + PIXEL02_10 + PIXEL03_80 + PIXEL10_81 + PIXEL11_31 + PIXEL12_30 + PIXEL13_10 + PIXEL20_82 + PIXEL21_32 + if (Diff(c[6], c[8])) + { + PIXEL22_0 + PIXEL23_0 + PIXEL30_82 + PIXEL31_32 + PIXEL32_0 + PIXEL33_0 + } + else + { + PIXEL22_70 + PIXEL23_21 + PIXEL30_11 + PIXEL31_13 + PIXEL32_83 + PIXEL33_50 + } + break; + } +case 119: + { + if (Diff(c[2], c[6])) + { + PIXEL00_81 + PIXEL01_31 + PIXEL02_0 + PIXEL03_0 + PIXEL12_0 + PIXEL13_0 + } + else + { + PIXEL00_12 + PIXEL01_14 + PIXEL02_83 + PIXEL03_50 + PIXEL12_70 + PIXEL13_21 + } + PIXEL10_81 + PIXEL11_31 + PIXEL20_82 + PIXEL21_32 + PIXEL22_30 + PIXEL23_10 + PIXEL30_82 + PIXEL31_32 + PIXEL32_10 + PIXEL33_80 + break; + } +case 237: +case 233: + { + PIXEL00_82 + PIXEL01_82 + PIXEL02_60 + PIXEL03_20 + PIXEL10_32 + PIXEL11_32 + PIXEL12_70 + PIXEL13_60 + PIXEL20_0 + PIXEL21_0 + PIXEL22_31 + PIXEL23_81 + if (Diff(c[8], c[4])) + { + PIXEL30_0 + } + else + { + PIXEL30_20 + } + PIXEL31_0 + PIXEL32_31 + PIXEL33_81 + break; + } +case 175: +case 47: + { + if (Diff(c[4], c[2])) + { + PIXEL00_0 + } + else + { + PIXEL00_20 + } + PIXEL01_0 + PIXEL02_32 + PIXEL03_82 + PIXEL10_0 + PIXEL11_0 + PIXEL12_32 + PIXEL13_82 + PIXEL20_31 + PIXEL21_31 + PIXEL22_70 + PIXEL23_60 + PIXEL30_81 + PIXEL31_81 + PIXEL32_60 + PIXEL33_20 + break; + } +case 183: +case 151: + { + PIXEL00_81 + PIXEL01_31 + PIXEL02_0 + if (Diff(c[2], c[6])) + { + PIXEL03_0 + } + else + { + PIXEL03_20 + } + PIXEL10_81 + PIXEL11_31 + PIXEL12_0 + PIXEL13_0 + PIXEL20_60 + PIXEL21_70 + PIXEL22_32 + PIXEL23_32 + PIXEL30_20 + PIXEL31_60 + PIXEL32_82 + PIXEL33_82 + break; + } +case 245: +case 244: + { + PIXEL00_20 + PIXEL01_60 + PIXEL02_81 + PIXEL03_81 + PIXEL10_60 + PIXEL11_70 + PIXEL12_31 + PIXEL13_31 + PIXEL20_82 + PIXEL21_32 + PIXEL22_0 + PIXEL23_0 + PIXEL30_82 + PIXEL31_32 + PIXEL32_0 + if (Diff(c[6], c[8])) + { + PIXEL33_0 + } + else + { + PIXEL33_20 + } + break; + } +case 250: + { + PIXEL00_80 + PIXEL01_10 + PIXEL02_10 + PIXEL03_80 + PIXEL10_10 + PIXEL11_30 + PIXEL12_30 + PIXEL13_10 + if (Diff(c[8], c[4])) + { + PIXEL20_0 + PIXEL30_0 + PIXEL31_0 + } + else + { + PIXEL20_50 + PIXEL30_50 + PIXEL31_50 + } + PIXEL21_0 + PIXEL22_0 + if (Diff(c[6], c[8])) + { + PIXEL23_0 + PIXEL32_0 + PIXEL33_0 + } + else + { + PIXEL23_50 + PIXEL32_50 + PIXEL33_50 + } + break; + } +case 123: + { + if (Diff(c[4], c[2])) + { + PIXEL00_0 + PIXEL01_0 + PIXEL10_0 + } + else + { + PIXEL00_50 + PIXEL01_50 + PIXEL10_50 + } + PIXEL02_10 + PIXEL03_80 + PIXEL11_0 + PIXEL12_30 + PIXEL13_10 + if (Diff(c[8], c[4])) + { + PIXEL20_0 + PIXEL30_0 + PIXEL31_0 + } + else + { + PIXEL20_50 + PIXEL30_50 + PIXEL31_50 + } + PIXEL21_0 + PIXEL22_30 + PIXEL23_10 + PIXEL32_10 + PIXEL33_80 + break; + } +case 95: + { + if (Diff(c[4], c[2])) + { + PIXEL00_0 + PIXEL01_0 + PIXEL10_0 + } + else + { + PIXEL00_50 + PIXEL01_50 + PIXEL10_50 + } + if (Diff(c[2], c[6])) + { + PIXEL02_0 + PIXEL03_0 + PIXEL13_0 + } + else + { + PIXEL02_50 + PIXEL03_50 + PIXEL13_50 + } + PIXEL11_0 + PIXEL12_0 + PIXEL20_10 + PIXEL21_30 + PIXEL22_30 + PIXEL23_10 + PIXEL30_80 + PIXEL31_10 + PIXEL32_10 + PIXEL33_80 + break; + } +case 222: + { + PIXEL00_80 + PIXEL01_10 + if (Diff(c[2], c[6])) + { + PIXEL02_0 + PIXEL03_0 + PIXEL13_0 + } + else + { + PIXEL02_50 + PIXEL03_50 + PIXEL13_50 + } + PIXEL10_10 + PIXEL11_30 + PIXEL12_0 + PIXEL20_10 + PIXEL21_30 + PIXEL22_0 + if (Diff(c[6], c[8])) + { + PIXEL23_0 + PIXEL32_0 + PIXEL33_0 + } + else + { + PIXEL23_50 + PIXEL32_50 + PIXEL33_50 + } + PIXEL30_80 + PIXEL31_10 + break; + } +case 252: + { + PIXEL00_80 + PIXEL01_61 + PIXEL02_81 + PIXEL03_81 + PIXEL10_10 + PIXEL11_30 + PIXEL12_31 + PIXEL13_31 + if (Diff(c[8], c[4])) + { + PIXEL20_0 + PIXEL30_0 + PIXEL31_0 + } + else + { + PIXEL20_50 + PIXEL30_50 + PIXEL31_50 + } + PIXEL21_0 + PIXEL22_0 + PIXEL23_0 + PIXEL32_0 + if (Diff(c[6], c[8])) + { + PIXEL33_0 + } + else + { + PIXEL33_20 + } + break; + } +case 249: + { + PIXEL00_82 + PIXEL01_82 + PIXEL02_61 + PIXEL03_80 + PIXEL10_32 + PIXEL11_32 + PIXEL12_30 + PIXEL13_10 + PIXEL20_0 + PIXEL21_0 + PIXEL22_0 + if (Diff(c[6], c[8])) + { + PIXEL23_0 + PIXEL32_0 + PIXEL33_0 + } + else + { + PIXEL23_50 + PIXEL32_50 + PIXEL33_50 + } + if (Diff(c[8], c[4])) + { + PIXEL30_0 + } + else + { + PIXEL30_20 + } + PIXEL31_0 + break; + } +case 235: + { + if (Diff(c[4], c[2])) + { + PIXEL00_0 + PIXEL01_0 + PIXEL10_0 + } + else + { + PIXEL00_50 + PIXEL01_50 + PIXEL10_50 + } + PIXEL02_10 + PIXEL03_80 + PIXEL11_0 + PIXEL12_30 + PIXEL13_61 + PIXEL20_0 + PIXEL21_0 + PIXEL22_31 + PIXEL23_81 + if (Diff(c[8], c[4])) + { + PIXEL30_0 + } + else + { + PIXEL30_20 + } + PIXEL31_0 + PIXEL32_31 + PIXEL33_81 + break; + } +case 111: + { + if (Diff(c[4], c[2])) + { + PIXEL00_0 + } + else + { + PIXEL00_20 + } + PIXEL01_0 + PIXEL02_32 + PIXEL03_82 + PIXEL10_0 + PIXEL11_0 + PIXEL12_32 + PIXEL13_82 + if (Diff(c[8], c[4])) + { + PIXEL20_0 + PIXEL30_0 + PIXEL31_0 + } + else + { + PIXEL20_50 + PIXEL30_50 + PIXEL31_50 + } + PIXEL21_0 + PIXEL22_30 + PIXEL23_61 + PIXEL32_10 + PIXEL33_80 + break; + } +case 63: + { + if (Diff(c[4], c[2])) + { + PIXEL00_0 + } + else + { + PIXEL00_20 + } + PIXEL01_0 + if (Diff(c[2], c[6])) + { + PIXEL02_0 + PIXEL03_0 + PIXEL13_0 + } + else + { + PIXEL02_50 + PIXEL03_50 + PIXEL13_50 + } + PIXEL10_0 + PIXEL11_0 + PIXEL12_0 + PIXEL20_31 + PIXEL21_31 + PIXEL22_30 + PIXEL23_10 + PIXEL30_81 + PIXEL31_81 + PIXEL32_61 + PIXEL33_80 + break; + } +case 159: + { + if (Diff(c[4], c[2])) + { + PIXEL00_0 + PIXEL01_0 + PIXEL10_0 + } + else + { + PIXEL00_50 + PIXEL01_50 + PIXEL10_50 + } + PIXEL02_0 + if (Diff(c[2], c[6])) + { + PIXEL03_0 + } + else + { + PIXEL03_20 + } + PIXEL11_0 + PIXEL12_0 + PIXEL13_0 + PIXEL20_10 + PIXEL21_30 + PIXEL22_32 + PIXEL23_32 + PIXEL30_80 + PIXEL31_61 + PIXEL32_82 + PIXEL33_82 + break; + } +case 215: + { + PIXEL00_81 + PIXEL01_31 + PIXEL02_0 + if (Diff(c[2], c[6])) + { + PIXEL03_0 + } + else + { + PIXEL03_20 + } + PIXEL10_81 + PIXEL11_31 + PIXEL12_0 + PIXEL13_0 + PIXEL20_61 + PIXEL21_30 + PIXEL22_0 + if (Diff(c[6], c[8])) + { + PIXEL23_0 + PIXEL32_0 + PIXEL33_0 + } + else + { + PIXEL23_50 + PIXEL32_50 + PIXEL33_50 + } + PIXEL30_80 + PIXEL31_10 + break; + } +case 246: + { + PIXEL00_80 + PIXEL01_10 + if (Diff(c[2], c[6])) + { + PIXEL02_0 + PIXEL03_0 + PIXEL13_0 + } + else + { + PIXEL02_50 + PIXEL03_50 + PIXEL13_50 + } + PIXEL10_61 + PIXEL11_30 + PIXEL12_0 + PIXEL20_82 + PIXEL21_32 + PIXEL22_0 + PIXEL23_0 + PIXEL30_82 + PIXEL31_32 + PIXEL32_0 + if (Diff(c[6], c[8])) + { + PIXEL33_0 + } + else + { + PIXEL33_20 + } + break; + } +case 254: + { + PIXEL00_80 + PIXEL01_10 + if (Diff(c[2], c[6])) + { + PIXEL02_0 + PIXEL03_0 + PIXEL13_0 + } + else + { + PIXEL02_50 + PIXEL03_50 + PIXEL13_50 + } + PIXEL10_10 + PIXEL11_30 + PIXEL12_0 + if (Diff(c[8], c[4])) + { + PIXEL20_0 + PIXEL30_0 + PIXEL31_0 + } + else + { + PIXEL20_50 + PIXEL30_50 + PIXEL31_50 + } + PIXEL21_0 + PIXEL22_0 + PIXEL23_0 + PIXEL32_0 + if (Diff(c[6], c[8])) + { + PIXEL33_0 + } + else + { + PIXEL33_20 + } + break; + } +case 253: + { + PIXEL00_82 + PIXEL01_82 + PIXEL02_81 + PIXEL03_81 + PIXEL10_32 + PIXEL11_32 + PIXEL12_31 + PIXEL13_31 + PIXEL20_0 + PIXEL21_0 + PIXEL22_0 + PIXEL23_0 + if (Diff(c[8], c[4])) + { + PIXEL30_0 + } + else + { + PIXEL30_20 + } + PIXEL31_0 + PIXEL32_0 + if (Diff(c[6], c[8])) + { + PIXEL33_0 + } + else + { + PIXEL33_20 + } + break; + } +case 251: + { + if (Diff(c[4], c[2])) + { + PIXEL00_0 + PIXEL01_0 + PIXEL10_0 + } + else + { + PIXEL00_50 + PIXEL01_50 + PIXEL10_50 + } + PIXEL02_10 + PIXEL03_80 + PIXEL11_0 + PIXEL12_30 + PIXEL13_10 + PIXEL20_0 + PIXEL21_0 + PIXEL22_0 + if (Diff(c[6], c[8])) + { + PIXEL23_0 + PIXEL32_0 + PIXEL33_0 + } + else + { + PIXEL23_50 + PIXEL32_50 + PIXEL33_50 + } + if (Diff(c[8], c[4])) + { + PIXEL30_0 + } + else + { + PIXEL30_20 + } + PIXEL31_0 + break; + } +case 239: + { + if (Diff(c[4], c[2])) + { + PIXEL00_0 + } + else + { + PIXEL00_20 + } + PIXEL01_0 + PIXEL02_32 + PIXEL03_82 + PIXEL10_0 + PIXEL11_0 + PIXEL12_32 + PIXEL13_82 + PIXEL20_0 + PIXEL21_0 + PIXEL22_31 + PIXEL23_81 + if (Diff(c[8], c[4])) + { + PIXEL30_0 + } + else + { + PIXEL30_20 + } + PIXEL31_0 + PIXEL32_31 + PIXEL33_81 + break; + } +case 127: + { + if (Diff(c[4], c[2])) + { + PIXEL00_0 + } + else + { + PIXEL00_20 + } + PIXEL01_0 + if (Diff(c[2], c[6])) + { + PIXEL02_0 + PIXEL03_0 + PIXEL13_0 + } + else + { + PIXEL02_50 + PIXEL03_50 + PIXEL13_50 + } + PIXEL10_0 + PIXEL11_0 + PIXEL12_0 + if (Diff(c[8], c[4])) + { + PIXEL20_0 + PIXEL30_0 + PIXEL31_0 + } + else + { + PIXEL20_50 + PIXEL30_50 + PIXEL31_50 + } + PIXEL21_0 + PIXEL22_30 + PIXEL23_10 + PIXEL32_10 + PIXEL33_80 + break; + } +case 191: + { + if (Diff(c[4], c[2])) + { + PIXEL00_0 + } + else + { + PIXEL00_20 + } + PIXEL01_0 + PIXEL02_0 + if (Diff(c[2], c[6])) + { + PIXEL03_0 + } + else + { + PIXEL03_20 + } + PIXEL10_0 + PIXEL11_0 + PIXEL12_0 + PIXEL13_0 + PIXEL20_31 + PIXEL21_31 + PIXEL22_32 + PIXEL23_32 + PIXEL30_81 + PIXEL31_81 + PIXEL32_82 + PIXEL33_82 + break; + } +case 223: + { + if (Diff(c[4], c[2])) + { + PIXEL00_0 + PIXEL01_0 + PIXEL10_0 + } + else + { + PIXEL00_50 + PIXEL01_50 + PIXEL10_50 + } + PIXEL02_0 + if (Diff(c[2], c[6])) + { + PIXEL03_0 + } + else + { + PIXEL03_20 + } + PIXEL11_0 + PIXEL12_0 + PIXEL13_0 + PIXEL20_10 + PIXEL21_30 + PIXEL22_0 + if (Diff(c[6], c[8])) + { + PIXEL23_0 + PIXEL32_0 + PIXEL33_0 + } + else + { + PIXEL23_50 + PIXEL32_50 + PIXEL33_50 + } + PIXEL30_80 + PIXEL31_10 + break; + } +case 247: + { + PIXEL00_81 + PIXEL01_31 + PIXEL02_0 + if (Diff(c[2], c[6])) + { + PIXEL03_0 + } + else + { + PIXEL03_20 + } + PIXEL10_81 + PIXEL11_31 + PIXEL12_0 + PIXEL13_0 + PIXEL20_82 + PIXEL21_32 + PIXEL22_0 + PIXEL23_0 + PIXEL30_82 + PIXEL31_32 + PIXEL32_0 + if (Diff(c[6], c[8])) + { + PIXEL33_0 + } + else + { + PIXEL33_20 + } + break; + } +case 255: + { + if (Diff(c[4], c[2])) + { + PIXEL00_0 + } + else + { + PIXEL00_20 + } + PIXEL01_0 + PIXEL02_0 + if (Diff(c[2], c[6])) + { + PIXEL03_0 + } + else + { + PIXEL03_20 + } + PIXEL10_0 + PIXEL11_0 + PIXEL12_0 + PIXEL13_0 + PIXEL20_0 + PIXEL21_0 + PIXEL22_0 + PIXEL23_0 + if (Diff(c[8], c[4])) + { + PIXEL30_0 + } + else + { + PIXEL30_20 + } + PIXEL31_0 + PIXEL32_0 + if (Diff(c[6], c[8])) + { + PIXEL33_0 + } + else + { + PIXEL33_20 + } + break; + } +} diff --git a/src/hq_shared32.cpp b/src/hq_shared32.cpp index ba4e5692..207c845b 100644 --- a/src/hq_shared32.cpp +++ b/src/hq_shared32.cpp @@ -29,201 +29,46 @@ const uint64_t treshold = UINT64_C(0x0000000000300706); void Interp1(unsigned char * pc, unsigned int c1, unsigned int c2) { -#if (defined(_MSC_VER) && !defined(C_CORE)) -#ifdef MMX - __asm - { - mov eax, pc - movd mm1, c1 - movd mm2, c2 - movq mm0, mm1 - pslld mm0, 2 - psubd mm0, mm1 - paddd mm0, mm2 - psrld mm0, 2 - movd [eax], mm0 - EMMS - } -#else - __asm - { - mov eax, pc - mov edx, c1 - shl edx, 2 - add edx, c2 - sub edx, c1 - shr edx, 2 - mov [eax], edx - } -#endif -#else *((int*)pc) = (c1*3+c2)/4; -#endif } void Interp2(unsigned char * pc, unsigned int c1, unsigned int c2, unsigned int c3) { -#if (defined(_MSC_VER) && !defined(C_CORE)) -#ifdef MMX - __asm - { - mov eax, pc - movd mm0, c1 - movd mm1, c2 - movd mm2, c3 - pslld mm0, 1 - paddd mm0, mm1 - paddd mm0, mm2 - psrad mm0, 2 - movd [eax], mm0 - EMMS - } -#else - __asm - { - mov eax, pc - mov edx, c1 - shl edx, 1 - add edx, c2 - add edx, c3 - shr edx, 2 - mov [eax], edx - } -#endif -#else *((int*)pc) = (c1*2+c2+c3)/4; -#endif } void Interp3(unsigned char * pc, unsigned int c1, unsigned int c2) { -#if (defined(_MSC_VER) && !defined(C_CORE)) -#ifdef MMX - __asm - { - mov eax, pc - movd mm1, c1 - movd mm2, c2 - punpcklbw mm1, reg_blank - punpcklbw mm2, reg_blank - pmullw mm1, const7 - paddw mm1, mm2 - psrlw mm1, 3 - packuswb mm1, reg_blank - movd [eax], mm1 - EMMS - } -#else - __asm - { - mov eax, c1 - mov ebx, c2 - mov ecx, eax - shl ecx, 3 - sub ecx, eax - add ecx, ebx - shr ecx, 3 - mov eax, pc - mov [eax], ecx - } -#endif -#else *((int*)pc) = (c1*7+c2)/8; *((int*)pc) = ((((c1 & 0x00FF00)*7 + (c2 & 0x00FF00) ) & 0x0007F800) + (((c1 & 0xFF00FF)*7 + (c2 & 0xFF00FF) ) & 0x07F807F8)) >> 3; -#endif } void Interp4(unsigned char * pc, unsigned int c1, unsigned int c2, unsigned int c3) { -#if (defined(_MSC_VER) && !defined(C_CORE)) -#ifdef MMX - __asm - { - mov eax, pc - movd mm1, c1 - movd mm2, c2 - movd mm3, c3 - punpcklbw mm1, reg_blank - punpcklbw mm2, reg_blank - punpcklbw mm3, reg_blank - psllw mm1, 1 - paddw mm2, mm3 - pmullw mm2, const7 - paddw mm1, mm2 - psrlw mm1, 4 - packuswb mm1, reg_blank - movd [eax], mm1 - EMMS - } -#else - __asm - { - mov eax, [c1] - and eax, 0FF00h - shl eax, 1 - mov ecx, [c2] - and ecx, 0FF00h - mov edx, [c3] - and edx, 0FF00h - add ecx, edx - imul ecx, ecx,7 - add eax, ecx - and eax, 0FF000h - - mov ebx, [c1] - and ebx, 0FF00FFh - shl ebx, 1 - mov ecx, [c2] - and ecx, 0FF00FFh - mov edx, [c3] - and edx, 0FF00FFh - add ecx, edx - imul ecx, ecx,7 - add ebx, ecx - and ebx, 0FF00FF0h - - add eax, ebx - shr eax, 4 - - mov ebx, pc - mov [ebx], eax - } -#endif -#else *((int*)pc) = (c1*2+(c2+c3)*7)/16; *((int*)pc) = ((((c1 & 0x00FF00)*2 + ((c2 & 0x00FF00) + (c3 & 0x00FF00))*7 ) & 0x000FF000) + (((c1 & 0xFF00FF)*2 + ((c2 & 0xFF00FF) + (c3 & 0xFF00FF))*7 ) & 0x0FF00FF0)) >> 4; -#endif } void Interp5(unsigned char * pc, unsigned int c1, unsigned int c2) { -#if (defined(_MSC_VER) && !defined(C_CORE)) -#ifdef MMX - __asm - { - mov eax, pc - movd mm0, c1 - movd mm1, c2 - paddd mm0, mm1 - psrad mm0, 1 - movd [eax], mm0 - EMMS - } -#else - __asm - { - mov eax, pc - mov edx, c1 - add edx, c2 - shr edx, 1 - mov [eax], edx - } -#endif -#else *((int*)pc) = (c1+c2)/2; -#endif +} + +void Interp6(unsigned char * pc, unsigned int c1, unsigned int c2, unsigned int c3) +{ + *((int*)pc) = (c1*5+c2*2+c3)/8; +} + +void Interp7(unsigned char * pc, unsigned int c1, unsigned int c2, unsigned int c3) +{ + *((int*)pc) = (c1*6+c2+c3)/8; +} + +void Interp8(unsigned char * pc, unsigned int c1, unsigned int c2) +{ + *((int*)pc) = (c1*5+c2*3)/8; } @@ -235,137 +80,16 @@ bool Diff(unsigned int c1, unsigned int c2) if (YUV1 == YUV2) return false; // Save some processing power -#ifdef MMX - unsigned int retval; - __asm - { - mov eax, 0x7FFFFFFF - movd mm7, eax ;mm7 = ABS_MASK = 0x7FFFFFFF - - ; Copy source colors in first reg - movd mm0, YUV1 - movd mm1, YUV2 - - mov eax, 0x00FF0000 - movd mm6, eax ;mm6 = Ymask = 0x00FF0000 - - ; Calculate color Y difference - movq mm2, mm0 - movq mm3, mm1 - pand mm2, mm6 - pand mm3, mm6 - psubd mm2, mm3 - pand mm2, mm7 - - mov eax, 0x0000FF00 - movd mm6, eax ;mm6 = Umask = 0x0000FF00 - - ; Calculate color U difference - movq mm3, mm0 - movq mm4, mm1 - pand mm3, mm6 - pand mm4, mm6 - psubd mm3, mm4 - pand mm3, mm7 - - mov eax, 0x000000FF - movd mm6, eax ;mm6 = Vmask = 0x000000FF - - ; Calculate color V difference - movq mm4, mm0 - movq mm5, mm1 - pand mm4, mm6 - pand mm5, mm6 - psubd mm4, mm5 - pand mm4, mm7 - - mov eax, 0x00300000 - movd mm5, eax ;mm5 = trY = 0x00300000 - mov eax, 0x00000700 - movd mm6, eax ;mm6 = trU = 0x00000700 - mov eax, 0x00000006 - movd mm7, eax ;mm7 = trV = 0x00000006 - - ; Compare the results - pcmpgtd mm2, trY - pcmpgtd mm3, trU - pcmpgtd mm4, trV - por mm2, mm3 - por mm2, mm4 - - movd retval, mm2 - - EMMS - } - return (retval != 0); -#else return ( abs32((YUV1 & Ymask) - (YUV2 & Ymask)) > trY ) || ( abs32((YUV1 & Umask) - (YUV2 & Umask)) > trU ) || ( abs32((YUV1 & Vmask) - (YUV2 & Vmask)) > trV ); -#endif } unsigned int RGBtoYUV(unsigned int c) -{ // Division through 3 slows down the emulation about 10% !!! -#ifdef MMX - unsigned int retval; - __asm - { - movd mm0, c - movq mm1, mm0 - movq mm2, mm0 ;mm0=mm1=mm2=c - - mov eax, 0x000000FF - movd mm5, eax ;mm5 = REDMASK = 0x000000FF - mov eax, 0x0000FF00 - movd mm6, eax ;mm6 = GREENMASK = 0x0000FF00 - mov eax, 0x00FF0000 - movd mm7, eax ;mm7 = BLUEMASK = 0x00FF0000 - - - pand mm0, mm5 - pand mm1, mm6 - pand mm2, mm7 ;mm0=R mm1=G mm2=B - - movq mm3, mm0 - paddd mm3, mm1 - paddd mm3, mm2 -; psrld mm3, 2 ;mm3=Y -; pslld mm3, 16 - pslld mm3, 14 ;mm3=Y<<16 - - mov eax, 512 - movd mm7, eax ;mm7 = 128 << 2 = 512 - - movq mm4, mm0 - psubd mm4, mm2 -; psrld mm4, 2 -; paddd mm4, mm7 ;mm4=U -; pslld mm4, 8 ;mm4=U<<8 - paddd mm4, mm7 - pslld mm4, 6 - - mov eax, 128 - movd mm7, eax ;mm7 = 128 - - movq mm5, mm1 - pslld mm5, 1 - psubd mm5, mm0 - psubd mm5, mm2 - psrld mm5, 3 - paddd mm5, mm7 ;mm5=V - - paddd mm5, mm4 - paddd mm5, mm3 - - movd retval, mm5 - - EMMS - } - return retval; -#else +{ + // Division through 3 slows down the emulation about 10% !!! unsigned char r, g, b, Y, u, v; r = (c & 0x000000FF); g = (c & 0x0000FF00) >> 8; @@ -374,16 +98,4 @@ unsigned int RGBtoYUV(unsigned int c) u = 128 + ((r - b) >> 2); v = 128 + ((-r + 2*g -b)>>3); return (Y<<16) + (u<<8) + v; - - // Extremely High Quality Code - //unsigned char r, g, b; - //r = c & 0xFF; - //g = (c >> 8) & 0xFF; - //b = (c >> 16) & 0xFF; - //unsigned char y, u, v; - //y = (0.256788 * r + 0.504129 * g + 0.097906 * b) + 16; - //u = (-0.148223 * r - 0.290993 * g + 0.439216 * b) + 128; - //v = (0.439216 * r - 0.367788 * g - 0.071427 * b) + 128; - //return (y << 16) + (u << 8) + v; -#endif } diff --git a/src/hqxx.h b/src/hqxx.h new file mode 100644 index 00000000..2555c27d --- /dev/null +++ b/src/hqxx.h @@ -0,0 +1,384 @@ +/* + VisualBoyAdvance - a Game Boy & Game Boy Advance emulator + + Copyright (C) 1999 - 2003 Forgotten + Copyright (C) 2003 - 2004 Forgotten and the VBA development team + Copyright (C) 2005 - 2006 VBA development team + + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA +*/ + +#include "System.h" + +#if defined(_16BIT) +#define SIZE_PIXEL 2 +#define COLORTYPE uint32_t +#elif defined(_32BIT) +#define SIZE_PIXEL 4 // 32bit = 4 bytes +#define COLORTYPE unsigned int +#endif +#define abs32(value) (value & 0x7FFFFFFF) + + +void Interp1(unsigned char * pc, COLORTYPE c1, COLORTYPE c2); +void Interp2(unsigned char * pc, COLORTYPE c1, COLORTYPE c2, COLORTYPE c3); +void Interp3(unsigned char * pc, COLORTYPE c1, COLORTYPE c2); +void Interp4(unsigned char * pc, COLORTYPE c1, COLORTYPE c2, COLORTYPE c3); +void Interp5(unsigned char * pc, COLORTYPE c1, COLORTYPE c2); +void Interp6(unsigned char * pc, COLORTYPE c1, COLORTYPE c2, COLORTYPE c3); +void Interp7(unsigned char * pc, COLORTYPE c1, COLORTYPE c2, COLORTYPE c3); +void Interp8(unsigned char * pc, COLORTYPE c1, COLORTYPE c2); +unsigned int RGBtoYUV(COLORTYPE c); +bool Diff(COLORTYPE c1, COLORTYPE c2); + + +#if defined(_HQ3X) +#define _MAGNIFICATION 3 + +#define PIXEL00_1M Interp1( pOut, c[5], c[1] ); +#define PIXEL00_1U Interp1( pOut, c[5], c[2] ); +#define PIXEL00_1L Interp1( pOut, c[5], c[4] ); +#define PIXEL00_2 Interp2( pOut, c[5], c[4], c[2] ); +#define PIXEL00_4 Interp4( pOut, c[5], c[4], c[2] ); +#define PIXEL00_5 Interp5( pOut, c[4], c[2] ); +#define PIXEL00_C *((COLORTYPE*)(pOut)) = c[5]; + +#define PIXEL01_1 Interp1( pOut+SIZE_PIXEL, c[5], c[2] ); +#define PIXEL01_3 Interp3( pOut+SIZE_PIXEL, c[5], c[2] ); +#define PIXEL01_6 Interp1( pOut+SIZE_PIXEL, c[2], c[5] ); +#define PIXEL01_C *((COLORTYPE*)(pOut+SIZE_PIXEL)) = c[5]; + +#define PIXEL02_1M Interp1( pOut+SIZE_PIXEL+SIZE_PIXEL, c[5], c[3] ); +#define PIXEL02_1U Interp1( pOut+SIZE_PIXEL+SIZE_PIXEL, c[5], c[2] ); +#define PIXEL02_1R Interp1( pOut+SIZE_PIXEL+SIZE_PIXEL, c[5], c[6] ); +#define PIXEL02_2 Interp2( pOut+SIZE_PIXEL+SIZE_PIXEL, c[5], c[2], c[6] ); +#define PIXEL02_4 Interp4( pOut+SIZE_PIXEL+SIZE_PIXEL, c[5], c[2], c[6] ); +#define PIXEL02_5 Interp5( pOut+SIZE_PIXEL+SIZE_PIXEL, c[2], c[6] ); +#define PIXEL02_C *((COLORTYPE*)(pOut+SIZE_PIXEL+SIZE_PIXEL)) = c[5]; + +#define PIXEL10_1 Interp1( pOut+dstPitch, c[5], c[4] ); +#define PIXEL10_3 Interp3( pOut+dstPitch, c[5], c[4] ); +#define PIXEL10_6 Interp1( pOut+dstPitch, c[4], c[5] ); +#define PIXEL10_C *((COLORTYPE*)(pOut+dstPitch)) = c[5]; + +#define PIXEL11 *((COLORTYPE*)(pOut+dstPitch+SIZE_PIXEL)) = c[5]; + +#define PIXEL12_1 Interp1( pOut+dstPitch+SIZE_PIXEL+SIZE_PIXEL, c[5], c[6] ); +#define PIXEL12_3 Interp3( pOut+dstPitch+SIZE_PIXEL+SIZE_PIXEL, c[5], c[6] ); +#define PIXEL12_6 Interp1( pOut+dstPitch+SIZE_PIXEL+SIZE_PIXEL, c[6], c[5] ); +#define PIXEL12_C *((COLORTYPE*)(pOut+dstPitch+SIZE_PIXEL+SIZE_PIXEL)) = c[5]; + +#define PIXEL20_1M Interp1( pOut+dstPitch+dstPitch, c[5], c[7] ); +#define PIXEL20_1D Interp1( pOut+dstPitch+dstPitch, c[5], c[8] ); +#define PIXEL20_1L Interp1( pOut+dstPitch+dstPitch, c[5], c[4] ); +#define PIXEL20_2 Interp2( pOut+dstPitch+dstPitch, c[5], c[8], c[4] ); +#define PIXEL20_4 Interp4( pOut+dstPitch+dstPitch, c[5], c[8], c[4] ); +#define PIXEL20_5 Interp5( pOut+dstPitch+dstPitch, c[8], c[4] ); +#define PIXEL20_C *((COLORTYPE*)(pOut+dstPitch+dstPitch)) = c[5]; + +#define PIXEL21_1 Interp1( pOut+dstPitch+dstPitch+SIZE_PIXEL, c[5], c[8] ); +#define PIXEL21_3 Interp3( pOut+dstPitch+dstPitch+SIZE_PIXEL, c[5], c[8] ); +#define PIXEL21_6 Interp1( pOut+dstPitch+dstPitch+SIZE_PIXEL, c[8], c[5] ); +#define PIXEL21_C *((COLORTYPE*)(pOut+dstPitch+dstPitch+SIZE_PIXEL)) = c[5]; + +#define PIXEL22_1M Interp1( pOut+dstPitch+dstPitch+SIZE_PIXEL+SIZE_PIXEL, c[5], c[9] ); +#define PIXEL22_1D Interp1( pOut+dstPitch+dstPitch+SIZE_PIXEL+SIZE_PIXEL, c[5], c[8] ); +#define PIXEL22_1R Interp1( pOut+dstPitch+dstPitch+SIZE_PIXEL+SIZE_PIXEL, c[5], c[6] ); +#define PIXEL22_2 Interp2( pOut+dstPitch+dstPitch+SIZE_PIXEL+SIZE_PIXEL, c[5], c[6], c[8] ); +#define PIXEL22_4 Interp4( pOut+dstPitch+dstPitch+SIZE_PIXEL+SIZE_PIXEL, c[5], c[6], c[8] ); +#define PIXEL22_5 Interp5( pOut+dstPitch+dstPitch+SIZE_PIXEL+SIZE_PIXEL, c[6], c[8] ); +#define PIXEL22_C *((COLORTYPE*)(pOut+dstPitch+dstPitch+SIZE_PIXEL+SIZE_PIXEL)) = c[5]; + +#elif defined(_HQ4X) + +#define _MAGNIFICATION 4 + +#define PIXEL00_0 *((COLORTYPE*)(pOut)) = c[5]; +#define PIXEL00_11 Interp1(pOut, c[5], c[4]); +#define PIXEL00_12 Interp1(pOut, c[5], c[2]); +#define PIXEL00_20 Interp2(pOut, c[5], c[2], c[4]); +#define PIXEL00_50 Interp5(pOut, c[2], c[4]); +#define PIXEL00_80 Interp8(pOut, c[5], c[1]); +#define PIXEL00_81 Interp8(pOut, c[5], c[4]); +#define PIXEL00_82 Interp8(pOut, c[5], c[2]); + +#define PIXEL01_0 *((COLORTYPE*)(pOut+SIZE_PIXEL)) = c[5]; +#define PIXEL01_10 Interp1(pOut+SIZE_PIXEL, c[5], c[1]); +#define PIXEL01_12 Interp1(pOut+SIZE_PIXEL, c[5], c[2]); +#define PIXEL01_14 Interp1(pOut+SIZE_PIXEL, c[2], c[5]); +#define PIXEL01_21 Interp2(pOut+SIZE_PIXEL, c[2], c[5], c[4]); +#define PIXEL01_31 Interp3(pOut+SIZE_PIXEL, c[5], c[4]); +#define PIXEL01_50 Interp5(pOut+SIZE_PIXEL, c[2], c[5]); +#define PIXEL01_60 Interp6(pOut+SIZE_PIXEL, c[5], c[2], c[4]); +#define PIXEL01_61 Interp6(pOut+SIZE_PIXEL, c[5], c[2], c[1]); +#define PIXEL01_82 Interp8(pOut+SIZE_PIXEL, c[5], c[2]); +#define PIXEL01_83 Interp8(pOut+SIZE_PIXEL, c[2], c[4]); + +#define PIXEL02_0 *((COLORTYPE*)(pOut+SIZE_PIXEL+SIZE_PIXEL)) = c[5]; +#define PIXEL02_10 Interp1(pOut+SIZE_PIXEL+SIZE_PIXEL, c[5], c[3]); +#define PIXEL02_11 Interp1(pOut+SIZE_PIXEL+SIZE_PIXEL, c[5], c[2]); +#define PIXEL02_13 Interp1(pOut+SIZE_PIXEL+SIZE_PIXEL, c[2], c[5]); +#define PIXEL02_21 Interp2(pOut+SIZE_PIXEL+SIZE_PIXEL, c[2], c[5], c[6]); +#define PIXEL02_32 Interp3(pOut+SIZE_PIXEL+SIZE_PIXEL, c[5], c[6]); +#define PIXEL02_50 Interp5(pOut+SIZE_PIXEL+SIZE_PIXEL, c[2], c[5]); +#define PIXEL02_60 Interp6(pOut+SIZE_PIXEL+SIZE_PIXEL, c[5], c[2], c[6]); +#define PIXEL02_61 Interp6(pOut+SIZE_PIXEL+SIZE_PIXEL, c[5], c[2], c[3]); +#define PIXEL02_81 Interp8(pOut+SIZE_PIXEL+SIZE_PIXEL, c[5], c[2]); +#define PIXEL02_83 Interp8(pOut+SIZE_PIXEL+SIZE_PIXEL, c[2], c[6]); + +#define PIXEL03_0 *((COLORTYPE*)(pOut+SIZE_PIXEL+SIZE_PIXEL+SIZE_PIXEL)) = c[5]; +#define PIXEL03_11 Interp1(pOut+SIZE_PIXEL+SIZE_PIXEL+SIZE_PIXEL, c[5], c[2]); +#define PIXEL03_12 Interp1(pOut+SIZE_PIXEL+SIZE_PIXEL+SIZE_PIXEL, c[5], c[6]); +#define PIXEL03_20 Interp2(pOut+SIZE_PIXEL+SIZE_PIXEL+SIZE_PIXEL, c[5], c[2], c[6]); +#define PIXEL03_50 Interp5(pOut+SIZE_PIXEL+SIZE_PIXEL+SIZE_PIXEL, c[2], c[6]); +#define PIXEL03_80 Interp8(pOut+SIZE_PIXEL+SIZE_PIXEL+SIZE_PIXEL, c[5], c[3]); +#define PIXEL03_81 Interp8(pOut+SIZE_PIXEL+SIZE_PIXEL+SIZE_PIXEL, c[5], c[2]); +#define PIXEL03_82 Interp8(pOut+SIZE_PIXEL+SIZE_PIXEL+SIZE_PIXEL, c[5], c[6]); + +#define PIXEL10_0 *((COLORTYPE*)(pOut+dstPitch)) = c[5]; +#define PIXEL10_10 Interp1(pOut+dstPitch, c[5], c[1]); +#define PIXEL10_11 Interp1(pOut+dstPitch, c[5], c[4]); +#define PIXEL10_13 Interp1(pOut+dstPitch, c[4], c[5]); +#define PIXEL10_21 Interp2(pOut+dstPitch, c[4], c[5], c[2]); +#define PIXEL10_32 Interp3(pOut+dstPitch, c[5], c[2]); +#define PIXEL10_50 Interp5(pOut+dstPitch, c[4], c[5]); +#define PIXEL10_60 Interp6(pOut+dstPitch, c[5], c[4], c[2]); +#define PIXEL10_61 Interp6(pOut+dstPitch, c[5], c[4], c[1]); +#define PIXEL10_81 Interp8(pOut+dstPitch, c[5], c[4]); +#define PIXEL10_83 Interp8(pOut+dstPitch, c[4], c[2]); + +#define PIXEL11_0 *((COLORTYPE*)(pOut+dstPitch+SIZE_PIXEL)) = c[5]; +#define PIXEL11_30 Interp3(pOut+dstPitch+SIZE_PIXEL, c[5], c[1]); +#define PIXEL11_31 Interp3(pOut+dstPitch+SIZE_PIXEL, c[5], c[4]); +#define PIXEL11_32 Interp3(pOut+dstPitch+SIZE_PIXEL, c[5], c[2]); +#define PIXEL11_70 Interp7(pOut+dstPitch+SIZE_PIXEL, c[5], c[4], c[2]); + +#define PIXEL12_0 *((COLORTYPE*)(pOut+dstPitch+SIZE_PIXEL+SIZE_PIXEL)) = c[5]; +#define PIXEL12_30 Interp3(pOut+dstPitch+SIZE_PIXEL+SIZE_PIXEL, c[5], c[3]); +#define PIXEL12_31 Interp3(pOut+dstPitch+SIZE_PIXEL+SIZE_PIXEL, c[5], c[2]); +#define PIXEL12_32 Interp3(pOut+dstPitch+SIZE_PIXEL+SIZE_PIXEL, c[5], c[6]); +#define PIXEL12_70 Interp7(pOut+dstPitch+SIZE_PIXEL+SIZE_PIXEL, c[5], c[6], c[2]); + +#define PIXEL13_0 *((COLORTYPE*)(pOut+dstPitch+SIZE_PIXEL+SIZE_PIXEL+SIZE_PIXEL)) = c[5]; +#define PIXEL13_10 Interp1(pOut+dstPitch+SIZE_PIXEL+SIZE_PIXEL+SIZE_PIXEL, c[5], c[3]); +#define PIXEL13_12 Interp1(pOut+dstPitch+SIZE_PIXEL+SIZE_PIXEL+SIZE_PIXEL, c[5], c[6]); +#define PIXEL13_14 Interp1(pOut+dstPitch+SIZE_PIXEL+SIZE_PIXEL+SIZE_PIXEL, c[6], c[5]); +#define PIXEL13_21 Interp2(pOut+dstPitch+SIZE_PIXEL+SIZE_PIXEL+SIZE_PIXEL, c[6], c[5], c[2]); +#define PIXEL13_31 Interp3(pOut+dstPitch+SIZE_PIXEL+SIZE_PIXEL+SIZE_PIXEL, c[5], c[2]); +#define PIXEL13_50 Interp5(pOut+dstPitch+SIZE_PIXEL+SIZE_PIXEL+SIZE_PIXEL, c[6], c[5]); +#define PIXEL13_60 Interp6(pOut+dstPitch+SIZE_PIXEL+SIZE_PIXEL+SIZE_PIXEL, c[5], c[6], c[2]); +#define PIXEL13_61 Interp6(pOut+dstPitch+SIZE_PIXEL+SIZE_PIXEL+SIZE_PIXEL, c[5], c[6], c[3]); +#define PIXEL13_82 Interp8(pOut+dstPitch+SIZE_PIXEL+SIZE_PIXEL+SIZE_PIXEL, c[5], c[6]); +#define PIXEL13_83 Interp8(pOut+dstPitch+SIZE_PIXEL+SIZE_PIXEL+SIZE_PIXEL, c[6], c[2]); + +#define PIXEL20_0 *((COLORTYPE*)(pOut+dstPitch+dstPitch)) = c[5]; +#define PIXEL20_10 Interp1(pOut+dstPitch+dstPitch, c[5], c[7]); +#define PIXEL20_12 Interp1(pOut+dstPitch+dstPitch, c[5], c[4]); +#define PIXEL20_14 Interp1(pOut+dstPitch+dstPitch, c[4], c[5]); +#define PIXEL20_21 Interp2(pOut+dstPitch+dstPitch, c[4], c[5], c[8]); +#define PIXEL20_31 Interp3(pOut+dstPitch+dstPitch, c[5], c[8]); +#define PIXEL20_50 Interp5(pOut+dstPitch+dstPitch, c[4], c[5]); +#define PIXEL20_60 Interp6(pOut+dstPitch+dstPitch, c[5], c[4], c[8]); +#define PIXEL20_61 Interp6(pOut+dstPitch+dstPitch, c[5], c[4], c[7]); +#define PIXEL20_82 Interp8(pOut+dstPitch+dstPitch, c[5], c[4]); +#define PIXEL20_83 Interp8(pOut+dstPitch+dstPitch, c[4], c[8]); + +#define PIXEL21_0 *((COLORTYPE*)(pOut+dstPitch+dstPitch+SIZE_PIXEL)) = c[5]; +#define PIXEL21_30 Interp3(pOut+dstPitch+dstPitch+SIZE_PIXEL, c[5], c[7]); +#define PIXEL21_31 Interp3(pOut+dstPitch+dstPitch+SIZE_PIXEL, c[5], c[8]); +#define PIXEL21_32 Interp3(pOut+dstPitch+dstPitch+SIZE_PIXEL, c[5], c[4]); +#define PIXEL21_70 Interp7(pOut+dstPitch+dstPitch+SIZE_PIXEL, c[5], c[4], c[8]); +#define PIXEL22_0 *((COLORTYPE*)(pOut+dstPitch+dstPitch+SIZE_PIXEL+SIZE_PIXEL)) = c[5]; +#define PIXEL22_30 Interp3(pOut+dstPitch+dstPitch+SIZE_PIXEL+SIZE_PIXEL, c[5], c[9]); +#define PIXEL22_31 Interp3(pOut+dstPitch+dstPitch+SIZE_PIXEL+SIZE_PIXEL, c[5], c[6]); +#define PIXEL22_32 Interp3(pOut+dstPitch+dstPitch+SIZE_PIXEL+SIZE_PIXEL, c[5], c[8]); +#define PIXEL22_70 Interp7(pOut+dstPitch+dstPitch+SIZE_PIXEL+SIZE_PIXEL, c[5], c[6], c[8]); + +#define PIXEL23_0 *((COLORTYPE*)(pOut+dstPitch+dstPitch+SIZE_PIXEL+SIZE_PIXEL+SIZE_PIXEL)) = c[5]; +#define PIXEL23_10 Interp1(pOut+dstPitch+dstPitch+SIZE_PIXEL+SIZE_PIXEL+SIZE_PIXEL, c[5], c[9]); +#define PIXEL23_11 Interp1(pOut+dstPitch+dstPitch+SIZE_PIXEL+SIZE_PIXEL+SIZE_PIXEL, c[5], c[6]); +#define PIXEL23_13 Interp1(pOut+dstPitch+dstPitch+SIZE_PIXEL+SIZE_PIXEL+SIZE_PIXEL, c[6], c[5]); +#define PIXEL23_21 Interp2(pOut+dstPitch+dstPitch+SIZE_PIXEL+SIZE_PIXEL+SIZE_PIXEL, c[6], c[5], c[8]); +#define PIXEL23_32 Interp3(pOut+dstPitch+dstPitch+SIZE_PIXEL+SIZE_PIXEL+SIZE_PIXEL, c[5], c[8]); +#define PIXEL23_50 Interp5(pOut+dstPitch+dstPitch+SIZE_PIXEL+SIZE_PIXEL+SIZE_PIXEL, c[6], c[5]); +#define PIXEL23_60 Interp6(pOut+dstPitch+dstPitch+SIZE_PIXEL+SIZE_PIXEL+SIZE_PIXEL, c[5], c[6], c[8]); +#define PIXEL23_61 Interp6(pOut+dstPitch+dstPitch+SIZE_PIXEL+SIZE_PIXEL+SIZE_PIXEL, c[5], c[6], c[9]); +#define PIXEL23_81 Interp8(pOut+dstPitch+dstPitch+SIZE_PIXEL+SIZE_PIXEL+SIZE_PIXEL, c[5], c[6]); +#define PIXEL23_83 Interp8(pOut+dstPitch+dstPitch+SIZE_PIXEL+SIZE_PIXEL+SIZE_PIXEL, c[6], c[8]); + +#define PIXEL30_0 *((COLORTYPE*)(pOut+dstPitch+dstPitch+dstPitch)) = c[5]; +#define PIXEL30_11 Interp1(pOut+dstPitch+dstPitch+dstPitch, c[5], c[8]); +#define PIXEL30_12 Interp1(pOut+dstPitch+dstPitch+dstPitch, c[5], c[4]); +#define PIXEL30_20 Interp2(pOut+dstPitch+dstPitch+dstPitch, c[5], c[8], c[4]); +#define PIXEL30_50 Interp5(pOut+dstPitch+dstPitch+dstPitch, c[8], c[4]); +#define PIXEL30_80 Interp8(pOut+dstPitch+dstPitch+dstPitch, c[5], c[7]); +#define PIXEL30_81 Interp8(pOut+dstPitch+dstPitch+dstPitch, c[5], c[8]); +#define PIXEL30_82 Interp8(pOut+dstPitch+dstPitch+dstPitch, c[5], c[4]); + +#define PIXEL31_0 *((COLORTYPE*)(pOut+dstPitch+dstPitch+dstPitch+SIZE_PIXEL)) = c[5]; +#define PIXEL31_10 Interp1(pOut+dstPitch+dstPitch+dstPitch+SIZE_PIXEL, c[5], c[7]); +#define PIXEL31_11 Interp1(pOut+dstPitch+dstPitch+dstPitch+SIZE_PIXEL, c[5], c[8]); +#define PIXEL31_13 Interp1(pOut+dstPitch+dstPitch+dstPitch+SIZE_PIXEL, c[8], c[5]); +#define PIXEL31_21 Interp2(pOut+dstPitch+dstPitch+dstPitch+SIZE_PIXEL, c[8], c[5], c[4]); +#define PIXEL31_32 Interp3(pOut+dstPitch+dstPitch+dstPitch+SIZE_PIXEL, c[5], c[4]); +#define PIXEL31_50 Interp5(pOut+dstPitch+dstPitch+dstPitch+SIZE_PIXEL, c[8], c[5]); +#define PIXEL31_60 Interp6(pOut+dstPitch+dstPitch+dstPitch+SIZE_PIXEL, c[5], c[8], c[4]); +#define PIXEL31_61 Interp6(pOut+dstPitch+dstPitch+dstPitch+SIZE_PIXEL, c[5], c[8], c[7]); +#define PIXEL31_81 Interp8(pOut+dstPitch+dstPitch+dstPitch+SIZE_PIXEL, c[5], c[8]); +#define PIXEL31_83 Interp8(pOut+dstPitch+dstPitch+dstPitch+SIZE_PIXEL, c[8], c[4]); + +#define PIXEL32_0 *((COLORTYPE*)(pOut+dstPitch+dstPitch+dstPitch+SIZE_PIXEL+SIZE_PIXEL)) = c[5]; +#define PIXEL32_10 Interp1(pOut+dstPitch+dstPitch+dstPitch+SIZE_PIXEL+SIZE_PIXEL, c[5], c[9]); +#define PIXEL32_12 Interp1(pOut+dstPitch+dstPitch+dstPitch+SIZE_PIXEL+SIZE_PIXEL, c[5], c[8]); +#define PIXEL32_14 Interp1(pOut+dstPitch+dstPitch+dstPitch+SIZE_PIXEL+SIZE_PIXEL, c[8], c[5]); +#define PIXEL32_21 Interp2(pOut+dstPitch+dstPitch+dstPitch+SIZE_PIXEL+SIZE_PIXEL, c[8], c[5], c[6]); +#define PIXEL32_31 Interp3(pOut+dstPitch+dstPitch+dstPitch+SIZE_PIXEL+SIZE_PIXEL, c[5], c[6]); +#define PIXEL32_50 Interp5(pOut+dstPitch+dstPitch+dstPitch+SIZE_PIXEL+SIZE_PIXEL, c[8], c[5]); +#define PIXEL32_60 Interp6(pOut+dstPitch+dstPitch+dstPitch+SIZE_PIXEL+SIZE_PIXEL, c[5], c[8], c[6]); +#define PIXEL32_61 Interp6(pOut+dstPitch+dstPitch+dstPitch+SIZE_PIXEL+SIZE_PIXEL, c[5], c[8], c[9]); +#define PIXEL32_82 Interp8(pOut+dstPitch+dstPitch+dstPitch+SIZE_PIXEL+SIZE_PIXEL, c[5], c[8]); +#define PIXEL32_83 Interp8(pOut+dstPitch+dstPitch+dstPitch+SIZE_PIXEL+SIZE_PIXEL, c[8], c[6]); + +#define PIXEL33_0 *((COLORTYPE*)(pOut+dstPitch+dstPitch+dstPitch+SIZE_PIXEL+SIZE_PIXEL+SIZE_PIXEL)) = c[5]; +#define PIXEL33_11 Interp1(pOut+dstPitch+dstPitch+dstPitch+SIZE_PIXEL+SIZE_PIXEL+SIZE_PIXEL, c[5], c[6]); +#define PIXEL33_12 Interp1(pOut+dstPitch+dstPitch+dstPitch+SIZE_PIXEL+SIZE_PIXEL+SIZE_PIXEL, c[5], c[8]); +#define PIXEL33_20 Interp2(pOut+dstPitch+dstPitch+dstPitch+SIZE_PIXEL+SIZE_PIXEL+SIZE_PIXEL, c[5], c[8], c[6]); +#define PIXEL33_50 Interp5(pOut+dstPitch+dstPitch+dstPitch+SIZE_PIXEL+SIZE_PIXEL+SIZE_PIXEL, c[8], c[6]); +#define PIXEL33_80 Interp8(pOut+dstPitch+dstPitch+dstPitch+SIZE_PIXEL+SIZE_PIXEL+SIZE_PIXEL, c[5], c[9]); +#define PIXEL33_81 Interp8(pOut+dstPitch+dstPitch+dstPitch+SIZE_PIXEL+SIZE_PIXEL+SIZE_PIXEL, c[5], c[6]); +#define PIXEL33_82 Interp8(pOut+dstPitch+dstPitch+dstPitch+SIZE_PIXEL+SIZE_PIXEL+SIZE_PIXEL, c[5], c[8]); +#endif + + + +#if defined(_HQ3X) +#if defined(_16BIT) +void hq3x16(unsigned char * pIn, unsigned int srcPitch, + unsigned char *, + unsigned char * pOut, unsigned int dstPitch, + int Xres, int Yres) +#elif defined(_32BIT) +void hq3x32(unsigned char * pIn, unsigned int srcPitch, + unsigned char *, + unsigned char * pOut, unsigned int dstPitch, + int Xres, int Yres) +#endif +#elif defined(_HQ4X) +#if defined(_16BIT) +void hq4x16(unsigned char * pIn, unsigned int srcPitch, + unsigned char *, + unsigned char * pOut, unsigned int dstPitch, + int Xres, int Yres) +#elif defined(_32BIT) +void hq4x32(unsigned char * pIn, unsigned int srcPitch, + unsigned char *, + unsigned char * pOut, unsigned int dstPitch, + int Xres, int Yres) +#endif +#endif +{ + unsigned int YUV1, YUV2; + int i, j, k; + unsigned int line; + COLORTYPE c[10]; + + // +----+----+----+ + // | | | | + // | c1 | c2 | c3 | + // +----+----+----+ + // | | | | + // | c4 | c5 | c6 | + // +----+----+----+ + // | | | | + // | c7 | c8 | c9 | + // +----+----+----+ + + for (j=0; j0) || (j0) + { + c[1] = *((COLORTYPE*)(pIn - line - SIZE_PIXEL)); + c[4] = *((COLORTYPE*)(pIn - SIZE_PIXEL)); + c[7] = *((COLORTYPE*)(pIn + line - SIZE_PIXEL)); + } + else + { + c[1] = c[2]; + c[4] = c[5]; + c[7] = c[8]; + } + + if (i 0x00300000 ) || + ( abs32((YUV1 & 0x0000FF00) - (YUV2 & 0x0000FF00)) > 0x00000700 ) || + ( abs32((YUV1 & 0x000000FF) - (YUV2 & 0x000000FF)) > 0x00000006 ) + ) + pattern |= flag; + } + flag <<= 1; + } + +#if defined(_HQ3X) +#include "hq3x_pattern.h" +#elif defined(_HQ4X) +#include "hq4x_pattern.h" +#endif + + pIn += SIZE_PIXEL; + pOut += _MAGNIFICATION * SIZE_PIXEL; + } + pIn += srcPitch - (Xres * SIZE_PIXEL); + pOut += dstPitch-(_MAGNIFICATION * Xres * SIZE_PIXEL); + pOut += (_MAGNIFICATION-1) * dstPitch; + } +} + +#undef SIZE_PIXEL +#undef COLORTYPE +#undef abs32 diff --git a/src/libresample-0.1.3/README.txt b/src/libresample-0.1.3/README.txt index 14be45b8..7cfb55cc 100644 --- a/src/libresample-0.1.3/README.txt +++ b/src/libresample-0.1.3/README.txt @@ -47,7 +47,7 @@ Changes in version 0.1.3: * resample-sndfile clips output to -1...1 (thanks to Glenn Maynard) -Usage notes: +Usage notes: - If the output buffer you pass is too small, resample_process may not use any input samples because its internal output diff --git a/src/libresample-0.1.3/config.guess b/src/libresample-0.1.3/config.guess index 297e5c30..71c2d54a 100644 --- a/src/libresample-0.1.3/config.guess +++ b/src/libresample-0.1.3/config.guess @@ -831,7 +831,7 @@ EOF ;; a.out-i386-linux) echo "${UNAME_MACHINE}-pc-linux-gnuaout" - exit 0 ;; + exit 0 ;; coff-i386) echo "${UNAME_MACHINE}-pc-linux-gnucoff" exit 0 ;; diff --git a/src/libresample-0.1.3/install-sh b/src/libresample-0.1.3/install-sh index e9de2384..594a4edb 100644 --- a/src/libresample-0.1.3/install-sh +++ b/src/libresample-0.1.3/install-sh @@ -115,7 +115,7 @@ fi if [ x"$dir_arg" != x ]; then dst=$src src="" - + if [ -d $dst ]; then instcmd=: chmodcmd="" @@ -125,7 +125,7 @@ if [ x"$dir_arg" != x ]; then else # Waiting for this to be detected by the "$instcmd $src $dsttmp" command -# might cause directories to be created, which would be especially bad +# might cause directories to be created, which would be especially bad # if $src (and thus $dsttmp) contains '*'. if [ -f $src -o -d $src ] @@ -135,7 +135,7 @@ else echo "install: $src does not exist" exit 1 fi - + if [ x"$dst" = x ] then echo "install: no destination specified" @@ -163,7 +163,7 @@ dstdir=`echo $dst | sed -e 's,[^/]*$,,;s,/$,,;s,^$,.,'` # Skip lots of stat calls in the usual case. if [ ! -d "$dstdir" ]; then -defaultIFS=' +defaultIFS=' ' IFS="${IFS-${defaultIFS}}" @@ -202,17 +202,17 @@ else # If we're going to rename the final executable, determine the name now. - if [ x"$transformarg" = x ] + if [ x"$transformarg" = x ] then dstfile=`basename $dst` else - dstfile=`basename $dst $transformbasename | + dstfile=`basename $dst $transformbasename | sed $transformarg`$transformbasename fi # don't allow the sed command to completely eliminate the filename - if [ x"$dstfile" = x ] + if [ x"$dstfile" = x ] then dstfile=`basename $dst` else @@ -243,7 +243,7 @@ else # Now rename the file to the real destination. $doit $rmcmd -f $dstdir/$dstfile && - $doit $mvcmd $dsttmp $dstdir/$dstfile + $doit $mvcmd $dsttmp $dstdir/$dstfile fi && diff --git a/src/libresample-0.1.3/win/libresample.dsp b/src/libresample-0.1.3/win/libresample.dsp index 4ebb51e4..f3aad0d4 100644 --- a/src/libresample-0.1.3/win/libresample.dsp +++ b/src/libresample-0.1.3/win/libresample.dsp @@ -7,19 +7,19 @@ CFG=libresample - Win32 Debug !MESSAGE This is not a valid makefile. To build this project using NMAKE, !MESSAGE use the Export Makefile command and run -!MESSAGE +!MESSAGE !MESSAGE NMAKE /f "libresample.mak". -!MESSAGE +!MESSAGE !MESSAGE You can specify a configuration when running NMAKE !MESSAGE by defining the macro CFG on the command line. For example: -!MESSAGE +!MESSAGE !MESSAGE NMAKE /f "libresample.mak" CFG="libresample - Win32 Debug" -!MESSAGE +!MESSAGE !MESSAGE Possible choices for configuration are: -!MESSAGE +!MESSAGE !MESSAGE "libresample - Win32 Release" (based on "Win32 (x86) Static Library") !MESSAGE "libresample - Win32 Debug" (based on "Win32 (x86) Static Library") -!MESSAGE +!MESSAGE # Begin Project # PROP AllowPerConfigDependencies 0 @@ -74,7 +74,7 @@ LIB32=link.exe -lib # ADD BASE LIB32 /nologo # ADD LIB32 /nologo /out:"libresampled.lib" -!ENDIF +!ENDIF # Begin Target diff --git a/src/macosx/KeyConfig.mm b/src/macosx/KeyConfig.mm index b4d14f45..b59a68a5 100644 --- a/src/macosx/KeyConfig.mm +++ b/src/macosx/KeyConfig.mm @@ -72,7 +72,7 @@ int poll() int config_main() { - + if(SDL_Init(SDL_INIT_TIMER|SDL_INIT_VIDEO|SDL_INIT_NOPARACHUTE)) { printf("Failed to init SDL: %s\n", SDL_GetError()); exit(-1); @@ -87,22 +87,22 @@ int config_main() // if (NULL == surface) { // printf("Failed to set video mode: %s\n", SDL_GetError()); // } - + int numJoy = SDL_NumJoysticks(); - + int i; for(i = 0; i < numJoy; i++) { SDL_JoystickOpen(i); } SDL_JoystickEventState(SDL_ENABLE); - + /*printf("%i joysticks were found.\n\n", SDL_NumJoysticks() ); printf("The names of the joysticks are:\n"); - - for( i=0; i < SDL_NumJoysticks(); i++ ) + + for( i=0; i < SDL_NumJoysticks(); i++ ) { printf(" %s\n", SDL_JoystickName(i)); }*/ - + return SDL_NumJoysticks(); } diff --git a/src/macosx/MainClass.mm b/src/macosx/MainClass.mm index 2afc0ccf..7916c4c1 100644 --- a/src/macosx/MainClass.mm +++ b/src/macosx/MainClass.mm @@ -101,7 +101,7 @@ bool changeType; - (void) closePrefsNull:(id)sender { [prefsWindow orderOut:self]; - + paused = false; SDL_PauseAudio(paused); wasPaused = false; @@ -198,10 +198,10 @@ bool changeType; [prefs setInteger:[realtimeClock indexOfSelectedItem] forKey:@"rtcEnabled"]; [prefs setInteger:[interframe indexOfSelectedItem] forKey:@"ifbType"]; [prefs setInteger:[changeFileType indexOfSelectedItem] forKey:@"changeType"]; - + [prefsWindow orderOut:self]; [prefs synchronize]; - + paused = !paused; SDL_PauseAudio(paused); if(paused) @@ -214,10 +214,10 @@ bool changeType; BOOL isOK; NSString * path = [NSString stringWithString:@"~/Library/Preferences/VisualBoyAdvance.plist"]; path = [path stringByExpandingTildeInPath]; - + if( [[NSFileManager defaultManager] fileExistsAtPath:path] ) isOK = [[NSFileManager defaultManager] removeFileAtPath:path handler:nil]; - + sdlSetDefaultPreferences(); [self loadConfig]; } @@ -239,11 +239,11 @@ bool changeType; { NSNumber *fileType = [NSNumber numberWithUnsignedLong:'Cart']; NSNumber *fileCreator = [NSNumber numberWithUnsignedLong:'vboy']; - + NSString * fileString = [[NSString alloc] initWithCString:filename]; - + [[NSFileManager defaultManager] changeFileAttributes:[NSDictionary dictionaryWithObject:fileType forKey:NSFileHFSTypeCode] atPath:fileString]; - + [[NSFileManager defaultManager] changeFileAttributes:[NSDictionary dictionaryWithObject:fileCreator forKey:NSFileHFSCreatorCode] atPath:fileString]; } @@ -251,11 +251,11 @@ bool changeType; { NSNumber *fileType = [NSNumber numberWithUnsignedLong:'savf']; NSNumber *fileCreator = [NSNumber numberWithUnsignedLong:'vboy']; - + NSString * fileString = [[NSString alloc] initWithCString:filename]; - + [[NSFileManager defaultManager] changeFileAttributes:[NSDictionary dictionaryWithObject:fileType forKey:NSFileHFSTypeCode] atPath:fileString]; - + [[NSFileManager defaultManager] changeFileAttributes:[NSDictionary dictionaryWithObject:fileCreator forKey:NSFileHFSCreatorCode] atPath:fileString]; } @@ -263,11 +263,11 @@ bool changeType; { NSNumber *fileType = [NSNumber numberWithUnsignedLong:'sgmf']; NSNumber *fileCreator = [NSNumber numberWithUnsignedLong:'vboy']; - + NSString * fileString = [[NSString alloc] initWithCString:statename]; - + [[NSFileManager defaultManager] changeFileAttributes:[NSDictionary dictionaryWithObject:fileType forKey:NSFileHFSTypeCode] atPath:fileString]; - + [[NSFileManager defaultManager] changeFileAttributes:[NSDictionary dictionaryWithObject:fileCreator forKey:NSFileHFSCreatorCode] atPath:fileString]; } @@ -286,18 +286,18 @@ bool changeType; { char parentdir[MAXPATHLEN]; char *c; - + strncpy ( parentdir, gArgv[0], sizeof(parentdir) ); c = (char*) parentdir; while (*c != '\0') /* go to end */ c++; - + while (*c != '/') /* back up to parent */ c--; - + *c++ = '\0'; /* cut off last part (binary name) */ - + if (shouldChdir) { assert ( chdir (parentdir) == 0 ); /* chdir to the binary app's parent */ @@ -349,7 +349,7 @@ bool changeType; /* Called when the internal event loop has just started running */ - (void) applicationDidFinishLaunching: (NSNotification *) note { - + gSDLMain = self; /* Set the working directory to the .app's parent directory */ @@ -408,7 +408,7 @@ if (emulating) else return YES; } - + -(void) openCheatCBA:(id)sender { [cheatWindow makeKeyAndOrderFront:self]; @@ -453,7 +453,7 @@ sdlReadState(0); // This is completely crazy. sdlEmuReset is declared in MainClass.h, which // is included in SDL.mm, but then it is defined in SDL.mm. Madness. -// Restructure this. +// Restructure this. -(void) resetEmulation:(id)sender { sdlEmuReset(); @@ -774,7 +774,7 @@ int main (int argc, char **argv) /* Copy the arguments into a global variable */ int i; - + /* This is passed if we are launched by double-clicking */ if ( argc >= 2 && strncmp (argv[1], "-psn", 4) == 0 ) { gArgc = 1; diff --git a/src/macosx/SDL.mm b/src/macosx/SDL.mm index 66c39341..59111b30 100644 --- a/src/macosx/SDL.mm +++ b/src/macosx/SDL.mm @@ -65,11 +65,11 @@ extern bool soundLowPass; extern bool soundReverse; extern int Init_2xSaI(u32); extern void _2xSaI(u8*,u32,u8*,u8*,u32,int,int); -extern void _2xSaI32(u8*,u32,u8*,u8*,u32,int,int); +extern void _2xSaI32(u8*,u32,u8*,u8*,u32,int,int); extern void Super2xSaI(u8*,u32,u8*,u8*,u32,int,int); extern void Super2xSaI32(u8*,u32,u8*,u8*,u32,int,int); extern void SuperEagle(u8*,u32,u8*,u8*,u32,int,int); -extern void SuperEagle32(u8*,u32,u8*,u8*,u32,int,int); +extern void SuperEagle32(u8*,u32,u8*,u8*,u32,int,int); extern void Pixelate(u8*,u32,u8*,u8*,u32,int,int); extern void Pixelate32(u8*,u32,u8*,u8*,u32,int,int); extern void MotionBlur(u8*,u32,u8*,u8*,u32,int,int); @@ -214,7 +214,7 @@ extern int runAgain, cheatCBA, cheatGSA; #define _stricmp strcasecmp bool sdlButtons[4][12] = { - { false, false, false, false, false, false, + { false, false, false, false, false, false, false, false, false, false, false, false }, { false, false, false, false, false, false, false, false, false, false, false, false }, @@ -332,7 +332,7 @@ u16 defaultMotion[4] = { struct option sdlOptions[] = { { "agb-print", no_argument, &sdlAgbPrint, 1 }, - { "auto-frameskip", no_argument, &autoFrameSkip, 1 }, + { "auto-frameskip", no_argument, &autoFrameSkip, 1 }, { "bios", required_argument, 0, 'b' }, { "config", required_argument, 0, 'c' }, { "debug", no_argument, 0, 'd' }, @@ -384,7 +384,7 @@ struct option sdlOptions[] = { { "show-speed-normal", no_argument, &showSpeed, 1 }, { "show-speed-detailed", no_argument, &showSpeed, 2 }, { "throttle", required_argument, 0, 'T' }, - { "verbose", required_argument, 0, 'v' }, + { "verbose", required_argument, 0, 'v' }, { "video-1x", no_argument, &sizeOption, 0 }, { "video-2x", no_argument, &sizeOption, 1 }, { "video-3x", no_argument, &sizeOption, 2 }, @@ -424,21 +424,21 @@ sdlStretcher[sdlStretcherPos++] = 0x8b;\ sdlStretcher[sdlStretcherPos++] = 0x06;\ sdlStretcher[sdlStretcherPos++] = 0x83;\ sdlStretcher[sdlStretcherPos++] = 0xc6;\ -sdlStretcher[sdlStretcherPos++] = 0x02; +sdlStretcher[sdlStretcherPos++] = 0x02; #define SDL_LOADL \ sdlStretcher[sdlStretcherPos++] = 0x8b;\ sdlStretcher[sdlStretcherPos++] = 0x06;\ sdlStretcher[sdlStretcherPos++] = 0x83;\ sdlStretcher[sdlStretcherPos++] = 0xc6;\ -sdlStretcher[sdlStretcherPos++] = 0x04; +sdlStretcher[sdlStretcherPos++] = 0x04; #define SDL_LOADL2 \ sdlStretcher[sdlStretcherPos++] = 0x8b;\ sdlStretcher[sdlStretcherPos++] = 0x06;\ sdlStretcher[sdlStretcherPos++] = 0x83;\ sdlStretcher[sdlStretcherPos++] = 0xc6;\ -sdlStretcher[sdlStretcherPos++] = 0x03; +sdlStretcher[sdlStretcherPos++] = 0x03; #define SDL_STOREW \ sdlStretcher[sdlStretcherPos++] = 0x66;\ @@ -446,21 +446,21 @@ sdlStretcher[sdlStretcherPos++] = 0x89;\ sdlStretcher[sdlStretcherPos++] = 0x07;\ sdlStretcher[sdlStretcherPos++] = 0x83;\ sdlStretcher[sdlStretcherPos++] = 0xc7;\ -sdlStretcher[sdlStretcherPos++] = 0x02; +sdlStretcher[sdlStretcherPos++] = 0x02; #define SDL_STOREL \ sdlStretcher[sdlStretcherPos++] = 0x89;\ sdlStretcher[sdlStretcherPos++] = 0x07;\ sdlStretcher[sdlStretcherPos++] = 0x83;\ sdlStretcher[sdlStretcherPos++] = 0xc7;\ -sdlStretcher[sdlStretcherPos++] = 0x04; +sdlStretcher[sdlStretcherPos++] = 0x04; #define SDL_STOREL2 \ sdlStretcher[sdlStretcherPos++] = 0x89;\ sdlStretcher[sdlStretcherPos++] = 0x07;\ sdlStretcher[sdlStretcherPos++] = 0x83;\ sdlStretcher[sdlStretcherPos++] = 0xc7;\ -sdlStretcher[sdlStretcherPos++] = 0x03; +sdlStretcher[sdlStretcherPos++] = 0x03; #define SDL_RET \ sdlStretcher[sdlStretcherPos++] = 0xc3; @@ -839,15 +839,15 @@ u32 sdlFromHex(char *s) void sdlCheckDirectory(char *dir) { struct stat buf; - + int len = strlen(dir); - + char *p = dir + len - 1; - + if(*p == '/' || *p == '\\') *p = 0; - + if(stat(dir, &buf) == 0) { if(!(buf.st_mode & S_IFDIR)) { fprintf(stderr, "Error: %s is not a directory\n", dir); @@ -862,11 +862,11 @@ void sdlCheckDirectory(char *dir) char *sdlGetFilename(char *name) { static char filebuffer[2048]; - + int len = strlen(name); - + char *p = name + len - 1; - + while(true) { if(*p == '/' || *p == '\\') { @@ -878,7 +878,7 @@ char *sdlGetFilename(char *name) if(len == 0) break; } - + if(len == 0) strcpy(filebuffer, name); else @@ -887,13 +887,13 @@ char *sdlGetFilename(char *name) } NSString *applicationSupportFolder() { - NSArray *paths = - NSSearchPathForDirectoriesInDomains(NSApplicationSupportDirectory, + NSArray *paths = + NSSearchPathForDirectoriesInDomains(NSApplicationSupportDirectory, NSUserDomainMask, YES); - NSString *basePath = ([paths count] > 0) ? [paths objectAtIndex: + NSString *basePath = ([paths count] > 0) ? [paths objectAtIndex: 0] : NSTemporaryDirectory(); - return [basePath - stringByAppendingPathComponent: [[NSBundle mainBundle] objectForInfoDictionaryKey: + return [basePath + stringByAppendingPathComponent: [[NSBundle mainBundle] objectForInfoDictionaryKey: @"CFBundleExecutable"]]; } @@ -935,16 +935,16 @@ void sdlReadPreferences(FILE * f) gbBorderOn = [prefs integerForKey:@"gbBorderOn"]; gbBorderAutomatic = [prefs integerForKey:@"gbBorderAutomatic"]; gbColorOption = [prefs integerForKey:@"colorOption"]; - + // Set up our application support directories. Some people don't like this, and prefer // the app to keep the folders near the app itself. Those people are wrong. NSFileManager *fileManager = [NSFileManager defaultManager]; NSString *appSupportFolder = applicationSupportFolder(); - + if (NO == [fileManager fileExistsAtPath: appSupportFolder]) { [fileManager createDirectoryAtPath: appSupportFolder attributes:nil]; } - + NSString *capture = [NSString stringWithFormat:@"%@/%@", appSupportFolder, @"Screenshots"]; if (NO == [fileManager fileExistsAtPath: capture]) { [fileManager createDirectoryAtPath: capture attributes: nil]; @@ -967,7 +967,7 @@ void sdlReadPreferences(FILE * f) case 4: break; default: - NSLog(@"Unknown sound quality %d. Defaulting to 22Khz\n", + NSLog(@"Unknown sound quality %d. Defaulting to 22Khz\n", soundQuality); soundQuality = 2; break; @@ -1046,21 +1046,21 @@ void sdlReadPreferences() //set all defaults sdlSetDefaultPreferences(); } - + sdlReadPreferences(NULL); } static void sdlApplyPerImagePreferences() { //FILE *f = sdlFindFile("vba-over.ini"); - + FILE *f = nil; if(!f) { fprintf(stderr, "vba-over.ini NOT FOUND (using emulator settings)\n"); return; } else fprintf(stderr, "Reading vba-over.ini\n"); - + char buffer[7]; buffer[0] = '['; buffer[1] = rom[0xac]; @@ -1069,58 +1069,58 @@ static void sdlApplyPerImagePreferences() buffer[4] = rom[0xaf]; buffer[5] = ']'; buffer[6] = 0; - + char readBuffer[2048]; - + bool found = false; - + while(1) { char *s = fgets(readBuffer, 2048, f); - + if(s == NULL) break; - + char *p = strchr(s, ';'); - + if(p) *p = 0; - + char *token = strtok(s, " \t\n\r="); - + if(!token) continue; if(strlen(token) == 0) continue; - + if(!strcmp(token, buffer)) { found = true; break; } } - + if(found) { while(1) { char *s = fgets(readBuffer, 2048, f); - + if(s == NULL) break; - + char *p = strchr(s, ';'); if(p) *p = 0; - + char *token = strtok(s, " \t\n\r="); if(!token) continue; if(strlen(token) == 0) continue; - + if(token[0] == '[') // starting another image settings break; char *value = strtok(NULL, "\t\n\r="); if(value == NULL) continue; - + if(!strcmp(token, "rtcEnabled")) rtcEnable(atoi(value) == 0 ? false : true); else if(!strcmp(token, "flashSize")) { @@ -1142,12 +1142,12 @@ static void sdlApplyPerImagePreferences() static int sdlCalculateShift(u32 mask) { int m = 0; - + while(mask) { m++; mask >>= 1; } - + return m-5; } @@ -1155,87 +1155,87 @@ static int sdlCalculateMaskWidth(u32 mask) { int m = 0; int mask2 = mask; - + while(mask2) { m++; mask2 >>= 1; } - + int m2 = 0; mask2 = mask; while(!(mask2 & 1)) { m2++; mask2 >>= 1; } - + return m - m2; } void sdlWriteState(int num) { char stateName[VBA_MAX_PATH_LEN]; - + if(saveDir[0]) sprintf(stateName, "%s/%s%d.sgm", saveDir, sdlGetFilename(filename), num+1); else sprintf(stateName,"%s%d.sgm", filename, num+1); - + if(emulator.emuWriteState) emulator.emuWriteState(stateName); - + sprintf(stateName, "Wrote state %d", num+1); systemScreenMessage(stateName); - + systemDrawScreen(); } void sdlReadState(int num) { char stateName[VBA_MAX_PATH_LEN]; - + if(saveDir[0]) sprintf(stateName, "%s/%s%d.sgm", saveDir, sdlGetFilename(filename), num+1); else sprintf(stateName,"%s%d.sgm", filename, num+1); - + if(emulator.emuReadState) emulator.emuReadState(stateName); - + sprintf(stateName, "Loaded state %d", num+1); systemScreenMessage(stateName); - + systemDrawScreen(); } void sdlWriteBattery() { char buffer[1048]; - + if(batteryDir[0]) sprintf(buffer, "%s/%s.sav", batteryDir, sdlGetFilename(filename)); - else + else sprintf(buffer, "%s.sav", filename); - + emulator.emuWriteBattery(buffer); - + // systemScreenMessage("Wrote battery"); } void sdlReadBattery() { char buffer[1048]; - + if(batteryDir[0]) sprintf(buffer, "%s/%s.sav", batteryDir, sdlGetFilename(filename)); - else + else sprintf(buffer, "%s.sav", filename); - + bool res = false; - + res = emulator.emuReadBattery(buffer); - + if(res) systemScreenMessage("Loaded battery"); } @@ -1275,7 +1275,7 @@ void sdlUpdateJoyButton(int which, int b = joypad[j][i] & 0xfff; if(dev) { dev--; - + if((dev == which) && (b >= 128) && (b == (button+128))) { sdlButtons[j][i] = pressed; } @@ -1287,12 +1287,12 @@ void sdlUpdateJoyButton(int which, int b = motion[i] & 0xfff; if(dev) { dev--; - + if((dev == which) && (b >= 128) && (b == (button+128))) { sdlMotionButtons[i] = pressed; } } - } + } } void sdlUpdateJoyHat(int which, @@ -1306,7 +1306,7 @@ void sdlUpdateJoyHat(int which, int a = joypad[j][i] & 0xfff; if(dev) { dev--; - + if((dev == which) && (a>=32) && (a < 48) && (((a&15)>>2) == hat)) { int dir = a & 3; int v = 0; @@ -1334,7 +1334,7 @@ void sdlUpdateJoyHat(int which, int a = motion[i] & 0xfff; if(dev) { dev--; - + if((dev == which) && (a>=32) && (a < 48) && (((a&15)>>2) == hat)) { int dir = a & 3; int v = 0; @@ -1355,7 +1355,7 @@ void sdlUpdateJoyHat(int which, sdlMotionButtons[i] = (v ? true : false); } } - } + } } void sdlUpdateJoyAxis(int which, @@ -1369,7 +1369,7 @@ void sdlUpdateJoyAxis(int which, int a = joypad[j][i] & 0xfff; if(dev) { dev--; - + if((dev == which) && (a < 32) && ((a>>1) == axis)) { sdlButtons[j][i] = (a & 1) ? (value > 16384) : (value < -16384); } @@ -1381,27 +1381,27 @@ void sdlUpdateJoyAxis(int which, int a = motion[i] & 0xfff; if(dev) { dev--; - + if((dev == which) && (a < 32) && ((a>>1) == axis)) { sdlMotionButtons[i] = (a & 1) ? (value > 16384) : (value < -16384); } } - } + } } bool sdlCheckJoyKey(int key) { int dev = (key >> 12) - 1; int what = key & 0xfff; - + if(what >= 128) { // joystick button int button = what - 128; - + if(button >= SDL_JoystickNumButtons(sdlDevices[dev])) return false; } else if (what < 0x20) { - // joystick axis + // joystick axis what >>= 1; if(what >= SDL_JoystickNumAxes(sdlDevices[dev])) return false; @@ -1412,7 +1412,7 @@ bool sdlCheckJoyKey(int key) if(what >= SDL_JoystickNumHats(sdlDevices[dev])) return false; } - + // no problem found return true; } @@ -1420,32 +1420,32 @@ bool sdlCheckJoyKey(int key) void sdlCheckKeys() { sdlNumDevices = SDL_NumJoysticks(); - + if(sdlNumDevices) sdlDevices = (SDL_Joystick **)calloc(1,sdlNumDevices * sizeof(SDL_Joystick **)); int i; - + bool usesJoy = false; - + for(int j = 0; j < 4; j++) { for(i = 0; i < 12; i++) { int dev = joypad[j][i] >> 12; if(dev) { dev--; bool ok = false; - + if(sdlDevices) { if(dev < sdlNumDevices) { if(sdlDevices[dev] == NULL) { sdlDevices[dev] = SDL_JoystickOpen(dev); } - + ok = sdlCheckJoyKey(joypad[j][i]); } else ok = false; } - + if(!ok) joypad[j][i] = defaultJoypad[i]; else @@ -1453,31 +1453,31 @@ void sdlCheckKeys() } } } - + for(i = 0; i < 4; i++) { int dev = motion[i] >> 12; if(dev) { dev--; bool ok = false; - + if(sdlDevices) { if(dev < sdlNumDevices) { if(sdlDevices[dev] == NULL) { sdlDevices[dev] = SDL_JoystickOpen(dev); } - + ok = sdlCheckJoyKey(motion[i]); } else ok = false; } - + if(!ok) motion[i] = defaultMotion[i]; else usesJoy = true; } } - + if(usesJoy) SDL_JoystickEventState(SDL_ENABLE); } @@ -1504,7 +1504,7 @@ void sdlPollEvents() if(emulating) soundPause(); } - + memset(delta,255,sizeof(delta)); } } @@ -1548,17 +1548,17 @@ void sdlPollEvents() if(event.key.keysym.mod & KMOD_META) { if(emulating) { emulator.emuReset(); - + systemScreenMessage("Reset"); } } break; case SDLK_b: if(event.key.keysym.mod & KMOD_META) { - if(emulating && emulator.emuReadMemState && rewindMemory + if(emulating && emulator.emuReadMemState && rewindMemory && rewindCount) { rewindPos = (rewindPos - 1) & 7; - emulator.emuReadMemState(&rewindMemory[REWIND_SIZE*rewindPos], + emulator.emuReadMemState(&rewindMemory[REWIND_SIZE*rewindPos], REWIND_SIZE); rewindCount--; rewindCounter = 0; @@ -1588,7 +1588,7 @@ void sdlPollEvents() case SDLK_d: if (event.key.keysym.mod & KMOD_META) { sdlReadState(0); - } + } case SDLK_F11: if(dbgMain != debuggerMain) { if(armState) { @@ -1624,12 +1624,12 @@ void sdlPollEvents() case SDLK_4: if(!(event.key.keysym.mod & MOD_NOALT) && (event.key.keysym.mod & KMOD_ALT)) { - char *disableMessages[4] = + char *disableMessages[4] = { "autofire A disabled", "autofire B disabled", "autofire R disabled", "autofire L disabled"}; - char *enableMessages[4] = + char *enableMessages[4] = { "autofire A", "autofire B", "autofire R", @@ -1772,66 +1772,66 @@ void usage(char *cmd) int main(int argc, char **argv) { bool failed = false; - + char szFile[1024]; captureDir[0] = 0; saveDir[0] = 0; batteryDir[0] = 0; ipsname[0] = 0; - + frameSkip = 2; gbBorderOn = 0; - + sdlReadPreferences(); - + if(sdlFlashSize == 0) flashSetSize(0x10000); else flashSetSize(0x20000); - + rtcEnable(sdlRtcEnable ? true : false); agbPrintEnable(sdlAgbPrint ? true : false); - + if(filter) { sizeOption = 1; } - + for(int i = 0; i < 24;) { systemGbPalette[i++] = (0x1f) | (0x1f << 5) | (0x1f << 10); systemGbPalette[i++] = (0x15) | (0x15 << 5) | (0x15 << 10); systemGbPalette[i++] = (0x0c) | (0x0c << 5) | (0x0c << 10); systemGbPalette[i++] = 0; } - + szFile[0] = '\0'; - + if (launchFile[0] != '\0') strcpy(szFile, launchFile); else openFile(szFile); - + if(szFile[0] != '\0') { - + if (changeType) [gSDLMain changeCreator:szFile]; strcpy(filename, szFile); char *p = strrchr(filename, '.'); - + if(p) *p = 0; - + if(ipsname[0] == 0) sprintf(ipsname, "%s.ips", filename); - + IMAGE_TYPE type = utilFindType(szFile); - + if(type == IMAGE_UNKNOWN) { systemMessage(0, "Unknown file type %s", szFile); exit(-1); } cartridgeType = (int)type; - + if(type == IMAGE_GB) { failed = !gbLoadRom(szFile); if(!failed) { @@ -1868,7 +1868,7 @@ int main(int argc, char **argv) //utilGBAFindSave(rom, size); //} emulator = GBASystem; - + cartridgeType = 0; emuWriteState = CPUWriteState; emuWriteMemState = CPUWriteMemState; @@ -1883,11 +1883,11 @@ int main(int argc, char **argv) emuMain = CPULoop; emuUpdateCPSR = CPUUpdateCPSR; emuCount = 50000; - + if(removeIntros && rom != NULL) { WRITE32LE(&rom[0], 0xea00002e); } - + CPUInit(biosFileName, useBios); CPUReset(); if(sdlAutoIPS) { @@ -1899,46 +1899,46 @@ int main(int argc, char **argv) } } } - + if(failed) { systemMessage(0, "Failed to load file %s", szFile); return 0; } } else { - return 0; + return 0; } - + sdlReadBattery(); - + if (cheatCBA == 1 && cartridgeType == 0) { [gSDLMain addCheatCBA]; cheatCBA = 0; } - + if (cheatGSA == 1 && cartridgeType == 0) { [gSDLMain addCheatGSA]; cheatGSA = 0; } - + int flags = SDL_INIT_VIDEO|SDL_INIT_AUDIO| SDL_INIT_TIMER|SDL_INIT_NOPARACHUTE; - + if(soundOffFlag) flags ^= SDL_INIT_AUDIO; - + if(SDL_Init(flags)) { systemMessage(0, "Failed to init SDL: %s", SDL_GetError()); exit(-1); } - + if(SDL_InitSubSystem(SDL_INIT_JOYSTICK)) { systemMessage(0, "Failed to init joystick support: %s", SDL_GetError()); } - + sdlCheckKeys(); - + if(cartridgeType == 0) { srcWidth = 240; srcHeight = 160; @@ -1950,7 +1950,7 @@ int main(int argc, char **argv) gbBorderLineSkip = 256; gbBorderColumnSkip = 48; gbBorderRowSkip = 40; - } else { + } else { srcWidth = 160; srcHeight = 144; gbBorderLineSkip = 160; @@ -1962,43 +1962,43 @@ int main(int argc, char **argv) srcWidth = 320; srcHeight = 240; } - + destWidth = (sizeOption+1)*srcWidth; destHeight = (sizeOption+1)*srcHeight; - + surface = SDL_SetVideoMode(destWidth, destHeight, 0, SDL_SWSURFACE); - + if(surface == NULL) { systemMessage(0, "Failed to set video mode"); SDL_Quit(); return 0; } - + systemRedShift = sdlCalculateShift(surface->format->Rmask); systemGreenShift = sdlCalculateShift(surface->format->Gmask); systemBlueShift = sdlCalculateShift(surface->format->Bmask); - + systemColorDepth = surface->format->BitsPerPixel; if(systemColorDepth == 15) systemColorDepth = 16; - + if(systemColorDepth != 16 && systemColorDepth != 24 && systemColorDepth != 32) { systemMessage(0,"Unsupported color depth '%d'.\nOnly 16, 24 and 32 bit color depths are supported\n", systemColorDepth); SDL_Quit(); return 0; } - + surface = SDL_SetVideoMode(destWidth, destHeight, 0, SDL_SWSURFACE | (fullscreen ? SDL_FULLSCREEN : 0)); - + if(surface == NULL) { systemMessage(0, "Failed to set video mode"); SDL_Quit(); return 0; } - + SDL_ShowCursor(!fullscreen); - + switch(systemColorDepth) { case 16: sdlStretcher = sdlStretcher16[sizeOption]; @@ -2013,28 +2013,28 @@ int main(int argc, char **argv) fprintf(stderr, "Unsupported resolution: %d\n", systemColorDepth); exit(-1); } - + //fprintf(stderr,"Color depth: %d\n", systemColorDepth); - + if(systemColorDepth == 16) { if(sdlCalculateMaskWidth(surface->format->Gmask) == 6) { Init_2xSaI(565); RGB_LOW_BITS_MASK = 0x821; } else { Init_2xSaI(555); - RGB_LOW_BITS_MASK = 0x421; + RGB_LOW_BITS_MASK = 0x421; } if(cartridgeType == 2) { for(int i = 0; i < 0x10000; i++) { systemColorMap16[i] = (((i >> 1) & 0x1f) << systemBlueShift) | (((i & 0x7c0) >> 6) << systemGreenShift) | - (((i & 0xf800) >> 11) << systemRedShift); - } + (((i & 0xf800) >> 11) << systemRedShift); + } } else { for(int i = 0; i < 0x10000; i++) { systemColorMap16[i] = ((i & 0x1f) << systemRedShift) | (((i & 0x3e0) >> 5) << systemGreenShift) | - (((i & 0x7c00) >> 10) << systemBlueShift); + (((i & 0x7c00) >> 10) << systemBlueShift); } } srcPitch = srcWidth * 2+4; @@ -2048,14 +2048,14 @@ int main(int argc, char **argv) for(int i = 0; i < 0x10000; i++) { systemColorMap32[i] = ((i & 0x1f) << systemRedShift) | (((i & 0x3e0) >> 5) << systemGreenShift) | - (((i & 0x7c00) >> 10) << systemBlueShift); + (((i & 0x7c00) >> 10) << systemBlueShift); } if(systemColorDepth == 32) srcPitch = srcWidth*4 + 4; else srcPitch = srcWidth*3; } - + if(systemColorDepth != 32) { switch(filter) { case 0: @@ -2153,7 +2153,7 @@ int main(int argc, char **argv) break; } } - + if(systemColorDepth == 16) { switch(ifbType) { case 0: @@ -2182,22 +2182,22 @@ int main(int argc, char **argv) } } else ifbFunction = NULL; - + if(delta == NULL) { delta = (u8*)malloc(322*242*4); memset(delta, 255, 322*242*4); } - + emulating = 1; renderedFrames = 0; - + if(!soundOffFlag) soundInit(); - + autoFrameSkipLastTime = throttleLastTime = systemGetClock(); - + SDL_WM_SetCaption("VBA", NULL); - + while(emulating) { sdlPollEvents(); if(!paused && active) @@ -2205,18 +2205,18 @@ int main(int argc, char **argv) else SDL_Delay(500); } - + emulating = 0; //fprintf(stderr,"Shutting down\n"); systemDrawScreen(); soundShutdown(); - + if(gbRom != NULL || rom != NULL) { - + sdlWriteBattery(); emuCleanUp(); } - + if(delta) { free(delta); delta = NULL; @@ -2229,10 +2229,10 @@ void systemMessage(int num, const char *msg, ...) { char buffer[SYSMSG_BUFFER_SIZE*2]; va_list valist; - + va_start(valist, msg); vsprintf(buffer, msg, valist); - + fprintf(stderr, "%s\n", buffer); va_end(valist); } @@ -2240,14 +2240,14 @@ void systemMessage(int num, const char *msg, ...) void systemDrawScreen() { renderedFrames++; - + if(yuv) { Draw_Overlay(surface, sizeOption+1); return; } - + SDL_LockSurface(surface); - + if(screenMessage) { if(cartridgeType == 1 && gbBorderOn) { gbSgbRenderBorder(); @@ -2255,19 +2255,19 @@ void systemDrawScreen() if(((systemGetClock() - screenMessageTime) < 3000) && !disableStatusMessages) { drawText(pix, srcPitch, 10, srcHeight - 20, - screenMessageBuffer); + screenMessageBuffer); } else { screenMessage = false; } } - + if(ifbFunction) { if(systemColorDepth == 16) ifbFunction(pix+destWidth+4, destWidth+4, srcWidth, srcHeight); else ifbFunction(pix+destWidth*2+4, destWidth*2+4, srcWidth, srcHeight); } - + if(filterFunction) { if(systemColorDepth == 16) filterFunction(pix+destWidth+4,destWidth+4, delta, @@ -2303,7 +2303,7 @@ void systemDrawScreen() break; case 1: for(i = 0; i < srcHeight; i++) { - SDL_CALL_STRETCHER; + SDL_CALL_STRETCHER; dest += destPitch; SDL_CALL_STRETCHER; src += srcPitch; @@ -2336,7 +2336,7 @@ void systemDrawScreen() break; } } - + if(showSpeed && fullscreen) { char buffer[50]; if(showSpeed == 1) @@ -2356,9 +2356,9 @@ void systemDrawScreen() surface->pitch, 10, surface->h-20, - buffer); - } - + buffer); + } + SDL_UnlockSurface(surface); // SDL_UpdateRect(surface, 0, 0, destWidth, destHeight); SDL_Flip(surface); @@ -2373,9 +2373,9 @@ u32 systemReadJoypad(int which) { if(which < 0 || which > 3) which = sdlDefaultJoypad; - + u32 res = 0; - + if(sdlButtons[which][KEY_BUTTON_A]) res |= 1; if(sdlButtons[which][KEY_BUTTON_B]) @@ -2396,25 +2396,25 @@ u32 systemReadJoypad(int which) res |= 256; if(sdlButtons[which][KEY_BUTTON_L]) res |= 512; - + // disallow L+R or U+D of being pressed at the same time if((res & 48) == 48) res &= ~16; if((res & 192) == 192) res &= ~128; - + if(sdlButtons[which][KEY_BUTTON_SPEED]) res |= 1024; if(sdlButtons[which][KEY_BUTTON_CAPTURE]) res |= 2048; - + if(autoFire) { res &= (~autoFire); if(autoFireToggle) res |= autoFire; autoFireToggle = !autoFireToggle; } - + return res; } @@ -2426,10 +2426,10 @@ void systemSetTitle(const char *title) void systemShowSpeed(int speed) { systemSpeed = speed; - + showRenderedFrames = renderedFrames; - renderedFrames = 0; - + renderedFrames = 0; + if(!fullscreen && showSpeed) { char buffer[80]; if(showSpeed == 1) @@ -2438,7 +2438,7 @@ void systemShowSpeed(int speed) sprintf(buffer, "VisualBoyAdvance-%3d%%(%d, %d fps)", systemSpeed, systemFrameSkip, showRenderedFrames); - + systemSetTitle(buffer); } } @@ -2449,17 +2449,17 @@ void systemFrame() void system10Frames(int rate) { - u32 time = systemGetClock(); + u32 time = systemGetClock(); if(!wasPaused && autoFrameSkip && !throttle) { u32 diff = time - autoFrameSkipLastTime; int speed = 100; - + if(diff) speed = (1000000/rate)/diff; - + if(speed >= 98) { frameskipadjust++; - + if(frameskipadjust >= 3) { frameskipadjust=0; if(systemFrameSkip > 0) @@ -2470,21 +2470,21 @@ void system10Frames(int rate) frameskipadjust -= (90 - speed)/5; else if(systemFrameSkip < 9) frameskipadjust--; - + if(frameskipadjust <= -2) { frameskipadjust += 2; if(systemFrameSkip < 9) systemFrameSkip++; } - } + } } if(!wasPaused && throttle) { if(!speedup) { u32 diff = time - throttleLastTime; - + int target = (1000000/(rate*throttle)); int d = (target - diff); - + if(d > 0) { SDL_Delay(d); } @@ -2497,14 +2497,14 @@ void system10Frames(int rate) rewindCounter = 0; } } - + if(systemSaveUpdateCounter) { if(--systemSaveUpdateCounter <= SYSTEM_SAVE_NOT_UPDATED) { sdlWriteBattery(); systemSaveUpdateCounter = SYSTEM_SAVE_NOT_UPDATED; } } - + wasPaused = false; autoFrameSkipLastTime = time; } @@ -2512,13 +2512,13 @@ void system10Frames(int rate) void systemScreenCapture(int a) { char buffer[VBA_MAX_PATH_LEN]; - + if(captureFormat) { if(captureDir[0]) sprintf(buffer, "%s/%s%02d.bmp", captureDir, sdlGetFilename(filename), a); else sprintf(buffer, "%s%02d.bmp", filename, a); - + emulator.emuWriteBMP(buffer); } else { if(captureDir[0]) @@ -2527,7 +2527,7 @@ void systemScreenCapture(int a) sprintf(buffer, "%s%02d.png", filename, a); emulator.emuWritePNG(buffer); } - + systemScreenMessage("Screen capture"); } @@ -2535,23 +2535,23 @@ void soundCallback(void *,u8 *stream,int len) { if (!emulating || soundInShutdown) return; - + // Patch #1382692 by deathpudding. /* since this is running in a different thread, speedup and * throttle can change at any time; save the value so locks * stay in sync */ bool lock = (!speedup && !throttle) ? true : false; - + if (lock) SDL_SemWait (sdlBufferFull); - + SDL_SemWait (sdlBufferLock); memcpy (stream, sdlBuffer, len); sdlSoundLen = 0; SDL_SemPost (sdlBufferLock); - + if (lock) - SDL_SemPost (sdlBufferEmpty); + SDL_SemPost (sdlBufferEmpty); } void systemWriteDataToSoundBuffer() @@ -2559,26 +2559,26 @@ void systemWriteDataToSoundBuffer() // Patch #1382692 by deathpudding. if (SDL_GetAudioStatus () != SDL_AUDIO_PLAYING) SDL_PauseAudio (0); - + if ((sdlSoundLen + soundBufferLen) >= 2048*2) { bool lock = (!speedup && !throttle) ? true : false; - + if (lock) SDL_SemWait (sdlBufferEmpty); - + SDL_SemWait (sdlBufferLock); int copied = 2048*2 - sdlSoundLen; memcpy (sdlBuffer + sdlSoundLen, soundFinalWave, copied); sdlSoundLen = 2048*2; SDL_SemPost (sdlBufferLock); - + if (lock) { SDL_SemPost (sdlBufferFull); - + /* wait for buffer to be dumped by soundCallback() */ SDL_SemWait (sdlBufferEmpty); SDL_SemPost (sdlBufferEmpty); - + SDL_SemWait (sdlBufferLock); memcpy (sdlBuffer, ((u8 *)soundFinalWave) + copied, soundBufferLen - copied); @@ -2603,7 +2603,7 @@ bool systemSoundInit() { SDL_AudioSpec audio; soundInShutdown = NO; - + switch(soundQuality) { case 1: audio.freq = 44100; @@ -2641,12 +2641,12 @@ void systemSoundShutdown() { // Patch #1382692 by deathpudding. psoundTickfn(); - + // Make sure that all waiters exit. soundInShutdown = YES; - + SDL_SemPost(sdlBufferFull); - SDL_CloseAudio (); + SDL_CloseAudio (); SDL_DestroySemaphore (sdlBufferLock); SDL_DestroySemaphore (sdlBufferFull); SDL_DestroySemaphore (sdlBufferEmpty); @@ -2697,7 +2697,7 @@ void systemUpdateMotionSensor() if(sensorX > 2047) sensorX = 2047; } - + if(sdlMotionButtons[KEY_UP]) { sensorY += 3; if(sensorY > 2197) @@ -2718,7 +2718,7 @@ void systemUpdateMotionSensor() sensorY += 2; if(sensorY > 2047) sensorY = 2047; - } + } } int systemGetSensorX() @@ -2743,7 +2743,7 @@ void systemScreenMessage(const char *msg) strncpy(screenMessageBuffer, msg, 20); screenMessageBuffer[20] = 0; } else - strcpy(screenMessageBuffer, msg); + strcpy(screenMessageBuffer, msg); } bool systemCanChangeSoundQuality() @@ -2769,7 +2769,7 @@ bool systemPauseOnFrame() void Init_Overlay(SDL_Surface *gbascreen, int overlaytype) { - + overlay = SDL_CreateYUVOverlay( GBA_WIDTH, GBA_HEIGHT, overlaytype, gbascreen); @@ -2786,7 +2786,7 @@ void Init_Overlay(SDL_Surface *gbascreen, int overlaytype) void Quit_Overlay(void) { - + SDL_FreeYUVOverlay(overlay); } @@ -2805,16 +2805,16 @@ inline void ConvertRGBtoYV12(SDL_Overlay *o) int x,y; int yuv[3]; Uint8 *p,*op[3]; - + SDL_LockYUVOverlay(o); - + /* Black initialization */ /* memset(o->pixels[0],0,o->pitches[0]*o->h); memset(o->pixels[1],128,o->pitches[1]*((o->h+1)/2)); memset(o->pixels[2],128,o->pitches[2]*((o->h+1)/2)); */ - + /* Convert */ for(y=0; y<160 && yh; y++) { p=(Uint8 *)pix+srcPitch*y; @@ -2831,7 +2831,7 @@ inline void ConvertRGBtoYV12(SDL_Overlay *o) p+=4;//s->format->BytesPerPixel; } } - + SDL_UnlockYUVOverlay(o); } @@ -2840,16 +2840,16 @@ inline void ConvertRGBtoIYUV(SDL_Overlay *o) int x,y; int yuv[3]; Uint8 *p,*op[3]; - + SDL_LockYUVOverlay(o); - + /* Black initialization */ /* memset(o->pixels[0],0,o->pitches[0]*o->h); memset(o->pixels[1],128,o->pitches[1]*((o->h+1)/2)); memset(o->pixels[2],128,o->pitches[2]*((o->h+1)/2)); */ - + /* Convert */ for(y=0; y<160 && yh; y++) { p=(Uint8 *)pix+srcPitch*y; @@ -2866,7 +2866,7 @@ inline void ConvertRGBtoIYUV(SDL_Overlay *o) p+=4; //s->format->BytesPerPixel; } } - + SDL_UnlockYUVOverlay(o); } @@ -2875,9 +2875,9 @@ inline void ConvertRGBtoUYVY(SDL_Overlay *o) int x,y; int yuv[3]; Uint8 *p,*op; - + SDL_LockYUVOverlay(o); - + for(y=0; y<160 && yh; y++) { p=(Uint8 *)pix+srcPitch*y; op=o->pixels[0]+o->pitches[0]*y; @@ -2889,11 +2889,11 @@ inline void ConvertRGBtoUYVY(SDL_Overlay *o) *(op++)=yuv[2]; } else *(op++)=yuv[0]; - + p+=4; //s->format->BytesPerPixel; } } - + SDL_UnlockYUVOverlay(o); } @@ -2902,9 +2902,9 @@ inline void ConvertRGBtoYVYU(SDL_Overlay *o) int x,y; int yuv[3]; Uint8 *p,*op; - + SDL_LockYUVOverlay(o); - + for(y=0; y<160 && yh; y++) { p=(Uint8 *)pix+srcPitch*y; op=o->pixels[0]+o->pitches[0]*y; @@ -2918,11 +2918,11 @@ inline void ConvertRGBtoYVYU(SDL_Overlay *o) *op=yuv[0]; op+=2; } - + p+=4; //s->format->BytesPerPixel; } } - + SDL_UnlockYUVOverlay(o); } @@ -2931,9 +2931,9 @@ inline void ConvertRGBtoYUY2(SDL_Overlay *o) int x,y; int yuv[3]; Uint8 *p,*op; - + SDL_LockYUVOverlay(o); - + for(y=0; y<160 && yh; y++) { p=(Uint8 *)pix+srcPitch*y; op=o->pixels[0]+o->pitches[0]*y; @@ -2947,11 +2947,11 @@ inline void ConvertRGBtoYUY2(SDL_Overlay *o) *op=yuv[0]; op+=2; } - + p+=4; //s->format->BytesPerPixel; } } - + SDL_UnlockYUVOverlay(o); } @@ -2978,21 +2978,21 @@ inline void Convert32bit(SDL_Surface *display) exit(1); break; } - + } inline void Draw_Overlay(SDL_Surface *display, int size) { SDL_LockYUVOverlay(overlay); - + Convert32bit(display); - + overlay_rect.x = 0; overlay_rect.y = 0; overlay_rect.w = GBA_WIDTH * size; overlay_rect.h = GBA_HEIGHT * size; - + SDL_DisplayYUVOverlay(overlay, &overlay_rect); SDL_UnlockYUVOverlay(overlay); } @@ -3004,13 +3004,13 @@ void systemGbBorderOn() gbBorderLineSkip = 256; gbBorderColumnSkip = 48; gbBorderRowSkip = 40; - + destWidth = (sizeOption+1)*srcWidth; destHeight = (sizeOption+1)*srcHeight; - + surface = SDL_SetVideoMode(destWidth, destHeight, 16, SDL_ANYFORMAT|SDL_HWSURFACE|SDL_DOUBLEBUF| - (fullscreen ? SDL_FULLSCREEN : 0)); + (fullscreen ? SDL_FULLSCREEN : 0)); #ifndef C_CORE sdlMakeStretcher(srcWidth); #else @@ -3029,26 +3029,26 @@ void systemGbBorderOn() exit(-1); } #endif - + if(systemColorDepth == 16) { if(sdlCalculateMaskWidth(surface->format->Gmask) == 6) { Init_2xSaI(565); RGB_LOW_BITS_MASK = 0x821; } else { Init_2xSaI(555); - RGB_LOW_BITS_MASK = 0x421; + RGB_LOW_BITS_MASK = 0x421; } if(cartridgeType == 2) { for(int i = 0; i < 0x10000; i++) { systemColorMap16[i] = (((i >> 1) & 0x1f) << systemBlueShift) | (((i & 0x7c0) >> 6) << systemGreenShift) | - (((i & 0xf800) >> 11) << systemRedShift); - } + (((i & 0xf800) >> 11) << systemRedShift); + } } else { for(int i = 0; i < 0x10000; i++) { systemColorMap16[i] = ((i & 0x1f) << systemRedShift) | (((i & 0x3e0) >> 5) << systemGreenShift) | - (((i & 0x7c00) >> 10) << systemBlueShift); + (((i & 0x7c00) >> 10) << systemBlueShift); } } srcPitch = srcWidth * 2+4; @@ -3062,7 +3062,7 @@ void systemGbBorderOn() for(int i = 0; i < 0x10000; i++) { systemColorMap32[i] = ((i & 0x1f) << systemRedShift) | (((i & 0x3e0) >> 5) << systemGreenShift) | - (((i & 0x7c00) >> 10) << systemBlueShift); + (((i & 0x7c00) >> 10) << systemBlueShift); } if(systemColorDepth == 32) srcPitch = srcWidth*4 + 4; @@ -3109,6 +3109,6 @@ void sdlToggleFullscreen() { { paused = 0; SDL_PauseAudio(0); - } + } } diff --git a/src/macosx/cart.icns b/src/macosx/cart.icns index 73bd1c2a..f3c9cba1 100755 Binary files a/src/macosx/cart.icns and b/src/macosx/cart.icns differ diff --git a/src/macosx/openfile.mm b/src/macosx/openfile.mm index 5f406a48..a8ba2b5c 100755 --- a/src/macosx/openfile.mm +++ b/src/macosx/openfile.mm @@ -5,11 +5,11 @@ int openBiosFile( char * r ) NSOpenPanel *oPanel = [NSOpenPanel openPanel]; int result; NSArray *filesToOpen; - + [oPanel setAllowsMultipleSelection:NO]; [oPanel setTitle:@"Open Bios File..."]; result = [oPanel runModalForDirectory:nil file:nil types:nil]; - if (result == NSOKButton) + if (result == NSOKButton) { filesToOpen = [oPanel filenames]; NSString *aFile = [filesToOpen objectAtIndex:0]; @@ -25,11 +25,11 @@ int openFile( char * r ) NSOpenPanel *oPanel = [NSOpenPanel openPanel]; int result; NSArray *filesToOpen; - + [oPanel setAllowsMultipleSelection:NO]; [oPanel setTitle:@"Open Rom..."]; result = [oPanel runModalForDirectory:nil file:nil types:nil]; - if (result == NSOKButton) + if (result == NSOKButton) { filesToOpen = [oPanel filenames]; NSString *aFile = [filesToOpen objectAtIndex:0]; @@ -37,4 +37,4 @@ int openFile( char * r ) return 1; } return 0; -} \ No newline at end of file +} diff --git a/src/sdl/SDL.cpp b/src/sdl/SDL.cpp index 731f0a87..87f8a127 100644 --- a/src/sdl/SDL.cpp +++ b/src/sdl/SDL.cpp @@ -89,6 +89,10 @@ extern void hq2x(u8*,u32,u8*,u8*,u32,int,int); extern void hq2x32(u8*,u32,u8*,u8*,u32,int,int); extern void lq2x(u8*,u32,u8*,u8*,u32,int,int); extern void lq2x32(u8*,u32,u8*,u8*,u32,int,int); +extern void hq3x16(u8*,u32,u8*,u8*,u32,int,int); +extern void hq3x32(u8*,u32,u8*,u8*,u32,int,int); +extern void hq4x16(u8*,u32,u8*,u8*,u32,int,int); +extern void hq4x32(u8*,u32,u8*,u8*,u32,int,int); extern void SmartIB(u8*,u32,int,int); extern void SmartIB32(u8*,u32,int,int); @@ -154,6 +158,8 @@ int sensorY = 2047; int filter = 0; u8 *delta = NULL; +int filter_enlarge = 2; + int sdlPrintUsage = 0; int disableMMX = 0; @@ -327,6 +333,8 @@ struct option sdlOptions[] = { { "filter-scanlines", no_argument, &filter, 11 }, { "filter-hq2x", no_argument, &filter, 12 }, { "filter-lq2x", no_argument, &filter, 13 }, + { "filter-hq3x", no_argument, &filter, 14 }, + { "filter-hq4x", no_argument, &filter, 15 }, { "flash-size", required_argument, 0, 'S' }, { "flash-64k", no_argument, &sdlFlashSize, 0 }, { "flash-128k", no_argument, &sdlFlashSize, 1 }, @@ -1114,7 +1122,7 @@ void sdlReadPreferences(FILE *f) strcpy(biosFileName, value); } else if(!strcmp(key, "filter")) { filter = sdlFromHex(value); - if(filter < 0 || filter > 13) + if(filter < 0 || filter > 15) filter = 0; } else if(!strcmp(key, "disableStatus")) { disableStatusMessages = sdlFromHex(value) ? true : false; @@ -1899,6 +1907,8 @@ Options:\n\ --filter-scanlines 11 - Scanlines\n\ --filter-hq2x 12 - hq2x\n\ --filter-lq2x 13 - lq2x\n\ + --filter-hq3x 14 - hq3x\n\ + --filter-hq4x 15 - hq4x\n\ -h, --help Print this help\n\ -i, --ips=PATCH Apply given IPS patch\n\ -p, --profile=[HERTZ] Enable profiling\n\ @@ -2178,8 +2188,14 @@ int main(int argc, char **argv) } } + switch (filter) + { + case 14: filter_enlarge = 3; break; + case 15: filter_enlarge = 4; break; + } + if(filter) { - sizeOption = 1; + sizeOption = filter_enlarge-1; } for(int i = 0; i < 24;) { @@ -2467,6 +2483,12 @@ int main(int argc, char **argv) case 13: filterFunction = lq2x; break; + case 14: + filterFunction = hq3x16; + break; + case 15: + filterFunction = hq4x16; + break; default: filterFunction = NULL; break; @@ -2515,6 +2537,12 @@ int main(int argc, char **argv) case 13: filterFunction = lq2x32; break; + case 14: + filterFunction = hq3x32; + break; + case 15: + filterFunction = hq4x32; + break; default: filterFunction = NULL; break; @@ -2669,19 +2697,21 @@ void systemDrawScreen() } if(filterFunction) { - if(systemColorDepth == 16) + if(systemColorDepth == 16) { filterFunction(pix+destWidth+4,destWidth+4, delta, (u8*)surface->pixels,surface->pitch, srcWidth, srcHeight); - else - filterFunction(pix+destWidth*2+4, - destWidth*2+4, + } else { + unsigned int destw = destWidth*(filter_enlarge == 2 ? 2 : 1)+4; + filterFunction(pix+destw, + destw, delta, (u8*)surface->pixels, surface->pitch, srcWidth, srcHeight); + } } else { int destPitch = surface->pitch; u8 *src = pix; diff --git a/src/win32/DirectDraw.cpp.orig b/src/win32/DirectDraw.cpp.orig index d359053b..6bd87567 100644 --- a/src/win32/DirectDraw.cpp.orig +++ b/src/win32/DirectDraw.cpp.orig @@ -70,7 +70,7 @@ public: virtual bool changeRenderSize(int w, int h); virtual DISPLAY_TYPE getType() { return DIRECT_DRAW; }; virtual void setOption(const char *, int) {} - virtual int selectFullScreenMode(GUID **); + virtual int selectFullScreenMode(GUID **); }; static HRESULT WINAPI checkModesAvailable(LPDDSURFACEDESC2 surf, LPVOID lpContext) @@ -99,10 +99,10 @@ static int ffs(UINT mask) if (mask) { while (!(mask & (1 << m))) m++; - + return (m); } - + return (0); } @@ -141,12 +141,12 @@ void DirectDrawDisplay::cleanup() ddsOffscreen->Release(); ddsOffscreen = NULL; } - + if(ddsPrimary != NULL) { ddsPrimary->Release(); ddsPrimary = NULL; } - + pDirectDraw->Release(); pDirectDraw = NULL; } @@ -215,7 +215,7 @@ bool DirectDrawDisplay::initialize() DWORD style = WS_POPUP | WS_VISIBLE; DWORD styleEx = 0; - + if(theApp.videoOption <= VIDEO_4X) style |= WS_OVERLAPPEDWINDOW; else @@ -224,7 +224,7 @@ bool DirectDrawDisplay::initialize() if(theApp.videoOption <= VIDEO_4X) AdjustWindowRectEx(&theApp.dest, style, TRUE, styleEx); else - AdjustWindowRectEx(&theApp.dest, style, FALSE, styleEx); + AdjustWindowRectEx(&theApp.dest, style, FALSE, styleEx); int winSizeX = theApp.dest.right-theApp.dest.left; int winSizeY = theApp.dest.bottom-theApp.dest.top; @@ -248,17 +248,17 @@ bool DirectDrawDisplay::initialize() x,y,winSizeX,winSizeY, NULL, 0); - + if (!(HWND)*pWnd) { winlog("Error creating Window %08x\n", GetLastError()); return FALSE; } - + theApp.updateMenuBar(); - + theApp.adjustDestRect(); - + GUID *guid = NULL; if(theApp.ddrawEmulationOnly) guid = (GUID *)DDCREATE_EMULATIONONLY; @@ -267,8 +267,8 @@ bool DirectDrawDisplay::initialize() guid = theApp.pVideoDriverGUID; ddrawDLL = LoadLibrary("DDRAW.DLL"); - HRESULT (WINAPI *DDrawCreateEx)(GUID *,LPVOID *,REFIID,IUnknown *); - if(ddrawDLL != NULL) { + HRESULT (WINAPI *DDrawCreateEx)(GUID *,LPVOID *,REFIID,IUnknown *); + if(ddrawDLL != NULL) { DDrawCreateEx = (HRESULT (WINAPI *)(GUID *,LPVOID *,REFIID,IUnknown *)) GetProcAddress(ddrawDLL, "DirectDrawCreateEx"); @@ -282,12 +282,12 @@ bool DirectDrawDisplay::initialize() } theApp.ddrawUsingEmulationOnly = theApp.ddrawEmulationOnly; - + HRESULT hret = DDrawCreateEx(guid, (void **)&pDirectDraw, IID_IDirectDraw7, NULL); - + if(hret != DD_OK) { winlog("Error creating DirectDraw object %08x\n", hret); if(theApp.ddrawEmulationOnly) { @@ -314,14 +314,14 @@ bool DirectDrawDisplay::initialize() for(i = 0; i < (int)hel.dwSize; i+=4) winlog("HEL CAPS %2d: %08x\n", i>>2, *p++); } - + theApp.mode320Available = false; theApp.mode640Available = false; theApp.mode800Available = false; // check for available fullscreen modes pDirectDraw->EnumDisplayModes(DDEDM_STANDARDVGAMODES, NULL, NULL, checkModesAvailable); - + DWORD flags = DDSCL_NORMAL; if(theApp.videoOption >= VIDEO_320x240) @@ -329,16 +329,16 @@ bool DirectDrawDisplay::initialize() DDSCL_ALLOWREBOOT | DDSCL_EXCLUSIVE | DDSCL_FULLSCREEN; - - hret = pDirectDraw->SetCooperativeLevel(pWnd->m_hWnd, + + hret = pDirectDraw->SetCooperativeLevel(pWnd->m_hWnd, flags); if(hret != DD_OK) { - winlog("Error SetCooperativeLevel %08x\n", hret); + winlog("Error SetCooperativeLevel %08x\n", hret); // errorMessage(myLoadString(IDS_ERROR_DISP_DRAWLEVEL), hret); return FALSE; } - + if(theApp.videoOption > VIDEO_4X) { hret = pDirectDraw->SetDisplayMode(theApp.fsWidth, theApp.fsHeight, @@ -351,7 +351,7 @@ bool DirectDrawDisplay::initialize() return FALSE; } } - + DDSURFACEDESC2 ddsd; ZeroMemory(&ddsd,sizeof(ddsd)); ddsd.dwSize = sizeof(ddsd); @@ -365,10 +365,10 @@ bool DirectDrawDisplay::initialize() ddsd.dwBackBufferCount = 2; } } - + hret = pDirectDraw->CreateSurface(&ddsd, &ddsPrimary, NULL); if(hret != DD_OK) { - winlog("Error primary CreateSurface %08x\n", hret); + winlog("Error primary CreateSurface %08x\n", hret); // errorMessage(myLoadString(IDS_ERROR_DISP_DRAWSURFACE), hret); return FALSE; } @@ -391,7 +391,7 @@ bool DirectDrawDisplay::initialize() // the second is the backbuffer and the third is the flip // surface caps.dwCaps = DDSCAPS_BACKBUFFER; - + hret = ddsPrimary->GetAttachedSurface(&caps, &ddsFlip); if(hret != DD_OK) { winlog("Failed to get attached surface %08x", hret); @@ -446,8 +446,8 @@ bool DirectDrawDisplay::initialize() return false; pWnd->DragAcceptFiles(TRUE); - - return true; + + return true; } bool DirectDrawDisplay::changeRenderSize(int w, int h) @@ -468,7 +468,7 @@ bool DirectDrawDisplay::changeRenderSize(int w, int h) bool DirectDrawDisplay::initializeOffscreen(int w, int h) { DDSURFACEDESC2 ddsd; - + ZeroMemory(&ddsd, sizeof(ddsd)); ddsd.dwSize = sizeof(ddsd); ddsd.dwFlags = DDSD_CAPS | DDSD_HEIGHT | DDSD_WIDTH; @@ -481,10 +481,10 @@ bool DirectDrawDisplay::initializeOffscreen(int w, int h) HRESULT hret = pDirectDraw->CreateSurface(&ddsd, &ddsOffscreen, NULL); if(hret != DD_OK) { - winlog("Error offscreen CreateSurface %08x\n", hret); + winlog("Error offscreen CreateSurface %08x\n", hret); if(theApp.ddrawUseVideoMemory) { regSetDwordValue("ddrawUseVideoMemory", 0); - } + } // errorMessage(myLoadString(IDS_ERROR_DISP_DRAWSURFACE2), hret); return false; } @@ -499,7 +499,7 @@ bool DirectDrawDisplay::initializeOffscreen(int w, int h) winlog("Offscreen CAPS 3: %08x\n", caps.dwCaps3); winlog("Offscreen CAPS 4: %08x\n", caps.dwCaps4); } - + DDPIXELFORMAT px; px.dwSize = sizeof(px); @@ -512,7 +512,7 @@ bool DirectDrawDisplay::initializeOffscreen(int w, int h) winlog("Pixel format %d %08x\n", ii, pdword[ii]); } } - + switch(px.dwRGBBitCount) { case 15: case 16: @@ -534,7 +534,7 @@ bool DirectDrawDisplay::initializeOffscreen(int w, int h) winlog("G Mask: %08x\n", px.dwGBitMask); winlog("B Mask: %08x\n", px.dwBBitMask); } - + systemRedShift = ffs(px.dwRBitMask); systemGreenShift = ffs(px.dwGBitMask); systemBlueShift = ffs(px.dwBBitMask); @@ -545,7 +545,7 @@ bool DirectDrawDisplay::initializeOffscreen(int w, int h) else cpu_mmx = 0; #endif - + if((px.dwFlags&DDPF_RGB) != 0 && px.dwRBitMask == 0xF800 && px.dwGBitMask == 0x07E0 && @@ -584,7 +584,7 @@ bool DirectDrawDisplay::initializeOffscreen(int w, int h) winlog("G shift: %d\n", systemGreenShift); winlog("B shift: %d\n", systemBlueShift); } - + utilUpdateSystemColorMaps(); width = w; height = h; @@ -605,7 +605,7 @@ void DirectDrawDisplay::clear() ddsFlip->Blt(NULL, NULL, NULL, DDBLT_COLORFILL | DDBLT_WAIT, &fx); ddsPrimary->Flip(NULL, 0); ddsFlip->Blt(NULL, NULL, NULL, DDBLT_COLORFILL | DDBLT_WAIT, &fx); - ddsPrimary->Flip(NULL, 0); + ddsPrimary->Flip(NULL, 0); } void DirectDrawDisplay::renderMenu() @@ -630,7 +630,7 @@ void DirectDrawDisplay::render() return; DDSURFACEDESC2 ddsDesc; - + ZeroMemory(&ddsDesc, sizeof(ddsDesc)); ddsDesc.dwSize = sizeof(ddsDesc); @@ -648,7 +648,7 @@ void DirectDrawDisplay::render() hret = ddsPrimary->Restore(); if(hret == DD_OK) { hret = ddsOffscreen->Restore(); - + if(hret == DD_OK) { hret = ddsOffscreen->Lock(NULL, &ddsDesc, @@ -658,11 +658,11 @@ void DirectDrawDisplay::render() #endif DDLOCK_SURFACEMEMORYPTR, NULL); - + } } } - + if(hret == DD_OK) { if(theApp.filterFunction) { if(systemColorDepth == 16) @@ -681,11 +681,11 @@ void DirectDrawDisplay::render() ddsDesc.lPitch, theApp.filterWidth, theApp.filterHeight); - + } else { int copyX = 240; int copyY = 160; - + if(theApp.cartridgeType == 1) { if(gbBorderOn) { copyX = 256; @@ -699,7 +699,7 @@ void DirectDrawDisplay::render() __asm { mov eax, copyX; mov ebx, copyY; - + mov esi, pix; mov edi, ddsDesc.lpSurface; mov edx, ddsDesc.lPitch; @@ -723,7 +723,7 @@ void DirectDrawDisplay::render() gbaOtherColor: cmp systemColorDepth, 32; jnz gbaOtherColor2; - + sub edx, eax; sub edx, eax; sub edx, eax; @@ -769,7 +769,7 @@ void DirectDrawDisplay::render() ddsDesc.lPitch, theApp.rect.left+10, theApp.rect.bottom-10, - buffer); + buffer); } } else if(theApp.ddrawDebug) winlog("Error during lock: %08x\n", hret); @@ -798,10 +798,10 @@ void DirectDrawDisplay::render() } } else { hret = ddsPrimary->Blt(&theApp.dest, ddsOffscreen, NULL,DDBLT_ASYNC,NULL); - + if(hret == DDERR_SURFACELOST) { hret = ddsPrimary->Restore(); - + if(hret == DD_OK) { hret = ddsPrimary->Blt(&theApp.dest, ddsOffscreen, NULL, DDBLT_ASYNC, NULL); } @@ -818,7 +818,7 @@ void DirectDrawDisplay::render() HDC hdc; ddsPrimary->GetDC(&hdc); SetTextColor(hdc, RGB(255,0,0)); - SetBkMode(hdc,TRANSPARENT); + SetBkMode(hdc,TRANSPARENT); TextOut(hdc, theApp.dest.left+10, theApp.dest.bottom - 20, theApp.screenMessageBuffer, strlen(theApp.screenMessageBuffer)); ddsPrimary->ReleaseDC(hdc); @@ -826,11 +826,11 @@ void DirectDrawDisplay::render() theApp.screenMessage = false; } } - + if(hret != DD_OK) { if(theApp.ddrawDebug) winlog("Error on update screen: %08x\n", hret); - } + } } int DirectDrawDisplay::selectFullScreenMode(GUID **pGUID) diff --git a/src/win32/DirectInput.cpp.orig b/src/win32/DirectInput.cpp.orig index de6c3b29..e7fbbab5 100644 --- a/src/win32/DirectInput.cpp.orig +++ b/src/win32/DirectInput.cpp.orig @@ -96,7 +96,7 @@ USHORT joypad[4][13] = { }, { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, - { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 } + { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 } }; USHORT motion[4] = { @@ -140,7 +140,7 @@ void winReadKeys() joypad[i][KEY_BUTTON_L] = key; key = winReadKey("R", i); if(key != -1) - joypad[i][KEY_BUTTON_R] = key; + joypad[i][KEY_BUTTON_R] = key; key = winReadKey("Start", i); if(key != -1) joypad[i][KEY_BUTTON_START] = key; @@ -188,16 +188,16 @@ void winSaveKeys() winSaveKey("Up", i, joypad[i][KEY_UP]); winSaveKey("Speed", i, joypad[i][KEY_BUTTON_SPEED]); winSaveKey("Capture", i, joypad[i][KEY_BUTTON_CAPTURE]); - winSaveKey("GS", i, joypad[i][KEY_BUTTON_GS]); + winSaveKey("GS", i, joypad[i][KEY_BUTTON_GS]); winSaveKey("Down", i, joypad[i][KEY_DOWN]); winSaveKey("A", i, joypad[i][KEY_BUTTON_A]); winSaveKey("B", i, joypad[i][KEY_BUTTON_B]); winSaveKey("L", i, joypad[i][KEY_BUTTON_L]); - winSaveKey("R", i, joypad[i][KEY_BUTTON_R]); + winSaveKey("R", i, joypad[i][KEY_BUTTON_R]); winSaveKey("Start", i, joypad[i][KEY_BUTTON_START]); winSaveKey("Select", i, joypad[i][KEY_BUTTON_SELECT]); } - regSetDwordValue("joyVersion", 1); + regSetDwordValue("joyVersion", 1); regSetDwordValue("Motion_Left", motion[KEY_LEFT]); @@ -212,10 +212,10 @@ void winSaveKeys() static BOOL CALLBACK EnumAxesCallback( const DIDEVICEOBJECTINSTANCE* pdidoi, VOID* pContext ) { - DIPROPRANGE diprg; - diprg.diph.dwSize = sizeof(DIPROPRANGE); - diprg.diph.dwHeaderSize = sizeof(DIPROPHEADER); - diprg.diph.dwHow = DIPH_BYOFFSET; + DIPROPRANGE diprg; + diprg.diph.dwSize = sizeof(DIPROPRANGE); + diprg.diph.dwHeaderSize = sizeof(DIPROPHEADER); + diprg.diph.dwHow = DIPH_BYOFFSET; diprg.diph.dwObj = pdidoi->dwOfs; // Specify the enumerated axis diprg.lMin = -32768; @@ -239,7 +239,7 @@ static BOOL CALLBACK EnumAxesCallback( const DIDEVICEOBJECTINSTANCE* pdidoi, didz.dwData = 5000; currentDevice->device->SetProperty(DIPROP_DEADZONE, &didz.diph); - + LONG center = (diprg.lMin + diprg.lMax)/2; LONG threshold = (diprg.lMax - center)/2; @@ -257,31 +257,31 @@ static BOOL CALLBACK EnumAxesCallback( const DIDEVICEOBJECTINSTANCE* pdidoi, static BOOL CALLBACK EnumPovsCallback( const DIDEVICEOBJECTINSTANCE* pdidoi, VOID* pContext ) { - return DIENUM_CONTINUE; + return DIENUM_CONTINUE; } static BOOL CALLBACK DIEnumDevicesCallback(LPCDIDEVICEINSTANCE pInst, LPVOID lpvContext) { ZeroMemory(&pDevices[numDevices],sizeof(deviceInfo)); - + HRESULT hRet = pDirectInput->CreateDevice(pInst->guidInstance, &pDevices[numDevices].device, NULL); - + if(hRet != DI_OK) return DIENUM_STOP; - + DIDEVCAPS caps; caps.dwSize=sizeof(DIDEVCAPS); - + hRet = pDevices[numDevices].device->GetCapabilities(&caps); - + if(hRet == DI_OK) { if(caps.dwFlags & DIDC_POLLEDDATAFORMAT || caps.dwFlags & DIDC_POLLEDDEVICE) pDevices[numDevices].isPolled = TRUE; - + pDevices[numDevices].nButtons = caps.dwButtons; pDevices[numDevices].nAxes = caps.dwAxes; pDevices[numDevices].nPovs = caps.dwPOVs; @@ -299,10 +299,10 @@ static BOOL CALLBACK DIEnumDevicesCallback(LPCDIDEVICEINSTANCE pInst, winlog("******************************\n"); winlog("Joystick %2d name : %s\n", numDevices, pInst->tszProductName); } - + numDevices++; - + return DIENUM_CONTINUE; } @@ -310,7 +310,7 @@ BOOL CALLBACK DIEnumDevicesCallback2(LPCDIDEVICEINSTANCE pInst, LPVOID lpvContext) { numDevices++; - + return DIENUM_CONTINUE; } @@ -344,103 +344,103 @@ static void checkKeys() pDevices[dev].needed = 1; else joypad[i][KEY_LEFT] = DIK_LEFT; - + dev = joypad[i][KEY_RIGHT] >> 8; if(dev < numDevices && dev >= 0) pDevices[dev].needed = 1; else joypad[i][KEY_RIGHT] = DIK_RIGHT; - + dev = joypad[i][KEY_UP] >> 8; if(dev < numDevices && dev >= 0) pDevices[dev].needed = 1; else joypad[i][KEY_UP] = DIK_UP; - + dev = joypad[i][KEY_DOWN] >> 8; if(dev < numDevices && dev >= 0) pDevices[dev].needed = 1; else joypad[i][KEY_DOWN] = DIK_DOWN; - + dev = joypad[i][KEY_BUTTON_A] >> 8; if(dev < numDevices && dev >= 0) pDevices[dev].needed = 1; else joypad[i][KEY_BUTTON_A] = DIK_Z; - + dev = joypad[i][KEY_BUTTON_B] >> 8; if(dev < numDevices && dev >= 0) pDevices[dev].needed = 1; else joypad[i][KEY_BUTTON_B] = DIK_X; - + dev = joypad[i][KEY_BUTTON_L] >> 8; if(dev < numDevices && dev >= 0) pDevices[dev].needed = 1; else joypad[i][KEY_BUTTON_L] = DIK_A; - + dev = joypad[i][KEY_BUTTON_R] >> 8; if(dev < numDevices && dev >= 0) pDevices[dev].needed = 1; else joypad[i][KEY_BUTTON_R] = DIK_S; - + dev = joypad[i][KEY_BUTTON_START] >> 8; if(dev < numDevices && dev >= 0) pDevices[dev].needed = 1; else joypad[i][KEY_BUTTON_START] = DIK_RETURN; - + dev = joypad[i][KEY_BUTTON_SELECT] >> 8; if(dev < numDevices && dev >= 0) pDevices[dev].needed = 1; else joypad[i][KEY_BUTTON_SELECT] = DIK_BACK; - + dev = joypad[i][KEY_BUTTON_SPEED] >> 8; if(dev < numDevices && dev >= 0) pDevices[dev].needed = 1; else joypad[i][KEY_BUTTON_SPEED] = DIK_SPACE; - + dev = joypad[i][KEY_BUTTON_CAPTURE] >> 8; if(dev < numDevices && dev >= 0) pDevices[dev].needed = 1; else joypad[i][KEY_BUTTON_CAPTURE] = DIK_F12; - + dev = joypad[i][KEY_BUTTON_GS] >> 8; if(dev < numDevices && dev >= 0) pDevices[dev].needed = 1; else joypad[i][KEY_BUTTON_GS] = DIK_C; } - + dev = motion[KEY_UP] >> 8; if(dev < numDevices && dev >= 0) pDevices[dev].needed = 1; else - motion[KEY_UP] = DIK_NUMPAD8; + motion[KEY_UP] = DIK_NUMPAD8; dev = motion[KEY_DOWN] >> 8; if(dev < numDevices && dev >= 0) pDevices[dev].needed = 1; else - motion[KEY_DOWN] = DIK_NUMPAD2; + motion[KEY_DOWN] = DIK_NUMPAD2; dev = motion[KEY_LEFT] >> 8; if(dev < numDevices && dev >= 0) pDevices[dev].needed = 1; else - motion[KEY_LEFT] = DIK_NUMPAD4; + motion[KEY_LEFT] = DIK_NUMPAD4; dev = motion[KEY_RIGHT] >> 8; if(dev < numDevices && dev >= 0) pDevices[dev].needed = 1; else - motion[KEY_RIGHT] = DIK_NUMPAD6; + motion[KEY_RIGHT] = DIK_NUMPAD6; } #define KEYDOWN(buffer,key) (buffer[key] & 0x80) @@ -451,14 +451,14 @@ static bool readKeyboard() HRESULT hret = pDevices[0].device-> GetDeviceState(256, (LPVOID)pDevices[0].data); - + if(hret == DIERR_INPUTLOST || hret == DIERR_NOTACQUIRED) { hret = pDevices[0].device->Acquire(); if(hret != DI_OK) return false; hret = pDevices[0].device->GetDeviceState(256,(LPVOID)pDevices[0].data); } - + return hret == DI_OK; } return true; @@ -469,19 +469,19 @@ static bool readJoystick(int joy) if(pDevices[joy].needed) { if(pDevices[joy].isPolled) ((LPDIRECTINPUTDEVICE2)pDevices[joy].device)->Poll(); - + HRESULT hret = pDevices[joy].device-> GetDeviceState(sizeof(DIJOYSTATE), (LPVOID)&pDevices[joy].state); - + if(hret == DIERR_INPUTLOST || hret == DIERR_NOTACQUIRED) { hret = pDevices[joy].device->Acquire(); - + if(hret == DI_OK) { - + if(pDevices[joy].isPolled) ((LPDIRECTINPUTDEVICE2)pDevices[joy].device)->Poll(); - + hret = pDevices[joy].device-> GetDeviceState(sizeof(DIJOYSTATE), (LPVOID)&pDevices[joy].state); @@ -496,15 +496,15 @@ static bool readJoystick(int joy) static void checkKeyboard() { - HRESULT hret = pDevices[0].device->Acquire(); + HRESULT hret = pDevices[0].device->Acquire(); hret = pDevices[0].device-> GetDeviceState(256, (LPVOID)pDevices[0].data); - + if(hret == DIERR_INPUTLOST || hret == DIERR_NOTACQUIRED) { return; } - + if(hret == DI_OK) { for(int i = 0; i < 256; i++) { if(KEYDOWN(pDevices[0].data, i)) { @@ -526,14 +526,14 @@ static void checkJoypads() int i =0; DIJOYSTATE joystick; - + for(i = 1; i < numDevices; i++) { HRESULT hret = pDevices[i].device->Acquire(); - + if(pDevices[i].isPolled) ((LPDIRECTINPUTDEVICE2)pDevices[i].device)->Poll(); - + hret = pDevices[i].device->GetDeviceState(sizeof(joystick), &joystick); int j; @@ -543,14 +543,14 @@ static void checkJoypads() pDevices[i].first = FALSE; continue; } - + for(j = 0; j < pDevices[i].nButtons; j++) { - if(((pDevices[i].state.rgbButtons[j] ^ joystick.rgbButtons[j]) + if(((pDevices[i].state.rgbButtons[j] ^ joystick.rgbButtons[j]) & joystick.rgbButtons[j]) & 0x80) { HWND focus = GetFocus(); SendMessage(focus, JOYCONFIG_MESSAGE, i,j+128); - } + } } for(j = 0; j < pDevices[i].nAxes && j < 8; j++) { @@ -563,31 +563,31 @@ static void checkJoypads() break; case DIJOFS_Y: value = joystick.lY; - old = pDevices[i].state.lY; + old = pDevices[i].state.lY; break; case DIJOFS_Z: value = joystick.lZ; - old = pDevices[i].state.lZ; + old = pDevices[i].state.lZ; break; case DIJOFS_RX: value = joystick.lRx; - old = pDevices[i].state.lRx; + old = pDevices[i].state.lRx; break; case DIJOFS_RY: value = joystick.lRy; - old = pDevices[i].state.lRy; + old = pDevices[i].state.lRy; break; case DIJOFS_RZ: value = joystick.lRz; - old = pDevices[i].state.lRz; + old = pDevices[i].state.lRz; break; case DIJOFS_SLIDER(0): value = joystick.rglSlider[0]; - old = pDevices[i].state.rglSlider[0]; + old = pDevices[i].state.rglSlider[0]; break; case DIJOFS_SLIDER(1): value = joystick.rglSlider[1]; - old = pDevices[i].state.rglSlider[1]; + old = pDevices[i].state.rglSlider[1]; break; } if(value != old) { @@ -601,7 +601,7 @@ static void checkJoypads() for(j = 0;j < 4 && j < pDevices[i].nPovs; j++) { if(LOWORD(pDevices[i].state.rgdwPOV[j]) != LOWORD(joystick.rgdwPOV[j])) { int state = getPovState(joystick.rgdwPOV[j]); - + if(state & POV_UP) SendMessage(GetFocus(), JOYCONFIG_MESSAGE, i, (j<<2)+0x20); else if(state & POV_DOWN) @@ -622,7 +622,7 @@ BOOL checkKey(int key) int dev = (key >> 8); int k = (key & 255); - + if(dev == 0) { return KEYDOWN(pDevices[0].data,k); } else { @@ -706,7 +706,7 @@ DirectInput::~DirectInput() free(pDevices); pDevices = NULL; } - + pDirectInput->Release(); pDirectInput = NULL; } @@ -724,11 +724,11 @@ bool DirectInput::initialize() 0, "VBA.ini"); dinputDLL = LoadLibrary("DINPUT.DLL"); - HRESULT (WINAPI *DInputCreate)(HINSTANCE,DWORD,LPDIRECTINPUT *,IUnknown *); - if(dinputDLL != NULL) { + HRESULT (WINAPI *DInputCreate)(HINSTANCE,DWORD,LPDIRECTINPUT *,IUnknown *); + if(dinputDLL != NULL) { DInputCreate = (HRESULT (WINAPI *)(HINSTANCE,DWORD,LPDIRECTINPUT *,IUnknown *)) GetProcAddress(dinputDLL, "DirectInputCreateA"); - + if(DInputCreate == NULL) { directXMessage("DirectInputCreateA"); return false; @@ -737,7 +737,7 @@ bool DirectInput::initialize() directXMessage("DINPUT.DLL"); return false; } - + HRESULT hret = DInputCreate(AfxGetInstanceHandle(), DIRECTINPUT_VERSION, &pDirectInput, @@ -752,8 +752,8 @@ bool DirectInput::initialize() NULL, DIEDFL_ATTACHEDONLY); - - + + pDevices = (deviceInfo *)calloc(numDevices, sizeof(deviceInfo)); hret = pDirectInput->CreateDevice(GUID_SysKeyboard,&pDevices[0].device,NULL); @@ -765,23 +765,23 @@ bool DirectInput::initialize() return false; } - + numDevices = 1; hret = pDirectInput->EnumDevices(DIDEVTYPE_JOYSTICK, DIEnumDevicesCallback, NULL, - DIEDFL_ATTACHEDONLY); + DIEDFL_ATTACHEDONLY); // hret = pDevices[0].device->SetCooperativeLevel(hWindow, // DISCL_FOREGROUND| // DISCL_NONEXCLUSIVE); - + if(hret != DI_OK) { // errorMessage(myLoadString(IDS_ERROR_DISP_LEVEL), hret); return false; } - + hret = pDevices[0].device->SetDataFormat(&c_dfDIKeyboard); if(hret != DI_OK) { @@ -813,13 +813,13 @@ bool DirectInput::initialize() positive); } } - + currentDevice = NULL; } for(i = 0; i < numDevices; i++) pDevices[i].device->Acquire(); - + return true; } @@ -843,7 +843,7 @@ u32 DirectInput::readDevice(int which) int i = theApp.joypadDefault; if(which >= 0 && which <= 3) i = which; - + if(checkKey(joypad[i][KEY_BUTTON_A])) res |= 1; if(checkKey(joypad[i][KEY_BUTTON_B])) @@ -864,7 +864,7 @@ u32 DirectInput::readDevice(int which) res |= 256; if(checkKey(joypad[i][KEY_BUTTON_L])) res |= 512; - + if(checkKey(joypad[i][KEY_BUTTON_GS])) res |= 4096; @@ -916,9 +916,9 @@ CString DirectInput::getKeyName(int key) ZeroMemory(&di,sizeof(DIDEVICEOBJECTINSTANCE)); di.dwSize = sizeof(DIDEVICEOBJECTINSTANCE); - + CString winBuffer = winResLoadString(IDS_ERROR); - + if(d == 0) { pDevices[0].device->GetObjectInfo(&di,key,DIPH_BYOFFSET); winBuffer = di.tszName; @@ -1001,7 +1001,7 @@ void DirectInput::checkMotionKeys() if(theApp.sensorX > 2047) theApp.sensorX = 2047; } - + if(checkKey(motion[KEY_UP])) { theApp.sensorY += 3; if(theApp.sensorY > 2197) @@ -1022,7 +1022,7 @@ void DirectInput::checkMotionKeys() theApp.sensorY += 2; if(theApp.sensorY > 2047) theApp.sensorY = 2047; - } + } } Input *newDirectInput() diff --git a/src/win32/VBA.rc b/src/win32/VBA.rc index 060f6aa0..ff6abe5a 100644 --- a/src/win32/VBA.rc +++ b/src/win32/VBA.rc @@ -27,18 +27,18 @@ LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US // TEXTINCLUDE // -1 TEXTINCLUDE +1 TEXTINCLUDE BEGIN "resource.h\0" END -2 TEXTINCLUDE +2 TEXTINCLUDE BEGIN "#include ""afxres.h""\r\n" "#include ""resource2.h""\0" END -3 TEXTINCLUDE +3 TEXTINCLUDE BEGIN "#include ""vba.rc2""\0" END @@ -1123,7 +1123,7 @@ END // #ifdef APSTUDIO_INVOKED -GUIDELINES DESIGNINFO +GUIDELINES DESIGNINFO BEGIN IDD_OPENDLG, DIALOG BEGIN @@ -1474,7 +1474,7 @@ END // Menu // -IDR_MENU MENU +IDR_MENU MENU BEGIN POPUP "&File" BEGIN @@ -1884,7 +1884,7 @@ END // Accelerator // -IDR_ACCELERATOR ACCELERATORS +IDR_ACCELERATOR ACCELERATORS BEGIN "C", ID_CHEATS_SEARCHFORCHEATS, VIRTKEY, CONTROL, NOINVERT "N", ID_DEBUG_NEXTFRAME, VIRTKEY, CONTROL, NOINVERT @@ -1947,7 +1947,7 @@ END // String Table // -STRINGTABLE +STRINGTABLE BEGIN IDS_UNSUPPORTED_VBA_SGM "Unsupported VisualBoyAdvance save game version %d" IDS_CANNOT_LOAD_SGM "Cannot load save game for %s" @@ -1959,7 +1959,7 @@ BEGIN IDS_NO_IMAGE_ON_ZIP "No image found on ZIP file %s" IDS_ERROR_OPENING_IMAGE "Error opening image %s" IDS_ERROR_READING_IMAGE "Error reading image %s" - IDS_UNSUPPORTED_BIOS_FUNCTION + IDS_UNSUPPORTED_BIOS_FUNCTION "Unsupported BIOS function %02x called from %08x. A BIOS file is needed in order to get correct behaviour." IDS_INVALID_BIOS_FILE_SIZE "Invalid BIOS file size" IDS_INVALID_CHEAT_CODE "Invalid cheat code '%s'. Supported formats are:\nXXXXXXXX:YY, XXXXXXXX:YYYY, XXXXXXXX:YYYYYYYY." @@ -1967,7 +1967,7 @@ BEGIN IDS_UNKNOWN_THUMB_OPCODE "Unknown opcode %04x from %08x" END -STRINGTABLE +STRINGTABLE BEGIN IDS_ERROR_CREATING_FILE "Error creating file %s" IDS_FAILED_TO_READ_SGM "Battery file's size incompatible with the ROM settings %s (%d).\nWarning : save of the battery file is now disabled !" @@ -1987,11 +1987,11 @@ BEGIN IDS_UNSUPPORTED_CHEAT_LIST_VERSION "Unsupported cheat list version %d" END -STRINGTABLE +STRINGTABLE BEGIN IDS_DIRECTX_7_REQUIRED "DirectX 7.0 or greater is required to run.\nDownload at http://www.microsoft.com/directx.\n\nError found at: %s" IDS_DISABLING_VIDEO_MEMORY "Disabling Use Video Memory setting" - IDS_SETTING_WILL_BE_EFFECTIVE + IDS_SETTING_WILL_BE_EFFECTIVE "Setting will be effective the next time you start the emulator" IDS_DISABLING_EMULATION_ONLY "Disabling Emulation Only setting" IDS_FAILED_TO_OPEN_FILE "Failed to open file %s" @@ -2003,13 +2003,13 @@ BEGIN IDS_CANNOT_SETFORMAT_PRIMARY "Cannot SetFormat for primary %08x" IDS_CANNOT_CREATESOUNDBUFFER_SEC "Cannot CreateSoundBuffer secondary %08x" IDS_CANNOT_PLAY_PRIMARY "Cannot Play primary %08x" - IDS_SEARCH_PRODUCED_TOO_MANY + IDS_SEARCH_PRODUCED_TOO_MANY "Search produced %d results. Please refine better" IDS_NUMBER_CANNOT_BE_EMPTY "Number cannot be empty" IDS_INVALID_ADDRESS "Invalid address: %08x" END -STRINGTABLE +STRINGTABLE BEGIN IDS_MISALIGNED_HALFWORD "Misaligned half-word address: %08x" IDS_MISALIGNED_WORD "Misaligned word address: %08x" @@ -2029,7 +2029,7 @@ BEGIN IDS_SELECT_BATTERY_DIR "Select Battery directory:" END -STRINGTABLE +STRINGTABLE BEGIN IDS_SELECT_SAVE_DIR "Select Save Directory:" IDS_SELECT_CAPTURE_DIR "Select Capture directory:" @@ -2049,7 +2049,7 @@ BEGIN IDS_LOADED_STATE_N "Loaded state %d" END -STRINGTABLE +STRINGTABLE BEGIN IDS_WROTE_STATE "Wrote state" IDS_WROTE_STATE_N "Wrote state %d" @@ -2069,7 +2069,7 @@ BEGIN IDS_UNKNOWN "Unknown" END -STRINGTABLE +STRINGTABLE BEGIN IDS_NONE "None" IDS_FAILED_TO_LOAD_LIBRARY "Failed to load library %s" @@ -2089,11 +2089,11 @@ BEGIN IDS_SELECT_BATTERY_FILE "Select battery file" END -STRINGTABLE +STRINGTABLE BEGIN IDS_UNSUPPORTED_CHEAT_LIST_TYPE "Unsupported cheat list type %d" IDS_INVALID_GSA_CODE "Invalid GSA code. Format is XXXXXXXXYYYYYYYY." - IDS_CANNOT_IMPORT_SNAPSHOT_FOR + IDS_CANNOT_IMPORT_SNAPSHOT_FOR "Cannot import snapshot for %s. Current game is %s" IDS_UNSUPPORTED_SNAPSHOT_FILE "Unsupported snapshot file %s" IDS_UNSUPPORTED_ARM_MODE "Unsupported ARM mode %02x" @@ -2104,7 +2104,7 @@ BEGIN IDS_OUT_OF_MEMORY "Failed to allocate memory for %s" END -STRINGTABLE +STRINGTABLE BEGIN IDS_FILTER_GBS "Gameboy Snapshot_*.GBS__" IDS_FILTER_GCF "Gameshark Code File_*.GCF__" @@ -2124,7 +2124,7 @@ BEGIN IDS_ERROR_LISTENING "Error listening on socket." END -STRINGTABLE +STRINGTABLE BEGIN IDS_ERROR_CREATING_SOCKET "Error creating socket." IDS_ACK_NOT_RECEIVED "ACK not received from GDB." @@ -2134,7 +2134,7 @@ BEGIN IDS_SELECT_DUMP_FILE "Select dump file name" IDS_FILTER_AVI "AVI File_*.AVI__" IDS_SELECT_AVI_NAME "Select AVI file name" - IDS_INVALID_THROTTLE_VALUE + IDS_INVALID_THROTTLE_VALUE "Invalid throttle value. Please enter a number between 5 and 1000." IDS_FILTER_INI "Skin INI File_*.INI__" IDS_SELECT_SKIN_FILE "Select the skin file name" @@ -2145,9 +2145,9 @@ BEGIN IDS_END_OF_MOVIE "end of movie" END -STRINGTABLE +STRINGTABLE BEGIN - IDS_INVALID_INTERVAL_VALUE + IDS_INVALID_INTERVAL_VALUE "Invalid rewind interval value. Please enter a number between 0 and 600 seconds." IDS_REGISTRY "VisualBoyAdvance no longer uses the registry to store its settings. Your previous settings have been exported into the file: %s" IDS_MOVIE_PLAY "Playing a movie will load a save state which may erase your previous battery saves. Please be sure to have a saved state if you don't want to loose any previous data."