예제 #1
0
u8 * GetImageData(void) {

	u8 * data = NULL;

	int ret;

	if (CONF_GetAspectRatio()) {
        ctx = PNGU_SelectImageFromBuffer(background169_png);
        if (!ctx)
            return NULL;
    } else {
        ctx = PNGU_SelectImageFromBuffer(background_png);
        if (!ctx)
            return NULL;
    }

	ret = PNGU_GetImageProperties(ctx, &imgProp);
	if (ret != PNGU_OK)
		return NULL;

    int len = imgProp.imgWidth * imgProp.imgHeight * 4;

    if(len%32) len += (32-len%32);
    data = (u8 *)memalign (32, len);
    ret = PNGU_DecodeTo4x4RGBA8 (ctx, imgProp.imgWidth, imgProp.imgHeight, data, 255);
	DCFlushRange(data, len);

	PNGU_ReleaseImageContext(ctx);

    return data;
}
예제 #2
0
void OSystem_Wii::initGfx() {
	gfx_set_underscan(ConfMan.getInt("wii_video_default_underscan_x"),
						ConfMan.getInt("wii_video_default_underscan_y"));

	_overlayWidth = gfx_video_get_width();
	_overlayHeight = gfx_video_get_height();

#ifndef GAMECUBE
	if (CONF_GetAspectRatio() && _fullscreen)
		_overlayHeight = 400;
#endif

	_overlaySize = _overlayWidth * _overlayHeight * 2;
	_overlayPixels = (OverlayColor *) memalign(32, _overlaySize);

	memset(&_texMouse, 0, sizeof(gfx_tex_t));
	memset(&_texOverlay, 0, sizeof(gfx_tex_t));
	memset(&_texGame, 0, sizeof(gfx_tex_t));

	_cursorPalette = (u16 *) malloc(256 * 2);
	if (!_cursorPalette) {
		printf("could not alloc palette buffer\n");
		::abort();
	}

	memset(_cursorPalette, 0, 256 * 2);

	if (!gfx_tex_init(&_texOverlay, GFX_TF_RGB5A3, 0,
						_overlayWidth, _overlayHeight)) {
		printf("could not init the overlay texture\n");
		::abort();
	}

	gfx_coords(&_coordsOverlay, &_texOverlay, GFX_COORD_FULLSCREEN);
}
예제 #3
0
void OSystem_Wii::initGfx() {
	_surface.w = 0;
	_surface.h = 0;
	_surface.pitch = 0;
	_surface.pixels = NULL;
	_surface.bytesPerPixel = 0;

	GX_InitVideo();

	_overlayWidth = 640;
	_overlayHeight = 480;

#ifndef GAMECUBE
	if (CONF_GetAspectRatio() && _fullscreen)
		_overlayHeight = 400;
#endif

	_overlaySize = _overlayWidth * _overlayHeight * 2;
	_overlayPixels = (OverlayColor *) memalign(32, _overlaySize);

	_palette = (u16 *) memalign(32, 256 * 2);
	memset(_palette, 0, 256 * 2);

	_cursorPalette = (u16 *) memalign(32, 256 * 2);
	memset(_cursorPalette, 0, 256 * 2);

	_texture = (u16 *) memalign(32, 640 * 480 * 2);

	setGraphicsMode(_activeGraphicsMode);
}
예제 #4
0
void Menu()
{
	int done = 0;
	int ctrl = 0;

	// Set video mode based on aspect ratio
	if(CONF_GetAspectRatio() == CONF_ASPECT_16_9) isWide = 1;
	setVideoMode();
	drawLogo();

	dListTotal = findPaks();
	dListCurrentPosition = 0;
	if(dListTotal != 1)
	{
		sortList();
		getAllLogs();
		initMenu(1);
		drawMenu();
		pControl = ControlMenu;

		while(!done)
		{
			ctrl = Control();
			switch(ctrl)
			{
				case 1:
				case 2:
					done = 1;
					break;

				case 3:
					drawLogs();
					break;

				case -1:
					drawMenu();
					break;

				case -2:
					// BGM player isn't supported
					break;
			}
		}
		freeAllLogs();
		termMenu();
		if(ctrl == 2)
		{
			if (filelist)
			{
				free(filelist);
				filelist = NULL;
			}
			borExit(0);
		}
	}
	getBasePath(packfile, filelist[dListCurrentPosition+dListScrollPosition].filename, 1);
	free(filelist);
}
예제 #5
0
파일: main.c 프로젝트: PaulWagener/WiiEarth
int main(){
	SYS_SetResetCallback(WiiResetPressed);
	SYS_SetPowerCallback(WiiPowerPressed);
	WPAD_SetPowerButtonCallback(WiimotePowerPressed);
	
	VIDEO_Init();

	if(CONF_GetAspectRatio())
	{
		SCREEN_WIDTH = 720;
	} else {
		SCREEN_WIDTH = 640;
	}
	
	
	initializeinput();
	initializeworld();
	
	GRRLIB_InitVideo();
	GRRLIB_Start();
	
	startscreen();
		
    while(1){
		if(!fadeout)
		{
			updateinput();
			updateworld();
			updatetiles();
			updateoverlay();
		}
		
		drawworld();
		drawcursor();
		drawoverlay();

		//When hitting home do a slow fade to black,
		//if it is totally black do the actual exit
		if (wpadheld & WPAD_BUTTON_HOME || HWButton) fadeout = true;
		if(fadeout)
		{
			fadeout_opacity += 5;
			if(fadeout_opacity >= 270) {
				if(HWButton)
					SYS_ResetSystem(HWButton, 0, 0);
					
				return 0;
			}
				
			GRRLIB_Rectangle(0, 0, SCREEN_WIDTH, SCREEN_HEIGHT, fadeout_opacity > 255 ? 255 << 24 : fadeout_opacity << 24, true);
			
		}
		
		GRRLIB_Render();
    }
    return 0;
}
void Background_Show(float x, float y, float z, u8 * data, float angle, float scaleX, float scaleY, u8 alpha)
{
	if(CONF_GetAspectRatio() != CONF_ASPECT_16_9)
		x -= 40;

	/* Draw image */
	Menu_DrawImg(x, y, z, imagewidth, imageheight, data, angle, scaleX, scaleY, alpha);
	Menu_Render();
}
예제 #7
0
/*
 * Initializes the SDL
 */
int wii_sdl_handle_init()
{
  if( SDL_Init( SDL_INIT_VIDEO | SDL_INIT_AUDIO ) < 0) 
  {
    return 0;
  }

  if( SDL_InitSubSystem( SDL_INIT_VIDEO ) < 0 ) 
  {
    return 0;
  }

  back_surface = 
    SDL_SetVideoMode(
      VB_WIDTH,
      VB_HEIGHT, 
#if BPP == 8
      8,
#elif BPP == 16
      16, 
#else 
      32,
#endif
      SDL_HWSURFACE
    );

#if 0
  if( CONF_GetAspectRatio() )
  {
    WII_SetWidescreen( 1 );
  }
  WII_SetWidescreen( 0 );
#endif

  if( !back_surface) 
  {
    return 0;
  }

#if BPP == 8
  int ncolors = back_surface->format->palette->ncolors;
  memcpy( orig_8bpp_colors, 
    back_surface->format->palette->colors, 
    ncolors * sizeof(SDL_Color) );
  orig_8bpp_palette.colors = orig_8bpp_colors;
  orig_8bpp_palette.ncolors = ncolors;
#endif

  return 1;
}
예제 #8
0
bool OSystem_Wii::setGraphicsMode(int mode) {
	s16 xar, yar;

	printf("setGraphicsMode %d\n", mode);

	xar = vmode->viWidth / 2;
	yar = vmode->xfbHeight / 2;

#ifndef GAMECUBE
	if (CONF_GetAspectRatio() && !_fullscreen)
		xar = s16(float(xar) / 1.33f);
#endif

	GX_SetCamPosZ(400 - mode * 10);
	GX_Start(640, 480, xar, yar);

	_activeGraphicsMode = mode;

	return true;
}
예제 #9
0
void
InitVideo ()
{
	VIDEO_Init();
	vmode = VIDEO_GetPreferredMode(NULL); // get default video mode

	// widescreen fix
	if(CONF_GetAspectRatio() == CONF_ASPECT_16_9)
	{
		vmode->viWidth = VI_MAX_WIDTH_PAL-12;
		vmode->viXOrigin = ((VI_MAX_WIDTH_PAL - vmode->viWidth) / 2) + 2;
	}

	VIDEO_Configure (vmode);

	screenheight = vmode->xfbHeight;
	screenwidth = vmode->fbWidth;

	// Allocate the video buffers
	xfb[0] = (u32 *) MEM_K0_TO_K1 (SYS_AllocateFramebuffer (vmode));
	xfb[1] = (u32 *) MEM_K0_TO_K1 (SYS_AllocateFramebuffer (vmode));

	// Clear framebuffers etc.
	VIDEO_ClearFrameBuffer (vmode, xfb[0], COLOR_BLACK);
	VIDEO_ClearFrameBuffer (vmode, xfb[1], COLOR_BLACK);
	VIDEO_SetNextFramebuffer (xfb[0]);

	// video callback
	VIDEO_SetPostRetraceCallback ((VIRetraceCallback)UpdatePadsCB);

	VIDEO_SetBlack (FALSE);
	VIDEO_Flush ();
	VIDEO_WaitVSync ();
	if (vmode->viTVMode & VI_NON_INTERLACE)
		VIDEO_WaitVSync ();

	StartGX();
	ResetVideo_Menu();
	// Finally, the video is up and ready for use :)
}
예제 #10
0
파일: video.c 프로젝트: MANICX100/wiimc
void
InitVideo ()
{
	VIDEO_Init();
	vmode = VIDEO_GetPreferredMode(NULL); // get default video mode
	
	bool pal = false;

	if (vmode == &TVPal528IntDf)
		pal = true;

	if (CONF_GetAspectRatio() == CONF_ASPECT_16_9)
	{
		vmode->fbWidth = 640;
		vmode->efbHeight = 456;
		vmode->viWidth = 686;

		if (pal)
		{
			vmode->xfbHeight = 542;
			vmode->viHeight = 542;
		}
		else
		{
			vmode->xfbHeight = 456;
			vmode->viHeight = 456;
		}
	}
	else
	{
		if (pal)
			vmode = &TVPal574IntDfScale;

		vmode->viWidth = 672;
	}

	if (pal)
	{
		vmode->viXOrigin = (VI_MAX_WIDTH_PAL - vmode->viWidth) / 2;
		vmode->viYOrigin = (VI_MAX_HEIGHT_PAL - vmode->viHeight) / 2;
	}
	else
	{
		vmode->viXOrigin = (VI_MAX_WIDTH_NTSC - vmode->viWidth) / 2;
		vmode->viYOrigin = (VI_MAX_HEIGHT_NTSC - vmode->viHeight) / 2;
	}

	VIDEO_Configure (vmode);

	// Allocate the video buffers
	xfb[0] = (u32 *) SYS_AllocateFramebuffer (vmode);
	xfb[1] = (u32 *) SYS_AllocateFramebuffer (vmode);
	DCInvalidateRange(xfb[0], VIDEO_GetFrameBufferSize(vmode));
	DCInvalidateRange(xfb[1], VIDEO_GetFrameBufferSize(vmode));
	xfb[0] = (u32 *) MEM_K0_TO_K1 (xfb[0]);
	xfb[1] = (u32 *) MEM_K0_TO_K1 (xfb[1]);

	// Clear framebuffers etc.
	VIDEO_ClearFrameBuffer (vmode, xfb[0], COLOR_BLACK);
	VIDEO_ClearFrameBuffer (vmode, xfb[1], COLOR_BLACK);
	VIDEO_SetNextFramebuffer (xfb[0]);

	VIDEO_SetBlack (FALSE);
	VIDEO_Flush ();
	VIDEO_WaitVSync ();
	if (vmode->viTVMode & VI_NON_INTERLACE)
		VIDEO_WaitVSync ();

	StartGX();
	ResetVideo_Menu();
	// Finally, the video is up and ready for use :)
}
예제 #11
0
void CSettings::SetDefault()
{
	snprintf(covers_path, sizeof(covers_path), "%simages/", ConfigPath);
	snprintf(covers2d_path, sizeof(covers2d_path), "%simages/2D/", ConfigPath);
	snprintf(coversFull_path, sizeof(coversFull_path), "%simages/full/", ConfigPath);
	snprintf(disc_path, sizeof(disc_path), "%simages/disc/", ConfigPath);
	snprintf(titlestxt_path, sizeof(titlestxt_path), "%stitles/", ConfigPath);
	snprintf(languagefiles_path, sizeof(languagefiles_path), "%slanguage/", ConfigPath);
	snprintf(update_path, sizeof(update_path), "%s/apps/usbloader_gx/", BootDevice);
	snprintf(BNRCachePath, sizeof(BNRCachePath), "%s/apps/usbloader_gx/cache_bnr/", BootDevice);
	snprintf(homebrewapps_path, sizeof(homebrewapps_path), "%s/apps/", BootDevice);
	snprintf(Cheatcodespath, sizeof(Cheatcodespath), "%s/codes/", BootDevice);
	snprintf(TxtCheatcodespath, sizeof(TxtCheatcodespath), "%s/txtcodes/", BootDevice);
	snprintf(BcaCodepath, sizeof(BcaCodepath), "%s/bca/", BootDevice);
	snprintf(WipCodepath, sizeof(WipCodepath), "%s/wip/", BootDevice);
	snprintf(WDMpath, sizeof(WDMpath), "%s/wdm/", BootDevice);
	snprintf(WiinnertagPath, sizeof(WiinnertagPath), "%s", ConfigPath);
	snprintf(theme_path, sizeof(theme_path), "%stheme/", ConfigPath);
	snprintf(dolpath, sizeof(dolpath), "%s/", BootDevice);
	snprintf(NandEmuPath, sizeof(NandEmuPath), "%s/nand/", BootDevice);
	snprintf(DEVOLoaderPath, sizeof(DEVOLoaderPath), "%s/apps/gc_devo/", BootDevice);
	snprintf(NINLoaderPath, sizeof(NINLoaderPath), "%s/apps/nintendont/", BootDevice);
	strlcpy(NandEmuChanPath, NandEmuPath, sizeof(NandEmuChanPath));
	strlcpy(GameCubePath, "usb1:/games/", sizeof(GameCubePath));
	strlcpy(GameCubeSDPath, "sd:/games/", sizeof(GameCubeSDPath));
	strlcpy(CustomBannersURL, "http://nintendont.gxarena.com/banners/", sizeof(CustomBannersURL));
	theme[0] = 0;
	language_path[0] = 0;
	ogg_path[0] = 0;
	unlockCode[0] = 0;
	db_language[0] = 0;
	returnTo[0] = 0;

	NTSC = (CONF_GetVideo() == CONF_VIDEO_NTSC);
	PAL50 = (CONF_GetVideo() == CONF_VIDEO_PAL) && (CONF_GetEuRGB60() == 0);
	widescreen = (CONF_GetAspectRatio() == CONF_ASPECT_16_9);

	godmode = 1;
	videomode = VIDEO_MODE_DISCDEFAULT;
	videopatch = OFF;
	videoPatchDol = OFF;
	language = CONSOLE_DEFAULT;
	ocarina = OFF;
	hddinfo = CLOCK_HR12;
	sinfo = ON;
	rumble = ON;
	GameSort = SORT_ABC;
	volume = 80;
	sfxvolume = 80;
	gamesoundvolume = 80;
	tooltips = ON;
	gamesound = ON;
	parentalcontrol = PARENTAL_LVL_ADULT;
	LoaderIOS = BUILD_IOS;
	cios = BUILD_IOS;
	gridRows = 3;
	partition = 0;
	discart = DISCARTS_ORIGINALS_CUSTOMS;
	coversfull = COVERSFULL_HQ;
	xflip = XFLIP_NO;
	quickboot = OFF;
	wiilight = WIILIGHT_ON;
	autonetwork = OFF;
	patchcountrystrings = OFF;
	titlesOverride = ON;
	ForceDiscTitles = OFF;
	screensaver = SCREENSAVER_10_MIN;
	musicloopmode = ON;
	marknewtitles = ON;
	ShowFreeSpace = ON;
	PlaylogUpdate = OFF;
	ParentalBlocks = BLOCK_ALL;
	InstallToDir = INSTALL_TO_NAME_GAMEID;
	GameSplit = GAMESPLIT_4GB;
	InstallPartitions = REMOVE_UPDATE_PARTITION;
	HomeMenu = HOME_MENU_DEFAULT;
	MultiplePartitions = OFF;
	BlockIOSReload = AUTO;
	USBPort = 0;
	USBAutoMount = ON;
	CacheTitles = ON;
	WSFactor = 0.8f; //actually should be 0.75 for real widescreen
	FontScaleFactor = 0.8f; //it's a work around to not have to change ALL fonts now
	ClockFontScaleFactor = 1.0f; // Scale of 1 to prevent misaligned clock.
	EnabledCategories.resize(1);
	EnabledCategories[0] = 0;
	RequiredCategories.resize(0);
	ForbiddenCategories.resize(0);
	Wiinnertag = OFF;
	SelectedGame = 0;
	GameListOffset = 0;
	sneekVideoPatch = OFF;
	NandEmuMode = OFF;
	NandEmuChanMode = 2;
	UseSystemFont = ON;
	Hooktype = 0;
	WiirdDebugger = OFF;
	WiirdDebuggerPause = OFF;
	ShowPlayCount = ON;
	RememberUnlock = ON;
	LoaderMode = MODE_WIIGAMES | MODE_GCGAMES;
	SearchMode = SEARCH_BEGINNING;
	GameAspectRatio = ASPECT_SYSTEM_DEFAULT;
	PointerSpeed = 0.18f;
	UseChanLauncher = OFF;
	AdjustOverscanX = 0;
	AdjustOverscanY = 0;
	TooltipDelay = 1500; // ms
	GameWindowMode = GAMEWINDOW_BANNER;
	CacheBNRFiles = ON;
	BannerAnimStart = BANNER_START_ON_ZOOM;
	BannerGridSpeed = 25.6f; // pixel/frames
	BannerZoomDuration = 30; // frames
	BannerProjectionOffsetX = (!widescreen || PAL50) ? 0.0f : 2.0f;
	BannerProjectionOffsetY = PAL50 ? -1.0f : (NTSC ? 0.0f : -4.0f);
	BannerProjectionWidth = (Settings.widescreen ? (Settings.PAL50 ? 616 : 620.0f) : 608.0f);
	BannerProjectionHeight = (Settings.PAL50 ? 448.0f : (NTSC ? 470.0f : 464.0f));
	GCBannerScale = 1.5f;
	GameCubeMode = GC_MODE_MIOS;
	GameCubeSource = AUTO;
	MultiDiscPrompt = OFF;
	DMLVideo = DML_VIDEO_AUTO;
	DMLProgPatch = OFF;
	DMLNMM = OFF;
	DMLActivityLED = OFF;
	DMLPADHOOK = OFF;
	DMLNoDisc2 = OFF;
	DMLWidescreen = OFF;
	DMLScreenshot = OFF;
	DMLJPNPatch = OFF;
	DMLDebug = OFF;
	NINDeflicker = OFF;
	NINPal50Patch = OFF;
	NINWiiUWide = widescreen;
	NINVideoScale = 40;
	NINVideoOffset = 0;
	NINRemlimit = OFF;
	NINMCEmulation = ON;
	NINMCSize = 2;
	NINAutoboot = ON;
	NINSettings = AUTO;
	NINUSBHID = OFF;
	NINMaxPads = 4;
	NINNativeSI = OFF;
	NINOSReport = OFF;
	NINLED = OFF;
	NINLog = OFF;
	DEVOMCEmulation = OFF;
	DEVOWidescreen = OFF;
	DEVOActivityLED = ON;
	DEVOFZeroAX = OFF;
	DEVOTimerFix = OFF;
	DEVODButtons = OFF;
	DEVOCropOverscan = OFF;
	DEVODiscDelay = OFF;
	GCInstallCompressed = OFF;
	GCInstallAligned = OFF;
	PrivateServer = OFF;
}
예제 #12
0
u8 * GetImageData(void)
{
	u8 * data = NULL;

	int ret;

	if (CONF_GetAspectRatio()) {
		switch (CONF_GetLanguage()) {
			case CONF_LANG_FRENCH:
				ctx = PNGU_SelectImageFromBuffer(bk169fr_png);
				break;
			case CONF_LANG_JAPANESE:
				ctx = PNGU_SelectImageFromBuffer(bk169jp_png);
				break;
			case CONF_LANG_SPANISH:
				ctx = PNGU_SelectImageFromBuffer(bk169sp_png);
				break;
			case CONF_LANG_ITALIAN:
				ctx = PNGU_SelectImageFromBuffer(bk169it_png);
				break;
			case CONF_LANG_DUTCH:
				ctx = PNGU_SelectImageFromBuffer(bk169du_png);
				break;
			case CONF_LANG_GERMAN:
				ctx = PNGU_SelectImageFromBuffer(bk169ge_png);
				break;
			default:
				ctx = PNGU_SelectImageFromBuffer(bk169en_png);
				break;
		}
	} else {
		switch (CONF_GetLanguage()) {
			case CONF_LANG_FRENCH:
				ctx = PNGU_SelectImageFromBuffer(bkfr_png);
				break;
			case CONF_LANG_JAPANESE:
				ctx = PNGU_SelectImageFromBuffer(bkjp_png);
				break;
			case CONF_LANG_SPANISH:
				ctx = PNGU_SelectImageFromBuffer(bksp_png);
				break;
			case CONF_LANG_ITALIAN:
				ctx = PNGU_SelectImageFromBuffer(bkit_png);
				break;
			case CONF_LANG_DUTCH:
				ctx = PNGU_SelectImageFromBuffer(bkdu_png);
				break;
			case CONF_LANG_GERMAN:
				ctx = PNGU_SelectImageFromBuffer(bkge_png);
				break;
			default:
				ctx = PNGU_SelectImageFromBuffer(bken_png);
				break;
		}
	}
	if (!ctx)
		return NULL;

	ret = PNGU_GetImageProperties(ctx, &imgProp);
	if (ret != PNGU_OK)
		return NULL;

    int len = imgProp.imgWidth * imgProp.imgHeight * 4;

    if(len%32) len += (32-len%32);
    data = (u8 *)memalign (32, len);
    ret = PNGU_DecodeTo4x4RGBA8 (ctx, imgProp.imgWidth, imgProp.imgHeight, data, 255);
	DCFlushRange(data, len);

	PNGU_ReleaseImageContext(ctx);

    return data;
}
예제 #13
0
파일: main.c 프로젝트: LPFaint99/gcmm
/****************************************************************************
* Initialise Video
*
* Before doing anything in libogc, it's recommended to configure a video
* output.
****************************************************************************/
static void
Initialise (void)
{
	VIDEO_Init ();		/*** ALWAYS CALL FIRST IN ANY LIBOGC PROJECT!
				     Not only does it initialise the video
				     subsystem, but also sets up the ogc os
				***/

	PAD_Init ();			/*** Initialise pads for input ***/
#ifdef HW_RVL
	WPAD_Init ();
#endif

	// get default video mode
	vmode = VIDEO_GetPreferredMode(NULL);

	switch (vmode->viTVMode >> 2)
	{
	case VI_PAL:
		// 576 lines (PAL 50Hz)
		// display should be centered vertically (borders)
		//Make all video modes the same size so menus doesn't screw up
		vmode = &TVPal576IntDfScale;
		vmode->xfbHeight = 480;
		vmode->viYOrigin = (VI_MAX_HEIGHT_PAL - 480)/2;
		vmode->viHeight = 480;

		vmode_60hz = 0;
		break;

	case VI_NTSC:
		// 480 lines (NTSC 60hz)
		vmode_60hz = 1;
		break;

	default:
		// 480 lines (PAL 60Hz)
		vmode_60hz = 1;
		break;
	}

#ifdef HW_DOL
	/* we have component cables, but the preferred mode is interlaced
	 * why don't we switch into progressive?
	 * (user may not have progressive compatible display but component input)
	 * on the Wii, the user can do this themselves on their Wii Settings */
	if(VIDEO_HaveComponentCable())
		vmode = &TVNtsc480Prog;
#endif

	/*	// check for progressive scan // bool progressive = FALSE;
		if (vmode->viTVMode == VI_TVMODE_NTSC_PROG)
			progressive = true;
	*/

#ifdef HW_RVL
	// widescreen fix
	if(CONF_GetAspectRatio())
	{
		vmode->viWidth = 678;
		vmode->viXOrigin = (VI_MAX_WIDTH_PAL - 678) / 2;
	}
#endif

	// configure VI
	VIDEO_Configure (vmode);

	// always 480 lines /*** Update screen height for font engine ***/
	screenheight = vmode->xfbHeight;

	/*** Now configure the framebuffer.
	     Really a framebuffer is just a chunk of memory
	     to hold the display line by line.
	***/
	// Allocate the video buffers
	xfb[0] = (u32 *) MEM_K0_TO_K1 (SYS_AllocateFramebuffer (vmode));
	/*** I prefer also to have a second buffer for double-buffering.
	     This is not needed for the console demo.
	***/
	xfb[1] = (u32 *) MEM_K0_TO_K1 (SYS_AllocateFramebuffer (vmode));

	/*** Define a console ***/
	console_init (xfb[0], 20, 64, vmode->fbWidth, vmode->xfbHeight, vmode->fbWidth * 2);

	/*** Clear framebuffer to black ***/
	VIDEO_ClearFrameBuffer (vmode, xfb[0], COLOR_BLACK);
	VIDEO_ClearFrameBuffer (vmode, xfb[1], COLOR_BLACK);

	/*** Set the framebuffer to be displayed at next VBlank ***/
	VIDEO_SetNextFramebuffer (xfb[0]);

	/*** Get the PAD status updated by libogc ***/
	VIDEO_SetPostRetraceCallback (updatePAD);
	VIDEO_SetBlack (0);

	/*** Update the video for next vblank ***/
	VIDEO_Flush ();

	VIDEO_WaitVSync ();		/*** Wait for VBL ***/
	if (vmode->viTVMode & VI_NON_INTERLACE)
		VIDEO_WaitVSync ();

}
예제 #14
0
int main(int argc, char* argv[]){
	/* INITIALIZE */
#ifdef DEBUGON
	//DEBUG_Init(GDBSTUB_DEVICE_TCP,GDBSTUB_DEF_TCPPORT); //Default port is 2828
	DEBUG_Init(GDBSTUB_DEVICE_USB, 1);
	_break();
#endif

	Initialise(); // Stock OGC initialization
//	vmode = VIDEO_GetPreferredMode(NULL);
#ifndef WII
	DVD_Init();
#endif
//	menuInit();
#ifdef DEBUGON
	//DEBUG_Init(GDBSTUB_DEVICE_TCP,GDBSTUB_DEF_TCPPORT); //Default port is 2828
//	DEBUG_Init(GDBSTUB_DEVICE_USB, 1);
//	_break();
#endif

	// Default Settings
	audioEnabled     = 1; // Audio
	scalePitch       = 1;
#ifdef RELEASE
	showFPSonScreen  = 0; // Show FPS on Screen
#else
	showFPSonScreen  = 1; // Show FPS on Screen
#endif
	printToScreen    = 1; // Show DEBUG text on screen
	printToSD        = 0; // Disable SD logging
	Timers.limitVIs  = 1;
	autoSave         = 1; // Auto Save Game
	dynacore         = 1; // Dynarec
#ifndef HW_RVL
	screenMode		 = 0; // Stretch FB horizontally
#else
	screenMode		 = CONF_GetAspectRatio() == CONF_ASPECT_16_9 ? SCREENMODE_16x9_PILLARBOX : SCREENMODE_4x3;
#endif
	videoMode		 = VIDEOMODE_AUTO;
	trapFilter		 = TRAPFILTER_DISABLE;
	padAutoAssign	 = PADAUTOASSIGN_AUTOMATIC;
	padType[0]		 = PADTYPE_NONE;
	padType[1]		 = PADTYPE_NONE;
	padType[2]		 = PADTYPE_NONE;
	padType[3]		 = PADTYPE_NONE;
	padAssign[0]	 = PADASSIGN_INPUT0;
	padAssign[1]	 = PADASSIGN_INPUT1;
	padAssign[2]	 = PADASSIGN_INPUT2;
	padAssign[3]	 = PADASSIGN_INPUT3;
	pakMode[0]		 = PAKMODE_MEMPAK; // memPak plugged into controller 1
	pakMode[1]		 = PAKMODE_MEMPAK;
	pakMode[2]		 = PAKMODE_MEMPAK;
	pakMode[3]		 = PAKMODE_MEMPAK;
	loadButtonSlot	 = LOADBUTTON_DEFAULT;
#ifdef GLN64_GX
// glN64 specific  settings
 	glN64_useFrameBufferTextures = 0; // Disable FrameBuffer textures
	glN64_use2xSaiTextures = 0;	// Disable 2xSai textures
	renderCpuFramebuffer = 0; // Disable CPU Framebuffer Rendering
#endif //GLN64_GX
	menuActive = 1;

	//config stuff
	fileBrowser_file* configFile_file;
	int (*configFile_init)(fileBrowser_file*) = fileBrowser_libfat_init;
#ifdef HW_RVL
	if(argc > 0 && argv[0][0] == 'u') {  //assume USB
		nativeSaveDevice = NATIVESAVEDEVICE_USB;
		saveStateDevice = SAVESTATEDEVICE_USB;
		configFile_file = &saveDir_libfat_USB;
		if(configFile_init(configFile_file)) {                //only if device initialized ok
			FILE* f = fopen( "usb:/not64/settings.cfg", "r" );  //attempt to open file
			if(f) {        //open ok, read it
				readConfig(f);
				fclose(f);
			}
			f = fopen( "usb:/not64/controlG.cfg", "r" );  //attempt to open file
			if(f) {
				load_configurations(f, &controller_GC);					//write out GC controller mappings
				fclose(f);
			}
#ifdef HW_RVL
			f = fopen( "usb:/not64/controlC.cfg", "r" );  //attempt to open file
			if(f) {
				load_configurations(f, &controller_Classic);			//write out Classic controller mappings
				fclose(f);
			}
			f = fopen( "usb:/not64/controlN.cfg", "r" );  //attempt to open file
			if(f) {
				load_configurations(f, &controller_WiimoteNunchuk);	//write out WM+NC controller mappings
				fclose(f);
			}
			f = fopen( "usb:/not64/controlW.cfg", "r" );  //attempt to open file
			if(f) {
				load_configurations(f, &controller_Wiimote);			//write out Wiimote controller mappings
				fclose(f);
			}
#endif //HW_RVL
		}
	}
	else /*if((argv[0][0]=='s') || (argv[0][0]=='/'))*/
#endif
	{ //assume SD
		nativeSaveDevice = NATIVESAVEDEVICE_SD;
		saveStateDevice = SAVESTATEDEVICE_SD;
		configFile_file = &saveDir_libfat_Default;
		if(configFile_init(configFile_file)) {                //only if device initialized ok
			FILE* f = fopen( "sd:/not64/settings.cfg", "r" );  //attempt to open file
			if(f) {        //open ok, read it
				readConfig(f);
				fclose(f);
			}
			f = fopen( "sd:/not64/controlG.cfg", "r" );  //attempt to open file
			if(f) {
				load_configurations(f, &controller_GC);					//write out GC controller mappings
				fclose(f);
			}
#ifdef HW_RVL
			f = fopen( "sd:/not64/controlC.cfg", "r" );  //attempt to open file
			if(f) {
				load_configurations(f, &controller_Classic);			//write out Classic controller mappings
				fclose(f);
			}
			f = fopen( "sd:/not64/controlN.cfg", "r" );  //attempt to open file
			if(f) {
				load_configurations(f, &controller_WiimoteNunchuk);	//write out WM+NC controller mappings
				fclose(f);
			}
			f = fopen( "sd:/not64/controlW.cfg", "r" );  //attempt to open file
			if(f) {
				load_configurations(f, &controller_Wiimote);			//write out Wiimote controller mappings
				fclose(f);
			}
#endif //HW_RVL
		}
	}
	// Handle options passed in through arguments
	int i;
	for(i=1; i<argc; ++i){
		handleConfigPair(argv[i]);
	}

	MenuContext *menu = new MenuContext(vmode);

	// Initialize the network if the user has specified something in their SMB settings
	if(strlen(&smbShareName[0]) && strlen(&smbIpAddr[0])) {
		init_network_thread();
	}

	while (menu->isRunning()) {}

	delete menu;

	return 0;
}
예제 #15
0
//---------------------------------------------------------------------------------
int main(int argc, char **argv) {
//---------------------------------------------------------------------------------

	s32 ret;
	u8 gamestatus = 0x03;
	u8 versionnumber = 0x80;
	u32 geckoidcheck;
	u8 oldconfigbytes[2];
	
	ret = sd_init();
	if(!ret){
		sd_found = 0;
	}
	else {
		sd_found = 1;
	}
	
	if (*((u32 *) 0x80001804) == 0x53545542 && *((u32 *) 0x80001808) == 0x48415858)
		loaderhbc = 1;
	
	*(u32*)0xCD00643C = 0x00000000;	// 32Mhz on Bus
	
	gecko_attached = usb_isgeckoalive(EXI_CHANNEL_1);
	if(gecko_attached){	
		gecko_channel = 1;
		if (EXI_GetID(gecko_channel, 0x80, &geckoidcheck) == 1)
		{
			if (geckoidcheck != 0)
			{
				gecko_attached = FALSE;
				goto slota;
			}
		}
		else
		{
			gecko_attached = FALSE;
			goto slota;
		}
		usb_flushnew(gecko_channel);
		goto slotb;
	}
	
slota:
	
	gecko_attached = usb_isgeckoalive(EXI_CHANNEL_0);
	if(gecko_attached){	
		gecko_channel = 0;
		if (EXI_GetID(gecko_channel, 0x80, &geckoidcheck) == 1)
		{
			if (geckoidcheck != 0)
			{
				gecko_attached = FALSE;
				goto slotb;
			}
		}
		else
		{
			gecko_attached = FALSE;
			goto slotb;
		}
		usb_flushnew(gecko_channel);
	}
	
slotb:
	
	sd_load_config();
	
	tempgameconf = (char *) sdbuffer;
	autobootcheck = 1;
	memset(gameidbuffer, 0, 8);
	app_loadgameconfig(gameidbuffer);
	autobootcheck = 0;
	
	loadStartupIOS();
	iosversion = IOS_GetVersion();
	
	if(config_not_loaded == 0){
		menu_load_config();
		config_not_loaded = 1;
	}
	
	if (autoboothbc || !loaderhbc)
	{
		if (autoboot == 1)
		{
			rebooter_thread();
			menu_number = 12;
			rebooter_thread_state = 0;
		}
	}
	else
		autoboot = 0;
	
	WPAD_Init();
	PAD_Init();
	VIDEO_Init();
	AUDIO_Init (NULL);
	
	SYS_SetPowerCallback (power_cb);
    SYS_SetResetCallback (reset_cb);
	
	if (CONF_GetProgressiveScan() > 0 && VIDEO_HaveComponentCable()) {
		progmode = 1;
	}

	if (CONF_GetAspectRatio()) {
		widescreen = 1;
	}
	
	gfx_init();
	gfx_load_gfx();
	
	gfx_load_gfx1();
	if (autoboot == 0 || autobootwait > 1)
		gfx_fade_logo();
	
	VIDEO_WaitVSync();
	
	if(!gecko_attached){	
		gecko_channel = 2;
	}

	gfx_int_stars();
	
	while(1)
	{
		if(gecko_attached){
			usb_recvbuffer(gecko_channel,&gecko_command,1);
			switch(gecko_command)
			{
				//case 0x04:	
				//	gecko_readmem();	
				//break;
				
				case 0x14:		// Load DOL
					load_geckoexe(0);
				break;
					
				case 0x24:		// Load DOL
					load_geckoexe(1);
				break;

				case 0x42:
					// Debugger on, pause start off
					config_bytes[7] = 0x01;
					config_bytes[5] = 0x00;
					usb_recvbuffer_safe(gecko_channel,&oldconfigbytes,2);	// Get config
					config_bytes[0] = oldconfigbytes[0];
					switch (oldconfigbytes[1])
					{
					case 0x00:
						config_bytes[1] = 0x00;
						break;
					case 0x01:
						config_bytes[1] = 0x01;
						break;
					case 0x02:
						config_bytes[1] = 0x00;
						break;
					case 0x03:
						config_bytes[1] = 0x01;
						break;
					case 0x04:
						config_bytes[1] = 0x03;
						break;
					case 0x05:
						config_bytes[1] = 0x03;
						break;
					case 0x06:
						config_bytes[1] = 0x02;
						break;
					case 0x07:
						config_bytes[1] = 0x02;
						break;
					}
					menu_number = 8;
					apploader_thread();
					gecko_command = 0;
				break;
					
				case 0x43:
					// Debugger on, pause start on
					config_bytes[7] = 0x01;
					config_bytes[5] = 0x01;
					usb_recvbuffer_safe(gecko_channel,&oldconfigbytes,2);	// Get config
					config_bytes[0] = oldconfigbytes[0];
					switch (oldconfigbytes[1])
					{
						case 0x00:
							config_bytes[1] = 0x00;
							break;
						case 0x01:
							config_bytes[1] = 0x01;
							break;
						case 0x02:
							config_bytes[1] = 0x00;
							break;
						case 0x03:
							config_bytes[1] = 0x01;
							break;
						case 0x04:
							config_bytes[1] = 0x03;
							break;
						case 0x05:
							config_bytes[1] = 0x03;
							break;
						case 0x06:
							config_bytes[1] = 0x02;
							break;
						case 0x07:
							config_bytes[1] = 0x02;
							break;
					}
					menu_number = 8;
					apploader_thread();
					gecko_command = 0;
				break;

				case 0x50:		
					usb_sendbuffer_safe(gecko_channel,&gamestatus,1);
				break;

				case 0x99:		
					usb_sendbuffer_safe(gecko_channel,&versionnumber,1); 
				break;
			}

		}
		
		if(error_sd || confirm_sd || error_video){
			sleep(1);
			error_sd = 0;
			confirm_sd = 0;
			error_video = 0;
		}

		if(loadedpng && !alphapng){	// if custom backdrop draw bubbles after image
			gfx_draw_image(0, 0, 640, 480, tex_logo1, 0, 1, 1,0xff);
			gfx_draw_stars();
		}
		else{
			gfx_draw_stars(); // else if own back drop do in this order due to border clip
			gfx_draw_image(0, 0, 640, 480, tex_logo1, 0, 1, 1,0xff);
		};
		
		menu_draw();
		gfx_render_direct();
	}

	return 0;
}
예제 #16
0
 int showDOLWindow(int nr)
 { 
         int ret = 1;
         bool doloop = true; 
         int fade = 5; 
         int y, sp; 
         int i;
		 
		 okButton.x = 353;
		 okButton.y = 335;
  
		 switch(nr)
		 {
			case 1:
				CFG_COUNT = CFG_METROID_COUNT;
				for ( i=0; i<CFG_COUNT; i++)
					strcpy(Episode[i], MPT_DOL[i]);
				break;
			case 2:
				CFG_COUNT = CFG_HOD23_COUNT;
				for ( i=0; i<CFG_COUNT; i++)
					strcpy(Episode[i], HOD23_DOL[i]);
				break;
		 }
  
         do{ 
			y = 115; 
			sp = 0; 

			WPAD_ScanPads(); 
			PAD_ScanPads(); 
			GetWiimoteData(); 

			draw_covers(); 
			GRRLIB_2D_Init(); 
			GRRLIB_FillScreen(0x00000000|fade); 

			GRRLIB_Rectangle(40, 106, 560, 276, 0xffffffdd, true);
			GRRLIB_Rectangle(42, 108, 556, 272, 0x737373FF, true);
			GRRLIB_Rectangle(268, 168, 304, 44, 0xffffffdd, true);
			GRRLIB_Rectangle(270, 170, 300, 40, 0x000000FF, true);

			// Get the title info
			struct discHdr *header = NULL;
			header = &self.gameList[self.gameSelected];
			char gameName[MAX_TITLE_LEN]; 

			if(self.usingTitlesTxt)
			{
				// Load a custom title
				sprintf(gameName, "%s", header->title);
				getTitle(titleList, (char*)header->id, gameName);
			}
			else
				sprintf(gameName, "%s", (header->title));

			// Chomp the title to fit
			if(strlen(gameName) >= 22)
			{
				//strncpy(gameName, header->title, 17);
				gameName[19] = '\0';
				strncat(gameName, "...", 3);
			}

			// Display Title, Last Played, and Size
			char tTemp[50];
			sprintf(tTemp,"%s",gameName);
			CFreeTypeGX_DrawText(ttf20pt, 420, 200, tTemp, (GXColor){0xff, 0xff, 0xff, 0xff}, FTGX_JUSTIFY_CENTER);
			CFreeTypeGX_DrawText(ttf20pt, 268, 149, "Episode to play ?", (GXColor){0xff, 0xff, 0xff, 0xff}, FTGX_JUSTIFY_LEFT);

			CFreeTypeGX_DrawText(ttf16pt, 350, 280, "Episode:", (GXColor){0x00, 0x00, 0x00, 0xff}, FTGX_JUSTIFY_RIGHT);
			CFreeTypeGX_DrawText(ttf16pt, 503, 280,  Episode[ret -1], (GXColor){0xff, 0xff, 0xff, 0xff}, FTGX_JUSTIFY_CENTER);


			// Draw the game cover
			if(self.gameSelected < MAX_BUFFERED_COVERS || self.gameSelected >= 0)
			{
				if(BUFFER_IsCoverReady(self.gameSelected))
				{
					pthread_mutex_lock(&buffer_mutex[self.gameSelected]);
					if(_texture_data[self.gameSelected].data)
					{
						if(CONF_GetAspectRatio() == CONF_ASPECT_16_9)
						{
							if(settings.covers3d)
							{
								GRRLIB_DrawFlatCoverImg(60, 131, _texture_data[self.gameSelected], 0, AR_16_9, 1, 0xFFFFFFFF);
							}
							else
							{
								GRRLIB_DrawImg(60, 131, _texture_data[self.gameSelected], 0, AR_16_9, 1, 0xFFFFFFFF);
							}
						}
						else
						{
							if(settings.covers3d)
							{
								GRRLIB_DrawFlatCoverImg(60, 131, _texture_data[self.gameSelected], 0, 1, 1, 0xFFFFFFFF);
							}
							else
							{
								GRRLIB_DrawImg(60, 131, _texture_data[self.gameSelected], 0, 1, 1, 0xFFFFFFFF);
							}
						}
					}
					else
					{
						if(CONF_GetAspectRatio() == CONF_ASPECT_16_9)
						{
							if(settings.covers3d)
							{
								GRRLIB_DrawFlatCoverImg(60, 131 , cover_texture_3d, 0, AR_16_9, 1, 0xFFFFFFFF);
							}
							else
							{
								GRRLIB_DrawImg(60, 131, cover_texture, 0, AR_16_9, 1, 0xFFFFFFFF);
							}
						}
						else
						{
							if(settings.covers3d)
							{
								GRRLIB_DrawFlatCoverImg(60, 131, cover_texture_3d, 0, 1, 1, 0xFFFFFFFF);
							}
							else
							{
								GRRLIB_DrawImg(60, 131, cover_texture, 0, 1, 1, 0xFFFFFFFF);
							}
						}
					}
					
					pthread_mutex_unlock(&buffer_mutex[self.gameSelected]);
				}
				else
				{	
				if(CONF_GetAspectRatio() == CONF_ASPECT_16_9)
				{
					if(settings.covers3d)
					{
						GRRLIB_DrawFlatCoverImg(60, 131, cover_texture_3d, 0, AR_16_9, 1, 0xFFFFFFFF);
					}
					else
					{
						GRRLIB_DrawImg(60, 131, cover_texture, 0, AR_16_9, 1, 0xFFFFFFFF);
					}
				}
				else
				{
					if(settings.covers3d)
					{
						GRRLIB_DrawFlatCoverImg(60, 131, cover_texture_3d, 0, 1, 1, 0xFFFFFFFF);
					}
					else
					{
						GRRLIB_DrawImg(60, 131, cover_texture, 0, 1, 1, 0xFFFFFFFF);
					}
				}
				}
			}
			else
			{
				if(CONF_GetAspectRatio() == CONF_ASPECT_16_9)
				{
					if(settings.covers3d)
					{
						GRRLIB_DrawFlatCoverImg(60, 131, cover_texture_3d, 0, AR_16_9, 1, 0xFFFFFFFF);
					}
					else
					{
						GRRLIB_DrawImg(60, 131, cover_texture, 0, AR_16_9, 1, 0xFFFFFFFF);
					}
				}
				else
				{
					if(settings.covers3d)
					{
						GRRLIB_DrawFlatCoverImg(60, 131, cover_texture_3d, 0, 1, 1, 0xFFFFFFFF);
					}
					else
					{
						GRRLIB_DrawImg(60, 131, cover_texture, 0, 1, 1, 0xFFFFFFFF);
					}
				}
			}


			Button_TTF_Paint(&okButton); 
			Button_Paint(&gDOLdownButton);
			Button_Paint(&gDOLupButton);

			DrawCursor(0, pointer.p_x, pointer.p_y, pointer.p_ang, 1, 1, 0xFFFFFFFF); 

			if ( Button_Hover(&okButton, pointer.p_x, pointer.p_y) ||
				 Button_Hover(&gDOLupButton, pointer.p_x, pointer.p_y) ||
			     Button_Hover(&gDOLdownButton, pointer.p_x, pointer.p_y) ) 
			{ 
				 // Should we be rumbling? 
				 if (--self.rumbleAmt > 0) 
						 WPAD_Rumble(0,1); // Turn on Wiimote rumble 
				 else  
						 WPAD_Rumble(0,0); // Kill the rumble 
			} 
			else 
			{ // If no button is being hovered, kill the rumble 
				 WPAD_Rumble(0,0); 
				 self.rumbleAmt = 5; 
			} 
			
			if((WPAD_ButtonsDown(0) & WPAD_BUTTON_A)||(PAD_ButtonsDown(0) & PAD_BUTTON_A))
			{
				if(Button_Select(&okButton, pointer.p_x, pointer.p_y) && WPAD_ButtonsDown(0) & WPAD_BUTTON_A) 
				{
					doloop = false;
				}
				else if (Button_Select(&gDOLdownButton, pointer.p_x, pointer.p_y))
				{ // Clicked on the episodeDOL buttons
					if (ret > 1)
					{
						ret --;
					}
					else
					{
						ret = (CFG_COUNT);
					}
				}
				else if (Button_Select(&gDOLupButton, pointer.p_x, pointer.p_y))
				{
					if (ret < (CFG_COUNT))
					{
						ret ++;
					}
					else
					{
						ret = 1;
					}
				}
			}
			GRRLIB_Render(); 
                  
         }while(doloop); 
  return ret;

}