//
// Project UnReality: The First Nintendo 64 Emulator
// Copyright (C) 1997-1998, Cold Fusion Entertainment
// All rights reserved
//
// This source code is unpublished propietary information of Cold Fusion Entertainment.  No portion of this software
// may be disclosed to any third party or copied or duplicated in any form, in whole or in part, without the prior
// written consent of Cold Fusion Entertainment.
// 

//
// $Log: JOY.H $
// Revision 1.2  1998/04/02 21:18:50  BREAKPOINT
// Implemented new memory mapping routines and changed ROM loading code.
// Revision 1.1  1998/03/08 19:09:26  unknown
// Initial revision
//

//---------------------------------------------------------------------------------------------------------------------

#ifndef JOY_H
#define JOY_H

#include <windows.h>
#include <types.h>

#pragma pack(1)
typedef struct
{
	uchar reserved0;
	uchar reserved1;
	uchar errno;
	uchar reserved3;
	uchar type_msb;
	uchar type_lsb;
	uchar status;
	uchar reserved7;
} ContStatusBlock;

typedef struct
{
	uchar reserved0;
	uchar reserved1;
	uchar errno;
	uchar reserved3;
	uchar button_msb;
	uchar button_lsb;
	schar stick_x;
	schar stick_y;
} ContDataBlock;
#pragma pack()

// These are Nintendo's defines for its button status.
#define CONT_C_RIGHT		0x01			// LSB
#define CONT_C_LEFT			0x02
#define CONT_C_DOWN			0x04
#define CONT_C_UP			0x08
#define CONT_R				0x10
#define CONT_L				0x20
#define CONT_DPAD_RIGHT		0x01			// MSB
#define CONT_DPAD_LEFT		0x02
#define CONT_DPAD_DOWN		0x04
#define CONT_DPAD_UP		0x08
#define CONT_START			0x10
#define CONT_Z				0x20
#define CONT_B				0x40
#define CONT_A				0x80

void ProcessJoypadBlock(LPVOID ptr);

#endif
