for to include the CLI files lool
This commit is contained in:
parent
cd97239ffe
commit
6b0113e2d7
@ -16,6 +16,8 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "zthread", "src\zthread.vcpr
|
|||||||
EndProject
|
EndProject
|
||||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "shared", "src\shared.vcproj", "{F548FC51-24A4-45FF-A381-BEBC39F18270}"
|
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "shared", "src\shared.vcproj", "{F548FC51-24A4-45FF-A381-BEBC39F18270}"
|
||||||
ProjectSection(ProjectDependencies) = postProject
|
ProjectSection(ProjectDependencies) = postProject
|
||||||
|
{8F1DEA42-6A5B-4B62-839D-C141A7BFACF2} = {8F1DEA42-6A5B-4B62-839D-C141A7BFACF2}
|
||||||
|
{262199E8-EEDF-4700-A1D1-E9CC901CF480} = {262199E8-EEDF-4700-A1D1-E9CC901CF480}
|
||||||
EndProjectSection
|
EndProjectSection
|
||||||
EndProject
|
EndProject
|
||||||
Global
|
Global
|
||||||
|
|||||||
47
src/Client/Cli.cpp
Normal file
47
src/Client/Cli.cpp
Normal file
@ -0,0 +1,47 @@
|
|||||||
|
#include "common.h"
|
||||||
|
#include "DefScript/DefScript.h"
|
||||||
|
#include "PseuWoW.h"
|
||||||
|
#include "Cli.h"
|
||||||
|
|
||||||
|
CliRunnable::CliRunnable(PseuInstance *p)
|
||||||
|
{
|
||||||
|
_stop = false;
|
||||||
|
_instance = p;
|
||||||
|
}
|
||||||
|
|
||||||
|
void CliRunnable::run(void)
|
||||||
|
{
|
||||||
|
char buf[400],*in;
|
||||||
|
std::string cur,out;
|
||||||
|
|
||||||
|
while(!_stop)
|
||||||
|
{
|
||||||
|
printf("<%s>:",cur.c_str());
|
||||||
|
fflush(stdout);
|
||||||
|
in = fgets(buf,sizeof(buf),stdin);
|
||||||
|
if (in == NULL)
|
||||||
|
return;
|
||||||
|
for(int i=0;in[i];i++)
|
||||||
|
if(in[i]=='\r'||in[i]=='\n')
|
||||||
|
{
|
||||||
|
in[i]=0;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
if(in[0]==0)
|
||||||
|
continue;
|
||||||
|
if(in[0]=='!')
|
||||||
|
cur = &in[1];
|
||||||
|
else
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
out = cur.empty() ? in : (cur+" "+in);
|
||||||
|
_instance->GetScripts()->RunSingleLine(out);
|
||||||
|
}
|
||||||
|
catch (...)
|
||||||
|
{
|
||||||
|
printf("Exception while executing CLI command!\n");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
18
src/Client/Cli.h
Normal file
18
src/Client/Cli.h
Normal file
@ -0,0 +1,18 @@
|
|||||||
|
#ifndef _CLI_H
|
||||||
|
#define _CLI_H
|
||||||
|
|
||||||
|
class PseuInstance;
|
||||||
|
|
||||||
|
class CliRunnable : public ZThread::Runnable
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
CliRunnable(PseuInstance*);
|
||||||
|
void run(void);
|
||||||
|
void stop() { _stop=true; }
|
||||||
|
|
||||||
|
private:
|
||||||
|
bool _stop;
|
||||||
|
PseuInstance *_instance;
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif
|
||||||
@ -83,7 +83,9 @@ int main(int argc, char* argv[]) {
|
|||||||
t.wait();
|
t.wait();
|
||||||
//...
|
//...
|
||||||
_UnhookSignals();
|
_UnhookSignals();
|
||||||
|
raise(SIGABRT); // this way to terminate is not nice but the only way to quit the CLI thread
|
||||||
raise(SIGQUIT);
|
raise(SIGQUIT);
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
catch (...)
|
catch (...)
|
||||||
{
|
{
|
||||||
|
|||||||
@ -29,9 +29,9 @@
|
|||||||
BasicRuntimeChecks="3"
|
BasicRuntimeChecks="3"
|
||||||
RuntimeLibrary="3"
|
RuntimeLibrary="3"
|
||||||
PrecompiledHeaderFile=".\Debug/PseuWoW_Controller.pch"
|
PrecompiledHeaderFile=".\Debug/PseuWoW_Controller.pch"
|
||||||
AssemblerListingLocation="$(SolutionDir)/temp/$(ProjectName)/"
|
AssemblerListingLocation="$(SolutionDir)temp/$(ProjectName)/$(ConfigurationName)/"
|
||||||
ObjectFile="$(SolutionDir)/temp/$(ProjectName)/"
|
ObjectFile="$(SolutionDir)temp/$(ProjectName)/$(ConfigurationName)/"
|
||||||
ProgramDataBaseFileName="$(SolutionDir)/temp/$(ProjectName)/"
|
ProgramDataBaseFileName="$(SolutionDir)temp/$(ProjectName)/$(ConfigurationName)/"
|
||||||
WarningLevel="3"
|
WarningLevel="3"
|
||||||
SuppressStartupBanner="TRUE"
|
SuppressStartupBanner="TRUE"
|
||||||
DebugInformationFormat="4"/>
|
DebugInformationFormat="4"/>
|
||||||
@ -83,9 +83,9 @@
|
|||||||
EnableFunctionLevelLinking="FALSE"
|
EnableFunctionLevelLinking="FALSE"
|
||||||
EnableEnhancedInstructionSet="0"
|
EnableEnhancedInstructionSet="0"
|
||||||
PrecompiledHeaderFile=".\Release/PseuWoW_Controller.pch"
|
PrecompiledHeaderFile=".\Release/PseuWoW_Controller.pch"
|
||||||
AssemblerListingLocation="$(SolutionDir)/temp/$(ProjectName)/"
|
AssemblerListingLocation="$(SolutionDir)temp/$(ProjectName)/$(ConfigurationName)/"
|
||||||
ObjectFile="$(SolutionDir)/temp/$(ProjectName)/"
|
ObjectFile="$(SolutionDir)temp/$(ProjectName)/$(ConfigurationName)/"
|
||||||
ProgramDataBaseFileName="$(SolutionDir)/temp/$(ProjectName)/"
|
ProgramDataBaseFileName="$(SolutionDir)temp/$(ProjectName)/$(ConfigurationName)/"
|
||||||
WarningLevel="3"
|
WarningLevel="3"
|
||||||
SuppressStartupBanner="TRUE"/>
|
SuppressStartupBanner="TRUE"/>
|
||||||
<Tool
|
<Tool
|
||||||
|
|||||||
@ -30,6 +30,9 @@
|
|||||||
RuntimeTypeInfo="TRUE"
|
RuntimeTypeInfo="TRUE"
|
||||||
UsePrecompiledHeader="0"
|
UsePrecompiledHeader="0"
|
||||||
PrecompiledHeaderFile="$(SolutionDir)/temp/$(ProjectName)/zlib.pch"
|
PrecompiledHeaderFile="$(SolutionDir)/temp/$(ProjectName)/zlib.pch"
|
||||||
|
AssemblerListingLocation="$(SolutionDir)temp/$(ProjectName)/$(ConfigurationName)/"
|
||||||
|
ObjectFile="$(SolutionDir)temp/$(ProjectName)/$(ConfigurationName)/"
|
||||||
|
ProgramDataBaseFileName="$(SolutionDir)temp/$(ProjectName)/$(ConfigurationName)/"
|
||||||
WarningLevel="3"
|
WarningLevel="3"
|
||||||
Detect64BitPortabilityProblems="TRUE"
|
Detect64BitPortabilityProblems="TRUE"
|
||||||
DebugInformationFormat="3"/>
|
DebugInformationFormat="3"/>
|
||||||
@ -71,6 +74,9 @@
|
|||||||
RuntimeTypeInfo="TRUE"
|
RuntimeTypeInfo="TRUE"
|
||||||
UsePrecompiledHeader="0"
|
UsePrecompiledHeader="0"
|
||||||
PrecompiledHeaderFile="$(SolutionDir)/temp/$(ProjectName)/zlib.pch"
|
PrecompiledHeaderFile="$(SolutionDir)/temp/$(ProjectName)/zlib.pch"
|
||||||
|
AssemblerListingLocation="$(SolutionDir)temp/$(ProjectName)/$(ConfigurationName)/"
|
||||||
|
ObjectFile="$(SolutionDir)temp/$(ProjectName)/$(ConfigurationName)/"
|
||||||
|
ProgramDataBaseFileName="$(SolutionDir)temp/$(ProjectName)/$(ConfigurationName)/"
|
||||||
WarningLevel="3"
|
WarningLevel="3"
|
||||||
Detect64BitPortabilityProblems="TRUE"
|
Detect64BitPortabilityProblems="TRUE"
|
||||||
DebugInformationFormat="3"/>
|
DebugInformationFormat="3"/>
|
||||||
|
|||||||
@ -13,8 +13,8 @@
|
|||||||
<Configurations>
|
<Configurations>
|
||||||
<Configuration
|
<Configuration
|
||||||
Name="Debug|Win32"
|
Name="Debug|Win32"
|
||||||
OutputDirectory="$(SolutionDir)/temp/$(ProjectName)/$(ConfigurationName)"
|
OutputDirectory="$(SolutionDir)temp/$(ProjectName)/$(ConfigurationName)"
|
||||||
IntermediateDirectory="$(SolutionDir)/temp/$(ProjectName)/$(ConfigurationName)"
|
IntermediateDirectory="$(SolutionDir)temp/$(ProjectName)/$(ConfigurationName)"
|
||||||
ConfigurationType="4"
|
ConfigurationType="4"
|
||||||
CharacterSet="2">
|
CharacterSet="2">
|
||||||
<Tool
|
<Tool
|
||||||
@ -28,6 +28,9 @@
|
|||||||
RuntimeTypeInfo="TRUE"
|
RuntimeTypeInfo="TRUE"
|
||||||
UsePrecompiledHeader="0"
|
UsePrecompiledHeader="0"
|
||||||
PrecompiledHeaderFile="$(SolutionDir)/temp/$(ProjectName)/zthread.pch"
|
PrecompiledHeaderFile="$(SolutionDir)/temp/$(ProjectName)/zthread.pch"
|
||||||
|
AssemblerListingLocation="$(SolutionDir)temp/$(ProjectName)/$(ConfigurationName)/"
|
||||||
|
ObjectFile="$(SolutionDir)temp/$(ProjectName)/$(ConfigurationName)/"
|
||||||
|
ProgramDataBaseFileName="$(SolutionDir)temp/$(ProjectName)/$(ConfigurationName)/"
|
||||||
WarningLevel="3"
|
WarningLevel="3"
|
||||||
Detect64BitPortabilityProblems="TRUE"
|
Detect64BitPortabilityProblems="TRUE"
|
||||||
DebugInformationFormat="3"/>
|
DebugInformationFormat="3"/>
|
||||||
@ -57,8 +60,8 @@
|
|||||||
</Configuration>
|
</Configuration>
|
||||||
<Configuration
|
<Configuration
|
||||||
Name="Release|Win32"
|
Name="Release|Win32"
|
||||||
OutputDirectory="$(SolutionDir)/temp/$(ProjectName)/$(ConfigurationName)"
|
OutputDirectory="$(SolutionDir)temp/$(ProjectName)/$(ConfigurationName)"
|
||||||
IntermediateDirectory="$(SolutionDir)/temp/$(ProjectName)/$(ConfigurationName)"
|
IntermediateDirectory="$(SolutionDir)temp/$(ProjectName)/$(ConfigurationName)"
|
||||||
ConfigurationType="4"
|
ConfigurationType="4"
|
||||||
CharacterSet="2">
|
CharacterSet="2">
|
||||||
<Tool
|
<Tool
|
||||||
@ -69,6 +72,9 @@
|
|||||||
RuntimeTypeInfo="TRUE"
|
RuntimeTypeInfo="TRUE"
|
||||||
UsePrecompiledHeader="0"
|
UsePrecompiledHeader="0"
|
||||||
PrecompiledHeaderFile="$(SolutionDir)/temp/$(ProjectName)/zthread.pch"
|
PrecompiledHeaderFile="$(SolutionDir)/temp/$(ProjectName)/zthread.pch"
|
||||||
|
AssemblerListingLocation="$(SolutionDir)temp/$(ProjectName)/$(ConfigurationName)/"
|
||||||
|
ObjectFile="$(SolutionDir)temp/$(ProjectName)/$(ConfigurationName)/"
|
||||||
|
ProgramDataBaseFileName="$(SolutionDir)temp/$(ProjectName)/$(ConfigurationName)/"
|
||||||
WarningLevel="3"
|
WarningLevel="3"
|
||||||
Detect64BitPortabilityProblems="TRUE"
|
Detect64BitPortabilityProblems="TRUE"
|
||||||
DebugInformationFormat="3"/>
|
DebugInformationFormat="3"/>
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user