MCPcopy Create free account
hub / github.com/LibreVR/Revive / wmain

Function wmain

ReviveInjector/main.cpp:176–320  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

174};
175
176int wmain(int argc, wchar_t *argv[]) {
177 if (argc < 2) {
178 printf("usage: ReviveInjector.exe <executable path>\n");
179 return -1;
180 }
181
182 WCHAR LogPath[MAX_PATH];
183 if (SUCCEEDED(SHGetFolderPath(NULL, CSIDL_LOCAL_APPDATA, NULL, 0, LogPath)))
184 {
185 wcsncat(LogPath, L"\\Revive", MAX_PATH);
186
187 BOOL exists = PathFileExists(LogPath);
188 if (!exists)
189 exists = CreateDirectory(LogPath, NULL);
190
191 wcsncat(LogPath, L"\\ReviveInjector.txt", MAX_PATH);
192 if (exists)
193 g_LogFile = _wfopen(LogPath, L"w");
194 }
195
196 LOG("Launched injector with: %ls\n", GetCommandLine());
197
198 char moduleDir[MAX_PATH];
199 GetModuleFileNameA(NULL, moduleDir, MAX_PATH);
200 PathRemoveFileSpecA(moduleDir);
201
202 bool debug = false;
203 StringArray dlls;
204 std::string appKey;
205 wchar_t path[MAX_PATH] = { 0 };
206 for (int i = 1; i < argc; i++)
207 {
208 if (wcscmp(argv[i], L"/openxr") == 0)
209 {
210 dlls.add(moduleDir + std::string("\\LibReviveXR64.dll"));
211 }
212 else if (wcscmp(argv[i], L"/proxy") == 0)
213 {
214 dlls.add(moduleDir + std::string("\\LibOVRProxy64.dll"));
215 }
216 else if (wcscmp(argv[i], L"/app") == 0)
217 {
218 appKey = "revive.app." + std::wstring_convert<std::codecvt_utf8<wchar_t>, wchar_t>().to_bytes(argv[++i]);
219 }
220 else if (wcscmp(argv[i], L"/base") == 0)
221 {
222 if (!GetOculusBasePath(path, MAX_PATH))
223 return -1;
224 }
225 else if (wcscmp(argv[i], L"/library") == 0)
226 {
227 if (!GetLibraryPath(path, MAX_PATH, argv[++i]))
228 {
229 if (!GetDefaultLibraryPath(path, MAX_PATH))
230 {
231 return -1;
232 }
233 }

Callers

nothing calls this directly

Calls 7

GetDefaultLibraryPathFunction · 0.85
addMethod · 0.80
emptyMethod · 0.80
sizeMethod · 0.80
c_strMethod · 0.80
GetOculusBasePathFunction · 0.70
GetLibraryPathFunction · 0.70

Tested by

no test coverage detected