PS2: Fix three compiler warnings and minor code formatting fixes.

This commit is contained in:
D G Turner 2012-11-27 03:55:06 +00:00
parent cf87fcba85
commit 6d4b0a2c9f
3 changed files with 40 additions and 41 deletions

View file

@ -102,8 +102,7 @@ int vblankEndHandler(int cause) {
void createAnimThread(Gs2dScreen *screen);
Gs2dScreen::Gs2dScreen(uint16 width, uint16 height, TVMode tvMode) {
Gs2dScreen::Gs2dScreen(uint16 width, uint16 height, TVMode mode) {
_systemQuit = false;
ee_sema_t newSema;
newSema.init_count = 1;
@ -118,7 +117,7 @@ Gs2dScreen::Gs2dScreen(uint16 width, uint16 height, TVMode tvMode) {
_vblankStartId = AddIntcHandler(INT_VBLANK_START, vblankStartHandler, 0);
_vblankEndId = AddIntcHandler(INT_VBLANK_END, vblankEndHandler, 0);
_dmacId = AddDmacHandler(2, dmacHandler, 0);
_dmacId = AddDmacHandler(2, dmacHandler, 0);
_dmaPipe = new DmaPipe(0x2000);
@ -139,7 +138,7 @@ Gs2dScreen::Gs2dScreen(uint16 width, uint16 height, TVMode tvMode) {
_clut[1] = GS_RGBA(0xC0, 0xC0, 0xC0, 0);
clearOverlay();
if (tvMode == TV_DONT_CARE) {
if (mode == TV_DONT_CARE) {
#if 1
char romver[8];
int fd = fioOpen("rom0:ROMVER", O_RDONLY);
@ -157,12 +156,12 @@ Gs2dScreen::Gs2dScreen(uint16 width, uint16 height, TVMode tvMode) {
_tvMode = TV_NTSC;
#endif
} else
_tvMode = tvMode;
_tvMode = mode;
// _tvMode = TV_NTSC;
printf("Setting up %s mode\n", (_tvMode == TV_PAL) ? "PAL" : "NTSC");
// set screen size, 640x512 for pal, 640x448 for ntsc
// set screen size, 640x512 for pal, 640x448 for ntsc
_tvWidth = 640;
_tvHeight = ((_tvMode == TV_PAL) ? 512 /*544*/ : 448);
kFullScreen[0].z = kFullScreen[1].z = 0;
@ -186,8 +185,8 @@ Gs2dScreen::Gs2dScreen(uint16 width, uint16 height, TVMode tvMode) {
_clutPtrs[MOUSE] = _clutPtrs[SCREEN] + 0x1000; // the cluts in PSMCT32 take up half a memory page each
_clutPtrs[TEXT] = _clutPtrs[SCREEN] + 0x2000;
_texPtrs[SCREEN] = _clutPtrs[SCREEN] + 0x3000;
_texPtrs[TEXT] = 0; // these buffers are stored in the alpha gaps of the frame buffers
_texPtrs[MOUSE] = 128 * 256 * 4;
_texPtrs[TEXT] = 0; // these buffers are stored in the alpha gaps of the frame buffers
_texPtrs[MOUSE] = 128 * 256 * 4;
_texPtrs[PRINTF] = _texPtrs[MOUSE] + M_SIZE * M_SIZE * 4;
_showOverlay = false;
@ -201,14 +200,14 @@ Gs2dScreen::Gs2dScreen(uint16 width, uint16 height, TVMode tvMode) {
_overlayFormat.bytesPerPixel = 2;
_overlayFormat.rLoss = 3;
_overlayFormat.gLoss = 3;
_overlayFormat.bLoss = 3;
_overlayFormat.aLoss = 7;
_overlayFormat.gLoss = 3;
_overlayFormat.bLoss = 3;
_overlayFormat.aLoss = 7;
_overlayFormat.rShift = 0;
_overlayFormat.gShift = 5;
_overlayFormat.bShift = 10;
_overlayFormat.aShift = 15;
_overlayFormat.rShift = 0;
_overlayFormat.gShift = 5;
_overlayFormat.bShift = 10;
_overlayFormat.aShift = 15;
// setup hardware now.
GS_CSR = CSR_RESET; // Reset GS
@ -249,18 +248,18 @@ Gs2dScreen::Gs2dScreen(uint16 width, uint16 height, TVMode tvMode) {
createAnimTextures();
// create anim thread
ee_thread_t animThread, thisThread;
// create animation thread
ee_thread_t animationThread, thisThread;
ReferThreadStatus(GetThreadId(), &thisThread);
_animStack = malloc(ANIM_STACK_SIZE);
animThread.initial_priority = thisThread.current_priority - 3;
animThread.stack = _animStack;
animThread.stack_size = ANIM_STACK_SIZE;
animThread.func = (void *)runAnimThread;
animThread.gp_reg = &_gp;
animationThread.initial_priority = thisThread.current_priority - 3;
animationThread.stack = _animStack;
animationThread.stack_size = ANIM_STACK_SIZE;
animationThread.func = (void *)runAnimThread;
animationThread.gp_reg = &_gp;
_animTid = CreateThread(&animThread);
_animTid = CreateThread(&animationThread);
assert(_animTid >= 0);
StartThread(_animTid, this);
}
@ -268,13 +267,13 @@ Gs2dScreen::Gs2dScreen(uint16 width, uint16 height, TVMode tvMode) {
void Gs2dScreen::quit(void) {
_systemQuit = true;
ee_thread_t statAnim;
do { // wait until thread called ExitThread()
do { // wait until thread called ExitThread()
SignalSema(g_AnimSema);
ReferThreadStatus(_animTid, &statAnim);
} while (statAnim.status != 0x10);
DeleteThread(_animTid);
free(_animStack);
_dmaPipe->waitForDma(); // wait for dmac and vblank for the last time
_dmaPipe->waitForDma(); // wait for dmac and vblank for the last time
while (g_DmacCmd || g_VblankCmd);
sioprintf("kill handlers\n");
@ -606,7 +605,7 @@ void Gs2dScreen::grabOverlay(byte *buf, uint16 pitch) {
for (uint32 cnt = 0; cnt < _height; cnt++) {
memcpy(buf, src, _width * 2);
buf += pitch;
src += _width;
src += _width;
}
}