Skip to content

Commit

Permalink
Add data exchange through a global shared state block
Browse files Browse the repository at this point in the history
This commits allows to share prviously unshared data without overloading too much the API by adding a single data block for pulsed state, device state, modulated segments, multiple DMDs, raw DMD frames (for correct rendering and allow coloring) and video.

This commit contains the skeleton and base implementation to set up the ground for more testing on client side  (VPX) when support will be more advanced there. It also gives a ground to implement in LibPinMame.
  • Loading branch information
vbousquet committed Aug 30, 2024
1 parent f863cb6 commit 7ff176e
Show file tree
Hide file tree
Showing 5 changed files with 612 additions and 6 deletions.
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(0x1F)]*/ 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(0x1F)] unsigned int updateMask);
};

// WSHDlg and related interfaces
Expand Down
Loading

0 comments on commit 7ff176e

Please sign in to comment.