Convert platform_xdk.cpp to C

This commit is contained in:
twinaphex 2017-10-03 04:36:43 +02:00
parent d0d6d0bfe8
commit be5d3cb0ba
3 changed files with 36 additions and 29 deletions

View File

@ -1100,12 +1100,25 @@ static void frontend_xdk_get_environment_settings(int *argc, char *argv[],
void *args, void *params_data)
{
HRESULT ret;
(void)ret;
#ifdef _XBOX360
unsigned long license_mask;
DWORD volume_device_type;
#endif
#ifndef IS_SALAMANDER
static char path[PATH_MAX_LENGTH] = {0};
#if defined(_XBOX1)
LAUNCH_DATA ptr;
DWORD launch_type;
#elif defined(_XBOX360)
DWORD dwLaunchDataSize;
#endif
#endif
#ifndef IS_SALAMANDER
bool original_verbose = verbosity_is_enabled();
#endif
(void)ret;
#ifndef IS_SALAMANDER
#if defined(HAVE_LOGGER)
logger_init();
@ -1116,9 +1129,6 @@ static void frontend_xdk_get_environment_settings(int *argc, char *argv[],
#ifdef _XBOX360
/* Detect install environment. */
unsigned long license_mask;
DWORD volume_device_type;
if (XContentGetLicenseMask(&license_mask, NULL) == ERROR_SUCCESS)
{
XContentQueryVolumeDeviceType("GAME",&volume_device_type, NULL);
@ -1181,11 +1191,7 @@ static void frontend_xdk_get_environment_settings(int *argc, char *argv[],
"info", sizeof(g_defaults.dirs[DEFAULT_DIR_CORE_INFO]));
#ifndef IS_SALAMANDER
static char path[PATH_MAX_LENGTH] = {0};
#if defined(_XBOX1)
LAUNCH_DATA ptr;
DWORD launch_type;
if (XGetLaunchInfo(&launch_type, &ptr) == ERROR_SUCCESS)
{
char *extracted_path = NULL;
@ -1204,14 +1210,15 @@ static void frontend_xdk_get_environment_settings(int *argc, char *argv[],
}
}
#elif defined(_XBOX360)
DWORD dwLaunchDataSize;
if (XGetLaunchDataSize(&dwLaunchDataSize) == ERROR_SUCCESS)
{
BYTE* pLaunchData = new BYTE[dwLaunchDataSize];
XGetLaunchData(pLaunchData, dwLaunchDataSize);
char *extracted_path = (char*)calloc(dwLaunchDataSize, sizeof(char));
BYTE* pLaunchData = (BYTE*)calloc(dwLaunchDataSize, sizeof(BYTE));
AURORA_LAUNCHDATA_EXECUTABLE* aurora = (AURORA_LAUNCHDATA_EXECUTABLE*)pLaunchData;
char* extracted_path = new char[dwLaunchDataSize];
XGetLaunchData(pLaunchData, dwLaunchDataSize);
memset(extracted_path, 0, dwLaunchDataSize);
if (aurora->ApplicationId == AURORA_LAUNCHDATA_APPID && aurora->FunctionId == AURORA_LAUNCHDATA_EXECUTABLE_FUNCID)
{
if (xbox_io_mount("aurora:", aurora->SystemPath) >= 0)
@ -1219,15 +1226,14 @@ static void frontend_xdk_get_environment_settings(int *argc, char *argv[],
"aurora:%s%s", aurora->RelativePath, aurora->Exectutable);
}
else
snprintf(extracted_path,
dwLaunchDataSize, "%s", pLaunchData);
strlcpy(extracted_path, pLaunchData, dwLaunchDataSize);
/* Auto-start game */
if (!string_is_empty(extracted_path))
strlcpy(path, extracted_path, sizeof(path));
if (pLaunchData)
delete []pLaunchData;
free(pLaunchData);
}
#endif
if (!string_is_empty(path))
@ -1278,6 +1284,13 @@ static void frontend_xdk_exec(const char *path, bool should_load_game)
{
#ifndef IS_SALAMANDER
bool original_verbose = verbosity_is_enabled();
#endif
#if defined(_XBOX)
#if defined(_XBOX1)
LAUNCH_DATA ptr;
#elif defined(_XBOX360)
char game_path[1024] = {0};
#endif
#endif
(void)should_load_game;
@ -1287,7 +1300,6 @@ static void frontend_xdk_exec(const char *path, bool should_load_game)
#else
#ifdef _XBOX
#if defined(_XBOX1)
LAUNCH_DATA ptr;
memset(&ptr, 0, sizeof(ptr));
if (should_load_game && !path_is_empty(RARCH_PATH_CONTENT))
@ -1296,8 +1308,6 @@ static void frontend_xdk_exec(const char *path, bool should_load_game)
if (!string_is_empty(path))
XLaunchNewImage(path, !string_is_empty((const char*)ptr.Data) ? &ptr : NULL);
#elif defined(_XBOX360)
char game_path[1024] = {0};
if (should_load_game && !path_is_empty(RARCH_PATH_CONTENT))
{
strlcpy(game_path, path_get(RARCH_PATH_CONTENT), sizeof(game_path));
@ -1305,7 +1315,7 @@ static void frontend_xdk_exec(const char *path, bool should_load_game)
}
if (!string_is_empty(path))
XLaunchNewImage(path, NULL);
XLaunchNewImage(path, 0);
#endif
#endif
#endif

View File

@ -833,6 +833,11 @@ FRONTEND
#if defined(_WIN32) && !defined(_XBOX)
#include "../frontend/drivers/platform_win32.c"
#endif
#ifdef _XBOX
#include "../frontend/drivers/platform_xdk.c"
#endif
#if defined(__CELLOS_LV2__)
#include "../frontend/drivers/platform_ps3.c"
#elif defined(GEKKO)

View File

@ -127,18 +127,10 @@ UI
/*============================================================
VIDEO DRIVER
============================================================ */
#ifdef _XBOX
#include "../frontend/drivers/platform_xdk.cpp"
#endif
#if defined(HAVE_D3D) && defined(HAVE_D3D9)
#ifdef HAVE_HLSL
#if defined(HAVE_D3D) && defined(HAVE_D3D9) && defined(HAVE_HLSL)
#include "../gfx/drivers_renderchain/d3d9_hlsl_renderchain.cpp"
#endif
#endif
#ifdef HAVE_VULKAN
#include "../gfx/drivers_shader/shader_vulkan.cpp"
#include "../gfx/drivers_shader/glslang_util.cpp"