本文整理汇总了C++中sceDisplayWaitVblankStart函数的典型用法代码示例。如果您正苦于以下问题:C++ sceDisplayWaitVblankStart函数的具体用法?C++ sceDisplayWaitVblankStart怎么用?C++ sceDisplayWaitVblankStart使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了sceDisplayWaitVblankStart函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: main
extern "C" int main(int argc, char *argv[]) {
// Let's not bother debugging to the display, since we'll just mess it up anyway.
HAS_DISPLAY = 0;
sceDisplaySetMode(0, 480, 272);
sceDisplaySetFrameBuf(0, 0, 0, 1);
sceDisplaySetFrameBuf(0, 0, 0, 0);
checkpointNext("While off:");
sceDisplayWaitVblankStart();
testStateScenarios();
sceDisplaySetFrameBuf((void *)0x04000000, 512, 3, 1);
sceDisplaySetFrameBuf((void *)0x04000000, 512, 3, 0);
checkpointNext("While on:");
sceDisplayWaitVblankStart();
testStateScenarios();
sceDisplaySetFrameBuf(0, 0, 0, 1);
checkpointNext("Latched off");
testIsState(" Latched off");
return 0;
}
示例2: main
extern "C" int main(int argc, char *argv[]) {
checkpointNext("sceDisplayAdjustAccumulatedHcount:");
testAdjustHcount(" -1", -1);
testAdjustHcount(" INT_MIN", 0x80000000);
testAdjustHcount(" INT_MAX", 0x7FFFFFFF);
testAdjustHcount(" 0", 0);
checkpointNext("sceDisplayGetAccumulatedHcount:");
testAdjustHcount(" Adjust to INT_MAX", 0x7FFFFFFF);
int wrappedH = sceDisplayGetAccumulatedHcount();
if (wrappedH < 5) {
checkpoint(" Wrapped around to 0: OK");
} else {
checkpoint(" Wrapped around to 0: Failed %d", wrappedH);
}
// Okay, let's gather some statistics.
int minH = 1000;
int maxH = 0;
int maxStrideH = 0;
int lastH = 0;
sceDisplayWaitVblankStart();
sceDisplayAdjustAccumulatedHcount(0x7FFFFFFF);
for (int i = 0; i < 60; ++i) {
sceDisplayWaitVblankStart();
int h = sceDisplayGetCurrentHcount();
int totalH = sceDisplayGetAccumulatedHcount();
if (h < minH) {
minH = h;
}
if (totalH - lastH > maxStrideH) {
maxStrideH = totalH - lastH;
}
lastH = totalH;
while (sceDisplayIsVblank()) {
h = sceDisplayGetCurrentHcount();
if (h > maxH) {
maxH = h;
}
}
}
int avgH = sceDisplayGetAccumulatedHcount() / 60;
checkpointNext("sceDisplayGetCurrentHcount:");
// Generally, 1, 14, 286, 286.
checkpoint(" (NOTE: not always consistent, use a few runs to get common numbers.)");
checkpoint(" Lowest: %d", minH);
checkpoint(" Highest (in vblank): %d", maxH);
checkpoint(" Highest stride: %d", maxStrideH);
checkpoint(" Average: %d", avgH);
return 0;
}
示例3: waitbutton
int waitbutton(int mask) {
SceCtrlData paddata;
do {
sceDisplayWaitVblankStart();
sceCtrlReadBufferPositive(&paddata, 1);
} while((paddata.Buttons & mask));
do {
sceDisplayWaitVblankStart();
sceCtrlReadBufferPositive(&paddata, 1);
} while(!(paddata.Buttons & mask));
return paddata.Buttons;
}
示例4: loadTheme
void loadTheme()
{
int i, bytesRead;
SceUID fp;
fp = sceIoOpen("ms0:/lockdown.thm", PSP_O_RDONLY, 0777);
if (fp < 0)
{
fp = sceIoOpen("flash0:/lockdown.thm", PSP_O_RDONLY, 0777);
if (fp < 0)
{
printTextScreen(0, 0, "Error loading flash0:/lockdown.thm.", RGB(255, 0, 0));
printTextScreen(0, 8, "Place theme at ms0:/lockdown.thm to load from memory stick.", RGB(255, 0, 0));
sceDisplayWaitVblankStart();
flipScreen();
sceKernelSleepThread();
}
}
for (i = 0; i < NUMFILES; i++)
{
bytesRead = sceIoRead(fp, &images[i].hdr, sizeof(imagehdr));
if (bytesRead != sizeof(imagehdr))
{
printTextScreen(0, 0, "Unexpected end of header.", RGB(255, 0, 0));
sceDisplayWaitVblankStart();
flipScreen();
sceKernelSleepThread();
}
images[i].blockid = sceKernelAllocPartitionMemory(2, "block", 0, (sizeof(unsigned char) * images[i].hdr.size), NULL);
if (images[i].blockid < 0)
{
printTextScreen(0, 0, "Memory allocation error.", RGB(255, 0, 0));
sceDisplayWaitVblankStart();
flipScreen();
sceKernelSleepThread();
}
images[i].data = (unsigned char*) sceKernelGetBlockHeadAddr(images[i].blockid);
bytesRead = sceIoRead(fp, images[i].data, images[i].hdr.size);
if (bytesRead != images[i].hdr.size)
{
printTextScreen(0, 0, "Unexpected end of data.", RGB(255, 0, 0));
sceDisplayWaitVblankStart();
flipScreen();
sceKernelSleepThread();
}
}
sceIoClose(fp);
}
示例5: mappa
//mappa
void mappa(){
int y;
int x;
int xtile;
int ytile;
for(y=0;y<34;y++){
for(x=0;x<60;x++){
ytile=floor(mappe[0][0][y][x][0] / tilesetw);
xtile=mappe[0][0][y][x][0]-((ytile)*tilesetw);
blitImageToImage(xtile*16 ,ytile*16,unita , unita, tile, x*unita, y*unita,terra);
if( mappe[0][0][y][x][1] > 1){
ytile=floor(mappe[0][0][y][x][1] / tilesetw);
xtile=mappe[0][0][y][x][1]-((ytile)*tilesetw);
blitAlphaImageToImage(xtile*16 ,ytile*16,unita , unita, tile, x*unita, y*unita,terra);
}
if( mappe[0][0][y][x][2] > 1){
ytile=floor(mappe[0][0][y][x][2] / tilesetw);
xtile=mappe[0][0][y][x][2]-((ytile)*tilesetw);
blitAlphaImageToImage(xtile*16 ,ytile*16,unita , unita, tile, x*unita, y*unita,terra);
}
}
}
sceDisplayWaitVblankStart();
}
示例6: vidgu_init
void vidgu_init()
{
g_pBlitBuff = (unsigned short *)(0x40000000 | (unsigned int)&g_BlitBuff);
sceGuInit();
// setup
sceGuStart(GU_DIRECT,list);
sceGuDrawBuffer(GU_PSM_5650,(void*)0,512);
sceGuDispBuffer(480,272,(void*)0x88000,512);
sceGuDepthBuffer((void*)0x110000,512);
sceGuOffset(2048 - (480/2),2048 - (272/2));
sceGuViewport(2048,2048,480,272);
sceGuDepthRange(0xc350,0x2710);
sceGuScissor(0,0,480,272);
sceGuEnable(GU_SCISSOR_TEST);
sceGuFrontFace(GU_CW);
sceGuEnable(GU_TEXTURE_2D);
sceGuClear(GU_COLOR_BUFFER_BIT|GU_DEPTH_BUFFER_BIT);
sceGuFinish();
sceGuSync(0,0);
sceDisplayWaitVblankStart();
sceGuDisplay(1);
}
示例7: psp_free
static void psp_free(void *data)
{
psp1_video_t *psp = (psp1_video_t*)data;
if(!(psp) || !(psp->main_dList))
return;
sceDisplayWaitVblankStart();
sceGuDisplay(GU_FALSE);
sceGuTerm();
if (psp->main_dList)
free(psp->main_dList);
if (psp->frame_dList)
free(psp->frame_dList);
if (psp->frame_coords)
free(TO_CACHED_PTR(psp->frame_coords));
if (psp->menu.frame_coords)
free(TO_CACHED_PTR(psp->menu.frame_coords));
if (psp->menu.dList)
free(psp->menu.dList);
if (psp->menu.frame)
free(psp->menu.frame);
free(data);
sceKernelDisableSubIntr(PSP_VBLANK_INT, 0);
sceKernelReleaseSubIntrHandler(PSP_VBLANK_INT,0);
}
示例8: setupGu
void setupGu(void)
{
sceGuInit();
sceGuStart(GU_DIRECT, list);
sceGuDrawBuffer(GU_PSM_8888, 0, BUF_WIDTH);
sceGuDispBuffer(SCR_WIDTH, SCR_HEIGHT, (void*)0x88000, BUF_WIDTH);
sceGuDepthBuffer((void*)0x110000, BUF_WIDTH);
sceGuOffset(0, 0);
sceGuScissor(0, 0, SCR_WIDTH, SCR_HEIGHT);
sceGuEnable(GU_SCISSOR_TEST);
sceGuBlendFunc(GU_ADD, GU_SRC_ALPHA, GU_ONE_MINUS_SRC_ALPHA, 0, 0);
sceGuEnable(GU_BLEND);
//sceGuTexFunc(GU_TFX_MODULATE, GU_TCC_RGBA);
//sceGuTexFilter(GU_LINEAR_MIPMAP_LINEAR, GU_NEAREST);
//sceGuTexWrap(GU_REPEAT, GU_REPEAT);
sceGuClearColor(0);
sceGuClearDepth(0);
sceGuClearStencil(0);
sceGuFinish();
sceGuSync(0, 0);
sceDisplayWaitVblankStart();
sceGuDisplay(GU_TRUE);
}
示例9: psp_init
void psp_init(void)
{
SceUID thid;
char buff[128], *r;
/* fw 1.5 sometimes returns 8002032c, although getcwd works */
r = getcwd(buff, sizeof(buff));
if (r) sceIoChdir(buff);
main_thread_id = sceKernelGetThreadId();
lprintf("running on %08x kernel\n", sceKernelDevkitVersion()),
lprintf("entered psp_init, threadId %08x, priority %i\n", main_thread_id,
sceKernelGetThreadCurrentPriority());
thid = sceKernelCreateThread("update_thread", callback_thread, 0x11, 0xFA0, 0, NULL);
if (thid >= 0)
{
sceKernelStartThread(thid, 0, 0);
}
/* video */
sceDisplaySetMode(0, 480, 272);
sceDisplaySetFrameBuf(VRAM_FB1, 512, PSP_DISPLAY_PIXEL_FORMAT_565, PSP_DISPLAY_SETBUF_NEXTFRAME);
current_screen = 1;
psp_screen = VRAM_FB0;
/* gu */
sceGuInit();
sceGuStart(GU_DIRECT, guCmdList);
sceGuDrawBuffer(GU_PSM_5650, (void *)VRAMOFFS_FB0, 512);
sceGuDispBuffer(480, 272, (void *)VRAMOFFS_FB1, 512); // don't care
sceGuClear(GU_COLOR_BUFFER_BIT | GU_DEPTH_BUFFER_BIT);
sceGuDepthBuffer((void *)VRAMOFFS_DEPTH, 512);
sceGuOffset(2048 - (480 / 2), 2048 - (272 / 2));
sceGuViewport(2048, 2048, 480, 272);
sceGuDepthRange(0xc350, 0x2710);
sceGuScissor(0, 0, 480, 272);
sceGuEnable(GU_SCISSOR_TEST);
sceGuDepthMask(0xffff);
sceGuDisable(GU_DEPTH_TEST);
sceGuFrontFace(GU_CW);
sceGuEnable(GU_TEXTURE_2D);
sceGuTexFunc(GU_TFX_REPLACE, GU_TCC_RGB);
sceGuAmbientColor(0xffffffff);
sceGuColor(0xffffffff);
sceGuFinish();
sceGuSync(0, 0);
sceDisplayWaitVblankStart();
sceGuDisplay(GU_TRUE);
/* input */
sceCtrlSetSamplingCycle(0);
sceCtrlSetSamplingMode(PSP_CTRL_MODE_ANALOG);
}
示例10: vidgu_render_nostretch
void vidgu_render_nostretch(int sx, int sy, int sw, int sh, int dx, int dy, int dw, int dh)
{
int start, end;
sceGuStart(GU_DIRECT,list);
sceGuTexMode(GU_PSM_5650,0,0,0); // 16-bit RGBA
sceGuTexImage(0,512,512,512,g_pBlitBuff); // setup texture as a 256x256 texture
//sceKernelDcacheWritebackAll();
sceGuTexFunc(GU_TFX_REPLACE,GU_TCC_RGBA); // don't get influenced by any vertex colors
sceGuTexFilter(GU_NEAREST,GU_NEAREST); // point-filtered sampling
for (start = sx, end = sx+sw; start < end; start += SLICE_SIZE, dx += SLICE_SIZE)
{
struct Vertex* vertices = (struct Vertex*)sceGuGetMemory(2 * sizeof(struct Vertex));
int width = (start + SLICE_SIZE) < end ? SLICE_SIZE : end-start;
vertices[0].u = start; vertices[0].v = sy;
vertices[0].color = 0;
vertices[0].x = dx; vertices[0].y = dy; vertices[0].z = 0;
vertices[1].u = start + width; vertices[1].v = sy + sh;
vertices[1].color = 0;
vertices[1].x = dx + width; vertices[1].y = dy + sh; vertices[1].z = 0;
sceGuDrawArray(GU_SPRITES,GU_TEXTURE_16BIT|GU_COLOR_5650|GU_VERTEX_16BIT|GU_TRANSFORM_2D,2,0,vertices);
}
sceGuFinish();
sceGuSync(0,0);
sceDisplayWaitVblankStart();
sceGuSwapBuffers();
//sceGuSwapBuffers();
}
示例11: main
int main(void)
{
int i;
pspDebugScreenInit();
SetupCallbacks();
/* Clear the existing profile regs */
pspDebugProfilerClear();
/* Enable profiling */
pspDebugProfilerEnable();
for(i = 0; i < 600; i++)
{
pspDebugScreenSetXY(0, 0);
/* Print profile information to the screen */
pspDebugProfilerPrint();
sceDisplayWaitVblankStart();
}
/* Let's bug out */
sceKernelExitDeleteThread(0);
return 0;
}
示例12: _gInit
void _gInit()
{
// Init & setup GU
sceGuInit();
sceGuStart(GU_DIRECT,list);
sceGuDrawBuffer(GU_PSM_8888,(void*)FRAMEBUFFER_SIZE,PSP_LINE_SIZE);
sceGuDispBuffer(G_SCR_W,G_SCR_H,(void*)0,PSP_LINE_SIZE);
sceGuDepthBuffer((void*)(FRAMEBUFFER_SIZE*2),PSP_LINE_SIZE);
sceGuOffset(2048-(G_SCR_W/2),2048-(G_SCR_H/2));
sceGuViewport(2048,2048,G_SCR_W,G_SCR_H);
gResetScissor();
sceGuDepthRange(65535,0);
sceGuClearDepth(65535);
sceGuAlphaFunc(GU_GREATER,0,0xff);
sceGuDepthFunc(GU_LEQUAL);
sceGuBlendFunc(GU_ADD,GU_SRC_ALPHA,GU_ONE_MINUS_SRC_ALPHA,0,0);
sceGuTexFunc(GU_TFX_MODULATE,GU_TCC_RGBA);
sceGuTexFilter(GU_LINEAR,GU_LINEAR);
sceGuShadeModel(GU_FLAT);
sceGuDisable(GU_CULL_FACE);
sceGuDisable(GU_CLIP_PLANES);
sceGuDisable(GU_DITHER);
sceGuEnable(GU_ALPHA_TEST);
sceGuEnable(GU_SCISSOR_TEST);
sceGuFinish();
sceGuSync(0,0);
sceDisplayWaitVblankStart();
sceGuDisplay(GU_TRUE);
init = G_TRUE;
}
示例13: pmp_show_thread
static int pmp_show_thread(SceSize input_length, void *input)
{
volatile struct pmp_play_struct *p = *((void **) input);
unsigned int current_buffer_number = 0;
while (p->return_request == 0)
{
if (pmp_wait(p, p->semaphore_can_show, "pmp_show_thread: sceKernelWaitSema failed on semaphore_can_show") == 0)
{
break;
}
sceDisplayWaitVblankStart();
sceDisplaySetFrameBuf(p->decoder.output_frame_buffers[current_buffer_number].video_frame, p->decoder.output_texture_width, PSP_DISPLAY_PIXEL_FORMAT_8888, PSP_DISPLAY_SETBUF_IMMEDIATE);
if (sceKernelSignalSema(p->semaphore_show_done, 1) < 0)
{
p->return_result = "pmp_show_thread: sceKernelSignalSema failed on semaphore_show_done";
p->return_request = 1;
break;
}
current_buffer_number = (current_buffer_number + 1) % p->decoder.number_of_frame_buffers;
}
return(0);
}
示例14: DEBUG_ENTER_FUNC
void MasterGuRenderer::guInit() {
DEBUG_ENTER_FUNC();
sceGuInit();
sceGuStart(0, _displayList);
guProgramDisplayBufferSizes();
sceGuOffset(2048 - (PSP_SCREEN_WIDTH / 2), 2048 - (PSP_SCREEN_HEIGHT / 2));
sceGuViewport(2048, 2048, PSP_SCREEN_WIDTH, PSP_SCREEN_HEIGHT);
sceGuDepthRange(0xC350, 0x2710);
sceGuDisable(GU_DEPTH_TEST); // We'll use depth buffer area
sceGuDepthMask(GU_TRUE); // Prevent writes to depth buffer
sceGuScissor(0, 0, PSP_SCREEN_WIDTH, PSP_SCREEN_HEIGHT);
sceGuEnable(GU_SCISSOR_TEST);
sceGuFrontFace(GU_CW);
sceGuEnable(GU_TEXTURE_2D);
sceGuClear(GU_COLOR_BUFFER_BIT | GU_DEPTH_BUFFER_BIT);
sceGuFinish();
sceGuSync(0, 0);
sceDisplayWaitVblankStart();
sceGuDisplay(1);
}
示例15: testStateScenarios
static void testStateScenarios() {
sceDisplayWaitVblankStart();
testIsState(" After start");
sceKernelDelayThread(1000);
testIsState(" After vblank end");
// Poll for sync after vblank start.
sceDisplayWaitVblankStart();
s64 start = sceKernelGetSystemTimeWide();
s64 end = start + 1000;
bool sawVsync = false;
bool vblankTimingGood = true;
while (sceKernelGetSystemTimeWide() < end) {
int vsyncResult = sceDisplayIsVsync();
if (vsyncResult) {
testIsState(" During vsync");
sawVsync = true;
int untilVsync = (int)(sceKernelGetSystemTimeWide() - start);
int untilVblankEnd = 0;
while (sceKernelGetSystemTimeWide() < end) {
if (!sceDisplayIsVblank()) {
untilVblankEnd = (int)(sceKernelGetSystemTimeWide() - start);
break;
}
}
if (untilVsync < 500 || untilVsync > 700) {
checkpoint(" Vsync did not occur when expected (should be around 631.5us from vblank start)");
vblankTimingGood = false;
}
if (untilVblankEnd < 600 || untilVblankEnd > 800) {
checkpoint(" Vblank did not take as long as expected (should be around 731.5us from vblank start)");
vblankTimingGood = false;
}
break;
}
}
if (!sawVsync) {
checkpoint(" Never received vsync");
} else if (vblankTimingGood) {
checkpoint(" Vblank timing checked out");
}
}