From 9124ca1c183ee2ac693d08864637522a0abc2679 Mon Sep 17 00:00:00 2001 From: LuigiBlood Date: Wed, 2 Aug 2023 21:49:04 +0200 Subject: [PATCH 1/4] add libleo bootdisk and bootstrap symbols --- tools/symbol_addrs.txt | 3 +++ 1 file changed, 3 insertions(+) diff --git a/tools/symbol_addrs.txt b/tools/symbol_addrs.txt index 9183525..6b4433e 100644 --- a/tools/symbol_addrs.txt +++ b/tools/symbol_addrs.txt @@ -199,6 +199,9 @@ LEOwrite_pointer = 0x801006C4; LEOc2ctrl_que_buf = 0x801006F0; LEOasic_bm_ctl_shadow = 0x801006CC; LEOasic_seq_ctl_shadow = 0x801006D0; +LeoBootGame = 0x8000B8B0; +__LeoBootGame2 = 0x8000B9EC; +__LeoBootGame3 = 0x8000BD10; leomain = 0x80051EC0; lldiv = 0x80064B10; main_func = 0x80000530; From 1080dcb34a853b686140f11c085fe2a956e54803 Mon Sep 17 00:00:00 2001 From: LuigiBlood Date: Thu, 3 Aug 2023 14:38:19 +0200 Subject: [PATCH 2/4] leoAlpha_div match --- src/libleo/leoc2ecc.c | 11 ++++++++++- tools/symbol_addrs.txt | 2 ++ 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/src/libleo/leoc2ecc.c b/src/libleo/leoc2ecc.c index d9026ba..e2dc1ce 100644 --- a/src/libleo/leoc2ecc.c +++ b/src/libleo/leoc2ecc.c @@ -1,5 +1,9 @@ #include "common.h" +//Tables to add here +extern u8 ganlog[512]; +extern u8 glog[512]; + #pragma GCC diagnostic push #pragma GCC diagnostic ignored "-Wunknown-pragmas" @@ -15,4 +19,9 @@ #pragma GLOBAL_ASM("asm/nonmatchings/libleo/leoc2ecc/leoAlpha_mult.s") -#pragma GLOBAL_ASM("asm/nonmatchings/libleo/leoc2ecc/leoAlpha_div.s") +s32 leoAlpha_div(s32 i, s32 k) { + if ((i == 0) || (k == 0)) { + return 0; + } + return ganlog[0xFF + (glog[i] - glog[k])]; +} diff --git a/tools/symbol_addrs.txt b/tools/symbol_addrs.txt index 6b4433e..e8b19ed 100644 --- a/tools/symbol_addrs.txt +++ b/tools/symbol_addrs.txt @@ -149,6 +149,8 @@ leoC2_3_ecc = 0x80053AF0; leoC2_4_ecc = 0x80053ED8; leoAlpha_mult = 0x80054774; leoAlpha_div = 0x800547B8; +ganlog = 0x8007DD50; +glog = 0x8007DF50; leoAnalize_asic_status = 0x80052D00; leoChk_asic_ready = 0x80052E0C; leoChk_cur_drvmode = 0x80053540; From 4d0c230fc0210e196287c59c322643c47d652061 Mon Sep 17 00:00:00 2001 From: LuigiBlood Date: Thu, 3 Aug 2023 14:43:11 +0200 Subject: [PATCH 3/4] leoAlpha_mult match --- src/libleo/leoc2ecc.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/libleo/leoc2ecc.c b/src/libleo/leoc2ecc.c index e2dc1ce..b872658 100644 --- a/src/libleo/leoc2ecc.c +++ b/src/libleo/leoc2ecc.c @@ -17,7 +17,12 @@ extern u8 glog[512]; #pragma GLOBAL_ASM("asm/nonmatchings/libleo/leoc2ecc/leoC2_4_ecc.s") -#pragma GLOBAL_ASM("asm/nonmatchings/libleo/leoc2ecc/leoAlpha_mult.s") +s32 leoAlpha_mult(s32 i, s32 k) { + if ((i == 0) || (k == 0)) { + return 0; + } + return ganlog[(glog[i] + glog[k])]; +} s32 leoAlpha_div(s32 i, s32 k) { if ((i == 0) || (k == 0)) { From 2168f435e91aa8da84c8f33ab8de0caf64485f45 Mon Sep 17 00:00:00 2001 From: LuigiBlood Date: Thu, 3 Aug 2023 15:22:05 +0200 Subject: [PATCH 4/4] leoC2_Correction match (jtbl) --- src/libleo/leoc2ecc.c | 25 +++++++++++++++++++++++++ tools/symbol_addrs.txt | 1 + 2 files changed, 26 insertions(+) diff --git a/src/libleo/leoc2ecc.c b/src/libleo/leoc2ecc.c index b872658..5aee5bb 100644 --- a/src/libleo/leoc2ecc.c +++ b/src/libleo/leoc2ecc.c @@ -3,11 +3,36 @@ //Tables to add here extern u8 ganlog[512]; extern u8 glog[512]; +//To be determined, should be a struct +extern u8 LEOc2_param[16]; #pragma GCC diagnostic push #pragma GCC diagnostic ignored "-Wunknown-pragmas" +#ifdef NON_MATCHING +s32 leoC2_Correction(void) { + switch (LEOc2_param[12]) { + case 1: + leoC2_single_ecc(); + return 0; + case 2: + leoC2_double_ecc(); + return 0; + case 3: + leoC2_3_ecc(); + return 0; + case 4: + leoC2_4_ecc(); + return 0; + default: + return -1; + case 0: + return 0; + } +} +#else #pragma GLOBAL_ASM("asm/nonmatchings/libleo/leoc2ecc/leoC2_Correction.s") +#endif #pragma GLOBAL_ASM("asm/nonmatchings/libleo/leoc2ecc/leoC2_single_ecc.s") diff --git a/tools/symbol_addrs.txt b/tools/symbol_addrs.txt index e8b19ed..7f2b70b 100644 --- a/tools/symbol_addrs.txt +++ b/tools/symbol_addrs.txt @@ -142,6 +142,7 @@ leoDiskStack = 0x801020D0; LEOdisk_type = 0x801006D8; LEO_country_code = 0x801006EC; LEOrw_flags = 0x801006D6; +LEOc2_param = 0x80101080; leoC2_Correction = 0x80053710; leoC2_single_ecc = 0x8005379C; leoC2_double_ecc = 0x80053870;