Skip to content
This repository has been archived by the owner on Feb 6, 2025. It is now read-only.

Commit

Permalink
Update natives to b2802.0
Browse files Browse the repository at this point in the history
this process was done mostly automated. Yet a manual review of the changes has been done and a few tests, however there could still be a very small chance that something could have been broken by this (nothing obvious though).
  • Loading branch information
fingaweg committed Dec 30, 2022
1 parent 81f9b8f commit 92f5836
Show file tree
Hide file tree
Showing 59 changed files with 7,303 additions and 6,030 deletions.
32 changes: 16 additions & 16 deletions Solution/source/Memory/GTAmemory.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1251,7 +1251,7 @@ float GTAmemory::WorldGravity_get()
void GTAmemory::WorldGravity_set(float value)
{
*_writeWorldGravityAddress = value;
GAMEPLAY::SET_GRAVITY_LEVEL(0);
SET_GRAVITY_LEVEL(0);
}

/*void GTAmemory::GetVehicleHandles(std::vector<Entity>& result)
Expand Down Expand Up @@ -1352,7 +1352,7 @@ void SpSnow::EnableSnow(bool bEnable)
{
BEGIN_TEXT_COMMAND_PRINT("STRING");
ADD_TEXT_COMPONENT_SUBSTRING_PLAYER_NAME("~r~Error:~s~ Snow is not compatible with this GTA Version.");
_DRAW_SUBTITLE_TIMED(2000, 1);
END_TEXT_COMMAND_PRINT(2000, 1);
//auto snow_ptr = GetTunablePtr<INT32>(RawTunableIndex::TURN_SNOW_ON_OFF);
//*snow_ptr = bEnable ? 1 : 0;
return;
Expand All @@ -1375,7 +1375,7 @@ void SpSnow::EnableSnow(bool bEnable)
{
BEGIN_TEXT_COMMAND_PRINT("STRING");
ADD_TEXT_COMPONENT_SUBSTRING_PLAYER_NAME("~r~Error:~s~ Snow is not compatible with this GTA Version.");
_DRAW_SUBTITLE_TIMED(2000, 1);
END_TEXT_COMMAND_PRINT(2000, 1);
//auto snow_ptr = GetTunablePtr<INT32>(RawTunableIndex::TURN_SNOW_ON_OFF);
//*snow_ptr = bEnable ? 1 : 0;
return;
Expand Down Expand Up @@ -1467,8 +1467,8 @@ void SpSnow::EnableSnow(bool bEnable)

//*snow_ptr = 1;

//_SET_FORCE_PED_FOOTSTEPS_TRACKS(true);
//_SET_FORCE_VEHICLE_TRAILS(true);
//USE_SNOW_FOOT_VFX_WHEN_UNSHELTERED(true);
//USE_SNOW_WHEEL_VFX_WHEN_UNSHELTERED(true);
this->EnableTracks(true, true, true, true);
// Now on
}
Expand All @@ -1484,8 +1484,8 @@ void SpSnow::EnableSnow(bool bEnable)

//*snow_ptr = 0;

//_SET_FORCE_PED_FOOTSTEPS_TRACKS(false);
//_SET_FORCE_VEHICLE_TRAILS(false);
//USE_SNOW_FOOT_VFX_WHEN_UNSHELTERED(false);
//USE_SNOW_WHEEL_VFX_WHEN_UNSHELTERED(false);
this->EnableTracks(false, false, false, false);
// Now off
}
Expand All @@ -1502,25 +1502,25 @@ void SpSnow::EnableTracks(bool tracksPed, bool deepTracksPed, bool tracksVehicle

if (tracksPed || tracksVehicle)
{
STREAMING::REQUEST_NAMED_PTFX_ASSET("core_snow");
GRAPHICS::_SET_PTFX_ASSET_NEXT_CALL("core_snow");
REQUEST_NAMED_PTFX_ASSET("core_snow");
USE_PARTICLE_FX_ASSET("core_snow");
}
else
{
STREAMING::_REMOVE_NAMED_PTFX_ASSET("core_snow");
REMOVE_NAMED_PTFX_ASSET("core_snow");
}
if (tracksPed)
{
AUDIO::REQUEST_SCRIPT_AUDIO_BANK("ICE_FOOTSTEPS", true);
AUDIO::REQUEST_SCRIPT_AUDIO_BANK("SNOW_FOOTSTEPS", true);
REQUEST_SCRIPT_AUDIO_BANK("ICE_FOOTSTEPS", true, 0);
REQUEST_SCRIPT_AUDIO_BANK("SNOW_FOOTSTEPS", true, 0);
}
else
{
AUDIO::RELEASE_NAMED_SCRIPT_AUDIO_BANK("ICE_FOOTSTEPS");
AUDIO::RELEASE_NAMED_SCRIPT_AUDIO_BANK("SNOW_FOOTSTEPS");
RELEASE_NAMED_SCRIPT_AUDIO_BANK("ICE_FOOTSTEPS");
RELEASE_NAMED_SCRIPT_AUDIO_BANK("SNOW_FOOTSTEPS");
}
GRAPHICS::_SET_FORCE_PED_FOOTSTEPS_TRACKS(tracksPed);
GRAPHICS::_SET_FORCE_VEHICLE_TRAILS(tracksVehicle);
USE_SNOW_FOOT_VFX_WHEN_UNSHELTERED(tracksPed);
USE_SNOW_WHEEL_VFX_WHEN_UNSHELTERED(tracksVehicle);
}

SpSnow::SpSnow()
Expand Down
2 changes: 1 addition & 1 deletion Solution/source/Menu/FolderPreviewBmps.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ namespace sub

if (menuPos.x > 0.45f) x_coord = menuPos.x - 0.003f;

DRAW_RECT(x_coord, y_coord, res.x + 0.003f, res.y + 0.003f, 0, 0, 0, 212);
DRAW_RECT(x_coord, y_coord, res.x + 0.003f, res.y + 0.003f, 0, 0, 0, 212, false);

if (it->second.Exists())
{
Expand Down
138 changes: 69 additions & 69 deletions Solution/source/Menu/Menu.cpp

Large diffs are not rendered by default.

184 changes: 92 additions & 92 deletions Solution/source/Menu/Routine.cpp

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion Solution/source/Menu/Routine.h
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ extern Hash kaboom_gun_hash, bullet_gun_hash;
extern GTAmodel::Model ped_gun_hash, object_gun_hash;
extern FLOAT current_timescale;
extern INT Static_241, Static_240, Static_242, Static_12;
extern PCHAR Static_239;
extern const char* Static_239;
extern INT bit_MSPaints_RGB_mode;
extern bool kaboom_gun_invis, kaboom_gun_rand_bit, ped_gun_rand_bit, object_gun_rand_bit_o, object_gun_rand_bit_v;
extern bool bit_night_vision;
Expand Down
10 changes: 5 additions & 5 deletions Solution/source/Misc/FlameThrower.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@ namespace _FlameThrower_ // Why have I made this for 'players' when this is sp a
}
}

wobject = GET_CURRENT_PED_WEAPON_ENTITY_INDEX(playerPed.Handle());
wobject = GET_CURRENT_PED_WEAPON_ENTITY_INDEX(playerPed.Handle(), 0);
Model& wmodel = wobject.Model();
gunBone = GET_ENTITY_BONE_INDEX_BY_NAME(wobject.Handle(), "Gun_Nuzzle");
//ModelDimensions& wdim = wmodel.Dimensions();
Expand All @@ -165,13 +165,13 @@ namespace _FlameThrower_ // Why have I made this for 'players' when this is sp a

if (!DOES_PARTICLE_FX_LOOPED_EXIST(fxHandle1))
{
_SET_PTFX_ASSET_NEXT_CALL(fxAsset1);
fxHandle1 = _START_PARTICLE_FX_LOOPED_ON_ENTITY_BONE(fxName1, wobject.Handle(), 0.0f, 0.0f, 0.04f, 89.5f, 0.0f, 90.0f, gunBone, scale, 0, 0, 0);
USE_PARTICLE_FX_ASSET(fxAsset1);
fxHandle1 = START_PARTICLE_FX_LOOPED_ON_ENTITY_BONE(fxName1, wobject.Handle(), 0.0f, 0.0f, 0.04f, 89.5f, 0.0f, 90.0f, gunBone, scale, 0, 0, 0);
}
/*if (!DOES_PARTICLE_FX_LOOPED_EXIST(fxHandle2))
{
_SET_PTFX_ASSET_NEXT_CALL(fxAsset2);
fxHandle2 = _START_PARTICLE_FX_LOOPED_ON_ENTITY_BONE(fxName2, wobject.Handle(), 0.0f, 2.33f, 0.04f, 89.5f, 0.0f, 90.0f, gunBone, scale, 0, 0, 0);
USE_PARTICLE_FX_ASSET(fxAsset2);
fxHandle2 = START_PARTICLE_FX_LOOPED_ON_ENTITY_BONE(fxName2, wobject.Handle(), 0.0f, 2.33f, 0.04f, 89.5f, 0.0f, 90.0f, gunBone, scale, 0, 0, 0);
}*/

SET_PARTICLE_FX_LOOPED_EVOLUTION(fxHandle1, "flow", 1.0f, 0);
Expand Down
6 changes: 3 additions & 3 deletions Solution/source/Misc/Gta2Cam.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -112,9 +112,9 @@ namespace _Gta2Cam_
mainCam.Position_set(myPos + mainCamRelativePos);
//mainCam.Rotation_set(-89.5f, 0.0f, 0.0f);

//_CLAMP_GAMEPLAY_CAM_PITCH(-90.0f, -90.0f);
_CLAMP_GAMEPLAY_CAM_PITCH(0.0f, 0.0f);
_CLAMP_GAMEPLAY_CAM_YAW(0.0f, 0.0f);
//SET_THIRD_PERSON_CAM_RELATIVE_PITCH_LIMITS_THIS_UPDATE(-90.0f, -90.0f);
SET_THIRD_PERSON_CAM_RELATIVE_PITCH_LIMITS_THIS_UPDATE(0.0f, 0.0f);
SET_THIRD_PERSON_CAM_RELATIVE_HEADING_LIMITS_THIS_UPDATE(0.0f, 0.0f);

GTAvehicle myVeh = myPed.CurrentVehicle();

Expand Down
14 changes: 7 additions & 7 deletions Solution/source/Misc/JumpAroundMode.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ namespace _JumpAroundMode_
if (IS_ENTITY_ATTACHED(ped) || !IS_PED_ON_FOOT(ped) || IS_ENTITY_IN_AIR(ped))
continue;
NETWORK_REQUEST_CONTROL_OF_ENTITY(ped);
TASK_JUMP(ped, true);
TASK_JUMP(ped, true, false, false);
APPLY_FORCE_TO_ENTITY(ped, 1, 0, 0, jumpForce, 0, 0, 0, false, false, true, true, false, true);
STOP_PED_SPEAKING(ped, true);

Expand All @@ -98,19 +98,19 @@ namespace _JumpAroundMode_
//if (GET_GAME_TIMER() >= Menu::delayedTimer)
//{
//neonRGB = { GET_RANDOM_INT_IN_RANGE(0, 255), GET_RANDOM_INT_IN_RANGE(0, 255), GET_RANDOM_INT_IN_RANGE(0, 255) };
_SET_VEHICLE_NEON_LIGHT_ENABLED(vehicle, 0, true);
_SET_VEHICLE_NEON_LIGHT_ENABLED(vehicle, 1, true);
_SET_VEHICLE_NEON_LIGHT_ENABLED(vehicle, 2, true);
_SET_VEHICLE_NEON_LIGHT_ENABLED(vehicle, 3, true);
_SET_VEHICLE_NEON_LIGHTS_COLOUR(vehicle, neonRGB.R, neonRGB.G, neonRGB.B);
SET_VEHICLE_NEON_ENABLED(vehicle, 0, true);
SET_VEHICLE_NEON_ENABLED(vehicle, 1, true);
SET_VEHICLE_NEON_ENABLED(vehicle, 2, true);
SET_VEHICLE_NEON_ENABLED(vehicle, 3, true);
SET_VEHICLE_NEON_COLOUR(vehicle, neonRGB.R, neonRGB.G, neonRGB.B);
//}
DRAW_LIGHT_WITH_RANGE(Pos.x, Pos.y, Pos.z, neonRGB.R, neonRGB.G, neonRGB.B, 3.2f, 1.2f);

//if (IS_ENTITY_IN_AIR(vehicle)) continue;
if (IS_VEHICLE_ON_ALL_WHEELS(vehicle))
{
NETWORK_REQUEST_CONTROL_OF_ENTITY(vehicle);
_SET_VEHICLE_NEON_LIGHT_ENABLED(vehicle, 0, 1); _SET_VEHICLE_NEON_LIGHT_ENABLED(vehicle, 1, 1); _SET_VEHICLE_NEON_LIGHT_ENABLED(vehicle, 2, 1); _SET_VEHICLE_NEON_LIGHT_ENABLED(vehicle, 3, 1);
SET_VEHICLE_NEON_ENABLED(vehicle, 0, 1); SET_VEHICLE_NEON_ENABLED(vehicle, 1, 1); SET_VEHICLE_NEON_ENABLED(vehicle, 2, 1); SET_VEHICLE_NEON_ENABLED(vehicle, 3, 1);
APPLY_FORCE_TO_ENTITY(vehicle, 0, 0.0f, 0.0f, jumpForce, 0.0f, 0.0f, 0.0f, false, false, true, true, false, true); // 68.f
}

Expand Down
14 changes: 7 additions & 7 deletions Solution/source/Misc/ManualRespawn.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -44,10 +44,10 @@ namespace _ManualRespawn_
{
GenericLoopedMode::TurnOff();

GAMEPLAY::_DISABLE_AUTOMATIC_RESPAWN(false);
SCRIPT::SET_NO_LOADING_SCREEN(false);
GAMEPLAY::SET_FADE_OUT_AFTER_DEATH(true);
GAMEPLAY::SET_FADE_OUT_AFTER_ARREST(true);
PAUSE_DEATH_ARREST_RESTART(false);
SET_NO_LOADING_SCREEN(false);
SET_FADE_OUT_AFTER_DEATH(true);
SET_FADE_OUT_AFTER_ARREST(true);
}

bool ManualRespawn::IsSkipPressed()
Expand Down Expand Up @@ -420,7 +420,7 @@ namespace _ManualRespawn_
{
if (IsSkipPressed())
{
_DISABLE_AUTOMATIC_RESPAWN(false);
PAUSE_DEATH_ARREST_RESTART(false);
SET_NO_LOADING_SCREEN(false);
SET_FADE_OUT_AFTER_DEATH(true);
SET_FADE_OUT_AFTER_ARREST(true);
Expand All @@ -429,7 +429,7 @@ namespace _ManualRespawn_
}
else if (!inRespawn)
{
_DISABLE_AUTOMATIC_RESPAWN(true);
PAUSE_DEATH_ARREST_RESTART(true);
SET_NO_LOADING_SCREEN(true);
SET_FADE_OUT_AFTER_DEATH(false);
SET_FADE_OUT_AFTER_ARREST(false);
Expand Down Expand Up @@ -467,7 +467,7 @@ namespace _ManualRespawn_

if ((!is_death && !is_arrest) || _ManualRespawn_::g_manualRespawn.InRespawn())
return;
if (_GET_NUMBER_OF_INSTANCES_OF_STREAMED_SCRIPT(0xCAC8014F) > 0)//director_mode.ysc
if (GET_NUMBER_OF_THREADS_RUNNING_THE_SCRIPT_WITH_THIS_HASH(0xCAC8014F) > 0)//director_mode.ysc
return;

Model& model = playerPed.Model();
Expand Down
44 changes: 23 additions & 21 deletions Solution/source/Natives/nativeCaller.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,37 +8,39 @@

#include "..\main.h"

// Zorg93
template <typename T>
static inline void nativePush(T value)
static inline void nativePush(T val)
{
UINT64 val64 = 0;
static_assert(sizeof(T) <= sizeof(UINT64), "error, value size > 64 bit");
*reinterpret_cast<T *>(&val64) = value; // &val + sizeof(dw) - sizeof(val)
if (sizeof(T) > sizeof(UINT64))
{
throw "error, value size > 64 bit";
}
*reinterpret_cast<T*>(&val64) = val; // &val + sizeof(dw) - sizeof(val)
nativePush64(val64);
}

////Helper for pushing a std::string
//static inline void nativePush(const std::string& value)
//{
// nativePush(value.c_str());
//}
static inline void pushArgs()
{
}

template <typename R, typename... TArgs>
static inline R invoke(UINT64 hash, TArgs... args)
template <typename T>
static inline void pushArgs(T arg)
{
static_assert(sizeof...(TArgs) <= 25, "Cannot push more than 25 Args to a native");
static_assert(sizeof(R) <= 24, "Natives cannot return data types larger than 24 bytes");
nativeInit(hash);
(nativePush(args), ...);
return *reinterpret_cast<R *>(nativeCall());
nativePush(arg);
}

template <typename R>
inline R invoke(UINT64 hash)
template <typename T, typename... Ts>
static inline void pushArgs(T arg, Ts... args)
{
static_assert(sizeof(R) <= 24, "Natives cannot return data types larger than 24 bytes");
nativeInit(hash);
return *reinterpret_cast<R *>(nativeCall());
nativePush(arg);
pushArgs(args...);
}

template <typename R, typename... Ts>
static inline R invoke(UINT64 hash, Ts... args)
{
nativeInit(hash);
pushArgs(args...);
return *reinterpret_cast<R*>(nativeCall());
}
Loading

0 comments on commit 92f5836

Please sign in to comment.