Welcome to DCEmu, Dont Just be a Guest, join in the fun here - please click here to register...


Translate DCEmu


DCEmu Forums:: The Homebrew & Gaming Network ::  

Welcome to the DCEmu Forums:: The Homebrew & Gaming Network :: forums.

You are currently viewing our boards as a guest which gives you limited access to view most discussions and access our other features. By joining our free community you will have access to post topics, communicate privately with other members (PM), respond to polls, upload content and access many other special features. Registration is fast, simple and absolutely free so please, join our community today!

If you have any problems with the registration process or your account login, please contact contact us.

Go Back   DCEmu Forums:: The Homebrew & Gaming Network :: > Hosted Coders Sites Forum > Archived Developer Forums > PSPzProject Forums > PSPzProject Discussion Forum
Tags

Welcome to DCEmu

DCEmu Breaking News
Problems logging-in?
Firefox users seem to experiencing problems logging-in the forums, fi your having the same trouble try login in via the news pages e.g. dcemu.co.uk, in the right side column.

Want a quick chat? Come join on in our IRC Chat room. Click here to use our Java chat app, or use a IRC program like mIRC and join us on the Freenode server in #dcemuuk

For those members who are interested you can join the RSS Feed Group in Your USER CP to see all our extra forums with the latest Gaming & Tech news.

Junk is Back .

DCEmu World Wide Prize Giveaway, Sponsored by GameYeeeah.com

Reply
Add this thread to:  Submit to Digg Digg  Submit to Reddit Reddit  Submit to Del.icio.us Del.icio.us  Submit to Yahoo! This Yahoo This  Submit to Technorati Technorati 
 
Thread Tools Search this Thread Display Modes
Old August 10th, 2008, 02:52   #1
jube808
DCEmu Coder
 
Join Date: Nov 2007

Posts: 12
Default PSPZ osk sample source

#include <pspkernel.h>
#include <pspdebug.h>
#include <pspdisplay.h>
#include <pspsdk.h>
#include <pspctrl.h>
#include <stdio.h>
#include <string.h>
#include <oslib/oslib.h>

#include "../../commons/callbacks.h"
#include "../../commons/calibrate.h"

PSP_MODULE_INFO("TS_SAMPLE", 0, 1, 1);
PSP_MAIN_THREAD_ATTR(THREAD_ATTR_USER | THREAD_ATTR_VFPU);
PSP_HEAP_SIZE_KB(12*1024);



char tschar = 0 ;
int sioReadChar();
int xread = 0;
int yread = 0;
int rread = 0;
int backspace = 0;
char screentext[1];
char redraw = 0;
char newchar = 0;




POINT touched,touchedscaled,touchedfinal;
POINT cal[3];
POINT tcal[3];
MATRIX calmatrix;

void sioInit(int,int);
void sioPutString(const char *, int);


int initOSLib(){
oslInit(0);
oslInitGfx(OSL_PF_8888, 1);
oslInitAudio();
oslSetQuitOnLoadFailure(1);
oslSetKeyAutorepeatInit(40);
oslSetKeyAutorepeatInterval(10);
return 0;
}



int byte2word ( int bytehigh, int bytelow )
{
int tally = 0;

tally = bytehigh ;
tally = tally << 8 ;
tally = tally | bytelow ;
return tally ;
}


char getTSChar (int yaxis,int xaxis)
{
char retchar = 0;
if ((yaxis > 60) && (yaxis < 100))
{
if ((xaxis > 0) && (xaxis < 43))
retchar = 0x31;
if ((xaxis > 43) && (xaxis < 86))
retchar = 0x32;
if ((xaxis > 86) && (xaxis < 131))
retchar = 0x33;
if ((xaxis > 131) && (xaxis < 175))
retchar = 0x34;
if ((xaxis > 175) && (xaxis < 218))
retchar = 0x35;
if ((xaxis > 218) && (xaxis < 262))
retchar = 0x36;
if ((xaxis > 262) && (xaxis < 306))
retchar = 0x37;
if ((xaxis > 306) && (xaxis < 350))
retchar = 0x38;
if ((xaxis > 350) && (xaxis < 393))
retchar = 0x39;
if ((xaxis > 393) && (xaxis < 435))
retchar = 0x30;
if ((xaxis > 435) && (xaxis <480))
retchar = 0x3F;
return(retchar);
}

if ((yaxis > 100) && (yaxis < 141))
{
if ((xaxis > 0) && (xaxis < 43))
retchar = 51;
if ((xaxis > 43) && (xaxis < 86))
retchar = 0x57;
if ((xaxis > 86) && (xaxis < 131))
retchar = 0x45;
if ((xaxis > 131) && (xaxis < 175))
retchar = 0x52;
if ((xaxis > 175) && (xaxis < 218))
retchar = 0x54;
if ((xaxis > 218) && (xaxis < 262))
retchar = 0x59;
if ((xaxis > 262) && (xaxis < 306))
retchar = 0x55;
if ((xaxis > 306) && (xaxis < 350))
retchar = 0x49;
if ((xaxis > 350) && (xaxis < 393))
retchar = 0x4f;
if ((xaxis > 393) && (xaxis < 435))
retchar = 0x50;
if ((xaxis > 435) && (xaxis <480))
retchar = 0x3f;
return(retchar);
}

if ((yaxis > 141) && (yaxis < 180))
{
if ((xaxis > 0) && (xaxis < 43))
retchar = 0x41;
if ((xaxis > 43) && (xaxis < 86))
retchar = 53;
if ((xaxis > 86) && (xaxis < 131))
retchar = 0x44;
if ((xaxis > 131) && (xaxis < 175))
retchar = 0x46;
if ((xaxis > 175) && (xaxis < 218))
retchar = 0x47;
if ((xaxis > 218) && (xaxis < 262))
retchar = 0x48;
if ((xaxis > 262) && (xaxis < 306))
retchar = 0x4A;
if ((xaxis > 306) && (xaxis < 350))
retchar = 0x4B;
if ((xaxis > 350) && (xaxis < 393))
retchar = 0x4c;
if ((xaxis > 393) && (xaxis < 435))
retchar = 0x3A;
if ((xaxis > 435) && (xaxis <480))
retchar = 0x3b;
return(retchar);
}

if ((yaxis > 180) && (yaxis < 220))
{
if ((xaxis > 0) && (xaxis < 43))
retchar = 0x5A;
if ((xaxis > 43) && (xaxis < 86))
retchar = 0x58;
if ((xaxis > 86) && (xaxis < 131))
retchar = 0x43;
if ((xaxis > 131) && (xaxis < 175))
retchar = 0x56;
if ((xaxis > 175) && (xaxis < 218))
retchar = 0x42;
if ((xaxis > 218) && (xaxis < 262))
retchar = 0x4e;
if ((xaxis > 262) && (xaxis < 306))
retchar = 0x4d;
if ((xaxis > 306) && (xaxis < 350))
retchar = 0x2c;
if ((xaxis > 350) && (xaxis < 393))
retchar = 0x2e;
if ((xaxis > 393) && (xaxis < 435))
retchar = 0x40;
if ((xaxis > 435) && (xaxis <480))
retchar = 0x3f;
return(retchar);
}

if ((yaxis > 100) && (yaxis < 141))
{
if ((xaxis > 0) && (xaxis < 43))
backspace = 1;
if ((xaxis > 43) && (xaxis < 86))
retchar = 0x20;
if ((xaxis > 86) && (xaxis < 131))
retchar = 0x0d;
return(retchar);
}
return(0);
}

int pollThread (SceSize args ,void * argp)
{
int ch = -1;
int readhigh = 0;
int readlow = 0;
float xf,yf ;
char oldchar = 0;
int keyrepeat = 0;


while(running())
{




ch = sioReadChar();
if(ch == 255)
{

ch = sioReadChar();
if(ch == 255)

{
readhigh = sioReadChar();
readlow = sioReadChar();
xf = ((byte2word ( readhigh,readlow )) - 45 ) / 1.77708 ;
xread = (int)xf;
if (xread > 480)
xread = 480;
if (xread < 0)
xread = 0;
xread = 480 - xread;


readhigh = sioReadChar();
readlow = sioReadChar();
yf = ((byte2word ( readhigh,readlow )) - 107 ) / 2.59191 ;
yread = (int)yf;
if (yread > 272)
yread = 272;
if (yread < 0)
yread = 0;
yread = 272 - yread;

readhigh = sioReadChar();
readlow = sioReadChar();
rread = byte2word ( readhigh,readlow ) ;

oldchar = newchar;
newchar = getTSChar(yread,xread);


if ((!(oldchar == newchar)) || (keyrepeat > 12) )
{
screentext[0] = newchar;
keyrepeat = 0;
redraw = 1;

}
else
{
keyrepeat++;
}


}
}
}
}



void createPollThread(){
SceUID thid;
thid = sceKernelCreateThread("sio polling thread", pollThread, 20, 16384, 0, NULL);
sceKernelStartThread(thid, 0, NULL);
}

int main(void)
{
int baud=9600;
initOSLib();
oslIntraFontInit(INTRAFONT_CACHE_MED);
pspDebugScreenInit();
//Load image:
OSL_IMAGE *bkg = oslLoadImageFilePNG("tskbd.png", OSL_IN_RAM | OSL_SWIZZLED, OSL_PF_8888);
pspDebugScreenPrintf("immage loaded\n");

//Load font:
OSL_FONT *pgfFont = oslLoadFontFile("flash0:/font/ltn0.pgf");
oslIntraFontSetStyle(pgfFont, 1.0, RGBA(255,255,255,255), RGBA(0,0,0,0), INTRAFONT_ALIGN_CENTER);
oslSetFont(pgfFont);
pspDebugScreenPrintf("font set\n");
oslStartDrawing();
oslDrawImageXY(bkg, 0, 0);
oslEndDrawing();

setupCallbacks(); // [home] handler

sceDisplayWaitVblankStart();
sceCtrlSetSamplingCycle(0);
sceCtrlSetSamplingMode(PSP_CTRL_MODE_ANALOG);

// load siodriver
SceUID mod = pspSdkLoadStartModule("sioDriver.prx", PSP_MEMORY_PARTITION_KERNEL);
if (mod < 0)
{
sceKernelDelayThread(3000000);
sceKernelExitGame();
}
sceKernelDelayThread(1000000);

sioInit(baud,0);
sceKernelDelayThread(1000000);

createPollThread();


while(running())
{

if (redraw)
{

oslStartDrawing();
oslDrawImageXY(bkg, 0, 0);
oslDrawString(100, 25, screentext);
oslEndDrawing();
redraw = 0;
pspDebugScreenPrintf(screentext);
}

}

sceKernelExitGame();
return 0;
}


thats the source to the osk that video'ed, posting it to let developers know how the serial data stream looks like
jube808 is offline   Reply With Quote

Visit Our Sponsor
Old August 10th, 2008, 21:38   #2
that1guywiththeface
PSP User
 
Join Date: Mar 2007

Location: Behind you
Posts: 235
Default

Errrr........ what? How do we get this working? Did you have to splice a DS with a PSP, or did you order from some factory surplus type thing?

If you can get this working on a practical level (i.e. so that a large percentage of the homebrew community can do it) you will have successfully turned the homebrew scene upside down on a level that hasn't been seen since Dark Alex released popstation and Custome Firmwares. The flood of homebrew games will be reborn with touch- screen implemented things with greater hardware potential than the DS, shooters will play better (homebrew), and there will bemore plausible attempts at DS emulators (i.e. ones that have more than 6-7 fps emulation). Maybe Exophase would even make a DS emulator from the ground up that would rival gpsp!

If you can impress Sony with this without infringing on Nintendo's copyright laws, Nintendo would officially be RAPED if Sony implements this, because then the PSP would literally do EVERYTHING the DS does, but better. Better graphics, better variety (not just games, but movies, music, and internet), and better potential quality. I like the possibilities.
__________________
"...Among other ill-advised five-word phrases that every man will inevitably say at least once in his life: I can jump that far; I'm gonna win her back..."- How I Met Your Mother
that1guywiththeface is offline   Reply With Quote
Old August 12th, 2008, 14:41   #3
jube808
DCEmu Coder
 
Join Date: Nov 2007

Posts: 12
Default

thank you !!, no all the electronics are custom designed, components sourced mainly from europe, when the thing is finished it will have no hint of "home-made".

Yes very astute, thats all very true, and wait till you see what it does to the pda market !!
jube808 is offline   Reply With Quote
Reply
Tags: , , ,



Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

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

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off


All times are GMT +1. The time now is 07:36.


Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
vB.Sponsors

eXTReMe Tracker

·DCEmu.com Next Gen Gaming ·Console Hacking.Com