yeh but what text...?Zitat:
Zitat von slicer4ever
Printable View
yeh but what text...?Zitat:
Zitat von slicer4ever
printf usually outputs to TTY over PSPLink. This is why I keep saying that printf should NOT be #defined to something else.
yaustar: why does the program on the previous page make my PSP freeze when ran?
No idea. Wild guess (depending on the size of the struct) stack overflow?Zitat:
Zitat von JaSo PsP
Reduce the number and see if it still runs?Code:SceIoDirent directoryEntry[MAX_DIRS];
As Archaemic said, add traces to your code to PSPLink and narrow down the line that is causing the crash.
sceIdStorageReadLeaf(idke y, dump);Code:int IdDump(const char* dst)
{
char PrintBin[56] , dump[512];
int BinSave;
u16 idkey;
BinSave = sceIoOpen(dst, PSP_O_CREAT | PSP_O_TRUNC | PSP_O_WRONLY, 0777);
if(BinSave<0) { return 0; }
pspDebugScreenClear();
for(idkey=0x000;idkey<=0x200;idkey++) // Ampliado desde 0x000 hasta 0x200 (anterior 0x004-0x127)
{
pspDebugScreenPrintf("key 0x%03X\n",idkey);
sprintf(PrintBin,"KEY : 0x%03X\n",idkey);
sceIoWrite(BinSave, PrintBin, 512);
sceIdStorageReadLeaf(idkey, dump);
sceIoWrite(BinSave, dump, 512);
}
sceIoClose(BinSave);
return 0;
}
it crashes at getting the first key:s
I am on the verge of crying. 8 hours for the toolchain. now sdl refuses to install. please tell me what's wrong somebody.
Also when running ./autogen.sh i get this:Code:[email protected] ~/sdl
$ make
Making all in src
make[1]: Entering directory `/home/Server2003/sdl/src'
.deps/SDL_error.Plo:1: *** multiple target patterns. Stop.
make[1]: Leaving directory `/home/Server2003/sdl/src'
make: *** [all-recursive] Error 1
This may be relevant to the problemCode:[email protected] ~/sdl
$ ./autogen.sh
Generating build information using aclocal, automake and autoconf
This may take a while ...
/usr/share/aclocal/libsmi.m4:8: warning: underquoted definition of AM_PATH_LIBSM
I
run info '(automake)Extending aclocal'
or see http://sources.redhat.com/automake/automake.html#Extending-aclocal
/usr/share/aclocal/cppunit.m4:4: warning: underquoted definition of AM_PATH_CPPU
NIT
/usr/share/aclocal/libsmi.m4:8: warning: underquoted definition of AM_PATH_LIBSM
I
run info '(automake)Extending aclocal'
or see http://sources.redhat.com/automake/automake.html#Extending-aclocal
/usr/share/aclocal/cppunit.m4:4: warning: underquoted definition of AM_PATH_CPPU
NIT
Now you are ready to run ./configure
Did you run the ./configure script? If so, with which parameters?
Code:LDFLAGS="-L$(psp-config --pspsdk-path)/lib -lc -lpspuser" \
./configure --host psp --prefix=$(psp-config --psp-prefix)
What's the full path to the SDL folder?
D:\cygwin\home\Server2003 \SDL
It may be something to do with automake. How do i force it to use automake 1.9 ? instead of 1.10 ?
i think i found my problem, i was supposed to add 'memset' to the code... Me thinks...
-= Double Post =-
WANT_AUTOMAKE="1.9" before you type make.Zitat:
Zitat von eldiablov
I remember what was in your sig :pZitat:
Zitat von eldiablov
erm. About popups ?
Cant you help me with my SDL problem ?
I would never recommend nor TRY SDL myself. But why would u need it?Zitat:
Zitat von eldiablov
BTW , your Sig was: "I drink a lot. I'm immature. I love myself. Sue me" Put it back. :p
no. I refuse :p. I want to port something which requires SDL. I normally wouldnt touch it with a barge pole.
how do you get the "main thread's stack size"????
how do you make a simple printf clock hh:mm:ss.
Fanjita's code in the Post your C examples ThreadCode:void CurrentTime( char * timeText) {
pspTime rtime;
sceRtcGetCurrentClockLocalTime(&rtime);
snprintf(timeText, 8, "%i:%02i" , rtime.hour , rtime.minutes);
}
^^ thank you
edit: what include do i need for the function sceRtcGetCurruentClockLoc alTime
psprtc.h
why wont this work. all it writes is a ' and thats it
and makefile:Code:void CurrentTime( char * timeText) {
pspTime rtime;
sceRtcGetCurrentClockLocalTime(&rtime);
snprintf( timeText, 8, "%i:%02i" , rtime.hour , rtime.minutes);
}
int main()
{
dsxSystemInit();
while(1)
{
dsxDrawingStart();
dsxDrawFontDefault(0, 100, GU_RGBA(0, 0, 0, 255), CurrentTime);
dsxDrawingEnd();
}
return 0;
}
Code:# Target Name
TARGET = battery
# Source Files
OBJS = ./main.o
#Build as a prx
BUILD_PRX = 1
# Libraries
LIBS = -ldsx -lpspgum -lpspgu -lm -lpsppower -lpsprtc -lpsphprm
# Misc.
INCDIR =
CFLAGS = -O2 -G0 -Wall
CXXFLAGS = $(CFLAGS) -fno-exceptions -fno-rtti
ASFLAGS = $(CFLAGS)
LIBDIR =
PSPSDK=$(shell psp-config --pspsdk-path)
include $(PSPSDK)/lib/build.mak
I'm surprised that that would even COMPILE.
Code:void CurrentTime( char * timeText) {
pspTime rtime;
sceRtcGetCurrentClockLocalTime(&rtime);
snprintf( timeText, 8, "%i:%02i" , rtime.hour , rtime.minutes);
}
int main()
{
dsxSystemInit();
char *time = malloc(sizeof(char)*9);
while(1)
{
CurrentTime(time);
dsxDrawingStart();
dsxDrawFontDefault(0, 100, GU_RGBA(0, 0, 0, 255), time);
dsxDrawingEnd();
}
return 0;
}
Well, the 'CurrentTime' doesnt return anything, void CurrentTime( char * timeText). When you put it in the drawfont function, it doesnt know what to write because that function returns void... The function may work better like this:
plus, when you used the function, you didnt put brackets after it '( char* timeText )' You were supposed to full it with what you wanted to fill...Code:char* CurrentTime() {
pspTime rtime;
char* timeText;
sceRtcGetCurrentClockLocalTime(&rtime);
snprintf( timeText, 8, "%i:%02i" , rtime.hour , rtime.minutes);
return timeText;
}
JaSo, that will cause nothing but trouble. You need to initialize timeText with some memory first.
that must be why i always get freezage when i use pointers with sprintf.... thanx :) ill use malloc more often.Zitat:
Zitat von Archaemic
this code returns the same results as the code i was using. just a ' on screenZitat:
Zitat von Archaemic
Try changing
dsxDrawFontDefault(0, 100, GU_RGBA(0, 0, 0, 255), time);
to
dsxDrawFontDefault(0, 100, GU_RGBA(255, 255, 255, 255), time);
im getting a warning from cygwin saying "passing arguement 4 of dsxDrawFontDefault from incompatible pointer type"Zitat:
Zitat von Archaemic
Then you don't have the code exactly as I have it.
Well, here's a better way anyway:
If that still doesn't work, then it's because I know nothing about DSX.Code:int main() {
dsxSystemInit();
pspTime time;
for(;;) {
dsxDrawingStart();
sceRtcGetCurrentClockLocalTime(&time);
dsxDrawFontDefault(0, 100, GU_RGBA(0, 0, 0, 255), "%i:%02i",time.hour,time.minutes);
dsxDrawingEnd();
}
return 0;
}
it works!! thank you so so muchZitat:
Zitat von Archaemic
my SDL problem is still alive. I have no idea what's wrong :(
Will calling func2 clear/free strings to NULL ??Code:void func1()
{
char strings[1000];
strcpy(strings,"blahbahlasdfasd");
func2(strings);
}
void func2(void *sh_t)
{
strcpy(sh_t,"");
}
I tried it But does it do the correct job/
You can only 'free()' something that was 'malloc()'d.
You could try.
Code:void clearString(char* string)
{
int i;
for(i = 0; i < strlen(string); i++)
{
string[i] = NULL;
}
}
it sets it empty, not NULL. you could do = NULL or free()... i dunno.Zitat:
Zitat von Mr305
I'm having a problem with fscanf, code that works on the PC doesn't work on the PSP. I'm trying to read a hex value from a file, the PC reads it fine, where as the PSP just gives me a 0, and thats it, so I'm just wondering if theres anything special I need to do on the PSP that I don't need to do on the PC?
Thanks.
-Aura
Can you show your routine for both the PC and the PSP?
Ignore what I said, the PC isn't reading it correctly either :Argh:
Guess thats what you get for trying to program at past midnight when your extreamly tired... Oh well, maybe I should just leave it for now, come back to it later.
-Aira
Or you can post it up and get some help. :)
Nah, unless I'm completely stumped I normally have a long hard look at what I'm doing to try and work it out... I find if I work it out I remember it, where as if someone else tells me I normally forget. Most of the time I end up working out little problems like this... just need another tea booster :tup:
-Aura
Variables declared within a function only have the scope of that function.Zitat:
Zitat von Mr305
Once the function ends the memory used by the function is no longer needed.
This doesn't apply to any malloc/calloc/realloc/memalign etc calls.