[JAR][frameworks] A little program to automate changing all those ids - Captivate Android Development

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

Related

SDConfigGen - a tool for automatically creating SDAutorun configurations

First off, I'd like to thank Sleuth255 for SDAutoRun, and to mousio for his AutoRun tool which provided the inspiration for this project.
SDConfigGen is a command line tool for the PC which inspects a collection of files to be installed, then produces an SDConfig.txt and other associated scripts and provisioning files to allow SDAutoRun to automatically install them.
It differs from mousio's solution in that rather than having SDAutoRun call a MortScript to do all the work, this tool creates an SDConfig.txt to do the majority, only calling scripts for specific functionality when required. Scripts (and therefore MortScript) may not even be required, if nothing being installed needs automation.
Installation
Unzipping the contents of the archive will produce this folder structure:
\
Storage Card\SDConfig\Cabs\
Files\
Scripts\
Settings\
Sys\​First things first - to use any of the script-based functionality a copy of the MortScript installation cab file must be placed within the Sys folder. Download MortScript-4.11b7.zip (or newer version) from http://www.sto-helit.de, then extract \cab\MortScript-4.11b7-PPC.cab from it.
Usage
If the name of the Storage Card will be different on your target device, then rename that folder to whatever it will be. Otherwise, just leave it as it is.
Within the sub-folders of SDConfig, add the files you want to be installed.
Cabs:
Any .cab files in this folder will be installed. If the installation of a .cab file requires user interaction (to confirm a license window, for example), then create a .mscr script file of the same name containing instructions to be executed while the cab file is being installed.
For example, if you need to install a cab file: "eWallet-PocketPC-Install.cab",
create a file called "eWallet-PocketPC-Install.mscr" too. This file contains
MortScript to be run while the cab installer is being run, for example:
Code:
windowTitle = "Software License Agreement"
WaitFor(windowTitle, 60)
SendLeftSoft(windowTitle)
Note that you don't need to worry about actually installing the cab, or waiting for installation to finish - just write the automation code itself.
The SDAutoRun UI will be hidden while an interactive cab is being installed like this, and a MortScript status window shown instead. The device will be responsive to user input, so if any non-automatable interaction is required, that can be done manually.
Files:
After the cab files have been installed, all files in this folder will be copied directly to the root folder. To copy files to sub-folders, place them in sub-folders of this folder. For example, to copy files to the Windows folder, create a Windows folder here and place the files within it.
Standard (English) folder names will automatically be replaced by variables, so files in the "Files\Program Files" folder here will be copied to %CE1% folder by SDAutoRun.
The file copy operation is actually performed by generating a CopyFiles.xml provisioning file in the Sys folder, and it is this that goes in the SDConfig.txt file. This method was chosen as it avoids the path length limit of copying directly in SDConfig.txt, and allows for the %CEn% variable subsitution scheme.
Settings:
After the files have been copied, any settings in this folder will be applied. Settings may either be .xml provisioning files (which are added directly to SDConfig.txt), or registry data in .reg, .rgu or .cereg files. Registry data files will be automatically converted to xml provisioning files within the Sys folder, which are then added to SDConfig.txt.
Scripts:
After the settings have been applied, any .mscr scripts within this folder will be executed. SDConfigGen will generate instructions in SDConfig.txt to automatically handle copying them to the \Temp folder and renaming them to replace spaces by underscores before execution if required.
Note that the device will not be interactive at this point, so don't write scripts that require user interaction.
Sys:
Apart from placing a copy of MortScript-4.11b7-PPC.cab in here, you shouldn't touch the contents of this folder; they will be automatically cleaned out and generated by the SDConfigGen tool.
Notes
I've provided RegToXml as a standalone .exe file so that registry data files can be manually converted to .xml provisioning files, if required. This is not generally necessary, though, as it will occur automatically as part of the SDConfigGen process.
Due to limitations of SDAutoRun, during installation some files need to be copied to the \Temp folder on the device before execution. A TempCleanup.xml provisioning file is generated in the Sys folder by SDConfigGen which is the last thing executed by SDConfig.txt. It should remove any temporary files that were placed in the \Temp folder, but will not remove the folder itself, or any other files within it.
SDAutoRun also requires that SDConfig.txt be ASCII, which means that if any files contain characters outside that range (such as accented characters), they can not be directly referenced. SDConfigGen will automatically detect this, and generate provisioning XML files to transparently rename the files before processing them, then back again afterwards.
The last statement in the SDConfig.txt is the RST: Reset statment, to reset the device.
The only part of the file structure that can be changed is the name of the "Storage Card" folder - the other folders cannot be renamed or moved. By default, when the SDConfigGen tool is run, it works with the first sub folder under the folder the .exe file is placed. To override this behaviour, pass the folder path to SDConfigGen.exe as a command line argument.
Cabs, settings and scripts are executed in alphabetical order, grouped by subfolder. Subfolders will be executed first, so for example the contents of Cabs\Prerequisites\ would be installed before the files directly in Cabs\ (but after files in Cabs\A\). All interactive cabs are executed first, followed by non-interactive ones.
All generated files (except SDConfig.txt) are in Unicode UTF-16 encoding.
To have SDConfigGen create a log file of the generation process, use the SDConfigGenWithLog.bat file included in the archive. It will create a results.log file containing the messages that would normally be output to the console.
This is still an early version, so there will probably be bugs with it. I've used it successfully for setting up my own device several times now, but I can't make any guarantees. Please do post any bug reports or suggestions here though!
Alex
Updates
0.6:
All output files are now in UTF-16 encoding, with the exception of SDConfig.txt, which is in ASCII.
If files referenced by SDConfig.txt have names containing non-ASCII characters, provisioning files to automatically rename them before they are accessed, and to restore them afterwards will be generated.
Subfolders are now supported in the Cabs, Settings and Scripts folders. Files within subfolders will be processed first, in alphabetical order of subfolder name.
File folder variable substition made case insensitive
Added SDConfigGenWithLog.bat file for easy logging of output to a log file
0.5.1:
Removed .svn files from the file structure (oops!)
0.5:
Made warning message on skipping registry files less confusing
RegToXml: Now supports empty values for String, MultiString and Binary values
RegToXml: Made ,ore robust to invalid data - if a value contains invalid data, only that value is skipped.
RegToXml: The line number is now reported with any error or warning message.
RegToXml: Whitespace allowed to surround the = in value lines.
0.4:
RegToXml: Fixed nesting bug with registry key deletion conversion
RegToXml: Now supports comments (lines starting with ; )
0.3:
RegToXml now assumes that registry files without Unicode BOM's are encoded in the system default ANSI codepage, rather than UTF-8 (this means that if your registry file is UTF-8, it must contain a Byte Order Mark to be read correctly)
0.2:
Files are now installed in alphabetical order by file name (within their own group). For example, first interactive cabs A-Z, then non-interactive cabs A-Z. This allows control over installing cabs that require others to be installed before or after them.
.NET Framework (required)
Lookin Mighty Fine Siuer.
Not in the Testing Time yet.
But does the scripts folder eventually combine the scripts into one?
(lazy Bum At Work, Not Able to test it)
No, the scripts in the scripts folder are not combined into a single script, they are all executed separately. Would there be some benefit to trying to combine them into a single script before execution?
AlexVallat said:
No, the scripts in the scripts folder are not combined into a single script, they are all executed separately. Would there be some benefit to trying to combine them into a single script before execution?
Click to expand...
Click to collapse
No, you are absolutely right there is now good reason for it.
It's better to have them seprated, makes finding **** Ups easier.
Don't know what i was thinking or why..
AlexVallat,
Thanks for your job, you soft is amazingly simple which is a great pro compared to SASHIMI for instance.
So yhis afternoon I started to put all my files in the appropriate folders and when I launch SDConfigGen with the folder path I don't get in the config.txt file \Storage Card\ before the files to execute but the path I gave as parameter. I think transforming the path given into \Storage Card\ could help.
One other point, as a poor French guy your RegToXml converter does not handle all the French extended character set such as é, à, ... Could you make it support this characters.
Anyway for now it is fully usable but requires SDConfig.txt file edition before launching the whole process. Tomorrow it will be hands-on time as I plan to upgrade my Polaris ROM so more news to come regarding SDCofingGen usage.
The_Steph
The_Steph said:
AlexVallat,
Thanks for your job, you soft is amazingly simple which is a great pro compared to SASHIMI for instance.
So yhis afternoon I started to put all my files in the appropriate folders and when I launch SDConfigGen with the folder path I don't get in the config.txt file \Storage Card\ before the files to execute but the path I gave as parameter. I think transforming the path given into \Storage Card\ could help.
One other point, as a poor French guy your RegToXml converter does not handle all the French extended character set such as é, à, ... Could you make it support this characters.
Anyway for now it is fully usable but requires SDConfig.txt file edition before launching the whole process. Tomorrow it will be hands-on time as I plan to upgrade my Polaris ROM so more news to come regarding SDCofingGen usage.
The_Steph
Click to expand...
Click to collapse
Hm my pall had the same thing but changing to Unicode seemed to solve his XML issue. NOt sure if this is the same but worth the try.
Great work alex!
Question:
Anyway to verify the syntax of the provisioning XML files?
Any tools out there that can create these files or verify them? I think a tool like this would be great.
NEVERMIND! I just saw your reply in the reg2xml converter thread! THANKS!
The_Steph: Thanks for your comments!
The idea with the path is that the name of the folder is used to control the name of the Storage Card on the device. So if you name your folder Storage Card, that's what goes in the SDConfig.txt. If, on your device, it has a different name (due to language changes, or whatever), then you need to rename the folder appropriately.
Thanks for the bug report about accented characters in RegToXml. I will fix that and post an updated version soon.
gtxaspec: I could verify that the files were valid XML, but the more useful check that they contain valid provisioning instructions is beyond the scope of this project. Not least because the documentation describing what are valid instructions is confusing and can be inaccurate. With anything other than the file and registry providers, it usually ends up being a case of trial and error. With the file and registry providers, using the auto-generation capabilities of SDConfigGen will avoid most surprises.
Alex
Version 0.3 released
I've just updated the first post to release version 0.3. This should address the accented characters issue raised by The_Steph, however it does mean that if your registry file is UTF-8 encoded, it must include Byte Order Marks to indicate this. Otherwise, it will be assumed to be encoded in the system default code page.
I've also added a feature that files are now installed in alphabetical order (within each group). If you need to make sure that certain cabs are installed before others, this can now be done by renaming them, usually by including a numeric prefix.
Alex
reg2xml bugs
Hi Alex,
Converting everything to xml and using standard provisioning is an interesting approach!
Only obviously reg2xml has got some problems still with .reg files containing certain characters:
I've attached you a sample file which is not converted correctly at three points, each with a different error cause.
- Comments (Lines beginning with ";") in the .reg files are sometimes (not in every case, could not see what the trigger is) leading to an aborted conversion.
- Some characters like the arrow character (ASCII 27/1BHex) are also a problem.
Maybe the attached file helps in finding the bug.
BTW: Do you also have a tool that is converting just the other way around: From XML to reg indstead of from reg to XML?
Sometimes I need to have a .reg file instead of an .XML. And importing the XML and then trying to find all registry entries to export it back to a .reg can be a very tedious thing when the imports are not all together in one registry branch.
Thanks!
Thanks for the bug report, asango. Yes, I forgot about comments, I'll fix that and release an update soon. I'm looking into what the best way to handle control characters like 0x1B is (which is 'Escape', according to the ASCII chart I'm looking at). Obviously crashing is not an acceptable behaviour, so I'll have some sort of fix for it.
I don't have a XmlToReg tool, but it sounds like a good idea - I'll probably write one over the weekend.
Alex
Great, looking forward to that, thank you!
Version 0.4 released
The first post has been updated to version 0.4. RegToXml has been updated to add support for comments in .reg files.
Unfortunately there appears to be no way to include control characters in an XML file. If the character itself, or even the character entity (like &#x1B, then the file is regarded as malformed and not accepted. I have therefore not been able to do anything to fix this (sorry asango!).
If anyone knows of a way that a provisioning file could be used to set a registry string value containing these characters, please let me know.
On a more positive note, the requested XmlToReg tool is up - I've given it its own thread here: XmlToReg.
Alex
Yes, the comments are now handled corectly, perfect!
Some other thing is still an issue:
test.reg: Converting...
test.reg: Conversion failed. (Unexpected value format: dword) Skipping.
In this case the output file is not generated at all, seems that not only the value is skipped but this causes the whole file not being written.
This leads to another suggestion: Would it be possible to indicate the line number where a problem happened?
This would make it much easier to find the problem.
And regarding the non handled escape characters:
This also leads to aborting. Would it also be possible to just skip them and issue a warning but go on with the conversion and with writing the outout file for the rest of the entries?
Now that is odd. "dword" is a perfectly valid value format, it shouldn't have produced that error. Any chance you could send me the .reg file that produced it?
Line numbers should be do-able, I'll add that to the next version.
The "skipping" message there referred to the "test.reg" at the start of the message, not to the dword value. I agree it looks misleading as it is currently worded though, I'll improve that.
About recovering from errors and skipping only invalid values rather than the whole file - this will be quite tricky. By the time I am notified of invalid characters by the XmlWriter, it has already given up in a sulk and can't be persuaded to continue writing any further. I'll need to do some sort of pre-vetting before passing data on to it. If I come up with any good ideas on how to do this, I'll include it in the next version.
Alex
asango, here's a candidate RegToXml.0.5.0 - could you check if it is still reporting the "Unexpected value format: dword" error with your file? It now reports line numbers, which might help track down the problem. It should also be able to recover from an invalid value and skip just that value, although I'm not sure how well that is working yet.
Alex
Hi Alex,
Great, the line numbers are making things much easier and this way I even found the reason for this error very easily:
Here's the point where it is failing:
[HKEY_LOCAL_MACHINE\Drivers\BuiltIn\RIL]
"NITZEnable"= dword:00000001
...with this error message:
test.reg: Converting...
[Line 194] Error: Invalid value (Unexpected value format: dword)
Skipping: HKEY_LOCAL_MACHINE\Drivers\BuiltIn\RIL\NITZEnable
Done.
As soon as I'm deleting the blank between the "=" and "dword" everything is ok.
Maybe you can allow blanks after the "=" in general?
This would solve this issue definitely
And yes, by the way the xml file is now generated despite of this error, very good!
Asango
Hmm... I'm not sure whitespace is supposed to be allowed around the = sign. It doesn't make anything ambiguous though, so there's no good reason not to relax the matching. Try this 0.5.1 which allows whitespace around the = sign, hopefully that should now parse your file correctly.
Alex
Yes, now I can see no other issues with the RegToXml tool, good work!
Also the whole cold boot import is ok with one exception:
Only the CopyFiles.xml which is generated by the SDConfigGen.exe is not copying all the files from the "Files" diectory during its execution.
Tried to import that xml manually with the xml option of Taskmgr and also got an error, but since the error is *very* uninformative and not showing the line number and my CopyFiles.xml is rather big I could not find the problem.
Could it be that the reason for the error is that if a file is already existing or read only that this will stop the rest of the import?
asango said:
Yes, now I can see no other issues with the Only the CopyFiles.xml which is generated by the SDConfigGen.exe is not copying all the files from the "Files" diectory during its execution.
Tried to import that xml manually with the xml option of Taskmgr and also got an error, but since the error is *very* uninformative and not showing the line number and my CopyFiles.xml is rather big I could not find the problem.
Click to expand...
Click to collapse
Second hands-on day with SDConfigGen and I have the same issue with v0.4. CopyFiles.xml is not executed at all. Probably a syntax error issue as stated by asango (I've done the same tests as him).
The_Steph

[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

[DEV][TOOL][PROJECT] Android APK Translation [CMD + GUI]

Android APK Translation - CMD Line Tool
CMD Line - The Idea
Files involved: "strings.xml", "arrays.xml", "plurals.xml"
translated files:
strings.xml - http://pastebin.com/embed_iframe.php?i=5u40nHZP
arrays.xml - http://pastebin.com/embed_iframe.php?i=93v9vZUk
plurals.xml - http://pastebin.com/embed_iframe.php?i=GwBuFdmW
original files:
strings.xml - http://pastebin.com/embed_iframe.php?i=r2W4yYvh
arrays.xml - http://pastebin.com/embed_iframe.php?i=Lfff9Pur
plurals.xml - http://pastebin.com/embed_iframe.php?i=eSe8yf4S
1) Get translated files from a translator.
2) Sort & delete tags/nodes with duplicate attributes from the translated files.
3) Get original files from the ROM.
4) Sort & delete tags/nodes with duplicate attributes from the original files.
5) Merge translated files with original files
(Optional) Discard all XML tags/nodes with attributes that doesn't exist in the original XML
Suggested Tool Syntax
Code:
apktrans [OPTS] --i rom/strings.xml --t translated/strings.xml --o merged/strings.xml
OPTS:
-s - sort xml nodes
-d - delete duplicate xml nodes
-m - discard xml nodes not present in the source xml
Notes
The node is considered a duplicate if there is another node with the same attributes, no matter how many children it have inside of it.
The node with more children overwrites the node with less.
Needed Tool Features
sort xml tags by attribute name
delete duplicate xml tags by attribute name
preserve node properties - ability to work on any kind of tags (string & arrays - children) - see example
should work with UTF-8
Android APK Translation - GUI Tool
GUI - The Idea
Original idea and source code: APK Translation Wizard
For the purpose of explanation, its assumed we want to translate from English source files to Vietnamese without a region code
File Structure
Code:
/
/apks-compiled - holds the apk files after encoding
/apks-frameworks - holds the framework files
/apks-source - holds the apk files for decoding/translation
/apks-translation - holds the apk files after encoding (with the translated files)
/core - holds the application files (binaries, scripts, etc...)
/i18n-crowdin - holds the translation files from the [URL="http://crowdin.net/project/miui-rom-translation"]MIUI translation project[/URL]
/i18n-other - holds the other translation files (drawable, raw, xml, etc...)
Decode Window - APK Decoding
Selectbox: Select which APK files you want to decode - apk files should be present inside the "/apks-source" directory
Selectbox: Select which framework file to use for APK decoding - framework file should be present inside "/apks-frameworks" directory
Button: Decode APK files - using APKTool​
Config Window - Tool Configuration
Button: Load original files - /res/values/strings.xml, /res/values/arrays.xml, /res/values/plurals.xml
Seletbox: Select destination locale - required - vi
Selectbox: Select destination region - optional - rVI
Button: Start Translation Process - set up /res/values-vi (and /res/values-vi-rVI if selected)​
Translation - strings.xml
View: APK_NAME | ATTRIBUTE_NAME | ORIGINAL STRING | TRANSLATED STRING
APK_NAME - name of the decoded apk
ATTRIBUTE_NAME - name of the tag's attribute we are translating
ORIGINAL STRING - the original string for translation
TRANSLATED STRING - the translated string*
*as appears in the /res/values-vi/strings.xml file OR /res/values-vi-rVI/strings.xml file OR empty if none
Button: Sort all tags - sorts all tags by attribute name
Button: Delete duplicate tags - delete tags with duplicate attribute name
Button: Import an XML patch - imports an XML file and merges the tags that have the same attributes
Button: Commit Translation - writes the translated xml file - /res/values-vi(-rVI)/strings.xml
Description
The user will be able to edit the TRANSLATED STRING column only.
The use will be able to edit tags which present only inside the source xml file (the decoded file) so to avoid adding tags which doesn't exist in the application we are translating.
If a tag is present in the XML patch but is missing in the source file; it will be discarded.
Translation - arrays.xml
View: APK_NAME | ATTRIBUTE_NODE_NAME | ORIGINAL STRINGS LIST | TRANSLATED STRINGS LIST
APK_NAME - name of the decoded apk
ATTRIBUTE_NODE_NAME - name of the tag/node's attribute we are translating
ORIGINAL STRINGS LIST - a list of the node's children which includes the original strings for translation
TRANSLATED STRINGS LIST - a list of the node's children which includes the translated strings*
*as appears in the /res/values-vi/arrays.xml file OR /res/values-vi-rVI/arrays.xml file OR empty if none
Button: Sort all nodes - sorts all nodes by attribute name - should NOT sort the children b/c their order is important!
Button: Delete duplicate nodes - delete nodes with duplicate attribute names
Button: Import an XML patch - imports an XML file and merges the nodes that have the same attributes
Button: Commit Translation - writes the translated xml file - /res/values-vi(-rVI)/arrays.xml
Description
ORIGINAL STRINGS LIST & TRANSLATED STRINGS LIST column will have a list of all properties (children) which belong to a specific ATTRIBUTE_NODE_NAME.
The user will be able to edit the TRANSLATED STRINGS LIST column only.
The user will be able to edit nodes which present only inside the source xml file (the decoded file) so to avoid adding nodes which doesn't exist in the application we are translating.
If a node is present in the XML patch but is missing in the source file; it will be discarded.
If a node in the XML patch includes more children then a node in the source file; All additional children will be discarded.
Translation - plurals.xml
View: APK_NAME | PLURAL_ATTRIBUTE_NODE_NAME | ATTRIBUTE_NAME | ORIGINAL STRING | TRANSLATED STRING
APK_NAME - name of the decoded apk
PLURAL_ATTRIBUTE_NODE_NAME - name of the plural's node attribute we are translating
ATTRIBUTE_NAME - name of the plural's node tag attribute we are translating
ORIGINAL STRING - original string for translation
TRANSLATED STRING - translated string*
*as appears in the /res/values-vi/plurals.xml file OR /res/values-vi-rVI/plurals.xml file OR empty if none
Button: Sort all plural nodes - sorts all nodes by attribute name - should NOT sort the children b/c their order is important!
Button: Delete duplicate plural nodes - delete nodes with duplicate attribute names
Button: Import an XML patch - imports an XML file and merges the nodes that have the same attributes
Button: Commit Translation - writes the translated xml file - /res/values-vi(-rVI)/plurals.xml
Description
The user will be able to edit the TRANSLATED STRING column only.
The user will be able to edit nodes which present only inside the source xml file (the decoded file) so to avoid adding nodes which doesn't exist in the application we are translating.
If a node is present in the XML patch but is missing in the source file; it will be discarded.
If a node in the XML patch includes more children then a node in the source file; All additional children will be discarded.
Encode Window - APK Encoding
Selectbox: Select which APK files you want to encode - will be taken from the "/projects" directory
Selectbox: Select which framework file to use for APK encoding - framework file should be present inside "/apks-frameworks" directory
Checkbox: Replace "Resources.arsc" - after compilation, the compiled APK will be unzipped, the Resources.arsc file will be taken out and put inside the original APK*.
Button: Encode APK files - using APKTool
*this is to avoid signature issues within the APK files.​
Android Localization - Useful Resources
Android SDK Guide on Localization
http://developer.android.com/guide/topics/resources/localization.html
http://developer.android.com/guide/topics/resources/providing-resources.html#BestMatch
http://developer.android.com/guide/topics/resources/providing-resources.html#table2
Mobile Country Codes (MMC)
http://en.wikipedia.org/wiki/List_of_mobile_country_codes
List of ISO-639-1 Codes (Country Codes)
http://en.wikipedia.org/wiki/List_of_ISO_639-1_codes
List of ISO-3166-1-alpha-2 Codes (Region Codes)
http://en.wikipedia.org/wiki/ISO_3166-1_alpha-2​
Examples of Usage
Note: trimmed due to forum length limits, notice that the xml tags are not sorted.
translated strings.xml:
Code:
<?xml version="1.0" encoding="UTF-8"?>
<resources>
<string name="common_minutes_ago">%s minutter siden</string>
<string name="common_hours_ago">%s timer siden</string>
<string name="common_days_ago">%s dage siden</string>
<string name="app_name">Browser</string>
</resources>
original strings.xml:
Code:
<?xml version="1.0" encoding="UTF-8"?>
<resources>
<string name="common_minutes_ago">%s minutes ago</string>
<string name="common_hours_ago">%s hours ago</string>
<string name="common_days_ago">%s days ago</string>
<string name="app_name">Browser</string>
<string name="app_settings">Settings</string>
<string name="urltitlebar_gotourl">GO</string>
<string name="urltitlebar_hint">Search or type in a URL</string>
<string name="search_description">Bookmarks, History, Google suggestions</string>
</resources>
final strings.xml:
Code:
<?xml version="1.0" encoding="UTF-8"?>
<resources>
<string name="common_minutes_ago">%s minutter siden</string>
<string name="common_hours_ago">%s timer siden</string>
<string name="common_days_ago">%s dage siden</string>
<string name="app_name">Browser</string>
<string name="app_settings">Settings</string>
<string name="urltitlebar_gotourl">GO</string>
<string name="urltitlebar_hint">Search or type in a URL</string>
<string name="search_description">Bookmarks, History, Google suggestions</string>
</resources>
Duplicate lines are always right after each other, right? I could throw together a script to delete the second line I think. I don't have time right now, but if no one has posted anything by this afternoon, I'll give it a shot for you.
SifJar said:
Duplicate lines are always right after each other, right? I could throw together a script to delete the second line I think. I don't have time right now, but if no one has posted anything by this afternoon, I'll give it a shot for you.
Click to expand...
Click to collapse
there is no need to create a script.
There are many text editors that can do that.
e.g. Notepad++
line 64-65
Code:
<string name="car_mode_disable_notification_message">برای خروج از حالت خودرو انتخاب کنید.</string>
<string name="car_mode_disable_notification_message">برای خروج از حالت خودرو انتخاب کنید</string>
in the above example there is a dot (.) more in 1st line, and for that reason a program will not recognise it as duplicate.
In notepad++ you can check for specific content, mark the duplicated and then delete the marked lines.
We need to delete a duplicate line of "<string name="car_mode_disable_notification_message">" so we make it in notepad++ to search for duplicates that have this pattern
Code:
<string name=" ">
and delete duplicate lines.
I am sure that this can be done because i have used it in the past (long ago).
I'll search some more to remember and post the way to do it.
Merged with Post#1
Merged with Post#1
Useful Resources
Merged with Post#1
Well, I decided to go ahead and throw together this:
deldupe.exe
Basically, pass the XML to deldupe.exe (drag the XML and drop it on EXE, or run it from command line like this: "deldupe.exe example.xml"). It'll delete all the lines with the same "name" attribute. It'll leave the first one. I tested it on the example XML you posted in your first post, got this as a result:
test.xml
Seems about right I think.
Dunno if you actually need this or not anymore, but it only took a few minutes to make, so I figured I may as well.
EDIT: It's also probably easier than messing with a text editor's settings. Just drag and drop, job done.
Merged with Post#1
I have to be honest, I'm not really sure what you mean. In the first file you linked, in reference to XML nodes, I can't see any duplication...
And the second part, I'm not really sure what you want. I understand you want to delete the duplicate lines from each version of each file. But I don't get the bit about merging. What is the final result you want to achieve?
I'm probably just being stupid here, but I can't really work out what it is you want the tool to do. If you could try and explain it in another way or something, I might be able to help.
EDIT: With the nodes stuff: Do you mean deleting a whole array when it is duplicated? If so, I think that could be trickier, but I could try it. I won't until I get confirmation though, don't want to waste time on something that isn't right
Also, seeing as they couldn't be sorted, it would probably be a longer process.
Merged with Post#1
Ah I think I got you now. This seems a LOT more complicated than what the app I posted already does. I might be able to do this, but I most likely won't I'm afraid. I will see what I can do though.
I have some ideas of stuff that might work. I'll start working on a few of them now.
EDIT: I have modified my previous script to now delete elements with duplicate "name" attributes, regardless of position in file. i.e. if an element with attribute is found a second time, it will be ignored. The next step is to modify the app to do this for two files, and then attempt to make it merge the results. I will look into nodes following that. I have made more progress than I had expected to be able to, I am now more hopeful about the chances of being successful.
OK, here is a new, updated EXE. This one takes two inputs, an original XML and a translated XML. It deletes duplicates from both (from anywhere, don't have to be line after each other), then merges all translated strings into the original XML, and saves it. You need to run it from the command line, something like this:
Code:
apk-trans.exe trans.xml orig.xml dest.xml
Gives this output with the two shortened XML fragments you posted: dest.xml (even with me manually duplicating some lines, in random places)
Here's the EXE: apk-trans.exe
I'll work on removing duplicate nodes next, then make it a little more user friendly (e.g. usage instructions built it, some sort of sign it is doing something, maybe an optional GUI [it would appear if app was run with no parameters, so command line usage would still work]).
I reckon removing duplicate nodes could be the hardest part. I may now stop working on this for today and resume tomorrow.
EDIT: At this point, this should work for files like strings.xml. plurals.xml and arrays.xml will both not work. Not actually sure how it would handle files like that. The duplicate deletion stuff shouldn't change them at all. Not sure what the merging will do. Probably also nothing. I'll test now though. EDIT: I tested, spits out the original (untranslated) XML, almost unchanged (spacing at start of line is slightly different, but that shouldn't matter at all)
EDIT: Updated the EXE, noticed it output XMLs with the wrong encoding, fixed that.
EDIT: Saw updated first post - this EXE does pretty much what the command line tool described at the start describes, for strings.xml. It doesn't sort, but it automatically deletes duplicates and those not not present in the original XML.
I've updated the first post with the most recent info and examples so that newcomers can easily get all the info they need.
Hopefully we can turn this into a serious project, next thing I'm going to create a couple of GUI images to better portray how and what the application should do.
@SifJar
Thanks a lot for your help so far my dear friend. I'm hopeful that we can achieve all the required features and make Android translation process an easier experience No doubt that it will catch a lot of attention as soon as its done!
EDIT:
I've tried the tool with the following files and I think I found a bug, the tool hangs...
Please see attached file.
First post have been updated again to better fit the new section
Thanks to the mods for moving it!
Huh. Dunno why it doesn't work with those files. I will look into it more a bit later on.
EDIT: It does work. It just takes a while and there is no visible sign the program is running. That is one of the things I mentioned above as needing to work on. I was focusing more on the functionality for the time being.
SifJar said:
Huh. Dunno why it doesn't work with those files. I will look into it more a bit later on.
EDIT: It does work. It just takes a while and there is no visible sign the program is running. That is one of the things I mentioned above as needing to work on. I was focusing more on the functionality for the time being.
Click to expand...
Click to collapse
Hmm weird, I'm on a Quad-Core Q6600 and I let it run for 10min but it didn't finish yet How much time did it take on your machine?
Thanks!
I didn't time it, but it took a while. I added some command line output to reassure that it is doing something, here's an updated binary:
{see below}
Usage is as before, only now you must add |more to the end of the command, or you won't get any command line output. (Limitation of the scripting language I use seemingly).
EDIT: Seems to take less than 10 mins on my computer, which is lower spec than yours. I'll add a GUI with a progress bar now to show proper progress.
EDIT: OK, here's a new .exe (again). This time, if you add a fourth parameter (can be anything, but I use "gui"), a progress bar will be shown, to show how the tool is progressing. Seems to work nicely for me. Usage is something like this:
Code:
apk-trans.exe t_strings.xml s_strings.xml dest.xml gui |more
The |more gives command line output, the "gui" parameter gives progress bar. You can have both. |more is not necessary if you just want the progress bar (has info on what is currently being done under progress bar on window, same info as is output to cmd line).
Here's the EXE: http://d.pr/f/VmwC
Obviously I will improve the GUI in future, this is just a quick thing thrown together in a few minutes.
Can you please make it so it will generate a proper exit code (0) and get rid of the pop-up if not in GUI mode?
Since it will be used mainly in bash a graphical GUI will be rarely used...
Btw, which language are you using?
EDIT:
Perhaps you could create a GIT for it on Github or similar so others can share their input...
Aternus said:
Can you please make it so it will generate a proper exit code (0) and get rid of the pop-up if not in GUI mode?
Since it will be used mainly in bash a graphical GUI will be rarely used...
Btw, which language are you using?
EDIT:
Perhaps you could create a GIT for it on Github or similar so others can share their input...
Click to expand...
Click to collapse
There should be no pop up if not in GUI mode. And no, I can't change the way it exits, sorry.
I am using AutoHotKey (AHK). Maybe I'll stick up the source somewhere. Give me a minute.
https://github.com/SifJar/apk-trans

[Utility][Tool]baksmali/smali

- What is baksmali/smali?
smali/baksmali is an assembler/disassembler for the dex format used by dalvik, Android's Java VM implementation. The syntax is loosely based on Jasmin's/dedexer's syntax, and supports the full functionality of the dex format (annotations, debug info, line info, etc.)
The names "smali" and "baksmali" are equivalents of "assembler" and "disassembler" respectively.
- Author of the tool
JesusFreke
- Why we need it?
Android apk and jar files will include java classes to execute certain functionality. With baksmali, you will be able to disassemble the java classes into editable form (smalis) so you can do your editing and modding involving java script. Once you done changing, you need to assemble all classes to a readable form for android, i.e, classes.dex and here comes the role of assembler (Smali).
Since we have apk manager, do we still need this tool?
Yes and No!!! Because some apk managers even if they do support jar files but once they decompile smalis, they will remove some lines (.line, .parameter, ...etc) which are in my opinion are useful to locate some codes. So the choice is yours.
- What does this tool do?
Simply it baksmali classes.dex of android apk and jar files into editable form (smalis) to do your changes; then assemble it back (smali).
- Will it affect apk and jar original signature?
No, it will preserve original signature.
- Got problem?
During assembling (smali), you may got error message. You can check log file to locate what is wrong that make the manager stop assembling the file or post the log file for developers to look into it.
- What are the steps to work with this tool?
Run Baksmali_tool.bat file, this will create all needed folders in the first run.
1. Put android apk or jar file in "put-file-here" folder. If Current-file status is set to None, then either you need to set a file in option #3 or you forget putting valid file in "put-file-here" folder.
2. When Current-file status is set to your file, you can disassemble its classes.dex by option #1.
3. Classout folder with name of file project will be created in "project" folder; make your changes there.
4. If finished your changes, assemble classout folder by option #2.
5. If everything is OK, a new file will be created in "finish" folder with tag (Modded_) in its name, push it to your device by option #3 if it was system apk or jar; and if it was non system apk file, install it by option #4.
- Latest stable version
Latest stable baksmali/smali version: 2.2.2 (30.10.2017)
baksmali v. 2.2.2 - Download (bitbucket.org)
smali v. 2.2.2 - Download (bitbucket.org)
baksmali/smaly previous versions - Download (bitbucket.org)
- Latest beta version
Latest beta baksmali/smali version:
- Changelog
baksmali/smali wiki and changelog (github)
- Where can I download latest source code?
You can visit
baksmali/smali source page (github)
and you can download the latest smali and baksmali code versions.
- Special Thanks to XDA Portal Team
Special thanks to XDA Portal Team for featuring this utility
XDA Portal Team
..
hi m8,
thanks for this nice tool
will try it next time I make a new theme
sent from my G-Note
great work majd keep it up
no credit to the author of smali/baksmali? :/
iBotPeaches said:
no credit to the author of smali/baksmali? :/
Click to expand...
Click to collapse
I think the authers are these guys ([email protected], [email protected], JesusFr.. @gmail.com) from project page.. aren't they??? if so I will update OP
majdinj said:
I think the authers are these guys ([email protected], [email protected], JesusFr.. @gmail.com) from project page.. aren't they??? if so I will update OP
Click to expand...
Click to collapse
Yes, thats the same person. I'd just put JesusFreke, as thats his username.
Version 1.1 is online
version 1.2 is online
some bugs fixed
Grate dev, Great tool...tnx majdini:fingers-crossed:
What a great idea to simplify life ^^.
Thanks majdinj.
majdinj said:
Backsmali / Smali Manager​
What is Backsmali / Smali?
smali/baksmali is an assembler/disassembler for the dex format used by dalvik, Android's Java VM implementation. The syntax is loosely based on Jasmin's/dedexer's syntax, and supports the full functionality of the dex format (annotations, debug info, line info, etc.)
The names "smali" and "baksmali" are equivalents of "assembler" and "disassembler" respectively.
Why we need it?
Android apk and jar files will include java classes to execute certain functionality. With backsmali, you will be able to disassemble the java classes into editable form (smalis) so you can do your editing and modding involving java script. Once you done changing, you need to assemble all classes to a readable form for android, i.e, classes.dex and here comes the role of assembler (Smali).
Since we have apk manager, do we still need this tool?
Yes and No!!! Because some apk managers even if they do support jar files but once they decompile smalis, they will remove some lines (.line, .parameter, ...etc) which are in my opinion are useful to locate some codes. So the choice is yours.
What does this tool do?
Simply it backsmali classes.dex of android apk and jar files into editable form (smalis) to do your changes; then assemble it back (smali).
Will it affect apk and jar original signature?
No, it will preserve original signature.
Got problem?
During assembling (smali), you may got error message. You can check log file to locate what is wrong that make the manager stop assembling the file or post the log file for developers to look into it.
What are the steps to work with this manager?
Run Backsmali_tool.bat file, this will create all needed folders in the first run..
1. Put android apk or jar file in "put-file-here" folder. If Current-file status is set to None, then either you need to set a file in option #3 or you forget putting valid file in "put-file-here" folder.
2. When Current-file status is set to your file, you can disassemble its classes.dex by option #1.
3. Classout folder with name of file project will be created in "project" folder; make your changes there.
4. If finished your changes, assemble classout folder by option #2.
5. If everything is OK, a new file will be created in "finish" folder with tag (Modded_) in its name, just rename it to its original name and push it to your device; don't forget to fix permissions as well.
If backsmali and smali code are outdated, what to do?
Just visit codes owner page, and download the latest smali and backsmali code versions and put them in "tools" folder (make sure to rename them to baksmali and smali without version number)
Future development?
Feel free to report any bugs or suggestion to improve upcoming releases :good:
Download
- Backsmali-Manager_v1.2 @ 11/June/2013 (The most recent one)
- Backsmali-Manager_v1.1 @ 7/June/2013 (old)
- Backsmali-Manager_v1 @ 6/June/2013 (old)
Change-log:
@ 11/June/2013 (v1.2):
- Fixed bug of file path in Read Log option.
- Fixed number 10 file that was not shown in Set Current-file option.
@ 7/June/2013 (v1.1):
- Deleting the folder and file in project and finish folder of same project name before backsmali or smali (no more overlapping :fingers-crossed.
- Added Read log file functionality in the main menu.
- Ability to open classout folder after backsmali.
- Ability to open finish folder after smali.
- Ability to renamed finished modded file to its original name.
- Neat smali and compression processing (i.e, hidden processing ).
- Fixed set Current-file option to visualize only apk and jar files.
@ 6/June/2013 (v1.0):
- First release of Backsmali / smali manager
Click to expand...
Click to collapse
i don't know how to start editing this smali file
badagila said:
i don't know how to start editing this smali file
Click to expand...
Click to collapse
Editing smali means to modify your jar or apk file to do certain new function, check the second thread in my signature in OP... you will find a lot editing tutorials of smalis of some android apps :laugh:
majdinj said:
Editing smali means to modify your jar or apk file to do certain new function, check the second thread in my signature in OP... you will find a lot editing tutorials of smalis of some android apps :laugh:
Click to expand...
Click to collapse
ok dude thanks
Hi, your work is featured here: http://ajqi.com/baksmali-smali-manager-windows-tool/
Keep it up!
VERY NICE!
Good Work..
I dont know much about smali backsmali.. but one confusion..
Is this tool also applicable if the files (apks or jars) we want to modify are odexed?
OJ said:
Good Work..
I dont know much about smali backsmali.. but one confusion..
Is this tool also applicable if the files (apks or jars) we want to modify are odexed?
Click to expand...
Click to collapse
No, actually classes.dex are made from the odex files.
If files are odexed, then there will be no classes.dex in apks or jar files. That's why it won't be applicable then
Version 1.3 is online
Change log:
- Added adb push finished file to device system partition (for system files).
- Ability to choose whether to reboot device after pushing files to device.
- Added adb install finished apk (for non-system files).
- Adjustable Java heap memory size.
- Adjustable finished file compression level.
- Updated Smali and Backsmali codes (date 15/6/2013).
@ 23/June/2013 (v1.4):
- Added Pull apk or jar From Android Device to the main menu.
- Added zipaligning process during Smali (better RAM management).
- Fixed apk installing process (added signing process step for installing apk process).
- Added direct link to this xda page in update option.
- More script polishing...
@ 29/June/2013 (v1.5-FINAL):
- Fixed adb remount bug for some ROMs in push option.
- Baksmali argument is updated; now you can choose whether to baksmali with x argument (retain .line, .parameter, .prologue, and .local) or b argument (remove .line, .parameter, .prologue, and .local).
Hi,
i've XP&Backsmali / Smali Manager v1.5 and i want baksmali framework.jar but i got error message(attachment)
I think wrong is slash (should be a backslash)
the same error is after i select 1(baksmali*)and then x and Y or
--------------------------------------------------------------and then b and Y
*baksmali or backsmali?

A sentence about usefulness of Resources

Hi
In "Hello Android" book that i am reading , there is a sentence about usefulness of Resources that i can't understand .
Please give me some help about it .
The paragraph is :
"The resource compiler compresses and packs your resources and then
generates a class named R that contains identifiers you use to reference
those resources in your program. This is a little different from standard
Java resources, which are referenced by key strings. Doing it this way
allows Android to make sure all your references are valid and saves
space by not having to store all those resource keys. Eclipse uses a
similar method to store and reference the resources in Eclipse plug-ins."
The underlined sentence has two part .
I understand part one in this way :
When there is some error in for example XML lay out files in Android project in Eclipse IDE ,
The IDE does not work correctly and some red signs are appeared next to files that have
error in left side project browser of Eclipse.
Is the thing that i understood is correct and complete ???
And about part two .
I cant understand it . What it says ??
Thanks for your help
peter.sorotokin said:
Hi
In "Hello Android" book that i am reading , there is a sentence about usefulness of Resources that i can't understand .
Please give me some help about it .
The paragraph is :
"The resource compiler compresses and packs your resources and then
generates a class named R that contains identifiers you use to reference
those resources in your program. This is a little different from standard
Java resources, which are referenced by key strings. Doing it this way
allows Android to make sure all your references are valid and saves
space by not having to store all those resource keys. Eclipse uses a
similar method to store and reference the resources in Eclipse plug-ins."
The underlined sentence has two part .
I understand part one in this way :
When there is some error in for example XML lay out files in Android project in Eclipse IDE ,
The IDE does not work correctly and some red signs are appeared next to files that have
error in left side project browser of Eclipse.
Is the thing that i understood is correct and complete ???
And about part two .
I cant understand it . What it says ??
Thanks for your help
Click to expand...
Click to collapse
Whenever you add a resource(image, raw file, drawable, etc) in your app package, a separate class named as R.java forms in your gen folder. This cannot be edited by you and can only be modified by the IDE. All your resources will be given a unique id by which you can refer to them from your Java classes. It will revert to the generated version if you try to modify it manually.
I guess that the way you understood the first part is correct. But it also applies to Java code. In the Android Java code you use these identifiers to load resources. You don't use hard-coded Strings. That way the compiler can check whether a resource with that name exists by checking whether the reference to the field in R is valid. If you had to put in hard-coded Strings, there would be no (easy) way to check that.
About the second part: I guess that it means that Strings need more storage space.
If we talk about usefulness of resources, this is a much bigger point to me: You can define different resources for portrait and landscape mode, for different countries, for different screen sizes, for different OS versions, etc. and Android cares about using the right one. You don't need to decide which one to use yourself.
You can also refer to them from Java and xml very easily. You just need to change one line of code to change a String that is used multiple times in your app. You can't forget one.
Link for a much more detailed description: http://developer.android.com/guide/topics/resources/overview.html (including the sub-topics)
However, I guess that you won't need that many details in the beginning. Your book should explain the most important things.

Categories

Resources