Mesen - NES Emulator

Discuss emulation of the Nintendo Entertainment System and Famicom.

Moderator: Moderators

unregistered
Posts: 1126
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: 236
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: 236
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: 89
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: 236
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: 89
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: 236
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 881 times
45-in-1 (JY-120A)(As) [U][!]_000.png
45-in-1 (JY-120A)(As) [U][!]_000.png (4.27 KiB) Viewed 881 times

mkwong98
Posts: 236
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: 89
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: 89
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: 212
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: 89
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!

Post Reply