Rockbox Technical Forums

Support and General Use => Theming and Appearance Customization => Topic started by: ceebmoj on October 20, 2005, 12:50:15 PM

Title: WPS image idear
Post by: ceebmoj on October 20, 2005, 12:50:15 PM
Hi all,

I was thinking about WPS files today and was wondering if a tag could be introduced that would allow you to set the path that the WPS images are loaded from. If no path is set then that would be loaded from .rockbox as standard.

However if it was set then all the BMPs would be loaded from this path. This would mean that it would take less space in the wps as rather than refer to the complete path for every image you wish to load you could just load the m by name from the set image path

This would allow WPS that use images to be easily removed with all the associated images. keeping the .rockbox folder tyder
Title: Re: WPS image idear
Post by: Assimalyst on October 20, 2005, 02:39:41 PM
Currently i have them stored in a subfolder called 'I' in the .rockbox folder to minimize file size.

I agree though this would help reduce it further.
Title: Re: WPS image idear
Post by: kenshin on October 21, 2005, 02:42:21 PM
One problem with this approach is that you would be forced to keep that tag at or near the top of the WPS. The image code loads the image into memory on the first pass through the WPS so you would never be able to load an image prior to setting your base directory name. But I can see where you're coming from. That would certainly help reduce the size of some of the monstrous WPS code I've seen.
Title: Re: WPS image idear
Post by: Bagder on October 21, 2005, 04:21:33 PM
I'd rather see the WPS code first attempt to load the images from the same dir the WPS file is located in.
Title: Re: WPS image idear
Post by: kenshin on October 21, 2005, 10:00:12 PM
I'd rather see the WPS code first attempt to load the images from the same dir the WPS file is located in.

That shouldn't be too difficult to code.
Title: Re: WPS image idear
Post by: psycho_maniac on October 23, 2005, 02:24:40 PM
you can do something kinda like what you are talking about when you go to load an image in a folder you can do
Code: [Select]
%x|1|/filename.bmp|x|y

im pretty sure im right if not close
Title: Re: WPS image idear
Post by: ceebmoj on October 23, 2005, 04:52:42 PM
Hi,

Loading the images from the path of the WPS file would also over come the problem as I see it I will have a go at psycho_manic implementation. However I thought the .wps file had to be in .rockbox dir to be loaded as a default however a bit of experimentation should show if I a right.

As kenshin says if a tag is used to set the path of the bmps the it would need to be up at the top of the wps file are there any other global settings that are used with in the wps that could be moved in to a header for the wps? Then things like the bmp path could be moved in to this header section of the wps.

Another possible improvement to the wps that could be implemented would be to alow the loading of images in a form of loop in to an array like structure. This would reduce the mount of space in the wps turned over to bmp loading. Just a thort.
Title: Re: WPS image idear
Post by: psycho_maniac on October 23, 2005, 10:14:18 PM
However I thought the .wps file had to be in .rockbox dir to be loaded as a default however a bit of experimentation should show if I a right.

im pretty sure you are right. but what if you went into the config file and changed where the wps file is located? then loaded those settings? would that then work? yes the wps would load (this is all guessing) but then i think the next time you start it up it will load the default wps because it cannot find the wps in the .rockbox folder i will try to experiment with this also

[edit] if you write in the config file where the wps is located it will load that where it is in the folder. i would like to load images in folders for the wps i use right now this wps uses like 40 something images and it kinda makes me .rockbox folder messy i tried to do the commands like i showed in my previous post but that boosted the size of my wps file so then all the images did not load. [edit]
Title: Re: WPS image idear
Post by: ceebmoj on October 24, 2005, 03:29:27 AM
Hi,

Thanks for the info psycho I will give that a try this evening.

I still think that some form of loop like syntax would be good for loading up the images in to an array type structure and would also be good for keeping the wps size down.
Title: Re: WPS image idear
Post by: kenshin on October 24, 2005, 12:25:57 PM
I still think that some form of loop like syntax would be good for loading up the images in to an array type structure and would also be good for keeping the wps size down.

I don't quite follow you here. Are you talking about loading all the image files based on some base filename (i.e. "img##.bmp") or based on what files exist in the filesystem? Neither is going to really benefit much. If you are reading based on filename, all your files have to locked into a certain naming scheme which makes it hard to remember which files do what. If you're reading the filesystem for .bmp files you could easily end up loading images you never use if you don't keep the filesystem clean (and I know some of you don't!). Furthermore, not all images are cached in memory. Only the %xl/%xd files are cached. The %x| files are displayed immediately. As to caching images, rockbox already does this but the WPS lets you tell Rockbox which files to load.

All image file paths must be relative to the .rockbox dir. So loading %x|a|/filename.bmp|x|y| will yeild a final path of /.rockbox//filename.bmp unless someone has changed this code in the path month or two.

The best solution, as Daniel proposed, would be to make the files load from the same directory as the WPS file. That way we need no major WPS changes nor do we get locked into anything in particular. Everyone can keep their files in subdirs of .rockbox (I've wanted this for awhile, myself). If no one submits a patch for this in the next couple weeks I'll do it. I can't this week or next as I'll be on vacation and business travel.
Title: Re: WPS image idear
Post by: amiconn on October 24, 2005, 02:13:03 PM
The best solution, as Daniel proposed, would be to make the files load from the same directory as the WPS file. That way we need no major WPS changes nor do we get locked into anything in particular. Everyone can keep their files in subdirs of .rockbox (I've wanted this for awhile, myself). If no one submits a patch for this in the next couple weeks I'll do it. I can't this week or next as I'll be on vacation and business travel.

I don't think this would be a good solution. The settings system only remembers the .wps if it's located directly in /.rockbox, not if it's in a sub-directory or elsewhere. This is for a reason - to save space in the settings sector. So if the .wps code would load the associated .bmp files from the .wps's dir, they would still clutter /.rockbox.

I can think of two possible solutions:


There are 2 possible extensions for idea #2:


Just my € 0.02
Title: Re: WPS image idear
Post by: ceebmoj on October 24, 2005, 04:31:49 PM
%x|a|a.bmp|0|0|
%xl|m|l.bmp|41|1|
%xl|n|m.bmp|41|1|
%xl|o|n.bmp|41|1|
%xl|q|o.bmp|6|12|
%xl|r|p.bmp|6|12|
%xl|s|q.bmp|6|12|
%xl|t|r.bmp|6|12|
%xl|u|s.bmp|26|1|
%xl|v|t.bmp|73|0|
%xl|x|u.bmp|81|0|
%xl|B|b.bmp|0|0|
%xl|C|c.bmp|0|0|
%xl|D|d.bmp|0|0|
%xl|E|e.bmp|0|0|
%xl|F|f.bmp|0|0|
%xl|G|g.bmp|0|0|
%xl|H|h.bmp|0|0|
%xl|I|i.bmp|0|0|
%xl|K|j.bmp|0|0|
%xl|L|k.bmp|0|0|
%xl|O|v.bmp|112|0|
%xl|P|w.bmp|112|0|
%xl|Q|x.bmp|112|0|
%xl|R|y.bmp|112|0|
%xl|S|z.bmp|112|0|
%xl|T|aa.bmp|111|0|



%ac%?it<%it|%fn>
%ac%?ia<%ia|%d2>
%ar%pc/%pt
 %fbk %?fc<MP1|MP2|MP3|WAV|OGG|FLAC|MPC||WPK|>
%?pv<%xdB|%xdC|%xdD|%xdE|%xdF|%xdG|%xdH|%xdI|%xdK|%xdL>
%?bp<%xdT|%?bl<%xdO|%xdP|%xdQ|%xdR|%xdS>>
%?mm<|%xdm|%xdn|%xdo>
%?mp<|%xdq|%xdr|%xds|%xdt>
%?ps<%xdu|>
%?mh<%xdv|>
%?mr<%xdx|>

I got this wps from the mystic river sight the wps is by the_engineer looking at it the vast majority of the wps is concerned with loading the bmps and associating them with tags.

I am not sure what is the best way to implemented it but there must be a more efficient way than this. My idea was to use a c, like loop 

%xl|img[]|.bmp

where the image files are loaded in the order they occur in the file system or they could be numbered. There are a number problems n this now I come to try and explain it to you.

However the point remains that there is scope to improve the system as the majority of the wps should not be taken up preloading images
Title: Re: WPS image idear
Post by: kenshin on October 24, 2005, 04:58:54 PM
The best solution, as Daniel proposed, would be to make the files load from the same directory as the WPS file. That way we need no major WPS changes nor do we get locked into anything in particular. Everyone can keep their files in subdirs of .rockbox (I've wanted this for awhile, myself). If no one submits a patch for this in the next couple weeks I'll do it. I can't this week or next as I'll be on vacation and business travel.

I don't think this would be a good solution. The settings system only remembers the .wps if it's located directly in /.rockbox, not if it's in a sub-directory or elsewhere. This is for a reason - to save space in the settings sector. So if the .wps code would load the associated .bmp files from the .wps's dir, they would still clutter /.rockbox.

I had thought of this but I wasn't aware of the reasoning behind it. My only thought on how to make it work involved changing the settings to refer to wps1/file.wps instead of just file.wps. Maybe that's not a good approach if space is why it's required to be in .rockbox as it currently is.

I can think of two possible solutions:

  • Let the code load the .bmp files from a sub-dir of the .wps dir which is named the same as the .wps, but without extension, i.e "test1.wps" would load its images from "test1/"
  • My old idea - allow multiple images in one .bmp file. The .bmp would be loaded once, then the various snippets can be displayed by specifying the region in pixels.

Given the choice between these two I'd vote for #1. It cleans up the filesystem but doesn't harm the size and complexity of a WPS. And it would be a pretty simple change. Putting all the images into a single .bmp would certainly increase the complexity. Some people already have difficulty with "%xl|a|file.bmp|x|y|" and "%xd|a|".
Title: Re: WPS image idear
Post by: ray on October 24, 2005, 07:38:39 PM
The best solution, as Daniel proposed, would be to make the files load from the same directory as the WPS file. That way we need no major WPS changes nor do we get locked into anything in particular. Everyone can keep their files in subdirs of .rockbox (I've wanted this for awhile, myself). If no one submits a patch for this in the next couple weeks I'll do it. I can't this week or next as I'll be on vacation and business travel.
this is similar in vain to the way winamp used to select its skins before they introduced archive support (although winamp had a directory specifically for skins)... the solution proposed by Daniel seems to be the best one right now.

although i would like to see a fixed directory similar to winamp's titled "WPS" or something along those lines, then you can either add all WPS' into the fixed folder or do something like this:

x:\.rockbox\WPS\skin1\
x:\.rockbox\WPS\skin2\

that way WPS' which use the same filename for BMPs will not interfere with another WPS design.