Ejemplo n.º 1
0
	void __appInit() {
		// Initialize services
		srvInit();
		aptInit();
		gfxInitDefault();
		hidInit();
		fsInit();
		sdmcInit();
		pxiDevInit();
		consoleInit(GFX_TOP, NULL);
	}
Ejemplo n.º 2
0
void initServices()
{
    hidInit();
    sdmcInit();
    gfxInitDefault();
    consoleInit(GFX_BOTTOM, NULL);

//    gfxInit(GSP_RGBA8_OES,GSP_BGR8_OES,false);
//    gfxInit(GSP_BGR8_OES,GSP_BGR8_OES,false);

    printf("Initializing the GPU...\n");
    gpuInit();
    printf("Done.\n");
	printf("This App is a modded version of 3Damnesic, by Dr.Hacknik.\n");
}
Ejemplo n.º 3
0
s32 main (void) {
	// Initialize services
	srvInit();
	aptInit();
	hidInit(NULL);
	gfxInitDefault();
	fsInit();
	sdmcInit();
	hbInit();
	qtmInit();
	
	Handle fileHandle;
	u32 bytesRead;
    FS_archive sdmcArchive=(FS_archive){ARCH_SDMC, (FS_path){PATH_EMPTY, 1, (u8*)""}};
    FS_path filePath=FS_makePath(PATH_CHAR, "/rxTools.dat");
    Result ret=FSUSER_OpenFileDirectly(NULL, &fileHandle, sdmcArchive, filePath, FS_OPEN_READ, FS_ATTRIBUTE_NONE);
	if(ret) goto EXIT;
    FSFILE_Read(fileHandle, &bytesRead, 0x20000, 0x14400000, 320*1024);
    FSFILE_Close(fileHandle);
	
	consoleInit(GFX_BOTTOM, NULL);
	if (brahma_init()) {
		quick_boot_firm(1);
		printf("[!] Quickload failed\n");
		brahma_exit();

	} else {
		printf("* BRAHMA *\n\n[!]Not enough memory\n");
		wait_any_key();
	}
  EXIT:
	hbExit();
	sdmcExit();
	fsExit();
	gfxExit();
	hidExit();
	aptExit();
	srvExit();
	// Return to hbmenu
	return 0;
}
Ejemplo n.º 4
0
s32 main(void) {
	// Initialize services
	srvInit();
	aptInit();
	hidInit(NULL);
	gfxInitDefault();
	gfxSet3D(true);
	fsInit();
	sdmcInit();
	hbInit();
	qtmInit();
	gfxSwapBuffers();

	Handle fileHandle;
	u32 bytesRead;
	FS_archive sdmcArchive = (FS_archive){ ARCH_SDMC, (FS_path){ PATH_EMPTY, 1, (u8*)"" } };
	FS_path filePath = FS_makePath(PATH_CHAR, "/" CODE_PATH);
	Result ret = FSUSER_OpenFileDirectly(NULL, &fileHandle, sdmcArchive, filePath, FS_OPEN_READ, FS_ATTRIBUTE_NONE);
	if (ret) goto EXIT;
	FSFILE_Read(fileHandle, &bytesRead, 0x14000, 0x14400000, 320 * 1024);
	FSFILE_Close(fileHandle);


	if (brahma_init())
	{
		quick_boot_firm(1);
		brahma_exit();
	}

EXIT:
	hbExit();
	sdmcExit();
	fsExit();
	gfxExit();
	hidExit();
	aptExit();
	srvExit();
	// Return to hbmenu
	return 0;
}
Ejemplo n.º 5
0
static void frontend_ctr_init(void *data)
{
#ifndef IS_SALAMANDER
   (void)data;
   global_t *global   = global_get_ptr();
   global->verbosity = true;

#if 0
   srvInit();
   aptInit();
   hidInit();
   fsInit();
   sdmcInit();

   APT_SetAppCpuTimeLimit(NULL, 80);
   gfxInitDefault();
#endif
   gfxInit(GSP_BGR8_OES,GSP_RGB565_OES,false);
   csndInit();
   gfxSet3D(false);
   consoleInit(GFX_BOTTOM, NULL);
#endif
}
Ejemplo n.º 6
0
int main() {
	// Initialize services
	srvInit();
	aptInit();
	hidInit(NULL);
	gfxInitDefault();
	fsInit();
	sdmcInit();
	hbInit();
	qtmInit();
	hidScanInput();
	u32 kDown = hidKeysDown();
	u32 kHeld = hidKeysHeld();

	//Load the configuration
	loadConfiguration();

    //Check kernel version
	getSystemVersion();
	
	//checks if the CFW has to boot right away or open the GUI
	if(auto_boot == '2') auto_boot = '2'; //here it checks if the "force GUI" is set, and preservs it if it is set
	else if(kHeld & KEY_L) auto_boot = '0'; //here it will start the GUI only this time
	else auto_boot = '1'; //here it won't show the GUI

	//checks if the CFW has to disable firmlaunch
	if (kHeld & KEY_R && firmlaunch == '0') firmlaunch = '2'; //here we enable the firmlaunch only this time
	else if (kHeld & KEY_R && firmlaunch == '1')firmlaunch = '3'; //here we disable the firmlaunch only this time
	
	//Then we save the configuration
	saveConfiguration();

	//Proceeds to launch the loader.bin
	bootCFW_FirstStage();

	}
Ejemplo n.º 7
0
void initFilesystem(void)
{
	fsInit();
	sdmcInit();
}
Ejemplo n.º 8
0
void Player::Init(int argc, char *argv[]) {
	static bool init = false;
	frames = 0;

	if (init) return;

	// Display a nice version string
	std::stringstream header;
	std::string addtl_ver(PLAYER_ADDTL);
	header << "EasyRPG Player " << PLAYER_VERSION;
	if (!addtl_ver.empty())
		header << " " << addtl_ver;
	header << " started";
	Output::Debug(header.str().c_str());

	unsigned int header_width = header.str().length();
	header.str("");
	header << std::setfill('=') << std::setw(header_width) << "=";
	Output::Debug(header.str().c_str());

#ifdef GEKKO
	// Init libfat (Mount SD/USB)
	if (!fatInitDefault()) {
		Output::Error("Couldn't mount any storage medium!");
	}
#elif defined(_3DS)
	// Starting debug console
	gfxInitDefault();
	consoleInit(GFX_BOTTOM, NULL);

	APT_SetAppCpuTimeLimit(30);
	if (osGetKernelVersion() <  SYSTEM_VERSION(2, 48, 3)) khaxInit(); // Executing libkhax just to be sure...
	consoleClear();

	// Check if we already have access to csnd:SND, if not, we will perform a kernel privilege escalation
	Handle csndHandle = 0;
	use_dsp = false;
#ifndef FORCE_DSP
	srvGetServiceHandleDirect(&csndHandle, "csnd:SND");
	if (csndHandle) {
		Output::Debug("csnd:SND has been selected as audio service.");
		svcCloseHandle(csndHandle);
	} else {
		Output::Debug("csnd:SND is unavailable...");
#endif
		srvGetServiceHandleDirect(&csndHandle, "dsp::DSP");
		if (csndHandle) {
			Output::Debug("dsp::DSP has been selected as audio service.");
			use_dsp = true;
			svcCloseHandle(csndHandle);
		} else {
			Output::Error("dsp::DSP is unavailable. Please dump a DSP firmware to use EasyRPG Player. If the problem persists, please report us the issue.");
		}
#ifndef FORCE_DSP
	}
#endif

	fsInit();
	sdmcInit();
#ifndef CITRA3DS_COMPATIBLE
	romfsInit();
#endif

	hidInit();

	// Enable 804 Mhz mode if on N3DS
	bool isN3DS;
	APT_CheckNew3DS(&isN3DS);
	if (isN3DS) {
		osSetSpeedupEnable(true);
	}
#endif

#if (defined(_WIN32) && defined(NDEBUG) && defined(WINVER) && WINVER >= 0x0600)
	InitMiniDumpWriter();
#endif

	srand(time(NULL));

	ParseCommandLine(argc, argv);

#ifdef EMSCRIPTEN
	Output::IgnorePause(true);

	// Create initial directory structure in our private area
	// Retrieve save directory from persistent storage
	EM_ASM(

		FS.mkdir("easyrpg");
		FS.chdir("easyrpg");

		var dirs = ['Backdrop', 'Battle', 'Battle2', 'BattleCharSet', 'BattleWeapon', 'CharSet', 'ChipSet', 'FaceSet', 'Frame', 'GameOver', 'Monster', 'Movie', 'Music', 'Panorama', 'Picture', 'Sound', 'System', 'System2', 'Title', 'Save'];
		dirs.forEach(function(dir) { FS.mkdir(dir) });

		FS.mount(IDBFS, {}, 'Save');

		FS.syncfs(true, function(err) {
		});
	);
Ejemplo n.º 9
0
void __appInit(void) {
    // Initialize services
    srvInit();
    fsInit();
    sdmcInit();
}
Ejemplo n.º 10
0
/*! initialize ftp subsystem */
int
ftp_init(void)
{
  int rc;

#ifdef _3DS
  Result  ret;

  /* initialize FS service */
  ret = fsInit();
  if(ret != 0)
  {
    console_print(RED "fsInit: 0x%08X\n" RESET, (unsigned int)ret);
    goto fs_fail;
  }

  /* initialize sdmc_dev */
  ret = sdmcInit();
  if(ret != 0)
  {
    console_print(RED "sdmcInit: 0x%08X\n" RESET, (unsigned int)ret);
    goto sdmc_fail;
  }

#if ENABLE_LOGGING
  /* open log file */
  FILE *fp = freopen("/ftbrony.log", "wb", stderr);
  if(fp == NULL)
  {
    console_print(RED "freopen: 0x%08X\n" RESET, errno);
    goto stderr_fail;
  }

  /* truncate log file */
  if(ftruncate(fileno(fp), 0) != 0)
  {
    console_print(RED "ftruncate: 0x%08X\n" RESET, errno);
    goto ftruncate_fail;
  }
#endif

  /* allocate buffer for SOC service */
  SOC_buffer = (u32*)memalign(SOC_ALIGN, SOC_BUFFERSIZE);
  if(SOC_buffer == NULL)
  {
    console_print(RED "memalign: failed to allocate\n" RESET);
    goto memalign_fail;
  }

  /* initialize SOC service */
  ret = SOC_Initialize(SOC_buffer, SOC_BUFFERSIZE);
  if(ret != 0)
  {
    console_print(RED "SOC_Initialize: 0x%08X\n" RESET, (unsigned int)ret);
    goto soc_fail;
  }
#endif

  /* allocate socket to listen for clients */
  listenfd = socket(AF_INET, SOCK_STREAM, 0);
  if(listenfd < 0)
  {
    console_print(RED "socket: %d %s\n" RESET, errno, strerror(errno));
    ftp_exit();
    return -1;
  }

  /* get address to listen on */
  serv_addr.sin_family      = AF_INET;
#ifdef _3DS
  serv_addr.sin_addr.s_addr = gethostid();
  serv_addr.sin_port        = htons(LISTEN_PORT);
#else
  serv_addr.sin_addr.s_addr = INADDR_ANY;
  serv_addr.sin_port        = htons(LISTEN_PORT);

  /* reuse address */
  {
    int yes = 1;
    rc = setsockopt(listenfd, SOL_SOCKET, SO_REUSEADDR, &yes, sizeof(yes));
    if(rc != 0)
    {
      console_print(RED "setsockopt: %d %s\n" RESET, errno, strerror(errno));
      ftp_exit();
      return -1;
    }
  }
#endif

  /* bind socket to listen address */
  rc = bind(listenfd, (struct sockaddr*)&serv_addr, sizeof(serv_addr));
  if(rc != 0)
  {
    console_print(RED "bind: %d %s\n" RESET, errno, strerror(errno));
    ftp_exit();
    return -1;
  }

  /* listen on socket */
  rc = listen(listenfd, 5);
  if(rc != 0)
  {
    console_print(RED "listen: %d %s\n" RESET, errno, strerror(errno));
    ftp_exit();
    return -1;
  }

  /* print server address */
#ifdef _3DS
  console_set_status("\n" GREEN STATUS_STRING " "
                     YELLOW "IP:"   CYAN "%s "
                     YELLOW "Port:" CYAN "%u"
                     RESET,
                     inet_ntoa(serv_addr.sin_addr),
                     ntohs(serv_addr.sin_port));
#else
  {
    char      hostname[128];
    socklen_t addrlen = sizeof(serv_addr);
    rc = getsockname(listenfd, (struct sockaddr*)&serv_addr, &addrlen);
    if(rc != 0)
    {
      console_print(RED "getsockname: %d %s\n" RESET, errno, strerror(errno));
      ftp_exit();
      return -1;
    }

    rc = gethostname(hostname, sizeof(hostname));
    if(rc != 0)
    {
      console_print(RED "gethostname: %d %s\n" RESET, errno, strerror(errno));
      ftp_exit();
      return -1;
    }

    console_set_status(GREEN STATUS_STRING " "
                       YELLOW "IP:"   CYAN "%s "
                       YELLOW "Port:" CYAN "%u"
                       RESET,
                       hostname,
                       ntohs(serv_addr.sin_port));
  }
#endif

  return 0;

#ifdef _3DS
soc_fail:
  free(SOC_buffer);

memalign_fail:
#ifdef ENABLE_LOGGING
ftruncate_fail:
  if(fclose(stderr) != 0)
    console_print(RED "fclose: 0x%08X\n" RESET, errno);

stderr_fail:
#endif
  ret = sdmcExit();
  if(ret != 0)
    console_print(RED "sdmcExit: 0x%08X\n" RESET, (unsigned int)ret);

sdmc_fail:
  ret = fsExit();
  if(ret != 0)
    console_print(RED "fsExit: 0x%08X\n" RESET, (unsigned int)ret);

fs_fail:
  return -1;
#endif
}