Created
June 19, 2025 18:03
-
-
Save Lusamine/5def7d05336f993457f89b22dd5c64b2 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| __int32 __fastcall camp_get_random_behavior_enum(__int64 a1) | |
| { | |
| __int64 v2; // x0 | |
| __int64 v3; // x20 | |
| int *v4; // x8 | |
| unsigned __int16 *v5; // x9 | |
| float v6; // s9 | |
| __int64 v7; // x9 | |
| __int64 v8; // x20 | |
| int *v9; // x8 | |
| unsigned __int16 *v10; // x9 | |
| float v11; // s8 | |
| __int64 v12; // x9 | |
| __int64 v13; // x20 | |
| int *v14; // x8 | |
| unsigned __int16 *v15; // x9 | |
| float v16; // s10 | |
| __int64 v17; // x9 | |
| char v18; // w0 | |
| float v19; // s0 | |
| float v20; // s11 | |
| float v21; // s8 | |
| float rand_float; // s0 | |
| if ( !sub_710121ACF0(*(_QWORD *)(a1 + 160)) ) | |
| return 1; | |
| v2 = *(_QWORD *)(a1 + 160); | |
| if ( !v2 ) | |
| return 1; | |
| if ( sub_710121ACF0(v2) ) | |
| v3 = *(_QWORD *)(a1 + 160); | |
| else | |
| v3 = 0LL; | |
| sub_710121ACF0(v3); | |
| v4 = *(int **)(v3 + 304); | |
| v5 = (unsigned __int16 *)((char *)v4 - *v4); | |
| v6 = 0.0; | |
| if ( *v5 >= 15u ) | |
| { | |
| v7 = v5[7]; | |
| if ( v7 ) | |
| v6 = (float)*(int *)((char *)v4 + v7); | |
| } | |
| if ( sub_710121ACF0(*(_QWORD *)(a1 + 160)) ) | |
| v8 = *(_QWORD *)(a1 + 160); | |
| else | |
| v8 = 0LL; | |
| sub_710121ACF0(v8); | |
| v9 = *(int **)(v8 + 304); | |
| v10 = (unsigned __int16 *)((char *)v9 - *v9); | |
| v11 = 0.0; | |
| if ( *v10 >= 9u ) | |
| { | |
| v12 = v10[4]; | |
| if ( v12 ) | |
| v11 = (float)*(int *)((char *)v9 + v12); | |
| } | |
| if ( sub_710121ACF0(*(_QWORD *)(a1 + 160)) ) | |
| v13 = *(_QWORD *)(a1 + 160); | |
| else | |
| v13 = 0LL; | |
| sub_710121ACF0(v13); | |
| v14 = *(int **)(v13 + 304); | |
| v15 = (unsigned __int16 *)((char *)v14 - *v14); | |
| v16 = 0.0; | |
| if ( *v15 >= 7u ) | |
| { | |
| v17 = v15[3]; | |
| if ( v17 ) | |
| v16 = (float)*(int *)((char *)v14 + v17); | |
| } | |
| v18 = sub_71011B7310(a1); | |
| v19 = v11 + v11; | |
| if ( (v18 & 1) == 0 ) | |
| v19 = v11; | |
| v20 = v6 + v19; | |
| v21 = (float)(v6 + v19) + v16; | |
| rand_float = get_rand_float(global_struct->main_rng, v21); | |
| if ( rand_float <= v6 ) // $s9 = 75, $s11 = 85, $s8 = 100, varies per species | |
| // Urshifu: (walk around) $s9 = 50, (run around) $s11 = 65, (stand and stretch) $s8 = 100 | |
| return 1; | |
| if ( rand_float <= v20 ) | |
| return 2; | |
| if ( rand_float > v21 ) | |
| return 1; | |
| return 3; | |
| } | |
| ---- | |
| .text:00000071011B7190 ; =============== S U B R O U T I N E ======================================= | |
| .text:00000071011B7190 | |
| .text:00000071011B7190 ; Attributes: bp-based frame | |
| .text:00000071011B7190 | |
| .text:00000071011B7190 ; __int32 __fastcall camp_get_random_behavior_enum(__int64) | |
| .text:00000071011B7190 camp_get_random_behavior_enum ; CODE XREF: sub_7101257710+8C↓p | |
| .text:00000071011B7190 | |
| .text:00000071011B7190 var_30 = -0x30 | |
| .text:00000071011B7190 var_20 = -0x20 | |
| .text:00000071011B7190 var_10 = -0x10 | |
| .text:00000071011B7190 var_s0 = 0 | |
| .text:00000071011B7190 | |
| .text:00000071011B7190 STP D11, D10, [SP,#-0x10+var_30]! | |
| .text:00000071011B7194 STP D9, D8, [SP,#0x30+var_20] | |
| .text:00000071011B7198 STP X20, X19, [SP,#0x30+var_10] | |
| .text:00000071011B719C STP X29, X30, [SP,#0x30+var_s0] | |
| .text:00000071011B71A0 ADD X29, SP, #0x30 | |
| .text:00000071011B71A4 MOV X19, X0 | |
| .text:00000071011B71A8 LDR X0, [X0,#0xA0] | |
| .text:00000071011B71AC BL sub_710121ACF0 | |
| .text:00000071011B71B0 TBZ W0, #0, loc_71011B72E8 | |
| .text:00000071011B71B4 LDR X0, [X19,#0xA0] | |
| .text:00000071011B71B8 CBZ X0, loc_71011B72E8 | |
| .text:00000071011B71BC BL sub_710121ACF0 | |
| .text:00000071011B71C0 TBZ W0, #0, loc_71011B71CC | |
| .text:00000071011B71C4 LDR X20, [X19,#0xA0] | |
| .text:00000071011B71C8 B loc_71011B71D0 | |
| .text:00000071011B71CC ; --------------------------------------------------------------------------- | |
| .text:00000071011B71CC | |
| .text:00000071011B71CC loc_71011B71CC ; CODE XREF: camp_get_random_behavior_enum+30↑j | |
| .text:00000071011B71CC MOV X20, XZR | |
| .text:00000071011B71D0 | |
| .text:00000071011B71D0 loc_71011B71D0 ; CODE XREF: camp_get_random_behavior_enum+38↑j | |
| .text:00000071011B71D0 MOV X0, X20 | |
| .text:00000071011B71D4 BL sub_710121ACF0 | |
| .text:00000071011B71D8 LDR X8, [X20,#0x130] | |
| .text:00000071011B71DC LDRSW X9, [X8] | |
| .text:00000071011B71E0 SUB X9, X8, X9 | |
| .text:00000071011B71E4 LDRH W10, [X9] | |
| .text:00000071011B71E8 FMOV S9, WZR | |
| .text:00000071011B71EC CMP W10, #0xF | |
| .text:00000071011B71F0 B.CC loc_71011B7204 | |
| .text:00000071011B71F4 LDRH W9, [X9,#0xE] | |
| .text:00000071011B71F8 CBZ X9, loc_71011B7204 | |
| .text:00000071011B71FC LDR S0, [X8,X9] | |
| .text:00000071011B7200 SCVTF S9, S0 | |
| .text:00000071011B7204 | |
| .text:00000071011B7204 loc_71011B7204 ; CODE XREF: camp_get_random_behavior_enum+60↑j | |
| .text:00000071011B7204 ; camp_get_random_behavior_enum+68↑j | |
| .text:00000071011B7204 LDR X0, [X19,#0xA0] | |
| .text:00000071011B7208 BL sub_710121ACF0 | |
| .text:00000071011B720C TBZ W0, #0, loc_71011B7218 | |
| .text:00000071011B7210 LDR X20, [X19,#0xA0] | |
| .text:00000071011B7214 B loc_71011B721C | |
| .text:00000071011B7218 ; --------------------------------------------------------------------------- | |
| .text:00000071011B7218 | |
| .text:00000071011B7218 loc_71011B7218 ; CODE XREF: camp_get_random_behavior_enum+7C↑j | |
| .text:00000071011B7218 MOV X20, XZR | |
| .text:00000071011B721C | |
| .text:00000071011B721C loc_71011B721C ; CODE XREF: camp_get_random_behavior_enum+84↑j | |
| .text:00000071011B721C MOV X0, X20 | |
| .text:00000071011B7220 BL sub_710121ACF0 | |
| .text:00000071011B7224 LDR X8, [X20,#0x130] | |
| .text:00000071011B7228 LDRSW X9, [X8] | |
| .text:00000071011B722C SUB X9, X8, X9 | |
| .text:00000071011B7230 LDRH W10, [X9] | |
| .text:00000071011B7234 FMOV S8, WZR | |
| .text:00000071011B7238 CMP W10, #9 | |
| .text:00000071011B723C B.CC loc_71011B7250 | |
| .text:00000071011B7240 LDRH W9, [X9,#8] | |
| .text:00000071011B7244 CBZ X9, loc_71011B7250 | |
| .text:00000071011B7248 LDR S0, [X8,X9] | |
| .text:00000071011B724C SCVTF S8, S0 | |
| .text:00000071011B7250 | |
| .text:00000071011B7250 loc_71011B7250 ; CODE XREF: camp_get_random_behavior_enum+AC↑j | |
| .text:00000071011B7250 ; camp_get_random_behavior_enum+B4↑j | |
| .text:00000071011B7250 LDR X0, [X19,#0xA0] | |
| .text:00000071011B7254 BL sub_710121ACF0 | |
| .text:00000071011B7258 TBZ W0, #0, loc_71011B7264 | |
| .text:00000071011B725C LDR X20, [X19,#0xA0] | |
| .text:00000071011B7260 B loc_71011B7268 | |
| .text:00000071011B7264 ; --------------------------------------------------------------------------- | |
| .text:00000071011B7264 | |
| .text:00000071011B7264 loc_71011B7264 ; CODE XREF: camp_get_random_behavior_enum+C8↑j | |
| .text:00000071011B7264 MOV X20, XZR | |
| .text:00000071011B7268 | |
| .text:00000071011B7268 loc_71011B7268 ; CODE XREF: camp_get_random_behavior_enum+D0↑j | |
| .text:00000071011B7268 MOV X0, X20 | |
| .text:00000071011B726C BL sub_710121ACF0 | |
| .text:00000071011B7270 LDR X8, [X20,#0x130] | |
| .text:00000071011B7274 LDRSW X9, [X8] | |
| .text:00000071011B7278 SUB X9, X8, X9 | |
| .text:00000071011B727C LDRH W10, [X9] | |
| .text:00000071011B7280 FMOV S10, WZR | |
| .text:00000071011B7284 CMP W10, #7 | |
| .text:00000071011B7288 B.CC loc_71011B729C | |
| .text:00000071011B728C LDRH W9, [X9,#6] | |
| .text:00000071011B7290 CBZ X9, loc_71011B729C | |
| .text:00000071011B7294 LDR S0, [X8,X9] | |
| .text:00000071011B7298 SCVTF S10, S0 | |
| .text:00000071011B729C | |
| .text:00000071011B729C loc_71011B729C ; CODE XREF: camp_get_random_behavior_enum+F8↑j | |
| .text:00000071011B729C ; camp_get_random_behavior_enum+100↑j | |
| .text:00000071011B729C MOV X0, X19 | |
| .text:00000071011B72A0 BL sub_71011B7310 | |
| .text:00000071011B72A4 FADD S0, S8, S8 | |
| .text:00000071011B72A8 TST W0, #1 | |
| .text:00000071011B72AC FCSEL S0, S0, S8, NE | |
| .text:00000071011B72B0 FADD S11, S9, S0 | |
| .text:00000071011B72B4 ADRP X8, #off_7102610848@PAGE | |
| .text:00000071011B72B8 LDR X8, [X8,#off_7102610848@PAGEOFF] | |
| .text:00000071011B72BC LDR X8, [X8] | |
| .text:00000071011B72C0 LDR X0, [X8,#0x98] | |
| .text:00000071011B72C4 FADD S8, S11, S10 | |
| .text:00000071011B72C8 MOV V0.16B, V8.16B | |
| .text:00000071011B72CC BL get_rand_float | |
| .text:00000071011B72D0 FCMP S0, S9 | |
| .text:00000071011B72D4 B.LS loc_71011B72E8 | |
| .text:00000071011B72D8 FCMP S0, S11 | |
| .text:00000071011B72DC B.LS loc_71011B7300 | |
| .text:00000071011B72E0 FCMP S0, S8 | |
| .text:00000071011B72E4 B.LS loc_71011B7308 | |
| .text:00000071011B72E8 | |
| .text:00000071011B72E8 loc_71011B72E8 ; CODE XREF: camp_get_random_behavior_enum+20↑j | |
| .text:00000071011B72E8 ; camp_get_random_behavior_enum+28↑j ... | |
| .text:00000071011B72E8 MOV W0, #1 | |
| .text:00000071011B72EC | |
| .text:00000071011B72EC loc_71011B72EC ; CODE XREF: camp_get_random_behavior_enum+174↓j | |
| .text:00000071011B72EC ; camp_get_random_behavior_enum+17C↓j | |
| .text:00000071011B72EC LDP D9, D8, [SP,#0x30+var_20] | |
| .text:00000071011B72F0 LDP X29, X30, [SP,#0x30+var_s0] | |
| .text:00000071011B72F4 LDP X20, X19, [SP,#0x30+var_10] | |
| .text:00000071011B72F8 LDP D11, D10, [SP+0x30+var_30],#0x40 | |
| .text:00000071011B72FC RET | |
| .text:00000071011B7300 ; --------------------------------------------------------------------------- | |
| .text:00000071011B7300 | |
| .text:00000071011B7300 loc_71011B7300 ; CODE XREF: camp_get_random_behavior_enum+14C↑j | |
| .text:00000071011B7300 MOV W0, #2 | |
| .text:00000071011B7304 B loc_71011B72EC | |
| .text:00000071011B7308 ; --------------------------------------------------------------------------- | |
| .text:00000071011B7308 | |
| .text:00000071011B7308 loc_71011B7308 ; CODE XREF: camp_get_random_behavior_enum+154↑j | |
| .text:00000071011B7308 MOV W0, #3 | |
| .text:00000071011B730C B loc_71011B72EC | |
| .text:00000071011B730C ; End of function camp_get_random_behavior_enum |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment