在 Linux 下玩《英雄无敌 3》

{ 撰文/吴吉庆 }

介绍

英雄无敌 2 和 3 都是英雄无敌系列的经典,你知道吗,英雄无敌 3 有 Linux 版的啊。 先来几张截图看看吧。

Heroes

Heroes

Heroes

怎么样?和 Windows 版的一样吗? 不过,这个 Linux 版并不是原公司做的,这个是可敬的洛基(loki)公司做的。

洛基公司是个致力于开发 Linux 游戏的公司,目标是增加 Linux 的竞争力。 无疑,他们都是非常喜欢 Linux 的一批人了。 可惜,公司已经倒闭,无法赢利公司就无法生存。 怎么 Linux 的游戏市场就是打不开呢?是因为当时 Linux 用户还少吧? 那么现在呢?

下载和安装

国内的用户可以到这里下载:

http://ftp.ubuntu.org.cn/games/xiechy/

感谢 Ubuntu 中文论坛提供的服务。

下载完 Heroes.of.Might.and.Magic.3.Linux.[mulek.info].iso 后,按以下步骤安装:

sudo mount -o loop Heroes.of.Might.and.Magic.3.Linux.[mulek.info].iso /mnt
cd /mnt
sudo bash setup.sh

将会启动安装的图形界面,有的机器也会启动文字安装界面。 安装的默认目录是 /usr/local/games/Heroes3,你也可以更改。 安装的大小是可以定制的,如果你不安装声音、音乐和视频,安装大小都不到 100 兆。

安装迅速完成, 这时在命令行运行 heroes3,就启动游戏了。 进去体验一下吧,很流畅吧,CPU 占用非常之低,看来是基于 Timer 实现的啊, 我喜欢这样的游戏。

安装全屏补丁

怎么回事?不能全屏。即使加了 -f 选项,也是在 800x600 的窗口中运行。

运行一下 heroes3 -v,现在的版本号是 1.2。

我们打一个 1.3.1 的补丁就可以了。

就在我们上面提到的 http://ftp.ubuntu.org.cn/games/xiechy/ 中,有一个 heroes3-1.3.1a-x86.run 文件,大概两兆多大小,这个就是补丁。 不过据说这个不行,要 Google 下载另一个 heroes3-1.3.1-x86.run, 注意到差别了吗,这个文件名中少一个 a。另外这个大小只有 1 兆左右。

现在运行 sudo sh heroes3-1.3.1-x86.run,却发现以下错误:

Verifying archive integrity...tail: cannot open `+6' for reading: No such file or directory
Error in check sums 2268731580 1601210390

下面就是我要讲的主要部分,怎么对补丁进行 hack。

用 Vim 打开 heroes3-1.3.1-x86.run,搜索 +6 ,发现是作为 tail 的参数。 表示从文件第六行的内容。但是这样使用参数是错误的,正确的使用方法是 tail --lines=+6。 所以把 +6 的部分都改正为 --lines=+6 。 这样 tail: cannot open+6' for reading: No such file or directory` 的错误就消除了。

再次运行 sudo sh heroes-1.3.1-x86.run,仍然有如下错误

Error in check sums 2268731580 1601210390

在 heroes-1.3.1-x86.run 中搜索,找到那个地方。

大概是 102 行,注释掉以下部分。

#[ $sum1 -ne $CRCsum ] && {
#  $echo Error in check sums $sum1 $CRCsum
#  eval $finish; exit 2;
#}

再次 sudo sh heroes3-1.3.1-x86.run,结果如下:

Verifying archive integrity...OK
Uncompressing Heroes of Might & Magic III for Linux: patch 1.3.1
trap: 126: cd /tmp; /bin/rm -rf $tmpdir; exit $res: bad trap

搜索 trap,只在一个地方出现,

[ "$keep" = y ] || trap 'cd /tmp; /bin/rm -rf $tmpdir; exit $res'

trap 什么意思,我不太明白,因为下面还有一行

[ "$keep" = y ] || { cd /tmp; /bin/rm -rf $tmpdir; }

所以我认为 trap 这行没有实际作用,注释掉

#[ "$keep" = y ] || trap 'cd /tmp; /bin/rm -rf $tmpdir; exit $res'

保存,运行 sudo ./heroes3-1.3.1-x86.run --keep。成了!

Verifying archive integrity...OK
Uncompressing Heroes of Might & Magic III for Linux: patch 1.3.1.....
***********************************************************************
This script will install the 1.3.1 patch for Heroes of Might & Magic III
You need an exiting installation of the game and sufficient
write access permissions to proceed.

This patch is for a x86 system
You are running a x86 system

OK !
Please enter the Heroes III installation directory [/usr/local/games/Heroes3]
:
Patching heroes3 ...

Successfully upgraded Heroes III to version 1.3.1 !
Please read the file README.patch13 in /usr/local/games/Heroes3 for details
about this patch.
Enjoy the game !

检验一下,heroes3 -v

Heroes of Might and Magic III Linux 1.3.1
- Mar  7 2000
Built with flags:
-DUNIX
Built with glibc-2.1

OK,升级成功!运行 heroes3,不加参数,默认是全屏的。如果要在窗口内运行,就 heroes3 -w

Enjoy the game!

更新: 想省事的朋友可以在这里下载我修改过的全屏补丁。

{ Source. Thanks jiqing. }

Read More:

18 Comments

  1. 1 qii Commented @ 2009-11-12 11:25Reply to this comment

    ub论坛的ftp是要密码的: ubuntu/ubuntuftp

  2. 2 crown.hg Commented @ 2009-11-12 11:30Reply to this comment

    请问楼主,可以用网上下截的英文版地图吗?

  3. 3 Weive Commented @ 2009-11-12 11:37Reply to this comment

    这个巨麻烦。说句实话,还不如用wine,下载电驴上硬盘版的WOG全集,效果来得更好。 而且这个版本只有埃拉西亚的光复,无法全屏也是个很难解决的问题。

  4. 4 foolz Commented @ 2009-11-12 11:37Reply to this comment

    I have done this like long time ago, I found out there will be a sound issue, something with other linux game like Never Winter Night. if the sounds is terrible. Try this:

    move your sound libraries from /usr/lib to your game directory if it is using an old version of the sound library.

    For instance, it may be something like libSDL-1.2.so.0 you may need to copy over. It could also be that you need to switch your computer to OSS sounds instead if you have a really really crappy sound card.

    good lucky

  5. 5 Yeqin_Su Commented @ 2009-11-12 12:17Reply to this comment

    很好很强大,感谢所有支持linux的用户

  6. 6 poet Commented @ 2009-11-12 12:58Reply to this comment

    这个是光复(RoE)版本,一般没什么人玩了,现在主流都是 SoD 或者 WoG,部分人已经是 HoTA 了。所以还是 wine 一个实在。

  7. 7 kilior Commented @ 2009-11-12 14:09Reply to this comment

    h3现在免费了吗?下载地址的公布会不会损害到ubuntu.org.cn?

  8. 8 hantsy Commented @ 2009-11-12 14:10Reply to this comment

    英雄无敌,雷神之锤一直都有linux版本

  9. 9 jiqingwu Commented @ 2009-11-12 14:28Reply to this comment

    @qii:感谢你的补充。

  10. 10 walkerxk Commented @ 2009-11-12 14:53Reply to this comment

    -_-!作者穿越了?这个是好几年前的事了。 http://home.donews.com/donews/article/2/20133.html 成立于1999年初的Loki公司幸运地成为了第一个吃螃蟹的人,两年多来它已经把数十款畅销电脑游戏从 Windows平台搬上了Linux平台——《文明:权倾天下》、《神话2:勾魂使者》、《铁路大亨2》、《雷神之锤3竞技场》、《英雄无敌3》、《模拟城市3000》、《军事冒险家》、《天旋地转3》、《文明:半人马座》、《虚幻竞技场》、《北欧神符》、《部落2》……每一款都堪称精品。

  11. 11 walkerxk Commented @ 2009-11-12 14:55Reply to this comment

    还有这里也有很多,都是原生的,不是wine:http://zh.wikipedia.org/wiki/Category:Linux%E9%81%8A%E6%88%B2

  12. 12 hmy Commented @ 2009-11-12 15:05Reply to this comment

    h3爱好者挺多,有混gamerhome的吗?

  13. 13 三翻领 Commented @ 2009-11-12 16:13Reply to this comment

    关心是否有随机地图,以及x86_64的支持。 这个游戏gentoo的portage一直就有,不过对x86架构一致屏蔽。

  14. 14 bamanzi Commented @ 2009-11-12 16:35Reply to this comment

    有点火星哈,连3DO都倒了好多年了,不过lz的探索精神值得肯定。6年前我试wine上跑h3还出现花屏、无声、崩溃等问题,但三年前跑wog都基本没问题了

  15. 15 黑日白月 Commented @ 2009-11-12 19:27Reply to this comment

    @foolz:

    Since you can read this article, I suppose you can read Chinese.

    很多跨平台的游戏是通过 SDL 实现的,在 Linux 平台上运行的时候最好使用系统自带的 SDL 库,否则会出现声音不正常的现象,比如无冬之夜。

    对于无冬之夜来言,可以编辑游戏的运行脚本,将游戏自带的 SDL 运行库从库文件变量中移除,如下所示:

    If you do not wish to use the SDL library included in the package, remove

    ./lib from LDLIBRARYPATH

    export LDLIBRARYPATH=./miles:$LDLIBRARYPATH

    希望这个思路对英雄无敌3有声音问题的童鞋有用……

  16. 16 Yeqin_Su Commented @ 2009-11-12 20:27Reply to this comment

    谢谢LZ,很好很强大……

  17. 17 zerg Commented @ 2009-11-12 21:03Reply to this comment

    安装不用sudo好意点,装自己家目录,声音独占似乎,全屏其实不好,现在的显示器分辨率那么高

  18. 18 macaulish Commented @ 2009-11-13 8:22Reply to this comment

    那个文件下还有doom3呢