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 


Clear CE Temp Directory
Goto page 1, 2  Next
 
Post new topic   Reply to topic    Cheat Engine Forum Index -> Cheat Engine
View previous topic :: View next topic  
Author Message
++METHOS
I post too much
Reputation: 92

Joined: 29 Oct 2010
Posts: 4197

PostPosted: Sat Feb 18, 2017 12:03 pm    Post subject: Clear CE Temp Directory Reply with quote

Is there a way to force CE to automatically cleanup its temp directory during future sessions in the case where we have lingering files due to unexpected crashes and the like?

Thanks!
Back to top
View user's profile Send private message
Dark Byte
Site Admin
Reputation: 457

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

PostPosted: Sat Feb 18, 2017 2:33 pm    Post subject: Reply with quote

set your clock 7 days ahead and then open and close CE
it will delete all the files older than 7 days

_________________
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
mgr.inz.Player
I post too much
Reputation: 218

Joined: 07 Nov 2008
Posts: 4438
Location: W kraju nad Wisla. UTC+01:00

PostPosted: Sat Feb 18, 2017 5:37 pm    Post subject: Reply with quote

You decreased it from 7 to 2:
Code:
                if (currenttime-age) > 60*60*24*2 then //if older than 2 days  then
                  deletefolder(f);

_________________
Back to top
View user's profile Send private message MSN Messenger
++METHOS
I post too much
Reputation: 92

Joined: 29 Oct 2010
Posts: 4197

PostPosted: Sat Feb 18, 2017 5:44 pm    Post subject: Reply with quote

Thanks, DB.

Any chance for incorporating an option in settings for this to occur during each session or for the purge to occur each day? Very Happy
I assume that this improves scan times? If so, are those scan times affected across different sessions?

Thanks!

EDIT:
Thanks, mgr.inz.Player! I may make use of this, depending on DB's response. I suppose, purging the temporary data may not be recommended, depending on the purpose of that data. I am curious about it.
Back to top
View user's profile Send private message
mgr.inz.Player
I post too much
Reputation: 218

Joined: 07 Nov 2008
Posts: 4438
Location: W kraju nad Wisla. UTC+01:00

PostPosted: Sat Feb 18, 2017 5:55 pm    Post subject: This post has 2 review(s) Reply with quote

you can use something like this for official CE6.6 (from 10/10/2016)
Code:
autoAssemble([[509D14:
db 48 3D 01 00 00 00 // cmp rax,00000001]],true)

createMemScan().destroy()

autoAssemble([[509D14:
db 48 3D 00 A3 02 00 // original: cmp rax,0002A300]],true)


It's for CE 64bit.




Code:
autoAssemble([[4DDDB7:
db 3D 01 00 00 00 // cmp eax,00000001]],true)

createMemScan().destroy()

autoAssemble([[4DDDB7:
db 3D 00 A3 02 00 // original: cmp eax,0002A300]],true)


for 32bit


As you see, I changed it to 1 second. You can change it to 2 hours, or something like that.

_________________
Back to top
View user's profile Send private message MSN Messenger
beagle
Cheater
Reputation: 0

Joined: 27 Aug 2014
Posts: 36

PostPosted: Sat Feb 18, 2017 7:00 pm    Post subject: Reply with quote

is this related to my menus updating slowly? sometimes it gets so slow i can comfortably watch each checkbox in a list load down the panel. when i restart the computer everything is back at the regular "instant" speed.
Back to top
View user's profile Send private message
++METHOS
I post too much
Reputation: 92

Joined: 29 Oct 2010
Posts: 4197

PostPosted: Sun Feb 19, 2017 9:14 am    Post subject: Reply with quote

Okay. I am going to assume that these temporary scan files are not beneficial across multiple sessions. If that is the case, I am curious why the purge cycle is set at 7 days.

Nonetheless...

mgr.inz.Player wrote:
You decreased it from 7 to 2:
Code:
                if (currenttime-age) > 60*60*24*2 then //if older than 2 days  then
                  deletefolder(f);


Thanks, mgr.inz.Player. I am trying to set this up in my auto-run folder as a standalone Lua script, but I have not been successful with it, thus far. I will continue to research this.

Also, would 60*60*24*1 create a daily purge cycle?

Thanks!
Back to top
View user's profile Send private message
ParkourPenguin
I post too much
Reputation: 138

Joined: 06 Jul 2014
Posts: 4275

PostPosted: Sun Feb 19, 2017 9:57 am    Post subject: Reply with quote

++METHOS:
I'm pretty sure mgr.inz.Player was referring to the CE source code (github link)

_________________
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
++METHOS
I post too much
Reputation: 92

Joined: 29 Oct 2010
Posts: 4197

PostPosted: Sun Feb 19, 2017 10:07 am    Post subject: Reply with quote

Yes, but since I have never tried to compile CE myself, I was researching a way to set this up as a simple Lua script. Although, I suppose I could try to make an assembly patch for it, but I would really prefer something a bit more permanent, with a lower probability of breaking on future releases and minimal maintenance. It also gives me another reason to try to learn Lua. Very Happy

To be honest, I do not even know if this is possible with Lua.
Back to top
View user's profile Send private message
ParkourPenguin
I post too much
Reputation: 138

Joined: 06 Jul 2014
Posts: 4275

PostPosted: Sun Feb 19, 2017 11:33 am    Post subject: This post has 1 review(s) Reply with quote

Code:
os.execute('forfiles /p "' .. getCurrentMemscan().ScanresultFolder:match('(.-)\\?$') .. '\\.." /d -1 /c "cmd /c del @path"')

This deletes any files within CE's temp directory that are more than 1 day old (specified by the 1 in "/d -1"). Note that this uses the date of the last modification and not the time: files less than 24 hours old can still be deleted if the file was last modified yesterday.

Edit: changed code to get path using info in DB's post below

_________________
I don't know where I'm going, but I'll figure it out when I get there.


Last edited by ParkourPenguin on Sun Feb 19, 2017 11:51 am; edited 1 time in total
Back to top
View user's profile Send private message
Dark Byte
Site Admin
Reputation: 457

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

PostPosted: Sun Feb 19, 2017 11:44 am    Post subject: This post has 1 review(s) Reply with quote

getCurrentMemscan().ScanresultFolder will return the path of the scanresults. go up one folder and you're in the tempfolder of ce.


i have had situations where i had ce and a game running for more than one day though, and if the tempfiles get deleted it will mess up the scan

_________________
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
mgr.inz.Player
I post too much
Reputation: 218

Joined: 07 Nov 2008
Posts: 4438
Location: W kraju nad Wisla. UTC+01:00

PostPosted: Sun Feb 19, 2017 12:03 pm    Post subject: Reply with quote

Code:
howOldInSeconds = 1*24*60*60

if cheatEngineIs64Bit() then
  script1=[[aobscanmodule(ScanFilesOlderThan_64bit,cheatengine-x86_64.exe,48 3D 00 A3 02 00)
registersymbol(ScanFilesOlderThan_64bit)
alloc(newmem,$1000,cheatengine-x86_64.exe)
label(return)

newmem:
  cmp rax,#{timespan}
  jmp return

ScanFilesOlderThan_64bit:
  jmp newmem
  nop
return:]]
  script2=[[ScanFilesOlderThan_64bit:
db 48 3D 00 A3 02 00]]
else
  script1=[[aobscanmodule(ScanFilesOlderThan_32bit,cheatengine-i386.exe,3D 00 A3 02 00)
registersymbol(ScanFilesOlderThan_32bit)
alloc(newmem,$1000,cheatengine-i386.exe)
label(return)

newmem:
  cmp eax,#{timespan}
  jmp return

ScanFilesOlderThan_32bit:
  jmp newmem
return:]]
  script2=[[ScanFilesOlderThan_32bit:
db 3D 00 A3 02 00]]
end

autoAssemble(script1:gsub('{timespan}',howOldInSeconds), true)
createMemScan().destroy()
autoAssemble(script2, true)




This code is not designed for autorun folder when howOldInSeconds is less than few hours.
Or just execute it when you need it.
And be sure there is only one CE instance running.


Edit:
added missing #

_________________


Last edited by mgr.inz.Player on Sun Feb 19, 2017 1:12 pm; edited 1 time in total
Back to top
View user's profile Send private message MSN Messenger
++METHOS
I post too much
Reputation: 92

Joined: 29 Oct 2010
Posts: 4197

PostPosted: Sun Feb 19, 2017 12:53 pm    Post subject: Reply with quote

ParkourPenguin-
Thank you for your help. I am still really stupid when it comes to Lua, so I apologize in advance, for not knowing the basics here. I tried creating a .lua file using only the code that you pasted, and I receive an error:

Code:
Purge Temp Folder.lua error:...les (x86)/Cheat Engine 6.6/autorun/Purge Temp Folder.lua:1: attempt to index a nil value


I should note that my temp folder is actually on a secondary drive (D). I should have mentioned this sooner...sorry.

Dark Byte-
Really!? I think that is extreme and I do not foresee myself needing to run CE for 24 hours straight. Very Happy Also, thank you for your help.

mgr.inz.Player-
Thank you for your help. I created a .lua file using only the code that you pasted. I did not receive any errors, but after closing CE, temporary files still remain that were modified/created 2 days ago. Could this be caused by the fact that I am not using the default temporary folder?

Thanks, again, everyone. I will +rep you when I am able.
Back to top
View user's profile Send private message
ParkourPenguin
I post too much
Reputation: 138

Joined: 06 Jul 2014
Posts: 4275

PostPosted: Sun Feb 19, 2017 1:01 pm    Post subject: Reply with quote

Seems like getCurrentMemscan() returns nil when run from the autorun folder. Delay it for a bit and it should be fine.
Code:
local t = createTimer()
t.Interval = 100
t.OnTimer = function()
  os.execute('forfiles /p "' .. getCurrentMemscan().ScanresultFolder:match('(.-)\\?$') .. '\\.." /d -1 /c "cmd /c del @path"')
  t.destroy()
end

_________________
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
mgr.inz.Player
I post too much
Reputation: 218

Joined: 07 Nov 2008
Posts: 4438
Location: W kraju nad Wisla. UTC+01:00

PostPosted: Sun Feb 19, 2017 1:10 pm    Post subject: This post has 1 review(s) Reply with quote

Looks like my script also needs a delay.

Code:
local howOldInSeconds = 1*24*60*60
local script1,script2='',''

if cheatEngineIs64Bit() then
  script1=[[aobscanmodule(ScanFilesOlderThan_64bit,cheatengine-x86_64.exe,48 3D 00 A3 02 00)
registersymbol(ScanFilesOlderThan_64bit)
alloc(newmem,$1000,cheatengine-x86_64.exe)
label(return)

newmem:
  cmp rax,#{timespan}
  jmp return

ScanFilesOlderThan_64bit:
  jmp newmem
  nop
return:]]
  script2=[[ScanFilesOlderThan_64bit:
db 48 3D 00 A3 02 00]]
else
  script1=[[aobscanmodule(ScanFilesOlderThan_32bit,cheatengine-i386.exe,3D 00 A3 02 00)
registersymbol(ScanFilesOlderThan_32bit)
alloc(newmem,$1000,cheatengine-i386.exe)
label(return)

newmem:
  cmp eax,#{timespan}
  jmp return

ScanFilesOlderThan_32bit:
  jmp newmem
return:]]
  script2=[[ScanFilesOlderThan_32bit:
db 3D 00 A3 02 00]]
end

local function purge(t)
  t.destroy()
  autoAssemble(script1:gsub('{timespan}',howOldInSeconds), true)
  createMemScan().destroy()
  autoAssemble(script2, true)
end

createTimer().OnTimer = purge

_________________
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
Goto page 1, 2  Next
Page 1 of 2

 
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