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 / [BUG] Running on the fresh-installed XP cause to strange bug (inside)

Author
Message
Alex_Peres
AGK Master
15
Years of Service
User Offline
Joined: 13th May 2009
Location: The Milky Way Galaxy
Posted: 5th Oct 2016 17:10 Edited at: 5th Oct 2016 17:12
Running on the fresh-installed XP cause to this strange bug:
(How to avoid this?)

Attachments

Login to view attachments
Paul Johnston
TGC Developer
21
Years of Service
User Offline
Joined: 16th Nov 2002
Location: United Kingdom
Posted: 6th Oct 2016 13:33
That would suggest the app had trouble writing to or reading from the %APPDATA% folder, on XP I think this translates to "C:\Documents and Settings\Username\Application Data", which may be a hidden folder. AppGameKit tries to write to "Local\AGKApps\AppName"
Alex_Peres
AGK Master
15
Years of Service
User Offline
Joined: 13th May 2009
Location: The Milky Way Galaxy
Posted: 6th Oct 2016 21:54
So, Paul, what can I do to make it work?
I've tested it on the fresh install on virtual machine and on the old installation of XP SP2 on my old machine. Result the same.
I used the "template_windows_vs2015" from the AGK...
Paul Johnston
TGC Developer
21
Years of Service
User Offline
Joined: 16th Nov 2002
Location: United Kingdom
Posted: 7th Oct 2016 13:41
Whilst the error message is displayed, does the "C:\Documents and Settings\Username\Application Data\Local\AGKApps" folder exist, and does it have anything in it?
Alex_Peres
AGK Master
15
Years of Service
User Offline
Joined: 13th May 2009
Location: The Milky Way Galaxy
Posted: 7th Oct 2016 16:18 Edited at: 7th Oct 2016 16:19
I found the "AGKApps" folder but here: "C:\Documents and Settings\IEUser\Local Settings\Application Data\AGKApps" inside there are some AppGameKit folders but almost all of them empty or have an empty "media" folder and "window_position.dat" file.

... after tests:
It seams like AppGameKit tier1 examples don't have this bug.
It shows only in tier2 example. The tier2 "Template.exe" file doesn't create Template folder here: "C:\Documents and Settings\IEUser\Local Settings\Application Data\AGKApps".
I use VS2015.
Paul Johnston
TGC Developer
21
Years of Service
User Offline
Joined: 16th Nov 2002
Location: United Kingdom
Posted: 7th Oct 2016 17:39
Since you are in Tier 2, open Core.cpp and find the _tWinMain function. Just before the call to agk::InitGL((void*)hWnd) add the following lines

That will tell you where it is trying to write to, maybe it will reveal something
Alex_Peres
AGK Master
15
Years of Service
User Offline
Joined: 13th May 2009
Location: The Milky Way Galaxy
Posted: 7th Oct 2016 19:06
Hey, Paul! I think I've found the bug.

It shows since you add this:



AGK_v2.0.19 - Works fine, without this issue!

AGK2.0.21 creates the "My Company" folder and the "Template" folder inside. But it seems like it doesn't see it or something like that... And just after this bug it deletes the "Template" folder.

Paul Johnston
TGC Developer
21
Years of Service
User Offline
Joined: 16th Nov 2002
Location: United Kingdom
Posted: 7th Oct 2016 19:59
Quote: "creates the "My Company" folder and the "Template" folder inside ... And just after this bug it deletes the "Template" folder"

That's as expected, it creates Arial.png and some other temporary files in this folder, and that at the end of the app deletes them all and the Template folder itself (if empty). The question is why it isn't writing (or reading) the Arial.png file. Do any files exist in that folder when the app is running, and was the path displayed in the message box correct?
Alex_Peres
AGK Master
15
Years of Service
User Offline
Joined: 13th May 2009
Location: The Milky Way Galaxy
Posted: 7th Oct 2016 20:39
Yes, "Arial.png" and the other files were created. And the message box showed the correct path.
As I said before it seems like AppGameKit doesn't see those files...
Alex_Peres
AGK Master
15
Years of Service
User Offline
Joined: 13th May 2009
Location: The Milky Way Galaxy
Posted: 7th Oct 2016 20:46
When the message box with the path shows the Template folder is created but empty. Just when I press "OK" to close this message box - I can see the created files. But game shows the exception about missed font image.
Paul Johnston
TGC Developer
21
Years of Service
User Offline
Joined: 16th Nov 2002
Location: United Kingdom
Posted: 7th Oct 2016 21:26
Quote: "When the message box with the path shows the Template folder is created but empty. Just when I press "OK" to close this message box - I can see the created files"

That is as expected, the files aren't actually created until the InitGL method.

Before the call to InitGL call agk::SetErrorMode(1) so it will continue after the error, then after the call to InitGL I would try loading the file myself. Use agk:penToRead( 1, "/Arial.png" ) and see what happens, does agk::GetFileExists( "/Arial.png" ) return 1 or 0, try the following code which is similar to what AppGameKit is doing internally
Alex_Peres
AGK Master
15
Years of Service
User Offline
Joined: 13th May 2009
Location: The Milky Way Galaxy
Posted: 7th Oct 2016 22:16
I've setted the "agk::SetErrorMode(1);" before the InitGL and added your code after InitGL. Message showed "Not found". But then the "Template" example has started fine and showed me the "FPS"...
Paul Johnston
TGC Developer
21
Years of Service
User Offline
Joined: 16th Nov 2002
Location: United Kingdom
Posted: 7th Oct 2016 23:50
Ok, now replace

with


The app continues to run because it is ignoring the error, but not loading these files could cause other problems down the line.
Alex_Peres
AGK Master
15
Years of Service
User Offline
Joined: 13th May 2009
Location: The Milky Way Galaxy
Posted: 8th Oct 2016 00:04
Now the message box shows: "Found".
Paul Johnston
TGC Developer
21
Years of Service
User Offline
Joined: 16th Nov 2002
Location: United Kingdom
Posted: 8th Oct 2016 01:46
Interesting, so it is just the stat() command that fails for some reason. You can find out why by replacing the above code with
Alex_Peres
AGK Master
15
Years of Service
User Offline
Joined: 13th May 2009
Location: The Milky Way Galaxy
Posted: 8th Oct 2016 12:38
Now it shows: "Returned: -1, Error: 22".
Paul Johnston
TGC Developer
21
Years of Service
User Offline
Joined: 16th Nov 2002
Location: United Kingdom
Posted: 8th Oct 2016 18:27
Error 22 is "invalid parameter", it appears the stat function is broken in VS2015 on Windows XP, you can read more here http://stackoverflow.com/questions/32452777/visual-c-2015-express-stat-not-working-on-windows-xp. I'll just replace it with fopen for the next version. Thanks for your help in tracking it down.
Alex_Peres
AGK Master
15
Years of Service
User Offline
Joined: 13th May 2009
Location: The Milky Way Galaxy
Posted: 8th Oct 2016 19:24
You welcome!

Login to post a reply

Server time is: 2024-09-29 19:20:31
Your offset time is: 2024-09-29 19:20:31