Zeige Ergebnis 9.151 bis 9.180 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; Thanks, guys....
-
10-08-2008, 02:39 PM #9151
- Registriert seit
- Apr 2008
- Beiträge
- 47
- Points
- 2.658
- Level
- 31
- Downloads
- 0
- Uploads
- 0
Thanks, guys.
-
10-10-2008, 07:06 AM #9152QJ Gamer Green
- Registriert seit
- Apr 2008
- Ort
- in a hobbit hole
- Beiträge
- 67
- Points
- 6.366
- Level
- 52
- Downloads
- 0
- Uploads
- 0
SDK dialog, net sample problems
I'm trying to integrate the NetDialog code into mine, but when I compile it, I just get a blank screen. None of the dialog samples work either.
I've tried compiling the original sample code, same thing. All I get is the spinning cube.
Also when I compiled the simple server (?) net sample, it goes to connection state 2 and stops there, waiting.
With the dialog samples, I get an undefined reference error at SceUtilityMsgDialogParams , even if psputility.h is #included, and -lpsputility is in LIBS.
static void ShowMessageDialog(const char *message)
{
SceUtilityMsgDialogParams dialog;
But if I try to typedef _SceUtilityMsgDialogParam s, I find that it is already declared!
I'm on 4.01 M33-2 with 1.50 addon - just to get PSPLink to run. I was hoping to code for 3xx/4xx, but I couldn't find a version of PSPLink for 3xx.
I recently re-ran (Dan peori's) toolchain installer to get the latest pspsdk.
Am I doing something wrong? Am I getting the correct SDK?
I have the pspsdk setup on Ubuntu.
-
10-10-2008, 09:40 AM #9153Developer

- Registriert seit
- Mar 2006
- Beiträge
- 1.026
- Points
- 7.577
- Level
- 58
- Downloads
- 0
- Uploads
- 0
Ensure you're compiling for the 3xx+ kernel. The netdialog sample is already setup to build this way.
All you do to do is 'make' the project, then transfer the single resulting EBOOT.PBP to a folder within PSP/GAME4xx and then run it.
It's pspUtilityMsgDialogParams , not sceUtilityMsgDialogParams .
The 3xx+ version of psplink is in the release_oe folder when you compile psplinkusb.
Check out my homebrew & C tutorials at http://insomniac.0x89.org/
Coder formerly known as Insomniac197
tshirtz: what is irshell ??
Atarian_: it's where people who work for the IRS go when they die
-
10-14-2008, 06:41 AM #9154QJ Gamer Green
- Registriert seit
- Apr 2008
- Ort
- in a hobbit hole
- Beiträge
- 67
- Points
- 6.366
- Level
- 52
- Downloads
- 0
- Uploads
- 0
Thanks,
Problem solved itself when I reinstalled the toolchain itself, instead of just PSPSDK.
I ran into a little problem compiling GCC, as it was looking for GMP and MFPR. There were some things I had to do to get it to compile.
One thing was I ignored the difference in version between gmp and libgmp, and another was I had to copy over the libgmp*.* and libmfpr.* from /usr/local/lib to /usr/lib, as somehow the compiler couldn't find the right libs (undefined reference errors popping up), even if I specified --with-gmp=/usr/local/lib --with-mfpr=/usr/local/lib
Also, my SDK utility samples now have pspUtilityMsgDialogParams instead of sceUtilityMsgDialogParams .
I was able to compile it and have the net dialog show up on my PSP.
Now I'm trying to get libcurl to work properly. I think I might have to recompile openssl and libcurl all over again with the new toolchain and sdk, and hopefully I can finally get back to coding again.
-
10-14-2008, 08:22 AM #9155
or you could download the latest versions of mpfr + gmp and untar them and symlink into the base gcc directory like so;
and the compile phase will automatically use those, then your build is self contained and you dont need to worry about externa libs and version mismatches etc.Code:ln -s ../gmp-4.2.2 gmp ln -s ../mpfr-2.3.1 mpfr ln -s ../newlib-1.16.0 newlib
-- Code Monkey : Sarien, Fishguts, Cracks and Crevices --
"Did IQ's just drop sharply while I was away?" (Ripley)
-
10-14-2008, 10:22 AM #9156Developer

- Registriert seit
- Mar 2006
- Beiträge
- 1.026
- Points
- 7.577
- Level
- 58
- Downloads
- 0
- Uploads
- 0
Probably the best way would be to compile gmp and mpfr specifying the correct directory.
Code:./configure --prefix=/usr

Check out my homebrew & C tutorials at http://insomniac.0x89.org/
Coder formerly known as Insomniac197
tshirtz: what is irshell ??
Atarian_: it's where people who work for the IRS go when they die
-
10-15-2008, 06:23 AM #9157I'm back!

- Registriert seit
- Feb 2007
- Ort
- England
- Beiträge
- 902
- Points
- 8.236
- Level
- 61
- Downloads
- 0
- Uploads
- 0
I think I remember seeing on here a looong time ago a way of splitting code up, one set of functions for PSP and one for PC by using some precompiler code, I was just wondering if I'm remembering right and how its done?
Thanks.
-Aura
-
10-15-2008, 07:24 AM #9158Developer

- Registriert seit
- Mar 2006
- Beiträge
- 1.026
- Points
- 7.577
- Level
- 58
- Downloads
- 0
- Uploads
- 0
You could wrap separate code blocks by using #ifdef #else #endif and friends.
Then when you compile, just add -D__PSP__ to your CFLAGS for the PSP build.Code:#ifdef __PSP__ // PSP specific code #else // PC specific code #endif
It would be easier for us to aid you if you stated your goal as well - there may be a better alternative.
Check out my homebrew & C tutorials at http://insomniac.0x89.org/
Coder formerly known as Insomniac197
tshirtz: what is irshell ??
Atarian_: it's where people who work for the IRS go when they die
-
10-16-2008, 11:16 AM #9159I'm back!

- Registriert seit
- Feb 2007
- Ort
- England
- Beiträge
- 902
- Points
- 8.236
- Level
- 61
- Downloads
- 0
- Uploads
- 0
I'm re-writing Roadblocks on the PSP, and porting it to the PC in 3D, so it will use the same physics, map reader, etc, but different graphics, and I ideally want to keep all my code in the same place with the same function names, so 2 different makefiles, one for the PSP using the __PSP__ flag, and the one for the PC having no flag seems perfect to me.
Thanks.
-Aura
-
10-16-2008, 11:37 AM #9160QJ Gamer Gold

- Registriert seit
- Jul 2005
- Ort
- everywhere
- Beiträge
- 3.526
- Points
- 17.453
- Level
- 84
- Downloads
- 1
- Uploads
- 0
have fun creating it=-)(doing the same with my pspbillards)
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
-
10-16-2008, 04:49 PM #9161QJ Gamer Silver

- Registriert seit
- May 2006
- Ort
- Behind you.
- Beiträge
- 1.814
- Points
- 10.921
- Level
- 69
- Downloads
- 0
- Uploads
- 0
Hey, haven't posted here in months.

How do i blit multiple images on the screen with independent properties at the same time? In other words, how do i blit a square (taken from the same png image) several times on the screen and make it move at different speeds and directions?
I've been wondering this ever since i started programming. If i know this, most of my problems will be solved...:)Calypso - Enjoy the excellent 2D space shooter:
http://dl.qj.net/Calypso-v1-PSP-Home...6542/catid/195
"Quoting yourself in your signature means you love to masterbate while looking at the mirror." -me (oh, wait...)
-
10-16-2008, 05:15 PM #9162QJ Gamer Gold

- Registriert seit
- Jul 2005
- Ort
- everywhere
- Beiträge
- 3.526
- Points
- 17.453
- Level
- 84
- Downloads
- 1
- Uploads
- 0
simple call the blit function again, but at a diffrent position, the buffer well update itself with multiple instances, it's up to you to keep track of these instances
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
-
10-16-2008, 05:20 PM #9163QJ Gamer Silver

- Registriert seit
- May 2006
- Ort
- Behind you.
- Beiträge
- 1.814
- Points
- 10.921
- Level
- 69
- Downloads
- 0
- Uploads
- 0
Well, obviously you can call the blit function again at a different position. But what if you want to make the second one move to the right and the first one move left? See what i'm saying. I mean towards different directions or speed.
Calypso - Enjoy the excellent 2D space shooter:
http://dl.qj.net/Calypso-v1-PSP-Home...6542/catid/195
"Quoting yourself in your signature means you love to masterbate while looking at the mirror." -me (oh, wait...)
-
10-16-2008, 05:25 PM #9164QJ Gamer Gold

- Registriert seit
- Jul 2005
- Ort
- everywhere
- Beiträge
- 3.526
- Points
- 17.453
- Level
- 84
- Downloads
- 1
- Uploads
- 0
like i said, that's stuff u need to keep track yourself
example:
^^obviously not ganna compile, but an example to show what i meanCode:int ObjAx = 0;//ObjA x int ObjAy = 0;//ObjA y int ObjBx = 0;//ObjB x int ObjBy = 0;//ObjB y int main(int argc, char **argv){ DrawImage(ObjAx, ObjAy, Img); DrawImage(ObjBx, ObjBy, Img); ObjAx--; ObjBx++; return 0; }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
-
10-16-2008, 05:34 PM #9165QJ Gamer Silver

- Registriert seit
- May 2006
- Ort
- Behind you.
- Beiträge
- 1.814
- Points
- 10.921
- Level
- 69
- Downloads
- 0
- Uploads
- 0
Lol, i know how to do that, but that introduces a lot of new variables that you have to keep up with, especially when you have like ten or more objects. Is there another way?
Calypso - Enjoy the excellent 2D space shooter:
http://dl.qj.net/Calypso-v1-PSP-Home...6542/catid/195
"Quoting yourself in your signature means you love to masterbate while looking at the mirror." -me (oh, wait...)
-
10-16-2008, 06:22 PM #9166QJ Gamer Blue
- Registriert seit
- Jul 2007
- Beiträge
- 296
- Points
- 3.795
- Level
- 38
- Downloads
- 0
- Uploads
- 0
Write a class.
*Warning, Above is Pseudo-Code*Code:class ScreenObject { private: Texture* m_texture; Vector2 m_position; public: ScreenObject(); ~ScreenObject(); void setInitialPosition(const Vector2& pos); bool setTexture(Texture* tex); bool updatePosition(int xDelta, int yDelta); void render(); }; ScreenObject::ScreenObject() { } ScreenObject::~ScreenObject() { } void ScreenObject::setInitialPosition(const Vector2& pos) { m_position = pos; } bool ScreenObject::setTexture(Texture* tex) { if(tex) { m_texture = tex; return true; } return false; } bool ScreenObject::updatePosition(int xDelta, int yDelta) { m_position.x += xDelta; m_position.y += yDelta; } bool ScreenObject::render() { m_texture.render(m_position); } int main(int argc, char** argv) { Texture tex("SomeTexture.png"); // Initialize Ten ScreenObjects ScreenObject* objects = new ScreenObject[10]; for(int i = 0; i < 10; ++i) { objects[i].setInitialPosition(Vector2(RandomInt(), RandomInt())); objects[i].setTexture(&tex); } while(running) { for(int i = 0; i < 10; ++i) { objects[i].updatePosition(RandomInt(), 0); objects[i].render(); } } // All done, clean up tex.unload(); return 0; }
-
10-17-2008, 05:13 AM #9167I'm back!

- Registriert seit
- Feb 2007
- Ort
- England
- Beiträge
- 902
- Points
- 8.236
- Level
- 61
- Downloads
- 0
- Uploads
- 0
I understand the basics of classes, but if I'm honest I can't see any major upside over standard struct style programming in C, maybe I'm overlooking something obvious or maybe I don't know enough about classes yet?
-Aura
-
10-17-2008, 11:29 AM #9168QJ Gamer Blue
- Registriert seit
- Jul 2007
- Beiträge
- 296
- Points
- 3.795
- Level
- 38
- Downloads
- 0
- Uploads
- 0
Yeah, you don't understand them.
-
10-17-2008, 11:48 AM #9169Banned for LIFE
- Registriert seit
- Oct 2006
- Ort
- East London, England
- Beiträge
- 2
- Points
- 18.744
- Level
- 86
- Downloads
- 0
- Uploads
- 0
Nice, couldnt you tell him why classes would be better?
-
10-17-2008, 11:59 AM #9170QJ Gamer Blue
- Registriert seit
- Jul 2007
- Beiträge
- 296
- Points
- 3.795
- Level
- 38
- Downloads
- 0
- Uploads
- 0
No, because they aren't "better". There is no "better".
If he wants to find out more about classes, he can go buy a book or google it.
-
10-17-2008, 12:00 PM #9171Banned for LIFE
- Registriert seit
- Oct 2006
- Ort
- East London, England
- Beiträge
- 2
- Points
- 18.744
- Level
- 86
- Downloads
- 0
- Uploads
- 0
You said he didnt know enough which implied there was an upside of using classes which in turn implies that they are "better" to use in this situation.
-
10-17-2008, 12:35 PM #9172I'm back!

- Registriert seit
- Feb 2007
- Ort
- England
- Beiträge
- 902
- Points
- 8.236
- Level
- 61
- Downloads
- 0
- Uploads
- 0
I've been using the Cambridge website to help, but I still don't understand why they are better, I think I understand what I've read, but everything with classes appears possible with functions and structs in C, or is that the point? Are classes just an easier way to manage data that in C would require multiple functions?
-Aura
-
10-17-2008, 01:34 PM #9173QJ Gamer Silver

- Registriert seit
- Jun 2006
- Ort
- UK
- Beiträge
- 2.326
- Points
- 10.263
- Level
- 67
- Downloads
- 0
- Uploads
- 0
Read chapters 4 and 5 in Thinking in C++ Vol 1.
[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]
-
10-17-2008, 02:40 PM #9174QJ Gamer Bronze

- Registriert seit
- Aug 2007
- Ort
- Australia
- Beiträge
- 659
- Points
- 8.045
- Level
- 60
- Downloads
- 0
- Uploads
- 0
-
10-17-2008, 02:42 PM #9175Banned for LIFE
- Registriert seit
- Oct 2006
- Ort
- East London, England
- Beiträge
- 2
- Points
- 18.744
- Level
- 86
- Downloads
- 0
- Uploads
- 0
1337ists should be eliminated from this thread.
-
10-17-2008, 03:38 PM #9176QJ Gamer Gold

- Registriert seit
- Jul 2005
- Ort
- everywhere
- Beiträge
- 3.526
- Points
- 17.453
- Level
- 84
- Downloads
- 1
- Uploads
- 0
o god, not the "help" stuff again...*sighs*
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
-
10-18-2008, 05:26 AM #9177I'm back!

- Registriert seit
- Feb 2007
- Ort
- England
- Beiträge
- 902
- Points
- 8.236
- Level
- 61
- Downloads
- 0
- Uploads
- 0
Thanks yaustar, I'm part way though chapter 4 and it seems very informative, I'll read through both chapters together later when I have more time.
I've just finished setting up the toolchain on my Ubuntu system, and code that used to compile fine no longer works. When compiling graphics.c it gives me errors, namely to do with these 2 lines of code
the errors are that ft2build.h does not exist, and that FT_FREETYPE_H expects a "" or <> because its not a file type. When I try and compile anything using rtc I also get errors on line 244 and 245 stating that a ; , or ) is required after time. I'm also getting problems trying to compile any applications with callbacks...Code:#include <ft2build.h> #include FT_FREETYPE_H
I never had these problems on my old Cygwin setup, so I'm just wondering if there are any libraries that I'll need to install?
Thanks.
-Aura
-
10-21-2008, 12:41 AM #9178QJ Gamer Bronze

- Registriert seit
- Jul 2006
- Beiträge
- 550
- Points
- 5.381
- Level
- 47
- Downloads
- 1
- Uploads
- 0
Quick question, can someone compile me the latest PSPLink from svn? I've tried a few revisions and the OE builds always crash. It's probably because my toolchain is old, but I'm too lazy to upgrade :-\
-
10-21-2008, 04:24 PM #9179
- Registriert seit
- Apr 2008
- Beiträge
- 47
- Points
- 2.658
- Level
- 31
- Downloads
- 0
- Uploads
- 0
Anybody know off the top of their head what color mode the OSK runs in?
-
10-22-2008, 04:03 PM #9180I'm back!

- Registriert seit
- Feb 2007
- Ort
- England
- Beiträge
- 902
- Points
- 8.236
- Level
- 61
- Downloads
- 0
- Uploads
- 0
I'm killing 2 birds with one stone right now, I'm writing my first OO and SDL program, all was going well but when I try and compile I get this error:
My code is this:source/objlist.o(.text+0xa4):obj list.cpp: undefined reference to `blitImage(int, int, SDL_Surface*, SDL_Surface*)'
headerCode:void blitImage(int x, int y, SDL_Surface* source, SDL_Surface* destination, SDL_Rect* sprite = NULL) { SDL_Rect coord; coord.x = x; coord.y = y; SDL_BlitSurface(source, sprite, destination, &coord); return; }
and yes, I have included the header in objlist.cpp, I'm stumped as to why its not working.Code:void blitImage(int x, int y, SDL_Surface* source, SDL_Surface* destination); void blitImage(int x, int y, SDL_Surface* source, SDL_Surface* destination, SDL_Rect* sprite);
-Aura


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