Skip to content

Commit

Permalink
Updater: Initialize and shutdown
Browse files Browse the repository at this point in the history
  • Loading branch information
skyjake committed May 24, 2012
1 parent 3a0ce9a commit 1a4bc98
Show file tree
Hide file tree
Showing 3 changed files with 64 additions and 89 deletions.
61 changes: 37 additions & 24 deletions doomsday/engine/portable/include/dd_pinit.h
@@ -1,29 +1,23 @@
/**\file dd_pinit.h
*\section License
* License: GPL
* Online License Link: http://www.gnu.org/licenses/gpl.html
*
*\author Copyright © 2003-2012 Jaakko Keränen <jaakko.keranen@iki.fi>
*\author Copyright © 2009-2012 Daniel Swanson <danij@dengine.net>
/**
* @file dd_pinit.h
* Platform independent routines for initializing the engine. @ingroup base
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
* @authors Copyright © 2003-2012 Jaakko Keränen <jaakko.keranen@iki.fi>
* @authors Copyright © 2009-2012 Daniel Swanson <danij@dengine.net>
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* @par License
* GPL: http://www.gnu.org/licenses/gpl.html
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor,
* Boston, MA 02110-1301 USA
*/

/**
* Portable Engine Initialization
* <small>This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by the
* Free Software Foundation; either version 2 of the License, or (at your
* option) any later version. This program is distributed in the hope that it
* will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
* Public License for more details. You should have received a copy of the GNU
* General Public License along with this program; if not, write to the Free
* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
* 02110-1301 USA</small>
*/

#ifndef LIBDENG_PORTABLE_INIT_H
Expand All @@ -39,14 +33,33 @@ extern "C" {

extern uint mainWindowIdx;

// Maximum allowed number of plugins.
/// Maximum allowed number of plugins.
#define MAX_PLUGS 32

/**
* Shuts down all subsystems. This is called from DD_Shutdown().
*/
void DD_ShutdownAll(void);

int DD_CheckArg(char* tag, const char** value);

/**
* Compose the title for the main window.
* @param title Title text for the window.
*/
void DD_ComposeMainWindowTitle(char* title);

/**
* Called early on during the startup process so that we can get the console
* online ready for printing ASAP.
*/
void DD_ConsoleInit(void);

void DD_InitAPI(void);

/**
* Define abbreviations and aliases for command line options.
*/
void DD_InitCommandLine(void);

extern game_import_t gi;
Expand Down
5 changes: 5 additions & 0 deletions doomsday/engine/portable/src/dd_init.cpp
Expand Up @@ -58,6 +58,7 @@

#include <QApplication>
#include <QSettings>
#include <QNetworkProxyFactory>
#include <QDebug>
#include <stdlib.h>
#include <de/App>
Expand All @@ -68,6 +69,7 @@
#include "con_main.h"
#include "window.h"
#include "displaymode.h"
#include "updater.h"
#include "sys_system.h"

extern "C" {
Expand All @@ -92,6 +94,9 @@ LegacyCore* de2LegacyCore;

static void continueInitWithEventLoopRunning(void)
{
// Check for updates automatically.
Updater_Init();

// This function only needs to be called once, so clear the callback.
LegacyCore_SetLoopFunc(de2LegacyCore, 0);

Expand Down
87 changes: 22 additions & 65 deletions doomsday/engine/portable/src/dd_pinit.c
@@ -1,35 +1,27 @@
/**\file dd_pinit.c
*\section License
* License: GPL
* Online License Link: http://www.gnu.org/licenses/gpl.html
/**
* @file dd_pinit.c
* Platform independent routines for initializing the engine. @ingroup base
*
*\author Copyright © 2003-2012 Jaakko Keränen <jaakko.keranen@iki.fi>
*\author Copyright © 2006-2012 Daniel Swanson <danij@dengine.net>
* @todo Move these to dd_init.cpp.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
* @authors Copyright © 2003-2012 Jaakko Keränen <jaakko.keranen@iki.fi>
* @authors Copyright © 2006-2012 Daniel Swanson <danij@dengine.net>
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* @par License
* GPL: http://www.gnu.org/licenses/gpl.html
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor,
* Boston, MA 02110-1301 USA
* <small>This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by the
* Free Software Foundation; either version 2 of the License, or (at your
* option) any later version. This program is distributed in the hope that it
* will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
* Public License for more details. You should have received a copy of the GNU
* General Public License along with this program; if not, write to the Free
* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
* 02110-1301 USA</small>
*/

/**
* Portable Engine Initialization
*
* Platform independent routines for initializing the engine.
*/

// HEADER FILES ------------------------------------------------------------

#ifdef WIN32
# define WIN32_LEAN_AND_MEAN
# include <windows.h>
Expand All @@ -46,33 +38,18 @@
#include "de_filesys.h"

#include "def_main.h"

// MACROS ------------------------------------------------------------------

// TYPES -------------------------------------------------------------------

// EXTERNAL FUNCTION PROTOTYPES --------------------------------------------

// PUBLIC FUNCTION PROTOTYPES ----------------------------------------------

// PRIVATE FUNCTION PROTOTYPES ---------------------------------------------

// EXTERNAL DATA DECLARATIONS ----------------------------------------------

// PUBLIC DATA DEFINITIONS -------------------------------------------------
#include "updater.h"

/*
* The game imports and exports.
*/
game_import_t __gi;
game_export_t __gx;

// PRIVATE DATA DEFINITIONS ------------------------------------------------

// CODE --------------------------------------------------------------------

int DD_CheckArg(char* tag, const char** value)
{
/// @todo Add parameter for using NextAsPath().

int i = CommandLine_Check(tag);
const char* next = CommandLine_Next();

Expand All @@ -83,9 +60,6 @@ int DD_CheckArg(char* tag, const char** value)
return 1;
}

/**
* Compose the title for the main window.
*/
void DD_ComposeMainWindowTitle(char* title)
{
if(DD_GameLoaded() && gx.GetVariable)
Expand Down Expand Up @@ -132,7 +106,6 @@ void DD_InitAPI(void)

void DD_InitCommandLine(void)
{
// Register some abbreviations for command line options.
CommandLine_Alias("-game", "-g");
CommandLine_Alias("-defs", "-d");
CommandLine_Alias("-width", "-w");
Expand All @@ -157,10 +130,6 @@ void DD_InitCommandLine(void)
CommandLine_Alias("-verbose", "-v");
}

/**
* Called early on during the startup process so that we can get the console
* online ready for printing ASAP.
*/
void DD_ConsoleInit(void)
{
const char* outFileName = "doomsday.out";
Expand All @@ -173,7 +142,6 @@ void DD_ConsoleInit(void)

// We'll redirect stdout to a log file.
outFileOk = LegacyCore_SetLogFile(de2LegacyCore, Str_Text(&nativePath));
//outFile = fopen(Str_Text(&nativePath), "w");
Str_Free(&nativePath);

if(!outFileOk)
Expand All @@ -197,13 +165,11 @@ void DD_ConsoleInit(void)
}
}

/**
* This is called from DD_Shutdown().
*/
void DD_ShutdownAll(void)
{
int i;

Updater_Shutdown();
FI_Shutdown();
UI_Shutdown();
Con_Shutdown();
Expand All @@ -228,13 +194,4 @@ void DD_ShutdownAll(void)
Garbage_Shutdown(); // before memzone
Z_Shutdown();
Sys_ShutdownWindowManager();

/*
// Close the message output file.
if(outFile)
{
fclose(outFile);
outFile = NULL;
}
*/
}

0 comments on commit 1a4bc98

Please sign in to comment.