Skip to content
Yangff edited this page Mar 1, 2024 · 22 revisions

About the Linux porting.

This Linux port is experimental and does not support many Windows features such as keyboards, GUIs, Reload mods, Dump headers etc. Make sure you have some Linux basics before you try it, for example you should know that Linux is case sensitive, and that on Linux you should use / instead of \\ in some scripts.

You can download the compiled .so file here https://github.com/Yangff/RE-UE4SS/actions . I will push new code and it will compile automatically so not every new build will work, but for exmplae, https://github.com/Yangff/RE-UE4SS/actions/runs/7941134296/ should work. More details info on buills are on the last section of this page.

The BPModLoader from the UE4SS 3.0.0 release will not work with this version, please use the older versions of the Mod Loader and BPML_GenericFunctions in the https://github.com/Yangff/RE-UE4SS/tree/main/assets/Mods directory.

you should use the latest BPModLoader.

Download and unzip it to your preferred location , you'll get the .so and .ini files.

Let's call this location <UE4SS Location>. Under <UE4SS Location>, create a Mods directory under this location and add your favorite mods, then open them and if you see Scripts, rename it to scripts. Open these scripts and if it has functions for registering shortcuts such as RegisterKeyBind, delete them. Also, some people use Enabled.txt, rename it to enabled.txt.

For BP mods with .pak, put them in <Game Location>/Pal/Content/Paks/LogicMods

Finally, run it with LD_PRELOAD=/<UE4SS Location>/libUE4SS.so /<Game Location>/Pal/Binaries/Linux/PalServer-Linux-Test <Your ARGS>

Sometimes it crashes at the early load and just like UE4SS on windows that is normal because of some racing between the async load and the hooking. If it still crash when the mods start to load .. something may go wrong..

Update

Case sensitive shouldn't be a problem right now, but if it can't find your mod please check that and let me know it's not working for which file (mods.txt? enabled.txt? etc)

We've rebased to the v3.0.1 so we should support the api required by latest bpmodloader

glibc

You will need glibc >= 2.35 and GLIBCXX >= 3.4.32 in order to use it. On ubuntu 22.04 that means you will need to install https://ubuntu.pkgs.org/22.04/ubuntu-main-amd64/libstdc++6_12-20220319-1ubuntu1_amd64.deb.html thanks to Cellenseres. I will see if I can manage to static link the glibcxx.

TUI

TUI requires a Terminal that supports mouse and xterm-256color, e.g. Windows Terminal https://www.microsoft.com/store/productId/9N0DX20HK701 If you are experiencing strange display problems, check that your TERM environment variable is correctly set to xterm-256color .

It should be enabled by default, if you don't need it please disable it in the config GuiConsoleEnabled and GuiConsoleVisible .

Keybinding

I've created a keybinding as long as you're using the tui.

Due to terminal limitations, some keys may not be mapped correctly, e.g. Ctrl+something cannot be combined with Shift, there is a limit to the number of key combinations that can be made with Alt, and pressing ESC and then pressing another key is treated as pressing alt+x. For example, shift changes upper/lower caes, so pressing a letter with a caps lock is treated as if it were a shift, except for symbols and numbers. shift, except for symbols and numbers. Duplicate keystrokes for Enter and ctrl+J...

This is based on EN-US keyboards, using other keyboards may give different results, I don't have a mac keyboard so I'm not sure what the keys look like on a mac.

Locales

Make sure your Linux has UTF-8 locals installed correctly, this should not be a problem on most distributions, but a few may not have UTF-8 locals installed.

libncurses

The default link is to libncursesw.so.6, which can cause problems if you're using a very old version of Linux, or if you've only installed libncurses(without w).

Icons

If you want to see the icon in the TUI interface, you can modify the configuration file's

[TUI]
TUINerdFont=0

to 1, provided you properly install a nerd font (preferably equal-width) https://www.nerdfonts.com/ and set it as your terminal font.

Test Mod

This is just a almost hello world mod to test if everything runs well

print(string.format("Hello world from Lua Mod!!!"))

local palUtility

local function PalUtility()
    if not palUtility or not palUtility:IsValid() then
        palUtility = StaticFindObject("/Script/Pal.Default__PalUtility")
    end
    return palUtility
end

function SendMessage(msg)
    local Player = FindFirstOf("PalPlayerCharacter")
    PalUtility():SendSystemAnnounce(Player, msg)
end

RegisterHook("/Script/Pal.PalNetworkItemComponent:RequestDrop_ToServer", function (self) 
    SendMessage("Player has dropped item")
    print("Player has dropped item\n")
end)

RegisterHook("/Script/Engine.PlayerController:ServerAcknowledgePossession", function (self) 
    SendMessage("Player has possessed")
    print("Player has possessed\n")
end)

RegisterHook("/Script/Pal.PalPlayerState:EnterChat_Receive", function (self, msg) 
    local message = msg:get()
    local my = self:get()
    local msg = message.Message
    local message_text = msg:ToString()
    if message_text == "Test" then
        local player = my:GetPlayerController()
        local state = self:get()
        
        local name = state:GetPlayerName()
        print(string.format("[Test] PlayerController: %s\n", name:ToString()))
        print(string.format("[Test] Valid?: %s\n", tostring(player:IsValid())))
        local character = player:GetDefaultPlayerCharacter()
        local characterb = player:GetControlPalCharacter()
        print(string.format("[Test] Character Valid?: %s\n", tostring(character:IsValid())))
        print(string.format("[Test] Characterb Valid?: %s\n", tostring(characterb:IsValid())))
    end
    print(string.format("Chat msg = %s\n", message_text))
end)


RegisterKeyBind(Key.U, {ModifierKey.ALT}, function()
    print("Alt + U is pressed\n")
end)

Known Issues

BP Mod

If you encounter that blueprint mods are not being loaded, but Lua scripts run normally, particularly, you observe that the RegisterInitGameStatePostHook hooking point is not being executed correctly, please check the execution time of PS Scan in your output:

09:32:45.604224170] [PS] Scan finished in 647.136743ms

If you see that the time here takes several seconds, then the possible issue is because the scan took too long, and the game has already finished loading, thus when it register the hook, the game already loaded and the function was called, you're missing the hook point. You can try giving the game more cores to reduce the scan time, or manually trigger this hook point.

This address should be cached; I'm not sure why it didn't happen under Linux. This issue should improve once fixed in the future (it occurs mostly on the first load after each version update).

Builds

Latest build that should work for most apis including the registerkey

https://github.com/Yangff/RE-UE4SS/actions/runs/8092207290


https://github.com/Yangff/RE-UE4SS/actions/runs/7941134296/

This should fix the problem that randomly crashes at exit.


https://github.com/Yangff/RE-UE4SS/actions/runs/7974108620

https://github.com/Yangff/RE-UE4SS/actions/runs/7974108622

This is the first version with the new string typing works for both Windows and Linux.


Clone this wiki locally