Jump to content

SharpBoy - A Game Boy emulator in C#


xdaniel
 Share

Recommended Posts

alphaheiti: Yeah, both OoA and OoS don't work right for now. Haven't looked into what's hanging them yet...

 

Salvage66: There's no sound, period. It's somewhat difficult to emulate, and even the (more or less) copy and paste from VBA and GEST I did for sound channel 1 didn't result in anything that's really recognizable. It will have sound at some point, but probably not in the near future.

 

MasterPhW: Many mainstream games should work already, excluding the above mentioned Zelda OoA/OoS (with minor glitches, maybe), but I know that many hard to emulate things don't yet - ex. certain PD demo ROMs come to mind here. Really looking forward to your test results :P

 

EDIT:

 

Posted Image

 

Haven't tested it much yet, tho :P

 

EDIT 2:

 

Figured out why the Oracle games hang, has to do with the missing sound emulation... A small hack later:

 

Posted ImagePosted ImagePosted ImagePosted ImagePosted Image

 

Currently hangs after the last screenshot.

 

EDIT 3:

 

Posted Image

 

Seasons actually goes further than Ages, no other screenshots, tho, as I'm about to look into the messed up graphics...

Edited by xdaniel
Link to comment
Share on other sites

Posted ImagePosted ImagePosted ImagePosted Image

 

Fixed a misconception of mine - cast the DMA length to a byte, which is too small of a data type for the Oracles' DMA transfers - so the graphics are now correct :P

 

EDIT: Also noticed that Ages crashes and restarts after the "Accept our quest, hero!" line, not sure why yet.

 

EDIT 2:

 

Posted Image

 

The Demotronic PD demo now also shows graphics, yet doesn't run because the emulator isn't accurate enough yet :P

 

EDIT 3:

 

Posted ImagePosted Image

 

Both, the original DMG and CGB bootstrap ROMs can now be used, however emulation issues make the DMG one run really sloooooowwwww...

Edited by xdaniel
Link to comment
Share on other sites

Posted ImagePosted ImagePosted Image

Crashed and restarted when about to go in-game; didn't proceed beyond the first screen which had graphical glitches; had some little graphical errors (just showing it off since it's one of my favorite games on the GB/GBC). All now seem to work pretty well.

 

Also, no comments at all? :P

 

...Ohhhhh, I get it now, you're trying to force me to return to Sayaka, right?! Admit it! ADMIT IT!!! >.<!

(j/k)

Link to comment
Share on other sites

You figured us out Xdan! Our devious plots to negate you back to Sakaya has been exposed!

 

Also great work on the GB emulator, though I guess a name change will be in order. I look forward to seeing Oracle of Ages running since it was one of my favorite GB/C games as well.

Link to comment
Share on other sites

Soo, I just embarked on a little playthrough of Ages, got all the way up to getting the shovel, got the Heart Container nearby - all with almost zero graphical glitches (pseudo-transparency via sprite flickering doesn't work right, two glitched map tiles which fixed themselfs after re-entering the screen) -, then checked out the menu screen, and promptly got a crash when I tried to exit the menu. So I'd say the main gameplay is working, but some specific bugs, which I still have to investigate, keep the game from being playable...

 

In other news, I started enhancing the debugger; to be exact I started work on breakpoint support. With how I'm planning them, you'll be able to set breakpoints on any currently active memory location (thus 0x0000 to 0xFFFF in the memory map), as well as all ROM, WRAM or VRAM banks as applicable, which can trigger on reading from, writing to and/or executing the opcode at that memory location.

Link to comment
Share on other sites

I dunno, I'm probably not gonna rename it again... The other SharpBoy hasn't been updated in almost a year, so I'm inclined to say that that project is dead.

 

In other news, the pseudo-transparency now works correctly, because I changed the point at which I draw the screen. Previously, I just drew the current screen contents at the end of every "emulation frame", now I do so whenever the last visible scanline has been rendered, just prior to entering V-Blank. I wish I could show a screenshot of it, but by the flickering nature of this, you'd only see - ex. in the case of the Oracles - either Link falling, or the glowing barrier thingy around him :P

 

EDIT: Took a break from breakpoints (ooh, the puns :P) and looked into why many GBC games didn't even boot correctly or had weird graphic glitches before crashing. Turns out they use the MBC5 memory controller, and I had the ROM bank select of that MBC done incorrectly - one two changed lines later, MBC5-based games spring to life one after another:

 

Posted ImagePosted Image

 

EDIT 2:

 

SharpBoy v0.2 released!

 

  • GBC DMA emulation fixed, transfer length wasn't being calculated correctly; fixes incorrect and missing graphics in some games
  • LCDC emulation improved, fixes flickering and slowdown in certain games and demos
  • MBC5 ROM bank select fixed; many more Game Boy Color games now start and/or run further
  • Timing of screen drawing improved, which results in less graphical glitches with ex. flickering sprites for pseudo-transparency
  • Temporary hack added to allow the Zelda: Oracle games to boot correctly, coupled with the above fixes they now go in-game
  • DMG and CGB bootstrap ROMs now supported; have to be named DMG_ROM.bin and CGB_ROM.bin and enabled via the menu
  • Manual system type selection implemented, emulator can now be forced to run in GB or GBC mode (not complete yet)
  • Controls can be changed via the GUI
  • Other minor GUI and usability improvements (ex. path to last ROM image run is saved to config.xml)
Edited by xdaniel
Link to comment
Share on other sites

I agree with Zeth, if you can get Oracle of Ages working I'll be really happy. It hasn't worked on any of the emulators I've tried to run it on, so I look forward to seeing progress. :P

 

Surprisingly I've been playing Oracle of Ages on my Nintendo DS since I got a emulator for the flashcart I have and runs pretty awesome, its Xdan's fault for me wanting to play this game again! XD

 

Only a few more days and I get my new computer so I can test this emulator! :P

Link to comment
Share on other sites

Sooo... I've decided to drop SlimDX and use OpenTK instead. For one, OpenTK doesn't need any runtimes or anything installed, and it also supports OpenAL for sound output. Besides, I'm used to OpenGL so getting nice and fast video output should be easy :P

 

Also, what I had already added over the last few days is loading ROMs from ZIP archives (via DotNetZip) and preliminary emulation of the Game Boy Camera's MBC. It boots, the menus and mini-games work, but emulation of the actual camera part isn't in (yet?).

 

EDIT: Alright, SlimDX is out, OpenTK is in and working perfectly fine. Also, video filtering can now be switched on (bilinear) or off (nearest neighbor):

 

Posted ImagePosted Image

 

Guess which one is which :P

 

EDIT 2:

 

Posted Image

 

Hmm....

 

EDIT 3: ...more difficult than I had imagined -.- Gotta focus on compatibility again, instead of things like the Game Boy Camera or whatever...

Edited by xdaniel
Link to comment
Share on other sites

Sooo... I've decided to drop SlimDX and use OpenTK instead. For one, OpenTK doesn't need any runtimes or anything installed, and it also supports OpenAL for sound output. Besides, I'm used to OpenGL so getting nice and fast video output should be easy :P

...

EDIT: Alright, SlimDX is out, OpenTK is in and working perfectly fine.

 

>1302453913

 

Rewritten rendering, now it's using DirectX via SlimDX

 

Does this mean Shaders? :P

 

>1299791017

Over those 2,662,896 seconds xdaniel changed his mind and his code. It was DirectX (through SlimDX), and now it is OpenGL (through OpenTK). Regardless, I believe both OpenGL and DirectX support shaders. What purpose they would have in a GBC emulator is beyond me.

Link to comment
Share on other sites

Yeah, shaders are supported by DX and OGL, but no, I'm not using them here. I suppose you could use them for some fancy graphic filters or something, but I don't really see the point in those for a GB/GBC emulator... If anything, I'd look into some of the "classic" filtering algorithms like Scale2x.

 

EDIT:

 

Posted Image

 

Breakpoint management pretty much complete (might change the list's layout a bit), still need to add code to use them in the CPU and memory emulation...

 

EDIT 2:

 

Implemented and improved breakpoint support; still a bit iffy, tho. Also fixed the GBC bootstrap's colorization functionality - what that means? Monochrome GB games are now colorized just like on a real GBC:

 

Posted Image

 

It does look a bit weird in emulation, in my opinion, but that's what it looks like on my GBC and GBA SP as well. Guess the machine's display makes it look better in reality or something...

 

EDIT 3:

 

Posted ImagePosted ImagePosted Image

 

Oh boy, oh boy! <3

 

EDIT 4:

 

Implementing breakpoints is proving to be a bit more difficult than I had anticipated... So here's this fancy GUI feature instead! A list! Featuring the ten most recently opened ROMs! Oh my god, it's incredible, it's like an encyclopedia for ten ROMs!

 

(...and yes, that was sarcasm, although the feature does exist now.)

 

Posted Image

Edited by xdaniel
Link to comment
Share on other sites

  • 2 weeks later...

Don't know if this has been posted but I've been getting some extreme fps problems, games running faster then they should, especially with the FPS Limit on. I'm getting 65 FPS with the limiter on and 95+ for the FPS off. Also no sound, but I think that's cause its been disabled?

 

Posted Image

Link to comment
Share on other sites

The FPS limiter is pretty unstable and more of an approximation than anything else... Also, sound isn't being emulated at all, as all the "experiments" I did with that before didn't work out too well.

 

EDIT:

 

Posted Image

 

*cough* Happy now, Salvage66? Made mostly from scratch, looked at some other icons for how to draw that perspective, tho. That's supposed to be a GB Pocket, btw, my good old silver GB Pocket to be exact :P The icon's probably a bit dark, might touch it up a bit more.

 

Also, changelog so far for SharpBoy v0.3, no release date or anything set yet:

 

  • Switched rendering from using SlimDX to OpenTK, SlimDX Runtimes no longer needed; video filtering now selectable
  • GBC DMA copy operations improved, fixes certain DMA transfers spanning different areas of memory
  • Improved support for "undocumented" I/O registers, Demotronic Demo no longer detects the emulator and now runs with some glitches
  • Above change, coupled with improved graphics emulation, also fixed colorization of monochrome games via the CGB bootstrap ROM
  • Preliminary MBC emulation for Pocket Camera / Game Boy Camera; no actual camera support
  • ROMs can now be loaded from ZIP archives (using the DotNetZip library); recent ROM history added to menu

EDIT 2:

 

Posted Image

Link to comment
Share on other sites

  • 3 weeks later...

SharpBoy v0.3 released, see SharpBoy Temporary Website for download: http://magicstone.de/dzd/sharpboy/

 

Changelog:

 

  • Switched rendering from using SlimDX to OpenTK, SlimDX Runtimes no longer needed; video filtering now selectable
  • GBC DMA copy operations improved, fixes certain DMA transfers spanning different areas of memory
  • Improved support for "undocumented" I/O registers, Demotronic Demo no longer detects the emulator and now runs with some glitches
  • Above change, coupled with improved graphics emulation, also fixed colorization of monochrome games via the CGB bootstrap ROM
  • Preliminary MBC emulation for Pocket Camera / Game Boy Camera; no actual camera support
  • Frame skipping and speed-up functionality implemented
  • ROMs can now be loaded from ZIP archives (using the DotNetZip library); recent ROM history added to menu
Link to comment
Share on other sites

Man, there's already a changelog for the next release...

 

  • Fixed compatibility regression with GBC DMA transfers, affects ex. Pokemon Puzzle Challenge
  • Improved LCD Status interrupt generation, fixes faked high-color display in certain Game Boy Color games
...the latter still needs some more work, tho, as it currently causes some palette glitches in other games.

 

EDIT:

 

The Oracle games appear to work right now, without crashing when exiting the menu. Seems to have been the fault of... well, I don't know. Some code that I probably had added as a kludge to get something else working. I commented that out and above it left the note:

 

// vvv-- WHAT WAS THIS FOR???

Best thing to do now is go through a whole bunch of games and demos and see if they're still working right with the recent changes.

 

EDIT 2:

 

Sorta unrelated:

 

Posted ImagePosted Image

 

Notice Bow-Wow's chain and the characters' shadows, as well as the status bar in WaveRace. Okay, I believe most(?) other GB emulators support that as well, so it's nothing new. But still! http://core.the-gcn.com/public/style_emoticons/default/teehee.gif

Edited by xdaniel
Link to comment
Share on other sites

 Share

×
×
  • Create New...

Important Information

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