yashsingh1/xdaforums huggingface dataset:
[Windows Mobile Development and Hacking General] smotrs:
I still haven't been able to figure out where this is actually referring too. I see similar situation in other lua files. But in each case, I've been unable to locate where or what it's actually trying to do. :confused:
[Windows Mobile Development and Hacking General] sztupy:
I'll look into theese Manila:// files when I have the time. I have some thoughts about how it works, but have to check it.
[Windows Mobile Development and Hacking General] sztupy:
They are dialogs (as their name suggests). They are defined in manila.xml (26948339_manila). They seem to be like some kind of "embedded mode9" files

Example:

<PageGroup Name="settings">
(...)
<PageGroup Name="updatesanddata">
<Page Order="0" Name="updatesanddata.page" PackageName="HTC" Title="[[IDS_UPDATESANDDATA]]" Default="true" >
<ComponentReference Name="page" Mode9Path="HTC\settings.mode9" Component="UpdatesAndDataPageComponent" SmartComponent="true" />
</Page>
</PageGroup>
(...)
</PageGroup>
[Windows Mobile Development and Hacking General] smotrs:
Interesting, it also appears to reference the settings.mode9 file as well from there. Thanks, I'll check these out, it was really bugging me. :)
[Windows Mobile Development and Hacking General] hallatore:
A little addition to the tools available.

Should make your testing of manila files alot easier and faster!

http://xdaforums.com/showthread.php?p=3542459
[Windows Mobile Development and Hacking General] guap:
I need some help with this script (extracted from home.mode9)

I need to cut off this part:

LoadDefaultBackground = function()
HomeBackground.TextureCoords.width = 1
HomeBackground.TextureCoords.height = 1
HomeBackground.Position.x = 0
HomeBackground.Position.y = 0
HomeBackground.Size.width = BackgroundWidth
HomeBackground.Size.height = BackgroundHeight
HomeBackground:SetTextureRef("nightroad_wallpaper")
InterpolateOpacity(100, HomeBackground)
end

but I can't decompile correctly according to output of luadec and have to go by hex

- Is there some reference about which values declare in hex the "end" of a procedure so i can cut with my hex editor?

- How can I proceed instead? Can someone decompile this script correctly so I can recompile and import with m9?

thank you
[Windows Mobile Development and Hacking General] hallatore:
You can download the decompiled rhodium scripts from http://winmo.sztupy.hu/manilakitchen.html

If thei'r not the correct version atleast they contain the luadec syntax used.
[Windows Mobile Development and Hacking General] avimak:
My message was deleted during the hack of xda, those **cking hackers pricks, never know what they doing.

they think it's a **cking kids board you can hack? this is number one WM forum on net! :mad:

well, here is the original message:

I have a problem:

I can't send Unicode messages from the new Message Tab.

I installed Dutty's V2.4, change the regional settings to "Russian" and Installed the Fingerkeyb keyboard version 2.0...

I did a SR and then sent to myself (and to other numbers) SMS message with English and Unicode characters and as you can see I received the English characters and didn't received the Unicode ones - only ???

Here is a screenshot:

I have this problem with Russian, with Hebrew - and it happened to me before I'm changing the regional settings - and after the changing...

I don't have any other problem with Russian or Hebrew fonts on my device, and I don't have this problem if I'm sending the SMS from the normal SMS interface (the Windows Mobile SMS GUI)...

please help me ;)
[Windows Mobile Development and Hacking General] guap:
no, that is a part of old home.mode9 with analog clock, it isn't in that dump

also, I cant track matching betwheen decompiled script and hex values

actually i get "bad header in precompiled chunk"
[Windows Mobile Development and Hacking General] sztupy:
beta2 released.

I fixed the crashings (tested with ManilaHD, it now decompiles (means: outputs something) all of the non-embeded lua files without crashings). For this I added some heavy hacks, which will define locals around code whenever possible. To get all of the useful infomration from a luac file always try the followings:

1. decompile it simply with luadec

If you don't find lines which shows warnings or errors, then you are probably fine. Try recompiling it, then dumb both compiled files with a disassembler. If they are almost identical then usually decompilation has worked.

2. decompile it using the -f option

Sometimes luadec will decompile functions, but because of some register errors it won't add these functions to the output. Using -f the functions will be dumped in the file separately from each other, so you might get more useful code snippets. Don't try to recompile this file though, use it only for a reference to re-create the original.

3. decompile with the -d option

Sometimes you might get a "undefined locals caused missing assignments" warning, and (usually) and empty block somewhere around this warning. If this happens, then you have to use the debug feature to get all information. Pending registers are stored after each opcode in the "tpend(n): blahblah" section. If there are a lot of pending variables in this section near your warning, then you can recover the missing assignments from here.

Currently the following files can be recompressed and decompressed without losing any information:

4aefb03d_manila
7564a2d6_manila
77faa36d_manila
71552a24_manila
5e085a76_manila
5f880c80_manila
6525061c_manila
283226d1_manila
1d1ee632_manila
075987ec_manila

I attached the decompilation of these files.
[Windows Mobile Development and Hacking General] sztupy:
And this means it couldn't find the redistributables. X86 OR X64?
[Windows Mobile Development and Hacking General] pcarvalho:
x86 as stated in logs...

did you read this on the link i posted...

"I had this problem with VS when I first started using it. No one could run my programs other than myself, or other computers with VS installed.

The reason for this is that unless you configure your build correctly, VS by default dynamically links to its runtime libraries (msvc90.dll, for example). What you need to do is go to the general build configuration, and set it to statically link with that library (i don't remember the exact name right now), MFC maybe?.

If you do this correctly (make sure to do it with all dependencies as well), the manifest file in your build folder will not reference this library. This should ensure that it won't have to go looking for dll's that your users don't have installed."
[Windows Mobile Development and Hacking General] sztupy:
Staticallly linking is not the real solution and is not the preferred way to do things. I changed beta2.zip, now it contains "release" type files. If you have the redistribs now it should work.
[Windows Mobile Development and Hacking General] sztupy:
Here is a small utility to check whether decompilation was succesful. Simply run compare.exe with a compiled lua file (ascii variant), and it will automatically decompile/recompile it, then dump it and will check for changes. If it can't find any it'll say okay.

You can also use it to compare two separate compiled files. This way you can always check whether your modifications to the decompiled sources have got you closer to the original file, or not.
[Windows Mobile Development and Hacking General] pcarvalho:
thanks! it works now...let me just say again...WOOOW!!! :)

keep it up...this thread is already on my bookmarks ;)

very good work being done here...

i already wanna remake stuff but can yet...lol

lua5.1 decompiler + mode9 editor = great future ahead :D

thanks
[Windows Mobile Development and Hacking General] sztupy:
I'm now trying to decompile the majority of the scripts (using xboxmods TF3DHD as a base) and add them here for reference. If anyone manages to decompile a script, then please upload them here so I can them to the repository.
[Windows Mobile Development and Hacking General] pcarvalho:
how do you want to do this? just single luac *_manila files or embedded scripts too? that is a lot of files :)

and just correctly decompiled ones or pretty much all?

another thing is that VGA and WVGA versions should be tested too...just to make it safe ;)
[Windows Mobile Development and Hacking General] sztupy:
First I run an automated check on the files (like in the previous example), and check how many differences are in the opcode dump of the original compared to the recompiled version. Then I go from 0 errors (they are included in the previuos post) upwards to the most buggiest scripts. I think the difference between VGA and WVGA are mostly in the numbers which can be easily re-edited if you have the source code by hand :)
[Windows Mobile Development and Hacking General] pcarvalho:
okay...decoding all that can as i write...what is...tflua.exe? :)
[Windows Mobile Development and Hacking General] pcarvalho:
all scripts decoded...come and get them...

all lua tf3dhd decoded

...................................for devs only.........................................

(password: pcarvalho_luac)

i used mode9 editor to sort out all scripts and then decompiled all...170 files total

there are 3 embebed scripts that are in:

1f3be060_manila, 252e3f90_manila and 6c922ab4_manila that make decompiler crash...
[Windows Mobile Development and Hacking General] showaco:
Great work sztupy:) can't wait til you get it decompiling 100%, you're opening up the doors to enormous possibilities here. 6Fg8 did a great job of integrating it into latest m9editor.
[Windows Mobile Development and Hacking General] guap:
@pcarlvalho: good work but there are still some significant decompile errors in home embedded script... useful only for studying for now
[Windows Mobile Development and Hacking General] sztupy:
Yes, it needs a lot of cleanup... Unfortunately I'm working on something else right now, but will look into it when I have the time.
[Windows Mobile Development and Hacking General] nixx-X1:
looking at the lua files I came across this line:

"EasterEggHitDetector.onRelease:disconnect(EasterEggRelease)"

as part of

require("transitions")

TransitionDelayTime = 7

objs3D = {}

objs3D[1] = GizmoGroup

objs3D[2] = EasterEggComponent

objs3D[3] = IconGroup

objs2D = {}

objs2D[1] = Group2D

TransitionComplete = function(loc_0)

trace("*** Navigate Complete in weather.m9 ***")

if loc_0 == "Out" then

EasterEggHitDetector.onRelease:disconnect(EasterEggRelease)

end

UpdateCityCount()

transitionDelayStart(loc_0)

navigatingIn = functionForAfterOnNavigateIn == nil

functionForAfterOnNavigateIn()

functionForAfterOnNavigateIn = nil

if loc_0 == "In" and UpdateStatus == 1 then

CityNumberGroup._visible = false

end

anybody notice an easter egg? :D
[Windows Mobile Development and Hacking General] 6Fg8:
yes there is one: go to the weather page, and quickly tap left and right to the title. You'll see a slideshow with all possible weather conditions.
[Windows Mobile Development and Hacking General] sztupy:
There is also a C function in lua.dll called lua_getawesomedata and lua_setawesomedata WTF?
[Windows Mobile Development and Hacking General] nixx-X1:
Haha cool! how did you get that one? :)

I love when ppl take the time to incorporate these things :cool:
[Windows Mobile Development and Hacking General] 12aon:
Would it be possible to create a partial recompile funtion and put this compilation together with the original lua file. Just a (silly) thought, 12
[Windows Mobile Development and Hacking General] szilamer:
Anybody tried loadlib or package.loadlib in this tf3d lua ?

Or it is impossible to load an external dll in this implementation of lua ?
[Windows Mobile Development and Hacking General] mun_rus:
yes.. that's a problem. manila uses only one system api function but it's not a "send in unicode" :(

may be we can write a function that will be retranslate it to unicode
[Windows Mobile Development and Hacking General] avimak:
If you can, it'll be great.

I'm not a lua programmer, in fact I'm a Javateer :o
[Windows Mobile Development and Hacking General] 12aon:
I wanted to see the diffences between the old TF3D 1.lua embedded in the homescreen, and I tried to decompile with luadec 2.0 but it actually seemed to give more errors than luadec 1.0 gave in the m9editor, but that's weird right? 12
[Windows Mobile Development and Hacking General] sztupy:
InitializeFullAnimation has a line:

local l_15_7 = l_15_2 == nil and l_15_0.Group2Animation:Visible() or l_15_2

this is something ugly and hard to decompile (it took me a while to figure this one out by hand too, because conditional assignments are the Achilles tendon of luadec), and luadec2 guesses wrong here. You have to correct this part by hand. And at the main block there is a table assignment, for which the heuristic guesses also wrong, creating lots of l_0_0 in the main block. This can be fixed easily too. (you can get the LDS2 string the heuristic uses with "luadec -pg filename.luac", then you can change parts of it and give it back using "luadec -l2 LDS2string filename.luac"
[Windows Mobile Development and Hacking General] 12aon:
Right, I'm not so good at doing guessing and stuff by hand yet. I'm trying to make a bat that does the guessing for me at least the luadec guessing, after which I'll try to do the same for luadecguess I think. I don't know what to change when I have the luadec -pg filename.luac, because I just see a lot of numbers, how to add these to the lua, 12
[Windows Mobile Development and Hacking General] sztupy:
1. get the output of luadec -pg

luadec -pg filename.luac > lds2string.txt

2. edit lds2string.txt First try removing everything before the first semicolon (those are variables for the main block, for which there are none to declare). Each semicolon represents one function, so to edit function No 12, you have to edit the numbers after the 12th semicolon

3. Pass the modified lds2string to luadec. For example

luadec -l2 ;1-25,1-25;(...);1-125,4-52,8-52; filename.luac > filename.lua
[Windows Mobile Development and Hacking General] aussiebum:
EDIT: I've managed to compile successfully after reading thru all the tutorials and playing around a bit. here's the fixed compiled script...

It contains some additional items not seen in the Rhodium script pack from sztupy - namely code for the Manila Start Menu.
[Windows Mobile Development and Hacking General] jcollin:
Manila MSDN : Http Error 503

Hi Sztupy,

I would like to go on your website to view the manila msdn, but I have a 503 http error on the msdn link. Is there another way to have access to those data ?

By the way, I would like to know how the files are linked altogether.

I think it all starts with the mode9 files, which reference the different lua files.

But so far, I could not manage to understand how the mode9 files know the link between the logical name of a picture and the filename of that picture.

For example in the icons.mode9, you can find references to the icon names but not to the corresponding manila files.

There must be a reference table somewhere but I could not find it.

My aim is to get enough knowledge to be able to create a new empty tab from scratch.

Thanks in advance for your help,

J.
[Windows Mobile Development and Hacking General] 12aon:
Well in fact they are linked that way. All the files paths Assets\.... wtc are coverted into binairy files which will lead to to the qtc image. Look for the instance names in the m9 to see what parameters are changed to that picture in the lua files, 12
[Windows Mobile Development and Hacking General] sztupy:
Oh, had a server restart, forgot to start msdn... I should put that into init.d...

btw. manila.xml is the base file. It references other mode9 files, which in term references the image files and lua scripts. All files are hashed to their _manila form using djb2 algorithm and using the whole path. So \Windows\manila.xml becomes 26948339_manila. Usually the ".", which means the actual directory will mean "\Windows\Htc\" and you have to append the image name after that. There are a lot of references to files in the mode9 files, but because in the later manilas a lot of thing became dynamic (for example the landscape/portrait rotation is done by a lua script that modifies all paramters of the mode9 files), most of the file references are deeply hidden in the lua scripts, and sometimes they are even generated dynamically.
[Windows Mobile Development and Hacking General] kinnyfaifai:
Hi all,

Over the last week, I've been trying to create my own manila files. I've managed to decompile using luadec, but I haven't been able to recompile them. I'm typing the following in:

luac -s test.lua

and I've tried:

luac -s test.lua test.luac

Both gives me this error:

luac.exe: test.lua:12: function arguments expected near ','

Could anyone tell me what I'm doing wrong, or what I'm missing.

Many thanks!
[Windows Mobile Development and Hacking General] avimak:
Can some one of you experts can decompile those files for me? I tried many times but it failed to do it perfect, some "local" are missing and it refused to recompile even before I'm touching the code - thanks!
[Windows Mobile Development and Hacking General] sztupy:
why don't you check your code at line 12?
[Windows Mobile Development and Hacking General] avimak:
LOL :D

you killing me man...
[Windows Mobile Development and Hacking General] kinnyfaifai:
Apologies for being a numpty! I think I've got the hang of it now. Trying to tweak the home manila to include hallatore's code to display more appointments without all the other changes he's made. I've got an X1i running Touch-It 5.04 by itje so I got plenty of screen space without compacting the clock etc.

Thanks for the help so far.

P.S. At least I'm providing some comedy moments! :rolleyes:
[Windows Mobile Development and Hacking General] avimak:
It's all friendly jokes dude ;)
[Windows Mobile Development and Hacking General] sztupy:
Sorry guys, I don't really have much time recently. But if someone might throw some new manila releases at me I might get back to a bit of decomp :)
[Windows Mobile Development and Hacking General] avimak:
Hi dude ;)

here's the FINAL manila v.3 from the Topaz official ROM - I'll be glad if you'll decompile those files! :D

It's already fixed a lot of bugs but some configuration will do it better :D

http://rapidshare.com/files/2182021...Signed_Topaz_61.20t.25.10_3.43.25.19_Ship.exe
[Windows Mobile Development and Hacking General] kinnyfaifai:
I admit to it when I make schoolboy errors. :) I know everyone here is friendly!

I've got a few more questions, but going to see if I can hammer them out myself first. I've read this thread twice now and slowly picking up bits and pieces more each time I re-read it!
[Windows Mobile Development and Hacking General] kinnyfaifai:
Any reason why using:

mkt.exe tomode9

gives this error:

C:\DOCUME~1\kinny\eee\eee.mode9converter.exe.22\app\mode9converter.rb:505:in `initialize': Permission denied - bin/windows/htc/home.mode9 (Errno::EACCES)
from C:\DOCUME~1\kinny\eee\eee.mode9converter.exe.22\app\mode9converter.rb:505:in `open'
from C:\DOCUME~1\kinny\eee\eee.mode9converter.exe.22\app\mode9converter.rb:505
from C:\DOCUME~1\kinny\eee\eee.mode9converter.exe.22\bootstrap.rb:77:in `load'
from C:\DOCUME~1\kinny\eee\eee.mode9converter.exe.22\bootstrap.rb:77

But getting it to do it straight from mode9converter doesn't chuck the error up.

I know the only thing I don't do is set my working directory in the windows PATH variable, so I'm running each of the tools from the working directory (I've got 2 going at the moment).
[Windows Mobile Development and Hacking General] sztupy:
check the attributes of bin/windows/htc/home.mode9 it might be read-only/system/etc (note to self: remove attributes in mkt before copying)
[Windows Mobile Development and Hacking General] sztupy:
thx. I'll try as soon as I'm finished with luadec3, it should make the work easier. This Topaz Manila still doesn't have the VGA/WVGA switch included right? If yes I think I'll wait for the next manila which will be both vga/wvga compilant for a complete decompilation.
[Windows Mobile Development and Hacking General] kinnyfaifai:
That's the first thing I've tried. The permissions are fine! I've done it a long way round now so I can bypass that error. :D
[Windows Mobile Development and Hacking General] kinnyfaifai:
Woohoo!

I managed to incorporate Hallatore's code for the X1i to show more appointments. Great thanks to sztupy for the great work on decompiling the manila files and Hallatore for sharing the snippets of code required to do this. I'm a happy bunny now! :D

Phase two, close to getting a 6th appointment to show up to make use of the gap at the bottom of the 5th. :)

Slowly getting the hang of Lua scripting. :)
[Windows Mobile Development and Hacking General] avimak:
I'm not sure, but you do whatever you need to do :)

can you just decompile the files I uploaded two-three days ago? this is for the Slider, now this is the final files :)
[Windows Mobile Development and Hacking General] avimak:
A very strange thing, the final Manila from the official Tachi Chinese ROM as the same English letterpicker with English letters (!), and of course all the connected files are "+ 65", there is absolutely no reference to Unicode in the new files! strange :\
[Windows Mobile Development and Hacking General] Ameet:
Hey buddy. Can you take a look here & below posts and help me in solving the problem? It is related to mode9 editing :)

http://xdaforums.com/showpost.php?p=3721931&postcount=2090
[Windows Mobile Development and Hacking General] Fredz:
Trace function

Hello,

I search where the trace function store message.

Someone can help me ?
[Windows Mobile Development and Hacking General] smotrs:
LUA Math function

As near as I can tell, the LUA contained on our phones doesn't contain the math module. I tried creating a random number to randomize the Weather Easter Egg, rather then show the same 4 all the time using math.random(41) which would create a random number from 1 to 41. But either it's not working or it's only returning the number 1.

I have read that there is an issue with the first call not being truly random so to throw it away by running it twice but only using the 2nd call. But I still get the same result.

So now my thinking is that the module isn't actually working on our version of LUA. So I'm wondering if there is a different way to generate a random number other then using the math module?

I'm hoping to release a new Weather TAB which fixes the oblong shapes of the Sun and Moon, increases the default city limit from 10 to 25 and shows more of the weather states when you run the Easter Egg. Having it randomly pick and display a group of 7 rather then always show the same 4 each time it's run would really be cool I think. JMO.
[Windows Mobile Development and Hacking General] smotrs:
Fred, the Trace function doesn't really store messages. It's used for debugging purposes on HTC's end using their proprietary development kit which allows them to test on a computer before deploying to the phone.
[Windows Mobile Development and Hacking General] sztupy:
You have to use a debugger to get these infomrations. Both IDA and the debugger of Visual Studio are good. If you only need the trace information I prefer the latter, because it's more stable, and allows you to connect to an already running program (like manila(2).exe).

IDA is good too, but only if you want to debug manila too.

To get trace infomrations I use Visual Studio 2008 SP1 if you're curious.
[Windows Mobile Development and Hacking General] sztupy:
You might want to implement your own pseudorandomnumber generator.

Now this is not that easy, because of the Q16 implementation of lua.

For example here is a simple random number generator I found in C#:

private static uint GetUint()
{
m_z = 36969 * (m_z & 65535) + (m_z >> 16);
m_w = 18000 * (m_w & 65535) + (m_w >> 16);
return (m_z << 16) + m_w;
}

public static double GetUniform()
{
uint u = GetUint();
return (u + 1) * 2.328306435454494e-10;
}

Although simple, it won't work in the Q16.16 environment (I think this is why the built in random number generator fails), but you might try to convert this snippet of code...

Or persuade me to start proting ExtLua to your manila version :)