Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add data exchange through a global shared state block #303

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 30 additions & 0 deletions src/win32com/Controller.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1733,6 +1733,36 @@ STDMETHODIMP CController::put_TimeFence(double timeInS)
return S_OK;
}

/****************************************************************************
* IController.get_StateBlock: returns a shared memory block name which holds
* a global state block prepended by the memory block size as an unsigned int
****************************************************************************/
STDMETHODIMP CController::get_StateBlock(/*[out, retval]*/ BSTR* pVal)
{
if (!pVal)
return E_POINTER;
if (!Machine)
return E_FAIL;
if (core_getOutputState(CORE_STATE_REQMASK_ALL) == NULL)
return E_FAIL;
CComBSTR bsStateSharedMemName(TEXT("Local\\VPinMameStateBlock"));
*pVal = bsStateSharedMemName.Detach();
return S_OK;
}

/****************************************************************************
* IController.UpdateStateBlock: Update requested outputs of the global state
* block
****************************************************************************/
STDMETHODIMP CController::UpdateStateBlock(/*[in, defaultvalue(0x3F)]*/ unsigned int updateMask)
{
if (!Machine)
return E_FAIL;
if (core_getOutputState(updateMask) == NULL)
return E_FAIL;
return S_OK;
}

/****************************************************************************
* IController.Version (read-only): gets the program version of VPM
****************************************************************************/
Expand Down
3 changes: 3 additions & 0 deletions src/win32com/Controller.h
Original file line number Diff line number Diff line change
Expand Up @@ -205,6 +205,9 @@ DECLARE_PROTECT_FINAL_CONSTRUCT()
STDMETHOD(put_ModOutputType)(/*[in]*/ int output, /*[in]*/ int no, /*[in]*/ int newVal);

STDMETHOD(put_TimeFence)(/*[in]*/ double fenceIns);

STDMETHOD(get_StateBlock)(/*[out, retval]*/ BSTR* pVal);
STDMETHOD(UpdateStateBlock)(/*[in, defaultvalue(0x1F)]*/ unsigned int updateMask);
};

#endif // !defined(AFX_Controller_H__D2811491_40D6_4656_9AA7_8FF85FD63543__INCLUDED_)
2 changes: 2 additions & 0 deletions src/win32com/VPinMAME.idl
Original file line number Diff line number Diff line change
Expand Up @@ -259,6 +259,8 @@ import "ocidl.idl";
[propget, id(88), helpstring("property ModOutputType")] HRESULT ModOutputType([in] int output, [in] int no, [out, retval] int *pVal);
[propput, id(88), helpstring("property ModOutputType")] HRESULT ModOutputType([in] int output, [in] int no, [in] int newVal);
[propput, id(89), helpstring("property TimeFence")] HRESULT TimeFence([in] double timeInS);
[propget, id(90), helpstring("property StateBlock")] HRESULT StateBlock([out, retval] BSTR* pVal);
[id(91), helpstring("method UpdateStateBlock")] HRESULT UpdateStateBlock([in, defaultvalue(0x3F)] unsigned int updateMask);
};

// WSHDlg and related interfaces
Expand Down
Loading
Loading