diff options
author | luckytyphlosion <10688458+luckytyphlosion@users.noreply.github.com> | 2018-07-08 18:00:32 -0400 |
---|---|---|
committer | luckytyphlosion <10688458+luckytyphlosion@users.noreply.github.com> | 2018-07-08 18:00:32 -0400 |
commit | 5a6620021ac2d7ea78c0ec45291cf8a169567206 (patch) | |
tree | 8d87aaac5c9268cb76582800c560d42368825784 | |
parent | ca09233c9eca4c6b9b0ccfba436dcd7e3b3e669c (diff) |
Add maps to linkerscript
-rw-r--r-- | data/maps/attributes.asm | 1 | ||||
-rw-r--r-- | home/rtc.asm | 2 | ||||
-rw-r--r-- | maps/PlayerHouse1F.asm | 2 | ||||
-rw-r--r-- | maps/PlayerHouse2F.asm | 2 | ||||
-rw-r--r-- | maps/Route1Gate1F.asm | 4 | ||||
-rw-r--r-- | maps/Route1Gate2F.asm | 2 | ||||
-rw-r--r-- | maps/Route1P1.asm | 2 | ||||
-rw-r--r-- | maps/Route1P2.asm | 2 | ||||
-rw-r--r-- | maps/SilentHill.asm | 2 | ||||
-rw-r--r-- | maps/SilentHillHouse.asm | 2 | ||||
-rw-r--r-- | maps/SilentHillLabBack.asm | 2 | ||||
-rw-r--r-- | maps/SilentHillLabFront.asm | 2 | ||||
-rw-r--r-- | maps/SilentHillPokecenter.asm | 2 | ||||
-rw-r--r-- | maps/UnusedMap13.asm | 2 | ||||
-rw-r--r-- | pokegold-spaceworld.link | 40 | ||||
-rw-r--r-- | tools/fix_sections.py | 29 | ||||
-rw-r--r-- | tools/fix_sections_directory.py | 1 |
17 files changed, 65 insertions, 34 deletions
diff --git a/data/maps/attributes.asm b/data/maps/attributes.asm index 01c2e64..cfd58d4 100644 --- a/data/maps/attributes.asm +++ b/data/maps/attributes.asm @@ -4610,4 +4610,3 @@ BullForestRoute3_MapEvents:: db 0 ; person events BullForestRoute3_Blocks:: INCBIN "maps/blk/BullForestRoute3.blk" - diff --git a/home/rtc.asm b/home/rtc.asm index 9a89497..651a7b6 100644 --- a/home/rtc.asm +++ b/home/rtc.asm @@ -16,4 +16,4 @@ TimeOfDayPals:: UpdateTimePals:: ; 33a callab _UpdateTimePals ; Func_8c335 - ret + ret
\ No newline at end of file diff --git a/maps/PlayerHouse1F.asm b/maps/PlayerHouse1F.asm index 52af3ce..826edbf 100644 --- a/maps/PlayerHouse1F.asm +++ b/maps/PlayerHouse1F.asm @@ -1,6 +1,6 @@ include "constants.asm" -SECTION "Player's House 1F", ROMX[$409C], BANK[$34] +SECTION "maps/PlayerHouse1F.asm", ROMX PlayerHouse1FScriptLoader:: ; 409C ld hl, PlayerHouse1FScriptPointers diff --git a/maps/PlayerHouse2F.asm b/maps/PlayerHouse2F.asm index f2be5e1..e902d84 100644 --- a/maps/PlayerHouse2F.asm +++ b/maps/PlayerHouse2F.asm @@ -1,6 +1,6 @@ include "constants.asm" -SECTION "Player's House 2F", ROMX[$418B], BANK[$34] +SECTION "maps/PlayerHouse2F.asm", ROMX PlayerHouse2FScriptLoader:: ; 418B ld hl, PlayerHouse2FScriptPointers diff --git a/maps/Route1Gate1F.asm b/maps/Route1Gate1F.asm index c393aa6..ef48c4c 100644 --- a/maps/Route1Gate1F.asm +++ b/maps/Route1Gate1F.asm @@ -1,6 +1,6 @@ include "constants.asm" -SECTION "Route 1 Gate 1F", ROMX[$4061], BANK[$26] +SECTION "maps/Route1Gate1F.asm", ROMX Route1Gate1FScriptLoader:: ;4061 ld hl, Route1Gate1FScriptPointers @@ -52,4 +52,4 @@ Route1Gate1FText2String: ; 40AC para "いってみたこと ある?" done -;ends at 40D9 +;ends at 40D9
\ No newline at end of file diff --git a/maps/Route1Gate2F.asm b/maps/Route1Gate2F.asm index ca8009d..805e7c0 100644 --- a/maps/Route1Gate2F.asm +++ b/maps/Route1Gate2F.asm @@ -1,6 +1,6 @@ include "constants.asm" -SECTION "Route 1 Gate 2F", ROMX[$411F], BANK[$26] +SECTION "maps/Route1Gate2F.asm", ROMX Route1Gate2FScriptLoader:: ; 411F ld hl, Route1Gate2FScriptPointers diff --git a/maps/Route1P1.asm b/maps/Route1P1.asm index f9a3e64..62ed0cd 100644 --- a/maps/Route1P1.asm +++ b/maps/Route1P1.asm @@ -1,6 +1,6 @@ include "constants.asm" -SECTION "Route 1 East", ROMX[$7B98], BANK[$36] +SECTION "maps/Route1P1.asm", ROMX Route1P1ScriptLoader:: ; 7B98 ld hl, Route1P1ScriptPointers diff --git a/maps/Route1P2.asm b/maps/Route1P2.asm index fa38d9e..ae7e399 100644 --- a/maps/Route1P2.asm +++ b/maps/Route1P2.asm @@ -1,6 +1,6 @@ include "constants.asm" -SECTION "Route 1 West", ROMX[$7C68], BANK[$36] +SECTION "maps/Route1P2.asm", ROMX Route1P2ScriptLoader:: ; 7C67 ld hl, Route1P2ScriptPointers diff --git a/maps/SilentHill.asm b/maps/SilentHill.asm index f699a44..922503d 100644 --- a/maps/SilentHill.asm +++ b/maps/SilentHill.asm @@ -1,6 +1,6 @@ include "constants.asm" -SECTION "Silent Hills Script", ROMX[$7669], BANK[$36] +SECTION "maps/SilentHill.asm", ROMX SilentHillScriptLoader:: ; 7669 ld hl, SilentHillScriptPointers1 diff --git a/maps/SilentHillHouse.asm b/maps/SilentHillHouse.asm index 591c217..8a48ef3 100644 --- a/maps/SilentHillHouse.asm +++ b/maps/SilentHillHouse.asm @@ -1,6 +1,6 @@ include "constants.asm" -SECTION "Silent Hills House", ROMX[$4839], BANK[$34] +SECTION "maps/SilentHillHouse.asm", ROMX SilentHillHouseScriptLoader:: ; 4839 ld hl, SilentHillHouseScriptPointers diff --git a/maps/SilentHillLabBack.asm b/maps/SilentHillLabBack.asm index 33d975e..7947dd4 100644 --- a/maps/SilentHillLabBack.asm +++ b/maps/SilentHillLabBack.asm @@ -1,6 +1,6 @@ include "constants.asm" -SECTION "Silent Lab P2 Script", ROMX[$5C69], BANK[$34] +SECTION "maps/SilentHillLabBack.asm", ROMX SilentHillLabBackScriptLoader:: ; 5C69 ld hl, SilentHillLabBackScriptPointers diff --git a/maps/SilentHillLabFront.asm b/maps/SilentHillLabFront.asm index 62a477a..0ab5266 100644 --- a/maps/SilentHillLabFront.asm +++ b/maps/SilentHillLabFront.asm @@ -1,6 +1,6 @@ include "constants.asm" -SECTION "Silent Lab P1", ROMX[$4BBC], BANK[$34] +SECTION "maps/SilentHillLabFront.asm", ROMX SilentHillLabFrontScriptLoader:: ; 4BBC ld hl, SilentHillLabFrontScriptPointers diff --git a/maps/SilentHillPokecenter.asm b/maps/SilentHillPokecenter.asm index 50ab6d3..9a9eca2 100644 --- a/maps/SilentHillPokecenter.asm +++ b/maps/SilentHillPokecenter.asm @@ -1,6 +1,6 @@ include "constants.asm" -SECTION "Silent Hills Pokecenter", ROMX[$4682], BANK[$34] +SECTION "maps/SilentHillPokecenter.asm", ROMX SilentHillPokecenterScriptLoader:: ; 4682 ld hl, SilentHillPokecenterScriptPointers diff --git a/maps/UnusedMap13.asm b/maps/UnusedMap13.asm index 647188b..9046aef 100644 --- a/maps/UnusedMap13.asm +++ b/maps/UnusedMap13.asm @@ -1,6 +1,6 @@ include "constants.asm" -SECTION "Map 13 Script", ROMX[$6078], BANK[$34] +SECTION "maps/UnusedMap13.asm", ROMX UnusedMap13ScriptLoader:: ; 6078 ld hl, UnusedMap13ScriptPointers diff --git a/pokegold-spaceworld.link b/pokegold-spaceworld.link index 8cad480..da3d9ef 100644 --- a/pokegold-spaceworld.link +++ b/pokegold-spaceworld.link @@ -1,29 +1,40 @@ ; Automatically generated by map2link.py ROM0 - org $0000 "home/rst.asm@rst00" + ; $0001 org $0008 "home/rst.asm@rst08" + ; $0009 org $0010 "home/rst.asm@rst10" + ; $0011 org $0018 "home/rst.asm@rst18" + ; $0019 org $0020 "home/rst.asm@rst20" + ; $0021 org $0028 "home/rst.asm@rst28" + ; $0029 org $0030 "home/rst.asm@rst30" + ; $0031 org $0038 "home/rst.asm@rst38" + ; $003b org $0040 "home/interrupts.asm@VBlank interrupt vector" + ; $0043 org $0048 "home/interrupts.asm@LCD interrupt vector" + ; $004b org $0050 "home/interrupts.asm@Timer interrupt vector" + ; $0053 org $0058 "home/interrupts.asm@Serial interrupt vector" + ; $005b org $0060 "home/interrupts.asm@Joypad interrupt vector" ; $0063 @@ -415,9 +426,9 @@ ROMX $25 ROMX $26 org $4000 "data/maps/attributes.asm@Route1Gate1F" - org $40da + "maps/Route1Gate1F.asm" "data/maps/attributes.asm@Route1Gate2F" - org $4224 + "maps/Route1Gate2F.asm" "data/maps/attributes.asm@WestMart1F" org $42a0 "data/maps/attributes.asm@WestMart2F" @@ -750,23 +761,25 @@ ROMX $34 "data/maps/attributes.asm@RouteSilentEastGate" org $4042 "data/maps/attributes.asm@PlayerHouse1F" - org $4132 + "maps/PlayerHouse1F.asm" "data/maps/attributes.asm@PlayerHouse2F" - org $45ff + "maps/PlayerHouse2F.asm" "data/maps/attributes.asm@SilentHillPokecenter" - org $47d5 + "maps/SilentHillPokecenter.asm" "data/maps/attributes.asm@SilentHillHouse" - org $4aac + "maps/SilentHillHouse.asm" "data/maps/attributes.asm@SilentHillLabFront" - org $5be6 + "maps/SilentHillLabFront.asm" "data/maps/attributes.asm@SilentHillLabBack" - org $605d + "maps/SilentHillLabBack.asm" "data/maps/attributes.asm@UnusedMap13" + ; $6068 + org $6078 + "maps/UnusedMap13.asm" ROMX $36 org $4000 org $4014 "data/maps/attributes.asm@SilentHill" - org $410d "data/maps/attributes.asm@OldCity" org $4372 "data/maps/attributes.asm@West" @@ -796,9 +809,7 @@ ROMX $36 "data/maps/attributes.asm@North" org $59df "data/maps/attributes.asm@Route1P1" - org $5abe "data/maps/attributes.asm@Route1P2" - org $5bd4 "data/maps/attributes.asm@Route2" org $5cc6 "data/maps/attributes.asm@HaitekuWestRoute" @@ -846,6 +857,11 @@ ROMX $36 "data/maps/attributes.asm@FontoRoute5" org $7530 "data/maps/attributes.asm@BullForestRoute3" + org $7669 + "maps/SilentHill.asm" + org $7b98 + "maps/Route1P1.asm" + "maps/Route1P2.asm" ROMX $37 org $4000 "gfx.asm@Bank 37 Tilesets 10" diff --git a/tools/fix_sections.py b/tools/fix_sections.py index fa40b4b..3d864ed 100644 --- a/tools/fix_sections.py +++ b/tools/fix_sections.py @@ -1,5 +1,6 @@ import os, errno import re +import fix_sections_directory os.chdir("..") cwd = os.getcwd() @@ -17,10 +18,10 @@ with open("pokegold-spaceworld-gen.link", "r") as f: def clean_section(line, file, multiple): global linkerscript lines = line.lstrip().split("\"") - if "@" not in lines[1] and not file == lines[1]: - file += ("@" + lines[1]) if multiple else "" - else: + if "@" in lines[1] or file == lines[1] or file == "hram.asm" or file == "vram.asm" or file == "sram.asm": file = lines[1] + else: + file += ("@" + lines[1]) if multiple else "" linkerscript = linkerscript.replace("\"" + lines[1] + "\"", "\"" + file + "\"") if "ROMX" in lines[2]: @@ -36,7 +37,7 @@ def clean_section(line, file, multiple): else: raise -TEMP_PATH = "temp/" +TEMP_PATH = fix_sections_directory.TEMP_DIRECTORY for root, dirs, files in os.walk(cwd): for file in files: @@ -89,9 +90,17 @@ for root, dirs, files in os.walk(cwd): linkerscript_lines = linkerscript.splitlines() i = 0 +clean_wram = False + while i < len(linkerscript_lines): line = linkerscript_lines[i] - if "\"Shim for " in line: + if clean_wram: + if "org $dfff" not in line: + print(linkerscript_lines.pop(i)) + else: + clean_wram = False + i += 1 + elif "\"Shim for " in line: no_pop_count = 0 shim_addr = line.replace(", ", " ; ").split(" ; ")[1] if linkerscript_lines[i-1] == "\torg " + shim_addr and linkerscript_lines[i-1] != "\torg $4000": @@ -107,16 +116,22 @@ while i < len(linkerscript_lines): i -= 3 - no_pop_count print("") - elif "ROMX" in line: + elif "ROMX" in line and "org $4000" not in linkerscript_lines[i+1]: linkerscript_lines.insert(i+1, "\torg $4000") i += 1 + elif line.startswith("WRAM0"): + linkerscript_lines.insert(i+1, "\torg $c000") + i += 1 + elif "\"Map Buffer\"" in line: + clean_wram = True + i += 1 else: i += 1 for i in range(len(linkerscript_lines)): linkerscript_lines[i] = linkerscript_lines[i].split(" ; ")[0] -linkerscript = "\n".join(linkerscript_lines) +linkerscript = "\n".join(linkerscript_lines) + "\n" with open(TEMP_PATH + "pokegold-spaceworld.link", "w+") as f: f.write(linkerscript)
\ No newline at end of file diff --git a/tools/fix_sections_directory.py b/tools/fix_sections_directory.py new file mode 100644 index 0000000..d359c8c --- /dev/null +++ b/tools/fix_sections_directory.py @@ -0,0 +1 @@ +TEMP_DIRECTORY = ""
\ No newline at end of file |