Added rumble support and aspect ratio

This commit is contained in:
fabio.olimpieri 2011-12-10 16:55:26 +00:00
parent 39c2b6bf21
commit c8286ae963
9 changed files with 148 additions and 27 deletions

View File

@ -1,9 +1,11 @@
version 7: version 7:
*Fixed Hardfile and virtual filesystem support * Fixed Hardfile and virtual filesystem support
*Added virtual keyboard * Added virtual keyboard
*Added several menu options (immediate blits, collision level, real CPU speed, scanlines, ntsc and sound) * Added several menu options (immediate blits, collision level, real CPU speed, scanlines, ntsc and sound)
*Menu reorganization * Menu reorganization
*Other small improvements * Other small improvements
-- Fabio Olimpieri <fabio.olimpieri@tin.it>, Nov 27 CEST 2011
version 6: version 6:
*(build) Update to devkitpro r24 and libogc 1.8.8 *(build) Update to devkitpro r24 and libogc 1.8.8
@ -21,7 +23,7 @@ version 6:
* Fixed second Joystick configuration issue * Fixed second Joystick configuration issue
* Other small fixes * Other small fixes
-- Fabio Olimpieri <fabio.olimpieri@tin.it>, sept 23 CEST 2011 -- Fabio Olimpieri <fabio.olimpieri@tin.it>, Oct 23 CEST 2011
version 5.1: version 5.1:

View File

@ -178,7 +178,7 @@ dist:uae.dol
cd $@ && tar -czf ../uae-wii-bin.tar.gz * cd $@ && tar -czf ../uae-wii-bin.tar.gz *
distsource: distsource:
cd .. && cp uae-wii uae-wii-v cd .. && cp -r uae-wii uae-wii-v
cd ../uae-wii-v && find . -name ".svn" | xargs rm -rf cd ../uae-wii-v && find . -name ".svn" | xargs rm -rf
cd .. && tar -czf uae-wii-v.tar.gz uae-wii-v cd .. && tar -czf uae-wii-v.tar.gz uae-wii-v

View File

@ -559,6 +559,8 @@ void save_options (FILE *f, const struct uae_prefs *p, int type)
#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); cfgfile_write (f, "wii_port=%d\n", p->Port);
cfgfile_write (f, "rumble=%s\n", p->rumble? "true" : "false");
cfgfile_write (f, "gfx_correct_ratio=%d\n", p->gfx_correct_ratio);
#endif #endif
#ifdef FILESYS #ifdef FILESYS
@ -856,11 +858,17 @@ static int cfgfile_parse_host (struct uae_prefs *p, char *option, char *value)
//return 1; //return 1;
if (cfgfile_intval (option, value, "wii_port", &p->Port, 1)) return 1; if (cfgfile_intval (option, value, "wii_port", &p->Port, 1)) return 1;
if (cfgfile_yesno (option, value, "smb_enable", &p->smb_enable)) return 1; if (cfgfile_yesno (option, value, "smb_enable", &p->smb_enable)) return 1;
if (cfgfile_yesno (option, value, "rumble", &p->rumble)) return 1;
if (cfgfile_string (option, value, "user", p->SmbUser, 32) if (cfgfile_string (option, value, "user", p->SmbUser, 32)
|| cfgfile_string (option, value, "password", p->SmbPwd,32) || cfgfile_string (option, value, "password", p->SmbPwd,32)
|| cfgfile_string (option, value, "share_name", p->SmbShare, 32) || cfgfile_string (option, value, "share_name", p->SmbShare, 32)
|| cfgfile_string (option, value, "smb_ip", p->SmbIp, 32)) return 1; || cfgfile_string (option, value, "smb_ip", p->SmbIp, 32)) return 1;
if (cfgfile_intval (option, value, "gfx_correct_ratio", &p->gfx_correct_ratio, 1))
{
if (p->gfx_correct_ratio < 80) p->gfx_correct_ratio = 80;
if (p->gfx_correct_ratio > 100) p->gfx_correct_ratio = 100;
return 1;
}
#endif #endif
if (cfgfile_yesno (option, value, "logfile", &p->logfile)) if (cfgfile_yesno (option, value, "logfile", &p->logfile))
return 1; return 1;
@ -2488,6 +2496,8 @@ void default_prefs (struct uae_prefs *p, int type)
strcpy (p->SmbShare, "Share"); strcpy (p->SmbShare, "Share");
strcpy (p->SmbIp, "192.168.0.1"); strcpy (p->SmbIp, "192.168.0.1");
p->Port= PORT_SD; p->Port= PORT_SD;
p->rumble= 0;
p->gfx_correct_ratio = 100;
#endif #endif
p->logfile= 0; p->logfile= 0;

View File

@ -1046,7 +1046,11 @@ static void init_aspect_maps (void)
native_lines_per_amiga_line = ((double)gfxvidinfo.height native_lines_per_amiga_line = ((double)gfxvidinfo.height
* (currprefs.gfx_lores ? 320 : 640) * (currprefs.gfx_lores ? 320 : 640)
/ (currprefs.gfx_linedbl ? 512 : 256) / (currprefs.gfx_linedbl ? 512 : 256)
/ gfxvidinfo.width); / gfxvidinfo.width
#ifdef GEKKO
*currprefs.gfx_correct_ratio/100
#endif
);
else else
native_lines_per_amiga_line = 1; native_lines_per_amiga_line = 1;

View File

@ -1369,7 +1369,11 @@ int check_prefs_changed_gfx (void)
&& changed_prefs.gfx_xcenter == currprefs.gfx_xcenter && changed_prefs.gfx_xcenter == currprefs.gfx_xcenter
&& changed_prefs.gfx_ycenter == currprefs.gfx_ycenter && changed_prefs.gfx_ycenter == currprefs.gfx_ycenter
&& changed_prefs.gfx_afullscreen == currprefs.gfx_afullscreen && changed_prefs.gfx_afullscreen == currprefs.gfx_afullscreen
&& changed_prefs.gfx_pfullscreen == currprefs.gfx_pfullscreen) { && changed_prefs.gfx_pfullscreen == currprefs.gfx_pfullscreen
#ifdef GEKKO
&& changed_prefs.gfx_correct_ratio == currprefs.gfx_correct_ratio
#endif
) {
return 0; return 0;
} }
@ -1391,6 +1395,9 @@ int check_prefs_changed_gfx (void)
currprefs.gfx_ycenter = changed_prefs.gfx_ycenter; currprefs.gfx_ycenter = changed_prefs.gfx_ycenter;
currprefs.gfx_afullscreen = changed_prefs.gfx_afullscreen; currprefs.gfx_afullscreen = changed_prefs.gfx_afullscreen;
currprefs.gfx_pfullscreen = changed_prefs.gfx_pfullscreen; currprefs.gfx_pfullscreen = changed_prefs.gfx_pfullscreen;
#ifdef GEKKO
currprefs.gfx_correct_ratio = changed_prefs.gfx_correct_ratio;
#endif
#ifdef PICASSO96 #ifdef PICASSO96
if (!screen_is_picasso) if (!screen_is_picasso)

View File

@ -36,6 +36,8 @@ extern int usbismount, smbismount;
extern const char *strdup_path_expand (const char *src); extern const char *strdup_path_expand (const char *src);
int gui_is_active;
static void default_config(void); static void default_config(void);
static const char *main_menu_messages[] = { static const char *main_menu_messages[] = {
@ -112,7 +114,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|68020/68881|68040|68060",
/*02*/ " ", /*02*/ " ",
/*03*/ "Chipset type", /*03*/ "Chipset type",
/*04*/ "^|OCS|ECS AGNUS|ECS|AGA", /*04*/ "^|OCS|ECS AGNUS|ECS|AGA",
@ -145,20 +147,24 @@ static const char *emulation_messages[] = {
static const char *graphic_messages[] = { static const char *graphic_messages[] = {
/*06*/ "Correct aspect", /*00*/ "Correct aspect",
/*01*/ "^|off|100%|95%|93%|90%|custom",
/*02*/ " ",
/*03*/ "Scanlines",
/*04*/ "^|on|off",
/*05*/ " ",
/*06*/ "Leds",
/*07*/ "^|on|off", /*07*/ "^|on|off",
/*05*/ " ", /*08*/ " ",
/*06*/ "Scanlines", /*09*/ "Port",
/*07*/ "^|on|off", /*10*/ "^|SD|USB|SMB",
/*05*/ " ", /*11*/ " ",
/*08*/ "Leds", /*12*/ "Rumble",
/*09*/ "^|on|off", /*13*/ "^|on|off",
/*05*/ " ",
/*10*/ "Port",
/*11*/ "^|SD|USB|SMB",
NULL NULL
}; };
static const int correct_aspect_table[] = {0,100,95,93,90};
static const int cpu_to_chipset_table[] = {0,-1,512*2,512*4, 512*8, 512*12, 512*16, 512*20}; static const int cpu_to_chipset_table[] = {0,-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};
@ -398,7 +404,7 @@ static void set_floppy_speed(int which)
static void set_gfx_framerate(int which) static void set_gfx_framerate(int which)
{ {
/* Custom setting - don't touch! */ /* Custom setting - don't touch! */
if (which > SDL_arraysize(framerate_table)) if (which > SDL_arraysize(framerate_table)-1)
return; return;
changed_prefs.gfx_framerate = framerate_table[which]; changed_prefs.gfx_framerate = framerate_table[which];
} }
@ -410,6 +416,24 @@ static int get_gfx_framerate(void)
} }
static void set_gfx_aspect_ratio(int which)
{
if (!which) {changed_prefs.gfx_correct_aspect = 0; return;}
/* Custom setting or correct aspect off - don't touch! */
if (which > SDL_arraysize(correct_aspect_table)-1)
return;
changed_prefs.gfx_correct_aspect = 1;
changed_prefs.gfx_correct_ratio = correct_aspect_table[which];
}
static int get_gfx_aspect_ratio(void)
{
if (!changed_prefs.gfx_correct_aspect) return 0;
else
return find_index_by_val(changed_prefs.gfx_correct_ratio, correct_aspect_table,
SDL_arraysize(correct_aspect_table), 5);
}
/* Helpers to determine the accuracy */ /* Helpers to determine the accuracy */
static int get_emulation_accuracy(void) static int get_emulation_accuracy(void)
{ {
@ -547,26 +571,30 @@ static void emulation_options(void)
static void graphic_options(void) static void graphic_options(void)
{ {
int submenus[4]; int submenus[5];
int opt; int opt;
memset(submenus, 0, sizeof(submenus)); memset(submenus, 0, sizeof(submenus));
submenus[0] = !changed_prefs.gfx_correct_aspect;
submenus[0] = get_gfx_aspect_ratio();
submenus[1] = !(changed_prefs.gfx_linedbl == 2) ; submenus[1] = !(changed_prefs.gfx_linedbl == 2) ;
submenus[2] = !changed_prefs.leds_on_screen; submenus[2] = !changed_prefs.leds_on_screen;
submenus[3] = changed_prefs.Port; submenus[3] = changed_prefs.Port;
submenus[4] = !changed_prefs.rumble;
opt = menu_select_title("Other options menu", opt = menu_select_title("Other options menu",
graphic_messages, submenus); graphic_messages, submenus);
if (opt < 0) if (opt < 0)
return; return;
changed_prefs.gfx_correct_aspect = !submenus[0]; set_gfx_aspect_ratio(submenus[0]);
changed_prefs.gfx_linedbl = submenus[1] ? 1 : 2; changed_prefs.gfx_linedbl = submenus[1] ? 1 : 2;
changed_prefs.leds_on_screen = !submenus[2]; changed_prefs.leds_on_screen = !submenus[2];
currprefs.leds_on_screen = changed_prefs.leds_on_screen;
set_Port(submenus[3]); set_Port(submenus[3]);
changed_prefs.rumble = !submenus[4];
currprefs.leds_on_screen = changed_prefs.leds_on_screen;
currprefs.rumble = changed_prefs.rumble;
} }
/* 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 */
@ -886,6 +914,7 @@ void gui_display(int shortcut)
{ {
int submenus[3]; int submenus[3];
int opt; int opt;
gui_is_active=1;
pause_sound(); pause_sound();
memset(submenus, 0, sizeof(submenus)); memset(submenus, 0, sizeof(submenus));
@ -932,7 +961,8 @@ void gui_display(int shortcut)
help(); help();
break; break;
case 14: case 14:
if (msgYesNo("Are you sure to quit?", 0, FULL_DISPLAY_X /2-138, FULL_DISPLAY_Y /2-48)) uae_quit(); if (msgYesNo("Are you sure to quit?", 0, FULL_DISPLAY_X /2-138, FULL_DISPLAY_Y /2-48))
{currprefs.rumble=0; uae_quit();}
break; break;
default: default:
break; break;
@ -940,6 +970,7 @@ void gui_display(int shortcut)
} while (opt == 0 || opt == 5 || opt == 8 || opt == 9 || opt == 10 || opt == 13); } while (opt == 0 || opt == 5 || opt == 8 || opt == 9 || opt == 10 || opt == 13);
resume_sound(); resume_sound();
gui_is_active=0;
} }
void gui_message (const char *format,...) void gui_message (const char *format,...)

View File

@ -253,6 +253,8 @@ struct uae_prefs {
char SmbShare[32]; char SmbShare[32];
char SmbIp[32]; char SmbIp[32];
int Port; //SD, USB or SMB int Port; //SD, USB or SMB
int rumble;
int gfx_correct_ratio;
#endif #endif
/* input */ /* input */

View File

@ -15,6 +15,13 @@
#include "inputdevice.h" #include "inputdevice.h"
#include <SDL.h> #include <SDL.h>
#if defined(GEKKO)
# include <ogc/system.h>
# include <wiiuse/wpad.h>
#endif
extern int gui_is_active;
static unsigned int nr_joysticks; static unsigned int nr_joysticks;
static int initialized; static int initialized;
@ -26,6 +33,55 @@ struct joyinfo {
static struct joyinfo joys[MAX_INPUT_DEVICES]; static struct joyinfo joys[MAX_INPUT_DEVICES];
//Wiimote Rumble
#ifdef GEKKO
void Rumble(unsigned int nr, unsigned int i, int bs)
{
static Uint32 last_ticks[MAX_INPUT_DEVICES];
Uint32 cur_ticks;
static bool rumble_on[MAX_INPUT_DEVICES];
static bool fire_pressed[MAX_INPUT_DEVICES];
static int joystickbutton_fire[MAX_INPUT_DEVICES]={-1,-1,-1,-1,-1,-1};
int kc;
cur_ticks = SDL_GetTicks();
kc = currprefs.joystick_settings[1][nr].eventid[i][0];
if (bs && (kc == INPUTEVENT_JOY2_FIRE_BUTTON || kc == INPUTEVENT_JOY1_FIRE_BUTTON) && !rumble_on[nr] && !fire_pressed[nr])
{
WPAD_Rumble(nr, true);
last_ticks[nr]= cur_ticks;
rumble_on[nr]=true;
fire_pressed[nr]=true;
joystickbutton_fire[nr]=i;
}
if (joystickbutton_fire[nr] == i)
{
if (!bs && (kc == INPUTEVENT_JOY2_FIRE_BUTTON || kc == INPUTEVENT_JOY1_FIRE_BUTTON) && rumble_on[nr] && fire_pressed[nr])
{
rumble_on[nr]=true;
fire_pressed[nr]=false;
}
if (((cur_ticks - last_ticks[nr] > 120) && rumble_on[nr] && !fire_pressed[nr]) \
||(!bs && (kc == INPUTEVENT_JOY2_FIRE_BUTTON || kc == INPUTEVENT_JOY1_FIRE_BUTTON) && !rumble_on[nr] && fire_pressed[nr]))
{
WPAD_Rumble(nr, false);
rumble_on[nr]=false;
fire_pressed[nr]=false;
joystickbutton_fire[nr]=-1;
}
if ((cur_ticks - last_ticks[nr] > 120) && rumble_on[nr] && fire_pressed[nr])
{
WPAD_Rumble(nr, false);
rumble_on[nr]=false;
fire_pressed[nr]=true;
}
}
}
#endif
static void read_joy (unsigned int nr) static void read_joy (unsigned int nr)
{ {
@ -66,6 +122,9 @@ static void read_joy (unsigned int nr)
for (i = 0; i < num; i++) { for (i = 0; i < num; i++) {
int bs = SDL_JoystickGetButton (joy, i) ? 1 : 0; int bs = SDL_JoystickGetButton (joy, i) ? 1 : 0;
setjoybuttonstate (nr, i, bs); setjoybuttonstate (nr, i, bs);
#ifdef GEKKO
if (!gui_is_active && currprefs.rumble) Rumble (nr,i, bs);
#endif
} }
} }

View File

@ -30,6 +30,8 @@ cpu_type=68000
immediate_blits=true immediate_blits=true
collision_level=playfields collision_level=playfields
#Use the 32 bit Motorola CPU 68020 version
cpu_24bit_addressing=false cpu_24bit_addressing=false
# Emulation precision # Emulation precision
@ -154,6 +156,10 @@ gfx_vsync=false
# Set true to adapt the Amiga screen to Wii screen # Set true to adapt the Amiga screen to Wii screen
gfx_correct_aspect=false gfx_correct_aspect=false
# Set the screen correct % ratio when gfx_correct_aspect is true - possible values 80-100
gfx_correct_ratio=93
# Set the framerate # Set the framerate
gfx_framerate=2 gfx_framerate=2