From 8464ad30bdd7e1e89f01c00c31cf974ba0e35944 Mon Sep 17 00:00:00 2001 From: twinaphex Date: Mon, 16 Oct 2017 01:33:17 +0200 Subject: [PATCH] (Xbox 360) Buildfixes --- gfx/common/d3d_common.c | 4 ++++ gfx/drivers_font/xdk360_fonts.cpp | 3 +++ libretro-common/file/file_path.c | 25 ++++++++++++------------- libretro-common/file/retro_dirent.c | 16 ++++++++-------- menu/menu_displaylist.c | 3 ++- 5 files changed, 29 insertions(+), 22 deletions(-) diff --git a/gfx/common/d3d_common.c b/gfx/common/d3d_common.c index 4e804a1cce..07976b7393 100644 --- a/gfx/common/d3d_common.c +++ b/gfx/common/d3d_common.c @@ -24,6 +24,10 @@ #include "../include/d3d8/d3dx8tex.h" #endif +#ifdef _XBOX +#include +#endif + bool d3d_swap(void *data, LPDIRECT3DDEVICE dev) { #if defined(_XBOX1) diff --git a/gfx/drivers_font/xdk360_fonts.cpp b/gfx/drivers_font/xdk360_fonts.cpp index 302466d3df..de923944cb 100644 --- a/gfx/drivers_font/xdk360_fonts.cpp +++ b/gfx/drivers_font/xdk360_fonts.cpp @@ -14,7 +14,10 @@ * If not, see . */ +#ifdef _XBOX #include +#include +#endif #include diff --git a/libretro-common/file/file_path.c b/libretro-common/file/file_path.c index cba1bf33ad..50cc54162b 100644 --- a/libretro-common/file/file_path.c +++ b/libretro-common/file/file_path.c @@ -118,28 +118,27 @@ static bool path_stat(const char *path, enum stat_mode mode, int32_t *size) struct _stat buf; char *path_local; wchar_t *path_wide; + DWORD file_info; if (!path || !*path) return false; -#if defined(_MSC_VER) && _MSC_VER < 1400 (void)path_wide; + (void)path_local; + (void)file_info; +#if defined(_MSC_VER) && _MSC_VER < 1400 || defined(_XBOX) /* assume W-functions do not work below VC2005 */ path_local = utf8_to_local_string_alloc(path); - - DWORD file_info = GetFileAttributes(path_local); + file_info = GetFileAttributes(path_local); _stat(path_local, &buf); if (path_local) free(path_local); #else - (void)path_local; - path_wide = utf8_to_utf16_string_alloc(path); - - DWORD file_info = GetFileAttributesW(path_wide); + file_info = GetFileAttributesW(path_wide); _wstat(path_wide, &buf); @@ -915,15 +914,17 @@ void fill_short_pathname_representation_noext(char* out_rep, int path_file_remove(const char *path) { - char *path_local; - wchar_t *path_wide; + char *path_local = NULL; + wchar_t *path_wide = NULL; if (!path || !*path) return false; -#if defined(_WIN32) && !defined(_XBOX) -#if defined(_MSC_VER) && _MSC_VER < 1400 + + (void)path_local; (void)path_wide; +#if defined(_WIN32) && !defined(_XBOX) +#if defined(_MSC_VER) && _MSC_VER < 1400 path_local = utf8_to_local_string_alloc(path); if (path_local) @@ -934,8 +935,6 @@ int path_file_remove(const char *path) return ret; } #else - (void)path_local; - path_wide = utf8_to_utf16_string_alloc(path); if (path_wide) diff --git a/libretro-common/file/retro_dirent.c b/libretro-common/file/retro_dirent.c index ecb58f837b..0604f2ef74 100644 --- a/libretro-common/file/retro_dirent.c +++ b/libretro-common/file/retro_dirent.c @@ -70,7 +70,7 @@ struct RDIR { #if defined(_WIN32) -#if defined(_MSC_VER) && _MSC_VER < 1400 +#if defined(_MSC_VER) && _MSC_VER < 1400 || defined(_XBOX) WIN32_FIND_DATA entry; #else WIN32_FIND_DATAW entry; @@ -95,10 +95,10 @@ struct RDIR *retro_opendir(const char *name) { #if defined(_WIN32) char path_buf[1024]; - char *path_local = NULL; + char *path_local = NULL; wchar_t *path_wide = NULL; #endif - struct RDIR *rdir = (struct RDIR*)calloc(1, sizeof(*rdir)); + struct RDIR *rdir = (struct RDIR*)calloc(1, sizeof(*rdir)); if (!rdir) return NULL; @@ -106,10 +106,10 @@ struct RDIR *retro_opendir(const char *name) #if defined(_WIN32) path_buf[0] = '\0'; snprintf(path_buf, sizeof(path_buf), "%s\\*", name); -#if defined(_MSC_VER) && _MSC_VER < 1400 +#if defined(_MSC_VER) && _MSC_VER < 1400 || defined(_XBOX) (void)path_wide; - path_local = utf8_to_local_string_alloc(path_buf); + path_local = utf8_to_local_string_alloc(path_buf); rdir->directory = FindFirstFile(path_local, &rdir->entry); if (path_local) @@ -117,7 +117,7 @@ struct RDIR *retro_opendir(const char *name) #else (void)path_local; - path_wide = utf8_to_utf16_string_alloc(path_buf); + path_wide = utf8_to_utf16_string_alloc(path_buf); rdir->directory = FindFirstFileW(path_wide, &rdir->entry); if (path_wide) @@ -155,7 +155,7 @@ int retro_readdir(struct RDIR *rdir) { #if defined(_WIN32) if(rdir->next) -#if defined(_MSC_VER) && _MSC_VER < 1400 +#if defined(_MSC_VER) && _MSC_VER < 1400 || defined(_XBOX) return (FindNextFile(rdir->directory, &rdir->entry) != 0); #else return (FindNextFileW(rdir->directory, &rdir->entry) != 0); @@ -177,7 +177,7 @@ int retro_readdir(struct RDIR *rdir) const char *retro_dirent_get_name(struct RDIR *rdir) { #if defined(_WIN32) -#if defined(_MSC_VER) && _MSC_VER < 1400 +#if defined(_MSC_VER) && _MSC_VER < 1400 || defined(_XBOX) char *name_local = local_to_utf8_string_alloc(rdir->entry.cFileName); memset(rdir->entry.cFileName, 0, sizeof(rdir->entry.cFileName)); strlcpy(rdir->entry.cFileName, name_local, sizeof(rdir->entry.cFileName)); diff --git a/menu/menu_displaylist.c b/menu/menu_displaylist.c index 788a216594..8e88e03217 100644 --- a/menu/menu_displaylist.c +++ b/menu/menu_displaylist.c @@ -2997,6 +2997,7 @@ static int menu_displaylist_parse_load_content_settings( static int menu_displaylist_parse_horizontal_content_actions( menu_displaylist_info_t *info) { + bool content_loaded = false; unsigned idx = rpl_entry_selection_ptr; menu_handle_t *menu = NULL; const char *label = NULL; @@ -3016,7 +3017,7 @@ static int menu_displaylist_parse_horizontal_content_actions( playlist_get_index(playlist, idx, &entry_path, &label, &core_path, &core_name, NULL, &db_name); - bool content_loaded = !rarch_ctl(RARCH_CTL_IS_DUMMY_CORE, NULL) + content_loaded = !rarch_ctl(RARCH_CTL_IS_DUMMY_CORE, NULL) && string_is_equal(menu->deferred_path, fullpath); if (content_loaded)