Skip to content

Instantly share code, notes, and snippets.

@Anaminus
Created March 12, 2015 06:14
Show Gist options
  • Save Anaminus/de33809d539b2d4e9a36 to your computer and use it in GitHub Desktop.
Save Anaminus/de33809d539b2d4e9a36 to your computer and use it in GitHub Desktop.
Replaces Roblox Studio's splash screen with another image.
-- Replaces Roblox Studio's splash screen with another image.
--
-- Usage:
--
-- lua splash-patch.lua [STUDIO_PATH] [IMAGE_PATH]
--
-- Specifying no options prompts for input.
-- First KB of original splash image file
local splashSig =
'\137\080\078\071\013\010\026\010\000\000\000\013\073\072\068\082' ..
'\000\000\002\063\000\000\001\070\008\006\000\000\000\133\105\254' ..
'\163\000\000\000\025\116\069\088\116\083\111\102\116\119\097\114' ..
'\101\000\065\100\111\098\101\032\073\109\097\103\101\082\101\097' ..
'\100\121\113\201\101\060\000\000\003\102\105\084\088\116\088\077' ..
'\076\058\099\111\109\046\097\100\111\098\101\046\120\109\112\000' ..
'\000\000\000\000\060\063\120\112\097\099\107\101\116\032\098\101' ..
'\103\105\110\061\034\239\187\191\034\032\105\100\061\034\087\053' ..
'\077\048\077\112\067\101\104\105\072\122\114\101\083\122\078\084' ..
'\099\122\107\099\057\100\034\063\062\032\060\120\058\120\109\112' ..
'\109\101\116\097\032\120\109\108\110\115\058\120\061\034\097\100' ..
'\111\098\101\058\110\115\058\109\101\116\097\047\034\032\120\058' ..
'\120\109\112\116\107\061\034\065\100\111\098\101\032\088\077\080' ..
'\032\067\111\114\101\032\053\046\048\045\099\048\054\048\032\054' ..
'\049\046\049\051\052\055\055\055\044\032\050\048\049\048\047\048' ..
'\050\047\049\050\045\049\055\058\051\050\058\048\048\032\032\032' ..
'\032\032\032\032\032\034\062\032\060\114\100\102\058\082\068\070' ..
'\032\120\109\108\110\115\058\114\100\102\061\034\104\116\116\112' ..
'\058\047\047\119\119\119\046\119\051\046\111\114\103\047\049\057' ..
'\057\057\047\048\050\047\050\050\045\114\100\102\045\115\121\110' ..
'\116\097\120\045\110\115\035\034\062\032\060\114\100\102\058\068' ..
'\101\115\099\114\105\112\116\105\111\110\032\114\100\102\058\097' ..
'\098\111\117\116\061\034\034\032\120\109\108\110\115\058\120\109' ..
'\112\077\077\061\034\104\116\116\112\058\047\047\110\115\046\097' ..
'\100\111\098\101\046\099\111\109\047\120\097\112\047\049\046\048' ..
'\047\109\109\047\034\032\120\109\108\110\115\058\115\116\082\101' ..
'\102\061\034\104\116\116\112\058\047\047\110\115\046\097\100\111' ..
'\098\101\046\099\111\109\047\120\097\112\047\049\046\048\047\115' ..
'\084\121\112\101\047\082\101\115\111\117\114\099\101\082\101\102' ..
'\035\034\032\120\109\108\110\115\058\120\109\112\061\034\104\116' ..
'\116\112\058\047\047\110\115\046\097\100\111\098\101\046\099\111' ..
'\109\047\120\097\112\047\049\046\048\047\034\032\120\109\112\077' ..
'\077\058\079\114\105\103\105\110\097\108\068\111\099\117\109\101' ..
'\110\116\073\068\061\034\120\109\112\046\100\105\100\058\070\055' ..
'\055\070\049\049\055\052\048\055\050\048\054\056\049\049\056\067' ..
'\049\052\056\054\068\053\052\057\052\069\066\065\055\056\034\032' ..
'\120\109\112\077\077\058\068\111\099\117\109\101\110\116\073\068' ..
'\061\034\120\109\112\046\100\105\100\058\051\054\056\052\066\066' ..
'\066\068\055\055\057\069\049\049\069\050\057\056\054\057\070\053' ..
'\052\070\051\053\065\049\054\051\048\056\034\032\120\109\112\077' ..
'\077\058\073\110\115\116\097\110\099\101\073\068\061\034\120\109' ..
'\112\046\105\105\100\058\051\054\056\052\066\066\066\067\055\055' ..
'\057\069\049\049\069\050\057\056\054\057\070\053\052\070\051\053' ..
'\065\049\054\051\048\056\034\032\120\109\112\058\067\114\101\097' ..
'\116\111\114\084\111\111\108\061\034\065\100\111\098\101\032\080' ..
'\104\111\116\111\115\104\111\112\032\067\083\053\032\077\097\099' ..
'\105\110\116\111\115\104\034\062\032\060\120\109\112\077\077\058' ..
'\068\101\114\105\118\101\100\070\114\111\109\032\115\116\082\101' ..
'\102\058\105\110\115\116\097\110\099\101\073\068\061\034\120\109' ..
'\112\046\105\105\100\058\055\056\048\050\068\067\055\048\056\055' ..
'\050\053\054\056\049\049\057\050\066\048\056\056\051\067\070\050' ..
'\056\065\068\067\049\069\034\032\115\116\082\101\102\058\100\111' ..
'\099\117\109\101\110\116\073\068\061\034\120\109\112\046\100\105' ..
'\100\058\070\055\055\070\049\049\055\052\048\055\050\048\054\056' ..
'\049\049\056\067\049\052\056\054\068\053\052\057\052\069\066\065' ..
'\055\056\034\047\062\032\060\047\114\100\102\058\068\101\115\099' ..
'\114\105\112\116\105\111\110\062\032\060\047\114\100\102\058\082' ..
'\068\070\062\032\060\047\120\058\120\109\112\109\101\116\097\062' ..
'\032\060\063\120\112\097\099\107\101\116\032\101\110\100\061\034' ..
'\114\034\063\062\034\132\044\033\000\004\054\168\073\068\065\084' ..
'\120\218\236\189\075\147\108\201\113\038\230\017\113\078\102\086' ..
'\213\125\245\003\232\110\000\236\006\241\006\009\014\031\067\138' ..
'\052\138\028\113\052\102\090\104\057\166\149\068\141\073\090\201' ..
'\076\043\237\180\156\063\160\181\022\179\213\102\076\102\050\027'
local pathStudio, pathImage = ...
if not pathStudio or not pathImage then
print("Input the path to a Roblox Studio executable:")
pathStudio = io.read()
print("Input the path to an image:")
pathImage = io.read()
end
local studio, err = io.open(pathStudio, 'r+b')
if not studio then
print("cannot open studio file:", err)
return
end
local image, err = io.open(pathImage, 'rb')
if not image then
print("cannot open image file:", err)
return
end
-- Scan executable for splash signature
local offset
local sizeStudio = studio:seek('end')
local chsize = #splashSig*2
local inc = #splashSig
local n = 0
while n < sizeStudio do
studio:seek('set', n)
local chunk = ''
while #chunk < chsize do
local ch = studio:read(chsize-#chunk)
if not ch then
ch = studio:read(chsize-#chunk)
if not ch then break end
end
chunk = chunk .. ch
end
if #chunk ~= chsize then break end
offset = chunk:find(splashSig, 1, true)
if offset then
offset = n + offset - 1
break
end
n = n + inc
end
if not offset then
print("could not locate splash image in executable")
return
end
-- Scan for end of image to get the file size
studio:seek('set', offset)
local IEND = '\73\69\78\68\174\66\96\130'
local offend
local chsize = 2^11
local inc = 2^10
local n = 0
while n < sizeStudio do
studio:seek('set', n)
local chunk = studio:read(chsize)
local _, e = chunk:find(IEND, 1, true)
if e then
offend = n + e - 1
break
end
n = n + inc
end
local sizeImage = image:seek('end')
if offend-offset > sizeImage then
print(string.format("file size of the image (%d bytes) is too large (must be no greater than %d bytes)", sizeImage, offend-offset))
return
end
-- Create a backup of Studio file
local backup, err = io.open(pathStudio .. '.bak', 'wb')
if not backup then
print("could not create studio backup:", err)
end
local chsize = 2^13
studio:seek('set')
while true do
local chunk = studio:read(chsize)
if not chunk then break end
backup:write(chunk)
end
backup:flush()
backup:close()
-- Overwrite splash
local chsize = 2^13
image:seek('set')
studio:seek('set', offset)
while true do
local chunk = image:read(chsize)
if not chunk then break end
studio:write(chunk)
end
studio:flush()
studio:close()
image:close()
@sn8to
Copy link

sn8to commented Nov 5, 2016

Any way to do this on a Windows PC? I noticed you were using the lua command, which isn't a built-in Windows command.

[EDIT]: Solved! Download a Win32 or Win64 binary zip from http://luabinaries.sourceforge.net/download.html

@sn8to
Copy link

sn8to commented Nov 5, 2016

I think your LUA script is broken. It might be because their new splash screen does not match the one your script is looking for. Try updating it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment