Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // Avoid passing VMArrays as arguments, behavior may be undefined as Papyrus does not normally support multi-dimensional arrays
- template<typename T1>
- void SendPapyrusEvent1(UInt64 handle, BSFixedString eventName, T1 & t1)
- {
- void * object = GetObjectFromHandle(handle, VMObject::kTypeID);
- if(object) {
- // Build the receiving VMValue from the handle
- VMValue receiver;
- PackHandle(&receiver, object, VMObject::kTypeID, (*g_gameVM)->m_virtualMachine);
- // Build the VM arguments for the CallFunctionNoWait
- VMArray<VMVariable> arguments;
- VMVariable var1, var2;
- var1.Set<T1>(&t1);
- arguments.Push(&var1);
- // Pack the VMArray
- VMValue args;
- PackValue(&args, &arguments, (*g_gameVM)->m_virtualMachine);
- // This should eventually replaced by an actual call to the Event Queue (VM+0x158), this is a workaround for now
- if(receiver.IsIdentifier()) {
- VMIdentifier * identifier = receiver.data.id;
- if(identifier) {
- CallFunctionNoWait_Internal((*g_gameVM)->m_virtualMachine, 0, identifier, &eventName, &args);
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement