-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
21 changed files
with
3,126 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
cmake_minimum_required(VERSION 3.26) | ||
project(OBCViewer) | ||
|
||
set(CMAKE_CXX_STANDARD 17) | ||
|
||
add_executable(OBCViewer OBCViewer.cpp) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
#include <iostream> | ||
#include <fstream> | ||
|
||
int main(int argc, char* argv[]) { | ||
if (argc != 3) { | ||
std::cerr << "Usage: " << argv[0] << " <script.obc> <output.txt>\n" << std::endl; | ||
printf("Supported games:\n"); | ||
printf(" * Adibou 3\n"); | ||
printf(" * Adi 5\n"); | ||
printf(" * Adibou presente series\n"); | ||
printf(" * Adiboud'chou series\n"); | ||
printf(" * Le Pays des pierres magiques\n"); | ||
printf("\n"); | ||
printf("<script.obc>\n\t .obc script to view\n\n"); | ||
printf("<output.txt>\n\tprints OBC Script in viewable for into the text file\n\n"); | ||
return 1; | ||
} | ||
|
||
std::string inputOBC = argv[1]; | ||
std::string outputOBC = argv[2]; | ||
|
||
// Use the OBC Script for Input | ||
std::ifstream OBCInput(inputOBC); | ||
|
||
if (!OBCInput) { | ||
std::cerr << "Error: Unable to find OBC Script." << std::endl; | ||
return 1; | ||
} | ||
|
||
// Open the output file for the OBC Script | ||
std::ofstream OBCOutput(outputOBC); | ||
|
||
if (!OBCOutput) { | ||
std::cerr << "Error: Unable to create text output of OBC Script." << std::endl; | ||
return 1; | ||
} | ||
|
||
// Read from input and write to output | ||
char c; | ||
while (OBCInput.get(c)) { | ||
if (std::isprint(static_cast<unsigned char>(c))) { | ||
OBCOutput.put(c); | ||
} | ||
} | ||
|
||
// Close input & output for OBC Script | ||
OBCInput.close(); | ||
OBCOutput.close(); | ||
|
||
std::cout << "OBC Script (" << argv[1] << ") is viewable and saved output to " << outputOBC << "" <<std::endl; | ||
|
||
return 0; | ||
} |
Oops, something went wrong.