summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.gitattributes2
-rw-r--r--.travis.yml4
-rw-r--r--arm9/asm/unk_0200AA80.s6
-rw-r--r--arm9/asm/unk_02015CC0.s60
-rw-r--r--arm9/src/unk_02015CC0.c31
-rw-r--r--include/unk_02015CC0.h8
-rw-r--r--tools/knarc/Makefile3
-rw-r--r--tools/msgenc/Makefile3
-rw-r--r--tools/msgenc/msgenc.cpp9
-rw-r--r--tools/mwasmarm_patcher/mwasmarm_patcher.c6
10 files changed, 55 insertions, 77 deletions
diff --git a/.gitattributes b/.gitattributes
index 4283d063..0ab03c06 100644
--- a/.gitattributes
+++ b/.gitattributes
@@ -1,4 +1,4 @@
*.sha1 text eol=lf
charmap.txt text eol=crlf working-tree-encoding=utf-16le-bom
files/msgdata/msg/*.txt eol=crlf working-tree-encoding=utf-16le-bom
-files/msgdata/msg/*.key binary
+*.key binary \ No newline at end of file
diff --git a/.travis.yml b/.travis.yml
index 71bc101a..ac700082 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -31,8 +31,8 @@ install:
- popd
script:
- - make
- - make pearl
+ - travis_retry make
+ - travis_retry make pearl
notifications:
email: false
diff --git a/arm9/asm/unk_0200AA80.s b/arm9/asm/unk_0200AA80.s
index ccf022f4..165a789e 100644
--- a/arm9/asm/unk_0200AA80.s
+++ b/arm9/asm/unk_0200AA80.s
@@ -5,9 +5,9 @@
.global UNK_020ECE64
UNK_020ECE64: ; 0x020ECE64
- .short 0x017E
- .short 0x0180
- .short 0x017F
+ .short 0x017E ; Locations
+ .short 0x0180 ; Gifts/trades
+ .short 0x017F ; Events
.balign 4
.global UNK_020ECE6C
diff --git a/arm9/asm/unk_02015CC0.s b/arm9/asm/unk_02015CC0.s
deleted file mode 100644
index 32de27da..00000000
--- a/arm9/asm/unk_02015CC0.s
+++ /dev/null
@@ -1,60 +0,0 @@
- .include "asm/macros.inc"
- .include "global.inc"
-
- .section .rodata
-
- .global UNK_020ED72C
-UNK_020ED72C: ; 0x020ED72C
- .byte 0x00, 0x00, 0xD0, 0x07, 0xB8, 0x0B, 0x00, 0x00
-
- .text
-
- thumb_func_start FUN_02015CC0
-FUN_02015CC0: ; 0x02015CC0
- ldr r3, _02015CDC ; =UNK_020ED72C
- mov r2, #0x0
-_02015CC4:
- ldrh r1, [r3, #0x2]
- cmp r0, r1
- bhs _02015CCE
- add r0, r2, #0x0
- bx lr
-_02015CCE:
- add r2, r2, #0x1
- add r3, r3, #0x2
- cmp r2, #0x2
- blt _02015CC4
- add r0, r2, #0x0
- bx lr
- nop
-_02015CDC: .word UNK_020ED72C
-
- thumb_func_start FUN_02015CE0
-FUN_02015CE0: ; 0x02015CE0
- push {r4, lr}
- add r4, r0, #0x0
- bl FUN_02015CC0
- lsl r1, r0, #0x1
- ldr r0, _02015CF4 ; =UNK_020ED72C
- ldrh r0, [r0, r1]
- sub r0, r4, r0
- pop {r4, pc}
- nop
-_02015CF4: .word UNK_020ED72C
-
- thumb_func_start FUN_02015CF8
-FUN_02015CF8: ; 0x02015CF8
- push {r3-r5, lr}
- add r5, r0, #0x0
- add r4, r1, #0x0
- cmp r5, #0x3
- blt _02015D06
- bl ErrorHandling
-_02015D06:
- ldr r0, _02015D10 ; =UNK_020ED72C
- lsl r1, r5, #0x1
- ldrh r0, [r0, r1]
- add r0, r4, r0
- pop {r3-r5, pc}
- .balign 4
-_02015D10: .word UNK_020ED72C
diff --git a/arm9/src/unk_02015CC0.c b/arm9/src/unk_02015CC0.c
new file mode 100644
index 00000000..5da221d0
--- /dev/null
+++ b/arm9/src/unk_02015CC0.c
@@ -0,0 +1,31 @@
+#include "global.h"
+#include "unk_02015CC0.h"
+
+#pragma thumb on
+
+const u16 UNK_020ED72C[] = {
+ 0,
+ 2000,
+ 3000
+};
+
+int FUN_02015CC0(u16 a0)
+{
+ int i;
+ for (i = 0; i < (int)NELEMS(UNK_020ED72C) - 1; i++) {
+ if (a0 < UNK_020ED72C[i + 1])
+ return i;
+ }
+ return i;
+}
+
+int FUN_02015CE0(u16 a0)
+{
+ return a0 - UNK_020ED72C[FUN_02015CC0(a0)];
+}
+
+int FUN_02015CF8(int a0, int a1)
+{
+ GF_ASSERT(a0 < (int)NELEMS(UNK_020ED72C));
+ return a1 + UNK_020ED72C[a0];
+}
diff --git a/include/unk_02015CC0.h b/include/unk_02015CC0.h
new file mode 100644
index 00000000..206afe6f
--- /dev/null
+++ b/include/unk_02015CC0.h
@@ -0,0 +1,8 @@
+#ifndef POKEDIAMOND_UNK_02015CC0_H
+#define POKEDIAMOND_UNK_02015CC0_H
+
+int FUN_02015CC0(u16 a0);
+int FUN_02015CE0(u16 a0);
+int FUN_02015CF8(int a0, int a1);
+
+#endif //POKEDIAMOND_UNK_02015CC0_H
diff --git a/tools/knarc/Makefile b/tools/knarc/Makefile
index 1c33e9f6..7dc8bd24 100644
--- a/tools/knarc/Makefile
+++ b/tools/knarc/Makefile
@@ -1,7 +1,6 @@
CXXFLAGS := -std=c++17 -O2 -Wall -Wno-switch
CFLAGS := -O2 -Wall -Wno-switch
-WSLENV ?= no
ifeq ($(OS),Windows_NT)
C_SRCS := fnmatch.c
LDFLAGS += -lstdc++fs
@@ -11,11 +10,9 @@ UNAME_S := $(shell uname -s)
ifeq ($(UNAME_S),Darwin)
LDFLAGS += -lstdc++ -lc++ -lc
else
-ifneq ($(WSLENV),)
LDFLAGS += -lstdc++fs
endif
endif
-endif
CXX_SRCS := Source.cpp Narc.cpp
C_OBJS := $(C_SRCS:%.c=%.o)
CXX_OBJS := $(CXX_SRCS:%.cpp=%.o)
diff --git a/tools/msgenc/Makefile b/tools/msgenc/Makefile
index f6ddc439..05253e8b 100644
--- a/tools/msgenc/Makefile
+++ b/tools/msgenc/Makefile
@@ -1,7 +1,6 @@
CXXFLAGS := -std=c++17 -O2 -Wall -Wno-switch
CFLAGS := -O2 -Wall -Wno-switch
-WSLENV ?= no
ifeq ($(OS),Windows_NT)
LDFLAGS += -lstdc++fs
else
@@ -9,11 +8,9 @@ UNAME_S := $(shell uname -s)
ifeq ($(UNAME_S),Darwin)
LDFLAGS += -lstdc++ -lc++ -lc
else
-ifneq ($(WSLENV),)
LDFLAGS += -lstdc++fs
endif
endif
-endif
CXX_SRCS := msgenc.cpp
HEADERS :=
diff --git a/tools/msgenc/msgenc.cpp b/tools/msgenc/msgenc.cpp
index bc5e9eab..314fbce1 100644
--- a/tools/msgenc/msgenc.cpp
+++ b/tools/msgenc/msgenc.cpp
@@ -49,7 +49,7 @@ u16string ReadTextFileU16LE(path filename) {
ss << "read error in " << filename;
throw runtime_error(ss.str());
}
- if (bom != u'\uFEFF') {
+ if (bom != u'\uFEFF' && bom != u'\uFFFE') {
stringstream ss;
ss << "invalid bom in " << filename;
throw runtime_error(ss.str());
@@ -63,7 +63,12 @@ u16string ReadTextFileU16LE(path filename) {
ss << "read error in " << filename;
throw runtime_error(ss.str());
}
- buf[count] = L'\0';
+ if (bom == u'\uFFFE') {
+ for (int i = 0; i < count; i++) {
+ buf[i] = (buf[i] << 8) | (buf[i] >> 8);
+ }
+ }
+ buf[count] = u'\0';
fclose(file);
return buf;
}
diff --git a/tools/mwasmarm_patcher/mwasmarm_patcher.c b/tools/mwasmarm_patcher/mwasmarm_patcher.c
index 7d15820d..e5ad3272 100644
--- a/tools/mwasmarm_patcher/mwasmarm_patcher.c
+++ b/tools/mwasmarm_patcher/mwasmarm_patcher.c
@@ -80,7 +80,7 @@ unsigned char * calculate_sha1 (const void * data, unsigned length) {
uint32_t state[5] = {0x67452301, 0xefcdab89, 0x98badcfe, 0x10325476, 0xc3d2e1f0};
const char * current;
unsigned remaining;
- for (current = data, remaining = length; remaining >= 64; current += 64, remaining -= 64) sha1_process_block(current, state);
+ for (current = data, remaining = length; remaining >= 64; current += 64, remaining -= 64) sha1_process_block((const uint8_t *)current, state);
// technically only {0} is necessary, but better safe than sorry
unsigned char last_block[64] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
@@ -224,9 +224,9 @@ int main(int argc, char *argv[]) {
}
free(string);
- unsigned char buf[SHA_DIGEST_LENGTH*2];
+ char buf[SHA_DIGEST_LENGTH*2];
for (int i=0; i < SHA_DIGEST_LENGTH; i++) {
- sprintf((unsigned char*)&(buf[i*2]), "%02x", sha1[i]);
+ sprintf(&(buf[i*2]), "%02x", sha1[i]);
}
free(sha1);