Skip to content

Building on Windows

christar edited this page Oct 4, 2022 · 2 revisions

Preparation

Download

  • YGOPro distribution

    It is used to obtain cards database and pictures, in which database is necessary

  • Visual Studio

    VS2015 and above versions can be used theoretically. During installation, select Desktop development with C++

  • DirectX SDK

  • git for windows

    And have GitHub account and SSH key

  • premake5

    There are two kinds of project description files, premake and cmake, but cmake has not been maintained recently

Dependency Libraries

At present, there is no mature solution for the installation of dependency library on windows, so it is recommended to download source code manually and compile statically

  • libevent-2.0.22

    Only this version has been tested, and the new version may work

  • FreeType-2.11.1

    Only this version has been tested. It is not recommended to use the new version for the time being

  • Irrlicht-1.8.5

    Only this version has been tested and needs to be patched with Chinese support

  • Lua-5.4

    Versions 5.2 and earlier are not supported

  • SQLite3

  • irrKlang

    Non open source, download the 32-bit version, can be disabled by changing USE_IRRKLANG in premake5.lua, the result is no sound

Download repo

Just use git clone, and add --recursive to clone sub modules at the same time, or run git submodule update --init after completion

After cloning is finished, enter the ocgcore and script sub-module dirs and checkout to master branch.

Commands:

git clone git@github.com:Fluorohydride/ygopro.git
cd ygopro
git submodule update --init
cd ocgcore/
git checkout master 
cd ..
cd script/
git checkout master 
cd ..

Install Dependency Libraries

  • Unzip the downloaded libevent to the project folder and rename it to event

  • Unzip the downloaded freetype to the project folder and rename it to freetype

  • Unzip the downloaded irrlicht to the project folder and rename it to irrlicht

  • Unzip the downloaded irrKlang to the project folder and rename it to irrKlang

  • Unzip the downloaded lua to the project folder and rename it to lua

  • Unzip the downloaded sqlite3 to the project folder and rename it to sqlite3 (There is a "3")

  • Copy all folders in the premake folder to the project folder, which contains the premake description files of each dependent library, which can be modified and improved by yourself

Patch Irrlicht

The original version of Irrlicht does not support Chinese copy and paste, does not support input method, and needs to be patched. Enter the Irrlicht folder and run

patch -p1 < irrlicht.patch

You can also use the modified version directly

Generate project files and compile

Install premake5.exe and add it to PATH, or put it directly into the project folder and run

premake5 vs2022

Then you can use VS to open the YGOPro.sln file in the build folder and compile

At this time, the directory structure should look like this after omitting redundant files:

├─bin
├─build
├─cmake
├─event
│  └─include
├─freetype
│  ├─include
│  └─src
├─gframe
├─irrKlang
│  ├─bin
│  ├─include
│  └─lib
├─irrlicht
│  ├─include
│  └─source
│      └─Irrlicht
├─lua
│  └─src
├─ocgcore
├─premake
├─script
├─sound
├─sqlite3
└─textures

Run and Debug

Copy cards.cdb and the pics folder, the deck folder and the replay folder from the distribution to the project root directory

Copy the 3 DLL of irrklang from irrklang\bin\win32-visualStudio to the project root directory

Then copy ygopro.exe generated in bin\release or bin\debug to the project root directory to run

You can also specify the working directory in VS as the YGOPro directory you are using for direct debugging

Using irrKlang pro

Irrklang is a commercial software, but all its features are free, but the free version must be released with DLL and cannot be statically compiled, so it is not necessary to use its pro version

If you must use pro version, after purchase, you can compile ikpMP3 in plugins together. The specific process is omitted

But in VS debugging, you need to use the free version of lib, and the pro version of lib does not support debugging