Fix "Core" to build with "Unicode".

This commit is contained in:
Jordan Woyak 2013-02-27 20:27:22 -06:00
parent 536c110b31
commit 6f87611767
8 changed files with 41 additions and 48 deletions

View File

@ -44,7 +44,7 @@
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
<UseDebugLibraries>false</UseDebugLibraries>
<ConfigurationType>StaticLibrary</ConfigurationType>
<CharacterSet>MultiByte</CharacterSet>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='DebugFast|Win32'" Label="Configuration">
<ConfigurationType>StaticLibrary</ConfigurationType>
@ -54,7 +54,7 @@
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
<UseDebugLibraries>false</UseDebugLibraries>
<ConfigurationType>StaticLibrary</ConfigurationType>
<CharacterSet>MultiByte</CharacterSet>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='DebugFast|x64'" Label="Configuration">
<ConfigurationType>StaticLibrary</ConfigurationType>

View File

@ -137,7 +137,7 @@ void SConfig::SaveSettings()
ini.Get("General", "GCMPathes", &oldPaths, 0);
for (int i = numPaths; i < oldPaths; i++)
{
TCHAR tmp[16];
char tmp[16];
sprintf(tmp, "GCMPath%i", i);
ini.DeleteKey("General", tmp);
}
@ -146,7 +146,7 @@ void SConfig::SaveSettings()
for (int i = 0; i < numPaths; i++)
{
TCHAR tmp[16];
char tmp[16];
sprintf(tmp, "GCMPath%i", i);
ini.Set("General", tmp, m_ISOFolder[i]);
}
@ -284,7 +284,7 @@ void SConfig::LoadSettings()
{
for (int i = 0; i < numGCMPaths; i++)
{
TCHAR tmp[16];
char tmp[16];
sprintf(tmp, "GCMPath%i", i);
std::string tmpPath;
ini.Get("General", tmp, &tmpPath, "");

View File

@ -98,8 +98,8 @@ void Console_Submit(const char *cmd)
}
CASE("dump")
{
TCHAR temp[256];
TCHAR filename[256];
char temp[256];
char filename[256];
u32 start;
u32 end;
sscanf(cmd, "%s %08x %08x %s", temp, &start, &end, filename);

View File

@ -25,7 +25,7 @@
namespace Win32TAPHelper
{
bool IsTAPDevice(const char *guid)
bool IsTAPDevice(const TCHAR *guid)
{
HKEY netcard_key;
LONG status;
@ -39,13 +39,13 @@ bool IsTAPDevice(const char *guid)
for (;;)
{
char enum_name[256];
char unit_string[256];
TCHAR enum_name[256];
TCHAR unit_string[256];
HKEY unit_key;
char component_id_string[] = "ComponentId";
char component_id[256];
char net_cfg_instance_id_string[] = "NetCfgInstanceId";
char net_cfg_instance_id[256];
TCHAR component_id_string[] = _T("ComponentId");
TCHAR component_id[256];
TCHAR net_cfg_instance_id_string[] = _T("NetCfgInstanceId");
TCHAR net_cfg_instance_id[256];
DWORD data_type;
len = sizeof(enum_name);
@ -56,7 +56,7 @@ bool IsTAPDevice(const char *guid)
else if (status != ERROR_SUCCESS)
return false;
snprintf(unit_string, sizeof(unit_string), "%s\\%s", ADAPTER_KEY, enum_name);
_sntprintf(unit_string, sizeof(unit_string), _T("%s\\%s"), ADAPTER_KEY, enum_name);
status = RegOpenKeyEx(HKEY_LOCAL_MACHINE, unit_string, 0, KEY_READ, &unit_key);
@ -78,8 +78,8 @@ bool IsTAPDevice(const char *guid)
if (status == ERROR_SUCCESS && data_type == REG_SZ)
{
if (!strcmp(component_id, TAP_COMPONENT_ID) &&
!strcmp(net_cfg_instance_id, guid))
if (!_tcscmp(component_id, TAP_COMPONENT_ID) &&
!_tcscmp(net_cfg_instance_id, guid))
{
RegCloseKey(unit_key);
RegCloseKey(netcard_key);
@ -96,7 +96,7 @@ bool IsTAPDevice(const char *guid)
return false;
}
bool GetGUIDs(std::vector<std::string>& guids)
bool GetGUIDs(std::vector<std::basic_string<TCHAR>>& guids)
{
LONG status;
HKEY control_net_key;
@ -111,12 +111,12 @@ bool GetGUIDs(std::vector<std::string>& guids)
while (!found_all)
{
char enum_name[256];
char connection_string[256];
TCHAR enum_name[256];
TCHAR connection_string[256];
HKEY connection_key;
char name_data[256];
TCHAR name_data[256];
DWORD name_type;
const char name_string[] = "Name";
const TCHAR name_string[] = _T("Name");
len = sizeof(enum_name);
status = RegEnumKeyEx(control_net_key, i, enum_name,
@ -127,8 +127,8 @@ bool GetGUIDs(std::vector<std::string>& guids)
else if (status != ERROR_SUCCESS)
return false;
snprintf(connection_string, sizeof(connection_string),
"%s\\%s\\Connection", NETWORK_CONNECTIONS_KEY, enum_name);
_sntprintf(connection_string, sizeof(connection_string),
_T("%s\\%s\\Connection"), NETWORK_CONNECTIONS_KEY, enum_name);
status = RegOpenKeyEx(HKEY_LOCAL_MACHINE, connection_string,
0, KEY_READ, &connection_key);
@ -165,15 +165,11 @@ bool GetGUIDs(std::vector<std::string>& guids)
return true;
}
bool OpenTAP(HANDLE& adapter, const std::string device_guid)
bool OpenTAP(HANDLE& adapter, const std::basic_string<TCHAR>& device_guid)
{
char device_path[256];
auto const device_path = USERMODEDEVICEDIR + device_guid + TAPSUFFIX;
/* Open Windows TAP-Win32 adapter */
snprintf(device_path, sizeof(device_path), "%s%s%s",
USERMODEDEVICEDIR, device_guid.c_str(), TAPSUFFIX);
adapter = CreateFile(device_path, GENERIC_READ | GENERIC_WRITE, 0, 0,
adapter = CreateFile(device_path.c_str(), GENERIC_READ | GENERIC_WRITE, 0, 0,
OPEN_EXISTING, FILE_ATTRIBUTE_SYSTEM | FILE_FLAG_OVERLAPPED, 0);
if (adapter == INVALID_HANDLE_VALUE)
@ -192,7 +188,7 @@ bool CEXIETHERNET::Activate()
return true;
DWORD len;
std::vector<std::string> device_guids;
std::vector<std::basic_string<TCHAR>> device_guids;
if (!Win32TAPHelper::GetGUIDs(device_guids))
{

View File

@ -65,18 +65,18 @@
// Registry keys
//=================
#define ADAPTER_KEY "SYSTEM\\CurrentControlSet\\Control\\Class\\{4D36E972-E325-11CE-BFC1-08002BE10318}"
#define ADAPTER_KEY _T("SYSTEM\\CurrentControlSet\\Control\\Class\\{4D36E972-E325-11CE-BFC1-08002BE10318}")
#define NETWORK_CONNECTIONS_KEY "SYSTEM\\CurrentControlSet\\Control\\Network\\{4D36E972-E325-11CE-BFC1-08002BE10318}"
#define NETWORK_CONNECTIONS_KEY _T("SYSTEM\\CurrentControlSet\\Control\\Network\\{4D36E972-E325-11CE-BFC1-08002BE10318}")
//======================
// Filesystem prefixes
//======================
#define USERMODEDEVICEDIR "\\\\.\\Global\\"
#define SYSDEVICEDIR "\\Device\\"
#define USERDEVICEDIR "\\DosDevices\\Global\\"
#define TAPSUFFIX ".tap"
#define USERMODEDEVICEDIR _T("\\\\.\\Global\\")
#define SYSDEVICEDIR _T("\\Device\\")
#define USERDEVICEDIR _T("\\DosDevices\\Global\\")
#define TAPSUFFIX _T(".tap")
//=========================================================
// TAP_COMPONENT_ID -- This string defines the TAP driver
@ -84,4 +84,4 @@
// simultaneously.
//=========================================================
#define TAP_COMPONENT_ID "tap0901"
#define TAP_COMPONENT_ID _T("tap0901")

View File

@ -17,7 +17,6 @@
#include <stdio.h>
#include <stdlib.h>
#include <regex>
#include <algorithm>
#include <unordered_map>
#include <ctime>
@ -464,9 +463,6 @@ int Wiimote::IOWrite(const u8* buf, int len)
template <typename T>
void ProcessWiimotes(bool new_scan, T& callback)
{
// match strings like "Nintendo RVL-WBC-01", "Nintendo RVL-CNT-01", "Nintendo RVL-CNT-01-TR"
const std::wregex wiimote_device_name(L"Nintendo RVL-.*");
BLUETOOTH_DEVICE_SEARCH_PARAMS srch;
srch.dwSize = sizeof(srch);
srch.fReturnAuthenticated = true;
@ -509,7 +505,7 @@ void ProcessWiimotes(bool new_scan, T& callback)
DEBUG_LOG(WIIMOTE, "authed %i connected %i remembered %i ",
btdi.fAuthenticated, btdi.fConnected, btdi.fRemembered);
if (std::regex_match(btdi.szName, wiimote_device_name))
if (IsValidBluetoothName(UTF16ToUTF8(btdi.szName)))
{
callback(hRadio, radioInfo, btdi);
}

View File

@ -91,7 +91,7 @@ public:
int int_sock; // Interrupt socket
#elif defined(_WIN32)
std::string devicepath; // Unique wiimote reference
std::basic_string<TCHAR> devicepath; // Unique wiimote reference
//ULONGLONG btaddr; // Bluetooth address
HANDLE dev_handle; // HID handle
OVERLAPPED hid_overlap_read, hid_overlap_write; // Overlap handle

View File

@ -58,6 +58,7 @@
#include "CommonPaths.h"
#include "IPC_HLE/WII_IPC_HLE_Device_usb.h"
#include "../Movie.h"
#include "StringUtil.h"
#ifdef _WIN32
#include <Windows.h>
@ -926,7 +927,7 @@ u32 CWII_IPC_HLE_Device_es::ES_DIVerify(u8* _pTMD, u32 _sz)
else
{
#ifdef _WIN32
MoveFile(savePath.c_str(), (savePath + "../backup/").c_str());
MoveFile(UTF8ToTStr(savePath).c_str(), UTF8ToTStr(savePath + "../backup/").c_str());
#else
File::CopyDir(savePath.c_str(),(savePath + "../backup/").c_str());
File::DeleteDirRecursively(savePath.c_str());
@ -940,7 +941,7 @@ u32 CWII_IPC_HLE_Device_es::ES_DIVerify(u8* _pTMD, u32 _sz)
if (File::Exists((savePath + "banner.bin").c_str()))
File::DeleteDirRecursively(savePath);
#ifdef _WIN32
MoveFile((savePath + "../backup/").c_str(), savePath.c_str());
MoveFile(UTF8ToTStr(savePath + "../backup/").c_str(), UTF8ToTStr(savePath).c_str());
#else
File::CopyDir((savePath + "../backup/").c_str(), savePath.c_str());
File::DeleteDirRecursively((savePath + "../backup/").c_str());