No, I decompressed it... A 585kb file, and when I highlight it, it says "Type: File"... So what do I do, thanksZitat:
Zitat von OmahaStylee
Printable View
No, I decompressed it... A 585kb file, and when I highlight it, it says "Type: File"... So what do I do, thanksZitat:
Zitat von OmahaStylee
I have a problem when I try to compile my code:
Heres my program:Code:[email protected] ~
$ cd projects/addition
[email protected] ~/projects/addition
$ make
psp-gcc -I. -I/usr/local/pspdev/psp/sdk/include -G0 -Wall -I/usr/local/pspdev/ps
p/sdk/include -c -o main.o main.c
main.c: In function 'main':
main.c:236: error: syntax error at end of input
make: *** [main.o] Error 1
The line its talking about is the last one.
When I try to replace the } it still shows up as an error?
I dont think my makefile is a problem but here it is:Code:// Math Prog
/*
This program is a simple multiplication program
*/
// Include all the required files.
#include <pspkernel.h>
#include <pspdebug.h>
#include <pspctrl.h>
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
/* Give your program a name */
PSP_MODULE_INFO("Math Prog", 0, 1, 1);
#define printf pspDebugScreenPrintf
// Essential stuff
// Exit callback
int exit_callback(int arg1, int arg2, void *common) {
sceKernelExitGame();
return 0;
}
/* Callback thread */
int CallbackThread(SceSize args, void *argp) {
int cbid;
cbid = sceKernelCreateCallback("Exit Callback", exit_callback, NULL);
sceKernelRegisterExitCallback(cbid);
sceKernelSleepThreadCB();
return 0;
}
/* Sets up the callback thread and returns its thread id */
int SetupCallbacks(void) {
int thid = 0;
thid = sceKernelCreateThread("update_thread", CallbackThread, 0x11, 0xFA0, 0, 0);
if(thid >= 0) {
sceKernelStartThread(thid, 0, 0);
}
return thid;
}
// Main Code, this is where your program is
int main(void)
{
SceCtrlData pad;
// Set up variables
int var1 = 0;
int status = 0;
int var2 = 0;
int var3 = 0;
int var4 = 0;
pspDebugScreenInit();
// Activate the controls
SetupCallbacks();
sceCtrlSetSamplingCycle(0);
sceCtrlSetSamplingMode(PSP_CTRL_MODE_ANALOG);
while (1){
// Set it up to read the Controls
sceCtrlReadBufferPositive(&pad, 1);
//Text you want to display
printf("The cheap calculator on your $250 PSP!\n");
printf("Try any of the 8 main keys to set numbers.\n");
printf("Try combinations of buttons.\n");
if (status == 0) {
// Position the instructions
pspDebugScreenSetXY(0, 4);
printf("Set the first number with the L button.\n");
/* Use %4i to pad the number guessed so no junk
is left behind when it changes digit length */
printf("Your number is... %7i", var1);
// Increase number by 1 when pressing up
if (pad.Buttons & PSP_CTRL_UP) {
var1++;}
// Decrease number by 1 when pressing down
if (pad.Buttons & PSP_CTRL_DOWN) {
var1--;}
// Decrease number by 10 if left is pressed
if (pad.Buttons & PSP_CTRL_LEFT) {
var1 -= 10;}
// Increase number by 10 if rights is pressed
if (pad.Buttons & PSP_CTRL_RIGHT) {
var1 += 10;}
// Increase number by 1000 if circle is pressed
if (pad.Buttons & PSP_CTRL_CIRCLE) {
var1 += 1000;}
// Increase number by 100 if triangle is pressed
if (pad.Buttons & PSP_CTRL_TRIANGLE) {
var1 += 100;}
// Decrease number by 1000 if square is pressed
if (pad.Buttons & PSP_CTRL_SQUARE) {
var1 -= 1000;}
// Decrease number by 100 if Cross is pressed
if (pad.Buttons & PSP_CTRL_CROSS){
var1 -= 100;}
// Finishes up the number
if (pad.Buttons & PSP_CTRL_LTRIGGER) {
status++;}
// End first number
}
if (status == 1) {
// Position the instructions
pspDebugScreenSetXY(0, 7);
printf("Set the second number with the R button.\n");
// Position the text that tells us our guess
pspDebugScreenSetXY(2, 8);
/* Use %4i to pad the number guessed so no junk
is left behind when it changes digit length */
printf("Your number is... %7i", var2);
// Increase number by 1 when pressing up
if (pad.Buttons & PSP_CTRL_UP) {
var2++;}
// Decrease number by 1 when pressing down
if (pad.Buttons & PSP_CTRL_DOWN) {
var2--;}
// Decrease number by 10 if left is pressed
if (pad.Buttons & PSP_CTRL_LEFT) {
var2 -= 10;}
// Increase number by 10 if rights is pressed
if (pad.Buttons & PSP_CTRL_RIGHT) {
var2 += 10;}
// Increase number by 1000 if circle is pressed
if (pad.Buttons & PSP_CTRL_CIRCLE) {
var2 += 1000;}
// Increase number by 100 if triangle is pressed
if (pad.Buttons & PSP_CTRL_TRIANGLE) {
var2 += 100;}
// Decrease number by 1000 if square is pressed
if (pad.Buttons & PSP_CTRL_SQUARE) {
var2 -= 1000;}
// Decrease number by 100 if Cross is pressed
if (pad.Buttons & PSP_CTRL_CROSS){
var2 -= 100;}
// Get the product and exit
if (pad.Buttons & PSP_CTRL_RTRIGGER) {
status++;}
// End second number
}
while (2){
// Set it up to read the Controls
sceCtrlReadBufferPositive(&pad, 1);
if (status == 0) {
// Position the instructions
pspDebugScreenSetXY(0, 4);
printf("Set the third number with the L button.\n");
/* Use %4i to pad the number guessed so no junk
is left behind when it changes digit length */
printf("Your number is... %7i", var1);
// Increase number by 1 when pressing up
if (pad.Buttons & PSP_CTRL_UP) {
var3++;}
// Decrease number by 1 when pressing down
if (pad.Buttons & PSP_CTRL_DOWN) {
var3--;}
// Decrease number by 10 if left is pressed
if (pad.Buttons & PSP_CTRL_LEFT) {
var3 -= 10;}
// Increase number by 10 if rights is pressed
if (pad.Buttons & PSP_CTRL_RIGHT) {
var3 += 10;}
// Increase number by 1000 if circle is pressed
if (pad.Buttons & PSP_CTRL_CIRCLE) {
var3 += 1000;}
// Increase number by 100 if triangle is pressed
if (pad.Buttons & PSP_CTRL_TRIANGLE) {
var3 += 100;}
// Decrease number by 1000 if square is pressed
if (pad.Buttons & PSP_CTRL_SQUARE) {
var3 -= 1000;}
// Decrease number by 100 if Cross is pressed
if (pad.Buttons & PSP_CTRL_CROSS){
var3 -= 100;}
// Finishes up the number
if (pad.Buttons & PSP_CTRL_LTRIGGER) {
status++;}
// End third number
}
if (status == 1) {
// Position the instructions
pspDebugScreenSetXY(0, 7);
printf("Set the fourth number with the R button.\n");
// Position the text that tells us our guess
pspDebugScreenSetXY(2, 8);
/* Use %4i to pad the number guessed so no junk
is left behind when it changes digit length */
printf("Your number is... %7i", var2);
// Increase number by 1 when pressing up
if (pad.Buttons & PSP_CTRL_UP) {
var4++;}
// Decrease number by 1 when pressing down
if (pad.Buttons & PSP_CTRL_DOWN) {
var4--;}
// Decrease number by 10 if left is pressed
if (pad.Buttons & PSP_CTRL_LEFT) {
var4 -= 10;}
// Increase number by 10 if rights is pressed
if (pad.Buttons & PSP_CTRL_RIGHT) {
var4 += 10;}
// Increase number by 1000 if circle is pressed
if (pad.Buttons & PSP_CTRL_CIRCLE) {
var4 += 1000;}
// Increase number by 100 if triangle is pressed
if (pad.Buttons & PSP_CTRL_TRIANGLE) {
var4 += 100;}
// Decrease number by 1000 if square is pressed
if (pad.Buttons & PSP_CTRL_SQUARE) {
var4 -= 1000;}
// Decrease number by 100 if Cross is pressed
if (pad.Buttons & PSP_CTRL_CROSS){
var4 -= 100;}
// Get the product and exit
if (pad.Buttons & PSP_CTRL_RTRIGGER) {
status++;}
// End fourth number
}
// Position the product and exit instructions
pspDebugScreenSetXY(0, 10);
if (status == 2) {
//Display your end text here
printf("The sum of the two numbers is %28i.\n", var1+var2+var3+var4);
printf("Your psp has done simple addition!\n");
printf("Exit how you would any other game.\n");
// Pause the game and wait for the home button to be used to exit
sceKernelSleepThread();
}
}
sceKernelExitGame();
return 0;
}
Is it that my program is too long? Any help is apreciated.Code:TARGET = Add
OBJS = main.o
CFLAGS = -G0 -Wall -I$(PSPSDK)/include
CXXFLAGS = $(CFLAGS) -fno-exceptions -fno-rtti
ASFLAGS = $(FLAGS)
EXTRA_TARGETS = EBOOT.PBP
PSP_EBOOT_TITLE = Addition Prog.
PSPSDK =$(shell psp-config --pspsdk-path)
include $(PSPSDK)/lib/build.mak
It's not too long ;)
I think maybe you forgot to close something. Try putting a "}" right before the SceKernelExitGame and see if that works :-\
while (2){
// Set it up to read the Controls
sceCtrlReadBufferPositive (&pad, 1);
if (
isnt that impossible?
since saying while (1){} is saying while true. and while(0) is like saying while false...?
Zitat:
Zitat von GTA3Rockstar
^^^^^
Omaha, I'm not sure about C, but in every other programming language I've used, anything above 0 evaluates to true (and possibly negative numbers too but I'm not sure on that).
It worked now, must have left something open.Zitat:
Zitat von Yeldarb
Thanks
I reinstalled CYGWIN but now there's no home folder. What do I do?
Everytime I try to run the toolchain.sh file I go for about an hour then get the error:
./toolchain.sh: line 239: cd: pspsdk: No such file or directory
./toolchain.sh: line 242: ./bootstrap: No such file or directory
ERROR RUNNING PSPSDK BOOTSTRAP
I did a search in the forums and on the 'net for this error but can't find a solution. Any ideas?
If you start up Cygwin you should normally have one created automatically with your username in it.Zitat:
Zitat von grampastumpy
Two questions:Zitat:
Zitat von GTA3Rockstar
1. how did you decompress it?
I decompressed it originally using winrar, but although a file was extracted, it wasn't a valid one. I had to use
tar xvfg psptoolchain-20050801.tar.gz
to get it to work.
2. if you did decompress it correctly, you should have a folder as a result. I thought it was called psptoolchain without an extention, but maybe it is called psptoolchain-20050801, and you have to do:
cd psptoolchain-20050801
sh toolchain.sh
to start the toolchain.
Well, under WinXP, there is no /home/user dir created. The default user directory when you start cygwin is C:\Documents and Settings\user.Zitat:
Zitat von Arwin
You can change it by setting the HOME variable.
Edit the .bat file and add SET HOME=C:\cygwin\home\user
Really? I never noticed that. I use Windows XP SP2 myself, on two machines, and I'm sure I've never created a home dir.Zitat:
Zitat von Ezeckiel
Thanks guys. The home folder's there now. Now to see if there's any errors...
That really depend how cygwin generate the etc/passwd file.Zitat:
Zitat von Arwin
Open up that file and look for a line beginning with your user name.
Fields on the line are separated by a colon ie :
Now look at the second field from end, it is your root path.
if it says /cygdrive/c/Documents and Settings/user then change it for /home/user.
Now you should have C:\cygwin\home\user as root
I'm stuck on that error too.Zitat:
Zitat von alben5k
It seem that subversion failed to get pspsdk. I tried that command :
svn checkout svn://svn.pspdev.org/psp/trunk/pspsdk
and got that error :
svn: Can't connect to host 'svn.pspdev.org' : Connection refused
Can someone help? maybe someone can post a zip containing all pspsdk files.
Thx
You need to have the pspsdk installed in your root. I think maybe you don't have it installed in c:\pspdev?Zitat:
Zitat von Ezeckiel
Well, i can't get the source because a firewall block the port. I do not have access to the firewall so i cannot changed it settings.Zitat:
Zitat von Arwin
Do someone knows if the pspdev subversion server can be accessed via http ?
something like 'svn checkout http://svn.pspdev.org/psp/trunk/pspsdk' ?
How would you change the font and how would you change it's size?
I dont think its possible with the debug screen (the one used in all these tuts), but it might be in one of the other print functions. If not, just look at the source for any program that does.Zitat:
Zitat von MagicianFB
cool but "hello world " thing is kinda old
I will own j00 my 100th post! :DJ:
Is there a way that you can delete all prior words on the screen yet still display text. I don't want to:An example area where you would use it:Code:sceKernelSleepThread();
Sorry if this is posted earlier, hard to skim through 45 pages worth.Code:int main(void)
{
SceCtrlData pad;
int status = 0;
pspDebugScreenInit();
SetupCallbacks();
sceCtrlSetSamplingCycle(0);
sceCtrlSetSamplingMode(PSP_CTRL_MODE_ANALOG);
while (1){
sceCtrlReadBufferPositive(&pad, 1);
if (status == 0) {
pspDebugScreenSetXY(0, 3);
printf("Press circle to turn left.\n");
// They turned left. Move to status 1
if (pad.Buttons & PSP_CTRL_CIRCLE) {
status--;}
}
if (status == 1) {
/* Here is where you would need to delete prior
text, but it flashes constantly. I dont want to add
a sleep thread because I want to be able to move on
to next area. Thanks for any help
*/
pspDebugScreenSetXY(0, 1);
printf("Press cross to turn right.\n");
// They turned right. Move to status 2
if (pad.Buttons & PSP_CTRL_SQUARE) {
status++;}
}
It's in tutorial 3: pspDebugScreenClear();
Sorry I didn't make it clear that I was using that already.Zitat:
Zitat von Yeldarb
When I put that in it makes the text flicker as if it keeps clearing the screen then loading the text over and over again.
Is there an option where you can make it only clear once?
Don't refresh the text unless you need it changed (put in a "changed" variable and only do your if statements if that changed variable is equal to one -- set it to 0 when you update and 1 when the text needs to be changed)
Sorry, but its noob time.Zitat:
Zitat von Yeldarb
Could you show an example of this in code form?
Thanks a lot.
Sorry, don't have time to write code, but here's some psuedo code :P
Hope that makes it more clear.Code://Your other code Up Here (initializing etc)
int changed=1;
while(1) {
//Read Button Input
if(Pad.Buttons & whatever) {
changed=1;
//your other code if "whatever" was pressed
}
if(changed) {
changed=0;
//Your if statements here
}
}
:clap:Zitat:
Zitat von Yeldarb
Thanks that did make it clearer.
Ahhhhhhhh...I was wondering that too. Thanks.
I've been encountering an error in the process of installing. I have completely followed every direction perfectly. However, after i run toolchain.sh I get an error while it's compiling. I have attatched a screenshot of the error, I would really appreciate any help someone could give me.
jazazel - I'm not sure, but try changing 4.0.1 to 4.0.0, run toolchain.sh again and see if it works.
Ok, i tried using 4.0.0 . I get the same error as posted before. The only thing different is that it displays "Checked out revision 976." instead of 972
How long does it go before it displays that?
I type "ls" and get "psptoolchain". Then I type "cd psptoolchain" and get ~/psptoolchain" next to my user name. Then when I type "ls" again nothing comes up. I tried typing "cd ./toolchain.sh" and get "bash: cd: ./psptoolchain.sh: No such file or directory. Little help?
I got passed the ERROR CONFIGURING BINUTILS, but now I get this ERROR BUuILDING GCC... I'm using XP btw
after installing cygwin and downloading binutils , gcc, and newlib. and after showing it running through the pspsdk files it displays that. I'm running XP SP1 btw.
I got that too the first time; turned out that was because I extracted it using winrar, rather than tar -xvfg toolchain.tar from cygwin.Zitat:
Zitat von Jon Doe
Quick question.
When writing a bunch of one line if statements, could you do it without the brackets? Just for the sake of organization.
Thanks all.Code:if(whatever) do_me=1
if(whatever) do_me=2
I think you can do that but don't forget the semi-colon in this case.
You are talking about the semi-colon for defining do_me right?