diff -ur ScummVM-cvs20020803/scummvm/saveload.cpp ScummVM-cvs20020803+hack/scummvm/saveload.cpp
old
|
new
|
|
28 | 28 | #include "config-file.h" |
29 | 29 | #include "resource.h" |
30 | 30 | #include "saveload.h" |
| 31 | #include "util.h" |
31 | 32 | |
32 | 33 | struct SaveGameHeader { |
33 | 34 | uint32 type; |
… |
… |
|
166 | 167 | |
167 | 168 | void Scumm::makeSavegameName(char *out, int slot, bool compatible) |
168 | 169 | { |
169 | | |
170 | | const char *dir = NULL; |
171 | | |
172 | | #ifdef _WIN32_WCE |
173 | | dir = _gameDataPath; |
174 | | #else |
175 | | |
176 | | #if !defined(MACOS_CARBON) |
177 | | dir = getenv("SCUMMVM_SAVEPATH"); |
178 | | #endif |
179 | | |
180 | | // If SCUMMVM_SAVEPATH was not specified, try to use game specific savepath from config |
181 | | if (!dir || dir[0] == 0) |
182 | | dir = scummcfg->get("savepath"); |
183 | | |
184 | | // If SCUMMVM_SAVEPATH was not specified, try to use general path from config |
185 | | if (!dir || dir[0] == 0) |
186 | | dir = scummcfg->get("savepath", "scummvm"); |
187 | | |
188 | | // If no save path was specified, use no directory prefix |
189 | | if (dir == NULL) |
190 | | dir = ""; |
191 | | #endif |
192 | | |
193 | 170 | // snprintf should be used here, but it's not portable enough |
194 | | sprintf(out, "%s%s.%c%.2d", dir, _exe_name, compatible ? 'c' : 's', slot); |
| 171 | sprintf(out, "%s%s.%c%.2d", GetSavegameDir(), _exe_name, compatible ? 'c' : 's', slot); |
195 | 172 | } |
196 | 173 | |
197 | 174 | bool Scumm::getSavegameName(int slot, char *desc) |
diff -ur ScummVM-cvs20020803/scummvm/simon/simon.cpp ScummVM-cvs20020803+hack/scummvm/simon/simon.cpp
old
|
new
|
|
20 | 20 | */ |
21 | 21 | |
22 | 22 | #include "stdafx.h" |
| 23 | #include "util.h" |
23 | 24 | #include "simon.h" |
24 | 25 | #include <errno.h> |
25 | 26 | |
… |
… |
|
4436 | 4437 | char *SimonState::gen_savename(int slot) |
4437 | 4438 | { |
4438 | 4439 | static char buf[256]; |
4439 | | const char *dir; |
4440 | 4440 | |
4441 | | /* perhaps getenv should be added to OSystem */ |
4442 | | #ifndef _WIN32_WCE |
4443 | | dir = getenv("SCUMMVM_SAVEPATH"); |
4444 | | if (dir == NULL) |
4445 | | dir = ""; |
4446 | | #else |
4447 | | dir = _game_path; |
4448 | | #endif |
4449 | | |
4450 | | sprintf(buf, "%sSAVE.%.3d", dir, slot); |
| 4441 | // snprintf should be used here, but it's not portable enough |
| 4442 | sprintf(buf, "%sSAVE.%.3d", GetSavegameDir(), slot); |
4451 | 4443 | return buf; |
4452 | 4444 | } |
4453 | 4445 | |
diff -ur ScummVM-cvs20020803/scummvm/util.cpp ScummVM-cvs20020803+hack/scummvm/util.cpp
old
|
new
|
|
19 | 19 | */ |
20 | 20 | |
21 | 21 | #include "stdafx.h" |
| 22 | #include "scumm.h" |
| 23 | #include "config-file.h" |
22 | 24 | #include "util.h" |
23 | 25 | |
| 26 | char *GetSavegameDir() |
| 27 | { |
| 28 | static char savegame_dir[256]; |
| 29 | const char *dir; |
| 30 | |
| 31 | #ifdef _WIN32_WCE |
| 32 | // Maybe we should pass _gameDataPath as an argument to this function |
| 33 | // instead of using g_scumm ... |
| 34 | dir = g_scumm->_gameDataPath; |
| 35 | #else |
| 36 | |
| 37 | #if !defined(MACOS_CARBON) |
| 38 | dir = getenv("SCUMMVM_SAVEPATH"); |
| 39 | #endif |
| 40 | |
| 41 | // If SCUMMVM_SAVEPATH was not specified, try to use game specific savepath from config |
| 42 | if (!dir || dir[0] == 0) |
| 43 | dir = scummcfg->get("savepath"); |
| 44 | |
| 45 | // If SCUMMVM_SAVEPATH was not specified, try to use general path from config |
| 46 | if (!dir || dir[0] == 0) |
| 47 | dir = scummcfg->get("savepath", "scummvm"); |
| 48 | |
| 49 | // If no save path was specified, use no directory prefix |
| 50 | if (dir == NULL) |
| 51 | dir = ""; |
| 52 | #endif |
| 53 | |
| 54 | strcpy(savegame_dir, dir); |
| 55 | return savegame_dir; |
| 56 | } |
| 57 | |
24 | 58 | // 8-bit alpha blending routines |
25 | 59 | int BlendCache[256][256]; |
26 | 60 | |
diff -ur ScummVM-cvs20020803/scummvm/util.h ScummVM-cvs20020803+hack/scummvm/util.h
old
|
new
|
|
23 | 23 | |
24 | 24 | #include "scummsys.h" |
25 | 25 | |
| 26 | char *GetSavegameDir(); |
| 27 | |
26 | 28 | int RGBMatch(byte *palette, int r, int g, int b); |
27 | 29 | int Blend(int src, int dst, byte *palette); |
28 | 30 | void ClearBlendCache(byte *palette, int weight); |