Compare commits

...

5 Commits

Author SHA1 Message Date
Such Meme, Many Skill
b8b37e78ba Hotfix for 10.0.0 2020-04-14 09:40:37 +02:00
Such Meme, Many Skill
82a4d03985 Bump version 2020-04-12 22:22:40 +02:00
Such Meme, Many Skill
195d9797fe Add that inside functions no "" are required for <=>+-/* 2020-04-12 20:31:32 +02:00
Such Meme, Many Skill
15e1210179 [script] Remove jump list & add if_check that works like if(check()) 2020-04-12 19:21:09 +02:00
Such Meme, Many Skill
e892e69929 don't hardcode locations where info should be parsed from 2020-04-08 17:33:34 +02:00
12 changed files with 86 additions and 54 deletions

View File

@@ -11,7 +11,7 @@ include $(DEVKITARM)/base_rules
IPL_LOAD_ADDR := 0x40003000 IPL_LOAD_ADDR := 0x40003000
LPVERSION_MAJOR := 2 LPVERSION_MAJOR := 2
LPVERSION_MINOR := 5 LPVERSION_MINOR := 5
LPVERSION_BUGFX := 0 LPVERSION_BUGFX := 1
################################################################################ ################################################################################

View File

@@ -42,6 +42,7 @@ static const pkg1_id_t _pkg1_ids[] = {
{ "20190531152432", 8, {0x29c50, 0x6a73, 0, 8, 12, HASH_ORDER_700_9xx, 0x5563, 0x1d437} }, //8.1.0 { "20190531152432", 8, {0x29c50, 0x6a73, 0, 8, 12, HASH_ORDER_700_9xx, 0x5563, 0x1d437} }, //8.1.0
{ "20190809135709", 9, {0x2ec10, 0x5573, 0, 1, 12, HASH_ORDER_700_9xx, 0x6495, 0x1d807} }, //9.0.0 - 9.0.1 { "20190809135709", 9, {0x2ec10, 0x5573, 0, 1, 12, HASH_ORDER_700_9xx, 0x6495, 0x1d807} }, //9.0.0 - 9.0.1
{ "20191021113848", 10,{0x2ec10, 0x5573, 0, 1, 12, HASH_ORDER_700_9xx, 0x6495, 0x1d807} }, //9.1.0 { "20191021113848", 10,{0x2ec10, 0x5573, 0, 1, 12, HASH_ORDER_700_9xx, 0x6495, 0x1d807} }, //9.1.0
{ "20200303104606", 11,{0x2ec10, 0x5573, 0, 1, 12, HASH_ORDER_700_9xx, 0x6495, 0x1d807} }, //10.0.0, May or may not be accurate. I just need to feed tsec anyway so this doesn't matter
{ NULL } //End. { NULL } //End.
}; };

View File

@@ -215,8 +215,8 @@ int dump_biskeys(){
memcpy(bis_key[3], bis_key[2], 0x20); memcpy(bis_key[3], bis_key[2], 0x20);
} }
sdmmc_storage_set_mmc_partition(&storage, 0); //sdmmc_storage_set_mmc_partition(&storage, 0);
nx_emmc_gpt_parse(&sys_gpt, &storage); //nx_emmc_gpt_parse(&sys_gpt, &storage);
se_aes_key_set(8, bis_key[2] + 0x00, 0x10); se_aes_key_set(8, bis_key[2] + 0x00, 0x10);
se_aes_key_set(9, bis_key[2] + 0x10, 0x10); se_aes_key_set(9, bis_key[2] + 0x10, 0x10);
@@ -226,11 +226,17 @@ int dump_biskeys(){
return 0; return 0;
} }
void dumpEmuGpt(){ void dumpGpt(){
connect_mmc(SYSMMC);
sdmmc_storage_set_mmc_partition(&storage, 0);
nx_emmc_gpt_parse(&sys_gpt, &storage);
if (emu_cfg.enabled){
connect_mmc(EMUMMC); connect_mmc(EMUMMC);
emummc_storage_set_mmc_partition(&storage, 0); emummc_storage_set_mmc_partition(&storage, 0);
nx_emmc_gpt_parse(&emu_gpt, &storage); nx_emmc_gpt_parse(&emu_gpt, &storage);
} }
}
link_t *selectGpt(short mmcType){ link_t *selectGpt(short mmcType){
switch(mmcType){ switch(mmcType){

View File

@@ -16,7 +16,7 @@ int mount_mmc(const char *partition, const int biskeynumb);
void connect_mmc(short mmctype); void connect_mmc(short mmctype);
void disconnect_mmc(); void disconnect_mmc();
int connect_part(const char *partition); int connect_part(const char *partition);
void dumpEmuGpt(); void dumpGpt();
link_t *selectGpt(short mmcType); link_t *selectGpt(short mmcType);
int checkGptRules(char *in); int checkGptRules(char *in);

View File

@@ -90,6 +90,10 @@ int handleEntries(short mmcType, menu_entry part){
int res = 0; int res = 0;
if (part.property & ISDIR){ if (part.property & ISDIR){
if (returnpkg1info().ver < 0){
gfx_errDisplay("emmcMakeMenu", ERR_BISKEY_DUMP_FAILED, 0);
return -1;
}
if (!mount_mmc(part.name, part.storage)) if (!mount_mmc(part.name, part.storage))
fileexplorer("emmc:/", 1); fileexplorer("emmc:/", 1);
} }

View File

@@ -25,7 +25,7 @@ void gfx_clearscreen(){
gfx_box(0, 0, 719, 15, COLOR_WHITE); gfx_box(0, 0, 719, 15, COLOR_WHITE);
gfx_con_setpos(0, 0); gfx_con_setpos(0, 0);
gfx_printf("Tegraexplorer v1.5.0\n"); gfx_printf("Tegraexplorer v1.5.1\n");
RESETCOLOR; RESETCOLOR;
} }

View File

@@ -120,13 +120,11 @@ int menu_make(menu_entry *entries, int amount, char *toptext){
res = 0; res = 0;
while (!res){ while (!res){
if (!res){
if (sd_inited && !!gpio_read(GPIO_PORT_Z, GPIO_PIN_1)){ if (sd_inited && !!gpio_read(GPIO_PORT_Z, GPIO_PIN_1)){
gfx_errDisplay("menu", ERR_SD_EJECTED, 0); gfx_errDisplay("menu", ERR_SD_EJECTED, 0);
sd_unmount(); sd_unmount();
return -1; return -1;
} }
}
res = btn_read(); res = btn_read();

View File

@@ -154,14 +154,14 @@ void te_main(){
if (dump_biskeys() == -1){ if (dump_biskeys() == -1){
gfx_errDisplay("dump_biskey", ERR_BISKEY_DUMP_FAILED, 0); gfx_errDisplay("dump_biskey", ERR_BISKEY_DUMP_FAILED, 0);
mainmenu_main[1].property |= ISHIDE; //mainmenu_main[1].property |= ISHIDE;
} }
if (emummc_load_cfg()){ if (emummc_load_cfg()){
mainmenu_main[2].property |= ISHIDE; mainmenu_main[2].property |= ISHIDE;
} }
else
dumpEmuGpt(); dumpGpt();
disconnect_mmc(); disconnect_mmc();

View File

@@ -30,7 +30,7 @@ extern short currentlyMounted;
int parseIntInput(char *in, int *out){ int parseIntInput(char *in, int *out){
if (in[0] == '@'){ if (in[0] == '@'){
if (str_int_find(argv[0], out)) if (str_int_find(in, out))
return -1; return -1;
} }
else else
@@ -38,10 +38,10 @@ int parseIntInput(char *in, int *out){
return 0; return 0;
} }
/*
int parseJmpInput(char *in, u64 *out){ int parseJmpInput(char *in, u64 *out){
if (in[0] == '?'){ if (in[0] == '?'){
if (str_jmp_find(argv[0], out)) if (str_jmp_find(in, out))
return -1; return -1;
else else
return 0; return 0;
@@ -49,6 +49,7 @@ int parseJmpInput(char *in, u64 *out){
else else
return -1; return -1;
} }
*/
int parseStringInput(char *in, char **out){ int parseStringInput(char *in, char **out){
if (in[0] == '$'){ if (in[0] == '$'){
@@ -103,6 +104,29 @@ int part_Wait(){
return 0; return 0;
} }
int part_Check(){
int left, right;
if (parseIntInput(argv[0], &left))
return -1;
if (parseIntInput(argv[2], &right))
return -1;
if (!strcmp(argv[1], "=="))
return (left == right);
else if (!strcmp(argv[1], "!="))
return (left != right);
else if (!strcmp(argv[1], ">="))
return (left >= right);
else if (!strcmp(argv[1], "<="))
return (left <= right);
else if (!strcmp(argv[1], ">"))
return (left > right);
else if (!strcmp(argv[1], "<"))
return (left < right);
else
return -1;
}
int part_if(){ int part_if(){
int condition; int condition;
if (parseIntInput(argv[0], &condition)) if (parseIntInput(argv[0], &condition))
@@ -125,6 +149,19 @@ int part_if(){
*/ */
} }
int part_if_args(){
int condition;
if ((condition = part_Check()) < 0)
return -1;
getfollowingchar('{');
if (!condition)
skipbrackets();
return 0;
}
int part_Math(){ int part_Math(){
int left, right; int left, right;
if (parseIntInput(argv[0], &left)) if (parseIntInput(argv[0], &left))
@@ -145,29 +182,6 @@ int part_Math(){
return -1; return -1;
} }
int part_Check(){
int left, right;
if (parseIntInput(argv[0], &left))
return -1;
if (parseIntInput(argv[2], &right))
return -1;
if (!strcmp(argv[1], "=="))
return (left == right);
else if (!strcmp(argv[1], "!="))
return (left != right);
else if (!strcmp(argv[1], ">="))
return (left >= right);
else if (!strcmp(argv[1], "<="))
return (left <= right);
else if (!strcmp(argv[1], ">"))
return (left > right);
else if (!strcmp(argv[1], "<"))
return (left < right);
else
return -1;
}
int part_SetInt(){ int part_SetInt(){
int out; int out;
parseIntInput(argv[0], &out); parseIntInput(argv[0], &out);
@@ -200,8 +214,8 @@ int part_SetStringIndex(){
} }
int part_goto(){ int part_goto(){
u64 target = 0; int target = 0;
if (parseJmpInput(argv[0], &target)) if (parseIntInput(argv[0], &target))
return -1; return -1;
f_lseek(&scriptin, target); f_lseek(&scriptin, target);
return 0; return 0;
@@ -510,12 +524,17 @@ int part_clearscreen(){
return 0; return 0;
} }
int part_getPos(){
return (int)f_tell(&scriptin);
}
str_fnc_struct functions[] = { str_fnc_struct functions[] = {
{"printf", part_printf, 1}, {"printf", part_printf, 1},
{"printInt", part_print_int, 1}, {"printInt", part_print_int, 1},
{"setPrintPos", part_setPrintPos, 2}, {"setPrintPos", part_setPrintPos, 2},
{"clearscreen", part_clearscreen, 0}, {"clearscreen", part_clearscreen, 0},
{"if", part_if, 1}, {"if", part_if, 1},
{"if", part_if_args, 3}, // function overloading
{"math", part_Math, 3}, {"math", part_Math, 3},
{"check", part_Check, 3}, {"check", part_Check, 3},
{"setInt", part_SetInt, 1}, {"setInt", part_SetInt, 1},
@@ -542,6 +561,7 @@ str_fnc_struct functions[] = {
{"mmc_mount", part_MountMMC, 1}, {"mmc_mount", part_MountMMC, 1},
{"mmc_dumpPart", part_mmc_dumpPart, 2}, {"mmc_dumpPart", part_mmc_dumpPart, 2},
{"mmc_restorePart", part_mmc_restorePart, 1}, {"mmc_restorePart", part_mmc_restorePart, 1},
{"getPosition", part_getPos, 0},
{"pause", part_Pause, 0}, {"pause", part_Pause, 0},
{"wait", part_Wait, 1}, {"wait", part_Wait, 1},
{"exit", part_Exit, 0}, {"exit", part_Exit, 0},
@@ -552,12 +572,10 @@ int run_function(char *func_name, int *out){
for (u32 i = 0; functions[i].key != NULL; i++){ for (u32 i = 0; functions[i].key != NULL; i++){
if (!strcmp(functions[i].key, func_name)){ if (!strcmp(functions[i].key, func_name)){
if (argc != functions[i].arg_count) if (argc != functions[i].arg_count)
return -2; continue;
*out = functions[i].value(); *out = functions[i].value();
if (*out < 0) return (*out < 0) ? -1 : 0;
return -1;
return 0;
} }
} }
return -1; return -1;

View File

@@ -70,7 +70,7 @@ u32 splitargs(char* in) {
} }
i--; i--;
} }
else if (in[i] >= '0' && in[i] <= '9') else if ((in[i] >= '0' && in[i] <= '9') || (in[i] >= '<' && in[i] <= '>') || in[i] == '+' || in[i] == '-' || in[i] == '*' || in[i] == '/')
argv[curcount][current++] = in[i]; argv[curcount][current++] = in[i];
else if (in[i] == '"') { else if (in[i] == '"') {
i++; i++;
@@ -201,6 +201,7 @@ void mainparser(){
getnextvalidchar(); getnextvalidchar();
} }
/*
if (currentchar == '?'){ if (currentchar == '?'){
char *jumpname; char *jumpname;
jumpname = readtilchar(';', ' '); jumpname = readtilchar(';', ' ');
@@ -209,6 +210,7 @@ void mainparser(){
getfollowingchar('\n'); getfollowingchar('\n');
return; return;
} }
*/
functionparser(); functionparser();
@@ -301,7 +303,7 @@ void runScript(char *path){
f_close(&scriptin); f_close(&scriptin);
str_int_clear(); str_int_clear();
str_jmp_clear(); //str_jmp_clear();
str_str_clear(); str_str_clear();
free(path_local); free(path_local);
//btn_wait(); //btn_wait();

View File

@@ -17,7 +17,7 @@
static dict_str_int *str_int_table = NULL; static dict_str_int *str_int_table = NULL;
static dict_str_str *str_str_table = NULL; static dict_str_str *str_str_table = NULL;
static dict_str_loc *str_jmp_table = NULL; //static dict_str_loc *str_jmp_table = NULL;
int str_int_add(char *key, int value){ int str_int_add(char *key, int value){
char *key_local; char *key_local;
@@ -91,7 +91,7 @@ void str_int_printall(){
temp = temp->next; temp = temp->next;
} }
} }
/*
int str_jmp_add(char *key, u64 value){ int str_jmp_add(char *key, u64 value){
char *key_local; char *key_local;
dict_str_loc *keyvaluepair; dict_str_loc *keyvaluepair;
@@ -161,6 +161,7 @@ void str_jmp_clear(){
} }
str_jmp_table = NULL; str_jmp_table = NULL;
} }
*/
int str_str_add(char *key, char *value){ int str_str_add(char *key, char *value){
char *key_local, *value_local; char *key_local, *value_local;

View File

@@ -23,9 +23,11 @@ int str_int_add(char *key, int value);
int str_int_find(char *key, int *out); int str_int_find(char *key, int *out);
void str_int_clear(); void str_int_clear();
void str_int_printall(); void str_int_printall();
/*
int str_jmp_add(char *key, u64 value); int str_jmp_add(char *key, u64 value);
int str_jmp_find(char *key, u64 *out); int str_jmp_find(char *key, u64 *out);
void str_jmp_clear(); void str_jmp_clear();
*/
int str_str_add(char *key, char *value); int str_str_add(char *key, char *value);
int str_str_find(char *key, char **out); int str_str_find(char *key, char **out);
int str_str_index(int index, char **out); int str_str_index(int index, char **out);