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; You aren't linking the source file? (Adding "objlist.o" to your OBJS line, if you are using a PSP makefile.) s/objlist.o/what_ever_source_file_is_ ...
-
10-22-2008, 07:03 PM #9181QJ Gamer Blue
- Registriert seit
- Jul 2007
- Beiträge
- 296
- Points
- 3.795
- Level
- 38
- Downloads
- 0
- Uploads
- 0
You aren't linking the source file? (Adding "objlist.o" to your OBJS line, if you are using a PSP makefile.)
s/objlist.o/what_ever_source_file_is_ including_the_blitimage_f ile.o
-
10-23-2008, 01:00 AM #9182Developer

- Registriert seit
- Mar 2006
- Beiträge
- 1.026
- Points
- 7.577
- Level
- 58
- Downloads
- 0
- Uploads
- 0
I see two prototypes for blitImage() but only one actual function.
Where is the function that matches the prototype?
Code:void blitImage(int x, int y, SDL_Surface* source, SDL_Surface* destination);

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-23-2008, 01:17 AM #9183QJ Gamer Silver

- Registriert seit
- Jun 2006
- Ort
- UK
- Beiträge
- 2.326
- Points
- 10.263
- Level
- 67
- Downloads
- 0
- Uploads
- 0
You are using default parameters incorrectly:
header
SourceCode:void blitImage(int x, int y, SDL_Surface* source, SDL_Surface* destination SDL_Rect* sprite = NULL);
Code:void blitImage(int x, int y, SDL_Surface* source, SDL_Surface* destination, SDL_Rect* sprite) { SDL_Rect coord; coord.x = x; coord.y = y; SDL_BlitSurface(source, sprite, destination, &coord); }[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-23-2008, 02:59 AM #9184I'm back!

- Registriert seit
- Feb 2007
- Ort
- England
- Beiträge
- 902
- Points
- 8.236
- Level
- 61
- Downloads
- 0
- Uploads
- 0
Nope, its added.
No luck there either, I'm getting an ambiguity issue:
Zitat von yaustar
I'm going to Google default parameters and hope something comes up (I'll edit the post if it does).source/objlist.cpp:23: note: candidates are: void blitImage(int, int, SDL_Surface*, SDL_Surface*)
note: void blitImage(int, int, SDL_Surface*, SDL_Surface*, SDL_Rect*)
-Aura
Durrrr, brains not functioning. I had void blitImage(int x, int y, SDL_Surface* source, SDL_Surface* destination); at the top of objlist from last night when I was trying to solve the problem, this was causing the ambiguity because I forgot to remove it. All fixed and working now.Geändert von Auraomega (10-23-2008 um 03:28 AM Uhr)
-
10-24-2008, 02:37 PM #9185
What are the analog offsets ? LX, LY: 0 to 255. Right? 115 - 128 Center? :)
[I wish not to code and test that out
]
Dont you all like using webbrowser with your right thumb? ;)
-
10-24-2008, 03:27 PM #9186Developer

- Registriert seit
- Mar 2006
- Beiträge
- 1.026
- Points
- 7.577
- Level
- 58
- Downloads
- 0
- Uploads
- 0
It's an unsigned char type, so 0 - 255 yes.

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-25-2008, 10:14 PM #9187QJ Gamer Silver

- Registriert seit
- Sep 2007
- Ort
- AUS
- Beiträge
- 284
- Points
- 12.501
- Level
- 73
- Downloads
- 0
- Uploads
- 0
Hey all,
would some one be able to give an example of the sceIoReadAsync() function from the sdk. I have been looking all over the forums and even in PPA source code. But i can't seem to get it to work.
Regards
HomemisterWyvern. That is all
-
11-09-2008, 05:45 PM #9188QJ Gamer Bronze
- Registriert seit
- Aug 2007
- Ort
- Everywhere
- Beiträge
- 206
- Points
- 5.826
- Level
- 49
- Downloads
- 0
- Uploads
- 0
Hi, this is still the latest tool chain release, right?
http://ps2dev.org/psp/Tools/Toolchain - 06/26/2007
-
11-09-2008, 06:37 PM #9189
-
11-10-2008, 01:52 AM #9190Developer

- Registriert seit
- Mar 2006
- Beiträge
- 1.026
- Points
- 7.577
- Level
- 58
- Downloads
- 0
- Uploads
- 0
It's not the latest toolchain.
Check the latest version out from the SVN.
Code:svn co svn://svn.ps2dev.org/psp/trunk/psptoolchain

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
-
11-10-2008, 07:31 PM #9191QJ Gamer Bronze
- Registriert seit
- Aug 2007
- Ort
- Everywhere
- Beiträge
- 206
- Points
- 5.826
- Level
- 49
- Downloads
- 0
- Uploads
- 0
Well.. I updated my sdk and when I was installing it, I got this..
Spoiler for Error:
And I tried searching around about it and found a post from another site where a guy had the same problem. It was pretty recent.
Anyone have any ideas?
-
11-11-2008, 06:28 PM #9192Bush Programmer

- Registriert seit
- Nov 2005
- Beiträge
- 3.658
- Points
- 60.149
- Level
- 100
- Downloads
- 0
- Uploads
- 0
Hi Guys,
I have two questions,
What do the last two values represent in this:
and more importantly,Code:PSP_MODULE_INFO("Program_Title", 0, 1, 0);
What is the fastest way to split a short into two bytes (u8 variables).
Cheers, Art.
-
11-11-2008, 07:44 PM #9193
- Registriert seit
- May 2008
- Beiträge
- 46
- Points
- 2.561
- Level
- 30
- Downloads
- 0
- Uploads
- 0
IIRC they are the version number (major and minor version). Though they can be arbitrarily set (I think they are 'char's so upto 0-255 I guess) but better check the pspsdk source for the actual macro definition.
Fastest way to split? Well the most direct way is:
Alternatively you could do:Code:u16 x = 0xABCD; u8 a = x & 0xFF; // 0xCD u8 b = x >> 8; // 0xAB u16 y = (b<<8) | a; // to get back original 0xABCD
I think this would be quicker since it would just be 2 load instructions, no other arithmetic manipulations.Code:u16 x = 0xABCD; u8 a = *((u8*)&x+0); // 0xCD u8 b = *((u8*)&x+1); // 0xAB // or written another way a = ((u8*)&x)[0]; // 0xCD b = ((u8*)&x)[1]; // 0xAB
Geändert von pspersanonymous (11-11-2008 um 08:33 PM Uhr)
-
11-11-2008, 10:39 PM #9194Bush Programmer

- Registriert seit
- Nov 2005
- Beiträge
- 3.658
- Points
- 60.149
- Level
- 100
- Downloads
- 0
- Uploads
- 0
Thankyou :)
That was fast.
-
11-12-2008, 02:54 AM #9195Developer

- Registriert seit
- Mar 2006
- Beiträge
- 1.026
- Points
- 7.577
- Level
- 58
- Downloads
- 0
- Uploads
- 0
chrisp6825: I commited a change to the SDK last night to fix the issue you mention.
Try re-installing and it should work now.
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
-
11-12-2008, 05:29 AM #9196
-
11-12-2008, 06:09 AM #9197
-
11-12-2008, 11:09 AM #9198I'm back!

- Registriert seit
- Feb 2007
- Ort
- England
- Beiträge
- 902
- Points
- 8.236
- Level
- 61
- Downloads
- 0
- Uploads
- 0
Is there a data type to hold 12 digit numbers? Best thing I've come up with so far is:
Its untidy but its only being used for a one shot application, just looking for the quickest method as its going to take a few hours to run as it is.Code:unsigned long int part1 = 0; unsigned long int part2 = 0; ... if(part1 == ulMax) { part2++; part1 = 0; } else { part1++; }
-Aura
EDIT:
Nevermind, I found how to use the u64 data type, for anyone wondering:
#define u64 unsigned long long int.
EDIT 2:
Question is still open, u64 won't allow me to place the value in that I require.Geändert von Auraomega (11-12-2008 um 12:50 PM Uhr)
-
11-12-2008, 02:02 PM #9199
- Registriert seit
- May 2008
- Beiträge
- 46
- Points
- 2.561
- Level
- 30
- Downloads
- 0
- Uploads
- 0
No (0xABCD & 0xff00) gives 0xAB00, if you assigned that to a char variable it would truncate to 0x00. In fact you don't really need the & 0xFF part:
What do you mean by "12 digits" ?? 12 digits in hex or in decimal ??Code:u8 a = 0xABCD; // would just give 0xCD, but compiler probably will warn // so while this works perfectly fine: u16 x = 0xABCD; u8 a = x; // will truncate to 0xCD u8 b = x>>8; // it's probably better practice to do: u16 x = 0xABCD; u8 a = x & 0xFF; u8 b = (x>>8) & 0xFF;
The u64 datatype is 64bits long (ie. 8 bytes long) so it stores 8 'char' values eg. 0x1122334455667788. To use 'long long' constant values you need to append 'll' to the end of the value:
Code:u64 var = 0x1122334455667788ll; printf("%llx", var);
-
11-12-2008, 03:08 PM #9200QJ Gamer Silver
- Registriert seit
- Sep 2006
- Ort
- Perth, Scotland
- Beiträge
- 1.094
- Points
- 8.475
- Level
- 62
- Downloads
- 0
- Uploads
- 0
You can also do,
char p = *(u8 *)&x;
char q = *(u8 *)(&x + 1);
or, you can do,
char p = _lb(&x);
char q = _lb(&x + 1);
-
11-12-2008, 07:33 PM #9201
- Registriert seit
- May 2008
- Beiträge
- 46
- Points
- 2.561
- Level
- 30
- Downloads
- 0
- Uploads
- 0
No no, that will give you invalid results. Note that's not the same thing as what I wrote (there's a slight but extremely important difference). Here's what I wrote originally in the above post:
Notice the brackets, what you wrote:Code:u16 x = 0xABCD; u8 a = *((u8*)&x+0); // 0xCD u8 b = *((u8*)&x+1); // 0xAB
here, x is a u16 datatype so the +1 doesnt add 1 to the address it actually adds 2, if x was an int, +1 would add 4 (or however long the datatype is on your platform).Code:char q = *(u8*)(&x+1); // dangerous, this will read out of bounds
So if x was stored at address 0x1000, your example would read a char from 0x1002, instead of reading from 0x1001 (ignore the real-world for a moment where stack values grow down from high-to-low addresses).
You need to watch where you put your brackets, it can make a huge difference (a matter of running correctly or crashing !!). You can try your example out, I don't think it will crash the app, but it definitely won't give you the correct result.
The second example, well, that is dependant on, firstly, running on a MIPS platform, and secondly, having those macro's defined in your setup. In that case, better off writing in pure asm (or inline asm).Geändert von pspersanonymous (11-12-2008 um 07:48 PM Uhr)
-
11-12-2008, 08:15 PM #9202QJ Gamer Bronze
- Registriert seit
- Aug 2007
- Ort
- Everywhere
- Beiträge
- 206
- Points
- 5.826
- Level
- 49
- Downloads
- 0
- Uploads
- 0
Sweet thanks. Ill try it out tonight.
-=Double Post Merge =-
Hmm, I got the error again..
Spoiler for error:
If you want to see my time.h file that it's saying has the previous decleration then here it is.. (this is the one at "usr\local\pspdev\psp\inc lude\sys\"
Spoiler for time.h:
Thanks for the help.Geändert von chrisp6825 (11-12-2008 um 09:54 PM Uhr) Grund: Automerged Doublepost
-
11-13-2008, 04:57 AM #9203
-
11-13-2008, 07:23 AM #9204Developer

- Registriert seit
- Mar 2006
- Beiträge
- 1.026
- Points
- 7.577
- Level
- 58
- Downloads
- 0
- Uploads
- 0
chrisp6825: Try again from scratch, the full toolchain. I made another commit after that one.

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
-
11-13-2008, 11:29 AM #9205
Achievements:
- Registriert seit
- Nov 2008
- Beiträge
- 15
- Points
- 2.228
- Level
- 28
- Downloads
- 0
- Uploads
- 0
Not really C++-related, but still:
Both when using OSlib and SDL, I get massive ghosting when moving images. It's extreme, really. I'm drawing a dark green image, and moving it, and it has a black trail after it. Anyone know what's up?
-
11-13-2008, 01:44 PM #9206QJ Gamer Gold

- Registriert seit
- Jul 2005
- Ort
- everywhere
- Beiträge
- 3.526
- Points
- 17.453
- Level
- 84
- Downloads
- 1
- Uploads
- 0
your not clearing the screen it sounds like, i'd suggest doing:
that should clear up your problemCode:... oslStartDrawing(); oslDrawFillRect(0,0,480,272, RGBA(0,0,0,255)); ...
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
-
11-13-2008, 01:50 PM #9207
Achievements:
- Registriert seit
- Nov 2008
- Beiträge
- 15
- Points
- 2.228
- Level
- 28
- Downloads
- 0
- Uploads
- 0
Nope, I am clearing it. Turns out it's the crappy screen of the PSP.
-
11-13-2008, 02:01 PM #9208QJ Gamer Silver
- Registriert seit
- Sep 2006
- Ort
- Perth, Scotland
- Beiträge
- 1.094
- Points
- 8.475
- Level
- 62
- Downloads
- 0
- Uploads
- 0
-
11-13-2008, 02:17 PM #9209QJ Gamer Gold

- Registriert seit
- Jul 2005
- Ort
- everywhere
- Beiträge
- 3.526
- Points
- 17.453
- Level
- 84
- Downloads
- 1
- Uploads
- 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
-
11-14-2008, 02:38 AM #9210QJ Gamer Silver

- Registriert seit
- Jun 2006
- Ort
- UK
- Beiträge
- 2.326
- Points
- 10.263
- Level
- 67
- Downloads
- 0
- Uploads
- 0
[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]


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