예제 #1
0
void firmware() {
    display_init();
    gfx_init_ctxt(&gfx_ctxt, display_init_framebuffer(), 720, 1280, 768);
    gfx_clear_color(&gfx_ctxt, 0xFF000000);
    gfx_con_init(&gfx_con, &gfx_ctxt);
    gfx_con_setcol(&gfx_con, DEFAULT_TEXT_COL, 0, 0);

    while (!sdMount()) {
        error("Failed to init SD card!\n");
        print("Press POWER to power off, any other key to retry\n");
        if (btn_wait() & BTN_POWER)
            i2c_send_byte(I2C_5, 0x3C, MAX77620_REG_ONOFFCNFG1, MAX77620_ONOFFCNFG1_PWR_OFF);
        btn_wait();
    }
    
    if(PMC(APBDEV_PMC_SCRATCH49) != 69 && fopen("/ReiNX.bin", "rb")) {
        fread((void*)PAYLOAD_ADDR, fsize(), 1);
        fclose();
        sdUnmount();
        display_end();
        CLOCK(CLK_RST_CONTROLLER_CLK_OUT_ENB_V) |= 0x400; // Enable AHUB clock.
        CLOCK(CLK_RST_CONTROLLER_CLK_OUT_ENB_Y) |= 0x40;  // Enable APE clock.
        PMC(APBDEV_PMC_SCRATCH49) = 69;
        ((void (*)())PAYLOAD_ADDR)();
    }
    SYSREG(AHB_AHB_SPARE_REG) = (volatile vu32)0xFFFFFF9F;
	PMC(APBDEV_PMC_SCRATCH49) = 0;
    
    print("Welcome to ReiNX %s!\n", VERSION);
    loadFirm();
    drawSplash();
    launch();
}
예제 #2
0
// Read the header data
UInt16 ReadHeader(void) {
  UInt16 err;
  MemHandle headerMH = NULL;
  MemPtr    headerMP = NULL;
  headerdata* foo;

  err = false;

  headerMH = DmGetRecord(JMPalmPrefs, 0);
  
  if (headerMH != NULL)
    headerMP = MemHandleLock(headerMH);

  foo = (headerdata*)headerMP;

  // copy the object
  if (foo != NULL) {
    memcpy(&hd, foo, sizeof(headerdata));

    // Header version incompatible?
    if (hd.version <= INCOMPATIBILITY_LEVEL) { 
      FrmCustomAlert(ErrorMessageForm, "Installation error: You must"\
		     " delete old JMPalm versions before installing"\
		     " this version. Please delete and reinstall.",
		     0, 0);
      err = true;
    }
    else if (hd.version < CURRENT_SETTINGS_VERSION) {
      FrmCustomAlert(ErrorMessageForm, "New (incompatible) version of "\
		     "JMPalm installed, "\
		     "your settings are lost!", 0, 0);
      drawSplash();
      ResetHeader();
    }
  }

  if (headerMH != NULL) {
    MemHandleUnlock(headerMH);
    DmReleaseRecord(JMPalmPrefs, 0, true);
  }

  return err;
}
예제 #3
0
파일: game.c 프로젝트: dong-brian/2048Plus
/* 
 * Draw the splash screen and perform the appropriate logic.
 * Pressing Start begins the game.
 * Pressing Select opens the settings menu.
 * Pressing A opens the instructions.
 * 
 * @return  the button pressed to exit the splash screen
 */
int splash(int *seed) {
    int result = 0;
    waitForVblank();
    drawSplash();
    while (!KEY_DOWN_NOW(BUTTON_START) && !KEY_DOWN_NOW(BUTTON_A)
            && !KEY_DOWN_NOW(BUTTON_SELECT)) {
        (*seed)++;
    }
    if (KEY_DOWN_NOW(BUTTON_START)) {
        result = BUTTON_START;
    } else if (KEY_DOWN_NOW(BUTTON_A)) {
        result = BUTTON_A;
    } else if (KEY_DOWN_NOW(BUTTON_SELECT)) {
        result = BUTTON_SELECT;
    }
    while (KEY_DOWN_NOW(BUTTON_START) || KEY_DOWN_NOW(BUTTON_A)
            || KEY_DOWN_NOW(BUTTON_SELECT));
    return result;
}
예제 #4
0
void SplashScreen::draw()
{
	hkgDisplayContext* ctx = m_window->getContext();
	ctx->lock();

	ctx->setLightingState( false );

	// Adds a ref to m_splashTexture
	ctx->setCurrentSoleTexture( m_splashTexture, HKG_TEXTURE_MODULATE );

	hkgViewport* orthoView = m_window->getWindowOrthoView();
	orthoView->setAsCurrent(ctx);

	bool logoState = m_window->getWantDrawHavokLogo();
	m_window->setWantDrawHavokLogo(false);

	drawSplash();
	if (m_progressBarEnabled)
	{
		drawProgressBar();
	}


	float restoreBK[3];
	m_window->getClearColor(restoreBK);
	m_window->setClearColor(HKG_VEC3_ZERO);
	
	m_window->swapBuffers();
	m_window->clearBuffers();

	m_window->setClearColor(restoreBK);

	m_window->setWantDrawHavokLogo(logoState);

	// Removes a ref from m_splashTexture
	ctx->setCurrentSoleTexture(HK_NULL, HKG_TEXTURE_MODULATE);
	ctx->unlock();
}