Skip to content

Commit

Permalink
corrected some args settings
Browse files Browse the repository at this point in the history
  • Loading branch information
FIX94 committed Sep 28, 2017
1 parent 7b9fd00 commit 7a7cafe
Showing 1 changed file with 16 additions and 5 deletions.
21 changes: 16 additions & 5 deletions source/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -97,21 +97,32 @@ int main(int argc, char *argv[])

char *CMD_ADDR = (char*)ARGS_ADDR + sizeof(struct __argv);
size_t full_fPath_len = strlen(fPath)+1;
size_t full_nincfg_len = sizeof(NIN_CFG);
size_t full_nincfg_len = sizeof(NIN_CFG)+1;
size_t full_args_len = sizeof(struct __argv)+full_fPath_len+full_nincfg_len;

memset(ARGS_ADDR, 0, full_args_len);
ARGS_ADDR->argvMagic = ARGV_MAGIC;
ARGS_ADDR->commandLine = CMD_ADDR;
ARGS_ADDR->length = full_args_len;
ARGS_ADDR->length = full_fPath_len+full_nincfg_len;
ARGS_ADDR->argc = 2;

memcpy(CMD_ADDR, fPath, full_fPath_len);
memcpy(CMD_ADDR+full_fPath_len, &nincfg, full_nincfg_len);
memcpy(CMD_ADDR+full_fPath_len, &nincfg, sizeof(NIN_CFG));
CMD_ADDR[full_fPath_len+sizeof(NIN_CFG)] = 0;
DCFlushRange(ARGS_ADDR, full_args_len);
#else
memset(ARGS_ADDR, 0, sizeof(struct __argv));
DCFlushRange(ARGS_ADDR, sizeof(struct __argv));
char *CMD_ADDR = (char*)ARGS_ADDR + sizeof(struct __argv);
size_t full_fPath_len = strlen(fPath)+1;
size_t full_args_len = sizeof(struct __argv)+full_fPath_len;

memset(ARGS_ADDR, 0, full_args_len);
ARGS_ADDR->argvMagic = ARGV_MAGIC;
ARGS_ADDR->commandLine = CMD_ADDR;
ARGS_ADDR->length = full_fPath_len;
ARGS_ADDR->argc = 1;

memcpy(CMD_ADDR, fPath, full_fPath_len);
DCFlushRange(ARGS_ADDR, full_args_len);
#endif

//possibly affects nintendont speed?
Expand Down

0 comments on commit 7a7cafe

Please sign in to comment.