Version 6

This commit is contained in:
fabio.olimpieri 2011-10-23 11:10:40 +00:00
parent 6fb9baf71f
commit ff6aa240d0
17 changed files with 1065 additions and 591 deletions

View File

@ -1,49 +1,73 @@
version 5: version 6:
* (build) Update to devkitpro r20 and the new SDL-wii trunk *(build) Update to devkitpro r24 and libogc 1.8.8
* Added SMB support
* Fix workbench graphics (thanks Fredric QJ Blåholtz) * Added mass storage usb support
* Many menu improvements (new colors, new popup messages, browsing with nunchuk, wider screen, etc.)
-- Simon Kagstrom <simon.kagstrom@gmail.com>, Tue Oct 20 19:30:35 CEST 2009 * Added nunchuck menu browsing
* Configuration file saved manually
version 4: * Several improvements in input configuration menu (single wiimote configurations,
* (build) Update to devkitpro r18 and the new SDL-wii trunk snd and trd button joystick, enable/disable mouse emulation, etc.)
* Name of the loaded file in the menu header
* Add Mario Kart wheel support: Let the orientation of the wiimote control * Added logfile option
left-right joystick direction. Useful for stunt car racer. This feature * Fixed correct aspect option (to adapt the Amiga screen to Wii screen)
requires SDL r62 or above. * Fixed mouse jerkiness
* Fixed second Joystick configuration issue
-- Simon Kagstrom <simon.kagstrom@gmail.com>, Tue Oct 20 19:30:35 CEST 2009 * Other small fixes
version 3: -- Fabio Olimpieri <fabio.olimpieri@tin.it>, sept 23 CEST 2011
* Correct banner showing errors (a SDL_Flip was needed)
version 5.1:
* Support Cloanto's amiga forever ROMs in the default config
* (build) Update to devkitpro r24 and libogc 1.8.7
-- Simon Kagstrom <simon.kagstrom@gmail.com>, Sat Jul 4 09:32:30 CEST 2009
-- Fabio Olimpieri <fabio.olimpieri@tin.it>, sept 23 CEST 2011
version 2:
* Fix bug where the nunchuk analogue controller and version 5:
the DPAD would not work at the same time * (build) Update to devkitpro r20 and the new SDL-wii trunk
* Lots of menu improvements (pressing 1 will now go * Fix workbench graphics (thanks Fredric QJ Blåholtz)
back to the last menu for example)
-- Simon Kagstrom <simon.kagstrom@gmail.com>, Tue Oct 20 19:30:35 CEST 2009
* Enable use of harddisks
version 4:
* Fix save/restore state * (build) Update to devkitpro r18 and the new SDL-wii trunk
* Add virtual keyboard (for binding joystick buttons to keyboard keys) * Add Mario Kart wheel support: Let the orientation of the wiimote control
left-right joystick direction. Useful for stunt car racer. This feature
* Load a uaerc.user if it exists. This is also saved when configuration changes and it requires SDL r62 or above.
overrides stuff from uaerc
-- Simon Kagstrom <simon.kagstrom@gmail.com>, Tue Oct 20 19:30:35 CEST 2009
* Allow setting of Amiga type (from PSPUae / FOL)
version 3:
* Better default configuration (from PSPUae / FOL) * Correct banner showing errors (a SDL_Flip was needed)
-- Simon Kagstrom <simon.kagstrom@gmail.com>, Sun May 31 09:23:43 CEST 2009 * Support Cloanto's amiga forever ROMs in the default config
version 1: -- Simon Kagstrom <simon.kagstrom@gmail.com>, Sat Jul 4 09:32:30 CEST 2009
* Initial release
version 2:
-- Simon Kagstrom <simon.kagstrom@gmail.com> * Fix bug where the nunchuk analogue controller and
the DPAD would not work at the same time
* Lots of menu improvements (pressing 1 will now go
back to the last menu for example)
* Enable use of harddisks
* Fix save/restore state
* Add virtual keyboard (for binding joystick buttons to keyboard keys)
* Load a uaerc.user if it exists. This is also saved when configuration changes and it
overrides stuff from uaerc
* Allow setting of Amiga type (from PSPUae / FOL)
* Better default configuration (from PSPUae / FOL)
-- Simon Kagstrom <simon.kagstrom@gmail.com>, Sun May 31 09:23:43 CEST 2009
version 1:
* Initial release
-- Simon Kagstrom <simon.kagstrom@gmail.com>

18
Makefile Normal file
View File

@ -0,0 +1,18 @@
all:
make -f Makefile.wii
run:
make run -f Makefile.wii
clean:
make clean -f Makefile.wii
dist:
make dist -f Makefile.wii

View File

@ -1,186 +1,199 @@
#--------------------------------------------------------------------------------- #---------------------------------------------------------------------------------
# Clear the implicit built in rules # Clear the implicit built in rules
#--------------------------------------------------------------------------------- #---------------------------------------------------------------------------------
.SUFFIXES: .SUFFIXES:
#--------------------------------------------------------------------------------- #---------------------------------------------------------------------------------
ifeq ($(strip $(DEVKITPPC)),) ifeq ($(strip $(DEVKITPPC)),)
$(error "Please set DEVKITPPC in your environment. export DEVKITPPC=<path to>devkitPPC") $(error "Please set DEVKITPPC in your environment. export DEVKITPPC=<path to>devkitPPC")
endif endif
include $(DEVKITPPC)/wii_rules include $(DEVKITPPC)/wii_rules
# Directories. # Directories.
OBJ_DIR := obj OBJ_DIR := obj
LIB_DIR := lib LIB_DIR := lib
BIN_DIR := . BIN_DIR := .
SRC_DIR := src SRC_DIR := src
INCLUDE_DIR := include INCLUDE_DIR := include
# Tools. # Tools.
PIPE_TO_SED := 2>&1 | sed "s/:\([0-9]*\):/\(\1\) :/" PIPE_TO_SED := 2>&1 | sed "s/:\([0-9]*\):/\(\1\) :/"
SYMLINKS=src/machdep src/osdep src/gfxdep src/joydep src/guidep src/sounddep src/threaddep SYMLINKS=src/machdep src/osdep src/gfxdep src/joydep src/guidep src/sounddep src/threaddep
# Source files. # Source files.
SRCS := $(wildcard $(SRC_DIR)/*.c $(SRC_DIR)/caps/*.c $(SRC_DIR)/dms/*.c $(SRC_DIR)/keymap/*.c) \ SRCS := $(wildcard $(SRC_DIR)/*.c $(SRC_DIR)/caps/*.c $(SRC_DIR)/dms/*.c $(SRC_DIR)/keymap/*.c) \
$(SRC_DIR)/machdep/support.c $(SRC_DIR)/gfxdep/rawkeys.c $(SRC_DIR)/guidep/gui-sdl.c $(SRC_DIR)/sounddep/sound.c \ $(SRC_DIR)/machdep/support.c $(SRC_DIR)/gfxdep/rawkeys.c $(SRC_DIR)/guidep/gui-sdl.c $(SRC_DIR)/sounddep/sound.c \
$(SRC_DIR)/gfxdep/sdlgfx.c $(SRC_DIR)/guidep/menu.c $(SRC_DIR)/osdep/main.c $(SRC_DIR)/threaddep/thread.c \ $(SRC_DIR)/gfxdep/sdlgfx.c $(SRC_DIR)/guidep/menu.c $(SRC_DIR)/osdep/main.c $(SRC_DIR)/threaddep/thread.c \
$(SRC_DIR)/gfxdep/sdlkeys.c $(SRC_DIR)/joydep/joystick.c $(SRC_DIR)/osdep/memory.c $(SRC_DIR)/gfxdep/sdlkeys.c $(SRC_DIR)/joydep/joystick.c $(SRC_DIR)/osdep/memory.c
SRCS := $(filter-out src/compemu_raw_x86.c src/compemu_fpp.c src/compemu_support.c src/svgancui.c src/build68k.c src/catweasel.c \ SRCS := $(filter-out src/compemu_raw_x86.c src/compemu_fpp.c src/compemu_support.c src/svgancui.c src/build68k.c src/catweasel.c \
src/cdrom.c src/blkdev-libscg.c src/blkdev.c src/blitops.c src/akiko.c src/filesys_bootrom.c \ src/cdrom.c src/blkdev-libscg.c src/blkdev.c src/blitops.c src/akiko.c src/filesys_bootrom.c \
src/genblitter.c src/gencomp.c src/gencpu.c \ src/genblitter.c src/gencomp.c src/gencpu.c \
src/genlinetoscr.c src/compemu.c src/compstbl.c \ src/genlinetoscr.c src/compemu.c src/compstbl.c \
src/enforcer.c src/ar.c src/debug.c \ src/enforcer.c src/ar.c src/debug.c \
src/readdisk.c src/gengenblitter.c src/scsiemul.c src/tui.c src/linetoscr.c, $(SRCS)) src/readdisk.c src/gengenblitter.c src/scsiemul.c src/tui.c src/linetoscr.c, $(SRCS))
genlinetoscr_args="-b" genlinetoscr_args="-b"
# Library object files. # Library object files.
OBJS := $(subst $(SRC_DIR),$(OBJ_DIR),$(SRCS:.c=.o)) $(OBJ_DIR)/guidep/VirtualKeyboard.o OBJS := $(subst $(SRC_DIR),$(OBJ_DIR),$(SRCS:.c=.o)) $(OBJ_DIR)/guidep/VirtualKeyboard.o
# Test source files. # Test source files.
# It can be useful to switch this variable around to select individual tests which are problematic. # It can be useful to switch this variable around to select individual tests which are problematic.
TEST_SRCS := $(TEST_SRC_DIR)/showfont.c TEST_SRCS := $(TEST_SRC_DIR)/showfont.c
src/tools/linetoscr:
cd src/tools/ && make -f Makefile.wii # What's a full build?
all: uae.dol
# What's a full build?
all: uae.dol src/tools/genlinetoscr.exe:
cd src/tools/ && make -f Makefile.wii
# How to delete the intermediate files.
clean: # How to delete the intermediate files.
@echo Cleaning $(OBJ_DIR) clean:
@rm -rf $(OBJS) $(OBJ_DIR) src/machdep src/target.h src/md-fpp.h src/sysconfig.h $(SYMLINKS) @echo Cleaning $(OBJ_DIR)
@rm -rf $(OBJS) $(OBJ_DIR) src/machdep src/target.h src/md-fpp.h src/sysconfig.h $(SYMLINKS)
$(OBJ_DIR): @rm -f src/blit.h src/blitfunc.c src/blitfunc.h src/blittable.c src/linetoscr.c
install -d $@ cd src/tools/ && make -f Makefile.wii clean
src/sysconfig.h: src/sysconfig.h.wii $(OBJ_DIR):
cp $< $@ install -d $@
src/machdep: src/sysconfig.h: src/sysconfig.h.wii
rm -f $@ cp $< $@
cd src && ln -s md-ppc-gcc machdep
src/machdep:
src/osdep: rm -f $@
rm -f $@ mkdir $@ && cd src/md-ppc-gcc && find . -maxdepth 1 -type f -exec ln '{}' ../machdep/'{}' ';'
cd src && ln -s od-generic osdep
src/osdep:
src/gfxdep: rm -f $@
rm -f $@ mkdir $@ && cd src/od-generic && find . -maxdepth 1 -type f -exec ln '{}' ../osdep/'{}' ';'
cd src && ln -s gfx-sdl gfxdep
src/gfxdep:
src/joydep: rm -f $@
rm -f $@ mkdir $@ && cd src/gfx-sdl && find . -maxdepth 1 -type f -exec ln '{}' ../gfxdep/'{}' ';'
cd src && ln -s jd-sdl joydep
src/joydep:
src/guidep: rm -f $@
rm -f $@ mkdir $@ && cd src/jd-sdl && find . -maxdepth 1 -type f -exec ln '{}' ../joydep/'{}' ';'
cd src && ln -s gui-sdl guidep
src/guidep:
src/sounddep: rm -f $@
rm -f $@ mkdir $@ && cd src/gui-sdl && find . -maxdepth 1 -type f -exec ln '{}' ../guidep/'{}' ';'
cd src && ln -s sd-sdl sounddep
src/sounddep:
src/threaddep: rm -f $@
rm -f $@ mkdir $@ && cd src/sd-sdl && find . -maxdepth 1 -type f -exec ln '{}' ../sounddep/'{}' ';'
cd src && ln -s td-sdl threaddep
src/threaddep:
src/target.h: rm -f $@
rm -f $@ mkdir $@ && cd src/td-sdl && find . -maxdepth 1 -type f -exec ln '{}' ../threaddep/'{}' ';'
cd src && ln -s targets/t-wii.h target.h
src/target.h:
src/md-fpp.h: rm -f $@
rm -f $@ cd src && ln -s targets/t-wii.h target.h
cd src && ln -s include/fpp-ieee.h md-fpp.h
src/md-fpp.h:
src/blit.h: src/tools/genblitter rm -f $@
src//tools/genblitter i >$@ cd src && ln -s include/fpp-ieee.h md-fpp.h
src/blitfunc.c: src/tools/genblitter src/blitfunc.h src/blit.h: src/tools/genblitter.exe
src/tools/genblitter f >$@ src/tools/genblitter.exe i >$@
src/blitfunc.h: src/tools/genblitter src/blitfunc.c: src/tools/genblitter.exe src/blitfunc.h
src/tools/genblitter h >$@ src/tools/genblitter.exe f >$@
src/blittable.c: src/tools/genblitter src/blitfunc.h src/blitfunc.h: src/tools/genblitter.exe
src/tools/genblitter t >$@ src/tools/genblitter.exe h >$@
src/linetoscr.c: src/tools/genlinetoscr src/blittable.c: src/tools/genblitter.exe src/blitfunc.h
src/tools/genlinetoscr $(genlinetoscr_args) >$@ src/tools/genblitter.exe t >$@
%.h: %.h.wii src/linetoscr.c: src/tools/genlinetoscr.exe
cp $< $@ src/tools/genlinetoscr.exe $(genlinetoscr_args) >$@
%.c: %.c.wii %.h: %.h.wii
cp $< $@ cp $< $@
# How to build a library. %.c: %.c.wii
$(LIB_DIR)/libSDL_ttf.a: $(OBJS) cp $< $@
@echo Archiving $@
@-mkdir -p $(dir $@) # How to build a library.
@powerpc-gekko-ar crs $@ $(OBJS) $(LIB_DIR)/libSDL_ttf.a: $(OBJS)
@echo ---- @echo Archiving $@
@-mkdir -p $(dir $@)
# How to build a DOL. @powerpc-eabi-ar crs $@ $(OBJS)
uae.dol: uae.elf @echo ----
@echo Creating DOL $@
@-mkdir -p $(dir $@) # How to build a DOL.
#powerpc-gekko-objcopy -O binary $< $@ uae.dol: uae.elf
elf2dol $< $@ @echo Creating DOL $@
@echo ---- @-mkdir -p $(dir $@)
#powerpc-eabi-objcopy -O binary $< $@
# Compilation flags. elf2dol $< $@
COMMON_FLAGS := -g -O3 -G8 -mrvl -Wall -D__inline__=__inline__ $(MACHDEP) @echo ----
INCLUDES := -Isrc/md-generic/ -Isrc/include -Isrc -I$(DEVKITPRO)/libogc/include -I$(DEVKITPRO)/libogc/include/SDL
DEFINES := -DOS_WITHOUT_MEMORY_MANAGEMENT -DSAVESTATE -DUSE_SDL -DSUPPORT_THREADS -DCPUEMU_0 -DCPUEMU_5 -DCPUEMU_6 \ # Compilation flags.
-DFPUEMU -DAGA -DAUTOCONFIG -DFILESYS \ COMMON_FLAGS := -g -O3 -G8 -mrvl -Wall -D__inline__=__inline__ $(MACHDEP) -Wno-unused-variable
-DTD_START_HEIGHT=16 INCLUDES := -Isrc/md-generic/ -Isrc/include -Isrc -I$(DEVKITPRO)/libogc/include -I$(DEVKITPRO)/libogc/include/SDL -I$(PORTLIBS)/include
CFLAGS := $(COMMON_FLAGS) $(INCLUDES) $(DEFINES) DEFINES := -DOS_WITHOUT_MEMORY_MANAGEMENT -DSAVESTATE -DUSE_SDL -DSUPPORT_THREADS -DCPUEMU_0 -DCPUEMU_5 -DCPUEMU_6 \
-DFPUEMU -DAGA -DAUTOCONFIG -DFILESYS \
#unused defines; -DFDI2RAW -DTD_START_HEIGHT=16
CFLAGS := $(COMMON_FLAGS) $(INCLUDES) $(DEFINES)
# Test link flags.
LDFLAGS := $(COMMON_FLAGS) -L$(LIB_DIR) -L$(DEVKITPRO)/libogc/lib -L$(DEVKITPRO)/libogc/lib/wii -lz -lSDL_ttf -lSDL -lfreetype -lfat -lwiiuse -lbte -logc -lm -lwiikeyboard #unused defines; -DFDI2RAW
dist: uae.dol # Test link flags.
LDFLAGS := $(COMMON_FLAGS) -L$(LIB_DIR) -L$(PORTLIBS)/lib -L$(DEVKITPRO)/libogc/lib -L$(DEVKITPRO)/libogc/lib/wii -lz -lSDL_ttf -lSDL -lfreetype -lfat -lwiiuse -lbte -logc -lm -lwiikeyboard -ltinysmb
dist: uae.dol
install -d $@/apps/uae
install -d $@/uae dist:uae.dol
install -d $@/uae/floppies install -d $@/apps/uae
install -d $@/uae/roms install -d $@/uae
install -d $@/uae/harddisks install -d $@/uae/floppies
install -d $@/uae/saves install -d $@/uae/roms
touch $@/uae/roms/put-your-kick-dot-rom-here install -d $@/uae/harddisks
cp $< $@/apps/uae/boot.dol install -d $@/uae/saves
cp meta.xml $@/apps/uae/ echo "dummy" > $@/uae/roms/put-your-kick-dot-rom-here
cp icon.png $@/apps/uae/ echo "dummy" > $@/uae/floppies/dummy
cp FreeMono.ttf $@/apps/uae/ echo "dummy" > $@/uae/harddisks/dummy
cp Smaller.ttf $@/apps/uae/ echo "dummy" > $@/uae/saves/dummy
cp README.Cloanto-Amiga_Forever $@/apps/uae/ cp $< $@/apps/uae/boot.dol
cp uaerc.wii $@/uae/uaerc cp meta.xml $@/apps/uae/
cd $@ && tar -czf ../uae-bin.tar.gz * cp icon.png $@/apps/uae/
cp FreeMono.ttf $@/apps/uae/
# How to link an ELF. cp Smaller.ttf $@/apps/uae/
uae.elf: src/tools/linetoscr src/blit.h src/blitfunc.c src/blitfunc.h src/blittable.c src/linetoscr.c $(SYMLINKS) src/target.h src/md-fpp.h src/sysconfig.h $(OBJS) cp README.Cloanto-Amiga_Forever $@/apps/uae/
@echo Linking $@ cp uaerc.wii $@/uae/uaerc
@-mkdir -p $(dir $@) cp uaerc.smb $@/uae/
$(CXX) -o $@ $(OBJS) $(LDFLAGS) cp docs/configuration.txt $@/apps/uae/
#keep elf for debugging cp docs/Joystick_mapping.txt $@/apps/uae/
#cp $@ /tmp/elf cd $@ && tar -czf ../uae-wii-bin.tar.gz *
# How to compile C file (SDL library). #---------------------------------------------------------------------------------
$(OBJ_DIR)/%.o: $(SRC_DIR)/%.c run:
@echo Compiling $< wiiload uae.dol
@-mkdir -p $(dir $@)
@$(CC) $(CFLAGS) -c $< -o $@ $(PIPE_TO_SED)
# How to link an ELF.
$(OBJ_DIR)/%.o: $(SRC_DIR)/%.cpp uae.elf: src/tools/genlinetoscr.exe src/blit.h src/blitfunc.c src/blitfunc.h src/blittable.c src/linetoscr.c $(SYMLINKS) src/target.h src/md-fpp.h src/sysconfig.h $(OBJS)
@echo Compiling $< @echo Linking $@
@-mkdir -p $(dir $@) @-mkdir -p $(dir $@)
@$(CXX) $(CFLAGS) -c $< -o $@ $(PIPE_TO_SED) $(CXX) -o $@ $(OBJS) $(LDFLAGS)
#keep elf for debugging
#cp $@ /tmp/elf
# How to compile C file (SDL library).
$(OBJ_DIR)/%.o: $(SRC_DIR)/%.c
@echo Compiling $<
@-mkdir -p $(dir $@)
@$(CC) $(CFLAGS) -c $< -o $@ $(PIPE_TO_SED)
$(OBJ_DIR)/%.o: $(SRC_DIR)/%.cpp
@echo Compiling $<
@-mkdir -p $(dir $@)
@$(CXX) $(CFLAGS) -c $< -o $@ $(PIPE_TO_SED)

91
docs/Joystick_mapping.txt Normal file
View File

@ -0,0 +1,91 @@
From http://www.freelists.org/post/uae/Configuring-keymapping
A few people have asked about if it's possible to re-configure the keymapping
in E-UAE. The answer is yes, but it's not easy to do, and it's not
documented.
Note: the whole handling of key-press translation needs to be re-thought. I
hacked in some code to support the translation of raw key codes, but it's
pretty much a mess at the moment.
Anyway, I thought the easiest was to explain how this can be done now is with
a couple of examples. You'll need to manually edit your config file.
Okay. Suppose (for some strange reason) you want the 'F1' key to produce the
equivalent of pressing the 'A' key on an Amiga keyboard. You're running E-UAE
on SDL/X11 on Linux, and you have raw key-mapping enabled
(sdl.map_raw_keys=true).
The first thing you need to do is to enable an alternate input configuration.
The default input configuration is number 0 and you can't modify that. You
can, however, modify configs 1 to 4. So:
input.config=1
Now, you change the mapping of the F1 key with:
input.1.keyboard.0.button.67=KEY_A
The is saying for input config 1 (the configuration you enabled above), for
keyboard 0 (the default), the button with keycode 67 will produce the input
event "KEY_A".
67 is the "raw" X11 scan code for the F1 key on Linux when using PC or Mac
keyboards. See the source file 'src/keymap/x11pc_rawkeys.c' for a list of
these. See 'src/keymap/quartz_rawkeys.c' for the OS X codes. Etc.
The input events are listed in 'src/inputevents.def'. The first parameter in
each DEFEVENT macro is the name of the input event.
Okay, let's try something more useful. Suppose you wanted to swap the left Alt
and left Amiga keys. Do this with:
input.1.keyboard.0.button.64=KEY_AMIGA_LEFT
input.1.keyboard.0.button.115=KEY_ALT_LEFT
Note that input events that you can generate are not limited to Amiga
key-presses. Suppose you want to emulate a joystick in port 2 with key
presses:
# This enables WASD + Left alt joystick emulation
input.1.keyboard.0.button.25=JOY2_UP
input.1.keyboard.0.button.38=JOY2_LEFT
input.1.keyboard.0.button.39=JOY2_DOWN
input.1.keyboard.0.button.40=JOY2_RIGHT
input.1.keyboard.0.button.64=JOY2_FIRE_BUTTON
The equivalent for OS X would be:
input.1.keyboard.0.button.13=JOY2_UP
input.1.keyboard.0.button.0=JOY2_LEFT
input.1.keyboard.0.button.1=JOY2_DOWN
input.1.keyboard.0.button.2=JOY2_RIGHT
input.1.keyboard.0.button.58=JOY2_FIRE_BUTTON
If you select an inputdevice configuration other than config 0, then the
existing default joystick emulation key layouts no longer apply.
You have to add your own key-map option to emulate joystick input with the
keyboard like the example I provided.
If you select an input config other config 0, then you have complete control
over which input event is generated by which key. If you don't change
anything, however, then the default mapping applies. Press 'a', you get an
a', etc. As I said, the default joystick emulation options no longer work. You
can select joyport1=kbd3, for example, but it will have no effect. The 't'
kill will produce a 't' input event, unless you manually assign another event
to the key.
Obviously if you you re-map a key, say 'W' to produce a joystick up event,
then it cannot also produce a key 'w' event. Each key can be assigned only
one event.
The reason for this system is to support two configuration modes. A legacy
mode (input.confg=0) where you get the default key mapping, mapping of mouse
and joystick events and the traditional keyboard joystick emulations; and a
new mode, where you can configure everything yourself. In the new mode, you
can configure 4 seperate mappings (input.config=<n>, where 1 <= n <= 4) which
you can switch between easily.

View File

@ -1,9 +1,9 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes"?> <?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<app version="5"> <app version="1">
<name>UAE</name> <name>UAE</name>
<coder>Simon Kagstrom</coder> <coder>Simon Kagstrom</coder>
<version>5</version> <version>6</version>
<release_date>20100320</release_date> <release_date>20111023</release_date>
<short_description>Amiga emulator</short_description> <short_description>Amiga emulator</short_description>
<long_description>UAE is an Amiga emulator written by Bernd Schmidt et al, see http://amigaemulator.org. The port to Wii was done by Simon Kagstrom, with help from Christopher Follett and "Knitax"</long_description> <long_description>UAE is an Amiga emulator written by Bernd Schmidt et al, see http://amigaemulator.org. The port to Wii was done by Simon Kagstrom, with help from Christopher Follett, "Knitax" and Fabio Olimpieri</long_description>
</app> </app>

View File

@ -557,7 +557,8 @@ void save_options (FILE *f, const struct uae_prefs *p, int type)
#endif #endif
#if defined GEKKO #if defined GEKKO
cfgfile_write (f, "wii_use_mario_kart_wheel=%s\n", p->use_wheel_input ? "yes" : "no"); //cfgfile_write (f, "wii_use_mario_kart_wheel=%s\n", p->use_wheel_input ? "yes" : "no");
cfgfile_write (f, "wii_port=%d\n", p->Port);
#endif #endif
#ifdef FILESYS #ifdef FILESYS
@ -639,7 +640,7 @@ int cfgfile_string (const char *option, const char *value, const char *name, cha
* TODO: Collect path handling tools in one place and cleanly * TODO: Collect path handling tools in one place and cleanly
* handle platform-specific differences. * handle platform-specific differences.
*/ */
static const char *strdup_path_expand (const char *src) const char *strdup_path_expand (const char *src)
{ {
char *path = 0; char *path = 0;
unsigned int srclen, destlen; unsigned int srclen, destlen;
@ -851,10 +852,17 @@ static int cfgfile_parse_host (struct uae_prefs *p, char *option, char *value)
#endif #endif
#if defined GEKKO #if defined GEKKO
if (cfgfile_yesno (option, value, "wii_use_mario_kart_wheel", &p->use_wheel_input)) //if (cfgfile_yesno (option, value, "wii_use_mario_kart_wheel", &p->use_wheel_input))
return 1; //return 1;
if (cfgfile_intval (option, value, "wii_port", &p->Port, 1)) return 1;
if (cfgfile_string (option, value, "user", &p->SmbUser, 32)
|| cfgfile_string (option, value, "password", &p->SmbPwd,32)
|| cfgfile_string (option, value, "share_name", &p->SmbShare, 32)
|| cfgfile_string (option, value, "smb_ip", &p->SmbIp, 32)) return 1;
#endif #endif
if (cfgfile_yesno (option, value, "logfile", &p->logfile))
return 1;
#ifdef DRIVESOUND #ifdef DRIVESOUND
if (cfgfile_intval (option, value, "floppy0sound", &p->dfxclick[0], 1) if (cfgfile_intval (option, value, "floppy0sound", &p->dfxclick[0], 1)
|| cfgfile_intval (option, value, "floppy1sound", &p->dfxclick[1], 1) || cfgfile_intval (option, value, "floppy1sound", &p->dfxclick[1], 1)
@ -1506,7 +1514,7 @@ static char *cfg_fgets (char *line, int max, FILE *fh)
return 0; return 0;
} }
static int cfgfile_load_2 (struct uae_prefs *p, const char *filename, int real, int *type) int cfgfile_load_2 (struct uae_prefs *p, const char *filename, int real, int *type)
{ {
int i; int i;
FILE *fh; FILE *fh;
@ -1521,7 +1529,9 @@ static int cfgfile_load_2 (struct uae_prefs *p, const char *filename, int real,
if (real) { if (real) {
p->config_version = 0; p->config_version = 0;
config_newfilesystem = 0; config_newfilesystem = 0;
#ifndef GEKKO
reset_inputdevice_config (p); reset_inputdevice_config (p);
#endif
} }
write_log ("Opening cfgfile '%s'...", filename); write_log ("Opening cfgfile '%s'...", filename);
@ -2469,9 +2479,15 @@ void default_prefs (struct uae_prefs *p, int type)
p->mountinfo = &options_mountinfo; p->mountinfo = &options_mountinfo;
#endif #endif
p->use_wheel_input = 0;
#ifdef GEKKO #ifdef GEKKO
p->use_wheel_input = 0; strcpy (p->SmbUser,"User");
strcpy (p->SmbPwd, "Password");
strcpy (p->SmbShare, "Share");
strcpy (p->SmbIp, "192.168.0.1");
p->Port= PORT_SD;
#endif #endif
p->logfile= 0;
#ifdef UAE_MINI #ifdef UAE_MINI
default_prefs_mini (p, 0); default_prefs_mini (p, 0);

View File

@ -53,9 +53,11 @@ typedef struct virtkey
{ name, "None", true } { name, "None", true }
#define KNL() \ #define KNL() \
{ NULL, NULL, false } { NULL, NULL, false }
#define NJ(name, joy_name) \
{ name, joy_name, false }
#define KEY_COLS 14 #define KEY_COLS 14
#define KEY_ROWS 7 #define KEY_ROWS 8
static virtkey_t keys[KEY_COLS * KEY_ROWS] = { static virtkey_t keys[KEY_COLS * KEY_ROWS] = {
N("Esc", "ESC"), KNL(), K("F1"),K("F2"),K("F3"),K("F4"),K("F5"),K("F6"),K("F7"),K("F8"),K("F9"),K("F10"), N("Del","DEL"),N("Help", "HELP"), N("Esc", "ESC"), KNL(), K("F1"),K("F2"),K("F3"),K("F4"),K("F5"),K("F6"),K("F7"),K("F8"),K("F9"),K("F10"), N("Del","DEL"),N("Help", "HELP"),
@ -64,7 +66,8 @@ static virtkey_t keys[KEY_COLS * KEY_ROWS] = {
N("Sft","SHIFT_LEFT"),KNL(), K("A"), K("S"), K("D"), K("F"), K("G"), K("H"), K("J"), K("K"), K("L"), N(":;", "SEMICOLON"), N("@#", "??"), N("Sft", "SHIFT_RIGHT"), N("Sft","SHIFT_LEFT"),KNL(), K("A"), K("S"), K("D"), K("F"), K("G"), K("H"), K("J"), K("K"), K("L"), N(":;", "SEMICOLON"), N("@#", "??"), N("Sft", "SHIFT_RIGHT"),
N("Ctrl","CTRL"),KNL(),K("Z"),K("X"), K("C"), K("V"), K("B"), K("N"), K("M"),N("<,", "COMMA"),N(">.", "PERIOD"), N("\\","KEY_BACKSLASH"), N("/", "SLASH"),N("Ret", "RETURN"), N("Ctrl","CTRL"),KNL(),K("Z"),K("X"), K("C"), K("V"), K("B"), K("N"), K("M"),N("<,", "COMMA"),N(">.", "PERIOD"), N("\\","KEY_BACKSLASH"), N("/", "SLASH"),N("Ret", "RETURN"),
N("Alt","ALT_LEFT"),KNL(), N("Amg","AMIGA_LEFT"),KNL(),N("space", "SPACE"),KNL(),KNL(),KNL(), N("Up", "CURSOR_UP"),KNL(),KNL(),N("Amg","AMIGA_RIGHT"),KNL(),N("Alt","ALT_RIGHT"), N("Alt","ALT_LEFT"),KNL(), N("Amg","AMIGA_LEFT"),KNL(),N("space", "SPACE"),KNL(),KNL(),KNL(), N("Up", "CURSOR_UP"),KNL(),KNL(),N("Amg","AMIGA_RIGHT"),KNL(),N("Alt","ALT_RIGHT"),
D("None"), KNL(), KNL(), KNL(), KNL(), KNL(), N("Lft", "CURSOR_LEFT"),KNL(), N("Dwn", "CURSOR_DOWN"), KNL(), N("Rgt", "CURSOR_RIGHT"),KNL(), N("Enter", "ENTER"), D("None"), KNL(), KNL(), KNL(), KNL(), KNL(), N("Lft", "CURSOR_LEFT"),KNL(), N("Dwn", "CURSOR_DOWN"), KNL(), N("Rgt", "CURSOR_RIGHT"),KNL(), N("Enter", "ENTER"),KNL(),
NJ("Fire","JOY_FIRE_BUTTON"),KNL(),KNL(),NJ("Joy 2nd button","JOY_2ND_BUTTON"),KNL(),KNL(),KNL(),KNL(),KNL(),NJ("Joy 3rd button","JOY_3RD_BUTTON"),KNL(),KNL(),KNL(),KNL()
}; };
VirtualKeyboard::VirtualKeyboard(SDL_Surface *screen, TTF_Font *font) VirtualKeyboard::VirtualKeyboard(SDL_Surface *screen, TTF_Font *font)
@ -89,7 +92,7 @@ void VirtualKeyboard::draw()
key_w * KEY_COLS, key_h * KEY_ROWS}; key_w * KEY_COLS, key_h * KEY_ROWS};
SDL_FillRect(this->screen, &bg_rect, SDL_FillRect(this->screen, &bg_rect,
SDL_MapRGB(screen->format, 0x00, 0x80, 0x80)); SDL_MapRGB(screen->format, 0xff, 0xff, 0xff));
for (int y = 0; y < KEY_ROWS; y++ ) for (int y = 0; y < KEY_ROWS; y++ )
{ {
@ -97,7 +100,7 @@ void VirtualKeyboard::draw()
{ {
int which = y * KEY_COLS + x; int which = y * KEY_COLS + x;
virtkey_t key = keys[which]; virtkey_t key = keys[which];
int r = 255, g = 255, b = 255; int r = 64, g = 64, b = 64;
const char *what = key.name; const char *what = key.name;
/* Skip empty positions */ /* Skip empty positions */
@ -105,9 +108,9 @@ void VirtualKeyboard::draw()
continue; continue;
if ( key.is_done ) if ( key.is_done )
r = 0; r = 255;
if ( (x == this->sel_x && y == this->sel_y)) if ( (x == this->sel_x && y == this->sel_y))
b = 0; g = 200;
menu_print_font(this->screen, r, g, b, menu_print_font(this->screen, r, g, b,
x * key_w + border_x, y * key_h + border_y, x * key_w + border_x, y * key_h + border_y,
@ -176,9 +179,10 @@ struct virtkey *VirtualKeyboard::get_key_internal()
const char* VirtualKeyboard::get_key() const char* VirtualKeyboard::get_key()
{ {
virtkey_t *key; virtkey_t *key;
SDL_Rect rect = {32, 32, FULL_DISPLAY_X-64, FULL_DISPLAY_Y-96};
SDL_FillRect(this->screen, 0, SDL_MapRGB(screen->format, 0x00, 0x80, 0x80)); SDL_FillRect(this->screen, &rect, SDL_MapRGB(screen->format, 0xff, 0xff, 0xff));
key = this->get_key_internal(); key = this->get_key_internal();
if (key == NULL) if (key == NULL)
return NULL; return NULL;

View File

@ -19,6 +19,14 @@
#include "uae.h" #include "uae.h"
#include "menu.h" #include "menu.h"
#include "VirtualKeyboard.h" #include "VirtualKeyboard.h"
#include "sounddep/sound.h"
#define ID_BUTTON_OFFSET 0
#define ID_AXIS_OFFSET 32
extern int usbismount, smbismount;
extern const char *strdup_path_expand (const char *src);
static void default_config(void); static void default_config(void);
@ -28,37 +36,49 @@ static const char *main_menu_messages[] = {
/*02*/ "States", /*02*/ "States",
/*03*/ "^|Load|Save|Delete", /*03*/ "^|Load|Save|Delete",
/*04*/ "#1-------------------------------------", /*04*/ "#1-------------------------------------",
/*05*/ "Reset UAE", /*05*/ "Wiimote configuration",
/*06*/ "Amiga options", /*06*/ "^|Wiimote1|Wiimote2",
/*07*/ "Input options", /*07*/ "Hardware options",
/*08*/ "Other options", /*08*/ "Other options",
/*09*/ "Help", /*09*/ "Save confs",
/*10*/ "Quit", /*10*/ "Reset UAE",
/*04*/ "#1-------------------------------------", /*11*/ "Help",
/*04*/ "#21 - back, 2/A - select", /*12*/ "Quit",
/*13*/ "#1-------------------------------------",
/*14*/ "#21 - back, 2/A - select",
NULL NULL
}; };
static const char *input_messages[] = { static const char *input_messages[] = {
/*00*/ "Bind key to Wiimote", /*00*/ "Bind key to Wiimote",
/*01*/ "^|1|-|+", /*01*/ "^|1|2|-|+",
/*02*/ "Bind key to Nunchuk", /*02*/ " ",
/*03*/ "^|C", /*03*/ "Bind key to Nunchuk",
/*04*/ "Bind key to Classic", /*04*/ "^|Z|C",
/*05*/ "^|b|x|y|L|R|Zl|Zr|-|+", /*05*/ " ",
/*06*/ "Mario kart wheel (horizontal only)", /*06*/ "Bind key to Classic",
/*07*/ "^|On|Off", /*07*/ "^|a|b|x|y|L|R|Zl|Zr|-|+",
/*08*/ " ",
/*09*/ "Mario kart wheel (horizontal only)",
/*10*/ "^|On|Off",
/*11*/ " ",
/*12*/ "Mouse emulation",
/*13*/ "^|On|Off",
NULL, NULL,
}; };
static const char *amiga_model_messages[] = { static const char *amiga_model_messages[] = {
/*00*/ "Amiga model", /*00*/ "Amiga model",
/*01*/ "^|A1000|A500|A600|A1200|Custom", /*01*/ "^|A1000|A500|A600|A1200|Custom",
/*02*/ "Emulation accuracy", /*02*/ " ",
/*03*/ "^|Fast|Compatible|Cycle-exact", /*03*/ "Emulation accuracy",
/*04*/ "Memory options", /*04*/ "^|Fast|Compatible|Cycle-exact",
/*05*/ "CPU/Chipset options", /*05*/ " ",
/*06*/ "Change ROM", /*06*/ "Memory options",
/*07*/ " ",
/*08*/ "CPU/Chipset options",
/*09*/ " ",
/*10*/ "Change ROM",
NULL NULL
}; };
@ -69,8 +89,8 @@ static const char *memory_messages[] = {
/*03*/ "^|None|256K|512K|1M|1.8M", /*03*/ "^|None|256K|512K|1M|1.8M",
/*04*/ "Fast mem", /*04*/ "Fast mem",
/*05*/ "^|None|1M|2M|4M|8M", /*05*/ "^|None|1M|2M|4M|8M",
/*04*/ "Zorro3 mem", /*06*/ "Zorro3 mem",
/*05*/ "^|None|1M|2M|4M|8M|16M|32M", /*07*/ "^|None|1M|2M|4M|8M|16M|32M",
NULL NULL
}; };
@ -82,6 +102,7 @@ static const int z3fastmem_size_table[] = { 0, 1024 * 1024, 2048 * 1024, 4096 *
static const char *cpu_chipset_messages[] = { static const char *cpu_chipset_messages[] = {
/*00*/ "CPU type", /*00*/ "CPU type",
/*01*/ "^|68000|68010|68020|68030|68040|68060", /*01*/ "^|68000|68010|68020|68030|68040|68060",
/*02*/ " ",
/*03*/ "Chipset type", /*03*/ "Chipset type",
/*04*/ "^|OCS|ECS AGNUS|ECS|AGA", /*04*/ "^|OCS|ECS AGNUS|ECS|AGA",
NULL NULL
@ -95,29 +116,32 @@ static const int chipset_mask_table[] = {0, CSMASK_ECS_AGNUS,
static const char *options_messages[] = { static const char *options_messages[] = {
/*00*/ "CPU to chipset speed", /*00*/ "CPU to chipset speed",
/*01*/ "^|max|0%|34%|51%|68%|84%|100% Chipset", /*01*/ "^|max|90%|80%|60%|40%|20%|0%",
/*02*/ "Frameskip", /*02*/ "Framerate",
/*03*/ "^|none|2|3|4|8|custom", /*03*/ "^|100%|50%|33%|25%|12%|custom",
/*04*/ "Floppy speed", /*04*/ "Floppy speed",
/*05*/ "^|normal|turbo|400%|800%", /*05*/ "^|normal|turbo|400%|800%",
/*06*/ "Correct aspect", /*06*/ "Correct aspect",
/*07*/ "^|true|false", /*07*/ "^|true|false",
/*08*/ "Leds", /*08*/ "Leds",
/*09*/ "^|on|off", /*09*/ "^|on|off",
/*10*/ "Port",
/*11*/ "^|SD|USB|SMB",
NULL NULL
}; };
static const int cpu_to_chipset_table[] = {-1,512,2560,5120,7168,8704,10240}; static const int cpu_to_chipset_table[] = {-1,512*2,512*4, 512*8, 512*12, 512*16, 512*20};
static const int floppy_table[] = {100, 0, 400, 800}; static const int floppy_table[] = {100, 0, 400, 800};
static const int framerate_table[] = {1, 2, 3, 4, 8}; static const int framerate_table[] = {1, 2, 3, 4, 8};
static const char *help_messages[] = { static const char *help_messages[] = {
/*00*/ "#2HOME enters the menu system, where arrow", /*00*/ "#2HOME enters the menu system, where arrow keys",
/*01*/ "#2keys and +/- are used to navigate up and down.", /*01*/ "#2and nunchuck are used to navigate up and down.",
/*02*/ "#2You can bind keyboard keys to the wiimote", /*02*/ "#2You can bind keyboard keys to the wiimote",
/*03*/ "#2buttons in the 'keyboard bindings' menu and", /*03*/ "#2buttons in the 'keyboard bindings' menu and",
/*04*/ "#2change emulation options in the Amiga menu.", /*04*/ "#2change emulation options in the hardware menu.",
/*05*/ "#2 ", /*05*/ "#2 ",
/*06*/ "#2Kickstart roms should be named kick.rom,", /*06*/ "#2Kickstart roms should be named kick.rom,",
/*07*/ "#2kick10.rom, kick12.rom, kick13.rom, kick20.rom,", /*07*/ "#2kick10.rom, kick12.rom, kick13.rom, kick20.rom,",
@ -247,7 +271,8 @@ static int prefs_has_changed;
static void insert_floppy(int which) static void insert_floppy(int which)
{ {
const char *name = menu_select_file(prefs_get_attr("floppy_path")); const char *selected_file=changed_prefs.df[which];
const char *name = menu_select_file(prefs_get_attr("floppy_path"), selected_file, which);
if (name != NULL) if (name != NULL)
{ {
@ -257,13 +282,11 @@ static void insert_floppy(int which)
strcpy (changed_prefs.df[which], name); strcpy (changed_prefs.df[which], name);
free((void*)name); free((void*)name);
} }
else
changed_prefs.df[which][0] = '\0';
} }
static void insert_rom(void) static void insert_rom(void)
{ {
const char *name = menu_select_file(prefs_get_attr("rom_path")); const char *name = menu_select_file(prefs_get_attr("rom_path"),NULL, -1);
/* None or NULL means no change */ /* None or NULL means no change */
if (name != NULL) if (name != NULL)
@ -362,16 +385,69 @@ static int get_gfx_framerate(void)
} }
static void set_Port(int which)
{
switch (which)
{
case PORT_SD:
prefs_set_attr ("floppy_path", strdup_path_expand (TARGET_FLOPPY_PATH));
changed_prefs.Port = which;
currprefs.Port = changed_prefs.Port;
break;
case PORT_USB:
if (usbismount) {
prefs_set_attr ("floppy_path", strdup_path_expand (TARGET_USB_PATH));
changed_prefs.Port = which;
currprefs.Port = changed_prefs.Port;}
else
msgInfo("USB is not mounted",3000,NULL);
break;
case PORT_SMB:
if (smbismount) {
prefs_set_attr ("floppy_path", strdup_path_expand (TARGET_SMB_PATH));
changed_prefs.Port = which;
currprefs.Port = changed_prefs.Port;}
else
msgInfo("SMB is not mounted",3000,NULL);
break;
default:
break;
}
}
static void save_configurations(void)
{
char user_options[255] = "";
int i;
#ifdef OPTIONS_IN_HOME
char *home = getenv ("HOME");
if (home != NULL && strlen (home) < 240)
{
strcpy (user_options, home);
strcat (user_options, "/");
}
#endif
strcat(user_options, OPTIONSFILENAME);
strcat(user_options, ".saved");
cfgfile_save(&changed_prefs, user_options, 0);
msgInfo("Configurations saved",3000,NULL);
}
static void general_options(void) static void general_options(void)
{ {
int submenus[5]; int submenus[6];
int opt; int opt;
submenus[0] = get_cpu_to_chipset_speed(); submenus[0] = get_cpu_to_chipset_speed();
submenus[1] = get_gfx_framerate(); submenus[1] = get_gfx_framerate();
submenus[2] = get_floppy_speed(); submenus[2] = get_floppy_speed();
submenus[3] = changed_prefs.gfx_correct_aspect == 0 ? 1 : 0; submenus[3] = changed_prefs.gfx_correct_aspect == 0 ? 1 : 0;
submenus[4] = currprefs.leds_on_screen == 0 ? 1 : 0; submenus[4] = changed_prefs.leds_on_screen == 0 ? 1 : 0;
submenus[5] = changed_prefs.Port;
opt = menu_select_title("General options menu", opt = menu_select_title("General options menu",
options_messages, submenus); options_messages, submenus);
@ -380,9 +456,10 @@ static void general_options(void)
set_cpu_to_chipset_speed(submenus[0]); set_cpu_to_chipset_speed(submenus[0]);
set_gfx_framerate(submenus[1]); set_gfx_framerate(submenus[1]);
set_floppy_speed(submenus[2]); set_floppy_speed(submenus[2]);
set_Port(submenus[5]);
changed_prefs.gfx_correct_aspect = !submenus[3]; changed_prefs.gfx_correct_aspect = !submenus[3];
currprefs.gfx_correct_aspect = changed_prefs.gfx_correct_aspect;
/* Floppy, Power, FPS, etc etc. */ /* Floppy, Power, FPS, etc etc. */
changed_prefs.leds_on_screen = !submenus[4]; changed_prefs.leds_on_screen = !submenus[4];
currprefs.leds_on_screen = changed_prefs.leds_on_screen; currprefs.leds_on_screen = changed_prefs.leds_on_screen;
@ -390,6 +467,7 @@ static void general_options(void)
prefs_has_changed = 1; prefs_has_changed = 1;
} }
/* There are a few unfortunate header problems, so I'll do like this for now */ /* There are a few unfortunate header problems, so I'll do like this for now */
struct uae_prefs; struct uae_prefs;
void read_inputdevice_config (struct uae_prefs *pr, const char *option, const char *value); void read_inputdevice_config (struct uae_prefs *pr, const char *option, const char *value);
@ -407,111 +485,98 @@ static void insert_keyboard_map(const char *key, const char *fmt, ...)
fprintf(stderr, "Too long string passed\n"); fprintf(stderr, "Too long string passed\n");
va_end(ap); va_end(ap);
printf("Mibb: %s:%s\n", buf, key); //printf("Mibb: %s:%s\n", buf, key);
read_inputdevice_config (&changed_prefs, buf, key); read_inputdevice_config (&changed_prefs, buf, key);
read_inputdevice_config (&currprefs, buf, key); read_inputdevice_config (&currprefs, buf, key);
} }
static void setup_joystick_defaults(int joy)
{
int fire_buttons[] = {3,7,9};
int i;
/* For some reason, the user uaerc removes these. The following
* lines should be removed when this is properly figured out */
for (i = 0; i < 6; i++)
{
const char *what = "JOY2_HORIZ"; /* Assume port 1 */
/* Odd - vertical */
if (i % 2 != 0)
{
if (joy == 1)
what = "JOY1_VERT";
else
what = "JOY2_VERT";
}
else if (joy == 1) /* Even - horizontal (and port 2) */
what = "JOY1_HORIZ";
insert_keyboard_map(what,
"input.1.joystick.%d.axis.%d", joy, i);
}
if (currprefs.use_wheel_input)
insert_keyboard_map(joy == 1 ? "JOY1_HORIZ" : "JOY2_HORIZ",
"input.1.joystick.%d.axis.6", joy);
else /* Just select something which will not affect play! */
insert_keyboard_map("PAR_JOY2_VERT",
"input.1.joystick.%d.axis.6", joy);
insert_keyboard_map(joy == 1 ? "JOY1_HORIZ" : "JOY2_HORIZ",
"input.1.joystick.%d.axis.9", joy);
insert_keyboard_map(joy == 1 ? "JOY1_VERT" : "JOY2_VERT",
"input.1.joystick.%d.axis.10", joy);
insert_keyboard_map("SPC_ENTERGUI", "input.1.joystick.%d.button.6", joy);
insert_keyboard_map("SPC_ENTERGUI", "input.1.joystick.%d.button.19", joy);
for (i = 0; i < SDL_arraysize(fire_buttons); i++)
{
const char *btn = joy == 0 ? "JOY2_FIRE_BUTTON" : "JOY1_FIRE_BUTTON";
insert_keyboard_map(btn, "input.1.joystick.%d.button.%d",
joy, fire_buttons[i]);
}
}
static void setup_joystick(int joy, const char *key, int sdl_key) static void setup_joystick(int joy, const char *key, int sdl_key)
{ {
if (!strcmp(key, "None"))
{
currprefs.joystick_settings[1][joy].eventid[ID_BUTTON_OFFSET + sdl_key][0] = 0;
changed_prefs.joystick_settings[1][joy].eventid[ID_BUTTON_OFFSET + sdl_key][0] = 0;
}
else
insert_keyboard_map(key, "input.1.joystick.%d.button.%d", joy, sdl_key); insert_keyboard_map(key, "input.1.joystick.%d.button.%d", joy, sdl_key);
} }
static void input_options(void) static void input_options(int joy)
{ {
const int wiimote_to_sdl[] = {2, 4, 5}; const int wiimote_to_sdl[] = {2, 3, 4, 5};
const int nunchuk_to_sdl[] = {8}; const int nunchuk_to_sdl[] = {7, 8};
const int classic_to_sdl[] = {10, 11, 12, 13, 14, 15, 16, 17, 18}; const int classic_to_sdl[] = {9, 10, 11, 12, 13, 14, 15, 16, 17, 18};
int sdl_key = 1; int sdl_key = 1;
const char *key; const char *key;
int submenus[4]; int submenus[5];
int opt; int opt;
int i; int i;
memset(submenus, 0, sizeof(submenus)); memset(submenus, 0, sizeof(submenus));
submenus[3] = !changed_prefs.use_wheel_input; submenus[3] = changed_prefs.joystick_settings[1][joy].eventid[ID_AXIS_OFFSET + 6][0]== 0 ? 1 : 0;
submenus[4] = changed_prefs.mouse_settings[1][joy].enabled == 0 ? 1 : 0;
opt = menu_select_title("Keyboard menu", opt = menu_select_title("Input menu",
input_messages, submenus); input_messages, submenus);
if (opt < 0) if (opt < 0)
return; return;
/* Translate key to UAE key event name */ /* Translate key to UAE key event name */
if (opt == 6)
{ if (opt == 9)
changed_prefs.use_wheel_input = !submenus[3]; {
currprefs.use_wheel_input = changed_prefs.use_wheel_input; if (!submenus[3]){
if (!joy) insert_keyboard_map("JOY2_HORIZ","input.1.joystick.%d.axis.6", 0);
else insert_keyboard_map("JOY1_HORIZ" ,"input.1.joystick.%d.axis.6", 1);}
else{
currprefs.joystick_settings[1][joy].eventid[ID_AXIS_OFFSET + 6][0] = 0;
changed_prefs.joystick_settings[1][joy].eventid[ID_AXIS_OFFSET + 6][0] = 0;
}
prefs_has_changed = 1; prefs_has_changed = 1;
return; return;
} }
if (opt == 12)
{
if (submenus[4])
{
changed_prefs.mouse_settings[1][joy].enabled = 0;
currprefs.mouse_settings[1][joy].enabled = 0;
}
else
{
changed_prefs.mouse_settings[1][joy].enabled = 1;
currprefs.mouse_settings[1][joy].enabled = 1;
}
prefs_has_changed = 1;
return;
}
key = virtkbd_get_key(); key = virtkbd_get_key();
if (key == NULL) if (key == NULL)
return; return;
switch(opt) switch(opt)
{ {
case 0: /* wiimote */ case 0: /* wiimote */
sdl_key = wiimote_to_sdl[submenus[0]]; break; sdl_key = wiimote_to_sdl[submenus[0]]; break;
case 2: /* nunchuk */ case 3: /* nunchuk */
sdl_key = nunchuk_to_sdl[submenus[1]]; break; sdl_key = nunchuk_to_sdl[submenus[1]]; break;
case 4: /* classic */ case 6: /* classic */
sdl_key = classic_to_sdl[submenus[2]]; break; sdl_key = classic_to_sdl[submenus[2]]; break;
default: /* can never happen */ default: /* can never happen */
break; break;
} }
changed_prefs.use_wheel_input = !submenus[3]; if (!strcmp(key,"JOY_FIRE_BUTTON"))
currprefs.use_wheel_input = changed_prefs.use_wheel_input; key= joy ? "JOY1_FIRE_BUTTON": "JOY2_FIRE_BUTTON";
for (i = 0; i < 2; i++) if (!strcmp(key,"JOY_2ND_BUTTON"))
setup_joystick(i, key, sdl_key); key= joy ? "JOY1_2ND_BUTTON": "JOY2_2ND_BUTTON";
if (!strcmp(key,"JOY_3RD_BUTTON"))
key= joy ? "JOY1_3RD_BUTTON": "JOY2_3RD_BUTTON";
setup_joystick(joy, key, sdl_key);
prefs_has_changed = 1; prefs_has_changed = 1;
} }
@ -579,7 +644,7 @@ static void amiga_model_options(void)
submenus[0] = cur_model; submenus[0] = cur_model;
submenus[1] = get_emulation_accuracy(); submenus[1] = get_emulation_accuracy();
opt = menu_select_title("Amiga model menu", opt = menu_select_title("Hardware option menu",
amiga_model_messages, submenus); amiga_model_messages, submenus);
if (opt < 0) if (opt < 0)
return; return;
@ -598,16 +663,16 @@ static void amiga_model_options(void)
switch(opt) switch(opt)
{ {
case 4:
memory_options(); break;
case 5:
cpu_chipset_options(); break;
case 6: case 6:
memory_options(); break;
case 8:
cpu_chipset_options(); break;
case 10:
insert_rom(); break; insert_rom(); break;
default: default:
break; break;
} }
} while (opt == 4 || opt == 5 || opt == 6); } while (opt == 6 || opt == 8 || opt == 10);
/* Reset the Amiga if the model has changed */ /* Reset the Amiga if the model has changed */
if (cur_model != submenus[0]) if (cur_model != submenus[0])
@ -636,24 +701,28 @@ static void save_load_state(int which)
case 2: case 2:
case 0: /* Load state */ case 0: /* Load state */
{ {
const char *name = menu_select_file(dir); const char *name = menu_select_file(dir, NULL,-1);
if (!name) if (!name)
return; return;
if (which == 0) if (ext_matches(name, ".uss")|ext_matches(name, ".USS"))
{ {
strcpy(savestate_fname, name); if (which == 0)
savestate_state = STATE_DORESTORE; {
} strcpy(savestate_fname, name);
else /* Delete saved state */ savestate_state = STATE_DORESTORE;
unlink(name); }
else /* Delete saved state */
unlink(name);
}
free((void*)name); free((void*)name);
} break; } break;
case 1: /* Save state */ case 1: /* Save state */
snprintf(db, 255, "%s/%s.uss", dir, fb); snprintf(db, 255, "%s/%s.uss", dir, fb);
savestate_state = STATE_DOSAVE; savestate_state = STATE_DOSAVE;
save_state(db, floppy0); save_state(db, floppy0);
msgInfo("State saved",3000,NULL);
break; break;
default: default:
break; break;
@ -682,7 +751,9 @@ void gui_notify_state (int state)
extern int log_quiet; extern int log_quiet;
int gui_update (void) int gui_update (void)
{ {
#ifndef GEKKO
log_quiet = 1; log_quiet = 1;
#endif
return 0; return 0;
} }
@ -748,7 +819,8 @@ void gui_display(int shortcut)
{ {
int submenus[3]; int submenus[3];
int opt; int opt;
pause_sound();
memset(submenus, 0, sizeof(submenus)); memset(submenus, 0, sizeof(submenus));
prefs_has_changed = 0; prefs_has_changed = 0;
@ -770,49 +842,32 @@ void gui_display(int shortcut)
save_load_state(submenus[1]); save_load_state(submenus[1]);
break; break;
case 5: case 5:
uae_reset(1); input_options(submenus[2]);
break; break;
case 6:
amiga_model_options();
break;
case 7: case 7:
input_options(); amiga_model_options();
break; break;
case 8: case 8:
general_options(); general_options();
break; break;
case 9: case 9:
help(); save_configurations();
break; break;
case 10: case 10:
uae_quit(); uae_reset(1);
break;
case 11:
help();
break;
case 12:
if (msgYesNo("Are you sure to quit?", 0, FULL_DISPLAY_X /2-138, FULL_DISPLAY_Y /2-48)) uae_quit();
break; break;
default: default:
break; break;
} }
} while (opt == 0 || opt == 6 || opt == 7 || opt == 8); } while (opt == 0 || opt == 5 || opt == 7 || opt == 8 || opt == 9 || opt == 11);
if (prefs_has_changed) resume_sound();
{
char user_options[255] = "";
int i;
#ifdef OPTIONS_IN_HOME
char *home = getenv ("HOME");
if (home != NULL && strlen (home) < 240)
{
strcpy (user_options, home);
strcat (user_options, "/");
}
#endif
strcat(user_options, OPTIONSFILENAME);
strcat(user_options, ".saved");
for (i = 0; i < 2; i++)
setup_joystick_defaults(i);
cfgfile_save(&changed_prefs, user_options, 0);
}
} }
void gui_message (const char *format,...) void gui_message (const char *format,...)

View File

@ -15,13 +15,12 @@
#include <sys/stat.h> #include <sys/stat.h>
#include <dirent.h> #include <dirent.h>
#include <unistd.h> #include <unistd.h>
#include <string.h>
#include "sysconfig.h" #include "sysconfig.h"
#include "menu.h" #include "menu.h"
#include "VirtualKeyboard.h" #include "VirtualKeyboard.h"
#define FULL_DISPLAY_X 640
#define FULL_DISPLAY_Y 480
typedef struct typedef struct
{ {
@ -103,7 +102,7 @@ int msgInfo(char *text, int duration, SDL_Rect *irc)
} }
SDL_FillRect(real_screen, &src, SDL_MapRGB(real_screen->format, 0, 96, 0)); SDL_FillRect(real_screen, &src, SDL_MapRGB(real_screen->format, 0, 96, 0));
SDL_FillRect(real_screen, &rc, SDL_MapRGB(real_screen->format, 128, 128, 128)); SDL_FillRect(real_screen, &rc, SDL_MapRGB(real_screen->format, 128, 128, 128));
menu_print_font(real_screen, 0,0,0, X+12, Y+12, text); menu_print_font(real_screen, 255,255,255, X+12, Y+12, text);
SDL_UpdateRect(real_screen, src.x, src.y, src.w, src.h); SDL_UpdateRect(real_screen, src.x, src.y, src.w, src.h);
SDL_UpdateRect(real_screen, rc.x, rc.y, rc.w,rc.h); SDL_UpdateRect(real_screen, rc.x, rc.y, rc.w,rc.h);
if (duration > 0) if (duration > 0)
@ -160,7 +159,7 @@ int msgYesNo(char *text, int default_opt, int x, int y)
{ {
SDL_FillRect(real_screen, &src, SDL_MapRGB(real_screen->format, 0, 96, 0)); SDL_FillRect(real_screen, &src, SDL_MapRGB(real_screen->format, 0, 96, 0));
SDL_FillRect(real_screen, &rc, SDL_MapRGB(real_screen->format, 128, 128, 128)); SDL_FillRect(real_screen, &rc, SDL_MapRGB(real_screen->format, 128, 128, 128));
menu_print_font(real_screen, 0,0,0, X+12, Y+12, text); menu_print_font(real_screen, 255,255,255, X+12, Y+12, text);
if (default_opt) if (default_opt)
{ {
@ -178,14 +177,15 @@ int msgYesNo(char *text, int default_opt, int x, int y)
brc.h=20; brc.h=20;
SDL_FillRect(real_screen, &brc, SDL_MapRGB(real_screen->format, 0x80, 0x00, 0x00)); SDL_FillRect(real_screen, &brc, SDL_MapRGB(real_screen->format, 0x80, 0x00, 0x00));
} }
menu_print_font(real_screen, 0,0,0, rc.x + rc.w/2-5*12, Y+42, "YES");
menu_print_font(real_screen, 0,0,0, rc.x + rc.w/2-5*12+8*12, Y+42, "NO"); menu_print_font(real_screen, 255,255,255, rc.x + rc.w/2-5*12, Y+42, "YES");
menu_print_font(real_screen, 255,255,255, rc.x + rc.w/2-5*12+8*12, Y+42, "NO");
SDL_UpdateRect(real_screen, src.x, src.y, src.w, src.h); SDL_UpdateRect(real_screen, src.x, src.y, src.w, src.h);
SDL_UpdateRect(real_screen, rc.x, rc.y, rc.w,rc.h); SDL_UpdateRect(real_screen, rc.x, rc.y, rc.w,rc.h);
SDL_UpdateRect(real_screen, brc.x, brc.y, brc.w,brc.h); SDL_UpdateRect(real_screen, brc.x, brc.y, brc.w,brc.h);
SDL_Flip(real_screen); //SDL_Flip(real_screen);
key = menu_wait_key_press(); key = menu_wait_key_press();
if (key & KEY_SELECT) if (key & KEY_SELECT)
{ {
@ -222,7 +222,7 @@ static int cmpstringp(const void *p1, const void *p2)
} }
/* Return true if name ends with ext (for filenames) */ /* Return true if name ends with ext (for filenames) */
static int ext_matches(const char *name, const char *ext) int ext_matches(const char *name, const char *ext)
{ {
int len = strlen(name); int len = strlen(name);
int ext_len = strlen(ext); int ext_len = strlen(ext);
@ -272,7 +272,7 @@ static const char **get_file_list(const char *base_dir)
snprintf(buf, 255, "%s/%s", base_dir, de->d_name); snprintf(buf, 255, "%s/%s", base_dir, de->d_name);
if (stat(buf, &st) < 0) if (stat(buf, &st) < 0)
continue; continue;
if (S_ISDIR(st.st_mode)) if (S_ISDIR(st.st_mode)&&strcmp(".", de->d_name))
{ {
char *p; char *p;
size_t len = strlen(de->d_name) + 4; size_t len = strlen(de->d_name) + 4;
@ -443,7 +443,7 @@ static void menu_draw(SDL_Surface *screen, menu_t *p_menu, int sel)
if (sel < 0) if (sel < 0)
SDL_FillRect(screen, &r, SDL_MapRGB(screen->format, 0x40, 0x00, 0x00)); SDL_FillRect(screen, &r, SDL_MapRGB(screen->format, 0x40, 0x00, 0x00));
else else
SDL_FillRect(screen, &r, SDL_MapRGB(screen->format, 0x00, 0x00, 0xff)); SDL_FillRect(screen, &r, SDL_MapRGB(screen->format, 0x00, 0xe7, 0xe7));
menu_print_font(screen, 0,0,0, p_menu->x1, p_menu->y1, p_menu->title); menu_print_font(screen, 0,0,0, p_menu->x1, p_menu->y1, p_menu->title);
} }
@ -463,12 +463,12 @@ static void menu_draw(SDL_Surface *screen, menu_t *p_menu, int sel)
menu_print_font(screen, 0x40,0x40,0x40, menu_print_font(screen, 0x40,0x40,0x40,
x_start, y_start + y, msg); x_start, y_start + y, msg);
else if (p_menu->cur_sel == i) /* Selected - color */ else if (p_menu->cur_sel == i) /* Selected - color */
menu_print_font(screen, 0,255,0, menu_print_font(screen, 0,200,0,
x_start, y_start + y, msg); x_start, y_start + y, msg);
else if (IS_SUBMENU(msg)) else if (IS_SUBMENU(msg))
{ {
if (p_menu->cur_sel == i-1) if (p_menu->cur_sel == i-1)
menu_print_font(screen, 0x80,0xff,0x80, menu_print_font(screen, 0,200,0,
x_start, y_start + y, msg); x_start, y_start + y, msg);
else else
menu_print_font(screen, 0x40,0x40,0x40, menu_print_font(screen, 0x40,0x40,0x40,
@ -527,7 +527,7 @@ static void menu_draw(SDL_Surface *screen, menu_t *p_menu, int sel)
r = (SDL_Rect){ x_start + (n+1) * w-1, y_start + (i+ 1 - p_menu->start_entry_visible) * ((h + h/4)) -3, (n_chars - 1) * w, 2}; r = (SDL_Rect){ x_start + (n+1) * w-1, y_start + (i+ 1 - p_menu->start_entry_visible) * ((h + h/4)) -3, (n_chars - 1) * w, 2};
if (p_menu->cur_sel == i-1) if (p_menu->cur_sel == i-1)
SDL_FillRect(screen, &r, SDL_FillRect(screen, &r,
SDL_MapRGB(screen->format, 0x0,0xff,0x80)); SDL_MapRGB(screen->format, 255,0,0));
else else
SDL_FillRect(screen, &r, SDL_FillRect(screen, &r,
SDL_MapRGB(screen->format, 0x40,0x40,0x40)); SDL_MapRGB(screen->format, 0x40,0x40,0x40));
@ -701,6 +701,17 @@ uint32_t menu_wait_key_press(void)
if (v & SDL_HAT_RIGHT) if (v & SDL_HAT_RIGHT)
keys |= KEY_RIGHT; keys |= KEY_RIGHT;
} }
Sint16 axis0 = SDL_JoystickGetAxis(joy, 0);
Sint16 axis1 = SDL_JoystickGetAxis(joy, 1);
if ( axis0 < -15000 ) keys |= KEY_LEFT;
else if (axis0 > 15000 ) keys |= KEY_RIGHT;
if (axis1 < -15000 ) keys |= KEY_UP;
else if( axis1 > 15000 ) keys |= KEY_DOWN;
if (SDL_JoystickGetButton(joy, 0) != 0 || /* A */ if (SDL_JoystickGetButton(joy, 0) != 0 || /* A */
SDL_JoystickGetButton(joy, 3) != 0 || /* 2 */ SDL_JoystickGetButton(joy, 3) != 0 || /* 2 */
SDL_JoystickGetButton(joy, 9) != 0 || /* CA */ SDL_JoystickGetButton(joy, 9) != 0 || /* CA */
@ -801,7 +812,7 @@ static int menu_select_internal(SDL_Surface *screen,
uint32_t keys; uint32_t keys;
int sel_last = p_menu->cur_sel; int sel_last = p_menu->cur_sel;
SDL_FillRect(screen, &r, SDL_MapRGB(screen->format, 0x00, 0x80, 0x80)); SDL_FillRect(screen, &r, SDL_MapRGB(screen->format, 0xff, 0xff, 0xff));
menu_draw(screen, p_menu, 0); menu_draw(screen, p_menu, 0);
SDL_Flip(screen); SDL_Flip(screen);
@ -849,6 +860,7 @@ int menu_select_sized(const char *title, const char **msgs, int *submenus, int s
{ {
menu_t menu; menu_t menu;
int out; int out;
/*
int info; int info;
if (!strcmp(title, "Folder") || !strcmp(title, "Single File") || if (!strcmp(title, "Folder") || !strcmp(title, "Single File") ||
@ -856,7 +868,7 @@ int menu_select_sized(const char *title, const char **msgs, int *submenus, int s
info = 0; info = 0;
else else
info = 1; info = 1;
*/
menu_init_internal(&menu, title, menu_font, msgs, menu_init_internal(&menu, title, menu_font, msgs,
x, y, x2, y2); x, y, x2, y2);
@ -872,8 +884,9 @@ int menu_select_sized(const char *title, const char **msgs, int *submenus, int s
int menu_select_title(const char *title, const char **msgs, int *submenus) int menu_select_title(const char *title, const char **msgs, int *submenus)
{ {
SDL_FillRect(real_screen, 0, SDL_MapRGB(real_screen->format, 0, 0, 0));
return menu_select_sized(title, msgs, submenus, 0, return menu_select_sized(title, msgs, submenus, 0,
32, 32, FULL_DISPLAY_X-32, FULL_DISPLAY_Y-64, 32, 32, FULL_DISPLAY_X-32, FULL_DISPLAY_Y-32,
NULL, NULL); NULL, NULL);
} }
@ -883,21 +896,29 @@ int menu_select(const char **msgs, int *submenus)
} }
static const char *menu_select_file_internal(const char *dir_path, static const char *menu_select_file_internal(const char *dir_path,
int x, int y, int x2, int y2) int x, int y, int x2, int y2,const char *selected_file, int which)
{ {
const char **file_list = get_file_list(dir_path); const char **file_list = get_file_list(dir_path);
char *sel; char *sel;
char *out; char *out;
char *ptr_selected_file;
int opt; int opt;
int i; int i;
char buf[64];
if (file_list == NULL) if (file_list == NULL)
return NULL; return NULL;
opt = menu_select_sized("Select file", file_list, NULL, 0, if (selected_file)
x, y, x2, y2, {
NULL, NULL); ptr_selected_file= strrchr(selected_file,'/');
if (ptr_selected_file) ptr_selected_file++;
else ptr_selected_file = selected_file;
snprintf(buf,64,"df%d:%s",which, ptr_selected_file);
opt = menu_select_sized(buf, file_list, NULL, 0, x, y, x2, y2,NULL, NULL);
}
else opt = menu_select_sized("Select file", file_list, NULL, 0, x, y, x2, y2,NULL, NULL);
if (opt < 0) if (opt < 0)
return NULL; return NULL;
sel = strdup(file_list[opt]); sel = strdup(file_list[opt]);
@ -925,7 +946,7 @@ static const char *menu_select_file_internal(const char *dir_path,
/* Too deep recursion! */ /* Too deep recursion! */
if (s >= sizeof(buf)) if (s >= sizeof(buf))
return NULL; return NULL;
return menu_select_file(buf); return menu_select_file(buf, selected_file, which);
} }
out = (char*)malloc(strlen(dir_path) + strlen(sel) + 4); out = (char*)malloc(strlen(dir_path) + strlen(sel) + 4);
@ -936,6 +957,7 @@ static const char *menu_select_file_internal(const char *dir_path,
return out; return out;
} }
/*
const char *menu_select_file_start(const char *dir_path, const char **d64_name) const char *menu_select_file_start(const char *dir_path, const char **d64_name)
{ {
const char *file = menu_select_file_internal(dir_path, const char *file = menu_select_file_internal(dir_path,
@ -946,13 +968,13 @@ const char *menu_select_file_start(const char *dir_path, const char **d64_name)
return file; return file;
} }
*/
const char *menu_select_file(const char *dir_path) const char *menu_select_file(const char *dir_path,const char *selected_file, int which)
{ {
if (dir_path == NULL) if (dir_path == NULL)
dir_path = ""; dir_path = "";
return menu_select_file_internal(dir_path, return menu_select_file_internal(dir_path,
32, 32, FULL_DISPLAY_X, FULL_DISPLAY_Y - 32); 0, 32, FULL_DISPLAY_X, FULL_DISPLAY_Y - 32, selected_file, which);
} }
static TTF_Font *read_font(const char *path) static TTF_Font *read_font(const char *path)

View File

@ -29,6 +29,9 @@ extern "C" {
#define KEY_PAGEDOWN 64 #define KEY_PAGEDOWN 64
#define KEY_PAGEUP 128 #define KEY_PAGEUP 128
#define KEY_HELP 256 #define KEY_HELP 256
#define FULL_DISPLAY_X 640
#define FULL_DISPLAY_Y 480
void menu_print_font(SDL_Surface *screen, int r, int g, int b, int x, int y, const char *msg); void menu_print_font(SDL_Surface *screen, int r, int g, int b, int x, int y, const char *msg);
void menu_print_font64(SDL_Surface *screen, int r, int g, int b, int x, int y, const char *msg); void menu_print_font64(SDL_Surface *screen, int r, int g, int b, int x, int y, const char *msg);
@ -36,7 +39,7 @@ void menu_print_font64(SDL_Surface *screen, int r, int g, int b, int x, int y, c
/* Various option selects */ /* Various option selects */
int menu_select_title(const char *title, const char **pp_msgs, int *p_submenus); int menu_select_title(const char *title, const char **pp_msgs, int *p_submenus);
int menu_select(const char **pp_msgs, int *p_submenus); int menu_select(const char **pp_msgs, int *p_submenus);
const char *menu_select_file(const char *dir_path); const char *menu_select_file(const char *dir_path,const char *selected_file, int which);
const char *menu_select_file_start(const char *dir_path, const char **d64_name); const char *menu_select_file_start(const char *dir_path, const char **d64_name);
uint32_t menu_wait_key_press(void); uint32_t menu_wait_key_press(void);
@ -50,6 +53,7 @@ void menu_init(SDL_Surface *screen);
int menu_is_inited(void); int menu_is_inited(void);
int ext_matches(const char *name, const char *ext);
#if defined(__cplusplus) #if defined(__cplusplus)
} }

View File

@ -17,6 +17,13 @@ struct strlist {
int unknown; int unknown;
}; };
// Device Port
enum Porttype {
PORT_SD, // Load from SD card
PORT_USB, // Load from USB port
PORT_SMB //Load from network
};
/* maximum number native input devices supported (single type) */ /* maximum number native input devices supported (single type) */
#define MAX_INPUT_DEVICES 6 #define MAX_INPUT_DEVICES 6
/* maximum number of native input device's buttons and axles supported */ /* maximum number of native input device's buttons and axles supported */
@ -238,6 +245,15 @@ struct uae_prefs {
#endif #endif
int use_wheel_input; int use_wheel_input;
int logfile;
#ifdef GEKKO
char SmbUser[32];
char SmbPwd[32];
char SmbShare[32];
char SmbIp[32];
int Port; //SD, USB or SMB
#endif
/* input */ /* input */
int jport0; int jport0;

View File

@ -113,7 +113,10 @@ static void read_joysticks (void)
{ {
if (get_joystick_num ()) { if (get_joystick_num ()) {
unsigned int i; unsigned int i;
//IR wiimote fix
#ifndef GEKKO
SDL_JoystickUpdate (); SDL_JoystickUpdate ();
#endif
for (i = 0; i < get_joystick_num (); i++) for (i = 0; i < get_joystick_num (); i++)
read_joy (i); read_joy (i);
} }
@ -138,6 +141,10 @@ static int init_joysticks (void)
joys[i].axles = SDL_JoystickNumAxes (joys[i].joy); joys[i].axles = SDL_JoystickNumAxes (joys[i].joy);
joys[i].buttons = SDL_JoystickNumButtons (joys[i].joy); joys[i].buttons = SDL_JoystickNumButtons (joys[i].joy);
} }
//IR wiimote fix
#ifdef GEKKO
SDL_JoystickEventState(SDL_ENABLE);
#endif
success = initialized = 1; success = initialized = 1;
} else } else
write_log ("Failed to initialize joysticks\n"); write_log ("Failed to initialize joysticks\n");

View File

@ -13,7 +13,11 @@
#include <assert.h> #include <assert.h>
#if defined(GEKKO) #if defined(GEKKO)
# include <fat.h> #include <gccore.h>
#include <ogc/usbstorage.h>
#include <fat.h>
#include <network.h>
#include <smb.h>
#endif #endif
#include "options.h" #include "options.h"
@ -57,6 +61,8 @@
#include "windows.h" #include "windows.h"
#endif #endif
extern int log_quiet;
struct uae_prefs currprefs, changed_prefs; struct uae_prefs currprefs, changed_prefs;
static int restart_program; static int restart_program;
@ -69,6 +75,103 @@ int log_scsi;
struct gui_info gui_data; struct gui_info gui_data;
bool usbismount = false;
bool networkisinit = false;
bool smbismount = false;
#if defined(GEKKO)
/****************************************************************************
* Mount SMB Share
****************************************************************************/
bool ConnectShare ()
{
if(smbismount)
return true;
//printf("user: %s\n", network_prefs.SmbUser);
//printf("pass: %s\n", network_prefs.SmbPwd);
//printf("share: %s\n", network_prefs.SmbShare);
//printf("ip: %s\n\n", network_prefs.SmbIp);
int a;
for (a=0;a<3;a++)
if(smbInit(currprefs.SmbUser, currprefs.SmbPwd,currprefs.SmbShare, currprefs.SmbIp))
{smbismount = true; break;}
if(!smbismount) printf("Failed to connect to SMB share\n\n");
else {
printf("Established connection to SMB share\n\n");
}
return smbismount;
}
void CloseShare()
{
if(smbismount) {
printf("Disconnected from SMB share\n");
smbClose("smb");
}
smbismount = false;
}
/****************************************************************************
* init and deinit USB device functions
****************************************************************************/
bool InitUSB()
{
printf("Initializing USB FAT subsytem ...\n\n");
fatUnmount("usb:");
// This should wake up the drive
bool isMounted = fatMountSimple("usb", &__io_usbstorage);
bool isInserted = __io_usbstorage.isInserted();
if (!isInserted) return false;
// USB Drive may be "sleeeeping"
// We need to try Mounting a few times to wake it up
int retry = 10;
while (retry && !isMounted)
{
sleep(1);
isMounted = fatMountSimple("usb", &__io_usbstorage);
retry--;
}
if (isMounted)
printf("USB FAT subsytem initialized\n\n");
else
printf("Impossible to initialize USB FAT subsytem\n\n");
return isMounted;
}
void DeInitUSB()
{
fatUnmount("usb:");
__io_usbstorage.shutdown();
}
bool InitNetwork()
{
char myIP[16];
memset(myIP, 0, sizeof(myIP));
printf("Getting IP address via DHCP...\n\n");
if (if_config(myIP, NULL, NULL, true) < 0) {
printf("No DHCP reply\n\n");
return false;
}
printf("Got an address: %s\n\n",myIP);
return true;
}
#endif
/* /*
* Random prefs-related junk that needs to go elsewhere. * Random prefs-related junk that needs to go elsewhere.
@ -438,7 +541,8 @@ static void parse_cmdline_and_init_file (int argc, char **argv)
strcat (optionsfile, OPTIONSFILENAME); strcat (optionsfile, OPTIONSFILENAME);
if (! cfgfile_load (&currprefs, optionsfile, 0)) { if (! cfgfile_load (&currprefs, optionsfile, 0)) {
// write_log ("failed to load config '%s'\n", optionsfile); write_log ("failed to load config '%s'\n", optionsfile);
#ifdef OPTIONS_IN_HOME #ifdef OPTIONS_IN_HOME
/* sam: if not found in $HOME then look in current directory */ /* sam: if not found in $HOME then look in current directory */
char *saved_path = strdup (optionsfile); char *saved_path = strdup (optionsfile);
@ -452,11 +556,11 @@ static void parse_cmdline_and_init_file (int argc, char **argv)
free (saved_path); free (saved_path);
#endif #endif
} }
fix_options ();
parse_cmdline (argc, argv); parse_cmdline (argc, argv);
parse_user_conf_file(".saved");
parse_user_conf_file(".user"); cfgfile_load (&currprefs, SAVEDFILENAME, 0);
cfgfile_load (&currprefs, USERFILENAME, 0);
fix_options (); fix_options ();
} }
@ -976,15 +1080,53 @@ int init_sdl (void)
#ifndef NO_MAIN_IN_MAIN_C #ifndef NO_MAIN_IN_MAIN_C
int main (int argc, char **argv) int main (int argc, char **argv)
{ {
fprintf(stderr, "main started\n");
#if defined(GEKKO) #ifdef GEKKO
fatInitDefault();
#endif printf("\x1b[2;0H");
//initialize libfat library
if (!fatInitDefault())
{
printf("Couldn't initialize SD fat subsytem\n");
sleep(3);
exit(0);
}
else
printf("SD FAT subsytem initialized\n\n");
usbismount = InitUSB();
networkisinit = InitNetwork();
default_prefs (&currprefs, 0);
cfgfile_load (&currprefs, SMBFILENAME, 0);
printf("\n");
if (networkisinit) ConnectShare();
sleep(3);
// clear the screen
printf("\x1b[2J");
printf("\x1b[2;0H");
if (!(log_quiet = !currprefs.logfile)) set_logfile("/uae/uae.log");
#endif
write_log("main started\n");
init_sdl (); init_sdl ();
fprintf(stderr, "sdl inited\n"); write_log("sdl inited\n");
gui_init (argc, argv); gui_init (argc, argv);
fprintf(stderr, "Starting real main\n"); write_log("Starting real main\n");
real_main (argc, argv); real_main (argc, argv);
#ifdef GEKKO
if (smbismount) CloseShare ();
DeInitUSB();
fatUnmount(0);
#endif
return 0; return 0;
} }
#endif #endif

View File

@ -1,22 +1,27 @@
/* /*
* UAE - The Un*x Amiga Emulator * UAE - The Un*x Amiga Emulator
* *
* Target specific stuff, *nix version * Target specific stuff, *nix version
* *
* Copyright 1997 Bernd Schmidt * Copyright 1997 Bernd Schmidt
*/ */
#define TARGET_NAME "wii" #define TARGET_NAME "wii"
#define TARGET_ROM_PATH "/uae/roms" #define TARGET_ROM_PATH "/uae/roms"
#define TARGET_FLOPPY_PATH "/uae/floppies" #define TARGET_FLOPPY_PATH "/uae/floppies"
#define TARGET_HARDFILE_PATH "/uae/harddisks" #define TARGET_HARDFILE_PATH "/uae/harddisks"
#define TARGET_SAVESTATE_PATH "/uae/saves" #define TARGET_SAVESTATE_PATH "/uae/saves"
#define TARGET_USB_PATH "usb:/"
#ifndef OPTIONSFILENAME #define TARGET_SMB_PATH "smb:/"
# define OPTIONSFILENAME "/uae/uaerc"
#endif #ifndef OPTIONSFILENAME
#undef OPTIONS_IN_HOME # define OPTIONSFILENAME "/uae/uaerc"
#endif
#define DEFPRTNAME "lpr" #undef OPTIONS_IN_HOME
#define DEFSERNAME "/dev/ttyS1" #define SMBFILENAME "/uae/uaerc.smb"
#define USERFILENAME "/uae/uaerc.user"
#define SAVEDFILENAME "/uae/uaerc.saved"
#define DEFPRTNAME "lpr"
#define DEFSERNAME "/dev/ttyS1"

View File

@ -2,12 +2,15 @@
# Makefile.in for UAE tools # Makefile.in for UAE tools
# #
export PATH := $(DEVKITPPC)/../MinGW/bin:$(PATH)
CC = gcc CC = gcc
LDFLAGS = LDFLAGS =
CFLAGS = -I../include CFLAGS = -I../include
LIBRARIES = LIBRARIES =
all: gencpu gencomp build68k genblitter genlinetoscr all: gencpu.exe gencomp.exe build68k.exe genblitter.exe genlinetoscr.exe
install: install:
@ -15,7 +18,7 @@ install:
clean: clean:
-rm -f *.o -rm -f *.o
-rm cpudefs.c -rm cpudefs.c
-rm -f gencpu gencomp genblitter build68k genlinetoscr -rm -f gencpu.exe gencomp.exe build68k.exe genblitter.exe genlinetoscr.exe
distclean: clean distclean: clean
@ -23,22 +26,22 @@ distclean: clean
-rm -f Makefile sysconfig.h -rm -f Makefile sysconfig.h
-rm -f *.c -rm -f *.c
genblitter: genblitter.o blitops.o writelog.o genblitter.exe: genblitter.o blitops.o writelog.o
$(CC) $(LDFLAGS) -o genblitter genblitter.o blitops.o writelog.o $(CC) $(LDFLAGS) -o genblitter.exe genblitter.o blitops.o writelog.o
build68k: build68k.o writelog.o build68k.exe: build68k.o writelog.o
$(CC) $(LDFLAGS) -o build68k build68k.o writelog.o $(CC) $(LDFLAGS) -o build68k.exe build68k.o writelog.o
gencpu: gencpu.o readcpu.o cpudefs.o missing.o writelog.o gencpu.exe: gencpu.o readcpu.o cpudefs.o missing.o writelog.o
$(CC) $(LDFLAGS) -o gencpu gencpu.o readcpu.o cpudefs.o missing.o writelog.o $(CC) $(LDFLAGS) -o gencpu.exe gencpu.o readcpu.o cpudefs.o missing.o writelog.o
gencomp: gencomp.o readcpu.o cpudefs.o missing.o gencomp.exe: gencomp.o readcpu.o cpudefs.o missing.o
$(CC) $(LDFLAGS) -o gencomp gencomp.o readcpu.o missing.o cpudefs.o writelog.o $(CC) $(LDFLAGS) -o gencomp.exe gencomp.o readcpu.o missing.o cpudefs.o writelog.o
genlinetoscr: genlinetoscr.o genlinetoscr.exe: genlinetoscr.o
$(CC) $(LDFLAGS) -o genlinetoscr genlinetoscr.o $(CC) $(LDFLAGS) -o genlinetoscr.exe genlinetoscr.o
custom.o: blit.h custom.o: blit.h
drawing.o: linetoscr.c drawing.o: linetoscr.c
cpudefs.c: build68k ../table68k cpudefs.c: build68k.exe ../table68k
./build68k < ../table68k >cpudefs.c build68k.exe < ../table68k >cpudefs.c
.c.o: .c.o:
$(CC) $(INCLUDES) -c $(INCDIRS) $(CFLAGS) $(X_CFLAGS) $(DEBUGFLAGS) $(CFLAGS_$@) $< -o $@ $(CC) $(INCLUDES) -c $(INCDIRS) $(CFLAGS) $(X_CFLAGS) $(DEBUGFLAGS) $(CFLAGS_$@) $< -o $@

10
uaerc.smb Normal file
View File

@ -0,0 +1,10 @@
# SMB configuration
user=USER
password=PASSWORD
share_name=FOLDER
smb_ip=192.168.0.1
# Enable logfile
logfile=false

252
uaerc.wii
View File

@ -1,104 +1,148 @@
wii.rom_path=/uae/roms wii.rom_path=/uae/roms
kickstart_rom_file=/uae/roms/kick.rom kickstart_rom_file=/uae/roms/kick.rom
kickstart_key_file=$(FILE_PATH)/rom.key kickstart_key_file=$(FILE_PATH)/rom.key
#kickstart_ext_rom_file= floppy0=/uae/floppies/
floppy0=/uae/floppies/
# Alters CPU speed (values are; real, max. CPU to Chipset; 1 through 20)
# Alters CPU speed (values are; real, max. CPU to Chipset; 1 through 20) # Current setting of 4 = 20% CHIPSET and 80% CPU
# Current setting of 3 = 17% CHIPSET and 83% CPU cpu_speed=4
cpu_speed=3 # CPU Type (values are; 68000, 68020, 68020/68881 and 68040)
# CPU Type (values are; 68000, 68020, 68020/68881 and 68040) cpu_type=68000
cpu_type=68000
#No need to explain
#No need to explain cpu_24bit_addressing=false
cpu_24bit_addressing=false #Immediate blits helps with speed
#Immediate blits helps with speed immediate_blits=true
immediate_blits=true collision_level=playfields
collision_level=playfields # Emulation precision
cpu_compatible=true cpu_compatible=true
cpu_24bit_addressing=false
# Chipset type (values are; ocs, ecs_agnus, ecs, aga)
# Chipset type (values are; ocs, ecs_agnus, ecs, aga) chipset=ecs_agnus
chipset=ecs_agnus
# Slow Memory (Values are; 0 = 0MB, 1 = 256KB, 2 = 512KB, 3 = 1MB and 4 = 1.7MB)
# Slow Memory (Values are; 0 = 0MB, 1 = 256KB, 2 = 512KB, 3 = 1MB and 4 = 1.7MB) bogomem_size=2
bogomem_size=2 # Chip Memory (Values are; 0 = 0MB, 1 = 512KB, 2 = 1MB, 3 = 1.5MB and 4 = 2MB)
# Chip Memory (Values are; 0 = 0MB, 1 = 512KB, 2 = 1MB, 3 = 1.5MB and 4 = 2MB) chipmem_size=1
chipmem_size=1 # Fast Memory (Values are; 0 = 0MB, 4 = 2MB and 8 = 8MB)
# Fast Memory (Values are; 0 = 0MB, 4 = 2MB and 8 = 8MB) fastmem_size=0
fastmem_size=0 # Accellerator Memory (Values are; 1MB, 2MB, 4MB, 8MB, 16MB and 32MB)
# Accellerator Memory (Values are; 1MB, 2MB, 4MB, 8MB, 16MB and 32MB) z3mem_size=0
z3mem_size=0
# Floppy speed, can cause incompatbility with certain floppy loaders
# Floppy speed, can cause incompatbility with certain floppy loaders # (Values are; 0 = Turbo, 100 = Standard and 800 = 800% faster)
# (Values are; 0 = Turbo, 100 = Standard and 800 = 800% faster) floppy_speed=100
floppy_speed=100
show_leds=true
gfx_center_horizontal=true
gfx_center_vertical=true # Sound configuration
gfx_vsync=false sound_output=normal
gfx_correct_aspect=false sound_frequency=32000
gfx_framerate=2 sound_latency=200
show_leds=true
sdl.map_raw_keys=true
sound_output=normal
sound_frequency=32000 input.config=1
sound_latency=200
# Keyboard setup
sdl.map_raw_keys=true input.1.keyboard.0.button.96=SPC_ENTERGUI
input.config=1
# Mouse emulated by Wiimote 1
# Keyboard setup input.1.mouse.0.disabled=0
input.1.keyboard.0.button.96=SPC_ENTERGUI input.1.mouse.0.axis.0=MOUSE1_HORIZ
input.1.mouse.0.axis.1=MOUSE1_VERT
# Mouse input.1.mouse.0.axis.2=MOUSE1_WHEEL
input.1.mouse.0.disabled=0
input.1.mouse.0.axis.0=MOUSE1_HORIZ # Mouse emulated by Wiimote 2 - disabled by default since Wii SDL uses wiimote 1 only
input.1.mouse.0.axis.1=MOUSE1_VERT input.1.mouse.1.disabled=1
input.1.mouse.0.axis.2=MOUSE1_WHEEL
input.1.mouse.0.button.0=JOY1_FIRE_BUTTON # Mouse Left Button - Wimote 'A'
input.1.mouse.0.button.1=JOY1_2ND_BUTTON input.1.mouse.0.button.0=JOY1_FIRE_BUTTON
input.1.mouse.0.button.2=JOY1_3RD_BUTTON
# Mouse Right Button - Wimote 'B'
# Joystick configuration. Wiimote 1 is both mouse and joystick 2, with input.1.mouse.0.button.1=JOY1_2ND_BUTTON
# the mouse button being the A key.
# See http://wiibrew.org/wiki/SDL for the button numbers # Mouse Middle Button - Wimote ?
input.1.mouse.0.button.2=JOY1_3RD_BUTTON
input.1.joystick.0.disabled=0
input.1.joystick.0.axis.0=JOY2_HORIZ
input.1.joystick.0.axis.1=JOY2_VERT # Joystick configuration. Wiimote 1 is both mouse and joystick 2, with
input.1.joystick.0.axis.2=JOY2_HORIZ # the mouse buttons being the A and B keys. Wiimote 2 is Joystick 1 only
input.1.joystick.0.axis.3=JOY2_VERT # See http://wiibrew.org/wiki/SDL for the button numbers
input.1.joystick.0.axis.4=JOY2_HORIZ
input.1.joystick.0.axis.5=JOY2_VERT # Wiimote 1 - axis
# The "hat" on the wiimote (dpad) input.1.joystick.0.disabled=0
input.1.joystick.0.axis.9=JOY2_HORIZ input.1.joystick.0.axis.0=JOY2_HORIZ
input.1.joystick.0.axis.10=JOY2_VERT input.1.joystick.0.axis.1=JOY2_VERT
input.1.joystick.0.axis.2=JOY2_HORIZ
# 2 on wiimote, Z on nunchuck and a on the classic controller input.1.joystick.0.axis.3=JOY2_VERT
input.1.joystick.0.button.3=JOY2_FIRE_BUTTON input.1.joystick.0.axis.4=JOY2_HORIZ
input.1.joystick.0.button.7=JOY2_FIRE_BUTTON input.1.joystick.0.axis.5=JOY2_VERT
input.1.joystick.0.button.9=JOY2_FIRE_BUTTON # The "hat" on the wiimote (dpad)
input.1.joystick.0.axis.9=JOY2_HORIZ
# Wiimote 2 input.1.joystick.0.axis.10=JOY2_VERT
input.1.joystick.1.disabled=0
input.1.joystick.1.axis.0=JOY1_HORIZ # Wiimote 2 - axis
input.1.joystick.1.axis.1=JOY1_VERT input.1.joystick.1.disabled=0
input.1.joystick.1.axis.2=JOY1_HORIZ input.1.joystick.1.axis.0=JOY1_HORIZ
input.1.joystick.1.axis.3=JOY1_VERT input.1.joystick.1.axis.1=JOY1_VERT
input.1.joystick.1.axis.4=JOY1_HORIZ input.1.joystick.1.axis.2=JOY1_HORIZ
input.1.joystick.1.axis.5=JOY1_VERT input.1.joystick.1.axis.3=JOY1_VERT
input.1.joystick.1.axis.9=JOY1_HORIZ input.1.joystick.1.axis.4=JOY1_HORIZ
input.1.joystick.1.axis.10=JOY1_VERT input.1.joystick.1.axis.5=JOY1_VERT
# The "hat" on the wiimote (dpad)
input.1.joystick.1.button.3=JOY1_FIRE_BUTTON input.1.joystick.1.axis.9=JOY1_HORIZ
input.1.joystick.1.button.7=JOY1_FIRE_BUTTON input.1.joystick.1.axis.10=JOY1_VERT
input.1.joystick.1.button.9=JOY1_FIRE_BUTTON
input.1.joystick.1.button.10=JOY1_FIRE_BUTTON # Fire: '2' on wiimote and 'a' on classic controller
input.1.joystick.0.button.3=JOY2_FIRE_BUTTON
input.1.joystick.0.button.9=JOY2_FIRE_BUTTON
# Home button input.1.joystick.1.button.3=JOY1_FIRE_BUTTON
input.1.joystick.1.button.6=SPC_ENTERGUI input.1.joystick.1.button.9=JOY1_FIRE_BUTTON
input.1.joystick.1.button.19=SPC_ENTERGUI
input.1.joystick.0.button.6=SPC_ENTERGUI # Home button
input.1.joystick.0.button.19=SPC_ENTERGUI input.1.joystick.1.button.6=SPC_ENTERGUI
input.1.joystick.1.button.19=SPC_ENTERGUI
input.1.joystick.0.button.6=SPC_ENTERGUI
input.1.joystick.0.button.19=SPC_ENTERGUI
# Joy 2nd Button: 'Z' on nunchunk and 'x' Classic Controller - Uncomment if you want to use them
#input.1.joystick.0.button.7=JOY2_2ND_BUTTON
#input.1.joystick.0.button.11=JOY2_2ND_BUTTON
#input.1.joystick.1.button.7=JOY2_2ND_BUTTON
#input.1.joystick.1.button.11=JOY2_2ND_BUTTON
#Joy1 3rd Button: 'C' on nunchunk and 'y' on Classic Controller - Uncomment if you want to use them
#input.1.joystick.0.button.8=JOY2_3RD_BUTTON
#input.1.joystick.0.button.12=JOY2_3RD_BUTTON
#input.1.joystick.1.button.7=JOY2_2ND_BUTTON
#input.1.joystick.1.button.11=JOY2_2ND_BUTTON
# Graphic configuration
# Necessary to get the relative coordinates from mouse emulated with wiimote
gfx_fullscreen_amiga=true
# Set the screen dimensions
gfx_width_windowed=640
gfx_height_windowed=480
gfx_width_fullscreen=640
gfx_height_fullscreen=480
gfx_center_horizontal=true
gfx_center_vertical=true
gfx_vsync=false
# Set true to adapt the Amiga screen to Wii screen
gfx_correct_aspect=false
# Set the framerate
gfx_framerate=2
# Enable 2 floppies
#nr_floppies=2
floppy0type=0
floppy1type=0
floppy2type=-1
floppy3type=-1