forums.ps2dev.org Forum Index forums.ps2dev.org
Homebrew PS2, PSP & PS3 Development Discussions
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Getting the Sony On SCreen Keyboard To Work

 
Post new topic   Reply to topic    forums.ps2dev.org Forum Index -> PSP Development
View previous topic :: View next topic  
Author Message
reefbarman



Joined: 08 Jan 2007
Posts: 87
Location: Australia

PostPosted: Wed Jan 10, 2007 2:54 pm    Post subject: Getting the Sony On SCreen Keyboard To Work Reply with quote

Hi, everyone

i would really love to see sony's on screen keyboard work in homebrew & my program but i dont really have a clue how to set it all up,

i have these in so far
Code:
#include <psputility_osk.h>
SceUtilityOskParams * myKeyboard;
SceUtilityOskData * myKeyboardData;
SceOskState keyboardState;


now my problem is how do i use all this
i want a function called keyboard() that displays this keyboard, makes it work and then stores the entered text in a char * array, then shuts the keyboard down allowing my program to return to it previous place

thanks in advance also if anyone know what any of the variable in the structs related to this do please post them thanks again
Back to top
View user's profile Send private message
Bytrix



Joined: 14 Sep 2005
Posts: 72
Location: England

PostPosted: Wed Jan 10, 2007 7:29 pm    Post subject: Reply with quote

I was wondering how to use this too, I ended up writing my own.
Back to top
View user's profile Send private message Send e-mail
adrahil



Joined: 16 Mar 2006
Posts: 277

PostPosted: Wed Jan 10, 2007 11:07 pm    Post subject: Reply with quote

Search the forums.... there is some post related...
Back to top
View user's profile Send private message
Insert_witty_name



Joined: 10 May 2006
Posts: 376

PostPosted: Wed Jan 10, 2007 11:35 pm    Post subject: Reply with quote

McZonk's sample that he posted is pretty self explanatory.
Back to top
View user's profile Send private message
reefbarman



Joined: 08 Jan 2007
Posts: 87
Location: Australia

PostPosted: Thu Jan 11, 2007 12:05 am    Post subject: Reply with quote

i read the example but the link are all broken so i cant get any of the code so a refresher here would be good or if i was reading the topic can some one post a link thanks, but still if anyone has a clue and could do a mock up function for me that would be great
Back to top
View user's profile Send private message
Insert_witty_name



Joined: 10 May 2006
Posts: 376

PostPosted: Thu Jan 11, 2007 1:10 am    Post subject: Reply with quote

Here's a mirror of McZonk's code mate.

It's pretty easy to understand.

http://www.psp-programming.com/animate/psposk.zip
Back to top
View user's profile Send private message
reefbarman



Joined: 08 Jan 2007
Posts: 87
Location: Australia

PostPosted: Thu Jan 11, 2007 1:14 am    Post subject: Reply with quote

cheers thanks alot
Back to top
View user's profile Send private message
reefbarman



Joined: 08 Jan 2007
Posts: 87
Location: Australia

PostPosted: Thu Jan 11, 2007 12:55 pm    Post subject: Reply with quote

okay im compiled the mczonk sample copied it to my psp and no that im running it all i get is a grey screen and a crash whats going on there??
Back to top
View user's profile Send private message
blondin



Joined: 07 Mar 2006
Posts: 18
Location: France (Grenoble)

PostPosted: Fri Jan 12, 2007 7:27 am    Post subject: Work only with 1.50 Reply with quote

This exemple work fine with firmware 1.50 but there is a solution to make it usable on a 2.71, 3.02 or 3.03OE ???
THX
Back to top
View user's profile Send private message
TyRaNiD



Joined: 18 Jan 2004
Posts: 918

PostPosted: Fri Jan 12, 2007 2:49 pm    Post subject: Reply with quote

The reason it doesn't work on the SE/OE firmwares in 1.5 mode (where you get the gray screen and crash) is cause the 1.5 vsh modules are not available which the OSK requires. As for why it doesn't work on 3.03oe it does with abit of prodding :P You need to build it as a PRX (for 3.02/3.03 at least) and you should remove the use of the osk lib which comes with the sample and use the one which comes with the sdk. Then it all works fine (sort of, the language it appears in is not my specified language so there is possibly some weirdness with the language settings).
Back to top
View user's profile Send private message
Bytrix



Joined: 14 Sep 2005
Posts: 72
Location: England

PostPosted: Fri Jan 12, 2007 7:19 pm    Post subject: Reply with quote

Thanks for that TyRaNiD, I too had been wondering how to get this to work in OE. Trying to add as many of these features as I can to my games to make them look a little bit more professional.
Back to top
View user's profile Send private message Send e-mail
reefbarman



Joined: 08 Jan 2007
Posts: 87
Location: Australia

PostPosted: Fri Jan 12, 2007 11:54 pm    Post subject: Reply with quote

is anyone able to compile a prx for me and give me instructions on how to add it into my code, its probably not too hard to do my self but i have never tried it before and dont know where to find good tutorials on how to do it so if someone is kind enough, cause while i have been developing my own keyboard system which is kinda cool it still has a lot of work and i would like to release a beta of my app asap, so using the sony one will be my temporary fix.
Back to top
View user's profile Send private message
blondin



Joined: 07 Mar 2006
Posts: 18
Location: France (Grenoble)

PostPosted: Mon Jan 15, 2007 9:47 am    Post subject: Reply with quote

Thx TyRaNid but I can't load the osk... the sceUtilityOskInitStart return NULL all the time :(
Can you post a little example of your prx please ;) ... thx again for your help
Back to top
View user's profile Send private message
blondin



Joined: 07 Mar 2006
Posts: 18
Location: France (Grenoble)

PostPosted: Wed Jan 17, 2007 9:26 am    Post subject: Reply with quote

It's ok I made it, i will post an exemple asap....
Back to top
View user's profile Send private message
reefbarman



Joined: 08 Jan 2007
Posts: 87
Location: Australia

PostPosted: Wed Jan 17, 2007 10:05 am    Post subject: Reply with quote

excellent
Back to top
View user's profile Send private message
blondin



Joined: 07 Mar 2006
Posts: 18
Location: France (Grenoble)

PostPosted: Fri Jan 19, 2007 5:44 am    Post subject: OSK for 303OE Reply with quote

Ok guys, let's go :

1. Create new main.c in a new directory paste this code :

Code:

#include <pspkernel.h>
#include <pspdisplay.h>
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <math.h>
#include <pspmoduleinfo.h>
#include <psputility.h>
#include <pspgu.h>
#include <pspgum.h>

#include <psputility_osk.h>

/* Define the module info section */
PSP_MODULE_INFO("MsgDialog Sample", 0, 1, 0);

#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;
}


/* Graphics stuff, based on cube sample */

static unsigned int __attribute__((aligned(16))) list[262144];

struct Vertex
{
    float u, v;
    unsigned int color;
    float x,y,z;
};

struct Vertex __attribute__((aligned(16))) vertices[12*3] =
{
    {0, 0, 0xff7f0000,-1,-1, 1}, // 0
    {1, 0, 0xff7f0000,-1, 1, 1}, // 4
    {1, 1, 0xff7f0000, 1, 1, 1}, // 5
   
    {0, 0, 0xff7f0000,-1,-1, 1}, // 0
    {1, 1, 0xff7f0000, 1, 1, 1}, // 5
    {0, 1, 0xff7f0000, 1,-1, 1}, // 1
   
    {0, 0, 0xff7f0000,-1,-1,-1}, // 3
    {1, 0, 0xff7f0000, 1,-1,-1}, // 2
    {1, 1, 0xff7f0000, 1, 1,-1}, // 6
   
    {0, 0, 0xff7f0000,-1,-1,-1}, // 3
    {1, 1, 0xff7f0000, 1, 1,-1}, // 6
    {0, 1, 0xff7f0000,-1, 1,-1}, // 7
   
    {0, 0, 0xff007f00, 1,-1,-1}, // 0
    {1, 0, 0xff007f00, 1,-1, 1}, // 3
    {1, 1, 0xff007f00, 1, 1, 1}, // 7
   
    {0, 0, 0xff007f00, 1,-1,-1}, // 0
    {1, 1, 0xff007f00, 1, 1, 1}, // 7
    {0, 1, 0xff007f00, 1, 1,-1}, // 4
   
    {0, 0, 0xff007f00,-1,-1,-1}, // 0
    {1, 0, 0xff007f00,-1, 1,-1}, // 3
    {1, 1, 0xff007f00,-1, 1, 1}, // 7
   
    {0, 0, 0xff007f00,-1,-1,-1}, // 0
    {1, 1, 0xff007f00,-1, 1, 1}, // 7
    {0, 1, 0xff007f00,-1,-1, 1}, // 4
   
    {0, 0, 0xff00007f,-1, 1,-1}, // 0
    {1, 0, 0xff00007f, 1, 1,-1}, // 1
    {1, 1, 0xff00007f, 1, 1, 1}, // 2
   
    {0, 0, 0xff00007f,-1, 1,-1}, // 0
    {1, 1, 0xff00007f, 1, 1, 1}, // 2
    {0, 1, 0xff00007f,-1, 1, 1}, // 3
   
    {0, 0, 0xff00007f,-1,-1,-1}, // 4
    {1, 0, 0xff00007f,-1,-1, 1}, // 7
    {1, 1, 0xff00007f, 1,-1, 1}, // 6
   
    {0, 0, 0xff00007f,-1,-1,-1}, // 4
    {1, 1, 0xff00007f, 1,-1, 1}, // 6
    {0, 1, 0xff00007f, 1,-1,-1}, // 5
};

#define BUF_WIDTH (512)
#define SCR_WIDTH (480)
#define SCR_HEIGHT (272)
#define PIXEL_SIZE (4) /* change this if you change to another screenmode */
#define FRAME_SIZE (BUF_WIDTH * SCR_HEIGHT * PIXEL_SIZE)
#define ZBUF_SIZE (BUF_WIDTH SCR_HEIGHT * 2) /* zbuffer seems to be 16-bit? */

static void SetupGu()
{
    sceGuInit();

    sceGuStart(GU_DIRECT,list);
    sceGuDrawBuffer(GU_PSM_8888,(void*)0,BUF_WIDTH);
    sceGuDispBuffer(SCR_WIDTH,SCR_HEIGHT,(void*)0x88000,BUF_WIDTH);
    sceGuDepthBuffer((void*)0x110000,BUF_WIDTH);
    sceGuOffset(2048 - (SCR_WIDTH/2),2048 - (SCR_HEIGHT/2));
    sceGuViewport(2048,2048,SCR_WIDTH,SCR_HEIGHT);
    sceGuDepthRange(0xc350,0x2710);
    sceGuScissor(0,0,SCR_WIDTH,SCR_HEIGHT);
    sceGuEnable(GU_SCISSOR_TEST);
    sceGuDepthFunc(GU_GEQUAL);
    sceGuEnable(GU_DEPTH_TEST);
    sceGuFrontFace(GU_CW);
    sceGuShadeModel(GU_SMOOTH);
    sceGuEnable(GU_CULL_FACE);
    sceGuEnable(GU_CLIP_PLANES);
    sceGuFinish();
    sceGuSync(0,0);
   
    sceDisplayWaitVblankStart();
    sceGuDisplay(GU_TRUE);
}

static void DrawStuff(void)
{
    static int val = 0;

    sceGuStart(GU_DIRECT,list);

    // clear screen
   
    sceGuClearColor(0xff554433);
    sceGuClearDepth(0);
    sceGuClear(GU_COLOR_BUFFER_BIT|GU_DEPTH_BUFFER_BIT);
   
    // setup matrices for cube
   
    sceGumMatrixMode(GU_PROJECTION);
    sceGumLoadIdentity();
    sceGumPerspective(75.0f,16.0f/9.0f,0.5f,1000.0f);
   
    sceGumMatrixMode(GU_VIEW);
    sceGumLoadIdentity();
   
    sceGumMatrixMode(GU_MODEL);
    sceGumLoadIdentity();
    {
        ScePspFVector3 pos = { 0, 0, -2.5f };
        ScePspFVector3 rot = { val * 0.79f * (M_PI/180.0f), val * 0.98f * (M_PI/180.0f), val * 1.32f * (M_PI/180.0f) };
        sceGumRotateXYZ(&rot);
        sceGumTranslate(&pos);
    }
   
    // draw cube
   
    sceGuAmbientColor(0xffffffff);
    sceGumDrawArray(GU_TRIANGLES,GU_TEXTURE_32BITF|GU_COLOR_8888|GU_VERTEX_32BITF|GU_TRANSFORM_3D,12*3,0,vertices);
   
    sceGuFinish();
    sceGuSync(0,0);

    val ++;
}


int keyboard(char *input){
   
   int done=0;

   // INIT OSK
   unsigned short intext[128]  = { 0 }; // text already in the edit box on start
   unsigned short outtext[128] = { 0 }; // text after input
   unsigned short desc[128]    = { 'E', 'n', 't', 'e', 'r', ' ', 'T', 'e', 'x', 't', 0 }; // description

   

   SceUtilityOskData data;
   memset(&data, 0, sizeof(data));
   data.language = 2; // english
   data.lines = 1; // just one line
   data.unk_24 = 1; // set to 1
   data.desc = desc;
   data.intext = intext;
   data.outtextlength = 128; // sizeof(outtext) / sizeof(unsigned short)
   data.outtextlimit = 50; // just allow 50 chars
   data.outtext = (unsigned short*)outtext;

   SceUtilityOskParams osk;
   memset(&osk, 0, sizeof(osk));
   osk.size = sizeof(osk);
   osk.language = 2;
   osk.buttonswap = 1; //X button: 1
   osk.unk_12 = 17;
   osk.unk_16 = 19; //tester a 1 pour les chiffres
   osk.unk_20 = 18;
   osk.unk_24 = 16;
   osk.unk_48 = 1;
   osk.data = &data;


   int rc = sceUtilityOskInitStart(&osk);
   if(rc) {
      return 0;
   }

   while(!done) {
      
      DrawStuff();

      switch(sceUtilityOskGetStatus()) {
         case PSP_OSK_INIT :
            break;
         case PSP_OSK_VISIBLE :
            sceUtilityOskUpdate(2); // 2 is taken from ps2dev.org recommendation
            break;
         case PSP_OSK_QUIT :
            sceUtilityOskShutdownStart();
            break;
         case PSP_OSK_FINISHED :
            done = 1;
            break;
         case PSP_OSK_NONE :
         default :
            break;
      }

      int i,j=0;
      for(i = 0; data.outtext[i]; i++) {

         if (data.outtext[i]!='\0' && data.outtext[i]!='\n' && data.outtext[i]!='\r'){
            input[j] = data.outtext[i];
            j++;
         }
      }

      /**/
      sceDisplayWaitVblankStart();
      sceGuSwapBuffers();
   }
   return 1;
}
/* main routine */
int main(int argc, char *argv[])
{
   char input[128]="";

    SetupCallbacks();
    SetupGu();
   
    keyboard(input);
   

   pspDebugScreenInit();
   pspDebugScreenClear();

   printf("osk return:\n\n%s\n", input);

   sceKernelDelayThread(10000000);
   sceKernelExitGame();
    return 0;
}


2. create your Makefile like that:

Code:

TARGET = OSK_SAMPLE
OBJS = main.o

INCDIR =

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

BUILD_PRX = 1

LIBDIR =
LDFLAGS =
LIBS= -lpsputility -lpspgum -lpspgu -lm

EXTRA_TARGETS = EBOOT.PBP
PSP_EBOOT_TITLE = OSK_SAMPLE

PSPSDK=$(shell psp-config --pspsdk-path)
include $(PSPSDK)/lib/build.mak

release: all
   mksfo OSK_SAMPLE PARAM.SFO
   pack-pbp EBOOT.PBP PARAM.SFO NULL NULL NULL NULL NULL OSK_SAMPLE.prx NULL
   cp EBOOT.PBP ./303


3. You have to create "303" directory before compiling

4. When all done type "make release" and paste "303" directory in your "GAME303" or "GAME".... as you want
Back to top
View user's profile Send private message
AnalCobra



Joined: 03 Mar 2007
Posts: 1

PostPosted: Sat Mar 03, 2007 9:01 pm    Post subject: Reply with quote

hey guys,

when i try to make the stuff posted above by blondin then i get following error :
Code:

$ make release
make: *** /usr/local/pspdev/psp/sdk: Is a directory.  Stop.


Does somebody know how to get rid of this error?

EDIT:
Did nobody hear something about this error, yet?
Back to top
View user's profile Send private message
J.F.



Joined: 22 Feb 2004
Posts: 2906

PostPosted: Mon Oct 22, 2007 4:37 am    Post subject: Reply with quote

I've modified blondin's code from above for the latest SDK. This works peachy on my 3.71 M33-2 Slim.

main.c
Code:
#include <pspkernel.h>
#include <pspdisplay.h>
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <math.h>
#include <pspmoduleinfo.h>
#include <psputility.h>
#include <pspgu.h>
#include <pspgum.h>

#include <psputility_osk.h>

/* Define the module info section */
PSP_MODULE_INFO("MsgDialog Sample", 0, 1, 0);

#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;
}


/* Graphics stuff, based on cube sample */

static unsigned int __attribute__((aligned(16))) list[262144];

struct Vertex
{
   float u, v;
   unsigned int color;
   float x,y,z;
};

struct Vertex __attribute__((aligned(16))) vertices[12*3] =
{
   {0, 0, 0xff7f0000,-1,-1, 1}, // 0
   {1, 0, 0xff7f0000,-1, 1, 1}, // 4
   {1, 1, 0xff7f0000, 1, 1, 1}, // 5

   {0, 0, 0xff7f0000,-1,-1, 1}, // 0
   {1, 1, 0xff7f0000, 1, 1, 1}, // 5
   {0, 1, 0xff7f0000, 1,-1, 1}, // 1

   {0, 0, 0xff7f0000,-1,-1,-1}, // 3
   {1, 0, 0xff7f0000, 1,-1,-1}, // 2
   {1, 1, 0xff7f0000, 1, 1,-1}, // 6

   {0, 0, 0xff7f0000,-1,-1,-1}, // 3
   {1, 1, 0xff7f0000, 1, 1,-1}, // 6
   {0, 1, 0xff7f0000,-1, 1,-1}, // 7

   {0, 0, 0xff007f00, 1,-1,-1}, // 0
   {1, 0, 0xff007f00, 1,-1, 1}, // 3
   {1, 1, 0xff007f00, 1, 1, 1}, // 7

   {0, 0, 0xff007f00, 1,-1,-1}, // 0
   {1, 1, 0xff007f00, 1, 1, 1}, // 7
   {0, 1, 0xff007f00, 1, 1,-1}, // 4

   {0, 0, 0xff007f00,-1,-1,-1}, // 0
   {1, 0, 0xff007f00,-1, 1,-1}, // 3
   {1, 1, 0xff007f00,-1, 1, 1}, // 7

   {0, 0, 0xff007f00,-1,-1,-1}, // 0
   {1, 1, 0xff007f00,-1, 1, 1}, // 7
   {0, 1, 0xff007f00,-1,-1, 1}, // 4

   {0, 0, 0xff00007f,-1, 1,-1}, // 0
   {1, 0, 0xff00007f, 1, 1,-1}, // 1
   {1, 1, 0xff00007f, 1, 1, 1}, // 2

   {0, 0, 0xff00007f,-1, 1,-1}, // 0
   {1, 1, 0xff00007f, 1, 1, 1}, // 2
   {0, 1, 0xff00007f,-1, 1, 1}, // 3

   {0, 0, 0xff00007f,-1,-1,-1}, // 4
   {1, 0, 0xff00007f,-1,-1, 1}, // 7
   {1, 1, 0xff00007f, 1,-1, 1}, // 6

   {0, 0, 0xff00007f,-1,-1,-1}, // 4
   {1, 1, 0xff00007f, 1,-1, 1}, // 6
   {0, 1, 0xff00007f, 1,-1,-1}, // 5
};

#define BUF_WIDTH (512)
#define SCR_WIDTH (480)
#define SCR_HEIGHT (272)
#define PIXEL_SIZE (4) /* change this if you change to another screenmode */
#define FRAME_SIZE (BUF_WIDTH * SCR_HEIGHT * PIXEL_SIZE)
#define ZBUF_SIZE (BUF_WIDTH SCR_HEIGHT * 2) /* zbuffer seems to be 16-bit? */

static void SetupGu()
{
   sceGuInit();

   sceGuStart(GU_DIRECT,list);
   sceGuDrawBuffer(GU_PSM_8888,(void*)0,BUF_WIDTH);
   sceGuDispBuffer(SCR_WIDTH,SCR_HEIGHT,(void*)0x88000,BUF_WIDTH);
   sceGuDepthBuffer((void*)0x110000,BUF_WIDTH);
   sceGuOffset(2048 - (SCR_WIDTH/2),2048 - (SCR_HEIGHT/2));
   sceGuViewport(2048,2048,SCR_WIDTH,SCR_HEIGHT);
   sceGuDepthRange(0xc350,0x2710);
   sceGuScissor(0,0,SCR_WIDTH,SCR_HEIGHT);
   sceGuEnable(GU_SCISSOR_TEST);
   sceGuDepthFunc(GU_GEQUAL);
   sceGuEnable(GU_DEPTH_TEST);
   sceGuFrontFace(GU_CW);
   sceGuShadeModel(GU_SMOOTH);
   sceGuEnable(GU_CULL_FACE);
   sceGuEnable(GU_CLIP_PLANES);
   sceGuFinish();
   sceGuSync(0,0);

   sceDisplayWaitVblankStart();
   sceGuDisplay(GU_TRUE);
}

static void DrawStuff(void)
{
   static int val = 0;

   sceGuStart(GU_DIRECT,list);

   // clear screen

   sceGuClearColor(0xff554433);
   sceGuClearDepth(0);
   sceGuClear(GU_COLOR_BUFFER_BIT|GU_DEPTH_BUFFER_BIT);

   // setup matrices for cube

   sceGumMatrixMode(GU_PROJECTION);
   sceGumLoadIdentity();
   sceGumPerspective(75.0f,16.0f/9.0f,0.5f,1000.0f);

   sceGumMatrixMode(GU_VIEW);
   sceGumLoadIdentity();

   sceGumMatrixMode(GU_MODEL);
   sceGumLoadIdentity();
   {
       ScePspFVector3 pos = { 0, 0, -2.5f };
       ScePspFVector3 rot = { val * 0.79f * (M_PI/180.0f), val * 0.98f * (M_PI/180.0f), val * 1.32f * (M_PI/180.0f) };
       sceGumRotateXYZ(&rot);
       sceGumTranslate(&pos);
   }

   // draw cube

   sceGuAmbientColor(0xffffffff);
   sceGumDrawArray(GU_TRIANGLES,GU_TEXTURE_32BITF|GU_COLOR_8888|GU_VERTEX_32BITF|GU_TRANSFORM_3D,12*3,0,vertices);

   sceGuFinish();
   sceGuSync(0,0);

   val ++;
}


int keyboard(char *input){

   int done=0;

   // INIT OSK
   unsigned short intext[128]  = { 0 }; // text already in the edit box on start
   unsigned short outtext[128] = { 0 }; // text after input
   unsigned short desc[128]   = { 'E', 'n', 't', 'e', 'r', ' ', 'T', 'e', 'x', 't', 0 }; // description



   SceUtilityOskData data;
   memset(&data, 0, sizeof(data));
   data.language = 2;         // key glyphs: 0-1=hiragana, 2+=western
   data.lines = 1;            // just one line
   data.unk_24 = 1;         // set to 1
   data.desc = desc;
   data.intext = intext;
   data.outtextlength = 128;   // sizeof(outtext) / sizeof(unsigned short)
   data.outtextlimit = 50;      // just allow 50 chars
   data.outtext = (unsigned short*)outtext;

   SceUtilityOskParams osk;
   memset(&osk, 0, sizeof(osk));
   osk.base.size = sizeof(osk);
   // dialog language: 0=Japanese, 1=English, 2=French, 3=Spanish, 4=German,
   // 5=Italian, 6=Dutch, 7=Portuguese, 8=Russian, 9=Korean, 10-11=Chinese, 12+=default
   osk.base.language = 1;
   osk.base.buttonSwap = 1;      // X button: 1
   osk.base.graphicsThread = 17;   // gfx thread pri
   osk.base.unknown = 19;         // unknown thread pri (?)
   osk.base.fontThread = 18;
   osk.base.soundThread = 16;
   osk.unk_48 = 1;
   osk.data = &data;


   int rc = sceUtilityOskInitStart(&osk);
   if(rc) {
      return 0;
   }

   while(!done) {

      DrawStuff();

      switch(sceUtilityOskGetStatus()) {
         case PSP_UTILITY_DIALOG_INIT :
            break;
         case PSP_UTILITY_DIALOG_VISIBLE :
            sceUtilityOskUpdate(2); // 2 is taken from ps2dev.org recommendation
            break;
         case PSP_UTILITY_DIALOG_QUIT :
            sceUtilityOskShutdownStart();
            break;
         case PSP_UTILITY_DIALOG_FINISHED :
            done = 1;
            break;
         case PSP_UTILITY_DIALOG_NONE :
         default :
            break;
      }

      int i,j=0;
      for(i = 0; data.outtext[i]; i++) {

         if (data.outtext[i]!='\0' && data.outtext[i]!='\n' && data.outtext[i]!='\r'){
            input[j] = data.outtext[i];
            j++;
         }
      }

      /**/
      sceDisplayWaitVblankStart();
      sceGuSwapBuffers();
   }
   return 1;
}
/* main routine */
int main(int argc, char *argv[])
{
   char input[128]="";

   SetupCallbacks();
   SetupGu();

   keyboard(input);


   pspDebugScreenInit();
   pspDebugScreenClear();

   printf("osk return:\n\n%s\n", input);

   sceKernelDelayThread(10000000);
   sceKernelExitGame();
   return 0;
}


Note the comments on the two language fields. I figured those out by changing the values and observing the results.
Back to top
View user's profile Send private message AIM Address
capz



Joined: 20 May 2008
Posts: 6

PostPosted: Tue May 20, 2008 4:21 am    Post subject: Reply with quote

AnalCobra wrote:
hey guys,

when i try to make the stuff posted above by blondin then i get following error :
Code:

$ make release
make: *** /usr/local/pspdev/psp/sdk: Is a directory.  Stop.


Does somebody know how to get rid of this error?

EDIT:
Did nobody hear something about this error, yet?

Am also having that exact same error, could somebody with more experience look at this? i only started this week :P
Back to top
View user's profile Send private message
Question_dev



Joined: 24 Aug 2007
Posts: 88

PostPosted: Tue May 20, 2008 6:03 am    Post subject: Reply with quote

Search for libosk, a easy-to-use osk lib. Just use the sample as basic. Easy to understand, only 4 lines of code and u got an advanced keyboard with text stored in char, etc. .

Cu
Back to top
View user's profile Send private message
capz



Joined: 20 May 2008
Posts: 6

PostPosted: Tue May 27, 2008 8:13 am    Post subject: Reply with quote

Question_dev wrote:
Search for libosk, a easy-to-use osk lib. Just use the sample as basic. Easy to understand, only 4 lines of code and u got an advanced keyboard with text stored in char, etc. .

Cu
hi, i did a little searching for that lib, but i found nothing. Nothing in google (that i could read at least), this forum, or the svn. would you/anyone be so kind to give me some directions?
Back to top
View user's profile Send private message
Insert_witty_name



Joined: 10 May 2006
Posts: 376

PostPosted: Tue May 27, 2008 8:40 am    Post subject: Reply with quote

I commited an updated osk header file and a sample recently.

Update your SDK.
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    forums.ps2dev.org Forum Index -> PSP Development All times are GMT + 10 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group