yashsingh1/xdaforums huggingface dataset:
[Windows Mobile Software Development] Co0kieMonster:
The misc category would be: fixes to some mishandled breaks and loop endings, indents not behaving properly in some cases, and I'm still looking to fix anything left wrong with conditionals and loops so that should all be close to 100% good by with v3.1.

I'm also modifying the compiler a bit. yozgatg found a loop that seems to use a continue statement. Lua doesn't officially support continue statements, but HTC probably added it for their needs. So I'm adding the same thing to our compiler.

"K" represents a constant. The right part of the disassembly decodes the constant automatically. In your case:

SETTABLE R0 K39 K24 ; R0["GroupAppointment1"] := nil
K39 == GroupAppointment1
K24 == nil

The K values are numbered as they appear in the source lua file. E.g.:

Source:

PeopleFrom = {All = 1, Device = 2, SIM = 3, Updated = 4}

Compiled:

0 [-]: NEWTABLE R0 0 4 ; R0 := {}
1 [-]: SETTABLE R0 K1 K2 ; R0["All"] := 1
2 [-]: SETTABLE R0 K3 K4 ; R0["Device"] := 2
3 [-]: SETTABLE R0 K5 K6 ; R0["SIM"] := 3
4 [-]: SETTABLE R0 K7 K8 ; R0["Updated"] := 4
5 [-]: SETGLOBAL R0 K0 ; PeopleFrom := R0

Even though "PeopleFrom" is mentioned last in the compiled opcodes it's aliased as the first constant K0. That's because it's first in the uncompiled source code.

Now, if we change the source to something like this:

local l_0_0 = {All = 1, Device = 2, SIM = 3, Updated = 4}
PeopleFrom = l_0_0

The compiled opcodes become this:

0 [-]: NEWTABLE R0 0 4 ; R0 := {}
1 [-]: SETTABLE R0 K0 K1 ; R0["All"] := 1
2 [-]: SETTABLE R0 K2 K3 ; R0["Device"] := 2
3 [-]: SETTABLE R0 K4 K5 ; R0["SIM"] := 3
4 [-]: SETTABLE R0 K6 K7 ; R0["Updated"] := 4
5 [-]: SETGLOBAL R0 K8 ; PeopleFrom := R0

In this case "PeopleFrom" is the last constant K8, because it appears last in the uncompiled source. Local variable names ("l_0_0" in this case) are not saved as constants or anything else so you won't see then in the disassembly.

Oh, and the constants are assigned K values only the first time they are found, and after that the same K is reused. So:

PeopleFrom = {All = nil, Device = nil, SIM = nil, Updated = 938}

Compiled:

0 [-]: NEWTABLE R0 0 4 ; R0 := {}
1 [-]: SETTABLE R0 K1 K2 ; R0["All"] := nil
2 [-]: SETTABLE R0 K3 K2 ; R0["Device"] := nil
3 [-]: SETTABLE R0 K4 K2 ; R0["SIM"] := nil
4 [-]: SETTABLE R0 K5 K6 ; R0["Updated"] := 938
5 [-]: SETGLOBAL R0 K0 ; PeopleFrom := R0
[Windows Mobile Software Development] kinnyfaifai:
@ co0kiemonster, many thanks for the explanation. :D

I got a long way to go yet then to be able to fix lua scripts. But i'll stick at it. :)
[Windows Mobile Software Development] yozgatg:
cookiemonster, did you find a way to implement a continue function to be used for "for" loops in the upcoming release?
[Windows Mobile Software Development] Co0kieMonster:
Yes, I just did that :)

I tested it with the file you sent me and with the "continue" it gets a 100% compare match.

I'm hoping to get 3.1 finalized and released later today. If by chance I don't make it I'll post a beta version in the Manila And XML GUI group.
[Windows Mobile Software Development] miammiam:
hi all,

i try to edit this file, for changing the bookmark target(Windows/opera9 to Windows/opera9/profile)

i had decompil with "luatool /d 3fb3a68c_manila"(55.8kb)

i have 3 files:

_3fb3a68c_manila.cmp.lua

_3fb3a68c_manila.dis.lua

_3fb3a68c_manila.lua

modified my target in 3 files and compile with "luatool /c 3fb3a68c_manila.lua"

a file "3fb3a68c_manila.luac"(56kb) are created, rename 3fb3a68c_manila in my kitchen; but when i flash my device=don't work the tab not start...

why?

ps: sorry for the bad english.
[Windows Mobile Software Development] Co0kieMonster:
LuaTool v1.1 released.

Changes: updated LuaDec to v3.1, LuaC to v1.1 and LuaCompare to v1.2.

LuaDec 3.1

: The main improvement for this version is a new way of handling complex logic expressions (e.g. "A and B and (C or D and E)"). It also has some minor conditional handling fixes, as well as general improvements - see full changelog.

LuaC 1.1

: Added the "continue" statement to the Lua Compiler.

Lua doesn't officially support continue statements, but it looks like HTC added it for their needs, so I'm following their lead.

LuaCompare 1.2

: Pre-compare disassembly is now done internally instead of writing to disk and reading (generally a better idea). Also added a console message with match percentage.
[Windows Mobile Software Development] miammiam:
"decompile succes 94%"....?
[Windows Mobile Software Development] Co0kieMonster:
If you get 3 output files after decompile that means the decompile wasn't 100% correct and you have to manually fix it. The cmp.lua file is the compare output and dis.lua is the disassembly. See sztupy's tutorial for tips on manual decompiling: http://msdn.winmo.sztupy.hu/manilasdk/show/Lua_Decompiling_Tutorial
[Windows Mobile Software Development] miammiam:
thanks... :)
[Windows Mobile Software Development] kwbr:
Hi, I am having the same problem with this manila file and luadec hangs / stops responding on my windows 7 machine. I can only get the disassembly file. So decompiling is a nogo for now.
[Windows Mobile Software Development] Co0kieMonster:
I've been working on LuaDec version 3.2 and it decompiles that file 100%. I still have a few things to finish up before I release it, but in the meanwhile I've attached a fully decompiled 3fb3a68c_manila.
[Windows Mobile Software Development] Co0kieMonster:
LuaTool v1.2 released.

Changes: updated LuaDec to v3.2, LuaC to v1.2 and LuaCompare to v1.2.1.

LuaDec 3.2

: Major overhaul of the local finding algorithm. Most lua scripts can now be fully decompiled without a problem.

The success rate on manila luac files is great: 94.31% (as tested on Manila 2.1.1921)

Manila 2.5.1921 has a total of 703 scripts (including embedded scripts). LuaDec can fully decompile 663 out of those 703 files => 94.31%.

LuaC 1.2

: LuaC can now directly replace functions in compiled luac files. This can be useful if the luac file can't be fully decompiled, but only a small part of the file needs to be edited.

Example: You have a luac file that can't be completely decompiled, but the function you need can. You can decompile only that function using LuaDec -f switch, then edit the function, and finally inject the modified function back into the original file using the LuaC -r switch.

That can look like this:

1) LuaTool /decompile -f 7 -o myfunction.lua 09ab94f0_manila --- this will decompile only function #7 and store it in myfunction.lua

2) now edit myfunction.lua as required

3) LuaTool /compile -r 7 09ab94f0_manila myfunction.lua --- this will replace function #7 in 09ab94f0_manila with the modified myfunction.lua

The function replace syntax is:

LuaTool /c -r <n> <luac_file> <inputfile>

<n> is the function number that should be replaced

<luac_file> is the compiled luac file where the function should be replaced

<inputfile> is the single function that will replace function <n> - it should be an uncompiled lua file with just a single function in it
[Windows Mobile Software Development] mwalt2:
Wow, nice stuff. Good work.
[Windows Mobile Software Development] santod040:
I have had some trouble trying to decompile the lua files in this zip file. I'm not sure why it's crashing out on me, but if anyone could lend a hand I would be most grateful!
[Windows Mobile Software Development] Co0kieMonster:
LuaDec 3.2 can fully decompile all the files except 652ae0f4_manila. Luckily, I've been working on a new beta version of LuaDec and it can decompile 652ae0f4_manila. I won’t be releasing the new LuaDec yet, but I have attached all the decompiled files.
[Windows Mobile Software Development] santod040:
You the man, Cookie Monster!!! :cool:
[Windows Mobile Software Development] Jamrecords:
Excellent work! And why you do not want to release a new version?

I have to ask you. Please, decompiled file 652ae0f4_manila from Manila 2.5.2011.3030 for me)

And, may I ask a personal study?

View attachment 652ae0f4_manila.zip
[Windows Mobile Software Development] Fredz:
Hi CookieMonster,

I've got some problem decompiling favorite people tab (manila 2.5 2021). The remaining files are the followings :

7b64b476_manila

22c30cbf_manila

049ced00_manila

57a92846_manila

285d32bc_manila

when did you expect to release the new version ?

Thanks for all you work.:)
[Windows Mobile Software Development] guenthar:
I used the luadec that is a part of manilla kitchen but it always gives me a bad header error with the scripts I'm trying to decompile. If I use luadec 2.1 though the scripts decompile correctly but the problem is that it always crashes on the larger scripts. I think the newer versions might have corrected the problem but they no longer work with my scripts.

EDIT: I was finally able to download luatool and when I use it to decompile one of the lua scripts it comes up with an error saying "not a valid luac file" and it does the same if I try to disassemble it. I forgot to mention before but I am trying to decompile the scripts from a new game called Venetica.
[Windows Mobile Software Development] Co0kieMonster:
I've attached a beta version of LuaTool with LuaDec 3.2.2beta. It will decompile 652ae0f4_manila and a few other files better then 3.2.0, but it might mess up some other files that 3.2.0 got right. So keep both version, and try with one or the other.

That's the reason I didn't want to release it - the new version isn't always better than the old, and I wanted to fix it. But since it looks like I won't have time to perfect it anytime soon, here's the Beta, but use with caution.

I've attached a beta of the new version. I hope that helps. And the same cautionary message as above: keep the last stable version at hand, too. I have no idea when I'll be able to get a new final version out.

In the mean time, you can also try the function replacement feature - it can be quite useful for party decompiled scripts.
[Windows Mobile Software Development] Co0kieMonster:
Upload one of the lua files, so I can take a look. If it's a regular ascii lua 5.1 script I can quickly recompile LuaTool for acsii. Manila uses unicode so the current LuaTool was adapted fot that.
[Windows Mobile Software Development] guenthar:
Here is one of the script files.
[Windows Mobile Software Development] Co0kieMonster:
Here is LuaTool for ASCII. It recognizes the file.

Unfortunately, it looks like the script uses variable arguments, and I haven't really had a chance to properly work that out (hasn’t come up much in the manila scripts).

It does decompile most of the file, though.
[Windows Mobile Software Development] Jamrecords:
Best!!! Thank you! 652 ...._manila decompile excellent. But the problem with other scripts still there. I think that you will finish it before the final))))

I have an idea (position shortcuts to switch hours), but I can not get it done. Can you help me?
[Windows Mobile Software Development] guenthar:
Even with this it couldn't be decompiled, edited, and recompiled correctly then?

Thank you for doing this.
[Windows Mobile Software Development] santod040:
So I too have been fighting to get this file decompiled cleanly. Even with the new beta version.

Is there any chance someone could help me with this?

I am still getting my feet wet with some of this decompiling and recompiling of scripts. But I have learned a great deal from all the pros on here in these forums. You guys are great! Thanks Cookie for your great tool and all your efforts! :)
[Windows Mobile Software Development] Co0kieMonster:
I'm willing to help, but I'm not sure I understand your idea.

Yeah, it can't be recompiled.

But, it looks like only the variable argument messes it up. I've added the bug to my to-do list and I'll hopefully have it fixed by the next release.

Are you sure you tried it with the 1.2.2beta I posted on the last page?

Because I just try it and it decompiles perfectly.
[Windows Mobile Software Development] santod040:
Yes, I did. Maybe my parameters are off?

Like I say, I am still a noob at this stuff.

I have decompiled it once before, but I don't recall what commands I used last time that worked.

All I really need to do is change one thing in the Rotate function, Home_PageListView.

Position.y there's a vector setting where Vector3(x, y, z)

I just need adjust x position to make this right.

As I have almost got this just how I want it now.

With landscape enabled as well. Thanks again for everything you do Cookie!

If you don't have time to help, I understand. :(
[Windows Mobile Software Development] Co0kieMonster:
I'm not sure what you mean by parameters, there's really only one thing you should type in the command line:

luatool /d 652ae0f4_manila

What decompile success did that give you?

P.S. Here is the decompiled file, just in case that doesn't work.
[Windows Mobile Software Development] santod040:
I don't know why it acts different for me then the older version.

Thanks again Co0kie!
[Windows Mobile Software Development] Fredz:
Hi CookieMonster,

The beta has only decompile successfully one file (57a92846_manila).

I've solve two other ones : I need to add do...end to limit propagation of local variables. Maybe this information can help you. The two files concerning are 22c30cbf_manila and 049ced00_manila.

So, it remains :

7b64b476_manila

285d32bc_manila

For the first one, the code missing is dead code.

For the second one, there is problem with local, but can't understand where is the problem.

Maybe you could solved them. So attached are the lua files.

Thanks
[Windows Mobile Software Development] theShad:
Co0kieMonster,

Thanks a lot for LuaTool, it is really perfect!

But as santod040 I have problems with decomiling 652ae0f4_manila. I use the last beta, the command "luatool /d 652ae0f4_manila" gives me 75% success. At first I thought that it could be because I took this file from manila mod, but then I tried orginal one and got same 75%((
[Windows Mobile Software Development] utopykzebulon:
hi all,

Someone knows where to find "_svc files" required in some lua script?
[Windows Mobile Software Development] Co0kieMonster:
The _svc files don't actually refer to any lua scripts, but to service .dlls: HomeService.dll, WorldClockService.dll, AppointmentService.dll, etc.

Might depend on which manila version the 652ae0f4_manila is from.

I'll see what I can do when I get around to working on LuaTool.

I've corrected the 285d32bc_manila manually and attached it. It's a problem with complex assignments.

Generally if you see something like:

local l_22_12 = something
if something then
l_22_12 = something_else
-- Error: some decompiler error
end

That's a complex assignment and it should be:

local l_22_12 = something and something_else

or:

local l_22_12 = something or something_else

I was working on solving this problem in LuaTool, but it's getting harder to correctly solve these cases without breaking something else. However, I believe I will be able to make it work eventually.

There are some cases like that 7b64b476_manila, where I don't even know how to decompile it manually, let alone write a decompiler that can. I've seen that case from 7b64b476_manila before, but I really don't get what's going on there. If someone manages do manually decompile that, please post it.
[Windows Mobile Software Development] Z!L0G80:
hi ,could you add luaj to your decompiler, description here >> http://sourceforge.net/projects/luaj/ i have found thiz compiled script on my htc hero in game :) attached sample

good work thnx
[Windows Mobile Software Development] Co0kieMonster:
No, sorry, too much work.
[Windows Mobile Software Development] TMartin:
Hey Co0kieMonster

Thanks for the great tool!!! 1.2.2 beta is working great so far!! Now if only I knew more about all this scripting.
[Windows Mobile Software Development] rotastrain:
hey cookie..

something slightly off topic

in ur great mod of the homescreen for manila 2.5..have u managed to decompile or find out how manila finds the icon of a exe?like when we choose the program it automatically finds the exe icon and sets it to the designated spot..do u know what lua code is written for that?
[Windows Mobile Software Development] Co0kieMonster:
6c219600_manila - under LaunchIconMode function:

HomeManager:GetImage(l_14_3.ExePath)
[Windows Mobile Software Development] akamustang:
Some things I have noticed

Recompiled scripts end up bigger than the originals even if /cr reports a 100% match

Would be nice if a recompiled script with no changes ended up byte for byte exactly the same as the original

Also uncompiling a recompiled script brings up even more errors

This wouldn't happen if the above suggestion could be implemented

i.e.

Decompile original to 1.lua, compile 1.lua to 1.luac, decompile 1.luac to 2.lua

Then compare 1.cmp.lua to 2.cmp.lua

On a related note

If your latest test/beta version has any improvements in these areas

Any chance you could upload it :D
[Windows Mobile Software Development] Co0kieMonster:
When you recompile the files make sure you set the -s (remove debug info) switch. That way you will get byte for byte identical files.

The extra debug info is what makes the recompiled files bigger. (But it doesn't impact functionality.)

This is related to the debug info. For the first decompile there was not debug info, but it was there for the second. It's actually a pretty rare case that files with debug info decompile worse than without. It should be the other way around.

The debug info contains information about local declarations. Without this information the decompiler has to go through a local mapping stage where it gathers the local declaration info. This mapping run might not always collect the right info -> decompile errors.

If a compiled file contains debug info, it has local declarations info (which is 100% correct), so there is no need to do separate local mapping, and no chance to get a wrong local map. Hence, the decompiling should be better in case the debug info is there.

There is one exception: around tables. I've built in some additional heuristics that help decompile some table situations. The tables are handled in a later stage but part of the detection had to be included in the local mapping stage. So when the local mapper is skipped because of the present debug info, the local map is OK, but some rare table cases may not be.

This is actually a very rare case. I'm surprised you found it.

Sadly I haven't done any additional work on the decompiler since 3.2.2, so the latest is uploaded.
[Windows Mobile Software Development] akamustang:
Ahh, if there is debug info being added that would most likely be my issue

Thanks for the -s tip, I'll give it a go
[Windows Mobile Software Development] ElCondor:
I'm pretty new to all this stuff, but I'm having a problem.

When running the tool, I can see the ms-dos like screen for one moment then it disappears.

I'm running Windows 7 64-bit.

Anyone know what to do?
[Windows Mobile Software Development] Co0kieMonster:
It's a command line tool.

You'd have to run it from the command prompt.

But if you have never used that before, I think the best way to get started would be to use the Manila CMD Kitchen: http://xdaforums.com/showthread.php?t=528548

It has a very well written guide.
[Windows Mobile Software Development] ElCondor:
OK I'll do some more research, learn more. Thanks!:)
[Windows Mobile Software Development] Silco:
is there a decompiler for lua 5.0.3 (I could only find 5.0.2 one and that returns an error on my file, 5.1.x decompiler also returns an error)
[Windows Mobile Software Development] betitomiller:
when i decompiling 1.7.1 , it does not go to decompile: 2E587A9A_manila, 5DED22E8_manila, 652ae0f4_manila

ask for advice, or decompile the file, and better and then another ...

and 22DC24C8_manila ... please
[Windows Mobile Software Development] cnzqy1:
You'd better see the thread more carefully, see:http://xdaforums.com/showpost.php?p=5493910&postcount=2, the attachment.
[Windows Mobile Software Development] sentinel80:
53cc1e4f_manila

Hi alls!

I cant decompile/compile this manila file, pls help me.

thanks
[Windows Mobile Software Development] Jaro72:
HVGA

Hi i'm intersted in porting your great mod to HVGA resolution but i need some help to get started. Maybe you can explaihn some things to me or what i need to do.

I have the .lua files and noticed some coordinates in there thes should be changes i assume. Anything else is also?

J!
[Windows Mobile Software Development] lyiann:
6c7fd322_manila

I can't decompile this manila file, help!!
[Windows Mobile Software Development] lyiann:
C:\manila>luatool /d 53cc1e4f_manila

Decompile success: 86%
[Windows Mobile Software Development] IoDa00:
Help compile file

Hi,

i need some help,

I decompiler this file successfully but when I try to compile, it gives me always the message permission denied.

I use this command

LuaTool /compile -s -r 28 5fa4d4b7_manila 5fa4d4b7_manila.lua

I attached file of version 2017 (Home Tab), and its changed lua file, to compile.

I Use the Windows 7 with administrator permissions and execute the files as administrator.

Thanks for the help

Cumps
[Windows Mobile Software Development] ai6908:
This is the first time I am using this tool...thanks for this co0kie...:)
[Windows Mobile Software Development] Co0kieMonster:
You need to remove the system and read-only flags from the file 5fa4d4b7_manila.

Use the command "attrib -s -r".
[Windows Mobile Software Development] IoDa00:
Thanks

solved
[Windows Mobile Software Development] plopper:
short question but big impact: any possibilety to port this toolset to linux?

plopper
[Windows Mobile Software Development] poorgrad:
I tried to run LuaTool with wine 1.3.10 on Fedora 14 and it failed with an call to an unimplemented function in msvcp90.dll.

This probably means it may not be simple to port.
[Windows Mobile Software Development] poorgrad:
I did some more experimentation. Luatool works in wine if you install the Visual Studio 2008 runtime using winetricks vcrun2008. I was able to use it to disable the clock animation following the instructions in http://xdaforums.com/showthread.php?t=703579.
[Windows Mobile Software Development] sharkie405:
I'm having a bit of trouble compiling this .lua file. Here is a screenie of the error:

Does anyone know why I'm getting this error and/or can anyone compile the attached file for me? :D
[Windows Mobile Software Development] poyensa:
as i said in CHT thread, i think the problem is in the decompilation process. That file looks like is not correctly decompiled, but its not necessary to decompile as co0kie provided the open source. So work on the original file, then compilation should not be a problem.
[Windows Mobile Software Development] AndresPlz:
help

Can some help me with this file?? is LUA 5.0 luap I been try anything to decompile it if someone can try some other thing that I dont i'll be thanksfully
[Windows Mobile Software Development] poyensa:
It gives me 'bad header in precompiled chunk' error. have you tried this? -> http://xdaforums.com/showthread.php?p=5548019#post5548019

no. error: 'input is not a valid luaC file'
[Windows Mobile Development and Hacking General] ekerbuddyeker:
i have a rhodium. I cannot seem to switch off data, even in comm manager. as soon as i switch it off, it goes on again! Something is using the radio, and I have been through every program I can find to stop it connecting automatically. But still no luck!

I need it off so that I can get blackberry software to run on my device (it gets blocked if anything else uses the radio), so it isnt a question of using an app like NODATA.

So I want to know if there is an app which can show me which program is using the radio.

Help anyone???
[Windows Mobile Development and Hacking General] Asphyx:
If your using Manila try shutting off push internet...

From the internet tab hit menu/data settings turn off push email.

Also check email retrieval settings...I set mine to every 2 hours...

I don't know of any App that will do this but it would be a nice one to have.
[Windows Mobile Development and Hacking General] hp610:
Im having the same problem on a Samsung i900 :S