在 Wine 中启用西里尔文

在 Wine 中启用西里尔文

我想在 Wine 下运行《帝国时代》游戏。游戏运行良好,但由于游戏已翻译为俄语,因此菜单中出现乱码而不是字母。

我已使用以下命令添加了所有 RU 语言环境:

sudo dpkg-reconfigure locales

我发现建议在命令行中添加语言:LANG=ru_RU.UTF-8 wine executable.exe。我的游戏包含很长的 sh 脚本,在它的末尾我发现了运行游戏可执行文件的行:

"$WINE" $VIRTUAL_DESKTOP "$EXE" $ARGS

这句话的回响带来了:

/home/me/Downloads/AgeOfEmpiresII/wine/bin/wine Age2_x1.exe

我将命令改为:

LANG=ru_RU.UTF-8 "$WINE" $VIRTUAL_DESKTOP "$EXE" $ARGS

这没有帮助,甚至其他选择也给出了同样的结果

ru_RU.ISO-8859-5
ru_RU.CP1251
ru_RU.KOI8-R
ru_RU.UTF-8

整个启动脚本:

#!/bin/bash

### Wine startup script
### Version 1.1.0
### Author: Kron
### Latest version: https://yadi.sk/d/IrofgqFSqHsPu

## Exit if root



if [[ "$EUID" = 0 ]]
  then echo "Do not run this script as root!"
  exit
fi

### Set variables

## Script directory

export SCRIPT="$(readlink -f "${BASH_SOURCE[0]}")"
export DIR="$(dirname "$SCRIPT")"

if [ ! -d "$DIR/game_info" ]; then
    export DIR="${DIR%/*}"
fi

## Wine executables

WINE="$DIR/wine/bin/wine"
REGEDIT="$DIR/wine/bin/regedit"
WINEBOOT="$DIR/wine/bin/wineboot"
WINESERVER="$DIR/wine/bin/wineserver"

## Wine variables

export WINEPREFIX="$DIR/prefix"
export WINEDEBUG="-all"
export WINEARCH="win32"
export WINEDLLOVERRIDES="winemenubuilder.exe=d;nvapi,nvapi64,mscoree,mshtml="

# Set WINEARCH to win64 if game_info/win64 file exists
if [ -f "$DIR/game_info/win64" ]; then export WINEARCH="win64"; fi
# Enable WINEDEBUG if --debug argument is passed to script
if [ "$1" = "--debug" ]; then export WINEDEBUG=; fi

## Script variables

# Get settings (variables) from settings file if exists
SCRIPT_NAME="$(basename "$SCRIPT" | cut -d. -f1)"

if [ -f "$DIR/settings_$SCRIPT_NAME" ]; then source "$DIR/settings_$SCRIPT_NAME"
else
    ## Create settings file
    echo "#!/bin/sh" > "$DIR/settings_$SCRIPT_NAME"

    # Disables CSMT
    NOCSMT=0; echo "NOCSMT=$NOCSMT" >> "$DIR/settings_$SCRIPT_NAME"
    # Enables DXVK (requires d3d11.dll and dxgi.dll)
    DXVK=1; echo "DXVK=$DXVK" >> "$DIR/settings_$SCRIPT_NAME"
    # Enables virtual desktop
    WINDOWED=0; echo "WINDOWED=$WINDOWED" >> "$DIR/settings_$SCRIPT_NAME"
    # Set virtual desktop size
    WINDOW_RES=800x600; echo "WINDOW_RES=$WINDOW_RES" >> "$DIR/settings_$SCRIPT_NAME"
    # Use PulseAudio instead of ALSA
    USEPULSE=0; echo "USEPULSE=$USEPULSE" >> "$DIR/settings_$SCRIPT_NAME"
    # Restore screen resolution after close game
    FIXRES=1; echo "FIXRES=$FIXRES" >> "$DIR/settings_$SCRIPT_NAME"
    # Use system Wine
    SYSWINE=0; echo "SYSWINE=$SYSWINE" >> "$DIR/settings_$SCRIPT_NAME"
    # Set windows version (win7, winxp, win2k)
    WINVER=win7; echo "WINVER=$WINVER" >> "$DIR/settings_$SCRIPT_NAME"

    chmod +x "$DIR/settings_$SCRIPT_NAME"
fi

# Enable virtual desktop if WINDOWED env is set to 1 or --window argument is passed
if [ $WINDOWED = 1 ] || [ "$1" = "--window" ] || [ "$2" = "--window" ]; then
    export VIRTUAL_DESKTOP="explorer /desktop=Wine,$WINDOW_RES"
fi

# Get current screen resolution
if [ $FIXRES = 1 ]; then
    RESOLUTION="$(xrandr | grep \* | awk '{print $1}')"
fi

# Use system Wine if --syswine argument is passed or no Wine found in directory
if [ ! -f "$WINE" ] || [ $SYSWINE = 1 ] || [ "$1" = "--syswine" ] || [ "$2" = "--syswine" ]; then
    WINE=wine
    REGEDIT=regedit
    WINEBOOT=wineboot
    WINESERVER=wineserver
fi

## Game-specific variables

# Use game_info_SCRIPTNAME.txt file if exists
if [ -f "$DIR/game_info/game_info_$SCRIPT_NAME.txt" ]; then
    GAME_INFO="$(cat "$DIR/game_info/game_info_$SCRIPT_NAME.txt")"
else
    GAME_INFO="$(cat "$DIR/game_info/game_info.txt")"
fi

GAME="$(echo "$GAME_INFO" | sed -n 6p)"
VERSION="$(echo "$GAME_INFO" | sed -n 2p)"
GAME_PATH="$WINEPREFIX/drive_c/$(echo "$GAME_INFO" | sed -n 1p)"
EXE="$(echo "$GAME_INFO" | sed -n 3p)"
ARGS="$(echo "$GAME_INFO" | sed -n 4p)"

### Prepare for launching game

## Exit if there is no Wine or game_info

WINE_VERSION="$("$WINE" --version)"
if [ ! "$WINE_VERSION" ]; then
    echo "There is no Wine available in your system!"
    exit
fi

if [ ! "$GAME_INFO" ]; then
    echo "There is no game_info.txt file!"
    exit
fi

## Change working directory

cd "$DIR" || exit

## Setup prefix

if [ ! -d prefix ] || [ "$(id -un)" != "$(cat lastuser)" ] || [ "$WINE_VERSION" != "$(cat lastwine)" ]; then
    # If the user name or Wine has changed move old prefix
    if [ -d prefix ]; then
        rm -r prefix_old
        mv prefix prefix_old
    fi

    # Create prefix
    "$WINEBOOT" && "$WINESERVER" -w

    # Apply reg files
    if [ -d game_info/regs ]; then
        cat game_info/regs/*.reg > game_reg.reg
        "$REGEDIT" game_reg.reg && rm game_reg.reg
    fi

    # Create symlink to game directory
    mkdir -p "$GAME_PATH" && rm -r "$GAME_PATH"
    ln -sfr game_info/data "$GAME_PATH"

    # Execute files in game_info/exe directory
    if [ -d game_info/exe ]; then
        for file in game_info/exe/*; do
            "$WINE" start "$file"
            "$WINESERVER" -w
        done
    fi

    # Symlink requeired dlls and override them
    if [ -d game_info/dlls ]; then
        echo -e "Windows Registry Editor Version 5.00\n" > dlloverrides.reg
        echo -e "[HKEY_CURRENT_USER\Software\Wine\DllOverrides]" >> dlloverrides.reg

        for x in game_info/dlls/*; do
            if [[ "$x" != *"special"* ]]; then
                ln -sfr "$x" "$WINEPREFIX/drive_c/windows/system32"

                # Do not override component if required
                if [ ! -f "game_info/dlls/special/"$(basename $x)"_nooverride" ]; then
                    echo -e '"'$(basename $x .dll)'"="native"' >> dlloverrides.reg
                fi

                # Register component with regsvr32 if required
                if [ -f "game_info/dlls/special/"$(basename $x)"_register" ]; then
                    "$WINE" regsvr32 "$(basename $x)"
                fi
            fi
        done

        "$REGEDIT" dlloverrides.reg && rm dlloverrides.reg
    fi

    # Make documents directory
    mkdir "$DIR/documents"

    # Sandbox the prefix; Borrowed from winetricks scripts
    rm -f "$WINEPREFIX/dosdevices/z:"

    if cd "$WINEPREFIX/drive_c/users/$(id -un)"; then
        for x in *; do
            if test -h "$x" && test -d "$x"; then
                rm -f "$x"

                # Create symlinks to documents directory
                ln -sfr "$DIR/documents" "$x"
            fi
        done

        # Create additional symlinks to documents directory
        rm -r "Application Data"
        rm -r AppData
        rm -r "Local Settings"

        ln -sfr "$DIR/documents" "Application Data"
        ln -sfr "$DIR/documents" AppData
        ln -sfr "$DIR/documents" "Local Settings"

        cd "$DIR"
    fi

    "$REGEDIT" /D 'HKEY_LOCAL_MACHINE\\Software\\Microsoft\Windows\CurrentVersion\Explorer\Desktop\Namespace\{9D20AAE8-0625-44B0-9CA7-71889C2254D9}'
    echo disable > "$WINEPREFIX/.update-timestamp"

    # Create symlinks to additional folders
    if [ -d game_info/additional ]; then
        for (( i=1; i <= $(ls -d game_info/additional/*/ | wc -l); i++ )); do
            ADD_PATH="$WINEPREFIX/drive_c/$(cat game_info/additional/path.txt | sed -n "$i"p | sed "s/--REPLACE_WITH_USERNAME--/$(id -un)/g")"

            if [[ "$ADD_PATH" = *"Мои документы"* ]]; then
                ADD_PATH="$(echo $ADD_PATH | sed "s/prefix\\/drive_c\\/users\\/$(id -un)\\/Мои документы/documents/g")"
            fi

            mkdir -p "$ADD_PATH"

            if [ -f game_info/additional/dir_$i/docopy ]; then
                cp -r game_info/additional/dir_$i/* "$ADD_PATH"
                rm "$ADD_PATH/docopy"
            else
                for file in game_info/additional/dir_$i/*; do
                    if [ -d "$ADD_PATH/$(basename "$file")" ]; then
                        rm -r "$ADD_PATH/$(basename "$file")"
                    fi

                    ln -sfr "$file" "$ADD_PATH"
                done
            fi
        done
    fi

    # Save information about last user name and Wine version
    echo "$(id -un)" > lastuser && echo "$WINE_VERSION" > lastwine
fi

## Set windows version; Borrowed from winetricks

if [ "$WINVER" != "$(cat lastwin)" ]; then
    if [ "$WINVER" = "winxp" ]; then
        csdversion="Service Pack 3"
        currentbuildnumber="2600"
        currentversion="5.1"
        csdversion_hex=dword:00000300
    elif [ "$WINVER" = "win2k" ]; then
        csdversion="Service Pack 4"
        currentbuildnumber="2195"
        currentversion="5.0"
        csdversion_hex=dword:00000400
    elif [ "$WINVER" = "win7" ]; then
        csdversion="Service Pack 1"
        currentbuildnumber="7601"
        currentversion="6.1"
        csdversion_hex=dword:00000100

        "$WINE" reg add "HKLM\\System\\CurrentControlSet\\Control\\ProductOptions" /v ProductType /d "WinNT" /f
    fi

    # Create registry file
    echo -e "Windows Registry Editor Version 5.00\n" > "$WINEPREFIX/drive_c/setwinver.reg"
    echo -e "[HKEY_LOCAL_MACHINE\\Software\\Microsoft\\Windows NT\\CurrentVersion]" >> "$WINEPREFIX/drive_c/setwinver.reg"
    echo -e '"CSDVersion"="'$csdversion'"' >> "$WINEPREFIX/drive_c/setwinver.reg"
    echo -e '"CurrentBuildNumber"="'$currentbuildnumber'"' >> "$WINEPREFIX/drive_c/setwinver.reg"
    echo -e '"CurrentVersion"="'$currentversion'"' >> "$WINEPREFIX/drive_c/setwinver.reg"

    echo -e "\n[HKEY_LOCAL_MACHINE\\System\\CurrentControlSet\\Control\\Windows]" >> "$WINEPREFIX/drive_c/setwinver.reg"
    echo -e '"CSDVersion"='$csdversion_hex'\n' >> "$WINEPREFIX/drive_c/setwinver.reg"

    # Apply and delete registry file
    "$REGEDIT" C:\setwinver.reg && rm "$WINEPREFIX/drive_c/setwinver.reg"
    echo "$WINVER" > lastwin
fi

## Set sound driver to PulseAudio; Borrowed from winetricks

if [ $USEPULSE = 1 ] && [ ! -f "$WINEPREFIX/drive_c/usepulse.reg" ]; then
    # Create registry file
    echo -e "Windows Registry Editor Version 5.00\n" > "$WINEPREFIX/drive_c/usepulse.reg"
    echo -e "[HKEY_CURRENT_USER\\Software\\Wine\\Drivers]\n" >> "$WINEPREFIX/drive_c/usepulse.reg"
    echo -e '"Audio"="pulse"' >> "$WINEPREFIX/drive_c/usepulse.reg"

    # Apply registry file
    "$REGEDIT" C:\usepulse.reg && rm "$WINEPREFIX/drive_c/usealsa.reg"
elif [ $USEPULSE = 0 ] && [ ! -f "$WINEPREFIX/drive_c/usealsa.reg" ]; then
    # Create registry file
    echo -e "Windows Registry Editor Version 5.00\n" > "$WINEPREFIX/drive_c/usealsa.reg"
    echo -e "[HKEY_CURRENT_USER\\Software\\Wine\\Drivers]\n" >> "$WINEPREFIX/drive_c/usealsa.reg"
    echo -e '"Audio"="alsa"' >> "$WINEPREFIX/drive_c/usealsa.reg"

    # Apply registry file
    "$REGEDIT" C:\usealsa.reg && rm "$WINEPREFIX/drive_c/usepulse.reg"
fi

## Disable CSMT if required

if [ $NOCSMT = 1 ] && [ ! -f "$WINEPREFIX/drive_c/csmt.reg" ]; then
    # Create registry file
    echo -e "Windows Registry Editor Version 5.00\n" > "$WINEPREFIX/drive_c/csmt.reg"
    echo -e "[HKEY_CURRENT_USER\Software\Wine\Direct3D]\n" >> "$WINEPREFIX/drive_c/csmt.reg"
    echo -e '"csmt"=dword:0\n' >> "$WINEPREFIX/drive_c/csmt.reg"

    # Apply registry file
    "$REGEDIT" C:\csmt.reg
elif [ $NOCSMT = 0 ] && [ -f "$WINEPREFIX/drive_c/csmt.reg" ]; then
    # Create registry file
    echo -e "Windows Registry Editor Version 5.00\n" > "$WINEPREFIX/drive_c/csmt.reg"
    echo -e "[HKEY_CURRENT_USER\Software\Wine\Direct3D]\n" >> "$WINEPREFIX/drive_c/csmt.reg"
    echo -e '"csmt"=-' >> "$WINEPREFIX/drive_c/csmt.reg"

    # Apply registry file
    "$REGEDIT" C:\csmt.reg && rm "$WINEPREFIX/drive_c/csmt.reg"
fi

## Disable DXVK if required

if [ $DXVK = 0 ]; then
    export WINEDLLOVERRIDES="$WINEDLLOVERRIDES;dxgi,d3d11=b"
fi

## Run the game

# Output game and Wine information
clear
echo "========================================="
echo -e "\nGame: $GAME\nVersion: $VERSION"
echo -ne "\nWine: $WINE_VERSION"

if [ $NOCSMT = 1 ]; then echo -ne "\nCSMT: disabled"
else echo -ne "\nCSMT: enabled"; fi
if [ $DXVK = 1 ] && [ -f "$DIR/game_info/dlls/d3d11.dll" ]; then
    echo -ne "\nDXVK: enabled"; else echo -ne "\nDXVK: disabled"
fi

echo -e '\n'
echo "========================================="
echo

# Launch the game


cd "$GAME_PATH/$(echo "$GAME_INFO" | sed -n 5p)" || exit

echo "gggg" "$WINE" LANG=ru_RU.UTF-8 $EXE

echo "$WINE" $VIRTUAL_DESKTOP "LANG=ru_RU.UTF-8" "$EXE" $ARGS
echo "$WINE" $VIRTUAL_DESKTOP "$EXE" $ARGS

"$WINE" $VIRTUAL_DESKTOP "$EXE" $ARGS

# Restore screen resolution
if [ $FIXRES = 1 ]; then
    "$WINESERVER" -w
    xrandr -s $RESOLUTION
fi

图片:

如何解决这个问题呢?

更新型多巴胺

安装的字体:

sudo apt-get install ttf-mscorefonts-installer

locale -a带来:

C
C.UTF-8
en_GB.utf8
POSIX
ru_RU
ru_RU.ISO-8859-5
ru_RU.cp1251
ru_RU.koi8-R
ru_RU.utf-8
russian
ru_UA
ru_UA.koi8u
ru_UA.utf8

相关内容