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
53
54
55
56
57
58
59
60
#!/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
 
get_win_path()
{
	local win_path="$1"
	win_path="${win_path#/}"
	win_path="${win_path//\//\\}"
	win_path="${win_path/\\/\:\\}"
	echo $win_path
}
 
format_transform()
{
	local file_7z=$1
	local file_zip=$2
	local tmp_dir=$TMPDIR
	mkdir "$tmp_dir"
 
	7z x ${file_7z} -o"`get_win_path \"$tmp_dir\"`"
	(
		cd "$tmp_dir"
		ls
 
		7z a -mx9 "`get_win_path \"${file_zip}\"`" || ( echo "Creating 7z file failed." && ISERR="yes" )
	)
 
	rm -Rf "$tmp_dir"
}
 
cd "$PARENTDIR"
 
for fn in `ls *.zip`; do
 
	echo "$fn"
 
	format_transform $fn "`pwd`/${fn%.zip}.7z"
 
	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

Switch between GPUs in Fedora35

Install Nvidia driver from rpmfusion,

yum install --nogpgcheck https://mirrors.tuna.tsinghua.edu.cn/rpmfusion/free/fedora/rpmfusion-free-release-$(rpm -E %fedora).noarch.rpm https://mirrors.tuna.tsinghua.edu.cn/rpmfusion/nonfree/fedora/rpmfusion-nonfree-release-$(rpm -E %fedora).noarch.rpm
dnf install akmod-nvidia

Before rebooting, must sign nividia driver using MOK.der, if not, we will receive at boot, "nvidia kernel module missing. falling back to nouveau".

Or install Nvidia driver from official site,

Clean up akmod-nvidia,

dnf remove akmod-nvidia
dnf remove xorg-x11-drv-nvidia

To blacklist the nouveau drivers,

dracut -v /boot/initramfs-`uname -r`.img `uname -r` --force

/etc/default/grub

GRUB_CMDLINE_LINUX="rhgb quiet rd.driver.blacklist=nouveau modprobe.blacklist=nouveau nvidia-drm.modeset=1"
grub2-mkconfig -o /boot/efi/EFI/fedora/grub.cfg

After rebooting, download NVIDIA-Linux-x86_64-XXX.XX.XX.run from official site, install it using /root/signed-modules/MOK.* and reboot,
https://www.nvidia.com/download/index.aspx?lang=en-us

Check current GPU vendor,

1
glxinfo | egrep "OpenGL vendor|OpenGL renderer"

How to dynamically switch GPUs?

I found ue4 selecting /dev/nvidia0 by itself, we needn't care about if switch.

https://pellegrino.link/2015/11/29/signing-nvidia-proprietary-driver-on-fedora.html
https://www.cnblogs.com/Mingxx/p/3192483.html
https://docs.fedoraproject.org/en-US/quick-docs/how-to-set-nvidia-as-primary-gpu-on-optimus-based-laptops/