
Ok problem: I'm trying to change the landscape and portrait phototab but tehy are somehow dependent on one another
here''s the original:
-- Decompiled using luadec 0.4 by sztupy (http://winmo.sztupy.hu) -- Command line was: -l 14;0;; 35a10783_manila.luac trace("Album Landscape") require("Common\\LayoutInfo") _LayoutInfo = LayoutInfo() Album_ScreenRotation = class(RotationTemplate) local l_0_0 = Album_ScreenRotation l_0_0.__init = function(l_1_0, l_1_1) l_1_0._ResetLayoutCallback = l_1_1 trace("Album_ScreenRotation:__init later") RotationTemplate.__init(l_1_0) end l_0_0 = Album_ScreenRotation l_0_0.OnScreenRotation = function(l_2_0) Camera2DBegin.Viewport.value = RectF(0, 0, screenWidth, screenHeight - 2 * SystemTitlebarHeight) Camera2DBegin.ViewLeft.value = 0 Camera2DBegin.ViewRight.value = screenWidth Camera2DBegin.ViewTop.value = 0 Camera2DBegin.ViewButtom.value = -(screenHeight - 2 * SystemTitlebarHeight) Listview3DCamera.Viewport.value = RectF(0, 0, screenWidth, screenHeight - 2 * SystemTitlebarHeight) Listview3DCamera.ViewLeft.value = 0 Listview3DCamera.ViewRight.value = screenWidth Listview3DCamera.ViewTop.value = 0 Listview3DCamera.ViewButtom.value = screenHeight - 2 * SystemTitlebarHeight if _application.Orientation == ScreenOrientation_Portrait then trace("Album_ScreenRotation_Portrait") Listview3DCamera.CameraPosition.value = Vector3(0, 50, 415) ControlPanel2D.Position.x = 0 ControlPanel2D.Position.y = 0 ArrowGroups.Position.y = -322 KeyUpSprit.Position.y = 60 KeyUpSprit.Size.height = 130 InitPortraitConstant() else if _application.Orientation == ScreenOrientation_Landscape then trace("Album_ScreenRotation_Landscape") Listview3DCamera.CameraPosition.value = Vector3(0, 50, 224) ControlPanel2D.Position.x = 307 ControlPanel2D.Position.y = SystemTitlebarHeight ArrowGroups.Position.y = -272 KeyUpSprit.Position.y = 10 KeyUpSprit.Size.height = 80 RightBound = 674 PanoramaWidth = 344 PanoramaHeight = 120 PanoramaVWidth = 108 PanoramaVHeight = 176 PortraitWidth = 132 PortraitHeight = 176 LandscapeWidth = 200 LandscapeHeight = 150 WideLandscapeWidth = 250 WideLandscapeHeight = 150 ParaOff = 0 LOff = -5 WLOff = 0 POff = -7 VParaOff = -7 PhotoHitTarget.Position.x = 212 PhotoHitTarget.Position.y = -36 PhotoHitTarget.Size.width = 360 PhotoHitTarget.Size.height = 300
-- Decompiled using luadec 0.4 by sztupy (http://winmo.sztupy.hu) -- Command line was: -l 14;0;; 35a10783_manila.luac trace("Album Landscape") require("Common\\LayoutInfo") _LayoutInfo = LayoutInfo() Album_ScreenRotation = class(RotationTemplate) local l_0_0 = Album_ScreenRotation l_0_0.__init = function(l_1_0, l_1_1) l_1_0._ResetLayoutCallback = l_1_1 trace("Album_ScreenRotation:__init later") RotationTemplate.__init(l_1_0) end l_0_0 = Album_ScreenRotation l_0_0.OnScreenRotation = function(l_2_0) Camera2DBegin.Viewport.value = RectF(0, 0, 640, 480 - 2 * 50) Camera2DBegin.ViewLeft.value = 0 Camera2DBegin.ViewRight.value = 640 Camera2DBegin.ViewTop.value = 0 Camera2DBegin.ViewButtom.value = -(480 - 2 * 50) Listview3DCamera.Viewport.value = RectF(0, 0, 480, 640 - 2 * 50) Listview3DCamera.ViewLeft.value = 0 Listview3DCamera.ViewRight.value = 480 Listview3DCamera.ViewTop.value = 0 Listview3DCamera.ViewButtom.value = 640 - 2 * 50 if _application.Orientation == ScreenOrientation_Portrait then trace("Album_ScreenRotation_Portrait") Listview3DCamera.CameraPosition.value = Vector3(0, 50, 415) ControlPanel2D.Position.x = 0 ControlPanel2D.Position.y = 0 ArrowGroups.Position.y = -322 KeyUpSprit.Position.y = 60 KeyUpSprit.Size.height = 130 InitPortraitConstant() else if _application.Orientation == ScreenOrientation_Landscape then trace("Album_ScreenRotation_Landscape") Listview3DCamera.CameraPosition.value = Vector3(0, 50, 224) ControlPanel2D.Position.x = 307 ControlPanel2D.Position.y = SystemTitlebarHeight ArrowGroups.Position.y = -272 KeyUpSprit.Position.y = 10 KeyUpSprit.Size.height = 80 RightBound = 539 PanoramaWidth = 344 PanoramaHeight = 120 PanoramaVWidth = 108 PanoramaVHeight = 176 PortraitWidth = 132 PortraitHeight = 176 LandscapeWidth = 200 LandscapeHeight = 150 WideLandscapeWidth = 250 WideLandscapeHeight = 150 ParaOff = 0 LOff = -5 WLOff = 0 POff = -7 VParaOff = -7 PhotoHitTarget.Position.x = 212 PhotoHitTarget.Position.y = -36 PhotoHitTarget.Size.width = 360 PhotoHitTarget.Size.height = 300 end end
The new "fast guess" mode usually works very fine with _large_ scripts (more than 10k). For smaller ones the original mode usually gets better results, but smaller scripts have already been decompiled
Usage:
luadecguess -fg 1 filename
---------------------------------------------- 5 LOADK 0 3 next bool: 1 locals(1): 0{l_11_0} vpend(0): tpend(1): 0{l_11_0} () -- DECOMPILER ERROR: Overwrote pending register. Missing locals? Creating them local l_11_0 = "" ---------------------------------------------- 6 GETGLOBAL 1 4 Exps(0): at 3 dest 6 neg 1 (cityListSize < 10) cpd -1 Stored at endif list: <6>
Great information, I put everything into a debug file so I can look at the relevant information and see what's there. What I don't see though is where the crash occurred.
It spewed out a whole bunch of lines and then finished with the following on the screen
---------------------------------------------- 5 LOADK 0 3 next bool: 1 locals(1): 0{l_11_0} vpend(0): tpend(1): 0{l_11_0} () -- DECOMPILER ERROR: Overwrote pending register. Missing locals? Creating them local l_11_0 = "" ---------------------------------------------- 6 GETGLOBAL 1 4 Exps(0): at 3 dest 6 neg 1 (cityListSize < 10) cpd -1 Stored at endif list: <6>
Could you explain a little more, about how to add th numbers in the locals (that's what LDS is right?). I don't understand yet. As for the script, when I change the red values in the script it changes landscape size as well as portrait size. In that way dependent, and now I'm wondering how to change the landscape independently, so I hoped any of the more experienced scripters would know what I'm doing wrong, 12
SetSomeValues if Portrait then SetSomeValuesForPortrait else if Landscape SetSomeValuesForLandscape end
Album_ScreenRotation.OnScreenRotation = function(l_2_0) if _application.Orientation == ScreenOrientation_Portrait then trace("Album_ScreenRotation_Portrait") Camera2DBegin.Viewport.value = RectF(0, 0, 640, 480 - 2 * 50) Camera2DBegin.ViewLeft.value = 0 Camera2DBegin.ViewRight.value = 640 Camera2DBegin.ViewTop.value = 0 Camera2DBegin.ViewButtom.value = -(480 - 2 * 50) Listview3DCamera.Viewport.value = RectF(0, 0, 480, 640 - 2 * 50) Listview3DCamera.ViewLeft.value = 0 Listview3DCamera.ViewRight.value = 480 Listview3DCamera.ViewTop.value = 0 Listview3DCamera.ViewButtom.value = 640 - 2 * 50 Listview3DCamera.CameraPosition.value = Vector3(0, 50, 415) ControlPanel2D.Position.x = 0 ControlPanel2D.Position.y = 0 ArrowGroups.Position.y = -322 KeyUpSprit.Position.y = 60 KeyUpSprit.Size.height = 130 InitPortraitConstant() elseif _application.Orientation == ScreenOrientation_Landscape then trace("Album_ScreenRotation_Landscape") Camera2DBegin.Viewport.value = RectF(0, 0, 640, 480 - 2 * 50) Camera2DBegin.ViewLeft.value = 0 Camera2DBegin.ViewRight.value = 640 Camera2DBegin.ViewTop.value = 0 Camera2DBegin.ViewButtom.value = -(480 - 2 * 50) Listview3DCamera.Viewport.value = RectF(0, 0, 480, 640 - 2 * 50) Listview3DCamera.ViewLeft.value = 0 Listview3DCamera.ViewRight.value = 480 Listview3DCamera.ViewTop.value = 0 Listview3DCamera.ViewButtom.value = 640 - 2 * 50 Listview3DCamera.CameraPosition.value = Vector3(0, 50, 224) ControlPanel2D.Position.x = 307 ControlPanel2D.Position.y = SystemTitlebarHeight ArrowGroups.Position.y = -272 KeyUpSprit.Position.y = 10 KeyUpSprit.Size.height = 80 RightBound = 539 PanoramaWidth = 344 PanoramaHeight = 120 PanoramaVWidth = 108 PanoramaVHeight = 176 PortraitWidth = 132 PortraitHeight = 176 LandscapeWidth = 200 LandscapeHeight = 150 WideLandscapeWidth = 250 WideLandscapeHeight = 150 ParaOff = 0 LOff = -5 WLOff = 0 POff = -7 VParaOff = -7 PhotoHitTarget.Position.x = 212 PhotoHitTarget.Position.y = -36 PhotoHitTarget.Size.width = 360 PhotoHitTarget.Size.height = 300 end end
That code looks like:
SetSomeValues if Portrait then SetSomeValuesForPortrait else if Landscape SetSomeValuesForLandscape end
trace("Album Landscape") require("Common\\LayoutInfo") _LayoutInfo = LayoutInfo() Album_ScreenRotation = class(RotationTemplate) local l_0_0 = Album_ScreenRotation l_0_0.__init = function(l_1_0, l_1_1) l_1_0._ResetLayoutCallback = l_1_1 trace("Album_ScreenRotation:__init later") RotationTemplate.__init(l_1_0) end l_0_0 = Album_ScreenRotation l_0_0.OnScreenRotation = function(l_2_0) Camera2DBegin.Viewport.value = RectF(0, 0, screenWidth, screenHeight - 2 * SystemTitlebarHeight) Camera2DBegin.ViewLeft.value = 0 Camera2DBegin.ViewRight.value = screenWidth Camera2DBegin.ViewTop.value = 0 Camera2DBegin.ViewButtom.value = -(screenHeight - 2 * SystemTitlebarHeight)
if _application.Orientation == ScreenOrientation_Landscape then trace("Album_ScreenRotation_Landscape") Listview3DCamera.CameraPosition.value = Vector3(0, 50, 224) ControlPanel2D.Position.x = 307 ControlPanel2D.Position.y = SystemTitlebarHeight ArrowGroups.Position.y = -272 KeyUpSprit.Position.y = 10 KeyUpSprit.Size.height = 80 RightBound = 674
No, unfortunately the debug output of luadec doesn't write out the function number. only the opcode number (should fix that). The opcode number it crashed was 6 (it's the number before GETGLOBAL). For the function number, you have to turn back before the 1st opcode, where you find something like this: "121 CLOSURE", which means this function was defined at the 121th opcode in the main body. Now look ad the luadisasm'd output, where you find at the 121th opcode which function this was (0 based, so the 1st function will be Function #0... luadec is 1st based, so the first function will be #1 just to confuse everyone )
After that you'll want to only decompile this particular function. For example if this was the 5th function, then write for example
luadec -f 5 -l ;;;;;0,0,5 lua.luac
(as you see I've put 5 semicolons before the first number). You always have to put as many 0's as parameters the function have, then a number for each opcode where a local is defined as the appropriate register.
Main Block Parameters: 0 Last relevant lines: 379 [-]: CLOSURE R0 49 ; R0 := closure(Function #49) 380 [-]: SETGLOBAL R0 K171 ; OnMenuExit := R0 Last register: 0 Register assignment dump: R0: 0,1,4,7,10,13,15,18,22,24,26,28,30,32,34,36,38,40,42,44,46,48,51,53,55,57,59,61,63,65,67,69,71,75,80,84,87,89,91,94,97,100,102,105,107,109,111,113,115,117,119,121,123,125,127,129,131,133,135,137,139,141,143,145,147,149,151,153,155,157,159,161,163,165,167,169,172,182,192,195,198,201,203,205,207,209,212,214,216,219,223,226,231,233,240,242,245,247,249,255,258,262,265,268,271,273,275,277,279,281,283,285,287,289,292,294,300,304,308,310,316,320,323,327,329,333,335,339 R1: 0,2,5,8,11,85,92,95,98,103,196,199,215,224,227,234,237,266,269,305,321,324,330,336 R2: 0,20,77,82,174 R3: 0,21,175,178 R4: 0,179,189,230,298,314 R5: 0,177,187
So when I look for the line similar to the "121 closure" is this in the output of the luadec or luadecguess? I couldn't find anything like that at the begining of the luadec output, but found this at the begining of the luadecguess output,
Main Block Parameters: 0 Last relevant lines: 379 [-]: CLOSURE R0 49 ; R0 := closure(Function #49) 380 [-]: SETGLOBAL R0 K171 ; OnMenuExit := R0 Last register: 0 Register assignment dump: R0: 0,1,4,7,10,13,15,18,22,24,26,28,30,32,34,36,38,40,42,44,46,48,51,53,55,57,59,61,63,65,67,69,71,75,80,84,87,89,91,94,97,100,102,105,107,109,111,113,115,117,119,121,123,125,127,129,131,133,135,137,139,141,143,145,147,149,151,153,155,157,159,161,163,165,167,169,172,182,192,195,198,201,203,205,207,209,212,214,216,219,223,226,231,233,240,242,245,247,249,255,258,262,265,268,271,273,275,277,279,281,283,285,287,289,292,294,300,304,308,310,316,320,323,327,329,333,335,339 R1: 0,2,5,8,11,85,92,95,98,103,196,199,215,224,227,234,237,266,269,305,321,324,330,336 R2: 0,20,77,82,174 R3: 0,21,175,178 R4: 0,179,189,230,298,314 R5: 0,177,187
Tags |
lua, manila, mod, tf3d, touchflo |
Thread Tools | Search this Thread |
Display Modes | |
|