1
0
mirror of synced 2024-11-27 14:50:47 +01:00

Fix Ghost Squad Evolution inputs

This commit is contained in:
Bobby Dilley 2024-05-27 20:35:34 +01:00
parent 4c006d591d
commit d8e8bb5cc9
7 changed files with 21 additions and 13 deletions

View File

@ -301,6 +301,7 @@ static int detectGame(uint32_t elf_crc)
config.gameStatus = WORKING; config.gameStatus = WORKING;
config.gameDVP = "DVP-0029A"; config.gameDVP = "DVP-0029A";
config.gameID = "SBNJ"; config.gameID = "SBNJ";
config.jvsAnalogueInBits = 8;
return 0; return 0;
} }
break; break;
@ -538,6 +539,7 @@ int initConfig()
config.gameDVP = "DVP-XXXX"; config.gameDVP = "DVP-XXXX";
config.gameType = SHOOTING; config.gameType = SHOOTING;
config.keymap = getDefaultKeymap(); config.keymap = getDefaultKeymap();
config.jvsAnalogueInBits = 10;
if (detectGame(config.crc32) != 0) if (detectGame(config.crc32) != 0)
{ {
printf("Warning: Unsure what game with CRC 0x%X is. Please submit this new game to the GitHub repository: https://github.com/bobbydilley/lindbergh-loader/issues/new?title=Please+add+new+game+0x%X&body=I+tried+to+launch+the+following+game:\n", config.crc32, config.crc32); printf("Warning: Unsure what game with CRC 0x%X is. Please submit this new game to the GitHub repository: https://github.com/bobbydilley/lindbergh-loader/issues/new?title=Please+add+new+game+0x%X&body=I+tried+to+launch+the+following+game:\n", config.crc32, config.crc32);

View File

@ -130,6 +130,7 @@ typedef struct
char *gameID; char *gameID;
char *gameTitle; char *gameTitle;
char *gameDVP; char *gameDVP;
int jvsAnalogueInBits;
} EmulatorConfig; } EmulatorConfig;
KeyMapping getDefaultKeymap(); KeyMapping getDefaultKeymap();

View File

@ -188,6 +188,8 @@ void glViewport(GLint x, GLint y, GLsizei width, GLsizei height)
int (*_glViewport)(GLint x, GLint y, GLsizei width, GLsizei height) = dlsym(RTLD_NEXT, "glViewport"); int (*_glViewport)(GLint x, GLint y, GLsizei width, GLsizei height) = dlsym(RTLD_NEXT, "glViewport");
switch (getConfig()->crc32) switch (getConfig()->crc32)
{ {
case LETS_GO_JUNGLE: case LETS_GO_JUNGLE:
case LETS_GO_JUNGLE_REVA: case LETS_GO_JUNGLE_REVA:
{ {
@ -201,7 +203,6 @@ void glViewport(GLint x, GLint y, GLsizei width, GLsizei height)
case LETS_GO_JUNGLE_SPECIAL: case LETS_GO_JUNGLE_SPECIAL:
{ {
printf("glViewPort(%d, %d, %d, %d);\n", x, y, width, height);
if (width == 2048 && height == 768) if (width == 2048 && height == 768)
{ {

View File

@ -16,10 +16,12 @@
#include <math.h> #include <math.h>
GameType gameType = SHOOTING; GameType gameType = SHOOTING;
int jvsAnalogueInBits = 10;
int initInput() int initInput()
{ {
gameType = getConfig()->gameType; gameType = getConfig()->gameType;
jvsAnalogueInBits = getConfig()->jvsAnalogueInBits;
return 0; return 0;
} }
@ -44,16 +46,16 @@ int XNextEventDriving(Display *display, XEvent *event_return, int returnValue)
incrementCoin(PLAYER_1, event_return->type == KeyPress); incrementCoin(PLAYER_1, event_return->type == KeyPress);
else if (event_return->xkey.keycode == keymap.player1.up) else if (event_return->xkey.keycode == keymap.player1.up)
setAnalogue(ANALOGUE_2, event_return->type == KeyPress ? pow(2, 10) - 1 : 0); setAnalogue(ANALOGUE_2, event_return->type == KeyPress ? pow(2, jvsAnalogueInBits) - 1 : 0);
else if (event_return->xkey.keycode == keymap.player1.down) else if (event_return->xkey.keycode == keymap.player1.down)
setAnalogue(ANALOGUE_3, event_return->type == KeyPress ? pow(2, 10) - 1 : 0); setAnalogue(ANALOGUE_3, event_return->type == KeyPress ? pow(2, jvsAnalogueInBits) - 1 : 0);
else if (event_return->xkey.keycode == keymap.player1.left) else if (event_return->xkey.keycode == keymap.player1.left)
setAnalogue(ANALOGUE_1, event_return->type == KeyPress ? pow(2, 10) * 0.2 : pow(2, 10) * 0.5); setAnalogue(ANALOGUE_1, event_return->type == KeyPress ? pow(2, jvsAnalogueInBits) * 0.2 : pow(2, jvsAnalogueInBits) * 0.5);
else if (event_return->xkey.keycode == keymap.player1.right) else if (event_return->xkey.keycode == keymap.player1.right)
setAnalogue(ANALOGUE_1, event_return->type == KeyPress ? pow(2, 10) * 0.8 : pow(2, 10) * 0.5); setAnalogue(ANALOGUE_1, event_return->type == KeyPress ? pow(2, jvsAnalogueInBits) * 0.8 : pow(2, jvsAnalogueInBits) * 0.5);
else if (event_return->xkey.keycode == keymap.player1.start) else if (event_return->xkey.keycode == keymap.player1.start)
setSwitch(PLAYER_1, BUTTON_START, event_return->type == KeyPress); setSwitch(PLAYER_1, BUTTON_START, event_return->type == KeyPress);
@ -136,11 +138,11 @@ int XNextEventShooting(Display *display, XEvent *event_return, int returnValue)
case MotionNotify: case MotionNotify:
{ {
setAnalogue(ANALOGUE_1, ((double)event_return->xmotion.x / (double)getConfig()->width) * pow(2, 10)); setAnalogue(ANALOGUE_1, ((double)event_return->xmotion.x / (double)getConfig()->width) * pow(2, jvsAnalogueInBits));
setAnalogue(ANALOGUE_2, ((double)event_return->xmotion.y / (double)getConfig()->height) * pow(2, 10)); setAnalogue(ANALOGUE_2, ((double)event_return->xmotion.y / (double)getConfig()->height) * pow(2, jvsAnalogueInBits));
// For The House of the Dead 4's Accelerometer // For The House of the Dead 4's Accelerometer
setAnalogue(ANALOGUE_5, pow(2, 10) / 2); setAnalogue(ANALOGUE_5, pow(2, jvsAnalogueInBits) / 2);
setAnalogue(ANALOGUE_6, pow(2, 10) / 2); setAnalogue(ANALOGUE_6, pow(2, jvsAnalogueInBits) / 2);
} }
break; break;

View File

@ -1,5 +1,7 @@
#include "jvs.h" #include "jvs.h"
#include "config.h"
#include <time.h> #include <time.h>
#include <string.h> #include <string.h>
#include <math.h> #include <math.h>
@ -33,7 +35,7 @@ int initJVS()
io.capabilities.switches = 14; io.capabilities.switches = 14;
io.capabilities.coins = 2; io.capabilities.coins = 2;
io.capabilities.players = 2; io.capabilities.players = 2;
io.capabilities.analogueInBits = 10; io.capabilities.analogueInBits = getConfig()->jvsAnalogueInBits;
io.capabilities.rightAlignBits = 0; io.capabilities.rightAlignBits = 0;
io.capabilities.analogueInChannels = 8; io.capabilities.analogueInChannels = 8;
io.capabilities.generalPurposeOutputs = 20; io.capabilities.generalPurposeOutputs = 20;

View File

@ -237,9 +237,6 @@ extern unsigned char outputBuffer[JVS_MAX_PACKET_SIZE], inputBuffer[JVS_MAX_PACK
int getSenseLine(); int getSenseLine();
void setSenseLine(int senseLine); void setSenseLine(int senseLine);
JVSCapabilities *getCapabilities();
JVSState *getState();
int initIO(); int initIO();
int setSwitch(JVSPlayer player, JVSInput switchNumber, int value); int setSwitch(JVSPlayer player, JVSInput switchNumber, int value);
int incrementCoin(JVSPlayer player, int amount); int incrementCoin(JVSPlayer player, int amount);

View File

@ -1074,6 +1074,9 @@ case VIRTUA_FIGHTER_5_FINAL_SHOWDOWN_REVA:
patchMemory(0x080e7db2, "01"); patchMemory(0x080e7db2, "01");
patchMemory(0x0009FF41, "15"); patchMemory(0x0009FF41, "15");
patchMemory(0x080e7f5f, "B80100000090"); patchMemory(0x080e7f5f, "B80100000090");
// Stop the extra inputs by removing io_glut_init
detourFunction(0x080e7f94, stubRetZero);
} }
break; break;
case HUMMER_EXTREME: case HUMMER_EXTREME: