Skip to content

Commit

Permalink
Win2000 buildfixes
Browse files Browse the repository at this point in the history
  • Loading branch information
Brad Parker committed Jan 17, 2017
1 parent 061c13b commit e1f4db8
Show file tree
Hide file tree
Showing 13 changed files with 31 additions and 15 deletions.
5 changes: 5 additions & 0 deletions audio/drivers/xaudio.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,11 @@
#include <compat/msvc.h>
#include <retro_miscellaneous.h>

#if defined(_MSC_VER) && (_WIN32_WINNT <= _WIN32_WINNT_WIN2K)
/* needed for CoInitializeEx */
#define _WIN32_DCOM
#endif

#include "xaudio.h"

#include "../audio_driver.h"
Expand Down
2 changes: 1 addition & 1 deletion file_path_special.c
Original file line number Diff line number Diff line change
Expand Up @@ -285,7 +285,7 @@ void fill_pathname_application_path(char *s, size_t len)
#endif

#ifdef HAVE_XMB
const char *xmb_theme_ident(void);
const char* xmb_theme_ident(void);
#endif

void fill_pathname_application_special(char *s, size_t len, enum application_special_type type)
Expand Down
4 changes: 2 additions & 2 deletions frontend/drivers/platform_win32.c
Original file line number Diff line number Diff line change
Expand Up @@ -328,7 +328,7 @@ static uint64_t frontend_win32_get_mem_used(void)
static void frontend_win32_attach_console(void)
{
#ifdef _WIN32
#if(_WIN32_WINNT >= 0x0500)
#ifdef _WIN32_WINNT_WINXP
if (!AttachConsole(ATTACH_PARENT_PROCESS))
{
AllocConsole();
Expand All @@ -343,7 +343,7 @@ static void frontend_win32_attach_console(void)
static void frontend_win32_detach_console(void)
{
#if defined(_WIN32) && !defined(_XBOX)
#if(_WIN32_WINNT >= 0x0500)
#ifdef _WIN32_WINNT_WINXP
if (!AttachConsole(ATTACH_PARENT_PROCESS))
{
HWND wnd = GetConsoleWindow();
Expand Down
5 changes: 5 additions & 0 deletions gfx/common/win32_common.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,9 @@ typedef enum _POWER_REQUEST_TYPE
#define POWER_REQUEST_CONTEXT_DETAILED_STRING 2
#endif

#ifdef _WIN32_WINNT_WIN7
typedef REASON_CONTEXT POWER_REQUEST_CONTEXT, *PPOWER_REQUEST_CONTEXT, *LPPOWER_REQUEST_CONTEXT;
#endif

#ifndef MAX_MONITORS
#define MAX_MONITORS 9
Expand Down Expand Up @@ -585,6 +587,7 @@ LRESULT CALLBACK WndProcGDI(HWND hwnd, UINT message,
#endif
return DefWindowProc(hwnd, message, wparam, lparam);
}
#endif

bool win32_window_create(void *data, unsigned style,
RECT *mon_rect, unsigned width,
Expand Down Expand Up @@ -724,6 +727,7 @@ bool win32_suppress_screensaver(void *data, bool enable)

if (major*100+minor >= 601)
{
#ifdef _WIN32_WINNT_WIN7
/* Windows 7, 8, 10 codepath */
typedef HANDLE (WINAPI * PowerCreateRequestPtr)(REASON_CONTEXT *context);
typedef BOOL (WINAPI * PowerSetRequestPtr)(HANDLE PowerRequest,
Expand All @@ -748,6 +752,7 @@ bool win32_suppress_screensaver(void *data, bool enable)
powerSetRequest( Request, PowerRequestDisplayRequired);
return true;
}
#endif
}
else
{
Expand Down
8 changes: 4 additions & 4 deletions gfx/drivers/d3d.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -259,18 +259,18 @@ static bool d3d_init_multipass(d3d_video_t *d3d)
}

memset(&d3d->shader, 0, sizeof(d3d->shader));

#ifdef HAVE_SHADERPIPELINE
if (!video_shader_read_conf_cgp(conf, &d3d->shader))
{
config_file_free(conf);
RARCH_ERR("Failed to parse CGP file.\n");
return false;
}

#endif
config_file_free(conf);

#ifdef HAVE_SHADERPIPELINE
video_shader_resolve_relative(&d3d->shader, d3d->shader_path.c_str());

#endif
RARCH_LOG("[D3D9 Meta-Cg] Found %u shaders.\n", d3d->shader.passes);

for (i = 0; i < d3d->shader.passes; i++)
Expand Down
2 changes: 1 addition & 1 deletion gfx/drivers_font/d3d_w32_font.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ static void *d3dfonts_w32_init_font(void *video_data,
OUT_TT_PRECIS,
CLIP_DEFAULT_PRECIS,
DEFAULT_PITCH,
#ifdef _MSC_VER /* MSVC needs w_char* */
#if defined(_MSC_VER) && _WIN32_WINNT > 0x0500 /* MSVC needs w_char* starting with XP */
L"Verdana" /* Hardcode FTL */
#else
"Verdana"
Expand Down
2 changes: 1 addition & 1 deletion griffin/griffin.c
Original file line number Diff line number Diff line change
Expand Up @@ -1011,7 +1011,7 @@ MENU
#include "../menu/drivers/rgui.c"
#endif

#if defined(HAVE_OPENGL) || defined(HAVE_VITA2D) || defined(_3DS)
#if defined(HAVE_OPENGL) || defined(HAVE_VITA2D) || defined(_3DS) || defined(_MSC_VER)
#ifdef HAVE_XMB
#include "../menu/drivers/xmb.c"
#endif
Expand Down
1 change: 1 addition & 0 deletions intl/msg_hash_chs.c
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
#if defined(_MSC_VER) && !defined(_XBOX)
/* https://support.microsoft.com/en-us/kb/980263 */
#pragma execution_character_set("utf-8")
#pragma warning( disable : 4566 )
#endif

int menu_hash_get_help_chs_enum(enum msg_hash_enums msg, char *s, size_t len)
Expand Down
1 change: 1 addition & 0 deletions intl/msg_hash_pl.c
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
#if defined(_MSC_VER) && !defined(_XBOX)
/* https://support.microsoft.com/en-us/kb/980263 */
#pragma execution_character_set("utf-8")
#pragma warning( disable: 4566 )
#endif

int menu_hash_get_help_pl_enum(enum msg_hash_enums msg, char *s, size_t len)
Expand Down
8 changes: 4 additions & 4 deletions libretro-common/net/net_ifinfo.c
Original file line number Diff line number Diff line change
Expand Up @@ -71,10 +71,10 @@ bool net_ifinfo_new(net_ifinfo_t *list)
{
unsigned k = 0;
#if defined(_WIN32) && !defined(_XBOX)
PIP_ADAPTER_ADDRESSES adapter_addresses = NULL, aa = NULL;
PIP_ADAPTER_UNICAST_ADDRESS ua = NULL;
#ifdef _WIN32_WINNT_WINXP
DWORD size;
PIP_ADAPTER_ADDRESSES adapter_addresses, aa;
PIP_ADAPTER_UNICAST_ADDRESS ua;

DWORD rv = GetAdaptersAddresses(AF_UNSPEC, GAA_FLAG_INCLUDE_PREFIX, NULL, NULL, &size);

adapter_addresses = (PIP_ADAPTER_ADDRESSES)malloc(size);
Expand All @@ -85,7 +85,7 @@ bool net_ifinfo_new(net_ifinfo_t *list)

if (rv != ERROR_SUCCESS)
goto error;

#endif
for (aa = adapter_addresses; aa != NULL; aa = aa->Next)
{
char name[PATH_MAX_LENGTH];
Expand Down
3 changes: 3 additions & 0 deletions libretro-common/rthreads/rthreads.c
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,9 @@
#include <xtl.h>
#else
#define WIN32_LEAN_AND_MEAN
#ifndef _WIN32_WINNT
#define _WIN32_WINNT 0x0500 /*_WIN32_WINNT_WIN2K */
#endif
#include <windows.h>
#endif
#elif defined(GEKKO)
Expand Down
2 changes: 1 addition & 1 deletion menu/drivers/xmb.c
Original file line number Diff line number Diff line change
Expand Up @@ -376,7 +376,7 @@ float gradient_dark[16] = {
0.0, 0.0, 0.0, 1.00,
};

const char *xmb_theme_ident(void)
const char* xmb_theme_ident(void)
{
settings_t *settings = config_get_ptr();
switch (settings->menu.xmb.theme)
Expand Down
3 changes: 2 additions & 1 deletion ui/drivers/ui_win32.c
Original file line number Diff line number Diff line change
Expand Up @@ -224,6 +224,7 @@ static void shader_dlg_params_clear(void)

void shader_dlg_params_reload(void)
{
#ifdef HAVE_SHADERPIPELINE
HFONT hFont;
RECT parent_rect;
int i, pos_x, pos_y;
Expand Down Expand Up @@ -325,7 +326,7 @@ void shader_dlg_params_reload(void)
(pos_x - SHADER_DLG_CTRL_X) + SHADER_DLG_WIDTH,
(pos_x == SHADER_DLG_CTRL_X) ? pos_y + 30 : SHADER_DLG_MAX_HEIGHT,
SWP_NOMOVE | SWP_NOZORDER | SWP_NOACTIVATE);

#endif
}

static void shader_dlg_update_on_top_state(void)
Expand Down

0 comments on commit e1f4db8

Please sign in to comment.