clownacy / clownmdemu Goto Github PK
View Code? Open in Web Editor NEWSega Mega Drive/Sega Genesis emulator that emphasises portability.
Home Page: https://clownacy.wordpress.com/tag/clownmdemu/
License: GNU Affero General Public License v3.0
Sega Mega Drive/Sega Genesis emulator that emphasises portability.
Home Page: https://clownacy.wordpress.com/tag/clownmdemu/
License: GNU Affero General Public License v3.0
The only controllers that are currently supported are the 3-button ones.
The CPU interpreters currently do not support delays of any form. However, I know of many that occur on real Mega Drives:
As a simple usability improvement, the emulator should change region to suit the loaded game. This would prevent games with region locking from being unplayable until the user changes the emulated console's region in the settings.
I live every day of my life in fear of implementing the H/V counter. Fortunately, there are some good test ROMS for it here: https://sonicresearch.org/community/index.php?threads/clownmdemu-the-greatest-mega-drive-emulator-ever-someday.6571/page-3#post-89616
... But I made a fork of it that is.
... And I even fixed a latent bug on other platforms.
https://github.com/jfolker/tinyfiledialogs
The original author doesn't update frequently, can you use my version instead? I managed to build clownmdemufrontend (FreeBSD, Clang) and even play Sonic 2 XL on it successfully.
The Window Plane was implemented in a really hacky way that isn't even correct: when drawn on the same line as Plane A, Plane A will appear behind the Window Plane. This is dumb, and is easily shown in the Sonic Clean Engine:
This may not be your fault, but Windows 10 H2 will detect clownmdemu as Trojan:Win32/Wacatac.H!ml
, I haven't tested Windows 11
This is something that Vladikcomper has brought up a few times: Gens KMod and BlastEm support the KDebug API, which allows emulated software to call into the emulator for a handful of uses, such as debug logging. On a real Mega Drive, using this API is harmless since it is done by accessing unused VDP registers. Though, I wonder about buggy games and homebrew that just access these registers accidentally: the last thing I need is to try to print garbage data as a zero-terminated string.
Some documentation can be found here: https://github.com/vladikcomper/md-modules/blob/master/modules/errorhandler/docs/how-to/Use_KDebug_integration.md
Every audio sample in the game plays too slowly. Noticeable as soon as the Sega logo.
Couldn't find a real hardware video, but this emulator capture seems about right: Video
This also affects Earthworm Jim 2, and probably other GEMS games?
So you remember that fix you did for Jim Power? This is basically that for CRAM, but with no commercial examples as far as I'm aware.
For a text printing routine I've made, I used a longword decrement write to CRAM via the data ports, to save a few bytes. Abbreviated code below:
lea vdpctrl,a5
lea (a5),a4 ; dec to data port
move.l #vdpComm(0,CRAM_WRITE),(a5)
move.l d2,-(a4) ; dec to data port (written values are word-inverted)
On real hardware and all other emulators I've tested, this results in the word values in d2 being written out of order, or "word-inverted". The only other thing I know that shares this behaviour is the AtGames Firecore of all things. Here's a rom to test this on
As pointed out by Vladikcomper, Window Plane emulation is broken in H32.
To quote Malachi...
I found the problem code. Basically at the end of my H_Int routine I had this
; a5 = vdp control reg
- move.w (a5),d0 ; wait until it's out of Hblank
andi.w #1<<2,d0
bne.s -
- move.w (a5),d0 ; now wait until it's in
andi.w #1<<2,d0
beq.s -
The first one was the problem, my assumption is that the register is always set to be in Hblank. Thankfully, that check was actually useless for this routine, so now you can play Sonic 2 as god inten-
vladikcomper — Today at 18:21
Hi, I have another bug report on Clownmdemu, this time quite serious~Looks like timing of Z80 interrupts is quite buggy. From my observations, your emulator may trigger Z80's VInt mid-frame or even by the end of the frame; at any moment in time really, if interrupts were previously disabled or if Z80 was stopped. This should never happen and it may mess up some Z80 drivers in unexpected ways.
On real hardware, there's a time window of ~171 Z80 cycles since the start of VBlank when interrupt will be acknowledged. If Z80 is stopped during this time or interrupts are disabled, VInt should be missed. In Clownmdemu, however, interrupt request "sticks" and will fire whenever interrupts are re-enabled or Z80 starts again, which may happen mid-frame.
vladikcomper — Today at 18:28
... This is somewhat related to my issue with Z80<->68k access delays. You see, I attempted to implement a "calibration" check by measuring 68k ROM vs Z80 RAM access time (number of reads before VBlank) to detect and calibrate Mega PCM 2 loops for inaccurate emulators.In inaccurate emulators ROM and RAM read count per frame match (while on real hardware ROM access is 24% slower), so it mostly worked well... Expect for Clownmdemu, which often refuses to properly calibrate, because it fires the first VBlank at arbitrary times :)
vladikcomper — Today at 18:57
There isn't much information available on the interrupts, so I gained some of this knowledge from various people or emulator's source code.That 171 cycle window for VBlank I originally discovered in Blastem's source code. I then found it in at least one more source, so it should be really accurate:
#define Z80_INT_PULSE_MCLKS 2573 //measured value is ~171.5 Z80 clocksWhen VBlanking period starts, INT pin is triggered on Z80 for roughly 171 cycles. If interrupts are enabled, Z80 disables them and executes VInt routine at 38h (I won't mention other modes useless on the MD).
If your VInt routine is shorter than 171 cycles or you re-enable interrupts (ei) immediately, the interrupt will be triggered again in the very same frame. This is why INT signal only lasts for 171 cycles and not the entire VBlank.
I know it's not implemented but i through this info will help.
This is the output of Sonic 1
ERROR: Unimplemented instruction IM used at 0x23
ERROR: 68k attempted to access Z80 memory/YM2612 ports without Z80 bus at 0x72776
ERROR: 68k attempted to access Z80 memory/YM2612 ports without Z80 bus at 0x7278E
ERROR: 68k attempted to access Z80 memory/YM2612 ports without Z80 bus at 0x72740
ERROR: 68k attempted to access Z80 memory/YM2612 ports without Z80 bus at 0x72758
Do you think it would be possible for you to port these three Sonic games:
Sonic 3 A.I.R
Sonic Nexus
Sonic Robo Blast 2
The Sonic 3 A.I.R has its source code on github, just google it and I think there is a port for Switch.
The Sonic Nexus decompile is in the Rubberduckycooly repository and is also based on RSDK so it can be ported to the Wii U.
Sonic Robo Blast 2 has its source code on its website and it would be interesting to see the port of the latest version of SRB2 on Wii U.
Finally, I wanted to ask you if it is possible if you can compile and adapt to Wii U, the movian application. It is a multimedia center that is for PS3 and PC and an attempt was made a long time ago to make a port for Wii. Maybe you can use the Wii port source code to make the Wii U port, especially since streaming services on Wii U are going to end soon.
You can find the Movian Wii source code in the wikiblog0 github repository. And the original source code on the movian website.
Link: https://github.com/wikiblog0/movian-wii-wiiu
I appreciate your contributions to the Wii U scene.
Greetings
What it says on the tin.
Hello! Great emulator, here I am playing on a Linux-based OS running Debian 11, and I built manually the 0.5.1 version.
As I was testing several games, I came across Hellfire (USA) version that, for some reason, has invisible sprites for both the ship and the enemies!
I am leaving a savestate, though it seems any version may encounter this bug during emulation? (ignore the .zip naming, that was just a way for me to upload the file containing the relevant info surrounding this game)
hellfirebug.zip
I didn't test every EA game - there are lots - but here's what I happened to run into:
At one point, m68k.c
references m68k/gen.c
, which does not appear to exist. I take it m68k/generator.c
was meant?
Waiting on the title screen will show a demo, then the title screen again, and finally an intro with a text scroll. This video shows what it's supposed to look like.
In clownmdemu, no text shows up:
This SpritesMind post partially describes what causes this.
Used by Malachi's hack. The 68k should indeed stop, but interrupts should resume it. STOP can be used for implementing WaitForVInt.
Hi, I have a problem when I launch any game from SGDK or sample assembly :
ERROR: Attempted to read invalid Z80 address 0x55EA
ERROR: Attempted to read invalid Z80 address 0x55EB
ERROR: Attempted to read invalid Z80 address 0x55EC
ERROR: Attempted to read invalid Z80 address 0x55ED
ERROR: Attempted to read invalid Z80 address 0x55EE
ERROR: Attempted to read invalid Z80 address 0x55EF
ERROR: Attempted to read invalid Z80 address 0x55F0
ERROR: Attempted to read invalid Z80 address 0x55F1
ERROR: Attempted to read invalid Z80 address 0x55F2
ERROR: Attempted to read invalid Z80 address 0x55F3
ERROR: Attempted to read invalid Z80 address 0x55F4
ERROR: Attempted to read invalid Z80 address 0x55F5
ERROR: Attempted to read invalid Z80 address 0x55F6
ERROR: Attempted to read invalid Z80 address 0x55F7
ERROR: Attempted to read invalid Z80 address 0x55F8
ERROR: Attempted to read invalid Z80 address 0x55F9
The problem occurs when restarting the Z80:
move.w $000,($A11200)
I hope you can fix this issue.
This is an odd one. Any inputs (even in the menu) are extremely sluggish and buggy. It's like the game only successfully reads the controller 10% of the time. The success rate seems to vary depending on CPU load - you can at least move between menu options, but once the game starts you're functionally immobile.
The first scene of the intro cutscene features graphics that don't load in correctly:
Compared to real hardware and most emulators: Video
Stage 2 is missing the entire foreground layer, and one sprite palette gets corrupted as you walk to the right. There's also some graphical corruption in the HUD:
Further stages are not any better:
There's a code to warp to the next stage, should be useful for testing: Start, B, A, Down, B, A, Down, Left, Up, C.
Yesterday I decided to try this game, and did a video showing it on YouTube, and I decided that I'd bring it here since another person also found the same issue;
The title card on levels bug out, it causes dots on World 2s background in attractions, and it causes some of the tether graphics to become black squares which carry over into the field stages (though they show up fine there if you start on them via "SELECT".)
The Z80 sound driver also doesn't seem to cause the game to crash (the problematic line) Ala inaccurate emulators.
A weird strip of 3 white squares will also show up in the "SELECT" menu if you can manage to trigger the alternative SEGA screen as shown in this screenshot; [screenshot]
(found out it was in the original game, disregard this part.
Here's a video comparison of the title card..
Bugged:
The intended result (using BlastEm):
Options menu - shown after pressing start on title screen - shows graphical corruption:
After starting the first level, none of the sprites show up and the game freezes:
Video of a full playthrough: Here
I'm sorry to post this here since it has nothing to so with Clowndemu :P
I did leave a msg on your Blog bit it didn't display after I sent it?
I just want to thank you for looking into N64 for the WiiU. your Blog post was an interesting read. You seem to have gotten really far even getting the Core to compile and run something :)
While I'm less than useless when it comes to coding and things like that M4xw could have saved you some time debugging, he's the maintainer of the Retroarch Mupen64 Core :)
How far are you planning on taking this N64 core? I see you primary goal is the OpenGL ES 2.0 renderer?
but honestly I hope you can make the N64 Core a reality. We have a reasonable PS1 Core 90% of games are running perfectly fine but some are still under performing, I'm hoping the OpenGL ES 2.0 will help there if you continue your work.
I see your work on the Core is with Aroma in mind? Tho I think it should be able to work on the Tiramisu environment too (that's what Retroarch currently runs on)
You mention that the Retrorach port is going through a messy refactor (which is true) but the old Tiramisu Isn't broken, your Core should be able to run on that just fine.
I hope you continue your port, even just for the OpenGL ES 2.0 work, I know Gary is still working on his ANGLE port but the more the merrier :D
M4xw is working on an aot recompiler that likely can be reworked to run on WiiU so if combined with your work could produce a working (fullspeed hopes) N64 Core for WiiU.
Again sorry for posting this here, I would have posted this on you Blog, but my last message didn't got through and you don't seem to be a member of GBAtemp and I couldn't find you on Discord.. I did find you on Sonic Retro but I couldn't send a PM :p
I'll delete this if its inappropriate.
Thank you for even looking into brining new (3D) Cores to WiiU. Its very much appreciated.
Compare to this.
As explained here, Echo the Dolphin and its sequel both have distorted sound effects. These games might be using SSG-EG or LFO, which are both currently unemulated.
It doesnt compile on windows mingw msys2
The intro cutscene scrolls a graphic on Plane A up and down, as seen in this video.
However, this is what happens in the emulator:
Note that this intro is different in the Japanese version.
I booted up a bunch of games and looked into anything that sounded off. (I also knew beforehand of a few games that tend to give emulators trouble in the sound department.) A lot of these have to do with known unemulated YM2612 features (SSG-EG, extended CH3 mode, LFO, CSM). I know you said sound emulation wasn't a priority at the moment, but I figured it was better to document all this in advance, rather than just sit on it. Hopefully this doesn't keep you up at night.
(By the way, I want to commend you for writing your own sound emulation. A lot of projects just use the Nuked cores - which is fine, but it's neat to see someone do it the hard way. The PSG noise emulation already seems to be a better match for Sega's SN7 clone than BlastEm, which sounds more like a main-brand one.)
I also found quite a few non-audio bugs while testing random games' audio... expect more bug reports to be made soon. Sorry about that.
SSG-EG
Extended CH3
CSM
As far as I know, only tech demos have used this.
Misc
Most of these will probably fix themselves as the FM emulation gets built out, but I thought I'd include them just in case they turn out to be unique bugs:
Most of these are less "audio bugs" and moreso "bugs that affect the audio":
===
If you're ever looking to check a music track against real hardware without pulling out the real thing, DUSTINODELLOFFICIAL and Random VGMs on YT are good sources.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.