diff options
author | Martin Kiewitz | 2017-02-23 23:54:45 +0100 |
---|---|---|
committer | Martin Kiewitz | 2017-02-23 23:54:45 +0100 |
commit | 9dd0cd51d5b243700ccbd154e1d91ddb84c307c2 (patch) | |
tree | 5fa0a22dc13b07840d5495d0fec99f3d1a38c0ee /engines/agi/agi.h | |
parent | 5fa728371f9d01f9fb268596d961ad841825a456 (diff) | |
download | scummvm-rg350-9dd0cd51d5b243700ccbd154e1d91ddb84c307c2.tar.gz scummvm-rg350-9dd0cd51d5b243700ccbd154e1d91ddb84c307c2.tar.bz2 scummvm-rg350-9dd0cd51d5b243700ccbd154e1d91ddb84c307c2.zip |
AGI: Clean up VM opcode handling
so that invalid opcodes won't crash ScummVM anymore
Diffstat (limited to 'engines/agi/agi.h')
-rw-r--r-- | engines/agi/agi.h | 26 |
1 files changed, 20 insertions, 6 deletions
diff --git a/engines/agi/agi.h b/engines/agi/agi.h index 2b62f9757a..46d0a341df 100644 --- a/engines/agi/agi.h +++ b/engines/agi/agi.h @@ -466,8 +466,6 @@ struct AgiGame { ScreenObjEntry addToPicView; - int32 ver; /**< detected game version */ - bool automaticSave; /**< set by CmdSetSimple() */ char automaticSaveDescription[SAVEDGAME_DESCRIPTION_LEN + 1]; @@ -718,7 +716,20 @@ struct AgiArtificialDelayEntry { uint16 millisecondsDelay; }; -typedef void (*AgiCommand)(AgiGame *state, AgiEngine *vm, uint8 *p); +typedef void (*AgiOpCodeFunction)(AgiGame *state, AgiEngine *vm, uint8 *p); + +struct AgiOpCodeEntry { + const char *name; + const char *parameters; + AgiOpCodeFunction functionPtr; + uint16 parameterSize; +}; + +struct AgiOpCodeDefinitionEntry { + const char *name; + const char *parameters; + AgiOpCodeFunction functionPtr; +}; class AgiEngine : public AgiBase { protected: @@ -985,10 +996,13 @@ private: uint32 _passedPlayTimeCycles; // increased by 1 every time we passed a cycle private: - AgiCommand _agiCommands[183]; - AgiCommand _agiCondCommands[256]; + AgiOpCodeEntry _opCodes[256]; // always keep those at 256, so that there is no way for invalid memory access + AgiOpCodeEntry _opCodesCond[256]; + + void setupOpCodes(uint16 version); - void setupOpcodes(); +public: + const AgiOpCodeEntry *getOpCodesTable() { return _opCodes; } }; } // End of namespace Agi |