Jump to content

SharpBoy - A Game Boy emulator in C#


xdaniel
 Share

Recommended Posts

Current release: SharpBoy v0.4

 

  • Fixed compatibility regression with GBC DMA transfers, affects ex. Pokemon Puzzle Challenge
  • Substantially improved MBC7 emulation via GEST's source code, Kirby Tilt 'n' Tumble is now playable
  • Improved LCD Status interrupt generation, fixes faked high-color display in certain Game Boy Color games
  • Some improvements in handling of disabled LCD; ex. Zelda: Oracle games no longer freeze when leaving the menu
  • Improved timer emulation and improved emulation of HALT opcode, fixes ex. Stunt Race FX Demo
  • Added Wii Remote support for input and Rumble, button configuration is fixed; MBC7 tilt sensor is controlled by Wii Remote when enabled
  • When using keyboard control, MBC7 tilt controls can be changed via the GUI's control settings
  • Added crude frame blending via OpenGL; blends currently drawn frame with previous frame to better simulate pseudo-transparency
  • Added option to keep aspect ratio intact when resizing window; also double-clicking the game screen maximizes/normalizes the window
  • Added drag-and-drop capabilities to GUI, ROMs can now be loaded by dropping them into the program window
  • Very minor GUI changes

Yeah, I kinda like that thread title :P

 

http://i.imgur.com/MRd3C.png

http://i.imgur.com/qdgf5.png

http://i.imgur.com/MF0sG.png

http://i.imgur.com/v4Dhv.png

Edited by xdaniel
  • Like 1
Link to comment
Share on other sites

Yep, classic GB emulator :P

 

It's basically me trying to modernize and improve upon a buggier, incomplete GB emulator I've coded up in C a year or two back called GBME; there's an old thread at Zelda Coalition I think. Not as many features as said C-based emulator yet (no MBC2-5 support, no debugger, etc.), has some bugs that the older one didn't have (ex. screen refresh issues with sprites and windows, see the weird lines in the Kirby and Pokemon screens), but it's an overall cleaner design, excluding some classes that are so far just direct ports of the old C code - the LCD controller comes to mind here.

 

There's no sound yet, although I'm looking into it - probably porting parts of VBA's code because emulating it looks difficult as hell - and compatibility is somewhat low, but I'm hopefully getting there :P

 

EDIT:

Posted ImagePosted ImagePosted ImagePosted Image

 

Many CPU opcodes have been fixed, interrupt and MBC management have been partially rewritten, MBC2 (ex. Wave Race) and 3 (ex. Pokemon Red/Blue, western versions) support is in and working, MBC internal/external RAM saving is in, which appears to be working correctly this time around.

Edited by xdaniel
Link to comment
Share on other sites

General notes: Rewritten rendering, now it's using DirectX via SlimDX and no longer exhibiting those sprite and window flickering glitches; the emulator tends to crash with invalid ROM/RAM bank accesses with some games, but that's probably down to bugs in the CPU core and not the MBC emulation (and certainly not the games); some timing fixes concerning interrupts and the LCD controller, still inaccurate (ex. missing/incorrect scrolling in Pokemon); sound looks really damn difficult and is a very low priority. Will do some GUI and usability cleanups, add some error handling, then comes a first release.

 

Game-specific screenshots below: Pokemon Gold (no RTC emulation yet, also that Rattata isn't anywhere near the top percentage of Rattata :P), Kirby's Dream Land 2 (great game), X (cool to see in general) and Tetris DX (mainly to demonstrate saving once more).

 

Posted ImagePosted ImagePosted ImagePosted ImagePosted Image

Link to comment
Share on other sites

Posted ImagePosted ImagePosted Image

 

Work-in-progress "Machine Debugger". The disassembler is working, complete with highlighting of different memory areas (ex. current PC is cyan and bold, sprite memory is violet, I/O registers are green) and selective textual output (data is only disassembled in areas where code can even be, ex. I/O registers are instead named, ex. VRAM is output bytewise in 8-byte steps). The rest of the window already gives an idea of what's to come - showing CPU registers and flags, a stack rundown, a memory viewer, setting breakpoints on read/write/execute, graphic viewers for tiles, tilemaps, maybe sprites, etc.

 

...but for now, time to sleep - it's 3:05 AM after all :P

 

EDIT: Uwahh... I'm a moron. It's 4:20 now:

 

Posted Image

Edited by xdaniel
Link to comment
Share on other sites

Well, there's the legendary(?) NO$GMB that everyone and their mother pirated - myself included, I have to admit -, because it supported serial link emulation (= Pokemon trading) before anything else did:

 

Posted Image

 

It's actually my inspiration for quite a bit of the up and coming debugger :P

 

EDIT:

 

Posted Image

 

Disassembler and CPU status pretty much done, memory viewer coming up next...

 

EDIT 2:

 

Posted Image

 

Wrote a custom hexadecimal viewer control, navigable via cursor keys or mouse. Everything else - like basing it off a TextBox or ListBox - was too cumbersome and maybe even more work in the end. Might look into adding editing capabilities, but for now it's good enough :P Still need to add a goto address function, like with the disassembler above, but that should be easy.

Edited by xdaniel
Link to comment
Share on other sites

Yah, I went there. The hex viewer editor control's now capable of editing stuff:

 

Posted Image

 

Just entered an 8; the control now expects either another digit, or pressing the enter key to write that value alone (becomes 0x08).

 

Posted Image

 

See? And editing can be disabled via the control's properties, so it can also be used as a plain hexadecimal viewer.

 

(And yeah, I entered those 0xAA's, which resulted in the glitched looking tile in the title logo. And yeah, the second screenshot was actually taken before the first one, so please excuse the missing 0x08 in the latter one.)

 

EDIT:

 

Posted Image

 

Yes, that square can be clicked on.

Link to comment
Share on other sites

Posted ImagePosted ImagePosted Image

 

With rather stable CPU, LCDC and Interrupt code, I started GBC emulation; still very, VERY preliminary right now...

 

(Also, Lyra sucks, Kris ftw!)

 

EDIT:

 

Posted Image

 

Well, BG layer colors are there now, now to fix window and sprite rendering, plus the host of other glitches still occuring.

 

EDIT 2:

 

Posted Image

 

Window and sprite rendering implemented; but the GBC's HDMA capabilities, CPU double speed mode and other features aren't done yet, and what's there has some bugs (ex. sprite colors are somewhat wonky).

 

EDIT 3:

 

Partial HDMA and CPU speed change emulation and bugfixes later...

 

Posted ImagePosted ImagePosted ImagePosted ImagePosted Imagehttp://i.imgur.com/AUfsG.png

 

Regarding GBC and MBC5 emulation only, Tetris DX works without visible glitches, Zelda DX has some issues with sprites and VRAM bank switching, Pokemon Gold works somewhat but has slight graphical glitches and crashes when entering and/or leaving the menu (Crystal has some severe graphic errors and dies when going in-game, probably MBC-related), Mega Man Xtreme works with minor glitches, Pokemon Puzzle Challenge appears to have more VRAM and/or MBC bank switching problems, with missing or corrupted graphics, and has logic bugs in-game (CPU core?), and Super Mario Bros. Deluxe has minor graphical bugs, but is unplayable because of MBC problems (levels are fully made of breakable blocks).

 

EDIT 4:

 

http://i.imgur.com/mWy8v.pnghttp://i.imgur.com/doQ9A.png

 

Tried to improve HDMA emulation, didn't go all too well...

Edited by xdaniel
Link to comment
Share on other sites

About two days, a rewrite of both memory management and GBC HDMA emulation later:

 

Posted ImagePosted Image

 

...but you get a spectacular crash before you even get to leave your house. Mostly while talking to your mom. She's a mean person, isn't she?

 

Also, that rewrite broke compatiblity with quite a few GBC games, including Zelda DX, Mega Man Xtreme and others...

Link to comment
Share on other sites

It's great to see you're still the enthusiastic coder and hacker you were years ago.

 

Looking forward to your first public beta release and will post about it on (nearly?) all known and important emulation sites. :P

And remember: GEST is still out there, which is one of the best, if not the best GB/C emulator available and open source. But keep on mind: accuracy is the key to success.

 

But keep in mind, that GBEmu already was used for a GB emulator for the PSP in 2005, so you should probably change its name to prevent confusion.

Link to comment
Share on other sites

For one, the emulator has been renamed - SharpBoy is now its name. Doesn't seem like that's been used for an emulator already :P

 

Now, as for accuracy and the like. I've been referencing GEST's source now, implementing new stuff and rewriting existing code. Overall accuracy, as far as ex. IRQ timing goes, has dropped a bit for now it seems, but I'm starting to see the fruits of the rewrites, with games now booting, running further, etc. than before. For example, Pokemon Crystal no longer crashes like mad, same goes for Pokemon Gold/Silver in GBC mode, and Super Mario Bros. Deluxe is now playable. I'm by no means as passionate as byuu when it comes to writing emulators and adhering to accuracy, but I'm going to keep trying my best :P

 

And all that said, I'm preparing the first release now. Gonna add some more usability-related things (ex. saving of emulator settings), maybe try and fix a few of the hopefully simple bugs (ex. sprite priorities) and then post it here~

 


Also... some screenshots from yesterday, while/after fixing some GBC-specific bugs (mainly WRAM bank switching and the CPU double speed mode):

 

Posted ImagePosted ImagePosted ImagePosted ImagePosted Image

 

Pokemon Gold, Pokemon Crystal (GBC only), Tetris DX, Pocket Puyo Puyo 4 (GBC only) and R-Type DX.

 

Posted ImagePosted ImagePosted ImagePosted ImagePosted Imagehttp://i.imgur.com/kv7gN.png

 

Super Mario Bros. Deluxe (GBC only), Zelda: Link's Awakening DX, GBC Promo Demo (GBC only), Pocket Bomberman, Mega Man Xtreme and Tales of Phantasia: Narikiri Dungeon.

Link to comment
Share on other sites

Download v0.1: http://magicstone.de/dzd/sharpboy/

 

Feedback is welcome! :P

 

EDIT: To those getting crashes or somesuch, do you have the latest .NET Framework 4 installed? If not: Microsoft .NET Framework 4 (Standalone Installer) and please post if it helped!

Edited by xdaniel
Link to comment
Share on other sites

Emutalk is down atm, so I can't post a news at Emulation64.com about it (but Wraggster usually "steals" all the news I post at AEP, so if ET&emu64 are back and I wait to long, it will be posted there without doubts), but I already reported at AEP-emu and emuxhaven and will test it after sleeping and after I found some time tomorrow/today. :P

 

 

Thanks for the release.

Link to comment
Share on other sites

MasterPhW: Thanks for the news posts, although this release appears to not work correctly for several people ^^" Trying to fix this right now and will post an updated build once I've confirmed it working for those where it doesn't atm...

 

Salvage66: Probably my smallest concern right now, but most likely a little Game Boy or something...

Link to comment
Share on other sites

MasterPhW: Thanks for the news posts, although this release appears to not work correctly for several people ^^" Trying to fix this right now and will post an updated build once I've confirmed it working for those where it doesn't atm...

 

It seems, that I'm one of those lucky bastards.

Posted Image

 

logfile_0.txt is empty.

I normally should have installed all needed libs, like .net 4, but sadly it didn't works here.

My rig is in my sig. I just pops up for a few miliseconds than closes itself.

Link to comment
Share on other sites

Yeah, apparently the sound code (and/or SlimDX's sound components) in the initial build is one thing that's creating problems, so the site's been updated with v0.1a that has sound completely disabled - the one I sent over to alphaheiti for testing. In addition, the "class not registered" error appears to happen when one doesn't have the SlimDX End User Runtimes installed - needed for all applications using SlimDX (-.-) - so a download link has been added to the site as well:

 

http://magicstone.de/dzd/sharpboy/

 

Thus, download the SlimDX runtimes, download the updated emulator and then it should work :P

Link to comment
Share on other sites

 Share

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.