diff --git a/Makefile.aros-armv7a-neon b/Makefile.aros-armv7a-neon new file mode 100755 index 0000000..78f7a74 --- /dev/null +++ b/Makefile.aros-armv7a-neon @@ -0,0 +1,173 @@ +MORE_CFLAGS += -DGP2X -DPANDORA -DDOUBLEBUFFER -DAROS + +NAME = uae4all2 +O = o +RM = rm -f + +PROG = $(NAME) + +all: $(PROG) + +FAME_CORE=1 +FAME_CORE_C=1 +#SDLSOUND=1 +NEWSDLSOUND=1 +#DEBUG=1 +#TEXT_GUI=1 +GUICHAN_GUI=1 +PANDORA=1 + +DEFAULT_CFLAGS = `sdl-config --cflags` + +LDFLAGS = -lguichan -lSDL_image -lSDL_ttf -lfreetype2 -lz -lpng -ljpeg `sdl-config --libs` + +MORE_CFLAGS += -Isrc -Isrc/gp2x -Isrc/vkbd -Isrc/menu -Isrc/include -Isrc/gp2x/menu -fomit-frame-pointer -Wno-unused -Wno-format -nix -DUSE_SDL -DGCCCONSTFUNC="__attribute__((const))" -DUSE_UNDERSCORE -DUNALIGNED_PROFITABLE -DOPTIMIZED_FLAGS -DSHM_SUPPORT_LINKS=0 -DOS_WITHOUT_MEMORY_MANAGEMENT -DVKBD_ALWAYS -DUSE_UAE4ALL_VKBD +MORE_CFLAGS += -DUSE_ARMV7 -DUSE_ARMNEON + +MORE_CFLAGS += -DROM_PATH_PREFIX=\"./\" -DDATA_PREFIX=\"./data/\" -DSAVE_PREFIX=\"./saves/\" + +ifndef DEBUG +MORE_CFLAGS += -O2 -ffast-math +MORE_CFLAGS += -fstrict-aliasing -fexpensive-optimizations +MORE_CFLAGS += -fweb -frename-registers -fomit-frame-pointer +#MORE_CFLAGS += -falign-functions=32 -falign-loops -falign-labels -falign-jumps +MORE_CFLAGS += -falign-functions=32 +MORE_CFLAGS += -finline -finline-functions -fno-builtin +else +MORE_CFLAGS += -ggdb +endif + +ASFLAGS += -mfloat-abi=soft -Wall -mfpu=neon + +MORE_CFLAGS+= -DUSE_AUTOCONFIG +MORE_CFLAGS+= -DUSE_ZFILE +MORE_CFLAGS+= -DFAME_INTERRUPTS_PATCH +# Turrican3 becomes unstable if this is not enabled +MORE_CFLAGS+= -DSAFE_MEMORY_ACCESS +#MORE_CFLAGS+= -DDEBUG_SAVESTATE + +CFLAGS = $(DEFAULT_CFLAGS) $(MORE_CFLAGS) + +OBJS = \ + src/audio.o \ + src/autoconf.o \ + src/blitfunc.o \ + src/blittable.o \ + src/blitter.o \ + src/cfgfile.o \ + src/cia.o \ + src/savedisk.o \ + src/savestate.o \ + src/custom.o \ + src/disk.o \ + src/drawing.o \ + src/ersatz.o \ + src/expansion.o \ + src/filesys.o \ + src/fsdb.o \ + src/fsdb_unix.o \ + src/fsusage.o \ + src/gfxutil.o \ + src/hardfile.o \ + src/keybuf.o \ + src/main.o \ + src/memory.o \ + src/missing.o \ + src/native2amiga.o \ + src/neon_helper.o \ + src/gui.o \ + src/od-joy.o \ + src/scsi-none.o \ + src/sdlgfx.o \ + src/writelog.o \ + src/zfile.o \ + src/menu/fade.o \ + src/vkbd/vkbd.o \ + src/gp2x/memcpy.o \ + src/gp2x/memset.o \ + src/gp2x/gp2x.o \ + src/gp2x/inputmode.o \ + src/gp2x/menu/menu_helper.o \ + src/gp2x/menu/menu_config.o \ + src/gp2x/menu/menu.o +ifdef GUICHAN_GUI +CFLAGS+= -DUSE_GUICHAN +OBJS += src/menu_guichan/menu_guichan.o \ + src/menu_guichan/menuTabMain.o \ + src/menu_guichan/menuTabFloppy.o \ + src/menu_guichan/menuTabHD.o \ + src/menu_guichan/menuTabDisplaySound.o \ + src/menu_guichan/menuTabSavestates.o \ + src/menu_guichan/menuTabControl.o \ + src/menu_guichan/menuTabCustomCtrl.o \ + src/menu_guichan/menuMessage.o \ + src/menu_guichan/menuLoad_guichan.o \ + src/menu_guichan/menuConfigManager.o \ + src/menu_guichan/uaeradiobutton.o \ + src/menu_guichan/uaedropdown.o +ifdef ANDROIDSDL +OBJS += src/menu_guichan/menuTabOnScreen.o +endif +ifdef PANDORA +OBJS += src/menu_guichan/sdltruetypefont.o +endif +else +OBJS += src/gp2x/menu/menu_fileinfo.o \ + src/gp2x/menu/menu_load.o \ + src/gp2x/menu/menu_main.o \ + src/gp2x/menu/menu_savestates.o \ + src/gp2x/menu/menu_misc.o \ + src/gp2x/menu/menu_controls.o \ + src/gp2x/menu/menu_display.o \ + src/gp2x/menu/menu_memory_disk.o +endif + +ifdef SDLSOUND +CFLAGS+= -DUSE_SDLSOUND +OBJS += src/sound.o +else +ifdef NEWSDLSOUND +OBJS += src/sound_sdl_new.o +else +OBJS += src/sound_gp2x.o +endif +endif + +ifdef FAME_CORE +ifdef FAME_CORE_C +CFLAGS+=-DUSE_FAME_CORE -DUSE_FAME_CORE_C -DFAME_IRQ_CLOCKING -DFAME_CHECK_BRANCHES -DFAME_EMULATE_TRACE -DFAME_DIRECT_MAPPING -DFAME_BYPASS_TAS_WRITEBACK -DFAME_ACCURATE_TIMING -DFAME_GLOBAL_CONTEXT -DFAME_FETCHBITS=8 -DFAME_DATABITS=8 -DFAME_NO_RESTORE_PC_MASKED_BITS +CFLAGS+=-DWITH_TESTMODE + +src/m68k/fame/famec.o: src/m68k/fame/famec.cpp +OBJS += src/m68k/fame/famec.o +else +CFLAGS+=-DUSE_FAME_CORE +src/m68k/fame/fame.o: src/m68k/fame/fame.asm + nasm src/m68k/fame/fame.asm +OBJS += src/m68k/fame/fame.o +endif +OBJS += src/m68k/fame/m68k_intrf.o +OBJS += src/m68k/m68k_cmn_intrf.o +else +OBJS += \ + src/m68k/uae/newcpu.o \ + src/m68k/uae/readcpu.o \ + src/m68k/uae/cpudefs.o \ + src/m68k/uae/fpp.o \ + src/m68k/uae/cpustbl.o \ + src/m68k/uae/cpuemu.o +endif + +CPPFLAGS = $(CFLAGS) + +$(PROG): $(OBJS) + $(CXX) $(CFLAGS) -o $(PROG) $(OBJS) $(LDFLAGS) +ifndef DEBUG +# $(STRIP) $(PROG) +endif + +run: $(PROG) + ./$(PROG) + +clean: + $(RM) $(PROG) $(OBJS) diff --git a/Makefile.aros-x86 b/Makefile.aros-x86 new file mode 100755 index 0000000..da6e0e6 --- /dev/null +++ b/Makefile.aros-x86 @@ -0,0 +1,170 @@ +MORE_CFLAGS += -DGP2X -DPANDORA -DDOUBLEBUFFER -DAROS + +NAME = uae4all2 +O = o +RM = rm -f + +PROG = $(NAME) + +all: $(PROG) + +FAME_CORE=1 +FAME_CORE_C=1 +#SDLSOUND=1 +NEWSDLSOUND=1 +#DEBUG=1 +#TEXT_GUI=1 +GUICHAN_GUI=1 +PANDORA=1 + +DEFAULT_CFLAGS = `sdl-config --cflags` + +LDFLAGS = -lguichan -lSDL_image -lSDL_ttf -lfreetype2 -lz -lpng -ljpeg `sdl-config --libs` + +MORE_CFLAGS += -Isrc -Isrc/gp2x -Isrc/vkbd -Isrc/menu -Isrc/include -Isrc/gp2x/menu -fomit-frame-pointer -Wno-unused -Wno-format -nix -DUSE_SDL -DGCCCONSTFUNC="__attribute__((const))" -DUSE_UNDERSCORE -DUNALIGNED_PROFITABLE -DOPTIMIZED_FLAGS -DSHM_SUPPORT_LINKS=0 -DOS_WITHOUT_MEMORY_MANAGEMENT -DVKBD_ALWAYS -DUSE_UAE4ALL_VKBD + +MORE_CFLAGS += -DROM_PATH_PREFIX=\"./\" -DDATA_PREFIX=\"./data/\" -DSAVE_PREFIX=\"./saves/\" + +ifndef DEBUG +MORE_CFLAGS += -O2 -ffast-math +MORE_CFLAGS += -fstrict-aliasing -fexpensive-optimizations +MORE_CFLAGS += -fweb -frename-registers -fomit-frame-pointer +#MORE_CFLAGS += -falign-functions=32 -falign-loops -falign-labels -falign-jumps +MORE_CFLAGS += -falign-functions=32 +MORE_CFLAGS += -finline -finline-functions -fno-builtin +else +MORE_CFLAGS += -ggdb +endif + +#ASFLAGS += -mfloat-abi=soft -Wall + +MORE_CFLAGS+= -DUSE_AUTOCONFIG +MORE_CFLAGS+= -DUSE_ZFILE +MORE_CFLAGS+= -DFAME_INTERRUPTS_PATCH +# Turrican3 becomes unstable if this is not enabled +MORE_CFLAGS+= -DSAFE_MEMORY_ACCESS +#MORE_CFLAGS+= -DDEBUG_SAVESTATE + +CFLAGS = $(DEFAULT_CFLAGS) $(MORE_CFLAGS) + +OBJS = \ + src/audio.o \ + src/autoconf.o \ + src/blitfunc.o \ + src/blittable.o \ + src/blitter.o \ + src/cfgfile.o \ + src/cia.o \ + src/compiler.o \ + src/savedisk.o \ + src/savestate.o \ + src/custom.o \ + src/disk.o \ + src/drawing.o \ + src/ersatz.o \ + src/expansion.o \ + src/filesys.o \ + src/fsdb.o \ + src/fsdb_unix.o \ + src/fsusage.o \ + src/gfxutil.o \ + src/hardfile.o \ + src/keybuf.o \ + src/main.o \ + src/memory.o \ + src/missing.o \ + src/native2amiga.o \ + src/gui.o \ + src/od-joy.o \ + src/scsi-none.o \ + src/sdlgfx.o \ + src/writelog.o \ + src/zfile.o \ + src/menu/fade.o \ + src/vkbd/vkbd.o \ + src/gp2x/gp2x.o \ + src/gp2x/inputmode.o \ + src/gp2x/menu/menu_helper.o \ + src/gp2x/menu/menu_config.o \ + src/gp2x/menu/menu.o +ifdef GUICHAN_GUI +CFLAGS+= -DUSE_GUICHAN +OBJS += src/menu_guichan/menu_guichan.o \ + src/menu_guichan/menuTabMain.o \ + src/menu_guichan/menuTabFloppy.o \ + src/menu_guichan/menuTabHD.o \ + src/menu_guichan/menuTabDisplaySound.o \ + src/menu_guichan/menuTabSavestates.o \ + src/menu_guichan/menuTabControl.o \ + src/menu_guichan/menuTabCustomCtrl.o \ + src/menu_guichan/menuMessage.o \ + src/menu_guichan/menuLoad_guichan.o \ + src/menu_guichan/menuConfigManager.o \ + src/menu_guichan/uaeradiobutton.o \ + src/menu_guichan/uaedropdown.o +ifdef ANDROIDSDL +OBJS += src/menu_guichan/menuTabOnScreen.o +endif +ifdef PANDORA +OBJS += src/menu_guichan/sdltruetypefont.o +endif +else +OBJS += src/gp2x/menu/menu_fileinfo.o \ + src/gp2x/menu/menu_load.o \ + src/gp2x/menu/menu_main.o \ + src/gp2x/menu/menu_savestates.o \ + src/gp2x/menu/menu_misc.o \ + src/gp2x/menu/menu_controls.o \ + src/gp2x/menu/menu_display.o \ + src/gp2x/menu/menu_memory_disk.o +endif + +ifdef SDLSOUND +CFLAGS+= -DUSE_SDLSOUND +OBJS += src/sound.o +else +ifdef NEWSDLSOUND +OBJS += src/sound_sdl_new.o +else +OBJS += src/sound_gp2x.o +endif +endif + +ifdef FAME_CORE +ifdef FAME_CORE_C +CFLAGS+=-DUSE_FAME_CORE -DUSE_FAME_CORE_C -DFAME_IRQ_CLOCKING -DFAME_CHECK_BRANCHES -DFAME_EMULATE_TRACE -DFAME_DIRECT_MAPPING -DFAME_BYPASS_TAS_WRITEBACK -DFAME_ACCURATE_TIMING -DFAME_GLOBAL_CONTEXT -DFAME_FETCHBITS=8 -DFAME_DATABITS=8 -DFAME_NO_RESTORE_PC_MASKED_BITS +CFLAGS+=-DWITH_TESTMODE + +src/m68k/fame/famec.o: src/m68k/fame/famec.cpp +OBJS += src/m68k/fame/famec.o +else +CFLAGS+=-DUSE_FAME_CORE +src/m68k/fame/fame.o: src/m68k/fame/fame.asm + nasm src/m68k/fame/fame.asm +OBJS += src/m68k/fame/fame.o +endif +OBJS += src/m68k/fame/m68k_intrf.o +OBJS += src/m68k/m68k_cmn_intrf.o +else +OBJS += \ + src/m68k/uae/newcpu.o \ + src/m68k/uae/readcpu.o \ + src/m68k/uae/cpudefs.o \ + src/m68k/uae/fpp.o \ + src/m68k/uae/cpustbl.o \ + src/m68k/uae/cpuemu.o +endif + +CPPFLAGS = $(CFLAGS) + +$(PROG): $(OBJS) + $(CXX) $(CFLAGS) -o $(PROG) $(OBJS) $(LDFLAGS) +ifndef DEBUG +# $(STRIP) $(PROG) +endif + +run: $(PROG) + ./$(PROG) + +clean: + $(RM) $(PROG) $(OBJS) diff --git a/src/fsusage.cpp b/src/fsusage.cpp index f7bdfe0..bb0a963 100755 --- a/src/fsusage.cpp +++ b/src/fsusage.cpp @@ -66,8 +66,10 @@ int statfs (); #endif #if HAVE_SYS_VFS_H +#ifndef AROS # include #endif +#endif #if HAVE_SYS_FS_S5PARAM_H /* Fujitsu UXP/V */ # include @@ -82,8 +84,10 @@ int statfs (); #endif #if HAVE_SYS_STATFS_H +#ifndef AROS # include #endif +#endif #if HAVE_DUSTAT_H /* AIX PS/2 */ # include diff --git a/src/gp2x/gp2x.cpp b/src/gp2x/gp2x.cpp index 6f26702..cf5efdd 100755 --- a/src/gp2x/gp2x.cpp +++ b/src/gp2x/gp2x.cpp @@ -7,14 +7,14 @@ #include #include -#ifndef WIN32 +#if !( defined(WIN32) || defined(AROS) ) #include #endif #include #include -#if !( defined(WIN32) || defined(ANDROIDSDL) ) +#if !( defined(WIN32) || defined(ANDROIDSDL) || defined(AROS)) #include #endif @@ -27,7 +27,7 @@ #include #include -#if !( defined(WIN32) || defined(ANDROIDSDL) ) +#if !( defined(WIN32) || defined(ANDROIDSDL) || defined(AROS)) #include #endif @@ -107,8 +107,9 @@ unsigned long gp2x_joystick_read(int allow_usb_joy) void gp2x_init(int argc, char **argv) { unsigned long memdev; - +#ifndef AROS mixerdev = open("/dev/mixer", O_RDWR); +#endif SDL_ShowCursor(SDL_DISABLE); getcwd(launchDir, 250); diff --git a/src/gp2x/menu/menu_helper.cpp b/src/gp2x/menu/menu_helper.cpp index b22a9dc..768d54f 100755 --- a/src/gp2x/menu/menu_helper.cpp +++ b/src/gp2x/menu/menu_helper.cpp @@ -135,9 +135,9 @@ void update_display() update_onscreen(); #endif -#if defined(PANDORA) && !defined(WIN32) +#if defined(PANDORA) && !(defined(WIN32) || defined(AROS)) prSDLScreen = SDL_SetVideoMode(visibleAreaWidth, mainMenu_displayedLines, 16, SDL_SWSURFACE|SDL_FULLSCREEN|SDL_DOUBLEBUF); -#elif defined(PANDORA) && defined(WIN32) +#elif defined(PANDORA) && (defined(WIN32) || defined(AROS)) prSDLScreen = SDL_SetVideoMode(visibleAreaWidth, mainMenu_displayedLines, 16, SDL_SWSURFACE|SDL_DOUBLEBUF); #else prSDLScreen = SDL_SetVideoMode(visibleAreaWidth, mainMenu_displayedLines, 16, SDL_SWSURFACE|SDL_FULLSCREEN); diff --git a/src/gui.cpp b/src/gui.cpp index 0d52683..fcb0cdf 100755 --- a/src/gui.cpp +++ b/src/gui.cpp @@ -129,7 +129,7 @@ static void getChanges(void) int gui_init (void) { SDL_ShowCursor(SDL_DISABLE); -#ifndef ANDROIDSDL +#if !(defined(ANDROIDSDL) || defined(AROS)) SDL_JoystickEventState(SDL_ENABLE); SDL_JoystickOpen(0); #endif diff --git a/src/include/NavigationMap.h b/src/include/NavigationMap.h index 17af525..da3624c 100755 --- a/src/include/NavigationMap.h +++ b/src/include/NavigationMap.h @@ -21,7 +21,7 @@ NavigationMap navMap[] = { "68000", "ChipMem", "1.2", "tabbedArea", "68020" }, { "68020", "ChipMem", "1.3", "68000", "OCS" }, { "OCS", "FastMem", "3.1", "68020", "ECS" }, -#if defined(PANDORA) && !defined(WIN32) +#if defined(PANDORA) && !(defined(WIN32) || defined(AROS)) { "ECS", "PandSpeed", "AROS", "OCS", "AGA" }, { "AGA", "PandSpeed", "BlitterMode", "ECS", "Reset" }, #else @@ -33,16 +33,16 @@ NavigationMap navMap[] = { "1.3", "68020", "14MHz", "1.2", "2.0" }, { "2.0", "OCS", "28MHz", "1.3", "3.1" }, { "3.1", "OCS", "28MHz", "2.0", "AROS" }, -#if defined(PANDORA) && !defined(WIN32) +#if defined(PANDORA) && !(defined(WIN32) || defined(AROS)) { "AROS", "ECS", "PandSpeed", "3.1", "BlitterMode" }, #endif -#if defined(WIN32) || defined(ANDROIDSDL) +#if defined(AROS) || defined(WIN32) || defined(ANDROIDSDL) { "AROS", "ECS", "112MHz", "3.1", "BM_normal" }, #endif { "7MHz", "1.2", "ChipMem", "tabbedArea", "14MHz" }, { "14MHz", "1.3", "ChipMem", "7MHz", "28MHz" }, -#if defined(PANDORA) && !defined(WIN32) +#if defined(PANDORA) && !(defined(WIN32) || defined(AROS)) { "28MHz", "2.0", "SlowMem", "14MHz", "BlitterMode" }, { "BlitterMode", "AGA", "PandSpeed", "---", "---" }, #else @@ -58,7 +58,7 @@ NavigationMap navMap[] = { "ChipMem", "---", "---", "tabbedArea", "SlowMem" }, { "SlowMem", "---", "---", "ChipMem", "FastMem" }, -#if defined(PANDORA) && !defined(WIN32) +#if defined(PANDORA) && !(defined(WIN32) || defined(AROS)) { "FastMem", "---", "---", "SlowMem", "PandSpeed" }, #else { "FastMem", "---", "---", "SlowMem", "Save Config" }, @@ -152,7 +152,7 @@ NavigationMap navMap[] = { "Port0", "ControlCfg2", "Light", "tabbedArea", "Port1" }, { "Port1", "ControlCfg4", "Medium", "Port0", "Both" }, -#if defined(WIN32) || defined(ANDROIDSDL) +#if defined(AROS) || defined(WIN32) || defined(ANDROIDSDL) { "Both", "ControlCfg4", "Heavy", "Port1", "Reset" }, #else { "Both", "ControlCfg4", "Heavy", "Port1", "StatusOn" }, @@ -167,7 +167,7 @@ NavigationMap navMap[] = { "Mouse.25", "Light", "TapNormal", "tabbedArea", "Mouse.5" }, { "Mouse.5", "Medium", "TapShort", "Mouse.25", "Mouse1x" }, { "Mouse1x", "Heavy", "TapNo", "Mouse.5", "Mouse2x" }, -#if defined(WIN32) || defined(ANDROIDSDL) +#if defined(AROS) || defined(WIN32) || defined(ANDROIDSDL) { "Mouse2x", "Heavy", "StatusLine", "Mouse1x", "Mouse4x" }, { "Mouse4x", "Heavy", "StatusLine", "Mouse2x", "StylusOffset" }, #else @@ -177,7 +177,7 @@ NavigationMap navMap[] = { "TapNormal", "Mouse.25", "ControlCfg1", "tabbedArea", "TapShort" }, { "TapShort", "Mouse.5", "ControlCfg3", "TapNormal", "TapNo" }, -#if defined(WIN32) || defined(ANDROIDSDL) +#if defined(AROS) || defined(WIN32) || defined(ANDROIDSDL) { "TapNo", "Mouse1x", "ControlCfg3", "TapShort", "StatusLine" }, { "StatusLine", "Mouse4x", "ControlCfg3", "TapNo", "StylusOffset" }, diff --git a/src/memory.cpp b/src/memory.cpp index cd0b26b..c81b429 100755 --- a/src/memory.cpp +++ b/src/memory.cpp @@ -896,15 +896,7 @@ static int load_kickstart (void) FILE *f = uae4all_rom_fopen(romfile, "rb"); if (f == NULL) { -#if defined(AMIGA)||defined(__POS__) -#define USE_UAE_ERSATZ "USE_UAE_ERSATZ" - if (!getenv (USE_UAE_ERSATZ)) { - write_log ("Using current ROM. (create ENV:%s to " "use uae's ROM replacement)\n", USE_UAE_ERSATZ); - memcpy (kickmemory, (char *) 0x1000000 - kickmem_size, kickmem_size); - kickstart_checksum (kickmemory, kickmem_size); - goto chk_sum; - } -#endif + return 0; } diff --git a/src/menu_guichan/menuLoad_guichan.cpp b/src/menu_guichan/menuLoad_guichan.cpp index 82ece54..f95af25 100755 --- a/src/menu_guichan/menuLoad_guichan.cpp +++ b/src/menu_guichan/menuLoad_guichan.cpp @@ -18,7 +18,7 @@ #include "gui.h" #include "cfgfile.h" -#ifdef WIN32 +#if defined(WIN32) #define realpath(N,R) _fullpath((R),(N),_MAX_PATH) #endif @@ -27,6 +27,95 @@ #define hddirterms extterms!=".hdf" && extterms!=".HDF" && extterms!=".Hdf" #define configterms extterms!="conf" && extterms!="CONF" && extterms!="Conf" +#define _XOPEN_SOURCE 500 +#if defined(AROS) +#include + + #if defined(__GP2X__) || defined(__WIZ__) || defined(__CAANOO__) || defined(__amigaos__) + // This is a random default value ... + #define PATH_MAX 32768 + #endif + + static char *sep(char *path) + { + char *tmp, c; + + tmp = strrchr(path, '/'); + if(tmp) { + c = tmp[1]; + tmp[1] = 0; + if (chdir(path)) { + return NULL; + } + tmp[1] = c; + + return tmp + 1; + } + return path; + } + + char *realpath(const char *_path, char *resolved_path) + { + int fd = open(".", O_RDONLY), l; + char current_dir_path[PATH_MAX]; + char path[PATH_MAX], lnk[PATH_MAX], *tmp = (char *)""; + + if (fd < 0) { + return NULL; + } + getcwd(current_dir_path,PATH_MAX); + strncpy(path, _path, PATH_MAX); + + if (chdir(path)) { + if (errno == ENOTDIR) { + #if defined(__WIN32__) || defined(__MORPHOS__) || defined(__amigaos__) + // No symbolic links and no readlink() + l = -1; + #else + l = readlink(path, lnk, PATH_MAX); + #endif + if (!(tmp = sep(path))) { + resolved_path = NULL; + goto abort; + } + if (l < 0) { + if (errno != EINVAL) { + resolved_path = NULL; + goto abort; + } + } else { + lnk[l] = 0; + if (!(tmp = sep(lnk))) { + resolved_path = NULL; + goto abort; + } + } + } else { + resolved_path = NULL; + goto abort; + } + } + + if(resolved_path==NULL) // if we called realpath with null as a 2nd arg + resolved_path = (char*) malloc( PATH_MAX ); + + if (!getcwd(resolved_path, PATH_MAX)) { + resolved_path = NULL; + goto abort; + } + + if(strcmp(resolved_path, "..") && *tmp) { + strcat(resolved_path, ".."); + } + + strcat(resolved_path, tmp); + abort: + chdir(current_dir_path); + close(fd); + return resolved_path; + } + +#endif /* What is being loaded, floppy/hd dir/hdf */ int menu_load_type; @@ -104,10 +193,13 @@ namespace widgets else if (menu_load_type != MENU_LOAD_HD_DIR) files.push_back(dent->d_name); } + if(dirs.size() > 0 && dirs[0] == ".") dirs.erase(dirs.begin()); + closedir(dir); } + if(dirs.size() == 0) dirs.push_back(".."); @@ -233,7 +325,7 @@ namespace widgets public: void action(const gcn::ActionEvent& actionEvent) { -#if defined(WIN32) || defined(ANDROIDSDL) +#if defined(WIN32) || defined(ANDROIDSDL) || defined(AROS) || defined(RASPBERRY) if (menu_load_type != MENU_LOAD_HD_DIR) { #endif @@ -254,7 +346,7 @@ namespace widgets strcat(filename, "/"); strcat(filename, dirList.getElementAt(selected_item).c_str()); checkfilename(filename); -#if defined(WIN32) || defined(ANDROIDSDL) +#if defined(WIN32) || defined(ANDROIDSDL) || defined(AROS) || defined(RASPBERRY) } #endif } diff --git a/src/menu_guichan/menuTabMain.cpp b/src/menu_guichan/menuTabMain.cpp index 3a52a07..31f5738 100755 --- a/src/menu_guichan/menuTabMain.cpp +++ b/src/menu_guichan/menuTabMain.cpp @@ -51,7 +51,7 @@ namespace widgets gcn::UaeRadioButton* radioButton_chipsetocs; gcn::UaeRadioButton* radioButton_chipsetecs; gcn::UaeRadioButton* radioButton_chipsetaga; -#if !(defined (ANDROIDSDL) || defined (WIN32)) +#if !(defined (ANDROIDSDL) || defined (WIN32) || defined (AROS)) gcn::Container* backgrd_blittermode; gcn::Label* label_blittermode; gcn::UaeDropDown* dropDown_blittermode; @@ -71,7 +71,7 @@ namespace widgets gcn::UaeRadioButton* radioButton_cpuspeed_7Mhz; gcn::UaeRadioButton* radioButton_cpuspeed_14Mhz; gcn::UaeRadioButton* radioButton_cpuspeed_28Mhz; -#if defined(WIN32) || defined(ANDROIDSDL) +#if defined(AROS) || defined(WIN32) || defined(ANDROIDSDL) gcn::UaeRadioButton* radioButton_cpuspeed_56Mhz; gcn::UaeRadioButton* radioButton_cpuspeed_112Mhz; #endif @@ -125,7 +125,7 @@ namespace widgets PandSpeedListModel pandSpeedList; #endif -#if !(defined (ANDROIDSDL) || defined (WIN32)) +#if !(defined (ANDROIDSDL) || defined (WIN32) || defined (AROS)) class BlitterModeListModel : public gcn::ListModel { private: @@ -189,7 +189,7 @@ namespace widgets public: void action(const gcn::ActionEvent& actionEvent) { -#if !(defined (ANDROIDSDL) || defined (WIN32)) +#if !(defined (ANDROIDSDL) || defined (WIN32) || defined (AROS)) if (actionEvent.getSource() == dropDown_blittermode) { switch(dropDown_blittermode->getSelected()) @@ -249,7 +249,7 @@ namespace widgets mainMenu_CPU_speed=1; else if (actionEvent.getSource() == radioButton_cpuspeed_28Mhz) mainMenu_CPU_speed=2; -#if defined(WIN32) || defined(ANDROIDSDL) +#if defined(AROS) || defined(WIN32) || defined(ANDROIDSDL) else if (actionEvent.getSource() == radioButton_cpuspeed_56Mhz) mainMenu_CPU_speed=3; else if (actionEvent.getSource() == radioButton_cpuspeed_112Mhz) @@ -282,7 +282,7 @@ namespace widgets MemorySliderActionListener* memorySliderActionListener; -#if defined(PANDORA) && !defined(WIN32) +#if defined(PANDORA) && !(defined(AROS) || defined(WIN32)) class PandSpeedActionListener : public gcn::ActionListener { public: @@ -343,7 +343,7 @@ namespace widgets group_chipset->setBaseColor(baseCol); // Select Blitter mode -#if !(defined (ANDROIDSDL) || defined (WIN32)) +#if !(defined (ANDROIDSDL) || defined (WIN32) || defined (AROS)) label_blittermode = new gcn::Label("Blitter mode"); label_blittermode->setPosition(4, 2); backgrd_blittermode = new gcn::Container(); @@ -432,7 +432,7 @@ namespace widgets radioButton_cpuspeed_28Mhz = new gcn::UaeRadioButton("28MHz", "radiocpuspeedgroup"); radioButton_cpuspeed_28Mhz->setPosition(5,70); radioButton_cpuspeed_28Mhz->setId("28MHz"); -#if defined(WIN32) || defined(ANDROIDSDL) +#if defined(AROS) || defined(WIN32) || defined(ANDROIDSDL) radioButton_cpuspeed_56Mhz = new gcn::UaeRadioButton("56MHz", "radiocpuspeedgroup"); radioButton_cpuspeed_56Mhz->setPosition(5,100); radioButton_cpuspeed_56Mhz->setId("56MHz"); @@ -451,7 +451,7 @@ namespace widgets radioButton_cpuspeed_7Mhz->addActionListener(cpuSpeedButtonActionListener); radioButton_cpuspeed_14Mhz->addActionListener(cpuSpeedButtonActionListener); radioButton_cpuspeed_28Mhz->addActionListener(cpuSpeedButtonActionListener); -#if defined(WIN32) || defined(ANDROIDSDL) +#if defined(AROS) || defined(WIN32) || defined(ANDROIDSDL) radioButton_cpuspeed_56Mhz->addActionListener(cpuSpeedButtonActionListener); radioButton_cpuspeed_112Mhz->addActionListener(cpuSpeedButtonActionListener); #endif @@ -461,7 +461,7 @@ namespace widgets group_cpuspeed->add(radioButton_cpuspeed_14Mhz); group_cpuspeed->add(radioButton_cpuspeed_28Mhz); group_cpuspeed->setMovable(false); -#if defined(WIN32) || defined(ANDROIDSDL) +#if defined(AROS) || defined(WIN32) || defined(ANDROIDSDL) group_cpuspeed->add(radioButton_cpuspeed_56Mhz); group_cpuspeed->add(radioButton_cpuspeed_112Mhz); group_cpuspeed->setSize(87,175); @@ -558,7 +558,7 @@ namespace widgets window_memory->setSize(287,160); window_memory->setBaseColor(baseCol); -#if defined(PANDORA) && !defined(WIN32) +#if defined(PANDORA) && !(defined(AROS) || defined(WIN32)) // Pandora CPU speed label_pandspeed = new gcn::Label("Pandora MHz"); label_pandspeed->setPosition(4, 2); @@ -581,7 +581,7 @@ namespace widgets tab_main->add(icon_winlogo); tab_main->add(group_cpu); tab_main->add(group_chipset); -#if !(defined (ANDROIDSDL) || defined (WIN32)) +#if !(defined (ANDROIDSDL) || defined (WIN32) || defined (AROS)) tab_main->add(backgrd_blittermode); tab_main->add(dropDown_blittermode); #else @@ -590,7 +590,7 @@ namespace widgets tab_main->add(group_kickstart); tab_main->add(group_cpuspeed); tab_main->add(window_memory); -#if defined(PANDORA) && !defined(WIN32) +#if defined(PANDORA) && !(defined(AROS) || defined(WIN32)) tab_main->add(backgrd_pandspeed); tab_main->add(dropDown_pandspeed); #endif @@ -609,7 +609,7 @@ namespace widgets delete radioButton_chipsetocs; delete radioButton_chipsetecs; delete radioButton_chipsetaga; -#if !(defined (ANDROIDSDL) || defined (WIN32)) +#if !(defined (ANDROIDSDL) || defined (WIN32) || defined (AROS)) delete backgrd_blittermode; delete label_blittermode; delete dropDown_blittermode; @@ -629,7 +629,7 @@ namespace widgets delete radioButton_cpuspeed_7Mhz; delete radioButton_cpuspeed_14Mhz; delete radioButton_cpuspeed_28Mhz; -#if defined(WIN32) || defined(ANDROIDSDL) +#if defined(AROS) || defined(WIN32) || defined(ANDROIDSDL) delete radioButton_cpuspeed_56Mhz; delete radioButton_cpuspeed_112Mhz; #endif @@ -650,7 +650,7 @@ namespace widgets delete slider_slowmem; delete slider_fastmem; -#if defined(PANDORA) && !defined(WIN32) +#if defined(PANDORA) && !(defined(AROS) || defined(WIN32)) delete backgrd_pandspeed; delete label_pandspeed; delete dropDown_pandspeed; @@ -662,7 +662,7 @@ namespace widgets delete kickstartButtonActionListener; delete cpuSpeedButtonActionListener; delete memorySliderActionListener; -#if defined(PANDORA) && !defined(WIN32) +#if defined(PANDORA) && !(defined(AROS) || defined(WIN32)) delete pandSpeedActionListener; #endif } @@ -681,7 +681,7 @@ namespace widgets radioButton_chipsetecs->setSelected(true); else if ((mainMenu_chipset & 0xff) == 2) radioButton_chipsetaga->setSelected(true); -#if !(defined (ANDROIDSDL) || defined (WIN32)) +#if !(defined (ANDROIDSDL) || defined (WIN32) || defined (AROS)) if (mainMenu_chipset & 0x100) dropDown_blittermode->setSelected(1); else if (mainMenu_chipset & 0x200) @@ -713,7 +713,7 @@ namespace widgets radioButton_cpuspeed_14Mhz->setSelected(true); else if (mainMenu_CPU_speed==2) radioButton_cpuspeed_28Mhz->setSelected(true); -#if defined(WIN32) || defined(ANDROIDSDL) +#if defined(AROS) || defined(WIN32) || defined(ANDROIDSDL) else if (mainMenu_CPU_speed==3) radioButton_cpuspeed_56Mhz->setSelected(true); else if (mainMenu_CPU_speed==4) @@ -730,7 +730,7 @@ namespace widgets label_slowsize->setCaption(SlowMem_list[mainMenu_slowMemory]); label_fastsize->setCaption(FastMem_list[mainMenu_fastMemory]); -#if defined(PANDORA) && !defined(WIN32) +#if defined(PANDORA) && !(defined(AROS) || defined(WIN32)) if(dropDown_pandspeed->getSelected() != (mainMenu_cpuSpeed - 500) / 20) dropDown_pandspeed->setSelected((mainMenu_cpuSpeed - 500) / 20); #endif diff --git a/src/menu_guichan/menu_guichan.cpp b/src/menu_guichan/menu_guichan.cpp index ff05b91..0081f8a 100755 --- a/src/menu_guichan/menu_guichan.cpp +++ b/src/menu_guichan/menu_guichan.cpp @@ -640,7 +640,7 @@ namespace widgets quitButtonActionListener = new QuitButtonActionListener(); button_quit->addActionListener(quitButtonActionListener); -#if defined(WIN32) || defined(ANDROIDSDL) +#if defined(AROS) || defined(WIN32) || defined(ANDROIDSDL) button_reset = new gcn::Button("Start"); #else button_reset = new gcn::Button("Reset"); @@ -1077,7 +1077,7 @@ int run_mainMenuGuichan() resetCpuSpeed(); #endif #ifndef USE_SDLSOUND - gp2x_stop_sound(); +// gp2x_stop_sound(); #endif saveAdfDir(); #ifndef ANDROIDSDL diff --git a/src/od-joy.cpp b/src/od-joy.cpp index f81175b..2fdc917 100755 --- a/src/od-joy.cpp +++ b/src/od-joy.cpp @@ -62,6 +62,7 @@ void read_joystick(int nr, unsigned int *dir, int *button) int x_axis, y_axis; int left = 0, right = 0, top = 0, bot = 0, upRight=0, downRight=0, upLeft=0, downLeft=0, x=0, y=0, a=0, b=0; int len, i, num; + SDL_Joystick *joy = nr == 0 ? uae4all_joy0 : uae4all_joy1; *dir = 0; @@ -124,10 +125,17 @@ void read_joystick(int nr, unsigned int *dir, int *button) } else if (!triggerR /*R+dpad = arrow keys*/ && !(mainMenu_customControls && !mainMenu_custom_dpad)) { +#ifndef AROS if (dpadRight || SDL_JoystickGetAxis(joy, 0) > 0) right=1; if (dpadLeft || SDL_JoystickGetAxis(joy, 0) < 0) left=1; if (dpadUp || SDL_JoystickGetAxis(joy, 1) < 0) top=1; if (dpadDown || SDL_JoystickGetAxis(joy, 1) > 0) bot=1; +#else + if (dpadRight) right=1; + if (dpadLeft) left=1; + if (dpadUp) top=1; + if (dpadDown) bot=1; +#endif if (mainMenu_joyConf) { #ifdef USE_UAE4ALL_VKBD @@ -212,13 +220,13 @@ void read_joystick(int nr, unsigned int *dir, int *button) } else { -#ifndef ANDROIDSDL +#if !(defined(ANDROIDSDL) || defined(AROS)) *button = ((mainMenu_button1==GP2X_BUTTON_B && buttonA) || (mainMenu_button1==GP2X_BUTTON_X && buttonX) || (mainMenu_button1==GP2X_BUTTON_Y && buttonY) || SDL_JoystickGetButton(joy, mainMenu_button1)) & 1; #else *button = ((mainMenu_button1==GP2X_BUTTON_B && buttonA) || (mainMenu_button1==GP2X_BUTTON_X && buttonX) || (mainMenu_button1==GP2X_BUTTON_Y && buttonY)) & 1; #endif delay++; -#ifdef PANDORA +#if defined(PANDORA) && !defined(AROS) *button |= ((buttonB || SDL_JoystickGetButton(joy, mainMenu_button2)) & 1) << 1; #else *button |= ((buttonB) & 1) << 1; @@ -283,11 +291,11 @@ void init_joystick(void) int i; nr_joysticks = SDL_NumJoysticks (); if (nr_joysticks > 0) - uae4all_joy0 = SDL_JoystickOpen (0); + uae4all_joy0 = SDL_JoystickOpen (0); if (nr_joysticks > 1) - uae4all_joy1 = SDL_JoystickOpen (1); + uae4all_joy1 = SDL_JoystickOpen (1); else - uae4all_joy1 = NULL; + uae4all_joy1 = NULL; } void close_joystick(void) diff --git a/src/sdlgfx.cpp b/src/sdlgfx.cpp index 3e6abd8..b48487c 100755 --- a/src/sdlgfx.cpp +++ b/src/sdlgfx.cpp @@ -101,7 +101,7 @@ static int ncolors = 0; /* Keyboard and mouse */ int uae4all_keystate[256]; -#ifdef PANDORA +#if defined(PANDORA) || defined(ANDROIDSDL) static int shiftWasPressed = 0; #define SIMULATE_SHIFT 0x200 #define SIMULATE_RELEASED_SHIFT 0x400 @@ -282,7 +282,9 @@ int graphics_init (void) static void graphics_subshutdown (void) { +#ifndef AROS SDL_FreeSurface(prSDLScreen); +#endif } void graphics_leave (void)