Custom Sky Color and unify some stuff (#1779)
This commit is contained in:
@ -212,7 +212,7 @@ namespace big
|
||||
options.at(ContextEntityType::SHARED).options.begin(),
|
||||
options.at(ContextEntityType::SHARED).options.end());
|
||||
|
||||
std::uint32_t max_size = 0;
|
||||
uint32_t max_size = 0;
|
||||
for (auto& [name, _] : menu.options)
|
||||
{
|
||||
max_size = static_cast<int>(max_size < name.length() ? name.length() : max_size);
|
||||
|
@ -23,7 +23,7 @@ namespace big
|
||||
return false;
|
||||
|
||||
const auto rockstar_id = net_player->get_net_data()->m_gamer_handle.m_rockstar_id;
|
||||
for (std::uint32_t i = 0; i < g_pointers->m_gta.m_friend_registry->m_friend_count; i++)
|
||||
for (uint32_t i = 0; i < g_pointers->m_gta.m_friend_registry->m_friend_count; i++)
|
||||
if (rockstar_id == g_pointers->m_gta.m_friend_registry->get(i)->m_rockstar_id)
|
||||
return true;
|
||||
return false;
|
||||
|
@ -10,7 +10,7 @@ namespace big
|
||||
{
|
||||
}
|
||||
|
||||
cache_file::cache_file(file cache_file, std::uint32_t cache_version) :
|
||||
cache_file::cache_file(file cache_file, uint32_t cache_version) :
|
||||
m_cache_file(cache_file),
|
||||
m_data(nullptr),
|
||||
m_cache_version(cache_version),
|
||||
@ -34,7 +34,7 @@ namespace big
|
||||
|
||||
file.read(reinterpret_cast<char*>(&m_cache_header), sizeof(m_cache_header));
|
||||
|
||||
m_data = std::make_unique<std::uint8_t[]>(m_cache_header.m_data_size);
|
||||
m_data = std::make_unique<uint8_t[]>(m_cache_header.m_data_size);
|
||||
file.read(reinterpret_cast<char*>(m_data.get()), m_cache_header.m_data_size);
|
||||
|
||||
file.close();
|
||||
@ -55,17 +55,17 @@ namespace big
|
||||
return true;
|
||||
}
|
||||
|
||||
std::uint8_t* cache_file::data() const
|
||||
uint8_t* cache_file::data() const
|
||||
{
|
||||
return m_data.get();
|
||||
}
|
||||
|
||||
std::uint64_t cache_file::data_size() const
|
||||
uint64_t cache_file::data_size() const
|
||||
{
|
||||
return m_cache_header.m_data_size;
|
||||
}
|
||||
|
||||
bool cache_file::up_to_date(std::uint32_t file_version) const
|
||||
bool cache_file::up_to_date(uint32_t file_version) const
|
||||
{
|
||||
if (!m_data)
|
||||
return false;
|
||||
@ -73,19 +73,19 @@ namespace big
|
||||
return m_cache_version == m_cache_header.m_cache_version && file_version == m_cache_header.m_file_version;
|
||||
}
|
||||
|
||||
void cache_file::set_data(cache_data&& data, std::uint64_t data_size)
|
||||
void cache_file::set_data(cache_data&& data, uint64_t data_size)
|
||||
{
|
||||
m_data.swap(data);
|
||||
m_cache_header.m_data_size = data_size;
|
||||
}
|
||||
|
||||
void cache_file::set_header_version(std::uint32_t file_version)
|
||||
void cache_file::set_header_version(uint32_t file_version)
|
||||
{
|
||||
m_cache_header.m_cache_version = m_cache_version;
|
||||
m_cache_header.m_file_version = file_version;
|
||||
}
|
||||
|
||||
void cache_file::set_cache_version(std::uint32_t cache_version)
|
||||
void cache_file::set_cache_version(uint32_t cache_version)
|
||||
{
|
||||
m_cache_version = cache_version;
|
||||
}
|
||||
|
@ -6,12 +6,12 @@ namespace big
|
||||
class cache_header final
|
||||
{
|
||||
public:
|
||||
std::uint32_t m_cache_version;
|
||||
std::uint32_t m_file_version;
|
||||
std::uint64_t m_data_size;
|
||||
uint32_t m_cache_version;
|
||||
uint32_t m_file_version;
|
||||
uint64_t m_data_size;
|
||||
};
|
||||
|
||||
using cache_data = std::unique_ptr<std::uint8_t[]>;
|
||||
using cache_data = std::unique_ptr<uint8_t[]>;
|
||||
class cache_file final
|
||||
{
|
||||
public:
|
||||
@ -26,7 +26,7 @@ namespace big
|
||||
/// </summary>
|
||||
/// <param name="cache_file">FileMgr file object</param>
|
||||
/// <param name="cache_version">Internal version, use this to invalidate the cache when changing the structure of the data</param>
|
||||
cache_file(file cache_file, std::uint32_t cache_version);
|
||||
cache_file(file cache_file, uint32_t cache_version);
|
||||
|
||||
/// <summary>
|
||||
/// Frees any memory used to hold the cached data.
|
||||
@ -45,8 +45,8 @@ namespace big
|
||||
/// <returns></returns>
|
||||
bool write() const;
|
||||
|
||||
std::uint8_t* data() const;
|
||||
std::uint64_t data_size() const;
|
||||
uint8_t* data() const;
|
||||
uint64_t data_size() const;
|
||||
|
||||
/// <summary>
|
||||
/// Check if the cache file is up to date with the expected versions
|
||||
@ -54,23 +54,23 @@ namespace big
|
||||
/// <param name="game_version">Current Game version</param>
|
||||
/// <param name="online_version">Current Online version</param>
|
||||
/// <returns>True if cache is up to date, false otherwise.</returns>
|
||||
bool up_to_date(std::uint32_t file_version) const;
|
||||
bool up_to_date(uint32_t file_version) const;
|
||||
|
||||
|
||||
void set_data(cache_data&& data, std::uint64_t data_size);
|
||||
void set_data(cache_data&& data, uint64_t data_size);
|
||||
/// <summary>
|
||||
/// Sets the version information of the cache header.
|
||||
/// </summary>
|
||||
/// <param name="game_version">Game Build</param>
|
||||
/// <param name="online_version">Online Version</param>
|
||||
void set_header_version(std::uint32_t file_version);
|
||||
void set_header_version(uint32_t file_version);
|
||||
|
||||
void set_cache_version(std::uint32_t cache_version);
|
||||
void set_cache_version(uint32_t cache_version);
|
||||
|
||||
private:
|
||||
file m_cache_file;
|
||||
|
||||
std::uint32_t m_cache_version;
|
||||
uint32_t m_cache_version;
|
||||
|
||||
cache_header m_cache_header;
|
||||
cache_data m_data;
|
||||
|
@ -72,7 +72,7 @@ namespace big
|
||||
}
|
||||
|
||||
// innefficient getters, don't care to fix right now
|
||||
const ped_item& gta_data_service::ped_by_hash(std::uint32_t hash)
|
||||
const ped_item& gta_data_service::ped_by_hash(uint32_t hash)
|
||||
{
|
||||
for (const auto& [name, ped] : m_peds)
|
||||
if (rage::joaat(name) == hash)
|
||||
@ -80,7 +80,7 @@ namespace big
|
||||
return gta_data_service::empty_ped;
|
||||
}
|
||||
|
||||
const vehicle_item& gta_data_service::vehicle_by_hash(std::uint32_t hash)
|
||||
const vehicle_item& gta_data_service::vehicle_by_hash(uint32_t hash)
|
||||
{
|
||||
for (const auto& [name, veh] : m_vehicles)
|
||||
if (rage::joaat(name) == hash)
|
||||
@ -88,7 +88,7 @@ namespace big
|
||||
return gta_data_service::empty_vehicle;
|
||||
}
|
||||
|
||||
const weapon_item& gta_data_service::weapon_by_hash(std::uint32_t hash)
|
||||
const weapon_item& gta_data_service::weapon_by_hash(uint32_t hash)
|
||||
{
|
||||
for (const auto& [name, weapon] : m_weapons_cache.weapon_map)
|
||||
if (rage::joaat(name) == hash)
|
||||
@ -96,7 +96,7 @@ namespace big
|
||||
return gta_data_service::empty_weapon;
|
||||
}
|
||||
|
||||
const weapon_component& gta_data_service::weapon_component_by_hash(std::uint32_t hash)
|
||||
const weapon_component& gta_data_service::weapon_component_by_hash(uint32_t hash)
|
||||
{
|
||||
for (const auto& [name, component] : m_weapons_cache.weapon_components)
|
||||
if (component.m_hash == hash)
|
||||
@ -217,7 +217,7 @@ namespace big
|
||||
std::sort(m_weapon_types.begin(), m_weapon_types.end());
|
||||
}
|
||||
|
||||
inline void parse_ped(std::vector<ped_item>& peds, std::vector<std::uint32_t>& mapped_peds, pugi::xml_document& doc)
|
||||
inline void parse_ped(std::vector<ped_item>& peds, std::vector<uint32_t>& mapped_peds, pugi::xml_document& doc)
|
||||
{
|
||||
const auto& items = doc.select_nodes("/CPedModelInfo__InitDataList/InitDatas/Item");
|
||||
for (const auto& item_node : items)
|
||||
@ -249,7 +249,7 @@ namespace big
|
||||
|
||||
void gta_data_service::rebuild_cache()
|
||||
{
|
||||
using hash_array = std::vector<std::uint32_t>;
|
||||
using hash_array = std::vector<uint32_t>;
|
||||
hash_array mapped_peds;
|
||||
hash_array mapped_vehicles;
|
||||
hash_array mapped_weapons;
|
||||
@ -260,7 +260,7 @@ namespace big
|
||||
std::vector<weapon_item> weapons;
|
||||
std::vector<weapon_component> weapon_components;
|
||||
|
||||
constexpr auto exists = [](const hash_array& arr, std::uint32_t val) -> bool {
|
||||
constexpr auto exists = [](const hash_array& arr, uint32_t val) -> bool {
|
||||
return std::find(arr.begin(), arr.end(), val) != arr.end();
|
||||
};
|
||||
|
||||
@ -539,7 +539,7 @@ namespace big
|
||||
|
||||
{
|
||||
const auto data_size = sizeof(ped_item) * peds.size();
|
||||
m_peds_cache.set_data(std::make_unique<std::uint8_t[]>(data_size), data_size);
|
||||
m_peds_cache.set_data(std::make_unique<uint8_t[]>(data_size), data_size);
|
||||
std::memcpy(m_peds_cache.data(), peds.data(), data_size);
|
||||
|
||||
m_peds_cache.set_header_version(file_version);
|
||||
@ -548,7 +548,7 @@ namespace big
|
||||
|
||||
{
|
||||
const auto data_size = sizeof(vehicle_item) * vehicles.size();
|
||||
m_vehicles_cache.set_data(std::make_unique<std::uint8_t[]>(data_size), data_size);
|
||||
m_vehicles_cache.set_data(std::make_unique<uint8_t[]>(data_size), data_size);
|
||||
std::memcpy(m_vehicles_cache.data(), vehicles.data(), data_size);
|
||||
|
||||
m_vehicles_cache.set_header_version(file_version);
|
||||
|
@ -29,10 +29,10 @@ namespace big
|
||||
void set_state(eGtaDataUpdateState state);
|
||||
void update_now();
|
||||
|
||||
const ped_item& ped_by_hash(std::uint32_t hash);
|
||||
const vehicle_item& vehicle_by_hash(std::uint32_t hash);
|
||||
const weapon_item& weapon_by_hash(std::uint32_t hash);
|
||||
const weapon_component& weapon_component_by_hash(std::uint32_t hash);
|
||||
const ped_item& ped_by_hash(uint32_t hash);
|
||||
const vehicle_item& vehicle_by_hash(uint32_t hash);
|
||||
const weapon_item& weapon_by_hash(uint32_t hash);
|
||||
const weapon_component& weapon_component_by_hash(uint32_t hash);
|
||||
const weapon_component& weapon_component_by_name(std::string name);
|
||||
|
||||
string_vec& ped_types();
|
||||
|
@ -8,7 +8,7 @@ namespace big
|
||||
public:
|
||||
char m_name[32];
|
||||
char m_ped_type[32];
|
||||
std::uint32_t m_hash;
|
||||
uint32_t m_hash;
|
||||
};
|
||||
#pragma pack(pop)
|
||||
}
|
@ -10,7 +10,7 @@ namespace big
|
||||
char m_display_name[32];
|
||||
char m_display_manufacturer[32];
|
||||
char m_vehicle_class[32];
|
||||
std::uint32_t m_hash;
|
||||
uint32_t m_hash;
|
||||
};
|
||||
#pragma pack(pop)
|
||||
}
|
@ -12,7 +12,7 @@ namespace big
|
||||
{
|
||||
std::string m_game_build;
|
||||
std::string m_online_version;
|
||||
std::uint32_t m_file_version;
|
||||
uint32_t m_file_version;
|
||||
|
||||
NLOHMANN_DEFINE_TYPE_INTRUSIVE(version_info, m_game_build, m_online_version, m_file_version)
|
||||
} version_info{};
|
||||
@ -22,7 +22,7 @@ namespace big
|
||||
|
||||
NLOHMANN_DEFINE_TYPE_INTRUSIVE(weapon_file, version_info, weapon_map, weapon_components)
|
||||
|
||||
bool up_to_date(std::uint32_t file_version) const
|
||||
bool up_to_date(uint32_t file_version) const
|
||||
{
|
||||
return file_version == version_info.m_file_version;
|
||||
}
|
||||
|
@ -8,9 +8,9 @@ namespace big
|
||||
std::string m_name;
|
||||
std::string m_display_name;
|
||||
std::string m_weapon_type;
|
||||
std::uint32_t m_hash;
|
||||
std::uint32_t m_reward_hash;
|
||||
std::uint32_t m_reward_ammo_hash;
|
||||
uint32_t m_hash;
|
||||
uint32_t m_reward_hash;
|
||||
uint32_t m_reward_ammo_hash;
|
||||
std::vector<std::string> m_attachments;
|
||||
bool m_throwable;
|
||||
|
||||
|
@ -207,7 +207,7 @@ namespace big
|
||||
if (const auto handle = rpf->Open(path.string().c_str(), true); handle != -1)
|
||||
{
|
||||
const auto data_length = rpf->GetFileLength(handle);
|
||||
const auto file_content = std::make_unique<std::uint8_t[]>(data_length);
|
||||
const auto file_content = std::make_unique<uint8_t[]>(data_length);
|
||||
|
||||
rpf->ReadFull(handle, file_content.get(), data_length);
|
||||
|
||||
@ -219,7 +219,7 @@ namespace big
|
||||
|
||||
void yim_fipackfile::read_xml_file(const std::filesystem::path& path, std::function<void(pugi::xml_document& doc)> cb)
|
||||
{
|
||||
read_file(path, [&cb](const std::unique_ptr<std::uint8_t[]>& file_content, const int data_size) {
|
||||
read_file(path, [&cb](const std::unique_ptr<uint8_t[]>& file_content, const int data_size) {
|
||||
if (pugi::xml_document doc; doc.load_buffer(file_content.get(), data_size).status == pugi::xml_parse_status::status_ok)
|
||||
{
|
||||
cb(doc);
|
||||
|
@ -3,7 +3,7 @@
|
||||
|
||||
namespace big
|
||||
{
|
||||
using file_contents_callback = std::function<void(const std::unique_ptr<std::uint8_t[]>& file_content, const int data_size)>;
|
||||
using file_contents_callback = std::function<void(const std::unique_ptr<uint8_t[]>& file_content, const int data_size)>;
|
||||
|
||||
class yim_fipackfile
|
||||
{
|
||||
|
@ -33,6 +33,7 @@ namespace big
|
||||
TRAIN,
|
||||
BLACKHOLE,
|
||||
MODEL_SWAPPER,
|
||||
VFX,
|
||||
|
||||
NETWORK,
|
||||
MISSIONS,
|
||||
@ -125,6 +126,7 @@ namespace big
|
||||
{TAB_DECL(TRAIN), view::train}},
|
||||
{TAB_DECL(BLACKHOLE), view::blackhole}},
|
||||
{TAB_DECL(MODEL_SWAPPER), view::model_swapper}},
|
||||
{TAB_DECL(VFX), view::vfx}},
|
||||
},
|
||||
},
|
||||
},
|
||||
|
@ -21,7 +21,7 @@ namespace big
|
||||
if (m_cooldown.has_value())
|
||||
m_wakeup = std::chrono::high_resolution_clock::now() + m_cooldown.value();
|
||||
|
||||
command::get(m_command_hash)->call(std::vector<std::uint64_t>());
|
||||
command::get(m_command_hash)->call(std::vector<uint64_t>());
|
||||
}
|
||||
|
||||
rage::joaat_t hotkey::name_hash() const
|
||||
|
@ -43,7 +43,7 @@ namespace big
|
||||
struct persistent_player
|
||||
{
|
||||
std::string name;
|
||||
std::uint64_t rockstar_id = 0;
|
||||
uint64_t rockstar_id = 0;
|
||||
bool block_join = false;
|
||||
int block_join_reason = 1;
|
||||
bool is_modder = false;
|
||||
|
@ -56,7 +56,7 @@ namespace big
|
||||
}
|
||||
}
|
||||
|
||||
void player_database_service::handle_game_mode_change(std::uint64_t rid, GameMode old_game_mode, GameMode new_game_mode, std::string mission_id, std::string mission_name)
|
||||
void player_database_service::handle_game_mode_change(uint64_t rid, GameMode old_game_mode, GameMode new_game_mode, std::string mission_id, std::string mission_name)
|
||||
{
|
||||
const char* old_game_mode_str = get_game_mode_str(old_game_mode);
|
||||
const char* new_game_mode_str = get_game_mode_str(new_game_mode);
|
||||
@ -189,7 +189,7 @@ namespace big
|
||||
}
|
||||
}
|
||||
|
||||
std::unordered_map<std::uint64_t, std::shared_ptr<persistent_player>>& player_database_service::get_players()
|
||||
std::unordered_map<uint64_t, std::shared_ptr<persistent_player>>& player_database_service::get_players()
|
||||
{
|
||||
return m_players;
|
||||
}
|
||||
@ -216,7 +216,7 @@ namespace big
|
||||
return player;
|
||||
}
|
||||
|
||||
std::shared_ptr<persistent_player> player_database_service::get_player_by_rockstar_id(std::uint64_t rockstar_id)
|
||||
std::shared_ptr<persistent_player> player_database_service::get_player_by_rockstar_id(uint64_t rockstar_id)
|
||||
{
|
||||
if (m_players.contains(rockstar_id))
|
||||
return m_players[rockstar_id];
|
||||
@ -235,7 +235,7 @@ namespace big
|
||||
}
|
||||
}
|
||||
|
||||
void player_database_service::update_rockstar_id(std::uint64_t old, std::uint64_t _new)
|
||||
void player_database_service::update_rockstar_id(uint64_t old, uint64_t _new)
|
||||
{
|
||||
auto player = m_players.extract(old);
|
||||
player.key() = _new;
|
||||
@ -243,7 +243,7 @@ namespace big
|
||||
m_players.insert(std::move(player));
|
||||
}
|
||||
|
||||
void player_database_service::remove_rockstar_id(std::uint64_t rockstar_id)
|
||||
void player_database_service::remove_rockstar_id(uint64_t rockstar_id)
|
||||
{
|
||||
if (m_selected && m_selected->rockstar_id == rockstar_id)
|
||||
m_selected = nullptr;
|
||||
|
@ -24,12 +24,12 @@ namespace big
|
||||
{
|
||||
class player_database_service
|
||||
{
|
||||
std::unordered_map<std::uint64_t, std::shared_ptr<persistent_player>> m_players;
|
||||
std::unordered_map<uint64_t, std::shared_ptr<persistent_player>> m_players;
|
||||
std::map<std::string, std::shared_ptr<persistent_player>> m_sorted_players;
|
||||
std::shared_ptr<persistent_player> m_selected = nullptr;
|
||||
|
||||
void handle_session_type_change(persistent_player& player, GSType new_session_type);
|
||||
static void handle_game_mode_change(std::uint64_t rid, GameMode old_game_mode, GameMode new_game_mode, std::string mission_id, std::string mission_name); // run in fiber pool
|
||||
static void handle_game_mode_change(uint64_t rid, GameMode old_game_mode, GameMode new_game_mode, std::string mission_id, std::string mission_name); // run in fiber pool
|
||||
bool join_being_redirected = false;
|
||||
void handle_join_redirect();
|
||||
std::atomic_bool updating = false;
|
||||
@ -43,12 +43,12 @@ namespace big
|
||||
void load();
|
||||
|
||||
std::shared_ptr<persistent_player> add_player(std::int64_t rid, const std::string_view name);
|
||||
std::unordered_map<std::uint64_t, std::shared_ptr<persistent_player>>& get_players();
|
||||
std::unordered_map<uint64_t, std::shared_ptr<persistent_player>>& get_players();
|
||||
std::map<std::string, std::shared_ptr<persistent_player>>& get_sorted_players();
|
||||
std::shared_ptr<persistent_player> get_player_by_rockstar_id(std::uint64_t rockstar_id);
|
||||
std::shared_ptr<persistent_player> get_player_by_rockstar_id(uint64_t rockstar_id);
|
||||
std::shared_ptr<persistent_player> get_or_create_player(player_ptr player);
|
||||
void update_rockstar_id(std::uint64_t old, std::uint64_t _new);
|
||||
void remove_rockstar_id(std::uint64_t rockstar_id);
|
||||
void update_rockstar_id(uint64_t old, uint64_t _new);
|
||||
void remove_rockstar_id(uint64_t rockstar_id);
|
||||
|
||||
void set_selected(std::shared_ptr<persistent_player> selected);
|
||||
std::shared_ptr<persistent_player> get_selected();
|
||||
|
@ -55,7 +55,7 @@ namespace big
|
||||
|
||||
rage::snPlayer* player::get_session_player()
|
||||
{
|
||||
for (std::uint32_t i = 0; i < gta_util::get_network()->m_game_session_ptr->m_player_count; i++)
|
||||
for (uint32_t i = 0; i < gta_util::get_network()->m_game_session_ptr->m_player_count; i++)
|
||||
{
|
||||
if (gta_util::get_network()->m_game_session_ptr->m_players[i]->m_player_data.m_host_token == get_net_data()->m_host_token)
|
||||
{
|
||||
@ -71,7 +71,7 @@ namespace big
|
||||
|
||||
rage::snPeer* player::get_session_peer()
|
||||
{
|
||||
for (std::uint32_t i = 0; i < gta_util::get_network()->m_game_session_ptr->m_peer_count; i++)
|
||||
for (uint32_t i = 0; i < gta_util::get_network()->m_game_session_ptr->m_peer_count; i++)
|
||||
{
|
||||
if (gta_util::get_network()->m_game_session_ptr->m_peers[i]->m_peer_data.m_gamer_handle.m_rockstar_id
|
||||
== get_net_data()->m_gamer_handle.m_rockstar_id)
|
||||
|
@ -78,10 +78,10 @@ namespace big
|
||||
int block_join_reason = 0;
|
||||
bool is_spammer = false;
|
||||
bool is_admin = false;
|
||||
std::optional<std::uint32_t> player_time_value;
|
||||
std::optional<uint32_t> player_time_value;
|
||||
std::optional<std::chrono::time_point<std::chrono::system_clock, std::chrono::milliseconds>> player_time_value_received_time;
|
||||
std::optional<std::uint32_t> time_difference;
|
||||
std::uint32_t num_time_syncs_sent = 9999;
|
||||
std::optional<uint32_t> time_difference;
|
||||
uint32_t num_time_syncs_sent = 9999;
|
||||
|
||||
bool block_explosions = false;
|
||||
bool block_clone_create = false;
|
||||
|
@ -4,13 +4,13 @@ namespace big
|
||||
{
|
||||
class rate_limiter
|
||||
{
|
||||
std::uint32_t m_attempts_allowed_in_time_period;
|
||||
uint32_t m_attempts_allowed_in_time_period;
|
||||
std::chrono::milliseconds m_time_period;
|
||||
std::chrono::system_clock::time_point m_last_event_time{};
|
||||
std::uint32_t m_num_attempts_allowed = 0;
|
||||
uint32_t m_num_attempts_allowed = 0;
|
||||
|
||||
public:
|
||||
rate_limiter(std::chrono::milliseconds time_period, std::uint32_t num_allowed_attempts) :
|
||||
rate_limiter(std::chrono::milliseconds time_period, uint32_t num_allowed_attempts) :
|
||||
m_attempts_allowed_in_time_period(num_allowed_attempts),
|
||||
m_time_period(time_period)
|
||||
{
|
||||
|
@ -26,8 +26,8 @@ namespace big
|
||||
std::function<void(rage::scrThread*, uint64_t*, uint64_t*)> m_broadcast_setup_callback{};
|
||||
std::function<void(rage::scrThread*, uint64_t*, uint64_t*)> m_broadcast_modify_callback{};
|
||||
|
||||
std::uint64_t* m_host_broadcast_data = nullptr;
|
||||
std::uint64_t* m_player_broadcast_data = nullptr;
|
||||
uint64_t* m_host_broadcast_data = nullptr;
|
||||
uint64_t* m_player_broadcast_data = nullptr;
|
||||
std::optional<std::chrono::system_clock::time_point> m_startup_complete_time = std::nullopt;
|
||||
|
||||
bool does_remote_script_exist();
|
||||
|
@ -4,13 +4,13 @@ namespace big
|
||||
{
|
||||
class script_data
|
||||
{
|
||||
std::uint32_t m_num_pages;
|
||||
uint32_t m_num_pages;
|
||||
|
||||
public:
|
||||
std::uint32_t m_code_size;
|
||||
std::uint8_t** m_bytecode;
|
||||
uint32_t m_code_size;
|
||||
uint8_t** m_bytecode;
|
||||
|
||||
script_data(std::uint32_t code_size, std::uint8_t** bytecode, std::uint32_t num_pages) :
|
||||
script_data(uint32_t code_size, uint8_t** bytecode, uint32_t num_pages) :
|
||||
m_code_size(code_size),
|
||||
m_bytecode(bytecode),
|
||||
m_num_pages(num_pages)
|
||||
|
@ -4,7 +4,7 @@
|
||||
|
||||
namespace big
|
||||
{
|
||||
script_patch::script_patch(rage::joaat_t script, const memory::pattern pattern, int32_t offset, std::vector<std::uint8_t> patch, bool* enable_bool) :
|
||||
script_patch::script_patch(rage::joaat_t script, const memory::pattern pattern, int32_t offset, std::vector<uint8_t> patch, bool* enable_bool) :
|
||||
m_script(script),
|
||||
m_pattern(pattern),
|
||||
m_offset(offset),
|
||||
@ -14,17 +14,17 @@ namespace big
|
||||
{
|
||||
}
|
||||
|
||||
std::uint8_t* script_patch::get_code_address(script_data* data, std::uint32_t index)
|
||||
uint8_t* script_patch::get_code_address(script_data* data, uint32_t index)
|
||||
{
|
||||
return &data->m_bytecode[index >> 14][index & 0x3FFF];
|
||||
}
|
||||
|
||||
const std::optional<uint32_t> script_patch::get_code_location_by_pattern(script_data* data, const memory::pattern& pattern)
|
||||
{
|
||||
std::uint32_t code_size = data->m_code_size;
|
||||
for (std::uint32_t i = 0; i < (code_size - pattern.m_bytes.size()); i++)
|
||||
uint32_t code_size = data->m_code_size;
|
||||
for (uint32_t i = 0; i < (code_size - pattern.m_bytes.size()); i++)
|
||||
{
|
||||
for (std::uint32_t j = 0; j < pattern.m_bytes.size(); j++)
|
||||
for (uint32_t j = 0; j < pattern.m_bytes.size(); j++)
|
||||
if (pattern.m_bytes[j].has_value())
|
||||
if (pattern.m_bytes[j].value() != *get_code_address(data, i + j))
|
||||
goto incorrect;
|
||||
|
@ -15,7 +15,7 @@ namespace big
|
||||
bool* m_bool;
|
||||
int32_t m_ip;
|
||||
|
||||
static std::uint8_t* get_code_address(script_data* data, std::uint32_t index);
|
||||
static uint8_t* get_code_address(script_data* data, uint32_t index);
|
||||
static const std::optional<uint32_t> get_code_location_by_pattern(script_data* data, const memory::pattern& pattern);
|
||||
void enable(script_data* data);
|
||||
void disable(script_data* data);
|
||||
@ -26,7 +26,7 @@ namespace big
|
||||
return m_script;
|
||||
}
|
||||
|
||||
script_patch(rage::joaat_t script, const memory::pattern pattern, int32_t offset, std::vector<std::uint8_t> patch, bool* enable_bool);
|
||||
script_patch(rage::joaat_t script, const memory::pattern pattern, int32_t offset, std::vector<uint8_t> patch, bool* enable_bool);
|
||||
void update(script_data* data);
|
||||
};
|
||||
}
|
@ -45,11 +45,11 @@ namespace big
|
||||
|
||||
void script_patcher_service::create_data_for_script(rage::scrProgram* program)
|
||||
{
|
||||
auto pages = new std::uint8_t*[program->get_num_code_pages()];
|
||||
auto pages = new uint8_t*[program->get_num_code_pages()];
|
||||
|
||||
for (auto i = 0u; i < program->get_num_code_pages(); i++)
|
||||
{
|
||||
pages[i] = new std::uint8_t[program->get_code_page_size(i)];
|
||||
pages[i] = new uint8_t[program->get_code_page_size(i)];
|
||||
std::memcpy(pages[i], program->get_code_page(i), program->get_code_page_size(i));
|
||||
}
|
||||
|
||||
@ -79,7 +79,7 @@ namespace big
|
||||
}
|
||||
}
|
||||
|
||||
std::uint8_t** script_patcher_service::get_script_bytecode(rage::joaat_t script)
|
||||
uint8_t** script_patcher_service::get_script_bytecode(rage::joaat_t script)
|
||||
{
|
||||
if (auto data = get_data_for_script(script))
|
||||
return data->m_bytecode;
|
||||
|
@ -22,7 +22,7 @@ namespace big
|
||||
|
||||
void add_patch(script_patch&& patch);
|
||||
void on_script_load(rage::scrProgram* program);
|
||||
std::uint8_t** get_script_bytecode(rage::joaat_t script);
|
||||
uint8_t** get_script_bytecode(rage::joaat_t script);
|
||||
void update();
|
||||
};
|
||||
|
||||
|
@ -61,7 +61,7 @@ namespace big
|
||||
|
||||
if (SCRIPT::HAS_SCRIPT_WITH_NAME_HASH_LOADED(RAGE_JOAAT("tuneables_processing")))
|
||||
{
|
||||
std::uint64_t args[] = {6, 27}; // TODO: check args
|
||||
uint64_t args[] = {6, 27}; // TODO: check args
|
||||
|
||||
int id = SYSTEM::START_NEW_SCRIPT_WITH_NAME_HASH_AND_ARGS(RAGE_JOAAT("tuneables_processing"), (Any*)args, sizeof(args) / 8, DEFAULT_STACK_SIZE);
|
||||
|
||||
@ -102,12 +102,12 @@ namespace big
|
||||
|
||||
void tunables_service::save()
|
||||
{
|
||||
auto data_size = sizeof(std::uint32_t) + sizeof(tunable_save_struct) * m_tunables.size();
|
||||
auto data = std::make_unique<std::uint8_t[]>(data_size);
|
||||
auto data_size = sizeof(uint32_t) + sizeof(tunable_save_struct) * m_tunables.size();
|
||||
auto data = std::make_unique<uint8_t[]>(data_size);
|
||||
auto data_ptr = data.get();
|
||||
|
||||
*(std::uint32_t*)data_ptr = m_tunables.size();
|
||||
data_ptr += sizeof(std::uint32_t);
|
||||
*(uint32_t*)data_ptr = m_tunables.size();
|
||||
data_ptr += sizeof(uint32_t);
|
||||
|
||||
for (auto& [hash, ptr] : m_tunables)
|
||||
{
|
||||
@ -126,8 +126,8 @@ namespace big
|
||||
{
|
||||
auto data = m_cache_file.data();
|
||||
|
||||
auto num_tunables = *(std::uint32_t*)data;
|
||||
data += sizeof(std::uint32_t);
|
||||
auto num_tunables = *(uint32_t*)data;
|
||||
data += sizeof(uint32_t);
|
||||
|
||||
for (int i = 0; i < num_tunables; i++)
|
||||
{
|
||||
|
@ -9,7 +9,7 @@ namespace big
|
||||
struct tunable_save_struct
|
||||
{
|
||||
rage::joaat_t hash;
|
||||
std::uint32_t offset;
|
||||
uint32_t offset;
|
||||
};
|
||||
#pragma pack(pop)
|
||||
|
||||
|
@ -32,7 +32,7 @@ namespace big
|
||||
handling_profiles m_handling_profiles;
|
||||
|
||||
// contains the handling profiles of a vehicles before they're been modified
|
||||
std::unordered_map<std::uint32_t, handling_profile> m_vehicle_backups;
|
||||
std::unordered_map<uint32_t, handling_profile> m_vehicle_backups;
|
||||
};
|
||||
|
||||
inline handling_service* g_handling_service{};
|
||||
|
Reference in New Issue
Block a user