2003-03-27 06:33:57 +00:00
|
|
|
// ******************************************************************
|
|
|
|
// *
|
|
|
|
// * .,-::::: .,:: .::::::::. .,:: .:
|
|
|
|
// * ,;;;'````' `;;;, .,;; ;;;'';;' `;;;, .,;;
|
|
|
|
// * [[[ '[[,,[[' [[[__[[\. '[[,,[['
|
|
|
|
// * $$$ Y$$$P $$""""Y$$ Y$$$P
|
|
|
|
// * `88bo,__,o, oP"``"Yo, _88o,,od8P oP"``"Yo,
|
|
|
|
// * "YUMMMMMP",m" "Mm,""YUMMMP" ,m" "Mm,
|
|
|
|
// *
|
|
|
|
// * Cxbx->Win32->CxbxKrnl->EmuShared.h
|
|
|
|
// *
|
|
|
|
// * This file is part of the Cxbx project.
|
|
|
|
// *
|
|
|
|
// * Cxbx and Cxbe are free software; you can redistribute them
|
|
|
|
// * and/or modify them under the terms of the GNU General Public
|
|
|
|
// * License as published by the Free Software Foundation; either
|
|
|
|
// * version 2 of the license, or (at your option) any later version.
|
|
|
|
// *
|
|
|
|
// * This program is distributed in the hope that it will be useful,
|
|
|
|
// * but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
// * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
// * GNU General Public License for more details.
|
|
|
|
// *
|
|
|
|
// * You should have recieved a copy of the GNU General Public License
|
|
|
|
// * along with this program; see the file COPYING.
|
|
|
|
// * If not, write to the Free Software Foundation, Inc.,
|
|
|
|
// * 59 Temple Place - Suite 330, Bostom, MA 02111-1307, USA.
|
|
|
|
// *
|
|
|
|
// * (c) 2002-2003 Aaron Robinson <caustik@caustik.com>
|
|
|
|
// *
|
|
|
|
// * All rights reserved
|
|
|
|
// *
|
|
|
|
// ******************************************************************
|
|
|
|
#ifndef EMUSHARED_H
|
|
|
|
#define EMUSHARED_H
|
|
|
|
|
2003-04-02 02:23:30 +00:00
|
|
|
#include "Cxbx.h"
|
2003-04-15 08:08:53 +00:00
|
|
|
#include "XBController.h"
|
2003-03-27 06:33:57 +00:00
|
|
|
|
2003-04-02 02:23:30 +00:00
|
|
|
#include <memory.h>
|
2003-03-27 06:33:57 +00:00
|
|
|
|
|
|
|
// ******************************************************************
|
2003-04-01 08:16:06 +00:00
|
|
|
// * EmuShared : Shared memory
|
2003-03-27 06:33:57 +00:00
|
|
|
// ******************************************************************
|
2003-04-04 04:35:00 +00:00
|
|
|
class EmuShared : public Mutex
|
2003-03-27 06:33:57 +00:00
|
|
|
{
|
2003-04-01 07:11:07 +00:00
|
|
|
public:
|
2003-04-15 08:08:53 +00:00
|
|
|
// ******************************************************************
|
|
|
|
// * Constructor / Deconstructor
|
|
|
|
// ******************************************************************
|
|
|
|
CXBXKRNL_API EmuShared();
|
|
|
|
CXBXKRNL_API ~EmuShared();
|
2003-04-04 04:35:00 +00:00
|
|
|
|
2003-04-04 03:31:43 +00:00
|
|
|
// ******************************************************************
|
|
|
|
// * Each process needs to call this to initialize shared memory
|
|
|
|
// ******************************************************************
|
|
|
|
CXBXKRNL_API static void Init();
|
2003-04-01 08:58:30 +00:00
|
|
|
|
2003-04-01 08:16:06 +00:00
|
|
|
// ******************************************************************
|
2003-04-04 03:31:43 +00:00
|
|
|
// * Each process needs to call this to cleanup shared memory
|
2003-04-01 08:16:06 +00:00
|
|
|
// ******************************************************************
|
2003-04-04 03:31:43 +00:00
|
|
|
CXBXKRNL_API static void Cleanup();
|
2003-04-01 08:16:06 +00:00
|
|
|
|
2003-04-04 03:31:43 +00:00
|
|
|
// ******************************************************************
|
2003-04-15 08:08:53 +00:00
|
|
|
// * Xbox Controller Accessor
|
2003-04-01 08:16:06 +00:00
|
|
|
// ******************************************************************
|
2003-04-15 08:08:53 +00:00
|
|
|
CXBXKRNL_API void GetXBController(XBController *ctrl) { Lock(); memcpy(ctrl, &m_XBController, sizeof(XBController)); Unlock();}
|
|
|
|
CXBXKRNL_API void SetXBController(XBController *ctrl) { Lock(); memcpy(&m_XBController, ctrl, sizeof(XBController)); Unlock();}
|
2003-04-01 07:11:07 +00:00
|
|
|
|
|
|
|
private:
|
2003-04-01 08:16:06 +00:00
|
|
|
// ******************************************************************
|
|
|
|
// * Shared configuration
|
|
|
|
// ******************************************************************
|
2003-04-15 08:08:53 +00:00
|
|
|
XBController m_XBController;
|
2003-04-04 04:35:00 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
// ******************************************************************
|
|
|
|
// * Exported Global Shared Memory Pointer
|
|
|
|
// ******************************************************************
|
|
|
|
extern CXBXKRNL_API EmuShared *g_EmuShared;
|
2003-04-15 08:08:53 +00:00
|
|
|
extern CXBXKRNL_API int g_EmuSharedRefCount;
|
2003-03-27 06:33:57 +00:00
|
|
|
|
|
|
|
#endif
|