aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCameron Cawley2020-01-02 22:32:03 +0000
committerFilippos Karapetis2020-01-11 17:34:12 +0200
commit5cd6812b9d53d532d12cfc81b6df144dc0e89d48 (patch)
tree66882f94e304ae59ec45e5f29f34dbfb4e6f996d
parente49282577fb10e65fd06fcb7808e300cf97b3ca8 (diff)
downloadscummvm-rg350-5cd6812b9d53d532d12cfc81b6df144dc0e89d48.tar.gz
scummvm-rg350-5cd6812b9d53d532d12cfc81b6df144dc0e89d48.tar.bz2
scummvm-rg350-5cd6812b9d53d532d12cfc81b6df144dc0e89d48.zip
GRAPHICS: Unify loading Windows cursor groups
-rw-r--r--graphics/wincursor.cpp60
-rw-r--r--graphics/wincursor.h8
2 files changed, 3 insertions, 65 deletions
diff --git a/graphics/wincursor.cpp b/graphics/wincursor.cpp
index 4cade1f5e2..7abd1a33ad 100644
--- a/graphics/wincursor.cpp
+++ b/graphics/wincursor.cpp
@@ -23,8 +23,6 @@
#include "common/ptr.h"
#include "common/stream.h"
#include "common/textconsole.h"
-#include "common/winexe_ne.h"
-#include "common/winexe_pe.h"
#include "graphics/wincursor.h"
@@ -242,63 +240,7 @@ WinCursorGroup::~WinCursorGroup() {
delete cursors[i].cursor;
}
-WinCursorGroup *WinCursorGroup::createCursorGroup(Common::NEResources *exe, const Common::WinResourceID &id) {
- Common::ScopedPtr<Common::SeekableReadStream> stream(exe->getResource(Common::kWinGroupCursor, id));
-
- if (!stream || stream->size() <= 6)
- return 0;
-
- stream->skip(4);
- uint32 cursorCount = stream->readUint16LE();
- if ((uint32)stream->size() < (6 + cursorCount * 14))
- return 0;
-
- WinCursorGroup *group = new WinCursorGroup();
- group->cursors.reserve(cursorCount);
-
- for (uint32 i = 0; i < cursorCount; i++) {
- stream->readUint16LE(); // width
- stream->readUint16LE(); // height
-
- // Plane count
- if (stream->readUint16LE() != 1) {
- delete group;
- return 0;
- }
-
- // Bits per pixel
- // NE cursors can only be 1bpp
- if (stream->readUint16LE() != 1) {
- delete group;
- return 0;
- }
-
- stream->readUint32LE(); // data size
- uint32 cursorId = stream->readUint16LE();
-
- Common::ScopedPtr<Common::SeekableReadStream> cursorStream(exe->getResource(Common::kWinCursor, cursorId));
- if (!cursorStream) {
- delete group;
- return 0;
- }
-
- WinCursor *cursor = new WinCursor();
- if (!cursor->readFromStream(*cursorStream)) {
- delete cursor;
- delete group;
- return 0;
- }
-
- CursorItem item;
- item.id = cursorId;
- item.cursor = cursor;
- group->cursors.push_back(item);
- }
-
- return group;
-}
-
-WinCursorGroup *WinCursorGroup::createCursorGroup(Common::PEResources *exe, const Common::WinResourceID &id) {
+WinCursorGroup *WinCursorGroup::createCursorGroup(Common::WinResources *exe, const Common::WinResourceID &id) {
Common::ScopedPtr<Common::SeekableReadStream> stream(exe->getResource(Common::kWinGroupCursor, id));
if (!stream || stream->size() <= 6)
diff --git a/graphics/wincursor.h b/graphics/wincursor.h
index d77314458b..77d00d2d69 100644
--- a/graphics/wincursor.h
+++ b/graphics/wincursor.h
@@ -29,8 +29,6 @@
#include "graphics/cursor.h"
namespace Common {
-class NEResources;
-class PEResources;
class SeekableReadStream;
}
@@ -56,10 +54,8 @@ struct WinCursorGroup {
Common::Array<CursorItem> cursors;
- /** Create a cursor group from an NE EXE, returns 0 on failure */
- static WinCursorGroup *createCursorGroup(Common::NEResources *exe, const Common::WinResourceID &id);
- /** Create a cursor group from an PE EXE, returns 0 on failure */
- static WinCursorGroup *createCursorGroup(Common::PEResources *exe, const Common::WinResourceID &id);
+ /** Create a cursor group from an EXE, returns 0 on failure */
+ static WinCursorGroup *createCursorGroup(Common::WinResources *exe, const Common::WinResourceID &id);
};
/**