Mame Playback Fatal Error, Input File Inp Not Found

By default, the inp file we downloaded should be placed in 'inp' directory which is at the same level with mame.exe.

I found this sophisticated reason by recording a inp file that shows me the sub-directory created.

We can indicate our inp directory by '-input_directory' argument.

Here is my handy bash,

MAME_DIR=/e/game/ex/mame
MAME_BIN="${MAME_DIR}/MAMEv0.248/mame.exe"
MAMEP_BIN="${MAME_DIR}/mameplus_bin_x86-0.168/mamep.exe"
MAME_0229="${MAME_DIR}/wolfmame-0229/mame.exe"
MAME_0140="${MAME_DIR}/wolfmame-0140/mame.exe"
MAME_0105="${MAME_DIR}/wolfmameplus-0105/mamep105-vc.exe"
MAME_0101="${MAME_DIR}/wolfmameplus-0101/mameip101.exe"

MAME_ROMS_DIR=${MAME_DIR}/database/roms
MAME_INP_DIR=${MAME_DIR}/database/inp

MAME_ARG="-window -skip_gameinfo -rompath ${MAME_DIR}/database/roms -snapshot_directory ${MAME_DIR}/database/snap -input_directory ${MAME_INP_DIR}"
MAMEP_ARG2="-scale_effect hq3x"
MAME_ARG2="-nofilter"

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=${MAME_DIR}/database/tmp
	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"
}

file_extract()
{
	local file_7z=$1
	local suffix_to_unzip=$2
	local tmp_dir=${MAME_DIR}/database/tmp
	mkdir "$tmp_dir"

	7z x ${file_7z} -o"`get_win_path \"$tmp_dir\"`"
	(
		cd "$tmp_dir"
		ls
		
		mv `find . -iname "*\.${suffix_to_unzip}" | head -n 1` ${MAME_INP_DIR}/
	)

	rm -Rf "$tmp_dir"
}

mame_inp()
{
	local GAME="$1"
	local EXE_VER="$2"
	local HEAD_NO="$3"
	local EXE=${MAME_BIN}
	[ "x${HEAD_NO}" == "x" ] && HEAD_NO=1
	local INP_PATH=`find ${MAME_INP_DIR} -iname "*${GAME}*" | sed -n ${HEAD_NO}p`
	local NEED_GO_TO_EXE_PATH=0

	if [ "x${EXE_VER}" == "xp" ] ; then
		EXE=${MAMEP_BIN}
		MAME_ARG_ALL="${MAME_ARG} ${MAMEP_ARG2}"
	elif [ "x${EXE_VER}" != "x" ] && [ "x${EXE_VER}" != "xnew" ] ; then
		format_transform ${MAME_ROMS_DIR}/${GAME}.7z ${MAME_ROMS_DIR}/${GAME}.zip
		eval EXE=\$MAME_${EXE_VER}
		MAME_ARG_ALL=${MAME_ARG}
		[ ${EXE_VER} -gt "0200" ] && MAME_ARG_ALL="${MAME_ARG} ${MAME_ARG2}"
		NEED_GO_TO_EXE_PATH=1
	else
		MAME_ARG_ALL="${MAME_ARG} ${MAME_ARG2}"
	fi
	
	file_extract ${INP_PATH} inp
	
	local INP_FILE=`cd ${MAME_INP_DIR} && find . -iname "*\.inp" | head -n 1 | awk -F/ '{print $2}'`
	
	echo "We will playback ${INP_FILE} using ${EXE}..."
	
	(
		[ ${NEED_GO_TO_EXE_PATH} == "1" ] && cd `dirname ${EXE}`
		echo "\n" | ${EXE} ${MAME_ARG_ALL} -cfg_directory ${MAME_DIR}/database/cfg ${GAME} -playback ${INP_FILE}
	)
	
	rm -Rf ${MAME_DIR}/database/cfg
	if [ -e ${MAME_ROMS_DIR}/${GAME}.zip ] ; then
		rm ${MAME_ROMS_DIR}/${GAME}.zip
	fi
	rm ${MAME_INP_DIR}/${INP_FILE}
}

alias mame="${MAME_BIN} ${MAME_ARG}"
alias mamep="${MAMEP_BIN} ${MAME_ARG}"

How to use, e.g.

mame_inp mystston new 2

refer to:
http://replay.marpirc.net/
http://forums.marpirc.net/viewtopic.php?f=2&t=15916
https://unix.stackexchange.com/questions/222487/bash-dynamic-variable-variable-names

Portable QGis

qgis-bin.env.sh

sed -e 's/\%CUR_DIR\%/E\:\\tool\\QGIS/g' \
	-e 's/\%CUR_DIR_LINUX\%/E\:\/tool\/QGIS/g' qgis-bin.env.scheme > qgis-bin.env

qgis-bin.env.scheme

PATH=%CUR_DIR%\bin;%CUR_DIR%\apps\grass\grass82\lib;%CUR_DIR%\apps\grass\grass82\bin;%CUR_DIR%\apps\qt5\bin;%CUR_DIR%\apps\Python39\Scripts;%CUR_DIR%\bin;%CUR_DIR%\apps\qgis\bin;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\system32\WBem
GDAL_DATA=%CUR_DIR%\apps\gdal\share\gdal
GDAL_DRIVER_PATH=%CUR_DIR%\apps\gdal\lib\gdalplugins
GDAL_FILENAME_IS_UTF8=YES
PDAL_DRIVER_PATH=%CUR_DIR%\apps\pdal\plugins
GISBASE=%CUR_DIR%\apps\grass\grass82
GRASS_PROJSHARE=%CUR_DIR%\share\proj
GRASS_PYTHON=%CUR_DIR%\bin\python3.exe
OSGEO4W_ROOT=%CUR_DIR%
PROJ_LIB=%CUR_DIR%\share\proj
PYTHONHOME=%CUR_DIR%\apps\Python39
PYTHONPATH=%CUR_DIR%\apps\grass\grass82\etc\python;
PYTHONUTF8=1
QGIS_PREFIX_PATH=%CUR_DIR_LINUX%/apps/qgis
QT_PLUGIN_PATH=%CUR_DIR%\apps\qgis\qtplugins;%CUR_DIR%\apps\qt5\plugins
VSI_CACHE=TRUE
VSI_CACHE_SIZE=1000000
O4W_QT_PREFIX=%CUR_DIR_LINUX%/apps/Qt5
O4W_QT_BINARIES=%CUR_DIR_LINUX%/apps/Qt5/bin
O4W_QT_PLUGINS=%CUR_DIR_LINUX%/apps/Qt5/plugins
O4W_QT_LIBRARIES=%CUR_DIR_LINUX%/apps/Qt5/lib
O4W_QT_TRANSLATIONS=%CUR_DIR_LINUX%/apps/Qt5/translations
O4W_QT_HEADERS=%CUR_DIR_LINUX%/apps/Qt5/include
QGIS_WIN_APP_NAME=QGIS_3.30\QGIS Desktop 3.30.2
SSL_CERT_DIR=%CUR_DIR%\apps\openssl\certs
SSL_CERT_FILE=%CUR_DIR%\bin\curl-ca-bundle.crt

Plugins,

QuickOSM
Search Layers

refer to:
https://github.com/sourcepole/qgis-openlayers-plugin
http://www.uwenku.com/question/p-gajlmliq-bag.html
https://www.naturalearthdata.com
https://www.qgistutorials.com/en/docs/3/making_a_map.html

Taskbar Disappeared, Unresponsible in Win11

Global.iris service of Windows 11, which is related to the wallpaper of the day feature, cannot be turned off from the services menu.

reg delete HKCU\SOFTWARE\Microsoft\Windows\CurrentVersion\IrisService

then reboot the pc.

refer to:
https://windowsreport.com/global-iris-service-windows-11
http://www.ulaojiu.com/xitong/xtjc/20210903/224262.html

Debian Memo

Intel non-free wifi firmware,

lspci -nnk
lshw -c
modinfo iwlwifi
dmesg | grep microcode
 
apt install intel-microcode
sudo apt-get install--reinstall linux-firmware

https://www.intel.com/content/www/us/en/support/articles/000005511/wireless.html
https://wiki.debian.org/iwlwifi
https://forums.debian.net/viewtopic.php?t=152523
https://wiki.debian.org/Microcode

Install PVE in Metal Partition not Whole Disk

Learnt from referred link, we first install Xubuntu along with Win11 in the same metal disk,

then we reboot into Xubuntu, update it to PVE kernel,

# sudo vi /etc/apt/sources.list.d/pve-install-repo.list
	deb [arch=amd64] http://download.proxmox.com/debian/pve bullseye pve-no-subscription
 
sudo wget https://enterprise.proxmox.com/debian/proxmox-release-bullseye.gpg -O /etc/apt/trusted.gpg.d/proxmox-release-bullseye.gpg
 
sudo apt update
sudo apt full-upgrade
 
sudo apt install pve-kernel-5.15
 
reboot
 
sudo apt install proxmox-ve postfix open-iscsi

To be continued ...

p.s. dependency failed in installing pve in ubuntu, which means we must play it under debian os.

refer to:
https://post.smzdm.com/p/awzzqlep
https://pve.proxmox.com/wiki/Install_Proxmox_VE_on_Debian_Buster

Create Shortcut Using Batch Script in Windows

shotcut.bat

@echo off
 
call :create_shortcut "Z:\port\d\7-Zip\"	7zFM.exe	C:\Users\eu\Desktop\ 7z
 
pause
exit
 
:create_shortcut
	set src_dir=%1%
	set src_file=%2%
	set dst_dir=%3%
	set dst_file=%4%
 
	echo "%src_dir%%src_file% => %dst_dir%%dst_file%"
 
	shotcut_func.vbs %src_dir% %src_file% %dst_dir% %dst_file%

	rem echo [InternetShortcut] >> %shortcut%
	rem echo URL="%source%" >> %shortcut%
	rem echo IconFile=%source% >> %shortcut%
	rem echo IconIndex=20 >> %shortcut%

shotcut_func.vbs

src_dir = wscript.arguments(0)
src_file = wscript.arguments(1)
dst_dir = wscript.arguments(2)
dst_file = wscript.arguments(3)
 
Set oWS = WScript.CreateObject("WScript.Shell")
sLinkFile = dst_dir + dst_file + ".lnk"
Set oLink = oWS.CreateShortcut(sLinkFile)
 
oLink.TargetPath = src_dir + src_file
' optional shortcut properties
' oLink.Arguments = ""
' oLink.IconLocation = src_dir + src_file + ", 2"
' oLink.WindowStyle = "1"
oLink.WorkingDirectory = src_dir
oLink.Save

refresh_icons.bat

taskkill /f /im explorer.exe
 
attrib -h -s -r "%userprofile%\AppData\Local\IconCache.db"
del /f "%userprofile%\AppData\Local\IconCache.db"
attrib /s /d -h -s -r "%userprofile%\AppData\Local\Microsoft\Windows\Explorer\*"
del /f "%userprofile%\AppData\Local\Microsoft\Windows\Explorer\thumbcache_32.db"
del /f "%userprofile%\AppData\Local\Microsoft\Windows\Explorer\thumbcache_96.db"
del /f "%userprofile%\AppData\Local\Microsoft\Windows\Explorer\thumbcache_102.db"
del /f "%userprofile%\AppData\Local\Microsoft\Windows\Explorer\thumbcache_256.db"
del /f "%userprofile%\AppData\Local\Microsoft\Windows\Explorer\thumbcache_1024.db"
del /f "%userprofile%\AppData\Local\Microsoft\Windows\Explorer\thumbcache_idx.db"
del /f "%userprofile%\AppData\Local\Microsoft\Windows\Explorer\thumbcache_sr.db"
 
echo y | reg delete "HKEY_CLASSES_ROOT\Local Settings\Software\Microsoft\Windows\CurrentVersion\TrayNotify" /v IconStreams
echo y | reg delete "HKEY_CLASSES_ROOT\Local Settings\Software\Microsoft\Windows\CurrentVersion\TrayNotify" /v PastIconsStream
 
start explorer

refer to:
https://serverfault.com/questions/171775/create-a-windows-shortcut-through-a-batch-file-bat
https://wenwen.sogou.com/z/q813141367.htm
https://www.2cto.com/kf/201307/225348.html
https://zhuanlan.zhihu.com/p/72426926

Dll Number Relative to Visual C++ Redistributable

MSVCR80.dll	Visual Studio 2005	8.0
MSVCR90.dll	Visual Studio 2008	9.0
MSVCR100.dll	Visual Studio 2010	10.0
MSVCR110.dll	Visual Studio 2012	11.0
MSVCR120.dll	Visual Studio 2013	12.0
MSVCR140.dll	Visual Studio 2015	14.0
MSVCR150.dll	Visual Studio 2017	15.0

refer to:
http://portal.digitser.cn/article-2038-1.html