![]() |
| Forums | Gaming News | Videos | Downloads | Today's Posts | Mark Forums Read | Chat | FAQ | Members List | Contact |
| ||||||
This is a discussion on C/C++ Programming Help Thread within the PSP Development Forum forums, part of the PSP Development, Hacks, and Homebrew category; Hi, I'm new to the PSP homebrew programing scene, lucky not to C++ however, and I can't figure out for ...
![]() |
|
|
LinkBack | Thread Tools |
|
|
#151 |
|
Hi, I'm new to the PSP homebrew programing scene, lucky not to C++ however, and I can't figure out for the life of me how to display one picture over the other withough erasing the first picture. If anyone could help it would be greatly appresiated.
Curently I have it set up as such. Code:
char buffer1[200];
char buffer2[200];
Image* bg;
Image* set;
sprintf(buffer1, "bg.png");
bg = loadImage(buffer1);
sprintf(buffer2, "set.png");
set = loadImage(buffer2);
sceDisplayWaitVblankStart();
blitAlphaImageToScreen(0 ,0 ,480 ,272 ,bg ,0 ,0 );
flipScreen();
sceDisplayWaitVblankStart();
blitAlphaImageToScreen(0 ,0 ,60 ,34 ,set ,60 ,34 );
flipScreen();
Sorry if this is noobish BTW. Last edited by F.T.P.; 03-28-2006 at 06:52 PM.. |
|
|
|
|
|
|
#154 | |
![]() Mushroom Man
|
Quote:
Code:
sceDisplayWaitVblankStart();
blitAlphaImageToScreen(0 ,0 ,480 ,272 ,bg ,0 ,0 );
blitAlphaImageToScreen(0 ,0 ,60 ,34 ,set ,60 ,34 );
flipScreen();
__________________
[URL=http://www.othala.co.uk]Othala[/URL] [B]o[/B] [URL=http://www.entheogendefencefund.org.uk/]Save the shroom![/URL] [CENTER][URL=http://www.othala.co.uk/travellerBlog][IMG]http://www.othala.co.uk/graphics/travBanner.png[/IMG][/URL][/CENTER] |
|
|
|
|
|
|
#155 |
![]() ![]() Developer
|
Does anyone know the command to activate usb ( I found the example in the sdk but somehow it didnt work form me...). Cause I want to activate it when I press 'X'. If anyone wold give me an example it would be great. Thanks in advance.
Edit: Nevermind I just got it to compile. Too bad that I just lost my USB-cable =S Last edited by SodR; 03-29-2006 at 11:58 AM.. |
|
|
|
|
|
#157 |
![]() |
Have anyone ever notice that when printing text to the screen whether over a picture or not, if the xcoord is <0 of the screen... nothing is printed at all?Would someone mind telling me what can be done about this? I'm currently using: printTextScreen(,,,) Last edited by Devun_06; 03-30-2006 at 12:35 PM.. |
|
|
|
|
|
#158 |
|
Hey, how could I disable 'Home' -button, so nothing would happen if you press it, or how could I get my program to straight exit when pressing 'Home'? I tried one method, and when you press 'Home', that stupid "Do you want to quit program" -popup comes to the screen, but after a second it will get me back to XMB. So how could I disable that "Do you want to quit program" -popup showing up at all?
EDIT: Got it working, no problems anymore
Last edited by MiiKKiZ; 03-31-2006 at 01:48 PM.. |
|
|
|
|
|
|
#159 |
![]() |
If you're getting the XMB return system then I guess your running 1.5. I've never tried overriding the original home key feature, but I think this might help.
SceCtrlData Pad; sceCtrlReadBufferPositive (&Pad,1); if(Pad.Buttons & PSP_CTRL_HOME){sceKernelE xitGame();} |
|
|
|
|
|
#160 |
![]() ![]() Developer
|
I have not tested it my self but if you code that nothing will happen when you press home, like this:
SceCtrlData Pad; sceCtrlReadBufferPositive (&Pad,1); if(Pad.Buttons & PSP_CTRL_HOME) I think it will work as it were disabled. At least you can always try. |
|
|
|
|
|
#161 |
![]() ![]() Bush Programmer
|
Hi Guys, just a little Q re C syntax.
I have some variables in a buffer that represent ASCII values that I would like to print to screen as ASCII. I can print them as decimal values like so: printf("variable is: %d",data[0]); So if I have the ASCII character '0' in the buffer, it will print as: variable is: 48 which is it's decimal value. What do I need to replace the %d with for ASCII? Cheers, Art. |
|
|
|
|
|
#162 |
![]() |
%c I believe. If I'm right, I read it here: http://irc.essex.ac.uk/www.iota-six....ming_intro.asp
|
|
|
|
|
|
#165 |
![]() ![]() ...in a dream...
|
hmmm....Soccer, thats what you told me for hex, and its true, looked it up and everything... use %02x to only use/get the hex in 2 character/byte form...
__________________
...you'll never know what it's like... spending your whole life in a dream...
Launch a Kitten out of a Cannon and win real cash! Checkout my newly updated site for all my projects (Kitten Cannon, BOXHEAD, Light Cycle 3D) |
|
|
|
|
|
#166 |
![]() |
Hi everyone, i'm trying to make a png photo viewer with music in the background. Can anybody please help.
Code:
#include <pspkernel.h>
#include <pspdisplay.h>
#include <pspdebug.h>
#include <pspgu.h>
#include <png.h>
#include <pspdisplay.h>
#include <pspctrl.h>
#include <stdio.h>
#include <psppower.h>
#include <pspaudio.h>
#include <pspaudiolib.h>
#include "mp3player.h"
#include "graphics.h"
PSP_MODULE_INFO("images and music", 0, 1, 1);
#define MAX(X, Y) ((X) > (Y) ? (X) : (Y))
#define printf pspDebugScreenPrintf
/* Exit callbacks */
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);
sceKernelSleepThreadCB();
return 0;
}
/* Sets up the callback thread and returns its 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;
}
int main(void) {
SetupCallbacks();
initGraphics();
SceCtrlData pad;
int i;
int j;
int selComponent = 0;
int selComponent2 = 0;
char buffer[200];
char image[5];
char music[5];
Image* ourImage;
pspAudioInit();
while(1) {
sceCtrlReadBufferPositive(&pad, 1);
if(selComponent == 0) {
image == "1.png";
} else if(selComponent == 1) {
image == "2.png";
} else if(selComponent == 2) {
image == "3.png";
} else if(selComponent == 3) {
image == "4.png";
} else if(selComponent == 4) {
image == "5.png";
}
if(selComponent2 == 0) {
music == "1.mp3";
} else if(selComponent2 == 1) {
music == "2.mp3";
} else if(selComponent2 == 2) {
music == "3.mp3";
} else if(selComponent2 == 3) {
music == "4.mp3";
} else if(selComponent2 == 4) {
music == "5.mp3";
}
if(pad.Buttons & PSP_CTRL_UP) {
if(selComponent > 0) {
selComponent--;
}
for(i=0; i<10; i++) {
sceDisplayWaitVblankStart();
}
} else if(pad.Buttons & PSP_CTRL_DOWN) {
if(selComponent < 4) {
selComponent++;
}
for(i=0; i<10; i++) {
sceDisplayWaitVblankStart();
}
}
if(pad.Buttons & PSP_CTRL_LEFT) {
if(selComponent2 > 0) {
selComponent2--;
}
for(j=0; j<10; j++) {
sceDisplayWaitVblankStart();
}
if(pad.Buttons & PSP_CTRL_RIGHT) {
if(selComponent2 > 1) {
selComponent2++;
}
for(j=0; j<10; j++) {
sceDisplayWaitVblankStart();
}
}
printf("Image viewer (with added music!)");
sprintf(buffer, image);
if (!ourImage) {
//Image load failed
printf("Image load failed!/n");
} else {
int x = 0;
int y = 0;
sceDisplayWaitVblankStart();
while (x <= 480) {
while (y <= 272) {
blitAlphaImageToScreen(0, 0, 480, 272, ourImage, x, y);
y += 272;
}
x += 480;
y = 0;
}
MP3_Init(1);
MP3_Load(music);
MP3_Play();
while(1) {
sceCtrlReadBufferPositive(&pad, 1);
if(pad.Buttons & PSP_CTRL_CROSS) {
break;
} else if(pad.Buttons & PSP_CTRL_CIRCLE) {
MP3_Pause();
for(i=0; i<10; i++) {
sceDisplayWaitVblankStart();
}
}
MP3_Stop();
MP3_FreeTune();
flipScreen();
for(i=0; i<1; i++) {
sceDisplayWaitVblankStart();
}
}
return 0;
}
|
|
|
|
|
|
#167 |
![]() ![]() Developer
|
code-zero: Maybe you should tell us what the problem is instead of yout posting your source. Doesn't it compile? If so what error code? Or at which point does your program crash?? We need more info
|
|
|
|
|
|
#168 |
![]() ![]() ...in a dream...
|
code-zero, there are multiple resons why it might not work... 1 being you initalized the MP3 playing in a loop, along with 2 infinite loops as well lol.. . Why not post your problems complying? Oh and it also looks like you are just copying and pasting from Yeldarbs *tuts*, 'ourImage'? SelComponent? blitting the backround/image with a loop for know reason? (remove the > and < junk, just do blitAlphaImageToScreen(0, 0, 480, 272, ourImage, 0, 0)<- that will blit ourImage to the co-ordinates of 0, 0 and the ourImage's dimensions are 480x272 in this) There are some more problems in theree, but ill let you debug to get used to having too.
__________________
...you'll never know what it's like... spending your whole life in a dream...
Launch a Kitten out of a Cannon and win real cash! Checkout my newly updated site for all my projects (Kitten Cannon, BOXHEAD, Light Cycle 3D) Last edited by SG57; 04-07-2006 at 12:32 PM.. |
|
|
|
|
|
#170 |
![]() ![]() Developer
|
I'm having problem installing PSPGL on my PC. I downloaded pspgl using svn (svn co svn://svn.ps2dev.org/psp/trunk/pspgl ) and that works just fine. But how am I supposed to install it?? The readme is like a riddle, why cant it just tell me what to do? I tryed to just go into the dir (cd pspgl) and type "make". After that alot of text rolls on the screen and after like a half a minute I get this error:
Code:
[Alotofdirnameshere]/TEMP/ccimwEpb.s: Assembler messages: [Alotofdirnameshere]/TEMP/ccimwEpb.s: "Error: Illegal operands 'vmidt.q m700' make: *** [glLoadIdentity.o] Error 1 Code:
psp-gcc -std=gnu99 -g -Wall -Wmissing-prototypes -Os -G0 -fsingle-precision-constant -I. -I /usr/local/pspdev/psp/include -I /usr/local/pspdev/psp/include funit-at-a-time -MD -MF .deps/[Filename].d -c [Filename].c |
|
|
|
|
|
#171 |
![]() ![]() Developer
|
Meh, I need help with blitting an image to the screen. Code:
Code:
#include <pspdisplay.h>
#include <pspctrl.h>
#include <pspkernel.h>
#include <pspdebug.h>
#include <pspgu.h>
#include <png.h>
#include <stdio.h>
#include "graphics.h"
#define MAX(X, Y) ((X) > (Y) ? (X) : (Y))
#define printf pspDebugScreenPrintf
PSP_MODULE_INFO("Button Basher", 0, 1, 1);
/* 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;
}
int main() {
char buffer[200];
Image* menubg;
pspDebugScreenInit();
SetupCallbacks();
initGraphics();
sprintf(buffer, "menubg.png");
menubg = loadImage(buffer);
if (!menubg) {
//Image load failed
printf("Image load failed! Please email youleben@gmail.com!\n");
} else {
int x = 0;
int y = 0;
sceDisplayWaitVblankStart();
while (x < 480) {
while (y < 272) {
blitAlphaImageToScreen(0, 0, 480, 272, menubg, x, y);
x = 0;
y = 0;
}
flipScreen();
}
}
sceKernelSleepThread();
return 0;
}
|
|
|
|
|
|
#172 |
|
At first, you dont need this:
while (x < 480) { while (y < 272) { blitAlphaImageToScreen(0, 0, 480, 272, menubg, x, y); x = 0; y = 0; } flipScreen(); } you just have to write: blitAlphaImageToScreen(0, 0, 480, 272, menubg, x, y); flipscreen(); you kopie the code, or?, try to understand why you dont need the 2 while sharpens. and now to your problem, i think you need a larger buffer, so test it with 20000 or more
|
|
|
|
|
|
|
#173 |
![]() ![]() Developer
|
Nvm I fixed it
I somehow got yeldarbs MSN and he helped me I just need to find a tut on how to make a menu now
|
|
|
|
|
|
#174 | |
![]() ![]() ...in a dream...
|
Quote:
![]() Anyway, i have included one of those copyright Comments at the top, so if you copy and paste, then youd have to include something about it. Instead just read it, get an idea of how it works, and then make your own. Very simple. P.S. If something is wrong in it, forgive me since i just throguh it together to help some new devlopers out since i too had a hard time with a menu. your welcome.
__________________
...you'll never know what it's like... spending your whole life in a dream...
Launch a Kitten out of a Cannon and win real cash! Checkout my newly updated site for all my projects (Kitten Cannon, BOXHEAD, Light Cycle 3D) |
|
|
|
|
|
|
#175 |
![]() ![]() Developer
|
ty so much
I can carry on now XD
|
|
|
|
|
|
#176 |
![]() ![]() Developer
|
Sorry for double post!
Im gettin eally annoyed with this oggplayer LIB. Here is a screenshot of my compiling error: ![]() Code: Code:
#include <pspdisplay.h>
#include <pspctrl.h>
#include <pspkernel.h>
#include <pspdebug.h>
#include <pspgu.h>
#include <png.h>
#include <stdio.h>
#include "graphics.h"
#include <stdlib.h>
#include <malloc.h>
#include <stdio.h>
#include <stdarg.h>
#include <string.h>
#include <limits.h>
#include <errno.h>
#include <pspaudiolib.h>
#include <pspaudio.h>
#include <pspdisplay.h>
#include <pspctrl.h>
#include <pspkernel.h>
#include <pspdebug.h>
#include <psputils.h>
#include <psptypes.h>
#include <psppower.h>
#include <pspiofilemgr.h>
#include <png.h>
#include <stdio.h>
#include "graphics.h"
//Ogg include
#include "ogg/ivorbisfile.h"
#include "oggplayer.h"
#define MAX(X, Y) ((X) > (Y) ? (X) : (Y))
#define printf pspDebugScreenPrintf
PSP_MODULE_INFO("Button Basher", 0, 1, 1);
/* 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;
}
int main() {
char buffer[200];
Image* menubg;
pspDebugScreenInit();
SetupCallbacks();
initGraphics();
pspAudioInit();
//Initialize OGG port
OGG_Init(1);
//Load OGG file
OGG_Load("sounds/menu.ogg");
//Play the loaded file
OGG_Play();
sprintf(buffer, "menubg.png");
menubg = loadImage(buffer);
if (!menubg) {
//Image load failed
printf("Image load failed! Please email youleben@gmail.com!\n");
} else {
int x = 0;
int y = 0;
sceDisplayWaitVblankStart();
blitAlphaImageToScreen(0, 0, 480, 272, menubg, x, y);
}
flipScreen();
sceKernelSleepThread();
return 0;
}
|
|
|
|
|
|
#177 |
![]() ![]() ...in a dream...
|
Its noi doubt you either dont ahve the OGGlib installed/not including then OGGlib/do not have the OGG lib in the makefile. But o have it repeat and never stop, look at the .h file of it and a protoyp will be in there for something similar.
__________________
...you'll never know what it's like... spending your whole life in a dream...
Launch a Kitten out of a Cannon and win real cash! Checkout my newly updated site for all my projects (Kitten Cannon, BOXHEAD, Light Cycle 3D) |
|
|
|
|
|
#180 |
![]() ![]() Developer
|
sorry unsure where else to post this but when i'm trying to get c to work i notice it is trying to dl from a website heres the full error
--15:23:54-- ftp://ftp.gnu.org/pub/gnu/binutils/b...-2.16.1.tar.gz (try: 6) => `binutils-2.16.1.tar.gz' Connecting to ftp.gnu.org|199.232.41.7| :21... failed: Connection timed out. Retrying. anyway around this would be much appreciated=-)
__________________
1. Failed....again... 2. http://slicer.gibbocool.com/ stay updated on all my projects |
|
|
|
![]() |
| Tags |
| c or c , c++ , c/c++ , code , coding , c_language , programming , psp , psp programming , thread |
| Thread Tools | |
|
|