Right.
When FF7 starts it looks for a binary value in the registry called SSI_DEBUG. If it's there, and contains the right data, debug messages are enabled.
The first thing my debugmode patch does is create a value in the registry with that name, of the right type, and the right size. That's what it does in the registry.
The *next* thing it does is change the EXE code. I did that by examining it in assembler ... nasty but useful. Rather than hack all the different parts of the program that check the registry, I let FF7 check that the SSI_DEBUG value is present, of the right data type, and of the right size. Then, when it checks to see whether the data is valid, it sets a variable to 0 is the data's invalid. The program then tests: Is that 0? If so, skip the debug enable. I just edit the assembler code from the JZ (Jump on Zero) CPU instruction to JNZ (Jump on Not Zero). Then, debug is on when the data ISN'T valid. Which is always, of course, since Square haven't told us what the key for debug mode on is.
I could have skipped the registry edit altogether by editing the assembler that checks, Is the data present? Is it of the correct size? etc., but it was quicker just to hack the code that checked the contents, and satisfy the *other* conditions by creating a registry key of the right type. It was easy to tell by looking at the source code what size and name the registry value had to be; I *couldn't* tell what data it should contain, so I hacked that part.