Skip to content

Commit

Permalink
Merge MSWheels commits
Browse files Browse the repository at this point in the history
* includes static_assert_patch
  • Loading branch information
MAFINS authored Oct 15, 2022
2 parents 9fa3a94 + 5588525 commit a0d6125
Show file tree
Hide file tree
Showing 8 changed files with 340 additions and 360 deletions.
45 changes: 23 additions & 22 deletions Solution/source/Menu/Menu.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@ std::pair<UINT16, UINT16> menubindsGamepad = { INPUT_FRONTEND_RB, INPUT_FRONTEND
UINT16 menubinds = VirtualKey::F8;

UINT16 Menu::currentsub = 0, Menu::LOOCsub = SUB::MAINMENU;
INT Menu::currentop = 0, *Menu::currentopATM = &currentop;
INT Menu::currentop = 0, * Menu::currentopATM = &currentop;
INT Menu::currentop_w_breaks = 0;
INT Menu::totalop = 0;
INT Menu::printingop = 0;
Expand Down Expand Up @@ -392,8 +392,8 @@ void Menu::titlebox_draw()
DRAW_SPRITE("shopui_title_supermod", "shopui_title_supermod", 0.16f + menuPos.x, 0.0989f + menuPos.y, 0.20f, 0.083f, 0.0f, 255, 255, 255, titlebox.A); break;
case SUB::WEAPONOPS: case SUB::KABOOMGUN: case SUB::BULLETGUN: case SUB::OBJECTGUN: case SUB::PEDGUN: case SUB::WEAPONOPS_WEAPONFAVOURITES: case SUB::WEAPONOPS_INDIVS_CATEGORIES: case SUB::WEAPONOPS_INDIVS_CATEGORY: case SUB::WEAPONOPS_INDIVS_ITEM: case SUB::WEAPONOPS_INDIVS_ITEM_MODS: case SUB::WEAPONOPS_PARACHUTE: case SUB::WEAPONOPS_LOADOUTS: case SUB::WEAPONOPS_LOADOUTS_INITEM: case SUB::WEAPONOPS_LASERSIGHT: case SUB::FORGEGUN: case SUB::GRAVITYGUN:
DRAW_SPRITE("shopui_title_gunclub", "shopui_title_gunclub", 0.16f + menuPos.x, 0.0989f + menuPos.y, 0.20f, 0.083f, 0.0f, 255, 255, 255, titlebox.A); break;
//case SUB::OBJECTSPAWNER_LIGHTINGOPS: case SUB::OBJECTSPAWNER_LIGHT: case SUB::OBJECTSPAWNER_SPOTLIGHT:
//DRAW_SPRITE("shopui_title_movie_masks", "shopui_title_movie_masks", 0.16f + menuPos.x, 0.0989f + menuPos.y, 0.20f, 0.083f, 0.0f, 255, 255, 255, titlebox.A); break;
//case SUB::OBJECTSPAWNER_LIGHTINGOPS: case SUB::OBJECTSPAWNER_LIGHT: case SUB::OBJECTSPAWNER_SPOTLIGHT:
//DRAW_SPRITE("shopui_title_movie_masks", "shopui_title_movie_masks", 0.16f + menuPos.x, 0.0989f + menuPos.y, 0.20f, 0.083f, 0.0f, 255, 255, 255, titlebox.A); break;
case SUB::SPAWNVEHICLE: case SUB::SPAWNVEHICLE_OPTIONS: case SUB::SPAWNVEHICLE_ALLCATS: case SUB::SPAWNVEHICLE_FAVOURITES: case SUB::FUNNYVEHICLES: case SUB::VEHICLE_SAVER: case SUB::VEHICLE_SAVER_INITEM:
DRAW_SPRITE("shopui_title_carmod2", "shopui_title_carmod2", 0.16f + menuPos.x, 0.0989f + menuPos.y, 0.20f, 0.083f, 0.0f, 255, 255, 255, titlebox.A); break;
case SUB::ANIMATIONSUB: case SUB::ANIMATIONSUB_DEER: case SUB::ANIMATIONSUB_GESTSIT: case SUB::ANIMATIONSUB_GUARDREAC: case SUB::ANIMATIONSUB_MISSRAPPEL: case SUB::ANIMATIONSUB_RANDARREST: case SUB::ANIMATIONSUB_SHARK: case SUB::ANIMATIONSUB_SWAT: case SUB::ANIMATIONSUB_CUSTOM: case SUB::ANIMATIONSUB_SETTINGS: case SUB::ANIMATIONSUB_TASKSCENARIOS: case SUB::ANIMATIONSUB_TASKSCENARIOS2: case SUB::MOVEMENTGROUP:
Expand Down Expand Up @@ -433,7 +433,7 @@ void Menu::background()


// Draw background
if (gradients && BG.R < 20 && BG.G < 20 && BG.B< 20) DRAW_SPRITE("CommonMenu", "Gradient_Bgd", 0.16f + menuPos.x, bg_Y + menuPos.y, 0.20f, bg_length, 0.0f, 255, 255, 255, BG.A);
if (gradients && BG.R < 20 && BG.G < 20 && BG.B < 20) DRAW_SPRITE("CommonMenu", "Gradient_Bgd", 0.16f + menuPos.x, bg_Y + menuPos.y, 0.20f, bg_length, 0.0f, 255, 255, 255, BG.A);
else DRAW_RECT(0.16f + menuPos.x, bg_Y + menuPos.y, 0.20f, bg_length, BG.R, BG.G, BG.B, BG.A);

// Draw scroller indicator rect
Expand Down Expand Up @@ -590,6 +590,8 @@ void Menu::while_opened()
{
SetSub_closed();
}


}
void Menu::Up(bool playSound)
{
Expand Down Expand Up @@ -640,17 +642,17 @@ void Menu::SetSub_previous()
}
void Menu::SetSub_new(INT sub_index)
{
currentsub_ar_index++; // Increment array index
currentsub_ar_index++; //Increment array index
currentsub_ar[currentsub_ar_index] = currentsub; // Store current submenu index in array
currentsub = sub_index; // Set new submenu as current submenu

currentop_ar[currentsub_ar_index] = currentop; // Store currently selected option in array
currentop = 1; currentop_w_breaks = 1; // Set new selected option as first option in submenu

printingop = 0; // Reset currently printing option var
totalop = 0;// Reset total number of options var
totalop = 0; // Reset total number of options var"

*currentopATM = currentop;
*currentopATM = currentop; //SetSub_new complete
}
void Menu::SetSub_closed()
{
Expand Down Expand Up @@ -1029,9 +1031,9 @@ Vector2 MouseSupport::GetSafezoneBounds()
int screenw, screenh;
_GET_SCREEN_ACTIVE_RESOLUTION(&screenw, &screenh);
float ratio = (float)screenw / screenh;
float wmp = ratio*hmp;
float wmp = ratio * hmp;

return Vector2(round(g*wmp) / 1920, round(g*hmp) / 1080);
return Vector2(round(g * wmp) / 1920, round(g * hmp) / 1080);
}

Vector2 MouseSupport::MousePosition()
Expand Down Expand Up @@ -1155,7 +1157,7 @@ void AddTitle(const std::string& text)
Game::Print::drawstringGXT(text, OptionY + menuPos.x, 0.1f + offset + menuPos.y);

}
void AddOption(std::string text, bool &option_code_bool, void(&callback)(), int submenu_index, bool show_arrow, bool gxt)
void AddOption(std::string text, bool& option_code_bool, void(&callback)(), int submenu_index, bool show_arrow, bool gxt)
{
char* tempChar;

Expand All @@ -1171,7 +1173,7 @@ void AddOption(std::string text, bool &option_code_bool, void(&callback)(), int
if (Menu::currentop >= GTA_SCROLLOP)
{

if (Menu::currentop >(Menu::totalop - GTA_BETOP))
if (Menu::currentop > (Menu::totalop - GTA_BETOP))
{
OptionY = GTA_SCROLLOP + (GTA_BETOP - (Menu::totalop - Menu::printingop));
}
Expand Down Expand Up @@ -1238,7 +1240,7 @@ void AddOption(std::string text, bool &option_code_bool, void(&callback)(), int
else Game::Print::drawstring(text, 0.066f + menuPos.x, OptionY + menuPos.y);
}
}
inline void AddOption(std::ostream& os, bool &option_code_bool, void(&callback)(), int submenu_index, bool show_arrow, bool gxt)
inline void AddOption(std::ostream& os, bool& option_code_bool, void(&callback)(), int submenu_index, bool show_arrow, bool gxt)
{
AddOption(dynamic_cast<std::ostringstream&>(os).str(), option_code_bool, callback, submenu_index, show_arrow, gxt);
}
Expand Down Expand Up @@ -1300,7 +1302,7 @@ void OptionStatus(BOOL status)

}
}
void AddToggle(const std::string& text, bool &loop_variable, bool &extra_option_code_ON, bool &extra_option_code_OFF, bool gxt)
void AddToggle(const std::string& text, bool& loop_variable, bool& extra_option_code_ON, bool& extra_option_code_OFF, bool gxt)
{
null = 0;
AddOption(text, null, nullFunc, -1, false, gxt);
Expand All @@ -1313,7 +1315,7 @@ void AddToggle(const std::string& text, bool &loop_variable, bool &extra_option_

OptionStatus(loop_variable); // Display ON/OFF
}
void AddToggle(const std::string& text, bool &loop_variable, void(&callback_ON)(), void(&callback_OFF)(), bool gxt)
void AddToggle(const std::string& text, bool& loop_variable, void(&callback_ON)(), void(&callback_OFF)(), bool gxt)
{
null = 0;
AddOption(text, null, nullFunc, -1, false, gxt);
Expand All @@ -1326,7 +1328,7 @@ void AddToggle(const std::string& text, bool &loop_variable, void(&callback_ON)(

OptionStatus(loop_variable); // Display ON/OFF
}
void AddLocal(const std::string& text, BOOL condition, bool &option_code_ON, bool &option_code_OFF, bool gxt)
void AddLocal(const std::string& text, BOOL condition, bool& option_code_ON, bool& option_code_OFF, bool gxt)
{
null = 0;
AddOption(text, null, nullFunc, -1, false, gxt);
Expand Down Expand Up @@ -1364,7 +1366,7 @@ void AddBreak(const std::string& text)
if (Menu::currentop >= GTA_SCROLLOP)
{

if (Menu::currentop >(Menu::totalop - GTA_BETOP))
if (Menu::currentop > (Menu::totalop - GTA_BETOP))
{
OptionY = GTA_SCROLLOP + (GTA_BETOP - (Menu::totalop - Menu::printingop));
}
Expand Down Expand Up @@ -1416,7 +1418,7 @@ void AddBreak(const std::string& text)
}

}
void AddNumber(const std::string& text, float value, __int8 decimal_places, bool &A_PRESS, bool &RIGHT_PRESS, bool &LEFT_PRESS, bool gxt)
void AddNumber(const std::string& text, float value, __int8 decimal_places, bool& A_PRESS, bool& RIGHT_PRESS, bool& LEFT_PRESS, bool gxt)
{
null = 0;
AddOption(text, null, nullFunc, -1, false, gxt);
Expand Down Expand Up @@ -1482,7 +1484,7 @@ void draw_tickol_tick_BNW(const PCHAR textureDict, const PCHAR normal, const PCH
}
inline void draw_tickol_tick(TICKOL tickType)
{
RGBA *colour = &optiontext;
RGBA* colour = &optiontext;
if (Menu::printingop == *Menu::currentopATM) colour = &selectedtext;
PCHAR textureDict, textureName;
Vector3 texture_res;
Expand Down Expand Up @@ -1554,7 +1556,7 @@ inline void draw_tickol_tick(TICKOL tickType)
DRAW_SPRITE(textureDict, textureName, get_xcoord_at_menu_rightEdge(texture_res.x, 0.0f, true), OptionY + 0.016f + menuPos.y, texture_res.x, texture_res.y, 0.0f, colour->R, colour->G, colour->B, colour->A);

}
void AddTickol(const std::string& text, BOOL condition, bool &option_code_ON, bool &option_code_OFF, TICKOL tickTrue, TICKOL tickFalse, bool gxt)
void AddTickol(const std::string& text, BOOL condition, bool& option_code_ON, bool& option_code_OFF, TICKOL tickTrue, TICKOL tickFalse, bool gxt)
{
null = 0;
AddOption(text, null, nullFunc, -1, false, gxt);
Expand Down Expand Up @@ -1601,7 +1603,7 @@ void AddTickol(const std::string& text, BOOL condition, void(&callback_ON)(), vo
}
}
template<typename TA>
inline void AddTexter(const std::string& text, int selectedindex, const TA& textarray, bool &A_PRESS, bool &RIGHT_PRESS, bool &LEFT_PRESS, bool gxt)
inline void AddTexter(const std::string& text, int selectedindex, const TA& textarray, bool& A_PRESS, bool& RIGHT_PRESS, bool& LEFT_PRESS, bool gxt)
{
null = 0;
AddOption(text, null, nullFunc, -1, false, gxt);
Expand Down Expand Up @@ -1666,7 +1668,7 @@ inline void AddTexter(const std::string& text, int selectedindex, const TA& text
}

}
void AddTexter(const std::string& text, int selectedindex, const std::vector<std::string>& textarray, bool &A_PRESS, bool &RIGHT_PRESS, bool &LEFT_PRESS, bool gxt)
void AddTexter(const std::string& text, int selectedindex, const std::vector<std::string>& textarray, bool& A_PRESS, bool& RIGHT_PRESS, bool& LEFT_PRESS, bool gxt)
{
AddTexter<std::vector<std::string>>(text, selectedindex, textarray, A_PRESS, RIGHT_PRESS, LEFT_PRESS, gxt);
}
Expand Down Expand Up @@ -1728,4 +1730,3 @@ bool Add_preset_colour_options(INT& r, INT& g, INT& b)




2 changes: 1 addition & 1 deletion Solution/source/Menu/MenuConfig.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -525,7 +525,7 @@ void MenuConfig::ConfigSave()
ini.SetLongValue(section_haxValues, "vehicle_spawner_neons_B", _globalSpawnVehicle_neonCol.B);
ini.SetLongValue(section_haxValues, "vehicle_spawner_primary_colour", _globalSpawnVehicle_PrimCol);
ini.SetLongValue(section_haxValues, "vehicle_spawner_secondary_colour", _globalSpawnVehicle_SecCol);
ini.SetBoolValue(section_haxValues, "vehicle_spawner_delete_old", _globalLSC_Customs);
ini.SetBoolValue(section_haxValues, "vehicle_menyoo_customs_lsc", _globalLSC_Customs);

ini.SetDoubleValue(section_haxValues, "clock", sub::Clock_catind::loop_clock);
ini.SetDoubleValue(section_haxValues, "clock_screen_pos_x", sub::Clock_catind::_analogueClockPos.x);
Expand Down
8 changes: 4 additions & 4 deletions Solution/source/Natives/nativeCaller.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ template <typename T>
static inline void nativePush(T value)
{
UINT64 val64 = 0;
//static_assert(sizeof(T) <= sizeof(UINT64), "error, value size > 64 bit");
static_assert(sizeof(T) <= sizeof(UINT64), "error, value size > 64 bit");
*reinterpret_cast<T *>(&val64) = value; // &val + sizeof(dw) - sizeof(val)
nativePush64(val64);
}
Expand All @@ -27,8 +27,8 @@ static inline void nativePush(T value)
template <typename R, typename... TArgs>
static inline R invoke(UINT64 hash, TArgs... args)
{
//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");
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());
Expand All @@ -37,7 +37,7 @@ static inline R invoke(UINT64 hash, TArgs... args)
template <typename R>
inline R invoke(UINT64 hash)
{
//static_assert(sizeof(R) <= 24, "Natives cannot return data types larger than 24 bytes");
static_assert(sizeof(R) <= 24, "Natives cannot return data types larger than 24 bytes");
nativeInit(hash);
return *reinterpret_cast<R *>(nativeCall());
}
Expand Down
4 changes: 2 additions & 2 deletions Solution/source/Natives/natives.h
Original file line number Diff line number Diff line change
Expand Up @@ -653,7 +653,7 @@ namespace PED
static Any _0xF033419D1B81FAE8(Any p0) { return invoke<Any>(0xF033419D1B81FAE8, p0); } // 0xF033419D1B81FAE8
static BOOL IS_PED_COMPONENT_VARIATION_VALID(Ped ped, int componentId, int drawableId, int textureId) { return invoke<BOOL>(0xE825F6B6CEA7671D, ped, componentId, drawableId, textureId); } // 0xE825F6B6CEA7671D 0x952ABD9A
static void SET_PED_COMPONENT_VARIATION(Ped ped, int componentId, int drawableId, int textureId, int paletteId) { invoke<Void>(0x262B14F48D29DE80, ped, componentId, drawableId, textureId, paletteId); } // 0x262B14F48D29DE80 0xD4F7B05C
static void SET_PED_RANDOM_COMPONENT_VARIATION(Ped ped, BOOL p1) { invoke<Void>(0xC8A9481A01E63C28, ped, p1); } // 0xC8A9481A01E63C28 0x4111BA46
//static void SET_PED_RANDOM_COMPONENT_VARIATION(Ped ped, BOOL p1) { invoke<Void>(0xC8A9481A01E63C28, ped, p1); } // 0xC8A9481A01E63C28 0x4111BA46
static void SET_PED_RANDOM_PROPS(Ped ped) { invoke<Void>(0xC44AA05345C992C6, ped); } // 0xC44AA05345C992C6 0xE3318E0E
static void SET_PED_DEFAULT_COMPONENT_VARIATION(Ped ped) { invoke<Void>(0x45EEE61580806D63, ped); } // 0x45EEE61580806D63 0xC866A984
static void SET_PED_BLEND_FROM_PARENTS(Ped ped, Any p1, Any p2, float p3, float p4) { invoke<Void>(0x137BBD05230DB22D, ped, p1, p2, p3, p4); } // 0x137BBD05230DB22D 0x837BD370
Expand Down Expand Up @@ -5362,4 +5362,4 @@ namespace UNK3
static Any _NETWORK_SHOP_CASH_TRANSFER_SET_TELEMETRY_NONCE_SEED() { return invoke<Any>(0x498C1E05CE5F7877); } // 0x498C1E05CE5F7877
static BOOL _NETWORK_SHOP_SET_TELEMETRY_NONCE_SEED(Any p0) { return invoke<BOOL>(0x9507D4271988E1AE, p0); } // 0x9507D4271988E1AE
static char* _GET_ONLINE_VERSION() { return invoke<char*>(0xFCA9373EF340AC0A); } // 0xFCA9373EF340AC0A
}
}
10 changes: 7 additions & 3 deletions Solution/source/Natives/natives2.h
Original file line number Diff line number Diff line change
Expand Up @@ -74,14 +74,19 @@ Hash GET_HASH_KEY(const std::string& value);

void add_text_component_long_string(const std::string& text);

namespace PED
{
static void SET_PED_RANDOM_COMPONENT_VARIATION(Ped ped, bool p1) { invoke<Void>(0xC8A9481A01E63C28, ped, p1); } // 0xC8A9481A01E63C28 0x4111BA46

}
namespace VEHICLE
{
// Interior colour
static void _0x7D1464D472D32136(Vehicle vehicle, int *interiorColour) { invoke<Void>(0x7D1464D472D32136, vehicle, interiorColour); } // 0x7D1464D472D32136
static void _0x7D1464D472D32136(Vehicle vehicle, int* interiorColour) { invoke<Void>(0x7D1464D472D32136, vehicle, interiorColour); } // 0x7D1464D472D32136
static void _0xF40DD601A65F7F19(Vehicle vehicle, int interiorColour) { invoke<Void>(0xF40DD601A65F7F19, vehicle, interiorColour); } // 0xF40DD601A65F7F19

// Dashboard colour
static void _0xB7635E80A5C31BFF(Vehicle vehicle, int *dashboardColour) { invoke<Void>(0xB7635E80A5C31BFF, vehicle, dashboardColour); } // 0xB7635E80A5C31BFF
static void _0xB7635E80A5C31BFF(Vehicle vehicle, int* dashboardColour) { invoke<Void>(0xB7635E80A5C31BFF, vehicle, dashboardColour); } // 0xB7635E80A5C31BFF
static void _0x6089CDF6A57F326C(Vehicle vehicle, int dashboardColour) { invoke<Void>(0x6089CDF6A57F326C, vehicle, dashboardColour); } // 0x6089CDF6A57F326C

// Imp/Exp DLC
Expand All @@ -106,4 +111,3 @@ namespace WEAPON
}



6 changes: 3 additions & 3 deletions Solution/source/Scripting/Model.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -283,13 +283,13 @@ namespace GTAmodel
case VEHICLE_RIPLEY:
case VEHICLE_PHANTOM:
case VEHICLE_AMBULANCE:
case VEHICLE_TYRUS:
//case VEHICLE_TYRUS:
case VEHICLE_CARGOPLANE:
case VEHICLE_RIOT:
case VEHICLE_BUS:
case VEHICLE_AIRBUS:
case VEHICLE_TAMPA:
case VEHICLE_TROHPYTRUCK:
//case VEHICLE_TAMPA:
//case VEHICLE_TROHPYTRUCK: //why were these 3 vehicles included?
case VEHICLE_CADDY3:
return false;
}
Expand Down
Loading

0 comments on commit a0d6125

Please sign in to comment.