Actions

SCHG

Difference between revisions of "Sonic the Hedgehog 2 (16-bit)/Text Editing"

From Sonic Retro

(Two-Player Mode Text: rm useless text)
(Half-done, I'll do the rest later)
Line 1: Line 1:
 
__NOTOC__
 
__NOTOC__
 
{{SCHG S2}}
 
{{SCHG S2}}
 
 
One of the most useful things to change in the game is the text. Though, there are many different formats for the many different types of text in the game. The known formats are listed here.
 
One of the most useful things to change in the game is the text. Though, there are many different formats for the many different types of text in the game. The known formats are listed here.
  
 
==Two-Player Mode Text==
 
==Two-Player Mode Text==
{| class="prettytable"
+
The text starts at byte_874A in Xenowhirl's disassembly. It uses a non-ASCII format, but thanks to [[AS]]' macro capabilities can be edited in the disassembly as plain text.
!Offset||Text
 
|-
 
|$874B-8756
 
|Emerald Hill
 
|-
 
|$8759-8763
 
|Mystic Cave
 
|-
 
|$8765-8770
 
|Casino Night
 
|-
 
|$8772-877E
 
|Special Stage
 
|-
 
|$8783-8789
 
|Special
 
|-
 
|$878D-8790
 
|Zone
 
|-
 
|$8793-8797
 
|Stage
 
|-
 
|$8799-87A1
 
|Game over
 
|-
 
|$87A3-87AB
 
|Time over
 
|-
 
|$87AD-87B3
 
|No game
 
|-
 
|$87B5-87B8
 
|Tied
 
|-
 
|$87BB-81BC
 
|1P
 
|-
 
|$87BF-87C0
 
|2P
 
|}
 
  
 
==Options Text==
 
==Options Text==
{| class="prettytable"
+
The text starts at byte_97CA in Xenowhirl's disassembly, and once again can be edited as plain text. The in-game format for each character is as follows:
!Offset||Text
 
|-
 
|$97CB-97DB
 
|* Player select *
 
|-
 
|$97DD-97EB
 
|Sonic and Miles
 
|-
 
|$97ED-97FB
 
|Sonic and Tails
 
|-
 
|$97FD-980B
 
|Sonic alone
 
|-
 
|$980D-981B
 
|Miles alone
 
|-
 
|$981D-982B
 
|Tails alone
 
|-
 
|$982D-983D
 
|* Vs mode items *
 
|-
 
|$983F-984D
 
|All kinds items
 
|-
 
|$984F-985B
 
|Teleport only
 
|-
 
|$985F-986F
 
|* Sound test*
 
|}
 
 
 
To properly modify the text, you will need to become familiar with the character set. Listed here is the entire character set that you can use.
 
 
{| class="prettytable" align="center"
 
{| class="prettytable" align="center"
 
|-
 
|-
Line 143: Line 67:
  
 
==Level Select Text==
 
==Level Select Text==
 +
The level select uses a plane map for the foreground and background graphics. The plane map for the text is located at MapEng_LevSel in Xenowhirl's disassembly, and is [[Enigma compression|Enigma-compressed]]. It is 40x28 tiles wide, with each word in it representing one 8x8 tile, arranged row-by-row.
  
009AEB-??????<br/>
+
The highlighting uses a different system, based on the array at byte_96EE. There are four bytes per level select entry. The first byte is the row offset into the plane map for the level name text, the second byte is the column offset for the same text multiplied by 2. The third byte is the row offset into the plane map for the act number text. If this is 0, no highlighting is performed for this text. The fourth byte is the column offset for the act number text multiplied by 2.
009B44 - ARZ<br/>
 
009B58 - WFZ<br/>
 
009BEF - OOZ<br/>
 
 
 
The format for level select text is very different. This is because it is mapped. This can be very confusing because it uses a very odd format—10 bits for each character. So, the easiest way to modify it is to take 5 bytes and convert them into bits. Then take the bits and separate them into 4 sets of 10 bits. So, if I have "C1 E0 B8 32 07", then I'd convert that into bits. The Windows calculator will work this feature just fine (although if you don't have 2000 or later, you'll have to do two calculations, as only [[double-word]] length is supported on the older versions of the Windows calculator). Then break up the large line of bits into sets. So, "C1 E0 B8 32 07" would become this.
 
 
 
1100000111 (A)<br/>
 
1000001011 (Q)<br/>
 
1000001100 (U)<br/>
 
1000000111 (A)<br/>
 
 
 
This is the confusing part. You'll have to 'shift' the bits over to the left by 2. So, take a look at A and Q (1100000111 1000001011). Shifting over to the left by 2 would convert these into 0000011110 00001011(10). The extra 10 on the end of the Q comes from the first two bits of the U. So, the values above come out to be this.
 
 
 
0000011110 (A)<br/>
 
0000101110 (Q)<br/>
 
0000110010 (U)<br/>
 
00000111(10) (A)<br/>
 
 
 
These values represent the character number of each listing in the games VRAM. So, like 0000011110 (1E in hex form) for example is the letter A found in the VRAM. You can also use the chart at the top of this page for a full listing of the major characters.
 
 
 
Death Egg and Hill Top aren't editable yet though. Nobody has figured out why, and I haven't really taken the time to look at them. For now, Death Egg and Hill Top will have to remain the way they are on the level select.
 
  
 
==© 1992 SEGA Text==
 
==© 1992 SEGA Text==
For editing the "© 1992 SEGA" text string on the title screen, you must use a different character set. Here are the instructions.
+
The "© 1992 SEGA Text" on the title screen is located at CopyrightText in Xenowhirl's disassembly, and uses a different format. Each word represents one character. The word values corresponding to each character are:
 
 
003E80 - © 1992 SEGA
 
 
 
FORMAT:
 
#1 #2
 
 
 
1+2 - Sprite selection in VRAM.
 
 
 
Every time you get up to 08 00 in a sprite selection, it wraps from the beginning of the VRAM, but with a different palette. Here are the standard sprite numbers for each character.
 
 
 
 
{| class="prettytable" align="center"
 
{| class="prettytable" align="center"
 
|-
 
|-

Revision as of 02:49, 30 August 2008


Sonic Community Hacking Guide
Sonic the Hedgehog 2 (16-bit)
Art
Objects
Levels
Text
Music
RAM
Miscellaneous

One of the most useful things to change in the game is the text. Though, there are many different formats for the many different types of text in the game. The known formats are listed here.

Two-Player Mode Text

The text starts at byte_874A in Xenowhirl's disassembly. It uses a non-ASCII format, but thanks to AS' macro capabilities can be edited in the disassembly as plain text.

Options Text

The text starts at byte_97CA in Xenowhirl's disassembly, and once again can be edited as plain text. The in-game format for each character is as follows:

00 - Space 10 - 0 11 - 1 12 - 2
13 - 3 14 - 4 15 - 5 16 - 6
17 - 7 18 - 8 19 - 9 1A - *
1B - © 1C - : 1D - . 1E - A
1F - B 20 - C 21 - D 22 - E
23 - F 24 - G 25 - H 26 - I
27 - J 28 - K 29 - L 2A - M
2B - N 2C - O 2D - P 2E - Q
2F - R 30 - S 31 - T 32 - U
33 - V 34 - W 35 - X 36 - Y
37 - Z 0E - Start a new text line 10 - Start a new selection box

Level Select Text

The level select uses a plane map for the foreground and background graphics. The plane map for the text is located at MapEng_LevSel in Xenowhirl's disassembly, and is Enigma-compressed. It is 40x28 tiles wide, with each word in it representing one 8x8 tile, arranged row-by-row.

The highlighting uses a different system, based on the array at byte_96EE. There are four bytes per level select entry. The first byte is the row offset into the plane map for the level name text, the second byte is the column offset for the same text multiplied by 2. The third byte is the row offset into the plane map for the act number text. If this is 0, no highlighting is performed for this text. The fourth byte is the column offset for the act number text multiplied by 2.

© 1992 SEGA Text

The "© 1992 SEGA Text" on the title screen is located at CopyrightText in Xenowhirl's disassembly, and uses a different format. Each word represents one character. The word values corresponding to each character are:

00 00 - Space 06 80 - 0 06 81 - 1 06 82 - 2
06 83 - 3 06 84 - 4 06 85 - 5 06 86 - 6
06 87 - 7 06 88 - 8 06 89 - 9 06 8A - *
06 8B - © 06 8C - : 06 8D - . 06 8E - A
06 8F - B 06 90 - C 06 91 - D 06 92 - E
06 93 - F 06 94 - G 06 95 - H 06 96 - I
06 97 - J 06 98 - K 06 99 - L 06 9A - M
06 9B - N 06 9C - O 06 9D - P 06 9E - Q
06 9F - R 06 A0 - S 06 A1 - T 06 A2 - U
06 A3 - V 06 A4 - W 06 A5 - X 06 A6 - Y
06 A7 - Z

Credits/Intro Text

Now that we have gotten all the basic text editing information out of the way, we can now learn how to edit the larger font text. This uses X and Y coordinates to place the character on the screen rather than just using a fixed font. Here are the instructions for editing the intro screen and the credits.

003A30 - Pointer to screen 1 information (intro)
00A016 - Pointer to data pointers for each screen (credits)

00B2B0 - Screen 1 information (intro)
00B2CA - Data pointers for each screen (credits)
00B322 - Screen 1 information (credits)

This is the format for laying pieces out onto the screen. This will not edit the actual text though.

FORMAT:

  1. 1 #2 #3 #4 #5 #6

1+2+3+4 - 32-bit address for text location
5 - Every time this value changes every 2 values, it will move on the Y axis 3 characters (24 pixels)
6 - Every time this value changes every 2 values, it will move on the X axis ½ characters (8 pixels). Every 80 changes in value will move on the Y axis 1 character (8 pixels).

For text, it works by placing 8x8 tiles together to make up the text.

Intro Text Format

00 - Space 01 & 02 - A 03 & 04 - B 05 & 06 - C
07 & 08 - D 09 & 0A - E 0B & 0C - F 0D & 0E - G
0F & 10 - H 11 - I 12 & 13 - J 14 & 15 - K
16 & 17 - L 18 & 19 - M 1A & 1B - N 1C & 1D - O
1E & 1F - P 20 & 21 - Q 22 & 23 - R 24 & 25 - S
26 & 27 - T 28 & 29 - U 2A & 2B - V 2C & 2D - W
2E & 2F - X 30 & 31 - Y 32 & 33 - Z 34 & 35 - 2
36 - ( 37 - ) 38 - " 39 - .
3A - © 3B & 3C - 1 3D & 3E - 9 3F & 40 - :

Credits Text Format

00 or 01 - Space 02 & 03 - A 04 & 05 - B 06 & 07 - C
08 & 09 - D 0A & 0B - E 0C & 0D - F 0E & 0F - G
10 & 11 - H 12 - I 13 & 14 - J 15 & 16 - K
17 & 18 - L 19 & 1A - M 1B & 1C - N 1D & 1E - O
1F & 20 - P 21 & 22 - Q 23 & 24 - R 25 & 26 - S
27 & 28 - T 29 & 2A - U 2B & 2C - V 2D & 2E - W
2F & 30 - X 31 & 32 - Y 33 & 34 - Z 35 & 36 - 2
37 - ( 38 - ) 39 - " 3A - .
3B - © 3C & 3D - 1 3E & 3F - 9 40 & 41 - :

Look in the games VRAM (patterns) to get the full listing of each character.

On text strings, FF is a separator that tells it to stop reading further. After FF, the next byte tells what palette info to use. This goes in 32's for each palette. This goes in 1's for change in tile set (move down the list of tiles every 256 tiles per every change in value). Use 00, 20, 40, and 60 for the credits and use 05, 25, 45, and 65 for the intro.

Title Card Text

Pointer(8 - bit, relative to first entry) Offset Text String
$15820, $15821, $15822, $15823, $15829 $15832-1583F (E)m(e)rald( )Hi(ll)
$15824, $15825 $15842-1584F M(e)tr(o)p(o)lis
$15827 $15852-1585B Hil(l )T(o)p
$15828 $1585E-1586B Hid(den )Palac(e)
$1582A $1586E-15875 (O)il( O)c(e)a(n)
$1582B $15878-15887 Mystic( )Cav(e)
$1582C $1588A-15897 Casi(no )(N)ight
$1582D $1589A-158A9 Ch(e)mical( )Pla(n)t
$1582F $158AC-158B9 Aquatic( )Rui(n)
$15830 $158BC-158C7 Sky( )Chas(e)
$15826 $158CA-158D7 Wi(n)g( )F(o)rtr(e)s(s)
$1582E $158DA-158E3 D(e)ath( )(E)gg

The above locations hold information that tells the game what sprites to load for the specific level splash text. Below is a list of all the characters you can choose from and what their values are.

00 - A 04 - B 08 - C 0C - D
10 - F 14 - G 18 - H 1C - I
1E - J 22 - K 26 - L 2A - M
30 - P 34 - Q 38 - R 3C - S
40 - T 44 - U 48 - V 4C - W
52 - X 56 - Y 5A - . FF FF - End of string

Now down to business. First off, you need to understand that E, N, O, Z (spells Zone), and space are not with this text editing section. They are in another section in which will be discussed after these notes. It is important that you understand the format. Here is how it works.

FORMAT:

  1. 1 #2

1 - Character
2 - Length that the character is drawn

Characters that are present more that once only show up once. This is because this stuff is only the info to tell what loads at startup and doesn't need to load the same thing twice since its already there. Here is a list of where all the strings are located.

Now, you will want to edit the actual strings and not just the sprites that load. So, here are the notes you need.

FORMAT:

  1. 1 #2 #3 #4 #5 #6 #7 #8

1 - Y position of the character every pixel (signed byte, relative to top of string)
2 - Length (going by the character size bytes gives a corrected length)
3 and 4 - VRAM location of character (1 Player)
5 and 6 - VRAM location of character (2 Player)
7 and 8 - X position of the character every pixel (signed word, relative to left of string)

Now, remember that there is a 2 byte header for each string that tells how many characters to read. Now you will probably want the location that allows you to change what string is used for each level. So, here it is.

0147BA - 2 bytes for location after this location for each level

Here is how each string is listed.

Level 00
Level 01
Level 02
Level 03
Level 04
Level 05
Level 06
Level 07
Level 08
Level 09
Level 0A
Level 0B
Level 0C
Level 0D
Level 0E
Level 0F
Level 10
"Zone"
1
2
3
"Sonic The Hedgehog"
Red splash screen panel edges

Now, you need to know what value to give each character. Here are the values.

8580 (or, 82C0 for 2 Player) - E
8584 (or, 82C2 for 2 Player) - N
8588 (or, 82C4 for 2 Player) - O
858C (or, 82C6 for 2 Player) - Z
85DE+ (or, 82EF+ for 2 Player) - Character list (see "Level Splash Startup" above)

2 Player size is always half the size in the "Level Splash Startup" above.

Splash Screen Panel: 014C32

Sonic Community Hacking Guide
General
SonED2 Manual | Subroutine Equivalency List
Game-Specific
Sonic the Hedgehog (16-bit) | Sonic the Hedgehog (8-bit) | Sonic CD (prototype 510) | Sonic CD | Sonic CD (PC) | Sonic CD (2011) | Sonic 2 (Simon Wai prototype) | Sonic 2 (16-bit) | Sonic 2 (Master System) | Sonic 3 | Sonic 3 & Knuckles | Chaotix | Sonic Jam | Sonic Jam 6 | Sonic Adventure | Sonic Adventure DX: Director's Cut | Sonic Adventure DX: PC | Sonic Adventure (2010) | Sonic Adventure 2 | Sonic Adventure 2: Battle | Sonic Adventure 2 (PC) | Sonic Heroes | Sonic Riders | Sonic the Hedgehog (2006) | Sonic & Sega All-Stars Racing | Sonic Unleashed (Xbox 360/PS3) | Sonic Colours | Sonic Generations | Sonic Forces
Technical information
Sonic Eraser | Sonic 2 (Nick Arcade prototype) | Sonic CD (prototype; 1992-12-04) | Dr. Robotnik's Mean Bean Machine | Sonic Triple Trouble | Tails Adventures | Sonic Crackers | Sonic 3D: Flickies' Island | Sonic & Knuckles Collection | Sonic R | Sonic Shuffle | Sonic Advance | Sonic Advance 3 | Sonic Battle | Shadow the Hedgehog | Sonic Rush | Sonic Classic Collection | Sonic Free Riders | Sonic Lost World
Legacy Guides
The Nemesis Hacking Guides The Esrael Hacking Guides
ROM: Sonic 1 | Sonic 2 | Sonic 2 Beta | Sonic 3

Savestate: Sonic 1 | Sonic 2 Beta/Final | Sonic 3

Sonic 1 (English / Portuguese) | Sonic 2 Beta (English / Portuguese) | Sonic 2 and Knuckles (English / Portuguese)
Move to Sega Retro
Number Systems (or scrap) | Assembly Hacking Guide | 68000 Instruction Set | 68000 ASM-to-Hex Code Reference | SMPS Music Hacking Guide | Mega Drive technical information