View Single Post
Old 10-02-2014, 07:26 AM   #108
Celphor
Human being with feelings
 
Join Date: Jan 2013
Location: Austria
Posts: 73
Default

Ok, I found out how to access the memory in EEL2 internally.

EEL_F NSEEL_CGEN_CALL scriptInstance::_testmethod(void *opaque, EEL_F *buf, EEL_F *len) {
scriptInstance *_this = (scriptInstance*)opaque;
if (_this)
{
unsigned int addr = *buf;
EEL_F **blocks = ((compileContext*)_this->m_vm)->ram_state.blocks;
unsigned int whichblock = addr / NSEEL_RAM_ITEMSPERBLOCK;
unsigned int offset = addr % NSEEL_RAM_ITEMSPERBLOCK;
EEL_F *block = blocks[whichblock];
EEL_F *x = 0;
if (block) {
x = block + offset;
}

_this->DebugOutput("test buf: %x", buf);
_this->DebugOutput("test x: %f", x);
_this->DebugOutput("test *x: %f", *x);
}
return 0.0;
}
Celphor is offline   Reply With Quote