Merge github.com:rednex/rgbds into overlay

This commit is contained in:
Sanqui
2017-02-28 18:58:58 +01:00
67 changed files with 1488 additions and 2792 deletions

View File

@@ -30,6 +30,6 @@ extern struct sSymbol *pPCSymbol;
extern bool oDontExpandStrings;
#define MAXMACROARGS 256
#define MAXINCPATHS 16
#define MAXINCPATHS 128
#endif /* // ASM_H */

View File

@@ -2,7 +2,7 @@
#define RGBDS_ASM_CHARMAP_H
#define MAXCHARMAPS 512
#define CHARMAPLENGTH 8
#define CHARMAPLENGTH 16
struct Charmap {
int count;

View File

@@ -59,9 +59,7 @@ extern void yyunputbytes(ULONG count);
extern YY_BUFFER_STATE pCurrentBuffer;
#ifdef __GNUC__
extern void strupr(char *s);
extern void strlwr(char *s);
#endif
extern void upperstring(char *s);
extern void lowerstring(char *s);
#endif

View File

@@ -2,6 +2,7 @@
#define RGBDS_MAIN_H
#include <stdbool.h>
#include "extern/stdnoreturn.h"
struct sOptions {
char gbgfx[4];
@@ -9,6 +10,7 @@ struct sOptions {
SLONG fillchar;
bool verbose;
bool haltnop;
bool exportall;
//-1 == random
};
@@ -23,7 +25,7 @@ extern void opt_Push(void);
extern void opt_Pop(void);
extern void opt_Parse(char *s);
void fatalerror(const char *fmt, ...);
noreturn void fatalerror(const char *fmt, ...);
void yyerror(const char *fmt, ...);
#define YY_FATAL_ERROR fatalerror

View File

@@ -36,6 +36,7 @@ struct sSymbol {
* not be changed during linking */
ULONG calchash(char *s);
void sym_SetExportAll(BBOOL set);
void sym_PrepPass1(void);
void sym_PrepPass2(void);
void sym_AddLocalReloc(char *tzSym);

30
include/gfx/gb.h Normal file
View File

@@ -0,0 +1,30 @@
/*
* Copyright © 2013 stag019 <stag019@gmail.com>
*
* Permission to use, copy, modify, and distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
* copyright notice and this permission notice appear in all copies.
*
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
* WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
* ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
#ifndef RGBDS_GFX_GB_H
#define RGBDS_GFX_GB_H
#include <stdint.h>
#include "gfx/main.h"
void png_to_gb(struct PNGImage png, struct GBImage *gb);
void output_file(struct Options opts, struct GBImage gb);
int get_tile_index(uint8_t *tile, uint8_t **tiles, int num_tiles, int tile_size);
void create_tilemap(struct Options opts, struct GBImage *gb, struct Tilemap *tilemap);
void output_tilemap_file(struct Options opts, struct Tilemap tilemap);
void output_palette_file(struct Options opts, struct PNGImage png);
#endif

75
include/gfx/main.h Normal file
View File

@@ -0,0 +1,75 @@
/*
* Copyright © 2013 stag019 <stag019@gmail.com>
*
* Permission to use, copy, modify, and distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
* copyright notice and this permission notice appear in all copies.
*
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
* WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
* ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
#ifndef RGBDS_GFX_MAIN_H
#define RGBDS_GFX_MAIN_H
#include <png.h>
#include <stdbool.h>
#include <stdint.h>
#include "extern/err.h"
struct Options {
bool debug;
bool verbose;
bool hardfix;
bool fix;
bool horizontal;
bool unique;
int trim;
char *mapfile;
bool mapout;
char *palfile;
bool palout;
char *outfile;
char *infile;
};
struct PNGImage {
png_struct *png;
png_info *info;
png_byte **data;
int width;
int height;
png_byte depth;
png_byte type;
bool horizontal;
int trim;
char *mapfile;
bool mapout;
char *palfile;
bool palout;
};
struct GBImage {
uint8_t *data;
int size;
bool horizontal;
int trim;
};
struct Tilemap {
uint8_t *data;
int size;
};
int depth, colors;
#include "gfx/makepng.h"
#include "gfx/gb.h"
#endif

28
include/gfx/makepng.h Normal file
View File

@@ -0,0 +1,28 @@
/*
* Copyright © 2013 stag019 <stag019@gmail.com>
*
* Permission to use, copy, modify, and distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
* copyright notice and this permission notice appear in all copies.
*
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
* WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
* ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
#ifndef RGBDS_GFX_PNG_H
#define RGBDS_GFX_PNG_H
#include "gfx/main.h"
void input_png_file(struct Options opts, struct PNGImage *img);
void get_text(struct PNGImage *png);
void set_text(struct PNGImage *png);
void output_png_file(struct Options opts, struct PNGImage *png);
void free_png_data(struct PNGImage *png);
#endif

View File

@@ -5,13 +5,26 @@
enum eBankDefine {
BANK_ROM0 = 0,
BANK_ROMX,
BANK_WRAM0 = 512,
BANK_WRAMX,
BANK_VRAM = 520,
BANK_HRAM = 522,
BANK_SRAM = 523
};
#define MAXBANKS 527
enum eBankCount {
BANK_COUNT_ROM0 = 1,
BANK_COUNT_ROMX = 511,
BANK_COUNT_WRAM0 = 1,
BANK_COUNT_WRAMX = 7,
BANK_COUNT_VRAM = 2,
BANK_COUNT_HRAM = 1,
BANK_COUNT_SRAM = 16
};
#define MAXBANKS (BANK_COUNT_ROM0 + BANK_COUNT_ROMX + BANK_COUNT_WRAM0 + BANK_COUNT_WRAMX \
+ BANK_COUNT_VRAM + BANK_COUNT_HRAM + BANK_COUNT_SRAM)
extern SLONG area_Avail(SLONG bank);
extern void AssignSections(void);