Compare commits

...
27 Commits
Author SHA1 Message Date
Bobby Dilley be78a23a31 Make dkeruza happy 2025-01-28 15:24:06 +00:00
Bobby Dilley 8942c510ec Look for /dev/dsp and /dev/dsp1 2025-01-28 10:45:35 +00:00
Bobby Dilley 685d569a08 Remove not needed message 2025-01-28 10:16:06 +00:00
Bobby Dilley 5f19cdc44c Fix wrong error message 2025-01-28 10:11:55 +00:00
Bobby Dilley be1b88b92f Merge remote-tracking branch 'caviar/master' 2025-01-28 10:01:27 +00:00
dkeruza-neo 93927ef8c9 Fixes and ID5 SBRY support. 2025-01-27 15:09:52 +01:00
dkeruza-neo f67f30cbcd Fixed a bug in LGJ when GPU was nVidia and Mesa was set as shader patches. 2025-01-26 03:58:41 +01:00
dkeruza-neo 7ea08b3db3 Cleaned up commented code. 2025-01-26 03:58:41 +01:00
dkeruza dde7cc7b56 Update lindbergh.conf
typo
2025-01-25 00:29:58 +01:00
dkeruza 6ff5d0b590 Update lindbergh.conf
typo
2025-01-24 10:59:45 +01:00
dkeruza a4cbbdaa97 Update patch.c
typo
2025-01-24 10:58:54 +01:00
dkeruza 2810022d1d Update config.h
typo
2025-01-24 10:53:19 +01:00
dkeruza b092b79331 Update config.c
typo
2025-01-24 10:52:23 +01:00
dkeruza-neo 1068fd5a1e Too many to list here. 2025-01-23 17:04:41 +01:00
Bobby Dilley ae61839826 Merge pull request #53 from Tovarichtch/dbresgames
add native resolution to games
2025-01-23 09:29:02 +00:00
Bobby Dilley 5786cdc37d Merge pull request #58 from lindbergh-loader/bobbydilley-patch-1
Update ci.yml
2025-01-16 10:37:32 +00:00
Bobby Dilley 5f90591690 Update ci.yml 2025-01-16 10:36:59 +00:00
Tovarichtch 9ee32e1fb0 ABC SDX was 16:9
https://www.gamoover.net/Forums/index.php?topic=44545.0
2025-01-13 22:18:05 -05:00
Tovarichtch 00a8279ce7 add config width/height 2025-01-13 20:50:55 -05:00
Tovarichtch ab7fbb7d5f ABC SDX
SDX cabinets of After Burner Climax were widescreen, clearly not 640x480. Can't locate native resolution.
2025-01-12 14:54:50 -05:00
Tovarichtch 69c0156e57 add native res to games 2025-01-11 10:39:07 -05:00
Synth_Magic 51eaec106c Do changes as requested 2025-01-10 22:03:06 +08:00
Synth Magic dcae95fe03 rename linux/limits.h to limits.h 2025-01-10 20:54:24 +08:00
Synth_Magic fbc76dfe5e Add config path sepcification 2025-01-10 20:52:07 +08:00
Bobby Dilley a3d476c584 Update ci.yml 2025-01-09 11:34:34 +00:00
Bobby Dilley 6d799d7524 Update ci.yml 2025-01-09 11:30:00 +00:00
Bobby Dilley 73d0c9fb57 Update ci.yml 2025-01-09 11:26:02 +00:00
29 changed files with 16357 additions and 632 deletions
+18 -14
View File
@@ -12,58 +12,62 @@ permissions:
contents: write contents: write
jobs: jobs:
build: build-and-release:
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
# Checkout the repository
- name: Checkout repository - name: Checkout repository
uses: actions/checkout@v3 uses: actions/checkout@v3
# Set up Docker Buildx
- name: Set up Docker Buildx - name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2 uses: docker/setup-buildx-action@v2
# Build the Docker image
- name: Build Docker image - name: Build Docker image
run: | run: |
docker build --target lindbergh-build -t lindbergh-loader . docker build --target lindbergh-build -t lindbergh-loader .
# Extract build artifacts
- name: Extract build artifacts - name: Extract build artifacts
run: | run: |
docker create --name lindbergh-builder lindbergh-loader docker create --name lindbergh-builder lindbergh-loader
docker cp lindbergh-builder:/output ./build docker cp lindbergh-builder:/output ./build
docker rm lindbergh-builder docker rm lindbergh-builder
# Compress the build directory
- name: Compress build directory
run: tar -czvf build.tar.gz -C ./build .
# Archive the build directory as an artifact for debugging
- name: Archive build directory - name: Archive build directory
uses: actions/upload-artifact@v3 uses: actions/upload-artifact@v3
with: with:
name: build-output name: build-output
path: ./build path: ./build
release: # Create a GitHub release and capture the upload URL (only on push events)
if: github.event_name == 'push'
needs: build
runs-on: ubuntu-latest
steps:
- name: Download build artifact
uses: actions/download-artifact@v3
with:
name: build-output
path: ./build
- name: Create Release - name: Create Release
if: github.event_name == 'push'
id: create_release
uses: actions/create-release@v1 uses: actions/create-release@v1
env: env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with: with:
tag_name: v${{ github.run_number }} tag_name: v${{ github.run_number }}
release_name: "Lindbergh Loader v${{ github.run_number }}" release_name: "Build v${{ github.run_number }}"
draft: false draft: false
prerelease: false prerelease: false
# Upload the compressed build artifact to the release (only on push events)
- name: Upload Release Asset - name: Upload Release Asset
if: github.event_name == 'push'
uses: actions/upload-release-asset@v1 uses: actions/upload-release-asset@v1
env: env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with: with:
upload_url: ${{ steps.create_release.outputs.upload_url }} upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./build asset_path: ./build.tar.gz
asset_name: build.tar.gz asset_name: build.tar.gz
asset_content_type: application/gzip asset_content_type: application/gzip
+13 -2
View File
@@ -1,6 +1,6 @@
CC = gcc -m32 -pthread CC = gcc -m32 -pthread
CFLAGS = -g -fPIC -m32 -Wall -Werror -Wno-unused-but-set-variable -Wno-unused-variable -Wno-unused-function -D_GNU_SOURCE -Wno-char-subscripts CFLAGS = -g -fPIC -m32 -Wall -Werror -Wno-misleading-indentation -Wno-unused-but-set-variable -Wno-unused-variable -Wno-unused-function -D_GNU_SOURCE -Wno-char-subscripts
LD = gcc -m32 LD = g++ -m32
LDFLAGS = -Wl,-z,defs -rdynamic -static-libgcc -lc -ldl -lGL -lglut -lX11 -lSDL2 -lm -lpthread -shared -nostdlib -lasound -L./src/libxdiff -lxdiff LDFLAGS = -Wl,-z,defs -rdynamic -static-libgcc -lc -ldl -lGL -lglut -lX11 -lSDL2 -lm -lpthread -shared -nostdlib -lasound -L./src/libxdiff -lxdiff
BUILD = build BUILD = build
@@ -46,6 +46,17 @@ libposixtime.so:
# Clean rule # Clean rule
clean: clean:
rm -f $(BUILD)/lindbergh.so
rm -f $(BUILD)/libsegaapi.so
rm -f $(BUILD)/lindbergh
rm -f src/lindbergh/*.o
rm -f src/libsegaapi/*.o
#clean all rule
cleanall:
rm -rf $(BUILD) rm -rf $(BUILD)
rm -f src/lindbergh/*.o rm -f src/lindbergh/*.o
rm -f src/libsegaapi/*.o rm -f src/libsegaapi/*.o
rm -f src/libkswapapi/*.o
rm -f src/libxdiff/*.a
rm -f src/libxdiff/xdiff/*.o
+34
View File
@@ -0,0 +1,34 @@
# Changelog
All notable changes to this project will be documented in this file.
## [2.0.2]
### Added
- InitialD 5 SBRY added.
- HOD4 SP CPU Frequency fix.
### Fixed
- Fixed a bug when a game uses GLUT and the conf was set to NO_SDL 1
- Fixed a bug in Let's go Jungle when GPU was nVidia and Mesa was set as shader patches.
- Exclude resolution patches when the resolution is the game's original resolution.
- Reload with Right mouse click for Rambo and 2Spicy with SDL.
### [2.0.1] 2025-01-23
### Added
- HOD4 Custom crosshair.
- HOD4 CPU frequency fix (Configurable via config file).
- HOD4 New resolution patch that fixes Boss battle and scales from 1280x768 instead of the lower resolution.
- Built in Logos and fonts (no more nee to use Lucida/SEGA_KakuGothic-DB-Roman_12 and logo.tga).
- Outrun 2 Easy network config from the conf file (can set your IP address in the config file and the loader will set it in the eeprom for you).
- Card Emulation for VT3 and R-tuned.
- All the now games work inside an SDL window now, unless it is disabled in the conf file.
## [2.0] - 2024-12-24
### Initial Release
- First official public release.
- Features of the loader:
- Dynamic shader modification allowing games to work on Intel, nVidia and AMD
- 5.1 Surround Sound Support
- Dynamic resolution patching allowing most games to scale properly in HD
- Original cabinet support with pass through of JVS and FFB
- Network play
- Both simple X11 and advanced evdev input system allowing for ready-to-play keyboard and mouse support or mapping of any controller
+35 -4
View File
@@ -41,15 +41,23 @@ EMULATE_DRIVEBOARD AUTO
# Set if the emulator should emulate the motion board from Outrun 2 SP SDX here # Set if the emulator should emulate the motion board from Outrun 2 SP SDX here
# If this is set to 0, then the emulator will route the traffic to one of the serial ports # If this is set to 0, then the emulator will route the traffic to one of the serial ports
EMULATE_MOTIONBOARD AUTO EMULATE_MOTIONBOARD AUTO
# Set if the loader should emulate the card reader in Virtua Tenis 3
# EMULATE_CARDREADER 1
# Card File for reader 1
# CARDFILE_01 Card_01.crd
# Card File for reader 2
# CARDFILE_02 Card_02.crd
# Define the path to pass the JVS packets to if JVS is not being emulated. # Define the path to pass the JVS packets to if JVS is not being emulated.
JVS_PATH /dev/ttyUSB0 JVS_PATH /dev/ttyUSB0
# Define the path to pass the first serial port to if it's not being emulated. # Define the path to pass the first serial port to if it's not being emulated.
SERIAL_1_PATH /dev/ttyUSB0 # SERIAL_1_PATH /dev/ttyUSB0
# Define the path to pass the second serial port to if it's not being emulated. # Define the path to pass the second serial port to if it's not being emulated.
SERIAL_2_PATH /dev/ttyUSB0 # SERIAL_2_PATH /dev/ttyUSB0
# Define the path to the sram.bin file # Define the path to the sram.bin file
SRAM_PATH sram.bin SRAM_PATH sram.bin
@@ -95,16 +103,39 @@ FPS_TARGET 60
LGJ_RENDER_WITH_MESA 1 LGJ_RENDER_WITH_MESA 1
# Set the Primeval Hunt mode # Set the Primeval Hunt mode
# Mode 0: Leaves everything as default # Mode 0: Default (Side by Side)
# Mode 1: No touch screen (Default mode) # Mode 1: No touch screen
# Mode 2: Side by Side # Mode 2: Side by Side
# Mode 3: 3ds mode 1 (Touch screen to the right) # Mode 3: 3ds mode 1 (Touch screen to the right)
# Mode 4: 3ds mode 2 (Touch screen to the bottom) # Mode 4: 3ds mode 2 (Touch screen to the bottom)
PRIMEVAL_HUNT_MODE 1 PRIMEVAL_HUNT_MODE 1
# Disble to use the original fonts instead of the built in font in the loader
DISABLE_BUILTIN_FONT 0
# Disble to use the original logos instead of the built in logos in the loader
DISABLE_BUILTIN_LOGOS 0
# Set to 0 to enable the mouse pointer/Cursor
HIDE_CURSOR 1
# Set the custom mouse pointer from a PNG file (Usefull for shooting games)
# CUSTOM_CURSOR myCustomCursor.png
# Set the width of the custom cursor
CUSTOM_CURSOR_WIDTH 32
# Set the height of the custom cursor
CUSTOM_CURSOR_HEIGHT 32
# Hacky way to make MJ4 work at prohibited times? # Hacky way to make MJ4 work at prohibited times?
# MJ4_ENABLED_ALL_THE_TIME 1 # MJ4_ENABLED_ALL_THE_TIME 1
# Sets the IP address in the eeprom for Outrun link (you have to put your NIC ip)
# OR2_IP 192.168.1.2
# House of the dead 4 speed fix set the frequency of your CPU in Ghz (The speed reported by the manufacturer)
# CPU_FREQ_GHZ 4.0
# Set the colour of the lindbergh to change the Segaboot logo # Set the colour of the lindbergh to change the Segaboot logo
# Possible colours are: YELLOW, RED, BLUE, SILVER, REDEX # Possible colours are: YELLOW, RED, BLUE, SILVER, REDEX
LINDBERGH_COLOUR YELLOW LINDBERGH_COLOUR YELLOW
+236
View File
@@ -0,0 +1,236 @@
#include <stdbool.h>
#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <sys/types.h>
#include <unistd.h>
#include "config.h"
#include "card_reader.h"
#define BLOCKSIZE 8
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};
SerialFD serialFD[2];
WriteCommand writeCmd[2];
ReadCommand readCmd[2];
void initReadCmd(int fdIdx)
{
readCmd[fdIdx].cmd = 0;
readCmd[fdIdx].cmdCompleted = false;
readCmd[fdIdx].cmdLen = 0;
readCmd[fdIdx].sentBytes = 0;
memset(&readCmd[fdIdx].sendBuffer, '\0', 256);
}
void initWriteCmd(int fdIdx)
{
writeCmd[fdIdx].cmdCompleted = false;
writeCmd[fdIdx].packetLen = 0;
writeCmd[fdIdx].recBytes = 0;
memset(&writeCmd[fdIdx].recBuffer, '\0', sizeof(uint8_t));
}
int initCardReader()
{
initReadCmd(0);
initReadCmd(1);
initWriteCmd(0);
initWriteCmd(1);
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)
{
printf("Game does not support Card Reader, please disable the card reader emulation in the config file.\n");
return -1;
}
if (getConfig()->emulateCardreader && getConfig()->emulateDriveboard && gId != R_TUNED)
{
printf("Game does not support Card Reader and Driver Board emulation enabled at the same time.\n");
printf("Please disable Drive Board emulations in the config file.\n");
return -1;
}
return 0;
}
int carReaderGetFdIdx(int fd)
{
if (fd == serialFD[0].fd)
return 0;
return 1;
}
uint8_t cardReaderGenChecksum(int fdIdx)
{
int checksum = 0;
for (int i = 0; i < readCmd[fdIdx].cmdLen - 1; i++)
{
checksum ^= readCmd[fdIdx].sendBuffer[i];
}
return checksum;
}
void buildOutputBuffer(int fdIdx, uint8_t cmd)
{
uint16_t packetLen = 0;
readCmd[fdIdx].sendBuffer[0] = 0x10;
readCmd[fdIdx].sendBuffer[1] = cmd;
switch (cmd)
{
case 0x10:
{
readCmd[fdIdx].sendBuffer[5] = 0x20;
}
case 0x11:
{
if (writeCmd[fdIdx].recBuffer[5] == 0x04)
{
initWriteCmd(fdIdx);
return;
}
}
case 0x14:
case 0x15:
case 0x20:
{
if (cmd == 0x20 && writeCmd[fdIdx].recBuffer[5] == 0x00)
readCmd[fdIdx].sendBuffer[4] = 0x80;
}
case 0x26:
case 0x27:
{
packetLen = 0x02;
readCmd[fdIdx].sendBuffer[3] = packetLen;
}
break;
case 0x21:
{
packetLen = 0x0a;
readCmd[fdIdx].sendBuffer[3] = packetLen;
readCmd[fdIdx].sendBuffer[6] = 0x81;
readCmd[fdIdx].sendBuffer[8] = 0x59;
readCmd[fdIdx].sendBuffer[9] = 0xda;
}
break;
case 0x22:
{
packetLen = 0x0a;
readCmd[fdIdx].sendBuffer[3] = packetLen;
readCmd[fdIdx].sendBuffer[7] = 0x08;
}
break;
case 0x33:
{
packetLen = 0x0a;
readCmd[fdIdx].sendBuffer[3] = packetLen;
readCmd[fdIdx].sendBuffer[6] = 0xff;
readCmd[fdIdx].sendBuffer[7] = 0xff;
}
break;
case 0x34:
{
uint16_t blockStart = (writeCmd[fdIdx].recBuffer[6] << 8) | writeCmd[fdIdx].recBuffer[7];
uint16_t blocksToRead = (writeCmd[fdIdx].recBuffer[8] << 8) | writeCmd[fdIdx].recBuffer[9];
packetLen = (BLOCKSIZE * blocksToRead) + 2;
readCmd[fdIdx].sendBuffer[3] = packetLen;
FILE *crdFile = fopen(serialFD[fdIdx].cardFilename, "rb");
fseek(crdFile, BLOCKSIZE * blockStart, SEEK_SET);
fread(readCmd[fdIdx].sendBuffer + 6, 1, packetLen - 2, crdFile);
fclose(crdFile);
}
break;
case 0x35:
{
readCmd[fdIdx].sendBuffer[3] = 0x02;
uint16_t blockStart = (writeCmd[fdIdx].recBuffer[6] << 8) | writeCmd[fdIdx].recBuffer[7];
uint16_t blocksToWrite = (writeCmd[fdIdx].recBuffer[8] << 8) | writeCmd[fdIdx].recBuffer[9];
packetLen = BLOCKSIZE * blocksToWrite;
FILE *crdFile = fopen(serialFD[fdIdx].cardFilename, "rb+");
fseek(crdFile, BLOCKSIZE * blockStart, SEEK_SET);
fwrite(writeCmd[fdIdx].recBuffer + 10, 1, packetLen, crdFile);
fclose(crdFile);
packetLen = 0x02;
}
break;
default:
{
printf("Command not supported.\n");
}
}
readCmd[fdIdx].cmdLen = packetLen + 5;
readCmd[fdIdx].sendBuffer[readCmd[fdIdx].cmdLen - 1] = cardReaderGenChecksum(fdIdx);
}
size_t cardReaderWrite(int fd, const void *buf, size_t count)
{
int fdIdx = carReaderGetFdIdx(fd);
if (writeCmd[fdIdx].cmdCompleted)
{
printf("Something went wrong, a write command was issued after the command was completed.\n");
}
if (writeCmd[fdIdx].recBytes == 4)
{
writeCmd[fdIdx].packetLen = (writeCmd[fdIdx].recBuffer[2] << 8) | writeCmd[fdIdx].recBuffer[3];
}
writeCmd[fdIdx].recBuffer[writeCmd[fdIdx].recBytes] = *((u_int8_t *)buf);
writeCmd[fdIdx].recBytes++;
if (writeCmd[fdIdx].recBytes == writeCmd[fdIdx].packetLen + 5)
{
writeCmd[fdIdx].cmdCompleted = true;
initReadCmd(fdIdx);
buildOutputBuffer(fdIdx, writeCmd[fdIdx].recBuffer[1]);
}
return count;
}
size_t cardReaderRead(int fd, void *buf, size_t count)
{
int fdIdx = carReaderGetFdIdx(fd);
if (!writeCmd[fdIdx].cmdCompleted || readCmd[fdIdx].cmdCompleted)
return -1;
if (readCmd[fdIdx].cmdLen == readCmd[fdIdx].sentBytes)
{
readCmd[fdIdx].cmdCompleted = true;
initWriteCmd(fdIdx);
return -1;
}
memcpy(buf, &readCmd[fdIdx].sendBuffer[readCmd[fdIdx].sentBytes], sizeof(uint8_t));
readCmd[fdIdx].sentBytes++;
return 1;
}
void cardReaderSetFd(int serial, int fd, char *fName)
{
serialFD[serial].fd = fd;
serialFD[serial].cardFilename = fName;
if (access(fName, F_OK) != 0)
{
FILE *crdFile = fopen(fName, "wb+");
if (getConfig()->crc32 == R_TUNED)
{
cardHeader[0x22] = 0x02;
cardHeader[0x23] = 0x60;
}
fwrite(cardHeader, 1, 56, crdFile);
uint8_t z = 0;
fseek(crdFile, 0x7c7, SEEK_CUR);
fwrite(&z, 1, 1, crdFile);
fclose(crdFile);
printf("Cardfile %s created.\n", fName);
}
}
+36
View File
@@ -0,0 +1,36 @@
#ifndef CARD_READER_H
#define CARD_READER_H
#include <stdint.h>
#include <sys/types.h>
typedef struct
{
int fd;
char *cardFilename;
} SerialFD;
typedef struct
{
bool cmdCompleted;
uint16_t packetLen;
uint8_t recBytes;
uint8_t recBuffer[256];
} WriteCommand;
typedef struct
{
uint8_t cmd;
bool cmdCompleted;
uint8_t cmdLen;
uint8_t sentBytes;
uint8_t sendBuffer[256];
} ReadCommand;
int initCardReader();
size_t cardReaderWrite(int fd, const void *buf, size_t count);
size_t cardReaderRead(int fd, void *buf, size_t count);
void cardReaderSetFd(int serial, int fd, char *fName);
#endif
+231 -68
View File
@@ -1,3 +1,4 @@
#include <limits.h>
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>
#include <string.h> #include <string.h>
@@ -85,9 +86,11 @@ static int detectGame(uint32_t elf_crc)
config.gameID = "SBLC"; config.gameID = "SBLC";
config.gameDVP = "DVP-0003A"; config.gameDVP = "DVP-0003A";
config.gameReleaseYear = "2005"; config.gameReleaseYear = "2005";
config.gameNativeResolutions = ""; config.gameNativeResolutions = "640x480, 1280x768";
config.gameType = SHOOTING; config.gameType = SHOOTING;
config.gameStatus = WORKING; config.gameStatus = WORKING;
config.width = 1280;
config.height = 768;
return 0; return 0;
} }
break; break;
@@ -99,9 +102,11 @@ static int detectGame(uint32_t elf_crc)
config.gameID = "SBLC"; config.gameID = "SBLC";
config.gameDVP = "DVP-0003B"; config.gameDVP = "DVP-0003B";
config.gameReleaseYear = "2005"; config.gameReleaseYear = "2005";
config.gameNativeResolutions = ""; config.gameNativeResolutions = "640x480, 1280x768";
config.gameType = SHOOTING; config.gameType = SHOOTING;
config.gameStatus = WORKING; config.gameStatus = WORKING;
config.width = 1280;
config.height = 768;
return 0; return 0;
} }
break; break;
@@ -113,9 +118,11 @@ static int detectGame(uint32_t elf_crc)
config.gameID = "SBLC"; config.gameID = "SBLC";
config.gameDVP = "DVP-0003C"; config.gameDVP = "DVP-0003C";
config.gameReleaseYear = "2005"; config.gameReleaseYear = "2005";
config.gameNativeResolutions = ""; config.gameNativeResolutions = "640x480, 1280x768";
config.gameType = SHOOTING; config.gameType = SHOOTING;
config.gameStatus = WORKING; config.gameStatus = WORKING;
config.width = 1280;
config.height = 768;
return 0; return 0;
} }
break; break;
@@ -128,7 +135,7 @@ static int detectGame(uint32_t elf_crc)
config.gameID = "SBLS"; config.gameID = "SBLS";
config.gameDVP = "DVP-0010"; config.gameDVP = "DVP-0010";
config.gameReleaseYear = "2006"; config.gameReleaseYear = "2006";
config.gameNativeResolutions = ""; config.gameNativeResolutions = "1024x768";
config.gameStatus = WORKING; config.gameStatus = WORKING;
config.gameType = SHOOTING; config.gameType = SHOOTING;
config.width = 1024; config.width = 1024;
@@ -145,7 +152,7 @@ static int detectGame(uint32_t elf_crc)
config.gameID = "SBLS"; config.gameID = "SBLS";
config.gameDVP = "DVP-0010B"; config.gameDVP = "DVP-0010B";
config.gameReleaseYear = "2006"; config.gameReleaseYear = "2006";
config.gameNativeResolutions = ""; config.gameNativeResolutions = "1024x768";
config.gameStatus = WORKING; config.gameStatus = WORKING;
config.gameType = SHOOTING; config.gameType = SHOOTING;
config.width = 1024; config.width = 1024;
@@ -164,7 +171,9 @@ static int detectGame(uint32_t elf_crc)
config.gameID = "SBRC"; config.gameID = "SBRC";
config.gameDVP = "DVP-0063"; config.gameDVP = "DVP-0063";
config.gameReleaseYear = "2008"; config.gameReleaseYear = "2008";
config.gameNativeResolutions = ""; config.gameNativeResolutions = "1280x768";
config.width = 1280;
config.height = 768;
return 0; return 0;
} }
break; break;
@@ -177,11 +186,13 @@ static int detectGame(uint32_t elf_crc)
config.gameDVP = "DVP-0015A"; config.gameDVP = "DVP-0015A";
config.gameID = "SBMB"; config.gameID = "SBMB";
config.gameReleaseYear = "2006"; config.gameReleaseYear = "2006";
config.gameNativeResolutions = ""; config.gameNativeResolutions = "800x480";
config.emulateDriveboard = 1; config.emulateDriveboard = 1;
config.emulateMotionboard = 1; config.emulateMotionboard = 1;
config.gameStatus = WORKING; config.gameStatus = WORKING;
config.gameType = DRIVING; config.gameType = DRIVING;
config.width = 800;
config.height = 480;
return 0; return 0;
} }
break; break;
@@ -193,11 +204,13 @@ static int detectGame(uint32_t elf_crc)
config.gameDVP = "DVP-0015"; config.gameDVP = "DVP-0015";
config.gameID = "SBMB"; config.gameID = "SBMB";
config.gameReleaseYear = "2006"; config.gameReleaseYear = "2006";
config.gameNativeResolutions = ""; config.gameNativeResolutions = "800x480";
config.emulateDriveboard = 1; config.emulateDriveboard = 1;
config.emulateMotionboard = 1; config.emulateMotionboard = 1;
config.gameStatus = WORKING; config.gameStatus = WORKING;
config.gameType = DRIVING; config.gameType = DRIVING;
config.width = 800;
config.height = 480;
return 0; return 0;
} }
break; break;
@@ -208,9 +221,11 @@ static int detectGame(uint32_t elf_crc)
config.gameDVP = "DVP-0008"; config.gameDVP = "DVP-0008";
config.gameID = "SBLM"; config.gameID = "SBLM";
config.gameReleaseYear = "2005"; config.gameReleaseYear = "2005";
config.gameNativeResolutions = ""; config.gameNativeResolutions = "1280x768";
config.gameStatus = WORKING; config.gameStatus = WORKING;
config.gameType = FIGHTING; config.gameType = FIGHTING;
config.width = 1280;
config.height = 768;
return 0; return 0;
} }
break; break;
@@ -221,9 +236,11 @@ static int detectGame(uint32_t elf_crc)
config.gameDVP = "DVP-0008A"; config.gameDVP = "DVP-0008A";
config.gameID = "SBLM"; config.gameID = "SBLM";
config.gameReleaseYear = "2005"; config.gameReleaseYear = "2005";
config.gameNativeResolutions = ""; config.gameNativeResolutions = "1280x768";
config.gameStatus = WORKING; config.gameStatus = WORKING;
config.gameType = FIGHTING; config.gameType = FIGHTING;
config.width = 1280;
config.height = 768;
return 0; return 0;
} }
break; break;
@@ -234,9 +251,11 @@ static int detectGame(uint32_t elf_crc)
config.gameDVP = "DVP-0008B"; config.gameDVP = "DVP-0008B";
config.gameID = "SBLM"; config.gameID = "SBLM";
config.gameReleaseYear = "2005"; config.gameReleaseYear = "2005";
config.gameNativeResolutions = ""; config.gameNativeResolutions = "1280x768";
config.gameStatus = WORKING; config.gameStatus = WORKING;
config.gameType = FIGHTING; config.gameType = FIGHTING;
config.width = 1280;
config.height = 768;
return 0; return 0;
} }
break; break;
@@ -247,9 +266,11 @@ static int detectGame(uint32_t elf_crc)
config.gameDVP = "DVP-0008E"; config.gameDVP = "DVP-0008E";
config.gameID = "SBLM"; config.gameID = "SBLM";
config.gameReleaseYear = "2005"; config.gameReleaseYear = "2005";
config.gameNativeResolutions = ""; config.gameNativeResolutions = "1280x768";
config.gameStatus = WORKING; config.gameStatus = WORKING;
config.gameType = FIGHTING; config.gameType = FIGHTING;
config.width = 1280;
config.height = 768;
return 0; return 0;
} }
break; break;
@@ -260,9 +281,11 @@ static int detectGame(uint32_t elf_crc)
config.gameDVP = "DVP-0043"; config.gameDVP = "DVP-0043";
config.gameID = "SBLM"; config.gameID = "SBLM";
config.gameReleaseYear = "2005"; config.gameReleaseYear = "2005";
config.gameNativeResolutions = ""; config.gameNativeResolutions = "1280x768";
config.gameStatus = WORKING; config.gameStatus = WORKING;
config.gameType = FIGHTING; config.gameType = FIGHTING;
config.width = 1280;
config.height = 768;
return 0; return 0;
} }
break; break;
@@ -273,9 +296,11 @@ static int detectGame(uint32_t elf_crc)
config.gameDVP = "DVP-XXXX"; config.gameDVP = "DVP-XXXX";
config.gameID = "SBQU"; config.gameID = "SBQU";
config.gameReleaseYear = "2008"; config.gameReleaseYear = "2008";
config.gameNativeResolutions = ""; config.gameNativeResolutions = "1280x768";
config.gameStatus = WORKING; config.gameStatus = WORKING;
config.gameType = FIGHTING; config.gameType = FIGHTING;
config.width = 1280;
config.height = 768;
return 0; return 0;
} }
break; break;
@@ -286,9 +311,11 @@ static int detectGame(uint32_t elf_crc)
config.gameDVP = "DVP-XXXX"; config.gameDVP = "DVP-XXXX";
config.gameID = "SBQU"; config.gameID = "SBQU";
config.gameReleaseYear = "2008"; config.gameReleaseYear = "2008";
config.gameNativeResolutions = ""; config.gameNativeResolutions = "1280x768";
config.gameStatus = WORKING; config.gameStatus = WORKING;
config.gameType = FIGHTING; config.gameType = FIGHTING;
config.width = 1280;
config.height = 768;
return 0; return 0;
} }
break; break;
@@ -299,9 +326,11 @@ static int detectGame(uint32_t elf_crc)
config.gameDVP = "DVP-XXXX"; config.gameDVP = "DVP-XXXX";
config.gameID = "SBQU"; config.gameID = "SBQU";
config.gameReleaseYear = "2008"; config.gameReleaseYear = "2008";
config.gameNativeResolutions = ""; config.gameNativeResolutions = "1280x768";
config.gameStatus = WORKING; config.gameStatus = WORKING;
config.gameType = FIGHTING; config.gameType = FIGHTING;
config.width = 1280;
config.height = 768;
return 0; return 0;
} }
break; break;
@@ -312,9 +341,11 @@ static int detectGame(uint32_t elf_crc)
config.gameDVP = "DVP-SBUV"; config.gameDVP = "DVP-SBUV";
config.gameID = "SBUV"; config.gameID = "SBUV";
config.gameReleaseYear = "2010"; config.gameReleaseYear = "2010";
config.gameNativeResolutions = ""; config.gameNativeResolutions = "1280x768";
config.gameType = FIGHTING; config.gameType = FIGHTING;
config.gameStatus = WORKING; config.gameStatus = WORKING;
config.width = 1280;
config.height = 768;
return 0; return 0;
} }
break; break;
@@ -325,9 +356,11 @@ static int detectGame(uint32_t elf_crc)
config.gameDVP = "DVP-5019A"; config.gameDVP = "DVP-5019A";
config.gameID = "SBUV"; config.gameID = "SBUV";
config.gameReleaseYear = "2010"; config.gameReleaseYear = "2010";
config.gameNativeResolutions = ""; config.gameNativeResolutions = "1280x768";
config.gameType = FIGHTING; config.gameType = FIGHTING;
config.gameStatus = WORKING; config.gameStatus = WORKING;
config.width = 1280;
config.height = 768;
return 0; return 0;
} }
break; break;
@@ -335,12 +368,14 @@ static int detectGame(uint32_t elf_crc)
case VIRTUA_FIGHTER_5_FINAL_SHOWDOWN_REVB: case VIRTUA_FIGHTER_5_FINAL_SHOWDOWN_REVB:
{ {
config.gameTitle = "Virtua Fighter 5 Final Showdown REV B"; config.gameTitle = "Virtua Fighter 5 Final Showdown REV B";
config.gameDVP = "DVP-5019B"; config.gameDVP = "DVP-5020";
config.gameID = "SBUV"; config.gameID = "SBXX";
config.gameReleaseYear = "2010"; config.gameReleaseYear = "2010";
config.gameNativeResolutions = ""; config.gameNativeResolutions = "1280x768";
config.gameType = FIGHTING; config.gameType = FIGHTING;
config.gameStatus = WORKING; config.gameStatus = WORKING;
config.width = 1280;
config.height = 768;
return 0; return 0;
} }
break; break;
@@ -349,11 +384,13 @@ static int detectGame(uint32_t elf_crc)
{ {
config.gameTitle = "Virtua Fighter 5 Final Showdown REV B ver 6.0000"; config.gameTitle = "Virtua Fighter 5 Final Showdown REV B ver 6.0000";
config.gameDVP = "DVP-5020"; config.gameDVP = "DVP-5020";
config.gameID = "SBUV"; config.gameID = "SBXX";
config.gameReleaseYear = "2010"; config.gameReleaseYear = "2010";
config.gameNativeResolutions = ""; config.gameNativeResolutions = "1280x768";
config.gameType = FIGHTING; config.gameType = FIGHTING;
config.gameStatus = WORKING; config.gameStatus = WORKING;
config.width = 1280;
config.height = 768;
return 0; return 0;
} }
break; break;
@@ -364,7 +401,7 @@ static int detectGame(uint32_t elf_crc)
config.gameDVP = "DVP-0011"; config.gameDVP = "DVP-0011";
config.gameID = "SBLU"; config.gameID = "SBLU";
config.gameReleaseYear = "2006"; config.gameReleaseYear = "2006";
config.gameNativeResolutions = ""; config.gameNativeResolutions = "1360x768";
config.gameType = SHOOTING; config.gameType = SHOOTING;
config.gameStatus = WORKING; config.gameStatus = WORKING;
config.width = 1360; config.width = 1360;
@@ -380,7 +417,7 @@ static int detectGame(uint32_t elf_crc)
config.gameID = "SBNR"; config.gameID = "SBNR";
config.gameDVP = "DVP-0036"; config.gameDVP = "DVP-0036";
config.gameReleaseYear = "2007"; config.gameReleaseYear = "2007";
config.gameNativeResolutions = ""; config.gameNativeResolutions = "1024x768";
config.gameType = SHOOTING; config.gameType = SHOOTING;
config.gameStatus = WORKING; config.gameStatus = WORKING;
config.width = 1024; config.width = 1024;
@@ -395,10 +432,12 @@ static int detectGame(uint32_t elf_crc)
config.gameDVP = "DVP-0009"; config.gameDVP = "DVP-0009";
config.gameID = "SBLR"; config.gameID = "SBLR";
config.gameReleaseYear = "2006"; config.gameReleaseYear = "2006";
config.gameNativeResolutions = ""; config.gameNativeResolutions = "640x480";
config.gameStatus = WORKING; config.gameStatus = WORKING;
config.jvsIOType = SEGA_TYPE_1; config.jvsIOType = SEGA_TYPE_1;
config.gameType = ABC; config.gameType = ABC;
config.width = 640;
config.height = 480;
return 0; return 0;
} }
break; break;
@@ -409,10 +448,12 @@ static int detectGame(uint32_t elf_crc)
config.gameDVP = "DVP-0009A"; config.gameDVP = "DVP-0009A";
config.gameID = "SBLR"; config.gameID = "SBLR";
config.gameReleaseYear = "2006"; config.gameReleaseYear = "2006";
config.gameNativeResolutions = ""; config.gameNativeResolutions = "640x480";
config.gameStatus = WORKING; config.gameStatus = WORKING;
config.jvsIOType = SEGA_TYPE_1; config.jvsIOType = SEGA_TYPE_1;
config.gameType = ABC; config.gameType = ABC;
config.width = 640;
config.height = 480;
return 0; return 0;
} }
break; break;
@@ -423,10 +464,12 @@ static int detectGame(uint32_t elf_crc)
config.gameDVP = "DVP-0009B"; config.gameDVP = "DVP-0009B";
config.gameID = "SBLR"; config.gameID = "SBLR";
config.gameReleaseYear = "2006"; config.gameReleaseYear = "2006";
config.gameNativeResolutions = ""; config.gameNativeResolutions = "640x480";
config.gameStatus = WORKING; config.gameStatus = WORKING;
config.jvsIOType = SEGA_TYPE_1; config.jvsIOType = SEGA_TYPE_1;
config.gameType = ABC; config.gameType = ABC;
config.width = 640;
config.height = 480;
return 0; return 0;
} }
break; break;
@@ -437,10 +480,12 @@ static int detectGame(uint32_t elf_crc)
config.gameDVP = "DVP-0018-SDX"; config.gameDVP = "DVP-0018-SDX";
config.gameID = "SBMN"; config.gameID = "SBMN";
config.gameReleaseYear = "2006 ?"; config.gameReleaseYear = "2006 ?";
config.gameNativeResolutions = ""; config.gameNativeResolutions = "640x480";
config.gameStatus = WORKING; config.gameStatus = WORKING;
config.jvsIOType = SEGA_TYPE_1; config.jvsIOType = SEGA_TYPE_1;
config.gameType = ABC; config.gameType = ABC;
config.width = 640;
config.height = 480;
return 0; return 0;
} }
break; break;
@@ -451,10 +496,12 @@ static int detectGame(uint32_t elf_crc)
config.gameDVP = "DVP-0018A-SDX"; config.gameDVP = "DVP-0018A-SDX";
config.gameID = "SBMN"; config.gameID = "SBMN";
config.gameReleaseYear = "2006 ?"; config.gameReleaseYear = "2006 ?";
config.gameNativeResolutions = ""; config.gameNativeResolutions = "640x480";
config.gameStatus = WORKING; config.gameStatus = WORKING;
config.jvsIOType = SEGA_TYPE_1; config.jvsIOType = SEGA_TYPE_1;
config.gameType = ABC; config.gameType = ABC;
config.width = 640;
config.height = 480;
return 0; return 0;
} }
break; break;
@@ -493,9 +540,11 @@ static int detectGame(uint32_t elf_crc)
config.gameID = "SBML"; config.gameID = "SBML";
config.gameDVP = "DVP-0019A"; config.gameDVP = "DVP-0019A";
config.gameReleaseYear = "2007"; config.gameReleaseYear = "2007";
config.gameNativeResolutions = ""; config.gameNativeResolutions = "1360x768";
config.gameStatus = WORKING; config.gameStatus = WORKING;
config.gameType = DRIVING; config.gameType = DRIVING;
config.width = 1360;
config.height = 768;
return 0; return 0;
} }
break; break;
@@ -506,9 +555,11 @@ static int detectGame(uint32_t elf_crc)
config.gameID = "SBML"; config.gameID = "SBML";
config.gameDVP = "DVP-0019B"; config.gameDVP = "DVP-0019B";
config.gameReleaseYear = "2007"; config.gameReleaseYear = "2007";
config.gameNativeResolutions = ""; config.gameNativeResolutions = "1360x768";
config.gameStatus = WORKING; config.gameStatus = WORKING;
config.gameType = DRIVING; config.gameType = DRIVING;
config.width = 1360;
config.height = 768;
return 0; return 0;
} }
break; break;
@@ -519,9 +570,11 @@ static int detectGame(uint32_t elf_crc)
config.gameID = "SBML"; config.gameID = "SBML";
config.gameDVP = "DVP-0019C"; config.gameDVP = "DVP-0019C";
config.gameReleaseYear = "2007"; config.gameReleaseYear = "2007";
config.gameNativeResolutions = ""; config.gameNativeResolutions = "1360x768";
config.gameStatus = WORKING; config.gameStatus = WORKING;
config.gameType = DRIVING; config.gameType = DRIVING;
config.width = 1360;
config.height = 768;
return 0; return 0;
} }
break; break;
@@ -532,9 +585,11 @@ static int detectGame(uint32_t elf_crc)
config.gameID = "SBML"; config.gameID = "SBML";
config.gameDVP = "DVP-0019D"; config.gameDVP = "DVP-0019D";
config.gameReleaseYear = "2007"; config.gameReleaseYear = "2007";
config.gameNativeResolutions = ""; config.gameNativeResolutions = "1360x768";
config.gameStatus = WORKING; config.gameStatus = WORKING;
config.gameType = DRIVING; config.gameType = DRIVING;
config.width = 1360;
config.height = 768;
return 0; return 0;
} }
break; break;
@@ -545,9 +600,11 @@ static int detectGame(uint32_t elf_crc)
config.gameID = "SBML"; config.gameID = "SBML";
config.gameDVP = "DVP-0019G"; config.gameDVP = "DVP-0019G";
config.gameReleaseYear = "2007"; config.gameReleaseYear = "2007";
config.gameNativeResolutions = ""; config.gameNativeResolutions = "1360x768";
config.gameStatus = WORKING; config.gameStatus = WORKING;
config.gameType = DRIVING; config.gameType = DRIVING;
config.width = 1360;
config.height = 768;
return 0; return 0;
} }
break; break;
@@ -558,9 +615,11 @@ static int detectGame(uint32_t elf_crc)
config.gameID = "SBNK"; config.gameID = "SBNK";
config.gameDVP = "DVP-0030B"; config.gameDVP = "DVP-0030B";
config.gameReleaseYear = "2007"; config.gameReleaseYear = "2007";
config.gameNativeResolutions = ""; config.gameNativeResolutions = "1360x768";
config.gameStatus = WORKING; config.gameStatus = WORKING;
config.gameType = DRIVING; config.gameType = DRIVING;
config.width = 1360;
config.height = 768;
return 0; return 0;
} }
break; break;
@@ -571,9 +630,11 @@ static int detectGame(uint32_t elf_crc)
config.gameID = "SBNK"; config.gameID = "SBNK";
config.gameDVP = "DVP-0030C"; config.gameDVP = "DVP-0030C";
config.gameReleaseYear = "2007"; config.gameReleaseYear = "2007";
config.gameNativeResolutions = ""; config.gameNativeResolutions = "1360x768";
config.gameStatus = WORKING; config.gameStatus = WORKING;
config.gameType = DRIVING; config.gameType = DRIVING;
config.width = 1360;
config.height = 768;
return 0; return 0;
} }
break; break;
@@ -584,9 +645,11 @@ static int detectGame(uint32_t elf_crc)
config.gameID = "SBNK"; config.gameID = "SBNK";
config.gameDVP = "DVP-0030D"; config.gameDVP = "DVP-0030D";
config.gameReleaseYear = "2007"; config.gameReleaseYear = "2007";
config.gameNativeResolutions = ""; config.gameNativeResolutions = "1360x768";
config.gameStatus = WORKING; config.gameStatus = WORKING;
config.gameType = DRIVING; config.gameType = DRIVING;
config.width = 1360;
config.height = 768;
return 0; return 0;
} }
break; break;
@@ -598,11 +661,11 @@ static int detectGame(uint32_t elf_crc)
config.gameDVP = "DVP-0044"; config.gameDVP = "DVP-0044";
config.gameID = "SBPF"; config.gameID = "SBPF";
config.gameReleaseYear = "2008"; config.gameReleaseYear = "2008";
config.gameNativeResolutions = "1280x768"; config.gameNativeResolutions = "640x480";
config.gameStatus = WORKING; config.gameStatus = WORKING;
config.gameType = DRIVING; config.gameType = DRIVING;
config.width = 1280; config.width = 640;
config.height = 768; config.height = 480;
return 0; return 0;
} }
break; break;
@@ -613,10 +676,12 @@ static int detectGame(uint32_t elf_crc)
config.gameDVP = "DVP-0069"; config.gameDVP = "DVP-0069";
config.gameID = "SBQL"; config.gameID = "SBQL";
config.gameReleaseYear = "2008"; config.gameReleaseYear = "2008";
config.gameNativeResolutions = ""; config.gameNativeResolutions = "640x480, 1280x768";
config.gameLindberghColour = REDEX; config.gameLindberghColour = REDEX;
config.gameType = SHOOTING; config.gameType = SHOOTING;
config.gameStatus = WORKING; config.gameStatus = WORKING;
config.width = 1280;
config.height = 768;
return 0; return 0;
} }
break; break;
@@ -627,10 +692,12 @@ static int detectGame(uint32_t elf_crc)
config.gameDVP = "DVP-0060"; config.gameDVP = "DVP-0060";
config.gameID = "SBQW"; config.gameID = "SBQW";
config.gameReleaseYear = "2008"; config.gameReleaseYear = "2008";
config.gameNativeResolutions = ""; config.gameNativeResolutions = "640x480";
config.emulateDriveboard = 1; config.emulateDriveboard = 1;
config.gameStatus = WORKING; config.gameStatus = WORKING;
config.gameType = DRIVING; config.gameType = DRIVING;
config.width = 640;
config.height = 480;
return 0; return 0;
} }
break; break;
@@ -642,10 +709,12 @@ static int detectGame(uint32_t elf_crc)
config.gameDVP = "DVP-0027A"; config.gameDVP = "DVP-0027A";
config.gameID = "SBMV"; config.gameID = "SBMV";
config.gameReleaseYear = "2008"; config.gameReleaseYear = "2008";
config.gameNativeResolutions = ""; config.gameNativeResolutions = "640x480, 1280x768";
config.gameLindberghColour = RED; config.gameLindberghColour = RED;
config.gameStatus = WORKING; config.gameStatus = WORKING;
config.gameType = SHOOTING; config.gameType = SHOOTING;
config.width = 1280;
config.height = 768;
return 0; return 0;
} }
break; break;
@@ -657,8 +726,10 @@ static int detectGame(uint32_t elf_crc)
config.gameDVP = "DVP-0005"; config.gameDVP = "DVP-0005";
config.gameID = "SBKX"; config.gameID = "SBKX";
config.gameReleaseYear = "2006"; config.gameReleaseYear = "2006";
config.gameNativeResolutions = ""; config.gameNativeResolutions = "640x480, 1360x768";
config.gameStatus = WORKING; config.gameStatus = WORKING;
config.width = 1360;
config.height = 768;
return 0; return 0;
} }
break; break;
@@ -670,9 +741,11 @@ static int detectGame(uint32_t elf_crc)
config.gameDVP = "DVP-0005A"; config.gameDVP = "DVP-0005A";
config.gameID = "SBKX"; config.gameID = "SBKX";
config.gameReleaseYear = "2006"; config.gameReleaseYear = "2006";
config.gameNativeResolutions = ""; config.gameNativeResolutions = "640x480, 1360x768";
config.gameType = FIGHTING; config.gameType = FIGHTING;
config.gameStatus = WORKING; config.gameStatus = WORKING;
config.width = 1360;
config.height = 768;
return 0; return 0;
} }
break; break;
@@ -684,9 +757,11 @@ static int detectGame(uint32_t elf_crc)
config.gameDVP = "DVP-0005B"; config.gameDVP = "DVP-0005B";
config.gameID = "SBKX"; config.gameID = "SBKX";
config.gameReleaseYear = "2006"; config.gameReleaseYear = "2006";
config.gameNativeResolutions = ""; config.gameNativeResolutions = "640x480, 1360x768";
config.gameType = FIGHTING; config.gameType = FIGHTING;
config.gameStatus = WORKING; config.gameStatus = WORKING;
config.width = 1360;
config.height = 768;
return 0; return 0;
} }
break; break;
@@ -698,9 +773,11 @@ static int detectGame(uint32_t elf_crc)
config.gameDVP = "DVP-0005C"; config.gameDVP = "DVP-0005C";
config.gameID = "SBKX"; config.gameID = "SBKX";
config.gameReleaseYear = "2006"; config.gameReleaseYear = "2006";
config.gameNativeResolutions = ""; config.gameNativeResolutions = "640x480, 1360x768";
config.gameType = FIGHTING; config.gameType = FIGHTING;
config.gameStatus = WORKING; config.gameStatus = WORKING;
config.width = 1360;
config.height = 768;
return 0; return 0;
} }
break; break;
@@ -711,10 +788,12 @@ static int detectGame(uint32_t elf_crc)
config.gameDVP = "DVP-0048A"; config.gameDVP = "DVP-0048A";
config.gameID = "SBPP"; config.gameID = "SBPP";
config.gameReleaseYear = "2008"; config.gameReleaseYear = "2008";
config.gameNativeResolutions = ""; config.gameNativeResolutions = "640x480";
config.gameLindberghColour = RED; config.gameLindberghColour = RED;
config.gameStatus = WORKING; config.gameStatus = WORKING;
config.gameType = SHOOTING; config.gameType = SHOOTING;
config.width = 640;
config.height = 480;
return 0; return 0;
} }
break; break;
@@ -726,10 +805,12 @@ static int detectGame(uint32_t elf_crc)
config.gameDVP = "DVP-0029A"; config.gameDVP = "DVP-0029A";
config.gameID = "SBNJ"; config.gameID = "SBNJ";
config.gameReleaseYear = "2007"; config.gameReleaseYear = "2007";
config.gameNativeResolutions = ""; config.gameNativeResolutions = "640x480";
config.gameLindberghColour = RED; config.gameLindberghColour = RED;
config.gameType = SHOOTING; config.gameType = SHOOTING;
config.jvsIOType = SEGA_TYPE_1; config.jvsIOType = SEGA_TYPE_1;
config.width = 640;
config.height = 480;
return 0; return 0;
} }
break; break;
@@ -740,9 +821,11 @@ static int detectGame(uint32_t elf_crc)
config.gameDVP = "DVP-0070A"; config.gameDVP = "DVP-0070A";
config.gameID = "SBQZ"; config.gameID = "SBQZ";
config.gameReleaseYear = "2009"; config.gameReleaseYear = "2009";
config.gameNativeResolutions = ""; config.gameNativeResolutions = "1360x768";
config.gameStatus = WORKING; config.gameStatus = WORKING;
config.gameType = DRIVING; config.gameType = DRIVING;
config.width = 1360;
config.height = 768;
return 0; return 0;
} }
break; break;
@@ -753,35 +836,56 @@ static int detectGame(uint32_t elf_crc)
config.gameDVP = "DVP-0070F"; config.gameDVP = "DVP-0070F";
config.gameID = "SBQZ"; config.gameID = "SBQZ";
config.gameReleaseYear = "2009"; config.gameReleaseYear = "2009";
config.gameNativeResolutions = ""; config.gameNativeResolutions = "1360x768";
config.gameStatus = WORKING; config.gameStatus = WORKING;
config.gameType = DRIVING; config.gameType = DRIVING;
config.width = 1360;
config.height = 768;
return 0; return 0;
} }
break; break;
case INITIALD_5_EXP_30: case INITIALD_5_EXP:
{ {
config.gameTitle = "Initial D5 Ver 2.0"; config.gameTitle = "Initial D5 EXP";
config.gameStatus = WORKING; config.gameStatus = WORKING;
config.gameDVP = "DVP-0075"; config.gameDVP = "DVP-0075";
config.gameID = "SBTS"; config.gameID = "SBRY";
config.gameReleaseYear = "2009"; config.gameReleaseYear = "2009";
config.gameNativeResolutions = ""; config.gameNativeResolutions = "1360x768";
config.gameType = DRIVING; config.gameType = DRIVING;
config.width = 1360;
config.height = 768;
return 0; return 0;
} }
break; break;
case INITIALD_5_EXP_40: case INITIALD_5_EXP_20:
{ {
config.gameTitle = "Initial D5 5 Ver 4.0"; config.gameTitle = "Initial D5 EXP 2.0";
config.gameStatus = WORKING;
config.gameDVP = "DVP-0084";
config.gameID = "SBTS";
config.gameReleaseYear = "2009";
config.gameNativeResolutions = "1360x768";
config.gameType = DRIVING;
config.width = 1360;
config.height = 768;
return 0;
}
break;
case INITIALD_5_EXP_20A:
{
config.gameTitle = "Initial D5 5 EXP 2.0";
config.gameDVP = "DVP-0084A"; config.gameDVP = "DVP-0084A";
config.gameID = "SBQN"; config.gameID = "SBQN";
config.gameReleaseYear = "2009"; config.gameReleaseYear = "2009";
config.gameNativeResolutions = ""; config.gameNativeResolutions = "1360x768";
config.gameStatus = WORKING; config.gameStatus = WORKING;
config.gameType = DRIVING; config.gameType = DRIVING;
config.width = 1360;
config.height = 768;
return 0; return 0;
} }
break; break;
@@ -792,9 +896,11 @@ static int detectGame(uint32_t elf_crc)
config.gameID = "SBQN"; config.gameID = "SBQN";
config.gameDVP = "DVP-0057B"; config.gameDVP = "DVP-0057B";
config.gameReleaseYear = "2008"; config.gameReleaseYear = "2008";
config.gameNativeResolutions = ""; config.gameNativeResolutions = "1280x768";
config.gameType = DRIVING; config.gameType = DRIVING;
config.gameStatus = WORKING; config.gameStatus = WORKING;
config.width = 1280;
config.height = 768;
return 0; return 0;
} }
break; break;
@@ -831,7 +937,7 @@ static int detectGame(uint32_t elf_crc)
config.gameID = "SBST"; config.gameID = "SBST";
config.gameDVP = "DVP-0083"; config.gameDVP = "DVP-0083";
config.gameReleaseYear = "2009"; config.gameReleaseYear = "2009";
config.gameNativeResolutions = ""; config.gameNativeResolutions = "1280x768";
config.gameType = DRIVING; config.gameType = DRIVING;
config.gameStatus = WORKING; config.gameStatus = WORKING;
return 0; return 0;
@@ -844,7 +950,7 @@ static int detectGame(uint32_t elf_crc)
config.gameDVP = "DVP-0011A"; config.gameDVP = "DVP-0011A";
config.gameID = "SBLU"; config.gameID = "SBLU";
config.gameReleaseYear = "2006"; config.gameReleaseYear = "2006";
config.gameNativeResolutions = ""; config.gameNativeResolutions = "1360x768";
config.gameType = SHOOTING; config.gameType = SHOOTING;
config.gameStatus = WORKING; config.gameStatus = WORKING;
config.width = 1360; config.width = 1360;
@@ -859,10 +965,12 @@ static int detectGame(uint32_t elf_crc)
config.gameDVP = "DVP-5007"; config.gameDVP = "DVP-5007";
config.gameID = "SBRG"; config.gameID = "SBRG";
config.gameReleaseYear = "2009"; config.gameReleaseYear = "2009";
config.gameNativeResolutions = ""; config.gameNativeResolutions = "1360x768";
config.gameLindberghColour = RED; config.gameLindberghColour = RED;
config.gameType = HARLEY; config.gameType = HARLEY;
config.gameStatus = WORKING; config.gameStatus = WORKING;
config.width = 1360;
config.height = 768;
return 0; return 0;
} }
break; break;
@@ -1008,6 +1116,15 @@ int readConfig(FILE *configFile, EmulatorConfig *config)
config->emulateMotionboard = getNextIntOrAuto(saveptr, defaultValue); config->emulateMotionboard = getNextIntOrAuto(saveptr, defaultValue);
} }
else if (strcmp(command, "EMULATE_CARDREADER") == 0)
config->emulateCardreader = atoi(getNextToken(NULL, " ", &saveptr));
else if (strcmp(command, "CARDFILE_01") == 0)
strcpy(config->cardFile1, getNextToken(NULL, " ", &saveptr));
else if (strcmp(command, "CARDFILE_02") == 0)
strcpy(config->cardFile2, getNextToken(NULL, " ", &saveptr));
else if (strcmp(command, "FULLSCREEN") == 0) else if (strcmp(command, "FULLSCREEN") == 0)
config->fullscreen = atoi(getNextToken(NULL, " ", &saveptr)); config->fullscreen = atoi(getNextToken(NULL, " ", &saveptr));
@@ -1080,9 +1197,8 @@ int readConfig(FILE *configFile, EmulatorConfig *config)
else if (strcmp(command, "KEEP_ASPECT_RATIO") == 0) else if (strcmp(command, "KEEP_ASPECT_RATIO") == 0)
config->keepAspectRatio = atoi(getNextToken(NULL, " ", &saveptr)); config->keepAspectRatio = atoi(getNextToken(NULL, " ", &saveptr));
else if (strcmp(command, "GPU_VENDOR") == 0) { else if (strcmp(command, "GPU_VENDOR") == 0)
config->configGPUVendor = config->GPUVendor = atoi(getNextToken(NULL, " ", &saveptr)); config->configGPUVendor = config->GPUVendor = atoi(getNextToken(NULL, " ", &saveptr));
}
else if (strcmp(command, "OUTRUN_LENS_GLARE_ENABLED") == 0) else if (strcmp(command, "OUTRUN_LENS_GLARE_ENABLED") == 0)
config->outrunLensGlareEnabled = atoi(getNextToken(NULL, " ", &saveptr)); config->outrunLensGlareEnabled = atoi(getNextToken(NULL, " ", &saveptr));
@@ -1099,8 +1215,35 @@ int readConfig(FILE *configFile, EmulatorConfig *config)
else if (strcmp(command, "PRIMEVAL_HUNT_MODE") == 0) else if (strcmp(command, "PRIMEVAL_HUNT_MODE") == 0)
config->phMode = atoi(getNextToken(NULL, " ", &saveptr)); config->phMode = atoi(getNextToken(NULL, " ", &saveptr));
else if (strcmp(command, "DISABLE_BUILTIN_FONT") == 0)
config->disableBuiltinFont = atoi(getNextToken(NULL, " ", &saveptr));
else if (strcmp(command, "DISABLE_BUILTIN_LOGOS") == 0)
config->disableBuiltinLogos = atoi(getNextToken(NULL, " ", &saveptr));
else if (strcmp(command, "HIDE_CURSOR") == 0)
config->hideCursor = atoi(getNextToken(NULL, " ", &saveptr));
else if (strcmp(command, "CUSTOM_CURSOR") == 0)
strcpy(config->customCursor, getNextToken(NULL, " ", &saveptr));
else if (strcmp(command, "CUSTOM_CURSOR_WIDTH") == 0)
config->customCursorWidth = atoi(getNextToken(NULL, " ", &saveptr));
else if (strcmp(command, "CUSTOM_CURSOR_HEIGHT") == 0)
config->customCursorHeight = atoi(getNextToken(NULL, " ", &saveptr));
else if (strcmp(command, "MJ4_ENABLED_ALL_THE_TIME") == 0) else if (strcmp(command, "MJ4_ENABLED_ALL_THE_TIME") == 0)
config->phMode = atoi(getNextToken(NULL, " ", &saveptr)); config->phMode = atoi(getNextToken(NULL, " ", &saveptr));
else if (strcmp(command, "OR2_IP") == 0)
strcpy(config->or2IP, getNextToken(NULL, " ", &saveptr));
else if (strcmp(command, "OR2_NETMASK") == 0)
strcpy(config->or2Netmask, getNextToken(NULL, " ", &saveptr));
else if (strcmp(command, "CPU_FREQ_GHZ") == 0)
config->cpuFreqGhz = atof(getNextToken(NULL, " ", &saveptr));
else if (strcmp(command, "TEST_KEY") == 0) else if (strcmp(command, "TEST_KEY") == 0)
config->keymap.test = atoi(getNextToken(NULL, " ", &saveptr)); config->keymap.test = atoi(getNextToken(NULL, " ", &saveptr));
@@ -1341,11 +1484,14 @@ KeyMapping getDefaultKeymap()
return defaultKeyMapping; return defaultKeyMapping;
} }
int initConfig() int initConfig(const char* configFilePath)
{ {
config.emulateRideboard = 0; config.emulateRideboard = 0;
config.emulateDriveboard = 0; config.emulateDriveboard = 0;
config.emulateMotionboard = 0; config.emulateMotionboard = 0;
config.emulateCardreader = 0;
strcpy(config.cardFile1, "Card_01.crd");
strcpy(config.cardFile2, "Card_02.crd");
config.emulateJVS = 1; config.emulateJVS = 1;
config.fullscreen = 0; config.fullscreen = 0;
config.lindberghColour = YELLOW; config.lindberghColour = YELLOW;
@@ -1377,7 +1523,17 @@ int initConfig()
config.fpsTarget = 60; config.fpsTarget = 60;
config.noSDL = 0; config.noSDL = 0;
config.phMode = 1; config.phMode = 1;
config.disableBuiltinFont = 0;
config.disableBuiltinLogos = 0;
config.hideCursor = 1;
strcpy(config.customCursor, "");
config.customCursorWidth = 32;
config.customCursorHeight = 32;
config.mj4EnabledAtT = 0; config.mj4EnabledAtT = 0;
strcpy(config.or2IP, "");
strcpy(config.or2Netmask, "");
config.cpuFreqGhz = 0.0f;
memset(&config.arcadeInputs.analogue_deadzone_start, 0, sizeof(config.arcadeInputs.analogue_deadzone_start)); memset(&config.arcadeInputs.analogue_deadzone_start, 0, sizeof(config.arcadeInputs.analogue_deadzone_start));
memset(&config.arcadeInputs.analogue_deadzone_middle, 0, sizeof(config.arcadeInputs.analogue_deadzone_middle)); memset(&config.arcadeInputs.analogue_deadzone_middle, 0, sizeof(config.arcadeInputs.analogue_deadzone_middle));
memset(&config.arcadeInputs.analogue_deadzone_end, 0, sizeof(config.arcadeInputs.analogue_deadzone_end)); memset(&config.arcadeInputs.analogue_deadzone_end, 0, sizeof(config.arcadeInputs.analogue_deadzone_end));
@@ -1396,11 +1552,18 @@ int initConfig()
config.inputMode = 0; // Default to all inputs config.inputMode = 0; // Default to all inputs
configFile = fopen(CONFIG_PATH, "r"); char filePath[PATH_MAX];
strncpy(filePath, CONFIG_PATH, PATH_MAX);
if (configFilePath != NULL && configFilePath[0] != '\0')
{
strncpy(filePath, configFilePath, PATH_MAX);
}
configFile = fopen(filePath, "r");
if (configFile == NULL) if (configFile == NULL)
{ {
log_warn("Cannot open %s, using default values.\n", CONFIG_PATH); log_warn("Cannot open %s, using default values.\n", filePath);
return 1; return 1;
} }
+16 -3
View File
@@ -29,8 +29,9 @@
#define INITIALD_4_EXP_REVD 0x62cc73a9 // DVP-0030D #define INITIALD_4_EXP_REVD 0x62cc73a9 // DVP-0030D
#define INITIALD_5_JAP_REVA 0xb3183112 // DVP-0070A #define INITIALD_5_JAP_REVA 0xb3183112 // DVP-0070A
#define INITIALD_5_JAP_REVF 0xfc3dc85d // DVP-0070F #define INITIALD_5_JAP_REVF 0xfc3dc85d // DVP-0070F
#define INITIALD_5_EXP_30 0x77c6b58b // DVP-0075 and DVP-0084???? #define INITIALD_5_EXP 0x701b88cf // DVP-0075
#define INITIALD_5_EXP_40 0xd4910e75 // DVP-0084A #define INITIALD_5_EXP_20 0x77c6b58b // DVP-0084
#define INITIALD_5_EXP_20A 0xd4910e75 // DVP-0084A
#define LETS_GO_JUNGLE 0xb1c8c901 // DVP-0011 #define LETS_GO_JUNGLE 0xb1c8c901 // DVP-0011
#define LETS_GO_JUNGLE_REVA 0xc697c4fb // DVP-0011A #define LETS_GO_JUNGLE_REVA 0xc697c4fb // DVP-0011A
#define LETS_GO_JUNGLE_SPECIAL 0x240beedc // DVP-0036A #define LETS_GO_JUNGLE_SPECIAL 0x240beedc // DVP-0036A
@@ -222,6 +223,9 @@ typedef struct
int emulateRideboard; int emulateRideboard;
int emulateDriveboard; int emulateDriveboard;
int emulateMotionboard; int emulateMotionboard;
int emulateCardreader;
char cardFile1[MAX_PATH_LENGTH];
char cardFile2[MAX_PATH_LENGTH];
int emulateJVS; int emulateJVS;
int fullscreen; int fullscreen;
char eepromPath[MAX_PATH_LENGTH]; char eepromPath[MAX_PATH_LENGTH];
@@ -257,7 +261,16 @@ typedef struct
int lgjRenderWithMesa; int lgjRenderWithMesa;
int noSDL; int noSDL;
int phMode; int phMode;
int disableBuiltinFont;
int disableBuiltinLogos;
int hideCursor;
char customCursor[MAX_PATH_LENGTH];
int customCursorWidth;
int customCursorHeight;
int mj4EnabledAtT; int mj4EnabledAtT;
char or2IP[16];
char or2Netmask[16];
float cpuFreqGhz;
ArcadeInputs arcadeInputs; ArcadeInputs arcadeInputs;
int inputMode; // 0 = both, 1 = SDL/X11 only, 2 = EVDEV only int inputMode; // 0 = both, 1 = SDL/X11 only, 2 = EVDEV only
int skipOutrunCabinetCheck; int skipOutrunCabinetCheck;
@@ -267,7 +280,7 @@ typedef struct
} EmulatorConfig; } EmulatorConfig;
KeyMapping getDefaultKeymap(); KeyMapping getDefaultKeymap();
int initConfig(); int initConfig(const char* configFilePath);
EmulatorConfig *getConfig(); EmulatorConfig *getConfig();
char *getGameName(); char *getGameName();
char *getDVPName(); char *getDVPName();
+11
View File
@@ -1,6 +1,7 @@
#include <stdint.h> #include <stdint.h>
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>
#include <string.h>
#include "config.h" #include "config.h"
#include "eeprom.h" #include "eeprom.h"
@@ -90,6 +91,16 @@ int initEeprom()
} }
} }
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)
{
printf("Error setting the new IP address.");
fclose(eeprom);
return 1;
}
}
fseek(eeprom, 0, SEEK_SET); fseek(eeprom, 0, SEEK_SET);
return 0; return 0;
+17
View File
@@ -226,6 +226,23 @@ int fixCoinAssignmentsHummer(FILE *eeprom)
return 0; return 0;
} }
int setIP(FILE *eeprom, char *ipAddress, char *netMask)
{
uint32_t ipHex = inet_addr(ipAddress);
uint32_t nMask = inet_addr(netMask);
uint32_t dhcp = 0;
memcpy(&eepromBuffer[eepromOffsetTable[ETH0].offset + 8], &dhcp, sizeof(uint32_t));
memcpy(&eepromBuffer[eepromOffsetTable[ETH0].offset + 12], &ipHex, sizeof(uint32_t));
memcpy(&eepromBuffer[eepromOffsetTable[ETH0].offset + 16], &nMask, sizeof(uint32_t));
addCRCtoBuffer(ETH0);
if (writeSectiontoFile(eeprom, ETH0) != 0)
{
printf("Error writing to eeprom.");
return 1;
}
return 0;
}
int eepromSettingsInit( FILE *eeprom) int eepromSettingsInit( FILE *eeprom)
{ {
build_crc32_table(); build_crc32_table();
+3 -1
View File
@@ -1,7 +1,9 @@
#include <stdio.h>
int eepromSettingsInit(FILE *eeprom); int eepromSettingsInit(FILE *eeprom);
int getRegion(); int getRegion();
int getFreeplay(); int getFreeplay();
int setRegion(FILE *eeprom, int region); int setRegion(FILE *eeprom, int region);
int setFreeplay(FILE *eeprom, int freeplay); int setFreeplay(FILE *eeprom, int freeplay);
int fixCreditSection(FILE *eeprom); int fixCreditSection(FILE *eeprom);
int fixCoinAssignmentsHummer(FILE *eeprom); int fixCoinAssignmentsHummer(FILE *eeprom);
int setIP(FILE *eeprom, char *ipAddress, char *netMask);
+23 -15
View File
@@ -22,10 +22,12 @@
#include "fps_limiter.h" #include "fps_limiter.h"
#include "sdlcalls.h" #include "sdlcalls.h"
#include "border.h" #include "border.h"
#include "resolution.h"
extern SDL_Window *SDLwindow; extern SDL_Window *SDLwindow;
extern char SDLgameTitle[]; extern char SDLgameTitle[];
extern fps_limit fpsLimit; extern fps_limit fpsLimit;
bool GLUTGame = false;
void *displayFunc = NULL; void *displayFunc = NULL;
void *reshapeFunc = NULL; void *reshapeFunc = NULL;
@@ -36,17 +38,16 @@ void FGAPIENTRY glutInit(int *argcp, char **argv)
{ {
if (*argcp > 1 && getConfig()->crc32 == SEGA_RACE_TV) if (*argcp > 1 && getConfig()->crc32 == SEGA_RACE_TV)
{ {
for (int x = 0; x < *argcp; x++) if (isTestMode())
{ {
if (strcmp(argv[x], "-t") == 0) EmulatorConfig *config = getConfig();
{ config->noSDL = 0;
EmulatorConfig *config = getConfig(); printf("Forced to use SDL to make Test mode render fine.\n");
config->noSDL = 0;
printf("Forced to use SDL to make Test mode render fine.");
}
} }
} }
glutInitSDL(argcp, argv); GLUTGame = true;
initSDL(argcp, argv);
} }
void FGAPIENTRY glutMainLoop(void) void FGAPIENTRY glutMainLoop(void)
@@ -296,7 +297,8 @@ void FGAPIENTRY glutKeyboardFunc(void (*callback)(unsigned char, int, int))
{ {
if (getConfig()->noSDL) if (getConfig()->noSDL)
{ {
void FGAPIENTRY (*_glutKeyboardFunc)(void (*callback)(unsigned char, int, int)) = dlsym(RTLD_NEXT, "glutKeyboardFunc"); void FGAPIENTRY (*_glutKeyboardFunc)(void (*callback)(unsigned char, int, int)) =
dlsym(RTLD_NEXT, "glutKeyboardFunc");
_glutKeyboardFunc(callback); _glutKeyboardFunc(callback);
return; return;
} }
@@ -307,7 +309,8 @@ void FGAPIENTRY glutKeyboardUpFunc(void (*callback)(unsigned char, int, int))
{ {
if (getConfig()->noSDL) if (getConfig()->noSDL)
{ {
void FGAPIENTRY (*_glutKeyboardUpFunc)(void (*callback)(unsigned char, int, int)) = dlsym(RTLD_NEXT, "glutKeyboardUpFunc"); void FGAPIENTRY (*_glutKeyboardUpFunc)(void (*callback)(unsigned char, int, int)) =
dlsym(RTLD_NEXT, "glutKeyboardUpFunc");
_glutKeyboardUpFunc(callback); _glutKeyboardUpFunc(callback);
return; return;
} }
@@ -362,7 +365,8 @@ void FGAPIENTRY glutPassiveMotionFunc(void (*callback)(int, int))
{ {
if (getConfig()->noSDL) if (getConfig()->noSDL)
{ {
void FGAPIENTRY (*_glutPassiveMotionFunc)(void (*callback)(int, int)) = dlsym(RTLD_NEXT, "glutPassiveMotionFunc"); void FGAPIENTRY (*_glutPassiveMotionFunc)(void (*callback)(int, int)) =
dlsym(RTLD_NEXT, "glutPassiveMotionFunc");
_glutPassiveMotionFunc(callback); _glutPassiveMotionFunc(callback);
return; return;
} }
@@ -417,7 +421,8 @@ void FGAPIENTRY glutSolidSphere(double radius, GLint slices, GLint stacks)
{ {
if (getConfig()->noSDL) if (getConfig()->noSDL)
{ {
void FGAPIENTRY (*_glutSolidSphere)(double radius, GLint slices, GLint stacks) = dlsym(RTLD_NEXT, "glutSolidSphere"); void FGAPIENTRY (*_glutSolidSphere)(double radius, GLint slices, GLint stacks) =
dlsym(RTLD_NEXT, "glutSolidSphere");
_glutSolidSphere(radius, slices, stacks); _glutSolidSphere(radius, slices, stacks);
return; return;
} }
@@ -428,7 +433,8 @@ void FGAPIENTRY glutWireSphere(double radius, GLint slices, GLint stacks)
{ {
if (getConfig()->noSDL) if (getConfig()->noSDL)
{ {
void FGAPIENTRY (*_glutWireSphere)(double radius, GLint slices, GLint stacks) = dlsym(RTLD_NEXT, "glutWireSphere"); void FGAPIENTRY (*_glutWireSphere)(double radius, GLint slices, GLint stacks) =
dlsym(RTLD_NEXT, "glutWireSphere");
_glutWireSphere(radius, slices, stacks); _glutWireSphere(radius, slices, stacks);
return; return;
} }
@@ -439,7 +445,8 @@ void FGAPIENTRY glutWireCone(double base, double height, GLint slices, GLint sta
{ {
if (getConfig()->noSDL) if (getConfig()->noSDL)
{ {
void FGAPIENTRY (*_glutWireCone)(double base, double height, GLint slices, GLint stacks) = dlsym(RTLD_NEXT, "glutWireCone"); void FGAPIENTRY (*_glutWireCone)(double base, double height, GLint slices, GLint stacks) =
dlsym(RTLD_NEXT, "glutWireCone");
_glutWireCone(base, height, slices, stacks); _glutWireCone(base, height, slices, stacks);
return; return;
} }
@@ -450,7 +457,8 @@ void FGAPIENTRY glutSolidCone(double base, double height, GLint slices, GLint st
{ {
if (getConfig()->noSDL) if (getConfig()->noSDL)
{ {
void FGAPIENTRY (*_glutSolidCone)(double base, double height, GLint slices, GLint stacks) = dlsym(RTLD_NEXT, "glutSolidCone"); void FGAPIENTRY (*_glutSolidCone)(double base, double height, GLint slices, GLint stacks) =
dlsym(RTLD_NEXT, "glutSolidCone");
_glutSolidCone(base, height, slices, stacks); _glutSolidCone(base, height, slices, stacks);
return; return;
} }
-25
View File
@@ -1,29 +1,4 @@
#ifndef GLUTHOOKS_H #ifndef GLUTHOOKS_H
#define GLUTHOOKS_H #define GLUTHOOKS_H
#include <GL/glx.h>
int myCreateWindow(int *param1);
void hod4glXSwapBuffers(Display *dpy, GLXDrawable drawable);
#endif #endif
// #include <GL/freeglut.h>
// /* The bitmap font structure taken from freeglut*/
// typedef struct tagSFG_Font SFG_Font;
// struct tagSFG_Font
// {
// char *Name; /* The source font name */
// int Quantity; /* Number of chars in font */
// int Height; /* Height of the characters */
// const GLubyte **Characters; /* The characters mapping */
// float xorig, yorig; /* Relative origin of the character */
// };
// extern SFG_Font fgFontFixed8x13;
// extern SFG_Font fgFontFixed9x15;
// extern SFG_Font fgFontHelvetica10;
// extern SFG_Font fgFontHelvetica12;
// extern SFG_Font fgFontHelvetica18;
// extern SFG_Font fgFontTimesRoman10;
// extern SFG_Font fgFontTimesRoman24;
+82 -47
View File
@@ -1,3 +1,4 @@
#include <complex.h>
#define GL_GLEXT_PROTOTYPES #define GL_GLEXT_PROTOTYPES
#ifndef __i386__ #ifndef __i386__
#define __i386__ #define __i386__
@@ -33,21 +34,51 @@ extern char SDLgameTitle[];
extern fps_limit fpsLimit; extern fps_limit fpsLimit;
extern Window win; extern Window win;
void glXToSDLSwapBuffers(Display *dpy, GLXDrawable drawable) void glXSwapBuffers(Display *dpy, GLXDrawable drawable)
{ {
pollEvents(); void (*_glXSwapBuffers)(Display *dpy, GLXDrawable drawable) = dlsym(RTLD_NEXT, "glXSwapBuffers");
EmulatorConfig *config = getConfig(); EmulatorConfig *config = getConfig();
if (config->borderEnabled) if (config->borderEnabled)
drawGameBorder(config->width, config->height, config->whiteBorderPercentage, config->blackBorderPercentage); drawGameBorder(config->width, config->height, config->whiteBorderPercentage, config->blackBorderPercentage);
SDL_GL_SwapWindow(SDLwindow); 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))
{
XEvent event;
while (XPending(dpy))
{
XNextEvent(dpy, &event);
}
}
else
{
pollEvents();
}
if (getConfig()->noSDL)
{
_glXSwapBuffers(dpy, drawable);
}
else
{
SDL_GL_SwapWindow(SDLwindow);
}
if (getConfig()->fpsLimiter) if (getConfig()->fpsLimiter)
{ {
fpsLimit.frameStart = Clock_now(); fpsLimit.frameStart = Clock_now();
FpsLimiter(&fpsLimit); FpsLimiter(&fpsLimit);
fpsLimit.frameEnd = Clock_now(); fpsLimit.frameEnd = Clock_now();
} }
if (getConfig()->noSDL)
{
XStoreName(dpy, win, "");
return;
}
char windowTitle[512]; char windowTitle[512];
sprintf(windowTitle, "%s - FPS: %.2f", SDLgameTitle, calculateFps()); sprintf(windowTitle, "%s - FPS: %.2f", SDLgameTitle, calculateFps());
SDL_SetWindowTitle(SDLwindow, windowTitle); SDL_SetWindowTitle(SDLwindow, windowTitle);
@@ -55,7 +86,7 @@ void glXToSDLSwapBuffers(Display *dpy, GLXDrawable drawable)
int glxSDLmyCreateWindow(int *param1) int glxSDLmyCreateWindow(int *param1)
{ {
glutInitSDL(0, 0); initSDL(0, 0);
char *buf = malloc(512); char *buf = malloc(512);
memset(buf, '\0', 512); memset(buf, '\0', 512);
// param1[0x17] = (intptr_t)(void *)buf; // window; // param1[0x17] = (intptr_t)(void *)buf; // window;
@@ -63,16 +94,37 @@ int glxSDLmyCreateWindow(int *param1)
return 1; return 1;
} }
static int nVidiaAttribs[] = {GLX_RGBA,
GLX_DOUBLEBUFFER,
GLX_RED_SIZE,
8,
GLX_GREEN_SIZE,
8,
GLX_BLUE_SIZE,
8,
GLX_ALPHA_SIZE,
8,
GLX_DEPTH_SIZE,
16,
GLX_STENCIL_SIZE,
8,
None};
XVisualInfo *glXChooseVisual(Display *dpy, int screen, int *attribList) XVisualInfo *glXChooseVisual(Display *dpy, int screen, int *attribList)
{ {
XVisualInfo *(*_glXChooseVisual)(Display *dpy, int screen, int *attribList) = dlsym(RTLD_NEXT, "glXChooseVisual"); XVisualInfo *(*_glXChooseVisual)(Display *dpy, int screen, int *attribList) = dlsym(RTLD_NEXT, "glXChooseVisual");
if (sdlGame) if (sdlGame)
return 0; return 0;
if (getConfig()->GPUVendor == NVIDIA_GPU)
{
return _glXChooseVisual(dpy, screen, nVidiaAttribs);
}
return _glXChooseVisual(dpy, screen, attribList); return _glXChooseVisual(dpy, screen, attribList);
} }
void GLAPIENTRY openglDebugCallback(GLenum source, GLenum type, GLuint id, GLenum severity, GLsizei length, const GLchar *message, void GLAPIENTRY openglDebugCallback(GLenum source, GLenum type, GLuint id, GLenum severity, GLsizei length,
const void *userParam) const GLchar *message, const void *userParam)
{ {
if (id == 1099) if (id == 1099)
return; return;
@@ -91,35 +143,6 @@ void GLAPIENTRY openglDebugCallback(GLenum source, GLenum type, GLuint id, GLenu
} }
} }
void glXSwapBuffers(Display *dpy, GLXDrawable drawable)
{
void (*_glXSwapBuffers)(Display *dpy, GLXDrawable drawable) = dlsym(RTLD_NEXT, "glXSwapBuffers");
EmulatorConfig *config = getConfig();
if (config->borderEnabled)
drawGameBorder(config->width, config->height, config->whiteBorderPercentage, config->blackBorderPercentage);
int gId = config->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))
{
XEvent event;
while (XPending(dpy))
{
XNextEvent(dpy, &event);
}
}
_glXSwapBuffers(dpy, drawable);
if (config->fpsLimiter)
{
fpsLimit.frameStart = Clock_now();
FpsLimiter(&fpsLimit);
fpsLimit.frameEnd = Clock_now();
}
XStoreName(dpy, win, "");
}
GLXContext glXCreateContext(Display *dpy, XVisualInfo *vis, GLXContext shareList, Bool direct) GLXContext glXCreateContext(Display *dpy, XVisualInfo *vis, GLXContext shareList, Bool direct)
{ {
GLXContext (*_glXCreateContext)(Display *dpy, XVisualInfo *vis, GLXContext shareList, Bool direct) = GLXContext (*_glXCreateContext)(Display *dpy, XVisualInfo *vis, GLXContext shareList, Bool direct) =
@@ -150,7 +173,8 @@ GLXContext glXGetCurrentContext()
GLXPbuffer glXCreatePbuffer(Display *dpy, GLXFBConfig config, const int *attrib_list) GLXPbuffer glXCreatePbuffer(Display *dpy, GLXFBConfig config, const int *attrib_list)
{ {
GLXPbuffer (*_glXCreatePbuffer)(Display *dpy, GLXFBConfig config, const int *attrib_list) = dlsym(RTLD_NEXT, "glXCreatePbuffer"); GLXPbuffer (*_glXCreatePbuffer)(Display *dpy, GLXFBConfig config, const int *attrib_list) =
dlsym(RTLD_NEXT, "glXCreatePbuffer");
if (sdlGame) if (sdlGame)
return 0; return 0;
return _glXCreatePbuffer(dpy, config, attrib_list); return _glXCreatePbuffer(dpy, config, attrib_list);
@@ -174,7 +198,8 @@ void glXDestroyPbuffer(Display *dpy, GLXPbuffer pbuf)
XVisualInfo *glXGetVisualFromFBConfig(Display *dpy, GLXFBConfig config) XVisualInfo *glXGetVisualFromFBConfig(Display *dpy, GLXFBConfig config)
{ {
XVisualInfo *(*_glXGetVisualFromFBConfig)(Display *dpy, GLXFBConfig config) = dlsym(RTLD_NEXT, "glXGetVisualFromFBConfig"); XVisualInfo *(*_glXGetVisualFromFBConfig)(Display *dpy, GLXFBConfig config) =
dlsym(RTLD_NEXT, "glXGetVisualFromFBConfig");
if (sdlGame) if (sdlGame)
return 0; return 0;
return _glXGetVisualFromFBConfig(dpy, config); return _glXGetVisualFromFBConfig(dpy, config);
@@ -212,9 +237,9 @@ GLXFBConfig *glXChooseFBConfig(Display *dpy, int screen, const int *attrib_list,
if (__NV_PRIME_RENDER_OFFLOAD == NULL) if (__NV_PRIME_RENDER_OFFLOAD == NULL)
__NV_PRIME_RENDER_OFFLOAD = " "; __NV_PRIME_RENDER_OFFLOAD = " ";
if ((strcmp(__GLX_VENDOR_LIBRARY_NAME, "nvidia") == 0) && (strcmp(__NV_PRIME_RENDER_OFFLOAD, "1") == 0) && 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_REVA) || (gId == THE_HOUSE_OF_THE_DEAD_4_REVB) ||
(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 == THE_HOUSE_OF_THE_DEAD_4_REVC) || (gId == THE_HOUSE_OF_THE_DEAD_4_SPECIAL) ||
(gId == TOO_SPICY))) (gId == THE_HOUSE_OF_THE_DEAD_4_SPECIAL_REVB) || (gId == THE_HOUSE_OF_THE_DEAD_EX) || (gId == TOO_SPICY)))
{ {
for (int i = 0; attrib_list[i] != None; i += 2) for (int i = 0; attrib_list[i] != None; i += 2)
{ {
@@ -231,8 +256,8 @@ GLXFBConfig *glXChooseFBConfig(Display *dpy, int screen, const int *attrib_list,
GLXContext glXCreateNewContext(Display *dpy, GLXFBConfig config, int render_type, GLXContext share_list, Bool direct) GLXContext glXCreateNewContext(Display *dpy, GLXFBConfig config, int render_type, GLXContext share_list, Bool direct)
{ {
GLXContext (*_glXCreateNewContext)(Display *dpy, GLXFBConfig config, int render_type, GLXContext share_list, Bool direct) = GLXContext (*_glXCreateNewContext)(Display *dpy, GLXFBConfig config, int render_type, GLXContext share_list,
dlsym(RTLD_NEXT, "glXCreateNewContext"); Bool direct) = dlsym(RTLD_NEXT, "glXCreateNewContext");
GLXContext ctx = _glXCreateNewContext(dpy, config, render_type, share_list, direct); GLXContext ctx = _glXCreateNewContext(dpy, config, render_type, share_list, direct);
@@ -246,12 +271,20 @@ GLXContext glXCreateNewContext(Display *dpy, GLXFBConfig config, int render_type
return ctx; return ctx;
} }
GLXPbuffer glXCreateGLXPbufferSGIX(Display *dpy, GLXFBConfigSGIX config, unsigned int width, unsigned int height, int *attrib_list) GLXPbuffer glXCreateGLXPbufferSGIX(Display *dpy, GLXFBConfigSGIX config, unsigned int width, unsigned int height,
int *attrib_list)
{ {
if (sdlGame) if (sdlGame)
return 0; return 0;
int pbufferAttribs[] = { int pbufferAttribs[] = {GLX_PBUFFER_WIDTH,
GLX_PBUFFER_WIDTH, width, GLX_PBUFFER_HEIGHT, height, GLX_PRESERVED_CONTENTS, true, GLX_LARGEST_PBUFFER, true, None}; width,
GLX_PBUFFER_HEIGHT,
height,
GLX_PRESERVED_CONTENTS,
true,
GLX_LARGEST_PBUFFER,
true,
None};
return glXCreatePbuffer(dpy, config, pbufferAttribs); return glXCreatePbuffer(dpy, config, pbufferAttribs);
} }
@@ -275,7 +308,8 @@ GLXFBConfigSGIX *glXChooseFBConfigSGIX(Display *dpy, int screen, int *attrib_lis
__NV_PRIME_RENDER_OFFLOAD = " "; __NV_PRIME_RENDER_OFFLOAD = " ";
if ((strcmp(__GLX_VENDOR_LIBRARY_NAME, "nvidia") == 0) && (strcmp(__NV_PRIME_RENDER_OFFLOAD, "1") == 0) && 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_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)) (gId == INITIALD_4_REVG) || (gId == INITIALD_4_EXP_REVB) || (gId == INITIALD_4_EXP_REVC) ||
gId == INITIALD_4_EXP_REVD))
{ {
for (int i = 0; attrib_list[i] != None; i += 2) for (int i = 0; attrib_list[i] != None; i += 2)
{ {
@@ -296,7 +330,8 @@ int glXGetFBConfigAttribSGIX(Display *dpy, GLXFBConfigSGIX config, int attribute
return glXGetFBConfigAttrib(dpy, config, attribute, value); return glXGetFBConfigAttrib(dpy, config, attribute, value);
} }
GLXContext glXCreateContextWithConfigSGIX(Display *dpy, GLXFBConfigSGIX config, int render_type, GLXContext share_list, Bool direct) GLXContext glXCreateContextWithConfigSGIX(Display *dpy, GLXFBConfigSGIX config, int render_type, GLXContext share_list,
Bool direct)
{ {
if (sdlGame) if (sdlGame)
return 0; return 0;
+337 -52
View File
@@ -1,6 +1,7 @@
#ifndef _GNU_SOURCE #ifndef _GNU_SOURCE
#define _GNU_SOURCE #define _GNU_SOURCE
#include <libgen.h> #include <libgen.h>
#include <stdint.h>
#include <time.h> #include <time.h>
#endif #endif
@@ -11,7 +12,6 @@
#undef __x86_64__ #undef __x86_64__
#include <arpa/inet.h> #include <arpa/inet.h>
#include <dlfcn.h> #include <dlfcn.h>
#include <errno.h>
#include <link.h> #include <link.h>
#include <linux/sockios.h> #include <linux/sockios.h>
#include <math.h> #include <math.h>
@@ -47,7 +47,10 @@
#include "shader_patches.h" #include "shader_patches.h"
#include "fps_limiter.h" #include "fps_limiter.h"
#include "evdevinput.h" #include "evdevinput.h"
#include "card_reader.h"
#include "log.h" #include "log.h"
#include "resources/font.h"
#include "resources/logo.h"
#define HOOK_FILE_NAME "/dev/zero" #define HOOK_FILE_NAME "/dev/zero"
@@ -63,12 +66,20 @@
#define FILE_RW1 3 #define FILE_RW1 3
#define FILE_RW2 4 #define FILE_RW2 4
#define FILE_HARLEY 5 #define FILE_HARLEY 5
#define FILE_FONT_ABC 6
#define FILE_FONT_TGA 7
#define FILE_LOGO_TGA 8
#define ROUTE 9
int hooks[5] = {-1, -1, -1, -1, -1}; int hooks[5] = {-1, -1, -1, -1, -1};
FILE *fileHooks[6] = {NULL, NULL, NULL, NULL, NULL, NULL}; FILE *fileHooks[10] = {NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL};
int fileRead[6] = {0, 0, 0, 0, 0, 0}; int fileRead[10] = {0, 0, 0, 0, 0, 0, 0, 0, 0};
char envpath[100]; char envpath[100];
int fontABCidx = 0;
int fontTGAidx = 0;
int logoTGAidx = 0;
uint32_t elf_crc = 0; uint32_t elf_crc = 0;
extern int hummerExtremeShaderFileIndex; extern int hummerExtremeShaderFileIndex;
@@ -174,7 +185,9 @@ void __attribute__((constructor)) hook_init()
act.sa_flags = SA_SIGINFO; act.sa_flags = SA_SIGINFO;
sigaction(SIGSEGV, &act, NULL); sigaction(SIGSEGV, &act, NULL);
initConfig(); char *(*_getenv)(const char *name) = dlsym(RTLD_NEXT, "getenv");
char* envPath = _getenv("LINDBERGH_CONFIG_PATH");
initConfig(envPath);
if (getConfig()->fpsLimiter == 1) if (getConfig()->fpsLimiter == 1)
{ {
@@ -213,6 +226,12 @@ void __attribute__((constructor)) hook_init()
exit(1); exit(1);
} }
if (getConfig()->emulateCardreader)
{
if (initCardReader() != 0)
exit(1);
}
if (initInput() != 0) if (initInput() != 0)
exit(1); exit(1);
@@ -238,21 +257,16 @@ void __attribute__((constructor)) hook_init()
} }
printf("\n"); printf("\n");
if (getConfig()->GPUVendor == ATI_GPU 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_30) || (getConfig()->crc32 == INITIALD_5_EXP_40))) {
printf("WARNING: Game %s is unsupported in AMD GPU with ATI driver\n",getGameName());
}
if (getConfig()->lgjRenderWithMesa &&
((getConfig()->crc32 == LETS_GO_JUNGLE) || (getConfig()->crc32 == LETS_GO_JUNGLE_REVA) || ((getConfig()->crc32 == LETS_GO_JUNGLE) || (getConfig()->crc32 == LETS_GO_JUNGLE_REVA) ||
(getConfig()->crc32 == LETS_GO_JUNGLE_SPECIAL))) (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)))
{ {
getConfig()->GPUVendor = AMD_GPU; printf("WARNING: Game %s is unsupported in AMD GPU with ATI driver\n", getGameName());
} }
} }
@@ -261,8 +275,7 @@ DIR *opendir(const char *dirname)
DIR *(*_opendir)(const char *dirname) = dlsym(RTLD_NEXT, "opendir"); DIR *(*_opendir)(const char *dirname) = dlsym(RTLD_NEXT, "opendir");
int gId = getConfig()->crc32; int gId = getConfig()->crc32;
if (gId == INITIALD_5_EXP_30 || gId == INITIALD_5_EXP_40 || gId == INITIALD_5_JAP_REVA || 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)
gId == INITIALD_5_JAP_REVF)
{ {
if (strcmp(dirname, "/tmp/") == 0) if (strcmp(dirname, "/tmp/") == 0)
{ {
@@ -292,6 +305,15 @@ int open(const char *pathname, int flags, ...)
int (*_open)(const char *pathname, int flags, ...) = dlsym(RTLD_NEXT, "open"); int (*_open)(const char *pathname, int flags, ...) = dlsym(RTLD_NEXT, "open");
// Attempt to open /dev/dsp and /dev/dsp1
if (strcmp(pathname, "/dev/dsp") == 0) {
int dspFileDescriptor = _open("/dev/dsp", flags, mode);
if(dspFileDescriptor != -1)
return dspFileDescriptor;
return _open("/dev/dsp1", flags, mode);
}
if (strcmp(pathname, "/dev/lbb") == 0) if (strcmp(pathname, "/dev/lbb") == 0)
{ {
hooks[BASEBOARD] = _open(HOOK_FILE_NAME, flags, mode); hooks[BASEBOARD] = _open(HOOK_FILE_NAME, flags, mode);
@@ -306,27 +328,39 @@ int open(const char *pathname, int flags, ...)
if (strcmp(pathname, "/dev/ttyS0") == 0 || strcmp(pathname, "/dev/tts/0") == 0) if (strcmp(pathname, "/dev/ttyS0") == 0 || strcmp(pathname, "/dev/tts/0") == 0)
{ {
if (getConfig()->emulateDriveboard == 0 && getConfig()->emulateRideboard == 0) if (getConfig()->emulateDriveboard == 0 && getConfig()->emulateRideboard == 0 && getConfig()->emulateCardreader == 0)
return _open(getConfig()->serial1Path, flags, mode); return _open(getConfig()->serial1Path, flags, mode);
if (hooks[SERIAL0] != -1) if (hooks[SERIAL0] != -1 && getConfig()->emulateCardreader && getConfig()->crc32 != R_TUNED)
return -1; {
return hooks[SERIAL0];
}
hooks[SERIAL0] = _open(HOOK_FILE_NAME, flags, mode); hooks[SERIAL0] = _open(HOOK_FILE_NAME, flags, mode);
log_warn("SERIAL0 Opened %d\n", hooks[SERIAL0]); printf("Warning: SERIAL0 Opened %d\n", hooks[SERIAL0]);
if (getConfig()->emulateCardreader == 1 && getConfig()->crc32 != R_TUNED)
cardReaderSetFd(0, hooks[SERIAL0], getConfig()->cardFile1);
return hooks[SERIAL0]; return hooks[SERIAL0];
} }
if (strcmp(pathname, "/dev/ttyS1") == 0 || strcmp(pathname, "/dev/tts/1") == 0) if (strcmp(pathname, "/dev/ttyS1") == 0 || strcmp(pathname, "/dev/tts/1") == 0)
{ {
if (getConfig()->emulateMotionboard == 0) if (getConfig()->emulateDriveboard == 0 && getConfig()->emulateMotionboard == 0 && getConfig()->emulateCardreader == 0)
return _open(getConfig()->serial2Path, flags, mode); return _open(getConfig()->serial2Path, flags, mode);
if (hooks[SERIAL1] != -1) if (hooks[SERIAL1] != -1 && getConfig()->emulateCardreader && getConfig()->crc32 != R_TUNED)
return -1; {
return hooks[SERIAL1];
}
hooks[SERIAL1] = _open(HOOK_FILE_NAME, flags, mode); hooks[SERIAL1] = _open(HOOK_FILE_NAME, flags, mode);
log_warn("SERIAL1 opened %d\n", hooks[SERIAL1]); log_warn("SERIAL1 opened %d\n", hooks[SERIAL1]);
if (getConfig()->emulateCardreader == 1)
cardReaderSetFd(1, hooks[SERIAL1], getConfig()->cardFile2);
return hooks[SERIAL1]; return hooks[SERIAL1];
} }
@@ -375,19 +409,60 @@ FILE *fopen(const char *restrict pathname, const char *restrict mode)
return _fopen("lindbergrc", mode); return _fopen("lindbergrc", mode);
} }
if ((strcmp(pathname, "/usr/lib/boot/logo.tga") == 0) || (strcmp(pathname, "/usr/lib/boot/logo.tga") == 0)) if ((strcmp(pathname, "/usr/lib/boot/logo.tga") == 0))
{ {
return _fopen("logo.tga", mode); if (!getConfig()->disableBuiltinLogos)
{
fileRead[FILE_LOGO_TGA] = 0;
fileHooks[FILE_LOGO_TGA] = _fopen(HOOK_FILE_NAME, mode);
return fileHooks[FILE_LOGO_TGA];
}
else
{
return _fopen("logo.tga", mode);
}
}
if (strcmp(pathname, "/usr/lib/boot/logo_red.tga") == 0)
{
if (!getConfig()->disableBuiltinLogos)
{
fileRead[FILE_LOGO_TGA] = 1;
fileHooks[FILE_LOGO_TGA] = _fopen(HOOK_FILE_NAME, mode);
return fileHooks[FILE_LOGO_TGA];
}
else
{
return _fopen("logo_red.tga", mode);
}
} }
if (strcmp(pathname, "/usr/lib/boot/LucidaConsole_12.tga") == 0) if (strcmp(pathname, "/usr/lib/boot/LucidaConsole_12.tga") == 0)
{ {
return _fopen("LucidaConsole_12.tga", mode); if (!getConfig()->disableBuiltinFont)
{
fileRead[FILE_FONT_TGA] = 0;
fileHooks[FILE_FONT_TGA] = _fopen(HOOK_FILE_NAME, mode);
return fileHooks[FILE_FONT_TGA];
}
else
{
return _fopen("LucidaConsole_12.tga", mode);
}
} }
if (strcmp(pathname, "/usr/lib/boot/LucidaConsole_12.abc") == 0) if (strcmp(pathname, "/usr/lib/boot/LucidaConsole_12.abc") == 0)
{ {
return _fopen("LucidaConsole_12.abc", mode); if (!getConfig()->disableBuiltinFont)
{
fileRead[FILE_FONT_ABC] = 0;
fileHooks[FILE_FONT_ABC] = _fopen(HOOK_FILE_NAME, mode);
return fileHooks[FILE_FONT_ABC];
}
else
{
return _fopen("LucidaConsole_12.abc", mode);
}
} }
if (strcmp(pathname, "/proc/cpuinfo") == 0) if (strcmp(pathname, "/proc/cpuinfo") == 0)
@@ -397,18 +472,32 @@ FILE *fopen(const char *restrict pathname, const char *restrict mode)
return fileHooks[CPUINFO]; return fileHooks[CPUINFO];
} }
if (strcmp(pathname, "/usr/lib/boot/logo_red.tga") == 0)
{
return _fopen("logo_red.tga", mode);
}
if (strcmp(pathname, "/usr/lib/boot/SEGA_KakuGothic-DB-Roman_12.tga") == 0) if (strcmp(pathname, "/usr/lib/boot/SEGA_KakuGothic-DB-Roman_12.tga") == 0)
{ {
return _fopen("SEGA_KakuGothic-DB-Roman_12.tga", mode); if (!getConfig()->disableBuiltinFont)
{
fileRead[FILE_FONT_TGA] = 0;
fileHooks[FILE_FONT_TGA] = _fopen(HOOK_FILE_NAME, mode);
return fileHooks[FILE_FONT_TGA];
}
else
{
return _fopen("SEGA_KakuGothic-DB-Roman_12.tga", mode);
}
} }
if (strcmp(pathname, "/usr/lib/boot/SEGA_KakuGothic-DB-Roman_12.abc") == 0) if (strcmp(pathname, "/usr/lib/boot/SEGA_KakuGothic-DB-Roman_12.abc") == 0)
{ {
return _fopen("SEGA_KakuGothic-DB-Roman_12.abc", mode); if (!getConfig()->disableBuiltinFont)
{
fileRead[FILE_FONT_ABC] = 0;
fileHooks[FILE_FONT_ABC] = _fopen(HOOK_FILE_NAME, mode);
return fileHooks[FILE_FONT_ABC];
}
else
{
return _fopen("SEGA_KakuGothic-DB-Roman_12.abc", mode);
}
} }
if (strcmp(pathname, "/proc/bus/pci/00/1f.0") == 0) if (strcmp(pathname, "/proc/bus/pci/00/1f.0") == 0)
@@ -477,8 +566,7 @@ FILE *fopen(const char *restrict pathname, const char *restrict mode)
} }
int gId = getConfig()->crc32; int gId = getConfig()->crc32;
if (gId == INITIALD_5_EXP_30 || gId == INITIALD_5_EXP_40 || gId == INITIALD_5_JAP_REVA || 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)
gId == INITIALD_5_JAP_REVF)
{ {
if (strncmp(pathname, "/tmp/", 5) == 0) if (strncmp(pathname, "/tmp/", 5) == 0)
{ {
@@ -505,22 +593,58 @@ FILE *fopen64(const char *pathname, const char *mode)
if (strcmp(pathname, "/usr/lib/boot/logo_red.tga") == 0) if (strcmp(pathname, "/usr/lib/boot/logo_red.tga") == 0)
{ {
return _fopen64("logo_red.tga", mode); if (!getConfig()->disableBuiltinLogos)
{
fileRead[FILE_LOGO_TGA] = 1;
fileHooks[FILE_LOGO_TGA] = _fopen64(HOOK_FILE_NAME, mode);
return fileHooks[FILE_LOGO_TGA];
}
else
{
return _fopen64("logo_red.tga", mode);
}
} }
if (strcmp(pathname, "/usr/lib/boot/logo.tga") == 0) if (strcmp(pathname, "/usr/lib/boot/logo.tga") == 0)
{ {
return _fopen64("logo.tga", mode); if (!getConfig()->disableBuiltinLogos)
{
fileRead[FILE_LOGO_TGA] = 0;
fileHooks[FILE_LOGO_TGA] = _fopen64(HOOK_FILE_NAME, mode);
return fileHooks[FILE_LOGO_TGA];
}
else
{
return _fopen64("logo.tga", mode);
}
} }
if (strcmp(pathname, "/usr/lib/boot/SEGA_KakuGothic-DB-Roman_12.tga") == 0) if (strcmp(pathname, "/usr/lib/boot/SEGA_KakuGothic-DB-Roman_12.tga") == 0)
{ {
return _fopen64("SEGA_KakuGothic-DB-Roman_12.tga", mode); if (!getConfig()->disableBuiltinFont)
{
fileRead[FILE_FONT_TGA] = 0;
fileHooks[FILE_FONT_TGA] = _fopen64(HOOK_FILE_NAME, mode);
return fileHooks[FILE_FONT_TGA];
}
else
{
return _fopen64("SEGA_KakuGothic-DB-Roman_12.tga", mode);
}
} }
if (strcmp(pathname, "/usr/lib/boot/SEGA_KakuGothic-DB-Roman_12.abc") == 0) if (strcmp(pathname, "/usr/lib/boot/SEGA_KakuGothic-DB-Roman_12.abc") == 0)
{ {
return _fopen64("SEGA_KakuGothic-DB-Roman_12.abc", mode); if (!getConfig()->disableBuiltinFont)
{
fileRead[FILE_FONT_ABC] = 0;
fileHooks[FILE_FONT_ABC] = _fopen64(HOOK_FILE_NAME, mode);
return fileHooks[FILE_FONT_ABC];
}
else
{
return _fopen64("SEGA_KakuGothic-DB-Roman_12.abc", mode);
}
} }
if ((getConfig()->crc32 == HUMMER) || (getConfig()->crc32 == HUMMER_SDLX) || if ((getConfig()->crc32 == HUMMER) || (getConfig()->crc32 == HUMMER_SDLX) ||
@@ -555,13 +679,19 @@ FILE *fopen64(const char *pathname, const char *mode)
int fclose(FILE *stream) int fclose(FILE *stream)
{ {
int (*_fclose)(FILE *stream) = dlsym(RTLD_NEXT, "fclose"); int (*_fclose)(FILE *stream) = dlsym(RTLD_NEXT, "fclose");
for (int i = 0; i < 7; i++) for (int i = 0; i < 9; i++)
{ {
if (fileHooks[i] == stream) if (fileHooks[i] == stream)
{ {
int r = _fclose(stream); int r = _fclose(stream);
fileHooks[i] = NULL; fileHooks[i] = NULL;
fileRead[i] = 0; fileRead[i] = 0;
if (stream == fileHooks[FILE_FONT_ABC])
fontABCidx = 0;
if (stream == fileHooks[FILE_FONT_TGA])
fontTGAidx = 0;
if (stream == fileHooks[FILE_LOGO_TGA])
logoTGAidx = 0;
return r; return r;
} }
} }
@@ -653,6 +783,16 @@ ssize_t read(int fd, void *buf, size_t count)
return driveboardRead(fd, buf, count); return driveboardRead(fd, buf, count);
} }
if (fd == hooks[SERIAL0] && getConfig()->emulateCardreader)
{
return cardReaderRead(fd, buf, count);
}
if (fd == hooks[SERIAL1] && getConfig()->emulateCardreader)
{
return cardReaderRead(fd, buf, count);
}
// If we don't hook the serial just reply with nothing // If we don't hook the serial just reply with nothing
if (fd == hooks[SERIAL0] || fd == hooks[SERIAL1]) if (fd == hooks[SERIAL0] || fd == hooks[SERIAL1])
{ {
@@ -693,6 +833,30 @@ size_t fread(void *buf, size_t size, size_t count, FILE *stream)
return harleyFreadReplace(buf, size, count, fileHooks[FILE_HARLEY]); return harleyFreadReplace(buf, size, count, fileHooks[FILE_HARLEY]);
} }
if (stream == fileHooks[FILE_FONT_ABC])
{
memcpy(buf, fontABC + fontABCidx, size * count);
fontABCidx += (size * count);
return size * count;
}
if (stream == fileHooks[FILE_FONT_TGA])
{
memcpy(buf, fontTGA + fontTGAidx, size * count);
fontTGAidx += (size * count);
return size * count;
}
if (stream == fileHooks[FILE_LOGO_TGA])
{
if (fileRead[FILE_LOGO_TGA] == 0)
memcpy(buf, logoLL + logoTGAidx, size * count);
else
memcpy(buf, logoLLRed + logoTGAidx, size * count);
logoTGAidx += (size * count);
return size * count;
}
return _fread(buf, size, count, stream); return _fread(buf, size, count, stream);
} }
@@ -709,9 +873,50 @@ long int ftell(FILE *stream)
return ftellGetShaderSize(fileRead[FILE_RW2]); return ftellGetShaderSize(fileRead[FILE_RW2]);
} }
if (stream == fileHooks[FILE_FONT_ABC])
{
return fontABClen;
}
return _ftell(stream); return _ftell(stream);
} }
int fseek(FILE *stream, long int offset, int whence)
{
int (*_fseek)(FILE *stream, long int offset, int whence) = dlsym(RTLD_NEXT, "fseek");
if (stream == fileHooks[FILE_FONT_ABC])
{
switch (whence)
{
case SEEK_CUR:
break;
case SEEK_SET:
fontABCidx = 0;
break;
case SEEK_END:
fontABCidx = fontABClen;
break;
}
return fontABCidx;
}
return _fseek(stream, offset, whence);
}
void rewind(FILE *stream)
{
void (*_rewind)(FILE *stream) = dlsym(RTLD_NEXT, "rewind");
if (stream == fileHooks[FILE_FONT_ABC])
{
fontABCidx = 0;
return;
}
_rewind(stream);
}
ssize_t write(int fd, const void *buf, size_t count) ssize_t write(int fd, const void *buf, size_t count)
{ {
int (*_write)(int fd, const void *buf, size_t count) = dlsym(RTLD_NEXT, "write"); int (*_write)(int fd, const void *buf, size_t count) = dlsym(RTLD_NEXT, "write");
@@ -728,9 +933,25 @@ ssize_t write(int fd, const void *buf, size_t count)
if (fd == hooks[SERIAL0] && getConfig()->emulateDriveboard) if (fd == hooks[SERIAL0] && getConfig()->emulateDriveboard)
{ {
// printf("Write addr: %p\n", addr);
return driveboardWrite(fd, buf, count); return driveboardWrite(fd, buf, count);
} }
if (fd == hooks[SERIAL1] && getConfig()->emulateDriveboard && getConfig()->crc32 != R_TUNED)
{
return driveboardWrite(fd, buf, count);
}
if (fd == hooks[SERIAL0] && getConfig()->emulateCardreader)
{
return cardReaderWrite(fd, buf, count);
}
if (fd == hooks[SERIAL1] && getConfig()->emulateCardreader)
{
return cardReaderWrite(fd, buf, count);
}
return _write(fd, buf, count); return _write(fd, buf, count);
} }
@@ -738,15 +959,6 @@ int ioctl(int fd, unsigned int request, void *data)
{ {
int (*_ioctl)(int fd, int request, void *data) = dlsym(RTLD_NEXT, "ioctl"); int (*_ioctl)(int fd, int request, void *data) = dlsym(RTLD_NEXT, "ioctl");
// Attempt to stop access to the ethernet ports
if ((request == SIOCSIFADDR) || (request == SIOCSIFFLAGS) || (request == SIOCSIFHWADDR) ||
(request == SIOCSIFHWBROADCAST) || (request == SIOCDELRT) || (request == SIOCADDRT) ||
(request == SIOCSIFNETMASK))
{
errno = ENXIO;
return -1;
}
if (fd == hooks[EEPROM]) if (fd == hooks[EEPROM])
{ {
if (request == 0xC04064A0) if (request == 0xC04064A0)
@@ -762,12 +974,77 @@ int ioctl(int fd, unsigned int request, void *data)
// Just accept any IOCTL on serial ports and ignore it // Just accept any IOCTL on serial ports and ignore it
if (fd == hooks[SERIAL0] || fd == hooks[SERIAL1]) if (fd == hooks[SERIAL0] || fd == hooks[SERIAL1])
{ {
if (request == 0x541b && getConfig()->crc32 == R_TUNED && fd == hooks[SERIAL1])
{
uint8_t d = 1;
memcpy(data, &d, sizeof(uint8_t));
}
return 0; return 0;
} }
return _ioctl(fd, request, data); return _ioctl(fd, request, data);
} }
int tcgetattr(int fd, struct termios *termios_p)
{
int (*_tcgetattr)(int fd, struct termios *termios_p) = dlsym(RTLD_NEXT, "tcgetattr");
if (fd == hooks[SERIAL0] && getConfig()->emulateDriveboard == 1)
return 0;
return _tcgetattr(fd, termios_p);
}
int tcsetattr(int fd, int optional_actions, const struct termios *termios_p)
{
int (*_tcsetattr)(int fd, int optional_actions, const struct termios *termios_p) = dlsym(RTLD_NEXT, "tcsetattr");
if (fd == hooks[SERIAL0] && getConfig()->emulateDriveboard == 1)
return 0;
return _tcsetattr(fd, optional_actions, termios_p);
}
speed_t cfgetispeed(const struct termios *termios_p)
{
speed_t (*_cfgetispeed)(const struct termios *termios_p) = dlsym(RTLD_NEXT, "cfgetispeed");
if (getConfig()->emulateDriveboard == 1)
return B9600;
return _cfgetispeed(termios_p);
}
speed_t cfgetospeed(const struct termios *termios_p)
{
speed_t (*_cfgetospeed)(const struct termios *termios_p) = dlsym(RTLD_NEXT, "cfgetospeed");
if (getConfig()->emulateDriveboard == 1)
return B9600;
return _cfgetospeed(termios_p);
}
int cfsetispeed(struct termios *termios_p, speed_t speed)
{
int (*_cfsetispeed)(struct termios *termios_p, speed_t speed) = dlsym(RTLD_NEXT, "cfsetispeed");
if (getConfig()->emulateDriveboard == 1)
return 0;
return _cfsetispeed(termios_p, speed);
}
int cfsetospeed(struct termios *termios_p, speed_t speed)
{
int (*_cfsetospeed)(struct termios *termios_p, speed_t speed) = dlsym(RTLD_NEXT, "cfsetospeed");
if (getConfig()->emulateDriveboard == 1)
return 0;
return _cfsetospeed(termios_p, speed);
}
int select(int nfds, fd_set *restrict readfds, fd_set *restrict writefds, fd_set *restrict exceptfds, int select(int nfds, fd_set *restrict readfds, fd_set *restrict writefds, fd_set *restrict exceptfds,
struct timeval *restrict timeout) struct timeval *restrict timeout)
{ {
@@ -784,6 +1061,11 @@ int select(int nfds, fd_set *restrict readfds, fd_set *restrict writefds, fd_set
return baseboardSelect(nfds, readfds, writefds, exceptfds, timeout); return baseboardSelect(nfds, readfds, writefds, exceptfds, timeout);
} }
if (getConfig()->emulateCardreader == 1 || getConfig()->emulateDriveboard == 1)
{
return 1;
}
return _select(nfds, readfds, writefds, exceptfds, timeout); return _select(nfds, readfds, writefds, exceptfds, timeout);
} }
@@ -818,6 +1100,9 @@ int system(const char *command)
if (strstr(command, "losetup") != NULL) if (strstr(command, "losetup") != NULL)
return 0; return 0;
if (strstr(command, "check_ip.sh") != NULL)
return 0;
return _system(command); return _system(command);
} }
+73 -2
View File
@@ -451,6 +451,7 @@ void sdlEventDriving(SDL_Event *event)
break; break;
} }
} }
void sdlEventShooting(SDL_Event *event) void sdlEventShooting(SDL_Event *event)
{ {
KeyMapping keymap = getConfig()->keymap; KeyMapping keymap = getConfig()->keymap;
@@ -585,13 +586,22 @@ void sdlEventShooting(SDL_Event *event)
case SDL_MOUSEBUTTONUP: case SDL_MOUSEBUTTONUP:
{ {
if (event->button.button == SDL_BUTTON_LEFT) // Trigger if (event->button.button == SDL_BUTTON_LEFT) // Trigger
{
setSwitch(PLAYER_1, BUTTON_1, event->type == SDL_MOUSEBUTTONDOWN); setSwitch(PLAYER_1, BUTTON_1, event->type == SDL_MOUSEBUTTONDOWN);
}
else if (event->button.button == SDL_BUTTON_RIGHT) // Reload else if (event->button.button == SDL_BUTTON_RIGHT) // Reload
{
if (getConfig()->crc32 == RAMBO || getConfig()->crc32 == TOO_SPICY)
{
setAnalogue(ANALOGUE_1, -1);
setAnalogue(ANALOGUE_2, -1);
}
setSwitch(PLAYER_1, BUTTON_2, event->type == SDL_MOUSEBUTTONDOWN); setSwitch(PLAYER_1, BUTTON_2, event->type == SDL_MOUSEBUTTONDOWN);
}
else if (event->button.button == SDL_BUTTON_MIDDLE) // Extra Gun Button else if (event->button.button == SDL_BUTTON_MIDDLE) // Extra Gun Button
{
setSwitch(PLAYER_1, BUTTON_3, event->type == SDL_MOUSEBUTTONDOWN); setSwitch(PLAYER_1, BUTTON_3, event->type == SDL_MOUSEBUTTONDOWN);
}
} }
break; break;
default: default:
@@ -654,6 +664,64 @@ void sdlEventABC(SDL_Event *event)
} }
} }
void sdlEventHarley(SDL_Event *event)
{
switch (event->type)
{
case SDL_KEYDOWN:
case SDL_KEYUP:
{
if (event->key.keysym.sym == SDLK_t)
setSwitch(SYSTEM, BUTTON_TEST, event->type == SDL_KEYDOWN);
else if (event->key.keysym.sym == SDLK_s)
setSwitch(PLAYER_1, BUTTON_SERVICE, event->type == SDL_KEYDOWN);
else if (event->key.keysym.sym == SDLK_5)
incrementCoin(PLAYER_1, event->type == SDL_KEYDOWN);
else if (event->key.keysym.sym == SDLK_1)
setSwitch(PLAYER_1, BUTTON_START, event->type == SDL_KEYDOWN);
else if (event->key.keysym.sym == SDLK_UP)
setAnalogue(ANALOGUE_1, event->type == SDL_KEYDOWN ? pow(2, jvsAnalogueInBits) - 1 : 0);
else if (event->key.keysym.sym == SDLK_DOWN)
setAnalogue(ANALOGUE_4, event->type == SDL_KEYDOWN ? pow(2, jvsAnalogueInBits) - 1 : 0);
else if (event->key.keysym.sym == SDLK_LEFT)
setAnalogue(ANALOGUE_2, event->type == SDL_KEYDOWN ? pow(2, jvsAnalogueInBits) * 0.2 : pow(2, jvsAnalogueInBits) * 0.5);
else if (event->key.keysym.sym == SDLK_RIGHT)
setAnalogue(ANALOGUE_2, event->type == SDL_KEYDOWN ? pow(2, jvsAnalogueInBits) * 0.8 : pow(2, jvsAnalogueInBits) * 0.5);
else if (event->key.keysym.sym == SDLK_q)
setSwitch(PLAYER_1, BUTTON_1, event->type == SDL_KEYDOWN);
else if (event->key.keysym.sym == SDLK_w)
setSwitch(PLAYER_1, BUTTON_2, event->type == SDL_KEYDOWN);
else if (event->key.keysym.sym == SDLK_e)
setSwitch(PLAYER_1, BUTTON_3, event->type == SDL_KEYDOWN);
else if (event->key.keysym.sym == SDLK_r)
setSwitch(PLAYER_1, BUTTON_4, event->type == SDL_KEYDOWN);
else if (event->key.keysym.sym == SDLK_z)
setSwitch(PLAYER_1, BUTTON_DOWN, event->type == SDL_KEYDOWN); // Hummer - SegaTV view change
else if (event->key.keysym.sym == SDLK_x)
setSwitch(PLAYER_1, BUTTON_UP, event->type == SDL_KEYDOWN);
else if (event->key.keysym.sym == SDLK_c)
setSwitch(PLAYER_1, BUTTON_LEFT, event->type == SDL_KEYDOWN);
else if (event->key.keysym.sym == SDLK_v)
setSwitch(PLAYER_1, BUTTON_RIGHT, event->type == SDL_KEYDOWN);
else if (event->key.keysym.sym == SDLK_a)
setSwitch(PLAYER_2, BUTTON_1, event->type == SDL_KEYDOWN); // SegaTV boost
else if (event->key.keysym.sym == SDLK_LCTRL)
setSwitch(PLAYER_2, BUTTON_DOWN, event->type == SDL_KEYDOWN); // Hummer boost
else if (event->key.keysym.sym == SDLK_SPACE)
setSwitch(PLAYER_2, BUTTON_UP, event->type == SDL_KEYDOWN);
}
break;
default:
break;
}
}
void sdlEventMahjong(SDL_Event *event) void sdlEventMahjong(SDL_Event *event)
{ {
switch (event->type) switch (event->type)
@@ -766,6 +834,9 @@ void handleSdlEvents(SDL_Event *event)
case ABC: case ABC:
sdlEventABC(event); sdlEventABC(event);
break; break;
case HARLEY:
sdlEventHarley(event);
break;
case MAHJONG: case MAHJONG:
sdlEventMahjong(event); sdlEventMahjong(event);
break; break;
+19 -2
View File
@@ -1,4 +1,5 @@
#include <dirent.h> #include <dirent.h>
#include <limits.h>
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>
#include <string.h> #include <string.h>
@@ -12,6 +13,7 @@
#define LD_PRELOAD "LD_PRELOAD" #define LD_PRELOAD "LD_PRELOAD"
#define PRELOAD_FILE_NAME "lindbergh.so" #define PRELOAD_FILE_NAME "lindbergh.so"
#define TEAM "bobbydilley, retrofan, dkeruza-neo, doozer, francesco, rolel, caviar-x" #define TEAM "bobbydilley, retrofan, dkeruza-neo, doozer, francesco, rolel, caviar-x"
#define LINDBERGH_CONFIG_PATH "LINDBERGH_CONFIG_PATH"
uint32_t elf_crc = 0; uint32_t elf_crc = 0;
@@ -119,6 +121,7 @@ void printUsage(char *argv[])
printf(" --list-controllers Lists available controllers and inputs\n"); printf(" --list-controllers Lists available controllers and inputs\n");
printf(" --version Displays the version of the loader and team's names\n"); printf(" --version Displays the version of the loader and team's names\n");
printf(" --help Displays this usage text\n"); printf(" --help Displays this usage text\n");
printf(" --config | -c Specifies configuration path\n");
} }
/** /**
@@ -248,8 +251,9 @@ int main(int argc, char *argv[])
int gdb = 0; int gdb = 0;
int forceGame = 0; int forceGame = 0;
int segaboot = 0; int segaboot = 0;
char extConfigPath[PATH_MAX] = {0};
char forceGamePath[128] = {0}; char forceGamePath[128] = {0};
for (int i = 1; i < argc; i++) for (int i = 1; i < argc; i++)
{ {
if (strcmp(argv[i], "-t") == 0 || strcmp(argv[i], "--test") == 0) if (strcmp(argv[i], "-t") == 0 || strcmp(argv[i], "--test") == 0)
@@ -269,7 +273,16 @@ int main(int argc, char *argv[])
gdb = 1; gdb = 1;
continue; continue;
} }
if (strcmp(argv[i], "-c") == 0 || strcmp(argv[i], "--config") == 0)
{
if (i+1 >= argc)
{
break;
}
strncpy(extConfigPath, argv[i+1], PATH_MAX);
i += 1;
continue;
}
// Treat the argument as the game name // Treat the argument as the game name
strcpy(forceGamePath, argv[i]); strcpy(forceGamePath, argv[i]);
forceGame = 1; forceGame = 1;
@@ -305,6 +318,10 @@ int main(int argc, char *argv[])
strcat(temp, command); strcat(temp, command);
strcpy(command, temp); strcpy(command, temp);
} }
if (extConfigPath[0] != '\0')
{
setenv(LINDBERGH_CONFIG_PATH,extConfigPath,1);
}
log_info("Starting $ %s", command); log_info("Starting $ %s", command);
-1
View File
@@ -4,7 +4,6 @@
#include <stdarg.h> #include <stdarg.h>
#include <stdio.h> #include <stdio.h>
#include <time.h>
// Structure to hold the formatted message and its size // Structure to hold the formatted message and its size
+216 -22
View File
@@ -1,11 +1,13 @@
#ifndef _GNU_SOURCE #ifndef _GNU_SOURCE
#define _GNU_SOURCE #define _GNU_SOURCE
#include <SDL2/SDL_events.h>
#endif #endif
#include <time.h> #include <time.h>
#define GL_GLEXT_PROTOTYPES #define GL_GLEXT_PROTOTYPES
#include "patch.h" #include "patch.h"
#include <GL/glx.h> #include <GL/glx.h>
#include <SDL2/SDL.h>
#include <dlfcn.h> #include <dlfcn.h>
#include <stdarg.h> #include <stdarg.h>
@@ -28,6 +30,7 @@ char elfID[4];
void *amDipswContextAddr; void *amDipswContextAddr;
extern void *glVertex3fPatchRetAddrABC[4]; extern void *glVertex3fPatchRetAddrABC[4];
extern void *glVertex3fNoPatchRetAddrABC[4]; extern void *glVertex3fNoPatchRetAddrABC[4];
void *hod4CursorHideShowCAVEAddress;
void setVariable(size_t address, size_t value) void setVariable(size_t address, size_t value)
{ {
@@ -173,7 +176,7 @@ int amDongleUpdate()
int amDongleUserInfoEx(int a, int b, char *_arcadeContext) int amDongleUserInfoEx(int a, int b, char *_arcadeContext)
{ {
int gId = getConfig()->crc32; uint32_t gId = getConfig()->crc32;
char *gameID; char *gameID;
switch (gId) switch (gId)
{ {
@@ -197,8 +200,9 @@ int amDongleUserInfoEx(int a, int b, char *_arcadeContext)
case INITIALD_4_EXP_REVD: case INITIALD_4_EXP_REVD:
case INITIALD_5_JAP_REVA: case INITIALD_5_JAP_REVA:
case INITIALD_5_JAP_REVF: case INITIALD_5_JAP_REVF:
case INITIALD_5_EXP_30: case INITIALD_5_EXP:
case INITIALD_5_EXP_40: case INITIALD_5_EXP_20:
case INITIALD_5_EXP_20A:
memcpy(_arcadeContext, elfID, 4); memcpy(_arcadeContext, elfID, 4);
break; break;
default: default:
@@ -255,15 +259,17 @@ int amDipswGetData(uint8_t *dip)
securityBoardIn(0x38, &data); securityBoardIn(0x38, &data);
result = (~data & 4) != 0; // Test Button result = 0x00;
if ((~data & 8) != 0)
result |= 2; // Service Button
if ((~data & 0x10) != 0) if ((~data & 0x10) != 0)
result |= 4; // ?? result |= 0x01; // Dip 7
if ((char)data >= 0) if ((~data & 0x20) != 0)
result |= 8; // ?? result |= 0x02; // Dip 8
if ((~data & 0x40) != 0)
result |= 0x04; // Dip 1
if ((~data & 0x80) != 0)
result |= 0x08; // Dip 2
if ((~data & 0x100) != 0) if ((~data & 0x100) != 0)
result |= 0x10; // Rotation result |= 0x10; // Rotation Dip 3
if ((~data & 0x200) != 0) if ((~data & 0x200) != 0)
result |= 0x20; // Resolution Dip 4 result |= 0x20; // Resolution Dip 4
if ((~data & 0x400) != 0) if ((~data & 0x400) != 0)
@@ -344,6 +350,75 @@ int patchedPuts(char *s)
return ret; return ret;
} }
__attribute__((naked)) void hod4CursorHideShowFixCAVE(int param1)
{
__asm__ volatile("push %%edi\n\tpush %%esi\n\tpush %%ebx\n\tsub $0x18, %%esp\n\tjmp *%0\n\t" ::"m"(hod4CursorHideShowCAVEAddress));
}
uint32_t hod4PrevValue;
bool hod4InTutorial = false;
void hod4CursorHideShow(int param1)
{
uint32_t value = *(unsigned int *)(uintptr_t)(param1 + 0x38);
if (!getConfig()->hideCursor)
{
switch (value)
{
case 0:
{
if (hod4PrevValue != 3 || hod4InTutorial)
{
SDL_ShowCursor(SDL_DISABLE);
}
hod4PrevValue = 0;
}
break;
case 3:
{
if (!hod4InTutorial)
{
SDL_ShowCursor(SDL_ENABLE);
hod4PrevValue = 3;
}
}
break;
case 4:
{
hod4InTutorial = false;
}
case 2:
case 5:
case 11:
{
SDL_ShowCursor(SDL_DISABLE);
}
}
}
hod4CursorHideShowFixCAVE(param1);
}
int hod4VsPrintf(char *str, const char *format, va_list arg)
{
int (*_vsprintf)(char *str, const char *format, va_list arg) = dlsym(RTLD_NEXT, "vsprintf");
int res = _vsprintf(str, format, arg);
if (strcmp(str, "free : tutorial\n") == 0)
{
hod4InTutorial = false;
}
if (strcmp(str, "entry : tutorial\n") == 0)
{
hod4InTutorial = true;
}
return res;
}
int initPatch() int initPatch()
{ {
EmulatorConfig *config = getConfig(); EmulatorConfig *config = getConfig();
@@ -773,6 +848,19 @@ int initPatch()
// patchMemory(0x0828a92a, "9090909090"); // IzPadServerExecute // patchMemory(0x0828a92a, "9090909090"); // IzPadServerExecute
// patchMemory(0x0828a936, "9090909090"); // IzMouseServerExecute // patchMemory(0x0828a936, "9090909090"); // IzMouseServerExecute
// patchMemory(0x0828a942, "9090909090"); // IzKeybdServerExecute // patchMemory(0x0828a942, "9090909090"); // IzKeybdServerExecute
if (!getConfig()->hideCursor)
{
hod4CursorHideShowCAVEAddress = (void *)0x08161c98 + 6;
detourFunction(0x08161c98, hod4CursorHideShow);
detourFunction(0x0804be14, hod4VsPrintf);
}
if (getConfig()->cpuFreqGhz != 0.0f)
{
uint32_t cpuFreq = (uint32_t)(getConfig()->cpuFreqGhz * 998000000.0);
setVariable(0x0828ea13, cpuFreq);
}
} }
break; break;
case THE_HOUSE_OF_THE_DEAD_4_REVA_TEST: case THE_HOUSE_OF_THE_DEAD_4_REVA_TEST:
@@ -843,10 +931,33 @@ int initPatch()
// patchMemory(0x082852b2, "9090909090"); // IzPadServerExecute // patchMemory(0x082852b2, "9090909090"); // IzPadServerExecute
// patchMemory(0x082852be, "9090909090"); // IzMouseServerExecute // patchMemory(0x082852be, "9090909090"); // IzMouseServerExecute
// patchMemory(0x082852ca, "9090909090"); // IzKeybdServerExecute // patchMemory(0x082852ca, "9090909090"); // IzKeybdServerExecute
if (!getConfig()->hideCursor)
{
hod4CursorHideShowCAVEAddress = (void *)0x08162494 + 6;
detourFunction(0x08162494, hod4CursorHideShow);
detourFunction(0x0804be04, hod4VsPrintf);
}
if (getConfig()->cpuFreqGhz != 0.0f)
{
uint32_t cpuFreq = (uint32_t)(getConfig()->cpuFreqGhz * 998000000.0);
setVariable(0x08289353, cpuFreq);
}
} }
break; break;
case THE_HOUSE_OF_THE_DEAD_4_REVB_TEST: case THE_HOUSE_OF_THE_DEAD_4_REVB_TEST:
{ {
detourFunction(0x0806228c, amDongleInit);
detourFunction(0x0806259f, amDongleIsAvailable);
detourFunction(0x08062506, amDongleUpdate);
// // Fixes
amDipswContextAddr = (void *)0x080980e8; // Address of amDipswContext
detourFunction(0x08062034, amDipswInit);
detourFunction(0x080620c9, amDipswExit);
detourFunction(0x0806213f, amDipswGetData);
detourFunction(0x080621b7, amDipswSetLed);
// CPU patch to support AMD processors // CPU patch to support AMD processors
patchMemory(0x08049f4d, "9090909090"); //__intel_new_proc_init_P patchMemory(0x08049f4d, "9090909090"); //__intel_new_proc_init_P
} }
@@ -885,10 +996,33 @@ int initPatch()
// patchMemory(0x082852b2, "9090909090"); // IzPadServerExecute // patchMemory(0x082852b2, "9090909090"); // IzPadServerExecute
// patchMemory(0x082852be, "9090909090"); // IzMouseServerExecute // patchMemory(0x082852be, "9090909090"); // IzMouseServerExecute
// patchMemory(0x082852ca, "9090909090"); // IzKeybdServerExecute // patchMemory(0x082852ca, "9090909090"); // IzKeybdServerExecute
if (!getConfig()->hideCursor)
{
hod4CursorHideShowCAVEAddress = (void *)0x08162494 + 6;
detourFunction(0x08162494, hod4CursorHideShow);
detourFunction(0x0804be04, hod4VsPrintf);
}
if (getConfig()->cpuFreqGhz != 0.0f)
{
uint32_t cpuFreq = (uint32_t)(getConfig()->cpuFreqGhz * 998000000.0);
setVariable(0x08289353, cpuFreq);
}
} }
break; break;
case THE_HOUSE_OF_THE_DEAD_4_REVC_TEST: case THE_HOUSE_OF_THE_DEAD_4_REVC_TEST:
{ {
detourFunction(0x0806226c, amDongleInit);
detourFunction(0x0806257f, amDongleIsAvailable);
detourFunction(0x080624e6, amDongleUpdate);
// Fixes
amDipswContextAddr = (void *)0x080980c8; // Address of amDipswContext
detourFunction(0x08062014, amDipswInit);
detourFunction(0x080620a9, amDipswExit);
detourFunction(0x0806211f, amDipswGetData);
detourFunction(0x08062197, amDipswSetLed);
// CPU patch to support AMD processors // CPU patch to support AMD processors
patchMemory(0x08049f4d, "9090909090"); //__intel_new_proc_init_P patchMemory(0x08049f4d, "9090909090"); //__intel_new_proc_init_P
} }
@@ -912,6 +1046,11 @@ int initPatch()
// Shader Fixes // Shader Fixes
cacheModedShaderFiles(); cacheModedShaderFiles();
if (getConfig()->cpuFreqGhz != 0.0f)
{
uint32_t cpuFreq = (uint32_t)(getConfig()->cpuFreqGhz * 998000000.0);
setVariable(0x0826829b, cpuFreq);
}
} }
break; break;
case THE_HOUSE_OF_THE_DEAD_4_SPECIAL_TEST: case THE_HOUSE_OF_THE_DEAD_4_SPECIAL_TEST:
@@ -920,7 +1059,7 @@ int initPatch()
detourFunction(0x0806ecff, amDongleIsAvailable); detourFunction(0x0806ecff, amDongleIsAvailable);
detourFunction(0x0806ec66, amDongleUpdate); detourFunction(0x0806ec66, amDongleUpdate);
// Fixes // Fixes
amDipswContextAddr = (void *)0x0a6f3f0c; // Address of amDipswContext amDipswContextAddr = (void *)0x080b2e88; // Address of amDipswContext
detourFunction(0x0806e794, amDipswInit); detourFunction(0x0806e794, amDipswInit);
detourFunction(0x0806e829, amDipswExit); detourFunction(0x0806e829, amDipswExit);
detourFunction(0x0806e89f, amDipswGetData); detourFunction(0x0806e89f, amDipswGetData);
@@ -949,6 +1088,11 @@ int initPatch()
// Shader Fixes // Shader Fixes
cacheModedShaderFiles(); cacheModedShaderFiles();
if (getConfig()->cpuFreqGhz != 0.0f)
{
uint32_t cpuFreq = (uint32_t)(getConfig()->cpuFreqGhz * 998000000.0);
setVariable(0x082d019d, cpuFreq);
}
} }
break; break;
case THE_HOUSE_OF_THE_DEAD_4_SPECIAL_REVB_TEST: case THE_HOUSE_OF_THE_DEAD_4_SPECIAL_REVB_TEST:
@@ -1961,7 +2105,7 @@ int initPatch()
detourFunction(0x0870efbd, amDipswGetData); detourFunction(0x0870efbd, amDipswGetData);
detourFunction(0x0870f034, stubRetZero); // amDipswSetLed detourFunction(0x0870f034, stubRetZero); // amDipswSetLed
detourFunction(0x08230fde, stubRetOne); // isEthLinkUp detourFunction(0x08230fde, stubRetOne); // isEthLinkUp
// patchMemory(0x082df87d, "e954010000"); // tickWaitDHCP patchMemory(0x082df87d, "e954010000"); // tickWaitDHCP
patchMemory(0x082e0ec9, "eb60"); // tickInitAddress patchMemory(0x082e0ec9, "eb60"); // tickInitAddress
detourFunction(0x0821b3ea, stubRetOne); // Skip Kickback initialization detourFunction(0x0821b3ea, stubRetOne); // Skip Kickback initialization
setVariable(0x08580979, 0x000126e9); // Avoid Full Screen set from Game setVariable(0x08580979, 0x000126e9); // Avoid Full Screen set from Game
@@ -1983,7 +2127,65 @@ int initPatch()
detourFunction(0x08266098, stubRetOne); // isExistNewerSource (forces shader recompilation) detourFunction(0x08266098, stubRetOne); // isExistNewerSource (forces shader recompilation)
} }
break; break;
case INITIALD_5_EXP_30: case INITIALD_5_EXP:
{
if (config->showDebugMessages == 1)
{
setVariable(0x093a93f0, 2); // amBackupDebugLevel
setVariable(0x093a9400, 2); // amCreditDebugLevel
setVariable(0x093a9658, 2); // amDipswDebugLevel
setVariable(0x093a965c, 2); // amDongleDebugLevel
setVariable(0x093a9660, 2); // amEepromDebugLevel
setVariable(0x093a9664, 2); // amHwmonitorDebugLevel
setVariable(0x093a9668, 2); // amJvsDebugLevel
setVariable(0x093a966c, 2); // amLibDebugLevel
setVariable(0x093a9670, 2); // amMiscDebugLevel
setVariable(0x093a9678, 2); // amSysDataDebugLevel
setVariable(0x093a9680, 2); // bcLibDebugLevel
setVariable(0x093a9674, 2); // amOsinfoDebugLevel
setVariable(0x093a9684, 0x0FFFFFFF); // s_logMask
detourFunction(0x08745e28, _putConsoleSeparate); // Debug Messages
}
// Security
detourFunction(0x08911dca, amDongleInit);
detourFunction(0x08910815, amDongleIsAvailable);
detourFunction(0x08911279, amDongleUpdate);
detourFunction(0x08911c91, amDongleUserInfoEx);
memcpy(elfID, (void *)0x084e2407, 4); // Get gameID from the ELF
// Fixes
amDipswContextAddr = (void *)0x093d94c8;
detourFunction(0x089105a8, amDipswInit);
detourFunction(0x0891062c, amDipswExit);
detourFunction(0x089106a1, amDipswGetData);
detourFunction(0x08910718, amDipswSetLed); // amDipswSetLed
detourFunction(0x08322248, stubRetOne); // isEthLinkUp
detourFunction(0x083084a2, stubRetOne); // Skip Kickback initialization
patchMemory(0x084429d9, "eb60"); // tickInitAddress
patchMemory(0x0843fb34, "C0270900"); // tickInitStoreNetwork
detourFunction(0x084deddc, stubRetZero); // doesNeedRollerCleaning
detourFunction(0x084dedf8, stubRetZero); // doesNeedStockerCleaning
patchMemory(0x0843f5ad, "c7c300030000"); // Moves Initializing text
patchMemory(0x089e314c, "47f3"); // Skips initialization
patchMemory(0x08789a49, "e92601000090"); // Prevents Full Screen set from the game
// Mesa Patches
if (getConfig()->GPUVendor != NVIDIA_GPU)
{
detourFunction(0x0807a3f0, gl_MultiTexCoord2fARB);
detourFunction(0x0807a470, gl_Color4ub);
detourFunction(0x0807a6b0, gl_Vertex3f);
detourFunction(0x0807ae10, gl_TexCoord2f);
detourFunction(0x0807aed0, cg_GLIsProfileSupported);
patchMemory(0x087450ef, "9090");
cacheModedShaderFiles();
}
detourFunction(0x08389544, stubRetOne); // isExistNewerSource
detourFunction(0x0807b370, gl_XGetProcAddressARB);
patchMemory(0x08744f2e, "00"); // Fix cutscenes
}
break;
case INITIALD_5_EXP_20:
{ {
if (config->showDebugMessages == 1) if (config->showDebugMessages == 1)
{ {
@@ -2049,7 +2251,7 @@ int initPatch()
patchMemory(0x08761a7e, "00"); // Fix cutscenes patchMemory(0x08761a7e, "00"); // Fix cutscenes
} }
break; break;
case INITIALD_5_EXP_40: case INITIALD_5_EXP_20A:
{ {
if (config->showDebugMessages == 1) if (config->showDebugMessages == 1)
{ {
@@ -2285,8 +2487,6 @@ int initPatch()
detourFunction(0x0831bf2f, amDipswGetData); detourFunction(0x0831bf2f, amDipswGetData);
detourFunction(0x0831bfa7, stubRetZero); detourFunction(0x0831bfa7, stubRetZero);
setVariable(0x0827a7c7, 0x34891beb); // Disable Fullscreen set from the game setVariable(0x0827a7c7, 0x34891beb); // Disable Fullscreen set from the game
detourFunction(0x081164b6, stubReturn); // patch cards to skip SIGFAULT
detourFunction(0x08116366, stubRetZero); // patch cards to skip SIGFAULT
detourFunction(0x08177acc, stubRetOne); // Patch seterror detourFunction(0x08177acc, stubRetOne); // Patch seterror
@@ -2357,8 +2557,6 @@ int initPatch()
detourFunction(0x0831bfd3, amDipswGetData); detourFunction(0x0831bfd3, amDipswGetData);
detourFunction(0x0831c04b, stubRetZero); detourFunction(0x0831c04b, stubRetZero);
setVariable(0x0827a7f7, 0x34891beb); // Disable Fullscreen set from the game setVariable(0x0827a7f7, 0x34891beb); // Disable Fullscreen set from the game
detourFunction(0x081164e6, stubReturn); // patch cards to skip SIGFAULT
detourFunction(0x08116396, stubRetZero); // patch cards to skip SIGFAULT
detourFunction(0x08177afc, stubRetOne); // Patch seterror detourFunction(0x08177afc, stubRetOne); // Patch seterror
// Mesa // Mesa
@@ -2428,8 +2626,6 @@ int initPatch()
detourFunction(0x0831c1bf, amDipswGetData); detourFunction(0x0831c1bf, amDipswGetData);
detourFunction(0x0831c237, stubRetZero); detourFunction(0x0831c237, stubRetZero);
setVariable(0x0827a9e3, 0x34891beb); // Disable Fullscreen set from the game setVariable(0x0827a9e3, 0x34891beb); // Disable Fullscreen set from the game
detourFunction(0x081165c2, stubReturn); // patch cards to skip SIGFAULT
detourFunction(0x08116472, stubRetZero); // patch cards to skip SIGFAUL
detourFunction(0x08177bf0, stubRetOne); // Patch seterror detourFunction(0x08177bf0, stubRetOne); // Patch seterror
// Mesa // Mesa
@@ -2499,8 +2695,6 @@ int initPatch()
detourFunction(0x0831c5d7, amDipswGetData); detourFunction(0x0831c5d7, amDipswGetData);
detourFunction(0x0831c64f, stubRetZero); detourFunction(0x0831c64f, stubRetZero);
setVariable(0x0827ae1b, 0x34891beb); // Disable Fullscreen set from the game setVariable(0x0827ae1b, 0x34891beb); // Disable Fullscreen set from the game
detourFunction(0x081165ee, stubReturn); // patch cards to skip SIGFAULT
detourFunction(0x0811649e, stubRetZero); // patch cards to skip SIGFAULT
detourFunction(0x08177c1c, stubRetOne); // Patch seterror detourFunction(0x08177c1c, stubRetOne); // Patch seterror
// Mesa // Mesa
+413 -110
View File
@@ -146,23 +146,48 @@ void glOrtho(GLdouble left, GLdouble right, GLdouble bottom, GLdouble top, GLdou
switch (getConfig()->crc32) switch (getConfig()->crc32)
{ {
case THE_HOUSE_OF_THE_DEAD_4_REVA:
case THE_HOUSE_OF_THE_DEAD_4_REVB:
case THE_HOUSE_OF_THE_DEAD_4_REVC:
{
if ((getConfig()->width != 1280 && getConfig()->height != 768) || (getConfig()->width != 640 && getConfig()->height != 480))
{
right = 1280.0;
bottom = 720.0;
}
}
break;
case THE_HOUSE_OF_THE_DEAD_4_SPECIAL: case THE_HOUSE_OF_THE_DEAD_4_SPECIAL:
case THE_HOUSE_OF_THE_DEAD_4_SPECIAL_REVB: case THE_HOUSE_OF_THE_DEAD_4_SPECIAL_REVB:
{ {
if (right == 1024.0 && bottom == 768.0) if (getConfig()->width != 1024 && getConfig()->height != 768)
{ {
right = 800.0; if (right == 1024.0 && bottom == 768.0)
bottom = 600.0; {
right = 800.0;
bottom = 600.0;
}
} }
} }
break; break;
case SEGA_RACE_TV: case SEGA_RACE_TV:
{ {
if ((right == 640.0 && bottom == 480.0) && (getConfig()->width != 640 && getConfig()->height != 480)) if (getConfig()->width != 640 && getConfig()->height != 480)
{ {
right = 600000.0; if ((right == 640.0 && bottom == 480.0) && (getConfig()->width != 640 && getConfig()->height != 480))
bottom = 600000.0; {
right = 600000.0;
bottom = 600000.0;
}
}
}
break;
case THE_HOUSE_OF_THE_DEAD_EX:
{
if (getConfig()->width != 1280 && getConfig()->height != 768)
{
right = 600.0;
bottom = 480.0;
} }
} }
break; break;
@@ -188,10 +213,13 @@ void glViewport(GLint x, GLint y, GLsizei width, GLsizei height)
case HUMMER: case HUMMER:
case HUMMER_SDLX: case HUMMER_SDLX:
{ {
if (width == 1280 && height == 768) if (getConfig()->width != 1280 && getConfig()->height != 768)
{ {
width = getConfig()->width; if (width == 1280 && height == 768)
height = getConfig()->height; {
width = getConfig()->width;
height = getConfig()->height;
}
} }
} }
break; break;
@@ -201,61 +229,61 @@ void glViewport(GLint x, GLint y, GLsizei width, GLsizei height)
case OUTRUN_2_SP_SDX_REVA_TEST: case OUTRUN_2_SP_SDX_REVA_TEST:
case OUTRUN_2_SP_SDX_REVA_TEST2: case OUTRUN_2_SP_SDX_REVA_TEST2:
{ {
if ((width >= 800) && (width != 1024)) if (getConfig()->width != 800 && getConfig()->height != 480)
{ {
width = getConfig()->width; if ((width >= 800) && (width != 1024))
height = getConfig()->height; {
width = getConfig()->width;
height = getConfig()->height;
}
} }
} }
break; break;
case SEGA_RACE_TV: case SEGA_RACE_TV:
{ {
if (width == 640 && height == 480 && returnAddress == (void *)0x08123932) if (getConfig()->width != 640 && getConfig()->height != 480)
{ {
x = srtvX; if (width == 640 && height == 480 && returnAddress == (void *)0x08123932)
width = srtvW; {
height = srtvH; x = srtvX;
} width = srtvW;
else if (width > 640) height = srtvH;
{ }
width = 0; else if (width > 640)
height = 0; {
} width = 0;
} height = 0;
break; }
case THE_HOUSE_OF_THE_DEAD_4_REVA:
case THE_HOUSE_OF_THE_DEAD_4_REVA_TEST:
case THE_HOUSE_OF_THE_DEAD_4_REVB:
case THE_HOUSE_OF_THE_DEAD_4_REVB_TEST:
case THE_HOUSE_OF_THE_DEAD_4_REVC:
case THE_HOUSE_OF_THE_DEAD_4_REVC_TEST:
{
if (width == 640 && height == 480)
{
width = getConfig()->width;
height = getConfig()->height;
} }
} }
break; break;
// case THE_HOUSE_OF_THE_DEAD_4_REVA:
// case THE_HOUSE_OF_THE_DEAD_4_REVA_TEST:
// case THE_HOUSE_OF_THE_DEAD_4_REVB:
// case THE_HOUSE_OF_THE_DEAD_4_REVB_TEST:
// case THE_HOUSE_OF_THE_DEAD_4_REVC:
// case THE_HOUSE_OF_THE_DEAD_4_REVC_TEST:
// {
// if (width == 640 && height == 480)
// {
// width = getConfig()->width;
// height = getConfig()->height;
// }
// }
// break;
case THE_HOUSE_OF_THE_DEAD_4_SPECIAL: case THE_HOUSE_OF_THE_DEAD_4_SPECIAL:
case THE_HOUSE_OF_THE_DEAD_4_SPECIAL_REVB: case THE_HOUSE_OF_THE_DEAD_4_SPECIAL_REVB:
{ {
if (width == 1024 && height == 768) if (getConfig()->width != 1024 && getConfig()->height != 768)
{ {
width = getConfig()->width; if (width == 1024 && height == 768)
height = getConfig()->height; {
x = 250; width = getConfig()->width;
y = 100; height = getConfig()->height;
} x = 250;
} y = 100;
break; }
case LETS_GO_JUNGLE:
{
if (width == 1360 && height == 768)
{
width = getConfig()->width;
height = getConfig()->height;
} }
} }
break; break;
@@ -264,11 +292,14 @@ void glViewport(GLint x, GLint y, GLsizei width, GLsizei height)
case VIRTUA_FIGHTER_5_FINAL_SHOWDOWN_REVB_6000: case VIRTUA_FIGHTER_5_FINAL_SHOWDOWN_REVB_6000:
case VIRTUA_FIGHTER_5_R: case VIRTUA_FIGHTER_5_R:
case VIRTUA_FIGHTER_5_R_REVD: case VIRTUA_FIGHTER_5_R_REVD:
case VIRTUA_FIGHTER_5_R_REVG: case VIRTUA_FIGHTER_5_R_REVG:
{ {
if (width == vf5FSwidth) if ((getConfig()->width != 640 && getConfig()->height != 480) || (getConfig()->width != 1280 && getConfig()->height != 768))
{ {
width = getConfig()->width; if (width == vf5FSwidth)
{
width = getConfig()->width;
}
} }
} }
break; break;
@@ -285,21 +316,24 @@ void glTexImage2D(unsigned int target, int level, int internalformat, int width,
void (*_glTexImage2D)(unsigned int target, int level, int internalformat, int width, int height, int border, unsigned int format, void (*_glTexImage2D)(unsigned int target, int level, int internalformat, int width, int height, int border, unsigned int format,
unsigned int type, const void *pixels) = dlsym(RTLD_NEXT, "glTexImage2D"); unsigned int type, const void *pixels) = dlsym(RTLD_NEXT, "glTexImage2D");
switch (getConfig()->crc32) if (getConfig()->width != 800 && getConfig()->height != 480)
{ {
case OUTRUN_2_SP_SDX: switch (getConfig()->crc32)
case OUTRUN_2_SP_SDX_REVA:
{
void *addr = __builtin_return_address(0);
if ((width >= 800) && (width != 1024) && (addr != (void *)0x80d78d5) && (addr != (void *)0x080d7941))
{ {
width = getConfig()->width; case OUTRUN_2_SP_SDX:
height = getConfig()->height; case OUTRUN_2_SP_SDX_REVA:
{
void *addr = __builtin_return_address(0);
if ((width >= 800) && (width != 1024) && (addr != (void *)0x80d78d5) && (addr != (void *)0x080d7941))
{
width = getConfig()->width;
height = getConfig()->height;
}
} }
}
break;
default:
break; break;
default:
break;
}
} }
_glTexImage2D(target, level, internalformat, width, height, border, format, type, pixels); _glTexImage2D(target, level, internalformat, width, height, border, format, type, pixels);
} }
@@ -357,25 +391,6 @@ int isTestMode()
void glBindTextureABC(GLenum target, GLuint texture) void glBindTextureABC(GLenum target, GLuint texture)
{ {
// const char *targetName = "";
// switch (target)
// {
// case GL_TEXTURE_2D:
// targetName = "GL_TEXTURE_2D";
// break;
// case GL_TEXTURE_CUBE_MAP:
// targetName = "GL_TEXTURE_CUBE_MAP";
// break;
// case GL_TEXTURE_3D:
// targetName = "GL_TEXTURE_3D";
// break;
// case GL_TEXTURE_1D:
// targetName = "GL_TEXTURE_1D";
// break;
// default:
// targetName = "UNKNOWN";
// break;
// }
curTargetABC = target; curTargetABC = target;
curTextureIDABC = texture; curTextureIDABC = texture;
@@ -1148,6 +1163,133 @@ void hookABCGLFunctions(uint32_t glBindTextureAddr, uint32_t glVertex3fAddr1, ui
replaceCallAtAddress(glVertex3fAddr2 + 0x7b, glVertex3fABC2); replaceCallAtAddress(glVertex3fAddr2 + 0x7b, glVertex3fABC2);
} }
GLenum curTargetGE = 0;
GLuint curTextureIDGE = 0;
bool enableScaling = false;
void glBindTextureGE(GLenum target, GLuint texture)
{
curTargetGE = target;
curTextureIDGE = texture;
void *addr = __builtin_return_address(0);
if (getConfig()->crc32 == TOO_SPICY)
{
if (texture == 902 || texture == 1642)
{ // 55 title
enableScaling = true; // Enable scaling
}
else if (texture == 903 || texture == 1686)
{
enableScaling = false; // Disable scaling
}
}
void (*_glBindTexture)(GLenum, GLuint) = dlsym(RTLD_NEXT, "glBindTexture");
_glBindTexture(target, texture);
}
void glVertex3fHOD4(GLfloat x, GLfloat y, GLfloat z)
{
int (*_glVertex3f)(GLfloat x, GLfloat y, GLfloat z) = dlsym(RTLD_NEXT, "glVertex3f");
void *returnAddress = __builtin_return_address(0);
float scaleX = getConfig()->width / 1280.0f;
float scaleY = getConfig()->height / 768.0f;
float TestX = ((((getConfig()->width - 1280.0) / 2.0) * 1.1116317809) / 1280.0) * (1.5 / scaleX);
float TestY = ((((getConfig()->height - 768.0) / 2.0) * 0.666979044) / 768.0) * (1.5 / scaleX);
float OffsetX = TestX; // test
float OffsetY = TestY;
float scaleZ = fabs(z) / 1.510000;
float AdjOffsetX = OffsetX * scaleZ;
float AdjOffsetY = OffsetY * scaleZ;
if (z == -1.510000f)
{ // logo 2d elemtents target
if (curTextureIDGE != 260) // target boss fight
{
x += OffsetX;
y -= OffsetY;
x *= scaleX;
y *= scaleY;
}
}
else if (z == -1.210000f)
{ // coins start select side
x += AdjOffsetX;
y -= AdjOffsetY;
x *= scaleX;
y *= scaleY;
}
else if (z == -1.310000f)
{ // main bd
x += AdjOffsetX;
y -= AdjOffsetY;
x *= scaleX;
y *= scaleY;
}
else if (z == -1.509800f)
{ // frame 2d elements
x += AdjOffsetX;
y -= AdjOffsetY;
x *= scaleX;
y *= scaleY;
}
else if (z == -1.4099999666f)
{ // continue
x += AdjOffsetX;
y -= AdjOffsetY;
x *= scaleX;
y *= scaleY;
}
else if (z == -1.6099998951f)
{ // score
x += AdjOffsetX;
y -= AdjOffsetY;
x *= scaleX;
y *= scaleY;
}
else if (z == -1.7100000381f)
{ // side select
x += AdjOffsetX;
y -= AdjOffsetY;
x *= scaleX;
y *= scaleY;
}
else if (z == -1.5091999769f || z == -1.5094000101f || z == -1.5095999241f)
{ // bar boss fight
x += AdjOffsetX;
y -= AdjOffsetY;
x *= scaleX;
y *= scaleY;
}
else if (z == -1.8099999428f)
{ // score BG
x += AdjOffsetX;
y -= AdjOffsetY;
x *= scaleX;
y *= scaleY;
}
_glVertex3f(x, y, z);
}
int initResolutionPatches() int initResolutionPatches()
{ {
switch (getConfig()->crc32) switch (getConfig()->crc32)
@@ -1163,6 +1305,8 @@ int initResolutionPatches()
break; break;
case AFTER_BURNER_CLIMAX: case AFTER_BURNER_CLIMAX:
{ {
if (getConfig()->width == 640 && getConfig()->height == 480)
break;
setVariable(0x082c0308, getConfig()->width); setVariable(0x082c0308, getConfig()->width);
setVariable(0x082c030c, getConfig()->height); setVariable(0x082c030c, getConfig()->height);
float newFontScale = getConfig()->height / 480.0; float newFontScale = getConfig()->height / 480.0;
@@ -1177,6 +1321,8 @@ int initResolutionPatches()
break; break;
case AFTER_BURNER_CLIMAX_REVA: case AFTER_BURNER_CLIMAX_REVA:
{ {
if (getConfig()->width == 640 && getConfig()->height == 480)
break;
setVariable(0x082c0a68, getConfig()->width); setVariable(0x082c0a68, getConfig()->width);
setVariable(0x082c0a6c, getConfig()->height); setVariable(0x082c0a6c, getConfig()->height);
float newFontScale = getConfig()->height / 480.0; float newFontScale = getConfig()->height / 480.0;
@@ -1191,6 +1337,8 @@ int initResolutionPatches()
break; break;
case AFTER_BURNER_CLIMAX_REVB: case AFTER_BURNER_CLIMAX_REVB:
{ {
if (getConfig()->width == 640 && getConfig()->height == 480)
break;
setVariable(0x082C0AE8, getConfig()->width); setVariable(0x082C0AE8, getConfig()->width);
setVariable(0x082C0AEC, getConfig()->height); setVariable(0x082C0AEC, getConfig()->height);
float newFontScale = getConfig()->height / 480.0; float newFontScale = getConfig()->height / 480.0;
@@ -1205,6 +1353,8 @@ int initResolutionPatches()
break; break;
case AFTER_BURNER_CLIMAX_SDX: case AFTER_BURNER_CLIMAX_SDX:
{ {
if (getConfig()->width == 640 && getConfig()->height == 480)
break;
setVariable(0x082c2228, getConfig()->width); setVariable(0x082c2228, getConfig()->width);
setVariable(0x082c222c, getConfig()->height); setVariable(0x082c222c, getConfig()->height);
float newFontScale = getConfig()->height / 480.0; float newFontScale = getConfig()->height / 480.0;
@@ -1219,6 +1369,8 @@ int initResolutionPatches()
break; break;
case AFTER_BURNER_CLIMAX_SDX_REVA: case AFTER_BURNER_CLIMAX_SDX_REVA:
{ {
if (getConfig()->width == 640 && getConfig()->height == 480)
break;
setVariable(0x082c2228, getConfig()->width); setVariable(0x082c2228, getConfig()->width);
setVariable(0x082c222c, getConfig()->height); setVariable(0x082c222c, getConfig()->height);
float newFontScale = getConfig()->height / 480.0; float newFontScale = getConfig()->height / 480.0;
@@ -1233,6 +1385,8 @@ int initResolutionPatches()
break; break;
case AFTER_BURNER_CLIMAX_SE: case AFTER_BURNER_CLIMAX_SE:
{ {
if (getConfig()->width == 640 && getConfig()->height == 480)
break;
setVariable(0x082c0b28, getConfig()->width); setVariable(0x082c0b28, getConfig()->width);
setVariable(0x082c0b2c, getConfig()->height); setVariable(0x082c0b2c, getConfig()->height);
float newFontScale = getConfig()->height / 480.0; float newFontScale = getConfig()->height / 480.0;
@@ -1247,6 +1401,8 @@ int initResolutionPatches()
break; break;
case AFTER_BURNER_CLIMAX_SE_REVA: case AFTER_BURNER_CLIMAX_SE_REVA:
{ {
if (getConfig()->width == 640 && getConfig()->height == 480)
break;
setVariable(0x082c0b28, getConfig()->width); setVariable(0x082c0b28, getConfig()->width);
setVariable(0x082c0b2c, getConfig()->height); setVariable(0x082c0b2c, getConfig()->height);
float newFontScale = getConfig()->height / 480.0; float newFontScale = getConfig()->height / 480.0;
@@ -1261,6 +1417,8 @@ int initResolutionPatches()
break; break;
case SEGA_RACE_TV: case SEGA_RACE_TV:
{ {
if (getConfig()->width == 640 && getConfig()->height == 480)
break;
if (getConfig()->keepAspectRatio) if (getConfig()->keepAspectRatio)
{ {
srtvX = (getConfig()->width - (getConfig()->height / 3) * 4) / 2; srtvX = (getConfig()->width - (getConfig()->height / 3) * 4) / 2;
@@ -1275,6 +1433,8 @@ int initResolutionPatches()
break; break;
case OUTRUN_2_SP_SDX: case OUTRUN_2_SP_SDX:
{ {
if (getConfig()->width <= 800 && getConfig()->height <= 480)
break;
// If resolution is not the native of the game this patch kind of fix the Sun when the LensGlare effect is // If resolution is not the native of the game this patch kind of fix the Sun when the LensGlare effect is
// shown. // shown.
if ((getConfig()->width > 800) && (getConfig()->height > 480)) if ((getConfig()->width > 800) && (getConfig()->height > 480))
@@ -1299,6 +1459,8 @@ int initResolutionPatches()
break; break;
case OUTRUN_2_SP_SDX_REVA: case OUTRUN_2_SP_SDX_REVA:
{ {
if (getConfig()->width <= 800 && getConfig()->height <= 480)
break;
// If resolution is not the native of the game this patch kind of fix the Sun when the LensGlare effect is // If resolution is not the native of the game this patch kind of fix the Sun when the LensGlare effect is
// shown. // shown.
if ((getConfig()->width > 800) && (getConfig()->height > 480)) if ((getConfig()->width > 800) && (getConfig()->height > 480))
@@ -1335,17 +1497,16 @@ int initResolutionPatches()
case OUTRUN_2_SP_SDX_REVA_TEST: case OUTRUN_2_SP_SDX_REVA_TEST:
case OUTRUN_2_SP_SDX_REVA_TEST2: case OUTRUN_2_SP_SDX_REVA_TEST2:
{ {
if (getConfig()->width <= 800 && getConfig()->height <= 480)
break;
setVariable(0x0804a490, getConfig()->width); setVariable(0x0804a490, getConfig()->width);
setVariable(0x0804a4ad, getConfig()->height); setVariable(0x0804a4ad, getConfig()->height);
} }
break; break;
case THE_HOUSE_OF_THE_DEAD_4_REVA: case THE_HOUSE_OF_THE_DEAD_4_REVA:
{ {
if (getConfig()->width == 1280 && getConfig()->height == 768) if (getConfig()->width <= 1280 && getConfig()->height <= 768)
{ break;
setVariable(0x084c9dbc, 1280);
return 0;
}
patchMemory(0x0804d142, "9090909090"); // setresolutiontype patchMemory(0x0804d142, "9090909090"); // setresolutiontype
// patchMemory(0x084c9dbc, "0005"); // patchMemory(0x084c9dbc, "0005");
// patchMemory(0x08448458, "0005"); // patchMemory(0x08448458, "0005");
@@ -1353,34 +1514,43 @@ int initResolutionPatches()
setVariable(0x084c9dbc, getConfig()->width); setVariable(0x084c9dbc, getConfig()->width);
setVariable(0x08448458, getConfig()->width); setVariable(0x08448458, getConfig()->width);
setVariable(0x0844845c, getConfig()->height); setVariable(0x0844845c, getConfig()->height);
patchMemory(0x08448460, "8002"); patchMemory(0x08448460, "0005");
patchMemory(0x08448464, "E001"); patchMemory(0x08448464, "0003");
patchMemory(0x0817ff6d, "e80ed5ecff"); // call crtgetresolution patchMemory(0x0817ff6d, "e80ed5ecff"); // call crtgetresolution
patchMemory(0x08448468, "8002"); // set crtgetresolution to 640x480 patchMemory(0x08448468, "0005"); // set crtgetresolution to 640x480
patchMemory(0x0844846c, "E001"); patchMemory(0x0844846c, "0003");
setVariable(0x08448338, getConfig()->width);
setVariable(0x0844833c, getConfig()->height);
detourFunction(0x0804c024, glVertex3fHOD4);
detourFunction(0x0804ca54, glBindTextureGE);
} }
break; break;
case THE_HOUSE_OF_THE_DEAD_4_REVB: case THE_HOUSE_OF_THE_DEAD_4_REVB:
{ {
if (getConfig()->width == 1280 && getConfig()->height == 768) if (getConfig()->width <= 1280 && getConfig()->height <= 768)
{ break;
setVariable(0x084c3a9c, 1280);
return 0;
}
patchMemory(0x0804d174, "9090909090"); // setresolutiontype patchMemory(0x0804d174, "9090909090"); // setresolutiontype
setVariable(0x084c3a9c, getConfig()->width); setVariable(0x084c3a9c, getConfig()->width);
setVariable(0x08443118, getConfig()->width); setVariable(0x08443118, getConfig()->width);
setVariable(0x0844311c, getConfig()->height); setVariable(0x0844311c, getConfig()->height);
patchMemory(0x08443120, "8002"); patchMemory(0x08443120, "0005");
patchMemory(0x08443124, "E001"); patchMemory(0x08443124, "0003");
patchMemory(0x0818080d, "e89eccecff"); // call crtgetresolution patchMemory(0x0818080d, "e89eccecff"); // call crtgetresolution
patchMemory(0x08443128, "8002"); // set crtgetresolution to 640x480 patchMemory(0x08443128, "0005"); // set crtgetresolution to 640x480
patchMemory(0x0844312c, "E001"); patchMemory(0x0844312c, "0003");
setVariable(0x08442ff8, getConfig()->width);
setVariable(0x08442ffc, getConfig()->height);
detourFunction(0x0804c014, glVertex3fHOD4);
detourFunction(0x0804ca84, glBindTextureGE);
} }
break; break;
case THE_HOUSE_OF_THE_DEAD_4_REVC: case THE_HOUSE_OF_THE_DEAD_4_REVC:
{ {
if (getConfig()->width == 1280 && getConfig()->height == 768) if (getConfig()->width <= 1280 && getConfig()->height <= 768)
{ {
setVariable(0x084c3a9c, 1280); setVariable(0x084c3a9c, 1280);
return 0; return 0;
@@ -1389,15 +1559,23 @@ int initResolutionPatches()
setVariable(0x084c3a9c, getConfig()->width); setVariable(0x084c3a9c, getConfig()->width);
setVariable(0x08443118, getConfig()->width); setVariable(0x08443118, getConfig()->width);
setVariable(0x0844311c, getConfig()->height); setVariable(0x0844311c, getConfig()->height);
patchMemory(0x08443120, "8002"); // gallwinres (2D) patchMemory(0x08443120, "0005"); // gallwinres (2D)
patchMemory(0x08443124, "E001"); patchMemory(0x08443124, "0003");
patchMemory(0x0818080d, "e89eccecff"); // sideselect fix patchMemory(0x0818080d, "e89eccecff"); // sideselect fix
patchMemory(0x08443128, "8002"); patchMemory(0x08443128, "0005");
patchMemory(0x0844312c, "E001"); patchMemory(0x0844312c, "0003");
setVariable(0x08442ff8, getConfig()->width);
setVariable(0x08442ffc, getConfig()->height);
detourFunction(0x0804c014, glVertex3fHOD4);
detourFunction(0x0804ca84, glBindTextureGE);
} }
break; break;
case THE_HOUSE_OF_THE_DEAD_4_SPECIAL: case THE_HOUSE_OF_THE_DEAD_4_SPECIAL:
{ {
if (getConfig()->width <= 1024 && getConfig()->height <= 768)
break;
patchMemory(0x0804d2f4, "9090909090"); // setresolutiontype patchMemory(0x0804d2f4, "9090909090"); // setresolutiontype
setVariable(0x084563c4, getConfig()->width); setVariable(0x084563c4, getConfig()->width);
setVariable(0x08424448, getConfig()->width); setVariable(0x08424448, getConfig()->width);
@@ -1409,6 +1587,8 @@ int initResolutionPatches()
break; break;
case THE_HOUSE_OF_THE_DEAD_4_SPECIAL_REVB: case THE_HOUSE_OF_THE_DEAD_4_SPECIAL_REVB:
{ {
if (getConfig()->width <= 1024 && getConfig()->height <= 768)
break;
patchMemory(0x0804d7e2, "9090909090"); // setresolutiontype patchMemory(0x0804d7e2, "9090909090"); // setresolutiontype
setVariable(0x084c35c4, getConfig()->width); setVariable(0x084c35c4, getConfig()->width);
setVariable(0x08491648, getConfig()->width); setVariable(0x08491648, getConfig()->width);
@@ -1420,11 +1600,12 @@ int initResolutionPatches()
break; break;
case THE_HOUSE_OF_THE_DEAD_EX: case THE_HOUSE_OF_THE_DEAD_EX:
{ {
patchMemory(0x087aa080, "5005"); // Boost Resolution
} }
break; break;
case VIRTUA_FIGHTER_5: case VIRTUA_FIGHTER_5:
{ {
if ((getConfig()->width == 640 && getConfig()->height == 480) || (getConfig()->width == 1280 && getConfig()->height == 768))
return 0;
patchMemory(0x08054057, "b80a000000"); // Skips resolution set by the Dip Switches. patchMemory(0x08054057, "b80a000000"); // Skips resolution set by the Dip Switches.
setVariable(0x0847cf58, getConfig()->width); setVariable(0x0847cf58, getConfig()->width);
setVariable(0x0847cf5c, getConfig()->height); setVariable(0x0847cf5c, getConfig()->height);
@@ -1433,6 +1614,8 @@ int initResolutionPatches()
break; break;
case VIRTUA_FIGHTER_5_REVA: case VIRTUA_FIGHTER_5_REVA:
{ {
if ((getConfig()->width == 640 && getConfig()->height == 480) || (getConfig()->width == 1280 && getConfig()->height == 768))
break;
patchMemory(0x8053167, "01"); // Enable Anti Alias patchMemory(0x8053167, "01"); // Enable Anti Alias
patchMemory(0x080541af, "b80a000000"); // Skips resolution set by the Dip Switches. patchMemory(0x080541af, "b80a000000"); // Skips resolution set by the Dip Switches.
setVariable(0x08487df8, getConfig()->width); setVariable(0x08487df8, getConfig()->width);
@@ -1441,6 +1624,8 @@ int initResolutionPatches()
break; break;
case VIRTUA_FIGHTER_5_REVB: case VIRTUA_FIGHTER_5_REVB:
{ {
if ((getConfig()->width == 640 && getConfig()->height == 480) || (getConfig()->width == 1280 && getConfig()->height == 768))
break;
patchMemory(0x08053673, "01"); // Enable Anti Alias patchMemory(0x08053673, "01"); // Enable Anti Alias
patchMemory(0x080546cf, "b80a000000"); // Skips resolution set by the Dip Switches. patchMemory(0x080546cf, "b80a000000"); // Skips resolution set by the Dip Switches.
setVariable(0x08536bb8, getConfig()->width); setVariable(0x08536bb8, getConfig()->width);
@@ -1449,6 +1634,8 @@ int initResolutionPatches()
break; break;
case VIRTUA_FIGHTER_5_REVE: // Also the public REV C version case VIRTUA_FIGHTER_5_REVE: // Also the public REV C version
{ {
if ((getConfig()->width == 640 && getConfig()->height == 480) || (getConfig()->width == 1280 && getConfig()->height == 768))
break;
patchMemory(0x080546c7, "01"); // Enable Anti Alias patchMemory(0x080546c7, "01"); // Enable Anti Alias
patchMemory(0x080557a3, "b80a000000"); // Skips resolution set by the Dip Switches. patchMemory(0x080557a3, "b80a000000"); // Skips resolution set by the Dip Switches.
setVariable(0x085efb18, getConfig()->width); setVariable(0x085efb18, getConfig()->width);
@@ -1457,6 +1644,8 @@ int initResolutionPatches()
break; break;
case VIRTUA_FIGHTER_5_EXPORT: case VIRTUA_FIGHTER_5_EXPORT:
{ {
if ((getConfig()->width == 640 && getConfig()->height == 480) || (getConfig()->width == 1280 && getConfig()->height == 768))
break;
patchMemory(0x08052b97, "01"); // Enable Anti Alias patchMemory(0x08052b97, "01"); // Enable Anti Alias
patchMemory(0x08053c67, "b80a000000"); // Skips resolution set by the Dip Switches. patchMemory(0x08053c67, "b80a000000"); // Skips resolution set by the Dip Switches.
setVariable(0x085259f8, getConfig()->width); setVariable(0x085259f8, getConfig()->width);
@@ -1465,6 +1654,8 @@ int initResolutionPatches()
break; break;
case VIRTUA_FIGHTER_5_FINAL_SHOWDOWN_REVA: case VIRTUA_FIGHTER_5_FINAL_SHOWDOWN_REVA:
{ {
if ((getConfig()->width == 640 && getConfig()->height == 480) || (getConfig()->width == 1280 && getConfig()->height == 768))
break;
patchMemory(0x08054b5e, "01"); // Enable Anti Alias patchMemory(0x08054b5e, "01"); // Enable Anti Alias
patchMemory(0x08055980, "b80a000000"); // Skips resolution set by the Dip Switches. patchMemory(0x08055980, "b80a000000"); // Skips resolution set by the Dip Switches.
vf5FSwidth = (getConfig()->height * 5) / 3; vf5FSwidth = (getConfig()->height * 5) / 3;
@@ -1476,6 +1667,8 @@ int initResolutionPatches()
break; break;
case VIRTUA_FIGHTER_5_FINAL_SHOWDOWN_REVB: case VIRTUA_FIGHTER_5_FINAL_SHOWDOWN_REVB:
{ {
if ((getConfig()->width == 640 && getConfig()->height == 480) || (getConfig()->width == 1280 && getConfig()->height == 768))
break;
patchMemory(0x080548c4, "01"); // Enable Anti Alias patchMemory(0x080548c4, "01"); // Enable Anti Alias
patchMemory(0x080556e6, "b80a000000"); // Skips resolution set by the Dip Switches. patchMemory(0x080556e6, "b80a000000"); // Skips resolution set by the Dip Switches.
vf5FSwidth = (getConfig()->height * 5) / 3; vf5FSwidth = (getConfig()->height * 5) / 3;
@@ -1487,6 +1680,8 @@ int initResolutionPatches()
break; break;
case VIRTUA_FIGHTER_5_FINAL_SHOWDOWN_REVB_6000: case VIRTUA_FIGHTER_5_FINAL_SHOWDOWN_REVB_6000:
{ {
if ((getConfig()->width == 640 && getConfig()->height == 480) || (getConfig()->width == 1280 && getConfig()->height == 768))
break;
patchMemory(0x08054bfe, "01"); // Enable Anti Alias patchMemory(0x08054bfe, "01"); // Enable Anti Alias
patchMemory(0x08055a20, "b80a000000"); // Skips resolution set by the Dip Switches. patchMemory(0x08055a20, "b80a000000"); // Skips resolution set by the Dip Switches.
vf5FSwidth = (getConfig()->height * 5) / 3; vf5FSwidth = (getConfig()->height * 5) / 3;
@@ -1498,6 +1693,8 @@ int initResolutionPatches()
break; break;
case VIRTUA_FIGHTER_5_R: case VIRTUA_FIGHTER_5_R:
{ {
if ((getConfig()->width == 640 && getConfig()->height == 480) || (getConfig()->width == 1280 && getConfig()->height == 768))
break;
patchMemory(0x0805421a, "01"); // Enable Anti Alias patchMemory(0x0805421a, "01"); // Enable Anti Alias
patchMemory(0x080554b0, "b80a000000"); // Skips resolution set by the Dip Switches. patchMemory(0x080554b0, "b80a000000"); // Skips resolution set by the Dip Switches.
vf5FSwidth = (getConfig()->height * 5) / 3; vf5FSwidth = (getConfig()->height * 5) / 3;
@@ -1509,6 +1706,8 @@ int initResolutionPatches()
break; break;
case VIRTUA_FIGHTER_5_R_REVD: case VIRTUA_FIGHTER_5_R_REVD:
{ {
if ((getConfig()->width == 640 && getConfig()->height == 480) || (getConfig()->width == 1280 && getConfig()->height == 768))
break;
patchMemory(0x080543aa, "01"); // Enable Anti Alias patchMemory(0x080543aa, "01"); // Enable Anti Alias
patchMemory(0x080555f6, "b80a000000"); // Skips resolution set by the Dip Switches. patchMemory(0x080555f6, "b80a000000"); // Skips resolution set by the Dip Switches.
vf5FSwidth = (getConfig()->height * 5) / 3; vf5FSwidth = (getConfig()->height * 5) / 3;
@@ -1518,8 +1717,10 @@ int initResolutionPatches()
setVariable(0x08822b30, getConfig()->height); setVariable(0x08822b30, getConfig()->height);
} }
break; break;
case VIRTUA_FIGHTER_5_R_REVG: case VIRTUA_FIGHTER_5_R_REVG:
{ {
if ((getConfig()->width == 640 && getConfig()->height == 480) || (getConfig()->width == 1280 && getConfig()->height == 768))
break;
patchMemory(0x0805436a, "01"); // Enable Anti Alias patchMemory(0x0805436a, "01"); // Enable Anti Alias
patchMemory(0x0805577c, "b80a000000"); // Skips resolution set by the Dip Switches. patchMemory(0x0805577c, "b80a000000"); // Skips resolution set by the Dip Switches.
vf5FSwidth = (getConfig()->height * 5) / 3; vf5FSwidth = (getConfig()->height * 5) / 3;
@@ -1553,6 +1754,8 @@ int initResolutionPatches()
break; break;
case INITIALD_4_REVA: case INITIALD_4_REVA:
{ {
if (getConfig()->width == 1360 && getConfig()->height == 768)
break;
setVariable(0x0835640d, 0x0000f0e9); // Force set resolution setVariable(0x0835640d, 0x0000f0e9); // Force set resolution
setVariable(0x08356503, getConfig()->width); // Set ResX setVariable(0x08356503, getConfig()->width); // Set ResX
setVariable(0x08356508, getConfig()->height); // Set ResY setVariable(0x08356508, getConfig()->height); // Set ResY
@@ -1585,6 +1788,8 @@ int initResolutionPatches()
break; break;
case INITIALD_4_REVB: case INITIALD_4_REVB:
{ {
if (getConfig()->width == 1360 && getConfig()->height == 768)
break;
setVariable(0x0835664d, 0x0000f0e9); // Force set resolution setVariable(0x0835664d, 0x0000f0e9); // Force set resolution
setVariable(0x08356743, getConfig()->width); // Set ResX setVariable(0x08356743, getConfig()->width); // Set ResX
setVariable(0x08356748, getConfig()->height); // Set ResY setVariable(0x08356748, getConfig()->height); // Set ResY
@@ -1617,6 +1822,8 @@ int initResolutionPatches()
break; break;
case INITIALD_4_REVC: case INITIALD_4_REVC:
{ {
if (getConfig()->width == 1360 && getConfig()->height == 768)
break;
setVariable(0x0835eebd, 0x0000f0e9); // Force set resolution setVariable(0x0835eebd, 0x0000f0e9); // Force set resolution
setVariable(0x0835efb3, getConfig()->width); // Set ResX setVariable(0x0835efb3, getConfig()->width); // Set ResX
setVariable(0x0835efb8, getConfig()->height); // Set ResY setVariable(0x0835efb8, getConfig()->height); // Set ResY
@@ -1649,6 +1856,8 @@ int initResolutionPatches()
break; break;
case INITIALD_4_REVD: case INITIALD_4_REVD:
{ {
if (getConfig()->width == 1360 && getConfig()->height == 768)
break;
setVariable(0x0835c55d, 0x0000f0e9); // Force set resolution setVariable(0x0835c55d, 0x0000f0e9); // Force set resolution
setVariable(0x0835c653, getConfig()->width); // Set ResX setVariable(0x0835c653, getConfig()->width); // Set ResX
setVariable(0x0835c658, getConfig()->height); // Set ResY setVariable(0x0835c658, getConfig()->height); // Set ResY
@@ -1681,6 +1890,8 @@ int initResolutionPatches()
break; break;
case INITIALD_4_REVG: case INITIALD_4_REVG:
{ {
if (getConfig()->width == 1360 && getConfig()->height == 768)
break;
setVariable(0x08393fbd, 0x0000f0e9); // Force set resolution setVariable(0x08393fbd, 0x0000f0e9); // Force set resolution
setVariable(0x083940b3, getConfig()->width); // Set ResX setVariable(0x083940b3, getConfig()->width); // Set ResX
setVariable(0x083940b8, getConfig()->height); // Set ResY setVariable(0x083940b8, getConfig()->height); // Set ResY
@@ -1721,6 +1932,8 @@ int initResolutionPatches()
break; break;
case INITIALD_4_EXP_REVB: case INITIALD_4_EXP_REVB:
{ {
if (getConfig()->width == 1360 && getConfig()->height == 768)
break;
setVariable(0x0837979d, 0x0000f0e9); // Force set resolution setVariable(0x0837979d, 0x0000f0e9); // Force set resolution
setVariable(0x08379893, getConfig()->width); // Set ResX setVariable(0x08379893, getConfig()->width); // Set ResX
setVariable(0x08379898, getConfig()->height); // Set ResY setVariable(0x08379898, getConfig()->height); // Set ResY
@@ -1765,6 +1978,8 @@ int initResolutionPatches()
break; break;
case INITIALD_4_EXP_REVC: case INITIALD_4_EXP_REVC:
{ {
if (getConfig()->width == 1360 && getConfig()->height == 768)
break;
setVariable(0x0837961d, 0x0000f0e9); // Force set resolution setVariable(0x0837961d, 0x0000f0e9); // Force set resolution
setVariable(0x08379713, getConfig()->width); // Set ResX setVariable(0x08379713, getConfig()->width); // Set ResX
setVariable(0x08379718, getConfig()->height); // Set ResY setVariable(0x08379718, getConfig()->height); // Set ResY
@@ -1812,6 +2027,8 @@ int initResolutionPatches()
break; break;
case INITIALD_4_EXP_REVD: case INITIALD_4_EXP_REVD:
{ {
if (getConfig()->width == 1360 && getConfig()->height == 768)
break;
setVariable(0x0837b12d, 0x0000f0e9); // Force set resolution setVariable(0x0837b12d, 0x0000f0e9); // Force set resolution
setVariable(0x0837b223, getConfig()->width); // Set ResX setVariable(0x0837b223, getConfig()->width); // Set ResX
setVariable(0x0837b228, getConfig()->height); // Set ResY setVariable(0x0837b228, getConfig()->height); // Set ResY
@@ -1854,8 +2071,61 @@ int initResolutionPatches()
} }
} }
break; break;
case INITIALD_5_EXP_30: case INITIALD_5_EXP:
{ {
if (getConfig()->width == 1360 && getConfig()->height == 768)
break;
patchMemory(0x0853d8cd, "E9f000"); // Accept different Resolutions
setVariable(0x0853d9c3, getConfig()->width); // Set ResX
setVariable(0x0853d9c8, getConfig()->height); // Set ResY
patchMemory(0x08356054, "bb01000000eb6b"); // Prevents renrer.ini from loading
setVariable(0x08355f30, getConfig()->width); // Framebuffer Main Width
setVariable(0x08355f37, getConfig()->height); // Framebuffer Main Height
setVariable(0x08355fd1, 256); // Framebuffer Road Specular width
setVariable(0x08355fd8, 256); // Framebuffer Road Specular height
setVariable(0x08355ff7, getConfig()->width); // Framebuffer Glare Width
setVariable(0x08355ffe, getConfig()->height); // Framebuffer Glare Height
setVariable(0x08356024, getConfig()->width >> 2); // Framebuffer Reduced width
patchMemory(0x08356049, "00000001"); // Enable Cube Secular
// Fix Press start and Insert coins text
idDisplayTextureCAVEAddress = (void *)0x084e2470 + 5;
detourFunction(0x084e2470, idDisplayTexture);
// setViewport for track selection screen
setVariable(0x08215cae, (int)(getConfig()->height * (112.0 / 768)));
setVariable(0x08215cb6, (int)(getConfig()->width * (724.0 / 1315)));
setVariable(0x08215cbe, (int)(getConfig()->height * (592.0 / 768)));
setVariable(0x08215cc6, (int)(getConfig()->width * (962.0 / 1315)));
setVariable(0x08215cce, getConfig()->height);
// FSAA
patchMemory(0x0875aaa6, "9090");
patchMemory(0x08788949, "01"); // FSAA Enabled
setVariable(0x08cac148, 1); // FSAA Quality
// Balloon fix
idDrawBallonCAVEAddress = (void *)0x082536c8 + 6;
iddrawBallonPutAddress = (void *)0x086d257c;
detourFunction(0x082536c8, idDrawBallon);
replaceCallAtAddress(0x08254b68, idBalloonPut);
replaceCallAtAddress(0x08254c29, idBalloonPut);
// START and VIEW CHANGE Text fix
float explanationScaleX = getConfig()->width - (1360.0 - 815.0);
float explanationScaleY = (getConfig()->height / 768.0) * 680.0;
setVariable(0x0826ac45, *(unsigned int *)&explanationScaleY);
setVariable(0x0826acbd, *(unsigned int *)&explanationScaleX);
// Scale Testmode text
if (isTestMode() && getConfig()->width >= 1920)
{
patchMemory(0x08c55ca0, "02");
idTextShift = (getConfig()->width == 1920 ? 27 : ((1920 / getConfig()->width) * 27) + 2);
idTestTextAddress = (void *)0x08775c1c;
replaceCallAtAddress(0x0850853e, idTestText);
}
}
break;
case INITIALD_5_EXP_20:
{
if (getConfig()->width == 1360 && getConfig()->height == 768)
break;
patchMemory(0x0855a48d, "E9f000"); // Accept different Resolutions patchMemory(0x0855a48d, "E9f000"); // Accept different Resolutions
setVariable(0x0855a583, getConfig()->width); // Set ResX setVariable(0x0855a583, getConfig()->width); // Set ResX
setVariable(0x0855a588, getConfig()->height); // Set ResY setVariable(0x0855a588, getConfig()->height); // Set ResY
@@ -1903,8 +2173,10 @@ int initResolutionPatches()
} }
} }
break; break;
case INITIALD_5_EXP_40: case INITIALD_5_EXP_20A:
{ {
if (getConfig()->width == 1360 && getConfig()->height == 768)
break;
patchMemory(0x0855a6dd, "E9f000"); // Accept different Resolutions patchMemory(0x0855a6dd, "E9f000"); // Accept different Resolutions
setVariable(0x0855a7d3, getConfig()->width); // Set ResX setVariable(0x0855a7d3, getConfig()->width); // Set ResX
setVariable(0x0855a7d8, getConfig()->height); // Set ResY setVariable(0x0855a7d8, getConfig()->height); // Set ResY
@@ -1954,6 +2226,8 @@ int initResolutionPatches()
break; break;
case INITIALD_5_JAP_REVA: // ID5 - DVP-0070A case INITIALD_5_JAP_REVA: // ID5 - DVP-0070A
{ {
if (getConfig()->width == 1360 && getConfig()->height == 768)
break;
patchMemory(0x0853ccdd, "E9f000"); // Accept different Resolutions patchMemory(0x0853ccdd, "E9f000"); // Accept different Resolutions
setVariable(0x0853cdd3, getConfig()->width); // Set ResX setVariable(0x0853cdd3, getConfig()->width); // Set ResX
setVariable(0x0853cdd8, getConfig()->height); // Set ResY setVariable(0x0853cdd8, getConfig()->height); // Set ResY
@@ -2003,6 +2277,8 @@ int initResolutionPatches()
break; break;
case INITIALD_5_JAP_REVF: // ID5 - DVP-0070F case INITIALD_5_JAP_REVF: // ID5 - DVP-0070F
{ {
if (getConfig()->width == 1360 && getConfig()->height == 768)
break;
patchMemory(0x08556bbd, "E9f000"); // Accept different Resolutions patchMemory(0x08556bbd, "E9f000"); // Accept different Resolutions
setVariable(0x08556cb3, getConfig()->width); // Set ResX setVariable(0x08556cb3, getConfig()->width); // Set ResX
setVariable(0x08556cb8, getConfig()->height); // Set ResY setVariable(0x08556cb8, getConfig()->height); // Set ResY
@@ -2062,6 +2338,19 @@ int initResolutionPatches()
setVariable(0x080645c6, getConfig()->height); setVariable(0x080645c6, getConfig()->height);
} }
break; break;
case SEGABOOT_2_4:
{
patchMemory(0x08059799, "9090");
patchMemory(0x080597b6, "07");
patchMemory(0x0805978e, "07");
patchMemory(0x080597a7, "07");
patchMemory(0x080597c7, "07");
patchMemory(0x08059780, "07");
patchMemory(0x08059768, "07");
setVariable(0x0809129d, getConfig()->width);
setVariable(0x08091252, getConfig()->height);
}
break;
case VIRTUA_TENNIS_3: case VIRTUA_TENNIS_3:
{ {
if (getConfig()->width <= 1360 && getConfig()->height <= 768) if (getConfig()->width <= 1360 && getConfig()->height <= 768)
@@ -2166,6 +2455,8 @@ int initResolutionPatches()
break; break;
case RAMBO: case RAMBO:
{ {
if (getConfig()->width <= 1360 && getConfig()->height <= 768)
break;
patchMemory(0x080c70d0, "9090909090"); // setresolutiontype patchMemory(0x080c70d0, "9090909090"); // setresolutiontype
setVariable(0x08416df0, getConfig()->width); // render res setVariable(0x08416df0, getConfig()->width); // render res
setVariable(0x08416d60, getConfig()->width); // main res setVariable(0x08416d60, getConfig()->width); // main res
@@ -2185,6 +2476,8 @@ int initResolutionPatches()
break; break;
case PRIMEVAL_HUNT: case PRIMEVAL_HUNT:
{ {
if (getConfig()->width <= 640 && getConfig()->height <= 480)
break;
phX = 0; phX = 0;
phY = 0; phY = 0;
phW = getConfig()->width; phW = getConfig()->width;
@@ -2277,6 +2570,8 @@ int initResolutionPatches()
break; break;
case HARLEY_DAVIDSON: case HARLEY_DAVIDSON:
{ {
if (getConfig()->width <= 1360 && getConfig()->height <= 768)
break;
int w = getConfig()->width; int w = getConfig()->width;
int h = getConfig()->height; int h = getConfig()->height;
setVariable(0x088a57e0, w); // main res setVariable(0x088a57e0, w); // main res
@@ -2300,6 +2595,8 @@ int initResolutionPatches()
break; break;
case HUMMER: case HUMMER:
{ {
if (getConfig()->width <= 1280 && getConfig()->height <= 768)
break;
replaceCallAtAddress(0x080d8b58, hummerRespatch); replaceCallAtAddress(0x080d8b58, hummerRespatch);
replaceCallAtAddress(0x080d8b73, hummerRespatch); replaceCallAtAddress(0x080d8b73, hummerRespatch);
replaceCallAtAddress(0x080d8b8e, hummerRespatch); replaceCallAtAddress(0x080d8b8e, hummerRespatch);
@@ -2310,6 +2607,8 @@ int initResolutionPatches()
break; break;
case HUMMER_SDLX: case HUMMER_SDLX:
{ {
if (getConfig()->width <= 1280 && getConfig()->height <= 768)
break;
replaceCallAtAddress(0x080d8b14, hummerRespatch); replaceCallAtAddress(0x080d8b14, hummerRespatch);
replaceCallAtAddress(0x080d8b2f, hummerRespatch); replaceCallAtAddress(0x080d8b2f, hummerRespatch);
replaceCallAtAddress(0x080d8b4a, hummerRespatch); replaceCallAtAddress(0x080d8b4a, hummerRespatch);
@@ -2320,6 +2619,8 @@ int initResolutionPatches()
break; break;
case HUMMER_EXTREME: case HUMMER_EXTREME:
{ {
if (getConfig()->width <= 1280 && getConfig()->height <= 768)
break;
replaceCallAtAddress(0x08159eab, hummerRespatch); replaceCallAtAddress(0x08159eab, hummerRespatch);
replaceCallAtAddress(0x08159ec9, hummerRespatch); replaceCallAtAddress(0x08159ec9, hummerRespatch);
replaceCallAtAddress(0x08159ee7, hummerRespatch); replaceCallAtAddress(0x08159ee7, hummerRespatch);
@@ -2330,6 +2631,8 @@ int initResolutionPatches()
break; break;
case HUMMER_EXTREME_MDX: case HUMMER_EXTREME_MDX:
{ {
if (getConfig()->width <= 1280 && getConfig()->height <= 768)
break;
replaceCallAtAddress(0x0816348b, hummerRespatch); replaceCallAtAddress(0x0816348b, hummerRespatch);
replaceCallAtAddress(0x081634a9, hummerRespatch); replaceCallAtAddress(0x081634a9, hummerRespatch);
replaceCallAtAddress(0x081634c7, hummerRespatch); replaceCallAtAddress(0x081634c7, hummerRespatch);
+1
View File
@@ -11,6 +11,7 @@ size_t harleyFreadReplace(void *buf, size_t size, size_t count, FILE *stream);
void glTexCoord2fvABC1(const float *v); void glTexCoord2fvABC1(const float *v);
void glVertex3fABC1(float x, float y, float z); void glVertex3fABC1(float x, float y, float z);
void glVertex3fABC2(float x, float y, float z); void glVertex3fABC2(float x, float y, float z);
int isTestMode();
typedef struct typedef struct
{ {
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
+154 -16
View File
@@ -1,6 +1,5 @@
#ifndef __i386__ #ifndef __i386__
#define __i386__ #define __i386__
#include <SDL2/SDL_video.h>
#endif #endif
#undef __x86_64__ #undef __x86_64__
#define GL_GLEXT_PROTOTYPES #define GL_GLEXT_PROTOTYPES
@@ -8,15 +7,26 @@
#include <stdbool.h> #include <stdbool.h>
#include <dlfcn.h> #include <dlfcn.h>
#include <SDL2/SDL.h> #include <SDL2/SDL.h>
#include <SDL2/SDL_syswm.h>
#include <X11/Xlib.h>
#include "config.h" #include "config.h"
#include "input.h" #include "input.h"
#include "sdlcalls.h" #include "sdlcalls.h"
#include "fps_limiter.h" #include "fps_limiter.h"
#define STB_IMAGE_IMPLEMENTATION
#include "stb_image.h"
bool SDLGame = false; #define STBI_ONLY_PNG
#define STBI_SUPPORT_ZLIB
#define STBI_NO_SIMD
bool SDLWindowCreated = false;
extern bool GLUTGame;
SDL_Window *SDLwindow; SDL_Window *SDLwindow;
SDL_GLContext SDLcontext; SDL_GLContext SDLcontext;
Display *x11Display;
Window x11Window;
char SDLgameTitle[256] = {0}; char SDLgameTitle[256] = {0};
extern fps_limit fpsLimit; extern fps_limit fpsLimit;
@@ -40,19 +50,117 @@ void GLAPIENTRY openglDebugCallback2(GLenum source, GLenum type, GLuint id, GLen
} }
} }
void glutInitSDL(int *argcp, char **argv) 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; int gId = getConfig()->crc32;
void FGAPIENTRY (*_glutInit)(int *argcp, char **argv) = dlsym(RTLD_NEXT, "glutInit"); void FGAPIENTRY (*_glutInit)(int *argcp, char **argv) = dlsym(RTLD_NEXT, "glutInit");
if (getConfig()->noSDL) if (getConfig()->noSDL && GLUTGame)
{ {
_glutInit(argcp, argv); _glutInit(argcp, argv);
return; return;
} }
// || gId == R_TUNED || gId == VIRTUA_FIGHTER_5_R || gId == VIRTUA_FIGHTER_5_R_REVD
if (gId == OUTRUN_2_SP_SDX_TEST || gId == OUTRUN_2_SP_SDX_REVA_TEST || gId == OUTRUN_2_SP_SDX_REVA_TEST2) 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); _glutInit(argcp, argv);
} }
@@ -64,7 +172,7 @@ void glutInitSDL(int *argcp, char **argv)
setenv("SDL_VIDEODRIVER", "x11", 1); setenv("SDL_VIDEODRIVER", "x11", 1);
} }
SDLGame = true; SDLWindowCreated = true;
if (SDL_Init(SDL_INIT_VIDEO) < 0) if (SDL_Init(SDL_INIT_VIDEO) < 0)
{ {
@@ -98,19 +206,49 @@ void glutInitSDL(int *argcp, char **argv)
exit(1); exit(1);
} }
SDLcontext = SDL_GL_CreateContext(SDLwindow); SDL_SysWMinfo info;
if (!SDLcontext) SDL_VERSION(&info.version);
if (SDL_GetWindowWMInfo(SDLwindow, &info))
{
if (info.subsystem == SDL_SYSWM_X11)
{ {
fprintf(stderr, "OpenGL context could not be created! SDL_Error: %s\n", SDL_GetError()); x11Display = info.info.x11.display;
x11Window = info.info.x11.window;
}
else
{
fprintf(stderr, "This program is not running on X11.\n");
}
}
else
{
fprintf(stderr, "SDL_GetWindowWMInfo Error: %s\n", SDL_GetError());
}
SDLcontext = SDL_GL_CreateContext(SDLwindow);
if (!SDLcontext)
{
fprintf(stderr, "OpenGL context could not be created! SDL_Error: %s\n", SDL_GetError());
exit(1);
}
printf(" SDL RESOLUTION: %dx%d\n\n", getConfig()->width, getConfig()->height);
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); exit(1);
} }
}
printf(" SDL RESOLUTION: %dx%d\n\n", getConfig()->width, getConfig()->height); if (getConfig()->hideCursor)
SDL_ShowCursor(SDL_DISABLE);
if (getConfig()->fullscreen)
{
SDL_SetWindowFullscreen(SDLwindow, SDL_WINDOW_FULLSCREEN);
}
} }
void sdlQuit() void sdlQuit()
+1 -1
View File
@@ -1,2 +1,2 @@
void glutInitSDL(int *argcp, char **argv); void initSDL(int *argcp, char **argv);
void pollEvents(); void pollEvents();
+5 -3
View File
@@ -1,8 +1,8 @@
#include <stdio.h> #include <stdio.h>
#include "securityboard.h" #include "securityboard.h"
#include "config.h"
#include "log.h" #include "log.h"
#include "config.h"
#define SECURITY_BOARD_FRONT_PANEL 0x38 #define SECURITY_BOARD_FRONT_PANEL 0x38
#define SECURITY_BOARD_FRONT_PANEL_NON_ROOT 0x1038 #define SECURITY_BOARD_FRONT_PANEL_NON_ROOT 0x1038
@@ -52,8 +52,10 @@ int securityBoardSetDipResolution(int width, int height)
setResolutionDips(1, 1, 0); setResolutionDips(1, 1, 0);
else if (width == 1360 && height == 768) else if (width == 1360 && height == 768)
setResolutionDips(1, 1, 1); setResolutionDips(1, 1, 1);
else else {
log_warn("Resolution not compatible, using 640 x 480\n"); if(getConfig()->showDebugMessages)
log_warn("Resolution not original, setting dips to 640 x 480.\n");
}
return 0; return 0;
} }
+151 -163
View File
@@ -433,8 +433,9 @@ void srtvElfShaderPatcher()
*/ */
bool shaderFileInList(const char *pathname, int *idx) bool shaderFileInList(const char *pathname, int *idx)
{ {
int gId = getConfig()->crc32; uint32_t gId = getConfig()->crc32;
char cwd[256]; char cwd[256];
int gpuVendor = getConfig()->GPUVendor;
if (gId == GHOST_SQUAD_EVOLUTION) if (gId == GHOST_SQUAD_EVOLUTION)
{ {
if (getConfig()->GPUVendor != NVIDIA_GPU) if (getConfig()->GPUVendor != NVIDIA_GPU)
@@ -493,8 +494,7 @@ bool shaderFileInList(const char *pathname, int *idx)
return false; return false;
} }
} }
else if ((gId == THE_HOUSE_OF_THE_DEAD_4_REVA) || (gId == THE_HOUSE_OF_THE_DEAD_4_REVB) || else if (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_REVC))
{ {
for (int x = 0; x < hod4ShaderPatchesCount; x++) for (int x = 0; x < hod4ShaderPatchesCount; x++)
{ {
@@ -507,7 +507,7 @@ bool shaderFileInList(const char *pathname, int *idx)
} }
return false; return false;
} }
else if ((gId == THE_HOUSE_OF_THE_DEAD_4_SPECIAL) || (gId == THE_HOUSE_OF_THE_DEAD_4_SPECIAL_REVB)) else if (gId == THE_HOUSE_OF_THE_DEAD_4_SPECIAL || gId == THE_HOUSE_OF_THE_DEAD_4_SPECIAL_REVB)
{ {
for (int x = 0; x < hod4spShaderPatchesCount; x++) for (int x = 0; x < hod4spShaderPatchesCount; x++)
{ {
@@ -546,7 +546,7 @@ bool shaderFileInList(const char *pathname, int *idx)
} }
return false; return false;
} }
else if ((gId == HUMMER) || (gId == HUMMER_SDLX) || (gId == HUMMER_EXTREME) || (gId == HUMMER_EXTREME_MDX)) else if (gId == HUMMER || gId == HUMMER_SDLX || gId == HUMMER_EXTREME || gId == HUMMER_EXTREME_MDX)
{ {
for (int x = 0; x < hummerFilesToModCount; x++) for (int x = 0; x < hummerFilesToModCount; x++)
@@ -560,104 +560,101 @@ bool shaderFileInList(const char *pathname, int *idx)
} }
return false; return false;
} }
else if (getConfig()->GPUVendor != NVIDIA_GPU) else if (gId == TOO_SPICY && gpuVendor != NVIDIA_GPU)
{ {
if (gId == TOO_SPICY) for (int x = 0; x < tooSpicyShaderPatchesCount; x++)
{ {
for (int x = 0; x < tooSpicyShaderPatchesCount; x++) if ((strcmp(tooSpicyShaderPatches[x].fileName, basename((char *)pathname)) == 0) &&
{ (tooSpicyShaderPatches[x].shaderBufferSize != 0))
if ((strcmp(tooSpicyShaderPatches[x].fileName, basename((char *)pathname)) == 0) &&
(tooSpicyShaderPatches[x].shaderBufferSize != 0))
{
*idx = x;
return true;
}
}
return false;
}
else if (gId == THE_HOUSE_OF_THE_DEAD_EX)
{
for (int x = 0; x < hodexShaderPatchesCount; x++)
{
if ((strcmp(hodexShaderPatches[x].fileName, basename((char *)pathname)) == 0) &&
(hodexShaderPatches[x].shaderBufferSize != 0))
{
*idx = x;
return true;
}
}
return false;
}
const char *fName = strrchr(pathname, '/');
char searchFileName[40];
char *searchFolder1;
char *searchFolder2;
char *format;
ShaderFilesToMod *filesToMod;
int filesToModCount;
if ((gId == LETS_GO_JUNGLE) || (gId == LETS_GO_JUNGLE_REVA) || (gId == LETS_GO_JUNGLE_SPECIAL))
{
filesToMod = lgjShaderFilesToMod;
filesToModCount = lgjFilesToModCount;
searchFolder1 = "/shader/Cg";
searchFolder2 = "/extraShader/Cg";
format = "%s/inc%s";
}
else if ((gId == INITIALD_4_EXP_REVB) || (gId == INITIALD_4_EXP_REVC) || (gId == INITIALD_4_EXP_REVD) ||
(gId == INITIALD_4_REVA) || (gId == INITIALD_4_REVB) || (gId == INITIALD_4_REVC) ||
(gId == INITIALD_4_REVD) || (gId == INITIALD_4_REVG) || (gId == INITIALD_5_JAP_REVA) ||
(gId == INITIALD_5_JAP_REVF) || (gId == INITIALD_5_EXP_30) || (gId == INITIALD_5_EXP_40))
{
filesToMod = idShaderFilesToMod;
filesToModCount = idFilesToModCount;
if ((gId == INITIALD_4_REVA) || (gId == INITIALD_4_REVB) || (gId == INITIALD_4_REVC) ||
(gId == INITIALD_4_REVD) || (gId == INITIALD_4_REVG))
{
filesToMod = id4jShaderFilesToMod;
filesToModCount = id4FilesToModCount;
}
searchFolder1 = "/shader/Cg/inc";
searchFolder2 = "/data/Shader";
if ((gId == INITIALD_5_JAP_REVA) || (gId == INITIALD_5_JAP_REVF) || (gId == INITIALD_5_EXP_30) ||
(gId == INITIALD_5_EXP_40))
{
searchFolder2 = "/data/V5SHADER";
}
format = "%s%s";
}
else 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))
{
filesToMod = vt3ShaderFilesToMod;
filesToModCount = vt3FilesToModCount;
searchFolder1 = "/shader/Cg/inc";
searchFolder2 = "/shader";
format = "%s%s";
}
if (strstr(pathname, searchFolder1) != NULL)
{
sprintf((void *)searchFileName, format, searchFolder1, fName);
}
else if (strstr(pathname, searchFolder2) != NULL)
{
sprintf((void *)searchFileName, format, searchFolder2, fName);
}
else
{
return false;
}
for (int x = 0; x < filesToModCount; x++)
{
if (strcmp(filesToMod[x].fileName, searchFileName) == 0)
{ {
*idx = x; *idx = x;
return true; return true;
} }
} }
return false;
}
else if (gId == THE_HOUSE_OF_THE_DEAD_EX && gpuVendor != NVIDIA_GPU)
{
for (int x = 0; x < hodexShaderPatchesCount; x++)
{
if ((strcmp(hodexShaderPatches[x].fileName, basename((char *)pathname)) == 0) && (hodexShaderPatches[x].shaderBufferSize != 0))
{
*idx = x;
return true;
}
}
return false;
}
const char *fName = strrchr(pathname, '/');
char searchFileName[40];
char *searchFolder1;
char *searchFolder2;
char *format;
ShaderFilesToMod *filesToMod;
int filesToModCount;
if ((gId == LETS_GO_JUNGLE || gId == LETS_GO_JUNGLE_REVA || gId == LETS_GO_JUNGLE_SPECIAL) &&
(gpuVendor != NVIDIA_GPU || getConfig()->lgjRenderWithMesa == 1))
{
filesToMod = lgjShaderFilesToMod;
filesToModCount = lgjFilesToModCount;
searchFolder1 = "/shader/Cg";
searchFolder2 = "/extraShader/Cg";
format = "%s/inc%s";
}
else if ((gId == INITIALD_4_EXP_REVB || gId == INITIALD_4_EXP_REVC || gId == INITIALD_4_EXP_REVD || gId == INITIALD_4_REVA ||
gId == INITIALD_4_REVB || gId == INITIALD_4_REVC || gId == INITIALD_4_REVD || gId == INITIALD_4_REVG ||
gId == INITIALD_5_JAP_REVA || gId == INITIALD_5_JAP_REVF || gId == INITIALD_5_EXP || gId == INITIALD_5_EXP_20 ||
gId == INITIALD_5_EXP_20A) &&
gpuVendor != NVIDIA_GPU)
{
filesToMod = idShaderFilesToMod;
filesToModCount = idFilesToModCount;
if (gId == INITIALD_4_REVA || gId == INITIALD_4_REVB || gId == INITIALD_4_REVC || gId == INITIALD_4_REVD || gId == INITIALD_4_REVG)
{
filesToMod = id4jShaderFilesToMod;
filesToModCount = id4FilesToModCount;
}
searchFolder1 = "/shader/Cg/inc";
searchFolder2 = "/data/Shader";
if (gId == INITIALD_5_JAP_REVA || gId == INITIALD_5_JAP_REVF || gId == INITIALD_5_EXP || gId == INITIALD_5_EXP_20 ||
gId == INITIALD_5_EXP_20A)
{
searchFolder2 = "/data/V5SHADER";
}
format = "%s%s";
}
else 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) &&
gpuVendor != NVIDIA_GPU)
{
filesToMod = vt3ShaderFilesToMod;
filesToModCount = vt3FilesToModCount;
searchFolder1 = "/shader/Cg/inc";
searchFolder2 = "/shader";
format = "%s%s";
}
if (strstr(pathname, searchFolder1) != NULL)
{
sprintf((void *)searchFileName, format, searchFolder1, fName);
}
else if (strstr(pathname, searchFolder2) != NULL)
{
sprintf((void *)searchFileName, format, searchFolder2, fName);
}
else
{
return false;
}
for (int x = 0; x < filesToModCount; x++)
{
if (strcmp(filesToMod[x].fileName, searchFileName) == 0)
{
*idx = x;
return true;
}
} }
return false; return false;
} }
@@ -668,7 +665,7 @@ bool shaderFileInList(const char *pathname, int *idx)
*/ */
long int ftellGetShaderSize(int idx) long int ftellGetShaderSize(int idx)
{ {
int gId = getConfig()->crc32; uint32_t gId = getConfig()->crc32;
if (gId == GHOST_SQUAD_EVOLUTION) if (gId == GHOST_SQUAD_EVOLUTION)
{ {
if (getConfig()->GPUVendor != NVIDIA_GPU) if (getConfig()->GPUVendor != NVIDIA_GPU)
@@ -677,24 +674,22 @@ long int ftellGetShaderSize(int idx)
} }
return gsevoNvidiaShaderPatches[idx].shaderBufferSize; return gsevoNvidiaShaderPatches[idx].shaderBufferSize;
} }
else if ((gId == LETS_GO_JUNGLE) || (gId == LETS_GO_JUNGLE_REVA) || (gId == LETS_GO_JUNGLE_SPECIAL)) else if (gId == LETS_GO_JUNGLE || gId == LETS_GO_JUNGLE_REVA || gId == LETS_GO_JUNGLE_SPECIAL)
{ {
return lgjShaderFilesToMod[idx].shaderBufferSize; return lgjShaderFilesToMod[idx].shaderBufferSize;
} }
else if ((gId == INITIALD_4_EXP_REVB) || (gId == INITIALD_4_EXP_REVC) || (gId == INITIALD_4_EXP_REVD) || else if (gId == INITIALD_4_EXP_REVB || gId == INITIALD_4_EXP_REVC || gId == INITIALD_4_EXP_REVD || gId == INITIALD_5_JAP_REVA ||
(gId == INITIALD_5_JAP_REVA) || (gId == INITIALD_5_JAP_REVF) || (gId == INITIALD_5_EXP_30) || gId == INITIALD_5_JAP_REVF || gId == INITIALD_5_EXP || gId == INITIALD_5_EXP_20 || gId == INITIALD_5_EXP_20A)
(gId == INITIALD_5_EXP_40))
{ {
return idShaderFilesToMod[idx].shaderBufferSize; return idShaderFilesToMod[idx].shaderBufferSize;
} }
else if ((gId == INITIALD_4_REVA) || (gId == INITIALD_4_REVB) || (gId == INITIALD_4_REVC) || else if (gId == INITIALD_4_REVA || gId == INITIALD_4_REVB || gId == INITIALD_4_REVC || gId == INITIALD_4_REVD || gId == INITIALD_4_REVG)
(gId == INITIALD_4_REVD) || (gId == INITIALD_4_REVG))
{ {
return id4jShaderFilesToMod[idx].shaderBufferSize; return id4jShaderFilesToMod[idx].shaderBufferSize;
} }
else if ((gId == VIRTUA_TENNIS_3) || (gId == VIRTUA_TENNIS_3_TEST) || (gId == VIRTUA_TENNIS_3_REVA) || else 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_REVA_TEST) || (gId == VIRTUA_TENNIS_3_REVB) || gId == VIRTUA_TENNIS_3_REVB || gId == VIRTUA_TENNIS_3_REVB_TEST || gId == VIRTUA_TENNIS_3_REVC ||
(gId == VIRTUA_TENNIS_3_REVB_TEST) || (gId == VIRTUA_TENNIS_3_REVC) || (gId == VIRTUA_TENNIS_3_REVC_TEST)) gId == VIRTUA_TENNIS_3_REVC_TEST)
{ {
return vt3ShaderFilesToMod[idx].shaderBufferSize; return vt3ShaderFilesToMod[idx].shaderBufferSize;
} }
@@ -713,12 +708,11 @@ long int ftellGetShaderSize(int idx)
return ramboNvidiaShaderPatches[idx].shaderBufferSize; return ramboNvidiaShaderPatches[idx].shaderBufferSize;
} }
} }
else if ((gId == THE_HOUSE_OF_THE_DEAD_4_REVA) || (gId == THE_HOUSE_OF_THE_DEAD_4_REVB) || else if (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_REVC))
{ {
return hod4ShaderPatches[idx].shaderBufferSize; return hod4ShaderPatches[idx].shaderBufferSize;
} }
else if ((gId == THE_HOUSE_OF_THE_DEAD_4_SPECIAL) || (gId == THE_HOUSE_OF_THE_DEAD_4_SPECIAL_REVB)) else if (gId == THE_HOUSE_OF_THE_DEAD_4_SPECIAL || gId == THE_HOUSE_OF_THE_DEAD_4_SPECIAL_REVB)
{ {
return hod4spShaderPatches[idx].shaderBufferSize; return hod4spShaderPatches[idx].shaderBufferSize;
} }
@@ -726,7 +720,7 @@ long int ftellGetShaderSize(int idx)
{ {
return hodexShaderPatches[idx].shaderBufferSize; return hodexShaderPatches[idx].shaderBufferSize;
} }
else if ((gId == HUMMER) || (gId == HUMMER_SDLX) || (gId == HUMMER_EXTREME) || (gId == HUMMER_EXTREME_MDX)) else if (gId == HUMMER || gId == HUMMER_SDLX || gId == HUMMER_EXTREME || gId == HUMMER_EXTREME_MDX)
{ {
return hummerShaderFilesToMod[idx].shaderBufferSize; return hummerShaderFilesToMod[idx].shaderBufferSize;
} }
@@ -747,7 +741,7 @@ long int ftellGetShaderSize(int idx)
*/ */
size_t freadReplace(void *buf, size_t size, size_t count, int idx) size_t freadReplace(void *buf, size_t size, size_t count, int idx)
{ {
int gId = getConfig()->crc32; uint32_t gId = getConfig()->crc32;
if (gId == GHOST_SQUAD_EVOLUTION) if (gId == GHOST_SQUAD_EVOLUTION)
{ {
if (getConfig()->GPUVendor != NVIDIA_GPU) if (getConfig()->GPUVendor != NVIDIA_GPU)
@@ -760,27 +754,25 @@ size_t freadReplace(void *buf, size_t size, size_t count, int idx)
} }
return 1; return 1;
} }
else if ((gId == LETS_GO_JUNGLE) || (gId == LETS_GO_JUNGLE_REVA) || (gId == LETS_GO_JUNGLE_SPECIAL)) else if (gId == LETS_GO_JUNGLE || gId == LETS_GO_JUNGLE_REVA || gId == LETS_GO_JUNGLE_SPECIAL)
{ {
memcpy(buf, lgjShaderFilesToMod[idx].shaderBuffer, size); memcpy(buf, lgjShaderFilesToMod[idx].shaderBuffer, size);
return size; return size;
} }
else if ((gId == INITIALD_4_EXP_REVB) || (gId == INITIALD_4_EXP_REVC) || (gId == INITIALD_4_EXP_REVD) || else if (gId == INITIALD_4_EXP_REVB || gId == INITIALD_4_EXP_REVC || gId == INITIALD_4_EXP_REVD || gId == INITIALD_5_JAP_REVA ||
(gId == INITIALD_5_JAP_REVA) || (gId == INITIALD_5_JAP_REVF) || (gId == INITIALD_5_EXP_30) || gId == INITIALD_5_JAP_REVF || gId == INITIALD_5_EXP || gId == INITIALD_5_EXP_20 || gId == INITIALD_5_EXP_20A)
(gId == INITIALD_5_EXP_40))
{ {
memcpy(buf, idShaderFilesToMod[idx].shaderBuffer, size); memcpy(buf, idShaderFilesToMod[idx].shaderBuffer, size);
return size; return size;
} }
else if ((gId == INITIALD_4_REVA) || (gId == INITIALD_4_REVB) || (gId == INITIALD_4_REVC) || else if (gId == INITIALD_4_REVA || gId == INITIALD_4_REVB || gId == INITIALD_4_REVC || gId == INITIALD_4_REVD || gId == INITIALD_4_REVG)
(gId == INITIALD_4_REVD) || (gId == INITIALD_4_REVG))
{ {
memcpy(buf, id4jShaderFilesToMod[idx].shaderBuffer, size); memcpy(buf, id4jShaderFilesToMod[idx].shaderBuffer, size);
return size; return size;
} }
else if ((gId == VIRTUA_TENNIS_3) || (gId == VIRTUA_TENNIS_3_TEST) || (gId == VIRTUA_TENNIS_3_REVA) || else 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_REVA_TEST) || (gId == VIRTUA_TENNIS_3_REVB) || gId == VIRTUA_TENNIS_3_REVB || gId == VIRTUA_TENNIS_3_REVB_TEST || gId == VIRTUA_TENNIS_3_REVC ||
(gId == VIRTUA_TENNIS_3_REVB_TEST) || (gId == VIRTUA_TENNIS_3_REVC) || (gId == VIRTUA_TENNIS_3_REVC_TEST)) gId == VIRTUA_TENNIS_3_REVC_TEST)
{ {
memcpy(buf, vt3ShaderFilesToMod[idx].shaderBuffer, size); memcpy(buf, vt3ShaderFilesToMod[idx].shaderBuffer, size);
return size; return size;
@@ -803,13 +795,12 @@ size_t freadReplace(void *buf, size_t size, size_t count, int idx)
return ramboNvidiaShaderPatches[idx].shaderBufferSize; return ramboNvidiaShaderPatches[idx].shaderBufferSize;
} }
} }
else if ((gId == THE_HOUSE_OF_THE_DEAD_4_REVA) || (gId == THE_HOUSE_OF_THE_DEAD_4_REVB) || else if (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_REVC))
{ {
memcpy(buf, hod4ShaderPatches[idx].shaderBuffer, hod4ShaderPatches[idx].shaderBufferSize); memcpy(buf, hod4ShaderPatches[idx].shaderBuffer, hod4ShaderPatches[idx].shaderBufferSize);
return hod4ShaderPatches[idx].shaderBufferSize; return hod4ShaderPatches[idx].shaderBufferSize;
} }
else if ((gId == THE_HOUSE_OF_THE_DEAD_4_SPECIAL) || (gId == THE_HOUSE_OF_THE_DEAD_4_SPECIAL_REVB)) else if (gId == THE_HOUSE_OF_THE_DEAD_4_SPECIAL || gId == THE_HOUSE_OF_THE_DEAD_4_SPECIAL_REVB)
{ {
memcpy(buf, hod4spShaderPatches[idx].shaderBuffer, hod4spShaderPatches[idx].shaderBufferSize); memcpy(buf, hod4spShaderPatches[idx].shaderBuffer, hod4spShaderPatches[idx].shaderBufferSize);
return hod4spShaderPatches[idx].shaderBufferSize; return hod4spShaderPatches[idx].shaderBufferSize;
@@ -819,7 +810,7 @@ size_t freadReplace(void *buf, size_t size, size_t count, int idx)
memcpy(buf, hodexShaderPatches[idx].shaderBuffer, hodexShaderPatches[idx].shaderBufferSize); memcpy(buf, hodexShaderPatches[idx].shaderBuffer, hodexShaderPatches[idx].shaderBufferSize);
return hodexShaderPatches[idx].shaderBufferSize; return hodexShaderPatches[idx].shaderBufferSize;
} }
else if ((gId == HUMMER) || (gId == HUMMER_SDLX) || (gId == HUMMER_EXTREME) || (gId == HUMMER_EXTREME_MDX)) else if (gId == HUMMER || gId == HUMMER_SDLX || gId == HUMMER_EXTREME || gId == HUMMER_EXTREME_MDX)
{ {
memcpy(buf, hummerShaderFilesToMod[idx].shaderBuffer, hummerShaderFilesToMod[idx].shaderBufferSize); memcpy(buf, hummerShaderFilesToMod[idx].shaderBuffer, hummerShaderFilesToMod[idx].shaderBufferSize);
return hummerShaderFilesToMod[idx].shaderBufferSize; return hummerShaderFilesToMod[idx].shaderBufferSize;
@@ -849,10 +840,10 @@ char *cgGetProgramString(char *program, int e)
uint32_t gId = getConfig()->crc32; uint32_t gId = getConfig()->crc32;
if ((gId != INITIALD_4_EXP_REVB) && (gId != INITIALD_4_EXP_REVC) && (gId != INITIALD_4_EXP_REVD) && if (gId != INITIALD_4_EXP_REVB && gId != INITIALD_4_EXP_REVC && gId != INITIALD_4_EXP_REVD && gId != INITIALD_4_REVA &&
(gId != INITIALD_4_REVA) && (gId != INITIALD_4_REVB) && (gId != INITIALD_4_REVC) && (gId != INITIALD_4_REVD) && gId != INITIALD_4_REVB && gId != INITIALD_4_REVC && gId != INITIALD_4_REVD && gId != INITIALD_4_REVG &&
(gId != INITIALD_4_REVG) && (gId != INITIALD_5_JAP_REVA) && (gId != INITIALD_5_JAP_REVF) && gId != INITIALD_5_JAP_REVA && gId != INITIALD_5_JAP_REVF && gId != INITIALD_5_EXP && gId != INITIALD_5_EXP_20 &&
(gId != INITIALD_5_EXP_30) && (gId != INITIALD_5_EXP_40)) gId != INITIALD_5_EXP_20A)
{ {
return _cgGetProgramString(program, e); return _cgGetProgramString(program, e);
} }
@@ -1098,23 +1089,23 @@ char *cgCreateProgram(uint32_t context, int program_type, const char *program, i
const char **args) = dlsym(RTLD_NEXT, "cgCreateProgram"); const char **args) = dlsym(RTLD_NEXT, "cgCreateProgram");
uint32_t gId = getConfig()->crc32; uint32_t gId = getConfig()->crc32;
if (((gId != VIRTUA_TENNIS_3) && (gId != VIRTUA_TENNIS_3_TEST) && (gId != VIRTUA_TENNIS_3_REVA) && 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_REVA_TEST) && (gId != VIRTUA_TENNIS_3_REVB) && (gId != VIRTUA_TENNIS_3_REVB_TEST) && gId != VIRTUA_TENNIS_3_REVB && gId != VIRTUA_TENNIS_3_REVB_TEST && gId != VIRTUA_TENNIS_3_REVC &&
(gId != VIRTUA_TENNIS_3_REVC) && (gId != VIRTUA_TENNIS_3_REVC_TEST) && (gId != INITIALD_4_EXP_REVB) && gId != VIRTUA_TENNIS_3_REVC_TEST && gId != INITIALD_4_EXP_REVB && gId != INITIALD_4_EXP_REVC && gId != INITIALD_4_EXP_REVD &&
(gId != INITIALD_4_EXP_REVC) && (gId != INITIALD_4_EXP_REVD) && (gId != LETS_GO_JUNGLE) && gId != LETS_GO_JUNGLE && gId != LETS_GO_JUNGLE_REVA && gId != LETS_GO_JUNGLE_SPECIAL && gId != INITIALD_4_REVA &&
(gId != LETS_GO_JUNGLE_REVA) && (gId != LETS_GO_JUNGLE_SPECIAL) && (gId != INITIALD_4_REVA) && gId != INITIALD_4_REVB && gId != INITIALD_4_REVC && gId != INITIALD_4_REVD && gId != INITIALD_4_REVG &&
(gId != INITIALD_4_REVB) && (gId != INITIALD_4_REVC) && (gId != INITIALD_4_REVD) && (gId != INITIALD_4_REVG) && gId != INITIALD_5_JAP_REVA && gId != INITIALD_5_JAP_REVF && gId != INITIALD_5_EXP && gId != INITIALD_5_EXP_20 &&
(gId != INITIALD_5_JAP_REVA) && (gId != INITIALD_5_JAP_REVF) && (gId != INITIALD_5_EXP_30) && gId != INITIALD_5_EXP_20A) ||
(gId != INITIALD_5_EXP_40)) ||
(getConfig()->GPUVendor == NVIDIA_GPU)) (getConfig()->GPUVendor == NVIDIA_GPU))
{ {
return _cgCreateProgram(context, program_type, program, profile, entry, args); if ((gId != LETS_GO_JUNGLE && gId != LETS_GO_JUNGLE_REVA && gId != LETS_GO_JUNGLE_SPECIAL) || getConfig()->lgjRenderWithMesa == 0)
return _cgCreateProgram(context, program_type, program, profile, entry, args);
} }
if ((gId == INITIALD_4_EXP_REVB) || (gId == INITIALD_4_EXP_REVC) || (gId == INITIALD_4_EXP_REVD) || if (gId == INITIALD_4_EXP_REVB || gId == INITIALD_4_EXP_REVC || gId == INITIALD_4_EXP_REVD || gId == INITIALD_4_REVA ||
(gId == INITIALD_4_REVA) || (gId == INITIALD_4_REVB) || (gId == INITIALD_4_REVC) || (gId == INITIALD_4_REVD) || gId == INITIALD_4_REVB || gId == INITIALD_4_REVC || gId == INITIALD_4_REVD || gId == INITIALD_4_REVG ||
(gId == INITIALD_4_REVG) || (gId == INITIALD_5_JAP_REVA) || (gId == INITIALD_5_JAP_REVF) || gId == INITIALD_5_JAP_REVA || gId == INITIALD_5_JAP_REVF || gId == INITIALD_5_EXP || gId == INITIALD_5_EXP_20 ||
(gId == INITIALD_5_EXP_30) || (gId == INITIALD_5_EXP_40)) gId == INITIALD_5_EXP_20A)
{ {
if ((profile == 6148) || (profile == 6150) || profile == 7001) if ((profile == 6148) || (profile == 6150) || profile == 7001)
profile = 6150; profile = 6150;
@@ -1148,9 +1139,8 @@ char *cgCreateProgram(uint32_t context, int program_type, const char *program, i
void gl_ShaderSourceARB(GLhandleARB shaderObj, GLsizei count, const GLcharARB **const string, const GLint *length) void gl_ShaderSourceARB(GLhandleARB shaderObj, GLsizei count, const GLcharARB **const string, const GLint *length)
{ {
int gId = getConfig()->crc32; uint32_t gId = getConfig()->crc32;
if ((gId != SEGA_RACE_TV) && (gId != HUMMER) && (gId != HUMMER_SDLX) && (gId != HUMMER_EXTREME) && if (gId != SEGA_RACE_TV && gId != HUMMER && gId != HUMMER_SDLX && gId != HUMMER_EXTREME && gId != HUMMER_EXTREME_MDX)
(gId != HUMMER_EXTREME_MDX))
{ {
glShaderSourceARB(shaderObj, count, string, length); glShaderSourceARB(shaderObj, count, string, length);
return; return;
@@ -1191,7 +1181,7 @@ void gl_ShaderSourceARB(GLhandleARB shaderObj, GLsizei count, const GLcharARB **
} }
} }
} }
else if ((gId == HUMMER) || (gId == HUMMER_SDLX) || (gId == HUMMER_EXTREME) || (gId == HUMMER_EXTREME_MDX)) else if (gId == HUMMER || gId == HUMMER_SDLX || gId == HUMMER_EXTREME || gId == HUMMER_EXTREME_MDX)
{ {
void *addr = __builtin_return_address(0); void *addr = __builtin_return_address(0);
if ((addr != (void *)0x830a501) && (addr != (void *)0x830a485) && (addr != (void *)0x08319841) && if ((addr != (void *)0x830a501) && (addr != (void *)0x830a485) && (addr != (void *)0x08319841) &&
@@ -1230,8 +1220,8 @@ void gl_ShaderSourceARB(GLhandleARB shaderObj, GLsizei count, const GLcharARB **
void *gl_XGetProcAddressARB(const unsigned char *procName) void *gl_XGetProcAddressARB(const unsigned char *procName)
{ {
int dbgMsg = getConfig()->showDebugMessages; int dbgMsg = getConfig()->showDebugMessages;
if ((getConfig()->crc32 != HUMMER) && (getConfig()->crc32 != HUMMER_SDLX) && if (getConfig()->crc32 != HUMMER && getConfig()->crc32 != HUMMER_SDLX && getConfig()->crc32 != HUMMER_EXTREME &&
(getConfig()->crc32 != HUMMER_EXTREME) && (getConfig()->crc32 != HUMMER_EXTREME_MDX)) getConfig()->crc32 != HUMMER_EXTREME_MDX)
{ {
if (strcmp((const char *)procName, "glGenOcclusionQueriesNV") == 0) if (strcmp((const char *)procName, "glGenOcclusionQueriesNV") == 0)
{ {
@@ -1608,7 +1598,7 @@ int xdlt_load_mmfile(char const *path, mmfile_t *mf)
int pos = 0; int pos = 0;
long size; long size;
char *blk; char *blk;
int gId = getConfig()->crc32; uint32_t gId = getConfig()->crc32;
if (xdl_init_mmfile(mf, XDLT_STD_BLKSIZE, XDL_MMF_ATOMIC) < 0) if (xdl_init_mmfile(mf, XDLT_STD_BLKSIZE, XDL_MMF_ATOMIC) < 0)
{ {
exit(1); exit(1);
@@ -1673,7 +1663,7 @@ int handle_patch(void *priv, mmbuffer_t *mb, int nbuf)
*/ */
void cacheModedShaderFiles() void cacheModedShaderFiles()
{ {
int gId = getConfig()->crc32; uint32_t gId = getConfig()->crc32;
char cwd[256]; char cwd[256];
char fullPath[512]; char fullPath[512];
char shaderBuffer[100000]; char shaderBuffer[100000];
@@ -1699,15 +1689,14 @@ void cacheModedShaderFiles()
free(newProgram); free(newProgram);
} }
} }
else if ((gId == INITIALD_4_EXP_REVB) || (gId == INITIALD_4_EXP_REVC) || (gId == INITIALD_4_EXP_REVD) || else if (gId == INITIALD_4_EXP_REVB || gId == INITIALD_4_EXP_REVC || gId == INITIALD_4_EXP_REVD || gId == INITIALD_4_REVA ||
(gId == INITIALD_4_REVA) || (gId == INITIALD_4_REVB) || (gId == INITIALD_4_REVC) || gId == INITIALD_4_REVB || gId == INITIALD_4_REVC || gId == INITIALD_4_REVD || gId == INITIALD_4_REVG ||
(gId == INITIALD_4_REVD) || (gId == INITIALD_4_REVG) || (gId == INITIALD_5_JAP_REVA) || gId == INITIALD_5_JAP_REVA || gId == INITIALD_5_JAP_REVF || gId == INITIALD_5_EXP || gId == INITIALD_5_EXP_20 ||
(gId == INITIALD_5_JAP_REVF) || (gId == INITIALD_5_EXP_30) || (gId == INITIALD_5_EXP_40)) gId == INITIALD_5_EXP_20A)
{ {
ShaderFilesToMod *shaderFilesToMod; ShaderFilesToMod *shaderFilesToMod;
int filesToModCount; int filesToModCount;
if ((gId == INITIALD_4_REVA) || (gId == INITIALD_4_REVB) || (gId == INITIALD_4_REVC) || if (gId == INITIALD_4_REVA || gId == INITIALD_4_REVB || gId == INITIALD_4_REVC || gId == INITIALD_4_REVD || gId == INITIALD_4_REVG)
(gId == INITIALD_4_REVD) || (gId == INITIALD_4_REVG))
{ {
shaderFilesToMod = id4jShaderFilesToMod; shaderFilesToMod = id4jShaderFilesToMod;
filesToModCount = id4FilesToModCount; filesToModCount = id4FilesToModCount;
@@ -1719,8 +1708,8 @@ void cacheModedShaderFiles()
} }
for (int x = 0; x < filesToModCount; x++) for (int x = 0; x < filesToModCount; x++)
{ {
if ((gId == INITIALD_5_JAP_REVA) || (gId == INITIALD_5_JAP_REVF) || (gId == INITIALD_5_EXP_30) || if (gId == INITIALD_5_JAP_REVA || gId == INITIALD_5_JAP_REVF || gId == INITIALD_5_EXP || gId == INITIALD_5_EXP_20 ||
(gId == INITIALD_5_EXP_40)) gId == INITIALD_5_EXP_20A)
{ {
char *fName = shaderFilesToMod[x].fileName; char *fName = shaderFilesToMod[x].fileName;
shaderFilesToMod[x].fileName = replaceSubstring(fName, 0, strlen(fName), "Shader", "V5SHADER"); shaderFilesToMod[x].fileName = replaceSubstring(fName, 0, strlen(fName), "Shader", "V5SHADER");
@@ -1749,9 +1738,9 @@ void cacheModedShaderFiles()
free(newProgram); free(newProgram);
} }
} }
else if ((gId == VIRTUA_TENNIS_3) || (gId == VIRTUA_TENNIS_3_TEST) || (gId == VIRTUA_TENNIS_3_REVA) || else 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_REVA_TEST) || (gId == VIRTUA_TENNIS_3_REVB) || gId == VIRTUA_TENNIS_3_REVB || gId == VIRTUA_TENNIS_3_REVB_TEST || gId == VIRTUA_TENNIS_3_REVC ||
(gId == VIRTUA_TENNIS_3_REVB_TEST) || (gId == VIRTUA_TENNIS_3_REVC) || (gId == VIRTUA_TENNIS_3_REVC_TEST)) gId == VIRTUA_TENNIS_3_REVC_TEST)
{ {
for (int x = 0; x < vt3FilesToModCount; x++) for (int x = 0; x < vt3FilesToModCount; x++)
{ {
@@ -1830,14 +1819,13 @@ void cacheModedShaderFiles()
shaderFilesToPatch = hodexShaderPatches; shaderFilesToPatch = hodexShaderPatches;
shaderFilesToPatchCount = hodexShaderPatchesCount; shaderFilesToPatchCount = hodexShaderPatchesCount;
} }
else if ((gId == THE_HOUSE_OF_THE_DEAD_4_REVA) || (gId == THE_HOUSE_OF_THE_DEAD_4_REVB) || else if (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_REVC))
{ {
sprintf(folderName, "/../fs/dat/"); sprintf(folderName, "/../fs/dat/");
shaderFilesToPatchCount = hod4ShaderPatchesCount; shaderFilesToPatchCount = hod4ShaderPatchesCount;
shaderFilesToPatch = hod4ShaderPatches; shaderFilesToPatch = hod4ShaderPatches;
} }
else if ((gId == THE_HOUSE_OF_THE_DEAD_4_SPECIAL) || (gId == THE_HOUSE_OF_THE_DEAD_4_SPECIAL_REVB)) else if (gId == THE_HOUSE_OF_THE_DEAD_4_SPECIAL || gId == THE_HOUSE_OF_THE_DEAD_4_SPECIAL_REVB)
{ {
sprintf(folderName, "/../fs/dat/"); sprintf(folderName, "/../fs/dat/");
shaderFilesToPatchCount = hod4spShaderPatchesCount; shaderFilesToPatchCount = hod4spShaderPatchesCount;
File diff suppressed because it is too large Load Diff
+120 -81
View File
@@ -4,7 +4,6 @@
#endif #endif
#undef __x86_64__ #undef __x86_64__
#include <GL/glx.h> #include <GL/glx.h>
#include <GL/freeglut.h>
#include <X11/Xatom.h> #include <X11/Xatom.h>
#include <X11/extensions/xf86vmode.h> #include <X11/extensions/xf86vmode.h>
#include <dlfcn.h> #include <dlfcn.h>
@@ -19,12 +18,19 @@
#include "config.h" #include "config.h"
#include "securityboard.h" #include "securityboard.h"
#include "fps_limiter.h" #include "fps_limiter.h"
#include "sdlcalls.h"
extern bool SDLGame; extern bool SDLWindowCreated;
extern bool gettingGPUVendor; extern bool gettingGPUVendor;
extern bool GLUTGame;
bool creatingWindow = false;
Window win; Window win;
extern Display *x11Display;
extern Window x11Window;
/** /**
* Stop the house of the dead games turning keyboard repeating off. * Stop the house of the dead games turning keyboard repeating off.
*/ */
@@ -33,43 +39,56 @@ int XAutoRepeatOff(Display *display)
return 0; return 0;
} }
Window XCreateWindow(Display *display, Window parent, int x, int y, unsigned int width, unsigned int height, Display *XOpenDisplay(const char *display_name)
unsigned int border_width, int depth, unsigned int class, Visual *visual, unsigned long valueMask, {
XSetWindowAttributes *attributes) 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;
return x11Display;
}
Window XCreateWindow(Display *display, Window parent, int x, int y, unsigned int width, unsigned int height, unsigned int border_width,
int depth, unsigned int class, Visual *visual, unsigned long valueMask, XSetWindowAttributes *attributes)
{ {
Window (*_XCreateWindow)(Display *display, Window parent, int x, int y, unsigned int width, unsigned int height, Window (*_XCreateWindow)(Display *display, Window parent, int x, int y, unsigned int width, unsigned int height,
unsigned int border_width, int depth, unsigned int class, Visual *visual, unsigned int border_width, int depth, unsigned int class, Visual *visual,
unsigned long valueMask, XSetWindowAttributes *attributes) = unsigned long valueMask, XSetWindowAttributes *attributes) =
dlsym(RTLD_NEXT, "XCreateWindow"); dlsym(RTLD_NEXT, "XCreateWindow");
if (SDLGame || gettingGPUVendor) if ((gettingGPUVendor || creatingWindow) || (GLUTGame && getConfig()->noSDL == 0))
{ {
Window window = _XCreateWindow(display, parent, x, y, width, height, border_width, depth, class, visual, Window window = _XCreateWindow(display, parent, x, y, width, height, border_width, depth, class, visual,
valueMask, attributes); valueMask, attributes);
return window; return window;
} }
width = getConfig()->width; if (getConfig()->noSDL)
height = getConfig()->height;
// Ensure that the windows will respond with keyboard and mouse events
attributes->event_mask = attributes->event_mask | KeyPressMask | KeyReleaseMask | PointerMotionMask;
// attributes->override_redirect = False;
Window 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)
{ {
Atom wm_state = XInternAtom(display, "_NET_WM_STATE", true); width = getConfig()->width;
Atom wm_fullscreen = XInternAtom(display, "_NET_WM_STATE_FULLSCREEN", true); height = getConfig()->height;
XChangeProperty(display, window, wm_state, XA_ATOM, 32, PropModeReplace, (unsigned char *)&wm_fullscreen, 1);
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);
printf(" X11 RESOLUTION: %dx%d\n\n", width, height);
if (getConfig()->fullscreen)
{
Atom wm_state = XInternAtom(display, "_NET_WM_STATE", true);
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;
} }
else
win = window; {
win = x11Window;
return window; }
return win;
} }
int XGrabPointer(Display *display, Window grab_window, Bool owner_events, unsigned int event_mask, int pointer_mode, int XGrabPointer(Display *display, Window grab_window, Bool owner_events, unsigned int event_mask, int pointer_mode,
@@ -78,10 +97,15 @@ int XGrabPointer(Display *display, Window grab_window, Bool owner_events, unsign
int (*_XGrabPointer)(Display *display, Window grab_window, Bool owner_events, unsigned int event_mask, int (*_XGrabPointer)(Display *display, Window grab_window, Bool owner_events, unsigned int event_mask,
int pointer_mode, int keyboard_mode, Window confine_to, Cursor cursor, Time time) = int pointer_mode, int keyboard_mode, Window confine_to, Cursor cursor, Time time) =
dlsym(RTLD_NEXT, "XGrabPointer"); dlsym(RTLD_NEXT, "XGrabPointer");
int returnValue = _XGrabPointer(display, grab_window, owner_events, event_mask, pointer_mode, keyboard_mode,
confine_to, cursor, time); if (getConfig()->noSDL)
XUngrabPointer(display, time); {
return returnValue; int returnValue =
_XGrabPointer(display, grab_window, owner_events, event_mask, pointer_mode, keyboard_mode, confine_to, cursor, time);
XUngrabPointer(display, time);
return returnValue;
}
return _XGrabPointer(display, grab_window, owner_events, event_mask, pointer_mode, keyboard_mode, confine_to, cursor, time);
} }
int XGrabKeyboard(Display *display, Window grab_window, Bool owner_events, int pointer_mode, int keyboard_mode, int XGrabKeyboard(Display *display, Window grab_window, Bool owner_events, int pointer_mode, int keyboard_mode,
@@ -89,22 +113,27 @@ int XGrabKeyboard(Display *display, Window grab_window, Bool owner_events, int p
{ {
int (*_XGrabKeyboard)(Display *display, Window grab_window, Bool owner_events, int pointer_mode, int keyboard_mode, int (*_XGrabKeyboard)(Display *display, Window grab_window, Bool owner_events, int pointer_mode, int keyboard_mode,
Time time) = dlsym(RTLD_NEXT, "XGrabKeyboard"); Time time) = dlsym(RTLD_NEXT, "XGrabKeyboard");
int returnValue = _XGrabKeyboard(display, grab_window, owner_events, pointer_mode, keyboard_mode, time);
XUngrabKeyboard(display, time);
return returnValue;
}
int XDefineCursor(Display *display, Window w, Cursor cursor) if (getConfig()->noSDL)
{ {
return 0; int returnValue = _XGrabKeyboard(display, grab_window, owner_events, pointer_mode, keyboard_mode, time);
XUngrabKeyboard(display, time);
return returnValue;
}
return _XGrabKeyboard(display, grab_window, owner_events, pointer_mode, keyboard_mode, time);
} }
int XStoreName(Display *display, Window w, const char *window_name) int XStoreName(Display *display, Window w, const char *window_name)
{ {
int (*_XStoreName)(Display *display, Window w, const char *window_name) = dlsym(RTLD_NEXT, "XStoreName"); int (*_XStoreName)(Display *display, Window w, const char *window_name) = dlsym(RTLD_NEXT, "XStoreName");
char windowTitle[512];
sprintf(windowTitle, "%s - FPS: %.2f", getGameName(), calculateFps()); if (getConfig()->noSDL)
return _XStoreName(display, w, windowTitle); {
char windowTitle[512];
sprintf(windowTitle, "%s - FPS: %.2f", getGameName(), calculateFps());
return _XStoreName(display, w, windowTitle);
}
return _XStoreName(display, w, window_name);
} }
int XSetStandardProperties(Display *display, Window window, const char *window_name, const char *icon_name, int XSetStandardProperties(Display *display, Window window, const char *window_name, const char *icon_name,
@@ -113,9 +142,30 @@ int XSetStandardProperties(Display *display, Window window, const char *window_n
int (*_XSetStandardProperties)(Display *display, Window window, const char *window_name, const char *icon_name, int (*_XSetStandardProperties)(Display *display, Window window, const char *window_name, const char *icon_name,
Pixmap icon_pixmap, char **argv, int argc, XSizeHints *hints) = Pixmap icon_pixmap, char **argv, int argc, XSizeHints *hints) =
dlsym(RTLD_NEXT, "XSetStandardProperties"); dlsym(RTLD_NEXT, "XSetStandardProperties");
char gameTitle[256] = {0};
strcat(gameTitle, getGameName()); if (getConfig()->noSDL)
return _XSetStandardProperties(display, window, gameTitle, icon_name, icon_pixmap, argv, argc, hints); {
char gameTitle[256] = {0};
strcat(gameTitle, getGameName());
return _XSetStandardProperties(display, window, gameTitle, icon_name, icon_pixmap, argv, argc, hints);
}
return _XSetStandardProperties(display, window, window_name, icon_name, icon_pixmap, argv, argc, hints);
}
int XPending(Display *display)
{
int (*_XPending)(Display *display) = dlsym(RTLD_NEXT, "XPending");
if (SDLWindowCreated)
return 0;
return _XPending(display);
}
int XFlush(Display *display)
{
int (*_XFlush)(Display *display) = dlsym(RTLD_NEXT, "XFlush");
if (SDLWindowCreated)
return 0;
return _XFlush(display);
} }
Bool XF86VidModeSwitchToMode(Display *display, int screen, XF86VidModeModeInfo *modesinfo) Bool XF86VidModeSwitchToMode(Display *display, int screen, XF86VidModeModeInfo *modesinfo)
@@ -153,48 +203,37 @@ int XF86VidModeGetAllModeLines(Display *display, int screen, int *modecount_retu
return true; return true;
} }
int XPending(Display *display) // Cursor XCreatePixmapCursor(Display *display, Pixmap source, Pixmap mask, XColor *fg, XColor *bg, unsigned int x,
{ // unsigned int y)
int (*_XPending)(Display *display) = dlsym(RTLD_NEXT, "XPending"); // {
if (SDLGame) // int (*_XCreatePixmapCursor)(Display *display, Pixmap source, Pixmap mask, XColor *fg, XColor *bg, unsigned int x,
return 0; // unsigned int y) = dlsym(RTLD_NEXT, "XCreatePixmapCursor");
return _XPending(display); // if (SDLGame)
} // return 0;
// return _XCreatePixmapCursor(display, source, mask, fg, bg, x, y);
// }
Cursor XCreatePixmapCursor(Display *display, Pixmap source, Pixmap mask, XColor *fg, XColor *bg, unsigned int x, // int XFreePixmap(Display *display, Pixmap pixmap)
unsigned int y) // {
{ // int (*_XFreePixmap)(Display *display, Pixmap pixmap) = dlsym(RTLD_NEXT, "XFreePixmap");
int (*_XCreatePixmapCursor)(Display *display, Pixmap source, Pixmap mask, XColor *fg, XColor *bg, unsigned int x, // if (SDLGame)
unsigned int y) = dlsym(RTLD_NEXT, "XCreatePixmapCursor"); // return 0;
if (SDLGame) // return _XFreePixmap(display, pixmap);
return 0; // }
return _XCreatePixmapCursor(display, source, mask, fg, bg, x, y);
}
int XFreePixmap(Display *display, Pixmap pixmap) // Pixmap XCreateBitmapFromData(Display *display, Drawable drawable, const char *data, unsigned int x, unsigned int y)
{ // {
int (*_XFreePixmap)(Display *display, Pixmap pixmap) = dlsym(RTLD_NEXT, "XFreePixmap"); // Pixmap (*_XCreateBitmapFromData)(Display *display, Drawable drawable, const char *data, unsigned int x,
if (SDLGame) // unsigned int y) = dlsym(RTLD_NEXT, "XCreateBitmapFromData");
return 0; // if (SDLGame)
return _XFreePixmap(display, pixmap); // return 0;
} // return _XCreateBitmapFromData(display, drawable, data, x, y);
// }
Pixmap XCreateBitmapFromData(Display *display, Drawable drawable, const char *data, unsigned int x, unsigned int y) // int XDefineCursor(Display *display, Window w, Cursor cursor)
{ // {
Pixmap (*_XCreateBitmapFromData)(Display *display, Drawable drawable, const char *data, unsigned int x, // return 0;
unsigned int y) = dlsym(RTLD_NEXT, "XCreateBitmapFromData"); // }
if (SDLGame)
return 0;
return _XCreateBitmapFromData(display, drawable, data, x, y);
}
int XFlush(Display *display)
{
int (*_XFlush)(Display *display) = dlsym(RTLD_NEXT, "XFlush");
if (SDLGame)
return 0;
return _XFlush(display);
}
typedef unsigned int uint; typedef unsigned int uint;