Version 1.08 with public source code release.

This commit is contained in:
icex2
2020-10-03 20:56:55 +02:00
parent 656148121d
commit 762bf140c0
555 changed files with 55502 additions and 3 deletions
+62
View File
@@ -0,0 +1,62 @@
/**
* Example implementation of the piubtn API. This doesn't really implement anything but rather provides a stub file that
* helps anyone to get started with API development/prototyping.
*
* A simple setup for a quick start:
* 1. Ensure that the API folders with the headers are located next to this file, specifically ptapi/io/piubtn.h.
* 2. Compile using: gcc -I. -m32 -shared -fPIC -o ptapi-io-piubtn-stub.so ptapi-io-piubtn-stub.c
* 3. Follow the steps in the readme to configure it for the game of your choice.
*/
#include <stdlib.h>
#include <stdio.h>
#include "ptapi/io/piubtn.h"
const char* ptapi_io_piubtn_ident(void)
{
return "stub";
}
bool ptapi_io_piubtn_open(void)
{
printf("piubtn-stub: ptapi_io_piubtn_open\n");
return true;
}
void ptapi_io_piubtn_close(void)
{
printf("piubtn-stub: ptapi_io_piubtn_close\n");
}
bool ptapi_io_piubtn_recv(void)
{
return true;
}
bool ptapi_io_piubtn_send(void)
{
return true;
}
void ptapi_io_piubtn_get_input(uint8_t player, struct ptapi_io_piubtn_inputs* inputs)
{
// Set all inputs to off
if (player == 0) {
inputs->left = false;
inputs->right = false;
inputs->start = false;
inputs->back = false;
} else {
inputs->left = false;
inputs->right = false;
inputs->start = false;
inputs->back = false;
}
}
void ptapi_io_piubtn_set_output(uint8_t player, const struct ptapi_io_piubtn_outputs* outputs)
{
}
+79
View File
@@ -0,0 +1,79 @@
/**
* Example implementation of the piuio API. This doesn't really implement anything but rather provides a stub file that
* helps anyone to get started with API development/prototyping.
*
* A simple setup for a quick start:
* 1. Ensure that the API folders with the headers are located next to this file, specifically ptapi/io/piuio.h.
* 2. Compile using: gcc -I. -m32 -shared -fPIC -o ptapi-io-piuio-stub.so ptapi-io-piuio-stub.c
* 3. Follow the steps in the readme to configure it for the game of your choice.
*/
#include <stdlib.h>
#include <stdio.h>
#include "ptapi/io/piuio.h"
const char* ptapi_io_piuio_ident(void)
{
return "stub";
}
bool ptapi_io_piuio_open(void)
{
printf("piuio-stub: ptapi_io_piuio_open\n");
return true;
}
void ptapi_io_piuio_close(void)
{
printf("piuio-stub: ptapi_io_piuio_close\n");
}
bool ptapi_io_piuio_recv(void)
{
return true;
}
bool ptapi_io_piuio_send(void)
{
return true;
}
void ptapi_io_piuio_get_input_pad(uint8_t player, enum ptapi_io_piuio_sensor_group sensor_group,
struct ptapi_io_piuio_pad_inputs* inputs)
{
// Set all inputs to off
if (player == 0) {
inputs->lu = false;
inputs->ru = false;
inputs->cn = false;
inputs->ld = false;
inputs->rd = false;
} else {
inputs->lu = false;
inputs->ru = false;
inputs->cn = false;
inputs->ld = false;
inputs->rd = false;
}
}
void ptapi_io_piuio_get_input_sys(struct ptapi_io_piuio_sys_inputs* inputs)
{
// Set all inputs to off
inputs->test = false;
inputs->service = false;
inputs->clear = false;
inputs->coin = false;
inputs->coin2 = false;
}
void ptapi_io_piuio_set_output_pad(uint8_t player, const struct ptapi_io_piuio_pad_outputs* outputs)
{
}
void ptapi_io_piuio_set_output_cab(const struct ptapi_io_piuio_cab_outputs* outputs)
{
}
+47
View File
@@ -0,0 +1,47 @@
# [str]: Path to game settings (SETTINGS) folder
game.settings=./save
# [str]: Version of the game (format YYYYMMDD). Make sure this matches exactly the version you are running because the hook lib has to apply memory patches.
game.version=20040408
# [bool (0/1)]: Force game into window mode
patch.gfx.windowed=0
# [bool (0/1)]: Enable file call monitoring
patch.hook_mon.file=0
# [bool (0/1)]: Enable file system related call monitoring
patch.hook_mon.fs=0
# [bool (0/1)]: Enable IO syscall monitoring
patch.hook_mon.io=0
# [bool (0/1)]: Enable any file/IO open call monitoring
patch.hook_mon.open=0
# [bool (0/1)]: Enable libusb call monitoring
patch.hook_mon.usb=0
# [bool (0/1)]: Disable the built in keyboard inputs for test (F1), service (F2) and clear (F3)
patch.hook_main_loop.disable_built_in_inputs=0
# [str]: Path to a library implementing the x11-input-handler api to capture X11 keyboard inputs
patch_hook_main_loop.x11_input_handler=
# [str]: Path to library implementing the piuio api for piuio emulation
patch.piuio.emu_lib=
# [bool (0/1)]: Enable game exit on Test + Service
patch.piuio_exit.test_serv=0
# [str]: Select the sound device to open on snd_pcm_open
patch.sound.device=dmix
# [bool (0/1)]: Halt on sigsegv to attach a debugger to the process
patch.sigsegv.halt_on_segv=0
# [str]: Print the log output to the specified file
util.log.file=pumptools.log
# [int]: Set the log level (0-4)
util.log.level=4
+50
View File
@@ -0,0 +1,50 @@
# [str]: Path to game settings (SETTINGS) folder
game.settings=./save
# [bool (0/1)]: Force game into window mode
patch.gfx.windowed=0
# [bool (0/1)]: Enable file call monitoring
patch.hook_mon.file=0
# [bool (0/1)]: Enable file system related call monitoring
patch.hook_mon.fs=0
# [bool (0/1)]: Enable IO syscall monitoring
patch.hook_mon.io=0
# [bool (0/1)]: Enable any file/IO open call monitoring
patch.hook_mon.open=0
# [bool (0/1)]: Enable libusb call monitoring
patch.hook_mon.usb=0
# [bool (0/1)]: Disable the built in keyboard inputs for test (F1), service (F2) and clear (F3)
patch.hook_main_loop.disable_built_in_inputs=0
# [str]: Path to a library implementing the x11-input-handler api to capture X11 keyboard inputs
patch_hook_main_loop.x11_input_handler=
# [str]: Address and port of pumpnet server (e.g. 127.0.0.1:1234)
patch.net_profile.server=
# [int]: Machine id for pumpnet
patch.net_profile.machine_id=0
# [str]: Path to library implementing the piuio api for piuio emulation
patch.piuio.emu_lib=
# [bool (0/1)]: Enable game exit on Test + Service
patch.piuio_exit.test_serv=0
# [str]: Select the sound device to open on snd_pcm_open
patch.sound.device=dmix
# [bool (0/1)]: Halt on sigsegv to attach a debugger to the process
patch.sigsegv.halt_on_segv=0
# [str]: Print the log output to the specified file
util.log.file=pumptools.log
# [int]: Set the log level (0-4)
util.log.level=4
+50
View File
@@ -0,0 +1,50 @@
# [str]: Path to game settings (SETTINGS) folder
game.settings=./save
# [bool (0/1)]: Force game into window mode
patch.gfx.windowed=0
# [bool (0/1)]: Enable file call monitoring
patch.hook_mon.file=0
# [bool (0/1)]: Enable file system related call monitoring
patch.hook_mon.fs=0
# [bool (0/1)]: Enable IO syscall monitoring
patch.hook_mon.io=0
# [bool (0/1)]: Enable any file/IO open call monitoring
patch.hook_mon.open=0
# [bool (0/1)]: Enable libusb call monitoring
patch.hook_mon.usb=0
# [bool (0/1)]: Disable the built in keyboard inputs for test (F1), service (F2) and clear (F3)
patch.hook_main_loop.disable_built_in_inputs=0
# [str]: Path to a library implementing the x11-input-handler api to capture X11 keyboard inputs
patch_hook_main_loop.x11_input_handler=
# [str]: Address and port of pumpnet server (e.g. 127.0.0.1:1234)
patch.net_profile.server=
# [int]: Machine id for pumpnet
patch.net_profile.machine_id=0
# [str]: Path to library implementing the piuio api for piuio emulation
patch.piuio.emu_lib=
# [bool (0/1)]: Enable game exit on Test + Service
patch.piuio_exit.test_serv=0
# [str]: Select the sound device to open on snd_pcm_open
patch.sound.device=dmix
# [bool (0/1)]: Halt on sigsegv to attach a debugger to the process
patch.sigsegv.halt_on_segv=0
# [str]: Print the log output to the specified file
util.log.file=pumptools.log
# [int]: Set the log level (0-4)
util.log.level=4
+50
View File
@@ -0,0 +1,50 @@
# [str]: Path to game settings (SETTINGS) folder
game.settings=./save
# [bool (0/1)]: Force game into window mode
patch.gfx.windowed=0
# [bool (0/1)]: Enable file call monitoring
patch.hook_mon.file=0
# [bool (0/1)]: Enable file system related call monitoring
patch.hook_mon.fs=0
# [bool (0/1)]: Enable IO syscall monitoring
patch.hook_mon.io=0
# [bool (0/1)]: Enable any file/IO open call monitoring
patch.hook_mon.open=0
# [bool (0/1)]: Enable libusb call monitoring
patch.hook_mon.usb=0
# [bool (0/1)]: Disable the built in keyboard inputs for test (F1), service (F2) and clear (F3)
patch.hook_main_loop.disable_built_in_inputs=0
# [str]: Path to a library implementing the x11-input-handler api to capture X11 keyboard inputs
patch_hook_main_loop.x11_input_handler=
# [str]: Address and port of pumpnet server (e.g. 127.0.0.1:1234)
patch.net_profile.server=
# [int]: Machine id for pumpnet
patch.net_profile.machine_id=0
# [str]: Path to library implementing the piuio api for piuio emulation
patch.piuio.emu_lib=
# [bool (0/1)]: Enable game exit on Test + Service
patch.piuio_exit.test_serv=0
# [str]: Select the sound device to open on snd_pcm_open
patch.sound.device=dmix
# [bool (0/1)]: Halt on sigsegv to attach a debugger to the process
patch.sigsegv.halt_on_segv=0
# [str]: Print the log output to the specified file
util.log.file=pumptools.log
# [int]: Set the log level (0-4)
util.log.level=4
+62
View File
@@ -0,0 +1,62 @@
# [str]: Path to game settings (SETTINGS) folder
game.settings=./save
# [int]: Sync offset in ms
game.sync_offset=115
# [double]: Sync multiplier
game.sync_multiplier=4.166667
# [double]: Volume of music playback
game.music_vol=1.000000
# [double]: Volume of sound effects playback
game.sfx_vol=1.000000
# [bool (0/1)]: Enable this option when running 1st or 2nd. This uses different file system redirects for the game directory as well as enables a fix. Without this, the game throws errors about not finding files
game.1st_2nd_fs=0
# [bool (0/1)]: Force game into window mode
patch.gfx.windowed=0
# [bool (0/1)]: Enable file call monitoring
patch.hook_mon.file=0
# [bool (0/1)]: Enable file system related call monitoring
patch.hook_mon.fs=0
# [bool (0/1)]: Enable IO syscall monitoring
patch.hook_mon.io=0
# [bool (0/1)]: Enable any file/IO open call monitoring
patch.hook_mon.open=0
# [bool (0/1)]: Enable libusb call monitoring
patch.hook_mon.usb=0
# [bool (0/1)]: Disable the built in keyboard inputs for test (F1), service (F2) and clear (F3)
patch.hook_main_loop.disable_built_in_inputs=0
# [str]: Path to a library implementing the x11-input-handler api to capture X11 keyboard inputs
patch_hook_main_loop.x11_input_handler=
# [str]: Path to library implementing the piuio api for piuio emulation
patch.piuio.emu_lib=
# [bool (0/1)]: Enable game exit on Test + Service
patch.piuio_exit.test_serv=0
# [str]: Select the sound device to open on snd_pcm_open
patch.sound.device=
# [bool (0/1)]: Enable debug output for the fmod library. This requires you to use the fmodexL.so instead of the standard fmodex.so
patch.sound.debug_output=0
# [bool (0/1)]: Halt on sigsegv to attach a debugger to the process
patch.sigsegv.halt_on_segv=0
# [str]: Print the log output to the specified file
util.log.file=pumptools.log
# [int]: Set the log level (0-4)
util.log.level=4
+56
View File
@@ -0,0 +1,56 @@
# [str]: Path to game settings (SETTINGS) folder
game.settings=./save
# [bool (0/1)]: Force game into window mode
patch.gfx.windowed=0
# [bool (0/1)]: Enable file call monitoring
patch.hook_mon.file=0
# [bool (0/1)]: Enable file system related call monitoring
patch.hook_mon.fs=0
# [bool (0/1)]: Enable IO syscall monitoring
patch.hook_mon.io=0
# [bool (0/1)]: Enable any file/IO open call monitoring
patch.hook_mon.open=0
# [bool (0/1)]: Enable libusb call monitoring
patch.hook_mon.usb=0
# [bool (0/1)]: Disable the built in keyboard inputs for test (F1), service (F2) and clear (F3)
patch.hook_main_loop.disable_built_in_inputs=0
# [str]: Path to a library implementing the x11-input-handler api to capture X11 keyboard inputs
patch_hook_main_loop.x11_input_handler=
# [str]: Address and port of pumpnet server (e.g. 127.0.0.1:1234)
patch.net_profile.server=
# [int]: Machine id for pumpnet
patch.net_profile.machine_id=0
# [bool (0/1/)]: Enable verbose log output for pumpnet related things, e.g. logging network traffic
patch.net_profile.verbose_log_output=0
# [str]: Path to a folder containing the client key, certificate and CA bundle to enable https communication
patch.net_profile.cert_dir_path=
# [str]: Path to library implementing the piuio api for piuio emulation
patch.piuio.emu_lib=
# [bool (0/1)]: Enable game exit on Test + Service
patch.piuio_exit.test_serv=0
# [str]: Select the sound device to open on snd_pcm_open
patch.sound.device=dmix
# [bool (0/1)]: Halt on sigsegv to attach a debugger to the process
patch.sigsegv.halt_on_segv=0
# [str]: Print the log output to the specified file
util.log.file=pumptools.log
# [int]: Set the log level (0-4)
util.log.level=4
+50
View File
@@ -0,0 +1,50 @@
# [str]: Path to game settings (SETTINGS) folder
game.settings=./save
# [bool (0/1)]: Force game into window mode
patch.gfx.windowed=0
# [bool (0/1)]: Enable file call monitoring
patch.hook_mon.file=0
# [bool (0/1)]: Enable file system related call monitoring
patch.hook_mon.fs=0
# [bool (0/1)]: Enable IO syscall monitoring
patch.hook_mon.io=0
# [bool (0/1)]: Enable any file/IO open call monitoring
patch.hook_mon.open=0
# [bool (0/1)]: Enable libusb call monitoring
patch.hook_mon.usb=0
# [bool (0/1)]: Disable the built in keyboard inputs for test (F1), service (F2) and clear (F3)
patch.hook_main_loop.disable_built_in_inputs=0
# [str]: Path to a library implementing the x11-input-handler api to capture X11 keyboard inputs
patch_hook_main_loop.x11_input_handler=
# [str]: Address and port of pumpnet server (e.g. 127.0.0.1:1234)
patch.net_profile.server=
# [int]: Machine id for pumpnet
patch.net_profile.machine_id=0
# [str]: Path to library implementing the piuio api for piuio emulation
patch.piuio.emu_lib=
# [bool (0/1)]: Enable game exit on Test + Service
patch.piuio_exit.test_serv=0
# [str]: Select the sound device to open on snd_pcm_open
patch.sound.device=dmix
# [bool (0/1)]: Halt on sigsegv to attach a debugger to the process
patch.sigsegv.halt_on_segv=0
# [str]: Print the log output to the specified file
util.log.file=pumptools.log
# [int]: Set the log level (0-4)
util.log.level=4
+47
View File
@@ -0,0 +1,47 @@
# [bool (0/1)]: Force unlock the game. Modifies the current and any new PIUNX.INI settings file permanently
game.force_unlock=0
# [str]: Path to game settings (SETTINGS) folder
game.settings=./save
# [bool (0/1)]: Force game into window mode
patch.gfx.windowed=0
# [bool (0/1)]: Enable file call monitoring
patch.hook_mon.file=0
# [bool (0/1)]: Enable file system related call monitoring
patch.hook_mon.fs=0
# [bool (0/1)]: Enable IO syscall monitoring
patch.hook_mon.io=0
# [bool (0/1)]: Enable any file/IO open call monitoring
patch.hook_mon.open=0
# [bool (0/1)]: Enable libusb call monitoring
patch.hook_mon.usb=0
# [bool (0/1)]: Disable the built in keyboard inputs for test (F1), service (F2) and clear (F3)
patch.hook_main_loop.disable_built_in_inputs=0
# [str]: Path to a library implementing the x11-input-handler api to capture X11 keyboard inputs
patch_hook_main_loop.x11_input_handler=
# [str]: Path to library implementing the piuio api for piuio emulation
patch.piuio.emu_lib=
# [bool (0/1)]: Enable game exit on Test + Service
patch.piuio_exit.test_serv=0
# [str]: Select the sound device to open on snd_pcm_open
patch.sound.device=dmix
# [bool (0/1)]: Halt on sigsegv to attach a debugger to the process
patch.sigsegv.halt_on_segv=0
# [str]: Print the log output to the specified file
util.log.file=pumptools.log
# [int]: Set the log level (0-4)
util.log.level=4
+47
View File
@@ -0,0 +1,47 @@
# [str]: Path to game settings (SETTINGS) folder
game.settings=./save
# [bool (0/1)]: Force game into window mode
patch.gfx.windowed=0
# [bool (0/1)]: Enable file call monitoring
patch.hook_mon.file=0
# [bool (0/1)]: Enable file system related call monitoring
patch.hook_mon.fs=0
# [bool (0/1)]: Enable IO syscall monitoring
patch.hook_mon.io=0
# [bool (0/1)]: Enable any file/IO open call monitoring
patch.hook_mon.open=0
# [bool (0/1)]: Enable libusb call monitoring
patch.hook_mon.usb=0
# [bool (0/1)]: Disable the built in keyboard inputs for test (F1), service (PRI) and clear (F3)
patch.hook_main_loop.disable_built_in_inputs=0
# [str]: Path to a library implementing the x11-input-handler api to capture X11 keyboard inputs
patch_hook_main_loop.x11_input_handler=
# [str]: Address and port of pumpnet server (e.g. 127.0.0.1:1234)
patch.net.server=
# [str]: Path to library implementing the piuio api for piuio emulation
patch.piuio.emu_lib=
# [bool (0/1)]: Enable game exit on Test + Service
patch.piuio_exit.test_serv=0
# [str]: Select the sound device to open on snd_pcm_open
patch.sound.device=hw:0
# [bool (0/1)]: Halt on sigsegv to attach a debugger to the process
patch.sigsegv.halt_on_segv=0
# [str]: Print the log output to the specified file
util.log.file=pumptools.log
# [int]: Set the log level (0-4)
util.log.level=4
+38
View File
@@ -0,0 +1,38 @@
# [str]: Path to game data (game) folder
game.data=./game
# [bool (0/1)]: Enable file call monitoring
patch.hook_mon.file=0
# [bool (0/1)]: Enable file system related call monitoring
patch.hook_mon.fs=0
# [bool (0/1)]: Enable IO syscall monitoring
patch.hook_mon.io=0
# [bool (0/1)]: Enable any file/IO open call monitoring
patch.hook_mon.open=0
# [bool (0/1)]: Enable libusb call monitoring
patch.hook_mon.usb=0
# [str]: Path to library implementing the piubtn api for piubtn emulation
patch.piubtn.emu_lib=
# [str]: Path to library implementing the piuio api for piuio emulation
patch.piuio.emu_lib=
# [bool (0/1)]: Enable game exit on Test + Service
patch.piuio_exit.test_serv=0
# [str]: Path to a library implementing the x11-input-handler api to capture X11 keyboard inputs
patch_x11_event_loop.input_handler_lib=
# [str]: Path to a second library implementing the x11-input-handler api to capture X11 keyboard inputs
patch_x11_event_loop.input_handler_lib2=
# [str]: Print the log output to the specified file
util.log.file=pumptools.log
# [int]: Set the log level (0-4)
util.log.level=4
+50
View File
@@ -0,0 +1,50 @@
# [str]: Path to game data (game) folder
game.data=./game
# [str]: Path to game settings (data) folder
game.settings=./save
# [bool (0/1)]: Enable file call monitoring
patch.hook_mon.file=0
# [bool (0/1)]: Enable file system related call monitoring
patch.hook_mon.fs=0
# [bool (0/1)]: Enable IO syscall monitoring
patch.hook_mon.io=0
# [bool (0/1)]: Enable any file/IO open call monitoring
patch.hook_mon.open=0
# [bool (0/1)]: Enable libusb call monitoring
patch.hook_mon.usb=0
# [str]: Path to library implementing the piubtn api for piubtn emulation
patch.piubtn.emu_lib=
# [str]: Path to library implementing the piuio api for piuio emulation
patch.piuio.emu_lib=
# [bool (0/1)]: Enable game exit on Test + Service
patch.piuio_exit.test_serv=0
# [str]: Bus and port (format: X-X, e.g. 1-2) of the USB slot to assign to Player 1 when a USB thumb drive is plugged in
patch.usb_profile.p1.bus_port=
# [str]: Bus and port (format: X-X, e.g. 1-2) of the USB slot to assign to Player 2 when a USB thumb drive is plugged in
patch.usb_profile.p2.bus_port=
# [str]: Device nodes of plugged in USB thumb drives to consider for mounting for usb profiles, format: sdX,sdY e.g. sde,sdf
patch.usb_profile.dev_nodes=
# [str]: Path to a library implementing the x11-input-handler api to capture X11 keyboard inputs
patch_x11_event_loop.input_handler_lib=
# [str]: Path to a second library implementing the x11-input-handler api to capture X11 keyboard inputs
patch_x11_event_loop.input_handler_lib2=
# [str]: Print the log output to the specified file
util.log.file=pumptools.log
# [int]: Set the log level (0-4)
util.log.level=4
+47
View File
@@ -0,0 +1,47 @@
# [bool (0/1)]: Force unlock the game. Modifies the current and any new PIUEXCEED.INI settings file permanently
game.force_unlock=0
# [str]: Path to game settings (SETTINGS) folder
game.settings=./save
# [bool (0/1)]: Force game into window mode
patch.gfx.windowed=0
# [bool (0/1)]: Enable file call monitoring
patch.hook_mon.file=0
# [bool (0/1)]: Enable file system related call monitoring
patch.hook_mon.fs=0
# [bool (0/1)]: Enable IO syscall monitoring
patch.hook_mon.io=0
# [bool (0/1)]: Enable any file/IO open call monitoring
patch.hook_mon.open=0
# [bool (0/1)]: Enable libusb call monitoring
patch.hook_mon.usb=0
# [bool (0/1)]: Disable the built in keyboard inputs for test (F1), service (F2) and clear (F3)
patch.hook_main_loop.disable_built_in_inputs=0
# [str]: Path to a library implementing the x11-input-handler api to capture X11 keyboard inputs
patch_hook_main_loop.x11_input_handler=
# [str]: Path to library implementing the piuio api for piuio emulation
patch.piuio.emu_lib=
# [bool (0/1)]: Enable game exit on Test + Service
patch.piuio_exit.test_serv=0
# [str]: Select the sound device to open on snd_pcm_open
patch.sound.device=dmix
# [bool (0/1)]: Halt on sigsegv to attach a debugger to the process
patch.sigsegv.halt_on_segv=0
# [str]: Print the log output to the specified file
util.log.file=pumptools.log
# [int]: Set the log level (0-4)
util.log.level=4
+47
View File
@@ -0,0 +1,47 @@
# [bool (0/1)]: Force unlock the game. Modifies the current and any new PIUZERO.INI settings file permanently
game.force_unlock=0
# [str]: Path to game settings (SETTINGS) folder
game.settings=./save
# [bool (0/1)]: Force game into window mode
patch.gfx.windowed=0
# [bool (0/1)]: Enable file call monitoring
patch.hook_mon.file=0
# [bool (0/1)]: Enable file system related call monitoring
patch.hook_mon.fs=0
# [bool (0/1)]: Enable IO syscall monitoring
patch.hook_mon.io=0
# [bool (0/1)]: Enable any file/IO open call monitoring
patch.hook_mon.open=0
# [bool (0/1)]: Enable libusb call monitoring
patch.hook_mon.usb=0
# [bool (0/1)]: Disable the built in keyboard inputs for test (F1), service (F2) and clear (F3)
patch.hook_main_loop.disable_built_in_inputs=0
# [str]: Path to a library implementing the x11-input-handler api to capture X11 keyboard inputs
patch_hook_main_loop.x11_input_handler=
# [str]: Path to library implementing the piuio api for piuio emulation
patch.piuio.emu_lib=
# [bool (0/1)]: Enable game exit on Test + Service
patch.piuio_exit.test_serv=0
# [str]: Select the sound device to open on snd_pcm_open
patch.sound.device=dmix
# [bool (0/1)]: Halt on sigsegv to attach a debugger to the process
patch.sigsegv.halt_on_segv=0
# [str]: Print the log output to the specified file
util.log.file=pumptools.log
# [int]: Set the log level (0-4)
util.log.level=4
Vendored Executable
+407
View File
@@ -0,0 +1,407 @@
#!/usr/bin/env bash
###
# Pump It Up Environment Bootstrap (piueb)
#
# This script sets up an environment to run all (MK5/6) Linux based PIU games as well as the MK3 linux ports.
# It takes care of the following tasks:
# - Check if all necessary files and directories are available
# - Verify that local dependencies for the game are used
# - Force the game into VSYNC
# - Bootstrap the application executable with:
# - A a subset of local libs or even a private ld-linux to ensure highest compatibility accross distros
# - A pumptools hook.so
#
# Therefore, this script expects the following folder structure and naming (!) to run the game:
# - game: The game folder with vanilla assets
# - lib: All (additional) dependencies the game needs to run
# - (save): Depending on your hook configuration, this can be located somewhere else, too
# - hook.conf: Configuration file with hook specific settings
# - hook.so: The game specific hook library compiled from pumptools
# - piu: The game's executable
# - piueb: This script
#
# To get usage/help output from piueb:
# ./piueb help
#
# To run the game, simply run this script with the "run" command:
# ./piueb run
#
# Additional arguments to hook.so are also supported:
# ./piueb run arg1 arg2
#
# For example, to get help/usage output from the hook library:
# ./piueb run -h
#
# For debugging purpose, a log file (piueb.log) is written to the folder this script is in.
###
readonly VERSION="1.0"
readonly LOG_LEVEL_ERROR="E"
readonly LOG_LEVEL_WARN="W"
readonly LOG_LEVEL_INFO="I"
readonly LOG_LEVEL_DEBUG="M"
##################################################################################
SELF_DIR="$(dirname "$(readlink -f "$0")")"
LOG_FILE="$SELF_DIR/piueb.log"
GAME_EXEC="$SELF_DIR/piu"
GAME_DIR="$SELF_DIR/game"
LIBS_DIR="$SELF_DIR/lib"
HOOK_FILE="$SELF_DIR/hook.so"
HOOK_CONFIG_FILE="$SELF_DIR/hook.conf"
LIBS_LINKER="$SELF_DIR/lib/ld-linux.so.2"
##################################################################################
log_init()
{
rm -f "$LOG_FILE"
}
log()
{
local level="$1"
local msg="$2"
local timestamp="$(date "+%Y/%m/%d-%H:%M:%S:%3N")"
local color=""
case $level in
$LOG_LEVEL_ERROR)
color="\e[1m\e[31m"
;;
$LOG_LEVEL_WARN)
color="\e[33m"
;;
$LOG_LEVEL_INFO)
color="\e[34m"
;;
$LOG_LEVEL_DEBUG)
color="\e[37m"
;;
esac
echo -e "${color}[$level]\e[0m[$timestamp] ${msg}"
echo "[$level][$timestamp] ${msg}" >> "$LOG_FILE"
}
log_error()
{
log "$LOG_LEVEL_ERROR" "$@"
}
log_warn()
{
log "$LOG_LEVEL_WARN" "$@"
}
log_info()
{
log "$LOG_LEVEL_INFO" "$@"
}
log_debug()
{
log "$LOG_LEVEL_DEBUG" "$@"
}
verify_running_as_root()
{
log_debug "Verify running as root user/with sudo..."
if [ "$EUID" -ne 0 ]; then
log_error "Running as non-root user, game likely to crash!"
fi
}
verify_file_exists()
{
local file_path="$1"
local warn_only="$2"
log_debug "Verify file/dir exists $file_path..."
if [ ! -e "$file_path" ]; then
if [ "$warn_only" ]; then
log_warn "Missing file \"$file_path\""
else
log_error "Missing required file \"$file_path\""
exit 1
fi
fi
}
verify_dir_not_empty()
{
local dir_path="$1"
if [ -z "$(ls -A $dir_path)" ]; then
log_error "Directory empty: $dir_path"
exit 1
fi
}
verify_deps_all_local()
{
local exec_path="$1"
local lib_path="$2"
local ldd_output="$(ldd $exec_path >&1)"
log_debug "Verify dependencies all local..."
log_debug "ldd output for $exec_path:\\n$ldd_output"
while read -r line; do
# Skip any additional output/error messages that are not part of the library listing
if [[ "$line:0:1" != "\t" ]]; then
continue
fi
local libname="$(echo "$line" | cut -d '.' -f 1)"
local libpath="$(echo "$line" | cut -d ' ' -f 3)"
# Skip a bunch of libs that are kernel specific like bound to GPU drivers
case $libname in
"linux-gate") ;& # fallthrough
"libGL") ;& # fallthrough
"libGLX") ;& # fallthrough
"libGLdispatch") ;& # fallthrough
# That will still point to the current machine's linker
# but we will use our own further down to bootstrap the elf
"ld-linux") ;& # fallthrough
"/lib/ld-linux")
log_debug "Skipping $libname"
continue
;;
*)
;;
esac
log_debug "Checking $libname: $libpath..."
if [[ $libpath != $LIBS_DIR* ]]; then
log_warn "$libname is not local to the game, path $libpath"
fi
done <<< "$ldd_output"
}
verify_game_executable()
{
local exec_path="$1"
log_debug "Verifying that game is executable: $exec_path..."
if [ ! -x "$exec_path" ]; then
log_warn "Game exec $exec_path not executable, fixing..."
chmod +x "$exec_path"
fi
}
print_usage()
{
echo "Pump It Up Environment Bootstrap (piueb), version $VERSION"
echo "Easily bootstrap linux based Pump games using pumptools."
echo "Usage: piueb <cmd> ..."
echo "Commands:"
echo " run - Run the game located next to this script"
echo " strace - Run the game with local libraries and strace attached for debugging"
echo " debug - Run the game with local libraries and a GDB debugger server attached for debugging"
echo " help - Print this usage message"
}
# Supports native mk6 linux games as well as the mk3 linux ports using mk3hook
cmd_run()
{
local mode="$1"
log_init
log_info "Pump It Up Environment Bootstrap (piueb), version $VERSION"
verify_running_as_root
log_info "Current path: $SELF_DIR"
log_debug "File and path verification..."
# Some file and folder verfication
verify_file_exists "$GAME_EXEC"
verify_file_exists "$GAME_DIR"
verify_dir_not_empty "$GAME_DIR"
verify_file_exists "$LIBS_DIR"
verify_dir_not_empty "$LIBS_DIR"
verify_file_exists "$HOOK_FILE"
# Only warn to allow creating of default hook.conf if no file exists
verify_file_exists "$HOOK_CONFIG_FILE" 1
# Support two modes of setting up the runtime environment with the game's
# dependencies:
# 1. Using a separate linker application which might be necessary when having
# to run the application with different libc (and/or other library) versions.
# This avoids incompatibilities with newer libc runtime and ld-linux versions
# (see f2-crashing-on-modern-linux-post-mortem.md).
#
# 2. Use only a subset of local libraries and take everything else from the
# current system. Your typical LD_LIBRARY_PATH method.
local lib_mode=""
if [ -e "$LIBS_LINKER" ]; then
lib_mode="ld"
else
lib_mode="local"
fi
log_info "Resolving dependencies mode: $lib_mode"
# LD_LIBRARY_PATH setup to use local libraries instead of system ones
if [ -z "$LD_LIBRARY_PATH" ]; then
LD_LIBRARY_PATH="$LIBS_DIR"
else
LD_LIBRARY_PATH="$LIBS_DIR:$LD_LIBRARY_PATH"
fi
log_debug "LD_LIBRARY_PATH: $LD_LIBRARY_PATH"
# Required that ldd shows us the correct paths
export LD_LIBRARY_PATH
# Check if all dependencies used are actually bundled with the game
verify_deps_all_local "$GAME_EXEC" "$LIBS_DIR"
local LD_PRELOAD="$HOOK_FILE"
local ldd_output_hook="$(ldd $HOOK_FILE >&1)"
log_debug "ldd output for $HOOK_FILE:\\n$ldd_output_hook"
if [ "${*:1}" ]; then
log_info "Additional cmd arguments provided: ${*:1}"
fi
log_info "Executing game $GAME_EXEC, mode $mode, lib_mode $lib_mode...\n=============================================================================================================================="
# Because people forget this when setting up the data manually
chmod +x "$GAME_EXEC"
# Force the game to run to vsync blank interval for nvidia cards: __GL_SYNC_TO_VBLANK=1
if [ "$mode" = "normal" ] && [ "$lib_mode" = "ld" ]; then
# / after GAME_DIR required
# Use private linker to avoid platform incompatibility issues (see above)
exec \
env __GL_SYNC_TO_VBLANK=1 \
env LD_PRELOAD="$LD_PRELOAD" \
"$LIBS_LINKER" \
--library-path "$LD_LIBRARY_PATH" \
"$GAME_EXEC" \
"${GAME_DIR}/" \
"--options" "$HOOK_CONFIG_FILE" \
"${@:2}"
elif [ "$mode" = "normal" ] && [ "$lib_mode" = "local" ]; then
# / after GAME_DIR required
exec \
env __GL_SYNC_TO_VBLANK=1 \
env LD_LIBRARY_PATH="$LD_LIBRARY_PATH" \
env LD_PRELOAD="$LD_PRELOAD" \
"$GAME_EXEC" \
"${GAME_DIR}/" \
"--options" "$HOOK_CONFIG_FILE" \
"${@:2}"
elif [ "$mode" = "debug" ] && [ "$lib_mode" = "ld" ]; then
log_error "debug mode with lib type ld not supported"
elif [ "$mode" = "debug" ] && [ "$lib_mode" = "local" ]; then
gdbserver \
--wrapper \
env \
__GL_SYNC_TO_VBLANK=1 \
LD_LIBRARY_PATH="$LD_LIBRARY_PATH" \
LD_PRELOAD="$LD_PRELOAD" \
-- 0.0.0.0:1234 \
"$GAME_EXEC" \
"${GAME_DIR}/" \
"--options" "$HOOK_CONFIG_FILE" \
"${@:2}"
elif [ "$mode" = "strace" ] && [ "$lib_mode" = "ld" ]; then
log_error "strace mode with lib type ld not supported"
elif [ "$mode" = "strace" ] && [ "$lib_mode" = "local" ]; then
strace \
-E __GL_SYNC_TO_VBLANK=1 \
-E LD_LIBRARY_PATH="$LD_LIBRARY_PATH" \
-E LD_PRELOAD="$LD_PRELOAD" \
"$GAME_EXEC" \
"${GAME_DIR}/" \
"--options" "$HOOK_CONFIG_FILE" \
"${@:2}"
elif [ "$mode" = "valgrind" ] && [ "$lib_mode" = "ld" ]; then
log_error "valgrind mode with lib type ld not supported"
elif [ "$mode" = "valgrind" ] && [ "$lib_mode" = "local" ]; then
valgrind \
--trace-children=yes \
env \
__GL_SYNC_TO_VBLANK=1 \
LD_LIBRARY_PATH="$LD_LIBRARY_PATH" \
LD_PRELOAD="$LD_PRELOAD" \
"$GAME_EXEC" \
"${GAME_DIR}/" \
"--options" "$HOOK_CONFIG_FILE" \
"${@:2}"
else
log_error "Unsupported mode ($mode) or lib_mode (($lib_mode)"
fi
}
cmd_help()
{
print_usage
}
##################################################################################
CMD="$1"
case $CMD in
"")
echo "Insufficient arguments."
print_usage
exit 1
;;
"help")
cmd_help
exit 0
;;
"run")
cmd_run "normal" "${@:2}"
exit 0
;;
"debug")
cmd_run "debug" "${@:2}"
exit 0
;;
"strace")
cmd_run "strace" "${@:2}"
exit 0
;;
"valgrind")
cmd_run "valgrind" "${@:2}"
exit 0
;;
*)
echo "Invalid command."
print_usage
exit 1
;;
esac