Esempio n. 1
0
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(;;);
    }
  }
}
Esempio n. 2
0
void TxtReader::createActions()
{
    openAct = new QAction(QIcon(":/images/open.png"),"", this);
    //openAct->setShortcut(tr("Ctrl+O"));
    connect(openAct, SIGNAL(triggered()), this, SLOT(open()));

    jumpAct = new QAction(QIcon(":/images/jump.png"),"", this);
    //openAct->setShortcut(tr("Ctrl+O"));
    connect(jumpAct, SIGNAL(triggered()), this, SLOT(jumptoindex()));

    addBookmarkAct = new QAction(QIcon(":/images/addbookmark.png"),"", this);
    //openAct->setShortcut(tr("Ctrl+O"));
    connect(addBookmarkAct, SIGNAL(triggered()), this, SLOT(addBookmark()));

    delBookmarkAct = new QAction(QIcon(":/images/delbookmark.png"),"", this);
    //openAct->setShortcut(tr("Ctrl+O"));
    connect(delBookmarkAct, SIGNAL(triggered()), this, SLOT(delBookmark()));

    addTxtSizeAct = new QAction(QIcon(":/images/zoom-in.png"),"", this);
    //openAct->setShortcut(tr("Ctrl+O"));
    connect(addTxtSizeAct, SIGNAL(triggered()), this, SLOT(addTxtSize()));

    subTxtSizeAct = new QAction(QIcon(":/images/zoom-out.png"),"", this);
    //openAct->setShortcut(tr("Ctrl+O"));
    connect(subTxtSizeAct, SIGNAL(triggered()), this, SLOT(subTxtSize()));

    setfontAct = new QAction(QIcon(":/images/setfont.png"),"", this);
    connect(setfontAct, SIGNAL(triggered()), this, SLOT(setfont()));

    setfontcolorAct = new QAction(QIcon(":/images/bgcolor.png"),"", this);
    connect(setfontcolorAct, SIGNAL(triggered()), this, SLOT(setfontcolor()));

    setbgcolorAct = new QAction(QIcon(":/images/bgcolor.png"),"", this);
    connect(setbgcolorAct, SIGNAL(triggered()), this, SLOT(setbgcolor()));

    setbgimageAct = new QAction(QIcon(":/images/bgimage.png"),"", this);
    connect(setbgimageAct, SIGNAL(triggered()), this, SLOT(setbgimage()));
    
    delbgimageAct = new QAction(QIcon(":/images/resetbg.png"),"", this);
    connect(delbgimageAct, SIGNAL(triggered()), this, SLOT(delbgimage()));

    codecActionGroup = new QActionGroup(this);
    connect(codecActionGroup, SIGNAL(triggered(QAction *)),
            this, SLOT(setcodecstr(QAction *)));
    GB2312Act = new QAction(tr("&GB2312"), this);
    GB2312Act->setData("GB2312");
    GB2312Act->setCheckable(true);
	codecActionGroup->addAction(GB2312Act);
	if (codecstr == "GB2312") GB2312Act->setChecked(true);

    UTF8Act = new QAction(tr("&UTF-8"), this);
    UTF8Act->setData("UTF-8");
    UTF8Act->setCheckable(true);
	codecActionGroup->addAction(UTF8Act);
	if (codecstr == "UTF-8") UTF8Act->setChecked(true);

    for (int i = 0; i < MaxRecentFiles; ++i) {
        recentFileActs[i] = new QAction(this);
        recentFileActs[i]->setVisible(false);
        connect(recentFileActs[i], SIGNAL(triggered()),
                this, SLOT(openRecentFile()));
    }

    //maximizeAction = new QAction(tr("Ma&ximize"), this);
    //connect(maximizeAction, SIGNAL(triggered()), this, SLOT(showMaximized()));
    
    viewfullscreenAction = new QAction(QIcon(":/images/fullscreen.png"),"", this);
    connect(viewfullscreenAction, SIGNAL(triggered()), this, SLOT(myshowfullscreen()));
    
    nofullscreenAction = new QAction(QIcon(":/images/nofullscreen.png"),"", this);
    connect(nofullscreenAction, SIGNAL(triggered()), this, SLOT(myexitfullscreen()));
    
    hiddenAction = new QAction(QIcon(":/images/min.png"),"", this);
    connect(hiddenAction, SIGNAL(triggered()), this, SLOT(myhide()));

    restoreAction = new QAction(QIcon(":/images/restore.png"),"", this);
    connect(restoreAction, SIGNAL(triggered()), this, SLOT(myrestore()));

    quitAction = new QAction(QIcon(":/images/exit.png"),"", this);
    //quitAction->setShortcut(tr("Ctrl+Q"));
    connect(quitAction, SIGNAL(triggered()), this, SLOT(quitaction()));

    aboutAct = new QAction(QIcon(":/images/about.png"),"", this);
    //aboutAct->setShortcut(tr("Ctrl+A"));
    //aboutAct->setStatusTip(tr("Show the application's About box"));
    connect(aboutAct, SIGNAL(triggered()), this, SLOT(about()));

    instructionAct = new QAction(QIcon(":/images/instruction.png"),"", this);
    //instructionAct->setShortcut(tr("Ctrl+A"));
    //instructionAct->setStatusTip(tr("Show the application's About box"));
    connect(instructionAct, SIGNAL(triggered()), this, SLOT(readOrInstruction()));
	return ;
}