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

View File

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

View File

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