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 


Web server plugin

 
Post new topic   Reply to topic    Cheat Engine Forum Index -> Cheat Engine
View previous topic :: View next topic  
Author Message
predprey
Master Cheater
Reputation: 24

Joined: 08 Oct 2015
Posts: 486

PostPosted: Thu Aug 02, 2018 5:00 pm    Post subject: Web server plugin Reply with quote

So I'm thinking of doing a server plugin that can allow users to connect to the host PC through a browser on any device (i.e. mobile phones) on the same LAN. So users may easily activate/deactivate memory records without alt-tabbing or getting up from the couch to reach their keyboard.

But I can't find a suitable exported function for getting the addresslist. Currently, I have two ideas in mind. Preferably, I will code in C/C++ using the Wt framework and get all necessary information through the Lua engine, caveat being that it requires a lot of reads from the Lua stack.

Alternatively, I can code using Lazarus and get all the tree nodes through the mainform pointer. But the web frameworks available for FreePascal seems lacking.

So, is there any other way I can get the addresslist to the plugin?
Back to top
View user's profile Send private message
Dark Byte
Site Admin
Reputation: 470

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

PostPosted: Thu Aug 02, 2018 11:31 pm    Post subject: Reply with quote

easiest is just use lua and invoke some lua functions like activateMemrec(id) or deactivateMemrec(id)

to call just do:
lua_getglobal(l,"activateMemrec")
lua_pushinteger(id)
lua_pcall(l,1,0,0)

and use luaL_doString ("......") to load your functions

_________________
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
predprey
Master Cheater
Reputation: 24

Joined: 08 Oct 2015
Posts: 486

PostPosted: Thu Aug 02, 2018 11:55 pm    Post subject: Reply with quote

Thanks, looks like I'll take the C++ option.
Back to top
View user's profile Send private message
Dark Byte
Site Admin
Reputation: 470

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

PostPosted: Fri Aug 03, 2018 2:26 am    Post subject: Reply with quote

If you have questions about lua, just ask. it's usually easier than it appears
_________________
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
predprey
Master Cheater
Reputation: 24

Joined: 08 Oct 2015
Posts: 486

PostPosted: Thu Aug 09, 2018 9:08 am    Post subject: Reply with quote

I'm getting Lua Panic errors by setting a timer to continuously refresh the client page.

---------------------------
Timer Exception
---------------------------
:TApplication->MainForm:TMainForm->pnlExtraMemRecInfo:TCEPanel->:TTimer:External exception E06D7363

Seems there is a conflict with CE's own update timer. Any ideas what might be causing it? My timer does access the addresslist through Lua every second, but I did check that the stack is managed and popped properly after each memory record retrieval. It doesn't crash or freeze immediately when these errors pop up and the addresslist state is synchronized between the browser and CE still. However, once such errors pops up, CE will lock up when closing. So it's not a problem I can ignore.
Back to top
View user's profile Send private message
Dark Byte
Site Admin
Reputation: 470

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

PostPosted: Thu Aug 09, 2018 9:40 am    Post subject: Reply with quote

do you use the lua state variable passed by the callback?

you're creating new timers constantly?
do you use threads ?

it could be your c++ code is running destructors on some objects using wrong typecasts or another exception (
https://blogs.msdn.microsoft.com/oldnewthing/20100730-00/?p=13273 )
and try without other extensions. perhaps they are conflicting (e.g pnlExtraMemRecInfo:TCEPanel is not a native CE object)

_________________
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
predprey
Master Cheater
Reputation: 24

Joined: 08 Oct 2015
Posts: 486

PostPosted: Thu Aug 09, 2018 9:53 am    Post subject: Reply with quote

I set the lua state taken from the exported functions as a global variable. The server instance is started on a separate thread. Timers are only created per web session e.g. refreshing/new user browsing.

I have a feeling it's my extension causing it. Totally forgot I had that extension. Thanks.
Back to top
View user's profile Send private message
Dark Byte
Site Admin
Reputation: 470

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

PostPosted: Thu Aug 09, 2018 12:16 pm    Post subject: Reply with quote

on function callbacks from lua always use the parameter it provides. Every thread has a unique lua state and functions can be called from other threads.

if you access lua from a new state, use the getLuaState function to get a new one

_________________
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
predprey
Master Cheater
Reputation: 24

Joined: 08 Oct 2015
Posts: 486

PostPosted: Fri Aug 17, 2018 8:07 am    Post subject: Reply with quote

So I have been thinking how to implement server push and eliminate the refresh timer on the client side. To do so I would need some way to detect a change in the addresslist. But CE does not support some of the TTreeView events that can easily be used for this e.g. OnAddition.

Thus, I currently have 2 ideas for it:
1. Do a timer on server side instead and periodically check for addresslist changes, either by saving the table and diff-ing the hash or individually check each memrec.

2. Use other events instead such as OnClick, OnMouseExit that are implemented in CE. However, this leaves some gaps where some actions will not be detected and pushed to clients.

Are there any better options I can go for?
Back to top
View user's profile Send private message
Dark Byte
Site Admin
Reputation: 470

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

PostPosted: Sat Aug 18, 2018 2:38 am    Post subject: Reply with quote

right now there's not mich i can think of. OnChange won't work ? (all published properties are available to lua)
_________________
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
predprey
Master Cheater
Reputation: 24

Joined: 08 Oct 2015
Posts: 486

PostPosted: Sat Aug 18, 2018 9:25 am    Post subject: Reply with quote

Yea, OnChange is a TTVChangedEvent, which is hidden in ceguicomponents.pas. I could make use of it, on top on OnAddition, OnDeletion and a few others.

It's fine though, I will just make use of what I have for now and update the plugin again as and when the events become available in future CE versions. Thanks for all the help till now. Smile
Back to top
View user's profile Send private message
Dark Byte
Site Admin
Reputation: 470

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

PostPosted: Sat Aug 18, 2018 12:17 pm    Post subject: Reply with quote

the addresslist isn't a ceguicomponent, it's a TTreeviewWithScroll which is a TtreeView which does have those properties published. (
https://github.com/cheat-engine/cheat-engine/blob/master/Cheat%20Engine/addresslist.pas )

if you're talking about something else like a component you created yourself then use the TTreeview component instead

see https://cheatengine.org/forum/viewtopic.php?p=5739406#5739406 for an example

_________________
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
predprey
Master Cheater
Reputation: 24

Joined: 08 Oct 2015
Posts: 486

PostPosted: Sun Aug 19, 2018 2:14 am    Post subject: Reply with quote

Dark Byte wrote:
the addresslist isn't a ceguicomponent, it's a TTreeviewWithScroll which is a TtreeView which does have those properties published. (
https://github.com/cheat-engine/cheat-engine/blob/master/Cheat%20Engine/addresslist.pas )

if you're talking about something else like a component you created yourself then use the TTreeview component instead

see https://cheatengine.org/forum/viewtopic.php?p=5739406#5739406 for an example


I tried poking at the TTreeviewWithScroll OnChange event but this was what the Lua engine returned:

Code:
local al = getAddressList()
print(tostring(al.getComponent(0).OnChange))


Error:This type of method:TTVChangedEvent is not yet supported
Script Error


Thereafter, I searched CE repo for "TTVChangedEvent" which led me to that section in ceguicomponents.pas so I assumed that it was a hidden property. But currently it does not seem possible to assign a function to the OnChange event.
Back to top
View user's profile Send private message
Dark Byte
Site Admin
Reputation: 470

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

PostPosted: Sun Aug 19, 2018 2:23 am    Post subject: Reply with quote

ah ok, i didn't check the type. i'll see about exposing more typedefs
_________________
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