No description
  • Assembly 90.1%
  • C 8.9%
  • C++ 0.6%
  • Python 0.2%
  • Makefile 0.1%
Find a file
Repository files (latest commit first)
Filename Latest commit message Latest commit date
Iru Cai f4a1e13b75 sync rich4_asm
This includes the relocation fix of rich4_ui_bank.asm
and rich4_monthly_settlement.asm.
2026-10-24 21:18:02 +08:00
asm sync rich4_asm 2026-10-24 21:18:02 +08:00
csrc implement an mkf viewer with Qt6 C++ 2026-07-25 21:14:39 +08:00
docs update player_info and map docs 2026-07-26 19:42:07 +08:00
r2 add assembly dump of rich4.exe 2021-05-10 19:56:00 +08:00
tools add rich4_asm sync script 2026-10-23 14:23:34 +08:00
.gitignore gitignore: add *.obj *.exe 2021-05-11 21:05:37 +08:00
COPYING LICENSE 2018-09-24 10:56:27 +08:00
readme.rst related work 2026-10-08 10:06:42 +08:00

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

大富翁4逆向
===========

本项目为大富翁4的逆向项目。所逆向的大富翁4版本为v3.11版本,rich4.exe 文件信息如下:

- 大小:588KiB
- SHA256: 5a90aee28ee5f7a5c3ba5cb935c9e55751a529c25fcd91208748a66293569550

本逆向项目从2018年开始,做了3个月的逆向,发现了大富翁4的数据文件解压算法、存档格式等有用的信息,但是由于时间关系,没能继续此项目。在2021年5月,我采用逐步修改程序的思路进行逆向,用 `r2dumpbin <https://github.com/mytbk/r2dumpbin>`__ 将 rich4.exe 转为汇编,使得逆向,修改,测试可以同步进行,提高逆向效率。

在2025年5月,我建立了 `rich4_asm <https://codeberg.org/vimacs/rich4_asm>`__ 项目,对大富翁4的反汇编进行注释,并且尝试拆分该反汇编文件。到了7月,通过对照 Watcom 编译器的代码,我已经把大富翁4的反汇编文件里用到的C库和运行时都剥离了出来,从而可以改用 MinGW 和 msvcrt 运行时库链接出可用的 rich4.exe.

参与项目
-----------

本 GitHub 项目用于接收 issue 和 pull request 和进行项目管理。

可以加入 Matrix 聊天室 #rich4re:matrixim.cc 进行讨论。

项目文件
--------

* csrc: 逆向后的C代码
* asm: rich4.exe 的反汇编,并将部分汇编代码替换为C代码,可以编译并链接生成可用的程序
* docs: 相关文档

如果需要阅读 r2dumpbin 转出来的反汇编代码,以及带注释的反汇编,可以见 `rich4_asm <https://codeberg.org/vimacs/rich4_asm>`__ 版本库。

构建
-------

本项目在 Arch Linux 下开发,使用 MinGW 工具链和 nasm 汇编器,可以执行 ``pacman -S mingw-w64 nasm`` 安装。

构建 rich4_mscrt.exe::

  cd asm
  make

将 rich4_mscrt.exe 复制到大富翁4的游戏目录,用 wine 运行即可启动游戏。

相关工作
--------------------

目前已有大富翁4的引擎重建工程,见 `Issue #6 <https://github.com/mytbk/rich4/issues/6>`__ 的讨论:

- https://github.com/lhr0909/richman4-remastered
- https://github.com/tytannial/rich4-re

以及大富翁4的资源编辑工具,见 `Discussion #7 <https://github.com/mytbk/rich4/discussions/7>`__:

- https://github.com/aecq/rich4/tree/public/mkf-fun/csrc/mkf/functional


类似工作
--------------------

以下是类似的游戏逆向工作,这些工作都是将游戏程序还原为源码,并且能构建出完全相同的文件。大富翁4逆向工程不能还原出和原程序完全相同的二进制,其目标是还原出功能等价的可读源码。

- https://blog.asie.pl/2020/08/reconstructing-zzt/
- https://www.reddit.com/r/ReverseEngineering/comments/xqi5e6/reconstructed_source_code_of_the_game_duke_nukem/
- https://github.com/pret/pokeemerald