예제 #1
0
void Gui_DrawCover(u8 *discid)
{
	extern char coverImg[];

	void *imgData = (void *)coverImg;

	char filepath[128];
	s32  ret;

	/* Generate cover filepath */
	sprintf(filepath, USBLOADER_PATH "/covers/%s.png", discid);

	/* Open cover */
	ret = Fat_ReadFile(filepath, &imgData);
	if (ret > 0) {
		u32 width, height;

		/* Get image dimensions */
		__Gui_GetPngDimensions(imgData, &width, &height);

		/* Image is too big, use default image */
		if ((width > COVER_WIDTH) || (height > COVER_HEIGHT))
			imgData = (void *)coverImg;
	}

	/* Draw cover */
	__Gui_DrawPng(imgData, COVER_XCOORD, COVER_YCOORD);

	/* Free memory */
	if (imgData != coverImg)
		free(imgData);
}
예제 #2
0
void Gui_DrawBackground(void)
{
	extern char bgImg[];

	void *imgData = (void *)bgImg;

	s32 ret;

	/* Try to open background image from SD */
	ret = Fat_ReadFile(USBLOADER_PATH "/background.png", &imgData);
	if (ret > 0) {
		u32 width, height;

		/* Get image dimensions */
		__Gui_GetPngDimensions(imgData, &width, &height);

		/* Background is too big, use default background */
		if ((width > BACKGROUND_WIDTH) || (height > BACKGROUND_HEIGHT))
			imgData = (void *)bgImg;
	}

	/* Draw background */
	__Gui_DrawPng(imgData, 0, 0);

	/* Free memory */
	if (imgData != bgImg)
		free(imgData);
} 
예제 #3
0
void LoadCurrentCover(int id, struct discHdr *gameList)
{
	#ifndef TEST_MODE
	void *imgData;// = (void *)no_cover_png;

	char filepath[128];
	char titleID[7];

	s32  ret;
	struct discHdr *header = &gameList[id];

	//sprintf(filepath, USBLOADER_PATH "/disks/%c%c%c%c%c%c.png", header->id[0],header->id[1],header->id[2],header->id[3],header->id[4],header->id[5]);
	sprintf(filepath, "%s/%c%c%c%c%c%c.png", dynPath.dir_disks, header->id[0],header->id[1],header->id[2],header->id[3],header->id[4],header->id[5]);

	ret = Fat_ReadFile(filepath, &imgData);
	
	sprintf(titleID, "%s", header->id);
	getGameSettings(titleID, &gameSetting);
	
	if (ret > 0)
	{
		BufferImageToSlot(&current_cover_texture,(const unsigned char*)imgData,10);

		CFFree(imgData);
	}
	else
	{
		//sprintf(filepath, USBLOADER_PATH "/disks/%c%c%c%c%c%c.png", header->id[0],header->id[1],header->id[2], header->id[3],header->id[4],header->id[5]);
		sprintf(filepath, "%s/%c%c%c%c%c%c.png", dynPath.dir_disks, header->id[0],header->id[1],header->id[2], header->id[3],header->id[4],header->id[5]);

		ret = Fat_ReadFile(filepath, &imgData);
		
		if (ret > 0)
		{
			BufferImageToSlot(&current_cover_texture,(const unsigned char*)imgData,10);
			CFFree(imgData);
		}
		else
		{
			BufferImageToSlot(&current_cover_texture,no_disc_png,10);
		}
	}
	
	#else
	BufferImageToSlot(&current_cover_texture,no_disc_png,10);
	#endif
}
예제 #4
0
void check_dol(char *name)
{
	void *buf = NULL;
	int size = -1;
	if (name) {
		dbg_printf("loading: %s\n", name);
		size = Fat_ReadFile(name, &buf);
		dbg_printf("size: %d\n", size);
	}
	if (size<0) {
		name = "sd:/apps/USBLoader/boot.dol";
		dbg_printf("loading: %s\n", name);
		size = Fat_ReadFile(name, &buf);
		dbg_printf("size: %d\n", size);
	}
	if (size < 0) return;
	check_dol_buf(buf, size);
	SAFE_FREE(buf);
}