Better HN
topnewbestaskshowjobs
Log inSign up

jpfau

303 karma · joined Oct 13, 2012 (14y ago) · 12 submissions

Submissions

comment 9y ago · link · parent

Instead I'd introduce some sort of random failure elsewhere in the game, so it superficially looks like it's working, but isn't any fun to play...

This isn't mentioned in the article, since one of the anti-piracy/-emulation techniques I didn't discover at the time of writing it (due to my dump being an overdump) is that many of the games do this. They screw up input so it either boots but you can't play it at all, or input is unplayably slow. It detects it by having an interesting memory mirroring quirk in the cartridges that no other GBA carts have.

comment 9y ago · link · parent

Indeed, I even posted it back then: https://news.ycombinator.com/item?id=8808754

comment 9y ago · link · parent

That's not an emulator, it's a frontend. You'd need to know the core, e.g. mGBA or VBA-Next.

comment 9y ago · link · parent

Mirrored memory is a side effect of unconnected lines on the address bus thus making the content of those bits irrelevant. Code can take advantage of this to run faster or put tag values into addresses.

What does this have to do with speed?

On a GBA, VRAM is faster than ordinary RAM. Programs can do well to use it for tight inner loops.

Almost all programs use IWRAM for this. It's one of the things it's for. It's as fast if not faster than VRAM (depends on if the VRAM is being accessed by the PPU at the time).

Using STM (store multiple) to DMA registers? Again, go faster.

In retrospect, yeah this might actually be the case.

Save type masquerading might be code that helps when running on a development kit, but I admit that I can't think of what use it might have.

There are a handful of GBA games that lie about save type as anti-piracy and refuse to save or even boot if it finds the wrong one. It's also really the only anti-piracy technique that any other GBA games actually use, since it's quite effective against flash carts.

5.

The Importance of Fuzzing Emulators(mgba.io ↗)

97 points · by jpfau · 10y ago · 12 comments

6.

MGBA: Dumping the Undumped(mgba.io ↗)

25 points · by jpfau · 11y ago · 1 comment

7.

Cycle Counting, Memory Stalls, Prefetch and Other Pitfalls(endrift.com ↗)

21 points · by jpfau · 11y ago · discuss

8.

Classic NES Series Anti-Emulation Measures(endrift.com ↗)

161 points · by jpfau · 11y ago · 26 comments

comment 14y ago · link · parent

There is an upload savegame button before you load the game. Once you've loaded the game you have to reset before you can load another savegame.

comment 14y ago · link · parent

I tried writing an ARM -> JS recompiler, but my initial tests showed that the slow games tended to re-copy the portions of code that were slow back into their working RAM, causing me to invalidate the recompiled code. Maybe I could get clever and detect when I don't need to invalidate the recompiled code, but I have a feeling that that would actually slow it down overall. Haven't tried this yet, though, so who can say?

What I did observe is that the games that DON'T invalidate the recompiled code tended to run ~20% slower, so I'm not really sure what I was doing wrong there. It mostly seems to be that the code my recompiler is outputting is less well optimized by the JIT, and not that the recompilation is too slow. It's also possible that my recompilation is screwing over the garbage collector, as I have a somewhat verbose intermediate representation that I created in the hopes that I could optimize the recompiled code. I don't have much experience with compilers though, and again, I never got around to this.

I've been pondering pushing the branch that I did this work on, but I was hoping to wait until I got it to perform better before pushing it.

comment 14y ago · link · parent

I can definitely see about moving some of the controls around. When I was testing it, I just had a lot of "wasted space" around the edges, so I figured I could use that for the controls and instructions. I guess I should rethink that.

You're correct that I'm scanning for the save type. Auto-detection is something I want to get in at some point, but I haven't quite gotten around to it yet. I was considering using a database for the save types as well, but I didn't know if such a database existed. I was just planning on pre-computing it by the same way I'm currently detecting it, which as you say has problems.

12.

Show HN: GBA.js, a Game Boy Advance emulator written in JavaScript(jpfau.github.com ↗)

76 points · by jpfau · 14y ago · 25 comments