From 77b7f861f34250de68668f03f9e986e8d3731bc5 Mon Sep 17 00:00:00 2001 From: Rangi42 Date: Thu, 20 Jun 2024 18:15:07 -0400 Subject: [PATCH] Make review changes --- BootROMs/cgb_boot.asm | 2 +- BootROMs/dmg_boot.asm | 4 ++-- BootROMs/sameboot.inc | 8 ++++---- Makefile | 42 +++++++++++++++++++++++------------------- 4 files changed, 30 insertions(+), 26 deletions(-) diff --git a/BootROMs/cgb_boot.asm b/BootROMs/cgb_boot.asm index b04aebfb2..8fc2ca459 100644 --- a/BootROMs/cgb_boot.asm +++ b/BootROMs/cgb_boot.asm @@ -896,7 +896,7 @@ ENDC ld e, c ld l, $0D - ld a, [CgbFlag] + ld a, [CGBFlag] bit 7, a call z, EmulateDMG bit 7, a diff --git a/BootROMs/dmg_boot.asm b/BootROMs/dmg_boot.asm index c0c64c59d..7013033a5 100644 --- a/BootROMs/dmg_boot.asm +++ b/BootROMs/dmg_boot.asm @@ -120,9 +120,9 @@ Start: ; Set registers to match the original DMG boot IF DEF(MGB) - ld hl, (BOOTUP_A_MGB << 8) | $B0 + lb hl, BOOTUP_A_MGB, %10110000 ELSE - ld hl, (BOOTUP_A_DMG << 8) | $B0 + lb hl, BOOTUP_A_DMG, %10110000 ENDC push hl pop af diff --git a/BootROMs/sameboot.inc b/BootROMs/sameboot.inc index 608ddc808..b7eecc734 100644 --- a/BootROMs/sameboot.inc +++ b/BootROMs/sameboot.inc @@ -25,12 +25,12 @@ ENDM header_section NintendoLogoEnd, $0134 header_section Title, $0134 header_section ManufacturerCode, $013F - header_section CgbFlag, $0143 + header_section CGBFlag, $0143 header_section NewLicenseeCode, $0144 - header_section SgbFlag, $0146 + header_section SGBFlag, $0146 header_section CartridgeType, $0147 - header_section RomSize, $0148 - header_section RamSize, $0149 + header_section ROMSize, $0148 + header_section RAMSize, $0149 header_section DestinationCode, $014A header_section OldLicenseeCode, $014B header_section MaskRomVersion, $014C diff --git a/Makefile b/Makefile index 3092b7f3e..89454a4fb 100644 --- a/Makefile +++ b/Makefile @@ -151,6 +151,10 @@ RGBASM := $(RGBDS)rgbasm RGBLINK := $(RGBDS)rgblink RGBGFX := $(RGBDS)rgbgfx +# RGBASM 0.7+ deprecate and remove `-h` +RGBASM_FLAGS = $(if $(filter $(shell echo 'println __RGBDS_MAJOR__ || (!__RGBDS_MAJOR__ && __RGBDS_MINOR__ > 6)' | $(RGBASM) -), $$0), -h,) --include $(OBJ)/BootROMs/ --include BootROMs/ +# RGBGFX 0.6+ replace `-h` with `-Z`, and need `-c embedded` +RGBGFX_FLAGS = $(if $(filter $(shell echo 'println __RGBDS_MAJOR__ || (!__RGBDS_MAJOR__ && __RGBDS_MINOR__ > 5)' | $(RGBASM) -), $$0), -h -u, -Z -u -c embedded) # Set compilation and linkage flags based on target, platform and configuration @@ -387,7 +391,7 @@ endif $(OBJ)/SDL/%.dep: SDL/% -@$(MKDIR) -p $(dir $@) $(CC) $(CFLAGS) $(SDL_CFLAGS) $(GL_CFLAGS) -MT $(OBJ)/$^.o -M $^ -c -o $@ - + $(OBJ)/OpenDialog/%.dep: OpenDialog/% -@$(MKDIR) -p $(dir $@) $(CC) $(CFLAGS) $(SDL_CFLAGS) $(GL_CFLAGS) -MT $(OBJ)/$^.o -M $^ -c -o $@ @@ -414,16 +418,16 @@ $(OBJ)/OpenDialog/%.c.o: OpenDialog/%.c $(OBJ)/%.c.o: %.c -@$(MKDIR) -p $(dir $@) $(CC) $(CFLAGS) $(FRONTEND_CFLAGS) $(FAT_FLAGS) -c $< -o $@ - + # HexFiend requires more flags $(OBJ)/HexFiend/%.m.o: HexFiend/%.m -@$(MKDIR) -p $(dir $@) $(CC) $(CFLAGS) $(FRONTEND_CFLAGS) $(FAT_FLAGS) $(OCFLAGS) -c $< -o $@ -fno-objc-arc -include HexFiend/HexFiend_2_Framework_Prefix.pch - + $(OBJ)/%.m.o: %.m -@$(MKDIR) -p $(dir $@) $(CC) $(CFLAGS) $(FRONTEND_CFLAGS) $(FAT_FLAGS) $(OCFLAGS) -c $< -o $@ - + # iOS Port $(BIN)/SameBoy-iOS.app: $(BIN)/SameBoy-iOS.app/SameBoy \ @@ -495,7 +499,7 @@ endif $(BIN)/SameBoy.app/Contents/Resources/%.nib: Cocoa/%.xib ibtool --target-device mac --minimum-deployment-target 10.9 --compile $@ $^ 2>&1 | cat - - + $(BIN)/SameBoy-iOS.app/%.storyboardc: iOS/%.storyboard ibtool --target-device iphone --target-device ipad --minimum-deployment-target $(IOS_MIN) --compile $@ $^ 2>&1 | cat - @@ -526,7 +530,7 @@ endif $(BIN)/SameBoy.qlgenerator/Contents/Resources/cgb_boot_fast.bin: $(BIN)/BootROMs/cgb_boot_fast.bin -@$(MKDIR) -p $(dir $@) cp -f $^ $@ - + # SDL Port # Unix versions build only one binary @@ -611,7 +615,7 @@ $(BIN)/SDL/background.bmp: SDL/background.bmp $(BIN)/SDL/Shaders: Shaders -@$(MKDIR) -p $@ cp -rf Shaders/*.fsh $@ - + $(BIN)/SDL/Palettes: Misc/Palettes -@$(MKDIR) -p $@ cp -rf Misc/Palettes/*.sbp $@ @@ -620,12 +624,12 @@ $(BIN)/SDL/Palettes: Misc/Palettes $(OBJ)/%.2bpp: %.png -@$(MKDIR) -p $(dir $@) - $(RGBGFX) $(if $(filter $(shell echo 'println __RGBDS_MAJOR__ || (!__RGBDS_MAJOR__ && __RGBDS_MINOR__ > 5)' | $(RGBASM) -), $$0), -h -u, -Z -u -c embedded) -o $@ $< + $(RGBGFX) $(RGBGFX_FLAGS) -o $@ $< $(OBJ)/BootROMs/SameBoyLogo.pb12: $(OBJ)/BootROMs/SameBoyLogo.2bpp $(PB12_COMPRESS) -@$(MKDIR) -p $(dir $@) "$(realpath $(PB12_COMPRESS))" < $< > $@ - + $(PB12_COMPRESS): BootROMs/pb12.c -@$(MKDIR) -p $(dir $@) $(NATIVE_CC) -std=c99 -Wall -Werror $< -o $@ @@ -637,7 +641,7 @@ $(BIN)/BootROMs/sgb2_boot.bin: BootROMs/sgb_boot.asm $(BIN)/BootROMs/%.bin: BootROMs/%.asm $(OBJ)/BootROMs/SameBoyLogo.pb12 -@$(MKDIR) -p $(dir $@) - $(RGBASM) $(if $(filter $(shell echo 'println __RGBDS_MAJOR__ || (!__RGBDS_MAJOR__ && __RGBDS_MINOR__ > 6)' | $(RGBASM) -), $$0), -h,) --include $(OBJ)/BootROMs/ --include BootROMs/ -o $@.tmp $< + $(RGBASM) $(RGBASM_FLAGS) -o $@.tmp $< $(RGBLINK) -x -o $@ $@.tmp @rm $@.tmp @@ -690,7 +694,7 @@ endif ios: @$(MAKE) _ios - + $(BIN)/SameBoy-iOS.ipa: ios iOS/sideload.entitlements $(MKDIR) -p $(OBJ)/Payload cp -rf $(BIN)/SameBoy-iOS.app $(OBJ)/Payload/SameBoy-iOS.app @@ -698,11 +702,11 @@ $(BIN)/SameBoy-iOS.ipa: ios iOS/sideload.entitlements (cd $(OBJ) && zip -q $(abspath $@) -r Payload) rm -rf $(OBJ)/Payload - + $(BIN)/SameBoy-iOS.deb: $(OBJ)/debian-binary $(OBJ)/control.tar.gz $(OBJ)/data.tar.gz -@$(MKDIR) -p $(dir $@) (cd $(OBJ) && ar cr $(abspath $@) $(notdir $^)) - + $(OBJ)/data.tar.gz: ios iOS/jailbreak.entitlements iOS/installer.entitlements $(MKDIR) -p $(OBJ)/private/var/containers/ cp -rf $(BIN)/SameBoy-iOS.app $(OBJ)/private/var/containers/SameBoy-iOS.app @@ -711,7 +715,7 @@ $(OBJ)/data.tar.gz: ios iOS/jailbreak.entitlements iOS/installer.entitlements codesign -fs - --entitlements iOS/jailbreak.entitlements $(OBJ)/private/var/containers/SameBoy-iOS.app (cd $(OBJ) && tar -czf $(abspath $@) --format ustar --uid 501 --gid 501 --numeric-owner ./private) rm -rf $(OBJ)/private/ - + $(OBJ)/control.tar.gz: iOS/deb-postinst iOS/deb-prerm iOS/deb-control -@$(MKDIR) -p $(dir $@) sed "s/@VERSION/$(VERSION)/" < iOS/deb-control > $(OBJ)/control @@ -719,11 +723,11 @@ $(OBJ)/control.tar.gz: iOS/deb-postinst iOS/deb-prerm iOS/deb-control ln iOS/deb-prerm $(OBJ)/prerm (cd $(OBJ) && tar -czf $(abspath $@) --format ustar --uid 501 --gid 501 --numeric-owner ./control ./postinst ./prerm) rm $(OBJ)/control $(OBJ)/postinst $(OBJ)/prerm - + $(OBJ)/debian-binary: -@$(MKDIR) -p $(dir $@) echo 2.0 > $@ - + $(LIBDIR)/libsameboy.o: $(CORE_OBJECTS) -@$(MKDIR) -p $(dir $@) @# This is a somewhat simple hack to force Clang and GCC to build a native object file out of one or many LTO objects @@ -731,12 +735,12 @@ $(LIBDIR)/libsameboy.o: $(CORE_OBJECTS) @# And this is a somewhat complicated hack to invoke the correct LTO-enabled LD command in a mostly cross-platform nature $(CC) $(FAT_FLAGS) $(CFLAGS) $(LIBFLAGS) $^ $(OBJ)/lto_hack.o -o $@ -@rm $(OBJ)/lto_hack.o - + $(LIBDIR)/libsameboy.a: $(LIBDIR)/libsameboy.o -@$(MKDIR) -p $(dir $@) -@rm -f $@ ar -crs $@ $^ - + $(INC)/%.h: Core/%.h -@$(MKDIR) -p $(dir $@) -@# CPPP doesn't like multibyte characters, so we replace the single quote character before processing so it doesn't complain @@ -745,7 +749,7 @@ $(INC)/%.h: Core/%.h lib-unsupported: @echo Due to limitations of lld-link, compiling SameBoy as a library on Windows is not supported. @false - + # Clean clean: rm -rf build