1
0
mirror of https://github.com/pumpitupdev/pumptools.git synced 2024-11-23 22:50:56 +01:00

Code format

This commit is contained in:
icex2 2023-03-02 19:09:18 +01:00
parent e25d52c293
commit 94529e1e04
26 changed files with 166 additions and 143 deletions

View File

@ -45,7 +45,10 @@ static const struct util_options_def exchook_options_def[] = {
},
{
.name = EXCHOOK_OPTIONS_STR_PATCH_GFX_SCALING_MODE,
.description = "Set a scaling mode for the rendered output. Available modes: 0 = disabled, 1 = SD 480 to pillarbox HD 720, 2 = SD 480 to pillarbox HD 1080, 3 = SD 480 to SD 960, 4 = HD 720 to HD 1080",
.description =
"Set a scaling mode for the rendered output. Available modes: 0 = "
"disabled, 1 = SD 480 to pillarbox HD 720, 2 = SD 480 to pillarbox "
"HD 1080, 3 = SD 480 to SD 960, 4 = HD 720 to HD 1080",
.param = 'z',
.type = UTIL_OPTIONS_TYPE_INT,
.is_secret_data = false,

View File

@ -36,7 +36,10 @@ const struct util_options_def f2hook_options_def[] = {
},
{
.name = F2HOOK_OPTIONS_STR_PATCH_GFX_SCALING_MODE,
.description = "Set a scaling mode for the rendered output. Available modes: 0 = disabled, 1 = SD 480 to pillarbox HD 720, 2 = SD 480 to pillarbox HD 1080, 3 = SD 480 to SD 960, 4 = HD 720 to HD 1080",
.description =
"Set a scaling mode for the rendered output. Available modes: 0 = "
"disabled, 1 = SD 480 to pillarbox HD 720, 2 = SD 480 to pillarbox "
"HD 1080, 3 = SD 480 to SD 960, 4 = HD 720 to HD 1080",
.param = 'z',
.type = UTIL_OPTIONS_TYPE_INT,
.is_secret_data = false,

View File

@ -36,7 +36,10 @@ const struct util_options_def fexhook_options_def[] = {
},
{
.name = FEXHOOK_OPTIONS_STR_PATCH_GFX_SCALING_MODE,
.description = "Set a scaling mode for the rendered output. Available modes: 0 = disabled, 1 = SD 480 to pillarbox HD 720, 2 = SD 480 to pillarbox HD 1080, 3 = SD 480 to SD 960, 4 = HD 720 to HD 1080",
.description =
"Set a scaling mode for the rendered output. Available modes: 0 = "
"disabled, 1 = SD 480 to pillarbox HD 720, 2 = SD 480 to pillarbox "
"HD 1080, 3 = SD 480 to SD 960, 4 = HD 720 to HD 1080",
.param = 'z',
.type = UTIL_OPTIONS_TYPE_INT,
.is_secret_data = false,

View File

@ -36,7 +36,10 @@ const struct util_options_def fsthook_options_def[] = {
},
{
.name = FSTHOOK_OPTIONS_STR_PATCH_GFX_SCALING_MODE,
.description = "Set a scaling mode for the rendered output. Available modes: 0 = disabled, 1 = SD 480 to pillarbox HD 720, 2 = SD 480 to pillarbox HD 1080, 3 = SD 480 to SD 960, 4 = HD 720 to HD 1080",
.description =
"Set a scaling mode for the rendered output. Available modes: 0 = "
"disabled, 1 = SD 480 to pillarbox HD 720, 2 = SD 480 to pillarbox "
"HD 1080, 3 = SD 480 to SD 960, 4 = HD 720 to HD 1080",
.param = 'z',
.type = UTIL_OPTIONS_TYPE_INT,
.is_secret_data = false,

View File

@ -35,7 +35,10 @@ static const struct util_options_def nxhook_options_def[] = {
},
{
.name = NXHOOK_OPTIONS_STR_PATCH_GFX_SCALING_MODE,
.description = "Set a scaling mode for the rendered output. Available modes: 0 = disabled, 1 = SD 480 to pillarbox HD 720, 2 = SD 480 to pillarbox HD 1080, 3 = SD 480 to SD 960, 4 = HD 720 to HD 1080",
.description =
"Set a scaling mode for the rendered output. Available modes: 0 = "
"disabled, 1 = SD 480 to pillarbox HD 720, 2 = SD 480 to pillarbox "
"HD 1080, 3 = SD 480 to SD 960, 4 = HD 720 to HD 1080",
.param = 'z',
.type = UTIL_OPTIONS_TYPE_INT,
.is_secret_data = false,

View File

@ -40,7 +40,10 @@ const struct util_options_def nx2hook_options_def[] = {
},
{
.name = NX2HOOK_OPTIONS_STR_PATCH_GFX_SCALING_MODE,
.description = "Set a scaling mode for the rendered output. Available modes: 0 = disabled, 1 = SD 480 to pillarbox HD 720, 2 = SD 480 to pillarbox HD 1080, 3 = SD 480 to SD 960, 4 = HD 720 to HD 1080",
.description =
"Set a scaling mode for the rendered output. Available modes: 0 = "
"disabled, 1 = SD 480 to pillarbox HD 720, 2 = SD 480 to pillarbox "
"HD 1080, 3 = SD 480 to SD 960, 4 = HD 720 to HD 1080",
.param = 'z',
.type = UTIL_OPTIONS_TYPE_INT,
.is_secret_data = false,

View File

@ -40,7 +40,10 @@ const struct util_options_def nxahook_options_def[] = {
},
{
.name = NXAHOOK_OPTIONS_STR_PATCH_GFX_SCALING_MODE,
.description = "Set a scaling mode for the rendered output. Available modes: 0 = disabled, 1 = SD 480 to pillarbox HD 720, 2 = SD 480 to pillarbox HD 1080, 3 = SD 480 to SD 960, 4 = HD 720 to HD 1080",
.description =
"Set a scaling mode for the rendered output. Available modes: 0 = "
"disabled, 1 = SD 480 to pillarbox HD 720, 2 = SD 480 to pillarbox "
"HD 1080, 3 = SD 480 to SD 960, 4 = HD 720 to HD 1080",
.param = 'z',
.type = UTIL_OPTIONS_TYPE_INT,
.is_secret_data = false,

View File

@ -1,8 +1,8 @@
#define LOG_MODULE "patch-gfx"
#include <GL/gl.h>
#include <X11/Xutil.h>
#include <stdbool.h>
#include <GL/gl.h>
// OpenGL 3.x+
#include <GL/glx.h>
@ -165,8 +165,11 @@ void patch_gfx_init()
log_info("Initialized");
}
// Note, consider improving scaling, see http://www.david-amador.com/2013/04/opengl-2d-independent-resolution-rendering/
// Note, consider improving scaling, see
// http://www.david-amador.com/2013/04/opengl-2d-independent-resolution-rendering/
void patch_gfx_scale(enum patch_gfx_scale_mode scale_mode)
{
log_error("GFX scaling enabled but will not work. Temporarily removed due to issues with loading libGL.so");
log_error(
"GFX scaling enabled but will not work. Temporarily removed due to "
"issues with loading libGL.so");
}

View File

@ -468,9 +468,7 @@ static bool _patch_net_profile_download_profile_file(
virtual_file->buffer,
virtual_file->file_info->file_size)) {
log_error(
"Downloading file player %d, file_type %d, failed",
player,
file_type);
"Downloading file player %d, file_type %d, failed", player, file_type);
return false;
}
@ -536,16 +534,12 @@ static bool _patch_net_profile_upload_profile_file(
virtual_file->buffer,
virtual_file->file_info->file_size)) {
log_error(
"Uploading file player %d, file_type %d, failed",
player,
file_type);
"Uploading file player %d, file_type %d, failed", player, file_type);
return false;
}
log_info(
"Uploading file player %d, file_type %d, successful",
player,
file_type);
"Uploading file player %d, file_type %d, successful", player, file_type);
return true;
}
@ -641,10 +635,7 @@ void patch_net_profile_init(
pthread_mutex_init(&_patch_net_profile_mutex, NULL);
log_info(
"Initialized: game %d, server %s",
game,
pumpnet_server_addr);
log_info("Initialized: game %d, server %s", game, pumpnet_server_addr);
}
void patch_net_profile_shutdown()

View File

@ -34,7 +34,10 @@ const struct util_options_def prihook_options_def[] = {
},
{
.name = PRIHOOK_OPTIONS_STR_PATCH_GFX_SCALING_MODE,
.description = "Set a scaling mode for the rendered output. Available modes: 0 = disabled, 1 = SD 480 to pillarbox HD 720, 2 = SD 480 to pillarbox HD 1080, 3 = SD 480 to SD 960, 4 = HD 720 to HD 1080",
.description =
"Set a scaling mode for the rendered output. Available modes: 0 = "
"disabled, 1 = SD 480 to pillarbox HD 720, 2 = SD 480 to pillarbox "
"HD 1080, 3 = SD 480 to SD 960, 4 = HD 720 to HD 1080",
.param = 'z',
.type = UTIL_OPTIONS_TYPE_INT,
.is_secret_data = false,

View File

@ -43,7 +43,10 @@ static const struct util_options_def x2hook_options_def[] = {
},
{
.name = X2HOOK_OPTIONS_STR_PATCH_GFX_SCALING_MODE,
.description = "Set a scaling mode for the rendered output. Available modes: 0 = disabled, 1 = SD 480 to pillarbox HD 720, 2 = SD 480 to pillarbox HD 1080, 3 = SD 480 to SD 960, 4 = HD 720 to HD 1080",
.description =
"Set a scaling mode for the rendered output. Available modes: 0 = "
"disabled, 1 = SD 480 to pillarbox HD 720, 2 = SD 480 to pillarbox "
"HD 1080, 3 = SD 480 to SD 960, 4 = HD 720 to HD 1080",
.param = 'z',
.type = UTIL_OPTIONS_TYPE_INT,
.is_secret_data = false,

View File

@ -43,7 +43,10 @@ static const struct util_options_def zerohook_options_def[] = {
},
{
.name = ZEROHOOK_OPTIONS_STR_PATCH_GFX_SCALING_MODE,
.description = "Set a scaling mode for the rendered output. Available modes: 0 = disabled, 1 = SD 480 to pillarbox HD 720, 2 = SD 480 to pillarbox HD 1080, 3 = SD 480 to SD 960, 4 = HD 720 to HD 1080",
.description =
"Set a scaling mode for the rendered output. Available modes: 0 = "
"disabled, 1 = SD 480 to pillarbox HD 720, 2 = SD 480 to pillarbox "
"HD 1080, 3 = SD 480 to SD 960, 4 = HD 720 to HD 1080",
.param = 'z',
.type = UTIL_OPTIONS_TYPE_INT,
.is_secret_data = false,

View File

@ -182,18 +182,13 @@ int32_t io_usb_control_transfer(
}
int32_t io_usb_interrupt_transfer(
void *handle,
int ep,
uint8_t *data,
uint16_t len,
uint32_t timeout)
void *handle, int ep, uint8_t *data, uint16_t len, uint32_t timeout)
{
struct usb_io_ctx *dev = (struct usb_io_ctx *) handle;
int32_t ret, transferred;
ret =
libusb_interrupt_transfer(
dev->dev, ep, data, len, &transferred, timeout);
libusb_interrupt_transfer(dev->dev, ep, data, len, &transferred, timeout);
if (transferred != len) {
log_error(

View File

@ -54,11 +54,7 @@ int32_t io_usb_control_transfer(
* @return Number of bytes read/written or -1 on error
*/
int32_t io_usb_interrupt_transfer(
void *handle,
int ep,
uint8_t *data,
uint16_t len,
uint32_t timeout);
void *handle, int ep, uint8_t *data, uint16_t len, uint32_t timeout);
/**
* Close a opened usb device
*

View File

@ -1,7 +1,8 @@
/**
* Communicate with the Andamiro "lxio" or ATMEGAPUMP or PIU HID.
* This device hosts all data in two address, and interrupt in and out.
* Device needs to be written then read in that order. Every read needs a preceding write.
* Device needs to be written then read in that order. Every read needs a
* preceding write.
*/
#define LOG_MODULE "ptapi-io-piuio-lxio"
@ -13,8 +14,8 @@
#include "util/log.h"
#include "ptapi/io/piuio.h"
#include "ptapi/io/piubtn.h"
#include "ptapi/io/piuio.h"
// Data going to/from lxio
uint8_t lxio_btn_state_buffer[LXIO_MSG_SIZE];
@ -135,7 +136,6 @@ static void convert_input_to_piuio()
ptapi_piuio_sys.clear = lxio_btn_state_buffer[8] & (1 << 7);
ptapi_piuio_sys.coin = lxio_btn_state_buffer[8] & (1 << 2);
ptapi_piuio_sys.coin2 = lxio_btn_state_buffer[9] & (1 << 2);
}
bool ptapi_io_piuio_recv(void)
@ -236,11 +236,12 @@ bool ptapi_io_piubtn_send(void)
return true;
}
void ptapi_io_piubtn_get_input(uint8_t player, struct ptapi_io_piubtn_inputs* inputs)
void ptapi_io_piubtn_get_input(
uint8_t player, struct ptapi_io_piubtn_inputs *inputs)
{
// Note: There could be consistancy issues if the two IOs are threaded by seperate threads
// Decided to take the risk of potentially lost button inputs. Testing has yielded
// good results.
// Note: There could be consistancy issues if the two IOs are threaded by
// seperate threads Decided to take the risk of potentially lost button
// inputs. Testing has yielded good results.
// Set all inputs to off
if (player == 0) {
@ -262,7 +263,11 @@ void ptapi_io_piubtn_get_input(uint8_t player, struct ptapi_io_piubtn_inputs* in
}
}
void ptapi_io_piubtn_set_output(uint8_t player, const struct ptapi_io_piubtn_outputs* outputs)
void ptapi_io_piubtn_set_output(
uint8_t player, const struct ptapi_io_piubtn_outputs *outputs)
{
memcpy(&ptapi_piubtn_out[player], outputs, sizeof(struct ptapi_io_piubtn_outputs));
memcpy(
&ptapi_piubtn_out[player],
outputs,
sizeof(struct ptapi_io_piubtn_outputs));
}

View File

@ -648,7 +648,10 @@ static bool util_options_init_from_file(
options->defs->defs[j].param,
options->defs->defs[j].name,
options->defs->defs[j].type,
val ? (options->defs->defs[j].is_secret_data ? "[REDACTED-SECRET]" : val) : "NULL");
val ?
(options->defs->defs[j].is_secret_data ? "[REDACTED-SECRET]" :
val) :
"NULL");
options->values[j].avail = true;
break;