ROM Hack Simple C/C++ Q

.::5pYd3r::.

Viva La Pizza
OP
Member
Joined
Jun 2, 2007
Messages
765
Trophies
0
Age
29
Location
The GREAT Southern Land :D
Website
Visit site
XP
293
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;
}
 

OrGoN3

Well-Known Member
Member
Joined
Apr 23, 2007
Messages
3,241
Trophies
1
XP
3,269
Country
United States
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++.
 

.::5pYd3r::.

Viva La Pizza
OP
Member
Joined
Jun 2, 2007
Messages
765
Trophies
0
Age
29
Location
The GREAT Southern Land :D
Website
Visit site
XP
293
Country
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
 

.::5pYd3r::.

Viva La Pizza
OP
Member
Joined
Jun 2, 2007
Messages
765
Trophies
0
Age
29
Location
The GREAT Southern Land :D
Website
Visit site
XP
293
Country
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;
}
 

BassAceGold

Testicles
Member
Joined
Aug 14, 2006
Messages
496
Trophies
1
XP
441
Country
Canada
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
 

BassAceGold

Testicles
Member
Joined
Aug 14, 2006
Messages
496
Trophies
1
XP
441
Country
Canada
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

General chit-chat
Help Users
  • BigOnYa @ BigOnYa:
    I kept thinking jaws was gonna come up and attack
  • K3Nv2 @ K3Nv2:
    Jaws is on a diet
  • K3Nv2 @ K3Nv2:
    Damn power went out
  • BigOnYa @ BigOnYa:
    Ok xdqwerty, your little bro prob tripped On the cord and unplugged you
  • K3Nv2 @ K3Nv2:
    Ya I'm afraid of the dark hug me
  • BigOnYa @ BigOnYa:
    Grab and hold close your AncientBoi doll.
  • K3Nv2 @ K3Nv2:
    Damn didn't charge my external battery either
  • BigOnYa @ BigOnYa:
    Take the batteries out of your SuperStabber3000... Or is it gas powered?
  • K3Nv2 @ K3Nv2:
    I stole batteries from your black mamba
    +1
  • K3Nv2 @ K3Nv2:
    My frozen food better hold up for an hour I know that
  • BigOnYa @ BigOnYa:
    Or else gonna be a big lunch and dinner tomorrow.
  • BigOnYa @ BigOnYa:
    Did you pay your power bill? Or give all yo money to my wife, again.
  • K3Nv2 @ K3Nv2:
    Oh good the estimated time is the same exact time they just said
    +1
  • BigOnYa @ BigOnYa:
    Load up your pc and monitor, and head to a McDonalds dining room, they have free WiFi
  • K3Nv2 @ K3Nv2:
    Sir please watch your porn in the bathroom
    +2
  • BigOnYa @ BigOnYa:
    No sir we can not sell you anymore apple pies, after what you did with the last one.
  • K3Nv2 @ K3Nv2:
    We ran out
  • HiradeGirl @ HiradeGirl:
    for your life
    +1
  • K3Nv2 @ K3Nv2:
    My life has no value my fat ass is staying right here
  • K3Nv2 @ K3Nv2:
    Nearly 4 hours without power :(
  • Veho @ Veho:
    SO POWERLESS
  • K3Nv2 @ K3Nv2:
    Tell Kanye I need power
    K3Nv2 @ K3Nv2: Tell Kanye I need power