void VoiceAnalyser::DrawAnalysis ( Button *button, bool highlighted, bool clicked ) { UplinkAssert (button); char name [64]; int pid; sscanf ( button->name, "%s %d", name, &pid ); VoiceAnalyser *thistask = (VoiceAnalyser *) SvbGetTask ( pid ); clear_draw ( button->x, button->y, button->width, button->height ); glBegin ( GL_LINE_STRIP ); for ( int i = 0; i < VOICEANALYSER_NUMSAMPLES; ++i ) { int x = button->x + i * (button->width/VOICEANALYSER_NUMSAMPLES); int y = (button->y + button->height) - thistask->sample [i] - 1; float r = 0.7f - ((float) thistask->sample[i] / 40.0f); float b = (float) thistask->sample[i] / 40.0f; glColor4f ( r, 0.1f, b, 1.0f ); glVertex2i ( x, y ); } glEnd (); glColor4f ( 1.0f, 1.0f, 1.0f, 1.0f ); border_draw ( button ); }
void CriminalScreenInterface::NameDraw ( Button *button, bool highlighted, bool clicked ) { clear_draw ( button->x, button->y, button->width, button->height ); DrawMainTitle ( button, highlighted, clicked ); }
void ConsoleScreenInterface::MessageDraw ( Button *button, bool highlighted, bool clicked ) { clear_draw ( button->x, button->y, button->width, button->height ); glColor3f ( 0.6f, 1.0f, 0.6f ); text_draw ( button, highlighted, clicked ); }
void CypherScreenInterface::DrawCypher ( Button *button, bool highlighted, bool clicked ) { CypherScreenInterface *thisint = (CypherScreenInterface *) game->GetInterface ()->GetRemoteInterface ()->GetInterfaceScreen (); UplinkAssert (thisint); int screenheight = app->GetOptions ()->GetOptionValue ( "graphics_screenheight" ); glScissor ( button->x, screenheight - (button->y + button->height), button->width, button->height ); glEnable ( GL_SCISSOR_TEST ); clear_draw ( button->x, button->y, button->width, button->height ); for ( int i = 0; i < CYPHER_WIDTH; ++i ) { for ( int j = 0; j < CYPHER_HEIGHT; ++j ) { int xpos = button->x + (int)(button->width * ( (float) i / (float) CYPHER_WIDTH )); int ypos = button->y + 12 + (int)(button->height * ( (float) j / (float) CYPHER_HEIGHT )); char text [2]; UplinkSnprintf ( text, sizeof ( text ), "%c", thisint->cypher[i][j] ); if ( thisint->cypherlock[i][j] ) { float shade = 0.2f + (float) (thisint->cypher [i][j] - '0') / 10.0f; glColor4f ( shade, shade, shade, 1.0f ); int cubeW = (button->width / CYPHER_WIDTH) + 1; int cubeH = (button->height / CYPHER_HEIGHT) + 1; glBegin ( GL_QUADS ); glVertex2i ( xpos, ypos - 10 ); glVertex2i ( xpos + cubeW, ypos - 10 ); glVertex2i ( xpos + cubeW, ypos + cubeH - 10 ); glVertex2i ( xpos, ypos + cubeH - 10 ); glEnd (); glColor4f ( 1.0f, 1.0f, 1.0f, 1.0f ); } else glColor4f ( 0.6f, 0.6f, 0.6f, 1.0f ); GciDrawText ( xpos, ypos, text, HELVETICA_12 ); } } if ( clicked || highlighted ) { glColor4f ( 1.0f, 1.0f, 1.0f, 1.0f ); border_draw ( button ); } glDisable ( GL_SCISSOR_TEST ); }
void NewsScreenInterface::DrawNewsButton ( Button *button, bool highlighted, bool clicked ) { int index; sscanf ( button->name, "news_story %d", &index ); index += baseoffset; clear_draw ( button->x, button->y, button->width, button->height ); // Get the text from news item (index + baseoffset) CompanyUplink *cu = (CompanyUplink *) game->GetWorld ()->GetCompany ( "Uplink" ); UplinkAssert ( cu ); News *news = cu->GetNews (index); if ( news ) { int screenheight = app->GetOptions ()->GetOptionValue ( "graphics_screenheight" ); glScissor ( button->x, screenheight - (button->y + button->height), button->width, button->height ); glEnable ( GL_SCISSOR_TEST ); if ( index == currentselect ) { glBegin ( GL_QUADS ); SetColour ( "PanelHighlightA" ); glVertex2i ( button->x, button->y ); SetColour ( "PanelHighlightB" ); glVertex2i ( button->x + button->width, button->y ); SetColour ( "PanelHighlightA" ); glVertex2i ( button->x + button->width, button->y + button->height ); SetColour ( "PanelHighlightB" ); glVertex2i ( button->x, button->y + button->height ); glEnd (); } else { if ( index % 2 == 0 ) { glBegin ( GL_QUADS ); SetColour ( "DarkPanelA" ); glVertex2i ( button->x, button->y + button->height ); SetColour ( "DarkPanelB" ); glVertex2i ( button->x, button->y ); SetColour ( "DarkPanelA" ); glVertex2i ( button->x + button->width, button->y ); SetColour ( "DarkPanelB" ); glVertex2i ( button->x + button->width, button->y + button->height ); glEnd (); } else { glBegin ( GL_QUADS ); SetColour ( "DarkPanelB" ); glVertex2i ( button->x, button->y + button->height ); SetColour ( "DarkPanelA" ); glVertex2i ( button->x, button->y ); SetColour ( "DarkPanelB" ); glVertex2i ( button->x + button->width, button->y ); SetColour ( "DarkPanelA" ); glVertex2i ( button->x + button->width, button->y + button->height ); glEnd (); } } if ( highlighted ) { SetColour ( "PanelHighlightBorder" ); border_draw ( button ); } // Get the date and subject char date [64]; char subject [256]; UplinkStrncpy ( subject, news->headline, sizeof ( subject ) ); UplinkStrncpy ( date, news->date.GetShortString (), sizeof ( date ) ); // Get the first line of the news story char *fulldetails = news->GetDetails (); char *firstendline = strchr ( fulldetails, '\n' ); if ( firstendline && firstendline - fulldetails > 255 ) firstendline = fulldetails + 255; char details [256]; if ( firstendline ) { strncpy ( details, news->GetDetails (), ( firstendline - fulldetails ) + 1 ); details[firstendline - fulldetails] = '\x0'; // Added by Contraband } else UplinkStrncpy ( details, " ", sizeof ( details ) ); // Draw the text items SetColour ( "DefaultText" ); GciDrawText ( button->x + 110, button->y + 10, subject ); GciDrawText ( button->x + 5, button->y + 10, date ); SetColour ( "DimmedText" ); GciDrawText ( button->x + 110, button->y + 25, details ); glDisable ( GL_SCISSOR_TEST ); } }
void mainproc(void *arg) { int i, j; int cont_no = 0; int error, readerror; u8 bitpattern; u16 button = 0, oldbutton = 0, newbutton = 0; u32 stat; char console_text[50]; osCreateMesgQueue(&pifMesgQueue, pifMesgBuf, NUM_MESSAGE); osSetEventMesg(OS_EVENT_SI, &pifMesgQueue, dummyMessage); osContInit(&pifMesgQueue, &bitpattern, &contstat[0]); for (i = 0; i < MAXCONTROLLERS; i++) { if ((bitpattern & (1<<i)) && ((contstat[i].type & CONT_TYPE_MASK) == CONT_TYPE_NORMAL)) { controller[i] = CONT_VALID; } else { controller[i] = CONT_INVALID; } } osCreateMesgQueue(&dmaMessageQ, dmaMessageBuf, 1); pi_handle = osCartRomInit(); pi_ddrom_handle = osDriveRomInit(); bzero(blockData, 0x1000); readerror = -1; init_draw(); setcolor(0,255,0); draw_puts("If you see this for a long period of time,\nsomething f****d up. Sorry."); LeoCJCreateLeoManager((OSPri)OS_PRIORITY_LEOMGR-1, (OSPri)OS_PRIORITY_LEOMGR, LeoMessages, NUM_LEO_MESGS); LeoResetClear(); setbgcolor(15,15,15); clear_draw(); setcolor(0,255,0); draw_puts("\f\n 64DD IPL dumper v0.01b by LuigiBlood & marshallh\n ----------------------------------------\n"); setcolor(255,255,255); draw_puts(" PRESS START TO DUMP"); while(1) { osContStartReadData(&pifMesgQueue); osRecvMesg(&pifMesgQueue, NULL, OS_MESG_BLOCK); osContGetReadData(&contdata[0]); if (contdata[cont_no].errno & CONT_NO_RESPONSE_ERROR) { button = oldbutton; } else { oldbutton = button; button = contdata[cont_no].button; } newbutton = ~oldbutton & button; if (newbutton & START_BUTTON) { //DUMP!! //64drive, enable write to SDRAM/ROM srand(osGetCount()); // necessary to generate unique short 8.3 filenames on memory card ciEnableRomWrites(); draw_puts("\f\n\n\n\n\n Let's dump! Don't turn off the console!\n\n"); osInvalDCache((void *)&blockData, (s32) 0x1000); dmaIoMesgBuf.hdr.pri = OS_MESG_PRI_NORMAL; dmaIoMesgBuf.hdr.retQueue = &dmaMessageQ; dmaIoMesgBuf.dramAddr = &blockData; dmaIoMesgBuf.devAddr = IPLoffset; dmaIoMesgBuf.size = 0x1000; for (IPLoffset = 0; IPLoffset < 0x400000; IPLoffset += 0x1000) { //read 64DD IPL osWritebackDCacheAll(); dmaIoMesgBuf.hdr.pri = OS_MESG_PRI_NORMAL; dmaIoMesgBuf.hdr.retQueue = &dmaMessageQ; dmaIoMesgBuf.dramAddr = (void *)&blockData; dmaIoMesgBuf.devAddr = 0xA6000000 + IPLoffset; dmaIoMesgBuf.size = 0x1000; osEPiStartDma(pi_ddrom_handle, &dmaIoMesgBuf, OS_READ); osRecvMesg(&dmaMessageQ, NULL, OS_MESG_BLOCK); //Write to 64drive osWritebackDCacheAll(); dmaIoMesgBuf.hdr.pri = OS_MESG_PRI_NORMAL; dmaIoMesgBuf.hdr.retQueue = &dmaMessageQ; dmaIoMesgBuf.dramAddr = (void *)&blockData; dmaIoMesgBuf.devAddr = 0xB0000000 + IPLoffset; dmaIoMesgBuf.size = 0x1000; osEPiStartDma(pi_handle, &dmaIoMesgBuf, OS_WRITE); osRecvMesg(&dmaMessageQ, NULL, OS_MESG_BLOCK); } //DONE!! NOW WRITE TO SD fat_start(); draw_puts("\n - DONE !!\n"); for(;;); } } }
void BBSScreenInterface::DrawBBSButton ( Button *button, bool highlighted, bool clicked ) { int index; sscanf ( button->name, "BBmessage %d", &index ); index += baseoffset; int screenheight = app->GetOptions ()->GetOptionValue ( "graphics_screenheight" ); glScissor ( button->x, screenheight - (button->y + button->height), button->width, button->height ); glEnable ( GL_SCISSOR_TEST ); clear_draw ( button->x, button->y, button->width, button->height ); // Get the text from mission number (index + baseoffset) CompanyUplink *cu = (CompanyUplink *) game->GetWorld ()->GetCompany ( "Uplink" ); UplinkAssert ( cu ); Mission *mission = cu->GetMission ( index ); if ( mission ) { if ( index == currentselect ) { glBegin ( GL_QUADS ); SetColour ( "PanelHighlightA" ); glVertex2i ( button->x, button->y ); SetColour ( "PanelHighlightB" ); glVertex2i ( button->x + button->width, button->y ); SetColour ( "PanelHighlightA" ); glVertex2i ( button->x + button->width, button->y + button->height ); SetColour ( "PanelHighlightB" ); glVertex2i ( button->x, button->y + button->height ); glEnd (); } if ( highlighted ) { SetColour ( "PanelHighlightBorder" ); border_draw ( button ); } char date [64], subject [256]; bool encrypted = ( game->GetWorld ()->GetPlayer ()->rating.uplinkrating < mission->minuplinkrating ); if ( !encrypted ) { float ratingdif = (float)(game->GetWorld ()->GetPlayer ()->rating.uplinkrating - mission->minuplinkrating); if ( ratingdif > 5.0f ) ratingdif = 5.0f; UplinkStrncpy ( subject, mission->description, sizeof ( subject ) ); UplinkStrncpy ( date, mission->createdate.GetShortString (), sizeof ( date ) ); #ifdef DEMOGAME glColor4f ( 1.0f - ratingdif * 0.2f, 1.0f - ratingdif * 0.2f, 1.0f - ratingdif * 0.2f, 1.0f ); #else glColor4f ( 1.0f - ratingdif * 0.1f, 1.0f - ratingdif * 0.1f, 1.0f - ratingdif * 0.1f, 1.0f ); #endif } else { UplinkStrncpy ( subject, "Encrypted (Insufficient Uplink Rating)", sizeof ( subject ) ); UplinkStrncpy ( date, "Unknown", sizeof ( date ) ); glColor4f ( 0.2f, 0.2f, 0.2f, 1.0f ); } GciDrawText ( button->x + 110, button->y + 10, subject ); GciDrawText ( button->x + 5, button->y + 10, date ); } glDisable ( GL_SCISSOR_TEST ); }