xoreos  0.0.5
asbuffer.h
Go to the documentation of this file.
1 /* xoreos - A reimplementation of BioWare's Aurora engine
2  *
3  * xoreos is the legal property of its developers, whose names
4  * can be found in the AUTHORS file distributed with this source
5  * distribution.
6  *
7  * xoreos is free software; you can redistribute it and/or
8  * modify it under the terms of the GNU General Public License
9  * as published by the Free Software Foundation; either version 3
10  * of the License, or (at your option) any later version.
11  *
12  * xoreos 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 xoreos. If not, see <http://www.gnu.org/licenses/>.
19  */
20 
25 #ifndef AURORA_ACTIONSCRIPT_ASBUFFER_H
26 #define AURORA_ACTIONSCRIPT_ASBUFFER_H
27 
28 #include <stack>
29 
30 #include <boost/any.hpp>
31 #include <boost/function.hpp>
32 
33 #include "src/common/readstream.h"
34 #include "src/common/scopedptr.h"
35 
38 
39 namespace Aurora {
40 
41 namespace ActionScript {
42 
43 class Variable;
44 
45 class ASBuffer {
46 public:
48 
49  void run(AVM &avm);
50 
51  void setConstantPool(std::vector<Common::UString> constantPool);
52 
53 private:
54  void execute(AVM &avm);
55 
56  void actionStop(AVM &avm);
57  void actionToggleQuality();
58  void actionSubtract();
59  void actionMultiply();
60  void actionDivide();
61  void actionAnd();
62  void actionOr();
63  void actionNot();
64  void actionPop();
65  void actionGetVariable(AVM &avm);
66  void actionSetVariable(AVM &avm);
67  void actionTrace();
68  void actionDefineLocal(AVM &avm);
69  void actionCallFunction();
70  void actionReturn(AVM &avm);
71  void actionNewObject(AVM &avm);
72  void actionInitArray();
73  void actionAdd2();
74  void actionLess2();
75  void actionEquals2();
76  void actionToNumber2();
77  void actionPushDuplicate();
78  void actionGetMember();
79  void actionSetMember();
80  void actionIncrement();
81  void actionCallMethod(AVM &avm);
82  void actionEnumerate2();
83  void actionExtends();
84  void actionGetURL(AVM &avm);
85  void actionStoreRegister(AVM &avm);
86  void actionConstantPool();
87  void actionDefineFunction2();
88  void actionPush(AVM &avm);
89  void actionJump();
90  void actionGetURL2(AVM &avm);
91  void actionDefineFunction();
92  void actionIf();
93 
94  // Utility methods and variables
96 
98  ptrdiff_t _seeked;
99 
100  // Constant pool
101  std::vector<Common::UString> _constants;
102 
103  // Execution stack
104  std::stack<Variable> _stack;
105 
106  // The script data
108 };
109 
110 } // End of namespace ActionScript
111 
112 } // End of namespace Aurora
113 
114 #endif // AURORA_ACTIONSCRIPT_ASBUFFER_H
ASBuffer(Common::SeekableReadStream *as)
Definition: asbuffer.cpp:86
std::stack< Variable > _stack
Definition: asbuffer.h:104
Common::SeekableReadStream * _script
Definition: asbuffer.h:107
A class holding an UTF-8 string.
Definition: ustring.h:48
void actionNewObject(AVM &avm)
Definition: asbuffer.cpp:340
void actionDefineLocal(AVM &avm)
Definition: asbuffer.cpp:281
Context for executing ActionScript.
A simple scoped smart pointer template.
void setConstantPool(std::vector< Common::UString > constantPool)
Definition: asbuffer.cpp:97
Basic reading stream interfaces.
void actionGetVariable(AVM &avm)
Definition: asbuffer.cpp:248
Abstract object which is inherited by every other class.
void actionStoreRegister(AVM &avm)
Definition: asbuffer.cpp:548
void actionCallMethod(AVM &avm)
Definition: asbuffer.cpp:436
std::vector< Common::UString > _constants
Definition: asbuffer.h:101
void actionSetVariable(AVM &avm)
Definition: asbuffer.cpp:264
Interface for a seekable & readable data stream.
Definition: readstream.h:265
Common::UString readString()
Definition: asbuffer.cpp:797
The Action script virtual machine (AVM).
Definition: avm.h:46