Windows 10: enable virtual terminal processing

Co-Authored-By: Luke S. <luke@street.dev>
This commit is contained in:
s0uthwest 2019-12-25 11:06:44 -08:00
parent c02e9d5876
commit 7720c6ef52
3 changed files with 24 additions and 8 deletions

View file

@ -6,13 +6,6 @@
// Copyright © 2016 tihmstar. All rights reserved. // Copyright © 2016 tihmstar. All rights reserved.
// //
#if defined _WIN32 || defined __CYGWIN__
#ifndef WIN32
//make sure WIN32 is defined if compiling for windows
#define WIN32
#endif
#endif
#include <libgeneral/macros.h> #include <libgeneral/macros.h>
#include <iostream> #include <iostream>
@ -41,7 +34,6 @@ extern "C"{
#include <libirecovery.h> #include <libirecovery.h>
} }
//(re)define __mkdir //(re)define __mkdir
#ifdef __mkdir #ifdef __mkdir
#undef __mkdir #undef __mkdir
@ -56,8 +48,12 @@ extern "C"{
#define USEC_PER_SEC 1000000 #define USEC_PER_SEC 1000000
#ifdef WIN32
#define FUTURERESTORE_TMP_PATH "download"
#else
#define TMP_PATH "/tmp" #define TMP_PATH "/tmp"
#define FUTURERESTORE_TMP_PATH TMP_PATH"/futurerestore" #define FUTURERESTORE_TMP_PATH TMP_PATH"/futurerestore"
#endif
#define BASEBAND_TMP_PATH FUTURERESTORE_TMP_PATH"/baseband.bbfw" #define BASEBAND_TMP_PATH FUTURERESTORE_TMP_PATH"/baseband.bbfw"
#define BASEBAND_MANIFEST_TMP_PATH FUTURERESTORE_TMP_PATH"/basebandManifest.plist" #define BASEBAND_MANIFEST_TMP_PATH FUTURERESTORE_TMP_PATH"/basebandManifest.plist"

View file

@ -9,6 +9,13 @@
#ifndef futurerestore_hpp #ifndef futurerestore_hpp
#define futurerestore_hpp #define futurerestore_hpp
#if defined _WIN32 || defined __CYGWIN__
#ifndef WIN32
//make sure WIN32 is defined if compiling for windows
#define WIN32
#endif
#endif
#include <stdio.h> #include <stdio.h>
#include <functional> #include <functional>
#include <vector> #include <vector>

View file

@ -24,6 +24,12 @@ extern "C"{
#include <libipatcher/libipatcher.hpp> #include <libipatcher/libipatcher.hpp>
#endif #endif
#ifdef WIN32
#include <windows.h>
#ifndef ENABLE_VIRTUAL_TERMINAL_PROCESSING
#define ENABLE_VIRTUAL_TERMINAL_PROCESSING 0x0004
#endif
#endif
static struct option longopts[] = { static struct option longopts[] = {
{ "apticket", required_argument, NULL, 't' }, { "apticket", required_argument, NULL, 't' },
@ -75,6 +81,13 @@ void cmd_help(){
printf(" \t\tWARNING: only use this for device without baseband (eg iPod or some wifi only iPads)\n\n"); printf(" \t\tWARNING: only use this for device without baseband (eg iPod or some wifi only iPads)\n\n");
} }
#ifdef WIN32
DWORD termFlags;
HANDLE handle = GetStdHandle(STD_OUTPUT_HANDLE);
if (GetConsoleMode(handle, &termFlags))
SetConsoleMode(handle, termFlags | ENABLE_VIRTUAL_TERMINAL_PROCESSING);
#endif
using namespace std; using namespace std;
using namespace tihmstar; using namespace tihmstar;
int main_r(int argc, const char * argv[]) { int main_r(int argc, const char * argv[]) {