Sign in to follow this  
Mark_Tempe2

how do you make savegames on vista ?

Recommended Posts

sorry for such a nubi question but I am not a professional programmer. I am adopting my game to work on vista and I run in to problems . here is what (I think) I know : you can save the game in program file directory but all of the game saves must be in My Documents folder . To my knowledge path to my documents folder will be different on every computer because in the path there will be a user name , example : C:\Documents and Settings\(user name)\My Documents . Apparently there is a way to find the user name using : SHGetSpecialFolderLocation() with CSIDL_LOCAL_APPDATA unfortunately I have no idea how to do that . I am using VC ++ 6 and in documentation I have not found any thing like CSIDL_LOCAL_APPDATA I did search the net , this forum and other forums for the answer , unfortunately I did not come up with anything useful in solving this problem . Which is odd because this has to be a common problem for nubies . Perhaps I used wrong key words. I really appreciate help with this problem . here is the code I use to load and save one of my game files. save file : //////////////////////////////////////////////////////////// FILE *pFile; pFile = fopen(SaveNameC,"wb"); fwrite (Cyngiel,sizeof(int),6,pFile); fwrite (SilaStrzaluTabela,sizeof(int),4,pFile); fwrite (KoordStrzalux,sizeof(int),20*6,pFile); fwrite (KoordStrzaluy,sizeof(int),20*6,pFile); fwrite (MatWturnaStrzalu,sizeof(int),8*8,pFile); fwrite (KooedynatyBlokow,sizeof(int),8,pFile); fwrite (KooedynatyBlokow2,sizeof(int),8,pFile); fwrite (WytrzymaloscBlokow,sizeof(int),8,pFile); fwrite (KoordynatExplozjix,sizeof(int),8,pFile); fwrite (KoordynatExplozjiy,sizeof(int),8,pFile); fwrite (OdliczKlatekiExpl,sizeof(int),8,pFile); fwrite (KoordynatBonusay,sizeof(int),8,pFile); fwrite (KoordynatBonusax,sizeof(int),8,pFile); fwrite (RodzajBonusa,sizeof(int),8,pFile); fwrite (ZmienneSaveLabirynt,sizeof(int),140,pFile); fclose (pFile); //////////////////////////////////////////////////////////// load file : //////////////////////////////////////////////////////////// FILE *pFile; pFile = fopen(SaveNameC,"r+b"); fread(&Cyngiel,sizeof(int),6,pFile); fread(&SilaStrzaluTabela,sizeof(int),4,pFile); fread(&KoordStrzalux,sizeof(int),20*6,pFile); fread(&KoordStrzaluy,sizeof(int),20*6,pFile); fread(&MatWturnaStrzalu,sizeof(int),8*8,pFile); fread(&KooedynatyBlokow,sizeof(int),8,pFile); fread(&KooedynatyBlokow2,sizeof(int),8,pFile); fread(&WytrzymaloscBlokow,sizeof(int),8,pFile); fread(&KoordynatExplozjix,sizeof(int),8,pFile); fread(&KoordynatExplozjiy,sizeof(int),8,pFile); fread(&OdliczKlatekiExpl,sizeof(int),8,pFile); fread(&KoordynatBonusay,sizeof(int),8,pFile); fread(&KoordynatBonusax,sizeof(int),8,pFile); fread(&RodzajBonusa,sizeof(int),8,pFile); fread(&ZmienneSaveLabirynt,sizeof(int),140,pFile); fclose(pFile); ////////////////////////////////////////////////////////////

Share this post


Link to post
Share on other sites
Unfortunately, the special folder functions that you're looking for came out with Windows 2000, and Windows ME, both of which came out significantly after MSVC 6, so MSVC 6 doesn't have the headers and libraries necessary to use them. If you want to use the shell folder functions, you should either find a version of the Platform SDK that supports MSVC 6 and came out after Windows 2000/ME or update compilers. MSVC 2008 Express Edition has recently been released for free on the Microsoft website.

Alternately, you can try using ExpandEnvironmentStrings() with APPDATA or USERPROFILE environment variables to get a folder in the user's profile area. However, this isn't particularly reliable.

Share this post


Link to post
Share on other sites
MSVC6 is a decade old, the best option for you is to update to a newer version of Visual Studio. You can get the Visual C++ 2008 Express Edition for free from Microsoft and will then be able to use the special folder functions.

I'm surprised you havn't run into a lot of other problems caused by your outdated compiler and IDE, it really is worth the learning curve of updating to the new environment when the tools you're using are that old.

Share this post


Link to post
Share on other sites
Quote:
Original post by jbadams
MSVC6 is a decade old, the best option for you is to update to a newer version of Visual Studio. You can get the Visual C++ 2008 Express Edition for free from Microsoft and will then be able to use the special folder functions.

I'm surprised you havn't run into a lot of other problems caused by your outdated compiler and IDE, it really is worth the learning curve of updating to the new environment when the tools you're using are that old.


Seconded. It's rather strange to be up-to-date with your operating system (despite the negative publicity Vista has received) but ten years off with your IDE.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this