Home › Forums › Destiny of an Emperor › Destiny of an Emperor RH Guide ( MOVED! to http://doaerhguide.wikidot.com )
Tagged: Battles, Destiny of an Editor, Destiny of an Emperor, Destiny of an Emperor hacking, Destiny of an Emperor Mods, Destiny of an Emperor Rom, DoaE rom, DoaE Rom hacking, FCEUX, Feidian, Graphics, hacking DoaE, Map, NES ROM hacking, nes8 template, Portraits, ROM Hacking, ROM hacking information
- This topic has 985 replies, 17 voices, and was last updated 2 years, 11 months ago by
MiDKnighT.
-
AuthorPosts
-
November 1, 2011 at 6:54 pm #39625
ludmeister
ParticipantI've used Gui Huan a few times… it's occasionally useful, but nothing a Gullwing can't cover. Besides, Gullwings are 100% efficient, and Gui Huan seems dependent on the user's Int vs. the enemy leader.
In my mod I made Tui Lu (Escape) the first mobility tactic you learn, and Gui Huan (Return) didn't come nearly as late in the game. They were learned only by higher Intelligence generals, and IIRC were replaced in the late game.
In other words, I believe those tactics are definitely replaceable.
When all else fails... manipulate the source code.
November 2, 2011 at 1:52 am #39626ludmeister
ParticipantLet's see if I can explain how to show Agility similar to the way my mod does on the Officer status screen. I'm having a bit of trouble following my notation… bleargh. I wasn't as thorough about taking notes about hex code as I am currently learning to be.
Now, it's important to note that this officer screen is used for ally and enemy alike. Officer stats are stored in memory in groups of twelve… the first 7 are Liu Bei's Army, and the final 5 are your enemy's. The final 5 slots are obviously invalid outside of battle. This will become important later.
@ 0x3ea4a- Status screen stat output strings
222321 0a0a f87785fb (STR__…)
181d23 0a0a f87785fb (INT__…)
10631f 0a0a f87785fb (A.P__…)
106312 0a0a f87785fb (A.C__…)
0d86 f87785fe (T.P__…) <- Trust me. This was friggin' annoying to ferret out.
The "860d" bit is actually a pointer to the function to display stuff. Go figure. So we'll have to dig for the actual "T.P" string.
According to my notes, to change T.P to AGI:
The pointers to the memory locations which display the various values on the status screen are located in the ROM @ 0x385ff-0x38608. They read:
9ca8f9b4fb 6161856061
The first group are the first bytes, the second group reference the second bytes of the pointers. So…
STR pointer= 619c
INT pointer= 61a8
A.P pointer= 85f9
A.C pointer= 60b4
"T.P" pointer= 61fb
Agility is found in memory @0x61b4, so instead edit 0x38603 from "fb" -> "b4", which will swap it for T.P.
T.P is not stored in memory as a part of an officer's data, and is custom calculated for the status screen. This can be gleaned from the following code:
0e:8579 (0x38589) B9 EF 85 LDA $85EF,Y @ $85EF = $9C (1st pointer byte)
0e:857c (0x3858c) 85 18 STA $0018
0e:857e (0x3858e) B9 F4 85 LDA $85F4,Y @ $85F4 = $61 (2nd pointer byte)
0e:8581 (0x38591) 85 19 STA $0019
0e:8583 (0x38593) A4 4A LDY $004A (# of general in list, 00 is 1st, 06 is player's last, 07-0b are enemies)
0e:8585 (0x38595) A5 54 LDA $0054 (Status screen value… 00 = STR, 01 = INT, etc.)
0e:8587 (0x38597) C9 02 CMP #$02 (Is it A.P?)
0e:8589 (0x38599) D0 07 BNE $8592
0e:858b (0x3859b) B9 C0 60 LDA $60C0,Y @ $60C0 … (Get general's Weapon ID)
0e:858e (0x3859e) A8 TAY
0e:858f (0x3859f) 4C 9F 85 JMP $859F
0e:8592 (0x385a2) C9 04 CMP #$04 (Is it T.P?)
0e:8594 (0x385a4) D0 09 BNE $859F (if not, don't bother getting general ID)
0e:8596 (0x385a6) A0 00 LDY #$00
0e:8598 (0x385a8) A5 4A LDA $004A (# of general in list)
0e:859a (0x385aa) C9 07 CMP #$07 (Compare # with 1st foe in list)
0e:859c (0x385ac) 90 01 BCC $859F
0e:859e (0x385ae) C8 INY
0e:859f (0x385af) E6 6E … Determines value based on the gleaned info
Of this code, if we are swapping Agi for T.P, the only change needed is 0x385a3: "04" -> "05". Agility is a general-based stat, and does not need to be custom calculated.
The string "T.P" is actually outputted programmatically:
0e:860d (0x3861d) A9 23 LDA $23 "T"
0e:860f (0x3861f) 9D 18 03 STA $0318,X @ $0348
0e:8612 (0x38622) A9 63 LDA $63 "."
0e:8614 (0x38624) 9D 19 03 STA $0319,X @ $0349
0e:8617 (0x38627) A9 1F LDA $1F "P"
0e:8619 (0x38629) 9D 1A 03 STA $031A,X @ $034A
You could change this, therefore, by changing:
0x3861e: "23" -> "10"
0x38623: "63" -> "36"
0x38628: "1f" -> "38"
This post is getting long, so I'll post part two separately. Because it's a mess to look at all that code, I'll also provide a nitty-gritty post which says "change this to that".
The rest is coming very soon…
When all else fails... manipulate the source code.
November 2, 2011 at 2:12 am #39627sonic.penguin
ModeratorAh good, I can see how displaying agility would be more important than TP in some instances, not like I can stand there looking at each officers AGI to determine if theyre going to go a turn before me or not. Anyways I digress.
Jie Ce/Negate would be a good replacement to Gui Han. It might make the game slighty more annoying however as enemies will constantly cancel out your Bei Ji/Zeal. Substituting it for something like Li Jian/Mislead might be a little too imbalancing in conjunction with Ji Mian or Ce Mian.
If editing Agi is anything like AP it might be slightly annoying as we had to hash out how the displayed values dont match the actual AP values in terms of damage, or even the critical hits was a toughy to crack.
Slicing it down to:
this is the Hex Address XXXXX change it to YY
does make things easier around here for those of us with short attention spans (points fingers all around!) Although some of us really like to know the nitty-gritty on details as well
Quote:You could change this, therefore, by changing:0x3861e: "23" -> "13"
0x38623: "63" -> "14"
0x38628: "1f" -> "15"
This changes the TP to DEF, woulndt AGI be more appropriate? J/w.
Other than that, got it working already perfectly :)
November 2, 2011 at 2:37 am #39628ludmeister
ParticipantPart 2: Billeting output
The above edits did not matter when inspecting a billeted officer! Grumble. Well… billeted officers are never equipped, so…
Are we back to the drawing board? No! We forge bravely ahead ;-)
When we look at a billeted general, his stats actually get placed in the 8th general's place (1st enemy!) Before we get here, Y already has the General ID we are looking up. Here's the code:
0e:936a (0x3937a) A9 00 LDA #$00
0e:936c (0x3937c) 20 C8 E3 JSR $E3C8 Get Strength
0e:936f (0x3937f) 8D A3 61 STA $61A3
0e:9372 (0x39382) AC AF 60 LDY $60AF Y = General ID
0e:9375 (0x39385) A9 01 LDA #$01
0e:9377 (0x39387) 20 C8 E3 JSR $E3C8 Get Intellect
0e:937a (0x3938a) 8D AF 61 STA $61AF
0e:937d (0x3938d) A9 00 LDA #$00
0e:937f (0x3938f) 8D C7 60 STA $60C7
0e:9382 (0x39392) 8D BB 60 STA $60BB
0e:9385 (0x39395) 8D FB 61 STA $61FB These are not important to zero out… they contain TP info which we will not show
0e:9388 (0x39398) 8D FC 61 STA $61FC
0e:938b (0x3939b) 8D FD 61 STA $61FD
…
So we can rewrite this little script, like so:
0e:936a (0x3937a) A9 00 LDA #$00
0e:936c (0x3937c) 8D BB 60 STA $60BB Important to zero out
0e:936f (0x3937f) 8D C7 60 STA $60C7 Ditto
0e:9372 (0x39382) 20 C8 E3 JSR $E3C8 Get Strength
0e:9375 (0x39385) 8D A3 61 STA $61A3
0e:9378 (0x39388) AC AF 60 LDY $60AF Y = General ID
0e:937b (0x3938b) A9 01 LDA #$01
0e:937d (0x3938d) 20 C8 E3 JSR $E3C8 Get Intellect
0e:9380 (0x39390) 8D AF 61 STA $61AF
0e:9383 (0x39393) AC AF 60 LDY $60AF Y = General ID again
0e:9386 (0x39396) A9 09 LDA #$09
0e:9388 (0x39398) 20 C8 E3 JSR $E3C8 Get Agility
0e:938b (0x3939b) 8D BB 61 STA $61BB
…
In other words, we change 0x3937a-0x3939c from
"A90020C8E38DA361ACAF60A90120C8E38DAF61A9008DC7608DBB608DFB618DFC618DFD"
to
"A9008DBB608DC76020C8E38DA361ACAF60A90120C8E38DAF61ACAF60A90920C8E38DBB"
And there we have it.
When all else fails... manipulate the source code.
November 2, 2011 at 2:38 am #39629ludmeister
ParticipantAh, sonic.penguin, you are correct. My apologies. It would be 10, 36, 38. Edited above.
When all else fails... manipulate the source code.
November 2, 2011 at 2:42 am #39630ludmeister
ParticipantT.P to AGI.
This is the quick and dirty How-to.
0x38603: "fb" -> "b4"
0x385a3: "04" -> "05"
0x3861e: "23" -> "10"
0x38623: "63" -> "36"
0x38628: "1f" -> "38"
0x3937a-0x3939c: "A90020C8E38DA361ACAF60A90120C8E38DAF61A9008DC7608DBB608DFB618DFC618DFD" ->
"A9008DBB608DC76020C8E38DA361ACAF60A90120C8E38DAF61ACAF60A90920C8E38DBB"
If anything is wrong, please let me know, so I can make it right.
When all else fails... manipulate the source code.
November 2, 2011 at 3:34 am #39631Lord Yuan Shu
KeymasterQuote:T.P to AGI.This is the quick and dirty How-to.
0x38603: "fb" -> "b4"
0x385a3: "04" -> "05"
0x3861e: "23" -> "10"
0x38623: "63" -> "36"
0x38628: "1f" -> "38"
0x3937a-0x3939c: "A90020C8E38DA361ACAF60A90120C8E38DAF61A9008DC7608DBB608DFB618DFC618DFD" ->
"A9008DBB608DC76020C8E38DA361ACAF60A90120C8E38DAF61ACAF60A90920C8E38DBB"
If anything is wrong, please let me know, so I can make it right.
Tried it out, worked good. It's a nice addition. Wish it was directly under INT so they were all three in a row like Doae 2 but that's nit-picking huohu .
But when testing I found out that adding the portraits broke my rom. When I recruit Huang Shao and then go to General – Huang Shao, the game freezes. Same thing if I use him in battle and it gets to his turn. So, something to do with his portrait. All I did was load d21.bmp, d22.bmp and d23.bmp to the first three open banks.
So maybe I'll try different portraits or a different bank, we'll see.
Welcome to Lord Yuan Shu Walkthrough Guides ·
Huo Hu's Adventure started Destiny of an Emperor hackingNovember 2, 2011 at 4:22 am #39632ludmeister
ParticipantLord Yuan Shu,
To change up the order of the Status screen, you could change up the order of the pointers
in 0x385ff-0x38608, edit the text in 0x3ea4a and following, and finally, edit 0x3861e, 0x38623 and 0x38628 to whatever three characters you wanted your last string to be. Hence why I had "Def" as those three characters which sonic.penguin astutely caught me on :-)
When all else fails... manipulate the source code.
November 2, 2011 at 6:01 am #39633Lord Yuan Shu
KeymasterSounds good man.
….
Quote:But when testing I found out that adding the portraits broke my rom. When I recruit Huang Shao and then go to General – Huang Shao, the game freezes. Same thing if I use him in battle and it gets to his turn. So, something to do with his portrait. All I did was load d21.bmp, d22.bmp and d23.bmp to the first three open banks.Man this shit is weird. So this happened, the rom broke and I started over with a rom that I had just expanded. This time I use Feidian to load up a bunch of different strips in MiDKnighT's folder, and the same thing happens! I go to check Huang Shao (Mi Zhe's spot in Xu Zhou) and then when I go General – Mi Zhu the game wigs out because of his portrait.
Wonder if the loading of portraits in banks is fucking up the pointers in some way. Not sure what's going on. Might try to expand a rom MiDKnighT's way and then see if I can load portraits and have no problem.
Welcome to Lord Yuan Shu Walkthrough Guides ·
Huo Hu's Adventure started Destiny of an Emperor hackingNovember 2, 2011 at 12:01 pm #39634sonic.penguin
ModeratorQuote:0x3861e: "23" -> "10"0x38623: "63" -> "36"
0x38628: "1f" -> "38"
Changing these to
10
16
18
will make it AGI.
23
36
38
will make it A.i
November 2, 2011 at 12:08 pm #39635MiDKnighT
ModeratorGuys I think I know what's going on with your portraits. The slot in the general's definition that I'm using for the "bank" number already had values there originally. I had set all of mine to zero in my ROM before adding the new stuff. My code was branching if the value was over 80. Your "old" value is probably still there causing it to branch to the new portrait bank code and is trying to use a portrait bank that doesn't exist. There are two options to fix this:
1. DoaEditor could zero out the portrait bank value if it is not F1, F3, F5, F7, etc…
or
2. I can change the portrait code to be more restrictive…Ie…only branch if it's F1 or above. But there still may be a couple of outliers in this case.
Let me fix the portrait code. I'll get that done today.
November 2, 2011 at 12:09 pm #39636MiDKnighT
ModeratorRe: ludmeister – It's so nice to have another assembly guy here figuring stuff out! Not that I'm an assembly guy. I just learned some of this stuff in the last few weeks.
November 2, 2011 at 12:37 pm #39637MiDKnighT
ModeratorPortrait code updated to only use new banks if unknown value is F1 or above (instead of 80).
November 2, 2011 at 12:42 pm #39638sonic.penguin
ModeratorQuote:Portrait code updated to only use new banks if unknown value is F1 or above (instead of 80).Good idea, will prevent a lot of wierd crashes hopefully
November 2, 2011 at 12:50 pm #39639MiDKnighT
ModeratorQuote:Tried it out, worked good. It's a nice addition. Wish it was directly under INT so they were all three in a row like Doae 2 but that's nit-pickingThat would be nice. I think with what lud posted we should have enough info to do it. It just might be a headache to figure it all out as he alluded to.
-
AuthorPosts
- You must be logged in to reply to this topic.

