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; bleh IWN already took care of the 1.5 starting issue by putting a nice little message saying please start your ...
-
05-04-2008, 05:48 AM #8491QJ Gamer Gold

- Registriert seit
- Jul 2005
- Ort
- everywhere
- Beiträge
- 3.526
- Points
- 17.453
- Level
- 84
- Downloads
- 1
- Uploads
- 0
bleh IWN already took care of the 1.5 starting issue by putting a nice little message saying please start your game under 3xx kernel
anyways sg57 i'm already on IRC ton's you should join us, it's how IWN helped me with getting circle collision working on my Impact game
which i love the method IWN(and i feel stupid for what i had come up with) i can apply it to nearly any basic geometry shape=-)
anywho hope to see you on irc sg=-)
1. Failed....again...
2. http://slicer.gibbocool.com/ stay updated on all my projects
3. it'll be 5 years in june, that's nearly 1/4 of my life on this planet that i've visited these forums, what a ride it has been
-
05-04-2008, 11:31 AM #8492words 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
What channel are you on lol im on psp-programming and pspdev pretty regularly.

...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
-
05-04-2008, 04:10 PM #8493QJ Gamer Gold

- Registriert seit
- Jul 2005
- Ort
- everywhere
- Beiträge
- 3.526
- Points
- 17.453
- Level
- 84
- Downloads
- 1
- Uploads
- 0
o i thought you went to irc.malloc.us, or defiance, etc, etc on #exo (redirection of #psp), bleh but IWN told me that you went on freenode and not the servers i cruise so i'll pop on #psp-programming on freenode from now on
1. Failed....again...
2. http://slicer.gibbocool.com/ stay updated on all my projects
3. it'll be 5 years in june, that's nearly 1/4 of my life on this planet that i've visited these forums, what a ride it has been
-
05-06-2008, 07:22 AM #8494
- Registriert seit
- May 2008
- Beiträge
- 2
- Points
- 2.517
- Level
- 30
- Downloads
- 0
- Uploads
- 0
I'm fairly new to c programming (in general) and I want to know how you can give a defined variable a value by reading a .txt file (something like the dofile() function in LUA)
example:I need to give a value to a certain variable (F) I've declared in the program by reading a .txt file that has ,for instance, a line that says F = 1
--swizl
-
05-06-2008, 07:30 AM #8495
fgets your line of text into a buffer. run atoi or strtoul or its friends at the right offset to the number.... strchr/isspace etc are your friends. or get a string library like bstring.
Zitat von swizl
-- Code Monkey : Sarien, Fishguts, Cracks and Crevices --
"Did IQ's just drop sharply while I was away?" (Ripley)
-
05-06-2008, 07:39 AM #8496
- Registriert seit
- May 2008
- Beiträge
- 2
- Points
- 2.517
- Level
- 30
- Downloads
- 0
- Uploads
- 0
its friends? care to explain?
Zitat von _df_
-
05-06-2008, 10:30 AM #8497
ato_i == integer. it has friends for float..
-- Code Monkey : Sarien, Fishguts, Cracks and Crevices --
"Did IQ's just drop sharply while I was away?" (Ripley)
-
05-06-2008, 10:54 AM #8498QJ Gamer Silver

- Registriert seit
- Jun 2006
- Ort
- UK
- Beiträge
- 2.326
- Points
- 10.263
- Level
- 67
- Downloads
- 0
- Uploads
- 0
By 'friends', he/she means 'similar functions'.
[Blog] [Portfolio]
[Homebrew Illuminati - Serious Homebrew Development Forums]
[I want to make Homebrew FAQ] [How I broke into the Games Industry]
[Programming Book List] [Programming Article List]
-
05-07-2008, 04:30 AM #8499
hey yauster... nice to see familiar people ;) i dont go much anymore to the gp32x forums... are you mostly working on psp stuff now over gp2x? I think pandora will be out of my price range (and I dont quite like its aesthetics)..
-- Code Monkey : Sarien, Fishguts, Cracks and Crevices --
"Did IQ's just drop sharply while I was away?" (Ripley)
-
05-07-2008, 05:02 AM #8500QJ Gamer Silver

- Registriert seit
- Jun 2006
- Ort
- UK
- Beiträge
- 2.326
- Points
- 10.263
- Level
- 67
- Downloads
- 0
- Uploads
- 0
Honestly I am waiting on the Pandora, I am just working on some cross platform stuff at the moment and actual work.
[Blog] [Portfolio]
[Homebrew Illuminati - Serious Homebrew Development Forums]
[I want to make Homebrew FAQ] [How I broke into the Games Industry]
[Programming Book List] [Programming Article List]
-
05-07-2008, 08:43 AM #8501
I tried using SG57's fading in and out example(that he gave me a few posts ago) with Psilocybeing's graphics.h and here's what i got:
Spoiler for code:
I have 2 questions and 1 problem:
Question: Is there a better way to do this?
Question: Does graphics.h allow Alpha as part of a color?
Problem: I tried running this code as part of a project I'm helping a friend with and when I try running the program my PSP crashes (yes I've checked if the .png's are interlaced or not(like the last time I had a prob like this))
PLZ HELP
EDIT: Sorry for the code formatting for some reason it's not coming in the spoiler the way it's supposed to.
-
05-07-2008, 04:08 PM #8502QJ Gamer Bronze
- Registriert seit
- Jan 2007
- Ort
- Right here
- Beiträge
- 179
- Points
- 5.354
- Level
- 47
- Downloads
- 0
- Uploads
- 0
how can i use a custom module_start in a prx. when i compile it, i get the error "multiple definition of `module_start'"
here is my main.c
Code:#include <pspsdk.h> #include <pspkernel.h> #include <pspdebug.h> #define printf pspDebugScreenPrintf PSP_MODULE_INFO("prx", 0, 1, 0); int module_start(SceSize args, void *argp) { // variable initialization return 0; } int module_stop(SceSize args, void *argp) { return 0; }sudo rm -rf /
PSN ID: FigMan13
-
05-07-2008, 04:45 PM #8503It's good to be free...

- Registriert seit
- Feb 2007
- Beiträge
- 2.440
- Points
- 10.420
- Level
- 67
- Downloads
- 0
- Uploads
- 0
Replace "build.mak" with "build_prx.mak" in the Makefile.
pəʇuɒɹɓ ɹoɟ ɓuɪɥʇou əʞɒʇ
-
05-07-2008, 04:50 PM #8504words 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
Are you sure that's the code i gave you... I wrote mine in OSlib, and tested it, and it appears that in your attempt to convert it to graphics.h you kinda didn't see what was actually happening :P Try again, it's a good learning experience.btw, use code tags ([code])
Zitat von bnc9
Geändert von SG57 (05-07-2008 um 05:14 PM Uhr)

...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
-
05-07-2008, 04:59 PM #8505QJ Gamer Bronze
- Registriert seit
- Jan 2007
- Ort
- Right here
- Beiträge
- 179
- Points
- 5.354
- Level
- 47
- Downloads
- 0
- Uploads
- 0
thanks :)
Zitat von Archaemic
sudo rm -rf /
PSN ID: FigMan13
-
05-08-2008, 02:38 AM #8506
arghh.. still refuses to work I know I should have asked this question earlier but SG57:what is really going on in the code you gave me ?!?
-
05-08-2008, 03:00 PM #8507words 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
lol I don't have the code i gave you stored, can you PM me it? I'll help you that way a little bit more :)

...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
-
05-09-2008, 02:04 PM #8508
What do Analog stick values range at?
For Lx & Ly
Correct?Code:0 - 128(in centre) - 255
-
05-09-2008, 02:11 PM #8509It's good to be free...

- Registriert seit
- Feb 2007
- Beiträge
- 2.440
- Points
- 10.420
- Level
- 67
- Downloads
- 0
- Uploads
- 0
I think 127 is the center.
But yeah, it's unsigned, so that is indeed the range.pəʇuɒɹɓ ɹoɟ ɓuɪɥʇou əʞɒʇ
-
05-11-2008, 08:13 PM #8510
Achievements:
- Registriert seit
- May 2008
- Beiträge
- 3
- Points
- 2.505
- Level
- 30
- Downloads
- 0
- Uploads
- 0
What is wrong?
Hello, I am new to programming for the PSP and have started my own game but I want to add sound. Using the library in Lesson 06 of the tutorial (libmad, I think it was) made my game slow.
I want to use the player from this sample code. However when I try to compile the code I get
Any help? What causes this?Code:players/pspaudiolib.o: In function `audioOutpuBlocking': pspaudiolib.c:(.text+0x80): undefined reference to `sceAudio_E0727056' players/pspaudiolib.o: In function `pspReleaseAudio': pspaudiolib.c:(.text+0xa0): undefined reference to `sceAudio_5C37C0AE' players/pspaudiolib.o: In function `setFrequency': pspaudiolib.c:(.text+0xb0): undefined reference to `sceAudio_38553111' players/pspaudiolib.o: In function `pspAudioOutBlocking': pspaudiolib.c:(.text+0xe8): undefined reference to `sceAudio_E0727056' players/pspaudiolib.o: In function `AudioChannelThread': pspaudiolib.c:(.text+0x190): undefined reference to `sceAudio_E0727056' players/pspaudiolib.o: In function `pspAudioSetFrequency': pspaudiolib.c:(.text+0x2fc): undefined reference to `sceAudio_5C37C0AE' pspaudiolib.c:(.text+0x30c): undefined reference to `sceAudio_38553111' players/pspaudiolib.o: In function `pspAudioEnd': pspaudiolib.c:(.text+0x3f4): undefined reference to `sceAudio_5C37C0AE' players/pspaudiolib.o: In function `pspAudioInit': pspaudiolib.c:(.text+0x4f8): undefined reference to `sceAudio_5C37C0AE' pspaudiolib.c:(.text+0x508): undefined reference to `sceAudio_38553111' pspaudiolib.c:(.text+0x778): undefined reference to `sceAudio_5C37C0AE' players/player.o: In function `audioOutput': player.c:(.text+0x1c4): undefined reference to `sceAudio_E0727056' players/player.o: In function `releaseAudio': player.c:(.text+0x1e4): undefined reference to `sceAudio_5C37C0AE' players/player.o: In function `setAudioFrequency': player.c:(.text+0x1f4): undefined reference to `sceAudio_38553111' /usr/local/pspdev/lib/gcc/psp/4.1.0/../../../../psp/lib/libFLAC.a(ogg_decoder_aspect.o): In function `FLAC__ogg_decoder_aspect_read_callback_wrapper': ogg_decoder_aspect.c:(.text+0x160): undefined reference to `ogg_sync_buffer' /usr/local/pspdev/lib/gcc/psp/4.1.0/../../../../psp/lib/libFLAC.a(ogg_decoder_aspect.o): In function `FLAC__ogg_decoder_aspect_finish': ogg_decoder_aspect.c:(.text+0x33c): undefined reference to `ogg_sync_clear' ogg_decoder_aspect.c:(.text+0x350): undefined reference to `ogg_stream_clear' /usr/local/pspdev/lib/gcc/psp/4.1.0/../../../../psp/lib/libFLAC.a(ogg_decoder_aspect.o): In function `FLAC__ogg_decoder_aspect_init': ogg_decoder_aspect.c:(.text+0x36c): undefined reference to `ogg_stream_init' ogg_decoder_aspect.c:(.text+0x394): undefined reference to `ogg_sync_init' collect2: ld returned 1 exit status make: *** [softwareplayers.elf] Error 1
Thanks a lot,
Justin
-
05-11-2008, 09:15 PM #8511It's good to be free...

- Registriert seit
- Feb 2007
- Beiträge
- 2.440
- Points
- 10.420
- Level
- 67
- Downloads
- 0
- Uploads
- 0
Install libogg, and also add -lpspaudio to the LIBS line in your makefile.
pəʇuɒɹɓ ɹoɟ ɓuɪɥʇou əʞɒʇ
-
05-11-2008, 09:32 PM #8512QJ Gamer Bronze
- Registriert seit
- Aug 2007
- Ort
- Everywhere
- Beiträge
- 206
- Points
- 5.826
- Level
- 49
- Downloads
- 0
- Uploads
- 0
Hi. I am trying to start coding in c/c++...
I've finally got the toolchain and stuff setup to compile some stuff successfully.
I followed a short tutorial on writing a Hello World and it compiled and ran fine on the psp.
But I wanted to code in the 3.xx kernel instead of getting into the 1.5 kernel. So, I looked up how to do this and found this http://www.ghoti.nl/PSPtutorialm0.php.
I followed all the instructions and compiled fine, but it wont run on the psp. I'm thinking it's because of this...
Won't having functions that deal with kernel not work in 3.xx?Code: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; }
What would I replace these functions with if this is whats causing the crash?
I'm sorry if this is a stupid question. This is my first time messing with c/c++.
I've been messing with lua, and I use to write Java a bunch (not for psp, for pc), but this is a bit different.
My source code is very simple and short, if this isn't the problem you could take a quick look at it.
main.c
Makefile
I appreciate any help.
Thanks!Geändert von chrisp6825 (05-12-2008 um 01:23 PM Uhr) Grund: wrong link.. :P
-
05-11-2008, 09:37 PM #8513It's good to be free...

- Registriert seit
- Feb 2007
- Beiträge
- 2.440
- Points
- 10.420
- Level
- 67
- Downloads
- 0
- Uploads
- 0
Those are all usermode functions. They just call on the kernel to do something.
pəʇuɒɹɓ ɹoɟ ɓuɪɥʇou əʞɒʇ
-
05-11-2008, 09:47 PM #8514words 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
Describe what is happening chrisp, because if you are running that app in 3.xx kernel it should display "Hello World" and do nothing. You can press home and exit though...

...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
-
05-12-2008, 01:15 PM #8515QJ Gamer Bronze
- Registriert seit
- Aug 2007
- Ort
- Everywhere
- Beiträge
- 206
- Points
- 5.826
- Level
- 49
- Downloads
- 0
- Uploads
- 0
Well, basically nothing is happening. I made the changes that it says to in that page, then I compiled it and stuck it in the GAME folder on my psp and it says the game can't be started. Before I changed it at all, it ran fine. I had it in the GAME folder and it still ran.
Zitat von SG57
My psp is fat 3.71-4 m33 with 1.5 kernal 2 on 3.71 kernel.
I moved it to the GAME150 folder and it just freezes in the gameboot.
When I made those changes and compiled, it gave me a prx file, so... maybe I might have to put it in with the game too? I don't think it's the problem but I'll try it.
Edit -
No, it didn't fix it. Does this page say to do everything I need to do? Is it leaving anything out?
Thanks for the help guys.Geändert von chrisp6825 (05-12-2008 um 01:27 PM Uhr)
-
05-12-2008, 01:33 PM #8516
What is the Fastest way to check if a string has an ending "\n", if not add one?

I'm doing this:
Code:if(text_lists[currprintnum][strlen(pb_text_lists[currprintnum])-1]!='\n')
Correct? :)
Or Am I supposed to use strcmp?
-
05-12-2008, 01:39 PM #8517It's good to be free...

- Registriert seit
- Feb 2007
- Beiträge
- 2.440
- Points
- 10.420
- Level
- 67
- Downloads
- 0
- Uploads
- 0
Can we see your Makefile?
Zitat von chrisp6825
pəʇuɒɹɓ ɹoɟ ɓuɪɥʇou əʞɒʇ
-
05-12-2008, 01:53 PM #8518QJ Gamer Bronze
- Registriert seit
- Aug 2007
- Ort
- Everywhere
- Beiträge
- 206
- Points
- 5.826
- Level
- 49
- Downloads
- 0
- Uploads
- 0
Sure..
Zitat von Archaemic
Spoiler for Makefile:
And heres the main.c just in case...
Spoiler for main.c:
-
05-12-2008, 02:13 PM #8519
no. that will fault if your string is ""...
Zitat von Mr305
try if(strchr(foo, '\n') != NULL)-- Code Monkey : Sarien, Fishguts, Cracks and Crevices --
"Did IQ's just drop sharply while I was away?" (Ripley)
-
05-12-2008, 02:54 PM #8520
Achievements:
- Registriert seit
- May 2008
- Beiträge
- 3
- Points
- 2.505
- Level
- 30
- Downloads
- 0
- Uploads
- 0
I installed libogg by following the directions here but I still get the same ogg errors. Also -lpspaudio is already there.
Zitat von Archaemic
Thanks,
Justin


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