Zeige Ergebnis 2.341 bis 2.370 von 10174
C/C++ Programming Help Thread
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; TUW, please add me on msn...
-
12-15-2006, 01:27 PM #2341is not posting very often

- Registriert seit
- Feb 2006
- Ort
- omnipresent
- Beiträge
- 5.162
- Points
- 33.152
- Level
- 100
- Downloads
- 0
- Uploads
- 0
TUW, please add me on msn
What did we think the world would look like in 2015?
http://forums.qj.net/501501-post26.html
Zitat von Abe
-
12-15-2006, 01:29 PM #2342The Unique Developer

- Registriert seit
- Oct 2006
- Ort
- Canada
- Beiträge
- 1.059
- Points
- 7.101
- Level
- 55
- Downloads
- 0
- Uploads
- 0
I have no time ... maybe later.
too busy with gf now :/Malloc.Us Network Administrator
Decryption of the Encrypted
You are the unseen, the unstoppable and in power of your code. The God of your software.
-
12-15-2006, 01:31 PM #2343is not posting very often

- Registriert seit
- Feb 2006
- Ort
- omnipresent
- Beiträge
- 5.162
- Points
- 33.152
- Level
- 100
- Downloads
- 0
- Uploads
- 0
oh ok lol.
What did we think the world would look like in 2015?
http://forums.qj.net/501501-post26.html
Zitat von Abe
-
12-15-2006, 01:32 PM #2344Heroes never die

- Registriert seit
- Aug 2006
- Ort
- ...........
- Beiträge
- 1.323
- Points
- 8.645
- Level
- 62
- Downloads
- 0
- Uploads
- 0
i overwrited the SDK with the HENSDK
-
12-15-2006, 01:34 PM #2345is not posting very often

- Registriert seit
- Feb 2006
- Ort
- omnipresent
- Beiträge
- 5.162
- Points
- 33.152
- Level
- 100
- Downloads
- 0
- Uploads
- 0
u mean overwrote
What did we think the world would look like in 2015?
http://forums.qj.net/501501-post26.html
Zitat von Abe
-
12-15-2006, 01:35 PM #2346Heroes never die

- Registriert seit
- Aug 2006
- Ort
- ...........
- Beiträge
- 1.323
- Points
- 8.645
- Level
- 62
- Downloads
- 0
- Uploads
- 0
yeah;)
-
12-15-2006, 01:40 PM #2347is not posting very often

- Registriert seit
- Feb 2006
- Ort
- omnipresent
- Beiträge
- 5.162
- Points
- 33.152
- Level
- 100
- Downloads
- 0
- Uploads
- 0
if there's any good C devs here willing to help me then please add me on MSN- [email protected] much appreciated
What did we think the world would look like in 2015?
http://forums.qj.net/501501-post26.html
Zitat von Abe
-
12-15-2006, 01:54 PM #2348Heroes never die

- Registriert seit
- Aug 2006
- Ort
- ...........
- Beiträge
- 1.323
- Points
- 8.645
- Level
- 62
- Downloads
- 0
- Uploads
- 0
i want help , but i am not good;)
-
12-15-2006, 02:24 PM #2349The Unique Developer

- Registriert seit
- Oct 2006
- Ort
- Canada
- Beiträge
- 1.059
- Points
- 7.101
- Level
- 55
- Downloads
- 0
- Uploads
- 0
please don't edit the SDK if you don't know how to...
so hallo007 use SE-SDK with the real SDK don't change it!
Thanks,
TUWMalloc.Us Network Administrator
Decryption of the Encrypted
You are the unseen, the unstoppable and in power of your code. The God of your software.
-
12-15-2006, 02:37 PM #2350is not posting very often

- Registriert seit
- Feb 2006
- Ort
- omnipresent
- Beiträge
- 5.162
- Points
- 33.152
- Level
- 100
- Downloads
- 0
- Uploads
- 0
how do you list a directory in C.
and then how do you kind of use each file.What did we think the world would look like in 2015?
http://forums.qj.net/501501-post26.html
Zitat von Abe
-
12-15-2006, 02:59 PM #2351words are stones in my <3

- Registriert seit
- Jul 2005
- Ort
- Spokane
- Beiträge
- 5.008
- Points
- 35.274
- Level
- 100
- My Mood
-
- Downloads
- 1
- Uploads
- 0
Word of advice to any that are doing some calculations such as this. Order of Operations is important, if you hadnt already knew.
Gave me a little trouble ;)Code://simplest parabola y = -x^2 // when x = 5, it comes out as -25, not 25 as it calculates exponents than multiplication // simplest parabola y=(-x)^2 // when x 5, it comes out as 25, not -25 as it multiplies x by -1, than squares it
My fountain was going downward rather than upward and i was baffled until i did a quick check on my math. Very important stuff ;)
Glyndder - Why are you ASKING people to do things for you? I believe you know where the 'pspiofilemgr.h' header is in your SDK. Not to mention a quick source code skim of multiple apps will help you without having people do it for you, in a sense.
-= Double Post =-
Or you couldd use the dirent library. Google dirent in C or directory browser dirent in C.
See what happensGeändert von SG57 (12-15-2006 um 02:59 PM Uhr) Grund: Automerged Doublepost

...at what speed must I live.. to be able to see you again?...
Projects
You can support my Open World 3D RPG for PSP by voting for it here
-
12-15-2006, 03:24 PM #2352is not posting very often

- Registriert seit
- Feb 2006
- Ort
- omnipresent
- Beiträge
- 5.162
- Points
- 33.152
- Level
- 100
- Downloads
- 0
- Uploads
- 0
thanks!
I didnt think of looking at the io header in the sdk.What did we think the world would look like in 2015?
http://forums.qj.net/501501-post26.html
Zitat von Abe
-
12-15-2006, 03:33 PM #2353The Unique Developer

- Registriert seit
- Oct 2006
- Ort
- Canada
- Beiträge
- 1.059
- Points
- 7.101
- Level
- 55
- Downloads
- 0
- Uploads
- 0
Alex_G -->
and my photoEntry struct is this :Code:void GetDirectoryList(const char *root){ struct SceIoDirent dir; memset(&dir, 0, sizeof(SceIoDirent)); static int dfd; dfd = sceIoDopen(root); if(dfd > 0){ int f=0;for(f=0;f<MAX_ENTRIES;f++){if(photoEntry[f].name){free(photoEntry[f].name);}photoEntry[f].name = NULL;} int count = 0;count = 0; while(sceIoDread(dfd, &dir) > 0){ static char* name; name = (char*)memalign(16,300); sprintf(name,"%s/%s", root, dir.d_name); static int s=0; s=strlen(name); photoEntry[count].name = strupr(name); photoEntry[count].length = s; // check for a file if (FIO_S_IFREG & (dir.d_stat.st_mode & FIO_S_IFMT)) { photoEntry[count].type =FIO_SO_IFREG; } // check for a folder if (FIO_S_IFDIR & (dir.d_stat.st_mode & FIO_S_IFMT)) { photoEntry[count].type =FIO_SO_IFDIR; } count++;if(count>MAX_ENTRIES-1){count = MAX_ENTRIES-1;} photoEntriesTotal = count;if(photoEntriesTotal < 0){photoEntriesTotal = 0;} } } sceIoDclose(dfd); }
and its defined like this :Code:struct PhotoEntry { char *name; int type; int length; };
:)Code:#define MAX_ENTRIES 100 struct PhotoEntry photoEntry[MAX_ENTRIES];
Geändert von the unique warrior (12-15-2006 um 03:48 PM Uhr)
Malloc.Us Network Administrator
Decryption of the Encrypted
You are the unseen, the unstoppable and in power of your code. The God of your software.
-
12-15-2006, 03:45 PM #2354words are stones in my <3

- Registriert seit
- Jul 2005
- Ort
- Spokane
- Beiträge
- 5.008
- Points
- 35.274
- Level
- 100
- My Mood
-
- Downloads
- 1
- Uploads
- 0
TUW - I do so hate your un-indenting coding methods... with a passion ;)

...at what speed must I live.. to be able to see you again?...
Projects
You can support my Open World 3D RPG for PSP by voting for it here
-
12-15-2006, 03:49 PM #2355The Unique Developer

- Registriert seit
- Oct 2006
- Ort
- Canada
- Beiträge
- 1.059
- Points
- 7.101
- Level
- 55
- Downloads
- 0
- Uploads
- 0
You do??!!! oh well what can I say .... its me :)
Zitat von SG57
Malloc.Us Network Administrator
Decryption of the Encrypted
You are the unseen, the unstoppable and in power of your code. The God of your software.
-
12-15-2006, 04:16 PM #2356QJ Gamer Silver
- Registriert seit
- Sep 2006
- Ort
- Finland
- Beiträge
- 752
- Points
- 7.385
- Level
- 57
- Downloads
- 0
- Uploads
- 0
I agree with SG57, code which isn't indented is horrible to read. Indent, it's good for everyone, the writers and the readers :P
Zitat von the unique warrior
Actually, when I started coding, I kinda just started indenting like automatically, I couldn't even think about NOT indenting :P
But yeah, whatever. Anyone have any idea how the DH Launcher launches devhook? I can't find anything on a quick look in the launcher sources
wheeee =:D
-
12-15-2006, 04:32 PM #2357The Unique Developer

- Registriert seit
- Oct 2006
- Ort
- Canada
- Beiträge
- 1.059
- Points
- 7.101
- Level
- 55
- Downloads
- 0
- Uploads
- 0
if you guys check uflash's source out you'll see that its indented :)
and that code was simply taken from ps2de forums I only changed the sruct and added file type and length .
:PMalloc.Us Network Administrator
Decryption of the Encrypted
You are the unseen, the unstoppable and in power of your code. The God of your software.
-
12-15-2006, 04:33 PM #2358words are stones in my <3

- Registriert seit
- Jul 2005
- Ort
- Spokane
- Beiträge
- 5.008
- Points
- 35.274
- Level
- 100
- My Mood
-
- Downloads
- 1
- Uploads
- 0
mATIAZ - I dont have a PSP, so cant help you there... As for the indenting, i do it automatically since it makes my code structured in a sense, and i can easily go back and forth without getting lost in nested loops and whatnot. I dont see how TUW gets anything efficiently done ;) jk
EDIT
Ok, gotcha ;)
...at what speed must I live.. to be able to see you again?...
Projects
You can support my Open World 3D RPG for PSP by voting for it here
-
12-15-2006, 04:42 PM #2359QJ Gamer Green
- Registriert seit
- Feb 2006
- Ort
- Australia - A.C.T.
- Beiträge
- 1.517
- Points
- 9.253
- Level
- 64
- Downloads
- 0
- Uploads
- 0
i normaly indent when i'm cleaning up the code befor release
Spoiler for LOL:
-
12-15-2006, 04:55 PM #2360The Unique Developer

- Registriert seit
- Oct 2006
- Ort
- Canada
- Beiträge
- 1.059
- Points
- 7.101
- Level
- 55
- Downloads
- 0
- Uploads
- 0
well its better to code indented ;)
Malloc.Us Network Administrator
Decryption of the Encrypted
You are the unseen, the unstoppable and in power of your code. The God of your software.
-
12-15-2006, 08:32 PM #2361
- Registriert seit
- Nov 2006
- Beiträge
- 11
- Points
- 3.593
- Level
- 37
- Downloads
- 0
- Uploads
- 0
Hello. I'm trying to get a scrollbar working. It's halfway here, but I can't seem to find the error that is keeping it from being 100% working.
Anyways, what I am trying to do is display only 5 words in a list of 9 words, lets say as an example; 1000, 2000, 3000, .... 9000. So for instance, it would display 1000 to 5000 on startup: ex
1000
2000
3000
4000
5000
One of the numbers would be highlighted, for instance; 1000. When you scroll down, only the 2000 will be highlighted instead. When you scroll past 3000, instead of just highlighting the next number, the whole list will move down, ex:
2000
3000
4000 (now highlighted)
5000
6000
and so on.
It works okay, exept that my code displays something like this:
1000
20001000
300020001000
4000300020001000
50004000300020001000
The highlighting and scrolling work like I intended, by for some reason, each line repeats all the numbers. Here is my code, can anyone spot the problem? Thanks!
P.S. Ignore any extra includes and such in the code, it will be part of a bigger code.
Code:#include <pspkernel.h> #include <pspdisplay.h> #include <pspctrl.h> #include <stdio.h> #include <stdlib.h> #include <psppower.h> #include <pspgu.h> #include <png.h> #include <time.h> #include "graphics.h" PSP_MODULE_INFO("test", 0, 1, 1); #define RGB(r, g, b) ((r)|((g)<<8)|((b)<<16)) /* 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; } char test1 [4] = "1000"; char test2 [4] = "2000"; char test3 [4] = "3000"; char test4 [4] = "4000"; char test5 [4] = "5000"; char test6 [4] = "6000"; char test7 [4] = "7000"; char test8 [4] = "8000"; char test9 [4] = "9000"; int x = 1; // number to find which 5 words to display int y = 0; // number for highlighting int i; int counter; Color highlightColor = RGB(200, 200, 200); Color dimmedColor = RGB(100, 100, 100); Color shadowColorH = RGB(55, 55, 55 ); Color shadowColorD = RGB(55, 55, 55 ); int main(void) { scePowerSetClockFrequency(333, 333, 166); SetupCallbacks(); initGraphics(); SceCtrlData pad; while (1) { counter = 0; for(i=x; i<x + 5; i++) { // for all 5 lines that need to be displayed counter++; // which line of the 5 lines to write if (i == x+y) { // if we are on a line that needs to be highlighted, display the highlighted words if (i == 1) { printTextScreen(30, counter*10, test1, highlightColor); } else if (i == 2) { printTextScreen(30, counter*10, test2, highlightColor); } else if (i == 3) { printTextScreen(30, counter*10, test3, highlightColor); } else if (i == 4) { printTextScreen(30, counter*10, test4, highlightColor); } else if (i == 5) { printTextScreen(30, counter*10, test5, highlightColor); } else if (i == 6) { printTextScreen(30, counter*10, test6, highlightColor); } else if (i == 7) { printTextScreen(30, counter*10, test7, highlightColor); } else if (i == 8) { printTextScreen(30, counter*10, test8, highlightColor); } else if (i == 9) { printTextScreen(30, counter*10, test9, highlightColor); } } else { // if not a words thats to be highlighted, display the shaded word if (i == 1) { printTextScreen(30, counter*10, test1, shadowColorD); } else if (i == 2) { printTextScreen(30, counter*10, test2, shadowColorD); } else if (i == 3) { printTextScreen(30, counter*10, test3, shadowColorD); } else if (i == 4) { printTextScreen(30, counter*10, test4, shadowColorD); } else if (i == 5) { printTextScreen(30, counter*10, test5, shadowColorD); } else if (i == 6) { printTextScreen(30, counter*10, test6, shadowColorD); } else if (i == 7) { printTextScreen(30, counter*10, test7, shadowColorD); } else if (i == 8) { printTextScreen(30, counter*10, test8, shadowColorD); } else if (i == 9) { printTextScreen(30, counter*10, test9, shadowColorD); } } } sceCtrlReadBufferPositive(&pad, 1); if (pad.Buttons & PSP_CTRL_UP) { if ((x > 1) & (y == 2)) { // if up button pressed and we are not at top of page and the highlighted word is the middle word x -= 1; // scroll up } else if (y > 0) { // if at top of the page or highlighted word is not in middle of scrollbar y -= 1; // highlight word abouve this one } } else if (pad.Buttons & PSP_CTRL_DOWN) { // reverse as up if ((x < 5) & (y == 2)) { x += 1; } else if (y < 4) { y += 1; } } flipScreen(); clearScreen(0); for(i=0; i<10; i++) { sceDisplayWaitVblankStart(); } } return 0; }
-
12-16-2006, 05:38 AM #2362Heroes never die

- Registriert seit
- Aug 2006
- Ort
- ...........
- Beiträge
- 1.323
- Points
- 8.645
- Level
- 62
- Downloads
- 0
- Uploads
- 0
how do you do that??
Zitat von the unique warrior
justput it in pspdev??
sdk/
HENsdk/
-= Double Post =-
how doyou let the user select an file in a map if you dont know wich files and how any files there are in
(like an mpplayer)Geändert von hallo007 (12-16-2006 um 05:38 AM Uhr) Grund: Automerged Doublepost
-
12-16-2006, 10:59 AM #2363QJ Gamer Silver
- Registriert seit
- Sep 2006
- Ort
- Finland
- Beiträge
- 752
- Points
- 7.385
- Level
- 57
- Downloads
- 0
- Uploads
- 0
Yeah, exactly :P
Zitat von SG57
wheeee =:D
-
12-16-2006, 11:00 AM #2364QJ Gamer Silver

- Registriert seit
- Jun 2006
- Ort
- UK
- Beiträge
- 2.326
- Points
- 10.263
- Level
- 67
- Downloads
- 0
- Uploads
- 0
That didn't give you warnings or errors?
Zitat von zwnage
The array is not large enough for the strings as it doesn't have enough room for a null terminator.Code:char test1 [4] = "1000"; char test2 [4] = "2000"; char test3 [4] = "3000"; char test4 [4] = "4000"; char test5 [4] = "5000"; char test6 [4] = "6000"; char test7 [4] = "7000"; char test8 [4] = "8000"; char test9 [4] = "9000";
Switch it to:
Code:char test1 [] = "1000"; char test2 [] = "2000"; char test3 [] = "3000"; char test4 [] = "4000"; char test5 [] = "5000"; char test6 [] = "6000"; char test7 [] = "7000"; char test8 [] = "8000"; char test9 [] = "9000";
-
12-16-2006, 03:29 PM #2365words are stones in my <3

- Registriert seit
- Jul 2005
- Ort
- Spokane
- Beiträge
- 5.008
- Points
- 35.274
- Level
- 100
- My Mood
-
- Downloads
- 1
- Uploads
- 0
Or, to put it another way... Every character array must be terminated by a NULL char. that char is '\0'. By not setting a character array's size on declaration, anything you initializing it to, will automatically size the array to how ever amny chars there are + 1 null terminating char...
You could have also just changed the 4 to 5 as the size of the arrays. But, if you plan to make a 5 digit number or word in the strings anywhere, best increase it to whatever you need (5 digits = 6, 6 digits = 7, etc.)
But heads way is perfect (saves you time counting)
...at what speed must I live.. to be able to see you again?...
Projects
You can support my Open World 3D RPG for PSP by voting for it here
-
12-17-2006, 04:13 AM #2366QJ Gamer Green
- Registriert seit
- Feb 2006
- Ort
- Australia - A.C.T.
- Beiträge
- 1.517
- Points
- 9.253
- Level
- 64
- Downloads
- 0
- Uploads
- 0
ok how would i go about making an app which can go from plain text to ascii and back the other way is there any straight forward code or would it be quite complex to code?
how hard would it be to port this code over it looks very much like C (i know it's java script)
Spoiler for CODE:Geändert von mafia1ft (12-17-2006 um 05:00 AM Uhr)
Spoiler for LOL:
-
12-17-2006, 08:59 AM #2367Developer

- Registriert seit
- Oct 2005
- Beiträge
- 408
- Points
- 7.058
- Level
- 55
- Downloads
- 0
- Uploads
- 0
Actually he's overallocating. It would be perfectly valid to define char test1[1] = "1000"; as the actual data is static text.
Zitat von head_54us
-
12-17-2006, 09:37 AM #2368
- Registriert seit
- Nov 2006
- Beiträge
- 11
- Points
- 3.593
- Level
- 37
- Downloads
- 0
- Uploads
- 0
Thanks for the help! I increased the array size, and it works now! Thanks a bunch, I would have never been able to find that error myself (and there was no error warnings). :)
-
12-17-2006, 09:52 AM #2369QJ Gamer Silver

- Registriert seit
- Jun 2006
- Ort
- UK
- Beiträge
- 2.326
- Points
- 10.263
- Level
- 67
- Downloads
- 0
- Uploads
- 0
mafia1ft: Plain text is ascii
I still think he is under allocating as he is explictly allocating 4 bytes for the string whereas
Zitat von Samstag
char * text = "dslkfljsf";
Would be fine.
-
12-17-2006, 03:29 PM #2370QJ Gamer Green
- Registriert seit
- Jul 2006
- Ort
- USA SC/NC
- Beiträge
- 699
- Points
- 5.712
- Level
- 48
- Downloads
- 0
- Uploads
- 0
Ok, I am new to PSP programming although I have some experience with C++.
I am using PSP-Programming as a guide to get me started with the basics. I understand quite a bit now. My question is wtf is wrong with this!!!!!! LOL. I get an error that I dont really understand. Could someone please tell me why I get this error/s
error: Syntax error before "}" token.
I really need some help with this. Could someone explian to me whjy I get this error. My code is below. It is a simple image load from PSP-Programming. Help. It looks way better on Bloodshed so please bear with me. :P
I typed all of it except a comment by hand. There may be spelling errors, but I do not see any.
Spoiler for Hi. Im Moca. !!!!:[CODE]Random Facts:
irc://irc.malloc.us #wtf #**********
[/CODE]
[SIZE="6"][FONT="Century Gothic"][COLOR="Blue"][URL="http://forums.**********.net"]http://forums.**********.net[/URL][/COLOR][/FONT][/SIZE]


LinkBack URL
About LinkBacks
Mit Zitat antworten

Hello everyone I am new here and I am glad to be part of this amazing community and I think there...
New to forum