吞食天地吧 关注:51,662贴子:1,025,558

【转载】简单介绍一下Game Genie金手指(GG码)

只看楼主收藏回复


原帖作者 @wangsitan

从处理器的寻址空间说起:

图1


RAM为0000~07FF,ROM在8000~FFFF

RAM(Ramdom Access Memory)是供程序随意读写的空间,用于保存程序运行时产生的数据。
ROM(Read Only Memory)是程序段,也就是可执行代码所在的空间。
比较常见也比较直观的那种金手指,格式为 Address-Type-Value。
这种金手指是控制内存用的,也就是说它能控制的范围是 0000~07FF,即Address为0000~07FF时才有效(virtuanes输入cheat code时并不检查地址,写一个超出范围的地址似乎也有影响,但是是怎么影响的我就不知道了)。

Type有两位,第一位是模式,对应关系为:
0 Always
1 Once
2 Greater
3 Less

第二位是长度,单位是字节,只能取1~4,即一条金手指能控制的范围为连续的1到4个字节。

Value就是期望的值,当然这个的取值范围取决于Type的第二位,1个字节就是00~FF,4个字节就是00000000~FFFFFFFF。
需要注意的是,这个Value是Little Endian的,即低地址存放最低有效字节,如0x12345678这个数占4个字节,在内存中这连续的4个字节的值依次为 78 56 34 12。


不同模式:
Always就是把输入的地址范围的内存值锁定为期望的值。实际上工作原理应该是频繁写入,而不是真正锁定,因为开着金手指的时候store指令依然可以改变内存的值。如07ff-01-80就是锁定07ff的值为80。

Once是只写一次。比如用XXXX-11-FF写生命数为255的话就会变成255命,之后死掉就减少,而不是锁定为255命。

Greater是指比期望的值大时就改写内存为期望的值。比如06ff-21-80,当金手指发现06FF的值变成A3时就会改写其为80,而发现06FF的值为30时就不管它。相当于给一个上限值。
Less和Greater道理相同,效果相反。

这种金手指常用于控制游戏中显而易见的数值,比如HP、SP、MP、DP、群P,各式P。
还可用于控制伪随机数,比如有的rpg遇敌算法中要读步数之类的内存,控制一下就可以不遇敌

这种金手指能改写内存,不能随意改变程序的走向

要改程序本身,就可以用GG码了

gg码要表达的意思是:
将rom段的某字节改变为期望的值。
这通常会引起混乱,因为rom段存在切页的情况,就是说不同的时刻映射出来的代码段可能会不一样。
所以可以加上一个前提条件,成为:
看rom段的某字节是否为某值,若是,则改变为某值。

举个栗子(小朋友不要被误导)

冒险岛2有个调试模式,需要的gg码是PPSZXXPE,这条金手指的意思是:
看AA52的值是否为09,若为09,则改为19。
图2


图中显示的是2A52,是从rom段开头8000算起的
8000+2a52=aa52
图3


这是nestopia的金手指界面
在一个区域内输入,然后点“效验”可以看到另外两块的信息
nestopia这个比较方便,你可以直接输入gg码,也可以输入地址、比较值和期望值。

有的模拟器,可能用户只能输入gg码。如果你知道要如何修改rom,而不知道相应的gg码,就需要工具去转换了,比如 图2 中的Game Genie Code Converter
有时一个修改要改多个字节,那就需要多条gg码了。
再举个栗子

热血足球联盟中
让必杀球可控制方向的补丁:
<06>[96DA]: AD 10 05 -> A9 00 EA
(广告:该作更多补丁见 http://tieba.baidu.com/p/1893107923

改动3个字节,故需要3条gg码
96DA的AD改为A9
96DB的10改为00
96DC的05改为EA

图4


gg码相当于简易的在线hack
或者说是在线的rom patch
打算自己做gg码的话,得会改rom

不像控制内存的金手指那么直观
但是能做到的事情更多
看到过类似这样的言论
某某模拟器的金手指根本不能用
就是个摆设

这种话说之前该三思。

有可能是让输gg码,尤其那种示例输入是一串字母的。

当然也不一定都是gg码,像nestopia里面就还有个Pro Action Rocky,那个看上去应该是由十六进制数字组成的。


收起回复
举报|2楼2013-09-24 18:54
    精品贴了吧


    回复
    举报|来自Android客户端3楼2013-09-24 18:56
      完全没懂


      回复
      举报|来自Android客户端4楼2013-09-25 02:48
        好乱啊,当年研究金手指就弄了半天,


        回复
        举报|来自Android客户端5楼2013-09-25 06:24
          大神语言真深奥


          回复
          举报|来自Android客户端6楼2013-09-25 08:58
            神马东西?


            回复
            举报|7楼2013-09-25 10:41
              这说的是啥 怎么我都不懂 直接发金手指码不就行了 要手机的


              收起回复
              举报|来自手机贴吧8楼2013-09-25 16:04
                呵呵 ~ 8楼真可爱 ~


                回复
                举报|来自手机贴吧10楼2013-09-25 16:17
                  发手机金手指代码啊 看不懂


                  收起回复
                  举报|来自手机贴吧11楼2013-09-25 16:25
                    说你可爱就越说越可爱 ~


                    回复
                    举报|来自手机贴吧12楼2013-09-25 16:27
                      无语


                      收起回复
                      举报|来自手机贴吧13楼2013-09-25 16:41
                        的确很无语 ~


                        回复
                        举报|来自手机贴吧14楼2013-09-25 17:06
                          .



                             ——专注水军三十年,为水而生。


                          回复
                          举报|来自Android客户端15楼2013-09-25 17:46
                            菜鸟默默路过


                            收起回复
                            举报|来自手机贴吧16楼2013-09-25 18:18
                              完全看不懂啊大神


                              收起回复
                              举报|18楼2013-12-27 10:17
                                你比不过马良的武力,张飞的智力,周仓的速度,黄巾贼的攻击。盗贼的防御,你五围都差劲


                                收起回复
                                举报|来自手机贴吧19楼2013-12-27 11:05
                                  楼主修改器我再网上找了半天也没找到,麻烦楼主下载地址麻烦发一下谢谢


                                  收起回复
                                  举报|20楼2014-08-11 07:14
                                    你介绍这东西完全无用,除非明白rom结构和数据详细地址才有可能制作出gg码


                                    收起回复
                                    举报|21楼2014-08-11 08:49
                                      帖子中说了 :
                                      gg码相当于简易的在线hack
                                      或者说是在线的rom patch
                                      打算自己做gg码的话,得会改rom
                                      不像控制内存的金手指那么直观
                                      但是能做到的事情更多

                                      ~
                                      各看官 ~
                                      请莫 无视此内容 ~


                                      回复
                                      举报|来自手机贴吧22楼2014-08-11 09:00
                                        【福利】
                                        参考一下吧
                                        http://tieba.baidu.com/p/3126524669


                                        回复
                                        举报|来自手机贴吧23楼2014-08-11 09:01
                                          所谓GG 就是Game Genie 一个外联的作弊设备 由美国一家公司制作


                                          后来任天堂还告了这家公司 结果败诉


                                          下面补充GG码制作原理(英文)


                                          -------------------------------------------------------------------------
                                          NES Game Genie Conversion Method
                                          -------------------------------------------------------------------------


                                          This document describes the process of converting NES Game Genie codes
                                          to raw hex values and ROM addresses. This information came from
                                          Benzene of Digital Emutations. I&#39;ve tested the results by using
                                          NESticle 0.xx for DOS.


                                          Mathematical concepts are explained in the math.txt file. Please consult
                                          that file if you have any questions about this process.


                                          For information on hex editing, please consult the hexedit.txt file.


                                          -------------------------------------------------------------------------
                                          Step 1 - Convert GG hex to Standard hex
                                          -------------------------------------------------------------------------


                                          All the game genie letters translate to standard hex codes, so we just
                                          need to know how that conversion works. Here&#39;s a short table.


                                          A = 0 E = 8
                                          P = 1 O = 9
                                          Z = 2 X = A
                                          L = 3 U = B
                                          G = 4 K = C
                                          I = 5 S = D
                                          T = 6 V = E
                                          Y = 7 N = F


                                          -------------------------------------------------------------------------
                                          Step 2 - Manipulations in Binary
                                          -------------------------------------------------------------------------


                                          The next part of the conversion involves translating our hex to
                                          binary, so we can manipulate the string bit-by-bit. We can use
                                          this handy table to convert easily.


                                          0 = 0000 8 = 1000
                                          1 = 0001 9 = 1001
                                          2 = 0010 A = 1010
                                          3 = 0011 B = 1011
                                          4 = 0100 C = 1100
                                          5 = 0101 D = 1101
                                          6 = 0110 E = 1110
                                          7 = 0111 F = 1111


                                          Just convert each letter and don&#39;t leave out any leading zero&#39;s,
                                          as they are very important.


                                          收起回复
                                          举报|24楼2014-08-11 09:26
                                            -------------------------------------------------------------------------
                                            Step 2a - Decoding 8 character Game Genie Codes
                                            -------------------------------------------------------------------------


                                            Skip this step if you have a 6 character code.


                                            We aren&#39;t done yet, because now that we have the binary version
                                            of the code, we have to rearrange the bits so it&#39;s no longer
                                            encrypted.


                                            To rearrange the values, we need to have a position system. Each
                                            bit in the bit string represents a different position. When we
                                            arrange the positions in order, we will have the converted code.


                                            Code: 00000110111000000110010011010011
                                            Position: 1678H234-IJKLABCDMNOeEFGafgh5bcd


                                            If we rearrange the code in order of position, starting with
                                            the numbers from 1-8, then the dash, next the letters A-O, and
                                            finally the letters a-h, we will have broken the code. You may
                                            want to break the code up to see the positions better.


                                            Code: 0000 0110 1110 0000 0110 1001 1101 0011
                                            Position: 1678 H234 -IJK LABC DMNO eEFG afgh 5bcd


                                            0110 0000 000 0001


                                            When we go to rearrange this code, we will end up with this
                                            set of bits:


                                            Original: 0000 0110 1110 0000 0110 1001 1101 0011
                                            Rearranged: 0110 0000 1000 0100 0110 0110 1011 0101
                                            Represents: VVVV VVVV -AAA AAAA AAAA AAAA CCCC CCCC


                                            VVVV VVVV: The value of the code. That is, what we change the
                                            addresses value to.


                                            AAA AAAA AAAA AAAA: The address of the code. What we change.


                                            CCCC CCCC: The compare value. We only change the address to
                                            the value if the current value of the address
                                            matches the compare value.


                                            -------------------------------------------------------------------------
                                            Step 2b - Decoding 6 character Game Genie Codes
                                            -------------------------------------------------------------------------


                                            Skip this step if you have an 8 character code.


                                            To find the correct values, we need to rearrange the bit positions in
                                            the bit string. To rearrange in the correct order, we will need to know
                                            the correct positions to rearrange the bits into.


                                            Code: 110110100101100100011001
                                            Position: 1678H234-IJKLABCDMNO5EFG


                                            If we rearrange the code in order of position, starting with the numbers
                                            1-8, then the dash, then the letters A-M, we will have the correct
                                            values. It helps to break up the code to see it better.


                                            Original: 1101 1010 0101 1001 0001 1001
                                            Rearranged: 1010 1101 0001 0001 1101 1001
                                            Represents: VVVV VVVV -AAA AAAA AAAA AAAA


                                            VVVv VVVV: The value of the code, i.e. what we change the value of the
                                            address to.


                                            AAA AAAA AAAA AAAA: The address of the code. What we change.


                                            -------------------------------------------------------------------------
                                            Step 3 - Back to hex
                                            -------------------------------------------------------------------------


                                            Codes are much easier to work with in hex, so let&#39;s translate
                                            our values back to hex. Just use the same conversion table from
                                            step 2.


                                            -------------------------------------------------------------------------
                                            Step 4 - ROM Addresses and ROM hacking
                                            -------------------------------------------------------------------------


                                            To get the ROM address, we need to add 8000h to our code address.
                                            Finally, we need to adjust for the iNES ROM header, which is 16
                                            bytes. So we need to add 0010h to our address.


                                            For 8 character game genie codes, there is an extra step. The
                                            compare value. This compare value is used because of the way the
                                            NES works. The NES can only handle 32K at a time. This means that
                                            to use more program data (because 32K is very small), we need to
                                            have different "ROM pages". A ROM page is 32K of data, and there
                                            are usually several of them in an iNES ROM (all .nes files are
                                            iNES roms).


                                            So, to find the correct value, we need to use the compare value.
                                            So, in the hex editor, check the value of the first ROM address
                                            against the compare value. If they match, that&#39;s the value to
                                            change. If not, then add 8000h to the value and check that value.
                                            Keep doing this until you find the matching value. Note that
                                            there may be more than one matching value. In that case, you
                                            will need to change them all (that&#39;s what the real game genie
                                            does - well, that&#39;s glib, but good enough).


                                            -------------------------------------------------------------------------
                                            Example of an 8 character code: ATVATGSL
                                            -------------------------------------------------------------------------


                                            Step 1) Translate the code and we get: ATVATGSL = 06E064D3
                                            Step 2) So, translate 06E069D3 to binary and we get
                                            0000 0110 1110 0000 0110 0100 1101 0011
                                            Step 2a) Now rearrange the bits to get the correct bit string
                                            0110 0000 1000 0100 0110 0110 1011 0101
                                            V: 0110 0000
                                            A: 000 0100 0110 0110
                                            C: 1011 0101
                                            Step 3) Convert back to hex
                                            V: 60h
                                            A: 0466
                                            C: B5
                                            Step 4) Add the offset values to get the ROM address:
                                            R: 8476h
                                            V: 60h
                                            C: B5


                                            If (R == C) then { R = V, repeat } else { r += 8000h, repeat. }


                                            Anyway, just keep checking values and adding 8000h till all the
                                            C&#39;s become V&#39;s. Simple, no?


                                            -------------------------------------------------------------------------
                                            Example of an 6 character code: SXIOPO
                                            -------------------------------------------------------------------------


                                            Step 1) Translate the code and we get: SXIOPO = DA5919
                                            Step 2) Convert that the binary and we get
                                            1101 1010 0101 1001 0001 1001
                                            Step 2b) Now rearrange the bits to get the correct bit string:
                                            1010 1101 0001 0001 1101 1001
                                            V: 1010 1101
                                            A: 001 0001 1101 1001
                                            Step 3) Convert back to hex:
                                            V: ADh
                                            A: 11D9h
                                            Step 4) Add the offset values to get the ROM address:
                                            R: 91E9h


                                            Now, just open your hex editor, and change the value of 91E9
                                            to be ADh.


                                            6 digit codes are quite simple, no?


                                            收起回复
                                            举报|25楼2014-08-11 09:27
                                              鉴于 狠多童鞋说看不懂 ~
                                              ....
                                              网上有 部分 现成滴 GG码 ~
                                              但多为 英文版(或者说美版) rom 适用 ~
                                              欲得 中文版 rom 适用 滴 GG码 ...
                                              你得 会 改 rom ~


                                              回复
                                              举报|来自手机贴吧26楼2014-08-11 10:36
                                                一窍不通


                                                回复
                                                举报|27楼2014-09-06 00:56
                                                  手机能内存地址不


                                                  收起回复
                                                  举报|28楼2015-07-04 15:35
                                                    求个金币的GG码


                                                    回复
                                                    举报|来自Android客户端29楼2015-12-24 15:58
                                                      写这些破外应谁能看懂?


                                                      收起回复
                                                      举报|来自手机贴吧30楼2016-04-26 22:39
                                                        写得好乱呀,都不知道那个是什么意思,那个又是什么意思,可不可以一部一部讲解


                                                        楼主说说话呗


                                                        回复
                                                        举报|来自Android客户端32楼2016-08-10 23:44