Skip to content

Commit 68999b5

Browse files
update cpp sdk
1 parent 822d413 commit 68999b5

File tree

2 files changed

+1
-148
lines changed

2 files changed

+1
-148
lines changed

runtime/src/CSharpResourceImpl.cpp

Lines changed: 0 additions & 147 deletions
Original file line numberDiff line numberDiff line change
@@ -47,153 +47,6 @@ CSharpResourceImpl::CSharpResourceImpl(alt::ICore* server, CoreClr* coreClr, alt
4747
OnCreateColShapeDelegate = nullptr;
4848
OnRemoveColShapeDelegate = nullptr;
4949
ColShapeDelegate = nullptr;
50-
51-
//if (isDll) {
52-
53-
/*
54-
struct stat buf;
55-
char* assemblyPath = new char[this->GetPath().GetSize() + strlen(ASSEMBLY_PATH) + 1];
56-
memcpy(assemblyPath, this->GetPath().CStr(), this->GetPath().GetSize());
57-
memcpy(assemblyPath + this->GetPath().GetSize(), ASSEMBLY_PATH, strlen(ASSEMBLY_PATH));
58-
strcpy(assemblyPath + this->GetPath().GetSize() + strlen(ASSEMBLY_PATH), "\0");
59-
60-
auto executable = (stat(assemblyPath, &buf) ==
61-
0);//TODO: needs resource cfg "assembly"
62-
delete[] assemblyPath;
63-
64-
coreClr->CreateAppDomain(server, this, this->GetPath().CStr(), &runtimeHost, &domainId, executable,
65-
resourcesCache->GetSize() - 1, this->name.CStr());
66-
67-
if (!executable) {
68-
coreClr->GetDelegate(server, runtimeHost, domainId, "AltV.Net", "AltV.Net.ModuleWrapper", "Main",
69-
reinterpret_cast<void**>(&MainDelegate));
70-
coreClr->GetDelegate(server, runtimeHost, domainId, "AltV.Net", "AltV.Net.ModuleWrapper",
71-
"OnCheckpoint", reinterpret_cast<void**>(&OnCheckpointDelegate));
72-
coreClr->GetDelegate(server, runtimeHost, domainId, "AltV.Net", "AltV.Net.ModuleWrapper",
73-
"OnClientEvent", reinterpret_cast<void**>(&OnClientEventDelegate));
74-
coreClr->GetDelegate(server, runtimeHost, domainId, "AltV.Net", "AltV.Net.ModuleWrapper",
75-
"OnPlayerConnect", reinterpret_cast<void**>(&OnPlayerConnectDelegate));
76-
coreClr->GetDelegate(server, runtimeHost, domainId, "AltV.Net", "AltV.Net.ModuleWrapper",
77-
"OnPlayerDisconnect", reinterpret_cast<void**>(&OnPlayerDisconnectDelegate));
78-
coreClr->GetDelegate(server, runtimeHost, domainId, "AltV.Net", "AltV.Net.ModuleWrapper",
79-
"OnPlayerDamage", reinterpret_cast<void**>(&OnPlayerDamageDelegate));
80-
coreClr->GetDelegate(server, runtimeHost, domainId, "AltV.Net", "AltV.Net.ModuleWrapper",
81-
"OnPlayerDeath", reinterpret_cast<void**>(&OnPlayerDeathDelegate));
82-
coreClr->GetDelegate(server, runtimeHost, domainId, "AltV.Net", "AltV.Net.ModuleWrapper", "OnPlayerRemove",
83-
reinterpret_cast<void**>(&OnPlayerRemoveDelegate));
84-
coreClr->GetDelegate(server, runtimeHost, domainId, "AltV.Net", "AltV.Net.ModuleWrapper", "OnVehicleRemove",
85-
reinterpret_cast<void**>(&OnVehicleRemoveDelegate));
86-
coreClr->GetDelegate(server, runtimeHost, domainId, "AltV.Net", "AltV.Net.ModuleWrapper", "OnServerEvent",
87-
reinterpret_cast<void**>(&OnServerEventDelegate));
88-
coreClr->GetDelegate(server, runtimeHost, domainId, "AltV.Net", "AltV.Net.ModuleWrapper",
89-
"OnPlayerChangeVehicleSeat",
90-
reinterpret_cast<void**>(&OnPlayerChangeVehicleSeatDelegate));
91-
coreClr->GetDelegate(server, runtimeHost, domainId, "AltV.Net", "AltV.Net.ModuleWrapper",
92-
"OnPlayerEnterVehicle",
93-
reinterpret_cast<void**>(&OnPlayerEnterVehicleDelegate));
94-
coreClr->GetDelegate(server, runtimeHost, domainId, "AltV.Net", "AltV.Net.ModuleWrapper",
95-
"OnPlayerLeaveVehicle",
96-
reinterpret_cast<void**>(&OnPlayerLeaveVehicleDelegate));
97-
coreClr->GetDelegate(server, runtimeHost, domainId, "AltV.Net", "AltV.Net.ModuleWrapper", "OnStop",
98-
reinterpret_cast<void**>(&OnStopDelegate));
99-
coreClr->GetDelegate(server, runtimeHost, domainId, "AltV.Net", "AltV.Net.ModuleWrapper", "OnTick",
100-
reinterpret_cast<void**>(&OnTickDelegate));
101-
coreClr->GetDelegate(server, runtimeHost, domainId, "AltV.Net", "AltV.Net.ModuleWrapper", "OnCreatePlayer",
102-
reinterpret_cast<void**>(&OnCreatePlayerDelegate));
103-
coreClr->GetDelegate(server, runtimeHost, domainId, "AltV.Net", "AltV.Net.ModuleWrapper", "OnRemovePlayer",
104-
reinterpret_cast<void**>(&OnRemovePlayerDelegate));
105-
coreClr->GetDelegate(server, runtimeHost, domainId, "AltV.Net", "AltV.Net.ModuleWrapper", "OnCreateVehicle",
106-
reinterpret_cast<void**>(&OnCreateVehicleDelegate));
107-
coreClr->GetDelegate(server, runtimeHost, domainId, "AltV.Net", "AltV.Net.ModuleWrapper", "OnRemoveVehicle",
108-
reinterpret_cast<void**>(&OnRemoveVehicleDelegate));
109-
coreClr->GetDelegate(server, runtimeHost, domainId, "AltV.Net", "AltV.Net.ModuleWrapper", "OnCreateBlip",
110-
reinterpret_cast<void**>(&OnCreateBlipDelegate));
111-
coreClr->GetDelegate(server, runtimeHost, domainId, "AltV.Net", "AltV.Net.ModuleWrapper", "OnRemoveBlip",
112-
reinterpret_cast<void**>(&OnRemoveBlipDelegate));
113-
coreClr->GetDelegate(server, runtimeHost, domainId, "AltV.Net", "AltV.Net.ModuleWrapper",
114-
"OnCreateCheckpoint",
115-
reinterpret_cast<void**>(&OnCreateCheckpointDelegate));
116-
coreClr->GetDelegate(server, runtimeHost, domainId, "AltV.Net", "AltV.Net.ModuleWrapper",
117-
"OnRemoveCheckpoint",
118-
reinterpret_cast<void**>(&OnRemoveCheckpointDelegate));
119-
coreClr->GetDelegate(server, runtimeHost, domainId, "AltV.Net", "AltV.Net.ModuleWrapper",
120-
"OnCreateVoiceChannel",
121-
reinterpret_cast<void**>(&OnCreateVoiceChannelDelegate));
122-
coreClr->GetDelegate(server, runtimeHost, domainId, "AltV.Net", "AltV.Net.ModuleWrapper",
123-
"OnRemoveVoiceChannel",
124-
reinterpret_cast<void**>(&OnRemoveCheckpointDelegate));
125-
coreClr->GetDelegate(server, runtimeHost, domainId, "AltV.Net", "AltV.Net.ModuleWrapper",
126-
"OnConsoleCommand",
127-
reinterpret_cast<void**>(&OnConsoleCommandDelegate));
128-
coreClr->GetDelegate(server, runtimeHost, domainId, "AltV.Net", "AltV.Net.ModuleWrapper",
129-
"OnMetaDataChange",
130-
reinterpret_cast<void**>(&OnMetaChangeDelegate));
131-
coreClr->GetDelegate(server, runtimeHost, domainId, "AltV.Net", "AltV.Net.ModuleWrapper",
132-
"OnSyncedMetaDataChange",
133-
reinterpret_cast<void**>(&OnSyncedMetaChangeDelegate));
134-
coreClr->GetDelegate(server, runtimeHost, domainId, "AltV.Net", "AltV.Net.ModuleWrapper",
135-
"OnCreateColShape",
136-
reinterpret_cast<void**>(&OnCreateColShapeDelegate));
137-
coreClr->GetDelegate(server, runtimeHost, domainId, "AltV.Net", "AltV.Net.ModuleWrapper",
138-
"OnRemoveColShape",
139-
reinterpret_cast<void**>(&OnRemoveColShapeDelegate));
140-
coreClr->GetDelegate(server, runtimeHost, domainId, "AltV.Net", "AltV.Net.ModuleWrapper",
141-
"OnColShape",
142-
reinterpret_cast<void**>(&ColShapeDelegate));
143-
}*/
144-
/*} else {
145-
#ifdef _WIN32
146-
server->LogInfo("Executable found, but not supported on windows");
147-
#else
148-
server->LogInfo("Executable found, will fork");
149-
int status;
150-
pid_t pid = fork();
151-
if (pid == -1) {
152-
server->LogInfo("Can't fork, error occured");
153-
} else if (pid == 0) {
154-
auto index = resourcesCache->GetSize() - 1;
155-
156-
char wd[PATH_MAX];
157-
if (!GetCurrentDir(wd, PATH_MAX)) {
158-
server->LogInfo(alt::String("coreclr-module: Unable to find the working directory"));
159-
return;
160-
}
161-
162-
const char* currResourceName = name.CStr();
163-
auto currFullPath = new char[strlen(wd) + strlen(RESOURCES_PATH) + strlen(currResourceName) +
164-
strlen(main.CStr()) + 1 + 1];
165-
strcpy(currFullPath, wd);
166-
strcat(currFullPath, RESOURCES_PATH);
167-
strcat(currFullPath, currResourceName);
168-
strcat(currFullPath, "/");
169-
strcat(currFullPath, main.CStr());
170-
171-
char resourceIndexChar = index + '0';
172-
char resourceIndexString[1];
173-
resourceIndexString[0] = resourceIndexChar;
174-
//TODO: fix / for windows
175-
***char* argv[4];
176-
argv[0] = currFullPath;
177-
argv[1] = "start";
178-
argv[2] = resourceIndexString;
179-
argv[3] = NULL;
180-
181-
printf("Executing resource with index %lld at path: %s\n", index, currFullPath);
182-
auto result = execvp(argv[0], &argv[1]);**
183-
auto result = execl(currFullPath, main.CStr(), resourceIndexString, NULL);
184-
if (result == -1) {
185-
printf("execvp-error: %s\n", strerror(errno));
186-
} else {
187-
printf("%s\n", "Resource executed successfully");
188-
}
189-
free(currFullPath);
190-
} else {
191-
printf("Execute resource in pid: %d\n", pid);
192-
while (wait(&status) != pid);
193-
printf("Executed resource in pid: %d\n", pid);
194-
}
195-
#endif
196-
}*/
19750
}
19851

19952
bool CSharpResourceImpl::Start() {

runtime/thirdparty/altv-cpp-api

0 commit comments

Comments
 (0)