gbadev.org forum archive

This is a read-only mirror of the content originally found on forum.gbadev.org (now offline), salvaged from Wayback machine copies. A new forum can be found here.

DS development > Reading JPEG files

#51297 - Dannon - Thu Aug 18, 2005 3:07 am

Can anyone point me in the direction of a good tutorial for reading and storing JPEG files in either a class or a structure?

Though not directly associated with DS development, it is for something I'm trying for the DS.

#51299 - hoagie - Thu Aug 18, 2005 4:13 am

comic reader?

plz?

#51301 - tepples - Thu Aug 18, 2005 4:17 am

Want a comic reader? Just get PogoShell and throw a bunch of 240x160 pixel .bmp files in a folder.
_________________
-- Where is he?
-- Who?
-- You know, the human.
-- I think he moved to Tilwick.

#51304 - headspin - Thu Aug 18, 2005 4:24 am

doublec's tutorial on using jpeg files here might be helpful.
_________________
Warhawk DS | Manic Miner: The Lost Levels | The Detective Game

#51316 - Diskun - Thu Aug 18, 2005 6:24 am

tepples wrote:
Want a comic reader? Just get PogoShell and throw a bunch of 240x160 pixel .bmp files in a folder.
That sucks, dermatologically tested (lol)

Greets

#51335 - Dannon - Thu Aug 18, 2005 2:19 pm

Ok, I've got the JPEG stuff from Headspin's site, looks good, but I'm using the GBAMP to store JPEGs, so I'm trying to use Chishm's code to access the CF card, it says that you have to run 'FAT_InitFiles()' at the begining so I have included 'gbamp_cf.h' and put 'FAT_InitFiles()' in my initialise function, but the compiler is saying 'undefined reference to 'FAT_InitFiles()', any help?

Last edited by Dannon on Thu Aug 18, 2005 3:19 pm; edited 1 time in total

#51339 - tepples - Thu Aug 18, 2005 3:11 pm

For one thing, there are two H's in chishm.

For another, if you're getting "undefined reference" errors, then you left out either one of the .c or .o files or one of the libraries.
_________________
-- Where is he?
-- Who?
-- You know, the human.
-- I think he moved to Tilwick.

#51348 - Dannon - Thu Aug 18, 2005 4:57 pm

Got it sorted thanks, but now FAT_InitFiles() is returning false, it is returning on it's first check:

if (!CF_IsInserted())
{
return (false);
}

this can't be right as I'm running it from the CF card on my GBAMP

Also is there any chance there's some way of rotating the console text 90 degrees so I can have the DS on its side?

#51369 - Lynx - Thu Aug 18, 2005 8:13 pm

I'd say yes, as one of the E3 demos had you hold the DS sideways.

#51372 - Dannon - Thu Aug 18, 2005 9:02 pm

I'm sure it can be done, you can rotate images easily enough, but I can't seem to rotate the background with the console on, I'm using the example with the 2D libnds demo:

Code:
// Set the mode for 2 text layers and two extended background layers
  videoSetMode( MODE_5_2D | DISPLAY_BG3_ACTIVE );

// Set the sub background up for text display (we could just print to one
// of the main display text backgrounds just as easily
  videoSetModeSub(MODE_0_2D | DISPLAY_BG0_ACTIVE); //sub bg 0 will be used to print text
   
// Set the first bank as background memory and the third as sub background memory
// B and D are not used (if you want a bitmap greater than 256x256 you will need more
//memory so another vram bank must be used and mapped consecutivly
  vramSetMainBanks( VRAM_A_MAIN_BG_0x6000000, VRAM_B_LCD, VRAM_C_SUB_BG,VRAM_D_LCD );

  SUB_BG0_CR = BG_MAP_BASE( 31 );
  BG_PALETTE_SUB[255] = RGB15( 31, 31, 31 );


I have tried loads of different things to rotate it, someone must have a way to do this

#51395 - chishm - Fri Aug 19, 2005 3:17 am

Dannon wrote:
Got it sorted thanks, but now FAT_InitFiles() is returning false, it is returning on it's first check:

if (!CF_IsInserted())
{
return (false);
}

this can't be right as I'm running it from the CF card on my GBAMP

That is because you haven't set WAIT_CR so the ARM9 can read from the GBA cart slot. I will make this an automatic thing in the next update, but I haven't got enough time (motivation) to work on all the changes I want to do at the moment.

#51409 - Dannon - Fri Aug 19, 2005 7:35 am

Where abouts do I set WAIT_CR and what to?

EDIT: Sorted out.

#55684 - LunarCrisis - Fri Sep 30, 2005 4:35 pm

Dannon wrote:
I'm sure it can be done, you can rotate images easily enough, but I can't seem to rotate the background with the console on, I'm using the example with the 2D libnds demo:

Code:
// Set the mode for 2 text layers and two extended background layers
  videoSetMode( MODE_5_2D | DISPLAY_BG3_ACTIVE );

// Set the sub background up for text display (we could just print to one
// of the main display text backgrounds just as easily
  videoSetModeSub(MODE_0_2D | DISPLAY_BG0_ACTIVE); //sub bg 0 will be used to print text
   
// Set the first bank as background memory and the third as sub background memory
// B and D are not used (if you want a bitmap greater than 256x256 you will need more
//memory so another vram bank must be used and mapped consecutivly
  vramSetMainBanks( VRAM_A_MAIN_BG_0x6000000, VRAM_B_LCD, VRAM_C_SUB_BG,VRAM_D_LCD );

  SUB_BG0_CR = BG_MAP_BASE( 31 );
  BG_PALETTE_SUB[255] = RGB15( 31, 31, 31 );


I have tried loads of different things to rotate it, someone must have a way to do this
I haven't tried this, but you could try using an extended rotation/scale background as your console, since it also uses 16 bit tile indices.
_________________
If a tree falls in the forest and no one is there to hear it, why the heck do you care?