It is currently Sat Sep 23, 2017 4:09 am

All times are UTC - 7 hours





Post new topic Reply to topic  [ 2 posts ] 
Author Message
PostPosted: Fri Aug 26, 2016 7:35 am 
Offline

Joined: Fri Aug 26, 2016 7:22 am
Posts: 1
So I already have an emulator that can emulate GB/GBC games fully, but I would like to add the ability to play GBS files.

I've had a look around documentation of the format and source code of already existing players, but I'm left confused.
Most notably the GBS spec document confuses me the most, as it is very vague in where I should start reading GB instructions (Is it at 0x70 or at the load address? The example in ROM-bank switching didn't clear anything up)
The only thing I've gotten working is offsetting the RST positions to the load address but even then I don't know if I'm doing it correctly because I'm overwriting instructions that are already there and that doesn't seem right (right at the very start of the file).

So, to make this easier on myself, from the perspective of an existing emulator, what do I need to add/modify to get it playing GBS files?


Top
 Profile  
 
PostPosted: Mon Sep 19, 2016 2:14 am 
Offline

Joined: Thu Oct 05, 2006 6:29 am
Posts: 910
I set things up like this:

Code:
    musicFile.read((char*)&mFileHeader, 0x70);

    numBanks = ((fileSize + mFileHeader.loadAddress - 0x70) + 0x3fff) >> 14;

    rom = new unsigned char[(uint32_t)numBanks << 14];

    memset(rom, 0, (uint32_t)numBanks << 14);
    musicFile.read((char*)rom + mFileHeader.loadAddress, fileSize-0x70);


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 2 posts ] 

All times are UTC - 7 hours


Who is online

Users browsing this forum: No registered users and 1 guest


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB® Forum Software © phpBB Group