Search
lxdream.org :: lxdream/src/lxdream.h
lxdream 0.9.1
released Jun 29
Download Now
filename src/lxdream.h
changeset 1159:580436b01b6c
prev1109:700c5ab26a63
next1292:799fdd4f704a
author nkeynes
date Fri Mar 02 23:49:10 2012 +1000 (8 years ago)
permissions -rw-r--r--
last change Android WIP:
* Rename gui_jni.c to gui_android.c - now quite android specific.
* Implement generic EGL driver with very minimal Java wrapper
* Run emulation in separate thread, and implement simple queue for
inter-thread communication.
* Add menu/action-bar items for start + reset
view annotate diff log raw
     1 /**
     2  * $Id$
     3  *
     4  * Common type definitions and forward declarations
     5  *
     6  * Copyright (c) 2005 Nathan Keynes.
     7  *
     8  * This program is free software; you can redistribute it and/or modify
     9  * it under the terms of the GNU General Public License as published by
    10  * the Free Software Foundation; either version 2 of the License, or
    11  * (at your option) any later version.
    12  *
    13  * This program is distributed in the hope that it will be useful,
    14  * but WITHOUT ANY WARRANTY; without even the implied warranty of
    15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    16  * GNU General Public License for more details.
    17  */
    19 #ifndef lxdream_lxdream_H
    20 #define lxdream_lxdream_H 1
    22 #include <stdint.h>
    23 #include <glib/gtypes.h>
    25 #include "../config.h"
    27 #ifdef __cplusplus
    28 extern "C" {
    29 #endif
    31 #define APP_NAME PACKAGE
    32 extern const char lxdream_package_name[];
    33 extern const char lxdream_short_version[];
    34 extern const char lxdream_full_version[];
    35 extern const char lxdream_copyright[];
    38 #define MB *1024*1024
    39 #define KB *1024
    41 #ifndef max
    42 #define max(a,b) ( (a) > (b) ? (a) : (b) )
    43 #endif
    45 /**
    46  * A 29-bit address in SH4 external address space
    47  */
    48 typedef uint32_t sh4addr_t;
    50 /**
    51  * A 32-bit address in SH4 virtual address space.
    52  */
    53 typedef uint32_t sh4vma_t;
    55 /**
    56  * A direct pointer into SH4 memory
    57  */
    58 typedef unsigned char *sh4ptr_t;
    60 /******************* Forward type declarations ******************/
    62 typedef struct render_buffer *render_buffer_t;
    63 typedef struct frame_buffer *frame_buffer_t;
    64 typedef struct vertex_buffer *vertex_buffer_t;
    66 /*************************** Logging ****************************/
    68 #define EMIT_FATAL 0
    69 #define EMIT_ERR 1
    70 #define EMIT_WARN 2
    71 #define EMIT_INFO 3
    72 #define EMIT_DEBUG 4
    73 #define EMIT_TRACE 5
    75 #ifdef MODULE
    76 #define MODULE_NAME MODULE.name
    77 #else
    78 #define MODULE_NAME "*****"
    79 #endif
    81 gboolean set_global_log_level( const gchar *level );
    82 void log_message( void *, int level, const char *source, const char *msg, ... );
    84 #define FATAL( ... ) log_message( NULL, EMIT_FATAL, MODULE_NAME, __VA_ARGS__ )
    85 #define ERROR( ... ) log_message( NULL, EMIT_ERR, MODULE_NAME, __VA_ARGS__ )
    86 #define WARN( ... ) log_message( NULL, EMIT_WARN, MODULE_NAME, __VA_ARGS__ )
    87 #define INFO( ... ) log_message( NULL, EMIT_INFO, MODULE_NAME, __VA_ARGS__ )
    88 #define DEBUG( ... ) log_message( NULL, EMIT_DEBUG, MODULE_NAME, __VA_ARGS__ )
    89 #define TRACE( ... ) log_message( NULL, EMIT_TRACE, MODULE_NAME, __VA_ARGS__ )
    91 /* Error reporting */
    92 #define MAX_ERROR_MSG_SIZE 512
    93 typedef struct error_struct {
    94     unsigned int code;
    95     char msg[MAX_ERROR_MSG_SIZE];
    96 } ERROR;
    98 #define LX_ERR_NONE          0
    99 #define LX_ERR_NOMEM         1  /* Out-of-memory */
   100 #define LX_ERR_CONFIG        2  /* Configuration problem */
   101 #define LX_ERR_UNHANDLED     3  /* A lower-level error occurred which we don't understand */
   102 #define LX_ERR_BUG           4
   103 #define LX_ERR_FILE_NOOPEN   9  /* File could not be opened (ENOENT or EACCESS usually) */
   104 #define LX_ERR_FILE_IOERROR 10  /* I/O error encountered in file */
   105 #define LX_ERR_FILE_INVALID 11  /* File contents are invalid for its type */
   106 #define LX_ERR_FILE_UNKNOWN 12  /* File type is unrecognized */
   107 #define LX_ERR_FILE_UNSUP   13  /* File type is unsupported */
   109 #define SET_ERROR(err, n, ...) if( (err) != NULL ) { (err)->code = n; snprintf( (err)->msg, sizeof((err)->msg), __VA_ARGS__ ); }
   110 #define CLEAR_ERROR(err) do { (err)->code = 0; (err)->msg[0] = 0; } while(0)
   113 #ifdef HAVE_FASTCALL
   114 #define FASTCALL __attribute__((regparm(2)))
   115 #else
   116 #define FASTCALL
   117 #endif
   119 #ifdef __cplusplus
   120 }
   121 #endif
   123 #endif /* !lxdream_lxdream_H */
.