diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/Makefile | 200 | ||||
-rw-r--r-- | src/gfx.c | 257 | ||||
-rw-r--r-- | src/gfx.h | 16 | ||||
-rw-r--r-- | src/gui.c | 6 | ||||
-rw-r--r-- | src/memmenu.c | 4 | ||||
-rw-r--r-- | src/zx81.c | 7 |
6 files changed, 139 insertions, 351 deletions
diff --git a/src/Makefile b/src/Makefile index 5103ab6..e50c10d 100644 --- a/src/Makefile +++ b/src/Makefile @@ -26,7 +26,7 @@ # Simply comment out if not, and replace as needed. # Other CFLAGS lines *are* required. # -CFLAGS = -g -Wall -Werror -pedantic -ansi +CFLAGS = -O2 TARGET = ezx81 @@ -56,207 +56,13 @@ OBJECTS = main.o \ z80_decode.o \ z80_dis.o -CFLAGS += `sdl-config --cflags` +CFLAGS += `sdl2-config --cflags` -LIBS = `sdl-config --libs` +LIBS = `sdl2-config --libs` $(TARGET): $(OBJECTS) $(Z80LIB) $(CC) $(CFLAGS) -o $(TARGET) $(OBJECTS) $(LIBS) -$(Z80LIB): z80/*.[ch] - cd z80; make "EXTERNAL_CFLAGS=`sdl-config --cflags`" ; cd .. - clean: rm -f $(TARGET) $(TARGET).exe $(OBJECTS) core - -depend: - makedepend -- $(CFLAGS) -- $(SOURCE) - if test -e Makefile ; then rm -f Makefile.bak ; fi - -# DO NOT DELETE THIS LINE -- make depend depends on it - -main.o: /usr/include/stdlib.h /usr/include/sys/cdefs.h -main.o: /usr/include/sys/_null.h /usr/include/sys/_types.h -main.o: /usr/include/machine/_types.h /usr/include/stdio.h -main.o: /usr/include/string.h /usr/include/strings.h -main.o: /usr/local/include/SDL11/SDL.h /usr/local/include/SDL11/SDL_main.h -main.o: /usr/local/include/SDL11/SDL_types.h -main.o: /usr/local/include/SDL11/SDL_getenv.h -main.o: /usr/local/include/SDL11/SDL_error.h -main.o: /usr/local/include/SDL11/begin_code.h -main.o: /usr/local/include/SDL11/close_code.h -main.o: /usr/local/include/SDL11/SDL_rwops.h -main.o: /usr/local/include/SDL11/SDL_timer.h -main.o: /usr/local/include/SDL11/SDL_audio.h -main.o: /usr/local/include/SDL11/SDL_byteorder.h -main.o: /usr/local/include/SDL11/SDL_cdrom.h -main.o: /usr/local/include/SDL11/SDL_joystick.h -main.o: /usr/local/include/SDL11/SDL_events.h -main.o: /usr/local/include/SDL11/SDL_active.h -main.o: /usr/local/include/SDL11/SDL_keyboard.h -main.o: /usr/local/include/SDL11/SDL_keysym.h -main.o: /usr/local/include/SDL11/SDL_mouse.h -main.o: /usr/local/include/SDL11/SDL_video.h -main.o: /usr/local/include/SDL11/SDL_mutex.h -main.o: /usr/local/include/SDL11/SDL_quit.h -main.o: /usr/local/include/SDL11/SDL_version.h z80.h z80_config.h zx81.h -main.o: gfx.h gui.h memmenu.h config.h exit.h -zx81.o: /usr/include/stdlib.h /usr/include/sys/cdefs.h -zx81.o: /usr/include/sys/_null.h /usr/include/sys/_types.h -zx81.o: /usr/include/machine/_types.h /usr/include/stdio.h -zx81.o: /usr/include/string.h /usr/include/strings.h zx81.h z80.h -zx81.o: z80_config.h /usr/local/include/SDL11/SDL.h -zx81.o: /usr/local/include/SDL11/SDL_main.h -zx81.o: /usr/local/include/SDL11/SDL_types.h -zx81.o: /usr/local/include/SDL11/SDL_getenv.h -zx81.o: /usr/local/include/SDL11/SDL_error.h -zx81.o: /usr/local/include/SDL11/begin_code.h -zx81.o: /usr/local/include/SDL11/close_code.h -zx81.o: /usr/local/include/SDL11/SDL_rwops.h -zx81.o: /usr/local/include/SDL11/SDL_timer.h -zx81.o: /usr/local/include/SDL11/SDL_audio.h -zx81.o: /usr/local/include/SDL11/SDL_byteorder.h -zx81.o: /usr/local/include/SDL11/SDL_cdrom.h -zx81.o: /usr/local/include/SDL11/SDL_joystick.h -zx81.o: /usr/local/include/SDL11/SDL_events.h -zx81.o: /usr/local/include/SDL11/SDL_active.h -zx81.o: /usr/local/include/SDL11/SDL_keyboard.h -zx81.o: /usr/local/include/SDL11/SDL_keysym.h -zx81.o: /usr/local/include/SDL11/SDL_mouse.h -zx81.o: /usr/local/include/SDL11/SDL_video.h -zx81.o: /usr/local/include/SDL11/SDL_mutex.h -zx81.o: /usr/local/include/SDL11/SDL_quit.h -zx81.o: /usr/local/include/SDL11/SDL_version.h gfx.h gui.h config.h util.h -zx81.o: exit.h -config.o: /usr/include/stdlib.h /usr/include/sys/cdefs.h -config.o: /usr/include/sys/_null.h /usr/include/sys/_types.h -config.o: /usr/include/machine/_types.h /usr/include/stdio.h -config.o: /usr/include/string.h /usr/include/strings.h exit.h config.h -gfx.o: /usr/include/stdlib.h /usr/include/sys/cdefs.h -gfx.o: /usr/include/sys/_null.h /usr/include/sys/_types.h -gfx.o: /usr/include/machine/_types.h /usr/include/stdio.h -gfx.o: /usr/include/string.h /usr/include/strings.h /usr/include/stdarg.h -gfx.o: gfx.h /usr/local/include/SDL11/SDL.h -gfx.o: /usr/local/include/SDL11/SDL_main.h -gfx.o: /usr/local/include/SDL11/SDL_types.h -gfx.o: /usr/local/include/SDL11/SDL_getenv.h -gfx.o: /usr/local/include/SDL11/SDL_error.h -gfx.o: /usr/local/include/SDL11/begin_code.h -gfx.o: /usr/local/include/SDL11/close_code.h -gfx.o: /usr/local/include/SDL11/SDL_rwops.h -gfx.o: /usr/local/include/SDL11/SDL_timer.h -gfx.o: /usr/local/include/SDL11/SDL_audio.h -gfx.o: /usr/local/include/SDL11/SDL_byteorder.h -gfx.o: /usr/local/include/SDL11/SDL_cdrom.h -gfx.o: /usr/local/include/SDL11/SDL_joystick.h -gfx.o: /usr/local/include/SDL11/SDL_events.h -gfx.o: /usr/local/include/SDL11/SDL_active.h -gfx.o: /usr/local/include/SDL11/SDL_keyboard.h -gfx.o: /usr/local/include/SDL11/SDL_keysym.h -gfx.o: /usr/local/include/SDL11/SDL_mouse.h -gfx.o: /usr/local/include/SDL11/SDL_video.h -gfx.o: /usr/local/include/SDL11/SDL_mutex.h -gfx.o: /usr/local/include/SDL11/SDL_quit.h -gfx.o: /usr/local/include/SDL11/SDL_version.h exit.h config.h font.h -gui.o: /usr/include/stdlib.h /usr/include/sys/cdefs.h -gui.o: /usr/include/sys/_null.h /usr/include/sys/_types.h -gui.o: /usr/include/machine/_types.h /usr/include/stdio.h -gui.o: /usr/include/string.h /usr/include/strings.h /usr/include/stdarg.h -gui.o: /usr/include/ctype.h /usr/include/_ctype.h /usr/include/runetype.h -gui.o: gui.h /usr/local/include/SDL11/SDL.h -gui.o: /usr/local/include/SDL11/SDL_main.h -gui.o: /usr/local/include/SDL11/SDL_types.h -gui.o: /usr/local/include/SDL11/SDL_getenv.h -gui.o: /usr/local/include/SDL11/SDL_error.h -gui.o: /usr/local/include/SDL11/begin_code.h -gui.o: /usr/local/include/SDL11/close_code.h -gui.o: /usr/local/include/SDL11/SDL_rwops.h -gui.o: /usr/local/include/SDL11/SDL_timer.h -gui.o: /usr/local/include/SDL11/SDL_audio.h -gui.o: /usr/local/include/SDL11/SDL_byteorder.h -gui.o: /usr/local/include/SDL11/SDL_cdrom.h -gui.o: /usr/local/include/SDL11/SDL_joystick.h -gui.o: /usr/local/include/SDL11/SDL_events.h -gui.o: /usr/local/include/SDL11/SDL_active.h -gui.o: /usr/local/include/SDL11/SDL_keyboard.h -gui.o: /usr/local/include/SDL11/SDL_keysym.h -gui.o: /usr/local/include/SDL11/SDL_mouse.h -gui.o: /usr/local/include/SDL11/SDL_video.h -gui.o: /usr/local/include/SDL11/SDL_mutex.h -gui.o: /usr/local/include/SDL11/SDL_quit.h -gui.o: /usr/local/include/SDL11/SDL_version.h gfx.h util.h exit.h -memmenu.o: /usr/include/stdlib.h /usr/include/sys/cdefs.h -memmenu.o: /usr/include/sys/_null.h /usr/include/sys/_types.h -memmenu.o: /usr/include/machine/_types.h /usr/include/stdio.h -memmenu.o: /usr/include/string.h /usr/include/strings.h /usr/include/ctype.h -memmenu.o: /usr/include/_ctype.h /usr/include/runetype.h memmenu.h z80.h -memmenu.o: z80_config.h zx81.h /usr/local/include/SDL11/SDL.h -memmenu.o: /usr/local/include/SDL11/SDL_main.h -memmenu.o: /usr/local/include/SDL11/SDL_types.h -memmenu.o: /usr/local/include/SDL11/SDL_getenv.h -memmenu.o: /usr/local/include/SDL11/SDL_error.h -memmenu.o: /usr/local/include/SDL11/begin_code.h -memmenu.o: /usr/local/include/SDL11/close_code.h -memmenu.o: /usr/local/include/SDL11/SDL_rwops.h -memmenu.o: /usr/local/include/SDL11/SDL_timer.h -memmenu.o: /usr/local/include/SDL11/SDL_audio.h -memmenu.o: /usr/local/include/SDL11/SDL_byteorder.h -memmenu.o: /usr/local/include/SDL11/SDL_cdrom.h -memmenu.o: /usr/local/include/SDL11/SDL_joystick.h -memmenu.o: /usr/local/include/SDL11/SDL_events.h -memmenu.o: /usr/local/include/SDL11/SDL_active.h -memmenu.o: /usr/local/include/SDL11/SDL_keyboard.h -memmenu.o: /usr/local/include/SDL11/SDL_keysym.h -memmenu.o: /usr/local/include/SDL11/SDL_mouse.h -memmenu.o: /usr/local/include/SDL11/SDL_video.h -memmenu.o: /usr/local/include/SDL11/SDL_mutex.h -memmenu.o: /usr/local/include/SDL11/SDL_quit.h -memmenu.o: /usr/local/include/SDL11/SDL_version.h gfx.h gui.h expr.h util.h -util.o: /usr/include/stdio.h /usr/include/sys/cdefs.h -util.o: /usr/include/sys/_null.h /usr/include/sys/_types.h -util.o: /usr/include/machine/_types.h /usr/include/string.h -util.o: /usr/include/strings.h /usr/include/stdarg.h util.h -util.o: /usr/include/stdlib.h exit.h -exit.o: /usr/include/stdlib.h /usr/include/sys/cdefs.h -exit.o: /usr/include/sys/_null.h /usr/include/sys/_types.h -exit.o: /usr/include/machine/_types.h /usr/include/stdarg.h exit.h -exit.o: /usr/local/include/SDL11/SDL.h /usr/local/include/SDL11/SDL_main.h -exit.o: /usr/local/include/SDL11/SDL_types.h -exit.o: /usr/local/include/SDL11/SDL_getenv.h -exit.o: /usr/local/include/SDL11/SDL_error.h -exit.o: /usr/local/include/SDL11/begin_code.h -exit.o: /usr/local/include/SDL11/close_code.h -exit.o: /usr/local/include/SDL11/SDL_rwops.h /usr/include/stdio.h -exit.o: /usr/local/include/SDL11/SDL_timer.h -exit.o: /usr/local/include/SDL11/SDL_audio.h -exit.o: /usr/local/include/SDL11/SDL_byteorder.h -exit.o: /usr/local/include/SDL11/SDL_cdrom.h -exit.o: /usr/local/include/SDL11/SDL_joystick.h -exit.o: /usr/local/include/SDL11/SDL_events.h -exit.o: /usr/local/include/SDL11/SDL_active.h -exit.o: /usr/local/include/SDL11/SDL_keyboard.h -exit.o: /usr/local/include/SDL11/SDL_keysym.h -exit.o: /usr/local/include/SDL11/SDL_mouse.h -exit.o: /usr/local/include/SDL11/SDL_video.h -exit.o: /usr/local/include/SDL11/SDL_mutex.h -exit.o: /usr/local/include/SDL11/SDL_quit.h -exit.o: /usr/local/include/SDL11/SDL_version.h -expr.o: /usr/include/stdlib.h /usr/include/sys/cdefs.h -expr.o: /usr/include/sys/_null.h /usr/include/sys/_types.h -expr.o: /usr/include/machine/_types.h /usr/include/stdio.h -expr.o: /usr/include/string.h /usr/include/strings.h /usr/include/ctype.h -expr.o: /usr/include/_ctype.h /usr/include/runetype.h -z80.o: /usr/include/stdlib.h /usr/include/sys/cdefs.h -z80.o: /usr/include/sys/_null.h /usr/include/sys/_types.h -z80.o: /usr/include/machine/_types.h /usr/include/string.h -z80.o: /usr/include/strings.h z80.h z80_config.h z80_private.h -z80_decode.o: /usr/include/stdlib.h /usr/include/sys/cdefs.h -z80_decode.o: /usr/include/sys/_null.h /usr/include/sys/_types.h -z80_decode.o: /usr/include/machine/_types.h /usr/include/limits.h -z80_decode.o: /usr/include/sys/limits.h /usr/include/machine/_limits.h -z80_decode.o: /usr/include/sys/syslimits.h z80.h z80_config.h z80_private.h -z80_dis.o: z80_config.h /usr/include/stdio.h /usr/include/sys/cdefs.h -z80_dis.o: /usr/include/sys/_null.h /usr/include/sys/_types.h -z80_dis.o: /usr/include/machine/_types.h /usr/include/string.h -z80_dis.o: /usr/include/strings.h /usr/include/stdarg.h z80.h z80_private.h @@ -33,12 +33,10 @@ static const char ident[]="$Id$"; #include "gfx.h" #include "exit.h" #include "config.h" +#include "util.h" #include "font.h" -static const char ident_h[]=EZX81_GFX_H; -static const char ident_fh[]=EZX81_FONT_H; - /* ---------------------------------------- MACROS */ @@ -50,72 +48,45 @@ static const char ident_fh[]=EZX81_FONT_H; #define FALSE 0 #endif -#define LOCK do \ - { \ - if (SDL_MUSTLOCK(surface)) \ - if (SDL_LockSurface(surface)<0) \ - Exit("Failed to lock surface: %s\n", \ - SDL_GetError()); \ - } while(0) - -#define UNLOCK do \ - { \ - if (SDL_MUSTLOCK(surface)) \ - SDL_UnlockSurface(surface); \ - } while(0) - - /* ---------------------------------------- STATICS */ -static SDL_Surface *surface; +static SDL_Window *window; +static SDL_Renderer *renderer; +static SDL_Texture *texture; +static Uint32 *pixels; static Uint32 ticks; static Uint32 frame; static int scale; static void (*putpixel)(int x, int y, Uint32 col); +#define NO_BMPIX 10 -/* ---------------------------------------- PRIVATE FUNCTIONS -*/ - -/* Taken from SDL documentation -*/ -static void normal_putpixel(int x, int y, Uint32 pixel) +static struct { - int bpp; - Uint8 *p; - - bpp=surface->format->BytesPerPixel; - p=(Uint8 *)surface->pixels+y*surface->pitch+x*bpp; + Uint32 col; + int r,g,b; +} bmpix[NO_BMPIX]= +{ + {0, 0x00,0x00,0x00}, /* BLACK */ + {0, 0x00,0x00,0xff}, /* BLUE */ + {0, 0xff,0x00,0x00}, /* RED */ + {0, 0xff,0x00,0xff}, /* MAGENTA */ + {0, 0x00,0xff,0x00}, /* GREEN */ + {0, 0x00,0xff,0xff}, /* CYAN */ + {0, 0xff,0xff,0x00}, /* YELLOW */ + {0, 0xff,0xff,0xff}, /* WHITE */ + {0, 0x60,0x60,0x60}, /* GREY */ +}; - switch(bpp) - { - case 1: - *p=pixel; - break; - case 2: - *(Uint16 *)p=pixel; - break; - case 3: - if(SDL_BYTEORDER==SDL_BIG_ENDIAN) - { - p[0]=(pixel>>16)&0xff; - p[1]=(pixel>>8)&0xff; - p[2]=pixel&0xff; - } else - { - p[0]=pixel&0xff; - p[1]=(pixel>>8)&0xff; - p[2]=(pixel>>16)&0xff; - } - break; +/* ---------------------------------------- PRIVATE FUNCTIONS +*/ - case 4: - *(Uint32 *)p=pixel; - break; - } +static void normal_putpixel(int x, int y, Uint32 pixel) +{ + pixels[x + y * GFX_WIDTH] = pixel; } @@ -128,7 +99,7 @@ static void scale_putpixel(int x, int y, Uint32 pixel) for(sx=0;sx<scale;sx++) for(sy=0;sy<scale;sy++) - normal_putpixel(x+sx,y+sy,pixel); + pixels[x+sx + (y+sy) * GFX_WIDTH * scale] = pixel; } @@ -146,10 +117,29 @@ static void DoVLine(int x, int y1, int y2, Uint32 col) } +static void BMPlot(int bx, int by, int *x, int *y, int w, int h, int col) +{ + if (*y<h) + { + putpixel(bx+*x,by+*y,bmpix[col].col); + + (*x)++; + + if (*x==w) + { + *x=0; + (*y)++; + } + } +} + + /* ---------------------------------------- EXPORTED INTERFACES */ void GFXInit(void) { + int f; + if (IConfig(CONF_FULLSCREEN)) scale=1; else @@ -166,39 +156,58 @@ void GFXInit(void) frame=1000/IConfig(CONF_FRAMES_PER_SEC); if (SDL_Init(SDL_INIT_TIMER|SDL_INIT_VIDEO)) - Exit("Failed to init SDL: %s\n",SDL_GetError()); + Exit("Failed to init SDL: %s\n",SDL_GetError()); + + if (!(window=SDL_CreateWindow("eSPEC", + SDL_WINDOWPOS_UNDEFINED, + SDL_WINDOWPOS_UNDEFINED, + GFX_WIDTH*scale, + GFX_HEIGHT*scale, + IConfig(CONF_FULLSCREEN) ? + SDL_WINDOW_FULLSCREEN : 0))) + { + Exit("Failed to open window: %s\n",SDL_GetError()); + } - if (!(surface=SDL_SetVideoMode(GFX_WIDTH*scale, - GFX_HEIGHT*scale, - 0, - IConfig(CONF_FULLSCREEN) ? - SDL_FULLSCREEN : 0))) + if (!(renderer = SDL_CreateRenderer(window, -1, 0))) { - Exit("Failed to open video: %s\n",SDL_GetError()); + Exit("Failed to create renderer: %s\n",SDL_GetError()); } - SDL_ShowCursor(SDL_DISABLE); - SDL_WM_SetCaption("eZX81","eZX81"); + if (!(texture = SDL_CreateTexture(renderer, + SDL_PIXELFORMAT_ARGB8888, + SDL_TEXTUREACCESS_STREAMING, + GFX_WIDTH*scale, + GFX_HEIGHT*scale))) + { + Exit("Failed to create texture: %s\n",SDL_GetError()); + } - atexit(SDL_Quit); -} + pixels = Malloc(sizeof(Uint32) * GFX_WIDTH*scale * GFX_HEIGHT*scale); + SDL_ShowCursor(SDL_DISABLE); -SDL_Surface *GFXGetSurface(void) -{ - return surface; + for(f=0;f<NO_BMPIX;f++) + bmpix[f].col=GFXRGB(bmpix[f].r,bmpix[f].g,bmpix[f].b); + + atexit(SDL_Quit); } Uint32 GFXRGB(Uint8 r, Uint8 g, Uint8 b) { - return SDL_MapRGB(surface->format,r,g,b); + return 0xff << 24 | (Uint32)r << 16 | (Uint32)g << 8 | b; } void GFXClear(Uint32 col) { - SDL_FillRect(surface,NULL,col); + int f; + + for(f = 0; f < GFX_WIDTH * scale * GFX_HEIGHT * scale; f++) + { + pixels[f] = col; + } } @@ -210,7 +219,12 @@ void GFXStartFrame(void) void GFXEndFrame(int delay) { - SDL_UpdateRect(surface,0,0,0,0); + SDL_UpdateTexture(texture, NULL, + pixels, GFX_WIDTH * scale * sizeof(Uint32)); + + SDL_RenderClear(renderer); + SDL_RenderCopy(renderer, texture, NULL, NULL); + SDL_RenderPresent(renderer); if (delay) { @@ -224,16 +238,6 @@ void GFXEndFrame(int delay) } -void GFXKeyRepeat(int repeat) -{ - if (repeat) - SDL_EnableKeyRepeat(SDL_DEFAULT_REPEAT_DELAY, - SDL_DEFAULT_REPEAT_INTERVAL); - else - SDL_EnableKeyRepeat(0,0); -} - - SDL_Event *GFXGetKey(void) { static SDL_Event e; @@ -261,48 +265,21 @@ SDL_Event *GFXWaitKey(void) } -void GFXLock(void) -{ - LOCK; -} - - -void GFXUnlock(void) -{ - UNLOCK; -} - - void GFXPlot(int x, int y, Uint32 col) { - LOCK; - - putpixel(x,y,col); - - UNLOCK; -} - - -void GFXFastPlot(int x, int y, Uint32 col) -{ putpixel(x,y,col); } void GFXRect(int x, int y, int w, int h, Uint32 col, int solid) { - LOCK; - if (solid) { - SDL_Rect r; - - r.x=x*scale; - r.y=y*scale; - r.w=w*scale; - r.h=h*scale; - - SDL_FillRect(surface,&r,col); + while(h--) + { + DoHLine(x,x+w-1,y,col); + y++; + } } else { @@ -311,24 +288,18 @@ void GFXRect(int x, int y, int w, int h, Uint32 col, int solid) DoVLine(x,y,y+h-1,col); DoVLine(x+w-1,y,y+h-1,col); } - - UNLOCK; } void GFXHLine(int x1, int x2, int y, Uint32 col) { - LOCK; DoHLine(x1,x2,y,col); - UNLOCK; } void GFXVLine(int x, int y1, int y2, Uint32 col) { - LOCK; DoVLine(x,y1,y2,col); - UNLOCK; } @@ -345,8 +316,6 @@ void GFXPrint(int x, int y, Uint32 col, const char *format, ...) p=buff; - LOCK; - while(*p) { for(sy=0;sy<8;sy++) @@ -364,8 +333,6 @@ void GFXPrint(int x, int y, Uint32 col, const char *format, ...) p++; x+=8; } - - UNLOCK; } @@ -383,8 +350,6 @@ void GFXPrintPaper(int x, int y, Uint32 col, Uint32 paper, p=buff; - LOCK; - while(*p) { for(sy=0;sy<8;sy++) @@ -404,8 +369,44 @@ void GFXPrintPaper(int x, int y, Uint32 col, Uint32 paper, p++; x+=8; } +} + + +void GFXBitmap(int x, int y, int w, int h, const unsigned char *data) +{ + int pix; + int px,py; + + pix=0; + px=0; + py=0; + + while(TRUE) + { + int i; + + i=*data++; + + if (i<0x80) + { + pix=i; + + BMPlot(x,y,&px,&py,w,h,pix); - UNLOCK; + if (py>=h) + break; + } + else + { + int f; + + for (f=0;f<i-0x80;f++) + BMPlot(x,y,&px,&py,w,h,pix); + + if (py>=h) + break; + } + } } @@ -97,27 +97,11 @@ SDL_Event *GFXGetKey(void); SDL_Event *GFXWaitKey(void); -/* Lock the screen for updates -*/ -void GFXLock(void); - - -/* Unlock the screen following updates -*/ -void GFXUnlock(void); - - /* Note that no bound checking (except for GFXPrint()) is done - it is the callers responsibility to plot onscreen. */ -/* Plot a point without locking. GFXLock() and GFXUnlock() MUST surround - calls to this -*/ -void GFXFastPlot(int x, int y, Uint32 col); - - /* Plot a point */ void GFXPlot(int x, int y, Uint32 col); @@ -342,8 +342,6 @@ const char *GUIInputString(const char *prompt, const char *orig) strncat(buff,orig,40); len=strlen(buff); - SDL_EnableUNICODE(1); - while(!done) { GFXRect(0,y_pos,GFX_WIDTH,8,BLACK,TRUE); @@ -372,7 +370,7 @@ const char *GUIInputString(const char *prompt, const char *orig) break; default: - c=(unsigned char)e->key.keysym.unicode; + c=(unsigned char)e->key.keysym.sym; if (len<40 && isprint(c)) { @@ -383,8 +381,6 @@ const char *GUIInputString(const char *prompt, const char *orig) } } - SDL_EnableUNICODE(0); - return buff; } diff --git a/src/memmenu.c b/src/memmenu.c index e7909a9..609d8bc 100644 --- a/src/memmenu.c +++ b/src/memmenu.c @@ -1121,8 +1121,6 @@ int MemoryMenu(Z80 *z80) int quit=FALSE; int y; - GFXKeyRepeat(TRUE); - while(!done) { DisplayMenu(); @@ -1204,8 +1202,6 @@ int MemoryMenu(Z80 *z80) } } - GFXKeyRepeat(FALSE); - GFXClear(BLACK); return quit; } @@ -100,7 +100,7 @@ static Z80Byte matrix[8]; typedef struct { - SDLKey key; + SDL_Keycode key; int m1,b1,m2,b2; } MatrixMap; @@ -493,6 +493,11 @@ void ZX81KeyEvent(SDL_Event *e) { const MatrixMap *m; + if (e->key.repeat) + { + return; + } + m=keymap; while(m->key!=SDLK_UNKNOWN) |