Commit a29afe20 authored by xiaoye's avatar xiaoye

Merge branch 'develop' of https://code.moenext.com/nanahira/ygopro into develop

parents b7cdf6a4 35359f0b
...@@ -121,6 +121,17 @@ bool DataManager::LoadStrings(const char* file) { ...@@ -121,6 +121,17 @@ bool DataManager::LoadStrings(const char* file) {
std::fclose(fp); std::fclose(fp);
return true; return true;
} }
bool DataManager::LoadStrings(const wchar_t* file) {
FILE* fp = mywfopen(file, "r");
if(!fp)
return false;
char linebuf[TEXT_LINE_SIZE]{};
while(std::fgets(linebuf, sizeof linebuf, fp)) {
ReadStringConfLine(linebuf);
}
std::fclose(fp);
return true;
}
bool DataManager::LoadStrings(irr::io::IReadFile* reader) { bool DataManager::LoadStrings(irr::io::IReadFile* reader) {
char ch{}; char ch{};
std::string linebuf; std::string linebuf;
......
...@@ -47,6 +47,7 @@ public: ...@@ -47,6 +47,7 @@ public:
bool LoadDB(const wchar_t* wfile); bool LoadDB(const wchar_t* wfile);
bool LoadDB(irr::io::IReadFile* reader); bool LoadDB(irr::io::IReadFile* reader);
bool LoadStrings(const char* file); bool LoadStrings(const char* file);
bool LoadStrings(const wchar_t* file);
bool LoadStrings(irr::io::IReadFile* reader); bool LoadStrings(irr::io::IReadFile* reader);
void ReadStringConfLine(const char* linebuf); void ReadStringConfLine(const char* linebuf);
bool LoadServerList(const char* file); bool LoadServerList(const char* file);
......
...@@ -386,7 +386,7 @@ void DuelClient::HandleSTOCPacketLan(unsigned char* data, int len) { ...@@ -386,7 +386,7 @@ void DuelClient::HandleSTOCPacketLan(unsigned char* data, int len) {
break; break;
} }
case ERRMSG_VERERROR: { case ERRMSG_VERERROR: {
if (temp_ver) { if (temp_ver || !mainGame->gameConf.freever) {
temp_ver = 0; temp_ver = 0;
mainGame->btnCreateHost->setEnabled(true); mainGame->btnCreateHost->setEnabled(true);
mainGame->btnJoinHost->setEnabled(true); mainGame->btnJoinHost->setEnabled(true);
......
...@@ -1262,9 +1262,7 @@ void Game::LoadExpansions(const wchar_t* expansions_path) { ...@@ -1262,9 +1262,7 @@ void Game::LoadExpansions(const wchar_t* expansions_path) {
dataManager.LoadServerList(fpath); dataManager.LoadServerList(fpath);
server_list_changed = true; server_list_changed = true;
} else { } else {
char upath[1024]; dataManager.LoadStrings(fpath);
BufferIO::EncodeUTF8(fpath, upath);
dataManager.LoadStrings(upath);
} }
return; return;
} }
...@@ -1543,12 +1541,14 @@ bool Game::LoadConfigFromFile(const char* file) { ...@@ -1543,12 +1541,14 @@ bool Game::LoadConfigFromFile(const char* file) {
gameConf.use_d3d = std::strtol(valbuf, nullptr, 10) > 0; gameConf.use_d3d = std::strtol(valbuf, nullptr, 10) > 0;
} else if(!std::strcmp(strbuf, "use_image_scale")) { } else if(!std::strcmp(strbuf, "use_image_scale")) {
gameConf.use_image_scale = std::strtol(valbuf, nullptr, 10) > 0; gameConf.use_image_scale = std::strtol(valbuf, nullptr, 10) > 0;
} else if(!std::strcmp(strbuf, "pro_version")) {
PRO_VERSION = std::strtol(valbuf, nullptr, 10);
} else if (!std::strcmp(strbuf, "use_image_scale_multi_thread")) { } else if (!std::strcmp(strbuf, "use_image_scale_multi_thread")) {
gameConf.use_image_scale_multi_thread = std::strtol(valbuf, nullptr, 10) > 0; gameConf.use_image_scale_multi_thread = std::strtol(valbuf, nullptr, 10) > 0;
} else if (!std::strcmp(strbuf, "use_image_load_background_thread")) { } else if (!std::strcmp(strbuf, "use_image_load_background_thread")) {
gameConf.use_image_load_background_thread = std::strtol(valbuf, nullptr, 10) > 0; gameConf.use_image_load_background_thread = std::strtol(valbuf, nullptr, 10) > 0;
} else if(!std::strcmp(strbuf, "pro_version")) {
PRO_VERSION = std::strtol(valbuf, nullptr, 10);
} else if(!std::strcmp(strbuf, "freever")) {
gameConf.freever = std::strtol(valbuf, nullptr, 10) > 0;
} else if(!std::strcmp(strbuf, "errorlog")) { } else if(!std::strcmp(strbuf, "errorlog")) {
unsigned int val = std::strtol(valbuf, nullptr, 10); unsigned int val = std::strtol(valbuf, nullptr, 10);
enable_log = val & 0xff; enable_log = val & 0xff;
...@@ -1821,6 +1821,7 @@ void Game::SaveConfig() { ...@@ -1821,6 +1821,7 @@ void Game::SaveConfig() {
std::fprintf(fp, "use_image_scale_multi_thread = %d\n", gameConf.use_image_scale_multi_thread ? 1 : 0); std::fprintf(fp, "use_image_scale_multi_thread = %d\n", gameConf.use_image_scale_multi_thread ? 1 : 0);
std::fprintf(fp, "use_image_load_background_thread = %d\n", gameConf.use_image_load_background_thread ? 1 : 0); std::fprintf(fp, "use_image_load_background_thread = %d\n", gameConf.use_image_load_background_thread ? 1 : 0);
std::fprintf(fp, "pro_version = %d\n", PRO_VERSION); std::fprintf(fp, "pro_version = %d\n", PRO_VERSION);
std::fprintf(fp, "freever = %d\n", gameConf.freever ? 1 : 0);
std::fprintf(fp, "antialias = %d\n", gameConf.antialias); std::fprintf(fp, "antialias = %d\n", gameConf.antialias);
std::fprintf(fp, "errorlog = %u\n", enable_log); std::fprintf(fp, "errorlog = %u\n", enable_log);
BufferIO::CopyWideString(ebNickName->getText(), gameConf.nickname); BufferIO::CopyWideString(ebNickName->getText(), gameConf.nickname);
......
...@@ -58,6 +58,7 @@ struct Config { ...@@ -58,6 +58,7 @@ struct Config {
#else #else
bool use_image_load_background_thread{ true }; bool use_image_load_background_thread{ true };
#endif #endif
bool freever{ true };
unsigned short antialias{ 0 }; unsigned short antialias{ 0 };
unsigned short serverport{ 7911 }; unsigned short serverport{ 7911 };
unsigned char textfontsize{ 14 }; unsigned char textfontsize{ 14 };
......
...@@ -2,7 +2,10 @@ ...@@ -2,7 +2,10 @@
#nickname & gamename should be less than 20 characters #nickname & gamename should be less than 20 characters
use_d3d = 0 use_d3d = 0
use_image_scale = 1 use_image_scale = 1
use_image_scale_multi_thread = 1
use_image_load_background_thread = 0
pro_version = 4961 pro_version = 4961
freever = 1
antialias = 2 antialias = 2
errorlog = 3 errorlog = 3
nickname = Komeiji Koishi nickname = Komeiji Koishi
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment