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 joseph10444 okay so this is my code *snip* so the "hello" would appear in white then the "hello ...
-
06-10-2008, 04:13 PM #8641QJ 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]
-
06-10-2008, 05:15 PM #8642lol

- Registriert seit
- Aug 2006
- Ort
- Whittier, CA
- Beiträge
- 5.791
- Points
- 20.859
- Level
- 91
- Downloads
- 0
- Uploads
- 0
Say I have an encryption chart.
Like A = 1561456, B = 54564
How would I make that into something I can use to decrypt data from a txt file.
example;
I have a text file
I want to be able to decrypt it to AB.1561456 54564
-
06-10-2008, 05:20 PM #8643It's good to be free...

- Registriert seit
- Feb 2007
- Beiträge
- 2.440
- Points
- 10.420
- Level
- 67
- Downloads
- 0
- Uploads
- 0
fscanf, as is recommended quite often in this thread.
pəʇuɒɹɓ ɹoɟ ɓuɪɥʇou əʞɒʇ
-
06-10-2008, 05:39 PM #8644lol

- Registriert seit
- Aug 2006
- Ort
- Whittier, CA
- Beiträge
- 5.791
- Points
- 20.859
- Level
- 91
- Downloads
- 0
- Uploads
- 0
ok now how would i make the decryption process?
How would i make the psp know to decrypt 1561456 54564 into AB?
-
06-10-2008, 05:42 PM #8645It's good to be free...

- Registriert seit
- Feb 2007
- Beiträge
- 2.440
- Points
- 10.420
- Level
- 67
- Downloads
- 0
- Uploads
- 0
Ohh, wait, the spaced aren't going to be there in the final thing, are they? Well, then it comes down to simple parsing. Just check what the first number is, branch depending on what it is, check the next number, branch again or fail if it doesn't line up with expected values, continue until you reach a leaf on the tree of possibilities, and then continue at the root of the tree. Simple as that.
pəʇuɒɹɓ ɹoɟ ɓuɪɥʇou əʞɒʇ
-
06-10-2008, 05:45 PM #8646lol

- Registriert seit
- Aug 2006
- Ort
- Whittier, CA
- Beiträge
- 5.791
- Points
- 20.859
- Level
- 91
- Downloads
- 0
- Uploads
- 0
The space wont be included... thanx
I am making a device for me to apply a cheat such as 0x1234578 0x87654321
0x12345678 is the address
0x87654321 is the data
I will then apply this cheat to the game, but i want it to load a encrpyted version then decrypt it then apply it...
-
06-10-2008, 05:50 PM #8647It's good to be free...

- Registriert seit
- Feb 2007
- Beiträge
- 2.440
- Points
- 10.420
- Level
- 67
- Downloads
- 0
- Uploads
- 0
Just so you know, such a simple substitution cypher is easily defeated.
pəʇuɒɹɓ ɹoɟ ɓuɪɥʇou əʞɒʇ
-
06-10-2008, 05:58 PM #8648lol

- Registriert seit
- Aug 2006
- Ort
- Whittier, CA
- Beiträge
- 5.791
- Points
- 20.859
- Level
- 91
- Downloads
- 0
- Uploads
- 0
It will run though several encryption layers.. Then to decrypt repeat the process but backwards using the decryption methods.
-
06-10-2008, 06:14 PM #8649Local Tech
- Registriert seit
- Oct 2007
- Ort
- home
- Beiträge
- 1.821
- Points
- 9.044
- Level
- 63
- Downloads
- 1
- Uploads
- 0
yeah i got R G and B but i dont really get how to make other colours
thanks for the link
like its always 0xFF(R)(G)(B) where two FFs go inside the brackets..
and whats "syntax"?
i was doing to the counter tutorial at pspprogramming.com and i got a lot of syntax errors
-
06-10-2008, 06:17 PM #8650It's good to be free...

- Registriert seit
- Feb 2007
- Beiträge
- 2.440
- Points
- 10.420
- Level
- 67
- Downloads
- 0
- Uploads
- 0
Um, no, you're doing it wrong. Just use the GU_RGBA macro to do colors for you, where each parameter is a number from 0 to 255. The higher the number, the more intense the color. For the fourth parameter, you'll probably want to use 255 all the time.
Syntax...well, if you're getting syntax errors, you're really doing it wrong. Syntax errors mean you didn't construct the file properly.pəʇuɒɹɓ ɹoɟ ɓuɪɥʇou əʞɒʇ
-
06-11-2008, 02:01 AM #8651QJ Gamer Green
- Registriert seit
- May 2008
- Beiträge
- 96
- Points
- 3.008
- Level
- 33
- Downloads
- 0
- Uploads
- 0
I don't want it zelda style, cause zelda is not such a great action game and this game is based on action so the screen must move real time.
You gave me an idea, but still i get stuck somewhere.
Let me explain the rest in words cause else it will be a way to long code.Code://begin code int playery = 136;//player at center int playerx = 240;//player at center int screenx = 0;//screen at begin 0 top left corner int screeny = 0;//screen at begin 0 top left corner initGraphics(); //LOAD IMAGES blablalba texture1Img=loadImage("gfx/tex/tex1.png"); playerImg=loadImage("gfx/player.png"); int main(){ //draw event startDrawing(); drawImage(texture1Img,screenx,screeny,0); drawImage(playerImage,playerx,playery,0); endDrawing();
everytime the character moves any direction playerx gets +2 values added adn the screenx gets also +2 values added same thing for screeny and playery.
But still this dont works....
I can continue my code, but it wont have any sense since this isn't working when i put textx < textx+480 and texty < texty+272 and try to launch the game with my PSP I get a black screen...
-
06-11-2008, 02:32 AM #8652QJ Gamer Green
- Registriert seit
- May 2008
- Beiträge
- 96
- Points
- 3.008
- Level
- 33
- Downloads
- 0
- Uploads
- 0
Okay I finnaly get some effect, ofcourse this is not what I want but comeone I get the screen XDXD, guys really this pisses me off!!
I will show you what I get!!

I've made 2 screenshots with my psp, this is what i get!!
The only thing that moves is the texture and the player the screen does not move!!!
And the screen is weird, but i've fixed that now.Geändert von Predricted (06-11-2008 um 03:51 AM Uhr)
-
06-11-2008, 03:51 AM #8653
Joseph: get a begginer C book or something before you tryr and go further. Read it twice.
anti-quickjay: XOR is your friend.predriected: if you want to scroll the background without scrolling the player, just change the internal blit offset of the texture/background image then blit the player back to the middle of the screen?Code:a = input_data ^ my_magic_number;
or did you want to scroll the screen only when the player gets close to an edge?-- Code Monkey : Sarien, Fishguts, Cracks and Crevices --
"Did IQ's just drop sharply while I was away?" (Ripley)
-
06-11-2008, 03:52 AM #8654NetGameOrb Maker

- Registriert seit
- Jan 2008
- Ort
- New York
- Beiträge
- 683
- Points
- 6.138
- Level
- 50
- My Mood
-
- Downloads
- 2
- Uploads
- 0
please post your whole code to see if i can help
and by the way do you want it to move as the player move. i mean the screen?GameLive name changed to NetGameOrb, Project is now online in Beta stage. Everyone encourage to register so they get news about the project and ability to play the games with NetGameOrb Support online. More info on site.
Stats Blog:http://netgameorb.blogspot.com/
Website:http://www.netgameorb.com/
-
06-11-2008, 03:56 AM #8655Local Tech
- Registriert seit
- Oct 2007
- Ort
- home
- Beiträge
- 1.821
- Points
- 9.044
- Level
- 63
- Downloads
- 1
- Uploads
- 0
-
06-11-2008, 04:01 AM #8656Developer

- Registriert seit
- Mar 2006
- Beiträge
- 1.026
- Points
- 7.577
- Level
- 58
- Downloads
- 0
- Uploads
- 0

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
-
06-11-2008, 04:04 AM #8657Developer

- Registriert seit
- Mar 2006
- Beiträge
- 1.026
- Points
- 7.577
- Level
- 58
- Downloads
- 0
- Uploads
- 0
As _df_ said XOR is great for simple encryption, as you can encrypt and decrypt using the same function.
http://www.cprogramming.com/tutorial/xor.html
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
-
06-11-2008, 05:08 AM #8658QJ Gamer Green
- Registriert seit
- May 2008
- Beiträge
- 96
- Points
- 3.008
- Level
- 33
- Downloads
- 0
- Uploads
- 0
Did you play CSPSP I want it to move like that, this means that the player is all the time at the center of the screen and whe it moves the screen follows him.Code:#include <pspkernel.h> #include <pspdisplay.h> #include <pspdebug.h> #include <pspctrl.h> #include <string.h> #include "callbacks.h" #include "graphics2d.h" #define PI (3.14159) #define DEG2RAD(a) (a*PI/180.0f) PSP_MODULE_INFO("The Gladiators Arena",0,1,1); int main() { int win = 0; int playery = 136; int playerx = 240; int screenx = 0; int screeny = 0; int globalx = 1200; int globaly = 1200; Image* texture2Img; Image* texture3Img; Image* texture4Img; Image* warriormaImg; SceCtrlData pad; pspDebugScreenInit(); setupCallbacks(); initGraphics(); // *** load images. PNG files are supported *** texture2Img = loadImage("gfx/tex2.png"); texture3Img = loadImage("gfx/tex3.png"); texture4Img = loadImage("gfx/tex4.png"); warriormaImg = loadImage("gfx/warriormale.png"); if( texture2Img == NULL || texture3Img == NULL || texture4Img == NULL || warriormaImg == NULL ) { sceKernelExitGame(); return -1; } sceKernelDcacheWritebackAll(); while( running() ) { startDrawing(); int textx=0; int texty=0; while (textx < 1200) { while (texty < 1200) { drawImage(texture2Img,textx,texty,0); texty += 128; } textx += 128; texty = 0; } drawImage(warriormaImg,playerx,playery,DEG2RAD(win)); endDrawing(); sceDisplayWaitVblankStart(); sceCtrlSetSamplingMode(1); sceCtrlPeekBufferPositive(&pad, 1); //Up if(pad.Ly >= 140 && pad.Ly <= 160) {playery=playery+0.8;} if(pad.Ly >= 161 && pad.Ly <= 199) {playery=playery+1.2;} if(pad.Ly >= 200 && pad.Ly <= 234) {playery=playery+1.6;} if(pad.Ly >= 235 && pad.Ly == 255) {playery=playery+2;} //Down if(pad.Ly <= 100 && pad.Ly > 91) {playery=playery-0.8;} if(pad.Ly <= 90 && pad.Ly > 61) {playery=playery-1.2;} if(pad.Ly <= 60 && pad.Ly > 21) {playery=playery-1.6;} if(pad.Ly <= 20 && pad.Ly == 0) {playery=playery-2;} //stop vert (up down) if(pad.Ly >= 101 && pad.Ly <=139) {playery=playery;} //Right if(pad.Lx >= 140 && pad.Lx <= 160) {playerx=playerx+0.8;} if(pad.Lx >= 161 && pad.Lx <= 199) {playerx=playerx+1.2;} if(pad.Lx >= 200 && pad.Lx <= 234) {playerx=playerx+1.6;} if(pad.Lx >= 235 && pad.Lx == 255) {playerx=playerx+2;} //Left if(pad.Lx <= 100 && pad.Lx >= 91) {playerx=playerx-0.8;} if(pad.Lx <= 90 && pad.Lx >= 61) {playerx=playerx-1.2;} if(pad.Lx <= 60 && pad.Lx >= 21) {playerx=playerx-1.6;} if(pad.Lx <= 20 && pad.Lx == 0) {playerx=playerx-2;} //stop horzt(left right) if(pad.Lx >= 101 && pad.Lx <=139) {playerx=playerx;} if(pad.Buttons & PSP_CTRL_CIRCLE) { win=win+5; } if(pad.Buttons & PSP_CTRL_SQUARE) { win=win-5; } flipScreen(); } endGraphics(); freeImage(texture2Img); freeImage(texture3Img); freeImage(texture4Img); freeImage(warriormaImg); sceKernelExitGame(); return 0; }
-
06-11-2008, 05:21 AM #8659QJ Gamer Green
- Registriert seit
- May 2008
- Beiträge
- 96
- Points
- 3.008
- Level
- 33
- Downloads
- 0
- Uploads
- 0
-
06-11-2008, 05:56 AM #8660QJ Gamer Silver

- Registriert seit
- Jun 2006
- Ort
- UK
- Beiträge
- 2.326
- Points
- 10.263
- Level
- 67
- Downloads
- 0
- Uploads
- 0
Try reading this article on numbering systems: http://www.gamedev.net/reference/art...rticle1563.asp
Taken from: http://www.homebrew-illuminati.co.uk...hp?topic=147.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]
-
06-11-2008, 09:12 AM #8661NetGameOrb Maker

- Registriert seit
- Jan 2008
- Ort
- New York
- Beiträge
- 683
- Points
- 6.138
- Level
- 50
- My Mood
-
- Downloads
- 2
- Uploads
- 0
ok let see if i can help
first of all i recommend you to use blitAlphaImageToScreen or a similar command to that to get better control of what you will draw to screen
this is just a little example that you could useCode:int main() { int win = 0; int playery = 136; int playerx = 240; int screenx = 0; int screeny = 0; int mapW = 512; // here we will store map width int mapH= 512; //here we will store map heigth int globalx = 1200; int globaly = 1200; Image* texture2Img; Image* texture3Img; Image* texture4Img; Image* warriormaImg; SceCtrlData pad; pspDebugScreenInit(); setupCallbacks(); initGraphics(); // *** load images. PNG files are supported *** texture2Img = loadImage("gfx/tex2.png"); texture3Img = loadImage("gfx/tex3.png"); texture4Img = loadImage("gfx/tex4.png"); warriormaImg = loadImage("gfx/warriormale.png"); if( texture2Img == NULL || texture3Img == NULL || texture4Img == NULL || warriormaImg == NULL ) { sceKernelExitGame(); return -1; } sceKernelDcacheWritebackAll(); while( running() ) { startDrawing(); int textx=0; int texty=0; while (textx < 1200) { while (texty < 1200) { blitAlphaImageToScreen(screenx,screeny,480,272,texture2Img,0,0);//blit the portion of the map that we are on to 0,0 on the psp screen texty += 128; } textx += 128; texty = 0; } drawImage(warriormaImg,playerx,playery,DEG2RAD(win)); endDrawing(); sceDisplayWaitVblankStart(); sceCtrlSetSamplingMode(1); sceCtrlPeekBufferPositive(&pad, 1); //Up if(pad.Ly >= 140 && pad.Ly <= 160) { screeny=screeny+0.8; //move the screen down 0.8 to see the rest of the map if (screeny + 272 > mapH) { //if screen y is larger then map heigth we will screeny = mapH - 272; //set the screen y to mapH - 272 so it will fit correctly playery=playery+0.8; //and move player down 0.8 instead so it wont look like he isnt moveing } } //here it end so on so on..
the player will only move if you screen have reach the end of the map.
i hope that will give you a ideaGameLive name changed to NetGameOrb, Project is now online in Beta stage. Everyone encourage to register so they get news about the project and ability to play the games with NetGameOrb Support online. More info on site.
Stats Blog:http://netgameorb.blogspot.com/
Website:http://www.netgameorb.com/
-
06-11-2008, 09:43 AM #8662QJ Gamer Green
- Registriert seit
- May 2008
- Beiträge
- 96
- Points
- 3.008
- Level
- 33
- Downloads
- 0
- Uploads
- 0
-
06-11-2008, 10:55 AM #8663NetGameOrb Maker

- Registriert seit
- Jan 2008
- Ort
- New York
- Beiträge
- 683
- Points
- 6.138
- Level
- 50
- My Mood
-
- Downloads
- 2
- Uploads
- 0
GameLive name changed to NetGameOrb, Project is now online in Beta stage. Everyone encourage to register so they get news about the project and ability to play the games with NetGameOrb Support online. More info on site.
Stats Blog:http://netgameorb.blogspot.com/
Website:http://www.netgameorb.com/
-
06-11-2008, 11:07 AM #8664QJ Gamer Bronze
- Registriert seit
- Apr 2008
- Ort
- Ireland
- Beiträge
- 978
- Points
- 6.517
- Level
- 52
- Downloads
- 0
- Uploads
- 0
Ok i got got question how to i load an image and keep it for say 5 seconds? i cant remember the code any1 help?
Something like that?Code:loadImage("image.png"); sceKernelDelayImage(10*1000*1000);
-
06-11-2008, 11:08 AM #8665It's good to be free...

- Registriert seit
- Feb 2007
- Beiträge
- 2.440
- Points
- 10.420
- Level
- 67
- Downloads
- 0
- Uploads
- 0
It's kept until you unload it...
But just keeping it doesn't have anything to do with whether or not it's on screen, which is I assume what you want.pəʇuɒɹɓ ɹoɟ ɓuɪɥʇou əʞɒʇ
-
06-11-2008, 11:11 AM #8666QJ Gamer Bronze
- Registriert seit
- Apr 2008
- Ort
- Ireland
- Beiträge
- 978
- Points
- 6.517
- Level
- 52
- Downloads
- 0
- Uploads
- 0
i want it to load at start of my game stay for 5 seconds and then load the game functions
-
06-11-2008, 11:12 AM #8667QJ Gamer Green
- Registriert seit
- May 2008
- Beiträge
- 96
- Points
- 3.008
- Level
- 33
- Downloads
- 0
- Uploads
- 0
I've tried to download that with cygwin svn command, but that didnt work
svn checkout svn://svn.pspdev.org/psp/trunk/libpng
So i downloaded it just from a site now when I put it at the right place and, then i do in cygwin:
cd oslib
then i do the command
make
it shows this error:
makefile:1: config.mk: no such file or directory
make :*** No rule to make target 'config.mk'. Stop.
Am I doing something wrong?
-
06-11-2008, 11:14 AM #8668QJ Gamer Bronze
- Registriert seit
- Apr 2008
- Ort
- Ireland
- Beiträge
- 978
- Points
- 6.517
- Level
- 52
- Downloads
- 0
- Uploads
- 0
dual boot linux far better and easier!
-
06-11-2008, 11:34 AM #8669NetGameOrb Maker

- Registriert seit
- Jan 2008
- Ort
- New York
- Beiträge
- 683
- Points
- 6.138
- Level
- 50
- My Mood
-
- Downloads
- 2
- Uploads
- 0
try downloading oslib mod 1.0.1
that the one i used and it worked perfectly for meGameLive name changed to NetGameOrb, Project is now online in Beta stage. Everyone encourage to register so they get news about the project and ability to play the games with NetGameOrb Support online. More info on site.
Stats Blog:http://netgameorb.blogspot.com/
Website:http://www.netgameorb.com/
-
06-11-2008, 01:57 PM #8670QJ Gamer Green
- Registriert seit
- May 2008
- Beiträge
- 96
- Points
- 3.008
- Level
- 33
- Downloads
- 0
- Uploads
- 0
When i download that mod from http://svn2.assembla.com/svn/oslibmod/trunk
with svn checkout command then i do
cd trunk
then i do
make
then i get errors
Can u explain?


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