]Glide64] use enum for Screen Rotate
This commit is contained in:
parent
8f6107e0bf
commit
e572f531d5
|
@ -28,9 +28,9 @@ LOCAL_SRC_FILES := \
|
||||||
$(SRCDIR)/Glide64/Debugger.cpp \
|
$(SRCDIR)/Glide64/Debugger.cpp \
|
||||||
$(SRCDIR)/Glide64/DepthBufferRender.cpp \
|
$(SRCDIR)/Glide64/DepthBufferRender.cpp \
|
||||||
$(SRCDIR)/Glide64/FBtoScreen.cpp \
|
$(SRCDIR)/Glide64/FBtoScreen.cpp \
|
||||||
$(SRCDIR)/Glide64/Keys.cpp \
|
|
||||||
$(SRCDIR)/Glide64/Main.cpp \
|
$(SRCDIR)/Glide64/Main.cpp \
|
||||||
$(SRCDIR)/Glide64/rdp.cpp \
|
$(SRCDIR)/Glide64/rdp.cpp \
|
||||||
|
$(SRCDIR)/Glide64/ScreenResolution.cpp \
|
||||||
$(SRCDIR)/Glide64/Settings.cpp \
|
$(SRCDIR)/Glide64/Settings.cpp \
|
||||||
$(SRCDIR)/Glide64/TexBuffer.cpp \
|
$(SRCDIR)/Glide64/TexBuffer.cpp \
|
||||||
$(SRCDIR)/Glide64/TexCache.cpp \
|
$(SRCDIR)/Glide64/TexCache.cpp \
|
||||||
|
|
|
@ -217,6 +217,7 @@ int GetCurrentResIndex(void)
|
||||||
return g_FullScreenResolutions.getCurrentResolutions();
|
return g_FullScreenResolutions.getCurrentResolutions();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifndef ANDROID
|
||||||
char ** grQueryResolutionsExt(int32_t * Size)
|
char ** grQueryResolutionsExt(int32_t * Size)
|
||||||
{
|
{
|
||||||
WriteTrace(TraceGlitch, TraceDebug, "-");
|
WriteTrace(TraceGlitch, TraceDebug, "-");
|
||||||
|
@ -229,3 +230,4 @@ uint32_t grWrapperFullScreenResolutionExt(uint32_t * width, uint32_t * height)
|
||||||
g_FullScreenResolutions.getResolution(g_settings->wrpResolution, width, height);
|
g_FullScreenResolutions.getResolution(g_settings->wrpResolution, width, height);
|
||||||
return g_settings->wrpResolution;
|
return g_settings->wrpResolution;
|
||||||
}
|
}
|
||||||
|
#endif
|
|
@ -6,6 +6,7 @@ int GetCurrentResIndex(void);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
short Set_basic_mode = 0, Set_texture_dir = 0, Set_log_dir = 0, Set_log_flush = 0;
|
short Set_basic_mode = 0, Set_texture_dir = 0, Set_log_dir = 0, Set_log_flush = 0;
|
||||||
|
extern int g_width, g_height;
|
||||||
|
|
||||||
CSettings::CSettings() :
|
CSettings::CSettings() :
|
||||||
m_dirty(false),
|
m_dirty(false),
|
||||||
|
@ -19,8 +20,7 @@ res_data(GR_RESOLUTION_640x480),
|
||||||
advanced_options(0),
|
advanced_options(0),
|
||||||
texenh_options(0),
|
texenh_options(0),
|
||||||
vsync(0),
|
vsync(0),
|
||||||
|
m_rotate(Rotate_None),
|
||||||
rotate(0),
|
|
||||||
|
|
||||||
filtering(0),
|
filtering(0),
|
||||||
fog(0),
|
fog(0),
|
||||||
|
@ -120,7 +120,7 @@ void CSettings::RegisterSettings(void)
|
||||||
#else
|
#else
|
||||||
general_setting(Set_wrpFBO, "wrpFBO", 1);
|
general_setting(Set_wrpFBO, "wrpFBO", 1);
|
||||||
#endif
|
#endif
|
||||||
general_setting(Set_Rotate, "rotate", 0);
|
general_setting(Set_Rotate, "rotate", Rotate_None);
|
||||||
general_setting(Set_wrpAnisotropic, "wrpAnisotropic", 0);
|
general_setting(Set_wrpAnisotropic, "wrpAnisotropic", 0);
|
||||||
general_setting(Set_autodetect_ucode, "autodetect_ucode", 1);
|
general_setting(Set_autodetect_ucode, "autodetect_ucode", 1);
|
||||||
general_setting(Set_ucode, "ucode", 2);
|
general_setting(Set_ucode, "ucode", 2);
|
||||||
|
@ -270,7 +270,7 @@ void CSettings::ReadSettings()
|
||||||
this->wrpResolution = GetSetting(Set_FullScreenRes);
|
this->wrpResolution = GetSetting(Set_FullScreenRes);
|
||||||
#endif
|
#endif
|
||||||
this->vsync = GetSetting(Set_vsync);
|
this->vsync = GetSetting(Set_vsync);
|
||||||
this->rotate = GetSetting(Set_Rotate);
|
m_rotate = (ScreenRotate_t)GetSetting(Set_Rotate);
|
||||||
this->advanced_options = Set_basic_mode ? !GetSystemSetting(Set_basic_mode) : 0;
|
this->advanced_options = Set_basic_mode ? !GetSystemSetting(Set_basic_mode) : 0;
|
||||||
this->texenh_options = GetSetting(Set_texenh_options);
|
this->texenh_options = GetSetting(Set_texenh_options);
|
||||||
|
|
||||||
|
@ -555,8 +555,7 @@ void CSettings::WriteSettings(void)
|
||||||
SetSetting(Set_FullScreenRes, g_settings->wrpResolution);
|
SetSetting(Set_FullScreenRes, g_settings->wrpResolution);
|
||||||
#endif
|
#endif
|
||||||
SetSetting(Set_vsync, g_settings->vsync);
|
SetSetting(Set_vsync, g_settings->vsync);
|
||||||
SetSetting(Set_Rotate, g_settings->rotate);
|
SetSetting(Set_Rotate, m_rotate);
|
||||||
//SetSetting(Set_advanced_options,g_settings->advanced_options);
|
|
||||||
SetSetting(Set_texenh_options, g_settings->texenh_options);
|
SetSetting(Set_texenh_options, g_settings->texenh_options);
|
||||||
|
|
||||||
SetSetting(Set_wrpVRAM, g_settings->wrpVRAM);
|
SetSetting(Set_wrpVRAM, g_settings->wrpVRAM);
|
||||||
|
|
|
@ -68,6 +68,14 @@ public:
|
||||||
Aspect_Original = 3,
|
Aspect_Original = 3,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
enum ScreenRotate_t
|
||||||
|
{
|
||||||
|
Rotate_None = 0,
|
||||||
|
Rotate_90 = 1,
|
||||||
|
Rotate_180 = 2,
|
||||||
|
Rotate_270 = 3,
|
||||||
|
};
|
||||||
|
|
||||||
uint32_t res_x, scr_res_x;
|
uint32_t res_x, scr_res_x;
|
||||||
uint32_t res_y, scr_res_y;
|
uint32_t res_y, scr_res_y;
|
||||||
#ifndef ANDROID
|
#ifndef ANDROID
|
||||||
|
@ -78,7 +86,6 @@ public:
|
||||||
int texenh_options;
|
int texenh_options;
|
||||||
int vsync;
|
int vsync;
|
||||||
|
|
||||||
int rotate;
|
|
||||||
|
|
||||||
int filtering;
|
int filtering;
|
||||||
int fog;
|
int fog;
|
||||||
|
@ -112,6 +119,7 @@ public:
|
||||||
|
|
||||||
inline const char * log_dir(void) const { return m_log_dir; }
|
inline const char * log_dir(void) const { return m_log_dir; }
|
||||||
inline bool FlushLogs(void) const { return m_FlushLogs; }
|
inline bool FlushLogs(void) const { return m_FlushLogs; }
|
||||||
|
inline ScreenRotate_t rotate(void) const { return m_rotate; }
|
||||||
|
|
||||||
inline AspectMode_t aspectmode(void) const { return m_aspectmode; }
|
inline AspectMode_t aspectmode(void) const { return m_aspectmode; }
|
||||||
//Texture filtering options
|
//Texture filtering options
|
||||||
|
@ -193,6 +201,7 @@ private:
|
||||||
char m_log_dir[260];
|
char m_log_dir[260];
|
||||||
AspectMode_t m_aspectmode;
|
AspectMode_t m_aspectmode;
|
||||||
uint32_t m_frame_buffer;
|
uint32_t m_frame_buffer;
|
||||||
|
ScreenRotate_t m_rotate;
|
||||||
hacks_t m_hacks;
|
hacks_t m_hacks;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -241,7 +241,7 @@ void check_link(GLuint program)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void set_rotation_matrix(GLuint loc, int rotate)
|
void set_rotation_matrix(GLuint loc, CSettings::ScreenRotate_t rotate)
|
||||||
{
|
{
|
||||||
GLfloat mat[16];
|
GLfloat mat[16];
|
||||||
|
|
||||||
|
@ -252,13 +252,13 @@ void set_rotation_matrix(GLuint loc, int rotate)
|
||||||
* (0, 0, 0, 1)
|
* (0, 0, 0, 1)
|
||||||
*/
|
*/
|
||||||
|
|
||||||
//mat[0] = cos(angle);
|
mat[0] = 1;
|
||||||
//mat[1] = sin(angle);
|
mat[1] = 0;
|
||||||
mat[2] = 0;
|
mat[2] = 0;
|
||||||
mat[3] = 0;
|
mat[3] = 0;
|
||||||
|
|
||||||
//mat[4] = -sin(angle);
|
mat[4] = 0;
|
||||||
//mat[5] = cos(angle);
|
mat[5] = 1;
|
||||||
mat[6] = 0;
|
mat[6] = 0;
|
||||||
mat[7] = 0;
|
mat[7] = 0;
|
||||||
|
|
||||||
|
@ -273,35 +273,27 @@ void set_rotation_matrix(GLuint loc, int rotate)
|
||||||
mat[15] = 1;
|
mat[15] = 1;
|
||||||
|
|
||||||
/* now set the actual rotation */
|
/* now set the actual rotation */
|
||||||
if (1 == rotate) // 90 degree
|
if (rotate == CSettings::Rotate_90)
|
||||||
{
|
{
|
||||||
mat[0] = 0;
|
mat[0] = 0;
|
||||||
mat[1] = 1;
|
mat[1] = 1;
|
||||||
mat[4] = -1;
|
mat[4] = -1;
|
||||||
mat[5] = 0;
|
mat[5] = 0;
|
||||||
}
|
}
|
||||||
else if (2 == rotate) // 180 degree
|
else if (rotate == CSettings::Rotate_180)
|
||||||
{
|
{
|
||||||
mat[0] = -1;
|
mat[0] = -1;
|
||||||
mat[1] = 0;
|
mat[1] = 0;
|
||||||
mat[4] = 0;
|
mat[4] = 0;
|
||||||
mat[5] = -1;
|
mat[5] = -1;
|
||||||
}
|
}
|
||||||
else if (3 == rotate) // 270 degree
|
else if (rotate == CSettings::Rotate_270)
|
||||||
{
|
{
|
||||||
mat[0] = 0;
|
mat[0] = 0;
|
||||||
mat[1] = -1;
|
mat[1] = -1;
|
||||||
mat[4] = 1;
|
mat[4] = 1;
|
||||||
mat[5] = 0;
|
mat[5] = 0;
|
||||||
}
|
}
|
||||||
else /* 0 degree, also fallback if input is wrong) */
|
|
||||||
{
|
|
||||||
mat[0] = 1;
|
|
||||||
mat[1] = 0;
|
|
||||||
mat[4] = 0;
|
|
||||||
mat[5] = 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
glUniformMatrix4fv(loc, 1, GL_FALSE, mat);
|
glUniformMatrix4fv(loc, 1, GL_FALSE, mat);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -349,7 +341,7 @@ void init_combiner()
|
||||||
check_link(g_program_object_default);
|
check_link(g_program_object_default);
|
||||||
glUseProgram(g_program_object_default);
|
glUseProgram(g_program_object_default);
|
||||||
int rotation_matrix_location = glGetUniformLocation(g_program_object_default, "rotation_matrix");
|
int rotation_matrix_location = glGetUniformLocation(g_program_object_default, "rotation_matrix");
|
||||||
set_rotation_matrix(rotation_matrix_location, g_settings->rotate);
|
set_rotation_matrix(rotation_matrix_location, g_settings->rotate());
|
||||||
|
|
||||||
texture0_location = glGetUniformLocation(g_program_object_default, "texture0");
|
texture0_location = glGetUniformLocation(g_program_object_default, "texture0");
|
||||||
texture1_location = glGetUniformLocation(g_program_object_default, "texture1");
|
texture1_location = glGetUniformLocation(g_program_object_default, "texture1");
|
||||||
|
@ -484,7 +476,7 @@ void update_uniforms(GLuint program_object, const shader_program_key & prog)
|
||||||
}
|
}
|
||||||
|
|
||||||
GLuint rotation_matrix_location = glGetUniformLocation(program_object, "rotation_matrix");
|
GLuint rotation_matrix_location = glGetUniformLocation(program_object, "rotation_matrix");
|
||||||
set_rotation_matrix(rotation_matrix_location, g_settings->rotate);
|
set_rotation_matrix(rotation_matrix_location, g_settings->rotate());
|
||||||
set_lambda();
|
set_lambda();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue