| 
  • If you are citizen of an European Union member nation, you may not use this service unless you are at least 16 years old.

  • Work with all your cloud files (Drive, Dropbox, and Slack and Gmail attachments) and documents (Google Docs, Sheets, and Notion) in one place. Try Dokkio (from the makers of PBworks) for free. Now available on the web, Mac, Windows, and as a Chrome extension!

View
 

eBook Converter

Page history last edited by Pasquale Barilla 10 years, 4 months ago

eBook Converter Functional Spec v0.1 (If you modify this, please increase version number accordingly)

 

1.0 Application Brief

1.1 Description of Application

In the markets that is our main focus for Playpower, books are seen sometimes as a luxury. There are hundreds of thousands of free, open domain, classic books on the internet (Project Gutenberg, etc), some of these books are the most important books ever written.

1.2 Application Goals

This application would be a tool that would run on a PC, and would accept TXT files (as a minimum). The application would process the file, then output a NES rom. The NES rom would be the contents of the the TXT file, broken up into pages that can be progressed by input from the controller.

1.3 User

This application is targeted at users of the Famiclone

1.4 Precident

eBooks have become much more popular in the past few years. Portability is the most valuable feature of eBooks. However, eBooks have a very high entry point, requiring the user to be able to afford a dedicated eBook reading device, or a computer. Being able to produce a cartridge full of books is therefore extremely valuable to these markets.

 

2.0 Conceptual Models

2.1 User Model

The user of this application would first select the TXT file they wish to convert to a NES format. The application process the file. The user can select several variables, such as white on black or black on white, font type, and so on (however, those are auxiliary). The user tells the application to process the file. The user is then presented with a nes file. When the user loads the NES file, it presents them with the title of the Book. If the user presses Start, A or Right, the book is started. Pressing A or Right will continue progressing the book. Pressing B or Left makes the book go back a page. Pressing Select brings up the page selector.

At the bottom of the screen is a progress meter and a page number indicator. The User can enter a page number to skip to that page.

 

2.2 Programmers Model

The eBook is given to the Application to parse. The application has a map of the most popular ASCII characters. The parser first divides up the book into pages, based on the maximum amount of characters in the readable screen. The application then converts the ASCII characters into their NES variants, and creates a background image for the NES. After the parser finishes processing the entire txt file, it then assembles a chain of background images which can be progressed through by hitting right or A, and back by hitting left or B. Hitting Select brings up the page selector.

 

3.0 Prototype

By using GalleryNES (Don Miller), we can create a prototype "ebook" by encoding 10 pages of text into a self-contained nes rom. By editing the image files directly with a non-destructive text editor (notepad is pretty much the only one that does it well) you can type text directly in the files, and then at compile-time it will automagically convert.

3.1 Images

3.2 Process for Prototype

When encoding the text file, you must first consider the target device. PAL cuts off the top and bottom (it seems), so instead of 32*30 it is actually 32*28 sprites.

To make the book more aesthetically pleasing, you should include a line of pipes on the 1st and 32nd columns, and then manually word-wrap (or include hyphens) to fit the words within the pipes.

3.3 Making the prototype files

3.2.a Manually

To convert files to work in GalleryNES, simply edit one of the existing graphic files in the GalleryNES directory, placing pipes at the 1st and 32nd columns, and *'s at the 1st and 30th row.

for example:

********************************

|THIS IS HOW YOU FORMAT THE TE-|

|XT. NOTICE HOW EACH ROW IS    |

|ONLY 32 CHARACTERS.            |

 

********************************

 

You must insert spaces between text and rows, as each row must have 32 characters in it.

 

3.2.b Programatically

A concept for handling this programatically is to parse the book, saving the entire text as a mutable array. Then we create a variable to act as a counter, a variable to handle the current word, and use a const to dictate the row in characters. Then each character in the array increases the variable by one. when the variable = 1 or 32, a pipe is inserted. Between spaces can be assumed to be a word. e.g.: " hello my name is Pasquale" would mean that each word between the space character is a book. So this variable would be 5, then 2, then 4, then 2, then 8 (yes, i have a long name).

So the reason why we have this word's character count saved as a variable is because we will use this for our word-wrap algorithm. If the character count of the word is greater than the remainder of the row const minus the current character, then if the word is greater than say 6 characters, a hyphen is inserted as the 31st character, and then that word is continued on the next line. We can adjust the word-wrap character count by modifying our greater than that const. 

eg:

(Pseudocode)

NSMutableArray *book = [whatever function will open this book, NSUrl or something];

const rowCharacters = 32

int currentCharacter;

int wordInCharacters;

int totalCharactersOfBook = 0;

[book count] = totalCharactersOfBook;

 

for (i = 0; i < totalCharactersOfBook; i++)

 

if (currentCharacter =< rowCharacters)

and (currentCharacter == 0) || (currentCharacter == 32)

[fileout '|'] //not actually sure of the code for this

currentCharacter++;

 

// WIP

 

Comments (1)

Kishan said

at 11:44 am on Mar 13, 2011

Awesome idea Pat!

You don't have permission to comment on this page.