Romhacking.net

Romhacking => Personal Projects => Topic started by: keithisgood on September 14, 2012, 01:58:04 pm

Title: Magic Kids; Scubbing McD's from M.C. Kids
Post by: keithisgood on September 14, 2012, 01:58:04 pm
Just discovered what a great game M.C. Kids is and been feeling icky about McDonald's blatant product plugging in the game. To that end, I've begun the process of overhauling the game's graphics to scrub away every clown and arch. The re-branded game is instead called "Magic Kids," keeping the storyline mostly intact but replacing Ronald McDonald with Walter the Wizard.

EDIT: All Finished and in the database:
http://www.romhacking.net/hacks/1136/

Screenshots!

Comparison shot of the Overworld Map:
(http://i.imgur.com/66rB5.gif)

In-Level Gameplay Before:
(http://i.imgur.com/MidaY.png)

...and after:
(http://i.imgur.com/tTWcd.png)

Also, here's an example of McDonald's branding run amok:
(http://i.imgur.com/C05pk.png)

...and the fix:
(http://i.imgur.com/uOHre.png)

Next is to overhaul the game sprites and remove all the McDonalds characters.

The text, however, proves tricky (as some of you may know) in that it's compressed in the rom. So this project may take a good amount of time to see completion while I learn enough ASM to crack the game's text compression.
Title: Re: Magic Kids; Scubbing McD's from M.C. Kids
Post by: Jedi QuestMaster on September 14, 2012, 09:55:24 pm
Interesting! I'd have loved it if someone replaced everything with Burger King & these kids. (http://images1.wikia.nocookie.net/__cb20110123002017/happymeal/images/9/9a/Burger_King_Kids_Club_group.jpg)

(btw, my avatar is a rejected Burger King letterform that I eventually colorized :P)
Title: Re: Magic Kids; Scubbing McD's from M.C. Kids
Post by: Zanerus on September 14, 2012, 10:49:25 pm
I can't offer any hacking help since I only know how to hack on a GBA but I'm looking forward to it. Good luck!
Title: Re: Magic Kids; Scubbing McD's from M.C. Kids
Post by: darkanx on September 15, 2012, 07:11:43 am
I approve of this! I could never bring myself to play this one because of the blatant branding. It just...seems wrong. Same for Cool Spot, Chester Cheetah, and all those others. I admit, I bought Sneak King from Gamestop as a gag gift and played it. Terrible, but kind of hilarious.

I look forward to seeing what you do with that Ronald sprite there. Some pallet swapping would probably do the trick, but wizards need hats. Off to a good start!
Title: .
Post by: Chpexo on September 15, 2012, 02:48:00 pm
.
Title: Re: Magic Kids; Scubbing McD\'s from M.C. Kids
Post by: keithisgood on September 15, 2012, 07:44:21 pm
Jedi, I'd completely forgotten about the BK Kids! Seeing the one with the visor especially brings back a small part of my childhood.

September 18, 2012, 01:37:20 pm - (Auto Merged - Double Posts are not allowed before 7 days.)
My first attempt at the title screen:
(http://i.imgur.com/F4cJB.png)
Still having trouble finding the tile data in the ROM...
beta ips included at the top of the thread
Title: Re: Magic Kids; Scubbing McD's from M.C. Kids
Post by: darkanx on September 19, 2012, 09:40:02 am
Ohh. Beta patch. Always up for testing some of those. So far it looks great.

I am getting a slightly garbled title screen (as in your pic), with a few tiles out of place. Coins and star graphics look great. Ronald in the intro looks like he is coming along well. I didn't play too far into the game yet, but initial impressions are very positive. Keep it up!
Title: Re: Magic Kids; Scubbing McD\'s from M.C. Kids
Post by: keithisgood on September 19, 2012, 11:13:51 am
Thanks for the positive words.
Redesigned the title screen to avoid tile hunting in the ROM:
(http://i.imgur.com/NEnpd.png)
Updated the Beta Rom.

I'm quite proud of Portraits which reveal when you get the secret cards. Took some real-life inspiration for my wizard...

September 22, 2012, 10:28:03 am - (Auto Merged - Double Posts are not allowed before 7 days.)
First shot at replacing Ronald McDonald with Walter the Wizard:
(http://i.imgur.com/Hl7bn.png)
Keeping the red/yellow pallete for now, to make things easier for me.
Title: Re: Magic Kids; Scubbing McD's from M.C. Kids
Post by: darkanx on September 23, 2012, 03:59:56 am
Is that Bill Nye? :3
Title: Re: Magic Kids; Scubbing McD's from M.C. Kids
Post by: keithisgood on September 23, 2012, 10:08:33 am
It is indeed! All the human characters in the game are based on real-life people. And who could possibly make for a better wizard than Bill Nye?
Title: Re: Magic Kids; Scubbing McD's from M.C. Kids
Post by: Zanerus on September 23, 2012, 10:43:51 am
Both unexpected and amusing. Good so far.
Title: Re: Magic Kids; Scubbing McD's from M.C. Kids
Post by: Azkadellia on September 23, 2012, 04:41:45 pm
... And who could possibly make for a better wizard than Bill Nye?

Mr. Wizard himself? (http://en.wikipedia.org/wiki/Don_Herbert)
Title: Re: Magic Kids; Scubbing McD's from M.C. Kids
Post by: fellowroot on September 23, 2012, 05:45:29 pm
This is actually a really cool idea. I like it and I like what you have done so far. The new artwork fits in just fine so that you can't even tell that that its been hacked. Don't stop now, keep it up!
Title: Re: Magic Kids; Scubbing McD's from M.C. Kids
Post by: keithisgood on September 24, 2012, 09:57:14 am
I couldn't choose between Mr. Wizard and Julius Sumner Miller; plus Bill Nye looks better in sprite-form (I think its the bow-tie)

And as to the graphics "fitting" I think its probably a statement more on how well-made this game is. The fact that 4 guys working unaided took a pile of licensed Fast Food garbage and built a well-plotted, entertaining game around it is remarkable. I'm just ironing out the rough edges; the game seems to make better sense when the McDonalds elements are taken out.
Title: Re: Magic Kids; Scubbing McD's from M.C. Kids
Post by: Proveaux on September 24, 2012, 10:38:04 pm
Looking good!
Title: Re: Magic Kids; Scubbing McD's from M.C. Kids
Post by: Mirby on September 25, 2012, 04:19:19 am
It is indeed! All the human characters in the game are based on real-life people.
I'm curious to see who replaces the other characters. Like the Hamburglar and Grimace. XD
Title: Re: Magic Kids; Scubbing McD's from M.C. Kids
Post by: keithisgood on September 25, 2012, 10:21:08 am
Here's the (mostly) completed set of character swaps:
(http://i.imgur.com/6pJr6.png)
Ronald becomes Walter Wizard
Birdie becomes Bettie the Wizard's Apprentice
Grimace becomes Silver the Gorilla
The Professor becomes The Engineer
CosMC becomes Cosmo (very creative, I know)
and Hamburglar becomes The Magic Thief / Dragon

The human characters are based on real people. Still working on the game sprites.
Title: Re: Magic Kids; Scubbing McD's from M.C. Kids
Post by: KingMike on September 25, 2012, 03:44:48 pm
Birdie's replacement makes me think of the Wendy's mascot. :P

If that wasn't what you were going for, maybe give her dark hair?
Title: Re: Magic Kids; Scubbing McD's from M.C. Kids
Post by: keithisgood on September 25, 2012, 04:05:41 pm
Not my intent to trade one burger chain for another, but i see the resemblance. Maybe I'll try dark hair with red highlights.
Title: Re: Magic Kids; Scubbing McD's from M.C. Kids
Post by: Mirby on September 26, 2012, 04:56:47 am
Hamburglar becomes a dragon? Wow he's serious now! XD
Title: Re: Magic Kids; Scubbing McD's from M.C. Kids
Post by: keithisgood on September 26, 2012, 10:09:10 am
Quote
Hamburglar becomes a dragon? Wow he's serious now! XD

Yeah, I felt that the last level deserved a decent antagonist. Since it takes place in a lava-filled cave, who better than a dragon?
Title: Re: Magic Kids; Scubbing McD's from M.C. Kids
Post by: Vanya on September 26, 2012, 01:19:01 pm
Who is the Engineer? Kinda looks like radio host George Noory.
Title: Re: Magic Kids; Scubbing McD's from M.C. Kids
Post by: keithisgood on September 26, 2012, 03:05:16 pm
The Engineer is based on an actor's portrayal of a famous scientist; in the context of the game, The Engineer builds tricks for the Wizard.
Title: Re: Magic Kids; Scubbing McD's from M.C. Kids
Post by: darkanx on September 26, 2012, 08:15:59 pm
The Engineer is based on an actor's portrayal of a famous scientist; in the context of the game, The Engineer builds tricks for the Wizard.

Famous scientist? Am I right again in thinking... pre-cancer Walter White from Breaking Bad? X3  I thought that the minute I saw him, but Walter usually wears glasses, so didn't make a post asking. If so, you are doing a fantastic job with 8bit caricatures.
Title: Re: Magic Kids; Scubbing McD\'s from M.C. Kids
Post by: keithisgood on September 26, 2012, 11:10:12 pm
While it would be awesome for Walter to make an appearance, the Engineer is based on Nikola Tesla (as played by David Bowie in The Prestige). Source pic here: http://serbianna.com/blogs/savich/wp-content/uploads/2012/08/tesla1.jpg

September 28, 2012, 09:35:18 am - (Auto Merged - Double Posts are not allowed before 7 days.)
More before and after artwork, this time a larger portrait of Hamburglar becoming the Dragon:
(http://i.imgur.com/oORM4.png)

The graphics are done, so now comes the real work in figuring out the text compression.

Anyone with skill in this area would be greatly appreciated.
Title: Re: Magic Kids; Scubbing McD's from M.C. Kids
Post by: MegaManJuno on September 28, 2012, 12:01:34 pm
The Engineer is based on an actor's portrayal of a famous scientist; in the context of the game, The Engineer builds tricks for the Wizard.

I'm guessing Tesla (a la The Prestige)?

Edit: Nevermind... helps to read the full thread first. I see now that my assumption was correct. :P
Title: Re: Magic Kids; Scubbing McD's from M.C. Kids
Post by: Vanya on September 28, 2012, 12:30:42 pm
If that's supposed to be Tesla then his face needs to be more gaunt.

The Dragon looks great.
Title: Re: Magic Kids; Scubbing McD\'s from M.C. Kids
Post by: keithisgood on October 05, 2012, 11:01:02 am
I realize it's not the greatest take on Tesla, but I figured I'll go with it for now, and once I figure out how to change text without learning copious amounts of ASM, I may go back and re-touch some graphics.
The sprite version looks a bit more Tesla-ish:

(http://i.imgur.com/FSgQE.png)


Right now I'm staring at the FCEUX Debugger like teenage me stared at the female body: very excited but absolutely zero clue how to work it.

October 06, 2012, 10:36:26 am - (Auto Merged - Double Posts are not allowed before 7 days.)
Okay, so messing with FCEUX's debugger, I've discovered the following:

*All Cutscene text is loaded into RAM between addresses $6905 and $74C4
*Large chunks of Dialogue text are loaded into RAM starting at $6905, depending on which sprite you talk to.
*When Text is being written to the screen, each letter's tile data is called from RAM address $0343

I'm trying to figure out how to change the text called into RAM. I set a Write Breakpoint for $6DDB (the RAM address for the R in Ronald--the game's first text). It returned me the following debugger data:

07:E478:A5 A5     LDA $00A5 = #$52
07:E47A:91 9B     STA ($9B),Y @ $6DDB = #$52

$52 is the RAM value used for R, so this is the correct code. So, now I've got the end of the string, so to say, how do I follow this back to the ROM so as to change $52 (R) to $57 (W)? I realize this is probably to then find out how 52 is loaded into $00A5, but that RAM address seems to be a catch all for storing data. I set a breakpoint there and spent half an hour hitting RUN repeatedly without any of the game text loading. Is there a better way to see how 52 gets into $00A5 other than the FCEUX debugger?
Title: Re: Magic Kids; Scubbing McD's from M.C. Kids
Post by: snarfblam on October 06, 2012, 06:55:21 pm
It looks like it's copying from a buffer for decompression. Try using the trace logger. Log to a file, and when you break on the write to $6DDB, open up the trace log, and search backwards for writes to $A5. That should help you find the decompression routine, which should help you find the compressed text.
Title: Re: Magic Kids; Scubbing McD's from M.C. Kids
Post by: keithisgood on October 07, 2012, 11:47:52 am
Thanks. I'm still getting the hang of FCEUX's various tools.
Title: Re: Magic Kids; Scubbing McD's from M.C. Kids
Post by: Dwedit on October 12, 2012, 02:01:49 am
Wanna tell Gregg Tavares about that hack?  His website is at http://games.greggman.com/
Title: Re: Magic Kids; Scubbing McD's from M.C. Kids
Post by: keithisgood on October 12, 2012, 12:01:55 pm
Yeah, i'd actually used his article regarding the making of M.C. Kids to verify the text was indeed compressed. His post wondering why M.C. Kids was so poorly received is one of the reasons I took up this project; I figured the reason was all the blatant McDonalds product placement.   
 
I'd actually considered e-mailing him to ask what the text compression scheme was, but if I do e-mail him, it'll probably be after I'm done.
Title: Re: Magic Kids; Scubbing McD's from M.C. Kids
Post by: Dwedit on October 12, 2012, 01:18:01 pm
I'd guess something like Huffman, so it's probably not byte-aligned.
Title: Re: Magic Kids; Scubbing McD's from M.C. Kids
Post by: keithisgood on October 12, 2012, 01:57:13 pm
The more I dig in, it seems the less I know. I'm guessing from here on out, the progress with this is going to be measured in months rather than days while I learn enough about ASM to make the needed text changes.
Title: Re: Magic Kids; Scubbing McD's from M.C. Kids
Post by: Trax on October 31, 2012, 10:23:45 pm
I've played this game a few times in the past, and was always repulsed by the McDonald's theme. I gave it another, more serious try, and it's actually not bad. The controls are fluid, and I like the idea of finding hidden cards and the gravity reversal. By the way, Keithisgood, your replacement graphics are looking good...

I took a look at the code in the vicinity of 1E478, but nothing specific comes to mind. Do we have an idea of the location of the compressed text in the ROM?
Title: Re: Magic Kids; Scubbing McD's from M.C. Kids
Post by: keithisgood on November 01, 2012, 10:58:45 pm
Unfortunately I have zero clue at this point. I've tried to follow the thread back from the RAM loading with very little success thusfar. A few more work projects are sapping away free time, so I haven't had much time to crack the compression.

I agree fully the game is much, much better than most give it credit for. Solid controls and varied gameplay. For some reason, I feel like Mack should have some ledges cut into his high-top. couldn't figure out how to get the sprite right, though.
Title: Re: Magic Kids; Scubbing McD's from M.C. Kids
Post by: DarkReaper on November 03, 2012, 05:50:29 pm
Ive never played the original, but once you finish cleaning it up it warrants atleast a try  ;D
Title: Re: Magic Kids; Scubbing McD's from M.C. Kids
Post by: keithisgood on November 08, 2012, 09:31:04 am
Thanks. It's actually a very fun game.
Title: Re: Magic Kids; Scubbing McD's from M.C. Kids
Post by: snarfblam on November 13, 2012, 09:45:47 pm
Do we have an idea of the location of the compressed text in the ROM?

I hope I'm not explaining anything that's already figured out, but it looks like a block of compressed text is stored in the ballpark of $4AB0 in the rom (headered), banked to $AAA0. I'm not sure exactly where it starts.

Text is decompressed to ASCII. It is converted to pattern numbers after it is decompressed. Definitely not byte aligned, but one of the first things I noticed was changing one bit of the compressed text changes one bit of the decompressed text.

I had been watching how modifying the compressed text changes what shows up on the nametable, which is in retrospect obviously wrong since the pattern table isn't arranged by ASCII. So don't do that. It helped once I realized I should have been monitoring how changing compressed text affects the decompressed-text-buffer (kind of a pain in FCEU).

Looks like there are nine bits per character. It's generally hard to find the bits and pieces of text because, as mentioned, they aren't byte aligned. I found the "is " in "Ronald was showing off his Magic" at 4AB5. Each character took up eight bits, followed by an extra bit. I would guess the extra bit indicates whether there are more characters in a group (of what, I'm not sure). 4B2D is " in t" from "picnic in the meadow". That one confuses me a bit more. I can clearly make out and easily modify the mentioned letters in the stream. I can also modify some bits of the following "h", but there is no "0110 1000" in the stream so I'm not clear on what's going on there.

So that's definitely something. I think it would help a lot to get input from somebody with experience with text compression. For now I already have Ronald McDonald burned into my retinas, so I'm calling it a night.
Title: Re: Magic Kids; Scubbing McD's from M.C. Kids
Post by: keithisgood on November 14, 2012, 08:52:17 am
That's miles beyond where I've gotten so far!  Although I don't have experience with compression schemes, I'll take a look at it once I finish work.
Title: Re: Magic Kids; Scubbing McD's from M.C. Kids
Post by: Alchemic on November 14, 2012, 10:05:06 pm
I did some poking around, and I think I've figured out the text compression. It's a kind of Lempel-Ziv:


The stream of compressed bits consists of a sequence of these two commands:

Pastcopy

Literal

A sample decompression from 0x4AAC:

Code: [Select]
B5 82 41 23 10 A8 15 52 D1 69 B9 C8 00 0C 16 DB CC 82 A7 70 ...

1011 = Pastcopy sources are eleven bits long
0101 = Pastcopy lengths are five bits long

1 00000100 = '\x04'
1 00000100 = '\x04'
1 00011000 = '\x18'
1 00001010 = '\x0A'
1 00000010 = '\x02'
1 01010100 = 'T'
1 01101000 = 'h'
1 01101001 = 'i'
1 01110011 = 's'
1 00100000 = ' '
0 00000000011 00000 = "is "
1 01101101 = 'm'
1 01111001 = 'y'
1 00100000 = ' '
1 01010011 = 'S'
1 01110000 = 'p'
...

The letters are ASCII, and there are control codes in the text; 0x01 ends a string, 0x02 is newline, not sure about other codes.

Some known blocks of compressed text (end addresses inclusive):
I'm not sure if there are more or not.

Python decompressor source:
Code: [Select]
# M.C. Kids Text Decompressor
# Written by Alchemic
# 2012 Nov 13
#
# This code uses python-bitstring version 2.2.0:
# http://code.google.com/p/python-bitstring/

import sys
import bitstring





def decompress(romFile, startOffset):
    # Define some useful constants.
    BIT_PASTCOPY = 0
    BIT_LITERAL = 1

    # Open the ROM.
    romStream = bitstring.ConstBitStream(filename=romFile)
    romStream.bytepos += startOffset

    # Allocate storage for the decompressed output.
    decomp = bytearray()

    # Read the first byte.
    # (It specifies the size of pastcopy's two arguments.)
    copySourceSize = romStream.read('uint:4')
    copyLengthSize = romStream.read('uint:4')

    # Main decompression loop.
    while True:
        nextCommand = romStream.read('bool')

        if nextCommand == BIT_PASTCOPY:
            # 0: Pastcopy case.
            copySource = romStream.read(copySourceSize).uint
            copyLength = romStream.read(copyLengthSize).uint
            copyLength += 3

            # A copy source of 0 indicates the end.
            if copySource == 0:
                break
           
            for i in xrange(copyLength):
                decomp.append(decomp[-copySource])

        elif nextCommand == BIT_LITERAL:
            # 1: Literal case.
            literalByte = romStream.read('uint:8')
            decomp.append(literalByte)

    # Calculate the end offset.
    romStream.bytealign()
    endOffset = romStream.bytepos

    # Return the decompressed data and end offset.
    return (decomp, endOffset)





if __name__ == "__main__":

    # Check for incorrect usage.
    argc = len(sys.argv)
    if argc < 3 or argc > 4:
        sys.stdout.write("Usage: ")
        sys.stdout.write("{0:s} ".format(sys.argv[0]))
        sys.stdout.write("<romFile> <startOffset> [outFile]\n")
        sys.exit(1)

    # Copy the arguments.
    romFile = sys.argv[1]
    startOffset = int(sys.argv[2], 16)
    outFile = None
    if argc == 4:
        outFile = sys.argv[3]

    # Decompress the data.
    outBytes, endOffset = decompress(romFile, startOffset)

    # Write the decompressed output, if appropriate.
    if outFile is not None:
        outStream = open(outFile, "wb")
        outStream.write(outBytes)
        outStream.close()

    # Report the size of the compressed data and last offset.
    sys.stdout.write("Original compressed size: 0x{0:X} ({0:d}) bytes\n".format(endOffset - startOffset))
    sys.stdout.write("Last offset read, inclusive: {0:X}\n".format(endOffset - 1))

    # Exit.
    sys.exit(0)
Title: Re: Magic Kids; Scubbing McD\'s from M.C. Kids
Post by: keithisgood on November 15, 2012, 12:01:33 pm
I am at a lack of words to properly express the true magnitude of your awesomeness.

November 15, 2012, 09:02:00 pm - (Auto Merged - Double Posts are not allowed before 7 days.)
Those three blocks are indeed the entire game text. Brilliant job.

I don't suppose you could write a re-insertion script? I have zero python skill.
Title: Re: Magic Kids; Scubbing McD's from M.C. Kids
Post by: Alchemic on November 17, 2012, 12:32:57 am
As requested, here's a compressor. Some observations:

Python compressor source:

Code: [Select]
# M.C. Kids Text Compressor
# Written by Alchemic
# 2012 Nov 16
#
# This code uses python-bitstring version 2.2.0:
# http://code.google.com/p/python-bitstring/

from __future__ import division

import sys
import bitstring





def compress(inBytes, sourceArgSize, lengthArgSize):
    # Define some useful constants.
    BIT_PASTCOPY = 0
    BIT_LITERAL = 1

    # Prepare for compression.
    currentIndex = 0
    endIndex = len(inBytes)
    output = bitstring.BitArray()
    output += bitstring.pack('uint:4', sourceArgSize)
    output += bitstring.pack('uint:4', lengthArgSize)

    # Main compression loop.
    while currentIndex < endIndex:
        bestSource = 0
        bestLength = 0

        # Compare what's coming up to what we've most recently seen.
        searchLimit = min(
            currentIndex,
            (1 << sourceArgSize) - 1
        )
        for i in xrange(1, searchLimit):
            # Don't look too far ahead at what's coming up:
            # - No further than can be encoded in one command.
            # - Not past the end of the input.
            lookaheadLimit = min(
                (1 << lengthArgSize) - 1 + 3,
                endIndex - currentIndex
            )

            # Count how many sequential bytes match (possibly zero).
            currentLength = 0
            for j in xrange(lookaheadLimit):
                if inBytes[currentIndex - i + j] == inBytes[currentIndex + j]:
                    currentLength += 1
                else:
                    break

            # Keep track of the largest match we've seen.
            if currentLength > bestLength:
                bestSource = i
                bestLength = currentLength

        # Write the next command.
        if bestLength >= 3:
            output += bitstring.pack('uint:1', BIT_PASTCOPY)
            output += bitstring.pack('uint:n=v', n = sourceArgSize, v = bestSource)
            output += bitstring.pack('uint:n=v', n = lengthArgSize, v = bestLength - 3)
            currentIndex += bestLength
        else:
            output += bitstring.pack('uint:1', BIT_LITERAL)
            output += bitstring.pack('uint:8', inBytes[currentIndex])
            currentIndex += 1

    # Write the terminating bits.
    output += bitstring.pack('uint:1', BIT_PASTCOPY)
    output += bitstring.pack('uint:n=v', n = sourceArgSize, v = 0)
    output += bitstring.pack('uint:n=v', n = lengthArgSize, v = 0)

    # Return the compressed data.
    return output.tobytes()





if __name__ == "__main__":

    # Check for incorrect usage.
    argc = len(sys.argv)
    if argc < 2 or argc > 4:
        sys.stdout.write("Usage: ")
        sys.stdout.write("{0:s} ".format(sys.argv[0]))
        sys.stdout.write("<inFile> [outFile] [outOffset]\n")
        sys.exit(1)

    # Copy the arguments.
    inFile = sys.argv[1]
    outFile = None
    if argc == 3 or argc == 4:
        outFile = sys.argv[2]
    outOffset = 0
    if argc == 4:
        outOffset = int(sys.argv[3], 16)

    # Open, read and close the input file.
    inStream = open(inFile, "rb")
    inBytes = bytearray(inStream.read())
    inStream.close()

    # Compress the data.
    compressedOptions = []
    for sourceArgSize in xrange(10, 12):
        for lengthArgSize in xrange(3, 6):
            sys.stdout.write("Compressing: {0:d},{1:d}".format(sourceArgSize, lengthArgSize))
            thisOption = compress(inBytes, sourceArgSize, lengthArgSize)
            sys.stdout.write(" = {0:d} bytes\n".format(len(thisOption)))
            compressedOptions.append(thisOption)
    outBytes = min(compressedOptions, key = len)
    sys.stdout.write("Done.\n\n")

    # Write the compressed output, if appropriate.
    if outFile is not None:
        # Mode r+b gives an error if the file doesn't already exist.
        open(outFile, "a").close()
        outStream = open(outFile, "r+b")
        outStream.seek(outOffset)
        outStream.write(outBytes)
        outStream.close()

    # Report statistics on the data.
    sys.stdout.write("Uncompressed size: 0x{0:X} ({0:d}) bytes\n".format(len(inBytes)))
    sys.stdout.write("Compressed size: 0x{0:X} ({0:d}) bytes\n".format(len(outBytes)))
    sys.stdout.write("Ratio: {0:f}\n".format(len(outBytes) / len(inBytes)))

    # Exit.
    sys.exit(0)
Title: Re: Magic Kids; Scubbing McD's from M.C. Kids
Post by: keithisgood on November 17, 2012, 09:54:35 am
How would you like to be credited in the game's opening credits? There's ample space for whatever title you may like.
"Ultimate Potentate of Text Compression" "Stephen Hawking Has Nuthin' on Me"? Your call.
Title: Re: Magic Kids; Scubbing McD's from M.C. Kids
Post by: henke37 on November 17, 2012, 11:36:18 am
How about "It's just LZ77"?
Title: Re: Magic Kids; Scubbing McD's from M.C. Kids
Post by: keithisgood on November 17, 2012, 12:47:02 pm
Whatever the text compression is, it's beyond me. I'm just grateful for the help!
Title: Re: Magic Kids; Scubbing McD's from M.C. Kids
Post by: DarknessSavior on November 17, 2012, 01:23:35 pm
Whatever the text compression is, it's beyond me. I'm just grateful for the help!
"It's just LZ77" is a joke. I know nothing about compression, but I assume that's harder than say...RLE (the easiest, from what I've heard)? I think it's meant to be something like, "Oh, it was just LZ77. No big deal". That kinda thing.

~DS
Title: Re: Magic Kids; Scubbing McD's from M.C. Kids
Post by: keithisgood on November 18, 2012, 10:22:27 am
Ah. Well that's what happens when an English major reads a programming joke. Here I am, ruining the fun for everyone.
Title: Re: Magic Kids; Scubbing McD's from M.C. Kids
Post by: Crysta on November 18, 2012, 11:32:18 am
Yknow, I just realized that the topic title says "Scubbing"...
Title: Re: Magic Kids; Scubbing McD's from M.C. Kids
Post by: Mirby on November 18, 2012, 11:42:18 pm
Well you can't just scrub away McDonald's from things, you need to scub it. It's much more in-depth and super effective against McDonald's residue.  ;D
Title: Re: Magic Kids; Scubbing McD\'s from M.C. Kids
Post by: keithisgood on November 19, 2012, 09:27:57 am
Ha! I'd never noticed that. Upside: a google search of Scubbing puts this thread on the front page. TAKE THAT PEOPLE WHO'VE MIS-TYPED "SCRUBBING BUBBLES!"

November 24, 2012, 10:04:36 am - (Auto Merged - Double Posts are not allowed before 7 days.)
New script written!

(http://i.imgur.com/PNOwj.gif)

Still working out a few kinks with the re-inserter being less efficient. Hopefully will have the finished ips soon.
Title: Re: Magic Kids; Scubbing McD's from M.C. Kids
Post by: Mirby on November 27, 2012, 02:27:26 am
i'm pretty excited 'bout this, i must admit. looks great :3
Title: Re: Magic Kids; Scubbing McD's from M.C. Kids
Post by: keithisgood on November 28, 2012, 02:27:02 pm
Okay, not sure if this is error on my part or something else. Re-inserting the compressed the text into the rom (via Alchemic's Python script) causes mass problems with most all text related events. I don't have a lot of knowledge of programming, but I'm guessing the ROM uses pointer data which doesn't match to the new script, causing all sorts of funky problems.

If anyone wants to take a look and see where I'm going wrong, the text files corresponding to the game's 3 blocks of text data are linked below:

https://www.dropbox.com/s/kmo9v2cpq7qglkb/MagicKidsText1.txt
https://www.dropbox.com/s/lqnhjglper6w0vm/MagicKidsText2.txt
https://www.dropbox.com/s/igyt399z11pzok5/MagicKidsText3.txt

I've been using either the Python IDLE GUI or Notepad to edit these.
Title: Re: Magic Kids; Scubbing McD's from M.C. Kids
Post by: fellowroot on December 04, 2012, 11:59:37 pm
I think that it is so funny that someone is actually doing this. Take that you big corporate companies who target their future customers when they are innocent children with their advertising. I could just see some fat kid playing this game back when it first came out thinking "Man, I could really go for some Mc Donalds about now" after the M symbols were burned into his retinas. I think the only way this advertising could have been any worse would be if it had an in game menu so that you could think about what to order while playing the game. lol

Anyway, I think you are doing a great job with this hack. All the graphics look nice and your idea is in good spirit. In fact, when your done it will probably be regarded as an actual game rather than an interactive sales commercial.

But I do have to say, I love some of the original music M.C. Kids has to offer. 
Title: Re: Magic Kids; Scubbing McD's from M.C. Kids
Post by: keithisgood on December 05, 2012, 09:01:47 am
Yeah; even if I had the skill to swap the music, I wouldn't. Some good stuff.
Title: Re: Magic Kids; Scubbing McD's from M.C. Kids
Post by: MathUser2929 on December 05, 2012, 10:13:30 am
I think it's interesting that you are trying to remove the McDonalds references. Id like to see what sprites you replace McDonald's characters with so post screens if you get the chance.

There was also a official hack of Cool spot to remove most of the 7up references. I think it was the official EU ROM. they replaced the 7up bottle in the intro with a generic bottle that was changed to a red color. The Spot character remained tho. I guess this was cause Fido Dido was the official mascot in EU, not Spot.
Title: Re: Magic Kids; Scubbing McD's from M.C. Kids
Post by: keithisgood on December 05, 2012, 02:17:53 pm
Sure. Repeating some of the images posted previously in this thread, the graphical changes go as follows:

Ronald McDonald becomes Walter the Wizard:
(http://i.imgur.com/Hl7bn.png)
(http://i.imgur.com/BELV7.png)

Birdie the Early Bird becomes Bettie the Apprentice:
(http://i.imgur.com/KZSnC.png)

Grimace the [whatever Grimace is] becomes Silver the Gorilla:
(http://i.imgur.com/94MCx.png)

The Professor becomes The Engineer:
(http://i.imgur.com/FSgQE.png)

CosMC the Alien becomes Cosmo the Astronaut:
(http://i.imgur.com/wEYga.png)

Hamburglar becomes The Dragon:
(http://i.imgur.com/Oe6vD.png)
(http://i.imgur.com/oORM4.png)

And the swapped out portraits for each character:
(http://i.imgur.com/ff1fj.png)

I worked within the tile layout and palettes already used in the game to make it simpler on my end. I may make a few tweaks in the future, but overall I'm pleased with the sprite/graphics work. As soon as I figure out how to make the text compression script play nice, I'll have a finished .ips.
Title: Re: Magic Kids; Scubbing McD's from M.C. Kids
Post by: MathUser2929 on December 05, 2012, 03:03:17 pm
Those are some interesting changes. The hack could make for a interesting playthrough.
Title: Re: Magic Kids; Scubbing McD's from M.C. Kids
Post by: fellowroot on December 06, 2012, 04:18:36 pm
When you are finished with the hack and its available to download I'll go buy and then eat a big fat Mc Donalds hamburger while playing it.  :D
Title: Re: Magic Kids; Scubbing McD's from M.C. Kids
Post by: keithisgood on December 06, 2012, 04:34:01 pm
Imma let you finish but the McD's chicken sangwich is the best of all time.
Title: Re: Magic Kids; Scubbing McD's from M.C. Kids
Post by: Trax on December 11, 2012, 10:26:56 pm
I remember playing that game many years ago, and ditching it after a very short time, mostly repulsed by the Mc themes. And now, because of this initiative, I tried the game again, and it's actually pretty good. The controls are good and the puzzle type levels make an interesting mix. Without the McDs, it'll be even better. I like the new characters...

Keep up the good work!
Title: Re: Magic Kids; Scubbing McD's from M.C. Kids
Post by: keithisgood on December 12, 2012, 05:09:21 pm
I think your experience with the game is the most common one. It's similar to my play through of MC Kids, anyway. I had the same vague recollections of the game being corporate shill, then decided to play it one day out of sheer boredom. 

And obviously, I wouldn't have put in so much time in the overhaul if I didn't think it was a fantastic game. Very innovative among NES platformers.

The last hurdle to a finished .ips is getting the text pointers to match the newly-compressed game script. It's a bit beyond my understanding at the moment, but I'm led to believe altering pointer data is pretty simple once you get the hang of it.
Title: Re: Magic Kids; Scubbing McD's from M.C. Kids
Post by: keithisgood on December 22, 2012, 09:19:18 am
Not earth shattering news, but I've deciphered the control codes accompanying each text block. Each string starts with something like 04 04 18 0A 02 TEXT TEXT TEXT...

The codes preceding the text simply dictate the position and size of the text box. 04 04 gives the screen coordinates of the upper left hand corner of the text box. 18 gives the width and 0A gives the height. 02 begins a new block of text and 01 ends each line of text

We've looked into the pointer system a bit in another thread (http://www.romhacking.net/forum/index.php/topic,15500.0.html) but it seems the pointer system is just as obfuscated as the rest of the text data. I'm thinking maybe I'll just tap out and shoot an e-mail to Greg Tavares begging for help.
Title: Re: Magic Kids; Scubbing McD's from M.C. Kids
Post by: keithisgood on February 01, 2013, 05:15:05 pm
I've smashed into the brick wall that is text compression, here. Text aside, all the graphical changes are implemented. I've had a few board members saying it's a pity I've put down the project and offering help, so I've decided to make available all my MC Kids/Magic Kids hacking documents if anyone else wants to take up the torch on this one.

https://www.dropbox.com/s/hji0k9mcnw62u6n/MagicKidsFiles.zip

The .zip contains all the decompressed and updated text files, the most current .ips patch, the table files, the python scripts for text decompression and reinsertion, and a document with all the information I have.

So if anyone wants to give the text a crack, please do!
Title: Re: Magic Kids; Scubbing McD's from M.C. Kids
Post by: Mirby on February 02, 2013, 03:58:21 pm
C'mon, can't anyone help here? This is so close to completion! :'(
Title: Re: Magic Kids; Scubbing McD's from M.C. Kids
Post by: keithisgood on February 03, 2013, 04:46:23 pm
Proveaux took a look at it and it looks like he managed to fit the new text. I'll give the rom a playthrough in the coming days and if it all checks out, the .ips will be posted soon.
Title: Re: Magic Kids; Scubbing McD's from M.C. Kids
Post by: Mirby on February 04, 2013, 03:51:55 am
Yaaaaaaaaay. This is great news.  :thumbsup:
Title: Re: Magic Kids; Scubbing McD's from M.C. Kids
Post by: keithisgood on February 05, 2013, 10:03:13 am
Text is good. Just going to make a few last adjustments and then upload the .ips (hopefully no later than tomorrow).

Title: Re: Magic Kids; Scubbing McD's from M.C. Kids
Post by: fellowroot on February 05, 2013, 06:02:50 pm
So did you 100% figure it out?

I actually was planning to ask my teacher assistant in my programming class if she could help me figure out that problem.

So forget when its done we are all going to go eat a big fat hamburger from Mc Donald's right?

Also keith, I know that you want to post the inp but also don't forget don't rush anything.
Title: Re: Magic Kids; Scubbing McD's from M.C. Kids
Post by: keithisgood on February 05, 2013, 10:54:23 pm
Proveaux figured out how to  alter the new game text to better fit how the compression script handled it.

I've submitted the hack to the database, but if you'd rather not wait 48 hours for it to be approved you can download the .ips patch here:

http://dl.dropbox.com/u/44890135/Magic%20Kids.zip
EDIT: The above link no longer works. Official .ips now in the romhacking.net database.

It requires a copy of "M.C. Kids (U).nes"
Title: Re: Magic Kids; Scubbing McD's from M.C. Kids
Post by: Mirby on February 07, 2013, 01:35:05 am
File not found. :C
Title: Re: Magic Kids; Scubbing McD's from M.C. Kids
Post by: keithisgood on February 07, 2013, 07:39:05 am
Yes, I linked a private dropbox file. Here's the public link:

http://dl.dropbox.com/u/44890135/Magic%20Kids.zip
Title: Re: Magic Kids; Scubbing McD's from M.C. Kids
Post by: Mirby on February 08, 2013, 01:28:37 am
Thanks!

So happy to be playin' this. :3
Title: Re: Magic Kids; Scubbing McD's from M.C. Kids
Post by: keithisgood on February 08, 2013, 01:31:22 pm
Glad to hear it. Let me know what you think once you've given it a spin.
Title: Re: Magic Kids; Scubbing McD's from M.C. Kids
Post by: MathUser2929 on February 08, 2013, 05:50:06 pm
http://www.romhacking.net/hacks/1136/

It's up.
Title: Re: Magic Kids; Scubbing McD's from M.C. Kids
Post by: Proveaux on February 08, 2013, 07:47:47 pm
(http://i1100.photobucket.com/albums/g415/proveauxhacks/IMG_20130208_191811.jpg)
Title: Re: Magic Kids; Scubbing McD's from M.C. Kids
Post by: keithisgood on February 08, 2013, 08:35:39 pm
You even got my ridiculous wordmark on there!
Title: Re: Magic Kids; Scubbing McD's from M.C. Kids
Post by: M-Tee on February 08, 2013, 08:53:30 pm
Is the illustration on the included box art custom?
Title: Re: Magic Kids; Scubbing McD's from M.C. Kids
Post by: Proveaux on February 08, 2013, 08:58:17 pm
Lol! Figured you had it and the seal on your Baseball simulator 2013 so I'd put it on this one too!
Title: Re: Magic Kids; Scubbing McD's from M.C. Kids
Post by: keithisgood on February 08, 2013, 09:35:45 pm
M_Tee: I designed the art included in the .zip file, using the European box art as a template.

European release:
(http://upload.wikimedia.org/wikipedia/en/thumb/4/40/McDonaldland_cover.png/220px-McDonaldland_cover.png)

My variation:
(http://i.imgur.com/qOWsY41m.png)
Title: Re: Magic Kids; Scubbing McD's from M.C. Kids
Post by: Mirby on February 09, 2013, 04:27:32 am
Glad to hear it. Let me know what you think once you've given it a spin.
It's great.

I actually just submitted a review for the hack. :D
Title: Re: Magic Kids; Scubbing McD's from M.C. Kids
Post by: fellowroot on February 10, 2013, 08:51:34 pm
Good JOB! I'll probably take a look at it soon to give possible feedback.

Title: Re: Magic Kids; Scubbing McD's from M.C. Kids
Post by: keithisgood on February 15, 2013, 01:43:38 pm
Wow! Only a week and already 80 downloads. Thanks for the enthusiasm, all. Didn't expect anyone to care much about the project and I've been pleasantly surprised throughout the whole process.

Cheers to you (yes, YOU).
Title: Re: Magic Kids; Scubbing McD's from M.C. Kids
Post by: Robertnine on July 19, 2013, 02:57:17 pm
Como están?  ;) quería felicitarlos por el gran juego que han hecho, me ha gustado mucho. Soy de argentina y me he propuesto hace un tiempo traducir este gran juego al español, ya que es uno de mis favoritos desde niño. Pero me he topado con el problema de que no encuentro el texto de diálogos. El texto que describe el nombre de niveles y los mensajes al final de cada nivel si he podido hallarlo y traducirlo con Translhextion, pero no lo demás. Le escribí un mail al señor Tavarezz y su respuesta fue que el no recuerda que el texto estuviera comprimido, lo cual me dejo desconcertado  :banghead: pues esperaba que el me diera le respuesta clave para terminar la traducción. A mi esto se me complica mucho, ya que la programación no es a lo que yo me dedico, pero he leído realmente mucho del tema desde hace unos 2 meses y he probado de todo pero nada!. Sin mas que decir espero que ustedes puedan darme alguna ayuda para poder terminar con mi trabajo ya que han logrado un excelente hack estoy seguro que podrán ayudarme. Sin mas que decir los felicito nuevamente y GRACIAS!  :thumbsup:
Title: .
Post by: Chpexo on July 20, 2013, 12:51:02 am
.
Title: Re: Magic Kids; Scubbing McD's from M.C. Kids
Post by: NES Boy on July 21, 2013, 12:57:51 am
Why, congratulations, keithisgood! Your research in drecrypting this game's text is about to come in use for a translation project!

As an aside, are you looking into changing the other versions of the game (http://www.mobygames.com/game/mc-kids/screenshots) into Magic Kids? Perhaps undoing the "ganstaization" of Mick and Mack (or Nick and Will, if you perfer) in the Amiga, Atari ST, and DOS versions?

MobyGames doesn't have any screenshots of the Amiga version, but there are a few videos on YouTube, such as this one (http://www.youtube.com/watch?v=6KJeCensol8).
Title: Re: Magic Kids; Scubbing McD's from M.C. Kids
Post by: keithisgood on July 21, 2013, 10:19:05 am
Well, I'm not sure how much credit I should get in regards to text translation: I dug with a hand shovel, Alchemic used a backhoe and provided a working decompression/insertion python script

And updating other versions of the game is an interesting proposition. I've only worked in NES thusfar, though, and have very little idea of how that skillset translates to other platforms (I do have are a very particular set of rom hacking skills. Skills I have acquired over a very short career. Skills that make it a nightmare hacking other platforms).

I'm actually working another rom hacking gig right now, but once I'm free, I'll poke around the other formats.