ok i included flib.o graphics.o and framebuffer.o
but it gives me an error with flib
http://img75.imageshack.us/img75/418...mpimagepj7.png
Printable View
ok i included flib.o graphics.o and framebuffer.o
but it gives me an error with flib
http://img75.imageshack.us/img75/418...mpimagepj7.png
beter copy and pasta you errors here;) and btw there is something wrong with your flib.o
-= Double Post =-
some prob's
it flips the text(je hebt vermenigvuldigen gekozen) 10.000 times on screen ,lolZitat:
inline void vermenigvuldigen()
{ pspDebugScreenClear();
x=0;
while(1) {
printf("\n\n\n\n\n\n\n je hebt vermenigvuldigen gekozen\n");
if (x>=50) {
printf(" bezig met opstarten");
}
if (x>200) {
printf(",klaar");
}
if (x>250) {
pspDebugScreenClear();
vermenigvuldigenb();
}
}
}
and the rest it dont
prob2
i let change the functions by pressing triangle
but when you hold it , it change , change and change , it only ahve to change ones
the prob is
it loads another loop while pressing triangle and in the next loop it does the same , so it continues.....
i posted a pic..
press back on your browser then forward..
that should make the image normal size
hallo007:
Flipping heck... where do I start....Code:inline void vermenigvuldigen()
{
pspDebugScreenClear();
x=0;
while(1)
{
printf("\n\n\n\n\n\n\n je hebt vermenigvuldigen gekozen\n");
if (x>=50)
{
printf(" bezig met opstarten");
}
if (x>200)
{
printf(",klaar");
}
if (x>250)
{
pspDebugScreenClear();
vermenigvuldigenb();
}
}
}
1) You are inlining a function that really doesn't need to be inlined. Don't overuse the inline keyword and avoid premature optimisation.
2) You are using an infinite loop (while(1) ) with no possbile exit condition.
3) x is always going to be 0 before the while loop begins therefore none of the if statements will equal true.
2/it loads another function so why exit?Zitat:
Zitat von head_54us
3/ , how do i let it be true
putZitat:
Zitat von hallo007
in your while loop.Code:int x=0;
-= Double Post =-
Hey i have a question..
In gimp, you can save images as image.c so cant you compile that image within the EBOOT to save memory space??
if (x>=50)Zitat:
Zitat von hallo007
is true if x is larger then or equal to 50.
but since you never make x increase nothing else will happen. add x++; or somthin
psphacker12.: Incorrect
hallo007: It doesn't even load another function since x is always 0 when entering the while loop.
This:
Might as well be:Code:inline void vermenigvuldigen()
{
pspDebugScreenClear();
x=0;
while(1)
{
printf("\n\n\n\n\n\n\n je hebt vermenigvuldigen gekozen\n");
if (x>=50)
{
printf(" bezig met opstarten");
}
if (x>200)
{
printf(",klaar");
}
if (x>250)
{
pspDebugScreenClear();
vermenigvuldigenb();
}
}
}
It won't ever leave the while loop.Code:inline void vermenigvuldigen()
{
pspDebugScreenClear();
x=0;
while(1)
{
printf("\n\n\n\n\n\n\n je hebt vermenigvuldigen gekozen\n");
}
}
psphacker12: Your freetype headers are in the wrong directory. They should be in:
I seem to remember the ps2dev.org SVN putting them in a freetype2 folder or something like that.Code:usr\local\pspdev\psp\include\freetype
Just copy them into the usr\local\pspdev\psp\incl ude\freetype directory.
Socket-programming
Hi,
I'm doing some networkprogramming right now; The connecting works fine, but when it comes to the data exchange I'm having some issues; What he shall do is:
1.) Client connects to server (works)
2.) Client sends "<command>get_artists </command>" (works)
3.) Server recieves message and prints it (works)
4.) Client sends "<command>get_albums</command>" (works)
5.) Server recieves message and prints it (works)
6.) Client starts recieving (while-loop) (he starts recieving but never actually recieves something)
7.) Server answers (never sends anything)
Server code:
Client code:Code:if(listen(sock, 5) == -1 )
error_exit("Error listening");
printf("Server ready - waiting for requests\n");
for (;;) {
len = sizeof(client); // client = sockaddr_in
fd = accept(sock, (struct sockaddr*)&client, &len);
if (fd < 0)
error_exit("Error accepting");
printf("Incloming request from %s\n", inet_ntoa(client.sin_addr));
while(rc!=SOCKET_ERROR)
{
rc=recv(fd,buf,256,0);
if(rc==0)
{
printf("Client closed the connection...\n");
break;
}
if(rc==SOCKET_ERROR)
{
printf("Error: recv, error-code: %d\n",WSAGetLastError());
break;
}
buf[rc]='\0';
printf("Client sent: %s\n",buf);
}
printf("Sending answer...\n");
sprintf(buf2,"%s\n",buf);
rc=send(fd,buf2,strlen(buf2),0);
printf("Closing connection...\n");
closesocket(fd);
what he does is, on the server, recieving and displaying the messages (nothing else), and on the client, he sends the 2 messages, displays 'reciecing and does nothing moreCode:command = "<command>get_artists</command>";
command_len = strlen(command);
command2 = "<command>get_albums</command>";
command2_len = strlen(command);
if (send(socket, command, command_len, 0) != command_len) {
printf("send() sent a different length of bytes than expected!\n"); // needs real exceptionhandling
return;
}
printf("sending command get_artists...\n");
if (send(socket, command2, command2_len, 0) != command_len) {
printf("send() sent a different length of bytes than expected!\n"); // needs real exceptionhandling
return;
}
printf("sending command get_albums...\n");
printf("recieving...\n");
while(rc!=SOCKET_ERROR)
{
rc=recv(socket,buf,4096,0); // muss noch variabel gemacht werden
buf[rc]='\0';
if(rc==0)
{
printf("Server has closed the connnection\n");
break;
}
if(rc==SOCKET_ERROR)
{
printf("Error: recv, error-code: %s\n",strerror(errno));
break;
}
printf("%s\n", buf);
strcat(recivedMessage, buf);
}
close(sock);
haha lol , that was in my programm , but i dindt written it in this thread;)Zitat:
Zitat von waterbottle
How do I make an If,Then statement satisfy multiple conditions?
I always do stuff in LUA and now want to learn C++. Im using the oslib (Old School Lib) to make a little sample thing to get expierence.Code:if (k->held.cross & sel = 1)
//code;
Just help and dont give smartass comments.
Code:Logical AND (what you want)
if(statement1 && statement2)
Bitwise AND
if(statement1 & statement2)
Logical OR
if(statement1 || statement2)
Bitwise OR (not sure about this one :P)
if(statement1 | statement2)
Thanks. I'll try figure out all the other problems myself.
Feel free to post here, that's what this thread's supposed to be for you know :Punk:Zitat:
Zitat von CtrlAltDeleteDie
Homer - You're correct, there's bitwise and logical AND, OR operators. But bitwise can return more than 1 or 0 ;)
Oh and homer - You're good with emulators, per say, right? think you could help me with a little... problem... Ill pm you with details if you want to, id very appreciate it :)
Okay, sure. I might be able to help :tup:Zitat:
Zitat von SG57
Ok sweet, how can i contact you? AIM (recommended), MSN, IRC, PM (not recommened)?
I find it better to give you info in portions then one large PM :o
P.S. Thanks for this
Ok. I decided to post again...
I probably dont need to post all this, but I will anyways.
The main error I got was, "paint was not declared in this scope". As you can tell I have no idea what I am doing, but I am learning from trial and error.Code:int main(int argc, char* argv[])
{
//Initialize the different parts of the library
oslInit(0);
oslInitGfx(OSL_PF_8888, 1);
oslSetBkColor(RGBA(0,0,0,0));
oslSetTextColor(RGB(255,255,255));
oslInitConsole();
OSL_CONTROLLER *k;
//Main loop
while (!osl_quit)
{
//Display code
oslStartDrawing();
paint = oslLoadImageFile("ms0:/img.png", OSL_IN_VRAM, OSL_PF_8888);
//Draw
oslDrawGradientRect(0, 0, 480, 272, RGB(255,255,255), RGB(255,255,255), RGB(100,100,100), RGB(100,100,100));
oslDrawFillRect(50, 50, 150, 150, RGB(255,0,0));
.........
You haven't declared paint as a datatype, I have no idea what the image struct is called in oslib. I'm sure it says in the documentation though (if it has any).Code:paint = oslLoadImageFile("ms0:/img.png", OSL_IN_VRAM, OSL_PF_8888);
It's correct. 'paint' is uninitialized. What data type must 'paint' be? Proably a structure pointer, but... to what? (i dont know OSL)
EDIT
homer beat me to it :Argh:
The bitwise OR (|) take two numbers like this:Zitat:
110101101
101011101
------------
111111101
EDIT (or something).
I think the stuct you want is named OSL_IMAGE.
So the paint line should look like this
However, you probably want to put that outside (before) the main loop or it'll load the image on each loop :PCode:OSL_IMAGE *paint = oslLoadImageFile("ms0:/img.png", OSL_IN_VRAM, OSL_PF_8888);
Thanks again Homer. I dont know why I didn't include that in the code before.
can you help me?
the problem is, that it compiles but when i load it the screen isnt fully blue and when i useCode:#include <pspdisplay.h>
#include <pspgu.h>
#include <pspkernel.h>
#include <pspctrl.h>
#include <pspdebug.h>
#include <stdlib.h>
#include <stdio.h>
#include <math.h>
#include <time.h>
#include <png.h>
#include <string.h>
#include "graphics.h"
#include "framebuffer.h"
#include "flib.h"
#define printf pspDebugScreenPrintf
#define dprint pspDebugScreenPrintf
#define MAX(X, Y) ((X) > (Y) ? (X) : (Y))
#define true 1
#define false !true
#define bool int
#define NULL 0
PSP_MODULE_INFO("OMG HAX!!!!1", 0, 1, 1);
/* Standard callbacks */
int exit_callback(int arg1, int arg2, void *common) {
sceKernelExitGame();
return 0;
}
int CallbackThread(SceSize args, void *argp) {
int cbid;
cbid = sceKernelCreateCallback("Exit Callback", exit_callback, NULL);
sceKernelRegisterExitCallback(cbid);
sceKernelSleepThreadCB();
return 0;
}
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 rand_nums() {
short rn0 = 0;
short rn1 = 0;
short rn2 = 0;
bool win_status = false;
SceCtrlData pad;
sceCtrlPeekBufferPositive(&pad, 1);
srand(sceKernelLibcTime(NULL));
if(pad.Buttons & PSP_CTRL_CROSS) {
rn0=rand()%1,3;
rn1=rand()%1,3;
rn2=rand()%1,3;
}
if(rn0 == 1 && rn1 == 1 && rn2 == 1) {
win_status=true;
if(win_status == true) {
pspDebugScreenSetXY(0,2);
pspDebugScreenClear();
pspDebugScreenSetBackColor(0x00FF0000);
pspDebugScreenSetTextColor(0x00000000);
pspDebugScreenPrintf("You won.\n");
pspDebugScreenPrintf("Press '~X~' to restart.\n");
sceKernelSleepThread();
if(pad.Buttons & PSP_CTRL_CROSS) {
rand_nums();
}
}
}
if(rn0 == 2 && rn1 == 2 && rn2 == 2) {
win_status=true;
if(win_status == true) {
pspDebugScreenSetXY(0,2);
pspDebugScreenClear();
pspDebugScreenSetBackColor(0x00FF0000);
pspDebugScreenSetTextColor(0x00000000);
pspDebugScreenPrintf("You won.\n");
pspDebugScreenPrintf("Press '~X~' to restart.\n");
sceKernelSleepThread();
if(pad.Buttons & PSP_CTRL_CROSS) {
rand_nums();
}
}
}
if(rn0 == 3 && rn1 == 3 && rn2 ==3) {
win_status=true;
if(win_status == true) {
pspDebugScreenSetXY(0,2);
pspDebugScreenClear();
pspDebugScreenSetBackColor(0x00FF0000);
pspDebugScreenSetTextColor(0x00000000);
pspDebugScreenPrintf("You won.\n");
pspDebugScreenPrintf("Press '~X~' to restart.\n");
sceKernelSleepThread();
if(pad.Buttons & PSP_CTRL_CROSS) {
rand_nums();
}
}
}
if(rn0 == 0 && rn1 == 0 && rn2 == 0) {
pspDebugScreenSetXY(0,2);
pspDebugScreenClear();
pspDebugScreenSetBackColor(0x00FF0000);
pspDebugScreenSetTextColor(0x00000000);
pspDebugScreenPrintf("Press '~X~' to start\n");
sceKernelSleepThread();
if(pad.Buttons & PSP_CTRL_CROSS) {
pspDebugScreenSetXY(0,2);
pspDebugScreenClear();
pspDebugScreenSetBackColor(0x00FF0000);
pspDebugScreenSetTextColor(0x00000000);
rn0=rand()%1,3;
rn1=rand()%1,3;
rn2=rand()%1,3;
}
}
}
int main(void) {
pspDebugScreenInit();
SetupCallbacks();
initGraphics();
void show_errmsg(const char *errmsg);
while(true) {
rand_nums();
}
return 0;
}
It makes the screen flicker.Code:flipScreen();
Zitat:
Zitat von psphacker12.
its not :
its:Code:while (true) {
Code:while (1) {
ok ill try that thenZitat:
Zitat von Grimfate126
edit: that makes absolutley no difference..
Technically, if you define true as 1, it works ;)
duh...:p lolCode:#define true 1
hey, im not THAT dumb. ;)Zitat:
Zitat von SG57
psphacker, then i dunno whats wrong.. (too lazy to inspect the whole entire code.) :tup:
would anybody be kind enough and help me?
ive read the insomaniacs tutorial and i followed everything written on the screen..the last step claims to change the path to a certain thing
starts with @off
cywin worked before that, but now it doesnt start. does anybody know what the path to cygwin was before chainging it so i can reinstall the toolchain (im guessing thats my problem) although ive installed it already...
Edit://
I got it :) But thanks anybody to anyone willing to help...
Strings
Hi, I'm having troubles with strings recieved via TCP; I'm getting a string "[list of artists]" from a simple TCP echo server (you don't need to view this, all it does is recieve a command (string) from the client and answer "[list of artists]".
Spoiler for server code:
More relevant code; How the client recieves the string from the server:
IMHO seems fine, but look what he does:Code:command = "get_artists";
command_len = strlen(command);
if (send(socket, command, command_len, 0) != command_len) {
printf("send() sent a different length of bytes than expected!\n");
return;
}
printf("sending command get_artists...\n");
printf("recieving...\n");
while(rc!=SOCKET_ERROR)
{
printf("Recieving package %d\n", i);
rc = recv(socket,buf,256,0);
buf[rc]='\0';
if(rc==0)
{
printf("Server has closed the connnection\n");
break;
}
if(rc==SOCKET_ERROR)
{
printf("Error: recv, error-code: %s\n",strerror(errno));
break;
}
strcat(recivedMessage, " - ");
strcat(recivedMessage, buf);
printf("buf: %s\n", buf);
printf("recivedMessage: %s\n", recivedMessage);
i++;
}
printf("\n\nget_artists returned: %s\n", recivedMessage);
http://bombach.info/luke/psp_get_artists.jpg
Could it be that he prints buf, which as an array has the size of 265, completely, the whole 256 chars?
-= Double Post =-
PS: Damn that psp is dirty!
from the look at your picture:Zitat:
buf[rc]='\0';
if(rc==0)
{
printf("Server has closed the connnection\n");
break;
}
you set a Null terminating character depending on rc (recieved bytes).
In your photo you also see that the psp puts out "Server has closed the connection"
This only happens if rc==0;
so in your case yout set '\0' or 0x00 immediately at the first position of your char buffer.
Furthermore printf only puts out chars till he finds '\0' so it's clear why you don't get anything ;)
Im having trouble compiling a program in CYGWIN. It compiles an .elf file which i can just rename to a .pbp, but I gives an arror when it goes to make a .pbp. Ill post what CYGWIN spits out.
Help?Code:........
-lpspctrl -lpspsdk -lc -lpspnet -lpspnet_inet -lpspnet_apctl -lpspnet_resolver
-lpsputility -lpspuser -lpspkernel -o Square.elf
psp-fixup-imports Square.elf
psp-strip Select Square.elf -o Select Square_strip.elf
Usage: psp-strip <option(s)> in-file(s)
Removes symbols and sections from files
The options are:
-I --input-target=<bfdname> Assume input file is in format <bfdname>
-O --output-target=<bfdname> Create an output file in format <bfdname>
-F --target=<bfdname> Set both input and output format to <bfdname>
-p --preserve-dates Copy modified/access timestamps to the output
-R --remove-section=<name> Remove section <name> from the output
-s --strip-all Remove all symbol and relocation information
-g -S -d --strip-debug Remove all debugging symbols & sections
--strip-unneeded Remove all symbols not needed by relocations
--only-keep-debug Strip everything but the debug information
-N --strip-symbol=<name> Do not copy symbol <name>
-K --keep-symbol=<name> Only copy symbol <name>
-w --wildcard Permit wildcard in symbol comparison
-x --discard-all Remove all non-global symbols
-X --discard-locals Remove any compiler-generated symbols
-v --verbose List all object files modified
-V --version Display this program's version number
-h --help Display this output
--info List object formats & architectures supported
-o <file> Place stripped output into <file>
psp-strip: supported targets: elf32-littlemips elf32-bigmips elf64-bigmips elf64
-littlemips elf64-little elf64-big elf32-little elf32-big srec symbolsrec tekhex
binary ihex
make: *** [EBOOT.PBP] Error 1
Do you use the sdk makefile or your custom?
Makefile:
Code:TARGET = Select Square
OBJS = main.o
YOURLIBS=
INCDIR =
CFLAGS = -G4 -Wall -O2
CXXFLAGS = $(CFLAGS) -fno-exceptions -fno-rtti
ASFLAGS = $(CFLAGS)
LIBDIR =
LDFLAGS =
STDLIBS= -losl -lpng -lz \
-lpspsdk -lpspctrl -lpspumd -lpsprtc -lpsppower -lpspgu -lpspaudiolib -lpspaudio -lm
LIBS=$(STDLIBS)$(YOURLIBS)
EXTRA_TARGETS = EBOOT.PBP
PSP_EBOOT_TITLE = SelectPSP
PSPSDK=$(shell psp-config --pspsdk-path)
include $(PSPSDK)/lib/build.mak
Right o Chaps, i got a problem, Cygwin is broke, and i cant delete it to get rid of it to re-install..
It comes up with a Error saying the folder cant be deleted, but that is utter crap since i've tried numerous unlocking programs, and i'm also the owner of the folder according to windows security.
Anyway to delete this pile of steaming **** off my harddrive ?
So I put "buf[rc]='\0';" after the break, but he still prints those huge spaces instread of a nice and cleanZitat:
Zitat von tommydanger
sending command get_artists...
recieving...
Recieving package 1
buf: [list of artists]
recivedMessage: [list of artists]
Server has closed the connnection
get_artists returned: [list of artists]
What he prints:
http://bombach.info/luke/psp_get_artists2.jpg
no this is due to the linefeeds you added in your printf commands "\n"
last statement:
printf("\n\nget_artists returned: %s\n", recivedMessage);
make 2 linfeeds before writing the string ;)
such a huge space?Zitat:
Zitat von tommydanger
What? that'd be even more space!Zitat:
Zitat von tommydanger
-= Double Post =-
Could it be because 'buf' is a array of the size of 265?
-= Double Post =-
I reduced the size of the array to 56 and still get the same screen :((Zitat:
Could it be because 'buf' is a array of the size of 265?