Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/workflows/zip-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -123,10 +123,10 @@ jobs:
changelog += `## PR #${pr.number}: ${pr.title}\n`;
const body = pr.body
if (body) {
const lines = body.split('\n').map(line => line.trim().replace(/^-\s*/, ''));
const lines = body.split('\n').map(line => line.trim());
for (const line of lines) {
if (line)
changelog += `- ${line}\n`;
changelog += `${line}\n`;
}
changelog += "\n";
}
Expand Down
40 changes: 32 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,26 @@
</a>
</div>

<details>
<summary>Table of Contents</summary>
<ol>
<li><a href="#about">About</a></li>
<li>
<a href="#getting-started">Getting Started</a>
<ul>
<li><a href="#setup">setup</a></li>
<li><a href="#commands-console">Commands Console</a></li>
</ul>
</li>
<li><a href="#contributing">Contributing</a></li>
<li><a href="#documentation">Documentation</a></li>
<li><a href="#features">Features</a></li>
<li><a href="#faq">FAQ</a></li>
<li><a href="#contact">Contact</a></li>
<li><a href="#acknowledgments">Acknowledgments</a></li>
</ol>
</details>

# About

![ss](./docs/ss.png)
Expand Down Expand Up @@ -72,6 +92,10 @@ This project was rewritten from scratch using [SmallBase](https://github.com/xes
> Some parts of the API were refactored or extended but nothing has drastically changed.
> All changes introduced in this project are documented in the source.

## Features

A full list of available features and their usage [can be found here](docs/Features.md).

## FAQ

- **Q:** Does this support Enhanced?
Expand All @@ -91,6 +115,14 @@ This project was rewritten from scratch using [SmallBase](https://github.com/xes
- **Short Answer:** No.
- **Long Answer:** Yes, a compatibility layer can be added to accomodate for all language and API differences but is it worth the trouble and code bloat? Absolutely not. We would be better off rewriting this for V2's API.

## Contact

<div>
<a href="https://discord.gg/RHBUxJ5Qhp">
<img height="96" width="192" alt="Discord" src="https://substackcdn.com/image/fetch/$s_!nfCP!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F8a41e45e-aac9-44e5-8b69-55a81058ecbf_875x280.png">
</a>
</div>

## Acknowledgments

| Name | Contribution |
Expand All @@ -104,11 +136,3 @@ This project was rewritten from scratch using [SmallBase](https://github.com/xes
| <a href="https://github.com/durtyfree"><img height="40" width="40" alt="DurtyFree" src="https://avatars.githubusercontent.com/durtyfree"><br/>Alexander Schmid</a> | [GTA V data dumps](https://github.com/DurtyFree/gta-v-data-dumps) |
| <a href="https://github.com/yimura"><img height="40" width="40" alt="Yimura" src="https://avatars.githubusercontent.com/yimura"><br/>Andreas Maerten</a> | GTA V classes (archived/removed) |
| <a href="https://unknowncheats.me"><img height="40" width="40" alt="UC" src="https://avatars.githubusercontent.com/u/29552835"><br/>UnknownCheats</a> | A treasure trove of information |

## Contact

<div>
<a href="https://discord.gg/RHBUxJ5Qhp">
<img height="96" width="192" alt="Discord" src="https://substackcdn.com/image/fetch/$s_!nfCP!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F8a41e45e-aac9-44e5-8b69-55a81058ecbf_875x280.png">
</a>
</div>
49 changes: 49 additions & 0 deletions SSV2/includes/classes/Mutex.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
--------------------------------------
-- Class: Mutex
--------------------------------------
-- Simple mutual exclusion.
---@class Mutex
---@field protected m_locked boolean
---@overload fun(): Mutex
local Mutex = {}
Mutex.__index = Mutex
---@diagnostic disable-next-line
setmetatable(Mutex, {
__call = function(_)
return Mutex.new()
end
})

---@return Mutex
function Mutex.new()
---@diagnostic disable-next-line
return setmetatable({ m_locked = false }, Mutex)
end

function Mutex:Acquire()
while (self.m_locked) do
yield()
end

self.m_locked = true
end

function Mutex:Release()
self.m_locked = false
end

-- Scoped lock.
---@param func function
---@param ... any
---@return ...
function Mutex:WithLock(func, ...)
self:Acquire()
local ret = { xpcall(func, function(msg)
self:Release()
error(msg)
end, ...) }
self:Release()
return table.unpack(ret)
end

return Mutex
43 changes: 17 additions & 26 deletions SSV2/includes/features/vehicle/stancer.lua
Original file line number Diff line number Diff line change
Expand Up @@ -285,11 +285,11 @@ function Stancer:ForEach(array, fn)
end

function Stancer:IsVehicleModelSaved()
if (not self.m_cached_model) then
if (not self.m_entity or not self.m_entity:IsValid()) then
return false
end

return GVars.features.vehicle.stancer.saved_models[tostring(self.m_cached_model)] ~= nil
return GVars.features.vehicle.stancer.saved_models[tostring(self.m_entity:GetModelHash())] ~= nil
end

function Stancer:ReadWheelArray()
Expand Down Expand Up @@ -413,7 +413,7 @@ function Stancer:AreSavedDeltasLoaded()
return false
end

local model = tostring(self.m_cached_model or self.m_entity:GetModelHash())
local model = tostring(self.m_entity:GetModelHash())
local saved = GVars.features.vehicle.stancer.saved_models
local front_obj = saved[model][tostring(self.eWheelSide.FRONT)]
local rear_obj = saved[model][tostring(self.eWheelSide.BACK)]
Expand Down Expand Up @@ -471,45 +471,36 @@ function Stancer:LoadSavedDeltas()
return false
end

local model = tostring(self.m_cached_model or self.m_entity:GetModelHash())
local model = tostring(self.m_entity:GetModelHash())
local saved = GVars.features.vehicle.stancer.saved_models
local front_obj = saved[model][tostring(self.eWheelSide.FRONT)]
local rear_obj = saved[model][tostring(self.eWheelSide.BACK)]
local front_obj = saved[model][self.eWheelSide.FRONT]
local rear_obj = saved[model][self.eWheelSide.BACK]

if (not front_obj or not rear_obj or next(front_obj) == nil or next(rear_obj) == nil) then
if (not front_obj or not rear_obj) then
return false
end

for k, v in pairs(front_obj) do
self.m_deltas[self.eWheelSide.FRONT][k] = v
if (k == "m_suspension_height") then
self.m_suspension_height.m_current = v
else
self.m_deltas[self.eWheelSide.FRONT][k] = v
end
end

for k, v in pairs(rear_obj) do
self.m_deltas[self.eWheelSide.BACK][k] = v
end

self.m_suspension_height.m_current = saved[model]["m_suspension_height"] or 0.0

PHYSICS.ACTIVATE_PHYSICS(self.m_entity:GetHandle())
return true
end

function Stancer:SaveCurrentVehicle()
local model = self.m_cached_model or self.m_entity:GetModelHash()
local __t = {
[self.eWheelSide.FRONT] = StanceObject.new(),
[self.eWheelSide.BACK] = StanceObject.new(),
m_suspension_height = self.m_suspension_height.m_current
}

for k, v in pairs(self.m_deltas[self.eWheelSide.FRONT]) do
__t[self.eWheelSide.FRONT][k] = v
end

for k, v in pairs(self.m_deltas[self.eWheelSide.BACK]) do
__t[self.eWheelSide.BACK][k] = v
end

GVars.features.vehicle.stancer.saved_models[tostring(model)] = table.copy(__t)
local strModel = tostring(self.m_entity:GetModelHash())
local saved = GVars.features.vehicle.stancer.saved_models
saved[strModel] = table.copy(self.m_deltas)
saved[strModel][self.eWheelSide.FRONT]["m_suspension_height"] = self.m_suspension_height.m_current
end

---@return boolean
Expand Down
13 changes: 6 additions & 7 deletions SSV2/includes/frontend/settings/settings_ui.lua
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,12 @@ local draw_cfg_reset_window = false
---@type Set<string>
local cfg_reset_exceptions = Set.new("backend.debug_mode")
local cfg_exc_keys = {
{ pair = Pair.new("YimActions Favorites", "features.yim_actions.favorites"), clicked = false, selected = false },
{ pair = Pair.new("YimResupplier", "features.yrv3"), clicked = false, selected = false },
{ pair = Pair.new("Casino Pacino", "features.dunk"), clicked = false, selected = false },
{ pair = Pair.new("Keyboard Keybinds", "keyboard_keybinds"), clicked = false, selected = false },
{ pair = Pair.new("Controller Keybinds", "gamepad_keybinds"), clicked = false, selected = false },
{ pair = Pair.new("EntityForge Favorites", "features.entity_forge.favorites"), clicked = false, selected = false },
{ pair = Pair.new("EntityForge Creations", "features.entity_forge.forged_entities"), clicked = false, selected = false },
{ pair = Pair.new("Casino Pacino", "features.dunk"), clicked = false, selected = false },
{ pair = Pair.new("EntityForge", "features.entity_forge"), clicked = false, selected = false },
{ pair = Pair.new("YimActions", "features.yim_actions"), clicked = false, selected = false },
{ pair = Pair.new("YimResupplier", "features.yrv3"), clicked = false, selected = false },
{ pair = Pair.new("Controller Keybinds", "gamepad_keybinds"), clicked = false, selected = false },
{ pair = Pair.new("Keyboard Keybinds", "keyboard_keybinds"), clicked = false, selected = false },
}

local function OnConfigReset()
Expand Down
17 changes: 9 additions & 8 deletions SSV2/includes/frontend/vehicle/stancer_ui.lua
Original file line number Diff line number Diff line change
Expand Up @@ -273,21 +273,23 @@ return function()

local saved_models = GVars.features.vehicle.stancer.saved_models
if (next(saved_models) ~= nil) then
ImGui.SameLine()
if (GUI:Button(_T("VEH_STANCE_VIEW_SAVED"))) then
saved_vehs_window.should_draw = true
end

ImGui.SameLine()
GVars.features.vehicle.stancer.auto_apply_saved, auto_apply_clicked = GUI:Checkbox(
_T("VEH_STANCE_AUTOAPPLY"),
GVars.features.vehicle.stancer.auto_apply_saved,
{ tooltip = _T("VEH_STANCE_AUTOAPPLY_TT") }
)

if (GVars.features.vehicle.stancer.auto_apply_saved and auto_apply_clicked) then
if (auto_apply_clicked and GVars.features.vehicle.stancer.auto_apply_saved) then
ThreadManager:Run(function()
Stancer:LoadSavedDeltas()
end)
end

if (GUI:Button(_T("VEH_STANCE_VIEW_SAVED"))) then
saved_vehs_window.should_draw = true
end
end

if (saved_vehs_window.should_draw) then
Expand Down Expand Up @@ -323,9 +325,8 @@ return function()
end

if (GUI:ConfirmPopup("##confirm_remove_all")) then
Serializer:WithLock(function()
GVars.features.vehicle.stancer.saved_models = {}
end)
GVars.features.vehicle.stancer.saved_models = {}
saved_vehs_window.should_draw = false
end
end, function()
saved_vehs_window.should_draw = false
Expand Down
4 changes: 3 additions & 1 deletion SSV2/includes/frontend/vehicle/vehicle_ui.lua
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,9 @@ local function driftOptions()
}
)

ImGui.ColorEditVec3(_T("VEH_DRIFT_SMOKE_COL"), GVars.features.vehicle.drift.smoke_fx.color)
if (GVars.features.vehicle.drift.smoke_fx.enabled) then
ImGui.ColorEditVec3(_T("VEH_DRIFT_SMOKE_COL"), GVars.features.vehicle.drift.smoke_fx.color)
end
end

local function driftMinigameOptions()
Expand Down
Loading