ScummVM API documentation
memory.h
1/* ScummVM - Graphic Adventure Engine
2*
3* ScummVM is the legal property of its developers, whose names
4* are too numerous to list here. Please refer to the COPYRIGHT
5* file distributed with this source distribution.
6*
7* This program is free software: you can redistribute it and/or modify
8* it under the terms of the GNU General Public License as published by
9* the Free Software Foundation, either version 3 of the License, or
10* (at your option) any later version.
11*
12* This program is distributed in the hope that it will be useful,
13* but WITHOUT ANY WARRANTY; without even the implied warranty of
14* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15* GNU General Public License for more details.
16*
17* You should have received a copy of the GNU General Public License
18* along with this program. If not, see <http://www.gnu.org/licenses/>.
19*
20*/
21
22
23#ifndef SNATCHER_MEMORY_H
24#define SNATCHER_MEMORY_H
25
26#include "common/scummsys.h"
27
28namespace Snatcher {
29
30class ActionSequenceHandler;
31class SaveLoadManager;
32class SnatcherEngine;
33class UI;
34struct GameState;
35
36// The script engine has opcodes that allow reading and writing into memory, at least for 16-bit addresses.
37// We could just create a 64K buffer and let that happen, but eventually we would have to route the values
38// to the affected parts of the engine, anyway. For now, my impression is that the memory writes are mostly
39// used to configure the verb interface while the reads are mostly for evaluation of the action sequeunce
40// results and also for querying the savegame environment.
41
43public:
44 MemAccessHandler(SnatcherEngine *vm, UI *ui, ActionSequenceHandler *aseq, SaveLoadManager *saveMan) : _vm(vm), _ui(ui), _aseq(aseq), _saveMan(saveMan), _state(nullptr) {}
46
47 uint16 readWord(uint16 addr);
48 void writeWord(uint16 addr, uint16 val);
49
50 void setGameState(GameState *state);
51
52 void saveTempState();
53 void restoreTempState();
54
55private:
56 SnatcherEngine *_vm;
57 UI *_ui;
59 SaveLoadManager *_saveMan;
60 GameState *_state;
61};
62
63} // End of namespace Snatcher
64
65#endif // SNATCHER_MEMORY_H
Definition: action.h:36
Definition: memory.h:42
Definition: saveload.h:44
Definition: snatcher.h:50
Definition: ui.h:42
Definition: state.h:94