diff options
author | Martin Kiewitz | 2010-06-19 09:46:04 +0000 |
---|---|---|
committer | Martin Kiewitz | 2010-06-19 09:46:04 +0000 |
commit | a7fa0649dfc71c79f496a86986413f35c8d36966 (patch) | |
tree | 550679e4c14e607949bdd47062ebbd57152e2cfb | |
parent | 4fb3059edcfdcfc6ab64cd0c4437e1cbb289d00e (diff) | |
download | scummvm-rg350-a7fa0649dfc71c79f496a86986413f35c8d36966.tar.gz scummvm-rg350-a7fa0649dfc71c79f496a86986413f35c8d36966.tar.bz2 scummvm-rg350-a7fa0649dfc71c79f496a86986413f35c8d36966.zip |
SCI: implemented checking of keyboard driver in case of SCI1EGA/EARLY, also renamed SCI_EVENT_JOYSTICK to SCI_EVENT_DIRECTION
svn-id: r50045
-rw-r--r-- | engines/sci/engine/kevent.cpp | 8 | ||||
-rw-r--r-- | engines/sci/event.cpp | 34 | ||||
-rw-r--r-- | engines/sci/event.h | 5 |
3 files changed, 41 insertions, 6 deletions
diff --git a/engines/sci/engine/kevent.cpp b/engines/sci/engine/kevent.cpp index f516a9d4b1..e38550adee 100644 --- a/engines/sci/engine/kevent.cpp +++ b/engines/sci/engine/kevent.cpp @@ -203,12 +203,10 @@ reg_t kMapKeyToDir(EngineState *s, int argc, reg_t *argv) { } if (mover >= 0) { - // FIXME: changing point was actually inbetween SCI1EARLY, we need to find out when it happened - // and then find some method of finding out those specific games - if (getSciVersion() >= SCI_VERSION_1_MIDDLE) - writeSelectorValue(segMan, obj, SELECTOR(type), SCI_EVENT_KEYBOARD | SCI_EVENT_JOYSTICK); + if (g_sci->getEventManager()->getUsesNewKeyboardDirectionType()) + writeSelectorValue(segMan, obj, SELECTOR(type), SCI_EVENT_KEYBOARD | SCI_EVENT_DIRECTION); else - writeSelectorValue(segMan, obj, SELECTOR(type), SCI_EVENT_JOYSTICK); + writeSelectorValue(segMan, obj, SELECTOR(type), SCI_EVENT_DIRECTION); writeSelectorValue(segMan, obj, SELECTOR(message), mover); return make_reg(0, 1); } else diff --git a/engines/sci/event.cpp b/engines/sci/event.cpp index eff7984d39..6c9e95a804 100644 --- a/engines/sci/event.cpp +++ b/engines/sci/event.cpp @@ -25,6 +25,7 @@ #include "common/system.h" #include "common/events.h" +#include "common/file.h" #include "sci/sci.h" #include "sci/event.h" @@ -35,11 +36,44 @@ namespace Sci { EventManager::EventManager(bool fontIsExtended) : _fontIsExtended(fontIsExtended), _modifierStates(0) { + + if (getSciVersion() >= SCI_VERSION_1_MIDDLE) { + _usesNewKeyboardDirectionType = true; + } else if (getSciVersion() <= SCI_VERSION_01) { + _usesNewKeyboardDirectionType = false; + } else { + // they changed this somewhere inbetween SCI1EGA/EARLY, so we need to check the size of the keyboard driver + _usesNewKeyboardDirectionType = false; + + Common::File keyboardDriver; + if (keyboardDriver.open("IBMKBD.DRV")) { + switch (keyboardDriver.size()) { + case 442: // SCI0 (PQ2) + case 446: // SCI0 (SQ3) + case 449: // SCI1EGA (QfG2) + break; + case 537: // SCI1 (SQ4) + case 564: // SCI1.1 (LB2) + case 758: // SCI1.1 (LB2cd) + case 760: // SCI1.1 (Pepper) + _usesNewKeyboardDirectionType = true; + break; + default: + error("Unsupported IBMKBD.DRV size (%d)", keyboardDriver.size()); + } + } else { + // We just default to OFF here in case the keyboard driver could not be found + warning("IBMKBD.DRV not found to distinguish usage of direction type"); + } + } } EventManager::~EventManager() { } +bool EventManager::getUsesNewKeyboardDirectionType() { + return _usesNewKeyboardDirectionType; +} struct ScancodeRow { int offset; diff --git a/engines/sci/event.h b/engines/sci/event.h index 314add7b2c..30098b0f6e 100644 --- a/engines/sci/event.h +++ b/engines/sci/event.h @@ -53,7 +53,7 @@ struct SciEvent { #define SCI_EVENT_MOUSE_PRESS (1<<0) #define SCI_EVENT_MOUSE_RELEASE (1<<1) #define SCI_EVENT_KEYBOARD (1<<2) -#define SCI_EVENT_JOYSTICK (1<<6) +#define SCI_EVENT_DIRECTION (1<<6) #define SCI_EVENT_SAID (1<<7) /*Fake values for other events*/ #define SCI_EVENT_ERROR (1<<10) @@ -115,6 +115,7 @@ public: ~EventManager(); SciEvent getSciEvent(unsigned int mask); + bool getUsesNewKeyboardDirectionType(); private: SciEvent getScummVMEvent(); @@ -122,6 +123,8 @@ private: const bool _fontIsExtended; int _modifierStates; Common::List<SciEvent> _events; + + bool _usesNewKeyboardDirectionType; }; } // End of namespace Sci |