Cleanups
This commit is contained in:
parent
8257cb638a
commit
8fbd59b690
|
@ -262,13 +262,11 @@ typedef struct _FILE_FS_DEVICE_INFORMATION {
|
||||||
#define FILE_AUTOGENERATED_DEVICE_NAME 0x00000080
|
#define FILE_AUTOGENERATED_DEVICE_NAME 0x00000080
|
||||||
#define FILE_DEVICE_SECURE_OPEN 0x00000100
|
#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;
|
typedef ULONG PHYSICAL_ADDRESS, *PPHYSICAL_ADDRESS;
|
||||||
|
|
||||||
// NtCreateFile/NtOpenFile stuff
|
/* NtCreateFile/NtOpenFile stuff */
|
||||||
#define FILE_SUPERSEDED 0x00000000
|
#define FILE_SUPERSEDED 0x00000000
|
||||||
#define FILE_OPENED 0x00000001
|
#define FILE_OPENED 0x00000001
|
||||||
#define FILE_CREATED 0x00000002
|
#define FILE_CREATED 0x00000002
|
||||||
|
@ -292,8 +290,8 @@ typedef ULONG PHYSICAL_ADDRESS, *PPHYSICAL_ADDRESS;
|
||||||
|
|
||||||
// Access types
|
// Access types
|
||||||
#define FILE_ANY_ACCESS 0
|
#define FILE_ANY_ACCESS 0
|
||||||
#define FILE_READ_ACCESS ( 0x0001 ) // file & pipe
|
#define FILE_READ_ACCESS 0x0001 /* file & pipe */
|
||||||
#define FILE_WRITE_ACCESS ( 0x0002 ) // file & pipe
|
#define FILE_WRITE_ACCESS 0x0002 /* file & pipe */
|
||||||
|
|
||||||
// Method types
|
// Method types
|
||||||
#define METHOD_BUFFERED 0
|
#define METHOD_BUFFERED 0
|
||||||
|
@ -323,8 +321,8 @@ typedef ULONG PHYSICAL_ADDRESS, *PPHYSICAL_ADDRESS;
|
||||||
// Special XBOX code?
|
// Special XBOX code?
|
||||||
#define IOCTL_CDROM_AUTHENTICATE_DISK CTL_CODE(FILE_DEVICE_CD_ROM, 0x0020, METHOD_BUFFERED, FILE_READ_ACCESS)
|
#define IOCTL_CDROM_AUTHENTICATE_DISK CTL_CODE(FILE_DEVICE_CD_ROM, 0x0020, METHOD_BUFFERED, FILE_READ_ACCESS)
|
||||||
|
|
||||||
// Structure for IOCTL_SCSI_PASS_THROUGH_DIRECT
|
/* Structure for IOCTL_SCSI_PASS_THROUGH_DIRECT
|
||||||
// Differences from NT: None, believe it or not.
|
* Differences from NT: None, believe it or not. */
|
||||||
typedef struct _SCSI_PASS_THROUGH_DIRECT {
|
typedef struct _SCSI_PASS_THROUGH_DIRECT {
|
||||||
/*000*/ USHORT Length;
|
/*000*/ USHORT Length;
|
||||||
/*002*/ UCHAR ScsiStatus;
|
/*002*/ UCHAR ScsiStatus;
|
||||||
|
@ -341,12 +339,12 @@ typedef struct _SCSI_PASS_THROUGH_DIRECT {
|
||||||
/*01C*/ UCHAR Cdb[16];
|
/*01C*/ UCHAR Cdb[16];
|
||||||
}SCSI_PASS_THROUGH_DIRECT, *PSCSI_PASS_THROUGH_DIRECT;
|
}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_OUT 0
|
||||||
#define SCSI_IOCTL_DATA_IN 1
|
#define SCSI_IOCTL_DATA_IN 1
|
||||||
#define SCSI_IOCTL_DATA_UNSPECIFIED 2
|
#define SCSI_IOCTL_DATA_UNSPECIFIED 2
|
||||||
|
|
||||||
// Kernel object type (unsure about the structure...)
|
/* Kernel object type (unsure about the structure...) */
|
||||||
typedef struct _OBJECT_TYPE
|
typedef struct _OBJECT_TYPE
|
||||||
{
|
{
|
||||||
// Same prototype as ExAllocatePoolWithTag, because that's the usual one
|
// Same prototype as ExAllocatePoolWithTag, because that's the usual one
|
||||||
|
@ -410,9 +408,9 @@ typedef struct _FILE_OBJECT {
|
||||||
typedef FILE_OBJECT *PFILE_OBJECT;
|
typedef FILE_OBJECT *PFILE_OBJECT;
|
||||||
|
|
||||||
|
|
||||||
// Thread information structures
|
/* Thread information structures */
|
||||||
|
|
||||||
// IRQL
|
/* IRQL */
|
||||||
typedef UCHAR KIRQL, *PKIRQL;
|
typedef UCHAR KIRQL, *PKIRQL;
|
||||||
#define PASSIVE_LEVEL 0 // Passive release level
|
#define PASSIVE_LEVEL 0 // Passive release level
|
||||||
#define LOW_LEVEL 0 // Lowest interrupt level
|
#define LOW_LEVEL 0 // Lowest interrupt level
|
||||||
|
@ -514,14 +512,13 @@ typedef struct _KTIMER {
|
||||||
LONG Period;
|
LONG Period;
|
||||||
} KTIMER, *PKTIMER;
|
} KTIMER, *PKTIMER;
|
||||||
|
|
||||||
|
/* XBE stuff
|
||||||
|
* Not used in any exported kernel calls, but still useful.
|
||||||
|
*/
|
||||||
|
|
||||||
|
/* XBE header information */
|
||||||
// XBE stuff
|
typedef struct _XBE_HEADER
|
||||||
// Not used in any exported kernel calls, but still useful.
|
{
|
||||||
|
|
||||||
|
|
||||||
// XBE header information
|
|
||||||
typedef struct _XBE_HEADER {
|
|
||||||
// 000 "XBEH"
|
// 000 "XBEH"
|
||||||
CHAR Magic[4];
|
CHAR Magic[4];
|
||||||
// 004 RSA digital signature of the entire header area
|
// 004 RSA digital signature of the entire header area
|
||||||
|
@ -643,22 +640,22 @@ typedef struct _XBE_SECTION {
|
||||||
// 038
|
// 038
|
||||||
} XBE_SECTION, *PXBE_SECTION;
|
} XBE_SECTION, *PXBE_SECTION;
|
||||||
|
|
||||||
// TLS directory information needed later
|
/* TLS directory information needed later
|
||||||
// Library version data needed later
|
* Library version data needed later */
|
||||||
|
|
||||||
// Initialization flags
|
/* Initialization flags */
|
||||||
#define XBE_INIT_MOUNT_UTILITY 0x00000001
|
#define XBE_INIT_MOUNT_UTILITY 0x00000001
|
||||||
#define XBE_INIT_FORMAT_UTILITY 0x00000002
|
#define XBE_INIT_FORMAT_UTILITY 0x00000002
|
||||||
#define XBE_INIT_64M_RAM_ONLY 0x00000004
|
#define XBE_INIT_64M_RAM_ONLY 0x00000004
|
||||||
#define XBE_INIT_DONT_SETUP_HDD 0x00000008
|
#define XBE_INIT_DONT_SETUP_HDD 0x00000008
|
||||||
|
|
||||||
// Region codes
|
/* Region codes */
|
||||||
#define XBE_REGION_US_CANADA 0x00000001
|
#define XBE_REGION_US_CANADA 0x00000001
|
||||||
#define XBE_REGION_JAPAN 0x00000002
|
#define XBE_REGION_JAPAN 0x00000002
|
||||||
#define XBE_REGION_ELSEWHERE 0x00000004
|
#define XBE_REGION_ELSEWHERE 0x00000004
|
||||||
#define XBE_REGION_DEBUG 0x80000000
|
#define XBE_REGION_DEBUG 0x80000000
|
||||||
|
|
||||||
// Media types
|
/* Media types */
|
||||||
#define XBE_MEDIA_HDD 0x00000001
|
#define XBE_MEDIA_HDD 0x00000001
|
||||||
#define XBE_MEDIA_XBOX_DVD 0x00000002
|
#define XBE_MEDIA_XBOX_DVD 0x00000002
|
||||||
#define XBE_MEDIA_ANY_CD_OR_DVD 0x00000004
|
#define XBE_MEDIA_ANY_CD_OR_DVD 0x00000004
|
||||||
|
@ -670,7 +667,7 @@ typedef struct _XBE_SECTION {
|
||||||
#define XBE_MEDIA_USB 0x00000100
|
#define XBE_MEDIA_USB 0x00000100
|
||||||
#define XBE_MEDIA_ALLOW_UNLOCKED_HDD 0x40000000
|
#define XBE_MEDIA_ALLOW_UNLOCKED_HDD 0x40000000
|
||||||
|
|
||||||
// Section flags
|
/* Section flags */
|
||||||
#define XBE_SEC_WRITABLE 0x00000001
|
#define XBE_SEC_WRITABLE 0x00000001
|
||||||
#define XBE_SEC_PRELOAD 0x00000002
|
#define XBE_SEC_PRELOAD 0x00000002
|
||||||
#define XBE_SEC_EXECUTABLE 0x00000004
|
#define XBE_SEC_EXECUTABLE 0x00000004
|
||||||
|
@ -678,21 +675,18 @@ typedef struct _XBE_SECTION {
|
||||||
#define XBE_SEC_RO_HEAD_PAGE 0x00000010
|
#define XBE_SEC_RO_HEAD_PAGE 0x00000010
|
||||||
#define XBE_SEC_RO_TAIL_PAGE 0x00000020
|
#define XBE_SEC_RO_TAIL_PAGE 0x00000020
|
||||||
|
|
||||||
|
/* x86 page size */
|
||||||
// x86 page size
|
|
||||||
#define PAGE_SIZE 0x1000
|
#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.
|
||||||
|
*
|
||||||
// PAGE_ALIGN:
|
* Differences from NT: None.
|
||||||
// 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)))
|
#define PAGE_ALIGN(Va) ((PVOID)((ULONG_PTR)(Va) & ~(PAGE_SIZE - 1)))
|
||||||
|
|
||||||
|
|
||||||
// NtReadFile:
|
// NtReadFile:
|
||||||
// Reads a file.
|
// Reads a file.
|
||||||
//
|
//
|
||||||
|
@ -963,11 +957,12 @@ XeLoadSection(
|
||||||
IN OUT PXBE_SECTION section
|
IN OUT PXBE_SECTION section
|
||||||
);
|
);
|
||||||
|
|
||||||
// Error codes
|
/* Error codes */
|
||||||
#define STATUS_SUCCESS 0x00000000
|
#define STATUS_SUCCESS 0x00000000
|
||||||
#define STATUS_UNSUCCESSFUL 0xC0000001
|
#define STATUS_UNSUCCESSFUL 0xC0000001
|
||||||
#define STATUS_UNRECOGNIZED_MEDIA 0xC0000014
|
#define STATUS_UNRECOGNIZED_MEDIA 0xC0000014
|
||||||
// The SCSI input buffer was too large (not necessarily an error!)
|
|
||||||
|
/* The SCSI input buffer was too large (not necessarily an error!) */
|
||||||
#define STATUS_DATA_OVERRUN 0xC000003C
|
#define STATUS_DATA_OVERRUN 0xC000003C
|
||||||
#define STATUS_INVALID_IMAGE_FORMAT 0xC000007B
|
#define STATUS_INVALID_IMAGE_FORMAT 0xC000007B
|
||||||
#define STATUS_INSUFFICIENT_RESOURCES 0xC000009A
|
#define STATUS_INSUFFICIENT_RESOURCES 0xC000009A
|
||||||
|
@ -1020,7 +1015,7 @@ HRESULT ObCreateSymbolicLink(PSTRING SymbolicLinkName, PSTRING DeviceName);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
HRESULT xbox_io_mount(const char* szDrive, char* szDevice)
|
static HRESULT xbox_io_mount(const char* szDrive, char* szDevice)
|
||||||
{
|
{
|
||||||
STRING DeviceName, LinkName;
|
STRING DeviceName, LinkName;
|
||||||
CHAR szDestinationDrive[PATH_MAX_LENGTH];
|
CHAR szDestinationDrive[PATH_MAX_LENGTH];
|
||||||
|
@ -1112,7 +1107,7 @@ static void frontend_xdk_get_environment_settings(int *argc, char *argv[],
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef _XBOX360
|
#ifdef _XBOX360
|
||||||
// detect install environment
|
/* Detect install environment. */
|
||||||
unsigned long license_mask;
|
unsigned long license_mask;
|
||||||
DWORD volume_device_type;
|
DWORD volume_device_type;
|
||||||
|
|
||||||
|
@ -1240,7 +1235,7 @@ static void frontend_xdk_init(void *data)
|
||||||
{
|
{
|
||||||
(void)data;
|
(void)data;
|
||||||
#if defined(_XBOX1) && !defined(IS_SALAMANDER)
|
#if defined(_XBOX1) && !defined(IS_SALAMANDER)
|
||||||
// Mount drives
|
/* Mount drives */
|
||||||
xbox_io_mount("A:", "cdrom0");
|
xbox_io_mount("A:", "cdrom0");
|
||||||
xbox_io_mount("C:", "Harddisk0\\Partition0");
|
xbox_io_mount("C:", "Harddisk0\\Partition0");
|
||||||
xbox_io_mount("E:", "Harddisk0\\Partition1");
|
xbox_io_mount("E:", "Harddisk0\\Partition1");
|
||||||
|
@ -1250,26 +1245,6 @@ static void frontend_xdk_init(void *data)
|
||||||
#endif
|
#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)
|
static void frontend_xdk_exec(const char *path, bool should_load_game)
|
||||||
{
|
{
|
||||||
#ifndef IS_SALAMANDER
|
#ifndef IS_SALAMANDER
|
||||||
|
@ -1317,6 +1292,24 @@ static void frontend_xdk_exec(const char *path, bool should_load_game)
|
||||||
#endif
|
#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)
|
static int frontend_xdk_get_rating(void)
|
||||||
{
|
{
|
||||||
#if defined(_XBOX360)
|
#if defined(_XBOX360)
|
||||||
|
|
Loading…
Reference in New Issue