yashsingh1/xdaforums huggingface dataset:
[Windows Mobile Development and Hacking General] B4PJS:
Here is the code snippet that is causing the error

ListImageLoaderClass.LoadNextImage = function(l_10_0)
repeat
-- DECOMPILER ERROR: Confused about usage of registers, missing locals? Creating them

local l_10_1 = l_10_0.Current + 1
if l_10_0.Current + 1 <= l_10_0.Last then
l_10_0.Current = l_10_1
-- DECOMPILER ERROR: Confused about usage of registers, missing locals? Creating them

local l_10_2 = l_10_0.Queue[l_10_0.Current]
-- DECOMPILER ERROR: Confused about usage of registers, missing locals? Creating them

local l_10_3 = l_10_2.Data
if l_10_0.Queue[l_10_0.Current] ~= nil then
if l_10_2.Data.IsRealized == true then
l_10_0.AsyncLoader:BeginLoadFile(l_10_3.ImagePath, true)
return
else
l_10_0.Queue[l_10_0.Current] = nil
end
end
l_10_1 = l_10_1 + 1
else
-- Warning: missing end command somewhere! Added here
end
-- Warning: missing end command somewhere! Added here
end
end
[Windows Mobile Development and Hacking General] 12aon:
Attach the file for me, but this kind of output is normal, from here on out you will have to manually correct the the files until compare says it's the same as is non decompiled counterpart. 12
[Windows Mobile Development and Hacking General] B4PJS:
Here are the two scripts that have the same error. For now I have just hacked the opera 9.7 cab to install to the normal location, but if I can get this done maybe I can put something together that means people can use different browsers with manilla :)
[Windows Mobile Development and Hacking General] smotrs:
Need the RAW manila files, not the LUA files. Otherwise we have nothing to compare too. :)
[Windows Mobile Development and Hacking General] B4PJS:
They are just the standard tf3d2 manillas of the same name... I thought everyone had a copy!
[Windows Mobile Development and Hacking General] Fredz:
Need help on lua language

I would like to modify the value of an other mode9 file, but i don't know how to do.

The modification must be in the music lua file (_Embedded/3.lua):

Landscape_up_btn_group._visible = true

But this variable is declared in the manila.mode9.xml file.

Can someone help me ?
[Windows Mobile Development and Hacking General] 12aon:
Everything that's in the lua overwrite's what's in the the mode9. So if it does not change when you edit it in the mode9 (I recommend trying the m9editor) than it's probably in the lua.

I can probably remember a few things about the scripts though what are you trying to accomplish?

12
[Windows Mobile Development and Hacking General] smotrs:
Depends on which phone the file came from. Each phone may have the same file, but not the same code within depending on what's changed from one phone to the next.

Are you referring to the Rhodium files that sztupy graciously decompiled for everyone? If so, then the decompiled LUA files should be in that package he uploaded. You would use a normal text editor program to modify them and the LUA compiler to recompile the modified code.

The m9editor will only give you a basic visual of the code, not the actual code. It also won't allow you to make changes to the LUA files, only mode9 files.
[Windows Mobile Development and Hacking General] :
okay, needing some help with this file. no idea what is messed up with it. I am getting different results on different things I do.

comparing it to the decompile rhodium files, it seems to be almost an exact match, for layout anyways, the locals are different, but aside from that everything is the same, and I am still getting a bunch of messed up stuff.

So if somone has time, and let me know what I did wrong it would be great.

The log file, my attempt to decompile it, and the manila file are all attached. so take a look
[Windows Mobile Development and Hacking General] B4PJS:
The m9editor does actually decompile the files for you and allow you to replace the files when you are finished editing. The manila files are for the Touch PRo form XBoxmods port.
[Windows Mobile Development and Hacking General] 12aon:
Yes it does but it relies on luadec 1.0 which is not as good at decompiling as the newer luadec 2.0. I use the m9editor to separate lua from the other files and do the proper decompiling in my kitchen. Sztupy decompiled the files used for the rhodium port and you can find them at his site, 12
[Windows Mobile Development and Hacking General] B4PJS:
Cheers Bro, will check it out :)
[Windows Mobile Development and Hacking General] 12aon:
The main block is different??? I don't really know what that means, never saw that before....
[Windows Mobile Development and Hacking General] :
Where there is something like this. the 1.699999... is that the correct number, or is it becuase HTC uses a different standard, and these numbers need to be cahnged to the correct conversion has well?

else
if l_2_0._application.Orientation == ScreenOrientation_Landscape then
l_2_2.Scale = Vector3Property(Vector3(1.6999969482421875, 1, 1))
end
[Windows Mobile Development and Hacking General] :
and if this is all I have in my Log file for errors, do I need to worry about fixing this?

Function 2:
1>175 [-]: EQ 0 R2 K66 ; if R2 ~= true then PC := 196
2>175 [-]: EQ 0 R2 K66 ; if R2 ~= true then PC := 204
1>176 [-]: JMP 196 ; PC := 196
2>176 [-]: JMP 204 ; PC := 204
1>189 [-]: EQ 0 R2 K66 ; if R2 ~= true then PC := 204
2>189 [-]: EQ 0 R2 K66 ; if R2 ~= true then PC := 196
1>190 [-]: JMP 204 ; PC := 204
2>190 [-]: JMP 196 ; PC := 196
Opcodes in original: 220
Same lines in both files: 216 98%

The way I read this, is that I have condionals, but that not to care about them, if I do not have anything else in the file to fix. or am i wrong on this has well.

CONDITIONALS!

99 out of 100 cases you will HATE them!

Usually if the only difference between the original and the decompiled script is the location
where they jump (the PC:=xxx part)then don’t care about them, unless you have fixed
the rest of the script (I mean the locals). If there are only conditional statements left,
then you will have a hard time guessing how this have to be done. Usually this means
the structure of the conditionals are not right. For example instead of

What is the proper way to handle the Repeat log?

LvMessages.ClearCollection = function(l_17_0)
local l_17_1 = l_17_0.collection:GetCount()
repeat
if l_17_1 > 0 then
l_17_0.collection:pop_back()
l_17_1 = l_17_1 - 1
end
end

convert this to?

LvMessages.ClearCollection = function(l_17_0)
local l_17_1 = l_17_0.collection:GetCount()

while l_17_1 > 0 do
l_17_0.collection:pop_back()
l_17_1 = l_17_1 - 1

end
[Windows Mobile Development and Hacking General] :
Well I have 155 of the Tachi Scripts decompiled. I am still getting confused on some of the bootlean error codes. and a few others.

its not an easy concept to get understand, so I am doing my best, 82 to go, and then I start on the embedded ones. this is going to be fun.
[Windows Mobile Development and Hacking General] colonel00:
Does anyone happen to know where the control is for the page length in the "people" tabs? For example, in peoplemessaging on a vga device, the last two lines/messages fall down behind the input box and menubar. I would like to move this up but cannot find where this is handled.
[Windows Mobile Development and Hacking General] epapas:
Menu Left Soft KEy

Hi

I am running a ROM with the TF3D2 V1E. There in the call history when I press menu I get a dim screen and everything is stuck.

I used m9 editor to find possible solution. So I found in the 771fb99e_manila the following snippet

RSKFunction_Callback = function()

dialogThing = _application.DialogManager:GetDialog(URL("Manila://PeopleCallLog.dialog"))

dialogThing.OnExit:connect(DialogMenu_Callback)

dialogThing:Show()

end

So what is Manila://PeopleCallLog.dialog? Is it in another file? Is it XML?

Any hint would be aprreciated. Thanks!!!
[Windows Mobile Development and Hacking General] 12aon:
Latest kitchen

I've been prepping a fully automated decompiling (and anything else realated to lua) kitchen. It decompiled as many lua files as you'd like at once. Also it's based on to keeping the original files names know at any times so it won't ever be confusing which files you work with. It automatically creates a scripts library from the successfully decompiled files (sztupy's tools of course) and it makes it real easy to get the embedded lua files from the mode9 in there as well. The only thing that you'll need to do is work on the scripts which luadec didn't fully decompile. Anyway check out this lean mean decompiling machine over here
[Windows Mobile Development and Hacking General] tkiela:
Hey there.

Is there any way to decompile a *.lub-File?

Everytime I try decompiling it with LuaTool or luadec.exe, the executeable crashes.

Why?

I uploaded an example file.

Thanks for help.
[Windows Mobile Development and Hacking General] 12aon:
Wrong thread, Sztupy hasn't been around for a while you should ask Co0kiemonster instead,

12
[Windows Mobile Development and Hacking General] guenthar:
I downloaded luadec today so that I can decompile a script from a game. I disassembled the script successfully but when I go to decompile it I get "unexpected symbol near ';'" and it doesn't do anything. I tried the debugging feature and it comes up with the same error.

Thank you
[Windows Mobile Development and Hacking General] hilaireg:
Have a look at these two threads:

Thread: http://xdaforums.com/showthread.php?t=528548

Thread: http://xdaforums.com/showthread.php?t=568281

HTH,
[Windows Mobile Development and Hacking General] sentinel80:
Problem with decompile 53cc1e4f_manila

Hi!

I have problem with decompile 53cc1e4f_manila this files is from Manila_2_1_19201317_0.

If i want decompile, i get three files:

53cc1e4f_manila.lua

53cc1e4f_manila.dis.lua

53cc1e4f_manila.error.txt

In error i see this message: LuaDec: 53cc1e4f_manila.lua:215: function arguments expected near 'l_15_8'

Anybody pls help me.
[Windows Mobile Development and Hacking General] 12aon:
Take a look inside this thread:

http://xdaforums.com/showthread.php?t=528548

This is an older version of the manila kitchen by Sztupy which relies upon an earlier version of the decompiler.

What those files mean is described in the thread above but I'll give you a quick answer. Do keep in mind that what you are trying to do most likely is a lot harder than you might think it is.

53cc1e4f_manila.lua -> this is a .lua file which handles some of the operations inside Sense\TF3D (right now it's not useble since there are still errors in this script)

53cc1e4f_manila.dis.lua -> This is the output from the dissembler, you can use this to see the order in which the script is processed

53cc1e4f_manila.error.txt -> This file tells you where to look for the error inside the .lua script

After you have fixed the error run the kitchen again with the "-CMP" switch to see if you have fixed that part of the lua script. Keep repeating this until there is no more error.txt,

12
[Windows Mobile Development and Hacking General] Akademik:
Hi!

I have problem with decompile strings_db.lua:(

If i want to decompile, i get error:

luadec: strings.lua: bad header in precompiled chunk

or

Input is not a valid LUAC file.

Can you help me please.
[Windows Mobile Development and Hacking General] plopper:
source code of luadec

saw that sztupy hasn't been around for a while and i wanted the decompiler for linux.

so i googled a bit and found his page on luaforge.

plopper
[Windows Mobile Development and Hacking General] sztupy:
I'm around, I'm just not working on this anymore.
[Windows Mobile Development and Hacking General] Gee Force:
I'm sorry to bump such an old thread, But I really need to decompile a lua script but the executable crashes on me, this seems to happen to anything big. Does anyone want to spare a few minutes and give a crack at trying to decompile this script for me? I'd really appreciate it.
[Windows Mobile Development and Hacking General] hilaireg:
Have a look at this thread:

http://xdaforums.com/showthread.php?t=528548

You will find newer tools, additional reference web links, and some XDA social groups which focus on modding Manila.

Cheers,
[Windows Mobile Development and Hacking General] umare4388:
I wand to get open source from dll file which made in C++.

Can any one help me to disassembly and de compile and decode. Interested can mail me to umaresuresh@gmail.com
[Windows Mobile Development and Hacking General] szilamer:
:( After making a lua script with this utility, I got this message:

dynamic libraries not enabled; check your Lua installation

My lua script:

a,b,c = package.loadlib("\\Windows\\extension2.dll", "libinit")

SomeText.String = b

I managed to output this message to the internet tab by slightly modifying

Calendar's lua and mode9 file ..

It would be great to have this dll loading feature :(
[Windows Mobile Development and Hacking General] sztupy:
Unfortunately not, it is disabled. I'm trying to do a workaround of this issue, but this takes time.
[Windows Mobile Development and Hacking General] xboxmod:
Great Work !

you are a master

this is really a good news for TF3D customisation

i try it now thanks a lot.

i've send 20 euro on your paypal account to support your work & I encourage

user of your tools to do the same.

you have made a really impressive work.

congratulation

bye
[Windows Mobile Development and Hacking General] szilamer:
Wow, this was a really fast workaround :) , thank you

I will try your sdk and patch asap.
[Windows Mobile Development and Hacking General] 6Fg8:
OMG that makes me speechless, will try that soon. Once again, awesome work!
[Windows Mobile Development and Hacking General] 12aon:
I have no manila2.exe so I'm guessing you meant manila.exe. I didn't unsight the files before I patched them, I know for icon changing this has to be done for dlls to work. Also have install SDKcerts.cab but I don't know if that is the same here. I patched the files for the raph manila, so if anybody can use them (haven't had time to test myself) here they are, 12

Edit: Removed Files
[Windows Mobile Development and Hacking General] sztupy:
been working on it for 1,5 weeks :) had some nightmares too...
[Windows Mobile Development and Hacking General] sztupy:
I only have the "HD manila" which has both a manila.exe and a manila2.exe, but only manila2.exe needs the patch. Need to test it with other versions too, hope it works with them too.

To try out whether ExtLua really works, I attached a zip file with the compiled demo dll, a modified manila file and a registry entry. If you do not use HDManila1.8.5c, then please try it out (make a backup of 4aefb03d_manila first though). If it does make a soft reset after clicking an image in the photo tabs, then it works.

Installation: disable M3D/copy all files to device/add registry entry/soft reset/enable M3D
[Windows Mobile Development and Hacking General] 12aon:
Thanks, will test. The files I patched were causing the manila to restart. Will unsign and patch again, 12
[Windows Mobile Development and Hacking General] xboxmod:
Hi

Manila2.exe is only on XBMOD HD Manila because hd manila need a loader to launch on diamond.

if you use another Manila Version patch Manila.exe
[Windows Mobile Development and Hacking General] sztupy:
Found out the bug in raphaels stock M3D. it seems lua.dll was changed in the HD version, and aul.dll only works with that. Replacing lua.dll did the job. I modified the zip file to hold both lua.dll and aul.dll, and provided an installer cab for Raphael's M3D version 1813.6. There is also an automatic Manila patcher to ease the job of hexediting/resigning.

Unfortunately M3D for manila doesn't have a 4aefb03d_manila file, but I patched 190f7f60_manila to soft reset the device when the camera button is pressed if you'd like to test ExtLua out.

DL link as usual: http://winmo.sztupy.hu/luadec.html
[Windows Mobile Development and Hacking General] 12aon:
Thanks a lot, but it complaints about system permissions and won't install the cab. Does the same with my modified cab (properly unsigned and signed). Any idea's?
[Windows Mobile Development and Hacking General] sztupy:
Is TouchFlo 3D disabled?
[Windows Mobile Development and Hacking General] 12aon:
Now you are just making me look silly:D. It worked soft resetted as it should, whohee! I lost every single image in the manila though:). You the man!

I'm going to uninstall because functionality is crappy like this, unless you anything else to try out for me, 12
[Windows Mobile Development and Hacking General] sztupy:
If you'd only uninstall the 190f7f60_manila and keep everything else that'd be great (to test stability). If you find it unstable then please tell, and uninstall the whole package.
[Windows Mobile Development and Hacking General] 12aon:
Do I need to keep the reg settings too? Because if not, I have blanks for every image in the manila (landscape has some images but I'm messing with that so might have something to do with that). So no images is a little mesy but if you have a solution sure I'll keep it on, 12
[Windows Mobile Development and Hacking General] sztupy:
Well, that is a bug, so disable the whole thing for now.
[Windows Mobile Development and Hacking General] 12aon:
Do you know anything about hex editing, I'm trying to change a couple of links in one of the lua scripts but no matter how right it seems it keeps crashing the landscape. Is it possible to do is that way or is there another possibility of changing a script that cannot be fully decompiled? 12
[Windows Mobile Development and Hacking General] sztupy:
If one would do a reassembler for lua then these kind of things could be changed easily, but I've never heard of one (saw on a forum, that someone is making one, but no links/DL yet)
[Windows Mobile Development and Hacking General] 12aon:
So no luck with the hex editor then? I wonder how people change the other lua files they do? I wish I was smart and stuff:D
[Windows Mobile Development and Hacking General] sztupy:
you can hexedit it, but it can break things if done incorrectly.
[Windows Mobile Development and Hacking General] smotrs:
Heh, that's an understatement. :)
[Windows Mobile Development and Hacking General] pcarvalho:
very nice work being done here :)

hex editing is...#!%&%/...not easy :D

so any more progress in full decompiling tf3d lua? i'm waiting on this one cause then i'll be able to make the QVGA port final...and then start making new things...

thanks and keep it up ;)
[Windows Mobile Development and Hacking General] sztupy:
I've put that project a bit aside because of the other, but I get back to it.
[Windows Mobile Development and Hacking General] smotrs:
Well, were looking forward to any progress you make. Keep up the good work and hope your current project is going well. :)
[Windows Mobile Development and Hacking General] sztupy:
LuaDec beta 0.3

LuaDec beta 0.3 released

Fixed bugs:

- OP_TFORLOOP is fixed

- loop variable handing is fixed

New features:

- added command line options to handle local variables

With this version you are able to tell luadec where to declare local variables. The format is the following: -l LDS, where LDS stands for "Local Description String". It contains numbers which describe on which opcode should luadec declare a new local variable. ; separates functions and , separates registers. For example -l ;0,2 will mean to declare the first register as a local variable in the first function.

For example to decompile 4692e326_manila succesfully you have to use "-l 4,5;;0,0,10,11;0,0,8" (this will declare 5 local variables in different points of the scrfipt).

I attached some succesfully decompiled scripts (from the stock Raphael TF3D), namely:

01d9e30a_manila.lua
075987ec_manila.lua
0d465002_manila.lua
1f2972b4_manila.lua
283226d1_manila.lua
42b71610_manila.lua
4692e326_manila.lua
584477c0_manila.lua
5e085a76_manila.lua
5e8e48df_manila.lua
5f880c80_manila.lua
6efe8603_manila.lua
71552a24_manila.lua
7564a2d6_manila.lua
77faa36d_manila.lua

I also added a patch file, which will show what you have to patch to get to the (almost) correct decompilation (success rate is _very_ high if you know where to declare locals)

Because determining where to declare locals is tiresome suspected features for next version will be:

- Upvalue handling

- Heuristics to detemine where to add local variables

I've just DL'ed the leaked TP2 TF3D files, so I think I start to work on decompiling that next.
[Windows Mobile Development and Hacking General] 12aon:
Could you elaborate on the local variables, what are they or do they do? Where can I find what these locals are supposed to be? I didn't come across any decompiling errors, nice work man! Thanks a lot for making all this possible, 12

Edit: Maybe you could explain using the manila_file I'm trying to change (you can find a copy here here). Just tell me if I'm asking to much of you, 12
[Windows Mobile Development and Hacking General] sztupy:
usually all variables are global in lua. So for example if you have a line like

Something = 0

you assign 0 to the global variable called Something. Fortunately the names and positions of global variables are known from the compiled lua script

local variables however are simply registers in a function, and they are not stored in the compiled script explicitly, so if someone writes

local Something = 0

then this variable will not be visible in the compiled version. Unfortunately to succesfully decompile something one has to know where the original user put these local declarations. Fortunately this can be "brute-forced" out in a lot of smaller scripts, and I'm having good progress on this.

Q: what do you want to do with that manila file?
[Windows Mobile Development and Hacking General] smotrs:
So is there anyway to resolve the, "-- Warning: missing end command somewhere! Added here" errors or warnings? Or do they not affect the re-compiling if the variables are in place?
[Windows Mobile Development and Hacking General] sztupy:
if the variables are in place then most of the time there aren't any warinigs or decompilation errors. Currently I'm running a brute force decompilation on the 365 script (both embedded and separate) files from TP2's manila. 89 scripts were already processed and from them 39 have been succesfully decompiled (which means that recompiling them will result in the original file).

Because lua stores functions in the luac file separately they can be decompiled separately, but compiling the script can only be done is everything is fine. For the other scripts (50 from 89) 75% of the functions are decompiled succesfully, and the others have to be corrected manually (usual errors are missing or misaligned "end"-s and of course missing local declarations). After manual correction these scripts should recompile to the same too.

I'm doing the check whether the recompiled files are the same using the compare script I attached earlier. It uses disasm's output to check whether the disassembly of the two files are the same EXCEPT for the line numbering information (that doesn't change anything semantically). Nothing else matters. If the disassembly is the same then the script will do the same so it doesn't matter whether there are any warnings or any other decompilation "errors" in the output.
[Windows Mobile Development and Hacking General] 12aon:
I see so I sit tight until you unleash the (brute) beast:). I'm trying to change a couple of links in my landscape menu and create names that are longer than the ones used now, because I can't use the hex editor to create new values. Like the GeckoApSt -> Gecko Appstore and I don't like the name home shortcuts and email shortcuts. I'm also using another dialer that the standard one so the Shell_localDialer link is useless. Things like that, and just change things to see what happens:), 12

EDIT: I attached the file with a couple of my edits in it already