Building on Windows - Fluorohydride/ygopro GitHub Wiki

YGOPro Windows Compilation Guide

1. Preparation

1.1 Required Software

  • YGOPro distribution

    • Used to obtain card database and card images, the database is essential
  • Visual Studio

    • Supports Visual Studio 2015 and higher versions
    • When installing, please check the Desktop development with C++ component
  • DirectX SDK

  • Git for Windows

  • Premake

    • The project supports both Premake and CMake build systems, but CMake has not been maintained recently, so Premake is recommended

1.2 Dependencies

Currently, there is no well-established automated solution for installing dependencies on Windows platform. It is recommended to manually download the source code of each library and compile them statically.

  • libevent

    • Only version 2.0.22 has been thoroughly tested, newer versions may be compatible but have not been verified
  • FreeType

  • Irrlicht

    • This is a modified version of Irrlicht with added Chinese support and other features
    • The original Irrlicht is not supported
  • Lua

    • Only versions 5.3.x and 5.4.x are supported
  • miniaudio

    • Only version 0.11.22 is supported, and you need to use the miniaudio_split version from it
  • SQLite

    • Only the amalgamation version is supported

2. Getting the Source Code

2.1 Clone the Repository

Use Git to clone the repository, making sure to include all submodules:

# Complete clone of code and submodules (recommended)
git clone --recursive https://github.com/Fluorohydride/ygopro.git
cd ygopro

# Or step by step
git clone https://github.com/Fluorohydride/ygopro.git
cd ygopro
git submodule update --init

# Switch submodules to the correct branch
cd ocgcore
git checkout master 
cd ..
cd script
git checkout master 
cd ..

2.2 Install Dependencies

Extract all downloaded dependency libraries to the project root directory and rename them according to the following rules:

  • libevent → Rename to event
  • Freetype → Rename to freetype
  • Irrlicht → Rename to irrlicht
  • Lua → Rename to lua
  • miniaudio → Rename to miniaudio
    • Copy the c and h files from miniaudio/extras/miniaudio_split to the miniaudio folder to replace the original files
  • SQLite → Rename to sqlite3 (note that there is a 3 at the end of the name)

2.3 Copy Description Files

  • Copy all subfolders in the premake folder to the project root directory
    • These folders contain the premake description files needed to compile each dependency library
  • Copy all subfolders in the resource folder to the project root directory

3. Generate Project and Compile

3.1 Generate Project Files

Install premake5.exe and add it to the PATH environment variable, or place it directly in the project root directory, then run:

premake5 vs2022 --no-miniaudio-support-opus-vorbis

This will generate a Visual Studio solution file (YGOPro.sln) in the build folder.

3.2 Directory Structure

After successful configuration, the project directory structure should look like this (some files omitted):

├─build
├─event
│  └─include
├─freetype
│  ├─include
│  └─src
├─gframe
├─irrlicht
│  ├─include
│  └─source
│      └─Irrlicht
├─lua
│  └─src
├─miniaudio
├─ocgcore
├─script
├─sound
├─sqlite3
└─textures

3.3 Compile the Project

Open YGOPro.sln in Visual Studio, select Release or Debug mode, then build the solution.

After compilation, the generated executable will be located in the bin/release or bin/debug directory.

4. Running and Debugging

4.1 Basic Running

  1. Copy the following files from the YGOPro distribution to the project root directory:

    • cards.cdb
    • pics folder
    • deck folder
  2. Copy the compiled YGOPro.exe to the project root directory

  3. Run YGOPro.exe

4.2 Debug with Visual Studio

In Visual Studio, you can set the working directory to your YGOPro directory for direct debugging.

5. Advanced Features

5.1 Support for OGG Format Audio

Install the following 4 additional libraries:

Place these libraries in the miniaudio/external folder and rename them to ogg, opus, opusfile, vorbis respectively.

Then run premake5 without the --no-miniaudio-support-opus-vorbis parameter.

5.2 Support for Windows XP

When generating project files with premake5, add the --winxp-support parameter.

Note: You need to use Visual Studio 2019 or earlier versions, and install the XP support component for v141. Although Visual Studio 2022 can install the XP support for v141 and compile, it will report errors when running and cannot be used.

6. Common Issues

See FAQ for Building