Skip to content

Commit 9788592

Browse files
committed
feature: add launch options
Signed-off-by: Mai Ooizumi <mai@imomoe.moe>
1 parent 9c7a963 commit 9788592

File tree

1 file changed

+20
-6
lines changed

1 file changed

+20
-6
lines changed

VScriptAutoPatcher/VScriptAutoPatcher.cpp

Lines changed: 20 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -167,9 +167,9 @@ static void Pause()
167167
FlushConsoleInputBuffer(h);
168168
}
169169

170-
int main()
170+
int main(int argc, const char * const * argv)
171171
{
172-
std::string filePath = "./bin/win64/vscript.dll";
172+
std::string filePath;
173173

174174
SetConsoleTitleA("黄埔军校 VScript Patcher");
175175

@@ -185,6 +185,20 @@ int main()
185185

186186
try
187187
{
188+
if (argc > 1)
189+
{
190+
filePath = argv[1];
191+
if (!std::filesystem::exists(filePath))
192+
{
193+
std::cerr << "Specified file path does not exist." << std::endl;
194+
return 2;
195+
}
196+
}
197+
else
198+
{
199+
filePath = "./bin/win64/vscript.dll";
200+
}
201+
188202
if (!std::filesystem::exists(filePath))
189203
{
190204
filePath = SelectPEFile();
@@ -195,10 +209,10 @@ int main()
195209

196210
PatchFile(filePath, { 0xBE, 0x01, 0x2A, 0x2A, 0x2A, 0x2B, 0xD6, 0x74, 0x2A, 0x3B, 0xD6 }, { 0xBE, 0x02 });
197211
}
198-
else
199-
{
200-
std::cerr << "File doesn't exist" << std::endl;
201-
return 2;
212+
else
213+
{
214+
std::cerr << "File doesn't exist" << std::endl;
215+
return 2;
202216
}
203217

204218
}

0 commit comments

Comments
 (0)