@lunaticodeveloper
credits:
LTPTeam
Pyke
Yo estoy forzando el uso del launcher desde el Main.dll y me funciona perfectamente:
extern "C" _declspec(dllexport) void EntryProc() // OK
char ** lpszCommandLine = 0;
CommandLineToArg(GetCommandLine(), &lpszCommandLine);
if( strcmp("Updater", lpszCommandLine[1]) )
{
MessageBox(0, "Please start Game from the Launcher!", "ERROR!", MB_OK | MB_ICONASTERISK);
ShellExecuteA(NULL,"open","Launcher.exe",0,0,SW_SHOW);
ExitProcess(0);
}
TMemory.h
void CommandLineToArg(char* Command, char*** argv);
TMemory.cpp
void CommandLineToArg(char * Command, char*** argv)
{
if (!Command) { return; }
bool Quote = false;
bool Content = false;
size_t CommandLen = strlen(Command);
int NumCommands = 1;
size_t I = 0;
for (I=0; I < CommandLen; I++)
{
if (Command[I] == '"')
{
Quote = !Quote;
Content = true;
}
else if (Command[I] == ' ')
{
if (!Quote&&Content)
{
Content = false;
NumCommands++;
}
}
else
{
Content = true;
}
}
*argv = new char*[NumCommands];
size_t StrBegin = 0;
size_t StrLen = 0;
size_t CommandNum = 0;
for (I=0; I < CommandLen; I++)
{
if (Command[I] == '"')
{
Quote = !Quote;
Content = true;
}
else if (Command[I] == ' ')
{
if ( !Quote && Content)
{
Content = false;
StrLen = I - StrBegin;
if (Command[StrBegin] == '"')
{
StrBegin++;
StrLen--;
}
if (Command[StrBegin+StrLen-1] == '"')
{
StrLen-=1;
}
char* Argument = 0;
Argument = new char[StrLen+1];
memcpy(Argument,Command + StrBegin,StrLen);
memset(Argument+StrLen,0,1);
(*argv)[CommandNum] = Argument;
CommandNum++;
StrBegin = I+1;
}
else if ( !Quote )
{
StrBegin++;
}
}
else
{
Content = true;
}
}
StrLen = I - StrBegin;
if (Command[StrBegin] == '"')
{
StrBegin++;
StrLen--;
}
if (Command[StrBegin+StrLen-1] == '"')
{
StrLen-=1;
}
char* Argument = 0;
Argument = new char[StrLen+1];
memcpy(Argument,Command + StrBegin,StrLen);
memset(Argument+StrLen,0,1);
(*argv)[CommandNum] = Argument;
}
but is all this code bro ?
Depende de que files estes usando bro, si estas usando por ejemplo la base de Takumi
Solo vas a definir TMemory en Main.cpp
y agregar el codigo en
y con eso ya esta porque en dichos source ya esta agregado el void CommandLineToArg.