Tuesday, February 24, 2009


I've run off some screen shots to entice people to try it out.

Also, I've noticed some people have started to upload it to things like gbatemp.net and the like. I encourage this; the more attention the better :). 

However; I'd ask that you always include a link to this blog when you do. Its good to be able to see how many people are interested in this project, and its even better if they have an easy way to contact me.

Normal layout across two screens:

Rotated layout across two screens (left to right):

Monday, February 23, 2009

Another release!

This release is coming much later than I wanted; but it has some very nice features. 

Here is the rom itself.
Here is the source.

First, on the PDF compatibility side, I've managed to solve the issue of non-embedded fonts not displaying. The program now uses a set of built-in fonts; so it might not always display exactly how the author wanted it to if the font is something obscure. Or dingbats, which I stripped out because it was simply too big to include.

Please please be sure to message me if PDF's don't work now, I have no test pdf's that break that don't have large images at this point.

On the features side, I've added a 'preview' button that displays a 'mini' view of the document. The button is the only filled in icon on the small status bar at the bottom; it looks like a bulls-eye. I'll change the icon later to something that makes sense.

If you just tap the mini-image, it will pan to put the point you clicked in the upper-left corner. 

If you draw a line with the stylus, it will adjust the zoom on the document to fill the screens with the size of the line you drew. Hopefully this is more intuitive in practice than it is in description. For instance, if you draw a line from the left to right of the document, it will zoom to fit the width of the document to the screen. If you draw a line from the top to the bottom of the document, it will zoom out to fit the height of the document to the screen. 

I'd really like comments on the GUI functionality. Does it do what you expect? Especially if it doesn't, tell me why and what you expect it to do. Ideally I'd have it so the user can not read any instructions and be up and running with this. 

I've also provided the ability to change files. This hasn't been extensively tested, and there may be memory leaks in it, so beware of that. If you hit 'start', it should pop up with the file browser.

Another new tool is the console, which you can layer over the screen with the 'Select' button. This should make the 'debug' builds not necessary so I will not release anymore of those. 

Lastly, rendering should be signifigantly quicker now. Still could be better, but for now it seems usable. 

Wednesday, February 11, 2009

New Release

The beta release is done! In this release I've worked only on basic navigability and rendering; I've got a lot to do in terms of PDF support and the like but I haven't had a ton of time to work on the project.

Here is what we got:
  • (Limited) Zooming in/out
  • Previous Page / Next Page
  • Support for vertical layout  or horizontal layout
  • Improved rendering
So far the zoom only aligns the PDF width with the width of the screen. Arbitrary zooming isn't difficult, but I'd rather solidify the GUI before I add features that should be part of the GUI. 

Funny things occasionally happen when flipping horizontal or vertical. You might have to scroll a bit to find the page. If you don't see it immediatly, zoom out to look :). 

The controls:
- Right shoulder: Next page
- Left shoulder: Prev page
- A: Zoom in
- B: Zoom out
- X: Rotate the page
- Select: Toggle rendering modes. The default one is bug free, but the secondary is quicker.   As soon as I figure out a few artifacting bugs, the secondary will be the only mode available. 
- You can still move around with the stylus. 

If you find a PDF that does NOT render, please leave a link in the comments to it. If the thing is massive or has a large image, that is probably the culprit, but leave it anyway. I hope to go through and vastly improve the percentage of PDF's this thing reads in the next release. 

Actually, if you find any bugs (and I'm sure there are plenty) or, better yet, have any ideas you think would work well, by all means comment!

Friday, February 6, 2009

Todo List

A feature list for the next pseudo release:
  • Next/Prev page (mapped to the shoulder keys) (done)
  • Open File command (mapped to 'Start') (done)
  • Determine rendering slowdowns and fix them. Might be able to do it with doing two small render's instead of one big one and use previous frame. 
  • Some kind of toolbar at the bottom; preferably to show page / page total and have a accessable file thing. 
  • Use color pallete so we can retain true color. I thought the color pallete mapped to 24 bit color. Oops. 
The first two items are actually done now as of an hour ago; I hope to be able to implement the next three by next week. 

Thursday, February 5, 2009

Source Code

Source code is now available:
  • Here is the source code for the NDS stuff proper - so far named ands-pdf.
  • Here is the modified source code for the fitz/mupdf package. This source is for embedded devices; go to the mupdf site for general use. 
  • Here are third party precompiled libraries and include files you'll need to link everything. Properly stated, these are the following libraries compiled for the arm-eabi target: libjpeg, libiberty, libxml2, libz, libfontconfig, libfreetype and libpdf (the mupdf library). Everything except the pdf library has been compiled without modification to source, and is provided more or less for convience. 
I'm looking into the different project hosting sites, but I've got other priorities right now so unless it becomes pressing, don't expect much movement on this front. If other people come on board, it will become a priority though, so anyone who wants to help please pitch in :)

PDF Viewer Prototype!

This morning I posted a prototype for the NDS PDF viewer to

The shout out to gbadev is well earned; they've got a great community over there and if you are doing homebrew for the DS or GBA and not going there, you are making things unnecessarily difficult for yourself.

Here is the prototype version for release. It has a simple file chooser and some artifacting issues. Its more a proof of concept than anything.

And here is the debug version of that same version. All this means is that rendering to the sub display is disabled, so you get a console. If you encounter any problems with a pdf, run them through that to see the exact error.

These user interfaces by the way, only work with the stylus. You double tap a pdf file to open it; same with a directory.

I'll be releasing the source code later tonight once I get all that stuff in order. I should note that I didn't write the PDF render engine for it; I cross compiled this and tweaked with it to avoid memory issues.

I would like, if at all possible, for as many people to test it out as possible and tell me how they like it. I'm also trying to dream up a way to make this easy to use for actual reading, and so any ideas in that regard would be greatly appreciated!

Tuesday, February 3, 2009

Cross-compiling ARM code

Here are a couple of things I learned cross compiling:

- Especially if you are going to be cross compiling something that uses alot of libraries; keep a clean and professional workspace. This is going to require alot of custom configures (eg, setting the --prefix variable so that you don't have ARM libraries among your x86 stuff) and also alot of make file hacking to point to the special library paths you'll have set up. Be patient with it.

- Do whatever you can on a linux machine. The tools available there are alot better in my book, and it won't matter anyway if your target isn't the processor you are compiling on.

- There don't seem to be alot of differences between what the ARM compiler does and the x86 stuff does. I was expecting many more problems than presented themselves. That being said; a major bug I ran into was that when enumeration values are set, it looks like it sets the bare minimum to distinguish the value from other enumeration types. This happened to screw up a hash function, or otherwise I would never have noticed.

Sunday, February 1, 2009

About me and the PDF for NDS project

I recently got a DS because I really wanted to do embedded programming (and my girlfriend wanted to play animal crossing, but whatev). I've also been looking at a number of different e-book solutions like the Kindle or the Sony Reader for a while and just wanted something like that to be able to take with me.

And I just assumed that the Nintendo DS had some software for PDF support. I was very wrong.

But that is okay! It makes a wonderful project to start off my development with!

So for the past week or so I've been toying around with it. I've run into alot of walls you'd expect to, but I can't believe how easy it is to cross compile things. I kind of want to do it on more things just because of how cool it is.

I created this blog to detail random things about this coding experiment and solicit feedback. If anyone wants to help develop, please leave a comment or something, I can use all the help!