fixed DVD support (gamecube), improved controller options

This commit is contained in:
ekeeke31 2008-08-11 18:02:04 +00:00
parent ec3f6c3d37
commit 0d367d7d16
6 changed files with 113 additions and 81 deletions

View File

@ -14,7 +14,7 @@ current:
- added support for some more unlicensed games: Pocket Monster, King of Fighter 98, Soul Blade (credits to Haze)
- improved Menacer emulation: fix lightgun support in Body Count & T2: The Arcade Game
- implemented Konami Justifier emulation: fix lightgun support in Lethal Enforcers 1 & 2
- implemented Sega Mouse emulation (Populous 2, Body Count, Shangai 2...)
- implemented Sega Mouse emulation (Populous 2, Body Count, Shangai 2, Fun'n Games, ...)
[Wii]
- added lightgun support (Menacer/Justifier) through Wiimote IR

View File

@ -51,8 +51,8 @@
/* System IO ports */
#define NO_SYSTEM (0) /* Unconnected Port*/
#define SYSTEM_GAMEPAD (1) /* Single Gamepad */
#define SYSTEM_MOUSE (2) /* Sega Mouse */
#define SYSTEM_MOUSE (1) /* Sega Mouse */
#define SYSTEM_GAMEPAD (2) /* Single Gamepad */
#define SYSTEM_MENACER (3) /* Sega Menacer (port 2) */
#define SYSTEM_JUSTIFIER (4) /* Konami Justifier (port 2) */
#define SYSTEM_TEAMPLAYER (5) /* Sega TeamPlayer */

View File

@ -64,6 +64,6 @@ void set_config_defaults(void)
/* controllers options */
ogc_input__set_defaults();
config.gun_cursor = 1;
config.invert_mouse = 1;
config.invert_mouse = 0;
}

View File

@ -17,24 +17,22 @@
***************************************************************************/
#include "shared.h"
#ifdef WII_DVD
#include "wdvd.h"
#endif
#ifdef HW_DOL
#include "dvd.h"
u64 DvdMaxOffset = 0x57057C00;
/** DVD I/O Address base **/
#ifndef HW_RVL
static vu32* const dvd = (u32*)0xCC006000;
static unsigned char *inquiry=(unsigned char *)0x80000004;
#endif
/** Due to lack of memory, we'll use this little 2k keyhole for all DVD operations **/
unsigned char DVDreadbuffer[2048] ATTRIBUTE_ALIGN (32);
#ifdef HW_RVL
u64 DvdMaxOffset = 0x118244F00LL;
#else
u64 DvdMaxOffset = 0x57057C00; // default
#include "wdvd.h"
u64 DvdMaxOffset = 0x118244F00LL;
#endif
/***************************************************************************
@ -44,37 +42,41 @@ u64 DvdMaxOffset = 0x57057C00; // default
***************************************************************************/
int dvd_read (void *dst, unsigned int len, u64 offset)
{
#ifndef HW_RVL
//unsigned char *buffer = (unsigned char *) (unsigned int) DVDreadbuffer;
// if (len > 2048) return 1; /*** We only allow 2k reads **/
/* DCInvalidateRange((void *)buffer, len);
/*** We only allow 2k reads **/
if (len > 2048) return 0;
/*** Let's not read past end of DVD ***/
if(offset < DvdMaxOffset)
{
dvd[0] = 0x2E;
#ifdef HW_DOL
unsigned char *buffer = (unsigned char *) (unsigned int) DVDreadbuffer;
DCInvalidateRange((void *)buffer, len);
/*dvd[0] = 0x2E;
dvd[1] = 0;
dvd[2] = 0xA8000000;
dvd[3] = (u32)(offset >> 2);
dvd[4] = len;
dvd[5] = (u32) buffer;
dvd[6] = len;
dvd[7] = 3; *//*** Enable reading with DMA ***/
// while (dvd[7] & 1);
// memcpy (dst, buffer, len);
// }
// else return 1; // Let's not read past end of DVD
dvd[7] = 3; */
// if (dvd[0] & 0x4) return 0; /* Ensure it has completed */
if (DVD_LowRead(dst,len,offset,NULL) == 1)
return 0;
#elif WII_DVD
/*** Enable reading with DMA ***/
DVD_LowRead(buffer,len,offset,NULL);
while (dvd[7] & 1);
memcpy (dst, buffer, len);
if (WDVD_LowUnencryptedRead((unsigned char **)&dst, len, (u32)(offset >> 2)) == 1)
return 0;
#endif
/*** Ensure it has completed ***/
if (dvd[0] & 0x4) return 0;
return 1;
#elif WII_DVD
return WDVD_LowUnencryptedRead((unsigned char **)&dst, len, (u32)(offset >> 2));
#endif
}
return 0;
}
/****************************************************************************
@ -86,11 +88,10 @@ int dvd_read (void *dst, unsigned int len, u64 offset)
*
* libOGC tends to foul up if you don't, and sometimes does if you do!
****************************************************************************/
#ifndef HW_RVL
#ifdef HW_DOL
void uselessinquiry ()
{
dvddrvinfo drive_info;
DVD_LowInquiry(&drive_info,NULL);
/*
@ -114,7 +115,7 @@ void uselessinquiry ()
*
* This can be used to prevent the Disc from spinning during playtime
****************************************************************************/
#ifndef HW_RVL
#ifdef HW_DOL
void dvd_motor_off( )
{
@ -143,7 +144,7 @@ void dvd_motor_off( )
* Detect the DVD Drive Type
*
****************************************************************************/
#ifndef HW_RVL
#ifdef HW_DOL
void dvd_drive_detect()
{
/*dvd[0] = 0x2e;

View File

@ -455,6 +455,11 @@ void ConfigureJoypads ()
sprintf (padmenu[1], "Port 2: GAMEPAD");
max_players ++;
}
else if (input.system[0] == SYSTEM_MOUSE)
{
sprintf (padmenu[0], "Port 1: MOUSE");
max_players ++;
}
else if (input.system[1] == SYSTEM_WAYPLAY)
{
sprintf (padmenu[1], "Port 2: 4-WAYPLAY");
@ -472,7 +477,7 @@ void ConfigureJoypads ()
else if (input.system[1] == SYSTEM_JUSTIFIER)
{
sprintf (padmenu[1], "Port 2: JUSTIFIERS");
max_players += 1;
max_players += 2;
}
else
sprintf (padmenu[1], "Port 2: NONE");
@ -526,11 +531,10 @@ void ConfigureJoypads ()
break;
}
input.system[0] ++;
if (input.system[0] == SYSTEM_MENACER) input.system[0] ++;
if (input.system[0] == SYSTEM_JUSTIFIER) input.system[0] ++;
if (input.system[0] == SYSTEM_WAYPLAY) input.system[1] = SYSTEM_WAYPLAY;
if (input.system[0] > SYSTEM_WAYPLAY)
if (input.system[0] == SYSTEM_MENACER) input.system[0] = SYSTEM_TEAMPLAYER;
else if ((input.system[0] == SYSTEM_MOUSE) && (input.system[1] == SYSTEM_MOUSE)) input.system[1] ++;
else if (input.system[0] == SYSTEM_WAYPLAY) input.system[1] = SYSTEM_WAYPLAY;
else if (input.system[0] > SYSTEM_WAYPLAY)
{
input.system[0] = NO_SYSTEM;
input.system[1] = SYSTEM_GAMEPAD;
@ -544,9 +548,9 @@ void ConfigureJoypads ()
break;
}
input.system[1] ++;
if (input.system[1] == SYSTEM_MOUSE) input.system[0] ++;
if (input.system[1] == SYSTEM_WAYPLAY) input.system[0] = SYSTEM_WAYPLAY;
if (input.system[1] > SYSTEM_WAYPLAY)
if ((input.system[1] == SYSTEM_MOUSE) && (input.system[0] == SYSTEM_MOUSE)) input.system[0] ++;
else if (input.system[1] == SYSTEM_WAYPLAY) input.system[0] = SYSTEM_WAYPLAY;
else if (input.system[1] > SYSTEM_WAYPLAY)
{
input.system[1] = NO_SYSTEM;
input.system[0] = SYSTEM_GAMEPAD;
@ -576,7 +580,7 @@ void ConfigureJoypads ()
case 5:
#ifdef HW_RVL
if (config.input[player].device == 1)
if (config.input[player].device > 0)
{
config.input[player].port ++;
}
@ -592,7 +596,58 @@ void ConfigureJoypads ()
if (config.input[player].port<4)
{
WPAD_Probe(config.input[player].port,&exp);
if ((exp == WPAD_EXP_NONE) && (config.input[player].port == (player % 4))) exp = WPAD_EXP_CLASSIC;
if (exp == WPAD_EXP_NUNCHUK) exp = 4;
}
while ((config.input[player].port<4) && (exp == 4))
{
config.input[player].port ++;
if (config.input[player].port<4)
{
exp = 4;
WPAD_Probe(config.input[player].port,&exp);
if (exp == WPAD_EXP_NUNCHUK) exp = 4;
}
}
if (config.input[player].port >= 4)
{
config.input[player].port = 0;
config.input[player].device = 2;
}
}
if (config.input[player].device == 2)
{
exp = 4;
if (config.input[player].port<4)
{
WPAD_Probe(config.input[player].port,&exp);
}
while ((config.input[player].port<4) && (exp != WPAD_EXP_NUNCHUK))
{
config.input[player].port ++;
if (config.input[player].port<4)
{
exp = 4;
WPAD_Probe(config.input[player].port,&exp);
}
}
if (config.input[player].port >= 4)
{
config.input[player].port = 0;
config.input[player].device = 3;
}
}
if (config.input[player].device == 3)
{
exp = 4;
if (config.input[player].port<4)
{
WPAD_Probe(config.input[player].port,&exp);
}
while ((config.input[player].port<4) && (exp != WPAD_EXP_CLASSIC))
@ -602,41 +657,17 @@ void ConfigureJoypads ()
{
exp = 4;
WPAD_Probe(config.input[player].port,&exp);
if ((exp == WPAD_EXP_NONE) && (config.input[player].port == (player % 4))) exp = WPAD_EXP_CLASSIC;
}
}
if (config.input[player].port >= 4)
{
config.input[player].port = player % 4;
config.input[player].device = 2;
}
}
if (config.input[player].device == 2)
{
exp = 4;
WPAD_Probe(config.input[player].port,&exp);
if (exp != WPAD_EXP_NUNCHUK) config.input[player].device ++;
}
if (config.input[player].device == 3)
{
exp = 4;
WPAD_Probe(config.input[player].port,&exp);
if (exp != WPAD_EXP_CLASSIC) config.input[player].device ++;
}
if (config.input[player].device > 3)
{
config.input[player].device = 0;
}
}
#else
config.input[player].device ++;
if (config.input[player].device > 0)
{
config.input[player].device = 0;
}
#endif
break;

View File

@ -223,7 +223,7 @@ static void pad_update(s8 num, u8 i)
{
input.analog[2][0] = x * 2;
input.analog[2][1] = y * 2;
if (config.invert_mouse) input.analog[2][1] = 0 - input.analog[2][1];
if (!config.invert_mouse) input.analog[2][1] = 0 - input.analog[2][1];
}
/* GAMEPAD directional buttons */
@ -485,7 +485,7 @@ static void wpad_update(s8 num, u8 i, u32 exp)
/* analog stick */
input.analog[2][0] = x * 2;
input.analog[2][1] = y * 2;
if (config.invert_mouse) input.analog[2][1] = 0 - input.analog[2][1];
if (!config.invert_mouse) input.analog[2][1] = 0 - input.analog[2][1];
}
/* GAMEPAD directional buttons */