Advertisement
MattFiler

ResourceDatabase

Jan 23rd, 2022
820
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. ResourceDatabase * __thiscall CATHODE::ResourceDatabase::ResourceDatabase(ResourceDatabase *this)
  2.  
  3. {
  4.   int *piVar1;
  5.   int iVar2;
  6.   char cVar3;
  7.   bool bVar4;
  8.   MemoryPool *pMVar5;
  9.   long *plVar6;
  10.   long lVar7;
  11.   MemoryAllocationBase *this_00;
  12.   long *plVar8;
  13.   long *local_48;
  14.  
  15.   *(undefined8 *)this = 0;
  16.   pMVar5 = MemoryManager::m_instance;
  17.   plVar6 = (long *)MemoryPool::pr_allocate(MemoryManager::m_instance,0);
  18.   if (plVar6 == (long *)0x0) {
  19.     local_48 = (long *)0x0;
  20.     plVar6 = local_48;
  21.   }
  22.   else {
  23.     lVar7 = (**(code **)(*plVar6 + 0x18))(plVar6);
  24.     (**(code **)*plVar6)(plVar6);
  25.     plVar8 = plVar6 + 1;
  26.     *(int *)plVar8 = 0;
  27.     *(undefined4 *)((long)plVar6 + 0xc) = 0;
  28.     *plVar6 = (long)(PTR_vtable_101f157c8 + 0x10);
  29.     plVar6[2] = lVar7;
  30.     MemoryTracker::set_owner
  31.               ((MemoryTracker *)&MemoryAllocation<CATHODE::ResourceDatabase::ResourceKey>::m_tracker
  32.                ,pMVar5);
  33.     do {
  34.       cVar3 = '\x01';
  35.       bVar4 = (bool)ExclusiveMonitorPass(plVar8,0x10);
  36.       if (bVar4) {
  37.         *(int *)plVar8 = *(int *)plVar8 + 1;
  38.         cVar3 = ExclusiveMonitorsStatus();
  39.       }
  40.     } while (cVar3 != '\0');
  41.   }
  42.   local_48 = plVar6;
  43.   if (&local_48 != (long **)this) {
  44.     this_00 = *(MemoryAllocationBase **)this;
  45.     if (this_00 != (MemoryAllocationBase *)0x0) {
  46.       if (*(int *)(this_00 + 8) == 1) {
  47.         ArrayPtr<CATHODE::ResourceDatabase::ResourceKey>::clear
  48.                   ((ArrayPtr_CATHODE__ResourceDatabase__ResourceKey_ *)this);
  49.         this_00 = *(MemoryAllocationBase **)this;
  50.       }
  51.       piVar1 = (int *)(this_00 + 8);
  52.       do {
  53.         iVar2 = *piVar1;
  54.         cVar3 = '\x01';
  55.         bVar4 = (bool)ExclusiveMonitorPass(piVar1,0x10);
  56.         if (bVar4) {
  57.           *piVar1 = iVar2 + -1;
  58.           cVar3 = ExclusiveMonitorsStatus();
  59.         }
  60.       } while (cVar3 != '\0');
  61.       if (iVar2 + -1 == 0) {
  62.         MemoryAllocationBase::release(this_00);
  63.       }
  64.       *(undefined8 *)this = 0;
  65.     }
  66.     if (plVar6 != (long *)0x0) {
  67.       *(long **)this = plVar6;
  68.       plVar6 = plVar6 + 1;
  69.       do {
  70.         cVar3 = '\x01';
  71.         bVar4 = (bool)ExclusiveMonitorPass(plVar6,0x10);
  72.         if (bVar4) {
  73.           *(int *)plVar6 = *(int *)plVar6 + 1;
  74.           cVar3 = ExclusiveMonitorsStatus();
  75.         }
  76.       } while (cVar3 != '\0');
  77.     }
  78.   }
  79.   if (local_48 != (long *)0x0) {
  80.     if (*(int *)(local_48 + 1) == 1) {
  81.       ArrayPtr<CATHODE::ResourceDatabase::ResourceKey>::clear
  82.                 ((ArrayPtr_CATHODE__ResourceDatabase__ResourceKey_ *)&local_48);
  83.     }
  84.     plVar6 = local_48 + 1;
  85.     do {
  86.       iVar2 = *(int *)plVar6;
  87.       cVar3 = '\x01';
  88.       bVar4 = (bool)ExclusiveMonitorPass(plVar6,0x10);
  89.       if (bVar4) {
  90.         *(int *)plVar6 = iVar2 + -1;
  91.         cVar3 = ExclusiveMonitorsStatus();
  92.       }
  93.     } while (cVar3 != '\0');
  94.     if (iVar2 + -1 == 0) {
  95.       MemoryAllocationBase::release((MemoryAllocationBase *)local_48);
  96.     }
  97.   }
  98.   return this;
  99. }
Advertisement
Advertisement
Advertisement
RAW Paste Data Copied
Advertisement