Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Add this under ### import always needed ### at the bottom
- import re
- import logging
- Paste code in after
- # run a script before emulator starts
- callExternalScripts("/usr/share/batocera/configgen/scripts", "gameStart", [systemName, system.config['emulator'], effectiveCore, effectiveRom])
- callExternalScripts("/userdata/system/scripts", "gameStart", [systemName, system.config['emulator'], effectiveCore, effectiveRom])
- # Set up logging
- logging.basicConfig(level=logging.DEBUG)
- logger = logging.getLogger(__name__)
- # switchres interlace
- def set_interlace(interlace_on=True):
- config_file = "/etc/switchres.ini"
- # Read the current content of the config file
- with open(config_file, 'r') as file:
- config_content = file.readlines()
- # Modify the interlace setting
- with open(config_file, 'w') as file:
- modified = False
- for line in config_content:
- # Replace the interlace setting based on interlace_on value
- if re.match(r'^\s*interlace\s+', line): # Allow any leading whitespace
- file.write(f" interlace {1 if interlace_on else 0}\n") # Keep 8 spaces
- modified = True
- logger.debug(f"Updated interlace to {1 if interlace_on else 0}")
- else:
- file.write(line)
- # Log if no interlace setting was found
- if not modified:
- logger.warning("No interlace setting found in /etc/switchres.ini to modify.")
- # Call the set_interlace function based on system options
- if system.isOptSet('interlace'):
- interlace_on = system.config["interlace"] == "" or system.config["interlace"] == "1"
- set_interlace(interlace_on)
- else:
- set_interlace(True)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement