Destiny of an Emperor Hacking Notes

Discussion of other Three Kingdoms games (e.g. Destiny of an Emperor and Dynasty Tactics) and other games by Koei (e.g. Samurai Warriors).

Destiny of an Emperor Hacking Notes

Unread postby James » Mon Feb 09, 2009 7:05 am

A number of people have taken interest in hacking Destiny of an Emperor ever since the original projects were started more than a year ago. Unfortunately, while quite a bit of information is available online, it is rather poorly organized, and only some of it has been documented in a user-friendly way. In an effort to make life a little easier for people I'm creating this thread. If you have actual information on how to edit something in the game, or something related to modding DoaE, you're welcome to post it in this thread for future reference.
Kongming’s Archives – Romance of the Three Kingdoms Novel, History and Games
“ They who can give up essential liberty to obtain a little temporary safety, deserve neither liberty nor safety.”
  — Ben Franklin
User avatar
James
Sausaged Fish
Sausaged Fish
 
Posts: 17954
Joined: Fri Jun 14, 2002 3:21 pm
Location: Happy Valley, UT

Re: Destiny of an Emperor Hacking Notes

Unread postby James » Mon Feb 09, 2009 7:13 am

The Sought-After An Sha Flag, Finally Revealed!
When An Sha is used a series of checks are initiated to determine if it is successful or not. In one of those checks the game references an eight-entry array located at 3BC5D to see if the targeted officer is immune to An Sha. In English, up to eight officers can be specified as An Sha-immune. In the original ROM those values are 57 71 88 00 00 00 00 00 with 57 being Sun Quan, 71 being Cao Pi, and 88 being Sima Yi. To add new officers simply enter their location value in place of a '00' entry. The first three entries can also be altered.

Officer Location Values

Here is the location of the An Sha flag in the ROM:
Image

Many thanks to MeteorStrike for outlining the game mechanics behind this!
Kongming’s Archives – Romance of the Three Kingdoms Novel, History and Games
“ They who can give up essential liberty to obtain a little temporary safety, deserve neither liberty nor safety.”
  — Ben Franklin
User avatar
James
Sausaged Fish
Sausaged Fish
 
Posts: 17954
Joined: Fri Jun 14, 2002 3:21 pm
Location: Happy Valley, UT

Re: Destiny of an Emperor Hacking Notes

Unread postby Lordyuanshu » Mon Feb 09, 2009 2:26 pm

Wow Meteorstrike at Gamefaqs knows some stuff :) It'd be nice if he found a way to do ambushes whenever
User avatar
Lordyuanshu
Scholar of Shen Zhou
 
Posts: 1325
Joined: Wed Dec 28, 2005 8:08 am
Location: Walkthrough FAQ Guides

Re: Destiny of an Emperor Hacking Notes

Unread postby Niahak » Tue Feb 10, 2009 12:01 am

That's awesome. The only other thing I can think of offhand that we need to know about is terrain (i.e. how maps/towns are laid out).

In case anyone is curious, here's basically how you could go about changing the length of an entry in a "dictionary" - the system used to compress text.

Say you have four entries - Xuzhou, Chengdu, Luoyang and Jianye.

The hex might look something like:

Code: Select all
DEE5EDF5FC000000
0000000000000000

Code: Select all
8A8A8A8A8A000000
0000000000000000

Further down, you might see (text translation for clarity)
Code: Select all
[FF]Xuzhou[FF]Chengdu[FF]
Luoyang[FF]Jianye[FF]


The first set is the local pointer and the second set is the "page" pointer, which increments if the local pointer would overflow. To get the location the ROM uses, you use the page pointer, then the local pointer.

Here we would see that "Xuzhou" starts at 8ADE, and that Chengdu starts at 8AE5, which is seven bytes later (E5 - DE = 7). That seven bytes is "Xuzhou" plus the [FF] which follows it.

If it's any help, Windows Calculator has an "F5" shortcut to switch to hex, and "F6" for decimal. It really made a difference to me.

So say you want a really long city name in place of Xuzhou. Let's say "Xuzhou, Castle of the True Wei". Let's also assume you have space for it below the other entries.

Notepad++ tells me that is 30 characters, or 24 characters in addition to what was used for Xuzhou. So we'll be adding 24 to all of our pointers after Xuzhou (, Domain of the Followers...). To easily add the hex together, convert the 24 to hex (so you can leave your calculator in hex mode) - this is 0x18.

We'll increase every pointer after the starting point of your string, so here we would start at the second pointer. If a local pointer rolls over in the addition (goes past FF), we increment the page pointer. The result would be

Code: Select all
ABFD050D14000000
0000000000000000

Code: Select all
8A8A8B8B8B000000
0000000000000000


You would of course want to change the actual entries to (text translation for clarity)
Code: Select all
[FF]Xuzhou, Castle
of the True Wei[FF]
Chengdu[FF]Luoyang[FF]
Jianye[FF]
User avatar
Niahak
Scholar
 
Posts: 359
Joined: Sun Apr 17, 2005 5:19 pm
Location: Taking bytes out of DoaE

Re: Destiny of an Emperor Hacking Notes

Unread postby Kong Zi » Tue Feb 10, 2009 5:46 am

I'm afraid it's difficult for me to understand, Niahak :cry:

I must be read it carefully .
Kong Zi
Apprentice
 
Posts: 37
Joined: Tue Nov 25, 2008 6:39 am

Re: Destiny of an Emperor Hacking Notes

Unread postby James » Tue Feb 10, 2009 6:13 am

The No-Billeting-For-You Flag, Finally Revealed!
When you attempt to place an officer in billeting the game references an array of up to seven possible officers who cannot be stored away. This array is located at 39580 and by default contains the values A8 A9 AA AC AD BC D5 (see below to see which officer is referenced by each entry). To remove an officer simply set their entry to '00'. To add a new officer, simply enter their location value (see below) over one of the eight available slots. Please note that there are different scripts for officers which may not be removed from your party. I haven't tested it yet, but scripts are probably tied to specific entries in the array.

By default the following officers cannot be removed:

Code: Select all
A8 = Liu Bei
A9 = Guan Yu
AA = Zhang Fei
AC = Guan Xing
AD = Zhang Bao
BC = Lu Bu
D5 = Zhu Ge Liang

Officer Location Values

Here is the location of the Billeting flag in the ROM:
Image

Many thanks to MeteorStrike for outlining the game mechanics behind this!

Image
Cao Pi, in the Destiny of an Emperor 2.0 Cao Cao Edition, is altered so he cannot be placed into billeting using the information above. His role is that of Liu Feng in the original Destiny of an Emperor.
Kongming’s Archives – Romance of the Three Kingdoms Novel, History and Games
“ They who can give up essential liberty to obtain a little temporary safety, deserve neither liberty nor safety.”
  — Ben Franklin
User avatar
James
Sausaged Fish
Sausaged Fish
 
Posts: 17954
Joined: Fri Jun 14, 2002 3:21 pm
Location: Happy Valley, UT

Re: Destiny of an Emperor Hacking Notes

Unread postby Niahak » Wed Feb 11, 2009 5:24 am

James wrote:The No-Billeting-For-You Flag, Finally Revealed!
I haven't tested it yet, but scripts are probably tied to specific entries in the array.


Any chance you could check into that? I was working on DoaEd earlier to add the An Sha flag (Unanshaable!), and I'd like to get the Billeting flag into the next release as well. I'd like to know how I should arrange things for the billeting flag.
User avatar
Niahak
Scholar
 
Posts: 359
Joined: Sun Apr 17, 2005 5:19 pm
Location: Taking bytes out of DoaE

Re: Destiny of an Emperor Hacking Notes

Unread postby James » Wed Feb 11, 2009 6:36 am

Niahak wrote:Any chance you could check into that? I was working on DoaEd earlier to add the An Sha flag (Unanshaable!), and I'd like to get the Billeting flag into the next release as well. I'd like to know how I should arrange things for the billeting flag.

Okay, I just checked. Every single slot gets the generic

Code: Select all
[T-VALUE]is
still young and
he shows a great[>]
deal of talent.
Don't give up on
him so easily.[END]

script, including Liu Bei.

For kicks and giggles I made all officers removable to see what the game would do if I tried to pitch all of them into billeting, and this is what I got:

Image

P.S. Feature request for the text editor: the number of bytes remaining in each section of the ROM. :)
Kongming’s Archives – Romance of the Three Kingdoms Novel, History and Games
“ They who can give up essential liberty to obtain a little temporary safety, deserve neither liberty nor safety.”
  — Ben Franklin
User avatar
James
Sausaged Fish
Sausaged Fish
 
Posts: 17954
Joined: Fri Jun 14, 2002 3:21 pm
Location: Happy Valley, UT

Re: Destiny of an Emperor Hacking Notes

Unread postby Tarrot » Wed Feb 11, 2009 8:40 am

I am actually shocked the programmers had enough forsight to put that in there even though theoretically it would've been impossible (although I'm not sure if in the period after Guan Yu and Zhang Fei leave your party that you could theoretically check billeting before Zhuge Liang was put back into your party).
Tarrot
Scholar of Shen Zhou
 
Posts: 1099
Joined: Mon Aug 30, 2004 4:35 am

Re: Destiny of an Emperor Hacking Notes

Unread postby Lordyuanshu » Wed Feb 11, 2009 2:22 pm

No, Zhu Ge Liang is forced into your party going into the Shu area - you can't get in if he's not in. Then he never leaves after that so the best you can do is just have Zhu Ge Liang.
User avatar
Lordyuanshu
Scholar of Shen Zhou
 
Posts: 1325
Joined: Wed Dec 28, 2005 8:08 am
Location: Walkthrough FAQ Guides

Next

Return to Other Three Kingdoms and Koei Games

Who is online

Users browsing this forum: No registered users and 2 guests

Copyright © 2002–2008 Kongming’s Archives. All Rights Reserved