(XDK) Added support for Aurora Launch Data

This commit is contained in:
Swizzy 2015-01-03 23:39:32 +01:00
parent 96224575f5
commit f3f527ba20
2 changed files with 61 additions and 2 deletions

View File

@ -29,6 +29,37 @@
static bool exit_spawn;
static bool exitspawn_start_game;
#ifdef _XBOX360
typedef struct _STRING
{
USHORT Length;
USHORT MaximumLength;
PCHAR Buffer;
} STRING, *PSTRING;
#ifdef __cplusplus
extern "C" {
#endif
VOID RtlInitAnsiString(PSTRING DestinationString, PCHAR SourceString);
HRESULT ObDeleteSymbolicLink(PSTRING SymbolicLinkName);
HRESULT ObCreateSymbolicLink(PSTRING SymbolicLinkName, PSTRING DeviceName);
#ifdef __cplusplus
}
#endif
HRESULT xbox_io_mount(const char* szDrive, char* szDevice)
{
STRING DeviceName, LinkName;
CHAR szDestinationDrive[MAX_PATH];
sprintf_s(szDestinationDrive, MAX_PATH, "\\??\\%s", szDrive);
RtlInitAnsiString(&DeviceName, szDevice);
RtlInitAnsiString(&LinkName, szDestinationDrive);
ObDeleteSymbolicLink(&LinkName);
return (HRESULT)ObCreateSymbolicLink(&LinkName, &DeviceName);
}
#endif
#ifdef _XBOX1
static HRESULT xbox_io_mount(char *szDrive, char *szDevice)
{
@ -202,8 +233,18 @@ static void frontend_xdk_get_environment_settings(int *argc, char *argv[],
{
BYTE* pLaunchData = new BYTE[dwLaunchDataSize];
XGetLaunchData(pLaunchData, dwLaunchDataSize);
char *extracted_path = (char*)&pLaunchData;
AURORA_LAUNCHDATA_ROM* aurora = (AURORA_LAUNCHDATA_ROM*)pLaunchData;
char* extracted_path = new char[dwLaunchDataSize];
memset(extracted_path, 0, dwLaunchDataSize);
if (aurora->ApplicationId == AURORA_LAUNCHDATA_APPID && aurora->FunctionId == AURORA_LAUNCHDATA_ROM_FUNCID)
{
if (xbox_io_mount("aurora:", aurora->SystemPath) >= 0)
sprintf_s(extracted_path, dwLaunchDataSize, "aurora:%s%s", aurora->RelativePath, aurora->Exectutable);
else
RARCH_LOG("Failed to mount %s as aurora:.\n", aurora->SystemPath);
}
else
sprintf_s(extracted_path, dwLaunchDataSize, "%s", pLaunchData);
if (extracted_path && extracted_path[0] != '\0')
{
strlcpy(path, extracted_path, sizeof(path));

View File

@ -26,6 +26,24 @@
#ifndef __XBOX_INTERNAL_H__
#define __XBOX_INTERNAL_H__
#ifdef _XBOX360
#define AURORA_LAUNCHDATA_APPID 'AUOA'
#define AURORA_LAUNCHDATA_ROM_FUNCID 'ROMS'
#define AURORA_LAUNCHDATA_ROM_VERSION 1
typedef struct _AURORA_LAUNCHDATA_ROM {
DWORD ApplicationId; // AURORA_LAUNCHDATA_APPID
DWORD FunctionId; // AURORA_LAUNCHDATA_ROM_FUNCID
DWORD FunctionVersion; // AURORA_LAUNCHDATA_ROM_VERSION
CHAR SystemPath[0x40]; // /System/Harddisk0/Parition0
CHAR RelativePath[0x104]; // /Emulators/Snes9x/Roms/
CHAR Exectutable[0x28]; // ChronoTrigger.zip
CHAR Reserved[0x100]; // Reserved for future use
} AURORA_LAUNCHDATA_ROM, *PAURORA_LAUNCH_DATA_ROM;
#endif
#ifdef _XBOX1
#include <pshpack4.h>