/// <summary> /// /// </summary> internal void UpdatePointers() { PointerEventActionType.UpdatePointers(); PointerIsMotionPlay.UpdatePointers(); PointerEventActionTask.UpdatePointers(); PointerPlayerStatus.UpdatePointers(); PointerPlayerHP.UpdatePointers(); PointerPlayerPosition.UpdatePointers(); PointerRankManager.UpdatePointers(); PointerInventory.UpdatePointers(); try { PointerEnemyCount.UpdatePointers(); PointerEnemyEntryList.UpdatePointers(); GenerateEnemyEntries(); PointerInventoryCount.UpdatePointers(); PointerInventoryEntryList.UpdatePointers(); GenerateItemEntries(); } catch { // May fail in main menu } }
private unsafe void GenerateItemEntries() { bool success; fixed(int *p = &InventoryTableCount) success = PointerInventoryCount.TryDerefInt(0x1C, p); PointerInventoryEntries = new MultilevelPointer[MAX_ITEMS]; PointerInventoryEntriesCustom = new MultilevelPointer[MAX_ITEMS]; // Skip the first 28 bytes and read the rest as a byte array // This can be done because the pointers are stored sequentially in an array byte[] inventoryEntriesPtrByteArr = PointerInventoryEntryList.DerefByteArray(0x20, MAX_ITEMS * sizeof(IntPtr)); // Do a block copy to convert the byte array to an IntPtr array IntPtr[] inventoryEntriesPtrArr = new IntPtr[MAX_ITEMS]; Buffer.BlockCopy(inventoryEntriesPtrByteArr, 0, inventoryEntriesPtrArr, 0, inventoryEntriesPtrByteArr.Length); for (int i = 0; i < PointerInventoryEntries.Length; ++i) { PointerInventoryEntries[i] = new MultilevelPointer(memoryAccess, IntPtr.Add(inventoryEntriesPtrArr[i], 0x58)); PointerInventoryEntriesCustom[i] = new MultilevelPointer(memoryAccess, IntPtr.Add(inventoryEntriesPtrArr[i], 0x58), 0x90); } }