Detecting the PCSX2 directory
I am trying to write code that auto-detects the patches folder in the PCSX2 directory. Is there an easy way to do this? I.e. is some sort of registry entry that points to the directory created when PCSX2 is installed?

Currently my code does the following:
1. Loop through all drives on the machine and look for the "Program Files" directory.
2. If Program Files exists, look for a subdirectory that contains "pcsx2" (case insensitive) in its name and has a subdirectory called "patches". If it is found, return the path and stop searching.

So this will find the PCSX2 directory as long as
a) it is in the Program Files directory in the root of one of the computer's drives
b) it has the string "pcsx2" in its name
c) it contains a subdirectory called patches
d) the search doesn't find a false positive first

I am just wondering if there is a better way.

Sponsored links

The easier way would be an entry in the register, otherwise you really need to search each partition for each entry and of course all possibles false positives.

But, pretty please, help the campaign to ban installing games in "C:\Program Files" or "C:\Program Files (x86)", the world will be a happier place then Smile
Imagination is where we are truly real
I don't know how useful this can be but in
C:\Documents and Settings\user name\Local Settings\Application Data\PCSX2
there is a file named usermode.ini
The new gui of pcsx2 create it and inside it under "CustomDocumentsFolder" is the location of pcsx2

And as far as I know pcsx2 don't write anything to the registry anymore(well maybe only if you use the installer)
I am trying to figure out what I need to get the path for usermode.ini on Win XP/Vista/7.

This is what I have so far:
%HOMEPATH%\Local Settings\Application Data\PCSX2\usermode.ini

In my Windows 7, C:\Users\user name\AppData\Local and C:\Documents and Settings\user name\Local Settings\Application Data point to the same place. But it seems that this is not always the case.

Also, if the installation of Windows is not English, wouldn't that path be incorrect? How to solve that problem?
I wouldn't try to find automatically the path for PCSX2 since not only It may be in any folder at user leisure (mainly after the campaign to avoid the C:\Program Files and Documents) as for many people there will be more than one installation, mainly for those trying the SVN, at least I hope so.

Probably the program will find the 'wrong' one and this be more confusing than the user installing the patcher under direct control.

Still 0.9.7 allows and actually has as default the "My Documents" or "Documents" folder for the support folders, if XP or seven. And even in that I wouldn't rely on try automatizing.
The only secure way to know which folders the emulator is actually using is locating the pcsx2.ini and reading directly it's lines.

For the usermode.ini, unless you want to repeat the install in every installation, it may be not that useful. And, maybe, not what the user wants anyway.
Imagination is where we are truly real

Users browsing this thread: 1 Guest(s)