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
5 changes: 5 additions & 0 deletions .vscode/compile_commands.json
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,11 @@
"arguments": ["/usr/bin/clang", "-c", "-Qunused-arguments", "-m32", "--target=i686-w64-windows-gnu", "-g", "-O0", "-std=c++23", "-include", "src/pch.h", "-include-pch", "build/.objs/ModelExtras/mingw/x86/debug/src/cxx/pch.h.pch", "-Iinclude", "-Iinclude/coreutils", "-I/m2/Code/plugin-sdk", "-I/m2/Code/plugin-sdk/plugin_sa", "-I/m2/Code/plugin-sdk/plugin_sa/game_sa", "-I/m2/Code/plugin-sdk/plugin_sa/game_sa/rw", "-I/m2/Code/plugin-sdk/shared", "-I/m2/Code/plugin-sdk/shared/game", "-I/m2/Code/plugin-sdk/injector", "-I/m2/Code/plugin-sdk/safetyhook", "-Isrc", "-Isrc/features", "-Ibuild/.gens/ModelExtras/mingw/x86/debug/platform/windows/idl", "-DPLUGIN_SGV_10US", "-DMODELEXTRAS_DEV", "-DGTASA", "-DRW", "--target=i686-w64-mingw32", "-fpermissive", "-fcommon", "-fms-extensions", "-Wno-microsoft-include", "-gdwarf-4", "-gstrict-dwarf", "-gcodeview", "-fdebug-macro", "-o", "build/.objs/ModelExtras/mingw/x86/debug/src/features/lights/base.cpp.obj", "src/features/lights/base.cpp"],
"file": "src/features/lights/base.cpp"
},
{
"directory": "/m2/Code/ModelExtras",
"arguments": ["/usr/bin/clang", "-c", "-Qunused-arguments", "-m32", "--target=i686-w64-windows-gnu", "-g", "-O0", "-std=c++23", "-include", "src/pch.h", "-include-pch", "build/.objs/ModelExtras/mingw/x86/debug/src/cxx/pch.h.pch", "-Iinclude", "-Iinclude/coreutils", "-I/m2/Code/plugin-sdk", "-I/m2/Code/plugin-sdk/plugin_sa", "-I/m2/Code/plugin-sdk/plugin_sa/game_sa", "-I/m2/Code/plugin-sdk/plugin_sa/game_sa/rw", "-I/m2/Code/plugin-sdk/shared", "-I/m2/Code/plugin-sdk/shared/game", "-I/m2/Code/plugin-sdk/injector", "-I/m2/Code/plugin-sdk/safetyhook", "-Isrc", "-Isrc/features", "-Ibuild/.gens/ModelExtras/mingw/x86/debug/platform/windows/idl", "-DPLUGIN_SGV_10US", "-DMODELEXTRAS_DEV", "-DGTASA", "-DRW", "--target=i686-w64-mingw32", "-fpermissive", "-fcommon", "-fms-extensions", "-Wno-microsoft-include", "-gdwarf-4", "-gstrict-dwarf", "-gcodeview", "-fdebug-macro", "-o", "build/.objs/ModelExtras/mingw/x86/debug/src/features/lights/headlight.cpp.obj", "src/features/lights/headlight.cpp"],
"file": "src/features/lights/headlight.cpp"
},
{
"directory": "/m2/Code/ModelExtras",
"arguments": ["/usr/bin/clang", "-c", "-Qunused-arguments", "-m32", "--target=i686-w64-windows-gnu", "-g", "-O0", "-std=c++23", "-include", "src/pch.h", "-include-pch", "build/.objs/ModelExtras/mingw/x86/debug/src/cxx/pch.h.pch", "-Iinclude", "-Iinclude/coreutils", "-I/m2/Code/plugin-sdk", "-I/m2/Code/plugin-sdk/plugin_sa", "-I/m2/Code/plugin-sdk/plugin_sa/game_sa", "-I/m2/Code/plugin-sdk/plugin_sa/game_sa/rw", "-I/m2/Code/plugin-sdk/shared", "-I/m2/Code/plugin-sdk/shared/game", "-I/m2/Code/plugin-sdk/injector", "-I/m2/Code/plugin-sdk/safetyhook", "-Isrc", "-Isrc/features", "-Ibuild/.gens/ModelExtras/mingw/x86/debug/platform/windows/idl", "-DPLUGIN_SGV_10US", "-DMODELEXTRAS_DEV", "-DGTASA", "-DRW", "--target=i686-w64-mingw32", "-fpermissive", "-fcommon", "-fms-extensions", "-Wno-microsoft-include", "-gdwarf-4", "-gstrict-dwarf", "-gcodeview", "-fdebug-macro", "-o", "build/.objs/ModelExtras/mingw/x86/debug/src/features/pedcols.cpp.obj", "src/features/pedcols.cpp"],
Expand Down
63 changes: 54 additions & 9 deletions compile_commands.json

Large diffs are not rendered by default.

13 changes: 3 additions & 10 deletions resource/dist/ModelExtras.ini
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@
//
// Current Patrons:
//
// Damix, SimBoRRis
// lemaze93, XG417
// Clayton Morrison, Wei Woo, �Wishy, Alexander Alexander, Macc, Flaqko _GTA, MG45, spdfnpe, ID_not4ound
// SimBoRRis, Supercakes
// Keith Ferrell, XG417, Agha
// Marcos Reis, Flaqko _GTA, spdfnpe
//
// Help support the developer by becoming a patron!
// https://www.patreon.com/c/grinch_
Expand Down Expand Up @@ -132,16 +132,12 @@ MaterialAmbientOff = 0.45
MaterialAmbientOn = 18.0

[CONFIG]
// Enables some developer specific features with MEDEV cheat (Patreon Only)
// Also enables MERELOAD cheat (Reloads config data of current player vehicle)
DeveloperMode = False

// Version check for ModelExtras models (Recommended to keep it enabled)
ModelVersionCheck = True

// Displays a warning message when an incompatible mod is detected
ShowIncompatibleWarning = True

// Log extra info in log, might cause performance issues (Useful for developers)
VerboseLogging = False

Expand All @@ -153,9 +149,6 @@ CoronaDistanceMul = 0.0
// Foglights will only turn on when headlights are active
FoglightTiedToHeadlight = True

// The beam light effect of headlights
HeadLightBeams = True

// ImVehFt light height limit, set to 0.0 to disable
LightHeightLimit = 0.5

Expand Down
2 changes: 1 addition & 1 deletion src/ModelExtrasAPI.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ bool ME_IsFeatureAvail(ME_FeatureID featureId) {
if (idx < 0 || idx >= static_cast<int>(eFeatureMatrix::FeatureCount)) {
return false;
}
return ModelExtrasLoader::m_bEnabledFeatures.test(idx);
return ModelExtras::m_bEnabledFeatures.test(idx);
}

// Dummy function to show on crash logs
Expand Down
15 changes: 2 additions & 13 deletions src/ModelExtrasAPI.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* API provided for ModelExtras v2.1 Release
* API provided for ModelExtras v3.0 Release
*/

#pragma once
Expand Down Expand Up @@ -62,7 +62,7 @@ enum ME_FeatureID
ME_FeatureCount
};

enum ME_MaterialID
enum ME_LightID
{
ME_HeadLightLeft,
ME_HeadLightRight,
Expand Down Expand Up @@ -118,21 +118,10 @@ extern "C"
ME_WRAPPER bool ME_IsFeatureAvail(ME_FeatureID featureId);

// Vehicle
ME_WRAPPER bool ME_GetVehicleLEDState(CVehicle *pVeh, ME_MaterialID ledID);
ME_WRAPPER void ME_SetVehicleLEDState(CVehicle *pVeh, ME_MaterialID ledID, bool state);

ME_WRAPPER bool ME_GetVehicleLightState(CVehicle *pVeh, ME_MaterialID lightId);
ME_WRAPPER void ME_SetVehicleLightState(CVehicle *pVeh, ME_MaterialID lightId, bool state);

ME_WRAPPER unsigned int ME_GetExhaustCount(CVehicle *pVeh);
ME_WRAPPER ME_ExhaustInfo ME_GetExhaustData(CVehicle *pVeh, int index);
ME_WRAPPER void ME_SetExhaustData(CVehicle *pVeh, int index, ME_ExhaustInfo &data);

// Ped
ME_WRAPPER int ME_GetPedRemap(CPed *ped, int index);
ME_WRAPPER void ME_SetPedRemap(CPed *ped, int index, int num);
ME_WRAPPER void ME_SetAllPedRemaps(CPed *ped, int num);

#ifdef __cplusplus
}
#endif
77 changes: 5 additions & 72 deletions src/dllmain.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,35 +2,8 @@
#include "defines.h"
#include "loader.h"

std::vector<std::string> donators = {
"Wei Woo",
"©Wishy",
"Alexander Alexander",
"Imad Fikri",
"ID_not4ound",
"Macc",
"lemaze93",
"XG417",
"Ruethy",
"Flaqko _GTA",
"MG45",
"Boris Ilincic",
"Damix",
"spdfnpe",
"Pol3 Million",
"Bubby Jackson",
"Keith Ferrell",
"Clayton Morrison",
"SimBoRRis",
"Agha"
};

void InitLogFile()
void InitLog()
{
static bool initialized = false;
if (initialized) return;
initialized = true;

auto sink_cout = std::make_shared<AixLog::SinkCout>(AixLog::Severity::debug);
auto sink_file = std::make_shared<AixLog::SinkFile>(AixLog::Severity::debug, std::string(MOD_NAME) + ".log");
AixLog::Log::init({sink_cout, sink_file});
Expand All @@ -48,15 +21,6 @@ void InitLogFile()
st.wYear, st.wMonth, st.wDay, st.wHour, st.wMinute);

header += timeBuf;

if (!donators.empty())
{
header += "Donators:\n";
for (const auto& name : donators)
{
header += "- " + name + "\n";
}
}
LOG(INFO) << header;
}

Expand All @@ -66,52 +30,21 @@ BOOL WINAPI DllMain(HINSTANCE hDllHandle, DWORD nReason, LPVOID Reserved)
{
gVerboseLogging = gConfig.ReadBoolean("CONFIG", "VerboseLogging", false);

Events::initScriptsEvent.after += []()
Events::initGameEvent += []()
{
InitLog();
if (!gVerboseLogging)
{
LOG(INFO) << "Enable 'VerboseLogging' in ModelExtras.ini to display model-related errors.";
}
};

Events::initRwEvent.after += []()
{
bool cleo = GetModuleHandle("CLEO.asi");

if (!cleo)
if (!GetModuleHandle("CLEO.asi"))
{
MessageBox(RsGlobal.ps->window, "CLEO Library 4.4 or above is required!", "ModelExtras", MB_OK);
LOG(ERROR) << "CLEO Library 4.4 or above is required!";
}
};

Events::initGameEvent += []()
{
bool ImVehFtInstalled = GetModuleHandle("ImVehFt.asi");
bool ImVehFtFixInstalled = GetModuleHandle("ImVehFtFix.asi");
bool AVSInstalled = GetModuleHandle("AdvancedVehicleSirens.asi");

InitLogFile();

if (gConfig.ReadBoolean("CONFIG", "ShowIncompatibleWarning", true) && (ImVehFtInstalled || ImVehFtFixInstalled || AVSInstalled))
{
std::string str = "ModelExtras contain the functions of these plugins,\n\n";

if (ImVehFtInstalled)
str += "- ImVehFt.asi\n";
if (ImVehFtFixInstalled)
str += "- ImVehFtFix.asi\n";
if (AVSInstalled)
str += "- AdvancedVehicleSirens.asi\n";

str += "\nRemove them to continue playing the game.";
MessageBox(RsGlobal.ps->window, str.c_str(), "Incompatible plugins found!", MB_OK);
LOG(ERROR) << str;
exit(EXIT_FAILURE);
}
return TRUE;
};
ModelExtrasLoader::Init();
ModelExtras::Init();
}
return TRUE;
}
4 changes: 2 additions & 2 deletions src/features/core/base.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@ CBaseFeature::CBaseFeature(std::string name, std::string configSection, eFeature
{
if (IsActive()) {
m_bActive = true;
ModelExtrasLoader::m_Features.push_back(this);
ModelExtras::m_Features.push_back(this);
if (m_featureId <= eFeatureMatrix::FeatureCount) {
ModelExtrasLoader::m_bEnabledFeatures.set(static_cast<int>(m_featureId));
ModelExtras::m_bEnabledFeatures.set(static_cast<int>(m_featureId));
}
LOG(INFO) << std::format("Feature '{}' enabled.", m_name);
}
Expand Down
2 changes: 1 addition & 1 deletion src/features/core/dummy.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ int ReadHex(char a, char b)
return (a << 4) + b;
}

VehicleDummy::VehicleDummy(const VehicleDummyConfig& config)
VehicleDummy::VehicleDummy(const DummyConfig& config)
{
data = config;
float angleVal = 0.0f;
Expand Down
8 changes: 4 additions & 4 deletions src/features/core/dummy.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,16 +10,16 @@
class VehicleDummy
{
private:
VehicleDummyConfig data;
DummyConfig data;

public:
VehicleDummy(const VehicleDummyConfig& config);
VehicleDummy(const DummyConfig& config);

const VehicleDummyConfig& GetRef() {
const DummyConfig& GetRef() {
return data;
}

VehicleDummyConfig& Get() {
DummyConfig& Get() {
return data;
}

Expand Down
4 changes: 2 additions & 2 deletions src/features/core/dummyconfig.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
class CVehicle;
class RwFrame;

struct VehicleDummyConfig {
struct DummyConfig {
CVehicle *pVeh = nullptr;
RwFrame* frame = nullptr;
CVector position;
Expand Down Expand Up @@ -52,7 +52,7 @@ struct VehicleDummyConfig {
static inline int gId = 0;
int id = 0;

VehicleDummyConfig () : id(gId++) {
DummyConfig () : id(gId++) {

}
};
Loading
Loading