diff --git a/Makefile b/Makefile index f22e6fc28..326d81421 100644 --- a/Makefile +++ b/Makefile @@ -49,7 +49,7 @@ OBJ_DIR := build/emerald LIBPATH := -L ../../tools/agbcc/lib else CC1 := $(shell $(PREFIX)gcc --print-prog-name=cc1) -override CFLAGS += -mthumb -mthumb-interwork -O2 -mabi=apcs-gnu -mtune=arm7tdmi -march=armv4t -quiet -fno-toplevel-reorder -Wno-aggressive-loop-optimizations -Wno-pointer-to-int-cast +override CFLAGS += -mthumb -mthumb-interwork -O2 -mabi=apcs-gnu -mtune=arm7tdmi -march=armv4t -quiet -fno-toplevel-reorder -fno-aggressive-loop-optimizations -Wno-pointer-to-int-cast ROM := pokeemerald_modern.gba OBJ_DIR := build/modern LIBPATH := -L $(DEVKITARM)/lib/gcc/arm-none-eabi/*/thumb -L $(DEVKITARM)/arm-none-eabi/lib/thumb @@ -233,7 +233,7 @@ $(OBJ_DIR)/ld_script.ld: $(LD_SCRIPT) $(LD_SCRIPT_DEPS) $(ELF): $(OBJ_DIR)/ld_script.ld $(OBJS) cd $(OBJ_DIR) && $(LD) $(LDFLAGS) -T ld_script.ld -o ../../$@ $(OBJS_REL) $(LIB) - $(FIX) $@ -p -t"$(TITLE)" -c$(GAME_CODE) -m$(MAKER_CODE) -r$(REVISION) --silent + $(FIX) $@ -t"$(TITLE)" -c$(GAME_CODE) -m$(MAKER_CODE) -r$(REVISION) --silent $(ROM): $(ELF) $(OBJCOPY) -O binary --gap-fill 0xFF --pad-to 0x9000000 $< $@ diff --git a/src/dma3_manager.c b/src/dma3_manager.c index f11bf33dd..43744883f 100644 --- a/src/dma3_manager.c +++ b/src/dma3_manager.c @@ -17,7 +17,7 @@ BSS_DATA struct u32 value; } gDma3Requests[MAX_DMA_REQUESTS]; -static bool8 gDma3ManagerLocked; +static volatile bool8 gDma3ManagerLocked; static u8 gDma3RequestCursor; void ClearDma3Requests(void) diff --git a/tools/gbafix/gbafix.c b/tools/gbafix/gbafix.c index b4ad15a88..179305b1b 100644 --- a/tools/gbafix/gbafix.c +++ b/tools/gbafix/gbafix.c @@ -138,6 +138,7 @@ int main(int argc, char *argv[]) char *argfile = 0; FILE *infile; int silent = 0; + int schedule_pad = 0; int size,bit; @@ -172,28 +173,27 @@ int main(int argc, char *argv[]) return -1; } + uint32_t sh_offset = 0; + // read file infile = fopen(argfile, "r+b"); if (!infile) { fprintf(stderr, "Error opening input file!\n"); return -1; } - fseek(infile, 0, SEEK_SET); + fseek(infile, sh_offset, SEEK_SET); fread(&header, sizeof(header), 1, infile); // elf check - uint32_t sh_offset = 0; + Elf32_Shdr secHeader; if (memcmp(&header, ELFMAG, 4) == 0) { Elf32_Ehdr *elfHeader = (Elf32_Ehdr *)&header; fseek(infile, elfHeader->e_shoff, SEEK_SET); int i; for (i = 0; i < elfHeader->e_shnum; i++) { - Elf32_Shdr secHeader; fread(&secHeader, sizeof(Elf32_Shdr), 1, infile); - if (secHeader.sh_type == SHT_PROGBITS && secHeader.sh_addr == elfHeader->e_entry) { - fseek(infile, secHeader.sh_offset, SEEK_SET); - sh_offset = secHeader.sh_offset; - break; - } + if (secHeader.sh_type == SHT_PROGBITS && secHeader.sh_addr == elfHeader->e_entry) break; } if (i == elfHeader->e_shnum) { fprintf(stderr, "Error finding entry point!\n"); return 1; } + fseek(infile, secHeader.sh_offset, SEEK_SET); + sh_offset = secHeader.sh_offset; fread(&header, sizeof(header), 1, infile); } @@ -211,15 +211,7 @@ int main(int argc, char *argv[]) { case 'p': // pad { - fseek(infile, 0, SEEK_END); - size = ftell(infile); - for (bit=31; bit>=0; bit--) if (size & (1<=0; bit--) if (size & (1<