JuniorDjjr / SA-MixSets

https://www.mixmods.com.br/2019/08/mod-mixsets.html
MIT License
43 stars 6 forks source link

Starting new game resets DesiredLoadedVeh #5

Closed kaey closed 2 years ago

kaey commented 2 years ago

Inspecting address 0x8A5A84 with gdb shows value 50 in main menu which is what i set in MixSets.ini.

Starting new game resets it to 22 (not 12, as comment in ini file suggests).

Typing SETS to reload config during the game sets it back to 50.

Starting new game again (without quitting) it still stays at 50.

This is also confirmed by OpenLimitAdjuster's limit screen accessible with F5 during game (VehicleStructs line).

JuniorDjjr commented 2 years ago

Fixed, but it's showing 22 because the value is also loaded by stream.ini (or some other CLEO mod is changing it). I disabled the value from stream.ini if set by MixSets, so it will not reset, if the problem continues for you, it's another mod that is changing.

kaey commented 2 years ago

Thanks for looking into this. Unfortunately behavior didn't change.

Exe is 1.0 hoodlum. I tried to remove all mods, including asi loader, mixsets and gta_sa.set, and here's what i found:

In main menu 0x8A5A84 is 12.

When starting new game the value is changed to 22. Here's gdb session:

(gdb) x/d 0x8A5A84
0x8a5a84:   12
(gdb) watch *0x8A5A84
Hardware watchpoint 1: *0x8A5A84
(gdb) c
Continuing.

------ Start new game ------

Thread 1 "gta_sa.exe" hit Hardware watchpoint 1: *0x8A5A84

Old value = 12
New value = 22
0x005b8e78 in ?? ()
(gdb) x/i 0x005b8e78
=> 0x5b8e78:    call   0x821195

And here's disassembly of relevant code

  5b8e5f:       a3 b0 4c 8e 00          mov    %eax,0x8e4cb0
  5b8e64:       c7 05 80 5a 8a 00 00    movl   $0x3200000,0x8a5a80
  5b8e6b:       00 20 03
  5b8e6e:       c7 05 84 5a 8a 00 16    movl   $0x16,0x8a5a84 <-------------
  5b8e75:       00 00 00
  5b8e78:       e8 18 83 26 00          call   0x821195

It seems like 0x16 (22 in decimal) is hardcoded in gta_sa.exe binary. Hope this helps.

JuniorDjjr commented 2 years ago

Thanks, really fixed now. Changed the name to NumDesiredLoadedVeh to avoid problems.

kaey commented 2 years ago

Works as expected now :heart: