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

Notices

Reply
 
Thread Tools Display Modes
  #21  
Old 01-14-2007, 04:07 AM
PSdonkey's Avatar
PSdonkey PSdonkey is offline
Squirrel Admin
PSP Titan
 
Join Date: Mar 2006
Posts: 9,117
PSdonkey has a reputation beyond reputePSdonkey has a reputation beyond reputePSdonkey has a reputation beyond reputePSdonkey has a reputation beyond reputePSdonkey has a reputation beyond reputePSdonkey has a reputation beyond reputePSdonkey has a reputation beyond reputePSdonkey has a reputation beyond reputePSdonkey has a reputation beyond reputePSdonkey has a reputation beyond reputePSdonkey has a reputation beyond repute
Default

ok, I played your game killaj and I see what you were talking about. It wouldn't let you input the number square that you wanted to place your X or your O because it would jump to fast the numbers if you slightly touch the up or down button or the R trigger. I fix the bugs and now your program works good. I uploaded it for you and included the modified source. Basically what I did is add this function
sceDisplayWaitVblankStart(); after each time the button is pressed and added it inside a for loop so it would pause for a certain amount of time after the button was pushed. Everything flows smooth now.
What that function does is it waits until the vsynch gets called to the os. Its tied into the screen refresh rate, the PSP refreshes 60 times a second.
Overall, you did a really god job of porting that game over to the PSP. Good job.
Here is the link:

http://www.mediafire.com/?9nxdyyjydg3
__________________
Want to become a PSP Dev the easy way? Check out my tutorial for the PSP here www.psp-hacks.com/forums/viewtopic.php?id=65403
Want to learn how to create your own games on the PSP? Check out my tutorial here http://www.psp-hacks.com/forums/view...693884#p693884
Want to learn how to program C++ ? Check out that tutorial here www.psp-hacks.com/forums/viewtopic.php?id=28694
Reply With Quote
  #22  
Old 01-14-2007, 01:09 PM
nobugging nobugging is offline
PSP Newbie
 
Join Date: Jan 2007
Posts: 47
nobugging User Has a Beginner Reputation
Default

Quote:
Originally Posted by ZiNgABuRgA
^^IDK, perhaps have two loops? Eg, one to wait for the button to be pressed, then, another one to wait till it's released?
The problem with this method is that it stops the game logic loop while the button is held. While it isn't problematic for this tye of turn based game, it will pose a problem with other types of games. This problem also exists with PSdonkey's method of using sceDisplayWaitVblankStart() to 'pause' the game logic.

A better solution is to keep track of the previous state of the pad and compare it with the current state. Then you can simply use this pseudo code to check for a distinct button press.

Code:
if button is pressed down now but was not pressed down last frame then
    do some stuff
end
Or the actual (stripped) code
Code:
SceCtrlData currentPadState, previousPadState;
while( 1 )
{
    // At the top of the loop
    sceCtrlReadBufferPositive(&currentPadState, 1);

    // Check for a button press
    if( currentPadState.Buttons & PSP_CTRL_UP && 0 == previousPadState.Buttons & PSP_CTRL_UP )
    {
        // Do some stuff
    }

    // At the bottom of the loop
    previousPadState = currentPadState;
    sceDisplayWaitVblankStart();
}
Reply With Quote
  #23  
Old 01-14-2007, 01:54 PM
PSdonkey's Avatar
PSdonkey PSdonkey is offline
Squirrel Admin
PSP Titan
 
Join Date: Mar 2006
Posts: 9,117
PSdonkey has a reputation beyond reputePSdonkey has a reputation beyond reputePSdonkey has a reputation beyond reputePSdonkey has a reputation beyond reputePSdonkey has a reputation beyond reputePSdonkey has a reputation beyond reputePSdonkey has a reputation beyond reputePSdonkey has a reputation beyond reputePSdonkey has a reputation beyond reputePSdonkey has a reputation beyond reputePSdonkey has a reputation beyond repute
Default

Your code does the exact same end result as my code but I kept mine a little bit simplier since this is a beginner's game and lesson. Plus with my code you can actually control how much time passes between each button press to conform to each individual program. There is nothing wrong with your code, there are just different ways to code and get the same end result.
__________________
Want to become a PSP Dev the easy way? Check out my tutorial for the PSP here www.psp-hacks.com/forums/viewtopic.php?id=65403
Want to learn how to create your own games on the PSP? Check out my tutorial here http://www.psp-hacks.com/forums/view...693884#p693884
Want to learn how to program C++ ? Check out that tutorial here www.psp-hacks.com/forums/viewtopic.php?id=28694
Reply With Quote
  #24  
Old 01-14-2007, 02:50 PM
killaj killaj is offline
Moderator
PSP Titan
 
Join Date: Nov 2005
Location: Daytona Beach Rank:Fuck Rank
Posts: 12,849
killaj is on a distinguished road
Default

thanks nobugging. i'm still learning what kinds of functions the psp has built in. that's a new one.
__________________
Reply With Quote
  #25  
Old 01-14-2007, 05:00 PM
itsalldasame2me itsalldasame2me is offline
PSP Enthusiast
 
Join Date: Mar 2006
Location: California
Posts: 346
itsalldasame2me User Has a Beginner Reputation
Default

Ok I'm having a bit of a problem. I downloaded the installer and installed everything correctly. then i edited the pspdev.bat like the tutorial said. but when i double click on it a box pops up that says "C:\WINDOWS\system32\cmd.com is not a valid win32 application" I don't know what im doing wrong. I followed everything correctly. Please help.
__________________
Reply With Quote
  #26  
Old 01-14-2007, 05:55 PM
killaj killaj is offline
Moderator
PSP Titan
 
Join Date: Nov 2005
Location: Daytona Beach Rank:Fuck Rank
Posts: 12,849
killaj is on a distinguished road
Default

take the .com off.
__________________
Reply With Quote
  #27  
Old 01-14-2007, 06:33 PM
ZiNgABuRgA's Avatar
ZiNgABuRgA ZiNgABuRgA is offline
Moderator
PSP Titan
 
Join Date: Sep 2006
Location: 4CHIN
Posts: 10,455
ZiNgABuRgA can only hope to improve
Default

O_o, that reminds me of a virus (which I installed on purpose). It makes a whole load of .com files to trick the computer into loading them (ie cmd.com, so when you specify "cmd" it launches the .com file instead of the .exe)
Reply With Quote
  #28  
Old 01-14-2007, 08:42 PM
nobugging nobugging is offline
PSP Newbie
 
Join Date: Jan 2007
Posts: 47
nobugging User Has a Beginner Reputation
Default

Quote:
Originally Posted by PSdonkey
Your code does the exact same end result as my code but I kept mine a little bit simplier since this is a beginner's game and lesson. Plus with my code you can actually control how much time passes between each button press to conform to each individual program. There is nothing wrong with your code, there are just different ways to code and get the same end result.
I disagree, as mentioned, your code stops game logic for a sixth of a second which wrecks havok in a an action game of some sort. It will run at ~60 fps and when you shoot for example, there is a lapse/lag in game speed since you just paused the game logic for a sixth of a second. If you want you want to control how much time passes between each button press, then use an independent timer or counter that doesn't affect the frequency (number of loops per second) for the main game logic.

Your code does work as intended without any adverse effects as it is a turn based game but there are bad side effects that were not mentioned and not visible in this program.

Quote:
Originally Posted by killaj
thanks nobugging. i'm still learning what kinds of functions the psp has built in. that's a new one.
It really isn't a function, more of a concept or just logic. Do you actually fully understand what this line of code does?
Code:
currentPadState.Buttons & PSP_CTRL_UP
Reply With Quote
  #29  
Old 01-14-2007, 09:04 PM
ZiNgABuRgA's Avatar
ZiNgABuRgA ZiNgABuRgA is offline
Moderator
PSP Titan
 
Join Date: Sep 2006
Location: 4CHIN
Posts: 10,455
ZiNgABuRgA can only hope to improve
Default

@nobugging: Stopping the game is actually the purpose here. This isn't an action game, so using an independent timer is just making things overly complex, and unnecessary.

In either case, using an independent timer, the game would still have to freeze, so it's completely pointless in this case.
Reply With Quote
  #30  
Old 01-14-2007, 09:19 PM
PSdonkey's Avatar
PSdonkey PSdonkey is offline
Squirrel Admin
PSP Titan
 
Join Date: Mar 2006
Posts: 9,117
PSdonkey has a reputation beyond reputePSdonkey has a reputation beyond reputePSdonkey has a reputation beyond reputePSdonkey has a reputation beyond reputePSdonkey has a reputation beyond reputePSdonkey has a reputation beyond reputePSdonkey has a reputation beyond reputePSdonkey has a reputation beyond reputePSdonkey has a reputation beyond reputePSdonkey has a reputation beyond reputePSdonkey has a reputation beyond repute
Default

I was just about to say the same things Zingaburga. There are a million ways of coding to end up with the same result. What Zingaburga suggested and my code are not wrong, nobugging. My code works just fine to get the desired results that killaj was looking for. IF you actually played the game, nobugging, you would see that for yourself. There are probably over a hundred different ways to display helloworld on your psp. None of them would be wrong. If you want to talk about "Correct" code, nobugging, then the "Correct" code would be the simplest and fastest code to get your desired result. If that was the case, then my code and what zingaburga suggested would be the "correct" code as you would say.



@itsalldasame2me, yeah do what Zingaburga suggested and scan your computer for viruses. That might solve the problem. Post if it doesn't and then i'll look more into it for you.
__________________
Want to become a PSP Dev the easy way? Check out my tutorial for the PSP here www.psp-hacks.com/forums/viewtopic.php?id=65403
Want to learn how to create your own games on the PSP? Check out my tutorial here http://www.psp-hacks.com/forums/view...693884#p693884
Want to learn how to program C++ ? Check out that tutorial here www.psp-hacks.com/forums/viewtopic.php?id=28694
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 10:55 PM.


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