Re-compress all Mame zip roms to 7z format

In advance,

trans_to_7z.sh

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
#!/bin/bash
 
PARENTDIR=$1
TMPDIR=`pwd`/tmp
 
PATH="/d/cext/Program Files/7-Zip:$PATH"
 
ISERR="no"
 
if [ "x$1" = x ] ; then
	echo "Please input dir to transform."
	exit
fi
 
if [ -e "$TMPDIR" ] ; then
	echo "Please rmdir [$TMPDIR] first."
	exit
fi
 
cd "$PARENTDIR"
 
get_win_path()
{
	local win_path="$1"
	win_path="${win_path#/}"
	win_path="${win_path//\//\\}"
	win_path="${win_path/\\/\:\\}"
	echo $win_path
}
 
for fn in `ls *.zip`; do
 
	echo "$fn"
 
	mkdir "$TMPDIR"
 
	7z x $fn -o"`get_win_path \"$TMPDIR\"`"
	NEWFN="`pwd`/${fn%.zip}.7z"
	(
		cd "$TMPDIR"
		7z a -mx9 "`get_win_path \"$NEWFN\"`" || ( echo "Creating 7z file failed." && ISERR="yes" )
		ls
	)
 
	rm -Rf "$TMPDIR"
 
	if [ $ISERR = "yes" ]; then
		exit
	fi
done
 
echo "Transforming done."

How to use?

Copy trans_to_7z.sh to Mame root folder which contains roms sub-directory, right click at blank place of this Mame root window in Explorer, select "Git Bash Here" which prompts bash console, input below and return,

1
./trans_to_7z.sh roms

refer to:
https://www.cnblogs.com/wq242424/p/15564203.html

Play mame in Linux handily

1
dnf install mame

in ~/.bashrc

1
2
MAME_DATABASE=/to/path/of/mame
alias mame_go="mame -window -rompath ${MAME_DATABASE}/roms -snapshot_directory ${MAME_DATABASE}/snap "

how to play,

1
2
3
4
# open game list.
mame_go
# or quickly into play.
mame_go sf2ce

Other emulators,

1
2
3
4
# fc nes
dnf install fceux
# ps2
dnf install pcsx2