Commit e00ef914 authored by nanahira's avatar nanahira

Merge branch 'develop' of git.moenext.com:mycard/ygopro into develop

parents ea358b1f 64528a8c
export ASSET_BRANCH_NAME="master"
# if $CI_COMMIT_REF_NAME includes develop or pre, then we use the develop branch
if [[ "$CI_COMMIT_REF_NAME" == *"develop"* || "$CI_COMMIT_REF_NAME" == *".pre"* ]]; then
export ASSET_BRANCH_NAME="develop"
fi
#!/bin/bash #!/bin/bash
set -x set -x
set -o errexit set -o errexit
source .ci/asset-branch
# ygopro-database # ygopro-database
apt update && apt -y install wget git libarchive-tools apt update && apt -y install wget git libarchive-tools sqlite3
git clone --depth=1 https://code.moenext.com/mycard/ygopro-database git clone --depth=1 -b "$ASSET_BRANCH_NAME" https://code.moenext.com/mycard/ygopro-database
cp -rf ./ygopro-database/locales/$TARGET_LOCALE/* . cp -rf ./ygopro-database/locales/$TARGET_LOCALE/strings.conf .
rm -f cards.cdb
sqlite3 ./ygopro-database/locales/$TARGET_LOCALE/cards.cdb .dump | sqlite3 cards.cdb
# ygopro-images # ygopro-images
mkdir pics mkdir pics
if [[ "$CI_COMMIT_REF_NAME" == *"develop"* || "$CI_COMMIT_REF_NAME" == *".pre"* ]]; then if [[ "$ASSET_BRANCH_NAME" == "develop" ]]; then
echo "This is a pre-release, skipping download." echo "This is a pre-release, skipping download."
else else
wget -O - https://cdn02.moecube.com:444/images/ygopro-images-${TARGET_LOCALE}.zip | bsdtar -C pics -xf - wget -O - https://cdn02.moecube.com:444/images/ygopro-images-${TARGET_LOCALE}.zip | bsdtar -C pics -xf -
......
...@@ -8,6 +8,8 @@ export EVENT_INCLUDE_DIR=$PWD/libevent-stable/include ...@@ -8,6 +8,8 @@ export EVENT_INCLUDE_DIR=$PWD/libevent-stable/include
export EVENT_LIB_DIR=$PWD/libevent-stable/lib export EVENT_LIB_DIR=$PWD/libevent-stable/lib
export OPUS_INCLUDE_DIR=$PWD/miniaudio/external-built/include/opus export OPUS_INCLUDE_DIR=$PWD/miniaudio/external-built/include/opus
export OPUS_LIB_DIR=$PWD/miniaudio/external-built/lib export OPUS_LIB_DIR=$PWD/miniaudio/external-built/lib
export OPUSFILE_INCLUDE_DIR=$PWD/miniaudio/external-built/include/opus
export OPUSFILE_LIB_DIR=$PWD/miniaudio/external-built/lib
export VORBIS_INCLUDE_DIR=$PWD/miniaudio/external-built/include export VORBIS_INCLUDE_DIR=$PWD/miniaudio/external-built/include
export VORBIS_LIB_DIR=$PWD/miniaudio/external-built/lib export VORBIS_LIB_DIR=$PWD/miniaudio/external-built/lib
export OGG_INCLUDE_DIR=$PWD/miniaudio/external-built/include export OGG_INCLUDE_DIR=$PWD/miniaudio/external-built/include
......
#!/bin/bash #!/bin/bash
set -x set -x
set -o errexit set -o errexit
source .ci/asset-branch
IRRLICHT_REPO_URL="https://code.moenext.com/mycard/irrlicht-new.git" IRRLICHT_REPO_URL="https://code.moenext.com/mycard/irrlicht-new.git"
IRRLICHT_BRANCH_NAME="master" IRRLICHT_BRANCH_NAME="$ASSET_BRANCH_NAME"
# if $CI_COMMIT_REF_NAME includes develop or pre, then we use the develop branch
if [[ "$CI_COMMIT_REF_NAME" == *"develop"* ]]; then
IRRLICHT_BRANCH_NAME="develop"
fi
if [[ "$CI_COMMIT_REF_NAME" == *"-pre"* ]]; then
IRRLICHT_BRANCH_NAME="develop"
fi
if [ ! -d "irrlicht" ]; then if [ ! -d "irrlicht" ]; then
git clone --depth=1 --branch "$IRRLICHT_BRANCH_NAME" "$IRRLICHT_REPO_URL" irrlicht git clone --depth=1 --branch "$IRRLICHT_BRANCH_NAME" "$IRRLICHT_REPO_URL" irrlicht
......
...@@ -33,7 +33,9 @@ runForDepot() { ...@@ -33,7 +33,9 @@ runForDepot() {
echo "$result" | jq . echo "$result" | jq .
} }
if [[ "$CI_COMMIT_TAG" == *".pre"* ]]; then source .ci/asset-branch
if [[ "$ASSET_BRANCH_NAME" == "develop" ]]; then
echo "This is a pre-release, skipping upload." echo "This is a pre-release, skipping upload."
else else
runForDepot win32 zh-CN runForDepot win32 zh-CN
......
...@@ -2,7 +2,7 @@ name: Automated Test Build ...@@ -2,7 +2,7 @@ name: Automated Test Build
on: on:
push: push:
branches: [ "master" ] branches: [ "master","develop" ]
pull_request: pull_request:
branches: [ "master" ] branches: [ "master" ]
...@@ -313,9 +313,7 @@ jobs: ...@@ -313,9 +313,7 @@ jobs:
- name: Use premake to generate make files - name: Use premake to generate make files
run: | run: |
./premake5 gmake \ ./premake5 gmake
--freetype-include-dir="/usr/include/freetype2" \
--opus-include-dir="/usr/include/opus"
- name: Make - name: Make
run: | run: |
...@@ -406,44 +404,9 @@ jobs: ...@@ -406,44 +404,9 @@ jobs:
cp -r premake/* . cp -r premake/* .
cp -r resource/* . cp -r resource/* .
- name: Use premake to generate make files (Intel) - name: Use premake to generate make files
if: runner.arch == 'X64' run: |
run: | DYLD_LIBRARY_PATH=$(brew --prefix)/lib ./premake5 gmake --cc=clang
./premake5 gmake \
--cc=clang \
<<<<<<< HEAD
--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"
=======
--no-use-irrklang \
--freetype-include-dir="/usr/local/include/freetype2"
>>>>>>> 3aace69fd7bed29f44f40321b513be2a9a3ee45c
- name: Use premake to generate make files (ARM64)
if: runner.arch == 'ARM64'
run: |
./premake5 gmake \
--cc=clang \
--event-include-dir="/opt/homebrew/include" \
--event-lib-dir="/opt/homebrew/lib" \
--freetype-include-dir="/opt/homebrew/include/freetype2" \
--freetype-lib-dir="/opt/homebrew/lib" \
--sqlite-include-dir="/opt/homebrew/opt/sqlite/include" \
<<<<<<< HEAD
--sqlite-lib-dir="/opt/homebrew/opt/sqlite/lib" \
--miniaudio-include-dir="/opt/homebrew/include" \
--miniaudio-lib-dir="/opt/homebrew/lib" \
--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"
=======
--sqlite-lib-dir="/opt/homebrew/opt/sqlite/lib"
>>>>>>> 3aace69fd7bed29f44f40321b513be2a9a3ee45c
- name: Make - name: Make
run: | run: |
......
...@@ -132,6 +132,8 @@ exec_linux: ...@@ -132,6 +132,8 @@ exec_linux:
EVENT_LIB_DIR: /usr/share/libevent-stable/lib EVENT_LIB_DIR: /usr/share/libevent-stable/lib
OPUS_INCLUDE_DIR: $CI_PROJECT_DIR/miniaudio/external-built/include/opus OPUS_INCLUDE_DIR: $CI_PROJECT_DIR/miniaudio/external-built/include/opus
OPUS_LIB_DIR: $CI_PROJECT_DIR/miniaudio/external-built/lib OPUS_LIB_DIR: $CI_PROJECT_DIR/miniaudio/external-built/lib
OPUSFILE_INCLUDE_DIR: $CI_PROJECT_DIR/miniaudio/external-built/include/opus
OPUSFILE_LIB_DIR: $CI_PROJECT_DIR/miniaudio/external-built/lib
VORBIS_INCLUDE_DIR: $CI_PROJECT_DIR/miniaudio/external-built/include VORBIS_INCLUDE_DIR: $CI_PROJECT_DIR/miniaudio/external-built/include
VORBIS_LIB_DIR: $CI_PROJECT_DIR/miniaudio/external-built/lib VORBIS_LIB_DIR: $CI_PROJECT_DIR/miniaudio/external-built/lib
OGG_INCLUDE_DIR: $CI_PROJECT_DIR/miniaudio/external-built/include OGG_INCLUDE_DIR: $CI_PROJECT_DIR/miniaudio/external-built/include
...@@ -227,12 +229,8 @@ assets: ...@@ -227,12 +229,8 @@ assets:
- wget -O - https://code.moenext.com/mycard/ygopro-sounds/-/archive/master/ygopro-sounds-master.tar.gz | tar zfx - - wget -O - https://code.moenext.com/mycard/ygopro-sounds/-/archive/master/ygopro-sounds-master.tar.gz | tar zfx -
- mv ygopro-sounds-master/sound/* sound - mv ygopro-sounds-master/sound/* sound
# fonts # fonts
- mkdir fonts - git clone --depth=1 https://code.moenext.com/mycard/ygopro-fonts
- cd fonts - mv ygopro-fonts/fonts .
- wget -O - https://cdn02.moecube.com:444/ygopro-fonts.tar.gz | tar zfx -
- mv simhei.ttf textFont.ttf
- mv arial.ttf numFont.ttf
- cd ..
# pack # pack
- git clone --depth=1 https://code.moenext.com/mycard/ygopro-card-list - git clone --depth=1 https://code.moenext.com/mycard/ygopro-card-list
- mv ygopro-card-list/pack . - mv ygopro-card-list/pack .
......
...@@ -32,7 +32,7 @@ public: ...@@ -32,7 +32,7 @@ public:
* @brief Copy a C-style string to another C-style string. * @brief Copy a C-style string to another C-style string.
* @param src The source wide string * @param src The source wide string
* @param pstr The destination char string * @param pstr The destination char string
* @param bufsize The size of the destination buffer * @param bufsize The length of the destination buffer
* @return The length of the copied string * @return The length of the copied string
*/ */
template<typename T1, typename T2> template<typename T1, typename T2>
...@@ -62,13 +62,13 @@ public: ...@@ -62,13 +62,13 @@ public:
} }
template<size_t N> template<size_t N>
static void CopyString(const char* src, char(&dst)[N]) { static void CopyString(const char* src, char(&dst)[N]) {
dst[0] = 0; std::strncpy(dst, src, N - 1);
std::strncat(dst, src, N - 1); dst[N - 1] = 0;
} }
template<size_t N> template<size_t N>
static void CopyWideString(const wchar_t* src, wchar_t(&dst)[N]) { static void CopyWideString(const wchar_t* src, wchar_t(&dst)[N]) {
dst[0] = 0; std::wcsncpy(dst, src, N - 1);
std::wcsncat(dst, src, N - 1); dst[N - 1] = 0;
} }
template<typename T> template<typename T>
static bool CheckUTF8Byte(const T* str, int len) { static bool CheckUTF8Byte(const T* str, int len) {
......
...@@ -359,7 +359,7 @@ bool DeckManager::DeleteCategory(const wchar_t* name) { ...@@ -359,7 +359,7 @@ bool DeckManager::DeleteCategory(const wchar_t* name) {
return false; return false;
return FileSystem::DeleteDir(localname); return FileSystem::DeleteDir(localname);
} }
bool DeckManager::SaveDeckBuffer(const ReplayDeck& deck, const wchar_t* name) { bool DeckManager::SaveDeckArray(const DeckArray& deck, const wchar_t* name) {
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(name, "w"); FILE* fp = OpenDeckFile(name, "w");
......
...@@ -35,7 +35,7 @@ struct Deck { ...@@ -35,7 +35,7 @@ struct Deck {
} }
}; };
struct ReplayDeck { struct DeckArray {
std::vector<uint32_t> main; std::vector<uint32_t> main;
std::vector<uint32_t> extra; std::vector<uint32_t> extra;
std::vector<uint32_t> side; std::vector<uint32_t> side;
...@@ -68,7 +68,7 @@ public: ...@@ -68,7 +68,7 @@ public:
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);
static bool DeleteCategory(const wchar_t* name); static bool DeleteCategory(const wchar_t* name);
static bool SaveDeckBuffer(const ReplayDeck& deck, const wchar_t* name); static bool SaveDeckArray(const DeckArray& deck, const wchar_t* name);
}; };
extern DeckManager deckManager; extern DeckManager deckManager;
......
...@@ -1262,7 +1262,12 @@ void Game::DrawDeckBd() { ...@@ -1262,7 +1262,12 @@ void Game::DrawDeckBd() {
driver->draw2DRectangle(Resize(805, 160, 1020, 630), 0x400000ff, 0x400000ff, 0x40000000, 0x40000000); driver->draw2DRectangle(Resize(805, 160, 1020, 630), 0x400000ff, 0x400000ff, 0x40000000, 0x40000000);
driver->draw2DRectangleOutline(Resize(804, 159, 1020, 630)); driver->draw2DRectangleOutline(Resize(804, 159, 1020, 630));
} }
for(int i = 0; i < 9 && i + scrFilter->getPos() < (int)deckBuilder.results.size(); ++i) { #ifdef YGOPRO_USE_THUMB_LOAD_THERAD
constexpr int MAX_RESULT = 9;
#else
constexpr int MAX_RESULT = 7;
#endif
for(int i = 0; i < MAX_RESULT && i + scrFilter->getPos() < (int)deckBuilder.results.size(); ++i) {
code_pointer ptr = deckBuilder.results[i + scrFilter->getPos()]; code_pointer ptr = deckBuilder.results[i + scrFilter->getPos()];
if(i >= 7) if(i >= 7)
{ {
......
...@@ -1580,7 +1580,10 @@ void Game::ShowCardInfo(int code, bool resize) { ...@@ -1580,7 +1580,10 @@ void Game::ShowCardInfo(int code, bool resize) {
myswprintf(formatBuffer, L"%ls[%08d]", dataManager.GetName(code), code); myswprintf(formatBuffer, L"%ls[%08d]", dataManager.GetName(code), code);
} }
stName->setText(formatBuffer); stName->setText(formatBuffer);
stName->setToolTipText(formatBuffer); if((int)guiFont->getDimension(formatBuffer).Width > stName->getRelativePosition().getWidth() - gameConf.textfontsize)
stName->setToolTipText(formatBuffer);
else
stName->setToolTipText(nullptr);
int offset = 0; int offset = 0;
if (is_valid && !gameConf.hide_setname) { if (is_valid && !gameConf.hide_setname) {
auto& cd = cit->second; auto& cd = cit->second;
...@@ -2057,6 +2060,9 @@ void Game::OnResize() { ...@@ -2057,6 +2060,9 @@ void Game::OnResize() {
btnBigCardZoomIn->setRelativePosition(Resize(205, 140, 295, 175)); btnBigCardZoomIn->setRelativePosition(Resize(205, 140, 295, 175));
btnBigCardZoomOut->setRelativePosition(Resize(205, 180, 295, 215)); btnBigCardZoomOut->setRelativePosition(Resize(205, 180, 295, 215));
btnBigCardClose->setRelativePosition(Resize(205, 230, 295, 265)); btnBigCardClose->setRelativePosition(Resize(205, 230, 295, 265));
irr::s32 barWidth = (xScale > 1) ? gameConf.textfontsize * xScale : gameConf.textfontsize;
env->getSkin()->setSize(irr::gui::EGDS_SCROLLBAR_SIZE, barWidth);
} }
void Game::ResizeChatInputWindow() { void Game::ResizeChatInputWindow() {
irr::s32 x = wInfos->getRelativePosition().LowerRightCorner.X + 6; irr::s32 x = wInfos->getRelativePosition().LowerRightCorner.X + 6;
......
...@@ -33,11 +33,17 @@ int main(int argc, char* argv[]) { ...@@ -33,11 +33,17 @@ int main(int argc, char* argv[]) {
#ifdef __APPLE__ #ifdef __APPLE__
CFURLRef bundle_url = CFBundleCopyBundleURL(CFBundleGetMainBundle()); CFURLRef bundle_url = CFBundleCopyBundleURL(CFBundleGetMainBundle());
CFURLRef bundle_base_url = CFURLCreateCopyDeletingLastPathComponent(nullptr, bundle_url); CFURLRef bundle_base_url = CFURLCreateCopyDeletingLastPathComponent(nullptr, bundle_url);
CFStringRef bundle_ext = CFURLCopyPathExtension(bundle_url);
if (bundle_ext) {
char path[PATH_MAX];
if (CFStringCompare(bundle_ext, CFSTR("app"), kCFCompareCaseInsensitive) == kCFCompareEqualTo
&& CFURLGetFileSystemRepresentation(bundle_base_url, true, (UInt8*)path, PATH_MAX)) {
chdir(path);
}
CFRelease(bundle_ext);
}
CFRelease(bundle_url); CFRelease(bundle_url);
CFStringRef path = CFURLCopyFileSystemPath(bundle_base_url, kCFURLPOSIXPathStyle);
CFRelease(bundle_base_url); CFRelease(bundle_base_url);
chdir(CFStringGetCStringPtr(path, kCFStringEncodingUTF8));
CFRelease(path);
#endif //__APPLE__ #endif //__APPLE__
#ifdef _WIN32 #ifdef _WIN32
if (argc == 2 && (ygo::IsExtension(argv[1], ".ydk") || ygo::IsExtension(argv[1], ".yrp"))) { // open file from explorer if (argc == 2 && (ygo::IsExtension(argv[1], ".ydk") || ygo::IsExtension(argv[1], ".yrp"))) { // open file from explorer
......
#include "image_manager.h" #include "image_manager.h"
#include "game.h" #include "game.h"
#ifdef YGOPRO_USE_THUMB_LOAD_THERAD
#include <thread> #include <thread>
#endif
#ifdef _OPENMP
#include <omp.h>
#endif
namespace ygo { namespace ygo {
...@@ -17,8 +22,10 @@ bool ImageManager::Initial() { ...@@ -17,8 +22,10 @@ bool ImageManager::Initial() {
tUnknownFit = nullptr; tUnknownFit = nullptr;
tUnknownThumb = nullptr; tUnknownThumb = nullptr;
tBigPicture = nullptr; tBigPicture = nullptr;
#ifdef YGOPRO_USE_THUMB_LOAD_THERAD
tLoading = nullptr; tLoading = nullptr;
tThumbLoadingThreadRunning = false; tThumbLoadingThreadRunning = false;
#endif
tAct = driver->getTexture("textures/act.png"); tAct = driver->getTexture("textures/act.png");
tAttack = driver->getTexture("textures/attack.png"); tAttack = driver->getTexture("textures/attack.png");
tChain = driver->getTexture("textures/chain.png"); tChain = driver->getTexture("textures/chain.png");
...@@ -59,7 +66,11 @@ void ImageManager::ClearTexture() { ...@@ -59,7 +66,11 @@ void ImageManager::ClearTexture() {
driver->removeTexture(tit->second); driver->removeTexture(tit->second);
} }
for(auto tit = tThumb.begin(); tit != tThumb.end(); ++tit) { for(auto tit = tThumb.begin(); tit != tThumb.end(); ++tit) {
#ifdef YGOPRO_USE_THUMB_LOAD_THERAD
if(tit->second && tit->second != tLoading) if(tit->second && tit->second != tLoading)
#else
if(tit->second)
#endif
driver->removeTexture(tit->second); driver->removeTexture(tit->second);
} }
if(tBigPicture != nullptr) { if(tBigPicture != nullptr) {
...@@ -69,12 +80,14 @@ void ImageManager::ClearTexture() { ...@@ -69,12 +80,14 @@ void ImageManager::ClearTexture() {
tMap[0].clear(); tMap[0].clear();
tMap[1].clear(); tMap[1].clear();
tThumb.clear(); tThumb.clear();
#ifdef YGOPRO_USE_THUMB_LOAD_THERAD
tThumbLoadingMutex.lock(); tThumbLoadingMutex.lock();
tThumbLoading.clear(); tThumbLoading.clear();
while(!tThumbLoadingCodes.empty()) while(!tThumbLoadingCodes.empty())
tThumbLoadingCodes.pop(); tThumbLoadingCodes.pop();
tThumbLoadingThreadRunning = false; tThumbLoadingThreadRunning = false;
tThumbLoadingMutex.unlock(); tThumbLoadingMutex.unlock();
#endif
tFields.clear(); tFields.clear();
} }
void ImageManager::RemoveTexture(int code) { void ImageManager::RemoveTexture(int code) {
...@@ -110,11 +123,13 @@ void ImageManager::ResizeTexture() { ...@@ -110,11 +123,13 @@ void ImageManager::ResizeTexture() {
driver->removeTexture(tUnknown); driver->removeTexture(tUnknown);
driver->removeTexture(tUnknownFit); driver->removeTexture(tUnknownFit);
driver->removeTexture(tUnknownThumb); driver->removeTexture(tUnknownThumb);
#ifdef YGOPRO_USE_THUMB_LOAD_THERAD
driver->removeTexture(tLoading); driver->removeTexture(tLoading);
tLoading = GetTextureFromFile("textures/cover.jpg", imgWidthThumb, imgHeightThumb);
#endif
tUnknown = GetTextureFromFile("textures/unknown.jpg", CARD_IMG_WIDTH, CARD_IMG_HEIGHT); tUnknown = GetTextureFromFile("textures/unknown.jpg", CARD_IMG_WIDTH, CARD_IMG_HEIGHT);
tUnknownFit = GetTextureFromFile("textures/unknown.jpg", imgWidthFit, imgHeightFit); tUnknownFit = GetTextureFromFile("textures/unknown.jpg", imgWidthFit, imgHeightFit);
tUnknownThumb = GetTextureFromFile("textures/unknown.jpg", imgWidthThumb, imgHeightThumb); tUnknownThumb = GetTextureFromFile("textures/unknown.jpg", imgWidthThumb, imgHeightThumb);
tLoading = GetTextureFromFile("textures/cover.jpg", imgWidthThumb, imgHeightThumb);
driver->removeTexture(tBackGround); driver->removeTexture(tBackGround);
tBackGround = GetTextureFromFile("textures/bg.jpg", bgWidth, bgHeight); tBackGround = GetTextureFromFile("textures/bg.jpg", bgWidth, bgHeight);
driver->removeTexture(tBackGround_menu); driver->removeTexture(tBackGround_menu);
...@@ -128,25 +143,27 @@ void ImageManager::ResizeTexture() { ...@@ -128,25 +143,27 @@ void ImageManager::ResizeTexture() {
} }
// function by Warr1024, from https://github.com/minetest/minetest/issues/2419 , modified // function by Warr1024, from https://github.com/minetest/minetest/issues/2419 , modified
void imageScaleNNAA(irr::video::IImage *src, irr::video::IImage *dest) { void imageScaleNNAA(irr::video::IImage *src, irr::video::IImage *dest) {
double sx, sy, minsx, maxsx, minsy, maxsy, area, ra, ga, ba, aa, pw, ph, pa; const irr::core::dimension2d<irr::u32> srcDim = src->getDimension();
irr::u32 dy, dx; const irr::core::dimension2d<irr::u32> destDim = dest->getDimension();
irr::video::SColor pxl;
// Cache rectsngle boundaries. // Cache scale ratios.
double sw = src->getDimension().Width * 1.0; const double rx = (double)srcDim.Width / destDim.Width;
double sh = src->getDimension().Height * 1.0; const double ry = (double)srcDim.Height / destDim.Height;
// Walk each destination image pixel. #pragma omp parallel
// Note: loop y around x for better cache locality. {
irr::core::dimension2d<irr::u32> dim = dest->getDimension(); double sx, sy, minsx, maxsx, minsy, maxsy, area, ra, ga, ba, aa, pw, ph, pa;
for(dy = 0; dy < dim.Height; dy++) irr::video::SColor pxl, npxl;
for(dx = 0; dx < dim.Width; dx++) {
// Walk each destination image pixel.
#pragma omp for schedule(dynamic)
for(irr::s32 dy = 0; dy < destDim.Height; dy++) {
for(irr::s32 dx = 0; dx < destDim.Width; dx++) {
// Calculate floating-point source rectangle bounds. // Calculate floating-point source rectangle bounds.
minsx = dx * sw / dim.Width; minsx = dx * rx;
maxsx = minsx + sw / dim.Width; maxsx = minsx + rx;
minsy = dy * sh / dim.Height; minsy = dy * ry;
maxsy = minsy + sh / dim.Height; maxsy = minsy + ry;
// Total area, and integral of r, g, b values over that area, // Total area, and integral of r, g, b values over that area,
// initialized to zero, to be summed up in next loops. // initialized to zero, to be summed up in next loops.
...@@ -157,9 +174,8 @@ void imageScaleNNAA(irr::video::IImage *src, irr::video::IImage *dest) { ...@@ -157,9 +174,8 @@ void imageScaleNNAA(irr::video::IImage *src, irr::video::IImage *dest) {
aa = 0; aa = 0;
// Loop over the integral pixel positions described by those bounds. // Loop over the integral pixel positions described by those bounds.
for(sy = floor(minsy); sy < maxsy; sy++) for(sy = floor(minsy); sy < maxsy; sy++) {
for(sx = floor(minsx); sx < maxsx; sx++) { for(sx = floor(minsx); sx < maxsx; sx++) {
// Calculate width, height, then area of dest pixel // Calculate width, height, then area of dest pixel
// that's covered by this source pixel. // that's covered by this source pixel.
pw = 1; pw = 1;
...@@ -183,21 +199,20 @@ void imageScaleNNAA(irr::video::IImage *src, irr::video::IImage *dest) { ...@@ -183,21 +199,20 @@ void imageScaleNNAA(irr::video::IImage *src, irr::video::IImage *dest) {
ba += pa * pxl.getBlue(); ba += pa * pxl.getBlue();
aa += pa * pxl.getAlpha(); aa += pa * pxl.getAlpha();
} }
}
// Set the destination image pixel to the average color. // Set the destination image pixel to the average color.
if(area > 0) { if(area > 0) {
pxl.setRed(ra / area + 0.5); npxl.set((irr::u32)(aa / area + 0.5),
pxl.setGreen(ga / area + 0.5); (irr::u32)(ra / area + 0.5),
pxl.setBlue(ba / area + 0.5); (irr::u32)(ga / area + 0.5),
pxl.setAlpha(aa / area + 0.5); (irr::u32)(ba / area + 0.5));
} else { } else {
pxl.setRed(0); npxl.set(0);
pxl.setGreen(0);
pxl.setBlue(0);
pxl.setAlpha(0);
} }
dest->setPixel(dx, dy, pxl); dest->setPixel(dx, dy, npxl);
} }
}
} // end of parallel region
} }
irr::video::ITexture* ImageManager::GetTextureFromFile(const char* file, irr::s32 width, irr::s32 height) { irr::video::ITexture* ImageManager::GetTextureFromFile(const char* file, irr::s32 width, irr::s32 height) {
if(mainGame->gameConf.use_image_scale) { if(mainGame->gameConf.use_image_scale) {
...@@ -283,6 +298,7 @@ irr::video::ITexture* ImageManager::GetBigPicture(int code, float zoom) { ...@@ -283,6 +298,7 @@ irr::video::ITexture* ImageManager::GetBigPicture(int code, float zoom) {
tBigPicture = texture; tBigPicture = texture;
return texture; return texture;
} }
#ifdef YGOPRO_USE_THUMB_LOAD_THERAD
int ImageManager::LoadThumbThread() { int ImageManager::LoadThumbThread() {
while(true) { while(true) {
imageManager.tThumbLoadingMutex.lock(); imageManager.tThumbLoadingMutex.lock();
...@@ -338,9 +354,34 @@ int ImageManager::LoadThumbThread() { ...@@ -338,9 +354,34 @@ int ImageManager::LoadThumbThread() {
imageManager.tThumbLoadingMutex.unlock(); imageManager.tThumbLoadingMutex.unlock();
return 0; return 0;
} }
#endif // YGOPRO_USE_THUMB_LOAD_THERAD
irr::video::ITexture* ImageManager::GetTextureThumb(int code) { irr::video::ITexture* ImageManager::GetTextureThumb(int code) {
if(code == 0) if(code == 0)
return tUnknownThumb; return tUnknownThumb;
#ifndef YGOPRO_USE_THUMB_LOAD_THERAD
auto tit = tThumb.find(code);
if(tit == tThumb.end()) {
char file[256];
std::snprintf(file, sizeof file, "expansions/pics/thumbnail/%d.jpg", code);
int width = CARD_THUMB_WIDTH * mainGame->xScale;
int height = CARD_THUMB_HEIGHT * mainGame->yScale;
irr::video::ITexture* img = GetTextureFromFile(file, width, height);
if(img == NULL) {
std::snprintf(file, sizeof file, "pics/thumbnail/%d.jpg", code);
img = GetTextureFromFile(file, width, height);
}
if(img == NULL && mainGame->gameConf.use_image_scale) {
std::snprintf(file, sizeof file, "expansions/pics/%d.jpg", code);
img = GetTextureFromFile(file, width, height);
if(img == NULL) {
std::snprintf(file, sizeof file, "pics/%d.jpg", code);
img = GetTextureFromFile(file, width, height);
}
}
tThumb[code] = img;
return (img == NULL) ? tUnknownThumb : img;
}
#else // YGOPRO_USE_THUMB_LOAD_THERAD
imageManager.tThumbLoadingMutex.lock(); imageManager.tThumbLoadingMutex.lock();
auto lit = tThumbLoading.find(code); auto lit = tThumbLoading.find(code);
if(lit != tThumbLoading.end()) { if(lit != tThumbLoading.end()) {
...@@ -368,6 +409,7 @@ irr::video::ITexture* ImageManager::GetTextureThumb(int code) { ...@@ -368,6 +409,7 @@ irr::video::ITexture* ImageManager::GetTextureThumb(int code) {
imageManager.tThumbLoadingMutex.unlock(); imageManager.tThumbLoadingMutex.unlock();
return tLoading; return tLoading;
} }
#endif // YGOPRO_USE_THUMB_LOAD_THERAD
if(tit->second) if(tit->second)
return tit->second; return tit->second;
else else
......
#ifndef IMAGEMANAGER_H #ifndef IMAGEMANAGER_H
#define IMAGEMANAGER_H #define IMAGEMANAGER_H
#ifndef _OPENMP
#define YGOPRO_USE_THUMB_LOAD_THERAD
#endif
#include "config.h" #include "config.h"
#include "data_manager.h" #include "data_manager.h"
#include <unordered_map> #include <unordered_map>
#ifdef YGOPRO_USE_THUMB_LOAD_THERAD
#include <queue> #include <queue>
#include <mutex> #include <mutex>
#endif
namespace ygo { namespace ygo {
...@@ -21,15 +27,19 @@ public: ...@@ -21,15 +27,19 @@ public:
irr::video::ITexture* GetBigPicture(int code, float zoom); irr::video::ITexture* GetBigPicture(int code, float zoom);
irr::video::ITexture* GetTextureThumb(int code); irr::video::ITexture* GetTextureThumb(int code);
irr::video::ITexture* GetTextureField(int code); irr::video::ITexture* GetTextureField(int code);
#ifdef YGOPRO_USE_THUMB_LOAD_THERAD
static int LoadThumbThread(); static int LoadThumbThread();
#endif
std::unordered_map<int, irr::video::ITexture*> tMap[2]; std::unordered_map<int, irr::video::ITexture*> tMap[2];
std::unordered_map<int, irr::video::ITexture*> tThumb; std::unordered_map<int, irr::video::ITexture*> tThumb;
std::unordered_map<int, irr::video::ITexture*> tFields; std::unordered_map<int, irr::video::ITexture*> tFields;
#ifdef YGOPRO_USE_THUMB_LOAD_THERAD
std::unordered_map<int, irr::video::IImage*> tThumbLoading; std::unordered_map<int, irr::video::IImage*> tThumbLoading;
std::queue<int> tThumbLoadingCodes; std::queue<int> tThumbLoadingCodes;
std::mutex tThumbLoadingMutex; std::mutex tThumbLoadingMutex;
bool tThumbLoadingThreadRunning; bool tThumbLoadingThreadRunning;
#endif
irr::IrrlichtDevice* device; irr::IrrlichtDevice* device;
irr::video::IVideoDriver* driver; irr::video::IVideoDriver* driver;
irr::video::ITexture* tCover[4]; irr::video::ITexture* tCover[4];
...@@ -37,7 +47,9 @@ public: ...@@ -37,7 +47,9 @@ public:
irr::video::ITexture* tUnknownFit; irr::video::ITexture* tUnknownFit;
irr::video::ITexture* tUnknownThumb; irr::video::ITexture* tUnknownThumb;
irr::video::ITexture* tBigPicture; irr::video::ITexture* tBigPicture;
#ifdef YGOPRO_USE_THUMB_LOAD_THERAD
irr::video::ITexture* tLoading; irr::video::ITexture* tLoading;
#endif
irr::video::ITexture* tAct; irr::video::ITexture* tAct;
irr::video::ITexture* tAttack; irr::video::ITexture* tAttack;
irr::video::ITexture* tNegated; irr::video::ITexture* tNegated;
......
...@@ -299,24 +299,24 @@ bool MenuHandler::OnEvent(const irr::SEvent& event) { ...@@ -299,24 +299,24 @@ bool MenuHandler::OnEvent(const irr::SEvent& event) {
auto selected = mainGame->lstReplayList->getSelected(); auto selected = mainGame->lstReplayList->getSelected();
if(selected == -1) if(selected == -1)
break; break;
Replay replay1; Replay replay;
wchar_t replay_name[256]{}; wchar_t replay_filename[256]{};
wchar_t namebuf[4][20]{}; wchar_t namebuf[4][20]{};
wchar_t filename[256]{}; wchar_t filename[256]{};
wchar_t replay_path[256]{}; wchar_t replay_path[256]{};
BufferIO::CopyWideString(mainGame->lstReplayList->getListItem(selected), replay_name); BufferIO::CopyWideString(mainGame->lstReplayList->getListItem(selected), replay_filename);
myswprintf(replay_path, L"./replay/%ls", replay_name); myswprintf(replay_path, L"./replay/%ls", replay_filename);
if (!replay1.OpenReplay(replay_path)) if (!replay.OpenReplay(replay_path))
break; break;
if (replay1.pheader.flag & REPLAY_SINGLE_MODE) if (replay.pheader.flag & REPLAY_SINGLE_MODE)
break; break;
for (size_t i = 0; i < replay1.decks.size(); ++i) { for (size_t i = 0; i < replay.decks.size(); ++i) {
BufferIO::CopyWideString(replay1.players[Replay::GetDeckPlayer(i)].c_str(), namebuf[i]); BufferIO::CopyWideString(replay.players[Replay::GetDeckPlayer(i)].c_str(), namebuf[i]);
FileSystem::SafeFileName(namebuf[i]); FileSystem::SafeFileName(namebuf[i]);
} }
for (size_t i = 0; i < replay1.decks.size(); ++i) { for (size_t i = 0; i < replay.decks.size(); ++i) {
myswprintf(filename, L"./deck/%ls-%d %ls.ydk", replay_name, i + 1, namebuf[i]); myswprintf(filename, L"./deck/%ls-%d %ls.ydk", replay_filename, i + 1, namebuf[i]);
DeckManager::SaveDeckBuffer(replay1.decks[i], filename); DeckManager::SaveDeckArray(replay.decks[i], filename);
} }
mainGame->stACMessage->setText(dataManager.GetSysString(1335)); mainGame->stACMessage->setText(dataManager.GetSysString(1335));
mainGame->PopupElement(mainGame->wACMessage, 20); mainGame->PopupElement(mainGame->wACMessage, 20);
...@@ -545,11 +545,11 @@ bool MenuHandler::OnEvent(const irr::SEvent& event) { ...@@ -545,11 +545,11 @@ bool MenuHandler::OnEvent(const irr::SEvent& event) {
repinfo.append(path); repinfo.append(path);
repinfo.append(L"\n"); repinfo.append(L"\n");
} }
const auto& namebuf = ReplayMode::cur_replay.players; const auto& player_names = ReplayMode::cur_replay.players;
if(ReplayMode::cur_replay.pheader.flag & REPLAY_TAG) if(ReplayMode::cur_replay.pheader.flag & REPLAY_TAG)
myswprintf(infobuf, L"%ls\n%ls\n===VS===\n%ls\n%ls\n", namebuf[0].c_str(), namebuf[1].c_str(), namebuf[2].c_str(), namebuf[3].c_str()); myswprintf(infobuf, L"%ls\n%ls\n===VS===\n%ls\n%ls\n", player_names[0].c_str(), player_names[1].c_str(), player_names[2].c_str(), player_names[3].c_str());
else else
myswprintf(infobuf, L"%ls\n===VS===\n%ls\n", namebuf[0].c_str(), namebuf[1].c_str()); myswprintf(infobuf, L"%ls\n===VS===\n%ls\n", player_names[0].c_str(), player_names[1].c_str());
repinfo.append(infobuf); repinfo.append(infobuf);
mainGame->ebRepStartTurn->setText(L"1"); mainGame->ebRepStartTurn->setText(L"1");
mainGame->SetStaticText(mainGame->stReplayInfo, 180, mainGame->guiFont, repinfo.c_str()); mainGame->SetStaticText(mainGame->stReplayInfo, 180, mainGame->guiFont, repinfo.c_str());
......
...@@ -5,6 +5,7 @@ project "YGOPro" ...@@ -5,6 +5,7 @@ project "YGOPro"
kind "WindowedApp" kind "WindowedApp"
cppdialect "C++14" cppdialect "C++14"
rtti "Off" rtti "Off"
openmp "On"
files { "*.cpp", "*.h" } files { "*.cpp", "*.h" }
includedirs { "../ocgcore" } includedirs { "../ocgcore" }
...@@ -49,7 +50,7 @@ project "YGOPro" ...@@ -49,7 +50,7 @@ project "YGOPro"
includedirs { "../miniaudio/extras/decoders/libopus", "../miniaudio/extras/decoders/libvorbis" } includedirs { "../miniaudio/extras/decoders/libopus", "../miniaudio/extras/decoders/libvorbis" }
if not MINIAUDIO_BUILD_OPUS_VORBIS then if not MINIAUDIO_BUILD_OPUS_VORBIS then
links { "opusfile", "vorbisfile", "opus", "vorbis", "ogg" } links { "opusfile", "vorbisfile", "opus", "vorbis", "ogg" }
libdirs { OPUS_LIB_DIR, VORBIS_LIB_DIR, OGG_LIBDIR } libdirs { OPUS_LIB_DIR, OPUSFILE_LIB_DIR, VORBIS_LIB_DIR, OGG_LIB_DIR }
end end
end end
end end
...@@ -83,6 +84,7 @@ project "YGOPro" ...@@ -83,6 +84,7 @@ project "YGOPro"
filter "not system:windows" filter "not system:windows"
links { "event_pthreads", "dl", "pthread" } links { "event_pthreads", "dl", "pthread" }
filter "system:macosx" filter "system:macosx"
openmp "Off"
links { "z" } links { "z" }
defines { "GL_SILENCE_DEPRECATION" } defines { "GL_SILENCE_DEPRECATION" }
if MAC_ARM then if MAC_ARM then
...@@ -94,6 +96,7 @@ project "YGOPro" ...@@ -94,6 +96,7 @@ project "YGOPro"
end end
filter "system:linux" filter "system:linux"
links { "GL", "X11", "Xxf86vm" } links { "GL", "X11", "Xxf86vm" }
linkoptions { "-fopenmp" }
if USE_AUDIO and AUDIO_LIB == "irrklang" then if USE_AUDIO and AUDIO_LIB == "irrklang" then
links { "IrrKlang" } links { "IrrKlang" }
linkoptions{ IRRKLANG_LINK_RPATH } linkoptions{ IRRKLANG_LINK_RPATH }
......
...@@ -138,6 +138,8 @@ bool Replay::OpenReplay(const wchar_t* name) { ...@@ -138,6 +138,8 @@ bool Replay::OpenReplay(const wchar_t* name) {
Reset(); Reset();
return false; return false;
} }
info_offset = data_position;
data_position = 0;
return true; return true;
} }
bool Replay::CheckReplay(const wchar_t* name) { bool Replay::CheckReplay(const wchar_t* name) {
...@@ -218,11 +220,15 @@ void Replay::Reset() { ...@@ -218,11 +220,15 @@ void Replay::Reset() {
replay_size = 0; replay_size = 0;
comp_size = 0; comp_size = 0;
data_position = 0; data_position = 0;
info_offset = 0;
players.clear(); players.clear();
params = { 0 }; params = { 0 };
decks.clear(); decks.clear();
script_name.clear(); script_name.clear();
} }
void Replay::SkipInfo(){
data_position += info_offset;
}
bool Replay::ReadInfo() { bool Replay::ReadInfo() {
int player_count = (pheader.flag & REPLAY_TAG) ? 4 : 2; int player_count = (pheader.flag & REPLAY_TAG) ? 4 : 2;
for (int i = 0; i < player_count; ++i) { for (int i = 0; i < player_count; ++i) {
...@@ -245,11 +251,15 @@ bool Replay::ReadInfo() { ...@@ -245,11 +251,15 @@ bool Replay::ReadInfo() {
if (!ReadData(filename, slen)) if (!ReadData(filename, slen))
return false; return false;
filename[slen] = 0; filename[slen] = 0;
script_name = filename; if (std::strncmp(filename, "./single/", 9))
return false;
script_name = filename + 9;
if (script_name.find_first_of(R"(/\)") != std::string::npos)
return false;
} }
else { else {
for (int p = 0; p < player_count; ++p) { for (int p = 0; p < player_count; ++p) {
ReplayDeck deck; DeckArray deck;
uint32_t main = Read<uint32_t>(); uint32_t main = Read<uint32_t>();
if (main > MAINC_MAX) if (main > MAINC_MAX)
return false; return false;
......
...@@ -80,6 +80,7 @@ public: ...@@ -80,6 +80,7 @@ public:
int32_t ReadInt32(); int32_t ReadInt32();
void Rewind(); void Rewind();
void Reset(); void Reset();
void SkipInfo();
FILE* fp{ nullptr }; FILE* fp{ nullptr };
#ifdef _WIN32 #ifdef _WIN32
...@@ -93,7 +94,7 @@ public: ...@@ -93,7 +94,7 @@ public:
std::vector<std::wstring> players; // 80 or 160 bytes std::vector<std::wstring> players; // 80 or 160 bytes
DuelParameters params; // 16 bytes DuelParameters params; // 16 bytes
std::vector<ReplayDeck> decks; // 4 bytes, main deck, 4 bytes, extra deck std::vector<DeckArray> decks; // 4 bytes, main deck, 4 bytes, extra deck
std::string script_name; // 2 bytes, script name (max: 256 bytes) std::string script_name; // 2 bytes, script name (max: 256 bytes)
private: private:
...@@ -102,6 +103,7 @@ private: ...@@ -102,6 +103,7 @@ private:
unsigned char* replay_data; unsigned char* replay_data;
size_t replay_size{}; size_t replay_size{};
size_t data_position{}; size_t data_position{};
size_t info_offset{};
bool is_recording{}; bool is_recording{};
bool is_replaying{}; bool is_replaying{};
bool can_read{}; bool can_read{};
......
...@@ -158,7 +158,8 @@ bool ReplayMode::StartDuel() { ...@@ -158,7 +158,8 @@ bool ReplayMode::StartDuel() {
const ReplayHeader& rh = cur_replay.pheader; const ReplayHeader& rh = cur_replay.pheader;
unsigned int seed = rh.seed; unsigned int seed = rh.seed;
std::mt19937 rnd(seed); std::mt19937 rnd(seed);
if(mainGame->dInfo.isTag) { cur_replay.SkipInfo();
if(rh.flag & REPLAY_TAG) {
BufferIO::CopyWideString(cur_replay.players[0].c_str(), mainGame->dInfo.hostname); BufferIO::CopyWideString(cur_replay.players[0].c_str(), mainGame->dInfo.hostname);
BufferIO::CopyWideString(cur_replay.players[1].c_str(), mainGame->dInfo.hostname_tag); BufferIO::CopyWideString(cur_replay.players[1].c_str(), mainGame->dInfo.hostname_tag);
BufferIO::CopyWideString(cur_replay.players[2].c_str(), mainGame->dInfo.clientname_tag); BufferIO::CopyWideString(cur_replay.players[2].c_str(), mainGame->dInfo.clientname_tag);
...@@ -207,7 +208,9 @@ bool ReplayMode::StartDuel() { ...@@ -207,7 +208,9 @@ bool ReplayMode::StartDuel() {
new_tag_card(pduel, code, 1, LOCATION_EXTRA); new_tag_card(pduel, code, 1, LOCATION_EXTRA);
} }
} else { } else {
if(!preload_script(pduel, cur_replay.script_name.c_str())) { char filename[256]{};
std::snprintf(filename, sizeof filename, "./single/%s", cur_replay.script_name.c_str());
if(!preload_script(pduel, filename)) {
return false; return false;
} }
} }
...@@ -821,12 +824,12 @@ bool ReplayMode::ReplayAnalyze(unsigned char* msg, unsigned int len) { ...@@ -821,12 +824,12 @@ bool ReplayMode::ReplayAnalyze(unsigned char* msg, unsigned int len) {
break; break;
} }
case MSG_AI_NAME: { case MSG_AI_NAME: {
int len = BufferIO::ReadInt16(pbuf); int len = buffer_read<uint16_t>(pbuf);
pbuf += len + 1; pbuf += len + 1;
break; break;
} }
case MSG_SHOW_HINT: { case MSG_SHOW_HINT: {
int len = BufferIO::ReadInt16(pbuf); int len = buffer_read<uint16_t>(pbuf);
pbuf += len + 1; pbuf += len + 1;
break; break;
} }
......
...@@ -749,21 +749,25 @@ bool SingleMode::SinglePlayAnalyze(unsigned char* msg, unsigned int len) { ...@@ -749,21 +749,25 @@ bool SingleMode::SinglePlayAnalyze(unsigned char* msg, unsigned int len) {
case MSG_AI_NAME: { case MSG_AI_NAME: {
char namebuf[128]{}; char namebuf[128]{};
wchar_t wname[20]{}; wchar_t wname[20]{};
int len = BufferIO::ReadInt16(pbuf); int name_len = buffer_read<uint16_t>(pbuf);
auto begin = pbuf; if (name_len + 1 <= (int)sizeof namebuf) {
pbuf += len + 1; std::memcpy(namebuf, pbuf, name_len);
std::memcpy(namebuf, begin, len + 1); namebuf[name_len] = 0;
}
pbuf += name_len + 1;
BufferIO::DecodeUTF8(namebuf, wname); BufferIO::DecodeUTF8(namebuf, wname);
BufferIO::CopyCharArray(wname, mainGame->dInfo.clientname); BufferIO::CopyCharArray(wname, mainGame->dInfo.clientname);
break; break;
} }
case MSG_SHOW_HINT: { case MSG_SHOW_HINT: {
char msgbuf[1024]; char msgbuf[1024]{};
wchar_t msg[1024]; wchar_t msg[1024]{};
int len = BufferIO::ReadInt16(pbuf); int msg_len = buffer_read<uint16_t>(pbuf);
auto begin = pbuf; if (msg_len + 1 <= (int)sizeof msgbuf) {
pbuf += len + 1; std::memcpy(msgbuf, pbuf, msg_len);
std::memcpy(msgbuf, begin, len + 1); msgbuf[msg_len] = 0;
}
pbuf += msg_len + 1;
BufferIO::DecodeUTF8(msgbuf, msg); BufferIO::DecodeUTF8(msgbuf, msg);
mainGame->gMutex.lock(); mainGame->gMutex.lock();
mainGame->SetStaticText(mainGame->stMessage, 310, mainGame->guiFont, msg); mainGame->SetStaticText(mainGame->stMessage, 310, mainGame->guiFont, msg);
......
...@@ -16,6 +16,7 @@ project "irrlicht" ...@@ -16,6 +16,7 @@ project "irrlicht"
"_IRR_STATIC_LIB_", "_IRR_STATIC_LIB_",
"NO_IRR_USE_NON_SYSTEM_BZLIB_", "NO_IRR_USE_NON_SYSTEM_BZLIB_",
"NO_IRR_COMPILE_WITH_BZIP2_", "NO_IRR_COMPILE_WITH_BZIP2_",
"NO_IRR_COMPILE_WITH_LZMA_",
"NO_IRR_COMPILE_WITH_CONSOLE_DEVICE_", "NO_IRR_COMPILE_WITH_CONSOLE_DEVICE_",
"NO_IRR_COMPILE_WITH_DIRECT3D_8_", "NO_IRR_COMPILE_WITH_DIRECT3D_8_",
"NO_IRR_COMPILE_WITH_DIRECTINPUT_JOYSTICK_", "NO_IRR_COMPILE_WITH_DIRECTINPUT_JOYSTICK_",
...@@ -62,13 +63,13 @@ project "irrlicht" ...@@ -62,13 +63,13 @@ project "irrlicht"
"NO__IRR_COMPILE_WITH_WAD_ARCHIVE_LOADER_", "NO__IRR_COMPILE_WITH_WAD_ARCHIVE_LOADER_",
"NO_IRR_COMPILE_WITH_ZIP_ENCRYPTION_", "NO_IRR_COMPILE_WITH_ZIP_ENCRYPTION_",
"PNG_INTEL_SSE", "PNG_INTEL_SSE",
"PNG_ARM_NEON_OPT=0",
"PNG_ARM_NEON_IMPLEMENTATION=0",
} }
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",
...@@ -161,7 +162,7 @@ project "irrlicht" ...@@ -161,7 +162,7 @@ project "irrlicht"
filter { "system:macosx" } filter { "system:macosx" }
cppdialect "gnu++14" cppdialect "gnu++14"
defines { "GL_SILENCE_DEPRECATION", "PNG_ARM_NEON_OPT=0", "PNG_ARM_NEON_IMPLEMENTATION=0" } defines { "GL_SILENCE_DEPRECATION" }
undefines { "NO_IRR_COMPILE_WITH_JOYSTICK_EVENTS_" } undefines { "NO_IRR_COMPILE_WITH_JOYSTICK_EVENTS_" }
files { files {
"source/Irrlicht/MacOSX/*.mm", "source/Irrlicht/MacOSX/*.mm",
......
...@@ -118,12 +118,12 @@ project "miniaudio" ...@@ -118,12 +118,12 @@ project "miniaudio"
"external/vorbis/include", "external/vorbis/include",
} }
defines { defines {
"OPUS_BUILD", "USE_ALLOCA", "OPUS_BUILD", "USE_ALLOCA", "HAVE_LRINTF", "OP_HAVE_LRINTF",
"OPUS_X86_PRESUME_SSE", "OPUS_X86_PRESUME_SSE2", "OPUS_X86_PRESUME_SSE", "OPUS_X86_PRESUME_SSE2",
"OPUS_HAVE_RTCD", "OPUS_X86_MAY_HAVE_SSE", "OPUS_X86_MAY_HAVE_SSE4_1", "OPUS_X86_MAY_HAVE_AVX2", "OPUS_HAVE_RTCD", "OPUS_X86_MAY_HAVE_SSE", "OPUS_X86_MAY_HAVE_SSE4_1", "OPUS_X86_MAY_HAVE_AVX2",
} }
else else
includedirs { OPUS_INCLUDE_DIR, VORBIS_INCLUDE_DIR, OGG_INCLUDE_DIR } includedirs { OPUS_INCLUDE_DIR, OPUSFILE_INCLUDE_DIR, VORBIS_INCLUDE_DIR, OGG_INCLUDE_DIR }
end end
end end
......
...@@ -46,14 +46,14 @@ newoption { trigger = "irrlicht-lib-dir", category = "YGOPro - irrlicht", descri ...@@ -46,14 +46,14 @@ newoption { trigger = "irrlicht-lib-dir", category = "YGOPro - irrlicht", descri
newoption { trigger = "no-audio", category = "YGOPro", description = "" } newoption { trigger = "no-audio", category = "YGOPro", description = "" }
newoption { trigger = "audio-lib", category = "YGOPro", description = "", value = "miniaudio, irrklang", default = AUDIO_LIB } newoption { trigger = "audio-lib", category = "YGOPro", description = "", value = "miniaudio, irrklang", default = AUDIO_LIB }
newoption { trigger = "miniaudio-include-dir", category = "YGOPro - miniaudio", description = "", value = "PATH" }
newoption { trigger = "miniaudio-lib-dir", category = "YGOPro - miniaudio", description = "", value = "PATH" }
newoption { trigger = "miniaudio-support-opus-vorbis", category = "YGOPro - miniaudio", description = "" } newoption { trigger = "miniaudio-support-opus-vorbis", category = "YGOPro - miniaudio", description = "" }
newoption { trigger = "no-miniaudio-support-opus-vorbis", category = "YGOPro - miniaudio", description = "" } newoption { trigger = "no-miniaudio-support-opus-vorbis", category = "YGOPro - miniaudio", description = "" }
newoption { trigger = "build-opus-vorbis", category = "YGOPro - miniaudio", description = "" } newoption { trigger = "build-opus-vorbis", category = "YGOPro - miniaudio", description = "" }
newoption { trigger = "no-build-opus-vorbis", category = "YGOPro - miniaudio", description = "" } newoption { trigger = "no-build-opus-vorbis", category = "YGOPro - miniaudio", description = "" }
newoption { trigger = "opus-include-dir", category = "YGOPro - miniaudio", description = "", value = "PATH" } newoption { trigger = "opus-include-dir", category = "YGOPro - miniaudio", description = "", value = "PATH" }
newoption { trigger = "opus-lib-dir", category = "YGOPro - miniaudio", description = "", value = "PATH" } newoption { trigger = "opus-lib-dir", category = "YGOPro - miniaudio", description = "", value = "PATH" }
newoption { trigger = "opusfile-include-dir", category = "YGOPro - miniaudio", description = "", value = "PATH" }
newoption { trigger = "opusfile-lib-dir", category = "YGOPro - miniaudio", description = "", value = "PATH" }
newoption { trigger = "vorbis-include-dir", category = "YGOPro - miniaudio", description = "", value = "PATH" } newoption { trigger = "vorbis-include-dir", category = "YGOPro - miniaudio", description = "", value = "PATH" }
newoption { trigger = "vorbis-lib-dir", category = "YGOPro - miniaudio", description = "", value = "PATH" } newoption { trigger = "vorbis-lib-dir", category = "YGOPro - miniaudio", description = "", value = "PATH" }
newoption { trigger = "ogg-include-dir", category = "YGOPro - miniaudio", description = "", value = "PATH" } newoption { trigger = "ogg-include-dir", category = "YGOPro - miniaudio", description = "", value = "PATH" }
...@@ -86,7 +86,7 @@ if not BUILD_LUA then ...@@ -86,7 +86,7 @@ if not BUILD_LUA then
-- at most times you need to change this if you change BUILD_LUA to false -- at most times you need to change this if you change BUILD_LUA to false
-- make sure your lua lib is built with C++ and version >= 5.3 -- make sure your lua lib is built with C++ and version >= 5.3
LUA_LIB_NAME = GetParam("lua-lib-name") LUA_LIB_NAME = GetParam("lua-lib-name")
LUA_INCLUDE_DIR = GetParam("lua-include-dir") or os.findheader(LUA_LIB_NAME) LUA_INCLUDE_DIR = GetParam("lua-include-dir") or os.findheader("lua.h")
LUA_LIB_DIR = GetParam("lua-lib-dir") or os.findlib(LUA_LIB_NAME) LUA_LIB_DIR = GetParam("lua-lib-dir") or os.findlib(LUA_LIB_NAME)
end end
...@@ -96,7 +96,7 @@ elseif GetParam("no-build-event") then ...@@ -96,7 +96,7 @@ elseif GetParam("no-build-event") then
BUILD_EVENT = false BUILD_EVENT = false
end end
if not BUILD_EVENT then if not BUILD_EVENT then
EVENT_INCLUDE_DIR = GetParam("event-include-dir") or os.findheader("event") EVENT_INCLUDE_DIR = GetParam("event-include-dir") or os.findheader("event2/event.h")
EVENT_LIB_DIR = GetParam("event-lib-dir") or os.findlib("event") EVENT_LIB_DIR = GetParam("event-lib-dir") or os.findlib("event")
end end
...@@ -106,7 +106,7 @@ elseif GetParam("no-build-freetype") then ...@@ -106,7 +106,7 @@ elseif GetParam("no-build-freetype") then
BUILD_FREETYPE = false BUILD_FREETYPE = false
end end
if not BUILD_FREETYPE then if not BUILD_FREETYPE then
FREETYPE_INCLUDE_DIR = GetParam("freetype-include-dir") or os.findheader("freetype") FREETYPE_INCLUDE_DIR = GetParam("freetype-include-dir") or os.findheader("freetype2/ft2build.h") .. "/freetype2"
FREETYPE_LIB_DIR = GetParam("freetype-lib-dir") or os.findlib("freetype") FREETYPE_LIB_DIR = GetParam("freetype-lib-dir") or os.findlib("freetype")
end end
...@@ -116,7 +116,7 @@ elseif GetParam("no-build-sqlite") then ...@@ -116,7 +116,7 @@ elseif GetParam("no-build-sqlite") then
BUILD_SQLITE = false BUILD_SQLITE = false
end end
if not BUILD_SQLITE then if not BUILD_SQLITE then
SQLITE_INCLUDE_DIR = GetParam("sqlite-include-dir") or os.findheader("sqlite3") SQLITE_INCLUDE_DIR = GetParam("sqlite-include-dir") or os.findheader("sqlite3.h")
SQLITE_LIB_DIR = GetParam("sqlite-lib-dir") or os.findlib("sqlite3") SQLITE_LIB_DIR = GetParam("sqlite-lib-dir") or os.findlib("sqlite3")
end end
...@@ -126,7 +126,7 @@ elseif GetParam("no-build-irrlicht") then ...@@ -126,7 +126,7 @@ elseif GetParam("no-build-irrlicht") then
BUILD_IRRLICHT = false BUILD_IRRLICHT = false
end end
if not BUILD_IRRLICHT then if not BUILD_IRRLICHT then
IRRLICHT_INCLUDE_DIR = GetParam("irrlicht-include-dir") or os.findheader("irrlicht") IRRLICHT_INCLUDE_DIR = GetParam("irrlicht-include-dir") or os.findheader("irrlicht.h")
IRRLICHT_LIB_DIR = GetParam("irrlicht-lib-dir") or os.findlib("irrlicht") IRRLICHT_LIB_DIR = GetParam("irrlicht-lib-dir") or os.findlib("irrlicht")
end end
...@@ -163,12 +163,14 @@ if USE_AUDIO then ...@@ -163,12 +163,14 @@ if USE_AUDIO then
MINIAUDIO_BUILD_OPUS_VORBIS = true MINIAUDIO_BUILD_OPUS_VORBIS = true
end end
if not MINIAUDIO_BUILD_OPUS_VORBIS then if not MINIAUDIO_BUILD_OPUS_VORBIS then
OPUS_INCLUDE_DIR = GetParam("opus-include-dir") or os.findheader("opus") OPUS_INCLUDE_DIR = GetParam("opus-include-dir") or os.findheader("opus/opus.h") .. "/opus"
OPUS_LIB_DIR = GetParam("opus-lib-dir") or os.findlib("opusfile") OPUS_LIB_DIR = GetParam("opus-lib-dir") or os.findlib("opus")
VORBIS_INCLUDE_DIR = GetParam("vorbis-include-dir") or os.findheader("vorbis") OPUSFILE_INCLUDE_DIR = GetParam("opusfile-include-dir") or os.findheader("opus/opusfile.h") .. "/opus"
OPUSFILE_LIB_DIR = GetParam("opusfile-lib-dir") or os.findlib("opusfile")
VORBIS_INCLUDE_DIR = GetParam("vorbis-include-dir") or os.findheader("vorbis/vorbisfile.h")
VORBIS_LIB_DIR = GetParam("vorbis-lib-dir") or os.findlib("vorbis") VORBIS_LIB_DIR = GetParam("vorbis-lib-dir") or os.findlib("vorbis")
OGG_INCLUDE_DIR = GetParam("ogg-include-dir") or os.findheader("ogg") OGG_INCLUDE_DIR = GetParam("ogg-include-dir") or os.findheader("ogg/ogg.h")
OCG_LIB_DIR = GetParam("ogg-lib-dir") or os.findlib("ogg") OGG_LIB_DIR = GetParam("ogg-lib-dir") or os.findlib("ogg")
end end
end end
elseif AUDIO_LIB == "irrklang" then elseif AUDIO_LIB == "irrklang" then
......
...@@ -663,6 +663,7 @@ ...@@ -663,6 +663,7 @@
!counter 0x106b 狂爱指示物 !counter 0x106b 狂爱指示物
!counter 0x6c 访问指示物 !counter 0x6c 访问指示物
!counter 0x6d 祝台指示物 !counter 0x6d 祝台指示物
!counter 0x6e 四季指示物
#setnames, using tab for comment #setnames, using tab for comment
!setname 0x1 正义盟军 AOJ !setname 0x1 正义盟军 AOJ
!setname 0x2 次世代 ジェネクス !setname 0x2 次世代 ジェネクス
...@@ -1245,7 +1246,7 @@ ...@@ -1245,7 +1246,7 @@
!setname 0x1c0 龙华 竜華 !setname 0x1c0 龙华 竜華
!setname 0x1c1 阿尔戈☆群星 ARGS !setname 0x1c1 阿尔戈☆群星 ARGS
!setname 0x1c2 喷水引擎 アクア・ジェット !setname 0x1c2 喷水引擎 アクア・ジェット
!setname 0x1c3 Mitsurugi !setname 0x1c3 Mitsurugi
!setname 0x1c4 征龙 征竜 !setname 0x1c4 征龙 征竜
!setname 0x1c5 再世 再世 !setname 0x1c5 再世 再世
!setname 0x1c6 统王 ドミナス !setname 0x1c6 统王 ドミナス
...@@ -1254,3 +1255,6 @@ ...@@ -1254,3 +1255,6 @@
!setname 0x1c9 星辰 ドラゴンテイル !setname 0x1c9 星辰 ドラゴンテイル
!setname 0x1ca 味美喵 ヤミー !setname 0x1ca 味美喵 ヤミー
!setname 0x1cb K9 !setname 0x1cb K9
!setname 0x1cc 瞬间移动 テレポート
!setname 0x1cd 神艺 アルトメギア
!setname 0x1ce 狱神 獄神
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