Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

AppGameKit Classic Chat / [SOLVED] Wonky behavior with SetRawWritePath()

Author
Message
Nieb
6
Years of Service
User Offline
Joined: 13th May 2014
Location: Lurking
Posted: 17th Apr 2019 04:51 Edited at: 17th Apr 2019 05:01
Using SetRawWritePath() causes "window_position.dat" to stop working properly. It also causes all media to fail to load when debugging.
Test project attached. Toggle the "IF" to test.

Attachments

Login to view attachments

The author of this post has marked a post as an answer.

Go to answer

Nieb
6
Years of Service
User Offline
Joined: 13th May 2014
Location: Lurking
Posted: 5th Aug 2019 00:27 Edited at: 5th Aug 2019 01:34
So I'm trying to manually copy the "window_position.dat" file to the dir that AppGameKit looks for it in when the app starts. I've gotten it to semi-work. However, it only works after closing and opening the app twice.

I need this too happen when the app ends. Does anyone know if AppGameKit has an "#OnEnd, do this" or something similar? (needs to work with external termination, for example pressing the X on the window)
blink0k
Moderator
7
Years of Service
User Offline
Joined: 22nd Feb 2013
Location: the land of oz
Posted: 5th Aug 2019 01:17 Edited at: 5th Aug 2019 01:19
I think AppGameKit will create windows_position.dat in C:\Users\your_id\AppData\Local\AGKApps\your_app\media so maybe check and see if there is a file because AppGameKit will probably use that one first
If you only need it for windows you could probably use This plugin to get the time the file was updated (AGK updates the file when you move the window) and if it has changed the overwrite it with the required data
Alternatively you could read the contents of the file and if it doesn't match what you require then update the file

You could also have two apps;
1. Uses RunApp() to launch the second app
2. When second app ends update the file
Nieb
6
Years of Service
User Offline
Joined: 13th May 2014
Location: Lurking
Posted: 5th Aug 2019 01:29
The issue is that AppGameKit only writes the file when the app terminates, and it only reads it when the app starts, before it starts executing your code.
Seems like running a separate helper app is the only solution. Yuk, that's ugly.
blink0k
Moderator
7
Years of Service
User Offline
Joined: 22nd Feb 2013
Location: the land of oz
Posted: 5th Aug 2019 01:38 Edited at: 5th Aug 2019 01:38
If you look at the file's date/time you can see it writes to the file when you move the window.
Paul Johnston
TGC Developer
17
Years of Service
User Offline
Joined: 16th Nov 2002
Location: United Kingdom
Posted: 5th Aug 2019 13:18
This post has been marked by the post author as the answer.
SetRawWritePath is deprecated for this reason, you should use file paths beginning with "raw:" to access any file in the filesystem instead, for example OpenToWrite( "raw:C:\Path\To\File.txt" )
Nieb
6
Years of Service
User Offline
Joined: 13th May 2014
Location: Lurking
Posted: 6th Aug 2019 01:52 Edited at: 6th Aug 2019 01:53
Thanks Paul, forgoing SetRawWritePath() and using "raw:" does the job.
It would be nice to have the WinPosDat in the same dir but, not a big issue.
Nieb
6
Years of Service
User Offline
Joined: 13th May 2014
Location: Lurking
Posted: 6th Aug 2019 06:40
Found a bug with SaveImage() while using "raw:", the file ends up in:
C:\Users\USERNAME\AppData\Local\AGKApps\SaveImageTest\raw.C\Users\USERNAME\GameData\SaveImageTest\screenshot\

Test project attached.

Also, the screenshot doesn't show the ClearColor, perhaps that's a fault of my screenshot code.

Attachments

Login to view attachments
Paul Johnston
TGC Developer
17
Years of Service
User Offline
Joined: 16th Nov 2002
Location: United Kingdom
Posted: 6th Aug 2019 17:04
This line

Is replacing all : characters with dots, which is also converting "raw:" into "raw."
Nieb
6
Years of Service
User Offline
Joined: 13th May 2014
Location: Lurking
Posted: 6th Aug 2019 20:50
Derp, my bad. Thanks again.

Login to post a reply

Server time is: 2020-06-04 06:19:25
Your offset time is: 2020-06-04 06:19:25