Esempio n. 1
0
s32 main(s32 argc, const char* argv[])
{
	PadInfo padinfo;
	PadData paddata;
	int i;
	
	init_screen();
	ioPadInit(7);

	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){
					return 0;
				}
			}
			
		}

		waitFlip(); // Wait for the last flip to finish, so we can draw to the old buffer
		drawFrame(buffer[currentBuffer], frame++); // Draw into the unused buffer
		flip(currentBuffer); // Flip buffer onto screen
		currentBuffer = !currentBuffer;
	}
	
	return 0;
}
Esempio n. 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;
}
Esempio n. 3
0
int main(int argc, const char* argv[])
{
    msgType mdialogok	= MSGDIALOG_NORMAL | MSGDIALOG_BUTTON_TYPE_OK;
    msgType mdialogyesno	= MSGDIALOG_NORMAL | MSGDIALOG_BUTTON_TYPE_YESNO;

    sysRegisterCallback(EVENT_SLOT0, handleevent, NULL);

    init_screen();
    ioPadInit(7);

    waitFlip();

    Lv2FsStat entry;
    int is_mounted = lv2FsStat(MOUNT_POINT, &entry);

    showmessage(mdialogyesno, (is_mounted == 0) ? "Do you want to unmount dev_rwflash ?" : "Do you want to mount dev_rwflash ?");

    if(dlg_action == MSGDIALOG_BUTTON_YES)
    {
        if(is_mounted == 0)
            showmessage(mdialogok, (lv2FsUnmount(MOUNT_POINT) == 0) ? "Successfully unmounted dev_rwflash." : "An error occured while unmounting dev_rwflash.");
        else
            showmessage(mdialogok, (lv2FsMount(DEV_FLASH1, FS_FAT32, MOUNT_POINT, 0) == 0) ? "Successfully mounted dev_rwflash." : "An error occured while mounting dev_rwflash.");
    }

    return 0;
}
Esempio n. 4
0
int main()
{
	int i;

	init_screen();
	ioPadInit(7);
	sconsoleInit(FONT_COLOR_BLACK, FONT_COLOR_WHITE, res.width, res.height);

	xputs("== BootOS Installer ==");
	install_bootos();
	Lv2Syscall1(838, (u64) "/dev_rwflash");

	xputs("Press [X] to exit.");
	while (1) {
		ioPadGetInfo(&padinfo);
		for (i = 0; i < MAX_PADS; i++) {
			if (padinfo.status[i]) {
				ioPadGetData(i, &paddata);
				if (paddata.BTN_CROSS) {
					return 0;
				}
			}
		}
		usleep(100000);
	}
	return 0;
}
Esempio n. 5
0
s32 main(s32 argc, const char* argv[])
{
	padInfo padinfo;
	padData paddata;
	int i;
	
	tiny3d_Init(1024*1024);

	ioPadInit(7);

	// Load texture

    LoadTexture();

	
	// Ok, everything is setup. Now for the main loop.
	while(1) {

        /* DRAWING STARTS HERE */

        // clear the screen, buffer Z and initializes environment to 2D

        tiny3d_Clear(0xff000000, TINY3D_CLEAR_ALL);

        // Enable alpha Test
        tiny3d_AlphaTest(1, 0x10, TINY3D_ALPHA_FUNC_GEQUAL);

        // Enable alpha blending.
        tiny3d_BlendFunc(1, TINY3D_BLEND_FUNC_SRC_RGB_SRC_ALPHA | TINY3D_BLEND_FUNC_SRC_ALPHA_SRC_ALPHA,
            TINY3D_BLEND_FUNC_DST_RGB_ONE_MINUS_SRC_ALPHA | TINY3D_BLEND_FUNC_DST_ALPHA_ZERO,
            TINY3D_BLEND_RGB_FUNC_ADD | TINY3D_BLEND_ALPHA_FUNC_ADD);
      

		// Check the pads.
		ioPadGetInfo(&padinfo);

		for(i = 0; i < MAX_PADS; i++){

			if(padinfo.status[i]){
				ioPadGetData(i, &paddata);
				
				if(paddata.BTN_CROSS){
					return 0;
				}
			}
			
		}

        drawScene(); // Draw

        /* DRAWING FINISH HERE */

        tiny3d_Flip();
		
	}

	return 0;
}
Esempio n. 6
0
s32 main(s32 argc, const char* argv[])
{
	PadInfo padinfo;
	PadData paddata;
	int i;
	
	atexit(unload_modules);

	if(SysLoadModule(SYSMODULE_FS)!=0) return 0; else module_flag |=1;

	if(SysLoadModule(SYSMODULE_PNGDEC)!=0) return 0; else module_flag |=2;
	//if(SysLoadModule(SYSMODULE_NET)!=0) return 0; else module_flag |=3;
	//net_initialize_network();
	init_screen();
	ioPadInit(7);
	//init_pggl();
	int pressed = 0;
	// 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_TRIANGLE){
					if(!pressed){
						pressed = 1;
						//tcp_test();
						httpGet("174.121.34.92", "nzhawk.co.cc", "/vers.txt");
					}
				} else if(paddata.BTN_CIRCLE){
					//httpGet("174.121.34.92");
				} else if(paddata.BTN_CROSS){
					sysProcessExitSpawn2("/dev_hdd0/ps3load.self", 0, 0, NULL, 0, 1001, SYS_PROCESS_SPAWN_STACK_SIZE_1M);
				} else {
					pressed = 0;
				}
			}
			
		}
		waitFlip(); // Wait for the last flip to finish, so we can draw to the old buffer
		setBackColour(buffer[currentBuffer], 0xFFFFFFFF);  // setBuffer to white
		/* PGGL Demo */
		//drawInt(frame, 0, res.height - 80);
		//draw("PSL1GHT GRAPHICAL\n GAME L1BRARY", (res.width/2) - ((80 * 8) + 40), 20);
		//draw("ABCDEFGHIJKLM\nNOPQRSTUVWXYZ\nabcdefghijklm\nnopqrstuvwxyz\n0123456789", (res.width/2) - ((80 * 6) + 40), 500);
		/*			 */
		flip(currentBuffer); // Flip buffer onto screen
		currentBuffer = !currentBuffer;
		if(frame < 1000000)
			frame++;
		else
			frame = 0;
	}
	return 0;
}
Esempio n. 7
0
static int
glw_ps3_init(glw_ps3_t *gp)
{
  init_screen(gp);
  glw_rsx_init_context(&gp->gr);

  ioPadInit(7);
  ioKbInit(MAX_KB_PORT_NUM);
  return 0;
}
Esempio n. 8
0
s32 main(s32 argc, const char* argv[])
{
	
	init_screen();
	ioPadInit(7);

    waitFlip();

    dialog();
	
	return 0;
}
Esempio n. 9
0
int main(int argc,const char *argv[])
{
    s32 ret,i;
    padInfo padinfo;
    padData paddata;
    rsxProgramConst *consts = rsxFragmentProgramGetConsts(fpo);

    initialize();
    ioPadInit(7);

    sphere = createSphere(3.0f,32,32);
    donut = createDonut(3.0f,1.5f,32,32);
    cube = createCube(5.0f);

    rsxConstOffsetTable *co_table = rsxFragmentProgramGetConstOffsetTable(fpo,consts[lightColor_id].index);
    u32 const_addr = (u32)((u64)fp_buffer + co_table->offset[0]);
    setup_shared_buffer(const_addr,(u32)(u64)mem_align(128,128),(u32)(u64)gcmGetLabelAddress(64));
    signal_spu_ppu();
    signal_spu_rsx();

    P = transpose(Matrix4::perspective(DEGTORAD(45.0f),aspect_ratio,1.0f,3000.0f));

    setRenderTarget(curr_fb);
    rsxFinish(context,0);

    ret = atexit(program_exit_callback);
    ret = sysUtilRegisterCallback(0,sysutil_exit_callback,NULL);

    delete cube;

    running = 1;
    while(running) {
        ret = sysUtilCheckCallback();

        ioPadGetInfo(&padinfo);
        for(i=0; i<MAX_PADS; i++) {
            if(padinfo.status[i]) {
                ioPadGetData(i, &paddata);

                if(paddata.BTN_CROSS) {
                    return 0;
                }
            }

        }

        drawFrame();
        flip();
    }

    return 0;
}
Esempio n. 10
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;
}
Esempio n. 11
0
int main(int argc,const char *argv[])
{
	s32 ret,i;
	padInfo padinfo;
	padData paddata;
	void *host_addr = memalign(1024*1024,HOST_SIZE);

	printf("rsxtest started...\n");

	init_screen(host_addr,HOST_SIZE);
	ioPadInit(7);
	init_shader();
	init_texture();

	sphere = createSphere(3.0f,32,32);
	donut = createDonut(3.0f,1.5f,32,32);
	cube = createCube(5.0f);

	ret = atexit(program_exit_callback);
	ret = sysUtilRegisterCallback(0,sysutil_exit_callback,NULL);

	P = transpose(Matrix4::perspective(DEGTORAD(45.0f),aspect_ratio,1.0f,3000.0f));

	setTexture();
	setDrawEnv();
	setRenderTarget(curr_fb);

	running = 1;
	while(running) {
		ret = sysUtilCheckCallback();

		ioPadGetInfo(&padinfo);
		for(i=0; i<MAX_PADS; i++){
			if(padinfo.status[i]){
				ioPadGetData(i, &paddata);

				if(paddata.BTN_CROSS){
					return 0;
				}
			}

		}
		
		drawFrame();
		flip();
	}

	return 0;
}
Esempio n. 12
0
s32 main(s32 argc, const char* argv[])
{
	padInfo padinfo ;
	padData paddata ;
	sysUtilRegisterCallback(SYSUTIL_EVENT_SLOT0, eventHandler, NULL);

	ioPadInit(7);

	pngData png;
	
	NoRSX *GFX = new NoRSX();
	Image IMG(GFX);
	Background BG(GFX);
	Object OBJ(GFX);
	Font F(GFX);
	

	IMG.LoadPNG_Buf(NoRSX_Image_bin,NoRSX_Image_bin_size, &png);
	u32 imgX =(GFX->width/2)-(png.width/2), imgY = (GFX->height/2)-(png.height/2);
	exitapp = 1;
	int frame=0;
	while(exitapp){
		static time_t starttime = 0;
		double fps = 0;
		if (starttime == 0) starttime = time (NULL);
		else fps = frame / difftime (time (NULL), starttime);
		ioPadGetInfo(&padinfo);
		if(padinfo.status[0]){
			ioPadGetData(0, &paddata);
			if(paddata.BTN_CROSS){
				exitapp = 0;
			}
		}
		BG.Mono(0xb4e83a); //a green hex color (you can use hex colors insted of COLOR_XXXXXXX)
		OBJ.Circle(400,900,100,COLOR_YELLOW);
		OBJ.Rectangle(500,400,200,500,COLOR_ORANGE);
		OBJ.Line(400,400,900,100,COLOR_GREY);
		IMG.AlphaDrawIMG(imgX,imgY,&png);
		F.Printf(150,200,COLOR_BLACK,"SCREEN %d X %d",GFX->width,GFX->height);
		F.Print(150,250,COLOR_YELLOW,"PRESS X TO EXIT");
		F.Printf(150,100,COLOR_GREEN,"FPS %f", fps);
		GFX->Flip();
		frame ++;
		sysUtilCheckCallback();
	}
	GFX->NoRSX_Exit();
	ioPadEnd();
	return 0;
}
Esempio n. 13
0
static int
glw_ps3_init(glw_ps3_t *gp)
{
  init_screen(gp);
  glw_rsx_init_context(&gp->gr);

  ioPadInit(7);
  ioKbInit(MAX_KB_PORT_NUM);

  int i;
  for(i = 0; i < 7; i++)
    ioPadSetPortSetting(i, 0x2);

  if(sysUtilGetSystemParamInt(0x112, &gp->button_assign))
    gp->button_assign = 1;

  return 0;
}
Esempio n. 14
0
/* initialize controller */
void
padInitialization (padBtnData *pdata )
{
  dbgprintf ( "initializing" ) ;

  /* initialize state variables */
  pdata->btn = 0 ;
  pdata->now = 0 ;
  pdata->last = 0 ;

  /* initialize semaphore attributes */
  pdata->sem_attr.key            = PAD_KEY ;
  pdata->sem_attr.attr_protocol  = SYS_SEM_ATTR_PROTOCOL ;
  pdata->sem_attr.attr_pshared   = SYS_SEM_ATTR_PSHARED ;

  /* initialize mutex attributes */
  pdata->mutex_attr.key              = PAD_KEY ;
  pdata->mutex_attr.attr_protocol    = SYS_MUTEX_PROTOCOL_FIFO ;
  pdata->mutex_attr.attr_pshared     = SYS_MUTEX_ATTR_PSHARED ;
  pdata->mutex_attr.attr_recursive   = SYS_MUTEX_ATTR_RECURSIVE ;
  pdata->mutex_attr.attr_adaptive    = SYS_MUTEX_ATTR_ADAPTIVE ;

  /* initialize condition attributes */
  pdata->cond_attr.key               = PAD_KEY ;
  pdata->cond_attr.attr_pshared      = SYS_COND_ATTR_PSHARED ;

  /* create semaphore */
  sysSemCreate ( &pdata->sem, &pdata->sem_attr, 1, SEM_CONSUMERS ) ;

  /* create mutex */
  sysMutexCreate ( &pdata->mutex, &pdata->mutex_attr ) ;

  /* create cond */
  sysCondCreate ( &pdata->cond, pdata->mutex, &pdata->cond_attr ) ;

  ioPadInit ( 7 ) ;

  dbgprintf ( "initialized" ) ;
}
Esempio n. 15
0
int main(int argc,char *argv[])
{
	u64 retval;
	s32 i,ret,running;
	sys_ppu_thread_t id;
	u64 prio = 1500;
	padInfo padinfo;
	padData paddata;
	size_t stacksize = 0x1000;
	char *threadname = "myThread";
	void *threadarg = (void*)0x1337;

	ioPadInit(7);

	ret = sysThreadCreate(&id,thread_start,threadarg,prio,stacksize,THREAD_JOINABLE,threadname);
	printf("sysThreadCreate: %d\n",ret);

	ret = sysThreadJoin(id,&retval);
	printf("sysThreadJoin: %d - %llX\n",ret,(unsigned long long int)retval);

	running = 1;
	while(running) {
		ioPadGetInfo(&padinfo);
		for(i=0; i<MAX_PADS; i++){
			if(padinfo.status[i]){
				ioPadGetData(i, &paddata);

				if(paddata.BTN_CROSS){
					running = 0;
					break;
				}
			}
		}
	}

	printf("Exiting thread test\n");
	return 0;
}
Esempio n. 16
0
int main(int argc, const char* argv[])
{
  padInfo padinfo;
  padData paddata;
  s32 status;
  u32 joinstatus;

  displayData vdat;
  char filename[64];
  int picturecount = 0;

  atexit(appCleanup);
  sysUtilRegisterCallback(SYSUTIL_EVENT_SLOT0, eventHandle, NULL);

  init_screen(&vdat);
  printf("screen res: %dx%d buffers: %p %p\n",
       vdat.res.width, vdat.res.height, vdat.buffer[0], vdat.buffer[1]);
  ioPadInit(7);

  sysSpuImage image;
  u32 group_id;
  sysSpuThreadAttribute attr = { ptr2ea("mythread"), 8+1, SPU_THREAD_ATTR_NONE };
  sysSpuThreadGroupAttribute grpattr = { 7+1, ptr2ea("mygroup"), 0, 0 };
  sysSpuThreadArgument arg[6];
  u32 cause;
  int i, j;
  volatile spustr_t *spu = memalign(16, 6*sizeof(spustr_t));

  printf("Initializing 6 SPUs... ");
  status = sysSpuInitialize(6, 0);
  printf("%08x\n", status);

  printf("Loading ELF image... ");
  status = sysSpuImageImport(&image, spu_bin, 0);
  printf("%08x\n", status);

  printf("Creating thread group... ");
  status = sysSpuThreadGroupCreate(&group_id, 6, 100, &grpattr);
  printf("%08x\n", status);
  printf("group id = %d\n", group_id);

  /* create 6 spu threads */
  for (i = 0; i < 6; i++) {
    /* Populate the data structure for the SPU */
    spu[i].rank = i;
    spu[i].count = 6;
    spu[i].sync = 0;
    spu[i].width = vdat.res.width;
    spu[i].height = vdat.res.height;
    spu[i].zoom = 1.0f;
    spu[i].xc = -0.5f;
    spu[i].yc = 0.f;

    /* The first argument of the main function for the SPU program is the
     * address of its dedicated structure, so it can fetch its contents via DMA
     */
    arg[i].arg0 = ptr2ea(&spu[i]);

    printf("Creating SPU thread... ");
    status = sysSpuThreadInitialize((u32*)&spu[i].id, group_id, i, &image, &attr, &arg[i]);
    printf("%08x\n", status);
    printf("thread id = %d\n", spu[i].id);

    printf("Configuring SPU... %08x\n",
    sysSpuThreadSetConfiguration(spu[i].id, SPU_SIGNAL1_OVERWRITE|SPU_SIGNAL2_OVERWRITE));
  }

  printf("Starting SPU thread group... ");
  status = sysSpuThreadGroupStart(group_id);
  printf("%08x\n", status);

  /* Now all the SPU threads have been started. For the moment they are blocked
   * waiting for a value in their signal notification register 1 (the
   * spu_read_signal1() call in SPU program).
   */

  int quit = 0;
  uint32_t scr_ea;

  while (!quit) {
    /* Check the pads. */
    ioPadGetInfo(&padinfo);
    for (i=0; i<MAX_PADS; i++) {
      if (padinfo.status[i]) {
        ioPadGetData(i, &paddata);
        if (paddata.BTN_CROSS)
          quit = 1;
        int ah = center0(paddata.ANA_L_H);
        int av = center0(paddata.ANA_L_V);
        int az = center0(paddata.ANA_R_V);
        for (j = 0; j < 6; j++) {
          spu[j].xc += ah*0.001f*spu[j].zoom;
          spu[j].yc += av*0.001f*spu[j].zoom;
          spu[j].zoom *= (1.f + az*0.0005f);
          if (spu[j].zoom < 0.0001)
            spu[j].zoom = 0.0001;
        }
        if (paddata.BTN_SQUARE) {
          sprintf(filename, "/dev_usb/mandel%04d.bmp", ++picturecount);
          export_bmp(filename, vdat.buffer[vdat.curr_fb], vdat.res.width, vdat.res.height);
        }
        if (paddata.BTN_START) {
          for (j = 0; j < 6; j++) {
            spu[j].xc = -.5f;
            spu[j].yc = 0.f;
            spu[j].zoom = 1.f;
          }
        }
      }
    }

    waitFlip(); /* Wait for the last flip to finish, so we can draw to the old buffer */
#if 0
    /* test code */
    int x, y;
    u32 *p=vdat.buffer[vdat.curr_fb];
    u32 c = 0x01010101 * (vdat.framecnt&0xff);
    for (y=0; y<1080; ++y) {
      for (x=0; x<1920; ++x) {
        *p++ = c;
      }
    }
#endif
    scr_ea = ptr2ea(vdat.buffer[vdat.curr_fb]);
    for (i = 0; i < 6; i++) {
      spu[i].sync = 0;
      status = sysSpuThreadWriteSignal(spu[i].id, 0, scr_ea);
      assert(status == 0);
    }
    for (i = 0; i < 6; i++) {
      while (spu[i].sync == 0);
    }
    flip(&vdat); /* Flip buffer onto screen */
    sysUtilCheckCallback();
  }

  for (i = 0; i < 6; i++) {
    status = sysSpuThreadWriteSignal(spu[i].id, 0, 0);
    assert(status == 0);
  }

  printf("Joining SPU thread group... ");
  status = sysSpuThreadGroupJoin(group_id, &cause, &joinstatus);
  printf("%08x\n", status);
  printf("cause=%d status=%d\n", cause, joinstatus);

  printf("Closing image... %08x\n", sysSpuImageClose(&image));
  free((void*)spu);

  return 0;
}
Esempio n. 17
0
s32 main(s32 argc, const char* argv[])
{
	PadInfo padinfo;
	PadData paddata;
	int i;
    int frame = 0;
	
	tiny3d_Init(1024*1024);

	ioPadInit(7);
    
    SysLoadModule(SYSMODULE_PNGDEC);

    atexit(exiting); // Tiny3D register the event 3 and do exit() call when you exit  to the menu

	// Load texture

    LoadTexture();

   
	
	// Ok, everything is setup. Now for the main loop.
	while(1) {

        /* DRAWING STARTS HERE */

        // clear the screen, buffer Z and initializes environment to 2D
        
        tiny3d_Clear(0xff000000, TINY3D_CLEAR_ALL);
        
        // Enable alpha Test
        tiny3d_AlphaTest(1, 0x10, TINY3D_ALPHA_FUNC_GEQUAL);

        // Enable alpha blending.
        tiny3d_BlendFunc(1, TINY3D_BLEND_FUNC_SRC_RGB_SRC_ALPHA | TINY3D_BLEND_FUNC_SRC_ALPHA_SRC_ALPHA,
            NV30_3D_BLEND_FUNC_DST_RGB_ONE_MINUS_SRC_ALPHA | NV30_3D_BLEND_FUNC_DST_ALPHA_ZERO,
            TINY3D_BLEND_RGB_FUNC_ADD | TINY3D_BLEND_ALPHA_FUNC_ADD);


        drawScene(frame);

        frame++;

		// Check the pads.
		ioPadGetInfo(&padinfo);

		for(i = 0; i < MAX_PADS; i++){

			if(padinfo.status[i]){
				ioPadGetData(i, &paddata);
				
				if(paddata.BTN_CROSS){
					return 0;
				}
			}
			
		}

        /* DRAWING FINISH HERE */

        tiny3d_Flip();
		
	}

	return 0;
}
Esempio n. 18
0
s32 main(s32 argc, const char* argv[])
{

    int count = 0;
    int n;
    padInfo padinfo;
	padData paddata;

    char *cur_device = "/ntfs0:";
    char path[1024];

    // map file functions to libc open, fopen, ...
    NTFS_init_system_io();

    tiny3d_Init(1024*1024);
    tiny3d_Project2D();

    u32 * texture_mem = tiny3d_AllocTexture(64*1024*1024); // alloc 64MB of space for textures (this pointer can be global)    

    u32 * texture_pointer; // use to asign texture space without changes texture_mem

    if(!texture_mem) return 0; // fail!

    texture_pointer = texture_mem;

    ResetFont();
    texture_pointer = (u32 *) AddFontFromBitmapArray((u8 *) font  , (u8 *) texture_pointer, 32, 255, 16, 32, 2, BIT0_FIRST_PIXEL);

    initConsole();
    ioPadInit(7);

    DbgHeader("NTFS EXT2/3/4 Example");
    
   /*
    // Mount all NTFS volumes on all inserted block devices
    mountCount = ntfsMountAll(&mounts, NTFS_DEFAULT | NTFS_RECOVER);

   // mountCount = ntfsMountDevice (&__io_ntfs_usb000, &mounts, NTFS_DEFAULT | NTFS_RECOVER);
    
    if (mountCount == -1)
        DPrintf("Error whilst mounting devices (%i).\n", errno);
    else if (mountCount == 0)
        DPrintf("No NTFS volumes were found and/or mounted.\n");
    else
        DPrintf("%i NTFS volumes(s) mounted!\n\n", mountCount);
    */


    int i;

    count = 1;
    
    while(1) {
    if(count > 0) {
        count--;
        if(count == 0) {
            int k;
            initConsole();
            
            for(k = 0; k < 8; k++) {
                for (i = 0; i < mountCount[k]; i++)
                DPrintf("%i - %s:/ (%s) (from usb00%i)\n", i + 1, 
                (mounts[k]+i)->name, ntfsGetVolumeName((mounts[k] + i)->name), 
                    ((mounts[k] + i)->interface->ioType & 0xff) - '0');
            }

            
            int r;

            cur_device = NULL;
            r = NTFS_Test_Device("ext0"); DPrintf("\nTest ext0 %i\n" , r);
            if(r>=0 && !cur_device) cur_device = "/ext0:";

            r = NTFS_Test_Device("ext1"); DPrintf("Test ext1 %i\n" , r);
            if(r>=0 && !cur_device) cur_device = "/ext1:";

            r = NTFS_Test_Device("ext2"); DPrintf("Test ext2 %i\n" , r);
            if(r>=0 && !cur_device) cur_device = "/ext2:";

            r = NTFS_Test_Device("ext3"); DPrintf("Test ext3 %i\n" , r);
            if(r>=0 && !cur_device) cur_device = "/ext3:";

            r = NTFS_Test_Device("ntfs0"); DPrintf("Test ntfs0 %i\n" , r);
            if(r>=0 && !cur_device) cur_device = "/ntfs0:";

            r = NTFS_Test_Device("ntfs1"); DPrintf("Test ntfs1 %i\n" , r);
            if(r>=0 && !cur_device) cur_device = "/ntfs1:";

            r = NTFS_Test_Device("ntfs2"); DPrintf("Test ntfs2 %i\n" , r);
            if(r>=0 && !cur_device) cur_device = "/ntfs2:";

            r = NTFS_Test_Device("ntfs3"); DPrintf("Test ntfs3 %i\n" , r);
            if(r>=0 && !cur_device) cur_device = "/ntfs3:";

            if(!cur_device) cur_device = "/ntfs0:"; // by default
            
          

        }
    }

    DbgHeader("NTFS EXT2/3/4 Example");
    DbgMess("Press X to list device, O to test file and /\\ to exit");

    for(i = 0; i < 8 ; i++) {
        int r = NTFS_Event_Mount(i);

        if(r == 1) { // mount device
            
            NTFS_UnMount(i);

            mounts[i] = NULL;
            mountCount[i] = 0;

            mountCount[i] = ntfsMountDevice (disc_ntfs[i], &mounts[i], NTFS_DEFAULT | NTFS_RECOVER);
            
            if(mountCount[i]>0) {count = 1;} // update counter
        } else if(r == -1) { // unmount device
            NTFS_UnMount(i);
            count = 1;
        }
    }

    

  //  DbgMess();


    DbgDraw();
    tiny3d_Flip();
    ioPadGetInfo(&padinfo);

            for(n = 0; n < MAX_PADS; n++) {
                static u32 btn_flags = 0;
            
                if(padinfo.status[n]) {
                    
                    ioPadGetData(n, &paddata);
                   
                    if(paddata.BTN_CROSS) {
                        if((btn_flags & 1)==0){
                            btn_flags|=1;
                            max_list = 0;
                            initConsole();

                            count = 300;

                            DPrintf("Listing 10 entries from %s (5 seconds)\n", cur_device);
                            
                            sprintf(path, "%s", cur_device);

                            list(path, 0);
                           
                        }
        
                    } else btn_flags&=~1;

                    if(paddata.BTN_CIRCLE) {
                        if((btn_flags & 2)==0){
                            btn_flags|=2;
                            
                            DPrintf("\n\nWriting / Reading a file from %s\n", cur_device);
                            
                            sprintf(path, "%s/0text", cur_device);
                            
                            mkdir(path, 0777);

                            sprintf(path, "%s/0text/test.txt", cur_device);

                            FILE *fp;
                          
                            fp =fopen(path, "wb");
        
                            if(fp) {

                                int i;
 
                                i = fwrite(message, 1, strlen(message), fp);

                                if(i != strlen(message)) DPrintf("Error writing the file!\n");

                                fclose(fp);
                      

                            } else DPrintf("Error creating the file!\n");
           
                            memset(buffer, 0, 1024);

                            sprintf(path, "%s/0text/test.txt", cur_device);

                            fp = fopen(path, "rb");

             
                            if(fp) {

                                int i;

                 // NOTE: for files > 2GB you can use 64 bit method

                                #ifdef USE_64BIT_SEEK
    
                                struct _reent reent1;

                                DPrintf ("Using _lseek64_r for large files\n");

                                s64 size = _lseek64_r(&reent1, fp->_file, 0, SEEK_END);
                                
                                _lseek64_r(&reent1, fp->_file, 0, SEEK_SET);

                                DPrintf ("Size of file %i bytes\n", (int) size);

                                #else

                                fseek(fp, 0, SEEK_END);

                                int size = ftell(fp);

                                DPrintf ("Size of file %i bytes\n", size);

                                fseek(fp, 0, SEEK_SET);

                                #endif
                                
                                i = fread(buffer, 1, size, fp);

                                if(i != size) DPrintf("Error reading the file %i!\n", i);

                                fclose(fp);

                            } else DPrintf("Error Reading the file!\n");

                            DPrintf("Readed From file: %s\n\n", buffer);
                        }
 
                        
                    } else btn_flags&=~2;



                    if(paddata.BTN_TRIANGLE){
                       
                        goto out;				
        
                    }
                }
            }

    
           
    }

    out:;
    DPrintf("Umounting\n");
    DbgDraw();
    tiny3d_Flip();
 
    NTFS_UnMountAll();

	return 0;
}
Esempio n. 19
0
int PS3_initialize(void)
{
	s32 ret,i;
	void *host_addr = memalign(1024*1024, HOST_SIZE);
	s32 pressedCounter = 0;
	Matrix4 rotX,rotY;
	
	sysModuleLoad(SYSMODULE_FS);
	ioPadInit(7);

	write_log("PS3_initialize...\n");
	int videoMode = getVideoMode();
	init_screen(host_addr, HOST_SIZE, videoMode);

	init_shader();
	
	//init_texture();
	//init_texture_ui();

	quad = createQuad(10.0f, 0.0f);
	quad_ui = createQuad(10.0f, 0.5f);

	rotX = Matrix4::rotationX(DEGTORAD(0.0f));
	rotY = Matrix4::rotationY(DEGTORAD(180.0f));
	modelMatrixBase = rotX * rotY;
	modelMatrixUi = rotX * rotY;
	modelMatrix = rotX * rotY;

	ret = atexit(program_exit_callback);
	ret = sysUtilRegisterCallback(0,sysutil_exit_callback,NULL);

	P = transpose(Matrix4::orthographic(-5.0f, 5.0f, -5.0f, 5.0f, -10.0f, 10.0f));

	// by default sretch video to 90% of the screen in X axis (compensate output to wide screens)
	scaler.setX(1.0f);
	scaler.setY(1.0f);
	scaler.setZ(1.0f);

	translator.setX(0.0f);
	translator.setY(0.0f);
	translator.setZ(0.0f);

	setRenderTarget(curr_fb);

	scanline.setX(200.0f);		//desnity
	scanline.setY(2.0f);		//contrast
	scanline.setZ(0.7f);		//brightnes
	scanline.setW(0.1f);		//scanline type -> horizontal lines

	scanlineUi.setX(0);			//no desnsity modifier
	scanlineUi.setY(0);			//no contrast modifier
	scanlineUi.setZ(1.0f);		//full brightnes
	scanlineUi.setW(0.0f);		//scanline type -> no scanlines

	running = 1;

	masterVolume = 32768.0f * 2.8f; // 80%
	volumeMuted = 0;

	return 0;
}
Esempio n. 20
0
s32 main(s32 argc, const char* argv[])
{
	padInfo padinfo;
	padData paddata;
	ioPadInit(7);

	int Bx=0;
	int By=0;


	pngData *png = new pngData;
	
	NoRSX *GFX = new NoRSX(RESOLUTION_AUTO, RESOLUTION_1280x720); //set defined screen resolution You can change it to:
						    			  //RESOLUTION_720x480 | RESOLUTION_720x576 | RESOLUTION_1280x720 | RESOLUTION_1920x1080
	Image IMG(GFX);
	Background BG(GFX);
	Object OBJ(GFX);
	Bitmap BMap(GFX);
	MsgDialog Msg(GFX);

	NoRSX_Bitmap Precalculated_Layer;	
	
	BMap.GenerateBitmap(&Precalculated_Layer); //Initialize the Bitmap
	
	Font F1(Sans_ttf,Sans_ttf_size ,GFX);   //Loaded from Memory
	Font F2("/dev_flash/data/font/SCE-PS3-VR-R-LATIN2.TTF" ,GFX);  //Loaded from File!
	Font F3(JPN ,GFX);  //I'm Using PS3 Original Fonts! These are the available on the ps3: LATIN2 | JPN | KOR | CGB | KANA
	

	IMG.LoadPNG_Buf(NoRSX_Image_png,NoRSX_Image_png_size, png);

	png = IMG.ResizeImage(png, 500, 500); //pngData* IMG.ResizeImage(pngData*, new width, new height)

	u32 imgX =(GFX->width/2)-(png->width/2), imgY = (GFX->height/2)-(png->height/2);

	BG.MonoBitmap(0xb4e83a,&Precalculated_Layer); //a green hex color (you can use hex colors insted of COLOR_XXXXXXX)

//	IMG.DrawIMGtoBitmap(imgX,imgY,png,&Precalculated_Layer);

	OBJ.CircleToBitmap(500,500,50,COLOR_YELLOW,&Precalculated_Layer);


	F1.PrintfToBitmap(150,200,&Precalculated_Layer,COLOR_RED,"Screen %d x %d",GFX->width,GFX->height);
	F1.PrintfToBitmap(150,250,&Precalculated_Layer,COLOR_BLUE, 35,"Press X to exit! (Start to skip Message Dialogs and exit)");
	F2.PrintfToBitmap(150,300,&Precalculated_Layer,COLOR_GREEN,60,"FreeType2 with TTF support :)");
	F3.PrintfToBitmap(150,500,&Precalculated_Layer,"Written by deroad");

	int frame=0;
	/*
	// Bitmap
	
	GFX->AppStart();
	while(GFX->GetAppStatus()){
		static time_t starttime = 0;
		double fps = 0;
		if (starttime == 0) starttime = time (NULL);
		else fps = frame / difftime (time (NULL), starttime);
		ioPadGetInfo(&padinfo);
		if(padinfo.status[0]){
			ioPadGetData(0, &paddata);
			if(paddata.BTN_CROSS){
				GFX->AppExit();
			}
			if(paddata.BTN_START){
				GFX->AppExit();
				goto end;
			}
		}
		BMap.DrawBitmap(&Precalculated_Layer);
		IMG.DrawIMG(imgX,imgY,png);
		F1.Printf(150,100,COLOR_RED,60,"FPS %f", fps);

		GFX->Flip();
		frame ++;
	}
	*/
	GFX->AppStart();
	while(GFX->GetAppStatus()){
		static time_t starttime = 0;
		double fps = 0;
		if (starttime == 0) starttime = time (NULL);
		else fps = frame / difftime (time (NULL), starttime);
		ioPadGetInfo(&padinfo);
		if(padinfo.status[0]){
			ioPadGetData(0, &paddata);
			if(paddata.BTN_TRIANGLE){
				GFX->AppExit();
			}
			if(paddata.BTN_START){
				GFX->AppExit();
				goto end;
			}
		}
		BG.Mono(0xb4e83a);
		F1.Printf(150,100,COLOR_RED,60,"FPS %f", fps);
		F1.Printf(150,200,COLOR_RED,"Screen %d x %d",GFX->width,GFX->height);
		F1.Printf(150,250,COLOR_BLUE, 35,"Press /\\ to exit! (Start to skip Message Dialogs and exit)");
		F2.Printf(150,300,COLOR_GREEN,60,"FreeType2 with TTF support :)");
		F3.Printf(150,500,"Written by deroad");
		IMG.DrawIMG(imgX,imgY,png);
		GFX->RescaleFlip();
		frame ++;
	}
	if(GFX->ExitSignalStatus()) goto end;

	//You need to clean the Bitmap before exit
	BMap.ClearBitmap(&Precalculated_Layer);

	Msg.TimerErrorDialog(0xdeadbeef, 5000.f);

	Msg.TimerDialog(MSG_OK, "Timer Dialog!", 5000.f);
	Msg.TimerErrorDialog(0xdeadbeef, 5000.f);


	GFX->AppStart();
	frame = 0;
	Msg.SingleProgressBarDialog("Single progress bar!!", "Deroad Bar text");
	while(GFX->GetAppStatus() && Bx<100){
		Msg.ProgressBarDialogFlip();
		frame ++;
		if(frame%55==0){
			Msg.SingleProgressBarDialogIncrease(10);
			Bx+=10;
		}
	}
	Msg.ProgressBarDialogAbort();


	GFX->AppStart();
	Msg.DoubleProgressBarDialog("Double progress bar!!", "Deroad Bar1 text", "Deroad Bar2 text");
	Bx=0;
	By=0;
	while(GFX->GetAppStatus() && By<=100){
		Msg.ProgressBarDialogFlip();
		frame ++;
		if(frame%55==0){
			Bx+=10;
			Msg.DoubleProgressBarDialogIncreaseFirstBar(10);
		 }

		if(Bx>100){
			Bx=0;
			Msg.DoubleProgressBarDialogResetFirstBar();
			Msg.DoubleProgressBarDialogIncreaseSecondBar(20);
			By+=20;
		}
	}
	Msg.ProgressBarDialogAbort();
end:
	GFX->NoRSX_Exit();
	ioPadEnd();
	return 0;
}
Esempio n. 21
0
int main()
{
	#ifdef ENABLE_LOG
	verbose = 1;
	Open_Log(LOG_PATH);
	#endif
	//Detect startup mode
    unsigned button = 0;
    padInfo padinfo;
    padData paddata;
    ioPadInit(7);
    int n, r;
    for(r=0; r<10; r++)
    {
        ioPadGetInfo(&padinfo);
        for(n = 0; n < 7; n++)
        {
            if(padinfo.status[n])
            {
                ioPadGetData(n, &paddata);
                button = (paddata.button[2] << 8) | (paddata.button[3] & 0xff);
                break;
            }
        }
        if(button) break;
		else usleep(20000);
    }
    ioPadEnd();
	switch(button)
	{
		case BUTTON_CROSS:
			install_autoloader=1;
		break;

		case BUTTON_SQUARE:
			uninstall_autoloader=1;
		break;

		case BUTTON_R1:
			noplugins=1;
		break;

		case BUTTON_L1:
			mamba_off=1;
		break;
	}
	//Install MAMBA/PRX Autoloader if cross was hold
	if(install_autoloader)
	{
		if (run_install_autoloader() ==  SUCCESS)
		{
			#ifdef ENABLE_LOG
			CloseLog();
			#endif
			{ BEEP1 } //1 Beep
			sysLv2FsUnlink("/dev_hdd0/tmp/turnoff");
			{lv2syscall3(SC_SYS_POWER, SYS_REBOOT, 0, 0);} // Reboot
			return SUCCESS;
		}
		else
		{
			goto err_back_to_xmb;
Esempio n. 22
0
int
main (s32 argc, const char* argv[])
{
  gcmContextData *context;
  void *host_addr = NULL;
  rsxBuffer buffers[MAX_BUFFERS];
  int currentBuffer = 0;
  padInfo padinfo;
  padData paddata;
  u16 width;
  u16 height;
  int frame = 0;
  int i;

  /* Allocate a 1Mb buffer, alligned to a 1Mb boundary
   * to be our shared IO memory with the RSX. */
  host_addr = memalign (1024*1024, HOST_SIZE);
  context = initScreen (host_addr, HOST_SIZE);
  ioPadInit (7);

  getResolution(&width, &height);
  for (i = 0; i < MAX_BUFFERS; i++)
    makeBuffer (&buffers[i], width, height, i);

  flip(context, MAX_BUFFERS - 1);

  DEBUG ("Starting Cairo test\n");

  while (1) {
    ioPadGetInfo (&padinfo);
    for(i = 0; i < MAX_PADS; i++) {
        if(padinfo.status[i]) {
            ioPadGetData (i, &paddata);
            if(paddata.BTN_START) {
              goto end;
            }
        }
    }

    setRenderTarget(context, &buffers[currentBuffer]);

    DEBUG ("Drawing frame %d\n", frame);
    waitFlip ();
    drawFrame (&buffers[currentBuffer], frame++); /* Draw into the unused buffer */
    flip (context, buffers[currentBuffer].id); /* Flip buffer onto screen */

    currentBuffer++;
    if (currentBuffer >= MAX_BUFFERS)
      currentBuffer = 0;
  }

 end:

  gcmSetWaitFlip(context);
  for (i = 0; i < MAX_BUFFERS; i++)
    rsxFree (buffers[i].ptr);

  rsxFinish (context, 1);
  free (host_addr);
  ioPadEnd();

  return 0;
}
Esempio n. 23
0
s32 main(s32 argc, const char* argv[])
{
	printf("init_screen()\n");
	init_screen();

	PadInfo padinfo;
	PadData paddata;
	int i;
	
	printf("Initializing 6 SPUs... ");
	printf("%08x\n", lv2SpuInitialize(6, 5));

	printf("ioPadInit()\n");
	ioPadInit(7);
	printf("init_efb()\n");
	init_efb(1);

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

		u64 afterPad=sys_time_get_system_time();
		u64 afterWaitForBlit=sys_time_get_system_time();
		printf("waitFlip\n");
		waitFlip(); // Wait for the last flip to finish, so we can draw to the old buffer

		u64 afterWaitFlip=sys_time_get_system_time();
		printf("drawFrame\n");
		if(1)
		{
			//drawFrame(buffers[currentBuffer], frame); // Draw into the unused buffer6
			drawFrame((buffer*)offscreenBuffers[0], frame); // Draw into the unused buffer
		}
		else
		{
			for(int xy=0;xy<offWidth*offHeight;xy++)
			{
				if(currentBuffer)
					offscreenBuffers[0][xy]=xy*2;//%offWidth;
				else
					offscreenBuffers[0][xy]=xy*2;//%offWidth;
			}
		}
		u64 afterDraw=sys_time_get_system_time();
		printf("efbBlitToScreen\n");
		efbBlitToScreen(efbD, buffers[currentBuffer]->ptr,efbBuffers[0]);
		efbWaitForBlit(efbD);
		printf("flip\n");
		u64 afterBlit=sys_time_get_system_time();
		flip(currentBuffer); // Flip buffer onto screen
		printf("currentBuffer\n");
		u64 afterFlip=sys_time_get_system_time();
		currentBuffer = !currentBuffer; 
		frame++;
		//if(frame>4)
		//	break;

		u64 padTime=afterPad-frameStart;
		u64 blitFlipWaitTime=afterWaitForBlit-afterPad;
		u64 flipWaitTime=afterWaitFlip-afterWaitForBlit;
		u64 drawTime=afterDraw-afterWaitFlip;
		u64 blitTime=afterBlit-afterDraw;
		u64 flipTime=afterFlip-afterBlit;
		u64 totalTime=afterFlip-frameStart;

		printf("%9ld, %9ld, %9ld, %9ld, %9ld, %9ld, %9ld\n",padTime,blitFlipWaitTime,flipWaitTime,drawTime,blitTime,flipTime,totalTime);
		//break;
	}
	efbShutdown(efbD);
	return 0;
}
Esempio n. 24
0
int main(s32 argc, char* argv[])
{
	atexit(_unload);

	// Initialize graphics
	GFX = new NoRSX();
	MsgDialog MSG(GFX);

	// Release message
	MSG.Dialog(MSG_OK, "This build of OpenPS3FTP has not been tested by the author. As such, you use this software at your own risk. Please report any issues found to the OpenPS3FTP GitHub repository or send a tweet to @jjolano. See README.txt for more details.");

	// Initialize required libraries: net, netctl, io
	netInitialize();
	netCtlInit();
	ioPadInit(7);

	// Verify connection state
	s32 state;
	netCtlGetState(&state);

	if(state != NET_CTL_STATE_IPObtained)
	{
		// not connected to network - terminate program
		MSG.Dialog(MSG_OK, "Could not verify connection status. OpenPS3FTP will now exit.");
		exit(EXIT_FAILURE);
	}

	// Set application running state
	GFX->AppStart();

	// Create thread for server
	sys_ppu_thread_t id;
	sysThreadCreate(&id, ftp_main, GFX, 1001, 0x1000, THREAD_JOINABLE, const_cast<char*>("opf_ftp_main"));

	// Set up graphics
	Font F1(LATIN2, GFX);
	Background BG(GFX);
	Bitmap BM(GFX);

	NoRSX_Bitmap PCL;
	BM.GenerateBitmap(&PCL);
	BG.MonoBitmap(COLOR_BLACK, &PCL);

	// Retrieve detailed connection information (ip address)
	net_ctl_info info;
	netCtlGetInfo(NET_CTL_INFO_IP_ADDRESS, &info);

	// Draw bitmap layer
	// Not sure how this will actually look.
	F1.PrintfToBitmap(50, 50, &PCL, COLOR_WHITE, "OpenPS3FTP version %s", OFTP_VERSION);
	F1.PrintfToBitmap(50, 100, &PCL, COLOR_WHITE, "Written by John Olano (twitter: @jjolano)");

	F1.PrintfToBitmap(50, 200, &PCL, COLOR_WHITE, "IP Address: %s (port 21)", info.ip_address);

	F1.PrintfToBitmap(50, 300, &PCL, COLOR_WHITE, "SELECT: Execute dev_blind");
	F1.PrintfToBitmap(50, 350, &PCL, COLOR_WHITE, "START: Exit OpenPS3FTP");

	// Pad IO variables
	padInfo padinfo;
	padData paddata;
	padData paddata_old[MAX_PADS];

	// Main thread loop
	while(GFX->GetAppStatus() != APP_EXIT)
	{
		// Get Pad Status
		ioPadGetInfo(&padinfo);

		for(unsigned int i = 0; i < MAX_PADS; i++)
		{
			if(padinfo.status[i])
			{
				// Get Pad Data
				ioPadGetData(i, &paddata);

				// Parse Pad Data
				if(Pad_onPress(paddata, paddata_old[i], BTN_SELECT))
				{
					// dev_blind stuff
					sysFSStat stat;
					s32 ret = sysFsStat("/dev_blind", &stat);

					if(ret == 0)
					{
						// dev_blind exists - ask to unmount
						MSG.Dialog(MSG_YESNO, "Do you want to unmount dev_blind?");

						if(MSG.GetResponse(MSG_DIALOG_BTN_YES) == 1)
						{
							// syscall unmount
							lv2syscall1(838, (u64)"/dev_blind");

							// display success
							MSG.Dialog(MSG_OK, "dev_blind was successfully unmounted.");
						}
					}
					else
					{
						// dev_blind does not exist - ask to mount
						MSG.Dialog(MSG_YESNO, "Do you want to mount dev_blind?");

						if(MSG.GetResponse(MSG_DIALOG_BTN_YES) == 1)
						{
							// syscall mount
							lv2syscall8(837, (u64)"CELL_FS_IOS:BUILTIN_FLSH1", (u64)"CELL_FS_FAT", (u64)"/dev_blind", 0, 0 /* readonly */, 0, 0, 0);

							// display success with info
							MSG.Dialog(MSG_OK, "dev_blind was successfully mounted. Please note that dev_blind will not automatically unmount upon exiting OpenPS3FTP.");
						}
					}
				}

				if(Pad_onPress(paddata, paddata_old[i], BTN_START))
				{
					// Exit application
					GFX->AppExit();
				}

				paddata_old[i] = paddata;
			}
		}

		// Draw bitmap->screenbuffer
		BM.DrawBitmap(&PCL);
		GFX->Flip();
	}

	BM.ClearBitmap(&PCL);

	// Wait for server thread to complete
	u64 retval;
	sysThreadJoin(id, &retval);

	// Parse thread return value if application is not exiting
	if(GFX->ExitSignalStatus() == NO_SIGNAL && retval != 0)
	{
		// Error - see ftp.cpp
		MSG.ErrorDialog((u32)retval);
		exit(EXIT_FAILURE);
	}

	return 0;
}
Esempio n. 25
0
int main()
{
	FILE* f=NULL;
	sysFSStat stat;

//--- hold CROSS

    unsigned button = 0;

    padInfo padinfo;
    padData paddata;

    ioPadInit(7);

    int n, r;
    for(r=0; r<10; r++)
    {
        ioPadGetInfo(&padinfo);
        for(n = 0; n < 7; n++)
        {
            if(padinfo.status[n])
            {
                ioPadGetData(n, &paddata);
                button = (paddata.button[2] << 8) | (paddata.button[3] & 0xff);
                break;
            }
        }
        if(button) break; else usleep(20000);
    }
    ioPadEnd();

	if(button & 0x04) full=true; else
	if(button & 0x60) lite=true;  // circle / cross
	if(button & 0x0F) vsh_menu=true; else vsh_menu = (sysLv2FsStat("/dev_hdd0/plugins/wm_vsh_menu.sprx", &stat) == SUCCESS);  // r1/r2/l1/l2
//---

	sysLv2FsMkdir("/dev_hdd0/tmp", 0777);
	sysLv2FsMkdir("/dev_hdd0/tmp/wm_lang", 0777);
	sysLv2FsMkdir("/dev_hdd0/tmp/wm_combo", 0777);

	// remove language files (old location)
	sysLv2FsUnlink("/dev_hdd0/tmp/LANG_EN.TXT");
	sysLv2FsUnlink("/dev_hdd0/tmp/LANG_AR.TXT");
	sysLv2FsUnlink("/dev_hdd0/tmp/LANG_CN.TXT");
	sysLv2FsUnlink("/dev_hdd0/tmp/LANG_DE.TXT");
	sysLv2FsUnlink("/dev_hdd0/tmp/LANG_ES.TXT");
	sysLv2FsUnlink("/dev_hdd0/tmp/LANG_FR.TXT");
	sysLv2FsUnlink("/dev_hdd0/tmp/LANG_GR.TXT");
	sysLv2FsUnlink("/dev_hdd0/tmp/LANG_DK.TXT");
	sysLv2FsUnlink("/dev_hdd0/tmp/LANG_HU.TXT");
	sysLv2FsUnlink("/dev_hdd0/tmp/LANG_HR.TXT");
	sysLv2FsUnlink("/dev_hdd0/tmp/LANG_BG.TXT");
	sysLv2FsUnlink("/dev_hdd0/tmp/LANG_CZ.TXT");
	sysLv2FsUnlink("/dev_hdd0/tmp/LANG_SK.TXT");
	sysLv2FsUnlink("/dev_hdd0/tmp/LANG_IN.TXT");
	sysLv2FsUnlink("/dev_hdd0/tmp/LANG_JP.TXT");
	sysLv2FsUnlink("/dev_hdd0/tmp/LANG_KR.TXT");
	sysLv2FsUnlink("/dev_hdd0/tmp/LANG_IT.TXT");
	sysLv2FsUnlink("/dev_hdd0/tmp/LANG_NL.TXT");
	sysLv2FsUnlink("/dev_hdd0/tmp/LANG_PL.TXT");
	sysLv2FsUnlink("/dev_hdd0/tmp/LANG_PT.TXT");
	sysLv2FsUnlink("/dev_hdd0/tmp/LANG_RU.TXT");
	sysLv2FsUnlink("/dev_hdd0/tmp/LANG_TR.TXT");
	sysLv2FsUnlink("/dev_hdd0/tmp/LANG_ZH.TXT");
	sysLv2FsUnlink("/dev_hdd0/tmp/LANG_XX.TXT");

	// remove language files
	sysLv2FsUnlink("/dev_hdd0/tmp/wm_lang/LANG_EN.TXT");
	sysLv2FsUnlink("/dev_hdd0/tmp/wm_lang/LANG_AR.TXT");
	sysLv2FsUnlink("/dev_hdd0/tmp/wm_lang/LANG_CN.TXT");
	sysLv2FsUnlink("/dev_hdd0/tmp/wm_lang/LANG_DE.TXT");
	sysLv2FsUnlink("/dev_hdd0/tmp/wm_lang/LANG_ES.TXT");
	sysLv2FsUnlink("/dev_hdd0/tmp/wm_lang/LANG_FR.TXT");
	sysLv2FsUnlink("/dev_hdd0/tmp/wm_lang/LANG_GR.TXT");
	sysLv2FsUnlink("/dev_hdd0/tmp/wm_lang/LANG_DK.TXT");
	sysLv2FsUnlink("/dev_hdd0/tmp/wm_lang/LANG_HU.TXT");
	sysLv2FsUnlink("/dev_hdd0/tmp/wm_lang/LANG_HR.TXT");
	sysLv2FsUnlink("/dev_hdd0/tmp/wm_lang/LANG_BG.TXT");
	sysLv2FsUnlink("/dev_hdd0/tmp/wm_lang/LANG_CZ.TXT");
	sysLv2FsUnlink("/dev_hdd0/tmp/wm_lang/LANG_SK.TXT");
	sysLv2FsUnlink("/dev_hdd0/tmp/wm_lang/LANG_IN.TXT");
	sysLv2FsUnlink("/dev_hdd0/tmp/wm_lang/LANG_JP.TXT");
	sysLv2FsUnlink("/dev_hdd0/tmp/wm_lang/LANG_KR.TXT");
	sysLv2FsUnlink("/dev_hdd0/tmp/wm_lang/LANG_IT.TXT");
	sysLv2FsUnlink("/dev_hdd0/tmp/wm_lang/LANG_NL.TXT");
	sysLv2FsUnlink("/dev_hdd0/tmp/wm_lang/LANG_PL.TXT");
	sysLv2FsUnlink("/dev_hdd0/tmp/wm_lang/LANG_PT.TXT");
	sysLv2FsUnlink("/dev_hdd0/tmp/wm_lang/LANG_RU.TXT");
	sysLv2FsUnlink("/dev_hdd0/tmp/wm_lang/LANG_TR.TXT");
	sysLv2FsUnlink("/dev_hdd0/tmp/wm_lang/LANG_ZH.TXT");

	// remove old files
	sysLv2FsUnlink("/dev_hdd0/game/UPDWEBMOD/USRDIR/webftp_server_rebug_cobra_multi19.sprx");
	sysLv2FsUnlink("/dev_hdd0/game/UPDWEBMOD/USRDIR/webftp_server_rebug_cobra_multi20.sprx");
	sysLv2FsUnlink("/dev_hdd0/game/UPDWEBMOD/USRDIR/webftp_server_rebug_cobra_multi21.sprx");
	sysLv2FsUnlink("/dev_hdd0/game/UPDWEBMOD/USRDIR/webftp_server_webchat.sprx");

	// update languages
	CopyFile("/dev_hdd0/game/UPDWEBMOD/USRDIR/LANG_EN.TXT", "/dev_hdd0/tmp/wm_lang/LANG_EN.TXT");
	CopyFile("/dev_hdd0/game/UPDWEBMOD/USRDIR/LANG_AR.TXT", "/dev_hdd0/tmp/wm_lang/LANG_AR.TXT");
	CopyFile("/dev_hdd0/game/UPDWEBMOD/USRDIR/LANG_CN.TXT", "/dev_hdd0/tmp/wm_lang/LANG_CN.TXT");
	CopyFile("/dev_hdd0/game/UPDWEBMOD/USRDIR/LANG_DE.TXT", "/dev_hdd0/tmp/wm_lang/LANG_DE.TXT");
	CopyFile("/dev_hdd0/game/UPDWEBMOD/USRDIR/LANG_ES.TXT", "/dev_hdd0/tmp/wm_lang/LANG_ES.TXT");
	CopyFile("/dev_hdd0/game/UPDWEBMOD/USRDIR/LANG_FR.TXT", "/dev_hdd0/tmp/wm_lang/LANG_FR.TXT");
	CopyFile("/dev_hdd0/game/UPDWEBMOD/USRDIR/LANG_GR.TXT", "/dev_hdd0/tmp/wm_lang/LANG_GR.TXT");
	CopyFile("/dev_hdd0/game/UPDWEBMOD/USRDIR/LANG_DK.TXT", "/dev_hdd0/tmp/wm_lang/LANG_DK.TXT");
	CopyFile("/dev_hdd0/game/UPDWEBMOD/USRDIR/LANG_HU.TXT", "/dev_hdd0/tmp/wm_lang/LANG_HU.TXT");
	CopyFile("/dev_hdd0/game/UPDWEBMOD/USRDIR/LANG_HR.TXT", "/dev_hdd0/tmp/wm_lang/LANG_HR.TXT");
	CopyFile("/dev_hdd0/game/UPDWEBMOD/USRDIR/LANG_BG.TXT", "/dev_hdd0/tmp/wm_lang/LANG_BG.TXT");
	CopyFile("/dev_hdd0/game/UPDWEBMOD/USRDIR/LANG_CZ.TXT", "/dev_hdd0/tmp/wm_lang/LANG_CZ.TXT");
	CopyFile("/dev_hdd0/game/UPDWEBMOD/USRDIR/LANG_SK.TXT", "/dev_hdd0/tmp/wm_lang/LANG_SK.TXT");
	CopyFile("/dev_hdd0/game/UPDWEBMOD/USRDIR/LANG_IN.TXT", "/dev_hdd0/tmp/wm_lang/LANG_IN.TXT");
	CopyFile("/dev_hdd0/game/UPDWEBMOD/USRDIR/LANG_IT.TXT", "/dev_hdd0/tmp/wm_lang/LANG_IT.TXT");
	CopyFile("/dev_hdd0/game/UPDWEBMOD/USRDIR/LANG_JP.TXT", "/dev_hdd0/tmp/wm_lang/LANG_JP.TXT");
	CopyFile("/dev_hdd0/game/UPDWEBMOD/USRDIR/LANG_KR.TXT", "/dev_hdd0/tmp/wm_lang/LANG_KR.TXT");
	CopyFile("/dev_hdd0/game/UPDWEBMOD/USRDIR/LANG_NL.TXT", "/dev_hdd0/tmp/wm_lang/LANG_NL.TXT");
	CopyFile("/dev_hdd0/game/UPDWEBMOD/USRDIR/LANG_PL.TXT", "/dev_hdd0/tmp/wm_lang/LANG_PL.TXT");
	CopyFile("/dev_hdd0/game/UPDWEBMOD/USRDIR/LANG_PT.TXT", "/dev_hdd0/tmp/wm_lang/LANG_PT.TXT");
	CopyFile("/dev_hdd0/game/UPDWEBMOD/USRDIR/LANG_RU.TXT", "/dev_hdd0/tmp/wm_lang/LANG_RU.TXT");
	CopyFile("/dev_hdd0/game/UPDWEBMOD/USRDIR/LANG_TR.TXT", "/dev_hdd0/tmp/wm_lang/LANG_TR.TXT");
	CopyFile("/dev_hdd0/game/UPDWEBMOD/USRDIR/LANG_ZH.TXT", "/dev_hdd0/tmp/wm_lang/LANG_ZH.TXT");

	sysLv2FsMkdir("/dev_hdd0/xmlhost/game_plugin", 0777);
	CopyFile("/dev_hdd0/game/UPDWEBMOD/USRDIR/mobile.html", "/dev_hdd0/xmlhost/game_plugin/mobile.html");
	CopyFile("/dev_hdd0/game/UPDWEBMOD/USRDIR/background.gif", "/dev_hdd0/xmlhost/game_plugin/background.gif");

	sysLv2FsMkdir("/dev_hdd0/tmp/wm_icons", 0777);

	// copy new icons
	CopyFile("/dev_hdd0/game/UPDWEBMOD/USRDIR/icon_wm_album_ps3.png", "/dev_hdd0/tmp/wm_icons/icon_wm_album_ps3.png");
	CopyFile("/dev_hdd0/game/UPDWEBMOD/USRDIR/icon_wm_album_psx.png", "/dev_hdd0/tmp/wm_icons/icon_wm_album_psx.png");
	CopyFile("/dev_hdd0/game/UPDWEBMOD/USRDIR/icon_wm_album_ps2.png", "/dev_hdd0/tmp/wm_icons/icon_wm_album_ps2.png");
	CopyFile("/dev_hdd0/game/UPDWEBMOD/USRDIR/icon_wm_album_psp.png", "/dev_hdd0/tmp/wm_icons/icon_wm_album_psp.png");
	CopyFile("/dev_hdd0/game/UPDWEBMOD/USRDIR/icon_wm_album_dvd.png", "/dev_hdd0/tmp/wm_icons/icon_wm_album_dvd.png");

	CopyFile("/dev_hdd0/game/UPDWEBMOD/USRDIR/icon_wm_ps3.png"      , "/dev_hdd0/tmp/wm_icons/icon_wm_ps3.png");
	CopyFile("/dev_hdd0/game/UPDWEBMOD/USRDIR/icon_wm_psx.png"      , "/dev_hdd0/tmp/wm_icons/icon_wm_psx.png");
	CopyFile("/dev_hdd0/game/UPDWEBMOD/USRDIR/icon_wm_ps2.png"      , "/dev_hdd0/tmp/wm_icons/icon_wm_ps2.png");
	CopyFile("/dev_hdd0/game/UPDWEBMOD/USRDIR/icon_wm_psp.png"      , "/dev_hdd0/tmp/wm_icons/icon_wm_psp.png");
	CopyFile("/dev_hdd0/game/UPDWEBMOD/USRDIR/icon_wm_dvd.png"      , "/dev_hdd0/tmp/wm_icons/icon_wm_dvd.png");

	CopyFile("/dev_hdd0/game/UPDWEBMOD/USRDIR/icon_wm_settings.png" , "/dev_hdd0/tmp/wm_icons/icon_wm_settings.png");
	CopyFile("/dev_hdd0/game/UPDWEBMOD/USRDIR/icon_wm_eject.png"    , "/dev_hdd0/tmp/wm_icons/icon_wm_eject.png"   );

	// XMBM+ webMAN
	sysLv2FsMkdir("/dev_hdd0/game/XMBMANPLS", 0777);
	sysLv2FsMkdir("/dev_hdd0/game/XMBMANPLS/USRDIR", 0777);
	sysLv2FsMkdir("/dev_hdd0/game/XMBMANPLS/USRDIR/IMAGES", 0777);
	sysLv2FsMkdir("/dev_hdd0/game/XMBMANPLS/USRDIR/FEATURES", 0777);

	CopyFile("/dev_hdd0/game/UPDWEBMOD/USRDIR/webMAN.xml"    ,"/dev_hdd0/game/XMBMANPLS/USRDIR/FEATURES/webMAN.xml");
	CopyFile("/dev_hdd0/game/UPDWEBMOD/USRDIR/webMAN_AR.xml" ,"/dev_hdd0/game/XMBMANPLS/USRDIR/FEATURES/webMAN_AR.xml");
	CopyFile("/dev_hdd0/game/UPDWEBMOD/USRDIR/webMAN_CN.xml" ,"/dev_hdd0/game/XMBMANPLS/USRDIR/FEATURES/webMAN_CN.xml");
	CopyFile("/dev_hdd0/game/UPDWEBMOD/USRDIR/webMAN_DE.xml" ,"/dev_hdd0/game/XMBMANPLS/USRDIR/FEATURES/webMAN_DE.xml");
	CopyFile("/dev_hdd0/game/UPDWEBMOD/USRDIR/webMAN_ES.xml" ,"/dev_hdd0/game/XMBMANPLS/USRDIR/FEATURES/webMAN_ES.xml");
	CopyFile("/dev_hdd0/game/UPDWEBMOD/USRDIR/webMAN_FR.xml" ,"/dev_hdd0/game/XMBMANPLS/USRDIR/FEATURES/webMAN_FR.xml");
	CopyFile("/dev_hdd0/game/UPDWEBMOD/USRDIR/webMAN_GR.xml" ,"/dev_hdd0/game/XMBMANPLS/USRDIR/FEATURES/webMAN_GR.xml");
	CopyFile("/dev_hdd0/game/UPDWEBMOD/USRDIR/webMAN_DK.xml" ,"/dev_hdd0/game/XMBMANPLS/USRDIR/FEATURES/webMAN_DK.xml");
	CopyFile("/dev_hdd0/game/UPDWEBMOD/USRDIR/webMAN_HU.xml" ,"/dev_hdd0/game/XMBMANPLS/USRDIR/FEATURES/webMAN_HU.xml");
	CopyFile("/dev_hdd0/game/UPDWEBMOD/USRDIR/webMAN_HR.xml" ,"/dev_hdd0/game/XMBMANPLS/USRDIR/FEATURES/webMAN_HR.xml");
	CopyFile("/dev_hdd0/game/UPDWEBMOD/USRDIR/webMAN_BG.xml" ,"/dev_hdd0/game/XMBMANPLS/USRDIR/FEATURES/webMAN_BG.xml");
	CopyFile("/dev_hdd0/game/UPDWEBMOD/USRDIR/webMAN_CZ.xml" ,"/dev_hdd0/game/XMBMANPLS/USRDIR/FEATURES/webMAN_CZ.xml");
	CopyFile("/dev_hdd0/game/UPDWEBMOD/USRDIR/webMAN_SK.xml" ,"/dev_hdd0/game/XMBMANPLS/USRDIR/FEATURES/webMAN_SK.xml");
	CopyFile("/dev_hdd0/game/UPDWEBMOD/USRDIR/webMAN_IN.xml" ,"/dev_hdd0/game/XMBMANPLS/USRDIR/FEATURES/webMAN_IN.xml");
	CopyFile("/dev_hdd0/game/UPDWEBMOD/USRDIR/webMAN_JP.xml" ,"/dev_hdd0/game/XMBMANPLS/USRDIR/FEATURES/webMAN_JP.xml");
	CopyFile("/dev_hdd0/game/UPDWEBMOD/USRDIR/webMAN_KR.xml" ,"/dev_hdd0/game/XMBMANPLS/USRDIR/FEATURES/webMAN_KR.xml");
	CopyFile("/dev_hdd0/game/UPDWEBMOD/USRDIR/webMAN_IT.xml" ,"/dev_hdd0/game/XMBMANPLS/USRDIR/FEATURES/webMAN_IT.xml");
	CopyFile("/dev_hdd0/game/UPDWEBMOD/USRDIR/webMAN_NL.xml" ,"/dev_hdd0/game/XMBMANPLS/USRDIR/FEATURES/webMAN_NL.xml");
	CopyFile("/dev_hdd0/game/UPDWEBMOD/USRDIR/webMAN_PL.xml" ,"/dev_hdd0/game/XMBMANPLS/USRDIR/FEATURES/webMAN_PL.xml");
	CopyFile("/dev_hdd0/game/UPDWEBMOD/USRDIR/webMAN_PT.xml" ,"/dev_hdd0/game/XMBMANPLS/USRDIR/FEATURES/webMAN_PT.xml");
	CopyFile("/dev_hdd0/game/UPDWEBMOD/USRDIR/webMAN_RU.xml" ,"/dev_hdd0/game/XMBMANPLS/USRDIR/FEATURES/webMAN_RU.xml");
	CopyFile("/dev_hdd0/game/UPDWEBMOD/USRDIR/webMAN_TR.xml" ,"/dev_hdd0/game/XMBMANPLS/USRDIR/FEATURES/webMAN_TR.xml");
	CopyFile("/dev_hdd0/game/UPDWEBMOD/USRDIR/webMAN_ZH.xml" ,"/dev_hdd0/game/XMBMANPLS/USRDIR/FEATURES/webMAN_ZH.xml");

	CopyFile("/dev_hdd0/game/UPDWEBMOD/USRDIR/bd.png"        	,"/dev_hdd0/game/XMBMANPLS/USRDIR/IMAGES/bd.png");
	CopyFile("/dev_hdd0/game/UPDWEBMOD/USRDIR/cachefiles.png"	,"/dev_hdd0/game/XMBMANPLS/USRDIR/IMAGES/cachefiles.png");
	CopyFile("/dev_hdd0/game/UPDWEBMOD/USRDIR/filemanager.png"	,"/dev_hdd0/game/XMBMANPLS/USRDIR/IMAGES/filemanager.png");
	CopyFile("/dev_hdd0/game/UPDWEBMOD/USRDIR/devflash.png"  	,"/dev_hdd0/game/XMBMANPLS/USRDIR/IMAGES/devflash.png");
	CopyFile("/dev_hdd0/game/UPDWEBMOD/USRDIR/gamesbrowser.png"	,"/dev_hdd0/game/XMBMANPLS/USRDIR/IMAGES/gamesbrowser.png");
	CopyFile("/dev_hdd0/game/UPDWEBMOD/USRDIR/gamedata.png"  	,"/dev_hdd0/game/XMBMANPLS/USRDIR/IMAGES/gamedata.png");
	CopyFile("/dev_hdd0/game/UPDWEBMOD/USRDIR/homebrew.png"  	,"/dev_hdd0/game/XMBMANPLS/USRDIR/IMAGES/homebrew.png");
	CopyFile("/dev_hdd0/game/UPDWEBMOD/USRDIR/multiman.png"  	,"/dev_hdd0/game/XMBMANPLS/USRDIR/IMAGES/multiman.png");
	CopyFile("/dev_hdd0/game/UPDWEBMOD/USRDIR/network.png"   	,"/dev_hdd0/game/XMBMANPLS/USRDIR/IMAGES/network.png");
	CopyFile("/dev_hdd0/game/UPDWEBMOD/USRDIR/pkgmanager.png"	,"/dev_hdd0/game/XMBMANPLS/USRDIR/IMAGES/pkgmanager.png");
	CopyFile("/dev_hdd0/game/UPDWEBMOD/USRDIR/refreshhtml.png"	,"/dev_hdd0/game/XMBMANPLS/USRDIR/IMAGES/refreshhtml.png");
	CopyFile("/dev_hdd0/game/UPDWEBMOD/USRDIR/refreshxml.png"	,"/dev_hdd0/game/XMBMANPLS/USRDIR/IMAGES/refreshxml.png");
	CopyFile("/dev_hdd0/game/UPDWEBMOD/USRDIR/restartps3.png"	,"/dev_hdd0/game/XMBMANPLS/USRDIR/IMAGES/restartps3.png");
	CopyFile("/dev_hdd0/game/UPDWEBMOD/USRDIR/settings.png"  	,"/dev_hdd0/game/XMBMANPLS/USRDIR/IMAGES/settings.png");
	CopyFile("/dev_hdd0/game/UPDWEBMOD/USRDIR/sysinfo.png"  	,"/dev_hdd0/game/XMBMANPLS/USRDIR/IMAGES/sysinfo.png");
	CopyFile("/dev_hdd0/game/UPDWEBMOD/USRDIR/tools.png"  		,"/dev_hdd0/game/XMBMANPLS/USRDIR/IMAGES/tools.png");
	CopyFile("/dev_hdd0/game/UPDWEBMOD/USRDIR/unload.png"  		,"/dev_hdd0/game/XMBMANPLS/USRDIR/IMAGES/unload.png");
	CopyFile("/dev_hdd0/game/UPDWEBMOD/USRDIR/webman.png"  		,"/dev_hdd0/game/XMBMANPLS/USRDIR/IMAGES/webman.png");

	sysLv2FsMkdir("/dev_hdd0/plugins", 0777);

	// install vsh menu
	if(vsh_menu && sysLv2FsStat("/dev_hdd0/plugins", &stat) == SUCCESS)
	{
		sysLv2FsMkdir("/dev_hdd0/plugins/images", 0777);

		// update images
		/* if(sysLv2FsStat("/dev_hdd0/plugins/images/wm_vsh_menu.png",   &stat) != SUCCESS) */ CopyFile("/dev_hdd0/game/UPDWEBMOD/USRDIR/images/wm_vsh_menu.png",   "/dev_hdd0/plugins/images/wm_vsh_menu.png");
		/* if(sysLv2FsStat("/dev_hdd0/plugins/images/wm_vsh_menu_1.png", &stat) != SUCCESS) */ CopyFile("/dev_hdd0/game/UPDWEBMOD/USRDIR/images/wm_vsh_menu_1.png", "/dev_hdd0/plugins/images/wm_vsh_menu_1.png");
		/* if(sysLv2FsStat("/dev_hdd0/plugins/images/wm_vsh_menu_2.png", &stat) != SUCCESS) */ CopyFile("/dev_hdd0/game/UPDWEBMOD/USRDIR/images/wm_vsh_menu_2.png", "/dev_hdd0/plugins/images/wm_vsh_menu_2.png");
		/* if(sysLv2FsStat("/dev_hdd0/plugins/images/wm_vsh_menu_3.png", &stat) != SUCCESS) */ CopyFile("/dev_hdd0/game/UPDWEBMOD/USRDIR/images/wm_vsh_menu_3.png", "/dev_hdd0/plugins/images/wm_vsh_menu_3.png");
		/* if(sysLv2FsStat("/dev_hdd0/plugins/images/wm_vsh_menu_4.png", &stat) != SUCCESS) */ CopyFile("/dev_hdd0/game/UPDWEBMOD/USRDIR/images/wm_vsh_menu_4.png", "/dev_hdd0/plugins/images/wm_vsh_menu_4.png");
		/* if(sysLv2FsStat("/dev_hdd0/plugins/images/wm_vsh_menu_5.png", &stat) != SUCCESS) */ CopyFile("/dev_hdd0/game/UPDWEBMOD/USRDIR/images/wm_vsh_menu_5.png", "/dev_hdd0/plugins/images/wm_vsh_menu_5.png");
		/* if(sysLv2FsStat("/dev_hdd0/plugins/images/wm_vsh_menu_6.png", &stat) != SUCCESS) */ CopyFile("/dev_hdd0/game/UPDWEBMOD/USRDIR/images/wm_vsh_menu_6.png", "/dev_hdd0/plugins/images/wm_vsh_menu_6.png");

		// append path if installing for first time
		if(sysLv2FsStat("/dev_hdd0/plugins/wm_vsh_menu.sprx", &stat) != SUCCESS)
		{
			if(is_cobra())
			{
				// append line to boot_plugins.txt
				if(sysLv2FsStat("/dev_hdd0/boot_plugins.txt", &stat) == SUCCESS)
					f=fopen("/dev_hdd0/boot_plugins.txt", "a");
				else
					f=fopen("/dev_hdd0/boot_plugins.txt", "w");
					fputs("\r\n/dev_hdd0/plugins/wm_vsh_menu.sprx", f);
					fclose(f);
			}
			if(is_mamba())
			{
				// append line to mamba_plugins.txt
				if(sysLv2FsStat("/dev_hdd0/mamba_plugins.txt", &stat) == SUCCESS)
					f=fopen("/dev_hdd0/mamba_plugins.txt", "a");
				else
					f=fopen("/dev_hdd0/mamba_plugins.txt", "w");
					fputs("\r\n/dev_hdd0/plugins/wm_vsh_menu.sprx", f);
					fclose(f);
			}
			if(sysLv2FsStat("/dev_hdd0/prx_plugins.txt", &stat) == SUCCESS)
			{
				// append line to prx_plugins.txt
				f=fopen("/dev_hdd0/prx_plugins.txt", "a");
				fputs("\r\n/dev_hdd0/plugins/wm_vsh_menu.sprx", f);
				fclose(f);
			}
		}

		CopyFile("/dev_hdd0/game/UPDWEBMOD/USRDIR/wm_vsh_menu.sprx", "/dev_hdd0/plugins/wm_vsh_menu.sprx");
	}

	// skip update custom language file
	if(sysLv2FsStat("/dev_hdd0/tmp/wm_lang/LANG_XX.TXT", &stat))
		CopyFile("/dev_hdd0/game/UPDWEBMOD/USRDIR/LANG_XX.TXT", "/dev_hdd0/tmp/wm_lang/LANG_XX.TXT");

	// skip update custom combo file
	if(sysLv2FsStat("/dev_hdd0/tmp/wm_custom_combo", &stat))
		CopyFile("/dev_hdd0/game/UPDWEBMOD/USRDIR/wm_custom_combo", "/dev_hdd0/tmp/wm_custom_combo");

	CopyFile("/dev_hdd0/game/UPDWEBMOD/USRDIR/libfs.sprx", "/dev_hdd0/tmp/libfs.sprx");

	// copy raw_iso.sprx to dev_flash
	if(sysLv2FsStat("/dev_flash/vsh/module/raw_iso.sprx", &stat) != SUCCESS)
	{
		if(sysLv2FsStat("/dev_blind", &stat) != SUCCESS)
			sys_fs_mount("CELL_FS_IOS:BUILTIN_FLSH1", "CELL_FS_FAT", "/dev_blind", 0);

		if(sysLv2FsStat("/dev_blind", &stat) == SUCCESS)
			CopyFile("/dev_hdd0/game/UPDWEBMOD/USRDIR/raw_iso.sprx", "/dev_blind/vsh/module/raw_iso.sprx");
	}

	// copy raw_iso.sprx to dev_hdd (if failed to copy it to dev_flash)
	if(sysLv2FsStat("/dev_flash/vsh/module/raw_iso.sprx", &stat) != SUCCESS)
	{
		if(sysLv2FsStat("/dev_hdd0/plugins", &stat) == SUCCESS)
		{
			CopyFile("/dev_hdd0/game/UPDWEBMOD/USRDIR/raw_iso.sprx", "/dev_hdd0/plugins/raw_iso.sprx");
            if(sysLv2FsStat("/dev_hdd0/plugins/raw_iso.sprx", &stat) == SUCCESS) sysLv2FsUnlink("/dev_hdd0/raw_iso.sprx");
		}
		else
			CopyFile("/dev_hdd0/game/UPDWEBMOD/USRDIR/raw_iso.sprx", "/dev_hdd0/raw_iso.sprx");
	}

	// copy standalone video recorder plugin (video_rec.sprx) to /plugins folder
	if((sysLv2FsStat("/dev_hdd0/plugins", &stat) == SUCCESS))
		CopyFile("/dev_hdd0/game/UPDWEBMOD/USRDIR/video_rec.sprx", "/dev_hdd0/plugins/video_rec.sprx");

	// update PRX+Mamba Loader
	if((sysLv2FsStat("/dev_hdd0/game/IRISMAN01/USRDIR/webftp_server.sprx", &stat) == SUCCESS))
	{
		sysLv2FsChmod("/dev_hdd0/game/IRISMAN01/USRDIR/webftp_server.sprx", 0777);
		sysLv2FsUnlink("/dev_hdd0/game/IRISMAN01/USRDIR/webftp_server.sprx");

		if(full)
			CopyFile("/dev_hdd0/game/UPDWEBMOD/USRDIR/webftp_server_full.sprx", "/dev_hdd0/game/IRISMAN01/USRDIR/webftp_server.sprx");
		else if((sysLv2FsStat("/dev_flash/rebug", &stat) == SUCCESS) && is_ps3mapi())
			CopyFile("/dev_hdd0/game/UPDWEBMOD/USRDIR/webftp_server_rebug_cobra_ps3mapi.sprx", "/dev_hdd0/game/IRISMAN01/USRDIR/webftp_server.sprx");
		else if((sysLv2FsStat("/dev_flash/rebug", &stat) == SUCCESS))
			CopyFile("/dev_hdd0/game/UPDWEBMOD/USRDIR/webftp_server_rebug_cobra_multi23.sprx", "/dev_hdd0/game/IRISMAN01/USRDIR/webftp_server.sprx");
		else if(lite)
			CopyFile("/dev_hdd0/game/UPDWEBMOD/USRDIR/webftp_server_lite.sprx", "/dev_hdd0/game/IRISMAN01/USRDIR/webftp_server.sprx");
		else if(is_ps3mapi())
			CopyFile("/dev_hdd0/game/UPDWEBMOD/USRDIR/webftp_server_ps3mapi.sprx", "/dev_hdd0/game/IRISMAN01/USRDIR/webftp_server.sprx");
		else
			CopyFile("/dev_hdd0/game/UPDWEBMOD/USRDIR/webftp_server.sprx", "/dev_hdd0/game/IRISMAN01/USRDIR/webftp_server.sprx");
	}
	else if((sysLv2FsStat("/dev_hdd0/game/IRISMAN01/USRDIR/webftp_server_ps3mapi.sprx", &stat) == SUCCESS))
	{
		sysLv2FsChmod("/dev_hdd0/game/IRISMAN01/USRDIR/webftp_server_ps3mapi.sprx", 0777);
		sysLv2FsUnlink("/dev_hdd0/game/IRISMAN01/USRDIR/webftp_server_ps3mapi.sprx");

		if((sysLv2FsStat("/dev_flash/rebug", &stat) == SUCCESS))
			CopyFile("/dev_hdd0/game/UPDWEBMOD/USRDIR/webftp_server_rebug_cobra_ps3mapi.sprx", "/dev_hdd0/game/IRISMAN01/USRDIR/webftp_server_ps3mapi.sprx");
		else
			CopyFile("/dev_hdd0/game/UPDWEBMOD/USRDIR/webftp_server_ps3mapi.sprx", "/dev_hdd0/game/IRISMAN01/USRDIR/webftp_server_ps3mapi.sprx");
	}

	char ligne[255];

	// update PRX Loader
	if(sysLv2FsStat("/dev_hdd0/game/PRXLOADER/USRDIR/plugins.txt", &stat) == SUCCESS)
	{
		f=fopen("/dev_hdd0/game/PRXLOADER/USRDIR/plugins.txt", "r");
		while(fgets(ligne, 255, f) != NULL)
		{
			if(strstr(ligne,"webftp_server") != NULL)
			{
				fclose(f);
				strtok(ligne, "\r\n");
				sysLv2FsUnlink(ligne);
				CopyFile("/dev_hdd0/game/UPDWEBMOD/USRDIR/webftp_server_noncobra.sprx",ligne);
				goto cont;
			}
		}
		fclose(f);
		f=fopen("/dev_hdd0/game/PRXLOADER/USRDIR/plugins.txt", "a");
		fputs("\r\n/dev_hdd0/game/PRXLOADER/USRDIR/webftp_server_noncobra.sprx", f);
		fclose(f);

		sysLv2FsChmod("/dev_hdd0/game/PRXLOADER/USRDIR/webftp_server_noncobra.sprx", 0777);
		sysLv2FsUnlink("/dev_hdd0/game/PRXLOADER/USRDIR/webftp_server_noncobra.sprx");

		CopyFile("/dev_hdd0/game/UPDWEBMOD/USRDIR/webftp_server_noncobra.sprx", "/dev_hdd0/game/PRXLOADER/USRDIR/webftp_server_noncobra.sprx");
	}

cont:

	// update dev_flash (rebug)
	if((sysLv2FsStat("/dev_flash/vsh/module/webftp_server.sprx", &stat) == SUCCESS) || (sysLv2FsStat("/dev_flash/vsh/module/webftp_server.sprx.bak", &stat) == SUCCESS))
	{
		is_cobra(); // re-enable cobra if it's disabled

		if(sysLv2FsStat("/dev_blind", &stat) != SUCCESS)
			sys_fs_mount("CELL_FS_IOS:BUILTIN_FLSH1", "CELL_FS_FAT", "/dev_blind", 0);

		sysLv2FsChmod("/dev_blind/vsh/module/webftp_server.sprx", 0777);
		sysLv2FsUnlink("/dev_blind/vsh/module/webftp_server.sprx");

		sysLv2FsChmod("/dev_blind/vsh/module/webftp_server.sprx.bak", 0777);
		sysLv2FsUnlink("/dev_blind/vsh/module/webftp_server.sprx.bak");

		if(full)
			CopyFile("/dev_hdd0/game/UPDWEBMOD/USRDIR/webftp_server_full.sprx", "/dev_blind/vsh/module/webftp_server.sprx");
		else if(lite)
			CopyFile("/dev_hdd0/game/UPDWEBMOD/USRDIR/webftp_server_lite.sprx", "/dev_blind/vsh/module/webftp_server.sprx");
		else if(is_ps3mapi())
			CopyFile("/dev_hdd0/game/UPDWEBMOD/USRDIR/webftp_server_rebug_cobra_ps3mapi.sprx", "/dev_blind/vsh/module/webftp_server.sprx");
		else
			CopyFile("/dev_hdd0/game/UPDWEBMOD/USRDIR/webftp_server_rebug_cobra_multi23.sprx", "/dev_blind/vsh/module/webftp_server.sprx");


		// delete webMAN from hdd0
		if((sysLv2FsStat("/dev_blind/vsh/module/webftp_server.sprx", &stat) == SUCCESS))
		{
			sysLv2FsChmod("/dev_hdd0/webftp_server.sprx", 0777);
			sysLv2FsUnlink("/dev_hdd0/webftp_server.sprx");

			sysLv2FsChmod("/dev_hdd0/plugins/webftp_server.sprx", 0777);
			sysLv2FsUnlink("/dev_hdd0/plugins/webftp_server.sprx");

			if(sysLv2FsStat("/dev_hdd0/boot_plugins.txt", &stat) == SUCCESS)
			{
				f=fopen("/dev_hdd0/boot_plugins.txt", "r");
				while(fgets(ligne, 255, f) != NULL)
				{
					if(strstr(ligne,"webftp_server") != NULL && strstr(ligne,"/dev_blind") == NULL)
					{
						strtok(ligne, "\r\n");
						sysLv2FsChmod(ligne, 0777);
						sysLv2FsUnlink(ligne);
						break;
					}
				}
				fclose(f);
			}
		}

		// reboot
		sysLv2FsUnlink("/dev_hdd0/tmp/turnoff");
		//{lv2syscall4(379,0x200,0,0,0); return_to_user_prog(int);}
		//{lv2syscall4(379,0x1200,0,0,0); return_to_user_prog(int);}
		{lv2syscall3(SC_SYS_POWER, SYS_REBOOT, 0, 0); return_to_user_prog(int);}
        //{lv2syscall3(SC_SYS_POWER, SYS_REBOOT, 0, 0);}

		return 0;
	}

	// update boot_plugins.txt
	if(lite || full || is_cobra())
	{
		// parse boot_plugins.txt (update existing path)
		if(sysLv2FsStat("/dev_hdd0/boot_plugins.txt", &stat) == SUCCESS)
		{
			f=fopen("/dev_hdd0/boot_plugins.txt", "r");
			while(fgets(ligne, 255, f) != NULL)
			{
				if(strstr(ligne,"webftp_server") != NULL)
				{
					fclose(f);
					strtok(ligne, "\r\n");
					sysLv2FsChmod(ligne, 0777);
					sysLv2FsUnlink(ligne);
					if(full)
						CopyFile("/dev_hdd0/game/UPDWEBMOD/USRDIR/webftp_server_full.sprx", ligne);
					else if(lite)
						CopyFile("/dev_hdd0/game/UPDWEBMOD/USRDIR/webftp_server_lite.sprx", ligne);
					else
					{
						if(is_ps3mapi())
							CopyFile("/dev_hdd0/game/UPDWEBMOD/USRDIR/webftp_server_ps3mapi.sprx", ligne);
						else
							CopyFile("/dev_hdd0/game/UPDWEBMOD/USRDIR/webftp_server.sprx", ligne);
					}
					goto exit;
				}
			}
			fclose(f);
		}

		// append line to boot_plugins.txt
		if(sysLv2FsStat("/dev_hdd0/boot_plugins.txt", &stat) == SUCCESS)
			f=fopen("/dev_hdd0/boot_plugins.txt", "a");
		else
			f=fopen("/dev_hdd0/boot_plugins.txt", "w");
		if((sysLv2FsStat("/dev_hdd0/plugins", &stat) == SUCCESS))
		{
			if(is_ps3mapi() && !lite && !full)
				fputs("\r\n/dev_hdd0/plugins/webftp_server_ps3mapi.sprx", f);
			else
				fputs("\r\n/dev_hdd0/plugins/webftp_server.sprx", f);
		}
		else
		{
			if(is_ps3mapi() && !lite && !full)
				fputs("\r\n/dev_hdd0/webftp_server_ps3mapi.sprx", f);
			else
				fputs("\r\n/dev_hdd0/webftp_server.sprx", f);
		}
		fclose(f);

		// delete old sprx
		sysLv2FsChmod("/dev_hdd0/webftp_server.sprx", 0777);
		sysLv2FsUnlink("/dev_hdd0/webftp_server.sprx");

		sysLv2FsChmod("/dev_hdd0/plugins/webftp_server.sprx", 0777);
		sysLv2FsUnlink("/dev_hdd0/plugins/webftp_server.sprx");

		sysLv2FsChmod("/dev_hdd0/webftp_server_ps3mapi.sprx", 0777);
		sysLv2FsUnlink("/dev_hdd0/webftp_server_ps3mapi.sprx");

		sysLv2FsChmod("/dev_hdd0/plugins/webftp_server_ps3mapi.sprx", 0777);
		sysLv2FsUnlink("/dev_hdd0/plugins/webftp_server_ps3mapi.sprx");

		// copy ps3mapi/cobra/rebug/lite sprx
		if((sysLv2FsStat("/dev_hdd0/plugins", &stat) == SUCCESS))
		{
			if(full)
				CopyFile("/dev_hdd0/game/UPDWEBMOD/USRDIR/webftp_server_full.sprx", "/dev_hdd0/plugins/webftp_server.sprx");
			else if(lite)
				CopyFile("/dev_hdd0/game/UPDWEBMOD/USRDIR/webftp_server_lite.sprx", "/dev_hdd0/plugins/webftp_server.sprx");
			else
			{
				if(is_ps3mapi())
				{
					if((sysLv2FsStat("/dev_flash/rebug", &stat) == SUCCESS))
						CopyFile("/dev_hdd0/game/UPDWEBMOD/USRDIR/webftp_server_rebug_cobra_ps3mapi.sprx", "/dev_hdd0/plugins/webftp_server_ps3mapi.sprx");
					else
						CopyFile("/dev_hdd0/game/UPDWEBMOD/USRDIR/webftp_server_ps3mapi.sprx", "/dev_hdd0/plugins/webftp_server_ps3mapi.sprx");
				}
				else
					CopyFile("/dev_hdd0/game/UPDWEBMOD/USRDIR/webftp_server.sprx", "/dev_hdd0/plugins/webftp_server.sprx");
			}
		}
		else
		{
			if(full)
				CopyFile("/dev_hdd0/game/UPDWEBMOD/USRDIR/webftp_server_full.sprx", "/dev_hdd0/webftp_server.sprx");
			else if(lite)
				CopyFile("/dev_hdd0/game/UPDWEBMOD/USRDIR/webftp_server_lite.sprx", "/dev_hdd0/webftp_server.sprx");
			else
			{
				if(is_ps3mapi())
				{
					if((sysLv2FsStat("/dev_flash/rebug", &stat) == SUCCESS))
						CopyFile("/dev_hdd0/game/UPDWEBMOD/USRDIR/webftp_server_rebug_cobra_ps3mapi.sprx", "/dev_hdd0/webftp_server_ps3mapi.sprx");
					else
						CopyFile("/dev_hdd0/game/UPDWEBMOD/USRDIR/webftp_server_ps3mapi.sprx", "/dev_hdd0/webftp_server_ps3mapi.sprx");
				}
				else
					CopyFile("/dev_hdd0/game/UPDWEBMOD/USRDIR/webftp_server.sprx", "/dev_hdd0/webftp_server.sprx");
			}
		}
	}

	// update mamba_plugins.txt
	if(is_mamba())
	{
		// parse mamba_plugins.txt (update existing path)
		if(sysLv2FsStat("/dev_hdd0/mamba_plugins.txt", &stat) == SUCCESS)
		{
			f=fopen("/dev_hdd0/mamba_plugins.txt", "r");
			while(fgets(ligne, 255, f) != NULL)
			{
				if(strstr(ligne,"webftp_server") != NULL)
				{
					fclose(f);
					strtok(ligne, "\r\n");
					sysLv2FsChmod(ligne, 0777);
					sysLv2FsUnlink(ligne);

					if(full)
						CopyFile("/dev_hdd0/game/UPDWEBMOD/USRDIR/webftp_server_full.sprx", ligne);
					else if(lite)
						CopyFile("/dev_hdd0/game/UPDWEBMOD/USRDIR/webftp_server_lite.sprx", ligne);
					else
						CopyFile("/dev_hdd0/game/UPDWEBMOD/USRDIR/webftp_server_ps3mapi.sprx", ligne);
					goto exit;
				}
			}
			fclose(f);
		}

		// append line to mamba_plugins.txt (Mamba/PRX Loader - PS3MAPI)
		if(sysLv2FsStat("/dev_hdd0/mamba_plugins.txt", &stat) == SUCCESS)
			f=fopen("/dev_hdd0/mamba_plugins.txt", "a");
		else
			f=fopen("/dev_hdd0/mamba_plugins.txt", "w");
		if((sysLv2FsStat("/dev_hdd0/plugins", &stat) == SUCCESS))
		{
			if(full || lite)
				fputs("\r\n/dev_hdd0/plugins/webftp_server.sprx", f);
			else
				fputs("\r\n/dev_hdd0/plugins/webftp_server_ps3mapi.sprx", f);
		}
		else if(full || lite)
			fputs("\r\n/dev_hdd0/webftp_server.sprx", f);
		else
			fputs("\r\n/dev_hdd0/webftp_server_ps3mapi.sprx", f);
		fclose(f);

		// delete old sprx
		sysLv2FsChmod("/dev_hdd0/webftp_server_ps3mapi.sprx", 0777);
		sysLv2FsUnlink("/dev_hdd0/webftp_server_ps3mapi.sprx");

		sysLv2FsChmod("/dev_hdd0/plugins/webftp_server_ps3mapi.sprx", 0777);
		sysLv2FsUnlink("/dev_hdd0/plugins/webftp_server_ps3mapi.sprx");

		// copy ps3mapi sprx
		if((sysLv2FsStat("/dev_hdd0/plugins", &stat) == SUCCESS))
		{
			if(full)
				CopyFile("/dev_hdd0/game/UPDWEBMOD/USRDIR/webftp_server_full.sprx", "/dev_hdd0/plugins/webftp_server.sprx");
			else if(lite)
				CopyFile("/dev_hdd0/game/UPDWEBMOD/USRDIR/webftp_server_lite.sprx", "/dev_hdd0/plugins/webftp_server.sprx");
			else if((sysLv2FsStat("/dev_flash/rebug", &stat) == SUCCESS))
				CopyFile("/dev_hdd0/game/UPDWEBMOD/USRDIR/webftp_server_rebug_cobra_ps3mapi.sprx", "/dev_hdd0/plugins/webftp_server_ps3mapi.sprx");
			else
				CopyFile("/dev_hdd0/game/UPDWEBMOD/USRDIR/webftp_server_ps3mapi.sprx", "/dev_hdd0/plugins/webftp_server_ps3mapi.sprx");
		}
		else
		{
			if(full)
				CopyFile("/dev_hdd0/game/UPDWEBMOD/USRDIR/webftp_server_full.sprx", "/dev_hdd0/webftp_server.sprx");
			else if(lite)
				CopyFile("/dev_hdd0/game/UPDWEBMOD/USRDIR/webftp_server_lite.sprx", "/dev_hdd0/webftp_server.sprx");
			else if((sysLv2FsStat("/dev_flash/rebug", &stat) == SUCCESS))
				CopyFile("/dev_hdd0/game/UPDWEBMOD/USRDIR/webftp_server_rebug_cobra_ps3mapi.sprx", "/dev_hdd0/webftp_server_ps3mapi.sprx");
			else
				CopyFile("/dev_hdd0/game/UPDWEBMOD/USRDIR/webftp_server_ps3mapi.sprx", "/dev_hdd0/webftp_server_ps3mapi.sprx");
		}
	}

	// update prx_plugins.txt (PRX LOADER)
	if(sysLv2FsStat("/dev_hdd0/prx_plugins.txt", &stat) == SUCCESS)
	{
		// parse prx_plugins.txt (update existing path)
		f=fopen("/dev_hdd0/prx_plugins.txt", "r");
		while(fgets(ligne, 255, f) != NULL)
		{
			if(strstr(ligne,"webftp_server") != NULL)
			{
				fclose(f);
				strtok(ligne, "\r\n");
				sysLv2FsUnlink(ligne);
				CopyFile("/dev_hdd0/game/UPDWEBMOD/USRDIR/webftp_server_noncobra.sprx",ligne);
				goto exit;
			}
		}
		fclose(f);

		// append line to prx_plugins.txt
		f=fopen("/dev_hdd0/prx_plugins.txt", "a");

		if(sysLv2FsStat("/dev_hdd0/plugins", &stat) == SUCCESS)
			fputs("\r\n/dev_hdd0/plugins/webftp_server_noncobra.sprx", f);
		else
			fputs("\r\n/dev_hdd0/webftp_server_noncobra.sprx", f);
		fclose(f);

		// delete old sprx
		sysLv2FsChmod("/dev_hdd0/webftp_server_noncobra.sprx", 0777);
		sysLv2FsUnlink("/dev_hdd0/webftp_server_noncobra.sprx");

		sysLv2FsChmod("/dev_hdd0/plugins/webftp_server_noncobra.sprx", 0777);
		sysLv2FsUnlink("/dev_hdd0/plugins/webftp_server_noncobra.sprx");

		// copy non cobra sprx
		if(sysLv2FsStat("/dev_hdd0/plugins", &stat) == SUCCESS)
			CopyFile("/dev_hdd0/game/UPDWEBMOD/USRDIR/webftp_server_noncobra.sprx", "/dev_hdd0/plugins/webftp_server_noncobra.sprx");
		else
			CopyFile("/dev_hdd0/game/UPDWEBMOD/USRDIR/webftp_server_noncobra.sprx", "/dev_hdd0/webftp_server_noncobra.sprx");
	}
	// exit
exit:

	// update category_game.xml (add fb.xml)
	if(add_mygame() != -2);


	// reboot
	sysLv2FsUnlink("/dev_hdd0/tmp/turnoff");
	//{lv2syscall4(379,0x200,0,0,0); return_to_user_prog(int);}
	//{lv2syscall4(379,0x1200,0,0,0); return_to_user_prog(int);}
	{lv2syscall3(SC_SYS_POWER, SYS_REBOOT, 0, 0); return_to_user_prog(int);}

	return 0;
}
Esempio n. 26
0
int main(int argc, char *argv[])
{
    int     ret, server_mode;
    void    *host_addr = memalign(1024 * 1024, HOST_SIZE);
    msgType dialog_type;
	sys_ppu_thread_t id; // start server thread

    load_modules();

    init_logging();

	netInitialize();
	netCtlInit();

    // Initialize SPUs
    LOG(lm_main, LOG_DEBUG, ("Initializing SPUs\n"));
    ret = sysSpuInitialize(MAX_PHYSICAL_SPU, MAX_RAW_SPU);
    if (ret != 0)
    {
        LOG(lm_main, LOG_ERROR, ("sysSpuInitialize failed: %d\n", ret));
        goto quit;
    }

    init_screen(host_addr, HOST_SIZE);
    ioPadInit(7);

    ret = initialize_exit_handlers();
    if (ret != 0)
        goto quit;

    show_version();

    if (user_requested_exit())
        goto quit;

	u64 CEX=0x4345580000000000ULL;
	u64 DEX=0x4445580000000000ULL;
	u64 DEH=0x4445480000000000ULL;

	if(lv2peek(0x80000000002E79C8ULL)==DEX) {dex_mode=2; c_firmware=3.41f;}
	else
	if(lv2peek(0x80000000002CFF98ULL)==CEX) {dex_mode=0; c_firmware=3.41f;}
	else
	if(lv2peek(0x80000000002EFE20ULL)==DEX) {dex_mode=2; c_firmware=3.55f;}
	else
	if(lv2peek(0x80000000002D83D0ULL)==CEX) {dex_mode=0; c_firmware=3.55f;}
	else
	if(lv2peek(0x8000000000302D88ULL)==DEX) {dex_mode=2; c_firmware=4.21f;}
	else
	if(lv2peek(0x80000000002E8610ULL)==CEX) {dex_mode=0; c_firmware=4.21f;}
	else
	if(lv2peek(0x80000000002E9F08ULL)==CEX) {dex_mode=0; c_firmware=4.30f;}
	else
	if(lv2peek(0x8000000000304630ULL)==DEX) {dex_mode=2; c_firmware=4.30f;}
	else
	if(lv2peek(0x80000000002E9F18ULL)==CEX) {dex_mode=0; c_firmware=4.31f;}
	else
	if(lv2peek(0x80000000002EA488ULL)==CEX) {dex_mode=0; c_firmware=4.40f;}
	else
	if(lv2peek(0x80000000002EA498ULL)==CEX) {dex_mode=0; c_firmware=4.41f;}
	else
	if(lv2peek(0x8000000000304EF0ULL)==DEX) {dex_mode=2; c_firmware=4.41f;}
	else
	if(lv2peek(0x80000000002EA9B8ULL)==CEX) {dex_mode=0; c_firmware=4.46f;}
	else
	if(lv2peek(0x8000000000305410ULL)==DEX) {dex_mode=2; c_firmware=4.46f;}
	else
	if(lv2peek(0x80000000002E9BE0ULL)==CEX) {dex_mode=0; c_firmware=4.50f;}
	else
	if(lv2peek(0x8000000000309698ULL)==DEX) {dex_mode=2; c_firmware=4.50f;}
	else
	if(lv2peek(0x80000000002E9D70ULL)==CEX) {dex_mode=0; c_firmware=4.53f;}
	else
	if(lv2peek(0x80000000002EC5E0ULL)==CEX) {dex_mode=0; c_firmware=4.55f;}
	else
	if(lv2peek(0x80000000002ED850ULL)==CEX) {dex_mode=0; c_firmware=4.60f;}
	else
	if(lv2peek(0x80000000002ED860ULL)==CEX) {dex_mode=0; c_firmware=4.65f;}
	else
	if(lv2peek(0x800000000030F1A8ULL)==DEX) {dex_mode=2; c_firmware=4.65f;}
	else
	if(lv2peek(0x80000000002ED778ULL)==CEX) {dex_mode=0; c_firmware=4.70f;}
	else
	if(lv2peek(0x800000000030F240ULL)==DEX) {dex_mode=2; c_firmware=4.70f;}
	else
	if(lv2peek(0x80000000002ED818ULL)==CEX) {dex_mode=0; c_firmware=4.75f;}
	else
	if(lv2peek(0x800000000030F2D0ULL)==DEX) {dex_mode=2; c_firmware=4.75f;}
	else
	if(lv2peek(0x80000000002ED808ULL)==CEX) {dex_mode=0; c_firmware=4.80f;}
	else
	if(lv2peek(0x800000000030F3A0ULL)==DEX) {dex_mode=2; c_firmware=4.80f;}
	else
	if(lv2peek(0x800000000030F3B0ULL)==DEX) {dex_mode=2; c_firmware=4.81f;}
	else
	if(lv2peek(0x800000000032EB60ULL)==DEH) {deh_mode=2; c_firmware=4.81f;}
	else	
		c_firmware=0.00f;

	if(c_firmware==3.55f && dex_mode)
	{
		SYSCALL_TABLE			= SYSCALL_TABLE_355D;
	}
	else
	if(c_firmware==3.55f && !dex_mode)
	{
		SYSCALL_TABLE			= SYSCALL_TABLE_355;
	}
	else
	if(c_firmware==4.21f && !dex_mode)
	{
		SYSCALL_TABLE			= SYSCALL_TABLE_421;
	}
	else
	if(c_firmware==4.30f && !dex_mode)
	{
		SYSCALL_TABLE			= SYSCALL_TABLE_430;
	}
	else
	if(c_firmware==4.30f && dex_mode)
	{
		SYSCALL_TABLE			= SYSCALL_TABLE_430D;
	}
	else
	if(c_firmware==4.31f && !dex_mode)
	{
		SYSCALL_TABLE			= SYSCALL_TABLE_431;
	}
	else
	if(c_firmware==4.40f && !dex_mode)
	{
		SYSCALL_TABLE			= SYSCALL_TABLE_440;
	}
	else
	if(c_firmware==4.41f && !dex_mode)
	{
		SYSCALL_TABLE			= SYSCALL_TABLE_441;
	}
	else
	if(c_firmware==4.41f && dex_mode)
	{
		SYSCALL_TABLE			= SYSCALL_TABLE_441D;
	}
	else
	if(c_firmware==4.46f && !dex_mode)
	{
		SYSCALL_TABLE			= SYSCALL_TABLE_446;
	}
	else
	if(c_firmware==4.50f && !dex_mode)
	{
		SYSCALL_TABLE			= SYSCALL_TABLE_450;
	}
	else
	if(c_firmware==4.53f && !dex_mode)
	{
		SYSCALL_TABLE			= SYSCALL_TABLE_453;
	}
	else
	if(c_firmware==4.55f && !dex_mode)
	{
		SYSCALL_TABLE			= SYSCALL_TABLE_455;
	}
	else
	if(c_firmware==4.60f && !dex_mode)
	{
		SYSCALL_TABLE			= SYSCALL_TABLE_460;
	}
	else
	if(c_firmware==4.65f && !dex_mode)
	{
		SYSCALL_TABLE			= SYSCALL_TABLE_465;
	}
	else
	if(c_firmware==4.65f && dex_mode)
	{
		SYSCALL_TABLE			= SYSCALL_TABLE_465D;
	}
	else
	if(c_firmware==4.70f && !dex_mode)
	{
		SYSCALL_TABLE			= SYSCALL_TABLE_470;
	}
	else
	if(c_firmware==4.70f && dex_mode)
	{
		SYSCALL_TABLE			= SYSCALL_TABLE_470D;
	}
	else
	if(c_firmware==4.75f && !dex_mode)
	{
		SYSCALL_TABLE			= SYSCALL_TABLE_475;
	}
	else
	if(c_firmware==4.80f && !dex_mode)
	{
		SYSCALL_TABLE			= SYSCALL_TABLE_480;
	}
	else
	if(c_firmware==4.80f && dex_mode)
	{
		SYSCALL_TABLE			= SYSCALL_TABLE_480D;
	}
	else
	if(c_firmware==4.75f && dex_mode)
	{
		SYSCALL_TABLE			= SYSCALL_TABLE_475D;
	}
	else
	if(c_firmware==4.81f && dex_mode)
	{
		SYSCALL_TABLE			= SYSCALL_TABLE_481D;
	}
	else
	if(c_firmware==4.46f && dex_mode)
	{
		SYSCALL_TABLE			= SYSCALL_TABLE_446D;
	}
	else
	if(c_firmware==4.50f && dex_mode)
	{
		SYSCALL_TABLE			= SYSCALL_TABLE_450D;
	}
	else
	if(c_firmware==4.21f && dex_mode)
	{
		SYSCALL_TABLE			= SYSCALL_TABLE_421D;
	}
	else
	if(c_firmware==3.41f)
	{
		SYSCALL_TABLE			= SYSCALL_TABLE_341;
	}
	else
	if(c_firmware==4.81f && deh_mode)
	{
		SYSCALL_TABLE			= SYSCALL_TABLE_481H;
	}	
/*
	if(c_firmware>=4.20f && SYSCALL_TABLE)
	{
		// add and enable lv2 peek/poke + lv1 peek/poke
		lv2poke(0x800000000000171CULL,       0x7C0802A6F8010010ULL);
		lv2poke(0x800000000000171CULL +   8, 0x396000B644000022ULL);
		lv2poke(0x800000000000171CULL +  16, 0x7C832378E8010010ULL);
		lv2poke(0x800000000000171CULL +  24, 0x7C0803A64E800020ULL);
		lv2poke(0x800000000000171CULL +  32, 0x7C0802A6F8010010ULL);
		lv2poke(0x800000000000171CULL +  40, 0x396000B744000022ULL);
		lv2poke(0x800000000000171CULL +  48, 0x38600000E8010010ULL);
		lv2poke(0x800000000000171CULL +  56, 0x7C0803A64E800020ULL);
		lv2poke(0x800000000000171CULL +  64, 0x7C0802A6F8010010ULL);
		lv2poke(0x800000000000171CULL +  72, 0x7D4B537844000022ULL);
		lv2poke(0x800000000000171CULL +  80, 0xE80100107C0803A6ULL);
		lv2poke(0x800000000000171CULL +  88, 0x4E80002080000000ULL);
		lv2poke(0x800000000000171CULL +  96, 0x0000170C80000000ULL);
		lv2poke(0x800000000000171CULL + 104, 0x0000171480000000ULL);
		lv2poke(0x800000000000171CULL + 112, 0x0000171C80000000ULL);
		lv2poke(0x800000000000171CULL + 120, 0x0000173C80000000ULL);
		lv2poke(0x800000000000171CULL + 128, 0x0000175C00000000ULL);
		lv2poke(SYSCALL_PTR( 6), 0x8000000000001778ULL); //sc6
		lv2poke(SYSCALL_PTR( 7), 0x8000000000001780ULL); //sc7
		lv2poke(SYSCALL_PTR( 8), 0x8000000000001788ULL); //sc8
		lv2poke(SYSCALL_PTR( 9), 0x8000000000001790ULL); //sc9
		lv2poke(SYSCALL_PTR(10), 0x8000000000001798ULL); //sc10
	}*/
    // remove patch protection
	if(c_firmware==3.55f)
	    remove_protection();

	if(c_firmware==0.00f)
		ret = -1;
	else
	    ret = patch_lv1_ss_services();
    if (ret < 0)
    {
        dialog_type = (MSG_DIALOG_NORMAL | MSG_DIALOG_BTN_TYPE_OK | MSG_DIALOG_DISABLE_CANCEL_ON);
        msgDialogOpen2(dialog_type, "ERROR: Couldn't patch lv1 services, returning to the XMB.\nMake sure you are running a firmware which allows patching!", dialog_handler, NULL, NULL);

        dialog_action = 0;
        while (!dialog_action && !user_requested_exit())
        {
            sysUtilCheckCallback();
            flip();
        }
        msgDialogAbort();

        goto quit;
    }

    // patch syscall 864 to allow drive re-init
	if(c_firmware==0.0f)
		ret = -1;
	else
	    ret = patch_syscall_864();
    if (ret < 0)
    {
        dialog_type = (MSG_DIALOG_NORMAL | MSG_DIALOG_BTN_TYPE_OK | MSG_DIALOG_DISABLE_CANCEL_ON);
        msgDialogOpen2(dialog_type, "ERROR: Couldn't patch syscall 864, returning to the XMB.\nMake sure you are running a firmware which allows patching!", dialog_handler, NULL, NULL);

        dialog_action = 0;
        while (!dialog_action && !user_requested_exit())
        {
            sysUtilCheckCallback();
            flip();
        }
        msgDialogAbort();

        goto quit;
    }

    // install the necessary modules
    ret = install_modules();
    if (ret < 0)
    {
        dialog_type = (MSG_DIALOG_NORMAL | MSG_DIALOG_BTN_TYPE_OK | MSG_DIALOG_DISABLE_CANCEL_ON);
        msgDialogOpen2(dialog_type, "Installation was aborted, returning to the XMB.", dialog_handler, NULL, NULL);

        dialog_action = 0;
        while (!dialog_action && !user_requested_exit())
        {
            sysUtilCheckCallback();
            flip();
        }
        msgDialogAbort();

        goto quit;
    }

    if (user_requested_exit())
        goto quit;

    // reset & re-authenticate the BD drive
    sys_storage_reset_bd();
    sys_storage_authenticate_bd();

    // eject current disc
    {
        int fd;
        ret = sys_storage_open(BD_DEVICE, &fd);
        if (ret == 0)
        {
            ioctl_eject(fd);
            sys_storage_close(fd);
        }
    }

    ret = sysDiscRegisterDiscChangeCallback(&bd_eject_disc_callback, &bd_insert_disc_callback);

    // poll for an output_device
    poll_output_devices();

    server_mode = user_select_server_mode();

    if (user_requested_exit())
        goto quit;

    if (server_mode)
    {
#ifdef ENABLE_LOGGING
        if (output_device)
        {
            char file_path[100];
            sprintf(file_path, "%s/daemon_log.txt", output_device);
            set_log_file(file_path);
        }
#endif
    	sysThreadCreate(&id, listener_thread, NULL, 1500, 0x400, 0, "listener");

        while (1)
        {
            // server loop
            server_loop();

            // break out of the loop when requested
            if (user_requested_exit())
                break;
        }
    }
    else
    {
        while (1)
        {
            // main loop
            main_loop();

            // break out of the loop when requested
            if (user_requested_exit())
                break;
        }
    }

    ret = sysDiscUnregisterDiscChangeCallback();

 quit:

    unpatch_lv1_ss_services();

    destroy_logging();
	netDeinitialize();
    unload_modules();

    free(host_addr);

    return 0;
}
Esempio n. 27
0
s32 main(s32 argc, const char* argv[])
{

	tiny3d_Init(1024*1024);

	ioPadInit(7);

    atexit(exiting); // Tiny3D register the event 3 and do exit() call when you exit  to the menu

	// Load texture

    LoadTexture();

	
	// Ok, everything is setup. Now for the main loop.
	while(1) {

        static long frame_count = 0;


        /* DRAWING STARTS HERE */

        // clear the screen, buffer Z and initializes environment to 2D

        double sx = (double) Video_Resolution.width;
        double sy = (double) Video_Resolution.height;
        double px = (double) (1000 + videoscale_x)/1000.0;
        double py = (double) (1000 + videoscale_y)/1000.0;
        
        tiny3d_UserViewport(1, 
            (float) ((sx - sx * px) / 2.0), // 2D position
            (float) ((sy - sy * py) / 2.0), 
            (float) ((sx * px) / 848.0),    // 2D scale
            (float) ((sy * py) / 512.0),
            (((float) Video_Resolution.width) / 1920.0f) * (float) (1000 + videoscale_x)/1000.0f,  // 3D scale
            (((float) Video_Resolution.height) / 1080.0f) * (float) (1000 + videoscale_y)/1000.0f);

        tiny3d_Clear(0xff000000, TINY3D_CLEAR_ALL);

        // Enable alpha Test
        tiny3d_AlphaTest(1, 0x10, TINY3D_ALPHA_FUNC_GEQUAL);

        // Enable alpha blending.
        tiny3d_BlendFunc(1, TINY3D_BLEND_FUNC_SRC_RGB_SRC_ALPHA | TINY3D_BLEND_FUNC_SRC_ALPHA_SRC_ALPHA,
            TINY3D_BLEND_FUNC_DST_RGB_ONE_MINUS_SRC_ALPHA | TINY3D_BLEND_FUNC_DST_ALPHA_ZERO,
            TINY3D_BLEND_RGB_FUNC_ADD | TINY3D_BLEND_ALPHA_FUNC_ADD);
      
        ps3pad_read();

        if(!(frame_count & 3)) {
            if(old_pad & BUTTON_UP) {if(videoscale_y > -179) videoscale_y--;}
            if(old_pad & BUTTON_DOWN) {if(videoscale_y < 10) videoscale_y++;}
            if(old_pad & BUTTON_LEFT) {if(videoscale_x > -199) videoscale_x--;}
            if(old_pad & BUTTON_RIGHT) {if(videoscale_x < 10) videoscale_x++;}
        }

        
        if(new_pad & BUTTON_CROSS) break;

        drawScene(); // Draw

        /* DRAWING FINISH HERE */

        tiny3d_Flip();
        
        frame_count++;
		
	}
	
	return 0;
}
Esempio n. 28
0
s32 main(s32 argc, const char* argv[])
{
  gcmContextData *context;
  void *host_addr = NULL;
  rsxBuffer buffers[MAX_BUFFERS];
  int currentBuffer = 0;
  padInfo padinfo ;
  padData paddata ;
  u16 width;
  u16 height;
  int i;
  long frame = 0; /* to keep track of how many frames we have rendered */

  atexit(unload_modules);
  if(sysModuleLoad(SYSMODULE_FS) != 0)
    return 0;
  else
    module_flag |= 1;

  if(sysModuleLoad(SYSMODULE_PNGDEC) != 0)
    return 0;
  else
    module_flag |= 2;

  /* Allocate a 1Mb buffer, alligned to a 1Mb boundary
   * to be our shared IO memory with the RSX. */
  host_addr = memalign ( 1024*1024, HOST_SIZE ) ;
  context = screenInit ( host_addr, HOST_SIZE ) ;
  getResolution( &width, &height ) ;
  for (i = 0; i < MAX_BUFFERS; i++)
    makeBuffer( &buffers[i], width, height, i ) ;
  flip( context, MAX_BUFFERS - 1 ) ;
  setRenderTarget(context, &buffers[currentBuffer]) ;

  sysUtilRegisterCallback(SYSUTIL_EVENT_SLOT0, eventHandler, NULL);

  ioPadInit(7) ;

  /* png bitmap buffer */
  pngData png1;

#if USE_PNG_FROM_FILE == true
  const char *filename = PNG_FILE;
  /* load png from file */
  pngLoadFromFile(filename, &png1);
#endif
#if USE_PNG_FROM_FILE == false
  /* load png from memory */
  pngLoadFromBuffer((void *)psl1ght_png, psl1ght_png_size, &png1);
#endif

  /* Ok, everything is setup. Now for the main loop. */
  exitapp = 1;
  while(exitapp)
  {
    /* Check the pads. */
    ioPadGetInfo(&padinfo);
    for(i=0; i<MAX_PADS; i++){
      if(padinfo.status[i]){
        ioPadGetData(i, &paddata);

        if(paddata.BTN_CROSS){
          exitapp = 0;
          goto end;
        }
      }
    }

    waitFlip(); // Wait for the last flip to finish, so we can draw to the old buffer
    drawFrame(&buffers[currentBuffer], frame++); // Draw into the unused buffer

    if(png1.bmp_out)
    {
      static int x=0, y=0, dx=2, dy=2;
  
      u32 *scr = (u32 *)buffers[currentBuffer].ptr;
      u32 *png= (void *)png1.bmp_out;
      int n, m;
  
      /* update x, y coordinates */
      x+=dx;
      y+=dy;
  
      /* */
      if(x < 0)
      {
        x=0;
        dx=1;
      }

      /* screen width to png width */
      if(x > (buffers[currentBuffer].width - png1.width))
      {
        x=(buffers[currentBuffer].width - png1.width);
        dx=-2;
      }
  
      /* */
      if(y < 0)
      {
        y=0;
        dy=1;
      }

      /* screen height to png height */
      if(y > (buffers[currentBuffer].height - png1.height))
      {
        y = (buffers[currentBuffer].height - png1.height);
        dy=-2;
      }

      /* update screen buffer from coordinates */
      scr += y * buffers[currentBuffer].width + x;                     
  
      // draw PNG
      for(n=0;n<png1.height;n++)
      {
        if((y+n)>=buffers[currentBuffer].height) break;
        for(m=0;m<png1.width;m++)
        {
          if((x+m)>=buffers[currentBuffer].width) break;
          scr[m]=png[m];
        }
        png+=png1.pitch>>2;
        scr+=buffers[currentBuffer].width;
      }
    }

    flip(context, buffers[currentBuffer].id); /* Flip buffer onto screen */

    currentBuffer = !currentBuffer;
    setRenderTarget(context, &buffers[currentBuffer]) ; /* change buffer */

    sysUtilCheckCallback(); /* check user attention span */
  }

 end:

  gcmSetWaitFlip(context);
  for (i=0; i < MAX_BUFFERS; i++)
    rsxFree (buffers[i].ptr);
  rsxFinish (context, 1);
  free (host_addr);
  ioPadEnd();

  return 0;
}
Esempio n. 29
0
s32 main(s32 argc, const char* argv[])
{
	PadInfo padinfo;
	PadData paddata;
	int i;
	
	tiny3d_Init(1024*1024);

	ioPadInit(7);
    
    SysLoadModule(SYSMODULE_PNGDEC);

	// Load texture

    LoadTexture();

    /* data for the ghost */

    ghost[0].x     = 0.0f;
    ghost[0].y     = 0.0f;
    ghost[0].dx    = 1.5f;
    ghost[0].dy    = 1.5f;
    ghost[0].frame = 0;
    ghost[0].color = 0xffffff80;

    ghost[1].x     = (847.0f - 64.0f);
    ghost[1].y     = 0.0f;
    ghost[1].dx    = -1.5f;
    ghost[1].dy    = 1.5f;
    ghost[1].frame = 0;
    ghost[1].color = 0x8f8fff80;

    ghost[2].x     = 0.0f;
    ghost[2].y     = (511.0f - 64.0f);
    ghost[2].dx    = 1.5f;
    ghost[2].dy    = -1.5f;
    ghost[2].frame = 0;
    ghost[2].color = 0xff8f8f80;

    ghost[3].x     = (847.0f - 64.0f);
    ghost[3].y     = (511.0f - 64.0f);
    ghost[3].dx    = -1.5f;
    ghost[3].dy    = -1.5f;
    ghost[3].frame = 0;
    ghost[3].color = 0x8fff8f80;
	
	// Ok, everything is setup. Now for the main loop.
	while(1) {

        /* DRAWING STARTS HERE */

        // clear the screen, buffer Z and initializes environment to 2D

        tiny3d_Clear(0xff000000, TINY3D_CLEAR_ALL);

        // Enable alpha Test
        tiny3d_AlphaTest(1, 0x10, TINY3D_ALPHA_FUNC_GEQUAL);

        // Enable alpha blending.
        tiny3d_BlendFunc(1, TINY3D_BLEND_FUNC_SRC_RGB_SRC_ALPHA | TINY3D_BLEND_FUNC_SRC_ALPHA_SRC_ALPHA,
            NV30_3D_BLEND_FUNC_DST_RGB_ONE_MINUS_SRC_ALPHA | NV30_3D_BLEND_FUNC_DST_ALPHA_ZERO,
            TINY3D_BLEND_RGB_FUNC_ADD | TINY3D_BLEND_ALPHA_FUNC_ADD);
      

		// Check the pads.
		ioPadGetInfo(&padinfo);

		for(i = 0; i < MAX_PADS; i++){

			if(padinfo.status[i]){
				ioPadGetData(i, &paddata);
				
				if(paddata.BTN_CROSS){
					return 0;
				}
			}
			
		}

        drawScene(); // Draw

        /* DRAWING FINISH HERE */

        tiny3d_Flip();
		
	}
	
    SysUnloadModule(SYSMODULE_PNGDEC);

	return 0;
}