Compare commits

...
17 Commits
Author SHA1 Message Date
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
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
26 changed files with 15908 additions and 442 deletions
+12 -2
View File
@@ -29,20 +29,28 @@ jobs:
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
# Create a GitHub release and upload the artifact # Create a GitHub release and capture the upload URL (only on push events)
- 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 }}
@@ -52,12 +60,14 @@ jobs:
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.
## [Unreleased]
### Added
- Let's go Jungle resolution patch.
- 2 Spicy resolution patch.
- 2 Spicy Patch to allow any IP for Network play.
- HOD4 SP CPU Frequency fix.
- ID4 and ID5 patches for Network link to allowed any NIC name and any IP.
- Harley patch for network link to allowed any NIC name and any IP.
- Fixed a bug in Let's go Jungle when GPU was nVidia and Mesa was set as shader patches.
### [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
+193 -57
View File
@@ -85,9 +85,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 +101,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 +117,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 +134,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 +151,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 +170,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 +185,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 +203,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 +220,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 +235,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 +250,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 +265,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 +280,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 +295,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 +310,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 +325,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 +340,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 +355,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;
@@ -338,9 +370,11 @@ static int detectGame(uint32_t elf_crc)
config.gameDVP = "DVP-5019B"; config.gameDVP = "DVP-5019B";
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;
@@ -351,9 +385,11 @@ static int detectGame(uint32_t elf_crc)
config.gameDVP = "DVP-5020"; config.gameDVP = "DVP-5020";
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;
@@ -364,7 +400,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 +416,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 +431,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 +447,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 +463,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 +479,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 +495,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 +539,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 +554,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 +569,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 +584,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 +599,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 +614,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 +629,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 +644,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 +660,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 +675,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 +691,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 +708,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 +725,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 +740,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 +756,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 +772,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 +787,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 +804,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 +820,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,9 +835,11 @@ 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;
@@ -767,8 +851,10 @@ static int detectGame(uint32_t elf_crc)
config.gameDVP = "DVP-0075"; config.gameDVP = "DVP-0075";
config.gameID = "SBTS"; config.gameID = "SBTS";
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;
@@ -779,9 +865,11 @@ static int detectGame(uint32_t elf_crc)
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 +880,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 +921,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 +934,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 +949,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 +1100,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 +1181,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 +1199,32 @@ 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, "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));
@@ -1346,6 +1470,9 @@ int initConfig()
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 +1504,16 @@ 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, "");
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));
+11
View File
@@ -222,6 +222,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 +260,15 @@ 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];
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;
+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, "255.255.255.0") != 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;
+315 -40
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;
@@ -213,6 +224,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);
@@ -248,12 +265,6 @@ void __attribute__((constructor)) hook_init()
(getConfig()->crc32 == INITIALD_5_EXP_30) || (getConfig()->crc32 == INITIALD_5_EXP_40))) { (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()); 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_SPECIAL)))
{
getConfig()->GPUVendor = AMD_GPU;
}
} }
DIR *opendir(const char *dirname) DIR *opendir(const char *dirname)
@@ -306,27 +317,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 +398,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 +461,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)
@@ -505,22 +583,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 +669,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 +773,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 +823,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 +863,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 +923,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 +949,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 +964,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 +1051,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 +1090,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);
} }
+61
View File
@@ -654,6 +654,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 +824,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;
+134 -11
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)
{ {
@@ -344,6 +347,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 +845,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 +928,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 +993,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
} }
@@ -920,7 +1051,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);
@@ -1961,7 +2092,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
@@ -2285,8 +2416,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 +2486,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 +2555,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 +2624,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
+202 -34
View File
@@ -146,7 +146,14 @@ 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:
{
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:
{ {
@@ -264,7 +271,7 @@ 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 (width == vf5FSwidth)
{ {
@@ -357,25 +364,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 +1136,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)
@@ -1353,11 +1468,17 @@ 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:
@@ -1371,11 +1492,17 @@ 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"); 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:
@@ -1389,11 +1516,17 @@ 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:
@@ -1425,6 +1558,8 @@ int initResolutionPatches()
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 +1568,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))
return 0;
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 +1578,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))
return 0;
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 +1588,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))
return 0;
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 +1598,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))
return 0;
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 +1608,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))
return 0;
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 +1621,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))
return 0;
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 +1634,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))
return 0;
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 +1647,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))
return 0;
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 +1660,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))
return 0;
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 +1671,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))
return 0;
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;
@@ -2062,6 +2217,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)
+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();
+102 -106
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)
@@ -560,104 +561,100 @@ 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_30 || gId == INITIALD_5_EXP_40) &&
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_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) &&
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)
@@ -747,7 +744,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)
@@ -1098,17 +1095,16 @@ 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_30 && gId != INITIALD_5_EXP_40) ||
(gId != INITIALD_5_JAP_REVA) && (gId != INITIALD_5_JAP_REVF) && (gId != INITIALD_5_EXP_30) &&
(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) ||
@@ -1148,7 +1144,7 @@ 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))
{ {
@@ -1608,7 +1604,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 +1669,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];
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)
{ {
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;