[Scummvm-git-logs] scummvm master -> b09dab8c9fc6e4d3af35d154921a03c9511dd688
bonki
bonki at users.noreply.github.com
Sun May 6 00:01:57 CEST 2018
This automated email contains information about 3 new commits which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .
Summary:
f5c45e5ca4 PRINCE: Removed unused kBadSVG
13a08a0bb0 PRINCE: Add play time metadata to savegames
b09dab8c9f PRINCE: Add FIXMEs for potential bugs
Commit: f5c45e5ca435ce4d7bfaedc1f47518eb49055635
https://github.com/scummvm/scummvm/commit/f5c45e5ca435ce4d7bfaedc1f47518eb49055635
Author: Adrian Frühwirth (bonki at users.noreply.github.com)
Date: 2018-05-06T00:00:38+02:00
Commit Message:
PRINCE: Removed unused kBadSVG
Changed paths:
engines/prince/saveload.cpp
diff --git a/engines/prince/saveload.cpp b/engines/prince/saveload.cpp
index 8832a6d..39860b8 100644
--- a/engines/prince/saveload.cpp
+++ b/engines/prince/saveload.cpp
@@ -38,7 +38,6 @@
namespace Prince {
-#define kBadSVG 99
#define kSavegameVersion 1
class InterpreterFlags;
Commit: 13a08a0bb0ac9153e7f597bf7b906329548024e3
https://github.com/scummvm/scummvm/commit/13a08a0bb0ac9153e7f597bf7b906329548024e3
Author: Adrian Frühwirth (bonki at users.noreply.github.com)
Date: 2018-05-06T00:00:38+02:00
Commit Message:
PRINCE: Add play time metadata to savegames
Changed paths:
engines/prince/detection.cpp
engines/prince/prince.h
engines/prince/saveload.cpp
diff --git a/engines/prince/detection.cpp b/engines/prince/detection.cpp
index 8fb63dd..0149a4b 100644
--- a/engines/prince/detection.cpp
+++ b/engines/prince/detection.cpp
@@ -175,6 +175,7 @@ bool PrinceMetaEngine::hasFeature(MetaEngineFeature f) const {
(f == kSavesSupportMetaInfo) ||
(f == kSavesSupportThumbnail) ||
(f == kSavesSupportCreationDate) ||
+ (f == kSavesSupportPlayTime) ||
(f == kSupportsListSaves) ||
(f == kSupportsLoadingDuringStartup) ||
(f == kSimpleSavesNames);
@@ -254,6 +255,7 @@ SaveStateDescriptor PrinceMetaEngine::querySaveMetaInfos(const char *target, int
desc.setThumbnail(header.thumbnail);
desc.setSaveDate(header.saveYear, header.saveMonth, header.saveDay);
desc.setSaveTime(header.saveHour, header.saveMinutes);
+ desc.setPlayTime(header.playTime * 1000);
return desc;
}
diff --git a/engines/prince/prince.h b/engines/prince/prince.h
index fcab7eb..efebd4c 100644
--- a/engines/prince/prince.h
+++ b/engines/prince/prince.h
@@ -86,8 +86,9 @@ struct SavegameHeader {
uint8 version;
Common::String saveName;
Graphics::Surface *thumbnail;
- int saveYear, saveMonth, saveDay;
- int saveHour, saveMinutes;
+ int16 saveYear, saveMonth, saveDay;
+ int16 saveHour, saveMinutes;
+ uint32 playTime;
};
#define kSavegameStrSize 14
diff --git a/engines/prince/saveload.cpp b/engines/prince/saveload.cpp
index 39860b8..e91bc34 100644
--- a/engines/prince/saveload.cpp
+++ b/engines/prince/saveload.cpp
@@ -44,13 +44,22 @@ class InterpreterFlags;
class Interpreter;
WARN_UNUSED_RESULT bool PrinceEngine::readSavegameHeader(Common::InSaveFile *in, SavegameHeader &header, bool skipThumbnail) {
+ header.version = 0;
+ header.saveName.clear();
+ header.thumbnail = nullptr;
+ header.saveYear = 0;
+ header.saveMonth = 0;
+ header.saveDay = 0;
+ header.saveHour = 0;
+ header.saveMinutes = 0;
+ header.playTime = 0;
+
// Get the savegame version
header.version = in->readByte();
if (header.version > kSavegameVersion)
return false;
// Read in the string
- header.saveName.clear();
char ch;
while ((ch = (char)in->readByte()) != '\0')
header.saveName += ch;
@@ -61,11 +70,12 @@ WARN_UNUSED_RESULT bool PrinceEngine::readSavegameHeader(Common::InSaveFile *in,
}
// Read in save date/time
- header.saveYear = in->readSint16LE();
- header.saveMonth = in->readSint16LE();
- header.saveDay = in->readSint16LE();
- header.saveHour = in->readSint16LE();
+ header.saveYear = in->readSint16LE();
+ header.saveMonth = in->readSint16LE();
+ header.saveDay = in->readSint16LE();
+ header.saveHour = in->readSint16LE();
header.saveMinutes = in->readSint16LE();
+ header.playTime = in->readUint32LE();
return true;
}
@@ -154,6 +164,8 @@ void PrinceEngine::writeSavegameHeader(Common::OutSaveFile *out, SavegameHeader
out->writeSint16LE(td.tm_mday);
out->writeSint16LE(td.tm_hour);
out->writeSint16LE(td.tm_min);
+
+ out->writeUint32LE(g_engine->getTotalPlayTime() / 1000);
}
void PrinceEngine::syncGame(Common::SeekableReadStream *readStream, Common::WriteStream *writeStream) {
@@ -413,6 +425,8 @@ bool PrinceEngine::loadGame(int slotNumber) {
delete readStream;
return false;
}
+
+ g_engine->setTotalPlayTime(saveHeader.playTime * 1000);
}
// Get in the savegame
Commit: b09dab8c9fc6e4d3af35d154921a03c9511dd688
https://github.com/scummvm/scummvm/commit/b09dab8c9fc6e4d3af35d154921a03c9511dd688
Author: Adrian Frühwirth (bonki at users.noreply.github.com)
Date: 2018-05-06T00:00:38+02:00
Commit Message:
PRINCE: Add FIXMEs for potential bugs
Changed paths:
engines/prince/inventory.cpp
engines/prince/script.cpp
diff --git a/engines/prince/inventory.cpp b/engines/prince/inventory.cpp
index fdb17b1..3183b94 100644
--- a/engines/prince/inventory.cpp
+++ b/engines/prince/inventory.cpp
@@ -394,6 +394,9 @@ void PrinceEngine::inventoryLeftMouseButton() {
int invObjExamEvent = _script->scanMobEvents(_invMobList[_selectedMob]._mask, _script->_scriptInfo.invObjExam);
if (invObjExamEvent == -1) {
// do_standard
+ // FIXME: UB?
+ // Constness of the pointer returned by c_str() is cast away (which generates a compiler warning)
+ // while it potentially gets modified inside printAt()
printAt(0, 216, (char *)_invMobList[_selectedMob]._examText.c_str(), kNormalWidth / 2, _invExamY);
_interpreter->setCurrentString(_invMobList[_selectedMob]._mask + 70000);
setVoice(0, 28, 1);
diff --git a/engines/prince/script.cpp b/engines/prince/script.cpp
index e40492f..d6d3251 100644
--- a/engines/prince/script.cpp
+++ b/engines/prince/script.cpp
@@ -1015,6 +1015,12 @@ void Interpreter::O_XORFLAG() {
void Interpreter::O_GETMOBTEXT() {
int32 mob = readScriptFlagValue();
_currentString = _vm->_locationNr * 100 + mob + 60001;
+ // FIXME: UB?
+ // This casts away the constness of the pointer returned by c_str() which is
+ // stored and potentially modified later (for example in printAt()).
+ // Also, the pointer is only valid as long as _vm->_mobList[mob]
+ // is around and _vm->_mobList[mob]._examText hasn't been modified by any of its
+ // non-const member functions which also might or might not be a problem.
_string = (byte *)_vm->_mobList[mob]._examText.c_str();
debugInterpreter("O_GETMOBTEXT mob %d", mob);
}
@@ -1831,6 +1837,12 @@ void Interpreter::O_DISABLENAK() {
void Interpreter::O_GETMOBNAME() {
int32 modId = readScriptFlagValue();
+ // FIXME: UB?
+ // This casts away the constness of the pointer returned by c_str() which is
+ // stored and potentially modified later (for example in printAt()).
+ // Also, the pointer is only valid as long as _vm->_mobList[mobId]
+ // is around and _vm->_mobList[mobId]._name hasn't been modified by any of its
+ // non-const member functions which also might or might not be a problem.
_string = (byte *)_vm->_mobList[modId]._name.c_str();
debugInterpreter("O_GETMOBNAME modId %d", modId);
}
More information about the Scummvm-git-logs
mailing list