[UTILITY] Lua 5.1 tools: compiler, decompiler, snippets & extendable lua.dll with SDK - Windows Mobile Development and Hacking General

[UTILITY] Lua 5.1 tools: compiler, decompiler, snippets & extendable lua.dll with SDK
Hi!
This package contains lots of useful tools for Manila3D Lua5.1 editing. You can find here a compiler a decompiler, a small script repository at post #3 and ExtLua, which provides developers the possibility to extend M3D's functionality.
Also check m9editor which is a really great application to edit mode9 files by 6Fg8!
And check Manila kitchen project which hosts the decompiled scripts with a LUA IDE and everything ready to go.
You might want to try out mode9 converter too.
ChangeLog
LuaDec 2.0
Finds out where locals are
Read more here
LuaDec 1.9
Some changes regarding LDS(2) strings and for loops (it's still a bit unstable)
LuaDec has a new option to disassemble instead of decompile
The provided lua package (lua, luac and luadec) is now unicode compilant, it will read and write the unicode variants of the scripts instead of the ascii variants.
Read more here
LuaDec 1.0
Added LDS2 support to both luadec and luac
Fixed OP_TFORLOOP handling
Read more here
LuaDec Beta6
Improved luadecguesser with fast mode
Fixed a crashing when encountering boolean values
Increases happy face rate in XDA-developers forum
Read more here
LuaDec Beta5
Improved luadecguesser
Read more here
luaDec Beta4
Upvalue handling
Added a brute-force local variable searcher application
Read more here
luaDec Beta3
Generic for loop handling
Improved local variable handling
Read more here
ExtLua 0.1
Initial release
Read more here
luaDec Beta2
Less crashing
More decompiling
Read more here
LuaDec Beta1
Decompiling simpler scripts and recompiling them will result in a semantically identical compiled lua script!
Numeric for loops are fixed, they should work fine
Complex boolean expressions and conditional statements will make luadec crash
Only works with ascii files. Don't forget to convert the lua files to ascii then back to unicode
Good to know
Luadec will output a "-- Lua5.1" or "-- Warning" comment to lines, where you should check the output.
If luadec crashes try running it with the "-d" parameter to acquire as much information as you can.
Compile your lua files with the "-s" parameter set.
It was compiled with Visual C++ 2008, so you might need the MSVC++ 2008 redistributables too.
Valid Numbers are in range from -32768.0 to 32767.0. Numbers not in this range will be cropped by the compiler.
There is a decompilation tutorial starting here
DL link: http://winmo.sztupy.hu/luadec.html
I start a repository at post #3 for them, but you can just look at the decompiled rhodium2 scripts too.

Does not work for me.

Useful snippets of code
Succesfully decompiled scripts
All rhodium and rhodium2 scripts:
http://winmo.sztupy.hu/manilakitchen.html
Run an application:
Code:
Shell_NavigateTo(command,parameters)
Add an eventhandler to an event: (thx D-MAN666)
Code:
object.EventName:connect(functionRef, scopeRef);
object.EventName:disconnect(functionRef, scopeRef);
Where events can be: onPress, onRelease, onReleaseOutside
Example (from 4aefb03d_manila):
Code:
require("hitfeedback")
OnPhotoTouchPress = function(loc_0)
gnPhotoTouchPressY = loc_0._ymouse
Camera3DHitFeedback:Press()
end
PhotoHitTarget.onPress:connect(OnPhotoTouchPress)

sztupy said:
More detail please... no output? crash ? missing dlls?
Click to expand...
Click to collapse
It simply return "cannot execute this file", tested on XP and Win7 beta

do you have to do something first at manila files?
for me say bad headers!
@udk : i'm running on win 7 beta too and it's working in CMD...

utopykzebulon said:
@udk : i'm running on win 7 beta too and it's working in CMD...
Click to expand...
Click to collapse
That's strange, maybe I miss some files.

udK said:
It simply return "cannot execute this file", tested on XP and Win7 beta
Click to expand...
Click to collapse
Do you have the MS Visual C++ 2008 redistributables? (MSVCR9 and MSVCP9)

utopykzebulon said:
do you have to do something first at manila files?
for me say bad headers!
@udk : i'm running on win 7 beta too and it's working in CMD...
Click to expand...
Click to collapse
did you unicode2ansi them?

sztupy said:
did you unicode2ansi them?
Click to expand...
Click to collapse
yes it's work onw thx man
For "ERROR_nil" you have to decompile lua files with chunkspy and correct it manually

utopykzebulon said:
yes it's work onw thx man
For "ERROR_nil" you have to decompile lua files with chunkspy and correct it manually
Click to expand...
Click to collapse
I' now comparing the VM docs of 5.0 and 5.1 and I'm comparing the changes. I already corrected a lot of bugs, so in the next version you might not even need chunkspy

sztupy said:
I' now comparing the VM docs of 5.0 and 5.1 and I'm comparing the changes. I already corrected a lot of bugs, so in the next version you might not even need chunkspy
Click to expand...
Click to collapse
you're great man
waiting for your relase!

Alpha 2:
Less chatty (no more "arg" values)
Fixed constant loading errors
fixed function variables
Added handlers to the new opcodes
Some changes to OP_TEST
Check first post for links.
I also started a repository for useful snippets of code at post #3

Wow, that looks promising!

Hi!
beta1 is released. I also added a compiler (and an interpreter just in case), that was changed to use TF3D's Q16.16 numeric encoding format. (Thanks to D-MAN for deciphering the encoding)
Currently luadec is able do decompile a lot of scripts, except:
Scripts with too much local variables
Scripts with complex boolean expressions and conditional statements
Scripts where luadec crashes while decompiling
This means however that recompiling small scripts WORK, and will result in a semantically identical files (semantically means it will do the same as the original. Usually the only thing that is changed is the line number of the function declarations (yes, lua stores this information in the compiled files) )
Tutorial
For example, to change 4aefb03d_manila do the following:
1. Convert it to ascii
Code:
luaconv 4aefb03d_manila x uni2asc
2. Decompile
Code:
luadec x > m.lua
3. Edit m.lua
4. Recompile using luac from my package
Code:
luac -s m.lua
5. Convert output back to unicode
Code:
luaconv luac.out 4aefb03d_manila.new asc2uni
Here is an example: this will run footprints instead of HTCAlbum
Code:
require("hitfeedback")
gnPhotoTouchPressY = -1
Camera3DHitFeedback = HitFeedback(Camera3D)
OnPhotoTouchPress = function(loc_0)
gnPhotoTouchPressY = loc_0._ymouse
Camera3DHitFeedback:Press()
end
OnPhotoTouchRelease = function(loc_0)
Camera3DHitFeedback:Release()
if gnPhotoTouchPressY ~= -1 and loc_0._xmouse < CameraSprit.Position.x and noImage2DCamera._visible == false then
Shell_NavigateTo("\\Windows\\HTCFootprint.exe", "")
end
gnPhotoTouchPressY = -1
end
OnPhotoTouchReleaseOutside = function()
Camera3DHitFeedback:Release()
end
PhotoHitTarget.onPress:connect(OnPhotoTouchPress)
PhotoHitTarget.onRelease:connect(OnPhotoTouchRelease)
PhotoHitTarget.onReleaseOutside:connect(OnPhotoTouchReleaseOutside)

You're the best
Now we can create a lots of manila mods
i try it now
thanks a lot for this tool
one of the best with mode9editor
edit after use:
really a giant leap in manila research....

fantastic work, sztupy. Already working on integration with m9editor. You're going to break the final frontier

6Fg8 said:
fantastic work, sztupy. Already working on integration with m9editor. You're going to break the final frontier
Click to expand...
Click to collapse
it will be fantastic....

WOW! manila's inside out
great work
i'm using windows 7 beta and i'm getting this error:
the application has failed to start because its side-by-side configuration is incorrect. Please see the application event log or use the command-line sxstrace.exe tool for more detail.
how to correct this?

pcarvalho said:
WOW! manila's inside out
great work
i'm using windows 7 beta and i'm getting this error:
the application has failed to start because its side-by-side configuration is incorrect. Please see the application event log or use the command-line sxstrace.exe tool for more detail.
how to correct this?
Click to expand...
Click to collapse
Did you install the MSVC++ 2008 redistributables?

sztupy said:
Did you install the MSVC++ 2008 redistributables?
Click to expand...
Click to collapse
yes, all that you say in first post is installed...
in the log i have:
Activation context generation failed for "C:\Users\XXXXXXXXX\Desktop\lua\luadec.exe". Dependent Assembly Microsoft.VC90.DebugCRT,processorArchitecture="x86",publicKeyToken="1fc8b3b9a1e18e3b",type="win32",version="9.0.21022.8" could not be found. Please use sxstrace.exe for detailed diagnosis.
and found this...
http://www.gamedev.net/community/forums/topic.asp?topic_id=493103

Related

Mortscript XML Parser

New Version, v2.3
# v2.3 Minor tweak to allow passing a filename instead of
# naruzo 20080117 an XML string
# Added option to disable string shrinking (shrinkString)
# Added a filter option. filterType can be "include" or "exclude"
#
Click to expand...
Click to collapse
I bundled RSSWeather.mscr (an example script that accesses Yahoo! weather feeds), the readme and the parser into one archive. The only file necessary to use the parser itself is parseXML.mscr.
There is also a new example included in the archive, topStories.mscr, which is a tool to access the Yahoo! top stories news feed (http://rss.news.yahoo.com/rss/topstories) and utilizes the new filterTags functionality to improve performance. The script reads each news item, pulls down the image file from Yahoo!'s site and stores several pieces of information in the registry for use in other scripts/rlToday/etc.
==================================================
Hello there!
I wrote an XML parser for Mortscript. From the synopsis:
parseXML.mscr is an XML parser written in Mortscript.
Writing a custom parser for every application tends to waste a lot of effort and time. Although a custom script for 1 particular application may be faster, parseXML.mscr simply offers a way to parse any XML into an easily accessible data structure with minimum coding/Mortscript experience.
The initial use case was to parse a Yahoo! weather RSS feed for use in my rlToday home screen (RSSWeather.mscr) An example script for parsing the Yahoo! Top Stories feed also exists (topStories.mscr)
parseXML is not staggeringly fast, but several options exist that can improve performance. I have not run it against any particularly hairy XML, but in theory it should be able to handle any well-formed XML.
Click to expand...
Click to collapse
### Output:
The following XML:
<rss version="2.0" >
<channel>
<title>ChannelTitle</title>
<item>
<title>ItemTitle</title>
<description lang="en" country="US">This is the description</description>
</item>
</channel>
</rss><!-- Published by blah 2007 -->
Parses to this data structure:
struct["rss"]["version"] = 2.0
struct["rss"]["channel"]["title"] = ChannelTitle
struct["rss"]["channel"]["item"]["title"] = ItemTitle
struct["rss"]["channel"]["item"]["description"]["lang"] = en
struct["rss"]["channel"]["item"]["description"]["country"] = US
struct["rss"]["channel"]["item"]["description"]["value"] = This is the description
struct["comment"] = Published by blah 2007
Click to expand...
Click to collapse
Enjoy!
thanks
NOw i go tmore idea on how to do other stuff.
v3patel said:
NOw i go tmore idea on how to do other stuff.
Click to expand...
Click to collapse
I hope so!
The parser uses Mortscript 'references' to build the data structure, which are a new (and very handy) feature as of version 4.1, if I remember correctly.
@naruzopsycho:
I'm trying to understand your xml parser and what the output would be. Is the output data written to registry, or to a specific file? Please forgive me my very limited knowledge about mortscript that I'm unable to understand your file completely.
The real use I have for this is to understand the weather cache file for pointUI, which is written in xml format (please refer to the attachment), to read the temperature and weather code and insert those to registry to update the S2U2 user weather as suggested in this thread:
http://forum.xda-developers.com/showthread.php?t=390841
I have posted the same question in the above thread and I think you may have a better idea of how to read the xml file.
Thank you for your help!

[Release-28th May 2009]Code Snippet Viewer v0.5.1 + Code Snippet Creator v0.5.0

With this tool you can lookup CodeSnippets on the Go! Just add them to the Access Database, convert it with the included tool "Code Snippet Creator" and copy it to your Device and start "Code Snippet Viewer"
The Viewer is Tested on my Stock HTC Kaiser - But it should run on any Touchscreen powered WM Device with netcfv2
Code:
Code Snippet Viewer v0.5.1
---
1. Copy the "Release" dir on your Windows Mobile Device with .NETcf2
2. Run "CodeSnippetViewer.exe" on Device
- Version 0.5.1
.Fix
- Version 0.5.0
.Release
Code:
Code Snippet Creator v0.5.0
---
1. Run "csviewer.exe" on Desktop PC
2. Press "Create Database" Button to create "CodeSnippets.txt"
3. Copy "CodeSnippets.txt" to your Device, where "CodeSnippetViewer.exe" is located
The Snippets are read out of the "CodeSnippets.mdb", feel free to add your Snippets there, and Post it on XDA-Developers
- Version 0.5.0
.Release
Download
http://www.scilor.com/codesnippets.html
If you have suggestions to improve this, just post it here!
Space Holder for additional things later on
WOW.. very interessting and helpfull Prog thank you
No Problem, if you have suggestions post it here
what is it for?
sorry for this question im just a newbie,
when i see it right r u german, so pm me pls in german if u can THX!
Ok I don't know exactly what this is for? I wish I did because it looks intriguing.
so what is it for now? can anybody describe it please?
You can create an Access Database for Code Snippets or other things you need to access on the go
then you can convert it and upload it to you phone
Website Added:
http://scilor.sc.funpic.de/codesnippets.html
i have tested your app. but it doesnt work. when i use your sample files, it works, but when i generate a new txt from my mdb, there is an error starting the app. ArgumentOutOfRangeException
here is my exported *.txt. I love this program. great work. i try to sync the mdb with a mysql db in the the net. so i can add new snippets online and sync them back to the device.... i have a cms on my website, where i have some modules which i can use for this. it works also with syntax highligtning (on the net) for some of the programming languages.
Thank you for your feedback, but I have the problem, that it doesnt works in the emulator anymore, I do not know why, it worked before xD
I'll If I can find teh problem.
NEW VERSION
Problem should be fixed!
many thx. i will try this @home, because i am now @work i will try to make an exporter with PHP for my online version to, when i have it done, i can mail them to you. this exporter should be easy to code. i can also make an importer, so that you can import a textfile.
the next idea could it be, that you mobile can add a new recordset with a new snippet, so the sync ist complete... but this only an idea by me...
Here you have the needed code for exporting from SQL to textfile (Routine from the Creator):
I have stripped it down just to show the important things
Code:
oRS.Open "SELECT * FROM CodeSnippets ORDER BY ProgrammingLanguage ASC, Category ASC, UnderCategory ASC", oConn, adOpenKeyset
oRS.MoveFirst
txtData = oRS.RecordCount & vbNewLine
For I = 1 To oRS.RecordCount
TempData = oRS.Fields("ID").Value & ">{.+.}<" & _
oRS.Fields("ProgrammingLanguage").Value & ">{.+.}<" & _
oRS.Fields("Category").Value & ">{.+.}<" & _
oRS.Fields("UnderCategory").Value & ">{.+.}<" & _
oRS.Fields("Snippet").Value
txtData = txtData & Replace(TempData, vbNewLine, ".>-NewLine-<.") & vbNewLine
'This Replaces all linebreaks in the Tempdata and attaches it to txtData and also adds a line break afterwards
oRS.MoveNext
DoEvents
Next
oRS.Close
oConn.Close
Call frmViewer.txt_WriteAll(PathTo & "CodeSnippets.txt", txtData)
Here Is a php I wrote from sketch without testing:
Code:
'Connect to the DB first
$newLine = '
';
'Sry that is a new line I do know if "\n" works instead
$SQLString = "SELECT * FROM CodeSnippets ORDER BY ProgrammingLanguage ASC, Category ASC, UnderCategory ASC";
if ($SQLAnswer = mysql_query($SQLString))
{
$txtData = mysql_num_rows($SQLAnswer).$newLine;
while($row = mysql_fetch_object($SQLAnswer))
{
$TempData = $row->ID.'>{.+.}<';
$TempData .= $row->ProgrammingLanguage.'>{.+.}<';
$TempData .= $row->Category.'>{.+.}<';
$TempData .= $row->UnderCategory.'>{.+.}<';
$TempData .= $row->Snippet;
$txtData .= $newLine.str_replace('.>-NewLine-<.', $newLine, $TempData).$newLine;
}
}
'Write $txtData to a File!
yes this should do the job. i will try it at the weekend. many thx
the rapidshare link show the old version. Can you please update the file or the link?
i have done the online version. there is a *.sql file included, this generates the needed MySQL tables. Also there is a slightly modified *.mdb. i have only modified the Formular.
next there are the needed php an html files for the webserver. the html file is a template, so anyone can modify it.
Update:
i have done some Additions. Included is now EditArea a OpenSource Syntax Highlightning Script. Also i have added a new version of the SQL table, since there is a new field "highlight", this is only for the JavaScript, this field will not be exported in any way.
Now you can manualy add a ProgrammingLanguage or Category by the textfield OR you can choose one from existing Selectbox.
The last time i have forgotten to say, that you must configure the MySQL connection in the common.php. have a look at the following block and put in the right values:
Code:
define("DATABASE_NAME","");
define("DATABASE_USER","");
define("DATABASE_PASSWORD","");
define("DATABASE_HOST","");
Sorry, made a mistake on my website, now it points to the new version
there is no new *.exe file in the zip :-( the directory contains only some txt files :-( please reupload the file.
Sry, here it is again.
Had a problem with my packer

[UTILITY] Manila 3D Kitchen [BETA, with rhodium manila support]

Hi!
There a lot of kitchens avaialable for ROM building. Now this one is to ease TouchFlo3D building.
This kitchen uses the knowledge and works of 6Fg8, D-MAN666, xboxmod, chainfire and many others who are involved in Manila hacking.
If you use this kitchen and/or any of the decompiled scripts then be so kind and share back the source code of your modified scripts too!
This kitchen (v1.5) has the following utilities included:
6Fg8's mode 9 editor (v3.3.0.1)
sztupy's mode9 converter (v1.0)
chainfire's CFC compressor (v0.46)
MKT: a tool for batch converting/compressing/compiling mode9,qtc,png,xml,lua files (v1.1)
LuaDec (2.0)
A work in progress lua and xml IDE
And various other tools
In the center of this kitchen stands MKT aka manila_kitchen_tool, which is like 'make' but for manila kitchen developement.
It has the following functionality:
split hased _manila files back to their original filenames
join a bunch of files in a directory back to their hashed form
mass decompile mode9 files back to xml and save their lua scripts
mass convert qtc files to/from png files
mass compile lua files
It works like 'make' in sense that only the modified files will be recompiled/recompressed so after the firts setup it might be ideal for manila development.
The output of the kitchen was tested with the Rhodium manila (WVGA version) on a HTC raphael device and it works, so this project is no longer a prototype, but is still considered beta stuff
Kitchen set up
I uploaded a complete Rhodium2 Manila kitchen in case you want to use that as a base (download both the kitchen and the rhodium files, then copy them to the same directory), but of course you can use any other manila pakcage you get across. To set up the kitchen copy the package into the 'pkg' directory then run:
Code:
mkt split
to split the hashed files back into their filenames. (For this conversion it uses the same table as m9editor uses.)
You will get a "bin" directory. This will hold all "compiled" stuff, so here you will find all the files that don't need more preprocessing, and can be hashed/installed to the device
Next you want to get some editable files out from the luac, mode9 and qtc files, so use:
Code:
mkt -x bin frommode9
To decompile mode9 files back to XML (it will also extract the scripts out of the package)
Next:
Code:
mkt -c d,qp fromqtc
or
mkt fromqtc
Will convert all qtc files to png files. (the first type will work on cfc compressed qtc files, the second will work on non cfc compressed files)
After this only the scripts are remaining. Unfortunately these can't be decompiled easily, so grap the decompilation of someone (like me ), and put these files into the "insrc" directory. After this run
Code:
mkt -d insrc -o src split
so all the hashed _manila files will be converted back to their original filenames to ease searching through them.
After this you're ready with your prepared kitchen. These things were already done with the Rhodium manila so you might use that package to start manila modding.
Compiling
You can use tomode9, compile and toqtc commands to compile these files back to their binary counterpart. Alternatively you can use:
Code:
mkt -c pq,c,p make
to run this three command after each other. It's like a Makefile, so it will only compile things that have changed. Of course you might want to 'make all':
Code:
mkt -a -c pq,c,p make
This will build all files from the "src" directory into the "bin" directory
Creating the package
After you're done you can use
Code:
mkt -o outdir join
to hash all files from the bin directory back to hashed form, and put it into the 'outdir' directory. Next add the binaries and you're ready to flash
Alternatively I included createpkg that will create a cab package from the OEM apckage found in the 'pkg' directory
Download and other stuff: http://winmo.sztupy.hu/manilakitchen.html
Sounds great! Downloading now. Thanks sztupy!
Yeah, good job sztupy, this will be a great addition.
nice...gotta buy a bigger house...so many kitchens
pcarvalho said:
nice...gotta buy a bigger house...so many kitchens :d
Click to expand...
Click to collapse
roflcopter
pcarvalho said:
nice...gotta buy a bigger house...so many kitchens
Click to expand...
Click to collapse
what you need is a microwave
sztupy said:
Missing functionality / bugs:
Embedded decompiled scripts can't be re-embedded into mode9 files automatically (this would need a command line mode9 editor
Click to expand...
Click to collapse
I can help you out with that. Not that it's already done but copying the relevant parts from m9editor together isnt the big deal.
6Fg8 said:
I can help you out with that. Not that it's already done but copying the relevant parts from m9editor together isnt the big deal.
Click to expand...
Click to collapse
I hoped so
unfortunately it's hard to tell a command line tool where to inject the scripts... An XML export/import function would be cool (export it to XML, without the binary scripts, then add the decomp'd scripts, and the importer would do its job esolving everything), but I know that won't be possible until you resolve the mode9 files completely...
sztupy said:
I hoped so
unfortunately it's hard to tell a command line tool where to inject the scripts... An XML export/import function would be cool (export it to XML, without the binary scripts, then add the decomp'd scripts, and the importer would do its job esolving everything), but I know that won't be possible until you resolve the mode9 files completely...
Click to expand...
Click to collapse
hm, didnt do much with xml, but i think i can figure that out. mode9 is almost done, there's only one bytegrave at the end of a mode9 file still unknown to me.
6Fg8 said:
hm, didnt do much with xml, but i think i can figure that out. mode9 is almost done, there's only one bytegrave at the end of a mode9 file still unknown to me.
Click to expand...
Click to collapse
your visualization of the m9 files look like xml, that's why I thought about that (but yaml could be a good serializator too). But this is just an idea, if you can tel me an easy way to tell a command line script where to inject a script that would be fine
And a command line CFC compressor is also needed
sztupy said:
your visualization of the m9 files look like xml, that's why I thought about that (but yaml could be a good serializator too). But this is just an idea, if you can tel me an easy way to tell a command line script where to inject a script that would be fine
And a command line CFC compressor is also needed
Click to expand...
Click to collapse
mode9 is basically binary XML, so i had no choice
The easiest way (at least for me) is byte positions just kidding ...
I'm on vacation next week, maybe i'll get struck by an ocean of light while skiing on one of the wonderful austrian mountains
CFC compressor .... I've that lying around somewhere here, shouldnt be a problem to adapt it.
an ambitious project... thank you
nice work great addition
Scripts update addon with the newest decompiled stuff.
Kitchen is now tested and considered BETA. Also added a great new tool: MKT to the kitchen. Read first post.
sztupy said:
Kitchen is now tested and considered BETA. Also added a great new tool: MKT to the kitchen. Read first post.
Click to expand...
Click to collapse
Just downloaded kitchen and getting ready to start playing. Just wondering, will this make a installable cab file for rhodium manila for touch pro? Of course with vga adapted files. I've noticed that previous attempts of making a cab for it have failed, but oem packages work when cooked in. I'm making a theme, which shouldn't require a full install, but would be nice to know.
showaco said:
Just downloaded kitchen and getting ready to start playing. Just wondering, will this make a installable cab file for rhodium manila for touch pro? Of course with vga adapted files. I've noticed that previous attempts of making a cab for it have failed, but oem packages work when cooked in. I'm making a theme, which shouldn't require a full install, but would be nice to know.
Click to expand...
Click to collapse
I tried to install it as a cab on NATF's ROM I'm using, and it worked flawlessly. It might break on a stock ROM though. The whole convert to cab thingy is alpha currently, but hopefully it will be solved.
sztupy, So how do you go about fixing the main function? I have the LUA file I've been working on done except for the main function and all the Q16.16 instances. But looking at the src.lua file, it appears chunks of the main are scattered throughout the file. Literally, I have code parts at the beginning of the file, in the middle and at the end of the file.
That's how the luadec output that you ran for me (because luadecguess was inaccurate) outputted the decompile.
So I'm stuck because I'm not sure how to proceed with fixing it. What do you do, just leave it where it's at and search for what it's referring to and fix it where you find it? Or do you cut/paste (move) it at the top of the src code in the order it's supposed to be in?
EDIT: never mind, left the code where it was and just searched out and fixed what it referenced. Other then the Q16.16 lines, everything is good.
Hi sztupy. Excellent work. Im poor and unemployed so although Id like to, I cant donate any cash at the moment. I like this project enough to offer body parts though, if any of yours fail
EDIT - bug report removed. was related to luaconv.exe. moving to another thread.
smotrs said:
sztupy, So how do you go about fixing the main function? I have the LUA file I've been working on done except for the main function and all the Q16.16 instances. But looking at the src.lua file, it appears chunks of the main are scattered throughout the file. Literally, I have code parts at the beginning of the file, in the middle and at the end of the file.
That's how the luadec output that you ran for me (because luadecguess was inaccurate) outputted the decompile.
So I'm stuck because I'm not sure how to proceed with fixing it. What do you do, just leave it where it's at and search for what it's referring to and fix it where you find it? Or do you cut/paste (move) it at the top of the src code in the order it's supposed to be in?
Click to expand...
Click to collapse
You can consider every function in the file as a value. It's just like a number or a string in this case, because in the main body you assign functions to some variables. So if you find something:
Code:
SomeStuff = function(foo)
lots of stuff
lots of stuff
lots of stuff
end
SomeOtherStuff = function(bar)
lots of stuff
lots of stuff
lots of stuff
end
Then in the main body this will translate to:
Code:
SomeStuff = funtion1
SomeOtherStuff = function2
And in the disassemlby to something like this:
Code:
R0 := Function(f1)
SomeStuff := R0
R0 := Function(f2)
SomeOtherStuff := R0
And of course the definitions of these functions will be put after the main body (just as with any other inlined function, the only exception is that compare/luadec and the other tools I made will handle these functions separately to ease decompiling). So if you have to fix the main body you have to only look at the part of the script which is not in a function...end body

[APP] IITP - imageinfo.txt producer

IITP - imageinfo.txt producer
version 0.1 - 2009.06.18
IITP is the tool for generating imageinfo.txt files from imageinfo.bin files, found in modules. It's mainly for people who still use XIPPort
Usage:
Code:
iitp [ -p physfirst ]
The param -p is optional. The value of PhysFirst has to be given in hex form, but both 0x1234abcd and 1234abcd notations are accepted.
If the param is not given, it looks for romhdr.bin file in the current directory, from which it takes this value (and while it's there, it generates ROMHDR.txt file, too).
WARNING:
As of now, it generates incorrect info for nk.exe! The same goes for modules from imgfs space.
Correct info is generated as of now only for XIP modules (with the exception of nk.exe).
Fixing these two things are on the TODO list
Many thanks go to globalbus for the theory help and to c_shekhar for pushing me to develop this little tool. Thanks guys!
Project home page:
http://code.google.com/p/iitp/
Changelog:
2009.06.18
- Initial release
great work indeed. Shall download to test... kudos to you...
great job! didn't think this was possible
thanks
Excellent tool!! Thank you very much.. can't wait for the version that will parse NK.exe correctly
edit: Is it possible to also generate the other txt files which XIPPORT requires? e.g. busenum.dll.txt which contains:
Module name: busenum.dll
dwFileAttributes: 00000007
ftTime: 01C9E411213D1D00
nFileSize: 00002DB0
lpszFileName: P+0007BFEC
ulE32Offset: P+00180F68
ulO32Offset: P+001A16A8
inertiax3 said:
can't wait for the version that will parse NK.exe correctly
Click to expand...
Click to collapse
Yeah, it's on its way - although you should have this file already It's the modules from MSXIPKernel package, which are changing... OEMXIPKernel stay the same - unless you get a new kernel from somewhere.
Nevertheless, it will be available very soon.
inertiax3 said:
edit: Is it possible to also generate the other txt files which XIPPORT requires?
Click to expand...
Click to collapse
I'll try, after I'm done with those two other things
utak3r said:
Yeah, it's on its way - although you should have this file already It's the modules from MSXIPKernel package, which are changing... OEMXIPKernel stay the same - unless you get a new kernel from somewhere.
Nevertheless, it will be available very soon.
I'll try, after I'm done with those two other things
Click to expand...
Click to collapse
That's specifically my case.. a new NK.exe (specific for the device).. Thank you in advance!

[JAR][frameworks] A little program to automate changing all those ids

Don't you wish smalis referenced xml by their tag name instead of those hex numbers? It would be so much easier to port smalis from one framework to another.
Changing every id that is different from the original fw to the destination fw by hand is feasible, but very time consuming. Thus, I made this little java program to automate the task. It runs in the command line, and takes four arguments: the smali you want to change, the smali to be created, the original public.xml, and the target public.xml
It is meant to be used with the script that is also attached, to change all the smali files in any directory. It should work also in windows, but I don't include a .bat file since I only tested this in ubuntu.
the idea is to use it like this:
Code:
./changeAllIds.sh in/ out/ original.xml target.xml > log 2 > err.log
Known issues/bugs/TODO-list:
- The bad news is that the program will throw an exception if there is an id in the smali file that is present in the original.xml but not in the target.xml. The good news is that it will output to stderr the name of the smali file and the line that has that reference, so you can immediately know which one is and add it to the target fw.
- For some reason, the ids 'ok' and 'cancel' will make this program crash. It was for me faster to temporally remove those references in the smali file and continue (adding them back later) rather than fixing the code. You're welcome to fix it if you feel like.
Source code can be found here:
https://github.com/aleadam/xml_id_changer
Well, thank you Sine for linking me to another post in the Vibrant forum.
There is a java program made by untermensch posted 3 days ago that does the same. Except, as judging by the description and the comments, that it's well done, as opposed to the crude and amateur code I posted above
http://forum.xda-developers.com/showthread.php?t=945637

Categories

Resources