| View previous topic :: View next topic |
| Author |
Message |
katszc How do I cheat?
Reputation: 0
Joined: 08 Jun 2020 Posts: 4
|
Posted: Tue Jun 09, 2020 7:54 am Post subject: Stop a game from pausing when unfocused |
|
|
Heyo!
(First of all, trying to learn Cheat Engine and Opcodes and all this is so much fun haha!)
This question I do know has been asked, but as I'm a complete idiot with these things, the answer they were given are ones I couldn't quite understand haha.
I'm wanting to keep the game Terraria from "pausing" when it isn't in focus, tried for a couple hours yesterday and did find some functions that may have had something to do with it, alas, whatever I tried, it didn't work, and it was likely that I was just changing values and stopping functions that are pointless.
The question basically boils down to: What exactly is one looking for when trying to disable the pause?
I did some snooping and "onblur" and "onfocusout" came up, but these two are just html code(?).
In Terraria specifically, the game doesn't even pause, at least not entirely, things likes torches and coins on ground still do their animation.
|
|
| Back to top |
|
 |
Csimbi I post too much
Reputation: 98
Joined: 14 Jul 2007 Posts: 3375
|
Posted: Tue Jun 09, 2020 10:40 am Post subject: |
|
|
I don't know this game, but here's what I would try:
- enable DBVM and use ultimap
- set up hotkeys for ultimap
- trigger the code and search for 'executed'
- make sure the code does not get executed (this is the hard one) and search for 'not executed'
- Iterate until a handful of functions are found.
- Skim through each for Windows API calls and flag checks/changes. You want to find a function that writes a flag on certain conditions (when Windows API calls return non-zero).
- See what flags are read/written and try NOPing the code that writes the flag(s).
- If that does not work (or the Windows API calls are not invoked in these directly), debug each function thoroughly, starting with the most relevant.
Good luck!
|
|
| Back to top |
|
 |
katszc How do I cheat?
Reputation: 0
Joined: 08 Jun 2020 Posts: 4
|
Posted: Tue Jun 09, 2020 10:43 am Post subject: |
|
|
| Thank you!!
|
|
| Back to top |
|
 |
atom0s Moderator
Reputation: 205
Joined: 25 Jan 2006 Posts: 8585 Location: 127.0.0.1
|
Posted: Tue Jun 09, 2020 1:43 pm Post subject: |
|
|
Terraria handles focus like this: (Inside of Terraria.Main.DoUpdate)
| Code: |
Main.hasFocus = base.IsActive;
Main.hasFocus |= (Form.ActiveForm == Control.FromHandle(base.Window.Handle) as Form);
if (!base.IsActive && Main.netMode == 0)
{
if (!Platform.IsOSX)
{
base.IsMouseVisible = true;
}
if (Main.netMode != 2 && Main.myPlayer >= 0)
{
Main.player[Main.myPlayer].delayUseItem = true;
}
Main.mouseLeftRelease = false;
Main.mouseRightRelease = false;
if (Main.gameMenu)
{
Main.UpdateMenu();
}
Main.gamePaused = true;
return;
}
if (!Platform.IsOSX)
{
base.IsMouseVisible = false;
}
SkyManager.Instance.Update(gameTime);
if (!Main.gamePaused)
{
EmoteBubble.UpdateAll();
}
|
If you follow 'base.IsActive' back to its root handling, it'll trace you back to within the XNA framework modules, which handles active windows via:
| Code: |
protected override void WndProc(ref Message m)
{
if (m.Msg == 28)
{
bool active = m.WParam != IntPtr.Zero;
this.OnActivateApp(active);
}
base.WndProc(ref m);
}
|
Msg 28 is 'WM_ACTIVATEAPP'. You can hook the message handler (WNDPROC) of the main window of the game and manually handle this and prevent the XNA framework from ever seeing any deactivation messages.
_________________
- Retired. |
|
| Back to top |
|
 |
katszc How do I cheat?
Reputation: 0
Joined: 08 Jun 2020 Posts: 4
|
Posted: Wed Jun 10, 2020 1:04 pm Post subject: |
|
|
Ooooh, terribly sorry about the late reply! Huge thanks to you too! :D
Been a little busy so haven't been able to really play around with this newly gained knowledge yet haha.
|
|
| Back to top |
|
 |
|