From eaf9e6a78d98e100dcab642ddeb443e07d0573ea Mon Sep 17 00:00:00 2001 From: Nicolas Bacca Date: Tue, 22 Oct 2002 22:58:34 +0000 Subject: New rendering, overlay, add optional support for GameX svn-id: r5260 --- backends/wince/screen.cpp | 593 ++++++++++++++++++++++++++++++++++++++-------- backends/wince/screen.h | 20 +- 2 files changed, 518 insertions(+), 95 deletions(-) (limited to 'backends') diff --git a/backends/wince/screen.cpp b/backends/wince/screen.cpp index 7dac8759ba..78b318e254 100644 --- a/backends/wince/screen.cpp +++ b/backends/wince/screen.cpp @@ -28,12 +28,16 @@ #include "gx.h" #include "screen.h" #include "resource.h" +#include "dynamic_imports.h" #define COLORCONV565(r,g,b) \ (((r&0xf8)<<(11-3))|((g&0xfc)<<(5-2))|((b&0xf8)>>3)) #define COLORCONV555(r,g,b) \ (((r&0xf8)<<(10-3))|((g&0xf8)<<(5-2))|((b&0xf8)>>3)) #define COLORCONVMONO(r,g,b) ((((3*r>>3)+(g>>1)+(b>>3))>>colorscale)^invert) +#define RED_FROM_565(x) ((((x)>>11)&0x1F) << 3) +#define GREEN_FROM_565(x) ((((x)>>5)&0x3F) << 2) +#define BLUE_FROM_565(x) (((x)&0x1F) << 3) #define MAX_CLR 0x100 static UBYTE palRed[MAX_CLR]; @@ -49,24 +53,26 @@ extern UBYTE item_toolbar[]; extern UBYTE item_toolbar_colors[]; extern UBYTE item_toolbarPortrait[]; extern UBYTE item_toolbarPortrait_colors[]; -extern UBYTE item_keyboard[]; -extern UBYTE item_keyboard_colors[]; -extern UBYTE item_keyboardPortrait[]; -extern UBYTE item_keyboardPortrait_colors[]; extern UBYTE item_disk[]; extern UBYTE item_disk_colors[]; extern UBYTE item_skip[]; extern UBYTE item_skip_colors[]; -extern UBYTE item_soundOn[]; -extern UBYTE item_soundOn_colors[]; extern UBYTE item_soundOff[]; extern UBYTE item_soundOff_colors[]; -extern UBYTE item_monkeyLandscape[]; -extern UBYTE item_monkeyLandscape_colors[]; +extern UBYTE item_soundOn[]; +extern UBYTE item_soundOn_colors[]; extern UBYTE item_monkeyPortrait[]; extern UBYTE item_monkeyPortrait_colors[]; +extern UBYTE item_monkeyLandscape[]; +extern UBYTE item_monkeyLandscape_colors[]; +extern UBYTE item_keyboard[]; +extern UBYTE item_keyboard_colors[]; +extern UBYTE item_keyboardPortrait[]; +extern UBYTE item_keyboardPortrait_colors[]; extern UBYTE item_loading[]; extern UBYTE item_loading_colors[]; +extern UBYTE item_startup[]; +extern UBYTE item_startup_colors[]; extern bool sound_activated; @@ -77,6 +83,15 @@ bool draw_keyboard; GXDisplayProperties gxdp; int active; +UBYTE decomp[320 * 240]; +UBYTE comment_zone[8 * 220]; +UBYTE highlighted_zone[8 * 220]; +int _highlighted_index = -1; + +bool _gfx_mode_switch; +int _game_selection_X_offset; +int _game_selection_Y_offset; + struct tScreenGeometry { long width; @@ -92,6 +107,7 @@ struct tScreenGeometry tScreenGeometry geom[3]; +tScreenGeometry portrait_geometry; int currentScreenMode = 0; int useMode = 0; @@ -106,6 +122,7 @@ UBYTE *toolbar = NULL; typedef void (*tCls)(); typedef void (*tBlt)(UBYTE*); typedef void (*tBlt_part)(UBYTE*,int, int, int, int, UBYTE*); +typedef void (*tSet_565)(INT16 *buffer, int pitch, int x, int y, int width, int height); void mono_Cls(); void mono_Blt(UBYTE*); @@ -120,12 +137,50 @@ void hicolor555_Blt(UBYTE*); void hicolor555_Blt_part(UBYTE*, int, int, int, int, UBYTE*); void hicolor565_Blt(UBYTE*); void hicolor565_Blt_part(UBYTE*, int, int, int, int, UBYTE*); +void hicolor565_Get_565(INT16*, int, int, int, int, int); +void hicolor565_Set_565(INT16*, int, int, int, int, int); +void hicolor555_Set_565(INT16*, int, int, int, int, int); +void palette_Set_565(INT16*, int, int, int, int, int); +void mono_Set_565(INT16*, int, int, int, int, int); + + +void NULL_Get_565(INT16*, int, int, int, int, int); +void NULL_Set_565(INT16*, int, int, int, int, int); void palette_update(); +void printString(const char *, int, int, int, int = -1); +static byte textfont[] =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,0,0,0,102,102,255,102,255,102,102,0,24,62,96,60,6,124,24,0,98,102,12,24,48,102,70,0,60,102,60,56,103,102,63,0,96,48,16,0,0,0,0,0,24,48,96,96,96,48,24,0,96,48,24,24,24,48,96,0, +0,102,60,255,60,102,0,0,0,24,24,126,24,24,0,0,0,0,0,0,0,48,48,96,0,0,0,126,0,0,0,0,0,0,0,0,0,96,96,0,0,3,6,12,24,48,96,0,60,102,102,102,102,102,60,0,24,24,56,24,24,24,126,0,60,102,6,12,48,96,126,0,60,102,6,28,6,102,60,0,6, +14,30,102,127,6,6,0,126,96,124,6,6,102,60,0,60,102,96,124,102,102,60,0,126,102,12,24,24,24,24,0,60,102,102,60,102,102,60,0,60,102,102,62,6,102,60,0,0,0,96,0,0,96,0,0,0,0,48,0,0,48,48,96,14,24,48,96,48,24,14,0,0,0,120,0,120,0,0,0,112,24, +12,6,12,24,112,0,60,102,6,12,24,0,24,0,0,0,0,255,255,0,0,0,24,60,102,126,102,102,102,0,124,102,102,124,102,102,124,0,60,102,96,96,96,102,60,0,120,108,102,102,102,108,120,0,126,96,96,120,96,96,126,0,126,96,96,120,96,96,96,0,60,102,96,110,102,102,60,0,102,102,102, +126,102,102,102,0,120,48,48,48,48,48,120,0,30,12,12,12,12,108,56,0,102,108,120,112,120,108,102,0,96,96,96,96,96,96,126,0,99,119,127,107,99,99,99,0,102,118,126,126,110,102,102,0,60,102,102,102,102,102,60,0,124,102,102,124,96,96,96,0,60,102,102,102,102,60,14,0,124,102,102,124, +120,108,102,0,60,102,96,60,6,102,60,0,126,24,24,24,24,24,24,0,102,102,102,102,102,102,60,0,102,102,102,102,102,60,24,0,99,99,99,107,127,119,99,0,102,102,60,24,60,102,102,0,102,102,102,60,24,24,24,0,126,6,12,24,48,96,126,0,120,96,96,96,96,96,120,0,3,6,12,24,48, +96,192,0,120,24,24,24,24,24,120,0,0,0,0,0,0,219,219,0,0,0,0,0,0,0,0,255,102,102,102,0,0,0,0,0,0,0,60,6,62,102,62,0,0,96,96,124,102,102,124,0,0,0,60,96,96,96,60,0,0,6,6,62,102,102,62,0,0,0,60,102,126,96,60,0,0,14,24,62,24,24, +24,0,0,0,62,102,102,62,6,124,0,96,96,124,102,102,102,0,0,48,0,112,48,48,120,0,0,12,0,12,12,12,12,120,0,96,96,108,120,108,102,0,0,112,48,48,48,48,120,0,0,0,102,127,127,107,99,0,0,0,124,102,102,102,102,0,0,0,60,102,102,102,60,0,0,0,124,102,102,124,96, +96,0,0,62,102,102,62,6,6,0,0,124,102,96,96,96,0,0,0,62,96,60,6,124,0,0,24,126,24,24,24,14,0,0,0,102,102,102,102,62,0,0,0,102,102,102,60,24,0,0,0,99,107,127,62,54,0,0,0,102,60,24,60,102,0,0,0,102,102,102,62,12,120,0,0,126,12,24,48,126,0, +24,48,48,96,48,48,24,0,96,96,96,0,96,96,96,0,96,48,48,24,48,48,96,0,0,0,0,0,0,0,0,0,8,12,14,255,255,14,12,8,60,102,96,96,102,60,24,56,102,0,102,102,102,102,62,0,12,24,60,102,126,96,60,0,24,36,60,6,62,102,62,0,102,0,60,6,62,102,62,0,48, +24,60,6,62,102,62,0,0,0,0,0,0,0,0,0,0,60,96,96,96,60,24,56,24,36,60,102,126,96,60,0,102,0,60,102,126,96,60,0,48,24,60,102,126,96,60,0,0,216,0,112,48,48,120,0,48,72,0,112,48,48,120,0,96,48,0,112,48,48,120,0,102,24,60,102,126,102,102,0,0,0, +0,0,0,0,0,0,24,48,124,96,120,96,124,0,0,0,108,26,126,216,110,0,30,40,40,126,72,136,142,0,24,36,60,102,102,102,60,0,102,0,60,102,102,102,60,0,48,24,60,102,102,102,60,0,24,36,0,102,102,102,62,0,48,24,102,102,102,102,62,0,0,0,0,0,0,0,0,0,102,60,102, +102,102,102,60,0,102,0,102,102,102,102,60,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,12,24,60,6,62,102,62,0,0,0,0,0,0,0,0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124,102,102,124,64,0,0,0}; + static tCls pCls = NULL; static tBlt pBlt = NULL; static tBlt_part pBlt_part = NULL; +static tSet_565 pSet_565 = NULL; static int _geometry_w; static int _geometry_h; @@ -133,6 +188,26 @@ static int _saved_geometry_h; HWND hWndMain; +unsigned char *image_expand(unsigned char *src) { + int i = 0; + int j; + int expanded = 0; + + for (;;) { + if (!src[i]) { + if (!src[i + 1]) + break; + for (j=0; j 0) ? -1 : 1; - scraddr = (UBYTE*)GXBeginDraw(); + scraddr = (UBYTE*)dynamicGXBeginDraw(); if(scraddr) { for(y=0; y>= gxdp.cBPP; +void mono_Set_565(INT16 *buffer, int pitch, int x, int y, int width, int height) { + + static UBYTE *scraddr; + static UBYTE *dst; + static long pixelstep; + static long linestep; + static UBYTE bitmask; + static int bitshift; + + scraddr = (UBYTE*)dynamicGXBeginDraw(); + pixelstep = geom[useMode].pixelstep; + linestep = (pixelstep > 0) ? -1 : 1; + bitshift = 0; + bitmask = (1<>= 1) == 0) { + buffer = *tmp++; + mask = 0x80; + } + color = ((buffer & mask) != 0); + if (color) + ptr[x] = textcolor; + else if (highlight > 0) + ptr[x] = highlight; + } + if (highlight > 0) { + int i; + for (i=9; i<220; i++) + ptr[x] = highlight; + } + ptr += 220; + } + +} +void printString(const char *str, int x, int y, int textcolor, int highlight) +{ + for (uint letter = 0; letter < strlen(str); letter++) + printChar(str[letter], x + (letter * 8), y, textcolor, highlight); +} + + +/* ************************** DIRECT BLT IMPLEMENTATION ************************* */ + + +void Get_565(UBYTE *src, INT16 *buffer, int pitch, int x, int y, int width, int height) { + int i,j; + UBYTE *tempo = (UBYTE*)buffer; + + // Dumb conversion to 565 + + for (i=0; i<240; i++) { + for (j=0; j<320; j++) { + *buffer++ = COLORCONV565(palRed[*src], palGreen[*src], palBlue[*src]); + src++; + } + } +} + +void Set_565(INT16 *buffer, int pitch, int x, int y, int width, int height) { + pSet_565(buffer, pitch, x, y, width, height); +} + +void NULL_Set_565(INT16 *buffer, int pitch, int x, int y, int width, int height) { +} + + #endif diff --git a/backends/wince/screen.h b/backends/wince/screen.h index c7eb2b3af5..7a9f7dac09 100644 --- a/backends/wince/screen.h +++ b/backends/wince/screen.h @@ -28,22 +28,40 @@ #define UBYTE unsigned char #endif +#ifndef INT16 +#define INT16 signed short +#endif + +#define GAME_SELECTION_X_OFFSET 15 +#define GAME_SELECTION_Y_OFFSET 25 + void SetScreenGeometry(int w, int h); void LimitScreenGeometry(); void RestoreScreenGeometry(); -int GraphicsOn(HWND hWndMain); +int GraphicsOn(HWND hWndMain, bool gfx_mode_switch); void GraphicsOff(); void GraphicsSuspend(); void GraphicsResume(); void SetPalEntry(int ent, UBYTE r, UBYTE g, UBYTE b); void Blt(UBYTE * scr_ptr); +void checkToolbar(); + +void Get_565(UBYTE *src, INT16 *buffer, int pitch, int x, int y, int width, int height); +void Set_565(INT16 *buffer, int pitch, int x, int y, int width, int height); /* meaning: 0 - portrait, 1 - left hand landscape, 2 - right hand landscape */ void SetScreenMode(int mode); int GetScreenMode(); void drawWait(); +void drawBlankGameSelection(); +void reducePortraitGeometry(); +void drawCommentString(char *); +void drawStandardString(char *, int); +void drawHighlightedString(char *, int); +void resetLastHighlighted(); + void Translate(int* x, int* y); typedef enum ToolbarSelected { -- cgit v1.2.3