Welcome! Log In Create A New Profile

Advanced

Libwiisprite Widescreen fix?

Posted by agoaj 
Libwiisprite Widescreen fix?
March 04, 2009 09:23PM
If you use libwiisprite, could you try compiling your game with this version of the library?
[agoajm.googlepages.com]
It should work as a widescreen fix, but I think there may be a problem where it adds V-space. I'd like to know how it works on your apps. Even if you are only using standard 4:3 I'd like to know if it affects anything.

The changes are
gamewindow.cpp
	void GameWindow::InitVideo(){
		// This Code is taken from many examples, but modified for this lib
		if(_initialized)return;
		// Start initializing
		VIDEO_Init();
		_rmode = VIDEO_GetPreferredMode(NULL);
		if(_rmode == NULL){
			exit(0);
			return;
		}
		if( CONF_GetAspectRatio() ) //Widescreen fix
{
	_rmode->viWidth = 678;
	_rmode->viXOrigin = (VI_MAX_WIDTH_PAL - 678)/2;
}

Now that alone gets it to fill the screen to the left and right mostly, but had a space on the top of the screen about 22 pixels high. So I made a change here
layermanager.cpp
void LayerManager::Draw(s32 x, s32 y) const{
		// Since this manager is using a modified scissor box, we use the data + hardcoded values
		GX_SetScissorBoxOffset(-x,-y-5);//  Original-31);   Agoaj: Made this change for the widescreen fix.
		GX_SetScissor(0, 0, _width, _height);
		
		// Do the layers!	
		for(u32 i = _size; i > 0; i--){
			if(i == 0) break;
			if(_layers[i-1])
				_layers[i-1]->Draw(-_x, (-_y)-31); // As strange as it might look like, this fixes everything.
		}

So, how does it work?
Re: Libwiisprite Widescreen fix?
March 05, 2009 09:23AM
I made some more changes but I don't know if it will work outside of NTSC 480P widescreen. I'm still interested to know how it works for your app, and if it filled the screen more or if anything got cut off. Please include your resolution and widescreen settings in your post.
[agoajm.googlepages.com]
Rename the file libwiisprite.a and put it in your lib/wii folder of libogc.

The changes are
gamewindow.cpp
	void GameWindow::InitVideo(){
		// This Code is taken from many examples, but modified for this lib
		if(_initialized)return;
		// Start initializing
		VIDEO_Init();
		_rmode = VIDEO_GetPreferredMode(NULL);
		if(_rmode == NULL){
			exit(0);
			return;
		}
		if( CONF_GetAspectRatio() ) //Widescreen fix
{
	_rmode->viWidth = 720;
	_rmode->viXOrigin = (VI_MAX_WIDTH_PAL - 720)/2;
}
_rmode->fbWidth = 608;  //More changes
_rmode->efbHeight = 520;
I don't know why changing the frame buffer to those particular values works the way it does. For me it fills the screen with a 640 x 480 sprite. I'm not sure if it's better this way or if I should change it so that a 720 x 480 fills the screen correctly.
layermanager.cpp
void LayerManager::Draw(s32 x, s32 y) const{
		// Since this manager is using a modified scissor box, we use the data + hardcoded values
		if(CONF_GetAspectRatio() )
		GX_SetScissorBoxOffset(-x-14,-y-5);//  Original-31);   Agoaj: Made this change for the widescreen fix.
		else
		GX_SetScissorBoxOffset(-x,-y-5);
		
		// Do the layers!	
		for(u32 i = _size; i > 0; i--){
			if(i == 0) break;
			if(_layers[i-1])
				_layers[i-1]->Draw(-_x, (-_y)-31); // As strange as it might look like, this fixes everything.
		}

So, how does it work?
Sorry, only registered users may post in this forum.

Click here to login