diff --git a/README.md b/README.md
index ee45b0ce..29cce5d8 100644
--- a/README.md
+++ b/README.md
@@ -1,4 +1,4 @@
-# banjo (99.3598%)
+# banjo (99.3923%)
@@ -28,7 +28,6 @@ Be sure to check scratch "family" for any progress that may not be reflected her
| core2/code_12F30.c | func_80299EC0 | [Ar62G](https://decomp.me/scratch/Ar62G) | 77.65% |
| core2/code_7AF80.c | func_80307948 | [zd8KD](https://decomp.me/scratch/zd8KD) | 85.40% |
| core2/code_87E30.c | gcdialog_update | [cPns0](https://decomp.me/scratch/cPns0) | 92.23% |
-| core2/code_98CB0.c | func_8031FC40 | [m2Bd9](https://decomp.me/scratch/m2Bd9) | 99.57% | address scrambling and unscrambling |
| core2/code_B9770.c | func_80340BE4 | [FXyYS](https://decomp.me/scratch/FXyYS) | 65.91% | spline function
| core2/code_B9770.c | func_803411B0 | [rHkDu](https://decomp.me/scratch/rHkDu) | 87.70% | spline function
diff --git a/progress/progress_core2.svg b/progress/progress_core2.svg
index e40953f2..673f0ed1 100644
--- a/progress/progress_core2.svg
+++ b/progress/progress_core2.svg
@@ -17,7 +17,7 @@
core2
- 98.8842%
- 98.8842%
+ 98.9409%
+ 98.9409%
\ No newline at end of file
diff --git a/progress/progress_total.svg b/progress/progress_total.svg
index 2562f664..6f6e28b0 100644
--- a/progress/progress_total.svg
+++ b/progress/progress_total.svg
@@ -17,7 +17,7 @@
Banjo-Kazooie (us.v10)
- 99.3598%
- 99.3598%
+ 99.3923%
+ 99.3923%
\ No newline at end of file
diff --git a/src/core2/code_98CB0.c b/src/core2/code_98CB0.c
index 21e5e79f..8b53cc14 100644
--- a/src/core2/code_98CB0.c
+++ b/src/core2/code_98CB0.c
@@ -41,26 +41,19 @@ u8 D_803831F8[0x21]; //copy of D_803831D0
/* .code */
-#ifndef NONMATCHING
-#pragma GLOBAL_ASM("asm/nonmatchings/core2/code_98CB0/func_8031FC40.s")
-#else
void func_8031FC40(void) {
- s32 scrambled_ptr;
+ s32 *scrambled_ptr;
s32 *unscrambled_ptr;
- s32 temp_a1;
- s32 temp_lo;
- s32 temp_t0;
- s32 temp_t1;
- s32 temp_a2;
- s32 temp_t9;
- s32 var_a0;
- u8* b_ptr;
- s32 var_t3;
- u32 var_v0 = 0x17536C34;
- u32 var_v1 = 0;
-
+ u32 a1;
+ s32 t0;
+ s32 t1;
+ u32 a0;
+ u8 *ptr;
+ u32 v0 = 0x17536C34;
+ u32 v1;
+
//obsucre address
- temp_t0 = (((s32)&D_803831A0.unk8 & 0xE0000000) >> 15) +
+ t0 = (((s32)&D_803831A0.unk8 & 0xE0000000) >> 15) +
(((s32)&D_803831A0.unk8 & 0x1FC00000) >> 22) +
(((s32)&D_803831A0.unk8 & 0x00300000) << 10) +
(((s32)&D_803831A0.unk8 & 0x000F0000) << 7) +
@@ -70,30 +63,26 @@ void func_8031FC40(void) {
(((s32)&D_803831A0.unk8 & 0x00000060) << 4) +
(((s32)&D_803831A0.unk8 & 0x00000018) << 18) +
(((s32)&D_803831A0.unk8 & 0x00000007) << 11);
-
+
//unobscure address
- temp_t9 = (temp_t0 & 0x38000000) / (1 << 24);
- temp_t1 = ((temp_t0 & 0x1E0600) << 0xB) | ((s32) (temp_t0 & 0x603800) / 8);
- temp_a1 = (((temp_t0 & 0x1C07F) << 0xF) + ((u32) (temp_t0 & 0xC7800000) >> 0x11)) | (temp_t9 + ((s32) (temp_t0 & 0x180) >> 6)); \
- var_a0 = ((temp_a1 & 0x3FE000) << 7)
- | (((temp_t1 >> 8) & 7) + ((temp_a1 << 0xA) & 0xFF800))
- | ((((u32) (temp_t1 & 0xF0000000) >> 0x15) + (temp_a1 & 0xE0000000)) ^ ((s32) ((temp_t1 /0x40) & 0xF000) >> 9));
+ t1 = ((t0 & 0x1E0600) << 0xB) | ((s32) (t0 & 0x603800) / 8);
+ a0 = (((t0 & 0x1C07F) << 0xF) + ((u32) (t0 & 0xC7800000) >> 0x11)) | (((t0 & 0x38000000) / (1 << 24)) + ((s32) (t0 & 0x180) >> 6)); \
+ a1 = a0; \
+ a0 = (((a1 & 0x3FE000) << 7)
+ | (((t1 >> 8) & 7) + ((a1 << 0xA) & 0xFF800))
+ | ((((u32) (t1 & 0xF0000000) >> 0x15) + (a1 & 0xE0000000)) ^ ((s32) ((t1 /0x40) & 0xF000) >> 9)));
//calculate checksum
- temp_a1 = 0x25;
- for(var_v1 = 0; var_v1 < temp_a1; var_v1++){
- b_ptr = (u8*)(var_a0 + var_v1);
- var_v0 = (((var_v0 - *b_ptr) & 0x1F) << 0xF) ^ ((*b_ptr* 0x1B) + (var_v0 >> 0xB));
+ ptr = (u8*)(a0);
+ a1 = 0x25;
+ for(v1 = 0; v1 < a1; v1++){
+ v0 = (((v0 - ptr[v1]) & 0x1F) << 0xF) ^ ((ptr[v1]* 0x1B) + (v0 >> 0xB));
}
- scrambled_ptr = (((s32) &D_803831A0 & 0x55555555) * 2) + ((u32) ((s32) &D_803831A0 & 0xAAAAAAAA) >> 1);
- unscrambled_ptr = (((scrambled_ptr & 0x55555555) * 2) | ((u32) (scrambled_ptr & 0xAAAAAAAA) >> 1));
- *unscrambled_ptr = var_v0;
- if(!var_a0);
+ scrambled_ptr = (s32 *) ((((s32) &D_803831A0 & 0x55555555) << 1) + (((s32) &D_803831A0 & 0xAAAAAAAA) >> 1));
+ unscrambled_ptr = (s32 *) ((((s32) scrambled_ptr & 0x55555555) << 1) | (((s32) scrambled_ptr & 0xAAAAAAAA) >> 1));
+ *unscrambled_ptr = v0;
}
-#endif
-
-
u32 func_8031FE40(void) {
u8 *obscured_addr;