X-Git-Url: https://git.zerfleddert.de/cgi-bin/gitweb.cgi/micropolis/blobdiff_plain/efad9d6d0b164bd37c84a9581dbf6397c7ffb3fa..5a6a8ae5829f6f2836cb58d35629c5fa1f7eb4ba:/src/sim/g_smmaps.c diff --git a/src/sim/g_smmaps.c b/src/sim/g_smmaps.c index 4ca499a..8b5f345 100644 --- a/src/sim/g_smmaps.c +++ b/src/sim/g_smmaps.c @@ -142,9 +142,9 @@ int DynamicData[32]; #define BE_ROW3_32 BE_ROW1_32(0) BE_ROW1_32(1) BE_ROW1_32(2) #define ROW3_8 if (view->x->needs_swap) { BE_ROW3_8 } else { LE_ROW3_8 } -#define ROW3_16 if (view->x->needs_swap) { BE_ROW3_16 } else { LE_ROW3_16 } -#define ROW3_24 if (view->x->needs_swap) { BE_ROW3_24 } else { LE_ROW3_24 } -#define ROW3_32 if (view->x->needs_swap) { BE_ROW3_32 } else { LE_ROW3_32 } +#define ROW3_16 LE_ROW3_16 +#define ROW3_24 LE_ROW3_24 +#define ROW3_32 LE_ROW3_32 #define ROW3 \ switch (view->x->depth) { \ @@ -295,14 +295,26 @@ void drawPower(SimView *view) case 16: { unsigned short *p; - p = (short *)image; - p[0] = p[1] = p[2] = pix; + p = (unsigned short *)image; + if (view->x->x_big_endian) { + p[0] = p[1] = p[2] = ((pix & 0xff) << 8) | ((pix & 0xff00) >> 8); + } else { + p[0] = p[1] = p[2] = pix; + } image += lineBytes; - p = (short *)image; - p[0] = p[1] = p[2] = pix; + p = (unsigned short *)image; + if (view->x->x_big_endian) { + p[0] = p[1] = p[2] = ((pix & 0xff) << 8) | ((pix & 0xff00) >> 8); + } else { + p[0] = p[1] = p[2] = pix; + } image += lineBytes; - p = (short *)image; - p[0] = p[1] = p[2] = pix; + p = (unsigned short *)image; + if (view->x->x_big_endian) { + p[0] = p[1] = p[2] = ((pix & 0xff) << 8) | ((pix & 0xff00) >> 8); + } else { + p[0] = p[1] = p[2] = pix; + } image += lineBytes; } break; @@ -315,12 +327,21 @@ void drawPower(SimView *view) unsigned char *img = image; for (x = 0; x < 4; x++) { - *(img++) = (pix >> 0) & 0xff; - *(img++) = (pix >> 8) & 0xff; - *(img++) = (pix >> 16) & 0xff; - if (pixelBytes == 4) { - img++; - } // if + if (view->x->x_big_endian) { + if (pixelBytes == 4) { + img++; + } // if + *(img++) = (pix >> 16) & 0xff; + *(img++) = (pix >> 8) & 0xff; + *(img++) = (pix >> 0) & 0xff; + } else { + *(img++) = (pix >> 0) & 0xff; + *(img++) = (pix >> 8) & 0xff; + *(img++) = (pix >> 16) & 0xff; + if (pixelBytes == 4) { + img++; + } // if + } } // for x image += lineBytes; } // for y