📜 ⬆️ ⬇️

Generate passwords for Super Castlevania IV and Rock n 'Roll Racing

Good afternoon, dear users.

Recently I wrote a post about password generation for the first and second Road Rash. In the comments to the article I was asked to clarify how the password system in the game Rock n 'Roll Racing is arranged. About this I would like to talk to you. But I would like to start with the game Super Castlevania IV. Well, let's get started.

image

Super Castlevania IV


Games for SNES, I have never "hacked". Well, until one moment. I once saw my brother playing this game. And he somehow casually said that it would be very good if it were possible to generate passwords on Super Castlevania IV. Without thinking, I set to work. After three sleepless nights, I realized what and how the password is stored.
')
Theory

The password consists of 16 cells (positions), each cell consists of 2 bits, a total of 16 * 2 = 32 bits. These bits save game data parameters:

Now let's see what the raw password consists of:

* in brackets will be indicated the number of bits.
C4 (1) , C4 (0)D (1) , D (0)? (1) (0)C2 (1) , C2 (0)
C6 (1) , C6 (0)N (15) , N (14)U1 (1) , U1 (0)C5 (1) , C5 (0)
U2 (1) , U2 (0)C1 (1) , C1 (0)? (1) (0)L (1) , L (0)
N (13) , N (12)C3 (1) , C3 (0)L (3) , L (2)U3 (1) , U3 (0)

Legend

? - always equal to zero.
U - unused bits.
D - (quest -1) (1-4) in binary number system. (00 - normal difficulty, 01 - increased complexity. I did not find passwords for Quest 3 and 4. On the Internet, the game records this data for some reason. Difficulty will not grow, but suddenly, if you complete the fourth quest, the secret ending will open? Although ... most likely nothing will change.)
N - the value of the name in the binary number system. The total of the name values ​​is subtracted from the initial value.

* in brackets recorded values ​​of characters.
* [] - space.
A (11)B (12)C (13)D (14)E (15)F (16)G (17)H (18)I (19)
J (20)K (21)L (22)M (23)N (24)O (25)P (26)Q (27)R (28)
S (29)T (30)U (31)V (32)W (33)X (34)Y (35)Z (36)[] (0)
12)2 (3)3 (4)4 (5)5 (6)6 (7)7 (8)8 (9)9 (10)


L - (level number (0-14) div3) in binary number system.

* Level B-3 consists of three parts.
roomLevelInitial value of the name
01-12040
one2-110240
23-114340
34-134826
four5-110256
five6-143026
67-151226
78-143042
eight9-147142
9A-155343
tenB-114388
elevenB-3 (1)63543
12B-3 (2)2104
13B-3 (3)18489
14B-434874


Checksums

C1 = N (1) , N (0) + D (1) , D (0)
C2 = N (3) , N (2) + C1 (3) , C1 (2) + U2 (1) , U2 (0)
C3 = N (5) , N (4) + C2 (3) , C2 (2) + U1 (1) , U1 (0)
C4 = N (7) , N (6) + C3 (3) , C3 (2) + U3 (1) , U3 (0)
C5 = N (9) , N (8) + C4 (3) , C4 (2)
C6 = N (11) , N (10) + C5 (3) , C5 (2)

I want to draw your attention to the fact that the two high-order bits from one checksum pass into the next checksum.

Coding

image

0 (00) is empty.
1 (01) - the ax.
2 (10) - holy water.
3 (11) - the heart.

Password generation example
Create a password that saves these parameters:
  • Name: "AWL [] VITA"
  • quest (4)
  • all unused bits are one
  • level B-3 (2)


We translate the values ​​into the binary number system:

level number (12div3 = 4) = 0100
Quest (4) = 4-1 = 3 = 11

Calculate the value of the name:

AWL [] VITA = 11 + 33 + 22 + 0 + 32 + 19 + 30 + 11 = 158
2104-158 = 1946 = 11110011010
N (15) , N (14) = 00
N (13) , N (12) = 00
N (11) , N (10) = 01
N (9) , N (8) = 11
N (7) , N (6) = 10
N (5) , N (4) = 01
N (3) , N (2) = 10
N (1) , N (0) = 10

Calculate checksums:

C1 = 10 + 11 = 0101
C2 = 10 + 01 + 11 = 0110
C3 = 01 + 01 + 11 = 0101
C4 = 10 + 01 + 11 = 0110
C5 = 11 + 01 = 0100
C6 = 01 + 01 = 10

We write the data in the table:

teneleven00ten
ten00eleven00
eleven010000
000101eleven

It remains to translate the numbers into a graphic image.


Rock n 'Roll Racing


I “hacked” this game for a long time and then did not use the method of bit parsing. Therefore, the approach to this game will be slightly different.

image

Theory

The password consists of 12 positions in which game data is saved:


Now let's see how the values ​​in the positions change depending on the selected game parameters:

Complexity1 position4 position
Rookie+0XOR5
VeteranXOR8XOR1
WarriorXOR16XOR13

Division1 position7 position
AXOR8+0
B+0+2

A machine2 position3 position9 position
Glitch+0+0+0
Glitch+0XOR16+4
Glitch (self-destructing machine)XOR1+0+8
Air bladeXOR1XOR16+12
MarauderXOR2+0+16
Dirt DevilXOR2XOR16+20
HavacXOR3+0+24
Battle trakXOR3XOR16+28

Car color2 position8 position
RedXOR20+0
GreenXOR16+1
The blackXOR28+2
BlueXOR4+4
Glitch (pink-green color)+0+5
YellowXOR12+6

Engine1 position10 position11 position
one+0+0+16
2XOR4+0+0
3XOR8+1+16
fourXOR12+1+0

Tires1 position4 position10 position
one+0+0+6
2XOR16+0+4
3+0XOR16+2
fourXOR16XOR16+0

Armor3 position9 position
oneXOR4+1
2+0+0
3XOR12+3
fourXOR8+2

Suspension3 position10 position
one+0+8
2XOR1+0
3XOR2+24
fourXOR3+16

Nitro / jump1 position2 position11 position
0+0+0+8
one+0XOR16+10
2XOR1+0+12
3XOR1XOR16+14
fourXOR2+0+0
fiveXOR2XOR16+2
6XOR3+0+4
7XOR3XOR16+6

Spikes / Mines2 position11 position12 position
0+0+1+0
oneXOR2+1+8
2XOR4+1+16
3XOR6+1+24
fourXOR8+0+0
fiveXOR10+0+8
6XOR12+0+16
7XOR14+0+24

Missiles / ammo2 position3 position12 position
0+0+0+0
one+0XOR8+1
2+0XOR16+2
3+0XOR24+3
fourXOR1+0+4
fiveXOR1XOR8+5
6XOR1XOR16+6
7XOR1XOR24+7

Planets1 position7 position8 position
Bogmire+0+1+0
New mojaveXOR1+1+8
Chem VIXOR2+1+16
DrakonisXOR3+1+24
GlitchXOR4+0+0
GlitchXOR5+0+8
NHOXOR6+0+16
InfernoXOR7+0+24

Characters1 position3 position4 position7 position
Tarquim+0XOR1XOR16+0
Jake badlanceXOR16XOR1XOR16+4
Glitch+0XOR1+0+8
Olaf (secret character)XOR16XOR1+0+12
Cyberhawk+0+0XOR16+16
Snake sandersXOR16+0XOR16+20
Katarina lions+0+0+0+24
IvanzypherXOR16+0+0+28


Now let's see how the positions change depending on the amount of money:

X 1z. X 2z. X 3z. X 4z. 000 $

The amount of money needs to be divided by 1000 and the balance to determine changes in positions.

1 position = XOR (x $ div 200)
2 position = XOR (3z. + 0, if x $ div 100 is an even number, or +16, if an odd number)
3 position = XOR (4. * 2)
4 position = XOR (x $ div 400)
5 position = ((x $ div 100) mod4) XOR ((x $ div 20) mod5)
(↓)
(The resulting number is converted)
in accordance with
0 → 13
1 → 5
2 → 29
3 → 21

6 position = ((x $ div 10) mod2) XOR 4h.
(↓)
(The resulting number is converted)
in accordance with
0 → 12
1 → 28

Coding

Characters in the positions take the values ​​“BCDFGHJKLMNPQRSTVWXYZ0123456789!”, Where B = 0, C = 1 ... 9 = 30,! = 31.

Password generation example
Create a password that saves these parameters:
  • complexity (veteran)
  • Division (A)
  • car (Dirt Devil)
  • car color (red)
  • planet (new mojave)
  • character (Cyberhawk)
  • armor (1)
  • engine (3)
  • suspension (2)
  • tires (4)
  • spikes / mines (5)
  • nitro / jump (3)
  • rockets / cartridges (7)
  • money ($ 1257,000)

Calculate money:
1257000/1000 = 1257
1 position = 1257 div 200 = 6 = XOR6
2 position = 5+ (1257 div 100) = 5 + 12 (since the number is even, then +0) = 5 + 0 = XOR5
3 position = 7 * 2 = 14 = XOR14
4 position = 1257 div 400 = 3 = XOR3
5 position = ((1257 div 100) mod4 = 0 → 13. 13 XOR (1257 div 20) mod5 = 13 XOR 2 = 15
6 position = ((1257 div 10) mod2 = 1 → 28. 28 XOR 7 = 27

Now write the position values ​​in the table:
* n. - position.
1 p.2 p.3 p.4 p.5 p.6 p.7 p.8 p.9 p.10 p.11 p.12 p.
XOR6XOR5XOR14XOR31527+1+8+20+1+16+8
XOR8XOR2XOR16XOR1+0+0+16+0+1+0+14+7
XOR8XOR20XOR4XOR16+0+0+0+0+0+0+0+0
XOR8XOR10XOR1XOR16+0+0+0+0+0+0+0+0
XOR16XOR16XOR24+0+0+0+0+0+0+0+0+0
XOR1XOR1+0+0+0+0+0+0+0+0+0+0
XOR1+0+0+0+0+0+0+0+0+0+0+0


We make the necessary calculations and get:
30,8,3,2 15,27,17,8 21,1,30,15

Now we encode this string:

9LFD T6WL 0C9T


Conclusion

Well, I hope that I didn’t confuse you too much with Rock n 'Roll Racing. Good luck, thanks for reading.

Source: https://habr.com/ru/post/304160/


All Articles