{"id":39847847,"url":"https://github.com/shmocz/ra2yrcpp","last_synced_at":"2026-01-18T13:38:27.425Z","repository":{"id":188592108,"uuid":"611979764","full_name":"shmocz/ra2yrcpp","owner":"shmocz","description":"Protobuf API and C++/Python library to interact with Red Alert 2: Yuri's Revenge through WebSockets and HTTP","archived":false,"fork":false,"pushed_at":"2026-01-11T00:59:12.000Z","size":1158,"stargazers_count":17,"open_issues_count":12,"forks_count":3,"subscribers_count":3,"default_branch":"develop","last_synced_at":"2026-01-11T08:26:43.772Z","etag":null,"topics":["cpp","python","ra2","red-alert-2"],"latest_commit_sha":null,"homepage":"","language":"C++","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/shmocz.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2023-03-10T00:02:33.000Z","updated_at":"2026-01-11T00:45:15.000Z","dependencies_parsed_at":null,"dependency_job_id":"97cba862-dec8-462c-ade8-62cc5e9bbaac","html_url":"https://github.com/shmocz/ra2yrcpp","commit_stats":null,"previous_names":["shmocz/ra2yrcpp"],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/shmocz/ra2yrcpp","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/shmocz%2Fra2yrcpp","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/shmocz%2Fra2yrcpp/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/shmocz%2Fra2yrcpp/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/shmocz%2Fra2yrcpp/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/shmocz","download_url":"https://codeload.github.com/shmocz/ra2yrcpp/tar.gz/refs/heads/develop","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/shmocz%2Fra2yrcpp/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28536764,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-18T13:04:05.990Z","status":"ssl_error","status_checked_at":"2026-01-18T13:01:44.092Z","response_time":98,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["cpp","python","ra2","red-alert-2"],"created_at":"2026-01-18T13:38:26.690Z","updated_at":"2026-01-18T13:38:27.407Z","avatar_url":"https://github.com/shmocz.png","language":"C++","readme":"# ra2yrcpp\n\nLibrary for interacting with Red Alert 2 Yuri's Revenge game process with protobuf based protocol over TCP. Inspired by [s2client-api](https://github.com/Blizzard/s2client-api).\n\n## Usage\n\nDownload the [latest release](https://github.com/shmocz/ra2yrcpp/releases/download/latest/ra2yrcpp.zip), copy `libra2yrcpp.dll` to same folder as `gamemd.exe` or `gamemd-spawn.exe`. Create configuration file named `ra2yrcpp.json` in that same folder, for example:\n\n```json\n{\n  \"port\": 14521,\n  \"allowedHostsRegex\": \"0.0.0.0|127.0.0.1|172..+\",\n  \"logFilename\": \"ra2yrcpp.log\"\n}\n```\n\n### Method 1: Syringe + yrpp-spawner\n\nThis is the recommended way to use existing game files from [CnCNet YR client package](https://github.com/CnCNet/cncnet-yr-client-package).\n\n\u003e [!NOTE]\n\u003e Syringe expects one space character after the executable name, hence the backtick.\n\nRun the game:\n\n```bash\nSyringe.exe gamemd.exe\\  -SPAWN -CD -LOG\n```\n\n### Method 2: Syringe + legacy spawner\n\n(TODO. In theory Syringe should also work with `gamemd-spawn.exe` without patching)\n\n### Method 3: Legacy spawner\n\nGet sources from [here](https://github.com/shmocz/ra2yrcpp/archive/refs/tags/latest.zip), or use git (use `--depth 1` if you want just the latest commit):\n\n```\ngit clone --recurse-submodules https://github.com/shmocz/ra2yrcpp.git\n```\n\nDownload the [latest release](https://github.com/shmocz/ra2yrcpp/releases/download/latest/ra2yrcpp.zip) and extract the contents to folder of your choice, e.g. `ra2yrcpp`. Download [spawner](https://github.com/CnCNet/yr-patches/releases/download/latest/yr-patches.zip) and patch it:\n\n```\npython ./scripts/patch_gamemd.py \\\n  --auto-patch \\\n  --build-dir ra2yrcpp \\\n  --input yr-patches/release/cncnet/gamemd-spawn.exe \\\n  --output ra2yrcpp/gamemd-spawn-ra2yrcpp.exe\n```\n\n\u003e **Warning**\n\u003e You cannot use the modified spawner in any online games played over CnCNet. Not only is this against their ToS, but the ra2yrcpp-specific spawner is incompatible with the standard version.\n\nCopy `ra2yrcpp/libra2yrcpp.dll` and `ra2yrcpp/gamemd-spawn-ra2yrcpp.exe` to the CnCNet installation folder. If you wish to launch the game via official CnCNet client, then overwrite the original `gamemd-spawn.exe` with the patched spawner.\n\n## Building\n\n`ra2yrcpp` depends on following software:\n\n- argparse\n- asio\n- cmake\n- fmt\n- protobuf\n- websocketpp\n- wine (Optional: see section about cross-compilation and protoc)\n- xbyak\n- zlib\n\nAll dependencies except cmake, python, zlib and wine are already included as submodules.\n\nFor `clang-cl`, zlib sources might be needed:\n\n```bash\ngit clone -b v1.2.8 https://github.com/madler/zlib.git 3rdparty/zlib\n```\n\n### Build with Docker (recommended)\n\nFor convenience, a Docker image is provided for both MinGW and clang-cl toolchains with all necessary dependencies to build the application and related components. MinGW toolchain is used by default.\n\nBuild the images:\n\n```bash\ndocker compose build builder\n```\n\nBuild the library with docker:\n\n```bash\n./scripts/tools.sh docker-build\n```\n\n### General build instructions (for developers)\n\n#### Obtain protobuf\n\n\u003e **Warning**\n\u003e Builds of libprotobuf lack compatibility across different compilers. Attempting to link a MinGW compiled library in MSVC/clang-cl toolchain, or vice versa, will result in errors.\n\nIf you built the main docker image then protobuf has already been built and you can copy the files from there:\n\n```bash\nmkdir -p opt/usr\ndocker compose cp -L builder:/usr/i686-w64-mingw32 opt/usr\ndocker compose cp -L builder:/usr/bin/protoc opt/bin\n```\n\n#### Build\n\nPick a toolchain of your choice, release type and the build script:\n\n```bash\nexport CMAKE_TOOLCHAIN_FILE=\u003ctoolchain-path\u003e\nexport CMAKE_RELEASE_TYPE=Release\n./scripts/tools.sh build-cpp\n```\n\nThis performs the build and installation under `cbuild/\u003ctoolchain-id\u003e-\u003crelease-type\u003e`.\n\nAlternatively invoke cmake directly:\n\n```bash\nmkdir -p build pkg\ncmake \\\n  -DCMAKE_INSTALL_PREFIX=pkg \\\n  --toolchain \u003ctoolchain-path\u003e \\\n  -S . -B build \\\n  cmake --build build --config Release --target all -j $(nproc) \\\n  cmake --build build --config Release --target install\n```\n\nThe following build options are available:\n\n- `RA2YRCPP_BUILD_MAIN_DLL` Whether to build the main YRpp-dependent DLL and related utilities. Default: `ON`\n- `RA2YRCPP_BUILD_TESTS` Whether to build test executables. Default: `ON`\n- `RA2YRCPP_DEBUG_LOG` Enable debug logging even for non-debug targets. Default: `OFF`\n- `RA2YRCPP_SYSTEM_PROTOBUF` Use system protobuf headers instead of the submodule. Useful when working on native builds. Default: `OFF`\n\n### Build using clang-cl\n\nClang-cl requires MSVC SDK, which will be downloaded when building the `clang-cl-msvc.Dockerfile` image. Once downloaded, modify the toolchain file at `toolchains/clang-cl-msvc.cmake` to point to correct SDK paths.\n\nAlso get the static zlib library, and adjust `ZLIB_LIBRARY` in the toolchain file accordingly. On Linux systems the library might be present if MinGW cross compilation toolchain has been installed.\n\nExecute build with:\n\n```bash\nexport CMAKE_TOOLCHAIN_FILE=toolchains/clang-cl-msvc.cmake\n./scripts/tools.sh build-cpp\n```\n\nthe build and install directories will be performed to `cbuild/\u003ctoolchain-name\u003e-$CMAKE_RELEASE_TYPE`, under the names `build` and `pkg` respectively.\n\n### Build using MinGW\n\nThe instructions are identical to `clang-cl`, consult the reference toolchain file at `mingw-w64-i686.cmake`.\n\n```bash\nexport CMAKE_TOOLCHAIN_FILE=toolchains/mingw-w64-i686.cmake\n./scripts/tools.sh build-cpp\n```\n\n### Build core library natively without YRpp\n\nThe core component and it's related tests do not depend on Windows, and can be built natively using `RA2YRCPP_BUILD_MAIN_DLL=OFF` CMake option. This is useful when debugging code of the main service. You can specify additional compile/link options for test executables in the `RA2YRCPP_EXTRA_FLAGS` variable. For instance, to enable ASan and UBSan on GCC or Clang:\n\n```cmake\nset(RA2YRCPP_EXTRA_FLAGS -fsanitize=address -fsanitize=undefined)\n```\n\n### Using different protobuf version\n\n\u003e **Warning**\n\u003e Currently supported only for native builds (`RA2YRCPP_BUILD_MAIN_DLL=OFF`)\n\nNewer versions of protobuf use abseil library and may require additional linking flags. These can be specified in the toolchain file like this:\n\n```cmake\nset(PROTOBUF_EXTRA_LIBS absl_status absl_log_internal_check_op absl_log_internal_message)\n```\n\nExact list of libraries may vary across systems and protobuf versions.\n\n## Options\n\n### Recording game data\n\n\u003e **Warning**\n\u003e The uncompressed recording can be very large. Consider downsampling or transforming it into less verbose format for further processing.\n\nA callback is created to save game state at the beginning of each frame. To output these to a file, set the `recordFilename` setting, e.g. `\"recordFilename\": \"record.pb.gz\"`. The states are stored as compressed consecutive serialized protobuf messages. After exiting the game, the recording can be dumped as lines of JSON strings with the tool `ra2yrcppcli.exe`.\n\n## Troubleshooting\n\n### The game doesn't start\n\nThis can happen if ra2yrcpp cannot load zlib DLL. Ensure that `zlib1.dll` is placed in the same folder as `libra2yrcpp.dll`.\n\n### The game freezes shortly after loading\n\nAnti-cheat mechanism tends to cause this. Use the non-hardened version of the spawner:\n\n- The [yrpp-spawner](https://github.com/CnCNet/yrpp-spawner/releases) (not the \"CnCNetYR\" version)\n- The [legacy spawner](https://github.com/CnCNet/yr-patches/releases/tag/latest).\n\n### Cannot attach debugger when using Syringe\n\nThis happens if debugging on Windows or with `winedbg` on Linux (regular `gdb` should work fine). Compile ra2yrcpp with `Debug` build variant, which causes it to detach from active debugger at initialization.\n\n## Credits\n\n- **shmocz**\n- **[CnCNet](https://github.com/CnCNet) Contributors**\n- **[Phobos](https://github.com/Phobos-developers/Phobos) and YRpp contributors**\n\n## Legal and license\n\n[![GPL v3](https://www.gnu.org/graphics/gplv3-127x51.png)](https://opensource.org/licenses/GPL-3.0)\n\nThis project has no direct association to Electronic Arts Inc. Command and Conquer, Yuri's Revenge, Red Alert, Westwood Studios, EA GAMES, the EA GAMES logo and Electronic Arts are trademarks or registered trademarks of Electronic Arts Inc. in the U.S. and/or other countries. All rights reserved.\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fshmocz%2Fra2yrcpp","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fshmocz%2Fra2yrcpp","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fshmocz%2Fra2yrcpp/lists"}