Gamestudio Links
Zorro Links
Newest Posts
Change chart colours
by 7th_zorro. 05/11/24 09:25
Data from CSV not parsed correctly
by dr_panther. 05/06/24 18:50
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
4 registered members (AndrewAMD, Baklazhan, Ayumi, Hanky27), 1,387 guests, and 2 spiders.
Key: Admin, Global Mod, Mod
Newest Members
Hanky27, firatv, wandaluciaia, Mega_Rod, EternallyCurious
19051 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
Can 3dgs read from and write to %appdata%? #334501
07/23/10 18:06
07/23/10 18:06
Joined: Jun 2006
Posts: 2,640
Earth
Germanunkol Offline OP
Expert
Germanunkol  Offline OP
Expert

Joined: Jun 2006
Posts: 2,640
Earth
We're having the Problem that our game, once installed, won't run on win7 and Vista, seemingly because of administrative rights. We need to write and modify files in the folders. The manual entry on "save_dir" says to change the dir on windows vista.
Now we want to change the dir where everything is saved to the application data, since that's what it's for. Can 3dgs somehow access the %appdata% variable at runtime without any plugins?


~"I never let school interfere with my education"~
-Mark Twain
Re: Can 3dgs read from and write to %appdata%? [Re: Germanunkol] #334503
07/23/10 18:12
07/23/10 18:12
Joined: Nov 2007
Posts: 1,143
United Kingdom
DJBMASTER Offline
Serious User
DJBMASTER  Offline
Serious User

Joined: Nov 2007
Posts: 1,143
United Kingdom
The win32 function 'SHGetFolderPath" is what you want. You can pass in environment variables like APPDATA, PROGRAM_FILES, SYSTEM and it will return the path on the current system...

http://msdn.microsoft.com/en-us/library/bb762181(VS.85).aspx

Re: Can 3dgs read from and write to %appdata%? [Re: DJBMASTER] #334511
07/23/10 18:37
07/23/10 18:37
Joined: Jun 2006
Posts: 2,640
Earth
Germanunkol Offline OP
Expert
Germanunkol  Offline OP
Expert

Joined: Jun 2006
Posts: 2,640
Earth
Uh, yes. Exactly. Thanks...
How do I access that function in LiteC though? This gives me a syntax error:
HRESULT WINAPI SHGetFolderPath(HWND hwndOwner, int nFolder,HANDLE hToken,DWORD dwFlags,LPTSTR pszPath);
#define PRAGMA_API SHGetFolderPath;Shell32.dll!SHGetFolderPath


~"I never let school interfere with my education"~
-Mark Twain
Re: Can 3dgs read from and write to %appdata%? [Re: Germanunkol] #334512
07/23/10 18:39
07/23/10 18:39
Joined: Jan 2003
Posts: 4,615
Cambridge
Joey Offline
Expert
Joey  Offline
Expert

Joined: Jan 2003
Posts: 4,615
Cambridge
just an assumption: you have to specify either SHGetFolderPathA or SHGetFolderPathW

Re: Can 3dgs read from and write to %appdata%? [Re: Joey] #334531
07/23/10 19:46
07/23/10 19:46
Joined: Nov 2007
Posts: 1,143
United Kingdom
DJBMASTER Offline
Serious User
DJBMASTER  Offline
Serious User

Joined: Nov 2007
Posts: 1,143
United Kingdom
Code:
#include <acknex.h>
#include <default.c>
#include <windows.h>

HRESULT WINAPI SHGetFolderPath(HWND hwndOwner, int nFolder,HANDLE hToken,DWORD dwFlags,char* pszPath);
#define PRAGMA_API SHGetFolderPath;Shell32.dll!SHGetFolderPathA

const int APPDATA = 0x001A;
char buffer[260];

void main()
{
	
	SHGetFolderPath(NULL,APPDATA,0,NULL,buffer);
	error(buffer);
}



Re: Can 3dgs read from and write to %appdata%? [Re: DJBMASTER] #334542
07/23/10 20:29
07/23/10 20:29
Joined: Jun 2006
Posts: 2,640
Earth
Germanunkol Offline OP
Expert
Germanunkol  Offline OP
Expert

Joined: Jun 2006
Posts: 2,640
Earth
Perfect. Thank you very much.
I didn't convert LPTSTR into a char* pointer... and SHGetFolderPathA was the other Rroblem. So 0x001A is the value of CSIDL_APPDATA? interesting...


~"I never let school interfere with my education"~
-Mark Twain
Re: Can 3dgs read from and write to %appdata%? [Re: Germanunkol] #334549
07/23/10 21:09
07/23/10 21:09
Joined: Nov 2007
Posts: 1,143
United Kingdom
DJBMASTER Offline
Serious User
DJBMASTER  Offline
Serious User

Joined: Nov 2007
Posts: 1,143
United Kingdom
Yeh sorry I should have mentioned you have 2 signatures for ansi (SHGetFolderPathA) and unicode (SHGetFolderPathW).

I use this page to find all the CSIDL values...

http://www.pinvoke.net/default.aspx/shell32.shgetfolderpath


Moderated by  HeelX, Lukas, rayp, Rei_Ayanami, Superku, Tobias, TWO, VeT 

Gamestudio download | chip programmers | Zorro platform | shop | Data Protection Policy

oP group Germany GmbH | Birkenstr. 25-27 | 63549 Ronneburg / Germany | info (at) opgroup.de

Powered by UBB.threads™ PHP Forum Software 7.7.1