QJ.NET | Videos | Forums | iPhone | MMORPG | Nintendo DS | Wii | PlayStation 3 | PSP | Xbox 360 | PC | Downloads | Contact Us
Forums | Gaming News | Videos | Downloads | Today's Posts | Mark Forums Read | Chat | FAQ | Members List | Contact

QJ.net Game Discussion - PSP, Xbox, Wii, PS3, PSP Homebrew, and PSP Guides

Go Back   QJ.net Game Discussion - PSP, Xbox, Wii, PS3, PSP Homebrew, and PSP Guides > Developers Corner > PSP Development, Hacks, and Homebrew > PSP Development Forum
The above video goes away if you are a member and logged in, so log in now!

can i have a c source code

This is a discussion on can i have a c source code within the PSP Development Forum forums, part of the PSP Development, Hacks, and Homebrew category; can i have a c source code for a game so i can see how its put together ps- i ...

Reply
 
LinkBack Thread Tools
Old 03-11-2007, 05:25 PM   #1
 
Ba11in13's Avatar
 
Join Date: Feb 2007
Posts: 250
Trader Feedback: 0
Default can i have a c source code

can i have a c source code for a game so i can see how its put together

ps- i will NOT stael your code
Ba11in13 is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Old 03-11-2007, 05:26 PM   #2
Enter Custom Title
 
Chathurga's Avatar
 
Join Date: Mar 2006
Location: Ireland
Posts: 2,089
Trader Feedback: 0
Default

For any game? Search dl.qj.net, there may be a game with source included.
Chathurga is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Old 03-11-2007, 05:58 PM   #3
 
Ba11in13's Avatar
 
Join Date: Feb 2007
Posts: 250
Trader Feedback: 0
Default

ok
Ba11in13 is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Old 03-11-2007, 06:01 PM   #4

I'm Baaaack!
 
Access_Denied's Avatar
 
Join Date: May 2006
Location: Waukegan,Illinois
Posts: 2,185
Trader Feedback: 0
Default

What kind of source do you want? Like a menu code, or an actual game. If it's simple enough, I can write one for you and comment it.
__________________
Access_Denied is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Old 03-11-2007, 06:05 PM   #5
 
Join Date: Jul 2006
Location: NorCal
Posts: 24,900
Trader Feedback: 0
Default

Code:
// Holla World! - My First App for the PSP

/*
          This program was created by Bob on 1/1/
          
*/

#include <pspkernel.h>
#include <pspdebug.h>

PSP_MODULE_INFO("Hello World", 0, 1, 1);
#define printf pspDebugScreenPrintf 
/* Exit callback */
int exit_callback(int arg1, int arg2, void *common) {
          sceKernelExitGame();
          return 0;
}

int CallbackThread(SceSize args, void *argp) {
          int cbid;

          cbid = sceKernelCreateCallback("Exit Callback", exit_callback, NULL);
          sceKernelRegisterExitCallback(cbid);

          sceKernelSleepThreadCB();

          return 0;
}

int SetupCallbacks(void) {
          int thid = 0;

          thid = sceKernelCreateThread("update_thread", CallbackThread, 0x11, 0xFA0, 0, 0);
          if(thid >= 0) {
                    sceKernelStartThread(thid, 0, 0);
          }

          return thid;
}

int main() {
pspDebugScreenInit();
SetupCallbacks();
printf("Hello World");
sceKernelSleepThread();
return 0;
}
__________________
If you ever need me, you can contact me at [URL="**********.net"]**********.net.[/URL]
Adiuvo is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Old 03-11-2007, 06:23 PM   #6
 

 
Join Date: Jun 2005
Location: Behind you!
Posts: 451
Trader Feedback: 0
Default

I think you scared him off :O
__________________
NOTICE: By the time you have noticed this notice, you will have noticed that this notice is not worth noticing.

FW History: 1.5>3.03OE-C>3.52 m33
seventoes is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Old 03-11-2007, 06:40 PM   #7
 
Join Date: Jul 2005
Posts: 944
Trader Feedback: 0
Default

Hello world is the most common one EVER so um not useful
1magus is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Old 03-11-2007, 06:40 PM   #8

I'm Baaaack!
 
Access_Denied's Avatar
 
Join Date: May 2006
Location: Waukegan,Illinois
Posts: 2,185
Trader Feedback: 0
Default

Here's a basic menu that *should* work. Somebody let me know if there's problems.

main.c
Code:
#include <pspkernel.h>
#include <pspdebug.h>
#include <stdio.h>
#include <string.h>
#include <pspctrl.h>
#include "graphics.h"
#define printc printTextCentered
#define RGB(r, g, b) ((r) | ((g) <<8) | ((b) <<16))
PSP_MODULE_INFO("Menu Example",0,1,1);

//our colors
Color yellow = RGB(255,255,0);
Color black = RGB(0,0,0);
Color blue = RGB(0,0,255);

//Custom function to print Text perfectly centered
void printTextCentered(int y,char* text,u32 color)
{
     //get length of string
     auto int length = strlen(text);
     //take length of string and multiply by 8 since each letter is 8 pixels wide
     //subtract half of that from 240 to center it
     auto int x = 240 - ((length*8)/2);
     //now print it to the screen using the inputed y position, text and color, and use the x coordinate we made
     printTextScreen(x,y,text,color);
}

//integer to keep track of menu status
int select = 0;

//timer we'll need later
int timer = 0;

//variable we'll need later
int pos;

//table to hold menu entries
//6 options, each able to hold 50 characters including the /0 terminator
char menu[6][50] = {
     {"Start"},
     {"Difficulty"},
     {"Sound Options"},
     {"Gameplay Options"},
     {"Cheat Codes"},
     {"Exit"},
};


//start of main function
int main() {
    //initiate graphics buffer so we can use the screen
    initGraphics();
    //assign variable 'pad' to the buttons
    SceCtrlData pad;
    //start of endless loop
    while(1) {
             //clear the screen yellow
             clearScreen(yellow);
             //initialize button input
             sceCtrlReadBufferPositive(&pad, 1);
             //increase the timer, so we can control button input later
             timer++;
             //print our 6 menu options using a for loop
             for(pos=0;pos<6;pos++) {
                                    printc((pos*10)+110,menu[pos],black);
             }
             //print the selected menu choice over the old one, in a different color
             printc((select*10)+110,menu[select],blue);
             //make it so if we press up, select decreases, but only to 0, not lower than 0
             //also make it so the timer be greater than 10, so we can control the speed of the movement
             if((pad.Buttons & PSP_CTRL_UP) && (select > 0) && (timer > 10)) {
                             //decrease select variable
                             select--;
                             //set timer to 0 to control speed
                             timer = 0;
             }
             //same thing with down button
             if((pad.Buttons & PSP_CTRL_DOWN) && (select < 5) && (timer > 10)) {
                             //increase select variable
                             select++;
                             //set timer to 0 to control speed
                             timer = 0;
             }
             //make it so if select is equal to 5("exit" is highlighted) and we press X, it will exit
             if((pad.Buttons & PSP_CTRL_CROSS) && (select == 5)) {
                             //exit the game
                             sceKernelExitGame();
             }
             //flip the screen so we can see everything
             flipScreen();
    //finish the endless loop
    }
    return 0;
}
Makefile
Code:
TARGET = example
OBJS = main.o graphics.o framebuffer.o

CFLAGS = -O2 -G0 -Wall
CXXFLAGS = $(CFLAGS) -fno-exceptions -fno-rtti
ASFLAGS = $(CFLAGS)

LIBS = -lpspgu -lpng -lz -lm

EXTRA_TARGETS = EBOOT.PBP
PSP_EBOOT_TITLE = Example

PSPSDK=$(shell psp-config --pspsdk-path)
include $(PSPSDK)/lib/build.mak
__________________
Access_Denied is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Old 03-12-2007, 02:48 AM   #9

Developer
 
yaustar's Avatar
 
Join Date: Jun 2006
Location: UK
Posts: 2,317
Trader Feedback: 0
Default

C++ TicTacToe in the command window:
PDF document on how is it put together and why (WIP) http://parabellumgames.no-ip.org/art...ing-practises/
Source Code
http://parabellumgames.no-ip.org/art...tactoe-source/

Dance2x for the GP2X SDL
Project Page with Videos
http://parabellumgames.no-ip.org/yaustar/dance2x.php
Source Code
http://archive.gp2x.de/cgi-bin/cfile...,0,0,0,46,1722
Report
http://yaustar.pwp.blueyonder.co.uk/...fullreport.pdf

PS for Dance2x, do NOT copy the commenting style in the .cpp files, I was trying a different programming method/style and I have since realised it is relatively poor in terms of maintenence.

Last edited by yaustar; 03-12-2007 at 04:42 AM..
yaustar is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply

Tags
code , source

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off



All times are GMT -8. The time now is 03:46 PM.



Use of this Web site constitutes acceptance of the TERMS & CONDITIONS and PRIVACY POLICY
Copyright © 2009, QJ.NET. All Rights Reserved.
Contact Us