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,3 +1,27 @@
version 6:
*(build) Update to devkitpro r24 and libogc 1.8.8
* Added SMB support
* Added mass storage usb support
* Many menu improvements (new colors, new popup messages, browsing with nunchuk, wider screen, etc.)
* Added nunchuck menu browsing
* Configuration file saved manually
* Several improvements in input configuration menu (single wiimote configurations,
snd and trd button joystick, enable/disable mouse emulation, etc.)
* Name of the loaded file in the menu header
* Added logfile option
* Fixed correct aspect option (to adapt the Amiga screen to Wii screen)
* Fixed mouse jerkiness
* Fixed second Joystick configuration issue
* Other small fixes
-- Fabio Olimpieri <fabio.olimpieri@tin.it>, sept 23 CEST 2011
version 5.1:
* (build) Update to devkitpro r24 and libogc 1.8.7
-- Fabio Olimpieri <fabio.olimpieri@tin.it>, sept 23 CEST 2011
version 5:
* (build) Update to devkitpro r20 and the new SDL-wii trunk

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

@ -45,16 +45,19 @@ OBJS := $(subst $(SRC_DIR),$(OBJ_DIR),$(SRCS:.c=.o)) $(OBJ_DIR)/guidep/VirtualKe
# It can be useful to switch this variable around to select individual tests which are problematic.
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
src/tools/genlinetoscr.exe:
cd src/tools/ && make -f Makefile.wii
# How to delete the intermediate files.
clean:
@echo Cleaning $(OBJ_DIR)
@rm -rf $(OBJS) $(OBJ_DIR) src/machdep src/target.h src/md-fpp.h src/sysconfig.h $(SYMLINKS)
@rm -f src/blit.h src/blitfunc.c src/blitfunc.h src/blittable.c src/linetoscr.c
cd src/tools/ && make -f Makefile.wii clean
$(OBJ_DIR):
install -d $@
@ -64,31 +67,31 @@ src/sysconfig.h: src/sysconfig.h.wii
src/machdep:
rm -f $@
cd src && ln -s md-ppc-gcc machdep
mkdir $@ && cd src/md-ppc-gcc && find . -maxdepth 1 -type f -exec ln '{}' ../machdep/'{}' ';'
src/osdep:
rm -f $@
cd src && ln -s od-generic osdep
mkdir $@ && cd src/od-generic && find . -maxdepth 1 -type f -exec ln '{}' ../osdep/'{}' ';'
src/gfxdep:
rm -f $@
cd src && ln -s gfx-sdl gfxdep
mkdir $@ && cd src/gfx-sdl && find . -maxdepth 1 -type f -exec ln '{}' ../gfxdep/'{}' ';'
src/joydep:
rm -f $@
cd src && ln -s jd-sdl joydep
mkdir $@ && cd src/jd-sdl && find . -maxdepth 1 -type f -exec ln '{}' ../joydep/'{}' ';'
src/guidep:
rm -f $@
cd src && ln -s gui-sdl guidep
mkdir $@ && cd src/gui-sdl && find . -maxdepth 1 -type f -exec ln '{}' ../guidep/'{}' ';'
src/sounddep:
rm -f $@
cd src && ln -s sd-sdl sounddep
mkdir $@ && cd src/sd-sdl && find . -maxdepth 1 -type f -exec ln '{}' ../sounddep/'{}' ';'
src/threaddep:
rm -f $@
cd src && ln -s td-sdl threaddep
mkdir $@ && cd src/td-sdl && find . -maxdepth 1 -type f -exec ln '{}' ../threaddep/'{}' ';'
src/target.h:
rm -f $@
@ -98,20 +101,20 @@ src/md-fpp.h:
rm -f $@
cd src && ln -s include/fpp-ieee.h md-fpp.h
src/blit.h: src/tools/genblitter
src//tools/genblitter i >$@
src/blit.h: src/tools/genblitter.exe
src/tools/genblitter.exe i >$@
src/blitfunc.c: src/tools/genblitter src/blitfunc.h
src/tools/genblitter f >$@
src/blitfunc.c: src/tools/genblitter.exe src/blitfunc.h
src/tools/genblitter.exe f >$@
src/blitfunc.h: src/tools/genblitter
src/tools/genblitter h >$@
src/blitfunc.h: src/tools/genblitter.exe
src/tools/genblitter.exe h >$@
src/blittable.c: src/tools/genblitter src/blitfunc.h
src/tools/genblitter t >$@
src/blittable.c: src/tools/genblitter.exe src/blitfunc.h
src/tools/genblitter.exe t >$@
src/linetoscr.c: src/tools/genlinetoscr
src/tools/genlinetoscr $(genlinetoscr_args) >$@
src/linetoscr.c: src/tools/genlinetoscr.exe
src/tools/genlinetoscr.exe $(genlinetoscr_args) >$@
%.h: %.h.wii
cp $< $@
@ -123,20 +126,20 @@ src/linetoscr.c: src/tools/genlinetoscr
$(LIB_DIR)/libSDL_ttf.a: $(OBJS)
@echo Archiving $@
@-mkdir -p $(dir $@)
@powerpc-gekko-ar crs $@ $(OBJS)
@powerpc-eabi-ar crs $@ $(OBJS)
@echo ----
# How to build a DOL.
uae.dol: uae.elf
@echo Creating DOL $@
@-mkdir -p $(dir $@)
#powerpc-gekko-objcopy -O binary $< $@
#powerpc-eabi-objcopy -O binary $< $@
elf2dol $< $@
@echo ----
# Compilation flags.
COMMON_FLAGS := -g -O3 -G8 -mrvl -Wall -D__inline__=__inline__ $(MACHDEP)
INCLUDES := -Isrc/md-generic/ -Isrc/include -Isrc -I$(DEVKITPRO)/libogc/include -I$(DEVKITPRO)/libogc/include/SDL
COMMON_FLAGS := -g -O3 -G8 -mrvl -Wall -D__inline__=__inline__ $(MACHDEP) -Wno-unused-variable
INCLUDES := -Isrc/md-generic/ -Isrc/include -Isrc -I$(DEVKITPRO)/libogc/include -I$(DEVKITPRO)/libogc/include/SDL -I$(PORTLIBS)/include
DEFINES := -DOS_WITHOUT_MEMORY_MANAGEMENT -DSAVESTATE -DUSE_SDL -DSUPPORT_THREADS -DCPUEMU_0 -DCPUEMU_5 -DCPUEMU_6 \
-DFPUEMU -DAGA -DAUTOCONFIG -DFILESYS \
-DTD_START_HEIGHT=16
@ -145,9 +148,8 @@ CFLAGS := $(COMMON_FLAGS) $(INCLUDES) $(DEFINES)
#unused defines; -DFDI2RAW
# 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
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
dist:uae.dol
install -d $@/apps/uae
@ -156,7 +158,10 @@ dist: uae.dol
install -d $@/uae/roms
install -d $@/uae/harddisks
install -d $@/uae/saves
touch $@/uae/roms/put-your-kick-dot-rom-here
echo "dummy" > $@/uae/roms/put-your-kick-dot-rom-here
echo "dummy" > $@/uae/floppies/dummy
echo "dummy" > $@/uae/harddisks/dummy
echo "dummy" > $@/uae/saves/dummy
cp $< $@/apps/uae/boot.dol
cp meta.xml $@/apps/uae/
cp icon.png $@/apps/uae/
@ -164,10 +169,18 @@ dist: uae.dol
cp Smaller.ttf $@/apps/uae/
cp README.Cloanto-Amiga_Forever $@/apps/uae/
cp uaerc.wii $@/uae/uaerc
cd $@ && tar -czf ../uae-bin.tar.gz *
cp uaerc.smb $@/uae/
cp docs/configuration.txt $@/apps/uae/
cp docs/Joystick_mapping.txt $@/apps/uae/
cd $@ && tar -czf ../uae-wii-bin.tar.gz *
#---------------------------------------------------------------------------------
run:
wiiload uae.dol
# How to link an ELF.
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)
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 Linking $@
@-mkdir -p $(dir $@)
$(CXX) -o $@ $(OBJS) $(LDFLAGS)

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"?>
<app version="5">
<app version="1">
<name>UAE</name>
<coder>Simon Kagstrom</coder>
<version>5</version>
<release_date>20100320</release_date>
<version>6</version>
<release_date>20111023</release_date>
<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>

View File

@ -557,7 +557,8 @@ void save_options (FILE *f, const struct uae_prefs *p, int type)
#endif
#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
#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
* handle platform-specific differences.
*/
static const char *strdup_path_expand (const char *src)
const char *strdup_path_expand (const char *src)
{
char *path = 0;
unsigned int srclen, destlen;
@ -851,10 +852,17 @@ static int cfgfile_parse_host (struct uae_prefs *p, char *option, char *value)
#endif
#if defined GEKKO
if (cfgfile_yesno (option, value, "wii_use_mario_kart_wheel", &p->use_wheel_input))
return 1;
#endif
//if (cfgfile_yesno (option, value, "wii_use_mario_kart_wheel", &p->use_wheel_input))
//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
if (cfgfile_yesno (option, value, "logfile", &p->logfile))
return 1;
#ifdef DRIVESOUND
if (cfgfile_intval (option, value, "floppy0sound", &p->dfxclick[0], 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;
}
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;
FILE *fh;
@ -1521,7 +1529,9 @@ static int cfgfile_load_2 (struct uae_prefs *p, const char *filename, int real,
if (real) {
p->config_version = 0;
config_newfilesystem = 0;
#ifndef GEKKO
reset_inputdevice_config (p);
#endif
}
write_log ("Opening cfgfile '%s'...", filename);
@ -2469,9 +2479,15 @@ void default_prefs (struct uae_prefs *p, int type)
p->mountinfo = &options_mountinfo;
#endif
#ifdef GEKKO
p->use_wheel_input = 0;
#ifdef GEKKO
strcpy (p->SmbUser,"User");
strcpy (p->SmbPwd, "Password");
strcpy (p->SmbShare, "Share");
strcpy (p->SmbIp, "192.168.0.1");
p->Port= PORT_SD;
#endif
p->logfile= 0;
#ifdef UAE_MINI
default_prefs_mini (p, 0);

View File

@ -53,9 +53,11 @@ typedef struct virtkey
{ name, "None", true }
#define KNL() \
{ NULL, NULL, false }
#define NJ(name, joy_name) \
{ name, joy_name, false }
#define KEY_COLS 14
#define KEY_ROWS 7
#define KEY_ROWS 8
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"),
@ -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("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"),
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)
@ -89,7 +92,7 @@ void VirtualKeyboard::draw()
key_w * KEY_COLS, key_h * KEY_ROWS};
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++ )
{
@ -97,7 +100,7 @@ void VirtualKeyboard::draw()
{
int which = y * KEY_COLS + x;
virtkey_t key = keys[which];
int r = 255, g = 255, b = 255;
int r = 64, g = 64, b = 64;
const char *what = key.name;
/* Skip empty positions */
@ -105,9 +108,9 @@ void VirtualKeyboard::draw()
continue;
if ( key.is_done )
r = 0;
r = 255;
if ( (x == this->sel_x && y == this->sel_y))
b = 0;
g = 200;
menu_print_font(this->screen, r, g, b,
x * key_w + border_x, y * key_h + border_y,
@ -176,8 +179,9 @@ struct virtkey *VirtualKeyboard::get_key_internal()
const char* VirtualKeyboard::get_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();
if (key == NULL)

View File

@ -19,6 +19,14 @@
#include "uae.h"
#include "menu.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);
@ -28,37 +36,49 @@ static const char *main_menu_messages[] = {
/*02*/ "States",
/*03*/ "^|Load|Save|Delete",
/*04*/ "#1-------------------------------------",
/*05*/ "Reset UAE",
/*06*/ "Amiga options",
/*07*/ "Input options",
/*05*/ "Wiimote configuration",
/*06*/ "^|Wiimote1|Wiimote2",
/*07*/ "Hardware options",
/*08*/ "Other options",
/*09*/ "Help",
/*10*/ "Quit",
/*04*/ "#1-------------------------------------",
/*04*/ "#21 - back, 2/A - select",
/*09*/ "Save confs",
/*10*/ "Reset UAE",
/*11*/ "Help",
/*12*/ "Quit",
/*13*/ "#1-------------------------------------",
/*14*/ "#21 - back, 2/A - select",
NULL
};
static const char *input_messages[] = {
/*00*/ "Bind key to Wiimote",
/*01*/ "^|1|-|+",
/*02*/ "Bind key to Nunchuk",
/*03*/ "^|C",
/*04*/ "Bind key to Classic",
/*05*/ "^|b|x|y|L|R|Zl|Zr|-|+",
/*06*/ "Mario kart wheel (horizontal only)",
/*07*/ "^|On|Off",
/*01*/ "^|1|2|-|+",
/*02*/ " ",
/*03*/ "Bind key to Nunchuk",
/*04*/ "^|Z|C",
/*05*/ " ",
/*06*/ "Bind key to Classic",
/*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,
};
static const char *amiga_model_messages[] = {
/*00*/ "Amiga model",
/*01*/ "^|A1000|A500|A600|A1200|Custom",
/*02*/ "Emulation accuracy",
/*03*/ "^|Fast|Compatible|Cycle-exact",
/*04*/ "Memory options",
/*05*/ "CPU/Chipset options",
/*06*/ "Change ROM",
/*02*/ " ",
/*03*/ "Emulation accuracy",
/*04*/ "^|Fast|Compatible|Cycle-exact",
/*05*/ " ",
/*06*/ "Memory options",
/*07*/ " ",
/*08*/ "CPU/Chipset options",
/*09*/ " ",
/*10*/ "Change ROM",
NULL
};
@ -69,8 +89,8 @@ static const char *memory_messages[] = {
/*03*/ "^|None|256K|512K|1M|1.8M",
/*04*/ "Fast mem",
/*05*/ "^|None|1M|2M|4M|8M",
/*04*/ "Zorro3 mem",
/*05*/ "^|None|1M|2M|4M|8M|16M|32M",
/*06*/ "Zorro3 mem",
/*07*/ "^|None|1M|2M|4M|8M|16M|32M",
NULL
};
@ -82,6 +102,7 @@ static const int z3fastmem_size_table[] = { 0, 1024 * 1024, 2048 * 1024, 4096 *
static const char *cpu_chipset_messages[] = {
/*00*/ "CPU type",
/*01*/ "^|68000|68010|68020|68030|68040|68060",
/*02*/ " ",
/*03*/ "Chipset type",
/*04*/ "^|OCS|ECS AGNUS|ECS|AGA",
NULL
@ -95,29 +116,32 @@ static const int chipset_mask_table[] = {0, CSMASK_ECS_AGNUS,
static const char *options_messages[] = {
/*00*/ "CPU to chipset speed",
/*01*/ "^|max|0%|34%|51%|68%|84%|100% Chipset",
/*02*/ "Frameskip",
/*03*/ "^|none|2|3|4|8|custom",
/*01*/ "^|max|90%|80%|60%|40%|20%|0%",
/*02*/ "Framerate",
/*03*/ "^|100%|50%|33%|25%|12%|custom",
/*04*/ "Floppy speed",
/*05*/ "^|normal|turbo|400%|800%",
/*06*/ "Correct aspect",
/*07*/ "^|true|false",
/*08*/ "Leds",
/*09*/ "^|on|off",
/*10*/ "Port",
/*11*/ "^|SD|USB|SMB",
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 framerate_table[] = {1, 2, 3, 4, 8};
static const char *help_messages[] = {
/*00*/ "#2HOME enters the menu system, where arrow",
/*01*/ "#2keys and +/- are used to navigate up and down.",
/*00*/ "#2HOME enters the menu system, where arrow keys",
/*01*/ "#2and nunchuck are used to navigate up and down.",
/*02*/ "#2You can bind keyboard keys to the wiimote",
/*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 ",
/*06*/ "#2Kickstart roms should be named kick.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)
{
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)
{
@ -257,13 +282,11 @@ static void insert_floppy(int which)
strcpy (changed_prefs.df[which], name);
free((void*)name);
}
else
changed_prefs.df[which][0] = '\0';
}
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 */
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)
{
int submenus[5];
int submenus[6];
int opt;
submenus[0] = get_cpu_to_chipset_speed();
submenus[1] = get_gfx_framerate();
submenus[2] = get_floppy_speed();
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",
options_messages, submenus);
@ -380,9 +456,10 @@ static void general_options(void)
set_cpu_to_chipset_speed(submenus[0]);
set_gfx_framerate(submenus[1]);
set_floppy_speed(submenus[2]);
set_Port(submenus[5]);
changed_prefs.gfx_correct_aspect = !submenus[3];
currprefs.gfx_correct_aspect = changed_prefs.gfx_correct_aspect;
/* Floppy, Power, FPS, etc etc. */
changed_prefs.leds_on_screen = !submenus[4];
currprefs.leds_on_screen = changed_prefs.leds_on_screen;
@ -390,6 +467,7 @@ static void general_options(void)
prefs_has_changed = 1;
}
/* There are a few unfortunate header problems, so I'll do like this for now */
struct uae_prefs;
void read_inputdevice_config (struct uae_prefs *pr, const char *option, const char *value);
@ -407,87 +485,69 @@ static void insert_keyboard_map(const char *key, const char *fmt, ...)
fprintf(stderr, "Too long string passed\n");
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 (&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)
{
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);
}
static void input_options(void)
static void input_options(int joy)
{
const int wiimote_to_sdl[] = {2, 4, 5};
const int nunchuk_to_sdl[] = {8};
const int classic_to_sdl[] = {10, 11, 12, 13, 14, 15, 16, 17, 18};
const int wiimote_to_sdl[] = {2, 3, 4, 5};
const int nunchuk_to_sdl[] = {7, 8};
const int classic_to_sdl[] = {9, 10, 11, 12, 13, 14, 15, 16, 17, 18};
int sdl_key = 1;
const char *key;
int submenus[4];
int submenus[5];
int opt;
int i;
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);
if (opt < 0)
return;
/* 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;
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;
}
@ -499,18 +559,23 @@ static void input_options(void)
{
case 0: /* wiimote */
sdl_key = wiimote_to_sdl[submenus[0]]; break;
case 2: /* nunchuk */
case 3: /* nunchuk */
sdl_key = nunchuk_to_sdl[submenus[1]]; break;
case 4: /* classic */
case 6: /* classic */
sdl_key = classic_to_sdl[submenus[2]]; break;
default: /* can never happen */
break;
}
changed_prefs.use_wheel_input = !submenus[3];
currprefs.use_wheel_input = changed_prefs.use_wheel_input;
if (!strcmp(key,"JOY_FIRE_BUTTON"))
key= joy ? "JOY1_FIRE_BUTTON": "JOY2_FIRE_BUTTON";
for (i = 0; i < 2; i++)
setup_joystick(i, key, sdl_key);
if (!strcmp(key,"JOY_2ND_BUTTON"))
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;
}
@ -579,7 +644,7 @@ static void amiga_model_options(void)
submenus[0] = cur_model;
submenus[1] = get_emulation_accuracy();
opt = menu_select_title("Amiga model menu",
opt = menu_select_title("Hardware option menu",
amiga_model_messages, submenus);
if (opt < 0)
return;
@ -598,16 +663,16 @@ static void amiga_model_options(void)
switch(opt)
{
case 4:
memory_options(); break;
case 5:
cpu_chipset_options(); break;
case 6:
memory_options(); break;
case 8:
cpu_chipset_options(); break;
case 10:
insert_rom(); break;
default:
break;
}
} while (opt == 4 || opt == 5 || opt == 6);
} while (opt == 6 || opt == 8 || opt == 10);
/* Reset the Amiga if the model has changed */
if (cur_model != submenus[0])
@ -636,11 +701,13 @@ static void save_load_state(int which)
case 2:
case 0: /* Load state */
{
const char *name = menu_select_file(dir);
const char *name = menu_select_file(dir, NULL,-1);
if (!name)
return;
if (ext_matches(name, ".uss")|ext_matches(name, ".USS"))
{
if (which == 0)
{
strcpy(savestate_fname, name);
@ -648,12 +715,14 @@ static void save_load_state(int which)
}
else /* Delete saved state */
unlink(name);
}
free((void*)name);
} break;
case 1: /* Save state */
snprintf(db, 255, "%s/%s.uss", dir, fb);
savestate_state = STATE_DOSAVE;
save_state(db, floppy0);
msgInfo("State saved",3000,NULL);
break;
default:
break;
@ -682,7 +751,9 @@ void gui_notify_state (int state)
extern int log_quiet;
int gui_update (void)
{
#ifndef GEKKO
log_quiet = 1;
#endif
return 0;
}
@ -748,6 +819,7 @@ void gui_display(int shortcut)
{
int submenus[3];
int opt;
pause_sound();
memset(submenus, 0, sizeof(submenus));
prefs_has_changed = 0;
@ -770,49 +842,32 @@ void gui_display(int shortcut)
save_load_state(submenus[1]);
break;
case 5:
uae_reset(1);
break;
case 6:
amiga_model_options();
input_options(submenus[2]);
break;
case 7:
input_options();
amiga_model_options();
break;
case 8:
general_options();
break;
case 9:
help();
save_configurations();
break;
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;
default:
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)
{
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);
}
resume_sound();
}
void gui_message (const char *format,...)

View File

@ -15,13 +15,12 @@
#include <sys/stat.h>
#include <dirent.h>
#include <unistd.h>
#include <string.h>
#include "sysconfig.h"
#include "menu.h"
#include "VirtualKeyboard.h"
#define FULL_DISPLAY_X 640
#define FULL_DISPLAY_Y 480
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, &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, rc.x, rc.y, rc.w,rc.h);
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, &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)
{
@ -178,14 +177,15 @@ int msgYesNo(char *text, int default_opt, int x, int y)
brc.h=20;
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, rc.x, rc.y, rc.w,rc.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();
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) */
static int ext_matches(const char *name, const char *ext)
int ext_matches(const char *name, const char *ext)
{
int len = strlen(name);
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);
if (stat(buf, &st) < 0)
continue;
if (S_ISDIR(st.st_mode))
if (S_ISDIR(st.st_mode)&&strcmp(".", de->d_name))
{
char *p;
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)
SDL_FillRect(screen, &r, SDL_MapRGB(screen->format, 0x40, 0x00, 0x00));
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);
}
@ -463,12 +463,12 @@ static void menu_draw(SDL_Surface *screen, menu_t *p_menu, int sel)
menu_print_font(screen, 0x40,0x40,0x40,
x_start, y_start + y, msg);
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);
else if (IS_SUBMENU(msg))
{
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);
else
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};
if (p_menu->cur_sel == i-1)
SDL_FillRect(screen, &r,
SDL_MapRGB(screen->format, 0x0,0xff,0x80));
SDL_MapRGB(screen->format, 255,0,0));
else
SDL_FillRect(screen, &r,
SDL_MapRGB(screen->format, 0x40,0x40,0x40));
@ -701,6 +701,17 @@ uint32_t menu_wait_key_press(void)
if (v & SDL_HAT_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 */
SDL_JoystickGetButton(joy, 3) != 0 || /* 2 */
SDL_JoystickGetButton(joy, 9) != 0 || /* CA */
@ -801,7 +812,7 @@ static int menu_select_internal(SDL_Surface *screen,
uint32_t keys;
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);
SDL_Flip(screen);
@ -849,6 +860,7 @@ int menu_select_sized(const char *title, const char **msgs, int *submenus, int s
{
menu_t menu;
int out;
/*
int info;
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;
else
info = 1;
*/
menu_init_internal(&menu, title, menu_font, msgs,
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)
{
SDL_FillRect(real_screen, 0, SDL_MapRGB(real_screen->format, 0, 0, 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);
}
@ -883,20 +896,28 @@ int menu_select(const char **msgs, int *submenus)
}
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);
char *sel;
char *out;
char *ptr_selected_file;
int opt;
int i;
char buf[64];
if (file_list == NULL)
return NULL;
opt = menu_select_sized("Select file", file_list, NULL, 0,
x, y, x2, y2,
NULL, NULL);
if (selected_file)
{
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)
return NULL;
@ -925,7 +946,7 @@ static const char *menu_select_file_internal(const char *dir_path,
/* Too deep recursion! */
if (s >= sizeof(buf))
return NULL;
return menu_select_file(buf);
return menu_select_file(buf, selected_file, which);
}
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;
}
/*
const char *menu_select_file_start(const char *dir_path, const char **d64_name)
{
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;
}
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)
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)

View File

@ -29,6 +29,9 @@ extern "C" {
#define KEY_PAGEDOWN 64
#define KEY_PAGEUP 128
#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_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 */
int menu_select_title(const char *title, 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);
uint32_t menu_wait_key_press(void);
@ -50,6 +53,7 @@ void menu_init(SDL_Surface *screen);
int menu_is_inited(void);
int ext_matches(const char *name, const char *ext);
#if defined(__cplusplus)
}

View File

@ -17,6 +17,13 @@ struct strlist {
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) */
#define MAX_INPUT_DEVICES 6
/* maximum number of native input device's buttons and axles supported */
@ -238,6 +245,15 @@ struct uae_prefs {
#endif
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 */
int jport0;

View File

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

View File

@ -13,7 +13,11 @@
#include <assert.h>
#if defined(GEKKO)
#include <gccore.h>
#include <ogc/usbstorage.h>
#include <fat.h>
#include <network.h>
#include <smb.h>
#endif
#include "options.h"
@ -57,6 +61,8 @@
#include "windows.h"
#endif
extern int log_quiet;
struct uae_prefs currprefs, changed_prefs;
static int restart_program;
@ -69,6 +75,103 @@ int log_scsi;
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.
@ -438,7 +541,8 @@ static void parse_cmdline_and_init_file (int argc, char **argv)
strcat (optionsfile, OPTIONSFILENAME);
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
/* sam: if not found in $HOME then look in current directory */
char *saved_path = strdup (optionsfile);
@ -452,11 +556,11 @@ static void parse_cmdline_and_init_file (int argc, char **argv)
free (saved_path);
#endif
}
fix_options ();
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 ();
}
@ -976,15 +1080,53 @@ int init_sdl (void)
#ifndef NO_MAIN_IN_MAIN_C
int main (int argc, char **argv)
{
fprintf(stderr, "main started\n");
#if defined(GEKKO)
fatInitDefault();
#ifdef GEKKO
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 ();
fprintf(stderr, "sdl inited\n");
write_log("sdl inited\n");
gui_init (argc, argv);
fprintf(stderr, "Starting real main\n");
write_log("Starting real main\n");
real_main (argc, argv);
#ifdef GEKKO
if (smbismount) CloseShare ();
DeInitUSB();
fatUnmount(0);
#endif
return 0;
}
#endif

View File

@ -12,11 +12,16 @@
#define TARGET_FLOPPY_PATH "/uae/floppies"
#define TARGET_HARDFILE_PATH "/uae/harddisks"
#define TARGET_SAVESTATE_PATH "/uae/saves"
#define TARGET_USB_PATH "usb:/"
#define TARGET_SMB_PATH "smb:/"
#ifndef OPTIONSFILENAME
# define OPTIONSFILENAME "/uae/uaerc"
#endif
#undef OPTIONS_IN_HOME
#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
#
export PATH := $(DEVKITPPC)/../MinGW/bin:$(PATH)
CC = gcc
LDFLAGS =
CFLAGS = -I../include
LIBRARIES =
all: gencpu gencomp build68k genblitter genlinetoscr
all: gencpu.exe gencomp.exe build68k.exe genblitter.exe genlinetoscr.exe
install:
@ -15,7 +18,7 @@ install:
clean:
-rm -f *.o
-rm cpudefs.c
-rm -f gencpu gencomp genblitter build68k genlinetoscr
-rm -f gencpu.exe gencomp.exe build68k.exe genblitter.exe genlinetoscr.exe
distclean: clean
@ -23,22 +26,22 @@ distclean: clean
-rm -f Makefile sysconfig.h
-rm -f *.c
genblitter: genblitter.o blitops.o writelog.o
$(CC) $(LDFLAGS) -o genblitter genblitter.o blitops.o writelog.o
build68k: build68k.o writelog.o
$(CC) $(LDFLAGS) -o build68k build68k.o writelog.o
gencpu: gencpu.o readcpu.o cpudefs.o missing.o writelog.o
$(CC) $(LDFLAGS) -o gencpu gencpu.o readcpu.o cpudefs.o missing.o writelog.o
gencomp: gencomp.o readcpu.o cpudefs.o missing.o
$(CC) $(LDFLAGS) -o gencomp gencomp.o readcpu.o missing.o cpudefs.o writelog.o
genlinetoscr: genlinetoscr.o
$(CC) $(LDFLAGS) -o genlinetoscr genlinetoscr.o
genblitter.exe: genblitter.o blitops.o writelog.o
$(CC) $(LDFLAGS) -o genblitter.exe genblitter.o blitops.o writelog.o
build68k.exe: build68k.o writelog.o
$(CC) $(LDFLAGS) -o build68k.exe build68k.o writelog.o
gencpu.exe: 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.exe: gencomp.o readcpu.o cpudefs.o missing.o
$(CC) $(LDFLAGS) -o gencomp.exe gencomp.o readcpu.o missing.o cpudefs.o writelog.o
genlinetoscr.exe: genlinetoscr.o
$(CC) $(LDFLAGS) -o genlinetoscr.exe genlinetoscr.o
custom.o: blit.h
drawing.o: linetoscr.c
cpudefs.c: build68k ../table68k
./build68k < ../table68k >cpudefs.c
cpudefs.c: build68k.exe ../table68k
build68k.exe < ../table68k >cpudefs.c
.c.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

View File

@ -1,12 +1,11 @@
wii.rom_path=/uae/roms
kickstart_rom_file=/uae/roms/kick.rom
kickstart_key_file=$(FILE_PATH)/rom.key
#kickstart_ext_rom_file=
floppy0=/uae/floppies/
# Alters CPU speed (values are; real, max. CPU to Chipset; 1 through 20)
# Current setting of 3 = 17% CHIPSET and 83% CPU
cpu_speed=3
# Current setting of 4 = 20% CHIPSET and 80% CPU
cpu_speed=4
# CPU Type (values are; 68000, 68020, 68020/68881 and 68040)
cpu_type=68000
@ -15,8 +14,8 @@ cpu_24bit_addressing=false
#Immediate blits helps with speed
immediate_blits=true
collision_level=playfields
# Emulation precision
cpu_compatible=true
cpu_24bit_addressing=false
# Chipset type (values are; ocs, ecs_agnus, ecs, aga)
chipset=ecs_agnus
@ -34,36 +33,44 @@ z3mem_size=0
# (Values are; 0 = Turbo, 100 = Standard and 800 = 800% faster)
floppy_speed=100
gfx_center_horizontal=true
gfx_center_vertical=true
gfx_vsync=false
gfx_correct_aspect=false
gfx_framerate=2
show_leds=true
# Sound configuration
sound_output=normal
sound_frequency=32000
sound_latency=200
sdl.map_raw_keys=true
input.config=1
# Keyboard setup
input.1.keyboard.0.button.96=SPC_ENTERGUI
# Mouse
# Mouse emulated by Wiimote 1
input.1.mouse.0.disabled=0
input.1.mouse.0.axis.0=MOUSE1_HORIZ
input.1.mouse.0.axis.1=MOUSE1_VERT
input.1.mouse.0.axis.2=MOUSE1_WHEEL
# Mouse emulated by Wiimote 2 - disabled by default since Wii SDL uses wiimote 1 only
input.1.mouse.1.disabled=1
# Mouse Left Button - Wimote 'A'
input.1.mouse.0.button.0=JOY1_FIRE_BUTTON
# Mouse Right Button - Wimote 'B'
input.1.mouse.0.button.1=JOY1_2ND_BUTTON
# Mouse Middle Button - Wimote ?
input.1.mouse.0.button.2=JOY1_3RD_BUTTON
# Joystick configuration. Wiimote 1 is both mouse and joystick 2, with
# the mouse button being the A key.
# the mouse buttons being the A and B keys. Wiimote 2 is Joystick 1 only
# See http://wiibrew.org/wiki/SDL for the button numbers
# Wiimote 1 - axis
input.1.joystick.0.disabled=0
input.1.joystick.0.axis.0=JOY2_HORIZ
input.1.joystick.0.axis.1=JOY2_VERT
@ -75,12 +82,7 @@ input.1.joystick.0.axis.5=JOY2_VERT
input.1.joystick.0.axis.9=JOY2_HORIZ
input.1.joystick.0.axis.10=JOY2_VERT
# 2 on wiimote, Z on nunchuck and a on the classic controller
input.1.joystick.0.button.3=JOY2_FIRE_BUTTON
input.1.joystick.0.button.7=JOY2_FIRE_BUTTON
input.1.joystick.0.button.9=JOY2_FIRE_BUTTON
# Wiimote 2
# Wiimote 2 - axis
input.1.joystick.1.disabled=0
input.1.joystick.1.axis.0=JOY1_HORIZ
input.1.joystick.1.axis.1=JOY1_VERT
@ -88,17 +90,59 @@ input.1.joystick.1.axis.2=JOY1_HORIZ
input.1.joystick.1.axis.3=JOY1_VERT
input.1.joystick.1.axis.4=JOY1_HORIZ
input.1.joystick.1.axis.5=JOY1_VERT
# The "hat" on the wiimote (dpad)
input.1.joystick.1.axis.9=JOY1_HORIZ
input.1.joystick.1.axis.10=JOY1_VERT
# 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
input.1.joystick.1.button.3=JOY1_FIRE_BUTTON
input.1.joystick.1.button.7=JOY1_FIRE_BUTTON
input.1.joystick.1.button.9=JOY1_FIRE_BUTTON
input.1.joystick.1.button.10=JOY1_FIRE_BUTTON
# Home button
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