Add Outrun Rev A
This commit is contained in:
parent
3b36d783ef
commit
6a1ff4adbf
@ -15,24 +15,93 @@
|
||||
#include <pthread.h>
|
||||
#include <math.h>
|
||||
|
||||
Game game = UNKNOWN;
|
||||
|
||||
int initInput()
|
||||
{
|
||||
game = getConfig()->game;
|
||||
return 0;
|
||||
}
|
||||
|
||||
int XNextEvent(Display *display, XEvent *event_return)
|
||||
/**
|
||||
* Button mapping used for driving games
|
||||
*/
|
||||
int XNextEventDriving(Display *display, XEvent *event_return, int returnValue)
|
||||
{
|
||||
|
||||
int (*_XNextEvent)(Display *display, XEvent *event_return) = dlsym(RTLD_NEXT, "XNextEvent");
|
||||
int returnValue = _XNextEvent(display, event_return);
|
||||
|
||||
// Return now if we're not emulating JVS
|
||||
if (!getConfig()->emulateJVS)
|
||||
switch (event_return->type)
|
||||
{
|
||||
return returnValue;
|
||||
|
||||
case KeyRelease:
|
||||
case KeyPress:
|
||||
{
|
||||
switch (event_return->xkey.keycode)
|
||||
{
|
||||
case 28:
|
||||
setSwitch(SYSTEM, BUTTON_TEST, event_return->type == KeyPress);
|
||||
break;
|
||||
case 39:
|
||||
setSwitch(PLAYER_1, BUTTON_SERVICE, event_return->type == KeyPress);
|
||||
break;
|
||||
case 14:
|
||||
incrementCoin(PLAYER_1, event_return->type == KeyPress);
|
||||
break;
|
||||
case 15:
|
||||
incrementCoin(PLAYER_2, event_return->type == KeyPress);
|
||||
break;
|
||||
case 111: // Up
|
||||
setAnalogue(ANALOGUE_2, event_return->type == KeyPress ? pow(2, 10) - 1 : 0);
|
||||
break;
|
||||
case 116: // Down
|
||||
setAnalogue(ANALOGUE_3, event_return->type == KeyPress ? pow(2, 10) - 1 : 0);
|
||||
break;
|
||||
case 113: // Left
|
||||
setAnalogue(ANALOGUE_1, event_return->type == KeyPress ? pow(2, 10) * 0.2 : pow(2, 10) * 0.5);
|
||||
break;
|
||||
case 114: // Right
|
||||
setAnalogue(ANALOGUE_1, event_return->type == KeyPress ? pow(2, 10) * 0.8 : pow(2, 10) * 0.5);
|
||||
break;
|
||||
case 10:
|
||||
setSwitch(PLAYER_1, BUTTON_START, event_return->type == KeyPress);
|
||||
break;
|
||||
case 24:
|
||||
setSwitch(PLAYER_1, BUTTON_1, event_return->type == KeyPress);
|
||||
break;
|
||||
case 25:
|
||||
setSwitch(PLAYER_1, BUTTON_2, event_return->type == KeyPress);
|
||||
break;
|
||||
case 26:
|
||||
setSwitch(PLAYER_1, BUTTON_3, event_return->type == KeyPress);
|
||||
break;
|
||||
case 27:
|
||||
setSwitch(PLAYER_1, BUTTON_4, event_return->type == KeyPress);
|
||||
break;
|
||||
case 29:
|
||||
setSwitch(PLAYER_1, BUTTON_UP, event_return->type == KeyPress);
|
||||
break;
|
||||
case 30:
|
||||
setSwitch(PLAYER_1, BUTTON_DOWN, event_return->type == KeyPress);
|
||||
break;
|
||||
case 31:
|
||||
setSwitch(PLAYER_1, BUTTON_LEFT, event_return->type == KeyPress);
|
||||
break;
|
||||
case 32:
|
||||
setSwitch(PLAYER_1, BUTTON_RIGHT, event_return->type == KeyPress);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
return returnValue;
|
||||
}
|
||||
|
||||
/**
|
||||
* Button mapping used for shooting games
|
||||
*/
|
||||
int XNextEventShooting(Display *display, XEvent *event_return, int returnValue)
|
||||
{
|
||||
switch (event_return->type)
|
||||
{
|
||||
|
||||
@ -116,3 +185,59 @@ int XNextEvent(Display *display, XEvent *event_return)
|
||||
|
||||
return returnValue;
|
||||
}
|
||||
|
||||
int XNextEvent(Display *display, XEvent *event_return)
|
||||
{
|
||||
|
||||
int (*_XNextEvent)(Display *display, XEvent *event_return) = dlsym(RTLD_NEXT, "XNextEvent");
|
||||
int returnValue = _XNextEvent(display, event_return);
|
||||
|
||||
// Return now if we're not emulating JVS
|
||||
if (!getConfig()->emulateJVS)
|
||||
{
|
||||
return returnValue;
|
||||
}
|
||||
|
||||
// Select the appropriate input mapping depending on the game
|
||||
switch (game)
|
||||
{
|
||||
// Driving games
|
||||
case INITIALD_4:
|
||||
case INITIALD_4_REVE:
|
||||
case INITIALD_5:
|
||||
case OUTRUN_2_SP_SDX:
|
||||
case OUTRUN_2_SP_SDX_TEST:
|
||||
case OUTRUN_2_SP_SDX_REVA:
|
||||
case OUTRUN_2_SP_SDX_REVA_TEST:
|
||||
case SEGA_RACE_TV:
|
||||
case R_TUNED:
|
||||
return XNextEventDriving(display, event_return, returnValue);
|
||||
break;
|
||||
|
||||
// Shooting games
|
||||
case THE_HOUSE_OF_THE_DEAD_4:
|
||||
case THE_HOUSE_OF_THE_DEAD_4_SPECIAL:
|
||||
case THE_HOUSE_OF_THE_DEAD_4_SPECIAL_TEST:
|
||||
case THE_HOUSE_OF_THE_DEAD_4_STRIPPED:
|
||||
case THE_HOUSE_OF_THE_DEAD_4_STRIPPED_TEST:
|
||||
case THE_HOUSE_OF_THE_DEAD_4_TEST:
|
||||
case THE_HOUSE_OF_THE_DEAD_EX:
|
||||
case THE_HOUSE_OF_THE_DEAD_EX_TEST:
|
||||
case TOO_SPICY:
|
||||
case PRIMEVAL_HUNT:
|
||||
case LETS_GO_JUNGLE:
|
||||
case LETS_GO_JUNGLE_REVA:
|
||||
case LETS_GO_JUNGLE_SPECIAL:
|
||||
|
||||
// Stick games
|
||||
case VIRTUA_TENNIS_3:
|
||||
case VIRTUA_TENNIS_3_TEST:
|
||||
case VIRTUA_FIGHTER_5: // TODO: Add in all the other VFs
|
||||
|
||||
default:
|
||||
return XNextEventShooting(display, event_return, returnValue);
|
||||
break;
|
||||
}
|
||||
|
||||
return returnValue;
|
||||
}
|
||||
|
@ -144,17 +144,17 @@ int amLibInit()
|
||||
|
||||
int amDipswInit()
|
||||
{
|
||||
uint32_t *amDipswContext = (uint32_t *)0x080980e8; // 0x0809c12c;
|
||||
uint32_t *amDipswContext1 = (uint32_t *)(0x080980e8 + 4); //(0x0809c12c + 4);
|
||||
uint32_t *amDipswContext2 = (uint32_t *)(0x080980e8 + 8); //(0x0809c12c + 8);
|
||||
uint32_t *amDipswContext3 = (uint32_t *)(0x080980e8 + 12); //(0x0809c12c + 12);
|
||||
//uint32_t *amDipswContext = (uint32_t *)0x080980e8; // 0x0809c12c;
|
||||
//uint32_t *amDipswContext1 = (uint32_t *)(0x080980e8 + 4); //(0x0809c12c + 4);
|
||||
//uint32_t *amDipswContext2 = (uint32_t *)(0x080980e8 + 8); //(0x0809c12c + 8);
|
||||
//uint32_t *amDipswContext3 = (uint32_t *)(0x080980e8 + 12); //(0x0809c12c + 12);
|
||||
// typedef void *(*___constant_c_and_count_memset)(uint32_t *, int, size_t);
|
||||
//___constant_c_and_count_memset func = (___constant_c_and_count_memset)//0x0805c3d5;
|
||||
// func(amDipswContext, 0, 4);
|
||||
*amDipswContext = 1;
|
||||
*amDipswContext1 = 1;
|
||||
*amDipswContext2 = 1;
|
||||
*amDipswContext3 = 1;
|
||||
//*amDipswContext = 1;
|
||||
//*amDipswContext1 = 1;
|
||||
//*amDipswContext2 = 1;
|
||||
//*amDipswContext3 = 1;
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -374,9 +374,19 @@ int initPatch()
|
||||
detourFunction(0x08190e80, amDongleInit);
|
||||
detourFunction(0x08191201, amDongleIsAvailable);
|
||||
detourFunction(0x08191125, amDongleUpdate);
|
||||
detourFunction(0x08191221, stubRetOne);
|
||||
// Fixes
|
||||
detourFunction(0x08190ca4, amDipswInit);
|
||||
detourFunction(0x08190db6, amDipswGetData);
|
||||
detourFunction(0x08190e2e, stubRetZero); // Stub amDipswSetLed
|
||||
|
||||
// Not sure what this does
|
||||
patchMemory(0x8105317, "909090909090909090909090909090909090909090909090909090909090909090909090");
|
||||
patchMemory(0x8048000 + 0x000C1593, "9090");
|
||||
patchMemory(0x8048000 + 0x000C1597, "9090");
|
||||
patchMemory(0x8048000 + 0x000C159D, "77");
|
||||
|
||||
|
||||
}
|
||||
break;
|
||||
case OUTRUN_2_SP_SDX_REVA_TEST:
|
||||
|
Loading…
x
Reference in New Issue
Block a user