mirror of
https://github.com/lindbergh-loader/lindbergh-loader.git
synced 2026-10-14 01:49:12 +03:00
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
cafd6276c3 | ||
|
|
a2dbf1cbda | ||
|
|
74d61985ec | ||
|
|
4d0996b905 | ||
|
|
52cb3eaf6b | ||
|
|
8b6604efc5 | ||
|
|
7b426f0d11 | ||
|
|
442d03b144 | ||
|
|
50a1a35f7f | ||
|
|
728c308835 | ||
|
|
543ebe4817 | ||
|
|
3c3f0f5eb5 | ||
|
|
fe2c749bb0 | ||
|
|
d3e6027139 | ||
|
|
565a9208b7 | ||
|
|
be78a23a31 | ||
|
|
8942c510ec | ||
|
|
685d569a08 | ||
|
|
5f19cdc44c | ||
|
|
be1b88b92f | ||
|
|
93927ef8c9 | ||
|
|
f67f30cbcd | ||
|
|
7ea08b3db3 | ||
|
|
dde7cc7b56 | ||
|
|
6ff5d0b590 | ||
|
|
a4cbbdaa97 | ||
|
|
2810022d1d | ||
|
|
b092b79331 | ||
|
|
1068fd5a1e | ||
|
|
ae61839826 | ||
|
|
5786cdc37d | ||
|
|
5f90591690 | ||
|
|
9ee32e1fb0 | ||
|
|
00a8279ce7 | ||
|
|
ab7fbb7d5f | ||
|
|
69c0156e57 | ||
|
|
51eaec106c | ||
|
|
dcae95fe03 | ||
|
|
fbc76dfe5e |
@@ -42,13 +42,14 @@ jobs:
|
|||||||
|
|
||||||
# Archive the build directory as an artifact for debugging
|
# 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@v4
|
||||||
with:
|
with:
|
||||||
name: build-output
|
name: build-output
|
||||||
path: ./build
|
path: ./build
|
||||||
|
|
||||||
# Create a GitHub release and capture the upload URL
|
# 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
|
id: create_release
|
||||||
uses: actions/create-release@v1
|
uses: actions/create-release@v1
|
||||||
env:
|
env:
|
||||||
@@ -59,8 +60,9 @@ jobs:
|
|||||||
draft: false
|
draft: false
|
||||||
prerelease: false
|
prerelease: false
|
||||||
|
|
||||||
# Upload the compressed build artifact to the release
|
# 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 }}
|
||||||
|
|||||||
@@ -1,7 +1,8 @@
|
|||||||
CC = gcc -m32 -pthread
|
CC ?= gcc
|
||||||
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 -pthread -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
|
CXX ?= g++
|
||||||
LDFLAGS = -Wl,-z,defs -rdynamic -static-libgcc -lc -ldl -lGL -lglut -lX11 -lSDL2 -lm -lpthread -shared -nostdlib -lasound -L./src/libxdiff -lxdiff
|
LD = $(CXX)
|
||||||
|
LDFLAGS = -m32 -Wl,-z,defs -rdynamic -static-libgcc -lc -ldl -lGL -lglut -lX11 -lXcursor -lSDL2 -lm -lpthread -shared -nostdlib -lasound -L./src/libxdiff -lxdiff -L/app/lib32
|
||||||
|
|
||||||
BUILD = build
|
BUILD = build
|
||||||
|
|
||||||
@@ -17,14 +18,14 @@ all: lindbergh libxdiff.a lindbergh.so libsegaapi.so libkswapapi.so libposixtime
|
|||||||
|
|
||||||
lindbergh: src/lindbergh/lindbergh.c src/lindbergh/log.c src/lindbergh/log.h src/lindbergh/jvs.c src/lindbergh/jvs.h src/lindbergh/config.h src/lindbergh/config.c src/lindbergh/evdevinput.h src/lindbergh/evdevinput.c
|
lindbergh: src/lindbergh/lindbergh.c src/lindbergh/log.c src/lindbergh/log.h src/lindbergh/jvs.c src/lindbergh/jvs.h src/lindbergh/config.h src/lindbergh/config.c src/lindbergh/evdevinput.h src/lindbergh/evdevinput.c
|
||||||
mkdir -p $(BUILD)
|
mkdir -p $(BUILD)
|
||||||
$(CC) src/lindbergh/lindbergh.c src/lindbergh/log.h src/lindbergh/log.c src/lindbergh/jvs.h src/lindbergh/jvs.c src/lindbergh/config.h src/lindbergh/config.c src/lindbergh/evdevinput.c src/lindbergh/evdevinput.h -o $(BUILD)/lindbergh -lm
|
$(CC) -m32 src/lindbergh/lindbergh.c src/lindbergh/log.h src/lindbergh/log.c src/lindbergh/jvs.h src/lindbergh/jvs.c src/lindbergh/config.h src/lindbergh/config.c src/lindbergh/evdevinput.c src/lindbergh/evdevinput.h -o $(BUILD)/lindbergh -lm
|
||||||
|
|
||||||
libxdiff.a: $(XDIFF_OBJS)
|
libxdiff.a: $(XDIFF_OBJS)
|
||||||
mkdir -p $(BUILD)
|
mkdir -p $(BUILD)
|
||||||
ar rcs src/libxdiff/libxdiff.a $(XDIFF_OBJS)
|
ar rcs src/libxdiff/libxdiff.a $(XDIFF_OBJS)
|
||||||
|
|
||||||
src/libxdiff/xdiff/%.o: src/libxdiff/xdiff/%.c
|
src/libxdiff/xdiff/%.o: src/libxdiff/xdiff/%.c
|
||||||
$(CC) -DHAVE_CONFIG_H -fPIC -c $< -o $@
|
$(CC) -m32 -DHAVE_CONFIG_H -fPIC -c $< -o $@
|
||||||
|
|
||||||
lindbergh.so: $(OBJS)
|
lindbergh.so: $(OBJS)
|
||||||
mkdir -p $(BUILD)
|
mkdir -p $(BUILD)
|
||||||
@@ -34,18 +35,29 @@ lindbergh.so: $(OBJS)
|
|||||||
$(CC) $(CFLAGS) -c $< -o $@
|
$(CC) $(CFLAGS) -c $< -o $@
|
||||||
|
|
||||||
libsegaapi.so: src/libsegaapi/libsegaapi.o
|
libsegaapi.so: src/libsegaapi/libsegaapi.o
|
||||||
gcc -m32 -O0 -g src/libsegaapi/libsegaapi.c -lFAudio -fPIC -shared -o $(BUILD)/libsegaapi.so
|
$(CC) -m32 -O0 -g src/libsegaapi/libsegaapi.c -lFAudio -L/app/lib32 -fPIC -shared -o $(BUILD)/libsegaapi.so
|
||||||
|
|
||||||
libkswapapi.so: src/libkswapapi/libkswapapi.o
|
libkswapapi.so: src/libkswapapi/libkswapapi.o
|
||||||
$(CC) src/libkswapapi/libkswapapi.o -fPIC -shared -o $(BUILD)/libkswapapi.so
|
$(CC) -m32 src/libkswapapi/libkswapapi.o -fPIC -shared -o $(BUILD)/libkswapapi.so
|
||||||
|
|
||||||
libposixtime.so:
|
libposixtime.so:
|
||||||
$(CC) src/libposixtime/libposixtime.c src/libposixtime/libposixtime.h -m32 -shared -o $(BUILD)/libposixtime.so
|
$(CC) -m32 src/libposixtime/libposixtime.c src/libposixtime/libposixtime.h -m32 -shared -o $(BUILD)/libposixtime.so
|
||||||
ln -s -f libposixtime.so $(BUILD)/libposixtime.so.1
|
ln -s -f libposixtime.so $(BUILD)/libposixtime.so.1
|
||||||
ln -s -f libposixtime.so $(BUILD)/libposixtime.so.2.4
|
ln -s -f libposixtime.so $(BUILD)/libposixtime.so.2.4
|
||||||
|
|
||||||
# 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
|
||||||
|
|||||||
@@ -0,0 +1,42 @@
|
|||||||
|
# Changelog
|
||||||
|
|
||||||
|
All notable changes to this project will be documented in this file.
|
||||||
|
|
||||||
|
## [2.0.3]
|
||||||
|
### Added
|
||||||
|
- Display a warning when loading an Elf that is not clean.
|
||||||
|
- Added to the lib folder, common libraries that are usually missing.
|
||||||
|
### Fixed
|
||||||
|
- Missing patch in HOD-EX.
|
||||||
|
- Alows to run a game that does not support Card reader if option enabled in conf file.
|
||||||
|
|
||||||
|
## [2.0.2] 2025-01-27
|
||||||
|
### Added
|
||||||
|
- InitialD 5 SBRY added.
|
||||||
|
- HOD4 SP CPU Frequency fix.
|
||||||
|
### Fixed
|
||||||
|
- Fixed a bug when a game uses GLUT and the conf was set to NO_SDL 1
|
||||||
|
- Fixed a bug in Let's go Jungle when GPU was nVidia and Mesa was set as shader patches.
|
||||||
|
- Exclude resolution patches when the resolution is the game's original resolution.
|
||||||
|
- Reload with Right mouse click for Rambo and 2Spicy with SDL.
|
||||||
|
|
||||||
|
### [2.0.1] 2025-01-23
|
||||||
|
### Added
|
||||||
|
- HOD4 Custom crosshair.
|
||||||
|
- HOD4 CPU frequency fix (Configurable via config file).
|
||||||
|
- HOD4 New resolution patch that fixes Boss battle and scales from 1280x768 instead of the lower resolution.
|
||||||
|
- Built in Logos and fonts (no more nee to use Lucida/SEGA_KakuGothic-DB-Roman_12 and logo.tga).
|
||||||
|
- Outrun 2 Easy network config from the conf file (can set your IP address in the config file and the loader will set it in the eeprom for you).
|
||||||
|
- Card Emulation for VT3 and R-tuned.
|
||||||
|
- All the now games work inside an SDL window now, unless it is disabled in the conf file.
|
||||||
|
|
||||||
|
## [2.0] - 2024-12-24
|
||||||
|
### Initial Release
|
||||||
|
- First official public release.
|
||||||
|
- Features of the loader:
|
||||||
|
- Dynamic shader modification allowing games to work on Intel, nVidia and AMD
|
||||||
|
- 5.1 Surround Sound Support
|
||||||
|
- Dynamic resolution patching allowing most games to scale properly in HD
|
||||||
|
- Original cabinet support with pass through of JVS and FFB
|
||||||
|
- Network play
|
||||||
|
- Both simple X11 and advanced evdev input system allowing for ready-to-play keyboard and mouse support or mapping of any controller
|
||||||
+17
-2
@@ -48,11 +48,26 @@ sudo ln -s /lib/i386-linux-gnu/libglut.so /lib/i386-linux-gnu/libglut.so.3
|
|||||||
|
|
||||||
### Let's Go Jungle Rev A
|
### Let's Go Jungle Rev A
|
||||||
|
|
||||||
- The game must be run in export mode to have the stereo sound option.
|
The game must be run in export mode to have the stereo sound option.
|
||||||
|
|
||||||
### Outrun 2 SP SDX
|
### Outrun 2 SP SDX
|
||||||
|
|
||||||
- You need to set `SKIP_OUTRUN_CABINET_CHECK` to 1 in `lindbergh.conf` to play in DX, SDX or Standard cabinet types.
|
You need to set `SKIP_OUTRUN_CABINET_CHECK` to 1 in `lindbergh.conf` to play in DX, SDX or Standard cabinet types.
|
||||||
|
|
||||||
|
### Ghost Squad / 2Spicy
|
||||||
|
|
||||||
|
You may have sound issues such as the game complaining that the system cannot open `/dev[/sound]/dsp`. You **must not** use the `libopenal.so.0` files that came with the game, please delete those if you've moved them into your game folder. Do the following:
|
||||||
|
|
||||||
|
```
|
||||||
|
sudo apt install pipewire-audio-client-libraries:i386
|
||||||
|
sudo cp /usr/share/doc/pipewire/examples/alsa.conf.d/99-pipewire-default.conf /etc/alsa/conf.d/
|
||||||
|
```
|
||||||
|
|
||||||
|
Then in the game folder you must create a symlink to the `libopenal.so.1` library installed on your system:
|
||||||
|
|
||||||
|
```
|
||||||
|
ln -s /usr/lib/i386-linux-gnu/libopenal.so.1 libopenal.so.0
|
||||||
|
```
|
||||||
|
|
||||||
## Configuration File : lindbergh.conf
|
## Configuration File : lindbergh.conf
|
||||||
|
|
||||||
|
|||||||
+35
-4
@@ -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
|
||||||
|
|||||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -0,0 +1,239 @@
|
|||||||
|
#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()
|
||||||
|
{
|
||||||
|
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("Warning: This Game does not support Card Reader, please disable the card reader emulation in the config file.\n");
|
||||||
|
printf(" I will disable the card reader for you.\n");
|
||||||
|
EmulatorConfig *config = getConfig();
|
||||||
|
config->emulateCardreader = 0;
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
if (getConfig()->emulateCardreader && getConfig()->emulateDriveboard && gId != R_TUNED)
|
||||||
|
{
|
||||||
|
printf("Warning: This Game does not support Card Reader and Driver Board emulation enabled at the same time.\n");
|
||||||
|
printf("Please disable Drive Board emulations in the config file.\n");
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
initReadCmd(0);
|
||||||
|
initReadCmd(1);
|
||||||
|
initWriteCmd(0);
|
||||||
|
initWriteCmd(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);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -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
|
||||||
+817
-650
File diff suppressed because it is too large
Load Diff
+18
-4
@@ -2,6 +2,7 @@
|
|||||||
#define CONFIG_H
|
#define CONFIG_H
|
||||||
|
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
|
#include <sys/types.h>
|
||||||
|
|
||||||
#define MAX_PATH_LENGTH 1024
|
#define MAX_PATH_LENGTH 1024
|
||||||
#define INPUT_STRING_LENGTH 256
|
#define INPUT_STRING_LENGTH 256
|
||||||
@@ -29,8 +30,9 @@
|
|||||||
#define INITIALD_4_EXP_REVD 0x62cc73a9 // DVP-0030D
|
#define INITIALD_4_EXP_REVD 0x62cc73a9 // DVP-0030D
|
||||||
#define INITIALD_5_JAP_REVA 0xb3183112 // DVP-0070A
|
#define INITIALD_5_JAP_REVA 0xb3183112 // DVP-0070A
|
||||||
#define INITIALD_5_JAP_REVF 0xfc3dc85d // DVP-0070F
|
#define INITIALD_5_JAP_REVF 0xfc3dc85d // DVP-0070F
|
||||||
#define INITIALD_5_EXP_30 0x77c6b58b // DVP-0075 and DVP-0084????
|
#define INITIALD_5_EXP 0x701b88cf // DVP-0075
|
||||||
#define INITIALD_5_EXP_40 0xd4910e75 // DVP-0084A
|
#define INITIALD_5_EXP_20 0x77c6b58b // DVP-0084
|
||||||
|
#define INITIALD_5_EXP_20A 0xd4910e75 // DVP-0084A
|
||||||
#define LETS_GO_JUNGLE 0xb1c8c901 // DVP-0011
|
#define LETS_GO_JUNGLE 0xb1c8c901 // DVP-0011
|
||||||
#define LETS_GO_JUNGLE_REVA 0xc697c4fb // DVP-0011A
|
#define LETS_GO_JUNGLE_REVA 0xc697c4fb // DVP-0011A
|
||||||
#define LETS_GO_JUNGLE_SPECIAL 0x240beedc // DVP-0036A
|
#define LETS_GO_JUNGLE_SPECIAL 0x240beedc // DVP-0036A
|
||||||
@@ -70,7 +72,6 @@
|
|||||||
#define VIRTUA_FIGHTER_5_REVB 0x8953bd52 // DVP-0008B
|
#define VIRTUA_FIGHTER_5_REVB 0x8953bd52 // DVP-0008B
|
||||||
#define VIRTUA_FIGHTER_5_REVE 0x4c2edbf6 // DVP-0008E
|
#define VIRTUA_FIGHTER_5_REVE 0x4c2edbf6 // DVP-0008E
|
||||||
#define VIRTUA_FIGHTER_5_EXPORT 0xec474630 // DVP-0043
|
#define VIRTUA_FIGHTER_5_EXPORT 0xec474630 // DVP-0043
|
||||||
#define VIRTUA_FIGHTER_5_FINAL_SHOWDOWN 0x48 // DVP-5019 or does not exist
|
|
||||||
#define VIRTUA_FIGHTER_5_FINAL_SHOWDOWN_REVA 0xbae2be62 // DVP-5019A
|
#define VIRTUA_FIGHTER_5_FINAL_SHOWDOWN_REVA 0xbae2be62 // DVP-5019A
|
||||||
#define VIRTUA_FIGHTER_5_FINAL_SHOWDOWN_REVB 0x7cee1d81 // DVP-5020
|
#define VIRTUA_FIGHTER_5_FINAL_SHOWDOWN_REVB 0x7cee1d81 // DVP-5020
|
||||||
#define VIRTUA_FIGHTER_5_FINAL_SHOWDOWN_REVB_6000 0x34c0d02 // DVP-5020 ver 6.00 (Weird public version)
|
#define VIRTUA_FIGHTER_5_FINAL_SHOWDOWN_REVB_6000 0x34c0d02 // DVP-5020 ver 6.00 (Weird public version)
|
||||||
@@ -222,6 +223,9 @@ typedef struct
|
|||||||
int emulateRideboard;
|
int emulateRideboard;
|
||||||
int emulateDriveboard;
|
int emulateDriveboard;
|
||||||
int emulateMotionboard;
|
int emulateMotionboard;
|
||||||
|
int emulateCardreader;
|
||||||
|
char cardFile1[MAX_PATH_LENGTH];
|
||||||
|
char cardFile2[MAX_PATH_LENGTH];
|
||||||
int emulateJVS;
|
int emulateJVS;
|
||||||
int fullscreen;
|
int fullscreen;
|
||||||
char eepromPath[MAX_PATH_LENGTH];
|
char eepromPath[MAX_PATH_LENGTH];
|
||||||
@@ -257,7 +261,16 @@ typedef struct
|
|||||||
int lgjRenderWithMesa;
|
int lgjRenderWithMesa;
|
||||||
int noSDL;
|
int noSDL;
|
||||||
int phMode;
|
int phMode;
|
||||||
|
int disableBuiltinFont;
|
||||||
|
int disableBuiltinLogos;
|
||||||
|
int hideCursor;
|
||||||
|
char customCursor[MAX_PATH_LENGTH];
|
||||||
|
int customCursorWidth;
|
||||||
|
int customCursorHeight;
|
||||||
int mj4EnabledAtT;
|
int mj4EnabledAtT;
|
||||||
|
char or2IP[16];
|
||||||
|
char or2Netmask[16];
|
||||||
|
float cpuFreqGhz;
|
||||||
ArcadeInputs arcadeInputs;
|
ArcadeInputs arcadeInputs;
|
||||||
int inputMode; // 0 = both, 1 = SDL/X11 only, 2 = EVDEV only
|
int inputMode; // 0 = both, 1 = SDL/X11 only, 2 = EVDEV only
|
||||||
int skipOutrunCabinetCheck;
|
int skipOutrunCabinetCheck;
|
||||||
@@ -266,8 +279,9 @@ typedef struct
|
|||||||
int borderEnabled;
|
int borderEnabled;
|
||||||
} EmulatorConfig;
|
} EmulatorConfig;
|
||||||
|
|
||||||
|
uint32_t get_crc32(const char *s, ssize_t n);
|
||||||
KeyMapping getDefaultKeymap();
|
KeyMapping getDefaultKeymap();
|
||||||
int initConfig();
|
int initConfig(const char* configFilePath);
|
||||||
EmulatorConfig *getConfig();
|
EmulatorConfig *getConfig();
|
||||||
char *getGameName();
|
char *getGameName();
|
||||||
char *getDVPName();
|
char *getDVPName();
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
|
#include <string.h>
|
||||||
|
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
#include "eeprom.h"
|
#include "eeprom.h"
|
||||||
@@ -90,6 +91,16 @@ int initEeprom()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ((getConfig()->crc32 == OUTRUN_2_SP_SDX || getConfig()->crc32 == OUTRUN_2_SP_SDX_REVA) && strcmp(getConfig()->or2IP, "") != 0)
|
||||||
|
{
|
||||||
|
if (setIP(eeprom, getConfig()->or2IP, getConfig()->or2Netmask) != 0)
|
||||||
|
{
|
||||||
|
printf("Error setting the new IP address.");
|
||||||
|
fclose(eeprom);
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
fseek(eeprom, 0, SEEK_SET);
|
fseek(eeprom, 0, SEEK_SET);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
|||||||
@@ -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();
|
||||||
|
|||||||
@@ -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
@@ -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;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -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
@@ -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;
|
||||||
|
|||||||
+328
-76
@@ -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>
|
||||||
@@ -30,8 +30,6 @@
|
|||||||
#include <ifaddrs.h>
|
#include <ifaddrs.h>
|
||||||
#include <dirent.h>
|
#include <dirent.h>
|
||||||
|
|
||||||
#include "hook.h"
|
|
||||||
|
|
||||||
#include "baseboard.h"
|
#include "baseboard.h"
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
#include "driveboard.h"
|
#include "driveboard.h"
|
||||||
@@ -47,7 +45,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 +64,20 @@
|
|||||||
#define FILE_RW1 3
|
#define FILE_RW1 3
|
||||||
#define FILE_RW2 4
|
#define FILE_RW2 4
|
||||||
#define FILE_HARLEY 5
|
#define FILE_HARLEY 5
|
||||||
|
#define FILE_FONT_ABC 6
|
||||||
|
#define FILE_FONT_TGA 7
|
||||||
|
#define FILE_LOGO_TGA 8
|
||||||
|
#define ROUTE 9
|
||||||
|
|
||||||
int hooks[5] = {-1, -1, -1, -1, -1};
|
int hooks[5] = {-1, -1, -1, -1, -1};
|
||||||
FILE *fileHooks[6] = {NULL, NULL, NULL, NULL, NULL, NULL};
|
FILE *fileHooks[10] = {NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL};
|
||||||
int fileRead[6] = {0, 0, 0, 0, 0, 0};
|
int fileRead[10] = {0, 0, 0, 0, 0, 0, 0, 0, 0};
|
||||||
char envpath[100];
|
char envpath[100];
|
||||||
|
|
||||||
|
int fontABCidx = 0;
|
||||||
|
int fontTGAidx = 0;
|
||||||
|
int logoTGAidx = 0;
|
||||||
|
|
||||||
uint32_t elf_crc = 0;
|
uint32_t elf_crc = 0;
|
||||||
|
|
||||||
extern int hummerExtremeShaderFileIndex;
|
extern int hummerExtremeShaderFileIndex;
|
||||||
@@ -174,7 +183,9 @@ void __attribute__((constructor)) hook_init()
|
|||||||
act.sa_flags = SA_SIGINFO;
|
act.sa_flags = SA_SIGINFO;
|
||||||
sigaction(SIGSEGV, &act, NULL);
|
sigaction(SIGSEGV, &act, NULL);
|
||||||
|
|
||||||
initConfig();
|
char *(*_getenv)(const char *name) = dlsym(RTLD_NEXT, "getenv");
|
||||||
|
char* envPath = _getenv("LINDBERGH_CONFIG_PATH");
|
||||||
|
initConfig(envPath);
|
||||||
|
|
||||||
if (getConfig()->fpsLimiter == 1)
|
if (getConfig()->fpsLimiter == 1)
|
||||||
{
|
{
|
||||||
@@ -213,6 +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);
|
||||||
|
|
||||||
@@ -238,21 +255,16 @@ void __attribute__((constructor)) hook_init()
|
|||||||
}
|
}
|
||||||
printf("\n");
|
printf("\n");
|
||||||
|
|
||||||
if (getConfig()->GPUVendor == ATI_GPU
|
if (getConfig()->GPUVendor == ATI_GPU &&
|
||||||
&& ((getConfig()->crc32 == LETS_GO_JUNGLE) || (getConfig()->crc32 == LETS_GO_JUNGLE_REVA) ||
|
|
||||||
(getConfig()->crc32 == LETS_GO_JUNGLE_SPECIAL) || (getConfig()->crc32 == AFTER_BURNER_CLIMAX) ||
|
|
||||||
(getConfig()->crc32 == AFTER_BURNER_CLIMAX_REVA) || (getConfig()->crc32 == AFTER_BURNER_CLIMAX_REVB) ||
|
|
||||||
(getConfig()->crc32 == AFTER_BURNER_CLIMAX_SDX) || (getConfig()->crc32 == AFTER_BURNER_CLIMAX_SDX_REVA) ||
|
|
||||||
(getConfig()->crc32 == AFTER_BURNER_CLIMAX_SE) || (getConfig()->crc32 == AFTER_BURNER_CLIMAX_SE_REVA) ||
|
|
||||||
(getConfig()->crc32 == INITIALD_5_JAP_REVA) || (getConfig()->crc32 == INITIALD_5_JAP_REVF) ||
|
|
||||||
(getConfig()->crc32 == INITIALD_5_EXP_30) || (getConfig()->crc32 == INITIALD_5_EXP_40))) {
|
|
||||||
printf("WARNING: Game %s is unsupported in AMD GPU with ATI driver\n",getGameName());
|
|
||||||
}
|
|
||||||
if (getConfig()->lgjRenderWithMesa &&
|
|
||||||
((getConfig()->crc32 == LETS_GO_JUNGLE) || (getConfig()->crc32 == LETS_GO_JUNGLE_REVA) ||
|
((getConfig()->crc32 == LETS_GO_JUNGLE) || (getConfig()->crc32 == LETS_GO_JUNGLE_REVA) ||
|
||||||
(getConfig()->crc32 == LETS_GO_JUNGLE_SPECIAL)))
|
(getConfig()->crc32 == LETS_GO_JUNGLE_SPECIAL) || (getConfig()->crc32 == AFTER_BURNER_CLIMAX) ||
|
||||||
|
(getConfig()->crc32 == AFTER_BURNER_CLIMAX_REVA) || (getConfig()->crc32 == AFTER_BURNER_CLIMAX_REVB) ||
|
||||||
|
(getConfig()->crc32 == AFTER_BURNER_CLIMAX_SDX) || (getConfig()->crc32 == AFTER_BURNER_CLIMAX_SDX_REVA) ||
|
||||||
|
(getConfig()->crc32 == AFTER_BURNER_CLIMAX_SE) || (getConfig()->crc32 == AFTER_BURNER_CLIMAX_SE_REVA) ||
|
||||||
|
(getConfig()->crc32 == INITIALD_5_JAP_REVA) || (getConfig()->crc32 == INITIALD_5_JAP_REVF) ||
|
||||||
|
(getConfig()->crc32 == INITIALD_5_EXP_20) || (getConfig()->crc32 == INITIALD_5_EXP_20A)))
|
||||||
{
|
{
|
||||||
getConfig()->GPUVendor = AMD_GPU;
|
printf("WARNING: Game %s is unsupported in AMD GPU with ATI driver\n", getGameName());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -261,8 +273,7 @@ DIR *opendir(const char *dirname)
|
|||||||
DIR *(*_opendir)(const char *dirname) = dlsym(RTLD_NEXT, "opendir");
|
DIR *(*_opendir)(const char *dirname) = dlsym(RTLD_NEXT, "opendir");
|
||||||
|
|
||||||
int gId = getConfig()->crc32;
|
int gId = getConfig()->crc32;
|
||||||
if (gId == INITIALD_5_EXP_30 || gId == INITIALD_5_EXP_40 || gId == INITIALD_5_JAP_REVA ||
|
if (gId == INITIALD_5_EXP || gId == INITIALD_5_EXP_20 || gId == INITIALD_5_EXP_20A || gId == INITIALD_5_JAP_REVA || gId == INITIALD_5_JAP_REVF)
|
||||||
gId == INITIALD_5_JAP_REVF)
|
|
||||||
{
|
{
|
||||||
if (strcmp(dirname, "/tmp/") == 0)
|
if (strcmp(dirname, "/tmp/") == 0)
|
||||||
{
|
{
|
||||||
@@ -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)
|
||||||
@@ -477,8 +555,7 @@ FILE *fopen(const char *restrict pathname, const char *restrict mode)
|
|||||||
}
|
}
|
||||||
|
|
||||||
int gId = getConfig()->crc32;
|
int gId = getConfig()->crc32;
|
||||||
if (gId == INITIALD_5_EXP_30 || gId == INITIALD_5_EXP_40 || gId == INITIALD_5_JAP_REVA ||
|
if (gId == INITIALD_5_EXP || gId == INITIALD_5_EXP_20 || gId == INITIALD_5_EXP_20A || gId == INITIALD_5_JAP_REVA || gId == INITIALD_5_JAP_REVF)
|
||||||
gId == INITIALD_5_JAP_REVF)
|
|
||||||
{
|
{
|
||||||
if (strncmp(pathname, "/tmp/", 5) == 0)
|
if (strncmp(pathname, "/tmp/", 5) == 0)
|
||||||
{
|
{
|
||||||
@@ -505,22 +582,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 +668,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 +772,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 +822,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 +862,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 +922,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 +948,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 +963,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 +1050,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 +1089,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);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -925,28 +1199,6 @@ int connect(int sockfd, const struct sockaddr *addr, socklen_t addrlen)
|
|||||||
return _connect(sockfd, addr, addrlen);
|
return _connect(sockfd, addr, addrlen);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Function to calculate CRC32 checksum in memory.
|
|
||||||
*/
|
|
||||||
uint32_t get_crc32(const char *s, size_t n)
|
|
||||||
{
|
|
||||||
uint32_t crc = 0xFFFFFFFF;
|
|
||||||
|
|
||||||
for (size_t i = 0; i < n; i++)
|
|
||||||
{
|
|
||||||
char ch = s[i];
|
|
||||||
for (size_t j = 0; j < 8; j++)
|
|
||||||
{
|
|
||||||
uint32_t b = (ch ^ crc) & 1;
|
|
||||||
crc >>= 1;
|
|
||||||
if (b)
|
|
||||||
crc = crc ^ 0xEDB88320;
|
|
||||||
ch >>= 1;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return ~crc;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Callback function to get the offset and size of the execution program in memory of the ELF we hook to.
|
* Callback function to get the offset and size of the execution program in memory of the ELF we hook to.
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -1,4 +0,0 @@
|
|||||||
#include <stdint.h>
|
|
||||||
#include <stddef.h>
|
|
||||||
|
|
||||||
uint32_t get_crc32(const char *s, size_t n);
|
|
||||||
+73
-2
@@ -451,6 +451,7 @@ void sdlEventDriving(SDL_Event *event)
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void sdlEventShooting(SDL_Event *event)
|
void sdlEventShooting(SDL_Event *event)
|
||||||
{
|
{
|
||||||
KeyMapping keymap = getConfig()->keymap;
|
KeyMapping keymap = getConfig()->keymap;
|
||||||
@@ -585,13 +586,22 @@ void sdlEventShooting(SDL_Event *event)
|
|||||||
case SDL_MOUSEBUTTONUP:
|
case SDL_MOUSEBUTTONUP:
|
||||||
{
|
{
|
||||||
if (event->button.button == SDL_BUTTON_LEFT) // Trigger
|
if (event->button.button == SDL_BUTTON_LEFT) // Trigger
|
||||||
|
{
|
||||||
setSwitch(PLAYER_1, BUTTON_1, event->type == SDL_MOUSEBUTTONDOWN);
|
setSwitch(PLAYER_1, BUTTON_1, event->type == SDL_MOUSEBUTTONDOWN);
|
||||||
|
}
|
||||||
else if (event->button.button == SDL_BUTTON_RIGHT) // Reload
|
else if (event->button.button == SDL_BUTTON_RIGHT) // Reload
|
||||||
|
{
|
||||||
|
if (getConfig()->crc32 == RAMBO || getConfig()->crc32 == TOO_SPICY)
|
||||||
|
{
|
||||||
|
setAnalogue(ANALOGUE_1, -1);
|
||||||
|
setAnalogue(ANALOGUE_2, -1);
|
||||||
|
}
|
||||||
setSwitch(PLAYER_1, BUTTON_2, event->type == SDL_MOUSEBUTTONDOWN);
|
setSwitch(PLAYER_1, BUTTON_2, event->type == SDL_MOUSEBUTTONDOWN);
|
||||||
|
}
|
||||||
else if (event->button.button == SDL_BUTTON_MIDDLE) // Extra Gun Button
|
else if (event->button.button == SDL_BUTTON_MIDDLE) // Extra Gun Button
|
||||||
|
{
|
||||||
setSwitch(PLAYER_1, BUTTON_3, event->type == SDL_MOUSEBUTTONDOWN);
|
setSwitch(PLAYER_1, BUTTON_3, event->type == SDL_MOUSEBUTTONDOWN);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
@@ -654,6 +664,64 @@ void sdlEventABC(SDL_Event *event)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void sdlEventHarley(SDL_Event *event)
|
||||||
|
{
|
||||||
|
switch (event->type)
|
||||||
|
{
|
||||||
|
case SDL_KEYDOWN:
|
||||||
|
case SDL_KEYUP:
|
||||||
|
{
|
||||||
|
if (event->key.keysym.sym == SDLK_t)
|
||||||
|
setSwitch(SYSTEM, BUTTON_TEST, event->type == SDL_KEYDOWN);
|
||||||
|
else if (event->key.keysym.sym == SDLK_s)
|
||||||
|
setSwitch(PLAYER_1, BUTTON_SERVICE, event->type == SDL_KEYDOWN);
|
||||||
|
else if (event->key.keysym.sym == SDLK_5)
|
||||||
|
incrementCoin(PLAYER_1, event->type == SDL_KEYDOWN);
|
||||||
|
else if (event->key.keysym.sym == SDLK_1)
|
||||||
|
setSwitch(PLAYER_1, BUTTON_START, event->type == SDL_KEYDOWN);
|
||||||
|
else if (event->key.keysym.sym == SDLK_UP)
|
||||||
|
setAnalogue(ANALOGUE_1, event->type == SDL_KEYDOWN ? pow(2, jvsAnalogueInBits) - 1 : 0);
|
||||||
|
else if (event->key.keysym.sym == SDLK_DOWN)
|
||||||
|
setAnalogue(ANALOGUE_4, event->type == SDL_KEYDOWN ? pow(2, jvsAnalogueInBits) - 1 : 0);
|
||||||
|
else if (event->key.keysym.sym == SDLK_LEFT)
|
||||||
|
setAnalogue(ANALOGUE_2, event->type == SDL_KEYDOWN ? pow(2, jvsAnalogueInBits) * 0.2 : pow(2, jvsAnalogueInBits) * 0.5);
|
||||||
|
else if (event->key.keysym.sym == SDLK_RIGHT)
|
||||||
|
setAnalogue(ANALOGUE_2, event->type == SDL_KEYDOWN ? pow(2, jvsAnalogueInBits) * 0.8 : pow(2, jvsAnalogueInBits) * 0.5);
|
||||||
|
else if (event->key.keysym.sym == SDLK_q)
|
||||||
|
setSwitch(PLAYER_1, BUTTON_1, event->type == SDL_KEYDOWN);
|
||||||
|
else if (event->key.keysym.sym == SDLK_w)
|
||||||
|
setSwitch(PLAYER_1, BUTTON_2, event->type == SDL_KEYDOWN);
|
||||||
|
else if (event->key.keysym.sym == SDLK_e)
|
||||||
|
setSwitch(PLAYER_1, BUTTON_3, event->type == SDL_KEYDOWN);
|
||||||
|
else if (event->key.keysym.sym == SDLK_r)
|
||||||
|
setSwitch(PLAYER_1, BUTTON_4, event->type == SDL_KEYDOWN);
|
||||||
|
else if (event->key.keysym.sym == SDLK_z)
|
||||||
|
setSwitch(PLAYER_1, BUTTON_DOWN, event->type == SDL_KEYDOWN); // Hummer - SegaTV view change
|
||||||
|
|
||||||
|
else if (event->key.keysym.sym == SDLK_x)
|
||||||
|
setSwitch(PLAYER_1, BUTTON_UP, event->type == SDL_KEYDOWN);
|
||||||
|
|
||||||
|
else if (event->key.keysym.sym == SDLK_c)
|
||||||
|
setSwitch(PLAYER_1, BUTTON_LEFT, event->type == SDL_KEYDOWN);
|
||||||
|
|
||||||
|
else if (event->key.keysym.sym == SDLK_v)
|
||||||
|
setSwitch(PLAYER_1, BUTTON_RIGHT, event->type == SDL_KEYDOWN);
|
||||||
|
|
||||||
|
else if (event->key.keysym.sym == SDLK_a)
|
||||||
|
setSwitch(PLAYER_2, BUTTON_1, event->type == SDL_KEYDOWN); // SegaTV boost
|
||||||
|
|
||||||
|
else if (event->key.keysym.sym == SDLK_LCTRL)
|
||||||
|
setSwitch(PLAYER_2, BUTTON_DOWN, event->type == SDL_KEYDOWN); // Hummer boost
|
||||||
|
|
||||||
|
else if (event->key.keysym.sym == SDLK_SPACE)
|
||||||
|
setSwitch(PLAYER_2, BUTTON_UP, event->type == SDL_KEYDOWN);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void sdlEventMahjong(SDL_Event *event)
|
void sdlEventMahjong(SDL_Event *event)
|
||||||
{
|
{
|
||||||
switch (event->type)
|
switch (event->type)
|
||||||
@@ -766,6 +834,9 @@ void handleSdlEvents(SDL_Event *event)
|
|||||||
case ABC:
|
case ABC:
|
||||||
sdlEventABC(event);
|
sdlEventABC(event);
|
||||||
break;
|
break;
|
||||||
|
case HARLEY:
|
||||||
|
sdlEventHarley(event);
|
||||||
|
break;
|
||||||
case MAHJONG:
|
case MAHJONG:
|
||||||
sdlEventMahjong(event);
|
sdlEventMahjong(event);
|
||||||
break;
|
break;
|
||||||
|
|||||||
+197
-8
@@ -11,7 +11,9 @@
|
|||||||
#define LD_LIBRARY_PATH "LD_LIBRARY_PATH"
|
#define LD_LIBRARY_PATH "LD_LIBRARY_PATH"
|
||||||
#define LD_PRELOAD "LD_PRELOAD"
|
#define LD_PRELOAD "LD_PRELOAD"
|
||||||
#define PRELOAD_FILE_NAME "lindbergh.so"
|
#define PRELOAD_FILE_NAME "lindbergh.so"
|
||||||
|
#define PRELOAD_FILE_FLATPAK "/app/lib32/lindbergh.so"
|
||||||
#define TEAM "bobbydilley, retrofan, dkeruza-neo, doozer, francesco, rolel, caviar-x"
|
#define TEAM "bobbydilley, retrofan, dkeruza-neo, doozer, francesco, rolel, caviar-x"
|
||||||
|
#define LINDBERGH_CONFIG_PATH "LINDBERGH_CONFIG_PATH"
|
||||||
|
|
||||||
uint32_t elf_crc = 0;
|
uint32_t elf_crc = 0;
|
||||||
|
|
||||||
@@ -39,6 +41,151 @@ char *games[] = {"main.exe",
|
|||||||
"a.elf",
|
"a.elf",
|
||||||
"END"};
|
"END"};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* An array containin clean games elf's CRC32
|
||||||
|
*/
|
||||||
|
uint32_t cleanElfCRC32[] = {
|
||||||
|
0x51C4D2F6, // DVP-0003A | hod4M.elf
|
||||||
|
0x1348BCA8, // DVP-0003A | hod4testM.elf
|
||||||
|
0x0AAE384E, // DVP-0003B | hod4M.elf
|
||||||
|
0x352AA797, // DVP-0003B | hod4testM.elf
|
||||||
|
0x42EED61A, // DVP-0003C | hod4M.elf
|
||||||
|
0x6DA6E511, // DVP-0003C | hod4testM.elf
|
||||||
|
0x0E4BF4B1, // DVP-0005 | vt3_Lindbergh
|
||||||
|
0x9E48AB5B, // DVP-0005 | vt3_testmode
|
||||||
|
0xE4C64D01, // DVP-0005A | vt3_Lindbergh
|
||||||
|
0x9C0E77E5, // DVP-0005A | vt3_testmode
|
||||||
|
0xA4BDB9E2, // DVP-0005B | vt3_Lindbergh
|
||||||
|
0x74E25472, // DVP-0005B | vt3_testmode
|
||||||
|
0x987AE3FF, // DVP-0005C | vt3_Lindbergh
|
||||||
|
0x1E4271A4, // DVP-0005C | vt3_testmode
|
||||||
|
0xD409B70C, // DVP-0008 | vf5
|
||||||
|
0x08EBC0DB, // DVP-0008A | vf5
|
||||||
|
0xA47FBA2D, // DVP-0008B | vf5
|
||||||
|
0x8CA46167, // DVP-0008C | vf5
|
||||||
|
0x75946796, // DVP-0008E | vf5
|
||||||
|
0x2C8F5D57, // DVP-0009 | abc
|
||||||
|
0x13D90755, // DVP-0009A | abc
|
||||||
|
0x633AD6FB, // DVP-0009B | abc
|
||||||
|
0xD39825A8, // DVP-0010 | hod4M.elf
|
||||||
|
0x0745CF0A, // DVP-0010 | hod4testM.elf
|
||||||
|
0x13E59583, // DVP-0010B | hod4M.elf
|
||||||
|
0x302FEB00, // DVP-0010B | hod4testM.elf
|
||||||
|
0x04E08C99, // DVP-0011 | lgj_final
|
||||||
|
0x0C3D3CC3, // DVP-0011A | lgj_final
|
||||||
|
0xD9660B2E, // DVP-0015 | JenTest
|
||||||
|
0x821C3404, // DVP-0015 | Jennifer
|
||||||
|
0x13AF8581, // DVP-0015A | JenTest
|
||||||
|
0xB2CE9B23, // DVP-0015A | Jennifer
|
||||||
|
0xCC32DEAE, // DVP-0018 | abc
|
||||||
|
0x17114BC1, // DVP-0018A | abc
|
||||||
|
0x22905D60, // DVP-0019A | id4.elf
|
||||||
|
0x43582D48, // DVP-0019B | id4.elf
|
||||||
|
0x2D2A18C1, // DVP-0019C | id4.elf
|
||||||
|
0x9BFD0D98, // DVP-0019D | id4.elf
|
||||||
|
0x9CF9BBCC, // DVP-0019G | id4.elf
|
||||||
|
0xFA0F6AB0, // DVP-0027A | apacheM.elf
|
||||||
|
0x9D414D18, // DVP-0029A | vsg
|
||||||
|
0xC345E213, // DVP-0030B | id4.elf
|
||||||
|
0x98E6A516, // DVP-0030C | id4.elf
|
||||||
|
0xF67365C9, // DVP-0030D | id4.elf
|
||||||
|
0x8BDD31BA, // DVP-0031 | abc
|
||||||
|
0x3DF37873, // DVP-0031A | abc
|
||||||
|
0xDD8BB792, // DVP-0036A | lgjsp_app
|
||||||
|
0xB0A96E34, // DVP-0043 | vf5
|
||||||
|
0xF99E5635, // DVP-0044 | drive.elf
|
||||||
|
0x4143F6B4, // DVP-0048A | main.exe
|
||||||
|
0x653BC83B, // DVP-0057 | a.elf
|
||||||
|
0x04D88552, // DVP-0057B | a.elf
|
||||||
|
0x089D6051, // DVP-0060 | dsr
|
||||||
|
0x317F3B90, // DVP-0063 | hodexRI.elf
|
||||||
|
0x3A5EEC69, // DVP-0063 | hodextestR.elf
|
||||||
|
0x81E02850, // DVP-0069 | ramboM.elf
|
||||||
|
0xE4F202BB, // DVP-0070A | id5.elf
|
||||||
|
0x2E6732A3, // DVP-0070F | id5.elf
|
||||||
|
0xF99A3CDB, // DVP-0075 | id5.elf
|
||||||
|
0x05647A8E, // DVP-0079 | hummer_Master.elf
|
||||||
|
0x4442EA15, // DVP-0083 | hummer_Master.elf
|
||||||
|
0x8DF6BBF9, // DVP-0084 | id5.elf
|
||||||
|
0x2AF8004E, // DVP-0084A | id5.elf
|
||||||
|
0xB95528F4, // DVP-5004 | vf5
|
||||||
|
0x012E4898, // DVP-5004D | vf5
|
||||||
|
0x74465F9F, // DVP-5004G | vf5
|
||||||
|
0x75B48E22, // DVP-5007 | chopperM.elf
|
||||||
|
0xFCB9D941, // DVP-5019A | vf5
|
||||||
|
0xAB70901C, // DVP-5020 | vf5
|
||||||
|
0x6BAA510D, // DVP-5020 | vf5 | Ver 6.000
|
||||||
|
};
|
||||||
|
|
||||||
|
int cleanElfCRC32Count = sizeof(cleanElfCRC32) / sizeof(uint32_t);
|
||||||
|
|
||||||
|
uint32_t calcCrc32(uint32_t crc, uint8_t data)
|
||||||
|
{
|
||||||
|
crc ^= data; // No shift needed; working in LSB-first order
|
||||||
|
for (int i = 0; i < 8; i++)
|
||||||
|
{
|
||||||
|
if (crc & 1)
|
||||||
|
{
|
||||||
|
crc = (crc >> 1) ^ 0xEDB88320;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
crc = (crc >> 1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return crc;
|
||||||
|
}
|
||||||
|
|
||||||
|
int lookupCrcTable(uint32_t crc)
|
||||||
|
{
|
||||||
|
for (int x = 0; x < cleanElfCRC32Count; x++)
|
||||||
|
{
|
||||||
|
if (cleanElfCRC32[x] == crc)
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
void isCleanElf(char *command)
|
||||||
|
{
|
||||||
|
const char *space_pos = strchr(command, ' ');
|
||||||
|
size_t length = space_pos ? (size_t)(space_pos - command) : strlen(command);
|
||||||
|
|
||||||
|
char elfName[256];
|
||||||
|
strncpy(elfName, command, length);
|
||||||
|
elfName[length] = '\0';
|
||||||
|
|
||||||
|
FILE *file = fopen(elfName, "rb");
|
||||||
|
if (!file)
|
||||||
|
{
|
||||||
|
log_error("Could not calculate the Elf CRC32.");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
uint32_t crc = 0xFFFFFFFF;
|
||||||
|
uint8_t buffer[4096];
|
||||||
|
size_t bytesRead;
|
||||||
|
|
||||||
|
while ((bytesRead = fread(buffer, 1, sizeof(buffer), file)) > 0)
|
||||||
|
{
|
||||||
|
for (size_t i = 0; i < bytesRead; i++)
|
||||||
|
{
|
||||||
|
crc = calcCrc32(crc, buffer[i]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
fclose(file);
|
||||||
|
crc = crc ^ 0xFFFFFFFF;
|
||||||
|
|
||||||
|
if (!lookupCrcTable(crc))
|
||||||
|
{
|
||||||
|
printf("\033[1;31m");
|
||||||
|
printf("Warning: The ELF you are running is not Clean and might cause unwanted behavior.\n");
|
||||||
|
printf(" Make sure you ELF and game dump are clean before reporting issues.\n");
|
||||||
|
printf("\033[0m");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Tests if the game uses a seperate elf for test mode
|
* Tests if the game uses a seperate elf for test mode
|
||||||
* and updates the command line to this elf.
|
* and updates the command line to this elf.
|
||||||
@@ -86,7 +233,7 @@ void testModePath(char *name)
|
|||||||
* Makes sure the environment variables are set correctly
|
* Makes sure the environment variables are set correctly
|
||||||
* to run the game.
|
* to run the game.
|
||||||
*/
|
*/
|
||||||
void setEnvironmentVariables()
|
void setEnvironmentVariables(int isFlatpak, int zink)
|
||||||
{
|
{
|
||||||
// Ensure the library path is set correctly
|
// Ensure the library path is set correctly
|
||||||
char libraryPath[128] = {0};
|
char libraryPath[128] = {0};
|
||||||
@@ -103,7 +250,13 @@ void setEnvironmentVariables()
|
|||||||
setenv(LD_LIBRARY_PATH, libraryPath, 1);
|
setenv(LD_LIBRARY_PATH, libraryPath, 1);
|
||||||
|
|
||||||
// Ensure the preload path is set correctly
|
// Ensure the preload path is set correctly
|
||||||
setenv(LD_PRELOAD, PRELOAD_FILE_NAME, 1);
|
if (!isFlatpak)
|
||||||
|
setenv(LD_PRELOAD, PRELOAD_FILE_NAME, 1);
|
||||||
|
else
|
||||||
|
setenv(LD_PRELOAD, PRELOAD_FILE_FLATPAK, 1);
|
||||||
|
|
||||||
|
if(zink)
|
||||||
|
setenv("MESA_LOADER_DRIVER_OVERRIDE", "zink", 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -119,6 +272,7 @@ void printUsage(char *argv[])
|
|||||||
printf(" --list-controllers Lists available controllers and inputs\n");
|
printf(" --list-controllers Lists available controllers and inputs\n");
|
||||||
printf(" --version Displays the version of the loader and team's names\n");
|
printf(" --version Displays the version of the loader and team's names\n");
|
||||||
printf(" --help Displays this usage text\n");
|
printf(" --help Displays this usage text\n");
|
||||||
|
printf(" --config | -c Specifies configuration path\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -169,9 +323,6 @@ void printVersion() {
|
|||||||
*/
|
*/
|
||||||
int main(int argc, char *argv[])
|
int main(int argc, char *argv[])
|
||||||
{
|
{
|
||||||
// Ensure environment variables are set correctly
|
|
||||||
setEnvironmentVariables();
|
|
||||||
|
|
||||||
// Check for --version before directory operations
|
// Check for --version before directory operations
|
||||||
if (argc > 1 && strcmp(argv[1], "--version") == 0) {
|
if (argc > 1 && strcmp(argv[1], "--version") == 0) {
|
||||||
printVersion();
|
printVersion();
|
||||||
@@ -191,6 +342,7 @@ int main(int argc, char *argv[])
|
|||||||
char *game = NULL;
|
char *game = NULL;
|
||||||
|
|
||||||
int lindberghSharedObjectFound = 0;
|
int lindberghSharedObjectFound = 0;
|
||||||
|
int isFlatpak = 0;
|
||||||
|
|
||||||
while ((ent = readdir(dir)) != NULL)
|
while ((ent = readdir(dir)) != NULL)
|
||||||
{
|
{
|
||||||
@@ -238,18 +390,29 @@ int main(int argc, char *argv[])
|
|||||||
|
|
||||||
if (!lindberghSharedObjectFound)
|
if (!lindberghSharedObjectFound)
|
||||||
{
|
{
|
||||||
log_error("The preload object lindbergh.so was not found in this directory.");
|
FILE *file = fopen(PRELOAD_FILE_FLATPAK, "r");
|
||||||
return EXIT_FAILURE;
|
if (file)
|
||||||
|
{
|
||||||
|
fclose(file);
|
||||||
|
isFlatpak = 1;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
log_error("The preload object lindbergh.so was not found in this directory.");
|
||||||
|
return EXIT_FAILURE;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Build up the command to start the game
|
// Build up the command to start the game
|
||||||
|
|
||||||
int testMode = 0;
|
int testMode = 0;
|
||||||
int gdb = 0;
|
int gdb = 0;
|
||||||
|
int zink = 0;
|
||||||
int forceGame = 0;
|
int forceGame = 0;
|
||||||
int segaboot = 0;
|
int segaboot = 0;
|
||||||
|
char extConfigPath[PATH_MAX] = {0};
|
||||||
char forceGamePath[128] = {0};
|
char forceGamePath[128] = {0};
|
||||||
|
|
||||||
for (int i = 1; i < argc; i++)
|
for (int i = 1; i < argc; i++)
|
||||||
{
|
{
|
||||||
if (strcmp(argv[i], "-t") == 0 || strcmp(argv[i], "--test") == 0)
|
if (strcmp(argv[i], "-t") == 0 || strcmp(argv[i], "--test") == 0)
|
||||||
@@ -270,11 +433,30 @@ int main(int argc, char *argv[])
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (strcmp(argv[i], "--zink") == 0)
|
||||||
|
{
|
||||||
|
zink = 1;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (strcmp(argv[i], "-c") == 0 || strcmp(argv[i], "--config") == 0)
|
||||||
|
{
|
||||||
|
if (i+1 >= argc)
|
||||||
|
{
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
strncpy(extConfigPath, argv[i+1], PATH_MAX);
|
||||||
|
i += 1;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
// Treat the argument as the game name
|
// Treat the argument as the game name
|
||||||
strcpy(forceGamePath, argv[i]);
|
strcpy(forceGamePath, argv[i]);
|
||||||
forceGame = 1;
|
forceGame = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Ensure environment variables are set correctly
|
||||||
|
setEnvironmentVariables(isFlatpak, zink);
|
||||||
|
|
||||||
char command[128] = {0};
|
char command[128] = {0};
|
||||||
strcpy(command, "./");
|
strcpy(command, "./");
|
||||||
if (forceGame)
|
if (forceGame)
|
||||||
@@ -298,6 +480,8 @@ int main(int argc, char *argv[])
|
|||||||
if (testMode)
|
if (testMode)
|
||||||
testModePath(command);
|
testModePath(command);
|
||||||
|
|
||||||
|
isCleanElf(command);
|
||||||
|
|
||||||
if (gdb)
|
if (gdb)
|
||||||
{
|
{
|
||||||
char temp[128];
|
char temp[128];
|
||||||
@@ -306,6 +490,11 @@ int main(int argc, char *argv[])
|
|||||||
strcpy(command, temp);
|
strcpy(command, temp);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (extConfigPath[0] != '\0')
|
||||||
|
{
|
||||||
|
setenv(LINDBERGH_CONFIG_PATH,extConfigPath,1);
|
||||||
|
}
|
||||||
|
|
||||||
log_info("Starting $ %s", command);
|
log_info("Starting $ %s", command);
|
||||||
|
|
||||||
return system(command);
|
return system(command);
|
||||||
|
|||||||
@@ -4,7 +4,6 @@
|
|||||||
|
|
||||||
#include <stdarg.h>
|
#include <stdarg.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <time.h>
|
|
||||||
|
|
||||||
|
|
||||||
// Structure to hold the formatted message and its size
|
// Structure to hold the formatted message and its size
|
||||||
|
|||||||
+2408
-2211
File diff suppressed because it is too large
Load Diff
+1021
-716
File diff suppressed because it is too large
Load Diff
@@ -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
@@ -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,2 +1,2 @@
|
|||||||
void glutInitSDL(int *argcp, char **argv);
|
void initSDL(int *argcp, char **argv);
|
||||||
void pollEvents();
|
void pollEvents();
|
||||||
@@ -1,8 +1,8 @@
|
|||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
|
||||||
#include "securityboard.h"
|
#include "securityboard.h"
|
||||||
#include "config.h"
|
|
||||||
#include "log.h"
|
#include "log.h"
|
||||||
|
#include "config.h"
|
||||||
|
|
||||||
#define SECURITY_BOARD_FRONT_PANEL 0x38
|
#define SECURITY_BOARD_FRONT_PANEL 0x38
|
||||||
#define SECURITY_BOARD_FRONT_PANEL_NON_ROOT 0x1038
|
#define SECURITY_BOARD_FRONT_PANEL_NON_ROOT 0x1038
|
||||||
@@ -52,8 +52,10 @@ int securityBoardSetDipResolution(int width, int height)
|
|||||||
setResolutionDips(1, 1, 0);
|
setResolutionDips(1, 1, 0);
|
||||||
else if (width == 1360 && height == 768)
|
else if (width == 1360 && height == 768)
|
||||||
setResolutionDips(1, 1, 1);
|
setResolutionDips(1, 1, 1);
|
||||||
else
|
else {
|
||||||
log_warn("Resolution not compatible, using 640 x 480\n");
|
if(getConfig()->showDebugMessages)
|
||||||
|
log_warn("Resolution not original, setting dips to 640 x 480.\n");
|
||||||
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|||||||
+169
-167
@@ -433,8 +433,9 @@ void srtvElfShaderPatcher()
|
|||||||
*/
|
*/
|
||||||
bool shaderFileInList(const char *pathname, int *idx)
|
bool shaderFileInList(const char *pathname, int *idx)
|
||||||
{
|
{
|
||||||
int gId = getConfig()->crc32;
|
uint32_t gId = getConfig()->crc32;
|
||||||
char cwd[256];
|
char cwd[256];
|
||||||
|
int gpuVendor = getConfig()->GPUVendor;
|
||||||
if (gId == GHOST_SQUAD_EVOLUTION)
|
if (gId == GHOST_SQUAD_EVOLUTION)
|
||||||
{
|
{
|
||||||
if (getConfig()->GPUVendor != NVIDIA_GPU)
|
if (getConfig()->GPUVendor != NVIDIA_GPU)
|
||||||
@@ -493,8 +494,7 @@ bool shaderFileInList(const char *pathname, int *idx)
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if ((gId == THE_HOUSE_OF_THE_DEAD_4_REVA) || (gId == THE_HOUSE_OF_THE_DEAD_4_REVB) ||
|
else if (gId == THE_HOUSE_OF_THE_DEAD_4_REVA || gId == THE_HOUSE_OF_THE_DEAD_4_REVB || gId == THE_HOUSE_OF_THE_DEAD_4_REVC)
|
||||||
(gId == THE_HOUSE_OF_THE_DEAD_4_REVC))
|
|
||||||
{
|
{
|
||||||
for (int x = 0; x < hod4ShaderPatchesCount; x++)
|
for (int x = 0; x < hod4ShaderPatchesCount; x++)
|
||||||
{
|
{
|
||||||
@@ -507,7 +507,7 @@ bool shaderFileInList(const char *pathname, int *idx)
|
|||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
else if ((gId == THE_HOUSE_OF_THE_DEAD_4_SPECIAL) || (gId == THE_HOUSE_OF_THE_DEAD_4_SPECIAL_REVB))
|
else if (gId == THE_HOUSE_OF_THE_DEAD_4_SPECIAL || gId == THE_HOUSE_OF_THE_DEAD_4_SPECIAL_REVB)
|
||||||
{
|
{
|
||||||
for (int x = 0; x < hod4spShaderPatchesCount; x++)
|
for (int x = 0; x < hod4spShaderPatchesCount; x++)
|
||||||
{
|
{
|
||||||
@@ -546,7 +546,7 @@ bool shaderFileInList(const char *pathname, int *idx)
|
|||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
else if ((gId == HUMMER) || (gId == HUMMER_SDLX) || (gId == HUMMER_EXTREME) || (gId == HUMMER_EXTREME_MDX))
|
else if (gId == HUMMER || gId == HUMMER_SDLX || gId == HUMMER_EXTREME || gId == HUMMER_EXTREME_MDX)
|
||||||
{
|
{
|
||||||
|
|
||||||
for (int x = 0; x < hummerFilesToModCount; x++)
|
for (int x = 0; x < hummerFilesToModCount; x++)
|
||||||
@@ -560,104 +560,101 @@ bool shaderFileInList(const char *pathname, int *idx)
|
|||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
else if (getConfig()->GPUVendor != NVIDIA_GPU)
|
else if (gId == TOO_SPICY && gpuVendor != NVIDIA_GPU)
|
||||||
{
|
{
|
||||||
if (gId == TOO_SPICY)
|
for (int x = 0; x < tooSpicyShaderPatchesCount; x++)
|
||||||
{
|
{
|
||||||
for (int x = 0; x < tooSpicyShaderPatchesCount; x++)
|
if ((strcmp(tooSpicyShaderPatches[x].fileName, basename((char *)pathname)) == 0) &&
|
||||||
{
|
(tooSpicyShaderPatches[x].shaderBufferSize != 0))
|
||||||
if ((strcmp(tooSpicyShaderPatches[x].fileName, basename((char *)pathname)) == 0) &&
|
|
||||||
(tooSpicyShaderPatches[x].shaderBufferSize != 0))
|
|
||||||
{
|
|
||||||
*idx = x;
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
else if (gId == THE_HOUSE_OF_THE_DEAD_EX)
|
|
||||||
{
|
|
||||||
for (int x = 0; x < hodexShaderPatchesCount; x++)
|
|
||||||
{
|
|
||||||
if ((strcmp(hodexShaderPatches[x].fileName, basename((char *)pathname)) == 0) &&
|
|
||||||
(hodexShaderPatches[x].shaderBufferSize != 0))
|
|
||||||
{
|
|
||||||
*idx = x;
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
const char *fName = strrchr(pathname, '/');
|
|
||||||
char searchFileName[40];
|
|
||||||
char *searchFolder1;
|
|
||||||
char *searchFolder2;
|
|
||||||
char *format;
|
|
||||||
ShaderFilesToMod *filesToMod;
|
|
||||||
int filesToModCount;
|
|
||||||
|
|
||||||
if ((gId == LETS_GO_JUNGLE) || (gId == LETS_GO_JUNGLE_REVA) || (gId == LETS_GO_JUNGLE_SPECIAL))
|
|
||||||
{
|
|
||||||
filesToMod = lgjShaderFilesToMod;
|
|
||||||
filesToModCount = lgjFilesToModCount;
|
|
||||||
searchFolder1 = "/shader/Cg";
|
|
||||||
searchFolder2 = "/extraShader/Cg";
|
|
||||||
format = "%s/inc%s";
|
|
||||||
}
|
|
||||||
|
|
||||||
else if ((gId == INITIALD_4_EXP_REVB) || (gId == INITIALD_4_EXP_REVC) || (gId == INITIALD_4_EXP_REVD) ||
|
|
||||||
(gId == INITIALD_4_REVA) || (gId == INITIALD_4_REVB) || (gId == INITIALD_4_REVC) ||
|
|
||||||
(gId == INITIALD_4_REVD) || (gId == INITIALD_4_REVG) || (gId == INITIALD_5_JAP_REVA) ||
|
|
||||||
(gId == INITIALD_5_JAP_REVF) || (gId == INITIALD_5_EXP_30) || (gId == INITIALD_5_EXP_40))
|
|
||||||
{
|
|
||||||
filesToMod = idShaderFilesToMod;
|
|
||||||
filesToModCount = idFilesToModCount;
|
|
||||||
if ((gId == INITIALD_4_REVA) || (gId == INITIALD_4_REVB) || (gId == INITIALD_4_REVC) ||
|
|
||||||
(gId == INITIALD_4_REVD) || (gId == INITIALD_4_REVG))
|
|
||||||
{
|
|
||||||
filesToMod = id4jShaderFilesToMod;
|
|
||||||
filesToModCount = id4FilesToModCount;
|
|
||||||
}
|
|
||||||
searchFolder1 = "/shader/Cg/inc";
|
|
||||||
searchFolder2 = "/data/Shader";
|
|
||||||
if ((gId == INITIALD_5_JAP_REVA) || (gId == INITIALD_5_JAP_REVF) || (gId == INITIALD_5_EXP_30) ||
|
|
||||||
(gId == INITIALD_5_EXP_40))
|
|
||||||
{
|
|
||||||
searchFolder2 = "/data/V5SHADER";
|
|
||||||
}
|
|
||||||
format = "%s%s";
|
|
||||||
}
|
|
||||||
else if ((gId == VIRTUA_TENNIS_3) || (gId == VIRTUA_TENNIS_3_TEST) || (gId == VIRTUA_TENNIS_3_REVA) ||
|
|
||||||
(gId == VIRTUA_TENNIS_3_REVA_TEST) || (gId == VIRTUA_TENNIS_3_REVB) ||
|
|
||||||
(gId == VIRTUA_TENNIS_3_REVB_TEST) || (gId == VIRTUA_TENNIS_3_REVC) ||
|
|
||||||
(gId == VIRTUA_TENNIS_3_REVC_TEST))
|
|
||||||
{
|
|
||||||
filesToMod = vt3ShaderFilesToMod;
|
|
||||||
filesToModCount = vt3FilesToModCount;
|
|
||||||
searchFolder1 = "/shader/Cg/inc";
|
|
||||||
searchFolder2 = "/shader";
|
|
||||||
format = "%s%s";
|
|
||||||
}
|
|
||||||
if (strstr(pathname, searchFolder1) != NULL)
|
|
||||||
{
|
|
||||||
sprintf((void *)searchFileName, format, searchFolder1, fName);
|
|
||||||
}
|
|
||||||
else if (strstr(pathname, searchFolder2) != NULL)
|
|
||||||
{
|
|
||||||
sprintf((void *)searchFileName, format, searchFolder2, fName);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
for (int x = 0; x < filesToModCount; x++)
|
|
||||||
{
|
|
||||||
if (strcmp(filesToMod[x].fileName, searchFileName) == 0)
|
|
||||||
{
|
{
|
||||||
*idx = x;
|
*idx = x;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
else if (gId == THE_HOUSE_OF_THE_DEAD_EX && gpuVendor != NVIDIA_GPU)
|
||||||
|
{
|
||||||
|
for (int x = 0; x < hodexShaderPatchesCount; x++)
|
||||||
|
{
|
||||||
|
if ((strcmp(hodexShaderPatches[x].fileName, basename((char *)pathname)) == 0) && (hodexShaderPatches[x].shaderBufferSize != 0))
|
||||||
|
{
|
||||||
|
*idx = x;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
const char *fName = strrchr(pathname, '/');
|
||||||
|
char searchFileName[40];
|
||||||
|
char *searchFolder1;
|
||||||
|
char *searchFolder2;
|
||||||
|
char *format;
|
||||||
|
ShaderFilesToMod *filesToMod;
|
||||||
|
int filesToModCount;
|
||||||
|
|
||||||
|
if ((gId == LETS_GO_JUNGLE || gId == LETS_GO_JUNGLE_REVA || gId == LETS_GO_JUNGLE_SPECIAL) &&
|
||||||
|
(gpuVendor != NVIDIA_GPU || getConfig()->lgjRenderWithMesa == 1))
|
||||||
|
{
|
||||||
|
filesToMod = lgjShaderFilesToMod;
|
||||||
|
filesToModCount = lgjFilesToModCount;
|
||||||
|
searchFolder1 = "/shader/Cg";
|
||||||
|
searchFolder2 = "/extraShader/Cg";
|
||||||
|
format = "%s/inc%s";
|
||||||
|
}
|
||||||
|
|
||||||
|
else if ((gId == INITIALD_4_EXP_REVB || gId == INITIALD_4_EXP_REVC || gId == INITIALD_4_EXP_REVD || gId == INITIALD_4_REVA ||
|
||||||
|
gId == INITIALD_4_REVB || gId == INITIALD_4_REVC || gId == INITIALD_4_REVD || gId == INITIALD_4_REVG ||
|
||||||
|
gId == INITIALD_5_JAP_REVA || gId == INITIALD_5_JAP_REVF || gId == INITIALD_5_EXP || gId == INITIALD_5_EXP_20 ||
|
||||||
|
gId == INITIALD_5_EXP_20A) &&
|
||||||
|
gpuVendor != NVIDIA_GPU)
|
||||||
|
{
|
||||||
|
filesToMod = idShaderFilesToMod;
|
||||||
|
filesToModCount = idFilesToModCount;
|
||||||
|
if (gId == INITIALD_4_REVA || gId == INITIALD_4_REVB || gId == INITIALD_4_REVC || gId == INITIALD_4_REVD || gId == INITIALD_4_REVG)
|
||||||
|
{
|
||||||
|
filesToMod = id4jShaderFilesToMod;
|
||||||
|
filesToModCount = id4FilesToModCount;
|
||||||
|
}
|
||||||
|
searchFolder1 = "/shader/Cg/inc";
|
||||||
|
searchFolder2 = "/data/Shader";
|
||||||
|
if (gId == INITIALD_5_JAP_REVA || gId == INITIALD_5_JAP_REVF || gId == INITIALD_5_EXP || gId == INITIALD_5_EXP_20 ||
|
||||||
|
gId == INITIALD_5_EXP_20A)
|
||||||
|
{
|
||||||
|
searchFolder2 = "/data/V5SHADER";
|
||||||
|
}
|
||||||
|
format = "%s%s";
|
||||||
|
}
|
||||||
|
else if ((gId == VIRTUA_TENNIS_3 || gId == VIRTUA_TENNIS_3_TEST || gId == VIRTUA_TENNIS_3_REVA || gId == VIRTUA_TENNIS_3_REVA_TEST ||
|
||||||
|
gId == VIRTUA_TENNIS_3_REVB || gId == VIRTUA_TENNIS_3_REVB_TEST || gId == VIRTUA_TENNIS_3_REVC ||
|
||||||
|
gId == VIRTUA_TENNIS_3_REVC_TEST) &&
|
||||||
|
gpuVendor != NVIDIA_GPU)
|
||||||
|
{
|
||||||
|
filesToMod = vt3ShaderFilesToMod;
|
||||||
|
filesToModCount = vt3FilesToModCount;
|
||||||
|
searchFolder1 = "/shader/Cg/inc";
|
||||||
|
searchFolder2 = "/shader";
|
||||||
|
format = "%s%s";
|
||||||
|
}
|
||||||
|
if (strstr(pathname, searchFolder1) != NULL)
|
||||||
|
{
|
||||||
|
sprintf((void *)searchFileName, format, searchFolder1, fName);
|
||||||
|
}
|
||||||
|
else if (strstr(pathname, searchFolder2) != NULL)
|
||||||
|
{
|
||||||
|
sprintf((void *)searchFileName, format, searchFolder2, fName);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
for (int x = 0; x < filesToModCount; x++)
|
||||||
|
{
|
||||||
|
if (strcmp(filesToMod[x].fileName, searchFileName) == 0)
|
||||||
|
{
|
||||||
|
*idx = x;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@@ -668,7 +665,7 @@ bool shaderFileInList(const char *pathname, int *idx)
|
|||||||
*/
|
*/
|
||||||
long int ftellGetShaderSize(int idx)
|
long int ftellGetShaderSize(int idx)
|
||||||
{
|
{
|
||||||
int gId = getConfig()->crc32;
|
uint32_t gId = getConfig()->crc32;
|
||||||
if (gId == GHOST_SQUAD_EVOLUTION)
|
if (gId == GHOST_SQUAD_EVOLUTION)
|
||||||
{
|
{
|
||||||
if (getConfig()->GPUVendor != NVIDIA_GPU)
|
if (getConfig()->GPUVendor != NVIDIA_GPU)
|
||||||
@@ -677,24 +674,22 @@ long int ftellGetShaderSize(int idx)
|
|||||||
}
|
}
|
||||||
return gsevoNvidiaShaderPatches[idx].shaderBufferSize;
|
return gsevoNvidiaShaderPatches[idx].shaderBufferSize;
|
||||||
}
|
}
|
||||||
else if ((gId == LETS_GO_JUNGLE) || (gId == LETS_GO_JUNGLE_REVA) || (gId == LETS_GO_JUNGLE_SPECIAL))
|
else if (gId == LETS_GO_JUNGLE || gId == LETS_GO_JUNGLE_REVA || gId == LETS_GO_JUNGLE_SPECIAL)
|
||||||
{
|
{
|
||||||
return lgjShaderFilesToMod[idx].shaderBufferSize;
|
return lgjShaderFilesToMod[idx].shaderBufferSize;
|
||||||
}
|
}
|
||||||
else if ((gId == INITIALD_4_EXP_REVB) || (gId == INITIALD_4_EXP_REVC) || (gId == INITIALD_4_EXP_REVD) ||
|
else if (gId == INITIALD_4_EXP_REVB || gId == INITIALD_4_EXP_REVC || gId == INITIALD_4_EXP_REVD || gId == INITIALD_5_JAP_REVA ||
|
||||||
(gId == INITIALD_5_JAP_REVA) || (gId == INITIALD_5_JAP_REVF) || (gId == INITIALD_5_EXP_30) ||
|
gId == INITIALD_5_JAP_REVF || gId == INITIALD_5_EXP || gId == INITIALD_5_EXP_20 || gId == INITIALD_5_EXP_20A)
|
||||||
(gId == INITIALD_5_EXP_40))
|
|
||||||
{
|
{
|
||||||
return idShaderFilesToMod[idx].shaderBufferSize;
|
return idShaderFilesToMod[idx].shaderBufferSize;
|
||||||
}
|
}
|
||||||
else if ((gId == INITIALD_4_REVA) || (gId == INITIALD_4_REVB) || (gId == INITIALD_4_REVC) ||
|
else if (gId == INITIALD_4_REVA || gId == INITIALD_4_REVB || gId == INITIALD_4_REVC || gId == INITIALD_4_REVD || gId == INITIALD_4_REVG)
|
||||||
(gId == INITIALD_4_REVD) || (gId == INITIALD_4_REVG))
|
|
||||||
{
|
{
|
||||||
return id4jShaderFilesToMod[idx].shaderBufferSize;
|
return id4jShaderFilesToMod[idx].shaderBufferSize;
|
||||||
}
|
}
|
||||||
else if ((gId == VIRTUA_TENNIS_3) || (gId == VIRTUA_TENNIS_3_TEST) || (gId == VIRTUA_TENNIS_3_REVA) ||
|
else if (gId == VIRTUA_TENNIS_3 || gId == VIRTUA_TENNIS_3_TEST || gId == VIRTUA_TENNIS_3_REVA || gId == VIRTUA_TENNIS_3_REVA_TEST ||
|
||||||
(gId == VIRTUA_TENNIS_3_REVA_TEST) || (gId == VIRTUA_TENNIS_3_REVB) ||
|
gId == VIRTUA_TENNIS_3_REVB || gId == VIRTUA_TENNIS_3_REVB_TEST || gId == VIRTUA_TENNIS_3_REVC ||
|
||||||
(gId == VIRTUA_TENNIS_3_REVB_TEST) || (gId == VIRTUA_TENNIS_3_REVC) || (gId == VIRTUA_TENNIS_3_REVC_TEST))
|
gId == VIRTUA_TENNIS_3_REVC_TEST)
|
||||||
{
|
{
|
||||||
return vt3ShaderFilesToMod[idx].shaderBufferSize;
|
return vt3ShaderFilesToMod[idx].shaderBufferSize;
|
||||||
}
|
}
|
||||||
@@ -713,12 +708,11 @@ long int ftellGetShaderSize(int idx)
|
|||||||
return ramboNvidiaShaderPatches[idx].shaderBufferSize;
|
return ramboNvidiaShaderPatches[idx].shaderBufferSize;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if ((gId == THE_HOUSE_OF_THE_DEAD_4_REVA) || (gId == THE_HOUSE_OF_THE_DEAD_4_REVB) ||
|
else if (gId == THE_HOUSE_OF_THE_DEAD_4_REVA || gId == THE_HOUSE_OF_THE_DEAD_4_REVB || gId == THE_HOUSE_OF_THE_DEAD_4_REVC)
|
||||||
(gId == THE_HOUSE_OF_THE_DEAD_4_REVC))
|
|
||||||
{
|
{
|
||||||
return hod4ShaderPatches[idx].shaderBufferSize;
|
return hod4ShaderPatches[idx].shaderBufferSize;
|
||||||
}
|
}
|
||||||
else if ((gId == THE_HOUSE_OF_THE_DEAD_4_SPECIAL) || (gId == THE_HOUSE_OF_THE_DEAD_4_SPECIAL_REVB))
|
else if (gId == THE_HOUSE_OF_THE_DEAD_4_SPECIAL || gId == THE_HOUSE_OF_THE_DEAD_4_SPECIAL_REVB)
|
||||||
{
|
{
|
||||||
return hod4spShaderPatches[idx].shaderBufferSize;
|
return hod4spShaderPatches[idx].shaderBufferSize;
|
||||||
}
|
}
|
||||||
@@ -726,7 +720,7 @@ long int ftellGetShaderSize(int idx)
|
|||||||
{
|
{
|
||||||
return hodexShaderPatches[idx].shaderBufferSize;
|
return hodexShaderPatches[idx].shaderBufferSize;
|
||||||
}
|
}
|
||||||
else if ((gId == HUMMER) || (gId == HUMMER_SDLX) || (gId == HUMMER_EXTREME) || (gId == HUMMER_EXTREME_MDX))
|
else if (gId == HUMMER || gId == HUMMER_SDLX || gId == HUMMER_EXTREME || gId == HUMMER_EXTREME_MDX)
|
||||||
{
|
{
|
||||||
return hummerShaderFilesToMod[idx].shaderBufferSize;
|
return hummerShaderFilesToMod[idx].shaderBufferSize;
|
||||||
}
|
}
|
||||||
@@ -747,7 +741,7 @@ long int ftellGetShaderSize(int idx)
|
|||||||
*/
|
*/
|
||||||
size_t freadReplace(void *buf, size_t size, size_t count, int idx)
|
size_t freadReplace(void *buf, size_t size, size_t count, int idx)
|
||||||
{
|
{
|
||||||
int gId = getConfig()->crc32;
|
uint32_t gId = getConfig()->crc32;
|
||||||
if (gId == GHOST_SQUAD_EVOLUTION)
|
if (gId == GHOST_SQUAD_EVOLUTION)
|
||||||
{
|
{
|
||||||
if (getConfig()->GPUVendor != NVIDIA_GPU)
|
if (getConfig()->GPUVendor != NVIDIA_GPU)
|
||||||
@@ -760,27 +754,25 @@ size_t freadReplace(void *buf, size_t size, size_t count, int idx)
|
|||||||
}
|
}
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
else if ((gId == LETS_GO_JUNGLE) || (gId == LETS_GO_JUNGLE_REVA) || (gId == LETS_GO_JUNGLE_SPECIAL))
|
else if (gId == LETS_GO_JUNGLE || gId == LETS_GO_JUNGLE_REVA || gId == LETS_GO_JUNGLE_SPECIAL)
|
||||||
{
|
{
|
||||||
memcpy(buf, lgjShaderFilesToMod[idx].shaderBuffer, size);
|
memcpy(buf, lgjShaderFilesToMod[idx].shaderBuffer, size);
|
||||||
return size;
|
return size;
|
||||||
}
|
}
|
||||||
else if ((gId == INITIALD_4_EXP_REVB) || (gId == INITIALD_4_EXP_REVC) || (gId == INITIALD_4_EXP_REVD) ||
|
else if (gId == INITIALD_4_EXP_REVB || gId == INITIALD_4_EXP_REVC || gId == INITIALD_4_EXP_REVD || gId == INITIALD_5_JAP_REVA ||
|
||||||
(gId == INITIALD_5_JAP_REVA) || (gId == INITIALD_5_JAP_REVF) || (gId == INITIALD_5_EXP_30) ||
|
gId == INITIALD_5_JAP_REVF || gId == INITIALD_5_EXP || gId == INITIALD_5_EXP_20 || gId == INITIALD_5_EXP_20A)
|
||||||
(gId == INITIALD_5_EXP_40))
|
|
||||||
{
|
{
|
||||||
memcpy(buf, idShaderFilesToMod[idx].shaderBuffer, size);
|
memcpy(buf, idShaderFilesToMod[idx].shaderBuffer, size);
|
||||||
return size;
|
return size;
|
||||||
}
|
}
|
||||||
else if ((gId == INITIALD_4_REVA) || (gId == INITIALD_4_REVB) || (gId == INITIALD_4_REVC) ||
|
else if (gId == INITIALD_4_REVA || gId == INITIALD_4_REVB || gId == INITIALD_4_REVC || gId == INITIALD_4_REVD || gId == INITIALD_4_REVG)
|
||||||
(gId == INITIALD_4_REVD) || (gId == INITIALD_4_REVG))
|
|
||||||
{
|
{
|
||||||
memcpy(buf, id4jShaderFilesToMod[idx].shaderBuffer, size);
|
memcpy(buf, id4jShaderFilesToMod[idx].shaderBuffer, size);
|
||||||
return size;
|
return size;
|
||||||
}
|
}
|
||||||
else if ((gId == VIRTUA_TENNIS_3) || (gId == VIRTUA_TENNIS_3_TEST) || (gId == VIRTUA_TENNIS_3_REVA) ||
|
else if (gId == VIRTUA_TENNIS_3 || gId == VIRTUA_TENNIS_3_TEST || gId == VIRTUA_TENNIS_3_REVA || gId == VIRTUA_TENNIS_3_REVA_TEST ||
|
||||||
(gId == VIRTUA_TENNIS_3_REVA_TEST) || (gId == VIRTUA_TENNIS_3_REVB) ||
|
gId == VIRTUA_TENNIS_3_REVB || gId == VIRTUA_TENNIS_3_REVB_TEST || gId == VIRTUA_TENNIS_3_REVC ||
|
||||||
(gId == VIRTUA_TENNIS_3_REVB_TEST) || (gId == VIRTUA_TENNIS_3_REVC) || (gId == VIRTUA_TENNIS_3_REVC_TEST))
|
gId == VIRTUA_TENNIS_3_REVC_TEST)
|
||||||
{
|
{
|
||||||
memcpy(buf, vt3ShaderFilesToMod[idx].shaderBuffer, size);
|
memcpy(buf, vt3ShaderFilesToMod[idx].shaderBuffer, size);
|
||||||
return size;
|
return size;
|
||||||
@@ -803,13 +795,12 @@ size_t freadReplace(void *buf, size_t size, size_t count, int idx)
|
|||||||
return ramboNvidiaShaderPatches[idx].shaderBufferSize;
|
return ramboNvidiaShaderPatches[idx].shaderBufferSize;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if ((gId == THE_HOUSE_OF_THE_DEAD_4_REVA) || (gId == THE_HOUSE_OF_THE_DEAD_4_REVB) ||
|
else if (gId == THE_HOUSE_OF_THE_DEAD_4_REVA || gId == THE_HOUSE_OF_THE_DEAD_4_REVB || gId == THE_HOUSE_OF_THE_DEAD_4_REVC)
|
||||||
(gId == THE_HOUSE_OF_THE_DEAD_4_REVC))
|
|
||||||
{
|
{
|
||||||
memcpy(buf, hod4ShaderPatches[idx].shaderBuffer, hod4ShaderPatches[idx].shaderBufferSize);
|
memcpy(buf, hod4ShaderPatches[idx].shaderBuffer, hod4ShaderPatches[idx].shaderBufferSize);
|
||||||
return hod4ShaderPatches[idx].shaderBufferSize;
|
return hod4ShaderPatches[idx].shaderBufferSize;
|
||||||
}
|
}
|
||||||
else if ((gId == THE_HOUSE_OF_THE_DEAD_4_SPECIAL) || (gId == THE_HOUSE_OF_THE_DEAD_4_SPECIAL_REVB))
|
else if (gId == THE_HOUSE_OF_THE_DEAD_4_SPECIAL || gId == THE_HOUSE_OF_THE_DEAD_4_SPECIAL_REVB)
|
||||||
{
|
{
|
||||||
memcpy(buf, hod4spShaderPatches[idx].shaderBuffer, hod4spShaderPatches[idx].shaderBufferSize);
|
memcpy(buf, hod4spShaderPatches[idx].shaderBuffer, hod4spShaderPatches[idx].shaderBufferSize);
|
||||||
return hod4spShaderPatches[idx].shaderBufferSize;
|
return hod4spShaderPatches[idx].shaderBufferSize;
|
||||||
@@ -819,7 +810,7 @@ size_t freadReplace(void *buf, size_t size, size_t count, int idx)
|
|||||||
memcpy(buf, hodexShaderPatches[idx].shaderBuffer, hodexShaderPatches[idx].shaderBufferSize);
|
memcpy(buf, hodexShaderPatches[idx].shaderBuffer, hodexShaderPatches[idx].shaderBufferSize);
|
||||||
return hodexShaderPatches[idx].shaderBufferSize;
|
return hodexShaderPatches[idx].shaderBufferSize;
|
||||||
}
|
}
|
||||||
else if ((gId == HUMMER) || (gId == HUMMER_SDLX) || (gId == HUMMER_EXTREME) || (gId == HUMMER_EXTREME_MDX))
|
else if (gId == HUMMER || gId == HUMMER_SDLX || gId == HUMMER_EXTREME || gId == HUMMER_EXTREME_MDX)
|
||||||
{
|
{
|
||||||
memcpy(buf, hummerShaderFilesToMod[idx].shaderBuffer, hummerShaderFilesToMod[idx].shaderBufferSize);
|
memcpy(buf, hummerShaderFilesToMod[idx].shaderBuffer, hummerShaderFilesToMod[idx].shaderBufferSize);
|
||||||
return hummerShaderFilesToMod[idx].shaderBufferSize;
|
return hummerShaderFilesToMod[idx].shaderBufferSize;
|
||||||
@@ -849,10 +840,10 @@ char *cgGetProgramString(char *program, int e)
|
|||||||
|
|
||||||
uint32_t gId = getConfig()->crc32;
|
uint32_t gId = getConfig()->crc32;
|
||||||
|
|
||||||
if ((gId != INITIALD_4_EXP_REVB) && (gId != INITIALD_4_EXP_REVC) && (gId != INITIALD_4_EXP_REVD) &&
|
if (gId != INITIALD_4_EXP_REVB && gId != INITIALD_4_EXP_REVC && gId != INITIALD_4_EXP_REVD && gId != INITIALD_4_REVA &&
|
||||||
(gId != INITIALD_4_REVA) && (gId != INITIALD_4_REVB) && (gId != INITIALD_4_REVC) && (gId != INITIALD_4_REVD) &&
|
gId != INITIALD_4_REVB && gId != INITIALD_4_REVC && gId != INITIALD_4_REVD && gId != INITIALD_4_REVG &&
|
||||||
(gId != INITIALD_4_REVG) && (gId != INITIALD_5_JAP_REVA) && (gId != INITIALD_5_JAP_REVF) &&
|
gId != INITIALD_5_JAP_REVA && gId != INITIALD_5_JAP_REVF && gId != INITIALD_5_EXP && gId != INITIALD_5_EXP_20 &&
|
||||||
(gId != INITIALD_5_EXP_30) && (gId != INITIALD_5_EXP_40))
|
gId != INITIALD_5_EXP_20A)
|
||||||
{
|
{
|
||||||
return _cgGetProgramString(program, e);
|
return _cgGetProgramString(program, e);
|
||||||
}
|
}
|
||||||
@@ -1098,23 +1089,23 @@ char *cgCreateProgram(uint32_t context, int program_type, const char *program, i
|
|||||||
const char **args) = dlsym(RTLD_NEXT, "cgCreateProgram");
|
const char **args) = dlsym(RTLD_NEXT, "cgCreateProgram");
|
||||||
|
|
||||||
uint32_t gId = getConfig()->crc32;
|
uint32_t gId = getConfig()->crc32;
|
||||||
if (((gId != VIRTUA_TENNIS_3) && (gId != VIRTUA_TENNIS_3_TEST) && (gId != VIRTUA_TENNIS_3_REVA) &&
|
if ((gId != VIRTUA_TENNIS_3 && gId != VIRTUA_TENNIS_3_TEST && gId != VIRTUA_TENNIS_3_REVA && gId != VIRTUA_TENNIS_3_REVA_TEST &&
|
||||||
(gId != VIRTUA_TENNIS_3_REVA_TEST) && (gId != VIRTUA_TENNIS_3_REVB) && (gId != VIRTUA_TENNIS_3_REVB_TEST) &&
|
gId != VIRTUA_TENNIS_3_REVB && gId != VIRTUA_TENNIS_3_REVB_TEST && gId != VIRTUA_TENNIS_3_REVC &&
|
||||||
(gId != VIRTUA_TENNIS_3_REVC) && (gId != VIRTUA_TENNIS_3_REVC_TEST) && (gId != INITIALD_4_EXP_REVB) &&
|
gId != VIRTUA_TENNIS_3_REVC_TEST && gId != INITIALD_4_EXP_REVB && gId != INITIALD_4_EXP_REVC && gId != INITIALD_4_EXP_REVD &&
|
||||||
(gId != INITIALD_4_EXP_REVC) && (gId != INITIALD_4_EXP_REVD) && (gId != LETS_GO_JUNGLE) &&
|
gId != LETS_GO_JUNGLE && gId != LETS_GO_JUNGLE_REVA && gId != LETS_GO_JUNGLE_SPECIAL && gId != INITIALD_4_REVA &&
|
||||||
(gId != LETS_GO_JUNGLE_REVA) && (gId != LETS_GO_JUNGLE_SPECIAL) && (gId != INITIALD_4_REVA) &&
|
gId != INITIALD_4_REVB && gId != INITIALD_4_REVC && gId != INITIALD_4_REVD && gId != INITIALD_4_REVG &&
|
||||||
(gId != INITIALD_4_REVB) && (gId != INITIALD_4_REVC) && (gId != INITIALD_4_REVD) && (gId != INITIALD_4_REVG) &&
|
gId != INITIALD_5_JAP_REVA && gId != INITIALD_5_JAP_REVF && gId != INITIALD_5_EXP && gId != INITIALD_5_EXP_20 &&
|
||||||
(gId != INITIALD_5_JAP_REVA) && (gId != INITIALD_5_JAP_REVF) && (gId != INITIALD_5_EXP_30) &&
|
gId != INITIALD_5_EXP_20A) ||
|
||||||
(gId != INITIALD_5_EXP_40)) ||
|
|
||||||
(getConfig()->GPUVendor == NVIDIA_GPU))
|
(getConfig()->GPUVendor == NVIDIA_GPU))
|
||||||
{
|
{
|
||||||
return _cgCreateProgram(context, program_type, program, profile, entry, args);
|
if ((gId != LETS_GO_JUNGLE && gId != LETS_GO_JUNGLE_REVA && gId != LETS_GO_JUNGLE_SPECIAL) || getConfig()->lgjRenderWithMesa == 0)
|
||||||
|
return _cgCreateProgram(context, program_type, program, profile, entry, args);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((gId == INITIALD_4_EXP_REVB) || (gId == INITIALD_4_EXP_REVC) || (gId == INITIALD_4_EXP_REVD) ||
|
if (gId == INITIALD_4_EXP_REVB || gId == INITIALD_4_EXP_REVC || gId == INITIALD_4_EXP_REVD || gId == INITIALD_4_REVA ||
|
||||||
(gId == INITIALD_4_REVA) || (gId == INITIALD_4_REVB) || (gId == INITIALD_4_REVC) || (gId == INITIALD_4_REVD) ||
|
gId == INITIALD_4_REVB || gId == INITIALD_4_REVC || gId == INITIALD_4_REVD || gId == INITIALD_4_REVG ||
|
||||||
(gId == INITIALD_4_REVG) || (gId == INITIALD_5_JAP_REVA) || (gId == INITIALD_5_JAP_REVF) ||
|
gId == INITIALD_5_JAP_REVA || gId == INITIALD_5_JAP_REVF || gId == INITIALD_5_EXP || gId == INITIALD_5_EXP_20 ||
|
||||||
(gId == INITIALD_5_EXP_30) || (gId == INITIALD_5_EXP_40))
|
gId == INITIALD_5_EXP_20A)
|
||||||
{
|
{
|
||||||
if ((profile == 6148) || (profile == 6150) || profile == 7001)
|
if ((profile == 6148) || (profile == 6150) || profile == 7001)
|
||||||
profile = 6150;
|
profile = 6150;
|
||||||
@@ -1148,9 +1139,8 @@ char *cgCreateProgram(uint32_t context, int program_type, const char *program, i
|
|||||||
|
|
||||||
void gl_ShaderSourceARB(GLhandleARB shaderObj, GLsizei count, const GLcharARB **const string, const GLint *length)
|
void gl_ShaderSourceARB(GLhandleARB shaderObj, GLsizei count, const GLcharARB **const string, const GLint *length)
|
||||||
{
|
{
|
||||||
int gId = getConfig()->crc32;
|
uint32_t gId = getConfig()->crc32;
|
||||||
if ((gId != SEGA_RACE_TV) && (gId != HUMMER) && (gId != HUMMER_SDLX) && (gId != HUMMER_EXTREME) &&
|
if (gId != SEGA_RACE_TV && gId != HUMMER && gId != HUMMER_SDLX && gId != HUMMER_EXTREME && gId != HUMMER_EXTREME_MDX)
|
||||||
(gId != HUMMER_EXTREME_MDX))
|
|
||||||
{
|
{
|
||||||
glShaderSourceARB(shaderObj, count, string, length);
|
glShaderSourceARB(shaderObj, count, string, length);
|
||||||
return;
|
return;
|
||||||
@@ -1191,7 +1181,7 @@ void gl_ShaderSourceARB(GLhandleARB shaderObj, GLsizei count, const GLcharARB **
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if ((gId == HUMMER) || (gId == HUMMER_SDLX) || (gId == HUMMER_EXTREME) || (gId == HUMMER_EXTREME_MDX))
|
else if (gId == HUMMER || gId == HUMMER_SDLX || gId == HUMMER_EXTREME || gId == HUMMER_EXTREME_MDX)
|
||||||
{
|
{
|
||||||
void *addr = __builtin_return_address(0);
|
void *addr = __builtin_return_address(0);
|
||||||
if ((addr != (void *)0x830a501) && (addr != (void *)0x830a485) && (addr != (void *)0x08319841) &&
|
if ((addr != (void *)0x830a501) && (addr != (void *)0x830a485) && (addr != (void *)0x08319841) &&
|
||||||
@@ -1230,8 +1220,8 @@ void gl_ShaderSourceARB(GLhandleARB shaderObj, GLsizei count, const GLcharARB **
|
|||||||
void *gl_XGetProcAddressARB(const unsigned char *procName)
|
void *gl_XGetProcAddressARB(const unsigned char *procName)
|
||||||
{
|
{
|
||||||
int dbgMsg = getConfig()->showDebugMessages;
|
int dbgMsg = getConfig()->showDebugMessages;
|
||||||
if ((getConfig()->crc32 != HUMMER) && (getConfig()->crc32 != HUMMER_SDLX) &&
|
if (getConfig()->crc32 != HUMMER && getConfig()->crc32 != HUMMER_SDLX && getConfig()->crc32 != HUMMER_EXTREME &&
|
||||||
(getConfig()->crc32 != HUMMER_EXTREME) && (getConfig()->crc32 != HUMMER_EXTREME_MDX))
|
getConfig()->crc32 != HUMMER_EXTREME_MDX)
|
||||||
{
|
{
|
||||||
if (strcmp((const char *)procName, "glGenOcclusionQueriesNV") == 0)
|
if (strcmp((const char *)procName, "glGenOcclusionQueriesNV") == 0)
|
||||||
{
|
{
|
||||||
@@ -1442,16 +1432,30 @@ int parseCgcArgs(const char *input, const char ***compilerArgs, const char **out
|
|||||||
|
|
||||||
void loadLibCg()
|
void loadLibCg()
|
||||||
{
|
{
|
||||||
|
int isFlatpak = 0;
|
||||||
void *handle = dlopen("./libCg.so", RTLD_NOW);
|
void *handle = dlopen("./libCg.so", RTLD_NOW);
|
||||||
if (!handle)
|
if (!handle)
|
||||||
{
|
{
|
||||||
fprintf(stderr, "Error: Unable to load library libCg.so %s\n", dlerror());
|
handle = dlopen("/app/lib32/libCg2.so", RTLD_NOW);
|
||||||
fprintf(stderr, "Error: libCg.so version 2.0 is needed to compile the shaders in the game's folder.\n");
|
if (!handle)
|
||||||
exit(1);
|
{
|
||||||
|
fprintf(stderr, "Error: Unable to load library libCg.so %s\n", dlerror());
|
||||||
|
fprintf(stderr, "Error: libCg.so version 2.0 is needed to compile the shaders in the game's folder.\n");
|
||||||
|
exit(1);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
isFlatpak = 1;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
char libCgVersion[9];
|
char libCgVersion[9];
|
||||||
FILE *libF = fopen("./libCg.so", "r");
|
FILE *libF;
|
||||||
|
if (isFlatpak)
|
||||||
|
libF = fopen("/app/lib32/libCg2.so", "r");
|
||||||
|
else
|
||||||
|
libF = fopen("./libCg.so", "r");
|
||||||
|
|
||||||
fseek(libF, 0x226d84, SEEK_SET);
|
fseek(libF, 0x226d84, SEEK_SET);
|
||||||
fread(libCgVersion, 9, 1, libF);
|
fread(libCgVersion, 9, 1, libF);
|
||||||
fclose(libF);
|
fclose(libF);
|
||||||
@@ -1608,7 +1612,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 +1677,7 @@ int handle_patch(void *priv, mmbuffer_t *mb, int nbuf)
|
|||||||
*/
|
*/
|
||||||
void cacheModedShaderFiles()
|
void cacheModedShaderFiles()
|
||||||
{
|
{
|
||||||
int gId = getConfig()->crc32;
|
uint32_t gId = getConfig()->crc32;
|
||||||
char cwd[256];
|
char cwd[256];
|
||||||
char fullPath[512];
|
char fullPath[512];
|
||||||
char shaderBuffer[100000];
|
char shaderBuffer[100000];
|
||||||
@@ -1699,15 +1703,14 @@ void cacheModedShaderFiles()
|
|||||||
free(newProgram);
|
free(newProgram);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if ((gId == INITIALD_4_EXP_REVB) || (gId == INITIALD_4_EXP_REVC) || (gId == INITIALD_4_EXP_REVD) ||
|
else if (gId == INITIALD_4_EXP_REVB || gId == INITIALD_4_EXP_REVC || gId == INITIALD_4_EXP_REVD || gId == INITIALD_4_REVA ||
|
||||||
(gId == INITIALD_4_REVA) || (gId == INITIALD_4_REVB) || (gId == INITIALD_4_REVC) ||
|
gId == INITIALD_4_REVB || gId == INITIALD_4_REVC || gId == INITIALD_4_REVD || gId == INITIALD_4_REVG ||
|
||||||
(gId == INITIALD_4_REVD) || (gId == INITIALD_4_REVG) || (gId == INITIALD_5_JAP_REVA) ||
|
gId == INITIALD_5_JAP_REVA || gId == INITIALD_5_JAP_REVF || gId == INITIALD_5_EXP || gId == INITIALD_5_EXP_20 ||
|
||||||
(gId == INITIALD_5_JAP_REVF) || (gId == INITIALD_5_EXP_30) || (gId == INITIALD_5_EXP_40))
|
gId == INITIALD_5_EXP_20A)
|
||||||
{
|
{
|
||||||
ShaderFilesToMod *shaderFilesToMod;
|
ShaderFilesToMod *shaderFilesToMod;
|
||||||
int filesToModCount;
|
int filesToModCount;
|
||||||
if ((gId == INITIALD_4_REVA) || (gId == INITIALD_4_REVB) || (gId == INITIALD_4_REVC) ||
|
if (gId == INITIALD_4_REVA || gId == INITIALD_4_REVB || gId == INITIALD_4_REVC || gId == INITIALD_4_REVD || gId == INITIALD_4_REVG)
|
||||||
(gId == INITIALD_4_REVD) || (gId == INITIALD_4_REVG))
|
|
||||||
{
|
{
|
||||||
shaderFilesToMod = id4jShaderFilesToMod;
|
shaderFilesToMod = id4jShaderFilesToMod;
|
||||||
filesToModCount = id4FilesToModCount;
|
filesToModCount = id4FilesToModCount;
|
||||||
@@ -1719,8 +1722,8 @@ void cacheModedShaderFiles()
|
|||||||
}
|
}
|
||||||
for (int x = 0; x < filesToModCount; x++)
|
for (int x = 0; x < filesToModCount; x++)
|
||||||
{
|
{
|
||||||
if ((gId == INITIALD_5_JAP_REVA) || (gId == INITIALD_5_JAP_REVF) || (gId == INITIALD_5_EXP_30) ||
|
if (gId == INITIALD_5_JAP_REVA || gId == INITIALD_5_JAP_REVF || gId == INITIALD_5_EXP || gId == INITIALD_5_EXP_20 ||
|
||||||
(gId == INITIALD_5_EXP_40))
|
gId == INITIALD_5_EXP_20A)
|
||||||
{
|
{
|
||||||
char *fName = shaderFilesToMod[x].fileName;
|
char *fName = shaderFilesToMod[x].fileName;
|
||||||
shaderFilesToMod[x].fileName = replaceSubstring(fName, 0, strlen(fName), "Shader", "V5SHADER");
|
shaderFilesToMod[x].fileName = replaceSubstring(fName, 0, strlen(fName), "Shader", "V5SHADER");
|
||||||
@@ -1749,9 +1752,9 @@ void cacheModedShaderFiles()
|
|||||||
free(newProgram);
|
free(newProgram);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if ((gId == VIRTUA_TENNIS_3) || (gId == VIRTUA_TENNIS_3_TEST) || (gId == VIRTUA_TENNIS_3_REVA) ||
|
else if (gId == VIRTUA_TENNIS_3 || gId == VIRTUA_TENNIS_3_TEST || gId == VIRTUA_TENNIS_3_REVA || gId == VIRTUA_TENNIS_3_REVA_TEST ||
|
||||||
(gId == VIRTUA_TENNIS_3_REVA_TEST) || (gId == VIRTUA_TENNIS_3_REVB) ||
|
gId == VIRTUA_TENNIS_3_REVB || gId == VIRTUA_TENNIS_3_REVB_TEST || gId == VIRTUA_TENNIS_3_REVC ||
|
||||||
(gId == VIRTUA_TENNIS_3_REVB_TEST) || (gId == VIRTUA_TENNIS_3_REVC) || (gId == VIRTUA_TENNIS_3_REVC_TEST))
|
gId == VIRTUA_TENNIS_3_REVC_TEST)
|
||||||
{
|
{
|
||||||
for (int x = 0; x < vt3FilesToModCount; x++)
|
for (int x = 0; x < vt3FilesToModCount; x++)
|
||||||
{
|
{
|
||||||
@@ -1830,14 +1833,13 @@ void cacheModedShaderFiles()
|
|||||||
shaderFilesToPatch = hodexShaderPatches;
|
shaderFilesToPatch = hodexShaderPatches;
|
||||||
shaderFilesToPatchCount = hodexShaderPatchesCount;
|
shaderFilesToPatchCount = hodexShaderPatchesCount;
|
||||||
}
|
}
|
||||||
else if ((gId == THE_HOUSE_OF_THE_DEAD_4_REVA) || (gId == THE_HOUSE_OF_THE_DEAD_4_REVB) ||
|
else if (gId == THE_HOUSE_OF_THE_DEAD_4_REVA || gId == THE_HOUSE_OF_THE_DEAD_4_REVB || gId == THE_HOUSE_OF_THE_DEAD_4_REVC)
|
||||||
(gId == THE_HOUSE_OF_THE_DEAD_4_REVC))
|
|
||||||
{
|
{
|
||||||
sprintf(folderName, "/../fs/dat/");
|
sprintf(folderName, "/../fs/dat/");
|
||||||
shaderFilesToPatchCount = hod4ShaderPatchesCount;
|
shaderFilesToPatchCount = hod4ShaderPatchesCount;
|
||||||
shaderFilesToPatch = hod4ShaderPatches;
|
shaderFilesToPatch = hod4ShaderPatches;
|
||||||
}
|
}
|
||||||
else if ((gId == THE_HOUSE_OF_THE_DEAD_4_SPECIAL) || (gId == THE_HOUSE_OF_THE_DEAD_4_SPECIAL_REVB))
|
else if (gId == THE_HOUSE_OF_THE_DEAD_4_SPECIAL || gId == THE_HOUSE_OF_THE_DEAD_4_SPECIAL_REVB)
|
||||||
{
|
{
|
||||||
sprintf(folderName, "/../fs/dat/");
|
sprintf(folderName, "/../fs/dat/");
|
||||||
shaderFilesToPatchCount = hod4spShaderPatchesCount;
|
shaderFilesToPatchCount = hod4spShaderPatchesCount;
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
+120
-81
@@ -4,7 +4,6 @@
|
|||||||
#endif
|
#endif
|
||||||
#undef __x86_64__
|
#undef __x86_64__
|
||||||
#include <GL/glx.h>
|
#include <GL/glx.h>
|
||||||
#include <GL/freeglut.h>
|
|
||||||
#include <X11/Xatom.h>
|
#include <X11/Xatom.h>
|
||||||
#include <X11/extensions/xf86vmode.h>
|
#include <X11/extensions/xf86vmode.h>
|
||||||
#include <dlfcn.h>
|
#include <dlfcn.h>
|
||||||
@@ -19,12 +18,19 @@
|
|||||||
#include "config.h"
|
#include "config.h"
|
||||||
#include "securityboard.h"
|
#include "securityboard.h"
|
||||||
#include "fps_limiter.h"
|
#include "fps_limiter.h"
|
||||||
|
#include "sdlcalls.h"
|
||||||
|
|
||||||
extern bool SDLGame;
|
extern bool SDLWindowCreated;
|
||||||
extern bool gettingGPUVendor;
|
extern bool gettingGPUVendor;
|
||||||
|
extern bool GLUTGame;
|
||||||
|
|
||||||
|
bool creatingWindow = false;
|
||||||
|
|
||||||
Window win;
|
Window win;
|
||||||
|
|
||||||
|
extern Display *x11Display;
|
||||||
|
extern Window x11Window;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Stop the house of the dead games turning keyboard repeating off.
|
* Stop the house of the dead games turning keyboard repeating off.
|
||||||
*/
|
*/
|
||||||
@@ -33,43 +39,56 @@ int XAutoRepeatOff(Display *display)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
Window XCreateWindow(Display *display, Window parent, int x, int y, unsigned int width, unsigned int height,
|
Display *XOpenDisplay(const char *display_name)
|
||||||
unsigned int border_width, int depth, unsigned int class, Visual *visual, unsigned long valueMask,
|
{
|
||||||
XSetWindowAttributes *attributes)
|
Display *(*_XOpenDisplay)(const char *display_name) = dlsym(RTLD_NEXT, "XOpenDisplay");
|
||||||
|
if (SDLWindowCreated || gettingGPUVendor || GLUTGame || getConfig()->noSDL)
|
||||||
|
return _XOpenDisplay(display_name);
|
||||||
|
|
||||||
|
creatingWindow = true;
|
||||||
|
initSDL(0, 0);
|
||||||
|
creatingWindow = false;
|
||||||
|
return x11Display;
|
||||||
|
}
|
||||||
|
|
||||||
|
Window XCreateWindow(Display *display, Window parent, int x, int y, unsigned int width, unsigned int height, unsigned int border_width,
|
||||||
|
int depth, unsigned int class, Visual *visual, unsigned long valueMask, XSetWindowAttributes *attributes)
|
||||||
{
|
{
|
||||||
Window (*_XCreateWindow)(Display *display, Window parent, int x, int y, unsigned int width, unsigned int height,
|
Window (*_XCreateWindow)(Display *display, Window parent, int x, int y, unsigned int width, unsigned int height,
|
||||||
unsigned int border_width, int depth, unsigned int class, Visual *visual,
|
unsigned int border_width, int depth, unsigned int class, Visual *visual,
|
||||||
unsigned long valueMask, XSetWindowAttributes *attributes) =
|
unsigned long valueMask, XSetWindowAttributes *attributes) =
|
||||||
dlsym(RTLD_NEXT, "XCreateWindow");
|
dlsym(RTLD_NEXT, "XCreateWindow");
|
||||||
|
|
||||||
if (SDLGame || gettingGPUVendor)
|
if ((gettingGPUVendor || creatingWindow) || (GLUTGame && getConfig()->noSDL == 0))
|
||||||
{
|
{
|
||||||
Window window = _XCreateWindow(display, parent, x, y, width, height, border_width, depth, class, visual,
|
Window window = _XCreateWindow(display, parent, x, y, width, height, border_width, depth, class, visual,
|
||||||
valueMask, attributes);
|
valueMask, attributes);
|
||||||
return window;
|
return window;
|
||||||
}
|
}
|
||||||
|
|
||||||
width = getConfig()->width;
|
if (getConfig()->noSDL)
|
||||||
height = getConfig()->height;
|
|
||||||
|
|
||||||
// Ensure that the windows will respond with keyboard and mouse events
|
|
||||||
attributes->event_mask = attributes->event_mask | KeyPressMask | KeyReleaseMask | PointerMotionMask;
|
|
||||||
// attributes->override_redirect = False;
|
|
||||||
|
|
||||||
Window window =
|
|
||||||
_XCreateWindow(display, parent, x, y, width, height, border_width, depth, class, visual, valueMask, attributes);
|
|
||||||
printf(" X11 RESOLUTION: %dx%d\n\n", width, height);
|
|
||||||
|
|
||||||
if (getConfig()->fullscreen)
|
|
||||||
{
|
{
|
||||||
Atom wm_state = XInternAtom(display, "_NET_WM_STATE", true);
|
width = getConfig()->width;
|
||||||
Atom wm_fullscreen = XInternAtom(display, "_NET_WM_STATE_FULLSCREEN", true);
|
height = getConfig()->height;
|
||||||
XChangeProperty(display, window, wm_state, XA_ATOM, 32, PropModeReplace, (unsigned char *)&wm_fullscreen, 1);
|
|
||||||
|
attributes->event_mask = attributes->event_mask | KeyPressMask | KeyReleaseMask | PointerMotionMask;
|
||||||
|
|
||||||
|
Window window = _XCreateWindow(display, parent, x, y, width, height, border_width, depth, class, visual, valueMask, attributes);
|
||||||
|
printf(" X11 RESOLUTION: %dx%d\n\n", width, height);
|
||||||
|
|
||||||
|
if (getConfig()->fullscreen)
|
||||||
|
{
|
||||||
|
Atom wm_state = XInternAtom(display, "_NET_WM_STATE", true);
|
||||||
|
Atom wm_fullscreen = XInternAtom(display, "_NET_WM_STATE_FULLSCREEN", true);
|
||||||
|
XChangeProperty(display, window, wm_state, XA_ATOM, 32, PropModeReplace, (unsigned char *)&wm_fullscreen, 1);
|
||||||
|
}
|
||||||
|
win = window;
|
||||||
}
|
}
|
||||||
|
else
|
||||||
win = window;
|
{
|
||||||
|
win = x11Window;
|
||||||
return window;
|
}
|
||||||
|
return win;
|
||||||
}
|
}
|
||||||
|
|
||||||
int XGrabPointer(Display *display, Window grab_window, Bool owner_events, unsigned int event_mask, int pointer_mode,
|
int XGrabPointer(Display *display, Window grab_window, Bool owner_events, unsigned int event_mask, int pointer_mode,
|
||||||
@@ -78,10 +97,15 @@ int XGrabPointer(Display *display, Window grab_window, Bool owner_events, unsign
|
|||||||
int (*_XGrabPointer)(Display *display, Window grab_window, Bool owner_events, unsigned int event_mask,
|
int (*_XGrabPointer)(Display *display, Window grab_window, Bool owner_events, unsigned int event_mask,
|
||||||
int pointer_mode, int keyboard_mode, Window confine_to, Cursor cursor, Time time) =
|
int pointer_mode, int keyboard_mode, Window confine_to, Cursor cursor, Time time) =
|
||||||
dlsym(RTLD_NEXT, "XGrabPointer");
|
dlsym(RTLD_NEXT, "XGrabPointer");
|
||||||
int returnValue = _XGrabPointer(display, grab_window, owner_events, event_mask, pointer_mode, keyboard_mode,
|
|
||||||
confine_to, cursor, time);
|
if (getConfig()->noSDL)
|
||||||
XUngrabPointer(display, time);
|
{
|
||||||
return returnValue;
|
int returnValue =
|
||||||
|
_XGrabPointer(display, grab_window, owner_events, event_mask, pointer_mode, keyboard_mode, confine_to, cursor, time);
|
||||||
|
XUngrabPointer(display, time);
|
||||||
|
return returnValue;
|
||||||
|
}
|
||||||
|
return _XGrabPointer(display, grab_window, owner_events, event_mask, pointer_mode, keyboard_mode, confine_to, cursor, time);
|
||||||
}
|
}
|
||||||
|
|
||||||
int XGrabKeyboard(Display *display, Window grab_window, Bool owner_events, int pointer_mode, int keyboard_mode,
|
int XGrabKeyboard(Display *display, Window grab_window, Bool owner_events, int pointer_mode, int keyboard_mode,
|
||||||
@@ -89,22 +113,27 @@ int XGrabKeyboard(Display *display, Window grab_window, Bool owner_events, int p
|
|||||||
{
|
{
|
||||||
int (*_XGrabKeyboard)(Display *display, Window grab_window, Bool owner_events, int pointer_mode, int keyboard_mode,
|
int (*_XGrabKeyboard)(Display *display, Window grab_window, Bool owner_events, int pointer_mode, int keyboard_mode,
|
||||||
Time time) = dlsym(RTLD_NEXT, "XGrabKeyboard");
|
Time time) = dlsym(RTLD_NEXT, "XGrabKeyboard");
|
||||||
int returnValue = _XGrabKeyboard(display, grab_window, owner_events, pointer_mode, keyboard_mode, time);
|
|
||||||
XUngrabKeyboard(display, time);
|
|
||||||
return returnValue;
|
|
||||||
}
|
|
||||||
|
|
||||||
int XDefineCursor(Display *display, Window w, Cursor cursor)
|
if (getConfig()->noSDL)
|
||||||
{
|
{
|
||||||
return 0;
|
int returnValue = _XGrabKeyboard(display, grab_window, owner_events, pointer_mode, keyboard_mode, time);
|
||||||
|
XUngrabKeyboard(display, time);
|
||||||
|
return returnValue;
|
||||||
|
}
|
||||||
|
return _XGrabKeyboard(display, grab_window, owner_events, pointer_mode, keyboard_mode, time);
|
||||||
}
|
}
|
||||||
|
|
||||||
int XStoreName(Display *display, Window w, const char *window_name)
|
int XStoreName(Display *display, Window w, const char *window_name)
|
||||||
{
|
{
|
||||||
int (*_XStoreName)(Display *display, Window w, const char *window_name) = dlsym(RTLD_NEXT, "XStoreName");
|
int (*_XStoreName)(Display *display, Window w, const char *window_name) = dlsym(RTLD_NEXT, "XStoreName");
|
||||||
char windowTitle[512];
|
|
||||||
sprintf(windowTitle, "%s - FPS: %.2f", getGameName(), calculateFps());
|
if (getConfig()->noSDL)
|
||||||
return _XStoreName(display, w, windowTitle);
|
{
|
||||||
|
char windowTitle[512];
|
||||||
|
sprintf(windowTitle, "%s - FPS: %.2f", getGameName(), calculateFps());
|
||||||
|
return _XStoreName(display, w, windowTitle);
|
||||||
|
}
|
||||||
|
return _XStoreName(display, w, window_name);
|
||||||
}
|
}
|
||||||
|
|
||||||
int XSetStandardProperties(Display *display, Window window, const char *window_name, const char *icon_name,
|
int XSetStandardProperties(Display *display, Window window, const char *window_name, const char *icon_name,
|
||||||
@@ -113,9 +142,30 @@ int XSetStandardProperties(Display *display, Window window, const char *window_n
|
|||||||
int (*_XSetStandardProperties)(Display *display, Window window, const char *window_name, const char *icon_name,
|
int (*_XSetStandardProperties)(Display *display, Window window, const char *window_name, const char *icon_name,
|
||||||
Pixmap icon_pixmap, char **argv, int argc, XSizeHints *hints) =
|
Pixmap icon_pixmap, char **argv, int argc, XSizeHints *hints) =
|
||||||
dlsym(RTLD_NEXT, "XSetStandardProperties");
|
dlsym(RTLD_NEXT, "XSetStandardProperties");
|
||||||
char gameTitle[256] = {0};
|
|
||||||
strcat(gameTitle, getGameName());
|
if (getConfig()->noSDL)
|
||||||
return _XSetStandardProperties(display, window, gameTitle, icon_name, icon_pixmap, argv, argc, hints);
|
{
|
||||||
|
char gameTitle[256] = {0};
|
||||||
|
strcat(gameTitle, getGameName());
|
||||||
|
return _XSetStandardProperties(display, window, gameTitle, icon_name, icon_pixmap, argv, argc, hints);
|
||||||
|
}
|
||||||
|
return _XSetStandardProperties(display, window, window_name, icon_name, icon_pixmap, argv, argc, hints);
|
||||||
|
}
|
||||||
|
|
||||||
|
int XPending(Display *display)
|
||||||
|
{
|
||||||
|
int (*_XPending)(Display *display) = dlsym(RTLD_NEXT, "XPending");
|
||||||
|
if (SDLWindowCreated)
|
||||||
|
return 0;
|
||||||
|
return _XPending(display);
|
||||||
|
}
|
||||||
|
|
||||||
|
int XFlush(Display *display)
|
||||||
|
{
|
||||||
|
int (*_XFlush)(Display *display) = dlsym(RTLD_NEXT, "XFlush");
|
||||||
|
if (SDLWindowCreated)
|
||||||
|
return 0;
|
||||||
|
return _XFlush(display);
|
||||||
}
|
}
|
||||||
|
|
||||||
Bool XF86VidModeSwitchToMode(Display *display, int screen, XF86VidModeModeInfo *modesinfo)
|
Bool XF86VidModeSwitchToMode(Display *display, int screen, XF86VidModeModeInfo *modesinfo)
|
||||||
@@ -153,48 +203,37 @@ int XF86VidModeGetAllModeLines(Display *display, int screen, int *modecount_retu
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
int XPending(Display *display)
|
// Cursor XCreatePixmapCursor(Display *display, Pixmap source, Pixmap mask, XColor *fg, XColor *bg, unsigned int x,
|
||||||
{
|
// unsigned int y)
|
||||||
int (*_XPending)(Display *display) = dlsym(RTLD_NEXT, "XPending");
|
// {
|
||||||
if (SDLGame)
|
// int (*_XCreatePixmapCursor)(Display *display, Pixmap source, Pixmap mask, XColor *fg, XColor *bg, unsigned int x,
|
||||||
return 0;
|
// unsigned int y) = dlsym(RTLD_NEXT, "XCreatePixmapCursor");
|
||||||
return _XPending(display);
|
// if (SDLGame)
|
||||||
}
|
// return 0;
|
||||||
|
// return _XCreatePixmapCursor(display, source, mask, fg, bg, x, y);
|
||||||
|
// }
|
||||||
|
|
||||||
Cursor XCreatePixmapCursor(Display *display, Pixmap source, Pixmap mask, XColor *fg, XColor *bg, unsigned int x,
|
// int XFreePixmap(Display *display, Pixmap pixmap)
|
||||||
unsigned int y)
|
// {
|
||||||
{
|
// int (*_XFreePixmap)(Display *display, Pixmap pixmap) = dlsym(RTLD_NEXT, "XFreePixmap");
|
||||||
int (*_XCreatePixmapCursor)(Display *display, Pixmap source, Pixmap mask, XColor *fg, XColor *bg, unsigned int x,
|
// if (SDLGame)
|
||||||
unsigned int y) = dlsym(RTLD_NEXT, "XCreatePixmapCursor");
|
// return 0;
|
||||||
if (SDLGame)
|
// return _XFreePixmap(display, pixmap);
|
||||||
return 0;
|
// }
|
||||||
return _XCreatePixmapCursor(display, source, mask, fg, bg, x, y);
|
|
||||||
}
|
|
||||||
|
|
||||||
int XFreePixmap(Display *display, Pixmap pixmap)
|
// Pixmap XCreateBitmapFromData(Display *display, Drawable drawable, const char *data, unsigned int x, unsigned int y)
|
||||||
{
|
// {
|
||||||
int (*_XFreePixmap)(Display *display, Pixmap pixmap) = dlsym(RTLD_NEXT, "XFreePixmap");
|
// Pixmap (*_XCreateBitmapFromData)(Display *display, Drawable drawable, const char *data, unsigned int x,
|
||||||
if (SDLGame)
|
// unsigned int y) = dlsym(RTLD_NEXT, "XCreateBitmapFromData");
|
||||||
return 0;
|
// if (SDLGame)
|
||||||
return _XFreePixmap(display, pixmap);
|
// return 0;
|
||||||
}
|
// return _XCreateBitmapFromData(display, drawable, data, x, y);
|
||||||
|
// }
|
||||||
|
|
||||||
Pixmap XCreateBitmapFromData(Display *display, Drawable drawable, const char *data, unsigned int x, unsigned int y)
|
// int XDefineCursor(Display *display, Window w, Cursor cursor)
|
||||||
{
|
// {
|
||||||
Pixmap (*_XCreateBitmapFromData)(Display *display, Drawable drawable, const char *data, unsigned int x,
|
// return 0;
|
||||||
unsigned int y) = dlsym(RTLD_NEXT, "XCreateBitmapFromData");
|
// }
|
||||||
if (SDLGame)
|
|
||||||
return 0;
|
|
||||||
return _XCreateBitmapFromData(display, drawable, data, x, y);
|
|
||||||
}
|
|
||||||
|
|
||||||
int XFlush(Display *display)
|
|
||||||
{
|
|
||||||
int (*_XFlush)(Display *display) = dlsym(RTLD_NEXT, "XFlush");
|
|
||||||
if (SDLGame)
|
|
||||||
return 0;
|
|
||||||
return _XFlush(display);
|
|
||||||
}
|
|
||||||
|
|
||||||
typedef unsigned int uint;
|
typedef unsigned int uint;
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user