Merge branch 'master' into dev

This commit is contained in:
KiritoDv 2021-07-21 18:16:34 -05:00
commit c8bca0b452
8 changed files with 23 additions and 25 deletions

View File

@ -25,6 +25,9 @@ MVideoCategory::MVideoCategory() : MoonCategory("TEXT_OPT_VIDEO"){
texY = 57;
hudY = 74;
#endif
this->catOptions.push_back(new MWValue(22, texY, "TEXT_OPT_TEXFILTER", {.index = (int*)&configFiltering, .values = &filters, .valueKeys = true}, true));
this->catOptions.push_back(new MWValue(22, texY, "Enable antialias", {.bvar = &configWindow.enable_antialias}, false));
this->catOptions.push_back(new MWValue(22, texY, "Antialias level", {.ivar = (int*)&configWindow.antialias_level, .max = 16, .min = 2, .step = 2, .rawValue = true}, false));
this->catOptions.push_back(new MWValue(22, texY, "TEXT_OPT_TEXFILTER", {.index = (int*)&configFiltering, .values = &filters, .valueKeys = true}, true));
this->catOptions.push_back(new MWValue(22, hudY, "TEXT_OPT_HUD", {.bvar = &configHUD}, true));
#ifndef TARGET_SWITCH

View File

@ -109,7 +109,7 @@ void MWValue::Draw(){
float value = isFloat ? *this->bind.fvar : *this->bind.ivar;
float max = this->bind.max;
wstring text = to_wstring((int)(100 * (value / max))) + L"%";
wstring text = !this->bind.rawValue ? to_wstring((int)(100 * (value / max))) + L"%" : to_wstring((int)value);
tmpWidth += MoonGetTextWidth(text, scale, false);
MoonDrawWideText(this->x + ( 10 + barWidth / 2 ) - tmpWidth / 2 + titleWidth, this->y, text, scale, {58, 249, 252, 255}, true, true);

View File

@ -18,6 +18,7 @@ struct MWValueBind{
int *index;
std::vector<std::wstring>* values;
bool valueKeys;
bool rawValue;
uint32_t* bindKeys;
std::string keyIcon;

View File

@ -48,6 +48,8 @@ ConfigWindow configWindow = {
.fullscreen = false,
.exiting_fullscreen = false,
.settings_changed = false,
.enable_antialias = true,
.antialias_level = 4
};
unsigned int configLanguage = 0;
@ -114,6 +116,8 @@ static const struct ConfigOption options[] = {
{.name = "window_y", .type = CONFIG_TYPE_UINT, .uintValue = &configWindow.y},
{.name = "window_w", .type = CONFIG_TYPE_UINT, .uintValue = &configWindow.w},
{.name = "window_h", .type = CONFIG_TYPE_UINT, .uintValue = &configWindow.h},
{.name = "aa_level", .type = CONFIG_TYPE_UINT, .uintValue = &configWindow.antialias_level},
{.name = "aa_enabled", .type = CONFIG_TYPE_BOOL, .uintValue = &configWindow.enable_antialias},
{.name = "vsync", .type = CONFIG_TYPE_BOOL, .boolValue = &configWindow.vsync},
{.name = "texture_filtering", .type = CONFIG_TYPE_UINT, .uintValue = &configFiltering},
{.name = "master_volume", .type = CONFIG_TYPE_UINT, .uintValue = &configMasterVolume},

View File

@ -15,6 +15,8 @@ typedef struct {
bool fullscreen;
bool exiting_fullscreen;
bool settings_changed;
bool enable_antialias;
unsigned int antialias_level;
} ConfigWindow;
extern ConfigWindow configWindow;

View File

@ -371,7 +371,7 @@ static struct ShaderProgram *gfx_opengl_create_and_load_new_shader(uint32_t shad
}
}
if (opt_alpha && opt_noise)
if (opt_alpha && opt_noise)
append_line(fs_buf, &fs_len, "texel.a *= floor(random(floor(vec3(gl_FragCoord.xy, frame_count))) + 0.5);");
if (opt_alpha) {
@ -628,12 +628,12 @@ static void gfx_opengl_init(void) {
sys_fatal("OpenGL 2.1+ is required.\nReported version: %s%d.%d", is_es ? "ES" : "", vmajor, vminor);
glGenBuffers(1, &opengl_vbo);
glBindBuffer(GL_ARRAY_BUFFER, opengl_vbo);
glDepthFunc(GL_LEQUAL);
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
moon_bind_hook(GFX_INIT);
moon_init_hook(0);
moon_call_hook(0);
@ -660,10 +660,14 @@ static void gfx_opengl_start_frame(void) {
glClearColor(0.0f, 0.0f, 0.0f, 1.0f);
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
glEnable(GL_SCISSOR_TEST);
if(configWindow.enable_antialias)
glEnable(GL_MULTISAMPLE);
else
glDisable(GL_MULTISAMPLE);
moon_bind_hook(GFX_POST_START_FRAME);
moon_init_hook(0);
moon_call_hook(0);
}
static void gfx_opengl_end_frame(void) {

View File

@ -219,8 +219,9 @@ static void gfx_sdl_init(const char *window_title) {
SDL_GL_SetAttribute(SDL_GL_CONTEXT_PROFILE_MASK, SDL_GL_CONTEXT_PROFILE_ES);
#endif
//SDL_GL_SetAttribute(SDL_GL_MULTISAMPLEBUFFERS, 1);
//SDL_GL_SetAttribute(SDL_GL_MULTISAMPLESAMPLES, 4);
SDL_GL_SetAttribute(SDL_GL_MULTISAMPLEBUFFERS, 1);
SDL_GL_SetAttribute(SDL_GL_MULTISAMPLESAMPLES, configWindow.antialias_level);
SDL_GL_SetAttribute(SDL_GL_ACCELERATED_VISUAL, 1);
#ifdef TARGET_SWITCH
configWindow.fullscreen = false;

View File

@ -207,30 +207,13 @@ void main_func(char *argv[]) {
else if (gCLIOpts.FullScreen == 2)
configWindow.fullscreen = false;
#if defined(WAPI_SDL1) || defined(WAPI_SDL2)
wm_api = &gfx_sdl;
#elif defined(WAPI_DXGI)
wm_api = &gfx_dxgi;
#else
#error No window API!
#endif
#if defined(RAPI_D3D11)
rendering_api = &gfx_direct3d11_api;
# define RAPI_NAME "DirectX 11"
#elif defined(RAPI_D3D12)
rendering_api = &gfx_direct3d12_api;
# define RAPI_NAME "DirectX 12"
#elif defined(RAPI_GL) || defined(RAPI_GL_LEGACY)
rendering_api = &gfx_opengl_api;
# ifdef USE_GLES
# define RAPI_NAME "OpenGL ES"
# else
# define RAPI_NAME "OpenGL"
# endif
#else
#error No rendering API!
#endif
char window_title[96] =
"Super Mario 64 - Moon64 (" RAPI_NAME ")";