How do i increase or decrease the volume of a particular sound in OSLib?
Thanks. ;)
Printable View
How do i increase or decrease the volume of a particular sound in OSLib?
Thanks. ;)
thats what i do.
the battery also time is printed fine over the images but just refresh when i press any button. weird
also i still would love to know how to use filebrowser.h + graphics.h since graphics.h just supports printtextscreen. anyone experienced?
Zitat:
Zitat von Judas
Do you mean the filebrowser.h by Slasher? If so, I think there's an example script included in there. It's pretty straightforward.Zitat:
Zitat von ultimate-psp
This should do what you want oslSetChannelVolume,Zitat:
Zitat von TMNT
It can be found in audio.h in the OSLib source code,
Zitat:
Zitat von hibbyware
It's not in my audio.h. What version are you using? Also, when i put this in my code, it gives an undefined reference error.
Edit:
I am using OSLib 2.10, and i found it out.
Code:yourSound->volumeLeft = 0;
yourSound->volumeRight = 0;
I don't use OSLib but had the source on my PC,
It's most prob an old version that I have,
Hey,
Iv been having some problems with some prx's iv been trying to make lately. Iv been trying to blit images in the XMB but it doesnt even boot. Iv been using graphics.h from PSP-Programming tutorials because i thought it might work even though its not made for it. Could someone possibly help me with this possibly provide a library for blitting in the XMB. Thanks
ok recently when i discovered that you could use jas0nuk's elf launcher with pandora to load homebrew on the slim i had a quick idea which was to make a simple script that loaded an eboot which it does and it works fine but not in kernel mode
- what i wanted to as is if i loaded a prx - can i load the prx in kernel mode, or alternately go around the houses and make a prx that gets loaded and loads an eboot in kernel mode
- so basically on a slim is there any way to load an eboot in kernel mode
- if i can load a kernel mode prx or eboot on a slim would you please explain how i would do that thanks
I hate asking for help, because I like to solve things myself, but I'm stumped. I have this code:
I also have a file called 'Levels', which looks like this:Code:...
char buf[3];
int a,b,x,y,array[12][16];
...
void readLevel(int level) {
file = fopen("Levels","rb");
fseek(file,225*level,SEEK_CUR);
fread(buf,2,1,file);
x = atoi(buf);
fread(buf,2,1,file);
y = atoi(buf);
fseek(file,2,SEEK_CUR);
for(a=0;a<12;a++) {
for(b=0;b<16;b++) {
fread(buf,1,1,file);
array[x][y] = atoi(buf);
}
fseek(file,2,SEEK_CUR);
}
fclose(file);
}
Spoiler for Levels:
The thing is, when I read the levels, I print them out. The first two numbers it reads, the x and y coordinates, come out fine. But, the rest of the level always comes out as the same number. Right now, if I read the first level of this file, it comes out as '10' over and over again, even though it's only supposed to read one byte. I'm stumped because when testing this on the PC, it works fine. (I mean compiling it with PC GCC and removing the PSP specific code, not using a PSP emulator or someting.) For the life of me, I can't figure out what's wrong. Does the PSP do something weird to alter the return value of atoi? Please help.
atoi is non standard and could be causing the error.
You are opening the file as binary when it is plain text.
You are reading 2 bytes at 1 time: http://www.cplusplus.com/reference/c...dio/fread.html
The second parameter of fread dictates the number of bytes to read for a element, the third dictates the number of elements. So in your code, you are reading 2 bytes * 1.
Edit: Forget the last point, you are only doing it for the x and y reads which is correct.
I don't know why I was opening in binary mode, habit I guess. I changed it to read mode, but still nothing. And I don't think it's atoi, as it's working for the first few numbers, but I guess it could be. And as for fread, I was told that you could do it either way, but one way is better coding style. I changed it, but it didn't do much, as it worked before.
I once saw a string to integer function as an alternative to atoi. I'll see if I can find it. Maybe it'll work.
-= Double Post =-
Well, while searching I found a function by Waterbottle earlier in this thread. It's supposed to convert a string to an int, but it didn't work. It makes me so mad because it works the first two times, then fails. :mad: I'll figure something out. Unless anyone else has some suggestions?
I have a feeling it might be atoi. Here is your buffer:
[\0][\0][\0] (this is actually undefined as you don't initialise the buffer)
After reading x of the first level it is:
[1][3][\0]
After reading y
[1][0][\0]
After reading 1 byte and inserted into the buffer, you get
[1][0][\0] rather then [1][\0][\0] which is what you were expecting.
Which is ten, not 1 because the buffer is not being cleared to
[\0][\0][\0]
after every fread and atoi or any string function will read a C-string until it hits a \0 in memory.
Try:
Code:void readLevel(int level) {
file = fopen("Levels","rb");
fseek(file,225*level,SEEK_CUR);
memset (buff,'\0',3);
fread(buf,2,1,file);
x = atoi(buf);
memset (buff,'\0',3);
fread(buf,2,1,file);
y = atoi(buf);
fseek(file,2,SEEK_CUR);
for(a=0;a<12;a++) {
for(b=0;b<16;b++) {
memset (buff,'\0',3);
fread(buf,1,1,file);
array[x][y] = atoi(buf);
}
fseek(file,2,SEEK_CUR);
}
fclose(file);
}
I tried that, but a little differently. But I no longer need it. I made a very stupid mistake that I didn't catch. Originally in my for loops, I had x and y as variables. Well, when I found those variables more appropriate for something else, I changed the for loop ones to a and b. But, forgot to change array[x][y] to array[a][b]. That solved my problem. Anyway, sorry for being stupid. :Cry:
Wouldn't it be easier to use fgetc() for this (no buffers, no memset, no atoi).Zitat:
Zitat von yaustar
Code:for(b=0;b<16;b++) {
array[a][b] = fgetc(file) - '0';
}
Yes. It be even easier to use file streams in C++ but I was trying to identify the source of the problem which I thought was buffer related.Zitat:
Zitat von kuroneko
Is there any way I can force the PSP to read a button press, even though no buttons are physically being pressed? Would I have to edit the SceCtrlData buffer manually or is there a easier/cleaner way?
-Aura
You'd have to hook the function(s), as you expected.
Or Better yet, change the Syscon Ctrl Packets, even sceControllerService shall be fooled. :)Zitat:
Zitat von Insert_Witty_Name
How would I go about changing the packets, isn't that the same basic idea as hooking or am I missing something?
-Aura
Cant be better spoon fed than this one. Google "Booster syscon override example".Zitat:
Zitat von Auraomega
You also need to do some homework :p
I've just done all my homework and I don't plan on doing anymore tonight ^.^
Thanks for that, should come in handy.
-Aura
I just downloaded OS Lib 2.10. I installed the files from the "Install" folder onto C:\cygwin\usr\local\pspde v\psp\sdk. I tried compiling a source example but got like 200+ errors.
By the looks of it, I didnt install Oslib right. How would I?Zitat:
psp-g++ -I. -I/cygdrive/c/CSP/cygwin/usr/local/pspdev/psp/sdk/include -G0 -Wall
-O2 -I. -I/cygdrive/c/CSP/cygwin/usr/local/pspdev/psp/sdk/include -G0 -Wall -O2
-fno-exceptions -fno-rtti -c -o src/main.o src/main.cpp
src/main.cpp:1:64: error: C:/devKitPro/devkitPSP/psp/sdk/include/oslib/oslib.h:
No such file or directory
src/main.cpp:7: error: expected constructor, destructor, or type conversion befo
re '(' token
src/main.cpp:8: error: expected constructor, destructor, or type conversion befo
re '(' token
src/main.cpp:55: error: expected constructor, destructor, or type conversion bef
ore '*' token
src/main.cpp:56: error: expected constructor, destructor, or type conversion bef
ore '*' token
src/main.cpp:57: error: expected constructor, destructor, or type conversion bef
ore '*' token
src/main.cpp:58: error: expected constructor, destructor, or type conversion bef
ore '*' token
src/main.cpp: In function 'void GereCoureur(COUREUR&)':
src/main.cpp:90: error: 'osl_pad' was not declared in this scope
src/main.cpp: In function 'void DessineCoureur(COUREUR&)' :
src/main.cpp:101: error: 'imgCoureur' was not declared in this scope
src/main.cpp:101: error: 'oslSetImageFrame' was not declared in this scope
src/main.cpp:104: error: 'imgCoureur' was not declared in this scope
src/main.cpp:104: error: 'oslSetImageFrame' was not declared in this scope
src/main.cpp:106: error: 'imgCoureur' was not declared in this scope
src/main.cpp:106: error: 'oslDrawImageXY' was not declared in this scope
src/main.cpp: In function 'COUREUR creeCoureur()':
src/main.cpp:114: error: 'imgCoureur' was not declared in this scope
src/main.cpp: In function 'void DessineObjet(OBJET)':
src/main.cpp:155: error: 'imgPierre' was not declared in this scope
src/main.cpp:155: error: 'oslDrawImageXY' was not declared in this scope
src/main.cpp: In function 'OBJET creePierre(float)':
src/main.cpp:166: error: 'imgPierre' was not declared in this scope
src/main.cpp: In function 'OBJET creePierreRandom(OBJET, float)':
src/main.cpp:180: error: 'rand' was not declared in this scope
src/main.cpp: In function 'int user_main()':
src/main.cpp:187: error: 'OSL_SOUND' was not declared in this scope
src/main.cpp:187: error: 'music' was not declared in this scope
src/main.cpp:191: error: 'OSL_COLOR' does not name a type
src/main.cpp:207: error: 'sceIoChdir' was not declared in this scope
src/main.cpp:208: error: 'oslInit' was not declared in this scope
src/main.cpp:209: error: 'OSL_PF_5650' was not declared in this scope
src/main.cpp:209: error: 'oslInitGfx' was not declared in this scope
src/main.cpp:210: error: 'oslInitAudio' was not declared in this scope
src/main.cpp:213: error: 'imgFond' was not declared in this scope
src/main.cpp:213: error: 'OSL_IN_RAM' was not declared in this scope
src/main.cpp:213: error: 'oslLoadImageFilePNG' was not declared in this scope
src/main.cpp:214: error: 'imgSol' was not declared in this scope
src/main.cpp:216: error: 'couleurMasque' was not declared in this scope
src/main.cpp:216: error: 'oslSetTransparentColor' was not declared in this scope
src/main.cpp:217: error: 'imgCoureur' was not declared in this scope
src/main.cpp:217: error: 'OSL_PF_5551' was not declared in this scope
src/main.cpp:218: error: 'imgPierre' was not declared in this scope
src/main.cpp:219: error: 'oslDisableTransparentCol or' was not declared in this s
cope
src/main.cpp:222: error: 'OSL_FMT_STREAM' was not declared in this scope
src/main.cpp:222: error: 'oslLoadSoundFileMP3' was not declared in this scope
src/main.cpp:226: error: 'oslFatalError' was not declared in this scope
src/main.cpp:229: error: 'oslSetImageFrameSize' was not declared in this scope
src/main.cpp:231: error: 'oslSetSoundLoop' was not declared in this scope
src/main.cpp:232: error: 'oslPlaySound' was not declared in this scope
src/main.cpp:246: error: 'OSL_SCREEN_WIDTH' was not declared in this scope
src/main.cpp:252: error: 'osl_quit' was not declared in this scope
src/main.cpp:255: error: 'oslStartDrawing' was not declared in this scope
src/main.cpp:258: error: 'RGB' was not declared in this scope
src/main.cpp:258: error: 'oslClearScreen' was not declared in this scope
src/main.cpp:267: error: 'oslDrawImageXY' was not declared in this scope
src/main.cpp:272: error: 'oslDrawImageXY' was not declared in this scope
src/main.cpp:281: error: 'RGBA' was not declared in this scope
src/main.cpp:281: error: 'oslSetBkColor' was not declared in this scope
src/main.cpp:282: error: 'oslSetTextColor' was not declared in this scope
src/main.cpp:283: error: 'oslPrintf_xy' was not declared in this scope
src/main.cpp:289: error: 'oslEndFrame' was not declared in this scope
src/main.cpp:290: error: 'oslEndDrawing' was not declared in this scope
src/main.cpp:295: error: 'oslDebug' was not declared in this scope
src/main.cpp:300: error: 'oslReadKeys' was not declared in this scope
src/main.cpp:303: error: 'osl_pad' was not declared in this scope
src/main.cpp:338: error: 'oslSyncFrameEx' was not declared in this scope
src/main.cpp:341: error: 'oslQuit' was not declared in this scope
src/main.cpp: In function 'int main(int, char**)':
src/main.cpp:353: error: 'OSL_FMT_MP3' was not declared in this scope
src/main.cpp:353: error: 'oslInitAudioME' was not declared in this scope
src/main.cpp:356: error: 'sceKernelGetThreadId' was not declared in this scope
src/main.cpp:356: error: 'sceIoGetThreadCwd' was not declared in this scope
src/main.cpp:359: error: 'SceUID' was not declared in this scope
src/main.cpp:359: error: expected `;' before 'thid'
src/main.cpp:365: error: 'thid' was not declared in this scope
src/main.cpp:365: error: 'sceKernelStartThread' was not declared in this scope
src/main.cpp:367: error: 'sceKernelWaitThreadEnd' was not declared in this scope
make: *** [src/main.o] Error 1
bash-3.2$
Hey guys I'e been looking for some examples on the function sce_getFrameBuff, but found like 3 or so examples, and couldn't understand how to use it in none of them. Can anybody here explain it to me?
Cheers
Ok... Installation being the problem is highly unlikely if you ran Install.bat as instructed...Zitat:
Zitat von Mirzab14
If you did that, it's your make file not linking correctly and/or src/main.cpp not including the right headers.
Here is the biggest error:Code:C:/devKitPro/devkitPSP/psp/sdk/include/oslib/oslib.h:
No such file or directory
You get the FB address with which you can do raw editing.Zitat:
Zitat von placo23
Right, but do you have any example of the use of that?Zitat:
Zitat von Mr305
Cheers
Check out My alarm Helper source, I forgot to rename sceDisplay_xxxxxxx to sceDisplayGetFramebuffer. :)Zitat:
Zitat von placo23
Great, can you just tell me where I can find the source of that? 'Cause I looked at the forums but didn't really find it.Zitat:
Zitat von Mr305
Thanks in advance :)
It's hereZitat:
Zitat von placo23
I might make a FULL button mapper which uses config file if I find time. :ROFL:Zitat:
Zitat von Mr305
Hey guys!
I thought it would be usefull to have this simple IRDA capture ported to
work with IRshell 3.9... I guess its harder then I thought because
it tries to find the irda device on the psp, but since it has been removed
in 3.71 and up, it needs to be relinked to the "sircs.prx" thing you put in the SYSTEM folder of the IRSHELL app...
Anybody understands what I mean?
I don't know how to 'relink' it so a little help would be amazing :D
Great... That's all I neededZitat:
Zitat von hibbyware
Thank you very much, and big thanks to Mr305
Hey guys,
I've been trying to install the psptoolchain on leopard for a little while now. I've made it through about the first 6 errors I've encountered but this one isn't working itself out. Any thoughts:
BTW I'm running a ppc.Code:../../gcc/config/rs6000/host-darwin.c:38: warning: ‘struct sigaltstack’ declared inside parameter list
../../gcc/config/rs6000/host-darwin.c:38: warning: its scope is only this definition or declaration, which is probably not what you want
../../gcc/config/rs6000/host-darwin.c:38: error: conflicting types for ‘sigaltstack’
/usr/include/signal.h:89: error: previous declaration of ‘sigaltstack’ was here
../../gcc/config/rs6000/host-darwin.c: In function ‘segv_handler’:
../../gcc/config/rs6000/host-darwin.c:71: error: ‘struct __darwin_mcontext’ has no member named ‘ss’
../../gcc/config/rs6000/host-darwin.c:120: error: ‘struct __darwin_mcontext’ has no member named ‘es’
../../gcc/config/rs6000/host-darwin.c:120: error: ‘struct __darwin_mcontext’ has no member named ‘ss’
../../gcc/config/rs6000/host-darwin.c: In function ‘darwin_rs6000_extra_signals’:
../../gcc/config/rs6000/host-darwin.c:134: warning: passing argument 1 of ‘sigaltstack’ from incompatible pointer type
make[2]: *** [host-ppc-darwin.o] Error 1
make[2]: *** Waiting for unfinished jobs....
make[1]: *** [all-gcc] Error 2
make: *** [all] Error 2
../scripts/002-gcc-4.1.0-stage1.sh: Failed.
ERROR: Could not run the toolchain script.
I need some little help. Im trying to set a backround color to blue so the whole screen will be filled with it. Im using this code and the only thing thats blue is the lines with the text on them, if that made any sense.
Code:pspDebugScreenSetBackColor(0x00402000);
printf("W e l c o m e\n");
printf("\n");
printf("\n");
pspDebugScreenSetTextColor(0x111FFF); // Light Blue
printf("Text\n");
sceKernelDelayThread(10*300*300);
printf(".");
sceKernelDelayThread(10*300*300);
printf(".");
sceKernelDelayThread(10*300*300);;
printf(".");
sceKernelDelayThread(10*200*200);
printf("DONE!");
sceKernelDelayThread(10*250*250);
printf("\n");
printf("\n");
printf("Text\n");
pspDebugScreenClear(); after you change the color.Zitat:
Zitat von Mirzab14
Hey, i was just wondering if someone could possibly let me know how to blit images in the XMB. I can blit an image but the XMB doesnt load, all i get is a black background with the image and nothing else. Any help would be mad, thanks
How would I let someone enter a number between 0-9 and up to 3 digits.
Like........ how can i let them input a number?
A whole stack of ways. Can you be more specific? Are you going to have an OSK?
Take a look at VSHBlit. There's an example in this thread talking about this, and actually blitting an image on XMB.Zitat:
Zitat von Xsjado7
If you don't find it, gimme a shout, I might still have it @ home