Skip to content

Commit

Permalink
(XDK) Added support for Aurora Launch Data
Browse files Browse the repository at this point in the history
  • Loading branch information
Swizzy committed Jan 3, 2015
1 parent 9622457 commit f3f527b
Show file tree
Hide file tree
Showing 2 changed files with 61 additions and 2 deletions.
45 changes: 43 additions & 2 deletions frontend/platform/platform_xdk.c
Expand Up @@ -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)
{
Expand Down Expand Up @@ -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));
Expand Down
18 changes: 18 additions & 0 deletions frontend/platform/platform_xdk.h
Expand Up @@ -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>
Expand Down

0 comments on commit f3f527b

Please sign in to comment.