| View previous topic :: View next topic |
| Author |
Message |
Dave_Scream Cheater
Reputation: 0
Joined: 06 Dec 2009 Posts: 36
|
Posted: Tue May 21, 2024 3:25 pm Post subject: On disable: failure writing referenced addresses |
|
|
when im trying to disable MR, I get error (right click context menu): failure writing referenced addresses.
Other code the same. The code is:
| Code: |
[ENABLE]
{ Game : helldivers2.exe
Version:
Date : 2024-04-05
Author : ZoDDeL
This script does blah blah blah
}
{$c}
// YOU CAN EDIT SECTION START
#define MAIN_AND_SIDE_MISSIONS_COMPLETED_HOTKEY VK_NUMPAD2
int MAIN_AND_SIDE_MISSIONS_COMPLETED_HOTKEY_STATE = 0;
int *main_mission_status;
int *side_mission_status;
#define MAIN_AND_SIDE_MISSIONS_RESTORE_HOTKEY VK_NUMPAD3
//#define MAIN_MISSIONS_COMPLETED_HOTKEY VK_NUMPAD3
// YOU CAN EDIT SECTION END
#define NO_OLDNAMES
#include <windows.h>
short GetAsyncKeyState(int);
//extern float ext_damage_mult;
{$asm}
[ENABLE]
// MAIN MISSION
aobscanmodule(missionA,game.dll,45 8B 4A 18 48 8D 8E 20 01 00 00 41 8B D5) // should be unique
alloc(missionA_newmem,$1000)
label(missionA_code)
label(missionA_return)
missionA_newmem:
{$ccode r10=r10}
main_mission_status = (int*)(r10+0x18);
if (GetAsyncKeyState(MAIN_AND_SIDE_MISSIONS_COMPLETED_HOTKEY) & 0x8000) {
if (!MAIN_AND_SIDE_MISSIONS_COMPLETED_HOTKEY_STATE) {
MAIN_AND_SIDE_MISSIONS_COMPLETED_HOTKEY_STATE = 1;
if (*main_mission_status != 1) {
*main_mission_status = 1;
} else {
*main_mission_status = 0;
}
}
} else {
MAIN_AND_SIDE_MISSIONS_COMPLETED_HOTKEY_STATE = 0;
}
{$asm}
missionA_code:
mov r9d,[r10+18]
lea rcx,[rsi+00000120]
mov edx,r13d
jmp missionA_return
missionA:
jmp far missionA_newmem
missionA_return:
registersymbol(missionA)
//--------------------------------------------------------
// SIDE MISSION
aobscanmodule(missionB,game.dll,41 8B 47 38 83 E8 02 83 F8 01 8B 83 14 08 00 00) // should be unique
alloc(missionB_newmem,$1000)
label(missionB_code)
label(missionB_return)
missionB_newmem:
{$ccode r15=r15}
side_mission_status = (int*)(r15+0x38);
if (GetAsyncKeyState(MAIN_AND_SIDE_MISSIONS_COMPLETED_HOTKEY) & 0x8000) {
if (!MAIN_AND_SIDE_MISSIONS_COMPLETED_HOTKEY_STATE) {
MAIN_AND_SIDE_MISSIONS_COMPLETED_HOTKEY_STATE = 1;
if (*side_mission_status != 2) {
*side_mission_status = 2;
} else {
*side_mission_status = 0;
}
}
} else {
MAIN_AND_SIDE_MISSIONS_COMPLETED_HOTKEY_STATE = 0;
}
{$asm}
missionB_code:
mov eax,[r15+38]
sub eax,02
cmp eax,01
mov eax,[rbx+00000814]
jmp missionB_return
missionB:
jmp far missionB_newmem
nop 2
missionB_return:
registersymbol(missionB)
[DISABLE]
dealloc(missionA_newmem)
missionA:
db 45 8B 4A 18 48 8D 8E 20 01 00 00 41 8B D5
dealloc(missionB_newmem)
missionB:
db 41 8B 47 38 83 E8 02 83 F8 01 8B 83 14 08 00 00
|
|
|
| Back to top |
|
 |
Autem Expert Cheater
Reputation: 1
Joined: 30 Jan 2023 Posts: 155
|
Posted: Tue May 21, 2024 4:19 pm Post subject: |
|
|
Just a guess but maybe because you have two "enable" sections. Delete the first [enable] and see if that fixes things.
Another idea might be to again reinforce ASM at the start of the disable section by adding another {$asm} right under [disable] just in case for some reason the asm label toward the end of your second enable block wasn't carried down. I can't fully explain why that happens sometimes, but it has happened to me in the past where if I add another asm label right at the start of the disable section, things work again. *shrug*
Also try having the deallocs from the disable section appear AFTER both of the AOBs have been run to restore the code. Don't deallocate it before you used it to restore the bytes. <-- edit: I stand corrected on this per Dark Byte's reply. The order shouldn't matter.
Let me know if any of this helped you out. I am curious!
Last edited by Autem on Wed May 22, 2024 2:58 pm; edited 2 times in total |
|
| Back to top |
|
 |
ParkourPenguin I post too much
Reputation: 152
Joined: 06 Jul 2014 Posts: 4715
|
Posted: Tue May 21, 2024 5:29 pm Post subject: |
|
|
You have two [ENABLE] sections. CE wouldn't even accept that as a valid AA script.
I'm assuming the first one shouldn't be there.
Execute the {$c} block only in the [ENABLE] section. Don't put it above [ENABLE] - that section of the AA script is executed when both enabling and disabling the script.
_________________
I don't know where I'm going, but I'll figure it out when I get there. |
|
| Back to top |
|
 |
Dark Byte Site Admin
Reputation: 471
Joined: 09 May 2003 Posts: 25827 Location: The netherlands
|
Posted: Tue May 21, 2024 11:57 pm Post subject: |
|
|
| Quote: |
Also try having the deallocs from the disable section appear AFTER both of the AOBs have been run to restore the code. Don't deallocate it before you used it to restore the bytes. <-- I would actually try this before my other suggestions, but noticed it last.
|
dealloc order doesn't matter. It only deallocates at the end, and only if all allocs are mentioned. If you miss one, nothing will be deallocated
_________________
Do not ask me about online cheats. I don't know any and wont help finding them.
Like my help? Join me on Patreon so i can keep helping |
|
| Back to top |
|
 |
Dave_Scream Cheater
Reputation: 0
Joined: 06 Dec 2009 Posts: 36
|
Posted: Wed May 22, 2024 2:16 pm Post subject: |
|
|
| ParkourPenguin wrote: | | Execute the {$c} block only in the [ENABLE] section. Don't put it above [ENABLE] - that section of the AA script is executed when both enabling and disabling the script. |
Yes the problem is here.
BUT
Isn't it true that the {$c} block before [ENABLE] lets you declare global variables? If I put this block in the [ENABLE] section, the variables won't be global anymore. And will be not possible to use them in other scripts?
|
|
| Back to top |
|
 |
Dark Byte Site Admin
Reputation: 471
Joined: 09 May 2003 Posts: 25827 Location: The netherlands
|
Posted: Wed May 22, 2024 2:20 pm Post subject: |
|
|
no. if it's outside of [enable] it just means it gets compiled by both enable and disable. Which is not very useful for {$c} blocks as all {$c} code generated is global to begin with
_________________
Do not ask me about online cheats. I don't know any and wont help finding them.
Like my help? Join me on Patreon so i can keep helping |
|
| Back to top |
|
 |
|