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 


Stardew Valley (C# MS XNA)

 
Post new topic   Reply to topic    Cheat Engine Forum Index -> General Gamehacking
View previous topic :: View next topic  
Author Message
blackjack4494
How do I cheat?
Reputation: 0

Joined: 27 Jun 2018
Posts: 1
Location: Germany

PostPosted: Wed Jun 27, 2018 10:38 am    Post subject: Stardew Valley (C# MS XNA) Reply with quote

Hello there,
so I just registered here to get some advice.
I am playing that Game called Stardew Valley some of you may heard of it it is like older Harvest Moon, a Farming Game.

The Game itself is written in C# using MS XNA Framework. It is probably managed Code (cannot post the url to stackoverflow but search for difference between managed and unmanaged or use question id 3563870).

I cannot find any static pointers. Everytime the Game is reopened (or even another savegame is loaded) the old addresses/pointers won't work anymore.
You can try it yourself if you have the Game.
I tried scanning multi level pointers and everything else I could as far as my CE knowledge/skills can lead me to.

Maybe I should state my goal. I do not want to cheat, hack or anything. All I want is to READ specific data like health, stamina etc. Actually a quite simple task you think.

So since there are no static pointers at all we need to do an aobscan and read a register. That should give us a usable address where we can use offsets to calculate other addresses to get more data.

Now my problem. With CE you can create a trainer, do your aobscan, allocate new memory, set up some labels and then read the specific register to get your baseaddress.
But I want to do it in C# (or C++ with inline asm and compile it as a dll tho I would write that method to have a parameter with the actual pattern to scan for since it changes because the multiplayer version is beta and updates are quite often and change those bytes often).
I would then have a super simple REST service on my server with a list of the game version and its specific bytes to search for.

In my understanding I need to get the value of the register. And that is not easily possible with just pattern scanning afaik (correct me if I am wrong).
And since you cannot use inline asm in c# I am forced to at least write a c++ dll since I do not want to write that whole thing in c++.

Is it called code cave what I am trying to use? I basically hook into the process look for those bytes, save the jump address, change the asm line add my own then do the original asm line and return the jump address we saved earlier? I have never done such thing before.

I hope you can help me somehow. Toss me into the right direction or whatever. I am glad about any help.

If it help I can do some screenshots or post some code.

As for actual code. I used a trainer someone else made just to see assemblerscript. Then I wrote a simple c+ console application but there I need to paste the base address which I have to manually extract from CE right now.
Back to top
View user's profile Send private message
Meas
Newbie cheater
Reputation: 0

Joined: 31 Oct 2015
Posts: 17

PostPosted: Fri Jun 29, 2018 4:52 am    Post subject: Reply with quote

Because the game is already in C# why not just use dnSpy and patch the C# code directly? Much easier and you have the full power of .NET and existing game dlls.

If you want to just read bytes from memory instead you can use ReadProcessMemory and WriteProcessMemory. Use PInvoke in C# to call those functions.

In general: if the game is SP and doesn't have Anti-Cheat, just patch the code because that's usually static. Don't bother with pointers. Games keep getting larger and larger and pointer scanner takes a very looong time.
Back to top
View user's profile Send private message
FreeER
Grandmaster Cheater Supreme
Reputation: 53

Joined: 09 Aug 2013
Posts: 1091

PostPosted: Fri Jun 29, 2018 5:27 am    Post subject: Reply with quote

Quote:
just patch the code because that's usually static
In my experience C# game code isn't usually static due to the use of jitting. Unless you're talking about the IL code but that's harder to work with, though I really haven't had experience with it so perhaps it's not that bad...

Though yes, AOBscans are easier many times. I have heard of a program that can pre-jit everything and re-save the binaries called ngen... Haven't taken the time to use it however.

As far as the "full power of .NET", well I've never actually had any luck with writing my own C# code and having it actually recompile properly. Typically for anything non-trivial there's problems with including other things and I've never found a tutorial that actually covers exactly how to fix it in all cases.

Though if it does work for you then great! Smile




As for inline asm in C#, have you looked at the black magic or otherwise googled asm / game hacking libraries? I don't use C# so I don't really have any experience to speak of with it but I have seen several people use it for trainers so it's certainly possible to do it without resorting to another language + injecting a dll.

Quote:
Is it called code cave what I am trying to use?
I generally just call it hooking, my definition of a code cave would be an existing memory block in the game that isn't used but I've seen others use it for allocated memory as well. There's a popular library for it called Detours which I believe uses the term "trampoline". Though looking for the AOBs is often called pattern scanning, the rest of it works only once you actually have an address (whether static or found through a scan or by querying an API like mono).


But honestly, why not just use CE? You can still have an API on your server that sends back AOBs / AA scripts and CE just uses those... you can use lua to contact the server with the game version and get them or even download a whole trainer made specifically for that version (https://forum.cheatengine.org/viewtopic.php?t=586784).

_________________
https://github.com/FreeER/ has a few CE related repos
Back to top
View user's profile Send private message
atom0s
Moderator
Reputation: 205

Joined: 25 Jan 2006
Posts: 8587
Location: 127.0.0.1

PostPosted: Mon Jul 02, 2018 12:28 pm    Post subject: Reply with quote

There are a lot of mods for this game already that handle things via reflection and runtime recompiling using things like Mono.Cecil.
_________________
- Retired.
Back to top
View user's profile Send private message Visit poster's website
Display posts from previous:   
Post new topic   Reply to topic    Cheat Engine Forum Index -> General Gamehacking 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