Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include "stdafx.h"
- #include "scan.h"
- #define SerializerFunc 0xA1B010
- #define WorkspaceVTable 0x1165EBC
- #define InstanceSetParent 0x5249C0
- std::string RBXMX_FileName;
- std::ofstream RBXMX_Out;
- struct instance_shared_ptr {
- void* instance;
- void* unk;
- };
- //typedef int(__thiscall* _ffc)(void* instance, std::string childname, char recursive);
- typedef void (__cdecl* _serialize)(std::ostream&, std::vector<instance_shared_ptr>, ULONG);
- typedef char (__thiscall* _SetParentInstance)(void* self, int wot, int whatever);
- _SetParentInstance SetParentInstance;
- //_ffc findfirstchild;
- _serialize serialize;
- DWORD WorkspaceVT;
- DWORD Workspace;
- DWORD Terrain;
- BOOL Dump_Instance_Vector(std::ostream& export_stream, std::vector<instance_shared_ptr>* instance_vector)
- {
- serialize(export_stream, *instance_vector, NULL);
- return TRUE;
- }
- std::string* GetName(int Instance) {
- return (std::string*)(*(int*)(Instance + 0x28));
- }
- int GetChildByName(int Instance, std::string Name) {
- // iterate over the children vector
- DWORD StartOfChildren = *(DWORD*)(Instance + 0x2C);
- DWORD EndOfChildren = *(DWORD*)(StartOfChildren + 4);
- for (int i = *(int*)StartOfChildren; i != EndOfChildren; i += 8)
- if (strcmp(GetName(*(int*)i)->c_str(), Name.c_str()) == 0)
- return *(int*)i;
- return 0;
- }
- /*
- void RemoveTerrainFromWorkspace(int Workspace)
- {
- DWORD StartOfChildren = *(DWORD*)(Workspace + 0x2C);
- DWORD EndOfChildren = *(DWORD*)(StartOfChildren + 4);
- for (int i = *(int*)StartOfChildren; i != EndOfChildren; i += 8)
- if (strcmp(GetName(*(int*)i)->c_str(), "Terrain") == 0)
- *(int*)i = NULL;
- }
- */
- int __stdcall MessageBoxHook(HWND WindowParent, LPCSTR Body, LPCSTR Caption, UINT Type)
- {
- MessageBoxW(WindowParent, L"The place has successfully been dumped! Roblox will now close.", L"Magus Night", MB_ICONINFORMATION);
- PostMessage(GetConsoleWindow(), WM_CLOSE, NULL, NULL);
- std::exit(NULL);
- return 0;
- }
- // crash rate: ~40%
- // please excuse the terrible code (this was made in 5 minutes)
- VOID Init()
- {
- std::stringstream RBXMX_Log;
- DWORD OldPerm, OldPermMsg, Base;
- // open console
- VirtualProtect(&FreeConsole, 1, PAGE_EXECUTE_READWRITE, &OldPerm);
- VirtualProtect(&MessageBoxA, 5, PAGE_EXECUTE_READWRITE, &OldPerm);
- *(BYTE*)(&FreeConsole) = 0xC3;
- AllocConsole();
- freopen("CONOUT$", "w", stdout);
- freopen("CONIN$", "r", stdin);
- SetConsoleTitleA("Magus Night v2.2 - by Louka @ V3rmillion");
- // header/filestream stuff
- std::cout << "Magus Night v2.2 - by Louka @ V3rmillion\nIf the game crashes during the dumping process, just try again.\n\nPlease enter filename: ";
- getline(std::cin, RBXMX_FileName);
- RBXMX_Out = std::ofstream(RBXMX_FileName, std::ios_base::out|std::ios_base::binary);
- if (RBXMX_Out.fail())
- {
- std::cout << "\nSomething went wrong while opening the file. Close Roblox and try again.";
- return;
- }
- // get functions from their offset
- std::cout << "[1/3] Getting funcs... ";
- Base = (DWORD)GetModuleHandleA("RobloxPlayerBeta.exe");
- serialize = (_serialize)(SerializerFunc - 0x400000 + Base);
- //SerializerJumpTo = (SerializerBckt - 0x400000 + Base);
- SetParentInstance = (_SetParentInstance)(InstanceSetParent - 0x400000 + Base);
- std::cout << "OK!\n[2/3] Obtaining workspace children vector... ";
- // obtain the workspace service by scanning its vftable
- WorkspaceVT = (WorkspaceVTable - 0x400000 + Base);
- Workspace = Memory::Scan(PAGE_READWRITE, (char*)&WorkspaceVT, "xxxx");
- if (strcmp(GetName(Workspace)->c_str(), "Workspace"))
- {
- std::cout << "Wrong Workspace instance! Quit Roblox and try again.";
- return;
- }
- // save the thing
- std::cout << "OK!\n[3/3] Dumping place to file... ";
- Terrain = GetChildByName(Workspace, "Terrain");
- //*(DWORD*)(Terrain + 0x22) = 0;
- //*(DWORD*)(Terrain + 0x34) = NULL;
- //RemoveTerrainFromWorkspace(Workspace);
- try
- {
- SetParentInstance((void*)Terrain, NULL, TRUE);
- Dump_Instance_Vector(RBXMX_Out, (std::vector<instance_shared_ptr>*)(Workspace + 0x2C));
- }
- catch (std::exception e)
- {
- std::cout << "An error occured while dumping: " << e.what() << "\n";
- return;
- }
- //Serialize_Instances(RBXMX_Out, *(std::vector<instance_shared_ptr>*)(Workspace + 0x2C), NULL);
- *(BYTE*)(&MessageBoxA) = 0xE9;
- *(DWORD*)((DWORD)&MessageBoxA + 1) = ((DWORD)&MessageBoxHook - (DWORD)&MessageBoxA) - 5;
- std::cout << "OK!\nDump successful!";
- RBXMX_Out.close();
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement