2024-02-16 17:55:50 +08:00
## :large_orange_diamond: **This is a fork**
Fork of https://gitlab.com/Mr_Goldberg/goldberg_emulator
2019-04-14 00:21:56 +08:00
2024-07-23 17:16:57 +08:00
Fork originally make by wizark952.
This is a latest version of his work.
### Feel free to make a PR.
2023-12-28 03:46:11 +08:00
---
2024-02-16 17:55:50 +08:00
:red_circle:
2024-05-10 04:36:42 +08:00
**This fork is not a takeover, not a resurrection of the original project, and not a replacement.**
**This is just a fork, don't take it seriously.**
2024-02-24 16:18:00 +08:00
**You are highly encouraged to fork/clone it and do whatever you want with it.**
2024-02-16 17:55:50 +08:00
:red_circle:
2023-12-28 03:46:11 +08:00
---
2024-06-09 01:51:47 +08:00
## **Compatibility**
This fork is incompatible with the original repo, lots of things has changed and might be even broken.
If something doesn't work, feel free to create a pull request with the appropriate fix, otherwise ignore this fork and use the original emu.
---
2024-05-10 04:36:42 +08:00
## **Credits**
Thanks to everyone contributing to this project in any way possible, we try to keep the [CHANGELOG.md ](./CHANGELOG.md ) updated with all the changes and their authors.
This project depends on many third-party libraries and tools, credits to them for their amazing work, you can find their listing here in [CREDITS.md ](./CREDITS.md ).
---
2024-02-16 17:40:03 +08:00
# How to use the emu
2024-05-10 04:36:42 +08:00
* **Always generate the interfaces file using the `find_interfaces` tool.**
* **Generate the proper app configuration using the `generate_emu_config` tool.**
* **If things don't work, try the `ColdClientLoader` setup.**
2024-02-26 04:48:21 +08:00
2024-08-04 23:25:06 +08:00
You can find helper guides, scripts, and tools here:
2024-08-05 03:12:56 +08:00
**(These guides, scripts, and tools are maintained by their authors.)**
2024-08-04 23:25:06 +08:00
* **[GBE-Autoconfigurator](https://github.com/daci12345/GBE-Autoconfigurator)**
* **[Semuexec](https://gitlab.com/detiam/Semuexec)**
* **[Steam Emu Utility](https://github.com/turusudiro/SteamEmuUtility)**
* **[How to use Goldberg Emulator](https://rentry.co/goldberg_emulator)**
* **[GSE-Generator](https://github.com/brunolee-GIT/GSE-Generator)**
2024-05-10 04:36:42 +08:00
You can also find instructions here in [README.release.md ](./post_build/README.release.md )
2024-01-27 03:31:26 +08:00
2023-12-28 03:46:11 +08:00
---
---
2023-12-28 07:04:18 +08:00
< br / >
2024-02-16 17:55:50 +08:00
# **Compiling**
## One time setup
### **Cloning the repo**
2024-05-01 05:44:23 +08:00
Disable automatic CRLF handling:
*Locally*
```shell
git config --local core.autocrlf false
```
*Or globally/system wide*
```shell
git config --system core.autocrlf false
git config --global core.autocrlf false
```
2024-05-07 00:25:27 +08:00
Clone the repo and its submodules **recursively**
```shell
2024-05-11 03:07:56 +08:00
git clone --recurse-submodules -j8 https://github.com/otavepto/gbe_fork.git
2024-05-07 00:25:27 +08:00
```
2024-05-11 03:07:56 +08:00
The switch `-j8` is optional, it allows Git to fetch up to 8 submodules
2024-05-07 00:25:27 +08:00
It is adviseable to always checkout submodules every now and then, to make sure they're up to date
```shell
2024-06-13 02:47:30 +08:00
git submodule update --init --recursive --remote
2024-05-07 00:25:27 +08:00
```
2024-02-16 17:55:50 +08:00
### For Windows:
2024-05-30 08:29:14 +08:00
* You need Windows 10 or 8.1 + WDK
* Using Visual Studio, install `Visual Studio 2022 Community` : https://visualstudio.microsoft.com/vs/community/
2023-12-28 03:46:11 +08:00
* Select the Workload `Desktop development with C++`
2023-12-30 05:25:10 +08:00
* In the `Individual componenets` scroll to the buttom and select the **latest** version of `Windows XX SDK (XX.X...)`
2024-05-30 08:29:14 +08:00
For example `Windows 11 SDK (10.0.22621.0)`
2024-06-13 02:47:30 +08:00
* Using `MSYS2` **this is currently experimental and will not work due to ABI differences** : https://www.msys2.org/
< details >
< summary > steps< / summary >
* To build 64-bit binaries use either the [environment ](https://www.msys2.org/docs/environments/ ) `UCRT64` or `MINGW64` then install the GCC toolchain
`UCRT64`
```shell
pacman -S mingw-w64-ucrt-x86_64-gcc
```
`MINGW64`
```shell
pacman -S mingw-w64-i686-gcc
```
* To build 32-bit binaries use the environment `MINGW32` then install the GCC toolchain
```shell
pacman -S mingw-w64-i686-gcc
```
< / details >
2023-12-28 03:46:11 +08:00
* Python 3.10 or above: https://www.python.org/downloads/windows/
After installation, make sure it works
2024-03-18 08:20:54 +08:00
```batch
2023-12-28 03:46:11 +08:00
python --version
```
2024-05-30 08:29:14 +08:00
* *(Optional)* Install a GUI for Git like [GitHub Desktop ](https://desktop.github.com/ ), or [Sourcetree ](https://www.sourcetreeapp.com/ )
2024-02-16 17:55:50 +08:00
### For Linux:
2023-12-28 03:46:11 +08:00
* Ubuntu 22.04 LTS: https://ubuntu.com/download/desktop
2024-05-31 17:29:52 +08:00
* Ubuntu required packages:
2024-05-31 19:39:06 +08:00
```shell
sudo apt update -y
sudo apt install -y coreutils # echo, printf, etc...
sudo apt install -y build-essential
sudo apt install -y gcc-multilib # needed for 32-bit builds
sudo apt install -y g++-multilib
sudo apt install -y libglx-dev # needed for overlay build (header files such as GL/glx.h)
sudo apt install -y libgl-dev # needed for overlay build (header files such as GL/gl.h)
```
*(Optional)* Additional packages
```shell
sudo apt install -y clang # clang compiler
sudo apt install -y binutils # contains the tool 'readelf' mainly, and other usefull binary stuff
```
2023-12-28 03:46:11 +08:00
* Python 3.10 or above
2024-03-18 08:20:54 +08:00
```shell
2024-07-13 11:50:28 +08:00
sudo apt update -y
sudo apt install -y software-properties-common
2023-12-28 03:46:11 +08:00
sudo add-apt-repository ppa:deadsnakes/ppa -y
sudo apt update -y
2024-07-13 11:50:28 +08:00
sudo apt install -y "python3.12"
sudo apt install -y "python3.12-dev"
sudo apt install -y "python3.12-venv"
sudo apt install -y python3-dev
2023-12-28 03:46:11 +08:00
# make sure it works
2024-07-13 11:50:28 +08:00
python3.12 --version
2023-12-28 03:46:11 +08:00
```
2024-02-16 17:55:50 +08:00
### **Building dependencies**
2023-12-28 03:46:11 +08:00
These are third party libraries needed to build the emu later, they are linked with the emu during its build process.
You don't need to build these dependencies every time, they rarely get updated.
The only times you'll need to rebuild them is either when their separete build folder was accedentally deleted, or when the dependencies were updated.
< br / >
2024-02-16 17:55:50 +08:00
#### On Windows:
2024-05-30 08:29:14 +08:00
Open CMD in the repo folder, then run the following
* To build using `Visual Studio`
2024-06-13 02:47:30 +08:00
```batch
set "CMAKE_GENERATOR=Visual Studio 17 2022"
third-party\common\win\premake\premake5.exe --file=premake5-deps.lua --64-build --32-build --all-ext --all-build --verbose --os=windows vs2022
2024-05-31 17:05:07 +08:00
```
2024-06-13 02:47:30 +08:00
* To build using `MSYS2` **this is currently experimental and will not work due to ABI differences**
< details >
< summary > steps< / summary >
*(Optional)* In both cases below, you can use `Clang` compiler instead of `GCC` by running these 2 commands in the same terminal instance
```shell
export CC="clang"
export CXX="clang++"
```
* To build 64-bit binaries (`UCRT64` or `MINGW64` )
```shell
export CMAKE_GENERATOR="MSYS Makefiles"
./third-party/common/win/premake/premake5.exe --file=premake5-deps.lua --64-build --all-ext --all-build --verbose --os=windows gmake2
```
* To build 32-bit binaries (`MINGW32`)
```shell
export CMAKE_GENERATOR="MSYS Makefiles"
./third-party/common/win/premake/premake5.exe --file=premake5-deps.lua --32-build --all-ext --all-build --verbose --os=windows gmake2
```
< / details >
2024-05-31 17:05:07 +08:00
2023-12-28 03:46:11 +08:00
This will:
* Extract all third party dependencies from the folder `third-party` into the folder `build\deps\win`
* Build all dependencies
2024-02-16 17:55:50 +08:00
#### On Linux:
2024-05-31 17:05:07 +08:00
Open a terminal in the repo folder
*(Optional)* You can use `Clang` compiler instead of `GCC` by running these 2 commands in the current terminal instance
```shell
export CC="clang"
export CXX="clang++"
```
Then run the following
2024-03-18 08:20:54 +08:00
```shell
2024-05-30 08:29:14 +08:00
export CMAKE_GENERATOR="Unix Makefiles"
./third-party/common/linux/premake/premake5 --file=premake5-deps.lua --64-build --32-build --all-ext --all-build --verbose --os=linux gmake2
2023-12-28 03:46:11 +08:00
```
This will:
* Extract all third party dependencies from the folder `third-party` into the folder `build/deps/linux`
2024-05-30 08:29:14 +08:00
* Build all dependencies (32-bit and 64-bit)
2023-12-28 03:46:11 +08:00
---
2024-02-16 17:55:50 +08:00
## **Building the emu**
### On Windows:
2024-05-30 08:29:14 +08:00
Open CMD in the repo folder, then run the following
* For `Visual Studio 2022`
```batch
2024-05-31 20:09:36 +08:00
third-party\common\win\premake\premake5.exe --file=premake5.lua --genproto --os=windows vs2022
2024-05-30 08:29:14 +08:00
```
You can then go to the folder `build\project\vs2022\win` and open the produced `.sln` file in Visual Studio.
Or, if you prefer to do it from command line, open the `Developer Command Prompt for VS 2022` inside the above folder, then:
```batch
msbuild /nologo /v:n /p:Configuration=release,Platform=Win32 gbe.sln
msbuild /nologo /v:n /p:Configuration=release,Platform=x64 gbe.sln
```
2024-06-13 02:47:30 +08:00
* For `MSYS2` **this is currently experimental and will not work due to ABI differences**
< details >
< summary > steps< / summary >
```shell
./third-party/common/win/premake/premake5.exe --file=premake5.lua --genproto --os=windows gmake2
cd ./build/project/gmake2/win
```
*(Optional)* You can use `Clang` compiler instead of `GCC` by running these 2 commands in the current terminal instance
```shell
export CC="clang"
export CXX="clang++"
```
* 64-bit build (`UCRT64` or `MINGW64` )
```shell
make config=release_x64 -j 8 all
```
* 32-bit build (`MINGW32`)
```shell
make config=release_x32 -j 8 all
```
To see all possible build targets
```shell
make help
```
< / details >
2024-05-30 08:29:14 +08:00
This will build a release version of the emu in the folder `build\win\<toolchain>\release`
2024-06-02 13:32:04 +08:00
An example script `build_win_premake.bat` is available, check it out
2024-03-25 07:27:12 +08:00
2023-12-28 03:46:11 +08:00
< br / >
2024-02-16 17:55:50 +08:00
### On Linux:
2024-05-30 08:29:14 +08:00
Open a terminal in the repo folder, then run the following
2024-03-18 08:20:54 +08:00
```shell
2024-05-31 20:09:36 +08:00
./third-party/common/linux/premake/premake5 --file=premake5.lua --genproto --os=linux gmake2
2024-05-30 08:29:14 +08:00
cd ./build/project/gmake2/linux
2024-05-31 17:05:07 +08:00
```
*(Optional)* You can use `Clang` compiler instead of `GCC` by running these 2 commands in the current terminal instance
```shell
export CC="clang"
export CXX="clang++"
```
Then run the following
```shell
2024-05-30 08:29:14 +08:00
make config=release_x32 -j 8 all
make config=release_x64 -j 8 all
```
2023-12-28 03:46:11 +08:00
2024-05-30 08:29:14 +08:00
To see all possible build targets
```shell
make help
```
2024-01-27 03:31:26 +08:00
2024-06-02 13:32:04 +08:00
This will build a release version of the emu in the folder `build/linux/<toolchain>/release`
An example script `build_linux_premake.sh` is available, check it out
2023-12-28 03:46:11 +08:00
---
2024-02-16 17:55:50 +08:00
## **Building the tool `generate_emu_config`**
2023-12-28 03:46:11 +08:00
Navigate to the folder `tools/generate_emu_config/` then
2024-02-16 17:55:50 +08:00
### On Windows:
2023-12-28 03:46:11 +08:00
Open CMD then:
1. Create python virtual environemnt and install the required packages/dependencies
```batch
recreate_venv_win.bat
```
2. Build the tool using `pyinstaller`
```batch
rebuild_win.bat
```
This will build the tool inside `bin\win`
2024-02-16 17:55:50 +08:00
### On Linux:
2023-12-28 03:46:11 +08:00
Open bash terminal then:
1. Create python virtual environemnt and install the required packages/dependencies
2024-03-18 08:20:54 +08:00
```shell
2023-12-28 03:46:11 +08:00
sudo ./recreate_venv_linux.sh
```
You might need to edit this script to use a different python version.
Find this line and change it:
2024-03-18 08:20:54 +08:00
```shell
2024-07-13 11:50:28 +08:00
python_package="python3.12"
2023-12-28 03:46:11 +08:00
```
2. Build the tool using `pyinstaller`
2024-03-18 08:20:54 +08:00
```shell
2023-12-28 03:46:11 +08:00
./rebuild_linux.sh
```
This will build the tool inside `bin/linux`
---
2024-02-16 17:55:50 +08:00
## **Using Github CI as a builder**
2023-12-28 03:46:11 +08:00
This is really slow and mainly intended for the CI Workflow scripts, but you can use it as another outlet if you can't build locally.
**You have to fork the repo first**.
2024-02-16 17:55:50 +08:00
### Initial setup
2023-12-28 03:46:11 +08:00
In your fork, open the `Settings` tab from the top, then:
* From the left side panel select `Actions` -> `General`
* In the section `Actions permissions` select `Allow all actions and reusable workflows`
* Scroll down, and in the section `Workflow permissions` select `Read and write permissions`
* *(Optional)* In the section `Artifact and log retention` , you can specify the amount of days to keep the build artifacts/archives.
It is recommended to set a reasonable number like 3-4 days, otherwise you may consume your packages storage if you use Github as a builder frequently, more details here: https://docs.github.com/en/get-started/learning-about-github/githubs-plans
2024-05-12 03:10:24 +08:00
### Manual trigger
1. Go to the `Actions` tab in your fork
2. Select the emu dependencies Workflow (ex: `Emu third-party dependencies (Windows) ` ) and run it on the **main** branch (ex: `dev` ).
Dependencies not created on the main branch won't be recognized by other branches or subsequent runs
3. Select one of the Workflow scripts from the left side panel, for example `Build all emu variants (Windows)`
3. On the top-right, select `Run workflow` -> select the desired branch (for example `dev` ) -> press the button `Run workflow`
4. When it's done, many packages (called build artifacts) will be created for that workflow.
Make sure to select the workflow again to view its history, then select the last run at the very top to view its artifacts
2023-12-28 03:46:11 +08:00
< br / >
Important note:
---
2024-05-12 03:10:24 +08:00
When you build the dependencies workflows, they will be cached to decrease the build times of the next triggers and avoid unnecessary/wasteful build process.
2023-12-28 03:46:11 +08:00
This will cause a problem if at any time the third-party dependencies were updated, in that case you need to manually delete the cache, in your fork:
1. Go to the `Actions` tab at the top
2. Select `Caches` from the left side panel
3. Delete the corresponding cache
< br / >
2023-12-20 13:56:18 +08:00
---
2019-04-14 00:21:56 +08:00
2024-02-16 17:55:50 +08:00
## ***(Optional)* Packaging**
2023-12-28 03:46:11 +08:00
This step is intended for Github CI/Workflow, but you can create a package locally.
2024-02-16 17:55:50 +08:00
### On Windows:
2023-12-28 03:46:11 +08:00
Open CMD in the repos's directory, then run this script
```batch
package_win.bat < build_folder >
```
2024-06-03 01:11:18 +08:00
`build_folder` is any folder inside `build\win` , for example: `vs2022\release`
The above example will create a `.7z` archive inside `build\package\win\`
2019-04-14 00:21:56 +08:00
2024-02-16 17:55:50 +08:00
### On Linux:
2023-12-28 03:46:11 +08:00
Open bash terminal in the repos's directory, then run this script
2024-03-18 08:20:54 +08:00
```shell
package_linux.sh < build_folder >
2023-12-28 03:46:11 +08:00
```
2024-06-03 01:11:18 +08:00
`build_folder` is any folder inside `build/linux` , for example: `gmake2/release`
The above example will create a compressed `.tar` archive inside `build/package/linux/`