aboutsummaryrefslogtreecommitdiff
path: root/sword2
diff options
context:
space:
mode:
authorJonathan Gray2003-08-24 13:46:42 +0000
committerJonathan Gray2003-08-24 13:46:42 +0000
commit527fa147c58e352ab1f8b2f6c801d5bbee234fbd (patch)
tree4ed85ae502a081ccc8fdd27ebd08603f29289917 /sword2
parent2c4f688e597613304d2ef0bd1a817fe0ba523522 (diff)
downloadscummvm-rg350-527fa147c58e352ab1f8b2f6c801d5bbee234fbd.tar.gz
scummvm-rg350-527fa147c58e352ab1f8b2f6c801d5bbee234fbd.tar.bz2
scummvm-rg350-527fa147c58e352ab1f8b2f6c801d5bbee234fbd.zip
make settings use SaveFileManager stuff as well
svn-id: r9848
Diffstat (limited to 'sword2')
-rw-r--r--sword2/controls.cpp31
1 files changed, 19 insertions, 12 deletions
diff --git a/sword2/controls.cpp b/sword2/controls.cpp
index 38e489c42b..622cbf4202 100644
--- a/sword2/controls.cpp
+++ b/sword2/controls.cpp
@@ -1892,19 +1892,22 @@ int32 ReadOptionSettings(void) //pete10Jun97
// byte 8 = subtitle state and byte 9 = object label state.
uint8 buff[10];
- FILE *fp;
+ SaveFile *fp;
+ SaveFileManager *mgr = g_system->get_savefile_manager();
- if ((fp = fopen("Settings.dat","rb"))== NULL)
+ if (!(fp = mgr->open_savefile("Settings.dat", g_sword2->getSavePath(), false)))
return (1);
- if (fread(buff,1,10,fp) != 10)
+ if (fp->read(buff, 10) != 10)
{
- fclose(fp);
+ delete fp;
+ delete mgr;
return (2);
}
- fclose(fp);
-
+ delete fp;
+ delete mgr;
+
g_sword2->_sound->SetMusicVolume(buff[0]);
g_sword2->_sound->SetSpeechVolume(buff[1]);
g_sword2->_sound->SetFxVolume(buff[2]);
@@ -1930,7 +1933,9 @@ int32 ReadOptionSettings(void) //pete10Jun97
int32 WriteOptionSettings(void) //pete10Jun97
{
uint8 buff[10];
- FILE *fp;
+ SaveFile *fp;
+ SaveFileManager *mgr = g_system->get_savefile_manager();
+
buff[0] = g_sword2->_sound->GetMusicVolume();
buff[1] = g_sword2->_sound->GetSpeechVolume();
@@ -1943,17 +1948,19 @@ int32 WriteOptionSettings(void) //pete10Jun97
buff[8] = pointerTextSelected;
buff[9] = stereoReversed;
- if ((fp = fopen("Settings.dat","wb"))== NULL)
+ if (!(fp = mgr->open_savefile("Settings.dat", g_sword2->getSavePath(), true)))
return (1);
- if (fwrite(buff,1,10,fp) != 10)
+ if (fp->write(buff, 10) != 10)
{
- fclose(fp);
+ delete fp;
+ delete mgr;
return (2);
}
- fclose(fp);
-
+ delete fp;
+ delete mgr;
+
return (0);
}