Thanks freeplay... I mean, hibbywareZitat:
Zitat von hibbyware
Printable View
Thanks freeplay... I mean, hibbywareZitat:
Zitat von hibbyware
hey so does anyone have a sample code for getting a variable from a text file off the internet, like get a string from blackbelttcon.com/test.txt
I need some help, I have a floatbut when I try and display it with the code:Zitat:
float CustardScroll = 2.50;
Instead of it saying "Custard Scrolls cost: 2.50" it says "Custard Scrolls cost: 2.50000"Zitat:
printf("Custard Scrolls cost: %f", CustardScroll);
Anybody know why :confused:
You haven't set the precision to be printed.Zitat:
Zitat von BigSanFrey
http://www.cplusplus.com/reference/c...io/printf.html
I want to draw a rectangle on the screen with an alpha layer... umm can't think of any examples, I was just wondering where to look for the GU functions as its been a while since I used any, and if there were any basic tutorials or source codes out there showing that idea, all I've really seen was the ones on PSP-Programming which didn't really interest me and so I didn't do much work with them.
Thanks.
-Aura
Easy enough to follow. pgeGfxStartDrawing() just checks to make sure the display list has been started.Code:void pgeGfxDrawRect(float x, float y, float width, float height, unsigned int color)
{
pgeGfxStartDrawing();
pgeVertCV* vertices = (pgeVertCV*)sceGuGetMemory((sizeof(pgeVertCV)<<1));
vertices[0].color = color;
vertices[0].x = x;
vertices[0].y = y;
vertices[0].z = 0.0f;
vertices[1].color = color;
vertices[1].x = x + width;
vertices[1].y = y + height;
vertices[1].z = 0.0f;
sceGuDisable(GU_TEXTURE_2D);
sceGuShadeModel(GU_FLAT);
sceGuDrawArray(GU_SPRITES, GU_COLOR_8888|GU_VERTEX_32BITF|GU_TRANSFORM_2D, 2, 0, vertices);
sceGuShadeModel(GU_SMOOTH);
sceGuEnable(GU_TEXTURE_2D);
}
What's the best way of determining whether someone is using the 1.5 kernel, or the 3.xx kernel?
Should I just use,
?Code:if (sceKernelDevkitVersion() == 0x01050001)
{
// 1.5
}
else
{
//3.xx
}
or is there some other way?
If you mean what has been set in recovery then you could check the config.se
I think that that would just check the firmware version, not the kernel being used. Also, checking config.se wouldn't work, as that just sets the kernel for GAME folder homebrew, when something can still be run from GAME150 or GAME3XX.Zitat:
Zitat von Slasher
Yeah but checking what the current working directory is and also checking what kernel the GAME folder is set to should tell you what kernel is running,Zitat:
Zitat von Judas
I'm sure there is a better way to check it but I'm sure it would work,
That would work, but would be a long way of doing so, I believe in one of the old OE/M33 firmwares contained a library in the SDK folder that had a function for checking the mode it was booted in, but I can't be sure.
I'm trying to get mp3s streaming... again... I got a hacky version earlier and somehow messed it up, I don't even know where I got the old code from that loaded the entire file into memory, but I want to learn to write my own music functions from scratch. I don't have much knowledge on the music front, but I assume streaming music requires 2 buffers, and for parts of a file to be read into each buffer, one of those buffers to be played while the other is read, but beyond that I don't know much, some heavily comment code or a guide or something would be highly apprechiated if anyone can point me in the right direction (I did look at this but it confused me :o
Thanks.
-Aura
Are there eboot compilers that you can use on the PSP that will compile c++ source files?
That could really help me out if there is something like that. :twisted: :confused:
maybe try uclinux
i just checked that out, would I have to use a secondary application within uclinux to compile? Or does uclinux have a set-up for packing?
thanks
not sure, never used it
Hmmm. I did a search off files.qj.net using keywords "pack" and others along those lines but it didn't turn up anything. I only found a pbp-pack on google, but that only packs on a computer the .sfo, .psp, and other assorted files after unpacking an eboot...
I'll search some more, but if anyone knows anything, the help would be appreciated ^ ^
Here's the deal, I really want to learn to code for the psp. In order to do so, I have ordered myself a book on basic C. Also I have read a fair amount of tutorials and lots of posts here and on ps2dev.
This already resulted in a working toolchain and my first "Hello World" app. Nothing big really, but you gotta start somewhere right ?
While I am awaiting my ordered book I'm trying to figure some simple stuff out, like button input. That's where my question comes in.
I'll post the my code, makefile and toolchain error. I've been searching my a** off on this issue, but can't figure it out yet. I hope someone here can help me out. (And yes I know, I will need to learn proper coding skills before starting on the psp, but I'm hoping I can combine the two).
My code:
My make file:Code://This is a simple 'Hello World' type app.
//It will display text and can be exited with a button press
//This app is created by FRanatic on 01-03-2008
#include <pspdebug.h>
#include <pspkernel.h>
#include <pspdisplay.h>
#include <pspctrl.h>
#define VERS 1
#define REVS 1
#define printf pspDebugScreenPrintf
PSP_MODULE_INFO("Hello World", 0, VERS, REVS);
PSP_HEAP_SIZE_MAX();
/* 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()
{
pspDebugScreenInit();
SetupCallbacks();
sceCtrlData pad;
printf("Hello FRanatic \n");
printf("Hit O to continue...\n");
while(1)
{
sceCtrlReadBufferPositive(&pad,1);
if(pad.Buttons & PSP_CTRL_CIRCLE){
break;}
}
pspDebugScreenClear();
printf("Press X to exit to the XMB\n");
while(1)
{
sceCtrlReadBufferPositive(&pad, 1);
if(pad.buttons & PSP_CTRL_CROSS){
sceKernelExitGame();}
}
sceKernelSleepThread();
return 0;
}
And the errors I get when running the makefile:Code:TARGET = hello2
OBJS = main.o
CFLAGS = -O2 -G0 -Wall
CXXFLAGS = $(CFLAGS) -fno-exceptions -fno-rtti
ASFLAGS = $(CFLAGS)
EXTRA_TARGETS = EBOOT.PBP
PSP_EBOOT_TITLE = Hello World 1.1
BUILD_PRX = 1
PSP_FW_VERSION = 371
PSPSDK=$(shell psp-config --pspsdk-path)
include $(PSPSDK)/lib/build.mak
Thanks in advance.Code:main.c: In function 'main':
main.c:55: error: 'sceCtrlData' undeclared (first use in this function)
main.c:55: error: (Each undeclared identifier is reported only once
main.c:55: error: for each function it appears in.)
main.c:55: error: expected ';' before 'pad'
main.c:62: error: 'pad' undeclared (first use in this function)
make: *** [main.o] Error 1
I presume you have read this?
Yes, I did.Zitat:
Zitat von BigSanFrey
Did I implement it the wrong way ?
Try making it for 1.50 kernel first, then see if your code works on 3.XX kernel :)
AFAIK, I only need to adjust my makefile (deleting prx and version lines) and remove the heap_size_max line from the code.
However my first hello world, did work with that makefile and heap_size line.
I've got a long road ahead of me...But I'll get there someday !
@JoyforPSP - Go through your code and check that you have enough { and } in your code as to me it looks like your missing some of these } ,
Not sure if this still applies, but sceCtrlData is not actually a struct, its SceCtrlData for some odd reason which I've never understood, unlike all other sce functions this one requires a capital S instead of a low case s...
-Aura
your error is with
it should beCode:sceCtrlData pad;
needed a captial S ;)Code:SceCtrlData pad;
-= Double Post =-
lol, beat me to it Aura
lol I looked at the error message then forgot about that,
Ignore me saying your missing some of these { and } as you do have them but they are put in a wierd place so I never noticed them, lol
Thanks everybody for the replies.
I got it running now and works like it should.
Indeed it a capital 'S' was needed.
thanks to hotrocker, I am now able to compile some eboots with his help. So this morning, he compiled my game, but it came up with these errors that I don't understand:
http://i181.photobucket.com/albums/x...ard/errror.jpg
And some of the errors are for "for" loops, I can't seem to figure out why these errors have occurred, does anyone know what I should change?
Also let me know if you want me to post the "main.cpp."
Post up the code. Also, you are attempting to compile main.c not main.cpp. If you are using C++, then rename the file to main.cpp.
Ok, I will tell hotrocker that, because I forgot to say that I was wanting c++ compiled...Zitat:
Zitat von yaustar
Here is main.cpp:
Spoiler for code:
i redid it as main.cpp and now ur only error is
line: 60 : expected ',' or '...' before '-' token
void oslDrawLine(int x-1, int y-1, int x-1, int y-1, OSL_COLOR color);
thats line 60