[HOW-TO]Hex edit resources.arsc from com.htc.resources - One (M7) General

I wrote this "How-to" because I haven't found such a thing on XDA or Google yet and it maybe helpful to others.
I have based this little guide on ViperOne which is Sense based. So things might be different on other ROM resource files.
As a lot of you out there know editing com.htc.resources.apk may cause issues when trying to decompile and compile. And when successfully compiled there probably are issues. Some don't care about it but others do.
This guide is to help anyone that successfully decompiled com.htc.resources.apk and edited the colors.xml in the res folder to use this custom colours in their theme or ROM. I changed only colors.xml and no other xml files so some things may be different if you edit other files that will compile in resources.arsc. If you have, then simply compare your resources.arsc with the stock one to see where the differences are. U can use KDiff3 or Beyond Compare to do this for example.
First. If you have any issues with decompiling and / or compiling com.htc.resources with apktool take a look at this thread http://forum.xda-developers.com/showthread.php?t=2229230 by @he_stheone64
or if you use Virtuous Ten Studio use the method of @Ajthescot here http://forum.xda-developers.com/showthread.php?p=43801810
Now, you have edited your colors.xml and compiled the apk. The apk or the resources.arsc flashes fine in your theme but you will end up with bad battery life and at medium sticking font size. What you have to do to fix this is hex edit the original resources.arsc from com.htc.resources.apk to match the changes you made in the colors.xml
This is how I do it:
Pull the resources.arsc from the original com.htc.resources.apk and place it on the desktop. Open the file in an hex editor (I use HxD Hex Editor)​
To look up the beginning of the colors.xml search for e5 b5 33 (in hex it’s reversed so you probably are not going to find 33 b5 e5). It should be line 0022F3E0 for Android 4.3 and line 0022E2A0 for Android 4.4 which is the beginning of the colors.xml. On 4.4.2 it is 0022F7D0.
{
"lightbox_close": "Close",
"lightbox_next": "Next",
"lightbox_previous": "Previous",
"lightbox_error": "The requested content cannot be loaded. Please try again later.",
"lightbox_start_slideshow": "Start slideshow",
"lightbox_stop_slideshow": "Stop slideshow",
"lightbox_full_screen": "Full screen",
"lightbox_thumbnails": "Thumbnails",
"lightbox_download": "Download",
"lightbox_share": "Share",
"lightbox_zoom": "Zoom",
"lightbox_new_window": "New window",
"lightbox_toggle_sidebar": "Toggle sidebar"
}
Now change the stock hex colours to the hex colours you have in your modified colors.xml. Work from the top to the bottom and look carefully at the ones you didn't change so you know where you are.​
When you are done save the file and put the resources.arsc you just edited in the com.htc.resources.apk for your theme or ROM or in your vrtheme folder. Flash the theme and enjoy your work without issues!​
Credits to @Basil3 who point me in the right direction!​

Just in case...

Thanks for excellent tips. :good: Really useful as I was looking for this.
What I did was:
a) pulled the original Resources.arsc and open it HxD,
b) then, in HxD I opened the same file from the com.htc.resources.apk which I had built earlier with VTS including altered colors.xml
c) noticed that the number of lines in original and in my build were different so the line numbers (0022F3E0) did not match
d) I used search to find first altered color code, once found
e) resized the tabs in HxD for comparison, "synced" the lines in the tabs/windows on the same hight
f) slided the tab showing the initial resources.arsc on the left, on top of the other one so that the color codes from both files would be as close each other as possible.
g) did the changes and saved
See the attached pics to see above, unsaved changes are show as red on the left tab, on the original resources.arsc file. Can happily confirm that this method really works.

This has been on my to do list for months, very happy to see someone beat me to it
Nicely explained mate :good:
Sent from my HTC One using Tapatalk

Nice one mate!! This will help a lot people around. Including me.
Ps : kanging @fisha21 theme still a priority.
Sent from my HTC One using Tapatalk

Thx for this guide :thumbup:
Sent from my BLUE HTC ONE bitten by a Viper

OP updated
The beginning of colors.xml changes in each Android version:
Android 4.3 - 0022F3E0
Android 4.4 - 0022E2A0
Android 4.4.2 - 0022F7D0
It could be different depending on the rom you're editing.

Related

[SOLVED] searching for an image in kitchen=no luck??? [dialer keypad image]

i have a bug on my rom because of an image.
the image is on the dial pad screen.
im searching for the image of the button to make the dial keypad/keyboard popup/down?
(ill be able to supply a screenshot later but not atm)
whats the image name and where can it be found in my evk?
cheers dudes, muchly appreciated
Rn
Did you check in your phone canvas package? If it's not visible in there it may be in one of the .dlls like phcan.dll or phcanrc.dll (I can't remember their exact names), but I'm pretty sure it's an image that you can see if you open up your phone canvas package. If it's in a .dll, you can use a program like Rezhack to open and edit .dlls.
Anything like this:
http://forum.xda-developers.com/showthread.php?p=10697671#post10697671
If this is the same issue I have then I believe its the .dlls phcanhtc.dll & phcanrc.dll that need modifying, however I don't know how to nor have I had any help in how....
The images are 'Dialer_Contact_down.png' & 'Dialer_Contact_up.png' and should be in the phonecanvas package.
Andy
help for help
cheers dudes, ill see what i can find from the info you mentioned.
{
"lightbox_close": "Close",
"lightbox_next": "Next",
"lightbox_previous": "Previous",
"lightbox_error": "The requested content cannot be loaded. Please try again later.",
"lightbox_start_slideshow": "Start slideshow",
"lightbox_stop_slideshow": "Stop slideshow",
"lightbox_full_screen": "Full screen",
"lightbox_thumbnails": "Thumbnails",
"lightbox_download": "Download",
"lightbox_share": "Share",
"lightbox_zoom": "Zoom",
"lightbox_new_window": "New window",
"lightbox_toggle_sidebar": "Toggle sidebar"
}
and yeah, its that little f*cka, ive wasted pure time lookin for that!
ADB100 said:
however I don't know how to nor have I had any help in how....
Click to expand...
Click to collapse
to edit dll's you need 'ResHacker' (resource hacker)
quick tutorial:
drag and drop the dll OR exe you want to edit onto the ResHacker.exe and it will open. everything inside the dll OR exe will be shown and you can edit it, eg icons
select the icon and right click
now replace resourse with your custom icon
*the number on the folder is the icon number - not the number on the icon
to make your own icons i suggest you use 'IcoFX'
install IcoFx and open it.
got to TOOLS/BATCH PROSESS
add images to that you want as icons
*dont use transparent images, it will turn out crap
select 48x48 and XP Colours
save
now go to TOOLS/RESOURCE EDITOR
click the 'add icon' and add the 'new' icons
now save but put .dll at the end of what ever you name it as
this creates a dll with your custom icons
cba explaining the rest but if ya realy wana know - pm
Rn
update
found it
to save you editing them:
Rn
(no dll's need modifying for this btw just thought id mention it, ive searched the dlls mentioned and none contain icons)
(infact i searched all the dlls in the canvas folder )
BIG thanks!
OK, so what does your dialer look like now? Is there no dialpad icon at all now?
I understand how reshacker works, however I don't think its Icons that need editing in the .dll's - its other stuff?
I have lived with the annoying cut-off for a while now but would be keen to see it fixed....
raving_nanza said:
found it
to save you editing them:
Rn
(no dll's need modifying for this btw just thought id mention it, ive searched the dlls mentioned and none contain icons)
(infact i searched all the dlls in the canvas folder )
BIG thanks!
Click to expand...
Click to collapse
...
yeah, there is basicly no image now, my images are fully transparent..
which is what i wanted, ill upload a screenshot later, AFK = using blackstone at the moment and cant upload a screenshot but i will when im back home, ill show you what its like on my rom.
Rn
*btw im using wm6.1 if it makes a differance?
...
yo dude
Rn
I didn't think I was going to like it, but I do. I might have to jack your idea! Thanks for posting the screenie!
...
hi dudes,
i finaly released my rom
if you want to check out what i done with those canvas images
there are screenshots for most of the open windows
link in signature
let me know what ya think
Rn
fyi, i have added you guys to my "thanks list" on the rom thread for helping me find the image

[SCRIPT] APK Manager like UI interface to edit m10 files

Based on apk manager script I have created a script which gives ease to modify m10 files. Copy script.bat into folder where m10tools binaries exist (at location where m10decoder.exe, m10encoder.exe, etc...).
{
"lightbox_close": "Close",
"lightbox_next": "Next",
"lightbox_previous": "Previous",
"lightbox_error": "The requested content cannot be loaded. Please try again later.",
"lightbox_start_slideshow": "Start slideshow",
"lightbox_stop_slideshow": "Stop slideshow",
"lightbox_full_screen": "Full screen",
"lightbox_thumbnails": "Thumbnails",
"lightbox_download": "Download",
"lightbox_share": "Share",
"lightbox_zoom": "Zoom",
"lightbox_new_window": "New window",
"lightbox_toggle_sidebar": "Toggle sidebar"
}
Download Script File Here
Installation:
1. Create folders Decoded, Encoded and m10_files at location where m10tool binaries are placed.
2. Copy script.bat at location where m10tool binaries are placed.
How to use
1. Place you m10 files in m10_files folder.
2. Select desired operation as shown in screen shot.
Change Logs
Code:
[B]Version 1.0[/B]
Initial release
Let me know if anyone needs any help on this
Hmmm... We need something like this impleted in apkmanager... Looks great amresh!
worked like a charm, thanks a ton amresh
Man thats great thanx!
Senergized in 3D
Can't believe I haven't thanked you yet. I've been using this for about a month now, and one thing everyone should know, is this tool has an extra advantage. Contrary to the m10 Editor UI Application, this script uses straight command line which makes all of your sense 3.0 m10 images decode with the same file name every time, where as the UI will give you random file names every time. And this is way simpler
Amresh, This was an ingenious idea and I can't thank you enough!
mpitcher225 said:
Can't believe I haven't thanked you yet. I've been using this for about a month now, and one thing everyone should know, is this tool has an extra advantage. Contrary to the m10 Editor UI Application, this script uses straight command line which makes all of your sense 3.0 m10 images decode with the same file name every time, where as the UI will give you random file names every time. And this is way simpler
Amresh, This was an ingenious idea and I can't thank you enough!
Click to expand...
Click to collapse
Has this program been optimized to work with sense 3..5?
Sent from my A500 using xda premium
i tried to modify the htc love apk. m10 files, but the thing is when i separate the dat and png files the folders are empty...plz help if u can..
sweet, thanks, will give it a shot

[Porting Tool] MIUI APKTool

{
"lightbox_close": "Close",
"lightbox_next": "Next",
"lightbox_previous": "Previous",
"lightbox_error": "The requested content cannot be loaded. Please try again later.",
"lightbox_start_slideshow": "Start slideshow",
"lightbox_stop_slideshow": "Stop slideshow",
"lightbox_full_screen": "Full screen",
"lightbox_thumbnails": "Thumbnails",
"lightbox_download": "Download",
"lightbox_share": "Share",
"lightbox_zoom": "Zoom",
"lightbox_new_window": "New window",
"lightbox_toggle_sidebar": "Toggle sidebar"
}
Overview
This is a more than full-featured APKTool GUI, It has a few options for porting which I'll explain in great detail but for now I'd like to say despite the minimalistic look which will stay lite forever, it does do a lot for efficiency and can be used for things other than MIUI, but is made especially for MIUI.
Notepad++
This deals with edits that need to be made with Notepad++ in general; It will open the selected file from WIP as well as the one from the Rom being ported for easy comparison.
Kernel Options
Pretty Simple, Executing the 'Unpack Boot.Img' Command will automatically split your Ramdisk; which can be found in root\boot, Repack puts everything back together and inserts Boot.img back into your WIP Rom folder.
Backup Options
Use this to make a backup of the current WIP Rom files; any backup files stay present until manually overwritten; saving time since the boot.img and updater-script can be used for any MIUI build generally.
Target
When a Workspace is generated, all APK and JARs will be placed into respective folders for easy access, tick 'Base' to work with your base rom APK and JARs and tick Port to work with your Port rom components
Download: MIUI APKTool 0.10
Handbook and source / Original post
Misc. Notes
This can be compiled If you have AHK installed easily by just pasting the code into a new AHK file.
Are you a fans of MIUI?
ImaxAndroid said:
Are you a fans of MIUI?
Click to expand...
Click to collapse
Huge fan, I'm also a member of the porting team at en.miui.com ;x
Bump, I have recoded this and it is less complex in general, using only variables to keep track of its own settings.
Aapt should be kept in the same directory and folder settings are no longer persistent for the sake of simplicity; however rotating folders are still possible and it works the same as before
I added porting options lol
Bump, I've added more to this and removed the need to have to set folders before each use; Ramdisk stuff has been streamlined to be more 'in the background' and the option to backup Build.prop, Updater-Script and boot.img have been added as well.
The Backup options apply to things inside 'WIP' and when using the Load option, it inserts backup content into WIP. This takes a lot of pain away from multiple ports or multiple attempts when trying to find the right base as far as Updater-Script and Boot.img go.
Lastly the Workspace Generator has been updated to mirror the new dependancies that have appear in MIUI 3.9, this should now support all MIUI JB versions 3.9 and under
Lastly the GUI is less clunky and less obnoxious to use, and faster in general
any tutorial on how to use this?
Will try

[TUTORIAL] How to integrate a custom recovery into your custom ROM

XDA PORTAL
Click to expand...
Click to collapse
Hello everyone
In this tutorial i will show you how to integrate the recovery into a custom rom.
This way users will not have to install it separately
{
"lightbox_close": "Close",
"lightbox_next": "Next",
"lightbox_previous": "Previous",
"lightbox_error": "The requested content cannot be loaded. Please try again later.",
"lightbox_start_slideshow": "Start slideshow",
"lightbox_stop_slideshow": "Stop slideshow",
"lightbox_full_screen": "Full screen",
"lightbox_thumbnails": "Thumbnails",
"lightbox_download": "Download",
"lightbox_share": "Share",
"lightbox_zoom": "Zoom",
"lightbox_new_window": "New window",
"lightbox_toggle_sidebar": "Toggle sidebar"
}
​
REQUIREMENTS:
You must know how to build a custom rom using Android Kitchen.
You must know how to edit an updater-script using Notepad++.
The WORKING folder of your rom (the one you get from the android kitchen when you extract system.img or zip folder or system.tar).
The recovery's flashable zip.
For this tutorial i am gonna use the PhilZ Touch CWM as example but this method is universal for all recoveries.
So, let's start:
1. Create in the kitchen's WORKING folder, a new folder and name it system2 (in your case working folder's name is gonna be different).
2. Extact the recovery's system folder contents into the system2 folder (the one previously created).
3. From the recovery's META-INF folder open, using Notepad++, the updater-script.
In my case looks like this:
4. Before proceeding, let me explain what is going on with the following lines:
package_extract_file("system/bin/recovery.tar", "/system/bin/recovery.tar");
package_extract_file("system/bin/taimport", "/system/bin/taimport");
package_extract_file("system/bin/taimportx", "/system/bin/taimportx");
package_extract_dir("system/btmgr", "/system/btmgr");
----- package_extract_dir(” “, “/”) – This command extracts all the files from the folder mentioned inside first quotation to the directory inside second quotation. -----
So since you created a new folder named system2, the above lines should be edited and look like this:
package_extract_file("system2/bin/recovery.tar", "/system/bin/recovery.tar");
package_extract_file("system2/bin/taimport", "/system/bin/taimport");
package_extract_file("system2/bin/taimportx", "/system/bin/taimportx");
package_extract_dir("system2/btmgr", "/system/btmgr");
5. Now open, using Notepad++, the updater-script for your rom.
6. Now copy the edited lines from the recovery's updater-script into the updater-script of your rom (add them at the bottom). Remove the show_progress lines. Now save the file.
7. Now you can build your rom and enjoy the integrated recovery!
8. Happy rom building
reserved
Too good
So you are back with your pc i guess
Awesome! Definitely looks much, much better than the "ms-dos" clone I see in my device
Bro @DaRk-L0rD
Very nice and very clear explained, specially for new ones :good:
Very clever tutorial my friend!! :good:
keep rocking...
Nice guide..
U are featured on portal. Congrats
Sent from my C5303 using XDA Premium 4 mobile app
Congratz bro.your post is on portal.nice job
Great, its work for me! :highfive:

APK Tool For Windows

{
"lightbox_close": "Close",
"lightbox_next": "Next",
"lightbox_previous": "Previous",
"lightbox_error": "The requested content cannot be loaded. Please try again later.",
"lightbox_start_slideshow": "Start slideshow",
"lightbox_stop_slideshow": "Stop slideshow",
"lightbox_full_screen": "Full screen",
"lightbox_thumbnails": "Thumbnails",
"lightbox_download": "Download",
"lightbox_share": "Share",
"lightbox_zoom": "Zoom",
"lightbox_new_window": "New window",
"lightbox_toggle_sidebar": "Toggle sidebar"
}
APKTOOL FOR WINDOWS
First and foremost thanks to @iBotPeaches for his dedication to Apktool!
Because I can double-click more accurately than I can type, I made this up to avoid having to use command line and speed up modding the couple of apks that I try to keep up on. Maybe it'll help a few others speed up their process too.
Now, this is a Windows based GUI for Apktool. No command line needed. That said, you should be very familiar with already using Apktool via command line so you know the process that it follows and the corrective measures needed should errors pop up. You need to have the exact same setup as Apktool (Java in your environment path and current Java version AND relevant frameworks installed via apktool!! ). All that this does is provide a simple Windows style menu for the process. You can very easily update apktool.jar as @iBotPeaches updates it. Also, if you would like to add any switch to the decompile or compile command other than the typical (which is what I used) you can just modify the corresponding .bat file located in SupportFiles that APKTool For WIN calls on.
See the attached screenshots in the following post for the easy to follow layout and it's capabilities. It will install frameworks/etc, decompile, compile (with or without original manifest and meta-inf), sign (with testkey or your personal one), and display an apktool log.
As this directly uses apktool.jar, it will have the same quirks/issues such as this current one:
10/18/2016 - for apktool v2.2.1 regarding v2 signed apps - LINK​
V4 - As I was posting this, I noticed there was an update to apktool.jar (v2.2.1) which I updated the file to reflect. I modded several apps with the earlier version but only attempted two apps with the updated one (didn't see any issue with either app but I'm still on MM). I haven't looked more in depth at this V2 signed apps issue yet to see if I can modify the signing.bat to account for it (it's 230am). I will update it if there is.
V5 - (1) Updated apktool.jar to 2.2.2 if you haven't already yourself and (2) added java version info in your log file on Decompile routine to help identify a beginners issue on determining whether or not you have java installed in your path
Copy apks to the "APKs_To Decompile" folder.
Copy your framework-res, twframework-res, systemUI as needed to the folder "Frameworks".
Install frameworks.
Running the APKTool For WIN.exe select Install Frameworks
Decompile.
Select Decompile .apk
Choose your apk.
Decompiled app will be in the Decompiled folder.
Compile.
Select Compile
Choose your app to compile.
(One backup will be automatically created if there is an existing one to be safe in the decompiled app's folder)
Choose to copy the original manifest and meta-inf if desired
Compiled apk will be in the Compiled folder
Sign.
Select Sign APK
Choose the apk to sign.
Choose to sign with the testkey or with your personal key (help file is included in the zip for initial setup for using your own key)
Signed apk will be in the Signed folder
APKTool Log
If an Error message is displayed after decompiling or compiling you can check the log.
It's also beneficial to clear the log sometimes.
reserved for future use, faqs, issues
hmmm......after being away for a while i'm checking back to see if anyone had issues with trying to use this....and.......
not a single issue/question/comment with nearly 100 downloads. you guys are GOOD!!! (unless y'all think it's pointless and are being too kind to comment )
in the next few days, i'll use it a bit more in depth with the updated source and see if anything needs tweaking
Great tool !! I like it , this is solve my problems.
thank you so much , please keep it up.
Small update - V5
1. Updated to apktool 2.2.2 in case you haven't already done so yourself.
2. Added your java version info to the log generated when you run a Decompile routine to help beginners identify whether or not java is in the required path

Categories

Resources