Skip to content

Instantly share code, notes, and snippets.

View ExtReMLapin's full-sized avatar
🤠
howdy

ExtReMLapin

🤠
howdy
  • Alphabet boys
  • Stacking up at your door
View GitHub Profile

So in mordhau you can equip stuff you didn't buy with default mercenaries, i wanted to check if editing thoses mercenaries could allow you to wear any armor (like the king one)

Found the armors were stored in BP_MordhauSingleton.uexp so I made a lil script to split the diff classes in multiple files

if CLIENT then return end
@ExtReMLapin
ExtReMLapin / luajit_compressed_signature.md
Last active September 10, 2019 15:08
Generate a lua (jit) compressed signature

First get an ascii signature like this with only 4 differents char (ignore newlines)

local tbl =[[
 ___       ________  ________   ________  ___   ___     
|\  \     |\   __  \|\   ___  \|\   ____\|\  \ |\  \    
\ \  \    \ \  \|\  \ \  \\ \  \ \  \___|\ \  \\_\  \   
 \ \ \ \ \ ____\ \ \\ \ \ \ \____\ \______ \ 
--fast
function bit.MSB(value)
value = bit.bor(value, bit.rshift(value, 1))
value = bit.bor(value, bit.rshift(value, 2))
value = bit.bor(value, bit.rshift(value, 4))
value = bit.bor(value, bit.rshift(value, 8))
value = bit.bor(value, bit.rshift(value, 16))
value = value + 1
value = bit.rshift(value, 1)

The two first were made by me, the last one by someone else (not sure who exactly, it was on gmodstore discord)

3 methods used

local ret_allocated = {}
ret_allocated[1] = function() return {1} end
ret_allocated[2] = function() return {1, 1} end
ret_allocated[4] = function() return {1, 1, 1, 1} end
ret_allocated[8] = function() return {1, 1, 1, 1, 1, 1, 1, 1} end
ret_allocated[16] = function() return {1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1} end
@ExtReMLapin
ExtReMLapin / check_if_fileLineIsActive_SUBFUNCTIONS_HACK.lua
Created October 30, 2019 09:24
Coded that for Infflux debugger, checks if the line of a file is active (used) using a proto hack instead of editing the luajit code
require("printtable")
jit.util = require("jit.util")
local function getSubFunctions(fn)
local ret = {}
local i = -1
while true do
@ExtReMLapin
ExtReMLapin / elseif_lookup_sequential.lua
Last active February 26, 2020 18:48
benchmarking lua elsif vs hashtable
local nBranch = 1
local nLoops = 2000000
print("NUMBER_BRANCHS,TIME_ELSEIF,TIME_LOOKUP")
while (nBranch <= 100) do
io.write(nBranch)
io.write(",")
local valueName = "iInner"
local elseifCodeTable = {"local iOutter = 1\nwhile iOutter <= " .. nLoops .. " do\n\tlocal iInner = 1\n\tlocal dummy;\n\twhile iInner <= " .. nBranch .. " do\n", "\t\tend\n\t\tiInner = iInner + 1\n\tend\n\tiOutter = iOutter + 1\nend"}
local i = 1
  • Generating routes on basecamp will generate a GPX file with startPoint and endPoint.

    • The .GPX will also include all the "segments" (where you need to turn, for example) between two points
    • The foretrex will NEVER read those points.
    • The data should either be stripped from the GPX or used by the GPS (second choice is probably better)
  • The files where routes/tracks are stored are GPX files (basically XML files)

    • Route line example (len=72 bytes): <gpxx:rpt lat="48.603794574737549" lon="1.569714546203613" />
      • Could be lowered to 16 bytes (2 x double) → 78% size reduction
  • Track line example (len=65 bytes):

[TRACE FAIL --- @lua/includes/util.lua:178 -- NYI: bytecode FNEW at @lua/includes/util.lua:182]
[TRACE FAIL --- @lua/includes/util.lua:178 -- NYI: bytecode FNEW at @lua/includes/util.lua:182]
[TRACE FAIL --- @lua/includes/extensions/client/panel/scriptedpanels.lua:71 -- NYI: bytecode FNEW at @lua/includes/extensions/client/panel/scriptedpanels.lua:89]
[TRACE FAIL --- (4/0) @lua/includes/modules/list.lua:30 -- NYI: bytecode UCLO at @gamemodes/sandbox/entities/weapons/gmod_tool/stools/colour.lua:131]
[TRACE FAIL --- (5/0) @lua/includes/modules/list.lua:40 -- NYI: bytecode UCLO at @gamemodes/sandbox/entities/weapons/gmod_tool/stools/dynamite.lua:178]
[TRACE FAIL --- (5/0) @lua/includes/modules/list.lua:40 -- NYI: bytecode UCLO at @gamemodes/sandbox/entities/weapons/gmod_tool/stools/hoverball.lua:220]
[TRACE FAIL --- (5/0) @lua/includes/modules/list.lua:40 -- NYI: bytecode UCLO at @gamemodes/sandbox/entities/weapons/gmod_tool/stools/lamp.lua:280]
[TRACE FAIL --- (5/0) @lua/includes/modules/list.lua:40 -- NYI: byt