Browse Source

Add save file path setting

master
Miloslav Ciz 2 weeks ago
parent
commit
eaeafc6368
  1. 4
      main_csfml.c
  2. 4
      main_sdl.c
  3. 8
      settings.h

4
main_csfml.c

@ -157,7 +157,7 @@ void SFG_processEvent(uint8_t event, uint8_t data) @@ -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]) @@ -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)
{

4
main_sdl.c

@ -127,7 +127,7 @@ uint32_t SFG_getTimeMs() @@ -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]) @@ -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");

8
settings.h

@ -19,6 +19,14 @@ @@ -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

Loading…
Cancel
Save