mirror of
https://github.com/pret/pmd-red.git
synced 2026-09-09 01:25:58 -05:00
modern working
This commit is contained in:
@@ -400,7 +400,7 @@ extern const struct ToneData voicegroup_pokemon_cry;
|
||||
extern char gNumMusicPlayers[];
|
||||
extern char gMaxLines[];
|
||||
|
||||
#define NUM_MUSIC_PLAYERS ((u16)gNumMusicPlayers)
|
||||
#define NUM_MUSIC_PLAYERS ((u16)((u32)gNumMusicPlayers))
|
||||
#define MAX_LINES ((u32)gMaxLines)
|
||||
|
||||
u32 umul3232H32(u32 multiplier, u32 multiplicand);
|
||||
|
||||
@@ -5,6 +5,7 @@
|
||||
#include <stdio.h>
|
||||
#include <stddef.h>
|
||||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
#include "config.h" // We need to define config before gba headers as print stuff needs the functions nulled before defines.
|
||||
#include "gba/gba.h"
|
||||
|
||||
@@ -54,6 +55,17 @@ static inline bool8 AreStringsDifferent(const u8 *str1, const u8 *str2)
|
||||
return strcmp(str1, str2) != 0;
|
||||
}
|
||||
|
||||
#ifdef MODERN
|
||||
#define BUGFIX
|
||||
#define NONMATCHING
|
||||
|
||||
#include "mini_printf.h"
|
||||
void sprintfStatic(char *buffer, const char *text, ...);
|
||||
// Use miniprintf instead of library printf functions
|
||||
#define sprintf sprintfStatic
|
||||
#define vsprintf mini_vsprintf
|
||||
#endif // MODERN
|
||||
|
||||
// Sometimes incrementing and decrementing a variable changes how registers are allocated, which helps with matching functions. Functionality-wise this doesn't do anything.
|
||||
#ifdef NONMATCHING
|
||||
#define ASM_MATCH_TRICK(a) {;}
|
||||
|
||||
42
include/mini_printf.h
Normal file
42
include/mini_printf.h
Normal file
@@ -0,0 +1,42 @@
|
||||
/*
|
||||
* The Minimal snprintf() implementation
|
||||
*
|
||||
* Copyright (c) 2013 Michal Ludvig <michal@logix.cz>
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
* * Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* * 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.
|
||||
* * Neither the name of the auhor nor the names of its contributors
|
||||
* may be used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "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.
|
||||
*/
|
||||
|
||||
/*
|
||||
* Courtey of https://github.com/mludvig/mini-printf
|
||||
* stripped to reduce file size for agb needs
|
||||
*/
|
||||
|
||||
#ifndef __MINI_PRINTF__
|
||||
#define __MINI_PRINTF__
|
||||
|
||||
s32 mini_vsprintf(char *buffer, const char *fmt, va_list va);
|
||||
s32 mini_vsnprintf(char *buffer, u32 buffer_len, const char *fmt, va_list va);
|
||||
s32 mini_vpprintf(void *buf, const char *fmt, va_list va);
|
||||
|
||||
#endif
|
||||
Reference in New Issue
Block a user