Removes 4 unneeded values in the GL plugin, Makes less buffer underruns in ALSA in DSP_NULL, and case sensitivity so Wii games get just a 'wii' bit farther

git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@216 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
Sonicadvance1 2008-08-14 23:04:24 +00:00
parent 7937befe73
commit 9b676c0a01
9 changed files with 45 additions and 46 deletions

View File

@ -211,26 +211,26 @@ bool CBoot::EmulatedBIOS_Wii(bool _bDebug)
// load settings.txt
{
std::string filename("wii/setting-eur.txt");
std::string filename("WII/setting-eur.txt");
if (VolumeHandler::IsValid())
{
switch(VolumeHandler::GetVolume()->GetCountry())
{
case DiscIO::IVolume::COUNTRY_JAP:
filename = "wii/setting-jpn.txt";
filename = "WII/setting-jpn.txt";
break;
case DiscIO::IVolume::COUNTRY_USA:
filename = "wii/setting-usa.txt";
filename = "WII/setting-usa.txt";
break;
case DiscIO::IVolume::COUNTRY_EUROPE:
filename = "wii/setting-eur.txt";
filename = "WII/setting-eur.txt";
break;
default:
PanicAlert("Unknown country. Wii boot process will be switched to European settings.");
filename = "wii/setting-eur.txt";
filename = "WII/setting-eur.txt";
break;
}
}

View File

@ -49,7 +49,7 @@ CWII_IPC_HLE_Device_FileIO::~CWII_IPC_HLE_Device_FileIO()
bool
CWII_IPC_HLE_Device_FileIO::Open(u32 _CommandAddress)
{
std::string Filename("wii");
std::string Filename("WII");
Filename += GetDeviceName();
m_pFileHandle = fopen(Filename.c_str(), "r+b");

View File

@ -54,7 +54,8 @@ namespace AOSound
}
return(false);*/
ao_play(device, soundData, dwSoundBytes);
if(soundData[0] != 0)
ao_play(device, soundData, dwSoundBytes);
return true;
}

View File

@ -541,7 +541,7 @@ bool SetScissorRect()
PRIM_LOG("scissor: lt=(%d,%d),rb=(%d,%d),off=(%d,%d)\n", rc.left, rc.top, rc.right, rc.bottom, xoff, yoff);
if( rc.right>=rc.left && rc.bottom>=rc.top ) {
glScissor(rc.left<<g_AAx, Renderer::GetTargetHeight()-(rc.bottom<<g_AAy), (rc.right-rc.left)<<g_AAx, (rc.bottom-rc.top)<<g_AAy);
glScissor(rc.left, Renderer::GetTargetHeight()-(rc.bottom), (rc.right-rc.left), (rc.bottom-rc.top));
return true;
}
@ -626,10 +626,10 @@ void LoadBPReg(u32 value0)
u32 nRestoreZBufferTarget = Renderer::GetZBufferTarget();
glViewport(0, 0, Renderer::GetTargetWidth()<<g_AAx, Renderer::GetTargetHeight()<<g_AAy);
glViewport(0, 0, Renderer::GetTargetWidth(), Renderer::GetTargetHeight());
// if copied to texture, set the dimensions to the source copy dims, otherwise, clear the entire buffer
if( PE_copy.copy_to_xfb == 0 )
glScissor(rc.left<<g_AAx, (Renderer::GetTargetHeight()-rc.bottom)<<g_AAy, (rc.right-rc.left)<<g_AAx, (rc.bottom-rc.top)<<g_AAy);
glScissor(rc.left, (Renderer::GetTargetHeight()-rc.bottom), (rc.right-rc.left), (rc.bottom-rc.top));
VertexShaderMngr::SetViewportChanged();
// since clear operations use the source rectangle, have to do regular renders (glClear clears the entire buffer)

View File

@ -51,8 +51,6 @@ extern GLWindow GLWin;
// yeah yeah, these should be hidden
extern int nBackbufferWidth, nBackbufferHeight;
extern u32 s_nTargetWidth, s_nTargetHeight;
extern u32 g_AAx, g_AAy;
bool OpenGL_Create(SVideoInitialize &_VideoInitialize, int _width, int _height);
bool OpenGL_MakeCurrent();

View File

@ -152,7 +152,7 @@ bool Renderer::Create2()
for(int i = 0; i < ARRAYSIZE(s_RenderTargets); ++i) {
glBindTexture(GL_TEXTURE_RECTANGLE_NV, s_RenderTargets[i]);
// initialize to default
glTexImage2D(GL_TEXTURE_RECTANGLE_NV, 0, 4, s_nTargetWidth, s_nTargetHeight, 0, GL_RGBA, GL_UNSIGNED_BYTE, NULL);
glTexImage2D(GL_TEXTURE_RECTANGLE_NV, 0, 4, nBackbufferWidth, nBackbufferHeight, 0, GL_RGBA, GL_UNSIGNED_BYTE, NULL);
glTexParameteri(GL_TEXTURE_RECTANGLE_NV, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
glTexParameteri(GL_TEXTURE_RECTANGLE_NV, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
if( glGetError() != GL_NO_ERROR) {
@ -174,7 +174,7 @@ bool Renderer::Create2()
// create zbuffer target
glGenTextures(1, (GLuint *)&s_ZBufferTarget);
glBindTexture(GL_TEXTURE_RECTANGLE_NV, s_ZBufferTarget);
glTexImage2D(GL_TEXTURE_RECTANGLE_NV, 0, 4, s_nTargetWidth, s_nTargetHeight, 0, GL_RGBA, GL_UNSIGNED_BYTE, NULL);
glTexImage2D(GL_TEXTURE_RECTANGLE_NV, 0, 4, nBackbufferWidth, nBackbufferHeight, 0, GL_RGBA, GL_UNSIGNED_BYTE, NULL);
glTexParameteri(GL_TEXTURE_RECTANGLE_NV, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
glTexParameteri(GL_TEXTURE_RECTANGLE_NV, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
@ -190,9 +190,9 @@ bool Renderer::Create2()
// create the depth buffer
glGenRenderbuffersEXT( 1, (GLuint *)&s_DepthTarget);
glBindRenderbufferEXT(GL_RENDERBUFFER_EXT, s_DepthTarget);
glRenderbufferStorageEXT(GL_RENDERBUFFER_EXT, GL_DEPTH24_STENCIL8_EXT, s_nTargetWidth, s_nTargetHeight);
glRenderbufferStorageEXT(GL_RENDERBUFFER_EXT, GL_DEPTH24_STENCIL8_EXT, nBackbufferWidth, nBackbufferHeight);
if( glGetError() != GL_NO_ERROR ) {
glRenderbufferStorageEXT(GL_RENDERBUFFER_EXT, GL_DEPTH_COMPONENT, s_nTargetWidth, s_nTargetHeight);
glRenderbufferStorageEXT(GL_RENDERBUFFER_EXT, GL_DEPTH_COMPONENT, nBackbufferWidth, nBackbufferHeight);
s_bHaveStencilBuffer = false;
}
else s_bHaveStencilBuffer = true;
@ -310,7 +310,7 @@ bool Renderer::Initialize()
glStencilFunc(GL_ALWAYS, 0, 0);
glBlendFunc(GL_ONE, GL_ONE);
glViewport(0,0,s_nTargetWidth,s_nTargetWidth); // Reset The Current Viewport
glViewport(0,0,GetTargetWidth(),GetTargetHeight()); // Reset The Current Viewport
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
@ -448,10 +448,17 @@ void Renderer::ReinitView(int nNewWidth, int nNewHeight)
nBackbufferWidth = nNewWidth > 16 ? nNewWidth : 16;
nBackbufferHeight = nNewHeight > 16 ? nNewHeight : 16;
}
//TODO: Return correct Values
int Renderer::GetTargetWidth()
{
return s_nTargetWidth;
return 640;
//return nBackbufferWidth;
}
int Renderer::GetTargetHeight()
{
return 480;
//return nBackbufferHeight;
}
bool Renderer::CanBlendLogicOp()
@ -459,11 +466,6 @@ bool Renderer::CanBlendLogicOp()
return g_bBlendLogicOp;
}
int Renderer::GetTargetHeight()
{
return s_nTargetHeight;
}
void Renderer::SetRenderTarget(u32 targ)
{
glFramebufferTexture2DEXT(GL_FRAMEBUFFER_EXT, GL_COLOR_ATTACHMENT0_EXT, GL_TEXTURE_RECTANGLE_NV, targ!=0?targ:s_RenderTargets[s_nCurTarget], 0 );
@ -538,7 +540,7 @@ void Renderer::FlushZBufferAlphaToTarget()
glDrawBuffer(GL_COLOR_ATTACHMENT0_EXT);
glColorMask(GL_FALSE, GL_FALSE, GL_FALSE, GL_TRUE);
glViewport(0, 0, GetTargetWidth()<<g_AAx, GetTargetHeight()<<g_AAy);
glViewport(0, 0, GetTargetWidth(), GetTargetHeight());
// texture map s_RenderTargets[s_curtarget] onto the main buffer
glActiveTexture(GL_TEXTURE0);
@ -554,9 +556,9 @@ void Renderer::FlushZBufferAlphaToTarget()
glBegin(GL_QUADS);
glTexCoord2f(0, 0); glVertex2f(-1,-1);
glTexCoord2f(0, (float)(GetTargetHeight()<<g_AAy)); glVertex2f(-1,1);
glTexCoord2f((float)(GetTargetWidth()<<g_AAx), (float)(GetTargetHeight()<<g_AAy)); glVertex2f(1,1);
glTexCoord2f((float)(GetTargetWidth()<<g_AAx), 0); glVertex2f(1,-1);
glTexCoord2f(0, (float)(GetTargetHeight())); glVertex2f(-1,1);
glTexCoord2f((float)(GetTargetWidth()), (float)(GetTargetHeight())); glVertex2f(1,1);
glTexCoord2f((float)(GetTargetWidth()), 0); glVertex2f(1,-1);
glEnd();
GL_REPORT_ERRORD();
@ -661,9 +663,9 @@ void Renderer::Swap(const TRectangle& rc)
for(int i = 1; i < 8; ++i) TextureMngr::DisableStage(i);
GL_REPORT_ERRORD();
float FactorW = (float)s_nTargetWidth / (float)nBackbufferWidth;
float FactorH = (float)s_nTargetHeight / (float)nBackbufferHeight;
//TODO: Do Correctly in a bit
float FactorW = (float)640 / (float)nBackbufferWidth;
float FactorH = (float)480 / (float)nBackbufferHeight;
float Max = (FactorW < FactorH) ? FactorH : FactorW;
float Temp = 1 / Max;
@ -673,9 +675,9 @@ void Renderer::Swap(const TRectangle& rc)
glBegin(GL_QUADS);
glTexCoord2f(0, 0); glVertex2f(-FactorW,-FactorH);
glTexCoord2f(0, (float)s_nTargetHeight); glVertex2f(-FactorW,FactorH);
glTexCoord2f((float)s_nTargetWidth, (float)s_nTargetHeight); glVertex2f(FactorW,FactorH);
glTexCoord2f((float)s_nTargetWidth, 0); glVertex2f(FactorW,-FactorH);
glTexCoord2f(0, (float)GetTargetHeight()); glVertex2f(-FactorW,FactorH);
glTexCoord2f((float)GetTargetWidth(), (float)GetTargetHeight()); glVertex2f(FactorW,FactorH);
glTexCoord2f((float)GetTargetWidth(), 0); glVertex2f(FactorW,-FactorH);
glEnd();
glBindTexture(GL_TEXTURE_RECTANGLE_NV, 0);
@ -782,24 +784,24 @@ void Renderer::Swap(const TRectangle& rc)
bool Renderer::SaveRenderTarget(const char* filename, int jpeg)
{
bool bflip = true;
vector<u32> data(s_nTargetWidth*s_nTargetHeight);
glReadPixels(0, 0, s_nTargetWidth, s_nTargetHeight, GL_BGRA, GL_UNSIGNED_BYTE, &data[0]);
vector<u32> data(nBackbufferWidth*nBackbufferHeight);
glReadPixels(0, 0, nBackbufferWidth, nBackbufferHeight, GL_BGRA, GL_UNSIGNED_BYTE, &data[0]);
if (glGetError() != GL_NO_ERROR)
return false;
if (bflip) {
// swap scanlines
vector<u32> scanline(s_nTargetWidth);
for(u32 i = 0; i < s_nTargetHeight/2; ++i) {
memcpy(&scanline[0], &data[i*s_nTargetWidth], s_nTargetWidth*4);
memcpy(&data[i*s_nTargetWidth], &data[(s_nTargetHeight-i-1)*s_nTargetWidth], s_nTargetWidth*4);
memcpy(&data[(s_nTargetHeight-i-1)*s_nTargetWidth], &scanline[0], s_nTargetWidth*4);
vector<u32> scanline(nBackbufferWidth);
for(u32 i = 0; i < nBackbufferHeight/2; ++i) {
memcpy(&scanline[0], &data[i*nBackbufferWidth], nBackbufferWidth*4);
memcpy(&data[i*nBackbufferWidth], &data[(nBackbufferHeight-i-1)*nBackbufferWidth], nBackbufferWidth*4);
memcpy(&data[(nBackbufferHeight-i-1)*nBackbufferWidth], &scanline[0], nBackbufferWidth*4);
}
}
if (jpeg) return SaveJPEG(filename, s_nTargetWidth, s_nTargetHeight, &data[0], 70);
if (jpeg) return SaveJPEG(filename, nBackbufferWidth, nBackbufferHeight, &data[0], 70);
return SaveTGA(filename, s_nTargetWidth, s_nTargetHeight, &data[0]);
return SaveTGA(filename, nBackbufferWidth, nBackbufferHeight, &data[0]);
}
void Renderer::SetCgErrorOutput(bool bOutput)

View File

@ -22,7 +22,6 @@
extern CGcontext g_cgcontext;
extern CGprofile g_cgvProf, g_cgfProf;
extern u32 g_AAx, g_AAy; // anti-aliasing
class Renderer
{

View File

@ -322,7 +322,7 @@ void VertexShaderMngr::SetConstants(VERTEXSHADER& vs)
// [5] = 16777215 * farz
INFO_LOG("view: topleft=(%f,%f), wh=(%f,%f), z=(%f,%f)\n",rawViewport[3]-rawViewport[0]-342,rawViewport[4]+rawViewport[1]-342,
2 * rawViewport[0], 2 * rawViewport[1], (rawViewport[5]-rawViewport[2])/16777215.0f, rawViewport[5]/16777215.0f);
glViewport((int)(rawViewport[3]-rawViewport[0]-342)<<g_AAx,Renderer::GetTargetHeight()-((int)(rawViewport[4]-rawViewport[1]-342)<<g_AAy), abs((int)(2 * rawViewport[0])), abs((int)(2 * rawViewport[1])));
glViewport((int)(rawViewport[3]-rawViewport[0]-342),Renderer::GetTargetHeight()-((int)(rawViewport[4]-rawViewport[1]-342)), abs((int)(2 * rawViewport[0])), abs((int)(2 * rawViewport[1])));
glDepthRange((rawViewport[5]-rawViewport[2])/16777215.0f, rawViewport[5]/16777215.0f);
}

View File

@ -18,7 +18,6 @@
// Preliminary non-working code.
#include "Common.h"
#include "Globals.h"
#include "Render.h"
#include "TextureMngr.h"