Ticket #7993: simonsave.3.diff

File simonsave.3.diff, 3.8 KB (added by eriktorbjorn, 22 years ago)

Revised patch against an August 2 snapshot

  • scummvm/saveload.cpp

    diff -ur ScummVM-cvs20020803/scummvm/saveload.cpp ScummVM-cvs20020803+hack/scummvm/saveload.cpp
    old new  
    2828#include "config-file.h"
    2929#include "resource.h"
    3030#include "saveload.h"
     31#include "util.h"
    3132
    3233struct SaveGameHeader {
    3334        uint32 type;
     
    166167
    167168void Scumm::makeSavegameName(char *out, int slot, bool compatible)
    168169{
    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 
    193170        // 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);
    195172}
    196173
    197174bool Scumm::getSavegameName(int slot, char *desc)
  • scummvm/simon/simon.cpp

    diff -ur ScummVM-cvs20020803/scummvm/simon/simon.cpp ScummVM-cvs20020803+hack/scummvm/simon/simon.cpp
    old new  
    2020 */
    2121
    2222#include "stdafx.h"
     23#include "util.h"
    2324#include "simon.h"
    2425#include <errno.h>
    2526
     
    44364437char *SimonState::gen_savename(int slot)
    44374438{
    44384439        static char buf[256];
    4439         const char *dir;
    44404440
    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);
    44514443        return buf;
    44524444}
    44534445
  • scummvm/util.cpp

    diff -ur ScummVM-cvs20020803/scummvm/util.cpp ScummVM-cvs20020803+hack/scummvm/util.cpp
    old new  
    1919 */
    2020
    2121#include "stdafx.h"
     22#include "scumm.h"
     23#include "config-file.h"
    2224#include "util.h"
    2325
     26char *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
    2458// 8-bit alpha blending routines
    2559int BlendCache[256][256];
    2660
  • scummvm/util.h

    diff -ur ScummVM-cvs20020803/scummvm/util.h ScummVM-cvs20020803+hack/scummvm/util.h
    old new  
    2323
    2424#include "scummsys.h"
    2525
     26char *GetSavegameDir();
     27
    2628int RGBMatch(byte *palette, int r, int g, int b);
    2729int Blend(int src, int dst, byte *palette);
    2830void ClearBlendCache(byte *palette, int weight);