mirror of
https://github.com/thunderbrewhq/thunderbrew
synced 2025-07-25 01:51:12 +03:00
Compare commits
24 Commits
d80e2b4b4f
...
41f4992ebe
Author | SHA1 | Date | |
---|---|---|---|
![]() |
41f4992ebe | ||
![]() |
88e21b4a22 | ||
![]() |
140bcde493 | ||
![]() |
babeb2d864 | ||
![]() |
8a71e9fdea | ||
![]() |
1539c56ace | ||
![]() |
7ae43b73fb | ||
![]() |
f28f4b0379 | ||
![]() |
d536140d63 | ||
![]() |
1e8dc7aef9 | ||
![]() |
ba21fb2994 | ||
![]() |
a15b5de3bf | ||
![]() |
31f4103f12 | ||
![]() |
b9b070830f | ||
![]() |
d18d8acc43 | ||
![]() |
29bae200f3 | ||
![]() |
28eecb2a09 | ||
![]() |
758099c076 | ||
![]() |
841cc1a476 | ||
![]() |
8d54e8ad0b | ||
![]() |
4a74c722a4 | ||
![]() |
77f4228abf | ||
![]() |
6e1f033e83 | ||
![]() |
2f070a489e |
@ -1,10 +1,12 @@
|
|||||||
add_subdirectory(app)
|
add_subdirectory(app)
|
||||||
add_subdirectory(async)
|
add_subdirectory(async)
|
||||||
add_subdirectory(client)
|
add_subdirectory(client)
|
||||||
|
add_subdirectory(clientobject)
|
||||||
add_subdirectory(console)
|
add_subdirectory(console)
|
||||||
add_subdirectory(cursor)
|
add_subdirectory(cursor)
|
||||||
add_subdirectory(db)
|
add_subdirectory(db)
|
||||||
add_subdirectory(event)
|
add_subdirectory(event)
|
||||||
|
add_subdirectory(gameui)
|
||||||
add_subdirectory(glue)
|
add_subdirectory(glue)
|
||||||
add_subdirectory(gx)
|
add_subdirectory(gx)
|
||||||
add_subdirectory(math)
|
add_subdirectory(math)
|
||||||
|
@ -39,6 +39,7 @@ target_link_libraries(client
|
|||||||
console
|
console
|
||||||
db
|
db
|
||||||
event
|
event
|
||||||
|
gameui
|
||||||
gx
|
gx
|
||||||
model
|
model
|
||||||
net
|
net
|
||||||
|
@ -2,12 +2,15 @@
|
|||||||
#include "async/AsyncFile.hpp"
|
#include "async/AsyncFile.hpp"
|
||||||
#include "client/ClientServices.hpp"
|
#include "client/ClientServices.hpp"
|
||||||
#include "client/CmdLine.hpp"
|
#include "client/CmdLine.hpp"
|
||||||
|
#include "client/ClientHandlers.hpp"
|
||||||
#include "console/CVar.hpp"
|
#include "console/CVar.hpp"
|
||||||
#include "console/Client.hpp"
|
#include "console/Client.hpp"
|
||||||
#include "console/Device.hpp"
|
#include "console/Device.hpp"
|
||||||
#include "console/Screen.hpp"
|
#include "console/Screen.hpp"
|
||||||
|
#include "console/Command.hpp"
|
||||||
#include "db/Db.hpp"
|
#include "db/Db.hpp"
|
||||||
#include "glue/CGlueMgr.hpp"
|
#include "glue/CGlueMgr.hpp"
|
||||||
|
#include "gameui/CGGameUI.hpp"
|
||||||
#include "gx/Screen.hpp"
|
#include "gx/Screen.hpp"
|
||||||
#include "gx/Texture.hpp"
|
#include "gx/Texture.hpp"
|
||||||
#include "model/Model2.hpp"
|
#include "model/Model2.hpp"
|
||||||
@ -21,9 +24,39 @@
|
|||||||
#include <storm/Error.hpp>
|
#include <storm/Error.hpp>
|
||||||
#include <storm/Log.hpp>
|
#include <storm/Log.hpp>
|
||||||
#include <bc/os/Path.hpp>
|
#include <bc/os/Path.hpp>
|
||||||
|
#include <bc/file/File.hpp>
|
||||||
|
|
||||||
|
|
||||||
|
CVar* Client::g_accountNameVar;
|
||||||
CVar* Client::g_accountListVar;
|
CVar* Client::g_accountListVar;
|
||||||
|
CVar* Client::g_accountUsesTokenVar;
|
||||||
|
CVar* Client::g_movieVar;
|
||||||
|
CVar* Client::g_expansionMovieVar;
|
||||||
|
CVar* Client::g_movieSubtitleVar;
|
||||||
|
|
||||||
|
|
||||||
HEVENTCONTEXT Client::g_clientEventContext;
|
HEVENTCONTEXT Client::g_clientEventContext;
|
||||||
|
char Client::g_currentLocaleName[5] = {};
|
||||||
|
|
||||||
|
|
||||||
|
static uint8_t s_expansionLevel = 0;
|
||||||
|
static bool g_hasIsoLocale[12] = {};
|
||||||
|
static char* s_localeArray[12] = {
|
||||||
|
"deDE", "enGB", "enUS", "esES", "frFR", "koKR",
|
||||||
|
"zhCN", "zhTW", "enCN", "enTW", "esMX", "ruRU"
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
int32_t CCommand_ReloadUI(const char*, const char*) {
|
||||||
|
CGlueMgr::m_reload = 1;
|
||||||
|
// CGGameUI::Reload();
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
int32_t CCommand_Perf(const char*, const char*) {
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
void AsyncFileInitialize() {
|
void AsyncFileInitialize() {
|
||||||
// TODO
|
// TODO
|
||||||
@ -36,18 +69,20 @@ void BaseInitializeGlobal() {
|
|||||||
|
|
||||||
void ClientMiscInitialize() {
|
void ClientMiscInitialize() {
|
||||||
// TODO
|
// TODO
|
||||||
|
}
|
||||||
|
|
||||||
Client::g_accountListVar = CVar::Register(
|
void ClientRegisterConsoleCommands() {
|
||||||
"accountList",
|
ConsoleCommandRegister("reloadUI", &CCommand_ReloadUI, CATEGORY::GRAPHICS, nullptr);
|
||||||
"List of wow accounts for saved Blizzard account",
|
ConsoleCommandRegister("perf", &CCommand_Perf, CATEGORY::DEBUG, nullptr);
|
||||||
0,
|
|
||||||
"",
|
const auto game = CATEGORY::GAME;
|
||||||
nullptr,
|
|
||||||
4,
|
Client::g_accountNameVar = CVar::Register("accountName", "Saved account name", 64, "", nullptr, game);
|
||||||
false,
|
Client::g_accountListVar = CVar::Register("accountList", "List of wow accounts for saved Blizzard account", 0, "", nullptr, game);
|
||||||
nullptr,
|
Client::g_accountUsesTokenVar = CVar::Register("g_accountUsesToken", "Saved whether uses authenticator", 0, "0", nullptr, game);
|
||||||
false
|
Client::g_movieVar = CVar::Register("movie", "Show movie on startup", 0, "1", nullptr, game);
|
||||||
);
|
Client::g_expansionMovieVar = CVar::Register("expansionMovie", "Show expansion movie on startup", 0, "1", nullptr, game);
|
||||||
|
Client::g_movieSubtitleVar = CVar::Register("movieSubtitle", "Show movie subtitles", 0, "0", nullptr, game);
|
||||||
|
|
||||||
// TODO
|
// TODO
|
||||||
}
|
}
|
||||||
@ -139,6 +174,32 @@ int32_t InitializeEngineCallback(const void* a1, void* a2) {
|
|||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
uint8_t GetExpansionLevel() {
|
||||||
|
return s_expansionLevel;
|
||||||
|
}
|
||||||
|
|
||||||
|
const char* UpdateInstallLocation() {
|
||||||
|
// TODO
|
||||||
|
return nullptr;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool UpdateInstallLocationForName(int32_t a1, size_t size, const char* filename, char* buffer, const char* locale) {
|
||||||
|
if (a1 == 2) {
|
||||||
|
auto location = UpdateInstallLocation();
|
||||||
|
if (!location) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
SStrPrintf(buffer, size, "%s%s%s", location, "Data\\", filename);
|
||||||
|
} else {
|
||||||
|
SStrPrintf(buffer, size, "%s%s", "Data\\", filename);
|
||||||
|
}
|
||||||
|
for (auto i = SStrStr(buffer, "****"); i; i = SStrStr(buffer, "****")) {
|
||||||
|
size_t offset = static_cast<size_t>(i - buffer);
|
||||||
|
memcpy(&buffer[offset], locale, 4);
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
void SetPaths() {
|
void SetPaths() {
|
||||||
// SFile::DisableSFileCheckDisk();
|
// SFile::DisableSFileCheckDisk();
|
||||||
// SFile::EnableDirectAccess(0);
|
// SFile::EnableDirectAccess(0);
|
||||||
@ -158,12 +219,109 @@ void SetPaths() {
|
|||||||
OsSetCurrentDirectory(datadir);
|
OsSetCurrentDirectory(datadir);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool IsCommonMpqExists() {
|
||||||
|
char path1[1024];
|
||||||
|
SStrPrintf(path1, sizeof(path1), "%s%s", "Data\\", "common.MPQ");
|
||||||
|
for (auto i = SStrStr(path1, "****"); i; i = SStrStr(path1, "****")) {
|
||||||
|
size_t offset = static_cast<size_t>(i - path1);
|
||||||
|
memcpy(&path1[offset], "----", 4);
|
||||||
|
}
|
||||||
|
|
||||||
|
char path2[1024];
|
||||||
|
SStrPrintf(path2, sizeof(path2), "%s%s", "..\\Data\\", "common.MPQ");
|
||||||
|
for (auto i = SStrStr(path2, "****"); i; i = SStrStr(path2, "****")) {
|
||||||
|
size_t offset = static_cast<size_t>(i - path2);
|
||||||
|
memcpy(&path2[offset], "----", 4);
|
||||||
|
}
|
||||||
|
|
||||||
|
auto location = UpdateInstallLocation();
|
||||||
|
if (location) {
|
||||||
|
char path3[1024];
|
||||||
|
SStrPrintf(path3, sizeof(path3), "%s%s%s", location, "Data\\", "common.MPQ");
|
||||||
|
for (auto i = SStrStr(path3, "****"); i; i = SStrStr(path3, "****")) {
|
||||||
|
size_t offset = static_cast<size_t>(i - path3);
|
||||||
|
memcpy(&path3[offset], "----", 4);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!Blizzard::File::Exists(path1) && !Blizzard::File::Exists(path2)) {
|
||||||
|
return Blizzard::File::Exists(path3);
|
||||||
|
}
|
||||||
|
} else if (!Blizzard::File::Exists(path1)) {
|
||||||
|
return Blizzard::File::Exists(path2);
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
size_t GetLocaleIndex(const char* locale) {
|
||||||
|
for (size_t i = 0; i < 12; ++i) {
|
||||||
|
if (SStrCmpI(locale, s_localeArray[i], 4) == 0) {
|
||||||
|
return i;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return 2; // s_localeArray[2] == "enUS"
|
||||||
|
}
|
||||||
|
|
||||||
|
void CheckAvailableLocales(char* locale) {
|
||||||
|
if (!IsCommonMpqExists()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
for (size_t localeIndex = 0; localeIndex < 12; ++localeIndex) {
|
||||||
|
g_hasIsoLocale[localeIndex] = false;
|
||||||
|
|
||||||
|
const char* filename = "****\\locale-****.MPQ";
|
||||||
|
|
||||||
|
char path[1024];
|
||||||
|
SStrPrintf(path, sizeof(path), "%s%s", "Data\\", filename);
|
||||||
|
for (auto i = SStrStr(path, "****"); i; i = SStrStr(path, "****")) {
|
||||||
|
size_t offset = static_cast<size_t>(i - path);
|
||||||
|
memcpy(&path[offset], s_localeArray[localeIndex], 4);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (Blizzard::File::Exists(path)) {
|
||||||
|
g_hasIsoLocale[localeIndex] = true;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
SStrPrintf(path, sizeof(path), "%s%s", "..\\Data\\", filename);
|
||||||
|
for (auto i = SStrStr(path, "****"); i; i = SStrStr(path, "****")) {
|
||||||
|
size_t offset = static_cast<size_t>(i - path);
|
||||||
|
memcpy(&path[offset], s_localeArray[localeIndex], 4);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (Blizzard::File::Exists(path)) {
|
||||||
|
g_hasIsoLocale[localeIndex] = true;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (UpdateInstallLocationForName(2, sizeof(path), filename, path, s_localeArray[localeIndex]) &&
|
||||||
|
Blizzard::File::Exists(path)) {
|
||||||
|
g_hasIsoLocale[localeIndex] = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
size_t localeIndex = GetLocaleIndex(locale);
|
||||||
|
for (size_t i = 0; i < 12; ++i) {
|
||||||
|
if (g_hasIsoLocale[localeIndex]) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
localeIndex = (localeIndex + 1) % 12;
|
||||||
|
}
|
||||||
|
SStrCopy(locale, s_localeArray[localeIndex], STORM_MAX_STR);
|
||||||
|
}
|
||||||
|
|
||||||
|
bool LocaleChangedCallback(CVar*, const char*, const char* value, void*) {
|
||||||
|
SStrCopy(Client::g_currentLocaleName, value, sizeof(Client::g_currentLocaleName));
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
int32_t InitializeGlobal() {
|
int32_t InitializeGlobal() {
|
||||||
// TODO
|
|
||||||
|
|
||||||
ProcessCommandLine();
|
ProcessCommandLine();
|
||||||
|
SetPaths();
|
||||||
|
|
||||||
// sub_403600("WoW.mfil");
|
// TODO:
|
||||||
|
// WowConfigureFileSystem::ReadBuildKeyFromFile("WoW.mfil");
|
||||||
|
|
||||||
// if (dword_B2FA10 != 2) {
|
// if (dword_B2FA10 != 2) {
|
||||||
// sub_403560();
|
// sub_403560();
|
||||||
@ -175,58 +333,83 @@ int32_t InitializeGlobal() {
|
|||||||
// LOBYTE(v24) = OsDirectoryExists((int)"WTF/Account") == 0;
|
// LOBYTE(v24) = OsDirectoryExists((int)"WTF/Account") == 0;
|
||||||
// }
|
// }
|
||||||
|
|
||||||
// ClientServices::LoadCDKey();
|
ClientServices::LoadCDKey();
|
||||||
|
|
||||||
SetPaths();
|
|
||||||
|
|
||||||
OpenArchives();
|
|
||||||
|
|
||||||
ConsoleInitializeClientCommand();
|
ConsoleInitializeClientCommand();
|
||||||
|
|
||||||
ConsoleInitializeClientCVar("Config.wtf");
|
ConsoleInitializeClientCVar("Config.wtf");
|
||||||
|
// TODO: CVar::ArchiveCodeRegisteredOnly();
|
||||||
// TODO
|
|
||||||
// replace enUS with detected locale
|
|
||||||
ClientServices::InitLoginServerCVars(1, "enUS");
|
|
||||||
|
|
||||||
// sub_7663F0();
|
|
||||||
|
|
||||||
// v18 = 0;
|
// v18 = 0;
|
||||||
// v19 = 0;
|
// v19 = 0;
|
||||||
// ptr = 0;
|
// ptr = 0;
|
||||||
// v21 = 0;
|
// v21 = 0;
|
||||||
|
|
||||||
// sub_406740(&v18, &CVar::Load);
|
// ::ForEveryRunOnceWTF::Execute(&v18, &CVar::Load);
|
||||||
|
|
||||||
// if (ptr) {
|
// if (ptr) {
|
||||||
// SMemFree(ptr, a_pad, -2, 0);
|
// SMemFree(ptr, a_pad, -2, 0);
|
||||||
// }
|
// }
|
||||||
|
|
||||||
// CVar::Register("dbCompress", "Database compression", 0, "-1", 0, 5, 0, 0, 0);
|
CVar::Register(
|
||||||
|
"dbCompress",
|
||||||
|
"Database compression",
|
||||||
|
0,
|
||||||
|
"-1",
|
||||||
|
nullptr,
|
||||||
|
CATEGORY::DEFAULT,
|
||||||
|
false,
|
||||||
|
nullptr,
|
||||||
|
false
|
||||||
|
);
|
||||||
|
|
||||||
// v2 = CVar::Register("locale", "Set the game locale", 0, "****", &LocaleChangedCallback, 5, 0, 0, 0);
|
CVar* locale = CVar::Register(
|
||||||
|
"locale",
|
||||||
|
"Set the game locale",
|
||||||
|
0,
|
||||||
|
"****",
|
||||||
|
&LocaleChangedCallback,
|
||||||
|
CATEGORY::DEFAULT,
|
||||||
|
false,
|
||||||
|
nullptr,
|
||||||
|
false
|
||||||
|
);
|
||||||
|
|
||||||
// if (!SStrCmp(v2->m_stringValue.m_str, "****", 0x7FFFFFFFu)) {
|
if (!SStrCmp(locale->GetString(), "****", STORM_MAX_STR)) {
|
||||||
// CVar::Set(v2, "enUS", 1, 0, 0, 1);
|
locale->Set("enUS", true, false, false, true);
|
||||||
// }
|
}
|
||||||
|
|
||||||
// CVar::Register("useEnglishAudio", "override the locale and use English audio", 0, "0", 0, 5, 0, 0, 0);
|
CVar::Register(
|
||||||
|
"useEnglishAudio",
|
||||||
|
"override the locale and use English audio",
|
||||||
|
0,
|
||||||
|
"0",
|
||||||
|
nullptr,
|
||||||
|
CATEGORY::DEFAULT,
|
||||||
|
false,
|
||||||
|
nullptr,
|
||||||
|
false
|
||||||
|
);
|
||||||
|
|
||||||
|
// TODO: SFile::IsTrial() check
|
||||||
// if (sub_422140()) {
|
// if (sub_422140()) {
|
||||||
// sub_4036B0(v24, 0, a2, (int)v2, (char)v24);
|
// sub_4036B0(v24, 0, a2, (int)v2, (char)v24);
|
||||||
// }
|
// }
|
||||||
|
|
||||||
// SStrCopy(&a1a, v2->m_stringValue.m_str, 5);
|
char existingLocale[5] = {};
|
||||||
|
SStrCopy(existingLocale, locale->GetString(), sizeof(existingLocale));
|
||||||
|
CheckAvailableLocales(existingLocale);
|
||||||
|
locale->Set(existingLocale, true, false, false, true);
|
||||||
|
|
||||||
// sub_402D50(&a1a);
|
char path[STORM_MAX_PATH];
|
||||||
|
SStrPrintf(path, sizeof(path), "%s%s", "Data\\", locale->GetString());
|
||||||
|
SFile::SetDataPathAlternate(path);
|
||||||
|
SFile::RebuildHash();
|
||||||
|
|
||||||
// CVar::Set(v2, &a1a, 1, 0, 0, 1);
|
|
||||||
|
|
||||||
// SStrPrintf(dest, 260, "%s%s", *(_DWORD *)off_AB6158, v2->m_stringValue.m_str);
|
OpenArchives();
|
||||||
|
|
||||||
// sub_421B50(dest);
|
// TODO: This method should be placed inside OpenArchives
|
||||||
|
ClientServices::InitLoginServerCVars(1, locale->GetString());
|
||||||
// sub_423D70();
|
|
||||||
|
|
||||||
// sub_405DD0();
|
// sub_405DD0();
|
||||||
|
|
||||||
@ -343,19 +526,36 @@ int32_t InitializeGlobal() {
|
|||||||
void CommonMain() {
|
void CommonMain() {
|
||||||
StormInitialize();
|
StormInitialize();
|
||||||
|
|
||||||
// TODO
|
// TODO:
|
||||||
// - error log setup
|
// SErrCatchUnhandledExceptions();
|
||||||
// - misc other setup
|
// OsSystemInitialize("Blizzard Entertainment World of Warcraft", 0);
|
||||||
|
// int option = 1;
|
||||||
|
// StormSetOption(10, &option, sizeof(option));
|
||||||
|
// StormSetOption(11, &option, sizeof(option));
|
||||||
|
// OsSystemEnableCpuLog();
|
||||||
|
|
||||||
|
// SetPaths() moved into InitializeGlobal()
|
||||||
|
|
||||||
|
// int sendErrorLogs = 1;
|
||||||
|
// if (!SRegLoadValue("World of Warcraft\\Client", "SendErrorLogs", 0, &sendErrorLogs)) {
|
||||||
|
// sendErrorLogs = 1;
|
||||||
|
// SRegSaveValue("World of Warcraft\\Client", "SendErrorLogs", 0, sendErrorLogs);
|
||||||
|
// }
|
||||||
|
|
||||||
|
// SErrSetLogTitleString("World of WarCraft (build 12340)");
|
||||||
|
// SErrSetLogTitleCallback(WowLogHeader);
|
||||||
|
// if (sendErrorLogs) {
|
||||||
|
// SErrRegisterHandler(SendErrorLog);
|
||||||
|
// }
|
||||||
|
|
||||||
if (InitializeGlobal()) {
|
if (InitializeGlobal()) {
|
||||||
EventDoMessageLoop();
|
EventDoMessageLoop();
|
||||||
|
// TODO: DestroyGlobal();
|
||||||
// TODO
|
|
||||||
// sub_406B70();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO
|
// TODO:
|
||||||
// - misc cleanup
|
// StormDestroy();
|
||||||
|
// Misc Cleanup
|
||||||
}
|
}
|
||||||
|
|
||||||
void BlizzardAssertCallback(const char* a1, const char* a2, const char* a3, uint32_t a4) {
|
void BlizzardAssertCallback(const char* a1, const char* a2, const char* a3, uint32_t a4) {
|
||||||
@ -383,7 +583,7 @@ void WowClientInit() {
|
|||||||
|
|
||||||
ClientMiscInitialize();
|
ClientMiscInitialize();
|
||||||
|
|
||||||
// sub_401B60();
|
ClientRegisterConsoleCommands();
|
||||||
|
|
||||||
ClientDBInitialize();
|
ClientDBInitialize();
|
||||||
|
|
||||||
@ -441,27 +641,22 @@ void WowClientInit() {
|
|||||||
// sub_421630();
|
// sub_421630();
|
||||||
// }
|
// }
|
||||||
|
|
||||||
// TODO
|
if (s_expansionLevel != 1) {
|
||||||
// if (byte_B2F9E1 != 1) {
|
if (Client::g_movieVar->GetInt()) {
|
||||||
// if ((g_playIntroMovie + 48) == 1) {
|
Client::g_movieVar->Set("0", true, false, false, true);
|
||||||
// CVar::Set(g_playIntroMovie, "0", 1, 0, 0, 1);
|
CGlueMgr::SetScreen("movie");
|
||||||
// CGlueMgr::SetScreen("movie");
|
} else {
|
||||||
// } else {
|
CGlueMgr::SetScreen("login");
|
||||||
// CGlueMgr::SetScreen("login");
|
}
|
||||||
// }
|
} else {
|
||||||
// } else {
|
if (Client::g_expansionMovieVar->GetInt()) {
|
||||||
// if ((dword_B2F980 + 48) == 1) {
|
Client::g_expansionMovieVar->Set("0", true, false, false, true);
|
||||||
// CVar::Set(dword_B2F980, "0", 1, 0, 0, 1);
|
Client::g_movieVar->Set("0", true, false, false, true);
|
||||||
// CVar::Set(g_playIntroMovie, "0", 1, 0, 0, 1);
|
CGlueMgr::SetScreen("movie");
|
||||||
// CGlueMgr::SetScreen("movie");
|
} else {
|
||||||
// } else {
|
CGlueMgr::SetScreen("login");
|
||||||
// CGlueMgr::SetScreen("login");
|
}
|
||||||
// }
|
}
|
||||||
// }
|
|
||||||
|
|
||||||
// TODO
|
|
||||||
// - temporary until above logic is implemented
|
|
||||||
CGlueMgr::SetScreen("login");
|
|
||||||
|
|
||||||
// TODO
|
// TODO
|
||||||
// CGlueMgr::m_pendingTimerAlert = dword_B2F9D8;
|
// CGlueMgr::m_pendingTimerAlert = dword_B2F9D8;
|
||||||
@ -469,3 +664,13 @@ void WowClientInit() {
|
|||||||
|
|
||||||
EventRegister(EVENT_ID_POLL, &PollNet);
|
EventRegister(EVENT_ID_POLL, &PollNet);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void ClientInitializeGame(int32_t continentID, const C3Vector& position) {
|
||||||
|
// TODO
|
||||||
|
CGGameUI::InitializeGame();
|
||||||
|
|
||||||
|
ClientServices::SetMessageHandler(SMSG_NEW_WORLD, &NewWorldHandler, nullptr);
|
||||||
|
ClientServices::SetMessageHandler(SMSG_LOGIN_VERIFY_WORLD, &LoginVerifyWorldHandler, nullptr);
|
||||||
|
|
||||||
|
// TODO
|
||||||
|
}
|
||||||
|
@ -2,21 +2,32 @@
|
|||||||
#define CLIENT_CLIENT_HPP
|
#define CLIENT_CLIENT_HPP
|
||||||
|
|
||||||
#include "event/Event.hpp"
|
#include "event/Event.hpp"
|
||||||
|
#include "tempest/Vector.hpp"
|
||||||
#include <cstdint>
|
#include <cstdint>
|
||||||
|
|
||||||
class CVar;
|
class CVar;
|
||||||
|
|
||||||
namespace Client {
|
namespace Client {
|
||||||
|
extern CVar* g_accountNameVar;
|
||||||
extern CVar* g_accountListVar;
|
extern CVar* g_accountListVar;
|
||||||
|
extern CVar* g_accountUsesTokenVar;
|
||||||
|
extern CVar* g_movieVar;
|
||||||
|
extern CVar* g_expansionMovieVar;
|
||||||
|
extern CVar* g_movieSubtitleVar;
|
||||||
extern HEVENTCONTEXT g_clientEventContext;
|
extern HEVENTCONTEXT g_clientEventContext;
|
||||||
|
extern char g_currentLocaleName[5];
|
||||||
}
|
}
|
||||||
|
|
||||||
void ClientPostClose(int32_t a1);
|
void ClientPostClose(int32_t a1);
|
||||||
|
|
||||||
|
const char* UpdateInstallLocation();
|
||||||
|
|
||||||
void CommonMain();
|
void CommonMain();
|
||||||
|
|
||||||
void StormInitialize();
|
void StormInitialize();
|
||||||
|
|
||||||
void WowClientInit();
|
void WowClientInit();
|
||||||
|
|
||||||
|
void ClientInitializeGame(int32_t continentID, const C3Vector& position);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
61
src/client/ClientHandlers.cpp
Normal file
61
src/client/ClientHandlers.cpp
Normal file
@ -0,0 +1,61 @@
|
|||||||
|
#include "client/ClientHandlers.hpp"
|
||||||
|
|
||||||
|
#include <storm/Error.hpp>
|
||||||
|
#include <common/DataStore.hpp>
|
||||||
|
|
||||||
|
#include "console/Line.hpp"
|
||||||
|
#include "world/World.hpp"
|
||||||
|
|
||||||
|
|
||||||
|
uint32_t s_newZoneID = 0;
|
||||||
|
C3Vector s_newPosition;
|
||||||
|
float s_newFacing = 0.0f;
|
||||||
|
const char* s_newMapname = nullptr;
|
||||||
|
|
||||||
|
|
||||||
|
int32_t NewWorldHandler(void* param, NETMESSAGE msgId, uint32_t time, CDataStore* msg) {
|
||||||
|
STORM_ASSERT(msgId == SMSG_NEW_WORLD);
|
||||||
|
|
||||||
|
msg->Get(s_newZoneID);
|
||||||
|
msg->Get(s_newPosition.x);
|
||||||
|
msg->Get(s_newPosition.y);
|
||||||
|
msg->Get(s_newPosition.z);
|
||||||
|
msg->Get(s_newFacing);
|
||||||
|
|
||||||
|
if (msg->IsRead()) {
|
||||||
|
// TODO
|
||||||
|
return 1;
|
||||||
|
} else {
|
||||||
|
ConsoleWrite("Bad SMSG_NEW_WORLD\n", DEFAULT_COLOR);
|
||||||
|
msg->Reset();
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
int32_t LoginVerifyWorldHandler(void* param, NETMESSAGE msgId, uint32_t time, CDataStore* msg) {
|
||||||
|
STORM_ASSERT(msgId == SMSG_LOGIN_VERIFY_WORLD);
|
||||||
|
|
||||||
|
uint32_t zoneID;
|
||||||
|
msg->Get(zoneID);
|
||||||
|
|
||||||
|
C3Vector position;
|
||||||
|
msg->Get(position.x);
|
||||||
|
msg->Get(position.y);
|
||||||
|
msg->Get(position.z);
|
||||||
|
|
||||||
|
float facing;
|
||||||
|
msg->Get(facing);
|
||||||
|
// zoneID != ClntObjMgrGetMapID()
|
||||||
|
if (false) {
|
||||||
|
s_newFacing = facing;
|
||||||
|
s_newPosition = position;
|
||||||
|
s_newZoneID = zoneID;
|
||||||
|
//if (zoneID < dword_AD4170 || zoneID > dword_AD416C || (v0 = *(_DWORD*)(dword_AD4180 + 4 * (zoneID - dword_AD4170))) == 0) {
|
||||||
|
// ConsoleWrite("Bad SMSG_NEW_WORLD zoneID\n", 0);
|
||||||
|
// return 0;
|
||||||
|
//}
|
||||||
|
//s_newMapname = *(_DWORD*)(v0 + 4);
|
||||||
|
LoadNewWorld();
|
||||||
|
}
|
||||||
|
return 1;
|
||||||
|
}
|
13
src/client/ClientHandlers.hpp
Normal file
13
src/client/ClientHandlers.hpp
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
#ifndef CLIENT_CLIENTHANDLERS_HPP
|
||||||
|
#define CLIENT_CLIENTHANDLERS_HPP
|
||||||
|
|
||||||
|
#include "net/Types.hpp"
|
||||||
|
|
||||||
|
class CDataStore;
|
||||||
|
|
||||||
|
|
||||||
|
int32_t NewWorldHandler(void* param, NETMESSAGE msgId, uint32_t time, CDataStore* msg);
|
||||||
|
int32_t LoginVerifyWorldHandler(void* param, NETMESSAGE msgId, uint32_t time, CDataStore* msg);
|
||||||
|
|
||||||
|
|
||||||
|
#endif // CLIENT_CLIENTHANDLERS_HPP
|
@ -16,3 +16,13 @@ void ClientRealmResponseAdapter::HandleAuthResponse(RealmConnection* realmConnec
|
|||||||
|
|
||||||
AccountDataInitialize(true);
|
AccountDataInitialize(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void ClientRealmResponseAdapter::CharacterListReceived(RealmConnection* realmConnection, void* a2, int32_t success) {
|
||||||
|
auto clientConnection = static_cast<ClientConnection*>(realmConnection);
|
||||||
|
|
||||||
|
if (success) {
|
||||||
|
clientConnection->Complete(1, 44);
|
||||||
|
} else {
|
||||||
|
clientConnection->Complete(1, 45);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
@ -7,6 +7,7 @@ class ClientRealmResponseAdapter : public RealmResponse {
|
|||||||
public:
|
public:
|
||||||
// Virtual member functions
|
// Virtual member functions
|
||||||
virtual void HandleAuthResponse(RealmConnection* realmConnection, uint8_t authResult);
|
virtual void HandleAuthResponse(RealmConnection* realmConnection, uint8_t authResult);
|
||||||
|
virtual void CharacterListReceived(RealmConnection* realmConnection, void* a2, int32_t success);
|
||||||
virtual void GameServerResult(RealmConnection* realmConnection, const char* a2, const char* a3, const char* a4) {};
|
virtual void GameServerResult(RealmConnection* realmConnection, const char* a2, const char* a3, const char* a4) {};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -65,6 +65,24 @@ ClientServices* ClientServices::GetInstance() {
|
|||||||
|
|
||||||
return ClientServices::s_instance;
|
return ClientServices::s_instance;
|
||||||
}
|
}
|
||||||
|
void ClientServices::SetMessageHandler(NETMESSAGE msgId, MESSAGE_HANDLER handler, void* param) {
|
||||||
|
STORM_ASSERT(ClientServices::s_currentConnection);
|
||||||
|
STORM_ASSERT(handler);
|
||||||
|
s_currentConnection->SetMessageHandler(msgId, handler, param);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void ClientServices::GetRealmList() {
|
||||||
|
// TODO
|
||||||
|
}
|
||||||
|
|
||||||
|
void ClientServices::GetCharacterList() {
|
||||||
|
ClientServices::s_currentConnection->GetCharacterList();
|
||||||
|
}
|
||||||
|
|
||||||
|
void ClientServices::CharacterLogin(uint64_t id, const C3Vector& position) {
|
||||||
|
ClientServices::s_currentConnection->CharacterLogin(id);
|
||||||
|
}
|
||||||
|
|
||||||
REALM_INFO* ClientServices::GetRealmInfoByIndex(int32_t index) {
|
REALM_INFO* ClientServices::GetRealmInfoByIndex(int32_t index) {
|
||||||
if (index >= ClientServices::GetInstance()->m_realmList.Count()) {
|
if (index >= ClientServices::GetInstance()->m_realmList.Count()) {
|
||||||
@ -264,6 +282,11 @@ const char* ClientServices::GetDefaultPatchListString() {
|
|||||||
return "public-test.patch.battle.net:1119/patch";
|
return "public-test.patch.battle.net:1119/patch";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool ClientServices::LoadCDKey() {
|
||||||
|
// TODO
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
void ClientServices::InitLoginServerCVars(int32_t overwrite, const char* locale) {
|
void ClientServices::InitLoginServerCVars(int32_t overwrite, const char* locale) {
|
||||||
if ((ClientServices::s_realmListBNVar == nullptr || ClientServices::s_realmListVar == nullptr) || overwrite != 0 ) {
|
if ((ClientServices::s_realmListBNVar == nullptr || ClientServices::s_realmListVar == nullptr) || overwrite != 0 ) {
|
||||||
ClientServices::s_decorateAccountName = CVar::Register(
|
ClientServices::s_decorateAccountName = CVar::Register(
|
||||||
|
@ -2,6 +2,8 @@
|
|||||||
#define CLIENT_CLIENT_SERVICES_HPP
|
#define CLIENT_CLIENT_SERVICES_HPP
|
||||||
|
|
||||||
#include "net/login/LoginResponse.hpp"
|
#include "net/login/LoginResponse.hpp"
|
||||||
|
#include "net/connection/NetClient.hpp"
|
||||||
|
#include <tempest/Vector.hpp>
|
||||||
|
|
||||||
class ClientConnection;
|
class ClientConnection;
|
||||||
class CVar;
|
class CVar;
|
||||||
@ -33,6 +35,10 @@ class ClientServices : public LoginResponse {
|
|||||||
static void ConnectToSelectedServer();
|
static void ConnectToSelectedServer();
|
||||||
static ClientConnection* Connection();
|
static ClientConnection* Connection();
|
||||||
static ClientServices* GetInstance();
|
static ClientServices* GetInstance();
|
||||||
|
static void SetMessageHandler(NETMESSAGE msgId, MESSAGE_HANDLER handler, void* param);
|
||||||
|
static void GetRealmList();
|
||||||
|
static void GetCharacterList();
|
||||||
|
static void CharacterLogin(uint64_t id, const C3Vector& position);
|
||||||
static REALM_INFO* GetRealmInfoByIndex(int32_t index);
|
static REALM_INFO* GetRealmInfoByIndex(int32_t index);
|
||||||
static const char* GetSelectedRealmName();
|
static const char* GetSelectedRealmName();
|
||||||
static const REALM_INFO* GetSelectedRealm();
|
static const REALM_INFO* GetSelectedRealm();
|
||||||
@ -45,6 +51,7 @@ class ClientServices : public LoginResponse {
|
|||||||
static void InitLoginServerCVars(int32_t overwrite, const char* locale);
|
static void InitLoginServerCVars(int32_t overwrite, const char* locale);
|
||||||
static const char* GetDefaultRealmlistString();
|
static const char* GetDefaultRealmlistString();
|
||||||
static const char* GetDefaultPatchListString();
|
static const char* GetDefaultPatchListString();
|
||||||
|
static bool LoadCDKey();
|
||||||
|
|
||||||
// Virtual member functions
|
// Virtual member functions
|
||||||
virtual int32_t GetLoginServerType();
|
virtual int32_t GetLoginServerType();
|
||||||
|
65
src/client/Patch.cpp
Normal file
65
src/client/Patch.cpp
Normal file
@ -0,0 +1,65 @@
|
|||||||
|
#include "client/Patch.hpp"
|
||||||
|
|
||||||
|
#include <storm/String.hpp>
|
||||||
|
|
||||||
|
#include "client/Client.hpp"
|
||||||
|
|
||||||
|
|
||||||
|
PatchFiles::PatchFiles() {
|
||||||
|
this->path = nullptr;
|
||||||
|
}
|
||||||
|
|
||||||
|
void PatchFiles::SearchArchives(const char* locale, int32_t a3) {
|
||||||
|
char fullPath[256] = {};
|
||||||
|
char pattern[256] = {};
|
||||||
|
char path[256] = {};
|
||||||
|
|
||||||
|
const size_t listSize = 12;
|
||||||
|
|
||||||
|
ListEntry list[listSize] = {
|
||||||
|
{ 0, 0, false, "Data\\", "patch-?.MPQ" },
|
||||||
|
{ 0, 0, false, "Data\\%s\\", "patch-%s-?.MPQ" },
|
||||||
|
{ 1, 0, false, "Data\\", "patch.MPQ" },
|
||||||
|
{ 1, 0, false, "Data\\%s\\", "patch-%s.MPQ" },
|
||||||
|
{ 1, 1, false, "Data\\", "patch-4.MPQ" },
|
||||||
|
{ 1, 1, false, "Data\\%s\\", "patch-%s-4.MPQ" },
|
||||||
|
{ 1, 1, false, "Data\\", "patch-3.MPQ" },
|
||||||
|
{ 1, 1, false, "Data\\%s\\", "patch-%s-3.MPQ" },
|
||||||
|
{ 1, 1, false, "..\\Data\\", "patch-2.MPQ" },
|
||||||
|
{ 1, 1, false, "..\\Data\\%s\\", "patch-%s-2.MPQ" },
|
||||||
|
{ 1, 1, false, "..\\Data\\", "patch.MPQ" },
|
||||||
|
{ 1, 1, false, "..\\Data\\%s\\", "patch-%s.MPQ" },
|
||||||
|
};
|
||||||
|
|
||||||
|
const char* installRoot = UpdateInstallLocation();
|
||||||
|
|
||||||
|
// Warning: assigning pointer to a temporary variable
|
||||||
|
// Need this for OsFileList's callback
|
||||||
|
this->path = path;
|
||||||
|
|
||||||
|
for (size_t i = 0; i <= 2; ++i) {
|
||||||
|
for (size_t j = 0; j < listSize; ++j) {
|
||||||
|
auto entry = &list[j];
|
||||||
|
if (entry->num1 != i || entry->num2 != (a3 != 0)) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
SStrPrintf(path, sizeof(path), entry->dataDir, locale);
|
||||||
|
SStrPrintf(pattern, sizeof(pattern), entry->pattern, locale);
|
||||||
|
if (entry->absolute && installRoot && installRoot[0]) {
|
||||||
|
SStrPrintf(fullPath, sizeof(fullPath), "%s%s", installRoot, path);
|
||||||
|
SStrCopy(path, fullPath, sizeof(path));
|
||||||
|
|
||||||
|
}
|
||||||
|
// TODO: OsFileList(this->path, pattern, PatchFiles::EnumPatchArchives, this, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (i == 0) {
|
||||||
|
std::qsort(this->files.Ptr(), this->files.Count(), sizeof(char*), &PatchFiles::qsortpatchfiles);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
int PatchFiles::qsortpatchfiles(const void* a1, const void* a2) {
|
||||||
|
return -SStrCmpI(*((const char**) a1), *((const char**) a2), STORM_MAX_STR);
|
||||||
|
}
|
33
src/client/Patch.hpp
Normal file
33
src/client/Patch.hpp
Normal file
@ -0,0 +1,33 @@
|
|||||||
|
#ifndef CLIENT_PATCH_HPP
|
||||||
|
#define CLIENT_PATCH_HPP
|
||||||
|
|
||||||
|
|
||||||
|
#include <storm/Array.hpp>
|
||||||
|
|
||||||
|
|
||||||
|
class PatchFiles {
|
||||||
|
public:
|
||||||
|
PatchFiles();
|
||||||
|
|
||||||
|
void SearchArchives(const char* locale, int32_t a3);
|
||||||
|
|
||||||
|
public:
|
||||||
|
char* path;
|
||||||
|
TSGrowableArray<char*> files;
|
||||||
|
|
||||||
|
private:
|
||||||
|
static int qsortpatchfiles(const void* a1, const void* a2);
|
||||||
|
|
||||||
|
private:
|
||||||
|
struct ListEntry {
|
||||||
|
uint32_t num1;
|
||||||
|
uint32_t num2;
|
||||||
|
bool absolute;
|
||||||
|
const char* dataDir;
|
||||||
|
const char* pattern;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#endif
|
16
src/clientobject/CMakeLists.txt
Normal file
16
src/clientobject/CMakeLists.txt
Normal file
@ -0,0 +1,16 @@
|
|||||||
|
file(GLOB PRIVATE_SOURCES "*.cpp")
|
||||||
|
|
||||||
|
add_library(clientobject STATIC
|
||||||
|
${PRIVATE_SOURCES}
|
||||||
|
)
|
||||||
|
|
||||||
|
target_include_directories(clientobject
|
||||||
|
PRIVATE
|
||||||
|
${CMAKE_SOURCE_DIR}/src
|
||||||
|
)
|
||||||
|
|
||||||
|
target_link_libraries(clientobject
|
||||||
|
PRIVATE
|
||||||
|
storm
|
||||||
|
db
|
||||||
|
)
|
43
src/clientobject/Unit_C.cpp
Normal file
43
src/clientobject/Unit_C.cpp
Normal file
@ -0,0 +1,43 @@
|
|||||||
|
#include "clientobject/Unit_C.hpp"
|
||||||
|
|
||||||
|
const char* CGUnit_C::GetDisplayRaceNameFromRecord(ChrRacesRec* record, uint8_t sexIn, uint8_t* sexOut) {
|
||||||
|
const char* result;
|
||||||
|
|
||||||
|
if (sexOut) {
|
||||||
|
*sexOut = sexIn;
|
||||||
|
}
|
||||||
|
if (!record) {
|
||||||
|
return nullptr;
|
||||||
|
}
|
||||||
|
if (!sexIn) {
|
||||||
|
if (record->m_nameMale[0]) {
|
||||||
|
return record->m_nameMale;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (record->m_nameFemale[0]) {
|
||||||
|
if (sexOut) {
|
||||||
|
*sexOut = 1;
|
||||||
|
}
|
||||||
|
return record->m_nameFemale;
|
||||||
|
}
|
||||||
|
|
||||||
|
return record->m_name;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (sexIn != 1) {
|
||||||
|
return record->m_name;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (record->m_nameFemale[0]) {
|
||||||
|
return record->m_nameFemale;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!record->m_nameMale[0]) {
|
||||||
|
return record->m_name;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (sexOut) {
|
||||||
|
*sexOut = 0;
|
||||||
|
}
|
||||||
|
return record->m_nameMale;
|
||||||
|
}
|
11
src/clientobject/Unit_C.hpp
Normal file
11
src/clientobject/Unit_C.hpp
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
#ifndef CLIENTOBJECT_UNIT_C_HPP
|
||||||
|
#define CLIENTOBJECT_UNIT_C_HPP
|
||||||
|
|
||||||
|
#include "db/rec/ChrRacesRec.hpp"
|
||||||
|
|
||||||
|
class CGUnit_C {
|
||||||
|
public:
|
||||||
|
static const char* GetDisplayRaceNameFromRecord(ChrRacesRec* record, uint8_t sexIn, uint8_t* sexOut = nullptr);
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif // CLIENTOBJECT_UNIT_C_HPP
|
@ -17,7 +17,7 @@ CVar* CVar::Lookup(const char* name) {
|
|||||||
: nullptr;
|
: nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
CVar* CVar::Register(const char* name, const char* help, uint32_t flags, const char* value, bool (*fcn)(CVar*, const char*, const char*, void*), uint32_t category, bool a7, void* arg, bool a9) {
|
CVar* CVar::Register(const char* name, const char* help, uint32_t flags, const char* value, bool (*fcn)(CVar*, const char*, const char*, void*), uint32_t category, bool setCommand, void* arg, bool a9) {
|
||||||
CVar* var = CVar::s_registeredCVars.Ptr(name);
|
CVar* var = CVar::s_registeredCVars.Ptr(name);
|
||||||
|
|
||||||
if (var) {
|
if (var) {
|
||||||
@ -36,7 +36,7 @@ CVar* CVar::Register(const char* name, const char* help, uint32_t flags, const c
|
|||||||
|
|
||||||
var->Set(value, setValue, setReset, setDefault, false);
|
var->Set(value, setValue, setReset, setDefault, false);
|
||||||
|
|
||||||
if (!a7) {
|
if (!setCommand) {
|
||||||
var->m_flags |= 0x80000000;
|
var->m_flags |= 0x80000000;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -59,7 +59,7 @@ CVar* CVar::Register(const char* name, const char* help, uint32_t flags, const c
|
|||||||
var->m_arg = arg;
|
var->m_arg = arg;
|
||||||
var->m_help.Copy(help);
|
var->m_help.Copy(help);
|
||||||
|
|
||||||
if (a7) {
|
if (setCommand) {
|
||||||
var->Set(value, true, true, false, false);
|
var->Set(value, true, true, false, false);
|
||||||
} else {
|
} else {
|
||||||
var->Set(value, true, false, true, false);
|
var->Set(value, true, false, true, false);
|
||||||
@ -67,7 +67,7 @@ CVar* CVar::Register(const char* name, const char* help, uint32_t flags, const c
|
|||||||
|
|
||||||
var->m_flags = flags | 0x1;
|
var->m_flags = flags | 0x1;
|
||||||
|
|
||||||
if (!a7) {
|
if (!setCommand) {
|
||||||
var->m_flags |= 0x8000000;
|
var->m_flags |= 0x8000000;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -6,6 +6,8 @@
|
|||||||
#include <storm/Hash.hpp>
|
#include <storm/Hash.hpp>
|
||||||
#include <bc/os/File.hpp>
|
#include <bc/os/File.hpp>
|
||||||
|
|
||||||
|
#include "console/Types.hpp"
|
||||||
|
|
||||||
class CVar : public TSHashObject<CVar, HASHKEY_STRI> {
|
class CVar : public TSHashObject<CVar, HASHKEY_STRI> {
|
||||||
public:
|
public:
|
||||||
// Static variables
|
// Static variables
|
||||||
@ -14,7 +16,17 @@ class CVar : public TSHashObject<CVar, HASHKEY_STRI> {
|
|||||||
|
|
||||||
// Static functions
|
// Static functions
|
||||||
static CVar* Lookup(const char* name);
|
static CVar* Lookup(const char* name);
|
||||||
static CVar* Register(const char*, const char*, uint32_t, const char*, bool (*)(CVar*, const char*, const char*, void*), uint32_t, bool, void*, bool);
|
static CVar* Register(
|
||||||
|
const char* name,
|
||||||
|
const char* help,
|
||||||
|
uint32_t flags,
|
||||||
|
const char* value,
|
||||||
|
bool (*fcn)(CVar*, const char*, const char*, void*) = nullptr,
|
||||||
|
uint32_t category = CATEGORY::DEFAULT,
|
||||||
|
bool setCommand = false,
|
||||||
|
void* arg = nullptr,
|
||||||
|
bool a9 = false
|
||||||
|
);
|
||||||
static void Initialize(const char* filename);
|
static void Initialize(const char* filename);
|
||||||
static int32_t Load(const char* filename);
|
static int32_t Load(const char* filename);
|
||||||
static int32_t Load(HOSFILE fileHandle);
|
static int32_t Load(HOSFILE fileHandle);
|
||||||
@ -37,7 +49,7 @@ class CVar : public TSHashObject<CVar, HASHKEY_STRI> {
|
|||||||
int32_t GetInt();
|
int32_t GetInt();
|
||||||
const char* GetString(void);
|
const char* GetString(void);
|
||||||
void InternalSet(const char*, bool, bool, bool, bool);
|
void InternalSet(const char*, bool, bool, bool, bool);
|
||||||
bool Set(const char*, bool, bool, bool, bool);
|
bool Set(const char* value, bool setValue, bool setReset, bool setDefault, bool a6);
|
||||||
bool Reset();
|
bool Reset();
|
||||||
bool Default();
|
bool Default();
|
||||||
int32_t Update();
|
int32_t Update();
|
||||||
|
@ -3,11 +3,32 @@
|
|||||||
#include "client/Gui.hpp"
|
#include "client/Gui.hpp"
|
||||||
#include "console/Console.hpp"
|
#include "console/Console.hpp"
|
||||||
#include "console/CVar.hpp"
|
#include "console/CVar.hpp"
|
||||||
|
#include "console/Command.hpp"
|
||||||
#include "event/Input.hpp"
|
#include "event/Input.hpp"
|
||||||
|
#include "gx/Gx.hpp"
|
||||||
#include "gx/Device.hpp"
|
#include "gx/Device.hpp"
|
||||||
#include <cstring>
|
#include <cstring>
|
||||||
#include <cstdio>
|
#include <cstdio>
|
||||||
|
|
||||||
|
|
||||||
|
CVar* s_cvHwDetect;
|
||||||
|
CVar* s_cvGxFixedFunction;
|
||||||
|
CVar* s_cvGxWindowResizeLock;
|
||||||
|
CVar* s_cvGxVideoOptionsVersion;
|
||||||
|
CVar* s_cvGxMaxFPSBk;
|
||||||
|
CVar* s_cvGxMaxFPS;
|
||||||
|
CVar* s_cvGxOverride;
|
||||||
|
CVar* s_cvGxStereoEnabled;
|
||||||
|
CVar* s_cvGxFixLag;
|
||||||
|
CVar* s_cvGxMultisampleQuality;
|
||||||
|
CVar* s_cvGxMultisample;
|
||||||
|
CVar* s_cvGxCursor;
|
||||||
|
CVar* s_cvGxAspect;
|
||||||
|
CVar* s_cvGxVSync;
|
||||||
|
CVar* s_cvGxTripleBuffer;
|
||||||
|
CVar* s_cvGxRefresh;
|
||||||
|
CVar* s_cvGxDepthBits;
|
||||||
|
CVar* s_cvGxColorBits;
|
||||||
CVar* s_cvGxMaximize;
|
CVar* s_cvGxMaximize;
|
||||||
CVar* s_cvGxResolution;
|
CVar* s_cvGxResolution;
|
||||||
CVar* s_cvGxWidescreen;
|
CVar* s_cvGxWidescreen;
|
||||||
@ -44,6 +65,87 @@ EGxApi g_gxApiSupported[] = {
|
|||||||
|
|
||||||
size_t g_numGxApiSupported = sizeof(g_gxApiSupported) / sizeof(EGxApi);
|
size_t g_numGxApiSupported = sizeof(g_gxApiSupported) / sizeof(EGxApi);
|
||||||
|
|
||||||
|
|
||||||
|
bool CVGxWindowResizeLockCallback(CVar*, const char*, const char*, void*) {
|
||||||
|
// TODO
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool GxVideoOptionsVersionCallback(CVar*, const char*, const char*, void*) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool CVGxMaxFPSBkCallback(CVar*, const char*, const char*, void*) {
|
||||||
|
// TODO
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool CVGxMaxFPSCallback(CVar*, const char*, const char*, void*) {
|
||||||
|
// TODO
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool CVGxOverrideCallback(CVar*, const char*, const char*, void*) {
|
||||||
|
// TODO
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool CVGxStereoEnabledCallback(CVar*, const char*, const char*, void*) {
|
||||||
|
// TODO
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool CVGxFixLagCallback(CVar*, const char*, const char*, void*) {
|
||||||
|
// TODO
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool CVGxMultisampleQualityCallback(CVar*, const char*, const char*, void*) {
|
||||||
|
// TODO
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool CVGxMultisampleCallback(CVar*, const char*, const char*, void*) {
|
||||||
|
// TODO
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool CVGxCursorCallback(CVar*, const char*, const char* value, void*) {
|
||||||
|
s_requestedFormat.hwCursor = SStrToInt(value) != 0;
|
||||||
|
ConsoleWrite("set pending gxRestart", DEFAULT_COLOR);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool CVGxAspectCallback(CVar*, const char*, const char*, void*) {
|
||||||
|
// TODO
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool CVGxVSyncCallback(CVar*, const char*, const char*, void*) {
|
||||||
|
// TODO
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool CVGxTripleBufferCallback(CVar*, const char*, const char*, void*) {
|
||||||
|
// TODO
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool CVGxRefreshCallback(CVar*, const char*, const char*, void*) {
|
||||||
|
// TODO
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool CVGxDepthBitsCallback(CVar*, const char*, const char*, void*) {
|
||||||
|
// TODO
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool CVGxColorBitsCallback(CVar*, const char*, const char*, void*) {
|
||||||
|
// TODO
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
bool CVGxMaximizeCallback(CVar*, const char*, const char*, void*) {
|
bool CVGxMaximizeCallback(CVar*, const char*, const char*, void*) {
|
||||||
// TODO
|
// TODO
|
||||||
return true;
|
return true;
|
||||||
@ -92,6 +194,11 @@ bool CVGxApiCallback(CVar* h, const char* oldValue, const char* newValue, void*
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int32_t CCGxRestart(const char*, const char*) {
|
||||||
|
// TODO
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
EGxApi GxApiDefault() {
|
EGxApi GxApiDefault() {
|
||||||
#if defined(WHOA_SYSTEM_WIN)
|
#if defined(WHOA_SYSTEM_WIN)
|
||||||
return GxApi_D3d9;
|
return GxApi_D3d9;
|
||||||
@ -107,112 +214,76 @@ EGxApi GxApiDefault() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void RegisterGxCVars() {
|
void RegisterGxCVars() {
|
||||||
auto& format = s_defaults.format;
|
const auto& format = s_defaults.format;
|
||||||
|
|
||||||
// TODO CURRENT_LANGUAGE check?
|
// TODO: bool isChinese = s_currentLocaleIndex == 4 (zhCN)
|
||||||
auto v1 = true;
|
bool isChinese = false;
|
||||||
|
|
||||||
s_cvGxWidescreen = CVar::Register(
|
const uint32_t graphics = CATEGORY::GRAPHICS;
|
||||||
"widescreen",
|
|
||||||
"Allow widescreen support",
|
|
||||||
0x0,
|
|
||||||
"1",
|
|
||||||
nullptr,
|
|
||||||
1,
|
|
||||||
false,
|
|
||||||
nullptr,
|
|
||||||
false
|
|
||||||
);
|
|
||||||
|
|
||||||
s_cvGxWindow = CVar::Register(
|
s_cvGxWidescreen = CVar::Register("widescreen", "Allow widescreen support", 0x0, "1", nullptr, graphics);
|
||||||
"gxWindow",
|
s_cvGxWindow = CVar::Register("gxWindow", "toggle fullscreen/window", 0x1 | 0x2, isChinese ? "1" : "0", &CVGxWindowCallback, graphics);
|
||||||
"toggle fullscreen/window",
|
s_cvGxMaximize = CVar::Register("gxMaximize", "maximize game window", 0x1 | 0x2, isChinese ? "1" : "0", &CVGxMaximizeCallback, graphics);
|
||||||
0x1 | 0x2,
|
|
||||||
v1 ? "1" : "0",
|
|
||||||
&CVGxWindowCallback,
|
|
||||||
1,
|
|
||||||
0,
|
|
||||||
0,
|
|
||||||
0
|
|
||||||
);
|
|
||||||
|
|
||||||
s_cvGxMaximize = CVar::Register(
|
char value[260] = {};
|
||||||
"gxMaximize",
|
SStrPrintf(value, sizeof(value), "%s", CGxFormat::formatToColorBitsString[format.colorFormat]);
|
||||||
"maximize game window",
|
s_cvGxColorBits = CVar::Register("gxColorBits", "color bits", 0x1 | 0x2, value, &CVGxColorBitsCallback, graphics);
|
||||||
0x1 | 0x2,
|
|
||||||
v1 ? "1" : "0",
|
|
||||||
&CVGxMaximizeCallback,
|
|
||||||
1,
|
|
||||||
0,
|
|
||||||
0,
|
|
||||||
0
|
|
||||||
);
|
|
||||||
|
|
||||||
// TODO s_cvGxColorBits
|
SStrPrintf(value, sizeof(value), "%s", CGxFormat::formatToColorBitsString[format.depthFormat]);
|
||||||
// TODO s_cvGxDepthBits
|
s_cvGxDepthBits = CVar::Register("gxDepthBits", "depth bits", 0x1 | 0x2, value, &CVGxDepthBitsCallback, graphics);
|
||||||
|
|
||||||
char resolution[260];
|
SStrPrintf(value, 260, "%dx%d", format.size.x, format.size.y);
|
||||||
SStrPrintf(resolution, 260, "%dx%d", format.size.x, format.size.y);
|
s_cvGxResolution = CVar::Register("gxResolution", "resolution", 0x1 | 0x2, value, &CVGxResolutionCallback, graphics);
|
||||||
s_cvGxResolution = CVar::Register(
|
|
||||||
"gxResolution",
|
|
||||||
"resolution",
|
|
||||||
0x1 | 0x2,
|
|
||||||
resolution,
|
|
||||||
&CVGxResolutionCallback,
|
|
||||||
1,
|
|
||||||
false,
|
|
||||||
nullptr,
|
|
||||||
false
|
|
||||||
);
|
|
||||||
|
|
||||||
// TODO s_cvGxRefresh
|
s_cvGxRefresh = CVar::Register("gxRefresh", "refresh rate", 0x1 | 0x2, "75", &CVGxRefreshCallback, graphics);
|
||||||
// TODO s_cvGxTripleBuffer
|
s_cvGxTripleBuffer = CVar::Register("gxTripleBuffer", "triple buffer", 0x1 | 0x2, "0", &CVGxTripleBufferCallback, graphics);
|
||||||
// TODO s_cvGxApi
|
s_cvGxApi = CVar::Register("gxApi", "graphics api", 0x1 | 0x2, g_gxApiNames[GxApiDefault()], &CVGxApiCallback, graphics);
|
||||||
|
|
||||||
s_cvGxApi = CVar::Register(
|
s_cvGxVSync = CVar::Register("gxVSync", "vsync on or off", 0x1 | 0x2, "1", &CVGxVSyncCallback, graphics);
|
||||||
"gxApi",
|
s_cvGxAspect = CVar::Register("gxAspect", "constrain window aspect", 0x1 | 0x2, "1", &CVGxAspectCallback, graphics);
|
||||||
"graphics api",
|
|
||||||
0x1 | 0x2,
|
|
||||||
g_gxApiNames[GxApiDefault()],
|
|
||||||
CVGxApiCallback,
|
|
||||||
1,
|
|
||||||
false,
|
|
||||||
nullptr,
|
|
||||||
false
|
|
||||||
);
|
|
||||||
|
|
||||||
// TODO s_cvGxVSync
|
s_cvGxCursor = CVar::Register("gxCursor", "toggle hardware cursor", 0x1 | 0x2, "1", &CVGxCursorCallback, graphics);
|
||||||
// TODO s_cvGxAspect
|
|
||||||
// TODO s_cvGxCursor
|
// TODO: v10 = *(_DWORD*)(dword_CABB60 + 84);
|
||||||
// TODO s_cvGxMultisample
|
int v10 = 0;
|
||||||
// TODO s_cvGxFixLag
|
SStrPrintf(value, sizeof(value), "%d", v10);
|
||||||
// TODO s_cvGxStereoEnabled
|
s_cvGxMultisample = CVar::Register("gxMultisample", "multisample", 0x1 | 0x2, value, &CVGxMultisampleCallback, graphics);
|
||||||
// TODO s_cvGxOverride
|
s_cvGxMultisampleQuality = CVar::Register("gxMultisampleQuality", "multisample quality", 0x1 | 0x2, "0.0", &CVGxMultisampleQualityCallback, graphics);
|
||||||
// TODO s_cvGxAspect
|
|
||||||
// TODO s_cvGxMaxFPS
|
// TODO: v10 = *(_DWORD*)(dword_CABB60 + 80);
|
||||||
// TODO s_cvGxMaxFPSBk
|
SStrPrintf(value, sizeof(value), "%d", v10);
|
||||||
// TODO s_cvWindowResizeLock
|
s_cvGxFixLag = CVar::Register("gxFixLag", "prevent cursor lag", 0x1 | 0x2, value, &CVGxFixLagCallback, graphics);
|
||||||
// TODO s_cvFixedFunction
|
s_cvGxStereoEnabled = CVar::Register("gxStereoEnabled", "Enable stereoscopic rendering", 0x1, "0", &CVGxStereoEnabledCallback, graphics);
|
||||||
|
s_cvGxOverride = CVar::Register("gxOverride", "gx overrides", 0x1, "", &CVGxOverrideCallback, graphics);
|
||||||
|
s_cvGxMaxFPS = CVar::Register("maxFPS", "Set FPS limit", 0x1, "200", &CVGxMaxFPSCallback, graphics);
|
||||||
|
s_cvGxMaxFPSBk = CVar::Register("maxFPSBk", "Set background FPS limit", 0x1, "30", &CVGxMaxFPSBkCallback, graphics);
|
||||||
|
s_cvGxVideoOptionsVersion = CVar::Register("videoOptionsVersion", "Video options version", 0x1 | 0x2, "0", &GxVideoOptionsVersionCallback, graphics);
|
||||||
|
s_cvGxWindowResizeLock = CVar::Register("windowResizeLock", "prevent resizing in windowed mode", 1, "0", &CVGxWindowResizeLockCallback, graphics);
|
||||||
|
s_cvGxFixedFunction = CVar::Register("fixedFunction", "Force fixed function rendering", 0x1 | 0x2, "0", 0, graphics);
|
||||||
}
|
}
|
||||||
|
|
||||||
void UpdateGxCVars() {
|
void UpdateGxCVars() {
|
||||||
// TODO others
|
s_cvGxColorBits->Update();
|
||||||
|
s_cvGxDepthBits->Update();
|
||||||
s_cvGxWindow->Update();
|
s_cvGxWindow->Update();
|
||||||
s_cvGxResolution->Update();
|
s_cvGxResolution->Update();
|
||||||
|
s_cvGxRefresh->Update();
|
||||||
// TODO others
|
s_cvGxTripleBuffer->Update();
|
||||||
|
s_cvGxApi->Update();
|
||||||
|
s_cvGxVSync->Update();
|
||||||
|
s_cvGxAspect->Update();
|
||||||
s_cvGxMaximize->Update();
|
s_cvGxMaximize->Update();
|
||||||
|
s_cvGxCursor->Update();
|
||||||
// TODO others
|
s_cvGxMultisample->Update();
|
||||||
|
s_cvGxMultisampleQuality->Update();
|
||||||
|
s_cvGxFixLag->Update();
|
||||||
}
|
}
|
||||||
|
|
||||||
void SetGxCVars(const CGxFormat& format) {
|
void SetGxCVars(const CGxFormat& format) {
|
||||||
char value[1024];
|
char value[1024] = {};
|
||||||
|
|
||||||
// TODO s_cvGxColorBits
|
s_cvGxColorBits->Set(CGxFormat::formatToColorBitsString[format.colorFormat], true, false, false, true);
|
||||||
// TODO s_cvGxDepthBits
|
s_cvGxDepthBits->Set(CGxFormat::formatToColorBitsString[format.depthFormat], true, false, false, true);
|
||||||
|
|
||||||
SStrPrintf(value, sizeof(value), "%d", format.window);
|
SStrPrintf(value, sizeof(value), "%d", format.window);
|
||||||
s_cvGxWindow->Set(value, true, false, false, true);
|
s_cvGxWindow->Set(value, true, false, false, true);
|
||||||
@ -220,43 +291,106 @@ void SetGxCVars(const CGxFormat& format) {
|
|||||||
SStrPrintf(value, sizeof(value), "%dx%d", format.size.x, format.size.y);
|
SStrPrintf(value, sizeof(value), "%dx%d", format.size.x, format.size.y);
|
||||||
s_cvGxResolution->Set(value, true, false, false, true);
|
s_cvGxResolution->Set(value, true, false, false, true);
|
||||||
|
|
||||||
// TODO s_cvGxRefresh
|
SStrPrintf(value, sizeof(value), "%d", format.refreshRate);
|
||||||
// TODO others
|
s_cvGxRefresh->Set(value, true, false, false, true);
|
||||||
|
|
||||||
|
// TODO: (format + 28) > 1
|
||||||
|
s_cvGxTripleBuffer->Set("0", true, false, false, true);
|
||||||
|
|
||||||
|
SStrPrintf(value, sizeof(value), "%d", format.vsync);
|
||||||
|
s_cvGxVSync->Set(value, true, false, false, true);
|
||||||
|
|
||||||
|
// TODO: format.aspectRatio
|
||||||
|
SStrPrintf(value, sizeof(value), "%d", 0);
|
||||||
|
s_cvGxAspect->Set(value, true, false, false, true);
|
||||||
|
|
||||||
SStrPrintf(value, sizeof(value), "%d", format.maximize);
|
SStrPrintf(value, sizeof(value), "%d", format.maximize);
|
||||||
s_cvGxMaximize->Set(value, true, false, false, true);
|
s_cvGxMaximize->Set(value, true, false, false, true);
|
||||||
|
|
||||||
// TODO others
|
SStrPrintf(value, sizeof(value), "%d", format.hwCursor);
|
||||||
|
s_cvGxCursor->Set(value, true, false, false, true);
|
||||||
|
|
||||||
|
SStrPrintf(value, sizeof(value), "%d", format.sampleCount);
|
||||||
|
s_cvGxMultisample->Set(value, true, false, false, true);
|
||||||
|
|
||||||
|
// TODO: format.multisampleQuality
|
||||||
|
SStrPrintf(value, sizeof(value), "%f", 0.0f);
|
||||||
|
s_cvGxMultisampleQuality->Set(value, true, false, false, true);
|
||||||
|
|
||||||
|
SStrPrintf(value, sizeof(value), "%d", format.fixLag);
|
||||||
|
s_cvGxFixLag->Set(value, true, false, false, true);
|
||||||
|
|
||||||
UpdateGxCVars();
|
UpdateGxCVars();
|
||||||
}
|
}
|
||||||
|
|
||||||
void ConsoleDeviceInitialize(const char* title) {
|
void ConsoleDeviceInitialize(const char* title) {
|
||||||
// TODO
|
GxLogOpen();
|
||||||
|
|
||||||
|
s_cvHwDetect = CVar::Register("hwDetect", "do hardware detection", 0x1, "1", nullptr, CATEGORY::GRAPHICS);
|
||||||
|
|
||||||
|
// TODO: sub_76BA30(&unk_CABB38, &byte_CABCBD); << ConsoleDetect
|
||||||
|
// TODO: byte_CABCBC = 1;
|
||||||
|
|
||||||
|
if (CmdLineGetBool(WOWCMD_HW_DETECT) || s_cvHwDetect->GetInt() != 0) {
|
||||||
|
s_hwDetect = true;
|
||||||
|
s_cvHwDetect->Set("0", true, false, false, true);
|
||||||
|
} else {
|
||||||
|
s_hwDetect = false;
|
||||||
|
}
|
||||||
|
|
||||||
// TODO proper logic
|
|
||||||
s_hwDetect = true;
|
|
||||||
|
|
||||||
ConsoleAccessSetEnabled(CmdLineGetBool(WOWCMD_CONSOLE));
|
ConsoleAccessSetEnabled(CmdLineGetBool(WOWCMD_CONSOLE));
|
||||||
|
|
||||||
// TODO
|
// TODO: sub_76B520(&unk_CABAF0, &unk_CABB38);
|
||||||
|
|
||||||
|
// CHANGE: Remove this when the rest will be ready
|
||||||
|
s_defaults.format.size.x = 1024;
|
||||||
|
s_defaults.format.size.y = 768;
|
||||||
|
s_defaults.format.colorFormat = CGxFormat::Fmt_Argb8888;
|
||||||
|
s_defaults.format.depthFormat = CGxFormat::Fmt_Ds248;
|
||||||
|
|
||||||
RegisterGxCVars();
|
RegisterGxCVars();
|
||||||
|
ConsoleCommandRegister("gxRestart", &CCGxRestart, CATEGORY::GRAPHICS, nullptr);
|
||||||
|
|
||||||
// TODO ConsoleCommandRegister("gxRestart", &CCGxRestart, 1, nullptr);
|
// TODO: GxAdapterMonitorModes((int)&unk_CABCC8);
|
||||||
|
// TODO: ValidateFormatMonitor(&unk_CABDA8);
|
||||||
|
|
||||||
// TODO
|
// TODO: if ( GxAdapterDesktopMode(&v28) )
|
||||||
|
if (true) {
|
||||||
|
s_requestedFormat.size.x = 1024;
|
||||||
|
s_requestedFormat.size.y = 768;
|
||||||
|
s_requestedFormat.colorFormat = CGxFormat::Fmt_Argb8888;
|
||||||
|
s_requestedFormat.depthFormat = CGxFormat::Fmt_Ds248;
|
||||||
|
}
|
||||||
|
|
||||||
// TODO
|
GxLog("ConsoleDeviceInitialize(): hwDetect = %d, hwChanged = %d", s_hwDetect, s_hwChanged);
|
||||||
// - source the size values correctly
|
|
||||||
s_requestedFormat.size.x = 1024;
|
if (CmdLineGetBool(WOWCMD_RES_800x600)) {
|
||||||
s_requestedFormat.size.y = 768;
|
s_requestedFormat.size.x = 800;
|
||||||
s_requestedFormat.colorFormat = CGxFormat::Fmt_Argb8888;
|
s_requestedFormat.size.y = 600;
|
||||||
s_requestedFormat.depthFormat = CGxFormat::Fmt_Ds248;
|
} else if (CmdLineGetBool(WOWCMD_RES_1024x768)) {
|
||||||
|
s_requestedFormat.size.x = 1024;
|
||||||
|
s_requestedFormat.size.y = 768;
|
||||||
|
} else if (CmdLineGetBool(WOWCMD_RES_1280x960)) {
|
||||||
|
s_requestedFormat.size.x = 1280;
|
||||||
|
s_requestedFormat.size.y = 960;
|
||||||
|
} else if (CmdLineGetBool(WOWCMD_RES_1280x1024)) {
|
||||||
|
s_requestedFormat.size.x = 1280;
|
||||||
|
s_requestedFormat.size.y = 1024;
|
||||||
|
} else if (CmdLineGetBool(WOWCMD_RES_1600x1200)) {
|
||||||
|
s_requestedFormat.size.x = 1600;
|
||||||
|
s_requestedFormat.size.y = 1200;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (s_cvGxFixedFunction->GetInt() != 0) {
|
||||||
|
// TODO: (dword_CABD20 = 0) s_requestedFormat.unknown_field = 0;
|
||||||
|
s_requestedFormat.pos.y = 0; // <--- CHECK THIS
|
||||||
|
s_requestedFormat.pos.x = 0;
|
||||||
|
}
|
||||||
|
|
||||||
if (s_hwDetect || s_hwChanged) {
|
if (s_hwDetect || s_hwChanged) {
|
||||||
// TODO Sub76B3F0(&UnkCABAF0, &UnkCABB38);
|
// TODO Sub76B3F0(&UnkCABAF0, &UnkCABB38);
|
||||||
// TODO s_cvFixedFunction->Set("0", 1, 0, 0, 1);
|
s_cvGxFixedFunction->Set("0", true, false, false, true);
|
||||||
// TODO memcpy(&s_requestedFormat, &s_defaults.format, sizeof(s_requestedFormat));
|
// TODO memcpy(&s_requestedFormat, &s_defaults.format, sizeof(s_requestedFormat));
|
||||||
|
|
||||||
s_requestedFormat.window = s_cvGxWindow->GetInt() != 0;
|
s_requestedFormat.window = s_cvGxWindow->GetInt() != 0;
|
||||||
@ -268,17 +402,6 @@ void ConsoleDeviceInitialize(const char* title) {
|
|||||||
SetGxCVars(s_requestedFormat);
|
SetGxCVars(s_requestedFormat);
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO
|
|
||||||
|
|
||||||
// TODO s_requestedFormat.hwTnL = !CmdLineGetBool(CMD_SW_TNL);
|
|
||||||
s_requestedFormat.hwTnL = true;
|
|
||||||
|
|
||||||
// TODO
|
|
||||||
|
|
||||||
CGxFormat format;
|
|
||||||
memcpy(&format, &s_requestedFormat, sizeof(s_requestedFormat));
|
|
||||||
|
|
||||||
// Select gxApi based on user CVars and command-line parameters
|
|
||||||
EGxApi api = GxApiDefault();
|
EGxApi api = GxApiDefault();
|
||||||
|
|
||||||
auto gxApiName = s_cvGxApi->GetString();
|
auto gxApiName = s_cvGxApi->GetString();
|
||||||
@ -286,6 +409,12 @@ void ConsoleDeviceInitialize(const char* title) {
|
|||||||
auto gxOverride = CmdLineGetString(WOWCMD_GX_OVERRIDE);
|
auto gxOverride = CmdLineGetString(WOWCMD_GX_OVERRIDE);
|
||||||
if (*gxOverride != '\0') {
|
if (*gxOverride != '\0') {
|
||||||
gxApiName = gxOverride;
|
gxApiName = gxOverride;
|
||||||
|
} else if (CmdLineGetBool(CMD_OPENGL)) {
|
||||||
|
gxApiName = g_gxApiNames[GxApi_OpenGl];
|
||||||
|
} else if (CmdLineGetBool(CMD_D3D)) {
|
||||||
|
gxApiName = g_gxApiNames[GxApi_D3d9];
|
||||||
|
} else if (CmdLineGetBool(CMD_D3D9EX)) {
|
||||||
|
gxApiName = g_gxApiNames[GxApi_D3d9Ex];
|
||||||
}
|
}
|
||||||
|
|
||||||
// Sanitize chosen gxApi against list of supported gxApis
|
// Sanitize chosen gxApi against list of supported gxApis
|
||||||
@ -297,13 +426,28 @@ void ConsoleDeviceInitialize(const char* title) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Log
|
s_requestedFormat.fixLag = s_cvGxFixLag->GetInt() != 0;
|
||||||
printf("GxApi_%s selected\n", g_gxApiNames[api]);
|
s_requestedFormat.hwTnL = !CmdLineGetBool(CMD_SW_TNL);
|
||||||
|
|
||||||
|
bool windowed = s_cvGxWindow->GetInt() != 0;
|
||||||
|
if (CmdLineGetBool(CMD_FULL_SCREEN)) {
|
||||||
|
windowed = false;
|
||||||
|
} else if (CmdLineGetBool(WOWCMD_WINDOWED)) {
|
||||||
|
windowed = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
s_requestedFormat.window = windowed;
|
||||||
|
// TODO: byte_CABD47 = windowed;
|
||||||
|
|
||||||
|
GxLog("GxApi_%s selected\n", g_gxApiNames[api]);
|
||||||
|
|
||||||
// Set internally (CVar value reflects the current gxApi at launch),
|
// Set internally (CVar value reflects the current gxApi at launch),
|
||||||
// this will not Set() as CVar gxApi is latched
|
// this will not Set() as CVar gxApi is latched
|
||||||
s_cvGxApi->InternalSet(g_gxApiNames[api], true, false, false, true);
|
s_cvGxApi->InternalSet(g_gxApiNames[api], true, false, false, true);
|
||||||
|
|
||||||
|
CGxFormat format;
|
||||||
|
memcpy(&format, &s_requestedFormat, sizeof(s_requestedFormat));
|
||||||
|
|
||||||
CGxDevice* device = GxDevCreate(api, OsWindowProc, format);
|
CGxDevice* device = GxDevCreate(api, OsWindowProc, format);
|
||||||
|
|
||||||
// TODO
|
// TODO
|
||||||
|
@ -8,6 +8,142 @@
|
|||||||
#include "event/sdl/Input.hpp"
|
#include "event/sdl/Input.hpp"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
static const uint32_t s_latin5lookup[256] = {
|
||||||
|
0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08,
|
||||||
|
0x09, 0x0A, 0x0B, 0x0C, 0x0D, 0x0E, 0x0F, 0x10, 0x11,
|
||||||
|
0x12, 0x13, 0x14, 0x15, 0x16, 0x17, 0x18, 0x19, 0x1A,
|
||||||
|
0x1B, 0x1C, 0x1D, 0x1E, 0x1F, 0x20, 0x21, 0x22, 0x23,
|
||||||
|
0x24, 0x25, 0x26, 0x27, 0x28, 0x29, 0x2A, 0x2B, 0x2C,
|
||||||
|
0x2D, 0x2E, 0x2F, 0x30, 0x31, 0x32, 0x33, 0x34, 0x35,
|
||||||
|
0x36, 0x37, 0x38, 0x39, 0x3A, 0x3B, 0x3C, 0x3D, 0x3E,
|
||||||
|
0x3F, 0x40, 0x41, 0x42, 0x43, 0x44, 0x45, 0x46, 0x47,
|
||||||
|
0x48, 0x49, 0x4A, 0x4B, 0x4C, 0x4D, 0x4E, 0x4F, 0x50,
|
||||||
|
0x51, 0x52, 0x53, 0x54, 0x55, 0x56, 0x57, 0x58, 0x59,
|
||||||
|
0x5A, 0x5B, 0x5C, 0x5D, 0x5E, 0x5F, 0x60, 0x61, 0x62,
|
||||||
|
0x63, 0x64, 0x65, 0x66, 0x67, 0x68, 0x69, 0x6A, 0x6B,
|
||||||
|
0x6C, 0x6D, 0x6E, 0x6F, 0x70, 0x71, 0x72, 0x73, 0x74,
|
||||||
|
0x75, 0x76, 0x77, 0x78, 0x79, 0x7A, 0x7B, 0x7C, 0x7D,
|
||||||
|
0x7E, 0x7F, 0x20AC, 0x20, 0x201A, 0x192, 0x201E, 0x2026, 0x2020,
|
||||||
|
0x2021, 0x2C6, 0x2030, 0x160, 0x2039, 0x152, 0x20, 0x20, 0x20,
|
||||||
|
0x20, 0x2018, 0x2019, 0x201C, 0x201D, 0x2022, 0x2013, 0x2014, 0x2DC,
|
||||||
|
0x2122, 0x161, 0x203A, 0x153, 0x20, 0x20, 0x178, 0x0A0, 0x0A1,
|
||||||
|
0x0A2, 0x0A3, 0x0A4, 0x0A5, 0x0A6, 0x0A7, 0x0A8, 0x0A9, 0x0AA,
|
||||||
|
0x0AB, 0x0AC, 0x0AD, 0x0AE, 0x0AF, 0x0B0, 0x0B1, 0x0B2, 0x0B3,
|
||||||
|
0x0B4, 0x0B5, 0x0B6, 0x0B7, 0x0B8, 0x0B9, 0x0BA, 0x0BB, 0x0BC,
|
||||||
|
0x0BD, 0x0BE, 0x0BF, 0x0C0, 0x0C1, 0x0C2, 0x0C3, 0x0C4, 0x0C5,
|
||||||
|
0x0C6, 0x0C7, 0x0C8, 0x0C9, 0x0CA, 0x0CB, 0x0CC, 0x0CD, 0x0CE,
|
||||||
|
0x0CF, 0x11E, 0x0D1, 0x0D2, 0x0D3, 0x0D4, 0x0D5, 0x0D6, 0x0D7,
|
||||||
|
0x0D8, 0x0D9, 0x0DA, 0x0DB, 0x0DC, 0x130, 0x15E, 0x0DF, 0x0E0,
|
||||||
|
0x0E1, 0x0E2, 0x0E3, 0x0E4, 0x0E5, 0x0E6, 0x0E7, 0x0E8, 0x0E9,
|
||||||
|
0x0EA, 0x0EB, 0x0EC, 0x0ED, 0x0EE, 0x0EF, 0x11F, 0x0F1, 0x0F2,
|
||||||
|
0x0F3, 0x0F4, 0x0F5, 0x0F6, 0x0F7, 0x0F8, 0x0F9, 0x0FA, 0x0FB,
|
||||||
|
0x0FC, 0x131, 0x15F, 0x0FF
|
||||||
|
};
|
||||||
|
|
||||||
|
static const uint32_t s_latin1lookup[32] = {
|
||||||
|
0x0FFFE, 0x0FFFE, 0x201A, 0x192, 0x201E, 0x2026, 0x2020, 0x2021,
|
||||||
|
0x2C6, 0x2030, 0x160, 0x2039, 0x152, 0x0FFFE, 0x0FFFE, 0x0FFFE,
|
||||||
|
0x0FFFE, 0x2018, 0x2019, 0x201C, 0x201D, 0x2022, 0x2013, 0x2014,
|
||||||
|
0x2DC, 0x2122, 0x161, 0x203A, 0x153, 0x0FFFE, 0x0FFFE, 0x178
|
||||||
|
};
|
||||||
|
|
||||||
|
static const uint32_t s_cyrilliclookup[256] = {
|
||||||
|
0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08,
|
||||||
|
0x09, 0x0A, 0x0B, 0x0C, 0x0D, 0x0E, 0x0F, 0x10, 0x11,
|
||||||
|
0x12, 0x13, 0x14, 0x15, 0x16, 0x17, 0x18, 0x19, 0x1A,
|
||||||
|
0x1B, 0x1C, 0x1D, 0x1E, 0x1F, 0x20, 0x21, 0x22, 0x23,
|
||||||
|
0x24, 0x25, 0x26, 0x27, 0x28, 0x29, 0x2A, 0x2B, 0x2C,
|
||||||
|
0x2D, 0x2E, 0x2F, 0x30, 0x31, 0x32, 0x33, 0x34, 0x35,
|
||||||
|
0x36, 0x37, 0x38, 0x39, 0x3A, 0x3B, 0x3C, 0x3D, 0x3E,
|
||||||
|
0x3F, 0x40, 0x41, 0x42, 0x43, 0x44, 0x45, 0x46, 0x47,
|
||||||
|
0x48, 0x49, 0x4A, 0x4B, 0x4C, 0x4D, 0x4E, 0x4F, 0x50,
|
||||||
|
0x51, 0x52, 0x53, 0x54, 0x55, 0x56, 0x57, 0x58, 0x59,
|
||||||
|
0x5A, 0x5B, 0x5C, 0x5D, 0x5E, 0x5F, 0x60, 0x61, 0x62,
|
||||||
|
0x63, 0x64, 0x65, 0x66, 0x67, 0x68, 0x69, 0x6A, 0x6B,
|
||||||
|
0x6C, 0x6D, 0x6E, 0x6F, 0x70, 0x71, 0x72, 0x73, 0x74,
|
||||||
|
0x75, 0x76, 0x77, 0x78, 0x79, 0x7A, 0x7B, 0x7C, 0x7D,
|
||||||
|
0x7E, 0x7F, 0x402, 0x403, 0x201A, 0x453, 0x201E, 0x2026, 0x2020,
|
||||||
|
0x2021, 0x20AC, 0x2030, 0x409, 0x2039, 0x40A, 0x40C, 0x40B, 0x40F,
|
||||||
|
0x452, 0x2018, 0x2019, 0x201C, 0x201D, 0x2022, 0x2013, 0x2014, 0x20,
|
||||||
|
0x2122, 0x459, 0x203A, 0x45A, 0x45C, 0x45B, 0x45F, 0x0A0, 0x40E,
|
||||||
|
0x45E, 0x408, 0x0A4, 0x490, 0x0A6, 0x0A7, 0x401, 0x0A9, 0x404,
|
||||||
|
0x0AB, 0x0AC, 0x0AD, 0x0AE, 0x407, 0x0B0, 0x0B1, 0x406, 0x456,
|
||||||
|
0x491, 0x0B5, 0x0B6, 0x0B7, 0x451, 0x2116, 0x454, 0x0BB, 0x458,
|
||||||
|
0x405, 0x455, 0x457, 0x410, 0x411, 0x412, 0x413, 0x414, 0x415,
|
||||||
|
0x416, 0x417, 0x418, 0x419, 0x41A, 0x41B, 0x41C, 0x41D, 0x41E,
|
||||||
|
0x41F, 0x420, 0x421, 0x422, 0x423, 0x424, 0x425, 0x426, 0x427,
|
||||||
|
0x428, 0x429, 0x42A, 0x42B, 0x42C, 0x42D, 0x42E, 0x42F, 0x430,
|
||||||
|
0x431, 0x432, 0x433, 0x434, 0x435, 0x436, 0x437, 0x438, 0x439,
|
||||||
|
0x43A, 0x43B, 0x43C, 0x43D, 0x43E, 0x43F, 0x440, 0x441, 0x442,
|
||||||
|
0x443, 0x444, 0x445, 0x446, 0x447, 0x448, 0x449, 0x44A, 0x44B,
|
||||||
|
0x44C, 0x44D, 0x44E, 0x44F
|
||||||
|
};
|
||||||
|
|
||||||
|
static const uint32_t s_latin2lookup[256] = {
|
||||||
|
0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08,
|
||||||
|
0x09, 0x0A, 0x0B, 0x0C, 0x0D, 0x0E, 0x0F, 0x10, 0x11,
|
||||||
|
0x12, 0x13, 0x14, 0x15, 0x16, 0x17, 0x18, 0x19, 0x1A,
|
||||||
|
0x1B, 0x1C, 0x1D, 0x1E, 0x1F, 0x20, 0x21, 0x22, 0x23,
|
||||||
|
0x24, 0x25, 0x26, 0x27, 0x28, 0x29, 0x2A, 0x2B, 0x2C,
|
||||||
|
0x2D, 0x2E, 0x2F, 0x30, 0x31, 0x32, 0x33, 0x34, 0x35,
|
||||||
|
0x36, 0x37, 0x38, 0x39, 0x3A, 0x3B, 0x3C, 0x3D, 0x3E,
|
||||||
|
0x3F, 0x40, 0x41, 0x42, 0x43, 0x44, 0x45, 0x46, 0x47,
|
||||||
|
0x48, 0x49, 0x4A, 0x4B, 0x4C, 0x4D, 0x4E, 0x4F, 0x50,
|
||||||
|
0x51, 0x52, 0x53, 0x54, 0x55, 0x56, 0x57, 0x58, 0x59,
|
||||||
|
0x5A, 0x5B, 0x5C, 0x5D, 0x5E, 0x5F, 0x60, 0x61, 0x62,
|
||||||
|
0x63, 0x64, 0x65, 0x66, 0x67, 0x68, 0x69, 0x6A, 0x6B,
|
||||||
|
0x6C, 0x6D, 0x6E, 0x6F, 0x70, 0x71, 0x72, 0x73, 0x74,
|
||||||
|
0x75, 0x76, 0x77, 0x78, 0x79, 0x7A, 0x7B, 0x7C, 0x7D,
|
||||||
|
0x7E, 0x7F, 0x20AC, 0x0FFFE, 0x201A, 0x0FFFE, 0x201E, 0x2026, 0x2020,
|
||||||
|
0x2021, 0x0FFFE, 0x2030, 0x160, 0x2039, 0x15A, 0x164, 0x17D, 0x179,
|
||||||
|
0x0FFFE, 0x2018, 0x2019, 0x201C, 0x201D, 0x2022, 0x2013, 0x2014, 0x0FFFE,
|
||||||
|
0x2122, 0x161, 0x203A, 0x15B, 0x165, 0x17E, 0x17A, 0x0A0, 0x2C7,
|
||||||
|
0x2D8, 0x141, 0x0A4, 0x104, 0x0A6, 0x0A7, 0x0A8, 0x0A9, 0x15E,
|
||||||
|
0x0AB, 0x0AC, 0x0AD, 0x0AE, 0x17B, 0x0B0, 0x0B1, 0x2DB, 0x142,
|
||||||
|
0x0B4, 0x0B5, 0x0B6, 0x0B7, 0x0B8, 0x105, 0x15F, 0x0BB, 0x13D,
|
||||||
|
0x2DD, 0x13E, 0x17C, 0x154, 0x0C1, 0x0C2, 0x102, 0x0C4, 0x139,
|
||||||
|
0x106, 0x0C7, 0x10C, 0x0C9, 0x118, 0x0CB, 0x11A, 0x0CD, 0x0CE,
|
||||||
|
0x10E, 0x110, 0x143, 0x147, 0x0D3, 0x0D4, 0x150, 0x0D6, 0x0D7,
|
||||||
|
0x158, 0x16E, 0x0DA, 0x170, 0x0DC, 0x0DD, 0x162, 0x0DF, 0x155,
|
||||||
|
0x0E1, 0x0E2, 0x103, 0x0E4, 0x13A, 0x107, 0x0E7, 0x10D, 0x0E9,
|
||||||
|
0x119, 0x0EB, 0x11B, 0x0ED, 0x0EE, 0x10F, 0x111, 0x144, 0x148,
|
||||||
|
0x0F3, 0x0F4, 0x151, 0x0F6, 0x0F7, 0x159, 0x16F, 0x0FA, 0x171,
|
||||||
|
0x0FC, 0x0FD, 0x163, 0x2D9
|
||||||
|
};
|
||||||
|
|
||||||
|
static const uint32_t s_thailookup[256] = {
|
||||||
|
0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08,
|
||||||
|
0x09, 0x0A, 0x0B, 0x0C, 0x0D, 0x0E, 0x0F, 0x10, 0x11,
|
||||||
|
0x12, 0x13, 0x14, 0x15, 0x16, 0x17, 0x18, 0x19, 0x1A,
|
||||||
|
0x1B, 0x1C, 0x1D, 0x1E, 0x1F, 0x20, 0x21, 0x22, 0x23,
|
||||||
|
0x24, 0x25, 0x26, 0x27, 0x28, 0x29, 0x2A, 0x2B, 0x2C,
|
||||||
|
0x2D, 0x2E, 0x2F, 0x30, 0x31, 0x32, 0x33, 0x34, 0x35,
|
||||||
|
0x36, 0x37, 0x38, 0x39, 0x3A, 0x3B, 0x3C, 0x3D, 0x3E,
|
||||||
|
0x3F, 0x40, 0x41, 0x42, 0x43, 0x44, 0x45, 0x46, 0x47,
|
||||||
|
0x48, 0x49, 0x4A, 0x4B, 0x4C, 0x4D, 0x4E, 0x4F, 0x50,
|
||||||
|
0x51, 0x52, 0x53, 0x54, 0x55, 0x56, 0x57, 0x58, 0x59,
|
||||||
|
0x5A, 0x5B, 0x5C, 0x5D, 0x5E, 0x5F, 0x60, 0x61, 0x62,
|
||||||
|
0x63, 0x64, 0x65, 0x66, 0x67, 0x68, 0x69, 0x6A, 0x6B,
|
||||||
|
0x6C, 0x6D, 0x6E, 0x6F, 0x70, 0x71, 0x72, 0x73, 0x74,
|
||||||
|
0x75, 0x76, 0x77, 0x78, 0x79, 0x7A, 0x7B, 0x7C, 0x7D,
|
||||||
|
0x7E, 0x7F, 0x20AC, 0x20, 0x20, 0x20, 0x20, 0x2026, 0x20,
|
||||||
|
0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
|
||||||
|
0x20, 0x2018, 0x2019, 0x201C, 0x201D, 0x2022, 0x2013, 0x2014, 0x20,
|
||||||
|
0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x0A0, 0x0E01,
|
||||||
|
0x0E02, 0x0E03, 0x0E04, 0x0E05, 0x0E06, 0x0E07, 0x0E08, 0x0E09, 0x0E0A,
|
||||||
|
0x0E0B, 0x0E0C, 0x0E0D, 0x0E0E, 0x0E0F, 0x0E10, 0x0E11, 0x0E12, 0x0E13,
|
||||||
|
0x0E14, 0x0E15, 0x0E16, 0x0E17, 0x0E18, 0x0E19, 0x0E1A, 0x0E1B, 0x0E1C,
|
||||||
|
0x0E1D, 0x0E1E, 0x0E1F, 0x0E20, 0x0E21, 0x0E22, 0x0E23, 0x0E24, 0x0E25,
|
||||||
|
0x0E26, 0x0E27, 0x0E28, 0x0E29, 0x0E2A, 0x0E2B, 0x0E2C, 0x0E2D, 0x0E2E,
|
||||||
|
0x0E2F, 0x0E30, 0x0E31, 0x0E32, 0x0E33, 0x0E34, 0x0E35, 0x0E36, 0x0E37,
|
||||||
|
0x0E38, 0x0E39, 0x0E3A, 0x20, 0x20, 0x20, 0x20, 0x0E3F, 0x0E40,
|
||||||
|
0x0E41, 0x0E42, 0x0E43, 0x0E44, 0x0E45, 0x0E46, 0x0E47, 0x0E48, 0x0E49,
|
||||||
|
0x0E4A, 0x0E4B, 0x0E4C, 0x0E4D, 0x0E4E, 0x0E4F, 0x0E50, 0x0E51, 0x0E52,
|
||||||
|
0x0E53, 0x0E54, 0x0E55, 0x0E56, 0x0E57, 0x0E58, 0x0E59, 0x0E5A, 0x0E5B,
|
||||||
|
0x20, 0x20, 0x20, 0x20
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
static RECT s_defaultWindowRect;
|
static RECT s_defaultWindowRect;
|
||||||
static int32_t s_savedResize;
|
static int32_t s_savedResize;
|
||||||
|
|
||||||
@ -469,7 +605,13 @@ void OsInputGetMousePosition(int32_t* x, int32_t* y) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
uint32_t OsInputGetCodePage() {
|
||||||
|
return ::GetACP();
|
||||||
|
}
|
||||||
|
|
||||||
int32_t OsWindowProc(void* window, uint32_t message, uintptr_t wparam, intptr_t lparam) {
|
int32_t OsWindowProc(void* window, uint32_t message, uintptr_t wparam, intptr_t lparam) {
|
||||||
|
static uint32_t s_codepage = 0;
|
||||||
|
|
||||||
auto hwnd = static_cast<HWND>(window);
|
auto hwnd = static_cast<HWND>(window);
|
||||||
|
|
||||||
// TODO
|
// TODO
|
||||||
@ -539,11 +681,28 @@ int32_t OsWindowProc(void* window, uint32_t message, uintptr_t wparam, intptr_t
|
|||||||
uint32_t character = wparam;
|
uint32_t character = wparam;
|
||||||
|
|
||||||
if (wparam >= 128) {
|
if (wparam >= 128) {
|
||||||
// TODO
|
if (s_codepage == 0) {
|
||||||
|
s_codepage = OsInputGetCodePage();
|
||||||
|
}
|
||||||
|
if (s_codepage == 1254) {
|
||||||
|
// ANSI Turkish; Turkish (Windows)
|
||||||
|
character = s_latin5lookup[wparam % 256];
|
||||||
|
} else if (s_codepage == 1252 && wparam < 0xA0) {
|
||||||
|
// ANSI Latin 1; Western European (Windows)
|
||||||
|
character = s_latin1lookup[wparam % 32];
|
||||||
|
} else if (s_codepage == 1251) {
|
||||||
|
// ANSI Cyrillic; Cyrillic (Windows)
|
||||||
|
character = s_cyrilliclookup[wparam % 256];
|
||||||
|
} else if (s_codepage == 1250) {
|
||||||
|
// ANSI Central European; Central European (Windows)
|
||||||
|
character = s_latin2lookup[wparam % 256];
|
||||||
|
} else if (s_codepage == 874) {
|
||||||
|
// Thai (Windows)
|
||||||
|
character = s_thailookup[wparam % 256];
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
OsQueuePut(OS_INPUT_CHAR, character, LOWORD(lparam), 0, 0);
|
OsQueuePut(OS_INPUT_CHAR, character, LOWORD(lparam), 0, 0);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
191
src/gameui/CGGameUI.cpp
Normal file
191
src/gameui/CGGameUI.cpp
Normal file
@ -0,0 +1,191 @@
|
|||||||
|
#include "gameui/CGGameUI.hpp"
|
||||||
|
|
||||||
|
#include <common/MD5.hpp>
|
||||||
|
#include <storm/Log.hpp>
|
||||||
|
|
||||||
|
#include "client/Client.hpp"
|
||||||
|
#include "gameui/CGWorldFrame.hpp"
|
||||||
|
#include "gx/Coordinate.hpp"
|
||||||
|
#include "gx/Device.hpp"
|
||||||
|
#include "ui/FrameScript.hpp"
|
||||||
|
#include "ui/FrameXML.hpp"
|
||||||
|
#include "glue/CGlueMgr.hpp"
|
||||||
|
#include "util/CStatus.hpp"
|
||||||
|
#include "util/SysMessage.hpp"
|
||||||
|
#include "util/SFile.hpp"
|
||||||
|
|
||||||
|
|
||||||
|
bool CGGameUI::m_reloadUI = 0;
|
||||||
|
CSimpleTop* CGGameUI::m_simpleTop = nullptr;
|
||||||
|
CSimpleFrame* CGGameUI::m_UISimpleParent = nullptr;
|
||||||
|
int32_t CGGameUI::m_hasControl = 0;
|
||||||
|
int32_t CGGameUI::m_screenWidth = 0;
|
||||||
|
int32_t CGGameUI::m_screenHeight = 0;
|
||||||
|
float CGGameUI::m_aspect = 0.0;
|
||||||
|
|
||||||
|
|
||||||
|
void CGGameUI::InitializeGame() {
|
||||||
|
// TODO
|
||||||
|
|
||||||
|
CGGameUI::m_hasControl = 1;
|
||||||
|
CGGameUI::Initialize();
|
||||||
|
}
|
||||||
|
|
||||||
|
void CGGameUI::Initialize() {
|
||||||
|
// TODO:
|
||||||
|
// sub_4CFB80();
|
||||||
|
// s_taintLogCVar =
|
||||||
|
// s_scriptProfileCVar =
|
||||||
|
|
||||||
|
//CGGameUI::s_loggingIn = 1;
|
||||||
|
//CGGameUI::m_reloadUIRequested = 0;
|
||||||
|
//CGGameUI::m_repopTime = 0;
|
||||||
|
//CGGameUI::m_deadNoRepopTimer = 0;
|
||||||
|
//CGGameUI::m_corpseReclaimDelay = 0;
|
||||||
|
//CGGameUI::m_instanceBootTime = 0;
|
||||||
|
//CGGameUI::m_instanceLockTime = 0;
|
||||||
|
//CGGameUI::m_instanceLockComletedMask = 0;
|
||||||
|
//CGGameUI::m_instanceLockExtending = 0;
|
||||||
|
//CGGameUI::m_summonConfirmTime = 0;
|
||||||
|
|
||||||
|
CRect screenRect;
|
||||||
|
g_theGxDevicePtr->CapsWindowSizeInScreenCoords(screenRect);
|
||||||
|
|
||||||
|
CGGameUI::m_screenWidth = 0;
|
||||||
|
CGGameUI::m_screenHeight = 0;
|
||||||
|
|
||||||
|
CGGameUI::m_aspect = CalculateAspectRatio();
|
||||||
|
CoordinateSetAspectRatio(CGGameUI::m_aspect);
|
||||||
|
|
||||||
|
auto m = SMemAlloc(sizeof(CSimpleTop), __FILE__, __LINE__, 0x0);
|
||||||
|
CGGameUI::m_simpleTop = new (m) CSimpleTop();
|
||||||
|
//CGGameUI::m_simpleTop->m_mouseButtonCallback = CGGameUI::FilterMouseButton;
|
||||||
|
//CGGameUI::m_simpleTop->m_mouseMoveCallback = CGGameUI::FilterMouseMotion;
|
||||||
|
CGGameUI::m_simpleTop->m_displaySizeCallback = &CGGameUI::HandleDisplaySizeChanged;
|
||||||
|
//CGGameUI::m_simpleTop->dword1244 = (uint32_t)CGGameUI::HandleFocusChanged;
|
||||||
|
//CGGameUI::m_simpleTop->dword124C = 1;
|
||||||
|
//CGGameUI::m_simpleTop->dword1254 = (uint32_t)CGGameUI::ShowBlockedFrameFeedback;
|
||||||
|
|
||||||
|
//CursorInitialize();
|
||||||
|
//auto activeInputControl = CGInputControl::GetActive();
|
||||||
|
//STORM_ASSERT(activeInputControl);
|
||||||
|
//CGInputControl::UpdateMouseMode((int)Active, 1);
|
||||||
|
|
||||||
|
FrameScript_Flush();
|
||||||
|
//LoadScriptFunctions();
|
||||||
|
FrameScript_CreateEvents(g_scriptEvents, 722);
|
||||||
|
//CGGameUI::RegisterGameCVars();
|
||||||
|
//CGUIBindings::Initialize();
|
||||||
|
|
||||||
|
CGGameUI::RegisterFrameFactories();
|
||||||
|
|
||||||
|
// STORM_ASSERT(GetDataInterfaceVersion() == GetCodeInterfaceVersion())
|
||||||
|
|
||||||
|
CWOWClientStatus status;
|
||||||
|
|
||||||
|
// OsCreateDirectory("Logs", 0);
|
||||||
|
if (!SLogCreate("Logs\\FrameXML.log", 0, &status.m_logFile)) {
|
||||||
|
SysMsgPrintf(SYSMSG_WARNING, "Cannot create WOWClient log file \"%s\"!", "Logs\\FrameXML.log");
|
||||||
|
}
|
||||||
|
|
||||||
|
//LoadAddOnEnableState(ClientServices::GetCharacterName());
|
||||||
|
|
||||||
|
MD5_CTX md5;
|
||||||
|
MD5Init(&md5);
|
||||||
|
|
||||||
|
unsigned char digest1[16];
|
||||||
|
|
||||||
|
switch (FrameXML_CheckSignature("Interface\\FrameXML\\FrameXML.toc", "Interface\\FrameXML\\Bindings.xml", nullptr, digest1)) {
|
||||||
|
case 0:
|
||||||
|
status.Add(STATUS_WARNING, "FrameXML missing signature");
|
||||||
|
ClientPostClose(10);
|
||||||
|
break;
|
||||||
|
case 1:
|
||||||
|
status.Add(STATUS_WARNING, "FrameXML has corrupt signature");
|
||||||
|
ClientPostClose(10);
|
||||||
|
break;
|
||||||
|
case 2:
|
||||||
|
status.Add(STATUS_WARNING, "FrameXML is modified or corrupt");
|
||||||
|
ClientPostClose(10);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 3:
|
||||||
|
break;
|
||||||
|
|
||||||
|
default:
|
||||||
|
ClientPostClose(10);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
int32_t numFiles = 0;
|
||||||
|
char* data = nullptr;
|
||||||
|
if (SFile::Load(nullptr, "Interface\\FrameXML\\FrameXML.toc", (void**)&data, nullptr, 1, 1, nullptr)) {
|
||||||
|
numFiles = FrameXML_GuessNumFiles(data);
|
||||||
|
SMemFree(data);
|
||||||
|
}
|
||||||
|
|
||||||
|
//numFiles += LoadAddOnFileCount();
|
||||||
|
|
||||||
|
//FrameXML_RegisterLoadProgressCallback(&LoadingScreenXMLCallback, 0, numFiles);
|
||||||
|
FrameXML_FreeHashNodes();
|
||||||
|
FrameXML_CreateFrames("Interface\\FrameXML\\FrameXML.toc", 0, &md5, &status);
|
||||||
|
|
||||||
|
//if (SFile__FileExistsEx((void*)"Interface\\FrameXML\\Bindings.xml", 1))
|
||||||
|
// CGUIBindings::Load("Interface\\FrameXML\\Bindings.xml", &md5, &status);
|
||||||
|
|
||||||
|
unsigned char digest2[16];
|
||||||
|
MD5Final(digest2, &md5);
|
||||||
|
if (memcmp(digest1, digest2, 16)) {
|
||||||
|
// DO NOTHING FOR NOW
|
||||||
|
//ClientPostClose(10);
|
||||||
|
}
|
||||||
|
|
||||||
|
int32_t objectType = CSimpleFrame::GetObjectType();
|
||||||
|
CGGameUI::m_UISimpleParent = (CSimpleFrame*) CScriptObject::GetScriptObjectByName("UIParent", objectType);
|
||||||
|
STORM_ASSERT(CGGameUI::m_UISimpleParent);
|
||||||
|
|
||||||
|
// TODO: CGGameUI::m_gameTooltip = ...
|
||||||
|
|
||||||
|
//LoadAddOns((int)v23);
|
||||||
|
//FrameXML_RegisterLoadProgressCallback(0, 0, 0);
|
||||||
|
//CGGameUI::RegisterUIScaleCVars();
|
||||||
|
//CGGameUI::SomeSavedAccountVariables((int)v23);
|
||||||
|
//LoadAccountData(6, (int(__cdecl*)(int, int, int))sub_5183A0, 0);
|
||||||
|
//CGGameUI::UpdateInitCounter();
|
||||||
|
//CGUIBindings::LoadBindings();
|
||||||
|
//CGUIMacros::Initialize();
|
||||||
|
//CGUIMacros::LoadMacros();
|
||||||
|
//CGChat::LoadChatSettings();
|
||||||
|
//CSimpleScriptManager::Create();
|
||||||
|
|
||||||
|
CSizeEvent sizeEvent;
|
||||||
|
sizeEvent.w = screenRect.maxX - screenRect.minX;
|
||||||
|
sizeEvent.h = screenRect.maxY - screenRect.minY;
|
||||||
|
|
||||||
|
CGGameUI::HandleDisplaySizeChanged(sizeEvent);
|
||||||
|
//CGGameUI::m_initialized = 1;
|
||||||
|
//EventRegister((LPCGUID)6, (PENABLECALLBACK)CGGameUI::Idle, v11, v12);
|
||||||
|
|
||||||
|
//TODO: GxDeviceCallbacks
|
||||||
|
|
||||||
|
//if (ClntObjMgrGetActivePlayer()) {
|
||||||
|
// CGGameUI::EnterWorld();
|
||||||
|
//}
|
||||||
|
//sub_4CFB90();
|
||||||
|
//CGGameUI::m_currentlyReloadingUI = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
void CGGameUI::RegisterFrameFactories() {
|
||||||
|
FrameXML_RegisterFactory("WorldFrame", CGWorldFrame::Create, 1);
|
||||||
|
//FrameXML_RegisterFactory("GameTooltip", (int)CGTooltip::Create, 0);
|
||||||
|
//FrameXML_RegisterFactory("Cooldown", (int)sub_51A380, 0);
|
||||||
|
//FrameXML_RegisterFactory("Minimap", (int)CGMinimapFrame::Create, 0);
|
||||||
|
//FrameXML_RegisterFactory("PlayerModel", (int)CGCharacterModelBase::Create, 0);
|
||||||
|
//FrameXML_RegisterFactory("DressUpModel", (int)sub_514300, 0);
|
||||||
|
//FrameXML_RegisterFactory("TabardModel", (int)CGTabardModelFrame::Create, 0);
|
||||||
|
//FrameXML_RegisterFactory("QuestPOIFrame", (int)sub_514260, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
int32_t CGGameUI::HandleDisplaySizeChanged(const CSizeEvent& event) {
|
||||||
|
return 0;
|
||||||
|
}
|
26
src/gameui/CGGameUI.hpp
Normal file
26
src/gameui/CGGameUI.hpp
Normal file
@ -0,0 +1,26 @@
|
|||||||
|
#ifndef GAME_UI_CGGAMEUI_HPP
|
||||||
|
#define GAME_UI_CGGAMEUI_HPP
|
||||||
|
|
||||||
|
|
||||||
|
#include "ui/CSimpleTop.hpp"
|
||||||
|
#include "ui/CSimpleFrame.hpp"
|
||||||
|
|
||||||
|
|
||||||
|
class CGGameUI {
|
||||||
|
public:
|
||||||
|
static void InitializeGame();
|
||||||
|
static void Initialize();
|
||||||
|
static void RegisterFrameFactories();
|
||||||
|
static int32_t HandleDisplaySizeChanged(const CSizeEvent& event);
|
||||||
|
|
||||||
|
public:
|
||||||
|
static bool m_reloadUI;
|
||||||
|
static CSimpleTop* m_simpleTop;
|
||||||
|
static CSimpleFrame* m_UISimpleParent;
|
||||||
|
static int32_t m_hasControl;
|
||||||
|
static int32_t m_screenWidth;
|
||||||
|
static int32_t m_screenHeight;
|
||||||
|
static float m_aspect;
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif // GAME_UI_CGGAMEUI_HPP
|
51
src/gameui/CGWorldFrame.cpp
Normal file
51
src/gameui/CGWorldFrame.cpp
Normal file
@ -0,0 +1,51 @@
|
|||||||
|
#include "gameui/CGWorldFrame.hpp"
|
||||||
|
|
||||||
|
#include "gx/Transform.hpp"
|
||||||
|
|
||||||
|
#include <storm/Memory.hpp>
|
||||||
|
#include <tempest/Matrix.hpp>
|
||||||
|
|
||||||
|
|
||||||
|
CGWorldFrame* CGWorldFrame::s_currentWorldFrame = nullptr;
|
||||||
|
|
||||||
|
|
||||||
|
CGWorldFrame::CGWorldFrame(CSimpleFrame* parent) : CSimpleFrame(parent) {
|
||||||
|
// TODO
|
||||||
|
s_currentWorldFrame = this;
|
||||||
|
}
|
||||||
|
|
||||||
|
void CGWorldFrame::OnFrameRender(CRenderBatch* batch, uint32_t layer) {
|
||||||
|
CSimpleFrame::OnFrameRender(batch, layer);
|
||||||
|
if (!layer) {
|
||||||
|
batch->QueueCallback(&CGWorldFrame::RenderWorld, this);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
CSimpleFrame* CGWorldFrame::Create(CSimpleFrame* parent) {
|
||||||
|
// TODO: Data = CDataAllocator__GetData(0, ".?AVCGWorldFrame@@", -2);
|
||||||
|
|
||||||
|
auto m = SMemAlloc(sizeof(CGWorldFrame), __FILE__, __LINE__, 0);
|
||||||
|
return m ? (new (m) CGWorldFrame(parent)) : nullptr;
|
||||||
|
}
|
||||||
|
|
||||||
|
void CGWorldFrame::RenderWorld(void* param) {
|
||||||
|
C44Matrix saved_proj;
|
||||||
|
GxXformProjection(saved_proj);
|
||||||
|
|
||||||
|
C44Matrix saved_view;
|
||||||
|
GxXformView(saved_view);
|
||||||
|
|
||||||
|
CGWorldFrame::OnWorldUpdate();
|
||||||
|
CGWorldFrame::OnWorldRender();
|
||||||
|
|
||||||
|
//PlayerNameRenderWorldText();
|
||||||
|
|
||||||
|
GxXformSetProjection(saved_proj);
|
||||||
|
GxXformSetView(saved_view);
|
||||||
|
}
|
||||||
|
|
||||||
|
void CGWorldFrame::OnWorldUpdate() {
|
||||||
|
}
|
||||||
|
|
||||||
|
void CGWorldFrame::OnWorldRender() {
|
||||||
|
}
|
22
src/gameui/CGWorldFrame.hpp
Normal file
22
src/gameui/CGWorldFrame.hpp
Normal file
@ -0,0 +1,22 @@
|
|||||||
|
#ifndef GAME_UI_CGWORLDFRAME_HPP
|
||||||
|
#define GAME_UI_CGWORLDFRAME_HPP
|
||||||
|
|
||||||
|
#include "ui/CSimpleFrame.hpp"
|
||||||
|
#include "ui/CSimpleTop.hpp"
|
||||||
|
|
||||||
|
class CGWorldFrame : public CSimpleFrame {
|
||||||
|
public:
|
||||||
|
CGWorldFrame(CSimpleFrame* parent);
|
||||||
|
|
||||||
|
virtual void OnFrameRender(CRenderBatch* batch, uint32_t layer);
|
||||||
|
|
||||||
|
static CSimpleFrame* Create(CSimpleFrame* parent);
|
||||||
|
static void RenderWorld(void* param);
|
||||||
|
static void OnWorldUpdate();
|
||||||
|
static void OnWorldRender();
|
||||||
|
|
||||||
|
public:
|
||||||
|
static CGWorldFrame* s_currentWorldFrame;
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif // GAME_UI_CGWORLDFRAME_HPP
|
28
src/gameui/CMakeLists.txt
Normal file
28
src/gameui/CMakeLists.txt
Normal file
@ -0,0 +1,28 @@
|
|||||||
|
file(GLOB PRIVATE_SOURCES "*.cpp")
|
||||||
|
|
||||||
|
add_library(gameui STATIC
|
||||||
|
${PRIVATE_SOURCES}
|
||||||
|
)
|
||||||
|
|
||||||
|
target_include_directories(gameui
|
||||||
|
PRIVATE
|
||||||
|
${CMAKE_SOURCE_DIR}/src
|
||||||
|
)
|
||||||
|
|
||||||
|
target_link_libraries(gameui
|
||||||
|
PRIVATE
|
||||||
|
client
|
||||||
|
clientobject
|
||||||
|
console
|
||||||
|
event
|
||||||
|
glue
|
||||||
|
gx
|
||||||
|
math
|
||||||
|
model
|
||||||
|
ui
|
||||||
|
util
|
||||||
|
PUBLIC
|
||||||
|
common
|
||||||
|
storm
|
||||||
|
tempest
|
||||||
|
)
|
@ -1,9 +1,12 @@
|
|||||||
#include "glue/CCharacterSelection.hpp"
|
#include "glue/CCharacterSelection.hpp"
|
||||||
#include "model/CM2Shared.hpp"
|
#include "model/CM2Shared.hpp"
|
||||||
#include "ui/CSimpleModelFFX.hpp"
|
#include "ui/CSimpleModelFFX.hpp"
|
||||||
|
#include "client/ClientServices.hpp"
|
||||||
|
#include "net/Connection.hpp"
|
||||||
|
|
||||||
TSGrowableArray<CharacterSelectionDisplay> CCharacterSelection::s_characterList;
|
TSGrowableArray<CharacterSelectionDisplay> CCharacterSelection::s_characterList;
|
||||||
CSimpleModelFFX* CCharacterSelection::s_modelFrame;
|
CSimpleModelFFX* CCharacterSelection::s_modelFrame;
|
||||||
|
float CCharacterSelection::s_charFacing = 0.0f;
|
||||||
|
|
||||||
void CCharacterSelection::RenderPrep() {
|
void CCharacterSelection::RenderPrep() {
|
||||||
// TODO
|
// TODO
|
||||||
@ -33,3 +36,34 @@ void CCharacterSelection::SetBackgroundModel(const char* modelPath) {
|
|||||||
model->IsDrawable(1, 1);
|
model->IsDrawable(1, 1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void CCharacterSelection::SetCharFacing(float facing) {
|
||||||
|
// TODO:
|
||||||
|
}
|
||||||
|
|
||||||
|
void CCharacterSelection::ClearCharacterList() {
|
||||||
|
}
|
||||||
|
|
||||||
|
void CCharacterSelection::UpdateCharacterList() {
|
||||||
|
// TODO: ClearAddOnEnableState(0);
|
||||||
|
// TODO: Proper implementation
|
||||||
|
|
||||||
|
auto& received = ClientServices::Connection()->m_characterList;
|
||||||
|
CCharacterSelection::s_characterList.SetCount(received.Count());
|
||||||
|
for (uint32_t i = 0; i < received.Count(); ++i) {
|
||||||
|
CCharacterSelection::s_characterList[i].m_characterInfo = received[i];
|
||||||
|
}
|
||||||
|
|
||||||
|
if (CCharacterSelection::GetNumCharacters()) {
|
||||||
|
int32_t currentIndex = 0;
|
||||||
|
FrameScript_SignalEvent(8, "%d", currentIndex + 1);
|
||||||
|
} else {
|
||||||
|
int32_t currentIndex = 0;
|
||||||
|
FrameScript_SignalEvent(8, "%d", currentIndex + 1);
|
||||||
|
}
|
||||||
|
FrameScript_SignalEvent(7, nullptr);
|
||||||
|
}
|
||||||
|
|
||||||
|
uint32_t CCharacterSelection::GetNumCharacters() {
|
||||||
|
return s_characterList.Count();
|
||||||
|
}
|
||||||
|
@ -2,11 +2,12 @@
|
|||||||
#define GLUE_C_CHARACTER_SELECTION_HPP
|
#define GLUE_C_CHARACTER_SELECTION_HPP
|
||||||
|
|
||||||
#include <storm/Array.hpp>
|
#include <storm/Array.hpp>
|
||||||
|
#include "net/Types.hpp"
|
||||||
|
|
||||||
class CSimpleModelFFX;
|
class CSimpleModelFFX;
|
||||||
|
|
||||||
struct CharacterSelectionDisplay {
|
struct CharacterSelectionDisplay {
|
||||||
// TODO
|
CHARACTER_INFO m_characterInfo;
|
||||||
};
|
};
|
||||||
|
|
||||||
class CCharacterSelection {
|
class CCharacterSelection {
|
||||||
@ -14,10 +15,15 @@ class CCharacterSelection {
|
|||||||
// Static variables
|
// Static variables
|
||||||
static TSGrowableArray<CharacterSelectionDisplay> s_characterList;
|
static TSGrowableArray<CharacterSelectionDisplay> s_characterList;
|
||||||
static CSimpleModelFFX* s_modelFrame;
|
static CSimpleModelFFX* s_modelFrame;
|
||||||
|
static float s_charFacing;
|
||||||
|
|
||||||
// Static functions
|
// Static functions
|
||||||
static void RenderPrep();
|
static void RenderPrep();
|
||||||
static void SetBackgroundModel(const char* modelPath);
|
static void SetBackgroundModel(const char* modelPath);
|
||||||
|
static void SetCharFacing(float facing);
|
||||||
|
static void ClearCharacterList();
|
||||||
|
static void UpdateCharacterList();
|
||||||
|
static uint32_t GetNumCharacters();
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
#include "glue/CGlueMgr.hpp"
|
#include "glue/CGlueMgr.hpp"
|
||||||
#include "glue/CRealmList.hpp"
|
#include "glue/CRealmList.hpp"
|
||||||
|
#include "glue/CCharacterSelection.hpp"
|
||||||
#include "client/Client.hpp"
|
#include "client/Client.hpp"
|
||||||
#include "client/ClientServices.hpp"
|
#include "client/ClientServices.hpp"
|
||||||
#include "gx/Coordinate.hpp"
|
#include "gx/Coordinate.hpp"
|
||||||
@ -43,6 +44,8 @@ unsigned char InterfaceKey[256] = {
|
|||||||
int32_t CGlueMgr::m_acceptedEULA = 1; // TODO
|
int32_t CGlueMgr::m_acceptedEULA = 1; // TODO
|
||||||
int32_t CGlueMgr::m_acceptedTerminationWithoutNotice;
|
int32_t CGlueMgr::m_acceptedTerminationWithoutNotice;
|
||||||
int32_t CGlueMgr::m_acceptedTOS = 1; // TODO
|
int32_t CGlueMgr::m_acceptedTOS = 1; // TODO
|
||||||
|
int32_t CGlueMgr::m_processServerAlert = 1;
|
||||||
|
int32_t CGlueMgr::m_pendingTimerAlert;
|
||||||
int32_t CGlueMgr::m_accountMsgAvailable;
|
int32_t CGlueMgr::m_accountMsgAvailable;
|
||||||
char CGlueMgr::m_accountName[1280];
|
char CGlueMgr::m_accountName[1280];
|
||||||
float CGlueMgr::m_aspect;
|
float CGlueMgr::m_aspect;
|
||||||
@ -57,6 +60,7 @@ int32_t CGlueMgr::m_lastLoginResult;
|
|||||||
int32_t CGlueMgr::m_lastLoginState;
|
int32_t CGlueMgr::m_lastLoginState;
|
||||||
int32_t CGlueMgr::m_loginResult;
|
int32_t CGlueMgr::m_loginResult;
|
||||||
int32_t CGlueMgr::m_loginState;
|
int32_t CGlueMgr::m_loginState;
|
||||||
|
int32_t CGlueMgr::m_matrixChallengeCount;
|
||||||
int32_t CGlueMgr::m_matrixRemaining;
|
int32_t CGlueMgr::m_matrixRemaining;
|
||||||
int32_t CGlueMgr::m_reconnect;
|
int32_t CGlueMgr::m_reconnect;
|
||||||
int32_t CGlueMgr::m_reload;
|
int32_t CGlueMgr::m_reload;
|
||||||
@ -67,6 +71,15 @@ int32_t CGlueMgr::m_showedDisconnect;
|
|||||||
CSimpleTop* CGlueMgr::m_simpleTop;
|
CSimpleTop* CGlueMgr::m_simpleTop;
|
||||||
int32_t CGlueMgr::m_suspended;
|
int32_t CGlueMgr::m_suspended;
|
||||||
|
|
||||||
|
int32_t CGlueMgr::m_surveyTimer;
|
||||||
|
int32_t CGlueMgr::m_executedSurvey;
|
||||||
|
int32_t CGlueMgr::m_surveyDownload;
|
||||||
|
int32_t CGlueMgr::m_patchDownload;
|
||||||
|
bool CGlueMgr::m_deleteLocalPatch;
|
||||||
|
|
||||||
|
CHARACTER_INFO* CGlueMgr::m_characterInfo = nullptr;
|
||||||
|
|
||||||
|
|
||||||
float CalculateAspectRatio() {
|
float CalculateAspectRatio() {
|
||||||
auto widescreenVar = CVar::Lookup("widescreen");
|
auto widescreenVar = CVar::Lookup("widescreen");
|
||||||
auto resolutionVar = CVar::Lookup("gxResolution");
|
auto resolutionVar = CVar::Lookup("gxResolution");
|
||||||
@ -197,9 +210,51 @@ int32_t CGlueMgr::HandleDisplaySizeChanged(const CSizeEvent& event) {
|
|||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void CGlueMgr::GetRealmList(bool showProgress) {
|
||||||
|
CGlueMgr::m_idleState = IDLE_REALM_LIST;
|
||||||
|
CGlueMgr::m_showedDisconnect = 0;
|
||||||
|
if (showProgress) {
|
||||||
|
auto text = FrameScript_GetText("REALM_LIST_IN_PROGRESS", -1, FRAMESCRIPT_GENDER::GENDER_NOT_APPLICABLE);
|
||||||
|
FrameScript_SignalEvent(3, "%s%s", "CANCEL", text);
|
||||||
|
}
|
||||||
|
ClientServices::GetRealmList();
|
||||||
|
}
|
||||||
|
|
||||||
|
void CGlueMgr::GetCharacterList() {
|
||||||
|
if (CGlueMgr::m_idleState != IDLE_WORLD_LOGIN) {
|
||||||
|
CGlueMgr::m_idleState = IDLE_CHARACTER_LIST;
|
||||||
|
auto text = FrameScript_GetText("CHAR_LIST_RETRIEVING", -1, GENDER_NOT_APPLICABLE);
|
||||||
|
FrameScript_SignalEvent(3, "%s%s", "CANCEL", text);
|
||||||
|
ClientServices::GetCharacterList();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// TODO a1: const EVENT_DATA_IDLE*
|
// TODO a1: const EVENT_DATA_IDLE*
|
||||||
int32_t CGlueMgr::Idle(const void* a1, void* a2) {
|
int32_t CGlueMgr::Idle(const void* a1, void* a2) {
|
||||||
// TODO
|
// TODO:
|
||||||
|
// if (gxDevice->IsStereoEnabled) {
|
||||||
|
// CGlueMgr::SetUIDepth(gxDevice->StereoGetConvergence);
|
||||||
|
// }
|
||||||
|
|
||||||
|
auto loginConnection = ClientServices::LoginConnection();
|
||||||
|
if (loginConnection) {
|
||||||
|
// Virtual call (loginConnection + 184) leads to nullsub
|
||||||
|
// Checked by tracing in debugger
|
||||||
|
}
|
||||||
|
|
||||||
|
if (CGlueMgr::m_processServerAlert) {
|
||||||
|
// TODO:
|
||||||
|
// v2 = SStrLen("SERVERALERT:");
|
||||||
|
// FrameScript_SignalEvent(0x15u, "%s", &CGlueMgr::m_serverAlert[(_DWORD)&v2[CGlueMgr::m_serverAlert[0] != -17 ? 0 : 3]]);
|
||||||
|
CGlueMgr::m_processServerAlert = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (CGlueMgr::m_pendingTimerAlert) {
|
||||||
|
FrameScript_SignalEvent(0x21u, "%d", CGlueMgr::m_pendingTimerAlert);
|
||||||
|
CGlueMgr::m_pendingTimerAlert = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
// TODO: CKBPage::UpdateLoadingQueue();
|
||||||
|
|
||||||
if (CGlueMgr::m_idleState == IDLE_NONE) {
|
if (CGlueMgr::m_idleState == IDLE_NONE) {
|
||||||
if (CGlueMgr::m_reload) {
|
if (CGlueMgr::m_reload) {
|
||||||
@ -213,18 +268,17 @@ int32_t CGlueMgr::Idle(const void* a1, void* a2) {
|
|||||||
CGlueMgr::m_reload = 0;
|
CGlueMgr::m_reload = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO
|
if (CGlueMgr::m_accountMsgAvailable) {
|
||||||
// if (CGlueMgr::m_accountMsgAvailable) {
|
FrameScript_SignalEvent(0x22u, 0);
|
||||||
// FrameScript_SignalEvent(0x22u, 0);
|
CGlueMgr::m_accountMsgAvailable = 0;
|
||||||
// CGlueMgr::m_accountMsgAvailable = 0;
|
}
|
||||||
// }
|
|
||||||
|
|
||||||
// TODO sub_4D84A0();
|
// TODO CGlueMgr::HandleBattlenetDisconnect();
|
||||||
|
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO
|
// TODO: LOOP { ConsoleWrite(GRUNT DEBUG MESSAGE) }
|
||||||
|
|
||||||
WOWCS_OPS op;
|
WOWCS_OPS op;
|
||||||
const char* msg;
|
const char* msg;
|
||||||
@ -243,6 +297,30 @@ int32_t CGlueMgr::Idle(const void* a1, void* a2) {
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
case IDLE_CHARACTER_LIST: {
|
||||||
|
CGlueMgr::PollCharacterList(errorCode, msg, complete, result, op);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
case IDLE_ENTER_WORLD: {
|
||||||
|
CGlueMgr::PollEnterWorld();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
case IDLE_12: {
|
||||||
|
if (CGlueMgr::m_patchDownload) {
|
||||||
|
CGlueMgr::PatchDownloadIdle();
|
||||||
|
} else if (CGlueMgr::m_surveyDownload) {
|
||||||
|
CGlueMgr::SurveyDownloadIdle();
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
case IDLE_13: {
|
||||||
|
CGlueMgr::PollUserSurvey();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
// TODO other idle states
|
// TODO other idle states
|
||||||
|
|
||||||
default:
|
default:
|
||||||
@ -340,6 +418,20 @@ void CGlueMgr::QuitGame() {
|
|||||||
ClientPostClose(0);
|
ClientPostClose(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void CGlueMgr::EnterWorld() {
|
||||||
|
// TODO: Proper implementation
|
||||||
|
if (CCharacterSelection::GetNumCharacters() < 1) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
CGlueMgr::m_characterInfo = &CCharacterSelection::s_characterList[0].m_characterInfo;
|
||||||
|
if (!m_characterInfo || !ClientServices::Connection()->IsConnected()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
CGlueMgr::m_idleState = IDLE_ENTER_WORLD;
|
||||||
|
CGlueMgr::m_showedDisconnect = 0;
|
||||||
|
}
|
||||||
|
|
||||||
void CGlueMgr::PollAccountLogin(int32_t errorCode, const char* msg, int32_t complete, int32_t result, WOWCS_OPS op) {
|
void CGlueMgr::PollAccountLogin(int32_t errorCode, const char* msg, int32_t complete, int32_t result, WOWCS_OPS op) {
|
||||||
auto login = ClientServices::LoginConnection();
|
auto login = ClientServices::LoginConnection();
|
||||||
|
|
||||||
@ -366,47 +458,52 @@ void CGlueMgr::PollAccountLogin(int32_t errorCode, const char* msg, int32_t comp
|
|||||||
FrameScript_SignalEvent(4, "%s", msg);
|
FrameScript_SignalEvent(4, "%s", msg);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (complete) {
|
if (!complete) {
|
||||||
if (result == 0) {
|
return;
|
||||||
if (errorCode != 2) {
|
|
||||||
// TODO
|
|
||||||
}
|
|
||||||
|
|
||||||
CGlueMgr::m_idleState = IDLE_NONE;
|
|
||||||
CGlueMgr::m_showedDisconnect = 0;
|
|
||||||
|
|
||||||
if (errorCode == 2) {
|
|
||||||
// TODO CGlueMgr::m_disconnectPending = 1;
|
|
||||||
// TODO ClientServices::Connection()->Disconnect();
|
|
||||||
}
|
|
||||||
|
|
||||||
if (errorCode != 13) {
|
|
||||||
// TODO CCharacterSelection::ClearCharacterList();
|
|
||||||
|
|
||||||
if (ClientServices::GetInstance()->m_realmList.Count()) {
|
|
||||||
FrameScript_SignalEvent(5, nullptr);
|
|
||||||
CRealmList::UpdateList();
|
|
||||||
} else {
|
|
||||||
// TODO
|
|
||||||
}
|
|
||||||
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!SStrCmpI(CGlueMgr::m_currentScreen, "charselect", STORM_MAX_STR)) {
|
|
||||||
CGlueMgr::SetScreen("login");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (op == COP_CONNECT) {
|
|
||||||
// TODO
|
|
||||||
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (result == 0) {
|
||||||
|
if (errorCode != 2) {
|
||||||
|
// TODO
|
||||||
|
// Select Error Description with or without URL
|
||||||
|
}
|
||||||
|
|
||||||
|
CGlueMgr::m_idleState = IDLE_NONE;
|
||||||
|
CGlueMgr::m_showedDisconnect = 0;
|
||||||
|
|
||||||
|
if (errorCode == 2) {
|
||||||
|
CGlueMgr::m_disconnectPending = 1;
|
||||||
|
ClientServices::Connection()->Disconnect();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (errorCode != 13) {
|
||||||
|
CCharacterSelection::ClearCharacterList();
|
||||||
|
|
||||||
|
if (ClientServices::GetInstance()->m_realmList.Count()) {
|
||||||
|
FrameScript_SignalEvent(5, nullptr);
|
||||||
|
CRealmList::UpdateList();
|
||||||
|
} else {
|
||||||
|
CGlueMgr::GetRealmList(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!SStrCmpI(CGlueMgr::m_currentScreen, "charselect", STORM_MAX_STR)) {
|
||||||
|
CGlueMgr::SetScreen("login");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (op == COP_CONNECT) {
|
||||||
|
// TODO: Correct arguments (they're not used inside method)
|
||||||
|
ClientServices::Connection()->AccountLogin("", "", 0, 0);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
CGlueMgr::SetScreen("charselect");
|
||||||
}
|
}
|
||||||
|
|
||||||
void CGlueMgr::PollLoginServerLogin() {
|
void CGlueMgr::PollLoginServerLogin() {
|
||||||
@ -426,32 +523,53 @@ void CGlueMgr::PollLoginServerLogin() {
|
|||||||
|
|
||||||
switch (CGlueMgr::m_loginState) {
|
switch (CGlueMgr::m_loginState) {
|
||||||
case LOGIN_STATE_FAILED: {
|
case LOGIN_STATE_FAILED: {
|
||||||
// TODO
|
ClientServices::LoginConnection()->Logoff();
|
||||||
|
CGlueMgr::m_idleState = IDLE_NONE;
|
||||||
|
CGlueMgr::m_showedDisconnect = 0;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
case LOGIN_STATE_DOWNLOADFILE: {
|
case LOGIN_STATE_DOWNLOADFILE: {
|
||||||
// TODO
|
// TODO
|
||||||
|
// Get String from Server's answer
|
||||||
|
// v14 = (char *)(ClientServices::LoginConnection() + 3928);
|
||||||
|
const char* v14 = "";
|
||||||
|
if (!SStrCmpI(v14, "Patch", STORM_MAX_STR)) {
|
||||||
|
CGlueMgr::PatchDownloadStart();
|
||||||
|
}
|
||||||
|
if (!SStrCmpI(v14, "Survey", STORM_MAX_STR)) {
|
||||||
|
CGlueMgr::SurveyDownloadStart();
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
case LOGIN_STATE_PIN: {
|
case LOGIN_STATE_PIN: {
|
||||||
|
FrameScript_SignalEvent(5, nullptr);
|
||||||
// TODO
|
// TODO
|
||||||
|
// Calling GruntLogin::GetPinInfo
|
||||||
|
// v9 = (unsigned __int8 *)(*(int (__thiscall **)(int))(*(_DWORD *)v8 + 136))(v8);
|
||||||
|
int32_t v9[10] = {};
|
||||||
|
FrameScript_SignalEvent(26, "%d%d%d%d%d%d%d%d%d%d", v9[0], v9[1], v9[2], v9[3], v9[4], v9[5], v9[6], v9[7], v9[8], v9[9]);
|
||||||
|
CGlueMgr::m_loginState = LOGIN_STATE_PIN_WAIT;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
case LOGIN_STATE_MATRIX: {
|
case LOGIN_STATE_MATRIX: {
|
||||||
// TODO
|
// TODO
|
||||||
|
// Calling GruntLogin::GetMatrixInfo
|
||||||
|
// (*(void (__thiscall **)(int, int *, int *, int *, int *, unsigned __int8 *, _DWORD **))(*(_DWORD *)v10 + 160))(v10, &v73, &v69, &v72, &v70, &v77, &v75);
|
||||||
|
CGlueMgr::m_matrixChallengeCount = 0;
|
||||||
|
CGlueMgr::m_matrixRemaining = 0;
|
||||||
|
CGlueMgr::m_loginState = LOGIN_STATE_MATRIX_WAIT;
|
||||||
|
FrameScript_SignalEvent(5, 0);
|
||||||
|
// TODO: FrameScript_SignalEvent(0x1Cu, "%d%d%d%d%b%d", v73, v69, v72, v70, v77, v75);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
case LOGIN_STATE_TOKEN: {
|
case LOGIN_STATE_TOKEN: {
|
||||||
// TODO
|
CGlueMgr::m_loginState = LOGIN_STATE_TOKEN_WAIT;
|
||||||
|
FrameScript_SignalEvent(5, 0);
|
||||||
|
FrameScript_SignalEvent(38, 0);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -470,6 +588,58 @@ void CGlueMgr::PollLoginServerLogin() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void CGlueMgr::PollCharacterList(int32_t errorCode, const char* msg, int32_t complete, int32_t result, WOWCS_OPS op) {
|
||||||
|
FrameScript_SignalEvent(4, "%s", msg);
|
||||||
|
|
||||||
|
if (CGlueMgr::HandleBattlenetDisconnect()) {
|
||||||
|
CGlueMgr::m_idleState = IDLE_NONE;
|
||||||
|
CGlueMgr::m_showedDisconnect = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!complete) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!result) {
|
||||||
|
if (errorCode == 2) {
|
||||||
|
CCharacterSelection::ClearCharacterList();
|
||||||
|
CGlueMgr::GetRealmList(true);
|
||||||
|
} else {
|
||||||
|
FrameScript_SignalEvent(3, "%s%s", "OKAY", msg);
|
||||||
|
CGlueMgr::m_idleState = IDLE_NONE;
|
||||||
|
CGlueMgr::m_showedDisconnect = 0;
|
||||||
|
}
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
CGlueMgr::m_idleState = IDLE_NONE;
|
||||||
|
CGlueMgr::m_showedDisconnect = 0;
|
||||||
|
FrameScript_SignalEvent(5, nullptr);
|
||||||
|
CCharacterSelection::UpdateCharacterList();
|
||||||
|
if (!CGlueMgr::m_accountMsgAvailable) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
FrameScript_SignalEvent(34, 0);
|
||||||
|
CGlueMgr::m_accountMsgAvailable = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
void CGlueMgr::PollUserSurvey() {
|
||||||
|
if (CGlueMgr::m_surveyDownload && false /* virtual call */) {
|
||||||
|
if (CGlueMgr::m_executedSurvey) {
|
||||||
|
// TODO
|
||||||
|
} else {
|
||||||
|
CGlueMgr::m_executedSurvey = 1;
|
||||||
|
if (CGlueMgr::SurveyExecute()) {
|
||||||
|
auto text = FrameScript_GetText("LOGIN_STATE_SURVEY", -1, FRAMESCRIPT_GENDER::GENDER_NOT_APPLICABLE);
|
||||||
|
FrameScript_SignalEvent(3, "%s%s", "CANCEL", text);
|
||||||
|
CGlueMgr::SurveySendResults();
|
||||||
|
// TODO: CGlueMgr::m_surveyTimer = OsGetAsyncTimeMs();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void CGlueMgr::InitCursor() {
|
void CGlueMgr::InitCursor() {
|
||||||
uint32_t width;
|
uint32_t width;
|
||||||
uint32_t height;
|
uint32_t height;
|
||||||
@ -664,16 +834,16 @@ void CGlueMgr::StatusDialogClick() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
case IDLE_ACCOUNT_LOGIN:
|
case IDLE_ACCOUNT_LOGIN:
|
||||||
case IDLE_3: {
|
case IDLE_CHARACTER_LIST: {
|
||||||
ClientServices::Connection()->Cancel(2);
|
ClientServices::Connection()->Cancel(2);
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
case IDLE_4:
|
case IDLE_REALM_LIST:
|
||||||
case IDLE_5:
|
case IDLE_CREATE_CHARACTER:
|
||||||
case IDLE_6:
|
case IDLE_DELETE_CHARACTER:
|
||||||
case IDLE_10: {
|
case IDLE_ENTER_WORLD: {
|
||||||
ClientServices::Connection()->Cancel(2);
|
ClientServices::Connection()->Cancel(2);
|
||||||
|
|
||||||
CGlueMgr::m_showedDisconnect = 0;
|
CGlueMgr::m_showedDisconnect = 0;
|
||||||
@ -691,20 +861,21 @@ void CGlueMgr::StatusDialogClick() {
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
case IDLE_11: {
|
case IDLE_WORLD_LOGIN: {
|
||||||
CGlueMgr::m_showedDisconnect = 0;
|
CGlueMgr::m_showedDisconnect = 0;
|
||||||
CGlueMgr::m_idleState = IDLE_NONE;
|
CGlueMgr::m_idleState = IDLE_NONE;
|
||||||
|
CGlueMgr::GetCharacterList();
|
||||||
// TODO
|
|
||||||
// CGlueMgr::GetCharacterList();
|
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
case IDLE_12:
|
case IDLE_12:
|
||||||
case IDLE_13: {
|
case IDLE_13: {
|
||||||
// TODO
|
if (CGlueMgr::m_surveyDownload) {
|
||||||
|
CGlueMgr::SurveyDownloadCancel();
|
||||||
|
CGlueMgr::m_showedDisconnect = 0;
|
||||||
|
CGlueMgr::m_idleState = IDLE_NONE;
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -744,3 +915,52 @@ void CGlueMgr::UpdateCurrentScreen(const char* screen) {
|
|||||||
|
|
||||||
// TODO
|
// TODO
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool CGlueMgr::HandleBattlenetDisconnect() {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
void CGlueMgr::PollEnterWorld() {
|
||||||
|
//if (!LoadingScreenDrawing())
|
||||||
|
// return;
|
||||||
|
|
||||||
|
if (CGlueMgr::m_suspended) {
|
||||||
|
CGlueMgr::m_idleState = IDLE_NONE;
|
||||||
|
CGlueMgr::m_showedDisconnect = 0;
|
||||||
|
//SI3::StopGlueMusic(3.0);
|
||||||
|
//SI3::StopGlueAmbience(-1.0);
|
||||||
|
ClientServices::CharacterLogin(CGlueMgr::m_characterInfo->guid, C3Vector());
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
auto info = CGlueMgr::m_characterInfo;
|
||||||
|
|
||||||
|
//if (*(_BYTE*)(info + 385))
|
||||||
|
// sub_4D9660(*(_BYTE*)(info + 377), (int)v51, *(_BYTE*)(info + 376), (int)&v68);
|
||||||
|
|
||||||
|
|
||||||
|
CGlueMgr::Suspend();
|
||||||
|
ClientInitializeGame(info->mapID, info->position);
|
||||||
|
}
|
||||||
|
|
||||||
|
void CGlueMgr::SurveyDownloadStart() {
|
||||||
|
}
|
||||||
|
|
||||||
|
void CGlueMgr::SurveyDownloadCancel() {
|
||||||
|
}
|
||||||
|
|
||||||
|
void CGlueMgr::SurveyDownloadIdle() {
|
||||||
|
}
|
||||||
|
|
||||||
|
bool CGlueMgr::SurveyExecute() {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
void CGlueMgr::SurveySendResults() {
|
||||||
|
}
|
||||||
|
|
||||||
|
void CGlueMgr::PatchDownloadStart() {
|
||||||
|
}
|
||||||
|
|
||||||
|
void CGlueMgr::PatchDownloadIdle() {
|
||||||
|
}
|
||||||
|
@ -6,6 +6,10 @@
|
|||||||
#include "gx/Texture.hpp"
|
#include "gx/Texture.hpp"
|
||||||
#include <cstdint>
|
#include <cstdint>
|
||||||
|
|
||||||
|
|
||||||
|
float CalculateAspectRatio();
|
||||||
|
|
||||||
|
|
||||||
class CSimpleTop;
|
class CSimpleTop;
|
||||||
|
|
||||||
class CGlueMgr {
|
class CGlueMgr {
|
||||||
@ -15,15 +19,15 @@ class CGlueMgr {
|
|||||||
IDLE_NONE = 0,
|
IDLE_NONE = 0,
|
||||||
IDLE_LOGIN_SERVER_LOGIN = 1,
|
IDLE_LOGIN_SERVER_LOGIN = 1,
|
||||||
IDLE_ACCOUNT_LOGIN = 2,
|
IDLE_ACCOUNT_LOGIN = 2,
|
||||||
IDLE_3 = 3,
|
IDLE_CHARACTER_LIST = 3,
|
||||||
IDLE_4 = 4,
|
IDLE_REALM_LIST = 4,
|
||||||
IDLE_5 = 5,
|
IDLE_CREATE_CHARACTER = 5,
|
||||||
IDLE_6 = 6,
|
IDLE_DELETE_CHARACTER = 6,
|
||||||
IDLE_7 = 7,
|
IDLE_7 = 7,
|
||||||
IDLE_8 = 8,
|
IDLE_8 = 8,
|
||||||
IDLE_9 = 9,
|
IDLE_9 = 9,
|
||||||
IDLE_10 = 10,
|
IDLE_ENTER_WORLD = 10,
|
||||||
IDLE_11 = 11,
|
IDLE_WORLD_LOGIN = 11,
|
||||||
IDLE_12 = 12,
|
IDLE_12 = 12,
|
||||||
IDLE_13 = 13
|
IDLE_13 = 13
|
||||||
};
|
};
|
||||||
@ -32,6 +36,8 @@ class CGlueMgr {
|
|||||||
static int32_t m_acceptedEULA;
|
static int32_t m_acceptedEULA;
|
||||||
static int32_t m_acceptedTerminationWithoutNotice;
|
static int32_t m_acceptedTerminationWithoutNotice;
|
||||||
static int32_t m_acceptedTOS;
|
static int32_t m_acceptedTOS;
|
||||||
|
static int32_t m_processServerAlert;
|
||||||
|
static int32_t m_pendingTimerAlert;
|
||||||
static int32_t m_accountMsgAvailable;
|
static int32_t m_accountMsgAvailable;
|
||||||
static char m_accountName[];
|
static char m_accountName[];
|
||||||
static float m_aspect;
|
static float m_aspect;
|
||||||
@ -46,6 +52,7 @@ class CGlueMgr {
|
|||||||
static int32_t m_lastLoginState;
|
static int32_t m_lastLoginState;
|
||||||
static int32_t m_loginResult;
|
static int32_t m_loginResult;
|
||||||
static int32_t m_loginState;
|
static int32_t m_loginState;
|
||||||
|
static int32_t m_matrixChallengeCount;
|
||||||
static int32_t m_matrixRemaining;
|
static int32_t m_matrixRemaining;
|
||||||
static int32_t m_reconnect;
|
static int32_t m_reconnect;
|
||||||
static int32_t m_reload;
|
static int32_t m_reload;
|
||||||
@ -56,18 +63,31 @@ class CGlueMgr {
|
|||||||
static CSimpleTop* m_simpleTop;
|
static CSimpleTop* m_simpleTop;
|
||||||
static int32_t m_suspended;
|
static int32_t m_suspended;
|
||||||
|
|
||||||
|
static int32_t m_surveyTimer;
|
||||||
|
static int32_t m_executedSurvey;
|
||||||
|
static int32_t m_surveyDownload;
|
||||||
|
static int32_t m_patchDownload;
|
||||||
|
static bool m_deleteLocalPatch;
|
||||||
|
|
||||||
|
static CHARACTER_INFO* m_characterInfo;
|
||||||
|
|
||||||
// Static functions
|
// Static functions
|
||||||
static void ChangeRealm(const REALM_INFO* realmInfo);
|
static void ChangeRealm(const REALM_INFO* realmInfo);
|
||||||
static void DisplayLoginStatus();
|
static void DisplayLoginStatus();
|
||||||
// TODO a1: const EVENT_DATA_IDLE*
|
// TODO a1: const EVENT_DATA_IDLE*
|
||||||
static int32_t HandleDisplaySizeChanged(const CSizeEvent& event);
|
static int32_t HandleDisplaySizeChanged(const CSizeEvent& event);
|
||||||
|
static void GetRealmList(bool showProgress);
|
||||||
|
static void GetCharacterList();
|
||||||
static int32_t Idle(const void* a1, void* a2);
|
static int32_t Idle(const void* a1, void* a2);
|
||||||
static void Initialize();
|
static void Initialize();
|
||||||
static void InitCursor();
|
static void InitCursor();
|
||||||
static void LoginServerLogin(const char* accountName, const char* password);
|
static void LoginServerLogin(const char* accountName, const char* password);
|
||||||
static void QuitGame();
|
static void QuitGame();
|
||||||
|
static void EnterWorld();
|
||||||
static void PollAccountLogin(int32_t errorCode, const char* msg, int32_t complete, int32_t result, WOWCS_OPS op);
|
static void PollAccountLogin(int32_t errorCode, const char* msg, int32_t complete, int32_t result, WOWCS_OPS op);
|
||||||
static void PollLoginServerLogin();
|
static void PollLoginServerLogin();
|
||||||
|
static void PollCharacterList(int32_t errorCode, const char* msg, int32_t complete, int32_t result, WOWCS_OPS op);
|
||||||
|
static void PollUserSurvey();
|
||||||
static void Resume();
|
static void Resume();
|
||||||
static void SetCurrentAccount(const char* accountName);
|
static void SetCurrentAccount(const char* accountName);
|
||||||
static void SetLoginStateAndResult(LOGIN_STATE state, LOGIN_RESULT result, char const* addrStr, char const* stateStr, char const* resultStr, uint8_t flags);
|
static void SetLoginStateAndResult(LOGIN_STATE state, LOGIN_RESULT result, char const* addrStr, char const* stateStr, char const* resultStr, uint8_t flags);
|
||||||
@ -76,6 +96,20 @@ class CGlueMgr {
|
|||||||
static void Sub4D8BA0();
|
static void Sub4D8BA0();
|
||||||
static void Suspend();
|
static void Suspend();
|
||||||
static void UpdateCurrentScreen(const char* screen);
|
static void UpdateCurrentScreen(const char* screen);
|
||||||
|
static bool HandleBattlenetDisconnect();
|
||||||
|
|
||||||
|
static void PollEnterWorld();
|
||||||
|
|
||||||
|
// Survey Download System
|
||||||
|
static void SurveyDownloadStart();
|
||||||
|
static void SurveyDownloadCancel();
|
||||||
|
static void SurveyDownloadIdle();
|
||||||
|
static bool SurveyExecute();
|
||||||
|
static void SurveySendResults();
|
||||||
|
|
||||||
|
// Patch Download System
|
||||||
|
static void PatchDownloadStart();
|
||||||
|
static void PatchDownloadIdle();
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -106,6 +106,14 @@ uint32_t CGxDevice::s_texFormatBytesPerBlock[] = {
|
|||||||
CGxShader* CGxDevice::s_uiVertexShader = nullptr;
|
CGxShader* CGxDevice::s_uiVertexShader = nullptr;
|
||||||
CGxShader* CGxDevice::s_uiPixelShader = nullptr;
|
CGxShader* CGxDevice::s_uiPixelShader = nullptr;
|
||||||
|
|
||||||
|
void CGxDevice::LogOpen() {
|
||||||
|
// TODO
|
||||||
|
}
|
||||||
|
|
||||||
|
void CGxDevice::LogClose() {
|
||||||
|
// TODO
|
||||||
|
}
|
||||||
|
|
||||||
void CGxDevice::Log(const char* format, ...) {
|
void CGxDevice::Log(const char* format, ...) {
|
||||||
// TODO
|
// TODO
|
||||||
}
|
}
|
||||||
@ -333,7 +341,7 @@ void CGxDevice::ICursorDraw() {
|
|||||||
// Turn off everything
|
// Turn off everything
|
||||||
GxRsSet(GxRs_PolygonOffset, 0);
|
GxRsSet(GxRs_PolygonOffset, 0);
|
||||||
GxRsSet(GxRs_NormalizeNormals, 0);
|
GxRsSet(GxRs_NormalizeNormals, 0);
|
||||||
GxRsSet(GxRs_BlendingMode, 1);
|
GxRsSet(GxRs_BlendingMode, GxBlend_AlphaKey);
|
||||||
GxRsSetAlphaRef();
|
GxRsSetAlphaRef();
|
||||||
GxRsSet(GxRs_Lighting, 0);
|
GxRsSet(GxRs_Lighting, 0);
|
||||||
GxRsSet(GxRs_Fog, 0);
|
GxRsSet(GxRs_Fog, 0);
|
||||||
|
@ -51,6 +51,8 @@ class CGxDevice {
|
|||||||
static CGxShader* s_uiPixelShader;
|
static CGxShader* s_uiPixelShader;
|
||||||
|
|
||||||
// Static functions
|
// Static functions
|
||||||
|
static void LogOpen();
|
||||||
|
static void LogClose();
|
||||||
static void Log(const char* format, ...);
|
static void Log(const char* format, ...);
|
||||||
static void Log(const CGxFormat& format);
|
static void Log(const CGxFormat& format);
|
||||||
#if defined(WHOA_SYSTEM_WIN)
|
#if defined(WHOA_SYSTEM_WIN)
|
||||||
|
50
src/gx/CGxFormat.cpp
Normal file
50
src/gx/CGxFormat.cpp
Normal file
@ -0,0 +1,50 @@
|
|||||||
|
#include "gx/CGxFormat.hpp"
|
||||||
|
|
||||||
|
const char* CGxFormat::formatToColorBitsString[Formats_Last] = { "16", "24", "24", "30", "16", "24", "24", "32" };
|
||||||
|
|
||||||
|
CGxFormat::CGxFormat() {
|
||||||
|
this->size.x = 0;
|
||||||
|
this->size.y = 0;
|
||||||
|
this->pos.x = 0;
|
||||||
|
this->pos.y = 0;
|
||||||
|
this->sampleQuality = 0.0;
|
||||||
|
this->maximize = 0;
|
||||||
|
this->stereoEnabled = false;
|
||||||
|
this->sampleCount = 1;
|
||||||
|
this->aspect = 1;
|
||||||
|
this->unk1 = -1;
|
||||||
|
this->unk2 = -1;
|
||||||
|
this->unk3 = -1;
|
||||||
|
this->unk4 = -1;
|
||||||
|
this->unk5 = -1;
|
||||||
|
this->unk6 = -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
CGxFormat::CGxFormat(bool p_window, const C2iVector& p_size, Format p_colorFormat, Format p_depthFormat, uint32_t p_refreshRate, uint32_t p_vsync, bool p_hwTnl, bool p_fixLag, bool p_hwCursor, bool p_aspect, bool p_maximize) {
|
||||||
|
this->size.x = 0;
|
||||||
|
this->size.y = 0;
|
||||||
|
this->pos.x = 0;
|
||||||
|
this->pos.y = 0;
|
||||||
|
this->hwTnL = p_hwTnl;
|
||||||
|
this->hwCursor = p_hwCursor;
|
||||||
|
this->fixLag = p_fixLag;
|
||||||
|
this->window = p_window;
|
||||||
|
this->depthFormat = p_depthFormat;
|
||||||
|
this->size.x = p_size.x;
|
||||||
|
this->size.y = p_size.y;
|
||||||
|
this->sampleQuality = 0.0;
|
||||||
|
this->colorFormat = p_colorFormat;
|
||||||
|
this->refreshRate = p_refreshRate;
|
||||||
|
this->vsync = p_vsync;
|
||||||
|
this->aspect = p_aspect;
|
||||||
|
this->stereoEnabled = 0;
|
||||||
|
this->maximize = p_maximize;
|
||||||
|
this->backbuffers = 1;
|
||||||
|
this->sampleCount = 1;
|
||||||
|
this->unk1 = -1;
|
||||||
|
this->unk2 = -1;
|
||||||
|
this->unk3 = -1;
|
||||||
|
this->unk4 = -1;
|
||||||
|
this->unk5 = -1;
|
||||||
|
this->unk6 = -1;
|
||||||
|
}
|
@ -19,18 +19,34 @@ class CGxFormat {
|
|||||||
Formats_Last = 8
|
Formats_Last = 8
|
||||||
};
|
};
|
||||||
|
|
||||||
|
CGxFormat();
|
||||||
|
CGxFormat(bool p_window, const C2iVector& p_size, Format p_colorFormat, Format p_depthFormat, uint32_t p_refreshRate, uint32_t p_vsync, bool p_hwTnl, bool p_fixLag, bool p_hwCursor, bool p_aspect, bool p_maximize);
|
||||||
|
|
||||||
|
static const char* formatToColorBitsString[Formats_Last];
|
||||||
|
|
||||||
// Member variables
|
// Member variables
|
||||||
|
uint32_t apiSpecificModeID;
|
||||||
bool hwTnL;
|
bool hwTnL;
|
||||||
bool hwCursor;
|
bool hwCursor;
|
||||||
bool fixLag;
|
bool fixLag;
|
||||||
int8_t window;
|
int8_t window;
|
||||||
|
int8_t aspect;
|
||||||
int32_t maximize;
|
int32_t maximize;
|
||||||
Format depthFormat;
|
Format depthFormat;
|
||||||
C2iVector size;
|
C2iVector size;
|
||||||
|
uint32_t backbuffers;
|
||||||
uint32_t sampleCount;
|
uint32_t sampleCount;
|
||||||
|
float sampleQuality;
|
||||||
Format colorFormat;
|
Format colorFormat;
|
||||||
uint32_t refreshRate;
|
uint32_t refreshRate;
|
||||||
uint32_t vsync;
|
uint32_t vsync;
|
||||||
|
bool stereoEnabled;
|
||||||
|
uint32_t unk1;
|
||||||
|
uint32_t unk2;
|
||||||
|
uint32_t unk3;
|
||||||
|
uint32_t unk4;
|
||||||
|
uint32_t unk5;
|
||||||
|
uint32_t unk6;
|
||||||
C2iVector pos;
|
C2iVector pos;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -59,3 +59,15 @@ void GxFormatColor(CImVector& color) {
|
|||||||
color = formattedColor;
|
color = formattedColor;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void GxLogOpen() {
|
||||||
|
CGxDevice::LogOpen();
|
||||||
|
}
|
||||||
|
|
||||||
|
void GxLogClose() {
|
||||||
|
CGxDevice::LogClose();
|
||||||
|
}
|
||||||
|
|
||||||
|
void GxLog(const char* format, ...) {
|
||||||
|
// TODO
|
||||||
|
}
|
||||||
|
@ -18,4 +18,10 @@ void GxCapsWindowSize(CRect&);
|
|||||||
|
|
||||||
void GxFormatColor(CImVector&);
|
void GxFormatColor(CImVector&);
|
||||||
|
|
||||||
|
void GxLogOpen();
|
||||||
|
|
||||||
|
void GxLogClose();
|
||||||
|
|
||||||
|
void GxLog(const char* format, ...);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -1109,6 +1109,20 @@ void CGxDeviceD3d::IRsSendToHw(EGxRenderState which) {
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
case GxRs_Lighting: {
|
||||||
|
int32_t enabled = 0;
|
||||||
|
|
||||||
|
if (this->MasterEnable(GxMasterEnable_Lighting)) {
|
||||||
|
enabled = state->m_value.m_data.i[0] != 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (this->m_deviceStates[Ds_Lighting] != enabled) {
|
||||||
|
this->m_d3dDevice->SetRenderState(D3DRS_LIGHTING, enabled);
|
||||||
|
this->m_deviceStates[Ds_Lighting] = enabled;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
case GxRs_DepthTest:
|
case GxRs_DepthTest:
|
||||||
case GxRs_DepthFunc: {
|
case GxRs_DepthFunc: {
|
||||||
auto depthTest = static_cast<uint32_t>((&this->m_appRenderStates[GxRs_DepthTest])->m_value);
|
auto depthTest = static_cast<uint32_t>((&this->m_appRenderStates[GxRs_DepthTest])->m_value);
|
||||||
|
@ -1,6 +1,8 @@
|
|||||||
#ifndef NET_TYPES_HPP
|
#ifndef NET_TYPES_HPP
|
||||||
#define NET_TYPES_HPP
|
#define NET_TYPES_HPP
|
||||||
|
|
||||||
|
#include <tempest/vector/C3Vector.hpp>
|
||||||
|
|
||||||
#include <cstdint>
|
#include <cstdint>
|
||||||
|
|
||||||
enum LOGIN_RESULT {
|
enum LOGIN_RESULT {
|
||||||
@ -1252,4 +1254,36 @@ struct REALM_INFO {
|
|||||||
uint16_t revision;
|
uint16_t revision;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
struct INVENTORY_ITEM {
|
||||||
|
uint8_t type;
|
||||||
|
uint32_t displayID;
|
||||||
|
uint32_t auraID;
|
||||||
|
};
|
||||||
|
|
||||||
|
struct CHARACTER_INFO {
|
||||||
|
uint64_t guid;
|
||||||
|
char name[48];
|
||||||
|
uint32_t mapID;
|
||||||
|
uint32_t zoneID;
|
||||||
|
uint32_t guildID;
|
||||||
|
C3Vector position;
|
||||||
|
INVENTORY_ITEM items[23];
|
||||||
|
uint32_t petDisplayInfoID;
|
||||||
|
uint32_t petExperienceLevel;
|
||||||
|
uint32_t petCreatureFamilyID;
|
||||||
|
uint32_t flags;
|
||||||
|
uint32_t customizeFlags;
|
||||||
|
uint8_t raceID;
|
||||||
|
uint8_t classID;
|
||||||
|
uint8_t sexID;
|
||||||
|
uint8_t skinID;
|
||||||
|
uint8_t faceID;
|
||||||
|
uint8_t hairStyleID;
|
||||||
|
uint8_t hairColorID;
|
||||||
|
uint8_t facialHairStyleID;
|
||||||
|
uint8_t experienceLevel;
|
||||||
|
uint8_t firstLogin;
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -2,6 +2,7 @@
|
|||||||
#include "net/Login.hpp"
|
#include "net/Login.hpp"
|
||||||
#include "client/ClientServices.hpp"
|
#include "client/ClientServices.hpp"
|
||||||
#include "ui/FrameScript.hpp"
|
#include "ui/FrameScript.hpp"
|
||||||
|
#include <storm/Error.hpp>
|
||||||
|
|
||||||
const char* s_errorCodeTokens[] = {
|
const char* s_errorCodeTokens[] = {
|
||||||
"RESPONSE_SUCCESS",
|
"RESPONSE_SUCCESS",
|
||||||
@ -110,6 +111,13 @@ const char* s_errorCodeTokens[] = {
|
|||||||
"CHAR_NAME_DECLENSION_DOESNT_MATCH_BASE_NAME",
|
"CHAR_NAME_DECLENSION_DOESNT_MATCH_BASE_NAME",
|
||||||
};
|
};
|
||||||
|
|
||||||
|
void ClientConnection::AccountLogin(const char* name, const char* password, int32_t region, int32_t locale) {
|
||||||
|
STORM_ASSERT(this->m_statusComplete == 1);
|
||||||
|
STORM_ASSERT(name);
|
||||||
|
STORM_ASSERT(password);
|
||||||
|
this->Initiate(COP_AUTHENTICATE, 11, nullptr);
|
||||||
|
}
|
||||||
|
|
||||||
void ClientConnection::AccountLogin_Finish(int32_t errorCode) {
|
void ClientConnection::AccountLogin_Finish(int32_t errorCode) {
|
||||||
this->Complete(errorCode == 12, errorCode);
|
this->Complete(errorCode == 12, errorCode);
|
||||||
}
|
}
|
||||||
@ -124,6 +132,24 @@ void ClientConnection::AccountLogin_Queued() {
|
|||||||
// TODO CGlueMgr::UpdateWaitQueue(this->m_queuePosition);
|
// TODO CGlueMgr::UpdateWaitQueue(this->m_queuePosition);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void ClientConnection::GetCharacterList() {
|
||||||
|
this->Initiate(COP_GET_CHARACTERS, 43, nullptr);
|
||||||
|
if (this->m_connected) {
|
||||||
|
this->RequestCharacterEnum();
|
||||||
|
} else {
|
||||||
|
this->Cancel(4);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void ClientConnection::CharacterLogin(uint64_t id) {
|
||||||
|
this->Initiate(COP_LOGIN_CHARACTER, 76, nullptr);
|
||||||
|
if (this->m_connected) {
|
||||||
|
this->RequestCharacterLogin(id);
|
||||||
|
} else {
|
||||||
|
this->Cancel(4);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void ClientConnection::Cancel(int32_t errorCode) {
|
void ClientConnection::Cancel(int32_t errorCode) {
|
||||||
this->Complete(0, errorCode);
|
this->Complete(0, errorCode);
|
||||||
}
|
}
|
||||||
|
@ -18,16 +18,19 @@ class ClientConnection : public RealmConnection {
|
|||||||
|
|
||||||
// Virtual member functions
|
// Virtual member functions
|
||||||
virtual int32_t HandleConnect();
|
virtual int32_t HandleConnect();
|
||||||
|
virtual void Complete(int32_t result, int32_t errorCode);
|
||||||
|
|
||||||
// Member functions
|
// Member functions
|
||||||
ClientConnection(RealmResponse* realmResponse)
|
ClientConnection(RealmResponse* realmResponse)
|
||||||
: RealmConnection(realmResponse)
|
: RealmConnection(realmResponse)
|
||||||
{};
|
{};
|
||||||
|
void AccountLogin(const char* name, const char* password, int32_t region, int32_t locale);
|
||||||
void AccountLogin_Finish(int32_t authResult);
|
void AccountLogin_Finish(int32_t authResult);
|
||||||
void AccountLogin_Queued();
|
void AccountLogin_Queued();
|
||||||
|
void GetCharacterList();
|
||||||
|
void CharacterLogin(uint64_t id);
|
||||||
void Cancel(int32_t errorCode);
|
void Cancel(int32_t errorCode);
|
||||||
void Cleanup();
|
void Cleanup();
|
||||||
void Complete(int32_t result, int32_t errorCode);
|
|
||||||
void Connect();
|
void Connect();
|
||||||
int32_t Disconnect();
|
int32_t Disconnect();
|
||||||
void Initiate(WOWCS_OPS op, int32_t errorCode, void (*cleanup)());
|
void Initiate(WOWCS_OPS op, int32_t errorCode, void (*cleanup)());
|
||||||
|
@ -24,7 +24,7 @@ int32_t RealmConnection::MessageHandler(void* param, NETMESSAGE msgId, uint32_t
|
|||||||
}
|
}
|
||||||
|
|
||||||
case SMSG_ENUM_CHARACTERS_RESULT: {
|
case SMSG_ENUM_CHARACTERS_RESULT: {
|
||||||
// TODO
|
result = connection->HandleCharEnum(msgId, time, msg);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -192,6 +192,100 @@ int32_t RealmConnection::HandleAuthResponse(uint32_t msgId, uint32_t time, CData
|
|||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int32_t RealmConnection::HandleCharEnum(uint32_t msgId, uint32_t time, CDataStore* msg) {
|
||||||
|
if (this->m_realmResponse) {
|
||||||
|
this->m_realmResponse->GameServerResult(this, "SMSG_CHAR_ENUM", nullptr, nullptr);
|
||||||
|
}
|
||||||
|
|
||||||
|
uint8_t count;
|
||||||
|
msg->Get(count);
|
||||||
|
|
||||||
|
bool overflow = false;
|
||||||
|
if (count > 10) {
|
||||||
|
count = 0;
|
||||||
|
overflow = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
m_characterList.SetCount(count);
|
||||||
|
|
||||||
|
for (uint32_t i = 0; i < count; ++i) {
|
||||||
|
auto& character = m_characterList[i];
|
||||||
|
msg->Get(character.guid);
|
||||||
|
msg->GetString(character.name, 48);
|
||||||
|
msg->Get(character.raceID);
|
||||||
|
msg->Get(character.classID);
|
||||||
|
msg->Get(character.sexID);
|
||||||
|
msg->Get(character.skinID);
|
||||||
|
msg->Get(character.faceID);
|
||||||
|
msg->Get(character.hairStyleID);
|
||||||
|
msg->Get(character.hairColorID);
|
||||||
|
msg->Get(character.facialHairStyleID);
|
||||||
|
msg->Get(character.experienceLevel);
|
||||||
|
msg->Get(character.zoneID);
|
||||||
|
msg->Get(character.mapID);
|
||||||
|
msg->Get(character.position.x);
|
||||||
|
msg->Get(character.position.y);
|
||||||
|
msg->Get(character.position.z);
|
||||||
|
msg->Get(character.guildID);
|
||||||
|
msg->Get(character.flags);
|
||||||
|
msg->Get(character.customizeFlags);
|
||||||
|
msg->Get(character.firstLogin);
|
||||||
|
msg->Get(character.petDisplayInfoID);
|
||||||
|
msg->Get(character.petExperienceLevel);
|
||||||
|
msg->Get(character.petCreatureFamilyID);
|
||||||
|
for (uint32_t j = 0; j < 23; ++j) {
|
||||||
|
msg->Get(character.items[j].displayID);
|
||||||
|
msg->Get(character.items[j].type);
|
||||||
|
msg->Get(character.items[j].auraID);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
int32_t success = 0;
|
||||||
|
if (msg->IsRead()) {
|
||||||
|
if (!overflow) {
|
||||||
|
success = 1;
|
||||||
|
}
|
||||||
|
} else if (!overflow) {
|
||||||
|
// TODO: Proper implementation
|
||||||
|
uint32_t value;
|
||||||
|
msg->Get(value);
|
||||||
|
msg->Get(value);
|
||||||
|
msg->Get(value);
|
||||||
|
msg->Get(value);
|
||||||
|
msg->Get(value);
|
||||||
|
msg->Get(value);
|
||||||
|
msg->Get(value);
|
||||||
|
msg->Get(value);
|
||||||
|
msg->Get(value);
|
||||||
|
msg->Get(value);
|
||||||
|
if (msg->IsRead()) {
|
||||||
|
success = 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!success) {
|
||||||
|
m_characterList.Clear();
|
||||||
|
}
|
||||||
|
|
||||||
|
this->m_realmResponse->CharacterListReceived(this, msg, success);
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
void RealmConnection::SetSelectedRealm(uint32_t a2, uint32_t a3, uint32_t a4) {
|
void RealmConnection::SetSelectedRealm(uint32_t a2, uint32_t a3, uint32_t a4) {
|
||||||
// TODO
|
// TODO
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void RealmConnection::RequestCharacterEnum() {
|
||||||
|
CDataStore msg;
|
||||||
|
msg.Put(static_cast<uint32_t>(CMSG_ENUM_CHARACTERS));
|
||||||
|
msg.Finalize();
|
||||||
|
this->Send(&msg);
|
||||||
|
}
|
||||||
|
|
||||||
|
void RealmConnection::RequestCharacterLogin(uint64_t id) {
|
||||||
|
CDataStore msg;
|
||||||
|
msg.Put(static_cast<uint32_t>(CMSG_PLAYER_LOGIN));
|
||||||
|
msg.Put(id);
|
||||||
|
msg.Finalize();
|
||||||
|
this->Send(&msg);
|
||||||
|
}
|
||||||
|
@ -24,6 +24,7 @@ class RealmConnection : public NetClient {
|
|||||||
|
|
||||||
// Member variables
|
// Member variables
|
||||||
RealmResponse* m_realmResponse;
|
RealmResponse* m_realmResponse;
|
||||||
|
TSFixedArray<CHARACTER_INFO> m_characterList;
|
||||||
uint8_t m_authenticated = 0;
|
uint8_t m_authenticated = 0;
|
||||||
uint32_t m_queuePosition = 0;
|
uint32_t m_queuePosition = 0;
|
||||||
uint32_t m_freeCharacterMigration = 0;
|
uint32_t m_freeCharacterMigration = 0;
|
||||||
@ -34,11 +35,15 @@ class RealmConnection : public NetClient {
|
|||||||
|
|
||||||
// Virtual member functions
|
// Virtual member functions
|
||||||
virtual int32_t HandleAuthChallenge(AuthenticationChallenge* challenge);
|
virtual int32_t HandleAuthChallenge(AuthenticationChallenge* challenge);
|
||||||
|
virtual void Complete(int32_t result, int32_t errorCode) = 0;
|
||||||
|
|
||||||
// Member functions
|
// Member functions
|
||||||
RealmConnection(RealmResponse* realmResponse);
|
RealmConnection(RealmResponse* realmResponse);
|
||||||
int32_t HandleAuthResponse(uint32_t msgId, uint32_t time, CDataStore* msg);
|
int32_t HandleAuthResponse(uint32_t msgId, uint32_t time, CDataStore* msg);
|
||||||
|
int32_t HandleCharEnum(uint32_t msgId, uint32_t time, CDataStore* msg);
|
||||||
void SetSelectedRealm(uint32_t a2, uint32_t a3, uint32_t a4);
|
void SetSelectedRealm(uint32_t a2, uint32_t a3, uint32_t a4);
|
||||||
|
void RequestCharacterEnum();
|
||||||
|
void RequestCharacterLogin(uint64_t id);
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -5,6 +5,7 @@ class RealmResponse {
|
|||||||
public:
|
public:
|
||||||
// Virtual member functions
|
// Virtual member functions
|
||||||
virtual void HandleAuthResponse(RealmConnection* connection, uint8_t authResult) = 0;
|
virtual void HandleAuthResponse(RealmConnection* connection, uint8_t authResult) = 0;
|
||||||
|
virtual void CharacterListReceived(RealmConnection* connection, void* a2, int32_t success) = 0;
|
||||||
virtual void GameServerResult(RealmConnection* connection, const char* a3, const char* a4, const char* a5) = 0;
|
virtual void GameServerResult(RealmConnection* connection, const char* a3, const char* a4, const char* a5) = 0;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -11,10 +11,10 @@
|
|||||||
STORM_EXPLICIT_LIST(CLayoutFrame, resizeLink) LayoutFrame::s_resizePendingList;
|
STORM_EXPLICIT_LIST(CLayoutFrame, resizeLink) LayoutFrame::s_resizePendingList;
|
||||||
|
|
||||||
float SynthesizeSide(float center, float opposite, float size) {
|
float SynthesizeSide(float center, float opposite, float size) {
|
||||||
if (center != CFramePoint::UNDEFINED && opposite != CFramePoint::UNDEFINED) {
|
if (opposite != CFramePoint::UNDEFINED && size != 0.0f) {
|
||||||
return center + center - opposite;
|
|
||||||
} else if (opposite != CFramePoint::UNDEFINED && size != 0.0f) {
|
|
||||||
return opposite + size;
|
return opposite + size;
|
||||||
|
} else if (center != CFramePoint::UNDEFINED && opposite != CFramePoint::UNDEFINED) {
|
||||||
|
return center + center - opposite;
|
||||||
} else if (center != CFramePoint::UNDEFINED && size != 0.0f) {
|
} else if (center != CFramePoint::UNDEFINED && size != 0.0f) {
|
||||||
return center + (size * 0.5f);
|
return center + (size * 0.5f);
|
||||||
} else {
|
} else {
|
||||||
|
@ -12,6 +12,7 @@ target_include_directories(ui
|
|||||||
target_link_libraries(ui
|
target_link_libraries(ui
|
||||||
PRIVATE
|
PRIVATE
|
||||||
client
|
client
|
||||||
|
clientobject
|
||||||
console
|
console
|
||||||
db
|
db
|
||||||
event
|
event
|
||||||
|
@ -150,7 +150,10 @@ void FrameScript_CreateEvents(const char* names[], uint32_t count) {
|
|||||||
FrameScript::s_scriptEvents.SetCount(count);
|
FrameScript::s_scriptEvents.SetCount(count);
|
||||||
|
|
||||||
for (int32_t i = 0; i < count; i++) {
|
for (int32_t i = 0; i < count; i++) {
|
||||||
auto event = FrameScript::s_scriptEventsHash.New(names[i], 0, 0);
|
FrameScript_EventObject* event = nullptr;
|
||||||
|
if (names[i]) {
|
||||||
|
event = FrameScript::s_scriptEventsHash.New(names[i], 0, 0);
|
||||||
|
}
|
||||||
FrameScript::s_scriptEvents[i] = event;
|
FrameScript::s_scriptEvents[i] = event;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -589,3 +589,24 @@ void FrameXML_StoreHashNode(XMLNode* node, const char* name, const char* a3, CSt
|
|||||||
status->Add(STATUS_INFO, "-- Added virtual frame %s", name);
|
status->Add(STATUS_INFO, "-- Added virtual frame %s", name);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int32_t FrameXML_GuessNumFiles(const char* data) {
|
||||||
|
int32_t result = 0;
|
||||||
|
while (*data) {
|
||||||
|
while (*data == '\r' || *data == '\n') {
|
||||||
|
++data;
|
||||||
|
}
|
||||||
|
if (!*data) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
char v3 = *data;
|
||||||
|
if (v3 != '#')
|
||||||
|
++result;
|
||||||
|
while (v3 != '\r' && v3 != '\n') {
|
||||||
|
v3 = *++data;
|
||||||
|
if (!v3)
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
@ -52,4 +52,6 @@ void FrameXML_ReleaseHashNode(const char* name);
|
|||||||
|
|
||||||
void FrameXML_StoreHashNode(XMLNode* node, const char* name, const char* a3, CStatus* status);
|
void FrameXML_StoreHashNode(XMLNode* node, const char* name, const char* a3, CStatus* status);
|
||||||
|
|
||||||
|
int32_t FrameXML_GuessNumFiles(const char* data);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -5,7 +5,9 @@
|
|||||||
#include "ui/Types.hpp"
|
#include "ui/Types.hpp"
|
||||||
#include "util/Lua.hpp"
|
#include "util/Lua.hpp"
|
||||||
#include "util/Unimplemented.hpp"
|
#include "util/Unimplemented.hpp"
|
||||||
#include <cstdint>
|
#include "glue/CGlueMgr.hpp"
|
||||||
|
#include "db/Db.hpp"
|
||||||
|
#include "clientobject/Unit_C.hpp"
|
||||||
|
|
||||||
int32_t Script_SetCharSelectModelFrame(lua_State* L) {
|
int32_t Script_SetCharSelectModelFrame(lua_State* L) {
|
||||||
if (!lua_isstring(L, 1)) {
|
if (!lua_isstring(L, 1)) {
|
||||||
@ -35,17 +37,74 @@ int32_t Script_SetCharSelectBackground(lua_State* L) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
int32_t Script_GetCharacterListUpdate(lua_State* L) {
|
int32_t Script_GetCharacterListUpdate(lua_State* L) {
|
||||||
WHOA_UNIMPLEMENTED(0);
|
// TODO: CCharSelectInfo::ClearCharacterModel();
|
||||||
|
// TODO: CCharSelectInfo::ClearPetModel();
|
||||||
|
CGlueMgr::GetCharacterList();
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int32_t Script_GetNumCharacters(lua_State* L) {
|
int32_t Script_GetNumCharacters(lua_State* L) {
|
||||||
lua_pushnumber(L, CCharacterSelection::s_characterList.Count());
|
lua_pushnumber(L, CCharacterSelection::GetNumCharacters());
|
||||||
|
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
int32_t Script_GetCharacterInfo(lua_State* L) {
|
int32_t Script_GetCharacterInfo(lua_State* L) {
|
||||||
WHOA_UNIMPLEMENTED(0);
|
if (!lua_isnumber(L, 1)) {
|
||||||
|
luaL_error(L, "Usage: GetCharacterInfo(index)");
|
||||||
|
}
|
||||||
|
|
||||||
|
int index = static_cast<int>(lua_tonumber(L, 1)) - 1;
|
||||||
|
if (index < 0 || index > CCharacterSelection::GetNumCharacters()) {
|
||||||
|
lua_pushnil(L); // name
|
||||||
|
lua_pushnil(L); // race
|
||||||
|
lua_pushnil(L); // class
|
||||||
|
lua_pushnumber(L, 0.0); // level
|
||||||
|
lua_pushnumber(L, 0.0); // zone
|
||||||
|
lua_pushnil(L); // sex
|
||||||
|
lua_pushnil(L); // ghost
|
||||||
|
lua_pushnil(L); // PCC
|
||||||
|
lua_pushnil(L); // PRC
|
||||||
|
lua_pushnil(L); // PFC
|
||||||
|
return 10;
|
||||||
|
}
|
||||||
|
|
||||||
|
auto& character = CCharacterSelection::s_characterList[index].m_characterInfo;
|
||||||
|
lua_pushstring(L, character.name);
|
||||||
|
|
||||||
|
auto raceName = CGUnit_C::GetDisplayRaceNameFromRecord(g_chrRacesDB.GetRecord(character.raceID), character.sexID);
|
||||||
|
lua_pushstring(L, raceName ? raceName : "");
|
||||||
|
|
||||||
|
// TODO: auto className = CGUnit_C::GetDisplayClassNameFromRecord(g_chrClassesDB.GetRecord(character.classID), character.sexID);
|
||||||
|
auto className = "Warrior";
|
||||||
|
lua_pushstring(L, className ? className : "");
|
||||||
|
|
||||||
|
lua_pushnumber(L, character.experienceLevel);
|
||||||
|
|
||||||
|
// TODO: auto areaRecord = g_areaTableDB.GetRecord(character.zoneID);
|
||||||
|
void* areaRecord = nullptr;
|
||||||
|
if (areaRecord) {
|
||||||
|
// TODO: lua_pushstring(L, areaRecord->name)
|
||||||
|
} else {
|
||||||
|
lua_pushnil(L);
|
||||||
|
}
|
||||||
|
|
||||||
|
// TODO: Use g_glueFrameScriptGenders[character.sexID]
|
||||||
|
lua_pushnumber(L, 0);
|
||||||
|
|
||||||
|
// ghost
|
||||||
|
lua_pushboolean(L, character.flags & 0x2000);
|
||||||
|
|
||||||
|
// PCC
|
||||||
|
lua_pushboolean(L, character.customizeFlags & 1);
|
||||||
|
|
||||||
|
// PRC
|
||||||
|
lua_pushboolean(L, character.customizeFlags & 0x100000);
|
||||||
|
|
||||||
|
// PFC
|
||||||
|
lua_pushboolean(L, character.customizeFlags & 0x10000);
|
||||||
|
|
||||||
|
return 10;
|
||||||
}
|
}
|
||||||
|
|
||||||
int32_t Script_SelectCharacter(lua_State* L) {
|
int32_t Script_SelectCharacter(lua_State* L) {
|
||||||
@ -71,11 +130,19 @@ int32_t Script_UpdateSelectionCustomizationScene(lua_State* L) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
int32_t Script_GetCharacterSelectFacing(lua_State* L) {
|
int32_t Script_GetCharacterSelectFacing(lua_State* L) {
|
||||||
WHOA_UNIMPLEMENTED(0);
|
// Radian to Degree
|
||||||
|
lua_pushnumber(L, CCharacterSelection::s_charFacing * 57.29578f);
|
||||||
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
int32_t Script_SetCharacterSelectFacing(lua_State* L) {
|
int32_t Script_SetCharacterSelectFacing(lua_State* L) {
|
||||||
WHOA_UNIMPLEMENTED(0);
|
if (!lua_isnumber(L, 1)) {
|
||||||
|
luaL_error(L, "Usage: SetCharacterSelectFacing(degrees)");
|
||||||
|
}
|
||||||
|
// Degree to Radian
|
||||||
|
float facing = lua_tonumber(L, 1) * 0.017453292;
|
||||||
|
CCharacterSelection::SetCharFacing(facing);
|
||||||
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
int32_t Script_GetSelectBackgroundModel(lua_State* L) {
|
int32_t Script_GetSelectBackgroundModel(lua_State* L) {
|
||||||
@ -83,16 +150,23 @@ int32_t Script_GetSelectBackgroundModel(lua_State* L) {
|
|||||||
return luaL_error(L, "Usage: GetSelectBackgroundModel(index)");
|
return luaL_error(L, "Usage: GetSelectBackgroundModel(index)");
|
||||||
}
|
}
|
||||||
|
|
||||||
auto characterIndex = static_cast<int32_t>(lua_tonumber(L, 1)) - 1;
|
auto index = static_cast<int32_t>(lua_tonumber(L, 1)) - 1;
|
||||||
|
|
||||||
|
// TODO: if (SFile::IsTrial())
|
||||||
|
if (false) {
|
||||||
|
lua_pushstring(L, "CharacterSelect");
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
// TODO
|
// TODO
|
||||||
|
|
||||||
ChrRacesRec* racesRec = nullptr;
|
ChrRacesRec* racesRec = nullptr;
|
||||||
|
|
||||||
if (characterIndex < 0 || characterIndex >= CCharacterSelection::s_characterList.Count()) {
|
if (index < 0 || index >= CCharacterSelection::s_characterList.Count()) {
|
||||||
racesRec = g_chrRacesDB.GetRecord(2);
|
racesRec = g_chrRacesDB.GetRecord(2);
|
||||||
} else {
|
} else {
|
||||||
// TODO
|
auto raceID = CCharacterSelection::s_characterList[index].m_characterInfo.raceID;
|
||||||
|
racesRec = g_chrRacesDB.GetRecord(raceID);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (racesRec) {
|
if (racesRec) {
|
||||||
|
@ -5,6 +5,7 @@
|
|||||||
#include "glue/CGlueMgr.hpp"
|
#include "glue/CGlueMgr.hpp"
|
||||||
#include "gx/Coordinate.hpp"
|
#include "gx/Coordinate.hpp"
|
||||||
#include "net/connection/ClientConnection.hpp"
|
#include "net/connection/ClientConnection.hpp"
|
||||||
|
#include "net/Login.hpp"
|
||||||
#include "ui/CSimpleTop.hpp"
|
#include "ui/CSimpleTop.hpp"
|
||||||
#include "ui/Types.hpp"
|
#include "ui/Types.hpp"
|
||||||
#include "console/CVar.hpp"
|
#include "console/CVar.hpp"
|
||||||
@ -19,11 +20,11 @@ int32_t Script_IsShiftKeyDown(lua_State* L) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
int32_t Script_GetBuildInfo(lua_State* L) {
|
int32_t Script_GetBuildInfo(lua_State* L) {
|
||||||
auto version = FrameScript_GetText("VERSION", -1, GENDER_NOT_APPLICABLE);
|
auto szVersion = FrameScript_GetText("VERSION", -1, GENDER_NOT_APPLICABLE);
|
||||||
lua_pushstring(L, version);
|
auto szVersionType = FrameScript_GetText("RELEASE_BUILD", -1, GENDER_NOT_APPLICABLE);
|
||||||
|
|
||||||
auto releaseBuild = FrameScript_GetText("RELEASE_BUILD", -1, GENDER_NOT_APPLICABLE);
|
lua_pushstring(L, szVersion);
|
||||||
lua_pushstring(L, releaseBuild);
|
lua_pushstring(L, szVersionType);
|
||||||
lua_pushstring(L, "3.3.5");
|
lua_pushstring(L, "3.3.5");
|
||||||
lua_pushstring(L, "12340");
|
lua_pushstring(L, "12340");
|
||||||
lua_pushstring(L, "Jun 24 2010");
|
lua_pushstring(L, "Jun 24 2010");
|
||||||
@ -274,7 +275,12 @@ int32_t Script_GetServerName(lua_State* L) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
int32_t Script_DisconnectFromServer(lua_State* L) {
|
int32_t Script_DisconnectFromServer(lua_State* L) {
|
||||||
WHOA_UNIMPLEMENTED(0);
|
if (ClientServices::Connection()->IsConnected()) {
|
||||||
|
CGlueMgr::m_disconnectPending = 1;
|
||||||
|
ClientServices::Connection()->Disconnect();
|
||||||
|
}
|
||||||
|
ClientServices::LoginConnection()->Logoff();
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int32_t Script_IsConnectedToServer(lua_State* L) {
|
int32_t Script_IsConnectedToServer(lua_State* L) {
|
||||||
@ -288,7 +294,8 @@ int32_t Script_IsConnectedToServer(lua_State* L) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
int32_t Script_EnterWorld(lua_State* L) {
|
int32_t Script_EnterWorld(lua_State* L) {
|
||||||
WHOA_UNIMPLEMENTED(0);
|
CGlueMgr::EnterWorld();
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int32_t Script_Screenshot(lua_State* L) {
|
int32_t Script_Screenshot(lua_State* L) {
|
||||||
|
@ -8,8 +8,9 @@
|
|||||||
#include <bc/file/File.hpp>
|
#include <bc/file/File.hpp>
|
||||||
#include "util/Filesystem.hpp"
|
#include "util/Filesystem.hpp"
|
||||||
|
|
||||||
static char s_basepath[STORM_MAX_PATH] = {0};
|
static char s_basepath[STORM_MAX_PATH] = { 0 };
|
||||||
static char s_datapath[STORM_MAX_PATH] = {0};
|
static char s_datapath[STORM_MAX_PATH] = { 0 };
|
||||||
|
static char s_datapath2[STORM_MAX_PATH] = { 0 };
|
||||||
|
|
||||||
// TODO Proper implementation
|
// TODO Proper implementation
|
||||||
int32_t SFile::Close(SFile* file) {
|
int32_t SFile::Close(SFile* file) {
|
||||||
@ -279,3 +280,17 @@ int32_t SFile::GetDataPath(char* buffer, size_t bufferchars) {
|
|||||||
SStrCopy(buffer, s_datapath, bufferchars);
|
SStrCopy(buffer, s_datapath, bufferchars);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int32_t SFile::SetDataPathAlternate(const char* path) {
|
||||||
|
SStrCopy(s_datapath2, path, STORM_MAX_PATH);
|
||||||
|
size_t length = SStrLen(s_datapath2);
|
||||||
|
if (length && s_datapath2[length - 1] != '\\' && s_datapath2[length - 1] != '/') {
|
||||||
|
SStrPack(s_datapath2, "\\", STORM_MAX_PATH);
|
||||||
|
}
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
int32_t SFile::RebuildHash() {
|
||||||
|
// TODO
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
@ -39,6 +39,8 @@ class SFile {
|
|||||||
static int32_t SetDataPath(const char* path);
|
static int32_t SetDataPath(const char* path);
|
||||||
static int32_t GetBasePath(char* path, size_t capacity);
|
static int32_t GetBasePath(char* path, size_t capacity);
|
||||||
static int32_t GetDataPath(char* path, size_t capacity);
|
static int32_t GetDataPath(char* path, size_t capacity);
|
||||||
|
static int32_t SetDataPathAlternate(const char* path);
|
||||||
|
static int32_t RebuildHash();
|
||||||
|
|
||||||
// Member variables
|
// Member variables
|
||||||
SFILE_TYPE m_type;
|
SFILE_TYPE m_type;
|
||||||
|
@ -150,7 +150,7 @@ int32_t StringToJustify(const char* string, uint32_t& justify) {
|
|||||||
{ 0x20, "BOTTOM" }
|
{ 0x20, "BOTTOM" }
|
||||||
};
|
};
|
||||||
|
|
||||||
for (int32_t i = 0; i < 5; i++) {
|
for (int32_t i = 0; i < 6; i++) {
|
||||||
if (!SStrCmpI(justifyMap[i].string, string, 0x7FFFFFFFu)) {
|
if (!SStrCmpI(justifyMap[i].string, string, 0x7FFFFFFFu)) {
|
||||||
justify = justifyMap[i].value;
|
justify = justifyMap[i].value;
|
||||||
return 1;
|
return 1;
|
||||||
|
6
src/world/World.cpp
Normal file
6
src/world/World.cpp
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
#include "world/World.hpp"
|
||||||
|
|
||||||
|
int32_t LoadNewWorld() {
|
||||||
|
|
||||||
|
return 1;
|
||||||
|
}
|
@ -3,4 +3,6 @@
|
|||||||
|
|
||||||
#include "world/CWorld.hpp"
|
#include "world/CWorld.hpp"
|
||||||
|
|
||||||
|
int32_t LoadNewWorld();
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
Loading…
Reference in New Issue
Block a user