Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #define subfc(a,b) (~b + a + 1)
- int getAddressOfScriptIndexPoolItem(int pool, int entity) {
- unsigned int r3, r4, r5, r6, r7, r8, r9 = 0;
- r3 = pool;
- r4 = entity;
- r8 = r4 >> 8;
- r6 = *(int*)(r3 + 0x4);
- r5 = r4&0xFF;
- r7 = r8;
- r4 = *(int*)r3;
- r6 = *(char*)(r6 + r7);
- if (r6 != r5)
- return 0;
- r6 = *(int*)(r3 + 0x1C);
- if (r6 == 0)
- goto loc_A54DF4;
- r5 = *(int*)(r3 + 0x20);
- if (r7 < r5)//this check might be backwards
- //would be correct according to https://www.cs.uaf.edu/2011/fall/cs301/lecture/11_21_PowerPC.html
- goto loc_A54DF4;
- r9 = *(int*)(r3 + 0x8);
- if (r7 >= r9)//same as above one, might be backwards
- goto loc_A54DF4;
- r3 = subfc(r7, r5);//this also might be wrong lol
- r3 = r3 >> 2;
- r3 = *(int*)(r6 + r3);
- return r3;
- loc_A54DF4:
- r3 = *(int*)(r3 + 0xC);
- r3 = r8 * r3;
- r3 = r4 + r3;
- return r3;
- }
- int getEntityFromIndex(int entityIndex) {
- if (entityIndex == -1)
- return 0;
- #define ScriptEntityPool_fwScriptGuid 0x1CC5790
- int v = getAddressOfScriptIndexPoolItem(*(int*)ScriptEntityPool_fwScriptGuid, entityIndex);
- if (v == 0)
- return 0;
- return *(int*)(v + 0x4);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement