diff --git a/src/imports/avs.h b/src/imports/avs.h index 77ff0ce..48024f9 100644 --- a/src/imports/avs.h +++ b/src/imports/avs.h @@ -36,7 +36,8 @@ enum property_type { PROPERTY_TYPE_S64 = 8, PROPERTY_TYPE_U64 = 9, PROPERTY_TYPE_BIN = 10, - PROPERTY_TYPE_STR = 11 + PROPERTY_TYPE_STR = 11, + PROPERTY_TYPE_BOOL = 52 }; struct property; @@ -57,8 +58,6 @@ enum psmap_type { PSMAP_TYPE_S64 = 8, PSMAP_TYPE_U64 = 9, PSMAP_TYPE_STR = 10, - /* Used on avs 803 instead of value 10 */ - PSMAP_TYPE_STR_LEGACY = 11, PSMAP_TYPE_ATTR = 45, PSMAP_TYPE_BOOL = 50, }; diff --git a/src/main/jbhook1/avs-boot.c b/src/main/jbhook1/avs-boot.c index 7084f70..969fbd8 100644 --- a/src/main/jbhook1/avs-boot.c +++ b/src/main/jbhook1/avs-boot.c @@ -77,7 +77,7 @@ static void avs_boot_replace_property_str( property_node_remove(tmp); } - tmp = property_node_create(NULL, node, PSMAP_TYPE_STR_LEGACY, name, val); + tmp = property_node_create(NULL, node, PROPERTY_TYPE_STR, name, val); if (tmp) { property_node_datasize(tmp); diff --git a/src/main/launcher/ea3-config.c b/src/main/launcher/ea3-config.c index 650e1bc..684ba46 100644 --- a/src/main/launcher/ea3-config.c +++ b/src/main/launcher/ea3-config.c @@ -160,3 +160,31 @@ void ea3_ident_to_property( property_psmap_export(ea3_config, NULL, ident, ea3_ident_psmap); } + +void ea3_ident_replace_property_bool( + struct property_node *node, const char *name, uint8_t val) +{ + struct property_node *tmp; + + tmp = property_search(NULL, node, name); + + if (tmp) { + property_node_remove(tmp); + } + + property_node_create(NULL, node, PROPERTY_TYPE_BOOL, name, val); +} + +void ea3_ident_replace_property_str( + struct property_node *node, const char *name, const char *val) +{ + struct property_node *tmp; + + tmp = property_search(NULL, node, name); + + if (tmp) { + property_node_remove(tmp); + } + + tmp = property_node_create(NULL, node, PROPERTY_TYPE_STR, name, val); +} diff --git a/src/main/launcher/ea3-config.h b/src/main/launcher/ea3-config.h index ccc2835..ada4400 100644 --- a/src/main/launcher/ea3-config.h +++ b/src/main/launcher/ea3-config.h @@ -38,5 +38,9 @@ bool ea3_ident_invoke_module_init( struct property_node *app_config); void ea3_ident_to_property( const struct ea3_ident *ident, struct property *ea3_config); +void ea3_ident_replace_property_bool( + struct property_node *node, const char *name, uint8_t val); +void ea3_ident_replace_property_str( + struct property_node *node, const char *name, const char *val); #endif diff --git a/src/main/launcher/main.c b/src/main/launcher/main.c index 4424381..ce04b89 100644 --- a/src/main/launcher/main.c +++ b/src/main/launcher/main.c @@ -94,7 +94,8 @@ static AVS_LOG_WRITER(log_callback, chars, nchars, ctx) free(utf16); } -static void load_hook_dlls(struct array* hook_dlls) { +static void load_hook_dlls(struct array *hook_dlls) +{ const char *hook_dll; for (size_t i = 0; i < hook_dlls->nitems; i++) { @@ -283,6 +284,24 @@ int main(int argc, const char **argv) ea3_ident_to_property(&ea3, ea3_config); + if (options.override_urlslash_enabled) { + log_info("Overriding url_slash to: %d", options.override_urlslash); + + ea3_ident_replace_property_bool( + ea3_config_root, + "/network/url_slash", + options.override_urlslash); + } + + if (options.override_service_enabled) { + log_info("Overriding service url to: %s", options.override_service); + + ea3_ident_replace_property_str( + ea3_config_root, + "/network/services", + options.override_service); + } + /* Start up e-Amusement client */ ea3_boot(ea3_config_root); diff --git a/src/main/launcher/options.c b/src/main/launcher/options.c index 91be9c0..995aedb 100644 --- a/src/main/launcher/options.c +++ b/src/main/launcher/options.c @@ -1,5 +1,6 @@ #include #include +#include #include "imports/avs.h" @@ -135,6 +136,35 @@ bool options_read_cmdline(struct options *options, int argc, const char **argv) break; + case 'S': + if (i + 1 >= argc) { + return false; + } + + options->override_service_enabled = true; + options->override_service = argv[++i]; + + break; + + case 'U': + if (i + 1 >= argc) { + return false; + } + + options->override_urlslash_enabled = true; + + const char * urlslash_value = argv[++i]; + + options->override_urlslash = false; + if (_stricmp(urlslash_value, "1") == 0) { + options->override_urlslash = true; + } + if (_stricmp(urlslash_value, "true") == 0) { + options->override_urlslash = true; + } + + break; + case 'D': options->remote_debugger = true; @@ -179,6 +209,8 @@ void options_print_usage(void) #endif " -P [pcbid] Specify PCBID (default: use ea3 config)\n" " -R [pcbid] Specify Soft ID (default: use ea3 config)\n" + " -S [url] Specify service url (default: use ea3 config)\n" + " -U [0/1] Specify url_slash (default: use ea3 config)\n" " -K [filename] Load hook DLL (can be specified multiple " "times)\n" " -B [filename] Load pre-hook DLL loaded before avs boot " diff --git a/src/main/launcher/options.h b/src/main/launcher/options.h index b7f0c01..cefcaf4 100644 --- a/src/main/launcher/options.h +++ b/src/main/launcher/options.h @@ -19,6 +19,10 @@ struct options { struct array hook_dlls; struct array before_hook_dlls; bool remote_debugger; + bool override_service_enabled; + const char *override_service; + bool override_urlslash_enabled; + bool override_urlslash; }; void options_init(struct options *options);