Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- bool __thiscall
- CATHODE::ResourceDatabase::add_resource_ptr(ResourceDatabase *this,uint param_1,MemoryPtr *param_2)
- {
- int *piVar1;
- MemoryAllocationBase **ppMVar2;
- uint uVar3;
- char cVar4;
- bool bVar5;
- MemoryAllocationBase *pMVar6;
- long lVar7;
- uint uVar8;
- int iVar9;
- uint uVar10;
- uint uVar11;
- uint local_48 [2];
- MemoryAllocationBase *local_40;
- MemoryAllocationBase *local_38;
- if (param_1 == 0xffffffff) goto LAB_10180a7c0;
- local_40 = (MemoryAllocationBase *)0x0;
- pMVar6 = *(MemoryAllocationBase **)param_2;
- if (pMVar6 != (MemoryAllocationBase *)0x0) {
- piVar1 = (int *)(pMVar6 + 8);
- do {
- cVar4 = '\x01';
- bVar5 = (bool)ExclusiveMonitorPass(piVar1,0x10);
- if (bVar5) {
- *piVar1 = *piVar1 + 1;
- cVar4 = ExclusiveMonitorsStatus();
- }
- local_40 = pMVar6;
- } while (cVar4 != '\0');
- }
- local_38 = (MemoryAllocationBase *)0x0;
- lVar7 = *(long *)this;
- local_48[0] = param_1;
- if ((lVar7 == 0) || (*(int *)(lVar7 + 0xc) == 0)) {
- LAB_10180a728:
- ArrayPtr<CATHODE::ResourceDatabase::ResourceKey>::push_sort
- ((ArrayPtr_CATHODE__ResourceDatabase__ResourceKey_ *)this,(ResourceKey *)local_48);
- }
- else {
- uVar3 = *(uint *)(lVar7 + 0xc);
- uVar8 = uVar3;
- if (uVar3 == 0) {
- LAB_10180a674:
- if (uVar8 == 0xffffffff) goto LAB_10180a728;
- }
- else {
- uVar8 = uVar3 | uVar3 >> 1;
- uVar8 = uVar8 | uVar8 >> 2;
- uVar8 = uVar8 | uVar8 >> 4;
- uVar8 = uVar8 | uVar8 >> 8;
- uVar8 = uVar8 | uVar8 >> 0x10;
- uVar8 = ((uVar8 & 0xaaaaaaaa) >> 1) + (uVar8 & 0x55555555);
- uVar8 = ((uVar8 & 0xcccccccc) >> 2) + (uVar8 & 0x33333333);
- uVar8 = ((uVar8 & 0xf0f0f0f0) >> 4) + (uVar8 & 0xf0f0f0f);
- uVar8 = ((uVar8 & 0xff00ff00) >> 8) + (uVar8 & 0xff00ff);
- iVar9 = -((uVar8 >> 0x10) + (uVar8 & 0xffff));
- if (iVar9 != 0) {
- uVar10 = 1 << (ulong)((iVar9 + 0x20U ^ 0x1f) & 0x1f);
- uVar8 = uVar10 - 1;
- do {
- while( true ) {
- uVar11 = uVar8;
- if (uVar3 <= uVar8) {
- uVar11 = *(int *)(lVar7 + 0xc) - 1;
- }
- uVar10 = uVar10 >> 1;
- uVar11 = *(uint *)(*(long *)(lVar7 + 0x10) + (ulong)uVar11 * 0x18);
- if (uVar11 < param_1) break;
- if (uVar11 <= param_1) goto LAB_10180a668;
- uVar8 = uVar8 - uVar10;
- bVar5 = iVar9 == -1;
- iVar9 = iVar9 + 1;
- if (bVar5) goto LAB_10180a668;
- }
- uVar8 = uVar8 + uVar10;
- bVar5 = iVar9 != -1;
- iVar9 = iVar9 + 1;
- } while (bVar5);
- LAB_10180a668:
- if (uVar3 <= uVar8) {
- uVar8 = uVar3 - 1;
- }
- goto LAB_10180a674;
- }
- uVar8 = 0;
- }
- if (*(uint *)(*(long *)(lVar7 + 0x10) + (ulong)uVar8 * 0x18) != param_1) goto LAB_10180a728;
- ppMVar2 = (MemoryAllocationBase **)(*(long *)(lVar7 + 0x10) + (ulong)uVar8 * 0x18 + 0x10);
- if (ppMVar2 != (MemoryAllocationBase **)param_2) {
- pMVar6 = *ppMVar2;
- if (pMVar6 != (MemoryAllocationBase *)0x0) {
- if (*(int *)(pMVar6 + 8) == 1) {
- (**(code **)**(undefined8 **)(pMVar6 + 0x10))();
- pMVar6 = *ppMVar2;
- }
- piVar1 = (int *)(pMVar6 + 8);
- do {
- iVar9 = *piVar1;
- cVar4 = '\x01';
- bVar5 = (bool)ExclusiveMonitorPass(piVar1,0x10);
- if (bVar5) {
- *piVar1 = iVar9 + -1;
- cVar4 = ExclusiveMonitorsStatus();
- }
- } while (cVar4 != '\0');
- if (iVar9 + -1 == 0) {
- MemoryAllocationBase::release(pMVar6);
- }
- *ppMVar2 = (MemoryAllocationBase *)0x0;
- }
- pMVar6 = *(MemoryAllocationBase **)param_2;
- if (pMVar6 != (MemoryAllocationBase *)0x0) {
- *ppMVar2 = pMVar6;
- piVar1 = (int *)(pMVar6 + 8);
- do {
- cVar4 = '\x01';
- bVar5 = (bool)ExclusiveMonitorPass(piVar1,0x10);
- if (bVar5) {
- *piVar1 = *piVar1 + 1;
- cVar4 = ExclusiveMonitorsStatus();
- }
- } while (cVar4 != '\0');
- }
- }
- }
- if (local_38 != (MemoryAllocationBase *)0x0) {
- if (*(int *)(local_38 + 8) == 1) {
- (**(code **)**(undefined8 **)(local_38 + 0x10))();
- }
- piVar1 = (int *)(local_38 + 8);
- do {
- iVar9 = *piVar1;
- cVar4 = '\x01';
- bVar5 = (bool)ExclusiveMonitorPass(piVar1,0x10);
- if (bVar5) {
- *piVar1 = iVar9 + -1;
- cVar4 = ExclusiveMonitorsStatus();
- }
- } while (cVar4 != '\0');
- if (iVar9 + -1 == 0) {
- MemoryAllocationBase::release(local_38);
- }
- local_38 = (MemoryAllocationBase *)0x0;
- }
- if (local_40 != (MemoryAllocationBase *)0x0) {
- if (*(int *)(local_40 + 8) == 1) {
- (**(code **)**(undefined8 **)(local_40 + 0x10))();
- }
- piVar1 = (int *)(local_40 + 8);
- do {
- iVar9 = *piVar1;
- cVar4 = '\x01';
- bVar5 = (bool)ExclusiveMonitorPass(piVar1,0x10);
- if (bVar5) {
- *piVar1 = iVar9 + -1;
- cVar4 = ExclusiveMonitorsStatus();
- }
- } while (cVar4 != '\0');
- if (iVar9 + -1 == 0) {
- MemoryAllocationBase::release(local_40);
- }
- }
- LAB_10180a7c0:
- return param_1 != 0xffffffff;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement