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; Zitat von Zack_PSP Setting up cygwin is easy. I cannot understand how so many people have issues with it. I ...
-
08-12-2009, 03:21 AM #9931Developer and Tutor.
- Registriert seit
- Jul 2007
- Ort
- Widnes, England
- Beiträge
- 1.649
- Points
- 8.736
- Level
- 62
- My Mood
-
- Downloads
- 0
- Uploads
- 0
------ FaT3oYCG -----
AKA Craig, call me what you want to It's your preference.
My Website: http://www.modern-gamer.co.uk/
Currently working on:
(0) MediaGrab
(0) PGE Gears Of War - On hold (Very large project).
(0) PS???? -On Hold A tactical 2d side scrolling game involving AI and online multiplayer features. - Tile engine nearley finished (1 bug to fix).
-
08-21-2009, 05:36 PM #9932QJ Gamer Blue
Achievements:
- Registriert seit
- Jun 2009
- Beiträge
- 6
- Points
- 1.778
- Level
- 24
- Downloads
- 0
- Uploads
- 0
Hello!
I recently took up programming for the PSP and started to follow the wonderful tutorials of psp-programmng.com. However, once I try to run toolchain.sh after installing CYGWIN I get this error after around 5 seconds after me typing in "./toolchain.sh" (without the quotes)
This is the error i get:
ERROR: Add C:/pspdev/bin to your path before continuing.
../depends/check-pspdev.sh:Failed.
Thank you very much for all your help in advance.
-
08-21-2009, 05:48 PM #9933QJ Gamer Blue
Achievements:
- Registriert seit
- Jun 2009
- Beiträge
- 6
- Points
- 1.778
- Level
- 24
- Downloads
- 0
- Uploads
- 0
nevermind i got it running fine, sorry
-
08-23-2009, 02:00 AM #9934QJ Gamer Blue
Achievements:
- Registriert seit
- Aug 2009
- Ort
- N/A
- Beiträge
- 38
- Points
- 1.799
- Level
- 24
- Downloads
- 0
- Uploads
- 0
FaT3oYCG : minpsp has been compiled for Linux 32 bits. I guess 64 bits users'd rather compile thier own version...
(and the distribution doesn't matter here)
-
08-30-2009, 08:11 AM #9935QJ Gamer Green
- Registriert seit
- Aug 2009
- Ort
- Moon
- Beiträge
- 146
- Points
- 3.217
- Level
- 35
- My Mood
-
- Downloads
- 0
- Uploads
- 0
Newbie Here!
I'm new to programming for the psp and i will like someone who is a capable of teaching me to do so because i want to code some pretty amazing stuff for the psp.
-
09-01-2009, 10:18 AM #9936QJ Gamer Gold

- Registriert seit
- Nov 2008
- Ort
- CAD
- Beiträge
- 693
- Points
- 13.372
- Level
- 75
- Downloads
- 19
- Uploads
- 4
does anybody how to make a fade-in and fade-out effect using graphics.c ? (in other words, just the libpng and the pspgu)
That epic dude.
-
09-03-2009, 06:56 AM #9937QJ Gamer Gold

- Registriert seit
- Nov 2008
- Ort
- CAD
- Beiträge
- 693
- Points
- 13.372
- Level
- 75
- Downloads
- 19
- Uploads
- 4
okay, new problem, i'm trying to create a table from the lua functions lua_Stae and lua_newtable, how do I do that?
i was thinking about something like this:
Code:lua_newtable(lua_State *table); table = { int variable1 }; [...] table.variable1 = 10;That epic dude.
-
09-03-2009, 08:36 AM #9938QJ Gamer Gold

- Registriert seit
- Jul 2005
- Ort
- everywhere
- Beiträge
- 3.526
- Points
- 17.453
- Level
- 84
- Downloads
- 1
- Uploads
- 0
what?, are u using c/++, or lua?
if it's the first, than you've got to stop thinking of tables like lua, and start thinking classes/structs and/or arrays
i.e:
honestly i have no idea what your trying to do, or why your referencing too lua while working in c/++(unless your attempting to add scripts to your game?)Code://this code is for c, if i did it in c++, i'd make a class with some constructors rather than filling it manually in the main loop typedef struct{ int x; int y; }PStruct; //position struct int main(int argc, char **argv){ PStruct Position; Position.x = 0; Position.y = 0; printf("%d %d\n", Position.x, Position.y); return 0; }
perhaps further explanation would help
also, for the other question, it's called the alpha channel, i'm not certain if their's a simple command for changing an image's alpha(or if it's possible with graphics.c IIRC it writes directly to the framebuffer)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
-
09-03-2009, 08:46 AM #9939QJ Gamer Silver

- Registriert seit
- Jun 2006
- Ort
- UK
- Beiträge
- 2.326
- Points
- 10.263
- Level
- 67
- Downloads
- 0
- Uploads
- 0
@slicer4ever - He is trying to use the Lua library's function to create a table and insert values into it. In short, he is using C or C++. He is probably trying to extend or write a Lua interpretor.
[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]
-
09-03-2009, 08:56 AM #9940QJ Gamer Gold

- Registriert seit
- Nov 2008
- Ort
- CAD
- Beiträge
- 693
- Points
- 13.372
- Level
- 75
- Downloads
- 19
- Uploads
- 4
nevermind, i've already solved the problem, it was a typo error in my typedef struct :P
and i'm not trying to make a lua interpretor, but a desktop environment, there'll be a release soonThat epic dude.
-
09-11-2009, 02:46 PM #9941QJ Gamer Gold

- Registriert seit
- Nov 2008
- Ort
- CAD
- Beiträge
- 693
- Points
- 13.372
- Level
- 75
- Downloads
- 19
- Uploads
- 4
does any1 know how to return the numeric code of a passed string ?
That epic dude.
-
09-11-2009, 04:30 PM #9942QJ Gamer Gold

- Registriert seit
- Jul 2005
- Ort
- everywhere
- Beiträge
- 3.526
- Points
- 17.453
- Level
- 84
- Downloads
- 1
- Uploads
- 0
atoi(char *string);
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
-
09-12-2009, 04:06 AM #9943QJ Gamer Gold

- Registriert seit
- Nov 2008
- Ort
- CAD
- Beiträge
- 693
- Points
- 13.372
- Level
- 75
- Downloads
- 19
- Uploads
- 4
thank you :)
That epic dude.
-
09-15-2009, 09:27 AM #9944QJ Gamer Gold

- Registriert seit
- Nov 2008
- Ort
- CAD
- Beiträge
- 693
- Points
- 13.372
- Level
- 75
- Downloads
- 19
- Uploads
- 4
okay, new question. does any1 know how to return the ASCII value of a char ?
That epic dude.
-
09-15-2009, 09:32 AM #9945QJ Gamer Silver

- Registriert seit
- Jun 2006
- Ort
- UK
- Beiträge
- 2.326
- Points
- 10.263
- Level
- 67
- Downloads
- 0
- Uploads
- 0
A char is usually an 8 bit integer.Code:char blah = 'j'; int foo = static_cast<int>(blah); // Or int foo2 = static_cast<int>('j');[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]
-
09-15-2009, 09:55 AM #9946QJ Gamer Gold

- Registriert seit
- Nov 2008
- Ort
- CAD
- Beiträge
- 693
- Points
- 13.372
- Level
- 75
- Downloads
- 19
- Uploads
- 4
oh great thanks. maybe this will work:
?Code:int returnASCII(const char *text, int index) { return (int)text[index]; }That epic dude.
-
09-15-2009, 11:50 AM #9947QJ Gamer Gold

- Registriert seit
- Jul 2005
- Ort
- everywhere
- Beiträge
- 3.526
- Points
- 17.453
- Level
- 84
- Downloads
- 1
- Uploads
- 0
umm.... or you could just do:
each ascii is already a 0-255 value(unsigned char an 8 bit type)Code:printf("%d %c\n", 'c', 'c');
so what your doing is no diffrent then:
their really is no need for a function to do that you just need to understand how ascii is representedCode:char *string[] = {'h', 'e', 'l', 'l', 'o', '\0'} printf("%d %c\n", string[0], string[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-17-2009, 02:06 PM #9948QJ Gamer Green
- Registriert seit
- Apr 2006
- Ort
- England ~¦¦¦|+|¦¦¦~
- Beiträge
- 1.112
- Points
- 9.165
- Level
- 64
- My Mood
-
- Downloads
- 0
- Uploads
- 0
I have a problem with extracting how many seconds have passed according to the tick count of the program. This is an extract from my main function:
The seconds go slower than they are supposed to, even though it is compared with the tick resolution. HELP!Code:Res = sceRtcGetTickResolution(); Time = GetCurrentTick(); while(!osl_quit) { if(HitStep) { MS++; HitStep = false; } oslStartDrawing(); sprintf(Display, "Seconds: %i", (int)MS); oslDrawString(0, 0, Display); oslEndDrawing(); if((GetCurrentTick() - Time) >= Res) { HitStep = true; Time = GetCurrentTick(); } oslSyncFrame(); oslAudioVSync(); }...Just Returned To The Scene...
-
10-17-2009, 02:17 PM #9949QJ Gamer Gold

- Registriert seit
- Nov 2008
- Ort
- CAD
- Beiträge
- 693
- Points
- 13.372
- Level
- 75
- Downloads
- 19
- Uploads
- 4
-
10-17-2009, 02:21 PM #9950QJ Gamer Green
- Registriert seit
- Apr 2006
- Ort
- England ~¦¦¦|+|¦¦¦~
- Beiträge
- 1.112
- Points
- 9.165
- Level
- 64
- My Mood
-
- Downloads
- 0
- Uploads
- 0
well, i am just in the testing phase at the moment, im trying to get a second counter based on the ticks. but it doesnt calculate a seconds from the ticks correctly. Dry-run the code and you may understand.
...Just Returned To The Scene...
-
10-17-2009, 02:37 PM #9951QJ Gamer Gold

- Registriert seit
- Nov 2008
- Ort
- CAD
- Beiträge
- 693
- Points
- 13.372
- Level
- 75
- Downloads
- 19
- Uploads
- 4
-
10-17-2009, 03:01 PM #9952QJ Gamer Green
- Registriert seit
- Apr 2006
- Ort
- England ~¦¦¦|+|¦¦¦~
- Beiträge
- 1.112
- Points
- 9.165
- Level
- 64
- My Mood
-
- Downloads
- 0
- Uploads
- 0
Because thats dependant on the speed of the processor? That piece of code doesnt relate to ANY time functions whatsoever!? How can dividing that number by 6 get the amount of seconds!?
...Just Returned To The Scene...
-
10-17-2009, 03:23 PM #9953Developer and Tutor.
- Registriert seit
- Jul 2007
- Ort
- Widnes, England
- Beiträge
- 1.649
- Points
- 8.736
- Level
- 62
- My Mood
-
- Downloads
- 0
- Uploads
- 0
lol, I understand what you are trying to do but why?
------ FaT3oYCG -----
AKA Craig, call me what you want to It's your preference.
My Website: http://www.modern-gamer.co.uk/
Currently working on:
(0) MediaGrab
(0) PGE Gears Of War - On hold (Very large project).
(0) PS???? -On Hold A tactical 2d side scrolling game involving AI and online multiplayer features. - Tile engine nearley finished (1 bug to fix).
-
10-18-2009, 02:10 AM #9954QJ Gamer Gold

- Registriert seit
- Nov 2008
- Ort
- CAD
- Beiträge
- 693
- Points
- 13.372
- Level
- 75
- Downloads
- 19
- Uploads
- 4
-
10-18-2009, 02:56 AM #9955Developer and Tutor.
- Registriert seit
- Jul 2007
- Ort
- Widnes, England
- Beiträge
- 1.649
- Points
- 8.736
- Level
- 62
- My Mood
-
- Downloads
- 0
- Uploads
- 0
------ FaT3oYCG -----
AKA Craig, call me what you want to It's your preference.
My Website: http://www.modern-gamer.co.uk/
Currently working on:
(0) MediaGrab
(0) PGE Gears Of War - On hold (Very large project).
(0) PS???? -On Hold A tactical 2d side scrolling game involving AI and online multiplayer features. - Tile engine nearley finished (1 bug to fix).
-
10-18-2009, 05:52 AM #9956QJ Gamer Gold

- Registriert seit
- Jul 2005
- Ort
- everywhere
- Beiträge
- 3.526
- Points
- 17.453
- Level
- 84
- Downloads
- 1
- Uploads
- 0
you should really know what your talking about when you respond, what your doing, as Jaso pointed out, is dependent on the processor speed, and is not guranteed to be correct depending on rather the processor isn't bogged down, also, dividing by 6 would not give you the number of seconds
@jaso, have you considered using the time function from stdlib
if all your trying to do is detect change in seconds the time function should be sufficient for your needsCode:int main(int argc, char **argv){ int CurrTime = time(NULL); int OldTime = CurrTime; while(1){ CurrTime = time(NULL); if(CurrTime-OldTime!=0){ OldTime = CurrTime; //Code for animation } } 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-18-2009, 06:13 AM #9957QJ Gamer Silver

- Registriert seit
- Jun 2006
- Ort
- UK
- Beiträge
- 2.326
- Points
- 10.263
- Level
- 67
- Downloads
- 0
- Uploads
- 0
Where did GetCurrentTick come from? If you are using sceRtcGetTickResolution then shouldn't you be using sceRtcGetCurrentTick? When you say the seconds are going slower, how much slower? A lot or very small amounts?
I would try:
Although not really a concern now, also be aware of integers wrapping back to 0 when they get too large.Code:Res = sceRtcGetTickResolution(); Time = GetCurrentTick(); while(!osl_quit) { oslStartDrawing(); oslDrawString(0, 0, Display); oslEndDrawing(); if((GetCurrentTick() - Time) >= Res) { MS += 1; // To deal with 'overflow' as GetCurrentTick() - Time is never // going to be exactly equal to Res Time = Time + Res; } sprintf(Display, "Seconds: %i", (int)MS); oslSyncFrame(); oslAudioVSync(); }[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-18-2009, 09:45 AM #9958QJ Gamer Green
- Registriert seit
- Apr 2006
- Ort
- England ~¦¦¦|+|¦¦¦~
- Beiträge
- 1.112
- Points
- 9.165
- Level
- 64
- My Mood
-
- Downloads
- 0
- Uploads
- 0
Ok a few things to make it easier to understand (sorry for the confusion).
GetCurrentTick is a function made by myself so i didnt have to create a variable to use as the parameter for sceRtcGetCurrentTick(), instead it jus returns a u64 value. It DOES use sceRtcGetCurrentTick() however.
The thing is, this program will end up needing a 'Beats Per Minute'. In order to calculate that, i need to be able to convert ticks into milliseconds, as opposed to using a pspTime struct and using functions to get the time.
At the moment, a full cycle of a 'Drum Beat' in my program has 16 steps. 'HitStep' is set to true when the next step is hit, according to the Beats Per Minute. So, as it runs through the loop, the time differences between the current tick and the last hit increase until it needs to hit another step. (This is getting confusing, even to type).
If you can extract any sort of sense from that, please help me all you can. I havent had time to try out the suggestions from slicer and yaustar (im going to ignore mootjeuh's wonderland suggestion) yet.
Thanks...Just Returned To The Scene...
-
10-18-2009, 10:05 AM #9959QJ 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
-
10-18-2009, 11:19 AM #9960QJ Gamer Green
- Registriert seit
- Apr 2006
- Ort
- England ~¦¦¦|+|¦¦¦~
- Beiträge
- 1.112
- Points
- 9.165
- Level
- 64
- My Mood
-
- Downloads
- 0
- Uploads
- 0
it stays at a constant rate, slower than a usual second, and i cant seem to calibrate it to exactly one second :/
...Just Returned To The Scene...


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