Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #inserts all text into FE3
- #expects intro text at intro.dump
- use Insert;
- use rmheader;
- use insertfont;
- die "Usage: insertall.pl original.smc finished.smc" unless @ARGV == 2;
- my $original = shift @ARGV;
- my $output = shift @ARGV;
- #clobber whatever is in $output
- open OUTPUT, ">$output" or die;
- close OUTPUT;
- #set up output
- rmheader::rmheader( $original, $output );
- insertfont::insertfont( $output, "font.insert" );
- #dump intro conversations
- my $ready = 0;
- my $temp = "temp.dump";
- my $ptr_index;
- my $txt_pos = "3000A0";
- my $position;
- open INTRO, "intro.dump" or die;
- while ( <INTRO> ) {
- if ( /^\[META*/ ) {
- #metadata line - either telling us the ptr_index, or useless
- if ( / = / ) {
- $line = $_;
- #if we're ready, insert!
- if ( $ready ) {
- print "Inserting $ptr_index at $txt_pos\n";
- close TEMP;
- if ( $ptr_index != 42 ) {
- $position =
- Insert::intro( $temp, $output, "300000",
- $ptr_index, $txt_pos );
- $txt_pos = sprintf "%.6x", hex( $txt_pos ) + $position;
- } else {
- #this part should always be written at 0x2e7243
- $temp_pos = "2e7243";
- close TEMP;
- $position = Insert::intro(
- $temp, $output, "300000", $ptr_index, $temp_pos );
- }
- }
- #start the next insertion
- open TEMP, ">$temp" or die;
- $line =~ / = ([0-9]*)/;
- $ptr_index = $1;
- $ready = 1;
- print "Next pointer to insert: $ptr_index\n";
- }
- } else {
- #write the line to TEMP
- print TEMP;
- }
- }
- print "Inserting $ptr_index at $txt_pos\n";
- close TEMP;
- #always write this at 0x2e305a
- $position = Insert::intro( $temp, $output, "300000", $ptr_index, "2e3157" );
- close INTRO;
- #dump conversations
- $ready = 0;
- $temp = "temp.dump";
- $ptr_index = 1;
- open CONV, "conv.dump" or die;
- while ( <CONV> ) {
- if ( /^\[META*/ ) {
- #metadata line - either telling us the ptr_index, or useless
- if ( / = / ) {
- $line = $_;
- #if we're ready, insert!
- if ( $ready ) {
- print "Inserting $ptr_index at $txt_pos\n";
- close TEMP;
- $position =
- Insert::conv( $temp, $output, $ptr_index, "71213",
- $txt_pos, 3 );
- $txt_pos = sprintf "%.6x", hex( $txt_pos ) + $position;
- }
- #start the next insertion
- open TEMP, ">$temp" or die;
- $line =~ / = ([0-9]*)/;
- $ptr_index = $1;
- $ready = 1;
- }
- } else {
- #write the line to TEMP
- print TEMP;
- }
- }
- #the last conversation
- close TEMP;
- $position = Insert::conv( $temp, $output, $ptr_index, "71213", $txt_pos, 3 );
- $txt_pos = sprintf "%.6x", hex( $txt_pos ) + $position;
- #write the chapter headings - menu edition
- $first_byte = hex substr $txt_pos, 0, 2;
- $second_byte = hex substr $txt_pos, 2, 2;
- $first_byte = 2 * $first_byte;
- if ( $second_byte >= 0x80 ) {
- $first_byte++;
- }
- $first_byte = sprintf "%.2x", $first_byte;
- Insert::write_misc( $output, $first_byte, "24218" );
- $ready = 0;
- open CHAP, "24223.dump" or die;
- while ( <CHAP> ) {
- if ( /^\[META*/ ) {
- #metadata line - either telling us the ptr_index, or useless
- if ( / = / ) {
- $line = $_;
- #if we're ready, insert!
- if ( $ready ) {
- print "Inserting $ptr_index at $txt_pos\n";
- close TEMP;
- $position =
- Insert::conv( $temp, $output, $ptr_index, "24223",
- $txt_pos, 2 );
- $txt_pos = sprintf "%.6x", hex( $txt_pos ) + $position;
- }
- #start the next insertion
- open TEMP, ">$temp" or die;
- $line =~ / = ([0-9]*)/;
- $ptr_index = $1;
- $ready = 1;
- print "Next pointer to insert: $ptr_index\n";
- }
- } else {
- #write the line to TEMP
- print TEMP;
- }
- }
- print "Inserting $ptr_index at $txt_pos\n";
- close CHAP;
- close TEMP;
- $position = Insert::conv( $temp, $output, $ptr_index, "24223", $txt_pos, 2 );
- $txt_pos = sprintf "%.6x", hex( $txt_pos ) + $position;
- #write the chapter headings - chapter intro edition
- $first_byte = hex substr $txt_pos, 0, 2;
- $second_byte = hex substr $txt_pos, 2, 2;
- $first_byte = 2 * $first_byte;
- if ( $second_byte >= 0x80 ) {
- $first_byte++;
- }
- $first_byte = sprintf "%.2x", $first_byte;
- #write the new subroutine that uses a different table for lookups
- Insert::write_misc( $output, "08c2300aaaa900" . $first_byte .
- "8504bf0082ee8503286b", "370100" );
- #have the chapter intros call this subroutine
- Insert::write_misc( $output, "0081ee", "026721" );
- $ready = 0;
- open CHAP, "24223.dump2" or die;
- while ( <CHAP> ) {
- if ( /^\[META*/ ) {
- #metadata line - either telling us the ptr_index, or useless
- if ( / = / ) {
- $line = $_;
- #if we're ready, insert!
- if ( $ready ) {
- print "Inserting $ptr_index at $txt_pos\n";
- close TEMP;
- $position =
- Insert::conv( $temp, $output, $ptr_index, "370200",
- $txt_pos, 2, 1 );
- $txt_pos = sprintf "%.6x", hex( $txt_pos ) + $position;
- }
- #start the next insertion
- open TEMP, ">$temp" or die;
- $line =~ / = ([0-9]*)/;
- $ptr_index = $1;
- $ready = 1;
- print "Next pointer to insert: $ptr_index\n";
- }
- } else {
- #write the line to TEMP
- print TEMP;
- }
- }
- print "Inserting $ptr_index at $txt_pos\n";
- close CHAP;
- close TEMP;
- $position = Insert::conv( $temp, $output, $ptr_index, "24223", $txt_pos, 2 );
- $txt_pos = sprintf "%.6x", hex( $txt_pos ) + $position;
- #write the delete/overwrite text
- $ready = 0;
- open DEL, "245bf.dump" or die;
- while ( <DEL> ) {
- if ( /^\[META*/ ) {
- #metadata line - either telling us the ptr_index, or useless
- if ( / = / ) {
- $line = $_;
- #if we're ready, insert!
- if ( $ready ) {
- print "Inserting $ptr_index at $txt_pos\n";
- close TEMP;
- $position =
- Insert::conv( $temp, $output, $ptr_index, "245bf",
- $txt_pos, 3 );
- $txt_pos = sprintf "%.6x", hex( $txt_pos ) + $position;
- }
- #start the next insertion
- open TEMP, ">$temp" or die;
- $line =~ / = ([0-9]*)/;
- $ptr_index = $1;
- $ready = 1;
- print "Next pointer to insert: $ptr_index\n";
- }
- } else {
- #write the line to TEMP
- print TEMP;
- }
- }
- print "Inserting $ptr_index at $txt_pos\n";
- close DEL;
- close TEMP;
- $position = Insert::conv( $temp, $output, $ptr_index, "245bf", $txt_pos, 3 );
- $txt_pos = sprintf "%.6x", hex( $txt_pos ) + $position;
- $ready = 0;
- open DEL, "24604.dump" or die;
- while ( <DEL> ) {
- if ( /^\[META*/ ) {
- #metadata line - either telling us the ptr_index, or useless
- if ( / = / ) {
- $line = $_;
- #if we're ready, insert!
- if ( $ready ) {
- print "Inserting $ptr_index at $txt_pos\n";
- close TEMP;
- $position =
- Insert::conv( $temp, $output, $ptr_index, "24604",
- $txt_pos, 3 );
- $txt_pos = sprintf "%.6x", hex( $txt_pos ) + $position;
- }
- #start the next insertion
- open TEMP, ">$temp" or die;
- $line =~ / = ([0-9]*)/;
- $ptr_index = $1;
- $ready = 1;
- print "Next pointer to insert: $ptr_index\n";
- }
- } else {
- #write the line to TEMP
- print TEMP;
- }
- }
- print "Inserting $ptr_index at $txt_pos\n";
- close DEL;
- close TEMP;
- $position = Insert::conv( $temp, $output, $ptr_index, "24604", $txt_pos, 3 );
- $txt_pos = sprintf "%.6x", hex( $txt_pos ) + $position;
- #insert the class roll
- Insert::write_misc( $output, "67", "3481e" );
- $ready = 0;
- open CLASS, "a9658.dump" or die;
- while ( <CLASS> ) {
- if ( /^\[META*/ ) {
- #metadata line - either telling us the ptr_index, or useless
- if ( / = / ) {
- $line = $_;
- #if we're ready, insert!
- if ( $ready ) {
- print "Inserting $ptr_index at $txt_pos\n";
- close TEMP;
- $position =
- Insert::conv( $temp, $output, $ptr_index, "a9658",
- $txt_pos, 3 );
- $txt_pos = sprintf "%.6x", hex( $txt_pos ) + $position;
- }
- #start the next insertion
- open TEMP, ">$temp" or die;
- $line =~ / = ([0-9]*)/;
- $ptr_index = $1;
- $ready = 1;
- print "Next pointer to insert: $ptr_index\n";
- }
- } else {
- #write the line to TEMP
- print TEMP;
- }
- }
- print "Inserting $ptr_index at $txt_pos\n";
- close CLASS;
- close TEMP;
- $position = Insert::conv( $temp, $output, $ptr_index, "a9658", $txt_pos, 3 );
- $txt_pos = sprintf "%.6x", hex( $txt_pos ) + $position;
- #insert the scrolling intro
- $first_byte = hex substr $txt_pos, 0, 2;
- $second_byte = hex substr $txt_pos, 2, 2;
- $first_byte = 2 * $first_byte;
- if ( $second_byte >= 0x80 ) {
- $first_byte++;
- }
- $first_byte = sprintf "%.2x", $first_byte;
- Insert::write_misc( $output, $first_byte, "6facf" );
- $ready = 0;
- open SCROLL, "6fb45.dump" or die;
- while ( <SCROLL> ) {
- if ( /^\[META*/ ) {
- #metadata line - either telling us the ptr_index, or useless
- if ( / = / ) {
- $line = $_;
- #if we're ready, insert!
- if ( $ready ) {
- print "Inserting $ptr_index at $txt_pos\n";
- close TEMP;
- $position =
- Insert::conv( $temp, $output, $ptr_index, "6fb45",
- $txt_pos, 2, 2 );
- $txt_pos = sprintf "%.6x", hex( $txt_pos ) + $position;
- }
- #start the next insertion
- open TEMP, ">$temp" or die;
- $line =~ / = ([0-9]*)/;
- $ptr_index = $1;
- $ready = 1;
- print "Next pointer to insert: $ptr_index\n";
- }
- } else {
- #write the line to TEMP
- print TEMP;
- }
- }
- print "Inserting $ptr_index at $txt_pos\n";
- close SCROLL;
- close TEMP;
- $position = Insert::conv( $temp, $output, $ptr_index, "6fb45", $txt_pos, 2, 2 );
- $txt_pos = sprintf "%.6x", hex( $txt_pos ) + $position;
- #insert shop dialogue
- $ready = 0;
- open SHOP, "701c4.dump" or die;
- while ( <SHOP> ) {
- if ( /^\[META*/ ) {
- #metadata line - either telling us the ptr_index, or useless
- if ( / = / ) {
- $line = $_;
- #if we're ready, insert!
- if ( $ready ) {
- print "Inserting $ptr_index at $txt_pos\n";
- close TEMP;
- $position =
- Insert::conv( $temp, $output, $ptr_index, "701c4",
- $txt_pos, 3 );
- $txt_pos = sprintf "%.6x", hex( $txt_pos ) + $position;
- }
- #start the next insertion
- open TEMP, ">$temp" or die;
- $line =~ / = ([0-9]*)/;
- $ptr_index = $1;
- $ready = 1;
- print "Next pointer to insert: $ptr_index\n";
- }
- } else {
- #write the line to TEMP
- print TEMP;
- }
- }
- print "Inserting $ptr_index at $txt_pos\n";
- close SHOP;
- close TEMP;
- $position = Insert::conv( $temp, $output, $ptr_index, "701c4", $txt_pos, 3 );
- $txt_pos = sprintf "%.6x", hex( $txt_pos ) + $position;
- #insert weapon names for the shop dialogue
- $first_byte = hex substr $txt_pos, 0, 2;
- $second_byte = hex substr $txt_pos, 2, 2;
- $first_byte = 2 * $first_byte;
- if ( $second_byte >= 0x80 ) {
- $first_byte++;
- }
- $first_byte = sprintf "%.2x", $first_byte;
- Insert::write_misc( $output, "220089ee60", "3d521" );
- Insert::write_misc( $output,
- "a50048a900${first_byte}85018d030f688d020f6b", "370900" );
- $ready = 0;
- open WEAP, "70c4a.dump" or die;
- while ( <WEAP> ) {
- if ( /^\[META*/ ) {
- #metadata line - either telling us the ptr_index, or useless
- if ( / = / ) {
- $line = $_;
- #if we're ready, insert!
- if ( $ready ) {
- print "Inserting $ptr_index at $txt_pos\n";
- close TEMP;
- $position =
- Insert::conv( $temp, $output, $ptr_index, "70c4a",
- $txt_pos, 2, 3 );
- $txt_pos = sprintf "%.6x", hex( $txt_pos ) + $position;
- }
- #start the next insertion
- open TEMP, ">$temp" or die;
- $line =~ / = ([0-9]*)/;
- $ptr_index = $1;
- $ready = 1;
- print "Next pointer to insert: $ptr_index\n";
- }
- } else {
- #write the line to TEMP
- print TEMP;
- }
- }
- print "Inserting $ptr_index at $txt_pos\n";
- close WEAP;
- close TEMP;
- $position = Insert::conv( $temp, $output, $ptr_index, "70c4a", $txt_pos, 2, 3 );
- $txt_pos = sprintf "%.6x", hex( $txt_pos ) + $position;
- #insert coliseum dialogue
- Insert::write_misc( $output, "bf00808e8500e8bf00808e8501ca6b", "370500" );
- Insert::write_misc( $output, "2200856eeaea", "3a48a" );
- $ready = 0;
- open COL, "70000.dump" or die;
- while ( <COL> ) {
- if ( /^\[META*/ ) {
- #metadata line - either telling us the ptr_index, or useless
- if ( / = / ) {
- $line = $_;
- #if we're ready, insert!
- if ( $ready ) {
- print "Inserting $ptr_index at $txt_pos\n";
- close TEMP;
- $position =
- Insert::conv( $temp, $output, $ptr_index, "70000",
- $txt_pos, 3 );
- $txt_pos = sprintf "%.6x", hex( $txt_pos ) + $position;
- }
- #start the next insertion
- open TEMP, ">$temp" or die;
- $line =~ / = ([0-9]*)/;
- $ptr_index = $1;
- $ready = 1;
- print "Next pointer to insert: $ptr_index\n";
- }
- } else {
- #write the line to TEMP
- print TEMP;
- }
- }
- print "Inserting $ptr_index at $txt_pos\n";
- close COL;
- close TEMP;
- $position = Insert::conv( $temp, $output, $ptr_index,
- "70000", $txt_pos, 3 );
- $txt_pos = sprintf "%.6x", hex( $txt_pos ) + $position;
- #insert the ending text
- Insert::write_misc( $output, "220080ff", "b5f8b" );
- Insert::write_misc( $output, "220080ff", "b61a4" );
- Insert::write_misc( $output, "8ba9ff48abb2008703ab6b", "3f8000" );
- $ready = 0;
- $backup = $txt_pos;
- $txt_pos = "3f8100";
- $ptr_index = -1;
- open ENDING, "endings3.dump" or die;
- while ( <ENDING> ) {
- if ( /^\[META*/ ) {
- #metadata line
- $line = $_;
- #if we're ready, insert!
- if ( $ready ) {
- print "Inserting $ptr_index at $txt_pos\n";
- close TEMP;
- $position =
- Insert::ending( $temp, $output, "b356a", $ptr_index,
- $txt_pos, 8 );
- $txt_pos = sprintf "%.6x", hex( $txt_pos ) + $position;
- }
- #start the next insertion
- open TEMP, ">$temp" or die;
- #print three padding spaces to temp
- $ptr_index++;
- $ready = 1;
- print "Next pointer to insert: $ptr_index\n";
- } else {
- #write the line to TEMP
- print TEMP;
- }
- }
- print "Inserting $ptr_index at $txt_pos\n";
- close ENDING;
- close TEMP;
- $position = Insert::ending( $temp, $output, "b356a", $ptr_index, $txt_pos, 8 );
- $txt_pos = sprintf "%.6x", hex( $txt_pos ) + $position;
- #insert the death text for endings
- Insert::write_misc( $output, "220080ff", "b618d" );
- $ready = 0;
- $ptr_index = -1;
- open ENDING2, "endings4.dump" or die;
- while ( <ENDING2> ) {
- if ( /^\[META*/ ) {
- #metadata line
- $line = $_;
- #if we're ready, insert!
- if ( $ready ) {
- print "Inserting $ptr_index at $txt_pos\n";
- close TEMP;
- $position =
- Insert::ending( $temp, $output, "b3842", $ptr_index,
- $txt_pos, 4 );
- $txt_pos = sprintf "%.6x", hex( $txt_pos ) + $position;
- }
- #start the next insertion
- open TEMP, ">$temp" or die;
- #print three padding spaces to temp
- $ptr_index++;
- $ready = 1;
- print "Next pointer to insert: $ptr_index\n";
- } else {
- #write the line to TEMP
- print TEMP;
- }
- }
- print "Inserting $ptr_index at $txt_pos\n";
- close ENDING2;
- close TEMP;
- $position = Insert::ending( $temp, $output, "b3842", $ptr_index, $txt_pos, 4 );
- $txt_pos = sprintf "%.6x", hex( $txt_pos ) + $position;
- #miscellaneous ending stuff
- Insert::write_misc( $output,
- "000100010001000f06101f2c2d29281b2631121f1d292c1e2d0000", "b39b0" );
- Insert::write_misc( $output, "b0b9", "b5d59" );
- Insert::write_misc( $output, "1700110c0011001131a0a0a0a0a005181000110000",
- "b3907" );
- Insert::write_misc( $output, "0001000100010f03142292e1b2631061f2626010000", "b3950");
- Insert::write_misc( $output, "50b9", "b5dcf" );
- Insert::write_misc( $output, "50b9", "b60f0" );
- Insert::write_misc( $output, "02292925313f31171b2c31292031081f2c291f2d", "b3970" );
- Insert::write_misc( $output, "70b9", "b5ac3" );
- Insert::write_misc( $output, "01281e312d2938312e23271f312a1b2d2d1f2d3939390000",
- "b3990" );
- Insert::write_misc( $output, "90b9", "b5a4a" );
- $position = Insert::ending( "b56a1.dump", $output, "b56a1", 0, $txt_pos, 4 );
- $txt_pos = sprintf "%.6x", hex( $txt_pos ) + $position;
- $position = Insert::ending( "b56c5.dump", $output, "b56c5", 0, $txt_pos, 4 );
- $txt_pos = sprintf "%.6x", hex( $txt_pos ) + $position;
- $position = Insert::ending( "b56f5.dump", $output, "b56f5", 0, $txt_pos, 4 );
- $txt_pos = sprintf "%.6x", hex( $txt_pos ) + $position;
- $position = Insert::ending( "b56fd.dump", $output, "b56fd", 0, $txt_pos, 4 );
- $txt_pos = sprintf "%.6x", hex( $txt_pos ) + $position;
- $position = Insert::ending( "b573d.dump", $output, "b573d", 0, $txt_pos, 4 );
- $txt_pos = sprintf "%.6x", hex( $txt_pos ) + $position;
- $position = Insert::ending( "b5741.dump", $output, "b5741", 0, $txt_pos, 4 );
- $txt_pos = sprintf "%.6x", hex( $txt_pos ) + $position;
- $txt_pos = $backup;
- #insert the ending chapter names
- $position = Insert::intro( "b205e.dump", $output, "b3158", 0, $txt_pos, 1 );
- $txt_pos = sprintf "%.6x", hex( $txt_pos ) + $position;
- $position = Insert::intro( "b23d5.dump", $output, "b306f", 0, $txt_pos, 1 );
- $txt_pos = sprintf "%.6x", hex( $txt_pos ) + $position;
- $position = Insert::intro( "b276c.dump", $output, "b2f4b", 0, $txt_pos, 1 );
- $txt_pos = sprintf "%.6x", hex( $txt_pos ) + $position;
- #insert the ending turn number positions
- $position = "b1fdc";
- $value = "0033";
- for (0..19) {
- $byte1 = substr $value, 0, 2;
- $byte2 = substr $value, 2, 2;
- Insert::write_misc( $output, $byte2 . $byte1, $position );
- $value = sprintf "%.4x", hex( $value ) + hex( "21" );
- $position = sprintf "%x", hex( $position ) + hex( "2" );
- }
- Insert::write_misc( $output, "c302", $position );
- $position = "b2006";
- $value = "0035";
- for (0..19) {
- $byte1 = substr $value, 0, 2;
- $byte2 = substr $value, 2, 2;
- Insert::write_misc( $output, $byte2 . $byte1, $position );
- $value = sprintf "%.4x", hex( $value ) + hex( "21" );
- $position = sprintf "%x", hex( $position ) + hex( "2" );
- }
- Insert::write_misc( $output, "c302", $position );
- $position = "b2030";
- $value = "0035";
- for (0..21) {
- $byte1 = substr $value, 0, 2;
- $byte2 = substr $value, 2, 2;
- Insert::write_misc( $output, $byte2 . $byte1, $position );
- $value = sprintf "%.4x", hex( $value ) + hex( "21" );
- $position = sprintf "%x", hex( $position ) + hex( "2" );
- }
- Insert::write_misc( $output, "0703", $position );
- #insert the ending intro (book 1)
- $first_byte = hex substr $txt_pos, 0, 2;
- $second_byte = hex substr $txt_pos, 2, 2;
- $third_byte = hex substr $txt_pos, 4, 2;
- $first_byte = 2 * $first_byte;
- if ( $second_byte < 0x80 ) {
- $second_byte += 0x80;
- } else {
- $first_byte++;
- }
- $bytes = sprintf "%.2x%.2x", $third_byte, $second_byte;
- $first_byte = sprintf "%.2x", $first_byte;
- $position = Insert::intro( "b114f.dump", $output, "b1150", 0, $txt_pos );
- Insert::write_misc( $output, "205391eaea", "b1b79" );
- Insert::write_misc( $output, "a900" . $first_byte . "8501" . "a9" . $bytes .
- "850060", "b1153" );
- $txt_pos = sprintf "%.6x", hex( $txt_pos ) + $position;
- #insert the ending intro (book 2 - missed finale)
- $first_byte = hex substr $txt_pos, 0, 2;
- $second_byte = hex substr $txt_pos, 2, 2;
- $third_byte = hex substr $txt_pos, 4, 2;
- $first_byte = 2 * $first_byte;
- if ( $second_byte < 0x80 ) {
- $second_byte += 0x80;
- } else {
- $first_byte++;
- }
- $bytes = sprintf "%.2x%.2x", $third_byte, $second_byte;
- $first_byte = sprintf "%.2x", $first_byte;
- $position = Insert::intro( "b11b6.dump", $output, "b1150", 0, $txt_pos );
- Insert::write_misc( $output, "205e91eaea", "b1b69" );
- Insert::write_misc( $output, "a900" . $first_byte . "8501" . "a9" . $bytes .
- "850060", "b115e" );
- $txt_pos = sprintf "%.6x", hex( $txt_pos ) + $position;
- #insert the ending intro (book 2 - with finale)
- $first_byte = hex substr $txt_pos, 0, 2;
- $second_byte = hex substr $txt_pos, 2, 2;
- $third_byte = hex substr $txt_pos, 4, 2;
- $first_byte = 2 * $first_byte;
- if ( $second_byte < 0x80 ) {
- $second_byte += 0x80;
- } else {
- $first_byte++;
- }
- $bytes = sprintf "%.2x%.2x", $third_byte, $second_byte;
- $first_byte = sprintf "%.2x", $first_byte;
- $position = Insert::intro( "b121b.dump", $output, "b1150", 0, $txt_pos, 2 );
- Insert::write_misc( $output, "206991eaea", "b1b59" );
- Insert::write_misc( $output, "a900" . $first_byte . "8501" . "a9" . $bytes .
- "850060", "b1169" );
- $txt_pos = sprintf "%.6x", hex( $txt_pos ) + $position;
- #insert the perfect ending
- $first_byte = hex substr $txt_pos, 0, 2;
- $second_byte = hex substr $txt_pos, 2, 2;
- $third_byte = hex substr $txt_pos, 4, 2;
- $first_byte = 2 * $first_byte;
- if ( $second_byte < 0x80 ) {
- $second_byte += 0x80;
- } else {
- $first_byte++;
- }
- $bytes = sprintf "%.2x%.2x", $third_byte, $second_byte;
- $first_byte = sprintf "%.2x", $first_byte;
- Insert::write_misc( $output, $bytes, "b6f74" );
- Insert::write_misc( $output, $first_byte, "b7778" );
- open PERFECT, "6c9d7.dump" or die;
- $ready = 0;
- $ptr_index = -1;
- while ( <PERFECT> ) {
- if ( /^\[META*/ ) {
- #metadata line
- $line = $_;
- #if we're ready, insert!
- if ( $ready ) {
- print "Inserting $ptr_index at $txt_pos\n";
- close TEMP;
- $position =
- Insert::intro( $temp, $output, $txt_pos, $ptr_index,
- $txt_pos, 3 );
- $txt_pos = sprintf "%.6x", hex( $txt_pos ) + $position;
- }
- #start the next insertion
- open TEMP, ">$temp" or die;
- #print three padding spaces to temp
- $ptr_index++;
- $ready = 1;
- print "Next pointer to insert: $ptr_index\n";
- } else {
- #write the line to TEMP
- print TEMP;
- }
- }
- print "Inserting $ptr_index at $txt_pos\n";
- close PERFECT;
- close TEMP;
- $position = Insert::intro( $temp, $output, $txt_pos, $ptr_index, $txt_pos, 3 );
- $txt_pos = sprintf "%.6x", hex( $txt_pos ) + $position;
- #insert the menu at the beginning of the game
- Insert::write_misc( $output, "121f2d2f271f310322310000", "360000" );
- Insert::write_misc( $output, "ec", "27ae2" );
- Insert::write_misc( $output, "0080", "27ae6" );
- Insert::write_misc( $output, "121f2d2e1b2c2e3103223100", "36000c" );
- Insert::write_misc( $output, "ec", "27b08" );
- Insert::write_misc( $output, "0c80", "27b0c" );
- Insert::write_misc( $output, "ec", "27ba0" );
- Insert::write_misc( $output, "0c80", "27ba4" );
- Insert::write_misc( $output, "0e1f3231071b271f31310000", "360018" );
- Insert::write_misc( $output, "ec", "27b2e" );
- Insert::write_misc( $output, "1880", "27b32" );
- Insert::write_misc( $output, "ec", "27bc6" );
- Insert::write_misc( $output, "1880", "27bca" );
- Insert::write_misc( $output, "ec", "27c38" );
- Insert::write_misc( $output, "1880", "27c3c" );
- Insert::write_misc( $output, "ec", "27c5e" );
- Insert::write_misc( $output, "1880", "27c62" );
- Insert::write_misc( $output, "03292a34310623261f310000", "360024" );
- Insert::write_misc( $output, "ec", "27b54" );
- Insert::write_misc( $output, "2480", "27b58" );
- Insert::write_misc( $output, "ec", "27bec" );
- Insert::write_misc( $output, "2480", "27bf0" );
- Insert::write_misc( $output, "052c1b2d1f310623261f0000", "360030" );
- Insert::write_misc( $output, "ec", "27b7a" );
- Insert::write_misc( $output, "3080", "27b7e" );
- Insert::write_misc( $output, "ec", "27c12" );
- Insert::write_misc( $output, "3080", "27c16" );
- #insert Empty for empty files
- Insert::write_misc( $output, "05272a2e34313131313131313131313131313131313131310000",
- "360042" );
- Insert::write_misc( $output, "ec", "24083" );
- Insert::write_misc( $output, "4280", "24087" );
- #insert "BXCHXX" for the chapter prologues/file select menu
- Insert::write_misc( $output, "0200110011c40300110011c4c4c40000", "26821" );
- Insert::write_misc( $output, "0200110011c40300110011c4c4c40000", "246b0" );
- Insert::write_misc( $output, "0200110011c40300110011c4c4c40000", "246c5" );
- Insert::write_misc( $output, "0200110011c40300110011c4c4c40000", "246d0" );
- Insert::write_misc( $output, "3e", "240e4" );
- #insert the book names
- Insert::write_misc( $output,
- "02292925313e31171b2c31292031041b2c25281f2d2d313131310000", "36005c" );
- Insert::write_misc( $output, "eaeaeaea", "27d93" );
- Insert::write_misc( $output, "ec", "27da3" );
- Insert::write_misc( $output, "5c80", "27da7" );
- Insert::write_misc( $output, "b8", "27dac" );
- Insert::write_misc( $output,
- "02292925313f31171b2c31292031081f2c291f2d3131313131310000", "360078" );
- Insert::write_misc( $output, "eaeaeaea", "27dd1" );
- Insert::write_misc( $output, "ec", "27de1" );
- Insert::write_misc( $output, "7880", "27de5" );
- Insert::write_misc( $output, "b8", "27dea" );
- #insert yes/no for overwriting files
- Insert::write_misc( $output, "191f2d0000", "24664" );
- Insert::write_misc( $output, "0e29310000", "2466a" );
- #insert the truncation for classes in the battle screen
- Insert::write_misc( $output,
- "088ba00000b700c9fffff010c00a00f00b200084e603e603c8c880e998186d18108d1810ab286b",
- "370300" );
- Insert::write_misc( $output,
- "da5a0a0aaaa00000bff89a8b29ffc305069703a04000bffa9a8b29ffc3050697037afa60",
- "370400" );
- Insert::write_misc( $output,
- "088b840029ff000aa8b7008500e220a97e8505c2208a1869fe408503a00000" .
- "b70329003c85062200836eab2860",
- "37f67" );
- Insert::write_misc( $output, "67ff", "3175f" );
- Insert::write_misc( $output, "67ff", "317c2" );
- #insert the menus
- Insert::write_misc( $output, "00806e", "3b15e" );
- Insert::write_misc( $output, "00806e", "3b17a" );
- #insert the character names
- Insert::write_misc( $output, "0080", "8617" );
- Insert::write_misc( $output, "008b6e", "861b" );
- Insert::write_misc( $output, "0080", "923a" );
- Insert::write_misc( $output, "00806e", "923e" );
- Insert::write_misc( $output, "0080", "a86c" );
- Insert::write_misc( $output, "00806e", "a871" );
- Insert::write_misc( $output, "0080", "c5da" );
- Insert::write_misc( $output, "00806e", "c5e1" );
- Insert::write_misc( $output, "0080", "cb3f" );
- Insert::write_misc( $output, "00806e", "cb46" );
- Insert::write_misc( $output, "f0", "31746" );
- Insert::write_misc( $output, "0080", "31750" );
- Insert::write_misc( $output, "f0", "317a9" );
- Insert::write_misc( $output, "0080", "317b3" );
- Insert::write_misc( $output, "f0", "330bc" );
- Insert::write_misc( $output, "0080", "330c0" );
- Insert::write_misc( $output, "0080", "39f4b" );
- Insert::write_misc( $output, "f0", "39f6f" );
- Insert::write_misc( $output, "0080f0", "39f7b" );
- Insert::write_misc( $output, "0080", "3a675" );
- Insert::write_misc( $output, "0080f0", "3a6af" );
- $position = Insert::menu( "char.dump", $output, "380000", 142 );
- #insert the class names
- $second_byte = hex substr $position, 2, 2;
- $third_byte = hex substr $position, 4, 2;
- if ( $second_byte < 0x80 ) {
- $second_byte += 0x80;
- }
- $bytes = sprintf "%.2x%.2x", $third_byte, $second_byte;
- Insert::write_misc( $output, $bytes, "a3de" );
- Insert::write_misc( $output, "00806e", "a3e1" );
- Insert::write_misc( $output, $bytes, "c5e7" );
- Insert::write_misc( $output, "00806e", "c5ee" );
- Insert::write_misc( $output, $bytes, "cb4c" );
- Insert::write_misc( $output, "00806e", "cb53" );
- Insert::write_misc( $output, "f0", "3182c" );
- Insert::write_misc( $output, $bytes, "31832" );
- Insert::write_misc( $output, "f0", "3185e" );
- Insert::write_misc( $output, $bytes, "31864" );
- Insert::write_misc( $output, "f0", "33101" );
- Insert::write_misc( $output, $bytes, "33105" );
- $position = Insert::menu( "class.dump", $output, $position, 45 );
- #insert the special battle class names
- $second_byte = hex substr $position, 2, 2;
- $third_byte = hex substr $position, 4, 2;
- if ( $second_byte < 0x80 ) {
- $second_byte += 0x80;
- }
- $bytes = sprintf "%.2x%.2x", $third_byte, $second_byte;
- Insert::write_misc( $output, "f0", "31821" );
- Insert::write_misc( $output, $bytes, "31825" );
- $position = Insert::menu( "43297.dump", $output, $position, 9 );
- #insert the long version of knight names
- $second_byte = hex substr $position, 2, 2;
- $third_byte = hex substr $position, 4, 2;
- if ( $second_byte < 0x80 ) {
- $second_byte += 0x80;
- }
- $bytes = sprintf "%.2x%.2x", $third_byte, $second_byte;
- Insert::write_misc( $output, "f0", "31851" );
- Insert::write_misc( $output, $bytes, "31855" );
- $position = Insert::menu( "4330b.dump", $output, $position, 4 );
- #insert the weapon/item names
- $second_byte = hex substr $position, 2, 2;
- $third_byte = hex substr $position, 4, 2;
- if ( $second_byte < 0x80 ) {
- $second_byte += 0x80;
- }
- $bytes = sprintf "%.2x%.2x", $third_byte, $second_byte;
- Insert::write_misc( $output, $bytes, "971f" );
- Insert::write_misc( $output, "00806e", "9725" );
- Insert::write_misc( $output, $bytes, "9b96" );
- Insert::write_misc( $output, "00806e", "9b99" );
- Insert::write_misc( $output, $bytes, "a3ff" );
- Insert::write_misc( $output, "00806e", "a402" );
- Insert::write_misc( $output, $bytes, "b2c0" );
- Insert::write_misc( $output, "00806e", "b2c4" );
- Insert::write_misc( $output, $bytes, "c600" );
- Insert::write_misc( $output, "00806e", "c607" );
- Insert::write_misc( $output, $bytes, "c699" );
- Insert::write_misc( $output, "00806e", "c69c" );
- Insert::write_misc( $output, $bytes, "c73e" );
- Insert::write_misc( $output, "00806e", "c741" );
- Insert::write_misc( $output, $bytes, "c866" );
- Insert::write_misc( $output, "00806e", "c86b" );
- Insert::write_misc( $output, $bytes, "ca26" );
- Insert::write_misc( $output, "00806e", "ca29" );
- Insert::write_misc( $output, $bytes, "da36" );
- Insert::write_misc( $output, "00806e", "da39" );
- Insert::write_misc( $output, $bytes, "db49" );
- Insert::write_misc( $output, "00806e", "db4f" );
- Insert::write_misc( $output, $bytes, "ed68" );
- Insert::write_misc( $output, "00806e", "ed6e" );
- Insert::write_misc( $output, $bytes, "edac" );
- Insert::write_misc( $output, "00806e", "edb2" );
- Insert::write_misc( $output, "f0", "31763" );
- Insert::write_misc( $output, $bytes, "31775" );
- Insert::write_misc( $output, "f0", "317c6" );
- Insert::write_misc( $output, $bytes, "317d8" );
- Insert::write_misc( $output, "f0", "330e7" );
- Insert::write_misc( $output, $bytes, "330eb" );
- Insert::write_misc( $output, $bytes, "3ae45" );
- Insert::write_misc( $output, "00806e", "3ae4b" );
- $position = Insert::menu ( "weapon.dump", $output, $position, 127 );
- #$position = Insert::menu ( "weapon.dump", $output, "5df58", 127 );
- #insert the weapon/item descriptions
- $second_byte = hex substr $position, 2, 2;
- $third_byte = hex substr $position, 4, 2;
- if ( $second_byte < 0x80 ) {
- $second_byte += 0x80;
- }
- $bytes = sprintf "%.2x%.2x", $third_byte, $second_byte;
- Insert::write_misc( $output, $bytes, "c1e8" );
- Insert::write_misc( $output, "00806e", "c1eb" );
- Insert::write_misc( $output, $bytes, "e74d" );
- Insert::write_misc( $output, "00806e", "e753" );
- Insert::write_misc( $output, $bytes, "e792" );
- Insert::write_misc( $output, "00806e", "e798" );
- $position = Insert::menu( "desc.dump", $output, $position, 129 );
- #insert the chapter names
- $second_byte = hex substr $position, 2, 2;
- $third_byte = hex substr $position, 4, 2;
- if ( $second_byte < 0x80 ) {
- $second_byte += 0x80;
- }
- $bytes = sprintf "%.2x%.2x", $third_byte, $second_byte;
- Insert::write_misc( $output, $bytes, "9a0a" );
- Insert::write_misc( $output, "00806e", "9a10" );
- $position = Insert::menu( "5c94e.dump", $output, $position, 45 );
- #insert the objectives
- $second_byte = hex substr $position, 2, 2;
- $third_byte = hex substr $position, 4, 2;
- if ( $second_byte < 0x80 ) {
- $second_byte += 0x80;
- }
- $bytes = sprintf "%.2x%.2x", $third_byte, $second_byte;
- Insert::write_misc( $output, $bytes, "9ad0" );
- Insert::write_misc( $output, "00806e", "9ad6" );
- $position = Insert::menu( "5d036.dump", $output, $position, 45 );
- #insert the terrain
- $second_byte = hex substr $position, 2, 2;
- $third_byte = hex substr $position, 4, 2;
- if ( $second_byte < 0x80 ) {
- $second_byte += 0x80;
- }
- $bytes = sprintf "%.2x%.2x", $third_byte, $second_byte;
- Insert::write_misc( $output, $bytes, "dc5d" );
- Insert::write_misc( $output, "00806e", "dc61" );
- $position = Insert::menu( "5f48e.dump", $output, $position, 162 );
- #insert the (character) menus
- $second_byte = hex substr $position, 2, 2;
- $third_byte = hex substr $position, 4, 2;
- if ( $second_byte < 0x80 ) {
- $second_byte += 0x80;
- }
- $bytes = sprintf "%.2x%.2x", $third_byte, $second_byte;
- Insert::write_misc( $output, $bytes, "ba08" );
- Insert::write_misc( $output, "00806e", "ba0d" );
- Insert::write_misc( $output, $bytes, "ba4a" );
- Insert::write_misc( $output, "00806e", "ba4f" );
- Insert::write_misc( $output, $bytes, "baa1" );
- Insert::write_misc( $output, "00806e", "baa4" );
- $position = Insert::menu( "5aae6.dump", $output, $position, 24 );
- #insert the character status screen
- $second_byte = hex substr $position, 2, 2;
- $third_byte = hex substr $position, 4, 2;
- if ( $second_byte < 0x80 ) {
- $second_byte += 0x80;
- }
- $bytes = sprintf "%.2x%.2x", $third_byte, $second_byte;
- Insert::write_misc( $output, $bytes, "cb59" );
- Insert::write_misc( $output, "00806e", "cb5f" );
- Insert::write_misc( $output, $bytes, "ce66" );
- Insert::write_misc( $output, "00806e", "ce6b" );
- Insert::write_misc( $output, $bytes, "cf3a" );
- Insert::write_misc( $output, "00806e", "cf3d" );
- Insert::write_misc( $output, $bytes, "cf7b" );
- Insert::write_misc( $output, "00806e", "cf80" );
- Insert::write_misc( $output, $bytes, "d09c" );
- Insert::write_misc( $output, "00806e", "d0a2" );
- $position = Insert::menu( "5ad32.dump", $output, $position, 16 );
- #insert the menu
- $second_byte = hex substr $position, 2, 2;
- $third_byte = hex substr $position, 4, 2;
- if ( $second_byte < 0x80 ) {
- $second_byte += 0x80;
- }
- $bytes = sprintf "%.2x%.2x", $third_byte, $second_byte;
- Insert::write_misc( $output, $bytes, "9853" );
- Insert::write_misc( $output, "00806e", "e2de" );
- Insert::write_misc( $output, $bytes, "99fa" );
- Insert::write_misc( $output, "00806e", "9a00" );
- Insert::write_misc( $output, $bytes, "a8ff" );
- Insert::write_misc( $output, "00806e", "a90c" );
- Insert::write_misc( $output, $bytes, "a9d7" );
- Insert::write_misc( $output, "00806e", "a9dc" );
- Insert::write_misc( $output, $bytes, "aa22" );
- Insert::write_misc( $output, "00806e", "aa28" );
- Insert::write_misc( $output, $bytes, "e97f" );
- Insert::write_misc( $output, "00806e", "e985" );
- Insert::write_misc( $output, $bytes, "eabc" );
- Insert::write_misc( $output, "00806e", "eac2" );
- Insert::write_misc( $output, $bytes, "eb4f" );
- Insert::write_misc( $output, "00806e", "eb55" );
- $position = Insert::menu( "59fea.dump", $output, $position, 14 );
- #insert the unit menu
- $second_byte = hex substr $position, 2, 2;
- $third_byte = hex substr $position, 4, 2;
- if ( $second_byte < 0x80 ) {
- $second_byte += 0x80;
- }
- $bytes = sprintf "%.2x%.2x", $third_byte, $second_byte;
- Insert::write_misc( $output, $bytes, "a2a8" );
- Insert::write_misc( $output, "00806e", "a2ae" );
- Insert::write_misc( $output, $bytes, "a2b5" );
- Insert::write_misc( $output, "00806e", "a2bf" );
- $position = Insert::menu( "5b46a.dump", $output, $position, 5 );
- #insert the trade/select menus
- $second_byte = hex substr $position, 2, 2;
- $third_byte = hex substr $position, 4, 2;
- if ( $second_byte < 0x80 ) {
- $second_byte += 0x80;
- }
- $bytes = sprintf "%.2x%.2x", $third_byte, $second_byte;
- Insert::write_misc( $output, $bytes, "845f" );
- Insert::write_misc( $output, "00806e", "8466" );
- Insert::write_misc( $output, $bytes, "8486" );
- Insert::write_misc( $output, "00806e", "848b" );
- Insert::write_misc( $output, $bytes, "8efe" );
- Insert::write_misc( $output, "00806e", "8f04" );
- Insert::write_misc( $output, $bytes, "9626" );
- Insert::write_misc( $output, "00806e", "962b" );
- $position = Insert::menu( "5c638.dump", $output, $position, 6 );
- #insert the options menu
- $second_byte = hex substr $position, 2, 2;
- $third_byte = hex substr $position, 4, 2;
- if ( $second_byte < 0x80 ) {
- $second_byte += 0x80;
- }
- $bytes = sprintf "%.2x%.2x", $third_byte, $second_byte;
- Insert::write_misc( $output, $bytes, "9c3a" );
- Insert::write_misc( $output, $bytes, "9c8c" );
- $position = Insert::menu( "5bdd6.dump", $output, $position, 6 );
- #insert the shop menus
- $second_byte = hex substr $position, 2, 2;
- $third_byte = hex substr $position, 4, 2;
- if ( $second_byte < 0x80 ) {
- $second_byte += 0x80;
- }
- $bytes = sprintf "%.2x%.2x", $third_byte, $second_byte;
- Insert::write_misc( $output, $bytes, "3937a" );
- Insert::write_misc( $output, "00806e", "39380" );
- Insert::write_misc( $output, $bytes, "3965a" );
- Insert::write_misc( $output, "00806e", "3965f" );
- $position = Insert::menu( "5bcca.dump", $output, $position, 5 );
- #insert the pre-chapter menu
- $second_byte = hex substr $position, 2, 2;
- $third_byte = hex substr $position, 4, 2;
- if ( $second_byte < 0x80 ) {
- $second_byte += 0x80;
- }
- $bytes = sprintf "%.2x%.2x", $third_byte, $second_byte;
- Insert::write_misc( $output, $bytes, "8072" );
- Insert::write_misc( $output, "00806e", "8078" );
- $position = Insert::menu( "59f64.dump", $output, $position, 1 );
- #insert "door opened!"
- $second_byte = hex substr $position, 2, 2;
- $third_byte = hex substr $position, 4, 2;
- if ( $second_byte < 0x80 ) {
- $second_byte += 0x80;
- }
- $bytes = sprintf "%.2x%.2x", $third_byte, $second_byte;
- Insert::write_misc( $output, $bytes, "3a1b6" );
- Insert::write_misc( $output, "00806e", "3a1b9" );
- $position = Insert::menu( "59f64.dump", $output, $position, 1 );
- #insert the turn switch menu
- $second_byte = hex substr $position, 2, 2;
- $third_byte = hex substr $position, 4, 2;
- if ( $second_byte < 0x80 ) {
- $second_byte += 0x80;
- }
- $bytes = sprintf "%.2x%.2x", $third_byte, $second_byte;
- Insert::write_misc( $output, $bytes, "c2f6" );
- Insert::write_misc( $output, "00806e", "c2f9" );
- $position = Insert::menu( "5d0fa.dump", $output, $position, 3 );
- #insert take/store/discard
- $second_byte = hex substr $position, 2, 2;
- $third_byte = hex substr $position, 4, 2;
- if ( $second_byte < 0x80 ) {
- $second_byte += 0x80;
- }
- $bytes = sprintf "%.2x%.2x", $third_byte, $second_byte;
- Insert::write_misc( $output, $bytes, "af66" );
- Insert::write_misc( $output, "00806e", "af6b" );
- $position = Insert::menu( "5c4bc.dump", $output, $position, 1 );
- #insert the battle animation menu
- $second_byte = hex substr $position, 2, 2;
- $third_byte = hex substr $position, 4, 2;
- if ( $second_byte < 0x80 ) {
- $second_byte += 0x80;
- }
- $bytes = sprintf "%.2x%.2x", $third_byte, $second_byte;
- Insert::write_misc( $output, $bytes, "c434" );
- Insert::write_misc( $output, "00806e", "c439" );
- Insert::write_misc( $output, $bytes, "c463" );
- $position = Insert::menu( "5c010.dump", $output, $position, 2 );
- #insert the item menu
- $second_byte = hex substr $position, 2, 2;
- $third_byte = hex substr $position, 4, 2;
- if ( $second_byte < 0x80 ) {
- $second_byte += 0x80;
- }
- $bytes = sprintf "%.2x%.2x", $third_byte, $second_byte;
- Insert::write_misc( $output, $bytes, "bb06" );
- Insert::write_misc( $output, "00806e", "bb0c" );
- Insert::write_misc( $output, $bytes, "bb38" );
- Insert::write_misc( $output, "00806e", "bb3b" );
- Insert::write_misc( $output, $bytes, "bb64" );
- Insert::write_misc( $output, "00806e", "bb6a" );
- $position = Insert::menu( "5acc6.dump", $output, $position, 6 );
- #insert the discard menu
- $second_byte = hex substr $position, 2, 2;
- $third_byte = hex substr $position, 4, 2;
- if ( $second_byte < 0x80 ) {
- $second_byte += 0x80;
- }
- $bytes = sprintf "%.2x%.2x", $third_byte, $second_byte;
- Insert::write_misc( $output, $bytes, "9253" );
- Insert::write_misc( $output, "00806e", "9259" );
- Insert::write_misc( $output, $bytes, "926e" );
- Insert::write_misc( $output, "00806e", "9274" );
- Insert::write_misc( $output, $bytes, "9705" );
- Insert::write_misc( $output, "00806e", "970b" );
- Insert::write_misc( $output, $bytes, "9729" );
- Insert::write_misc( $output, "00806e", "972f" );
- Insert::write_misc( $output, $bytes, "9b75" );
- Insert::write_misc( $output, "00806e", "9b7b" );
- Insert::write_misc( $output, $bytes, "a898" );
- Insert::write_misc( $output, "00806e", "a89b" );
- Insert::write_misc( $output, $bytes, "b2a6" );
- Insert::write_misc( $output, "00806e", "b2ac" );
- Insert::write_misc( $output, $bytes, "b2c8" );
- Insert::write_misc( $output, "00806e", "b2ce" );
- Insert::write_misc( $output, $bytes, "c716" );
- Insert::write_misc( $output, "00806e", "c71b" );
- Insert::write_misc( $output, $bytes, "c7b6" );
- Insert::write_misc( $output, "00806e", "c7bb" );
- Insert::write_misc( $output, $bytes, "ca8f" );
- Insert::write_misc( $output, "00806e", "ca95" );
- Insert::write_misc( $output, $bytes, "db34" );
- Insert::write_misc( $output, "00806e", "db39" );
- $position = Insert::menu( "5a9bc.dump", $output, $position, 6 );
- #insert a miscellaneous menu
- $second_byte = hex substr $position, 2, 2;
- $third_byte = hex substr $position, 4, 2;
- if ( $second_byte < 0x80 ) {
- $second_byte += 0x80;
- }
- $bytes = sprintf "%.2x%.2x", $third_byte, $second_byte;
- Insert::write_misc( $output, $bytes, "9b0a" );
- Insert::write_misc( $output, "00806e", "9b10" );
- Insert::write_misc( $output, $bytes, "c151" );
- Insert::write_misc( $output, "00806e", "c157" );
- Insert::write_misc( $output, $bytes, "c5c0" );
- Insert::write_misc( $output, "00806e", "c5c6" );
- Insert::write_misc( $output, $bytes, "c90a" );
- Insert::write_misc( $output, "00806e", "c910" );
- Insert::write_misc( $output, $bytes, "da43" );
- Insert::write_misc( $output, "00806e", "da46" );
- Insert::write_misc( $output, $bytes, "dc79" );
- Insert::write_misc( $output, "00806e", "dc7f" );
- Insert::write_misc( $output, $bytes, "ee34" );
- Insert::write_misc( $output, "00806e", "ee3a" );
- Insert::write_misc( $output, $bytes, "3ae32" );
- Insert::write_misc( $output, "00806e", "3ae35" );
- Insert::write_misc( $output, $bytes, "3998f" );
- Insert::write_misc( $output, "00806e", "39995" );
- Insert::write_misc( $output, $bytes, "39a9d" );
- Insert::write_misc( $output, "00806e", "39aa3" );
- Insert::write_misc( $output, $bytes, "39ac0" );
- Insert::write_misc( $output, "00806e", "39ac6" );
- Insert::write_misc( $output, $bytes, "39f56" );
- $position = Insert::menu( "5b522.dump", $output, $position, 25 );
- #insert the supply notices
- $second_byte = hex substr $position, 2, 2;
- $third_byte = hex substr $position, 4, 2;
- if ( $second_byte < 0x80 ) {
- $second_byte += 0x80;
- }
- $bytes = sprintf "%.2x%.2x", $third_byte, $second_byte;
- Insert::write_misc( $output, $bytes, "bea0" );
- Insert::write_misc( $output, "00806e", "bea6" );
- Insert::write_misc( $output, $bytes, "bed4" );
- Insert::write_misc( $output, "00806e", "beda" );
- Insert::write_misc( $output, $bytes, "bf0c" );
- Insert::write_misc( $output, "00806e", "bf12" );
- Insert::write_misc( $output, $bytes, "bf53" );
- Insert::write_misc( $output, "00806e", "bf59" );
- Insert::write_misc( $output, $bytes, "e434" );
- Insert::write_misc( $output, "00806e", "e43c" );
- $position = Insert::menu( "5ae94.dump", $output, $position, 13 );
- #insert the item effect notices
- $second_byte = hex substr $position, 2, 2;
- $third_byte = hex substr $position, 4, 2;
- if ( $second_byte < 0x80 ) {
- $second_byte += 0x80;
- }
- $bytes = sprintf "%.2x%.2x", $third_byte, $second_byte;
- Insert::write_misc( $output, $bytes, "ec9d" );
- Insert::write_misc( $output, "00806e", "eca2" );
- Insert::write_misc( $output, $bytes, "ecdc" );
- Insert::write_misc( $output, "00806e", "ece7" );
- Insert::write_misc( $output, $bytes, "ed20" );
- Insert::write_misc( $output, "00806e", "ed25" );
- Insert::write_misc( $output, $bytes, "ed4e" );
- Insert::write_misc( $output, "00806e", "ed54" );
- Insert::write_misc( $output, $bytes, "ed97" );
- Insert::write_misc( $output, "00806e", "ed9c" );
- Insert::write_misc( $output, $bytes, "3b3d4" );
- Insert::write_misc( $output, "00806e", "3b3d9" );
- $position = Insert::menu( "5d13a.dump", $output, $position, 15 );
- #insert the in-battle text
- $first_byte = hex substr $position, 0, 2;
- $second_byte = hex substr $position, 2, 2;
- $third_byte = hex substr $position, 4, 2;
- $first_byte = 2 * $first_byte;
- if ( $second_byte < 0x80 ) {
- $second_byte += 0x80;
- } else {
- $first_byte++;
- }
- $bytes = sprintf "%.2x%.2x", $third_byte, $second_byte;
- $first_byte = sprintf "%.2x", $first_byte;
- Insert::write_misc( $output, $bytes, "330a1" );
- Insert::write_misc( $output, $first_byte, "3309d" );
- Insert::write_misc( $output, $bytes, "33147" );
- Insert::write_misc( $output, $first_byte, "33143" );
- $position = Insert::menu( "42ddb.dump", $output, $position, 69 );
- #in-battle participle hax
- Insert::write_misc( $output, "20a0ff", "330b0" );
- Insert::write_misc( $output, "220086eeae181060", "37fa0" );
- Insert::write_misc( $output,
- "e220c905f003c2206be8e8bdb41d48c907f03ac909f022c920f01ec90af01ec90bf026c913f022c914f01ec935f016c936f012c92df00a801fa9408012a941800ea943800aa9428006a91f8002a9449db41dcaca68c2206b68a943cacac2206b",
- "370600" );
- #in-battle weapon/command switch hax
- Insert::write_misc( $output, "20b0ff", "330d9" );
- Insert::write_misc( $output, "22008aee60", "37fb0" );
- Insert::write_misc( $output, "209bb06b", "37fc0" );
- Insert::write_misc( $output,
- "daee3910ae3910bdb41de220c913f016c914f012c907f00ec909f010c220ce3910faa900246bc22022c0ff86e220a91fce3910ae39109db41d80e1",
- "370a00" );
- #in-battle newlines hax
- Insert::write_misc( $output, "220087ee60", "33199" );
- Insert::write_misc( $output, "2075b1e603e603c8c86b", "331a5" );
- Insert::write_misc( $output,
- "48a503186980002980ff18690c00850368c8c86b", "370800" );
- Insert::write_misc( $output,
- "088ba00000b700c9fdffd006220088ee80f3c9fffff00622a5b18680e898186d18108d1810ab286b",
- "370700" );
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement