Assorted warning fixes, small mixer improvement when both DTK and HLE audio are used

git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@1100 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
hrydgard 2008-11-09 13:17:17 +00:00
parent 42a515ba76
commit 530fb9ba3d
11 changed files with 24 additions and 29 deletions

View File

@ -14,6 +14,7 @@
// Official SVN repository and contact information can be found at // Official SVN repository and contact information can be found at
// http://code.google.com/p/dolphin-emu/ // http://code.google.com/p/dolphin-emu/
#include <memory.h> #include <memory.h>
#ifdef _WIN32 #ifdef _WIN32

View File

@ -92,7 +92,7 @@ public:
// Store strings. // Store strings.
void Do(std::string &x) void Do(std::string &x)
{ {
int stringLen = x.length() + 1; int stringLen = (int)x.length() + 1;
Do(stringLen); Do(stringLen);
switch (mode) switch (mode)

View File

@ -104,7 +104,7 @@ void PatchFunctions()
if (symbol > 0) if (symbol > 0)
{ {
u32 HLEPatchValue = (1 & 0x3f) << 26; u32 HLEPatchValue = (1 & 0x3f) << 26;
for (size_t addr = symbol->address; addr < symbol->address + symbol->size; addr += 4) for (u32 addr = symbol->address; addr < symbol->address + symbol->size; addr += 4)
Memory::Write_U32(HLEPatchValue | i, addr); Memory::Write_U32(HLEPatchValue | i, addr);
LOG(HLE,"Patching %s %08x", OSPatches[i].m_szPatchName, symbol->address); LOG(HLE,"Patching %s %08x", OSPatches[i].m_szPatchName, symbol->address);
} }

View File

@ -149,7 +149,7 @@ CWII_IPC_HLE_Device_FileIO::Read(u32 _CommandAddress)
if (m_pFileHandle != NULL) if (m_pFileHandle != NULL)
{ {
size_t readItems = fread(Memory::GetPointer(Address), 1, Size, m_pFileHandle); size_t readItems = fread(Memory::GetPointer(Address), 1, Size, m_pFileHandle);
ReturnValue = readItems; ReturnValue = (u32)readItems;
LOG(WII_IPC_FILEIO, "FileIO reads from %s (Addr=0x%08x Size=0x%x)", GetDeviceName().c_str(), Address, Size); LOG(WII_IPC_FILEIO, "FileIO reads from %s (Addr=0x%08x Size=0x%x)", GetDeviceName().c_str(), Address, Size);
} }
else else

View File

@ -181,7 +181,7 @@ bool CompressFileToBlob(const char* infile, const char* outfile, u32 sub_type,
callback("Files opened, ready to compress.", 0, arg); callback("Files opened, ready to compress.", 0, arg);
fseek(inf, 0, SEEK_END); fseek(inf, 0, SEEK_END);
int insize = ftell(inf); s64 insize = ftell(inf);
fseek(inf, 0, SEEK_SET); fseek(inf, 0, SEEK_SET);
CompressedBlobHeader header; CompressedBlobHeader header;
header.magic_cookie = kBlobCookie; header.magic_cookie = kBlobCookie;

View File

@ -442,7 +442,7 @@ void CUCode_AX::MixAdd(short* _pBuffer, int _iSize)
} // end of the _iSize loop } // end of the _iSize loop
// ============ // ============
if(gVolume) // allow us to turn this off in the debugger if (gVolume) // allow us to turn this off in the debugger
{ {
pb.mixer.volume_left = ADPCM_Vol(pb.mixer.volume_left, pb.mixer.unknown, pb.mixer_control); pb.mixer.volume_left = ADPCM_Vol(pb.mixer.volume_left, pb.mixer.unknown, pb.mixer_control);
pb.mixer.volume_right = ADPCM_Vol(pb.mixer.volume_right, pb.mixer.unknown2, pb.mixer_control); pb.mixer.volume_right = ADPCM_Vol(pb.mixer.volume_right, pb.mixer.unknown2, pb.mixer_control);
@ -457,21 +457,21 @@ void CUCode_AX::MixAdd(short* _pBuffer, int _iSize)
for (int i = 0; i < _iSize; i++) for (int i = 0; i < _iSize; i++)
{ {
// Clamp into 16-bit. Maybe we should add a volume compressor here. // Clamp into 16-bit. Maybe we should add a volume compressor here.
int left = templbuffer[i]; int left = templbuffer[i] + _pBuffer[0];
int right = temprbuffer[i]; int right = temprbuffer[i] + _pBuffer[1];
if (left < -32767) left = -32767; if (left < -32767) left = -32767;
if (left > 32767) left = 32767; if (left > 32767) left = 32767;
if (right < -32767) right = -32767; if (right < -32767) right = -32767;
if (right > 32767) right = 32767; if (right > 32767) right = 32767;
*_pBuffer++ += left; *_pBuffer++ = left;
*_pBuffer++ += right; *_pBuffer++ = right;
} }
// write back out pbs // write back out pbs
WriteBackPBs(PBs, numberOfPBs); WriteBackPBs(PBs, numberOfPBs);
// write logging data to debugger again after the update // write logging data to debugger again after the update
if(m_frame) if (m_frame)
{ {
CUCode_AX::Logging(_pBuffer, _iSize, 1); CUCode_AX::Logging(_pBuffer, _iSize, 1);
} }

View File

@ -317,7 +317,6 @@
AssemblerListingLocation="$(IntDir)\" AssemblerListingLocation="$(IntDir)\"
WarningLevel="3" WarningLevel="3"
WarnAsError="false" WarnAsError="false"
Detect64BitPortabilityProblems="true"
DebugInformationFormat="3" DebugInformationFormat="3"
ForcedIncludeFiles="stdafx.h" ForcedIncludeFiles="stdafx.h"
/> />

View File

@ -664,8 +664,8 @@ void OpenGL_Update()
{ {
MValueX = 1.0f / Max; MValueX = 1.0f / Max;
MValueY = 1.0f / Max; MValueY = 1.0f / Max;
nXoff = (nBackbufferWidth - (640 * MValueX)) / 2; nXoff = (int)((nBackbufferWidth - (640 * MValueX)) / 2);
nYoff = (nBackbufferHeight - (480 * MValueY)) / 2; nYoff = (int)((nBackbufferHeight - (480 * MValueY)) / 2);
} }
// tell the debugger // tell the debugger

View File

@ -68,13 +68,8 @@ NativeVertexFormat::~NativeVertexFormat()
inline GLuint VarToGL(VarType t) inline GLuint VarToGL(VarType t)
{ {
switch (t) { static const GLuint lookup[5] = {GL_BYTE, GL_UNSIGNED_BYTE, GL_SHORT, GL_UNSIGNED_SHORT, GL_FLOAT};
case VAR_BYTE: return GL_BYTE; return lookup[t];
case VAR_UNSIGNED_BYTE: return GL_UNSIGNED_BYTE;
case VAR_SHORT: return GL_SHORT;
case VAR_UNSIGNED_SHORT: return GL_UNSIGNED_SHORT;
case VAR_FLOAT: return GL_FLOAT;
}
return 0; return 0;
} }

View File

@ -232,7 +232,7 @@ TextureMngr::TCacheEntry* TextureMngr::Load(int texstage, u32 address, int width
/*if (width == entry.w && height==entry.h && format==entry.fmt) /*if (width == entry.w && height==entry.h && format==entry.fmt)
{ {
LPDIRECT3DTEXTURE9 tex = entry.texture; LPDIRECT3DTEXTURE9 tex = entry.texture;
int bs = TexDecoder_GetBlockWidthInTexels(format)-1; //TexelSizeInNibbles(format)*width*height/16; int bs = TexDecoder_GetBlockWidthInTexels(format)-1;
int expandedWidth = (width+bs) & (~bs); int expandedWidth = (width+bs) & (~bs);
D3DFORMAT dfmt = TexDecoder_Decode(temp,ptr,expandedWidth,height,format, tlutaddr, tlutfmt); D3DFORMAT dfmt = TexDecoder_Decode(temp,ptr,expandedWidth,height,format, tlutaddr, tlutfmt);
ReplaceTexture2D(tex,temp,width,height,expandedWidth,dfmt); ReplaceTexture2D(tex,temp,width,height,expandedWidth,dfmt);
@ -247,7 +247,7 @@ TextureMngr::TCacheEntry* TextureMngr::Load(int texstage, u32 address, int width
} }
} }
int bs = TexDecoder_GetBlockWidthInTexels(format) - 1; //TexelSizeInNibbles(format)*width*height/16; int bs = TexDecoder_GetBlockWidthInTexels(format) - 1;
int expandedWidth = (width + bs) & (~bs); int expandedWidth = (width + bs) & (~bs);
PC_TexFormat dfmt = TexDecoder_Decode(temp, ptr, expandedWidth, height, format, tlutaddr, tlutfmt); PC_TexFormat dfmt = TexDecoder_Decode(temp, ptr, expandedWidth, height, format, tlutaddr, tlutfmt);
@ -261,9 +261,9 @@ TextureMngr::TCacheEntry* TextureMngr::Load(int texstage, u32 address, int width
((u32 *)ptr)[entry.hashoffset] = entry.hash; ((u32 *)ptr)[entry.hashoffset] = entry.hash;
entry.addr = address; entry.addr = address;
entry.isRenderTarget=false; entry.isRenderTarget = false;
entry.isNonPow2 = ((width&(width-1)) || (height&(height-1))); entry.isNonPow2 = ((width & (width - 1)) || (height & (height - 1)));
glGenTextures(1, (GLuint *)&entry.texture); glGenTextures(1, (GLuint *)&entry.texture);
GLenum target = entry.isNonPow2 ? GL_TEXTURE_RECTANGLE_ARB : GL_TEXTURE_2D; GLenum target = entry.isNonPow2 ? GL_TEXTURE_RECTANGLE_ARB : GL_TEXTURE_2D;
@ -307,7 +307,7 @@ TextureMngr::TCacheEntry* TextureMngr::Load(int texstage, u32 address, int width
} }
INCSTAT(stats.numTexturesCreated); INCSTAT(stats.numTexturesCreated);
SETSTAT(stats.numTexturesAlive,textures.size()); SETSTAT(stats.numTexturesAlive, textures.size());
//glEnable(entry.isNonPow2?GL_TEXTURE_RECTANGLE_ARB:GL_TEXTURE_2D); //glEnable(entry.isNonPow2?GL_TEXTURE_RECTANGLE_ARB:GL_TEXTURE_2D);

View File

@ -367,7 +367,7 @@ void VertexLoader::CompileVertexTranslator()
break; break;
} }
} }
if (j == 8 && !((m_NativeFmt->m_components&VB_HAS_TEXMTXIDXALL) & (VB_HAS_TEXMTXIDXALL<<(i+1)))) // no more tex coords and tex matrices, so exit loop if (j == 8 && !((m_NativeFmt->m_components & VB_HAS_TEXMTXIDXALL) & (VB_HAS_TEXMTXIDXALL << (i + 1)))) // no more tex coords and tex matrices, so exit loop
break; break;
} }
} }
@ -379,7 +379,8 @@ void VertexLoader::CompileVertexTranslator()
PortableVertexDeclaration vtx_decl; PortableVertexDeclaration vtx_decl;
// TODO - merge all the below into the ifs and stuff above.
// Also merge ComputeVertexSize into the result.
int m_components = m_NativeFmt->m_components; int m_components = m_NativeFmt->m_components;
const TVtxAttr &vtx_attr = m_VtxAttr; const TVtxAttr &vtx_attr = m_VtxAttr;
@ -445,7 +446,6 @@ void VertexLoader::CompileVertexTranslator()
// TextureCoord // TextureCoord
for (int i = 0; i < 8; i++) { for (int i = 0; i < 8; i++) {
if (tc[i] != NOT_PRESENT || (m_components & (VB_HAS_TEXMTXIDX0 << i))) { if (tc[i] != NOT_PRESENT || (m_components & (VB_HAS_TEXMTXIDX0 << i))) {
// TODO : More potential disalignment!
if (m_components & (VB_HAS_TEXMTXIDX0 << i)) { if (m_components & (VB_HAS_TEXMTXIDX0 << i)) {
if (tc[i] != NOT_PRESENT) { if (tc[i] != NOT_PRESENT) {
vtx_decl.texcoord_offset[i] = offset; vtx_decl.texcoord_offset[i] = offset;