Ticket #9087: flicker.patch
File flicker.patch, 8.6 KB (added by , 15 years ago) 


osys_psp.cpp
409 409 sceGuColor(0xFFFFFFFF); 410 410 411 411 struct Vertex* vertices = (struct Vertex*)sceGuGetMemory(2 * sizeof(struct Vertex)); 412 vertices[0].u = 0.5 ; vertices[0].v = 0.5;413 vertices[1].u = _screenWidth  0.5 ; vertices[1].v = _screenHeight  0.5;412 vertices[0].u = 0.5f; vertices[0].v = 0.5f; 413 vertices[1].u = _screenWidth  0.5f; vertices[1].v = _screenHeight  0.5f; 414 414 switch(_graphicMode) { 415 415 case CENTERED_320X200: 416 416 vertices[0].x = (PSP_SCREEN_WIDTH  320) / 2; vertices[0].y = (PSP_SCREEN_HEIGHT  200) / 2; vertices[0].z = 0; … … 437 437 438 438 sceGuDrawArray(GU_SPRITES, GU_TEXTURE_32BITFGU_VERTEX_32BITFGU_TRANSFORM_2D, 2, 0, vertices); 439 439 if (_screenWidth == 640) { 440 // 2nd draw 441 struct Vertex* vertices2 = (struct Vertex*)sceGuGetMemory(2 * sizeof(struct Vertex)); 440 442 sceGuTexImage(0, 512, 512, _screenWidth, _offscreen+512); 441 vertices[0].u = 512 + 0.5; vertices[1].v = _screenHeight  0.5; 442 vertices[0].x += (vertices[1].x  vertices[0].x) * 511 / 640; vertices[0].y = 0; vertices[0].z = 0; 443 sceGuDrawArray(GU_SPRITES, GU_TEXTURE_32BITFGU_VERTEX_32BITFGU_TRANSFORM_2D, 2, 0, vertices); 443 vertices2[0].u = 512 + 0.5f; 444 vertices2[0].v = vertices[0].v; 445 vertices2[1].u = vertices[1].u; 446 vertices2[1].v = _screenHeight  0.5f; 447 vertices2[0].x = vertices[0].x + (vertices[1].x  vertices[0].x) * 511 / 640; 448 vertices2[0].y = 0; 449 vertices2[0].z = 0; 450 vertices2[1].x = vertices[1].x; 451 vertices2[1].y = vertices[1].y; 452 vertices2[1].z = 0; 453 sceGuDrawArray(GU_SPRITES, GU_TEXTURE_32BITFGU_VERTEX_32BITFGU_TRANSFORM_2D, 2, 0, vertices2); 444 454 } 445 455 446 456 447 457 // draw overlay 448 458 if (_overlayVisible) { 449 vertices[0].x = 0; vertices[0].y = 0; vertices[0].z = 0; 450 vertices[1].x = PSP_SCREEN_WIDTH; vertices[1].y = PSP_SCREEN_HEIGHT; vertices[1].z = 0; 451 vertices[0].u = 0.5; vertices[0].v = 0.5; 452 vertices[1].u = _overlayWidth  0.5; vertices[1].v = _overlayHeight  0.5; 459 struct Vertex* vertOverlay = (struct Vertex*)sceGuGetMemory(2 * sizeof(struct Vertex)); 460 vertOverlay[0].x = 0; 461 vertOverlay[0].y = 0; 462 vertOverlay[0].z = 0; 463 vertOverlay[1].x = PSP_SCREEN_WIDTH; 464 vertOverlay[1].y = PSP_SCREEN_HEIGHT; 465 vertOverlay[1].z = 0; 466 vertOverlay[0].u = 0.5f; 467 vertOverlay[0].v = 0.5f; 468 vertOverlay[1].u = _overlayWidth  0.5f; 469 vertOverlay[1].v = _overlayHeight  0.5f; 453 470 sceGuTexMode(GU_PSM_4444, 0, 0, 0); // 16bit image 454 471 sceGuDisable(GU_ALPHA_TEST); 455 472 sceGuEnable(GU_BLEND); … … 463 480 sceGuTexImage(0, 512, 256, _overlayWidth, _overlayBuffer); 464 481 465 482 sceGuTexFunc(GU_TFX_REPLACE, GU_TCC_RGBA); 466 sceGuDrawArray(GU_SPRITES,GU_TEXTURE_32BITFGU_VERTEX_32BITFGU_TRANSFORM_2D,2,0,vert ices);483 sceGuDrawArray(GU_SPRITES,GU_TEXTURE_32BITFGU_VERTEX_32BITFGU_TRANSFORM_2D,2,0,vertOverlay); 467 484 // need to render twice for textures > 512 468 485 if ( _overlayWidth > 512) { 486 struct Vertex* vertOverlay2 = (struct Vertex*)sceGuGetMemory(2 * sizeof(struct Vertex)); 469 487 sceGuTexImage(0, 512, 512, _overlayWidth, _overlayBuffer + 512); 470 vertices[0].u = 512 + 0.5; vertices[1].v = _overlayHeight  0.5; 471 vertices[0].x = PSP_SCREEN_WIDTH * 512 / 640; vertices[0].y = 0; vertices[0].z = 0; 472 sceGuDrawArray(GU_SPRITES, GU_TEXTURE_32BITFGU_VERTEX_32BITFGU_TRANSFORM_2D, 2, 0, vertices); 488 vertOverlay2[0].u = 512 + 0.5f; 489 vertOverlay2[0].v = vertOverlay[0].v; 490 vertOverlay2[1].u = vertOverlay[1].u; 491 vertOverlay2[1].v = _overlayHeight  0.5f; 492 vertOverlay2[0].x = PSP_SCREEN_WIDTH * 512 / 640; 493 vertOverlay2[0].y = 0; 494 vertOverlay2[0].z = 0; 495 vertOverlay2[1].x = PSP_SCREEN_WIDTH; 496 vertOverlay2[1].y = PSP_SCREEN_HEIGHT; 497 vertOverlay2[1].z = 0; 498 sceGuDrawArray(GU_SPRITES, GU_TEXTURE_32BITFGU_VERTEX_32BITFGU_TRANSFORM_2D, 2, 0, vertOverlay2); 473 499 } 474 500 sceGuDisable(GU_BLEND); 475 501 } … … 484 510 sceGuTexImage(0, MOUSE_SIZE, MOUSE_SIZE, MOUSE_SIZE, _mouseBuf); 485 511 sceGuTexFunc(GU_TFX_MODULATE, GU_TCC_RGBA); 486 512 487 vertices[0].u = 0.5; vertices[0].v = 0.5; 488 vertices[1].u = _mouseWidth  0.5; vertices[1].v = _mouseHeight  0.5; 513 struct Vertex* vertMouse = (struct Vertex*)sceGuGetMemory(2 * sizeof(struct Vertex)); 514 vertMouse[0].u = 0.5f; vertMouse[0].v = 0.5f; 515 vertMouse[1].u = _mouseWidth  0.5f; vertMouse[1].v = _mouseHeight  0.5f; 489 516 490 517 //adjust cursor position 491 518 int mX = _mouseX  _mouseHotspotX; … … 497 524 scalex = (float)PSP_SCREEN_WIDTH /_overlayWidth; 498 525 scaley = (float)PSP_SCREEN_HEIGHT /_overlayHeight; 499 526 500 vert ices[0].x = mX * scalex; vertices[0].y = mY * scaley; vertices[0].z = 0;501 vert ices[1].x = vertices[0].x + _mouseWidth * scalex; vertices[1].y = vertices[0].y + _mouseHeight * scaley; vertices[0].z = 0;527 vertMouse[0].x = mX * scalex; vertMouse[0].y = mY * scaley; vertMouse[0].z = 0; 528 vertMouse[1].x = vertMouse[0].x + _mouseWidth * scalex; vertMouse[1].y = vertMouse[0].y + _mouseHeight * scaley; vertMouse[0].z = 0; 502 529 } else 503 530 switch(_graphicMode) { 504 531 case CENTERED_320X200: 505 vert ices[0].x = (PSP_SCREEN_WIDTH  320) / 2 + mX; vertices[0].y = (PSP_SCREEN_HEIGHT  200) / 2 + mY; vertices[0].z = 0;506 vert ices[1].x = vertices[0].x+_mouseWidth; vertices[1].y = vertices[0].y + _mouseHeight; vertices[1].z = 0;532 vertMouse[0].x = (PSP_SCREEN_WIDTH  320) / 2 + mX; vertMouse[0].y = (PSP_SCREEN_HEIGHT  200) / 2 + mY; vertMouse[0].z = 0; 533 vertMouse[1].x = vertMouse[0].x+_mouseWidth; vertMouse[1].y = vertMouse[0].y + _mouseHeight; vertMouse[1].z = 0; 507 534 break; 508 535 case CENTERED_435X272: 509 536 { … … 512 539 scalex = 435.0f / _screenWidth; 513 540 scaley = 272.0f / _screenHeight; 514 541 515 vert ices[0].x = (PSP_SCREEN_WIDTH  435) / 2 + mX * scalex; vertices[0].y = mY * scaley; vertices[0].z = 0;516 vert ices[1].x = vertices[0].x + _mouseWidth * scalex; vertices[1].y = vertices[0].y + _mouseHeight * scaley; vertices[0].z = 0;542 vertMouse[0].x = (PSP_SCREEN_WIDTH  435) / 2 + mX * scalex; vertMouse[0].y = mY * scaley; vertMouse[0].z = 0; 543 vertMouse[1].x = vertMouse[0].x + _mouseWidth * scalex; vertMouse[1].y = vertMouse[0].y + _mouseHeight * scaley; vertMouse[0].z = 0; 517 544 518 545 } 519 546 break; … … 524 551 scalex = 362.0f / _screenWidth; 525 552 scaley = 272.0f / _screenHeight; 526 553 527 vert ices[0].x = (PSP_SCREEN_WIDTH  362) / 2 + mX * scalex; vertices[0].y = mY * scaley; vertices[0].z = 0;528 vert ices[1].x = vertices[0].x + _mouseWidth * scalex; vertices[1].y = vertices[0].y + _mouseHeight * scaley; vertices[0].z = 0;554 vertMouse[0].x = (PSP_SCREEN_WIDTH  362) / 2 + mX * scalex; vertMouse[0].y = mY * scaley; vertMouse[0].z = 0; 555 vertMouse[1].x = vertMouse[0].x + _mouseWidth * scalex; vertMouse[1].y = vertMouse[0].y + _mouseHeight * scaley; vertMouse[0].z = 0; 529 556 } 530 557 break; 531 558 case STRETCHED_480X272: … … 535 562 scalex = (float)PSP_SCREEN_WIDTH / _screenWidth; 536 563 scaley = (float)PSP_SCREEN_HEIGHT / _screenHeight; 537 564 538 vert ices[0].x = mX * scalex; vertices[0].y = mY * scaley; vertices[0].z = 0;539 vert ices[1].x = vertices[0].x + _mouseWidth * scalex; vertices[1].y = vertices[0].y + _mouseHeight * scaley; vertices[0].z = 0;565 vertMouse[0].x = mX * scalex; vertMouse[0].y = mY * scaley; vertMouse[0].z = 0; 566 vertMouse[1].x = vertMouse[0].x + _mouseWidth * scalex; vertMouse[1].y = vertMouse[0].y + _mouseHeight * scaley; vertMouse[0].z = 0; 540 567 } 541 568 break; 542 569 } 543 sceGuDrawArray(GU_SPRITES, GU_TEXTURE_32BITFGU_VERTEX_32BITFGU_TRANSFORM_2D, 2, 0, vert ices);570 sceGuDrawArray(GU_SPRITES, GU_TEXTURE_32BITFGU_VERTEX_32BITFGU_TRANSFORM_2D, 2, 0, vertMouse); 544 571 } 545 572 546 573 if (_keyboardVisible) { … … 566 593 } 567 594 sceGuTexFunc(GU_TFX_REPLACE, GU_TCC_RGBA); 568 595 569 vertices[0].u = 0.5; vertices[0].v = 0.5; 570 vertices[1].u = PSP_SCREEN_WIDTH0.5; vertices[1].v = PSP_SCREEN_HEIGHT0.5; 571 vertices[0].x = 0; vertices[0].y = 0; vertices[0].z = 0; 572 vertices[1].x = PSP_SCREEN_WIDTH; vertices[1].y = PSP_SCREEN_HEIGHT; vertices[0].z = 0; 573 sceGuDrawArray(GU_SPRITES,GU_TEXTURE_32BITFGU_VERTEX_32BITFGU_TRANSFORM_2D,2,0,vertices); 596 struct Vertex* vertKB = (struct Vertex*)sceGuGetMemory(2 * sizeof(struct Vertex)); 597 vertKB[0].u = 0.5f; vertKB[0].v = 0.5f; 598 vertKB[1].u = PSP_SCREEN_WIDTH0.5f; vertKB[1].v = PSP_SCREEN_HEIGHT0.5f; 599 vertKB[0].x = 0; vertKB[0].y = 0; vertKB[0].z = 0; 600 vertKB[1].x = PSP_SCREEN_WIDTH; vertKB[1].y = PSP_SCREEN_HEIGHT; vertKB[0].z = 0; 601 sceGuDrawArray(GU_SPRITES,GU_TEXTURE_32BITFGU_VERTEX_32BITFGU_TRANSFORM_2D,2,0,vertKB); 574 602 sceGuDisable(GU_BLEND); 575 603 } 576 sceKernelDcacheWritebackAll();604 //sceKernelDcacheWritebackAll(); 577 605 578 606 sceGuFinish(); 579 607 sceGuSync(0,0);