Skip to content

Commit c1519c8

Browse files
committed
auto login fixes and more
fixes if the user has auto login selected, as long as the slot and auto login slot match it should work fix where you only had say slot 3 in the config, and tried running the app directly
1 parent 995a4ac commit c1519c8

1 file changed

Lines changed: 33 additions & 3 deletions

File tree

FFXI-Launcher.cpp

Lines changed: 33 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -525,6 +525,25 @@ void launchAccount(const AccountConfig& account, const GlobalConfig& config) {
525525
std::cerr << "Failed to read login_w.bin, using default slot selection\n";
526526
}
527527

528+
// Check for auto-login status
529+
std::ifstream loginWFile(polPath + "\\usr\\all\\login_w.bin", std::ios::binary);
530+
bool autoLoginEnabled = false;
531+
if (loginWFile) {
532+
loginWFile.seekg(0x6F);
533+
unsigned char autoLoginValue;
534+
loginWFile.read(reinterpret_cast<char*>(&autoLoginValue), 1);
535+
autoLoginEnabled = (autoLoginValue != 0x00);
536+
537+
// If auto-login is enabled, check if the slot matches
538+
if (autoLoginEnabled && loginWValue != -1 && loginWValue != account.slot) {
539+
std::cout << "\nWARNING: Auto-login is enabled for slot " << loginWValue
540+
<< " but you selected slot " << account.slot << ".\n"
541+
<< "The wrong character may be logged in.\n"
542+
<< "Waiting 5 seconds before continuing...\n";
543+
Sleep(5000);
544+
}
545+
}
546+
528547
// Wait for the window to have a title bar (WS_CAPTION)
529548
int waitTitleBar = 0;
530549
while (!(GetWindowLong(hwnd, GWL_STYLE) & WS_CAPTION) && waitTitleBar < 100) { // up to 10s
@@ -588,12 +607,18 @@ void launchAccount(const AccountConfig& account, const GlobalConfig& config) {
588607
SetFocus(hwnd);
589608
BringWindowToTop(hwnd);
590609

610+
611+
612+
// Skip these returns if auto-login is enabled
613+
if (!autoLoginEnabled) {
591614
Sleep(200);
592615
simulateKey(VK_RETURN);
593616
Sleep(200);
594617
simulateKey(VK_RETURN);
595618
Sleep(300);
596619
simulateKey(VK_RETURN);
620+
}
621+
597622
Sleep(500);
598623
simulateKey(VK_RETURN);
599624
Sleep(500);
@@ -979,9 +1004,14 @@ int main(int argc, char* argv[]) {
9791004
// Find the account to launch
9801005
AccountConfig* toLaunch = nullptr;
9811006
if (characterName.empty()) {
982-
// Default: launch the first slot
983-
for (auto& acc : config.accounts) {
984-
if (acc.slot == 1) { toLaunch = &acc; break; }
1007+
// If only one account exists, use it regardless of slot
1008+
if (config.accounts.size() == 1) {
1009+
toLaunch = &config.accounts[0];
1010+
} else {
1011+
// If multiple accounts, we should have already prompted for selection
1012+
// This is just a fallback
1013+
std::cout << "No account selected. Please specify a character name.\n";
1014+
return 1;
9851015
}
9861016
} else {
9871017
for (auto& acc : config.accounts) {

0 commit comments

Comments
 (0)