#135382 - yellowstar - Mon Jul 23, 2007 1:20 am
The problem in this post is
not the problem I am having right now.
See my second post for my current problem.
I need some help with booting GBA homebrew.
How do I boot GBA homebrew?
I know how to boot the Game Pak.
EDIT:
I only have a Slot-1 device.
For Slot-2 devices,
I only have commercial Game Paks.
Last edited by yellowstar on Sat Jul 28, 2007 11:59 pm; edited 3 times in total
#135392 - tepples - Mon Jul 23, 2007 2:01 am
Which flash equipment are you using in SLOT-2?
_________________
-- Where is he?
-- Who?
-- You know, the human.
-- I think he moved to Tilwick.
#135394 - yellowstar - Mon Jul 23, 2007 2:08 am
I only have a Slot-1 device.
For Slot-2 devices,
I only have commercial Game Paks.
#135397 - dantheman - Mon Jul 23, 2007 2:46 am
You can only boot GBA homebrew if you have a homebrew device in slot-2. You cannot launch it from a slot-1 device.
#135443 - spinal_cord - Mon Jul 23, 2007 12:27 pm
dantheman is right. The GBA hardware does not know slot-1 exists and has absolutely no access to it.
_________________
I'm not a boring person, it's just that boring things keep happening to me.
Homepage
#135862 - tepples - Thu Jul 26, 2007 9:26 pm
Solution: Buy the EZ-FLASH 3-in-1 card.
_________________
-- Where is he?
-- Who?
-- You know, the human.
-- I think he moved to Tilwick.
#136087 - yellowstar - Sat Jul 28, 2007 11:56 pm
I now am now having a differen't problem.
I am trying to boot Game Paks,(GBA)
with custom borders,
but it won't work.
Booting works fine,
it's the border that won't work.
The border that is displayed is a normal,
black border.
Here's how I am doing it:
ARM9:
For booting GBA,
the ARM9 calls PreGBA,
then CommandBootGBA.
CommandBootGBA
does stuff for initializing for
booting and the custom border,
then it sends a message
to the ARM7,
telling it to boot the GBA slot.
Here's the data palette vars:
(These vars are initialized in a init function.)
(My code converts paletted data to 16 bit data.)
Code: |
u16 *data = NULL;
unsigned char *data2 = NULL;
u16 *palette = NULL;
|
Code: |
void PreGBA()
{
DIR_ITER *dir;
char str[256];
char str2[256];
strcpy(str,"");
strcpy(str2,"");
sprintf(str,"/GameBooter/Extras/GBA/Games/%s/A/",GBA_HEADER.title);
dir = diropen(str);
if(dir!=NULL)
{
dirclose(dir);
FILE *f = NULL;
int size = 0;
sprintf(str2,"%s%s",str,"Pic.raw");
f = fopen(str2,"rb");
if(f==NULL)
return;
size = GetFileSize(f);
if(size!=256*192)
{
FAT_init_success = false;
fclose(f);
return;
}
fread(data2,1,256*192,f);
fclose(f);
sprintf(str2,"%s%s",str,"master.pal");
size = 0;
f = fopen(str2,"rb");
if(f==NULL)
return;
size = GetFileSize(f);
fread(palette,2,size/2,f);
fclose(f);
for(int i=0; i < 256*192; i++)
{
data[i] = palette[data2[i]];
}
}
}
|
Here's the code for CommandBootGBA:
(FAT_init_success is the value fatInitDefault returns.)
Code: |
void CommandBootGBA()
{
u16 clear = 0x0000;
u32 *VRAMA = (u32 *)0x06000000;
u32 *VRAMB = (u32 *)0x06020000;
u32 *VRAMC = (u32 *)0x06040000;
u32 *VRAMD = (u32 *)0x06060000;
vramSetMainBanks( VRAM_A_MAIN_BG, VRAM_B_MAIN_BG,
VRAM_C_MAIN_BG, VRAM_D_MAIN_BG);
memset(VRAMA, clear, 256*256*2);
memset(VRAMB, clear, 256*256*2);
memset(VRAMC, clear, 256*256*2);
memset(VRAMD, clear, 256*256*2);
vramSetMainBanks( VRAM_A_MAIN_BG, VRAM_B_MAIN_BG,
VRAM_C_ARM7, VRAM_D_ARM7);
if(FAT_init_success)
{
videoSetMode(MODE_5_2D);
dmaCopy((u16*)data,VRAM_A,256*192*2);
dmaCopy((u16*)data,VRAM_B,256*192*2);
}
if(PersonalData->_user_data.gbaScreen) {
lcdMainOnBottom();
}
REG_EXEMEMCNT = (0xa08f);
commandControl->processed = false;
commandControl->mode = false;
commandControl->fire = true;
sysSetCartOwner(false);
}
|
ARM7:
I can't post any code for the ARM7,
as for some reason the source files
got corrupted,
and they can't be read anymore.
I have backups
on a differen't computer,
but I don't have access to it.
Basicly the ARM7
does the normal GBA booting stuff.
It does this when it receives the
message from the ARM9 to boot.
#136120 - chuckstudios - Sun Jul 29, 2007 1:46 pm
My code probably has some unnecessary steps, but this how I boot to GBA with borders:
Code: |
void injectBorder(void) {
EFS_FILE* borderFile;
char* borderData = malloc(98304);
memset(borderData, 0, 98304);
borderFile = EFS_fopen("/border.bin");
EFS_fread(borderData, 1, 98304, borderFile);
EFS_fclose(borderFile);
videoSetMode(MODE_5_2D | DISPLAY_BG3_ACTIVE);
videoSetModeSub(MODE_5_2D | DISPLAY_BG3_ACTIVE);
vramSetMainBanks(VRAM_A_MAIN_BG_0x06000000, VRAM_B_MAIN_BG_0x06020000, VRAM_C_SUB_BG_0x06200000, VRAM_D_LCD);
// for the main screen
BG3_CR = BG_BMP16_256x256 | BG_BMP_BASE(0) | BG_WRAP_OFF;
BG3_XDX = 1 << 8; //scale x
BG3_XDY = 0; //rotation x
BG3_YDX = 0; //rotation y
BG3_YDY = 1 << 8; //scale y
BG3_CX = 0; //translation x
BG3_CY = 0; //translation y
// actually using it as a back buffer, but to see it as a viewable BG in no$...
BG2_CR = BG_BMP16_256x256 | BG_BMP_BASE(8) | BG_WRAP_OFF;
BG2_XDX = 1 << 8; //scale x
BG2_XDY = 0; //rotation x
BG2_YDX = 0; //rotation y
BG2_YDY = 1 << 8; //scale y
BG2_CX = 0; //translation x
BG2_CY = 0; //translation y
dmaCopy(borderData, (uint16*)BG_BMP_RAM(0), 256*192*2);
dmaCopy(borderData, (uint16*)BG_BMP_RAM(8), 256*192*2);
}
void bootGBA(void){
iprintf("Starting execution.\n");
//swiDelay(0x200000);
//hardware_init();
sysSetBusOwners(BUS_OWNER_ARM7,BUS_OWNER_ARM7);
if(PersonalData->_user_data.gbaScreen)
REG_POWERCNT=1;
else
REG_POWERCNT=POWER_SWAP_LCDS|1;
IPC_ARM9=IPC_GBA;
} |
border.bin is converted with GRIT with the following commands:
grit border.bmp -ftbin -fh! -gB16