{"type": "func", "start": 4031344, "end": 4031558, "name": "GJGameLevel::saveNewScore", "pseudocode": "// \n// GJGameLevel::saveNewScore from 0x3d8370 to 0x3d8446 (214 bytes)\n// \n// 5 xrefs:\n// > PlayLayer::levelComplete @ 0x3136a4\n// > PlayLayer::levelComplete @ 0x3136f2\n// > PlayLayer::levelComplete @ 0x313742\n// > GJGameLevel::handleStatsConflict @ 0x3d854c\n// > GJGameLevel::handleStatsConflict @ 0x3d859a\n// \n// This function is hookable on this platform!\n// \n// Using BromaIDA 8.0.0 @ https://github.com/Stazzical/BromaIDA\n// Using bindings at commit ba9f177b at Thu Jul 16 22:52:06 2026 from https://github.com/geode-sdk/bindings\n// \n\nint __fastcall GJGameLevel::saveNewScore(\n        GJGameLevel *a1,\n        int a2,\n        int a3,\n        int a4,\n        int a5,\n        int a6,\n        int a7,\n        unsigned __int8 a8)\n{\n  int v11; // r5\n  int m_bestTime; // r2\n  int m_clicksPoints; // r2\n  int m_ticksPoints; // r2\n  int m_coinsPoints; // r2\n  int v16; // r1\n  int m_bestPoints; // r2\n  int m_coinsTime; // r2\n  int m_clicksTime; // r2\n  int m_ticksTime; // r3\n  int v22; // [sp+0h] [bp-14h]\n  int v23; // [sp+4h] [bp-10h]\n  int v24; // [sp+8h] [bp-Ch]\n\n  v11 = a8;\n  if ( a3 )\n  {\n    if ( a2 )\n    {\n      m_bestPoints = a1->m_bestPoints;\n      if ( a2 > m_bestPoints || !m_bestPoints || a8 )\n      {\n        m_coinsTime = a1->m_coinsTime;\n        v11 = 1;\n        a1->m_ticksPoints = a4;\n        a1->m_clicksPoints = a5;\n        v22 = m_coinsTime;\n        a1->m_coinsPoints = a6;\n        m_clicksTime = a1->m_clicksTime;\n        m_ticksTime = a1->m_ticksTime;\n        a1->m_bestPoints = a2;\n        a1->m_platformerSeed = generateBestHash(a1->m_bestTime, a2, m_clicksTime, m_ticksTime, v22, a5, a4, a6);\n        sub_775D40(&a1->m_inputsPoints, a7);\n        a1->m_savedPoints = 1;\n      }\n    }\n    else\n    {\n      v11 = 0;\n    }\n  }\n  else if ( a2 <= 0 || (m_bestTime = a1->m_bestTime, a2 >= m_bestTime) && m_bestTime && !a8 )\n  {\n    v11 = 0;\n  }\n  else\n  {\n    m_clicksPoints = a1->m_clicksPoints;\n    a1->m_ticksTime = a4;\n    v11 = 1;\n    a1->m_clicksTime = a5;\n    v23 = m_clicksPoints;\n    m_ticksPoints = a1->m_ticksPoints;\n    a1->m_coinsTime = a6;\n    v24 = m_ticksPoints;\n    m_coinsPoints = a1->m_coinsPoints;\n    v16 = a1->m_bestPoints;\n    a1->m_bestTime = a2;\n    a1->m_platformerSeed = generateBestHash(a2, v16, a5, a4, a6, v23, v24, m_coinsPoints);\n    sub_775D40(&a1->m_inputsTime, a7);\n    a1->m_savedTime = 1;\n  }\n  GJGameLevel::storeNewLocalScore(a1, a2, a3);\n  return v11;\n}", "assembly": "; \n; GJGameLevel::saveNewScore from 0x3d8370 to 0x3d8446 (214 bytes)\n; \n; 5 xrefs:\n; > PlayLayer::levelComplete @ 0x3136a4\n; > PlayLayer::levelComplete @ 0x3136f2\n; > PlayLayer::levelComplete @ 0x313742\n; > GJGameLevel::handleStatsConflict @ 0x3d854c\n; > GJGameLevel::handleStatsConflict @ 0x3d859a\n; \n; This function is hookable on this platform!\n; \n; Using BromaIDA 8.0.0 @ https:;github.com/Stazzical/BromaIDA\n; Using bindings at commit ba9f177b at Thu Jul 16 22:52:06 2026 from https:;github.com/geode-sdk/bindings\n; \n\nPUSH            {R4-R7,LR}                                             ; +0x0, 0x3d8370\nSUB             SP, SP, #0x14; int                                     ; +0x2, 0x3d8372\nMOV             R6, R1                                                 ; +0x4, 0x3d8374\nMOV             R4, R0                                                 ; +0x6, 0x3d8376\nLDR.W           LR, [SP,#0x14+arg_0]                                   ; +0x8, 0x3d8378\nMOV             R7, R2                                                 ; +0xc, 0x3d837c\nLDR             R1, [SP,#0x14+arg_4]                                   ; +0xe, 0x3d837e\nLDRB.W          R5, [SP,#0x14+arg_C]                                   ; +0x10, 0x3d8380\nCBNZ            R2, loc_3D83DE                                         ; +0x14, 0x3d8384\nCMP             R6, #0                                                 ; +0x16, 0x3d8386\nBLE             loc_3D8430                                             ; +0x18, 0x3d8388\nLDR.W           R2, [R0,#0x324]                                        ; +0x1a, 0x3d838a\nCMP             R6, R2                                                 ; +0x1e, 0x3d838e\nBLT             loc_3D8398                                             ; +0x20, 0x3d8390\nCBZ             R2, loc_3D8398                                         ; +0x22, 0x3d8392\nCMP             R5, #0                                                 ; +0x24, 0x3d8394\nBEQ             loc_3D8430                                             ; +0x26, 0x3d8396\nLDR.W           R2, [R4,#0x340]                                        ; +0x28, 0x3d8398\nMOV             R0, R6; int                                            ; +0x2c, 0x3d839c\nSTR.W           R3, [R4,#0x328]                                        ; +0x2e, 0x3d839e\nMOVS            R5, #1                                                 ; +0x32, 0x3d83a2\nSTR.W           LR, [R4,#0x32C]                                        ; +0x34, 0x3d83a4\nSTR             R2, [SP,#0x14+var_10]; int                             ; +0x38, 0x3d83a8\nLDR.W           R2, [R4,#0x33C]                                        ; +0x3a, 0x3d83aa\nSTR.W           R1, [R4,#0x330]                                        ; +0x3e, 0x3d83ae\nSTR             R1, [SP,#0x14+var_14]; int                             ; +0x42, 0x3d83b2\nSTR             R2, [SP,#0x14+var_C]; int                              ; +0x44, 0x3d83b4\nLDR.W           R2, [R4,#0x344]                                        ; +0x46, 0x3d83b6\nLDR.W           R1, [R4,#0x338]; int                                   ; +0x4a, 0x3d83ba\nSTR.W           R6, [R4,#0x324]                                        ; +0x4e, 0x3d83be\nSTR             R2, [SP,#0x14+var_8]; int                              ; +0x52, 0x3d83c2\nMOV             R2, LR; int                                            ; +0x54, 0x3d83c4\nBL              _Z16generateBestHashiiiiiiii; generateBestHash(int,int,int,int,int,int,int,int) ; +0x56, 0x3d83c6\nLDR             R1, [SP,#0x14+arg_8]                                   ; +0x5a, 0x3d83ca\nSTR.W           R0, [R4,#0x34C]                                        ; +0x5c, 0x3d83cc\nADD.W           R0, R4, #0x334                                         ; +0x60, 0x3d83d0\nBL              sub_775D40                                             ; +0x64, 0x3d83d4\nSTRB.W          R5, [R4,#0x358]                                        ; +0x68, 0x3d83d8\nB               loc_3D8436                                             ; +0x6c, 0x3d83dc\nCBZ             R6, loc_3D8434                                         ; +0x6e, 0x3d83de\nLDR.W           R2, [R0,#0x338]                                        ; +0x70, 0x3d83e0\nCMP             R6, R2                                                 ; +0x74, 0x3d83e4\nBGT             loc_3D83EC                                             ; +0x76, 0x3d83e6\nCBZ             R2, loc_3D83EC                                         ; +0x78, 0x3d83e8\nCBZ             R5, loc_3D8436                                         ; +0x7a, 0x3d83ea\nLDR.W           R2, [R4,#0x330]                                        ; +0x7c, 0x3d83ec\nMOVS            R5, #1                                                 ; +0x80, 0x3d83f0\nSTR.W           R3, [R4,#0x33C]                                        ; +0x82, 0x3d83f2\nSTR.W           LR, [R4,#0x340]                                        ; +0x86, 0x3d83f6\nSTMEA.W         SP, {R2,LR}                                            ; +0x8a, 0x3d83fa\nSTR.W           R1, [R4,#0x344]                                        ; +0x8e, 0x3d83fe\nSTR             R3, [SP,#0x14+var_C]; int                              ; +0x92, 0x3d8402\nSTR             R1, [SP,#0x14+var_8]; int                              ; +0x94, 0x3d8404\nMOV             R1, R6; int                                            ; +0x96, 0x3d8406\nLDR.W           R2, [R4,#0x32C]; int                                   ; +0x98, 0x3d8408\nLDR.W           R3, [R4,#0x328]; int                                   ; +0x9c, 0x3d840c\nSTR.W           R6, [R4,#0x338]                                        ; +0xa0, 0x3d8410\nLDR.W           R0, [R4,#0x324]; int                                   ; +0xa4, 0x3d8414\nBL              _Z16generateBestHashiiiiiiii; generateBestHash(int,int,int,int,int,int,int,int) ; +0xa8, 0x3d8418\nLDR             R1, [SP,#0x14+arg_8]                                   ; +0xac, 0x3d841c\nSTR.W           R0, [R4,#0x34C]                                        ; +0xae, 0x3d841e\nADD.W           R0, R4, #0x348                                         ; +0xb2, 0x3d8422\nBL              sub_775D40                                             ; +0xb6, 0x3d8426\nSTRB.W          R5, [R4,#0x359]                                        ; +0xba, 0x3d842a\nB               loc_3D8436                                             ; +0xbe, 0x3d842e\nMOV             R5, R7                                                 ; +0xc0, 0x3d8430\nB               loc_3D8436                                             ; +0xc2, 0x3d8432\nMOV             R5, R6                                                 ; +0xc4, 0x3d8434\nMOV             R0, R4; this                                           ; +0xc6, 0x3d8436\nMOV             R1, R6; int                                            ; +0xc8, 0x3d8438\nMOV             R2, R7; int                                            ; +0xca, 0x3d843a\nBL              _ZN11GJGameLevel18storeNewLocalScoreEii; GJGameLevel::storeNewLocalScore(int,int) ; +0xcc, 0x3d843c\nMOV             R0, R5                                                 ; +0xd0, 0x3d8440\nADD             SP, SP, #0x14                                          ; +0xd2, 0x3d8442\nPOP             {R4-R7,PC}                                             ; +0xd4, 0x3d8444", "xrefs": ["PlayLayer::levelComplete @ 0x3136a4", "PlayLayer::levelComplete @ 0x3136f2", "PlayLayer::levelComplete @ 0x313742", "GJGameLevel::handleStatsConflict @ 0x3d854c", "GJGameLevel::handleStatsConflict @ 0x3d859a"], "is_objc": false, "is_arm32": false, "is_arm64": false, "bida_info": "8.0.0 @ https://github.com/Stazzical/BromaIDA", "bindings_info": "commit ba9f177b at Thu Jul 16 22:52:06 2026 from https://github.com/geode-sdk/bindings"}