Skip to content

Instantly share code, notes, and snippets.

@SBird1337
Last active April 21, 2022 15:45
Show Gist options
  • Save SBird1337/48e468e1c81d12e1e6f7e0443af343e2 to your computer and use it in GitHub Desktop.
Save SBird1337/48e468e1c81d12e1e6f7e0443af343e2 to your computer and use it in GitHub Desktop.
/*
mgba.h
Copyright (c) 2016 Jeffrey Pfau
Redistribution and use in source and binary forms, with or without modification,
are permitted provided that the following conditions are met:
1. Redistributions of source code must retain the above copyright notice,
this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation and/or
other materials provided with the distribution.
THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE
LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#ifndef MGBA_H
#define MGBA_H
#include "gba/types.h"
#ifdef __cplusplus
extern "C" {
#endif
#define MGBA_LOG_FATAL (0)
#define MGBA_LOG_ERROR (1)
#define MGBA_LOG_WARN (2)
#define MGBA_LOG_INFO (3)
#define MGBA_LOG_DEBUG (4)
#define MGBA_REG_DEBUG_MAX (256)
void MgbaPrintf(s32 level, const char* string, ...);
bool8 MgbaOpen(void);
void MgbaClose(void);
void MgbaAssert(const char *pFile, s32 nLine, const char *pExpression, bool32 nStopProgram);
void MgbaPrintEncoded(s32 level, const char *encodedString);
#define MGBA_ASSERT(exp) (exp) ? ((void*)0) : MgbaAssert(__FILE__, __LINE__, #exp, 1);
#define MGBA_WARNING(exp) (exp) ? ((void*)0) : MgbaAssert(__FILE__, __LINE__, #exp, 0);
#ifdef __cplusplus
}
#endif
#endif
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment