mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-07-23 22:29:39 -06:00
Kill off some usages of c_str.
Also changes some function params, but this is ok. Some simplifications were also able to be made (ie. killing off strcmps with ==, etc).
This commit is contained in:
@ -2,7 +2,9 @@
|
||||
// Licensed under GPLv2
|
||||
// Refer to the license.txt file included.
|
||||
|
||||
#include <cctype>
|
||||
#include <list>
|
||||
#include <string>
|
||||
|
||||
#include "VideoBackends/D3D/D3DBase.h"
|
||||
#include "VideoBackends/D3D/D3DShader.h"
|
||||
@ -316,7 +318,7 @@ int CD3DFont::Shutdown()
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
int CD3DFont::DrawTextScaled(float x, float y, float size, float spacing, u32 dwColor, const char* strText)
|
||||
int CD3DFont::DrawTextScaled(float x, float y, float size, float spacing, u32 dwColor, const std::string& text)
|
||||
{
|
||||
if (!m_pVB)
|
||||
return 0;
|
||||
@ -331,7 +333,6 @@ int CD3DFont::DrawTextScaled(float x, float y, float size, float spacing, u32 dw
|
||||
// translate starting positions
|
||||
float sx = x * scalex - 1.f;
|
||||
float sy = 1.f - y * scaley;
|
||||
char c;
|
||||
|
||||
// Fill vertex buffer
|
||||
FONT2DVERTEX* pVertices;
|
||||
@ -355,14 +356,14 @@ int CD3DFont::DrawTextScaled(float x, float y, float size, float spacing, u32 dw
|
||||
D3D::context->PSSetShaderResources(0, 1, &m_pTexture);
|
||||
|
||||
float fStartX = sx;
|
||||
while (c = *strText++)
|
||||
for (char c : text)
|
||||
{
|
||||
if (c == ('\n'))
|
||||
if (c == '\n')
|
||||
{
|
||||
sx = fStartX;
|
||||
sy -= scaley * size;
|
||||
}
|
||||
if (c < (' '))
|
||||
if (!std::isprint(c))
|
||||
continue;
|
||||
|
||||
c -= 32;
|
||||
|
@ -5,6 +5,7 @@
|
||||
#pragma once
|
||||
|
||||
#include <d3d11.h>
|
||||
#include <string>
|
||||
|
||||
#include "Common/MathUtil.h"
|
||||
|
||||
@ -41,9 +42,9 @@ namespace D3D
|
||||
int Init();
|
||||
int Shutdown();
|
||||
int DrawTextScaled(float x, float y,
|
||||
float size,
|
||||
float spacing, u32 dwColor,
|
||||
const char* strText);
|
||||
float size,
|
||||
float spacing, u32 dwColor,
|
||||
const std::string& text);
|
||||
};
|
||||
|
||||
extern CD3DFont font;
|
||||
|
@ -391,7 +391,7 @@ void PixelShaderCache::Init()
|
||||
Clear();
|
||||
|
||||
if (!File::Exists(File::GetUserPath(D_SHADERCACHE_IDX)))
|
||||
File::CreateDir(File::GetUserPath(D_SHADERCACHE_IDX).c_str());
|
||||
File::CreateDir(File::GetUserPath(D_SHADERCACHE_IDX));
|
||||
|
||||
SETSTAT(stats.numPixelShadersCreated, 0);
|
||||
SETSTAT(stats.numPixelShadersAlive, 0);
|
||||
|
@ -255,7 +255,7 @@ Renderer::~Renderer()
|
||||
D3D::Close();
|
||||
}
|
||||
|
||||
void Renderer::RenderText(const char *text, int left, int top, u32 color)
|
||||
void Renderer::RenderText(const std::string& text, int left, int top, u32 color)
|
||||
{
|
||||
D3D::font.DrawTextScaled((float)left, (float)top, 20.f, 0.0f, color, text);
|
||||
}
|
||||
|
@ -1,5 +1,6 @@
|
||||
#pragma once
|
||||
|
||||
#include <string>
|
||||
#include "VideoCommon/RenderBase.h"
|
||||
|
||||
namespace DX11
|
||||
@ -30,7 +31,7 @@ public:
|
||||
void ApplyCullDisable();
|
||||
void RestoreCull();
|
||||
|
||||
void RenderText(const char* pstr, int left, int top, u32 color);
|
||||
void RenderText(const std::string& text, int left, int top, u32 color);
|
||||
|
||||
u32 AccessEFB(EFBAccessType type, u32 x, u32 y, u32 poke_data);
|
||||
|
||||
|
@ -138,7 +138,7 @@ void VertexShaderCache::Init()
|
||||
Clear();
|
||||
|
||||
if (!File::Exists(File::GetUserPath(D_SHADERCACHE_IDX)))
|
||||
File::CreateDir(File::GetUserPath(D_SHADERCACHE_IDX).c_str());
|
||||
File::CreateDir(File::GetUserPath(D_SHADERCACHE_IDX));
|
||||
|
||||
SETSTAT(stats.numVertexShadersCreated, 0);
|
||||
SETSTAT(stats.numVertexShadersAlive, 0);
|
||||
|
@ -1,5 +1,6 @@
|
||||
#pragma once
|
||||
|
||||
#include <string>
|
||||
#include "VideoCommon/VideoBackendBase.h"
|
||||
|
||||
namespace DX11
|
||||
@ -18,7 +19,7 @@ class VideoBackend : public VideoBackendHardware
|
||||
|
||||
void ShowConfig(void* parent);
|
||||
|
||||
void UpdateFPSDisplay(const char*);
|
||||
void UpdateFPSDisplay(const std::string&);
|
||||
unsigned int PeekMessages();
|
||||
};
|
||||
|
||||
|
@ -2,11 +2,13 @@
|
||||
// Licensed under GPLv2
|
||||
// Refer to the license.txt file included.
|
||||
|
||||
#include <string>
|
||||
#include <wx/wx.h>
|
||||
|
||||
#include "Common/FileUtil.h"
|
||||
#include "Common/IniFile.h"
|
||||
#include "Common/LogManager.h"
|
||||
#include "Common/StringUtil.h"
|
||||
|
||||
#include "Core/ConfigManager.h"
|
||||
#include "Core/Core.h"
|
||||
@ -54,11 +56,9 @@ unsigned int VideoBackend::PeekMessages()
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
void VideoBackend::UpdateFPSDisplay(const char *text)
|
||||
void VideoBackend::UpdateFPSDisplay(const std::string& text)
|
||||
{
|
||||
TCHAR temp[512];
|
||||
swprintf_s(temp, sizeof(temp)/sizeof(TCHAR), _T("%hs | D3D | %hs"), scm_rev_str, text);
|
||||
EmuWindow::SetWindowText(temp);
|
||||
EmuWindow::SetWindowText(StringFromFormat("%s | D3D | %s", scm_rev_str, text.c_str()));
|
||||
}
|
||||
|
||||
std::string VideoBackend::GetName()
|
||||
@ -154,7 +154,7 @@ bool VideoBackend::Initialize(void *&window_handle)
|
||||
|
||||
frameCount = 0;
|
||||
|
||||
g_Config.Load((File::GetUserPath(D_CONFIG_IDX) + "gfx_dx11.ini").c_str());
|
||||
g_Config.Load(File::GetUserPath(D_CONFIG_IDX) + "gfx_dx11.ini");
|
||||
g_Config.GameIniLoad();
|
||||
g_Config.UpdateProjectionHack();
|
||||
g_Config.VerifyValidity();
|
||||
|
Reference in New Issue
Block a user