From b369f37c6244b5d56742b56f745219fb2544efe2 Mon Sep 17 00:00:00 2001 From: Ian C Date: Fri, 16 Feb 2007 01:10:41 +0000 Subject: Some hi-res support. Added new config page and averaging touchscreen reads. In process of writing file selector. --- include/config.h | 48 ++++++++++++++++++++++++++++++++++++++++++++++++ include/ds81_debug.h | 36 ++++++++++++++++++++++++++++++++++++ include/framebuffer.h | 1 + include/gui.h | 2 ++ include/touchwrap.h | 38 ++++++++++++++++++++++++++++++++++++++ 5 files changed, 125 insertions(+) create mode 100644 include/config.h create mode 100644 include/ds81_debug.h create mode 100644 include/touchwrap.h (limited to 'include') diff --git a/include/config.h b/include/config.h new file mode 100644 index 0000000..82c0c4f --- /dev/null +++ b/include/config.h @@ -0,0 +1,48 @@ +/* + ds81 - Nintendo DS ZX81 emulator. + + Copyright (C) 2006 Ian Cowburn + + This program is free software; you can redistribute it and/or + modify it under the terms of the GNU General Public License + as published by the Free Software Foundation; either version 2 + of the License, or (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + + $Id$ +*/ +#ifndef DS81_CONFIG_H +#define DS81_CONFIG_H + +typedef enum +{ + DS81_STICKY_SHIFT, + DS81_AVERAGE_TOUCHSCREEN, + DS81_NUM_CONFIG_ITEMS +} DS81_ConfigItem; + +/* Returns TRUE if config loaded from FAT device +*/ +int LoadConfig(void); + +/* Returns TRUE if config saved to FAT device +*/ +int SaveConfig(void); + +/* Gets a description for a config item. +*/ +const char *ConfigDesc(DS81_ConfigItem item); + +/* Table of configs. Done like this for simple performance reasons. +*/ +extern int DS81_Config[/*DS81_ConfigItem item*/]; + +#endif /* DS81_CONFIG_H */ diff --git a/include/ds81_debug.h b/include/ds81_debug.h new file mode 100644 index 0000000..82e8c45 --- /dev/null +++ b/include/ds81_debug.h @@ -0,0 +1,36 @@ +/* + ds81 - Nintendo DS ZX81 emulator. + + Copyright (C) 2006 Ian Cowburn + + This program is free software; you can redistribute it and/or + modify it under the terms of the GNU General Public License + as published by the Free Software Foundation; either version 2 + of the License, or (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + + $Id$ +*/ +#ifndef DS81_DEBUG_H +#define DS81_DEBUG_H + +#include "framebuffer.h" + +#define DS81_DEBUG(fmt, args...) \ + do \ + { \ + FB_FillBox(0,184,256,8,FB_RGB(10,0,0)); \ + FB_printf(0,184,FB_RGB(31,31,31),FB_RGB(10,0,0), fmt , ## args);\ + while (keysDownRepeat()!=KEY_A); \ + } while(0) + + +#endif /* DS81_DEBUG_H */ diff --git a/include/framebuffer.h b/include/framebuffer.h index 2fd7bc3..7b04685 100644 --- a/include/framebuffer.h +++ b/include/framebuffer.h @@ -27,6 +27,7 @@ void FB_Init(uint16 *vram); void FB_Print(const char *text, int x, int y, int colour, int paper); void FB_Centre(const char *text, int y, int colour, int paper); +void FB_printf(int x, int y, int colour, int paper, const char *format, ...); void FB_HLine(int x1, int x2, int y, int colour); void FB_VLine(int x, int y1, int y2, int colour); void FB_Box(int x, int y, int w, int h, int colour); diff --git a/include/gui.h b/include/gui.h index 4a07915..388c200 100644 --- a/include/gui.h +++ b/include/gui.h @@ -24,5 +24,7 @@ int GUI_Menu(const char *opts[]); void GUI_Alert(int fatal, const char *text); +void GUI_Config(void); +bool GUI_FileSelect(char pwd[], char selected_file[], const char *filter); #endif /* DS81_GUI_H */ diff --git a/include/touchwrap.h b/include/touchwrap.h new file mode 100644 index 0000000..1ba9f90 --- /dev/null +++ b/include/touchwrap.h @@ -0,0 +1,38 @@ +/* + ds81 - Nintendo DS ZX81 emulator. + + Copyright (C) 2006 Ian Cowburn + + This program is free software; you can redistribute it and/or + modify it under the terms of the GNU General Public License + as published by the Free Software Foundation; either version 2 + of the License, or (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + + $Id$ +*/ +#ifndef DS81_TOUCHWRAP_H +#define DS81_TOUCHWRAP_H + +/* Don't know whether I have a problem with my DS or the library, but sometimes + the touchscreen value is off (one co-ord generally completely out). + + To alleviate this, and as this is a simple touch screen keyboard, allow + touchs to be averaged if the config says so. And averaged touch just means + that two touchs have to happen within 5 pixels on X and Y before being + allowed. + + If not configured to average, this simply reads the touchscreen position + and returns true. +*/ +int AllowTouch(touchPosition *tp); + +#endif /* DS81_TOUCHWRAP_H */ -- cgit v1.2.3