ROM Hack Simple C/C++ Q

.::5pYd3r::.

Viva La Pizza
Member
Joined
Jun 2, 2007
Messages
765
Reaction score
1
Trophies
1
Age
32
Location
The GREAT Southern Land :D
Website
Visit site
XP
333
Country
What did i do wrong in this code, i'm trying to make an app that when u press the A button it changes the colour of the top screen to a random colour
CODE// PALib Template Application

// Includes
#include    // Include for PA_Lib
u8 Colour1 = 31;
u8 Colour2 = 31;
u8 Colour3 = 31;
u32 max = 31;

int main()
{
ÂÂÂÂint i;

ÂÂÂÂconsoleDemoInit();

ÂÂÂÂvideoSetMode(MODE_FB0);

ÂÂÂÂvramSetBankA(VRAM_A_LCD);

ÂÂÂÂprintf("WELCOME TO SpYdEr's first DS app\n");

ÂÂÂÂprintf("Press A to change colour of the top screen\n");

ÂÂÂÂif (Pad.Newpress.Anykey)

Âu32 Colour1 = PA_RandMax(max);
ÂÂÂÂ
ÂÂÂÂfor(i = 0; i < 256 * 192; i++)
ÂVRAM_A = RGB15(Colour1,Colour2,Colour3);

ÂÂÂÂreturn 0;
}
 
I've never programmed for the DS, so I'm not sure, but I see one thing odd about the program. You define a global u8 Colour1 = 31;. But then later on you set u32 Colour1 = PA_RandMax(max);. So now you have to variables with different types? I assume those are types (u8, u32), which is an illegal operation in C++.
 
yeah i changed it but it still doesn't work
frown.gif
, it looks like when i do Colour1 = PA_RandMax(31); it doesn't change the variable
 
sorry for the triple post but here is the updated code and it still doesn't work
CODE// PALib Template Application

// Includes
#include    // Include for PA_Lib
u8 Colour1 = 31;
u8 Colour2 = 31;
u8 Colour3 = 31;

int main()
{
ÂÂÂÂint i;

ÂÂÂÂconsoleDemoInit();

ÂÂÂÂvideoSetMode(MODE_FB0);

ÂÂÂÂvramSetBankA(VRAM_A_LCD);

ÂÂÂÂprintf("WELCOME TO SpYdEr's first DS app\n");

ÂÂÂÂprintf("Press A to change colour of the top screen\n");

ÂÂÂÂif(Pad.Newpress.Anykey)
ÂÂÂÂ{ÂÂÂÂ
ÂColour1 = PA_RandMax(31);
ÂColour2 = PA_RandMax(31);
ÂColour3 = PA_RandMax(31);
ÂÂÂÂ}
ÂÂÂÂfor(i = 0; i < 256 * 192; i++)
ÂVRAM_A = RGB15(Colour1,Colour2,Colour3);

ÂÂÂÂreturn 0;
}
 
If your using palib, why don't you use some of its functions?
CODE// PALib Template Application

// Includes
#include    // Include for PA_Lib
u8 Colour1 = 31;
u8 Colour2 = 31;
u8 Colour3 = 31;

int main()
{

PA_Init(); Â Â// Initializes PA_Lib
PA_InitVBL();
PA_InitRand();
PA_Init16bitBg (1,3);
int x;
int y;

printf("WELCOME TO SpYdEr's first DS app\n");


printf("Press A to change colour of the top screen\n");

while(1){

if(Pad.Newpress.Anykey)
{
Colour1 = PA_RandMax(31);
Colour2 = PA_RandMax(31);
Colour3 = PA_RandMax(31);
}
for(x=0;x
 
Yeah i forgot to change the text stuff (its 2 am now
tongue.gif
) and if you need information on what i did you can find it in the palib documentation Here. Tutorials can also be found Here if you need more info.
 

Site & Scene News

Popular threads in this forum