2013-01-28 21:28:22 +00:00
|
|
|
/**
|
|
|
|
******************************************************************************
|
|
|
|
* Xenia : Xbox 360 Emulator Research Project *
|
|
|
|
******************************************************************************
|
|
|
|
* Copyright 2013 Ben Vanik. All rights reserved. *
|
|
|
|
* Released under the BSD license - see LICENSE in the root for more details. *
|
|
|
|
******************************************************************************
|
|
|
|
*/
|
|
|
|
|
2013-10-24 03:42:24 +00:00
|
|
|
#ifndef XENIA_XBOX_H_
|
|
|
|
#define XENIA_XBOX_H_
|
2013-01-28 21:28:22 +00:00
|
|
|
|
2015-02-11 17:42:12 +00:00
|
|
|
#include <string>
|
|
|
|
|
2015-05-02 10:42:51 +00:00
|
|
|
#include "xenia/base/memory.h"
|
2013-01-28 21:28:22 +00:00
|
|
|
|
|
|
|
namespace xe {
|
|
|
|
|
2014-08-16 05:59:28 +00:00
|
|
|
#pragma pack(push, 4)
|
|
|
|
|
|
|
|
|
2013-01-29 05:36:03 +00:00
|
|
|
typedef uint32_t X_HANDLE;
|
|
|
|
#define X_INVALID_HANDLE_VALUE ((X_HANDLE)-1)
|
|
|
|
|
|
|
|
|
2014-08-20 05:55:09 +00:00
|
|
|
// TODO(benvanik): type all of this so we get some safety.
|
|
|
|
|
2013-01-28 21:28:22 +00:00
|
|
|
// NT_STATUS (STATUS_*)
|
|
|
|
// http://msdn.microsoft.com/en-us/library/cc704588.aspx
|
|
|
|
// Adding as needed.
|
2013-01-31 06:44:32 +00:00
|
|
|
typedef uint32_t X_STATUS;
|
2013-10-24 06:48:18 +00:00
|
|
|
#define XSUCCEEDED(s) ((s & 0xC0000000) == 0)
|
|
|
|
#define XFAILED(s) (!XSUCCEEDED(s))
|
2014-01-08 02:52:26 +00:00
|
|
|
#define X_STATUS_SUCCESS ((X_STATUS)0x00000000L)
|
|
|
|
#define X_STATUS_ABANDONED_WAIT_0 ((X_STATUS)0x00000080L)
|
|
|
|
#define X_STATUS_USER_APC ((X_STATUS)0x000000C0L)
|
|
|
|
#define X_STATUS_ALERTED ((X_STATUS)0x00000101L)
|
|
|
|
#define X_STATUS_TIMEOUT ((X_STATUS)0x00000102L)
|
|
|
|
#define X_STATUS_PENDING ((X_STATUS)0x00000103L)
|
2015-02-11 17:42:12 +00:00
|
|
|
#define X_STATUS_OBJECT_NAME_EXISTS ((X_STATUS)0x40000000L)
|
2014-01-08 06:47:35 +00:00
|
|
|
#define X_STATUS_TIMER_RESUME_IGNORED ((X_STATUS)0x40000025L)
|
2014-01-19 14:56:56 +00:00
|
|
|
#define X_STATUS_BUFFER_OVERFLOW ((X_STATUS)0x80000005L)
|
|
|
|
#define X_STATUS_NO_MORE_FILES ((X_STATUS)0x80000006L)
|
2014-01-08 02:52:26 +00:00
|
|
|
#define X_STATUS_UNSUCCESSFUL ((X_STATUS)0xC0000001L)
|
|
|
|
#define X_STATUS_NOT_IMPLEMENTED ((X_STATUS)0xC0000002L)
|
|
|
|
#define X_STATUS_INFO_LENGTH_MISMATCH ((X_STATUS)0xC0000004L)
|
|
|
|
#define X_STATUS_ACCESS_VIOLATION ((X_STATUS)0xC0000005L)
|
|
|
|
#define X_STATUS_INVALID_HANDLE ((X_STATUS)0xC0000008L)
|
|
|
|
#define X_STATUS_INVALID_PARAMETER ((X_STATUS)0xC000000DL)
|
|
|
|
#define X_STATUS_NO_SUCH_FILE ((X_STATUS)0xC000000FL)
|
2014-06-11 03:40:11 +00:00
|
|
|
#define X_STATUS_END_OF_FILE ((X_STATUS)0xC0000011L)
|
2014-01-08 02:52:26 +00:00
|
|
|
#define X_STATUS_NO_MEMORY ((X_STATUS)0xC0000017L)
|
|
|
|
#define X_STATUS_ALREADY_COMMITTED ((X_STATUS)0xC0000021L)
|
|
|
|
#define X_STATUS_ACCESS_DENIED ((X_STATUS)0xC0000022L)
|
|
|
|
#define X_STATUS_BUFFER_TOO_SMALL ((X_STATUS)0xC0000023L)
|
|
|
|
#define X_STATUS_OBJECT_TYPE_MISMATCH ((X_STATUS)0xC0000024L)
|
2015-02-11 17:42:12 +00:00
|
|
|
#define X_STATUS_OBJECT_NAME_NOT_FOUND ((X_STATUS)0xC0000034L)
|
|
|
|
#define X_STATUS_OBJECT_NAME_COLLISION ((X_STATUS)0xC0000035L)
|
2014-01-08 02:52:26 +00:00
|
|
|
#define X_STATUS_INVALID_PAGE_PROTECTION ((X_STATUS)0xC0000045L)
|
|
|
|
#define X_STATUS_MUTANT_NOT_OWNED ((X_STATUS)0xC0000046L)
|
|
|
|
#define X_STATUS_MEMORY_NOT_ALLOCATED ((X_STATUS)0xC00000A0L)
|
|
|
|
#define X_STATUS_INVALID_PARAMETER_1 ((X_STATUS)0xC00000EFL)
|
|
|
|
#define X_STATUS_INVALID_PARAMETER_2 ((X_STATUS)0xC00000F0L)
|
|
|
|
#define X_STATUS_INVALID_PARAMETER_3 ((X_STATUS)0xC00000F1L)
|
2013-01-28 21:28:22 +00:00
|
|
|
|
2013-10-24 04:10:41 +00:00
|
|
|
// HRESULT (ERROR_*)
|
|
|
|
// Adding as needed.
|
2015-02-11 07:32:25 +00:00
|
|
|
// For some reason, half of these aren't *actually* HRESULTs.
|
|
|
|
// Windows is a weird place.
|
2013-11-01 23:23:14 +00:00
|
|
|
typedef uint32_t X_RESULT;
|
2014-01-05 08:48:00 +00:00
|
|
|
#define X_FACILITY_WIN32 7
|
2015-02-11 15:36:15 +00:00
|
|
|
#define X_RESULT_FROM_WIN32(x) x //((X_RESULT)(x) <= 0 ? ((X_RESULT)(x)) : ((X_RESULT) (((x) & 0x0000FFFF) | (X_FACILITY_WIN32 << 16) | 0x80000000)))
|
|
|
|
#define X_ERROR_SUCCESS X_RESULT_FROM_WIN32(0x00000000L)
|
2015-02-12 22:16:43 +00:00
|
|
|
#define X_ERROR_FILE_NOT_FOUND X_RESULT_FROM_WIN32(0x00000002L)
|
2015-02-11 15:36:15 +00:00
|
|
|
#define X_ERROR_ACCESS_DENIED X_RESULT_FROM_WIN32(0x00000005L)
|
|
|
|
#define X_ERROR_INVALID_HANDLE X_RESULT_FROM_WIN32(0x00000006L)
|
|
|
|
#define X_ERROR_NO_MORE_FILES X_RESULT_FROM_WIN32(0x00000018L)
|
|
|
|
#define X_ERROR_INVALID_PARAMETER X_RESULT_FROM_WIN32(0x00000057L)
|
|
|
|
#define X_ERROR_IO_PENDING X_RESULT_FROM_WIN32(0x000003E5L)
|
|
|
|
#define X_ERROR_INSUFFICIENT_BUFFER X_RESULT_FROM_WIN32(0x0000007AL)
|
2015-02-12 22:16:43 +00:00
|
|
|
#define X_ERROR_INVALID_NAME X_RESULT_FROM_WIN32(0x0000007BL)
|
2015-02-11 15:36:15 +00:00
|
|
|
#define X_ERROR_BAD_ARGUMENTS X_RESULT_FROM_WIN32(0x000000A0L)
|
|
|
|
#define X_ERROR_BUSY X_RESULT_FROM_WIN32(0x000000AAL)
|
2015-02-12 22:16:43 +00:00
|
|
|
#define X_ERROR_ALREADY_EXISTS X_RESULT_FROM_WIN32(0x000000B7L)
|
2015-02-11 15:36:15 +00:00
|
|
|
#define X_ERROR_DEVICE_NOT_CONNECTED X_RESULT_FROM_WIN32(0x0000048FL)
|
|
|
|
#define X_ERROR_NOT_FOUND X_RESULT_FROM_WIN32(0x00000490L)
|
|
|
|
#define X_ERROR_CANCELLED X_RESULT_FROM_WIN32(0x000004C7L)
|
|
|
|
#define X_ERROR_NOT_LOGGED_ON X_RESULT_FROM_WIN32(0x000004DDL)
|
|
|
|
#define X_ERROR_NO_SUCH_USER X_RESULT_FROM_WIN32(0x00000525L)
|
|
|
|
#define X_ERROR_FUNCTION_FAILED X_RESULT_FROM_WIN32(0x0000065BL)
|
|
|
|
#define X_ERROR_EMPTY X_RESULT_FROM_WIN32(0x000010D2L)
|
|
|
|
|
|
|
|
typedef uint32_t X_HRESULT;
|
2015-02-17 01:18:07 +00:00
|
|
|
#define X_E_SUCCESS static_cast<X_HRESULT>(0)
|
|
|
|
#define X_E_FALSE static_cast<X_HRESULT>(0x80000000L)
|
2015-02-11 15:36:15 +00:00
|
|
|
#define X_E_INVALIDARG static_cast<X_HRESULT>(0x80070057L)
|
2013-10-24 04:10:41 +00:00
|
|
|
|
2013-01-28 21:28:22 +00:00
|
|
|
// MEM_*, used by NtAllocateVirtualMemory
|
2013-01-29 05:36:03 +00:00
|
|
|
#define X_MEM_COMMIT 0x00001000
|
|
|
|
#define X_MEM_RESERVE 0x00002000
|
|
|
|
#define X_MEM_DECOMMIT 0x00004000
|
|
|
|
#define X_MEM_RELEASE 0x00008000
|
|
|
|
#define X_MEM_FREE 0x00010000
|
|
|
|
#define X_MEM_PRIVATE 0x00020000
|
|
|
|
#define X_MEM_RESET 0x00080000
|
|
|
|
#define X_MEM_TOP_DOWN 0x00100000
|
|
|
|
#define X_MEM_NOZERO 0x00800000
|
|
|
|
#define X_MEM_LARGE_PAGES 0x20000000
|
|
|
|
#define X_MEM_HEAP 0x40000000
|
|
|
|
#define X_MEM_16MB_PAGES 0x80000000 // from Valve SDK
|
2013-01-28 21:28:22 +00:00
|
|
|
|
2013-10-16 04:30:57 +00:00
|
|
|
// FILE_*, used by NtOpenFile
|
|
|
|
#define X_FILE_SUPERSEDED 0x00000000
|
|
|
|
#define X_FILE_OPENED 0x00000001
|
|
|
|
#define X_FILE_CREATED 0x00000002
|
|
|
|
#define X_FILE_OVERWRITTEN 0x00000003
|
|
|
|
#define X_FILE_EXISTS 0x00000004
|
|
|
|
#define X_FILE_DOES_NOT_EXIST 0x00000005
|
|
|
|
|
2013-01-28 21:28:22 +00:00
|
|
|
|
|
|
|
// PAGE_*, used by NtAllocateVirtualMemory
|
2013-01-29 05:36:03 +00:00
|
|
|
#define X_PAGE_NOACCESS 0x00000001
|
|
|
|
#define X_PAGE_READONLY 0x00000002
|
|
|
|
#define X_PAGE_READWRITE 0x00000004
|
|
|
|
#define X_PAGE_WRITECOPY 0x00000008
|
|
|
|
#define X_PAGE_EXECUTE 0x00000010
|
|
|
|
#define X_PAGE_EXECUTE_READ 0x00000020
|
|
|
|
#define X_PAGE_EXECUTE_READWRITE 0x00000040
|
|
|
|
#define X_PAGE_EXECUTE_WRITECOPY 0x00000080
|
|
|
|
#define X_PAGE_GUARD 0x00000100
|
|
|
|
#define X_PAGE_NOCACHE 0x00000200
|
|
|
|
#define X_PAGE_WRITECOMBINE 0x00000400
|
2013-01-28 21:28:22 +00:00
|
|
|
|
|
|
|
|
|
|
|
// (?), used by KeGetCurrentProcessType
|
|
|
|
#define X_PROCTYPE_IDLE 0
|
|
|
|
#define X_PROCTYPE_USER 1
|
|
|
|
#define X_PROCTYPE_SYSTEM 2
|
|
|
|
|
|
|
|
|
2014-07-03 04:57:21 +00:00
|
|
|
// Sockets/networking.
|
|
|
|
#define X_INVALID_SOCKET (uint32_t)(~0)
|
|
|
|
#define X_SOCKET_ERROR (uint32_t)(-1)
|
|
|
|
|
|
|
|
|
2013-01-31 06:44:32 +00:00
|
|
|
// Thread enums.
|
|
|
|
#define X_CREATE_SUSPENDED 0x00000004
|
|
|
|
|
|
|
|
|
2013-01-30 22:26:28 +00:00
|
|
|
// TLS specials.
|
|
|
|
#define X_TLS_OUT_OF_INDEXES UINT32_MAX // (-1)
|
|
|
|
|
|
|
|
|
2013-01-31 08:19:48 +00:00
|
|
|
// Languages.
|
|
|
|
#define X_LANGUAGE_ENGLISH 1
|
|
|
|
#define X_LANGUAGE_JAPANESE 2
|
|
|
|
|
|
|
|
|
2014-08-20 05:55:09 +00:00
|
|
|
enum X_FILE_ATTRIBUTES {
|
2013-10-17 05:19:50 +00:00
|
|
|
X_FILE_ATTRIBUTE_NONE = 0x0000,
|
|
|
|
X_FILE_ATTRIBUTE_READONLY = 0x0001,
|
|
|
|
X_FILE_ATTRIBUTE_HIDDEN = 0x0002,
|
|
|
|
X_FILE_ATTRIBUTE_SYSTEM = 0x0004,
|
|
|
|
X_FILE_ATTRIBUTE_DIRECTORY = 0x0010,
|
|
|
|
X_FILE_ATTRIBUTE_ARCHIVE = 0x0020,
|
|
|
|
X_FILE_ATTRIBUTE_DEVICE = 0x0040,
|
|
|
|
X_FILE_ATTRIBUTE_NORMAL = 0x0080,
|
|
|
|
X_FILE_ATTRIBUTE_TEMPORARY = 0x0100,
|
|
|
|
X_FILE_ATTRIBUTE_COMPRESSED = 0x0800,
|
|
|
|
X_FILE_ATTRIBUTE_ENCRYPTED = 0x4000,
|
2014-08-20 05:55:09 +00:00
|
|
|
};
|
2013-10-17 05:19:50 +00:00
|
|
|
|
|
|
|
|
2014-01-20 14:01:36 +00:00
|
|
|
// http://code.google.com/p/vdash/source/browse/trunk/vdash/include/kernel.h
|
2014-08-20 05:55:09 +00:00
|
|
|
enum X_FILE_INFORMATION_CLASS {
|
2013-10-24 03:42:24 +00:00
|
|
|
XFileDirectoryInformation = 1,
|
|
|
|
XFileFullDirectoryInformation,
|
|
|
|
XFileBothDirectoryInformation,
|
|
|
|
XFileBasicInformation,
|
|
|
|
XFileStandardInformation,
|
|
|
|
XFileInternalInformation,
|
|
|
|
XFileEaInformation,
|
|
|
|
XFileAccessInformation,
|
|
|
|
XFileNameInformation,
|
|
|
|
XFileRenameInformation,
|
|
|
|
XFileLinkInformation,
|
|
|
|
XFileNamesInformation,
|
|
|
|
XFileDispositionInformation,
|
|
|
|
XFilePositionInformation,
|
|
|
|
XFileFullEaInformation,
|
|
|
|
XFileModeInformation,
|
|
|
|
XFileAlignmentInformation,
|
|
|
|
XFileAllInformation,
|
|
|
|
XFileAllocationInformation,
|
|
|
|
XFileEndOfFileInformation,
|
|
|
|
XFileAlternateNameInformation,
|
|
|
|
XFileStreamInformation,
|
2014-01-20 14:01:36 +00:00
|
|
|
XFileMountPartitionInformation,
|
|
|
|
XFileMountPartitionsInformation,
|
2013-10-24 03:42:24 +00:00
|
|
|
XFilePipeRemoteInformation,
|
2014-01-20 14:01:36 +00:00
|
|
|
XFileSectorInformation,
|
|
|
|
XFileXctdCompressionInformation,
|
2013-10-24 03:42:24 +00:00
|
|
|
XFileCompressionInformation,
|
|
|
|
XFileObjectIdInformation,
|
|
|
|
XFileCompletionInformation,
|
|
|
|
XFileMoveClusterInformation,
|
2014-01-20 14:01:36 +00:00
|
|
|
XFileIoPriorityInformation,
|
2013-10-24 03:42:24 +00:00
|
|
|
XFileReparsePointInformation,
|
|
|
|
XFileNetworkOpenInformation,
|
|
|
|
XFileAttributeTagInformation,
|
|
|
|
XFileTrackingInformation,
|
|
|
|
XFileMaximumInformation
|
2014-08-16 05:59:28 +00:00
|
|
|
};
|
|
|
|
|
2014-08-03 04:37:11 +00:00
|
|
|
inline void XOverlappedSetResult(void* ptr, uint32_t value) {
|
|
|
|
auto p = reinterpret_cast<uint32_t*>(ptr);
|
2015-05-02 10:42:51 +00:00
|
|
|
xe::store_and_swap<uint32_t>(&p[0], value);
|
2014-08-03 04:37:11 +00:00
|
|
|
}
|
|
|
|
inline void XOverlappedSetLength(void* ptr, uint32_t value) {
|
|
|
|
auto p = reinterpret_cast<uint32_t*>(ptr);
|
2015-05-02 10:42:51 +00:00
|
|
|
xe::store_and_swap<uint32_t>(&p[1], value);
|
2014-08-04 04:26:10 +00:00
|
|
|
}
|
|
|
|
inline uint32_t XOverlappedGetContext(void* ptr) {
|
|
|
|
auto p = reinterpret_cast<uint32_t*>(ptr);
|
2015-05-02 10:42:51 +00:00
|
|
|
return xe::load_and_swap<uint32_t>(&p[2]);
|
2014-08-03 04:37:11 +00:00
|
|
|
}
|
|
|
|
inline void XOverlappedSetContext(void* ptr, uint32_t value) {
|
|
|
|
auto p = reinterpret_cast<uint32_t*>(ptr);
|
2015-05-02 10:42:51 +00:00
|
|
|
xe::store_and_swap<uint32_t>(&p[2], value);
|
2014-08-03 04:37:11 +00:00
|
|
|
}
|
2015-02-03 06:31:30 +00:00
|
|
|
inline X_HANDLE XOverlappedGetEvent(void* ptr) {
|
2014-08-03 04:37:11 +00:00
|
|
|
auto p = reinterpret_cast<uint32_t*>(ptr);
|
2015-05-02 10:42:51 +00:00
|
|
|
return xe::load_and_swap<uint32_t>(&p[3]);
|
2014-08-03 04:37:11 +00:00
|
|
|
}
|
2015-02-03 06:31:30 +00:00
|
|
|
inline uint32_t XOverlappedGetCompletionRoutine(void* ptr) {
|
2014-08-03 04:37:11 +00:00
|
|
|
auto p = reinterpret_cast<uint32_t*>(ptr);
|
2015-05-02 10:42:51 +00:00
|
|
|
return xe::load_and_swap<uint32_t>(&p[4]);
|
2014-08-03 04:37:11 +00:00
|
|
|
}
|
2015-02-03 06:31:30 +00:00
|
|
|
inline uint32_t XOverlappedGetCompletionContext(void* ptr) {
|
2014-08-03 04:37:11 +00:00
|
|
|
auto p = reinterpret_cast<uint32_t*>(ptr);
|
2015-05-02 10:42:51 +00:00
|
|
|
return xe::load_and_swap<uint32_t>(&p[5]);
|
2014-08-03 04:37:11 +00:00
|
|
|
}
|
2015-02-03 06:31:30 +00:00
|
|
|
inline void XOverlappedSetExtendedError(void* ptr, uint32_t value) {
|
2014-08-03 04:37:11 +00:00
|
|
|
auto p = reinterpret_cast<uint32_t*>(ptr);
|
2015-05-02 10:42:51 +00:00
|
|
|
xe::store_and_swap<uint32_t>(&p[6], value);
|
2014-08-03 04:37:11 +00:00
|
|
|
}
|
|
|
|
|
2013-10-17 04:32:53 +00:00
|
|
|
class X_ANSI_STRING {
|
2014-01-19 14:56:56 +00:00
|
|
|
private:
|
|
|
|
uint16_t length;
|
|
|
|
uint16_t maximum_length;
|
|
|
|
const char* buffer;
|
2013-10-17 04:32:53 +00:00
|
|
|
|
2014-01-19 14:56:56 +00:00
|
|
|
public:
|
2013-10-17 04:32:53 +00:00
|
|
|
X_ANSI_STRING() {
|
|
|
|
Zero();
|
|
|
|
}
|
|
|
|
X_ANSI_STRING(const uint8_t* base, uint32_t p) {
|
|
|
|
Read(base, p);
|
|
|
|
}
|
|
|
|
void Read(const uint8_t* base, uint32_t p) {
|
2015-05-02 10:42:51 +00:00
|
|
|
length = xe::load_and_swap<uint16_t>(base + p);
|
|
|
|
maximum_length = xe::load_and_swap<uint16_t>(base + p + 2);
|
2013-10-17 04:32:53 +00:00
|
|
|
if (maximum_length) {
|
2015-05-02 10:42:51 +00:00
|
|
|
buffer = (const char*)(base + xe::load_and_swap<uint32_t>(base + p + 4));
|
2013-10-17 04:32:53 +00:00
|
|
|
} else {
|
|
|
|
buffer = 0;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
void Zero() {
|
|
|
|
length = maximum_length = 0;
|
|
|
|
buffer = 0;
|
|
|
|
}
|
2014-01-19 14:56:56 +00:00
|
|
|
char* Duplicate() {
|
2015-02-11 17:42:12 +00:00
|
|
|
if (!buffer || !length) {
|
|
|
|
return nullptr;
|
2014-01-19 14:56:56 +00:00
|
|
|
}
|
2014-08-21 05:22:47 +00:00
|
|
|
auto copy = (char*)calloc(length + 1, sizeof(char));
|
2014-08-16 23:46:20 +00:00
|
|
|
std::strncpy(copy, buffer, length);
|
2014-01-19 14:56:56 +00:00
|
|
|
return copy;
|
|
|
|
}
|
2015-02-11 17:42:12 +00:00
|
|
|
std::string to_string() {
|
|
|
|
if (!buffer || !length) {
|
|
|
|
return "";
|
|
|
|
}
|
|
|
|
std::string result(buffer, length);
|
|
|
|
return result;
|
|
|
|
}
|
2013-10-17 04:32:53 +00:00
|
|
|
};
|
2014-08-20 05:50:21 +00:00
|
|
|
//static_assert_size(X_ANSI_STRING, 8);
|
2013-10-17 04:32:53 +00:00
|
|
|
|
|
|
|
|
2014-06-23 02:41:26 +00:00
|
|
|
// Values seem to be all over the place - GUIDs?
|
|
|
|
typedef uint32_t XNotificationID;
|
|
|
|
|
|
|
|
|
2014-08-16 05:59:28 +00:00
|
|
|
// http://ffplay360.googlecode.com/svn/trunk/Common/XTLOnPC.h
|
|
|
|
struct X_VIDEO_MODE {
|
2014-08-20 05:55:09 +00:00
|
|
|
be<uint32_t> display_width;
|
|
|
|
be<uint32_t> display_height;
|
|
|
|
be<uint32_t> is_interlaced;
|
|
|
|
be<uint32_t> is_widescreen;
|
|
|
|
be<uint32_t> is_hi_def;
|
|
|
|
be<float> refresh_rate;
|
|
|
|
be<uint32_t> video_standard;
|
|
|
|
be<uint32_t> unknown_0x8a;
|
|
|
|
be<uint32_t> unknown_0x01;
|
|
|
|
be<uint32_t> reserved[3];
|
2014-08-16 05:59:28 +00:00
|
|
|
};
|
|
|
|
static_assert_size(X_VIDEO_MODE, 48);
|
|
|
|
|
2014-08-20 05:55:09 +00:00
|
|
|
enum X_INPUT_FLAG {
|
2014-08-20 05:50:21 +00:00
|
|
|
X_INPUT_FLAG_GAMEPAD = 0x00000001,
|
2014-08-20 05:55:09 +00:00
|
|
|
};
|
2013-10-24 05:13:05 +00:00
|
|
|
|
2014-08-20 05:55:09 +00:00
|
|
|
enum X_INPUT_GAMEPAD_BUTTON {
|
2014-08-20 05:50:21 +00:00
|
|
|
X_INPUT_GAMEPAD_DPAD_UP = 0x0001,
|
|
|
|
X_INPUT_GAMEPAD_DPAD_DOWN = 0x0002,
|
|
|
|
X_INPUT_GAMEPAD_DPAD_LEFT = 0x0004,
|
|
|
|
X_INPUT_GAMEPAD_DPAD_RIGHT = 0x0008,
|
|
|
|
X_INPUT_GAMEPAD_START = 0x0010,
|
|
|
|
X_INPUT_GAMEPAD_BACK = 0x0020,
|
|
|
|
X_INPUT_GAMEPAD_LEFT_THUMB = 0x0040,
|
|
|
|
X_INPUT_GAMEPAD_RIGHT_THUMB = 0x0080,
|
|
|
|
X_INPUT_GAMEPAD_LEFT_SHOULDER = 0x0100,
|
|
|
|
X_INPUT_GAMEPAD_RIGHT_SHOULDER = 0x0200,
|
|
|
|
X_INPUT_GAMEPAD_A = 0x1000,
|
|
|
|
X_INPUT_GAMEPAD_B = 0x2000,
|
|
|
|
X_INPUT_GAMEPAD_X = 0x4000,
|
|
|
|
X_INPUT_GAMEPAD_Y = 0x8000,
|
2014-08-20 05:55:09 +00:00
|
|
|
};
|
2013-10-24 05:42:48 +00:00
|
|
|
|
2014-08-20 05:50:21 +00:00
|
|
|
struct X_INPUT_GAMEPAD {
|
|
|
|
be<uint16_t> buttons;
|
|
|
|
be<uint8_t> left_trigger;
|
|
|
|
be<uint8_t> right_trigger;
|
|
|
|
be<int16_t> thumb_lx;
|
|
|
|
be<int16_t> thumb_ly;
|
|
|
|
be<int16_t> thumb_rx;
|
|
|
|
be<int16_t> thumb_ry;
|
2013-10-24 05:13:05 +00:00
|
|
|
};
|
2014-08-20 05:50:21 +00:00
|
|
|
static_assert_size(X_INPUT_GAMEPAD, 12);
|
2013-10-24 05:13:05 +00:00
|
|
|
|
2014-08-20 05:50:21 +00:00
|
|
|
struct X_INPUT_STATE {
|
|
|
|
be<uint32_t> packet_number;
|
|
|
|
X_INPUT_GAMEPAD gamepad;
|
2013-10-24 05:13:05 +00:00
|
|
|
};
|
2014-08-20 05:50:21 +00:00
|
|
|
static_assert_size(X_INPUT_STATE, sizeof(X_INPUT_GAMEPAD) + 4);
|
2013-10-24 05:13:05 +00:00
|
|
|
|
2014-08-20 05:50:21 +00:00
|
|
|
struct X_INPUT_VIBRATION {
|
|
|
|
be<uint16_t> left_motor_speed;
|
|
|
|
be<uint16_t> right_motor_speed;
|
2013-10-24 05:13:05 +00:00
|
|
|
};
|
2014-08-20 05:50:21 +00:00
|
|
|
static_assert_size(X_INPUT_VIBRATION, 4);
|
2013-10-24 05:13:05 +00:00
|
|
|
|
2014-08-20 05:50:21 +00:00
|
|
|
struct X_INPUT_CAPABILITIES {
|
|
|
|
be<uint8_t> type;
|
|
|
|
be<uint8_t> sub_type;
|
|
|
|
be<uint16_t> flags;
|
|
|
|
X_INPUT_GAMEPAD gamepad;
|
|
|
|
X_INPUT_VIBRATION vibration;
|
2013-10-24 05:13:05 +00:00
|
|
|
};
|
2014-08-20 05:50:21 +00:00
|
|
|
static_assert_size(X_INPUT_CAPABILITIES,
|
|
|
|
sizeof(X_INPUT_GAMEPAD) + sizeof(X_INPUT_VIBRATION) + 4);
|
2014-01-05 06:38:56 +00:00
|
|
|
|
2014-08-20 05:50:21 +00:00
|
|
|
// http://msdn.microsoft.com/en-us/library/windows/desktop/microsoft.directx_sdk.reference.xinput_keystroke(v=vs.85).aspx
|
|
|
|
struct X_INPUT_KEYSTROKE {
|
|
|
|
be<uint16_t> virtual_key;
|
|
|
|
be<uint16_t> unicode;
|
|
|
|
be<uint16_t> flags;
|
|
|
|
be<uint8_t> user_index;
|
|
|
|
be<uint8_t> hid_code;
|
2014-01-05 06:38:56 +00:00
|
|
|
};
|
2014-08-20 05:50:21 +00:00
|
|
|
static_assert_size(X_INPUT_KEYSTROKE, 8);
|
2013-10-24 05:13:05 +00:00
|
|
|
|
2014-08-16 05:59:28 +00:00
|
|
|
#pragma pack(pop)
|
|
|
|
|
2013-01-28 21:28:22 +00:00
|
|
|
} // namespace xe
|
|
|
|
|
2013-10-24 03:42:24 +00:00
|
|
|
#endif // XENIA_XBOX_H_
|