mirror of
https://github.com/dscalzi/HeliosLauncher.git
synced 2024-12-22 11:42:14 -08:00
v1.4.0 - Added Shader Options, Electron v4.
This commit is contained in:
parent
b98a4ec21f
commit
be533af38b
@ -10,6 +10,8 @@ const DISABLED_EXT = '.disabled'
|
|||||||
|
|
||||||
const SHADER_REGEX = /^(.+)\.zip$/
|
const SHADER_REGEX = /^(.+)\.zip$/
|
||||||
const SHADER_OPTION = /shaderPack=(.+)/
|
const SHADER_OPTION = /shaderPack=(.+)/
|
||||||
|
const SHADER_DIR = 'shaderpacks'
|
||||||
|
const SHADER_CONFIG = 'optionsshaders.txt'
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Validate that the given directory exists. If not, it is
|
* Validate that the given directory exists. If not, it is
|
||||||
@ -145,10 +147,10 @@ exports.isDropinModEnabled = function(fullName){
|
|||||||
* An array of objects storing metadata about each discovered shaderpack.
|
* An array of objects storing metadata about each discovered shaderpack.
|
||||||
*/
|
*/
|
||||||
exports.scanForShaderpacks = function(instanceDir){
|
exports.scanForShaderpacks = function(instanceDir){
|
||||||
const shaderDir = path.join(instanceDir, 'shaderpacks')
|
const shaderDir = path.join(instanceDir, SHADER_DIR)
|
||||||
const packsDiscovered = [{
|
const packsDiscovered = [{
|
||||||
fullName: 'OFF',
|
fullName: 'OFF',
|
||||||
name: 'No Shaderpack'
|
name: 'Off (Default)'
|
||||||
}]
|
}]
|
||||||
if(fs.existsSync(shaderDir)){
|
if(fs.existsSync(shaderDir)){
|
||||||
let modCandidates = fs.readdirSync(shaderDir)
|
let modCandidates = fs.readdirSync(shaderDir)
|
||||||
@ -176,7 +178,7 @@ exports.scanForShaderpacks = function(instanceDir){
|
|||||||
exports.getEnabledShaderpack = function(instanceDir){
|
exports.getEnabledShaderpack = function(instanceDir){
|
||||||
exports.validateDir(instanceDir)
|
exports.validateDir(instanceDir)
|
||||||
|
|
||||||
const optionsShaders = path.join(instanceDir, 'optionsshaders.txt')
|
const optionsShaders = path.join(instanceDir, SHADER_CONFIG)
|
||||||
if(fs.existsSync(optionsShaders)){
|
if(fs.existsSync(optionsShaders)){
|
||||||
const buf = fs.readFileSync(optionsShaders, {encoding: 'utf-8'})
|
const buf = fs.readFileSync(optionsShaders, {encoding: 'utf-8'})
|
||||||
const match = SHADER_OPTION.exec(buf)
|
const match = SHADER_OPTION.exec(buf)
|
||||||
@ -198,7 +200,7 @@ exports.getEnabledShaderpack = function(instanceDir){
|
|||||||
exports.setEnabledShaderpack = function(instanceDir, pack){
|
exports.setEnabledShaderpack = function(instanceDir, pack){
|
||||||
exports.validateDir(instanceDir)
|
exports.validateDir(instanceDir)
|
||||||
|
|
||||||
const optionsShaders = path.join(instanceDir, 'optionsshaders.txt')
|
const optionsShaders = path.join(instanceDir, SHADER_CONFIG)
|
||||||
let buf
|
let buf
|
||||||
if(fs.existsSync(optionsShaders)){
|
if(fs.existsSync(optionsShaders)){
|
||||||
buf = fs.readFileSync(optionsShaders, {encoding: 'utf-8'})
|
buf = fs.readFileSync(optionsShaders, {encoding: 'utf-8'})
|
||||||
@ -217,7 +219,7 @@ exports.setEnabledShaderpack = function(instanceDir, pack){
|
|||||||
*/
|
*/
|
||||||
exports.addShaderpacks = function(files, instanceDir) {
|
exports.addShaderpacks = function(files, instanceDir) {
|
||||||
|
|
||||||
const p = path.join(instanceDir, 'shaderpacks')
|
const p = path.join(instanceDir, SHADER_DIR)
|
||||||
|
|
||||||
exports.validateDir(p)
|
exports.validateDir(p)
|
||||||
|
|
||||||
|
@ -817,6 +817,7 @@ function bindShaderpackButton() {
|
|||||||
e.preventDefault()
|
e.preventDefault()
|
||||||
|
|
||||||
DropinModUtil.addShaderpacks(e.dataTransfer.files, CACHE_SETTINGS_INSTANCE_DIR)
|
DropinModUtil.addShaderpacks(e.dataTransfer.files, CACHE_SETTINGS_INSTANCE_DIR)
|
||||||
|
saveShaderpackSettings()
|
||||||
resolveShaderpacksForUI()
|
resolveShaderpacksForUI()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user