mirror of
https://github.com/pumpitupdev/pumptools.git
synced 2025-02-17 10:58:36 +01:00
nxahook: Support pumpnet
This commit is contained in:
parent
7d03f6b7dc
commit
b2bbf8981d
@ -16,4 +16,4 @@ add_library(${PROJECT_NAME} SHARED ${SOURCE_FILES} ${HDD_RAW} ${DOG_KEY})
|
|||||||
set_target_properties(${PROJECT_NAME} PROPERTIES LINK_FLAGS "-fPIC")
|
set_target_properties(${PROJECT_NAME} PROPERTIES LINK_FLAGS "-fPIC")
|
||||||
set_target_properties(${PROJECT_NAME} PROPERTIES PREFIX "")
|
set_target_properties(${PROJECT_NAME} PROPERTIES PREFIX "")
|
||||||
|
|
||||||
target_link_libraries(${PROJECT_NAME} asset-nxa crypt hook-core microdog40 patch ptapi-io-piuio-util util dl pthread)
|
target_link_libraries(${PROJECT_NAME} asset-nxa crypt hook-core microdog40 patch ptapi-io-piuio-util pumpnet-lib util dl pthread curl)
|
6
dist/conf/nxahook.conf
vendored
6
dist/conf/nxahook.conf
vendored
@ -31,6 +31,12 @@ patch.net_profile.server=
|
|||||||
# [int]: Machine id for pumpnet
|
# [int]: Machine id for pumpnet
|
||||||
patch.net_profile.machine_id=0000000000000000
|
patch.net_profile.machine_id=0000000000000000
|
||||||
|
|
||||||
|
# [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
|
# [str]: Path to library implementing the piuio api for piuio emulation
|
||||||
patch.piuio.emu_lib=
|
patch.piuio.emu_lib=
|
||||||
|
|
||||||
|
@ -16,6 +16,7 @@
|
|||||||
#include "hook/patch/main-loop.h"
|
#include "hook/patch/main-loop.h"
|
||||||
#include "hook/patch/microdog40.h"
|
#include "hook/patch/microdog40.h"
|
||||||
#include "hook/patch/mounts.h"
|
#include "hook/patch/mounts.h"
|
||||||
|
#include "hook/patch/net-profile.h"
|
||||||
#include "hook/patch/piuio-exit.h"
|
#include "hook/patch/piuio-exit.h"
|
||||||
#include "hook/patch/piuio.h"
|
#include "hook/patch/piuio.h"
|
||||||
#include "hook/patch/redir.h"
|
#include "hook/patch/redir.h"
|
||||||
@ -280,6 +281,18 @@ static void nxahook_patch_profile()
|
|||||||
nxahook_profile_gen_init();
|
nxahook_profile_gen_init();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void nxahook_patch_pumpnet(struct nxahook_options *options)
|
||||||
|
{
|
||||||
|
if (options->patch.net.server && options->patch.net.machine_id != 0) {
|
||||||
|
patch_net_profile_init(
|
||||||
|
ASSET_GAME_VERSION_NXA,
|
||||||
|
options->patch.net.server,
|
||||||
|
options->patch.net.machine_id,
|
||||||
|
options->patch.net.cert_dir_path,
|
||||||
|
options->patch.net.verbose_log_output);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void nxahook_constructor(void)
|
void nxahook_constructor(void)
|
||||||
{
|
{
|
||||||
/* Nothing here */
|
/* Nothing here */
|
||||||
@ -309,6 +322,11 @@ void nxahook_trap_before_main(int argc, char **argv)
|
|||||||
nxahook_patch_dongle_init();
|
nxahook_patch_dongle_init();
|
||||||
nxahook_patch_hdd_check_init();
|
nxahook_patch_hdd_check_init();
|
||||||
nxahook_patch_piuio_init(&options);
|
nxahook_patch_piuio_init(&options);
|
||||||
|
// Init order of pumpnet and auto profile generating important: pumpnet hook,
|
||||||
|
// if active, needs to be applied before the auto gen profile hook. Otherwise,
|
||||||
|
// the game detects that no profile is available and auto generates one even
|
||||||
|
// it should take the pumpnet route to grab a profile from a remote server
|
||||||
|
nxahook_patch_pumpnet(&options);
|
||||||
nxahook_patch_profile();
|
nxahook_patch_profile();
|
||||||
|
|
||||||
free(game_data_path);
|
free(game_data_path);
|
||||||
@ -318,6 +336,7 @@ void nxahook_trap_before_main(int argc, char **argv)
|
|||||||
|
|
||||||
void nxahook_trap_after_main(void)
|
void nxahook_trap_after_main(void)
|
||||||
{
|
{
|
||||||
|
patch_net_profile_shutdown();
|
||||||
patch_piuio_shutdown();
|
patch_piuio_shutdown();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -16,6 +16,10 @@
|
|||||||
#define NXAHOOK_OPTIONS_STR_PATCH_NET_PROFILE_SERVER "patch.net_profile.server"
|
#define NXAHOOK_OPTIONS_STR_PATCH_NET_PROFILE_SERVER "patch.net_profile.server"
|
||||||
#define NXAHOOK_OPTIONS_STR_PATCH_NET_PROFILE_MACHINE_ID \
|
#define NXAHOOK_OPTIONS_STR_PATCH_NET_PROFILE_MACHINE_ID \
|
||||||
"patch.net_profile.machine_id"
|
"patch.net_profile.machine_id"
|
||||||
|
#define NXAHOOK_OPTIONS_STR_PATCH_NET_PROFILE_VERBOSE_LOG_OUTPUT \
|
||||||
|
"patch.net_profile.verbose_log_output"
|
||||||
|
#define NXAHOOK_OPTIONS_STR_PATCH_NET_PROFILE_CERT_DIR_PATH \
|
||||||
|
"patch.net_profile.cert_dir_path"
|
||||||
#define NXAHOOK_OPTIONS_STR_PATCH_PIUIO_EMU_LIB "patch.piuio.emu_lib"
|
#define NXAHOOK_OPTIONS_STR_PATCH_PIUIO_EMU_LIB "patch.piuio.emu_lib"
|
||||||
#define NXAHOOK_OPTIONS_STR_PATCH_PIUIO_EXIT_TEST_SERV \
|
#define NXAHOOK_OPTIONS_STR_PATCH_PIUIO_EXIT_TEST_SERV \
|
||||||
"patch.piuio_exit.test_serv"
|
"patch.piuio_exit.test_serv"
|
||||||
@ -118,6 +122,25 @@ const struct util_options_def nxahook_options_def[] = {
|
|||||||
.is_secret_data = true,
|
.is_secret_data = true,
|
||||||
.default_value.str = "0000000000000000",
|
.default_value.str = "0000000000000000",
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
.name = NXAHOOK_OPTIONS_STR_PATCH_NET_PROFILE_VERBOSE_LOG_OUTPUT,
|
||||||
|
.description = "Enable verbose log output for pumpnet related things, "
|
||||||
|
"e.g. logging network traffic",
|
||||||
|
.param = 'v',
|
||||||
|
.type = UTIL_OPTIONS_TYPE_BOOL,
|
||||||
|
.is_secret_data = false,
|
||||||
|
.default_value.b = false,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
.name = NXAHOOK_OPTIONS_STR_PATCH_NET_PROFILE_CERT_DIR_PATH,
|
||||||
|
.description =
|
||||||
|
"Path to a folder containing the client key, certificate and CA "
|
||||||
|
"bundle to enable https communication",
|
||||||
|
.param = 'c',
|
||||||
|
.type = UTIL_OPTIONS_TYPE_STR,
|
||||||
|
.is_secret_data = false,
|
||||||
|
.default_value.str = NULL,
|
||||||
|
},
|
||||||
{
|
{
|
||||||
.name = NXAHOOK_OPTIONS_STR_PATCH_PIUIO_EMU_LIB,
|
.name = NXAHOOK_OPTIONS_STR_PATCH_PIUIO_EMU_LIB,
|
||||||
.description =
|
.description =
|
||||||
@ -212,11 +235,15 @@ bool nxahook_options_init(
|
|||||||
options_opt, NXAHOOK_OPTIONS_STR_PATCH_HOOK_MAIN_LOOP_X11_INPUT_HANDLER);
|
options_opt, NXAHOOK_OPTIONS_STR_PATCH_HOOK_MAIN_LOOP_X11_INPUT_HANDLER);
|
||||||
options->patch.net.server = util_options_get_str(
|
options->patch.net.server = util_options_get_str(
|
||||||
options_opt, NXAHOOK_OPTIONS_STR_PATCH_NET_PROFILE_SERVER);
|
options_opt, NXAHOOK_OPTIONS_STR_PATCH_NET_PROFILE_SERVER);
|
||||||
options->patch.net.machine_id = strtoul(
|
options->patch.net.machine_id = strtoull(
|
||||||
util_options_get_str(
|
util_options_get_str(
|
||||||
options_opt, NXAHOOK_OPTIONS_STR_PATCH_NET_PROFILE_MACHINE_ID),
|
options_opt, NXAHOOK_OPTIONS_STR_PATCH_NET_PROFILE_MACHINE_ID),
|
||||||
NULL,
|
NULL,
|
||||||
16);
|
16);
|
||||||
|
options->patch.net.verbose_log_output = util_options_get_bool(
|
||||||
|
options_opt, NXAHOOK_OPTIONS_STR_PATCH_NET_PROFILE_VERBOSE_LOG_OUTPUT);
|
||||||
|
options->patch.net.cert_dir_path = util_options_get_str(
|
||||||
|
options_opt, NXAHOOK_OPTIONS_STR_PATCH_NET_PROFILE_CERT_DIR_PATH);
|
||||||
options->patch.piuio.api_lib = util_options_get_str(
|
options->patch.piuio.api_lib = util_options_get_str(
|
||||||
options_opt, NXAHOOK_OPTIONS_STR_PATCH_PIUIO_EMU_LIB);
|
options_opt, NXAHOOK_OPTIONS_STR_PATCH_PIUIO_EMU_LIB);
|
||||||
options->patch.piuio.exit_test_serv = util_options_get_bool(
|
options->patch.piuio.exit_test_serv = util_options_get_bool(
|
||||||
|
@ -31,7 +31,9 @@ struct nxahook_options {
|
|||||||
|
|
||||||
struct net {
|
struct net {
|
||||||
const char *server;
|
const char *server;
|
||||||
uint32_t machine_id;
|
uint64_t machine_id;
|
||||||
|
bool verbose_log_output;
|
||||||
|
const char *cert_dir_path;
|
||||||
} net;
|
} net;
|
||||||
|
|
||||||
struct piuio {
|
struct piuio {
|
||||||
|
@ -5,6 +5,8 @@
|
|||||||
|
|
||||||
#include "asset/nx2/lib/usb-rank.h"
|
#include "asset/nx2/lib/usb-rank.h"
|
||||||
#include "asset/nx2/lib/usb-save.h"
|
#include "asset/nx2/lib/usb-save.h"
|
||||||
|
#include "asset/nxa/lib/usb-rank.h"
|
||||||
|
#include "asset/nxa/lib/usb-save.h"
|
||||||
|
|
||||||
#include "capnhook/hook/filehook.h"
|
#include "capnhook/hook/filehook.h"
|
||||||
|
|
||||||
@ -77,8 +79,8 @@ static bool _patch_net_profile_close_pumpnet_profile_file(
|
|||||||
|
|
||||||
static const struct profile_virtual_mnt_point_info
|
static const struct profile_virtual_mnt_point_info
|
||||||
_patch_net_profile_virtual_mnt_point_infos[] = {
|
_patch_net_profile_virtual_mnt_point_infos[] = {
|
||||||
{.player = {
|
{.player =
|
||||||
{.file_info =
|
{{.file_info =
|
||||||
{{.player = 0,
|
{{.player = 0,
|
||||||
.file_type = PUMPNET_LIB_FILE_TYPE_SAVE,
|
.file_type = PUMPNET_LIB_FILE_TYPE_SAVE,
|
||||||
.file_path = "/mnt/0/nx2save.bin",
|
.file_path = "/mnt/0/nx2save.bin",
|
||||||
@ -95,7 +97,26 @@ static const struct profile_virtual_mnt_point_info
|
|||||||
{.player = 1,
|
{.player = 1,
|
||||||
.file_type = PUMPNET_LIB_FILE_TYPE_RANK,
|
.file_type = PUMPNET_LIB_FILE_TYPE_RANK,
|
||||||
.file_path = "/mnt/1/nx2rank.bin",
|
.file_path = "/mnt/1/nx2rank.bin",
|
||||||
.file_size = ASSET_NX2_USB_RANK_SIZE}}},
|
.file_size = ASSET_NX2_USB_RANK_SIZE}}}}},
|
||||||
|
{.player = {
|
||||||
|
{.file_info =
|
||||||
|
{{.player = 0,
|
||||||
|
.file_type = PUMPNET_LIB_FILE_TYPE_SAVE,
|
||||||
|
.file_path = "/mnt/0/nxasave.bin",
|
||||||
|
.file_size = ASSET_NXA_USB_SAVE_SIZE},
|
||||||
|
{.player = 0,
|
||||||
|
.file_type = PUMPNET_LIB_FILE_TYPE_RANK,
|
||||||
|
.file_path = "/mnt/0/nxarank.bin",
|
||||||
|
.file_size = ASSET_NXA_USB_RANK_SIZE}}},
|
||||||
|
{.file_info =
|
||||||
|
{{.player = 1,
|
||||||
|
.file_type = PUMPNET_LIB_FILE_TYPE_SAVE,
|
||||||
|
.file_path = "/mnt/1/nxasave.bin",
|
||||||
|
.file_size = ASSET_NXA_USB_SAVE_SIZE},
|
||||||
|
{.player = 1,
|
||||||
|
.file_type = PUMPNET_LIB_FILE_TYPE_RANK,
|
||||||
|
.file_path = "/mnt/1/nxarank.bin",
|
||||||
|
.file_size = ASSET_NXA_USB_RANK_SIZE}}},
|
||||||
}}};
|
}}};
|
||||||
|
|
||||||
static const struct profile_virtual_mnt_point_info
|
static const struct profile_virtual_mnt_point_info
|
||||||
@ -566,10 +587,10 @@ void patch_net_profile_init(
|
|||||||
idx = 0;
|
idx = 0;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
// case PUMPNET_LIB_GAME_NXA:
|
case ASSET_GAME_VERSION_NXA:
|
||||||
// idx = 1;
|
idx = 1;
|
||||||
// break;
|
break;
|
||||||
//
|
|
||||||
// case PUMPNET_LIB_GAME_FST:
|
// case PUMPNET_LIB_GAME_FST:
|
||||||
// idx = 2;
|
// idx = 2;
|
||||||
// break;
|
// break;
|
||||||
@ -581,7 +602,6 @@ void patch_net_profile_init(
|
|||||||
// case PUMPNET_LIB_GAME_F2:
|
// case PUMPNET_LIB_GAME_F2:
|
||||||
// idx = 4;
|
// idx = 4;
|
||||||
// break;
|
// break;
|
||||||
case ASSET_GAME_VERSION_NXA:
|
|
||||||
case ASSET_GAME_VERSION_FIESTA:
|
case ASSET_GAME_VERSION_FIESTA:
|
||||||
case ASSET_GAME_VERSION_FIESTA_EX:
|
case ASSET_GAME_VERSION_FIESTA_EX:
|
||||||
case ASSET_GAME_VERSION_FIESTA_2:
|
case ASSET_GAME_VERSION_FIESTA_2:
|
||||||
|
@ -29,6 +29,9 @@ static char *_pumpnet_lib_get_endpoint_save(
|
|||||||
case ASSET_GAME_VERSION_NX2:
|
case ASSET_GAME_VERSION_NX2:
|
||||||
return util_str_merge(server_addr, USBPROFILE_ENDPOINT "/nx2/save");
|
return util_str_merge(server_addr, USBPROFILE_ENDPOINT "/nx2/save");
|
||||||
|
|
||||||
|
case ASSET_GAME_VERSION_NXA:
|
||||||
|
return util_str_merge(server_addr, USBPROFILE_ENDPOINT "/nxa/save");
|
||||||
|
|
||||||
default:
|
default:
|
||||||
log_die("Unsupported game version %d", game);
|
log_die("Unsupported game version %d", game);
|
||||||
return NULL;
|
return NULL;
|
||||||
@ -42,6 +45,9 @@ static char *_pumpnet_lib_get_endpoint_rank(
|
|||||||
case ASSET_GAME_VERSION_NX2:
|
case ASSET_GAME_VERSION_NX2:
|
||||||
return util_str_merge(server_addr, USBPROFILE_ENDPOINT "/nx2/rank");
|
return util_str_merge(server_addr, USBPROFILE_ENDPOINT "/nx2/rank");
|
||||||
|
|
||||||
|
case ASSET_GAME_VERSION_NXA:
|
||||||
|
return util_str_merge(server_addr, USBPROFILE_ENDPOINT "/nxa/rank");
|
||||||
|
|
||||||
default:
|
default:
|
||||||
log_die("Unsupported game version %d", game);
|
log_die("Unsupported game version %d", game);
|
||||||
return NULL;
|
return NULL;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user