mirror of
https://github.com/blawar/GLideN64.git
synced 2024-06-25 05:49:34 +00:00
Code refactor: replace NULL by nullptr.
This commit is contained in:
parent
0060d3ea80
commit
86fbea9edc
|
@ -70,7 +70,7 @@ void ColorBufferToRDRAM::_initFBTexture(void)
|
|||
m_pTexture->textureBytes = m_pTexture->realWidth * m_pTexture->realHeight * 4;
|
||||
textureCache().addFrameBufferTextureSize(m_pTexture->textureBytes);
|
||||
glBindTexture(GL_TEXTURE_2D, m_pTexture->glName);
|
||||
glTexImage2D(GL_TEXTURE_2D, 0, fboFormats.colorInternalFormat, m_pTexture->realWidth, m_pTexture->realHeight, 0, fboFormats.colorFormat, fboFormats.colorType, NULL);
|
||||
glTexImage2D(GL_TEXTURE_2D, 0, fboFormats.colorInternalFormat, m_pTexture->realWidth, m_pTexture->realHeight, 0, fboFormats.colorFormat, fboFormats.colorType, nullptr);
|
||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
|
||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
|
||||
glBindTexture(GL_TEXTURE_2D, 0);
|
||||
|
@ -95,14 +95,14 @@ void ColorBufferToRDRAM::_destroyFBTexure(void)
|
|||
|
||||
bool ColorBufferToRDRAM::_prepareCopy(u32 _startAddress)
|
||||
{
|
||||
if (VI.width == 0 || frameBufferList().getCurrent() == NULL)
|
||||
if (VI.width == 0 || frameBufferList().getCurrent() == nullptr)
|
||||
return false;
|
||||
|
||||
OGLVideo & ogl = video();
|
||||
const u32 curFrame = ogl.getBuffersSwapCount();
|
||||
FrameBuffer * pBuffer = frameBufferList().findBuffer(_startAddress);
|
||||
|
||||
if (pBuffer == NULL || pBuffer->m_isOBScreen)
|
||||
if (pBuffer == nullptr || pBuffer->m_isOBScreen)
|
||||
return false;
|
||||
|
||||
if (m_frameCount == curFrame && pBuffer == m_pCurFrameBuffer && m_startAddress != _startAddress)
|
||||
|
|
|
@ -54,7 +54,7 @@ void ColorBufferToRDRAM_GL::_initBuffers(void)
|
|||
// Initialize Pixel Buffer Objects
|
||||
for (u32 i = 0; i < _numPBO; ++i) {
|
||||
glBindBuffer(GL_PIXEL_PACK_BUFFER, m_PBO[i]);
|
||||
glBufferData(GL_PIXEL_PACK_BUFFER, m_pTexture->textureBytes, NULL, GL_DYNAMIC_READ);
|
||||
glBufferData(GL_PIXEL_PACK_BUFFER, m_pTexture->textureBytes, nullptr, GL_DYNAMIC_READ);
|
||||
}
|
||||
glBindBuffer(GL_PIXEL_PACK_BUFFER, 0);
|
||||
}
|
||||
|
|
|
@ -70,12 +70,12 @@ void DepthBufferToRDRAM::init()
|
|||
textureCache().addFrameBufferTextureSize(m_pDepthTexture->textureBytes);
|
||||
|
||||
glBindTexture(GL_TEXTURE_2D, m_pColorTexture->glName);
|
||||
glTexImage2D(GL_TEXTURE_2D, 0, fboFormats.monochromeInternalFormat, m_pColorTexture->realWidth, m_pColorTexture->realHeight, 0, fboFormats.monochromeFormat, fboFormats.monochromeType, NULL);
|
||||
glTexImage2D(GL_TEXTURE_2D, 0, fboFormats.monochromeInternalFormat, m_pColorTexture->realWidth, m_pColorTexture->realHeight, 0, fboFormats.monochromeFormat, fboFormats.monochromeType, nullptr);
|
||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
|
||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
|
||||
|
||||
glBindTexture(GL_TEXTURE_2D, m_pDepthTexture->glName);
|
||||
glTexImage2D(GL_TEXTURE_2D, 0, fboFormats.depthInternalFormat, m_pDepthTexture->realWidth, m_pDepthTexture->realHeight, 0, GL_DEPTH_COMPONENT, fboFormats.depthType, NULL);
|
||||
glTexImage2D(GL_TEXTURE_2D, 0, fboFormats.depthInternalFormat, m_pDepthTexture->realWidth, m_pDepthTexture->realHeight, 0, GL_DEPTH_COMPONENT, fboFormats.depthType, nullptr);
|
||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
|
||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
|
||||
|
||||
|
@ -91,7 +91,7 @@ void DepthBufferToRDRAM::init()
|
|||
// Generate and initialize Pixel Buffer Objects
|
||||
glGenBuffers(1, &m_PBO);
|
||||
glBindBuffer(GL_PIXEL_PACK_BUFFER, m_PBO);
|
||||
glBufferData(GL_PIXEL_PACK_BUFFER, m_pDepthTexture->realWidth * m_pDepthTexture->realHeight * sizeof(float), NULL, GL_DYNAMIC_READ);
|
||||
glBufferData(GL_PIXEL_PACK_BUFFER, m_pDepthTexture->realWidth * m_pDepthTexture->realHeight * sizeof(float), nullptr, GL_DYNAMIC_READ);
|
||||
glBindBuffer(GL_PIXEL_PACK_BUFFER, 0);
|
||||
}
|
||||
|
||||
|
@ -99,13 +99,13 @@ void DepthBufferToRDRAM::destroy() {
|
|||
glBindFramebuffer(GL_DRAW_FRAMEBUFFER, 0);
|
||||
glDeleteFramebuffers(1, &m_FBO);
|
||||
m_FBO = 0;
|
||||
if (m_pColorTexture != NULL) {
|
||||
if (m_pColorTexture != nullptr) {
|
||||
textureCache().removeFrameBufferTexture(m_pColorTexture);
|
||||
m_pColorTexture = NULL;
|
||||
m_pColorTexture = nullptr;
|
||||
}
|
||||
if (m_pDepthTexture != NULL) {
|
||||
if (m_pDepthTexture != nullptr) {
|
||||
textureCache().removeFrameBufferTexture(m_pDepthTexture);
|
||||
m_pDepthTexture = NULL;
|
||||
m_pDepthTexture = nullptr;
|
||||
}
|
||||
if (m_PBO != 0) {
|
||||
glDeleteBuffers(1, &m_PBO);
|
||||
|
@ -123,7 +123,7 @@ bool DepthBufferToRDRAM::_prepareCopy(u32 _address, bool _copyChunk)
|
|||
if (numPixels == 0) // Incorrect buffer size. Don't copy
|
||||
return false;
|
||||
FrameBuffer *pBuffer = frameBufferList().findBuffer(_address);
|
||||
if (pBuffer == NULL || pBuffer->isAuxiliary() || pBuffer->m_pDepthBuffer == NULL || !pBuffer->m_pDepthBuffer->m_cleared)
|
||||
if (pBuffer == nullptr || pBuffer->isAuxiliary() || pBuffer->m_pDepthBuffer == nullptr || !pBuffer->m_pDepthBuffer->m_cleared)
|
||||
return false;
|
||||
|
||||
m_pCurDepthBuffer = pBuffer->m_pDepthBuffer;
|
||||
|
@ -187,7 +187,7 @@ bool DepthBufferToRDRAM::_copy(u32 _startAddress, u32 _endAddress)
|
|||
glReadPixels(x0, y0, width, height, fboFormats.depthFormat, fboFormats.depthType, 0);
|
||||
|
||||
GLubyte* pixelData = (GLubyte*)glMapBufferRange(GL_PIXEL_PACK_BUFFER, 0, width * height * fboFormats.depthFormatBytes, GL_MAP_READ_BIT);
|
||||
if (pixelData == NULL)
|
||||
if (pixelData == nullptr)
|
||||
return false;
|
||||
|
||||
f32 * ptr_src = (f32*)pixelData;
|
||||
|
@ -199,7 +199,7 @@ bool DepthBufferToRDRAM::_copy(u32 _startAddress, u32 _endAddress)
|
|||
|
||||
m_pCurDepthBuffer->m_cleared = false;
|
||||
FrameBuffer * pBuffer = frameBufferList().findBuffer(m_pCurDepthBuffer->m_address);
|
||||
if (pBuffer != NULL)
|
||||
if (pBuffer != nullptr)
|
||||
pBuffer->m_cleared = false;
|
||||
|
||||
glUnmapBuffer(GL_PIXEL_PACK_BUFFER);
|
||||
|
|
|
@ -37,7 +37,7 @@ void RDRAMtoColorBuffer::init()
|
|||
m_pTexture->textureBytes = m_pTexture->realWidth * m_pTexture->realHeight * 4;
|
||||
textureCache().addFrameBufferTextureSize(m_pTexture->textureBytes);
|
||||
glBindTexture( GL_TEXTURE_2D, m_pTexture->glName );
|
||||
glTexImage2D(GL_TEXTURE_2D, 0, fboFormats.colorInternalFormat, m_pTexture->realWidth, m_pTexture->realHeight, 0, fboFormats.colorFormat, fboFormats.colorType, NULL);
|
||||
glTexImage2D(GL_TEXTURE_2D, 0, fboFormats.colorInternalFormat, m_pTexture->realWidth, m_pTexture->realHeight, 0, fboFormats.colorFormat, fboFormats.colorType, nullptr);
|
||||
glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR );
|
||||
glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR );
|
||||
glBindTexture(GL_TEXTURE_2D, 0);
|
||||
|
@ -50,9 +50,9 @@ void RDRAMtoColorBuffer::init()
|
|||
|
||||
void RDRAMtoColorBuffer::destroy()
|
||||
{
|
||||
if (m_pTexture != NULL) {
|
||||
if (m_pTexture != nullptr) {
|
||||
textureCache().removeFrameBufferTexture(m_pTexture);
|
||||
m_pTexture = NULL;
|
||||
m_pTexture = nullptr;
|
||||
}
|
||||
#ifndef GLES2
|
||||
if (m_PBO != 0) {
|
||||
|
@ -193,13 +193,13 @@ void RDRAMtoColorBuffer::copyFromRDRAM(u32 _address, bool _bCFB)
|
|||
const u32 dataSize = width*height * 4;
|
||||
#ifndef GLES2
|
||||
PBOBinder binder(GL_PIXEL_UNPACK_BUFFER, m_PBO);
|
||||
glBufferData(GL_PIXEL_UNPACK_BUFFER, dataSize, NULL, GL_DYNAMIC_DRAW);
|
||||
glBufferData(GL_PIXEL_UNPACK_BUFFER, dataSize, nullptr, GL_DYNAMIC_DRAW);
|
||||
GLubyte* ptr = (GLubyte*)glMapBufferRange(GL_PIXEL_UNPACK_BUFFER, 0, dataSize, GL_MAP_WRITE_BIT);
|
||||
#else
|
||||
GLubyte* ptr = (GLubyte*)malloc(dataSize);
|
||||
PBOBinder binder(ptr);
|
||||
#endif // GLES2
|
||||
if (ptr == NULL)
|
||||
if (ptr == nullptr)
|
||||
return;
|
||||
|
||||
u32 * dst = (u32*)ptr;
|
||||
|
|
|
@ -97,7 +97,7 @@ CombinerInfo & CombinerInfo::get()
|
|||
|
||||
void CombinerInfo::init()
|
||||
{
|
||||
m_pCurrent = NULL;
|
||||
m_pCurrent = nullptr;
|
||||
m_pUniformCollection = createUniformCollection();
|
||||
GLint numBinaryFormats = 0;
|
||||
#ifdef GL_NUM_PROGRAM_BINARY_FORMATS
|
||||
|
@ -118,8 +118,8 @@ void CombinerInfo::init()
|
|||
void CombinerInfo::destroy()
|
||||
{
|
||||
delete m_pUniformCollection;
|
||||
m_pUniformCollection = NULL;
|
||||
m_pCurrent = NULL;
|
||||
m_pUniformCollection = nullptr;
|
||||
m_pCurrent = nullptr;
|
||||
if (m_bShaderCacheSupported)
|
||||
_saveShadersStorage();
|
||||
m_shadersLoaded = 0;
|
||||
|
@ -262,7 +262,7 @@ void CombinerInfo::update()
|
|||
void CombinerInfo::setCombine(u64 _mux )
|
||||
{
|
||||
const u64 key = getCombinerKey(_mux);
|
||||
if (m_pCurrent != NULL && m_pCurrent->getKey() == key) {
|
||||
if (m_pCurrent != nullptr && m_pCurrent->getKey() == key) {
|
||||
m_bChanged = false;
|
||||
m_pCurrent->update(false);
|
||||
return;
|
||||
|
@ -282,37 +282,37 @@ void CombinerInfo::setCombine(u64 _mux )
|
|||
|
||||
void CombinerInfo::updatePrimColor()
|
||||
{
|
||||
if (m_pUniformCollection != NULL)
|
||||
if (m_pUniformCollection != nullptr)
|
||||
m_pUniformCollection->setColorData(UniformCollection::cuPrimColor, sizeof(f32)* 5, &gDP.primColor.r);
|
||||
}
|
||||
|
||||
void CombinerInfo::updateEnvColor()
|
||||
{
|
||||
if (m_pUniformCollection != NULL)
|
||||
if (m_pUniformCollection != nullptr)
|
||||
m_pUniformCollection->setColorData(UniformCollection::cuEnvColor, sizeof(f32)* 4, &gDP.envColor.r);
|
||||
}
|
||||
|
||||
void CombinerInfo::updateFogColor()
|
||||
{
|
||||
if (m_pUniformCollection != NULL)
|
||||
if (m_pUniformCollection != nullptr)
|
||||
m_pUniformCollection->setColorData(UniformCollection::cuFogColor, sizeof(f32)* 4, &gDP.fogColor.r);
|
||||
}
|
||||
|
||||
void CombinerInfo::updateBlendColor()
|
||||
{
|
||||
if (m_pUniformCollection != NULL)
|
||||
if (m_pUniformCollection != nullptr)
|
||||
m_pUniformCollection->setColorData(UniformCollection::cuBlendColor, sizeof(f32)* 4, &gDP.blendColor.r);
|
||||
}
|
||||
|
||||
void CombinerInfo::updateKeyColor()
|
||||
{
|
||||
if (m_pUniformCollection != NULL)
|
||||
if (m_pUniformCollection != nullptr)
|
||||
m_pUniformCollection->setColorData(UniformCollection::cuCenterColor, sizeof(f32)* 8, &gDP.key.center.r);
|
||||
}
|
||||
|
||||
void CombinerInfo::updateConvertColor()
|
||||
{
|
||||
if (m_pUniformCollection == NULL)
|
||||
if (m_pUniformCollection == nullptr)
|
||||
return;
|
||||
f32 convert[2] = { gDP.convert.k4*0.0039215689f, gDP.convert.k5*0.0039215689f };
|
||||
m_pUniformCollection->setColorData(UniformCollection::cuK4, sizeof(convert), convert);
|
||||
|
@ -320,20 +320,20 @@ void CombinerInfo::updateConvertColor()
|
|||
|
||||
void CombinerInfo::updateTextureParameters()
|
||||
{
|
||||
if (m_pUniformCollection != NULL)
|
||||
if (m_pUniformCollection != nullptr)
|
||||
m_pUniformCollection->updateTextureParameters();
|
||||
}
|
||||
|
||||
void CombinerInfo::updateLightParameters()
|
||||
{
|
||||
if (m_pUniformCollection != NULL)
|
||||
if (m_pUniformCollection != nullptr)
|
||||
m_pUniformCollection->updateLightParameters();
|
||||
gSP.changed &= ~CHANGED_LIGHT;
|
||||
}
|
||||
|
||||
void CombinerInfo::updateParameters(OGLRender::RENDER_STATE _renderState)
|
||||
{
|
||||
if (m_pUniformCollection != NULL)
|
||||
if (m_pUniformCollection != nullptr)
|
||||
m_pUniformCollection->updateUniforms(m_pCurrent, _renderState);
|
||||
}
|
||||
|
||||
|
|
|
@ -148,7 +148,7 @@ private:
|
|||
, m_bShaderCacheSupported(false)
|
||||
, m_shadersLoaded(0)
|
||||
, m_configOptionsBitSet(0)
|
||||
, m_pCurrent(NULL) {}
|
||||
, m_pCurrent(nullptr) {}
|
||||
CombinerInfo(const CombinerInfo &);
|
||||
|
||||
void _saveShadersStorage() const;
|
||||
|
|
|
@ -17,9 +17,9 @@ const GLuint TlutImageUnit = 1;
|
|||
const GLuint depthImageUnit = 2;
|
||||
|
||||
DepthBuffer::DepthBuffer() : m_address(0), m_width(0), m_uly(0), m_lry(0),
|
||||
m_depthImageFBO(0), m_pDepthImageTexture(NULL), m_pDepthBufferTexture(NULL),
|
||||
m_cleared(false), m_pResolveDepthBufferTexture(NULL), m_resolved(false),
|
||||
m_pDepthBufferCopyTexture(NULL), m_copied(false)
|
||||
m_depthImageFBO(0), m_pDepthImageTexture(nullptr), m_pDepthBufferTexture(nullptr),
|
||||
m_cleared(false), m_pResolveDepthBufferTexture(nullptr), m_resolved(false),
|
||||
m_pDepthBufferCopyTexture(nullptr), m_copied(false)
|
||||
{
|
||||
glGenFramebuffers(1, &m_copyFBO);
|
||||
if (video().getRender().isImageTexturesSupported() && config.frameBufferEmulation.N64DepthCompare != 0)
|
||||
|
@ -33,11 +33,11 @@ DepthBuffer::DepthBuffer(DepthBuffer && _other) :
|
|||
m_pDepthBufferCopyTexture(_other.m_pDepthBufferCopyTexture), m_copied(m_copied)
|
||||
{
|
||||
_other.m_depthImageFBO = 0;
|
||||
_other.m_pDepthImageTexture = NULL;
|
||||
_other.m_pDepthBufferTexture = NULL;
|
||||
_other.m_pResolveDepthBufferTexture = NULL;
|
||||
_other.m_pDepthImageTexture = nullptr;
|
||||
_other.m_pDepthBufferTexture = nullptr;
|
||||
_other.m_pResolveDepthBufferTexture = nullptr;
|
||||
_other.m_resolved = false;
|
||||
_other.m_pDepthBufferCopyTexture = NULL;
|
||||
_other.m_pDepthBufferCopyTexture = nullptr;
|
||||
_other.m_copied = false;
|
||||
}
|
||||
|
||||
|
@ -45,22 +45,22 @@ DepthBuffer::~DepthBuffer()
|
|||
{
|
||||
if (m_depthImageFBO != 0)
|
||||
glDeleteFramebuffers(1, &m_depthImageFBO);
|
||||
if (m_pDepthImageTexture != NULL)
|
||||
if (m_pDepthImageTexture != nullptr)
|
||||
textureCache().removeFrameBufferTexture(m_pDepthImageTexture);
|
||||
if (m_pDepthBufferTexture != NULL)
|
||||
if (m_pDepthBufferTexture != nullptr)
|
||||
textureCache().removeFrameBufferTexture(m_pDepthBufferTexture);
|
||||
if (m_pResolveDepthBufferTexture != NULL)
|
||||
if (m_pResolveDepthBufferTexture != nullptr)
|
||||
textureCache().removeFrameBufferTexture(m_pResolveDepthBufferTexture);
|
||||
if (m_copyFBO != 0)
|
||||
glDeleteFramebuffers(1, &m_copyFBO);
|
||||
if (m_pDepthBufferCopyTexture != NULL)
|
||||
if (m_pDepthBufferCopyTexture != nullptr)
|
||||
textureCache().removeFrameBufferTexture(m_pDepthBufferCopyTexture);
|
||||
}
|
||||
|
||||
void DepthBuffer::initDepthImageTexture(FrameBuffer * _pBuffer)
|
||||
{
|
||||
#ifdef GL_IMAGE_TEXTURES_SUPPORT
|
||||
if (!video().getRender().isImageTexturesSupported() || config.frameBufferEmulation.N64DepthCompare == 0 || m_pDepthImageTexture != NULL)
|
||||
if (!video().getRender().isImageTexturesSupported() || config.frameBufferEmulation.N64DepthCompare == 0 || m_pDepthImageTexture != nullptr)
|
||||
return;
|
||||
|
||||
m_pDepthImageTexture = textureCache().addFrameBufferTexture();
|
||||
|
@ -85,7 +85,7 @@ void DepthBuffer::initDepthImageTexture(FrameBuffer * _pBuffer)
|
|||
textureCache().addFrameBufferTextureSize(m_pDepthImageTexture->textureBytes);
|
||||
|
||||
glBindTexture(GL_TEXTURE_2D, m_pDepthImageTexture->glName);
|
||||
glTexImage2D(GL_TEXTURE_2D, 0, fboFormats.depthImageInternalFormat, m_pDepthImageTexture->realWidth, m_pDepthImageTexture->realHeight, 0, fboFormats.depthImageFormat, fboFormats.depthImageType, NULL);
|
||||
glTexImage2D(GL_TEXTURE_2D, 0, fboFormats.depthImageInternalFormat, m_pDepthImageTexture->realWidth, m_pDepthImageTexture->realHeight, 0, fboFormats.depthImageFormat, fboFormats.depthImageType, nullptr);
|
||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
|
||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
|
||||
glBindTexture(GL_TEXTURE_2D, 0);
|
||||
|
@ -102,7 +102,7 @@ void DepthBuffer::initDepthImageTexture(FrameBuffer * _pBuffer)
|
|||
|
||||
void DepthBuffer::_initDepthBufferTexture(FrameBuffer * _pBuffer, CachedTexture * _pTexture, bool _multisample)
|
||||
{
|
||||
if (_pBuffer != NULL) {
|
||||
if (_pBuffer != nullptr) {
|
||||
_pTexture->width = (u32)(_pBuffer->m_pTexture->width);
|
||||
_pTexture->height = (u32)(_pBuffer->m_pTexture->height);
|
||||
_pTexture->address = _pBuffer->m_startAddress;
|
||||
|
@ -148,7 +148,7 @@ void DepthBuffer::_initDepthBufferTexture(FrameBuffer * _pBuffer, CachedTexture
|
|||
#endif // GL_MULTISAMPLING_SUPPORT
|
||||
{
|
||||
glBindTexture(GL_TEXTURE_2D, _pTexture->glName);
|
||||
glTexImage2D(GL_TEXTURE_2D, 0, fboFormats.depthInternalFormat, _pTexture->realWidth, _pTexture->realHeight, 0, GL_DEPTH_COMPONENT, fboFormats.depthType, NULL);
|
||||
glTexImage2D(GL_TEXTURE_2D, 0, fboFormats.depthInternalFormat, _pTexture->realWidth, _pTexture->realHeight, 0, GL_DEPTH_COMPONENT, fboFormats.depthType, nullptr);
|
||||
|
||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
|
||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
|
||||
|
@ -170,13 +170,13 @@ void DepthBuffer::setDepthAttachment(GLenum _target)
|
|||
|
||||
void DepthBuffer::initDepthBufferTexture(FrameBuffer * _pBuffer)
|
||||
{
|
||||
if (m_pDepthBufferTexture == NULL) {
|
||||
if (m_pDepthBufferTexture == nullptr) {
|
||||
m_pDepthBufferTexture = textureCache().addFrameBufferTexture();
|
||||
_initDepthBufferTexture(_pBuffer, m_pDepthBufferTexture, config.video.multisampling != 0);
|
||||
}
|
||||
|
||||
#ifdef GL_MULTISAMPLING_SUPPORT
|
||||
if (config.video.multisampling != 0 && m_pResolveDepthBufferTexture == NULL) {
|
||||
if (config.video.multisampling != 0 && m_pResolveDepthBufferTexture == nullptr) {
|
||||
m_pResolveDepthBufferTexture = textureCache().addFrameBufferTexture();
|
||||
_initDepthBufferTexture(_pBuffer, m_pResolveDepthBufferTexture, false);
|
||||
}
|
||||
|
@ -220,7 +220,7 @@ CachedTexture * DepthBuffer::copyDepthBufferTexture(FrameBuffer * _pBuffer)
|
|||
if (m_copied)
|
||||
return m_pDepthBufferCopyTexture;
|
||||
|
||||
if (m_pDepthBufferCopyTexture == NULL) {
|
||||
if (m_pDepthBufferCopyTexture == nullptr) {
|
||||
m_pDepthBufferCopyTexture = textureCache().addFrameBufferTexture();
|
||||
_initDepthBufferTexture(_pBuffer, m_pDepthBufferCopyTexture, false);
|
||||
}
|
||||
|
@ -269,7 +269,7 @@ void DepthBuffer::bindDepthImageTexture()
|
|||
#endif
|
||||
}
|
||||
|
||||
DepthBufferList::DepthBufferList() : m_pCurrent(NULL), m_pzLUT(NULL)
|
||||
DepthBufferList::DepthBufferList() : m_pCurrent(nullptr), m_pzLUT(nullptr)
|
||||
{
|
||||
m_pzLUT = new u16[0x40000];
|
||||
for (int i = 0; i<0x40000; i++) {
|
||||
|
@ -288,7 +288,7 @@ DepthBufferList::DepthBufferList() : m_pCurrent(NULL), m_pzLUT(NULL)
|
|||
DepthBufferList::~DepthBufferList()
|
||||
{
|
||||
delete[] m_pzLUT;
|
||||
m_pzLUT = NULL;
|
||||
m_pzLUT = nullptr;
|
||||
m_list.clear();
|
||||
}
|
||||
|
||||
|
@ -300,12 +300,12 @@ DepthBufferList & DepthBufferList::get()
|
|||
|
||||
void DepthBufferList::init()
|
||||
{
|
||||
m_pCurrent = NULL;
|
||||
m_pCurrent = nullptr;
|
||||
}
|
||||
|
||||
void DepthBufferList::destroy()
|
||||
{
|
||||
m_pCurrent = NULL;
|
||||
m_pCurrent = nullptr;
|
||||
m_list.clear();
|
||||
}
|
||||
|
||||
|
@ -320,7 +320,7 @@ DepthBuffer * DepthBufferList::findBuffer(u32 _address)
|
|||
for (DepthBuffers::iterator iter = m_list.begin(); iter != m_list.end(); ++iter)
|
||||
if (iter->m_address == _address)
|
||||
return &(*iter);
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
void DepthBufferList::removeBuffer(u32 _address )
|
||||
|
@ -339,23 +339,23 @@ void DepthBufferList::saveBuffer(u32 _address)
|
|||
return;
|
||||
|
||||
FrameBuffer * pFrameBuffer = frameBufferList().findBuffer(_address);
|
||||
if (pFrameBuffer != NULL)
|
||||
if (pFrameBuffer != nullptr)
|
||||
pFrameBuffer->m_isDepthBuffer = true;
|
||||
|
||||
if (m_pCurrent == NULL || m_pCurrent->m_address != _address)
|
||||
if (m_pCurrent == nullptr || m_pCurrent->m_address != _address)
|
||||
m_pCurrent = findBuffer(_address);
|
||||
|
||||
if (m_pCurrent != NULL && pFrameBuffer != NULL && m_pCurrent->m_width != pFrameBuffer->m_width) {
|
||||
if (m_pCurrent != nullptr && pFrameBuffer != nullptr && m_pCurrent->m_width != pFrameBuffer->m_width) {
|
||||
removeBuffer(_address);
|
||||
m_pCurrent = NULL;
|
||||
m_pCurrent = nullptr;
|
||||
}
|
||||
|
||||
if (m_pCurrent == NULL) {
|
||||
if (m_pCurrent == nullptr) {
|
||||
m_list.emplace_front();
|
||||
DepthBuffer & buffer = m_list.front();
|
||||
|
||||
buffer.m_address = _address;
|
||||
buffer.m_width = pFrameBuffer != NULL ? pFrameBuffer->m_width : VI.width;
|
||||
buffer.m_width = pFrameBuffer != nullptr ? pFrameBuffer->m_width : VI.width;
|
||||
|
||||
buffer.initDepthBufferTexture(pFrameBuffer);
|
||||
|
||||
|
@ -366,7 +366,7 @@ void DepthBufferList::saveBuffer(u32 _address)
|
|||
|
||||
#ifdef DEBUG
|
||||
DebugMsg( DEBUG_HIGH | DEBUG_HANDLED, "DepthBuffer_SetBuffer( 0x%08X ); color buffer is 0x%08X\n",
|
||||
address, ( pFrameBuffer != NULL && pFrameBuffer->m_FBO > 0) ? pFrameBuffer->m_startAddress : 0
|
||||
address, ( pFrameBuffer != nullptr && pFrameBuffer->m_FBO > 0) ? pFrameBuffer->m_startAddress : 0
|
||||
);
|
||||
#endif
|
||||
|
||||
|
@ -374,7 +374,7 @@ void DepthBufferList::saveBuffer(u32 _address)
|
|||
|
||||
void DepthBufferList::clearBuffer(u32 _uly, u32 _lry)
|
||||
{
|
||||
if (m_pCurrent == NULL)
|
||||
if (m_pCurrent == nullptr)
|
||||
return;
|
||||
m_pCurrent->m_cleared = true;
|
||||
m_pCurrent->m_uly = _uly;
|
||||
|
|
|
@ -31,9 +31,9 @@ FrameBuffer::FrameBuffer() :
|
|||
m_scaleX(0), m_scaleY(0),
|
||||
m_copiedToRdram(false), m_fingerprint(false), m_cleared(false), m_changed(false), m_cfb(false),
|
||||
m_isDepthBuffer(false), m_isPauseScreen(false), m_isOBScreen(false), m_needHeightCorrection(false),
|
||||
m_loadType(LOADTYPE_BLOCK), m_pDepthBuffer(NULL),
|
||||
m_resolveFBO(0), m_pResolveTexture(NULL), m_resolved(false),
|
||||
m_SubFBO(0), m_pSubTexture(NULL)
|
||||
m_loadType(LOADTYPE_BLOCK), m_pDepthBuffer(nullptr),
|
||||
m_resolveFBO(0), m_pResolveTexture(nullptr), m_resolved(false),
|
||||
m_SubFBO(0), m_pSubTexture(nullptr)
|
||||
{
|
||||
m_loadTileOrigin.uls = m_loadTileOrigin.ult = 0;
|
||||
m_pTexture = textureCache().addFrameBufferTexture();
|
||||
|
@ -54,13 +54,13 @@ FrameBuffer::FrameBuffer(FrameBuffer && _other) :
|
|||
m_RdramCopy(_other.m_RdramCopy)
|
||||
{
|
||||
_other.m_FBO = 0;
|
||||
_other.m_pTexture = NULL;
|
||||
_other.m_pDepthBuffer = NULL;
|
||||
_other.m_pResolveTexture = NULL;
|
||||
_other.m_pTexture = nullptr;
|
||||
_other.m_pDepthBuffer = nullptr;
|
||||
_other.m_pResolveTexture = nullptr;
|
||||
_other.m_resolveFBO = 0;
|
||||
_other.m_RdramCopy.clear();
|
||||
_other.m_SubFBO = 0;
|
||||
_other.m_pSubTexture = NULL;
|
||||
_other.m_pSubTexture = nullptr;
|
||||
}
|
||||
|
||||
|
||||
|
@ -68,15 +68,15 @@ FrameBuffer::~FrameBuffer()
|
|||
{
|
||||
if (m_FBO != 0)
|
||||
glDeleteFramebuffers(1, &m_FBO);
|
||||
if (m_pTexture != NULL)
|
||||
if (m_pTexture != nullptr)
|
||||
textureCache().removeFrameBufferTexture(m_pTexture);
|
||||
if (m_resolveFBO != 0)
|
||||
glDeleteFramebuffers(1, &m_resolveFBO);
|
||||
if (m_pResolveTexture != NULL)
|
||||
if (m_pResolveTexture != nullptr)
|
||||
textureCache().removeFrameBufferTexture(m_pResolveTexture);
|
||||
if (m_SubFBO != 0)
|
||||
glDeleteFramebuffers(1, &m_SubFBO);
|
||||
if (m_pSubTexture != NULL)
|
||||
if (m_pSubTexture != nullptr)
|
||||
textureCache().removeFrameBufferTexture(m_pSubTexture);
|
||||
}
|
||||
|
||||
|
@ -110,9 +110,9 @@ void FrameBuffer::_setAndAttachTexture(u16 _size, CachedTexture *_pTexture)
|
|||
{
|
||||
glBindTexture(GL_TEXTURE_2D, _pTexture->glName);
|
||||
if (_size > G_IM_SIZ_8b)
|
||||
glTexImage2D(GL_TEXTURE_2D, 0, fboFormats.colorInternalFormat, _pTexture->realWidth, _pTexture->realHeight, 0, fboFormats.colorFormat, fboFormats.colorType, NULL);
|
||||
glTexImage2D(GL_TEXTURE_2D, 0, fboFormats.colorInternalFormat, _pTexture->realWidth, _pTexture->realHeight, 0, fboFormats.colorFormat, fboFormats.colorType, nullptr);
|
||||
else
|
||||
glTexImage2D(GL_TEXTURE_2D, 0, fboFormats.monochromeInternalFormat, _pTexture->realWidth, _pTexture->realHeight, 0, fboFormats.monochromeFormat, fboFormats.monochromeType, NULL);
|
||||
glTexImage2D(GL_TEXTURE_2D, 0, fboFormats.monochromeInternalFormat, _pTexture->realWidth, _pTexture->realHeight, 0, fboFormats.monochromeFormat, fboFormats.monochromeType, nullptr);
|
||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
|
||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
|
||||
|
||||
|
@ -197,11 +197,11 @@ void FrameBuffer::reinit(u16 _height)
|
|||
{
|
||||
const u16 format = m_pTexture->format;
|
||||
const u32 endAddress = m_startAddress + ((m_width * _height) << m_size >> 1) - 1;
|
||||
if (m_pTexture != NULL)
|
||||
if (m_pTexture != nullptr)
|
||||
textureCache().removeFrameBufferTexture(m_pTexture);
|
||||
if (m_resolveFBO != 0)
|
||||
glDeleteFramebuffers(1, &m_resolveFBO);
|
||||
if (m_pResolveTexture != NULL)
|
||||
if (m_pResolveTexture != nullptr)
|
||||
textureCache().removeFrameBufferTexture(m_pResolveTexture);
|
||||
m_pTexture = textureCache().addFrameBufferTexture();
|
||||
init(m_startAddress, endAddress, format, m_size, m_width, _height, m_cfb);
|
||||
|
@ -324,7 +324,7 @@ bool FrameBuffer::_initSubTexture(u32 _t)
|
|||
const u32 width = pTile->lrs - pTile->uls + 1;
|
||||
const u32 height = pTile->lrt - pTile->ult + 1;
|
||||
|
||||
if (m_pSubTexture != NULL) {
|
||||
if (m_pSubTexture != nullptr) {
|
||||
if (m_pSubTexture->size == m_pTexture->size &&
|
||||
m_pSubTexture->clampWidth == width &&
|
||||
m_pSubTexture->clampHeight == height)
|
||||
|
@ -343,9 +343,9 @@ bool FrameBuffer::_initSubTexture(u32 _t)
|
|||
glActiveTexture(GL_TEXTURE0 + _t);
|
||||
glBindTexture(GL_TEXTURE_2D, m_pSubTexture->glName);
|
||||
if (m_pSubTexture->size > G_IM_SIZ_8b)
|
||||
glTexImage2D(GL_TEXTURE_2D, 0, fboFormats.colorInternalFormat, m_pSubTexture->realWidth, m_pSubTexture->realHeight, 0, fboFormats.colorFormat, fboFormats.colorType, NULL);
|
||||
glTexImage2D(GL_TEXTURE_2D, 0, fboFormats.colorInternalFormat, m_pSubTexture->realWidth, m_pSubTexture->realHeight, 0, fboFormats.colorFormat, fboFormats.colorType, nullptr);
|
||||
else
|
||||
glTexImage2D(GL_TEXTURE_2D, 0, fboFormats.monochromeInternalFormat, m_pSubTexture->realWidth, m_pSubTexture->realHeight, 0, fboFormats.monochromeFormat, fboFormats.monochromeType, NULL);
|
||||
glTexImage2D(GL_TEXTURE_2D, 0, fboFormats.monochromeInternalFormat, m_pSubTexture->realWidth, m_pSubTexture->realHeight, 0, fboFormats.monochromeFormat, fboFormats.monochromeType, nullptr);
|
||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
|
||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
|
||||
|
||||
|
@ -444,23 +444,23 @@ FrameBufferList & FrameBufferList::get()
|
|||
|
||||
void FrameBufferList::init()
|
||||
{
|
||||
m_pCurrent = NULL;
|
||||
m_pCopy = NULL;
|
||||
m_pCurrent = nullptr;
|
||||
m_pCopy = nullptr;
|
||||
glBindFramebuffer(GL_DRAW_FRAMEBUFFER, 0);
|
||||
m_prevColorImageHeight = 0;
|
||||
}
|
||||
|
||||
void FrameBufferList::destroy() {
|
||||
m_list.clear();
|
||||
m_pCurrent = NULL;
|
||||
m_pCopy = NULL;
|
||||
m_pCurrent = nullptr;
|
||||
m_pCopy = nullptr;
|
||||
glBindFramebuffer(GL_DRAW_FRAMEBUFFER, 0);
|
||||
}
|
||||
|
||||
void FrameBufferList::setBufferChanged()
|
||||
{
|
||||
gDP.colorImage.changed = TRUE;
|
||||
if (m_pCurrent != NULL) {
|
||||
if (m_pCurrent != nullptr) {
|
||||
m_pCurrent->m_changed = true;
|
||||
m_pCurrent->m_copiedToRdram = false;
|
||||
}
|
||||
|
@ -468,7 +468,7 @@ void FrameBufferList::setBufferChanged()
|
|||
|
||||
void FrameBufferList::correctHeight()
|
||||
{
|
||||
if (m_pCurrent == NULL)
|
||||
if (m_pCurrent == nullptr)
|
||||
return;
|
||||
if (m_pCurrent->m_changed) {
|
||||
m_pCurrent->m_needHeightCorrection = false;
|
||||
|
@ -490,7 +490,7 @@ void FrameBufferList::clearBuffersChanged()
|
|||
{
|
||||
gDP.colorImage.changed = FALSE;
|
||||
FrameBuffer * pBuffer = frameBufferList().findBuffer(*REG.VI_ORIGIN);
|
||||
if (pBuffer != NULL)
|
||||
if (pBuffer != nullptr)
|
||||
pBuffer->m_changed = false;
|
||||
}
|
||||
|
||||
|
@ -505,13 +505,13 @@ FrameBuffer * FrameBufferList::findBuffer(u32 _startAddress)
|
|||
for (FrameBuffers::iterator iter = m_list.begin(); iter != m_list.end(); ++iter)
|
||||
if (iter->m_startAddress <= _startAddress && iter->m_endAddress >= _startAddress) // [ { ]
|
||||
return &(*iter);
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
FrameBuffer * FrameBufferList::_findBuffer(u32 _startAddress, u32 _endAddress, u32 _width)
|
||||
{
|
||||
if (m_list.empty())
|
||||
return NULL;
|
||||
return nullptr;
|
||||
|
||||
FrameBuffers::iterator iter = m_list.end();
|
||||
do {
|
||||
|
@ -527,7 +527,7 @@ FrameBuffer * FrameBufferList::_findBuffer(u32 _startAddress, u32 _endAddress, u
|
|||
return &(*iter);
|
||||
}
|
||||
} while (iter != m_list.begin());
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
FrameBuffer * FrameBufferList::findTmpBuffer(u32 _address)
|
||||
|
@ -535,12 +535,12 @@ FrameBuffer * FrameBufferList::findTmpBuffer(u32 _address)
|
|||
for (FrameBuffers::iterator iter = m_list.begin(); iter != m_list.end(); ++iter)
|
||||
if (iter->m_startAddress > _address || iter->m_endAddress < _address)
|
||||
return &(*iter);
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
void FrameBufferList::saveBuffer(u32 _address, u16 _format, u16 _size, u16 _width, u16 _height, bool _cfb)
|
||||
{
|
||||
if (m_pCurrent != NULL && config.frameBufferEmulation.copyAuxToRDRAM != 0) {
|
||||
if (m_pCurrent != nullptr && config.frameBufferEmulation.copyAuxToRDRAM != 0) {
|
||||
if (m_pCurrent->isAuxiliary()) {
|
||||
FrameBuffer_CopyToRDRAM(m_pCurrent->m_startAddress, true);
|
||||
removeBuffer(m_pCurrent->m_startAddress);
|
||||
|
@ -548,13 +548,13 @@ void FrameBufferList::saveBuffer(u32 _address, u16 _format, u16 _size, u16 _widt
|
|||
}
|
||||
|
||||
if (VI.width == 0 || _height == 0) {
|
||||
m_pCurrent = NULL;
|
||||
m_pCurrent = nullptr;
|
||||
glBindFramebuffer(GL_DRAW_FRAMEBUFFER, 0);
|
||||
return;
|
||||
}
|
||||
|
||||
OGLVideo & ogl = video();
|
||||
if (m_pCurrent != NULL) {
|
||||
if (m_pCurrent != nullptr) {
|
||||
// Correct buffer's end address
|
||||
if (!m_pCurrent->isAuxiliary()) {
|
||||
if (gDP.colorImage.height > 200)
|
||||
|
@ -580,11 +580,11 @@ void FrameBufferList::saveBuffer(u32 _address, u16 _format, u16 _size, u16 _widt
|
|||
}
|
||||
|
||||
const u32 endAddress = _address + ((_width * _height) << _size >> 1) - 1;
|
||||
if (m_pCurrent == NULL || m_pCurrent->m_startAddress != _address || m_pCurrent->m_width != _width)
|
||||
if (m_pCurrent == nullptr || m_pCurrent->m_startAddress != _address || m_pCurrent->m_width != _width)
|
||||
m_pCurrent = findBuffer(_address);
|
||||
const float scaleX = config.frameBufferEmulation.nativeResFactor == 0 ? ogl.getScaleX() : static_cast<float>(config.frameBufferEmulation.nativeResFactor);
|
||||
const float scaleY = config.frameBufferEmulation.nativeResFactor == 0 ? ogl.getScaleY() : scaleX;
|
||||
if (m_pCurrent != NULL) {
|
||||
if (m_pCurrent != nullptr) {
|
||||
if ((m_pCurrent->m_startAddress != _address) ||
|
||||
(m_pCurrent->m_width != _width) ||
|
||||
//(current->height != height) ||
|
||||
|
@ -593,7 +593,7 @@ void FrameBufferList::saveBuffer(u32 _address, u16 _format, u16 _size, u16 _widt
|
|||
(m_pCurrent->m_scaleY != scaleY))
|
||||
{
|
||||
removeBuffer(m_pCurrent->m_startAddress);
|
||||
m_pCurrent = NULL;
|
||||
m_pCurrent = nullptr;
|
||||
} else {
|
||||
m_pCurrent->m_resolved = false;
|
||||
glBindFramebuffer(GL_FRAMEBUFFER, m_pCurrent->m_FBO);
|
||||
|
@ -604,7 +604,7 @@ void FrameBufferList::saveBuffer(u32 _address, u16 _format, u16 _size, u16 _widt
|
|||
m_pCurrent->m_size = _size;
|
||||
m_pCurrent->m_pTexture->format = _format;
|
||||
m_pCurrent->m_pTexture->size = _size;
|
||||
if (m_pCurrent->m_pResolveTexture != NULL) {
|
||||
if (m_pCurrent->m_pResolveTexture != nullptr) {
|
||||
m_pCurrent->m_pResolveTexture->format = _format;
|
||||
m_pCurrent->m_pResolveTexture->size = _size;
|
||||
}
|
||||
|
@ -613,7 +613,7 @@ void FrameBufferList::saveBuffer(u32 _address, u16 _format, u16 _size, u16 _widt
|
|||
}
|
||||
}
|
||||
}
|
||||
const bool bNew = m_pCurrent == NULL;
|
||||
const bool bNew = m_pCurrent == nullptr;
|
||||
if (bNew) {
|
||||
// Wasn't found or removed, create a new one
|
||||
m_list.emplace_front();
|
||||
|
@ -632,7 +632,7 @@ void FrameBufferList::saveBuffer(u32 _address, u16 _format, u16 _size, u16 _widt
|
|||
|
||||
#ifdef DEBUG
|
||||
DebugMsg( DEBUG_HIGH | DEBUG_HANDLED, "FrameBuffer_SaveBuffer( 0x%08X ); depth buffer is 0x%08X\n",
|
||||
address, (depthBuffer.top != NULL && depthBuffer.top->renderbuf > 0) ? depthBuffer.top->address : 0
|
||||
address, (depthBuffer.top != nullptr && depthBuffer.top->renderbuf > 0) ? depthBuffer.top->address : 0
|
||||
);
|
||||
#endif
|
||||
|
||||
|
@ -653,7 +653,7 @@ void FrameBufferList::removeAux()
|
|||
for (FrameBuffers::iterator iter = m_list.begin(); iter != m_list.end(); ++iter) {
|
||||
while (iter->m_width != VI.width && iter->m_height != VI.height) {
|
||||
if (&(*iter) == m_pCurrent) {
|
||||
m_pCurrent = NULL;
|
||||
m_pCurrent = nullptr;
|
||||
glBindFramebuffer(GL_DRAW_FRAMEBUFFER, 0);
|
||||
}
|
||||
iter = m_list.erase(iter);
|
||||
|
@ -668,7 +668,7 @@ void FrameBufferList::removeBuffer(u32 _address )
|
|||
for (FrameBuffers::iterator iter = m_list.begin(); iter != m_list.end(); ++iter)
|
||||
if (iter->m_startAddress == _address) {
|
||||
if (&(*iter) == m_pCurrent) {
|
||||
m_pCurrent = NULL;
|
||||
m_pCurrent = nullptr;
|
||||
glBindFramebuffer(GL_DRAW_FRAMEBUFFER, 0);
|
||||
}
|
||||
m_list.erase(iter);
|
||||
|
@ -678,11 +678,11 @@ void FrameBufferList::removeBuffer(u32 _address )
|
|||
|
||||
void FrameBufferList::removeBuffers(u32 _width)
|
||||
{
|
||||
m_pCurrent = NULL;
|
||||
m_pCurrent = nullptr;
|
||||
for (FrameBuffers::iterator iter = m_list.begin(); iter != m_list.end(); ++iter) {
|
||||
while (iter->m_width == _width) {
|
||||
if (&(*iter) == m_pCurrent) {
|
||||
m_pCurrent = NULL;
|
||||
m_pCurrent = nullptr;
|
||||
glBindFramebuffer(GL_DRAW_FRAMEBUFFER, 0);
|
||||
}
|
||||
iter = m_list.erase(iter);
|
||||
|
@ -711,11 +711,11 @@ void FrameBufferList::fillBufferInfo(void * _pinfo, u32 _size)
|
|||
|
||||
void FrameBufferList::attachDepthBuffer()
|
||||
{
|
||||
if (m_pCurrent == NULL)
|
||||
if (m_pCurrent == nullptr)
|
||||
return;
|
||||
|
||||
DepthBuffer * pDepthBuffer = depthBufferList().getCurrent();
|
||||
if (m_pCurrent->m_FBO > 0 && pDepthBuffer != NULL) {
|
||||
if (m_pCurrent->m_FBO > 0 && pDepthBuffer != nullptr) {
|
||||
pDepthBuffer->initDepthImageTexture(m_pCurrent);
|
||||
pDepthBuffer->initDepthBufferTexture(m_pCurrent);
|
||||
#ifdef GLES2
|
||||
|
@ -728,9 +728,9 @@ void FrameBufferList::attachDepthBuffer()
|
|||
if (video().getRender().isImageTexturesSupported() && config.frameBufferEmulation.N64DepthCompare != 0)
|
||||
pDepthBuffer->bindDepthImageTexture();
|
||||
} else
|
||||
m_pCurrent->m_pDepthBuffer = NULL;
|
||||
m_pCurrent->m_pDepthBuffer = nullptr;
|
||||
} else
|
||||
m_pCurrent->m_pDepthBuffer = NULL;
|
||||
m_pCurrent->m_pDepthBuffer = nullptr;
|
||||
|
||||
#ifndef GLES2
|
||||
GLuint attachments[1] = { GL_COLOR_ATTACHMENT0 };
|
||||
|
@ -743,7 +743,7 @@ void FrameBufferList::clearDepthBuffer(DepthBuffer * _pDepthBuffer)
|
|||
{
|
||||
for (FrameBuffers::iterator iter = m_list.begin(); iter != m_list.end(); ++iter) {
|
||||
if (iter->m_pDepthBuffer == _pDepthBuffer) {
|
||||
iter->m_pDepthBuffer = NULL;
|
||||
iter->m_pDepthBuffer = nullptr;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -779,7 +779,7 @@ void FrameBufferList::renderBuffer(u32 _address)
|
|||
return;
|
||||
|
||||
FrameBuffer *pBuffer = findBuffer(_address);
|
||||
if (pBuffer == NULL)
|
||||
if (pBuffer == nullptr)
|
||||
return;
|
||||
|
||||
OGLVideo & ogl = video();
|
||||
|
@ -892,7 +892,7 @@ void FrameBufferList::renderBuffer(u32 _address)
|
|||
if (dstPartHeight > 0) {
|
||||
const u32 size = *REG.VI_STATUS & 3;
|
||||
pBuffer = findBuffer(_address + (((*REG.VI_WIDTH)*VI.height)<<size>>1));
|
||||
if (pBuffer != NULL) {
|
||||
if (pBuffer != nullptr) {
|
||||
pFilteredBuffer = PostProcessor::get().doBlur(PostProcessor::get().doGammaCorrection(pBuffer));
|
||||
srcY0 = 0;
|
||||
srcY1 = srcPartHeight;
|
||||
|
@ -913,7 +913,7 @@ void FrameBufferList::renderBuffer(u32 _address)
|
|||
}
|
||||
|
||||
glBindFramebuffer(GL_READ_FRAMEBUFFER, 0);
|
||||
if (m_pCurrent != NULL)
|
||||
if (m_pCurrent != nullptr)
|
||||
glBindFramebuffer(GL_DRAW_FRAMEBUFFER, m_pCurrent->m_FBO);
|
||||
ogl.swapBuffers();
|
||||
gDP.changed |= CHANGED_SCISSOR;
|
||||
|
@ -926,7 +926,7 @@ void FrameBufferList::renderBuffer(u32 _address)
|
|||
return;
|
||||
|
||||
FrameBuffer *pBuffer = findBuffer(_address);
|
||||
if (pBuffer == NULL)
|
||||
if (pBuffer == nullptr)
|
||||
return;
|
||||
|
||||
OGLVideo & ogl = video();
|
||||
|
@ -964,7 +964,7 @@ void FrameBufferList::renderBuffer(u32 _address)
|
|||
ogl.getRender().drawTexturedRect(params);
|
||||
|
||||
glBindFramebuffer(GL_READ_FRAMEBUFFER, 0);
|
||||
if (m_pCurrent != NULL)
|
||||
if (m_pCurrent != nullptr)
|
||||
glBindFramebuffer(GL_DRAW_FRAMEBUFFER, m_pCurrent->m_FBO);
|
||||
ogl.swapBuffers();
|
||||
|
||||
|
@ -977,11 +977,11 @@ void FrameBufferList::renderBuffer(u32 _address)
|
|||
|
||||
void FrameBuffer_ActivateBufferTexture(u32 t, FrameBuffer *pBuffer)
|
||||
{
|
||||
if (pBuffer == NULL)
|
||||
if (pBuffer == nullptr)
|
||||
return;
|
||||
|
||||
CachedTexture *pTexture = pBuffer->getTexture(t);
|
||||
if (pTexture == NULL)
|
||||
if (pTexture == nullptr)
|
||||
return;
|
||||
|
||||
// frameBufferList().renderBuffer(pBuffer->m_startAddress);
|
||||
|
@ -991,11 +991,11 @@ void FrameBuffer_ActivateBufferTexture(u32 t, FrameBuffer *pBuffer)
|
|||
|
||||
void FrameBuffer_ActivateBufferTextureBG(u32 t, FrameBuffer *pBuffer )
|
||||
{
|
||||
if (pBuffer == NULL)
|
||||
if (pBuffer == nullptr)
|
||||
return;
|
||||
|
||||
CachedTexture *pTexture = pBuffer->getTextureBG(t);
|
||||
if (pTexture == NULL)
|
||||
if (pTexture == nullptr)
|
||||
return;
|
||||
|
||||
// frameBufferList().renderBuffer(pBuffer->m_startAddress);
|
||||
|
@ -1010,10 +1010,10 @@ void FrameBuffer_CopyToRDRAM(u32 _address, bool _sync)
|
|||
#else
|
||||
if ((config.generalEmulation.hacks & hack_subscreen) == 0)
|
||||
return;
|
||||
if (VI.width == 0 || frameBufferList().getCurrent() == NULL)
|
||||
if (VI.width == 0 || frameBufferList().getCurrent() == nullptr)
|
||||
return;
|
||||
FrameBuffer *pBuffer = frameBufferList().findBuffer(_address);
|
||||
if (pBuffer == NULL || pBuffer->m_width < VI.width || pBuffer->m_isOBScreen)
|
||||
if (pBuffer == nullptr || pBuffer->m_width < VI.width || pBuffer->m_isOBScreen)
|
||||
return;
|
||||
copyWhiteToRDRAM(pBuffer);
|
||||
#endif
|
||||
|
@ -1030,11 +1030,11 @@ bool FrameBuffer_CopyDepthBuffer( u32 address )
|
|||
{
|
||||
#ifndef GLES2
|
||||
FrameBuffer * pCopyBuffer = frameBufferList().getCopyBuffer();
|
||||
if (pCopyBuffer != NULL) {
|
||||
if (pCopyBuffer != nullptr) {
|
||||
// This code is mainly to emulate Zelda MM camera.
|
||||
ColorBufferToRDRAM::get().copyToRDRAM(pCopyBuffer->m_startAddress, true);
|
||||
pCopyBuffer->m_RdramCopy.resize(0); // To disable validity check by RDRAM content. CPU may change content of the buffer for some unknown reason.
|
||||
frameBufferList().setCopyBuffer(NULL);
|
||||
frameBufferList().setCopyBuffer(nullptr);
|
||||
return true;
|
||||
} else
|
||||
return DepthBufferToRDRAM::get().copyToRDRAM(address);
|
||||
|
|
|
@ -95,7 +95,7 @@ public:
|
|||
static FrameBufferList & get();
|
||||
|
||||
private:
|
||||
FrameBufferList() : m_pCurrent(NULL), m_pCopy(NULL) {}
|
||||
FrameBufferList() : m_pCurrent(nullptr), m_pCopy(nullptr) {}
|
||||
FrameBufferList(const FrameBufferList &);
|
||||
|
||||
FrameBuffer * _findBuffer(u32 _startAddress, u32 _endAddress, u32 _width);
|
||||
|
|
10
src/GBI.cpp
10
src/GBI.cpp
|
@ -119,19 +119,19 @@ void GBI_Unknown( u32 w0, u32 w1 )
|
|||
|
||||
void GBIInfo::init()
|
||||
{
|
||||
m_pCurrent = NULL;
|
||||
m_pCurrent = nullptr;
|
||||
_flushCommands();
|
||||
}
|
||||
|
||||
void GBIInfo::destroy()
|
||||
{
|
||||
m_pCurrent = NULL;
|
||||
m_pCurrent = nullptr;
|
||||
m_list.clear();
|
||||
}
|
||||
|
||||
bool GBIInfo::isHWLSupported() const
|
||||
{
|
||||
if (m_pCurrent == NULL)
|
||||
if (m_pCurrent == nullptr)
|
||||
return false;
|
||||
switch (m_pCurrent->type) {
|
||||
case S2DEX:
|
||||
|
@ -156,7 +156,7 @@ void GBIInfo::_makeCurrent(MicrocodeInfo * _pCurrent)
|
|||
return;
|
||||
}
|
||||
|
||||
if (m_pCurrent == NULL || (m_pCurrent->type != _pCurrent->type)) {
|
||||
if (m_pCurrent == nullptr || (m_pCurrent->type != _pCurrent->type)) {
|
||||
m_pCurrent = _pCurrent;
|
||||
_flushCommands();
|
||||
|
||||
|
@ -273,7 +273,7 @@ void GBIInfo::loadMicrocode(u32 uc_start, u32 uc_dstart, u16 uc_dsize)
|
|||
if (strncmp( &uc_str[4], "SW", 2 ) == 0)
|
||||
type = F3D;
|
||||
else if (strncmp( &uc_str[4], "Gfx", 3 ) == 0) {
|
||||
current.NoN = (strstr( uc_str + 4, ".NoN") != NULL);
|
||||
current.NoN = (strstr( uc_str + 4, ".NoN") != nullptr);
|
||||
|
||||
if (strncmp( &uc_str[14], "F3D", 3 ) == 0) {
|
||||
if (uc_str[28] == '1' || strncmp(&uc_str[28], "0.95", 4) == 0 || strncmp(&uc_str[28], "0.96", 4) == 0)
|
||||
|
|
10
src/GBI.h
10
src/GBI.h
|
@ -692,12 +692,12 @@ struct GBIInfo
|
|||
void init();
|
||||
void destroy();
|
||||
void loadMicrocode(u32 uc_start, u32 uc_dstart, u16 uc_dsize);
|
||||
u32 getMicrocodeType() const {return m_pCurrent != NULL ? m_pCurrent->type : NONE;}
|
||||
u32 getMicrocodeType() const {return m_pCurrent != nullptr ? m_pCurrent->type : NONE;}
|
||||
bool isHWLSupported() const;
|
||||
bool isNoN() const { return m_pCurrent != NULL ? m_pCurrent->NoN : false; }
|
||||
bool isTextureGen() const { return m_pCurrent != NULL ? m_pCurrent->textureGen: true; }
|
||||
bool isTexturePersp() const { return m_pCurrent != NULL ? m_pCurrent->texturePersp: true; }
|
||||
bool isBranchLessZ() const { return m_pCurrent != NULL ? m_pCurrent->branchLessZ : true; }
|
||||
bool isNoN() const { return m_pCurrent != nullptr ? m_pCurrent->NoN : false; }
|
||||
bool isTextureGen() const { return m_pCurrent != nullptr ? m_pCurrent->textureGen: true; }
|
||||
bool isTexturePersp() const { return m_pCurrent != nullptr ? m_pCurrent->texturePersp: true; }
|
||||
bool isBranchLessZ() const { return m_pCurrent != nullptr ? m_pCurrent->branchLessZ : true; }
|
||||
|
||||
private:
|
||||
void _flushCommands();
|
||||
|
|
|
@ -67,8 +67,8 @@ TxCache::TxCache(int options, int cachesize, const wchar_t *path, const wchar_t
|
|||
|
||||
if (!_gzdest0 || !_gzdest1 || !_gzdestLen) {
|
||||
_options &= ~(GZ_TEXCACHE|GZ_HIRESTEXCACHE);
|
||||
_gzdest0 = NULL;
|
||||
_gzdest1 = NULL;
|
||||
_gzdest0 = nullptr;
|
||||
_gzdest1 = nullptr;
|
||||
_gzdestLen = 0;
|
||||
}
|
||||
}
|
||||
|
@ -268,7 +268,7 @@ TxCache::save(const wchar_t *path, const wchar_t *filename, int config)
|
|||
destLen = _gzdestLen;
|
||||
if (dest && destLen) {
|
||||
if (uncompress(dest, &destLen, (*itMap).second->info.data, (*itMap).second->size) != Z_OK) {
|
||||
dest = NULL;
|
||||
dest = nullptr;
|
||||
destLen = 0;
|
||||
}
|
||||
format &= ~GL_TEXFMT_GZ;
|
||||
|
|
|
@ -60,7 +60,7 @@ TxFilter::~TxFilter()
|
|||
TxFilter::TxFilter(int maxwidth, int maxheight, int maxbpp, int options,
|
||||
int cachesize, const wchar_t * path, const wchar_t * texPackPath, const wchar_t * ident,
|
||||
dispInfoFuncExt callback) :
|
||||
_tex1(NULL), _tex2(NULL), _txQuantize(NULL), _txTexCache(NULL), _txHiResCache(NULL), _txUtil(NULL), _txImage(NULL)
|
||||
_tex1(nullptr), _tex2(nullptr), _txQuantize(nullptr), _txTexCache(nullptr), _txHiResCache(nullptr), _txUtil(nullptr), _txImage(nullptr)
|
||||
{
|
||||
/* HACKALERT: the emulator misbehaves and sometimes forgets to shutdown */
|
||||
if ((ident && wcscmp(ident, wst("DEFAULT")) != 0 && _ident.compare(ident) == 0) &&
|
||||
|
@ -97,8 +97,8 @@ TxFilter::TxFilter(int maxwidth, int maxheight, int maxbpp, int options,
|
|||
|
||||
_initialized = 0;
|
||||
|
||||
_tex1 = NULL;
|
||||
_tex2 = NULL;
|
||||
_tex1 = nullptr;
|
||||
_tex2 = nullptr;
|
||||
|
||||
_maxwidth = maxwidth > 4096 ? 4096 : maxwidth;
|
||||
_maxheight = maxheight > 4096 ? 4096 : maxheight;
|
||||
|
@ -587,7 +587,7 @@ TxFilter::dmptx(uint8 *src, int width, int height, int rowStridePixel, uint16 gf
|
|||
|
||||
if (!_path.empty() && !_ident.empty()) {
|
||||
/* dump it to disk */
|
||||
FILE *fp = NULL;
|
||||
FILE *fp = nullptr;
|
||||
tx_wstring tmpbuf;
|
||||
|
||||
/* create directories */
|
||||
|
@ -609,11 +609,11 @@ TxFilter::dmptx(uint8 *src, int width, int height, int rowStridePixel, uint16 gf
|
|||
}
|
||||
|
||||
#ifdef WIN32
|
||||
if ((fp = _wfopen(tmpbuf.c_str(), wst("wb"))) != NULL) {
|
||||
if ((fp = _wfopen(tmpbuf.c_str(), wst("wb"))) != nullptr) {
|
||||
#else
|
||||
char cbuf[MAX_PATH];
|
||||
wcstombs(cbuf, tmpbuf.c_str(), MAX_PATH);
|
||||
if ((fp = fopen(cbuf, "wb")) != NULL) {
|
||||
if ((fp = fopen(cbuf, "wb")) != nullptr) {
|
||||
#endif
|
||||
_txImage->writePNG(src, fp, width, height, (rowStridePixel << 2), 0x0003, 0);
|
||||
fclose(fp);
|
||||
|
|
|
@ -27,7 +27,7 @@
|
|||
|
||||
#include "TxFilter.h"
|
||||
|
||||
TxFilter *txFilter = NULL;
|
||||
TxFilter *txFilter = nullptr;
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C"{
|
||||
|
@ -51,7 +51,7 @@ txfilter_shutdown(void)
|
|||
{
|
||||
if (txFilter) delete txFilter;
|
||||
|
||||
txFilter = NULL;
|
||||
txFilter = nullptr;
|
||||
}
|
||||
|
||||
TAPI boolean TAPIENTRY
|
||||
|
|
|
@ -204,7 +204,7 @@ TxHiResCache::loadHiResTextures(const wchar_t * dir_path, boolean replace)
|
|||
|
||||
foundfilename = osal_search_dir_read_next(dir);
|
||||
// The array is empty, break the current operation
|
||||
if (foundfilename == NULL)
|
||||
if (foundfilename == nullptr)
|
||||
break;
|
||||
// The current file is a hidden one
|
||||
if (wccmp(foundfilename, wst(".")))
|
||||
|
@ -225,18 +225,18 @@ TxHiResCache::loadHiResTextures(const wchar_t * dir_path, boolean replace)
|
|||
|
||||
int width = 0, height = 0;
|
||||
uint16 format = 0;
|
||||
uint8 *tex = NULL;
|
||||
uint8 *tex = nullptr;
|
||||
int tmpwidth = 0, tmpheight = 0;
|
||||
uint16 tmpformat = 0;
|
||||
uint8 *tmptex= NULL;
|
||||
uint8 *tmptex= nullptr;
|
||||
uint16 destformat = 0;
|
||||
|
||||
/* Rice hi-res textures: begin
|
||||
*/
|
||||
uint32 chksum = 0, fmt = 0, siz = 0, palchksum = 0;
|
||||
char *pfname = NULL, fname[MAX_PATH];
|
||||
char *pfname = nullptr, fname[MAX_PATH];
|
||||
std::string ident;
|
||||
FILE *fp = NULL;
|
||||
FILE *fp = nullptr;
|
||||
|
||||
wcstombs(fname, _ident.c_str(), MAX_PATH);
|
||||
/* XXX case sensitivity fiasco!
|
||||
|
@ -357,28 +357,28 @@ TxHiResCache::loadHiResTextures(const wchar_t * dir_path, boolean replace)
|
|||
}
|
||||
/* _a.png */
|
||||
strcpy(pfname, "_a.png");
|
||||
if ((fp = fopen(fname, "rb")) != NULL) {
|
||||
if ((fp = fopen(fname, "rb")) != nullptr) {
|
||||
tmptex = _txImage->readPNG(fp, &tmpwidth, &tmpheight, &tmpformat);
|
||||
fclose(fp);
|
||||
}
|
||||
if (!tmptex) {
|
||||
/* _a.bmp */
|
||||
strcpy(pfname, "_a.bmp");
|
||||
if ((fp = fopen(fname, "rb")) != NULL) {
|
||||
if ((fp = fopen(fname, "rb")) != nullptr) {
|
||||
tmptex = _txImage->readBMP(fp, &tmpwidth, &tmpheight, &tmpformat);
|
||||
fclose(fp);
|
||||
}
|
||||
}
|
||||
/* _rgb.png */
|
||||
strcpy(pfname, "_rgb.png");
|
||||
if ((fp = fopen(fname, "rb")) != NULL) {
|
||||
if ((fp = fopen(fname, "rb")) != nullptr) {
|
||||
tex = _txImage->readPNG(fp, &width, &height, &format);
|
||||
fclose(fp);
|
||||
}
|
||||
if (!tex) {
|
||||
/* _rgb.bmp */
|
||||
strcpy(pfname, "_rgb.bmp");
|
||||
if ((fp = fopen(fname, "rb")) != NULL) {
|
||||
if ((fp = fopen(fname, "rb")) != nullptr) {
|
||||
tex = _txImage->readBMP(fp, &width, &height, &format);
|
||||
fclose(fp);
|
||||
}
|
||||
|
@ -401,8 +401,8 @@ TxHiResCache::loadHiResTextures(const wchar_t * dir_path, boolean replace)
|
|||
}
|
||||
if (tex) free(tex);
|
||||
if (tmptex) free(tmptex);
|
||||
tex = NULL;
|
||||
tmptex = NULL;
|
||||
tex = nullptr;
|
||||
tmptex = nullptr;
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
@ -436,7 +436,7 @@ TxHiResCache::loadHiResTextures(const wchar_t * dir_path, boolean replace)
|
|||
#endif
|
||||
}
|
||||
free(tmptex);
|
||||
tmptex = NULL;
|
||||
tmptex = nullptr;
|
||||
} else {
|
||||
/* clobber A comp. never a question of alpha. only RGB used. */
|
||||
#if !DEBUG
|
||||
|
@ -471,7 +471,7 @@ TxHiResCache::loadHiResTextures(const wchar_t * dir_path, boolean replace)
|
|||
pfname == strstr(fname, "_ciByRGBA.dds") ||
|
||||
#endif
|
||||
pfname == strstr(fname, "_ci.bmp")) {
|
||||
if ((fp = fopen(fname, "rb")) != NULL) {
|
||||
if ((fp = fopen(fname, "rb")) != nullptr) {
|
||||
if (strstr(fname, ".png")) tex = _txImage->readPNG(fp, &width, &height, &format);
|
||||
else tex = _txImage->readBMP(fp, &width, &height, &format);
|
||||
fclose(fp);
|
||||
|
@ -494,7 +494,7 @@ TxHiResCache::loadHiResTextures(const wchar_t * dir_path, boolean replace)
|
|||
if (!(format == GL_RGBA8 || format == GL_COLOR_INDEX8_EXT ) ||
|
||||
(width * height) < 4) { /* TxQuantize requirement: width * height must be 4 or larger. */
|
||||
free(tex);
|
||||
tex = NULL;
|
||||
tex = nullptr;
|
||||
#if !DEBUG
|
||||
INFO(80, wst("-----\n"));
|
||||
INFO(80, wst("path: %ls\n"), dir_path.string().c_str());
|
||||
|
@ -649,7 +649,7 @@ TxHiResCache::loadHiResTextures(const wchar_t * dir_path, boolean replace)
|
|||
}
|
||||
if (!_txReSample->minify(&tex, &width, &height, ratio)) {
|
||||
free(tex);
|
||||
tex = NULL;
|
||||
tex = nullptr;
|
||||
DBG_INFO(80, wst("Error: minification failed!\n"));
|
||||
continue;
|
||||
}
|
||||
|
@ -664,7 +664,7 @@ TxHiResCache::loadHiResTextures(const wchar_t * dir_path, boolean replace)
|
|||
if (!_txReSample->nextPow2(&tex, &width , &height, 32, 0)) {
|
||||
#endif
|
||||
free(tex);
|
||||
tex = NULL;
|
||||
tex = nullptr;
|
||||
DBG_INFO(80, wst("Error: aspect ratio adjustment failed!\n"));
|
||||
continue;
|
||||
}
|
||||
|
@ -701,7 +701,7 @@ TxHiResCache::loadHiResTextures(const wchar_t * dir_path, boolean replace)
|
|||
tex = tmptex;
|
||||
} else
|
||||
free(tmptex);
|
||||
tmptex = NULL;
|
||||
tmptex = nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -717,7 +717,7 @@ TxHiResCache::loadHiResTextures(const wchar_t * dir_path, boolean replace)
|
|||
#endif
|
||||
if (tex) {
|
||||
free(tex);
|
||||
tex = NULL;
|
||||
tex = nullptr;
|
||||
INFO(80, wst("Error: bad format or size! %d x %d gfmt:%x\n"), width, height, format);
|
||||
} else {
|
||||
INFO(80, wst("Error: load failed!!\n"));
|
||||
|
@ -757,7 +757,7 @@ TxHiResCache::loadHiResTextures(const wchar_t * dir_path, boolean replace)
|
|||
free(tex);
|
||||
}
|
||||
|
||||
} while (foundfilename != NULL);
|
||||
} while (foundfilename != nullptr);
|
||||
osal_search_dir_close(dir);
|
||||
|
||||
CHDIR(curpath);
|
||||
|
|
|
@ -51,19 +51,19 @@ TxImage::getPNGInfo(FILE *fp, png_structp *png_ptr, png_infop *info_ptr)
|
|||
return 0;
|
||||
|
||||
/* get PNG file info */
|
||||
*png_ptr = png_create_read_struct(PNG_LIBPNG_VER_STRING, NULL, NULL, NULL);
|
||||
*png_ptr = png_create_read_struct(PNG_LIBPNG_VER_STRING, nullptr, nullptr, nullptr);
|
||||
if (!*png_ptr)
|
||||
return 0;
|
||||
|
||||
*info_ptr = png_create_info_struct(*png_ptr);
|
||||
if (!*info_ptr) {
|
||||
png_destroy_read_struct(png_ptr, NULL, NULL);
|
||||
png_destroy_read_struct(png_ptr, nullptr, nullptr);
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (setjmp(png_jmpbuf(*png_ptr))) {
|
||||
DBG_INFO(80, wst("error reading png!\n"));
|
||||
png_destroy_read_struct(png_ptr, info_ptr, NULL);
|
||||
png_destroy_read_struct(png_ptr, info_ptr, nullptr);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -81,7 +81,7 @@ TxImage::readPNG(FILE* fp, int* width, int* height, uint16* format)
|
|||
|
||||
png_structp png_ptr;
|
||||
png_infop info_ptr;
|
||||
uint8 *image = NULL;
|
||||
uint8 *image = nullptr;
|
||||
int bit_depth, color_type, interlace_type, compression_type, filter_type,
|
||||
row_bytes, o_width, o_height, num_pas;
|
||||
|
||||
|
@ -92,11 +92,11 @@ TxImage::readPNG(FILE* fp, int* width, int* height, uint16* format)
|
|||
|
||||
/* check if we have a valid png file */
|
||||
if (!fp)
|
||||
return NULL;
|
||||
return nullptr;
|
||||
|
||||
if (!getPNGInfo(fp, &png_ptr, &info_ptr)) {
|
||||
INFO(80, wst("error reading png file! png image is corrupt.\n"));
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
png_get_IHDR(png_ptr, info_ptr,
|
||||
|
@ -158,9 +158,9 @@ TxImage::readPNG(FILE* fp, int* width, int* height, uint16* format)
|
|||
|
||||
/* punt invalid formats */
|
||||
if (color_type != PNG_COLOR_TYPE_RGB_ALPHA) {
|
||||
png_destroy_read_struct(&png_ptr, &info_ptr, NULL);
|
||||
png_destroy_read_struct(&png_ptr, &info_ptr, nullptr);
|
||||
DBG_INFO(80, wst("Error: not PNG_COLOR_TYPE_RGB_ALPHA format!\n"));
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
/*png_color_8p sig_bit;
|
||||
|
@ -193,7 +193,7 @@ TxImage::readPNG(FILE* fp, int* width, int* height, uint16* format)
|
|||
|
||||
for (i = 0; i < o_height; i++) {
|
||||
/* copy row */
|
||||
png_read_rows(png_ptr, &tmpimage, NULL, 1);
|
||||
png_read_rows(png_ptr, &tmpimage, nullptr, 1);
|
||||
tmpimage += row_bytes;
|
||||
}
|
||||
}
|
||||
|
@ -220,7 +220,7 @@ TxImage::readPNG(FILE* fp, int* width, int* height, uint16* format)
|
|||
#endif
|
||||
if (image) {
|
||||
free(image);
|
||||
image = NULL;
|
||||
image = nullptr;
|
||||
}
|
||||
*width = 0;
|
||||
*height = 0;
|
||||
|
@ -233,7 +233,7 @@ TxImage::readPNG(FILE* fp, int* width, int* height, uint16* format)
|
|||
}
|
||||
|
||||
/* clean up */
|
||||
png_destroy_read_struct(&png_ptr, &info_ptr, NULL);
|
||||
png_destroy_read_struct(&png_ptr, &info_ptr, nullptr);
|
||||
|
||||
#ifdef DEBUG
|
||||
if (!image) {
|
||||
|
@ -247,11 +247,11 @@ TxImage::readPNG(FILE* fp, int* width, int* height, uint16* format)
|
|||
boolean
|
||||
TxImage::writePNG(uint8* src, FILE* fp, int width, int height, int rowStride, uint16 format, uint8 *palette)
|
||||
{
|
||||
png_structp png_ptr = NULL;
|
||||
png_infop info_ptr = NULL;
|
||||
png_structp png_ptr = nullptr;
|
||||
png_infop info_ptr = nullptr;
|
||||
png_color_8 sig_bit;
|
||||
png_colorp palette_ptr = NULL;
|
||||
png_bytep trans_ptr = NULL;//, tex_ptr;
|
||||
png_colorp palette_ptr = nullptr;
|
||||
png_bytep trans_ptr = nullptr;//, tex_ptr;
|
||||
int bit_depth = 0, color_type = 0, row_bytes = 0, num_palette = 0;
|
||||
int i = 0;
|
||||
//uint16 srcfmt, destfmt;
|
||||
|
@ -259,13 +259,13 @@ TxImage::writePNG(uint8* src, FILE* fp, int width, int height, int rowStride, ui
|
|||
if (!src || !fp)
|
||||
return 0;
|
||||
|
||||
png_ptr = png_create_write_struct(PNG_LIBPNG_VER_STRING, NULL, NULL, NULL);
|
||||
if (png_ptr == NULL)
|
||||
png_ptr = png_create_write_struct(PNG_LIBPNG_VER_STRING, nullptr, nullptr, nullptr);
|
||||
if (png_ptr == nullptr)
|
||||
return 0;
|
||||
|
||||
info_ptr = png_create_info_struct(png_ptr);
|
||||
if (info_ptr == NULL) {
|
||||
png_destroy_write_struct(&png_ptr, NULL);
|
||||
if (info_ptr == nullptr) {
|
||||
png_destroy_write_struct(&png_ptr, nullptr);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -494,9 +494,9 @@ TxImage::readBMP(FILE* fp, int* width, int* height, uint16* format)
|
|||
* 24, 32bit bmp -> GL_RGBA8
|
||||
*/
|
||||
|
||||
uint8 *image = NULL;
|
||||
uint8 *image_row = NULL;
|
||||
uint8 *tmpimage = NULL;
|
||||
uint8 *image = nullptr;
|
||||
uint8 *image_row = nullptr;
|
||||
uint8 *tmpimage = nullptr;
|
||||
int row_bytes, pos, i, j;
|
||||
/* Windows Bitmap */
|
||||
BITMAPFILEHEADER bmp_fhdr;
|
||||
|
@ -509,11 +509,11 @@ TxImage::readBMP(FILE* fp, int* width, int* height, uint16* format)
|
|||
|
||||
/* check if we have a valid bmp file */
|
||||
if (!fp)
|
||||
return NULL;
|
||||
return nullptr;
|
||||
|
||||
if (!getBMPInfo(fp, &bmp_fhdr, &bmp_ihdr)) {
|
||||
INFO(80, wst("error reading bitmap file! bitmap image is corrupt.\n"));
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
DBG_INFO(80, wst("bmp format %d x %d bitdepth:%d compression:%x offset:%d\n"),
|
||||
|
@ -529,7 +529,7 @@ TxImage::readBMP(FILE* fp, int* width, int* height, uint16* format)
|
|||
if (!(bmp_ihdr.biBitCount == 8 || bmp_ihdr.biBitCount == 4 || bmp_ihdr.biBitCount == 32 || bmp_ihdr.biBitCount == 24) ||
|
||||
bmp_ihdr.biCompression != 0) {
|
||||
DBG_INFO(80, wst("Error: incompatible bitmap format!\n"));
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
switch (bmp_ihdr.biBitCount) {
|
||||
|
@ -572,7 +572,7 @@ TxImage::readBMP(FILE* fp, int* width, int* height, uint16* format)
|
|||
} else {
|
||||
if (image_row) free(image_row);
|
||||
if (image) free(image);
|
||||
image = NULL;
|
||||
image = nullptr;
|
||||
}
|
||||
break;
|
||||
case 24:
|
||||
|
@ -600,7 +600,7 @@ TxImage::readBMP(FILE* fp, int* width, int* height, uint16* format)
|
|||
} else {
|
||||
if (image_row) free(image_row);
|
||||
if (image) free(image);
|
||||
image = NULL;
|
||||
image = nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -633,7 +633,7 @@ TxImage::readBMP(FILE* fp, int* width, int* height, uint16* format)
|
|||
#endif
|
||||
if (image) {
|
||||
free(image);
|
||||
image = NULL;
|
||||
image = nullptr;
|
||||
}
|
||||
*width = 0;
|
||||
*height = 0;
|
||||
|
|
|
@ -502,11 +502,11 @@ TxUtil::getNumberofProcessors()
|
|||
uint32_t count;
|
||||
|
||||
nm[0] = CTL_HW; nm[1] = HW_AVAILCPU;
|
||||
sysctl(nm, 2, &count, &len, NULL, 0);
|
||||
sysctl(nm, 2, &count, &len, nullptr, 0);
|
||||
|
||||
if (count < 1) {
|
||||
nm[1] = HW_NCPU;
|
||||
sysctl(nm, 2, &count, &len, NULL, 0);
|
||||
sysctl(nm, 2, &count, &len, nullptr, 0);
|
||||
if (count < 1) { count = 1; }
|
||||
}
|
||||
numcore = count;
|
||||
|
@ -531,7 +531,7 @@ TxMemBuf::TxMemBuf()
|
|||
{
|
||||
int i;
|
||||
for (i = 0; i < 4; i++) {
|
||||
_tex[i] = NULL;
|
||||
_tex[i] = nullptr;
|
||||
_size[i] = 0;
|
||||
}
|
||||
}
|
||||
|
@ -565,7 +565,7 @@ TxMemBuf::shutdown()
|
|||
int i;
|
||||
for (i = 0; i < _numBufs; i++) {
|
||||
if (_tex[i]) free(_tex[i]);
|
||||
_tex[i] = NULL;
|
||||
_tex[i] = nullptr;
|
||||
_size[i] = 0;
|
||||
}
|
||||
}
|
||||
|
@ -573,7 +573,7 @@ TxMemBuf::shutdown()
|
|||
uint8*
|
||||
TxMemBuf::get(unsigned int num)
|
||||
{
|
||||
return ((num < _numBufs) ? _tex[num] : NULL);
|
||||
return ((num < _numBufs) ? _tex[num] : nullptr);
|
||||
}
|
||||
|
||||
uint32
|
||||
|
|
|
@ -43,7 +43,7 @@ static std::string strFragmentShader;
|
|||
class NoiseTexture
|
||||
{
|
||||
public:
|
||||
NoiseTexture() : m_pTexture(NULL), m_PBO(0), m_DList(0) {}
|
||||
NoiseTexture() : m_pTexture(nullptr), m_PBO(0), m_DList(0) {}
|
||||
void init();
|
||||
void destroy();
|
||||
void update();
|
||||
|
@ -72,7 +72,7 @@ void NoiseTexture::init()
|
|||
m_pTexture->textureBytes = m_pTexture->realWidth * m_pTexture->realHeight;
|
||||
textureCache().addFrameBufferTextureSize(m_pTexture->textureBytes);
|
||||
glBindTexture(GL_TEXTURE_2D, m_pTexture->glName);
|
||||
glTexImage2D(GL_TEXTURE_2D, 0, GL_R8, m_pTexture->realWidth, m_pTexture->realHeight, 0, GL_RED, GL_UNSIGNED_BYTE, NULL);
|
||||
glTexImage2D(GL_TEXTURE_2D, 0, GL_R8, m_pTexture->realWidth, m_pTexture->realHeight, 0, GL_RED, GL_UNSIGNED_BYTE, nullptr);
|
||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
|
||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
|
||||
glBindTexture(GL_TEXTURE_2D, 0);
|
||||
|
@ -80,14 +80,14 @@ void NoiseTexture::init()
|
|||
// Generate Pixel Buffer Object. Initialize it with max buffer size.
|
||||
glGenBuffers(1, &m_PBO);
|
||||
PBOBinder binder(GL_PIXEL_UNPACK_BUFFER, m_PBO);
|
||||
glBufferData(GL_PIXEL_UNPACK_BUFFER, 640*580, NULL, GL_DYNAMIC_DRAW);
|
||||
glBufferData(GL_PIXEL_UNPACK_BUFFER, 640*580, nullptr, GL_DYNAMIC_DRAW);
|
||||
}
|
||||
|
||||
void NoiseTexture::destroy()
|
||||
{
|
||||
if (m_pTexture != NULL) {
|
||||
if (m_pTexture != nullptr) {
|
||||
textureCache().removeFrameBufferTexture(m_pTexture);
|
||||
m_pTexture = NULL;
|
||||
m_pTexture = nullptr;
|
||||
}
|
||||
glDeleteBuffers(1, &m_PBO);
|
||||
m_PBO = 0;
|
||||
|
@ -102,7 +102,7 @@ void NoiseTexture::update()
|
|||
return;
|
||||
PBOBinder binder(GL_PIXEL_UNPACK_BUFFER, m_PBO);
|
||||
GLubyte* ptr = (GLubyte*)glMapBufferRange(GL_PIXEL_UNPACK_BUFFER, 0, dataSize, GL_MAP_WRITE_BIT);
|
||||
if (ptr == NULL)
|
||||
if (ptr == nullptr)
|
||||
return;
|
||||
for (u32 y = 0; y < VI.height; ++y) {
|
||||
for (u32 x = 0; x < VI.width; ++x)
|
||||
|
@ -170,7 +170,7 @@ void InitShadowMapShader()
|
|||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
|
||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
|
||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
|
||||
glTexImage2D(GL_TEXTURE_2D, 0, fboFormats.lutInternalFormat, 256, 1, 0, fboFormats.lutFormat, fboFormats.lutType, NULL);
|
||||
glTexImage2D(GL_TEXTURE_2D, 0, fboFormats.lutInternalFormat, 256, 1, 0, fboFormats.lutFormat, fboFormats.lutType, nullptr);
|
||||
|
||||
g_draw_shadow_map_program = createShaderProgram(default_vertex_shader, shadow_map_fragment_shader_float);
|
||||
}
|
||||
|
@ -197,7 +197,7 @@ static
|
|||
GLuint _createShader(GLenum _type, const char * _strShader)
|
||||
{
|
||||
GLuint shader_object = glCreateShader(_type);
|
||||
glShaderSource(shader_object, 1, &_strShader, NULL);
|
||||
glShaderSource(shader_object, 1, &_strShader, nullptr);
|
||||
glCompileShader(shader_object);
|
||||
assert(checkShaderCompileStatus(shader_object));
|
||||
return shader_object;
|
||||
|
@ -447,7 +447,7 @@ ShaderCombiner::ShaderCombiner(Combiner & _color, Combiner & _alpha, const gDPCo
|
|||
|
||||
GLuint fragmentShader = glCreateShader(GL_FRAGMENT_SHADER);
|
||||
const GLchar * strShaderData = strFragmentShader.data();
|
||||
glShaderSource(fragmentShader, 1, &strShaderData, NULL);
|
||||
glShaderSource(fragmentShader, 1, &strShaderData, nullptr);
|
||||
glCompileShader(fragmentShader);
|
||||
if (!checkShaderCompileStatus(fragmentShader))
|
||||
logErrorShader(GL_FRAGMENT_SHADER, strFragmentShader);
|
||||
|
@ -613,8 +613,8 @@ void ShaderCombiner::updateRenderTarget(bool _bForce)
|
|||
void ShaderCombiner::updateScreenCoordsScale(bool _bForce)
|
||||
{
|
||||
FrameBuffer * pCurrentBuffer = frameBufferList().getCurrent();
|
||||
const float scaleX = pCurrentBuffer != NULL ? 1.0f / pCurrentBuffer->m_width : VI.rwidth;
|
||||
const float scaleY = pCurrentBuffer != NULL ? 1.0f / pCurrentBuffer->m_height : VI.rheight;
|
||||
const float scaleX = pCurrentBuffer != nullptr ? 1.0f / pCurrentBuffer->m_width : VI.rwidth;
|
||||
const float scaleY = pCurrentBuffer != nullptr ? 1.0f / pCurrentBuffer->m_height : VI.rheight;
|
||||
m_uniforms.uScreenCoordsScale.set(2.0f*scaleX, -2.0f*scaleY, _bForce);
|
||||
}
|
||||
|
||||
|
@ -723,7 +723,7 @@ void ShaderCombiner::updateFrameBufferInfo(bool _bForce) {
|
|||
int nFbFixedAlpha0 = 0, nFbFixedAlpha1 = 0;
|
||||
int nMSTex0Enabled = 0, nMSTex1Enabled = 0;
|
||||
TextureCache & cache = textureCache();
|
||||
if (cache.current[0] != NULL && cache.current[0]->frameBufferTexture != CachedTexture::fbNone) {
|
||||
if (cache.current[0] != nullptr && cache.current[0]->frameBufferTexture != CachedTexture::fbNone) {
|
||||
if (cache.current[0]->size == G_IM_SIZ_8b) {
|
||||
nFbMonochromeMode0 = 1;
|
||||
if (gDP.otherMode.imageRead == 0)
|
||||
|
@ -732,7 +732,7 @@ void ShaderCombiner::updateFrameBufferInfo(bool _bForce) {
|
|||
nFbMonochromeMode0 = 2;
|
||||
nMSTex0Enabled = cache.current[0]->frameBufferTexture == CachedTexture::fbMultiSample ? 1 : 0;
|
||||
}
|
||||
if (cache.current[1] != NULL && cache.current[1]->frameBufferTexture != CachedTexture::fbNone) {
|
||||
if (cache.current[1] != nullptr && cache.current[1]->frameBufferTexture != CachedTexture::fbNone) {
|
||||
if (cache.current[1]->size == G_IM_SIZ_8b) {
|
||||
nFbMonochromeMode1 = 1;
|
||||
if (gDP.otherMode.imageRead == 0)
|
||||
|
@ -758,7 +758,7 @@ void ShaderCombiner::updateDepthInfo(bool _bForce) {
|
|||
return;
|
||||
|
||||
FrameBuffer * pBuffer = frameBufferList().getCurrent();
|
||||
if (pBuffer == NULL || pBuffer->m_pDepthBuffer == NULL)
|
||||
if (pBuffer == nullptr || pBuffer->m_pDepthBuffer == nullptr)
|
||||
return;
|
||||
|
||||
const int nDepthEnabled = (gSP.geometryMode & G_ZBUFFER) > 0 ? 1 : 0;
|
||||
|
|
|
@ -164,12 +164,12 @@ void UniformBlock::updateTextureParameters()
|
|||
memcpy(pData + m_textureBlock.m_offsets[tuTexScale], texScale, m_textureBlock.m_offsets[tuTexOffset] - m_textureBlock.m_offsets[tuTexScale]);
|
||||
|
||||
f32 texOffset[8] = { 0, 0, 0, 0, 0, 0, 0, 0 };
|
||||
if (gSP.textureTile[0] != NULL) {
|
||||
if (gSP.textureTile[0] != nullptr) {
|
||||
if (gSP.textureTile[0]->textureMode != TEXTUREMODE_BGIMAGE && gSP.textureTile[0]->textureMode != TEXTUREMODE_FRAMEBUFFER_BG) {
|
||||
texOffset[0] = gSP.textureTile[0]->fuls;
|
||||
texOffset[1] = gSP.textureTile[0]->fult;
|
||||
FrameBuffer * pBuffer = gSP.textureTile[0]->frameBuffer;
|
||||
if (pBuffer != NULL) {
|
||||
if (pBuffer != nullptr) {
|
||||
if (gSP.textureTile[0]->masks > 0 && gSP.textureTile[0]->clamps == 0)
|
||||
texOffset[0] = float(gSP.textureTile[0]->uls % (1 << gSP.textureTile[0]->masks));
|
||||
if (gSP.textureTile[0]->maskt > 0 && gSP.textureTile[0]->clampt == 0)
|
||||
|
@ -181,7 +181,7 @@ void UniformBlock::updateTextureParameters()
|
|||
texOffset[4] = gSP.textureTile[1]->fuls;
|
||||
texOffset[5] = gSP.textureTile[1]->fult;
|
||||
FrameBuffer * pBuffer = gSP.textureTile[1]->frameBuffer;
|
||||
if (pBuffer != NULL) {
|
||||
if (pBuffer != nullptr) {
|
||||
if (gSP.textureTile[1]->masks > 0 && gSP.textureTile[1]->clamps == 0)
|
||||
texOffset[4] = float(gSP.textureTile[1]->uls % (1 << gSP.textureTile[1]->masks));
|
||||
if (gSP.textureTile[1]->maskt > 0 && gSP.textureTile[1]->clampt == 0)
|
||||
|
|
|
@ -81,7 +81,7 @@ const char* GLErrorString(GLenum errorCode)
|
|||
#endif
|
||||
{GL_OUT_OF_MEMORY, "out of memory"},
|
||||
|
||||
{0, NULL }
|
||||
{0, nullptr }
|
||||
};
|
||||
|
||||
int i;
|
||||
|
@ -94,7 +94,7 @@ const char* GLErrorString(GLenum errorCode)
|
|||
}
|
||||
}
|
||||
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
bool isGLError()
|
||||
|
@ -104,7 +104,7 @@ bool isGLError()
|
|||
|
||||
if ((errCode = glGetError()) != GL_NO_ERROR) {
|
||||
errString = GLErrorString(errCode);
|
||||
if (errString != NULL)
|
||||
if (errString != nullptr)
|
||||
fprintf (stderr, "OpenGL Error: %s\n", errString);
|
||||
return true;
|
||||
}
|
||||
|
@ -122,7 +122,7 @@ bool OGLVideo::isExtensionSupported(const char *extension)
|
|||
const GLubyte *start = extensions;
|
||||
for (;;) {
|
||||
where = (GLubyte *)strstr((const char *)start, extension);
|
||||
if (where == NULL)
|
||||
if (where == nullptr)
|
||||
break;
|
||||
|
||||
GLubyte *terminator = where + strlen(extension);
|
||||
|
@ -279,7 +279,7 @@ void OGLVideo::readScreen(void **_pDest, long *_pWidth, long *_pHeight )
|
|||
*_pHeight = m_height;
|
||||
|
||||
*_pDest = malloc( m_height * m_width * 3 );
|
||||
if (*_pDest == NULL)
|
||||
if (*_pDest == nullptr)
|
||||
return;
|
||||
|
||||
#ifndef GLESX
|
||||
|
@ -293,13 +293,13 @@ void OGLVideo::readScreen(void **_pDest, long *_pWidth, long *_pHeight )
|
|||
|
||||
void OGLVideo::readScreen2(void * _dest, int * _width, int * _height, int _front)
|
||||
{
|
||||
if (_width == NULL || _height == NULL)
|
||||
if (_width == nullptr || _height == nullptr)
|
||||
return;
|
||||
|
||||
*_width = m_screenWidth;
|
||||
*_height = m_screenHeight;
|
||||
|
||||
if (_dest == NULL)
|
||||
if (_dest == nullptr)
|
||||
return;
|
||||
|
||||
u8 *pBufferData = (u8*)malloc((*_width)*(*_height) * 4);
|
||||
|
@ -347,8 +347,8 @@ OGLRender::TexrectDrawer::TexrectDrawer()
|
|||
, m_FBO(0)
|
||||
, m_programTex(0)
|
||||
, m_programClean(0)
|
||||
, m_pTexture(NULL)
|
||||
, m_pBuffer(NULL)
|
||||
, m_pTexture(nullptr)
|
||||
, m_pBuffer(nullptr)
|
||||
{}
|
||||
|
||||
void OGLRender::TexrectDrawer::init()
|
||||
|
@ -372,7 +372,7 @@ void OGLRender::TexrectDrawer::init()
|
|||
m_pTexture->textureBytes = m_pTexture->realWidth * m_pTexture->realHeight * 4;
|
||||
textureCache().addFrameBufferTextureSize(m_pTexture->textureBytes);
|
||||
glBindTexture(GL_TEXTURE_2D, m_pTexture->glName);
|
||||
glTexImage2D(GL_TEXTURE_2D, 0, fboFormats.colorInternalFormat, m_pTexture->realWidth, m_pTexture->realHeight, 0, fboFormats.colorFormat, fboFormats.colorType, NULL);
|
||||
glTexImage2D(GL_TEXTURE_2D, 0, fboFormats.colorInternalFormat, m_pTexture->realWidth, m_pTexture->realHeight, 0, fboFormats.colorFormat, fboFormats.colorType, nullptr);
|
||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
|
||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
|
||||
glBindTexture(GL_TEXTURE_2D, 0);
|
||||
|
@ -415,9 +415,9 @@ void OGLRender::TexrectDrawer::destroy()
|
|||
glDeleteFramebuffers(1, &m_FBO);
|
||||
m_FBO = 0;
|
||||
}
|
||||
if (m_pTexture != NULL) {
|
||||
if (m_pTexture != nullptr) {
|
||||
textureCache().removeFrameBufferTexture(m_pTexture);
|
||||
m_pTexture = NULL;
|
||||
m_pTexture = nullptr;
|
||||
}
|
||||
if (m_programTex != 0)
|
||||
glDeleteProgram(m_programTex);
|
||||
|
@ -437,7 +437,7 @@ void OGLRender::TexrectDrawer::add()
|
|||
if (m_numRects != 0) {
|
||||
bool bContinue = false;
|
||||
if (m_otherMode == gDP.otherMode._u64 && m_mux == gDP.combine.mux) {
|
||||
const float scaleY = (m_pBuffer != NULL ? m_pBuffer->m_height : VI.height) / 2.0f;
|
||||
const float scaleY = (m_pBuffer != nullptr ? m_pBuffer->m_height : VI.height) / 2.0f;
|
||||
if (m_ulx == pRect[0].x) {
|
||||
// bContinue = m_lry == pRect[0].y;
|
||||
bContinue = fabs((m_lry - pRect[0].y) * scaleY) < 1.1f; // Fix for Mario Kart
|
||||
|
@ -478,7 +478,7 @@ void OGLRender::TexrectDrawer::add()
|
|||
glDepthMask(FALSE);
|
||||
glDisable(GL_BLEND);
|
||||
|
||||
if (m_pBuffer == NULL)
|
||||
if (m_pBuffer == nullptr)
|
||||
glViewport(0, 0, VI.width, VI.height);
|
||||
else
|
||||
glViewport(0, 0, m_pBuffer->m_width, m_pBuffer->m_height);
|
||||
|
@ -548,8 +548,8 @@ bool OGLRender::TexrectDrawer::draw()
|
|||
|
||||
GLVertex * rect = render.m_rect;
|
||||
|
||||
const float scaleX = (m_pBuffer != NULL ? 1.0f / m_pBuffer->m_width : VI.rwidth) * 2.0f;
|
||||
const float scaleY = (m_pBuffer != NULL ? 1.0f / m_pBuffer->m_height : VI.rheight) * 2.0f;
|
||||
const float scaleX = (m_pBuffer != nullptr ? 1.0f / m_pBuffer->m_width : VI.rwidth) * 2.0f;
|
||||
const float scaleY = (m_pBuffer != nullptr ? 1.0f / m_pBuffer->m_height : VI.rheight) * 2.0f;
|
||||
|
||||
const float s0 = (m_ulx + 1.0f) / scaleX / (float)m_pTexture->realWidth;
|
||||
const float t1 = (m_uly + 1.0f) / scaleY / (float)m_pTexture->realHeight;
|
||||
|
@ -557,7 +557,7 @@ bool OGLRender::TexrectDrawer::draw()
|
|||
const float t0 = (m_lry + 1.0f) / scaleY / (float)m_pTexture->realHeight;
|
||||
const float W = 1.0f;
|
||||
|
||||
if (m_pBuffer == NULL)
|
||||
if (m_pBuffer == nullptr)
|
||||
glViewport(0, ogl.getHeightOffset(), ogl.getScreenWidth(), ogl.getScreenHeight());
|
||||
else
|
||||
glViewport(0, 0, m_pBuffer->m_width*m_pBuffer->m_scaleX, m_pBuffer->m_height*m_pBuffer->m_scaleY);
|
||||
|
@ -603,7 +603,7 @@ bool OGLRender::TexrectDrawer::draw()
|
|||
rect[3].t0 = t1;
|
||||
|
||||
render.updateScissor(m_pBuffer);
|
||||
glBindFramebuffer(GL_DRAW_FRAMEBUFFER, m_pBuffer != NULL ? m_pBuffer->m_FBO : 0);
|
||||
glBindFramebuffer(GL_DRAW_FRAMEBUFFER, m_pBuffer != nullptr ? m_pBuffer->m_FBO : 0);
|
||||
glDrawArrays(GL_TRIANGLE_STRIP, 0, 4);
|
||||
|
||||
glBindFramebuffer(GL_DRAW_FRAMEBUFFER, m_FBO);
|
||||
|
@ -613,7 +613,7 @@ bool OGLRender::TexrectDrawer::draw()
|
|||
rect[2].y = m_lry;
|
||||
rect[3].y = m_lry;
|
||||
|
||||
if (m_pBuffer == NULL)
|
||||
if (m_pBuffer == nullptr)
|
||||
glViewport(0, 0, VI.width, VI.height);
|
||||
else
|
||||
glViewport(0, 0, m_pBuffer->m_width, m_pBuffer->m_height);
|
||||
|
@ -624,7 +624,7 @@ bool OGLRender::TexrectDrawer::draw()
|
|||
glEnable(GL_SCISSOR_TEST);
|
||||
|
||||
m_pBuffer = frameBufferList().getCurrent();
|
||||
glBindFramebuffer(GL_DRAW_FRAMEBUFFER, m_pBuffer != NULL ? m_pBuffer->m_FBO : 0);
|
||||
glBindFramebuffer(GL_DRAW_FRAMEBUFFER, m_pBuffer != nullptr ? m_pBuffer->m_FBO : 0);
|
||||
|
||||
m_numRects = 0;
|
||||
m_vecRectCoords.clear();
|
||||
|
@ -833,7 +833,7 @@ void OGLRender::_updateViewport() const
|
|||
{
|
||||
OGLVideo & ogl = video();
|
||||
FrameBuffer * pCurrentBuffer = frameBufferList().getCurrent();
|
||||
if (pCurrentBuffer == NULL) {
|
||||
if (pCurrentBuffer == nullptr) {
|
||||
const f32 scaleX = ogl.getScaleX();
|
||||
const f32 scaleY = ogl.getScaleY();
|
||||
float Xf = gSP.viewport.vscale[0] < 0 ? (gSP.viewport.x + gSP.viewport.vscale[0] * 2.0f) : gSP.viewport.x;
|
||||
|
@ -861,7 +861,7 @@ void OGLRender::_updateScreenCoordsViewport() const
|
|||
{
|
||||
OGLVideo & ogl = video();
|
||||
FrameBuffer * pCurrentBuffer = frameBufferList().getCurrent();
|
||||
if (pCurrentBuffer == NULL)
|
||||
if (pCurrentBuffer == nullptr)
|
||||
glViewport(0, ogl.getHeightOffset(), ogl.getScreenWidth(), ogl.getScreenHeight());
|
||||
else
|
||||
glViewport(0, 0, pCurrentBuffer->m_width*pCurrentBuffer->m_scaleX, pCurrentBuffer->m_height*pCurrentBuffer->m_scaleY);
|
||||
|
@ -881,7 +881,7 @@ void OGLRender::updateScissor(FrameBuffer * _pBuffer) const
|
|||
OGLVideo & ogl = video();
|
||||
f32 scaleX, scaleY;
|
||||
u32 heightOffset, screenHeight;
|
||||
if (_pBuffer == NULL) {
|
||||
if (_pBuffer == nullptr) {
|
||||
scaleX = ogl.getScaleX();
|
||||
scaleY = ogl.getScaleY();
|
||||
heightOffset = ogl.getHeightOffset();
|
||||
|
@ -965,10 +965,10 @@ void OGLRender::_updateDepthCompare() const
|
|||
|
||||
void OGLRender::_updateTextures(RENDER_STATE _renderState) const
|
||||
{
|
||||
//For some reason updating the texture cache on the first frame of LOZ:OOT causes a NULL Pointer exception...
|
||||
//For some reason updating the texture cache on the first frame of LOZ:OOT causes a nullptr Pointer exception...
|
||||
CombinerInfo & cmbInfo = CombinerInfo::get();
|
||||
ShaderCombiner * pCurrentCombiner = cmbInfo.getCurrent();
|
||||
if (pCurrentCombiner != NULL) {
|
||||
if (pCurrentCombiner != nullptr) {
|
||||
for (u32 t = 0; t < 2; ++t) {
|
||||
if (pCurrentCombiner->usesTile(t))
|
||||
textureCache().update(t);
|
||||
|
@ -1138,7 +1138,7 @@ void OGLRender::_prepareDrawTriangle(bool _dma)
|
|||
|
||||
bool OGLRender::_canDraw() const
|
||||
{
|
||||
return config.frameBufferEmulation.enable == 0 || frameBufferList().getCurrent() != NULL;
|
||||
return config.frameBufferEmulation.enable == 0 || frameBufferList().getCurrent() != nullptr;
|
||||
}
|
||||
|
||||
void OGLRender::drawLLETriangle(u32 _numVtx)
|
||||
|
@ -1247,15 +1247,15 @@ void OGLRender::drawRect(int _ulx, int _uly, int _lrx, int _lry, float *_pColor)
|
|||
|
||||
FrameBuffer * pCurrentBuffer = frameBufferList().getCurrent();
|
||||
OGLVideo & ogl = video();
|
||||
if (pCurrentBuffer == NULL)
|
||||
if (pCurrentBuffer == nullptr)
|
||||
glViewport( 0, ogl.getHeightOffset(), ogl.getScreenWidth(), ogl.getScreenHeight());
|
||||
else {
|
||||
glViewport(0, 0, pCurrentBuffer->m_width*pCurrentBuffer->m_scaleX, pCurrentBuffer->m_height*pCurrentBuffer->m_scaleY);
|
||||
}
|
||||
glDisable(GL_CULL_FACE);
|
||||
|
||||
const float scaleX = pCurrentBuffer != NULL ? 1.0f / pCurrentBuffer->m_width : VI.rwidth;
|
||||
const float scaleY = pCurrentBuffer != NULL ? 1.0f / pCurrentBuffer->m_height : VI.rheight;
|
||||
const float scaleX = pCurrentBuffer != nullptr ? 1.0f / pCurrentBuffer->m_width : VI.rwidth;
|
||||
const float scaleY = pCurrentBuffer != nullptr ? 1.0f / pCurrentBuffer->m_height : VI.rheight;
|
||||
const float Z = (gDP.otherMode.depthSource == G_ZS_PRIM) ? gDP.primDepth.z : gSP.viewport.nearz;
|
||||
const float W = 1.0f;
|
||||
m_rect[0].x = (float)_ulx * (2.0f * scaleX) - 1.0;
|
||||
|
@ -1294,7 +1294,7 @@ static
|
|||
bool texturedRectShadowMap(const OGLRender::TexturedRectParams &)
|
||||
{
|
||||
FrameBuffer * pCurrentBuffer = frameBufferList().getCurrent();
|
||||
if (pCurrentBuffer != NULL) {
|
||||
if (pCurrentBuffer != nullptr) {
|
||||
if (gDP.textureImage.size == 2 && gDP.textureImage.address >= gDP.depthImageAddress && gDP.textureImage.address < (gDP.depthImageAddress + gDP.colorImage.width*gDP.colorImage.width * 6 / 4)) {
|
||||
#ifdef GL_IMAGE_TEXTURES_SUPPORT
|
||||
pCurrentBuffer->m_pDepthBuffer->activateDepthBufferTexture(pCurrentBuffer);
|
||||
|
@ -1320,7 +1320,7 @@ bool texturedRectDepthBufferCopy(const OGLRender::TexturedRectParams & _params)
|
|||
if (config.frameBufferEmulation.copyDepthToRDRAM == 0)
|
||||
return true;
|
||||
FrameBuffer * pBuffer = frameBufferList().getCurrent();
|
||||
if (pBuffer == NULL)
|
||||
if (pBuffer == nullptr)
|
||||
return true;
|
||||
pBuffer->m_cleared = true;
|
||||
if (rectDepthBufferCopyFrame != video().getBuffersSwapCount()) {
|
||||
|
@ -1346,7 +1346,7 @@ static
|
|||
bool texturedRectCopyToItself(const OGLRender::TexturedRectParams & _params)
|
||||
{
|
||||
FrameBuffer * pCurrent = frameBufferList().getCurrent();
|
||||
if (pCurrent != NULL && pCurrent->m_size == G_IM_SIZ_8b && gSP.textureTile[0]->frameBuffer == pCurrent)
|
||||
if (pCurrent != nullptr && pCurrent->m_size == G_IM_SIZ_8b && gSP.textureTile[0]->frameBuffer == pCurrent)
|
||||
return true;
|
||||
return texturedRectDepthBufferCopy(_params);
|
||||
}
|
||||
|
@ -1426,7 +1426,7 @@ bool texturedRectMonochromeBackground(const OGLRender::TexturedRectParams & _par
|
|||
if (gDP.textureImage.address >= gDP.colorImage.address && gDP.textureImage.address <= (gDP.colorImage.address + gDP.colorImage.width*gDP.colorImage.height * 2)) {
|
||||
#ifdef GL_IMAGE_TEXTURES_SUPPORT
|
||||
FrameBuffer * pCurrentBuffer = frameBufferList().getCurrent();
|
||||
if (pCurrentBuffer != NULL) {
|
||||
if (pCurrentBuffer != nullptr) {
|
||||
FrameBuffer_ActivateBufferTexture(0, pCurrentBuffer);
|
||||
SetMonochromeCombiner();
|
||||
return false;
|
||||
|
@ -1439,7 +1439,7 @@ bool texturedRectMonochromeBackground(const OGLRender::TexturedRectParams & _par
|
|||
|
||||
// Special processing of textured rect.
|
||||
// Return true if actuial rendering is not necessary
|
||||
bool(*texturedRectSpecial)(const OGLRender::TexturedRectParams & _params) = NULL;
|
||||
bool(*texturedRectSpecial)(const OGLRender::TexturedRectParams & _params) = nullptr;
|
||||
|
||||
void OGLRender::drawTexturedRect(const TexturedRectParams & _params)
|
||||
{
|
||||
|
@ -1481,7 +1481,7 @@ void OGLRender::drawTexturedRect(const TexturedRectParams & _params)
|
|||
glDisableVertexAttribArray(SC_MODIFY);
|
||||
}
|
||||
|
||||
if (_params.texrectCmd && texturedRectSpecial != NULL && texturedRectSpecial(_params)) {
|
||||
if (_params.texrectCmd && texturedRectSpecial != nullptr && texturedRectSpecial(_params)) {
|
||||
gSP.changed |= CHANGED_GEOMETRYMODE;
|
||||
return;
|
||||
}
|
||||
|
@ -1500,14 +1500,14 @@ void OGLRender::drawTexturedRect(const TexturedRectParams & _params)
|
|||
const bool bUseTexrectDrawer = config.generalEmulation.enableNativeResTexrects != 0
|
||||
&& bUseBilinear
|
||||
&& pCurrentCombiner->usesTexture()
|
||||
&& (pCurrentBuffer == NULL || !pCurrentBuffer->m_cfb)
|
||||
&& (cache.current[0] != NULL)
|
||||
// && (cache.current[0] == NULL || cache.current[0]->format == G_IM_FMT_RGBA || cache.current[0]->format == G_IM_FMT_CI)
|
||||
&& (pCurrentBuffer == nullptr || !pCurrentBuffer->m_cfb)
|
||||
&& (cache.current[0] != nullptr)
|
||||
// && (cache.current[0] == nullptr || cache.current[0]->format == G_IM_FMT_RGBA || cache.current[0]->format == G_IM_FMT_CI)
|
||||
&& ((cache.current[0]->frameBufferTexture == CachedTexture::fbNone && !cache.current[0]->bHDTexture))
|
||||
&& (cache.current[1] == NULL || (cache.current[1]->frameBufferTexture == CachedTexture::fbNone && !cache.current[1]->bHDTexture));
|
||||
&& (cache.current[1] == nullptr || (cache.current[1]->frameBufferTexture == CachedTexture::fbNone && !cache.current[1]->bHDTexture));
|
||||
|
||||
const float scaleX = pCurrentBuffer != NULL ? 1.0f / pCurrentBuffer->m_width : VI.rwidth;
|
||||
const float scaleY = pCurrentBuffer != NULL ? 1.0f / pCurrentBuffer->m_height : VI.rheight;
|
||||
const float scaleX = pCurrentBuffer != nullptr ? 1.0f / pCurrentBuffer->m_width : VI.rwidth;
|
||||
const float scaleY = pCurrentBuffer != nullptr ? 1.0f / pCurrentBuffer->m_height : VI.rheight;
|
||||
const float Z = (gDP.otherMode.depthSource == G_ZS_PRIM) ? gDP.primDepth.z : gSP.viewport.nearz;
|
||||
const float W = 1.0f;
|
||||
f32 uly, lry;
|
||||
|
@ -1642,7 +1642,7 @@ void OGLRender::drawTexturedRect(const TexturedRectParams & _params)
|
|||
if (bUseTexrectDrawer)
|
||||
m_texrectDrawer.add();
|
||||
else {
|
||||
if (pCurrentBuffer == NULL)
|
||||
if (pCurrentBuffer == nullptr)
|
||||
glViewport(0, ogl.getHeightOffset(), ogl.getScreenWidth(), ogl.getScreenHeight());
|
||||
else
|
||||
glViewport(0, 0, pCurrentBuffer->m_width*pCurrentBuffer->m_scaleX, pCurrentBuffer->m_height*pCurrentBuffer->m_scaleY);
|
||||
|
@ -1793,7 +1793,7 @@ void OGLRender::_initExtensions()
|
|||
LOG(LOG_VERBOSE, "OpenGL version string: %s\n", glGetString(GL_VERSION));
|
||||
LOG(LOG_VERBOSE, "OpenGL vendor: %s\n", glGetString(GL_VENDOR));
|
||||
const GLubyte * strRenderer = glGetString(GL_RENDERER);
|
||||
if (strstr((const char*)strRenderer, "Adreno") != NULL)
|
||||
if (strstr((const char*)strRenderer, "Adreno") != nullptr)
|
||||
m_oglRenderer = glrAdreno;
|
||||
LOG(LOG_VERBOSE, "OpenGL renderer: %s\n", strRenderer);
|
||||
|
||||
|
@ -1811,9 +1811,9 @@ void OGLRender::_initExtensions()
|
|||
glGetIntegerv(GL_MINOR_VERSION, &minorVersion);
|
||||
LOG(LOG_VERBOSE, "OpenGL minor version: %d\n", minorVersion);
|
||||
#ifndef GLESX
|
||||
m_bImageTexture = (majorVersion >= 4) && (minorVersion >= 3) && (glBindImageTexture != NULL);
|
||||
m_bImageTexture = (majorVersion >= 4) && (minorVersion >= 3) && (glBindImageTexture != nullptr);
|
||||
#elif defined(GLES3_1)
|
||||
m_bImageTexture = (majorVersion >= 3) && (minorVersion >= 1) && (glBindImageTexture != NULL);
|
||||
m_bImageTexture = (majorVersion >= 3) && (minorVersion >= 1) && (glBindImageTexture != nullptr);
|
||||
#else
|
||||
m_bImageTexture = false;
|
||||
#endif
|
||||
|
@ -1861,7 +1861,7 @@ void OGLRender::_initStates()
|
|||
glClearColor( 0.0f, 0.0f, 0.0f, 0.0f );
|
||||
glClear( GL_COLOR_BUFFER_BIT );
|
||||
|
||||
srand( time(NULL) );
|
||||
srand( time(nullptr) );
|
||||
|
||||
ogl.swapBuffers();
|
||||
}
|
||||
|
@ -1925,7 +1925,7 @@ void OGLRender::_setSpecialTexrect() const
|
|||
else if (strstr(name, (const char *)"ZELDA"))
|
||||
texturedRectSpecial = texturedRectMonochromeBackground;
|
||||
else
|
||||
texturedRectSpecial = NULL;
|
||||
texturedRectSpecial = nullptr;
|
||||
}
|
||||
|
||||
static
|
||||
|
@ -1983,7 +1983,7 @@ void displayLoadProgress(const wchar_t *format, ...)
|
|||
wcstombs(buf, wbuf, INFO_BUF);
|
||||
|
||||
FrameBuffer* pBuffer = frameBufferList().getCurrent();
|
||||
if (pBuffer != NULL)
|
||||
if (pBuffer != nullptr)
|
||||
glBindFramebuffer(GL_DRAW_FRAMEBUFFER, 0);
|
||||
|
||||
OGLRender & render = video().getRender();
|
||||
|
@ -1991,7 +1991,7 @@ void displayLoadProgress(const wchar_t *format, ...)
|
|||
render.drawText(buf, -0.9f, 0);
|
||||
video().swapBuffers();
|
||||
|
||||
if (pBuffer != NULL)
|
||||
if (pBuffer != nullptr)
|
||||
glBindFramebuffer(GL_DRAW_FRAMEBUFFER, pBuffer->m_FBO);
|
||||
}
|
||||
|
||||
|
|
48
src/RSP.cpp
48
src/RSP.cpp
|
@ -268,11 +268,11 @@ u32 DepthClearColor = 0xfffcfffc;
|
|||
static
|
||||
void setDepthClearColor()
|
||||
{
|
||||
if (strstr(RSP.romname, (const char *)"Elmo's") != NULL)
|
||||
if (strstr(RSP.romname, (const char *)"Elmo's") != nullptr)
|
||||
DepthClearColor = 0xFFFFFFFF;
|
||||
else if (strstr(RSP.romname, (const char *)"Taz Express") != NULL)
|
||||
else if (strstr(RSP.romname, (const char *)"Taz Express") != nullptr)
|
||||
DepthClearColor = 0xFFBCFFBC;
|
||||
else if (strstr(RSP.romname, (const char *)"NFL QBC 2000") != NULL || strstr(RSP.romname, (const char *)"NFL Quarterback Club") != NULL || strstr(RSP.romname, (const char *)"Jeremy McGrath Super") != NULL)
|
||||
else if (strstr(RSP.romname, (const char *)"NFL QBC 2000") != nullptr || strstr(RSP.romname, (const char *)"NFL Quarterback Club") != nullptr || strstr(RSP.romname, (const char *)"Jeremy McGrath Super") != nullptr)
|
||||
DepthClearColor = 0xFFFDFFFC;
|
||||
else
|
||||
DepthClearColor = 0xFFFCFFFC;
|
||||
|
@ -318,42 +318,42 @@ void RSP_Init()
|
|||
strncpy(RSP.romname, romname, 21);
|
||||
setDepthClearColor();
|
||||
config.generalEmulation.hacks = 0;
|
||||
if (strstr(RSP.romname, (const char *)"OgreBattle64") != NULL)
|
||||
if (strstr(RSP.romname, (const char *)"OgreBattle64") != nullptr)
|
||||
config.generalEmulation.hacks |= hack_Ogre64;
|
||||
else if (strstr(RSP.romname, (const char *)"MarioGolf64") != NULL ||
|
||||
strstr(RSP.romname, (const char *)"F1 POLE POSITION 64") != NULL)
|
||||
else if (strstr(RSP.romname, (const char *)"MarioGolf64") != nullptr ||
|
||||
strstr(RSP.romname, (const char *)"F1 POLE POSITION 64") != nullptr)
|
||||
config.generalEmulation.hacks |= hack_noDepthFrameBuffers;
|
||||
else if (strstr(RSP.romname, (const char *)"CONKER BFD") != NULL)
|
||||
else if (strstr(RSP.romname, (const char *)"CONKER BFD") != nullptr)
|
||||
config.generalEmulation.hacks |= hack_blurPauseScreen | hack_rectDepthBufferCopyCBFD;
|
||||
else if (strstr(RSP.romname, (const char *)"MICKEY USA") != NULL)
|
||||
else if (strstr(RSP.romname, (const char *)"MICKEY USA") != nullptr)
|
||||
config.generalEmulation.hacks |= hack_blurPauseScreen;
|
||||
else if (strstr(RSP.romname, (const char *)"MarioTennis64") != NULL)
|
||||
else if (strstr(RSP.romname, (const char *)"MarioTennis64") != nullptr)
|
||||
config.generalEmulation.hacks |= hack_scoreboardJ;
|
||||
else if (strstr(RSP.romname, (const char *)"MarioTennis") != NULL)
|
||||
else if (strstr(RSP.romname, (const char *)"MarioTennis") != nullptr)
|
||||
config.generalEmulation.hacks |= hack_scoreboard;
|
||||
else if (strstr(RSP.romname, (const char *)"Pilot Wings64") != NULL)
|
||||
else if (strstr(RSP.romname, (const char *)"Pilot Wings64") != nullptr)
|
||||
config.generalEmulation.hacks |= hack_pilotWings;
|
||||
else if (strstr(RSP.romname, (const char *)"THE LEGEND OF ZELDA") != NULL ||
|
||||
strstr(RSP.romname, (const char *)"ZELDA MASTER QUEST") != NULL ||
|
||||
strstr(RSP.romname, (const char *)"DOUBUTSUNOMORI") != NULL)
|
||||
else if (strstr(RSP.romname, (const char *)"THE LEGEND OF ZELDA") != nullptr ||
|
||||
strstr(RSP.romname, (const char *)"ZELDA MASTER QUEST") != nullptr ||
|
||||
strstr(RSP.romname, (const char *)"DOUBUTSUNOMORI") != nullptr)
|
||||
config.generalEmulation.hacks |= hack_subscreen;
|
||||
else if (strstr(RSP.romname, (const char *)"LEGORacers") != NULL)
|
||||
else if (strstr(RSP.romname, (const char *)"LEGORacers") != nullptr)
|
||||
config.generalEmulation.hacks |= hack_legoRacers;
|
||||
else if (strstr(RSP.romname, (const char *)"Blast") != NULL)
|
||||
else if (strstr(RSP.romname, (const char *)"Blast") != nullptr)
|
||||
config.generalEmulation.hacks |= hack_blastCorps;
|
||||
else if (strstr(RSP.romname, (const char *)"SPACE INVADERS") != NULL)
|
||||
else if (strstr(RSP.romname, (const char *)"SPACE INVADERS") != nullptr)
|
||||
config.generalEmulation.hacks |= hack_ignoreVIHeightChange;
|
||||
else if (strstr(RSP.romname, (const char *)"MASK") != NULL) // Zelda MM
|
||||
else if (strstr(RSP.romname, (const char *)"MASK") != nullptr) // Zelda MM
|
||||
config.generalEmulation.hacks |= hack_ZeldaMM;
|
||||
else if (strstr(RSP.romname, (const char *)"Perfect Dark") != NULL ||
|
||||
strstr(RSP.romname, (const char *)"PERFECT DARK") != NULL)
|
||||
else if (strstr(RSP.romname, (const char *)"Perfect Dark") != nullptr ||
|
||||
strstr(RSP.romname, (const char *)"PERFECT DARK") != nullptr)
|
||||
config.generalEmulation.hacks |= hack_rectDepthBufferCopyPD;
|
||||
else if (strstr(RSP.romname, (const char *)"Jeremy McGrath Super") != NULL)
|
||||
else if (strstr(RSP.romname, (const char *)"Jeremy McGrath Super") != nullptr)
|
||||
config.generalEmulation.hacks |= hack_ModifyVertexXyInShader;
|
||||
else if (strstr(RSP.romname, (const char *)"Quake") != NULL ||
|
||||
strstr(RSP.romname, (const char *)"QUAKE II") != NULL)
|
||||
else if (strstr(RSP.romname, (const char *)"Quake") != nullptr ||
|
||||
strstr(RSP.romname, (const char *)"QUAKE II") != nullptr)
|
||||
config.generalEmulation.hacks |= hack_doNotResetTLUTmode;
|
||||
else if (strstr(RSP.romname, (const char *)"quarterback_club_98") != NULL)
|
||||
else if (strstr(RSP.romname, (const char *)"quarterback_club_98") != nullptr)
|
||||
config.generalEmulation.hacks |= hack_LoadDepthTextures;
|
||||
|
||||
api().FindPluginPath(RSP.pluginpath);
|
||||
|
|
|
@ -59,12 +59,12 @@ void logErrorShader(GLenum _shaderType, const std::string & _strShader)
|
|||
GLuint createShaderProgram(const char * _strVertex, const char * _strFragment)
|
||||
{
|
||||
GLuint vertex_shader_object = glCreateShader(GL_VERTEX_SHADER);
|
||||
glShaderSource(vertex_shader_object, 1, &_strVertex, NULL);
|
||||
glShaderSource(vertex_shader_object, 1, &_strVertex, nullptr);
|
||||
glCompileShader(vertex_shader_object);
|
||||
assert(checkShaderCompileStatus(vertex_shader_object));
|
||||
|
||||
GLuint fragment_shader_object = glCreateShader(GL_FRAGMENT_SHADER);
|
||||
glShaderSource(fragment_shader_object, 1, &_strFragment, NULL);
|
||||
glShaderSource(fragment_shader_object, 1, &_strFragment, nullptr);
|
||||
glCompileShader(fragment_shader_object);
|
||||
assert(checkShaderCompileStatus(fragment_shader_object));
|
||||
|
||||
|
|
|
@ -210,7 +210,7 @@ struct Atlas {
|
|||
};
|
||||
|
||||
TextDrawer::TextDrawer() :
|
||||
m_pAtlas(NULL), m_program(0), m_uTex(0), m_uColor(0), m_vbo(0)
|
||||
m_pAtlas(nullptr), m_program(0), m_uTex(0), m_uColor(0), m_vbo(0)
|
||||
{}
|
||||
|
||||
TextDrawer & TextDrawer::get() {
|
||||
|
@ -223,7 +223,7 @@ bool getFontFileName(char * _strName)
|
|||
{
|
||||
#ifdef OS_WINDOWS
|
||||
char * pSysPath = getenv("WINDIR");
|
||||
if (pSysPath == NULL)
|
||||
if (pSysPath == nullptr)
|
||||
return false;
|
||||
sprintf(_strName, "%s/Fonts/%s", pSysPath, config.font.name.c_str());
|
||||
#elif defined (ANDROID)
|
||||
|
@ -241,7 +241,7 @@ FT_Face face;
|
|||
|
||||
void TextDrawer::init()
|
||||
{
|
||||
if (m_pAtlas != NULL)
|
||||
if (m_pAtlas != nullptr)
|
||||
return;
|
||||
|
||||
char strBuffer[PLUGIN_PATH_SIZE];
|
||||
|
@ -282,10 +282,10 @@ void TextDrawer::init()
|
|||
|
||||
void TextDrawer::destroy()
|
||||
{
|
||||
if (m_pAtlas == NULL)
|
||||
if (m_pAtlas == nullptr)
|
||||
return;
|
||||
delete m_pAtlas;
|
||||
m_pAtlas = NULL;
|
||||
m_pAtlas = nullptr;
|
||||
glDeleteBuffers(1, &m_vbo);
|
||||
m_vbo = 0;
|
||||
glDeleteProgram(m_program);
|
||||
|
@ -301,7 +301,7 @@ void TextDrawer::destroy()
|
|||
*/
|
||||
void TextDrawer::renderText(const char *_pText, float _x, float _y) const
|
||||
{
|
||||
if (m_pAtlas == NULL)
|
||||
if (m_pAtlas == nullptr)
|
||||
return;
|
||||
OGLVideo & ogl = video();
|
||||
const float sx = 2.0f / ogl.getWidth();
|
||||
|
|
|
@ -479,7 +479,7 @@ void TextureCache::init()
|
|||
m_cachedBytes = m_pDummy->textureBytes;
|
||||
activateDummy( 0 );
|
||||
activateDummy( 1 );
|
||||
current[0] = current[1] = NULL;
|
||||
current[0] = current[1] = nullptr;
|
||||
|
||||
#ifdef GL_MULTISAMPLING_SUPPORT
|
||||
if (config.video.multisampling != 0) {
|
||||
|
@ -500,13 +500,13 @@ void TextureCache::init()
|
|||
activateMSDummy(1);
|
||||
} else
|
||||
#endif
|
||||
m_pMSDummy = NULL;
|
||||
m_pMSDummy = nullptr;
|
||||
assert(!isGLError());
|
||||
}
|
||||
|
||||
void TextureCache::destroy()
|
||||
{
|
||||
current[0] = current[1] = NULL;
|
||||
current[0] = current[1] = nullptr;
|
||||
|
||||
for (Textures::const_iterator cur = m_textures.cbegin(); cur != m_textures.cend(); ++cur)
|
||||
glDeleteTextures( 1, &cur->glName );
|
||||
|
@ -594,7 +594,7 @@ void _calcTileSizes(u32 _t, TileSizes & _sizes, gDPTile * _pLoadTile)
|
|||
const u32 tileWidth = ((pTile->lrs - pTile->uls) & 0x03FF) + 1;
|
||||
const u32 tileHeight = ((pTile->lrt - pTile->ult) & 0x03FF) + 1;
|
||||
|
||||
const bool bUseLoadSizes = _pLoadTile != NULL && _pLoadTile->loadType == LOADTYPE_TILE &&
|
||||
const bool bUseLoadSizes = _pLoadTile != nullptr && _pLoadTile->loadType == LOADTYPE_TILE &&
|
||||
(pTile->tmem == _pLoadTile->tmem);
|
||||
|
||||
u32 loadWidth = 0, loadHeight = 0;
|
||||
|
@ -715,8 +715,8 @@ bool TextureCache::_loadHiresBackground(CachedTexture *_pTexture)
|
|||
int tile_height = gSP.bgImage.height;
|
||||
int bpl = tile_width << gSP.bgImage.size >> 1;
|
||||
|
||||
u8 * paladdr = NULL;
|
||||
u16 * palette = NULL;
|
||||
u8 * paladdr = nullptr;
|
||||
u16 * palette = nullptr;
|
||||
if ((gSP.bgImage.size < G_IM_SIZ_16b) && (gDP.otherMode.textureLUT != G_TT_NONE || gSP.bgImage.format == G_IM_FMT_CI)) {
|
||||
if (gSP.bgImage.size == G_IM_SIZ_8b)
|
||||
paladdr = (u8*)(gDP.TexFilterPalette);
|
||||
|
@ -775,10 +775,10 @@ void TextureCache::_loadBackground(CachedTexture *pTexture)
|
|||
bpl = gSP.bgImage.width << gSP.bgImage.size >> 1;
|
||||
numBytes = bpl * gSP.bgImage.height;
|
||||
pSwapped = (u8*)malloc(numBytes);
|
||||
assert(pSwapped != NULL);
|
||||
assert(pSwapped != nullptr);
|
||||
UnswapCopyWrap(RDRAM, gSP.bgImage.address, pSwapped, 0, RDRAMSize, numBytes);
|
||||
pDest = (u32*)malloc(pTexture->textureBytes);
|
||||
assert(pDest != NULL);
|
||||
assert(pDest != nullptr);
|
||||
|
||||
clampSClamp = pTexture->width - 1;
|
||||
clampTClamp = pTexture->height - 1;
|
||||
|
@ -806,7 +806,7 @@ void TextureCache::_loadBackground(CachedTexture *pTexture)
|
|||
GHQTexInfo ghqTexInfo;
|
||||
if (txfilter_filter((u8*)pDest, pTexture->realWidth, pTexture->realHeight,
|
||||
glInternalFormat, (uint64)pTexture->crc, &ghqTexInfo) != 0 &&
|
||||
ghqTexInfo.data != NULL) {
|
||||
ghqTexInfo.data != nullptr) {
|
||||
if (ghqTexInfo.width % 2 != 0 &&
|
||||
ghqTexInfo.format != GL_RGBA &&
|
||||
m_curUnpackAlignment > 1)
|
||||
|
@ -864,8 +864,8 @@ bool TextureCache::_loadHiresTexture(u32 _tile, CachedTexture *_pTexture, u64 &
|
|||
}
|
||||
}
|
||||
|
||||
u8 * paladdr = NULL;
|
||||
u16 * palette = NULL;
|
||||
u8 * paladdr = nullptr;
|
||||
u16 * palette = nullptr;
|
||||
if ((_pTexture->size < G_IM_SIZ_16b) && (gDP.otherMode.textureLUT != G_TT_NONE || _pTexture->format == G_IM_FMT_CI)) {
|
||||
if (_pTexture->size == G_IM_SIZ_8b)
|
||||
paladdr = (u8*)(gDP.TexFilterPalette);
|
||||
|
@ -899,7 +899,7 @@ void TextureCache::_loadDepthTexture(CachedTexture * _pTexture, u16* _pDest)
|
|||
const u32 numTexels = _pTexture->realWidth * _pTexture->realHeight;
|
||||
_pTexture->textureBytes = numTexels * sizeof(GLfloat);
|
||||
GLfloat * pDestF = (GLfloat*)malloc(_pTexture->textureBytes);
|
||||
assert(pDestF != NULL);
|
||||
assert(pDestF != nullptr);
|
||||
|
||||
for (u32 t = 0; t < numTexels; ++t)
|
||||
pDestF[t] = _pDest[t] / 65535.0f;
|
||||
|
@ -1057,7 +1057,7 @@ void TextureCache::_load(u32 _tile, CachedTexture *_pTexture)
|
|||
}
|
||||
|
||||
pDest = (u32*)malloc(_pTexture->textureBytes);
|
||||
assert(pDest != NULL);
|
||||
assert(pDest != nullptr);
|
||||
|
||||
GLint mipLevel = 0, maxLevel = 0;
|
||||
#ifndef GLES2
|
||||
|
@ -1099,7 +1099,7 @@ void TextureCache::_load(u32 _tile, CachedTexture *_pTexture)
|
|||
GHQTexInfo ghqTexInfo;
|
||||
if (txfilter_filter((u8*)pDest, tmptex.realWidth, tmptex.realHeight,
|
||||
glInternalFormat, (uint64)_pTexture->crc,
|
||||
&ghqTexInfo) != 0 && ghqTexInfo.data != NULL) {
|
||||
&ghqTexInfo) != 0 && ghqTexInfo.data != nullptr) {
|
||||
#ifdef GLES2
|
||||
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA,
|
||||
ghqTexInfo.width, ghqTexInfo.height,
|
||||
|
@ -1139,7 +1139,7 @@ void TextureCache::_load(u32 _tile, CachedTexture *_pTexture)
|
|||
tmptex.maskS = mipTile.masks;
|
||||
tmptex.maskT = mipTile.maskt;
|
||||
TileSizes sizes;
|
||||
_calcTileSizes(tileMipLevel, sizes, NULL);
|
||||
_calcTileSizes(tileMipLevel, sizes, nullptr);
|
||||
tmptex.width = sizes.width;
|
||||
tmptex.clampWidth = sizes.clampWidth;
|
||||
tmptex.height = sizes.height;
|
||||
|
@ -1375,7 +1375,7 @@ void TextureCache::_updateBackground()
|
|||
|
||||
void TextureCache::_clear()
|
||||
{
|
||||
current[0] = current[1] = NULL;
|
||||
current[0] = current[1] = nullptr;
|
||||
|
||||
for (Textures::const_iterator cur = m_textures.cbegin(); cur != m_textures.cend(); ++cur) {
|
||||
m_cachedBytes -= cur->textureBytes;
|
||||
|
@ -1457,7 +1457,7 @@ void TextureCache::update(u32 _t)
|
|||
crc = _calculateCRC( _t, params );
|
||||
}
|
||||
|
||||
if (current[_t] != NULL && current[_t]->crc == crc) {
|
||||
if (current[_t] != nullptr && current[_t]->crc == crc) {
|
||||
activateTexture(_t, current[_t]);
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -65,10 +65,10 @@ struct TextureCache
|
|||
static TextureCache & get();
|
||||
|
||||
private:
|
||||
TextureCache() : m_pDummy(NULL), m_hits(0), m_misses(0), m_maxBytes(0), m_cachedBytes(0), m_curUnpackAlignment(4), m_toggleDumpTex(false)
|
||||
TextureCache() : m_pDummy(nullptr), m_hits(0), m_misses(0), m_maxBytes(0), m_cachedBytes(0), m_curUnpackAlignment(4), m_toggleDumpTex(false)
|
||||
{
|
||||
current[0] = NULL;
|
||||
current[1] = NULL;
|
||||
current[0] = nullptr;
|
||||
current[1] = nullptr;
|
||||
CRC_BuildTable();
|
||||
}
|
||||
TextureCache(const TextureCache &);
|
||||
|
|
10
src/VI.cpp
10
src/VI.cpp
|
@ -68,12 +68,12 @@ void VI_UpdateSize()
|
|||
// const int divot = ((*REG.VI_STATUS) >> 4) & 1;
|
||||
FrameBufferList & fbList = frameBufferList();
|
||||
FrameBuffer * pBuffer = fbList.findBuffer(VI.lastOrigin);
|
||||
DepthBuffer * pDepthBuffer = pBuffer != NULL ? pBuffer->m_pDepthBuffer : NULL;
|
||||
DepthBuffer * pDepthBuffer = pBuffer != nullptr ? pBuffer->m_pDepthBuffer : nullptr;
|
||||
if (config.frameBufferEmulation.enable && ((config.generalEmulation.hacks & hack_ZeldaMM) == 0) &&
|
||||
((interlacedPrev != VI.interlaced) ||
|
||||
(VI.width > 0 && VI.width != VI.widthPrev) ||
|
||||
(!VI.interlaced && pDepthBuffer != NULL && pDepthBuffer->m_width != VI.width) ||
|
||||
((config.generalEmulation.hacks & hack_ignoreVIHeightChange) == 0 && pBuffer != NULL && pBuffer->m_height != VI.height))
|
||||
(!VI.interlaced && pDepthBuffer != nullptr && pDepthBuffer->m_width != VI.width) ||
|
||||
((config.generalEmulation.hacks & hack_ignoreVIHeightChange) == 0 && pBuffer != nullptr && pBuffer->m_height != VI.height))
|
||||
) {
|
||||
fbList.removeBuffers(VI.widthPrev);
|
||||
fbList.removeBuffers(VI.width);
|
||||
|
@ -110,7 +110,7 @@ void VI_UpdateScreen()
|
|||
if (config.frameBufferEmulation.enable) {
|
||||
|
||||
FrameBuffer * pBuffer = frameBufferList().findBuffer(*REG.VI_ORIGIN);
|
||||
if (pBuffer == NULL)
|
||||
if (pBuffer == nullptr)
|
||||
gDP.changed |= CHANGED_CPU_FB_WRITE;
|
||||
else if (!FBInfo::fbInfo.isSupported() && !pBuffer->isValid()) {
|
||||
gDP.changed |= CHANGED_CPU_FB_WRITE;
|
||||
|
@ -134,7 +134,7 @@ void VI_UpdateScreen()
|
|||
|
||||
if (bNeedSwap) {
|
||||
if (bCFB) {
|
||||
if (pBuffer == NULL || pBuffer->m_width != VI.width) {
|
||||
if (pBuffer == nullptr || pBuffer->m_width != VI.width) {
|
||||
if (!bVIUpdated) {
|
||||
VI_UpdateSize();
|
||||
ogl.updateScale();
|
||||
|
|
|
@ -329,8 +329,8 @@ void ZSort_MTXRNSP( u32, u32 )
|
|||
|
||||
void ZSort_MTXCAT(u32 _w0, u32 _w1)
|
||||
{
|
||||
M44 *s = NULL;
|
||||
M44 *t = NULL;
|
||||
M44 *s = nullptr;
|
||||
M44 *t = nullptr;
|
||||
u32 S = _SHIFTR(_w0, 0, 4);
|
||||
u32 T = _SHIFTR(_w1, 16, 4);
|
||||
u32 D = _SHIFTR(_w1, 0, 4);
|
||||
|
@ -356,7 +356,7 @@ void ZSort_MTXCAT(u32 _w0, u32 _w1)
|
|||
t = (M44*)gSP.matrix.combined;
|
||||
break;
|
||||
}
|
||||
assert(s != NULL && t != NULL);
|
||||
assert(s != nullptr && t != nullptr);
|
||||
f32 m[4][4];
|
||||
MultMatrix(*s, *t, m);
|
||||
|
||||
|
|
|
@ -161,7 +161,7 @@ void PluginAPI::RomClosed()
|
|||
&m_pluginThreadCv)
|
||||
);
|
||||
delete m_pRspThread;
|
||||
m_pRspThread = NULL;
|
||||
m_pRspThread = nullptr;
|
||||
#else
|
||||
TFH.shutdown();
|
||||
video().stop();
|
||||
|
|
|
@ -371,14 +371,14 @@ static
|
|||
bool CheckForFrameBufferTexture(u32 _address, u32 _bytes)
|
||||
{
|
||||
gDP.loadTile->textureMode = TEXTUREMODE_NORMAL;
|
||||
gDP.loadTile->frameBuffer = NULL;
|
||||
gDP.loadTile->frameBuffer = nullptr;
|
||||
gDP.changed |= CHANGED_TMEM;
|
||||
if (!config.frameBufferEmulation.enable)
|
||||
return false;
|
||||
|
||||
FrameBufferList & fbList = frameBufferList();
|
||||
FrameBuffer *pBuffer = fbList.findBuffer(_address);
|
||||
bool bRes = pBuffer != NULL;
|
||||
bool bRes = pBuffer != nullptr;
|
||||
if (bRes) {
|
||||
if ((config.generalEmulation.hacks & hack_blurPauseScreen) != 0) {
|
||||
if (gDP.colorImage.address == gDP.depthImageAddress && pBuffer->m_copiedToRdram) {
|
||||
|
@ -620,7 +620,7 @@ void gDPLoadBlock(u32 tile, u32 uls, u32 ult, u32 lrs, u32 dxt)
|
|||
return;
|
||||
}
|
||||
|
||||
gDP.loadTile->frameBuffer = NULL;
|
||||
gDP.loadTile->frameBuffer = nullptr;
|
||||
CheckForFrameBufferTexture(address, bytes); // Load data to TMEM even if FB texture is found. See comment to texturedRectDepthBufferCopy
|
||||
|
||||
if (gDP.loadTile->size == G_IM_SIZ_32b)
|
||||
|
@ -726,7 +726,7 @@ void gDPSetScissor( u32 mode, f32 ulx, f32 uly, f32 lrx, f32 lry )
|
|||
void gDPFillRDRAM(u32 address, s32 ulx, s32 uly, s32 lrx, s32 lry, u32 width, u32 size, u32 color, bool scissor)
|
||||
{
|
||||
FrameBuffer * pCurrentBuffer = frameBufferList().getCurrent();
|
||||
if (pCurrentBuffer != NULL) {
|
||||
if (pCurrentBuffer != nullptr) {
|
||||
pCurrentBuffer->m_cleared = true;
|
||||
pCurrentBuffer->m_fillcolor = color;
|
||||
}
|
||||
|
|
20
src/gSP.cpp
20
src/gSP.cpp
|
@ -175,7 +175,7 @@ static void gSPLightVertex4_default(u32 v)
|
|||
|
||||
static void gSPPointLightVertex4_default(u32 v, float _vPos[4][3])
|
||||
{
|
||||
assert(_vPos != NULL);
|
||||
assert(_vPos != nullptr);
|
||||
gSPTransformNormal4(v, gSP.matrix.modelView[gSP.matrix.modelViewi]);
|
||||
OGLRender & render = video().getRender();
|
||||
for(int j = 0; j < 4; ++j) {
|
||||
|
@ -425,7 +425,7 @@ static void gSPLightVertex_default(SPVertex & _vtx)
|
|||
|
||||
static void gSPPointLightVertex_default(SPVertex & _vtx, float * _vPos)
|
||||
{
|
||||
assert(_vPos != NULL);
|
||||
assert(_vPos != nullptr);
|
||||
float light_intensity = 0.0f;
|
||||
_vtx.HWLight = 0;
|
||||
_vtx.r = gSP.lights[gSP.numLights].r;
|
||||
|
@ -2030,7 +2030,7 @@ void _drawYUVImageToFrameBuffer(const ObjCoordinates & _objCoords)
|
|||
dst += ci_width - 16;
|
||||
}
|
||||
FrameBuffer *pBuffer = frameBufferList().getCurrent();
|
||||
if (pBuffer != NULL)
|
||||
if (pBuffer != nullptr)
|
||||
pBuffer->m_isOBScreen = true;
|
||||
}
|
||||
|
||||
|
@ -2070,10 +2070,10 @@ void _copyDepthBuffer()
|
|||
// Take any frame buffer and attach source depth buffer to it, to blit it into copy depth buffer
|
||||
FrameBufferList & fbList = frameBufferList();
|
||||
FrameBuffer * pTmpBuffer = fbList.findTmpBuffer(fbList.getCurrent()->m_startAddress);
|
||||
if (pTmpBuffer == NULL)
|
||||
if (pTmpBuffer == nullptr)
|
||||
return;
|
||||
DepthBuffer * pCopyBufferDepth = dbList.findBuffer(gSP.bgImage.address);
|
||||
if (pCopyBufferDepth == NULL)
|
||||
if (pCopyBufferDepth == nullptr)
|
||||
return;
|
||||
glBindFramebuffer(GL_READ_FRAMEBUFFER, pTmpBuffer->m_FBO);
|
||||
pCopyBufferDepth->setDepthAttachment(GL_READ_FRAMEBUFFER);
|
||||
|
@ -2085,7 +2085,7 @@ void _copyDepthBuffer()
|
|||
GL_DEPTH_BUFFER_BIT, GL_NEAREST
|
||||
);
|
||||
// Restore objects
|
||||
if (pTmpBuffer->m_pDepthBuffer != NULL)
|
||||
if (pTmpBuffer->m_pDepthBuffer != nullptr)
|
||||
pTmpBuffer->m_pDepthBuffer->setDepthAttachment(GL_READ_FRAMEBUFFER);
|
||||
glBindFramebuffer(GL_READ_FRAMEBUFFER, 0);
|
||||
// Set back current depth buffer
|
||||
|
@ -2116,7 +2116,7 @@ void _loadBGImage(const uObjScaleBg * _bgInfo, bool _loadScale)
|
|||
|
||||
if (config.frameBufferEmulation.enable) {
|
||||
FrameBuffer *pBuffer = frameBufferList().findBuffer(gSP.bgImage.address);
|
||||
if ((pBuffer != NULL) && pBuffer->m_size == gSP.bgImage.size && (!pBuffer->m_isDepthBuffer || pBuffer->m_changed)) {
|
||||
if ((pBuffer != nullptr) && pBuffer->m_size == gSP.bgImage.size && (!pBuffer->m_isDepthBuffer || pBuffer->m_changed)) {
|
||||
gDP.tiles[0].frameBuffer = pBuffer;
|
||||
gDP.tiles[0].textureMode = TEXTUREMODE_FRAMEBUFFER_BG;
|
||||
gDP.tiles[0].loadType = LOADTYPE_TILE;
|
||||
|
@ -2141,7 +2141,7 @@ void gSPBgRect1Cyc( u32 _bg )
|
|||
// In later case depth buffer is used as temporal color buffer, and usual rendering must be used.
|
||||
// Since both situations are hard to distinguish, do the both depth buffer copy and bg rendering.
|
||||
if ((config.generalEmulation.hacks & hack_ZeldaMM) != 0 &&
|
||||
(gSP.bgImage.address == gDP.depthImageAddress || depthBufferList().findBuffer(gSP.bgImage.address) != NULL)
|
||||
(gSP.bgImage.address == gDP.depthImageAddress || depthBufferList().findBuffer(gSP.bgImage.address) != nullptr)
|
||||
)
|
||||
_copyDepthBuffer();
|
||||
#endif // GLES2
|
||||
|
@ -2163,7 +2163,7 @@ void gSPBgRectCopy( u32 _bg )
|
|||
#ifdef GL_IMAGE_TEXTURES_SUPPORT
|
||||
// See comment to gSPBgRect1Cyc
|
||||
if ((config.generalEmulation.hacks & hack_ZeldaMM) != 0 &&
|
||||
(gSP.bgImage.address == gDP.depthImageAddress || depthBufferList().findBuffer(gSP.bgImage.address) != NULL)
|
||||
(gSP.bgImage.address == gDP.depthImageAddress || depthBufferList().findBuffer(gSP.bgImage.address) != nullptr)
|
||||
)
|
||||
_copyDepthBuffer();
|
||||
#endif // GL_IMAGE_TEXTURES_SUPPORT
|
||||
|
@ -2254,7 +2254,7 @@ void _loadSpriteImage(const uSprite *_pSprite)
|
|||
if (config.frameBufferEmulation.enable != 0)
|
||||
{
|
||||
FrameBuffer *pBuffer = frameBufferList().findBuffer(gSP.bgImage.address);
|
||||
if (pBuffer != NULL) {
|
||||
if (pBuffer != nullptr) {
|
||||
gDP.tiles[0].frameBuffer = pBuffer;
|
||||
gDP.tiles[0].textureMode = TEXTUREMODE_FRAMEBUFFER_BG;
|
||||
gDP.tiles[0].loadType = LOADTYPE_TILE;
|
||||
|
|
|
@ -48,10 +48,10 @@ void PluginAPI::GetUserCachePath(wchar_t * _strPath)
|
|||
|
||||
void PluginAPI::FindPluginPath(wchar_t * _strPath)
|
||||
{
|
||||
if (_strPath == NULL)
|
||||
if (_strPath == nullptr)
|
||||
return;
|
||||
#ifdef OS_WINDOWS
|
||||
GetModuleFileNameW(NULL, _strPath, PLUGIN_PATH_SIZE);
|
||||
GetModuleFileNameW(nullptr, _strPath, PLUGIN_PATH_SIZE);
|
||||
_cutLastPathSeparator(_strPath);
|
||||
#elif defined(OS_LINUX)
|
||||
char path[512];
|
||||
|
|
|
@ -16,8 +16,8 @@ Config config;
|
|||
static
|
||||
const u32 uMegabyte = 1024U*1024U;
|
||||
|
||||
static m64p_handle g_configVideoGeneral = NULL;
|
||||
static m64p_handle g_configVideoGliden64 = NULL;
|
||||
static m64p_handle g_configVideoGeneral = nullptr;
|
||||
static m64p_handle g_configVideoGliden64 = nullptr;
|
||||
|
||||
static
|
||||
bool Config_SetDefault()
|
||||
|
@ -241,7 +241,7 @@ void Config_LoadConfig()
|
|||
config.font.name = "arial.ttf";
|
||||
char buf[16];
|
||||
sprintf(buf, "0x%s", ConfigGetParamString(g_configVideoGliden64, "fontColor"));
|
||||
long int uColor = strtol(buf, NULL, 16);
|
||||
long int uColor = strtol(buf, nullptr, 16);
|
||||
if (uColor != 0) {
|
||||
config.font.color[0] = _SHIFTR(uColor, 16, 8);
|
||||
config.font.color[1] = _SHIFTR(uColor, 8, 8);
|
||||
|
|
|
@ -9,37 +9,37 @@
|
|||
#define DLSYM(a, b) dlsym(a, b)
|
||||
#endif // OS_WINDOWS
|
||||
|
||||
ptr_ConfigGetSharedDataFilepath ConfigGetSharedDataFilepath = NULL;
|
||||
ptr_ConfigGetUserConfigPath ConfigGetUserConfigPath = NULL;
|
||||
ptr_ConfigGetUserDataPath ConfigGetUserDataPath = NULL;
|
||||
ptr_ConfigGetUserCachePath ConfigGetUserCachePath = NULL;
|
||||
ptr_ConfigOpenSection ConfigOpenSection = NULL;
|
||||
ptr_ConfigDeleteSection ConfigDeleteSection = NULL;
|
||||
ptr_ConfigSaveSection ConfigSaveSection = NULL;
|
||||
ptr_ConfigSaveFile ConfigSaveFile = NULL;
|
||||
ptr_ConfigSetDefaultInt ConfigSetDefaultInt = NULL;
|
||||
ptr_ConfigSetDefaultFloat ConfigSetDefaultFloat = NULL;
|
||||
ptr_ConfigSetDefaultBool ConfigSetDefaultBool = NULL;
|
||||
ptr_ConfigSetDefaultString ConfigSetDefaultString = NULL;
|
||||
ptr_ConfigGetParamInt ConfigGetParamInt = NULL;
|
||||
ptr_ConfigGetParamFloat ConfigGetParamFloat = NULL;
|
||||
ptr_ConfigGetParamBool ConfigGetParamBool = NULL;
|
||||
ptr_ConfigGetParamString ConfigGetParamString = NULL;
|
||||
ptr_ConfigGetSharedDataFilepath ConfigGetSharedDataFilepath = nullptr;
|
||||
ptr_ConfigGetUserConfigPath ConfigGetUserConfigPath = nullptr;
|
||||
ptr_ConfigGetUserDataPath ConfigGetUserDataPath = nullptr;
|
||||
ptr_ConfigGetUserCachePath ConfigGetUserCachePath = nullptr;
|
||||
ptr_ConfigOpenSection ConfigOpenSection = nullptr;
|
||||
ptr_ConfigDeleteSection ConfigDeleteSection = nullptr;
|
||||
ptr_ConfigSaveSection ConfigSaveSection = nullptr;
|
||||
ptr_ConfigSaveFile ConfigSaveFile = nullptr;
|
||||
ptr_ConfigSetDefaultInt ConfigSetDefaultInt = nullptr;
|
||||
ptr_ConfigSetDefaultFloat ConfigSetDefaultFloat = nullptr;
|
||||
ptr_ConfigSetDefaultBool ConfigSetDefaultBool = nullptr;
|
||||
ptr_ConfigSetDefaultString ConfigSetDefaultString = nullptr;
|
||||
ptr_ConfigGetParamInt ConfigGetParamInt = nullptr;
|
||||
ptr_ConfigGetParamFloat ConfigGetParamFloat = nullptr;
|
||||
ptr_ConfigGetParamBool ConfigGetParamBool = nullptr;
|
||||
ptr_ConfigGetParamString ConfigGetParamString = nullptr;
|
||||
|
||||
/* definitions of pointers to Core video extension functions */
|
||||
ptr_VidExt_Init CoreVideo_Init = NULL;
|
||||
ptr_VidExt_Quit CoreVideo_Quit = NULL;
|
||||
ptr_VidExt_ListFullscreenModes CoreVideo_ListFullscreenModes = NULL;
|
||||
ptr_VidExt_SetVideoMode CoreVideo_SetVideoMode = NULL;
|
||||
ptr_VidExt_SetCaption CoreVideo_SetCaption = NULL;
|
||||
ptr_VidExt_ToggleFullScreen CoreVideo_ToggleFullScreen = NULL;
|
||||
ptr_VidExt_ResizeWindow CoreVideo_ResizeWindow = NULL;
|
||||
ptr_VidExt_GL_GetProcAddress CoreVideo_GL_GetProcAddress = NULL;
|
||||
ptr_VidExt_GL_SetAttribute CoreVideo_GL_SetAttribute = NULL;
|
||||
ptr_VidExt_GL_GetAttribute CoreVideo_GL_GetAttribute = NULL;
|
||||
ptr_VidExt_GL_SwapBuffers CoreVideo_GL_SwapBuffers = NULL;
|
||||
ptr_VidExt_Init CoreVideo_Init = nullptr;
|
||||
ptr_VidExt_Quit CoreVideo_Quit = nullptr;
|
||||
ptr_VidExt_ListFullscreenModes CoreVideo_ListFullscreenModes = nullptr;
|
||||
ptr_VidExt_SetVideoMode CoreVideo_SetVideoMode = nullptr;
|
||||
ptr_VidExt_SetCaption CoreVideo_SetCaption = nullptr;
|
||||
ptr_VidExt_ToggleFullScreen CoreVideo_ToggleFullScreen = nullptr;
|
||||
ptr_VidExt_ResizeWindow CoreVideo_ResizeWindow = nullptr;
|
||||
ptr_VidExt_GL_GetProcAddress CoreVideo_GL_GetProcAddress = nullptr;
|
||||
ptr_VidExt_GL_SetAttribute CoreVideo_GL_SetAttribute = nullptr;
|
||||
ptr_VidExt_GL_GetAttribute CoreVideo_GL_GetAttribute = nullptr;
|
||||
ptr_VidExt_GL_SwapBuffers CoreVideo_GL_SwapBuffers = nullptr;
|
||||
|
||||
void(*renderCallback)(int) = NULL;
|
||||
void(*renderCallback)(int) = nullptr;
|
||||
|
||||
m64p_error PluginAPI::PluginStartup(m64p_dynlib_handle _CoreLibHandle)
|
||||
{
|
||||
|
@ -82,7 +82,7 @@ m64p_error PluginAPI::PluginShutdown()
|
|||
#ifdef RSPTHREAD
|
||||
_callAPICommand(acRomClosed);
|
||||
delete m_pRspThread;
|
||||
m_pRspThread = NULL;
|
||||
m_pRspThread = nullptr;
|
||||
#else
|
||||
video().stop();
|
||||
#endif
|
||||
|
@ -98,19 +98,19 @@ m64p_error PluginAPI::PluginGetVersion(
|
|||
)
|
||||
{
|
||||
/* set version info */
|
||||
if (_PluginType != NULL)
|
||||
if (_PluginType != nullptr)
|
||||
*_PluginType = M64PLUGIN_GFX;
|
||||
|
||||
if (_PluginVersion != NULL)
|
||||
if (_PluginVersion != nullptr)
|
||||
*_PluginVersion = PLUGIN_VERSION;
|
||||
|
||||
if (_APIVersion != NULL)
|
||||
if (_APIVersion != nullptr)
|
||||
*_APIVersion = VIDEO_PLUGIN_API_VERSION;
|
||||
|
||||
if (_PluginNamePtr != NULL)
|
||||
if (_PluginNamePtr != nullptr)
|
||||
*_PluginNamePtr = pluginName;
|
||||
|
||||
if (_Capabilities != NULL)
|
||||
if (_Capabilities != nullptr)
|
||||
{
|
||||
*_Capabilities = 0;
|
||||
}
|
||||
|
|
|
@ -128,7 +128,7 @@ void OGLVideoMupenPlus::_stop()
|
|||
void OGLVideoMupenPlus::_swapBuffers()
|
||||
{
|
||||
// if emulator defined a render callback function, call it before buffer swap
|
||||
if (renderCallback != NULL) {
|
||||
if (renderCallback != nullptr) {
|
||||
glUseProgram(0);
|
||||
if (config.frameBufferEmulation.N64DepthCompare == 0) {
|
||||
glViewport(0, getHeightOffset(), getScreenWidth(), getScreenHeight());
|
||||
|
|
Loading…
Reference in New Issue
Block a user