Cheat Engine Forum Index Cheat Engine
The Official Site of Cheat Engine
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 


C in AA Custom Types Bug

 
Post new topic   Reply to topic    Cheat Engine Forum Index -> Cheat Engine
View previous topic :: View next topic  
Author Message
ParkourPenguin
I post too much
Reputation: 152

Joined: 06 Jul 2014
Posts: 4719

PostPosted: Fri Sep 22, 2023 7:34 pm    Post subject: C in AA Custom Types Bug Reply with quote

I'm trying to use C in an AA custom type, but I'm getting an error "Failure writing referenced addresses"
Code:
alloc(ConvertRoutine,1024)
alloc(ConvertBackRoutine,1024)
alloc(TypeName,256)
alloc(ByteSize,4)
alloc(UsesFloat,1)
alloc(UsesString,1)
alloc(MaxStringSize,2)
alloc(CallMethod,1)

TypeName:
db '4-byte C',0

ByteSize:
dd 4

UsesFloat:
db 0

UsesString:
db 0

MaxStringSize:
dw #100

CallMethod:
db 1

{$C}
#include <stdint.h>

int my_custom_type_convert(unsigned char *input, uintptr_t address){
  return *(int *)input;
}

void my_custom_type_convert_back(int i, uintptr_t address, unsigned char *output) {
  *(int *)output = i;
}
{$ASM}

ConvertRoutine:
  jmp my_custom_type_convert

ConvertBackRoutine:
  jmp my_custom_type_convert_back


Comment out `jmp my_custom_type_convert_back` and it works:
Code:
ConvertRoutine:
  jmp my_custom_type_convert

ConvertBackRoutine:
  //jmp my_custom_type_convert_back
Comment out the previous `jmp` and nothing changes: it doesn't work if the second `jmp` exists, and it works if it's commented out.

If there's anything under ConvertBackRoutine it stops working:
Code:
ConvertRoutine:
  jmp my_custom_type_convert

ConvertBackRoutine:
  ret
Fails with the same error.

But if I reverse the order of ConvertRoutine and ConvertBackRoutine, apparently everything works fine?
Code:
ConvertBackRoutine:
  jmp my_custom_type_convert_back

ConvertRoutine:
  jmp my_custom_type_convert


Running CE 7.5 on Linux via Wine 8.15 Staging
My head hurts. Does anyone else get this behaviour?

_________________
I don't know where I'm going, but I'll figure it out when I get there.
Back to top
View user's profile Send private message
Dark Byte
Site Admin
Reputation: 471

Joined: 09 May 2003
Posts: 25833
Location: The netherlands

PostPosted: Sat Sep 23, 2023 3:20 am    Post subject: Reply with quote

might already be fixed on github and 7.5.1 but i'll check later when i have time

edit: yeah, it's fixed

_________________
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
View user's profile Send private message MSN Messenger
Display posts from previous:   
Post new topic   Reply to topic    Cheat Engine Forum Index -> Cheat Engine All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Powered by phpBB © 2001, 2005 phpBB Group

CE Wiki   IRC (#CEF)   Twitter
Third party websites