diff --git a/include/img.h b/include/img.h index a953cc3..69af70e 100644 --- a/include/img.h +++ b/include/img.h @@ -20,14 +20,18 @@ typedef struct { U8 r, g, b, nothing; } img_color_t; +#ifdef IIGS + +typedef void img_t; + +#else typedef struct { U16 w, h; U16 ncolors; img_color_t *colors; U8 *pixels; } img_t; - -//segment "screen"; +#endif extern img_t *IMG_SPLASH; diff --git a/include/system.h b/include/system.h index 3ae1f5d..f59ca4c 100644 --- a/include/system.h +++ b/include/system.h @@ -169,6 +169,10 @@ extern void sysjoy_init(void); extern void sysjoy_shutdown(void); #endif +#ifdef IIGS +// GS Specific Stuff +extern int LZ4_Unpack(char* pDest, char* pPackedSource); +#endif #endif diff --git a/src/draw.c b/src/draw.c index b878d5f..d69b8ad 100644 --- a/src/draw.c +++ b/src/draw.c @@ -695,16 +695,17 @@ draw_pic(U16 x, U16 y, U16 w, U16 h, U32 *pic) void draw_img(img_t *i) { +#ifdef IIGS + LZ4_Unpack(sysvid_fb, (char*)i); +#else U16 k; draw_setfb(0, 0); if (i->ncolors > 0) sysvid_setPalette(i->colors, i->ncolors); -#ifndef IIGS for (k = 0; k < SYSVID_WIDTH * SYSVID_HEIGHT; k++) fb[k] = i->pixels[k]; #endif - } diff --git a/src/game.c b/src/game.c index 7c8c695..b065d89 100644 --- a/src/game.c +++ b/src/game.c @@ -228,7 +228,7 @@ game_run(void) tmx = tm; tm = sys_gettime(); tmx = tm - tmx; if (tmx < game_period) sys_sleep(game_period - tmx); - printf("tmx=%x\n"); +// printf("tmx=%x\n"); /* video */ /*DEBUG*//*game_rects=&draw_SCREENRECT;*//*DEBUG*/ diff --git a/src/img_icon.e b/src/img_icon.e index 60df2f0..6e46db4 100644 --- a/src/img_icon.e +++ b/src/img_icon.e @@ -1,3 +1,4 @@ +#ifndef IIGS static U8 IMG_ICON_PIXELS[] = { 0,0,0,0,0,0,0,0,0, 211,108,211,108,52,52,52,52,52,52,52,52,52,0,0,0, @@ -76,4 +77,4 @@ static img_t IMG_ICON_OBJECT = { }; img_t *IMG_ICON = &IMG_ICON_OBJECT; - +#endif diff --git a/src/img_splash.e b/src/img_splash.e index 4059a2c..2c9d582 100644 --- a/src/img_splash.e +++ b/src/img_splash.e @@ -4013,7 +4013,11 @@ static img_t IMG_SPLASH_OBJECT = { }; img_t *IMG_SPLASH = &IMG_SPLASH_OBJECT; + #else -img_t *IMG_SPLASH = 0; +// On the GS it's a packed $C1 +extern U8 img_splash_lz4; +extern U8 splash_lz4; +img_t *IMG_SPLASH = &img_splash_lz4; #endif diff --git a/src/scr_imain.c b/src/scr_imain.c index 46223d7..2a7bcb2 100644 --- a/src/scr_imain.c +++ b/src/scr_imain.c @@ -24,6 +24,7 @@ #ifdef IIGS #pragma noroot segment "screen"; +extern img_t splash_lz4; #endif /* @@ -78,6 +79,10 @@ screen_introMain(void) draw_pic(0, 0, 0x140, 0xc8, pic_splash); #endif +#ifdef GFXGS + draw_img(&splash_lz4); +#endif + seq = 2; break; diff --git a/src/sysvid.c b/src/sysvid.c index b61fbf1..48c87d5 100644 --- a/src/sysvid.c +++ b/src/sysvid.c @@ -46,6 +46,12 @@ rect_t SCREENRECT = {0, 0, SYSVID_WIDTH, SYSVID_HEIGHT, NULL}; /* whole fb */ static SDL_Color palette[256]; static SDL_Surface *screen; #endif + +#ifdef IIGS +volatile char *VIDEO_REGISTER = (char*)0xC029; +volatile char *SHADOW_REGISTER = (char*)0xC035; +#endif + static U32 videoFlags; static U8 zoom = SYSVID_ZOOM; /* actual zoom level */ @@ -244,6 +250,13 @@ sysvid_init(void) //BlitFieldHndl = NewHandle(0x10000, userid(), 0xC014, 0); sysvid_fb = (U8*)0x12000; + // SHR ON + *VIDEO_REGISTER|=0xC0; + + // ENABLE Shadowing of SHR + *SHADOW_REGISTER&=~0x08; // Shadow Enable + + #endif #ifndef IIGS SDL_Surface *s; @@ -412,6 +425,12 @@ sysvid_clear(void) { #ifndef IIGS memset(sysvid_fb, 0, SYSVID_WIDTH * SYSVID_HEIGHT); +#else + size_t length = SYSVID_WIDTH /2 * SYSVID_HEIGHT; + //printf("sysvid_clear: target = %08p\n", sysvid_fb); + //printf("sysvid_clear: length = %08p\n", length); + //sys_sleep(10000); + memset(sysvid_fb, 0, length); #endif } diff --git a/src/xrick.c b/src/xrick.c index 1edf053..dfccdee 100644 --- a/src/xrick.c +++ b/src/xrick.c @@ -18,10 +18,8 @@ #include #endif - -extern char splash_lz4; -volatile char *VIDEO = (char*)0xC029; -extern int LZ4_Unpack(char* pDest, char* pPackedSource); +extern char img_splash_lz4; +extern void* IMG_SPLASH; /* * main @@ -31,12 +29,11 @@ main(int argc, char *argv[]) { printf("Hello from xrick IIgs\n"); - printf("Unpacking Splash!\n"); - - LZ4_Unpack((char*)(0xE12000), &splash_lz4); - - // SHR ON -// *VIDEO|=0xC0; +// printf("Unpacking Splash!\n"); +// LZ4_Unpack((char*)(0xE12000), &img_splash_lz4); +// printf("%08x\n", &img_splash_lz4 ); +// printf("%08x\n", IMG_SPLASH ); +// sys_sleep(10000); sys_init(argc, argv); if (sysarg_args_data)