Commit 90bb84f0 authored by mercury233's avatar mercury233

Merge branch 'fh' into patch-miniaudio-v2

parents f4d23d09 478e674c
......@@ -401,12 +401,6 @@ jobs:
run: |
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
run: |
cp -r premake/* .
......@@ -418,9 +412,7 @@ jobs:
./premake5 gmake \
--cc=clang \
--freetype-include-dir="/usr/local/include/freetype2" \
--opus-include-dir="/usr/local/include/opus" \
--irrlicht-include-dir="../irrlicht/include" \
--irrlicht-lib-dir="../irrlicht/source/Irrlicht/MacOSX/build/Release"
--opus-include-dir="/usr/local/include/opus"
- name: Use premake to generate make files (ARM64)
if: runner.arch == 'ARM64'
......@@ -438,9 +430,7 @@ jobs:
--opus-include-dir="/opt/homebrew/include/opus" \
--opus-lib-dir="/opt/homebrew/lib" \
--vorbis-include-dir="/opt/homebrew/include" \
--vorbis-lib-dir="/opt/homebrew/lib" \
--irrlicht-include-dir="../irrlicht/include" \
--irrlicht-lib-dir="../irrlicht/source/Irrlicht/MacOSX/build/Release"
--vorbis-lib-dir="/opt/homebrew/lib"
- name: Make
run: |
......
......@@ -311,7 +311,7 @@ bool DeckManager::LoadCurrentDeck(int category_index, const wchar_t* category_na
mainGame->deckBuilder.RefreshPackListScroll();
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"))
return false;
FILE* fp = OpenDeckFile(file, "w");
......@@ -319,13 +319,13 @@ bool DeckManager::SaveDeck(Deck& deck, const wchar_t* file) {
return false;
std::fprintf(fp, "#created by ...\n#main\n");
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");
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");
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);
return true;
}
......
......@@ -58,7 +58,7 @@ public:
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 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 CreateCategory(const wchar_t* name);
static bool RenameCategory(const wchar_t* oldname, const wchar_t* newname);
......
......@@ -3869,7 +3869,9 @@ bool DuelClient::ClientAnalyze(unsigned char* msg, int len) {
break;
}
case MSG_RELOAD_FIELD: {
if(!mainGame->dInfo.isReplay || !mainGame->dInfo.isReplaySkiping) {
mainGame->gMutex.lock();
}
mainGame->dField.Clear();
mainGame->dInfo.duel_rule = BufferIO::ReadUInt8(pbuf);
int val = 0;
......@@ -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));
mainGame->dField.last_chain = true;
}
if(!mainGame->dInfo.isReplay || !mainGame->dInfo.isReplaySkiping) {
mainGame->gMutex.unlock();
}
break;
}
}
......
......@@ -106,6 +106,9 @@ bool Game::Initialize() {
numFont = irr::gui::CGUITTFont::createTTFont(env, gameConf.numfont, 16);
if(!numFont) {
const wchar_t* numFontPaths[] = {
L"./fonts/numFont.ttf",
L"./fonts/numFont.ttc",
L"./fonts/numFont.otf",
L"C:/Windows/Fonts/arialbd.ttf",
L"/usr/share/fonts/truetype/DroidSansFallbackFull.ttf",
L"/usr/share/fonts/opentype/noto/NotoSansCJK-Bold.ttc",
......@@ -113,9 +116,6 @@ bool Game::Initialize() {
L"/usr/share/fonts/noto-cjk/NotoSansCJK-Bold.ttc",
L"/System/Library/Fonts/SFNSTextCondensed-Bold.otf",
L"/System/Library/Fonts/SFNS.ttf",
L"./fonts/numFont.ttf",
L"./fonts/numFont.ttc",
L"./fonts/numFont.otf"
};
for(const wchar_t* path : numFontPaths) {
BufferIO::CopyWideString(path, gameConf.numfont);
......@@ -127,6 +127,9 @@ bool Game::Initialize() {
textFont = irr::gui::CGUITTFont::createTTFont(env, gameConf.textfont, gameConf.textfontsize);
if(!textFont) {
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.ttf",
L"C:/Windows/Fonts/simsun.ttc",
......@@ -139,9 +142,6 @@ bool Game::Initialize() {
L"/usr/share/fonts/noto-cjk/NotoSansCJK-Regular.ttc",
L"/System/Library/Fonts/PingFang.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) {
BufferIO::CopyWideString(path, gameConf.textfont);
......@@ -159,7 +159,7 @@ bool Game::Initialize() {
}
});
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;
}
if(!numFont) {
......@@ -1719,6 +1719,11 @@ void Game::AddDebugMsg(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");
if(!fp)
return;
......
......@@ -26,7 +26,7 @@ int main(int argc, char* argv[]) {
#if defined(FOPEN_WINDOWS_SUPPORT_UTF8)
std::setlocale(LC_CTYPE, ".UTF-8");
#elif defined(__APPLE__)
std::setlocale(LC_CTYPE, "C.UTF-8");
std::setlocale(LC_CTYPE, "UTF-8");
#elif !defined(_WIN32)
std::setlocale(LC_CTYPE, "");
#endif
......
......@@ -67,8 +67,6 @@ project "irrlicht"
files {
"include/*.h",
"source/Irrlicht/*.cpp",
"source/Irrlicht/lzma/*.h",
"source/Irrlicht/lzma/*.c",
"source/Irrlicht/zlib/zlib.h",
"source/Irrlicht/zlib/adler32.c",
"source/Irrlicht/zlib/compress.c",
......@@ -158,3 +156,15 @@ project "irrlicht"
filter { "system:linux" }
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"
BUILD_EVENT = os.istarget("windows")
BUILD_FREETYPE = os.istarget("windows")
BUILD_SQLITE = os.istarget("windows")
BUILD_IRRLICHT = not os.istarget("macosx")
BUILD_IRRLICHT = true
USE_AUDIO = true
AUDIO_LIB = "miniaudio"
......@@ -226,7 +226,6 @@ workspace "YGOPro"
filter "system:macosx"
libdirs { "/usr/local/lib" }
buildoptions { "-stdlib=libc++" }
if MAC_ARM then
buildoptions { "--target=arm64-apple-macos12" }
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