Good news
FalKoopa
tag.
So, it happened 2-3 hours ago, but one of my PR was merged, #4203, the one that......enables memory breakpoint aka memechecks for every build of dolphin
That's right, the magic version is 5.0-583, from that version and newer, memchecks are enabled, just run with a -d to have the debugger and press the +MC button to add memchecks.
The ONLY difference performance wise is a mere 2% on some games ......I think we can agree it's not much.
This is by far the most important merge I wanted to do and also the hypest one because it's about freaking time
So, a bit of an explanation, what are memchecks?
I probably talked about them lately, but a memcheck is like a breakpoint, but it only breaks when reaching a particular instruction. Memchecks are more for breaking when tempering with memory, you can decide an address or a range and the game will break whenever soemthign read or writes (you can configure that) and you even have an option to log that it broke due to it.
It's asctually an essential feature of the debugger. Let me explain, you know how in my research and gltich hunting i use cheat engine to monitor the emulated ram and if necessary, hack it?
Well for the ram monitoring part, CE is the best tool, but what if I want to know more? What if I want to know what happened before the value was written to that address? What if I want to know how a certain address is used?
You can;t use standard breakpoints, they break on specific instructions......the games has thousands of them there is no way you can get your way through it with jsut that.
That's where memchecks becomes essential. Say I search for an rng formula, I would find the rng beforehand, then add a memcheck on write to that address and eventually, the game woudl break bringing me to the exact instruction it wrote and what happened before is likely the rest of the fucntion that aims to write to the RNG aka, I don;t need the memcheck anymore, it got to the point I wanted so I jsut make my way back using breakpoints.
So, yeah, it;s a pretty hype feature.....unfortunately.
I have no idea why, but since about as much as I know dolphin, this particular feature was systematically disabled from release and only reserved to 2 types of specific build configuration: debug and debugfast. It's clear it was intentional when it happened because there's even a comment saying so and some preprocessor check (so it woudl even be disabled or enabled at compile time).
Because it was disabled at compile time for release, there is no way to ever get it on release or stable build, you HAVE to build from source and specify that you want debug or debugfast.
Now, most people I knew that wanted memchecks used debugfast and after some accidental testing, I got why: debug is an horrible build config, twice as slow as release and debugfast is.......hoenstly abotu the same as release performance wise, the only thign you gain other than memcheck is several additional logging options for the logger. Because of this, most people I met didn't know that debug woudl work too, debugfast was jsut the advertised choice to have memchecks.
But you might think, release has the debugger and full breakpoint support. isn't it odd to not ahve memchecks?
And......you would be right. My guess is that it was originally disabled for performance concerns, you would check the memory eveyr rad and write and you would also drop performance significantly when using them (more on that later).
However, it still doesn;t make sense and it didn;t since at least several years (I even found traces in 2.0 and guess what? it was disdabled for release). There's litterally a method in the breakpoints system for the memchecks called HasAny() which just by a sumple check can tell if any memchecks are in use, it;s a very small and quick function. Why not use that instead of disabling them entirely?
And there enlies the problem: at the end, there wasn;t much reason this woudl be still disdabled and for years, people had to build dolphin which on windows, if you don;t know what you are getting into, you ahve to isntall visual studio (takes lots of hard drive space and several hours to install), and not to mention how advanced, complicated and VERY prone to error this task is. It's basically expected you are into developping...yikes.
It is so annoying, I coudln;t do an idea I had which was to make a tutorial on tasvideos abotu the usage of debugger, asm might be soemthign hard to teach, but building dolphin.......how do you expect one to do this and be guaranted ntohign wrong happens? It woudln't have worked, it's not really user firendly.
So, when I started to get into contributions and the devs eventually realised I was helpfull (read my post abut the debugger situation), one told me that he was actually working on such ideas and basically told me the same reasons I said: it doesn;t change performance until you start to use it.
Eventually, I got tired so I tried to work on it and it was actualyl very simple, the ONLY overhead detected by a tester was at worst 2%, honestly, considering how memchecks are essential, I don't think it's really bad, I even heard other improvements would counter that 2% later.
Btw, about that part when it impacts performance when you use it, it;s pretty drastic, works is started to make it work better, but the key point is it gets worse once the first is added, but comes back to nromal after the last is removed, aka you won;t notice anything until you use them.
So yeah, memchecks got free at last and I really am hype to the possibilities it opens up now that everyone that uses the lattest dev builds can use it