Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Opening ROM creates an UnimplementedNesMapperException #2

Open
iwillreku3206 opened this issue Dec 7, 2020 · 9 comments
Open

Opening ROM creates an UnimplementedNesMapperException #2

iwillreku3206 opened this issue Dec 7, 2020 · 9 comments

Comments

@iwillreku3206
Copy link

ROM: Tetris (U).nes

Error details:


java.lang.RuntimeException: ghidranes.errors.UnimplementedNesMapperException: Tried to load ROM with unimplemented mapper 1
	at ghidranes.GhidraNesLoader.load(GhidraNesLoader.java:102)
	at ghidra.app.util.opinion.AbstractLibrarySupportLoader.doLoad(AbstractLibrarySupportLoader.java:346)
	at ghidra.app.util.opinion.AbstractLibrarySupportLoader.loadProgram(AbstractLibrarySupportLoader.java:83)
	at ghidra.app.util.opinion.AbstractProgramLoader.load(AbstractProgramLoader.java:112)
	at ghidra.plugin.importer.ImporterUtilities.importSingleFile(ImporterUtilities.java:401)
	at ghidra.plugin.importer.ImporterDialog.lambda$okCallback$7(ImporterDialog.java:351)
	at ghidra.util.task.TaskLauncher$1.run(TaskLauncher.java:90)
	at ghidra.util.task.Task.monitoredRun(Task.java:126)
	at ghidra.util.task.TaskRunner.lambda$startTaskThread$1(TaskRunner.java:94)
	at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1130)
	at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:630)
	at java.base/java.lang.Thread.run(Thread.java:832)
Caused by: ghidranes.errors.UnimplementedNesMapperException: Tried to load ROM with unimplemented mapper 1
	at ghidranes.mappers.NesMapper.getMapper(NesMapper.java:21)
	at ghidranes.GhidraNesLoader.load(GhidraNesLoader.java:99)
	... 11 more


Build Date: 2020-Feb-12 1149 EST
Ghidra Version: 9.1.2
Java Home: C:\Program Files\Java\jdk-15.0.1
JVM Version: Oracle Corporation 15.0.1
OS: Windows 10 10.0 amd64
Workstation: DESKTOP-SPQJ3UK
@kylewlacy
Copy link
Owner

So far, I've only implemented one mapper (mapper 0, a.k.a NROM), so trying to load any NES ROM that uses a different mapper will fail with this error.

It shouldn't be too hard to add other mappers, but there are a lot of them (~200), so it would take a lot of work to support all of them. That said, the most popular games in the NES library only use a handful of different mappers (mapper 1 is a pretty common one IIRC).

I don't really have any spare capacity to work through even the common ones, but I might try to tackle it when my plate is more clear. I'll leave this issue open to track any progress at least.

@kylewlacy kylewlacy pinned this issue Dec 14, 2020
@StunningRob
Copy link

I'm curious if you documented anything about how you implemented mapper 0, or if you are interested in pointing me in the right direction to get started helping with this project. I'd like to work on making it compatible with other mappers and can help out if you give me a starting point. If you have a discord or anywhere else this is discussed I'd be happy to join that and we can talk there.

@kylewlacy
Copy link
Owner

@StunningRob I'd like to sit down and write docs for all this stuff soon (got some other stuff in-flight at the moment), but I think it'll take some time to get something written up for it. Unfortunately, mapper 0 is one of the few "simple" mappers-- most of the rest have some sort of bankswitching in place. I started working on another mapper a long time ago before putting it on hiatus, but I remember working with bankswitching in Ghidra being kind of painful.

@StunningRob
Copy link

Very cool. When you have time to work on a guide or something to help me get started I'm interested in helping work on other mappers.

@antoniovazquezblanco
Copy link
Contributor

Tryed to implement mapper 30. It was a pain and didn't really land on anything usable. If anyone has any resource on how bankswitching on Ghidra may work please share the resource!

Thanks for the loader btw :)

@kylewlacy
Copy link
Owner

...it's been a while since I've come back to this project. When I first started working on it, I tried implementing mapper 2 (UxROM). I believe I got something that was kind of working, but I remember that it was pretty clunky, and dealing with bank switching in the disassembly was very much a manual and tedious process. The code I had for that was on the wip/uxrom branch, although that was written before Ghidra 10 and I think there's been some breakage since then.

Unfortunately, it's been long enough since then that I really don't remember any of the details. I still definitely have a passive interest in the NES dev space, but my original motivation for this was when I was actively working on my NES emulator (Lochnes). Since I reached what I felt was a good stopping point with my emulator, I haven't had the motivation to come back and revisit this project. I won't rule out the possibility that I do come back to this project, if I get a particularly strong emulation/reverse engineering itch again!

As far as other resources go, I found this Reddit thread, which links to another Ghidra loader that does handle bankswitching, although it sounds like it's tailored to SMB3 specifically. I haven't looked at that project at all yet, so I can't speak to the approach used for it.

@antoniovazquezblanco
Copy link
Contributor

I was using your NES loader to solve a CTF challenge. I was able to solve it already just by looking at the assembly although it was quite a pain to do so haha.

My interest on this at the moment is merely getting to know more about Ghidra and NES but I no longer need the mapper. Depending on my needs, I may get back to it if I find some free time to tinker with Ghidra now that I have more resources to look at!

@himham-jak
Copy link

I'm looking for any info on implementing mapper 105, NES-EVENT. NESdev.org has both the NES-EVENT and the MMC1 its based on documented, but I don't have an understanding of how this is implemented now for the other mappers. I would love to add this to GhidraNes so we can get a better look at NWC1990.

@kylewlacy
Copy link
Owner

I'm looking for any info on implementing mapper 105, NES-EVENT. NESdev.org has both the NES-EVENT and the MMC1 its based on documented, but I don't have an understanding of how this is implemented now for the other mappers. I would love to add this to GhidraNes so we can get a better look at NWC1990.

I'm... honestly not that knowledgeable about different NES mappers specifically, but I'd be happy to provide some pointers and advice for working on mappers in general for GhidraNes

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants