Commit ce9cfe29 authored by mercury233's avatar mercury233

Merge branch 'master' of https://github.com/Fluorohydride/ygopro into server

parents e257ab2e c6b06904
...@@ -144,7 +144,7 @@ jobs: ...@@ -144,7 +144,7 @@ jobs:
uses: mercury233/action-cache-download-file@v1.0.0 uses: mercury233/action-cache-download-file@v1.0.0
with: with:
url: https://github.com/xiph/opus/releases/download/v1.5.2/opus-1.5.2.tar.gz url: https://github.com/xiph/opus/releases/download/v1.5.2/opus-1.5.2.tar.gz
- name: Extract opus - name: Extract opus
if: matrix.audiolib == 'miniaudio' if: matrix.audiolib == 'miniaudio'
run: | run: |
...@@ -398,7 +398,7 @@ jobs: ...@@ -398,7 +398,7 @@ jobs:
uses: mercury233/action-cache-download-file@v1.0.0 uses: mercury233/action-cache-download-file@v1.0.0
with: with:
url: https://github.com/xiph/opus/releases/download/v1.5.2/opus-1.5.2.tar.gz url: https://github.com/xiph/opus/releases/download/v1.5.2/opus-1.5.2.tar.gz
- name: Extract opus - name: Extract opus
if: matrix.static-link == true if: matrix.static-link == true
run: | run: |
...@@ -625,7 +625,7 @@ jobs: ...@@ -625,7 +625,7 @@ jobs:
uses: mercury233/action-cache-download-file@v1.0.0 uses: mercury233/action-cache-download-file@v1.0.0
with: with:
url: https://github.com/xiph/opus/releases/download/v1.5.2/opus-1.5.2.tar.gz url: https://github.com/xiph/opus/releases/download/v1.5.2/opus-1.5.2.tar.gz
- name: Extract opus - name: Extract opus
if: matrix.static-link == true if: matrix.static-link == true
run: | run: |
...@@ -679,7 +679,7 @@ jobs: ...@@ -679,7 +679,7 @@ jobs:
--build-event \ --build-event \
--build-freetype \ --build-freetype \
--build-sqlite \ --build-sqlite \
--build-opus-vorbis --build-opus-vorbis
- name: Make - name: Make
run: | run: |
......
...@@ -162,7 +162,6 @@ public: ...@@ -162,7 +162,6 @@ public:
} }
else else
return 0; return 0;
} }
}; };
......
...@@ -35,8 +35,12 @@ void ClientCard::SetCode(unsigned int x) { ...@@ -35,8 +35,12 @@ void ClientCard::SetCode(unsigned int x) {
if((location == LOCATION_HAND) && (code != x)) { if((location == LOCATION_HAND) && (code != x)) {
code = x; code = x;
mainGame->dField.MoveCard(this, 5); mainGame->dField.MoveCard(this, 5);
} else } else {
if (x == 0 && code != 0) {
chain_code = code;
}
code = x; code = x;
}
} }
void ClientCard::UpdateInfo(unsigned char* buf) { void ClientCard::UpdateInfo(unsigned char* buf) {
int flag = BufferIO::Read<int32_t>(buf); int flag = BufferIO::Read<int32_t>(buf);
...@@ -48,11 +52,7 @@ void ClientCard::UpdateInfo(unsigned char* buf) { ...@@ -48,11 +52,7 @@ void ClientCard::UpdateInfo(unsigned char* buf) {
int pdata = BufferIO::Read<int32_t>(buf); int pdata = BufferIO::Read<int32_t>(buf);
if (!pdata) if (!pdata)
ClearData(); ClearData();
if((location == LOCATION_HAND) && ((unsigned int)pdata != code)) { SetCode(pdata);
code = pdata;
mainGame->dField.MoveCard(this, 5);
} else
code = pdata;
} }
if(flag & QUERY_POSITION) { if(flag & QUERY_POSITION) {
int pdata = (BufferIO::Read<int32_t>(buf) >> 24) & 0xff; int pdata = (BufferIO::Read<int32_t>(buf) >> 24) & 0xff;
......
...@@ -13,7 +13,7 @@ ...@@ -13,7 +13,7 @@
#include <windows.h> #include <windows.h>
#include <ws2tcpip.h> #include <ws2tcpip.h>
#if defined(_MSC_VER) or defined(__MINGW32__) #if defined(_MSC_VER) || defined(__MINGW32__)
#define mywcsncasecmp _wcsnicmp #define mywcsncasecmp _wcsnicmp
#define mystrncasecmp _strnicmp #define mystrncasecmp _strnicmp
#else #else
...@@ -54,8 +54,12 @@ ...@@ -54,8 +54,12 @@
#include "../ocgcore/ocgapi.h" #include "../ocgcore/ocgapi.h"
template<size_t N, typename... TR> template<size_t N, typename... TR>
inline int myswprintf(wchar_t(&buf)[N], const wchar_t* fmt, TR... args) { inline int myswprintf(wchar_t(&buf)[N], const wchar_t* fmt, TR&&... args) {
return std::swprintf(buf, N, fmt, args...); return std::swprintf(buf, N, fmt, std::forward<TR>(args)...);
}
template<size_t N, typename... TR>
inline int mysnprintf(char(&buf)[N], const char* fmt, TR&&... args) {
return std::snprintf(buf, N, fmt, std::forward<TR>(args)...);
} }
inline FILE* mywfopen(const wchar_t* filename, const char* mode) { inline FILE* mywfopen(const wchar_t* filename, const char* mode) {
...@@ -72,20 +76,7 @@ inline FILE* mywfopen(const wchar_t* filename, const char* mode) { ...@@ -72,20 +76,7 @@ inline FILE* mywfopen(const wchar_t* filename, const char* mode) {
return fp; return fp;
} }
#if !defined(_WIN32)
#define myfopen std::fopen #define myfopen std::fopen
#elif defined(WDK_NTDDI_VERSION) && (WDK_NTDDI_VERSION >= 0x0A000005) // Redstone 4, Version 1803, Build 17134.
#define FOPEN_WINDOWS_SUPPORT_UTF8
#define myfopen std::fopen
#else
inline FILE* myfopen(const char* filename, const char* mode) {
wchar_t wfilename[256]{};
BufferIO::DecodeUTF8(filename, wfilename);
wchar_t wmode[20]{};
BufferIO::CopyCharArray(mode, wmode);
return _wfopen(wfilename, wmode);
}
#endif
#if !defined(YGOPRO_SERVER_MODE) || defined(SERVER_ZIP_SUPPORT) #if !defined(YGOPRO_SERVER_MODE) || defined(SERVER_ZIP_SUPPORT)
#include <irrlicht.h> #include <irrlicht.h>
......
...@@ -14,7 +14,10 @@ irr::io::IFileSystem* DataManager::FileSystem = nullptr; ...@@ -14,7 +14,10 @@ irr::io::IFileSystem* DataManager::FileSystem = nullptr;
DataManager dataManager; DataManager dataManager;
DataManager::DataManager() : _datas(32768), _strings(32768) { DataManager::DataManager() : _datas(32768), _strings(32768) {
extra_setcode = { {8512558u, {0x8f, 0x54, 0x59, 0x82, 0x13a}}, }; extra_setcode = {
{8512558u, {0x8f, 0x54, 0x59, 0x82, 0x13a}},
{55088578u, {0x8f, 0x54, 0x59, 0x82, 0x13a}},
};
} }
bool DataManager::ReadDB(sqlite3* pDB) { bool DataManager::ReadDB(sqlite3* pDB) {
sqlite3_stmt* pStmt = nullptr; sqlite3_stmt* pStmt = nullptr;
...@@ -184,7 +187,7 @@ void DataManager::ReadStringConfLine(const char* linebuf) { ...@@ -184,7 +187,7 @@ void DataManager::ReadStringConfLine(const char* linebuf) {
#endif //YGOPRO_SERVER_MODE #endif //YGOPRO_SERVER_MODE
bool DataManager::Error(sqlite3* pDB, sqlite3_stmt* pStmt) { bool DataManager::Error(sqlite3* pDB, sqlite3_stmt* pStmt) {
if (const char* msg = sqlite3_errmsg(pDB)) if (const char* msg = sqlite3_errmsg(pDB))
std::snprintf(errmsg, sizeof errmsg, "%s", msg); mysnprintf(errmsg, "%s", msg);
else else
errmsg[0] = '\0'; errmsg[0] = '\0';
sqlite3_finalize(pStmt); sqlite3_finalize(pStmt);
...@@ -405,10 +408,10 @@ unsigned char* DataManager::ScriptReaderEx(const char* script_path, int* slen) { ...@@ -405,10 +408,10 @@ unsigned char* DataManager::ScriptReaderEx(const char* script_path, int* slen) {
return ReadScriptFromFile(script_path, slen); return ReadScriptFromFile(script_path, slen);
const char* script_name = script_path + 2; const char* script_name = script_path + 2;
char expansions_path[1024]{}; char expansions_path[1024]{};
std::snprintf(expansions_path, sizeof expansions_path, "./expansions/%s", script_name); mysnprintf(expansions_path, "./expansions/%s", script_name);
#ifdef YGOPRO_SERVER_MODE #ifdef YGOPRO_SERVER_MODE
char special_path[1024]{}; char special_path[1024]{};
std::snprintf(special_path, sizeof special_path, "./specials/%s", script_path + 9); mysnprintf(special_path, "./specials/%s", script_path + 9);
if (ReadScriptFromFile(special_path, slen)) if (ReadScriptFromFile(special_path, slen))
return scriptBuffer; return scriptBuffer;
if (ReadScriptFromFile(expansions_path, slen)) // always read expansions first if (ReadScriptFromFile(expansions_path, slen)) // always read expansions first
......
...@@ -214,6 +214,7 @@ bool DeckBuilder::OnEvent(const irr::SEvent& event) { ...@@ -214,6 +214,7 @@ bool DeckBuilder::OnEvent(const irr::SEvent& event) {
mainGame->cbDBDecks->addItem(dname); mainGame->cbDBDecks->addItem(dname);
mainGame->cbDBDecks->setSelected(mainGame->cbDBDecks->getItemCount() - 1); mainGame->cbDBDecks->setSelected(mainGame->cbDBDecks->getItemCount() - 1);
} }
prev_deck = mainGame->cbDBDecks->getSelected();
int catesel = mainGame->cbDBCategory->getSelected(); int catesel = mainGame->cbDBCategory->getSelected();
wchar_t catepath[256]; wchar_t catepath[256];
DeckManager::GetCategoryPath(catepath, catesel, mainGame->cbDBCategory->getText()); DeckManager::GetCategoryPath(catepath, catesel, mainGame->cbDBCategory->getText());
......
...@@ -348,6 +348,7 @@ void Game::DrawCard(ClientCard* pcard) { ...@@ -348,6 +348,7 @@ void Game::DrawCard(ClientCard* pcard) {
if(pcard->aniFrame == 0) { if(pcard->aniFrame == 0) {
pcard->is_moving = false; pcard->is_moving = false;
pcard->is_fading = false; pcard->is_fading = false;
pcard->chain_code = 0;
} }
} }
matManager.mCard.AmbientColor = 0xffffffff; matManager.mCard.AmbientColor = 0xffffffff;
...@@ -355,7 +356,10 @@ void Game::DrawCard(ClientCard* pcard) { ...@@ -355,7 +356,10 @@ void Game::DrawCard(ClientCard* pcard) {
driver->setTransform(irr::video::ETS_WORLD, pcard->mTransform); driver->setTransform(irr::video::ETS_WORLD, pcard->mTransform);
auto m22 = pcard->mTransform(2, 2); auto m22 = pcard->mTransform(2, 2);
if(m22 > -0.99 || pcard->is_moving) { if(m22 > -0.99 || pcard->is_moving) {
matManager.mCard.setTexture(0, imageManager.GetTexture(pcard->code)); auto code = pcard->code;
if (code == 0 && pcard->is_moving)
code = pcard->chain_code;
matManager.mCard.setTexture(0, imageManager.GetTexture(code));
driver->setMaterial(matManager.mCard); driver->setMaterial(matManager.mCard);
driver->drawVertexPrimitiveList(matManager.vCardFront, 4, matManager.iRectangle, 2); driver->drawVertexPrimitiveList(matManager.vCardFront, 4, matManager.iRectangle, 2);
} }
......
...@@ -739,7 +739,6 @@ void DuelClient::HandleSTOCPacketLan(unsigned char* data, int len) { ...@@ -739,7 +739,6 @@ void DuelClient::HandleSTOCPacketLan(unsigned char* data, int len) {
starttime = new_replay.pheader.base.start_time; starttime = new_replay.pheader.base.start_time;
else else
starttime = new_replay.pheader.base.seed; starttime = new_replay.pheader.base.seed;
wchar_t timetext[40]; wchar_t timetext[40];
std::wcsftime(timetext, sizeof timetext / sizeof timetext[0], L"%Y-%m-%d %H-%M-%S", std::localtime(&starttime)); std::wcsftime(timetext, sizeof timetext / sizeof timetext[0], L"%Y-%m-%d %H-%M-%S", std::localtime(&starttime));
mainGame->ebRSName->setText(timetext); mainGame->ebRSName->setText(timetext);
......
...@@ -1782,7 +1782,7 @@ void Game::AddDebugMsg(const char* msg) { ...@@ -1782,7 +1782,7 @@ void Game::AddDebugMsg(const char* msg) {
} }
if (enable_log & 0x2) { if (enable_log & 0x2) {
char msgbuf[1040]; char msgbuf[1040];
std::snprintf(msgbuf, sizeof msgbuf, "[Script Error]: %s", msg); mysnprintf(msgbuf, "[Script Error]: %s", msg);
ErrorLog(msgbuf); ErrorLog(msgbuf);
} }
#endif //YGOPRO_SERVER_MODE #endif //YGOPRO_SERVER_MODE
......
...@@ -11,6 +11,10 @@ ...@@ -11,6 +11,10 @@
#include "base64.h" #include "base64.h"
#endif #endif
#if defined(_WIN32) && (!defined(WDK_NTDDI_VERSION) || (WDK_NTDDI_VERSION < 0x0A000005)) // Redstone 4, Version 1803, Build 17134.
#error "This program requires the Windows 10 SDK version 1803 or above to compile on Windows. Otherwise, non-ASCII characters will not be displayed or processed correctly."
#endif
unsigned int enable_log = 0x3; unsigned int enable_log = 0x3;
#ifndef YGOPRO_SERVER_MODE #ifndef YGOPRO_SERVER_MODE
bool exit_on_return = false; bool exit_on_return = false;
...@@ -28,11 +32,11 @@ void ClickButton(irr::gui::IGUIElement* btn) { ...@@ -28,11 +32,11 @@ void ClickButton(irr::gui::IGUIElement* btn) {
#endif //YGOPRO_SERVER_MODE #endif //YGOPRO_SERVER_MODE
int main(int argc, char* argv[]) { int main(int argc, char* argv[]) {
#if defined(FOPEN_WINDOWS_SUPPORT_UTF8) #if defined(_WIN32)
std::setlocale(LC_CTYPE, ".UTF-8"); std::setlocale(LC_CTYPE, ".UTF-8");
#elif defined(__APPLE__) #elif defined(__APPLE__)
std::setlocale(LC_CTYPE, "UTF-8"); std::setlocale(LC_CTYPE, "UTF-8");
#elif !defined(_WIN32) #else
std::setlocale(LC_CTYPE, ""); std::setlocale(LC_CTYPE, "");
#endif #endif
#if defined __APPLE__ && !defined YGOPRO_SERVER_MODE #if defined __APPLE__ && !defined YGOPRO_SERVER_MODE
......
...@@ -237,10 +237,10 @@ irr::video::ITexture* ImageManager::GetTexture(int code, bool fit) { ...@@ -237,10 +237,10 @@ irr::video::ITexture* ImageManager::GetTexture(int code, bool fit) {
auto tit = tMap[fit ? 1 : 0].find(code); auto tit = tMap[fit ? 1 : 0].find(code);
if(tit == tMap[fit ? 1 : 0].end()) { if(tit == tMap[fit ? 1 : 0].end()) {
char file[256]; char file[256];
std::snprintf(file, sizeof file, "expansions/pics/%d.jpg", code); mysnprintf(file, "expansions/pics/%d.jpg", code);
irr::video::ITexture* img = GetTextureFromFile(file, width, height); irr::video::ITexture* img = GetTextureFromFile(file, width, height);
if(img == nullptr) { if(img == nullptr) {
std::snprintf(file, sizeof file, "pics/%d.jpg", code); mysnprintf(file, "pics/%d.jpg", code);
img = GetTextureFromFile(file, width, height); img = GetTextureFromFile(file, width, height);
} }
if(img == nullptr && !mainGame->gameConf.use_image_scale) { if(img == nullptr && !mainGame->gameConf.use_image_scale) {
...@@ -264,10 +264,10 @@ irr::video::ITexture* ImageManager::GetBigPicture(int code, float zoom) { ...@@ -264,10 +264,10 @@ irr::video::ITexture* ImageManager::GetBigPicture(int code, float zoom) {
} }
irr::video::ITexture* texture; irr::video::ITexture* texture;
char file[256]; char file[256];
std::snprintf(file, sizeof file, "expansions/pics/%d.jpg", code); mysnprintf(file, "expansions/pics/%d.jpg", code);
irr::video::IImage* srcimg = driver->createImageFromFile(file); irr::video::IImage* srcimg = driver->createImageFromFile(file);
if(srcimg == nullptr) { if(srcimg == nullptr) {
std::snprintf(file, sizeof file, "pics/%d.jpg", code); mysnprintf(file, "pics/%d.jpg", code);
srcimg = driver->createImageFromFile(file); srcimg = driver->createImageFromFile(file);
} }
if(srcimg == nullptr) { if(srcimg == nullptr) {
...@@ -293,18 +293,18 @@ int ImageManager::LoadThumbThread() { ...@@ -293,18 +293,18 @@ int ImageManager::LoadThumbThread() {
imageManager.tThumbLoadingCodes.pop(); imageManager.tThumbLoadingCodes.pop();
imageManager.tThumbLoadingMutex.unlock(); imageManager.tThumbLoadingMutex.unlock();
char file[256]; char file[256];
std::snprintf(file, sizeof file, "expansions/pics/thumbnail/%d.jpg", code); mysnprintf(file, "expansions/pics/thumbnail/%d.jpg", code);
irr::video::IImage* img = imageManager.driver->createImageFromFile(file); irr::video::IImage* img = imageManager.driver->createImageFromFile(file);
if(img == nullptr) { if(img == nullptr) {
std::snprintf(file, sizeof file, "pics/thumbnail/%d.jpg", code); mysnprintf(file, "pics/thumbnail/%d.jpg", code);
img = imageManager.driver->createImageFromFile(file); img = imageManager.driver->createImageFromFile(file);
} }
if(img == nullptr && mainGame->gameConf.use_image_scale) { if(img == nullptr && mainGame->gameConf.use_image_scale) {
std::snprintf(file, sizeof file, "expansions/pics/%d.jpg", code); mysnprintf(file, "expansions/pics/%d.jpg", code);
img = imageManager.driver->createImageFromFile(file); img = imageManager.driver->createImageFromFile(file);
} }
if(img == nullptr && mainGame->gameConf.use_image_scale) { if(img == nullptr && mainGame->gameConf.use_image_scale) {
std::snprintf(file, sizeof file, "pics/%d.jpg", code); mysnprintf(file, "pics/%d.jpg", code);
img = imageManager.driver->createImageFromFile(file); img = imageManager.driver->createImageFromFile(file);
} }
if(img != nullptr) { if(img != nullptr) {
...@@ -347,19 +347,19 @@ irr::video::ITexture* ImageManager::GetTextureThumb(int code) { ...@@ -347,19 +347,19 @@ irr::video::ITexture* ImageManager::GetTextureThumb(int code) {
auto tit = tThumb.find(code); auto tit = tThumb.find(code);
if(tit == tThumb.end() && !mainGame->gameConf.use_image_load_background_thread) { if(tit == tThumb.end() && !mainGame->gameConf.use_image_load_background_thread) {
char file[256]; char file[256];
std::snprintf(file, sizeof file, "expansions/pics/thumbnail/%d.jpg", code); mysnprintf(file, "expansions/pics/thumbnail/%d.jpg", code);
int width = CARD_THUMB_WIDTH * mainGame->xScale; int width = CARD_THUMB_WIDTH * mainGame->xScale;
int height = CARD_THUMB_HEIGHT * mainGame->yScale; int height = CARD_THUMB_HEIGHT * mainGame->yScale;
irr::video::ITexture* img = GetTextureFromFile(file, width, height); irr::video::ITexture* img = GetTextureFromFile(file, width, height);
if(img == NULL) { if(img == NULL) {
std::snprintf(file, sizeof file, "pics/thumbnail/%d.jpg", code); mysnprintf(file, "pics/thumbnail/%d.jpg", code);
img = GetTextureFromFile(file, width, height); img = GetTextureFromFile(file, width, height);
} }
if(img == NULL && mainGame->gameConf.use_image_scale) { if(img == NULL && mainGame->gameConf.use_image_scale) {
std::snprintf(file, sizeof file, "expansions/pics/%d.jpg", code); mysnprintf(file, "expansions/pics/%d.jpg", code);
img = GetTextureFromFile(file, width, height); img = GetTextureFromFile(file, width, height);
if(img == NULL) { if(img == NULL) {
std::snprintf(file, sizeof file, "pics/%d.jpg", code); mysnprintf(file, "pics/%d.jpg", code);
img = GetTextureFromFile(file, width, height); img = GetTextureFromFile(file, width, height);
} }
} }
...@@ -372,7 +372,7 @@ irr::video::ITexture* ImageManager::GetTextureThumb(int code) { ...@@ -372,7 +372,7 @@ irr::video::ITexture* ImageManager::GetTextureThumb(int code) {
if(lit != tThumbLoading.end()) { if(lit != tThumbLoading.end()) {
if(lit->second != nullptr) { if(lit->second != nullptr) {
char file[256]; char file[256];
std::snprintf(file, sizeof file, "pics/thumbnail/%d.jpg", code); mysnprintf(file, "pics/thumbnail/%d.jpg", code);
irr::video::ITexture* texture = driver->addTexture(file, lit->second); // textures must be added in the main thread due to OpenGL irr::video::ITexture* texture = driver->addTexture(file, lit->second); // textures must be added in the main thread due to OpenGL
lit->second->drop(); lit->second->drop();
tThumb[code] = texture; tThumb[code] = texture;
...@@ -406,18 +406,18 @@ irr::video::ITexture* ImageManager::GetTextureField(int code) { ...@@ -406,18 +406,18 @@ irr::video::ITexture* ImageManager::GetTextureField(int code) {
auto tit = tFields.find(code); auto tit = tFields.find(code);
if(tit == tFields.end()) { if(tit == tFields.end()) {
char file[256]; char file[256];
std::snprintf(file, sizeof file, "expansions/pics/field/%d.png", code); mysnprintf(file, "expansions/pics/field/%d.png", code);
irr::video::ITexture* img = GetTextureFromFile(file, 512 * mainGame->xScale, 512 * mainGame->yScale); irr::video::ITexture* img = GetTextureFromFile(file, 512 * mainGame->xScale, 512 * mainGame->yScale);
if(img == nullptr) { if(img == nullptr) {
std::snprintf(file, sizeof file, "expansions/pics/field/%d.jpg", code); mysnprintf(file, "expansions/pics/field/%d.jpg", code);
img = GetTextureFromFile(file, 512 * mainGame->xScale, 512 * mainGame->yScale); img = GetTextureFromFile(file, 512 * mainGame->xScale, 512 * mainGame->yScale);
} }
if(img == nullptr) { if(img == nullptr) {
std::snprintf(file, sizeof file, "pics/field/%d.png", code); mysnprintf(file, "pics/field/%d.png", code);
img = GetTextureFromFile(file, 512 * mainGame->xScale, 512 * mainGame->yScale); img = GetTextureFromFile(file, 512 * mainGame->xScale, 512 * mainGame->yScale);
} }
if(img == nullptr) { if(img == nullptr) {
std::snprintf(file, sizeof file, "pics/field/%d.jpg", code); mysnprintf(file, "pics/field/%d.jpg", code);
img = GetTextureFromFile(file, 512 * mainGame->xScale, 512 * mainGame->yScale); img = GetTextureFromFile(file, 512 * mainGame->xScale, 512 * mainGame->yScale);
if(img == nullptr) { if(img == nullptr) {
tFields[code] = nullptr; tFields[code] = nullptr;
......
...@@ -382,9 +382,9 @@ bool MenuHandler::OnEvent(const irr::SEvent& event) { ...@@ -382,9 +382,9 @@ bool MenuHandler::OnEvent(const irr::SEvent& event) {
int flag = 0; int flag = 0;
flag += (mainGame->chkBotHand->isChecked() ? 0x1 : 0); flag += (mainGame->chkBotHand->isChecked() ? 0x1 : 0);
char arg2[8]; char arg2[8];
std::snprintf(arg2, sizeof arg2, "%d", flag); mysnprintf(arg2, "%d", flag);
char arg3[8]; char arg3[8];
std::snprintf(arg3, sizeof arg3, "%d", mainGame->gameConf.serverport); mysnprintf(arg3, "%d", mainGame->gameConf.serverport);
execl("./bot", "bot", arg1, arg2, arg3, nullptr); execl("./bot", "bot", arg1, arg2, arg3, nullptr);
std::exit(0); std::exit(0);
} else { } else {
......
...@@ -182,7 +182,7 @@ public: ...@@ -182,7 +182,7 @@ public:
bool success = true; bool success = true;
TraversalDir(dir, [dir, &success](const char *name, bool isdir) { TraversalDir(dir, [dir, &success](const char *name, bool isdir) {
char full_path[1024]; char full_path[1024];
int len = std::snprintf(full_path, sizeof full_path, "%s/%s", dir, name); int len = mysnprintf(full_path, "%s/%s", dir, name);
if (len < 0 || len >= (int)(sizeof full_path)) { if (len < 0 || len >= (int)(sizeof full_path)) {
success = false; success = false;
return; return;
...@@ -234,7 +234,7 @@ public: ...@@ -234,7 +234,7 @@ public:
file_unit funit; file_unit funit;
#endif #endif
char fname[1024]; char fname[1024];
int len = std::snprintf(fname, sizeof fname, "%s/%s", path, dirp->d_name); int len = mysnprintf(fname, "%s/%s", path, dirp->d_name);
if (len < 0 || len >= (int)(sizeof fname)) if (len < 0 || len >= (int)(sizeof fname))
continue; continue;
stat(fname, &fileStat); stat(fname, &fileStat);
......
...@@ -63,7 +63,7 @@ end ...@@ -63,7 +63,7 @@ end
end end
if BUILD_FREETYPE then if BUILD_FREETYPE then
includedirs { "../freetype/include" } includedirs { "../freetype/custom", "../freetype/include" }
else else
includedirs { FREETYPE_INCLUDE_DIR } includedirs { FREETYPE_INCLUDE_DIR }
libdirs { FREETYPE_LIB_DIR } libdirs { FREETYPE_LIB_DIR }
......
...@@ -176,17 +176,12 @@ bool Replay::RenameReplay(const wchar_t* oldname, const wchar_t* newname) { ...@@ -176,17 +176,12 @@ bool Replay::RenameReplay(const wchar_t* oldname, const wchar_t* newname) {
wchar_t newfname[256]; wchar_t newfname[256];
myswprintf(oldfname, L"./replay/%ls", oldname); myswprintf(oldfname, L"./replay/%ls", oldname);
myswprintf(newfname, L"./replay/%ls", newname); myswprintf(newfname, L"./replay/%ls", newname);
#ifdef _WIN32 char oldfilefn[1024];
BOOL result = MoveFileW(oldfname, newfname); char newfilefn[1024];
return !!result;
#else
char oldfilefn[256];
char newfilefn[256];
BufferIO::EncodeUTF8(oldfname, oldfilefn); BufferIO::EncodeUTF8(oldfname, oldfilefn);
BufferIO::EncodeUTF8(newfname, newfilefn); BufferIO::EncodeUTF8(newfname, newfilefn);
int result = rename(oldfilefn, newfilefn); int result = std::rename(oldfilefn, newfilefn);
return result == 0; return result == 0;
#endif
} }
bool Replay::ReadNextResponse(unsigned char resp[]) { bool Replay::ReadNextResponse(unsigned char resp[]) {
unsigned char len{}; unsigned char len{};
......
...@@ -212,7 +212,7 @@ bool ReplayMode::StartDuel() { ...@@ -212,7 +212,7 @@ bool ReplayMode::StartDuel() {
} }
} else { } else {
char filename[256]{}; char filename[256]{};
std::snprintf(filename, sizeof filename, "./single/%s", cur_replay.script_name.c_str()); mysnprintf(filename, "./single/%s", cur_replay.script_name.c_str());
if(!preload_script(pduel, filename)) { if(!preload_script(pduel, filename)) {
return false; return false;
} }
......
...@@ -218,7 +218,7 @@ void SoundManager::PlaySoundEffect(int sound) { ...@@ -218,7 +218,7 @@ void SoundManager::PlaySoundEffect(int sound) {
break; break;
} }
char soundPath[40]; char soundPath[40];
std::snprintf(soundPath, 40, "./sound/%s.wav", soundName); mysnprintf(soundPath, "./sound/%s.wav", soundName);
SetSoundVolume(mainGame->gameConf.sound_volume); SetSoundVolume(mainGame->gameConf.sound_volume);
#ifdef YGOPRO_USE_MINIAUDIO #ifdef YGOPRO_USE_MINIAUDIO
ma_engine_play_sound(&engineSound, soundPath, nullptr); ma_engine_play_sound(&engineSound, soundPath, nullptr);
......
...@@ -10,9 +10,6 @@ project "event" ...@@ -10,9 +10,6 @@ project "event"
if EVENT_VERSION>=0x02020000 then if EVENT_VERSION>=0x02020000 then
print("Warning: Using libevent version 2.2.x is not supported, please use 2.1.x, otherwise you may encounter issues.") print("Warning: Using libevent version 2.2.x is not supported, please use 2.1.x, otherwise you may encounter issues.")
end end
if EVENT_VERSION>=0x02010000 and WINXP_SUPPORT then
print("Warning: libevent 2.1 uses some new APIs which require Windows Vista or later, so WinXP support will be invalid.")
end
includedirs { "include", "compat" } includedirs { "include", "compat" }
......
/****************************************************************************
*
* ft2build.h
*
* FreeType 2 build and setup macros.
*
* Use custom/ft2build.h instead of the default include/freetype/ft2build.h
* to customize the FreeType 2 build of YGOPro.
*
*/
#ifndef FT2_BUILD_MY_PLATFORM_H_
#define FT2_BUILD_MY_PLATFORM_H_
#define FT_CONFIG_OPTIONS_H <ygopro/ftoption.h>
#define FT_CONFIG_MODULES_H <ygopro/ftmodule.h>
#include <freetype/config/ftheader.h>
#endif /* FT2_BUILD_MY_PLATFORM_H_ */
/*
* This file registers the FreeType modules compiled into the library.
*
* YGOPro only uses modules that are needed for TrueType and OpenType fonts.
*
*/
FT_USE_MODULE( FT_Driver_ClassRec, tt_driver_class )
FT_USE_MODULE( FT_Driver_ClassRec, cff_driver_class )
FT_USE_MODULE( FT_Module_Class, psaux_module_class )
FT_USE_MODULE( FT_Module_Class, psnames_module_class )
FT_USE_MODULE( FT_Module_Class, pshinter_module_class )
FT_USE_MODULE( FT_Module_Class, sfnt_module_class )
FT_USE_MODULE( FT_Renderer_Class, ft_smooth_renderer_class )
/* EOF */
/****************************************************************************
*
* ftoption.h
*
* User-selectable configuration macros (specification only).
*
* This file is customized for YGOPro to include only the necessary
* configuration options for the TrueType and OpenType font driver.
*
* See the original FreeType source code for more information.
* /include/freetype/config/ftoption.h
*
*/
#ifndef FTOPTION_H_
#define FTOPTION_H_
#include <ft2build.h>
FT_BEGIN_HEADER
#define FT_CONFIG_OPTION_ENVIRONMENT_PROPERTIES
#undef FT_CONFIG_OPTION_FORCE_INT64
#define FT_CONFIG_OPTION_INLINE_MULFIX
#define FT_CONFIG_OPTION_POSTSCRIPT_NAMES
#define FT_CONFIG_OPTION_INCREMENTAL
#define FT_RENDER_POOL_SIZE 16384L
#define FT_MAX_MODULES 32
#undef FT_CONFIG_OPTION_USE_MODULE_ERRORS
#define TT_CONFIG_OPTION_EMBEDDED_BITMAPS
#define TT_CONFIG_OPTION_COLOR_LAYERS
#define TT_CONFIG_OPTION_POSTSCRIPT_NAMES
#define TT_CONFIG_CMAP_FORMAT_0
#define TT_CONFIG_CMAP_FORMAT_2
#define TT_CONFIG_CMAP_FORMAT_4
#define TT_CONFIG_CMAP_FORMAT_6
#define TT_CONFIG_CMAP_FORMAT_8
#define TT_CONFIG_CMAP_FORMAT_10
#define TT_CONFIG_CMAP_FORMAT_12
#define TT_CONFIG_CMAP_FORMAT_13
#define TT_CONFIG_CMAP_FORMAT_14
#define TT_CONFIG_OPTION_BYTECODE_INTERPRETER
#define TT_CONFIG_OPTION_SUBPIXEL_HINTING
#undef TT_CONFIG_OPTION_COMPONENT_OFFSET_SCALED
#ifndef TT_CONFIG_OPTION_MAX_RUNNABLE_OPCODES
#define TT_CONFIG_OPTION_MAX_RUNNABLE_OPCODES 1000000L
#endif
#define T1_MAX_SUBRS_CALLS 16
#define T1_MAX_CHARSTRINGS_OPERANDS 256
#define CFF_CONFIG_OPTION_DARKENING_PARAMETER_X1 500
#define CFF_CONFIG_OPTION_DARKENING_PARAMETER_Y1 400
#define CFF_CONFIG_OPTION_DARKENING_PARAMETER_X2 1000
#define CFF_CONFIG_OPTION_DARKENING_PARAMETER_Y2 275
#define CFF_CONFIG_OPTION_DARKENING_PARAMETER_X3 1667
#define CFF_CONFIG_OPTION_DARKENING_PARAMETER_Y3 275
#define CFF_CONFIG_OPTION_DARKENING_PARAMETER_X4 2333
#define CFF_CONFIG_OPTION_DARKENING_PARAMETER_Y4 0
#ifdef TT_CONFIG_OPTION_BYTECODE_INTERPRETER
#define TT_USE_BYTECODE_INTERPRETER
#ifdef TT_CONFIG_OPTION_SUBPIXEL_HINTING
#define TT_SUPPORT_SUBPIXEL_HINTING_MINIMAL
#endif
#endif
#ifdef TT_CONFIG_OPTION_COLOR_LAYERS
#define TT_SUPPORT_COLRV1
#endif
FT_END_HEADER
#endif /* FTOPTION_H_ */
/* END */
project "freetype" project "freetype"
kind "StaticLib" kind "StaticLib"
includedirs { "include" } includedirs { "custom", "include" }
defines { "FT2_BUILD_LIBRARY" } defines { "FT2_BUILD_LIBRARY" }
files { "src/autofit/autofit.c", files {
"src/base/ftbase.c", "src/base/ftinit.c",
"src/base/ftbbox.c", "src/base/ftbase.c",
"src/base/ftbdf.c", "src/base/ftbitmap.c",
"src/base/ftbitmap.c", "src/cff/cff.c",
"src/base/ftcid.c", "src/psaux/psaux.c",
"src/base/ftfstype.c", "src/pshinter/pshinter.c",
"src/base/ftgasp.c", "src/psnames/psnames.c",
"src/base/ftglyph.c", "src/sfnt/sfnt.c",
"src/base/ftgxval.c", "src/smooth/smooth.c",
"src/base/ftinit.c", "src/truetype/truetype.c",
"src/base/ftmm.c", }
"src/base/ftotval.c",
"src/base/ftpatent.c",
"src/base/ftpfr.c",
"src/base/ftstroke.c",
"src/base/ftsynth.c",
"src/base/fttype1.c",
"src/base/ftwinfnt.c",
"src/bdf/bdf.c",
"src/cache/ftcache.c",
"src/cff/cff.c",
"src/cid/type1cid.c",
"src/gzip/ftgzip.c",
"src/lzw/ftlzw.c",
"src/pcf/pcf.c",
"src/pfr/pfr.c",
"src/psaux/psaux.c",
"src/pshinter/pshinter.c",
"src/psnames/psmodule.c",
"src/raster/raster.c",
"src/sfnt/sfnt.c",
"src/sdf/sdf.c",
"src/smooth/smooth.c",
"src/truetype/truetype.c",
"src/type1/type1.c",
"src/type42/type42.c",
"src/winfonts/winfnt.c" }
if os.isfile("src/svg/svg.c") then
files { "src/svg/svg.c" }
end
filter "system:windows" filter "system:windows"
files { "builds/windows/ftsystem.c", files { "builds/windows/ftsystem.c",
......
...@@ -10,4 +10,5 @@ project "sqlite3" ...@@ -10,4 +10,5 @@ project "sqlite3"
"SQLITE_OMIT_DEPRECATED", "SQLITE_OMIT_DEPRECATED",
"SQLITE_OMIT_PROGRESS_CALLBACK", "SQLITE_OMIT_PROGRESS_CALLBACK",
"SQLITE_OMIT_SHARED_CACHE", "SQLITE_OMIT_SHARED_CACHE",
"SQLITE_TRUSTED_SCHEMA=0",
} }
...@@ -89,7 +89,6 @@ newoption { trigger = "irrklang-pro-release-lib-dir", category = "YGOPro - irrkl ...@@ -89,7 +89,6 @@ newoption { trigger = "irrklang-pro-release-lib-dir", category = "YGOPro - irrkl
newoption { trigger = "irrklang-pro-debug-lib-dir", category = "YGOPro - irrklang - pro", description = "", value = "PATH" } newoption { trigger = "irrklang-pro-debug-lib-dir", category = "YGOPro - irrklang - pro", description = "", value = "PATH" }
newoption { trigger = 'build-ikpmp3', category = "YGOPro - irrklang - ikpmp3", description = "" } newoption { trigger = 'build-ikpmp3', category = "YGOPro - irrklang - ikpmp3", description = "" }
newoption { trigger = "winxp-support", category = "YGOPro", description = "" }
newoption { trigger = "mac-arm", category = "YGOPro", description = "Compile for Apple Silicon Mac" } newoption { trigger = "mac-arm", category = "YGOPro", description = "Compile for Apple Silicon Mac" }
newoption { trigger = "mac-intel", category = "YGOPro", description = "Compile for Intel Mac" } newoption { trigger = "mac-intel", category = "YGOPro", description = "Compile for Intel Mac" }
...@@ -237,7 +236,7 @@ if GetParam("no-dxsdk") then ...@@ -237,7 +236,7 @@ if GetParam("no-dxsdk") then
end end
if USE_DXSDK and os.istarget("windows") then if USE_DXSDK and os.istarget("windows") then
if not os.getenv("DXSDK_DIR") then if not os.getenv("DXSDK_DIR") then
print("DXSDK_DIR environment variable not set, it seems you don't have the DirectX SDK installed. DirectX mode will be disabled.") print("Warning: DXSDK_DIR environment variable not set, it seems you don't have the DirectX SDK installed. DirectX mode will be disabled.")
USE_DXSDK = false USE_DXSDK = false
end end
end end
...@@ -313,10 +312,6 @@ if USE_AUDIO and not SERVER_MODE then ...@@ -313,10 +312,6 @@ if USE_AUDIO and not SERVER_MODE then
end end
end end
if GetParam("winxp-support") and os.istarget("windows") then
WINXP_SUPPORT = true
end
if os.istarget("macosx") then if os.istarget("macosx") then
if GetParam("mac-arm") then if GetParam("mac-arm") then
MAC_ARM = true MAC_ARM = true
...@@ -348,12 +343,7 @@ workspace "YGOPro" ...@@ -348,12 +343,7 @@ workspace "YGOPro"
filter "system:windows" filter "system:windows"
systemversion "latest" systemversion "latest"
startproject "YGOPro" startproject "YGOPro"
if WINXP_SUPPORT then defines { "WINVER=0x0601" } -- WIN7
defines { "WINVER=0x0501" }
toolset "v141_xp"
else
defines { "WINVER=0x0601" } -- WIN7
end
platforms { "Win32", "x64" } platforms { "Win32", "x64" }
filter { "system:windows", "platforms:Win32" } filter { "system:windows", "platforms:Win32" }
...@@ -411,9 +401,7 @@ workspace "YGOPro" ...@@ -411,9 +401,7 @@ workspace "YGOPro"
filter "action:vs*" filter "action:vs*"
cdialect "C11" cdialect "C11"
if not WINXP_SUPPORT then conformancemode "On"
conformancemode "On"
end
vectorextensions "SSE2" vectorextensions "SSE2"
buildoptions { "/utf-8" } buildoptions { "/utf-8" }
defines { "_CRT_SECURE_NO_WARNINGS" } defines { "_CRT_SECURE_NO_WARNINGS" }
......
...@@ -667,6 +667,8 @@ ...@@ -667,6 +667,8 @@
!counter 0x6c 访问指示物 !counter 0x6c 访问指示物
!counter 0x6d 祝台指示物 !counter 0x6d 祝台指示物
!counter 0x6e 四季指示物 !counter 0x6e 四季指示物
!counter 0x6f 龋齿指示物
!counter 0x70 盘子指示物
#setnames, using tab for comment #setnames, using tab for comment
!setname 0x1 正义盟军 AOJ !setname 0x1 正义盟军 AOJ
!setname 0x2 次世代 ジェネクス !setname 0x2 次世代 ジェネクス
...@@ -1251,7 +1253,7 @@ ...@@ -1251,7 +1253,7 @@
!setname 0x1c2 喷水引擎 アクア・ジェット !setname 0x1c2 喷水引擎 アクア・ジェット
!setname 0x1c3 巳剑 Mitsurugi !setname 0x1c3 巳剑 Mitsurugi
!setname 0x1c4 征龙 征竜 !setname 0x1c4 征龙 征竜
!setname 0x1c5 再世 再世 !setname 0x1c5 再世 リジェネシス
!setname 0x1c6 统王 ドミナス !setname 0x1c6 统王 ドミナス
!setname 0x1c7 塞勒凯特 Serket !setname 0x1c7 塞勒凯特 Serket
!setname 0x1c8 阿匹卜 Apophis !setname 0x1c8 阿匹卜 Apophis
...@@ -1261,3 +1263,7 @@ ...@@ -1261,3 +1263,7 @@
!setname 0x1cc 瞬间移动 テレポート !setname 0x1cc 瞬间移动 テレポート
!setname 0x1cd 神艺 アルトメギア !setname 0x1cd 神艺 アルトメギア
!setname 0x1ce 狱神 獄神 !setname 0x1ce 狱神 獄神
!setname 0x1cf 奏悦机组 R.B.
!setname 0x1d0 死伟王 死偉王
!setname 0x1d1 绚岚 絢嵐
!setname 0x1d2 终刻 ドゥームズ
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