From 3e1afcb736ca63c25778b857427117231bf2b424 Mon Sep 17 00:00:00 2001 From: dwsJason Date: Sun, 5 Aug 2018 14:12:14 -0400 Subject: [PATCH] stubout draw_img, so that the game doesn't crash --- src/draw.c | 9 ++++++++- src/game.c | 37 +++++++++++++++++++++++++++++++++++++ src/sysevt.c | 6 ++++++ src/system.c | 2 +- src/sysvid.c | 18 ++++++++++++++++++ 5 files changed, 70 insertions(+), 2 deletions(-) diff --git a/src/draw.c b/src/draw.c index 94731a7..b878d5f 100644 --- a/src/draw.c +++ b/src/draw.c @@ -111,7 +111,11 @@ static U8 *fb; /* frame buffer pointer */ void draw_setfb(U16 x, U16 y) { - fb = sysvid_fb + x + y * SYSVID_WIDTH; +#ifdef IIGS + fb = sysvid_fb + x + y * (SYSVID_WIDTH/2); +#else + fb = sysvid_fb + x + y * SYSVID_WIDTH; +#endif } @@ -696,8 +700,11 @@ draw_img(img_t *i) 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 e4a7a10..7c8c695 100644 --- a/src/game.c +++ b/src/game.c @@ -251,6 +251,35 @@ game_run(void) freedata(); /* free cached data */ } +static char* game_state_strings[] = +{ +#ifdef ENABLE_DEVTOOLS + "DEVTOOLS", +#endif + "XRICK", + "INIT_GAME", + "INIT_BUFFER", + "INTRO_MAIN", + "INTRO_MAP", + "PAUSE_PRESSED1", + "PAUSE_PRESSED1B", + "PAUSED", + "PAUSE_PRESSED2", + "PLAY0", + "PLAY1", + "PLAY2", + "PLAY3", + "CHAIN_SUBMAP", + "CHAIN_MAP", + "CHAIN_END", + "SCROLL_UP", + "SCROLL_DOWN", + "RESTART", + "GAMEOVER", + "GETNAME", + "EXIT" +}; + /* * Prepare frame * @@ -263,6 +292,12 @@ frame(void) { while (1) { + { + printf("game_state = %s\n", game_state_strings[game_state]); + } + + + switch (game_state) { @@ -575,6 +610,8 @@ init(void) { U8 i; + printf("game.c: init(void);\n"); + E_RICK_STRST(0xff); game_lives = 6; diff --git a/src/sysevt.c b/src/sysevt.c index f42d322..ab8d9e0 100644 --- a/src/sysevt.c +++ b/src/sysevt.c @@ -225,6 +225,9 @@ processEvent() void sysevt_poll(void) { +#ifdef IIGS + printf("sysevt_poll\n"); +#endif #ifndef IIGS while (SDL_PollEvent(&event)) processEvent(); @@ -237,6 +240,9 @@ sysevt_poll(void) void sysevt_wait(void) { +#ifdef IIGS + printf("sysevt_wait\n"); +#endif #ifndef IIGS SDL_WaitEvent(&event); processEvent(); diff --git a/src/system.c b/src/system.c index bba5bc5..72fbb0a 100644 --- a/src/system.c +++ b/src/system.c @@ -105,7 +105,7 @@ sys_sleep(int s) while (s > 0) { sysvid_wait_vblank(); - s -= 16; // Abouy 1/60th of a second + s -= 16; // About 1/60th of a second } #endif #ifndef IIGS diff --git a/src/sysvid.c b/src/sysvid.c index 19f663f..b61fbf1 100644 --- a/src/sysvid.c +++ b/src/sysvid.c @@ -238,6 +238,12 @@ sysvid_init(void) exit(1); } printf("SUCCESS\n"); + + // Allocate Some Direct Page memory + //directPage = NewHandle( 0x200, userid(), 0xC005, 0 ); + //BlitFieldHndl = NewHandle(0x10000, userid(), 0xC014, 0); + sysvid_fb = (U8*)0x12000; + #endif #ifndef IIGS SDL_Surface *s; @@ -459,6 +465,7 @@ void sysvid_wait_vblank() #ifdef IIGS volatile const S8* VSTATUS = (S8*) 0xC019; + #if 1 // While already in vblank wait while ((*VSTATUS & 0x80) == 0) { @@ -468,6 +475,17 @@ void sysvid_wait_vblank() { // Wait for VBLANK to BEGIN } + #else + // While already in vblank wait + while (VSTATUS[0] >= 0) + { + // Wait for VBLANK to END + } + while (VSTATUS[0] < 0) + { + // Wait for VBLANK to BEGIN + } + #endif #endif }