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, 06:51:36 PM *
Welcome, Guest. Please login or register.
Did you miss your activation email?

Login with username, password and session length

News: Check out the Code Section!
Home Help Search Shop Login Register
Digg This!
Pages: [1]
Print
Author Topic: help in my project  (Read 488 times)
znos
Newbie
*

Karma: +0/-0
Offline Offline

Posts: 11
541.78 points

View Inventory
Send Money to znos

View Profile
« on: March 10, 2010, 08:20:39 AM »

i want to write a psp plugin to check your battery percentage and equivalent time while playing a game.
i'm very new to writing programs to a psp.. but i have lots of experience in programming...

my question is how do i get the psp's battery percentage and it's equivalent time?

i got this so far:
 
Code:
#include <pspkernel.h>
#include <psppower.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;
}

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

          cbid = sceKernelCreateCallback("Exit Callback", exit_callback, NULL);
          sceKernelRegisterExitCallback(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;
}

int main() {

pspDebugScreenInit();
SetupCallbacks();
printf("Battery Remaining: %i (%i)\n", scePowerGetBatteryLifePercent(), scePowerGetBatteryLifeTime());
printf("Battery Temperature: %i\n", scePowerGetBatteryTemp());
printf("Battery Voltage: %i", scePowerGetBatteryVolt());
sceKernelSleepThread();
return 0;
}

it won't compile.. i have installed psptoochain and got other projects to run.. but this one says "undefined referece to scePowerGetBatteryLifePercent"
« Last Edit: March 10, 2010, 08:57:03 AM by znos » 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 #1 on: March 10, 2010, 10:57:39 AM »

post your makefile
Logged

Check out my:
 Audio lib
 Pmf Viewer
znos
Newbie
*

Karma: +0/-0
Offline Offline

Posts: 11
541.78 points

View Inventory
Send Money to znos

View Profile
« Reply #2 on: March 10, 2010, 05:02:21 PM »

it's ok.. i've managed to get it to work..

my other question is this: i'm planning to make it as a plugin, how do i print something kind of like the vsh menu style of printing when i press a certain key combination let's say L+R+Select
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 #3 on: March 10, 2010, 05:17:23 PM »

Do you mean like when a game fails to load and you get a message, or just plain text?
Try searching for vshblitter it might give you an idea of what to do
Logged

Check out my:
 Audio lib
 Pmf Viewer
znos
Newbie
*

Karma: +0/-0
Offline Offline

Posts: 11
541.78 points

View Inventory
Send Money to znos

View Profile
« Reply #4 on: March 10, 2010, 05:22:07 PM »

thanks..

just plaintext..

EDIT:
====
i can now blit the string that i want.. now this is my problem:

how can i blit a string while playing a game? i've searched in google and found someone talking about devhook.. what is devhook? and can anyone point me out to an example of a devhook?
« Last Edit: March 11, 2010, 07:32:37 AM by znos » Logged
Pages: [1]
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.169 seconds with 28 queries.
Sister Sites: Guitar Hero 4   BrokeniTouch.com