CheatMaker 论坛

注册

 

发新话题 回复该主题

[ZT]如何译制VBA/VBA-M(Windows/MFC) [复制链接]

1#
原帖地址
vba-m.com/forum/Thread-tutorial-how-to-create-a-translation

How to create a translation for VBA/VBA-M (Windows/MFC)
by spacy51

This tutorial uses Visual Studio/C++, but I am pretty sure it is also possible to do this with mingw and a resource file editor or just notepad.
This will also work with the free Express Edition of Visual C++, but you do not get the visual resource file editor with it, so you have to use an external editor or just Notepad to do the translating. However, compiling should work fine.

Get to the source code of the VBA version you want to create a translation for.
The only file you need is "src\win32\VBA.rc". This file contains all strings, dialogs and the menu.
You should remove all lines with "res\VBA.rc2" in it, because the file is empty anyway.

Now open the Visual Studio IDE.

File -> New -> Project -> Win32 -> Win32 Project -> DLL (leave settings at default) -> Finish

A DLL project has been created with an almost empty DllMain entry function. We do not have to modify this in any way, it should just be there so the compiler does not complain.

Right click on the project file or the "Resource Files" folder and select "Add -> Existing Item".
Browse to the place where you saved "VBA.rc" and click on the "Add" button.

Voilà, "almost" done.
The project should compile from now on. Either press F7 or use the "Build" menu.

You can finally translate all the stuff in "VBA.rc" to your desired language, you can even rearrange/resize the dialogs etc. if you want. Please do not delete anything!


In order to use your language DLL, you have to rename it to "vba_XXX.dll", where xxx is the 3 charachter language code, and place it to the same folder where the "VisualBoyAdvance.exe" is located.
Open VBA-M and go to "Options -> Emulator -> UI Language -> Other" and enter the 3 character language code. The translation should be applied instantly and VBA does remember it when closed & reloaded.




Btw, this way it is probably possible to circumvent the resource hacking protection of VBA-M

-------------------------------------------------------------------------------------------------------------------------------

如何译制VBA/VBA-M (Windows/MFC)

本教程使用的是Visual Studio/C++,但我确信用MinGW和一个资源文件编辑器或者干脆就一个记事本,也能完成。
译制工作用免费的Express Edition of Visual C++亦可完成。但是Express版并没有资源文件编辑器(visual resource file editor)。所以你得用个外部的编辑器或者就是用记事本来做翻译。不管怎样,编译都没有问题。

拿到你要翻译的VBA版本对应的源代码。你需要的仅仅是"src\win32\VBA.rc"。该文件包含了所有的字符串,对话框和菜单。移除所有包含"res\VBA.rc2"的行,因为这个文件其实是空的。

现在打开Visual Studio IDE

文件 -> 新建 -> 工程 -> Win32 -> Win32 工程 -> DLL (使用默认设置) -> 完成

这样,包含一个几乎全空的DllMain入口函数的DLL动态连接库工程就建好了。我们就把这建好的文件放着,一丁点儿都不用修改,免得编译器“犯冲”。

右击工程文件或者在“资源文件”文件夹内右击“添加 -> 已有项目”。浏览打开你保存"VBA.rc"的地方然后点击“添加”按钮


好啦,“几乎”完工。
现在该编译工程了。按F7键或者使用“编译(Build)”菜单。

你可以彻底地把"VBA.rc"里的东西都译成你需要的语言。只要你想,你甚至可以重排对话框等的位置和尺寸。只是别删除任何东西。

要使用你自己的语言DLL库,你需要重命名其为"vba_XXX.dll",这里xxx是3位语言码。把改好的文件和"VisualBoyAdvance.exe" 放到同一个文件夹下。
打开 VBA-M 然后打开“选项 -> 模拟器 -> 界面语言 -> 其它” 然后输入3位语言码。译文立即生效。VBA在关闭或重载时会记住这个设置。

另外,用这个方法就跳过了“破解VBA-M资源文件”来翻译软件了。
分享 转发
我来人间一趟 奔着自由与光
TOP
2#

不用那么麻烦,像sdl passolo这类汉化软件都支持直接从exe中导出dll资源,不用编译源代码
我原来做vba汉化文件也是看的这篇,一看还要编译,就直接问了khiav,用passolo很轻松就搞定了
TOP
发新话题 回复该主题