Often times emulators are written to work for the most popular games primarily, and issues with more obscrure or demanding games are not addressed. It sounds like the default Retroarch FCEUX NES core does not work well with Doki Doki Yuuenchi. I’d suggest trying one of the alternative NES emulators, though I don’t think any of them are packaged with RetroPie so you’d have to do some manual work. I know there are some other options but I haven’t tried them.