Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

"cia-to-3ds.convert_all.bat" #30

Open
eyeonus opened this issue Feb 25, 2021 · 0 comments
Open

"cia-to-3ds.convert_all.bat" #30

eyeonus opened this issue Feb 25, 2021 · 0 comments

Comments

@eyeonus
Copy link

eyeonus commented Feb 25, 2021

I made a simple batch job for converting cia files into 3ds files for Citra peeps.

This batch file has to be in the same folder as the toolkit.

By default, this will take every '*.cia' file located in "<toolkit installation folder>\cia", extract them to a folder by the same name minus the extension in "<toolkit installation folder>\3ds", build a '*.3ds' from that folder and place it in the '<toolkit installation folder>\3ds' folder, and then delete the folder (and all its contents) created from the extraction process.

The user can specify the source folder where the '*.cia' files are located and the output folder to store the resultant '*.3ds' files.
The output folder does not need to exist and will be created if it does not, but obviously the input folder does need to exist, and to contain '*.cia' files in order for this to do anything.
(The temporary output folder produced by the extraction will also be in the specified output folder.)

An input folder must be specified in the command line if an output folder other than the default is desired, but if an input folder is specified and an output folder is not, it will use the default location mentioned above.
(The batch file is stupid, and assumes the first passed parameter is the input folder and the second is the output folder, so in order to have a specified output the input must be specified as well.)

So, if this toolkit is installed at 'C:\DotNet3dsToolkit':
C:\DotNet3dsToolkit\cia-to-3ds.convertall.bat will find all the '*.cia' files in "C:\DotNet3dsToolkit\cia' and produce '*.3ds' files from them in the folder "C:\DotNet3dsToolkit\3ds".

Whereas:
C:\DotNet3dsToolkit\cia-to-3ds.convertall.bat L:\ROMs\3DS\ L:ROMs\3DS\ will find all the '*.cia' files in "L:\ROMs\3DS" and produce '*.3ds' files from them in the folder "L:\ROMs\3DS".

In any case, here it is:

@echo off

rem Get argument values.  If not specified, use default values.
if "%1"=="" ( set "in=cia" ) else ( set "in=%1" )
if "%2"=="" ( set "out=3ds" ) else ( set "out=%2" )

if not exist %out% mkdir %out%

setlocal enabledelayedexpansion

for %%f in ("%in%\*.cia") do (
	set name=%%~nf
	
	echo =========================================================================
	echo Extracting "!name!.cia" to "%out%\!name!\"
	echo =========================================================================
	.\ToolkitConsole.exe "%in%\!name!.cia" "%out%\!name!"
	
	echo =========================================================================
	echo Building "!name!.3ds" from "%out%\!name!\"
	echo =========================================================================
	.\ToolkitConsole.exe "%out%\!name!" "%out%\!name!.3ds"
	
	echo =========================================================================
	echo Removing "!name!"
	rmdir /S /Q "%out%\!name!"
)

echo =========================================================================
echo All '*.cia' files from "%in%" converted to '*.3ds' files and placed in "%out%"

I don't expect you to add this to the project, hence no PR, but I would ask that you don't close this issue just so future users can make use of it if they desire.

@eyeonus eyeonus changed the title "cia-to-3ds.convertall.bat" "cia-to-3ds.convert_all.bat" Feb 25, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant