Skip to content
This repository has been archived by the owner on Aug 9, 2024. It is now read-only.

Commit

Permalink
Item spawn cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
JKAnderson committed Mar 31, 2018
1 parent 869cc68 commit 18d2bbf
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 14 deletions.
2 changes: 0 additions & 2 deletions DS Gadget/DSOffsets.cs
Original file line number Diff line number Diff line change
Expand Up @@ -191,8 +191,6 @@ public enum DropItem
Category = 0x01,
ItemID = 0x06,
Count = 0x10,
Ptr1 = 0x15,
Ptr2 = 0x32,
Jump = 0x38
}
}
Expand Down
27 changes: 15 additions & 12 deletions DS Gadget/DSProcess.cs
Original file line number Diff line number Diff line change
Expand Up @@ -620,26 +620,29 @@ public void DropItem(int category, int itemID, int count)
{
byte[] bytes =
{
0xBD, 0x00, 0x00, 0x00, 0x00, 0xBB, 0xF0, 0x00,
0x00, 0x00, 0xB9, 0xFF, 0xFF, 0xFF, 0xFF, 0xBA,
0x00, 0x00, 0x00, 0x00, 0xA1, 0xD0, 0x86, 0x37,
0x01, 0x89, 0xA8, 0x28, 0x08, 0x00, 0x00, 0x89,
0x98, 0x2C, 0x08, 0x00, 0x00, 0x89, 0x88, 0x30,
0x08, 0x00, 0x00, 0x89, 0x90, 0x34, 0x08, 0x00,
0x00, 0xA1, 0xBC, 0xD6, 0x37, 0x01, 0x50, 0xE8,
0x00, 0x00, 0x00, 0x00, 0xC3
0xBD, 0x00, 0x00, 0x00, 0x00,
0xBB, 0x00, 0x00, 0x00, 0x00,
0xB9, 0xFF, 0xFF, 0xFF, 0xFF,
0xBA, 0x00, 0x00, 0x00, 0x00,
0xA1, 0xD0, 0x86, 0x37, 0x01,
0x89, 0xA8, 0x28, 0x08, 0x00, 0x00,
0x89, 0x98, 0x2C, 0x08, 0x00, 0x00,
0x89, 0x88, 0x30, 0x08, 0x00, 0x00,
0x89, 0x90, 0x34, 0x08, 0x00, 0x00,
0xA1, 0xBC, 0xD6, 0x37, 0x01,
0x50,
0xE8, 0x00, 0x00, 0x00, 0x00,
0xC3
};

ReplaceBytes(bytes, category, (int)DSOffsets.DropItem.Category);
ReplaceBytes(bytes, itemID, (int)DSOffsets.DropItem.ItemID);
ReplaceBytes(bytes, count, (int)DSOffsets.DropItem.Count);
ReplaceBytes(bytes, 0x13786D0, (int)DSOffsets.DropItem.Ptr1);
ReplaceBytes(bytes, 0x137D6BC, (int)DSOffsets.DropItem.Ptr2);

IntPtr insertPtr = dsInterface.VirtualAllocEx(1024);
IntPtr insertPtr = dsInterface.VirtualAllocEx(bytes.Length);
ReplaceBytes(bytes, 0 - ((int)insertPtr + 0x3C - 0xDC8C60), (int)DSOffsets.DropItem.Jump);

dsInterface.WriteProcessMemory(insertPtr, bytes, 1024);
dsInterface.WriteProcessMemory(insertPtr, bytes, bytes.Length);
dsInterface.CreateRemoteThread(insertPtr);
}
#endregion
Expand Down

0 comments on commit 18d2bbf

Please sign in to comment.