mirror of
https://github.com/ptitSeb/box64.git
synced 2024-12-03 12:11:01 +00:00
[RCFILE] Slightly changed how BOX64_ARGS behave, and added BOX64_INSERT_ARGS
This commit is contained in:
parent
362402ffbf
commit
1b48cd157a
@ -391,7 +391,10 @@ Those variables are only valid inside a rcfile:
|
||||
* 1 : Added "-cef-disable-gpu-compositor" to command line arguments (usefull for steamwebhelper/cef based programs)
|
||||
|
||||
#### BOX64_ARGS
|
||||
If that var exist, it will be added as argument(s) to the command line. Note that "" are supported, but not ''
|
||||
If that var exist, it will be added as argument(s) to the command line if there is no current argument (it's ignored else). Note that "" are supported, but not ''
|
||||
|
||||
#### BOX64_INSERT_ARGS
|
||||
If that var exist, it will be inserted as firsts argument(s) to the command line. Note that "" are supported, but not ''
|
||||
|
||||
#### BOX64_EXIT
|
||||
* 0 : Nothing special
|
||||
|
43
src/core.c
43
src/core.c
@ -68,6 +68,7 @@ int box64_ignoreint3 = 0;
|
||||
int box64_rdtsc = 0;
|
||||
int box64_rdtsc_1ghz = 0;
|
||||
uint8_t box64_rdtsc_shift = 0;
|
||||
char* box64_insert_args = NULL;
|
||||
char* box64_new_args = NULL;
|
||||
#ifdef DYNAREC
|
||||
int box64_dynarec = 1;
|
||||
@ -1716,10 +1717,16 @@ static void add_argv(const char* what) {
|
||||
if(!strcmp(my_context->argv[i], what))
|
||||
there = 1;
|
||||
if(!there) {
|
||||
printf_log(LOG_INFO, "Inserting \"%s\" to the arguments\n", what);
|
||||
// try to prepend the arg, not appending
|
||||
static int where = 0;
|
||||
if(!where)
|
||||
where = (box64_wine)?2:1;
|
||||
printf_log(LOG_INFO, "Inserting \"%s\" to the argument %d\n", what, where);
|
||||
my_context->argv = (char**)box_realloc(my_context->argv, (my_context->argc+1)*sizeof(char*));
|
||||
my_context->argv[my_context->argc] = box_strdup(what);
|
||||
memmove(my_context->argv+where+1, my_context->argv+where, (my_context->argc-where)*sizeof(char*));
|
||||
my_context->argv[where] = box_strdup(what);
|
||||
my_context->argc++;
|
||||
where++;
|
||||
}
|
||||
}
|
||||
|
||||
@ -2069,11 +2076,39 @@ int initialize(int argc, const char **argv, char** env, x64emu_t** emulator, elf
|
||||
{
|
||||
add_argv("-cef-disable-gpu-compositor");
|
||||
}
|
||||
// add new args only if there is no args already
|
||||
if(box64_new_args) {
|
||||
char tmp[256];
|
||||
char* p = box64_new_args;
|
||||
int state = 0;
|
||||
char* p2 = p;
|
||||
if(my_context->argc==1 || (my_context->argc==2 && box64_wine))
|
||||
while(state>=0) {
|
||||
switch(*p2) {
|
||||
case 0: // end of flux
|
||||
if(state && (p2!=p)) add_argv(p);
|
||||
state = -1;
|
||||
break;
|
||||
case '"': // start/end of quotes
|
||||
if(state<2) {if(!state) p=p2; state=2;} else state=1;
|
||||
break;
|
||||
case ' ':
|
||||
if(state==1) {strncpy(tmp, p, p2-p); tmp[p2-p]='\0'; add_argv(tmp); state=0;}
|
||||
break;
|
||||
default:
|
||||
if(state==0) {state=1; p=p2;}
|
||||
break;
|
||||
}
|
||||
++p2;
|
||||
}
|
||||
box_free(box64_new_args);
|
||||
box64_new_args = NULL;
|
||||
}
|
||||
if(box64_insert_args) {
|
||||
char tmp[256];
|
||||
char* p = box64_insert_args;
|
||||
int state = 0;
|
||||
char* p2 = p;
|
||||
while(state>=0) {
|
||||
switch(*p2) {
|
||||
case 0: // end of flux
|
||||
@ -2092,8 +2127,8 @@ int initialize(int argc, const char **argv, char** env, x64emu_t** emulator, elf
|
||||
}
|
||||
++p2;
|
||||
}
|
||||
box_free(box64_new_args);
|
||||
box64_new_args = NULL;
|
||||
box_free(box64_insert_args);
|
||||
box64_insert_args = NULL;
|
||||
}
|
||||
// check if file exist
|
||||
if(!my_context->argv[0] || !FileExist(my_context->argv[0], IS_FILE)) {
|
||||
|
@ -242,8 +242,8 @@ static void* pthread_routine(void* p)
|
||||
Push64(emu, 0); // PUSH BP
|
||||
R_RBP = R_RSP; // MOV BP, SP
|
||||
R_RSP -= 64; // Guard zone
|
||||
if(R_RSP&0x8) // align if needed (shouldn't be)
|
||||
R_RSP-=8;
|
||||
R_RSP &= ~15LL;
|
||||
R_RSP-=8; // make sure RSP is aligned inside thread function
|
||||
PushExit(emu);
|
||||
R_RIP = et->fnc;
|
||||
R_RDI = (uintptr_t)et->arg;
|
||||
|
@ -124,6 +124,7 @@ ENTRYSTRING_(BOX64_ENV2, new_env2) \
|
||||
ENTRYSTRING_(BOX64_ENV3, new_env3) \
|
||||
ENTRYSTRING_(BOX64_ENV4, new_env4) \
|
||||
ENTRYSTRING_(BOX64_ARGS, new_args) \
|
||||
ENTRYSTRING_(BOX64_INSERT_ARGS, insert_args) \
|
||||
ENTRYBOOL(BOX64_RESERVE_HIGH, new_reserve_high) \
|
||||
|
||||
#ifdef HAVE_TRACE
|
||||
@ -501,6 +502,7 @@ extern int ftrace_has_pid;
|
||||
extern FILE* ftrace;
|
||||
extern char* ftrace_name;
|
||||
extern char* box64_new_args;
|
||||
extern char* box64_insert_args;
|
||||
void openFTrace(const char* newtrace);
|
||||
void addNewEnvVar(const char* s);
|
||||
void AddNewLibs(const char* libs);
|
||||
@ -655,6 +657,12 @@ void internal_ApplyParams(const char* name, const my_params_t* param) {
|
||||
box_free(box64_new_args);
|
||||
box64_new_args = box_strdup(param->new_args);
|
||||
}
|
||||
if(param->is_insert_args_present) {
|
||||
printf_log(LOG_INFO, "Adding \"%s\" arguments to command line\n", param->insert_args);
|
||||
if(box64_insert_args)
|
||||
box_free(box64_insert_args);
|
||||
box64_insert_args = box_strdup(param->insert_args);
|
||||
}
|
||||
if(param->is_bash_present && FileIsX64ELF(param->bash)) {
|
||||
if(my_context->bashpath)
|
||||
box_free(my_context->bashpath);
|
||||
|
@ -413,7 +413,7 @@ BOX64_DYNAREC_STRONGMEM=1
|
||||
BOX64_DYNAREC_BIGBLOCK=3
|
||||
BOX64_DYNAREC_CALLRET=1
|
||||
BOX64_DYNAREC_SAFEFLAGS=0
|
||||
BOX64_ARGS=-cef-disable-breakpad -cef-disable-d3d11 -cef-disable-delaypageload -cef-force-occlusion -cef-disable-sandbox -cef-disable--seccomp-sandbox -no-cef-sandbox -disable-winh264 -cef-disable-gpu -vgui -oldtraymenu -cef-single-process
|
||||
BOX64_ARGS=-cef-disable-breakpad -cef-disable-d3d11 -cef-disable-delaypageload -cef-force-occlusion -cef-disable-sandbox -cef-disable-seccomp-sandbox -no-cef-sandbox -disable-winh264 -cef-disable-gpu -vgui -oldtraymenu -cef-single-process
|
||||
|
||||
[steamwebhelper.exe]
|
||||
BOX64_DYNAREC_STRONGMEM=1
|
||||
|
Loading…
Reference in New Issue
Block a user