From 803e53c77c59ea518e117d47ae915ffbb009c6f4 Mon Sep 17 00:00:00 2001 From: Bitl Date: Wed, 5 Oct 2016 14:16:41 -0700 Subject: [PATCH] v1.0 Source Code --- .gitattributes | 17 +++++ .gitignore | 47 ++++++++++++ RBXLegacy.bat | 58 +++++++++++++++ README.md | 113 +++++++++++++++++++++++++++++ client/CSMPFunctions.lua | 149 +++++++++++++++++++++++++++++++++++++++ 5 files changed, 384 insertions(+) create mode 100644 .gitattributes create mode 100644 .gitignore create mode 100644 RBXLegacy.bat create mode 100644 README.md create mode 100644 client/CSMPFunctions.lua diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 0000000..bdb0cab --- /dev/null +++ b/.gitattributes @@ -0,0 +1,17 @@ +# Auto detect text files and perform LF normalization +* text=auto + +# Custom for Visual Studio +*.cs diff=csharp + +# Standard to msysgit +*.doc diff=astextplain +*.DOC diff=astextplain +*.docx diff=astextplain +*.DOCX diff=astextplain +*.dot diff=astextplain +*.DOT diff=astextplain +*.pdf diff=astextplain +*.PDF diff=astextplain +*.rtf diff=astextplain +*.RTF diff=astextplain diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..cd2946a --- /dev/null +++ b/.gitignore @@ -0,0 +1,47 @@ +# Windows image file caches +Thumbs.db +ehthumbs.db + +# Folder config file +Desktop.ini + +# Recycle Bin used on file shares +$RECYCLE.BIN/ + +# Windows Installer files +*.cab +*.msi +*.msm +*.msp + +# Windows shortcuts +*.lnk + +# ========================= +# Operating System Files +# ========================= + +# OSX +# ========================= + +.DS_Store +.AppleDouble +.LSOverride + +# Thumbnails +._* + +# Files that might appear in the root of a volume +.DocumentRevisions-V100 +.fseventsd +.Spotlight-V100 +.TemporaryItems +.Trashes +.VolumeIcon.icns + +# Directories potentially created on remote AFP share +.AppleDB +.AppleDesktop +Network Trash Folder +Temporary Items +.apdisk diff --git a/RBXLegacy.bat b/RBXLegacy.bat new file mode 100644 index 0000000..bbd349b --- /dev/null +++ b/RBXLegacy.bat @@ -0,0 +1,58 @@ +@ECHO OFF +cls +COLOR 4F +SET appname=RBXLegacy +TITLE %appname% +SET RobloxPath=%CD%\client\RobloxApp.exe +SET RobloxPathRoot=%CD%\client +SET GameLoadPath=%RobloxPathRoot:\=\\% +SET RobloxPort=53640 +SET UserID=0 +SET PlayerName=Player +SET DefaultIP=localhost +SET DefaultMap=Baseplate +GOTO MainMenu +GOTO::EOF + +:MainMenu +cls +ECHO %appname% +ECHO. +ECHO Menu Options: +ECHO 1 - JOIN SERVER +ECHO 2 - START SERVER +ECHO 0 - QUIT +SET /P LaunchId="Option: " +IF %LaunchId%==1 GOTO ClientSetup +IF %LaunchId%==2 GOTO ServerSetup +IF %LaunchId%==0 EXIT +GOTO::EOF + +:ClientSetup +cls +ECHO JOIN SERVER +ECHO. +ECHO If you don't enter an IP, the default will be used instead. +ECHO. +SET /P JoinServer="Server IP (Default: %DefaultIP%): " +IF NOT DEFINED JoinServer SET JoinServer=%DefaultIP% +ECHO Starting Roblox... +%RobloxPath% -script "dofile('%GameLoadPath%\\CSMPFunctions.lua'); _G.CSConnect(%UserID%,'%JoinServer%',%RobloxPort%,'%PlayerName%');" +GOTO::EOF + +:ServerSetup +cls +ECHO START SERVER +ECHO. +ECHO If you don't enter a map name, the default will be used instead. +ECHO Be sure you port forward %RobloxPort% if you want to start a public server. +ECHO. +ECHO Select a map: +ECHO. +for %%a in ("%CD%\client\Maps\*") do @echo %%~na +ECHO. +SET /P ServerPlaceId="Type the name of the map you would like to load (Default: %DefaultMap%): " +IF NOT DEFINED ServerPlaceId SET ServerPlaceId=%DefaultMap% +ECHO Starting Roblox... +%RobloxPath% -script "dofile('%GameLoadPath%\\CSMPFunctions.lua'); _G.CSServer(%RobloxPort%); game:Load('%GameLoadPath%\\Maps\\%ServerPlaceId%.rbxl');" +GOTO::EOF \ No newline at end of file diff --git a/README.md b/README.md new file mode 100644 index 0000000..7a56af6 --- /dev/null +++ b/README.md @@ -0,0 +1,113 @@ +#RBXLegacy +------------------------------- +========= INFORMATION ========= +------------------------------- +[What is RBXLegacy?] +RBXLegacy is a modified version of a late-2008 ROBLOX client, built to allow the user to run LAN and Internet servers. + +-------------------------------- +========= INSTRUCTIONS ========= +-------------------------------- + +WARNING: +If Hamachi is on, you won't be able to join "localhost" or any other local or private IP address! In order to use RBXLegacy on LAN or Play Solo, +you must either turn off Hamachi by pressing the "Turn Off" button, or by turning one of your Hamachi networks online if you own a network. + + + +=== HOSTING === + +How to host a server: + +1. Port forward 53640 as TCP/UCP. If you do not know how to port forward, there are plenty of tutorials on the internet for this. + +2. Open the RBXLegacy.bat. + +3. Select the "START SERVER" option by typing 2 and then pressing Enter or Return. + +4. Type in the name of the map you want to play, then press Enter or Return. The ROBLOX Studio window should load with the map you chose. + +5. To share your server with friends, send them your public/external IP address (Google ip). + + + +How to host a LAN server: + +1. First, you must know your LAN IPv4 address from ipconfig. If you don't know your LAN IPv4 address, there are plenty of tutorials on the internet for this. + +2. Open the RBXLegacy.bat. + +3. Select the "START SERVER" option by typing 2 and then pressing Enter or Return. + +4. Type in the name of the map you want to play, then press Enter or Return. The ROBLOX Studio window should load with the map you chose. + +5. To share your server with friends, tell them your LAN IPv4 address. + + + +How to host a Hamachi server: + +1. Make sure you have Hamachi installed and you made a network already. If you do not know how, there are plenty of tutorials on the internet for this. + +2. Open the RBXLegacy.bat. + +3. Select the "START SERVER" option by typing 2 and then pressing Enter or Return. + +4. Type in the name of the map you want to play, then press Enter or Return. The ROBLOX Studio window should load with the map you chose. + +5. To share your server with friends, send them your Hamachi IPv4 address located above your computer's name on the Hamachi window. +You must also share the network ID and password to your Hamachi network. + + + +=== CONNECTING === + +How to connect via IP (LAN/Online): + +1. Open the RBXLegacy.bat. + +2. Select the "JOIN SERVER" option by typing 1 and then pressing Enter or Return. + +3. Type in the IP address that is shared to you, and then press Enter or Return. + +4. You should be able to join the server. + + + +How to connect via Hamachi: + +1. Open the RBXLegacy.bat. + +2. Select the "JOIN SERVER" option by typing 1 and then pressing Enter or Return. + +3. Type in the IPv4 Address that is in the title of the Hamachi network you are in, and then press Enter or Return. + +4. You should be able to join the server. + +=== PLAY SOLO === + + + +How to Play Solo: + +1. Open the RBXLegacy.bat. + +2. Select the "START SERVER" option by typing 2 and then pressing Enter or Return. + +3. Type in the name of the map you want to play, then press Enter or Return. The ROBLOX Studio window should load with the map you chose. + +4. Then, launch the RBXLegacy.bat again and then select "JOIN SERVER" by typing 1 and then pressing Enter or Return. + +5. On the "JOIN SERVER" screen, press Enter or Return. ROBLOX will then load. + +--------------------------- +========= CREDITS ========= +--------------------------- + +ROBLOX and the ROBLOX Client were made by the ROBLOX Corporation. +The ROBLOX Corporation does not support or endorse the creation of RBXLegacy. +Bitl is not affiliated with the ROBLOX Corporation or its subsidiaries. +Bitl does not own any of the content included with RBXLegacy. +The client itself was not modified in any way. +LUA scripts were used to build a client that can connect to LAN and the Internet. +The LUA scripts used was borrowed from the RBXPri client and merged into 1 single script. diff --git a/client/CSMPFunctions.lua b/client/CSMPFunctions.lua new file mode 100644 index 0000000..5465cd0 --- /dev/null +++ b/client/CSMPFunctions.lua @@ -0,0 +1,149 @@ +--TODO: add play solo + +EnforceMaxPlayers=false; +SysopConnections={}; +IPBannedlist={}; + +function IncommingConnection(Peer, Replicator) + for Index,Value in pairs(IPBannedlist) do + if (Value == Replicator.MachineAddress) then + Replicator:CloseConnection(); + end + end +end + +function CSServer(Port,Limit) + assert((type(Port)~="number" or tonumber(Port)~=nil or Port==nil),"CSRun Error: Port must be nil or a number."); + local NetworkServer=game:GetService("NetworkServer"); + if (Limit) then + NetworkServer:SetOutgoingKBPSLimit(Limit) + end + pcall(NetworkServer.Stop,NetworkServer); + NetworkServer:Start(Port); + game:GetService("Players").PlayerAdded:connect(function(Player) + Player:LoadCharacter(); + Player.Changed:connect(function(Property) + if (Property=="Character") and (Player.Character~=nil) then + local Character=Player.Character; + local Humanoid=Character:FindFirstChild("Humanoid"); + if (Humanoid~=nil) then + Humanoid.Died:connect(function() delay(5,function() Player:LoadCharacter() end) end) + end + end + end) + end) + game:GetService("RunService"):Run(); + pcall(function() game.Close:connect(function() NetworkServer:Stop(); end) end); + -- ChildAdded is being a retard. Sorry for inefficient code. + --[[while wait(0.1) do + print("OMG",#game.NetworkServer:children()) + for Index,Child in pairs(NetworkServer:GetChildren()) do + if (Child.className == "") then + IncommingConnection(nil, Child); + end + end + end]] + NetworkServer.IncommingConnection:connect(IncommingConnection); +end + +function CSConnect(UserID,ServerIP,ServerPort,PlayerName,Ticket,Limit) + pcall(function() + game:GetService("GuiService").Changed:connect(function() + pcall(function() game:GetService("GuiService").ShowLegacyPlayerList=true; end); + pcall(function() game.CoreGui.RobloxGui.PlayerListScript:Remove(); end); + pcall(function() game.CoreGui.RobloxGui.PlayerListTopRightFrame:Remove(); end); + pcall(function() game.CoreGui.RobloxGui.BigPlayerListWindowImposter:Remove(); end); + pcall(function() game.CoreGui.RobloxGui.BigPlayerlist:Remove(); end); + end); + end) + game:GetService("RunService"):Run(); + assert((ServerIP~=nil and ServerPort~=nil),"CSConnect Error: ServerIP and ServerPort must be defined."); + local function SetMessage(Message) game:SetMessage(Message); end + local Visit,NetworkClient,PlayerSuccess,Player,ConnectionFailedHook=game:GetService("Visit"),game:GetService("NetworkClient"); + + local function GetClassCount(Class,Parent) + local Objects=Parent:GetChildren(); + local Number=0; + for Index,Object in pairs(Objects) do + if (Object.className==Class) then + Number=Number+1; + end + Number=Number+GetClassCount(Class,Object); + end + return Number; + end + + local function RequestCharacter(Replicator) + local Connection; + Connection=Player.Changed:connect(function(Property) + if (Property=="Character") then + game:ClearMessage(); + end + end) + SetMessage("Requesting character..."); + Replicator:RequestCharacter(); + SetMessage("Waiting for character..."); + end + + local function Disconnection(Peer,LostConnection) + if (LostConnection==true) then + SetMessage("You have lost connection to the game"); + else + SetMessage("You have lost connection to the game"); + end + end + + local function ConnectionAccepted(Peer,Replicator) + Replicator.Disconnection:connect(Disconnection); + local RequestingMarker=true; + game:SetMessageBrickCount(); + local Marker=Replicator:SendMarker(); + Marker.Received:connect(function() + RequestingMarker=false; + RequestCharacter(Replicator) + end) + while RequestingMarker do + Workspace:ZoomToExtents(); + wait(0.5); + end + end + + local function ConnectionFailed(Peer,Code) + SetMessage("Failed to connect to the Game. (ID="..Code..")"); + end + + pcall(function() settings().Diagnostics:LegacyScriptMode(); end); + pcall(function() game:SetRemoteBuildMode(true); end); + SetMessage("Progress: Connecting to the server ..."); + NetworkClient.ConnectionAccepted:connect(ConnectionAccepted); + ConnectionFailedHook=NetworkClient.ConnectionFailed:connect(ConnectionFailed); + NetworkClient.ConnectionRejected:connect(function() + pcall(function() ConnectionFailedHook:disconnect(); end); + SetMessage("Failed to connect to the Game. (Connection rejected)"); + end) + + pcall(function() NetworkClient.Ticket=Ticket or ""; end) -- 2008 client has no ticket :O + if (Limit) then + NetworkClient:SetOutgoingKBPSLimit(Limit) + end + Player=game:GetService("Players"):CreateLocalPlayer(UserID); + PlayerSuccess=pcall(function() return NetworkClient:Connect(ServerIP,ServerPort) end); + + if (not PlayerSuccess) then + SetMessage("Failed to connect to the Game. (Invalid IP Address"); + NetworkClient:Disconnect(); + end + + if (not Player) then + SetMessage("Failed to connect to the Game. (Player not found)"); + NetworkClient:Disconnect(); + end + + Player:SetSuperSafeChat(false); + Player.CharacterAppearance=0; + pcall(function() Player.Name=PlayerName or ""; end); + pcall(function() Visit:SetUploadUrl(""); end); +end + +_G.CSServer=CSServer; +_G.CSConnect=CSConnect;