1
0
mirror of https://github.com/blawar/GLideN64.git synced 2024-07-04 10:03:36 +00:00

Fix some type mismatch errors.

This commit is contained in:
Sergey Lipskiy 2013-04-22 12:19:52 +07:00
parent d57cf2e3f4
commit 97f07e38c3
6 changed files with 56 additions and 56 deletions

View File

@ -151,7 +151,7 @@ void Config_SaveConfig()
void Config_ApplyDlgConfig( HWND hWndDlg )
{
char text[256];
int i;
LRESULT i;
SendDlgItemMessage( hWndDlg, IDC_CACHEMEGS, WM_GETTEXT, 4, (LPARAM)text );
cache.maxBytes = atol( text ) * 1048576;
@ -159,7 +159,7 @@ void Config_ApplyDlgConfig( HWND hWndDlg )
OGL.forceBilinear = (SendDlgItemMessage( hWndDlg, IDC_FORCEBILINEAR, BM_GETCHECK, NULL, NULL ) == BST_CHECKED);
OGL.enable2xSaI = (SendDlgItemMessage( hWndDlg, IDC_ENABLE2XSAI, BM_GETCHECK, NULL, NULL ) == BST_CHECKED);
OGL.fog = (SendDlgItemMessage( hWndDlg, IDC_FOG, BM_GETCHECK, NULL, NULL ) == BST_CHECKED);
OGL.originAdjust = (OGL.enable2xSaI ? 0.25 : 0.50);
OGL.originAdjust = (OGL.enable2xSaI ? 0.25f : 0.50f);
OGL.fullscreenBits = fullscreen.bitDepth[SendDlgItemMessage( hWndDlg, IDC_FULLSCREENBITDEPTH, CB_GETCURSEL, 0, 0 )];
i = SendDlgItemMessage( hWndDlg, IDC_FULLSCREENRES, CB_GETCURSEL, 0, 0 );
@ -168,7 +168,7 @@ void Config_ApplyDlgConfig( HWND hWndDlg )
OGL.fullscreenRefresh = fullscreen.refreshRate[SendDlgItemMessage( hWndDlg, IDC_FULLSCREENREFRESH, CB_GETCURSEL, 0, 0 )];
i = SendDlgItemMessage( hWndDlg, IDC_TEXTUREBPP, CB_GETCURSEL, 0, 0 );
OGL.textureBitDepth = i;
OGL.textureBitDepth = (int)i;
i = SendDlgItemMessage( hWndDlg, IDC_WINDOWEDRES, CB_GETCURSEL, 0, 0 );
OGL.windowedWidth = windowedModes[i].width;
@ -200,7 +200,7 @@ void UpdateFullscreenConfig( HWND hWndDlg )
SendDlgItemMessage( hWndDlg, IDC_FULLSCREENBITDEPTH, CB_RESETCONTENT, 0, 0 );
while (EnumDisplaySettings( NULL, i, &deviceMode ) != 0)
{
int j = 0;
DWORD j = 0;
for (; j < fullscreen.numBitDepths; j++)
{
if (deviceMode.dmBitsPerPel == fullscreen.bitDepth[j])
@ -229,7 +229,7 @@ void UpdateFullscreenConfig( HWND hWndDlg )
SendDlgItemMessage( hWndDlg, IDC_FULLSCREENRES, CB_RESETCONTENT, 0, 0 );
while (EnumDisplaySettings( NULL, i, &deviceMode ) != 0)
{
int j = 0;
DWORD j = 0;
for (; j < fullscreen.numResolutions; j++)
{
if ((deviceMode.dmPelsWidth == fullscreen.resolution[j].width) &&
@ -263,7 +263,7 @@ void UpdateFullscreenConfig( HWND hWndDlg )
SendDlgItemMessage( hWndDlg, IDC_FULLSCREENREFRESH, CB_RESETCONTENT, 0, 0 );
while (EnumDisplaySettings( NULL, i, &deviceMode ) != 0)
{
int j = 0;
DWORD j = 0;
for (; j < fullscreen.numRefreshRates; j++)
{
if ((deviceMode.dmDisplayFrequency == fullscreen.refreshRate[j]))
@ -292,7 +292,7 @@ void UpdateFullscreenConfig( HWND hWndDlg )
BOOL CALLBACK ConfigDlgProc( HWND hWndDlg, UINT message, WPARAM wParam, LPARAM lParam )
{
char text[256];
int i;
LRESULT i;
DEVMODE deviceMode;
switch (message)
{

View File

@ -257,17 +257,17 @@ void DebugMsg( WORD type, LPCSTR format, ... )
if ((((type & DEBUG_DETAIL) && Debug.detail) || ((type & 0xF000) == Debug.level)) && (type & 0x0FFF & Debug.show))
{
for (int i = 0; i < 4 * RSP.PCi; i++)
for (u32 i = 0; i < 4 * RSP.PCi; i++)
text[i] = ' ';
vsprintf( text + 4 * RSP.PCi, format, va );
INT length = SendDlgItemMessage( hDebugDlg, IDC_DEBUGEDIT, WM_GETTEXTLENGTH, 0, 0 );
INT lengthLimit = SendDlgItemMessage( hDebugDlg, IDC_DEBUGEDIT, EM_GETLIMITTEXT, 0, 0 );
LRESULT length = SendDlgItemMessage( hDebugDlg, IDC_DEBUGEDIT, WM_GETTEXTLENGTH, 0, 0 );
LRESULT lengthLimit = SendDlgItemMessage( hDebugDlg, IDC_DEBUGEDIT, EM_GETLIMITTEXT, 0, 0 );
if ((length + strlen( text )) > lengthLimit)
{
INT lineLength = SendDlgItemMessage( hDebugDlg, IDC_DEBUGEDIT, EM_LINELENGTH, 0, 0 );
LRESULT lineLength = SendDlgItemMessage( hDebugDlg, IDC_DEBUGEDIT, EM_LINELENGTH, 0, 0 );
SendDlgItemMessage( hDebugDlg, IDC_DEBUGEDIT, EM_SETSEL, 0, lineLength + 1 );
SendDlgItemMessage( hDebugDlg, IDC_DEBUGEDIT, EM_REPLACESEL, (WPARAM)FALSE, (LPARAM)"" );
}

View File

@ -188,8 +188,8 @@ void FrameBuffer_SaveBuffer( u32 address, u16 size, u16 width, u16 height )
current->scaleX = OGL.scaleX;
current->scaleY = OGL.scaleY;
current->texture->width = current->width * OGL.scaleX;
current->texture->height = current->height * OGL.scaleY;
current->texture->width = (u32)(current->width * OGL.scaleX);
current->texture->height = (u32)(current->height * OGL.scaleY);
current->texture->clampS = 1;
current->texture->clampT = 1;
current->texture->address = current->startAddress;
@ -200,8 +200,8 @@ void FrameBuffer_SaveBuffer( u32 address, u16 size, u16 width, u16 height )
current->texture->maskT = 0;
current->texture->mirrorS = 0;
current->texture->mirrorT = 0;
current->texture->realWidth = pow2( current->width * OGL.scaleX );
current->texture->realHeight = pow2( current->height * OGL.scaleY );
current->texture->realWidth = (u32)pow2( current->width * OGL.scaleX );
current->texture->realHeight = (u32)pow2( current->height * OGL.scaleY );
current->texture->textureBytes = current->texture->realWidth * current->texture->realHeight * 4;
cache.cachedBytes += current->texture->textureBytes;
@ -265,16 +265,16 @@ void FrameBuffer_RenderBuffer( u32 address )
glDrawBuffer( GL_FRONT );
glBegin(GL_QUADS);
glTexCoord2f( 0.0f, 0.0f );
glVertex2f( 0.0f, OGL.height - current->texture->height );
glVertex2f( 0.0f, (GLfloat)(OGL.height - current->texture->height) );
glTexCoord2f( 0.0f, v1 );
glVertex2f( 0.0f, OGL.height );
glVertex2f( 0.0f, (GLfloat)OGL.height );
glTexCoord2f( u1, v1 );
glVertex2f( current->texture->width, OGL.height );
glVertex2f( current->texture->width, (GLfloat)OGL.height );
glTexCoord2f( u1, 0.0f );
glVertex2f( current->texture->width, OGL.height - current->texture->height );
glVertex2f( current->texture->width, (GLfloat)(OGL.height - current->texture->height) );
glEnd();
glDrawBuffer( GL_BACK );

View File

@ -328,7 +328,7 @@ MicrocodeInfo *GBI_DetectMicrocode( u32 uc_start, u32 uc_dstart, u16 uc_dsize )
{
MicrocodeInfo *current;
for (int i = 0; i < GBI.numMicrocodes; i++)
for (u32 i = 0; i < GBI.numMicrocodes; i++)
{
current = GBI.top;
@ -432,7 +432,7 @@ MicrocodeInfo *GBI_DetectMicrocode( u32 uc_start, u32 uc_dstart, u16 uc_dsize )
// Let the user choose the microcode
#ifndef __LINUX__
current->type = DialogBox( hInstance, MAKEINTRESOURCE( IDD_MICROCODEDLG ), hWnd, MicrocodeDlgProc );
current->type = (u32)DialogBox( hInstance, MAKEINTRESOURCE( IDD_MICROCODEDLG ), hWnd, MicrocodeDlgProc );
#else // !__LINUX__
printf( "glN64: Warning - unknown ucode!!!\n" );
current->type = MicrocodeDialog();

38
gDP.cpp
View File

@ -281,20 +281,20 @@ void gDPUpdateColorImage()
return;
if ((gDP.colorImage.size == G_IM_SIZ_16b) && (gDP.colorImage.format == G_IM_FMT_RGBA))
{
u16 *frameBuffer = (u16*)malloc( gDP.colorImage.width * OGL.scaleX * gDP.colorImage.height * OGL.scaleY * 2 );
u16 *frameBuffer = (u16*)malloc( (u32)(gDP.colorImage.width * OGL.scaleX * gDP.colorImage.height * OGL.scaleY * 2) );
u16 *colorImage = (u16*)&RDRAM[gDP.colorImage.address];
u32 frameX, frameY;
u32 i = 0;
glReadBuffer( GL_BACK );
glReadPixels( 0, OGL.height - gDP.colorImage.height * OGL.scaleY + OGL.heightOffset, gDP.colorImage.width * OGL.scaleX, gDP.colorImage.height * OGL.scaleY, GL_RGBA, GL_UNSIGNED_SHORT_5_5_5_1_EXT, frameBuffer );
glReadPixels( 0, OGL.height - (u32)(gDP.colorImage.height * OGL.scaleY) + OGL.heightOffset, (u32)(gDP.colorImage.width * OGL.scaleX), (u32)(gDP.colorImage.height * OGL.scaleY), GL_RGBA, GL_UNSIGNED_SHORT_5_5_5_1_EXT, frameBuffer );
for (u32 y = 0; y < gDP.colorImage.height; y++)
{
frameY = (gDP.colorImage.height - 1) * OGL.scaleY - y * OGL.scaleY;
frameY = (u32)((gDP.colorImage.height - 1) * OGL.scaleY - y * OGL.scaleY);
for (u32 x = 0; x < gDP.colorImage.width; x++)
{
frameX = x * OGL.scaleX;
frameX = (u32)(x * OGL.scaleX);
colorImage[i^1] = frameBuffer[(u32)(gDP.colorImage.width * OGL.scaleX) * frameY + frameX];
i++;
@ -305,19 +305,19 @@ void gDPUpdateColorImage()
}
else if ((gDP.colorImage.size == G_IM_SIZ_8b) && (gDP.colorImage.format == G_IM_FMT_I))
{
u8 *frameBuffer = (u8*)malloc( gDP.colorImage.width * OGL.scaleX * gDP.colorImage.height * OGL.scaleY );
u8 *frameBuffer = (u8*)malloc( (u32)(gDP.colorImage.width * OGL.scaleX * gDP.colorImage.height * OGL.scaleY) );
u8 *colorImage = (u8*)&RDRAM[gDP.colorImage.address];
u32 frameX, frameY;
u32 i = 0;
glReadPixels( 0, OGL.height - gDP.colorImage.height * OGL.scaleY + OGL.heightOffset, gDP.colorImage.width * OGL.scaleX, gDP.colorImage.height * OGL.scaleY, GL_LUMINANCE, GL_UNSIGNED_BYTE, frameBuffer );
glReadPixels( 0, OGL.height - (u32)(gDP.colorImage.height * OGL.scaleY) + OGL.heightOffset, (u32)(gDP.colorImage.width * OGL.scaleX), (u32)(gDP.colorImage.height * OGL.scaleY), GL_LUMINANCE, GL_UNSIGNED_BYTE, frameBuffer );
for (u32 y = 0; y < gDP.colorImage.height; y++)
{
frameY = (gDP.colorImage.height - 1) * OGL.scaleY - y * OGL.scaleY;
frameY = (u32)((gDP.colorImage.height - 1) * OGL.scaleY - y * OGL.scaleY);
for (u32 x = 0; x < gDP.colorImage.width; x++)
{
frameX = x * OGL.scaleX;
frameX = (u32)(x * OGL.scaleX);
colorImage[i^3] = frameBuffer[(u32)(gDP.colorImage.width * OGL.scaleX) * frameY + frameX];
i++;
@ -351,10 +351,10 @@ void gDPSetColorImage( u32 format, u32 size, u32 width, u32 address )
if (OGL.frameBufferTextures)
{
if (gDP.colorImage.changed)
FrameBuffer_SaveBuffer( gDP.colorImage.address, gDP.colorImage.size, gDP.colorImage.width, gDP.colorImage.height );
FrameBuffer_SaveBuffer( gDP.colorImage.address, (u16)gDP.colorImage.size, (u16)gDP.colorImage.width, (u16)gDP.colorImage.height );
if (address != gDP.depthImageAddress)
FrameBuffer_RestoreBuffer( address, size, width );
FrameBuffer_RestoreBuffer( address, (u16)size, (u16)width );
//OGL_ClearDepthBuffer();
}
@ -463,10 +463,10 @@ void gDPSetFillColor( u32 c )
gDP.fillColor.r = _SHIFTR( c, 11, 5 ) * 0.032258064f;
gDP.fillColor.g = _SHIFTR( c, 6, 5 ) * 0.032258064f;
gDP.fillColor.b = _SHIFTR( c, 1, 5 ) * 0.032258064f;
gDP.fillColor.a = _SHIFTR( c, 0, 1 );
gDP.fillColor.a = (f32)_SHIFTR( c, 0, 1 );
gDP.fillColor.z = _SHIFTR( c, 2, 14 );
gDP.fillColor.dz = _SHIFTR( c, 0, 2 );
gDP.fillColor.z = (f32)_SHIFTR( c, 2, 14 );
gDP.fillColor.dz = (f32)_SHIFTR( c, 0, 2 );
#ifdef DEBUG
DebugMsg( DEBUG_HIGH | DEBUG_HANDLED, "gDPSetFillColor( 0x%08X );\n", c );
@ -708,13 +708,13 @@ void gDPLoadTLUT( u32 tile, u32 uls, u32 ult, u32 lrs, u32 lrt )
{
gDPSetTileSize( tile, uls, ult, lrs, lrt );
u16 count = (gDP.tiles[tile].lrs - gDP.tiles[tile].uls + 1) * (gDP.tiles[tile].lrt - gDP.tiles[tile].ult + 1);
u16 count = (u16)((gDP.tiles[tile].lrs - gDP.tiles[tile].uls + 1) * (gDP.tiles[tile].lrt - gDP.tiles[tile].ult + 1));
u32 address = gDP.textureImage.address + gDP.tiles[tile].ult * gDP.textureImage.bpl + (gDP.tiles[tile].uls << gDP.textureImage.size >> 1);
u16 *dest = (u16*)&TMEM[gDP.tiles[tile].tmem];
u16 *src = (u16*)&RDRAM[address];
u16 pal = (gDP.tiles[tile].tmem - 256) >> 4;
u16 pal = (u16)((gDP.tiles[tile].tmem - 256) >> 4);
int i = 0;
while (i < count)
@ -797,7 +797,7 @@ void gDPFillRectangle( s32 ulx, s32 uly, s32 lrx, s32 lry )
if (depthBuffer.current) depthBuffer.current->cleared = FALSE;
gDP.colorImage.changed = TRUE;
gDP.colorImage.height = max( gDP.colorImage.height, lry );
gDP.colorImage.height = (u32)max( (s32)gDP.colorImage.height, lry );
#ifdef DEBUG
DebugMsg( DEBUG_HIGH | DEBUG_HANDLED, "gDPFillRectangle( %i, %i, %i, %i );\n",
@ -850,8 +850,8 @@ void gDPTextureRectangle( f32 ulx, f32 uly, f32 lrx, f32 lry, s32 tile, f32 s, f
if (gDP.textureMode == TEXTUREMODE_NORMAL)
gDP.textureMode = TEXTUREMODE_TEXRECT;
gDP.texRect.width = max( lrs, s ) + dsdx;
gDP.texRect.height = max( lrt, t ) + dtdy;
gDP.texRect.width = (u32)(max( lrs, s ) + dsdx);
gDP.texRect.height = (u32)(max( lrt, t ) + dtdy);
if (lrs > s)
{
@ -873,7 +873,7 @@ void gDPTextureRectangle( f32 ulx, f32 uly, f32 lrx, f32 lry, s32 tile, f32 s, f
if (depthBuffer.current) depthBuffer.current->cleared = FALSE;
gDP.colorImage.changed = TRUE;
gDP.colorImage.height = max( gDP.colorImage.height, gDP.scissor.lry );
gDP.colorImage.height = max( gDP.colorImage.height, (u32)gDP.scissor.lry );
#ifdef DEBUG
DebugMsg( DEBUG_HIGH | DEBUG_HANDLED, "gDPTextureRectangle( %f, %f, %f, %f, %i, %i, %f, %f, %f, %f );\n",

32
gSP.cpp
View File

@ -425,7 +425,7 @@ void gSPVertex( u32 v, u32 n, u32 v0 )
if ((n + v0) < (80))
{
for (int i = v0; i < n + v0; i++)
for (u32 i = v0; i < n + v0; i++)
{
gSP.vertices[i].x = vertex->x;
gSP.vertices[i].y = vertex->y;
@ -501,7 +501,7 @@ void gSPCIVertex( u32 v, u32 n, u32 v0 )
if ((n + v0) < (80))
{
for (int i = v0; i < n + v0; i++)
for (u32 i = v0; i < n + v0; i++)
{
gSP.vertices[i].x = vertex->x;
gSP.vertices[i].y = vertex->y;
@ -559,7 +559,7 @@ void gSPDMAVertex( u32 v, u32 n, u32 v0 )
if ((n + v0) < (80))
{
for (int i = v0; i < n + v0; i++)
for (u32 i = v0; i < n + v0; i++)
{
gSP.vertices[i].x = *(s16*)&RDRAM[address ^ 2];
gSP.vertices[i].y = *(s16*)&RDRAM[(address + 2) ^ 2];
@ -891,7 +891,7 @@ void gSPTriangle( s32 v0, s32 v1, s32 v2, s32 flag )
if (depthBuffer.current) depthBuffer.current->cleared = FALSE;
gDP.colorImage.changed = TRUE;
gDP.colorImage.height = max( gDP.colorImage.height, gDP.scissor.lry );
gDP.colorImage.height = max( gDP.colorImage.height, (u32)gDP.scissor.lry );
}
void gSP1Triangle( s32 v0, s32 v1, s32 v2, s32 flag )
@ -1015,7 +1015,7 @@ bool gSPCullVertices( u32 v0, u32 vn )
xClip = yClip = zClip = 0.0f;
for (int i = v0; i <= vn; i++)
for (u32 i = v0; i <= vn; i++)
{
if (gSP.vertices[i].xClip == 0.0f)
return FALSE;
@ -1151,7 +1151,7 @@ void gSPSegment( s32 seg, s32 base )
return;
}
if (base > RDRAMSize - 1)
if (base > (s32)RDRAMSize - 1)
{
#ifdef DEBUG
DebugMsg( DEBUG_HIGH | DEBUG_ERROR, "// Attempting to load invalid address into segment array\n",
@ -1458,8 +1458,8 @@ void gSPBgRect1Cyc( u32 bg )
f32 imageX = _FIXED2FLOAT( objScaleBg->imageX, 5 );
f32 imageY = _FIXED2FLOAT( objScaleBg->imageY, 5 );
f32 imageW = objScaleBg->imageW >> 2;
f32 imageH = objScaleBg->imageH >> 2;
f32 imageW = (f32)(objScaleBg->imageW >> 2);
f32 imageH = (f32)(objScaleBg->imageH >> 2);
f32 frameX = _FIXED2FLOAT( objScaleBg->frameX, 2 );
f32 frameY = _FIXED2FLOAT( objScaleBg->frameY, 2 );
@ -1538,11 +1538,11 @@ void gSPBgRectCopy( u32 bg )
gSP.bgImage.palette = objBg->imagePal;
gDP.textureMode = TEXTUREMODE_BGIMAGE;
u16 imageX = objBg->imageX >> 5;
u16 imageY = objBg->imageY >> 5;
f32 imageX = objBg->imageX / 32.f;
f32 imageY = objBg->imageY / 32.f;
s16 frameX = objBg->frameX / 4;
s16 frameY = objBg->frameY / 4;
f32 frameX = objBg->frameX / 4.0f;
f32 frameY = objBg->frameY / 4.0f;
u16 frameW = objBg->frameW >> 2;
u16 frameH = objBg->frameH >> 2;
@ -1623,22 +1623,22 @@ void gSPObjSprite( u32 sp )
gSP.vertices[1].y = gSP.objMatrix.C * x1 + gSP.objMatrix.D * y0 + gSP.objMatrix.Y;
gSP.vertices[1].z = 0.0f;
gSP.vertices[1].w = 1.0f;
gSP.vertices[1].s = imageW - 1;
gSP.vertices[1].s = (f32)(imageW - 1);
gSP.vertices[1].t = 0.0f;
gSP.vertices[2].x = gSP.objMatrix.A * x1 + gSP.objMatrix.B * y1 + gSP.objMatrix.X;
gSP.vertices[2].y = gSP.objMatrix.C * x1 + gSP.objMatrix.D * y1 + gSP.objMatrix.Y;
gSP.vertices[2].z = 0.0f;
gSP.vertices[2].w = 1.0f;
gSP.vertices[2].s = imageW - 1;
gSP.vertices[2].t = imageH - 1;
gSP.vertices[2].s = (f32)(imageW - 1);
gSP.vertices[2].t = (f32)(imageH - 1);
gSP.vertices[3].x = gSP.objMatrix.A * x0 + gSP.objMatrix.B * y1 + gSP.objMatrix.X;
gSP.vertices[3].y = gSP.objMatrix.C * x0 + gSP.objMatrix.D * y1 + gSP.objMatrix.Y;
gSP.vertices[3].z = 0.0f;
gSP.vertices[3].w = 1.0f;
gSP.vertices[3].s = 0;
gSP.vertices[3].t = imageH - 1;
gSP.vertices[3].t = (f32)(imageH - 1);
gDPSetTile( objSprite->imageFmt, objSprite->imageSiz, objSprite->imageStride, objSprite->imageAdrs, 0, objSprite->imagePal, G_TX_CLAMP, G_TX_CLAMP, 0, 0, 0, 0 );
gDPSetTileSize( 0, 0, 0, (imageW - 1) << 2, (imageH - 1) << 2 );