1
0
Fork 0
mirror of https://github.com/suchmememanyskill/TegraExplorer.git synced 2024-11-08 13:11:54 +00:00

[Script] Make printf accept multiple args

This commit is contained in:
Such Meme, Many Skill 2020-04-15 22:02:19 +02:00
parent 28fb01b155
commit e24f8ad722
3 changed files with 21 additions and 9 deletions

View file

@ -66,12 +66,24 @@ int parseStringInput(char *in, char **out){
u32 currentcolor = COLOR_WHITE;
int part_printf(){
char *toprint;
if (parseStringInput(argv[0], &toprint))
SWAPCOLOR(currentcolor);
for (int i = 0; i < argc; i++){
if (argv[i][0] == '@'){
int toprintint;
if (parseIntInput(argv[i], &toprintint))
return -1;
SWAPCOLOR(currentcolor);
gfx_printf(toprint);
gfx_printf("%d", toprintint);
}
else {
char *toprintstring;
if (parseStringInput(argv[i], &toprintstring))
return -1;
gfx_printf(toprintstring);
}
}
gfx_printf("\n");
return 0;
}
@ -529,7 +541,7 @@ int part_getPos(){
}
str_fnc_struct functions[] = {
{"printf", part_printf, 1},
{"printf", part_printf, 255},
{"printInt", part_print_int, 1},
{"setPrintPos", part_setPrintPos, 2},
{"clearscreen", part_clearscreen, 0},
@ -571,7 +583,7 @@ str_fnc_struct functions[] = {
int run_function(char *func_name, int *out){
for (u32 i = 0; functions[i].key != NULL; i++){
if (!strcmp(functions[i].key, func_name)){
if (argc != functions[i].arg_count)
if (argc != functions[i].arg_count && functions[i].arg_count != 255)
continue;
*out = functions[i].value();

View file

@ -56,7 +56,7 @@ u32 splitargs(char* in) {
argv = calloc(count + 1, sizeof(char*));
for (i = 0; i < count; i++)
argv[i] = calloc(128, sizeof(char));
argv[i] = calloc(96, sizeof(char));
for (i = 0; i < len && curcount < count; i++) {

View file

@ -35,7 +35,7 @@ void displayinfo(){
SWAPCOLOR(COLOR_ORANGE);
gfx_printf("Fuse count: %d\nPKG1 id: %s\n", fuse_count, pkg1.id);
gfx_printf("Fuse count: %d\nPKG1 id: '%s'\n", fuse_count, pkg1.id);
if (pkg1.ver >= 0)
gfx_printf("PKG1 version: %d\n", pkg1.ver);