@echo off :: ############################################################################### :: # :: # Copyright (C) 2009-2013 Nintendo. All rights reserved. :: # :: # These coded instructions, statements, and computer programs contain :: # proprietary information of Nintendo of America Inc. and/or Nintendo :: # Company Ltd., and are protected by Federal copyright law. They may :: # not be disclosed to third parties or copied or duplicated in any form, :: # in whole or in part, without the prior written consent of Nintendo.:::: :: # :: ############################################################################### REM REM THIS SCRIPT SETS DEFAULT OPTIONS FOR OPENING A CAFE WINDOW. IT'S THE REM SAME AS RUNNING "cafe.bat [-option ...] -default". REM :: ************************************************************ :: * CAFE - Environment :: ************************************************************ : From here, variable changes to do not affect environment SETLOCAL set _ME=%~nx0 REM *** REM Set options REM Don't take any current settings from the environment set _SETDEFAULTS= set USE_CAFEX= set SESSION_MANAGER= set DO_SYNC_SESSION= set USE_PCFS_OVER_SATA= set USE_CYGWIN= REM Commandline (per-invocation) options. Takes precedence. :getopt if "%~1" == "" goto :getopt_done for %%i in (-h -help --help) do if "%~1" == "%%i" goto :usage if "%~1" == "-?" goto :usage && REM "-?" doesn't work in "for" loop 8-( set _SETDEFAULTS=1 if /i "%~1" == "-cafex" set USE_CAFEX=1&& goto :getopt_next if /i "%~1" == "-nocafex" set USE_CAFEX=0&& goto :getopt_next if /i "%~1" == "-multi" set SESSION_MANAGER=1&& goto :getopt_next if /i "%~1" == "-nomulti" set SESSION_MANAGER=0&& goto :getopt_next if /i "%~1" == "-session" set SESSION_MANAGER=1&& goto :getopt_next if /i "%~1" == "-nosession" set SESSION_MANAGER=0&& goto :getopt_next if /i "%~1" == "-syncsession" set DO_SYNC_SESSION=1&& goto :getopt_next if /i "%~1" == "-nosyncsession" set DO_SYNC_SESSION=0&& goto :getopt_next if /i "%~1" == "-pcfsoversata" set USE_PCFS_OVER_SATA=1&& goto :getopt_next if /i "%~1" == "-nopcfsoversata" set USE_PCFS_OVER_SATA=0&& goto :getopt_next if /i "%~1" == "-cygwin" set USE_CYGWIN=1&& goto :getopt_next if /i "%~1" == "-nocygwin" set USE_CYGWIN=0&& goto :getopt_next if /i "%~1" == "-reset" set _RESET_CONFIG=1&& goto :getopt_next echo. && echo ERROR! Unrecognized option '%~1'! && goto :usage :getopt_next shift goto :getopt :getopt_done REM Read defaults from config file, for anything that's not set yet. set _CONFIG=%APPDATA%\Nintendo\cafe.defaults if NOT EXIST "%_CONFIG%" goto :update_config if NOT "%_RESET_CONFIG%" == "" goto :update_config for /f "tokens=1,2 delims==" %%i in (%_CONFIG%) do call :set_config_value %%i %%j if not exist "%APPDATA%\disable_pcfs_over_sata" goto :update_config REM old "pcfs_over_sata" sentinel exists; update to new config file set USE_PCFS_OVER_SATA=0 del /f "%APPDATA%\disable_pcfs_over_sata" 2>nul goto :update_config :set_config_value if "%USE_CAFEX%" == "" if /i "%1" == "USE_CAFEX" set USE_CAFEX=%2 if "%SESSION_MANAGER%" == "" if /i "%1" == "SESSION_MANAGER" set SESSION_MANAGER=%2 if "%SESSION_MANAGER%" == "" if /i "%1" == "USE_MULTI" set SESSION_MANAGER=%2 if "%DO_SYNC_SESSION%" == "" if /i "%1" == "DO_SYNC_SESSION" set DO_SYNC_SESSION=%2 if "%USE_PCFS_OVER_SATA%" == "" if /i "%1" == "USE_PCFS_OVER_SATA" set USE_PCFS_OVER_SATA=%2 if "%USE_CYGWIN%" == "" if /i "%1" == "USE_CYGWIN" set USE_CYGWIN=%2 goto :eof :update_config REM rewrite config file if requested; NOT "thread-safe"! set _CONFIG="%_CONFIG%" for %%i in (%_CONFIG%) do md %%~dpi 2>nul del /f %_CONFIG% 2>nul copy /y NUL %_CONFIG% 1>nul 2>nul if NOT EXIST %_CONFIG% echo WARNING! Could not save options as default! && goto :config_done for %%i in (%_CONFIG%) do if NOT "%%~zi" == "0" echo WARNING! Could not save options as default! && goto :config_done if NOT "%USE_CAFEX%" == "" >>%_CONFIG% echo USE_CAFEX=%USE_CAFEX% if NOT "%SESSION_MANAGER%" == "" >>%_CONFIG% echo SESSION_MANAGER=%SESSION_MANAGER% if NOT "%DO_SYNC_SESSION%" == "" >>%_CONFIG% echo DO_SYNC_SESSION=%DO_SYNC_SESSION% if NOT "%USE_PCFS_OVER_SATA%" == "" >>%_CONFIG% echo USE_PCFS_OVER_SATA=%USE_PCFS_OVER_SATA% if NOT "%USE_CYGWIN%" == "" >>%_CONFIG% echo USE_CYGWIN=%USE_CYGWIN% :config_done set _CONFIG= REM Display current settings echo Currently saved options: if "%USE_CAFEX%" == "0" echo -nocafex if "%USE_CAFEX%" == "1" echo -cafex if "%SESSION_MANAGER%" == "0" echo -nomulti if "%SESSION_MANAGER%" == "1" echo -multi if "%DO_SYNC_SESSION%" == "0" echo -nosyncsession if "%DO_SYNC_SESSION%" == "1" echo -syncsession if "%USE_PCFS_OVER_SATA%" == "0" echo -nopcfsoversata if "%USE_PCFS_OVER_SATA%" == "1" echo -pcfsoversata if "%USE_CYGWIN%" == "0" echo -nocygwin if "%USE_CYGWIN%" == "1" echo -cygwin REM Are we running in a Bash shell? if not "%SHLVL%" == "" if not "%_SETDEFAULTS%" == "" echo *** Options will take effect the next time you open a Cafe window! goto :end :usage echo. echo ================================================== echo NINTENDO CAFE ENVIRONMENT! echo ================================================== echo. echo Usage: %_ME% [options] echo. echo Options: echo -cafex Use CafeX to run applications (default) echo -nocafex Do not use CafeX; uses Cygwin shell scripts echo -multi Enable multisession CAFE support echo -nomulti Do not enable multisession support (default) echo -syncsession Copy per-session files (default) echo -nosyncsession Do not copy files; data files shared across sessions echo -pcfsoversata Enable PCFS over SATA (default) echo -nopcfsoversata Disable PCFS over SATA; use PCFS over SDIO echo -cygwin Use Cygwin (default) echo -nocygwin Do not use Cygwin; for running apps only echo. echo -reset Remove all currently set options echo (other than ones specified on this commandline) echo. goto :end :end set _SETDEFAULT= ENDLOCAL