Skip to content
forked from sohpeach/gmbc

About

Load and run Garry's Mod Lua bytecode with C++

Resources

Stars

0 stars

Watchers

0 watching

Forks

 
 

Repository files navigation

gm_bytecode

Build

It's a bytecode loader for gmod servers and clients

Repository: https://github.com/unknown-gd/gm_bytecode

Usage

local bytecode = string.dump(function() print "my secrit code" end)
-- 10 minutes later
require("bytecode")
load_bytecode(bytecode)()

Copy the matching modules into garrysmod/lua/bin:

GMod branch OS Server Client
x64 Linux gmsv_bytecode_linux64.dll gmcl_bytecode_linux64.dll
x32 Linux gmsv_bytecode_linux.dll gmcl_bytecode_linux.dll
x64 Windows gmsv_bytecode_win64.dll gmcl_bytecode_win64.dll
x32 Windows gmsv_bytecode_win32.dll gmcl_bytecode_win32.dll

Building

Nix (flake) — Linux x64 / x32

Builds both gmsv_ and gmcl_ modules:

nix build                 # linux64 + linux32 → result/lib/
nix build .#linux64
nix build .#linux32
nix build .#all

nix develop               # cmake, ninja, gcc, i686 toolchain, clangd

Editor / clangd (NixOS + Zed)

std / missing-header squiggles mean clangd has no compile database or cannot see the nix gcc-wrapper includes.

nix develop -c cmake --preset linux64   # writes build/linux64/compile_commands.json

.clangd points at that database. For Zed, create .zed/settings.json (gitignored locally) pointing at the repo wrapper, which injects --query-driver:

{
  "lsp": {
    "clangd": {
      "binary": {
        "path": "/ABS/PATH/TO/gm_bytecode/tools/zed-clangd"
      }
    }
  }
}

Or set the same under lsp.clangd.binary in ~/.config/zed/settings.json, then restart clangd / reload Zed.

CMake presets

cmake --preset linux64 && cmake --build --preset linux64
cmake --preset linux32 && cmake --build --preset linux32

# Windows — run from an MSVC Developer shell (or after vcvarsall), with Ninja installed
cmake --preset win64 && cmake --build --preset win64
cmake --preset win32 && cmake --build --preset win32

Or set the target explicitly:

cmake -B build -G Ninja -DGM_BYTECODE_TARGET=linux64|linux32|win64|win32 -DCMAKE_BUILD_TYPE=Release
cmake --build build

Manual (without presets)

git clone https://github.com/unknown-gd/gm_bytecode.git
cd gm_bytecode

Linux

cmake -B build-linux64 -G Ninja -DGM_BYTECODE_TARGET=linux64 -DCMAKE_BUILD_TYPE=Release
cmake --build build-linux64

cmake -B build-linux32 -G Ninja -DGM_BYTECODE_TARGET=linux32 -DCMAKE_CXX_FLAGS=-m32 -DCMAKE_C_FLAGS=-m32 -DCMAKE_BUILD_TYPE=Release
cmake --build build-linux32

Windows (MSVC Developer shell + Ninja)

cmake -B build-win64 -G Ninja -DGM_BYTECODE_TARGET=win64 -DCMAKE_BUILD_TYPE=Release
cmake --build build-win64

cmake -B build-win32 -G Ninja -DGM_BYTECODE_TARGET=win32 -DCMAKE_BUILD_TYPE=Release
cmake --build build-win32

About

Load and run Garry's Mod Lua bytecode with C++

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages