HEX Add 2 to this code?

Discussion in 'General Off-Topic Chat' started by jonthedit, May 4, 2014.

  1. jonthedit
    OP

    jonthedit GBAtemp Advanced Maniac

    Member
    1,691
    438
    May 30, 2011
    Bangladesh
    So here is the GameShark code in question:
    80086E8X 000F

    The X stands for the player being modified. It can be used to set every player to Character "0F" in the last four.

    So, here is what I've done and confirmed it works.
    80086E84 000F - Player 1 Becomes Character
    80086E86 000F - Player 2 Becomes Character
    80086E88 000F - Player 3 Becomes Character

    And now here is where I am lost.
    6,8,0F, 11, Just add two in hex for the next player value.

    Okay, great! Now how the hell do I replace one "X" with two characters?
    I took this code:
    80086E8X 000F and erased the 8 before the XX, so it read as follows:
    80086EXX 000F
    From there I added 0F, which is player 4, respectively.
    80086E0F 000F - Player 4 SHOULD Become Character right? NOPE! That "8" before the X makes or breaks the code.

    So I came here to ask, HOW THE HELL AM I SUPPOSED TO REPRESENT 0F in ONE SLOT!?

    Thanks!
     
  2. Foxi4

    Foxi4 On the hunt...

    pip Reporter
    23,557
    21,533
    Sep 13, 2009
    Poland
    Gaming Grotto
    Hexadecimal numbers always consist of two characters, so it's more like:

    80 08 6E XX 00 0F

    Which translates to decimal:

    128 8 110 XX 0 15

    Now, 84 (hex) = 132 (dec), 86 (hex) = 134 (dec), 88 (hex) = 136 (dec), so the jumps are regular. I think you can take it from here relatively easily. ;)

    EDIT: I would assume that the next in line would be 8A, which converts to 138 decimal. It makes sense and fits the pattern, that should be player four.
     
  3. loco365

    loco365 GBAtemp Guru

    Member
    5,458
    2,674
    Sep 1, 2010
    If it's 0F, you can just put F. 0x0F and 0xF are the exact same thing. So your code would go from this:

    80086E8X 000F

    to

    80086E8F 000F
     
    jonthedit likes this.
  4. Foxi4

    Foxi4 On the hunt...

    pip Reporter
    23,557
    21,533
    Sep 13, 2009
    Poland
    Gaming Grotto
    Where does the certainty that 0F refers to player 4 come from? Why would the game suddenly break the memory pattern used for the three other players?

    Again, guys:

    84 hex = (4*16^0) + (8*16^1) = (4*1) + (8*16) = 4 + 128 = 132
    86 hex = (6*16^0) + (8*16^1) = (6*1) + (8*16) = 6 + 128 = 134
    88 hex = (8*16^0) + (8*16^1) = (8*1) + (8*16) = 8 + 128 = 136
    8A hex = (10*16^0) + (8*16^1) = (10*1) + (8*16) = 10 + 128 = 138

    hex/dec:

    0 = 0
    1 = 1
    2 = 2
    3 = 3
    4 = 4
    5 = 5
    6 = 6
    7 = 7
    8 = 8
    9 = 9
    A = 10
    B = 11
    C = 12
    D = 13
    E = 14
    F = 15
     
  5. jonthedit
    OP

    jonthedit GBAtemp Advanced Maniac

    Member
    1,691
    438
    May 30, 2011
    Bangladesh

    There is 8 players total.
    I guess I am way off.
    F refers to no one.
    A refers to player four. Unless F is player 8 because the cycle starts again...
     
  6. Foxi4

    Foxi4 On the hunt...

    pip Reporter
    23,557
    21,533
    Sep 13, 2009
    Poland
    Gaming Grotto
    If there's 8 players total then the math should be simple from this point:

    Player 1 = 84 (132)
    Player 2 = 86 (134)
    Player 3 = 88 (136)
    Player 4 = 8A (138)
    Player 5 = 8C (140)
    Player 6 = 8E (142)
    Player 7 = 90 (144)
    Player 8 = 92 (146)

    Does that help/work?

    Edit: Added the missing player, well-spotted jonthedit. ;)
     
  7. jonthedit
    OP

    jonthedit GBAtemp Advanced Maniac

    Member
    1,691
    438
    May 30, 2011
    Bangladesh
    The 90 breaks it.
    The 8 seems to be part of the code and not actually related to the character. :|
     
  8. Foxi4

    Foxi4 On the hunt...

    pip Reporter
    23,557
    21,533
    Sep 13, 2009
    Poland
    Gaming Grotto
    That should't be the case, again, hexadecimal numbers come in pairs. I take it that players from 1 to 7 work fine? Why not try 82 (130)? It's sort of ass-backwards, but you never know. It would be easier to tinker with this if we knew the game you're working on and your tools.
     
  9. jonthedit
    OP

    jonthedit GBAtemp Advanced Maniac

    Member
    1,691
    438
    May 30, 2011
    Bangladesh
    You skipped player 5.
    That is why 90 broke it.
     
  10. Foxi4

    Foxi4 On the hunt...

    pip Reporter
    23,557
    21,533
    Sep 13, 2009
    Poland
    Gaming Grotto
    Herp-a-derp, my bad, you're absolutely right, corrected in the post above.
     
  11. jonthedit
    OP

    jonthedit GBAtemp Advanced Maniac

    Member
    1,691
    438
    May 30, 2011
    Bangladesh
    Figured it out. Thanks for the help! Thank you Team Fail and Foxi4!

    To elaborate, the Hexadecimal conversion Foxi4 explained made sense to me. (I probably should have refreshed my memory on Hex :P)
    The problem was not the "90". Foxi4 was correct, and I was wrong. The game accepted the code however the multiple instances of the code running with separate targets caused issues.
    So I created a tool that injected the codes at different times.
    Ironically after making this tool, I found [pec] which solves this issue by itself. Either way, I did this without [pec].

    Regular gap of 2! I made a mistake as explained above.
     
    Foxi4 likes this.
  12. Foxi4

    Foxi4 On the hunt...

    pip Reporter
    23,557
    21,533
    Sep 13, 2009
    Poland
    Gaming Grotto
    I'm glad that we could help! So, what was your final result? I'm just curious if this was a regular gap of 2 or if it went funky for player 7 and player 8. - Snip! Didn't notice the edit above. :P

    EDIT: Good to hear that everything worked out in the end, good luck with whatever you're modifying! ;)
     
  13. jonthedit
    OP

    jonthedit GBAtemp Advanced Maniac

    Member
    1,691
    438
    May 30, 2011
    Bangladesh
    Sorry for the delay! Glad you saw my edit!
    Here is my first experiment that ended in success using what we just discussed! I hope to reverse engineer this game at some point, and getting involved with GS is a start for me! I need to see what can be done without source tampering!
    The video is now fully processed. HD :P!
     
    Foxi4 likes this.
  14. Foxi4

    Foxi4 On the hunt...

    pip Reporter
    23,557
    21,533
    Sep 13, 2009
    Poland
    Gaming Grotto
    Crash Team Racing? Good man, looks like fun! :)
     
  15. jonthedit
    OP

    jonthedit GBAtemp Advanced Maniac

    Member
    1,691
    438
    May 30, 2011
    Bangladesh
    CTR is an old PSOne classic. I love the game! I actually find it more fun than Mario Kart even though it is a clone of MK.
    I just bought it again on my family's PS3 when it went on sale for 99cents! Already 101%'d it lol.
    Thought I would have some fun tampering with it on an emulator.