diff --git a/src/libleo/leoc2ecc.c b/src/libleo/leoc2ecc.c index d9026ba..5aee5bb 100644 --- a/src/libleo/leoc2ecc.c +++ b/src/libleo/leoc2ecc.c @@ -1,9 +1,38 @@ #include "common.h" +//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") @@ -13,6 +42,16 @@ #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])]; +} -#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 9183525..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; @@ -149,6 +150,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; @@ -199,6 +202,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;