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!

Get OSK works on vsh mode ?

This is a discussion on Get OSK works on vsh mode ? within the PSP Development Forum forums, part of the PSP Development, Hacks, and Homebrew category; I get the osk works on game mode now ... but when i compile it into a prx..and load it ...

Reply
 
LinkBack Thread Tools
Old 02-11-2007, 07:56 PM   #1
 
Join Date: Dec 2006
Posts: 2
Trader Feedback: 0
Default Get OSK works on vsh mode ?

I get the osk works on game mode now ...

but when i compile it into a prx..and load it in vsh mode by a module loader....
the background animate shows normally.
and sceUtilityOskInitStart() successfully load..
but i cant see the osk keyboard...
if I turn off the psp now... I could see the osk keyboard flash up while the
XMB shutting down...

the osk keyboard is draw successfully...
but maybe in the layer under the XMB or something like that, i think.

Need a hand~~~


here is the code

main.c
Code:
#include <pspkernel.h>
#include <pspdisplay.h>
#include <pspdebug.h>
#include <pspctrl.h>
#include <psprtc.h>
#include <pspgu.h>
#include <psputils.h>
#include <pspmath.h>

#include <string.h>

#include <psputility_osk.h>

PSP_MODULE_INFO("pspmath_demo", 0, 1, 1);
PSP_MAIN_THREAD_ATTR(THREAD_ATTR_VFPU);

typedef struct {
	unsigned int c;
	float x, y, z;
} CVertex;

u32 __attribute__((aligned(16))) list[1024];
CVertex __attribute__((aligned(16))) stars[1000];
ScePspFMatrix4 projection3d, view, model;
ScePspQuatMatrix qcam, qa, qb;
int running = 1;

int exitCallback(int arg1, int arg2, void *common)
{
	running = 0;
	return 0;
}

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

	cbid = sceKernelCreateCallback("Exit Callback", exitCallback, NULL);
	sceKernelRegisterExitCallback(cbid);
	sceKernelSleepThreadCB();
	return 0;
}

int setupCallbacks(void)
{
	int thid = 0;

	thid = sceKernelCreateThread("callbackThread", callbackThread, 0x11, 0xFA0, 0, 0);
	if(thid >= 0)
		sceKernelStartThread(thid, 0, 0);
	return thid;
}

void initGU() {
	sceGuInit();
	sceGuStart(GU_DIRECT,list);
	sceGuDrawBuffer(GU_PSM_8888,(void *)0,512);
	sceGuDispBuffer(480,272,(void*)0x88000,512);
	sceGuOffset(2048 - (480/2),2048 - (272/2));
	sceGuViewport(2048,2048,480,272);
	sceGuScissor(0,0,480,272);
	sceGuEnable(GU_SCISSOR_TEST);
	sceGuShadeModel(GU_SMOOTH);
	sceGuDisable(GU_DEPTH_TEST);
	sceGuDisable(GU_CULL_FACE);
	sceGuDisable(GU_LIGHTING);
	sceGuDisable(GU_TEXTURE_2D);
	sceGuFinish();
	sceGuSync(0,0);
	sceDisplayWaitVblankStart();
	sceGuDisplay(1);
}

int main(int argc, char *argv[]) {
	u64 tick;
	int n;
	SceCtrlData pad;
	float t;
	
	char input[128]="";

	// vfpu has a random number generator,
	// and it needs to be seeded

	sceRtcGetCurrentTick(&tick);
	vfpu_srand((u32)tick / 10000.0f);

	//setupCallbacks();
	initGU();

	vfpu_perspective_matrix(&projection3d, 60.0f, 480.0f/272.0f, 0.5f, 1000.0f);
	vfpu_identity_matrix(&view);
	vfpu_identity_matrix(&model);

	// build a random starfield, using sphere to cartesian coordinate conversions
	// note how we use vfpu_randf here to generate random radian angles,
	// and how we use vfpu_rand_8888 to generate random colors for the stars

	for (n=0; n<1000; n++) {
		vfpu_sphere_to_cartesian(vfpu_randf(0.0f, 6.28319f), vfpu_randf(0.0f, 3.14159f), 1000.0f, (ScePspFVector4 *)&(stars[n]));
		stars[n].c = vfpu_rand_8888(160, 255);
	}

	n = 0;

	// start off with 2 random rotations for the interpolation
	vfpu_quaternion_from_euler(&qa, vfpu_randf(0.0f, 360.0f), vfpu_randf(0.0f, 360.0f), vfpu_randf(0.0f, 360.0f));
	vfpu_quaternion_ln(&qa, &qa);
	vfpu_quaternion_from_euler(&qb, vfpu_randf(0.0f, 360.0f), vfpu_randf(0.0f, 360.0f), vfpu_randf(0.0f, 360.0f));
	vfpu_quaternion_ln(&qb, &qb);

	sceCtrlSetSamplingCycle(0);
	sceCtrlSetSamplingMode(PSP_CTRL_MODE_ANALOG);
	


	   // 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 = 1; 
	osk.buttonswap = 0; //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 (running) {

		n++;

		// when we reach the limit of our interpolation:
		//		copy qb to qa
		//		generate a new random quaternion in qb
		//		take the log of quaternion qb
		//		reset the time counter

		if (n >= 300) {
			n = 0;
			vfpu_quaternion_copy(&qa, &qb);
			vfpu_quaternion_from_euler(&qb, vfpu_randf(0.0f, 360.0f), vfpu_randf(0.0f, 360.0f), vfpu_randf(0.0f, 360.0f));
			vfpu_quaternion_ln(&qb, &qb);
		}

		// to build the view matrix:
		//		get the interpolated quaternion in qcam
		//		take the exp of qcam
		//		build a rotation matrix from qcam, place into view matrix
		//
		// here we use the function .5 + (cos(t) * .5) for our 'time' variable
		// this gives us the smooth ease in/ease out motion you see as the demo
		// interpolates between qa and qb
		//
		// this is why we must do 300-n, as cos(0) = 1, cos(PI) = -1, we want
		// the reverse, -1 to 1

		t = n/300.0f;
		vfpu_quaternion_sample_linear(&qcam, &qa, &qb, vfpu_ease_in_out(t));
		vfpu_quaternion_exp(&qcam, &qcam);
		vfpu_quaternion_to_matrix(&qcam, &view);

		sceGuStart(GU_DIRECT, list);
		sceGuClearColor(0);
		sceGuClear(GU_COLOR_BUFFER_BIT|GU_FAST_CLEAR_BIT);

		// load our generated matrix data into the display list

		sceGuSetMatrix(GU_PROJECTION, &projection3d);
		sceGuSetMatrix(GU_VIEW, &view);
		sceGuSetMatrix(GU_MODEL, &model);

		sceGuDrawArray(GU_POINTS, GU_VERTEX_32BITF | GU_COLOR_8888 | GU_TRANSFORM_3D, 1000, 0, stars);

		sceGuFinish();
		sceGuSync(0,0);
	
		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 : 
	            running = 0; 
	            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++; 
	         } 
	      }
		sceGuSwapBuffers();
	
		//sceCtrlPeekBufferPositive(&pad, 1);

		//if (pad.Buttons & PSP_CTRL_CROSS) {
		//	break;
		//}
		sceDisplayWaitVblankStart();
	}

	sceGuTerm();
	//sceKernelExitGame();
	return 0;
}

makefile
Code:
TARGET = sample
OBJS = main.o

BUILD_PRX = 1

USE_PSPSDK_LIBC = 1

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

LIBDIR =
LDFLAGS =
LIBS= -lpspgu -lpsprtc -lpspctrl -lpspmath

PSPSDK=$(shell psp-config --pspsdk-path)
include $(PSPSDK)/lib/build.mak
Need a hand~~~
-= Double Post =-
should I do something to the Params of OSK?

Last edited by poison; 02-11-2007 at 07:56 PM.. Reason: Automerged Doublepost
poison is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Old 02-11-2007, 08:48 PM   #2
No longer a community member.
 
a_noob's Avatar
 
Join Date: Sep 2006
Location: Over there.
Posts: 666
Trader Feedback: 0
Default

How about ditching sony's OSK for The Danzeff Keyboard. Its on the source code part of dl.qj.net
a_noob is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Old 02-13-2007, 02:12 AM   #3
 
Join Date: Dec 2006
Posts: 2
Trader Feedback: 0
Default

Quote:
Originally Posted by a_noob
How about ditching sony's OSK for The Danzeff Keyboard. Its on the source code part of dl.qj.net
ya... I know that...

but actually, I just want to know how to use sony's OSK in VSH like the XMB does..
poison is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply

Tags
mode , osk , vsh , works

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 05:58 PM.



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