Port Request: Text Reader...


Lobo

Active Member
Joined
May 9, 2006
Messages
527
I was extremely fond of Xreader on my old GP2X for reading simple plain text books in .txt format. On the Wiz the inbuilt text reader wasn't too bad so I ended up using that.

However, my Pandora has nothing for reading simple text files (and bookmarking so I can come back and continue from where I left off.) I used to read a lot on the GP2X, and (until I got my Panda) on the Wiz.


Surely some kind-hearted, altruistic coder could take it upon himself to do a dirty port of some GP2x/Wiz text reader? Or maybe there's already something in the Angstrom repo that could be PNDed? Maybe there's even some app on my Pandora already that has the capability to read text files and let me bookmark them?

Thanks for at least taking the time to read this! :)
 
I second this! A text reader that remembers the position and can handle bookmarks, same a pdf reader that remembers the position!

And a video player that remembers the position would also be a nice addition! :)
 
It will happen, just a matter of time - it was one of the things i wanted most on my pandora

Seeing all the Ipad/Android tablet devices with some pretty good readers, will give someone an idea to either create or port something from android .. there may even be a good one in the Angstrom repository
 
If I just knew what the hell I was doing, I'd try and do some of that crazy angstrom-repo-pnd-sheenanigans. :D
 
Lobo said:
However, my Pandora has nothing for reading simple text files (and bookmarking so I can come back and continue from where I left off.) I used to read a lot on the GP2X, and (until I got my Panda) on the Wiz.

If just picking up where you left off is your concern, you can use mousepad to read the file, and when you finish a session type the phrase LOBOISGREAT. Then next time you load it up, do a search for LOBOISGREAT (remember to delete the text before you continue reading).

It's not ideal but could work as a stop-gap.
 
Last edited by a moderator:
Nice lateral thinking there!

Guess I'll do that till something better comes along, though it's definitely just a temporary workaround. Still prefer a dedicated text book reader app though.
 
Lol! That's what I did like, ages ago. You've only just reminded me of it, thankyou! (I didn't type LOBOISGREAT tho, I don't remember what I typed, I think it was a single character!)
I also support the idea of a 'real' book reading program for the pandora, and xreader looks simple to port, just looking at the build script (actually INCREDIBLY easy to port, just copy 'n' compile really(WHOOPS, that was the Linux script, not gp2x, which i didn't study too hard, but i'd assume on Pandora we'd do the Linux script anyway because we have everything the GP2X wouldn't), it's just C++ and SDL! You might need to change button configs, or want to increase resolution. PM me if that seems hard, i'll dig deeper, or do it for you.), but I am currently pandora-less (and probably will be, until batch 4(+))

I tried building it on my box (Kubuntu 10.04, 64-bit Desktop, kernel 2.6.32-21, shouldn't matter at all), but it really didn't work. Here's the output:
kyen@Unbihexium-316:~/code/notme$ ./build_linux.sh
src/state_menu.cpp: In member function ‘virtual void MenuState::think(bool)’:
src/state_menu.cpp:71: warning: deprecated conversion from string constant to ‘char*’
src/translation.cpp: In static member function ‘static char* Translation::get(int)’:
src/translation.cpp:21: warning: deprecated conversion from string constant to ‘char*’
kyen@Unbihexium-316:~/code/notme$ ls
build_gp2x.sh build_linux.sh src xreader
kyen@Unbihexium-316:~/code/notme$ ./xreader
Couldn't load imgae Couldn't open skins/Chocolate/bg.bmp
Segmentation fault
kyen@Unbihexium-316:~/code/notme$ ./xreader

I suppose it might be caused by me not using the background bitmap, but that means this program is evil, you should make sure that stuff isn't NULL(or filled with an error code, etc) :D . Again, i gtg, i'll dig deeper later.
EDIT: I couldn't resist, so I tried it in GDB
Program received signal SIGSEGV, Segmentation fault.
0x000000000040366b in Bitmap::draw(SDL_Surface*, int, int) ()
That would be it.
Tried it after moving the dirs full of stuff into the same dir as the executable, and it works. It looks really nice, too, I couldn't find any files wth the .txt extension to test tho, but you can guess the keys it uses (on the keyboard) and it all works sweet; ignoing all that...ah-hem 'technical' (I feel bad leaving it without quotes, it was too easy :) stuff:
It works really easily, and should build and run perfectly on the pandora as on any other Linux machine. Even if the key layout is a little dodgy.
EDIT2: Wow, I just gave it a test file(then noticed the 'show all' feature...) and it works really nice, I think i'll be running this on my Pandora when I get one :D Now all I need to find is a book.
 
Last edited by a moderator:
Interesting, I didnt notice the source code was included in the file I linked (I was actually wondering where to get it!).

I'll definitely take a look, though my C knowledge is almost null. Might even try compiling it on my pandora, just for kicks, though my linux knowledge is about the same level as my C knowledge :)



Still, if you think it looks so easy I'm sure a dev with a Pandora could whip out a pnd in no time, right? COME ON DEVS! Throw me a frickin bone here! :)
 
Ninjaed!

So, imagine you had to explain to someone who had no idea what they were doing :) step by step, how would you compile this on a pandora?

p.s. I mean BASIC basic, like
1. download file and unzip to DIRECTORY
etc. :)



[edit]
What do you know? I got it compiling and running! On my pandora for my pandora! How cool is that?
Now I just need to delve into the code to do some button mapping and change the window sizing. Wish me luck.
[end edit]
 
Luck wished :D .

I actually didn't check if what you had linked had source, i googled it, found it's page and downloaded it there. It's great that you got it working! And it's great that you have tried; it's annoying when people say 'Wait, this guy says he'll help SO I WON'T EVEN TRY.". Really, be proud :D .

I can have a look for you to remap the buttons, but I think it's a good exercise and might lure you into the hell that is the life of the programmer (what am I on about, I don't know sht :D ). It is a good idea for people here to learn C(/C++), and learn it well (I still aren't as good as I wish I was. Pointers are a pain sometimes. And sometimes things aren't as intuitive as you'd hope. You'll be thankign the OP team for included Wifi in the Pandora. You'll be checking things a lot if you begin to code.), because there is waaay too much Python here, the cycle-wastage makes me feel sick really. greenies out there, think about how much coal you're burning with your stupid slow Python script. And to PC 'devs', java ISN'T portable, stop saying it is. A C/C++ program can be compiled with a new architecture target in a matter of seconds, provided there is some way of making the program useful, you might say the same about java BUT: if it isn't supported by the high-and-mighty Sun Microsystems(or by openJDK) then it just won't get supported. (well, that stab wasn't needed, but hey...)

Lobo, wish you good times with your lil' pandora and, if you get interested, good fun coding too (muahahahaha...right)
EDIT: Cleaned
 
Cheers man!

I got it all scaled up to the Pandoras resolution, more or less. Now I still need to do the button remapping(think I know what to do) and then I need to make a new bigger font(they're bitmaps) because the included ones are too small for Pandoras screen, and simply doubling the bmp makes it look like crap.

Anyway, almost there!

BTW, thanks for the pointers! Really helped!
 
Hah, good on you!
Did you also remember to make the text wrap differently (unless you had changed a define, in which case it most likely has already been changed??? I haven't looked really :( )? Otherwise there will just be screen sitting there not showing any text.
 
I didn't change any wrapping code, nor anything else except for scaling the screens and button mapping. I've tested it quite a bit and it opens my text files perfectly, remembers the position, saves my preferences etc. so no apparent bugs on my build.



The only thing stopping me from making it public is the damn font is still giving me grief: I wonder what the hell the author used to make them because I don't want to do it by hand in a normal graphics editor.
 
Lobo said:
I didn't change any wrapping code, nor anything else except for scaling the screens and button mapping. I've tested it quite a bit and it opens my text files perfectly, remembers the position, saves my preferences etc. so no apparent bugs on my build.



The only thing stopping me from making it public is the damn font is still giving me grief: I wonder what the hell the author used to make them because I don't want to do it by hand in a normal graphics editor.
Scaling? Hmm, i'm not quite sure I understand what you have done so: What have you done? if you've made everything bigger with rotozoom (ouch) or by changing the fonts/bg picture/part of the code, a better idea may be adding SDL_FULLSCREEN to SDL_SetVideoMode (which is located somewhere in there), unless you multitask whilst reading. What this does is essentially is make it bigger/easier to read. Increasing the resolution just to increase everything in a similar way just eats CPU time during blitting (copying to video memory/screen/stuff).
For trying to find SDL_SetVideoMode, here's an example:
screen = SDL_SetVideoMode(320, 240, 24, SDL_HWSURFACE | SDL_FULLSCREEN);
..for more info: http://www.libsdl.org/cgi/docwiki.cgi/SDL_SetVideoMode

Of course, no need to worry if you've changed it so it can draw into more screen space, with a real higher effective resolution.

Ah yes, those kind of fonts would be annoying...heh, if you think you're up to it you could change it to use SDL_ttf, but that could eat more CPU power, but if you do go for it, SDL_RenderText_Shaded will be the function you want.
SDL_rtf could also be useful, the only information for it is found here, which is next to nothign :\. http://www.libsdl.org/cgi/docwiki.cgi/SDL_rtf

I don't mean to scare you away, lol, it's probably fine, porting applications won't be always this hard (if it is hard) :D
 
Last edited by a moderator:
No, I haven't done anything fancy. Just replaced the numbers 320 and 240 with 800 and 480, basically, plus doubled some other numbers to make the stuff fit the (bigger)screen area.

And, no I'm not up to the task of switching to TTF: my coding skills don't go so far! I'm more of a "replace strings/numbers" kind of guy :)
 
Hah! Nothing wrong with that :D.

As long as you're not the "replace the credits and copyright info and take credit" kinda guy! (I can see you aren't) :D.
 
As a matter of fact, if I ever get this to a state where it could go public, I'm going to track down the author to get his permission, or at least let him know what I've done (I think I could publish it as long as I include the source, right? the code is GPL).

Actually, I might just get in contact with him and see if he wants to take up the torch again: easier for everyone! ;) AFAIK, I believe he was working on TTF support before he went MIA. Maybe he could whip up a new bigger font for me LOL
 
Lobo said:
As a matter of fact, if I ever get this to a state where it could go public, I'm going to track down the author to get his permission, or at least let him know what I've done (I think I could publish it as long as I include the source, right? the code is GPL).

Actually, I might just get in contact with him and see if he wants to take up the torch again: easier for everyone! ;) AFAIK, I believe he was working on TTF support before he went MIA. Maybe he could whip up a new bigger font for me LOL

You can get more help if you post your source. If its working somewhat, some others can provide their expertise to help alleviate the font issue. Remember, don't hold it back. That's how code disappears.


*EDIT*
And on the GPL note. You don't have to provide your modified source, just the original source. If you host the binary, you need to provide access to the source. But if you do create a binary, please post YOUR modified source code. We all would like it.
 
Last edited by a moderator:
No worries, when I put out my version it'll be with the modified source included.
As for the font issue, the original code is all they need to add ttf support. As a matter of fact, if the coder is capable of adding ttf support, then the minor changes I've made for button mapping and scaling up the windows would be a walk in the park. I'm sure they'd do a better job of it too ;)
 
Back
Top