Build fixes as well as precompiled MXE fixes

This commit is contained in:
Colton Rushton 2021-02-14 09:21:45 -04:00
parent fdaad3056b
commit 69260df4ad
5 changed files with 54 additions and 34 deletions

View File

@ -102,12 +102,22 @@ ifeq ($(WINDOWS_BUILD),1)
TARGET_ARCH = i386pe
TARGET_BITS = 32
NO_BZERO_BCOPY := 1
NO_PIE := 0
NO_PIE = 0
else ifeq ($(CROSS),x86_64-w64-mingw32.static-)
TARGET_ARCH = i386pep
TARGET_BITS = 64
NO_BZERO_BCOPY := 1
NO_PIE := 0
NO_PIE = 0
else ifeq ($(CROSS),mxe-i686-w64-mingw32.static-)
TARGET_ARCH = i386pe
TARGET_BITS = 32
NO_BZERO_BCOPY := 1
NO_PIE = 0
else ifeq ($(CROSS),mxe-x86_64-w64-mingw32.static-)
TARGET_ARCH = i386pep
TARGET_BITS = 64
NO_BZERO_BCOPY := 1
NO_PIE = 0
endif
endif
@ -300,34 +310,32 @@ ifeq ($(TARGET_WEB),1)
endif
ifeq ($(TARGET_RPI),1)
machine = $(shell sh -c 'uname -m 2>/dev/null || echo unknown')
machine = $(shell sh -c 'uname -m 2>/dev/null || echo unknown')
# Raspberry Pi B+, Zero, etc
ifneq (,$(findstring armv6l,$(machine)))
OPT_FLAGS := -march=armv6zk+fp -mfpu=vfp -Ofast
endif
ifneq (,$(findstring armv6l,$(machine)))
OPT_FLAGS := -march=armv6zk+fp -mfpu=vfp -Ofast
endif
# Raspberry Pi 2 and 3 in ARM 32bit mode
ifneq (,$(findstring armv7l,$(machine)))
model = $(shell sh -c 'cat /sys/firmware/devicetree/base/model 2>/dev/null || echo unknown')
ifneq (,$(findstring 3,$(model)))
OPT_FLAGS := -march=armv8-a+crc -mtune=cortex-a53 -mfpu=neon-fp-armv8 -O3
else
OPT_FLAGS := -march=armv7-a -mtune=cortex-a7 -mfpu=neon-vfpv4 -O3
endif
endif
ifneq (,$(findstring armv7l,$(machine)))
model = $(shell sh -c 'cat /sys/firmware/devicetree/base/model 2>/dev/null || echo unknown')
ifneq (,$(findstring 3,$(model)))
OPT_FLAGS := -march=armv8-a+crc -mtune=cortex-a53 -mfpu=neon-fp-armv8 -O3
else
OPT_FLAGS := -march=armv7-a -mtune=cortex-a7 -mfpu=neon-vfpv4 -O3
endif
endif
# RPi3 or RPi4, in ARM64 (aarch64) mode. NEEDS TESTING 32BIT.
# DO NOT pass -mfpu stuff here, thats for 32bit ARM only and will fail for 64bit ARM.
ifneq (,$(findstring aarch64,$(machine)))
model = $(shell sh -c 'cat /sys/firmware/devicetree/base/model 2>/dev/null || echo unknown')
ifneq (,$(findstring 3,$(model)))
OPT_FLAGS := -march=armv8-a+crc -mtune=cortex-a53 -O3
else ifneq (,$(findstring 4,$(model)))
OPT_FLAGS := -march=armv8-a+crc+simd -mtune=cortex-a72 -O3
endif
endif
ifneq (,$(findstring aarch64,$(machine)))
model = $(shell sh -c 'cat /sys/firmware/devicetree/base/model 2>/dev/null || echo unknown')
ifneq (,$(findstring 3,$(model)))
OPT_FLAGS := -march=armv8-a+crc -mtune=cortex-a53 -O3
else ifneq (,$(findstring 4,$(model)))
OPT_FLAGS := -march=armv8-a+crc+simd -mtune=cortex-a72 -O3
endif
endif
endif
# File dependencies and variables for specific files
@ -363,15 +371,15 @@ ULTRA_C_FILES := $(addprefix lib/src/,$(ULTRA_C_FILES))
ifeq ($(VERSION),sh)
SOUND_BANK_FILES := $(wildcard sound/sound_banks/*.json)
SOUND_SEQUENCE_FILES := $(wildcard sound/sequences/jp/*.m64) \
$(wildcard sound/sequences/*.m64) \
$(foreach file,$(wildcard sound/sequences/jp/*.s),$(BUILD_DIR)/$(file:.s=.m64)) \
$(foreach file,$(wildcard sound/sequences/*.s),$(BUILD_DIR)/$(file:.s=.m64))
$(wildcard sound/sequences/*.m64) \
$(foreach file,$(wildcard sound/sequences/jp/*.s),$(BUILD_DIR)/$(file:.s=.m64)) \
$(foreach file,$(wildcard sound/sequences/*.s),$(BUILD_DIR)/$(file:.s=.m64))
else
SOUND_BANK_FILES := $(wildcard sound/sound_banks/*.json)
SOUND_SEQUENCE_FILES := $(wildcard sound/sequences/$(VERSION)/*.m64) \
$(wildcard sound/sequences/*.m64) \
$(foreach file,$(wildcard sound/sequences/$(VERSION)/*.s),$(BUILD_DIR)/$(file:.s=.m64)) \
$(foreach file,$(wildcard sound/sequences/*.s),$(BUILD_DIR)/$(file:.s=.m64))
$(wildcard sound/sequences/*.m64) \
$(foreach file,$(wildcard sound/sequences/$(VERSION)/*.s),$(BUILD_DIR)/$(file:.s=.m64)) \
$(foreach file,$(wildcard sound/sequences/*.s),$(BUILD_DIR)/$(file:.s=.m64))
endif
SOUND_SAMPLE_DIRS := $(wildcard sound/samples/*)

View File

@ -2807,7 +2807,7 @@ void print_hud_course_complete_coins(s16 x, s16 y) {
gSPDisplayList(gDisplayListHead++, dl_rgba16_text_end);
if (gCourseCompleteCoins >= gHudDisplay.coins) {
if (gCourseCompleteCoins >= (u64)gHudDisplay.coins) {
gCourseCompleteCoinsEqual = 1;
gCourseCompleteCoins = gHudDisplay.coins;
@ -2828,14 +2828,18 @@ void print_hud_course_complete_coins(s16 x, s16 y) {
}
}
if (gHudDisplay.coins == gCourseCompleteCoins && gGotFileCoinHiScore != 0) {
if ((u64)gHudDisplay.coins == gCourseCompleteCoins && gGotFileCoinHiScore != 0) {
play_sound(SOUND_MENU_MARIO_CASTLE_WARP2, gDefaultSoundArgs);
}
}
}
void play_star_fanfare_and_flash_hud(s32 arg, u8 starNum) {
#ifndef QOL_FIXES
if (gHudDisplay.coins == gCourseCompleteCoins && (gCurrCourseStarFlags & starNum) == 0 && gHudFlash == 0) {
#else
if ((u64)gHudDisplay.coins == gCourseCompleteCoins && (gCurrCourseStarFlags & starNum) == 0 && gHudFlash == 0) {
#endif
play_star_fanfare();
gHudFlash = arg;
}

View File

@ -896,7 +896,7 @@ void update_hud_values(void) {
gHudDisplay.flags &= ~HUD_DISPLAY_FLAG_COIN_COUNT;
}
if (gHudDisplay.coins < gMarioState->numCoins) {
if ((u64)gHudDisplay.coins < gMarioState->numCoins) {
if (gGlobalTimer & 0x00000001) {
u32 coinSound;
if (gMarioState->action & (ACT_FLAG_SWIMMING | ACT_FLAG_METAL_WATER)) {
@ -1090,7 +1090,7 @@ s32 play_mode_change_area(void) {
// is never set to -1.
if (sTransitionUpdate == (void (*)(s16 *)) - 1) {
#else
if (sTransitionUpdate == -1) {
if (sTransitionTimer == -1) {
#endif
update_camera(gCurrentArea->camera);
} else if (sTransitionUpdate != NULL) {

View File

@ -243,7 +243,11 @@ s32 get_star_collection_dialog(struct MarioState *m) {
for (i = 0; i < 6; i++) {
numStarsRequired = sStarsNeededForDialog[i];
#ifndef QOL_FIXES
if (m->prevNumStarsForDialog < numStarsRequired && m->numStars >= numStarsRequired) {
#else
if ((u64)m->prevNumStarsForDialog < numStarsRequired && m->numStars >= numStarsRequired) {
#endif
dialogID = i + DIALOG_141;
break;
}

View File

@ -505,7 +505,11 @@ void save_file_collect_star_or_key(u64 coinScore, s16 starIndex) {
}
#endif
#ifndef QOL_FIXES
if (coinScore > save_file_get_course_coin_score(fileIndex, courseIndex)) {
#else
if (coinScore > (u64)save_file_get_course_coin_score(fileIndex, courseIndex)) {
#endif
gSaveBuffer.files[fileIndex][0].courseCoinScores[courseIndex] = coinScore;
touch_coin_score_age(fileIndex, courseIndex);