Skip to content

Commit

Permalink
Properly checking if texture is installed before drawing.
Browse files Browse the repository at this point in the history
  • Loading branch information
Rinnegatamante committed Aug 12, 2020
1 parent 7feadb0 commit d43208f
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 11 deletions.
14 changes: 7 additions & 7 deletions Source/HLEGraphics/uCodes/Ucode_S2DEX.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,13 +23,13 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
//*****************************************************************************
// Needed by S2DEX
//*****************************************************************************
#define S2DEX_OBJLT_TXTRBLOCK 0x00001033
#define S2DEX_OBJLT_TXTRTILE 0x00fc1034
#define S2DEX_OBJLT_TLUT 0x00000030
#define S2DEX_BGLT_LOADBLOCK 0x0033
#define S2DEX_BGLT_LOADTILE 0xfff4
#define S2DEX_BG_FLAG_FLIPS 0x01
#define S2DEX_BG_FLAG_FLIPT 0x10
#define S2DEX_OBJLT_TXTRBLOCK 0x00001033
#define S2DEX_OBJLT_TXTRTILE 0x00fc1034
#define S2DEX_OBJLT_TLUT 0x00000030
#define S2DEX_BGLT_LOADBLOCK 0x0033
#define S2DEX_BGLT_LOADTILE 0xfff4
#define S2DEX_BG_FLAG_FLIPS 0x01
#define S2DEX_BG_FLAG_FLIPT 0x10

//*****************************************************************************
//
Expand Down
8 changes: 6 additions & 2 deletions Source/SysVita/HLEGraphics/RendererLegacy.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -853,6 +853,9 @@ void RendererLegacy::DrawUITexture()
void RendererLegacy::Draw2DTexture(f32 x0, f32 y0, f32 x1, f32 y1,
f32 u0, f32 v0, f32 u1, f32 v1)
{
const CNativeTexture *texture = mBoundTexture[0];
if (!texture) return;

//if ((gRDPOtherMode.L & 0xFFFFFF00) == 0x0C184200) CDebugConsole::Get()->Msg(1, "Draw2DTexture: L: 0x%08X", gRDPOtherMode.L);
glMatrixMode(GL_PROJECTION);
glLoadMatrixf((float*)mScreenToDevice.mRaw);
Expand All @@ -874,7 +877,6 @@ void RendererLegacy::Draw2DTexture(f32 x0, f32 y0, f32 x1, f32 y1,
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP);

const CNativeTexture *texture = mBoundTexture[0];
float scale_x = texture->GetScaleX();
float scale_y = texture->GetScaleY();

Expand Down Expand Up @@ -920,6 +922,9 @@ void RendererLegacy::Draw2DTexture(f32 x0, f32 y0, f32 x1, f32 y1,
void RendererLegacy::Draw2DTextureR(f32 x0, f32 y0, f32 x1, f32 y1, f32 x2,
f32 y2, f32 x3, f32 y3, f32 s, f32 t)
{
const CNativeTexture *texture = mBoundTexture[0];
if (!texture) return;

//if ((gRDPOtherMode.L & 0xFFFFFF00) == 0x0C184200) CDebugConsole::Get()->Msg(1, "Draw2DTextureR: L: 0x%08X", gRDPOtherMode.L);
glMatrixMode(GL_PROJECTION);
glLoadMatrixf((float*)mScreenToDevice.mRaw);
Expand All @@ -941,7 +946,6 @@ void RendererLegacy::Draw2DTextureR(f32 x0, f32 y0, f32 x1, f32 y1, f32 x2,
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP);

const CNativeTexture * texture = mBoundTexture[0];
float scale_x = texture->GetScaleX();
float scale_y = texture->GetScaleY();

Expand Down
8 changes: 6 additions & 2 deletions Source/SysVita/HLEGraphics/RendererModern.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -992,6 +992,9 @@ void RendererModern::DrawUITexture()

void RendererModern::Draw2DTexture(f32 x0, f32 y0, f32 x1, f32 y1, f32 u0, f32 v0, f32 u1, f32 v1)
{
const CNativeTexture * texture = mBoundTexture[0];
if (!texture) return;

gRDPOtherMode.cycle_type = CYCLE_COPY;

PrepareRenderState(mScreenToDevice.mRaw, false);
Expand All @@ -1002,7 +1005,6 @@ void RendererModern::Draw2DTexture(f32 x0, f32 y0, f32 x1, f32 y1, f32 u0, f32 v
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP);

const CNativeTexture * texture = mBoundTexture[0];
float scale_x = texture->GetScaleX();
float scale_y = texture->GetScaleY();

Expand Down Expand Up @@ -1050,6 +1052,9 @@ void RendererModern::Draw2DTexture(f32 x0, f32 y0, f32 x1, f32 y1, f32 u0, f32 v

void RendererModern::Draw2DTextureR(f32 x0, f32 y0, f32 x1, f32 y1, f32 x2, f32 y2, f32 x3, f32 y3, f32 s, f32 t)
{
const CNativeTexture * texture = mBoundTexture[0];
if (!texture) return;

gRDPOtherMode.cycle_type = CYCLE_COPY;

PrepareRenderState(mScreenToDevice.mRaw, false);
Expand All @@ -1060,7 +1065,6 @@ void RendererModern::Draw2DTextureR(f32 x0, f32 y0, f32 x1, f32 y1, f32 x2, f32
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP);

const CNativeTexture * texture = mBoundTexture[0];
float scale_x = texture->GetScaleX();
float scale_y = texture->GetScaleY();

Expand Down

0 comments on commit d43208f

Please sign in to comment.