Author Topic: config saves for steam  (Read 134 times)

Offline MrPlow

  • Prof. Inline
  • *****
  • Posts: 1177
    • View Profile
config saves for steam
« on: 2017-Nov-16 »
Hi Guys

What is the best location for saving game files for Steam game so that updates will not overwrite the old files?

Do I use the Media folder, documents or other?

Ta
Comp:
Speccy-48k, Speccy-128k, Amigas, PCs

Offline spacefractal

  • Community Developer
  • Prof. Inline
  • ******
  • Posts: 3326
    • View Profile
    • Space Fractal
Re: config saves for steam
« Reply #1 on: 2017-Nov-16 »
document folder and then create a sub folder.... and then  do a lots of dat files, not single files. this is what im did in Karma Miwa and Greedy Mouse. This was implented using "iCloud" system with on Windows just creating a lots of dat files. Here its was only the higest score that got saved.

Code: GLBasic [Select]
GLOBAL ActualFolder$

FUNCTION iCLOUDPUT: name$, value$, code$="234521"
        ?IFDEF IPHONE
                IMPORT "C" void CloudPut(const char*, const char*)
                CloudPut(name$, value$)
        ?ENDIF
        LOCAL OK=OPENFILE(1, ActualFolder$+name$+".dat", 0)
        IF OK=1
                value$=ENCRYPT$(code$+name$, value$)
                WRITELINE 1, value$
                CLOSEFILE 1
        ENDIF
  ENDFUNCTION

FUNCTION iCLOUDGET$: name$, code$="234521"
        LOCAL value$=""
        ?IFDEF IPHONE
                IMPORT "C" const char* CloudGet(const char*)
                value$=CloudGet(name$)
                IF value$<>"" THEN RETURN value$
        ?ENDIF
        IF value$=""
                IF DOESFILEEXIST(ActualFolder$+name$+".dat")
                        LOCAL OK=OPENFILE(1, ActualFolder$+name$+".dat", 1)
                        IF OK=1
                                READLINE 1, value$
                                CLOSEFILE 1
                                value$=DECRYPT$(code$+name$, value$)
                        ENDIF
                ENDIF
        ENDIF
        RETURN value$
ENDFUNCTION

FUNCTION iCLOUDSYNC:
        ?IFDEF IPHONE
                IMPORT "C" void CloudSync()
                CloudSync()
        ?ENDIF
ENDFUNCTION

FUNCTION ICLOUDSTART: SaveFileDoc$
        ActualFolder$=SaveFileDoc$
        ActualFolder$=REPLACE$(ActualFolder$, "save2.ini", "")
        ActualFolder$=REPLACE$(ActualFolder$, "save.ini", "")
ENDFUNCTION
 

Code: GLBasic [Select]
FUNCTION Game_Mouse_CloudSync: value$, name$
        LOCAL sc2=iCLOUDGET$(name$+value$)
        LOCAL sc=GetStr$(value$, name$)
        IF sc>sc2
                IF sc>0 THEN iCLOUDPUT(name$+value$, sc)
        ELSE
                IF sc2>0 THEN SetStr(value$, name$, sc2)
        ENDIF
ENDFUNCTION
 

This is what im does for progress. im do not save settings its self in the cloud throught.
Greedy Mouse - Karma Miwa - Spot Race - CatchOut - Android Extras - is on a vacation trip, home before end of few days in jan.

Offline MrPlow

  • Prof. Inline
  • *****
  • Posts: 1177
    • View Profile
Re: config saves for steam
« Reply #2 on: 2017-Nov-16 »
Thanks SF!
Comp:
Speccy-48k, Speccy-128k, Amigas, PCs