[Scummvm-git-logs] scummvm master -> 527b6e9d2dd1a787ff30b395e0c980bbc5b8179e
aquadran
noreply at scummvm.org
Sun Jan 30 23:42:13 UTC 2022
This automated email contains information about 1 new commit which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .
Summary:
527b6e9d2d HADESCH: Alloc PEResources on heap to avoid stack overflow
Commit: 527b6e9d2dd1a787ff30b395e0c980bbc5b8179e
https://github.com/scummvm/scummvm/commit/527b6e9d2dd1a787ff30b395e0c980bbc5b8179e
Author: PaweÅ KoÅodziejski (aquadran at gmail.com)
Date: 2022-01-31T00:42:09+01:00
Commit Message:
HADESCH: Alloc PEResources on heap to avoid stack overflow
Changed paths:
engines/hadesch/hadesch.cpp
engines/hadesch/hadesch.h
diff --git a/engines/hadesch/hadesch.cpp b/engines/hadesch/hadesch.cpp
index 23ceb1bbede..422e79b38fc 100644
--- a/engines/hadesch/hadesch.cpp
+++ b/engines/hadesch/hadesch.cpp
@@ -174,9 +174,9 @@ Common::MemoryReadStream *readWiseFile(Common::File &setupFile, const struct Wis
}
#endif
-Common::ErrorCode HadeschEngine::loadWindowsCursors(Common::PEResources &exe) {
+Common::ErrorCode HadeschEngine::loadWindowsCursors(Common::PEResources *exe) {
for (unsigned i = 0; i < ARRAYSIZE(cursorids); i++) {
- Graphics::WinCursorGroup *group = Graphics::WinCursorGroup::createCursorGroup(&exe, cursorids[i]);
+ Graphics::WinCursorGroup *group = Graphics::WinCursorGroup::createCursorGroup(exe, cursorids[i]);
if (!group) {
debug("Cannot find cursor group %d", cursorids[i]);
@@ -193,11 +193,13 @@ Common::ErrorCode HadeschEngine::loadWindowsCursors(Common::PEResources &exe) {
Common::ErrorCode HadeschEngine::loadCursors() {
debug("HadeschEngine: loading cursors");
- {
- Common::PEResources exe = Common::PEResources();
- if (exe.loadFromEXE("HADESCH.EXE")) {
- return loadWindowsCursors(exe);
- }
+ Common::PEResources *exe = new Common::PEResources();
+ if (exe->loadFromEXE("HADESCH.EXE")) {
+ Common::ErrorCode status = loadWindowsCursors(exe);
+ delete exe;
+ return status;
+ } else {
+ delete exe;
}
const char *const macPaths[] = {
@@ -247,9 +249,13 @@ Common::ErrorCode HadeschEngine::loadCursors() {
return Common::kUnsupportedGameidError;
}
- Common::PEResources exe = Common::PEResources();
- if (exe.loadFromEXE(hadeschExe)) {
- return loadWindowsCursors(exe);
+ exe = new Common::PEResources();
+ if (exe->loadFromEXE(hadeschExe)) {
+ Common::ErrorCode status = loadWindowsCursors(exe);
+ delete exe;
+ return status;
+ } else {
+ delete exe;
}
}
}
diff --git a/engines/hadesch/hadesch.h b/engines/hadesch/hadesch.h
index b3df76c2844..79d254f42c2 100644
--- a/engines/hadesch/hadesch.h
+++ b/engines/hadesch/hadesch.h
@@ -190,7 +190,7 @@ private:
RoomId roomId);
Common::ErrorCode loadCursors();
bool handleGenericCheat(const Common::String &cheat);
- Common::ErrorCode loadWindowsCursors(Common::PEResources &exe);
+ Common::ErrorCode loadWindowsCursors(Common::PEResources *exe);
struct Timer {
int32 next_time;
More information about the Scummvm-git-logs
mailing list