Skip to: Site menu | Main content


Welcome to PSP-Programming.com, a place for developers to get together.

Welcome to the forums. Here you can find other user tutorials as well as homebrew releases and the source code repository. You can also ask for help with your code here and post your own homebrew!

PSP-Programming.com Forums
February 08, 2012, 07:12:20 PM *
Welcome, Guest. Please login or register.
Did you miss your activation email?

Login with username, password and session length

News: Join our IRC channel: ##psp-programming on freenode
Home Help Search Shop Login Register
Digg This!
Pages: 1 [2]
Print
Author Topic: Coding for the PSP with Visual Studio - It's never been easier!  (Read 7756 times)
pentagram
Newbie
*

Karma: +0/-0
Offline Offline

Posts: 42
2559.21 points

View Inventory
Send Money to pentagram

View Profile
« Reply #15 on: November 02, 2009, 12:52:05 PM »

1.Any tutorial using psplink?

2. Ok. I`ve done that with cmd.

Code:
C:\@PSPDEVkizko\pspf>cd C:\pspsdk\psp\sdk\samples\power

C:\pspsdk\psp\sdk\samples\power>make
psp-gcc -I. -IC:/pspsdk/psp/sdk/include -O2 -G0 -Wall -D_PSP_FW_VERSION=150   -c
 -o main.o main.c
psp-gcc -I. -IC:/pspsdk/psp/sdk/include -O2 -G0 -Wall -D_PSP_FW_VERSION=150  -L.
 -LC:/pspsdk/psp/sdk/lib   main.o -lpsppower -lpspdebug -lpspdisplay -lpspge -lp
spctrl -lpspsdk -lc -lpspnet -lpspnet_inet -lpspnet_apctl -lpspnet_resolver -lps
putility -lpspuser -lpspkernel -o powersample.elf
psp-fixup-imports powersample.elf

C:\pspsdk\psp\sdk\samples\power>


But i only have main.o and other file, no EBOOT.PBP

Here is the main.c
Code:
/*
 * PSP Software Development Kit - http://www.pspdev.org
 * -----------------------------------------------------------------------
 * Licensed under the BSD license, see LICENSE in PSPSDK root for details.
 *
 * main.c - Sample to demonstrate proper use of the power library
 *
 * Copyright (c) 2005 John Kelley <ps2dev@kelley.ca>
 *
 * $Id: main.c 1869 2006-04-09 14:21:59Z tyranid $
 */
#include <pspkernel.h>
#include <pspdebug.h>
#include <pspctrl.h>
#include <pspdisplay.h>
#include <stdio.h>
#include <pspmoduleinfo.h>
#include <psppower.h>

/* Define the module info section */
PSP_MODULE_INFO("PowerTest", 0, 0, 71);

char powerCBMessage[256];

/* Define printf, just to make typing easier */
#define printf  pspDebugScreenPrintf

/* Exit callback */
int exit_callback(int arg1, int arg2, void *common)
{
    sceKernelExitGame();

return 0;
}

/* Power Callback */
int power_callback(int unknown, int pwrflags, void *common)
{
    /* check for power switch and suspending as one is manual and the other automatic */
    if (pwrflags & PSP_POWER_CB_POWER_SWITCH || pwrflags & PSP_POWER_CB_SUSPENDING) {
sprintf(powerCBMessage,
"first arg: 0x%08X, flags: 0x%08X: suspending\n", unknown, pwrflags);
    } else if (pwrflags & PSP_POWER_CB_RESUMING) {
sprintf(powerCBMessage,
"first arg: 0x%08X, flags: 0x%08X: resuming from suspend mode\n",
unknown, pwrflags);
    } else if (pwrflags & PSP_POWER_CB_RESUME_COMPLETE) {
sprintf(powerCBMessage,
"first arg: 0x%08X, flags: 0x%08X: resume complete\n", unknown, pwrflags);
    } else if (pwrflags & PSP_POWER_CB_STANDBY) {
sprintf(powerCBMessage,
"first arg: 0x%08X, flags: 0x%08X: entering standby mode\n", unknown, pwrflags);
    } else {
sprintf(powerCBMessage, "first arg: 0x%08X, flags: 0x%08X: Unhandled power event\n", unknown, pwrflags);
    }
    sceDisplayWaitVblankStart();

return 0;
}

/* Callback thread */
int CallbackThread(SceSize args, void *argp)
{
    int cbid;
    cbid = sceKernelCreateCallback("Exit Callback", exit_callback, NULL);
    sceKernelRegisterExitCallback(cbid);
    cbid = sceKernelCreateCallback("Power Callback", power_callback, NULL);
    scePowerRegisterCallback(0, cbid);
    sceKernelSleepThreadCB();

return 0;
}

/* Sets up the callback thread and returns its thread id */
int SetupCallbacks(void)
{
    int thid = 0;
    thid = sceKernelCreateThread("update_thread", CallbackThread, 0x11, 0xFA0, 0, 0);
    if (thid >= 0)
sceKernelStartThread(thid, 0, 0);
    return thid;
}

/* main routine */
int main(int argc, char *argv[])
{
    SceCtrlData pad;
    int i = 0;
    int powerLocked = 0;
    int powerTicks = 0;
    u32 oldButtons = 0;
    int batteryLifeTime = 0;
    
    //init screen and callbacks
    pspDebugScreenInit();
    pspDebugScreenClear();
    SetupCallbacks();

    // Setup Pad
    sceCtrlSetSamplingCycle(0);
    sceCtrlSetSamplingMode(0);

    //fetch and print out power and battery information
    for (;;) {
     /* fix so the screen lines up right if the battery disappears */
     if (!scePowerIsBatteryExist()) {
   pspDebugScreenClear();
     }
    
pspDebugScreenSetXY(0, 0);
printf("PSP Power Sample v1.0 by John_K\n\n");
sceCtrlReadBufferPositive(&pad, 1);

printf("External Power: %s\n", scePowerIsPowerOnline()? "yes" : "no ");
printf("%-14s: %s\n", "Battery", scePowerIsBatteryExist()? "present" : "absent ");

if (scePowerIsBatteryExist()) {
   printf("%-14s: %s\n", "Low Charge", scePowerIsLowBattery()? "yes" : "no ");
   printf("%-14s: %s\n", "Charging", scePowerIsBatteryCharging()? "yes" : "no ");
   batteryLifeTime = scePowerGetBatteryLifeTime();
   printf("%-14s: %d%% (%02dh%02dm)     \n", "Charge",
  scePowerGetBatteryLifePercent(), batteryLifeTime/60, batteryLifeTime-(batteryLifeTime/60*60));
   printf("%-14s: %0.3fV\n", "Volts", (float) scePowerGetBatteryVolt() / 1000.0);
   printf("%-14s: %d deg C\n", "Battery Temp", scePowerGetBatteryTemp());
} else
   printf("Battery stats unavailable\n");

printf("%-14s: %d mHz\n", "CPU Speed", scePowerGetCpuClockFrequency());
printf("%-14s: %d mHz\n", "Bus Speed", scePowerGetBusClockFrequency());
printf("%-14s: %s       \n", "Power Switch", powerLocked == 0 ? "unlocked" : "locked");
printf("%-14s: %s  \n", "Send Ticks", powerTicks == 1 ? "yes" : "no");
printf("\nPress X to switch CPU between 333 and 222 mHz\n");
printf("Press O to toggle power switch lock\n");
printf("Press [] to toggle sending power ticks\n");
//send powerTicks if enabled
if (powerTicks == 1)
   if (scePowerTick(0) != 0)
printf("Error calling  scePowerTick(0)\n");

//only check buttons if they've changed since last frame
if (oldButtons != pad.Buttons) {
   //check to see if the user pressed X to toggle CPU speed
   if (pad.Buttons & PSP_CTRL_CROSS) {
if (i == 0) {
   i = scePowerSetClockFrequency(333, 333, 166);
   if (i == 0) {
i = 1;
   } else {
printf("\nCould not set CPU to 333mHz (0x%08X)\n", i);
i = 0;
   }
} else {
   i = scePowerSetClockFrequency(222, 222, 111);
   if (i != 0) {
printf("\nCould not set CPU to 222mHz (0x%08X)\n", i);
i = 1;
   }
}
   }
   //check to see if the user pressed O to toggle power locking
   if (pad.Buttons & PSP_CTRL_CIRCLE) {
if (powerLocked == 0) {
   if (scePowerLock(0) == 0)
powerLocked = 1;
   else
printf("Error locking power switch\n");
} else {
   if (scePowerUnlock(0) == 0)
powerLocked = 0;
   else
printf("Error unlocking power switch\n");
}
   }
   //check to see if the user pressed [] to toggle PowerTicks
   if (pad.Buttons & PSP_CTRL_SQUARE)
powerTicks = powerTicks == 1 ? 0 : 1;
}

pspDebugScreenSetXY(0, 30);
printf("Power callback messages appear below:\n%s\n", powerCBMessage);
oldButtons = pad.Buttons;

sceDisplayWaitVblankStart();
    }

    sceKernelSleepThread();
    sceKernelExitGame();

    return 0;
}

and Makefile:
Code:
PSPSDK = $(shell psp-config --pspsdk-path)
PSPLIBSDIR = $(PSPSDK)/..
TARGET = powersample
OBJS = main.o
LIBS = -lpsppower


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

include $(PSPSDK)/lib/build.mak

What is wrong? Is the sample from SDK, i`ve done once the EBOOT.PBP from this about 1 week ago, before reuinstalling windows.



LE: I tryed C:\pspsdk\psp\sdk\samples\usb\storage
But the same, it only make me 2 new files:
main.o
and an *.elf
The usbstorage makefile:
Code:
PSPSDK = $(shell psp-config --pspsdk-path)
PSPLIBSDIR = $(PSPSDK)/..
TARGET = usbstorage
OBJS = main.o
LIBS = -lpspusb -lpspusbstor
CFLAGS = -O2 -G0 -Wall
CXXFLAGS = $(CFLAGS) -fno-exceptions -fno-rtti
ASFLAGS = $(CFLAGS)

include $(PSPSDK)/lib/build.mak


I thing it`s something wrong instaled. But i folloed the tutorial. What could be wrong?
« Last Edit: November 02, 2009, 01:10:14 PM by pentagram » Logged


mowglisanu

C/C++ Developer
Hero Member
*

Karma: +36/-11
Offline Offline

Posts: 787
0.00 points

View Inventory
Send Money to mowglisanu


View Profile
« Reply #16 on: November 02, 2009, 01:57:01 PM »

add
Code:
EXTRA_TARGETS=EBOOT.PBP
to your makefile
Logged

Check out my:
 Audio lib
 Pmf Viewer
Arshia001

C/C++ Developer
Sr. Member
*

Karma: +42/-41
Offline Offline

Posts: 268
1224.39 points

View Inventory
Send Money to Arshia001

View Profile
« Reply #17 on: November 04, 2009, 04:54:32 AM »

...And your problem with VS is solved as well.I told it was something to do with the makefile.
« Last Edit: November 04, 2009, 04:57:09 AM by Arshia001 » Logged

Check out this audio library:
http://www.psp-programming.com/forums/index.php/topic,4338.0.html

Thanks for all the Karma,you guys!
pentagram
Newbie
*

Karma: +0/-0
Offline Offline

Posts: 42
2559.21 points

View Inventory
Send Money to pentagram

View Profile
« Reply #18 on: November 04, 2009, 06:09:52 AM »

...And your problem with VS is solved as well.I told it was something to do with the makefile.

It`s ok now, i started codding! Thanks both of you!
Logged
Scylla
Newbie
*

Karma: +0/-0
Offline Offline

Posts: 7
440.52 points

View Inventory
Send Money to Scylla

View Profile
« Reply #19 on: November 15, 2009, 06:53:28 PM »

I don't understand this.......

Do I not need to install CYGWIN or PSPTOOLCHAIN and crap like that?

And what visual studio install do I need? C#? C? C++? ...VisualBasic????????????
Logged
Arshia001

C/C++ Developer
Sr. Member
*

Karma: +42/-41
Offline Offline

Posts: 268
1224.39 points

View Inventory
Send Money to Arshia001

View Profile
« Reply #20 on: November 18, 2009, 08:52:46 PM »

Nope.Just VC++ (Express edition works too) and MINPSP.
Logged

Check out this audio library:
http://www.psp-programming.com/forums/index.php/topic,4338.0.html

Thanks for all the Karma,you guys!
WalangAlam
Jr. Member
**

Karma: +1/-0
Offline Offline

Posts: 79
3889.29 points

View Inventory
Send Money to WalangAlam

View Profile
« Reply #21 on: November 24, 2009, 06:42:59 PM »

i've been asking at MSDN how to activate intellisense for pspsdk in vs2008 so its ctrl+space. thanks for the info.

anyway to run and test prx and eboot without running them in my psp? anyway i can run my psp code in my pc or vs2008?
Logged
shenglong
Newbie
*

Karma: +0/-0
Offline Offline

Posts: 1
136.59 points

View Inventory
Send Money to shenglong

View Profile
« Reply #22 on: October 14, 2010, 04:27:54 PM »

excellent work arshia thanks alot Very Happy

i downloaded visuall c++ express 2010 and ur instructions worked great Very Happy

any luck on the psplink side of things ???
Logged
Kahori
Newbie
*

Karma: +0/-0
Offline Offline

Posts: 42
4311.90 points

View Inventory
Send Money to Kahori

View Profile
« Reply #23 on: June 10, 2011, 07:34:01 AM »

Ok it works Smile!
perfekt!

but there is one tiny thing....
Everytime I need to create a new folder with the name which I have typed before in :
Code:
Build command line:
vsmake && copy EBOOT.PBP "G:\PSP\GAME\Hola mundo\"

clean commands:
vsmake clean

Rebuild command line:
vsmake clean && vsmake && copy EBOOT.PBP "G:\PSP\GAME\Hola mundo\"


If not, I am getting errors :/

Quote
+ Intellisense doesn't work  in Visual Studio 2010 Sad!!!!
It works now, my messenger plus plugin was catching the signal auf ctrl + space
« Last Edit: June 10, 2011, 10:30:53 AM by Kahori » Logged
Pages: 1 [2]
Print
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.11 | SMF © 2006-2009, Simple Machines LLC Valid XHTML 1.0! Valid CSS!
Page created in 0.199 seconds with 30 queries.
Sister Sites: Guitar Hero 4   BrokeniTouch.com