Skip to content

Commit

Permalink
Merge pull request #3 from madsciencecoder/windows-tweaks
Browse files Browse the repository at this point in the history
Tweaks to improve Windows compatibility.
  • Loading branch information
madsciencecoder committed Feb 20, 2016
2 parents cf0812f + a60fd50 commit df35f2c
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 18 deletions.
10 changes: 7 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,11 @@

Custom launcher for the MMORPG Toontown Rewritten. Named after the in game shticker book which provides access to various settings and data. It tries to provide an all in one tool to provide useful tools to make playing easier.

Currently the only supported platform is Linux. It is designed with being cross-platform in mind but I have not yet had a chance to build it or test for Mac OS X or Windows. If someone would like to build it for either platform it should just be a matter of changing a few defines in globaldefines.h and configuring the build environment.
It is designed with being cross-platform in mind but I have not yet had a chance to build it or test for Mac OS X. If someone would like to, it should just be a matter of changing a few defines in globaldefines.h and configuring the build environment.

### Windows Installer

There is now an official installer for Windows. Please check the releases page to download the most recent version. Please note that it does not check for updates for itself yet so be sure to either keep an eye out or you can follow the repository for email updates.

### Linux Packages

Expand Down Expand Up @@ -71,9 +75,9 @@ TODO: add dependency packages and link to AUR PKGBUILD
#### Windows
As of commit 2f31c14 it should now compile and run just fine on Windows. Windows is still not being officially supported so while future commits will likely not break compatibility they will not be tested on Windows.
Check
The easiest way to compile this on Windows is to download Qt from their website (https://www.qt.io/download-open-source/) and install with at least Qt 5.5 and MinGW. You will need to manually supply a built bzip2 library for Qt to use. You can get a pre-compiled one from http://sourceforge.net/projects/mingw/files/MinGW/Extension/bzip2/bzip2-1.0.6-4/. You will need both the dev and dll-2 downloads. Then copy the files to the Qt folders containing the build libraries. Qt does not provide any DLLs for openssl either which is necessary since the program uses HTTPS for the login. You can get some pre compiled ones from http://slproweb.com/products/Win32OpenSSL.html. To make handling DLLs easier you may wish to also add the Qt bin directory to your Windows PATH environment variable.
The easiest way to compile this on Windows is to download Qt from their website (https://www.qt.io/download-open-source/) and install with at least Qt 5.5 and MinGW. You will need to manually supply a built bzip2 library for Qt to use which you can download a pre-compiled one from http://sourceforge.net/projects/mingw/files/MinGW/Extension/bzip2/bzip2-1.0.6-4/. You will need both the dev and dll-2 downloads. Then copy the files to the Qt folders containing the build libraries. You will also need openssl DLLs which can be downloaded from http://slproweb.com/products/Win32OpenSSL.html. To make handling DLLs easier you may wish to add the Qt bin directory to your Windows PATH environment variable.
#### Mac OS X
Expand Down
15 changes: 9 additions & 6 deletions globaldefines.h
Original file line number Diff line number Diff line change
Expand Up @@ -25,21 +25,27 @@

//Platform Specific Configurations
#ifdef Q_OS_LINUX
#define FILES_PATH QDir::homePath() + "/ToontownRewritten/"
#define FILES_PATH QDir::homePath() + QString("/ToontownRewritten/")
#define PLATFORM "linux2"
#define ENGINE_FILENAME "TTREngine"
#define ENGINE_FILENAME FILES_PATH + QString("TTREngine")
#define CACHE_DIR FILES_PATH + QString("cache/")
#define LOG_FILE FILES_PATH + QString("log.txt")

//for windows support (should now work)
#elif defined(Q_OS_WIN)
#define FILES_PATH ""
#define FILES_PATH QDir::currentPath() + QString("/../")
#define ENGINE_FILENAME QString("TTREngine.exe")
#define PLATFORM "win32"
#define CACHE_DIR QString("cache/")
#define LOG_FILE QString("log.txt")

//For OS X support (not used because no mac to compile and test on)
#elif defined(Q_OS_MAC)
#define FILES_PATH ""
#define ENGINE_FILENAME ""
#define PLATFORM "darwin"
#define CACHE_DIR FILES_PATH + QString("cache/")
#define LOG_FILE FILES_PATH + QString("log.txt")

#else
#error "Unsupported platform."
Expand All @@ -50,6 +56,3 @@

//content distribution URL
#define CDN_URL "https://cdn.toontownrewritten.com/content/"

//cache directory for web apps and temporary downloads of updated files
#define CACHE_DIR FILES_PATH + QString("cache/")
10 changes: 3 additions & 7 deletions loginworker.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -227,14 +227,10 @@ void LoginWorker::startGame(QString cookie, QString gameServer)
{
QLOG_DEBUG() << "Starting game!\n";

//setup the paths
QString engineFile = FILES_PATH + ENGINE_FILENAME;
QString gamePath = FILES_PATH;

gameProcess = new QProcess();

gameProcess->setWorkingDirectory(gamePath);
QDir::setCurrent(gamePath);
gameProcess->setWorkingDirectory(FILES_PATH);
QDir::setCurrent(FILES_PATH);

//set the environment variables for the engine
QProcessEnvironment gameEnvironment = QProcessEnvironment::systemEnvironment();
Expand All @@ -246,7 +242,7 @@ void LoginWorker::startGame(QString cookie, QString gameServer)
connect(gameProcess, SIGNAL(finished(int)), this, SLOT(gameHasFinished(int)));

//start the game
gameProcess->start(engineFile);
gameProcess->start(ENGINE_FILENAME);
gameProcess->waitForStarted(30000);
}

Expand Down
3 changes: 1 addition & 2 deletions main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -35,10 +35,9 @@ int main(int argc, char *argv[])

//set logging level and file name
logger.setLoggingLevel(QsLogging::TraceLevel);
const QString sLogPath = FILES_PATH + QString("log.txt");

// Create log destinations
QsLogging::DestinationPtr fileDestination(QsLogging::DestinationFactory::MakeFileDestination(sLogPath));
QsLogging::DestinationPtr fileDestination(QsLogging::DestinationFactory::MakeFileDestination(LOG_FILE));
QsLogging::DestinationPtr debugDestination(QsLogging::DestinationFactory::MakeDebugOutputDestination());

// set log destinations on the logger
Expand Down

0 comments on commit df35f2c

Please sign in to comment.