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 


Need example of using synchronize()

 
Post new topic   Reply to topic    Cheat Engine Forum Index -> Cheat Engine
View previous topic :: View next topic  
Author Message
zxuiji
Advanced Cheater
Reputation: 1

Joined: 26 Sep 2016
Posts: 70

PostPosted: Mon Oct 29, 2018 9:38 am    Post subject: Need example of using synchronize() Reply with quote

Trying to verify some patch codes are being reached in a thread, tried to call print for it but I think it's causing an access violation. Might be something else but until I know how to use synchronize() I won't be able to verify.
_________________
Those who do not trust in christ to save them from their sins will only experience hell when their soul is released from it's earthly vessel.
Back to top
View user's profile Send private message
Dark Byte
Site Admin
Reputation: 470

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

PostPosted: Mon Oct 29, 2018 9:43 am    Post subject: Reply with quote

print is thread-safe(synchronized itself) so that shouldn't cause an issue

But if you're inside a thread (inMainThread() returns false ) then you can call synchronize(function()) or synchronize(function(...),...) to run the given code inside the main thread. Only the main thread can access things that affect the gui, like addresslist, memoryrecords, button states, etc... (that includes both writes AND reads)

e.g:
Code:

synchronize(function(p1,p2)
  print('hello')
  print('p1='..p1)
  print('p2='..p2)
end, 1,'parameter 2')


or to show it more clearly:
Code:

createThread(function(t)
print('before inMainThread='..tostring(inMainThread()))

synchronize(function(p1,p2)
  print('inMainThread='..tostring(inMainThread()))
  print('p1='..p1)
  print('p2='..p2)
end, 1,'parameter 2')

print('after inMainThread='..tostring(inMainThread()))

end)

returns
Code:

before inMainThread=false
inMainThread=true
p1=1
p2=parameter 2
after inMainThread=false

_________________
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
zxuiji
Advanced Cheater
Reputation: 1

Joined: 26 Sep 2016
Posts: 70

PostPosted: Mon Oct 29, 2018 10:29 am    Post subject: Reply with quote

Judging from that I should be creating an anonymous to call what I want then?

Anyway dunno what I did but the access violation went away, now trying to find an example the compare code types to make sure my own are correct, (e.g. I got a D type before a 4 type when possibly I need a e type instead)

https://gamehacking.org/wiki/Code_Types_%28Playstation_2%29

and

http://macrox.gshi.org/The%20Hacking%20Text.htm#ps2_code_types

are currently all I found and they don't give examples :(

And btw thanks :)

_________________
Those who do not trust in christ to save them from their sins will only experience hell when their soul is released from it's earthly vessel.
Back to top
View user's profile Send private message
predprey
Master Cheater
Reputation: 24

Joined: 08 Oct 2015
Posts: 486

PostPosted: Mon Oct 29, 2018 10:55 am    Post subject: Reply with quote

Examples? Why not just search for existing action replay codes instead?

http://uk.codejunkies.com/search/codes_search_results.aspx?platval=1&game=&plat=PlayStation2

Also, for all your old school hacking needs.

http://www.codemasters-project.net
Back to top
View user's profile Send private message
zxuiji
Advanced Cheater
Reputation: 1

Joined: 26 Sep 2016
Posts: 70

PostPosted: Mon Oct 29, 2018 12:10 pm    Post subject: Reply with quote

Thanks, wound up doing that while waiting for your reply. Also thanks for the code-master link, been trying to remember the name of that site XD
_________________
Those who do not trust in christ to save them from their sins will only experience hell when their soul is released from it's earthly vessel.
Back to top
View user's profile Send private message
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