Exemple #1
0
static void
glw_ps3_mainloop(glw_ps3_t *gp)
{
  int currentBuffer = 0;
  TRACE(TRACE_INFO, "GLW", "Entering mainloop");
#if 0
  int r = ioPadSetPortSetting(6, 0xffffffff);
  TRACE(TRACE_ERROR, "PS3PAD", "portsetting=0x%x", r);
#endif

  sysRegisterCallback(EVENT_SLOT0, eventHandle, gp);
  while(!gp->stop) {

    handle_pads(gp);
    handle_kb(gp);


    waitFlip();
    drawFrame(gp, currentBuffer, 1);
    flip(gp, currentBuffer);
    currentBuffer = !currentBuffer;
    sysCheckCallback();
  }
  waitFlip();
  drawFrame(gp, currentBuffer, 0);
  flip(gp, currentBuffer);
  currentBuffer = !currentBuffer;

  sysUnregisterCallback(EVENT_SLOT0);
}
Exemple #2
0
s32 main(s32 argc, const char* argv[])
{

	atexit(appCleanup);
	deadrsx_init();
	ioPadInit(7);
	sysRegisterCallback(EVENT_SLOT0, eventHandle, NULL);

	u32 *frag_mem = rsxMemAlign(256, 256);
	printf("frag_mem = 0x%08lx\n", (u64) frag_mem);
	realityInstallFragmentProgram_old(context, &nv30_fp, frag_mem);

        loading(); // where all the loading done xD

	long frame = 0; 

	while(1){
                ps3_pad(); // where all are controls are
		waitFlip(); // Wait for the last flip to finish, so we can draw to the old buffer
		drawFrame(currentBuffer, frame++); // Draw into the unused buffer
		flip(currentBuffer); // Flip buffer onto screen
		currentBuffer = !currentBuffer;
		sysCheckCallback();

	}
	
	return 0;
}
Exemple #3
0
static void
glw_ps3_mainloop(glw_ps3_t *gp)
{
  int currentBuffer = 0;
  TRACE(TRACE_DEBUG, "GLW", "Entering mainloop");



  sysRegisterCallback(EVENT_SLOT0, eventHandle, gp);
  while(gp->gp_stop != 10) {

    if(gp->gp_stop)
      gp->gp_stop++;

    handle_pads(gp);
    handle_kb(gp);

    waitFlip();
    drawFrame(gp, currentBuffer, 1);
    flip(gp, currentBuffer);
    currentBuffer = !currentBuffer;
    sysCheckCallback();
  }
  waitFlip();
  drawFrame(gp, currentBuffer, 0);
  flip(gp, currentBuffer);
  currentBuffer = !currentBuffer;

  sysUnregisterCallback(EVENT_SLOT0);
}
Exemple #4
0
s32 main(s32 argc, const char* argv[])
{
	PadInfo padinfo;
	PadData paddata;
	int i;
	
	atexit(appCleanup);
	init_screen();
	ioPadInit(7);
	sysRegisterCallback(EVENT_SLOT0, eventHandle, NULL);

	// Load texture
	dice = loadPng(dice_bin);
	assert(realityAddressToOffset(dice.data, &tx_offset) == 0);

	//load_acid_texture((uint8_t *)tx_mem, 0);

	// install fragment shader in rsx memory
	u32 *frag_mem = rsxMemAlign(256, 256);
	printf("frag_mem = 0x%08lx\n", (u64) frag_mem);
	realityInstallFragmentProgram_old(context, &nv30_fp, frag_mem);

	long frame = 0; // To keep track of how many frames we have rendered.
	
	// Ok, everything is setup. Now for the main loop.
	while(1){
		// Check the pads.
		ioPadGetInfo(&padinfo);
		for(i=0; i<MAX_PADS; i++){
			if(padinfo.status[i]){
				ioPadGetData(i, &paddata);
				
				if(paddata.BTN_CROSS || paddata.BTN_START){
					return 0;
				}
			}
			
		}

		waitFlip(); // Wait for the last flip to finish, so we can draw to the old buffer
		drawFrame(currentBuffer, frame++); // Draw into the unused buffer
		flip(currentBuffer); // Flip buffer onto screen
		currentBuffer = !currentBuffer;
		sysCheckCallback();

	}
	
	return 0;
}
Exemple #5
0
void showmessage(msgType type, const char* message)
{
    msgDialogOpen(type, message, handledialog, 0, NULL);

    dlg_action = 0;
    while(!dlg_action)
    {
        sysCheckCallback();

        flip(currentBuffer);
        waitFlip();
        currentBuffer = !currentBuffer;
    }

    msgDialogClose();
}
Exemple #6
0
unsigned ps3pad_read()
{
    int n;

    PadActParam actparam;

    unsigned butt = 0;

    pad_alive = 0;

    sysCheckCallback();

    ioPadGetInfo(&padinfo);

    for(n = 0; n < MAX_PADS; n++) {
            
        if(padinfo.status[n])  {
                    
            ioPadGetData(n, &paddata);
            pad_alive = 1;
            butt = (paddata.button[2] << 8) | (paddata.button[3] & 0xff);

            /* Analog stick management */
            if (paddata.button[6] < 0x10)
                butt |= BUTTON_LEFT;
            else if (paddata.button[6] > 0xe0)
                butt |= BUTTON_RIGHT;
            if (paddata.button[7] < 0x10)
                butt |= BUTTON_UP;
            else if (paddata.button[7] > 0xe0)
                butt |= BUTTON_DOWN;
            break;
        
        }
    }

		
    if(!pad_alive) butt = 0;
    else {
        actparam.small_motor = 0;
		actparam.large_motor = 0;
        
        if(rumble1_on) {
            
			actparam.large_motor = 255;
              
            rumble1_on++;
          
            if(rumble1_on > 15) rumble1_on = 0;
          
        }

        if(rumble2_on) {
           
            actparam.small_motor = 1;

            rumble2_on++;

            if(rumble2_on > 10) rumble2_on = 0;
        }

        last_rumble = n;

        ioPadSetActDirect(n, &actparam);
    }

    temp_pad = butt;

    new_pad = temp_pad & (~old_pad); old_pad = temp_pad;


return butt;
}
Exemple #7
0
void dialog()
{
    int response;
    u32 happypercent;
    u32 moneypercent;

// error code message

    msgDialogErrorCode(0xBEBACAFE, my_dialog, (void *) 0xEEEE0001, NULL);
    msgDialogDelayedClose(3000.0f); // 3 seconds

    dialog_action = 0;
    while(dialog_action!=-1)
		{
		sysCheckCallback();my_flip();
		}

    msgDialogClose();

// yes/no message

    msgType mdialogyesno = MSGDIALOG_NORMAL | MSGDIALOG_BUTTON_TYPE_YESNO | MSGDIALOG_DISABLE_CANCEL_ON | MSGDIALOG_DEFAULT_CURSOR_NO;

    msgDialogOpen2(mdialogyesno, "Hey!!\nYou are Happy?", my_dialog, (void *) 0x11110001, NULL);

    dialog_action = 0;
    while(!dialog_action)
		{
		sysCheckCallback();my_flip();
		}

    msgDialogClose();

    response = dialog_action;

// OK message

    msgType mdialogok = MSGDIALOG_NORMAL | MSGDIALOG_BUTTON_TYPE_OK;
    
    if(response == 1)
        msgDialogOpen2(mdialogok, "I'm glad you're happy :)\nMerry Christmas!!!", my_dialog, (void *) 0x22220001, NULL);
    else
        msgDialogOpen2(mdialogok, "Ok, but removes your vinegar face :p\nIt's Christmas!!!", my_dialog, (void *) 0x22220002, NULL);

    dialog_action = 0;
    while(!dialog_action)
		{
		sysCheckCallback();my_flip();
		}

    msgDialogClose();

// Single Progress bar 

    msgType mdialogprogress = MSGDIALOG_SINGLE_PROGRESSBAR;
    
    happypercent = 0;

    msgDialogOpen2(mdialogprogress, "Recharging happiness batteries...", my_dialog, (void *) 0x33330001, NULL);
    msgDialogProgressBarMessage(PROGRESSBAR_INDEX0, "You're Happy");
    msgDialogResetProgressBar(PROGRESSBAR_INDEX0);
   
    dialog_action = 0;
    while(!dialog_action)
		{
        msgDialogIncProgressBar(PROGRESSBAR_INDEX0, happypercent);
		sysCheckCallback();my_flip();
        if(happypercent < 100) happypercent++;
        usleep(100*1000);
		}

    msgDialogClose();

// Double Progress bar 

    mdialogprogress = MSGDIALOG_DOUBLE_PROGRESSBAR;
    
    moneypercent = 0;

    msgDialogOpen2(mdialogprogress, "Recharging Virtual money...", my_dialog, (void *) 0x33330002, NULL);
    msgDialogProgressBarMessage(PROGRESSBAR_INDEX0, "You're Happy");
    msgDialogResetProgressBar(PROGRESSBAR_INDEX0);
    msgDialogProgressBarMessage(PROGRESSBAR_INDEX1, "Virtual money");
    msgDialogResetProgressBar(PROGRESSBAR_INDEX1);
   
    dialog_action = 0;
    while(!dialog_action)
		{
        msgDialogIncProgressBar(PROGRESSBAR_INDEX0, happypercent);
        msgDialogIncProgressBar(PROGRESSBAR_INDEX1, moneypercent);
		sysCheckCallback();my_flip();
        if(happypercent < 100) happypercent++;
        if(moneypercent < 100) moneypercent++;
        usleep(100*1000);
		}

    msgDialogClose();

// OK with delay time 

    msgDialogOpen2(mdialogok, "Congratulations!!!\nYou are now happy and you have virtual money :p", my_dialog, (void *) 0x22220003, NULL);
    msgDialogDelayedClose(3000.0f); // 3 seconds

    dialog_action = 0;
    while(!dialog_action)
		{
		sysCheckCallback();my_flip();
		}

    msgDialogClose();

// OK with delay time 

    msgDialogOpen2(mdialogok, "Good bye!!", my_dialog, (void *) 0x22220004, NULL);
    msgDialogDelayedClose(2000.0f); // 2 seconds

    dialog_action = 0;
    while(!dialog_action)
		{
		sysCheckCallback();my_flip();
		}

     msgDialogClose();
    
}