Add save file path setting

This commit is contained in:
Miloslav Ciz 2023-01-22 20:38:09 +01:00
parent 6abe7d7b0b
commit eaeafc6368
3 changed files with 12 additions and 4 deletions

View File

@ -157,7 +157,7 @@ void SFG_processEvent(uint8_t event, uint8_t data)
void SFG_save(uint8_t data[SFG_SAVE_SIZE])
{
FILE *f = fopen("anarch.sav","wb");
FILE *f = fopen(SFG_SAVE_FILE_PATH,"wb");
if (f == NULL)
return;
@ -169,7 +169,7 @@ void SFG_save(uint8_t data[SFG_SAVE_SIZE])
uint8_t SFG_load(uint8_t data[SFG_SAVE_SIZE])
{
FILE *f = fopen("anarch.sav","rb");
FILE *f = fopen(SFG_SAVE_FILE_PATH,"rb");
if (f != NULL)
{

View File

@ -127,7 +127,7 @@ uint32_t SFG_getTimeMs()
void SFG_save(uint8_t data[SFG_SAVE_SIZE])
{
FILE *f = fopen("anarch.sav","wb");
FILE *f = fopen(SFG_SAVE_FILE_PATH,"wb");
puts("SDL: opening and writing save file");
@ -145,7 +145,7 @@ void SFG_save(uint8_t data[SFG_SAVE_SIZE])
uint8_t SFG_load(uint8_t data[SFG_SAVE_SIZE])
{
#ifndef __EMSCRIPTEN__
FILE *f = fopen("anarch.sav","rb");
FILE *f = fopen(SFG_SAVE_FILE_PATH,"rb");
puts("SDL: opening and reading save file");

View File

@ -19,6 +19,14 @@
#ifndef _SFG_SETTINGS_H
#define _SFG_SETTINGS_H
/**
Path to the save file. You may want to set this to some absolute path,
depending on your system.
*/
#ifndef SFG_SAVE_FILE_PATH
#define SFG_SAVE_FILE_PATH "anarch.sav"
#endif
/**
Time multiplier in SFG_Units (1.0 == 1024). This can be used to slow down or
speed up the game. Note that this also changes the rendering FPS accordingly