1
0
forked from 0ad/0ad

singleton.h: use assert2 (avoid trouble in wdbg code)

lib.h: reorder error codes (more clear) and add a few

detect.cpp, gfx.h: move gfx_mem (amount of video memory) here from ogl

This was SVN commit r2391.
This commit is contained in:
janwas 2005-06-16 21:46:33 +00:00
parent e43892634b
commit 40b26227d7
4 changed files with 38 additions and 35 deletions

View File

@ -26,6 +26,7 @@
#include "posix.h"
#include "detect.h"
#include "timer.h"
#include "sdl.h"
#ifdef _M_IX86
extern void ia32_get_cpu_info();
@ -82,6 +83,8 @@ void get_mem_status()
char gfx_card[GFX_CARD_LEN] = "";
char gfx_drv_ver[GFX_DRV_VER_LEN] = "";
int gfx_mem = -1; // [MiB]; approximate
// attempt to detect graphics card without OpenGL (in case ogl init fails,
// or we want more detailed info). gfx_card[] is unchanged on failure.
@ -89,6 +92,10 @@ void get_gfx_info()
{
int ret = -1;
gfx_mem = (SDL_GetVideoInfo()->video_mem) / 1048576; // [MiB]
// TODO: add sizeof(FB)?
// try platform-specific versions first: they return more
// detailed information, and don't require OpenGL to be ready.

View File

@ -147,6 +147,7 @@ STMT(\
// useful because VC6 may return 0 on failure, instead of throwing.
// this wraps the exception handling, and creates a NULL pointer on failure.
#define SAFE_NEW(type, ptr)\
@ -164,51 +165,44 @@ STMT(\
enum LibError
{
//
// lib + res
//
// function arguments
ERR_INVALID_PARAM = -1000,
ERR_INVALID_HANDLE = -1001,
ERR_NO_MEM = -1002,
ERR_BUF_SIZE = -1002,
// try again later
ERR_AGAIN = -1003,
// fixed limit exceeded
ERR_LIMIT = -1004,
// system doesn't support required API(s)
ERR_NO_SYS = -1005,
// feature not currently implemented (will probably change)
ERR_NOT_IMPLEMENTED = -1006,
// feature won't be supported
ERR_NOT_SUPPORTED = -1007,
// system limitations
// .. out of memory
ERR_NO_MEM = -1020,
// .. try again later
ERR_AGAIN = -1021,
// .. fixed limit exceeded
ERR_LIMIT = -1022,
// .. the OS doesn't provide an API we need
ERR_NO_SYS = -1023,
// .. feature not currently implemented (will probably change)
ERR_NOT_IMPLEMENTED = -1024,
// .. feature won't be supported
ERR_NOT_SUPPORTED = -1025,
// file contents are damaged
ERR_CORRUPTED = -1008,
ERR_CORRUPTED = -1040,
ERR_UNKNOWN_FORMAT = -1009,
ERR_UNKNOWN_FORMAT = -1050,
ERR_TIMED_OUT = -1010,
ERR_TIMED_OUT = -1060,
//
// file + vfs
//
ERR_FILE_NOT_FOUND = -1100,
ERR_PATH_NOT_FOUND = -1101,
ERR_DIR_END = -1102,
ERR_EOF = -1103,
ERR_PATH_LENGTH = -1104,
ERR_NOT_FILE = -1105,
ERR_FILE_ACCESS = -1106,
ERR_IO = -1107,
ERR_FILE_NOT_FOUND = -1200,
ERR_PATH_NOT_FOUND = -1201,
ERR_DIR_END = -1202,
ERR_EOF = -1203,
ERR_PATH_LENGTH = -1204,
ERR_NOT_FILE = -1205,
ERR_FILE_ACCESS = -1206,
ERR_IO = -1207,
ERR_TEX_FMT_INVALID = -1200,
ERR_TEX_FMT_INVALID = -1300,
ERR_LAST

View File

@ -16,6 +16,8 @@ extern char gfx_card[GFX_CARD_LEN]; // default: ""
const size_t GFX_DRV_VER_LEN = 64;
extern char gfx_drv_ver[GFX_DRV_VER_LEN]; // default: ""
extern int gfx_mem; // [MiB]; approximate
// attempt to detect graphics card without OpenGL (in case ogl init fails,
// or we want more detailed info). gfx_card[] is unchanged on failure.
extern void get_gfx_info(void);

View File

@ -31,7 +31,7 @@ class Singleton
public:
Singleton()
{
assert2( !ms_singleton );
assert( !ms_singleton );
//use a cunning trick to get the singleton pointing to the start of
//the whole, rather than the start of the Singleton part of the object