mirror of
https://github.com/pret/pokediamond.git
synced 2026-04-26 00:11:26 -05:00
Label symbols in arm7_rom.s; quiet mwasmarm_patcher; SHA1 checksums for arm7, arm9 binaries
This commit is contained in:
parent
a4d6c2b4f7
commit
3a1259dbe6
3
Makefile
3
Makefile
|
|
@ -92,7 +92,7 @@ TOOLS_DIR = tools
|
|||
SHA1SUM = sha1sum
|
||||
JSONPROC = $(TOOLS_DIR)/jsonproc/jsonproc
|
||||
GFX = $(TOOLS_DIR)/nitrogfx/nitrogfx
|
||||
MWASMARM_PATCHER = $(TOOLS_DIR)/mwasmarm_patcher/mwasmarm_patcher$(EXE)
|
||||
MWASMARM_PATCHER = $(TOOLS_DIR)/mwasmarm_patcher/mwasmarm_patcher$(EXE) -q
|
||||
|
||||
TOOLDIRS = $(filter-out $(TOOLS_DIR)/mwccarm,$(wildcard $(TOOLS_DIR)/*))
|
||||
TOOLBASE = $(TOOLDIRS:$(TOOLS_DIR)/%=%)
|
||||
|
|
@ -138,6 +138,7 @@ $(TOOLDIRS):
|
|||
@$(MAKE) -C $@
|
||||
|
||||
$(MWASMARM): patch_mwasmarm
|
||||
@:
|
||||
|
||||
patch_mwasmarm:
|
||||
$(MWASMARM_PATCHER) $(MWASMARM)
|
||||
|
|
|
|||
|
|
@ -89,7 +89,7 @@ LDFLAGS = -map -nodead -w off -proc v5te -interworking -map -symtab -m _start
|
|||
SHA1SUM = sha1sum
|
||||
JSONPROC = $(TOOLS_DIR)/jsonproc/jsonproc
|
||||
GFX = $(TOOLS_DIR)/nitrogfx/nitrogfx
|
||||
MWASMARM_PATCHER = $(TOOLS_DIR)/mwasmarm_patcher/mwasmarm_patcher$(EXE)
|
||||
MWASMARM_PATCHER = $(TOOLS_DIR)/mwasmarm_patcher/mwasmarm_patcher$(EXE) -q
|
||||
|
||||
TOOLDIRS = $(filter-out $(TOOLS_DIR)/mwccarm,$(wildcard $(TOOLS_DIR)/*))
|
||||
TOOLBASE = $(TOOLDIRS:$(TOOLS_DIR)/%=%)
|
||||
|
|
@ -112,7 +112,7 @@ endif
|
|||
MAKEFLAGS += --no-print-directory
|
||||
|
||||
all: $(ROM)
|
||||
# @$(SHA1SUM) -c $(TARGET).sha1
|
||||
@$(SHA1SUM) -c $(TARGET).sha1
|
||||
|
||||
clean: mostlyclean
|
||||
make -C $(TOOLS_DIR)/mwasmarm_patcher clean
|
||||
|
|
|
|||
|
|
@ -61,7 +61,7 @@ _023800a4:
|
|||
ldr r1, _23800f8
|
||||
ldr lr, _23800fc
|
||||
bx r1
|
||||
_23800cc: .word FUN_023801B0
|
||||
_23800cc: .word SDK_STATIC_BSS_START
|
||||
_23800d0: .word 0x0380ff00
|
||||
_23800d4: .word 0x0380ffc0
|
||||
_23800d8: .word 0x0380ff80
|
||||
|
|
@ -128,30 +128,33 @@ _0238018c:
|
|||
bx lr
|
||||
_2380194: .word 0x027ffffa
|
||||
_2380198:
|
||||
.word UNK_23A92F8
|
||||
.word UNK_23A931C
|
||||
.word FUN_023801B0
|
||||
.word FUN_023801B0
|
||||
.word FUN_023801B0
|
||||
.word 0x00000000
|
||||
.word SDK_AUTOLOAD_LIST
|
||||
.word SDK_AUTOLOAD_LIST_END
|
||||
.word SDK_AUTOLOAD_START
|
||||
.word SDK_STATIC_BSS_START
|
||||
.word SDK_STATIC_BSS_END
|
||||
arm_func_end FUN_238015C
|
||||
|
||||
arm_func_start FUN_023801B0
|
||||
FUN_023801B0:
|
||||
.balign 16, 0
|
||||
|
||||
SDK_STATIC_BSS_START:
|
||||
SDK_STATIC_BSS_END:
|
||||
|
||||
SDK_AUTOLOAD_START:
|
||||
.incbin "baserom.nds", 0x30D1B0, 0x91B0
|
||||
|
||||
thumb_func_start ROM7_SVC_SoftReset
|
||||
ROM7_SVC_SoftReset: ; 0x02389360
|
||||
thumb_func_start SVC_SoftReset
|
||||
SVC_SoftReset: ; 0x02389360
|
||||
swi 0
|
||||
bx lr
|
||||
|
||||
thumb_func_start ROM7_SVC_WaitByLoop
|
||||
ROM7_SVC_WaitByLoop: ; 0x02389364
|
||||
thumb_func_start SVC_WaitByLoop
|
||||
SVC_WaitByLoop: ; 0x02389364
|
||||
swi 3
|
||||
bx lr
|
||||
|
||||
thumb_func_start ROM7_SVC_WaitIntr
|
||||
ROM7_SVC_WaitIntr: ; 0x02389368
|
||||
thumb_func_start SVC_WaitIntr
|
||||
SVC_WaitIntr: ; 0x02389368
|
||||
ldr r2, =0x04000000
|
||||
mov ip, r2
|
||||
mov r2, #0x0
|
||||
|
|
@ -159,54 +162,64 @@ ROM7_SVC_WaitIntr: ; 0x02389368
|
|||
bx lr
|
||||
.pool
|
||||
|
||||
thumb_func_start ROM7_SVC_WaitVBlankIntr
|
||||
ROM7_SVC_WaitVBlankIntr:
|
||||
thumb_func_start SVC_WaitVBlankIntr
|
||||
SVC_WaitVBlankIntr:
|
||||
mov r2, #0x0
|
||||
swi 5
|
||||
bx lr
|
||||
|
||||
non_word_aligned_thumb_func_start ROM7_SVC_Halt
|
||||
ROM7_SVC_Halt:
|
||||
non_word_aligned_thumb_func_start SVC_Halt
|
||||
SVC_Halt:
|
||||
swi 6
|
||||
bx lr
|
||||
|
||||
non_word_aligned_thumb_func_start ROM7_SVC_Stop
|
||||
ROM7_SVC_Stop:
|
||||
non_word_aligned_thumb_func_start SVC_Stop
|
||||
SVC_Stop:
|
||||
swi 7
|
||||
bx lr
|
||||
|
||||
non_word_aligned_thumb_func_start ROM7_SVC_SoundBias
|
||||
ROM7_SVC_SoundBias:
|
||||
non_word_aligned_thumb_func_start SVC_SoundBias
|
||||
SVC_SoundBias:
|
||||
swi 8
|
||||
bx lr
|
||||
|
||||
non_word_aligned_thumb_func_start ROM7_SVC_SoundBiasSet
|
||||
ROM7_SVC_SoundBiasSet:
|
||||
non_word_aligned_thumb_func_start SVC_SoundBiasSet
|
||||
SVC_SoundBiasSet:
|
||||
add r1, r0, #0x0
|
||||
mov r0, #0x1
|
||||
swi 8
|
||||
bx lr
|
||||
|
||||
non_word_aligned_thumb_func_start ROM7_SVC_SoundBiasReset
|
||||
ROM7_SVC_SoundBiasReset:
|
||||
non_word_aligned_thumb_func_start SVC_SoundBiasReset
|
||||
SVC_SoundBiasReset:
|
||||
add r1, r0, #0x0
|
||||
mov r0, #0x0
|
||||
swi 8
|
||||
bx lr
|
||||
|
||||
non_word_aligned_thumb_func_start ROM7_SVC_Div
|
||||
ROM7_SVC_Div:
|
||||
non_word_aligned_thumb_func_start SVC_Div
|
||||
SVC_Div:
|
||||
swi 9
|
||||
bx lr
|
||||
|
||||
non_word_aligned_thumb_func_start ROM7_SVC_DivRem
|
||||
ROM7_SVC_DivRem:
|
||||
non_word_aligned_thumb_func_start SVC_DivRem
|
||||
SVC_DivRem:
|
||||
swi 9
|
||||
add r0, r1, #0x0
|
||||
bx lr
|
||||
.incbin "baserom.nds", 0x3163a4, 0x1ff54
|
||||
|
||||
UNK_23A92F8:
|
||||
.incbin "baserom.nds", 0x3362F8, 0x24
|
||||
SDK_AUTOLOAD_LIST:
|
||||
.word 0x027E0000
|
||||
.word 0x000000DC
|
||||
.word 0x00000000
|
||||
|
||||
UNK_23A931C:
|
||||
.word 0x037F8000
|
||||
.word 0x0000F70C
|
||||
.word 0x00004220
|
||||
|
||||
.word 0x06000000
|
||||
.word 0x00019960
|
||||
.word 0x00001590
|
||||
|
||||
SDK_AUTOLOAD_LIST_END:
|
||||
|
|
|
|||
|
|
@ -89,7 +89,7 @@ LDFLAGS = -map -nodead -w off -proc v5te -interworking -map -symtab -m _start
|
|||
SHA1SUM = sha1sum
|
||||
JSONPROC = $(TOOLS_DIR)/jsonproc/jsonproc
|
||||
GFX = $(TOOLS_DIR)/nitrogfx/nitrogfx
|
||||
MWASMARM_PATCHER = $(TOOLS_DIR)/mwasmarm_patcher/mwasmarm_patcher$(EXE)
|
||||
MWASMARM_PATCHER = $(TOOLS_DIR)/mwasmarm_patcher/mwasmarm_patcher$(EXE) -q
|
||||
|
||||
TOOLDIRS = $(filter-out $(TOOLS_DIR)/mwccarm,$(wildcard $(TOOLS_DIR)/*))
|
||||
TOOLBASE = $(TOOLDIRS:$(TOOLS_DIR)/%=%)
|
||||
|
|
@ -112,7 +112,7 @@ endif
|
|||
MAKEFLAGS += --no-print-directory
|
||||
|
||||
all: $(ROM)
|
||||
# @$(SHA1SUM) -c $(TARGET).sha1
|
||||
@$(SHA1SUM) -c $(TARGET).sha1
|
||||
|
||||
clean: mostlyclean
|
||||
make -C $(TOOLS_DIR)/mwasmarm_patcher clean
|
||||
|
|
|
|||
|
|
@ -262,9 +262,10 @@ _start_ModuleParams:
|
|||
.word SDK_STATIC_BSS_START
|
||||
.word SDK_STATIC_BSS_END
|
||||
|
||||
.word 0x00000000
|
||||
.ascii "1u" ; 31 75
|
||||
.byte 0x02, 0x03
|
||||
.balign 16, 0
|
||||
|
||||
; .version
|
||||
.word 0x03027531
|
||||
.word 0xdec00621
|
||||
.byte 0xde, 0xc0, 0x06, 0x21
|
||||
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@ CFLAGS := -O3
|
|||
.PHONY: all clean
|
||||
|
||||
all: mwasmarm_patcher
|
||||
@
|
||||
@:
|
||||
|
||||
clean: ; $(RM) mwasmarm_patcher$(EXE)
|
||||
|
||||
|
|
|
|||
|
|
@ -147,6 +147,7 @@ void sha1_process_block (const unsigned char * block, uint32_t * state) {
|
|||
// ax6 code end
|
||||
// ---------------------------------------------------------
|
||||
|
||||
__attribute__((format(printf, 1, 2)))
|
||||
void fatal_printf(char *str, ...) {
|
||||
va_list args;
|
||||
va_start(args, str);
|
||||
|
|
@ -167,16 +168,45 @@ int get_file_size (FILE * fp) {
|
|||
#define SHA_DIGEST_LENGTH 20
|
||||
|
||||
void print_help(void) {
|
||||
printf("mwasmarm patcher usage: input (example: mwasmarm_patcher mwasmarm.exe)\n");
|
||||
printf("Usage:\n"
|
||||
"\tmwasmarm_patcher [OPTIONS] FILENAME\n\n"
|
||||
"Arguments:\n"
|
||||
"\tFILENAME: path to MWASMARM.exe program\n\n"
|
||||
"OPTIONS:\n"
|
||||
"\t-q/--quietly: Suppress verbose output\n"
|
||||
"\t-h/--help: Print this message and exit\n");
|
||||
}
|
||||
|
||||
int main(int argc, char *argv[]) {
|
||||
if (argc != 2) {
|
||||
int quietly = 0;
|
||||
char* filename = NULL;
|
||||
for (int i = 1; i < argc; i++)
|
||||
{
|
||||
if (argv[i][0] == '-') {
|
||||
if (strcmp(argv[i], "-q") == 0 || strcmp(argv[i], "--quietly") == 0)
|
||||
quietly = 1;
|
||||
else if (strcmp(argv[i], "-h") == 0 || strcmp(argv[i], "--help") == 0) {
|
||||
print_help();
|
||||
exit(0);
|
||||
}
|
||||
else
|
||||
{
|
||||
print_help();
|
||||
fatal_printf("Unrecognized option: %s\n", argv[i]);
|
||||
}
|
||||
} else if (filename != NULL) {
|
||||
print_help();
|
||||
fatal_printf("Excess filename supplied\n");
|
||||
}
|
||||
else
|
||||
filename = argv[i];
|
||||
}
|
||||
if (filename == NULL) {
|
||||
print_help();
|
||||
return 1;
|
||||
fatal_printf("Missing required argument: filename\n");
|
||||
} else {
|
||||
// Open the file and read it's sha1 hash.
|
||||
FILE *f = fopen(argv[1], "rb+");
|
||||
FILE *f = fopen(filename, "rb+");
|
||||
if (f == NULL) {
|
||||
fatal_printf("ERROR: No file detected\n");
|
||||
}
|
||||
|
|
@ -205,7 +235,7 @@ int main(int argc, char *argv[]) {
|
|||
for (int i = 0; gPatchDefs[i].sha1before != NULL; i++) {
|
||||
// check if already patched for the current loop.
|
||||
if (!strcmp(buf, gPatchDefs[i].sha1after)) {
|
||||
printf("Supported patched version detected (%s): no action needed\n", gPatchDefs[i].version);
|
||||
if (!quietly) printf("Supported patched version detected (%s): no action needed\n", gPatchDefs[i].version);
|
||||
return 0;
|
||||
} else if(!strcmp(buf, gPatchDefs[i].sha1before)) {
|
||||
// we found an unpatched version: apply the patches.
|
||||
|
|
@ -213,7 +243,7 @@ int main(int argc, char *argv[]) {
|
|||
fseek(f, gPatchDefs[i].patches[j].offsetPatch, SEEK_SET);
|
||||
fputc(gPatchDefs[i].patches[j].newByte, f);
|
||||
}
|
||||
printf("Supported unpatched version detected (%s): assembler patched\n", gPatchDefs[i].version);
|
||||
if (!quietly) printf("Supported unpatched version detected (%s): assembler patched\n", gPatchDefs[i].version);
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user