Check the changelog.

This commit is contained in:
dkeruza-neo
2025-03-09 00:44:55 -05:00
parent cc500aa7ef
commit 9bbc0f983e
35 changed files with 3185 additions and 1672 deletions
+19 -8
View File
@@ -1,7 +1,6 @@
#include <stdbool.h>
#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <sys/types.h>
#include <unistd.h>
@@ -11,6 +10,8 @@
#define BLOCKSIZE 8
extern uint32_t gId;
uint8_t cardHeader[] = {0x08, 0x00, 0x00, 0x00, 0x81, 0x00, 0x59, 0xda, 0x00, 0x00, 0x54, 0x4d, 0x50, 0x06, 0x03, 0x23, 0x10, 0x41, 0x62,
0xad, 0x00, 0x2b, 0x0b, 0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x95, 0x71, 0x52, 0x70, 0x00, 0x00,
0x00, 0x00, 0xaa, 0xaa, 0xaa, 0xaa, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfd, 0xd2};
@@ -38,17 +39,27 @@ void initWriteCmd(int fdIdx)
int initCardReader()
{
uint32_t gId = getConfig()->crc32;
if (gId != VIRTUA_TENNIS_3 && gId != VIRTUA_TENNIS_3_TEST && gId != VIRTUA_TENNIS_3_REVA && gId != VIRTUA_TENNIS_3_REVA_TEST &&
gId != VIRTUA_TENNIS_3_REVB && gId != VIRTUA_TENNIS_3_REVB_TEST && gId != VIRTUA_TENNIS_3_REVC &&
gId != VIRTUA_TENNIS_3_REVC_TEST && gId != R_TUNED)
EmulatorConfig *config = getConfig();
switch (gId)
{
printf("Warning: This Game does not support Card Reader, please disable the card reader emulation in the config file.\n");
printf(" I will disable the card reader for you.\n");
EmulatorConfig *config = getConfig();
case R_TUNED:
case VIRTUA_TENNIS_3:
case VIRTUA_TENNIS_3_TEST:
case VIRTUA_TENNIS_3_REVA:
case VIRTUA_TENNIS_3_REVA_TEST:
case VIRTUA_TENNIS_3_REVB:
case VIRTUA_TENNIS_3_REVB_TEST:
case VIRTUA_TENNIS_3_REVC:
case VIRTUA_TENNIS_3_REVC_TEST:
// Code for supported games
break;
default:
printf("Warning: This Game does not support Card Reader, I will disable the card reader for you.\n");
config->emulateCardreader = 0;
return 0;
}
if (getConfig()->emulateCardreader && getConfig()->emulateDriveboard && gId != R_TUNED)
{
printf("Warning: This Game does not support Card Reader and Driver Board emulation enabled at the same time.\n");
+33 -3
View File
@@ -619,6 +619,7 @@ static int detectGame(uint32_t elf_crc)
config.gameReleaseYear = "2008";
config.gameNativeResolutions = "640x480";
config.emulateDriveboard = 1;
config.emulateCardreader = 1;
config.gameStatus = WORKING;
config.gameType = DRIVING;
config.width = 640;
@@ -947,6 +948,7 @@ static int detectGame(uint32_t elf_crc)
config.gameID = "SBKX";
config.gameReleaseYear = "2006";
config.gameNativeResolutions = "640x480, 1360x768";
config.emulateCardreader = 1;
config.gameStatus = WORKING;
config.width = 1360;
config.height = 768;
@@ -962,6 +964,7 @@ static int detectGame(uint32_t elf_crc)
config.gameID = "SBKX";
config.gameReleaseYear = "2006";
config.gameNativeResolutions = "640x480, 1360x768";
config.emulateCardreader = 1;
config.gameType = FIGHTING;
config.gameStatus = WORKING;
config.width = 1360;
@@ -978,6 +981,7 @@ static int detectGame(uint32_t elf_crc)
config.gameID = "SBKX";
config.gameReleaseYear = "2006";
config.gameNativeResolutions = "640x480, 1360x768";
config.emulateCardreader = 1;
config.gameType = FIGHTING;
config.gameStatus = WORKING;
config.width = 1360;
@@ -994,6 +998,7 @@ static int detectGame(uint32_t elf_crc)
config.gameID = "SBKX";
config.gameReleaseYear = "2006";
config.gameNativeResolutions = "640x480, 1360x768";
config.emulateCardreader = 1;
config.gameType = FIGHTING;
config.gameStatus = WORKING;
config.width = 1360;
@@ -1069,7 +1074,7 @@ int getNextIntOrAuto(char *saveptr, int defaultValue) {
strcpy(nextToken, getNextToken(NULL, " ", &saveptr));
toLowerCase(nextToken);
if(strcmp(nextToken, "auto") == 0)
if (strcmp(nextToken, "auto") == 0)
return defaultValue;
return atoi(nextToken);
@@ -1099,6 +1104,9 @@ int readConfig(FILE *configFile, EmulatorConfig *config)
config->height = getNextIntOrAuto(saveptr, defaultValue);
}
else if (strcmp(command, "BOOST_RENDER_RES") == 0)
config->boostRenderRes = atoi(getNextToken(NULL, " ", &saveptr));
else if (strcmp(command, "EEPROM_PATH") == 0)
strcpy(config->eepromPath, getNextToken(NULL, " ", &saveptr));
@@ -1121,7 +1129,13 @@ int readConfig(FILE *configFile, EmulatorConfig *config)
}
else if (strcmp(command, "EMULATE_CARDREADER") == 0)
config->emulateCardreader = atoi(getNextToken(NULL, " ", &saveptr));
{
int defaultValue = config->emulateCardreader;
config->emulateCardreader = getNextIntOrAuto(saveptr, defaultValue);
}
else if (strcmp(command, "EMULATE_TOUCHSCREEN") == 0)
config->emulateTouchscreen = atoi(getNextToken(NULL, " ", &saveptr));
else if (strcmp(command, "CARDFILE_01") == 0)
strcpy(config->cardFile1, getNextToken(NULL, " ", &saveptr));
@@ -1237,6 +1251,15 @@ int readConfig(FILE *configFile, EmulatorConfig *config)
else if (strcmp(command, "CUSTOM_CURSOR_HEIGHT") == 0)
config->customCursorHeight = atoi(getNextToken(NULL, " ", &saveptr));
else if (strcmp(command, "PH_TOUCH_CURSOR") == 0)
strcpy(config->phTouchCursor, getNextToken(NULL, " ", &saveptr));
else if (strcmp(command, "PH_TOUCH_CURSOR_WIDTH") == 0)
config->phTouchCursorWidth = atoi(getNextToken(NULL, " ", &saveptr));
else if (strcmp(command, "PH_TOUCH_CURSOR_HEIGHT") == 0)
config->phTouchCursorHeight = atoi(getNextToken(NULL, " ", &saveptr));
else if (strcmp(command, "MJ4_ENABLED_ALL_THE_TIME") == 0)
config->phMode = atoi(getNextToken(NULL, " ", &saveptr));
@@ -1380,6 +1403,8 @@ int readConfig(FILE *configFile, EmulatorConfig *config)
strncpy(config->arcadeInputs.player2_button_9, getNextToken(NULL, " ", &saveptr), INPUT_STRING_LENGTH - 1);
else if (strcmp(command, "PLAYER_2_BUTTON_10") == 0)
strncpy(config->arcadeInputs.player2_button_10, getNextToken(NULL, " ", &saveptr), INPUT_STRING_LENGTH - 1);
else if (strcmp(command, "PLAYER_2_COIN") == 0)
strncpy(config->arcadeInputs.player2_coin, getNextToken(NULL, " ", &saveptr), INPUT_STRING_LENGTH - 1);
// Analogue inputs
else if (strcmp(command, "ANALOGUE_1") == 0)
@@ -1496,6 +1521,7 @@ int initConfig(const char* configFilePath)
config.emulateDriveboard = 0;
config.emulateMotionboard = 0;
config.emulateCardreader = 0;
config.emulateTouchscreen = 0;
strcpy(config.cardFile1, "Card_01.crd");
strcpy(config.cardFile2, "Card_02.crd");
config.emulateJVS = 1;
@@ -1508,6 +1534,7 @@ int initConfig(const char* configFilePath)
strcpy(config.serial2Path, "/dev/ttyS1");
config.width = 640;
config.height = 480;
config.boostRenderRes = 1;
config.region = EX;
config.freeplay = -1;
config.showDebugMessages = 0;
@@ -1528,13 +1555,16 @@ int initConfig(const char* configFilePath)
config.fpsLimiter = 0;
config.fpsTarget = 60;
config.noSDL = 0;
config.phMode = 1;
config.phMode = 2;
config.disableBuiltinFont = 0;
config.disableBuiltinLogos = 0;
config.hideCursor = 1;
strcpy(config.customCursor, "");
config.customCursorWidth = 32;
config.customCursorHeight = 32;
strcpy(config.phTouchCursor, "");
config.phTouchCursorWidth = 32;
config.phTouchCursorHeight = 32;
config.mj4EnabledAtT = 0;
strcpy(config.or2IP, "");
+7 -1
View File
@@ -202,7 +202,8 @@ typedef struct {
char player2_button_8[INPUT_STRING_LENGTH];
char player2_button_9[INPUT_STRING_LENGTH];
char player2_button_10[INPUT_STRING_LENGTH];
char player2_coin[INPUT_STRING_LENGTH];
// Analogue inputs
char analogue_1[INPUT_STRING_LENGTH];
char analogue_2[INPUT_STRING_LENGTH];
@@ -225,6 +226,7 @@ typedef struct
int emulateDriveboard;
int emulateMotionboard;
int emulateCardreader;
int emulateTouchscreen;
char cardFile1[MAX_PATH_LENGTH];
char cardFile2[MAX_PATH_LENGTH];
int emulateJVS;
@@ -236,6 +238,7 @@ typedef struct
char serial2Path[MAX_PATH_LENGTH];
int width;
int height;
int boostRenderRes;
Colour lindberghColour;
GameStatus gameStatus;
GameType gameType;
@@ -268,6 +271,9 @@ typedef struct
char customCursor[MAX_PATH_LENGTH];
int customCursorWidth;
int customCursorHeight;
char phTouchCursor[MAX_PATH_LENGTH];
int phTouchCursorWidth;
int phTouchCursorHeight;
int mj4EnabledAtT;
char or2IP[16];
char or2Netmask[16];
+229
View File
@@ -0,0 +1,229 @@
#include <SDL2/SDL_events.h>
#include <SDL2/SDL_mouse.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#define STB_IMAGE_IMPLEMENTATION
#include "stb_image.h"
#define STBI_ONLY_PNG
#define STBI_SUPPORT_ZLIB
#define STBI_NO_SIMD
#include <SDL2/SDL.h>
#include <X11/Xlib.h>
#include <X11/Xcursor/Xcursor.h>
#include "config.h"
extern Display *x11Display;
extern Window window;
void *customCursor;
void *phTouchCursor;
void *blankCursor;
SDL_Surface *createSurfaceFromStb(unsigned char *data, int width, int height, int channels)
{
Uint32 rmask, gmask, bmask, amask;
if (channels == 4)
{
rmask = 0x000000FF;
gmask = 0x0000FF00;
bmask = 0x00FF0000;
amask = 0xFF000000;
}
else if (channels == 3)
{
rmask = 0x000000FF;
gmask = 0x0000FF00;
bmask = 0x00FF0000;
amask = 0;
}
else
{
fprintf(stderr, "Unsupported image format with %d channels.\n", channels);
return NULL;
}
return SDL_CreateRGBSurfaceFrom(data, width, height, channels * 8, width * channels, rmask, gmask, bmask, amask);
}
int loadNewCursor(const char *cursorFileName, void **cursor, int customWidth, int customHeight)
{
int width, height, channels;
unsigned char *imageData = stbi_load(cursorFileName, &width, &height, &channels, 0);
if (!imageData)
{
fprintf(stderr, "Failed to load image: %s\n", cursorFileName);
return 0;
}
SDL_Surface *originalSurface = createSurfaceFromStb(imageData, width, height, channels);
if (!originalSurface)
{
stbi_image_free(imageData);
return 0;
}
SDL_Surface *resizedSurface =
SDL_CreateRGBSurface(0, customWidth, customHeight, originalSurface->format->BitsPerPixel, originalSurface->format->Rmask,
originalSurface->format->Gmask, originalSurface->format->Bmask, originalSurface->format->Amask);
if (!resizedSurface)
{
fprintf(stderr, "SDL_CreateRGBSurface Error: %s\n", SDL_GetError());
SDL_FreeSurface(originalSurface);
stbi_image_free(imageData);
return 0;
}
SDL_Rect srcRect = {0, 0, originalSurface->w, originalSurface->h};
SDL_Rect destRect = {0, 0, customWidth, customHeight};
if (SDL_BlitScaled(originalSurface, &srcRect, resizedSurface, &destRect) != 0)
{
fprintf(stderr, "SDL_BlitScaled Error: %s\n", SDL_GetError());
SDL_FreeSurface(resizedSurface);
SDL_FreeSurface(originalSurface);
stbi_image_free(imageData);
return 0;
}
if (getConfig()->noSDL == 0)
{
*cursor = SDL_CreateColorCursor(resizedSurface, customWidth / 2, customHeight / 2);
if (!*cursor)
{
fprintf(stderr, "SDL_CreateColorCursor Error: %s\n", SDL_GetError());
SDL_FreeSurface(resizedSurface);
SDL_FreeSurface(originalSurface);
stbi_image_free(imageData);
return 0;
}
SDL_FreeSurface(resizedSurface);
SDL_FreeSurface(originalSurface);
}
else
{
XcursorImage *xcursor = XcursorImageCreate(resizedSurface->w, resizedSurface->h);
if (!xcursor)
return None;
xcursor->xhot = customWidth / 2;
xcursor->yhot = customHeight / 2;
xcursor->width = resizedSurface->w;
xcursor->height = resizedSurface->h;
// Convert SDL surface to Xcursor format (32-bit ARGB)
for (int y = 0; y < resizedSurface->h; ++y)
{
for (int x = 0; x < resizedSurface->w; ++x)
{
Uint32 pixel = ((Uint32 *)resizedSurface->pixels)[y * resizedSurface->w + x];
Uint8 r, g, b, a;
SDL_GetRGBA(pixel, resizedSurface->format, &r, &g, &b, &a);
xcursor->pixels[y * resizedSurface->w + x] = (a << 24) | (r << 16) | (g << 8) | b;
}
}
*cursor = (void*)XcursorImageLoadCursor(x11Display, xcursor);
XcursorImageDestroy(xcursor);
}
return 1;
}
void loadCursors()
{
if (strcmp(getConfig()->customCursor, "") != 0)
{
if (!loadNewCursor(getConfig()->customCursor, (void *)&customCursor, getConfig()->customCursorWidth,
getConfig()->customCursorHeight))
{
fprintf(stderr, "Custom cursor could not be loaded!\n");
exit(1);
}
}
if (strcmp(getConfig()->phTouchCursor, "") != 0)
{
if (!loadNewCursor(getConfig()->phTouchCursor, (void *)&phTouchCursor, getConfig()->phTouchCursorWidth,
getConfig()->phTouchCursorHeight))
{
fprintf(stderr, "Custom cursor could not be loaded!\n");
exit(1);
}
}
if(getConfig()->noSDL)
{
XColor dummyColor;
Pixmap blankPixmap;
blankPixmap = XCreatePixmap(x11Display, window, 1, 1, 1);
if (!blankPixmap)
{
fprintf(stderr, "Failed to create blank pixmap\n");
}
blankCursor = (void*)XCreatePixmapCursor(x11Display, blankPixmap, blankPixmap, &dummyColor, &dummyColor, 0, 0);
if (!blankCursor)
{
fprintf(stderr, "Failed to create blank cursor\n");
XFreePixmap(x11Display, blankPixmap);
}
}
}
void setCursor(void *cursor)
{
if (getConfig()->noSDL == 0)
{
if (SDL_GetCursor() != NULL)
SDL_SetCursor(cursor);
}
else
{
XDefineCursor(x11Display, window, (Cursor)cursor);
XFlush(x11Display);
}
}
void hideCursor()
{
if (getConfig()->noSDL == 0)
{
SDL_ShowCursor(SDL_DISABLE);
}
else
{
XDefineCursor(x11Display, window, (Cursor)blankCursor);
XFlush(x11Display);
}
}
void showCursor()
{
if (getConfig()->noSDL == 0)
{
SDL_ShowCursor(SDL_ENABLE);
}
else
{
XDefineCursor(x11Display, window, (Cursor)customCursor);
XFlush(x11Display);
}
}
void showPhCursor()
{
if (getConfig()->noSDL == 0)
{
SDL_ShowCursor(SDL_ENABLE);
}
else
{
XDefineCursor(x11Display, window, (Cursor)phTouchCursor);
XFlush(x11Display);
}
}
+10
View File
@@ -0,0 +1,10 @@
#ifndef CUSTOM_CURSORS_H
#define CUSTOM_CURSORS_H
int loadNewCursor(const char *cursorFileName, void **cursor, int customWidth, int customHeight);
void loadCursors();
void setCursor(void *cursor);
void hideCursor();
void showCursor();
void showPhCursor();
#endif
+22 -16
View File
@@ -16,6 +16,8 @@
#define I2C_SEEK 2
#define I2C_WRITE 3
extern uint32_t gId;
union i2c_smbus_data {
uint8_t byte;
uint16_t word;
@@ -68,36 +70,40 @@ int initEeprom()
setFreeplay(eeprom, getConfig()->freeplay);
}
if ((getConfig()->crc32 == LETS_GO_JUNGLE_SPECIAL) || (getConfig()->crc32 == THE_HOUSE_OF_THE_DEAD_EX) ||
(getConfig()->crc32 == THE_HOUSE_OF_THE_DEAD_4_SPECIAL) ||
(getConfig()->crc32 == THE_HOUSE_OF_THE_DEAD_4_SPECIAL_REVB))
switch (gId)
{
case LETS_GO_JUNGLE_SPECIAL:
case THE_HOUSE_OF_THE_DEAD_EX:
case THE_HOUSE_OF_THE_DEAD_4_SPECIAL:
case THE_HOUSE_OF_THE_DEAD_4_SPECIAL_REVB:
if (fixCreditSection(eeprom) != 0)
{
printf("Error initializing eeprom settings.");
fclose(eeprom);
return 1;
}
}
if (getConfig()->crc32 == HUMMER || getConfig()->crc32 == HUMMER_SDLX || getConfig()->crc32 == HUMMER_EXTREME ||
getConfig()->crc32 == HUMMER_EXTREME_MDX)
{
break;
case HUMMER:
case HUMMER_SDLX:
case HUMMER_EXTREME:
case HUMMER_EXTREME_MDX:
if (fixCoinAssignmentsHummer(eeprom) != 0)
{
printf("Error initializing eeprom settings.");
fclose(eeprom);
return 1;
}
}
if ((getConfig()->crc32 == OUTRUN_2_SP_SDX || getConfig()->crc32 == OUTRUN_2_SP_SDX_REVA) && strcmp(getConfig()->or2IP, "") != 0)
{
if (setIP(eeprom, getConfig()->or2IP, getConfig()->or2Netmask) != 0)
break;
case OUTRUN_2_SP_SDX:
case OUTRUN_2_SP_SDX_REVA:
if (strcmp(getConfig()->or2IP, "") != 0)
{
printf("Error setting the new IP address.");
fclose(eeprom);
return 1;
if (setIP(eeprom, getConfig()->or2IP, getConfig()->or2Netmask) != 0)
{
printf("Error setting the new IP address.");
fclose(eeprom);
return 1;
}
}
}
-1
View File
@@ -3,7 +3,6 @@
#include <stdlib.h>
#include <string.h>
#include "config.h"
#include "eeprom_settings.h"
uint32_t crc32_table[255];
+54 -37
View File
@@ -59,6 +59,7 @@ ArcadeInput arcadeInputs[] = {{"TEST_BUTTON", 0, BUTTON_TEST, 1},
{"PLAYER_2_BUTTON_8", 2, BUTTON_8, 1},
{"PLAYER_2_BUTTON_9", 2, BUTTON_9, 1},
{"PLAYER_2_BUTTON_10", 2, BUTTON_10, 1},
{"PLAYER_2_COIN", 2, COIN, 1},
{"ANALOGUE_1", 0, ANALOGUE_1, 1},
{"ANALOGUE_2", 0, ANALOGUE_2, 1},
@@ -921,18 +922,19 @@ static ControllerStatus listControllers(Controllers *controllers)
strcat(controllerInput->inputName, "_");
strcat(controllerInput->inputName, codename(EV_KEY, code));
normaliseName(controllerInput->inputName);
if(snprintf(controllerInput->inputTechName, SIZE, "%s:KEY:%i", controllers->controller[i].path, code) >= 1024) {
// hum ok, truncated value
}
strcpy(controllerInput->inputTechNegName, "-"); // unassignable value (not "" while some conf are empty)
// if(snprintf(controllerInput->inputTechName, SIZE, "%s:KEY:%i", controllers->controller[i].path,
// code) >= 1024) {
// // hum ok, truncated value
// }
// strcpy(controllerInput->inputTechNegName, "-"); // unassignable value (not "" while some conf are empty)
}
}
}
if (test_bit(EV_ABS, bit[0]))
{
ioctl(controller, EVIOCGBIT(EV_ABS, ABS_MAX), bit[EV_ABS]);
for (int code = 0; code < ABS_MAX; code++)
ioctl(controller, EVIOCGBIT(EV_ABS, KEY_MAX), bit[EV_ABS]);
for (int code = 0; code < KEY_MAX; code++)
{
if (test_bit(code, bit[EV_ABS]))
{
@@ -946,12 +948,14 @@ static ControllerStatus listControllers(Controllers *controllers)
strcat(controllerInput->inputName, "_");
strcat(controllerInput->inputName, codename(EV_ABS, code));
normaliseName(controllerInput->inputName);
if(snprintf(controllerInput->inputTechName, SIZE, "%s:ABS:%i", controllers->controller[i].path, code) >= 1024) {
// hum ok, truncated value
}
if(snprintf(controllerInput->inputTechNegName, SIZE, "%s:ABS_NEG:%i", controllers->controller[i].path, code) >= 1024) {
// hum ok, truncated value
}
// if(snprintf(controllerInput->inputTechName, SIZE, "%s:ABS:%i", controllers->controller[i].path,
// code) >= 1024) {
// // hum ok, truncated value
// }
// if(snprintf(controllerInput->inputTechNegName, SIZE, "%s:ABS_NEG:%i",
// controllers->controller[i].path, code) >= 1024) {
// // hum ok, truncated value
// }
ControllerInput *minControllerInput =
&controllers->controller[i].inputs[controllers->controller[i].inputCount++];
@@ -960,12 +964,14 @@ static ControllerStatus listControllers(Controllers *controllers)
minControllerInput->specialFunction = ANALOGUE_TO_DIGITAL_MIN;
strcpy(minControllerInput->inputName, controllerInput->inputName);
strcat(minControllerInput->inputName, "_MIN");
if(snprintf(minControllerInput->inputTechName, SIZE, "%s:ABS:%i:MIN", controllers->controller[i].path, code) >= 1024) {
// hum ok, truncated value
}
if(snprintf(minControllerInput->inputTechNegName, SIZE, "%s:ABS_NEG:%i:MIN", controllers->controller[i].path, code) >= 1024) {
// hum ok, truncated value
}
// if(snprintf(minControllerInput->inputTechName, SIZE, "%s:ABS:%i:MIN",
// controllers->controller[i].path, code) >= 1024) {
// // hum ok, truncated value
// }
// if(snprintf(minControllerInput->inputTechNegName, SIZE, "%s:ABS_NEG:%i:MIN",
// controllers->controller[i].path, code) >= 1024) {
// // hum ok, truncated value
// }
ControllerInput *maxControllerInput =
&controllers->controller[i].inputs[controllers->controller[i].inputCount++];
@@ -974,24 +980,27 @@ static ControllerStatus listControllers(Controllers *controllers)
maxControllerInput->specialFunction = ANALOGUE_TO_DIGITAL_MAX;
strcpy(maxControllerInput->inputName, controllerInput->inputName);
strcat(maxControllerInput->inputName, "_MAX");
if(snprintf(maxControllerInput->inputTechName, SIZE, "%s:ABS:%i:MAX", controllers->controller[i].path, code) >= 1024) {
// hum ok, truncated value
}
if(snprintf(maxControllerInput->inputTechNegName, SIZE, "%s:ABS_NEG:%i:MAX", controllers->controller[i].path, code) >= 1024) {
// hum ok, truncated value
}
ControllerInput *shakeControllerInput =
&controllers->controller[i].inputs[controllers->controller[i].inputCount++];
shakeControllerInput->evType = EV_ABS;
shakeControllerInput->evCode = code;
shakeControllerInput->specialFunction = ANALOGUE_SHAKE;
strcpy(shakeControllerInput->inputName, controllerInput->inputName);
strcat(shakeControllerInput->inputName, "_SHAKE");
if(snprintf(shakeControllerInput->inputTechName, SIZE, "%s:ABS:%i:SHAKE", controllers->controller[i].path, code) >= 1024) {
// hum ok, truncated value
}
// if(snprintf(maxControllerInput->inputTechName, SIZE, "%s:ABS:%i:MAX",
// controllers->controller[i].path, code) >= 1024) {
// // hum ok, truncated value
// }
// if(snprintf(maxControllerInput->inputTechNegName, SIZE, "%s:ABS_NEG:%i:MAX",
// controllers->controller[i].path, code) >= 1024) {
// // hum ok, truncated value
// }
// ControllerInput *shakeControllerInput =
// &controllers->controller[i].inputs[controllers->controller[i].inputCount++];
// shakeControllerInput->evType = EV_ABS;
// shakeControllerInput->evCode = code;
// shakeControllerInput->specialFunction = ANALOGUE_SHAKE;
// strcpy(shakeControllerInput->inputName, controllerInput->inputName);
// strcat(shakeControllerInput->inputName, "_SHAKE");
// if(snprintf(shakeControllerInput->inputTechName, SIZE, "%s:ABS:%i:SHAKE",
// controllers->controller[i].path, code) >= 1024) {
// // hum ok, truncated value
// }
//
struct input_absinfo absoluteFeatures;
ioctl(controller, EVIOCGABS(code), &absoluteFeatures);
controllers->controller[i].absMin[code] = absoluteFeatures.minimum;
@@ -1183,6 +1192,8 @@ char *getMapping(char *mapping)
return "TEST_BUTTON";
if (strcmp(mapping, config->arcadeInputs.player1_coin) == 0)
return "PLAYER_1_COIN";
if (strcmp(mapping, config->arcadeInputs.player2_coin) == 0)
return "PLAYER_2_COIN";
// Player 1 controls
if (strcmp(mapping, config->arcadeInputs.player1_button_start) == 0)
@@ -1429,9 +1440,15 @@ ControllerStatus startControllerThreads(Controllers *controllers)
if (strstr(input.name, "ANALOGUE") != NULL)
controllers->controller[i].keyTriggers[controllers->controller[i].inputs[j].evCode].isAnalogue = 1;
if (strcmp(input.name, "PLAYER_1_COIN") == 0) {
if (strcmp(input.name, "PLAYER_1_COIN") == 0)
{
controllers->controller[i].keyTriggers[controllers->controller[i].inputs[j].evCode].isCoin = 1;
}
}
if (strcmp(input.name, "PLAYER_2_COIN") == 0)
{
controllers->controller[i].keyTriggers[controllers->controller[i].inputs[j].evCode].isCoin = 1;
}
}
break;
+4 -4
View File
@@ -2,7 +2,7 @@
#include <linux/input-event-codes.h>
#define SIZE 1024
#define SIZE 128
#define CONTROLLER_THREAD_MAX 256
@@ -69,12 +69,12 @@ typedef struct
typedef struct
{
char name[SIZE];
char path[SIZE];
char physicalLocation[SIZE];
char path[320];
char physicalLocation[128];
int absMax[ABS_MAX];
int absMin[ABS_MAX];
ControllerInput inputs[SIZE];
ControllerInput inputs[320];
int inputCount;
ArcadeInput keyTriggers[KEY_MAX];
+24 -8
View File
@@ -24,6 +24,7 @@
#include "border.h"
#include "resolution.h"
extern uint32_t gId;
extern SDL_Window *SDLwindow;
extern char SDLgameTitle[];
extern fps_limit fpsLimit;
@@ -36,7 +37,9 @@ void *idleFunc = NULL;
void FGAPIENTRY glutInit(int *argcp, char **argv)
{
if (*argcp > 1 && getConfig()->crc32 == SEGA_RACE_TV)
void FGAPIENTRY (*_glutInit)(int *argcp, char **argv) = dlsym(RTLD_NEXT, "glutInit");
if (*argcp > 1 && gId == SEGA_RACE_TV)
{
if (isTestMode())
{
@@ -45,8 +48,14 @@ void FGAPIENTRY glutInit(int *argcp, char **argv)
printf("Forced to use SDL to make Test mode render fine.\n");
}
}
GLUTGame = true;
if (getConfig()->noSDL)
{
_glutInit(argcp, argv);
return;
}
GLUTGame = true;
initSDL(argcp, argv);
}
@@ -102,10 +111,13 @@ void FGAPIENTRY glutSwapBuffers(void)
return;
}
int gId = config->crc32;
if (gId == OUTRUN_2_SP_SDX || gId == OUTRUN_2_SP_SDX_REVA || gId == OUTRUN_2_SP_SDX_REVA_TEST || gId == OUTRUN_2_SP_SDX_REVA_TEST2 ||
gId == OUTRUN_2_SP_SDX_TEST)
switch (gId)
{
case OUTRUN_2_SP_SDX:
case OUTRUN_2_SP_SDX_REVA:
case OUTRUN_2_SP_SDX_REVA_TEST:
case OUTRUN_2_SP_SDX_REVA_TEST2:
case OUTRUN_2_SP_SDX_TEST:
pollEvents();
}
@@ -174,11 +186,15 @@ void FGAPIENTRY glutSetCursor(int glutCursor)
if (getConfig()->noSDL)
{
void FGAPIENTRY (*_glutSetCursor)(int glutCursor) = dlsym(RTLD_NEXT, "glutSetCursor");
_glutSetCursor(glutCursor);
if(strcmp(getConfig()->customCursor, "") == 0)
_glutSetCursor(glutCursor);
return;
}
SDL_Cursor *cursor = SDL_CreateSystemCursor(SDL_SYSTEM_CURSOR_ARROW);
SDL_SetCursor(cursor);
if (strcmp(getConfig()->customCursor, "") == 0)
{
SDL_Cursor *cursor = SDL_CreateSystemCursor(SDL_SYSTEM_CURSOR_ARROW);
SDL_SetCursor(cursor);
}
}
void FGAPIENTRY glutDisplayFunc(void (*callback)(void))
+56 -27
View File
@@ -1,4 +1,3 @@
#include <complex.h>
#define GL_GLEXT_PROTOTYPES
#ifndef __i386__
#define __i386__
@@ -20,6 +19,7 @@
#include <dlfcn.h>
#include <SDL2/SDL.h>
#include <sys/time.h>
#include <stdio.h>
#include "fps_limiter.h"
#include "sdlcalls.h"
@@ -28,11 +28,12 @@
#include "border.h"
bool sdlGame = false;
extern uint32_t gId;
extern SDL_Window *SDLwindow;
extern SDL_GLContext SDLcontext;
extern char SDLgameTitle[];
extern fps_limit fpsLimit;
extern Window win;
extern Window window;
void glXSwapBuffers(Display *dpy, GLXDrawable drawable)
{
@@ -43,14 +44,22 @@ void glXSwapBuffers(Display *dpy, GLXDrawable drawable)
if (config->borderEnabled)
drawGameBorder(config->width, config->height, config->whiteBorderPercentage, config->blackBorderPercentage);
int gId = getConfig()->crc32;
if (getConfig()->noSDL && (gId == OUTRUN_2_SP_SDX || gId == OUTRUN_2_SP_SDX_REVA || gId == OUTRUN_2_SP_SDX_REVA_TEST ||
gId == OUTRUN_2_SP_SDX_REVA_TEST2 || gId == OUTRUN_2_SP_SDX_TEST))
if (getConfig()->noSDL)
{
XEvent event;
while (XPending(dpy))
switch (gId)
{
XNextEvent(dpy, &event);
case OUTRUN_2_SP_SDX:
case OUTRUN_2_SP_SDX_REVA:
case OUTRUN_2_SP_SDX_REVA_TEST:
case OUTRUN_2_SP_SDX_REVA_TEST2:
case OUTRUN_2_SP_SDX_TEST:
{
XEvent event;
while (XPending(dpy))
{
XNextEvent(dpy, &event);
}
}
}
}
else
@@ -76,7 +85,7 @@ void glXSwapBuffers(Display *dpy, GLXDrawable drawable)
if (getConfig()->noSDL)
{
XStoreName(dpy, win, "");
XStoreName(dpy, window, "");
return;
}
char windowTitle[512];
@@ -229,28 +238,37 @@ GLXFBConfig *glXChooseFBConfig(Display *dpy, int screen, const int *attrib_list,
GLXFBConfig *(*_glXChooseFBConfig)(Display *dpy, int screen, const int *attrib_list, int *nelements) =
dlsym(RTLD_NEXT, "glXChooseFBConfig");
int gId = getConfig()->crc32;
char *__GLX_VENDOR_LIBRARY_NAME = getenv("__GLX_VENDOR_LIBRARY_NAME");
char *__NV_PRIME_RENDER_OFFLOAD = getenv("__NV_PRIME_RENDER_OFFLOAD");
if (__GLX_VENDOR_LIBRARY_NAME == NULL)
__GLX_VENDOR_LIBRARY_NAME = " ";
if (__NV_PRIME_RENDER_OFFLOAD == NULL)
__NV_PRIME_RENDER_OFFLOAD = " ";
if ((strcmp(__GLX_VENDOR_LIBRARY_NAME, "nvidia") == 0) && (strcmp(__NV_PRIME_RENDER_OFFLOAD, "1") == 0) &&
((gId == THE_HOUSE_OF_THE_DEAD_4_REVA) || (gId == THE_HOUSE_OF_THE_DEAD_4_REVB) ||
(gId == THE_HOUSE_OF_THE_DEAD_4_REVC) || (gId == THE_HOUSE_OF_THE_DEAD_4_SPECIAL) ||
(gId == THE_HOUSE_OF_THE_DEAD_4_SPECIAL_REVB) || (gId == THE_HOUSE_OF_THE_DEAD_EX) || (gId == TOO_SPICY)))
switch (gId)
{
for (int i = 0; attrib_list[i] != None; i += 2)
case THE_HOUSE_OF_THE_DEAD_4_REVA:
case THE_HOUSE_OF_THE_DEAD_4_REVB:
case THE_HOUSE_OF_THE_DEAD_4_REVC:
case THE_HOUSE_OF_THE_DEAD_4_SPECIAL:
case THE_HOUSE_OF_THE_DEAD_4_SPECIAL_REVB:
case THE_HOUSE_OF_THE_DEAD_EX:
case TOO_SPICY:
{
if (strcmp(__GLX_VENDOR_LIBRARY_NAME, "nvidia") == 0 && strcmp(__NV_PRIME_RENDER_OFFLOAD, "1") == 0)
{
if (attrib_list[i] == GLX_DOUBLEBUFFER)
for (int i = 0; attrib_list[i] != None; i += 2)
{
int *ptr = (int *)&attrib_list[i + 1];
patchMemory((intptr_t)ptr, "01");
setVariable((intptr_t)ptr, GLX_DONT_CARE);
if (attrib_list[i] == GLX_DOUBLEBUFFER)
{
int *ptr = (int *)&attrib_list[i + 1];
patchMemory((intptr_t)ptr, "01");
setVariable((intptr_t)ptr, GLX_DONT_CARE);
}
}
}
}
}
return _glXChooseFBConfig(dpy, screen, attrib_list, nelements);
}
@@ -306,20 +324,31 @@ GLXFBConfigSGIX *glXChooseFBConfigSGIX(Display *dpy, int screen, int *attrib_lis
__GLX_VENDOR_LIBRARY_NAME = " ";
if (__NV_PRIME_RENDER_OFFLOAD == NULL)
__NV_PRIME_RENDER_OFFLOAD = " ";
if ((strcmp(__GLX_VENDOR_LIBRARY_NAME, "nvidia") == 0) && (strcmp(__NV_PRIME_RENDER_OFFLOAD, "1") == 0) &&
((gId == INITIALD_4_REVA) || (gId == INITIALD_4_REVB) || (gId == INITIALD_4_REVC) || (gId == INITIALD_4_REVD) ||
(gId == INITIALD_4_REVG) || (gId == INITIALD_4_EXP_REVB) || (gId == INITIALD_4_EXP_REVC) ||
gId == INITIALD_4_EXP_REVD))
switch (gId)
{
for (int i = 0; attrib_list[i] != None; i += 2)
case INITIALD_4_REVA:
case INITIALD_4_REVB:
case INITIALD_4_REVC:
case INITIALD_4_REVD:
case INITIALD_4_REVG:
case INITIALD_4_EXP_REVB:
case INITIALD_4_EXP_REVC:
case INITIALD_4_EXP_REVD:
{
if (strcmp(__GLX_VENDOR_LIBRARY_NAME, "nvidia") == 0 && strcmp(__NV_PRIME_RENDER_OFFLOAD, "1") == 0)
{
if (attrib_list[i] == GLX_DOUBLEBUFFER)
for (int i = 0; attrib_list[i] != None; i += 2)
{
int *ptr = (int *)&attrib_list[i + 1];
patchMemory((intptr_t)ptr, "01");
if (attrib_list[i] == GLX_DOUBLEBUFFER)
{
int *ptr = (int *)&attrib_list[i + 1];
patchMemory((intptr_t)ptr, "01");
}
}
}
}
}
return glXChooseFBConfig(dpy, screen, attrib_list, nelements);
}
+169 -72
View File
@@ -46,6 +46,7 @@
#include "fps_limiter.h"
#include "evdevinput.h"
#include "card_reader.h"
#include "touchscreen.h"
#include "log.h"
#include "resources/font.h"
#include "resources/logo.h"
@@ -80,9 +81,12 @@ int logoTGAidx = 0;
uint32_t elf_crc = 0;
uint32_t gId = 0;
extern int hummerExtremeShaderFileIndex;
extern bool cachedShaderFilesLoaded;
extern char vf5StageNameAbbr[5];
bool phShowCursorInGame = false;
extern fps_limit fpsLimit;
Controllers controllers = {0};
@@ -102,7 +106,9 @@ static void handleSegfault(int signal, siginfo_t *info, void *ptr)
ucontext_t *ctx = ptr;
// Get the address of the instruction causing the segfault
uint8_t *code = (uint8_t *)ctx->uc_mcontext.gregs[REG_EIP];
// uint8_t *code = (uint8_t *)ctx->uc_mcontext.gregs[REG_EIP];
greg_t eip_value = ctx->uc_mcontext.gregs[REG_EIP];
uint8_t *code = (uint8_t *)(uintptr_t)eip_value; // Use uintptr_t to ensure proper alignment
switch (*code)
{
@@ -171,9 +177,36 @@ static void handleSegfault(int signal, siginfo_t *info, void *ptr)
}
}
char *checkIDlike()
{
FILE *file = fopen("/etc/os-release", "r");
if (!file)
{
perror("Failed to open /etc/os-release");
return NULL;
}
char line[256];
char *result = NULL;
while (fgets(line, sizeof(line), file))
{
if (strncmp(line, "ID_LIKE=", 8) == 0)
{
char *id_like = strchr(line, '=');
if (id_like)
{
result = strdup(id_like);
break;
}
}
}
fclose(file);
return result;
}
void __attribute__((constructor)) hook_init()
{
// Get offsets of the Game's ELF and calculate CRC32.
dl_iterate_phdr(callback, NULL);
@@ -183,15 +216,27 @@ void __attribute__((constructor)) hook_init()
act.sa_flags = SA_SIGINFO;
sigaction(SIGSEGV, &act, NULL);
char *(*_getenv)(const char *name) = dlsym(RTLD_NEXT, "getenv");
char* envPath = _getenv("LINDBERGH_CONFIG_PATH");
char *envPath = getenv("LINDBERGH_CONFIG_PATH");
initConfig(envPath);
gId = getConfig()->crc32;
char *id_like = checkIDlike();
if (id_like == NULL)
{
log_warn("Unable to get system info on current OS");
}
else if (strstr(id_like, "debian") == NULL)
{
log_warn("Seems like you're not in debian-like system. There might be unexpected issues.");
}
if (getConfig()->fpsLimiter == 1)
{
fpsLimit.targetFrameTime = 1000000 / getConfig()->fpsTarget;
fpsLimit.frameEnd = Clock_now();
}
getGPUVendor();
if (initPatch() != 0)
@@ -236,8 +281,6 @@ void __attribute__((constructor)) hook_init()
if (initControllers(&controllers) != 0)
exit(1);
securityBoardSetDipResolution(getConfig()->width, getConfig()->height);
printf("\nSEGA Lindbergh Emulator\nBy the Lindbergh Development Team 2025\n\n");
@@ -255,16 +298,26 @@ void __attribute__((constructor)) hook_init()
}
printf("\n");
if (getConfig()->GPUVendor == ATI_GPU &&
((getConfig()->crc32 == LETS_GO_JUNGLE) || (getConfig()->crc32 == LETS_GO_JUNGLE_REVA) ||
(getConfig()->crc32 == LETS_GO_JUNGLE_SPECIAL) || (getConfig()->crc32 == AFTER_BURNER_CLIMAX) ||
(getConfig()->crc32 == AFTER_BURNER_CLIMAX_REVA) || (getConfig()->crc32 == AFTER_BURNER_CLIMAX_REVB) ||
(getConfig()->crc32 == AFTER_BURNER_CLIMAX_SDX) || (getConfig()->crc32 == AFTER_BURNER_CLIMAX_SDX_REVA) ||
(getConfig()->crc32 == AFTER_BURNER_CLIMAX_SE) || (getConfig()->crc32 == AFTER_BURNER_CLIMAX_SE_REVA) ||
(getConfig()->crc32 == INITIALD_5_JAP_REVA) || (getConfig()->crc32 == INITIALD_5_JAP_REVF) ||
(getConfig()->crc32 == INITIALD_5_EXP_20) || (getConfig()->crc32 == INITIALD_5_EXP_20A)))
switch (gId)
{
printf("WARNING: Game %s is unsupported in AMD GPU with ATI driver\n", getGameName());
case LETS_GO_JUNGLE:
case LETS_GO_JUNGLE_REVA:
case LETS_GO_JUNGLE_SPECIAL:
case AFTER_BURNER_CLIMAX:
case AFTER_BURNER_CLIMAX_REVA:
case AFTER_BURNER_CLIMAX_REVB:
case AFTER_BURNER_CLIMAX_SDX:
case AFTER_BURNER_CLIMAX_SDX_REVA:
case AFTER_BURNER_CLIMAX_SE:
case AFTER_BURNER_CLIMAX_SE_REVA:
case INITIALD_5_JAP_REVA:
case INITIALD_5_JAP_REVF:
case INITIALD_5_EXP_20:
case INITIALD_5_EXP_20A:
if (getConfig()->GPUVendor == ATI_GPU)
{
printf("WARNING: Game %s is unsupported in AMD GPU with ATI driver\n", getGameName());
}
}
}
@@ -272,9 +325,13 @@ DIR *opendir(const char *dirname)
{
DIR *(*_opendir)(const char *dirname) = dlsym(RTLD_NEXT, "opendir");
int gId = getConfig()->crc32;
if (gId == INITIALD_5_EXP || gId == INITIALD_5_EXP_20 || gId == INITIALD_5_EXP_20A || gId == INITIALD_5_JAP_REVA || gId == INITIALD_5_JAP_REVF)
switch (gId)
{
case INITIALD_5_EXP:
case INITIALD_5_EXP_20:
case INITIALD_5_EXP_20A:
case INITIALD_5_JAP_REVA:
case INITIALD_5_JAP_REVF:
if (strcmp(dirname, "/tmp/") == 0)
{
return _opendir(dirname + 1);
@@ -317,10 +374,11 @@ int open(const char *pathname, int flags, ...)
if (strcmp(pathname, "/dev/ttyS0") == 0 || strcmp(pathname, "/dev/tts/0") == 0)
{
if (getConfig()->emulateDriveboard == 0 && getConfig()->emulateRideboard == 0 && getConfig()->emulateCardreader == 0)
if (getConfig()->emulateDriveboard == 0 && getConfig()->emulateRideboard == 0 && getConfig()->emulateCardreader == 0 &&
getConfig()->emulateTouchscreen == 0)
return _open(getConfig()->serial1Path, flags, mode);
if (hooks[SERIAL0] != -1 && getConfig()->emulateCardreader && getConfig()->crc32 != R_TUNED)
if (hooks[SERIAL0] != -1 && getConfig()->emulateCardreader && gId != R_TUNED)
{
return hooks[SERIAL0];
}
@@ -328,7 +386,7 @@ int open(const char *pathname, int flags, ...)
hooks[SERIAL0] = _open(HOOK_FILE_NAME, flags, mode);
printf("Warning: SERIAL0 Opened %d\n", hooks[SERIAL0]);
if (getConfig()->emulateCardreader == 1 && getConfig()->crc32 != R_TUNED)
if (getConfig()->emulateCardreader == 1 && gId != R_TUNED)
cardReaderSetFd(0, hooks[SERIAL0], getConfig()->cardFile1);
return hooks[SERIAL0];
@@ -339,7 +397,7 @@ int open(const char *pathname, int flags, ...)
if (getConfig()->emulateDriveboard == 0 && getConfig()->emulateMotionboard == 0 && getConfig()->emulateCardreader == 0)
return _open(getConfig()->serial2Path, flags, mode);
if (hooks[SERIAL1] != -1 && getConfig()->emulateCardreader && getConfig()->crc32 != R_TUNED)
if (hooks[SERIAL1] != -1 && getConfig()->emulateCardreader && gId != R_TUNED)
{
return hooks[SERIAL1];
}
@@ -393,6 +451,11 @@ FILE *fopen(const char *restrict pathname, const char *restrict mode)
{
FILE *(*_fopen)(const char *restrict pathname, const char *restrict mode) = dlsym(RTLD_NEXT, "fopen");
if (strcmp(pathname, "/proc/net/route") == 0)
{
return NULL;
}
if (strcmp(pathname, "/root/lindbergrc") == 0)
{
return _fopen("lindbergrc", mode);
@@ -515,13 +578,6 @@ FILE *fopen(const char *restrict pathname, const char *restrict mode)
return 0;
}
if (strcmp("./../fs/data/cse_credit.bnk", pathname) == 0)
{
void *addr = __builtin_return_address(0);
fileHooks[FILE_HARLEY] = _fopen(pathname, mode);
return fileHooks[FILE_HARLEY];
}
if (cachedShaderFilesLoaded)
{
void *addr = __builtin_return_address(0);
@@ -554,15 +610,35 @@ FILE *fopen(const char *restrict pathname, const char *restrict mode)
}
}
int gId = getConfig()->crc32;
if (gId == INITIALD_5_EXP || gId == INITIALD_5_EXP_20 || gId == INITIALD_5_EXP_20A || gId == INITIALD_5_JAP_REVA || gId == INITIALD_5_JAP_REVF)
switch (gId)
{
case INITIALD_5_EXP:
case INITIALD_5_EXP_20:
case INITIALD_5_EXP_20A:
case INITIALD_5_JAP_REVA:
case INITIALD_5_JAP_REVF:
if (strncmp(pathname, "/tmp/", 5) == 0)
{
return fopen(pathname + 1, mode);
}
}
if (gId == PRIMEVAL_HUNT)
{
if (strstr(pathname, "/data/lua/texture/start_stage") != NULL)
phShowCursorInGame = true;
else if (strstr(pathname, "/data/texture/weapon_select/") != NULL)
phShowCursorInGame = false;
else if (strstr(pathname, "/data/texture/stage_select/") != NULL)
phShowCursorInGame = false;
else if (strstr(pathname, "/data/texture/name_entry/") != NULL)
phShowCursorInGame = false;
else if (strstr(pathname, "/data/texture/game_end/") != NULL)
phShowCursorInGame = false;
else if (strstr(pathname, "/data/lua/stage/bonus_0") != NULL)
phShowCursorInGame = true;
}
// printf("Path= %s\n", pathname);
return _fopen(pathname, mode);
@@ -636,28 +712,31 @@ FILE *fopen64(const char *pathname, const char *mode)
}
}
if ((getConfig()->crc32 == HUMMER) || (getConfig()->crc32 == HUMMER_SDLX) ||
(getConfig()->crc32 == HUMMER_EXTREME) || (getConfig()->crc32 == HUMMER_EXTREME_MDX))
int idx;
switch (gId)
{
int idx;
case HUMMER:
case HUMMER_SDLX:
case HUMMER_EXTREME:
case HUMMER_EXTREME_MDX:
if (shaderFileInList(pathname, &idx))
{
hummerExtremeShaderFileIndex = idx;
}
}
if ((getConfig()->crc32 == VIRTUA_FIGHTER_5_FINAL_SHOWDOWN_REVA || getConfig()->crc32 == VIRTUA_FIGHTER_5_FINAL_SHOWDOWN_REVB ||
getConfig()->crc32 == VIRTUA_FIGHTER_5_FINAL_SHOWDOWN_REVB_6000) &&
(getConfig()->GPUVendor != NVIDIA_GPU && getConfig()->GPUVendor != ATI_GPU))
{
char *filename = basename((char *)pathname);
if (strstr(filename, "light_") || strstr(filename, "glow_"))
break;
case VIRTUA_FIGHTER_5_FINAL_SHOWDOWN_REVA:
case VIRTUA_FIGHTER_5_FINAL_SHOWDOWN_REVB:
case VIRTUA_FIGHTER_5_FINAL_SHOWDOWN_REVB_6000:
if (getConfig()->GPUVendor != NVIDIA_GPU && getConfig()->GPUVendor != ATI_GPU)
{
printf("Stage: %s\n", filename);
char *start = strchr(filename, '_') + 1;
char *end = strstr(filename, ".txt");
strncpy(vf5StageNameAbbr, start, end - start);
vf5StageNameAbbr[end - start] = '\0';
char *filename = basename((char *)pathname);
if (strstr(filename, "light_") || strstr(filename, "glow_"))
{
char *start = strchr(filename, '_') + 1;
char *end = strstr(filename, ".txt");
strncpy(vf5StageNameAbbr, start, end - start);
vf5StageNameAbbr[end - start] = '\0';
}
}
}
@@ -785,6 +864,11 @@ ssize_t read(int fd, void *buf, size_t count)
// If we don't hook the serial just reply with nothing
if (fd == hooks[SERIAL0] || fd == hooks[SERIAL1])
{
if (gId == PRIMEVAL_HUNT && getConfig()->emulateTouchscreen == 1)
{
phRead(fd, buf, count);
return 1;
}
return -1;
}
@@ -817,10 +901,10 @@ size_t fread(void *buf, size_t size, size_t count, FILE *stream)
return freadReplace(buf, size, count, fileRead[FILE_RW2]);
}
if (stream == fileHooks[FILE_HARLEY])
{
return harleyFreadReplace(buf, size, count, fileHooks[FILE_HARLEY]);
}
// if (stream == fileHooks[FILE_HARLEY])
// {
// return harleyFreadReplace(buf, size, count, fileHooks[FILE_HARLEY]);
// }
if (stream == fileHooks[FILE_FONT_ABC])
{
@@ -926,7 +1010,7 @@ ssize_t write(int fd, const void *buf, size_t count)
return driveboardWrite(fd, buf, count);
}
if (fd == hooks[SERIAL1] && getConfig()->emulateDriveboard && getConfig()->crc32 != R_TUNED)
if (fd == hooks[SERIAL1] && getConfig()->emulateDriveboard && gId != R_TUNED)
{
return driveboardWrite(fd, buf, count);
}
@@ -960,10 +1044,9 @@ int ioctl(int fd, unsigned int request, void *data)
return baseboardIoctl(fd, request, data);
}
// Just accept any IOCTL on serial ports and ignore it
if (fd == hooks[SERIAL0] || fd == hooks[SERIAL1])
{
if (request == 0x541b && getConfig()->crc32 == R_TUNED && fd == hooks[SERIAL1])
if (request == 0x541b && gId == R_TUNED && fd == hooks[SERIAL1])
{
uint8_t d = 1;
memcpy(data, &d, sizeof(uint8_t));
@@ -1232,26 +1315,40 @@ int setenv(const char *name, const char *value, int overwrite)
char *getenv(const char *name)
{
char *(*_getenv)(const char *name) = dlsym(RTLD_NEXT, "getenv");
int gId = getConfig()->crc32;
if ((strcmp(name, "TEA_DIR") == 0) &&
((gId == VIRTUA_TENNIS_3) || (gId == VIRTUA_TENNIS_3_TEST) || (gId == VIRTUA_TENNIS_3_REVA) ||
(gId == VIRTUA_TENNIS_3_REVA_TEST) || (gId == VIRTUA_TENNIS_3_REVB) || (gId == VIRTUA_TENNIS_3_REVB_TEST) ||
(gId == VIRTUA_TENNIS_3_REVC) || (gId == VIRTUA_TENNIS_3_REVC_TEST) || ((gId == RAMBO)) || (gId == TOO_SPICY)))
if (strcmp(name, "TEA_DIR") == 0)
{
if (getcwd(envpath, 100) == NULL)
return "";
char *ptr = strrchr(envpath, '/');
if (ptr == NULL)
return "";
*ptr = '\0';
return envpath;
}
else if (strcmp(name, "TEA_DIR") == 0)
{
if (getcwd(envpath, 100) == NULL)
return "";
return envpath;
switch (gId)
{
case VIRTUA_TENNIS_3:
case VIRTUA_TENNIS_3_TEST:
case VIRTUA_TENNIS_3_REVA:
case VIRTUA_TENNIS_3_REVA_TEST:
case VIRTUA_TENNIS_3_REVB:
case VIRTUA_TENNIS_3_REVB_TEST:
case VIRTUA_TENNIS_3_REVC:
case VIRTUA_TENNIS_3_REVC_TEST:
case RAMBO:
case TOO_SPICY:
{
if (getcwd(envpath, 100) == NULL)
return "";
char *ptr = strrchr(envpath, '/');
if (ptr == NULL)
return "";
*ptr = '\0';
return envpath;
}
break;
default:
{
if (getcwd(envpath, 100) == NULL)
return "";
return envpath;
}
}
}
if (strcmp(name, "__GL_SYNC_TO_VBLANK") == 0)
{
return "";
@@ -1292,7 +1389,7 @@ struct tm *localtime_r(const time_t *timep, struct tm *result)
struct tm *(*_localtime_r)(const time_t *, struct tm *) =
(struct tm * (*)(const time_t *, struct tm *)) dlsym(RTLD_NEXT, "localtime_r");
if ((getConfig()->crc32 == MJ4_REVG || getConfig()->crc32 == MJ4_EVO) && getConfig()->mj4EnabledAtT == 1)
if ((gId == MJ4_REVG || gId == MJ4_EVO) && getConfig()->mj4EnabledAtT == 1)
{
time_t target_time = 1735286445;
struct tm *res = _localtime_r(&target_time, result);
+149 -22
View File
@@ -1,11 +1,15 @@
#ifndef __i386__
#define __i386__
#include "customcursor.h"
#endif
#undef __x86_64__
#include <SDL2/SDL.h>
#include "jvs.h"
#include "config.h"
#include "customcursor.h"
#include "patch.h"
#include "touchscreen.h"
#include <GL/freeglut.h>
#include <GL/glx.h>
@@ -20,6 +24,12 @@
GameType gameType = SHOOTING;
int jvsAnalogueInBits = 10;
extern int phX, phY, phW, phH;
extern int phX2, phY2, phW2, phH2;
int phIsDragging = 0;
extern void *customCursor;
extern void *phTouchCursor;
extern bool phShowCursorInGame;
int initInput()
{
@@ -35,6 +45,105 @@ int initInput()
return 0;
}
void phTouchScreenCursor(int mX, int mY, int *motX, int *motY)
{
if (getConfig()->emulateTouchscreen)
{
switch (getConfig()->phMode)
{
case 0:
case 2:
case 3:
if ((mX >= phX2 && mX <= (phX2 + phW2) && mY >= phY2 && mY <= (phY2 + phH2)) && getConfig()->hideCursor == 0)
{
setCursor(phTouchCursor);
showPhCursor();
}
else if (getConfig()->hideCursor == 1 || phShowCursorInGame == false)
{
hideCursor();
}
else if (phShowCursorInGame && getConfig()->hideCursor == 0)
{
setCursor(customCursor);
showCursor();
}
break;
case 4:
if ((mX >= phX2 && mX <= (phX2 + phW2) && mY >= (phY2 + phH) && mY <= (phY2 + (phH2 + phH))) && getConfig()->hideCursor == 0)
{
setCursor(phTouchCursor);
showPhCursor();
}
else if (getConfig()->hideCursor == 1 || phShowCursorInGame == false)
{
hideCursor();
}
else if (phShowCursorInGame && getConfig()->hideCursor == 0)
{
setCursor(customCursor);
showCursor();
}
}
}
if (mX < phX)
*motX = phX;
if (mX > (phW + phX))
*motX = (phW + phX) - 1;
if (mY > phH + phY)
*motY = (phH + phY) - 1;
if (mY < phY)
*motY = phY;
}
void phTouchClick(int mX, int mY, int type)
{
int x, y;
bool insideTouchScreen = false;
switch (getConfig()->phMode)
{
case 0:
case 2:
case 3:
if (mX >= phX2 && mX <= (phX2 + phW2) && mY >= phY2 && mY <= (phY2 + phH2))
{
x = mX - phW;
y = mY - phY2;
insideTouchScreen = true;
}
break;
case 4:
if (mX >= phX2 && mX <= (phX2 + phW2) && mY >= (phY2 + phH) && mY <= (phY2 + (phH2 + phH)))
{
x = mX - phX2;
y = mY - phH;
insideTouchScreen = true;
}
}
if (insideTouchScreen)
{
if (type == ButtonPress)
phCoordinates(x, y, phW2, phH2, ButtonPress);
else if (type == SDL_MOUSEBUTTONDOWN)
phCoordinates(x, y, phW2, phH2, SDL_MOUSEBUTTONDOWN);
else if (type == ButtonRelease)
phCoordinates(x, y, phW2, phH2, ButtonRelease);
else if (type == SDL_MOUSEBUTTONUP)
phCoordinates(x, y, phW2, phH2, SDL_MOUSEBUTTONUP);
else if (type == MotionNotify)
phCoordinates(x, y, phW2, phH2, MotionNotify);
else if (type == SDL_MOUSEMOTION)
phCoordinates(x, y, phW2, phH2, SDL_MOUSEMOTION);
}
else
{
if (getConfig()->noSDL)
setSwitch(PLAYER_1, BUTTON_1, type == ButtonPress);
else
setSwitch(PLAYER_1, BUTTON_1, type == SDL_MOUSEBUTTONDOWN);
}
}
/**
* Button mapping used for driving games
*/
@@ -281,16 +390,15 @@ int XNextEventShooting(Display *display, XEvent *event_return, int returnValue)
{
int mX = event_return->xmotion.x;
int mY = event_return->xmotion.y;
if (mX < phX)
mX = phX;
if (mX > (phW + phX))
mX = (phW + phX) - 1;
if (mY > phH + phY)
mY = (phH + phY) - 1;
if (mY < phY)
mY = phY;
setAnalogue(ANALOGUE_1, ((double)(mX - phX) / (double)phW) * pow(2, jvsAnalogueInBits));
setAnalogue(ANALOGUE_2, ((double)(mY - phY) / (double)phH) * pow(2, jvsAnalogueInBits));
if (phIsDragging)
phTouchClick(mX, mY, event_return->type);
int motX = mX, motY = mY;
phTouchScreenCursor(mX, mY, &motX, &motY);
setAnalogue(ANALOGUE_1, ((double)(motX - phX) / (double)phW) * pow(2, jvsAnalogueInBits));
setAnalogue(ANALOGUE_2, ((double)(motY - phY) / (double)phH) * pow(2, jvsAnalogueInBits));
}
else
{
@@ -335,7 +443,17 @@ int XNextEventShooting(Display *display, XEvent *event_return, int returnValue)
{
if (event_return->xbutton.button == 1) // Trigger
{
setSwitch(PLAYER_1, BUTTON_1, event_return->type == ButtonPress);
if (getConfig()->crc32 == PRIMEVAL_HUNT && getConfig()->emulateTouchscreen)
{
int mX = event_return->xmotion.x;
int mY = event_return->xmotion.y;
phTouchClick(mX, mY, event_return->type);
phIsDragging = (event_return->type == ButtonPress ? 1 : 0);
}
else
{
setSwitch(PLAYER_1, BUTTON_1, event_return->type == ButtonPress);
}
}
else if (event_return->xbutton.button == 3) // Reload
{
@@ -534,16 +652,15 @@ void sdlEventShooting(SDL_Event *event)
{
int mX = event->motion.x;
int mY = event->motion.y;
if (mX < phX)
mX = phX;
if (mX > (phW + phX))
mX = (phW + phX) - 1;
if (mY > phH + phY)
mY = (phH + phY) - 1;
if (mY < phY)
mY = phY;
setAnalogue(ANALOGUE_1, ((double)(mX - phX) / (double)phW) * pow(2, jvsAnalogueInBits));
setAnalogue(ANALOGUE_2, ((double)(mY - phY) / (double)phH) * pow(2, jvsAnalogueInBits));
if (phIsDragging)
phTouchClick(mX, mY, event->type);
int motX = mX, motY = mY;
phTouchScreenCursor(mX, mY, &motX, &motY);
setAnalogue(ANALOGUE_1, ((double)(motX - phX) / (double)phW) * pow(2, jvsAnalogueInBits));
setAnalogue(ANALOGUE_2, ((double)(motY - phY) / (double)phH) * pow(2, jvsAnalogueInBits));
}
else
{
@@ -587,7 +704,17 @@ void sdlEventShooting(SDL_Event *event)
{
if (event->button.button == SDL_BUTTON_LEFT) // Trigger
{
setSwitch(PLAYER_1, BUTTON_1, event->type == SDL_MOUSEBUTTONDOWN);
if (getConfig()->crc32 == PRIMEVAL_HUNT && getConfig()->emulateTouchscreen)
{
int mX = event->motion.x;
int mY = event->motion.y;
phTouchClick(mX, mY, event->type);
phIsDragging = (event->type == SDL_MOUSEBUTTONDOWN ? 1 : 0);
}
else
{
setSwitch(PLAYER_1, BUTTON_1, event->type == SDL_MOUSEBUTTONDOWN);
}
}
else if (event->button.button == SDL_BUTTON_RIGHT) // Reload
{
+28 -11
View File
@@ -85,6 +85,7 @@ uint32_t cleanElfCRC32[] = {
0x9BFD0D98, // DVP-0019D | id4.elf
0x9CF9BBCC, // DVP-0019G | id4.elf
0xFA0F6AB0, // DVP-0027A | apacheM.elf
0x5A7F315E, // DVP-0027A | apachetestM.elf
0x9D414D18, // DVP-0029A | vsg
0xC345E213, // DVP-0030B | id4.elf
0x98E6A516, // DVP-0030C | id4.elf
@@ -182,6 +183,7 @@ void isCleanElf(char *command)
printf("\033[1;31m");
printf("Warning: The ELF you are running is not Clean and might cause unwanted behavior.\n");
printf(" Make sure you ELF and game dump are clean before reporting issues.\n");
printf(" If you are sure the ELF is clean, please report it to us.\n");
printf("\033[0m");
}
}
@@ -215,7 +217,7 @@ void testModePath(char *name)
if (strcmp(name, "./apacheM.elf") == 0)
{
strcpy(name, "./apacheTestM.elf");
strcpy(name, "./apachetestM.elf");
return;
}
@@ -233,7 +235,7 @@ void testModePath(char *name)
* Makes sure the environment variables are set correctly
* to run the game.
*/
void setEnvironmentVariables(int isFlatpak, int zink)
void setEnvironmentVariables(int isFlatpak, int zink, int nvidia)
{
// Ensure the library path is set correctly
char libraryPath[128] = {0};
@@ -254,9 +256,15 @@ void setEnvironmentVariables(int isFlatpak, int zink)
setenv(LD_PRELOAD, PRELOAD_FILE_NAME, 1);
else
setenv(LD_PRELOAD, PRELOAD_FILE_FLATPAK, 1);
if(zink)
if (zink)
setenv("MESA_LOADER_DRIVER_OVERRIDE", "zink", 1);
if (nvidia)
{
setenv("__GLX_VENDOR_LIBRARY_NAME", "nvidia", 1);
setenv("__NV_PRIME_RENDER_OFFLOAD", "1", 1);
}
}
/**
@@ -268,6 +276,8 @@ void printUsage(char *argv[])
printf("Options:\n");
printf(" --test | -t Runs the test mode\n");
printf(" --segaboot | -s Runs segaboot\n");
printf(" --zink | -z Runs with Zink\n");
printf(" --nvidia | -n Runs with nVidia GPU when is as a secondary GPU in a laptop\n");
printf(" --gdb Runs with GDB\n");
printf(" --list-controllers Lists available controllers and inputs\n");
printf(" --version Displays the version of the loader and team's names\n");
@@ -408,6 +418,7 @@ int main(int argc, char *argv[])
int testMode = 0;
int gdb = 0;
int zink = 0;
int nvidia = 0;
int forceGame = 0;
int segaboot = 0;
char extConfigPath[PATH_MAX] = {0};
@@ -433,19 +444,25 @@ int main(int argc, char *argv[])
continue;
}
if (strcmp(argv[i], "--zink") == 0)
if (strcmp(argv[i], "-z") == 0 || strcmp(argv[i], "--ziink") == 0)
{
zink = 1;
continue;
}
if (strcmp(argv[i], "-n") == 0 || strcmp(argv[i], "--nvidia") == 0)
{
nvidia = 1;
continue;
}
if (strcmp(argv[i], "-c") == 0 || strcmp(argv[i], "--config") == 0)
{
if (i+1 >= argc)
if (i + 1 >= argc)
{
break;
}
strncpy(extConfigPath, argv[i+1], PATH_MAX);
strncpy(extConfigPath, argv[i + 1], PATH_MAX);
i += 1;
continue;
}
@@ -455,8 +472,8 @@ int main(int argc, char *argv[])
}
// Ensure environment variables are set correctly
setEnvironmentVariables(isFlatpak, zink);
setEnvironmentVariables(isFlatpak, zink, nvidia);
char command[128] = {0};
strcpy(command, "./");
if (forceGame)
@@ -492,7 +509,7 @@ int main(int argc, char *argv[])
if (extConfigPath[0] != '\0')
{
setenv(LINDBERGH_CONFIG_PATH,extConfigPath,1);
setenv(LINDBERGH_CONFIG_PATH, extConfigPath, 1);
}
log_info("Starting $ %s", command);
+214 -211
View File
@@ -1,13 +1,11 @@
#ifndef _GNU_SOURCE
#define _GNU_SOURCE
#include <SDL2/SDL_events.h>
#endif
#include <time.h>
#define GL_GLEXT_PROTOTYPES
#include "patch.h"
#include <GL/glx.h>
#include <SDL2/SDL.h>
#include <dlfcn.h>
#include <stdarg.h>
@@ -24,13 +22,19 @@
#include "shader_patches.h"
#include "glxhooks.h"
#include "log.h"
#include "customcursor.h"
extern uint32_t gId;
char elfID[4];
void *amDipswContextAddr;
extern void *glVertex3fPatchRetAddrABC[4];
extern void *glVertex3fNoPatchRetAddrABC[4];
void *hod4CursorHideShowCAVEAddress;
extern void *customCursor;
extern void *phTouchCursor;
extern void *blankCursor;
void setVariable(size_t address, size_t value)
{
int pagesize = sysconf(_SC_PAGE_SIZE);
@@ -175,7 +179,6 @@ int amDongleUpdate()
int amDongleUserInfoEx(int a, int b, char *_arcadeContext)
{
uint32_t gId = getConfig()->crc32;
char *gameID;
switch (gId)
{
@@ -322,9 +325,8 @@ int or2snprintf(char *s, size_t n, const char *format, ...)
return ret;
}
// printf hook, used by OR2
int patchedPrintf(char *format,...)
int patchedPrintf(char *format, ...)
{
if (format == NULL)
return 0;
@@ -370,7 +372,7 @@ void hod4CursorHideShow(int param1)
{
if (hod4PrevValue != 3 || hod4InTutorial)
{
SDL_ShowCursor(SDL_DISABLE);
hideCursor();
}
hod4PrevValue = 0;
}
@@ -379,7 +381,7 @@ void hod4CursorHideShow(int param1)
{
if (!hod4InTutorial)
{
SDL_ShowCursor(SDL_ENABLE);
showCursor();
hod4PrevValue = 3;
}
}
@@ -392,7 +394,7 @@ void hod4CursorHideShow(int param1)
case 5:
case 11:
{
SDL_ShowCursor(SDL_DISABLE);
hideCursor();
}
}
}
@@ -421,8 +423,9 @@ int hod4VsPrintf(char *str, const char *format, va_list arg)
int initPatch()
{
EmulatorConfig *config = getConfig();
int GPUVendor = getConfig()->GPUVendor;
switch (config->crc32)
switch (gId)
{
case AFTER_BURNER_CLIMAX: // DVP-0009
{
@@ -440,7 +443,7 @@ int initPatch()
detourFunction(0x081e2a9c, amDipswInit);
detourFunction(0x081e2b38, amDipswExit);
if (getConfig()->GPUVendor != NVIDIA_GPU)
if (GPUVendor != NVIDIA_GPU)
{
detourFunction(0x0804e1e4, gl_ProgramStringARB);
}
@@ -462,7 +465,7 @@ int initPatch()
detourFunction(0x081e31e4, amDipswInit);
detourFunction(0x081e3280, amDipswExit);
if (getConfig()->GPUVendor != NVIDIA_GPU)
if (GPUVendor != NVIDIA_GPU)
{
detourFunction(0x0804e1e4, gl_ProgramStringARB);
}
@@ -484,7 +487,7 @@ int initPatch()
detourFunction(0x081e3248, amDipswInit);
detourFunction(0x081e32e4, amDipswExit);
if (getConfig()->GPUVendor != NVIDIA_GPU)
if (GPUVendor != NVIDIA_GPU)
{
detourFunction(0x0804e1ec, gl_ProgramStringARB);
}
@@ -505,7 +508,7 @@ int initPatch()
detourFunction(0x081e47a4, amDipswInit);
detourFunction(0x081e4840, amDipswExit);
if (getConfig()->GPUVendor != NVIDIA_GPU)
if (GPUVendor != NVIDIA_GPU)
{
detourFunction(0x0804e244, gl_ProgramStringARB);
}
@@ -527,7 +530,7 @@ int initPatch()
detourFunction(0x081e478c, amDipswInit);
detourFunction(0x081e4828, amDipswExit);
if (getConfig()->GPUVendor != NVIDIA_GPU)
if (GPUVendor != NVIDIA_GPU)
{
detourFunction(0x0804e24c, gl_ProgramStringARB);
}
@@ -549,7 +552,7 @@ int initPatch()
detourFunction(0x081e3294, amDipswInit);
detourFunction(0x081e3330, amDipswExit);
if (getConfig()->GPUVendor != NVIDIA_GPU)
if (GPUVendor != NVIDIA_GPU)
{
detourFunction(0x0804e1e4, gl_ProgramStringARB);
}
@@ -571,7 +574,7 @@ int initPatch()
detourFunction(0x081e327c, amDipswInit);
detourFunction(0x081e3318, amDipswExit);
if (getConfig()->GPUVendor != NVIDIA_GPU)
if (GPUVendor != NVIDIA_GPU)
{
detourFunction(0x0804e1ec, gl_ProgramStringARB);
}
@@ -601,7 +604,7 @@ int initPatch()
detourFunction(0x080e7f94, stubRetZero);
cacheModedShaderFiles();
if (getConfig()->GPUVendor != NVIDIA_GPU)
if (GPUVendor != NVIDIA_GPU)
{
gsEvoElfShaderPatcher();
detourFunction(0x0804c334, gl_ProgramStringARB);
@@ -623,7 +626,7 @@ int initPatch()
detourFunction(0x08394825, amDipswGetData);
detourFunction(0x08395da5, amDongleUserInfoEx);
if (getConfig()->GPUVendor != NVIDIA_GPU)
if (GPUVendor != NVIDIA_GPU)
{
cacheModedShaderFiles();
loadLibCg();
@@ -910,7 +913,7 @@ int initPatch()
setVariable(0x0857f0e9, 0x000126e9); // Avoid Full Screen set from Game
patchMemory(0x087bc56c, "ab"); // Skips initialization
if (getConfig()->GPUVendor != NVIDIA_GPU)
if (GPUVendor != NVIDIA_GPU)
{
detourFunction(0x08078860, gl_MultiTexCoord2fARB);
detourFunction(0x080788d0, gl_Color4ub);
@@ -965,7 +968,7 @@ int initPatch()
setVariable(0x0857ee69, 0x000126e9); // Avoid Full Screen set from Game
patchMemory(0x087bc2ec, "eb"); // Skips initialization
if (getConfig()->GPUVendor != NVIDIA_GPU)
if (GPUVendor != NVIDIA_GPU)
{
detourFunction(0x08078860, gl_MultiTexCoord2fARB);
detourFunction(0x080788d0, gl_Color4ub);
@@ -1020,7 +1023,7 @@ int initPatch()
setVariable(0x08580979, 0x000126e9); // Avoid Full Screen set from Game
patchMemory(0x087beb6c, "5b"); // Skips initialization
if (getConfig()->GPUVendor != NVIDIA_GPU)
if (GPUVendor != NVIDIA_GPU)
{
detourFunction(0x080788ec, gl_MultiTexCoord2fARB);
detourFunction(0x0807895c, gl_Color4ub);
@@ -1076,7 +1079,7 @@ int initPatch()
patchMemory(0x08799adc, "df"); // Skips initialization
setVariable(0x085593c9, 0x000126e9); // Avoid Full Screen set from Game
if (getConfig()->GPUVendor != NVIDIA_GPU)
if (GPUVendor != NVIDIA_GPU)
{
detourFunction(0x08078980, gl_MultiTexCoord2fARB);
detourFunction(0x080789f0, gl_Color4ub);
@@ -1132,7 +1135,7 @@ int initPatch()
patchMemory(0x08799d9c, "cf"); // Skips initialization
setVariable(0x08559609, 0x000126e9); // Avoid Full Screen set from Game
if (getConfig()->GPUVendor != NVIDIA_GPU)
if (GPUVendor != NVIDIA_GPU)
{
detourFunction(0x080789a4, gl_MultiTexCoord2fARB);
detourFunction(0x08078a14, gl_Color4ub);
@@ -1188,7 +1191,7 @@ int initPatch()
patchMemory(0x087a2efc, "ff"); // Skips initialization
setVariable(0x08561e79, 0x000126e9); // Avoid Full Screen set from Game
if (getConfig()->GPUVendor != NVIDIA_GPU)
if (GPUVendor != NVIDIA_GPU)
{
detourFunction(0x080789a4, gl_MultiTexCoord2fARB);
detourFunction(0x08078a14, gl_Color4ub);
@@ -1244,7 +1247,7 @@ int initPatch()
patchMemory(0x087a025c, "6f"); // Skips initialization
setVariable(0x0855f519, 0x000126e9); // Avoid Full Screen set from Game
if (getConfig()->GPUVendor != NVIDIA_GPU)
if (GPUVendor != NVIDIA_GPU)
{
detourFunction(0x080789a4, gl_MultiTexCoord2fARB);
detourFunction(0x08078a14, gl_Color4ub);
@@ -1300,7 +1303,7 @@ int initPatch()
patchMemory(0x087e9ebc, "3f36"); // Skips initialization
setVariable(0x08599819, 0x000126e9); // Avoid Full Screen set from Game
if (getConfig()->GPUVendor != NVIDIA_GPU)
if (GPUVendor != NVIDIA_GPU)
{
detourFunction(0x0807a298, gl_MultiTexCoord2fARB);
detourFunction(0x0807a308, gl_Color4ub);
@@ -1358,7 +1361,7 @@ int initPatch()
patchMemory(0x08789a49, "e92601000090"); // Prevents Full Screen set from the game
// Mesa Patches
if (getConfig()->GPUVendor != NVIDIA_GPU)
if (GPUVendor != NVIDIA_GPU)
{
detourFunction(0x0807a3f0, gl_MultiTexCoord2fARB);
detourFunction(0x0807a470, gl_Color4ub);
@@ -1424,7 +1427,7 @@ int initPatch()
detourFunction(0x089382e0, stubRetZero); // Eliminates amsInit Function
// Mesa Patches
if (getConfig()->GPUVendor != NVIDIA_GPU)
if (GPUVendor != NVIDIA_GPU)
{
detourFunction(0x0807a6c0, gl_MultiTexCoord2fARB);
detourFunction(0x0807a740, gl_Color4ub);
@@ -1490,7 +1493,7 @@ int initPatch()
detourFunction(0x08938530, stubRetZero); // Eliminates amsInit Function
// Mesa Patches
if (getConfig()->GPUVendor != NVIDIA_GPU)
if (GPUVendor != NVIDIA_GPU)
{
detourFunction(0x0807a6c0, gl_MultiTexCoord2fARB);
detourFunction(0x0807a740, gl_Color4ub);
@@ -1548,7 +1551,7 @@ int initPatch()
patchMemory(0x08441f99, "eb60"); // tickInitAddress
// Mesa Patches
if (getConfig()->GPUVendor != NVIDIA_GPU)
if (GPUVendor != NVIDIA_GPU)
{
detourFunction(0x0807a3f0, gl_MultiTexCoord2fARB);
detourFunction(0x0807a470, gl_Color4ub);
@@ -1613,7 +1616,7 @@ int initPatch()
detourFunction(0x0850fba0, stubRetZero); // isUseServerBox
// Mesa Patches
if (getConfig()->GPUVendor != NVIDIA_GPU)
if (GPUVendor != NVIDIA_GPU)
{
detourFunction(0x0807a42c, gl_MultiTexCoord2fARB);
detourFunction(0x0807a4ac, gl_Color4ub);
@@ -1629,54 +1632,6 @@ int initPatch()
patchMemory(0x0875e1ae, "00"); // Fix cutscenes
}
break;
case LETS_GO_JUNGLE_REVA:
{
if (config->showDebugMessages == 1)
{
setVariable(0x08c10604, 2); // amBackupDebugLevel
setVariable(0x08c10620, 2); // amCreditDebugLevel
setVariable(0x08c10878, 2); // amDipswDebugLevel
setVariable(0x08c1087c, 2); // amDongleDebugLevel
setVariable(0x08c10880, 2); // amEepromDebugLevel
setVariable(0x08c10884, 2); // amHwmonitorDebugLevel
setVariable(0x08c10888, 2); // amJvsDebugLevel
setVariable(0x08c1088c, 2); // amLibDebugLevel
setVariable(0x08c10890, 2); // amMiscDebugLevel
setVariable(0x08c10898, 2); // amSysDataDebugLevel
setVariable(0x08c108a0, 2); // bcLibDebugLevel
setVariable(0x08c10894, 2); // amOsinfoDebugLevel
setVariable(0x08c108a4, 0x0FFFFFFF); // s_logMask
detourFunction(0x08074a8c, _putConsole); // Debug Messages
}
// Security
detourFunction(0x084e9fbc, amDongleInit);
detourFunction(0x084ea378, amDongleIsAvailable);
detourFunction(0x084ea29c, amDongleUpdate);
patchMemory(0x0807b86a, "9090"); // Patch initializeArcadeBackup
// Fixes
amDipswContextAddr = (void *)0x08c43e08; // Address of amDipswContext
detourFunction(0x084e9de0, amDipswInit);
detourFunction(0x084e9e7c, amDipswExit);
detourFunction(0x084e9ef2, amDipswGetData);
detourFunction(0x084e9f6a, amDipswSetLed);
patchMemory(0x084125f0, "9090"); // No full screen
// Mesa Patches
if (getConfig()->GPUVendor != NVIDIA_GPU || getConfig()->lgjRenderWithMesa)
{
detourFunction(0x08071790, gl_MultiTexCoord2fARB);
detourFunction(0x08071800, gl_Color4ub);
detourFunction(0x08071a30, gl_Vertex3f);
detourFunction(0x08072080, gl_TexCoord2f);
detourFunction(0x08072110, cg_GLIsProfileSupported);
detourFunction(0x08071e50, gl_ProgramStringARB);
cacheModedShaderFiles();
}
detourFunction(0x080722e0, gl_ProgramParameters4fvNV);
// patchMemory(0x083f4626, "909090909090");
detourFunction(0x08072520, gl_XGetProcAddressARB);
}
break;
case LETS_GO_JUNGLE:
{
if (config->showDebugMessages == 1)
@@ -1710,7 +1665,7 @@ int initPatch()
patchMemory(0x0840d858, "9090"); // No full screen
// Mesa Patches
if (getConfig()->GPUVendor != NVIDIA_GPU || getConfig()->lgjRenderWithMesa)
if (GPUVendor != NVIDIA_GPU || getConfig()->lgjRenderWithMesa)
{
detourFunction(0x080716e4, gl_MultiTexCoord2fARB);
detourFunction(0x08071754, gl_Color4ub);
@@ -1725,6 +1680,54 @@ int initPatch()
detourFunction(0x08072454, gl_XGetProcAddressARB);
}
break;
case LETS_GO_JUNGLE_REVA:
{
if (config->showDebugMessages == 1)
{
setVariable(0x08c10604, 2); // amBackupDebugLevel
setVariable(0x08c10620, 2); // amCreditDebugLevel
setVariable(0x08c10878, 2); // amDipswDebugLevel
setVariable(0x08c1087c, 2); // amDongleDebugLevel
setVariable(0x08c10880, 2); // amEepromDebugLevel
setVariable(0x08c10884, 2); // amHwmonitorDebugLevel
setVariable(0x08c10888, 2); // amJvsDebugLevel
setVariable(0x08c1088c, 2); // amLibDebugLevel
setVariable(0x08c10890, 2); // amMiscDebugLevel
setVariable(0x08c10898, 2); // amSysDataDebugLevel
setVariable(0x08c108a0, 2); // bcLibDebugLevel
setVariable(0x08c10894, 2); // amOsinfoDebugLevel
setVariable(0x08c108a4, 0x0FFFFFFF); // s_logMask
detourFunction(0x08074a8c, _putConsole); // Debug Messages
}
// Security
detourFunction(0x084e9fbc, amDongleInit);
detourFunction(0x084ea378, amDongleIsAvailable);
detourFunction(0x084ea29c, amDongleUpdate);
patchMemory(0x0807b86a, "9090"); // Patch initializeArcadeBackup
// Fixes
amDipswContextAddr = (void *)0x08c43e08; // Address of amDipswContext
detourFunction(0x084e9de0, amDipswInit);
detourFunction(0x084e9e7c, amDipswExit);
detourFunction(0x084e9ef2, amDipswGetData);
detourFunction(0x084e9f6a, amDipswSetLed);
patchMemory(0x084125f0, "9090"); // No full screen
// Mesa Patches
if (GPUVendor != NVIDIA_GPU || getConfig()->lgjRenderWithMesa)
{
detourFunction(0x08071790, gl_MultiTexCoord2fARB);
detourFunction(0x08071800, gl_Color4ub);
detourFunction(0x08071a30, gl_Vertex3f);
detourFunction(0x08072080, gl_TexCoord2f);
detourFunction(0x08072110, cg_GLIsProfileSupported);
detourFunction(0x08071e50, gl_ProgramStringARB);
cacheModedShaderFiles();
}
detourFunction(0x080722e0, gl_ProgramParameters4fvNV);
// patchMemory(0x083f4626, "909090909090");
detourFunction(0x08072520, gl_XGetProcAddressARB);
}
break;
case LETS_GO_JUNGLE_SPECIAL:
{
if (config->showDebugMessages == 1)
@@ -1758,7 +1761,7 @@ int initPatch()
patchMemory(0x08438954, "9090"); // No full screen
// Mesa Patches
if (getConfig()->GPUVendor != NVIDIA_GPU || getConfig()->lgjRenderWithMesa)
if (GPUVendor != NVIDIA_GPU || getConfig()->lgjRenderWithMesa)
{
detourFunction(0x080718e0, gl_MultiTexCoord2fARB);
detourFunction(0x08071950, gl_Color4ub);
@@ -1773,6 +1776,32 @@ int initPatch()
detourFunction(0x080726c0, gl_XGetProcAddressARB);
}
break;
case MJ4_EVO:
{
detourFunction(0x08840b61, amDongleInit);
detourFunction(0x0883f3ed, amDongleIsAvailable);
detourFunction(0x0883f40a, amDongleIsDevelop);
detourFunction(0x0883ff0e, amDongleUpdate);
// Fixes and patches to bypss network check
amDipswContextAddr = (void *)0x0af8ff3c; // Address of amDipswContext
detourFunction(0x0883f180, amDipswInit);
detourFunction(0x0883f204, amDipswExit);
detourFunction(0x0883f279, amDipswGetData);
detourFunction(0x0883f2ef, amDipswSetLed);
patchMemory(0x080ea0d1, "909090909090");
detourFunction(0x080e327c, stubRetZero); // skip checks
detourFunction(0x080ee4fa, stubRetZero);
patchMemory(0x080ea0bf, "75");
patchMemory(0x08c035b8, "00");
if (GPUVendor != NVIDIA_GPU)
{
detourFunction(0x08051314, gl_ProgramStringARB);
}
}
break;
case MJ4_REVG:
{
setVariable(0x0acf85d4, 2);
@@ -1818,38 +1847,12 @@ int initPatch()
patchMemory(0x08732fd3, "2e2f00"); // Patch /home/disk2 folder
// Mesa Patches
if (getConfig()->GPUVendor != NVIDIA_GPU)
if (GPUVendor != NVIDIA_GPU)
{
detourFunction(0x08050ebc, gl_ProgramStringARB);
}
}
break;
case MJ4_EVO:
{
detourFunction(0x08840b61, amDongleInit);
detourFunction(0x0883f3ed, amDongleIsAvailable);
detourFunction(0x0883f40a, amDongleIsDevelop);
detourFunction(0x0883ff0e, amDongleUpdate);
// Fixes and patches to bypss network check
amDipswContextAddr = (void *)0x0af8ff3c; // Address of amDipswContext
detourFunction(0x0883f180, amDipswInit);
detourFunction(0x0883f204, amDipswExit);
detourFunction(0x0883f279, amDipswGetData);
detourFunction(0x0883f2ef, amDipswSetLed);
patchMemory(0x080ea0d1, "909090909090");
detourFunction(0x080e327c, stubRetZero); // skip checks
detourFunction(0x080ee4fa, stubRetZero);
patchMemory(0x080ea0bf, "75");
patchMemory(0x08c035b8, "00");
if (getConfig()->GPUVendor != NVIDIA_GPU)
{
detourFunction(0x08051314, gl_ProgramStringARB);
}
}
break;
case OUTRUN_2_SP_SDX:
{
if (config->showDebugMessages == 1)
@@ -1888,7 +1891,7 @@ int initPatch()
// Shader Patches
detourFunction(0x0804ca98, gl_ProgramStringARB);
if (getConfig()->GPUVendor != NVIDIA_GPU)
if (GPUVendor != NVIDIA_GPU)
{
detourFunction(0x0804cf38, glGenProgramsARB); // Replaces glGenProgramsNV
detourFunction(0x0804c548, gl_BindProgramNV); // Replaces glBindProgramNV
@@ -1906,26 +1909,6 @@ int initPatch()
detourFunction(0x0804d148, or2snprintf); // Fixes a bug in snprintf libc 2.39??
}
break;
case OUTRUN_2_SP_SDX_TEST:
{
// Security
detourFunction(0x08066204, amDongleInit);
detourFunction(0x08066585, amDongleIsAvailable);
detourFunction(0x080664a9, amDongleUpdate);
detourFunction(0x080665a5, amDongleIsDevelop);
// Fixes
amDipswContextAddr = (void *)0x080980e8; // Address of amDipswContext
detourFunction(0x08066028, amDipswInit);
detourFunction(0x080660c4, amDipswExit);
detourFunction(0x0806613a, amDipswGetData);
detourFunction(0x080661b2, amDipswSetLed); // Stub amDipswSetLed
detourFunction(0x08066028, amDipswInit);
// Patch to allow selection of all cabinet types
patchMemory(0x08054a88, "9090909090");
}
break;
case OUTRUN_2_SP_SDX_REVA:
{
if (config->showDebugMessages == 1)
@@ -1967,7 +1950,7 @@ int initPatch()
// Shader Patches
detourFunction(0x0804ca98, gl_ProgramStringARB);
if (getConfig()->GPUVendor != NVIDIA_GPU)
if (GPUVendor != NVIDIA_GPU)
{
detourFunction(0x0804cf38, glGenProgramsARB); // Replaces glGenProgramsNV
detourFunction(0x0804c548, gl_BindProgramNV); // Replaces glBindProgramNV
@@ -2014,6 +1997,26 @@ int initPatch()
patchMemory(0x08054ac4, "9090909090");
}
break;
case OUTRUN_2_SP_SDX_TEST:
{
// Security
detourFunction(0x08066204, amDongleInit);
detourFunction(0x08066585, amDongleIsAvailable);
detourFunction(0x080664a9, amDongleUpdate);
detourFunction(0x080665a5, amDongleIsDevelop);
// Fixes
amDipswContextAddr = (void *)0x080980e8; // Address of amDipswContext
detourFunction(0x08066028, amDipswInit);
detourFunction(0x080660c4, amDipswExit);
detourFunction(0x0806613a, amDipswGetData);
detourFunction(0x080661b2, amDipswSetLed); // Stub amDipswSetLed
detourFunction(0x08066028, amDipswInit);
// Patch to allow selection of all cabinet types
patchMemory(0x08054a88, "9090909090");
}
break;
case PRIMEVAL_HUNT:
{
// Security
@@ -2052,7 +2055,7 @@ int initPatch()
detourFunction(0x082c3103, amDipswSetLed);
cacheModedShaderFiles();
// Mesa Patches
if (getConfig()->GPUVendor != NVIDIA_GPU)
if (GPUVendor != NVIDIA_GPU)
{
loadLibCg();
cacheNnstdshader();
@@ -2087,7 +2090,7 @@ int initPatch()
patchMemory(0x838C498, "2e2f524f4d5f4c414e472f656e00"); // Patch /home/disk0 folder
// Mesa Patches
if (getConfig()->GPUVendor != NVIDIA_GPU)
if (GPUVendor != NVIDIA_GPU)
{
detourFunction(0x080507e8, gl_ProgramStringARB);
}
@@ -2143,7 +2146,7 @@ int initPatch()
srtvElfShaderPatcher();
// Mesa Patches
if (getConfig()->GPUVendor != NVIDIA_GPU)
if (GPUVendor != NVIDIA_GPU)
{
patchMemory(0x082d3ce9, "9090"); // Force GL_NVX_conditional_render
}
@@ -2406,22 +2409,6 @@ int initPatch()
}
}
break;
case THE_HOUSE_OF_THE_DEAD_4_SPECIAL_TEST:
{
detourFunction(0x0806e9ec, amDongleInit);
detourFunction(0x0806ecff, amDongleIsAvailable);
detourFunction(0x0806ec66, amDongleUpdate);
// Fixes
amDipswContextAddr = (void *)0x080b2e88; // Address of amDipswContext
detourFunction(0x0806e794, amDipswInit);
detourFunction(0x0806e829, amDipswExit);
detourFunction(0x0806e89f, amDipswGetData);
detourFunction(0x0806e917, amDipswSetLed);
// CPU patch to support AMD processors
patchMemory(0x08054bf0, "9090909090"); //__intel_new_proc_init_P
}
break;
case THE_HOUSE_OF_THE_DEAD_4_SPECIAL_REVB:
{
detourFunction(0x08363438, amDongleInit);
@@ -2464,6 +2451,22 @@ int initPatch()
patchMemory(0x08054820, "9090909090"); //__intel_new_proc_init_P
}
break;
case THE_HOUSE_OF_THE_DEAD_4_SPECIAL_TEST:
{
detourFunction(0x0806e9ec, amDongleInit);
detourFunction(0x0806ecff, amDongleIsAvailable);
detourFunction(0x0806ec66, amDongleUpdate);
// Fixes
amDipswContextAddr = (void *)0x080b2e88; // Address of amDipswContext
detourFunction(0x0806e794, amDipswInit);
detourFunction(0x0806e829, amDipswExit);
detourFunction(0x0806e89f, amDipswGetData);
detourFunction(0x0806e917, amDipswSetLed);
// CPU patch to support AMD processors
patchMemory(0x08054bf0, "9090909090"); //__intel_new_proc_init_P
}
break;
case THE_HOUSE_OF_THE_DEAD_EX:
{
detourFunction(0x084ba886, amDongleInit);
@@ -2482,7 +2485,7 @@ int initPatch()
patchMemory(0x0804e4a7, "9090909090"); //__intel_new_proc_init_P
// Mesa Patches
if (getConfig()->GPUVendor != NVIDIA_GPU)
if (GPUVendor != NVIDIA_GPU)
{
patchMemory(0x08503bfa, "6d657361"); // Rename compile folder to compmesa
cacheModedShaderFiles();
@@ -2528,6 +2531,7 @@ int initPatch()
patchMemory(0x08210f3c, "9090909090909090");
patchMemory(0x08210f45, "01");
patchMemory(0x08210f49, "909090");
patchMemory(0x082ef5d0, "9090909090");
// Fixes
amDipswContextAddr = (void *)0x0c8ed0cc;
detourFunction(0x08318f84, amDipswInit);
@@ -2543,7 +2547,7 @@ int initPatch()
detourFunction(0x081cbcd2, stubRetOne);
// Mesa Patches
if (getConfig()->GPUVendor != NVIDIA_GPU)
if (GPUVendor != NVIDIA_GPU)
{
loadLibCg();
cacheNnstdshader();
@@ -2607,7 +2611,7 @@ int initPatch()
patchMemory(0x080a36de, "9090909090");
patchMemory(0x080a35ed, "ffffffff");
patchMemory(0x080a3620, "ffffffff");
if (getConfig()->GPUVendor != NVIDIA_GPU)
if (GPUVendor != NVIDIA_GPU)
{
detourFunction(0x08051b9c, gl_ProgramStringARB);
}
@@ -2630,7 +2634,7 @@ int initPatch()
detourFunction(0x08094d28, stubRetZero);
patchMemory(0x080a29a5, "EB");
if (getConfig()->GPUVendor != NVIDIA_GPU)
if (GPUVendor != NVIDIA_GPU)
{
detourFunction(0x0805160c, gl_ProgramStringARB);
}
@@ -2661,11 +2665,11 @@ int initPatch()
patchMemory(0x88AB0C1, "2e2f666f6f3100"); // Patch /home/disk2 folder
patchMemory(0x88AB0D2, "2e2f666f6f3200"); // Patch /home/disk2 folder
patchMemory(0x89C8F24, "2e2f00"); // Patch /home/disk2 folder
if (getConfig()->GPUVendor != NVIDIA_GPU)
if (GPUVendor != NVIDIA_GPU)
{
detourFunction(0x08052aa4, gl_ProgramStringARB);
}
if (getConfig()->GPUVendor != NVIDIA_GPU || getConfig()->GPUVendor == ATI_GPU)
if (GPUVendor != NVIDIA_GPU || GPUVendor == ATI_GPU)
{
hookVf5FSExposure(0x08148279, 0x0814844a, 0x08148b42, 0x08148d52);
}
@@ -2696,11 +2700,11 @@ int initPatch()
patchMemory(0x88CACBD, "2e2f666f6f3100"); // Patch /home/disk2 folder
patchMemory(0x88CACCE, "2e2f666f6f3200"); // Patch /home/disk2 folder
patchMemory(0x89DE5AA, "2e2f00"); // Patch /home/disk2 folder
if (getConfig()->GPUVendor != NVIDIA_GPU)
if (GPUVendor != NVIDIA_GPU)
{
detourFunction(0x08052840, gl_ProgramStringARB);
}
if (getConfig()->GPUVendor != NVIDIA_GPU || getConfig()->GPUVendor == ATI_GPU)
if (GPUVendor != NVIDIA_GPU || GPUVendor == ATI_GPU)
{
hookVf5FSExposure(0x08148a47, 0x08148c18, 0x08149310, 0x08149520);
}
@@ -2732,11 +2736,11 @@ int initPatch()
patchMemory(0x88CD4AE, "2e2f666f6f3200"); // Patch /home/disk2 folder
patchMemory(0x89ED9C4, "2e2f00"); // Patch /home/disk2 folder
if (getConfig()->GPUVendor != NVIDIA_GPU)
if (GPUVendor != NVIDIA_GPU)
{
detourFunction(0x08052b20, gl_ProgramStringARB);
}
if (getConfig()->GPUVendor != NVIDIA_GPU || getConfig()->GPUVendor == ATI_GPU)
if (GPUVendor != NVIDIA_GPU || GPUVendor == ATI_GPU)
{
hookVf5FSExposure(0x081489f7, 0x08148bc8, 0x081492c0, 0x081494d0);
}
@@ -2769,7 +2773,7 @@ int initPatch()
patchMemory(0x0810030c, "ffffffff");
patchMemory(0x08100313, "ffffffff");
if (getConfig()->GPUVendor != NVIDIA_GPU)
if (GPUVendor != NVIDIA_GPU)
{
detourFunction(0x08052a68, gl_ProgramStringARB);
}
@@ -2802,7 +2806,7 @@ int initPatch()
patchMemory(0x08119204, "ffffffff");
patchMemory(0x0811920b, "ffffffff");
if (getConfig()->GPUVendor != NVIDIA_GPU)
if (GPUVendor != NVIDIA_GPU)
{
detourFunction(0x08052a84, gl_ProgramStringARB);
}
@@ -2835,7 +2839,7 @@ int initPatch()
patchMemory(0x08119384, "ffffffff");
patchMemory(0x0811938b, "ffffffff");
if (getConfig()->GPUVendor != NVIDIA_GPU)
if (GPUVendor != NVIDIA_GPU)
{
detourFunction(0x08052a70, gl_ProgramStringARB);
}
@@ -2873,7 +2877,7 @@ int initPatch()
patchMemory(0x080a6356, "9090909090");
patchMemory(0x080a6265, "ffffffff");
patchMemory(0x080a6298, "ffffffff");
if (getConfig()->GPUVendor != NVIDIA_GPU)
if (GPUVendor != NVIDIA_GPU)
{
detourFunction(0x08051c4c, gl_ProgramStringARB);
}
@@ -2909,7 +2913,7 @@ int initPatch()
patchMemory(0x080b5682, "9090909090");
patchMemory(0x080B5591, "ffffffff");
patchMemory(0x080B55C4, "ffffffff");
if (getConfig()->GPUVendor != NVIDIA_GPU)
if (GPUVendor != NVIDIA_GPU)
{
detourFunction(0x08052088, gl_ProgramStringARB);
}
@@ -2946,7 +2950,7 @@ int initPatch()
patchMemory(0x080e16b6, "9090909090");
patchMemory(0x080e15bd, "ffffffff");
patchMemory(0x080e15f7, "ffffffff");
if (getConfig()->GPUVendor != NVIDIA_GPU)
if (GPUVendor != NVIDIA_GPU)
{
detourFunction(0x08052fbc, gl_ProgramStringARB);
}
@@ -2954,7 +2958,6 @@ int initPatch()
patchMemory(0x080e173c, "B810000000");
}
break;
case VIRTUA_TENNIS_3:
{
if (config->showDebugMessages == 1)
@@ -2972,12 +2975,12 @@ int initPatch()
detourFunction(0x0831beb9, amDipswExit);
detourFunction(0x0831bf2f, amDipswGetData);
detourFunction(0x0831bfa7, stubRetZero);
setVariable(0x0827a7c7, 0x34891beb); // Disable Fullscreen set from the game
setVariable(0x0827a7c7, 0x34891beb); // Disable Fullscreen set from the game
detourFunction(0x08177acc, stubRetOne); // Patch seterror
// Mesa
if (getConfig()->GPUVendor != NVIDIA_GPU)
if (GPUVendor != NVIDIA_GPU)
{
detourFunction(0x0804d458, cg_GLGetLatestProfile);
detourFunction(0x0804dcd8, cg_GLIsProfileSupported);
@@ -2994,37 +2997,6 @@ int initPatch()
}
}
break;
case VIRTUA_TENNIS_3_TEST:
{
if (config->showDebugMessages == 1)
{
// Debug
detourFunction(0x08054c64, _putConsole); // Debug Messages
}
// Security
detourFunction(0x0815f060, amDongleInit);
detourFunction(0x0815f373, amDongleIsAvailable);
detourFunction(0x0815f2da, amDongleUpdate);
// Fixes
amDipswContextAddr = (void *)0x085e4a6c; // Address of amDipswContext
detourFunction(0x0815c9b0, amDipswInit);
detourFunction(0x0815ca45, amDipswExit);
detourFunction(0x0815cabb, amDipswGetData);
detourFunction(0x0815cb33, amDipswSetLed);
patchMemory(0x0806f983, "EB"); // Avoid Full Screen set from Game
// Mesa Patches
if (getConfig()->GPUVendor != NVIDIA_GPU)
{
detourFunction(0x0804ce54, cg_GLIsProfileSupported);
detourFunction(0x0804c724, gl_Color4ub);
detourFunction(0x0804c8b4, gl_Vertex3f);
detourFunction(0x0804cdc4, gl_TexCoord2f);
patchMemory(0x0806a01a, "31FF90");
cacheModedShaderFiles();
}
}
break;
case VIRTUA_TENNIS_3_REVA:
{
if (config->showDebugMessages == 1)
@@ -3042,11 +3014,11 @@ int initPatch()
detourFunction(0x0831bf5d, amDipswExit);
detourFunction(0x0831bfd3, amDipswGetData);
detourFunction(0x0831c04b, stubRetZero);
setVariable(0x0827a7f7, 0x34891beb); // Disable Fullscreen set from the game
detourFunction(0x08177afc, stubRetOne); // Patch seterror
setVariable(0x0827a7f7, 0x34891beb); // Disable Fullscreen set from the game
detourFunction(0x08177afc, stubRetOne); // Patch seterror
// Mesa
if (getConfig()->GPUVendor != NVIDIA_GPU)
if (GPUVendor != NVIDIA_GPU)
{
detourFunction(0x0804d458, cg_GLGetLatestProfile);
detourFunction(0x0804dcd8, cg_GLIsProfileSupported);
@@ -3083,7 +3055,7 @@ int initPatch()
patchMemory(0x0806fd8f, "EB"); // Avoid Full Screen set from Game
// Mesa Patches
if (getConfig()->GPUVendor != NVIDIA_GPU)
if (GPUVendor != NVIDIA_GPU)
{
detourFunction(0x0804ce54, cg_GLIsProfileSupported);
detourFunction(0x0804c724, gl_Color4ub);
@@ -3111,11 +3083,11 @@ int initPatch()
detourFunction(0x0831c149, amDipswExit);
detourFunction(0x0831c1bf, amDipswGetData);
detourFunction(0x0831c237, stubRetZero);
setVariable(0x0827a9e3, 0x34891beb); // Disable Fullscreen set from the game
detourFunction(0x08177bf0, stubRetOne); // Patch seterror
setVariable(0x0827a9e3, 0x34891beb); // Disable Fullscreen set from the game
detourFunction(0x08177bf0, stubRetOne); // Patch seterror
// Mesa
if (getConfig()->GPUVendor != NVIDIA_GPU)
if (GPUVendor != NVIDIA_GPU)
{
detourFunction(0x0804d458, cg_GLGetLatestProfile);
detourFunction(0x0804dcd8, cg_GLIsProfileSupported);
@@ -3152,7 +3124,7 @@ int initPatch()
patchMemory(0x0806fa33, "EB"); // Avoid Full Screen set from Game
// Mesa Patches
if (getConfig()->GPUVendor != NVIDIA_GPU)
if (GPUVendor != NVIDIA_GPU)
{
detourFunction(0x0804ce54, cg_GLIsProfileSupported);
detourFunction(0x0804c724, gl_Color4ub);
@@ -3180,11 +3152,11 @@ int initPatch()
detourFunction(0x0831c561, amDipswExit);
detourFunction(0x0831c5d7, amDipswGetData);
detourFunction(0x0831c64f, stubRetZero);
setVariable(0x0827ae1b, 0x34891beb); // Disable Fullscreen set from the game
detourFunction(0x08177c1c, stubRetOne); // Patch seterror
setVariable(0x0827ae1b, 0x34891beb); // Disable Fullscreen set from the game
detourFunction(0x08177c1c, stubRetOne); // Patch seterror
// Mesa
if (getConfig()->GPUVendor != NVIDIA_GPU)
if (GPUVendor != NVIDIA_GPU)
{
detourFunction(0x0804d458, cg_GLGetLatestProfile);
detourFunction(0x0804dcd8, cg_GLIsProfileSupported);
@@ -3228,7 +3200,7 @@ int initPatch()
patchMemory(0x0806fe3f, "EB"); // Avoid Full Screen set from Game
// Mesa Patches
if (getConfig()->GPUVendor != NVIDIA_GPU)
if (GPUVendor != NVIDIA_GPU)
{
detourFunction(0x0804ce54, cg_GLIsProfileSupported);
detourFunction(0x0804c724, gl_Color4ub);
@@ -3239,6 +3211,37 @@ int initPatch()
}
}
break;
case VIRTUA_TENNIS_3_TEST:
{
if (config->showDebugMessages == 1)
{
// Debug
detourFunction(0x08054c64, _putConsole); // Debug Messages
}
// Security
detourFunction(0x0815f060, amDongleInit);
detourFunction(0x0815f373, amDongleIsAvailable);
detourFunction(0x0815f2da, amDongleUpdate);
// Fixes
amDipswContextAddr = (void *)0x085e4a6c; // Address of amDipswContext
detourFunction(0x0815c9b0, amDipswInit);
detourFunction(0x0815ca45, amDipswExit);
detourFunction(0x0815cabb, amDipswGetData);
detourFunction(0x0815cb33, amDipswSetLed);
patchMemory(0x0806f983, "EB"); // Avoid Full Screen set from Game
// Mesa Patches
if (GPUVendor != NVIDIA_GPU)
{
detourFunction(0x0804ce54, cg_GLIsProfileSupported);
detourFunction(0x0804c724, gl_Color4ub);
detourFunction(0x0804c8b4, gl_Vertex3f);
detourFunction(0x0804cdc4, gl_TexCoord2f);
patchMemory(0x0806a01a, "31FF90");
cacheModedShaderFiles();
}
}
break;
default:
break;
}
+842 -594
View File
File diff suppressed because it is too large Load Diff
+53 -134
View File
@@ -14,13 +14,9 @@
#include "input.h"
#include "sdlcalls.h"
#include "fps_limiter.h"
#define STB_IMAGE_IMPLEMENTATION
#include "stb_image.h"
#define STBI_ONLY_PNG
#define STBI_SUPPORT_ZLIB
#define STBI_NO_SIMD
#include "customcursor.h"
extern uint32_t gId;
bool SDLWindowCreated = false;
extern bool GLUTGame;
SDL_Window *SDLwindow;
@@ -30,6 +26,11 @@ Window x11Window;
char SDLgameTitle[256] = {0};
extern fps_limit fpsLimit;
extern void *customCursor;
extern void *phTouchCursor;
int glutInitialized = 0;
void GLAPIENTRY openglDebugCallback2(GLenum source, GLenum type, GLuint id, GLenum severity, GLsizei length,
const GLchar *message, const void *userParam)
{
@@ -50,125 +51,32 @@ void GLAPIENTRY openglDebugCallback2(GLenum source, GLenum type, GLuint id, GLen
}
}
SDL_Surface *createSurfaceFromStb(unsigned char *data, int width, int height, int channels)
{
Uint32 rmask, gmask, bmask, amask;
if (channels == 4)
{ // RGBA
rmask = 0x000000FF;
gmask = 0x0000FF00;
bmask = 0x00FF0000;
amask = 0xFF000000;
}
else if (channels == 3)
{ // RGB
rmask = 0x000000FF;
gmask = 0x0000FF00;
bmask = 0x00FF0000;
amask = 0;
}
else
{
fprintf(stderr, "Unsupported image format with %d channels.\n", channels);
return NULL;
}
SDL_Surface *surface = SDL_CreateRGBSurfaceFrom(data, width, height, channels * 8, width * channels, rmask, gmask, bmask, amask);
if (!surface)
{
fprintf(stderr, "SDL_CreateRGBSurfaceFrom Error: %s\n", SDL_GetError());
}
return surface;
}
int loadNewCursor(char *cursorFileName)
{
int width, height, channels;
unsigned char *imageData = stbi_load(cursorFileName, &width, &height, &channels, 0);
if (!imageData)
{
fprintf(stderr, "Failed to load image: %s\n", cursorFileName);
SDL_Quit();
return 0;
}
SDL_Surface *originalSurface = createSurfaceFromStb(imageData, width, height, channels);
if (!originalSurface)
{
stbi_image_free(imageData);
SDL_Quit();
return 0;
}
int newWidth = getConfig()->customCursorWidth;
int newHeight = getConfig()->customCursorHeight;
SDL_Surface *resizedSurface =
SDL_CreateRGBSurface(0, newWidth, newHeight, originalSurface->format->BitsPerPixel, originalSurface->format->Rmask,
originalSurface->format->Gmask, originalSurface->format->Bmask, originalSurface->format->Amask);
if (!resizedSurface)
{
fprintf(stderr, "SDL_CreateRGBSurface Error: %s\n", SDL_GetError());
SDL_FreeSurface(originalSurface);
stbi_image_free(imageData);
SDL_Quit();
return 0;
}
SDL_Rect srcRect = {0, 0, originalSurface->w, originalSurface->h};
SDL_Rect destRect = {0, 0, newWidth, newHeight};
if (SDL_BlitScaled(originalSurface, &srcRect, resizedSurface, &destRect) != 0)
{
fprintf(stderr, "SDL_BlitScaled Error: %s\n", SDL_GetError());
SDL_FreeSurface(resizedSurface);
SDL_FreeSurface(originalSurface);
stbi_image_free(imageData);
SDL_Quit();
return 0;
}
SDL_Cursor *customCursor = SDL_CreateColorCursor(resizedSurface, newWidth / 2, newHeight / 2);
if (!customCursor)
{
fprintf(stderr, "SDL_CreateColorCursor Error: %s\n", SDL_GetError());
SDL_FreeSurface(resizedSurface);
SDL_FreeSurface(originalSurface);
stbi_image_free(imageData);
SDL_Quit();
return 0;
}
SDL_SetCursor(customCursor);
SDL_FreeSurface(resizedSurface);
SDL_FreeSurface(originalSurface);
stbi_image_free(imageData);
return 1;
}
void initSDL(int *argcp, char **argv)
{
int gId = getConfig()->crc32;
void FGAPIENTRY (*_glutInit)(int *argcp, char **argv) = dlsym(RTLD_NEXT, "glutInit");
if (getConfig()->noSDL && GLUTGame)
switch (gId)
{
_glutInit(argcp, argv);
return;
case OUTRUN_2_SP_SDX_TEST:
case OUTRUN_2_SP_SDX_REVA_TEST:
case OUTRUN_2_SP_SDX_REVA_TEST2:
if (!glutInitialized)
{
glutInitialized = 1;
_glutInit(argcp, argv);
return;
}
}
if ((gId == OUTRUN_2_SP_SDX_TEST || gId == OUTRUN_2_SP_SDX_REVA_TEST || gId == OUTRUN_2_SP_SDX_REVA_TEST2) && GLUTGame)
{
_glutInit(argcp, argv);
}
if ((gId == AFTER_BURNER_CLIMAX) || (gId == AFTER_BURNER_CLIMAX_REVA) || (gId == AFTER_BURNER_CLIMAX_REVB) ||
(gId == AFTER_BURNER_CLIMAX_SDX) || (gId == AFTER_BURNER_CLIMAX_SDX_REVA) || (gId == AFTER_BURNER_CLIMAX_SE) ||
(gId == AFTER_BURNER_CLIMAX_SE_REVA))
switch (gId)
{
case AFTER_BURNER_CLIMAX:
case AFTER_BURNER_CLIMAX_REVA:
case AFTER_BURNER_CLIMAX_REVB:
case AFTER_BURNER_CLIMAX_SDX:
case AFTER_BURNER_CLIMAX_SDX_REVA:
case AFTER_BURNER_CLIMAX_SE:
case AFTER_BURNER_CLIMAX_SE_REVA:
setenv("SDL_VIDEODRIVER", "x11", 1);
}
@@ -183,14 +91,31 @@ void initSDL(int *argcp, char **argv)
SDL_GL_SetAttribute(SDL_GL_DOUBLEBUFFER, 1); // Double buffering
SDL_GL_SetAttribute(SDL_GL_DEPTH_SIZE, 1); // 24-bit depth buffer
SDL_GL_SetAttribute(SDL_GL_ALPHA_SIZE, 8); // Set the alpha size to 8 bits
if (gId == AFTER_BURNER_CLIMAX || gId == AFTER_BURNER_CLIMAX_REVA || gId == AFTER_BURNER_CLIMAX_REVB ||
gId == AFTER_BURNER_CLIMAX_SDX || gId == AFTER_BURNER_CLIMAX_SDX_REVA || gId == AFTER_BURNER_CLIMAX_SE ||
gId == AFTER_BURNER_CLIMAX_SE_REVA || gId == R_TUNED || gId == VIRTUA_FIGHTER_5 || gId == VIRTUA_FIGHTER_5_REVA ||
gId == VIRTUA_FIGHTER_5_REVB || gId == VIRTUA_FIGHTER_5_REVE || gId == VIRTUA_FIGHTER_5_EXPORT || gId == VIRTUA_FIGHTER_5_R ||
gId == VIRTUA_FIGHTER_5_R_REVD || gId == VIRTUA_FIGHTER_5_R_REVG || gId == VIRTUA_FIGHTER_5_FINAL_SHOWDOWN_REVA ||
gId == VIRTUA_FIGHTER_5_FINAL_SHOWDOWN_REVB || gId == VIRTUA_FIGHTER_5_FINAL_SHOWDOWN_REVB_6000 || gId == GHOST_SQUAD_EVOLUTION ||
gId == SEGA_RACE_TV || gId == MJ4_REVG || gId == MJ4_EVO)
switch (gId)
{
case AFTER_BURNER_CLIMAX:
case AFTER_BURNER_CLIMAX_REVA:
case AFTER_BURNER_CLIMAX_REVB:
case AFTER_BURNER_CLIMAX_SDX:
case AFTER_BURNER_CLIMAX_SDX_REVA:
case AFTER_BURNER_CLIMAX_SE:
case AFTER_BURNER_CLIMAX_SE_REVA:
case R_TUNED:
case VIRTUA_FIGHTER_5:
case VIRTUA_FIGHTER_5_REVA:
case VIRTUA_FIGHTER_5_REVB:
case VIRTUA_FIGHTER_5_REVE:
case VIRTUA_FIGHTER_5_EXPORT:
case VIRTUA_FIGHTER_5_R:
case VIRTUA_FIGHTER_5_R_REVD:
case VIRTUA_FIGHTER_5_R_REVG:
case VIRTUA_FIGHTER_5_FINAL_SHOWDOWN_REVA:
case VIRTUA_FIGHTER_5_FINAL_SHOWDOWN_REVB:
case VIRTUA_FIGHTER_5_FINAL_SHOWDOWN_REVB_6000:
case GHOST_SQUAD_EVOLUTION:
case SEGA_RACE_TV:
case MJ4_REVG:
case MJ4_EVO:
SDL_GL_SetAttribute(SDL_GL_STENCIL_SIZE, 1);
}
@@ -236,18 +161,12 @@ void initSDL(int *argcp, char **argv)
if (getConfig()->fullscreen)
{
SDL_SetWindowFullscreen(SDLwindow, SDL_WINDOW_FULLSCREEN);
}
if (strcmp(getConfig()->customCursor, "") != 0)
{
if (!loadNewCursor(getConfig()->customCursor))
{
fprintf(stderr, "Custom cursor could not be loaded!\n");
exit(1);
}
}
if (getConfig()->hideCursor)
loadCursors();
setCursor(customCursor);
if (getConfig()->hideCursor || gId == PRIMEVAL_HUNT)
SDL_ShowCursor(SDL_DISABLE);
}
+1 -1
View File
@@ -1,8 +1,8 @@
#include <stdio.h>
#include "config.h"
#include "securityboard.h"
#include "log.h"
#include "config.h"
#define SECURITY_BOARD_FRONT_PANEL 0x38
#define SECURITY_BOARD_FRONT_PANEL_NON_ROOT 0x1038
File diff suppressed because it is too large Load Diff
+8 -8
View File
@@ -702,14 +702,14 @@ static int stbi__sse2_available()
static int stbi__sse2_available()
{
//#if defined(__GNUC__) && (__GNUC__ * 100 + __GNUC_MINOR__) >= 408 // GCC 4.8 or later
// GCC 4.8+ has a nice way to do this
//return __builtin_cpu_supports("sse2");
//#else
// portable way to do this, preferably without using GCC inline ASM?
// just bail for now.
return 0;
//#endif
// #if defined(__GNUC__) && (__GNUC__ * 100 + __GNUC_MINOR__) >= 408 // GCC 4.8 or later
// // GCC 4.8+ has a nice way to do this
// return __builtin_cpu_supports("sse2");
// #else
// portable way to do this, preferably without using GCC inline ASM?
// just bail for now.
return 0;
// #endif
}
#endif
#endif
+85
View File
@@ -0,0 +1,85 @@
#include <SDL2/SDL_events.h>
#include <X11/X.h>
#include <stdbool.h>
#include <stdint.h>
#include <string.h>
#include <sys/types.h>
char phSendBuf[10];
bool phBufferFilled = false;
int phCommand = 1;
int phCommandByte = 0;
uint16_t coordX;
uint16_t coordY;
#define TOUCH_START 0x81
#define TOUCH_TOUCHING 0x82
#define TOUCH_END 0x84
void phCoordinates(int x, int y, int w, int h, int button)
{
coordX = (float)x / ((float)w * 0.0002441406);
coordY = (float)y / ((float)h * 0.0002441406);
memset(phSendBuf, 0, sizeof(phSendBuf));
if (button == SDL_MOUSEBUTTONDOWN || button == ButtonPress)
{
phSendBuf[2] = TOUCH_START;
phCommand = 1;
}
else if (button == SDL_MOUSEBUTTONUP || button == ButtonRelease)
{
phSendBuf[2] = TOUCH_END;
phCommand = 3;
}
else if (button == SDL_MOUSEMOTION || button == MotionNotify)
{
phSendBuf[2] = TOUCH_TOUCHING;
phCommand = 2;
}
phSendBuf[0] = 0x55;
phSendBuf[1] = 0x54;
phSendBuf[3] = (char)(coordX & 0xFF);
phSendBuf[4] = (char)((coordX >> 8) & 0xff);
phSendBuf[5] = (char)(coordY & 0xFF);
phSendBuf[6] = (char)((coordY >> 8) & 0xff);
phBufferFilled = true;
}
uint8_t phCalcChecksum()
{
int8_t checksum = -0x56;
for (int x = 0; x < 9;x++)
{
checksum += phSendBuf[x];
}
return (uint8_t)(checksum & 0xff);
}
ssize_t phRead(int fd, void *buf, size_t count)
{
if(!phBufferFilled)
return 0;
if(phCommandByte == 9)
{
switch (phCommand)
{
case 1:
phCommand = 2;
break;
case 2:
phSendBuf[2] = TOUCH_TOUCHING;
break;
case 3:
phBufferFilled = false;
}
phSendBuf[9] = phCalcChecksum();
}
memcpy(buf, &phSendBuf[phCommandByte], sizeof(char));
phCommandByte++;
if (phCommandByte == 10)
phCommandByte = 0;
return 1;
}
+9
View File
@@ -0,0 +1,9 @@
#ifndef TOUCHSCREEN_H
#define TOUCHSCREEN_H
#include <sys/types.h>
void phCoordinates(int x, int y, int w, int h, int button);
ssize_t phRead(int fd, void *buf, size_t count);
#endif
+25 -47
View File
@@ -19,6 +19,7 @@
#include "securityboard.h"
#include "fps_limiter.h"
#include "sdlcalls.h"
#include "customcursor.h"
extern bool SDLWindowCreated;
extern bool gettingGPUVendor;
@@ -26,11 +27,14 @@ extern bool GLUTGame;
bool creatingWindow = false;
Window win;
Window window;
extern Display *x11Display;
extern Window x11Window;
extern void *customCursor;
extern void *phTouchCursor;
/**
* Stop the house of the dead games turning keyboard repeating off.
*/
@@ -42,12 +46,17 @@ int XAutoRepeatOff(Display *display)
Display *XOpenDisplay(const char *display_name)
{
Display *(*_XOpenDisplay)(const char *display_name) = dlsym(RTLD_NEXT, "XOpenDisplay");
if (SDLWindowCreated || gettingGPUVendor || GLUTGame || getConfig()->noSDL)
return _XOpenDisplay(display_name);
creatingWindow = true;
initSDL(0, 0);
creatingWindow = false;
if (SDLWindowCreated || gettingGPUVendor || getConfig()->noSDL)
{
x11Display = _XOpenDisplay(display_name);
}
else
{
creatingWindow = true;
initSDL(0, 0);
creatingWindow = false;
}
return x11Display;
}
@@ -61,19 +70,16 @@ Window XCreateWindow(Display *display, Window parent, int x, int y, unsigned int
if ((gettingGPUVendor || creatingWindow) || (GLUTGame && getConfig()->noSDL == 0))
{
Window window = _XCreateWindow(display, parent, x, y, width, height, border_width, depth, class, visual,
valueMask, attributes);
return window;
window = _XCreateWindow(display, parent, x, y, width, height, border_width, depth, class, visual, valueMask, attributes);
}
if (getConfig()->noSDL)
else if (getConfig()->noSDL)
{
width = getConfig()->width;
height = getConfig()->height;
attributes->event_mask = attributes->event_mask | KeyPressMask | KeyReleaseMask | PointerMotionMask;
Window window = _XCreateWindow(display, parent, x, y, width, height, border_width, depth, class, visual, valueMask, attributes);
window = _XCreateWindow(display, parent, x, y, width, height, border_width, depth, class, visual, valueMask, attributes);
printf(" X11 RESOLUTION: %dx%d\n\n", width, height);
if (getConfig()->fullscreen)
@@ -82,13 +88,17 @@ Window XCreateWindow(Display *display, Window parent, int x, int y, unsigned int
Atom wm_fullscreen = XInternAtom(display, "_NET_WM_STATE_FULLSCREEN", true);
XChangeProperty(display, window, wm_state, XA_ATOM, 32, PropModeReplace, (unsigned char *)&wm_fullscreen, 1);
}
win = window;
x11Window = window;
loadCursors();
setCursor(customCursor);
if (getConfig()->hideCursor)
hideCursor();
}
else
{
win = x11Window;
window = x11Window;
}
return win;
return window;
}
int XGrabPointer(Display *display, Window grab_window, Bool owner_events, unsigned int event_mask, int pointer_mode,
@@ -203,38 +213,6 @@ int XF86VidModeGetAllModeLines(Display *display, int screen, int *modecount_retu
return true;
}
// Cursor XCreatePixmapCursor(Display *display, Pixmap source, Pixmap mask, XColor *fg, XColor *bg, unsigned int x,
// unsigned int y)
// {
// int (*_XCreatePixmapCursor)(Display *display, Pixmap source, Pixmap mask, XColor *fg, XColor *bg, unsigned int x,
// unsigned int y) = dlsym(RTLD_NEXT, "XCreatePixmapCursor");
// if (SDLGame)
// return 0;
// return _XCreatePixmapCursor(display, source, mask, fg, bg, x, y);
// }
// int XFreePixmap(Display *display, Pixmap pixmap)
// {
// int (*_XFreePixmap)(Display *display, Pixmap pixmap) = dlsym(RTLD_NEXT, "XFreePixmap");
// if (SDLGame)
// return 0;
// return _XFreePixmap(display, pixmap);
// }
// Pixmap XCreateBitmapFromData(Display *display, Drawable drawable, const char *data, unsigned int x, unsigned int y)
// {
// Pixmap (*_XCreateBitmapFromData)(Display *display, Drawable drawable, const char *data, unsigned int x,
// unsigned int y) = dlsym(RTLD_NEXT, "XCreateBitmapFromData");
// if (SDLGame)
// return 0;
// return _XCreateBitmapFromData(display, drawable, data, x, y);
// }
// int XDefineCursor(Display *display, Window w, Cursor cursor)
// {
// return 0;
// }
typedef unsigned int uint;
void glGenFencesNV(int n, uint *fences)