#include "pch.h"
#include <string>
#include <iostream>

template<typename T>void Patch(int Address, T Value) {
	auto Pointer = (T *)Address;
	unsigned long Protect;
	VirtualProtect(Pointer, sizeof(T), PAGE_READWRITE, &Protect);
	*Pointer = Value;
	VirtualProtect(Pointer, sizeof(T), Protect, &Protect);
}

class LimitsVC {
public:
	LimitsVC() {
		#define TYPE char*
        int n = 38; // кол-во оружия. 37 изначально
        //int m = 72;
        const int max_length = 20;
        char** weaponlist = new char* [n];

        // Выделяем память под каждую строку
        for (int i = 0; i < n; i++) {
            weaponlist[i] = new char[max_length];
        }

        // Заполняем массив
        strcpy_s(weaponlist[0], max_length, "Unarmed");
        strcpy_s(weaponlist[1], max_length, "BrassKnuckle");
        strcpy_s(weaponlist[2], max_length, "ScrewDriver");
        strcpy_s(weaponlist[3], max_length, "GolfClub");
        strcpy_s(weaponlist[4], max_length, "NightStick");
        strcpy_s(weaponlist[5], max_length, "Knife");
        strcpy_s(weaponlist[6], max_length, "BaseballBat");
        strcpy_s(weaponlist[7], max_length, "Hammer");
        strcpy_s(weaponlist[8], max_length, "Cleaver");
        strcpy_s(weaponlist[9], max_length, "Machete");
        strcpy_s(weaponlist[10], max_length, "Katana");
        strcpy_s(weaponlist[11], max_length, "Chainsaw");
        strcpy_s(weaponlist[12], max_length, "Grenade");
        strcpy_s(weaponlist[13], max_length, "DetonateGrenade");
        strcpy_s(weaponlist[14], max_length, "TearGas");
        strcpy_s(weaponlist[15], max_length, "Molotov");
        strcpy_s(weaponlist[16], max_length, "Rocket");
        strcpy_s(weaponlist[17], max_length, "Colt45");
        strcpy_s(weaponlist[18], max_length, "Python");
        strcpy_s(weaponlist[19], max_length, "Shotgun");
        strcpy_s(weaponlist[20], max_length, "Spas12Shotgun");
        strcpy_s(weaponlist[21], max_length, "StubbyShotgun");
        strcpy_s(weaponlist[22], max_length, "Tec9");
        strcpy_s(weaponlist[23], max_length, "Uzi");
        strcpy_s(weaponlist[24], max_length, "SilencedIngram");
        strcpy_s(weaponlist[25], max_length, "Mp5");
        strcpy_s(weaponlist[26], max_length, "m4");
        strcpy_s(weaponlist[27], max_length, "Ruger");
        strcpy_s(weaponlist[28], max_length, "SniperRifle");
        strcpy_s(weaponlist[29], max_length, "LaserScope");
        strcpy_s(weaponlist[30], max_length, "RocketLauncher");
        strcpy_s(weaponlist[31], max_length, "FlameThrower");
        strcpy_s(weaponlist[32], max_length, "M60");
        strcpy_s(weaponlist[33], max_length, "Minigun");
        strcpy_s(weaponlist[34], max_length, "Detonator");
        strcpy_s(weaponlist[35], max_length, "HeliCannon");
        strcpy_s(weaponlist[36], max_length, "Camera");
        strcpy_s(weaponlist[37], max_length, "Hand"); // Новое оружие

        // Пример использования
        //std::cout << "Weapon at index 0: " << weaponlist[0] << std::endl;
		// Новое значение кол-ва оружия
		Patch(0x5D54AC, (TYPE)weaponlist);
		Patch(0x5D54C0, (BYTE)n);
        Patch(0x5D584C, (BYTE)n);
        Patch(0x5D5871, (BYTE)n);  
        Patch(0x5D58A1, (BYTE)n);
        //Patch(0x42992A, (BYTE)n);
        //Patch(0x429953, (BYTE)n);
        //Patch(0x4299FF, (BYTE)n);
        //Patch(0x429C31, (BYTE)n);
        //Patch(0x4FF7A8, (BYTE)n); // ??
        //Patch(0x4FF86E, (BYTE)n); // ??
        //Patch(0x4FFA73, (BYTE)n); // ??
        //Patch(0x55F696, (BYTE)n); // ??
        //Patch(0x55F6A0, (BYTE)n); // ??
        //Patch(0x55FF3F, (BYTE)n);
        //Patch(0x5601E7, (BYTE)n); // ??
        //Patch(0x5CA17F, (BYTE)n); // ?? 
	}
} LimitsVC;