Skip to content

Commit

Permalink
current state of unicode conversion
Browse files Browse the repository at this point in the history
This will be a big step forward, when it's done.
Unfortunately, it's not finished yet. 8 little compiler errors are left :)
After fixing that, it needs some testing to find potential new issues... I'm not sure if these changes are all correct, especially when reading bmd files with strings.

Sending the packets need to be adapted as well to the new send functions, to make it work properly, of course.
  • Loading branch information
sven-n committed Sep 26, 2023
1 parent e8413ab commit 9bc4ebd
Show file tree
Hide file tree
Showing 416 changed files with 12,306 additions and 12,865 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,9 @@ https://go.microsoft.com/fwlink/?LinkID=208121.
<SelfContained>false</SelfContained>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)'=='Release'">
<PublishDir>$(SolutionDir)..\Source Main 5.2\Global Release</PublishDir>
<PublishDir>..\Source Main 5.2\Global Debug</PublishDir>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)'=='Debug'">
<PublishDir>$(SolutionDir)..\Source Main 5.2\Global Debug</PublishDir>
<PublishDir>$(SolutionDir)..\Source Main 5.2\Global Debug</PublishDir>
</PropertyGroup>
</Project>
8 changes: 1 addition & 7 deletions Source Main 5.2/Main.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@
<ClCompile>
<Optimization>Disabled</Optimization>
<AdditionalIncludeDirectories>$(SolutionDir)source\;$(SolutionDir)dependencies\include;$(SolutionDir)dependencies\netcore\includes</AdditionalIncludeDirectories>
<PreprocessorDefinitions>WIN32;_DEBUG;_WINDOWS;_FOREIGN_DEBUG;_LANGUAGE_FOREIGN;_LANGUAGE_ENG;_ALLOW_RTCc_IN_STL;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<PreprocessorDefinitions>WIN32;_DEBUG;_WINDOWS;_FOREIGN_DEBUG;_LANGUAGE_FOREIGN;_LANGUAGE_ENG;UNICODE;_ALLOW_RTCc_IN_STL;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<StringPooling>true</StringPooling>
<MinimalRebuild>false</MinimalRebuild>
<ExceptionHandling>Async</ExceptionHandling>
Expand Down Expand Up @@ -430,8 +430,6 @@ xcopy /s /r /y /q "$(SolutionDir)dependencies\netcore\Native.NETHostFxr.runtime
<ClCompile Include="source\ExternalObject\Leaf\callstackdmp.cpp" />
<ClCompile Include="source\ExternalObject\Leaf\checkintegrity.cpp" />
<ClCompile Include="source\ExternalObject\Leaf\ExceptionHandler.cpp" />
<ClCompile Include="source\ExternalObject\Leaf\html_log.cpp" />
<ClCompile Include="source\ExternalObject\Leaf\peimage.cpp" />
<ClCompile Include="source\ExternalObject\Leaf\stdleaf.cpp" />
<ClCompile Include="source\ExternalObject\Leaf\sysinfo.cpp" />
<ClCompile Include="source\ExternalObject\Leaf\xortrans.cpp" />
Expand Down Expand Up @@ -677,7 +675,6 @@ xcopy /s /r /y /q "$(SolutionDir)dependencies\netcore\Native.NETHostFxr.runtime
<ClCompile Include="source\UISenatus.cpp" />
<ClCompile Include="source\UIWindows.cpp" />
<ClCompile Include="source\UsefulDef.cpp" />
<ClCompile Include="source\Utilities\Log\DebugAngel.cpp" />
<ClCompile Include="source\Utilities\Log\ErrorReport.cpp" />
<ClCompile Include="source\Utilities\Log\muConsoleDebug.cpp" />
<ClCompile Include="source\Utilities\Log\WindowsConsole.cpp" />
Expand Down Expand Up @@ -823,8 +820,6 @@ xcopy /s /r /y /q "$(SolutionDir)dependencies\netcore\Native.NETHostFxr.runtime
<ClInclude Include="source\ExternalObject\Leaf\callstackdmp.h" />
<ClInclude Include="source\ExternalObject\Leaf\checkintegrity.h" />
<ClInclude Include="source\ExternalObject\Leaf\ExceptionHandler.h" />
<ClInclude Include="source\ExternalObject\Leaf\html_log.h" />
<ClInclude Include="source\ExternalObject\Leaf\peimage.h" />
<ClInclude Include="source\ExternalObject\Leaf\rdtsc.h" />
<ClInclude Include="source\ExternalObject\Leaf\regkey.h" />
<ClInclude Include="source\ExternalObject\Leaf\stdleaf.h" />
Expand Down Expand Up @@ -1085,7 +1080,6 @@ xcopy /s /r /y /q "$(SolutionDir)dependencies\netcore\Native.NETHostFxr.runtime
<ClInclude Include="source\UISenatus.h" />
<ClInclude Include="source\UIWindows.h" />
<ClInclude Include="source\UsefulDef.h" />
<ClInclude Include="source\Utilities\Log\DebugAngel.h" />
<ClInclude Include="source\Utilities\Log\ErrorReport.h" />
<ClInclude Include="source\Utilities\Log\muConsoleDebug.h" />
<ClInclude Include="source\Utilities\Log\WindowsConsole.h" />
Expand Down
18 changes: 0 additions & 18 deletions Source Main 5.2/Main.vcxproj.filters
Original file line number Diff line number Diff line change
Expand Up @@ -988,9 +988,6 @@
<ClCompile Include="source\Time\Timer.cpp">
<Filter>External Object\time</Filter>
</ClCompile>
<ClCompile Include="source\Utilities\Log\DebugAngel.cpp">
<Filter>Utilities\log</Filter>
</ClCompile>
<ClCompile Include="source\Utilities\Log\ErrorReport.cpp">
<Filter>Utilities\log</Filter>
</ClCompile>
Expand Down Expand Up @@ -1156,12 +1153,6 @@
<ClCompile Include="source\ExternalObject\Leaf\ExceptionHandler.cpp">
<Filter>External Object\Leaf</Filter>
</ClCompile>
<ClCompile Include="source\ExternalObject\Leaf\html_log.cpp">
<Filter>External Object\Leaf</Filter>
</ClCompile>
<ClCompile Include="source\ExternalObject\Leaf\peimage.cpp">
<Filter>External Object\Leaf</Filter>
</ClCompile>
<ClCompile Include="source\ExternalObject\Leaf\stdleaf.cpp">
<Filter>External Object\Leaf</Filter>
</ClCompile>
Expand Down Expand Up @@ -2019,9 +2010,6 @@
<ClInclude Include="source\Time\Timer.h">
<Filter>External Object\time</Filter>
</ClInclude>
<ClInclude Include="source\Utilities\Log\DebugAngel.h">
<Filter>Utilities\log</Filter>
</ClInclude>
<ClInclude Include="source\Utilities\Log\ErrorReport.h">
<Filter>Utilities\log</Filter>
</ClInclude>
Expand Down Expand Up @@ -2229,12 +2217,6 @@
<ClInclude Include="source\ExternalObject\Leaf\ExceptionHandler.h">
<Filter>External Object\Leaf</Filter>
</ClInclude>
<ClInclude Include="source\ExternalObject\Leaf\html_log.h">
<Filter>External Object\Leaf</Filter>
</ClInclude>
<ClInclude Include="source\ExternalObject\Leaf\peimage.h">
<Filter>External Object\Leaf</Filter>
</ClInclude>
<ClInclude Include="source\ExternalObject\Leaf\rdtsc.h">
<Filter>External Object\Leaf</Filter>
</ClInclude>
Expand Down
26 changes: 13 additions & 13 deletions Source Main 5.2/source/BoneManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,11 @@
#include "ZzzInterface.h"
#include "./Utilities/Log/ErrorReport.h"

void BoneManager::RegisterBone(CHARACTER* pCharacter, const std::string& name, int nBone)
void BoneManager::RegisterBone(CHARACTER* pCharacter, const std::wstring& name, int nBone)
{
CBoneManager::GetInstance()->RegisterBone(pCharacter, name, nBone);
}
void BoneManager::UnregisterBone(CHARACTER* pCharacter, const std::string& name)
void BoneManager::UnregisterBone(CHARACTER* pCharacter, const std::wstring& name)
{
CBoneManager::GetInstance()->UnregisterBone(pCharacter, name);
}
Expand All @@ -23,19 +23,19 @@ void BoneManager::UnregisterAll()
CBoneManager::GetInstance()->UnregisterAll();
}

CHARACTER* BoneManager::GetOwnCharacter(OBJECT* pObject, const std::string& name)
CHARACTER* BoneManager::GetOwnCharacter(OBJECT* pObject, const std::wstring& name)
{
return CBoneManager::GetInstance()->GetOwnCharacter(pObject, name);
}
int BoneManager::GetBoneNumber(OBJECT* pObject, const std::string& name)
int BoneManager::GetBoneNumber(OBJECT* pObject, const std::wstring& name)
{
return CBoneManager::GetInstance()->GetBoneNumber(pObject, name);
}
bool BoneManager::GetBonePosition(OBJECT* pObject, const std::string& name, OUT vec3_t Position)
bool BoneManager::GetBonePosition(OBJECT* pObject, const std::wstring& name, OUT vec3_t Position)
{
return CBoneManager::GetInstance()->GetBonePosition(pObject, name, Position);
}
bool BoneManager::GetBonePosition(OBJECT* pObject, const std::string& name, IN vec3_t Relative, OUT vec3_t Position)
bool BoneManager::GetBonePosition(OBJECT* pObject, const std::wstring& name, IN vec3_t Relative, OUT vec3_t Position)
{
return CBoneManager::GetInstance()->GetBonePosition(pObject, name, Relative, Position);
}
Expand All @@ -47,7 +47,7 @@ CBoneManager::~CBoneManager()
UnregisterAll();
}

void CBoneManager::RegisterBone(CHARACTER* pCharacter, const std::string& name, int nBone)
void CBoneManager::RegisterBone(CHARACTER* pCharacter, const std::wstring& name, int nBone)
{
if (pCharacter != NULL)
{
Expand All @@ -66,7 +66,7 @@ void CBoneManager::RegisterBone(CHARACTER* pCharacter, const std::string& name,
}
}
}
void CBoneManager::UnregisterBone(CHARACTER* pCharacter, const std::string& name)
void CBoneManager::UnregisterBone(CHARACTER* pCharacter, const std::wstring& name)
{
if (pCharacter != NULL) {
LPBONEINFO _lpBoneInfo = FindBone(&pCharacter->Object, name);
Expand Down Expand Up @@ -97,21 +97,21 @@ void CBoneManager::UnregisterAll()
m_listBone.clear();
}

CHARACTER* CBoneManager::GetOwnCharacter(OBJECT* pObject, const std::string& name)
CHARACTER* CBoneManager::GetOwnCharacter(OBJECT* pObject, const std::wstring& name)
{
LPBONEINFO _lpBoneInfo = FindBone(pObject, name);
if (_lpBoneInfo)
return _lpBoneInfo->pCharacter;
return NULL;
}
int CBoneManager::GetBoneNumber(OBJECT* pObject, const std::string& name)
int CBoneManager::GetBoneNumber(OBJECT* pObject, const std::wstring& name)
{
LPBONEINFO _lpBoneInfo = FindBone(pObject, name);
if (_lpBoneInfo)
return _lpBoneInfo->nBone;
return -1;
}
bool CBoneManager::GetBonePosition(OBJECT* pObject, const std::string& name, OUT vec3_t Position)
bool CBoneManager::GetBonePosition(OBJECT* pObject, const std::wstring& name, OUT vec3_t Position)
{
LPBONEINFO _lpBoneInfo = FindBone(pObject, name);
if (_lpBoneInfo) {
Expand All @@ -124,7 +124,7 @@ bool CBoneManager::GetBonePosition(OBJECT* pObject, const std::string& name, OUT
}
return false;
}
bool CBoneManager::GetBonePosition(OBJECT* pObject, const std::string& name, IN vec3_t Relative, OUT vec3_t Position)
bool CBoneManager::GetBonePosition(OBJECT* pObject, const std::wstring& name, IN vec3_t Relative, OUT vec3_t Position)
{
LPBONEINFO _lpBoneInfo = FindBone(pObject, name);
if (_lpBoneInfo) {
Expand All @@ -143,7 +143,7 @@ CBoneManager* CBoneManager::GetInstance()
return &s_Instace;
}

CBoneManager::LPBONEINFO CBoneManager::FindBone(OBJECT* pObject, const std::string& name)
CBoneManager::LPBONEINFO CBoneManager::FindBone(OBJECT* pObject, const std::wstring& name)
{
auto iter = m_listBone.begin();
for (; iter != m_listBone.end(); iter++)
Expand Down
28 changes: 14 additions & 14 deletions Source Main 5.2/source/BoneManager.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,21 +9,21 @@
#include "ZzzCharacter.h"

namespace BoneManager {
void RegisterBone(CHARACTER* pCharacter, const std::string& name, int nBone);
void UnregisterBone(CHARACTER* pCharacter, const std::string& name);
void RegisterBone(CHARACTER* pCharacter, const std::wstring& name, int nBone);
void UnregisterBone(CHARACTER* pCharacter, const std::wstring& name);
void UnregisterBone(CHARACTER* pCharacter);
void UnregisterAll();

CHARACTER* GetOwnCharacter(OBJECT* pObject, const std::string& name);
int GetBoneNumber(OBJECT* pObject, const std::string& name);
bool GetBonePosition(OBJECT* pObject, const std::string& name, OUT vec3_t Position);
bool GetBonePosition(OBJECT* pObject, const std::string& name, IN vec3_t Relative, OUT vec3_t Position);
CHARACTER* GetOwnCharacter(OBJECT* pObject, const std::wstring& name);
int GetBoneNumber(OBJECT* pObject, const std::wstring& name);
bool GetBonePosition(OBJECT* pObject, const std::wstring& name, OUT vec3_t Position);
bool GetBonePosition(OBJECT* pObject, const std::wstring& name, IN vec3_t Relative, OUT vec3_t Position);
}

class CBoneManager {
typedef struct __BONEINFO
{
std::string name; // bone name
std::wstring name; // bone name

CHARACTER* pCharacter;
BMD* pModel;
Expand All @@ -36,22 +36,22 @@ class CBoneManager {
public:
~CBoneManager();

void RegisterBone(CHARACTER* pCharacter, const std::string& name, int nBone);
void UnregisterBone(CHARACTER* pCharacter, const std::string& name);
void RegisterBone(CHARACTER* pCharacter, const std::wstring& name, int nBone);
void UnregisterBone(CHARACTER* pCharacter, const std::wstring& name);
void UnregisterBone(CHARACTER* pCharacter);
void UnregisterAll();

CHARACTER* GetOwnCharacter(OBJECT* pObject, const std::string& name);
int GetBoneNumber(OBJECT* pObject, const std::string& name);
bool GetBonePosition(OBJECT* pObject, const std::string& name, OUT vec3_t Position);
bool GetBonePosition(OBJECT* pObject, const std::string& name, IN vec3_t Relative, OUT vec3_t Position);
CHARACTER* GetOwnCharacter(OBJECT* pObject, const std::wstring& name);
int GetBoneNumber(OBJECT* pObject, const std::wstring& name);
bool GetBonePosition(OBJECT* pObject, const std::wstring& name, OUT vec3_t Position);
bool GetBonePosition(OBJECT* pObject, const std::wstring& name, IN vec3_t Relative, OUT vec3_t Position);

static CBoneManager* GetInstance();

protected:
CBoneManager(); //. ban create instance

LPBONEINFO FindBone(OBJECT* pObject, const std::string& name);
LPBONEINFO FindBone(OBJECT* pObject, const std::wstring& name);
};

#endif // _BONEMANAGER_H_
44 changes: 22 additions & 22 deletions Source Main 5.2/source/Builder.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -29,11 +29,11 @@ namespace
{
const int TEXTFILENAMECOUNT = eInfo_File_Count;
const int TEXTFILENAMELENGTH = 64;
const char TEXTFILEPOSITION[TEXTFILENAMELENGTH] = "data\\local\\";
const char TEXTFILETESTSERVER[TEXTFILENAMELENGTH] = "test";
const char TEXTFILEBMD[TEXTFILENAMELENGTH] = ".bmd";
const char TEXTFILETXT[TEXTFILENAMELENGTH] = ".txt";
const char TEXTFILENAME[TEXTFILENAMECOUNT][TEXTFILENAMELENGTH] =
const wchar_t TEXTFILEPOSITION[TEXTFILENAMELENGTH] = "data\\local\\";
const wchar_t TEXTFILETESTSERVER[TEXTFILENAMELENGTH] = "test";
const wchar_t TEXTFILEBMD[TEXTFILENAMELENGTH] = ".bmd";
const wchar_t TEXTFILETXT[TEXTFILENAMELENGTH] = ".txt";
const wchar_t TEXTFILENAME[TEXTFILENAMECOUNT][TEXTFILENAMELENGTH] =
{
"text",
"item",
Expand Down Expand Up @@ -61,7 +61,7 @@ Builder::Builder() : m_isTestServer(false)
InitBuilder();
}
catch (...) {
MessageBox(NULL, "InitBuilder Error", "Builder", MB_OK);
MessageBox(NULL, L"InitBuilder Error", L"Builder", MB_OK);
Clear();
throw;
}
Expand Down Expand Up @@ -95,30 +95,30 @@ void Builder::InitBuilder()

#ifdef KJH_MOD_NATION_LANGUAGE_REDEFINE
#ifdef _LANGUAGE_KOR
sprintf(m_Language, "(%s)", "Kor");
wsprintf(m_Language, L"(%s)", L"Kor");
#elif _LANGUAGE_ENG
sprintf(m_Language, "(%s)", "Eng");
wsprintf(m_Language, L"(%s)", L"Eng");
#elif _LANGUAGE_TAI
sprintf(m_Language, "(%s)", "Tai");
wsprintf(m_Language, L"(%s)", L"Tai");
#elif _LANGUAGE_CHS
sprintf(m_Language, "(%s)", "Chs");
wsprintf(m_Language, L"(%s)", L"Chs");
#elif _LANGUAGE_JPN
sprintf(m_Language, "(%s)", "Jpn");
wsprintf(m_Language, L"(%s)", L"Jpn");
#elif _LANGUAGE_PHI
sprintf(m_Language, "(%s)", "Phi");
wsprintf(m_Language, L"(%s)", L"Phi");
#elif _LANGUAGE_VIE
sprintf(m_Language, "(%s)", "Vie");
wsprintf(m_Language, L"(%s)", L"Vie");
#endif
#else // KJH_MOD_NATION_LANGUAGE_REDEFINE
switch (SELECTED_LANGUAGE)
{
case LANGUAGE_KOREAN: sprintf(m_Language, "(%s)", "Kor"); break;
case LANGUAGE_ENGLISH: sprintf(m_Language, "(%s)", "Eng"); break;
case LANGUAGE_TAIWANESE: sprintf(m_Language, "(%s)", "Tai"); break;
case LANGUAGE_CHINESE: sprintf(m_Language, "(%s)", "Chs"); break;
case LANGUAGE_JAPANESE: sprintf(m_Language, "(%s)", "Jpn"); break;
case LANGUAGE_PHILIPPINES: sprintf(m_Language, "(%s)", "Phi"); break;
case LANGUAGE_VIETNAMESE: sprintf(m_Language, "(%s)", "Vie"); break;
case LANGUAGE_KOREAN: wsprintf(m_Language, L"(%s)", L"Kor"); break;
case LANGUAGE_ENGLISH: wsprintf(m_Language, L"(%s)", L"Eng"); break;
case LANGUAGE_TAIWANESE: wsprintf(m_Language, L"(%s)", L"Tai"); break;
case LANGUAGE_CHINESE: wsprintf(m_Language, L"(%s)", L"Chs"); break;
case LANGUAGE_JAPANESE: wsprintf(m_Language, L"(%s)", L"Jpn"); break;
case LANGUAGE_PHILIPPINES: wsprintf(m_Language, L"(%s)", L"Phi"); break;
case LANGUAGE_VIETNAMESE: wsprintf(m_Language, L"(%s)", L"Vie"); break;
}
#endif // KJH_MOD_NATION_LANGUAGE_REDEFINE

Expand Down Expand Up @@ -148,9 +148,9 @@ BoostSmart_Ptr(InfoFile) Builder::MakeInfo(InfoTextType type)
{
BoostSmart_Ptr(InfoFile) info;

char TextFileName[512];
wchar_t TextFileName[512];

sprintf(TextFileName, "%s%s%s%s%s", //경로, 파일명, 테스트, 나라별, 확장명
wsprintf(TextFileName, L"%s%s%s%s%s", //경로, 파일명, 테스트, 나라별, 확장명
TEXTFILEPOSITION,
TEXTFILENAME[type],
m_isTestServer ? TEXTFILETESTSERVER : "",
Expand Down
2 changes: 1 addition & 1 deletion Source Main 5.2/source/Builder.h
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ namespace info
private:
InfoMAP m_InfoMap;
bool m_isTestServer;
char m_Language[32];
wchar_t m_Language[32];
};
};

Expand Down
10 changes: 5 additions & 5 deletions Source Main 5.2/source/Button.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -201,7 +201,7 @@ void CButton::Render()
g_pRenderText->SetFont(g_hFixFont);

SIZE size;
g_pMultiLanguage->_GetTextExtentPoint32(g_pRenderText->GetFontDC(), m_szText, ::strlen(m_szText), &size);
g_pMultiLanguage->_GetTextExtentPoint32(g_pRenderText->GetFontDC(), m_szText, ::wcslen(m_szText), &size);

float fTextRelativeYPos = ((CSprite::GetHeight() - size.cy) / 2.0f);

Expand All @@ -214,15 +214,15 @@ void CButton::ReleaseText()
SAFE_DELETE_ARRAY(m_adwTextColorMap);
}

void CButton::SetText(const char* pszText, DWORD* adwColor)
void CButton::SetText(const wchar_t* pszText, DWORD* adwColor)
{
ReleaseText();

m_szText = new char[::strlen(pszText) + 1];
::strcpy(m_szText, pszText);
m_szText = new wchar_t[wcslen(pszText) + 1];
wcscpy(m_szText, pszText);

int nTextColor = -1 < m_anImgMap[BTN_UP_CHECK] ? BTN_IMG_MAX : BTN_IMG_MAX / 2;

m_adwTextColorMap = new DWORD[nTextColor];
::memcpy(m_adwTextColorMap, adwColor, sizeof(DWORD) * nTextColor);
memcpy(m_adwTextColorMap, adwColor, sizeof(DWORD) * nTextColor);
}
Loading

0 comments on commit 9bc4ebd

Please sign in to comment.