#!/usr/bin/env python
import Command
import recalboxFiles
from generators.Generator import Generator
import dolphinControllers
import shutil
import os.path
import ConfigParser
from settings.unixSettings import UnixSettings

class DolphinGenerator(Generator):
    def generate(self, system, rom, playersControllers):
        dolphinControllers.generateControllerConfig(system, playersControllers)

        dolphinSettings = UnixSettings(recalboxFiles.dolphinIni, separator=' ')
        #Draw or not FPS
	if system.config['showFPS'] == 'true':
            dolphinSettings.save("ShowLag", "True")
            dolphinSettings.save("ShowFrameCount", "True")
        else:
            dolphinSettings.save("ShowLag", "False")
            dolphinSettings.save("ShowFrameCount", "False")

        # don't ask about statistics
        dolphinSettings.save("PermissionAsked", "True")

        commandArray = [recalboxFiles.recalboxBins[system.config['emulator']], "-e", rom, "--confirm=False"]
        if 'args' in system.config and system.config['args'] is not None:
             commandArray.extend(system.config['args'])
        return Command.Command(videomode=system.config['videomode'], array=commandArray, env={"XDG_CONFIG_HOME":recalboxFiles.CONF, "XDG_DATA_HOME":recalboxFiles.SAVES})

@@ -864,24 +864,110 @@
 %22, %22True%22)%0A%0A
+        # don't confirm at stop%0A        dolphinSettings.save(%22ConfirmStop%22, %22False%22)%0A%0A
         comm
@@ -1046,27 +1046,8 @@
  rom
-, %22--confirm=False%22
 %5D%0A  

save the confirm on stop directly