Bemanitools v5.26 release

This commit is contained in:
icex2
2019-09-27 22:36:50 +02:00
commit cbd7720349
718 changed files with 62731 additions and 0 deletions
+173
View File
@@ -0,0 +1,173 @@
#include <stdio.h>
#include <stdlib.h>
#include "imports/avs.h"
#include "launcher/options.h"
#include "util/array.h"
#include "util/str.h"
#define DEFAULT_HEAP_SIZE 16777216
void options_init(struct options *options)
{
options->std_heap_size = DEFAULT_HEAP_SIZE;
options->avs_heap_size = DEFAULT_HEAP_SIZE;
options->app_config_path = "prop/app-config.xml";
options->avs_config_path = "prop/avs-config.xml";
options->ea3_config_path = "prop/ea3-config.xml";
options->softid = NULL;
options->pcbid = NULL;
options->module = NULL;
options->logfile = NULL;
options->remote_debugger = false;
array_init(&options->hook_dlls);
}
bool options_read_cmdline(struct options *options, int argc, const char **argv)
{
for (int i = 1 ; i < argc ; i++) {
if (argv[i][0] == '-') {
switch (argv[i][1]) {
case 'A':
if (i + 1 >= argc) {
return false;
}
options->app_config_path = argv[++i];
break;
case 'E':
if (i + 1 >= argc) {
return false;
}
options->ea3_config_path = argv[++i];
break;
case 'V':
if (i + 1 >= argc) {
return false;
}
options->avs_config_path = argv[++i];
break;
case 'P':
if (i + 1 >= argc) {
return false;
}
options->pcbid = argv[++i];
break;
case 'R':
if (i + 1 >= argc) {
return false;
}
options->softid = argv[++i];
break;
case 'H':
if (i + 1 >= argc) {
return false;
}
options->avs_heap_size = (size_t)strtol(argv[++i],NULL,0);
if (options->avs_heap_size == 0) {
return false;
}
break;
#ifdef AVS_HAS_STD_HEAP
case 'T':
if (i + 1 >= argc) {
return false;
}
options->std_heap_size = (size_t)strtol(argv[++i],NULL,0);
if (options->std_heap_size == 0) {
return false;
}
break;
#endif
case 'K':
if (i + 1 >= argc) {
return false;
}
*array_append(const char *,&options->hook_dlls)=argv[++i];
break;
case 'Y':
if (i + 1 >= argc) {
return false;
}
options->logfile = argv[++i];
break;
case 'D':
options->remote_debugger = true;
break;
default:
break;
}
} else {
if (!options->module) {
options->module = argv[i];
}
}
}
if (options->module) {
return true;
} else {
return false;
}
}
void options_print_usage(void)
{
fprintf(stderr,
"Usage: launcher.exe [launcher options...] <app.dll> [hooks options...] \n"
"\n"
" The following options can be specified before the app DLL path:\n"
"\n"
" -A [filename] App configuration file (default: prop/app-config.xml)\n"
" -V [filename] AVS configuration file (default: prop/avs-config.xml)\n"
" -E [filename] ea3 configuration file (default: prop/ea3-config.xml)\n"
" -H [bytes] AVS heap size (default: 16777216)\n"
#ifdef AVS_HAS_STD_HEAP
" -T [bytes] 'std' heap size (default 16777216)\n"
#endif
" -P [pcbid] Specify PCBID (default: use ea3 config)\n"
" -R [pcbid] Specify Soft ID (default: use ea3 config)\n"
" -K [filename] Load hook DLL (can be specified multiple times)\n"
" -Y [filename] Log to a file in addition to the console\n"
" -D Halt the launcher before bootstrapping AVS until a"
" remote debugger is attached\n"
);
}
void options_fini(struct options *options)
{
array_fini(&options->hook_dlls);
}