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; }
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); }
void drawUploadTransfer() { sceDisplaySetMode(0, SCR_WIDTH, SCR_HEIGHT); sceGuStart(GU_DIRECT, list); sceGuTexFilter(GU_LINEAR, GU_LINEAR); sceGuFinish(); sceGuSync(0, 0); // This time, we only need one buffer. switchBuf(0, GU_PSM_8888); drawTexFlush(2, 2, 16, GU_PSM_T8, imageData, clutAddOne, vertices1); sceDisplayWaitVblank(); // Okay, let's draw a totally different pattern in memory. for (int y = 0; y < 272; ++y) { for (int x = 0; x < 512; ++x) { copybuf[y * 512 + x] = (x & 1) + (y & 1); } } sceKernelDcacheWritebackInvalidateAll(); sceDmacMemcpy(getBufAddr(0), copybuf, sizeof(copybuf)); sceKernelDcacheWritebackInvalidateAll(); // Now download should display out pattern. displayBuffer("Pattern"); }
/** * display_init: Initialize the PSP display. * * [Parameters] * None * [Return value] * Nonzero on success, zero on error */ int display_init(void) { /* Have we already initialized? */ static int initted = 0; if (initted) { return 1; } /* Clear out VRAM */ memset(sceGeEdramGetAddr(), 0, sceGeEdramGetSize()); sceKernelDcacheWritebackInvalidateAll(); /* Set display mode */ int32_t res = sceDisplaySetMode(0, DISPLAY_WIDTH, DISPLAY_HEIGHT); if (res < 0) { DMSG("sceDisplaySetMode() failed: %s", psp_strerror(res)); return 0; } display_width = DISPLAY_WIDTH; display_height = DISPLAY_HEIGHT; display_mode = PSP_DISPLAY_PIXEL_FORMAT_8888; display_bpp = 32; /* Initialize VRAM pointers */ uint8_t *vram_addr = sceGeEdramGetAddr(); uint32_t vram_size = sceGeEdramGetSize(); const uint32_t frame_size = DISPLAY_STRIDE * DISPLAY_HEIGHT * (display_bpp/8); int i; for (i = 0; i < lenof(surfaces); i++) { surfaces[i] = vram_addr + i*frame_size; } vram_spare_ptr = (uint8_t *)(vram_addr + lenof(surfaces)*frame_size); vram_next_alloc = vram_spare_ptr; vram_top = vram_addr + vram_size; displayed_surface = 0; work_surface = 1; swap_pending = 0; /* Set the currently-displayed buffer */ sceDisplaySetFrameBuf(surfaces[displayed_surface], DISPLAY_STRIDE, display_mode, PSP_DISPLAY_SETBUF_IMMEDIATE); /* Set up the GU library */ guInit(); guStart(GU_DIRECT, display_list); guDispBuffer(DISPLAY_WIDTH, DISPLAY_HEIGHT, surfaces[displayed_surface], DISPLAY_STRIDE); guFinish(); guSync(0, 0); /* Success */ initted = 1; return 1; }
void drawWithIndexOffsets() { sceDisplaySetMode(0, SCR_WIDTH, SCR_HEIGHT); sceGuStart(GU_DIRECT, list); sceGuTexFilter(GU_NEAREST, GU_NEAREST); sceGuFinish(); sceGuSync(0, 0); checkpointNext("Index shifts 8888:"); drawWithIndexOffsetsFmt(GU_PSM_8888); schedf("\n"); checkpointNext("Index shifts 4444:"); drawWithIndexOffsetsFmt(GU_PSM_4444); }
void sceGuDispBuffer(int width, int height, void* dispbp, int dispbw) { gu_draw_buffer.width = width; gu_draw_buffer.height = height; gu_draw_buffer.disp_buffer = dispbp; if (!gu_draw_buffer.frame_width || (gu_draw_buffer.frame_width != dispbw)) gu_draw_buffer.frame_width = dispbw; drawRegion(0,0,gu_draw_buffer.width,gu_draw_buffer.height); sceDisplaySetMode(0,gu_draw_buffer.width,gu_draw_buffer.height); if (gu_display_on) sceDisplaySetFrameBuf((void*)(((unsigned int)ge_edram_address) + ((unsigned int)gu_draw_buffer.disp_buffer)), dispbw, gu_draw_buffer.pixel_size, PSP_DISPLAY_SETBUF_NEXTFRAME); }
bool8 S9xSceGUInit (void) { sceGuInit (); sceDisplaySetMode (0, SCREEN_WIDTH, SCREEN_HEIGHT); S9xSceGUInit2 (); sceGuDrawBuffer (SceGU.pixel_format, (void *)0, SceGU.line_size); #ifdef SCEGU_DOUBLE_BUFFERED sceGuDisplay (1); #endif return (TRUE); }
void drawIntraTransfer() { sceDisplaySetMode(0, SCR_WIDTH, SCR_HEIGHT); sceGuStart(GU_DIRECT, list); sceGuTexFilter(GU_LINEAR, GU_LINEAR); sceGuFinish(); sceGuSync(0, 0); // This time, we only need one buffer. switchBuf(0, GU_PSM_8888); drawTexFlush(2, 2, 16, GU_PSM_T8, imageData, clutAddOne, vertices1); sceDisplayWaitVblank(); // Next, let's copy from this buffer to itself. sceKernelDcacheWritebackInvalidateAll(); sceDmacMemcpy(getBufAddr(0), (u8 *)getBufAddr(0) + sizeof(copybuf) / 2, sizeof(copybuf) / 2); sceKernelDcacheWritebackInvalidateAll(); // Now download should display a different buffer. displayBuffer("Spliced buffer"); }
void drawInterTransfer() { sceDisplaySetMode(0, SCR_WIDTH, SCR_HEIGHT); // First draw a texture to buffer 1. We'll use a clut here from memory. switchBuf(0, GU_PSM_8888); drawTexFlush(2, 2, 16, GU_PSM_T8, imageData, clutAddOne, vertices1); // Second, another texture to buffer 2. With a different clut so that they are visibly different. switchBuf(1, GU_PSM_8888); drawTexFlush(2, 2, 16, GU_PSM_T8, imageData, clutAddThree, vertices1); sceDisplayWaitVblank(); // Okay, at this point we have two buffers. Let's display one to make sure download works. displayBuffer("Initial download"); // Next, let's copy between them. sceKernelDcacheWritebackInvalidateAll(); sceDmacMemcpy(getBufAddr(1), getBufAddr(0), sizeof(copybuf)); sceKernelDcacheWritebackInvalidateAll(); // Now download should display the other buffer. displayBuffer("Copied buffer"); }
//////////////////////////////////////////////////////////////////////////////////// // This is just a quick and easy procedure to wait for a PSP to join, the following // is what is done in Lumines: // // - Wait for a PSP to join // - Add the PSP to the list of machines available // - Wait for the user to select a PSP // - Call sceMatchingSelectTarget // - The other PSP will receive MATCHING_SELECTED event // - The other PSP displays a message to accept or cancel // - If accepted the other PSP calls sceMatchingSelectTarget // - The first PSP receives MATCHING_ESTABLISHED // // In lumines they then close the connection and start a new adhoc connection // with just those two machines in it. /////////////////////////////////////////////////////////////////////////////////// int adhocSelect(void) { SceCtrlData m_PspPad; int err = 0; char mac[10]; char name[256]; int waitAccept = 0; int currentState = PSP_LISTING; int oldButtons = 0; char tempStr[100]; char str[256]; sceDisplaySetMode( 0, SCREEN_WIDTH, SCREEN_HEIGHT ); sceDisplaySetFrameBuf( (char*)VRAM_ADDR, 512, 1, 1 ); pgFillAllvram(0);pgScreenFrame(2,0); for(;;) { sceCtrlReadBufferPositive(&m_PspPad, 1); //pspDebugScreenSetTextColor(0xFFFF); switch(currentState) { case PSP_LISTING: { //pspDebugScreenInit(); //pspDebugScreenPrintf("Select a server to connect to, or triangle to return\n\n\n"); pgFillAllvram(0);pgScreenFrame(2,0); mh_print(0,0,"Select a server to connect to, or triangle to return",0xFFFF); DisplayPspList(); pgScreenFlipV(); g_Server = 0; if(m_PspPad.Buttons != oldButtons) { if(m_PspPad.Buttons & PSP_CTRL_UP) { UpList(); } if(m_PspPad.Buttons & PSP_CTRL_DOWN) { DownList(); } if(m_PspPad.Buttons & PSP_CTRL_CROSS) { if(GetPspEntry(mac, name) > 0) { currentState = PSP_SELECTING; sceNetAdhocMatchingSelectTarget(matchingId, mac, 0, 0); } } if(m_PspPad.Buttons & PSP_CTRL_TRIANGLE) return -1; } if(matchChanged) { if(g_matchEvent == MATCHING_SELECTED) { memcpy(mac, g_mac, 6); strcpy(name, g_matchOptData); currentState = PSP_SELECTED; } } break; } case PSP_SELECTING: { //pspDebugScreenInit(); pgFillAllvram(0);pgScreenFrame(2,0); sceNetEtherNtostr(mac, tempStr); //printf("Waiting for %s to accept the connection\nTo cancel press O\n", tempStr); sprintf(str,"Waiting for %s to accept the connection\nTo cancel press O\n", tempStr); mh_print(0,0,str,0xFFFF); pgScreenFlipV(); if(m_PspPad.Buttons != oldButtons) { if(m_PspPad.Buttons & PSP_CTRL_CIRCLE) { sceNetAdhocMatchingCancelTarget(matchingId, mac); currentState = PSP_LISTING; } } if(matchChanged) { if(g_matchEvent == MATCHING_SELECTED) { sceNetAdhocMatchingCancelTarget(matchingId, mac); } else if(g_matchEvent == MATCHING_ESTABLISHED) { currentState = PSP_ESTABLISHED; } else if(g_matchEvent == MATCHING_REJECTED) { currentState = PSP_LISTING; } } break; } case PSP_SELECTED: { g_Server = 1; //pspDebugScreenInit(); pgFillAllvram(0);pgScreenFrame(2,0); sceNetEtherNtostr(mac, tempStr); sprintf(str,"%s has requested a connection\nTo accept the connection press X, to cancel press O\n", tempStr); mh_print(0,0,str,0xFFFF); pgScreenFlipV(); if(m_PspPad.Buttons != oldButtons) { if(m_PspPad.Buttons & PSP_CTRL_CIRCLE) { sceNetAdhocMatchingCancelTarget(matchingId, mac); currentState = PSP_LISTING; } if(m_PspPad.Buttons & PSP_CTRL_CROSS) { sceNetAdhocMatchingSelectTarget(matchingId, mac, 0, 0); currentState = PSP_WAIT_EST; } } if(matchChanged) { if(g_matchEvent == MATCHING_CANCELED) { currentState = PSP_LISTING; } } break; } case PSP_WAIT_EST: { if(matchChanged) { if(g_matchEvent == MATCHING_ESTABLISHED) { currentState = PSP_ESTABLISHED; } } break; } } matchChanged = 0; oldButtons = m_PspPad.Buttons; if(currentState == PSP_ESTABLISHED) break; sceDisplayWaitVblankStart(); } char macAddr[10]; char *tempMac; if(g_Server) { sceWlanGetEtherAddr(macAddr); tempMac = macAddr; } else { tempMac = mac; } sceNetEtherNtostr(tempMac, tempStr); char ssid[10]; sprintf(ssid, "%c%c%c%c%c%c", tempStr[9], tempStr[10], tempStr[12], tempStr[13], tempStr[15], tempStr[16]); adhocReconnect(ssid); // We only get here if both PSP's have agreed to connect //pspDebugScreenInit(); //pspDebugScreenPrintf("Connected\n"); pgFillAllvram(0);pgScreenFrame(2,0); mh_print(0,0,"Connected",0xFFFF); pgScreenFlipV(); return 0; }
int psp_initadhocgame(void){ int retval; //testing net stuff //pspDebugScreenInit(); sprintf(str_id,"%s\/%s",os9x_nickname,shortrom_filename); if((adhocInit(str_id) >= 0) && (adhocSelect() >=0)) { //init adhoc unsigned int length; uint8 *buffer; int err = 0; int i=0; if (g_Server) os9x_conId = 1; else os9x_conId = 2; //buffer=(uint8*)malloc(256); //sceKernelDelayThread(1000000); //wait //pspDebugScreenInit(); if (os9x_conId==1) { //server //send settings is now done in psp.cpp /*save_buffer_settings(buffer); sceKernelDelayThread(3000000); //wait printf("Sending settings data to the client\n"); err = adhocSendRecvAck(buffer, 256); if (!err) printf("Done sending data\n"); else { printf("Error %d!",err); retval=-2; sceKernelDelayThread(1000000); //wait }*/ //server is pl1 os9x_netpadindex=0; } else { //client /*int size = 0; // receive the settings data printf("Waiting for settings data\n"); length = 256; err = adhocRecvSendAck(buffer, &length); if (!err) { printf("Received data from server %d bytes\n",length); load_buffer_settings(buffer); } else { printf("Error %d!",err); retval=-3; sceKernelDelayThread(1000000); //wait }*/ //client is pl2 os9x_netpadindex=1; } retval=0; //free(buffer); } else retval=-1; sceDisplaySetMode( 0, SCREEN_WIDTH, SCREEN_HEIGHT ); sceDisplaySetFrameBuf( (char*)VRAM_ADDR, 512, 1, 1 ); pgScreenFrame(2,0); return retval; }
void draw() { int x = 10, y = 10; sceDisplaySetMode(0, SCR_WIDTH, SCR_HEIGHT); sceGuStart(GU_DIRECT, list); sceGuClear(GU_COLOR_BUFFER_BIT); sceGuClutMode(GU_PSM_8888, 0, 0xFF, 0); sceGuClutLoad(1, clut); drawBG(); // Reset things. sceGuSendCommandi(GE_CMD_LIGHTINGENABLE, 0); sceGuSendCommandi(GE_CMD_MATERIALALPHA, 0x00); sceGuSendCommandi(GE_CMD_AMBIENTCOLOR, 0x000000); sceGuSendCommandi(GE_CMD_AMBIENTALPHA, 0x00); sceGuSendCommandi(GE_CMD_MATERIALUPDATE, 0); sceGuSendCommandi(GE_CMD_MATERIALAMBIENT, 0); nextBox(&x, &y); sceGuSendCommandi(GE_CMD_MATERIALUPDATE, 0xFF); sceGuSendCommandi(GE_CMD_MATERIALAMBIENT, 0xFF0000); nextBox(&x, &y); sceGuSendCommandi(GE_CMD_MATERIALAMBIENT, 0x00FF00); nextBox(&x, &y); sceGuSendCommandi(GE_CMD_MATERIALUPDATE, 0); sceGuSendCommandi(GE_CMD_MATERIALAMBIENT, 0x0000FF); nextBox(&x, &y); sceGuSendCommandi(GE_CMD_MATERIALUPDATE, 0); sceGuSendCommandi(GE_CMD_MATERIALAMBIENT, 0); nextBoxHasColor(&x, &y, HASCOLOR_RGBA); sceGuSendCommandi(GE_CMD_MATERIALUPDATE, GU_AMBIENT); sceGuSendCommandi(GE_CMD_MATERIALALPHA, 0x00); sceGuSendCommandi(GE_CMD_MATERIALAMBIENT, 0xFF0000); sceGuSendCommandi(GE_CMD_AMBIENTCOLOR, 0x0000FF); sceGuSendCommandi(GE_CMD_AMBIENTALPHA, 0x00); sceGuSendCommandi(GE_CMD_LIGHTINGENABLE, 1); nextBoxHasColor(&x, &y, HASCOLOR_RGBA); sceGuSendCommandi(GE_CMD_MATERIALUPDATE, 0xFF); sceGuSendCommandi(GE_CMD_MATERIALALPHA, 0x80); sceGuSendCommandi(GE_CMD_MATERIALAMBIENT, 0xFFFFFF); sceGuSendCommandi(GE_CMD_AMBIENTCOLOR, 0xFFFFFF); sceGuSendCommandi(GE_CMD_AMBIENTALPHA, 0x80); sceGuSendCommandi(GE_CMD_LIGHTINGENABLE, 1); nextBoxHasColor(&x, &y, HASCOLOR_RGBA); sceGuSendCommandi(GE_CMD_MATERIALUPDATE, 0); sceGuSendCommandi(GE_CMD_MATERIALAMBIENT, 0); nextBoxHasColor(&x, &y, HASCOLOR_RGBA_TRANSPARENT); sceGuSendCommandi(GE_CMD_MATERIALUPDATE, GU_AMBIENT); sceGuSendCommandi(GE_CMD_MATERIALALPHA, 0x0); sceGuSendCommandi(GE_CMD_MATERIALAMBIENT, 0xFF0000); sceGuSendCommandi(GE_CMD_AMBIENTCOLOR, 0x0000FF); sceGuSendCommandi(GE_CMD_AMBIENTALPHA, 0x0); sceGuSendCommandi(GE_CMD_LIGHTINGENABLE, 1); nextBoxHasColor(&x, &y, HASCOLOR_RGBA_TRANSPARENT); sceGuSendCommandi(GE_CMD_MATERIALUPDATE, 0xFF); sceGuSendCommandi(GE_CMD_MATERIALALPHA, 0x10); sceGuSendCommandi(GE_CMD_MATERIALAMBIENT, 0xFFFFFF); sceGuSendCommandi(GE_CMD_AMBIENTCOLOR, 0xFFFFFF); sceGuSendCommandi(GE_CMD_AMBIENTALPHA, 0x10); sceGuSendCommandi(GE_CMD_LIGHTINGENABLE, 1); nextBoxHasColor(&x, &y, HASCOLOR_RGBA_TRANSPARENT); sceGuSendCommandi(GE_CMD_MATERIALUPDATE, 0); sceGuSendCommandi(GE_CMD_MATERIALAMBIENT, 0); nextBoxHasColor(&x, &y, HASCOLOR_RGB); sceGuSendCommandi(GE_CMD_MATERIALUPDATE, GU_AMBIENT); sceGuSendCommandi(GE_CMD_MATERIALALPHA, 0x0); sceGuSendCommandi(GE_CMD_MATERIALAMBIENT, 0xFF0000); sceGuSendCommandi(GE_CMD_AMBIENTCOLOR, 0x0000FF); sceGuSendCommandi(GE_CMD_AMBIENTALPHA, 0x0); sceGuSendCommandi(GE_CMD_LIGHTINGENABLE, 1); nextBoxHasColor(&x, &y, HASCOLOR_RGB); sceGuSendCommandi(GE_CMD_MATERIALUPDATE, 0xFF); sceGuSendCommandi(GE_CMD_MATERIALALPHA, 0x10); sceGuSendCommandi(GE_CMD_MATERIALAMBIENT, 0xFFFFFF); sceGuSendCommandi(GE_CMD_AMBIENTCOLOR, 0xFFFFFF); sceGuSendCommandi(GE_CMD_AMBIENTALPHA, 0x10); sceGuSendCommandi(GE_CMD_LIGHTINGENABLE, 1); nextBoxHasColor(&x, &y, HASCOLOR_RGB); sceGuSendCommandi(GE_CMD_MATERIALUPDATE, 0); sceGuSendCommandi(GE_CMD_MATERIALAMBIENT, 0); nextBoxHasColor(&x, &y, HASCOLOR_RGB_TRANSPARENT); sceGuSendCommandi(GE_CMD_MATERIALUPDATE, GU_AMBIENT); sceGuSendCommandi(GE_CMD_MATERIALALPHA, 0x0); sceGuSendCommandi(GE_CMD_MATERIALAMBIENT, 0xFF0000); sceGuSendCommandi(GE_CMD_AMBIENTCOLOR, 0x0000FF); sceGuSendCommandi(GE_CMD_AMBIENTALPHA, 0x0); sceGuSendCommandi(GE_CMD_LIGHTINGENABLE, 1); nextBoxHasColor(&x, &y, HASCOLOR_RGB_TRANSPARENT); sceGuSendCommandi(GE_CMD_MATERIALUPDATE, 0xFF); sceGuSendCommandi(GE_CMD_MATERIALALPHA, 0x10); sceGuSendCommandi(GE_CMD_MATERIALAMBIENT, 0xFFFFFF); sceGuSendCommandi(GE_CMD_AMBIENTCOLOR, 0xFFFFFF); sceGuSendCommandi(GE_CMD_AMBIENTALPHA, 0x10); sceGuSendCommandi(GE_CMD_LIGHTINGENABLE, 1); nextBoxHasColor(&x, &y, HASCOLOR_RGB_TRANSPARENT); sceGuSendCommandi(GE_CMD_MATERIALUPDATE, 0); sceGuSendCommandi(GE_CMD_MATERIALAMBIENT, 0); nextBox(&x, &y); /*ScePspFVector3 pos = {x, y, 0}; sceGuLight(0, GU_DIRECTIONAL, GU_AMBIENT_AND_DIFFUSE, &pos); nextBox(&x, &y); pos.x = x; pos.y = y; sceGuLight(0, GU_DIRECTIONAL, GU_AMBIENT_AND_DIFFUSE, &pos); sceGuLightMode(GU_SINGLE_COLOR); sceGuLightColor(0, GU_AMBIENT, 0x00FF00); sceGuLightAtt(0, 1.0, 1.0, 1.0); nextBox(&x, &y);*/ sceGuFinish(); sceGuSync(GU_SYNC_LIST, GU_SYNC_WHAT_DONE); sceGuSync(0, 0); sceDisplayWaitVblankStart(); }
extern "C" int main(int argc, char *argv[]) { init(); schedf("framebuf: %08x\n", sceDisplaySetFrameBuf(sceGeEdramGetAddr(), 512, GU_PSM_8888, PSP_DISPLAY_SETBUF_IMMEDIATE)); schedf("dispmode: %08x\n", sceDisplaySetMode(0, 480, 272)); checkpointNext("Common:"); testBlendFunc(" One + Zero", 0x44444444, 0xEEDDCCBB, GU_ADD, GU_FIX, GU_FIX, 0xFFFFFFFF, 0x00000000); testBlendFunc(" Zero + One", 0x44444444, 0xEEDDCCBB, GU_ADD, GU_FIX, GU_FIX, 0x00000000, 0xFFFFFFFF); testBlendFunc(" Alpha + Inverse alpha", 0x44444444, 0xEEDDCCBB, GU_ADD, GU_SRC_ALPHA, GU_ONE_MINUS_SRC_ALPHA, 0x80808080, 0x80808080); checkpointNext("Doubling:"); testBlendFunc(" Double source alpha + Zero", 0x40404040, 0x80808080, GU_ADD, GU_DOUBLE_SRC_ALPHA, GU_FIX, 0x00000000, 0x00000000); testBlendFunc(" Double source alpha + Zero", 0x40404040, 0x80909090, GU_ADD, GU_DOUBLE_SRC_ALPHA, GU_FIX, 0x00000000, 0x00000000); testBlendFunc(" Double source alpha + Zero", 0x40404040, 0x90808080, GU_ADD, GU_DOUBLE_SRC_ALPHA, GU_FIX, 0x00000000, 0x00000000); testBlendFunc(" Inverse double source alpha + Zero", 0x40404040, 0x80808080, GU_ADD, GU_ONE_MINUS_DOUBLE_SRC_ALPHA, GU_FIX, 0x00000000, 0x00000000); testBlendFunc(" Inverse double source alpha + Zero", 0x40404040, 0x80909090, GU_ADD, GU_ONE_MINUS_DOUBLE_SRC_ALPHA, GU_FIX, 0x00000000, 0x00000000); testBlendFunc(" Inverse double source alpha + Zero", 0x40404040, 0x90808080, GU_ADD, GU_ONE_MINUS_DOUBLE_SRC_ALPHA, GU_FIX, 0x00000000, 0x00000000); testBlendFunc(" Inverse double source alpha + Zero", 0x40404040, 0x40808080, GU_ADD, GU_ONE_MINUS_DOUBLE_SRC_ALPHA, GU_FIX, 0x00000000, 0x00000000); testBlendFunc(" Double dest alpha + Zero", 0x40404040, 0x80808080, GU_ADD, GU_DOUBLE_DST_ALPHA, GU_FIX, 0x00000000, 0x00000000); testBlendFunc(" Double dest alpha + Zero", 0x90404040, 0x80808080, GU_ADD, GU_DOUBLE_DST_ALPHA, GU_FIX, 0x00000000, 0x00000000); testBlendFunc(" Double dest alpha + Zero", 0x40404040, 0x80909090, GU_ADD, GU_DOUBLE_DST_ALPHA, GU_FIX, 0x00000000, 0x00000000); checkpointNext("Factors:"); testBlendFunc(" Dest color + Zero", 0x50404040, 0x90808080, GU_ADD, GU_DST_COLOR, GU_FIX, 0x00000000, 0x00000000); testBlendFunc(" Inverse dest color + Zero", 0x50404040, 0x90808080, GU_ADD, GU_ONE_MINUS_DST_COLOR, GU_FIX, 0x00000000, 0x00000000); testBlendFunc(" Src alpha + Zero", 0x50404040, 0x90808080, GU_ADD, GU_SRC_ALPHA, GU_FIX, 0x00000000, 0x00000000); testBlendFunc(" Inverse src alpha + Zero", 0x50404040, 0x90808080, GU_ADD, GU_ONE_MINUS_SRC_ALPHA, GU_FIX, 0x00000000, 0x00000000); testBlendFunc(" Dest alpha + Zero", 0x50404040, 0x90808080, GU_ADD, GU_DST_ALPHA, GU_FIX, 0x00000000, 0x00000000); testBlendFunc(" Inverse dest alpha + Zero", 0x50404040, 0x90808080, GU_ADD, GU_ONE_MINUS_DST_ALPHA, GU_FIX, 0x00000000, 0x00000000); testBlendFunc(" Double src alpha + Zero", 0x50404040, 0x90808080, GU_ADD, GU_DOUBLE_SRC_ALPHA, GU_FIX, 0x00000000, 0x00000000); testBlendFunc(" Inverse double src alpha + Zero", 0x50404040, 0x90808080, GU_ADD, GU_ONE_MINUS_DOUBLE_SRC_ALPHA, GU_FIX, 0x00000000, 0x00000000); testBlendFunc(" Double dest alpha + Zero", 0x50404040, 0x90808080, GU_ADD, GU_DOUBLE_DST_ALPHA, GU_FIX, 0x00000000, 0x00000000); testBlendFunc(" Inverse double dest alpha + Zero", 0x50404040, 0x90808080, GU_ADD, GU_ONE_MINUS_DOUBLE_DST_ALPHA, GU_FIX, 0x00000000, 0x00000000); testBlendFunc(" Fix + Zero", 0x50404040, 0x90808080, GU_ADD, GU_FIX, GU_FIX, 0x90808080, 0x00000000); testBlendFunc(" Zero + Src color", 0x50404040, 0x90808080, GU_ADD, GU_FIX, GU_SRC_COLOR, 0x00000000, 0x00000000); testBlendFunc(" Zero + Inverse dest color", 0x50404040, 0x90808080, GU_ADD, GU_FIX, GU_ONE_MINUS_SRC_COLOR, 0x00000000, 0x00000000); testBlendFunc(" Zero + Src alpha", 0x50404040, 0x90808080, GU_ADD, GU_FIX, GU_SRC_ALPHA, 0x00000000, 0x00000000); testBlendFunc(" Zero + Inverse src alpha", 0x50404040, 0x90808080, GU_ADD, GU_FIX, GU_ONE_MINUS_SRC_ALPHA, 0x00000000, 0x00000000); testBlendFunc(" Zero + Dest alpha", 0x50404040, 0x90808080, GU_ADD, GU_FIX, GU_DST_ALPHA, 0x00000000, 0x00000000); testBlendFunc(" Zero + Inverse dest alpha", 0x50404040, 0x90808080, GU_ADD, GU_FIX, GU_ONE_MINUS_DST_ALPHA, 0x00000000, 0x00000000); testBlendFunc(" Zero + Double src alpha", 0x50404040, 0x90808080, GU_ADD, GU_FIX, GU_DOUBLE_SRC_ALPHA, 0x00000000, 0x00000000); testBlendFunc(" Zero + Inverse double src alpha", 0x50404040, 0x90808080, GU_ADD, GU_FIX, GU_ONE_MINUS_DOUBLE_SRC_ALPHA, 0x00000000, 0x00000000); testBlendFunc(" Zero + Double dest alpha", 0x50404040, 0x90808080, GU_ADD, GU_FIX, GU_DOUBLE_DST_ALPHA, 0x00000000, 0x00000000); testBlendFunc(" Zero + Inverse double dest alpha", 0x50404040, 0x90808080, GU_ADD, GU_FIX, GU_ONE_MINUS_DOUBLE_DST_ALPHA, 0x00000000, 0x00000000); checkpointNext("Add:"); testBlendFunc(" F0 + 0F", 0xFFFFFFFF, 0xFFFFFFFF, GU_ADD, GU_FIX, GU_FIX, 0xF0F0F0F0, 0x0F0F0F0F); testBlendFunc(" 0F + F0", 0xFFFFFFFF, 0xFFFFFFFF, GU_ADD, GU_FIX, GU_FIX, 0x0F0F0F0F, 0xF0F0F0F0); checkpointNext("Subtract:"); testBlendFunc(" F0 - 0F", 0xFFFFFFFF, 0xFFFFFFFF, GU_SUBTRACT, GU_FIX, GU_FIX, 0xF0F0F0F0, 0x0F0F0F0F); testBlendFunc(" 0F - F0", 0xFFFFFFFF, 0xFFFFFFFF, GU_SUBTRACT, GU_FIX, GU_FIX, 0x0F0F0F0F, 0xF0F0F0F0); checkpointNext("Reverse subtract:"); testBlendFunc(" Reverse F0 - 0F", 0xFFFFFFFF, 0xFFFFFFFF, GU_REVERSE_SUBTRACT, GU_FIX, GU_FIX, 0xF0F0F0F0, 0x0F0F0F0F); testBlendFunc(" Reverse 0F - F0", 0xFFFFFFFF, 0xFFFFFFFF, GU_REVERSE_SUBTRACT, GU_FIX, GU_FIX, 0x0F0F0F0F, 0xF0F0F0F0); checkpointNext("Min:"); testBlendFunc(" Min 0F, F0", 0xF0F0F0F0, 0x0F0F0F0F, GU_MIN, GU_FIX, GU_FIX, 0x80808080, 0x80808080); testBlendFunc(" Min F0, 0F", 0x0F0F0F0F, 0xF0F0F0F0, GU_MIN, GU_FIX, GU_FIX, 0x80808080, 0x80808080); checkpointNext("Max:"); testBlendFunc(" Max 0F, F0", 0xF0F0F0F0, 0x0F0F0F0F, GU_MAX, GU_FIX, GU_FIX, 0x80808080, 0x80808080); testBlendFunc(" Max F0, 0F", 0x0F0F0F0F, 0xF0F0F0F0, GU_MAX, GU_FIX, GU_FIX, 0x80808080, 0x80808080); checkpointNext("Absolute difference:"); testBlendFunc(" Abs 0F - F0", 0xF0F0F0F0, 0x0F0F0F0F, GU_ABS, GU_FIX, GU_FIX, 0x80808080, 0x80808080); testBlendFunc(" Abs F0 - 0F", 0x0F0F0F0F, 0xF0F0F0F0, GU_ABS, GU_FIX, GU_FIX, 0x80808080, 0x80808080); sceGuTerm(); return 0; }
void pgInit() { sceDisplaySetMode(0,SCREEN_WIDTH,SCREEN_HEIGHT); pgScreenFrame(0,0); }