Quick Reply
Search this Thread
Test Subject
Original Poster
#1 Old 19th Sep 2024 at 5:08 AM Last edited by kronosta : 19th Sep 2024 at 5:42 AM.
Default Injecting/Modifying SimData and Other Assets by Poking Memory
It's been a long-standing problem with Sims 4 mods that SimData makes things uninjectable by Python script mods, meaning some level of incompatibility is required for many things. The Venue List mod is required because of this, for example.

I thought maybe I could inject SimData and strings using Cheat Engine, and after a few hours of work, I actually managed to rename a trait through its SimData, construct entirely new SimData that I could switch between by messing with pointers, and through a similar method to the previous, create an entirely new string at runtime. It's kinda hard for me to concisely describe how to do it, so I'll put my notes here.

A fair word of warning though: most operating systems have functions to read and write the memory of other processes, but they always lock it behind administrator privileges. Doing this through a Python mod (which I have not done yet) would require invoking another executable somewhere, and that executable would require administrator privileges, so users of a mod would have to trust that it isn't malware, as some pretty terrible things can be done with those privileges.

Here are my notes (indentation is important for organization here but that requires preformatting so I'm using the code tag, please ignore the colors):
Advertisement
Fat Obstreperous Jerk
#2 Old 14th Nov 2024 at 2:32 AM
Hooboy, we're getting really into the weeds here. Technically, I don't think you'd need another executable to poke the memory or admin privileges. You'd only need to poke the memory of your own process, and since you're only poking data memory, this wouldn't even trip memory protections since programs are expected to poke their own data. If you start asking programs to execute instructions in that memory, you might trip DEP, though. I've not worked with Python enough to know if there are functionalities for letting you directly write memory addresses in a low-level manner like this. You could definitely injection-load a regular C library at runtime to gain this capability, though,

Grant me the serenity to accept the things I cannot change, the courage to change the things I cannot accept, and the wisdom to hide the bodies of those I had to kill because they pissed me off.
Back to top