lucianopeixoto / SteamFriendsTagger

A simple tool to manually tag steam profiles on your screenshots
GNU General Public License v3.0
3 stars 0 forks source link

Use the folders in userdata folder to find local steam users #3

Closed lucianopeixoto closed 7 years ago

lucianopeixoto commented 7 years ago

C:\Program Files (x86)\Steam\userdata has a folder for each local user account. Example: C:\Program Files (x86)\Steam\userdata\66942368 The user id is in STEAM id3, We must convert to ID64 somehow.

lucianopeixoto commented 7 years ago

https://auct.eu/convert-steamid32-id-steam-name-to-steam64/

STEAMID32 + 76561197960265728 = STEAMID64

lucianopeixoto commented 7 years ago

The sum is now working.

`// Function for finding sum of larger numbers QString findSum(QString str1, QString str2) { qDebug() << "findSum( " << str1 << ", " << str2 << ")"; // Before proceeding further, make sure length // of str2 is larger. if (str1.length() > str2.length()) swap(str1, str2);

// Take an empty string for storing result
QString str = "";

// Calculate lenght of both string
int n1 = str1.length(), n2 = str2.length();

qDebug() << "n1 = str1.length = " << n1 << "n2 = str2.length = " << n2;

// Reverse both of strings
std::reverse(str1.begin(), str1.end());
std::reverse(str2.begin(), str2.end());

qDebug() << "After reversion: str1 = " << str1 << "str2 = " << str2;

int carry = 0;
for (int i=0; i<n1; i++)
{
    // Do school mathematics, compute sum of
    // current digits and carry
    int sum = ((str1.at(i).toLatin1()- '0') + (str2.at(i).toLatin1() - '0') + carry);
    str.push_back(sum%10 + '0');

    // Calculate carry for next step
    carry = sum/10;
}

// Add remaining digits of larger number
for (int i=n1; i<n2; i++)
{
    int sum = ((str2.at(i).toLatin1()-'0')+carry);
    str.push_back(sum%10 + '0');
    carry = sum/10;
}

// Add remaining carry
if (carry)
    str.push_back(carry+'0');

// reverse resultant string
std::reverse(str.begin(), str.end());

return str;

}`

The only thing left to do is to find the folders and offer the user to choose which steam account is going to be used.

lucianopeixoto commented 7 years ago

Working like a charm!