The unofficial RoTK2 GameGenie/PAR codes topic!!

You're browsing the GameFAQs Message Boards as a guest. Sign Up for free (or Log In if you already have an account) to be able to post messages, change how messages are displayed, and view media in posts.
  1. Boards
  2. Romance of the Three Kingdoms II
  3. The unofficial RoTK2 GameGenie/PAR codes topic!!

User Info: darkmoon2321

darkmoon2321
3 years ago#1
So I figure this should go in its own topic, since there is quite a bit of information. I will post what I know at the moment, and I'll try to respond with specific codes if there is something that you would like to see. I'll start with the RAM addresses and try to explain what they mean. For these, you can easily generate codes to modify these values:

7EE005 Change scenario number (Scenario 1 is 00, Scenario 2 is 01, etc).
7EE006 Lower byte for the year
7EE007 Upper byte for the year (you can actually change the year to modern times if you want)
7EE008 Holds the month (0=January)

Officer data is stored from 7EE04C to 7EF203. Each officer has a sequence of 21 bytes (x15 hex). So 7EE04C is the start of officer 1, 7EE061 is officer 2, 7EE076 is officer 3, etc). For Example, Zhang Xiu's stats in scenario 1:
7EE54D 00 lower byte of next officer's RAM address (ex, if you have E061, we get stats of the officer whose data starts in 7EE061. That officer is considered to be in same city.)
7EE54E 00 upper byte of next officer's RAM address
7EE54F 00 Lowest bit holds done/not done status. 2nd bit holds whether hidden or not.
7EE550 00 holds 80 if you give the officer an item.
7EE551 32 Int
7EE552 4B War
7EE553 4B Chm
7EE554 08 Used to identify ruler (Dong Zhuo is ruler #8)
7EE555 4C Loyalty (FF if they are their own ruler)
7EE556 01 Years of service (FF if they are their own ruler)
7EE557 FF Holds true ruler number if an officer is in hiding, otherwise FF
7EE558 FF unknown, changes when an officer goes into hiding.
7EE559 0A Number of soldiers (this value subtracts from Arms)
7EE55A 00 Upper byte of number of soldiers (in battle value actually multiplied by 100)
7EE55B 64 Used for calculating amount of Arms. (divide by number of soldiers)
7EE55C 00 Upper byte for calculating amount of Arms.
7EE55D 43 Soldier training level.
7EE55E 00 unknown
7EE55F 00 unknown (changes to FF when killed)
7EE560 92 This is officers ID#. Changing it changes portrait and age (FF when dead)
7EE561 00 Upper byte of officer ID# (FF when dead)

Province data is stored from 7EF424 to 7EF824. Each province has 25 bytes of data. Starting at 7EF424, add x19 to move to next city. For example, province 10:
7EF505 37 Lower byte of next city in ruler's control (0000 for the last city in the sequence)
7EF506 F5 Upper byte of next city in ruler's control (ex, this points to 7EF537 [province 12])
7EF507 12 Lower byte of city's governor (at 7EE412 here)
7EF508 E4 Upper byte of city's governor
7EF509 00 Lower byte of an unclaimed officer in the city's RAM address (this slot is only filled after you discover them)
7EF50A 00 Upper byte of an unclaimed officer in the city's RAM address
7EF50B BA Lower byte of another free officer in the city (this slot already holds the hidden officer's address)
7EF50C E4 Upper byte for another free officer in the city (this slot becomes zero after you discover the officer)
7EF50D E8 Gold, lower byte
7EF50E 03 Gold, upper byte
7EF50F F4 Rice, lower byte
7EF510 01 Rice, upper byte
7EF511 40 Population, lower byte
7EF512 1F Population, upper byte
7EF513 08 (Ruler ID#. Changing this alone does not give you full control of the city).
7EF514 FF Unknown.
7EF515 80 (Different bits have different affects. Highest bit [x80] indicates turn is over. Other bits change depending on status of delegated control.
7EF516 71 Unknown. Going to war affects it, taxing the citizens affects it.
7EF517 FF Province number to send goods to (delegate command)
7EF518 FF Province number to invade (delegate command)
7EF519 Land
7EF51A PL, people's loyalty
7EF51B Flood control
7EF51C Horses
7EF51D Cost

User Info: darkmoon2321

darkmoon2321
3 years ago#2
There is also a separate batch of stats specific to rulers. Ruler stats are stored in a sequence of 34 bytes starting at RAM address 7EF204. The ruler stats end at 7EF423, and a maximum of 16 rulers are possible. You can generally find ruler numbers by looking at the alliance screen. The rulers are displayed according to their ruler number (read left to right, not up to
down). You must take into account that your own ruler is not displayed though. Since Cao Cao has ruler number 0, it's easy to find the rest if you use Cao Cao's alliance screen. Cao Cao's ruler stats in scenario 1:

7EF204 01 Lower byte of Ruler's RAM address
7EF205 E3 Upper byte of Ruler's RAM address
7EF206 EC Lower byte of Ruler's home city RAM address
7EF207 F4 Upper byte of Ruler's home city RAM address
7EF208 16 Lower byte of Advisor's RAM address
7EF209 E3 Upper byte of Advisor's RAM address
7EF20A 32 Trust rating
7EF20B 00 Unknown, gets set to 20 on your turn (21 if clan has been destroyed)
7EF20C 03 Unknown
7EF20D 08 Accepting an alliance changes this to FF, getting hit with rival tigers changes this to the ruler number that is going to be attacked.
7EF20E 00 Each bit represents an alliance (ex. 02 an alliance with ruler 2, 04 an alliance with ruler 3, 06 alliances with rulers 2 and 3, etc.)
7EF20F 00 Each bit represents an alliance
7EF210 22 Unknown
7EF211 01 Unknown
7EF212 32 Hostility to ruler 00 (self in this case)
7EF213 32 Hostility to ruler 01 (You do not see these hostilities, other rulers do)
7EF214 32 Hostility to ruler 02
7EF215 32 Hostility to ruler 03
7EF216 32 Hostility to ruler 04
7EF217 32 Hostility to ruler 05
7EF218 32 Hostility to ruler 06
7EF219 32 Hostility to ruler 07
7EF21A 32 Hostility to ruler 08
7EF21B 32 Hostility to ruler 09
7EF21C 32 Hostility to ruler 0A
7EF21D 32 Hostility to ruler 0B
7EF21E 32 Hostility to ruler 0C
7EF21F 32 Hostility to ruler 0D
7EF220 32 Hostility to ruler 0E
7EF221 32 Hostility to ruler 0F
7EF222 FF Unknown
7EF223 FF Unknown
7EF224 FF Unknown
7EF225 FF Unknown

Other codes:
7EF87E** holds the normal items remaining to be rewarded. Each bit represents an item.
7EFEA901 Code to give you a rare item after battle.
7EFC2A** Holds the outcome of battle. Which side won/lost and how (ran out of rice, etc.). 00 to 06 are valid.

08BE41D6 Always gain a normal item after battle (unless you would have gotten a rare one).

08B95789 Code to manually select a rare item
08B958** Change the ** to choose rare item.

7E8B5189 Equivalent to the codes above for selecting a rare item, but only use them right before item is awarded.
7E8B52**

04A527D6 One way of avoiding loyalty drops (A4 to promote loyalty drop instead)
04A549D6 One way of avoiding loyalty drops (A4 to promote loyalty drop instead)
04A553D6 One way of avoiding loyalty drops (A4 to promote loyalty drop instead)
04A55E6* Change the amount that loyalties will drop by *

7EACF1A4 Alliances will always succeed
04E667A4 Alternate version of above code.

User Info: darkmoon2321

darkmoon2321
3 years ago#3
In my version of the game (headerless ROM), hidden stats for officers start at x12478 (Cao Cao's data first). If you would like to convert a location in the hex to a cheat code usable in-game, the procedure is as follows:
Take the lowest three digits, and keep them for your code, so:
x12478 -> ***478
The game is HiRom, so each block of data starts at **/8000 instead of **/0000. So basically, take the highest two digits, divide by x8, and store the remainder.
(x12/x8)=x02
x12%x8=x02 (remainder)
Multiply the result of the division by x10 (which just means move the digit over, so x02 becomes x20)
Take the remainder, and add x08 to it (x08 + x02=x0A).
Add these together, and here are the top digits for your code (x20+x0A=x2A)
So the game address works out to 02A478.
A completed code would be 02A47864 to change Cao Cao's reliability/duty stat to 100.

If your ROM has a header, you will need to subtract x0200 from the hex before performing the above steps.

You might notice when looking at the codes I posted, that pretty much all the numbers you see during the course of the game start after address 7EE000. That leaves a lot of RAM addresses that haven't been explained yet. Much of these early addresses are actually used to store the game's custom opcodes and programming routines, rather than holding normal variables. This seems to be true through around 7E2000 to 7ED***. Huge chunks of data are taken straight from the ROM and pasted into these memory locations. Values closer to 7E2*** are loaded in when you start up the game, and do not really change (they contain functions that are used very often during the game). An interesting code block is from around 7E7200 up to 7ED000. When you start or exit combat, or select certain commands, the game moves a big block of data from the ROM into these memory addresses to access the script. Changing these values alters the way that the scripts run, which can lead to some very cool effects. However, it is usually better to edit the ROM directly rather than these RAM addresses, because if you forget to turn off the code, the game will likely crash the next time this region gets changed.

Next I'll post about the opcodes in the game's scripting language. I don't have all of them identified yet, and some of them sort of defy description, but I have the majority of them figured out, and certainly the most useful ones for modifying game behavior.

User Info: DragonAtma

DragonAtma
3 years ago#4
Darkmoon, keep in mind that (1) there's a whole bunch of info which assumes you use a header, and (2) the games themselves include a header. For most people, the officer info starts at 12678, not 12478. ;)

As for cheat codes:
7EF874xx changes the difficulty. By difficulty 7, even reliable people start to rebel.
7EFD02xx changes the first player's force (use while picking a force, turn off when it declars "Jan 189"). Do keep in mind that a bizarre programming overlap with New Ruler means that you normally can't select Han Fu in the vanilla game, even with this code...
My NES, SNES, and GB all work just fine. Why should I downgrade to a Wii U, PS4, or XBone?

User Info: darkmoon2321

darkmoon2321
3 years ago#5
Opcodes in the scripting language for this game:

"00"=Get stack value and store it in $0A (Take FFE9, add $04, and use that address to get value. Ignore overflow)
"01"=Get stack value and store it in $0A (Take FFEB, add $04, and use that address to get value. Ignore overflow)
"02"=Get stack value and store it in $0A (Take FFED, add $04, and use that address to get value. Ignore overflow)
"03"=Get stack value and store it in $0A (Take FFEF, add $04, and use that address to get value. Ignore overflow)
"04"=Get stack value and store it in $0A (Take FFF1, add $04, and use that address to get value. Ignore overflow)
"05"=Get stack value and store it in $0A (Take FFF3, add $04, and use that address to get value. Ignore overflow)
"06"=Get stack value and store it in $0A (Take FFF5, add $04, and use that address to get value. Ignore overflow)
"07"=Get stack value and store it in $0A (Take FFF7, add $04, and use that address to get value. Ignore overflow)
"08"=Get stack value and store it in $0A (Take FFF9, add $04, and use that address to get value. Ignore overflow)
"09"=Get stack value and store it in $0A (Take FFFB, add $04, and use that address to get value. Ignore overflow)
"0A"=Get stack value and store it in $0A (Take FFFD, add $04, and use that address to get value. Ignore overflow)
"0B"=Get stack value and store it in $0A (Take FFFF, add $04, and use that address to get value. Ignore overflow)
"0C"=Get value from address F bytes after $04(stack address) and store it in $0A (stack value)
"0D"=Get value from address x11 bytes after $04(stack address) and store it in $0A (stack value)
"0E"=Get value from address x13 bytes after $04(stack address) and store it in $0A (stack value)
"0F"=Get value from address x15 bytes after $04(stack address) and store it in $0A (stack value)
"10"=Get stack value and store it in $0E (Take FFE9, add $04, and use that address to get value. Ignore overflow)
"11"=Get stack value and store it in $0E (Take FFEB, add $04, and use that address to get value. Ignore overflow)
"12"=Get stack value and store it in $0E (Take FFED, add $04, and use that address to get value. Ignore overflow)
"13"=Get stack value and store it in $0E (Take FFEF, add $04, and use that address to get value. Ignore overflow)
"14"=Get stack value and store it in $0E (Take FFF1, add $04, and use that address to get value. Ignore overflow)
"15"=Get stack value and store it in $0E (Take FFF3, add $04, and use that address to get value. Ignore overflow)
"16"=Get stack value and store it in $0E (Take FFF5, add $04, and use that address to get value. Ignore overflow)
"17"=Get stack value and store it in $0E (Take FFF7, add $04, and use that address to get value. Ignore overflow)
"18"=Get stack value and store it in $0E (Take FFF9, add $04, and use that address to get value. Ignore overflow)
"19"=Get stack value and store it in $0E (Take FFFB, add $04, and use that address to get value. Ignore overflow)
"1A"=Get stack value and store it in $0E (Take FFFD, add $04, and use that address to get value. Ignore overflow)
"1B"=Get stack value and store it in $0E (Take FFFF, add $04, and use that address to get value. Ignore overflow)
"1C"=Get value from address F bytes after $04(stack address) and store it in $0E (stack value)
"1D"=Get value from address x11 bytes after $04(stack address) and store it in $0E (stack value)
"1E"=Get value from address x13 bytes after $04(stack address) and store it in $0E (stack value)
"1F"=Get value from address x15 bytes after $04(stack address) and store it in $0E (stack value)

User Info: darkmoon2321

darkmoon2321
3 years ago#6
"20"=Take FFE9, add $04 to it, and then use address formed to store current value of $0A (2 byte).
"21"=Take FFEB, add $04 to it, and then use address formed to store current value of $0A (2 byte).
"22"=Take FFED, add $04 to it, and then use address formed to store current value of $0A (2 byte).
"23"=Take FFEF, add $04 to it, and then use address formed to store current value of $0A (2 byte).
"24"=Take FFF1, add $04 to it, and then use address formed to store current value of $0A (2 byte).
"25"=Take FFF3, add $04 to it, and then use address formed to store current value of $0A (2 byte).
"26"=Take FFF5, add $04 to it, and then use address formed to store current value of $0A (2 byte).
"27"=Take FFF7, add $04 to it, and then use address formed to store current value of $0A (2 byte).
"28"=Take FFF9, add $04 to it, and then use address formed to store current value of $0A (2 byte).
"29"=Take FFFB, add $04 to it, and then use address formed to store current value of $0A (2 byte).
"2A"=Take FFFD, add $04 to it, and then use address formed to store current value of $0A (2 byte).
"2B"=Take FFFF, add $04 to it, and then use address formed to store current value of $0A (2 byte).
"2C"=Store current value from $0A in a location formed by address F bytes after $04 (stack area)
"2D"=Store current value from $0A in a location formed by address x11 bytes after $04 (stack area)
"2E"=Store current value from $0A in a location formed by address x13 bytes after $04 (stack area)
"2F"=Store current value from $0A in a location formed by address x15 bytes after $04 (stack area)
"30"=Get stack value and push it to the stack (Take FFE9, add $04, and use that address to get value. Ignore overflow)
"31"=Get stack value and push it to the stack (Take FFEB, add $04, and use that address to get value. Ignore overflow)
"32"=Get stack value and push it to the stack (Take FFED, add $04, and use that address to get value. Ignore overflow)
"33"=Get stack value and push it to the stack (Take FFEF, add $04, and use that address to get value. Ignore overflow)
"34"=Get stack value and push it to the stack (Take FFF1, add $04, and use that address to get value. Ignore overflow)
"35"=Get stack value and push it to the stack (Take FFF3, add $04, and use that address to get value. Ignore overflow)
"36"=Get stack value and push it to the stack (Take FFF5, add $04, and use that address to get value. Ignore overflow)
"37"=Get stack value and push it to the stack (Take FFF7, add $04, and use that address to get value. Ignore overflow)
"38"=Get stack value and push it to the stack (Take FFF9, add $04, and use that address to get value. Ignore overflow)
"39"=Get stack value and push it to the stack (Take FFFB, add $04, and use that address to get value. Ignore overflow)
"3A"=Get stack value and push it to the stack (Take FFFD, add $04, and use that address to get value. Ignore overflow)
"3B"=Get stack value and push it to the stack (Take FFFF, add $04, and use that address to get value. Ignore overflow)
"3C"=Get value from address F bytes after $04(stack address) and push it to stack (stack value)
"3D"=Get value from address x11 bytes after $04(stack address) and push it to stack (stack value)
"3E"=Get value from address x13 bytes after $04(stack address) and push it to stack (stack value)
"3F"=Get value from address x15 bytes after $04(stack address) and push it to stack (stack value)
"4*"=Stores * into $0A
"5*"=Stores * into $0E
"6*"=Push * onto the stack

User Info: darkmoon2321

darkmoon2321
3 years ago#7
"70"=Does nothing (NOP equivalent)
"7*"=Adds * to the value in $0A, and stores it back in $0A.
"80"=BRK #$00, do not use
"81" unknown
"82" unknown
"83" unknown
"84" unknown
"85" unknown
"86" unknown
"87" unknown
"88" unknown
"89"=Takes value stored in next byte, and stores it in $0A. (branches is plus???)
"8A"=Possibly store value in next two bytes in either $0A or $0E depending if plus or minus?????
"8B"=Takes value stored in next byte, and stores it in $0E. (branches is plus???)
"8C"=Takes value stored in next two bytes, and stores it in $0E.(two bytes)
"8D"=Takes value stored in next byte, and pushes it to the stack.
"8E" unknown
"8F"=****This is really weird and complicated, but net result is storing a stack value in $0A (1 byte)
"90" unknown
"91-9F"=BRK #$00, do not use
"A0"=Load next two bytes, add $04 to them, and use this as an address to get a stack value into $0A (8 bit). (what happens

if two bytes are positive? Something happens...)"
"A1" unknown
"A2"=Load next two bytes, add $04 to them, and use this as an address to store a stack value from $0A (8 bit).(Something

happens if the two bytes are positive).
"A3"=****Does weird stuff with next two bytes and then pushes a number to the stack.";}
"A4"=Load next two bytes and use this as an address to take a value from and store it into $0A (two bytes).
"A5"=Load next two bytes and use this as an address to take a value from and store it into $0A.(one byte)
"A6"=Load next two bytes and use this as an address to take a value from and store it into $0E.
"A7"=Load next two bytes and use value from this address to store single byte in $0E (upper byte stored as zero).
"A8"=Load next two bytes and use this as an address to store two bytes from $0A.
"A9"=Load next two bytes and use this as an address to store the value from $0A into it (one byte).
"AA"=Load next two bytes and use the address formed by this to get a value to push to the stack"
"AB"=Load next two bytes and use them to form an address. Take value from that address and push to stack (single byte, with

upper byte zero)
"AC"=This is a special type of branch, go to the location in the next two bytes.
"AD" unknown
"AE" unknown
"AF" unknown
"B0"=Load value from address formed by $0A, store this value back in $0A.
"B1"=Pull value off stack into $0E, use address formed by $0E as destination for value currently in $0A.
"B2"=BRK #$00, do not use
"B3"=Push $0A onto the stack.
"B4"=Pull value off the stack and store in $0E.
"B5" unknown
"B6" unknown
"B7" unknown
"B8" unknown
"B9" unknown
"BA" unknown
"BB"=Add $0E to $0A, store it back in $0A
"BC"=Subtract $0E from $0A, store result back in $0A.
"BD" unknown
"BE"=Take value in $0A and divide it by 2^$0E
"BF" unknown

User Info: darkmoon2321

darkmoon2321
3 years ago#8
Here are the most important opcodes for program control. The C* opcodes perform comparisons between $0A and $0E, and are usually then followed by D7 or D8, which causes the code to branch. Changing a D7 or D8 to a D6 or A4 can allow you to control the flow of the game.

"C0"=Compare $0A with $0E, store 1 in $0A if they are equal, otherwise store 0 in $0A.
"C1"=Compare $0A with $0E, store 1 in $0A if not equal, otherwise store 0 in $0A.
"C2"=If $0A is greater than $0E, store 0 in $0A, otherwise store 1 in $0A
"C3"=If $0A is less than $0E, store 0 in $0A, otherwise store 1 in $0A (or equal???)
"C4"=If $0A is less than $0E, store 0 in $0A, otherwise store 1 in $0A (or equal???)"
"C5"=If $0A is greater than $0E, store 1 in $0A, otherwise store 0 in $0A (or equal???)
"C6"=Compare $0A with $0E, store 0 in $0A if $0A is greater than or equal to $0E, otherwise store 1 in $0A.
"C7"=If comparing $0A to $0E results in carry clear, store 0 in $0A, otherwise store 1
"C8"=If comparing $0A to $0E results in carry set, store 0 in $0A, otherwise store 1
"C9"=If comparing $0E to $0A results in carry clear, store 0 in $0A, otherwise store 1
"CA"=If $0A is nonzero, store 0 in $0A, otherwise store 1 in $0A.
"CB"=Subtract $0A from 0, and store value in $0A (get $0A's complement)
"CC"=Performs EOR with $0A and FFFF, stores result in $0A (only bits that are different between numbers will come out 1 in result)
"CD"=Swaps values of $0A and $0E ($0E becomes $0A and vice-versa)
"CE"=BRK #$00, do not use
"CF"=Return to previous $06 program counter
"D0"=Increment $0A by 1.
"D1"=Subtract 1 from $0A. (Dec $0A)
"D2"=Multiply $0A by 2. (ASL $0A)
"D3"=outfile<<"Load address stored in $0A, take the value and store one byte in $0A.
"D4"=Pull value from stack into $0E, use address formed by new $0E as a destination for the value currently in $0A.
"D5" unknown
"D6"="Branch Always"
"D7"=Branch if $0A is not zero"
"D8"=Branch if $0A is zero
"D9" unknown
"DA"=Compares $0A and $0E with bitwise AND, returns result in $0A
"DB" unknown
"DC" unknown
"DD" unknown
"DE"=Take value from next two bytes, increment (how much depends on if plus/minus), add $04, and store in $0A and $00.
"DF" unknown
"E0" unknown
"E1" unknown
"E2" unknown
"E3" unknown
"E4" unknown
"E5" unknown
"E6" unknown
"E7" unknown
"E8" unknown
"E9"=Branch using JSRs so you can return properly. This is how the game calls most functions.
"EA" unknown
"EB"=BRK #$00, do not use
"EC"=BRK #$00, do not use
"ED"=BRK #$00, do not use
"EE"=BRK #$00, do not use
"EF"=BRK #$00, do not use
"F*"=BRK #$00, do not use

User Info: darkmoon2321

darkmoon2321
3 years ago#9
DragonAtma: Regarding headers, there are two different kinds. From what I can tell, the kind you are referring to are present in every SNES game and ROM. When I am talking about a headered vs. headerless ROM, I'm talking about the 512 bytes that are added to the beginning of some versions of the game that are only really used for game copiers. This is the difference between an smc and an sfc file. These bytes do not affect gameplay at all, and are not needed for normal operation.

http://romhack.wikia.com/wiki/SNES_header

Either way, you can still convert between hex addresses and codes, you just have to consider the x200 byte difference.

User Info: DragonAtma

DragonAtma
3 years ago#10
Darkmoon, I know full well what a header is. Do keep in mind that I released both the first and second ever english rotk2 mods. ;)

That said, it does have an effect on listing what the locations are; if you make codes for the headered version, you're making codes most people can use right away, while if you make a code for the nonheadered version, most people have to adjust all positions by x200.
My NES, SNES, and GB all work just fine. Why should I downgrade to a Wii U, PS4, or XBone?
(edited 3 years ago)
  1. Boards
  2. Romance of the Three Kingdoms II
  3. The unofficial RoTK2 GameGenie/PAR codes topic!!

Report Message

Terms of Use Violations:

Etiquette Issues:

Notes (optional; required for "Other"):
Add user to Ignore List after reporting

Topic Sticky

You are not allowed to request a sticky.

Update Topic Flair

You are not allowed to update this topic's flair.