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; float is 32bit & int 16 bit. i.e. better fps. Erm. No, that is just wrong....
-
12-27-2007, 06:49 PM #7261QJ Gamer Silver

- Registriert seit
- Jun 2006
- Ort
- UK
- Beiträge
- 2.326
- Points
- 10.263
- Level
- 67
- Downloads
- 0
- Uploads
- 0
Erm. No, that is just wrong.float is 32bit & int 16 bit. i.e. better fps.
[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]
-
12-27-2007, 06:50 PM #7262QJ Gamer Silver

- Registriert seit
- Jan 2006
- Ort
- Germany
- Beiträge
- 926
- Points
- 14.087
- Level
- 77
- Downloads
- 0
- Uploads
- 0
No you were right with your first statement. An 'int' is defined as an integer of the host processors word-size, which means 32bit on PSP and most nowadays PCs (or 64 for IA64) etc.
Zitat von Archaemic
long is just an integer datatype that is guaranteed to be at least 32bit in size. Same as short is guaranteed to be at least 16bit in size.
Actually, a long COULD turn out smaller than an int (though it shouldn't, as long and short are only modifiers and not own datatypes in fact).Raphs board rules #31: Excessive use of punctuation is either a sign of a lesser ego or a small mind. Avoid it if you don't want to look like a total moron.
Raphs board rules #17: When you need to ask whether you are capable of doing something, you are not.
Raphs board rules #2: Exploits aren't found by changing version numbers, blindly merging data into a file or turning your PSP upside down.
Raphs board rules #1: If you have no clue how exploits work, don't come up with ideas about them.
-
12-27-2007, 06:53 PM #7263I'm back!

- Registriert seit
- Feb 2007
- Ort
- England
- Beiträge
- 902
- Points
- 8.236
- Level
- 61
- Downloads
- 0
- Uploads
- 0
Ok thanks guys, its not that difficult to understand, so would I be right in thinking 0.5f is just 1/2?
-Aura
-
12-27-2007, 06:56 PM #7264QJ Gamer Silver

- Registriert seit
- Jun 2006
- Ort
- UK
- Beiträge
- 2.326
- Points
- 10.263
- Level
- 67
- Downloads
- 0
- Uploads
- 0
In our minds, yes. In C or C++, 1/2 would give you 0 (int/int). 1.f/2.f would give you 0.5f.
[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]
-
12-27-2007, 07:05 PM #7265
What about HUGE vertices array containing Floats but not INT.
Zitat von yaustar
Nao tell me, Which one would be good?
-
12-27-2007, 07:09 PM #7266QJ Gamer Silver
- Registriert seit
- Feb 2007
- Ort
- Melbourne, Australia
- Beiträge
- 1.773
- Points
- 8.717
- Level
- 62
- My Mood
-
- Downloads
- 0
- Uploads
- 0
Hello again... How do I check if a picture is any part over another one? I know
works fine, but i want to make a like a zig-zag ( \/\/\/\/\/ kinda thing)... but that would be too hard to do with the above code..Code:if ((x0 >= (StarX - 5) && x0 <= (StarX + 5)) && ((y0 >= (StarY - 5) && y0 <= (StarY + 5))) ) { StarY = GetRandomNum(1, 272); StarX = GetRandomNum(1, 430); }WHA!?
-
12-27-2007, 07:11 PM #7267QJ Gamer Silver

- Registriert seit
- Jun 2006
- Ort
- UK
- Beiträge
- 2.326
- Points
- 10.263
- Level
- 67
- Downloads
- 0
- Uploads
- 0
Even then, still no because you pass by reference or by pointer. All you do is use less memory and even that is ONLY if the data structure is properly packed.What about HUGE vertices array containing Floats but not INT.
Nao tell me, Which one would be good?
Transversing through the array is still the same speed between the two.
If you copy such a huge array of data, that is inefficiency from the programmer for not managing their data structures properly.
Edit: This is basing on your information that ints are 16 bit on the PSP which it isn't as mentioned by others in this thread.
-= Double Post =-
Look for Box-Line collision on Google.
Zitat von BigSanFrey
Geändert von yaustar (12-27-2007 um 07:29 PM Uhr) Grund: Automerged Doublepost
[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]
-
12-28-2007, 01:08 AM #7268QJ Gamer Silver
- Registriert seit
- Feb 2007
- Ort
- Melbourne, Australia
- Beiträge
- 1.773
- Points
- 8.717
- Level
- 62
- My Mood
-
- Downloads
- 0
- Uploads
- 0
Thanks, looks confusing though...
Zitat von yaustar
Anyway i have a problem. My "game" is meant to show 4 little squares with a cross in it (this is the picture
). But number four does not show, it shows if i have the
set toCode:int StarX4 = GetRandomNum(331, 416); int StarY4 = GetRandomNum(1, 272);Or if i collect star number 2 :Argh:...Code:int StarX4 = GetRandomNum(3, 40) int StarY4 = GetRandomNum(1, 272);
Here is my code (in a spoiler)
Spoiler for Code:Geändert von BigSanFrey (12-28-2007 um 12:19 PM Uhr)
WHA!?
-
12-28-2007, 05:05 AM #7269QJ Gamer Silver

- Registriert seit
- Jan 2006
- Ort
- Germany
- Beiträge
- 926
- Points
- 14.087
- Level
- 77
- Downloads
- 0
- Uploads
- 0
Regarding graphics hardware the format of vertices doesn't really matter, only the size of each vector as that decides the number of vertices fitting into the memory bandwidth of the CPU->GPU bus.
Zitat von Mr305
In fact, for most common GPUs float is the internal format, so submitting vertices in that format is avoiding the conversion step - but in reality that doesn't hit the performance at all, as that just takes a few cycles and that's only a fraction of the time that is required for the memory transfer, so the conversion is completely hidden in the mem transfer latency.Raphs board rules #31: Excessive use of punctuation is either a sign of a lesser ego or a small mind. Avoid it if you don't want to look like a total moron.
Raphs board rules #17: When you need to ask whether you are capable of doing something, you are not.
Raphs board rules #2: Exploits aren't found by changing version numbers, blindly merging data into a file or turning your PSP upside down.
Raphs board rules #1: If you have no clue how exploits work, don't come up with ideas about them.
-
12-28-2007, 06:59 AM #7270I'm back!

- Registriert seit
- Feb 2007
- Ort
- England
- Beiträge
- 902
- Points
- 8.236
- Level
- 61
- Downloads
- 0
- Uploads
- 0
I'm having a problem with intraFont, been working at it for over 5 hours hoping something comes to mind, or I just get lucky...
Doing this is fine the first time, but whenever I do it more than once there are a LOT of graphical glitches and the get steadily worse as you can see below.Code:blitAlphaImageToScreen( 0, 0, 480, 272, setting.Background, 0, 0); guStart(); print(font.f1, 0, 10, "C.U.S.T.O.M. Menu System."); sceGuFinish(); sceGuSync(0,0); flipScreen();
If anyone knows what I'm doing wrong can you show me some example code? (The example used doesn't blit an image, just makes the background grey).
-Aura
-
12-28-2007, 07:10 AM #7271
You'll need to reset sceGuTexMode back to 8888 ; or atleast that was with pgeFont. Donno if its the same with intra.
Zitat von Auraomega
-
12-28-2007, 07:21 AM #7272I'm back!

- Registriert seit
- Feb 2007
- Ort
- England
- Beiträge
- 902
- Points
- 8.236
- Level
- 61
- Downloads
- 0
- Uploads
- 0
Nope, same problem.
Zitat von Mr305
EDIT : My apologies, you were right, I forgot to add guStart so it wasn't actually setting the value. It all works now :)
-AuraGeändert von Auraomega (12-28-2007 um 08:32 AM Uhr)
-
12-28-2007, 12:19 PM #7273QJ Gamer Silver
- Registriert seit
- Feb 2007
- Ort
- Melbourne, Australia
- Beiträge
- 1.773
- Points
- 8.717
- Level
- 62
- My Mood
-
- Downloads
- 0
- Uploads
- 0
Zitat von BigSanFrey
anyone?
WHA!?
-
12-28-2007, 08:10 PM #7274QJ Gamer Bronze

- Registriert seit
- Aug 2007
- Ort
- Australia
- Beiträge
- 659
- Points
- 8.045
- Level
- 60
- Downloads
- 0
- Uploads
- 0
Hey, i was just wondering how i would go about clearing an array or, when i store data in it, does it overwrite whats currently in it? Iv tried free(); but it unallocates the memory. Anyhelp would be awesome, thanks
-
12-28-2007, 09:06 PM #7275It's good to be free...

- Registriert seit
- Feb 2007
- Beiträge
- 2.440
- Points
- 10.420
- Level
- 67
- Downloads
- 0
- Uploads
- 0
Um, yes it overwrites the data. Use memset to clear it, though.
pəʇuɒɹɓ ɹoɟ ɓuɪɥʇou əʞɒʇ
-
12-28-2007, 09:09 PM #7276QJ Gamer Bronze

- Registriert seit
- Aug 2007
- Ort
- Australia
- Beiträge
- 659
- Points
- 8.045
- Level
- 60
- Downloads
- 0
- Uploads
- 0
Awesome, thanks
-
12-28-2007, 09:17 PM #7277QJ Gamer Platinum
- Registriert seit
- Dec 2005
- Ort
- h0000000rj
- Beiträge
- 12.867
- Points
- 57.528
- Level
- 100
- Downloads
- 0
- Uploads
- 0
... what would it do if not overwrite the data?
[I fail @ life]
-
12-28-2007, 10:06 PM #7278QJ Gamer Bronze

- Registriert seit
- Aug 2007
- Ort
- Australia
- Beiträge
- 659
- Points
- 8.045
- Level
- 60
- Downloads
- 0
- Uploads
- 0
as in, say you had
and you didCode:char buffer[32];
buffer would currently be holding the first 10 bytes of file.Code:sceIoRead(file, buffer, 10);
Then, if you did
would it overwrite the current 10 bytes stored or would it add to it so buffer now composed of the first 10 bytes of file and file2?Code:sceIoRead(file2, buffer, 10);
-
12-29-2007, 04:21 AM #7279Banned for LIFE
- Registriert seit
- Oct 2006
- Ort
- East London, England
- Beiträge
- 2
- Points
- 18.744
- Level
- 86
- Downloads
- 0
- Uploads
- 0
Guys, I am attempting to port a simple sdl demo. It compiles fine with no issues but upon booting it gives me a bsod.
I just basically need to know how to read these kind of messages or what I can use to debug my programs efficiently.Code:I regret to inform you your psp has just crashed Exception Details: Exception - Bus Error (data) EPC - 08900668 Cause - 1000001C Status - 60008613 BadVAddr - 00000000 The offending routine may be identified with: psp-addr2line -e target.elf -f -C 0x8900668 0x0 0x8900c0c
-
12-29-2007, 04:46 AM #7280Developer

- Registriert seit
- Mar 2006
- Beiträge
- 1.026
- Points
- 7.577
- Level
- 58
- Downloads
- 0
- Uploads
- 0
Do what it says, type the line into your prompt:
Changing target.elf to the name of your elf.psp-addr2line -e target.elf -f -C 0x8900668 0x0 0x8900c0c
It'll give you the file & line number that caused the error.
You need to have compiled with the -g flag in your makefile for this to work correctly.
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
-
12-29-2007, 05:00 AM #7281Banned for LIFE
- Registriert seit
- Oct 2006
- Ort
- East London, England
- Beiträge
- 2
- Points
- 18.744
- Level
- 86
- Downloads
- 0
- Uploads
- 0
Ok, the output from that is:
So if i'm right in thinking that there are two offending lines of code, they would beCode:/home/G.Ninja/bouncing/bouncing.c:106 ?? ??:0 rungame /home/G.Ninja/bouncing/bouncing.c:103
andCode:if(SDL_SetColorKey(s_surface, SDL_SRCCOLORKEY | SDL_RLEACCEL, SDL_MapRGB(s_surface->format, COLORKEY)) == -1)
Code:done = 1;

EDIT: I commented out them lines of code and it seems to have done the trick. Thanks for your help IWN.Geändert von eldiablov (12-29-2007 um 05:12 AM Uhr)
-
12-29-2007, 09:01 AM #7282QJ Gamer Silver

- Registriert seit
- Jan 2006
- Ort
- Germany
- Beiträge
- 926
- Points
- 14.087
- Level
- 77
- Downloads
- 0
- Uploads
- 0
The first answer is correct. If you want to store the second file's ten bytes after the first, you'd have to do:
Zitat von Xsjado7
Code:sceIoRead(file2, buffer+10, 10);
Raphs board rules #31: Excessive use of punctuation is either a sign of a lesser ego or a small mind. Avoid it if you don't want to look like a total moron.
Raphs board rules #17: When you need to ask whether you are capable of doing something, you are not.
Raphs board rules #2: Exploits aren't found by changing version numbers, blindly merging data into a file or turning your PSP upside down.
Raphs board rules #1: If you have no clue how exploits work, don't come up with ideas about them.
-
12-29-2007, 11:18 AM #7283Banned for LIFE
- Registriert seit
- Oct 2006
- Ort
- East London, England
- Beiträge
- 2
- Points
- 18.744
- Level
- 86
- Downloads
- 0
- Uploads
- 0
How would I read a string in a file ? Im looking at pspiofilemgr.h but i'm not finding anything that makes sense to me.
-
12-29-2007, 12:11 PM #7284QJ Gamer Green
- Registriert seit
- Jul 2006
- Ort
- USA SC/NC
- Beiträge
- 699
- Points
- 5.712
- Level
- 48
- Downloads
- 0
- Uploads
- 0
sceIoRead? Open the file, seek to whatever offset you need, read a number of bytes that you want, close file.
Zitat von eldiablov
[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]
-
12-29-2007, 01:16 PM #7285QJ Gamer Silver

- Registriert seit
- May 2006
- Ort
- Behind you.
- Beiträge
- 1.814
- Points
- 10.921
- Level
- 69
- Downloads
- 0
- Uploads
- 0
I'm having problems with file i/o. I haven't had this problem before, and this code always worked fine until now:
Instead of gettingCode:FILE* options; options = fopen("./files/options.txt","r+b"); fseek(options, 0, SEEK_SET); fprintf(options, "s"); fclose(options);in my options file, i now getCode:s
. Originally, the options file wasCode:n
. I just wanted to change the 'n' to an 's', but instead, i got something wierd. Any ideas?Code:n
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...)
-
12-29-2007, 01:55 PM #7286I'm back!

- Registriert seit
- Feb 2007
- Ort
- England
- Beiträge
- 902
- Points
- 8.236
- Level
- 61
- Downloads
- 0
- Uploads
- 0
I'm having some problems with Project4 that I can't understand, I'm just wondering if anyone here can help me.
I've moved all the graphics handling (graphics.c intraFont.c) into an external prx that I load and link to. When I try loading it with pspSdkLoadStartModule it returns error 0x800000D1 which is SCE_KERNEL_ERROR_ILLEGAL_ PERM, I'm not sure what the error means, or what I've done wrong.
My next question is how or what is flash2 when trying to access it? I'm trying to write a file to flash2 (and flash3) and read it back, but I keep getting the nodev error (0x80000321).
Is there any way I can check what variables are being passed between modules, or is there any way I can check what heaps are currently allocated?
How can I get things printed on the PSPLink shell when running in 3.XX on 3.52? I never had this problem in 3.40LE, but have done ever since moving to 3.52 (does this happen on 3.71?).
How should I got about loading a PSX game? I've triedWhere param.key is game, pops, psx. I'm guessing the key is wrong but I can't work out what it is meant to be, so if anyone knows...?Code:sctrlKernelLoadExecVSHWithApitype(0x143, bpath, ¶m);
(Not sure if this is allowed or not, if its not let me know and I'll remove it) When using sctrlSEMountUmdFromFile for M33 or NP9660 it returns a nodev error, but works fine for ISOFs if its enabled in recovery, I've tried loading the modules from flash0, but no luck.
Theres a lot of questions there, but any help to any of them will be helping me a great deal.
Thanks in advance.
-Aura
-
12-29-2007, 02:16 PM #7287
you could use
fprintf(stdout, "your output\n");
with psplink to output text to the terminal
-
12-29-2007, 03:38 PM #7288Banned for LIFE
- Registriert seit
- Oct 2006
- Ort
- East London, England
- Beiträge
- 2
- Points
- 18.744
- Level
- 86
- Downloads
- 0
- Uploads
- 0
How would I find the offset ?
Zitat von Moca
-
12-29-2007, 03:53 PM #7289Developer

- Registriert seit
- Mar 2006
- Beiträge
- 1.026
- Points
- 7.577
- Level
- 58
- Downloads
- 0
- Uploads
- 0
Check the mode you are opening the file in:
Zitat von TMNT
http://www.cplusplus.com/reference/c...dio/fopen.html
"r+b" doesn't seem right for what you're trying to do.
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
-
12-29-2007, 06:41 PM #7290QJ Gamer Bronze

- Registriert seit
- Aug 2007
- Ort
- Australia
- Beiträge
- 659
- Points
- 8.045
- Level
- 60
- Downloads
- 0
- Uploads
- 0
Use sceIoLseek(currentlyopenf ile, howfartoseek, positiontoseekfrom);
Zitat von eldiablov
for the last param you can use SEEK_SET to reposition the pointer from the start of the file, SEEK_CUR to reposition relative from where it is currently, and SEEK_END to set from the end of the file


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