I thought this was a Linux issue or something, but looking closer at the code I think this is true for Windows as well.
If you delete the "persist.dat", start the game and modify settings, they will not be remembered the next time you open Oni.
The ONrPersist() function is supposed to store these settings in the "persist.dat".
|
static void ONrPersist(void) |
|
{ |
|
BFtFile *stream = BFrFile_FOpen(ONcPersistance_FileName, "w"); |
|
UUtError error; |
|
|
|
if (NULL != stream) { |
|
error = BFrFile_Write(stream, sizeof(ONtPersistance), &ONgPersistance); |
|
BFrFile_Close(stream); |
|
} |
|
|
|
return; |
|
} |
However,
BFrFile_FOpen() will error out since it uses
BFrFileRef_Set() which returns
BFcError_FileNotFound if the file doesn't already exist.
|
UUtError |
|
BFrFileRef_Set( |
|
BFtFileRef* inFileRef, |
|
const char* inFileName) // like make from name but does not create |
|
{ |
|
UUtError error; |
|
|
|
UUmAssert(NULL != inFileRef); |
|
UUmAssert(NULL != inFileName); |
|
|
|
if(strlen(inFileName) >= BFcMaxPathLength) |
|
{ |
|
UUmError_ReturnOnErrorMsg(UUcError_Generic, "Path name too long"); |
|
} |
|
|
|
/* Make sure the path name is valid */ |
|
error = BFiCheckFileName(inFileName); |
|
UUmError_ReturnOnError(error); |
|
|
|
if(BFiFileRef_PathNameExists(inFileName) == UUcFalse) |
|
{ |
|
return BFcError_FileNotFound; |
|
} |
Indeed there doesn't seem to be a good way to create a file at all in the provided API.
Looking at how BFrFile_Create() is used it seems likely that creating a BFtFileRef to a non-existing file shouldn't actually error out.
I thought this was a Linux issue or something, but looking closer at the code I think this is true for Windows as well.
If you delete the "persist.dat", start the game and modify settings, they will not be remembered the next time you open Oni.
The
ONrPersist()function is supposed to store these settings in the "persist.dat".OniFoxed/OniProj/OniGameSource/Oni_Persistance.c
Lines 152 to 163 in 9362f44
However,
BFrFile_FOpen()will error out since it usesBFrFileRef_Set()which returnsBFcError_FileNotFoundif the file doesn't already exist.OniFoxed/BungieFrameWork/BFW_Source/BFW_FileManager/Platform_Win32/BFW_FileManager_Win32.c
Lines 162 to 184 in 9362f44
Indeed there doesn't seem to be a good way to create a file at all in the provided API.
Looking at how
BFrFile_Create()is used it seems likely that creating aBFtFileRefto a non-existing file shouldn't actually error out.