Example #1
0
int main(int argc, char *argv[]) {
	debug_wait_for_client();
	
	PRINTF("installing new poke syscall\n");
	install_new_poke();
	
	PRINTF("mapping lv1\n");
	if (!map_lv1()) {
		remove_new_poke();
		exit(0);
	}
	
	PRINTF("patching lv2 mem protection\n");
	patch_lv2_protection();
	
	/* PRINTF("unmapping lv1\n");
	unmap_lv1();
	
	PRINTF("installing syscall 36\n");
	install_syscall_36();
	
	PRINTF("installing vsh_open hook\n");
	install_vsh_open_hook();	
	
	PRINTF("installing misc lv2 patches\n");
	install_lv2_patches(); */
	
	PRINTF("removing new poke syscall\n");
	remove_new_poke();
	
	PRINTF("done, exiting\n");
	return 0;
}
Example #2
0
int main(int argc, char **argv)
#endif
{
  bool pkg_installed = false;
#if DEBUG
  debug_wait_for_client();
#endif

#ifdef __POWERPC__
  addr = 0x4c490d03;
  host = "pkg-distro.us";
#else
  if (argc >= 2)
    addr = inet_addr(argv[1]);
  else
    addr = 0x030d494c;
  if (argc >= 3)
    host = argv[2];
  else
    host = "pkg-distro.us";
#endif

  gfxinit(&W, &H);
#ifdef __POWERPC__
  char *data = GET("/hpr/", 0);
#else
  char *data = GET(argc >= 4 ? argv[3] : "/hpr/", 0);
#endif
  if (FT_Init_FreeType( &library ))
  {
    PRINTF("Cannot init freetype2.\n");
    return 1;
  }

  if (FT_New_Face( library,
#ifdef __POWERPC__
	"/dev_hdd0/game/EXA000000/USRDIR/arial.ttf",
#else
	"arial.ttf",
#endif
	0,
	&face ))
  {
    PRINTF("Cannot load font.\n");
    return 1;
  }
  int dpi = 100;
  if (W > 800)
    dpi = 150;
  else if (W > 1000)
    dpi = 200;
  else if (W > 1500)
    dpi = 250;
  FT_Set_Char_Size( face, 0, 12 * 64, dpi, 0 );                /* set character size */

  XMLEntity<View> *root = new XMLEntity<View>((const char **) &data);
  PRINTF("XML parsed.\n");
  View *view = new View(*root);
  PRINTF("View ready.\n");
  waitFlip();
  view->render();
  copy();
  flip();
  PRINTF("Render ok.\n");
  bool running = true;
  PRINTF("In main loop.\n");

  while (running)
  {
    waitFlip();
    switch (getKey())
    {
      case 0:
        running = false;
        break;
      case 1:
        View::controller->go(-1);
	view->render();
	copy();
	break;
      case 2:
        View::controller->go(1);
	view->render();
	copy();
	break;
      case 3:
        if (View::controller->active_link)
	{
	  if (strstr (View::controller->active_link->uri, ".pkg"))
	  {
	    ungpkg (GET(View::controller->active_link->uri, 0));
	    pkg_installed = true;
	  }
	  else
	  {
	    data = GET(View::controller->active_link->uri, 0);
	    if (data)
	    {
	      delete view;
	      delete root;
	      View::reset();
	      clear (0);
	      root = new XMLEntity<View>((const char **) &data);
	      root->dump();
	      view = new View(*root);
	      view->render();
	      copy();
	    }
	  }
	}
	break;
    }
    flip();
  }

#ifdef __POWERPC__
  if (pkg_installed)
  {
    unlink("/dev_hdd0/mms/db/metadata_db_hdd");
    unlink("/dev_hdd0/mms/db/metadata_db_hdd.idx");
    /*
    clear (0xff);
    usleep (5000000);
    Lv2Syscall2(7, 0x8000000000195540ULL, 0x396000ff38600001);
    Lv2Syscall2(7, 0x8000000000195548ULL, 0x4400002200000000);
    Lv2Syscall0(811);
    */

    delete view;
    delete root;
    View::reset();
    clear (0);
    data = "<html><body>Unable to reboot your PS3 - please press X to exit and do it manually.</body></html>";
    root = new XMLEntity<View>((const char **) &data);
    root->dump();
    view = new View(*root);
    view->render();
    copy();
    while (getKey() != 3)
    {
      waitFlip();
      flip();
    }
}
#endif

  return 0;
}