From 7e6f7b9e457b819b5e4dc78af776fd3b478d533b Mon Sep 17 00:00:00 2001 From: Bradley Bell Date: Sat, 10 Jan 2015 13:42:11 -0800 Subject: [PATCH] remove ggi target --- Makefile.am | 8 +- arch/carbon/conf.h | 8 - arch/cocoa/conf.h | 5 - arch/ggi/event.c | 139 ---------- arch/ggi/gr.c | 343 ------------------------ arch/ggi/init.c | 21 -- arch/ggi/key.c | 481 ---------------------------------- arch/ggi/mouse.c | 168 ------------ arch/include/event.h | 8 - arch/ogl/glx.c | 3 - arch/win32/mouse.c | 6 - configure.ac | 14 - d2x.xcodeproj/project.pbxproj | 18 -- 13 files changed, 1 insertion(+), 1221 deletions(-) delete mode 100644 arch/ggi/event.c delete mode 100644 arch/ggi/gr.c delete mode 100644 arch/ggi/init.c delete mode 100644 arch/ggi/key.c delete mode 100644 arch/ggi/mouse.c diff --git a/Makefile.am b/Makefile.am index 8e0226f9..5432bfd4 100644 --- a/Makefile.am +++ b/Makefile.am @@ -1,5 +1,5 @@ bin_PROGRAMS = @TARGETS@ hogcreate hogextract mveplayer mvlcreate mvlextract txb2tex tex2txb -EXTRA_PROGRAMS = d2x d2x-sdl d2x-gl d2x-ggi d2x-svga +EXTRA_PROGRAMS = d2x d2x-sdl d2x-gl d2x-svga # Common to all d2x platforms/options @@ -89,12 +89,6 @@ endif # Remaining targets are based on d2x_* -d2x_ggi_CPPFLAGS = $(d2x_CPPFLAGS) -DGGI -d2x_ggi_SOURCES = $(d2x_SOURCES) arch/ggi/event.c arch/ggi/gr.c arch/ggi/init.c arch/ggi/key.c arch/ggi/mouse.c -d2x_ggi_LDFLAGS = $(d2x_LDFLAGS) -d2x_ggi_LDADD = $(d2x_LDADD) -lggi -lgii - - d2x_svga_CPPFLAGS = $(d2x_CPPFLAGS) -DSVGA d2x_svga_SOURCES = $(d2x_SOURCES) arch/svgalib/event.c arch/svgalib/gr.c arch/svgalib/key.c arch/svgalib/mouse.c arch/svgalib/init.c d2x_svga_LDFLAGS = $(d2x_LDFLAGS) diff --git a/arch/carbon/conf.h b/arch/carbon/conf.h index fa4d1a56..09a9feb6 100755 --- a/arch/carbon/conf.h +++ b/arch/carbon/conf.h @@ -17,9 +17,6 @@ /* Define for faster i/o on little-endian cpus */ /* #undef FAST_FILE_IO */ -/* Define if you want a GGI build */ -/* #undef GGI */ - /* Define to 1 if you have the declaration of `nanosleep', and to 0 if you don't. */ #define HAVE_DECL_NANOSLEEP 1 @@ -163,10 +160,6 @@ #endif // OS 9/X #ifdef __unix__ -# ifdef GGI -# define GII_INPUT 1 -# define GGI_VIDEO 1 -# else # ifdef SVGA # define SVGALIB_INPUT 1 # define SVGALIB_VIDEO 1 @@ -178,7 +171,6 @@ # define SDL_VIDEO 1 # endif # endif -# endif #endif #ifdef macintosh diff --git a/arch/cocoa/conf.h b/arch/cocoa/conf.h index 9d14891b..17203da7 100644 --- a/arch/cocoa/conf.h +++ b/arch/cocoa/conf.h @@ -152,10 +152,6 @@ #endif #ifdef __unix__ -# ifdef GGI -# define GII_INPUT 1 -# define GGI_VIDEO 1 -# else # ifdef SVGA # define SVGALIB_INPUT 1 # define SVGALIB_VIDEO 1 @@ -167,7 +163,6 @@ # define SDL_VIDEO 1 # endif # endif -# endif #endif #ifdef _WIN32 diff --git a/arch/ggi/event.c b/arch/ggi/event.c deleted file mode 100644 index 6a2172a5..00000000 --- a/arch/ggi/event.c +++ /dev/null @@ -1,139 +0,0 @@ -/* - * - * GGI Event related stuff - * - * - */ - -#ifdef HAVE_CONFIG_H -#include -#endif - -#include -#include -#include -#include -#include "event.h" -#include "error.h" -#include "fix.h" - -static int initialised=0; - -#ifdef GGI_VIDEO -#include -extern ggi_visual_t *screenvis; -#endif -gii_input_t inputs; - -extern void keyboard_handler(int key, ubyte state); -extern void mouse_handler_button(int button, ubyte state); -extern void mouse_handler_relative(int x, int y); -extern void mouse_handler_absolute(int x, int y); - -void event_poll() -{ - int n; - struct timeval tv; - gii_event event; - - if (!initialised) - event_init(); - if (inputs==NULL) - return; -// Error("GII error: no inputs (perhaps you need to set GII_INPUT env var)\n"); - - tv.tv_sec = 0; - tv.tv_usec = 0; - - giiEventPoll(inputs, emAll, &tv); - - n = giiEventsQueued(inputs, emAll); - - while (n-- > 0) - { - giiEventRead(inputs, &event, emAll); - switch (event.any.type) - { - case evKeyPress: - keyboard_handler(event.key.label, 1); - break; - case evKeyRelease: - keyboard_handler(event.key.label, 0); - break; - case evPtrAbsolute: - mouse_handler_absolute(event.pmove.x, event.pmove.y); - break; - case evPtrRelative: - mouse_handler_relative(event.pmove.x, event.pmove.y); - break; - case evPtrButtonPress: - mouse_handler_button(event.pbutton.button - 1, 1); - break; - case evPtrButtonRelease: - mouse_handler_button(event.pbutton.button - 1, 0); - break; - } - } -} - -void event_close() -{ -#ifndef GGI_VIDEO - if (inputs) - giiClose(inputs); -#endif - giiExit(); -} - -#ifdef GII_XWIN -int gii_xwin_initialized=0; -#include -//void lock_nothing(void){return;} -void init_gii_xwin(Display *disp,Window win){ - printf("gii xwin %i %i\n",initialised,gii_xwin_initialized); - if (!initialised) - event_init(); - if (gii_xwin_initialized){ - gii_event ev; - gii_xwin_cmddata_setparam *giiargs=(gii_xwin_cmddata_setparam *) &ev.cmd.data; - memset(&ev,0,sizeof(gii_cmd_nodata_event)+sizeof(gii_xwin_cmddata_setparam)); - ev.cmd.code=GII_CMDCODE_XWINSETPARAM; - ev.any.type = evCommand; - ev.any.size=sizeof(gii_cmd_nodata_event)+sizeof(gii_xwin_cmddata_setparam); - giiargs->win=win; - giiargs->ptralwaysrel=1; - giiEventSend(inputs,&ev); - }else{ - gii_input_t inputs2; - gii_inputxwin_arg giiargs; - memset(&giiargs,0,sizeof(giiargs)); - giiargs.disp=disp; - giiargs.win=win; - giiargs.ptralwaysrel=1; - //giiargs.gglock=lock_nothing; - inputs2=giiOpen("xwin",&giiargs,NULL); - if (inputs2){ - gii_xwin_initialized=1; - if (inputs) - inputs=giiJoinInputs(inputs,inputs2); - else - inputs=inputs2; - } - } -} -#endif - -int event_init() -{ - if (!initialised){ - giiInit(); -#ifdef GGI_VIDEO - inputs = ggiJoinInputs(screenvis, NULL); -#else - inputs=giiOpen(NULL); -#endif - initialised = 1; - atexit(event_close); - } - return 0; -} diff --git a/arch/ggi/gr.c b/arch/ggi/gr.c deleted file mode 100644 index d9811d8b..00000000 --- a/arch/ggi/gr.c +++ /dev/null @@ -1,343 +0,0 @@ -/* - * - * Graphics functions for GGI. - * - * - */ - -#ifdef HAVE_CONFIG_H -#include -#endif - -#include -#include -#include -#include -#include "gr.h" -#include "grdef.h" -#include "palette.h" -#include "u_mem.h" -#include "error.h" -#include "console.h" - -#include "gamefont.h" - -int gr_installed = 0; -void *screenbuffer; - -ggi_visual_t *screenvis; -const ggi_directbuffer *dbuffer; -ggi_mode init_mode; - -ubyte use_directbuffer; - -void gr_update() -{ - ggiFlush(screenvis); - if (!use_directbuffer) - ggiPutBox(screenvis, 0, 0, grd_curscreen->sc_w, grd_curscreen->sc_h, screenbuffer); -} - -int gr_set_mode(uint32_t mode) -{ - unsigned int w, h; - ggi_mode other_mode; - -#ifdef NOGRAPH - return 0; -#endif - if (mode<=0) - return 0; - - w=SM_W(mode); - h=SM_H(mode); - - - gr_palette_clear(); - - if(ggiCheckGraphMode(screenvis, w, h, GGI_AUTO, GGI_AUTO, GT_8BIT, &other_mode)) - ggiSetMode(screenvis, &other_mode); - else - ggiSetGraphMode(screenvis, w, h, GGI_AUTO, GGI_AUTO, GT_8BIT); - - ggiSetFlags(screenvis, GGIFLAG_ASYNC); - - if (!ggiDBGetNumBuffers(screenvis)) - use_directbuffer = 0; - else - { - dbuffer = ggiDBGetBuffer(screenvis, 0); - if (!(dbuffer->type & GGI_DB_SIMPLE_PLB)) - use_directbuffer = 0; - else - use_directbuffer = 1; - } - - memset(grd_curscreen, 0, sizeof(grs_screen)); - - grd_curscreen->sc_mode = mode; - grd_curscreen->sc_w = w; - grd_curscreen->sc_h = h; - grd_curscreen->sc_aspect = fixdiv(grd_curscreen->sc_w*3,grd_curscreen->sc_h*4); - grd_curscreen->sc_canvas.cv_bitmap.bm_x = 0; - grd_curscreen->sc_canvas.cv_bitmap.bm_y = 0; - grd_curscreen->sc_canvas.cv_bitmap.bm_w = w; - grd_curscreen->sc_canvas.cv_bitmap.bm_h = h; - grd_curscreen->sc_canvas.cv_bitmap.bm_type = BM_LINEAR; - - if (use_directbuffer) - { - grd_curscreen->sc_canvas.cv_bitmap.bm_data = dbuffer->write; - grd_curscreen->sc_canvas.cv_bitmap.bm_rowsize = dbuffer->buffer.plb.stride; - } - else - { - d_free(screenbuffer); - screenbuffer = d_malloc (w * h); - grd_curscreen->sc_canvas.cv_bitmap.bm_data = screenbuffer; - grd_curscreen->sc_canvas.cv_bitmap.bm_rowsize = w; - } - - gr_set_current_canvas(NULL); - - //gamefont_choose_game_font(w,h); - - return 0; -} - -int gr_init(void) -{ - int retcode; - int mode = SM(648,480); - // Only do this function once! - if (gr_installed==1) - return -1; - MALLOC(grd_curscreen,grs_screen, 1); - memset(grd_curscreen, 0, sizeof(grs_screen)); - - ggiInit(); - screenvis = ggiOpen(NULL); - ggiGetMode(screenvis, &init_mode); - - if ((retcode=gr_set_mode(mode))) - return retcode; - - grd_curscreen->sc_canvas.cv_color = 0; - grd_curscreen->sc_canvas.cv_drawmode = 0; - grd_curscreen->sc_canvas.cv_font = NULL; - grd_curscreen->sc_canvas.cv_font_fg_color = 0; - grd_curscreen->sc_canvas.cv_font_bg_color = 0; - gr_set_current_canvas( &grd_curscreen->sc_canvas ); - - gr_installed = 1; - atexit(gr_close); - return 0; -} - -void gr_close () -{ - if (gr_installed==1) - { - ggiSetMode(screenvis, &init_mode); - ggiClose(screenvis); - ggiExit(); - gr_installed = 0; - d_free(grd_curscreen); - } -} - -// Palette functions follow. - -static int last_r=0, last_g=0, last_b=0; - -void gr_palette_clear() -{ - ggi_color *colors = calloc (256, sizeof(ggi_color)); - - ggiSetPalette (screenvis, 0, 256, colors); - - gr_palette_faded_out = 1; -} - - -void gr_palette_step_up (int r, int g, int b) -{ - int i; - ubyte *p = gr_palette; - int temp; - - ggi_color colors[256]; - - if (gr_palette_faded_out) return; - - if ((r==last_r) && (g==last_g) && (b==last_b)) return; - - last_r = r; - last_g = g; - last_b = b; - - for (i = 0; i < 256; i++) - { - temp = (int)(*p++) + r + gr_palette_gamma; - if (temp<0) temp=0; - else if (temp>63) temp=63; - colors[i].r = temp * 0x3ff; - temp = (int)(*p++) + g + gr_palette_gamma; - if (temp<0) temp=0; - else if (temp>63) temp=63; - colors[i].g = temp * 0x3ff; - temp = (int)(*p++) + b + gr_palette_gamma; - if (temp<0) temp=0; - else if (temp>63) temp=63; - colors[i].b = temp * 0x3ff; - } - ggiSetPalette (screenvis, 0, 256, colors); -} - -//added on 980913 by adb to fix palette problems -// need a min without side effects... -#undef min -static inline int min(int x, int y) { return x < y ? x : y; } -//end changes by adb - -void gr_palette_load (ubyte *pal) -{ - int i, j; - ggi_color colors[256]; - - for (i = 0, j = 0; j < 256; j++) - { - gr_current_pal[i] = pal[i]; - if (gr_current_pal[i] > 63) gr_current_pal[i] = 63; - colors[j].r = (min(gr_current_pal[i] + gr_palette_gamma, 63)) * 0x3ff; - i++; - gr_current_pal[i] = pal[i]; - if (gr_current_pal[i] > 63) gr_current_pal[i] = 63; - colors[j].g = (min(gr_current_pal[i] + gr_palette_gamma, 63)) * 0x3ff; - i++; - gr_current_pal[i] = pal[i]; - if (gr_current_pal[i] > 63) gr_current_pal[i] = 63; - colors[j].b = (min(gr_current_pal[i] + gr_palette_gamma, 63)) * 0x3ff; - i++; - } - - ggiSetPalette(screenvis, 0, 256, colors); - - gr_palette_faded_out = 0; - init_computed_colors(); -} - - - -int gr_palette_fade_out (ubyte *pal, int nsteps, int allow_keys) -{ - int i, j, k; - ubyte c; - fix fade_palette[768]; - fix fade_palette_delta[768]; - - ggi_color fade_colors[256]; - - if (gr_palette_faded_out) return 0; - - if (pal==NULL) pal=gr_current_pal; - - for (i=0; i<768; i++) - { - gr_current_pal[i] = pal[i]; - fade_palette[i] = i2f(pal[i]); - fade_palette_delta[i] = fade_palette[i] / nsteps; - } - - for (j=0; j i2f(pal[i] + gr_palette_gamma)) - fade_palette[i] = i2f(pal[i] + gr_palette_gamma); - } - for (i = 0, k = 0; k < 256; k++) - { - c = f2i(fade_palette[i++]); - if (c > 63) c = 63; - fade_colors[k].r = c * 0x3ff; - c = f2i(fade_palette[i++]); - if (c > 63) c = 63; - fade_colors[k].g = c * 0x3ff; - c = f2i(fade_palette[i++]); - if (c > 63) c = 63; - fade_colors[k].b = c * 0x3ff; - } - ggiSetPalette (screenvis, 0, 256, fade_colors); - gr_update(); - } - - gr_palette_faded_out = 1; - return 0; -} - - - -int gr_palette_fade_in (ubyte *pal, int nsteps, int allow_keys) -{ - int i, j, k; - ubyte c; - fix fade_palette[768]; - fix fade_palette_delta[768]; - - ggi_color fade_colors[256]; - - if (!gr_palette_faded_out) return 0; - - for (i=0; i<768; i++) - { - gr_current_pal[i] = pal[i]; - fade_palette[i] = 0; - fade_palette_delta[i] = i2f(pal[i] + gr_palette_gamma) / nsteps; - } - - for (j=0; j i2f(pal[i] + gr_palette_gamma)) - fade_palette[i] = i2f(pal[i] + gr_palette_gamma); - } - for (i = 0, k = 0; k < 256; k++) - { - c = f2i(fade_palette[i++]); - if (c > 63) c = 63; - fade_colors[k].r = c * 0x3ff; - c = f2i(fade_palette[i++]); - if (c > 63) c = 63; - fade_colors[k].g = c * 0x3ff; - c = f2i(fade_palette[i++]); - if (c > 63) c = 63; - fade_colors[k].b = c * 0x3ff; - } - ggiSetPalette (screenvis, 0, 256, fade_colors); - gr_update(); - } - - gr_palette_faded_out = 0; - return 0; -} - - - -void gr_palette_read (ubyte *pal) -{ - ggi_color colors[256]; - int i, j; - - ggiGetPalette (screenvis, 0, 256, colors); - - for (i = 0, j = 0; i < 256; i++) - { - pal[j++] = colors[i].r / 0x3ff; - pal[j++] = colors[i].g / 0x3ff; - pal[j++] = colors[i].b / 0x3ff; - } -} diff --git a/arch/ggi/init.c b/arch/ggi/init.c deleted file mode 100644 index 872a677e..00000000 --- a/arch/ggi/init.c +++ /dev/null @@ -1,21 +0,0 @@ -/* - * - * GGI Initialization - * - * - */ - -#ifdef HAVE_CONFIG_H -#include -#endif - -#include -#include -#include "text.h" -#include "event.h" -#include "error.h" -#include "args.h" - -void arch_ggi_init() -{ -} diff --git a/arch/ggi/key.c b/arch/ggi/key.c deleted file mode 100644 index 01485230..00000000 --- a/arch/ggi/key.c +++ /dev/null @@ -1,481 +0,0 @@ -/* - * - * GGI keyboard input support - * - * - */ - -#ifdef HAVE_CONFIG_H -#include -#endif - -#include -#include - -#include - -#include "event.h" -#include "error.h" -#include "key.h" -#include "timer.h" -#include "mono.h" - - -#define KEY_BUFFER_SIZE 16 - -static unsigned char Installed = 0; - -//-------- Variable accessed by outside functions --------- -unsigned char keyd_buffer_type; // 0=No buffer, 1=buffer ASCII, 2=buffer scans -unsigned char keyd_repeat; -unsigned char keyd_editor_mode; -volatile unsigned char keyd_last_pressed; -volatile unsigned char keyd_last_released; -volatile unsigned char keyd_pressed[256]; -volatile int keyd_time_when_last_pressed; - -typedef struct Key_info { - ubyte state; // state of key 1 == down, 0 == up - ubyte last_state; // previous state of key - int counter; // incremented each time key is down in handler - fix timewentdown; // simple counter incremented each time in interrupt and key is down - fix timehelddown; // counter to tell how long key is down -- gets reset to 0 by key routines - ubyte downcount; // number of key counts key was down - ubyte upcount; // number of times key was released -} Key_info; - -typedef struct keyboard { - unsigned short keybuffer[KEY_BUFFER_SIZE]; - Key_info keys[256]; - fix time_pressed[KEY_BUFFER_SIZE]; - unsigned int keyhead, keytail; -} keyboard; - -static /*volatile*/ keyboard key_data; - -char * key_text[256]; - -unsigned char ascii_table[128] = -{ 255, 255, '1', '2', '3', '4', '5', '6', '7', '8', '9', '0', '-', '=',255,255, - 'q', 'w', 'e', 'r', 't', 'y', 'u', 'i', 'o', 'p', '[', ']', 255, 255, - 'a', 's', 'd', 'f', 'g', 'h', 'j', 'k', 'l', ';', 39, '`', - 255, '\\', 'z', 'x', 'c', 'v', 'b', 'n', 'm', ',', '.', '/', 255,'*', - 255, ' ', 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255,255,255, - 255, 255, 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255, - 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255, - 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255, - 255,255,255,255,255,255,255,255 }; - -unsigned char shifted_ascii_table[128] = -{ 255, 255, '!', '@', '#', '$', '%', '^', '&', '*', '(', ')', '_', '+',255,255, - 'Q', 'W', 'E', 'R', 'T', 'Y', 'U', 'I', 'O', 'P', '{', '}', 255, 255, - 'A', 'S', 'D', 'F', 'G', 'H', 'J', 'K', 'L', ':', '"', '~', - 255, '|', 'Z', 'X', 'C', 'V', 'B', 'N', 'M', '<', '>', '?', 255,255, - 255, ' ', 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255,255,255, - 255, 255, 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255, - 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255, - 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255, - 255,255,255,255,255,255,255,255 }; - -int giiKeyTranslate (int keylabel) { - switch (keylabel) - { - case GIIUC_0: return KEY_0; - case GIIUC_1: return KEY_1; - case GIIUC_2: return KEY_2; - case GIIUC_3: return KEY_3; - case GIIUC_4: return KEY_4; - case GIIUC_5: return KEY_5; - case GIIUC_6: return KEY_6; - case GIIUC_7: return KEY_7; - case GIIUC_8: return KEY_8; - case GIIUC_9: return KEY_9; - - case GIIUC_A: return KEY_A; - case GIIUC_B: return KEY_B; - case GIIUC_C: return KEY_C; - case GIIUC_D: return KEY_D; - case GIIUC_E: return KEY_E; - case GIIUC_F: return KEY_F; - case GIIUC_G: return KEY_G; - case GIIUC_H: return KEY_H; - case GIIUC_I: return KEY_I; - case GIIUC_J: return KEY_J; - case GIIUC_K: return KEY_K; - case GIIUC_L: return KEY_L; - case GIIUC_M: return KEY_M; - case GIIUC_N: return KEY_N; - case GIIUC_O: return KEY_O; - case GIIUC_P: return KEY_P; - case GIIUC_Q: return KEY_Q; - case GIIUC_R: return KEY_R; - case GIIUC_S: return KEY_S; - case GIIUC_T: return KEY_T; - case GIIUC_U: return KEY_U; - case GIIUC_V: return KEY_V; - case GIIUC_W: return KEY_W; - case GIIUC_X: return KEY_X; - case GIIUC_Y: return KEY_Y; - case GIIUC_Z: return KEY_Z; - - case GIIUC_Minus: return KEY_MINUS; - case GIIUC_Equal: return KEY_EQUAL; - case GIIUC_Slash: return KEY_DIVIDE; - case GIIUC_BackSlash: return KEY_SLASH; - case GIIUC_Comma: return KEY_COMMA; - case GIIUC_Period: return KEY_PERIOD; - case GIIUC_Semicolon: return KEY_SEMICOL; - - case GIIUC_BracketLeft: return KEY_LBRACKET; - case GIIUC_BracketRight: return KEY_RBRACKET; - - case GIIUC_Apostrophe: return KEY_RAPOSTRO; - case GIIUC_Grave: return KEY_LAPOSTRO; - - case GIIUC_Escape: return KEY_ESC; - case GIIK_Enter: return KEY_ENTER; - case GIIUC_BackSpace: return KEY_BACKSP; - case GIIUC_Tab: return KEY_TAB; - case GIIUC_Space: return KEY_SPACEBAR; - - case GIIK_NumLock: return KEY_NUMLOCK; - case GIIK_ScrollLock: return KEY_SCROLLOCK; - case GIIK_CapsLock: return KEY_CAPSLOCK; - - case GIIK_ShiftL: return KEY_LSHIFT; - case GIIK_ShiftR: return KEY_RSHIFT; - - case GIIK_AltL: return KEY_LALT; - case GIIK_AltR: return KEY_RALT; - - case GIIK_CtrlL: return KEY_LCTRL; - case GIIK_CtrlR: return KEY_RCTRL; - - case GIIK_F1: return KEY_F1; - case GIIK_F2: return KEY_F2; - case GIIK_F3: return KEY_F3; - case GIIK_F4: return KEY_F4; - case GIIK_F5: return KEY_F5; - case GIIK_F6: return KEY_F6; - case GIIK_F7: return KEY_F7; - case GIIK_F8: return KEY_F8; - case GIIK_F9: return KEY_F9; - case GIIK_F10: return KEY_F10; - case GIIK_F11: return KEY_F11; - case GIIK_F12: return KEY_F12; - - case GIIK_P0: return KEY_PAD0; - case GIIK_P1: return KEY_PAD1; - case GIIK_P2: return KEY_PAD2; - case GIIK_P3: return KEY_PAD3; - case GIIK_P4: return KEY_PAD4; - case GIIK_P5: return KEY_PAD5; - case GIIK_P6: return KEY_PAD6; - case GIIK_P7: return KEY_PAD7; - case GIIK_P8: return KEY_PAD8; - case GIIK_P9: return KEY_PAD9; - case GIIK_PMinus: return KEY_PADMINUS; - case GIIK_PPlus: return KEY_PADPLUS; - case GIIK_PDecimal: return KEY_PADPERIOD; - case GIIK_PSlash: return KEY_PADDIVIDE; - case GIIK_PAsterisk: return KEY_PADMULTIPLY; - case GIIK_PEnter: return KEY_PADENTER; - - case GIIK_Insert: return KEY_INSERT; - case GIIK_Home: return KEY_HOME; - case GIIK_PageUp: return KEY_PAGEUP; - case GIIK_Delete: return KEY_DELETE; - case GIIK_End: return KEY_END; - case GIIK_PageDown: return KEY_PAGEDOWN; - case GIIK_Up: return KEY_UP; - case GIIK_Down: return KEY_DOWN; - case GIIK_Left: return KEY_LEFT; - case GIIK_Right: return KEY_RIGHT; - - case GIIK_PrintScreen: return KEY_PRINT_SCREEN; - case GIIK_Pause: return KEY_PAUSE; - } - return 0; -} - -//killed on 10/03/98 by Matt Mueller -//unsigned char key_to_ascii(int a) -//{ -// if (!isprint(a)) return 255; -// if (a & KEY_SHIFTED) { -// return (toupper((unsigned char) a)); -// } else { -// return ((unsigned char) a); -// } -//} -//end kill -MM - -//added on 10/03/98 by Matt Mueller to fix shifted keys (copied from dos/key.c) -unsigned char key_to_ascii(int keycode) -{ - int shifted; - - shifted = keycode & KEY_SHIFTED; - keycode &= 0xFF; - - if ( keycode>=127 ) - return 255; - - if (shifted) - return shifted_ascii_table[keycode]; - else - return ascii_table[keycode]; -} -//end addition -MM - -void keyboard_handler(int button, ubyte state) -{ - ubyte key_state; - int i, keycode; - unsigned short event_key; - Key_info *key; - unsigned char temp; - - key_state = state; - event_key = giiKeyTranslate(button); - //mprintf((0,"keyboard_handler(%i,%i):%i\n",button,state,event_key)); - - //===================================================== - //Here a translation from win keycodes to mac keycodes! - //===================================================== - - for (i = 255; i >= 0; i--) { - - keycode = i; - key = &(key_data.keys[keycode]); - if (i == event_key) - state = key_state; - else - state = key->last_state; - - if ( key->last_state == state ) { - if (state) { - key->counter++; - keyd_last_pressed = keycode; - keyd_time_when_last_pressed = timer_get_fixed_seconds(); - } - } else { - if (state) { - keyd_last_pressed = keycode; - keyd_pressed[keycode] = 1; - key->downcount += state; - key->state = 1; - key->timewentdown = keyd_time_when_last_pressed = timer_get_fixed_seconds(); - key->counter++; - } else { - keyd_pressed[keycode] = 0; - keyd_last_released = keycode; - key->upcount += key->state; - key->state = 0; - key->counter = 0; - key->timehelddown += timer_get_fixed_seconds() - key->timewentdown; - } - } - if ( (state && !key->last_state) || (state && key->last_state && (key->counter > 30) && (key->counter & 0x01)) ) { - if ( keyd_pressed[KEY_LSHIFT] || keyd_pressed[KEY_RSHIFT]) - keycode |= KEY_SHIFTED; - if ( keyd_pressed[KEY_LALT] || keyd_pressed[KEY_RALT]) - keycode |= KEY_ALTED; - if ( keyd_pressed[KEY_LCTRL] || keyd_pressed[KEY_RCTRL]) - keycode |= KEY_CTRLED; - if ( keyd_pressed[KEY_DELETE] ) - keycode |= KEY_DEBUGGED; - temp = key_data.keytail+1; - if ( temp >= KEY_BUFFER_SIZE ) temp=0; - if (temp!=key_data.keyhead) { - key_data.keybuffer[key_data.keytail] = keycode; - key_data.time_pressed[key_data.keytail] = keyd_time_when_last_pressed; - key_data.keytail = temp; - } - } - key->last_state = state; - } -} - -void key_close() -{ - Installed = 0; -} - -void key_init() -{ - Installed=1; - - keyd_time_when_last_pressed = timer_get_fixed_seconds(); - keyd_buffer_type = 1; - keyd_repeat = 1; - -// Clear the keyboard array - key_flush(); - atexit(key_close); -} - -void key_flush() -{ - int i; - fix curtime; - - if (!Installed) - key_init(); - - key_data.keyhead = key_data.keytail = 0; - - //Clear the keyboard buffer - for (i=0; i= KEY_BUFFER_SIZE ) n=0; - return n; -} - -int key_checkch() -{ - int is_one_waiting = 0; - event_poll(); - if (key_data.keytail!=key_data.keyhead) - is_one_waiting = 1; - return is_one_waiting; -} - -int key_inkey() -{ - int key = 0; - if (!Installed) - key_init(); - event_poll(); - if (key_data.keytail!=key_data.keyhead) { - key = key_data.keybuffer[key_data.keyhead]; - key_data.keyhead = add_one(key_data.keyhead); - } -//added 9/3/98 by Matt Mueller to free cpu time instead of hogging during menus and such -// else timer_delay(1); -//end addition - Matt Mueller - return key; -} - -int key_inkey_time(fix * time) -{ - int key = 0; - - if (!Installed) - key_init(); - event_poll(); - if (key_data.keytail!=key_data.keyhead) { - key = key_data.keybuffer[key_data.keyhead]; - *time = key_data.time_pressed[key_data.keyhead]; - key_data.keyhead = add_one(key_data.keyhead); - } - return key; -} - -int key_peekkey() -{ - int key = 0; - event_poll(); - if (key_data.keytail!=key_data.keyhead) - key = key_data.keybuffer[key_data.keyhead]; - - return key; -} - -int key_getch() -{ - int dummy=0; - - if (!Installed) - return 0; -// return getch(); - - while (!key_checkch()) - dummy++; - return key_inkey(); -} - -unsigned int key_get_shift_status() -{ - unsigned int shift_status = 0; - - if ( keyd_pressed[KEY_LSHIFT] || keyd_pressed[KEY_RSHIFT] ) - shift_status |= KEY_SHIFTED; - - if ( keyd_pressed[KEY_LALT] || keyd_pressed[KEY_RALT] ) - shift_status |= KEY_ALTED; - - if ( keyd_pressed[KEY_LCTRL] || keyd_pressed[KEY_RCTRL] ) - shift_status |= KEY_CTRLED; - -#ifndef NDEBUG - if (keyd_pressed[KEY_DELETE]) - shift_status |=KEY_DEBUGGED; -#endif - - return shift_status; -} - -// Returns the number of seconds this key has been down since last call. -fix key_down_time(int scancode) -{ - fix time_down, time; - - event_poll(); - if ((scancode<0)|| (scancode>255)) return 0; - - if (!keyd_pressed[scancode]) { - time_down = key_data.keys[scancode].timehelddown; - key_data.keys[scancode].timehelddown = 0; - } else { - time = timer_get_fixed_seconds(); - time_down = time - key_data.keys[scancode].timewentdown; - key_data.keys[scancode].timewentdown = time; - } - - return time_down; -} - -unsigned int key_down_count(int scancode) -{ - int n; - event_poll(); - if ((scancode<0)|| (scancode>255)) return 0; - - n = key_data.keys[scancode].downcount; - key_data.keys[scancode].downcount = 0; - - return n; -} - -unsigned int key_up_count(int scancode) -{ - int n; - event_poll(); - if ((scancode<0)|| (scancode>255)) return 0; - - n = key_data.keys[scancode].upcount; - key_data.keys[scancode].upcount = 0; - - return n; -} diff --git a/arch/ggi/mouse.c b/arch/ggi/mouse.c deleted file mode 100644 index 2a447e13..00000000 --- a/arch/ggi/mouse.c +++ /dev/null @@ -1,168 +0,0 @@ -/* - * - * GGI mouse support - * - * - */ - -#ifdef HAVE_CONFIG_H -#include -#endif - -#include -#include -#include -#include "fix.h" -#include "timer.h" -#include "event.h" -#include "mouse.h" - -struct mousebutton { - ubyte pressed; - fix time_went_down; - fix time_held_down; - uint num_downs; - uint num_ups; -}; - -#define MOUSE_MAX_BUTTONS 3 - -static struct mouseinfo { - struct mousebutton buttons[MOUSE_MAX_BUTTONS]; -//added on 10/17/98 by Hans de Goede for mouse functionality - int min_x, min_y; - int max_x, max_y; - int delta_x, delta_y; - int x,y; -} Mouse; - -void mouse_correct() -{ - if (Mouse.x < Mouse.min_x) - Mouse.x = Mouse.min_x; - else if (Mouse.x > Mouse.max_x) - Mouse.x = Mouse.max_x; - if (Mouse.y < Mouse.min_y) - Mouse.y = Mouse.min_y; - else if (Mouse.y > Mouse.max_y) - Mouse.y = Mouse.max_y; -} - -void mouse_handler_absolute(int x, int y) -{ - Mouse.delta_x += (x - Mouse.x); - Mouse.delta_y += (y - Mouse.y); - Mouse.x = x; - Mouse.y = y; -// mouse_correct(); -} - -void mouse_handler_relative(int x, int y) -{ - Mouse.delta_x += x; - Mouse.delta_y += y; - Mouse.x += x; - Mouse.y += y; -// mouse_correct(); -} - -void mouse_handler_button(int button, ubyte state) -{ - if (!Mouse.buttons[button].pressed && state) - { - Mouse.buttons[button].time_went_down = timer_get_fixed_seconds(); - Mouse.buttons[button].num_downs++; - } - else if (Mouse.buttons[button].pressed && !state) - { - Mouse.buttons[button].num_ups++; - } - - Mouse.buttons[button].pressed = state; -} - -void Mouse_close(void) -{ -} - -void Mouse_init(void) -{ - memset(&Mouse, 0, sizeof(Mouse)); -} - -void -mouse_set_limits( int x1, int y1, int x2, int y2 ) -{ - Mouse.min_x = x1; - Mouse.max_x = x2; - Mouse.min_y = y1; - Mouse.max_y = y2; -} - -void mouse_flush() // clears all mice events... -{ - Mouse.x = 0; - Mouse.y = 0; - Mouse.delta_x = 0; - Mouse.delta_y = 0; -} - -//======================================================================== -void mouse_get_pos( int *x, int *y) -{ - event_poll(); - *x = Mouse.x; - *y = Mouse.y; -} - -void mouse_get_delta( int *dx, int *dy ) -{ - event_poll(); - *dx = Mouse.delta_x; - *dy = Mouse.delta_y; - Mouse.delta_x = 0; - Mouse.delta_y = 0; -} - -int mouse_get_btns() -{ - ubyte buttons = 0; - int i; - event_poll(); - for (i = 0; i < MOUSE_MAX_BUTTONS; i++) - buttons |= (Mouse.buttons[i].pressed << i); - return buttons; -} - -void mouse_set_pos( int x, int y) -{ - Mouse.x = x; - Mouse.y = y; -} - -void mouse_get_cyberman_pos( int *x, int *y ) -{ -} - -// Returns how long this button has been down since last call. -fix mouse_button_down_time(int button) -{ - if (Mouse.buttons[button].pressed) - return (timer_get_fixed_seconds() - Mouse.buttons[button].time_went_down); - else - return 0; -} - -// Returns how many times this button has went down since last call -int mouse_button_down_count(int button) -{ - int count = Mouse.buttons[button].num_downs; - Mouse.buttons[button].num_downs = 0; - return count; -} - -// Returns 1 if this button is currently down -int mouse_button_state(int button) -{ - return Mouse.buttons[button].pressed; -} diff --git a/arch/include/event.h b/arch/include/event.h index a2e7a776..af67460f 100644 --- a/arch/include/event.h +++ b/arch/include/event.h @@ -8,15 +8,7 @@ #ifndef _EVENT_H #define _EVENT_H -#ifdef GII_XWIN -#include -#endif - int event_init(); void event_poll(); -#ifdef GII_XWIN -void init_gii_xwin(Display *disp,Window win); -#endif - #endif diff --git a/arch/ogl/glx.c b/arch/ogl/glx.c index c0b04215..cd48efa5 100644 --- a/arch/ogl/glx.c +++ b/arch/ogl/glx.c @@ -218,9 +218,6 @@ int ogl_init_window(int x, int y){ ogl_do_fullscreen_internal(); // gr_do_fullscreen(ogl_fullscreen); } -#ifdef GII_XWIN - init_gii_xwin(dpy,win); -#endif return 0; } void ogl_destroy_window(void){ diff --git a/arch/win32/mouse.c b/arch/win32/mouse.c index 9f441d91..831983c0 100644 --- a/arch/win32/mouse.c +++ b/arch/win32/mouse.c @@ -116,11 +116,6 @@ int WMMouse_Handler_Ready = 0; int mouse_wparam, mouse_lparam, mouse_msg; -//GGI data: -//extern ggi_visual_t visual; -//extern ggi_directbuffer_t dbuf; // GGI direct acces to screen memory -//extern ggi_pixellinearbuffer *plb; - //Mouse globals static double mouse_x, mouse_y; static double mouse_saved_x, mouse_saved_y; //used when hiding/unhiding to reset the real (displayed) postion @@ -509,7 +504,6 @@ void show_cursor() } -/* New mouse pointer stuff for GGI/DGA */ //#include "cursor.h" /* cursor and mask */ typedef struct Sprite { diff --git a/configure.ac b/configure.ac index 36093df6..6086545b 100644 --- a/configure.ac +++ b/configure.ac @@ -206,15 +206,6 @@ else TARGETS="d2x-gl $TARGETS" fi - # Check for GGI - AC_ARG_WITH(ggi, - [ --with-ggi Build GGI support ],,) - if test x$with_ggi = xyes; then - TARGETS="d2x-ggi $TARGETS" - fi - AC_SUBST(GGI_LIBS) - AM_CONDITIONAL(USE_GGI, test x$with_ggi = xyes) - # Check for SVGALib AC_ARG_WITH(svga, [ --with-svga Build SVGALib support ],,) @@ -323,10 +314,6 @@ AH_BOTTOM([ #endif #ifdef __unix__ -# ifdef GGI -# define GII_INPUT 1 -# define GGI_VIDEO 1 -# else # ifdef SVGA # define SVGALIB_INPUT 1 # define SVGALIB_VIDEO 1 @@ -338,7 +325,6 @@ AH_BOTTOM([ # define SDL_VIDEO 1 # endif # endif -# endif #endif #ifdef _WIN32 diff --git a/d2x.xcodeproj/project.pbxproj b/d2x.xcodeproj/project.pbxproj index b6d65e09..8b1e3a20 100644 --- a/d2x.xcodeproj/project.pbxproj +++ b/d2x.xcodeproj/project.pbxproj @@ -455,11 +455,6 @@ 146695591A2729860070D41D /* tweak.inc */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.pascal; path = tweak.inc; sourceTree = ""; }; 1466955A1A2729860070D41D /* vesa.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = vesa.c; sourceTree = ""; }; 1466955B1A2729860070D41D /* vgaregs.inc */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.pascal; path = vgaregs.inc; sourceTree = ""; }; - 1466955D1A2729860070D41D /* event.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = event.c; sourceTree = ""; }; - 1466955E1A2729860070D41D /* gr.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = gr.c; sourceTree = ""; }; - 1466955F1A2729860070D41D /* init.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = init.c; sourceTree = ""; }; - 146695601A2729860070D41D /* key.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = key.c; sourceTree = ""; }; - 146695631A2729860070D41D /* mouse.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = mouse.c; sourceTree = ""; }; 146695651A2729860070D41D /* event.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = event.h; sourceTree = ""; }; 146695661A2729860070D41D /* gui.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = gui.h; sourceTree = ""; }; 146695671A2729860070D41D /* joy.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = joy.h; sourceTree = ""; }; @@ -1196,7 +1191,6 @@ 146694FD1A2729860070D41D /* carbon */, 146695031A2729860070D41D /* cocoa */, 146695061A2729860070D41D /* dos */, - 1466955C1A2729860070D41D /* ggi */, 146695641A2729860070D41D /* include */, 1466956A1A2729860070D41D /* linux */, 1466958A1A2729860070D41D /* ogl */, @@ -1381,18 +1375,6 @@ path = include; sourceTree = ""; }; - 1466955C1A2729860070D41D /* ggi */ = { - isa = PBXGroup; - children = ( - 1466955D1A2729860070D41D /* event.c */, - 1466955E1A2729860070D41D /* gr.c */, - 1466955F1A2729860070D41D /* init.c */, - 146695601A2729860070D41D /* key.c */, - 146695631A2729860070D41D /* mouse.c */, - ); - path = ggi; - sourceTree = ""; - }; 146695641A2729860070D41D /* include */ = { isa = PBXGroup; children = ( -- 2.39.2