mirror of
https://github.com/lindbergh-loader/lindbergh-loader.git
synced 2026-10-14 01:49:12 +03:00
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
cc500aa7ef | ||
|
|
cafd6276c3 | ||
|
|
a2dbf1cbda | ||
|
|
74d61985ec | ||
|
|
4d0996b905 | ||
|
|
52cb3eaf6b | ||
|
|
8b6604efc5 | ||
|
|
7b426f0d11 | ||
|
|
442d03b144 | ||
|
|
50a1a35f7f | ||
|
|
728c308835 | ||
|
|
543ebe4817 | ||
|
|
3c3f0f5eb5 | ||
|
|
fe2c749bb0 | ||
|
|
1f20a51aba | ||
|
|
d3e6027139 | ||
|
|
565a9208b7 | ||
|
|
be78a23a31 | ||
|
|
8942c510ec | ||
|
|
685d569a08 | ||
|
|
5f19cdc44c | ||
|
|
be1b88b92f | ||
|
|
8347b61468 | ||
|
|
3642e2392b | ||
|
|
51eaec106c | ||
|
|
dcae95fe03 | ||
|
|
fbc76dfe5e |
@@ -42,7 +42,7 @@ 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
|
||||||
|
|||||||
@@ -1,7 +1,8 @@
|
|||||||
CC = gcc -m32 -pthread
|
CC ?= gcc
|
||||||
CFLAGS = -g -fPIC -m32 -Wall -Werror -Wno-misleading-indentation -Wno-unused-but-set-variable -Wno-unused-variable -Wno-unused-function -D_GNU_SOURCE -Wno-char-subscripts
|
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 = g++ -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,13 +35,13 @@ 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
|
||||||
|
|
||||||
|
|||||||
+9
-1
@@ -2,7 +2,15 @@
|
|||||||
|
|
||||||
All notable changes to this project will be documented in this file.
|
All notable changes to this project will be documented in this file.
|
||||||
|
|
||||||
## [2.0.2]
|
## [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
|
### Added
|
||||||
- InitialD 5 SBRY added.
|
- InitialD 5 SBRY added.
|
||||||
- HOD4 SP CPU Frequency fix.
|
- HOD4 SP CPU Frequency fix.
|
||||||
|
|||||||
+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
|
||||||
|
|
||||||
|
|||||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -38,25 +38,28 @@ void initWriteCmd(int fdIdx)
|
|||||||
|
|
||||||
int initCardReader()
|
int initCardReader()
|
||||||
{
|
{
|
||||||
initReadCmd(0);
|
|
||||||
initReadCmd(1);
|
|
||||||
initWriteCmd(0);
|
|
||||||
initWriteCmd(1);
|
|
||||||
|
|
||||||
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 && gId != VIRTUA_TENNIS_3_REVA_TEST &&
|
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_REVB && gId != VIRTUA_TENNIS_3_REVB_TEST && gId != VIRTUA_TENNIS_3_REVC &&
|
||||||
gId != VIRTUA_TENNIS_3_REVC_TEST && gId != R_TUNED)
|
gId != VIRTUA_TENNIS_3_REVC_TEST && gId != R_TUNED)
|
||||||
{
|
{
|
||||||
printf("Game does not support Card Reader, please disable the card reader emulation in the config file.\n");
|
printf("Warning: This Game does not support Card Reader, please disable the card reader emulation in the config file.\n");
|
||||||
return -1;
|
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)
|
if (getConfig()->emulateCardreader && getConfig()->emulateDriveboard && gId != R_TUNED)
|
||||||
{
|
{
|
||||||
printf("Game does not support Card Reader and Driver Board emulation enabled at the same time.\n");
|
printf("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");
|
printf("Please disable Drive Board emulations in the config file.\n");
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
initReadCmd(0);
|
||||||
|
initReadCmd(1);
|
||||||
|
initWriteCmd(0);
|
||||||
|
initWriteCmd(1);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+617
-603
File diff suppressed because it is too large
Load Diff
@@ -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
|
||||||
@@ -71,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)
|
||||||
@@ -183,6 +183,7 @@ typedef struct {
|
|||||||
char player1_button_8[INPUT_STRING_LENGTH];
|
char player1_button_8[INPUT_STRING_LENGTH];
|
||||||
char player1_button_9[INPUT_STRING_LENGTH];
|
char player1_button_9[INPUT_STRING_LENGTH];
|
||||||
char player1_button_10[INPUT_STRING_LENGTH];
|
char player1_button_10[INPUT_STRING_LENGTH];
|
||||||
|
char player1_coin[INPUT_STRING_LENGTH];
|
||||||
|
|
||||||
// Player 2 controls
|
// Player 2 controls
|
||||||
char player2_button_start[INPUT_STRING_LENGTH];
|
char player2_button_start[INPUT_STRING_LENGTH];
|
||||||
@@ -279,8 +280,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();
|
||||||
|
|||||||
+138
-20
@@ -41,6 +41,7 @@ ArcadeInput arcadeInputs[] = {{"TEST_BUTTON", 0, BUTTON_TEST, 1},
|
|||||||
{"PLAYER_1_BUTTON_8", 1, BUTTON_8, 1},
|
{"PLAYER_1_BUTTON_8", 1, BUTTON_8, 1},
|
||||||
{"PLAYER_1_BUTTON_9", 1, BUTTON_9, 1},
|
{"PLAYER_1_BUTTON_9", 1, BUTTON_9, 1},
|
||||||
{"PLAYER_1_BUTTON_10", 1, BUTTON_10, 1},
|
{"PLAYER_1_BUTTON_10", 1, BUTTON_10, 1},
|
||||||
|
{"PLAYER_1_COIN", 1, COIN, 1},
|
||||||
|
|
||||||
{"PLAYER_2_BUTTON_START", 2, BUTTON_START, 1},
|
{"PLAYER_2_BUTTON_START", 2, BUTTON_START, 1},
|
||||||
{"PLAYER_2_BUTTON_SERVICE", 2, BUTTON_SERVICE, 1},
|
{"PLAYER_2_BUTTON_SERVICE", 2, BUTTON_SERVICE, 1},
|
||||||
@@ -920,14 +921,18 @@ static ControllerStatus listControllers(Controllers *controllers)
|
|||||||
strcat(controllerInput->inputName, "_");
|
strcat(controllerInput->inputName, "_");
|
||||||
strcat(controllerInput->inputName, codename(EV_KEY, code));
|
strcat(controllerInput->inputName, codename(EV_KEY, code));
|
||||||
normaliseName(controllerInput->inputName);
|
normaliseName(controllerInput->inputName);
|
||||||
|
if(snprintf(controllerInput->inputTechName, SIZE, "%s:KEY:%i", controllers->controller[i].path, code) >= 1024) {
|
||||||
|
// hum ok, truncated value
|
||||||
|
}
|
||||||
|
strcpy(controllerInput->inputTechNegName, "-"); // unassignable value (not "" while some conf are empty)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (test_bit(EV_ABS, bit[0]))
|
if (test_bit(EV_ABS, bit[0]))
|
||||||
{
|
{
|
||||||
ioctl(controller, EVIOCGBIT(EV_ABS, KEY_MAX), bit[EV_ABS]);
|
ioctl(controller, EVIOCGBIT(EV_ABS, ABS_MAX), bit[EV_ABS]);
|
||||||
for (int code = 0; code < KEY_MAX; code++)
|
for (int code = 0; code < ABS_MAX; code++)
|
||||||
{
|
{
|
||||||
if (test_bit(code, bit[EV_ABS]))
|
if (test_bit(code, bit[EV_ABS]))
|
||||||
{
|
{
|
||||||
@@ -941,6 +946,12 @@ static ControllerStatus listControllers(Controllers *controllers)
|
|||||||
strcat(controllerInput->inputName, "_");
|
strcat(controllerInput->inputName, "_");
|
||||||
strcat(controllerInput->inputName, codename(EV_ABS, code));
|
strcat(controllerInput->inputName, codename(EV_ABS, code));
|
||||||
normaliseName(controllerInput->inputName);
|
normaliseName(controllerInput->inputName);
|
||||||
|
if(snprintf(controllerInput->inputTechName, SIZE, "%s:ABS:%i", controllers->controller[i].path, code) >= 1024) {
|
||||||
|
// hum ok, truncated value
|
||||||
|
}
|
||||||
|
if(snprintf(controllerInput->inputTechNegName, SIZE, "%s:ABS_NEG:%i", controllers->controller[i].path, code) >= 1024) {
|
||||||
|
// hum ok, truncated value
|
||||||
|
}
|
||||||
|
|
||||||
ControllerInput *minControllerInput =
|
ControllerInput *minControllerInput =
|
||||||
&controllers->controller[i].inputs[controllers->controller[i].inputCount++];
|
&controllers->controller[i].inputs[controllers->controller[i].inputCount++];
|
||||||
@@ -949,6 +960,12 @@ static ControllerStatus listControllers(Controllers *controllers)
|
|||||||
minControllerInput->specialFunction = ANALOGUE_TO_DIGITAL_MIN;
|
minControllerInput->specialFunction = ANALOGUE_TO_DIGITAL_MIN;
|
||||||
strcpy(minControllerInput->inputName, controllerInput->inputName);
|
strcpy(minControllerInput->inputName, controllerInput->inputName);
|
||||||
strcat(minControllerInput->inputName, "_MIN");
|
strcat(minControllerInput->inputName, "_MIN");
|
||||||
|
if(snprintf(minControllerInput->inputTechName, SIZE, "%s:ABS:%i:MIN", controllers->controller[i].path, code) >= 1024) {
|
||||||
|
// hum ok, truncated value
|
||||||
|
}
|
||||||
|
if(snprintf(minControllerInput->inputTechNegName, SIZE, "%s:ABS_NEG:%i:MIN", controllers->controller[i].path, code) >= 1024) {
|
||||||
|
// hum ok, truncated value
|
||||||
|
}
|
||||||
|
|
||||||
ControllerInput *maxControllerInput =
|
ControllerInput *maxControllerInput =
|
||||||
&controllers->controller[i].inputs[controllers->controller[i].inputCount++];
|
&controllers->controller[i].inputs[controllers->controller[i].inputCount++];
|
||||||
@@ -957,6 +974,23 @@ static ControllerStatus listControllers(Controllers *controllers)
|
|||||||
maxControllerInput->specialFunction = ANALOGUE_TO_DIGITAL_MAX;
|
maxControllerInput->specialFunction = ANALOGUE_TO_DIGITAL_MAX;
|
||||||
strcpy(maxControllerInput->inputName, controllerInput->inputName);
|
strcpy(maxControllerInput->inputName, controllerInput->inputName);
|
||||||
strcat(maxControllerInput->inputName, "_MAX");
|
strcat(maxControllerInput->inputName, "_MAX");
|
||||||
|
if(snprintf(maxControllerInput->inputTechName, SIZE, "%s:ABS:%i:MAX", controllers->controller[i].path, code) >= 1024) {
|
||||||
|
// hum ok, truncated value
|
||||||
|
}
|
||||||
|
if(snprintf(maxControllerInput->inputTechNegName, SIZE, "%s:ABS_NEG:%i:MAX", controllers->controller[i].path, code) >= 1024) {
|
||||||
|
// hum ok, truncated value
|
||||||
|
}
|
||||||
|
|
||||||
|
ControllerInput *shakeControllerInput =
|
||||||
|
&controllers->controller[i].inputs[controllers->controller[i].inputCount++];
|
||||||
|
shakeControllerInput->evType = EV_ABS;
|
||||||
|
shakeControllerInput->evCode = code;
|
||||||
|
shakeControllerInput->specialFunction = ANALOGUE_SHAKE;
|
||||||
|
strcpy(shakeControllerInput->inputName, controllerInput->inputName);
|
||||||
|
strcat(shakeControllerInput->inputName, "_SHAKE");
|
||||||
|
if(snprintf(shakeControllerInput->inputTechName, SIZE, "%s:ABS:%i:SHAKE", controllers->controller[i].path, code) >= 1024) {
|
||||||
|
// hum ok, truncated value
|
||||||
|
}
|
||||||
|
|
||||||
struct input_absinfo absoluteFeatures;
|
struct input_absinfo absoluteFeatures;
|
||||||
ioctl(controller, EVIOCGABS(code), &absoluteFeatures);
|
ioctl(controller, EVIOCGABS(code), &absoluteFeatures);
|
||||||
@@ -1048,8 +1082,13 @@ void *controllerThread(void *_args)
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
setSwitch(args->controller->keyTriggers[event.code].player,
|
if(args->controller->keyTriggers[event.code].isCoin == 1) {
|
||||||
args->controller->keyTriggers[event.code].channel, event.value == 0 ? 0 : 1);
|
if(event.value == 1)
|
||||||
|
incrementCoin(args->controller->keyTriggers[event.code].player, 1);
|
||||||
|
} else
|
||||||
|
setSwitch(args->controller->keyTriggers[event.code].player,
|
||||||
|
args->controller->keyTriggers[event.code].channel, event.value == 0 ? 0 : 1);
|
||||||
|
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
@@ -1059,31 +1098,67 @@ void *controllerThread(void *_args)
|
|||||||
((double)event.value - (double)args->controller->absMin[event.code]) /
|
((double)event.value - (double)args->controller->absMin[event.code]) /
|
||||||
((double)args->controller->absMax[event.code] - (double)args->controller->absMin[event.code]);
|
((double)args->controller->absMax[event.code] - (double)args->controller->absMin[event.code]);
|
||||||
|
|
||||||
|
if(args->controller->absTriggers[event.code].isNeg == 1) {
|
||||||
|
scaled = 1.0 - scaled;
|
||||||
|
}
|
||||||
|
|
||||||
if (args->controller->absTriggers[event.code].enabled)
|
if (args->controller->absTriggers[event.code].enabled)
|
||||||
{
|
{
|
||||||
int channel = args->controller->absTriggers[event.code].channel;
|
int channel = args->controller->absTriggers[event.code].channel;
|
||||||
// Deadzone handling
|
|
||||||
if (scaled < analogue_deadzones[channel].start_max)
|
if (args->controller->absTriggers[event.code].isAnalogue) {
|
||||||
|
// Deadzone handling
|
||||||
|
if (scaled < analogue_deadzones[channel].start_max)
|
||||||
scaled = 0.0;
|
scaled = 0.0;
|
||||||
if (scaled > analogue_deadzones[channel].middle_min && scaled < analogue_deadzones[channel].middle_max)
|
if (scaled > analogue_deadzones[channel].middle_min && scaled < analogue_deadzones[channel].middle_max)
|
||||||
scaled = 0.5;
|
scaled = 0.5;
|
||||||
if (scaled > analogue_deadzones[channel].end_min)
|
if (scaled > analogue_deadzones[channel].end_min)
|
||||||
scaled = 1.0;
|
scaled = 1.0;
|
||||||
|
setAnalogue(channel, scaled * (pow(2, jvsBits) - 1));
|
||||||
setAnalogue(channel, scaled * (pow(2, jvsBits) - 1));
|
} else {
|
||||||
|
setSwitch(args->controller->absTriggers[event.code].player,
|
||||||
|
args->controller->absTriggers[event.code].channel, scaled < 0.8 ? 0 : 1);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (args->controller->absTriggers[event.code].minEnabled)
|
if(event.value <= ((args->controller->absMin[event.code] + args->controller->absMax[event.code]) / 2)) {
|
||||||
{
|
if (args->controller->absTriggers[event.code].minEnabled)
|
||||||
setSwitch(args->controller->absTriggers[event.code].minPlayer,
|
{
|
||||||
args->controller->absTriggers[event.code].minChannel, scaled < 0.2);
|
int channel = args->controller->absTriggers[event.code].minChannel;
|
||||||
|
|
||||||
|
if (args->controller->absTriggers[event.code].isAnalogue) {
|
||||||
|
setAnalogue(channel, scaled < 0.2 ? 0.0 : pow(2, jvsBits) * 1.0);
|
||||||
|
} else {
|
||||||
|
setSwitch(args->controller->absTriggers[event.code].minPlayer,
|
||||||
|
args->controller->absTriggers[event.code].minChannel, scaled < 0.2 ? 1 : 0);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (args->controller->absTriggers[event.code].maxEnabled)
|
if(event.value >= ((args->controller->absMin[event.code] + args->controller->absMax[event.code]) / 2)) {
|
||||||
{
|
if (args->controller->absTriggers[event.code].maxEnabled)
|
||||||
setSwitch(args->controller->absTriggers[event.code].maxPlayer,
|
{
|
||||||
args->controller->absTriggers[event.code].maxChannel, scaled > 0.8);
|
int channel = args->controller->absTriggers[event.code].maxChannel;
|
||||||
|
|
||||||
|
if (args->controller->absTriggers[event.code].isAnalogue) {
|
||||||
|
setAnalogue(channel, scaled > 0.8 ? pow(2, jvsBits) : 0.0);
|
||||||
|
} else {
|
||||||
|
setSwitch(args->controller->absTriggers[event.code].maxPlayer,
|
||||||
|
args->controller->absTriggers[event.code].maxChannel, scaled > 0.8 ? 1 : 0);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
if (args->controller->absTriggers[event.code].shakeEnabled)
|
||||||
|
{
|
||||||
|
int channel = args->controller->absTriggers[event.code].shakeChannel;
|
||||||
|
if( (scaled > args->controller->absTriggers[event.code].shakePreviousScaled && scaled - args->controller->absTriggers[event.code].shakePreviousScaled > 0.1) ||
|
||||||
|
(scaled < args->controller->absTriggers[event.code].shakePreviousScaled && -scaled + args->controller->absTriggers[event.code].shakePreviousScaled > 0.1)) {
|
||||||
|
setAnalogue(channel, 0);
|
||||||
|
} else {
|
||||||
|
setAnalogue(channel, pow(2, jvsBits) / 2);
|
||||||
|
}
|
||||||
|
args->controller->absTriggers[event.code].shakePreviousScaled = scaled;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
@@ -1106,6 +1181,8 @@ char *getMapping(char *mapping)
|
|||||||
// Test button
|
// Test button
|
||||||
if (strcmp(mapping, config->arcadeInputs.test) == 0)
|
if (strcmp(mapping, config->arcadeInputs.test) == 0)
|
||||||
return "TEST_BUTTON";
|
return "TEST_BUTTON";
|
||||||
|
if (strcmp(mapping, config->arcadeInputs.player1_coin) == 0)
|
||||||
|
return "PLAYER_1_COIN";
|
||||||
|
|
||||||
// Player 1 controls
|
// Player 1 controls
|
||||||
if (strcmp(mapping, config->arcadeInputs.player1_button_start) == 0)
|
if (strcmp(mapping, config->arcadeInputs.player1_button_start) == 0)
|
||||||
@@ -1232,19 +1309,35 @@ ControllerStatus startControllerThreads(Controllers *controllers)
|
|||||||
controllers->controller[i].absTriggers[j].enabled = 0;
|
controllers->controller[i].absTriggers[j].enabled = 0;
|
||||||
controllers->controller[i].absTriggers[j].minEnabled = 0;
|
controllers->controller[i].absTriggers[j].minEnabled = 0;
|
||||||
controllers->controller[i].absTriggers[j].maxEnabled = 0;
|
controllers->controller[i].absTriggers[j].maxEnabled = 0;
|
||||||
|
controllers->controller[i].absTriggers[j].shakeEnabled = 0;
|
||||||
|
controllers->controller[i].absTriggers[j].isNeg = 0;
|
||||||
|
controllers->controller[i].absTriggers[j].isAnalogue = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (int j = 0; j < KEY_MAX; j++)
|
for (int j = 0; j < KEY_MAX; j++)
|
||||||
{
|
{
|
||||||
controllers->controller[i].keyTriggers[j].enabled = 0;
|
controllers->controller[i].keyTriggers[j].enabled = 0;
|
||||||
controllers->controller[i].keyTriggers[j].isAnalogue = 0;
|
controllers->controller[i].keyTriggers[j].isAnalogue = 0;
|
||||||
|
controllers->controller[i].keyTriggers[j].isCoin = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (int j = 0; j < controllers->controller[i].inputCount; j++)
|
for (int j = 0; j < controllers->controller[i].inputCount; j++)
|
||||||
{
|
{
|
||||||
char *mapping = getMapping(controllers->controller[i].inputs[j].inputName);
|
char *mapping = getMapping(controllers->controller[i].inputs[j].inputName);
|
||||||
if (mapping == NULL)
|
int negabs = 0;
|
||||||
continue;
|
|
||||||
|
if (mapping == NULL) {
|
||||||
|
// give a 2nd chance with a techninal mapping
|
||||||
|
mapping = getMapping(controllers->controller[i].inputs[j].inputTechName);
|
||||||
|
if (mapping == NULL) {
|
||||||
|
// give a 3rd change with negativ technical mapping
|
||||||
|
mapping = getMapping(controllers->controller[i].inputs[j].inputTechNegName);
|
||||||
|
negabs = 1;
|
||||||
|
if (mapping == NULL) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
ArcadeInput input = {0};
|
ArcadeInput input = {0};
|
||||||
ControllerStatus status = getArcadeInputByName(mapping, &input);
|
ControllerStatus status = getArcadeInputByName(mapping, &input);
|
||||||
@@ -1269,6 +1362,9 @@ ControllerStatus startControllerThreads(Controllers *controllers)
|
|||||||
input.name);
|
input.name);
|
||||||
controllers->controller[i].absTriggers[controllers->controller[i].inputs[j].evCode].player =
|
controllers->controller[i].absTriggers[controllers->controller[i].inputs[j].evCode].player =
|
||||||
input.player;
|
input.player;
|
||||||
|
controllers->controller[i].absTriggers[controllers->controller[i].inputs[j].evCode].isNeg = negabs;
|
||||||
|
if (strstr(input.name, "ANALOGUE") == NULL)
|
||||||
|
controllers->controller[i].absTriggers[controllers->controller[i].inputs[j].evCode].isAnalogue = 0;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
@@ -1281,6 +1377,9 @@ ControllerStatus startControllerThreads(Controllers *controllers)
|
|||||||
input.name);
|
input.name);
|
||||||
controllers->controller[i].absTriggers[controllers->controller[i].inputs[j].evCode].maxPlayer =
|
controllers->controller[i].absTriggers[controllers->controller[i].inputs[j].evCode].maxPlayer =
|
||||||
input.player;
|
input.player;
|
||||||
|
controllers->controller[i].absTriggers[controllers->controller[i].inputs[j].evCode].isNeg = negabs;
|
||||||
|
if (strstr(input.name, "ANALOGUE") == NULL)
|
||||||
|
controllers->controller[i].absTriggers[controllers->controller[i].inputs[j].evCode].isAnalogue = 0;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
@@ -1293,6 +1392,21 @@ ControllerStatus startControllerThreads(Controllers *controllers)
|
|||||||
input.name);
|
input.name);
|
||||||
controllers->controller[i].absTriggers[controllers->controller[i].inputs[j].evCode].minPlayer =
|
controllers->controller[i].absTriggers[controllers->controller[i].inputs[j].evCode].minPlayer =
|
||||||
input.player;
|
input.player;
|
||||||
|
controllers->controller[i].absTriggers[controllers->controller[i].inputs[j].evCode].isNeg = negabs;
|
||||||
|
if (strstr(input.name, "ANALOGUE") == NULL)
|
||||||
|
controllers->controller[i].absTriggers[controllers->controller[i].inputs[j].evCode].isAnalogue = 0;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
|
case ANALOGUE_SHAKE:
|
||||||
|
{
|
||||||
|
controllers->controller[i].absTriggers[controllers->controller[i].inputs[j].evCode].shakeEnabled = 1;
|
||||||
|
controllers->controller[i].absTriggers[controllers->controller[i].inputs[j].evCode].shakeChannel =
|
||||||
|
input.channel;
|
||||||
|
strcpy(controllers->controller[i].absTriggers[controllers->controller[i].inputs[j].evCode].shakeName,
|
||||||
|
input.name);
|
||||||
|
controllers->controller[i].absTriggers[controllers->controller[i].inputs[j].evCode].shakePlayer =
|
||||||
|
input.player;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
@@ -1314,6 +1428,10 @@ ControllerStatus startControllerThreads(Controllers *controllers)
|
|||||||
|
|
||||||
if (strstr(input.name, "ANALOGUE") != NULL)
|
if (strstr(input.name, "ANALOGUE") != NULL)
|
||||||
controllers->controller[i].keyTriggers[controllers->controller[i].inputs[j].evCode].isAnalogue = 1;
|
controllers->controller[i].keyTriggers[controllers->controller[i].inputs[j].evCode].isAnalogue = 1;
|
||||||
|
|
||||||
|
if (strcmp(input.name, "PLAYER_1_COIN") == 0) {
|
||||||
|
controllers->controller[i].keyTriggers[controllers->controller[i].inputs[j].evCode].isCoin = 1;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
|||||||
@@ -31,6 +31,15 @@ typedef struct
|
|||||||
int maxEnabled;
|
int maxEnabled;
|
||||||
|
|
||||||
int isAnalogue;
|
int isAnalogue;
|
||||||
|
int isNeg; // reversed axis
|
||||||
|
|
||||||
|
char shakeName[SIZE];
|
||||||
|
int shakeChannel;
|
||||||
|
int shakeEnabled;
|
||||||
|
int shakePlayer;
|
||||||
|
double shakePreviousScaled;
|
||||||
|
|
||||||
|
int isCoin;
|
||||||
} ArcadeInput;
|
} ArcadeInput;
|
||||||
|
|
||||||
typedef enum
|
typedef enum
|
||||||
@@ -43,12 +52,15 @@ typedef enum {
|
|||||||
NO_SPECIAL_FUNCTION = 0,
|
NO_SPECIAL_FUNCTION = 0,
|
||||||
ANALOGUE_TO_DIGITAL_MAX,
|
ANALOGUE_TO_DIGITAL_MAX,
|
||||||
ANALOGUE_TO_DIGITAL_MIN,
|
ANALOGUE_TO_DIGITAL_MIN,
|
||||||
DIGITAL_TO_ANALOGUE
|
DIGITAL_TO_ANALOGUE,
|
||||||
|
ANALOGUE_SHAKE
|
||||||
} SpecialFunction;
|
} SpecialFunction;
|
||||||
|
|
||||||
typedef struct
|
typedef struct
|
||||||
{
|
{
|
||||||
char inputName[SIZE];
|
char inputName[SIZE];
|
||||||
|
char inputTechName[SIZE];
|
||||||
|
char inputTechNegName[SIZE];
|
||||||
int evType;
|
int evType;
|
||||||
int evCode;
|
int evCode;
|
||||||
SpecialFunction specialFunction;
|
SpecialFunction specialFunction;
|
||||||
|
|||||||
+3
-25
@@ -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"
|
||||||
@@ -185,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)
|
||||||
{
|
{
|
||||||
@@ -1199,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);
|
|
||||||
+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
|
||||||
|
|||||||
+1571
-1568
File diff suppressed because it is too large
Load Diff
+681
-679
File diff suppressed because it is too large
Load Diff
@@ -2,6 +2,7 @@
|
|||||||
|
|
||||||
#include "securityboard.h"
|
#include "securityboard.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
|
||||||
@@ -51,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;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1432,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);
|
||||||
|
|||||||
@@ -702,14 +702,14 @@ static int stbi__sse2_available()
|
|||||||
|
|
||||||
static int stbi__sse2_available()
|
static int stbi__sse2_available()
|
||||||
{
|
{
|
||||||
#if defined(__GNUC__) && (__GNUC__ * 100 + __GNUC_MINOR__) >= 408 // GCC 4.8 or later
|
//#if defined(__GNUC__) && (__GNUC__ * 100 + __GNUC_MINOR__) >= 408 // GCC 4.8 or later
|
||||||
// GCC 4.8+ has a nice way to do this
|
// GCC 4.8+ has a nice way to do this
|
||||||
return __builtin_cpu_supports("sse2");
|
//return __builtin_cpu_supports("sse2");
|
||||||
#else
|
//#else
|
||||||
// portable way to do this, preferably without using GCC inline ASM?
|
// portable way to do this, preferably without using GCC inline ASM?
|
||||||
// just bail for now.
|
// just bail for now.
|
||||||
return 0;
|
return 0;
|
||||||
#endif
|
//#endif
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
Reference in New Issue
Block a user