Advertisement
MattFiler

find_resource_index

Jan 23rd, 2022
580
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. undefined4 __thiscall
  2. CATHODE::ResourceRegistry::find_resource_index
  3.           (ResourceRegistry *this,ShortGuid *param_1,ShortGuid *param_2)
  4.  
  5. {
  6.   uint uVar1;
  7.   uint uVar2;
  8.   uint uVar3;
  9.   uint uVar4;
  10.   bool bVar5;
  11.   undefined4 uVar6;
  12.   long lVar7;
  13.   uint uVar8;
  14.   int iVar9;
  15.   uint uVar10;
  16.   uint uVar11;
  17.  
  18.   lVar7 = *(long *)(this + 8);
  19.   if (lVar7 != 0) {
  20.     uVar1 = *(uint *)param_1;
  21.     uVar2 = *(uint *)param_2;
  22.     if (*(int *)(lVar7 + 0xc) != 0) {
  23.       uVar3 = *(uint *)(lVar7 + 0xc);
  24.       uVar8 = uVar3;
  25.       if (uVar3 != 0) {
  26.         uVar8 = uVar3 | uVar3 >> 1;
  27.         uVar8 = uVar8 | uVar8 >> 2;
  28.         uVar8 = uVar8 | uVar8 >> 4;
  29.         uVar8 = uVar8 | uVar8 >> 8;
  30.         uVar8 = uVar8 | uVar8 >> 0x10;
  31.         uVar8 = ((uVar8 & 0xaaaaaaaa) >> 1) + (uVar8 & 0x55555555);
  32.         uVar8 = ((uVar8 & 0xcccccccc) >> 2) + (uVar8 & 0x33333333);
  33.         uVar8 = ((uVar8 & 0xf0f0f0f0) >> 4) + (uVar8 & 0xf0f0f0f);
  34.         uVar8 = ((uVar8 & 0xff00ff00) >> 8) + (uVar8 & 0xff00ff);
  35.         iVar9 = -((uVar8 >> 0x10) + (uVar8 & 0xffff));
  36.         if (iVar9 == 0) {
  37.           uVar8 = 0;
  38.         }
  39.         else {
  40.           uVar10 = 1 << (ulong)((iVar9 + 0x20U ^ 0x1f) & 0x1f);
  41.           uVar8 = uVar10 - 1;
  42.           do {
  43.             while( true ) {
  44.               uVar11 = uVar8;
  45.               if (uVar3 <= uVar8) {
  46.                 uVar11 = *(int *)(lVar7 + 0xc) - 1;
  47.               }
  48.               uVar10 = uVar10 >> 1;
  49.               uVar4 = *(uint *)(*(long *)(lVar7 + 0x10) + (ulong)uVar11 * 0xc + 4);
  50.               if (uVar4 < uVar2) break;
  51.               if (uVar4 <= uVar2) {
  52.                 uVar11 = *(uint *)(*(long *)(lVar7 + 0x10) + (ulong)uVar11 * 0xc);
  53.                 if (uVar11 < uVar1) break;
  54.                 if (uVar11 <= uVar1) goto LAB_10180b358;
  55.               }
  56.               uVar8 = uVar8 - uVar10;
  57.               bVar5 = iVar9 == -1;
  58.               iVar9 = iVar9 + 1;
  59.               if (bVar5) goto LAB_10180b358;
  60.             }
  61.             uVar8 = uVar8 + uVar10;
  62.             bVar5 = iVar9 != -1;
  63.             iVar9 = iVar9 + 1;
  64.           } while (bVar5);
  65. LAB_10180b358:
  66.           if (uVar3 <= uVar8) {
  67.             uVar8 = uVar3 - 1;
  68.           }
  69.         }
  70.       }
  71.       lVar7 = *(long *)(lVar7 + 0x10);
  72.       if (*(uint *)(lVar7 + (ulong)uVar8 * 0xc + 4) == uVar2) {
  73.         uVar6 = 0xffffffff;
  74.         if ((uVar8 != 0xffffffff) && (*(uint *)(lVar7 + (ulong)uVar8 * 0xc) == uVar1)) {
  75.           uVar6 = *(undefined4 *)(lVar7 + (ulong)uVar8 * 0xc + 8);
  76.         }
  77.         return uVar6;
  78.       }
  79.     }
  80.   }
  81.   return 0xffffffff;
  82. }
Advertisement
Advertisement
Advertisement
RAW Paste Data Copied
Advertisement