mirror of
https://github.com/libretro/RetroArch
synced 2025-01-30 12:32:52 +00:00
Cleanups
This commit is contained in:
parent
8257cb638a
commit
8fbd59b690
@ -157,23 +157,23 @@ typedef struct _OBJECT_ATTRIBUTES {
|
||||
typedef OBJECT_ATTRIBUTES *POBJECT_ATTRIBUTES;
|
||||
|
||||
// Flags for OBJECT_ATTRIBUTES::Attributes
|
||||
#define OBJ_INHERIT 0x00000002L
|
||||
#define OBJ_PERMANENT 0x00000010L
|
||||
#define OBJ_EXCLUSIVE 0x00000020L
|
||||
#define OBJ_CASE_INSENSITIVE 0x00000040L
|
||||
#define OBJ_OPENIF 0x00000080L
|
||||
#define OBJ_OPENLINK 0x00000100L
|
||||
#define OBJ_KERNEL_HANDLE 0x00000200L
|
||||
#define OBJ_VALID_ATTRIBUTES 0x000003F2L
|
||||
#define OBJ_INHERIT 0x00000002L
|
||||
#define OBJ_PERMANENT 0x00000010L
|
||||
#define OBJ_EXCLUSIVE 0x00000020L
|
||||
#define OBJ_CASE_INSENSITIVE 0x00000040L
|
||||
#define OBJ_OPENIF 0x00000080L
|
||||
#define OBJ_OPENLINK 0x00000100L
|
||||
#define OBJ_KERNEL_HANDLE 0x00000200L
|
||||
#define OBJ_VALID_ATTRIBUTES 0x000003F2L
|
||||
|
||||
// CreateDisposition values for NtCreateFile()
|
||||
#define FILE_SUPERSEDE 0x00000000
|
||||
#define FILE_OPEN 0x00000001
|
||||
#define FILE_CREATE 0x00000002
|
||||
#define FILE_OPEN_IF 0x00000003
|
||||
#define FILE_OVERWRITE 0x00000004
|
||||
#define FILE_OVERWRITE_IF 0x00000005
|
||||
#define FILE_MAXIMUM_DISPOSITION 0x00000005
|
||||
#define FILE_SUPERSEDE 0x00000000
|
||||
#define FILE_OPEN 0x00000001
|
||||
#define FILE_CREATE 0x00000002
|
||||
#define FILE_OPEN_IF 0x00000003
|
||||
#define FILE_OVERWRITE 0x00000004
|
||||
#define FILE_OVERWRITE_IF 0x00000005
|
||||
#define FILE_MAXIMUM_DISPOSITION 0x00000005
|
||||
|
||||
// CreateOption values for NtCreateFile()
|
||||
// FILE_NON_DIRECTORY_FILE | FILE_SYNCHRONOUS_IO_NONALERT is what CreateFile
|
||||
@ -262,13 +262,11 @@ typedef struct _FILE_FS_DEVICE_INFORMATION {
|
||||
#define FILE_AUTOGENERATED_DEVICE_NAME 0x00000080
|
||||
#define FILE_DEVICE_SECURE_OPEN 0x00000100
|
||||
|
||||
|
||||
|
||||
// Physical address
|
||||
// Differences from NT: 32 bit address instead of 64.
|
||||
/* Physical address
|
||||
* Differences from NT: 32 bit address instead of 64. */
|
||||
typedef ULONG PHYSICAL_ADDRESS, *PPHYSICAL_ADDRESS;
|
||||
|
||||
// NtCreateFile/NtOpenFile stuff
|
||||
/* NtCreateFile/NtOpenFile stuff */
|
||||
#define FILE_SUPERSEDED 0x00000000
|
||||
#define FILE_OPENED 0x00000001
|
||||
#define FILE_CREATED 0x00000002
|
||||
@ -292,8 +290,8 @@ typedef ULONG PHYSICAL_ADDRESS, *PPHYSICAL_ADDRESS;
|
||||
|
||||
// Access types
|
||||
#define FILE_ANY_ACCESS 0
|
||||
#define FILE_READ_ACCESS ( 0x0001 ) // file & pipe
|
||||
#define FILE_WRITE_ACCESS ( 0x0002 ) // file & pipe
|
||||
#define FILE_READ_ACCESS 0x0001 /* file & pipe */
|
||||
#define FILE_WRITE_ACCESS 0x0002 /* file & pipe */
|
||||
|
||||
// Method types
|
||||
#define METHOD_BUFFERED 0
|
||||
@ -323,8 +321,8 @@ typedef ULONG PHYSICAL_ADDRESS, *PPHYSICAL_ADDRESS;
|
||||
// Special XBOX code?
|
||||
#define IOCTL_CDROM_AUTHENTICATE_DISK CTL_CODE(FILE_DEVICE_CD_ROM, 0x0020, METHOD_BUFFERED, FILE_READ_ACCESS)
|
||||
|
||||
// Structure for IOCTL_SCSI_PASS_THROUGH_DIRECT
|
||||
// Differences from NT: None, believe it or not.
|
||||
/* Structure for IOCTL_SCSI_PASS_THROUGH_DIRECT
|
||||
* Differences from NT: None, believe it or not. */
|
||||
typedef struct _SCSI_PASS_THROUGH_DIRECT {
|
||||
/*000*/ USHORT Length;
|
||||
/*002*/ UCHAR ScsiStatus;
|
||||
@ -341,12 +339,12 @@ typedef struct _SCSI_PASS_THROUGH_DIRECT {
|
||||
/*01C*/ UCHAR Cdb[16];
|
||||
}SCSI_PASS_THROUGH_DIRECT, *PSCSI_PASS_THROUGH_DIRECT;
|
||||
|
||||
// DataIn fields for IOCTL_SCSI_PASS_THROUGH_DIRECT
|
||||
/* DataIn fields for IOCTL_SCSI_PASS_THROUGH_DIRECT */
|
||||
#define SCSI_IOCTL_DATA_OUT 0
|
||||
#define SCSI_IOCTL_DATA_IN 1
|
||||
#define SCSI_IOCTL_DATA_UNSPECIFIED 2
|
||||
|
||||
// Kernel object type (unsure about the structure...)
|
||||
/* Kernel object type (unsure about the structure...) */
|
||||
typedef struct _OBJECT_TYPE
|
||||
{
|
||||
// Same prototype as ExAllocatePoolWithTag, because that's the usual one
|
||||
@ -410,9 +408,9 @@ typedef struct _FILE_OBJECT {
|
||||
typedef FILE_OBJECT *PFILE_OBJECT;
|
||||
|
||||
|
||||
// Thread information structures
|
||||
/* Thread information structures */
|
||||
|
||||
// IRQL
|
||||
/* IRQL */
|
||||
typedef UCHAR KIRQL, *PKIRQL;
|
||||
#define PASSIVE_LEVEL 0 // Passive release level
|
||||
#define LOW_LEVEL 0 // Lowest interrupt level
|
||||
@ -514,14 +512,13 @@ typedef struct _KTIMER {
|
||||
LONG Period;
|
||||
} KTIMER, *PKTIMER;
|
||||
|
||||
/* XBE stuff
|
||||
* Not used in any exported kernel calls, but still useful.
|
||||
*/
|
||||
|
||||
|
||||
// XBE stuff
|
||||
// Not used in any exported kernel calls, but still useful.
|
||||
|
||||
|
||||
// XBE header information
|
||||
typedef struct _XBE_HEADER {
|
||||
/* XBE header information */
|
||||
typedef struct _XBE_HEADER
|
||||
{
|
||||
// 000 "XBEH"
|
||||
CHAR Magic[4];
|
||||
// 004 RSA digital signature of the entire header area
|
||||
@ -643,22 +640,22 @@ typedef struct _XBE_SECTION {
|
||||
// 038
|
||||
} XBE_SECTION, *PXBE_SECTION;
|
||||
|
||||
// TLS directory information needed later
|
||||
// Library version data needed later
|
||||
/* TLS directory information needed later
|
||||
* Library version data needed later */
|
||||
|
||||
// Initialization flags
|
||||
/* Initialization flags */
|
||||
#define XBE_INIT_MOUNT_UTILITY 0x00000001
|
||||
#define XBE_INIT_FORMAT_UTILITY 0x00000002
|
||||
#define XBE_INIT_64M_RAM_ONLY 0x00000004
|
||||
#define XBE_INIT_DONT_SETUP_HDD 0x00000008
|
||||
|
||||
// Region codes
|
||||
/* Region codes */
|
||||
#define XBE_REGION_US_CANADA 0x00000001
|
||||
#define XBE_REGION_JAPAN 0x00000002
|
||||
#define XBE_REGION_ELSEWHERE 0x00000004
|
||||
#define XBE_REGION_DEBUG 0x80000000
|
||||
|
||||
// Media types
|
||||
/* Media types */
|
||||
#define XBE_MEDIA_HDD 0x00000001
|
||||
#define XBE_MEDIA_XBOX_DVD 0x00000002
|
||||
#define XBE_MEDIA_ANY_CD_OR_DVD 0x00000004
|
||||
@ -670,7 +667,7 @@ typedef struct _XBE_SECTION {
|
||||
#define XBE_MEDIA_USB 0x00000100
|
||||
#define XBE_MEDIA_ALLOW_UNLOCKED_HDD 0x40000000
|
||||
|
||||
// Section flags
|
||||
/* Section flags */
|
||||
#define XBE_SEC_WRITABLE 0x00000001
|
||||
#define XBE_SEC_PRELOAD 0x00000002
|
||||
#define XBE_SEC_EXECUTABLE 0x00000004
|
||||
@ -678,21 +675,18 @@ typedef struct _XBE_SECTION {
|
||||
#define XBE_SEC_RO_HEAD_PAGE 0x00000010
|
||||
#define XBE_SEC_RO_TAIL_PAGE 0x00000020
|
||||
|
||||
|
||||
// x86 page size
|
||||
/* x86 page size */
|
||||
#define PAGE_SIZE 0x1000
|
||||
|
||||
/* Native NT API calls on the XBOX */
|
||||
|
||||
// Native NT API calls on the XBOX
|
||||
|
||||
|
||||
// PAGE_ALIGN:
|
||||
// Returns an address rounded down to the nearest page boundary.
|
||||
//
|
||||
// Differences from NT: None.
|
||||
/* PAGE_ALIGN:
|
||||
* Returns an address rounded down to the nearest page boundary.
|
||||
*
|
||||
* Differences from NT: None.
|
||||
*/
|
||||
#define PAGE_ALIGN(Va) ((PVOID)((ULONG_PTR)(Va) & ~(PAGE_SIZE - 1)))
|
||||
|
||||
|
||||
// NtReadFile:
|
||||
// Reads a file.
|
||||
//
|
||||
@ -963,16 +957,17 @@ XeLoadSection(
|
||||
IN OUT PXBE_SECTION section
|
||||
);
|
||||
|
||||
// Error codes
|
||||
#define STATUS_SUCCESS 0x00000000
|
||||
#define STATUS_UNSUCCESSFUL 0xC0000001
|
||||
#define STATUS_UNRECOGNIZED_MEDIA 0xC0000014
|
||||
// The SCSI input buffer was too large (not necessarily an error!)
|
||||
#define STATUS_DATA_OVERRUN 0xC000003C
|
||||
#define STATUS_INVALID_IMAGE_FORMAT 0xC000007B
|
||||
#define STATUS_INSUFFICIENT_RESOURCES 0xC000009A
|
||||
#define STATUS_TOO_MANY_SECRETS 0xC0000156
|
||||
#define STATUS_REGION_MISMATCH 0xC0050001
|
||||
/* Error codes */
|
||||
#define STATUS_SUCCESS 0x00000000
|
||||
#define STATUS_UNSUCCESSFUL 0xC0000001
|
||||
#define STATUS_UNRECOGNIZED_MEDIA 0xC0000014
|
||||
|
||||
/* The SCSI input buffer was too large (not necessarily an error!) */
|
||||
#define STATUS_DATA_OVERRUN 0xC000003C
|
||||
#define STATUS_INVALID_IMAGE_FORMAT 0xC000007B
|
||||
#define STATUS_INSUFFICIENT_RESOURCES 0xC000009A
|
||||
#define STATUS_TOO_MANY_SECRETS 0xC0000156
|
||||
#define STATUS_REGION_MISMATCH 0xC0050001
|
||||
|
||||
#ifdef __cplusplus
|
||||
};
|
||||
@ -1020,7 +1015,7 @@ HRESULT ObCreateSymbolicLink(PSTRING SymbolicLinkName, PSTRING DeviceName);
|
||||
}
|
||||
#endif
|
||||
|
||||
HRESULT xbox_io_mount(const char* szDrive, char* szDevice)
|
||||
static HRESULT xbox_io_mount(const char* szDrive, char* szDevice)
|
||||
{
|
||||
STRING DeviceName, LinkName;
|
||||
CHAR szDestinationDrive[PATH_MAX_LENGTH];
|
||||
@ -1112,7 +1107,7 @@ static void frontend_xdk_get_environment_settings(int *argc, char *argv[],
|
||||
#endif
|
||||
|
||||
#ifdef _XBOX360
|
||||
// detect install environment
|
||||
/* Detect install environment. */
|
||||
unsigned long license_mask;
|
||||
DWORD volume_device_type;
|
||||
|
||||
@ -1240,7 +1235,7 @@ static void frontend_xdk_init(void *data)
|
||||
{
|
||||
(void)data;
|
||||
#if defined(_XBOX1) && !defined(IS_SALAMANDER)
|
||||
// Mount drives
|
||||
/* Mount drives */
|
||||
xbox_io_mount("A:", "cdrom0");
|
||||
xbox_io_mount("C:", "Harddisk0\\Partition0");
|
||||
xbox_io_mount("E:", "Harddisk0\\Partition1");
|
||||
@ -1250,26 +1245,6 @@ static void frontend_xdk_init(void *data)
|
||||
#endif
|
||||
}
|
||||
|
||||
static void frontend_xdk_exec(const char *path, bool should_load_game);
|
||||
|
||||
static void frontend_xdk_set_fork(bool exit, bool start_game)
|
||||
{
|
||||
exit_spawn = exit;
|
||||
exitspawn_start_game = start_game;
|
||||
}
|
||||
|
||||
static void frontend_xdk_exitspawn(char *s, size_t len)
|
||||
{
|
||||
bool should_load_game = false;
|
||||
#ifndef IS_SALAMANDER
|
||||
should_load_game = exitspawn_start_game;
|
||||
|
||||
if (!exit_spawn)
|
||||
return;
|
||||
#endif
|
||||
frontend_xdk_exec(s, should_load_game);
|
||||
}
|
||||
|
||||
static void frontend_xdk_exec(const char *path, bool should_load_game)
|
||||
{
|
||||
#ifndef IS_SALAMANDER
|
||||
@ -1317,6 +1292,24 @@ static void frontend_xdk_exec(const char *path, bool should_load_game)
|
||||
#endif
|
||||
}
|
||||
|
||||
static void frontend_xdk_set_fork(bool exit, bool start_game)
|
||||
{
|
||||
exit_spawn = exit;
|
||||
exitspawn_start_game = start_game;
|
||||
}
|
||||
|
||||
static void frontend_xdk_exitspawn(char *s, size_t len)
|
||||
{
|
||||
bool should_load_game = false;
|
||||
#ifndef IS_SALAMANDER
|
||||
should_load_game = exitspawn_start_game;
|
||||
|
||||
if (!exit_spawn)
|
||||
return;
|
||||
#endif
|
||||
frontend_xdk_exec(s, should_load_game);
|
||||
}
|
||||
|
||||
static int frontend_xdk_get_rating(void)
|
||||
{
|
||||
#if defined(_XBOX360)
|
||||
|
Loading…
x
Reference in New Issue
Block a user