[Scummvm-git-logs] scummvm master -> 302d26bf42a56eb0d9c82b4eabface8736249f64
dreammaster
paulfgilbert at gmail.com
Sun Jan 6 23:09:11 CET 2019
This automated email contains information about 2 new commits which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .
Summary:
8515590b47 GLK: FROTZ: Fix #10869 Crash initializing undo data
302d26bf42 GLK: FROTZ: Force v6 games to 320x200
Commit: 8515590b47ca297880df59f81f305b00b7c5384a
https://github.com/scummvm/scummvm/commit/8515590b47ca297880df59f81f305b00b7c5384a
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2019-01-06T14:00:53-08:00
Commit Message:
GLK: FROTZ: Fix #10869 Crash initializing undo data
Changed paths:
engines/glk/frotz/mem.cpp
engines/glk/frotz/mem.h
diff --git a/engines/glk/frotz/mem.cpp b/engines/glk/frotz/mem.cpp
index 227b673..ea3ca18 100644
--- a/engines/glk/frotz/mem.cpp
+++ b/engines/glk/frotz/mem.cpp
@@ -36,8 +36,44 @@ Mem::Mem() : story_fp(nullptr), story_size(0), first_undo(nullptr), last_undo(nu
void Mem::initialize() {
initializeStoryFile();
loadGameHeader();
+ loadMemory();
initializeUndo();
+ // Read header extension table
+ hx_table_size = get_header_extension(HX_TABLE_SIZE);
+ hx_unicode_table = get_header_extension(HX_UNICODE_TABLE);
+ hx_flags = get_header_extension(HX_FLAGS);
+}
+
+void Mem::initializeStoryFile() {
+ if (story_fp->size() < 64)
+ error("This file is too small to be a Z-code file.");
+}
+
+void Mem::loadGameHeader() {
+ // Load header
+ zmp = (byte *)malloc(64);
+ story_fp->seek(0);
+ story_fp->read(zmp, 64);
+
+ Common::MemoryReadStream h(zmp, 64);
+ loadHeader(h);
+
+ // Calculate story file size in bytes
+ if (h_file_size != 0) {
+ story_size = (long)2 * h_file_size;
+
+ if (h_version >= V4)
+ story_size *= 2;
+ if (h_version >= V6)
+ story_size *= 2;
+ } else {
+ // Some old games lack the file size entry
+ story_size = story_fp->size();
+ }
+}
+
+void Mem::loadMemory() {
// Allocate memory for story data
if ((zmp = (zbyte *)realloc(zmp, story_size)) == nullptr)
error("Out of memory");
@@ -51,16 +87,6 @@ void Mem::initialize() {
if (story_fp->read(zmp + size, n) != n)
error("Story file read error");
}
-
- // Read header extension table
- hx_table_size = get_header_extension(HX_TABLE_SIZE);
- hx_unicode_table = get_header_extension(HX_UNICODE_TABLE);
- hx_flags = get_header_extension(HX_FLAGS);
-}
-
-void Mem::initializeStoryFile() {
- if (story_fp->size() < 64)
- error("This file is too small to be a Z-code file.");
}
void Mem::initializeUndo() {
@@ -82,31 +108,8 @@ void Mem::initializeUndo() {
_undo_slots = 0;
}
- if (reserve_mem != 0)
- delete reserved;
-}
-
-void Mem::loadGameHeader() {
- // Load header
- zmp = (byte *)malloc(64);
- story_fp->seek(0);
- story_fp->read(zmp, 64);
-
- Common::MemoryReadStream h(zmp, 64);
- loadHeader(h);
-
- // Calculate story file size in bytes
- if (h_file_size != 0) {
- story_size = (long)2 * h_file_size;
-
- if (h_version >= V4)
- story_size *= 2;
- if (h_version >= V6)
- story_size *= 2;
- } else {
- // Some old games lack the file size entry
- story_size = story_fp->size();
- }
+ if (reserve_mem)
+ delete[] reserved;
}
zword Mem::get_header_extension(int entry) {
diff --git a/engines/glk/frotz/mem.h b/engines/glk/frotz/mem.h
index a632bc6..c58ef65 100644
--- a/engines/glk/frotz/mem.h
+++ b/engines/glk/frotz/mem.h
@@ -72,14 +72,19 @@ private:
void initializeStoryFile();
/**
- * Setup undo data
+ * Handles loading the game header
*/
- void initializeUndo();
+ void loadGameHeader();
/**
- * Handles loading the game header
+ * Initializes memory and loads the story data
*/
- void loadGameHeader();
+ void loadMemory();
+
+ /**
+ * Setup undo data
+ */
+ void initializeUndo();
protected:
/**
* Read a value from the header extension (former mouse table).
Commit: 302d26bf42a56eb0d9c82b4eabface8736249f64
https://github.com/scummvm/scummvm/commit/302d26bf42a56eb0d9c82b4eabface8736249f64
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2019-01-06T14:07:14-08:00
Commit Message:
GLK: FROTZ: Force v6 games to 320x200
As much as I'd like to allow for variable resolution sizes,
the graphics in Zork Zero are geared specifically for a 320x200
screen. Maybe in the future I can allow for automatic stretching
to fit any screen size, but for now it's more important to get
the v6 games working at all
Changed paths:
engines/glk/frotz/frotz.cpp
engines/glk/frotz/frotz.h
engines/glk/frotz/glk_interface.cpp
engines/glk/frotz/screen.cpp
engines/glk/glk.h
diff --git a/engines/glk/frotz/frotz.cpp b/engines/glk/frotz/frotz.cpp
index 8ec3db7..0c33f41 100644
--- a/engines/glk/frotz/frotz.cpp
+++ b/engines/glk/frotz/frotz.cpp
@@ -24,6 +24,7 @@
#include "glk/frotz/frotz_types.h"
#include "glk/frotz/screen.h"
#include "glk/frotz/quetzal.h"
+#include "engines/util.h"
#include "common/config-manager.h"
namespace Glk {
@@ -40,6 +41,19 @@ Frotz::~Frotz() {
reset_memory();
}
+void Frotz::initGraphicsMode() {
+ _gameFile.seek(0);
+ byte version = _gameFile.readByte();
+
+ if (version == 6) {
+ // The V6 games have graphics that expect 320x200 mode
+ Graphics::PixelFormat pixelFormat(2, 5, 6, 5, 0, 11, 5, 0, 0);
+ initGraphics(320, 200, &pixelFormat);
+ } else {
+ GlkEngine::initGraphicsMode();
+ }
+}
+
Screen *Frotz::createScreen() {
return new FrotzScreen();
}
diff --git a/engines/glk/frotz/frotz.h b/engines/glk/frotz/frotz.h
index b5de82d..8312e16 100644
--- a/engines/glk/frotz/frotz.h
+++ b/engines/glk/frotz/frotz.h
@@ -37,6 +37,11 @@ class Frotz : public Processor {
friend class FrotzScreen;
protected:
/**
+ * Setup the video mode
+ */
+ virtual void initGraphicsMode();
+
+ /**
* Create the screen class
*/
virtual Screen *createScreen() override;
diff --git a/engines/glk/frotz/glk_interface.cpp b/engines/glk/frotz/glk_interface.cpp
index 959ab31..46a6caa 100644
--- a/engines/glk/frotz/glk_interface.cpp
+++ b/engines/glk/frotz/glk_interface.cpp
@@ -350,13 +350,11 @@ void GlkInterface::gos_update_height() {
void GlkInterface::reset_status_ht() {
uint height;
- if (_wp._upper) {
+ if (_wp._upper && h_version != 6) {
glk_window_get_size(_wp._upper, nullptr, &height);
if ((uint)mach_status_ht != height) {
- glk_window_set_arrangement(
- glk_window_get_parent(_wp._upper),
- winmethod_Above | winmethod_Fixed,
- mach_status_ht, nullptr);
+ glk_window_set_arrangement(glk_window_get_parent(_wp._upper),
+ winmethod_Above | winmethod_Fixed, mach_status_ht, nullptr);
}
}
}
diff --git a/engines/glk/frotz/screen.cpp b/engines/glk/frotz/screen.cpp
index 06b3616..f364a23 100644
--- a/engines/glk/frotz/screen.cpp
+++ b/engines/glk/frotz/screen.cpp
@@ -42,9 +42,9 @@ void FrotzScreen::loadFonts(Common::Archive *archive) {
byte version = g_vm->_gameFile.readByte();
if (version == 6) {
- // For graphical games, force both mono and proportinate fonts to be the same size.
- // This simplifies calculation of pixels when setting window position and sizes
- g_conf->_monoInfo._size = g_conf->_propInfo._size = MAX(g_conf->_monoInfo._size, g_conf->_propInfo._size);
+ // For graphical games, ignore any font configurations and force their size
+ g_conf->_monoInfo._size = g_conf->_propInfo._size = 7;
+ g_conf->_monoInfo._aspect = g_conf->_propInfo._aspect = 1.0;
}
// Load the basic fonts
diff --git a/engines/glk/glk.h b/engines/glk/glk.h
index 2782353..17ee356 100644
--- a/engines/glk/glk.h
+++ b/engines/glk/glk.h
@@ -72,11 +72,6 @@ private:
* Handles basic initialization
*/
void initialize();
-
- /**
- * Setup the video mode
- */
- void initGraphicsMode();
protected:
const GlkGameDescription _gameDescription;
Common::RandomSource _random;
@@ -92,6 +87,11 @@ protected:
virtual bool hasFeature(EngineFeature f) const;
/**
+ * Setup the video mode
+ */
+ virtual void initGraphicsMode();
+
+ /**
* Create the screen
*/
virtual Screen *createScreen();
More information about the Scummvm-git-logs
mailing list