Cheat Engine Forum Index Cheat Engine
The Official Site of Cheat Engine
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 


Append DB entry to player [(Lua),System.Collections,(mono)]

 
Post new topic   Reply to topic    Cheat Engine Forum Index -> Cheat Engine Lua Scripting
View previous topic :: View next topic  
Author Message
salumor
Advanced Cheater
Reputation: 0

Joined: 14 Jan 2019
Posts: 84

PostPosted: Sun Dec 26, 2021 5:15 pm    Post subject: Append DB entry to player [(Lua),System.Collections,(mono)] Reply with quote

Ok, so I have a working code living up to the point providing the address to the DB entry I want to copy and of the player's list of owned entries like f.e. (and see attached):

Code:
local wantedDBentry = readPointer([[vars and offsets to addr in above code]])
local addrofplayerownedentries = readPointer([[vars and offsets to addr in above code]])


And I do know the functions adding them do make use of System.Collections.Generic.List<T>.Add

Code:
public void Add(T item)
{
   if (this._size == this._items.Length)
   {
      this.EnsureCapacity(this._size + 1);
   }
   T[] items = this._items;
   int size = this._size;
   this._size = size + 1;
   items[size] = item;
   this._version++;
}


Now I know that- and how I could do that using ASM Hooks and calling conventions. But I'd need to be independent and thus know what's the best way to manually append to the list using lua or other code blocks?

Up till now I thought about a structure (thanks to mono auto created, else manually), recursive copy as a table and write the table addr. to wanted offset-addr.
But I don't know if that could be problematic (f.e. if I add ce allocated space). Further I don't know how to ensure enough List/Array space so I guess the easiest way after copying the List would be to call the function above, but dunno how to do that. Prob. ccode, but, yeah ....
Also for that way I don't know how the List has to look like (if I do think about Array.GetLength() f.e.).



cestrdb.png
 Description:
 Filesize:  130.64 KB
 Viewed:  668 Time(s)

cestrdb.png


Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    Cheat Engine Forum Index -> Cheat Engine Lua Scripting All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Powered by phpBB © 2001, 2005 phpBB Group

CE Wiki   IRC (#CEF)   Twitter
Third party websites