[APP][3rd Aug] Convert your CPR Titanium or PLG file to different (all) resolutions!

OndraSter

Retired Recognized Developer
Mar 27, 2009
2,083
272
0
28
Prague
Convert your CPR file to different resolution by one click

Hello guys,
TPC asked me for one tool - he has made his own Titanium plugin and wanted to convert it to Fuze, that has got different resolution than Kaiser that he built it on.

I've written that app and here ya go:


It converts all Height, Width, Left, Top, ItemHeight and ItemWidth attribs in .cpr file. It isn't perfect because some values you'll have to adjust manually, but rewriting all thousands lines of code takes much longer.

It was built for Titanium CPR file, but it will probably work on any different CPR file (since it is all the same XML).

You need only .NET Framework!


If you like my work and want me to continue developing tools, Buy me a beer!

Bugfixed:
v1.1: Now it can handle . numbers
 

Attachments

Last edited:

OndraSter

Retired Recognized Developer
Mar 27, 2009
2,083
272
0
28
Prague
PLG Resizer - convert your .plg to all resolutions



If you like my work and want me to continue developing tools, Buy me a beer!


V1: without generate landscape function
V2: added generate landscape function + some anti-crash fixes
V2.1: fixed bug that when in file were both landscape + portrait modes tool crashed (occured only in v2, v1 was working fine)
 

Attachments

Last edited:

MichelDiamond

Retired Recognized Developer
Jul 6, 2009
2,222
272
0
What a great idea! And I'm not thinking about CPR alone...

What do you think: Would it be possible to take a .plg-File in any resolution (and perhaps landsape and portrait) - and the converter would make the output-plg-File for all resolutions in one file?

A .plg is a part of the .cpr - so it could be possible - your parser should only recogonize then <layer>...</layers>-Tags to know where the Resolution-Parts are to find and where the new resolutions should be inserted (Multi-Select instead of Single-Select)
For fine adjustings - perhaps there are some further algorithm to find - I think, it would work without very good.

That would be totally great!

And thanx for sharing your cpr-converter

Micha
 
Last edited:

gullum

Senior Member
Mar 22, 2007
2,471
10
0
since the cpr are realy xml could be good also if prssible to resize aplication skins (full screen player, audio manager) anyway I'll try it
 

twopumpchump

Inactive Recognized Developer / Retired Moderator
Aug 10, 2008
4,055
362
0
Kentucky
m-s-j.net
congrats on the new tool, it works great :D


ps...i want everybody to know that i came up with this idea because im LAZY lol. great work by ondraster for making this happen :)
 
Last edited:

OndraSter

Retired Recognized Developer
Mar 27, 2009
2,083
272
0
28
Prague
What do you think: Would it be possible to take a .plg-File in any resolution (and perhaps landsape and portrait) - and the converter would make the output-plg-File for all resolutions in one file?
It shouldn't be problem, but I couldn't find any .plg in SYS, so I haven't got it test on. Send me one/link me to one and I'll try it.

since the cpr are realy xml could be good also if prssible to resize aplication skins (full screen player, audio manager) anyway I'll try it
I took a look at FullScreenPlayer's XML file and I think it won't be hard.

Great work man, works awesome. I just used it to port my NeoTitanium skin to all resolutions & so far so good.

EDIT: Make sure the paths don't have spaces. This will cause an error.
It works with spaces in path OK for me.


Thanks from everyone.
 

MichelDiamond

Retired Recognized Developer
Jul 6, 2009
2,222
272
0
It shouldn't be problem, but I couldn't find any .plg in SYS, so I haven't got it test on. Send me one/link me to one and I'll try it.
Thank you - I'll send you one with VGA portrait and landscape - if the Converter could make a difference betweend portrait resizing and landscape resizing - that would be real cool.

after <layers> the marks of the resolutions are to find

after </layers> the new resolutions should be inserted, that it works in each .plg of each Plugin

Thanx in advance for trying
Micha
 

Attachments

OndraSter

Retired Recognized Developer
Mar 27, 2009
2,083
272
0
28
Prague
Thank you - I'll send you one with VGA portrait and landscape - if the Converter could make a difference betweend portrait resizing and landscape resizing - that would be real cool.

after <layers> the marks of the resolutions are to find

after </layers> the new resolutions should be inserted, that it works in each .plg of each Plugin

Thanx in advance for trying
Micha
So When I got the beginning

Code:
<?xml version="1.0" encoding="utf-8"?>
<plugin>
	<name>JMLToday</name>
	<position>0</position>
	<layouts>
Then becomes <layout screenWidth="480" screenHeight="640"> where are screen width and height and then starts the layout for this resolution right? Eg if I'd want to have this file from 480x640 to 240x320, all numbers since <layout ..> would change to half in all Left, Top, Height and Width + screenWidth and screenHeight would change and this all will be added as new <layout ..>?
 

MichelDiamond

Retired Recognized Developer
Jul 6, 2009
2,222
272
0
So When I got the beginning

Code:
<?xml version="1.0" encoding="utf-8"?>
<plugin>
	<name>JMLToday</name>
	<position>0</position>
	<layouts>
Then becomes <layout screenWidth="480" screenHeight="640"> where are screen width and height and then starts the layout for this resolution right? Eg if I'd want to have this file from 480x640 to 240x320, all numbers since <layout ..> would change to half in all Left, Top, Height and Width + screenWidth and screenHeight would change and this all will be added as new <layout ..>?
Yes - exactly

The .plg's - each "Layouts"-Section will added by installation from AT Plugin Installer in the different CPR's with the resolutions - so every .CPR is defined by the .plg's
 

MichelDiamond

Retired Recognized Developer
Jul 6, 2009
2,222
272
0
I understand :) - but would be real cool - whenever ( I think very much Plugins would use itfor their .plg's - no developer has all devices with all resolutions.. and Simulators... :rolleyes: )

Meanwhile we can use the original CPR-Converter for the .plg's :)

Thank you
Micha
 

OndraSter

Retired Recognized Developer
Mar 27, 2009
2,083
272
0
28
Prague
@MichelDiamond

I found out that there is in .plg both portrait and lanscape - are there always or aren't? Can I depend on it?
 

MichelDiamond

Retired Recognized Developer
Jul 6, 2009
2,222
272
0
No - you cannot depend on it - if always x < y there's only portrait - and so the option to convert it to landscape - should be disabled then. Then the .plg-File has only all portrait-Skins in all resolutions.
Perhaps an extra option to turn the .plg in90 degrees then (it would be countable without changing the algorithm), when you don't discover any landscape in the .plg - but with the wisdom, that it works, but doesn't look so fine.
More important is to make a difference between portrait and landscape in one file.

What's also common:That 2 resolutions are already in the file (e.g. VGA and WVGA) - and the User could choose, which of the both Resolutions he want to have converted (That's easy for the algorithm).
The user should have the intelligance, that it's better, to convert the WVGA to WQVGA :)
And if your program always inserts the new Layout at the bottom of the .plg - after the last layout - you mustn't care by program for it.
 

OndraSter

Retired Recognized Developer
Mar 27, 2009
2,083
272
0
28
Prague
OK, since I didn't get your response in few minutes:D, I started working on it, grabbed my "multiplying" core from CPR resolution changer and here is screenshot:



It works!:eek:, but till I release it I'll do the "if missing landscape, do only portrait" failsafe.

I've spend on it few hours (no kidding!:D) and many pops to the desk:D.

PS: It works a bit different - I have specified resolutions it will generate, then it detects where start of port + landscape start and end, takes this part, runs it via multiplying core, adds <layout screenWidth...> and adds to file for each resolution both port + land.
 

MichelDiamond

Retired Recognized Developer
Jul 6, 2009
2,222
272
0
*umph* You know what you have done? :)

This program means now.. that each Titanium Plugin mustn't be anymore released only in one Resolution - it can be released in each resolution...
because the skins in the cprs can also be converted.
Everybody can make a Skin - and with your converter - he can provide it for each device

And for JMLToday it means the same... the first trials were successful - but in JMLToday all the skins have my resolution of course... so I will have a look for feedback from the Users with other resolutions.

You know that's a KillerApp for Titanium now... You're great (and also a typical Programmer like I know it from me :) Problems have to be solved - insomnia :) )

Thanx man! Will give Feedback
Micha
 

OndraSter

Retired Recognized Developer
Mar 27, 2009
2,083
272
0
28
Prague
OK.

When I was reading "*umph* You know what you have done?" my stomach went really high because I was scared what have I done lol.

OK, I'll tomorrow add the "convert from portrait to landscape" function.

But since it is half past one after midnight (AM) I'm not sure how it is counted - Left is swapped with Top and Height is swapped with Width or should I recount it? If I'm thinking right this should be more accurate because of odd numbers.

Or not?:D

I've never been good to painting and virtually imagining 2D (or 3D):D.

// OK, not, it would have to be pointed right into middle.
 
Last edited: