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
This diff is collapsed.
#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];
......
This diff is collapsed.
#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