Commit dabedb42 authored by CeRiAl's avatar CeRiAl

Several (dumb?) changes for initial port to mingw32ce

parent f2fc773b
.gitignore # Files to ignore
Makefile.in
aclocal.m4 aclocal.m4
autom4te.cache/ autom4te.cache
.deps
Makefile
Makefile.in
*~
*.o
*.a
configure configure
src/Makefile.in config.log
src/archivers/dms/Makefile.in config.status
src/archivers/zip/Makefile.in sysconfig.h
src/caps/Makefile.in stamp-h1
src/gfx-amigaos/Makefile.in
src/gfx-beos/Makefile.in # Eclipse project files
src/gfx-cocoa/Makefile.in /.project
src/gfx-curses/Makefile.in /.cproject
src/gfx-sdl/Makefile.in /.settings
src/gfx-x11/Makefile.in /.autotools
src/gui-beos/Makefile.in
src/gui-cocoa/Makefile.in # mingw32/cygwin and mingw32ce (WinCE) related
src/gui-gtk/Makefile.in *.exe
src/gui-muirexx/Makefile.in /cerial_compile.txt
src/gui-none/Makefile.in /_testbed_/
src/gui-qt/Makefile.in /src/uae.rc
src/jd-amigainput/Makefile.in
src/jd-amigaos/Makefile.in /df0.adz
src/jd-beos/Makefile.in /kick.rom
src/jd-linuxold/Makefile.in /drive_sounds.zip
src/jd-none/Makefile.in
src/jd-sdl/Makefile.in /src/gfxdep
src/keymap/Makefile.in /src/guidep
src/md-68k/Makefile.in /src/joydep
src/md-amd64-gcc/Makefile.in /src/machdep
src/md-generic/Makefile.in /src/osdep
src/md-i386-gcc/Makefile.in /src/sounddep
src/md-ppc-gcc/Makefile.in /src/threaddep
src/md-ppc/Makefile.in /src/PUAE.app
src/od-amiga/Makefile.in /src/od-macosx/Credits.rtf
src/od-beos/Makefile.in /src/od-macosx/Info.plist
src/od-generic/Makefile.in
src/od-linux/Makefile.in # symbolic links (under cygwin they are real files)
src/od-macosx/Makefile.in /src/md-fpp.h
src/od-win32/Makefile.in /src/target.h
src/sd-alsa/Makefile.in /src/tools/blitops.c
src/sd-amigaos/Makefile.in /src/tools/build68k.c
src/sd-beos/Makefile.in /src/tools/cpudefs.c
src/sd-none/Makefile.in /src/tools/genblitter.c
src/sd-sdl/Makefile.in /src/tools/gencomp.c
src/sd-solaris/Makefile.in /src/tools/gencpu.c
src/sd-uss/Makefile.in /src/tools/genlinetoscr.c
src/td-amigaos/Makefile.in /src/tools/missing.c
src/td-beos/Makefile.in /src/tools/readcpu.c
src/td-none/Makefile.in /src/tools/writelog.c
src/td-posix/Makefile.in
src/td-sdl/Makefile.in # generated files
src/td-win32/Makefile.in # blitter
src/test/Makefile.in /src/blit.h
src/tools/autom4te.cache/ /src/blitfunc.c
src/tools/configure /src/blitfunc.h
/src/blittable.c
/src/linetoscr.c
# cpu
/src/cpudefs.c
/src/cputbl.h
/src/cpustbl.c
/src/compemu.c
/src/comptbl.h
/src/compstbl.c
/src/cpuemu_0.c
/src/cpuemu_11.c
/src/cpuemu_12.c
/src/cpuemu_20.c
/src/cpuemu_21.c
/src/cpuemu_31.c
# jit
/src/compemu.cpp
/src/compstbl.h
/src/compstbl.cpp
#Ignore default Visual Studio build folders
[Dd]ebug/
[Rr]elease/
# P-UAE
#
# 2006-2011 Mustafa TUFAN (aka GnoStiC/BRONX)
#
#
#
base=" --with-sdl --with-sdl-gfx --with-sdl-sound --enable-drvsnd "
cd32=" --enable-cd32 "
a600=" --enable-gayle "
#scsi=" --enable-scsi-device --enable-ncr --enable-a2091 "
scsi=""
other=" --with-caps --enable-amax --disable-jit"
#
#
./bootstrap.sh
./configure $base $cd32 $a600 $scsi $other CFLAGS="-D_WIN32 -I/usr/local/include -mno-cygwin -mwindows" CPPFLAGS="-D_WIN32 -I/usr/local/include -mno-cygwin -mwindows" LDFLAGS="-D_WIN32 -L/usr/local/lib -mno-cygwin -mwindows"
make clean
make
...@@ -376,6 +376,10 @@ case $host_os in ...@@ -376,6 +376,10 @@ case $host_os in
mingw32*) mingw32*)
HOST_OS=win32 HOST_OS=win32
OSDEP=od-win32 OSDEP=od-win32
;;
cygwin)
HOST_OS=win32
OSDEP=od-win32
esac esac
AC_MSG_RESULT([$HOST_OS]) AC_MSG_RESULT([$HOST_OS])
...@@ -1249,9 +1253,16 @@ dnl ...@@ -1249,9 +1253,16 @@ dnl
if [[ "$GUI_DEP" = "gui-none" ]]; then if [[ "$GUI_DEP" = "gui-none" ]]; then
if [[ "x$HAVE_GTK" = "xno" ]]; then if [[ "x$HAVE_GTK" = "xno" ]]; then
AC_MSG_WARN([UI wanted, but no UI useable target found]) if [[ "x$HAVE_SDL" = "xno" ]]; then
NR_ERRORS=`expr $NR_ERRORS + 1` AC_MSG_WARN([UI wanted, but no UI useable target found])
WANT_UI=no NR_ERRORS=`expr $NR_ERRORS + 1`
WANT_UI=no
else
GUI_DEP=gui-sdl
GUI_LIBS="-lSDL_image -lSDL_ttf $SDL_LIBS"
GUI_NAME="SDL"
GUI_CFLAGS="$CFLAGS"
fi
else else
GUI_DEP=gui-gtk GUI_DEP=gui-gtk
GUI_LIBS="$GTK_LIBS" GUI_LIBS="$GTK_LIBS"
...@@ -2036,6 +2047,7 @@ AC_CONFIG_FILES([Makefile ...@@ -2036,6 +2047,7 @@ AC_CONFIG_FILES([Makefile
src/gui-gtk/Makefile src/gui-gtk/Makefile
src/gui-muirexx/Makefile src/gui-muirexx/Makefile
src/gui-qt/Makefile src/gui-qt/Makefile
src/gui-sdl/Makefile
src/keymap/Makefile src/keymap/Makefile
src/test/Makefile src/test/Makefile
]) ])
......
...@@ -30,7 +30,7 @@ DIST_SUBDIRS = \ ...@@ -30,7 +30,7 @@ DIST_SUBDIRS = \
gfx-amigaos gfx-beos gfx-x11 gfx-sdl gfx-curses gfx-svga gfx-cocoa \ gfx-amigaos gfx-beos gfx-x11 gfx-sdl gfx-curses gfx-svga gfx-cocoa \
sd-none sd-alsa sd-amigaos sd-beos sd-sdl sd-solaris sd-uss \ sd-none sd-alsa sd-amigaos sd-beos sd-sdl sd-solaris sd-uss \
jd-none jd-amigainput jd-amigaos jd-beos jd-linuxold jd-sdl \ jd-none jd-amigainput jd-amigaos jd-beos jd-linuxold jd-sdl \
gui-none gui-beos gui-cocoa gui-gtk gui-muirexx \ gui-none gui-beos gui-cocoa gui-gtk gui-muirexx gui-sdl \
od-generic od-amiga od-beos od-linux od-macosx od-win32 \ od-generic od-amiga od-beos od-linux od-macosx od-win32 \
td-none td-amigaos td-beos td-posix td-sdl td-win32 \ td-none td-amigaos td-beos td-posix td-sdl td-win32 \
keymap caps archivers/dms archivers/zip keymap caps archivers/dms archivers/zip
......
...@@ -4942,4 +4942,3 @@ void config_check_vsync (void) ...@@ -4942,4 +4942,3 @@ void config_check_vsync (void)
config_changed = 0; config_changed = 0;
} }
} }
...@@ -1678,6 +1678,7 @@ STATIC_INLINE void raw_inc_sp(int off) ...@@ -1678,6 +1678,7 @@ STATIC_INLINE void raw_inc_sp(int off)
#ifdef NATMEM_OFFSET #ifdef NATMEM_OFFSET
#ifdef _WIN32 // %%% BRIAN KING WAS HERE %%% #ifdef _WIN32 // %%% BRIAN KING WAS HERE %%%
#include <windows.h>
#include <winbase.h> #include <winbase.h>
#else #else
#ifndef __USE_GNU #ifndef __USE_GNU
......
...@@ -21,7 +21,7 @@ ...@@ -21,7 +21,7 @@
// %%% BRIAN KING WAS HERE %%% // %%% BRIAN KING WAS HERE %%%
extern bool canbang; extern bool canbang;
#include <sys/mman.h> // #include <sys/mman.h>
extern void jit_abort(const TCHAR*,...); extern void jit_abort(const TCHAR*,...);
compop_func *compfunctbl[65536]; compop_func *compfunctbl[65536];
compop_func *nfcompfunctbl[65536]; compop_func *nfcompfunctbl[65536];
...@@ -125,9 +125,9 @@ static uae_s32 nextused[VREGS]; ...@@ -125,9 +125,9 @@ static uae_s32 nextused[VREGS];
static uae_u8 *popallspace; static uae_u8 *popallspace;
#ifdef NATMEM_OFFSET #ifdef NATMEM_OFFSET
# ifndef WIN32 // # ifndef WIN32
struct sigaction *saved_handler; struct sigaction *saved_handler;
# endif // # endif
#endif #endif
uae_u32 m68k_pc_offset; uae_u32 m68k_pc_offset;
......
...@@ -65,7 +65,8 @@ extern int inputdevice_logging; ...@@ -65,7 +65,8 @@ extern int inputdevice_logging;
static FILE *logfile; static FILE *logfile;
#ifndef _WIN32 //#ifndef _WIN32
#if 1
#define console_out printf #define console_out printf
#define console_flush() fflush( stdout ) #define console_flush() fflush( stdout )
#define console_get( input, len ) fgets( input, len, stdin ) #define console_get( input, len ) fgets( input, len, stdin )
...@@ -3307,7 +3308,8 @@ static bool debug_line (TCHAR *input) ...@@ -3307,7 +3308,8 @@ static bool debug_line (TCHAR *input)
} else if (*inptr == 't') { } else if (*inptr == 't') {
next_char (&inptr); next_char (&inptr);
debugtest_set (&inptr); debugtest_set (&inptr);
#ifdef _WIN32 //#ifdef _WIN32
#if 0
} else if (*inptr == 'g') { } else if (*inptr == 'g') {
extern void update_disassembly (uae_u32); extern void update_disassembly (uae_u32);
next_char (&inptr); next_char (&inptr);
...@@ -3476,7 +3478,8 @@ static bool debug_line (TCHAR *input) ...@@ -3476,7 +3478,8 @@ static bool debug_line (TCHAR *input)
{ {
uae_u32 maddr; uae_u32 maddr;
int lines; int lines;
#ifdef _WIN32 //#ifdef _WIN32
#if 0
if (*inptr == 'g') { if (*inptr == 'g') {
extern void update_memdump (uae_u32); extern void update_memdump (uae_u32);
next_char (&inptr); next_char (&inptr);
......
...@@ -44,7 +44,8 @@ TCHAR *nname_begin (TCHAR *nname) ...@@ -44,7 +44,8 @@ TCHAR *nname_begin (TCHAR *nname)
return nname; return nname;
} }
#ifndef _WIN32 //#ifndef _WIN32
#if 1
/* Find the name REL in directory DIRNAME. If we find a file that /* Find the name REL in directory DIRNAME. If we find a file that
* has exactly the same name, return REL. If we find a file that * has exactly the same name, return REL. If we find a file that
* has the same name when compared case-insensitively, return a * has the same name when compared case-insensitively, return a
......
...@@ -4,6 +4,6 @@ AM_CFLAGS = @UAE_CFLAGS@ ...@@ -4,6 +4,6 @@ AM_CFLAGS = @UAE_CFLAGS@
noinst_LIBRARIES = libgfxdep.a noinst_LIBRARIES = libgfxdep.a
libgfxdep_a_SOURCES = sdlgfx.c sdlkeys.c sdlkeys_dik.c rawkeys.c libgfxdep_a_SOURCES = sdlgfx.c sdlkeys.c sdlkeys_dik.c rawkeys.c SDL_TouchUI.c
noinst_HEADERS = gfx.h sdlgfx.h noinst_HEADERS = gfx.h sdlgfx.h
...@@ -70,6 +70,8 @@ unsigned int shading_enabled = 0; ...@@ -70,6 +70,8 @@ unsigned int shading_enabled = 0;
#include "hotkeys.h" #include "hotkeys.h"
#include "sdlgfx.h" #include "sdlgfx.h"
#include <SDL_TouchUI.h>
/* Uncomment for debugging output */ /* Uncomment for debugging output */
//#define DEBUG //#define DEBUG
#ifdef DEBUG #ifdef DEBUG
...@@ -746,6 +748,8 @@ static void sdl_unlock_nolock (struct vidbuf_description *gfxinfo) ...@@ -746,6 +748,8 @@ static void sdl_unlock_nolock (struct vidbuf_description *gfxinfo)
STATIC_INLINE void sdl_flush_block_nolock (struct vidbuf_description *gfxinfo, int first_line, int last_line) STATIC_INLINE void sdl_flush_block_nolock (struct vidbuf_description *gfxinfo, int first_line, int last_line)
{ {
SDL_TUI_UpdateRect (0, first_line, current_width, last_line - first_line + 1);
SDL_UpdateRect (display, 0, first_line, current_width, last_line - first_line + 1); SDL_UpdateRect (display, 0, first_line, current_width, last_line - first_line + 1);
} }
...@@ -821,6 +825,9 @@ static void sdl_flush_clear_screen (struct vidbuf_description *gfxinfo) ...@@ -821,6 +825,9 @@ static void sdl_flush_clear_screen (struct vidbuf_description *gfxinfo)
if (display) { if (display) {
SDL_Rect rect = { 0, 0, display->w, display->h }; SDL_Rect rect = { 0, 0, display->w, display->h };
SDL_FillRect (display, &rect, SDL_MapRGB (display->format, 0,0,0)); SDL_FillRect (display, &rect, SDL_MapRGB (display->format, 0,0,0));
SDL_TUI_UpdateRect (0, 0, rect.w, rect.h);
SDL_UpdateRect (display, 0, 0, rect.w, rect.h); SDL_UpdateRect (display, 0, 0, rect.w, rect.h);
} }
} }
...@@ -1173,6 +1180,8 @@ static int graphics_subinit (void) ...@@ -1173,6 +1180,8 @@ static int graphics_subinit (void)
} }
#endif /* USE_GL */ #endif /* USE_GL */
SDL_TUI_Init("sdl_touchui.xml", "keyboard-off");
/* Set UAE window title and icon name */ /* Set UAE window title and icon name */
setmaintitle (); setmaintitle ();
...@@ -1289,7 +1298,10 @@ void handle_events (void) ...@@ -1289,7 +1298,10 @@ void handle_events (void)
{ {
SDL_Event rEvent; SDL_Event rEvent;
//SDL_TUI_UpdateAll();
while (SDL_PollEvent (&rEvent)) { while (SDL_PollEvent (&rEvent)) {
SDL_TUI_HandleEvent(&rEvent);
switch (rEvent.type) { switch (rEvent.type) {
case SDL_QUIT: case SDL_QUIT:
DEBUG_LOG ("Event: quit\n"); DEBUG_LOG ("Event: quit\n");
...@@ -1403,6 +1415,8 @@ void handle_events (void) ...@@ -1403,6 +1415,8 @@ void handle_events (void)
if (!currprefs.use_gl) { if (!currprefs.use_gl) {
# endif /* USE_GL */ # endif /* USE_GL */
if (screen_is_picasso && refresh_necessary) { if (screen_is_picasso && refresh_necessary) {
SDL_TUI_UpdateRect (0, 0, picasso_vidinfo.width, picasso_vidinfo.height);
SDL_UpdateRect (screen, 0, 0, picasso_vidinfo.width, picasso_vidinfo.height); SDL_UpdateRect (screen, 0, 0, picasso_vidinfo.width, picasso_vidinfo.height);
refresh_necessary = 0; refresh_necessary = 0;
memset (picasso_invalid_lines, 0, sizeof picasso_invalid_lines); memset (picasso_invalid_lines, 0, sizeof picasso_invalid_lines);
...@@ -1439,7 +1453,9 @@ void handle_events (void) ...@@ -1439,7 +1453,9 @@ void handle_events (void)
updaterecs[urc].h = i - strt; updaterecs[urc].h = i - strt;
urc++; urc++;
# else # else
SDL_UpdateRect (screen, 0, strt, picasso_vidinfo.width, i - strt); SDL_TUI_UpdateRect (0, strt, picasso_vidinfo.width, i - strt);
SDL_UpdateRect (screen, 0, strt, picasso_vidinfo.width, i - strt);
# endif # endif
strt = -1; strt = -1;
} }
...@@ -1447,7 +1463,9 @@ void handle_events (void) ...@@ -1447,7 +1463,9 @@ void handle_events (void)
if (strt != -1) if (strt != -1)
abort (); abort ();
# ifdef OPTIMIZE_UPDATE_RECS # ifdef OPTIMIZE_UPDATE_RECS
SDL_UpdateRects (screen, urc, updaterecs); SDL_TUI_UpdateRects (urc, updaterecs);
SDL_UpdateRects (screen, urc, updaterecs);
# endif # endif
} }
picasso_has_invalid_lines = 0; picasso_has_invalid_lines = 0;
......
...@@ -100,7 +100,9 @@ static int kc_decode (int keysym) ...@@ -100,7 +100,9 @@ static int kc_decode (int keysym)
case SDLK_RMETA: return AK_RAMI; case SDLK_RMETA: return AK_RAMI;
case SDLK_LMETA: return AK_LAMI; case SDLK_LMETA: return AK_LAMI;
case SDLK_RETURN: return AK_RET; case SDLK_RETURN: return AK_RET;
case SDLK_SPACE: return AK_SPC; // case SDLK_SPACE: return AK_SPC;
case SDLK_SPACE: return AKS_ENTERGUI;
case SDLK_LSHIFT: return AK_LSH; case SDLK_LSHIFT: return AK_LSH;
case SDLK_RSHIFT: return AK_RSH; case SDLK_RSHIFT: return AK_RSH;
case SDLK_ESCAPE: return AK_ESC; case SDLK_ESCAPE: return AK_ESC;
......
AM_CPPFLAGS = @UAE_CPPFLAGS@
AM_CPPFLAGS += -I$(top_srcdir)/src/include -I$(top_builddir)/src -I$(top_srcdir)/src
AM_CFLAGS = @UAE_CFLAGS@
AM_CFLAGS += @SDL_CFLAGS@
noinst_LIBRARIES = libguidep.a
libguidep_a_SOURCES = inputmode.c menu.c menu_load.c menu_prefs.c menu_tweak.c vkbd.cpp volumecontrol.c
noinst_HEADERS = inputmode.h menu.h vkbd.h volumecontrol.h
# Makefile.in generated by automake 1.11.1 from Makefile.am.
# @configure_input@
# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
# 2003, 2004, 2005, 2006, 2007, 2008, 2009 Free Software Foundation,
# Inc.
# This Makefile.in is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
# PARTICULAR PURPOSE.
@SET_MAKE@
VPATH = @srcdir@
pkgdatadir = $(datadir)/@PACKAGE@
pkgincludedir = $(includedir)/@PACKAGE@
pkglibdir = $(libdir)/@PACKAGE@
pkglibexecdir = $(libexecdir)/@PACKAGE@
am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
install_sh_DATA = $(install_sh) -c -m 644
install_sh_PROGRAM = $(install_sh) -c
install_sh_SCRIPT = $(install_sh) -c
INSTALL_HEADER = $(INSTALL_DATA)
transform = $(program_transform_name)
NORMAL_INSTALL = :
PRE_INSTALL = :
POST_INSTALL = :
NORMAL_UNINSTALL = :
PRE_UNINSTALL = :
POST_UNINSTALL = :
build_triplet = @build@
host_triplet = @host@
target_triplet = @target@
subdir = src/gui-sdl
DIST_COMMON = $(noinst_HEADERS) $(srcdir)/Makefile.am \
$(srcdir)/Makefile.in
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
am__aclocal_m4_deps = $(top_srcdir)/m4/acx_pthread.m4 \
$(top_srcdir)/m4/as-objc.m4 \
$(top_srcdir)/m4/ax_check_compiler_flags.m4 \
$(top_srcdir)/m4/ax_gcc_archflag.m4 \
$(top_srcdir)/m4/ax_gcc_x86_cpuid.m4 \
$(top_srcdir)/m4/framework.m4 $(top_srcdir)/m4/fsusage.m4 \
$(top_srcdir)/m4/gtk-2.0.m4 $(top_srcdir)/m4/gtk.m4 \
$(top_srcdir)/m4/sdl.m4 $(top_srcdir)/m4/type_socklen_t.m4 \
$(top_srcdir)/m4/uintmax_t.m4 $(top_srcdir)/configure.in
am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
$(ACLOCAL_M4)
mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs
CONFIG_HEADER = $(top_builddir)/src/sysconfig.h
CONFIG_CLEAN_FILES =
CONFIG_CLEAN_VPATH_FILES =
LIBRARIES = $(noinst_LIBRARIES)
ARFLAGS = cru
libguidep_a_AR = $(AR) $(ARFLAGS)
libguidep_a_LIBADD =
am_libguidep_a_OBJECTS = inputmode.$(OBJEXT) menu.$(OBJEXT) \
menu_load.$(OBJEXT) menu_prefs.$(OBJEXT) menu_tweak.$(OBJEXT) \
vkbd.$(OBJEXT) volumecontrol.$(OBJEXT)
libguidep_a_OBJECTS = $(am_libguidep_a_OBJECTS)
DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir)/src
depcomp = $(SHELL) $(top_srcdir)/depcomp
am__depfiles_maybe = depfiles
am__mv = mv -f
COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
$(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
CCLD = $(CC)
LINK = $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@
CXXCOMPILE = $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \
$(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS)
CXXLD = $(CXX)
CXXLINK = $(CXXLD) $(AM_CXXFLAGS) $(CXXFLAGS) $(AM_LDFLAGS) $(LDFLAGS) \
-o $@
SOURCES = $(libguidep_a_SOURCES)
DIST_SOURCES = $(libguidep_a_SOURCES)
HEADERS = $(noinst_HEADERS)
ETAGS = etags
CTAGS = ctags
DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
ACLOCAL = @ACLOCAL@
AMTAR = @AMTAR@
AR = @AR@
ASMOBJS = @ASMOBJS@
AUTOCONF = @AUTOCONF@
AUTOHEADER = @AUTOHEADER@
AUTOMAKE = @AUTOMAKE@
AWK = @AWK@
BSDSOCKOBJS = @BSDSOCKOBJS@
CC = @CC@
CCAS = @CCAS@
CCASDEPMODE = @CCASDEPMODE@
CCASFLAGS = @CCASFLAGS@
CCDEPMODE = @CCDEPMODE@
CDOBJS = @CDOBJS@
CFLAGS = @CFLAGS@
CPP = @CPP@
CPPFLAGS = @CPPFLAGS@
CPUOBJS = @CPUOBJS@
CXX = @CXX@
CXXDEPMODE = @CXXDEPMODE@
CXXFLAGS = @CXXFLAGS@
CYGPATH_W = @CYGPATH_W@
DEBUGOBJS = @DEBUGOBJS@
DEFS = @DEFS@
DEPDIR = @DEPDIR@
ECHO_C = @ECHO_C@
ECHO_N = @ECHO_N@
ECHO_T = @ECHO_T@
EGREP = @EGREP@
EXEEXT = @EXEEXT@
EXTRAOBJS = @EXTRAOBJS@
FILEPRG = @FILEPRG@
FILESYSOBJS = @FILESYSOBJS@
GENCPUOPTS = @GENCPUOPTS@
GFX_DEP = @GFX_DEP@
GREP = @GREP@
GTK_CFLAGS = @GTK_CFLAGS@
GTK_CONFIG = @GTK_CONFIG@
GTK_LIBS = @GTK_LIBS@
GUI_DEP = @GUI_DEP@
INSTALL = @INSTALL@
INSTALL_DATA = @INSTALL_DATA@
INSTALL_PROGRAM = @INSTALL_PROGRAM@
INSTALL_SCRIPT = @INSTALL_SCRIPT@
INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
JITOBJS = @JITOBJS@
JOY_DEP = @JOY_DEP@
LDFLAGS = @LDFLAGS@
LIBOBJS = @LIBOBJS@
LIBS = @LIBS@
LTLIBOBJS = @LTLIBOBJS@
MACHDEP = @MACHDEP@
MAKEDEPPRG = @MAKEDEPPRG@
MAKEINFO = @MAKEINFO@
MATHLIB = @MATHLIB@
MKDIR_P = @MKDIR_P@
NO_SCHED_CFLAGS = @NO_SCHED_CFLAGS@
OBJC = @OBJC@
OBJCDEPMODE = @OBJCDEPMODE@
OBJC_LDFLAGS = @OBJC_LDFLAGS@
OBJEXT = @OBJEXT@
OSDEP = @OSDEP@
PACKAGE = @PACKAGE@
PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
PACKAGE_NAME = @PACKAGE_NAME@
PACKAGE_STRING = @PACKAGE_STRING@
PACKAGE_TARNAME = @PACKAGE_TARNAME@
PACKAGE_URL = @PACKAGE_URL@
PACKAGE_VERSION = @PACKAGE_VERSION@
PATH_SEPARATOR = @PATH_SEPARATOR@
PKG_CONFIG = @PKG_CONFIG@
PRTDIAG = @PRTDIAG@
PTHREAD_CC = @PTHREAD_CC@
PTHREAD_CFLAGS = @PTHREAD_CFLAGS@
PTHREAD_LIBS = @PTHREAD_LIBS@
RANLIB = @RANLIB@
RCLPRG = @RCLPRG@
RESOBJS = @RESOBJS@
SCSIOBJS = @SCSIOBJS@
SDL_CFLAGS = @SDL_CFLAGS@
SDL_CONFIG = @SDL_CONFIG@
SDL_LIBS = @SDL_LIBS@
SET_MAKE = @SET_MAKE@
SHELL = @SHELL@
SND_DEP = @SND_DEP@
STRIP = @STRIP@
TARGET = @TARGET@
THREADDEP = @THREADDEP@
UAE_CFLAGS = @UAE_CFLAGS@
UAE_CPPFLAGS = @UAE_CPPFLAGS@
UAE_LIBS = @UAE_LIBS@
UAE_RSRCFILE = @UAE_RSRCFILE@
VERSION = @VERSION@
WRCPRG = @WRCPRG@
XMKMF = @XMKMF@
X_CFLAGS = @X_CFLAGS@
X_EXTRA_LIBS = @X_EXTRA_LIBS@
X_LIBS = @X_LIBS@
X_PRE_LIBS = @X_PRE_LIBS@
abs_builddir = @abs_builddir@
abs_srcdir = @abs_srcdir@
abs_top_builddir = @abs_top_builddir@
abs_top_srcdir = @abs_top_srcdir@
ac_ct_CC = @ac_ct_CC@
ac_ct_CXX = @ac_ct_CXX@
ac_ct_OBJC = @ac_ct_OBJC@
ac_cv_c_inline = @ac_cv_c_inline@
am__include = @am__include@
am__leading_dot = @am__leading_dot@
am__quote = @am__quote@
am__tar = @am__tar@
am__untar = @am__untar@
bindir = @bindir@
build = @build@
build_alias = @build_alias@
build_cpu = @build_cpu@
build_os = @build_os@
build_vendor = @build_vendor@
builddir = @builddir@
datadir = @datadir@
datarootdir = @datarootdir@
docdir = @docdir@
dvidir = @dvidir@
exec_prefix = @exec_prefix@
host = @host@
host_alias = @host_alias@
host_cpu = @host_cpu@
host_os = @host_os@
host_vendor = @host_vendor@
htmldir = @htmldir@
includedir = @includedir@
infodir = @infodir@
install_sh = @install_sh@
libdir = @libdir@
libexecdir = @libexecdir@
localedir = @localedir@
localstatedir = @localstatedir@
mandir = @mandir@
mkdir_p = @mkdir_p@
oldincludedir = @oldincludedir@
pdfdir = @pdfdir@
prefix = @prefix@
program_transform_name = @program_transform_name@
psdir = @psdir@
sbindir = @sbindir@
sharedstatedir = @sharedstatedir@
srcdir = @srcdir@
subdirs = @subdirs@
sysconfdir = @sysconfdir@
target = @target@
target_alias = @target_alias@
target_cpu = @target_cpu@
target_os = @target_os@
target_vendor = @target_vendor@
top_build_prefix = @top_build_prefix@
top_builddir = @top_builddir@
top_srcdir = @top_srcdir@
AM_CPPFLAGS = @UAE_CPPFLAGS@ -I$(top_srcdir)/src/include \
-I$(top_builddir)/src -I$(top_srcdir)/src
AM_CFLAGS = @UAE_CFLAGS@ @SDL_CFLAGS@
noinst_LIBRARIES = libguidep.a
libguidep_a_SOURCES = inputmode.c menu.c menu_load.c menu_prefs.c menu_tweak.c vkbd.cpp volumecontrol.c
noinst_HEADERS = inputmode.h menu.h vkbd.h volumecontrol.h
all: all-am
.SUFFIXES:
.SUFFIXES: .c .cpp .o .obj
$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps)
@for dep in $?; do \
case '$(am__configure_deps)' in \
*$$dep*) \
( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \
&& { if test -f $@; then exit 0; else break; fi; }; \
exit 1;; \
esac; \
done; \
echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign src/gui-sdl/Makefile'; \
$(am__cd) $(top_srcdir) && \
$(AUTOMAKE) --foreign src/gui-sdl/Makefile
.PRECIOUS: Makefile
Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
@case '$?' in \
*config.status*) \
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
*) \
echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
esac;
$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
$(top_srcdir)/configure: $(am__configure_deps)
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
$(ACLOCAL_M4): $(am__aclocal_m4_deps)
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
$(am__aclocal_m4_deps):
clean-noinstLIBRARIES:
-test -z "$(noinst_LIBRARIES)" || rm -f $(noinst_LIBRARIES)
libguidep.a: $(libguidep_a_OBJECTS) $(libguidep_a_DEPENDENCIES)
-rm -f libguidep.a
$(libguidep_a_AR) libguidep.a $(libguidep_a_OBJECTS) $(libguidep_a_LIBADD)
$(RANLIB) libguidep.a
mostlyclean-compile:
-rm -f *.$(OBJEXT)
distclean-compile:
-rm -f *.tab.c
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/inputmode.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/menu.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/menu_load.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/menu_prefs.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/menu_tweak.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/vkbd.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/volumecontrol.Po@am__quote@
.c.o:
@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@ $(COMPILE) -c $<
.c.obj:
@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'`
@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@ $(COMPILE) -c `$(CYGPATH_W) '$<'`
.cpp.o:
@am__fastdepCXX_TRUE@ $(CXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
@am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCXX_FALSE@ $(CXXCOMPILE) -c -o $@ $<
.cpp.obj:
@am__fastdepCXX_TRUE@ $(CXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'`
@am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCXX_FALSE@ $(CXXCOMPILE) -c -o $@ `$(CYGPATH_W) '$<'`
ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
unique=`for i in $$list; do \
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
done | \
$(AWK) '{ files[$$0] = 1; nonempty = 1; } \
END { if (nonempty) { for (i in files) print i; }; }'`; \
mkid -fID $$unique
tags: TAGS
TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
$(TAGS_FILES) $(LISP)
set x; \
here=`pwd`; \
list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
unique=`for i in $$list; do \
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
done | \
$(AWK) '{ files[$$0] = 1; nonempty = 1; } \
END { if (nonempty) { for (i in files) print i; }; }'`; \
shift; \
if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \
test -n "$$unique" || unique=$$empty_fix; \
if test $$# -gt 0; then \
$(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
"$$@" $$unique; \
else \
$(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
$$unique; \
fi; \
fi
ctags: CTAGS
CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
$(TAGS_FILES) $(LISP)
list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
unique=`for i in $$list; do \
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
done | \
$(AWK) '{ files[$$0] = 1; nonempty = 1; } \
END { if (nonempty) { for (i in files) print i; }; }'`; \
test -z "$(CTAGS_ARGS)$$unique" \
|| $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
$$unique
GTAGS:
here=`$(am__cd) $(top_builddir) && pwd` \
&& $(am__cd) $(top_srcdir) \
&& gtags -i $(GTAGS_ARGS) "$$here"
distclean-tags:
-rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
distdir: $(DISTFILES)
@srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
list='$(DISTFILES)'; \
dist_files=`for file in $$list; do echo $$file; done | \
sed -e "s|^$$srcdirstrip/||;t" \
-e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \
case $$dist_files in \
*/*) $(MKDIR_P) `echo "$$dist_files" | \
sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \
sort -u` ;; \
esac; \
for file in $$dist_files; do \
if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
if test -d $$d/$$file; then \
dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
if test -d "$(distdir)/$$file"; then \
find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
fi; \
if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \
find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
fi; \
cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \
else \
test -f "$(distdir)/$$file" \
|| cp -p $$d/$$file "$(distdir)/$$file" \
|| exit 1; \
fi; \
done
check-am: all-am
check: check-am
all-am: Makefile $(LIBRARIES) $(HEADERS)
installdirs:
install: install-am
install-exec: install-exec-am
install-data: install-data-am
uninstall: uninstall-am
install-am: all-am
@$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
installcheck: installcheck-am
install-strip:
$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
`test -z '$(STRIP)' || \
echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
mostlyclean-generic:
clean-generic:
distclean-generic:
-test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
-test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES)
maintainer-clean-generic:
@echo "This command is intended for maintainers to use"
@echo "it deletes files that may require special tools to rebuild."
clean: clean-am
clean-am: clean-generic clean-noinstLIBRARIES mostlyclean-am
distclean: distclean-am
-rm -rf ./$(DEPDIR)
-rm -f Makefile
distclean-am: clean-am distclean-compile distclean-generic \
distclean-tags
dvi: dvi-am
dvi-am:
html: html-am
html-am:
info: info-am
info-am:
install-data-am:
install-dvi: install-dvi-am
install-dvi-am:
install-exec-am:
install-html: install-html-am
install-html-am:
install-info: install-info-am
install-info-am:
install-man:
install-pdf: install-pdf-am
install-pdf-am:
install-ps: install-ps-am
install-ps-am:
installcheck-am:
maintainer-clean: maintainer-clean-am
-rm -rf ./$(DEPDIR)
-rm -f Makefile
maintainer-clean-am: distclean-am maintainer-clean-generic
mostlyclean: mostlyclean-am
mostlyclean-am: mostlyclean-compile mostlyclean-generic
pdf: pdf-am
pdf-am:
ps: ps-am
ps-am:
uninstall-am:
.MAKE: install-am install-strip
.PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \
clean-noinstLIBRARIES ctags distclean distclean-compile \
distclean-generic distclean-tags distdir dvi dvi-am html \
html-am info info-am install install-am install-data \
install-data-am install-dvi install-dvi-am install-exec \
install-exec-am install-html install-html-am install-info \
install-info-am install-man install-pdf install-pdf-am \
install-ps install-ps-am install-strip installcheck \
installcheck-am installdirs maintainer-clean \
maintainer-clean-generic mostlyclean mostlyclean-compile \
mostlyclean-generic pdf pdf-am ps ps-am tags uninstall \
uninstall-am
# Tell versions [3.59,3.63) of GNU make to not export all variables.
# Otherwise a system limit (for SysV at least) may be exceeded.
.NOEXPORT:
#include <SDL.h> #include <SDL.h>
#include "gp2x.h"
#include "inputmode.h" #include "inputmode.h"
extern char launchDir [256]; extern char launchDir [256];
...@@ -44,7 +43,8 @@ void inputmode_redraw(void) { ...@@ -44,7 +43,8 @@ void inputmode_redraw(void) {
r.h=120; r.h=120;
if (inputMode[0] && inputMode[1]) { if (inputMode[0] && inputMode[1]) {
if (gp2xMouseEmuOn) { // if (gp2xMouseEmuOn) {
if (1) {
surface = inputMode[1]; surface = inputMode[1];
} else { } else {
surface = inputMode[0]; surface = inputMode[0];
......
#include "SDL.h" #include "SDL.h"
#include "SDL_image.h" #include "SDL_image.h"
#include <sys/mman.h>
#include <stdlib.h> #include <stdlib.h>
#include <stdio.h> #include <stdio.h>
#include <string.h> #include <string.h>
...@@ -13,15 +12,26 @@ ...@@ -13,15 +12,26 @@
#include "gui.h" #include "gui.h"
#include "zfile.h" #include "zfile.h"
#include <SDL_TouchUI.h>
#define GUI_DEBUG
#ifdef GUI_DEBUG
#define DEBUG_LOG write_log ( "%s: ", __func__); write_log
#else
#define DEBUG_LOG(...) do ; while(0)
#endif
#define VIDEO_FLAGS SDL_HWSURFACE #define VIDEO_FLAGS SDL_HWSURFACE
SDL_Surface* tmpSDLScreen = NULL; SDL_Surface* tmpSDLScreen = NULL;
SDL_Surface* display = NULL;
int seciliolan = 0; int menuSelection = 0;
char yol[256]; char yol[256];
char msg[50]; char msg[50];
char msg_status[50]; char msg_status[50];
extern char launchDir[256]; //extern char launchDir[256];
char launchDir[256];
extern int dirz(int parametre); extern int dirz(int parametre);
extern int tweakz(int parametre); extern int tweakz(int parametre);
...@@ -29,38 +39,78 @@ extern int prefz(int parametre); ...@@ -29,38 +39,78 @@ extern int prefz(int parametre);
int soundVolume = 100; int soundVolume = 100;
extern int flashLED; extern int flashLED;
// static int gui_available = 0;
void write_text (int x, int y, char* txt) {
SDL_Surface* pText_Surface = TTF_RenderText_Solid(amiga_font, txt, text_color);
rect.x = x;
rect.y = y;
rect.w = pText_Surface->w;
rect.h = pText_Surface->h;
SDL_BlitSurface (pText_Surface,NULL,tmpSDLScreen,&rect);
SDL_FreeSurface(pText_Surface);
}
void blit_image (SDL_Surface* img, int x, int y) {
SDL_Rect dest;
dest.x = x;
dest.y = y;
SDL_BlitSurface(img, 0, tmpSDLScreen, &dest);
}
void secilimi (int ix, int iy, int mx, int my, SDL_Surface* img, int hangi) {
int secili = 0;
if (mx >= ix && mx <= ix + iconsizex) {
if (my >= iy && my <= iy + iconsizey) {
secili = 1;
}
}
if (secili == 1) {
SDL_SetAlpha(img, SDL_SRCALPHA, 100);
menuSelection = hangi;
} else {
SDL_SetAlpha(img, SDL_SRCALPHA, 255);
}
}
int gui_init (void) { int gui_init (void) {
if (display == NULL) { if (display == NULL) {
SDL_Init (SDL_INIT_VIDEO | SDL_INIT_JOYSTICK); display = SDL_GetVideoSurface();
display = SDL_SetVideoMode(320,240,16,VIDEO_FLAGS); }
if (display) {
SDL_JoystickEventState(SDL_ENABLE);
SDL_JoystickOpen(0);
SDL_ShowCursor(SDL_DISABLE);
TTF_Init();
amiga_font = TTF_OpenFont("fonts/amiga4ever_pro2.ttf",8);
text_color.r = 0;
text_color.g = 0;
text_color.b = 0;
pMenu_Surface = SDL_LoadBMP("images/menu.bmp");
pMouse_Pointer = SDL_LoadBMP("images/mousep.bmp");
SDL_SetColorKey(pMouse_Pointer, SDL_SRCCOLORKEY, SDL_MapRGB(pMouse_Pointer->format, 85, 170,153));
icon_expansion = SDL_LoadBMP("images/icon-expansion.bmp");
icon_preferences= SDL_LoadBMP("images/icon-preferences.bmp");
icon_keymaps = SDL_LoadBMP("images/icon-keymaps.bmp");
icon_floppy = SDL_LoadBMP("images/icon-floppy.bmp");
icon_reset = SDL_LoadBMP("images/icon-reset.bmp");
icon_storage = SDL_LoadBMP("images/icon-storage.bmp");
icon_run = SDL_LoadBMP("images/icon-run.bmp");
icon_exit = SDL_LoadBMP("images/icon-exit.bmp");
icon_tweaks = SDL_LoadBMP("images/icon-tweaks.bmp");
tmpSDLScreen = SDL_CreateRGBSurface(display->flags,display->w,display->h,display->format->BitsPerPixel,display->format->Rmask,display->format->Gmask,display->format->Bmask,display->format->Amask);
SDL_TUI_Init("sdl_touchui.xml", "keyboard-off");
return 1;
} }
SDL_JoystickEventState(SDL_ENABLE); return 0;
SDL_JoystickOpen(0);
SDL_ShowCursor(SDL_DISABLE);
TTF_Init();
amiga_font = TTF_OpenFont("fonts/amiga4ever_pro2.ttf",8);
text_color.r = 0;
text_color.g = 0;
text_color.b = 0;
pMenu_Surface = SDL_LoadBMP("images/menu.bmp");
pMouse_Pointer = SDL_LoadBMP("images/mousep.bmp");
SDL_SetColorKey(pMouse_Pointer, SDL_SRCCOLORKEY, SDL_MapRGB(pMouse_Pointer->format, 85, 170,153));
icon_expansion = SDL_LoadBMP("images/icon-expansion.bmp");
icon_preferences= SDL_LoadBMP("images/icon-preferences.bmp");
icon_keymaps = SDL_LoadBMP("images/icon-keymaps.bmp");
icon_floppy = SDL_LoadBMP("images/icon-floppy.bmp");
icon_reset = SDL_LoadBMP("images/icon-reset.bmp");
icon_storage = SDL_LoadBMP("images/icon-storage.bmp");
icon_run = SDL_LoadBMP("images/icon-run.bmp");
icon_exit = SDL_LoadBMP("images/icon-exit.bmp");
icon_tweaks = SDL_LoadBMP("images/icon-tweaks.bmp");
tmpSDLScreen = SDL_CreateRGBSurface(display->flags,display->w,display->h,display->format->BitsPerPixel,display->format->Rmask,display->format->Gmask,display->format->Bmask,display->format->Amask);
return 1;
} }
void gui_exit (void){ void gui_exit (void){
...@@ -83,7 +133,7 @@ void gui_exit (void){ ...@@ -83,7 +133,7 @@ void gui_exit (void){
SDL_Quit; SDL_Quit;
} }
int gui_display(int shortcut){ void gui_display (int shortcut){
SDL_Event event; SDL_Event event;
int menu_exitcode = -1; int menu_exitcode = -1;
...@@ -98,16 +148,22 @@ int gui_display(int shortcut){ ...@@ -98,16 +148,22 @@ int gui_display(int shortcut){
int iconpos_x = 0; int iconpos_x = 0;
int iconpos_y = 0; int iconpos_y = 0;
if (display == NULL) {
gui_init();
}
getcwd(launchDir,256); getcwd(launchDir,256);
while (!mainloopdone) { while (!mainloopdone) {
while (SDL_PollEvent(&event)) { while (SDL_PollEvent(&event)) {
SDL_TUI_HandleEvent(&event);
if (event.type == SDL_QUIT) { if (event.type == SDL_QUIT) {
mainloopdone = 1; mainloopdone = 1;
} }
if (event.type == SDL_JOYBUTTONDOWN) { if (event.type == SDL_JOYBUTTONDOWN) {
switch (event.jbutton.button) { switch (event.jbutton.button) {
case GP2X_BUTTON_R: break; #if 0
case GP2X_BUTTON_R: break;
case GP2X_BUTTON_L: break; case GP2X_BUTTON_L: break;
case GP2X_BUTTON_UP: kup = 1; break; case GP2X_BUTTON_UP: kup = 1; break;
case GP2X_BUTTON_DOWN: kdown = 1; break; case GP2X_BUTTON_DOWN: kdown = 1; break;
...@@ -117,6 +173,7 @@ int gui_display(int shortcut){ ...@@ -117,6 +173,7 @@ int gui_display(int shortcut){
case GP2X_BUTTON_B: ksel = 1; break; case GP2X_BUTTON_B: ksel = 1; break;
case GP2X_BUTTON_Y: break; case GP2X_BUTTON_Y: break;
case GP2X_BUTTON_START: mainloopdone = 1; break; case GP2X_BUTTON_START: mainloopdone = 1; break;
#endif
} }
} }
if (event.type == SDL_KEYDOWN) { if (event.type == SDL_KEYDOWN) {
...@@ -135,7 +192,7 @@ int gui_display(int shortcut){ ...@@ -135,7 +192,7 @@ int gui_display(int shortcut){
mouse_y += event.motion.yrel; mouse_y += event.motion.yrel;
} }
if (event.type == SDL_MOUSEBUTTONDOWN) { if (event.type == SDL_MOUSEBUTTONDOWN) {
if (seciliolan == 0) { if (menuSelection == 0) {
if (mouse_x >= 0 && mouse_x <= 20) { if (mouse_x >= 0 && mouse_x <= 20) {
if (mouse_y >= 0 && mouse_y <= 20) { if (mouse_y >= 0 && mouse_y <= 20) {
mainloopdone = 1; mainloopdone = 1;
...@@ -147,43 +204,43 @@ int gui_display(int shortcut){ ...@@ -147,43 +204,43 @@ int gui_display(int shortcut){
} }
} }
if (ksel == 1) { if (ksel == 1) {
if (seciliolan == menu_sel_expansion) { if (menuSelection == menu_sel_expansion) {
sprintf(msg,"%s","Select KickStart ROM"); sprintf(msg,"%s","Select KickStart ROM");
sprintf(msg_status,"%s"," "); sprintf(msg_status,"%s"," ");
sprintf(yol,"%s/roms",launchDir); sprintf(yol,"%s/roms",launchDir);
dirz(1); dirz(1);
} }
if (seciliolan == menu_sel_floppy) { if (menuSelection == menu_sel_floppy) {
sprintf(msg,"%s","Select Disk Image"); sprintf(msg,"%s","Select Disk Image");
sprintf(msg_status,"%s","DF0: B DF1: A"); sprintf(msg_status,"%s","DF0: B DF1: A");
sprintf(yol,"%s/disks",launchDir); sprintf(yol,"%s/disks",launchDir);
dirz(0); dirz(0);
} }
if (seciliolan == menu_sel_prefs) { if (menuSelection == menu_sel_prefs) {
sprintf(msg,"%s"," "); sprintf(msg,"%s"," ");
sprintf(msg_status,"%s"," "); sprintf(msg_status,"%s"," ");
prefz(0); prefz(0);
} }
if (seciliolan == menu_sel_reset) { if (menuSelection == menu_sel_reset) {
//reset amiga //reset amiga
menu_exitcode = 2; menu_exitcode = 2;
mainloopdone = 1; mainloopdone = 1;
} }
if (seciliolan == menu_sel_keymaps) { if (menuSelection == menu_sel_keymaps) {
} }
if (seciliolan == menu_sel_tweaks) { if (menuSelection == menu_sel_tweaks) {
sprintf(msg,"%s","Tweaks"); sprintf(msg,"%s","Tweaks");
sprintf(msg_status,"%s","L/R = -/+ B: Apply"); sprintf(msg_status,"%s","L/R = -/+ B: Apply");
tweakz(0); tweakz(0);
} }
if (seciliolan == menu_sel_storage) { if (menuSelection == menu_sel_storage) {
} }
if (seciliolan == menu_sel_run) { if (menuSelection == menu_sel_run) {
menu_exitcode = 1; menu_exitcode = 1;
mainloopdone = 1; mainloopdone = 1;
} }
if (seciliolan == menu_sel_exit) { if (menuSelection == menu_sel_exit) {
SDL_Quit(); SDL_Quit();
#ifdef GP2X #ifdef GP2X
...@@ -242,7 +299,11 @@ int gui_display(int shortcut){ ...@@ -242,7 +299,11 @@ int gui_display(int shortcut){
secilimi (iconpos_x,iconpos_y,mouse_x,mouse_y, icon_exit, menu_sel_exit); secilimi (iconpos_x,iconpos_y,mouse_x,mouse_y, icon_exit, menu_sel_exit);
blit_image (icon_exit, iconpos_x, iconpos_y); blit_image (icon_exit, iconpos_x, iconpos_y);
// texts // texts
write_text (26,3,"UAE2x 0.1 alpha //GnoStiC");
//char tmpMsg[50];
//sprintf(tmpMsg, "P-UAE %d.%d.%d", UAEMAJOR, UAEMINOR, UAESUBREV);
//write_text (26, 3, tmpMsg);
write_text (26, 3, "P-UAE 2.3.0");
// mouse pointer ------------------------------ // mouse pointer ------------------------------
if (kleft == 1) { if (kleft == 1) {
...@@ -274,43 +335,135 @@ int gui_display(int shortcut){ ...@@ -274,43 +335,135 @@ int gui_display(int shortcut){
// mouse pointer-end // mouse pointer-end
SDL_BlitSurface (tmpSDLScreen,NULL,display,NULL); SDL_BlitSurface (tmpSDLScreen,NULL,display,NULL);
SDL_TUI_UpdateAll();
SDL_Flip(display); SDL_Flip(display);
} //while done } //while done
return menu_exitcode;
} }
void write_text (int x, int y, char* txt) { void gui_handle_events (void)
SDL_Surface* pText_Surface = TTF_RenderText_Solid(amiga_font, txt, text_color); {
if (!gui_available)
return;
#if 0
while (comm_pipe_has_data (&from_gui_pipe)) {
int cmd = read_comm_pipe_int_blocking (&from_gui_pipe);
switch (cmd) {
case UAECMD_EJECTDISK: {
int n = read_comm_pipe_int_blocking (&from_gui_pipe);
uae_sem_wait (&gui_sem);
changed_prefs.floppyslots[n].df[0] = '\0';
uae_sem_post (&gui_sem);
if (pause_uae) {
/* When UAE is running it will notify the GUI when a disk has been inserted
* or removed itself. When UAE is paused, however, we need to do this ourselves
* or the change won't be realized in the GUI until UAE is resumed */
// write_comm_pipe_int (&to_gui_pipe, n, 1);
}
break;
}
case UAECMD_INSERTDISK: {
int n = read_comm_pipe_int_blocking (&from_gui_pipe);
uae_sem_wait (&gui_sem);
strncpy (changed_prefs.floppyslots[n].df, new_disk_string[n], 255);
free (new_disk_string[n]);
new_disk_string[n] = 0;
changed_prefs.floppyslots[n].df[255] = '\0';
uae_sem_post (&gui_sem);
if (pause_uae) {
/* When UAE is running it will notify the GUI when a disk has been inserted
* or removed itself. When UAE is paused, however, we need to do this ourselves
* or the change won't be realized in the GUI until UAE is resumed */
// write_comm_pipe_int (&to_gui_pipe, GUICMD_DISKCHANGE, 0);
// write_comm_pipe_int (&to_gui_pipe, n, 1);
}
break;
}
case UAECMD_RESET:
uae_reset (0);
break;
#ifdef DEBUGGER
case UAECMD_DEBUG:
activate_debugger ();
break;
#endif
case UAECMD_QUIT:
uae_quit ();
break;
case UAECMD_PAUSE:
pause_uae = 1;
uae_pause ();
break;
case UAECMD_RESUME:
pause_uae = 0;
uae_resume ();
break;
case UAECMD_SAVE_CONFIG:
uae_sem_wait (&gui_sem);
//uae_save_config ();
uae_sem_post (&gui_sem);
break;
case UAECMD_SELECT_ROM:
uae_sem_wait (&gui_sem);
strncpy (changed_prefs.romfile, gui_romname, 255);
changed_prefs.romfile[255] = '\0';
free (gui_romname);
uae_sem_post (&gui_sem);
break;
case UAECMD_SELECT_KEY:
uae_sem_wait (&gui_sem);
strncpy (changed_prefs.keyfile, gui_keyname, 255);
changed_prefs.keyfile[255] = '\0';
free (gui_keyname);
uae_sem_post (&gui_sem);
break;
case UAECMD_SAVESTATE_LOAD:
uae_sem_wait (&gui_sem);
savestate_initsave (gui_sstate_name, 0, 0);
savestate_state = STATE_DORESTORE;
write_log ("Restoring state from '%s'...\n", gui_sstate_name);
uae_sem_post (&gui_sem);
break;
case UAECMD_SAVESTATE_SAVE:
uae_sem_wait (&gui_sem);
savestate_initsave (gui_sstate_name, 0, 0);
save_state (gui_sstate_name, "puae");
write_log ("Saved state to '%s'...\n", gui_sstate_name);
uae_sem_post (&gui_sem);
break;
/* case UAECMD_START:
uae_start ();
break;
case UAECMD_STOP:
uae_stop ();
break;*/
}
}
#endif
}
rect.x = x; void gui_message (const char *format,...) {
rect.y = y; char msg[2048];
rect.w = pText_Surface->w; va_list parms;
rect.h = pText_Surface->h;
SDL_BlitSurface (pText_Surface,NULL,tmpSDLScreen,&rect); va_start (parms,format);
SDL_FreeSurface(pText_Surface); vsprintf ( msg, format, parms);
} va_end (parms);
void blit_image (SDL_Surface* img, int x, int y) { write_log (msg);
SDL_Rect dest;
dest.x = x;
dest.y = y;
SDL_BlitSurface(img, 0, tmpSDLScreen, &dest);
} }
void secilimi (int ix, int iy, int mx, int my, SDL_Surface* img, int hangi) { void gui_fps (int fps, int idle) {
int secili = 0; gui_data.fps = fps;
if (mx >= ix && mx <= ix + iconsizex) { gui_data.idle = idle;
if (my >= iy && my <= iy + iconsizey) {
secili = 1;
}
}
if (secili == 1) {
SDL_SetAlpha(img, SDL_SRCALPHA, 100);
seciliolan = hangi;
} else {
SDL_SetAlpha(img, SDL_SRCALPHA, 255);
}
} }
//
int gui_update (void) { return 0; }
void gui_flicker_led (int led, int unitnum, int status) {}
void gui_led (int led, int on) {}
void gui_filename (int num, const char *name) {}
void gui_disk_image_change (int unitnum, const TCHAR *name) {}
void gui_lock (void) {}
void gui_unlock (void) {}
#include <stdio.h> #include <stdio.h>
#include <SDL.h> #include <SDL.h>
#include "SDL_ttf.h" #include "SDL_ttf.h"
#include "gp2x.h"
#define iconsizex 50 #define iconsizex 50
#define iconsizey 60 #define iconsizey 60
......
...@@ -5,12 +5,13 @@ ...@@ -5,12 +5,13 @@
#include "SDL.h" #include "SDL.h"
#include "SDL_image.h" #include "SDL_image.h"
#include "SDL_ttf.h" #include "SDL_ttf.h"
#include "gp2x.h"
#include <dirent.h> #include <dirent.h>
#include <stdlib.h> #include <stdlib.h>
#include <string.h> #include <string.h>
#include <sys/stat.h> #include <sys/stat.h>
#include <SDL_TouchUI.h>
extern void write_text(int x, int y, char* txt); extern void write_text(int x, int y, char* txt);
extern void blit_image(SDL_Surface* img, int x, int y); extern void blit_image(SDL_Surface* img, int x, int y);
extern SDL_Surface* display; extern SDL_Surface* display;
...@@ -19,54 +20,51 @@ extern SDL_Surface* pMenu_Surface; ...@@ -19,54 +20,51 @@ extern SDL_Surface* pMenu_Surface;
extern SDL_Color text_color; extern SDL_Color text_color;
#define MAX_FILES 1024 #define MAX_FILES 1024
extern char launchDir[];
extern char yol[]; extern char yol[];
extern char msg[]; extern char msg[];
extern char msg_status[]; extern char msg_status[];
int dirz (int parametre) { int dirz (int parametre) {
char launchDir[256];
SDL_Event event; SDL_Event event;
int getdir = 1; int getdir = 1;
pMenu_Surface = SDL_LoadBMP("images/menu_load.bmp"); pMenu_Surface = SDL_LoadBMP("images/menu_load.bmp");
int loadloopdone = 0; int loadloopdone = 0;
int num_of_files = 0; int num_of_files = 0;
int seciliolan = 0; int menuSelection = 0;
int q; int q;
int bas = 0; int bas = 0;
int ka = 0; int ka = 0;
int kb = 0; int kb = 0;
char **filez = (char **)malloc(MAX_FILES*sizeof(char *)); char **filez = (char **)malloc(MAX_FILES*sizeof(char *));
if (display == NULL) {
gui_init();
}
int i; int i;
int paging = 18; int paging = 18;
DIR *d=opendir(yol); DIR *d=opendir(yol);
struct dirent *ep; struct dirent *ep;
getcwd(launchDir,256);
if (d != NULL) { if (d != NULL) {
for(i=0;i<MAX_FILES;i++) { for(i=0;i<MAX_FILES;i++) {
ep = readdir(d); ep = readdir(d);
if (ep == NULL) { if (ep == NULL) {
break; break;
} else { } else {
//if ((!strcmp(ep->d_name,".")) || (!strcmp(ep->d_name,"..")) || (!strcmp(ep->d_name,"uae2x.gpe"))) { struct stat sstat;
char *tmp=(char *)calloc(1,256);
struct stat sstat; strcpy(tmp,launchDir);
char *tmp=(char *)calloc(1,256); strcat(tmp,"/");
strcpy(tmp,launchDir); strcat(tmp,ep->d_name);
strcat(tmp,"/");
strcat(tmp,ep->d_name); filez[i]=(char*)malloc(64);
strncpy(filez[i],ep->d_name,64);
//if (!stat(tmp, &sstat)) { num_of_files++;
// if (S_ISDIR(sstat.st_mode)) { free(tmp);
// //folder EKLENECEK
// } else {
filez[i]=(char*)malloc(64);
strncpy(filez[i],ep->d_name,64);
num_of_files++;
// }
//}
free(tmp);
//}
} }
} }
closedir(d); closedir(d);
...@@ -77,68 +75,86 @@ int dirz (int parametre) { ...@@ -77,68 +75,86 @@ int dirz (int parametre) {
while (!loadloopdone) { while (!loadloopdone) {
while (SDL_PollEvent(&event)) { while (SDL_PollEvent(&event)) {
SDL_TUI_HandleEvent(&event);
if (event.type == SDL_QUIT) { if (event.type == SDL_QUIT) {
loadloopdone = 1; loadloopdone = 1;
} }
if (event.type == SDL_JOYBUTTONDOWN) { if (event.type == SDL_JOYBUTTONDOWN) {
switch (event.jbutton.button) { switch (event.jbutton.button) {
case GP2X_BUTTON_UP: seciliolan -= 1; break; #if 0
case GP2X_BUTTON_DOWN: seciliolan += 1; break; case GP2X_BUTTON_UP: menuSelection -= 1; break;
case GP2X_BUTTON_DOWN: menuSelection += 1; break;
case GP2X_BUTTON_A: ka = 1; break; case GP2X_BUTTON_A: ka = 1; break;
case GP2X_BUTTON_B: kb = 1; break; case GP2X_BUTTON_B: kb = 1; break;
case GP2X_BUTTON_SELECT: loadloopdone = 1; break; case GP2X_BUTTON_SELECT: loadloopdone = 1; break;
#endif
} }
} }
if (event.type == SDL_KEYDOWN) { if (event.type == SDL_KEYDOWN) {
switch (event.key.keysym.sym) { switch (event.key.keysym.sym) {
case SDLK_ESCAPE: loadloopdone = 1; break; case SDLK_ESCAPE: loadloopdone = 1; break;
case SDLK_UP: seciliolan -= 1; break; case SDLK_UP: menuSelection -= 1; break;
case SDLK_DOWN: seciliolan += 1; break; case SDLK_DOWN: menuSelection += 1; break;
case SDLK_a: ka = 1; break; case SDLK_a: ka = 1; break;
case SDLK_b: kb = 1; break; case SDLK_b: kb = 1; break;
default: break; default: break;
} }
} }
} }
if (ka == 1) { //df1 if (parametre == 0) {
if (parametre == 0) { if (ka == 1) { //df1
// Select Disk Image
char *tmp=(char *)calloc(1,256); char *tmp=(char *)calloc(1,256);
strcpy(tmp,launchDir); //strcpy(tmp,launchDir);
strcat(tmp,"/roms/"); strcat(tmp,"disks/");
strcat(tmp,filez[seciliolan]); strcat(tmp,filez[menuSelection]);
strcpy(currprefs.df[1],tmp); //strcpy(changed_prefs.floppyslots[1].df,tmp);
write_log ("Old Disk Image: %s\n", changed_prefs.floppyslots[1].df);
strncpy(changed_prefs.floppyslots[1].df, tmp, 255);
write_log ("Selected Disk Image: %s\n", changed_prefs.floppyslots[1].df);
free(tmp); free(tmp);
loadloopdone = 1; loadloopdone = 1;
ka = 0;
} }
ka = 0; if (kb == 1) { //df0;
} // Select Disk Image
if (kb == 1) { //df0;
if (parametre == 0) {
char *tmp=(char *)calloc(1,256); char *tmp=(char *)calloc(1,256);
strcpy(tmp,launchDir); //strcpy(tmp,launchDir);
strcat(tmp,"/disks/"); strcat(tmp,"disks/");
strcat(tmp,filez[seciliolan]); strcat(tmp,filez[menuSelection]);
strcpy(currprefs.df[0],tmp); //strcpy(changed_prefs.floppyslots[0].df,tmp);
write_log ("Old Disk Image: %s\n", changed_prefs.floppyslots[0].df);
strncpy(changed_prefs.floppyslots[0].df, tmp, 255);
write_log ("Selected Disk Image: %s\n", changed_prefs.floppyslots[0].df);
free(tmp); free(tmp);
loadloopdone = 1; loadloopdone = 1;
} else { kb = 0;
}
} else {
if (kb == 1) {
// Select KickStart ROM
char *tmp=(char *)calloc(1,256); char *tmp=(char *)calloc(1,256);
strcpy(tmp,launchDir); //strcpy(tmp,launchDir);
strcat(tmp,"/roms/"); strcat(tmp,"roms/");
strcat(tmp,filez[seciliolan]); strcat(tmp,filez[menuSelection]);
strcpy(currprefs.romfile,tmp); //strcpy(changed_prefs.romfile,tmp);
write_log ("Old KickStart ROM: %s\n", changed_prefs.romfile);
strncpy(changed_prefs.romfile, tmp, 255);
write_log ("Selected KickStart ROM: %s\n", changed_prefs.romfile);
free(tmp); free(tmp);
loadloopdone = 1; loadloopdone = 1;
} }
kb = 0; ka = 0;
kb = 0;
} }
if (seciliolan < 0) { seciliolan = 0; }
if (seciliolan >= num_of_files) { seciliolan = num_of_files-1; } if (menuSelection < 0) { menuSelection = 0; }
if (seciliolan > (bas + paging -1)) { bas += 1; } if (menuSelection >= num_of_files) { menuSelection = num_of_files-1; }
if (seciliolan < bas) { bas -= 1; } if (menuSelection > (bas + paging -1)) { bas += 1; }
if (menuSelection < bas) { bas -= 1; }
if ((bas+paging) > num_of_files) { bas = (num_of_files - paging); } if ((bas+paging) > num_of_files) { bas = (num_of_files - paging); }
// background // background
...@@ -147,11 +163,11 @@ int dirz (int parametre) { ...@@ -147,11 +163,11 @@ int dirz (int parametre) {
// texts // texts
int sira = 0; int sira = 0;
for (q=bas; q<(bas+paging); q++) { for (q=bas; q<(bas+paging); q++) {
if (seciliolan == q) { if (menuSelection == q) {
text_color.r = 255; text_color.g = 100; text_color.b = 100; text_color.r = 255; text_color.g = 100; text_color.b = 100;
} }
write_text (10,25+(sira*10),filez[q]); // write_text (10,25+(sira*10),filez[q]); //
if (seciliolan == q) { if (menuSelection == q) {
text_color.r = 0; text_color.g = 0; text_color.b = 0; text_color.r = 0; text_color.g = 0; text_color.b = 0;
} }
sira++; sira++;
...@@ -161,11 +177,12 @@ int dirz (int parametre) { ...@@ -161,11 +177,12 @@ int dirz (int parametre) {
write_text (15,228,msg_status); write_text (15,228,msg_status);
SDL_BlitSurface (tmpSDLScreen,NULL,display,NULL); SDL_BlitSurface (tmpSDLScreen,NULL,display,NULL);
SDL_TUI_UpdateAll();
SDL_Flip(display); SDL_Flip(display);
} //while done } //while done
free(filez); free(filez);
pMenu_Surface = SDL_LoadBMP("images/menu.bmp"); pMenu_Surface = SDL_LoadBMP("images/menu.bmp");
return 0; return 0;
} }
...@@ -3,9 +3,10 @@ ...@@ -3,9 +3,10 @@
#include "options.h" #include "options.h"
#include "SDL.h" #include "SDL.h"
#include "gp2x.h"
#include <stdlib.h> #include <stdlib.h>
#include <SDL_TouchUI.h>
extern void write_text(int x, int y, char* txt); extern void write_text(int x, int y, char* txt);
extern void blit_image(SDL_Surface* img, int x, int y); extern void blit_image(SDL_Surface* img, int x, int y);
extern SDL_Surface* display; extern SDL_Surface* display;
...@@ -18,13 +19,17 @@ extern char msg_status[50]; ...@@ -18,13 +19,17 @@ extern char msg_status[50];
int prefz (int parametre) { int prefz (int parametre) {
SDL_Event event; SDL_Event event;
pMenu_Surface = SDL_LoadBMP("images/menu_tweak.bmp"); if (display == NULL) {
gui_init();
}
pMenu_Surface = SDL_LoadBMP("images/menu_tweak.bmp");
int prefsloopdone = 0; int prefsloopdone = 0;
int kup = 0; int kup = 0;
int kdown = 0; int kdown = 0;
int kleft = 0; int kleft = 0;
int kright = 0; int kright = 0;
int seciliolan = 0; int menuSelection = 0;
int deger; int deger;
int q; int q;
int w; int w;
...@@ -48,43 +53,49 @@ int prefz (int parametre) { ...@@ -48,43 +53,49 @@ int prefz (int parametre) {
char* p_floppy[]= {"0","100","200","300"}; //3 char* p_floppy[]= {"0","100","200","300"}; //3
int defaults[] = {0,0,0,0,0,0,0,0}; int defaults[] = {0,0,0,0,0,0,0,0};
defaults[0] = currprefs.cpu_level; // defaults[0] = changed_prefs.cpu_level;
if (currprefs.address_space_24 != 0) { defaults[0] = changed_prefs.cpu_model;
if (currprefs.cpu_level == 2) { defaults[0] = 4; } if (changed_prefs.address_space_24 != 0) {
if (currprefs.cpu_level == 3) { defaults[0] = 5; } // if (changed_prefs.cpu_level == 2) { defaults[0] = 4; }
// if (changed_prefs.cpu_level == 3) { defaults[0] = 5; }
if (changed_prefs.cpu_model == 2) { defaults[0] = 4; }
if (changed_prefs.cpu_model == 3) { defaults[0] = 5; }
} }
defaults[1] = currprefs.m68k_speed; defaults[1] = changed_prefs.m68k_speed;
defaults[2] = currprefs.chipset_mask; defaults[2] = changed_prefs.chipset_mask;
defaults[3] = currprefs.chipmem_size; defaults[3] = changed_prefs.chipmem_size;
defaults[4] = currprefs.fastmem_size; defaults[4] = changed_prefs.fastmem_size;
defaults[5] = currprefs.bogomem_size; defaults[5] = changed_prefs.bogomem_size;
defaults[6] = currprefs.produce_sound; defaults[6] = changed_prefs.produce_sound;
defaults[7] = currprefs.gfx_framerate; defaults[7] = changed_prefs.gfx_framerate;
defaults[8] = currprefs.floppy_speed; defaults[8] = changed_prefs.floppy_speed;
char *tmp; char *tmp;
tmp=(char*)malloc(6); tmp=(char*)malloc(6);
while (!prefsloopdone) { while (!prefsloopdone) {
while (SDL_PollEvent(&event)) { while (SDL_PollEvent(&event)) {
SDL_TUI_HandleEvent(&event);
if (event.type == SDL_QUIT) { if (event.type == SDL_QUIT) {
prefsloopdone = 1; prefsloopdone = 1;
} }
if (event.type == SDL_JOYBUTTONDOWN) { if (event.type == SDL_JOYBUTTONDOWN) {
switch (event.jbutton.button) { switch (event.jbutton.button) {
case GP2X_BUTTON_UP: seciliolan--; break; #if 0
case GP2X_BUTTON_DOWN: seciliolan++; break; case GP2X_BUTTON_UP: menuSelection--; break;
case GP2X_BUTTON_DOWN: menuSelection++; break;
case GP2X_BUTTON_LEFT: kleft = 1; break; case GP2X_BUTTON_LEFT: kleft = 1; break;
case GP2X_BUTTON_RIGHT: kright = 1; break; case GP2X_BUTTON_RIGHT: kright = 1; break;
case GP2X_BUTTON_SELECT: prefsloopdone = 1; break; case GP2X_BUTTON_SELECT: prefsloopdone = 1; break;
case GP2X_BUTTON_B: prefsloopdone = 1; break; case GP2X_BUTTON_B: prefsloopdone = 1; break;
#endif
} }
} }
if (event.type == SDL_KEYDOWN) { if (event.type == SDL_KEYDOWN) {
switch (event.key.keysym.sym) { switch (event.key.keysym.sym) {
case SDLK_ESCAPE: prefsloopdone = 1; break; case SDLK_ESCAPE: prefsloopdone = 1; break;
case SDLK_UP: seciliolan--; break; case SDLK_UP: menuSelection--; break;
case SDLK_DOWN: seciliolan++; break; case SDLK_DOWN: menuSelection++; break;
case SDLK_LEFT: kleft = 1; break; case SDLK_LEFT: kleft = 1; break;
case SDLK_RIGHT: kright = 1; break; case SDLK_RIGHT: kright = 1; break;
case SDLK_b: prefsloopdone = 1; break; case SDLK_b: prefsloopdone = 1; break;
...@@ -93,30 +104,30 @@ int prefz (int parametre) { ...@@ -93,30 +104,30 @@ int prefz (int parametre) {
} }
} }
if (kleft == 1) { if (kleft == 1) {
defaults[seciliolan]--; defaults[menuSelection]--;
kleft = 0; kleft = 0;
if (seciliolan == 1) { if (menuSelection == 1) {
//cpu_speed_change = 1; //cpu_speed_change = 1;
} }
if (seciliolan == 6) { if (menuSelection == 6) {
//snd_change = 1; //snd_change = 1;
} }
if (seciliolan == 7) { if (menuSelection == 7) {
//gfx_frameskip_change = 1; //gfx_frameskip_change = 1;
} }
} }
if (kright == 1) { if (kright == 1) {
defaults[seciliolan]++; defaults[menuSelection]++;
kright = 0; kright = 0;
if (seciliolan == 1) { if (menuSelection == 1) {
//cpu_speed_change = 1; //cpu_speed_change = 1;
} }
if (seciliolan == 6) { if (menuSelection == 6) {
//snd_change = 1; //snd_change = 1;
} }
if (seciliolan == 7) { if (menuSelection == 7) {
//gfx_frameskip_change = 1; //gfx_frameskip_change = 1;
} }
} }
...@@ -141,8 +152,8 @@ int prefz (int parametre) { ...@@ -141,8 +152,8 @@ int prefz (int parametre) {
if (defaults[7] > 3) defaults[7] = 0; //frameskip if (defaults[7] > 3) defaults[7] = 0; //frameskip
if (defaults[8] > 3) defaults[8] = 0; //floppy if (defaults[8] > 3) defaults[8] = 0; //floppy
if (seciliolan < 0) { seciliolan = 8; } if (menuSelection < 0) { menuSelection = 8; }
if (seciliolan > 8) { seciliolan = 0; } if (menuSelection > 8) { menuSelection = 0; }
// background // background
SDL_BlitSurface (pMenu_Surface,NULL,tmpSDLScreen,NULL); SDL_BlitSurface (pMenu_Surface,NULL,tmpSDLScreen,NULL);
...@@ -150,7 +161,7 @@ int prefz (int parametre) { ...@@ -150,7 +161,7 @@ int prefz (int parametre) {
int sira = 0; int sira = 0;
int skipper = 0; int skipper = 0;
for (q=0; q<9; q++) { for (q=0; q<9; q++) {
if (seciliolan == q) { if (menuSelection == q) {
text_color.r = 150; text_color.g = 50; text_color.b = 50; text_color.r = 150; text_color.g = 50; text_color.b = 50;
} }
write_text (10,skipper+25+(sira*10),prefs[q]); // write_text (10,skipper+25+(sira*10),prefs[q]); //
...@@ -181,7 +192,9 @@ int prefz (int parametre) { ...@@ -181,7 +192,9 @@ int prefz (int parametre) {
write_text (25,6,msg); // write_text (25,6,msg); //
write_text (25,240,msg_status); // write_text (25,240,msg_status); //
SDL_BlitSurface (tmpSDLScreen,NULL,display,NULL); SDL_BlitSurface (tmpSDLScreen,NULL,display,NULL);
SDL_TUI_UpdateAll();
SDL_Flip(display); SDL_Flip(display);
} //while done } //while done
/* /*
......
#include "SDL.h" #include "SDL.h"
#include "gp2x.h"
#include <stdlib.h> #include <stdlib.h>
#include "gp2x-cpuctrl/cpuctrl.h"
#include <SDL_TouchUI.h>
extern void write_text(int x, int y, char* txt); extern void write_text(int x, int y, char* txt);
extern void blit_image(SDL_Surface* img, int x, int y); extern void blit_image(SDL_Surface* img, int x, int y);
...@@ -22,7 +22,7 @@ int tweakz (int parametre) { ...@@ -22,7 +22,7 @@ int tweakz (int parametre) {
int kleft = 0; int kleft = 0;
int kright = 0; int kright = 0;
int kb = 0; int kb = 0;
int seciliolan = 0; int menuSelection = 0;
int q; int q;
char* tweaks[] = {"CPU Mhz","tRC","tRAS","tWR","tMRD","tRFC","tRP","tRCD","PLL","Timing","Default (200mhz)","Default (266mhz)","Evil Dragon (266mhz)"}; char* tweaks[] = {"CPU Mhz","tRC","tRAS","tWR","tMRD","tRFC","tRP","tRCD","PLL","Timing","Default (200mhz)","Default (266mhz)","Evil Dragon (266mhz)"};
...@@ -33,6 +33,10 @@ int tweakz (int parametre) { ...@@ -33,6 +33,10 @@ int tweakz (int parametre) {
char *tmp; char *tmp;
tmp=(char*)malloc(5); tmp=(char*)malloc(5);
if (display == NULL) {
gui_init();
}
#ifdef GP2X #ifdef GP2X
unsigned sysfreq=0; unsigned sysfreq=0;
int cpufreq; int cpufreq;
...@@ -52,22 +56,25 @@ int tweakz (int parametre) { ...@@ -52,22 +56,25 @@ int tweakz (int parametre) {
while (!tweakloopdone) { while (!tweakloopdone) {
while (SDL_PollEvent(&event)) { while (SDL_PollEvent(&event)) {
SDL_TUI_HandleEvent(&event);
if (event.type == SDL_QUIT) { tweakloopdone = 1; } if (event.type == SDL_QUIT) { tweakloopdone = 1; }
if (event.type == SDL_JOYBUTTONDOWN) { if (event.type == SDL_JOYBUTTONDOWN) {
switch (event.jbutton.button) { switch (event.jbutton.button) {
case GP2X_BUTTON_UP: seciliolan--; break; #if 0
case GP2X_BUTTON_DOWN: seciliolan++; break; case GP2X_BUTTON_UP: menuSelection--; break;
case GP2X_BUTTON_DOWN: menuSelection++; break;
case GP2X_BUTTON_LEFT: kleft = 1; break; case GP2X_BUTTON_LEFT: kleft = 1; break;
case GP2X_BUTTON_RIGHT: kright = 1; break; case GP2X_BUTTON_RIGHT: kright = 1; break;
case GP2X_BUTTON_SELECT: tweakloopdone = 1; break; case GP2X_BUTTON_SELECT: tweakloopdone = 1; break;
case GP2X_BUTTON_B: kb =1; break; case GP2X_BUTTON_B: kb =1; break;
#endif
} }
} }
if (event.type == SDL_KEYDOWN) { if (event.type == SDL_KEYDOWN) {
switch (event.key.keysym.sym) { switch (event.key.keysym.sym) {
case SDLK_ESCAPE: tweakloopdone = 1; break; case SDLK_ESCAPE: tweakloopdone = 1; break;
case SDLK_UP: seciliolan--; break; case SDLK_UP: menuSelection--; break;
case SDLK_DOWN: seciliolan++; break; case SDLK_DOWN: menuSelection++; break;
case SDLK_LEFT: kleft = 1; break; case SDLK_LEFT: kleft = 1; break;
case SDLK_RIGHT: kright = 1; break; case SDLK_RIGHT: kright = 1; break;
case SDLK_b: kb = 1; break; case SDLK_b: kb = 1; break;
...@@ -76,16 +83,17 @@ int tweakz (int parametre) { ...@@ -76,16 +83,17 @@ int tweakz (int parametre) {
} }
} }
if (kb == 1) { if (kb == 1) {
if (seciliolan == 10) { if (menuSelection == 10) {
for (q=0; q<10;q++) { defaults[q] = def_slow_tweak[q]; } for (q=0; q<10;q++) { defaults[q] = def_slow_tweak[q]; }
} }
if (seciliolan == 11) { if (menuSelection == 11) {
for (q=0; q<10;q++) { defaults[q] = def_fast_tweak[q]; } for (q=0; q<10;q++) { defaults[q] = def_fast_tweak[q]; }
} }
if (seciliolan == 12) { if (menuSelection == 12) {
for (q=0; q<10;q++) { defaults[q] = evil_tweak[q]; } for (q=0; q<10;q++) { defaults[q] = evil_tweak[q]; }
} }
if (seciliolan < 10) { if (menuSelection < 10) {
#if 0
//apply //apply
//printf("FLCK: %d",0); set_CAS(0); //printf("FLCK: %d",0); set_CAS(0);
printf("FLCK: %d",defaults[0]); set_FCLK(defaults[0]); printf("FLCK: %d",defaults[0]); set_FCLK(defaults[0]);
...@@ -101,16 +109,17 @@ int tweakz (int parametre) { ...@@ -101,16 +109,17 @@ int tweakz (int parametre) {
} else { } else {
printf("ULCD: %d",defaults[9]); set_add_ULCDCLK(defaults[9]-1); printf("ULCD: %d",defaults[9]); set_add_ULCDCLK(defaults[9]-1);
} }
#endif
tweakloopdone = 1; tweakloopdone = 1;
} }
kb = 0; kb = 0;
} }
if (kleft == 1) { if (kleft == 1) {
if (seciliolan < 10) { defaults[seciliolan]--; } if (menuSelection < 10) { defaults[menuSelection]--; }
kleft = 0; kleft = 0;
} }
if (kright == 1) { if (kright == 1) {
if (seciliolan < 10) { defaults[seciliolan]++; } if (menuSelection < 10) { defaults[menuSelection]++; }
kright = 0; kright = 0;
} }
...@@ -135,8 +144,8 @@ int tweakz (int parametre) { ...@@ -135,8 +144,8 @@ int tweakz (int parametre) {
if (defaults[7] == 0) defaults[7] = 16; //trcd if (defaults[7] == 0) defaults[7] = 16; //trcd
if (defaults[8] == 11) defaults[7] = -6; //timing if (defaults[8] == 11) defaults[7] = -6; //timing
if (seciliolan < 0) { seciliolan = 12; } if (menuSelection < 0) { menuSelection = 12; }
if (seciliolan > 12) { seciliolan = 0; } if (menuSelection > 12) { menuSelection = 0; }
// background // background
SDL_BlitSurface (pMenu_Surface,NULL,tmpSDLScreen,NULL); SDL_BlitSurface (pMenu_Surface,NULL,tmpSDLScreen,NULL);
...@@ -146,7 +155,7 @@ int tweakz (int parametre) { ...@@ -146,7 +155,7 @@ int tweakz (int parametre) {
int skipper = 0; int skipper = 0;
for (q=0; q<13; q++) { for (q=0; q<13; q++) {
if (q == 10) { skipper = 30; } if (q == 10) { skipper = 30; }
if (seciliolan == q) { if (menuSelection == q) {
text_color.r = 255; text_color.g = 100; text_color.b = 100; text_color.r = 255; text_color.g = 100; text_color.b = 100;
} }
write_text (10,skipper+25+(sira*10),tweaks[q]); // write_text (10,skipper+25+(sira*10),tweaks[q]); //
...@@ -162,7 +171,7 @@ int tweakz (int parametre) { ...@@ -162,7 +171,7 @@ int tweakz (int parametre) {
} }
write_text (100,skipper+25+(sira*10),tmp); write_text (100,skipper+25+(sira*10),tmp);
} }
if (seciliolan == q) { if (menuSelection == q) {
text_color.r = 0; text_color.g = 0; text_color.b = 0; text_color.r = 0; text_color.g = 0; text_color.b = 0;
} }
sira++; sira++;
...@@ -170,7 +179,9 @@ int tweakz (int parametre) { ...@@ -170,7 +179,9 @@ int tweakz (int parametre) {
write_text (25,3,msg); write_text (25,3,msg);
write_text (15,228,msg_status); write_text (15,228,msg_status);
SDL_BlitSurface (tmpSDLScreen,NULL,display,NULL); SDL_BlitSurface (tmpSDLScreen,NULL,display,NULL);
SDL_TUI_UpdateAll();
SDL_Flip(display); SDL_Flip(display);
} //while done } //while done
......
#include <SDL.h> #include <SDL.h>
#include "gp2x.h"
#include "volumecontrol.h" #include "volumecontrol.h"
......
...@@ -27,7 +27,8 @@ extern void deinit_socket_layer (void); ...@@ -27,7 +27,8 @@ extern void deinit_socket_layer (void);
#define MAXADDRLEN 256 #define MAXADDRLEN 256
#ifdef _WIN32 //#ifdef _WIN32
#if 0
#define SOCKET_TYPE SOCKET #define SOCKET_TYPE SOCKET
#else #else
#define SOCKET_TYPE int #define SOCKET_TYPE int
......
...@@ -40,7 +40,7 @@ ...@@ -40,7 +40,7 @@
#define SAVE_EXCEPTION #define SAVE_EXCEPTION
#define RESTORE_EXCEPTION #define RESTORE_EXCEPTION
#ifdef _WIN32 #ifdef _WIN32
struct m68k_exception { struct m68k_exception {
int prb; int prb;
m68k_exception (int exc) : prb (exc) {} m68k_exception (int exc) : prb (exc) {}
...@@ -52,14 +52,14 @@ struct m68k_exception { ...@@ -52,14 +52,14 @@ struct m68k_exception {
#define THROW_AGAIN(var) throw #define THROW_AGAIN(var) throw
#define VOLATILE #define VOLATILE
#define ALWAYS_INLINE __inline #define ALWAYS_INLINE __inline
#else #else
#define TRY(x) #define TRY(x)
#define CATCH(x) #define CATCH(x)
#define THROW(x) #define THROW(x)
#define THROW_AGAIN(x) #define THROW_AGAIN(x)
#define VOLATILE #define VOLATILE
#define ALWAYS_INLINE inline __attribute__ ((__always_inline__)) #define ALWAYS_INLINE inline __attribute__ ((__always_inline__))
#endif //if win32 #endif //if win32
#define true 1 #define true 1
#define false 0 #define false 0
#define likely(x) x #define likely(x) x
...@@ -597,4 +597,4 @@ struct mmufixup ...@@ -597,4 +597,4 @@ struct mmufixup
}; };
extern struct mmufixup mmufixup[2]; extern struct mmufixup mmufixup[2];
#endif /* CPUMMU_H */ #endif /* CPUMMU_H */
\ No newline at end of file
#ifdef WIN32 #ifdef XWIN32
#include "picasso96_win.h" #include "picasso96_win.h"
......
...@@ -17,7 +17,7 @@ ...@@ -17,7 +17,7 @@
#define ECS_DENISE #define ECS_DENISE
#ifdef JIT #if defined(JIT) && !defined(_WIN32)
#define NATMEM_OFFSET natmem_offset #define NATMEM_OFFSET natmem_offset
#else #else
#undef NATMEM_OFFSET #undef NATMEM_OFFSET
......
...@@ -100,7 +100,8 @@ static void show_version_full (void) ...@@ -100,7 +100,8 @@ static void show_version_full (void)
write_log ("Copyright 1995-2002 Bernd Schmidt\n"); write_log ("Copyright 1995-2002 Bernd Schmidt\n");
write_log (" 1999-2011 Toni Wilen\n"); write_log (" 1999-2011 Toni Wilen\n");
write_log (" 2003-2007 Richard Drummond\n"); write_log (" 2003-2007 Richard Drummond\n");
write_log (" 2006-2011 Mustafa 'GnoStiC' Tufan\n\n"); write_log (" 2006-2011 Mustafa 'GnoStiC' Tufan\n");
write_log (" 2004-2010 Ismail 'CeRiAl' Khatib\n\n");
write_log ("See the source for a full list of contributors.\n"); write_log ("See the source for a full list of contributors.\n");
write_log ("This is free software; see the file COPYING for copying conditions. There is NO\n"); write_log ("This is free software; see the file COPYING for copying conditions. There is NO\n");
write_log ("warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.\n"); write_log ("warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.\n");
......
...@@ -24,7 +24,8 @@ ...@@ -24,7 +24,8 @@
*/ */
/* Is there any way to do this without declaring *all* memory clobbered? /* Is there any way to do this without declaring *all* memory clobbered?
I.e. any way to tell gcc that some byte-sized value is in %al? */ I.e. any way to tell gcc that some byte-sized value is in %al? */
#ifdef __APPLE__ //#ifdef __APPLE__
#if 1
#define optflag_testl(v) \ #define optflag_testl(v) \
__asm__ __volatile__ ("andl %0,%0\n\t" \ __asm__ __volatile__ ("andl %0,%0\n\t" \
"lahf\n\t" \ "lahf\n\t" \
......
...@@ -1368,6 +1368,7 @@ int D3D_goodenough (void) ...@@ -1368,6 +1368,7 @@ int D3D_goodenough (void)
// debug_win32 // debug_win32
void update_debug_info(void) void update_debug_info(void)
{ {
} }
//win32gfx.cpp //win32gfx.cpp
...@@ -1533,3 +1534,4 @@ void serialuartbreak (int v) ...@@ -1533,3 +1534,4 @@ void serialuartbreak (int v)
EscapeCommFunction (hCom, CLRBREAK); EscapeCommFunction (hCom, CLRBREAK);
*/ */
} }
...@@ -129,7 +129,8 @@ int fsdb_set_file_attrs (a_inode *aino) ...@@ -129,7 +129,8 @@ int fsdb_set_file_attrs (a_inode *aino)
/* Return nonzero if we can represent the amigaos_mode of AINO within the /* Return nonzero if we can represent the amigaos_mode of AINO within the
* native FS. Return zero if that is not possible. */ * native FS. Return zero if that is not possible. */
int fsdb_mode_representable_p (const a_inode *aino)
int fsdb_mode_representable_p (const a_inode *aino, int amigaos_mode)
{ {
int mask = aino->amigaos_mode; int mask = aino->amigaos_mode;
int m1; int m1;
...@@ -225,4 +226,25 @@ int dos_errno (void) ...@@ -225,4 +226,25 @@ int dos_errno (void)
return ERROR_NOT_IMPLEMENTED; return ERROR_NOT_IMPLEMENTED;
} }
} }
/* return supported combination */
int fsdb_mode_supported (const a_inode *aino)
{
int mask = aino->amigaos_mode;
if (0 && aino->dir)
return 0;
if (fsdb_mode_representable_p (aino, mask))
return mask;
mask &= ~(A_FIBF_SCRIPT | A_FIBF_READ | A_FIBF_EXECUTE);
if (fsdb_mode_representable_p (aino, mask))
return mask;
mask &= ~A_FIBF_WRITE;
if (fsdb_mode_representable_p (aino, mask))
return mask;
mask &= ~A_FIBF_DELETE;
if (fsdb_mode_representable_p (aino, mask))
return mask;
return 0;
}
#endif #endif
...@@ -5,12 +5,20 @@ ...@@ -5,12 +5,20 @@
#include "sysconfig.h" #include "sysconfig.h"
#include "sysdeps.h" #include "sysdeps.h"
#include "options.h"
#include "threaddep/thread.h" #include "threaddep/thread.h"
#include "filesys.h" #include "filesys.h"
#include "zfile.h"
#include "blkdev.h" #include "blkdev.h"
#define hfd_log write_log #define hfd_log write_log
#define HDF_HANDLE_WIN32 1
#define HDF_HANDLE_ZFILE 2
#define HDF_HANDLE_LINUX 3
#define INVALID_HANDLE_VALUE NULL
#include <windef.h> #include <windef.h>
#include <winbase.h> #include <winbase.h>
...@@ -24,18 +32,27 @@ ...@@ -24,18 +32,27 @@
#include <cfgmgr32.h> // for SetupDiXxx functions. #include <cfgmgr32.h> // for SetupDiXxx functions.
#endif #endif
struct hardfilehandle
{
int zfile;
struct zfile *zf;
FILE *h;
};
struct uae_driveinfo { struct uae_driveinfo {
uae_u64 offset2; char vendor_id[128];
uae_u64 size2; char product_id[128];
char vendor_id[128]; char product_rev[128];
char product_id[128]; char product_serial[128];
char product_rev[128]; char device_name[2048];
char product_serial[128]; char device_path[2048];
char device_name[256]; uae_u64 size;
char device_path[2048]; uae_u64 offset;
uae_u64 size; int bytespersector;
uae_u64 offset; int removablemedia;
int bytespersector; int nomedia;
int dangerous;
int readonly;
}; };
#define CACHE_SIZE 16384 #define CACHE_SIZE 16384
...@@ -139,7 +156,7 @@ static int isharddrive (const char *name) ...@@ -139,7 +156,7 @@ static int isharddrive (const char *name)
return -1; return -1;
} }
int hdf_open (struct hardfiledata *hfd, const char *name) int hdf_open_target (struct hardfiledata *hfd, const char *name)
{ {
HANDLE h = INVALID_HANDLE_VALUE; HANDLE h = INVALID_HANDLE_VALUE;
int i; int i;
...@@ -154,7 +171,7 @@ int hdf_open (struct hardfiledata *hfd, const char *name) ...@@ -154,7 +171,7 @@ int hdf_open (struct hardfiledata *hfd, const char *name)
} }
hfd_log ("hfd open: '%s'\n", name); hfd_log ("hfd open: '%s'\n", name);
if (strlen (name) > 4 && !memcmp (name, "HD_", 3)) { if (strlen (name) > 4 && !memcmp (name, "HD_", 3)) {
hdf_init (); hdf_init_target ();
i = isharddrive (name); i = isharddrive (name);
if (i >= 0) { if (i >= 0) {
udi = &uae_drives[i]; udi = &uae_drives[i];
...@@ -169,12 +186,8 @@ int hdf_open (struct hardfiledata *hfd, const char *name) ...@@ -169,12 +186,8 @@ int hdf_open (struct hardfiledata *hfd, const char *name)
strncpy (hfd->vendor_id, udi->vendor_id, 8); strncpy (hfd->vendor_id, udi->vendor_id, 8);
strncpy (hfd->product_id, udi->product_id, 16); strncpy (hfd->product_id, udi->product_id, 16);
strncpy (hfd->product_rev, udi->product_rev, 4); strncpy (hfd->product_rev, udi->product_rev, 4);
hfd->offset2 = hfd->offset = udi->offset; hfd->offset = udi->offset;
hfd->size2 = hfd->size = udi->size; hfd->physsize = hfd->virtsize = udi->size;
if (hfd->offset != udi->offset2 || hfd->size != udi->size2) {
gui_message ("Harddrive safety check: fatal memory corruption\n");
abort ();
}
hfd->blocksize = udi->bytespersector; hfd->blocksize = udi->bytespersector;
if (hfd->offset == 0) { if (hfd->offset == 0) {
if (!safetycheck (hfd->handle, 0, hfd->cache, hfd->blocksize)) { if (!safetycheck (hfd->handle, 0, hfd->cache, hfd->blocksize)) {
...@@ -211,7 +224,7 @@ int hdf_open (struct hardfiledata *hfd, const char *name) ...@@ -211,7 +224,7 @@ int hdf_open (struct hardfiledata *hfd, const char *name)
return 0; return 0;
} }
low &= ~(hfd->blocksize - 1); low &= ~(hfd->blocksize - 1);
hfd->size = hfd->size2 = ((uae_u64)high << 32) | low; hfd->physsize = hfd->virtsize = ((uae_u64)high << 32) | low;
} else { } else {
write_log ("HDF '%s' failed to open. error = %d\n", name, GetLastError ()); write_log ("HDF '%s' failed to open. error = %d\n", name, GetLastError ());
} }
...@@ -225,7 +238,7 @@ int hdf_open (struct hardfiledata *hfd, const char *name) ...@@ -225,7 +238,7 @@ int hdf_open (struct hardfiledata *hfd, const char *name)
return 0; return 0;
} }
void hdf_close (struct hardfiledata *hfd) void hdf_close_target (struct hardfiledata *hfd)
{ {
hfd_log ("close handle=%p\n", hfd->handle); hfd_log ("close handle=%p\n", hfd->handle);
hfd->flags = 0; hfd->flags = 0;
...@@ -238,7 +251,7 @@ void hdf_close (struct hardfiledata *hfd) ...@@ -238,7 +251,7 @@ void hdf_close (struct hardfiledata *hfd)
hfd->cache_valid = 0; hfd->cache_valid = 0;
} }
int hdf_dup (struct hardfiledata *hfd, const struct hardfiledata *src) int hdf_dup_target (struct hardfiledata *hfd, const struct hardfiledata *src)
{ {
HANDLE duphandle; HANDLE duphandle;
if (src == 0 || src == INVALID_HANDLE_VALUE) if (src == 0 || src == INVALID_HANDLE_VALUE)
...@@ -256,16 +269,12 @@ int hdf_dup (struct hardfiledata *hfd, const struct hardfiledata *src) ...@@ -256,16 +269,12 @@ int hdf_dup (struct hardfiledata *hfd, const struct hardfiledata *src)
return 1; return 1;
} }
static int hdf_seek (struct hardfiledata *hfd, uae_u64 offset) static int hdf_seek_target (struct hardfiledata *hfd, uae_u64 offset)
{ {
DWORD high, ret; DWORD high, ret;
if (hfd->offset != hfd->offset2 || hfd->size != hfd->size2) { if (offset >= hfd->physsize - hfd->virtual_size) {
gui_message ("hd: memory corruption detected in seek"); gui_message ("hd: tried to seek out of bounds! (%I64X >= %I64X)\n", offset, hfd->physsize);
abort ();
}
if (offset >= hfd->size) {
gui_message ("hd: tried to seek out of bounds! (%I64X >= %I64X)\n", offset, hfd->size);
abort (); abort ();
} }
offset += hfd->offset; offset += hfd->offset;
...@@ -285,10 +294,6 @@ static void poscheck (struct hardfiledata *hfd, int len) ...@@ -285,10 +294,6 @@ static void poscheck (struct hardfiledata *hfd, int len)
DWORD high, ret, err; DWORD high, ret, err;
uae_u64 pos; uae_u64 pos;
if (hfd->offset != hfd->offset2 || hfd->size != hfd->size2) {
gui_message ("hd: memory corruption detected in poscheck");
abort ();
}
high = 0; high = 0;
ret = SetFilePointer (hfd->handle, 0, &high, FILE_CURRENT); ret = SetFilePointer (hfd->handle, 0, &high, FILE_CURRENT);
err = GetLastError (); err = GetLastError ();
...@@ -305,8 +310,8 @@ static void poscheck (struct hardfiledata *hfd, int len) ...@@ -305,8 +310,8 @@ static void poscheck (struct hardfiledata *hfd, int len)
gui_message ("hd: poscheck failed, offset out of bounds! (%I64d < %I64d)", pos, hfd->offset); gui_message ("hd: poscheck failed, offset out of bounds! (%I64d < %I64d)", pos, hfd->offset);
abort (); abort ();
} }
if (pos >= hfd->offset + hfd->size || pos >= hfd->offset + hfd->size + len) { if (pos >= hfd->offset + hfd->physsize - hfd->virtual_size || pos >= hfd->offset + hfd->physsize + len - hfd->virtual_size) {
gui_message ("hd: poscheck failed, offset out of bounds! (%I64d >= %I64d, LEN=%d)", pos, hfd->offset + hfd->size, len); gui_message ("hd: poscheck failed, offset out of bounds! (0x%llx >= 0x%llx, LEN=%d)", pos, hfd->offset + hfd->physsize, len);
abort (); abort ();
} }
if (pos & (hfd->blocksize - 1)) { if (pos & (hfd->blocksize - 1)) {
...@@ -353,7 +358,7 @@ int hdf_read (struct hardfiledata *hfd, void *buffer, uae_u64 offset, int len) ...@@ -353,7 +358,7 @@ int hdf_read (struct hardfiledata *hfd, void *buffer, uae_u64 offset, int len)
} }
#endif #endif
int hdf_read (struct hardfiledata *hfd, void *buffer, uae_u64 offset, int len) int hdf_read_target (struct hardfiledata *hfd, void *buffer, uae_u64 offset, int len)
{ {
DWORD outlen = 0; DWORD outlen = 0;
int coffset; int coffset;
...@@ -366,9 +371,9 @@ int hdf_read (struct hardfiledata *hfd, void *buffer, uae_u64 offset, int len) ...@@ -366,9 +371,9 @@ int hdf_read (struct hardfiledata *hfd, void *buffer, uae_u64 offset, int len)
return len; return len;
} }
hfd->cache_offset = offset; hfd->cache_offset = offset;
if (offset + CACHE_SIZE > hfd->offset + hfd->size) if (offset + CACHE_SIZE > hfd->offset + (hfd->physsize - hfd->virtual_size))
hfd->cache_offset = hfd->offset + hfd->size - CACHE_SIZE; hfd->cache_offset = hfd->offset + (hfd->physsize - hfd->virtual_size) - CACHE_SIZE;
hdf_seek (hfd, hfd->cache_offset); hdf_seek_target (hfd, hfd->cache_offset);
poscheck (hfd, CACHE_SIZE); poscheck (hfd, CACHE_SIZE);
ReadFile (hfd->handle, hfd->cache, CACHE_SIZE, &outlen, NULL); ReadFile (hfd->handle, hfd->cache, CACHE_SIZE, &outlen, NULL);
hfd->cache_valid = 0; hfd->cache_valid = 0;
...@@ -385,11 +390,11 @@ int hdf_read (struct hardfiledata *hfd, void *buffer, uae_u64 offset, int len) ...@@ -385,11 +390,11 @@ int hdf_read (struct hardfiledata *hfd, void *buffer, uae_u64 offset, int len)
return 0; return 0;
} }
int hdf_write (struct hardfiledata *hfd, void *buffer, uae_u64 offset, int len) int hdf_write_target (struct hardfiledata *hfd, void *buffer, uae_u64 offset, int len)
{ {
DWORD outlen = 0; DWORD outlen = 0;
hfd->cache_valid = 0; hfd->cache_valid = 0;
hdf_seek (hfd, offset); hdf_seek_target (hfd, offset);
poscheck (hfd, len); poscheck (hfd, len);
memcpy (hfd->cache, buffer, len); memcpy (hfd->cache, buffer, len);
WriteFile (hfd->handle, hfd->cache, len, &outlen, NULL); WriteFile (hfd->handle, hfd->cache, len, &outlen, NULL);
...@@ -727,7 +732,7 @@ end: ...@@ -727,7 +732,7 @@ end:
} }
#endif #endif
int hdf_init (void) int hdf_init_target (void)
{ {
#ifdef WINDDK #ifdef WINDDK
HDEVINFO hIntDevInfo; HDEVINFO hIntDevInfo;
...@@ -769,12 +774,62 @@ int hdf_getnumharddrives (void) ...@@ -769,12 +774,62 @@ int hdf_getnumharddrives (void)
return num_drives; return num_drives;
} }
char *hdf_getnameharddrive (int index, int flags) char *hdf_getnameharddrive (int index, int flags, int *sectorsize, int *dangerousdrive)
{ {
static char name[512]; static char name[512];
char tmp[32]; char tmp[32];
uae_u64 size = uae_drives[index].size; uae_u64 size = uae_drives[index].size;
int nomedia = uae_drives[index].nomedia;
char *dang = "?";
char *rw = "RW";
if (dangerousdrive)
*dangerousdrive = 0;
switch (uae_drives[index].dangerous)
{
case -5:
dang = "[PART]";
break;
case -6:
dang = "[MBR]";
break;
case -7:
dang = "[!]";
break;
case -8:
dang = "[UNK]";
break;
case -9:
dang = "[EMPTY]";
break;
case -3:
dang = "(CPRM)";
break;
case -2:
dang = "(SRAM)";
break;
case -1:
dang = "(RDB)";
break;
case 0:
dang = "[OS]";
if (dangerousdrive)
*dangerousdrive |= 1;
break;
}
if (nomedia) {
dang = "[NO MEDIA]";
if (dangerousdrive)
*dangerousdrive &= ~1;
}
if (uae_drives[index].readonly) {
rw = "RO";
if (dangerousdrive && !nomedia)
*dangerousdrive |= 2;
}
if (sectorsize)
*sectorsize = uae_drives[index].bytespersector;
if (flags & 1) { if (flags & 1) {
if (size >= 1024 * 1024 * 1024) if (size >= 1024 * 1024 * 1024)
sprintf (tmp, "%.1fG", ((double)(uae_u32)(size / (1024 * 1024))) / 1024.0); sprintf (tmp, "%.1fG", ((double)(uae_u32)(size / (1024 * 1024))) / 1024.0);
...@@ -786,4 +841,12 @@ char *hdf_getnameharddrive (int index, int flags) ...@@ -786,4 +841,12 @@ char *hdf_getnameharddrive (int index, int flags)
return uae_drives[index].device_name; return uae_drives[index].device_name;
} }
int hdf_resize_target (struct hardfiledata *hfd, uae_u64 newsize)
{
int err = 0;
write_log ("hdf_resize_target: SetEndOfFile() %d\n", err);
return 0;
}
#endif #endif
...@@ -37,7 +37,7 @@ static RETSIGTYPE sigbrkhandler (int foo) ...@@ -37,7 +37,7 @@ static RETSIGTYPE sigbrkhandler (int foo)
void setup_brkhandler (void) void setup_brkhandler (void)
{ {
#if defined(__unix) && !defined(__NeXT__) #if defined(__unix) && !defined(__NeXT__) && !defined(_WIN32)
struct sigaction sa; struct sigaction sa;
sa.sa_handler = sigbrkhandler; sa.sa_handler = sigbrkhandler;
sa.sa_flags = 0; sa.sa_flags = 0;
...@@ -161,12 +161,13 @@ int main (int argc, char **argv) ...@@ -161,12 +161,13 @@ int main (int argc, char **argv)
// hInst = hInstance; // hInst = hInstance;
// argc = __argc; argv = __argv; // argc = __argc; argv = __argv;
start_path = xmalloc( MAX_DPATH ); //start_path = xmalloc( MAX_DPATH );
start_path = xmalloc( char, MAX_DPATH );
GetModuleFileName( NULL, start_path, MAX_DPATH ); GetModuleFileName( NULL, start_path, MAX_DPATH );
if ((posn = strrchr( start_path, '\\'))) if ((posn = strrchr( start_path, '\\')))
*posn = 0; *posn = 0;
init_sdl (); // init_sdl ();
real_main (argc, argv); real_main (argc, argv);
...@@ -236,7 +237,7 @@ void target_save_options (FILE *f, const struct uae_prefs *p) ...@@ -236,7 +237,7 @@ void target_save_options (FILE *f, const struct uae_prefs *p)
{ {
} }
int target_parse_option (struct uae_prefs *p, const char *option, const char *value) int target_parse_option (struct uae_prefs *p, TCHAR *option, TCHAR *value)
{ {
return 0; return 0;
} }
......
...@@ -18,7 +18,8 @@ ...@@ -18,7 +18,8 @@
static DWORD lasterror; static DWORD lasterror;
#ifndef HAVE_GETTIMEOFDAY //#ifndef HAVE_GETTIMEOFDAY
#if 0
/* Our Win32 implementation of this function */ /* Our Win32 implementation of this function */
void gettimeofday (struct timeval *tv, void *blah) void gettimeofday (struct timeval *tv, void *blah)
{ {
......
...@@ -6,7 +6,8 @@ void fname_atow (const char *src, char *dst, int size); ...@@ -6,7 +6,8 @@ void fname_atow (const char *src, char *dst, int size);
void fname_wtoa (unsigned char *ptr); void fname_wtoa (unsigned char *ptr);
int w32fopendel(char *name, char *mode, int delflag); int w32fopendel(char *name, char *mode, int delflag);
#ifndef HAVE_GETTIMEOFDAY //#ifndef HAVE_GETTIMEOFDAY
#if 0
void gettimeofday (struct timeval *tv, void *blah); void gettimeofday (struct timeval *tv, void *blah);
#endif #endif
......
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
#include <windows.h> #include <windows.h>
#define SHOW_CONSOLE 0 #define SHOW_CONSOLE 1
static int consoleopen = 0; static int consoleopen = 0;
static HANDLE stdinput; static HANDLE stdinput;
......
...@@ -4310,4 +4310,3 @@ uae_u8 *save_p96 (int *len, uae_u8 *dstptr) ...@@ -4310,4 +4310,3 @@ uae_u8 *save_p96 (int *len, uae_u8 *dstptr)
#endif //savestate #endif //savestate
#endif //picasso96 #endif //picasso96
timestamp for src/sysconfig.h
...@@ -2981,4 +2981,3 @@ void zfile_seterror (const TCHAR *format, ...) ...@@ -2981,4 +2981,3 @@ void zfile_seterror (const TCHAR *format, ...)
{ {
} }
#endif #endif
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment