Jump to content
Visual Boy Advance-M
Carrin

Wisdom Tree compatibility (and here's how)

Recommended Posts

I did a search and couldn't find anything about this, save for a post that says it would be hard to reverse-engineer. Anyways...

 

In case you didn't know, there are a handful of unlicensed game boy games made by a company Wisdom Tree. These roms are all over the internet, but unfortunately there aren't any emulators that support them. The problem is that they use a unique form of bank switching, unlike any of the official games.

 

A few months back I made a game boy emulator for the mac, just for a side project. (

, download). Having played one of these games myself, I found an old forum post somewhere that actually described how to emulate them. If you click the video link above, you can see emulation of one of these games in action.

 

To add Wisdom Tree compatibility, all you need are 3 things:

1. Way to detect wisdom tree carts. Since they do not follow the same header format of official games.

2. ROM read function, due to unique bank switching

3. ROM write function

 

1. The way I used in my emulator, was to check if it was an invalid header. If so, then check if the ROM data contains the text WISDOM(0x20)TREE or WISDOM(0x00)TREE - using those two different bytes for the space. If so, then you've got it. All 6 games contain one of those strings.

 

2. For these cartridges, a rom read function would work like so (I took this straight from my emulator, you could port it to C++ without any trouble). The big difference is that whereas official game boy games will only change the second rom bank (0x4000-0x7999) while leaving the first static (0x0000-0x3999), the wisdom tree carts change both of them.

 

- (uint8_t)readRomAtAddress:(uint16_t)address {

   if (headerType == HEADERTYPE_WISDOM_TREE)
   {
       uint8_t *bytePtr = rom;
       return *(bytePtr + address + romBankOffset);
   }
   else {
       // support for official mappers would go here
       }


   }
}

 

 

A rom write function would look like this. Note that it moves the pointer around in increments of 0x8000. Whereas official game boy games use the value to determine which bank, Wisdom Tree carts use the write address itself, ignoring the value. So, writing to ROM address 0x02 would set the offset to 0x8000 * 2.

 

- (void)writeRomValue:(uint8_t)value atAddress:(uint16_t)address {

   if (headerType == HEADERTYPE_WISDOM_TREE)
   {
       switch (address>>12) {
           case 0:
           case 1:
           case 2:
           case 3: {
               romBankNumber = address;
               romBankOffset = (address)*(0x8000);
               //NSLog(@"Switching to romBankOffset %i", romBankOffset);
               return;
           }
           default:
               return;   
       }
   }
   else { // official gb games
       ...
       }
   }    
}

I hope you guys can make possibly incorporate this into a windows emulator. I got a message this afternoon by a guy who said he'd like to see it, and after finding this project, maybe you can make it happen.

Share this post


Link to post
Share on other sites

none of the official MBC chips so far are detected by a header, so theres no particular reason why this custom MBC would require it,

 

The bank controller should be detectable just by determining which registers are set when the rom is started and setting the appropriate bank/mapper addresses.

Share this post


Link to post
Share on other sites

Is emulating these games something the VBA-M team will look into? I'd also be really interested on seeing the Wisdom Tree games emulated. Like the OP said there is currently not a single emulator (windows at least) that can emulate these games.

Share this post


Link to post
Share on other sites

Well, if the header is "invalid," but it loads on an actual GBA anyway, maybe the header should be almost ignored by an accurate emulator, or the header is just not thoroughly documented enough to understand the functionality of all of the bits? I know there is a bare minimum of which bits need to be set in an N64 header for games to boot there.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×