Advertisement
MattFiler

ResourceRegistry::initialise

Jan 23rd, 2022
546
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. void __thiscall CATHODE::ResourceRegistry::initialise(ResourceRegistry *this,char *param_1)
  2.  
  3. {
  4.   long *plVar1;
  5.   int iVar2;
  6.   char cVar3;
  7.   bool bVar4;
  8.   MemoryPool *pMVar5;
  9.   uint *puVar6;
  10.   long lVar7;
  11.   void *pvVar8;
  12.   long *plVar9;
  13.   int iVar10;
  14.   int *piVar11;
  15.   uint uVar12;
  16.   uint *puVar13;
  17.   uint uVar14;
  18.   uint uVar15;
  19.   uint uVar16;
  20.   long *local_78;
  21.   uint *local_70 [2];
  22.   uint *local_60;
  23.   int local_58;
  24.   undefined local_54;
  25.  
  26.   uninitialise(this);
  27.   local_54 = 0;
  28.   CA::MemFileIn::open((MemFileIn *)local_70,param_1);
  29.   pMVar5 = MemoryManager::m_instance;
  30.   if (local_58 != 0) goto LAB_10180b168;
  31.   if (local_60 < local_70[0] + 1) {
  32.     local_58 = 1;
  33.     puVar13 = local_70[0] + 1;
  34.     if (local_70[0] + 1 <= local_60) goto LAB_10180ae00;
  35. LAB_10180ae48:
  36.     local_58 = 1;
  37.     puVar13 = local_70[0] + 1;
  38.     if (local_60 < puVar13) goto LAB_10180ae5c;
  39. LAB_10180ae14:
  40.     uVar16 = *local_70[0];
  41.   }
  42.   else {
  43.     puVar13 = local_70[0] + 2;
  44.     local_70[0] = local_70[0] + 1;
  45.     if (local_60 < puVar13) goto LAB_10180ae48;
  46. LAB_10180ae00:
  47.     local_70[0] = puVar13;
  48.     puVar13 = local_70[0] + 1;
  49.     if (puVar13 <= local_60) goto LAB_10180ae14;
  50. LAB_10180ae5c:
  51.     uVar16 = 0;
  52.     local_58 = 1;
  53.     puVar13 = local_70[0];
  54.   }
  55.   local_70[0] = puVar13 + 1;
  56.   if (local_60 < local_70[0]) {
  57.     local_58 = 1;
  58.     local_70[0] = puVar13;
  59.   }
  60.   uVar14 = uVar16 * 0xc;
  61.   local_78 = (long *)MemoryPool::pr_allocate(MemoryManager::m_instance,uVar14);
  62.   if (local_78 == (long *)0x0) {
  63.     pvVar8 = (void *)0x0;
  64.     local_78 = (long *)0x0;
  65.   }
  66.   else {
  67.     lVar7 = (**(code **)(*local_78 + 0x18))(local_78);
  68.     (**(code **)*local_78)(local_78);
  69.     plVar9 = local_78 + 1;
  70.     *(int *)plVar9 = 0;
  71.     *(uint *)((long)local_78 + 0xc) = uVar14 / 0xc;
  72.     *local_78 = (long)(PTR_vtable_101f157d0 + 0x10);
  73.     local_78[2] = lVar7;
  74.     MemoryTracker::set_owner
  75.               ((MemoryTracker *)&MemoryAllocation<CATHODE::ResourceRegistry::ResourceKey>::m_tracker
  76.                ,pMVar5);
  77.     do {
  78.       cVar3 = '\x01';
  79.       bVar4 = (bool)ExclusiveMonitorPass(plVar9,0x10);
  80.       if (bVar4) {
  81.         *(int *)plVar9 = *(int *)plVar9 + 1;
  82.         cVar3 = ExclusiveMonitorsStatus();
  83.       }
  84.     } while (cVar3 != '\0');
  85.     if (local_78 == (long *)0x0) {
  86.       pvVar8 = (void *)0x0;
  87.     }
  88.     else {
  89.       pvVar8 = (void *)local_78[2];
  90.     }
  91.   }
  92.   __stubs::_bzero(pvVar8,(ulong)uVar14);
  93.   plVar9 = *(long **)(this + 8);
  94.   if (plVar9 != (long *)0x0) {
  95.     if ((*(int *)(plVar9 + 1) == 1) && (piVar11 = (int *)((long)plVar9 + 0xc), *piVar11 != 0)) {
  96.       iVar2 = *(int *)((long)plVar9 + 0xc);
  97.       if (iVar2 != 0) {
  98.         do {
  99.           cVar3 = '\x01';
  100.           bVar4 = (bool)ExclusiveMonitorPass(piVar11,0x10);
  101.           if (bVar4) {
  102.             *piVar11 = *piVar11 + -1;
  103.             cVar3 = ExclusiveMonitorsStatus();
  104.           }
  105.         } while (cVar3 != '\0');
  106.         if (iVar2 != 1) {
  107.           iVar10 = 1;
  108.           do {
  109.             piVar11 = (int *)(*(long *)(this + 8) + 0xc);
  110.             do {
  111.               cVar3 = '\x01';
  112.               bVar4 = (bool)ExclusiveMonitorPass(piVar11,0x10);
  113.               if (bVar4) {
  114.                 *piVar11 = *piVar11 + -1;
  115.                 cVar3 = ExclusiveMonitorsStatus();
  116.               }
  117.             } while (cVar3 != '\0');
  118.             iVar10 = iVar10 + 1;
  119.           } while (iVar10 != iVar2);
  120.         }
  121.         plVar9 = *(long **)(this + 8);
  122.       }
  123.       (**(code **)(*plVar9 + 0x40))(plVar9,0);
  124.       plVar9 = *(long **)(this + 8);
  125.     }
  126.     plVar1 = plVar9 + 1;
  127.     do {
  128.       iVar2 = *(int *)plVar1;
  129.       cVar3 = '\x01';
  130.       bVar4 = (bool)ExclusiveMonitorPass(plVar1,0x10);
  131.       if (bVar4) {
  132.         *(int *)plVar1 = iVar2 + -1;
  133.         cVar3 = ExclusiveMonitorsStatus();
  134.       }
  135.     } while (cVar3 != '\0');
  136.     if (iVar2 + -1 == 0) {
  137.       MemoryAllocationBase::release((MemoryAllocationBase *)plVar9);
  138.     }
  139.     *(undefined8 *)(this + 8) = 0;
  140.   }
  141.   if (local_78 != (long *)0x0) {
  142.     *(long **)(this + 8) = local_78;
  143.     plVar9 = local_78 + 1;
  144.     do {
  145.       cVar3 = '\x01';
  146.       bVar4 = (bool)ExclusiveMonitorPass(plVar9,0x10);
  147.       if (bVar4) {
  148.         *(int *)plVar9 = *(int *)plVar9 + 1;
  149.         cVar3 = ExclusiveMonitorsStatus();
  150.       }
  151.     } while (cVar3 != '\0');
  152.   }
  153.   if (local_78 != (long *)0x0) {
  154.     if ((*(int *)(local_78 + 1) == 1) && (piVar11 = (int *)((long)local_78 + 0xc), *piVar11 != 0)) {
  155.       iVar2 = *(int *)((long)local_78 + 0xc);
  156.       if (iVar2 != 0) {
  157.         do {
  158.           cVar3 = '\x01';
  159.           bVar4 = (bool)ExclusiveMonitorPass(piVar11,0x10);
  160.           if (bVar4) {
  161.             *piVar11 = *piVar11 + -1;
  162.             cVar3 = ExclusiveMonitorsStatus();
  163.           }
  164.         } while (cVar3 != '\0');
  165.         if (iVar2 != 1) {
  166.           iVar10 = 1;
  167.           do {
  168.             piVar11 = (int *)((long)local_78 + 0xc);
  169.             do {
  170.               cVar3 = '\x01';
  171.               bVar4 = (bool)ExclusiveMonitorPass(piVar11,0x10);
  172.               if (bVar4) {
  173.                 *piVar11 = *piVar11 + -1;
  174.                 cVar3 = ExclusiveMonitorsStatus();
  175.               }
  176.             } while (cVar3 != '\0');
  177.             iVar10 = iVar10 + 1;
  178.           } while (iVar10 != iVar2);
  179.         }
  180.       }
  181.       (**(code **)(*local_78 + 0x40))(local_78,0);
  182.     }
  183.     plVar9 = local_78 + 1;
  184.     do {
  185.       iVar2 = *(int *)plVar9;
  186.       cVar3 = '\x01';
  187.       bVar4 = (bool)ExclusiveMonitorPass(plVar9,0x10);
  188.       if (bVar4) {
  189.         *(int *)plVar9 = iVar2 + -1;
  190.         cVar3 = ExclusiveMonitorsStatus();
  191.       }
  192.     } while (cVar3 != '\0');
  193.     if (iVar2 + -1 == 0) {
  194.       MemoryAllocationBase::release((MemoryAllocationBase *)local_78);
  195.     }
  196.   }
  197.   if (uVar16 != 0) {
  198.     lVar7 = 0;
  199.     uVar12 = 0;
  200.     uVar14 = 0;
  201.     uVar15 = 0;
  202.     do {
  203.       puVar13 = local_70[0] + 1;
  204.       if (local_60 < puVar13) {
  205.         local_58 = 1;
  206.         puVar13 = local_70[0];
  207.         puVar6 = local_70[0] + 1;
  208.         if (local_70[0] + 1 <= local_60) goto LAB_10180b114;
  209. LAB_10180b148:
  210.         local_58 = 1;
  211.         puVar13 = local_70[0] + 1;
  212.         if (puVar13 <= local_60) goto LAB_10180b0c8;
  213. LAB_10180b158:
  214.         local_58 = 1;
  215.       }
  216.       else {
  217.         uVar12 = *local_70[0];
  218.         puVar6 = local_70[0] + 2;
  219.         local_70[0] = puVar13;
  220.         if (local_60 < puVar6) goto LAB_10180b148;
  221. LAB_10180b114:
  222.         local_70[0] = puVar6;
  223.         uVar15 = *puVar13;
  224.         puVar13 = local_70[0] + 1;
  225.         if (local_60 < puVar13) goto LAB_10180b158;
  226. LAB_10180b0c8:
  227.         uVar14 = *local_70[0];
  228.         local_70[0] = puVar13;
  229.       }
  230.       puVar13 = (uint *)(*(long *)(*(long *)(this + 8) + 0x10) + lVar7);
  231.       *puVar13 = uVar15;
  232.       puVar13[1] = uVar12;
  233.       puVar13[2] = uVar14;
  234.       lVar7 = lVar7 + 0xc;
  235.     } while ((ulong)uVar16 * 0xc - lVar7 != 0);
  236.   }
  237.   ResourceDatabase::initialise((ResourceDatabase *)this);
  238. LAB_10180b168:
  239.   CA::MemFileIn::_MemFileIn((MemFileIn *)local_70);
  240.   return;
  241. }
Advertisement
Advertisement
Advertisement
RAW Paste Data Copied
Advertisement