2023-07-16 01:58:32 -04:00
# LCPU
2023-07-23 05:22:32 -04:00
LCPU is an alternative CPU core addon for Garry's Mod and Wiremod.
2023-07-16 01:58:32 -04:00
It provides:
2023-07-17 03:01:10 -04:00
- A standard RISC-V architechure (rv32ima) CPU core, implemented in native code
2023-07-23 05:22:32 -04:00
- I know, but it wouldn't particularly be very good if I managed to implement it in Lua
(that and the more reasons to not use Lua for a part of this codebase, the better...)
2023-07-17 03:01:10 -04:00
- Interoperation with the Wiremod addon (and addons which implement Wiremod integration)
2023-07-16 01:58:32 -04:00
2023-07-18 23:33:30 -04:00
This addon (for now) works with both the non-beta branch and the x86-64 beta branches of GMod.
2023-07-16 06:20:11 -04:00
2023-07-23 05:22:32 -04:00
Note that the GitHub mirror is provided only for convinence, and is not used for active development.
See [this link ](https://git.crustywindo.ws/modeco80/gmod-lcpu ) for the actual development repository.
2023-07-16 06:20:11 -04:00
# Installation
2023-07-28 06:05:58 -04:00
You will need Wiremod installed, either from the Workshop or cloned as a filesystem addon.
2023-07-18 23:33:30 -04:00
This repository is set up to be a Filesystem Addon; therefore, workflows which clone repositories from Git and put them in addons/ should be able to work with the LCPU addon just fine.
2023-07-28 06:05:58 -04:00
Preliminary installation steps (by hand):
2023-07-18 23:33:30 -04:00
```
2023-07-23 05:22:32 -04:00
garrysmod/addons$ git clone --recursive https://git.crustywindo.ws/modeco80/gmod-lcpu.git lcpu
2023-07-18 23:33:30 -04:00
garrysmod/addons$ cd lcpu
# Build the LCPU native module. These steps build the linux64 version of the module
# on linux; you'll need to alter it if you want to build for 32-bit.
garrysmod/addons/lcpu$ cmake -Wno-dev -GNinja -S native -B build \
-DCMAKE_BUILD_TYPE=Release
garrysmod/addons/lcpu$ ninja -C build
# Install the native module (Linux)
# For Windows you can do the same thing, just replace this
# with how you'd do it in batch (or use Explorer, I'm not your dad)
garrysmod/addons/lcpu$ [[ ! -d '../../lua/bin']] & & mkdir -p ../../lua/bin & & cp build/projects/lcpu/*.dll ../../lua/bin
# Tada!
```
2023-07-23 05:22:32 -04:00
On Linux you can alternatively use the `./build_module.sh` script that will do all the build and installation steps automatically, once cloning the repository in the garrysmod/addons folder.
2023-07-28 06:05:58 -04:00
Windows building is currently untested; I see no reason why it wouldn't work.
2023-07-19 06:31:07 -04:00
2023-07-18 23:33:30 -04:00
# Special Thanks
2023-07-23 05:22:32 -04:00
[CNLohr ](https://github.com/CNLohr ) - I may not like the mini-rv32ima code that much, but it did still help a lot (and my emulation core library is based off it, with tons of refactoring and a C++ rewrite to boot.), so thanks for creating the project.