Jump to content

I Want To Write One Memory Adress Into Main.scm WITHOUT CLEO [Sa Classic]


ArmanCan

Recommended Posts

Hello again my dear Modders 😃

 

Well.. the titel is obvious the memory is sittng at below so tell me.. how can i do it? I'm ready to apply it if it's not mathematically insane sh*t or technically difficult.. 😃

0A8C: write_memory 0x44183D size 1 value 0 virtual_protect 0 // removes the wanted level when you leave town// this enables traffic again:s 
Link to comment
Share on other sites

I know you can use stats alerting opcodes for this. These do not check if stat value is in valid range, so you can write memory with them.

Also addressing variable arrays can be abused in similar manner.

There should be some topics about it on forum, as in early days there was no CLEO.

Link to comment
Share on other sites

1 hour ago, MiranDMC said:

I know you can use stats alerting opcodes for this. These do not check if stat value is in valid range, so you can write memory with them.

but how? 🙂

1 hour ago, MiranDMC said:

There should be some topics about it on forum, as in early days there was no CLEO.

I always make a research before making a request.. i would find myself a solution if i could find something useful 😃

Link to comment
Share on other sites

its called aDMA:

 

Example from Orion:

// Mathing it out
0@ = 0x455443  // Address of: Duration of horshoe collected message
//1@ = 0x455443
0@ /= 4 // rounding off to doubly-even
0@ *= 4
//1@ -= 0@ // 0x455443 MOD 4 = 3, need to add remainder back in with aDMA offset
0@ -= 0xA49960 // ScriptSpace, base offset to $0, &0
0@ /= 4 // aDMA indexes are like global variable indexes to dwords
&3(0@,1i) = 3000 // &3 = &0 + 3 bytes, the remainder in 1@  

 

Here is my function for setting stats without popup messages:
 

// set player stat without displaying info popup
// arg 0 - stat id
// arg 1 - stat value 
:PLAYER_STAT_SET_QUIET
    if
        0@ < 82
    then
        0@ *= 4 // bytes peer stat
        0@ += 0x00B79380 // float stats block start
    else
        0@ *= 4 // bytes peer stat
        0@ += 0x00B78E20 // integer stats block start
    end
    write_memory 0@ size 4 value 1@ virtual_protect 0
cleo_return 0

Original stats related opcodes use same arithmetic to calculate target address. So you can get your desired address and figure out what 'stat id' you have to use to write there.

Edited by MiranDMC
Link to comment
Share on other sites

Since your data size in only one byte, extra care must be used to avoid altering the whole dword when using aDMA. 

//0A8C: write_memory 0x44183D size 1 value 0 virtual_protect 0 // removes the wanted level when you leave town
// Mathing it out (untested)
0@ = 0x44183D  // size 1  // removes the wanted level when you leave town
0@ -= 1 // rounding off to doubly-even
0@ -= 0xA49960 // offset to ScriptSpace
0@ /= 4 // convert to aDMA index
08C0: clear &1(0@,1i) bit 0  // good enough if the byte value can only be 0 or 1
08C0: clear &1(0@,1i) bit 1  // clearing the rest of the bits in the byte
08C0: clear &1(0@,1i) bit 2  // good enough if the byte value is always 4
08C0: clear &1(0@,1i) bit 3
08C0: clear &1(0@,1i) bit 4  // note that &1 is adding back the 1 removed while rounding
08C0: clear &1(0@,1i) bit 5
08C0: clear &1(0@,1i) bit 6
08C0: clear &1(0@,1i) bit 7

 

Edited by OrionSR
Link to comment
Share on other sites

I would just add that the func you're about to modify through memory actually has 2 places where the wanted level is defined as 4 stars and the other place is:

0x4418B1    [byte]

I believe you need to change this one as well in order to remove the stars.

  • Like 2
Link to comment
Share on other sites

15 hours ago, MiranDMC said:

Original stats related opcodes use same arithmetic to calculate target address.

Well sh*t! My maths is good but i don't know it and i don't wanna mess with arithmetic calculations.. thanks again for your suggestion and your example codes..😃

10 hours ago, OrionSR said:

Since your data size in only one byte, extra care must be used to avoid altering the whole dword when using aDMA. 

Is it a completed process? If yes where and how should i place it? 🙂

3 hours ago, Jack said:

I would just add that the func you're about to modify through memory actually has 2 places where the wanted level is defined as 4 stars and the other place is:

Jack is this memory adress familiar to you? And can you do this modification? Everyone above me (including you) is suggesting me some complicated and weird stuff 😃

Link to comment
Share on other sites

Complicated? Man this is basic software development stuff...

 

Anyway, why are you  doing some code hacks instead of just allowing player to leave town in same way the game do in storyline?

0629: change_integer_stat 181 to 4 // all cities open

 

Edited by MiranDMC
Link to comment
Share on other sites

5 minutes ago, MiranDMC said:

Complicated? Man this is basic software development stuff...

But unfortunately i'm not software developer 😃

5 minutes ago, MiranDMC said:

Anyway, why are you  doing some code hacks instead of just allowing player to leave town in same way the game do in storyline?

I would like to increase it f*cking much but this will terminate phonecalls from Ten-Penny and Cesar Salad 🙁

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • 1 User Currently Viewing
    0 members, 0 Anonymous, 1 Guest

×
×
  • Create New...

Important Information

By using GTAForums.com, you agree to our Terms of Use and Privacy Policy.