Skip to content

Commit 90944ee

Browse files
committed
added some basic instructions
1 parent 4d9e18a commit 90944ee

File tree

3 files changed

+193
-0
lines changed

3 files changed

+193
-0
lines changed

Diff for: CSharpObjectForLogin.lua

+144
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,144 @@
1+
CSharpObjectForLogin = class('CSharpObjectForLogin')
2+
3+
CSharpObjectForLogin.ins = nil
4+
function CSharpObjectForLogin:Ins()
5+
if CSharpObjectForLogin.ins == nil then
6+
CSharpObjectForLogin.ins = CSharpObjectForLogin.new()
7+
end
8+
return CSharpObjectForLogin
9+
end
10+
11+
local goGameRoleReadyForLogin = nil
12+
local transCamera = nil
13+
local cameraController = nil
14+
15+
function CSharpObjectForLogin:Initialize(completeCallback)
16+
self:GetObjects()
17+
18+
if ObjectsIsGetted then
19+
if completeCallback ~= nil then
20+
completeCallback()
21+
end
22+
else
23+
if self.tick == nil then
24+
self.tick = TimeTickManager.Me():CreateTick(0, 500, self.OnTick, self, 1)
25+
end
26+
self.completeCallback = completeCallback
27+
end
28+
end
29+
30+
function CSharpObjectForLogin:GetCameraController()
31+
return cameraController
32+
end
33+
34+
function CSharpObjectForLogin:GetTransCamera()
35+
return transCamera
36+
end
37+
38+
function CSharpObjectForLogin:Release()
39+
transCamera = nil
40+
cameraController = nil
41+
42+
GameObject.Destroy(goGameRoleReadyForLogin)
43+
goGameRoleReadyForLogin = nil
44+
end
45+
46+
function CSharpObjectForLogin:Reset()
47+
self:Release()
48+
end
49+
50+
function CSharpObjectForLogin:OnTick()
51+
self:GetObjects()
52+
53+
if self:ObjectsIsGetted() then
54+
TimeTickManager.Me():ClearTick(self, 1)
55+
self.tick = nil
56+
57+
if self.completeCallback ~= nil then
58+
self.completeCallback()
59+
end
60+
end
61+
end
62+
63+
function CSharpObjectForLogin:GetObjects()
64+
goGameRoleReadyForLogin = GameObject.Find('GameRoleReadyForLogin(Clone)')
65+
if goGameRoleReadyForLogin ~= nil then
66+
transCamera = goGameRoleReadyForLogin.transform:Find('Camera')
67+
local transCameraController = goGameRoleReadyForLogin.transform:Find('CameraController')
68+
cameraController = transCameraController:GetComponent('CameraControllerForLoginScene')
69+
end
70+
end
71+
72+
function CSharpObjectForLogin:ObjectsIsGetted()
73+
return goGameRoleReadyForLogin
74+
end
75+
76+
function resetForLoginUnity()
77+
78+
end
79+
80+
autoImport("Table_MainViewButton")
81+
Table_MainViewButton[#Table_MainViewButton + 1] = {
82+
id = #Table_MainViewButton + 1,
83+
name = "Shalzuth",
84+
icon = "setup",
85+
panelid = 630,
86+
redtiptype = _EmptyTable,
87+
Enterhide = _EmptyTable
88+
}
89+
90+
TEXT_COMMANDS = TEXT_COMMANDS or {}
91+
TEXT_COMMANDS["@test"] = function(params)
92+
local f = io.open("/data/local/tmp/script/rom.lua")
93+
local s = f:read("*a")
94+
f:close()
95+
local f2 = loadstring(s);
96+
if f2~=nil then
97+
local status, err = pcall(f2);
98+
if status == false then
99+
if UIUtil ~= nil then
100+
UIUtil.FloatMsgByText(err);
101+
end;
102+
return false;
103+
else
104+
if UIUtil ~= nil then
105+
UIUtil.FloatMsgByText("Success");
106+
end;
107+
return true;
108+
end;
109+
else
110+
if UIUtil ~= nil then
111+
UIUtil.FloatMsgByText("File failed to load");
112+
end;
113+
return false;
114+
end;
115+
return
116+
end
117+
118+
autoImport("ChatSystemManager")
119+
function ChatSystemManager:CheckChatContent_Hook(msg)
120+
if msg == "" then
121+
return
122+
end
123+
local is_command = false
124+
local commands = StringUtil.Split(msg, ";")
125+
for k, v in pairs(commands) do
126+
local first_char = string.sub(v, 1, 1)
127+
if first_char == "@" or first_char == "#" or first_char == "/" then
128+
v = string.lower(v)
129+
local params = StringUtil.Split(v, " ")
130+
local cmd = string.gsub(params[1], "[#|/]", "@", 1)
131+
local status, error = pcall(TEXT_COMMANDS[cmd], params)
132+
if not status then
133+
local err = string.format("ERROR EXECUTING CMD: %s\n\nERROR CODE: %s", cmd, error)
134+
TipsView.Me():ShowGeneralHelp(err, "Information")
135+
else
136+
pcall(SETTINGS_SAVE)
137+
end
138+
is_command = true
139+
end
140+
end
141+
return is_command and true or self:CheckChatContent_Orig(msg)
142+
end
143+
ChatSystemManager.CheckChatContent_Orig = ChatSystemManager.CheckChatContent_Orig or ChatSystemManager.CheckChatContent
144+
ChatSystemManager.CheckChatContent = ChatSystemManager.CheckChatContent_Hook

Diff for: README.md

+10
Original file line numberDiff line numberDiff line change
@@ -1 +1,11 @@
11
# ROMEncryption
2+
3+
The Unity dll's are XOR'd, and then the main one has some weird encryption on the .text section. I didn't care to figure it out, but you can hardcode the pointer to correct it, and then decompile it with a .NET decompiler.
4+
5+
The Lua scripts are within the .unity3d files - you will need a .unity3d extractor to dump the raw blobs. The binary blobs can then be decrypted with ROM's custom DES cipher as seen in ROMDesCipher.cs
6+
7+
All the Lua scripts were also dumped to https://github.com/shalzuth/rom_files
8+
9+
This can be used to decrypt/re-encrypt the main login Lua script at login/CSharpObjectForLogin.lua, then re-encrypt with the same function, push it back into the unity3d file, then voila! You have Lua scripting within ROM.
10+
11+
I also included an example modified [CSharpObjectForLogin.lua](https://github.com/shalzuth/ROMEncryption/blob/master/CSharpObjectForLogin.lua#L90-L144) that will load whatever Lua script is at "/data/local/tmp/script/rom.lua" and execute it. Additionally, I've included a [rom.lua](https://github.com/shalzuth/ROMEncryption/blob/master/rom.lua) to show basic functionality of zoom hack, removing fog, and setting the FPS.

Diff for: rom.lua

+39
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
-- CameraController.singletonInstance.zoomMin = 0.1;
2+
-- UnityEngine.Application.targetFrameRate = 60.0;
3+
-- RenderSettings.fog = false;
4+
5+
if DebugLog == nil then
6+
DebugLog = {};
7+
DebugLog.File = io.open("/data/local/tmp/script/rom.log", "a");
8+
DebugLog.Write = function(data)
9+
DebugLog.File:write(os.date("%x %X") .. ' ' .. data .. "\n");
10+
DebugLog.File:flush();
11+
end;
12+
end;
13+
if Game~=nil and Game.me~=nil then
14+
DebugLog.Write(tostring(Game.me));
15+
end;
16+
17+
function SetFrameRate(fps)
18+
UnityEngine.Application.targetFrameRate = fps;
19+
end;
20+
21+
function ZoomHack(apply)
22+
if apply then
23+
CameraController.singletonInstance.zoomMin = 0.1;
24+
else
25+
CameraController.singletonInstance.zoomMin = 0.7;
26+
end
27+
end;
28+
29+
function RemoveFog()
30+
RenderSettings.fog = false;
31+
end;
32+
33+
ZoomHack(true);
34+
RemoveFog();
35+
SetFrameRate(60.0);
36+
37+
38+
DebugLog.Write("loaded");
39+

0 commit comments

Comments
 (0)