I' wud better stick to PSP GU tut's than that!Zitat:
Zitat von yaustar
Any other links?
Printable View
I' wud better stick to PSP GU tut's than that!Zitat:
Zitat von yaustar
Any other links?
3D is generally 3D no matter which API you use. The only other decent ones are the GU version of the Nehe tutorials found at psp-programming which you found too hard.Zitat:
Zitat von Mr305
http://www.psp-programming.com/code/...id=c:tutorials
You can try reading the OpenGL RedBook:
http://fly.cc.fer.hr/~unreal/theredbook/
Hey,
I need some help with my program. To put it simple, i made a timer to allow some credit screens to apprear in my loop. For every screen that appears, i want a different music sound effect to play once. Here is my code (i know i completely messed up, but i can't think of how i can make it possible). Right now, the mp3 just repeats itself while i display my first image. Anyways, here is my code:
Code:int credits()
{
int showTime = 0;
Font* myfont1 = Font_Load("./files/Fonts/VERA.TTF");
Font_SetSize(myfont1, 14);
Font* myfont2 = Font_Load("./files/Fonts/REN_STIM.TTF");
Font_SetSize(myfont2, 15);
Font* myfont3 = Font_Load("./files/Fonts/VERA.TTF");
Font_SetSize(myfont3, 20);
Image* credits;
Image* credits2;
Image* credits3;
credits = loadImage("./files/images/superbatxs.png");
credits2 = loadImage("./files/images/bubbles.png");
credits3 = loadImage("./files/images/superbat.png");
MP3_Load("./files/sounds/comet1.mp3");
MP3_Play();
while(1) {
for (;;) {
showTime++;
if (showTime < 240) { // EVERY 60 IS A SECOND //
blitAlphaImageToScreen(0, 0 , 480, 272, credits, 0, 0);
Font_PrintScreen(myfont3, 135, 125, "SuperbatXS presents...", GU_RGBA(0, 100, 0, 255), getVramDrawBuffer());
flipScreen();
}
}
if (MP3_EndOfStream() == 1) {
MP3_Stop();
break;
}
}
MP3_Stop();
MP3_FreeTune();
for (;;) {
showTime++;
if (showTime < 240) { // EVERY 60 IS A SECOND //
blitAlphaImageToScreen(0, 0 , 480, 272, credits, 0, 0);
Font_PrintScreen(myfont3, 135, 125, "SuperbatXS presents...", GU_RGBA(0, 100, 0, 255), getVramDrawBuffer());
flipScreen();
}
if ((showTime > 240 && showTime < 480)) { // EVERY 60 IS A SECOND //
blitAlphaImageToScreen(0, 0 , 480, 272, credits2, 0, 0);
Font_PrintScreen(myfont2, 2, 10, "A shell developed for full homebrew", GU_RGBA(0, 0, 255, 255), getVramDrawBuffer());
Font_PrintScreen(myfont2, 10, 25, "gaming and media experience...", GU_RGBA(0, 0, 255, 255), getVramDrawBuffer());
flipScreen();
}
if ((showTime > 480 && showTime < 850)){ // EVERY 60 IS A SECOND //
blitAlphaImageToScreen(0, 0 , 480, 272, credits3, 0, 0);
Font_PrintScreen(myfont3, 185, 145, "G-Pack", GU_RGBA(0, 0, 255, 255), getVramDrawBuffer());
Font_PrintScreen(myfont3, 267, 145, "v.3", GU_RGBA(255, 215, 0, 255), getVramDrawBuffer());
Font_PrintScreen(myfont2, 20, 200, "Now a completely new experience...", GU_RGBA(255, 239, 219, 255), getVramDrawBuffer());
Font_PrintScreen(myfont1, 2, 225, "Plug in your headphones now for full sound experience!", GU_RGBA(255, 69, 0, 255), getVramDrawBuffer());
flipScreen();
}
if (showTime >= 850) {
appmain();
}
}
}
Im too busy to read through it all thoroughly, but i can see where you problem loop is, along with another problem loop youd have after fixing hte first:
bold = problem loop
underline bold = future problem loop
Zitat:
Zitat von Code
Lol, that's obvious. But, i want to load the different music files for each loading screen. For example, my first loading screen blits while playing the music, when the music ends, the next loading screen blits and the next music begins along with it. Now, each of my music file also has a different length.Zitat:
Zitat von SG57
superbatx, I suggest that you indent. It helps in several ways. It make your source readable, and it allows you to see these kinds of errors easier.
I suggest you use a program called Astyle. It automatically formats your source to be indented in different styles such ANSI, K&R, GNU, etc... It is built in to Code::Blocks.
I also suggest DevC++ due to the fact that it auto indents and other stuff ;p
Look at post #3563. I already indented. SG57 just quoted it without the indents i put. Also, some of the indents i put in that post aren't the way they are.Zitat:
Zitat von Moca
I need some help with 4th brightness. Here is my code:
I am obviously not using the right functions or the right values. What is the code i need to use if i want to set the 4th brightness?Code:void sceDisplay_driver_9E3C6DC6(int 100,int 0);//a0 0-100,a1 = 0/1 (set to 0)
#define sceDisplaySetBrightness sceDisplay_driver_9E3C6DC6
void sceDisplay_driver_31C4BAA8(int *100,int *0);
#define sceDisplayGetBrightness sceDisplay_driver_31C4BAA8
//later in main loop
if (pad.Buttons & PSP_CTRL_LTRIGGER){
sceDisplayGetBrightness(int *100, int *0) //to get brightness, and
sceDisplaySetBrightness(int 100, int 0) //to set brightness
}
Well I can't help you with the brightness thing but this might give you problems later on...
that looks like a standard pad hold, do you plan to make it so it Cycles through the brightness levels with the L trigger? if so than I would use the "new_pad" or "old_pad" trick, (what ever ya want to call it) so that it waits for you to lift up the button and press it down again before it changes, other wise it will cycle through really really fast. But if thats not the case than just ignore this post :PCode:if (pad.Buttons & PSP_CTRL_LTRIGGER){
I'd rather use this:Zitat:
Zitat von BlackShark
Code:if(pad.Buttons & PSP_BUTTON_SOMEBUTTON)
{
// do your ****
function();
while(pad.Buttons & PSP_BUTTON_SOMEBUTTON)
{
sceCtrlPeekBufferPositive(&pad, 1);
}
}
Guys.......i didn't post the buttons LTrigger part for asking if i need to use oldpad or not. I just did it to show the general function. I only need to test the 4th brightness, and get it working. I have enough knowledge to know about oldpad. So, i just need someone to help me with the brightness code, and not the controls code.
For oldpad, I do this:
keysPressed will now give you all the keys that have just been pressed. It's simple and efficient.Code:unsigned long keysPressed = (currentPad.Buttons ^ oldPad.Button) & currentPad.Buttons ;
By the way, what's "int *100" supposed to do?
Let me quote this again. For the last time, I AM NOT ASKING FOR OLDPAD OR THE CONTROLS FOR BRIGHTNESS, BUT THE FUNCTION FOR THE BRIGHTNESS. HOW IS THAT HARD TO UNDERSTAND?Zitat:
Zitat von Xylem
Where the hell are you getting this code from?Code:void sceDisplay_driver_9E3C6DC6(int 100,int 0);//a0 0-100,a1 = 0/1 (set to 0)
#define sceDisplaySetBrightness sceDisplay_driver_9E3C6DC6
void sceDisplay_driver_31C4BAA8(int *100,int *0);
#define sceDisplayGetBrightness sceDisplay_driver_31C4BAA8
Zitat:
Zitat von Xylem
Why is that so hard to understand?Code:if(pad.Buttons & PSP_CTRL_LTRIGGER) {
sceDisplaySetBrightness(100,0);
}
How do you set the psp debug text to a different size? / is there a way?
Thank you
No.Zitat:
Zitat von BlackShark
Hey,
Listen guys, i am very sorry about my behavior earlier. I was just pretty angry because of the bad grade at school, and i was very sensitive about that (lol, it turned out to be someone else's grade.....teacher made a mistake). Anyways, my point is that my behavior was really bad, and i was being really rude (especially to Yaustar and Access_Denied, who have helped me a lot the past days in coding). Just like to say sorry. :(
Also, i have one last question. Here is the code:
In that code, what do i need to change to make it work? Do i change the a0 to 100 and a1 to 0? Or do i leave that, but put the 100 and 0 in the set part like i did?Code:void sceDisplay_driver_9E3C6DC6(int a0,int a1);//a0 0-100,a1 = 0/1 (set to 0)
#define sceDisplaySetBrightness sceDisplay_driver_9E3C6DC6
//later in main loop controls
if(pad.Buttons & PSP_CTRL_LTRIGGER) {
sceDisplaySetBrightness(100,0);
}
Hey, i need help with I/O functions. Right now, i am optimizing the code for the G-Pack and trying to make it look more organized and look clean. I need to put all my settings in one file. I know how to read X to Y bytes, but i don't know how to write from X to Y bytes. If anyone could explain or give me the code, then i can understand and learn it. Thanks.
fprintf(FILE *stream, const char * format, ...);
ftw...
Lol, i have no idea what you are saying....if you could give me an example code, i can understand it better. Btw, here is the code for reading the 6th to the 7th character in my g-pack:Zitat:
Zitat von SG57
It reads the 6th to the 7th character (being the 7th character- 9999991 or 9999990). I know how to read it, but how do you write. I had another question about that, why do you need a [2] after the variables i declared. Whenever i put another number in the [-], the program doesn't work...Code:char x[7];
char variable[2] = "0";
char variable1[2] = "1";
FILE *credit;
if ((credit = fopen("./files/credit.txt","rb")) == NULL)
{
printf("There is nothing in this file");
}
x[fread(x, 1, 7, credit)] = 0;
fclose(credit);
x[7]=0;
if(strcmp (variable,x+6) == 0)
{
appmain();
}
if(strcmp (variable1,x+6) == 0)
{
credits();
}
Example code using fprintfZitat:
Zitat von superbatxs
Code:char text[12] = "Hello World";
FILE *d;
if ((d = fopen("ms0:/test.txt", "a+b")) == NULL)
{
printf("Dest. file could not be opened for writing");
fclose(d);
return -1;
}
fprintf(d,"Just like printf but prints to file instead of screen. BTW, %s", text);
fclose(d);
super - You need to learn to use your resources more effectively... A quick google search will give you something similar to what Moca posted.
Yea, but............what about using it to print numbers instead of letters, or printing to a X to Y position. How come this doesn't work:Zitat:
Zitat von Moca
I am trying to write something in to the 7th character in a file.Code:char x[7];
char variable1[2] = "0";
credit = fopen ( "./files/credit2.txt" , "wb" );
x[7]=0;
fprintf (credit, x+6, variable1);
fclose (credit);
:|Zitat:
Zitat von superbatxs
INSTEAD OF PRINTING TO THE SCREEN IT PRINTS TO A FILE... Do you know how to use printf :|
or...Code:fprintf(credit,"x + 6 = %d \n variable1 = %d",x+6,variable1);
btw, if you want to write to an offset,Code:sprintf(text,"x + 6 = %d \n variable1 = %d",x+6,variable1);
fprintf(credit,text);
fseek(credit,offset,SEEK_ SET);
This goes to the offset that you want. Then write what you want from there.
ok, ive asked this before and it was answered so kindly by SG57, but I could not find it again, I searched for at least an hour (not exaggerated) on this thread and could not find it so, (very sorry) but here it goes.
How do I find the last 4 characters of a file (using a filebrowser)? like how would you tell if a file is an .mp3 ?
Thank you, and sorry for asking that twice.
The first thing that comes to mind is fread + strcmp :p
fseek(file,-4,SEEK_END); // Seeks -4 bytes from the end of the file
Then read the four bytes with fread and store it in a string. Compare the string with "mp3" and if strcmp returns 0, they are equal.
btw, i guess you could read the header of every file in a directory then work from there.
Lol, believe it or not, i was asking you guys the wrong question. Sorry for all the trouble. What i actually wanted to do was write only one character in a certain place in a file (like write a 0 instead of 6 in "1234567", etc.). I learned that you need SEEK_END to set the origin where you need to replace the character. I know how to do it now, but sorry for asking you guys the wrong question. I myself was confused, and probably made you guys confused as well. :oZitat:
Zitat von Moca
Check out the functions on this page, they will greatly help you.Zitat:
Zitat von superbatxs
http://www.psp-programming.com/code/...id=c:functions
Yep, your sig is huge. Seriously, i am going to post the code in the C examples thread to help other people who need help with writing blocks of data from X to Y bytes. I got mine to work now. Hint: the origin should be changed, and same for where you want to stop (example- SEEK_END).Zitat:
Zitat von Access_Denied
what does that mean:Code:PSP_USB_CONNECTION_ESTABLISHED
that at the moment a file is transfering to psp?
or that the psp is connected to pc?
I think it's that the psp is connected to the pc.Zitat:
Zitat von hallo007
oke
does anyone know wich byte of the return is for currently transfering , or doesnt it returns that info?Code:sceUsbGetState(void);
Ok, i was wrong. I don't understand how to write X to Y bytes in a file. If anyone could help, that would be great. I tried using this:
I wanted to replace a 6 with 0 in "1234567". However, when i used it, it gave me "123450". It deleted the 7. I know why, because i did SEEK_END, and the program seeked from the 5 to the 7 because of it. But even when i tried "SEEK_END - 1", it still gave me the same thing. Even when i put 6 instead of SEEK_END, it still gives me a "0" in the whole file.Code:char buffer20[] = { '0' };
credit = fopen ( "./files/credit.txt" , "wb" );
fseek(credit, 5, SEEK_END);
fwrite(buffer20, sizeof(buffer20[0]) , sizeof(buffer20), credit);
fclose (credit);
Try using SEEK_SET to position from the start of the file.
The second argument of fseek is what you need to alter to get the correct value, not the third argument.
I tried:Zitat:
Zitat von Insert_Witty_Name
and:Code:char buffer20[] = { '0' };
credit = fopen ( "./files/credit.txt" , "wb" );
fseek(credit, SEEK_SET, 5);
fwrite(buffer20, sizeof(buffer20[0]) , sizeof(buffer20), credit);
fclose (credit);
The first one gave me a "0", and the second one gave me a "123450". How do i make it so it gives me a "1234507"?Code:char buffer20[] = { '0' };
credit = fopen ( "./files/credit.txt" , "wb" );
fseek(credit, 5, SEEK_SET);
fwrite(buffer20, sizeof(buffer20[0]) , sizeof(buffer20), credit);
fclose (credit);
would seek to the offset 5 in the file.Code:fseek(credit, 5, SEEK_SET);
The other one is invalid.
It looks to me like you're truncating the file, but I'm not sure, I've never tried to write to the middle of the file.
So would you happen to know what to do? I have been testing and patiently waiting for someone to help for hours, and i want to finish this before i do any other optimizations to my shell.Zitat:
Zitat von Archaemic
wouldn't writing to the middle of the file overwrite whatevers written there?
which for now you could save whatever is after that point and re-write it after writing whatever you need 2 write there
superbatxs
Take a look at...
http://www.cplusplus.com/reference/c...dio/fseek.html
It has example and it should help,