m64p_error ConfigShutdown(void) { /* first, save the file if necessary */ if (l_SaveConfigOnExit) ConfigSaveFile(); /* reset the initialized flag */ if (!l_ConfigInit) return M64ERR_NOT_INIT; l_ConfigInit = 0; /* free any malloc'd local variables */ if (l_DataDirOverride != NULL) { free(l_DataDirOverride); l_DataDirOverride = NULL; } if (l_ConfigDirOverride != NULL) { free(l_ConfigDirOverride); l_ConfigDirOverride = NULL; } /* free all of the memory in the 2 lists */ delete_list(&l_ConfigListActive); delete_list(&l_ConfigListSaved); return M64ERR_SUCCESS; }
void Config_LoadConfig() { const u32 hacks = config.generalEmulation.hacks; if (!Config_SetDefault()) { config.generalEmulation.hacks = hacks; return; } config.version = ConfigGetParamInt(g_configVideoGliden64, "configVersion"); if (config.version != CONFIG_VERSION_CURRENT) { m64p_error res = ConfigDeleteSection("Video-GLideN64"); assert(res == M64ERR_SUCCESS); ConfigSaveFile(); if (!Config_SetDefault()) { config.generalEmulation.hacks = hacks; return; } } config.video.fullscreen = ConfigGetParamBool(g_configVideoGeneral, "Fullscreen"); config.video.windowedWidth = ConfigGetParamInt(g_configVideoGeneral, "ScreenWidth"); config.video.windowedHeight = ConfigGetParamInt(g_configVideoGeneral, "ScreenHeight"); config.video.verticalSync = ConfigGetParamBool(g_configVideoGeneral, "VerticalSync"); #ifdef GL_MULTISAMPLING_SUPPORT config.video.multisampling = ConfigGetParamInt(g_configVideoGliden64, "MultiSampling"); #else config.video.multisampling = 0; #endif config.frameBufferEmulation.aspect = ConfigGetParamInt(g_configVideoGliden64, "AspectRatio"); config.frameBufferEmulation.bufferSwapMode = ConfigGetParamInt(g_configVideoGliden64, "BufferSwapMode"); config.frameBufferEmulation.nativeResFactor = ConfigGetParamInt(g_configVideoGliden64, "UseNativeResolutionFactor"); //#Texture Settings config.texture.bilinearMode = ConfigGetParamBool(g_configVideoGliden64, "bilinearMode"); config.texture.maxAnisotropy = ConfigGetParamInt(g_configVideoGliden64, "MaxAnisotropy"); config.texture.maxBytes = ConfigGetParamInt(g_configVideoGliden64, "CacheSize") * uMegabyte; //#Emulation Settings config.generalEmulation.enableNoise = ConfigGetParamBool(g_configVideoGliden64, "EnableNoise"); config.generalEmulation.enableLOD = ConfigGetParamBool(g_configVideoGliden64, "EnableLOD"); config.generalEmulation.enableHWLighting = ConfigGetParamBool(g_configVideoGliden64, "EnableHWLighting"); config.generalEmulation.enableShadersStorage = ConfigGetParamBool(g_configVideoGliden64, "EnableShadersStorage"); config.generalEmulation.correctTexrectCoords = ConfigGetParamInt(g_configVideoGliden64, "CorrectTexrectCoords"); config.generalEmulation.enableNativeResTexrects = ConfigGetParamBool(g_configVideoGliden64, "enableNativeResTexrects"); #ifdef ANDROID config.generalEmulation.forcePolygonOffset = ConfigGetParamBool(g_configVideoGliden64, "ForcePolygonOffset"); config.generalEmulation.polygonOffsetFactor = ConfigGetParamFloat(g_configVideoGliden64, "PolygonOffsetFactor"); config.generalEmulation.polygonOffsetUnits = ConfigGetParamFloat(g_configVideoGliden64, "PolygonOffsetUnits"); #endif //#Frame Buffer Settings:" config.frameBufferEmulation.enable = ConfigGetParamBool(g_configVideoGliden64, "EnableFBEmulation"); config.frameBufferEmulation.copyAuxToRDRAM = ConfigGetParamBool(g_configVideoGliden64, "EnableCopyAuxiliaryToRDRAM"); config.frameBufferEmulation.copyToRDRAM = ConfigGetParamInt(g_configVideoGliden64, "EnableCopyColorToRDRAM"); config.frameBufferEmulation.copyDepthToRDRAM = ConfigGetParamInt(g_configVideoGliden64, "EnableCopyDepthToRDRAM"); config.frameBufferEmulation.copyFromRDRAM = ConfigGetParamBool(g_configVideoGliden64, "EnableCopyColorFromRDRAM"); config.frameBufferEmulation.N64DepthCompare = ConfigGetParamBool(g_configVideoGliden64, "EnableN64DepthCompare"); config.frameBufferEmulation.fbInfoDisabled = ConfigGetParamBool(g_configVideoGliden64, "DisableFBInfo"); config.frameBufferEmulation.fbInfoReadColorChunk = ConfigGetParamBool(g_configVideoGliden64, "FBInfoReadColorChunk"); config.frameBufferEmulation.fbInfoReadDepthChunk = ConfigGetParamBool(g_configVideoGliden64, "FBInfoReadDepthChunk"); //#Texture filter settings config.textureFilter.txFilterMode = ConfigGetParamInt(g_configVideoGliden64, "txFilterMode"); config.textureFilter.txEnhancementMode = ConfigGetParamInt(g_configVideoGliden64, "txEnhancementMode"); config.textureFilter.txDeposterize = ConfigGetParamInt(g_configVideoGliden64, "txDeposterize"); config.textureFilter.txFilterIgnoreBG = ConfigGetParamBool(g_configVideoGliden64, "txFilterIgnoreBG"); config.textureFilter.txCacheSize = ConfigGetParamInt(g_configVideoGliden64, "txCacheSize") * uMegabyte; config.textureFilter.txHiresEnable = ConfigGetParamBool(g_configVideoGliden64, "txHiresEnable"); config.textureFilter.txHiresFullAlphaChannel = ConfigGetParamBool(g_configVideoGliden64, "txHiresFullAlphaChannel"); config.textureFilter.txHresAltCRC = ConfigGetParamBool(g_configVideoGliden64, "txHresAltCRC"); config.textureFilter.txDump = ConfigGetParamBool(g_configVideoGliden64, "txDump"); config.textureFilter.txForce16bpp = ConfigGetParamBool(g_configVideoGliden64, "txForce16bpp"); config.textureFilter.txCacheCompression = ConfigGetParamBool(g_configVideoGliden64, "txCacheCompression"); config.textureFilter.txSaveCache = ConfigGetParamBool(g_configVideoGliden64, "txSaveCache"); ::mbstowcs(config.textureFilter.txPath, ConfigGetParamString(g_configVideoGliden64, "txPath"), PLUGIN_PATH_SIZE); //#Font settings config.font.name = ConfigGetParamString(g_configVideoGliden64, "fontName"); if (config.font.name.empty()) config.font.name = "arial.ttf"; char buf[16]; sprintf(buf, "0x%s", ConfigGetParamString(g_configVideoGliden64, "fontColor")); 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); config.font.color[2] = _SHIFTR(uColor, 0, 8); config.font.color[3] = 0xFF; config.font.colorf[0] = _FIXED2FLOAT(config.font.color[0], 8); config.font.colorf[1] = _FIXED2FLOAT(config.font.color[1], 8); config.font.colorf[2] = _FIXED2FLOAT(config.font.color[2], 8); config.font.colorf[3] = 1.0f; } config.font.size = ConfigGetParamInt(g_configVideoGliden64, "fontSize"); if (config.font.size == 0) config.font.size = 30; //#Bloom filter settings config.bloomFilter.enable = ConfigGetParamBool(g_configVideoGliden64, "EnableBloom"); config.bloomFilter.thresholdLevel = ConfigGetParamInt(g_configVideoGliden64, "bloomThresholdLevel"); config.bloomFilter.blendMode = ConfigGetParamInt(g_configVideoGliden64, "bloomBlendMode"); config.bloomFilter.blurAmount = ConfigGetParamInt(g_configVideoGliden64, "blurAmount"); config.bloomFilter.blurStrength = ConfigGetParamInt(g_configVideoGliden64, "blurStrength"); //#Gamma correction settings config.gammaCorrection.force = ConfigGetParamBool(g_configVideoGliden64, "ForceGammaCorrection"); config.gammaCorrection.level = ConfigGetParamFloat(g_configVideoGliden64, "GammaCorrectionLevel"); config.generalEmulation.hacks = hacks; }