bool LOBBY_MAPS_EXTRA = false;
bool LOBBY_DPAD_CYCLE = false;
const char* stringsM[] = {
"mplobby_01", "mp_arena", "mp_bac_01", "mp_bac_03", "mp_bac_042", "mp_balance", "mp_bor_01", "mp_bor_02", "mp_bor_03",
"mp_coop_delivery", "mp_coop_gauntlet", "mp_coop_gauntlet_minimap", "mp_coop_gauntlet_mm", "mp_ptp_01", "mp_ptp_02",
"mp_ptp_02_minimap01", "mp_ptp_02_mm", "mp_ptp_03"
};
const int stringsMSize = sizeof(stringsM) / sizeof(stringsM[0]);
const char* extra_strings[] = {
"mp_brothel", "mp_brothl2", "mp_churchh", "mp_crashld", "mp_crib", "mp_crib001", "mp_demoder",
"mp_kingrec", "mp_legal", "mp_legale2", "mp_legalee", "mp_methlab", "mp_movieth", "mp_nighcl2", "mp_nighcl3",
"mp_nightcl", "mp_parking", "mp_pricemn", "mp_snatch", "mp_stripc2", "mp_teashop", "mp_thebar", "mp_thebar2", "mp_yacht"
};
const int extra_stringsSize = sizeof(extra_strings) / sizeof(extra_strings[0]);
int currentIndex = 0;
here are my global variables
const char* moveLeft(const char* strings[], int& currentIndex, int size) {
currentIndex = (currentIndex - 1 + size) % size;
return strings[currentIndex];
}
const char* moveRight(const char* strings[], int& currentIndex, int size) {
currentIndex = (currentIndex + 1) % size;
return strings[currentIndex];
}
here are my functions for moving left or right
void updateStrings(bool LOBBY_MAPS_EXTRA) {
static const int maxStrings = stringsMSize + extra_stringsSize;
static const int finalStringsSize = LOBBY_MAPS_EXTRA ? maxStrings : stringsMSize;
static const char** finalStrings = new const char*[finalStringsSize];
if (LOBBY_MAPS_EXTRA) {
// Copy both arrays into the finalStrings array
std::copy(stringsM, stringsM + stringsMSize, finalStrings);
std::copy(extra_strings, extra_strings + extra_stringsSize, finalStrings + stringsMSize);
// Update currentIndex if it's out of bounds
if (currentIndex >= finalStringsSize) {
currentIndex = 0; // Reset currentIndex to the beginning
}
} else {
// Copy only the stringsM array into the finalStrings array
std::copy(stringsM, stringsM + stringsMSize, finalStrings);
// Update currentIndex if it's out of bounds
if (currentIndex >= stringsMSize) {
currentIndex = 0; // Reset currentIndex to the beginning
}
}
}
here is my function to update the strings when LOBBY_MAPS_EXTRA is true or false
void MonitorKeysWithXInput() {
DWORD dwResult;
XINPUT_STATE state;
// Loop indefinitely to monitor XInput state changes
while (true) {
auto toggleBool = [](bool& value) { value = !value; };
// Get the state of the controller
dwResult = XInputGetState(0, &state);
if (dwResult == ERROR_SUCCESS) {
[7:04 PM]
if ((state.Gamepad.wButtons & XINPUT_GAMEPAD_DPAD_RIGHT)) {
if (LOBBY_DPAD_CYCLE) {
// Move to the next string index
int newIndex = (currentIndex + 1) % stringsMSize;
// Update the memory address only if the new index is within bounds
if (newIndex < stringsMSize) {
// Memory address to replace
char* addressToReplace = reinterpret_cast<char*>(0x82069194);
const char* newString = moveRight(stringsM, currentIndex, stringsMSize);
std::strcpy(addressToReplace, newString);
// Determine the length of the final string
size_t length = strlen("subtitle_add "lobby set: "")
+ strlen(addressToReplace)
+ 1 // For the terminating null character
+ 2; // For the extra quotes and space
// Clean up dynamically allocated memory
delete[] command;
} else {
std::cout << "Reached end of strings array!" << std::endl;
}
}
}
if ((state.Gamepad.wButtons & XINPUT_GAMEPAD_DPAD_LEFT)) {
if (LOBBY_DPAD_CYCLE) {
// Move to the previous string index
int newIndex = (currentIndex - 1 + stringsMSize) % stringsMSize;
// Update the memory address only if the new index is within bounds
if (newIndex >= 0) {
// Memory address to replace
char* addressToReplace = reinterpret_cast<char*>(0x82069194);
const char* newString = moveLeft(stringsM, currentIndex, stringsMSize);
std::strcpy(addressToReplace, newString);
// Determine the length of the final string
size_t length = strlen("subtitle_add "lobby set: "")
+ strlen(addressToReplace)
+ 1 // For the terminating null character
+ 2; // For the extra quotes and space
// Clean up dynamically allocated memory
delete[] command;
} else {
std::cout << "Reached beginning of strings array!" << std::endl;
}
}
}
}
else {
// The controller is not connected or an error occurred
std::cout << "Controller not connected or an error occurred!" << std::endl;
// Sleep for a short duration before trying again
Sleep(1000);
}
}
}
here is the function scanning for buttons on a xbox controller
please note that this is for c++ version 14
for some reason it is only going through the first string, even if LOBBY_MAPS_EXTRA is true
I have tried many variations of this code and it only goes through StringsM