1# Play! # 2Play! is a PlayStation 2 emulator for Windows, macOS, UNIX, Android & iOS platforms. 3 4Compatibility information is available on the official [Compatibility Tracker](https://github.com/jpd002/Play-Compatibility). 5If a specific game doesn't work with the emulator, please create a new issue there. 6 7For more information, please visit [purei.org](https://purei.org). 8 9## Building ## 10 11### Getting Started ### 12First you'll need to clone this repo which contains the emulator source code, alongside the submodules required to build Play!: 13 ``` 14 git clone --recurse-submodules https://github.com/jpd002/Play-.git 15 cd Play- 16 ``` 17 18### Building for Windows ### 19The easiest way to build the project on Windows is to open Qt Creator and direct it to the Cmake file in `/project/dir/Play-/CMakeLists.txt`. 20You can also build the project using Visual Studio or cmdline, for that you must follow these instructions: 21 22To build for Windows you will need to have CMake installed on your system. 23 ```cmd 24 mkdir build 25 cd build 26 ``` 27 ``` 28 # Not specifying -G will automatically generate 32-bit projects. 29 cmake .. -G "Visual Studio 15 2017 Win64" -DCMAKE_PREFIX_PATH="C:\Qt\5.10.1\msvc2017_64" -DUSE_QT=YES 30 ``` 31You can now build the project by opening the generated Visual Studio Solution or continue through cmdline: 32 ```cmd 33 cmake --build . --config Release 34 ``` 35Note: `--config` can be `Release`, `Debug`, or `RelWithDebInfo`. 36 37### Building for macOS & iOS ### 38If you don't have CMake installed, you can install it using [Homebrew](https://brew.sh) with the following command: 39 ```bash 40 brew install cmake 41 ``` 42 43There are two ways to generate a build for macOS. Either by using Makefiles, or Xcode: 44 ```bash 45 mkdir build 46 cd build 47 ``` 48 ``` 49 # Not specifying -G will automatically pick Makefiles 50 cmake .. -G Xcode -DCMAKE_BUILD_TYPE=Release -DCMAKE_PREFIX_PATH=~/Qt/5.1.0/clang_64/ 51 cmake --build . --config Release 52 # OR 53 cmake .. -G "Unix Makefiles" -DCMAKE_BUILD_TYPE=Release -DCMAKE_PREFIX_PATH=~/Qt/5.1.0/clang_64/ 54 cmake --build . 55 ``` 56To generate a build for iOS, you will need to add the following parameters to the CMake invocation: 57 ```bash 58 -DCMAKE_TOOLCHAIN_FILE=../../../Dependencies/cmake-ios/ios.cmake -DTARGET_IOS=ON 59 ``` 60 61iOS build doesn't use Qt, so omit `-DCMAKE_PREFIX_PATH=...` 62 63Example: 64 ```bash 65 cmake .. -G Xcode -DCMAKE_TOOLCHAIN_FILE=../deps/Dependencies/cmake-ios/ios.cmake -DTARGET_IOS=ON 66 ``` 67 68Note: iOS builds generated with Makefiles will not be FAT binaries. 69 70### Building for UNIX ### 71if you don't have Cmake or OpenAL lib installed, you'll also require Qt. (preferably version 5.6) 72You can install it using your OS packaging tool, e.g Ubuntu: `apt install cmake libalut-dev qt5-default libevdev-dev libqt5x11extras5-dev libsqlite3-dev` 73 74On UNIX systems there are 3 ways to setup a build. Using Qt creator, makefile or Ninja: 75 - QT Creator 76 - Open Project -> `Play/CMakeLists.txt` 77 78 - Makefile/Ninja: 79 ```bash 80 mkdir build 81 cd build 82 ``` 83 ``` 84 # Not specifying -G will automatically pick Makefiles 85 cmake .. -G "Unix Makefiles" -DCMAKE_BUILD_TYPE=Release -DCMAKE_PREFIX_PATH=/opt/qt56/ 86 cmake --build . 87 # OR 88 cmake .. -G Ninja -DCMAKE_PREFIX_PATH=/opt/qt56/ 89 cmake --build . --config Release 90 ``` 91The above example uses a backport repo to install Qt5.6 on Ubuntu Trusty. 92 93Note: `CMAKE_PREFIX_PATH` refers to the Qt directory containing bin/libs folder. If you install Qt from their official website, your `CMAKE_PREFIX_PATH` might look like this: `~/Qt5.6.0/5.6/gcc_64/` 94 95### Building for Android ### 96Building for Android has been tested on macOS and UNIX environments. 97 98Android can be built using Android Studio, or Gradle: 99 - Android Studio: 100 - Files-> Open Projects-> Directory To `Play/build_android` 101 - Install NDK using SDK manager 102 - Edit/create `Play/build_android/local.properties` 103 - OSX: Add a new line: `ndk.dir=/Users/USER_NAME/Library/Android/sdk/ndk-bundle` replacing `USER_NAME` with your macOS username 104 - UNIX: Add a new line: `ndk.dir=~/Android/Sdk/ndk-bundle` 105 - Windows: Add a new line: `C:\Users\USER_NAME\AppData\Local\Android\sdk\ndk-bundle` 106 - Please leave an empty new line at the end of the file. 107 108Note: These examples are only valid if you installed NDK through Android Studio's SDK manager. 109Otherwise, you must specify the correct location to the Android NDK. 110 111Once this is done, you can start the build: 112 - Gradle: Prerequisite Android SDK & NDK (Both can be installed through Android Studio) 113 - edit/create `Play/build_android/local.properties` 114 - OSX: 115 - Add a new line: `sdk.dir=/Users/USER_NAME/Library/Android/sdk` replacing `USER_NAME` with your macOS username 116 - Add a new line: `ndk.dir=/Users/USER_NAME/Library/Android/sdk/ndk-bundle` replacing `USER_NAME` with your macOS username 117 - UNIX: 118 - Add a new line: `sdk.dir=~/Android/Sdk` 119 - Add a new line: `ndk.dir=~/Android/Sdk/ndk-bundle` 120 - Windows: 121 - Add a new line: `sdk.dir=C:\Users\USER_NAME\AppData\Local\Android\sdk` 122 - Add a new line: `ndk.dir=C:\Users\USER_NAME\AppData\Local\Android\sdk\ndk-bundle` 123 - Please leave an empty new line at the end of the file. 124 125Note: These examples are only valid if you installed NDK through Android Studio's SDK manager. 126Otherwise you must specify the correct location to Android NDK. 127Once this is done, you can start the build: 128 ```bash 129 cd Play/build_android 130 sh gradlew assembleDebug 131 ``` 132 133##### About Release/Signed builds ##### 134Building through Android Studio, you have the option to “Generate Signed APK”. 135 136When building through Gradle, you must create a text file called `Play/build_android/keystore.properties` and add the following properties to it: `storeFile`, `storePassword`, `keyAlias`, and `keyPassword`. 137 138E.g for `keystore.properties`: 139 ``` 140 storeFile=/location/to/my/key.jks 141 storePassword=mysuperhardpassword 142 keyAlias=myalias 143 keyPassword=myevenharderpassword 144 ``` 145Please leave an empty new line at the end of the file. 146 ``` 147 cd Play/build_android 148 sh gradlew assembleRelease 149 # or on Windows 150 gradlew.bat assembleRelease 151 ``` 152