Skip to content

Instantly share code, notes, and snippets.

View stravant's full-sized avatar

Mark Langen stravant

  • Roblox
  • Bay Area
View GitHub Profile
@stravant
stravant / Walkthrough.md
Created November 30, 2020 05:25
BFBBDecom Walkthrough

Reverse Engineering a Function

Name Mangling Translation

The first thing you will have to do when reverse engineering a function is understand what name the function has / what arguments it takes. To do this, you need to understand name mangling.

Functions in C++ can be overloaded, having different variants, each with different argument types. However, there are multiple ways to write a function signature which really means the same thing, for instance:

  • float32 const* foobar(void);
  • const float *foobar();
-- Wait for the things we need to arrive
game:WaitForChild("Workspace")
game.Workspace:WaitForChild("Terrain")
-- Local copy of terrain to call on throughout the script for speed
local terrain = game.Workspace.Terrain
--==========================================================================================================--
-- Noise generation code ==--
--==========================================================================================================--
--
local perm = {
151,160,137,91,90,15,
131,13,201,95,96,53,194,233,7,225,140,36,103,30,69,142,8,99,37,240,21,10,23,
190, 6,148,247,120,234,75,0,26,197,62,94,252,219,203,117,35,11,32,57,177,33,
88,237,149,56,87,174,20,125,136,171,168, 68,175,74,165,71,134,139,48,27,166,
77,146,158,231,83,111,229,122,60,211,133,230,220,105,92,41,55,46,245,40,244,
@stravant
stravant / FooBar.lua
Last active July 26, 2020 22:18
Lua class template
local FooBar = {}
FooBar.__index = FooBar
function FooBar.new()
local this = {
_privateVariable = 137,
}
return setmetatable(this, FooBar)
end
--[[
Micro-optimized code for computing a local space and the global space
bounding box for a set of parts and attachments as fast as possible.
]]
local function computeTwoBoundingBoxes(basisCFrame1, allParts, allAttachments)
local basisX, basisY, basisZ = basisCFrame1.X, basisCFrame1.Y, basisCFrame1.Z
local inverseBasis1 = basisCFrame1:Inverse()
local xmin1, xmax1 = math.huge, -math.huge
local ymin1, ymax1 = math.huge, -math.huge
local zmin1, zmax1 = math.huge, -math.huge
@stravant
stravant / scramble.lua
Created October 30, 2019 00:48
Scramble the object placement in an osu map
--X: 0-512
--Y: 0-384
-- Type bits: (-)(-)(-)(-) (spinner)(NC)(slider)(circle)
-- Circle: x,y,time,type,hitSound,extras
-- Slider: x,y,time,type,hitSound,sliderType|curvePoints,repeat,pixelLength,edgeHitsounds,edgeAdditions,extras
-- type = Linear Perfect Bezier Catmul
@stravant
stravant / Wist.lua
Last active February 28, 2017 22:47
--[[
Flow:
-
]]
local WistServer = {}
function WistServer.new(players)
This file has been truncated, but you can view the full file.
[
{
"year": 2012,
"month": 4,
"day": 21,
"players": [
{"username": "White Wolf", "pp": 6604, "userId": 39828},
{"username": "Cookiezi", "pp": 6602, "userId": 124493},
{"username": "SiLviA", "pp": 6527, "userId": 409747},
{"username": "Rucker", "pp": 6450, "userId": 147515},
@stravant
stravant / thread_fetch.lua
Created November 17, 2014 21:55
Tracked Thread saver for Roblox Forums
#!/usr/bin/lua
local tracked_url = "http://www.roblox.com/Forum/User/MyForums.aspx"
local base_url = "http://www.roblox.com/Forum/ShowPost.aspx?PostID="
-- Paste your .ROBLOSECURITY cookie below, you can find the cookie by viewing www.roblox.com's
-- cookies in your browser while you are logged in.
-- DO NOT SHARE THIS VALUE, it can be used to log into your current account session.
local cookie = ""