Mesen - NES Emulator

Discuss emulation of the Nintendo Entertainment System and Famicom.

Moderator: Moderators

unregistered
Posts: 1184
Joined: Thu Apr 23, 2009 11:21 pm
Location: cypress, texas

Re: Mesen - NES Emulator

Post by unregistered » Wed Dec 09, 2020 9:50 pm

Goose2k wrote:
Wed Dec 09, 2020 9:28 pm
Awesome thanks!

https://ci.appveyor.com/project/Sour/me ... s/32488821

"Fixed crash when loading VS-DualSystem games that are marked as having no work ram" :shock:

I think that might actually be the bug!


Unfortunately it still crashes on latest. Thanks though!
You’re welcome! :)

Ummm... your link shows that release is almost 7 months old... so if I wanted to research this Vs System update more, I’d search 7 months back in this thread and read some; maybe Sour wrote something about Vs System... or maybe you’ll be able to read the conversation leading to that release.

Sour did talk elsewhere about updates... there are some links a few pages back that will link to some of those resources. At least the links worked maybe a month or two ago. :) Sorry that didn’t solve your problem. A little research may improve things a little. :)

mkwong98
Posts: 265
Joined: Mon May 30, 2011 9:01 pm

Re: Mesen - NES Emulator

Post by mkwong98 » Sun Dec 20, 2020 9:20 am

I traced the error to line 97 in VsSystem.h but not sure what is causing an error:
shared_ptr<Console> dualConsole = _console->GetDualConsole();

BTW I uploaded a new release to Mesen:

Added an option in HD pack builder to save screen information when tiles are first shown in the same folder as the HD pack. User can look up which screen the tiles are added in the tileIndex.csv and open the screen_XXX.csv and screen_XXX.png to see the actual usage of the tiles.

Added playback option and volume option to <bgm> tag as suggested by kya. Use 1 for looping playback, 0 for single playback, -1 for no change to playback option. Use 0 to 255 for volume control and -1 for no volume change:
<bgm>[album - integer],[track - integer],[filename - ogg],[loop point - integer],[playback option - integer],[volume - integer]

Download here: https://github.com/mkwong98/Mesen/releases

mkwong98
Posts: 265
Joined: Mon May 30, 2011 9:01 pm

Re: Mesen - NES Emulator

Post by mkwong98 » Mon Feb 08, 2021 3:21 am

I made the following changes to Mesen:
Fixed Sprite Viewer Copy Tile function only give the first half if it is a large sprites.
Fixed HD tile default not used even when the tile found has failed the condition test.
Fixed compiler out of heap space when compiling after updating VS 2019.
Removed an unused parameter in ProcessTile function call.
Added a warning to the tool tip of 8x16 sprite option about when it should be used.
Added an option to output BG tiles only or Sprite tiles only.

Files can be found here:
https://github.com/mkwong98/Mesen/releases

dink
Posts: 107
Joined: Sun Jan 12, 2020 8:42 pm

Re: Mesen - NES Emulator

Post by dink » Tue Feb 09, 2021 6:30 pm

mkwong98,
Thanks for continuing this great emulator!
Several months ago I uncovered 2 bugs in the JyCompany mapper and explains what they were with some hints to fixing them:
viewtopic.php?f=3&t=13844&start=855#p256728
Would you be interested in fixing them? I will try to help in any way I can if needed.

best regards,
- dink

mkwong98
Posts: 265
Joined: Mon May 30, 2011 9:01 pm

Re: Mesen - NES Emulator

Post by mkwong98 » Fri Feb 12, 2021 10:15 am

dink wrote:
Tue Feb 09, 2021 6:30 pm
mkwong98,
Thanks for continuing this great emulator!
Several months ago I uncovered 2 bugs in the JyCompany mapper and explains what they were with some hints to fixing them:
viewtopic.php?f=3&t=13844&start=855#p256728
Would you be interested in fixing them? I will try to help in any way I can if needed.

best regards,
- dink
Hi dink,
I can fix the bug with the missing bit 3 bits but I'm not familiar with outer bank select. Is there any document that I can learn more about this?

dink
Posts: 107
Joined: Sun Jan 12, 2020 8:42 pm

Re: Mesen - NES Emulator

Post by dink » Mon Feb 15, 2021 9:24 am

Hi mkwong99,
Search for "Outer Bank Select ($D003)" on:
https://wiki.nesdev.com/w/index.php/J.Y._Company_ASIC

Here's a piece from my mapper:
write handler:
if ((address & 0xf803) == 0xd003) {
if (_romInfo.MapperID == 35 || _romInfo.MapperID == 90 || _romInfo.MapperID == 209 || _romInfo.MapperID == 211)
obank = data;
}

in the update section,
INT32 prg8_obank = (obank & 6) << 5;
INT32 prg16_obank = (obank & 6) << 4;
INT32 prg32_obank = (obank & 6) << 3;

With each prg page-map, | (or) the outerbank with the banksize you're mapping to.
f.ex in Mesen style: SelectPRGPage(0, prgRegs[0] | prg8_obank);
Mesen might(?) use different pagenumber sizes than I do, so I don't know for sure if the 16/32bit bank maps (SelectPRGPage2x(), ...4x()) need the shifting, you may have to try experiment :)
p.s. this outer bank logic is only to be used on mappers 35, 90, 209, 211, be sure to check _romInfo.MapperID when writing obank.

best regards,
- dink

mkwong98
Posts: 265
Joined: Mon May 30, 2011 9:01 pm

Re: Mesen - NES Emulator

Post by mkwong98 » Wed Feb 17, 2021 10:31 am

Hi dink,

I added a new variable called _prgBlock:

Code: Select all

if (_romInfo.MapperID == 35 || _romInfo.MapperID == 90 || _romInfo.MapperID == 209 || _romInfo.MapperID == 211) {
	_prgBlock = value & 0x06;
}
And used it in the following section

Code: Select all

switch(_prgMode & 0x03) {
	case 0:
		SelectPrgPage4x(0, (_prgMode & 0x04) ? prgRegs[3] : 0x3C);
		if(_enablePrgAt6000) {
			SetCpuMemoryMapping(0x6000, 0x7FFF, prgRegs[3] * 4 + 3, PrgMemoryType::PrgRom);
		}
		break;

	case 1:
		SelectPrgPage2x(0, prgRegs[1] << 1);
		SelectPrgPage2x(1, (_prgMode & 0x04) ? prgRegs[3] : 0x3E);
		if(_enablePrgAt6000) {
			SetCpuMemoryMapping(0x6000, 0x7FFF, prgRegs[3] * 2 + 1, PrgMemoryType::PrgRom);
		}
		break;
				
	case 2:
	case 3:
		SelectPRGPage(0, prgRegs[0] | (_prgBlock << 5));
		SelectPRGPage(1, prgRegs[1] | (_prgBlock << 5));
		SelectPRGPage(2, prgRegs[2] | (_prgBlock << 5));
		SelectPRGPage(3, (_prgMode & 0x04) ? prgRegs[3] | (_prgBlock << 5) : 0x3F);
		if(_enablePrgAt6000) {
			SetCpuMemoryMapping(0x6000, 0x7FFF, prgRegs[3], PrgMemoryType::PrgRom);
		}
		break;
}
Now both 01.Super Mario World and 03.Aladdin III boot but I'm sure I'm not doing the whole thing correctly. It will be great if you can review the code and tell me what is missing or not needed. Thanks.
45-in-1 (JY-120A)(As) [U][!]_001.png
45-in-1 (JY-120A)(As) [U][!]_001.png (3.81 KiB) Viewed 10767 times
45-in-1 (JY-120A)(As) [U][!]_000.png
45-in-1 (JY-120A)(As) [U][!]_000.png (4.27 KiB) Viewed 10767 times

mkwong98
Posts: 265
Joined: Mon May 30, 2011 9:01 pm

Re: Mesen - NES Emulator

Post by mkwong98 » Fri Feb 19, 2021 10:20 pm

Hi dinks,

I made a release of the changes so far: https://github.com/mkwong98/Mesen/relea ... 9.9-210220
As you can see, I have added the outer PRG bank select to 8k banking mode only. Please test it.
I'm not adding it to other modes because I don't know how to test it. So if you have examples of outer PRG bank select in other modes then I'll add them in too.

dink
Posts: 107
Joined: Sun Jan 12, 2020 8:42 pm

Re: Mesen - NES Emulator

Post by dink » Sat Feb 20, 2021 10:50 pm

mkwong98 - thanks, looks very nice! :)
I will do some research when time permits and get back with you on the other modes.

best regards,
- dink

User avatar
gravelstudios
Posts: 104
Joined: Mon Mar 13, 2017 5:21 pm
Contact:

Re: Mesen - NES Emulator

Post by gravelstudios » Sun Feb 21, 2021 10:40 am

I've encountered something that has me scratching my head. I have controller 2 mapped to some keys on my keyboard. Mesen doesn't seem to allow me to push A, B, Select, and Start simultaneously on controller 2. it will allow it on controller 1, but on controller two it will only register 2 or at most 3 keys pressed at the same time, not all 4. I'm not sure if this is an issue with my settings in Mesen (I couldn't find a "limit keys pressed" setting anywhere), or some obscure limitation in the NES hardware I didn't know about. Does anybody know what I'm referring to? Thanks.

User avatar
Controllerhead
Posts: 289
Joined: Tue Nov 13, 2018 4:58 am
Location: $4016
Contact:

Re: Mesen - NES Emulator

Post by Controllerhead » Sun Feb 21, 2021 10:58 am

gravelstudios wrote:
Sun Feb 21, 2021 10:40 am
Mesen doesn't seem to allow me to push A, B, Select, and Start simultaneously
This is probably not Mesen. This is probably your keyboard =p

Most do not register all of the keys all of the time. Some of the old school IBM PS2 port or high end gaming keyboards will register every key all of the time, but, most modern ones do not.

Try plugging in a gamepad to double check.
Image

User avatar
gravelstudios
Posts: 104
Joined: Mon Mar 13, 2017 5:21 pm
Contact:

Re: Mesen - NES Emulator

Post by gravelstudios » Sun Feb 21, 2021 11:34 am

Controllerhead wrote:
Sun Feb 21, 2021 10:58 am
gravelstudios wrote:
Sun Feb 21, 2021 10:40 am
Mesen doesn't seem to allow me to push A, B, Select, and Start simultaneously
This is probably not Mesen. This is probably your keyboard =p

Most do not register all of the keys all of the time. Some of the old school IBM PS2 port or high end gaming keyboards will register every key all of the time, but, most modern ones do not.

Try plugging in a gamepad to double check.
You were right. Thank a lot!

CharCorr
Posts: 3
Joined: Tue Jan 12, 2021 10:28 am

Re: Mesen - NES Emulator

Post by CharCorr » Sun Mar 07, 2021 12:03 pm

Hello. I hope some users here can answer some questions I have. :3

There's a hack for Mega Man 3 called "Mega Man 3 Improvement" which is made by kuja killer and can be found here: https://www.romhacking.net/hacks/992/

This hack has some issues running on Mesen. It has several bugs believed to be because of IRQ issues. A friend of mine messaged kuja killer, but he/she replied and said it was Mesen's fault. Said that it runs fine on hardware, though I don't know what was done to test this. But he/she could not diagnose Mesen due to being unable to run Mesen on his/her computer.

I wrote on Mesen's github about the problems, but users there said it was the hack's fault. Said loaders like the Everdrive aren't necessarily reliable for testing. See here: https://github.com/SourMesen/Mesen/issues/630

I know Mesen isn't in development anymore. But I was hoping some users of this forum can finally settle the matter. I'll describe the bugs below.


First: Mega Man 3 Improvement fixes the infamous glitched line on the stage select screen. Unfortunately, this causes the line's previous location to act strange in Mesen. It will cause the screen to jiggle at that scanline. Very easy to notice. It doesn't always happen, though. It sometimes does and sometimes doesn't at random. But usually it jiggles.

Second: This one is only seen (as far as I can tell) if you toggle the advanced setting "Enable PPU $2006 scroll glitch emulation" to on. Mesen doesn't recommend this, but I think it's more accurate to real hardware? Anyway, with this option on, enter a stage (let's say Hard Man) and pause the game. This brings up the weapon select menu. The menu will likely glitch out. Sometimes a lot of garbage data will appear in the menu, flashing on and off. Looks like some letters and numbers flashing.

Thank you for reading through this message, even if you don't have any answers for me. If you have any questions for me, please don't hesitate to ask.

lidnariq
Posts: 10646
Joined: Sun Apr 13, 2008 11:12 am
Location: Seattle

Re: Mesen - NES Emulator

Post by lidnariq » Sun Mar 07, 2021 1:50 pm

There's really nothing more to say than what Sour and domgetter said in that bug report, which I'm repeating here:
unless the hack was tested on an actual MMC3 chip (not a reproduction cart, not a flash cart), it's hard to know which behavior is correct (and it's possible the hardware sometimes works and sometimes jitters from one reset to another, too)

kuja killer
Posts: 124
Joined: Mon May 25, 2009 2:20 pm

Re: Mesen - NES Emulator

Post by kuja killer » Sun Mar 07, 2021 3:40 pm

ive replied a million times to tons of people that it's likely something wrong with that emulator's own IRQ timing code (the C++ code or whatever is used to program the emulator with) ..and not what i tried doing in the game's own IRQ code to hide the scanline stuff in the so called "h blank" thing which is the PPU pixel 256 to 310 or whatever the range is exactly.

every emulator seems to have their own timings. i know that there's about a 15 or 20-something pixel different between fceux and nintendulator when comparing IRQs in the debugger viewer. irq's start like 20 ppu pixels earlier on average than fceux does....meaning that was the emu's own coding doing that, not the game. :|

I cant test mesen personally cause the developer designed it with a slightly higher version of "net framework" which isn't supposed on Win XP. XP only goes up to 4.0 i think...and his emulator needs 4.5 ..ugh. Oh well.

the whole thing where the pause menu splits itself into 3 duplicate pieces happens originally in mm3 too in some partiular emulator (i forget which), and i dont know what that's about.

i dont know the status on a real NES that lidnariq mentioned since i dont own any such stuff in real life.
Last edited by kuja killer on Mon Mar 08, 2021 12:09 am, edited 2 times in total.

Post Reply