[Scummvm-git-logs] scummvm master -> e9cf5dd00cc94ee859d3529faa60d66f2a79ca29
sdelamarre
noreply at scummvm.org
Wed Jun 25 21:38:29 UTC 2025
This automated email contains information about 1 new commit which have been
pushed to the 'scummvm' repo located at https://api.github.com/repos/scummvm/scummvm .
Summary:
e9cf5dd00c GOB: Distinguish between "CD" vs "hard disk" INI files (Adibou2/Anglais)
Commit: e9cf5dd00cc94ee859d3529faa60d66f2a79ca29
https://github.com/scummvm/scummvm/commit/e9cf5dd00cc94ee859d3529faa60d66f2a79ca29
Author: Simon Delamarre (simon.delamarre14 at gmail.com)
Date: 2025-06-25T23:29:00+02:00
Commit Message:
GOB: Distinguish between "CD" vs "hard disk" INI files (Adibou2/Anglais)
Sometimes a modifiable INI file in the game directory (which is mapped
to a save file in ScummVM) is initialized by copying a read-only file
from the CD.
Both files have the same name. But in some situations, the scripts need
to read values from the CD version before copying it. This commit ensures
we fetch the correct version in such a case.
Fixes the Environment CD version check in Adibou2/Anglais and Adibou2/Musique.
Changed paths:
engines/gob/iniconfig.cpp
engines/gob/iniconfig.h
engines/gob/inter_v7.cpp
diff --git a/engines/gob/iniconfig.cpp b/engines/gob/iniconfig.cpp
index a6f65ae113e..1d922b3f6dd 100644
--- a/engines/gob/iniconfig.cpp
+++ b/engines/gob/iniconfig.cpp
@@ -40,13 +40,13 @@ INIConfig::~INIConfig() {
delete c->_value.config;
}
-bool INIConfig::getValue(Common::String &result, const Common::String &file,
+bool INIConfig::getValue(Common::String &result, const Common::String &file, bool isCd,
const Common::String §ion, const Common::String &key,
const Common::String &def) {
Config config;
if (!getConfig(file, config)) {
- if (!openConfig(file, config)) {
+ if (!openConfig(file, isCd, config)) {
result = def;
return false;
}
@@ -60,12 +60,12 @@ bool INIConfig::getValue(Common::String &result, const Common::String &file,
return true;
}
-bool INIConfig::setValue(const Common::String &file, const Common::String §ion,
+bool INIConfig::setValue(const Common::String &file, bool isCd, const Common::String §ion,
const Common::String &key, const Common::String &value) {
Config config;
if (!getConfig(file, config))
- if (!createConfig(file, config))
+ if (!createConfig(file, isCd, config))
return false;
config.config->setKey(key, section, value);
@@ -89,9 +89,8 @@ bool INIConfig::getConfig(const Common::String &file, Config &config) {
return true;
}
-bool INIConfig::readConfigFromDisk(const Common::String &file, Gob::INIConfig::Config &config) {
- SaveLoad::SaveMode mode = _vm->_saveLoad->getSaveMode(file.c_str());
- if (mode == SaveLoad::kSaveModeSave) {
+bool INIConfig::readConfigFromDisk(const Common::String &file, bool isCd, Gob::INIConfig::Config &config) {
+ if (!isCd && _vm->_saveLoad->getSaveMode(file.c_str()) == SaveLoad::kSaveModeSave) {
debugC(3, kDebugFileIO, "Loading INI from save file \"%s\"", file.c_str());
// Read from save file
int size = _vm->_saveLoad->getSize(file.c_str());
@@ -121,12 +120,12 @@ bool INIConfig::readConfigFromDisk(const Common::String &file, Gob::INIConfig::C
}
-bool INIConfig::openConfig(const Common::String &file, Config &config) {
+bool INIConfig::openConfig(const Common::String &file, bool isCd, Config &config) {
config.config = new Common::INIFile();
config.config->allowNonEnglishCharacters();
config.created = false;
- if (!readConfigFromDisk(file, config)) {
+ if (!readConfigFromDisk(file, isCd, config)) {
delete config.config;
config.config = nullptr;
return false;
@@ -138,12 +137,12 @@ bool INIConfig::openConfig(const Common::String &file, Config &config) {
return true;
}
-bool INIConfig::createConfig(const Common::String &file, Config &config) {
+bool INIConfig::createConfig(const Common::String &file, bool isCd, Config &config) {
config.config = new Common::INIFile();
config.config->allowNonEnglishCharacters();
config.created = true;
- readConfigFromDisk(file, config); // May return false in case we are dealing with a temporary file
+ readConfigFromDisk(file, isCd, config); // May return false in case we are dealing with a temporary file
_configs.setVal(file, config);
diff --git a/engines/gob/iniconfig.h b/engines/gob/iniconfig.h
index 790ea08f442..66e7e5feaf4 100644
--- a/engines/gob/iniconfig.h
+++ b/engines/gob/iniconfig.h
@@ -41,11 +41,11 @@ public:
INIConfig(GobEngine *vm);
~INIConfig();
- bool getValue(Common::String &result, const Common::String &file,
+ bool getValue(Common::String &result, const Common::String &file, bool isCd,
const Common::String §ion, const Common::String &key,
const Common::String &def = "");
- bool setValue(const Common::String &file, const Common::String §ion,
+ bool setValue(const Common::String &file, bool isCd, const Common::String §ion,
const Common::String &key, const Common::String &value);
private:
@@ -61,9 +61,9 @@ private:
bool getConfig(const Common::String &file, Config &config);
- bool readConfigFromDisk(const Common::String &file, Config &config);
- bool openConfig(const Common::String &file, Config &config);
- bool createConfig(const Common::String &file, Config &config);
+ bool readConfigFromDisk(const Common::String &file, bool isCd, Config &config);
+ bool openConfig(const Common::String &file, bool isCd, Config &config);
+ bool createConfig(const Common::String &file, bool isCd, Config &config);
};
} // End of namespace Gob
diff --git a/engines/gob/inter_v7.cpp b/engines/gob/inter_v7.cpp
index bdcb3ee98fa..6775eed2ba3 100644
--- a/engines/gob/inter_v7.cpp
+++ b/engines/gob/inter_v7.cpp
@@ -1035,7 +1035,8 @@ void Inter_v7::o7_draw0xA0() {
void Inter_v7::o7_getINIValue() {
- Common::String file = getFile(_vm->_game->_script->evalString());
+ bool isCd = false;
+ Common::String file = getFile(_vm->_game->_script->evalString(), true, &isCd);
Common::String section = _vm->_game->_script->evalString();
Common::String key = _vm->_game->_script->evalString();
@@ -1046,7 +1047,7 @@ void Inter_v7::o7_getINIValue() {
key = oemToANSI(key);
Common::String value;
- _inis.getValue(value, file, section, key, def);
+ _inis.getValue(value, file, isCd, section, key, def);
value = ansiToOEM(value);
@@ -1055,7 +1056,8 @@ void Inter_v7::o7_getINIValue() {
}
void Inter_v7::o7_setINIValue() {
- Common::String file = getFile(_vm->_game->_script->evalString());
+ bool isCd = false;
+ Common::String file = getFile(_vm->_game->_script->evalString(), true, &isCd);
Common::String section = _vm->_game->_script->evalString();
Common::String key = _vm->_game->_script->evalString();
@@ -1066,7 +1068,7 @@ void Inter_v7::o7_setINIValue() {
key = oemToANSI(key);
value = oemToANSI(value);
- bool success = _inis.setValue(file, section, key, value);
+ bool success = _inis.setValue(file, isCd, section, key, value);
WRITE_VAR(27, success ? 1 : 0);
debugC(5, kDebugGameFlow, "o7_setINIValue: %s: [%s] %s := %s", file.c_str(), section.c_str(), key.c_str(), value.c_str());
}
More information about the Scummvm-git-logs
mailing list