git.y1.nz

gbdk-2020

GameBoy Development Kit
download: https://git.y1.nz/archives/gbdk.tar.gz
README | Files | Log | Refs | LICENSE

commit d16df3484ad1a0fdb8edb1d7e4700e85ef1dad84
parent e3671c05a71d72a62f96c64fe98b9c44b79bed54
Author: Zal0 <cebolleto@gmail.com>
Date:   Fri, 29 Jan 2021 10:10:42 +0100

stripping exe and fixed a few warnings

Diffstat:
M.gitignore1+
Mgbdk-support/png2mtspr/Makefile12++++++++----
Mgbdk-support/png2mtspr/png2mtspr.cpp20++++++++++----------
3 files changed, 19 insertions(+), 14 deletions(-)

diff --git a/.gitignore b/.gitignore @@ -63,6 +63,7 @@ link/Debug/ link/.vs/ far_fixer/Debug/ far_fixer/.vs/ +[Dd]ebug/ # Auto-generated make.bat (from Makefiles) make.bat diff --git a/gbdk-support/png2mtspr/Makefile b/gbdk-support/png2mtspr/Makefile @@ -2,28 +2,32 @@ # Variables to control Makefile operation CXX = g++ -CXXFLAGS = -Wall -g -LFLAGS = -g -static -std=c++11 +CXXFLAGS = -Os -Wall -g +LFLAGS = -g -static + +ifeq ($(OS),Windows_NT) + EXT = .exe +endif # **************************************************** # Targets needed to bring the executable up to date TARGET = png2mtspr + SRCS := picopng.cpp png2mtspr.cpp OBJS := $(SRCS:%.cpp=%.o) $(TARGET): $(OBJS) $(CXX) $(LFLAGS) -o $(TARGET) $(OBJS) + strip $@$(EXT) # The main.o target can be written more simply %.cpp.o: %.cpp - @echo compiling $< $(CXX) $(CXXFLAGS) -c $< -o $@ clean: - @echo cleaning $(TARGET) rm -f *.o rm -f *.exe rm -f TARGET diff --git a/gbdk-support/png2mtspr/png2mtspr.cpp b/gbdk-support/png2mtspr/png2mtspr.cpp @@ -110,7 +110,7 @@ bool FindTile(const Tile& t, unsigned char& idx, unsigned char& props) it = find(tiles.begin(), tiles.end(), t); if(it != tiles.end()) { - idx = it - tiles.begin(); + idx = (unsigned char)(it - tiles.begin()); props = 0; return true; } @@ -119,7 +119,7 @@ bool FindTile(const Tile& t, unsigned char& idx, unsigned char& props) it = find(tiles.begin(), tiles.end(), tile); if(it != tiles.end()) { - idx = it - tiles.begin(); + idx = (unsigned char)(it - tiles.begin()); props = 1 << 5; return true; } @@ -128,7 +128,7 @@ bool FindTile(const Tile& t, unsigned char& idx, unsigned char& props) it = find(tiles.begin(), tiles.end(), tile); if(it != tiles.end()) { - idx = it - tiles.begin(); + idx = (unsigned char)(it - tiles.begin()); props = (1 << 5) | (1 << 6); return true; } @@ -137,7 +137,7 @@ bool FindTile(const Tile& t, unsigned char& idx, unsigned char& props) it = find(tiles.begin(), tiles.end(), tile); if(it != tiles.end()) { - idx = it - tiles.begin(); + idx = (unsigned char)(it - tiles.begin()); props = 1 << 6; return true; } @@ -231,13 +231,13 @@ int main(int argc, char *argv[]) } } - int slash_pos = output_filename.rfind('/'); - if(slash_pos == -1) - slash_pos = output_filename.rfind('\\'); - int dot_pos = output_filename.rfind('.'); + size_t slash_pos = output_filename.find_last_of('/'); + if(slash_pos == -1u) + slash_pos = output_filename.find_last_of('\\'); + size_t dot_pos = output_filename.find_last_of('.'); - if(slash_pos == -1) slash_pos = 0; - if(dot_pos == -1) dot_pos = 0; + if(slash_pos == -1u) slash_pos = 0; + if(dot_pos == -1u) dot_pos = 0; string output_filename_h = output_filename.substr(0, dot_pos) + ".h"; string data_name = output_filename.substr(slash_pos + 1, dot_pos - 1 - slash_pos);

This webpage is intended to be an accessible preview of this repository. To get a fuller picture, clone it and use the git CLI.