Hacking Survivalist: Invisible Strain help
Posted: Sat Jan 15, 2022 2:32 pm
Game: Survivalist: Invisible Strain
I've written a table for the game, and it's posted here: viewtopic.php?t=12733 (I don't know how to link to the specific post, so scroll down a little)
In the table, I routinely desire to reference my specific communityID. That is, if I want to make a script for no bloodloss, I want it to only affect my community. In the table, the _community variable is a global variable established elsewhere. It's set to always refer to my community's, "uniqueID". So, if the community being referenced at the specific moment in the script is different than my community, it will move on and just do the normal code rather than injecting my changes.
It's injected in the Character method, and the offset for the community is +290 from that method. Then, from within the community method, the uniqueID is offset +98. I'm a bit unsure if I have to push two registers to accomplish this reference, but that's a side question.
Regardless to the answer to that side question, this is all fairly straight-forward. The offset references a method, and then the second offset is a variable within that method.
My problem comes up whenever I want to reference a list. Like, when the offset is listed in the mono dissector as:
I have no problem referring to it. I'm unsure how to reference things in lists, though. Like, for instance, in the CropsManager method, offset +10 is listed like this:
In PlantableCrop is the offset to calculate current moisture in the plant. If I go to that method, and inject in a good location like the Update method, I can make it so that all crops across the map have full moisture all the time and never need to be watered. But, I don't know how to do the cmp for my community, so that it only affects my community rather than all crops across the map.
So that's my question. How can I do this check? Many people might suggest using lua, which is a completely foreign language to me, but I'm asking a question to learn the answers. I'm not sure that I'm ready to learn lua, or the technique used in lua to easily dissect the list, but I'm open to recommendations. Ideally, I'd like to figure out how to do this using assembly, which I'm much more familiar with even though I'm still an elementary student in regards to it. As well, while I don't know how to reference my community from this method, I also don't really know how to reference the moisture level from the CropsManager method, since it's a list.
And above that I would need the line comparing my community to the one that plant belongs in.
I'm in way over my head here, and I'd like some help if I can get it.
I've written a table for the game, and it's posted here: viewtopic.php?t=12733 (I don't know how to link to the specific post, so scroll down a little)
In the table, I routinely desire to reference my specific communityID. That is, if I want to make a script for no bloodloss, I want it to only affect my community. In the table, the _community variable is a global variable established elsewhere. It's set to always refer to my community's, "uniqueID". So, if the community being referenced at the specific moment in the script is different than my community, it will move on and just do the normal code rather than injecting my changes.
The first way I learned how to make this check is like this:
...
label(noBloodLoss)
label(cleanUp)
label(code)
label(return)
newmem:
push rcx
push rdx
mov rcx,[rsi+290] //community
mov rdx,[rcx+98] //uniqueID
cmp [_community],rdx
jne cleanUp
movss xmm5,[noBloodLoss]
cleanUp:
pop rdx
pop rcx
code:
...
noBloodLoss:
dd (float)0
...
Which is, could I do this, instead, and have it work just fine:
...
newmem:
push rcx
mov rcx,[rsi+290] //community
mov rcx,[rcx+98] //uniqueID
cmp [_community],rcx
jne cleanUp
movss xmm5,[noBloodLoss]
cleanUp:
pop rcx
code:
...
My problem comes up whenever I want to reference a list. Like, when the offset is listed in the mono dissector as:
Spoiler
290 : Community (type: Community)
Spoiler
10 : AllCrops (type: System.Collections.Generic.List<PlantableCrop>)
So that's my question. How can I do this check? Many people might suggest using lua, which is a completely foreign language to me, but I'm asking a question to learn the answers. I'm not sure that I'm ready to learn lua, or the technique used in lua to easily dissect the list, but I'm open to recommendations. Ideally, I'd like to figure out how to do this using assembly, which I'm much more familiar with even though I'm still an elementary student in regards to it. As well, while I don't know how to reference my community from this method, I also don't really know how to reference the moisture level from the CropsManager method, since it's a list.
This won't work
push rdx
mov rdx,[rax+10] //offset for PlantableCrop list
mov [rdx+60],(float)10 //offset for currentMoistureLevel
pop rdx
I'm in way over my head here, and I'd like some help if I can get it.