Skip to content

Commit

Permalink
feature: add launch options
Browse files Browse the repository at this point in the history
Signed-off-by: Mai Ooizumi <[email protected]>
  • Loading branch information
Mai-Ooizumi committed Apr 11, 2024
1 parent 9c7a963 commit 9788592
Showing 1 changed file with 20 additions and 6 deletions.
26 changes: 20 additions & 6 deletions VScriptAutoPatcher/VScriptAutoPatcher.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -167,9 +167,9 @@ static void Pause()
FlushConsoleInputBuffer(h);
}

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

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

Expand All @@ -185,6 +185,20 @@ int main()

try
{
if (argc > 1)
{
filePath = argv[1];
if (!std::filesystem::exists(filePath))
{
std::cerr << "Specified file path does not exist." << std::endl;
return 2;
}
}
else
{
filePath = "./bin/win64/vscript.dll";
}

if (!std::filesystem::exists(filePath))
{
filePath = SelectPEFile();
Expand All @@ -195,10 +209,10 @@ int main()

PatchFile(filePath, { 0xBE, 0x01, 0x2A, 0x2A, 0x2A, 0x2B, 0xD6, 0x74, 0x2A, 0x3B, 0xD6 }, { 0xBE, 0x02 });
}
else
{
std::cerr << "File doesn't exist" << std::endl;
return 2;
else
{
std::cerr << "File doesn't exist" << std::endl;
return 2;
}

}
Expand Down

0 comments on commit 9788592

Please sign in to comment.