mirror of
https://github.com/libretro/scummvm.git
synced 2025-01-19 00:15:30 +00:00
SCI: implemented checking of keyboard driver in case of SCI1EGA/EARLY, also renamed SCI_EVENT_JOYSTICK to SCI_EVENT_DIRECTION
svn-id: r50045
This commit is contained in:
parent
4fb3059edc
commit
a7fa0649df
@ -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
|
||||
|
@ -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;
|
||||
|
@ -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
|
||||
|
Loading…
x
Reference in New Issue
Block a user