Page 1 of 2
[GBA] Classic NES Series Anti-Emulation Measures
Posted: Sat Jan 03, 2015 5:30 pm
by koitsu
Re: [GBA] Classic NES Series Anti-Emulation Measures
Posted: Sat Jan 03, 2015 6:40 pm
by tepples
In case you're not familiar with the GBA architecture, here are some analogous tests of an NES emulator:
- Memory mirroring: Make sure writes to $1FFF are mirrored to $07FF.
- Execution from VRAM: Execution from MMC5 ExRAM, or JSR $2007 where VRAM data register holds a value $60 (RTS).
- Store multiple to DMA registers: Perhaps something involving open bus and read-modify-write on some port where writes have a side effect, such as OAM DMA.
- Save type masquerading: Enable battery RAM, check that it's the correct size, and check that the mapper disables it when asked to. Low G Man (for NES) and Earthbound (for Super NES) use this.
- Prefetch abuse: Not sure about this one, as the 6502 doesn't do memory accesses for an older instruction after opcode fetches for a newer one. Probably bank switching the second half of the next instruction, like a mix of Earthworm Jim 2 (which uses well-disguised bank switches in its init code) and The Magic of Scheherazade (which failed for a long time in PocketNES).
- Audio FIFO irregularities: Perhaps reliance on length counter or sweep or DMC prefetch behavior.
We previously discussed
testing poorly emulated features before using them.
Re: [GBA] Classic NES Series Anti-Emulation Measures
Posted: Sat Jan 03, 2015 9:04 pm
by Shonumi
I talked to endrift about these before, though I haven't gotten NES classics working in my fledgling emulator myself (there is still 1,000+ other TODOs after all). I find the VRAM execution the most interesting. You can basically treat this area of memory like a supplement to the 32K WRAM during Forced Blank or VBlank (they'll even have the same access timings). If you're setting up the game and needs lots of fast memory, it seems like pretty cool technique to use. I never made the assumption that VRAM addresses couldn't be valid PC values, so I would have never discovered this in my own emulator unless something came up.
I've actually been meaning to do something similar on the GBC with some homebrew just because.
Re: [GBA] Classic NES Series Anti-Emulation Measures
Posted: Sun Jan 04, 2015 4:07 am
by Bregalad
Very interesting. (I don't think executing code from VRAM is only specific anti-emulation measure, as it's the second-fastest RAM available.)
I really don't understand why they made all this trouble to emulate "Classic NES" games which were already emulated in their NES form anyway, and did not make this for native GBA games. This makes straight no sense. The opposite would have made quite some sense.
Also how does those games displays NES graphics on a screen with inferior X and Y resolution ? This has always bugged me. PocketNES used to look terrible but now that a NDS equivalent exists nobody'd use this anymore.
Re: [GBA] Classic NES Series Anti-Emulation Measures
Posted: Sun Jan 04, 2015 8:40 am
by tokumaru
Bregalad wrote:I really don't understand why they made all this trouble to emulate "Classic NES" games which were already emulated in their NES form anyway, and did not make this for native GBA games. This makes straight no sense.
My thoughts exactly. NES games had been successfully emulated for years, why go through the trouble of making the GBA versions of those particular games tougher to emulate?
Re: [GBA] Classic NES Series Anti-Emulation Measures
Posted: Sun Jan 04, 2015 9:04 am
by tepples
Bregalad wrote:I really don't understand why they made all this trouble to emulate "Classic NES" games which were already emulated in their NES form anyway, and did not make this for native GBA games.
Perhaps Nintendo planned to use these in native GBA games but never got around to it.
Also how does those games displays NES graphics on a screen with inferior X and Y resolution ?
I believe N used the same method as PocketNES, where every four lines of background are compressed to three through temporal AA (lines 0, 1, 3 in even fields and lines 0, 2, 3 in odd), but some problematic tiles are modified to look better at 8x6. Back when PocketNES was popular, Pocket Heaven board members would create CHR patches to make fonts look better in PocketNES. I don't own any to check, but perhaps the scale ratio is configurable at compile time to shrink games less if their graphics don't push as far into overscan. Something whose display fits into a 23-line-tall window, such as Dr. Mario, could run at 87.5% height (each tile 8x7 pixels, which replicates the authentic PAR) without problem.
This has always bugged me. PocketNES used to look terrible but now that a NDS equivalent exists nobody'd use this anymore.
It's been a decade and there's still no commercial solution to display DS games on a TV. The Game Boy Player and GBA flash carts existed before the PowerPak, which is in fact why I got into GBAdev before NESdev.
Re: [GBA] Classic NES Series Anti-Emulation Measures
Posted: Sun Jan 04, 2015 1:09 pm
by Drag
Nintendo clearly wanted to help GBA emulation become more accurate by subtly suggesting a couple of things that needed to be improved upon. Clearly.
Re: [GBA] Classic NES Series Anti-Emulation Measures
Posted: Sun Jan 04, 2015 1:37 pm
by koitsu
tokumaru wrote:My thoughts exactly. NES games had been successfully emulated for years, why go through the trouble of making the GBA versions of those particular games tougher to emulate?
My opinion/theory at the time -- which still remains the same today -- is that it was a combination of 1) attempting to "re-establish" the fact that these games still bring them money (i.e. in a legal case, they could argue that piracy of retro games does in fact impact them), and 2) their way of acknowledging that people still like to play classic console games (i.e. marketing knows there's money to be made off of people who want to play classic games on present-day systems).
Don't forget Virtual Console on the Wii/WiiU, and that one game (I can't remember its name, or for which Nintendo console) where in-game you could get Famicom carts of first-gen games and play them on your character's game console/TV.
TL;DR -- if something a large corporation does can't easily be explained, chances are marketing and/or IP (intellectual property) had some involvement.
Re: [GBA] Classic NES Series Anti-Emulation Measures
Posted: Sun Jan 04, 2015 1:54 pm
by tepples
"that one game" was
Animal Crossing according to
the wiki.
Re: [GBA] Classic NES Series Anti-Emulation Measures
Posted: Sun Jan 04, 2015 2:24 pm
by Shonumi
teeples wrote:
It's been a decade and there's still no commercial solution to display DS games on a TV.
With the exception of Brain Age in Japan this is sadly still true. Nintendo said they were planning to offer more DS games as Wii U Virtual Console titles, but that's so far failed to materialize. Maybe they found out emulating the DS was harder than it looks
koitsu wrote:
My opinion/theory at the time -- which still remains the same today -- is that it was a combination of 1) attempting to "re-establish" the fact that these games still bring them money (i.e. in a legal case, they could argue that piracy of retro games does in fact impact them), and 2) their way of acknowledging that people still like to play classic console games (i.e. marketing knows there's money to be made off of people who want to play classic games on present-day systems).
I agree with both points, but I'm kinda of the sneaking suspicion that at least a few of the things endrift listed are just "wtf?" programming decisions Nintendo did for whatever reason (e.g. someone thought they were being clever/cool/cute). Not all of the points are especially hard to implement in an emulator imo. I already hit half of the points in the article myself before I even looked at the NES Classics.
But then again, Game Freak programmed some of the later Pokemon games to detect pirate copies or emulators that weren't accurate enough, so it wouldn't surprise me if these were genuinely intended to thwart (at least temporarily) emulation of NES Classics.
Re: [GBA] Classic NES Series Anti-Emulation Measures
Posted: Mon Jan 05, 2015 12:32 pm
by mikejmoffitt
Speaking of DS games on a TV, it occurred to me the other day that the 3DS's screen height of 240 pixels might mean its display timings are similar to that of NTSC, and a TV display solution might be possible in the analogue domain. Has anyone looked into 3DS to TV capture, other than
that one proprietary solution?
Re: [GBA] Classic NES Series Anti-Emulation Measures
Posted: Mon Jan 05, 2015 12:50 pm
by loopy
I worked on one years ago, there wasn't any interest in it so I abandoned it. The vast majority of people looking for capture solutions want it for YouTube / Twitch so direct USB output is simpler. If you want TV out, you can always make the PC display full screen and use its HDMI output. (Same goes for DS to TV, by the way.
Shameless plug 
)
Re: [GBA] Classic NES Series Anti-Emulation Measures
Posted: Mon Jan 05, 2015 12:51 pm
by koitsu
Random tidbit: that one proprietary solution was also created by loopy here on the forum, AFAIK, so it's at least not some random garbage product. :)
NINJA'D BY THE AUTHOR haha
Re: [GBA] Classic NES Series Anti-Emulation Measures
Posted: Mon Jan 05, 2015 12:56 pm
by loopy
Mine is
here. Screw that other guy. haha
Re: [GBA] Classic NES Series Anti-Emulation Measures
Posted: Mon Jan 05, 2015 12:59 pm
by koitsu
Oh christ, I misread the damn domain names. *sigh* People these days...
3dscapture.com -- loopy's device
3dsvideocapture.com -- some ridiculous overpriced whatever