forked from metin-server/m2dev-client-src
Full Unicode patch with RTL Support & BiDi logic.
This commit is well documented, so no need to tell you my life story. Full Unicode patch with RTL Support & BiDi logic. Removed the legacy codePage, normalised to UTF8 (65001). It also comes with: CTRL + A : select text (highlighted) CTRL + C : copy CTRL + V : paste CTRL + X : cut CTRL + Y : redo CTRL + Z : undo
This commit is contained in:
@@ -3,6 +3,8 @@
|
||||
#include "GrpD3DXBuffer.h"
|
||||
#include "StateManager.h"
|
||||
|
||||
#include <utf8.h>
|
||||
|
||||
CVertexShader::CVertexShader()
|
||||
{
|
||||
Initialize();
|
||||
@@ -29,21 +31,44 @@ void CVertexShader::Destroy()
|
||||
|
||||
bool CVertexShader::CreateFromDiskFile(const char* c_szFileName, const DWORD* c_pdwVertexDecl)
|
||||
{
|
||||
Destroy();
|
||||
Destroy();
|
||||
|
||||
LPD3DXBUFFER lpd3dxShaderBuffer;
|
||||
LPD3DXBUFFER lpd3dxErrorBuffer;
|
||||
|
||||
if (FAILED(
|
||||
D3DXAssembleShaderFromFile(c_szFileName, 0, NULL, 0, &lpd3dxShaderBuffer, &lpd3dxErrorBuffer)
|
||||
)) return false;
|
||||
if (!c_szFileName || !*c_szFileName)
|
||||
return false;
|
||||
|
||||
if (FAILED(
|
||||
ms_lpd3dDevice->CreateVertexShader((const DWORD*)lpd3dxShaderBuffer->GetBufferPointer(), &m_handle)
|
||||
))
|
||||
return false;
|
||||
// UTF-8 → UTF-16 for D3DX
|
||||
std::wstring wFileName = Utf8ToWide(c_szFileName);
|
||||
|
||||
return true;
|
||||
LPD3DXBUFFER lpd3dxShaderBuffer = nullptr;
|
||||
LPD3DXBUFFER lpd3dxErrorBuffer = nullptr;
|
||||
|
||||
HRESULT hr = D3DXAssembleShaderFromFileW(
|
||||
wFileName.c_str(),
|
||||
nullptr,
|
||||
nullptr,
|
||||
0,
|
||||
&lpd3dxShaderBuffer,
|
||||
&lpd3dxErrorBuffer
|
||||
);
|
||||
|
||||
if (FAILED(hr))
|
||||
{
|
||||
if (lpd3dxErrorBuffer)
|
||||
{
|
||||
const char* err = (const char*)lpd3dxErrorBuffer->GetBufferPointer();
|
||||
TraceError("Vertex shader compile error: %s", err);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
if (FAILED(
|
||||
ms_lpd3dDevice->CreateVertexShader(
|
||||
(const DWORD*)lpd3dxShaderBuffer->GetBufferPointer(),
|
||||
&m_handle
|
||||
)))
|
||||
return false;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
void CVertexShader::Set()
|
||||
|
||||
Reference in New Issue
Block a user