PSP Hacks - Forums

Go Back   PSP Hacks - Forums > PSP Community > PSP Programming & Development

Notices

Reply
 
Thread Tools Display Modes
  #1  
Old 11-03-2009, 09:41 PM
gunman121 gunman121 is offline
PSP Enthusiast
 

Join Date: Jul 2008
Posts: 361
gunman121 Has a Beginner Reputation
Default Help requested.

I decided to do a simple app as my first PSP program, a calender. So far it's not done but -- I do have most of it done. However I'm coming across a problem when i run it on my PSP. I have it set so when you press the right button on the psp, it goes to the next month and displays the image. Well at first it was scrolling through all the months and looping 3 times and stoped at december. I fixed that and lowered it so it only did 3 months till i got it fixed. It was then obvious i had done if(osl_keys->held.right). I then changed it too if(osl_keys->pressed.right). Now when i start up and just press right it stays on feb and does't move. Here's my code for the calender part -- I have tried changing the timer around and calling the method at the very end of the if statement so it's not in each if -- but none have worked.

Quote:
Originally Posted by PSPHacker#1
stupid noob learn the godamn basics before you do this shit!!!
I know the basics, I have gone through several courses and read several books. Please don't try and put me down, because I don't have oslib memorised yet.

Quote:
Originally Posted by PSPHacker#2
idiot fag retard there's tons of documenttation how can u screw up OSLIB!!!!
Good question, I've read through a majority of the methods and tried to follow what each did. I still need help.


Spoiler:
Code:
 	int good(int timer)
  	{
          timer = timer + 1;
          oslReadKeys();
      
          if(osl_keys->pressed.right)
          {
   		
			
          if(timer == 0 )
          {
             timer = 1;
             }
           if(timer == 1 )
           {
                    	
		oslStartDrawing();
		oslCls();
		oslDrawImage(caljan);		
		oslEndDrawing();
		oslSyncFrame();	
		good(timer);
	
    }

			 if(timer == 2 )
			 {
                  	oslStartDrawing();
		oslCls();
		oslDrawImage(calfeb);		
		oslEndDrawing();
		oslSyncFrame();	
		good(timer);
   
   
		
        }
			
			 if(timer == 3 )
			 {
            	oslStartDrawing();
		oslCls();
		oslDrawImage(calmar);		
		oslEndDrawing();
		oslSyncFrame();	
		good(timer);
      

        }	

}

}



Any help appreciated, Even if Brick bitches me out.
__________________
Fat PSP: 1.50 OFW --> 2.80 OFW --> 3.50 OFW --> 3.80 OFW --> 3.90 OFW --> Pandora --> 3.71 m33 --> 3.90 m33 --> 4.01 m33 --> 5.00 m33-3
Slim psp: 3.90 OFW --> Pandora --> Brick(Somehow?) --> DC v7 --> Still brick --> DC v7 format flash1 --> DC v5 --> 3.90 m33 --> 5.00m33-3
Reply With Quote
  #2  
Old 11-04-2009, 02:19 AM
Brick Brick is offline
I am Flame Master
PSP Titan
 

Join Date: Mar 2005
Location: *this
Posts: 42,229
Brick has a reputation beyond reputeBrick has a reputation beyond reputeBrick has a reputation beyond reputeBrick has a reputation beyond reputeBrick has a reputation beyond reputeBrick has a reputation beyond reputeBrick has a reputation beyond reputeBrick has a reputation beyond reputeBrick has a reputation beyond reputeBrick has a reputation beyond reputeBrick has a reputation beyond repute
Default

Quote:
Originally Posted by gunman121 View Post
Any help appreciated, Even if Brick bitches me out.
You're a funny gguy...

BTW , if that "PSPHacker#%" is me , change it to "PSPF@cker#%" KTHX.

Good luck , because i don't see anyone to actually bother.
Spoiler:

Not really!... *e-curses*
Reply With Quote
  #3  
Old 11-04-2009, 04:33 PM
gunman121 gunman121 is offline
PSP Enthusiast
 

Join Date: Jul 2008
Posts: 361
gunman121 Has a Beginner Reputation
Default

Quote:
Originally Posted by Brick View Post
You're a funny gguy...

BTW , if that "PSPHacker#%" is me , change it to "PSPF@cker#%" KTHX.

Good luck , because i don't see anyone to actually bother.
Spoiler:

Not really!... *e-curses*
Then why have this part of the forums?
__________________
Fat PSP: 1.50 OFW --> 2.80 OFW --> 3.50 OFW --> 3.80 OFW --> 3.90 OFW --> Pandora --> 3.71 m33 --> 3.90 m33 --> 4.01 m33 --> 5.00 m33-3
Slim psp: 3.90 OFW --> Pandora --> Brick(Somehow?) --> DC v7 --> Still brick --> DC v7 format flash1 --> DC v5 --> 3.90 m33 --> 5.00m33-3
Reply With Quote
  #4  
Old 11-04-2009, 10:01 PM
Brick Brick is offline
I am Flame Master
PSP Titan
 

Join Date: Mar 2005
Location: *this
Posts: 42,229
Brick has a reputation beyond reputeBrick has a reputation beyond reputeBrick has a reputation beyond reputeBrick has a reputation beyond reputeBrick has a reputation beyond reputeBrick has a reputation beyond reputeBrick has a reputation beyond reputeBrick has a reputation beyond reputeBrick has a reputation beyond reputeBrick has a reputation beyond reputeBrick has a reputation beyond repute
Default

Quote:
Originally Posted by gunman121 View Post
Then why have this part of the forums?
When you're asking for help, don't start the drama , its the 3rd time you do this.

Yes , you will get flamed if you start saying that you're going to create a MMORG in ... 6 years and then you seem to have no idea about advanced concepts.

Yes , you will also get flamed by everyone if .... [insert kerWin's case] ...


Anyway , i will help you this time , but when you're asking for help , don't trigger flames/and or drama.

It seems that PSPF@cker is absolutely right , you need to learn the basics.
You don't know anything about arrays and pointers/structures ....................................


Code:
//You're using C i guess...

static TMonth MonthTable align(16) [MONTH_COUNT] =
{
	TMonth("January",1,getImageFromCache("January.PNG")) , 
	TMonth("February",2,getImageFromCache("February.PNG")) , ...lalalaaa
};


//Then , you do :


if(monthChanged)
{
	++activeMonthInex;

	if(activeMonthInex > MONTH_COUNT - 1)
		activeMonthInex = 0;

	activeMonthPointer = (MonthTable + activeMonthInex);
}


oslStartDrawing();
oslCls();

if(activeMonthPointer)
	oslDrawImage(activeMonthPointer->imagePtr);   
     
oslEndDrawing();
oslSyncFrame();

Feature-less version :

Code:
//You're using C i guess...

static OSL_IMAGE* MonthTable align(16) [MONTH_COUNT] =
{
	getImageFromCache("January.PNG") , 
	getImageFromCache("February.PNG") , ...lalalaaa
};


//Then , you do :


if(monthChanged)
{
	++activeMonthInex;

	if(activeMonthInex > MONTH_COUNT - 1)
		activeMonthInex = 0;

	activeMonthPointer = (MonthTable + activeMonthInex);
}


oslStartDrawing();
oslCls();

if(activeMonthPointer)
	oslDrawImage(activeMonthPointer);   
     
oslEndDrawing();
oslSyncFrame();
BTW, "getImageFromCache" is actually :
Code:
preloadResources()
{
        //safe-load resources
	buffer align(16) [ 128 ];

	for(int i = 0; i < MONTH_COUNT; i++)
	{
		strcpy(buffer,(MonthTable + i)->string);
		strcat(buffer,".png");

		(MonthTable + i)->imagePtr = loadImage(buffer);
	}


	//MOAAREEE
}

Last edited by Brick; 11-04-2009 at 10:12 PM.
Reply With Quote
  #5  
Old 11-05-2009, 08:16 AM
gunman121 gunman121 is offline
PSP Enthusiast
 

Join Date: Jul 2008
Posts: 361
gunman121 Has a Beginner Reputation
Default

Quote:
Originally Posted by Brick View Post
When you're asking for help, don't start the drama , its the 3rd time you do this.

Yes , you will get flamed if you start saying that you're going to create a MMORG in ... 6 years and then you seem to have no idea about advanced concepts.

Yes , you will also get flamed by everyone if .... [insert kerWin's case] ...


Anyway , i will help you this time , but when you're asking for help , don't trigger flames/and or drama.

It seems that PSPF@cker is absolutely right , you need to learn the basics.
You don't know anything about arrays and pointers/structures ....................................

Spoiler:

Code:
//You're using C i guess...

static TMonth MonthTable align(16) [MONTH_COUNT] =
{
	TMonth("January",1,getImageFromCache("January.PNG")) , 
	TMonth("February",2,getImageFromCache("February.PNG")) , ...lalalaaa
};


//Then , you do :


if(monthChanged)
{
	++activeMonthInex;

	if(activeMonthInex > MONTH_COUNT - 1)
		activeMonthInex = 0;

	activeMonthPointer = (MonthTable + activeMonthInex);
}


oslStartDrawing();
oslCls();

if(activeMonthPointer)
	oslDrawImage(activeMonthPointer->imagePtr);   
     
oslEndDrawing();
oslSyncFrame();

Feature-less version :

Code:
//You're using C i guess...

static OSL_IMAGE* MonthTable align(16) [MONTH_COUNT] =
{
	getImageFromCache("January.PNG") , 
	getImageFromCache("February.PNG") , ...lalalaaa
};


//Then , you do :


if(monthChanged)
{
	++activeMonthInex;

	if(activeMonthInex > MONTH_COUNT - 1)
		activeMonthInex = 0;

	activeMonthPointer = (MonthTable + activeMonthInex);
}


oslStartDrawing();
oslCls();

if(activeMonthPointer)
	oslDrawImage(activeMonthPointer);   
     
oslEndDrawing();
oslSyncFrame();
BTW, "getImageFromCache" is actually :
Code:
preloadResources()
{
        //safe-load resources
	buffer align(16) [ 128 ];

	for(int i = 0; i < MONTH_COUNT; i++)
	{
		strcpy(buffer,(MonthTable + i)->string);
		strcat(buffer,".png");

		(MonthTable + i)->imagePtr = loadImage(buffer);
	}


	//MOAAREEE
}
Wow, wow. Where did I start drama lol? I made silly jokes at the start of my topic, that wasn't intended to be serious. Third time I've done this? Whatt.. I think you mean yourself.

I do indeed know about pointers, I don't quite understand why I would use them in this case.. It seems very unnessessary for a simple concenpt that I'm doing. But thanks. I guess I'll change it up.
__________________
Fat PSP: 1.50 OFW --> 2.80 OFW --> 3.50 OFW --> 3.80 OFW --> 3.90 OFW --> Pandora --> 3.71 m33 --> 3.90 m33 --> 4.01 m33 --> 5.00 m33-3
Slim psp: 3.90 OFW --> Pandora --> Brick(Somehow?) --> DC v7 --> Still brick --> DC v7 format flash1 --> DC v5 --> 3.90 m33 --> 5.00m33-3

Last edited by gunman121; 11-05-2009 at 07:07 PM.
Reply With Quote
  #6  
Old 11-04-2009, 06:17 PM
pspjoke's Avatar
pspjoke pspjoke is offline
Programmer
PSP Guru
 

Join Date: Mar 2008
Location: U.S.
Posts: 1,643
pspjoke is on a distinguished road
Default

for people to ask questions minus the attitude?

i skimmed over the code, there is something wrong...

i hate the way you place your brackets.
__________________
http://levoneprojects.net23.net/

++rep me if i helped you please.
Ahh, shit. Stupidity is on the rise again.
went legit Oct. 31, 09'
piracy is wrong, please don't do it.

Reply With Quote
  #7  
Old 11-04-2009, 06:19 PM
gunman121 gunman121 is offline
PSP Enthusiast
 

Join Date: Jul 2008
Posts: 361
gunman121 Has a Beginner Reputation
Default

Quote:
Originally Posted by pspjoke View Post
for people to ask questions minus the attitude?
My comment was being sarcastic >_<.

What do you think pspjoke, do you see my problem?
__________________
Fat PSP: 1.50 OFW --> 2.80 OFW --> 3.50 OFW --> 3.80 OFW --> 3.90 OFW --> Pandora --> 3.71 m33 --> 3.90 m33 --> 4.01 m33 --> 5.00 m33-3
Slim psp: 3.90 OFW --> Pandora --> Brick(Somehow?) --> DC v7 --> Still brick --> DC v7 format flash1 --> DC v5 --> 3.90 m33 --> 5.00m33-3
Reply With Quote
  #8  
Old 11-04-2009, 07:15 PM
pspjoke's Avatar
pspjoke pspjoke is offline
Programmer
PSP Guru
 

Join Date: Mar 2008
Location: U.S.
Posts: 1,643
pspjoke is on a distinguished road
Default

Quote:
Originally Posted by gunman121 View Post
My comment was being sarcastic >_<.

What do you think pspjoke, do you see my problem?
hold on a sec, ill look at it a little and see if i notice anything. im kinda busy tho so sorry if i can't help.


EDIT:

ok im seeing some stuff i don't like and some stuff im unsure about cause i don't know how you have it set up to call good initially.

idk if this is your problem tho.

Code:
     int good(int timer)
    {
        timer = timer + 1;
        oslReadKeys();
      
        if(osl_keys->pressed.right)
        {


            if(timer == 0 )
            {
                timer = 1;
            }
            if(timer == 1 )
            {
                        
                oslStartDrawing();
                oslCls();
                oslDrawImage(caljan);        
                oslEndDrawing();
                oslSyncFrame();    
                good(timer);

            }

            if(timer == 2 )
            {
                oslStartDrawing();
                oslCls();
                oslDrawImage(calfeb);        
                oslEndDrawing();
                oslSyncFrame();    
                good(timer);  
            }
            
            if(timer == 3 )
            {
                oslStartDrawing();
                oslCls();
                oslDrawImage(calmar);        
                oslEndDrawing();
                oslSyncFrame();    
                good(timer);
            }    

        }
    }
you have good in a recursion IF %condition% is met and if the condition is not met, the recursion dies.. which would be like ending a loop in this case. (and freeing a lot of memory.. but thats not the issue)

don't do this... im assuming you don't have good being called in a loop because you thought a recursive function would suffice, but idk.

anyway remove all the calls to good from good and throw the one and only call to good in a loop.


for example.

Code:
int good(int& timer)
{
    timer = timer + 1;
    oslReadKeys();
  
    if(osl_keys->pressed.right)
    {


        if(timer == 0 )
        {
            timer = 1;
        }
        if(timer == 1 )
        {
                    
            oslStartDrawing();
            oslCls();
            oslDrawImage(caljan);        
            oslEndDrawing();
            oslSyncFrame();    

        }

        if(timer == 2 )
        {
            oslStartDrawing();
            oslCls();
            oslDrawImage(calfeb);        
            oslEndDrawing();
            oslSyncFrame();     
        }
        
        if(timer == 3 )
        {
            oslStartDrawing();
            oslCls();
            oslDrawImage(calmar);        
            oslEndDrawing();
            oslSyncFrame();    
        }    

    }
}
    
    
int main()
{
    int timer = 0;
    
    while(true)
        good(timer);
    
    return 0;
}
hope that helps.
NOTE: that the example code wont compile for obvious reasons. (a lot of un-declared vars)
__________________
http://levoneprojects.net23.net/

++rep me if i helped you please.
Ahh, shit. Stupidity is on the rise again.
went legit Oct. 31, 09'
piracy is wrong, please don't do it.


Last edited by pspjoke; 11-04-2009 at 07:29 PM.
Reply With Quote
  #9  
Old 11-04-2009, 08:41 PM
gunman121 gunman121 is offline
PSP Enthusiast
 

Join Date: Jul 2008
Posts: 361
gunman121 Has a Beginner Reputation
Default

Yeah I had tried moving that around before, but still no luck. Hmm.
__________________
Fat PSP: 1.50 OFW --> 2.80 OFW --> 3.50 OFW --> 3.80 OFW --> 3.90 OFW --> Pandora --> 3.71 m33 --> 3.90 m33 --> 4.01 m33 --> 5.00 m33-3
Slim psp: 3.90 OFW --> Pandora --> Brick(Somehow?) --> DC v7 --> Still brick --> DC v7 format flash1 --> DC v5 --> 3.90 m33 --> 5.00m33-3
Reply With Quote
  #10  
Old 11-06-2009, 12:34 AM
Brick Brick is offline
I am Flame Master
PSP Titan
 

Join Date: Mar 2005
Location: *this
Posts: 42,229
Brick has a reputation beyond reputeBrick has a reputation beyond reputeBrick has a reputation beyond reputeBrick has a reputation beyond reputeBrick has a reputation beyond reputeBrick has a reputation beyond reputeBrick has a reputation beyond reputeBrick has a reputation beyond reputeBrick has a reputation beyond reputeBrick has a reputation beyond reputeBrick has a reputation beyond repute
Default

Quote:
Originally Posted by gunman121 View Post
Wow, wow. Where did I start drama lol? I made silly jokes at the start of my topic, that wasn't intended to be serious. Third time I've done this? Whatt.. I think you mean yourself.
I'm too lazy to give a serious reply , but i'll tell you one thing : When you're asking for help , don't do *this.

Spoiler:

@THnakes mode. [ thhhhhhhhhh..sssssssssssssssssss ]

*this = "OK GUYTH , I KNOW I'M NOOB , BUT PLEATHE DON'T CALL ME ... OKTH?."
*this += "BRICK'th GOING TO FLAME ME OMG. PLEATHE H.L.P."
*this += "[QUOTETH]THEX[/QUOTETH]"


Quote:
Originally Posted by gunman121 View Post
I do indeed know about pointers, I don't quite understand why I would use them in this case.. It seems very unnessessary for a simple concenpt that I'm doing. But thanks. I guess I'll change it up.
Just...what? The library that you're working with uses pointers for pretty much everything.
If you really don't know how the library works , seriously , its a serious issue.

BTW,Its common sense , BUT , that preload function will load every single month picture into memory and you don't want that but the active month.

AND,what kind of calendar application is this without dynamic content?..........
Reply With Quote
Reply

 



Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 07:25 PM.


Powered by vBulletin® Version 3.8.4
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
©