Commit 90bb84f0 authored by mercury233's avatar mercury233

Merge branch 'fh' into patch-miniaudio-v2

parents f4d23d09 478e674c
...@@ -401,12 +401,6 @@ jobs: ...@@ -401,12 +401,6 @@ jobs:
run: | run: |
git clone --depth=1 https://github.com/mercury233/irrlicht git clone --depth=1 https://github.com/mercury233/irrlicht
- name: Build irrlicht
run: |
cd irrlicht/source/Irrlicht/MacOSX
xcodebuild -project MacOSX.xcodeproj
cd ../../../..
- name: Copy premake files - name: Copy premake files
run: | run: |
cp -r premake/* . cp -r premake/* .
...@@ -418,9 +412,7 @@ jobs: ...@@ -418,9 +412,7 @@ jobs:
./premake5 gmake \ ./premake5 gmake \
--cc=clang \ --cc=clang \
--freetype-include-dir="/usr/local/include/freetype2" \ --freetype-include-dir="/usr/local/include/freetype2" \
--opus-include-dir="/usr/local/include/opus" \ --opus-include-dir="/usr/local/include/opus"
--irrlicht-include-dir="../irrlicht/include" \
--irrlicht-lib-dir="../irrlicht/source/Irrlicht/MacOSX/build/Release"
- name: Use premake to generate make files (ARM64) - name: Use premake to generate make files (ARM64)
if: runner.arch == 'ARM64' if: runner.arch == 'ARM64'
...@@ -438,9 +430,7 @@ jobs: ...@@ -438,9 +430,7 @@ jobs:
--opus-include-dir="/opt/homebrew/include/opus" \ --opus-include-dir="/opt/homebrew/include/opus" \
--opus-lib-dir="/opt/homebrew/lib" \ --opus-lib-dir="/opt/homebrew/lib" \
--vorbis-include-dir="/opt/homebrew/include" \ --vorbis-include-dir="/opt/homebrew/include" \
--vorbis-lib-dir="/opt/homebrew/lib" \ --vorbis-lib-dir="/opt/homebrew/lib"
--irrlicht-include-dir="../irrlicht/include" \
--irrlicht-lib-dir="../irrlicht/source/Irrlicht/MacOSX/build/Release"
- name: Make - name: Make
run: | run: |
......
...@@ -311,7 +311,7 @@ bool DeckManager::LoadCurrentDeck(int category_index, const wchar_t* category_na ...@@ -311,7 +311,7 @@ bool DeckManager::LoadCurrentDeck(int category_index, const wchar_t* category_na
mainGame->deckBuilder.RefreshPackListScroll(); mainGame->deckBuilder.RefreshPackListScroll();
return res; return res;
} }
bool DeckManager::SaveDeck(Deck& deck, const wchar_t* file) { bool DeckManager::SaveDeck(const Deck& deck, const wchar_t* file) {
if(!FileSystem::IsDirExists(L"./deck") && !FileSystem::MakeDir(L"./deck")) if(!FileSystem::IsDirExists(L"./deck") && !FileSystem::MakeDir(L"./deck"))
return false; return false;
FILE* fp = OpenDeckFile(file, "w"); FILE* fp = OpenDeckFile(file, "w");
...@@ -319,13 +319,13 @@ bool DeckManager::SaveDeck(Deck& deck, const wchar_t* file) { ...@@ -319,13 +319,13 @@ bool DeckManager::SaveDeck(Deck& deck, const wchar_t* file) {
return false; return false;
std::fprintf(fp, "#created by ...\n#main\n"); std::fprintf(fp, "#created by ...\n#main\n");
for(size_t i = 0; i < deck.main.size(); ++i) for(size_t i = 0; i < deck.main.size(); ++i)
std::fprintf(fp, "%d\n", deck.main[i]->first); std::fprintf(fp, "%u\n", deck.main[i]->first);
std::fprintf(fp, "#extra\n"); std::fprintf(fp, "#extra\n");
for(size_t i = 0; i < deck.extra.size(); ++i) for(size_t i = 0; i < deck.extra.size(); ++i)
std::fprintf(fp, "%d\n", deck.extra[i]->first); std::fprintf(fp, "%u\n", deck.extra[i]->first);
std::fprintf(fp, "!side\n"); std::fprintf(fp, "!side\n");
for(size_t i = 0; i < deck.side.size(); ++i) for(size_t i = 0; i < deck.side.size(); ++i)
std::fprintf(fp, "%d\n", deck.side[i]->first); std::fprintf(fp, "%u\n", deck.side[i]->first);
std::fclose(fp); std::fclose(fp);
return true; return true;
} }
......
...@@ -58,7 +58,7 @@ public: ...@@ -58,7 +58,7 @@ public:
static void GetDeckFile(wchar_t* ret, int category_index, const wchar_t* category_name, const wchar_t* deckname); static void GetDeckFile(wchar_t* ret, int category_index, const wchar_t* category_name, const wchar_t* deckname);
static FILE* OpenDeckFile(const wchar_t* file, const char* mode); static FILE* OpenDeckFile(const wchar_t* file, const char* mode);
static irr::io::IReadFile* OpenDeckReader(const wchar_t* file); static irr::io::IReadFile* OpenDeckReader(const wchar_t* file);
static bool SaveDeck(Deck& deck, const wchar_t* file); static bool SaveDeck(const Deck& deck, const wchar_t* file);
static bool DeleteDeck(const wchar_t* file); static bool DeleteDeck(const wchar_t* file);
static bool CreateCategory(const wchar_t* name); static bool CreateCategory(const wchar_t* name);
static bool RenameCategory(const wchar_t* oldname, const wchar_t* newname); static bool RenameCategory(const wchar_t* oldname, const wchar_t* newname);
......
...@@ -3869,7 +3869,9 @@ bool DuelClient::ClientAnalyze(unsigned char* msg, int len) { ...@@ -3869,7 +3869,9 @@ bool DuelClient::ClientAnalyze(unsigned char* msg, int len) {
break; break;
} }
case MSG_RELOAD_FIELD: { case MSG_RELOAD_FIELD: {
mainGame->gMutex.lock(); if(!mainGame->dInfo.isReplay || !mainGame->dInfo.isReplaySkiping) {
mainGame->gMutex.lock();
}
mainGame->dField.Clear(); mainGame->dField.Clear();
mainGame->dInfo.duel_rule = BufferIO::ReadUInt8(pbuf); mainGame->dInfo.duel_rule = BufferIO::ReadUInt8(pbuf);
int val = 0; int val = 0;
...@@ -3975,7 +3977,9 @@ bool DuelClient::ClientAnalyze(unsigned char* msg, int len) { ...@@ -3975,7 +3977,9 @@ bool DuelClient::ClientAnalyze(unsigned char* msg, int len) {
myswprintf(event_string, dataManager.GetSysString(1609), dataManager.GetName(mainGame->dField.current_chain.code)); myswprintf(event_string, dataManager.GetSysString(1609), dataManager.GetName(mainGame->dField.current_chain.code));
mainGame->dField.last_chain = true; mainGame->dField.last_chain = true;
} }
mainGame->gMutex.unlock(); if(!mainGame->dInfo.isReplay || !mainGame->dInfo.isReplaySkiping) {
mainGame->gMutex.unlock();
}
break; break;
} }
} }
......
...@@ -106,6 +106,9 @@ bool Game::Initialize() { ...@@ -106,6 +106,9 @@ bool Game::Initialize() {
numFont = irr::gui::CGUITTFont::createTTFont(env, gameConf.numfont, 16); numFont = irr::gui::CGUITTFont::createTTFont(env, gameConf.numfont, 16);
if(!numFont) { if(!numFont) {
const wchar_t* numFontPaths[] = { const wchar_t* numFontPaths[] = {
L"./fonts/numFont.ttf",
L"./fonts/numFont.ttc",
L"./fonts/numFont.otf",
L"C:/Windows/Fonts/arialbd.ttf", L"C:/Windows/Fonts/arialbd.ttf",
L"/usr/share/fonts/truetype/DroidSansFallbackFull.ttf", L"/usr/share/fonts/truetype/DroidSansFallbackFull.ttf",
L"/usr/share/fonts/opentype/noto/NotoSansCJK-Bold.ttc", L"/usr/share/fonts/opentype/noto/NotoSansCJK-Bold.ttc",
...@@ -113,9 +116,6 @@ bool Game::Initialize() { ...@@ -113,9 +116,6 @@ bool Game::Initialize() {
L"/usr/share/fonts/noto-cjk/NotoSansCJK-Bold.ttc", L"/usr/share/fonts/noto-cjk/NotoSansCJK-Bold.ttc",
L"/System/Library/Fonts/SFNSTextCondensed-Bold.otf", L"/System/Library/Fonts/SFNSTextCondensed-Bold.otf",
L"/System/Library/Fonts/SFNS.ttf", L"/System/Library/Fonts/SFNS.ttf",
L"./fonts/numFont.ttf",
L"./fonts/numFont.ttc",
L"./fonts/numFont.otf"
}; };
for(const wchar_t* path : numFontPaths) { for(const wchar_t* path : numFontPaths) {
BufferIO::CopyWideString(path, gameConf.numfont); BufferIO::CopyWideString(path, gameConf.numfont);
...@@ -127,6 +127,9 @@ bool Game::Initialize() { ...@@ -127,6 +127,9 @@ bool Game::Initialize() {
textFont = irr::gui::CGUITTFont::createTTFont(env, gameConf.textfont, gameConf.textfontsize); textFont = irr::gui::CGUITTFont::createTTFont(env, gameConf.textfont, gameConf.textfontsize);
if(!textFont) { if(!textFont) {
const wchar_t* textFontPaths[] = { const wchar_t* textFontPaths[] = {
L"./fonts/textFont.ttf",
L"./fonts/textFont.ttc",
L"./fonts/textFont.otf",
L"C:/Windows/Fonts/msyh.ttc", L"C:/Windows/Fonts/msyh.ttc",
L"C:/Windows/Fonts/msyh.ttf", L"C:/Windows/Fonts/msyh.ttf",
L"C:/Windows/Fonts/simsun.ttc", L"C:/Windows/Fonts/simsun.ttc",
...@@ -139,9 +142,6 @@ bool Game::Initialize() { ...@@ -139,9 +142,6 @@ bool Game::Initialize() {
L"/usr/share/fonts/noto-cjk/NotoSansCJK-Regular.ttc", L"/usr/share/fonts/noto-cjk/NotoSansCJK-Regular.ttc",
L"/System/Library/Fonts/PingFang.ttc", L"/System/Library/Fonts/PingFang.ttc",
L"/System/Library/Fonts/STHeiti Medium.ttc", L"/System/Library/Fonts/STHeiti Medium.ttc",
L"./fonts/textFont.ttf",
L"./fonts/textFont.ttc",
L"./fonts/textFont.otf"
}; };
for(const wchar_t* path : textFontPaths) { for(const wchar_t* path : textFontPaths) {
BufferIO::CopyWideString(path, gameConf.textfont); BufferIO::CopyWideString(path, gameConf.textfont);
...@@ -159,7 +159,7 @@ bool Game::Initialize() { ...@@ -159,7 +159,7 @@ bool Game::Initialize() {
} }
}); });
if(fpath[0] == 0) { if(fpath[0] == 0) {
ErrorLog("No fonts found! Please manually edit system.conf or place appropriate font file in the fonts directory."); ErrorLog("No fonts found! Please place appropriate font file in the fonts directory, or edit system.conf manually.");
return false; return false;
} }
if(!numFont) { if(!numFont) {
...@@ -1719,6 +1719,11 @@ void Game::AddDebugMsg(const char* msg) { ...@@ -1719,6 +1719,11 @@ void Game::AddDebugMsg(const char* msg) {
} }
} }
void Game::ErrorLog(const char* msg) { void Game::ErrorLog(const char* msg) {
#ifdef _WIN32
OutputDebugStringA(msg);
#else
std::fprintf(stderr, "%s\n", msg);
#endif
FILE* fp = myfopen("error.log", "a"); FILE* fp = myfopen("error.log", "a");
if(!fp) if(!fp)
return; return;
......
...@@ -26,7 +26,7 @@ int main(int argc, char* argv[]) { ...@@ -26,7 +26,7 @@ int main(int argc, char* argv[]) {
#if defined(FOPEN_WINDOWS_SUPPORT_UTF8) #if defined(FOPEN_WINDOWS_SUPPORT_UTF8)
std::setlocale(LC_CTYPE, ".UTF-8"); std::setlocale(LC_CTYPE, ".UTF-8");
#elif defined(__APPLE__) #elif defined(__APPLE__)
std::setlocale(LC_CTYPE, "C.UTF-8"); std::setlocale(LC_CTYPE, "UTF-8");
#elif !defined(_WIN32) #elif !defined(_WIN32)
std::setlocale(LC_CTYPE, ""); std::setlocale(LC_CTYPE, "");
#endif #endif
......
...@@ -67,8 +67,6 @@ project "irrlicht" ...@@ -67,8 +67,6 @@ project "irrlicht"
files { files {
"include/*.h", "include/*.h",
"source/Irrlicht/*.cpp", "source/Irrlicht/*.cpp",
"source/Irrlicht/lzma/*.h",
"source/Irrlicht/lzma/*.c",
"source/Irrlicht/zlib/zlib.h", "source/Irrlicht/zlib/zlib.h",
"source/Irrlicht/zlib/adler32.c", "source/Irrlicht/zlib/adler32.c",
"source/Irrlicht/zlib/compress.c", "source/Irrlicht/zlib/compress.c",
...@@ -158,3 +156,15 @@ project "irrlicht" ...@@ -158,3 +156,15 @@ project "irrlicht"
filter { "system:linux" } filter { "system:linux" }
links { "X11", "Xxf86vm" } links { "X11", "Xxf86vm" }
filter { "system:macosx" }
cppdialect "gnu++14"
defines { "GL_SILENCE_DEPRECATION", "PNG_ARM_NEON_OPT=0", "PNG_ARM_NEON_IMPLEMENTATION=0" }
undefines { "NO_IRR_COMPILE_WITH_JOYSTICK_EVENTS_" }
files {
"source/Irrlicht/MacOSX/*.mm",
"source/Irrlicht/MacOSX/*.h",
}
filter { "system:macosx", "files:source/Irrlicht/Irrlicht.cpp or source/Irrlicht/COpenGLDriver.cpp" }
compileas "Objective-C++"
...@@ -6,7 +6,7 @@ LUA_LIB_NAME = "lua" ...@@ -6,7 +6,7 @@ LUA_LIB_NAME = "lua"
BUILD_EVENT = os.istarget("windows") BUILD_EVENT = os.istarget("windows")
BUILD_FREETYPE = os.istarget("windows") BUILD_FREETYPE = os.istarget("windows")
BUILD_SQLITE = os.istarget("windows") BUILD_SQLITE = os.istarget("windows")
BUILD_IRRLICHT = not os.istarget("macosx") BUILD_IRRLICHT = true
USE_AUDIO = true USE_AUDIO = true
AUDIO_LIB = "miniaudio" AUDIO_LIB = "miniaudio"
...@@ -226,7 +226,6 @@ workspace "YGOPro" ...@@ -226,7 +226,6 @@ workspace "YGOPro"
filter "system:macosx" filter "system:macosx"
libdirs { "/usr/local/lib" } libdirs { "/usr/local/lib" }
buildoptions { "-stdlib=libc++" }
if MAC_ARM then if MAC_ARM then
buildoptions { "--target=arm64-apple-macos12" } buildoptions { "--target=arm64-apple-macos12" }
end end
......
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