aboutsummaryrefslogtreecommitdiff
path: root/graphics
diff options
context:
space:
mode:
Diffstat (limited to 'graphics')
-rw-r--r--graphics/fonts/winfont.cpp14
-rw-r--r--graphics/macgui/macmenu.cpp5
-rw-r--r--graphics/macgui/macmenu.h4
-rw-r--r--graphics/wincursor.cpp12
-rw-r--r--graphics/wincursor.h4
5 files changed, 23 insertions, 16 deletions
diff --git a/graphics/fonts/winfont.cpp b/graphics/fonts/winfont.cpp
index ec6ce6f89a..6ba0136a52 100644
--- a/graphics/fonts/winfont.cpp
+++ b/graphics/fonts/winfont.cpp
@@ -86,15 +86,18 @@ bool WinFont::loadFromFON(const Common::String &fileName, const WinFontDirEntry
}
bool WinFont::loadFromNE(const Common::String &fileName, const WinFontDirEntry &dirEntry) {
- Common::NEResources exe;
+ Common::NEResources *exe = new Common::NEResources();
- if (!exe.loadFromEXE(fileName))
+ if (!exe->loadFromEXE(fileName)) {
+ delete exe;
return false;
+ }
// Let's pull out the font directory
- Common::SeekableReadStream *fontDirectory = exe.getResource(Common::kWinFontDir, Common::String("FONTDIR"));
+ Common::SeekableReadStream *fontDirectory = exe->getResource(Common::kWinFontDir, Common::String("FONTDIR"));
if (!fontDirectory) {
warning("No font directory in '%s'", fileName.c_str());
+ delete exe;
return false;
}
@@ -105,18 +108,21 @@ bool WinFont::loadFromNE(const Common::String &fileName, const WinFontDirEntry &
// Couldn't match the face name
if (fontId == 0xffffffff) {
warning("Could not find face '%s' in '%s'", dirEntry.faceName.c_str(), fileName.c_str());
+ delete exe;
return false;
}
// Actually go get our font now...
- Common::SeekableReadStream *fontStream = exe.getResource(Common::kWinFont, fontId);
+ Common::SeekableReadStream *fontStream = exe->getResource(Common::kWinFont, fontId);
if (!fontStream) {
warning("Could not find font %d in %s", fontId, fileName.c_str());
+ delete exe;
return false;
}
bool ok = loadFromFNT(*fontStream);
delete fontStream;
+ delete exe;
return ok;
}
diff --git a/graphics/macgui/macmenu.cpp b/graphics/macgui/macmenu.cpp
index 2c9b3f0902..b79ba8cfbc 100644
--- a/graphics/macgui/macmenu.cpp
+++ b/graphics/macgui/macmenu.cpp
@@ -24,6 +24,7 @@
#include "common/stack.h"
#include "common/keyboard.h"
#include "common/macresman.h"
+#include "common/winexe_pe.h"
#include "graphics/primitives.h"
#include "graphics/font.h"
@@ -200,8 +201,8 @@ static Common::U32String readUnicodeString(Common::SeekableReadStream *stream) {
}
-MacMenu *MacMenu::createMenuFromPEexe(Common::PEResources &exe, MacWindowManager *wm) {
- Common::SeekableReadStream *menuData = exe.getResource(Common::kWinMenu, 128);
+MacMenu *MacMenu::createMenuFromPEexe(Common::PEResources *exe, MacWindowManager *wm) {
+ Common::SeekableReadStream *menuData = exe->getResource(Common::kWinMenu, 128);
if (!menuData)
return nullptr;
diff --git a/graphics/macgui/macmenu.h b/graphics/macgui/macmenu.h
index c8633c0cc7..13d374d084 100644
--- a/graphics/macgui/macmenu.h
+++ b/graphics/macgui/macmenu.h
@@ -24,11 +24,11 @@
#define GRAPHICS_MACGUI_MACMENU_H
#include "common/str-array.h"
-#include "common/winexe_pe.h"
namespace Common {
class U32String;
class MacResManager;
+class PEResources;
}
namespace Graphics {
@@ -51,7 +51,7 @@ public:
~MacMenu();
static Common::StringArray *readMenuFromResource(Common::SeekableReadStream *res);
- static MacMenu *createMenuFromPEexe(Common::PEResources &exe, MacWindowManager *wm);
+ static MacMenu *createMenuFromPEexe(Common::PEResources *exe, MacWindowManager *wm);
void setCommandsCallback(void (*callback)(int, Common::String &, void *), void *data) { _ccallback = callback; _cdata = data; }
void setCommandsCallback(void (*callback)(int, Common::U32String &, void *), void *data) { _unicodeccallback = callback; _cdata = data; }
diff --git a/graphics/wincursor.cpp b/graphics/wincursor.cpp
index 13d9bebfba..4cade1f5e2 100644
--- a/graphics/wincursor.cpp
+++ b/graphics/wincursor.cpp
@@ -242,8 +242,8 @@ 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));
+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;
@@ -276,7 +276,7 @@ WinCursorGroup *WinCursorGroup::createCursorGroup(Common::NEResources &exe, cons
stream->readUint32LE(); // data size
uint32 cursorId = stream->readUint16LE();
- Common::ScopedPtr<Common::SeekableReadStream> cursorStream(exe.getResource(Common::kWinCursor, cursorId));
+ Common::ScopedPtr<Common::SeekableReadStream> cursorStream(exe->getResource(Common::kWinCursor, cursorId));
if (!cursorStream) {
delete group;
return 0;
@@ -298,8 +298,8 @@ WinCursorGroup *WinCursorGroup::createCursorGroup(Common::NEResources &exe, cons
return group;
}
-WinCursorGroup *WinCursorGroup::createCursorGroup(Common::PEResources &exe, const Common::WinResourceID &id) {
- Common::ScopedPtr<Common::SeekableReadStream> stream(exe.getResource(Common::kWinGroupCursor, id));
+WinCursorGroup *WinCursorGroup::createCursorGroup(Common::PEResources *exe, const Common::WinResourceID &id) {
+ Common::ScopedPtr<Common::SeekableReadStream> stream(exe->getResource(Common::kWinGroupCursor, id));
if (!stream || stream->size() <= 6)
return 0;
@@ -325,7 +325,7 @@ WinCursorGroup *WinCursorGroup::createCursorGroup(Common::PEResources &exe, cons
stream->readUint32LE(); // data size
uint32 cursorId = stream->readUint16LE();
- Common::ScopedPtr<Common::SeekableReadStream> cursorStream(exe.getResource(Common::kWinCursor, cursorId));
+ Common::ScopedPtr<Common::SeekableReadStream> cursorStream(exe->getResource(Common::kWinCursor, cursorId));
if (!cursorStream) {
delete group;
return 0;
diff --git a/graphics/wincursor.h b/graphics/wincursor.h
index 2780b23a90..d77314458b 100644
--- a/graphics/wincursor.h
+++ b/graphics/wincursor.h
@@ -57,9 +57,9 @@ 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);
+ 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);
+ static WinCursorGroup *createCursorGroup(Common::PEResources *exe, const Common::WinResourceID &id);
};
/**