Coding

 Reply to this postStart new topic

Running Scripts in a Frozen Game

Deji
post Dec 7 2010, 02:51 AM
Post #1


Coding like a Rockstar!

Group Icon

Posts: 1,468
From: ???
Joined: 28-May 09



Running Scripts in a Frozen Game


Here's a very cool ability! By following these few simple steps, we can have high script speed as well as the ability to execute code whilst the game is in a frozen state. I've only tested this on a stripped .scm with some CLEO's, so it is possible for bugs to occur at the hand of certain opcodes which shouldn't function.


Basically, this is like allowing scripts to carry on executing when you pause the game. We can indeed actually do that. I've managed to use this to moving draw textures whilst in the main menu wink.gif


The main address, which freezes the game (like when paused in the menu) is: 0xB7CB49 - however, we can't use this without first patching the game to continue running the script...

Enable Some Updates During Pause


This enables quite a lot of things, including script parsing... But a lot of these things are stuff you would normally interact with via the scripts.
  • Scripts
  • Controls
  • Cheats (won't apply until you unpause)
  • HUD
  • Camera Movement
  • Time? (clock doesn't advance.. probably related to internal timers)
  • Weather? (it doesn't seem to progress naturally, though... so, only script control)


etc.. A lot of things will update, but will not appear to do so. It's confusing me slightly to figure out how it works... but I could prevent pretty much everything if needed.

Anyway, to enable all this...

NOP 2 bytes @ 0x53BF8A then 6 bytes @ 0x53BF96


Enable Text Draw While Frozen


NOP 4 bytes @ 0x58FCC2

Includes drawing boxes, etc. Also the HUD wink.gif


Enable Texture Drawing While Frozen

NOP 8 bytes @ 0x58D4BE

This probably also enables styled text, etc.

Note: It is required to use opcode 03E0 before drawing the textures if you don't want the textures to draw on top of the main menu!



This should be tested against the main.scm, though. As I said, it's possible that it executes some things which will crash the game if executed while frozen... When I use it, I'll probably look towards disabling other scripts smile.gif


Here's a crappy screenshot:


--------------------
Go to the top of the page
 
+Quote Post
abc
post Dec 8 2010, 09:35 PM
Post #2


The New Guy!

Posts: 4
Joined: 8-December 10



Can be a way to create a button for quick load save, by emulating key presses in the menu?
Go to the top of the page
 
+Quote Post
Deji
post Dec 9 2010, 06:05 PM
Post #3


Coding like a Rockstar!

Group Icon

Posts: 1,468
From: ???
Joined: 28-May 09



Maybe.. why don't you try and see?


--------------------
Go to the top of the page
 
+Quote Post
abc
post Dec 11 2010, 03:16 AM
Post #4


The New Guy!

Posts: 4
Joined: 8-December 10



My game crashes when i changing those memory. Maybe you post simple cleo script as example?
Go to the top of the page
 
+Quote Post
Deji
post Dec 11 2010, 04:35 PM
Post #5


Coding like a Rockstar!

Group Icon

Posts: 1,468
From: ???
Joined: 28-May 09



SANNY
{$CLEO}
wait 4000
0A8C: write_memory 0x53BF8A size 2 value 0x9090 virtual_protect 1  // Enable frozen game stuff
0A8C: write_memory 0x53BF96 size 6 value 0x90 virtual_protect 1  // Enable frozen game stuff
0A8C: write_memory 0x58FCC2 size 4 value 0x90909090 virtual_protect 1  // Enable frozen game text draw
0A8C: write_memory 0x58D4BE size 8 value 0x90 virtual_protect 1  // Enable frozen game texture draw
0A8C: write_memory 0xB7CB49 size 1 value 1 virtual_protect 0  // Freeze game
wait 3000
0A8C: write_memory 0x53BF8A size 2 value 0xC084 virtual_protect 1  // Disable frozen game stuff
0A8C: write_memory 0x53BF96 size 4 value 0x0298850F virtual_protect 1  // Disable frozen game stuff
0A8C: write_memory 0x53BF9A size 2 value 0x0 virtual_protect 1  // Disable frozen game stuff
0A8C: write_memory 0x58FCC2 size 4 value 0x4D75C084 virtual_protect 1  // Disable frozen game text draw
0A8C: write_memory 0x58D4BE size 4 value 0x850FC084 virtual_protect 1  // Disable frozen game texture draw
0A8C: write_memory 0x58D4C2 size 4 value 0x000000AF virtual_protect 1  // Disable frozen game texture draw
0A8C: write_memory 0xB7CB49 size 1 value 0 virtual_protect 0  // Unfreeze
0A93:


--------------------
Go to the top of the page
 
+Quote Post
DK22
post Dec 27 2010, 09:50 PM
Post #6


Member

Posts: 197
From: Liberty City, Shoreside
Joined: 15-July 10



So, then, would this return "true" while in menu?
SANNY
0A8D: 0@ = read_memory 0xB7CB49 size 1 virtual_protect false

?
And, would be there any way to play sound?
Go to the top of the page
 
+Quote Post
Deji
post Dec 27 2010, 10:07 PM
Post #7


Coding like a Rockstar!

Group Icon

Posts: 1,468
From: ???
Joined: 28-May 09



Well, it returns true when the game is frozen... best use 0xBA67A4 if you want to see if the menu is actually active..


--------------------
Go to the top of the page
 
+Quote Post
DK22
post Dec 30 2010, 06:38 PM
Post #8


Member

Posts: 197
From: Liberty City, Shoreside
Joined: 15-July 10



Yes, it works.
I tried to perform audio, but it doesn't work. Seems it needed to be enabled too.
Go to the top of the page
 
+Quote Post
Reply to this postStart new topic

1 User(s) are reading this topic (1 Guests and 0 Anonymous Users)
0 Members: