diff --git a/src/lindbergh/config.c b/src/lindbergh/config.c index 90c8f29..70fffd4 100644 --- a/src/lindbergh/config.c +++ b/src/lindbergh/config.c @@ -301,6 +301,7 @@ static int detectGame(uint32_t elf_crc) config.gameStatus = WORKING; config.gameDVP = "DVP-0029A"; config.gameID = "SBNJ"; + config.jvsAnalogueInBits = 8; return 0; } break; @@ -538,6 +539,7 @@ int initConfig() config.gameDVP = "DVP-XXXX"; config.gameType = SHOOTING; config.keymap = getDefaultKeymap(); + config.jvsAnalogueInBits = 10; 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); diff --git a/src/lindbergh/config.h b/src/lindbergh/config.h index 2f01ee1..47ae69a 100644 --- a/src/lindbergh/config.h +++ b/src/lindbergh/config.h @@ -130,6 +130,7 @@ typedef struct char *gameID; char *gameTitle; char *gameDVP; + int jvsAnalogueInBits; } EmulatorConfig; KeyMapping getDefaultKeymap(); diff --git a/src/lindbergh/graphics.c b/src/lindbergh/graphics.c index 37f3cda..d91bc40 100644 --- a/src/lindbergh/graphics.c +++ b/src/lindbergh/graphics.c @@ -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"); switch (getConfig()->crc32) { + + case LETS_GO_JUNGLE: case LETS_GO_JUNGLE_REVA: { @@ -201,7 +203,6 @@ void glViewport(GLint x, GLint y, GLsizei width, GLsizei height) case LETS_GO_JUNGLE_SPECIAL: { - printf("glViewPort(%d, %d, %d, %d);\n", x, y, width, height); if (width == 2048 && height == 768) { diff --git a/src/lindbergh/input.c b/src/lindbergh/input.c index 8fcad98..8d03ded 100644 --- a/src/lindbergh/input.c +++ b/src/lindbergh/input.c @@ -16,10 +16,12 @@ #include GameType gameType = SHOOTING; +int jvsAnalogueInBits = 10; int initInput() { gameType = getConfig()->gameType; + jvsAnalogueInBits = getConfig()->jvsAnalogueInBits; return 0; } @@ -44,16 +46,16 @@ int XNextEventDriving(Display *display, XEvent *event_return, int returnValue) incrementCoin(PLAYER_1, event_return->type == KeyPress); 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) - 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) - 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) - 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) setSwitch(PLAYER_1, BUTTON_START, event_return->type == KeyPress); @@ -136,11 +138,11 @@ int XNextEventShooting(Display *display, XEvent *event_return, int returnValue) case MotionNotify: { - setAnalogue(ANALOGUE_1, ((double)event_return->xmotion.x / (double)getConfig()->width) * pow(2, 10)); - setAnalogue(ANALOGUE_2, ((double)event_return->xmotion.y / (double)getConfig()->height) * 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, jvsAnalogueInBits)); // For The House of the Dead 4's Accelerometer - setAnalogue(ANALOGUE_5, pow(2, 10) / 2); - setAnalogue(ANALOGUE_6, pow(2, 10) / 2); + setAnalogue(ANALOGUE_5, pow(2, jvsAnalogueInBits) / 2); + setAnalogue(ANALOGUE_6, pow(2, jvsAnalogueInBits) / 2); } break; diff --git a/src/lindbergh/jvs.c b/src/lindbergh/jvs.c index 76b9939..4015c73 100644 --- a/src/lindbergh/jvs.c +++ b/src/lindbergh/jvs.c @@ -1,5 +1,7 @@ #include "jvs.h" +#include "config.h" + #include #include #include @@ -33,7 +35,7 @@ int initJVS() io.capabilities.switches = 14; io.capabilities.coins = 2; io.capabilities.players = 2; - io.capabilities.analogueInBits = 10; + io.capabilities.analogueInBits = getConfig()->jvsAnalogueInBits; io.capabilities.rightAlignBits = 0; io.capabilities.analogueInChannels = 8; io.capabilities.generalPurposeOutputs = 20; diff --git a/src/lindbergh/jvs.h b/src/lindbergh/jvs.h index 2c349aa..9b6ac5d 100644 --- a/src/lindbergh/jvs.h +++ b/src/lindbergh/jvs.h @@ -237,9 +237,6 @@ extern unsigned char outputBuffer[JVS_MAX_PACKET_SIZE], inputBuffer[JVS_MAX_PACK int getSenseLine(); void setSenseLine(int senseLine); -JVSCapabilities *getCapabilities(); -JVSState *getState(); - int initIO(); int setSwitch(JVSPlayer player, JVSInput switchNumber, int value); int incrementCoin(JVSPlayer player, int amount); diff --git a/src/lindbergh/patch.c b/src/lindbergh/patch.c index 0c8997d..4cd74a5 100644 --- a/src/lindbergh/patch.c +++ b/src/lindbergh/patch.c @@ -1074,6 +1074,9 @@ case VIRTUA_FIGHTER_5_FINAL_SHOWDOWN_REVA: patchMemory(0x080e7db2, "01"); patchMemory(0x0009FF41, "15"); patchMemory(0x080e7f5f, "B80100000090"); + + // Stop the extra inputs by removing io_glut_init + detourFunction(0x080e7f94, stubRetZero); } break; case HUMMER_EXTREME: