Kega Fusion v3.61

Talk about development tools here

Moderator: BigEvilCorporation

King Of Chaos
Very interested
Posts: 273
Joined: Fri Feb 29, 2008 8:12 pm
Location: United States

Kega Fusion v3.61

Post by King Of Chaos » Wed Dec 10, 2008 10:50 pm

New Kega build out...

---------------------------------------------------------------------------
Kega Fusion v3.6 (C) Steve Snake 2008
---------------------------------------------------------------------------

Whats New ?
-----------

Well it's been a long time. Lots of really bad things have happened, often
working on Kega felt like the last thing I wanted to be doing.

Still. Work on it I did. Lots of changes and additions over the last two
years, most of which I've forgotten about again, but here's the stuff I
can remember:

* Fixed Sound/Timing Issue with Fahrenheit SCD/32X.

* Fixed a typo which corrupted a register in the YM2612 SSG/EG section.

* Removed a few pieces of test code that were not supposed to be left in,
and affected timing of various things under certain conditions.

* LOTS of behind-the-scenes fixes and improvements, which I've totally
forgotten, but you will notice them and remind me at some point ;-)

* Rewrote controller code, should fix problems with some USB controllers.

* Rewrote Menacer emulation which made it easier to add Konami Justifier
emulation. Just the first Justifier is emulated for now. You'll
definitely want to calibrate it in games that use it.

* Added SegaCD SaveStates that actually, you know, work.

* Added support for more games that use custom SRAM, and fixed some that
were already emulated, but got broken at some point.

* Added support for all unlicensed Genesis games that I know of.

* Added support for the Sega Virtua Processor (SVP). Thanks to the reverse
engineering work by the amazing Tasco Deluxe, and the proof of concept
emulator by Notaz, I was able to write and debug my ASM core for this in
just two days.

* Removed some filtering in YM2612 SuperHQ mode (you won't actually notice)
and instead added a "Filter" option to the sound menu. This filter is
very close to that in a real Model 1 Genesis/MegaDrive. Most people will
want to leave this off (me included) but I know some people wanted it.

* Removed 11025Hz option. It was causing me problems, doesn't work well on
most newish hardware, and sucked anyway.

* Added preliminary Sega Pico support. There's a lot more I plan to do with
this. For now, just load as a Genesis ROM. Mouse is required for Pico,
along with the following controls: START switches between StoryWare and
trackpad, B is the pico red button, A and C turn pages, and U/D/L/R are,
well, U/D/L/R.

* Added ability to create 128K SegaCD RAM carts to keep SpinelSun happy ;-)

* Added two controller sharing options for Netplay. Everybody can now share
controller one, or all controllers. The latter isn't very useful, but why
not.

* Added "Nearest Multiple" option to the Video Menu. The various Aspect
modes do what they have always done when this option is enabled, but now
when it is disabled, they will allow non-multiple stretching while still
keeping the aspect ratio correct.

* Added "Use NTSC Aspect" option to the Video Menu. This used to be done
automatically under certain conditions, now you have full control.

* Added Pause Emulation feature.

* Added Frame Advance feature.

* Added No Frame Skipping feature. You should pretty much ignore this and
let Kega do what is best. But it does also trigger a special case mode
when you have VSync enabled, and you hit Fast Forward. Normally, VSync
is ignored during Fast Forward, or else Fast Forward wouldn't actually
do very much. With No Frame Skipping enabled, it will still do VSyncs.
This might be useful to you if your video mode is running at some odd
refresh rate. Note that the sound could well sound awful if you do this.

* Added AVI Logging using custom Kega Game Video 1 lossless codec. This is
needed because logging RAW video causes poor performance even on highend
machines, and using any of the available codecs either doesn't compress
well enough to fix that, or does compress well enough, but can't keep up
with 60fps, so you get poor performance either way. The codec is able to
use hints from the emulator to aid in compression, allowing pretty good
compression while taking very little CPU time. The codec to allow you
to play back and convert the files is included in the archive, and can
be installed via right clicking on the INI file and telling the OS to
continue with the install. Tested on XP and Vista64, should work fine
on 9x and Vista32.

Note that these AVI files are not really meant to be shared as they are,
it's just a way for you to log video without horrible laggy gameplay.
Convert them to Xvid or something using the excellent VirtualDub program
(Google it.) I'll open up this codec sometime later incase it's useful
for other purposes/programs.

* Disabled BIOS use where possible during Netplay games, to prevent out
of sync errors when people had different combinations of BIOS/NO BIOS/
Different BIOS.

* Netplay Games should now automatically change your country code to that
of the host.

* Added Fast 32X Timing option. This is mainly for development. If you
don't know what this is for, leave it disabled.

* Added CartBoot option, which is enabled via INI file only. Again, if
you don't know what this is for, leave it disabled.

* Kega Fusion now runs beautifully under Vista.

Kega Fusion was already more accurate than any other emulator, this time
around, thanks to various internal tweaks, and removing of left-over test
code, it SHOULD be more accurate than ever before :-)

I don't think I broke anything, but there have been some very big changes
and I have changed machines and build environments twice since the last
version, so it's entirely possible. Please let me know if I have.

I'll just add here that several people assumed Kega was 'dead' because I
hadn't updated it for a long time. Rest assured, this is not the case.
Nothing is 'dead' unless I say otherwise. I may well have some problems,
or even other projects, that take all my time. But just like Arnie, I'll
be back.

Gotta go, busy busy busy...

Snake.
kega kat at gmail dot com (withnospacesanywhere)

Download site: http://www.eidolons-inn.net/tiki-index.php?page=Kega
Last edited by King Of Chaos on Wed Dec 24, 2008 2:42 am, edited 1 time in total.

TmEE co.(TM)
Very interested
Posts: 2440
Joined: Tue Dec 05, 2006 1:37 pm
Location: Estonia, Rapla City
Contact:

Post by TmEE co.(TM) » Thu Dec 11, 2008 8:04 am

Go Steve :D
Mida sa loed ? Nagunii aru ei saa ;)
http://www.tmeeco.eu
Files of all broken links and images of mine are found here : http://www.tmeeco.eu/FileDen

Eke
Very interested
Posts: 884
Joined: Wed Feb 28, 2007 2:57 pm
Contact:

Post by Eke » Thu Dec 11, 2008 2:09 pm

Great ! Nice work with those unlicensed games and the SVP emulation

I tested some timing sensitive games (the ones that I personnally have to test again every time I change somthing in my timings :wink: ), and here's the result:

*related to VINT timing:
Fatal rewind: hangs on black screen
Out Runners: corrupted pixel dots on title screen

*related to HINT/HBLANK timings:
Sonic 3D Blast: flickering line in Bonus Mode
Kawasaki Super Challenge: single line glitch at the bottom of active display
Deadly Moves: flickering line at the top of active display


good luck, I know how this is painful to get 'em all working


fixed VDP stuff I noticed:
- Sega logo in Bass Master Classic Pro in now correctly displayed ;-)
- "Star Wars"-like intro in Monster World 4 is not freezing anymore
Last edited by Eke on Thu Dec 11, 2008 4:57 pm, edited 1 time in total.

ElBarto
Very interested
Posts: 160
Joined: Wed Dec 13, 2006 10:29 am
Contact:

Post by ElBarto » Thu Dec 11, 2008 2:46 pm

I assume the cartboot options is like to put a tape on B32 right ?
I don't have a windows to test right here.

AamirM
Very interested
Posts: 472
Joined: Mon Feb 18, 2008 8:23 am
Contact:

Post by AamirM » Thu Dec 11, 2008 3:07 pm

Hi,
Out Runners: corrupted pixel dots on title screen
IIRC, I am pretty sure its a DMA issue. I have the same problem in Regen. Never got the time (read: motivation) to fix it. I can be wrong though. I looked at it very long time ago.
Kawasaki Super Challenge: single line glitch at the bottom of active display
Again, it can be DMA. You might also want to check out F1 World Championships. Not sure again though.
good luck, I know how this is painful to get 'em all working
Ditto ;) .
* Added No Frame Skipping feature. You should pretty much ignore this and
let Kega do what is best. But it does also trigger a special case mode
when you have VSync enabled, and you hit Fast Forward. Normally, VSync
is ignored during Fast Forward, or else Fast Forward wouldn't actually
do very much. With No Frame Skipping enabled, it will still do VSyncs.
This might be useful to you if your video mode is running at some odd
refresh rate. Note that the sound could well sound awful if you do this.
What!!!? Kega used frame skipping in Fast Forward all along!! Ahhh.....it all makes sense now :) . I've been optimizing the hell out of my SMS/GG/SC/SG emulation core to make it as fast as Kega. So I've been comparing with frame skipping :D . I don't skip frames while in fast forward ;) .

I have one bug report though. Its related to SSG-EG in Olympic Gold - Barcelona 92. The background music in water diving during training doesn't seem to be correct in some places. Will post some recording shortly.

EDIT:
Here is what I am talking about.

stay safe,

AamirM
Last edited by AamirM on Thu Dec 11, 2008 3:59 pm, edited 1 time in total.

Graz
Very interested
Posts: 81
Joined: Thu Aug 23, 2007 12:36 am
Location: Orlando, FL

Re: Kega Fusion v3.6

Post by Graz » Thu Dec 11, 2008 3:26 pm

King Of Chaos wrote:Lots of really bad things have happened, often working on Kega felt like the last thing I wanted to be doing.
That doesn't sound good. Hopefully things are going better for you now. We all appreciate the work you've done. Thanks, Steve.

Snake
Very interested
Posts: 206
Joined: Sat Sep 13, 2008 1:01 am

Post by Snake » Thu Dec 11, 2008 6:50 pm

Thanks Eke - the annoying thing is all this stuff should have worked, but I think I messed with the timing while the bad test code was still in place. Now I've removed that code some timing or other is probably happening a few cycles too early. Ah well, at least I have things to test, now :)
AamirM wrote:What!!!? Kega used frame skipping in Fast Forward all along!!
Hehe - VSync skip - not frame skip ;)

If you think about it, if your refresh rate is 60hz, and you're running a 60hz game vsynced - if you hit fastforward nothing will happen. Not very useful ;) So vsyncs are skipped in fastforward normally.

King tells me this build reports just 2% CPU utilisation while playing Comix Zone. It's a bit silly fast :)

Thanks for the zip, I'll look into it.

AamirM
Very interested
Posts: 472
Joined: Mon Feb 18, 2008 8:23 am
Contact:

Post by AamirM » Thu Dec 11, 2008 7:23 pm

Hi,
Snake wrote:Hehe - VSync skip - not frame skip Wink

If you think about it, if your refresh rate is 60hz, and you're running a 60hz game vsynced - if you hit fastforward nothing will happen. Not very useful Wink So vsyncs are skipped in fastforward normally.

King tells me this build reports just 2% CPU utilisation while playing Comix Zone. It's a bit silly fast Smile
Haha :lol: . Well, you just wait :D . In my attempt to bring Regen's speed upto Kega's level I've (blindly) optimized things so much now that, in same SMS game, the new Fusion 3.6 gives 690-700 FPS (frameskipping disabled, fast forward) while Regen (frameskipping gets disabled while in turbo mode) gives over 900 FPS. And all my code is in C. And if it wasn't for the new release, I would've still been trying to make it more fast. Though, I still have to make Genesis emulation more faster.

stay safe,

AamirM

King Of Chaos
Very interested
Posts: 273
Joined: Fri Feb 29, 2008 8:12 pm
Location: United States

Post by King Of Chaos » Thu Dec 11, 2008 9:03 pm

Yeah Comix Zone and Virtua Racing are running rather well with full speed on Vista with very, very little CPU utilization.

I need to find some Sega Pico games (I guess the prototypes) to test.

Snake
Very interested
Posts: 206
Joined: Sat Sep 13, 2008 1:01 am

Post by Snake » Thu Dec 11, 2008 9:06 pm

AamirM wrote:Haha :lol: . Well, you just wait :D . In my attempt to bring Regen's speed upto Kega's level I've (blindly) optimized things so much now that, in same SMS game, the new Fusion 3.6 gives 690-700 FPS (frameskipping disabled, fast forward)
Hmm, I think you've just found a bug. "Frameskip" setting shouldn't make any difference at all in fast forward, the only thing it should change is vsyncs do or don't get ignored - in effect, if fastfoward is enabled, it instead gets used as a vsync flag. How odd. 700fps for SMS should be doable @ 300Mhz! The only thing I can think of is that it's somehow forcing a vsync every so often, maybe in some other code.
[edit] Actually the main reason I added it was for AVIs, to make sure every frame got written. Maybe I'm still sending the screen to my AVI code, which at the very least means an extra screen copy per frame. That'd do it. I'll have to look.

Regardless, trying to optimise SMS is probably a waste of your time, I imagine it was fast enough on pretty much any system capable of running it anyway. I can't say I put too much effort into optimising SMS either, there's just no point. However, getting a C based emulator running at a similar speed should tell you, you might be missing something ;) Accuracy is of higher importance to me. My Z80 core is probably much slower than most out there, because it's about as accurate as is possible. It runs one cycle at a time, not one instruction. Every read/write is performed on the exact cycle as real hardware, and a lot of instructions do multiple reads or writes to the same address, even ones that don't actually NEED to read anything do this - because that's what a real Z80 does. The Z80 is... a bit odd ;)

Anyway, if I ever do get back to serious SMS work, it's going to get slower, not faster.
Last edited by Snake on Fri Dec 12, 2008 1:23 am, edited 3 times in total.

Christuserloeser
Very interested
Posts: 145
Joined: Sun Jan 28, 2007 2:01 am
Location: DCEvolution.net
Contact:

Post by Christuserloeser » Thu Dec 11, 2008 9:10 pm

Thanks for the new release! :)

- I wonder if you got any plans to release (parts of) the emulator under the GPL or a similar free software license one day ? (as this would be about the only thing anyone could possibly complain about with this emulator)


Keep up the good work.
http://www.DCEvolution.net - Gigabytes of free Dreamcast software for you

Image

King Of Chaos
Very interested
Posts: 273
Joined: Fri Feb 29, 2008 8:12 pm
Location: United States

Post by King Of Chaos » Thu Dec 11, 2008 9:49 pm

Might of found something. In Comix Zone when fighting a certain enemy (or enemies) on one of the levels, there's an area where the ground is near that glitches at times. I thought it was because of the Genesis sprite limit being hammered into, but I'm not sure.

I tried to get a screenshot as the glitch occurred (it wasn't easy), and I'll give a savestate for the area where the glitches begin. :)

Screenshot:
Image

Savestate: http://www.mediafire.com/?sharekey=6acb ... 430ab8fe9d

I'll just assume for now it's because of the Genesis sprite limitation, since Comix Zone does push it to its limits. :P

devzone
Interested
Posts: 18
Joined: Sun Jun 01, 2008 12:21 am
Contact:

Post by devzone » Thu Dec 11, 2008 9:52 pm

Thanks for the new version good work

This might be a noob question but is the source code for kega available ?

King Of Chaos
Very interested
Posts: 273
Joined: Fri Feb 29, 2008 8:12 pm
Location: United States

Post by King Of Chaos » Thu Dec 11, 2008 9:56 pm

devzone wrote:This might be a noob question but is the source code for kega available ?
It's a closed source emulator.
Christuserloeser wrote:I wonder if you got any plans to release (parts of) the emulator under the GPL or a similar free software license one day ? (as this would be about the only thing anyone could possibly complain about with this emulator)
I can't speak for Snake, but I don't see this ever happening, mainly because I don't think Snake would want his code (that he has worked long and hard on) out there being changed, mangled and torn apart and added to different ports and emulator variants. Complain away, I guess. :)

Nemesis
Very interested
Posts: 791
Joined: Wed Nov 07, 2007 1:09 am
Location: Sydney, Australia

Post by Nemesis » Fri Dec 12, 2008 4:09 am

Awesome! I've been waiting for this to come along.

You need to modify the framerate counter. The thing seems to cap at 999FPS. :D
My Z80 core is probably much slower than most out there, because it's about as accurate as is possible. It runs one cycle at a time, not one instruction. Every read/write is performed on the exact cycle as real hardware, and a lot of instructions do multiple reads or writes to the same address, even ones that don't actually NEED to read anything do this - because that's what a real Z80 does.
Damn, you've got me beat. My Z80 core is nowhere near that level yet. A super-pedantic cycle-exact Z80 is filed under "insane project #247" in my to do list.
AamirM wrote:
Out Runners: corrupted pixel dots on title screen
IIRC, I am pretty sure its a DMA issue. I have the same problem in Regen. Never got the time (read: motivation) to fix it. I can be wrong though. I looked at it very long time ago.
Kawasaki Super Challenge: single line glitch at the bottom of active display
Again, it can be DMA. You might also want to check out F1 World Championships. Not sure again though.
I've been doing quite a bit of work on the VDP lately, and I know of half a dozen or so confirmed test cases which can break things under Kega, Gens, and probably every other Mega Drive emulator to varying degrees, and I haven't even tested most of the stuff I've come across in emulators. Almost all of these cases are obscure and undefined points of behaviour, but that's not to say there isn't code out there which relies on some of them. There are some fundamentals about how the VDP processes control/data port access, how it works with its registers, and how and when DMA operations are initiated. When you get these right, all those little quirks go away.

I'll be releasing my notes when I'm further along with the testing. I'm trying to get enough information to make my VDP core bulletproof, IE, behave correctly in response to all port access. Hopefully my notes will be good enough for you guys to do the same.

Post Reply