Skip to content

Commit

Permalink
Add files via upload
Browse files Browse the repository at this point in the history
  • Loading branch information
paganswrath authored Mar 27, 2023
1 parent 93fc8bf commit 7b6ef03
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 66 deletions.
16 changes: 3 additions & 13 deletions Source/Main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,7 @@ int main(int argc, char *argv[])
}
else {
LoadScript(argv[1]);


BenchMode = true;



}

Expand All @@ -32,16 +28,10 @@ int main(int argc, char *argv[])
BeginDrawing();
ClearBackground(BLACK);

if (BenchMode){
TimeCounter ++;

if (TimeCounter == 30 * 5){
cout << "Average Speed: " << (CycleCounter / TimeCounter) / 30 << " \n";
cout << "Cycle Score: " << (CycleCounter) / 30 * 5 << " \n";
exit(0);
}
for (int T = 0 ; T <= InstructionsPerTick ; T++){
CycleInstruction();
ParasiteScriptCoreData.LineCounter += 1;
}
for (int i = 0 ; i <= ProcessSpeed ; i ++)ParasiteScriptInterperate();

EndDrawing();
}
Expand Down
54 changes: 6 additions & 48 deletions Source/Parasite/ParasiteScript.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -204,15 +204,14 @@ static bool TickFlag = false;
static int CycleCounter = 0;
static int TimeCounter = 0;

void* CycleInstruction(void* VInstruction){
string Instruction = *static_cast<string*>(VInstruction);
static int InstructionsPerTick = 8;

auto CycleInstruction(){
if (ParasiteScriptCoreData.LineCounter != ParasiteScriptCoreData.ProgramSize){
string Instruction = ParasiteScriptCoreData.Line[ParasiteScriptCoreData.LineCounter];

if (SplitValue(Instruction, 0 ) == "stop"){

}
if (SplitValue(Instruction , 0 ) == "tick"){
TickFlag = true;
exit(0);
}

if (SplitValue(Instruction, 0 ) == "var" || SplitValue(Instruction, 0 ) == "spr"){
Expand Down Expand Up @@ -442,10 +441,6 @@ void* CycleInstruction(void* VInstruction){
}
}
}

if (SplitValue(Instruction, 0 ) == "end"){
exit(0);
}

if (SplitValue(Instruction, 0 ) == "settextsize"){
ParasiteScriptCoreData.TextSize = StringToInt(SplitValue(Instruction, 1 ));
Expand Down Expand Up @@ -697,47 +692,10 @@ void* CycleInstruction(void* VInstruction){
}
}
}
}
}
}

if (BenchMode){
CycleCounter ++;
}
}

static int InstructionsPerTick = 2;


auto ParasiteScriptInterperate(){ // Quick Interperater
#if (defined(SingleCore))
for (int i = 0 ; i <= ParasiteScriptCoreData.ProgramSize ; i ++){
if (ParasiteScriptCoreData.LineCounter != ParasiteScriptCoreData.ProgramSize){

CycleInstruction(&ParasiteScriptCoreData.Line[ParasiteScriptCoreData.LineCounter]);
ParasiteScriptCoreData.LineCounter ++;

if (TickFlag){
TickFlag = false;
i = ParasiteScriptCoreData.ProgramSize;
}

}
}
#endif
#if (defined(MultiCore))
if (ParasiteScriptCoreData.LineCounter != ParasiteScriptCoreData.ProgramSize){

for (int i = 0; i <= InstructionsPerTick; i++){
pthread_t ChildThread;
pthread_create( &ChildThread, NULL, &CycleInstruction, &ParasiteScriptCoreData.Line[ParasiteScriptCoreData.LineCounter + i]);
}

ParasiteScriptCoreData.LineCounter += InstructionsPerTick;

if (TickFlag){
TickFlag = false;
}
}
#endif

}
10 changes: 5 additions & 5 deletions Source/System.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,7 @@ void DisplayTerminal(){
break;
}

DrawTextEx(PPGSystem.SystemFont, FormatText("%c", DisplayCharacter), {CharacterPlace * 14 , 12 * CharacterLine}, 15, 1, WHITE);
DrawTextEx(PPGSystem.SystemFont, TextFormat("%c", DisplayCharacter), {CharacterPlace * 14 , 12 * CharacterLine}, 15, 1, WHITE);
CharacterPlace ++;

}
Expand Down Expand Up @@ -261,7 +261,7 @@ void DisplayTerminal(){
TextEditorRunning = true;
TerminalRunning = false; // Launch Into App

FileName = FormatText("Apps/%ls.ps" ,AppName.c_str());
FileName = TextFormat("Apps/%ls.ps" ,AppName.c_str());
break;
}

Expand All @@ -286,9 +286,9 @@ void DisplayTerminal(){
AppName += PPGSystem.TerminalData[x];
}

cout << FormatText("Apps/%ls.ps" ,AppName.c_str());
cout << TextFormat("Apps/%ls.ps" ,AppName.c_str());

LoadScript(FormatText("Apps/%ls.ps" ,AppName.c_str()));
LoadScript(TextFormat("Apps/%ls.ps" ,AppName.c_str()));
TerminalRunning = false; // Launch Into App
break;
}
Expand Down Expand Up @@ -450,7 +450,7 @@ void StartMenu(){
}

DrawRectangle(198 , 18 , 24 * 3.75, 10 , BLACK);
DrawTextEx(PPGSystem.SystemFont , FormatText("Sprite Size: %i" ,SpriteEditorSize + 1) , { 200 , 20 } , 8 , 1 , WHITE );
DrawTextEx(PPGSystem.SystemFont , TextFormat("Sprite Size: %i" ,SpriteEditorSize + 1) , { 200 , 20 } , 8 , 1 , WHITE );


}
Expand Down

0 comments on commit 7b6ef03

Please sign in to comment.