|
@@ -114,6 +114,7 @@ void cp437toUnicode(const char *input, std::string &out) {
|
|
|
}
|
|
|
|
|
|
bool unicode = false;
|
|
|
+bool full_cp437 = false;
|
|
|
bool debug_capture = false;
|
|
|
|
|
|
|
|
@@ -135,6 +136,7 @@ Door::Door(std::string dname, int argc, char *argv[])
|
|
|
opt.addUsage(" -l --local Local Mode");
|
|
|
opt.addUsage(" -d --dropfile [FILENAME] Load Dropfile");
|
|
|
opt.addUsage(" -n --node N Set node number");
|
|
|
+
|
|
|
|
|
|
opt.addUsage(" -u --username NAME Set Username");
|
|
|
opt.addUsage(" -t --timeleft N Set time left");
|
|
@@ -142,6 +144,8 @@ Door::Door(std::string dname, int argc, char *argv[])
|
|
|
opt.addUsage("");
|
|
|
opt.setFlag("help", 'h');
|
|
|
opt.setFlag("local", 'l');
|
|
|
+ opt.setFlag("cp437", 'c');
|
|
|
+ opt.setFlag("unicode");
|
|
|
opt.setFlag("debuggering");
|
|
|
opt.setOption("dropfile", 'd');
|
|
|
|
|
@@ -229,7 +233,15 @@ Door::Door(std::string dname, int argc, char *argv[])
|
|
|
|
|
|
if (!debugging) {
|
|
|
detect_unicode_and_screen();
|
|
|
- logf << "Screen " << width << " X " << height << std::endl;
|
|
|
+ logf << "Screen " << width << " X " << height << " unicode " << unicode
|
|
|
+ << " full_cp437 " << full_cp437 << std::endl;
|
|
|
+ }
|
|
|
+
|
|
|
+ if (opt.getFlag("cp437")) {
|
|
|
+ unicode = false;
|
|
|
+ }
|
|
|
+ if (opt.getFlag("unicode")) {
|
|
|
+ unicode = true;
|
|
|
}
|
|
|
}
|
|
|
|
|
@@ -294,6 +306,7 @@ void Door::init(void) {
|
|
|
|
|
|
void Door::detect_unicode_and_screen(void) {
|
|
|
unicode = false;
|
|
|
+ full_cp437 = false;
|
|
|
width = 0;
|
|
|
height = 0;
|
|
|
|
|
@@ -307,7 +320,9 @@ void Door::detect_unicode_and_screen(void) {
|
|
|
|
|
|
*this << "\x1b[0;30;40m\x1b[2J\x1b[H";
|
|
|
|
|
|
- *this << "\x03\x04"
|
|
|
+ *this << "\x03\x04"
|
|
|
+ << "\x1b[6n";
|
|
|
+ *this << door::nl << "\u2615"
|
|
|
<< "\x1b[6n";
|
|
|
*this << "\x1b[999C\x1b[999B\x1b[6n";
|
|
|
*this << "\x1b[H";
|
|
@@ -356,18 +371,25 @@ void Door::detect_unicode_and_screen(void) {
|
|
|
|
|
|
|
|
|
|
|
|
- if ((strstr(buffer, "1;1R") != nullptr)) {
|
|
|
+ if ((strstr(buffer, "1;1R") != nullptr) and
|
|
|
+ ((strstr(buffer, "2;2R") != nullptr) or
|
|
|
+ (strstr(buffer, "2;3R") != nullptr))) {
|
|
|
|
|
|
|
|
|
|
|
|
unicode = true;
|
|
|
log() << "unicode enabled \u2615" << std::endl;
|
|
|
+ } else {
|
|
|
+ if (strstr(buffer, "1;3R") != nullptr) {
|
|
|
+ full_cp437 = true;
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
char *cp;
|
|
|
+
|
|
|
cp = strchr(buffer, '\x1b');
|
|
|
if (cp != nullptr) {
|
|
|
cp = strchr(cp + 1, '\x1b');
|
|
@@ -376,6 +398,8 @@ void Door::detect_unicode_and_screen(void) {
|
|
|
log() << buffer << std::endl;
|
|
|
return;
|
|
|
}
|
|
|
+ */
|
|
|
+ cp = strrchr(buffer, '\x1b');
|
|
|
|
|
|
if (cp != nullptr) {
|
|
|
cp++;
|