Don't attempt to use std::string anymore in gfx/d3d/d3d.cpp

This commit is contained in:
twinaphex 2016-01-09 03:00:33 +01:00
parent 26e59c2037
commit f76b7f2b60
2 changed files with 13 additions and 12 deletions

View File

@ -1084,7 +1084,7 @@ static bool d3d_init_multipass(d3d_video_t *d3d)
unsigned i;
bool use_extra_pass;
video_shader_pass *pass = NULL;
config_file_t *conf = config_file_new(d3d->shader_path.c_str());
config_file_t *conf = config_file_new(d3d->shader_path);
if (!conf)
{
@ -1103,7 +1103,7 @@ static bool d3d_init_multipass(d3d_video_t *d3d)
config_file_free(conf);
video_shader_resolve_relative(&d3d->shader, d3d->shader_path.c_str());
video_shader_resolve_relative(&d3d->shader, d3d->shader_path);
RARCH_LOG("[D3D9 Meta-Cg] Found %u shaders.\n", d3d->shader.passes);
@ -1162,7 +1162,7 @@ static bool d3d_init_singlepass(d3d_video_t *d3d)
pass->fbo.type_y = RARCH_SCALE_VIEWPORT;
pass->fbo.scale_x = pass->fbo.scale_y;
pass->fbo.type_x = pass->fbo.type_y;
strlcpy(pass->source.path, d3d->shader_path.c_str(),
strlcpy(pass->source.path, d3d->shader_path,
sizeof(pass->source.path));
#endif
@ -1172,8 +1172,7 @@ static bool d3d_init_singlepass(d3d_video_t *d3d)
static bool d3d_process_shader(d3d_video_t *d3d)
{
#ifdef HAVE_FBO
if (strcmp(path_get_extension(
d3d->shader_path.c_str()), "cgp") == 0)
if (strcmp(path_get_extension(d3d->shader_path), "cgp") == 0)
return d3d_init_multipass(d3d);
#endif
@ -1598,13 +1597,14 @@ static bool d3d_set_shader(void *data,
{
bool restore_old = false;
d3d_video_t *d3d = (d3d_video_t*)data;
std::string shader = "";
char old_shader[PATH_MAX_LENGTH];
char shader[PATH_MAX_LENGTH];
switch (type)
{
case RARCH_SHADER_CG:
if (path)
shader = path;
strlcpy(shader, path, sizeof(shader));
#ifdef HAVE_HLSL
d3d->shader = &hlsl_backend;
#endif
@ -1613,8 +1613,8 @@ static bool d3d_set_shader(void *data,
break;
}
std::string old_shader = d3d->shader_path;
d3d->shader_path = shader;
strlcpy(old_shader, d3d->shader_path, sizeof(old_shader));
strlcpy(d3d->shader_path, shader, sizeof(d3d->shader_path));
if (!d3d_process_shader(d3d) || !d3d_restore(d3d))
{
@ -1624,7 +1624,7 @@ static bool d3d_set_shader(void *data,
if (restore_old)
{
d3d->shader_path = old_shader;
strlcpy(d3d->shader_path, old_shader, sizeof(d3d->shader_path));
d3d_process_shader(d3d);
d3d_restore(d3d);
}

View File

@ -17,9 +17,10 @@
#ifndef __D3DVIDEO_INTF_H__
#define __D3DVIDEO_INTF_H__
#include <string>
#include <vector>
#include <retro_miscellaneous.h>
#ifdef HAVE_CONFIG_H
#include "../../config.h"
#endif
@ -99,7 +100,7 @@ typedef struct d3d_video
unsigned dev_rotation;
D3DVIEWPORT final_viewport;
std::string shader_path;
char shader_path[PATH_MAX_LENGTH];
struct video_shader shader;
video_info_t video_info;