-=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- (c) WidthPadding Industries 1987 0|748|0 -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=-
SoCoder -> Blogs Home -> Blogs


 
spinal
Created : 15 October 2007
Edited : 18 October 2007

I'm recoding my menu...



Thats right, that cool looking menu I made for the DS doesn't always work (load things) so I'm re doing it. Mostly I'm thinking there are memory issues, but I don't know anything about DS hardware, nor do I know what Chishm's dldi loader does or how it does it. I do know however, that the more I add to the menu, the less likely the loader is to work.

So, I'm using my blog here to both keep you guys up to date with it, and ask for help/advice and feedback. If anyone feels like adding anything, don't hesitate to jump in and make you're voice heard.

Here is the code so far.


 

Comments


Tuesday, 16 October 2007, 00:37
Jayenkai
I recently found the command "PA_ResetSpriteSys()", which will free the entire sprite system, including those in use, the graphics, the palette, and everything else.. All in one nice easy command.
So, if you are having memory issues, perhaps throw that in just after your fade.
In fact, hunt around PALib's command list. I'm sure there'll be more than just that.
Tuesday, 16 October 2007, 04:27
spinal
There is one for clearing the gfx system also. I'm going to handle the file info slightly differently, I will assign it to the offscreen sprite that is being changed, so It will only hold 5 or 6 sets of gfx/pal & title info.
Tuesday, 16 October 2007, 04:44
Jayenkai
Yeah, that's probably a good idea. Try to keep memory down.

Once worry would be that I'm not sure how much wear+tear you'll cause, constantly reading from the card like that.
Tuesday, 16 October 2007, 05:42
spinal
I thought only writing caused problems?
Tuesday, 16 October 2007, 05:45
Jayenkai
Well then that's good enough for me
Tuesday, 16 October 2007, 06:10
spinal
First Problem!!



I copied this mostly from the PALib FAT example and partly form my old code. As you can see when you run it, It's not creating the directory list properly. For some reason its only listing the first folder multiple times, rather than all of them.
Any Ideas? I can't see any problems with the code.
Tuesday, 16 October 2007, 08:45
Agent
I haven't tried running it, but it looks like you need to allocate some memory to store each filename



and also if you want to list files as well as directories


Tuesday, 16 October 2007, 19:07
spinal
Thanks, you were correct, the filename thingy was the problem.
Wednesday, 17 October 2007, 18:46
spinal
OK, this is confusing me, I'm getting "implicit declaration of function 'chdir'" I'm fairly sure I've included the correct files and am using the command correctly.

Oh, I've put the 'code so far' at the top of the blog entry, minus the arm9 loader code, would you guy(s) need that also? or don't you care? It's only used for runNdsFile(filename);
Thursday, 18 October 2007, 05:06
Agent
That warning message means you're using a function before it's been declared. When it's a library function, it's usually because the relevant header file hasn't been included.

In your case, that would be <unistd.h>
Thursday, 18 October 2007, 05:58
spinal
Thanks for the info smith, I have updated the code accordingly. I have also added the nice fadeout, thats the main bit I want to work in the finished menu. I will start work on the icons next. If anyone has any advice about the code so far, I will gladly accept it. I am trying to keep the memory usage down as it might be (ok probably is) effecting the loader. Also I have been recomended to try holding a large array from the start of the program and freeing it just before loading the .nds so that the loader has a large chunk of unfragmented ram to use. I don't know if this will work or not.
Friday, 19 October 2007, 19:07
spinal
OK, the icons don't work. I have lifted the dock menu straight from the previous versions of the menu, modding them to work the new way (only load a graphic from the file if the icon is off screen, only holding a max of 5 icons in memory). However, it doesn't work properly. The dock isn't scrolling properly and sometimes I get stray icons. I have zipped the code so far because I couldn't be bothered to cut'n'paste loads of times. The archive is of the full palib project minus the custom arm7 stuff (only needed to reset the ds and run the loaded file).



I bet Jay can fix this, he fixed it the first five times.

|edit| Doesn't matter, I'm an idiot. Turns out I was counting 1 extra (nonexistent) file number, so I was getting randomness. (Jay ignore that PM).
Saturday, 20 October 2007, 16:22
Jayenkai
Ok, will do!

I'll assume it was one of those "0" issues. I've done that plenty over the past few days! In fact, the reels in my slot machine have 51 slots, not 50, due to me having forgotten/added/removed/forgotten/added again the 0'th item!
Saturday, 20 October 2007, 16:56
spinal
its that i increase the array after adding a value ready for the next one. So the array is always 1 bigger than it needs to be.
Saturday, 20 October 2007, 17:43
spinal
My current problem is getting the file information to display on the bottom screen on a bitmap layer.

Saturday, 20 October 2007, 19:41
spinal
For anyone who is able to test, here is a .nds of the menu so far.
menu_ab.zip.
press up and down to go through the list (i will change this to left and right). I'm experimenting with holding buttons rather than tapping them, the result isn't very good at the moment.

Also instead of hard coding the text colours, they will be chosen from wel places pixels on the background images, making skinning simpler for both me and the end user (no need messing about with .ini files or anything).

So, give it a go, tell me if it works, offer suggestions on the controls etc.
Sunday, 21 October 2007, 14:30
spinal
After a few days of tired Internet digging, it seems that I will not be able to detect if a file is hidden or not, so hidden files/folders will appear in the list no matter what I do to it.
Monday, 22 October 2007, 04:40
spinal
_Progress_Report_

I have now added the clock and managed to get it to collect its colours from the top background image. that means when I add skin support I dont need to mess with .ini files or anything, all the colours will come from pixels on the background. I havent decided if I want to hide them or not, but i dont think people will mind 4 pixels in the bottom left of the screen.

next i need to add the date back onto the top screen and it should be ready for a re-release as version 1.3.

Oh, and it still loads moonshell, so the lower memory usage seems to be helping the loader.

|edit| it stopped loading for a little while, but i noticed I had 'const' my time/date variables so they werent getting deleted. works again now.
Tuesday, 23 October 2007, 06:04
spinal
Now I'm getting corruption in the top left of some of the icons, about 3/4 of the first tile is sometimes a folder instead of the correct icon. I am going to try copying the data slower using a for loop instead of dmacopying it. Perhaps its a leak somewhere... if it is, I can't be bothered to fix it.
Monday, 03 December 2007, 04:59
spinal
An mp3 lib has just popped up on gbadev (and probably other sites to) but it runs mostly on arm7, to get it to fit in palib would mean removing some of palibs arm7 code, apparently the mod play has to go to make this mp3 lib work. I'm seriously considering doing this as it would also help with the ebook thingy.
Monday, 17 December 2007, 05:41
spinal
Minor update, I now have gif's loading as the icons, this will provide a way to change the default folder/file icons, and potentially to allow custom icons for each file (although they are all still 16 colours).