2001-10-08 19:24:46 +00:00
|
|
|
#include "CServer.h"
|
|
|
|
#include "CScreenMap.h"
|
2001-10-14 18:29:43 +00:00
|
|
|
#include "CThread.h"
|
2001-11-19 00:33:36 +00:00
|
|
|
#include "CNetwork.h"
|
2001-10-08 19:24:46 +00:00
|
|
|
|
2001-11-19 00:33:36 +00:00
|
|
|
void realMain()
|
2001-10-08 19:24:46 +00:00
|
|
|
{
|
2001-10-14 18:29:43 +00:00
|
|
|
CThread::init();
|
2001-11-19 00:33:36 +00:00
|
|
|
CNetwork::init();
|
2001-10-08 19:24:46 +00:00
|
|
|
|
|
|
|
CScreenMap screenMap;
|
|
|
|
screenMap.addScreen("primary");
|
2001-11-25 18:32:41 +00:00
|
|
|
screenMap.addScreen("secondary");
|
|
|
|
screenMap.connect("primary", CScreenMap::kRight, "secondary");
|
|
|
|
screenMap.connect("secondary", CScreenMap::kLeft, "primary");
|
2001-10-08 19:24:46 +00:00
|
|
|
|
2001-11-19 00:33:36 +00:00
|
|
|
CServer* server = NULL;
|
2001-10-08 19:24:46 +00:00
|
|
|
try {
|
2001-11-19 00:33:36 +00:00
|
|
|
server = new CServer();
|
2001-10-08 19:24:46 +00:00
|
|
|
server->setScreenMap(screenMap);
|
|
|
|
server->run();
|
2001-11-19 00:33:36 +00:00
|
|
|
delete server;
|
|
|
|
CNetwork::cleanup();
|
|
|
|
}
|
|
|
|
catch (...) {
|
|
|
|
delete server;
|
|
|
|
CNetwork::cleanup();
|
|
|
|
throw;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
#if defined(CONFIG_PLATFORM_WIN32)
|
|
|
|
|
|
|
|
#include "CMSWindowsScreen.h"
|
|
|
|
|
|
|
|
int WINAPI WinMain(HINSTANCE instance, HINSTANCE, LPSTR, int)
|
|
|
|
{
|
|
|
|
CMSWindowsScreen::init(instance);
|
|
|
|
|
|
|
|
if (__argc != 1) {
|
|
|
|
CString msg = "no arguments allowed. exiting.";
|
|
|
|
MessageBox(NULL, msg.c_str(), "error", MB_OK | MB_ICONERROR);
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
try {
|
|
|
|
realMain();
|
|
|
|
return 0;
|
2001-10-08 19:24:46 +00:00
|
|
|
}
|
|
|
|
catch (XBase& e) {
|
2001-11-19 00:33:36 +00:00
|
|
|
CString msg = "failed: ";
|
|
|
|
msg += e.what();
|
|
|
|
MessageBox(NULL, msg.c_str(), "error", MB_OK | MB_ICONERROR);
|
2001-10-08 19:24:46 +00:00
|
|
|
return 1;
|
|
|
|
}
|
2001-11-19 00:33:36 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
#else
|
|
|
|
|
|
|
|
#include <stdio.h>
|
2001-10-08 19:24:46 +00:00
|
|
|
|
2001-11-19 00:33:36 +00:00
|
|
|
int main(int argc, char** argv)
|
|
|
|
{
|
|
|
|
if (argc != 1) {
|
|
|
|
fprintf(stderr, "usage: %s\n", argv[0]);
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
try {
|
|
|
|
realMain();
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
catch (XBase& e) {
|
|
|
|
fprintf(stderr, "failed: %s\n", e.what());
|
|
|
|
return 1;
|
|
|
|
}
|
2001-10-08 19:24:46 +00:00
|
|
|
}
|
2001-11-19 00:33:36 +00:00
|
|
|
|
|
|
|
#endif
|