mirror of
https://github.com/rwengine/openrw.git
synced 2024-11-25 20:02:40 +01:00
Update VM var size, expose threads
This commit is contained in:
parent
a7da8ea424
commit
d4f0d7dc0d
@ -12,10 +12,10 @@
|
||||
#define SCM_CONDITIONAL_MASK_PASSED 0xFF
|
||||
#define SCM_THREAD_LOCAL_SIZE 256
|
||||
|
||||
/* as shipped, SCM variables are 4 bytes wide, this isn't enough for 64-bit
|
||||
* pointers, so we re-allocate the global and local space taking into account
|
||||
* the native pointer size */
|
||||
#define SCM_VARIABLE_SIZE sizeof(void*)
|
||||
/* Maxium size value that can be stored in each memory address.
|
||||
* Changing this will break saves.
|
||||
*/
|
||||
#define SCM_VARIABLE_SIZE sizeof(uint32_t)
|
||||
|
||||
class GameState;
|
||||
|
||||
@ -173,6 +173,8 @@ public:
|
||||
|
||||
void startThread(SCMThread::pc_t start, bool mission = false);
|
||||
|
||||
std::vector<SCMThread>& getThreads() { return _activeThreads; }
|
||||
|
||||
SCMByte* getGlobals();
|
||||
|
||||
GameState* getState() const { return state; }
|
||||
|
@ -86,13 +86,13 @@ void ScriptMachine::executeThread(SCMThread &t, int msPassed)
|
||||
break;
|
||||
case TGlobal: {
|
||||
auto v = _file->read<std::uint16_t>(t.programCounter);
|
||||
parameters.back().globalPtr = _globals + v * sizeof(SCMByte) * 4;
|
||||
parameters.back().globalPtr = _globals + v * sizeof(SCMByte) * SCM_VARIABLE_SIZE;
|
||||
t.programCounter += sizeof(SCMByte) * 2;
|
||||
}
|
||||
break;
|
||||
case TLocal: {
|
||||
auto v = _file->read<std::uint16_t>(t.programCounter);
|
||||
parameters.back().globalPtr = t.locals + v * sizeof(SCMByte) * 4;
|
||||
parameters.back().globalPtr = t.locals + v * sizeof(SCMByte) * SCM_VARIABLE_SIZE;
|
||||
t.programCounter += sizeof(SCMByte) * 2;
|
||||
}
|
||||
break;
|
||||
|
Loading…
Reference in New Issue
Block a user