~ubuntu-branches/ubuntu/trusty/manaplus/trusty

« back to all changes in this revision

Viewing changes to src/main.cpp

  • Committer: Package Import Robot
  • Author(s): Patrick Matthäi
  • Date: 2013-10-07 10:26:14 UTC
  • mfrom: (1.1.11)
  • Revision ID: package-import@ubuntu.com-20131007102614-tg2zjdz8vmtl6n7i
Tags: 1.3.9.29-1
New upstream release.

Show diffs side-by-side

added added

removed removed

Lines of Context:
34
34
#include "utils/mkdir.h"
35
35
#endif
36
36
#include "utils/paths.h"
 
37
#include "utils/physfscheckutils.h"
 
38
#include "utils/physfstools.h"
 
39
#include "utils/physfsrwops.h"
37
40
#include "utils/process.h"
38
 
#include "utils/physfstools.h"
39
41
#include "utils/xml.h"
40
42
 
41
43
#ifdef UNITTESTS
46
48
#include <windows.h>
47
49
#endif
48
50
 
 
51
#include <SDL_image.h>
 
52
#include <SDL_mixer.h>
 
53
#include <SDL_version.h>
 
54
 
 
55
#define SDL_IMAGE_COMPILEDVERSION \
 
56
    SDL_VERSIONNUM(SDL_IMAGE_MAJOR_VERSION, \
 
57
    SDL_IMAGE_MINOR_VERSION, SDL_IMAGE_PATCHLEVEL)
 
58
 
 
59
#define SDL_IMAGE_VERSION_ATLEAST(X, Y, Z) \
 
60
    (SDL_IMAGE_COMPILEDVERSION >= SDL_VERSIONNUM(X, Y, Z))
 
61
 
 
62
#define SDL_MIXER_COMPILEDVERSION \
 
63
    SDL_VERSIONNUM(SDL_MIXER_MAJOR_VERSION, \
 
64
    SDL_MIXER_MINOR_VERSION, SDL_MIXER_PATCHLEVEL)
 
65
 
 
66
#define SDL_MIXER_VERSION_ATLEAST(X, Y, Z) \
 
67
    (SDL_MIXER_COMPILEDVERSION >= SDL_VERSIONNUM(X, Y, Z))
 
68
 
49
69
#include "debug.h"
50
70
 
51
71
char *selfName = nullptr;
273
293
 
274
294
    // Initialize PhysicsFS
275
295
#ifdef ANDROID
276
 
    mkdir_r(getenv("DATADIR2"));
 
296
    mkdir_r(getSdStoragePath().c_str());
277
297
 
278
298
    if (!PHYSFS_init((getRealPath(".").append("/fakebinary")).c_str()))
279
299
#else
290
310
    atexit((void(*)()) PHYSFS_deinit);
291
311
 
292
312
    XML::initXML();
 
313
#if SDL_IMAGE_VERSION_ATLEAST(1, 2, 11)
 
314
    IMG_Init(IMG_INIT_PNG);
 
315
#endif
 
316
#if SDL_MIXER_VERSION_ATLEAST(1, 2, 11)
 
317
    Mix_Init(MIX_INIT_OGG);
 
318
#endif
293
319
 
294
320
#ifdef WIN32
295
321
    SetCurrentDirectory(PhysFs::getBaseDir());
309
335
    }
310
336
    delete client;
311
337
    client = nullptr;
 
338
 
 
339
#if SDL_MIXER_VERSION_ATLEAST(1, 2, 11)
 
340
    Mix_Quit();
 
341
#endif
 
342
#if SDL_IMAGE_VERSION_ATLEAST(1, 2, 11)
 
343
    IMG_Quit();
 
344
#endif
 
345
 
 
346
#ifdef DUMP_LEAKED_RESOURCES
 
347
    reportRWops();
 
348
#endif
 
349
#ifdef DEBUG_PHYSFS
 
350
    reportPhysfsLeaks();
 
351
#endif
312
352
    return ret;
313
353
}
314
354