Index | FAQ | Search | Memberlist | Usergroups | Profile | Log in to check your private messages | Log in | Register

Wii: vid_wii.c

| Inside3d Forums Forum Index -> Engine Programming

View previous topic :: View next topic
Author | Message
--- | ---
Baker Joined: 14 Mar 2006 Posts: 1538 |

Posted: Fri Dec 25, 2009 6:24 pm Post subject: Wii: vid_wii.c |

Sometime I'll probably play around with Bigfoot's Wii build for Quakeworld (thread @ Quakeworld.nu). I think it is interesting not because it is Wii but because BigFoot made it. Most of the engine ports are done by clueless people that have a lot of experience in the platform they are developing on, but don't have any practical experience with Quake.
And that's not Bigfoot

Code:
/* Copyright (C) 2008 Mark Olsen This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#include <ogcsys.h>
#include <gccore.h>
#include <gctypes.h>
#include <stdlib.h>
#include <string.h>
#define false qfalse
#define true qtrue
#include "quakedef.h"
#include "d_local.h"
#include "input.h"
#include "keys.h"
#include "in_wii.h"
#undef false
#undef true
struct display
{
unsigned int width;
unsigned int height;
void *inputdata;
unsigned char *buffer8;
unsigned short *buffer;
unsigned char paly[256];
unsigned char palcb[256];
unsigned char palcr[256];
};
void Sys_Video_CvarInit(void)
{
}
void *Sys_Video_Open(unsigned int width, unsigned int height, unsigned int depth, int fullscreen, unsigned char *palette)
{
struct display *d;
d = malloc(sizeof(*d));
if (d)
{
GXRModeObj *rmode;
switch(VIDEO_GetCurrentTvMode())
{
case VI_NTSC:
rmode = &TVNtsc480IntDf;
break;
case VI_PAL:
rmode = &TVPal528IntDf;
break;
case VI_MPAL:
rmode = &TVMpal480IntDf;
break;
default:
rmode = &TVNtsc480IntDf;
break;
}
d->width = rmode->fbWidth;
d->height = rmode->xfbHeight;
d->buffer8 = malloc(d->width * d->height);
if (d->buffer8)
{
memset(d->buffer8, 0, d->width * d->height);
d->buffer = MEM_K0_TO_K1(SYS_AllocateFramebuffer(rmode));
if (d->buffer)
{
memset(d->buffer, 0, d->width * d->height * 2);
#if 1
VIDEO_Configure(rmode);
VIDEO_SetNextFramebuffer(d->buffer);
VIDEO_SetBlack(FALSE);
VIDEO_Flush();
VIDEO_WaitVSync();
#endif
d->inputdata = Sys_Input_Init();
if (d->inputdata)
{
Com_Printf("%s: %dx%d display initialised\n", __func__, d->width, d->height);
return d;
}
#warning Free fb
}
free(d->buffer8);
}
free(d);
}
return 0;
}
void Sys_Video_Close(void *display)
{
struct display *d;
d = display;
#warning Free fb
free(d->buffer8);
free(d);
}
unsigned int Sys_Video_GetNumBuffers(void *display)
{
return 1;
}
void Sys_Video_GetEvents(void *display)
{
struct display *d = display;
Sys_Input_GetEvents(d->inputdata);
}
void Sys_Video_GetMouseMovement(void *display, int *mousex, int *mousey)
{
struct display *d = display;
Sys_Input_GetMouseMovement(d->inputdata, mousex, mousey);
}
void Sys_Video_Update(void *display, vrect_t * rects)
{
struct display *d = display;
unsigned int *dest;
unsigned char *source;
unsigned int startx;
unsigned int width;
unsigned int x;
unsigned int y;
unsigned int cb;
unsigned int cr;
#if 1
while (rects)
{
startx = rects->x&~1;
width = (rects->width + (rects->x - startx) + 1)&~1;
source = d->buffer8 + rects->y * d->width + startx;
dest = (unsigned int *)(d->buffer + rects->y * d->width + startx);
for(y=0;y<rects->height;y++)
{
for(x=0;x<width;x+=2)
{
cb = (d->palcb[source[x]] + d->palcb[source[x+1]])>>1;
cr = (d->palcr[source[x]] + d->palcr[source[x+1]])>>1;
dest[x/2] = (d->paly[source[x]]<<24)|(cb<<16)|(d->paly[source[x+1]]<<8)|cr;
}
source+= d->width;
dest+= d->width/2;
}
rects = rects->pnext;
}
#endif
}
void Sys_Video_GrabMouse(void *display, int dograb)
{
}
void Sys_Video_SetPalette(void *display, unsigned char *palette)
{
struct display *d = display;
int i;
int r, g, b;
for (i = 0; i < 256; i++)
{
r = palette[i * 3 + 0];
g = palette[i * 3 + 1];
b = palette[i * 3 + 2];
d->paly[i] = (299 * r + 587 * g + 114 * b) / 1000;
d->palcb[i] = (-16874 * r - 33126 * g + 50000 * b + 12800000) / 100000;
d->palcr[i] = (50000 * r - 41869 * g - 8131 * b + 12800000) / 100000;
}
}
void VID_LockBuffer()
{
}
void VID_UnlockBuffer()
{
}
void D_BeginDirectRect(int x, int y, byte *pbitmap, int width, int height)
{
}
void D_EndDirectRect(int x, int y, int width, int height)
{
}
void Sys_Video_SetWindowTitle(void *display, const char *text)
{
}
unsigned int Sys_Video_GetWidth(void *display)
{
struct display *d;
d = display;
return d->width;
}
unsigned int Sys_Video_GetHeight(void *display)
{
struct display *d;
d = display;
return d->height;
}
unsigned int Sys_Video_GetBytesPerRow(void *display)
{
struct display *d;
d = display;
return d->width;
}
void *Sys_Video_GetBuffer(void *display)
{
struct display *d;
d = display;
return d->buffer8;
}

Back to top |

Team Xlink Joined: 25 Jun 2009 Posts: 320 |

Posted: Sun Dec 27, 2009 2:50 am Post subject: |

He has done a good port. Its nice because it is Quake World and not Quake and he did a good job on it. _________________

Anonymous wrote:
if it works, it works. if it doesn't, HAHAHA!

Back to top |

r00k Joined: 13 Nov 2004 Posts: 483 |

Posted: Sun Dec 27, 2009 6:47 am Post subject: |

dont waste your time on the psp. its a dead platform, albiet quake is a dead game in their eyes. You're mooning the handicap. wait, what i mean is that you CAN NOT play QUAKE on the PSP as it was Meant to be played. unless its a custom mod. it just wont happen...

Back to top |

Baker Joined: 14 Mar 2006 Posts: 1538 |

Posted: Sun Dec 27, 2009 12:09 pm Post subject: |

r00k wrote:
dont waste your time on the psp. its a dead platform, albiet quake is a dead game in their eyes. You're mooning the handicap. wait, what i mean is that you CAN NOT play QUAKE on the PSP as it was Meant to be played. unless its a custom mod. it just wont happen...

The "Quake" engine is a gateway to many things.
If you are thinking "Quake" sure that's a proper statement.
Personally, once I saw Nexuiz I stopped thinking of the Quake engine as "Quake".
And then when I saw Kurok, I saw what a strong imagination could do with mapping tools and the Quake engine.
Quake will be the spawn of one thousand children.

Back to top |

Downsider Joined: 16 Sep 2008 Posts: 478 |

Posted: Sun Dec 27, 2009 3:03 pm Post subject: |

Cobalt Runner plays fine on the PSP. And it's cool.

Back to top |

Team Xlink Joined: 25 Jun 2009 Posts: 320 |

Posted: Sun Dec 27, 2009 5:02 pm Post subject: |

Quake plays fine on the psp. It is a fun game and is the best fps on the platform. _________________

Anonymous wrote:
if it works, it works. if it doesn't, HAHAHA!

Back to top |

Downsider Joined: 16 Sep 2008 Posts: 478 |

Posted: Mon Dec 28, 2009 1:32 am Post subject: |

Team Xlink wrote:
Quake plays fine on the psp. It is a fun game and is the best fps on the platform.

Quake plays like ass on the PSP in multiplayer.
You'll get your ass kicked with 4 face buttons and an "analog nub".
And even in singleplayer, most of it consists of exploiting the AI because you don't have the reflexes required to play it correctly without proper controls.

Back to top |

Display posts from previous:

| Inside3d Forums Forum Index -> Engine Programming | All times are GMT
Page 1 of 1

Jump to:

You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum

Powered by phpBB © 2004 phpBB Group