From 5b32937f8fe4938a3b88f730646f90dc090898fb Mon Sep 17 00:00:00 2001 From: "Such Meme, Many Skill" Date: Wed, 1 Apr 2020 16:37:32 +0200 Subject: [PATCH] add stringcompare function, fix some returns --- source/tegraexplorer/emmc/emmc.c | 6 +++--- source/tegraexplorer/script/functions.c | 14 +++++++++++++- 2 files changed, 16 insertions(+), 4 deletions(-) diff --git a/source/tegraexplorer/emmc/emmc.c b/source/tegraexplorer/emmc/emmc.c index 7485a92..60b2fc2 100644 --- a/source/tegraexplorer/emmc/emmc.c +++ b/source/tegraexplorer/emmc/emmc.c @@ -67,7 +67,7 @@ int connect_part(const char *partition){ system_part = nx_emmc_part_find(&gpt, partition); if (!system_part) { gfx_errDisplay("connect_mmc_part", ERR_PART_NOT_FOUND, 0); - return -1; + return 1; } return 0; @@ -81,11 +81,11 @@ int mount_mmc(const char *partition, const int biskeynumb){ se_aes_key_set(9, bis_key[biskeynumb] + 0x10, 0x10); if (connect_part(partition)) - return -1; + return 1; if ((res = f_mount(&emmc, "emmc:", 1))) { gfx_errDisplay("mount_mmc", res, 0); - return -1; + return 1; } return 0; diff --git a/source/tegraexplorer/script/functions.c b/source/tegraexplorer/script/functions.c index ee86755..3462e12 100644 --- a/source/tegraexplorer/script/functions.c +++ b/source/tegraexplorer/script/functions.c @@ -65,7 +65,7 @@ int part_printf(){ char *toprint; if (parseStringInput(argv[0], &toprint)) return -1; - + SWAPCOLOR(currentcolor); gfx_printf(toprint); gfx_printf("\n"); @@ -428,6 +428,17 @@ int part_setPrintPos(){ return 0; } +int part_stringcompare(){ + char *left, *right; + + if (parseStringInput(argv[0], &left)) + return -1; + if (parseStringInput(argv[1], &right)) + return -1; + + return (strcmp(left, right)) ? 0 : 1; +} + str_fnc_struct functions[] = { {"printf", part_printf, 1}, {"printInt", part_print_int, 1}, @@ -441,6 +452,7 @@ str_fnc_struct functions[] = { {"setStringIndex", part_SetStringIndex, 2}, {"setColor", part_setColor, 1}, {"combineStrings", part_addstrings, 3}, + {"compareStrings", part_stringcompare, 2}, {"invert", part_invert, 1}, {"fs_exists", part_fs_exists, 1}, {"fs_move", part_fs_Move, 2},