diff --git a/.clang-format b/.clang-format new file mode 100644 index 0000000..01aed9a --- /dev/null +++ b/.clang-format @@ -0,0 +1,6 @@ +IndentWidth: 4 +TabWidth: 4 +UseTab: Never +ContinuationIndentWidth: 4 +AlignAfterOpenBracket: DontAlign # Ensure a tabulation first inside a bracket +BreakBeforeBraces: Allman # Ensure opening bracket goes to newline for a statement diff --git a/.gitmodules b/.gitmodules index b5314ec..012dffa 100644 --- a/.gitmodules +++ b/.gitmodules @@ -1,3 +1,4 @@ [submodule "PCCS"] path = PCCS - url = https://github.com/GearsProgress/Pokemon-Community-Conversion-Standard.git + url = https://github.com/Striaton-Lab-Team/Pokemon-Community-Conversion-Standard.git + branch = release-candidate diff --git a/PCCS b/PCCS index 038f669..c59d238 160000 --- a/PCCS +++ b/PCCS @@ -1 +1 @@ -Subproject commit 038f669012b1ab43c4583a546902209f63ed40e1 +Subproject commit c59d238f1b4dac5221498077bb0a228d21a4c0ff diff --git a/README.md b/README.md index f7efdf5..a8c81ac 100644 --- a/README.md +++ b/README.md @@ -11,7 +11,7 @@ Pokémon Transfered using Poké Transporter GB *will* be removed from Red, Blue, Currently the only release is in English. Releases supporting other languages is planned for the near future. -Currently English versions of Red, Blue, Yellow, Gold, Silver, Crystal are supported- plus English, Spanish, German, Italian, French versions of Ruby, Sapphire, FireRed, LeafGreen, and Emerald. Compatibility for other languages is currently in development and will be added in the near future. +English, French, German, Italian and Spanish games are supported. Poke Transporter GB supports original gen III cartridges AND the gen III games in mode B on the [EZ Flash Omega Definitive Edition flashcart](docs/EZ_Flash_Omega_DE.md). @@ -97,7 +97,7 @@ One of my favorite aspects of the Pokémon franchise is the ability to send Pok - [Serebii](https://www.serebii.net/) - [PokeAPI](https://pokeapi.co/) - [Glitch City Wiki](https://glitchcity.wiki/wiki/Main_Page) - + # Discord Community Assistance: - [Hex Maniac Advance Development](https://discord.com/invite/x9eQuBg) - [GBAdev](https://discord.gg/ctGSNxRkg2) diff --git a/graphics/boxBG.grit b/graphics/boxBG.grit index 75206cd..2a3d2d2 100644 --- a/graphics/boxBG.grit +++ b/graphics/boxBG.grit @@ -2,5 +2,5 @@ # Text Box (Background) : 64x64t, 4bpp, SBB-layout, LZ77 compressed. # Pallet bank 2, copy from 32 to 48. # --gt -gB4 -gzl -mR4 -mLs -mp2 -mzl -ps0 -pe16 +-gt -gB4 -gzl -mR4 -mLs -mp2 -ma64 -mzl -ps0 -pe16 diff --git a/graphics/fennelBG.grit b/graphics/fennelBG.grit index 75206cd..2a3d2d2 100644 --- a/graphics/fennelBG.grit +++ b/graphics/fennelBG.grit @@ -2,5 +2,5 @@ # Text Box (Background) : 64x64t, 4bpp, SBB-layout, LZ77 compressed. # Pallet bank 2, copy from 32 to 48. # --gt -gB4 -gzl -mR4 -mLs -mp2 -mzl -ps0 -pe16 +-gt -gB4 -gzl -mR4 -mLs -mp2 -ma64 -mzl -ps0 -pe16 diff --git a/graphics/languages/chineseSI/button_cancel_left.png b/graphics/languages/chineseSI/button_cancel_left.png index 9b621e7..3e92589 100644 Binary files a/graphics/languages/chineseSI/button_cancel_left.png and b/graphics/languages/chineseSI/button_cancel_left.png differ diff --git a/graphics/languages/chineseSI/button_confirm_left.png b/graphics/languages/chineseSI/button_confirm_left.png index 1461e96..8b1865c 100644 Binary files a/graphics/languages/chineseSI/button_confirm_left.png and b/graphics/languages/chineseSI/button_confirm_left.png differ diff --git a/graphics/languages/chineseSI/button_no.png b/graphics/languages/chineseSI/button_no.png index 4767a65..e495e53 100644 Binary files a/graphics/languages/chineseSI/button_no.png and b/graphics/languages/chineseSI/button_no.png differ diff --git a/graphics/languages/chineseSI/button_yes.png b/graphics/languages/chineseSI/button_yes.png index 7aa5fb6..8daf466 100644 Binary files a/graphics/languages/chineseSI/button_yes.png and b/graphics/languages/chineseSI/button_yes.png differ diff --git a/graphics/languages/chineseSI/dexBG.grit b/graphics/languages/chineseSI/dexBG.grit index 75206cd..2a3d2d2 100644 --- a/graphics/languages/chineseSI/dexBG.grit +++ b/graphics/languages/chineseSI/dexBG.grit @@ -2,5 +2,5 @@ # Text Box (Background) : 64x64t, 4bpp, SBB-layout, LZ77 compressed. # Pallet bank 2, copy from 32 to 48. # --gt -gB4 -gzl -mR4 -mLs -mp2 -mzl -ps0 -pe16 +-gt -gB4 -gzl -mR4 -mLs -mp2 -ma64 -mzl -ps0 -pe16 diff --git a/graphics/openingBG.grit b/graphics/languages/chineseSI/openingBG.grit similarity index 68% rename from graphics/openingBG.grit rename to graphics/languages/chineseSI/openingBG.grit index 75206cd..2a3d2d2 100644 --- a/graphics/openingBG.grit +++ b/graphics/languages/chineseSI/openingBG.grit @@ -2,5 +2,5 @@ # Text Box (Background) : 64x64t, 4bpp, SBB-layout, LZ77 compressed. # Pallet bank 2, copy from 32 to 48. # --gt -gB4 -gzl -mR4 -mLs -mp2 -mzl -ps0 -pe16 +-gt -gB4 -gzl -mR4 -mLs -mp2 -ma64 -mzl -ps0 -pe16 diff --git a/graphics/languages/chineseSI/openingBG.png b/graphics/languages/chineseSI/openingBG.png new file mode 100644 index 0000000..53edf53 Binary files /dev/null and b/graphics/languages/chineseSI/openingBG.png differ diff --git a/graphics/languages/chineseSI/types.png b/graphics/languages/chineseSI/types.png index 3793847..e3dd592 100644 Binary files a/graphics/languages/chineseSI/types.png and b/graphics/languages/chineseSI/types.png differ diff --git a/graphics/languages/chineseTR/button_cancel_left.png b/graphics/languages/chineseTR/button_cancel_left.png index 9b621e7..3e92589 100644 Binary files a/graphics/languages/chineseTR/button_cancel_left.png and b/graphics/languages/chineseTR/button_cancel_left.png differ diff --git a/graphics/languages/chineseTR/button_confirm_left.png b/graphics/languages/chineseTR/button_confirm_left.png index 1461e96..1724ea0 100644 Binary files a/graphics/languages/chineseTR/button_confirm_left.png and b/graphics/languages/chineseTR/button_confirm_left.png differ diff --git a/graphics/languages/chineseTR/button_no.png b/graphics/languages/chineseTR/button_no.png index 4767a65..e495e53 100644 Binary files a/graphics/languages/chineseTR/button_no.png and b/graphics/languages/chineseTR/button_no.png differ diff --git a/graphics/languages/chineseTR/button_yes.png b/graphics/languages/chineseTR/button_yes.png index 7aa5fb6..8daf466 100644 Binary files a/graphics/languages/chineseTR/button_yes.png and b/graphics/languages/chineseTR/button_yes.png differ diff --git a/graphics/languages/chineseTR/dexBG.grit b/graphics/languages/chineseTR/dexBG.grit index 75206cd..2a3d2d2 100644 --- a/graphics/languages/chineseTR/dexBG.grit +++ b/graphics/languages/chineseTR/dexBG.grit @@ -2,5 +2,5 @@ # Text Box (Background) : 64x64t, 4bpp, SBB-layout, LZ77 compressed. # Pallet bank 2, copy from 32 to 48. # --gt -gB4 -gzl -mR4 -mLs -mp2 -mzl -ps0 -pe16 +-gt -gB4 -gzl -mR4 -mLs -mp2 -ma64 -mzl -ps0 -pe16 diff --git a/graphics/languages/chineseTR/openingBG.grit b/graphics/languages/chineseTR/openingBG.grit new file mode 100644 index 0000000..2a3d2d2 --- /dev/null +++ b/graphics/languages/chineseTR/openingBG.grit @@ -0,0 +1,6 @@ +# +# Text Box (Background) : 64x64t, 4bpp, SBB-layout, LZ77 compressed. +# Pallet bank 2, copy from 32 to 48. +# +-gt -gB4 -gzl -mR4 -mLs -mp2 -ma64 -mzl -ps0 -pe16 + diff --git a/graphics/languages/chineseTR/openingBG.png b/graphics/languages/chineseTR/openingBG.png new file mode 100644 index 0000000..53edf53 Binary files /dev/null and b/graphics/languages/chineseTR/openingBG.png differ diff --git a/graphics/languages/chineseTR/types.png b/graphics/languages/chineseTR/types.png index 3793847..e3dd592 100644 Binary files a/graphics/languages/chineseTR/types.png and b/graphics/languages/chineseTR/types.png differ diff --git a/graphics/languages/english/button_cancel_left.png b/graphics/languages/english/button_cancel_left.png index 9b621e7..c3f1242 100644 Binary files a/graphics/languages/english/button_cancel_left.png and b/graphics/languages/english/button_cancel_left.png differ diff --git a/graphics/languages/english/button_confirm_left.png b/graphics/languages/english/button_confirm_left.png index 1461e96..1185835 100644 Binary files a/graphics/languages/english/button_confirm_left.png and b/graphics/languages/english/button_confirm_left.png differ diff --git a/graphics/languages/english/button_no.png b/graphics/languages/english/button_no.png index 4767a65..2c8f9f5 100644 Binary files a/graphics/languages/english/button_no.png and b/graphics/languages/english/button_no.png differ diff --git a/graphics/languages/english/button_yes.png b/graphics/languages/english/button_yes.png index 7aa5fb6..b84953f 100644 Binary files a/graphics/languages/english/button_yes.png and b/graphics/languages/english/button_yes.png differ diff --git a/graphics/languages/english/dexBG.grit b/graphics/languages/english/dexBG.grit index 75206cd..2a3d2d2 100644 --- a/graphics/languages/english/dexBG.grit +++ b/graphics/languages/english/dexBG.grit @@ -2,5 +2,5 @@ # Text Box (Background) : 64x64t, 4bpp, SBB-layout, LZ77 compressed. # Pallet bank 2, copy from 32 to 48. # --gt -gB4 -gzl -mR4 -mLs -mp2 -mzl -ps0 -pe16 +-gt -gB4 -gzl -mR4 -mLs -mp2 -ma64 -mzl -ps0 -pe16 diff --git a/graphics/languages/english/openingBG.grit b/graphics/languages/english/openingBG.grit new file mode 100644 index 0000000..2a3d2d2 --- /dev/null +++ b/graphics/languages/english/openingBG.grit @@ -0,0 +1,6 @@ +# +# Text Box (Background) : 64x64t, 4bpp, SBB-layout, LZ77 compressed. +# Pallet bank 2, copy from 32 to 48. +# +-gt -gB4 -gzl -mR4 -mLs -mp2 -ma64 -mzl -ps0 -pe16 + diff --git a/graphics/languages/english/openingBG.png b/graphics/languages/english/openingBG.png new file mode 100644 index 0000000..53edf53 Binary files /dev/null and b/graphics/languages/english/openingBG.png differ diff --git a/graphics/languages/english/types.png b/graphics/languages/english/types.png index 3793847..e3dd592 100644 Binary files a/graphics/languages/english/types.png and b/graphics/languages/english/types.png differ diff --git a/graphics/languages/french/dexBG.grit b/graphics/languages/french/dexBG.grit index 75206cd..2a3d2d2 100644 --- a/graphics/languages/french/dexBG.grit +++ b/graphics/languages/french/dexBG.grit @@ -2,5 +2,5 @@ # Text Box (Background) : 64x64t, 4bpp, SBB-layout, LZ77 compressed. # Pallet bank 2, copy from 32 to 48. # --gt -gB4 -gzl -mR4 -mLs -mp2 -mzl -ps0 -pe16 +-gt -gB4 -gzl -mR4 -mLs -mp2 -ma64 -mzl -ps0 -pe16 diff --git a/graphics/languages/french/openingBG.grit b/graphics/languages/french/openingBG.grit new file mode 100644 index 0000000..2a3d2d2 --- /dev/null +++ b/graphics/languages/french/openingBG.grit @@ -0,0 +1,6 @@ +# +# Text Box (Background) : 64x64t, 4bpp, SBB-layout, LZ77 compressed. +# Pallet bank 2, copy from 32 to 48. +# +-gt -gB4 -gzl -mR4 -mLs -mp2 -ma64 -mzl -ps0 -pe16 + diff --git a/graphics/languages/french/openingBG.png b/graphics/languages/french/openingBG.png new file mode 100644 index 0000000..0df44ec Binary files /dev/null and b/graphics/languages/french/openingBG.png differ diff --git a/graphics/languages/german/button_cancel_left.png b/graphics/languages/german/button_cancel_left.png index 9b621e7..5840962 100644 Binary files a/graphics/languages/german/button_cancel_left.png and b/graphics/languages/german/button_cancel_left.png differ diff --git a/graphics/languages/german/button_confirm_left.png b/graphics/languages/german/button_confirm_left.png index 1461e96..0d85349 100644 Binary files a/graphics/languages/german/button_confirm_left.png and b/graphics/languages/german/button_confirm_left.png differ diff --git a/graphics/languages/german/button_no.png b/graphics/languages/german/button_no.png index 4767a65..eb3ed83 100644 Binary files a/graphics/languages/german/button_no.png and b/graphics/languages/german/button_no.png differ diff --git a/graphics/languages/german/button_yes.png b/graphics/languages/german/button_yes.png index 7aa5fb6..ad473b7 100644 Binary files a/graphics/languages/german/button_yes.png and b/graphics/languages/german/button_yes.png differ diff --git a/graphics/languages/german/dexBG.grit b/graphics/languages/german/dexBG.grit index 75206cd..2a3d2d2 100644 --- a/graphics/languages/german/dexBG.grit +++ b/graphics/languages/german/dexBG.grit @@ -2,5 +2,5 @@ # Text Box (Background) : 64x64t, 4bpp, SBB-layout, LZ77 compressed. # Pallet bank 2, copy from 32 to 48. # --gt -gB4 -gzl -mR4 -mLs -mp2 -mzl -ps0 -pe16 +-gt -gB4 -gzl -mR4 -mLs -mp2 -ma64 -mzl -ps0 -pe16 diff --git a/graphics/languages/german/openingBG.grit b/graphics/languages/german/openingBG.grit new file mode 100644 index 0000000..2a3d2d2 --- /dev/null +++ b/graphics/languages/german/openingBG.grit @@ -0,0 +1,6 @@ +# +# Text Box (Background) : 64x64t, 4bpp, SBB-layout, LZ77 compressed. +# Pallet bank 2, copy from 32 to 48. +# +-gt -gB4 -gzl -mR4 -mLs -mp2 -ma64 -mzl -ps0 -pe16 + diff --git a/graphics/languages/german/openingBG.png b/graphics/languages/german/openingBG.png new file mode 100644 index 0000000..d55306a Binary files /dev/null and b/graphics/languages/german/openingBG.png differ diff --git a/graphics/languages/german/ptgb_logo_l.png b/graphics/languages/german/ptgb_logo_l.png index 2477664..07c2f56 100644 Binary files a/graphics/languages/german/ptgb_logo_l.png and b/graphics/languages/german/ptgb_logo_l.png differ diff --git a/graphics/languages/german/ptgb_logo_r.png b/graphics/languages/german/ptgb_logo_r.png index a779749..73ba075 100644 Binary files a/graphics/languages/german/ptgb_logo_r.png and b/graphics/languages/german/ptgb_logo_r.png differ diff --git a/graphics/languages/german/types.png b/graphics/languages/german/types.png index 3793847..96a883b 100644 Binary files a/graphics/languages/german/types.png and b/graphics/languages/german/types.png differ diff --git a/graphics/languages/italian/button_cancel_left.png b/graphics/languages/italian/button_cancel_left.png index 9b621e7..a1ecd8e 100644 Binary files a/graphics/languages/italian/button_cancel_left.png and b/graphics/languages/italian/button_cancel_left.png differ diff --git a/graphics/languages/italian/button_confirm_left.png b/graphics/languages/italian/button_confirm_left.png index 1461e96..c1dc71e 100644 Binary files a/graphics/languages/italian/button_confirm_left.png and b/graphics/languages/italian/button_confirm_left.png differ diff --git a/graphics/languages/italian/button_no.png b/graphics/languages/italian/button_no.png index 4767a65..4989d45 100644 Binary files a/graphics/languages/italian/button_no.png and b/graphics/languages/italian/button_no.png differ diff --git a/graphics/languages/italian/button_yes.png b/graphics/languages/italian/button_yes.png index 7aa5fb6..02b609f 100644 Binary files a/graphics/languages/italian/button_yes.png and b/graphics/languages/italian/button_yes.png differ diff --git a/graphics/languages/italian/dexBG.grit b/graphics/languages/italian/dexBG.grit index 75206cd..2a3d2d2 100644 --- a/graphics/languages/italian/dexBG.grit +++ b/graphics/languages/italian/dexBG.grit @@ -2,5 +2,5 @@ # Text Box (Background) : 64x64t, 4bpp, SBB-layout, LZ77 compressed. # Pallet bank 2, copy from 32 to 48. # --gt -gB4 -gzl -mR4 -mLs -mp2 -mzl -ps0 -pe16 +-gt -gB4 -gzl -mR4 -mLs -mp2 -ma64 -mzl -ps0 -pe16 diff --git a/graphics/languages/italian/openingBG.grit b/graphics/languages/italian/openingBG.grit new file mode 100644 index 0000000..2a3d2d2 --- /dev/null +++ b/graphics/languages/italian/openingBG.grit @@ -0,0 +1,6 @@ +# +# Text Box (Background) : 64x64t, 4bpp, SBB-layout, LZ77 compressed. +# Pallet bank 2, copy from 32 to 48. +# +-gt -gB4 -gzl -mR4 -mLs -mp2 -ma64 -mzl -ps0 -pe16 + diff --git a/graphics/languages/italian/openingBG.png b/graphics/languages/italian/openingBG.png new file mode 100644 index 0000000..9901a31 Binary files /dev/null and b/graphics/languages/italian/openingBG.png differ diff --git a/graphics/languages/italian/ptgb_logo_l.png b/graphics/languages/italian/ptgb_logo_l.png index 2477664..802875b 100644 Binary files a/graphics/languages/italian/ptgb_logo_l.png and b/graphics/languages/italian/ptgb_logo_l.png differ diff --git a/graphics/languages/italian/ptgb_logo_r.png b/graphics/languages/italian/ptgb_logo_r.png index a779749..b15599c 100644 Binary files a/graphics/languages/italian/ptgb_logo_r.png and b/graphics/languages/italian/ptgb_logo_r.png differ diff --git a/graphics/languages/italian/types.png b/graphics/languages/italian/types.png index 3793847..7f768fe 100644 Binary files a/graphics/languages/italian/types.png and b/graphics/languages/italian/types.png differ diff --git a/graphics/languages/japanese/button_cancel_left.png b/graphics/languages/japanese/button_cancel_left.png index 9b621e7..84b3391 100644 Binary files a/graphics/languages/japanese/button_cancel_left.png and b/graphics/languages/japanese/button_cancel_left.png differ diff --git a/graphics/languages/japanese/button_confirm_left.png b/graphics/languages/japanese/button_confirm_left.png index 1461e96..e70f8d4 100644 Binary files a/graphics/languages/japanese/button_confirm_left.png and b/graphics/languages/japanese/button_confirm_left.png differ diff --git a/graphics/languages/japanese/button_no.png b/graphics/languages/japanese/button_no.png index 4767a65..2087636 100644 Binary files a/graphics/languages/japanese/button_no.png and b/graphics/languages/japanese/button_no.png differ diff --git a/graphics/languages/japanese/button_yes.png b/graphics/languages/japanese/button_yes.png index 7aa5fb6..581033c 100644 Binary files a/graphics/languages/japanese/button_yes.png and b/graphics/languages/japanese/button_yes.png differ diff --git a/graphics/languages/japanese/dexBG.grit b/graphics/languages/japanese/dexBG.grit index 75206cd..2a3d2d2 100644 --- a/graphics/languages/japanese/dexBG.grit +++ b/graphics/languages/japanese/dexBG.grit @@ -2,5 +2,5 @@ # Text Box (Background) : 64x64t, 4bpp, SBB-layout, LZ77 compressed. # Pallet bank 2, copy from 32 to 48. # --gt -gB4 -gzl -mR4 -mLs -mp2 -mzl -ps0 -pe16 +-gt -gB4 -gzl -mR4 -mLs -mp2 -ma64 -mzl -ps0 -pe16 diff --git a/graphics/languages/japanese/dexBG.png b/graphics/languages/japanese/dexBG.png index 399a0a2..7b57011 100644 Binary files a/graphics/languages/japanese/dexBG.png and b/graphics/languages/japanese/dexBG.png differ diff --git a/graphics/languages/japanese/openingBG.grit b/graphics/languages/japanese/openingBG.grit new file mode 100644 index 0000000..2a3d2d2 --- /dev/null +++ b/graphics/languages/japanese/openingBG.grit @@ -0,0 +1,6 @@ +# +# Text Box (Background) : 64x64t, 4bpp, SBB-layout, LZ77 compressed. +# Pallet bank 2, copy from 32 to 48. +# +-gt -gB4 -gzl -mR4 -mLs -mp2 -ma64 -mzl -ps0 -pe16 + diff --git a/graphics/languages/japanese/openingBG.png b/graphics/languages/japanese/openingBG.png new file mode 100644 index 0000000..53edf53 Binary files /dev/null and b/graphics/languages/japanese/openingBG.png differ diff --git a/graphics/languages/japanese/ptgb_logo_l.png b/graphics/languages/japanese/ptgb_logo_l.png index 2477664..8510689 100644 Binary files a/graphics/languages/japanese/ptgb_logo_l.png and b/graphics/languages/japanese/ptgb_logo_l.png differ diff --git a/graphics/languages/japanese/ptgb_logo_r.png b/graphics/languages/japanese/ptgb_logo_r.png index a779749..6fef540 100644 Binary files a/graphics/languages/japanese/ptgb_logo_r.png and b/graphics/languages/japanese/ptgb_logo_r.png differ diff --git a/graphics/languages/japanese/types.png b/graphics/languages/japanese/types.png index 3793847..e3dd592 100644 Binary files a/graphics/languages/japanese/types.png and b/graphics/languages/japanese/types.png differ diff --git a/graphics/languages/korean/button_cancel_left.png b/graphics/languages/korean/button_cancel_left.png index 9b621e7..59ed89c 100644 Binary files a/graphics/languages/korean/button_cancel_left.png and b/graphics/languages/korean/button_cancel_left.png differ diff --git a/graphics/languages/korean/button_confirm_left.png b/graphics/languages/korean/button_confirm_left.png index 1461e96..4d6cf5c 100644 Binary files a/graphics/languages/korean/button_confirm_left.png and b/graphics/languages/korean/button_confirm_left.png differ diff --git a/graphics/languages/korean/button_no.png b/graphics/languages/korean/button_no.png index 4767a65..f1363b4 100644 Binary files a/graphics/languages/korean/button_no.png and b/graphics/languages/korean/button_no.png differ diff --git a/graphics/languages/korean/button_yes.png b/graphics/languages/korean/button_yes.png index 7aa5fb6..5b86cba 100644 Binary files a/graphics/languages/korean/button_yes.png and b/graphics/languages/korean/button_yes.png differ diff --git a/graphics/languages/korean/dexBG.grit b/graphics/languages/korean/dexBG.grit index 75206cd..2a3d2d2 100644 --- a/graphics/languages/korean/dexBG.grit +++ b/graphics/languages/korean/dexBG.grit @@ -2,5 +2,5 @@ # Text Box (Background) : 64x64t, 4bpp, SBB-layout, LZ77 compressed. # Pallet bank 2, copy from 32 to 48. # --gt -gB4 -gzl -mR4 -mLs -mp2 -mzl -ps0 -pe16 +-gt -gB4 -gzl -mR4 -mLs -mp2 -ma64 -mzl -ps0 -pe16 diff --git a/graphics/languages/korean/openingBG.grit b/graphics/languages/korean/openingBG.grit new file mode 100644 index 0000000..2a3d2d2 --- /dev/null +++ b/graphics/languages/korean/openingBG.grit @@ -0,0 +1,6 @@ +# +# Text Box (Background) : 64x64t, 4bpp, SBB-layout, LZ77 compressed. +# Pallet bank 2, copy from 32 to 48. +# +-gt -gB4 -gzl -mR4 -mLs -mp2 -ma64 -mzl -ps0 -pe16 + diff --git a/graphics/languages/korean/openingBG.png b/graphics/languages/korean/openingBG.png new file mode 100644 index 0000000..53edf53 Binary files /dev/null and b/graphics/languages/korean/openingBG.png differ diff --git a/graphics/languages/korean/ptgb_logo_l.png b/graphics/languages/korean/ptgb_logo_l.png index 2477664..07c2f56 100644 Binary files a/graphics/languages/korean/ptgb_logo_l.png and b/graphics/languages/korean/ptgb_logo_l.png differ diff --git a/graphics/languages/korean/ptgb_logo_r.png b/graphics/languages/korean/ptgb_logo_r.png index a779749..ff3af2a 100644 Binary files a/graphics/languages/korean/ptgb_logo_r.png and b/graphics/languages/korean/ptgb_logo_r.png differ diff --git a/graphics/languages/korean/types.png b/graphics/languages/korean/types.png index 3793847..e3dd592 100644 Binary files a/graphics/languages/korean/types.png and b/graphics/languages/korean/types.png differ diff --git a/graphics/languages/portugueseBR/button_cancel_left.png b/graphics/languages/portugueseBR/button_cancel_left.png index 9b621e7..24cac3f 100644 Binary files a/graphics/languages/portugueseBR/button_cancel_left.png and b/graphics/languages/portugueseBR/button_cancel_left.png differ diff --git a/graphics/languages/portugueseBR/button_confirm_left.png b/graphics/languages/portugueseBR/button_confirm_left.png index 1461e96..89ede01 100644 Binary files a/graphics/languages/portugueseBR/button_confirm_left.png and b/graphics/languages/portugueseBR/button_confirm_left.png differ diff --git a/graphics/languages/portugueseBR/button_no.png b/graphics/languages/portugueseBR/button_no.png index 4767a65..88ecf7f 100644 Binary files a/graphics/languages/portugueseBR/button_no.png and b/graphics/languages/portugueseBR/button_no.png differ diff --git a/graphics/languages/portugueseBR/button_yes.png b/graphics/languages/portugueseBR/button_yes.png index 7aa5fb6..ef1ea50 100644 Binary files a/graphics/languages/portugueseBR/button_yes.png and b/graphics/languages/portugueseBR/button_yes.png differ diff --git a/graphics/languages/portugueseBR/dexBG.grit b/graphics/languages/portugueseBR/dexBG.grit index 75206cd..2a3d2d2 100644 --- a/graphics/languages/portugueseBR/dexBG.grit +++ b/graphics/languages/portugueseBR/dexBG.grit @@ -2,5 +2,5 @@ # Text Box (Background) : 64x64t, 4bpp, SBB-layout, LZ77 compressed. # Pallet bank 2, copy from 32 to 48. # --gt -gB4 -gzl -mR4 -mLs -mp2 -mzl -ps0 -pe16 +-gt -gB4 -gzl -mR4 -mLs -mp2 -ma64 -mzl -ps0 -pe16 diff --git a/graphics/languages/portugueseBR/openingBG.grit b/graphics/languages/portugueseBR/openingBG.grit new file mode 100644 index 0000000..2a3d2d2 --- /dev/null +++ b/graphics/languages/portugueseBR/openingBG.grit @@ -0,0 +1,6 @@ +# +# Text Box (Background) : 64x64t, 4bpp, SBB-layout, LZ77 compressed. +# Pallet bank 2, copy from 32 to 48. +# +-gt -gB4 -gzl -mR4 -mLs -mp2 -ma64 -mzl -ps0 -pe16 + diff --git a/graphics/languages/portugueseBR/openingBG.png b/graphics/languages/portugueseBR/openingBG.png new file mode 100644 index 0000000..acdbbd2 Binary files /dev/null and b/graphics/languages/portugueseBR/openingBG.png differ diff --git a/graphics/languages/portugueseBR/types.png b/graphics/languages/portugueseBR/types.png index 3793847..b173471 100644 Binary files a/graphics/languages/portugueseBR/types.png and b/graphics/languages/portugueseBR/types.png differ diff --git a/graphics/languages/spanishEU/button_cancel_left.png b/graphics/languages/spanishEU/button_cancel_left.png index 9b621e7..24cac3f 100644 Binary files a/graphics/languages/spanishEU/button_cancel_left.png and b/graphics/languages/spanishEU/button_cancel_left.png differ diff --git a/graphics/languages/spanishEU/button_confirm_left.png b/graphics/languages/spanishEU/button_confirm_left.png index 1461e96..89ede01 100644 Binary files a/graphics/languages/spanishEU/button_confirm_left.png and b/graphics/languages/spanishEU/button_confirm_left.png differ diff --git a/graphics/languages/spanishEU/button_no.png b/graphics/languages/spanishEU/button_no.png index 4767a65..4989d45 100644 Binary files a/graphics/languages/spanishEU/button_no.png and b/graphics/languages/spanishEU/button_no.png differ diff --git a/graphics/languages/spanishEU/button_yes.png b/graphics/languages/spanishEU/button_yes.png index 7aa5fb6..a596b89 100644 Binary files a/graphics/languages/spanishEU/button_yes.png and b/graphics/languages/spanishEU/button_yes.png differ diff --git a/graphics/languages/spanishEU/dexBG.grit b/graphics/languages/spanishEU/dexBG.grit index 75206cd..2a3d2d2 100644 --- a/graphics/languages/spanishEU/dexBG.grit +++ b/graphics/languages/spanishEU/dexBG.grit @@ -2,5 +2,5 @@ # Text Box (Background) : 64x64t, 4bpp, SBB-layout, LZ77 compressed. # Pallet bank 2, copy from 32 to 48. # --gt -gB4 -gzl -mR4 -mLs -mp2 -mzl -ps0 -pe16 +-gt -gB4 -gzl -mR4 -mLs -mp2 -ma64 -mzl -ps0 -pe16 diff --git a/graphics/languages/spanishEU/openingBG.grit b/graphics/languages/spanishEU/openingBG.grit new file mode 100644 index 0000000..2a3d2d2 --- /dev/null +++ b/graphics/languages/spanishEU/openingBG.grit @@ -0,0 +1,6 @@ +# +# Text Box (Background) : 64x64t, 4bpp, SBB-layout, LZ77 compressed. +# Pallet bank 2, copy from 32 to 48. +# +-gt -gB4 -gzl -mR4 -mLs -mp2 -ma64 -mzl -ps0 -pe16 + diff --git a/graphics/languages/spanishEU/openingBG.png b/graphics/languages/spanishEU/openingBG.png new file mode 100644 index 0000000..6da4cba Binary files /dev/null and b/graphics/languages/spanishEU/openingBG.png differ diff --git a/graphics/languages/spanishEU/ptgb_logo_r.png b/graphics/languages/spanishEU/ptgb_logo_r.png index a779749..c6c38a0 100644 Binary files a/graphics/languages/spanishEU/ptgb_logo_r.png and b/graphics/languages/spanishEU/ptgb_logo_r.png differ diff --git a/graphics/languages/spanishEU/types.png b/graphics/languages/spanishEU/types.png index 3793847..c7a18dd 100644 Binary files a/graphics/languages/spanishEU/types.png and b/graphics/languages/spanishEU/types.png differ diff --git a/graphics/languages/spanishLA/button_cancel_left.png b/graphics/languages/spanishLA/button_cancel_left.png index 9b621e7..24cac3f 100644 Binary files a/graphics/languages/spanishLA/button_cancel_left.png and b/graphics/languages/spanishLA/button_cancel_left.png differ diff --git a/graphics/languages/spanishLA/button_confirm_left.png b/graphics/languages/spanishLA/button_confirm_left.png index 1461e96..89ede01 100644 Binary files a/graphics/languages/spanishLA/button_confirm_left.png and b/graphics/languages/spanishLA/button_confirm_left.png differ diff --git a/graphics/languages/spanishLA/button_no.png b/graphics/languages/spanishLA/button_no.png index 4767a65..4989d45 100644 Binary files a/graphics/languages/spanishLA/button_no.png and b/graphics/languages/spanishLA/button_no.png differ diff --git a/graphics/languages/spanishLA/button_yes.png b/graphics/languages/spanishLA/button_yes.png index 7aa5fb6..a596b89 100644 Binary files a/graphics/languages/spanishLA/button_yes.png and b/graphics/languages/spanishLA/button_yes.png differ diff --git a/graphics/languages/spanishLA/dexBG.grit b/graphics/languages/spanishLA/dexBG.grit index 75206cd..2a3d2d2 100644 --- a/graphics/languages/spanishLA/dexBG.grit +++ b/graphics/languages/spanishLA/dexBG.grit @@ -2,5 +2,5 @@ # Text Box (Background) : 64x64t, 4bpp, SBB-layout, LZ77 compressed. # Pallet bank 2, copy from 32 to 48. # --gt -gB4 -gzl -mR4 -mLs -mp2 -mzl -ps0 -pe16 +-gt -gB4 -gzl -mR4 -mLs -mp2 -ma64 -mzl -ps0 -pe16 diff --git a/graphics/languages/spanishLA/openingBG.grit b/graphics/languages/spanishLA/openingBG.grit new file mode 100644 index 0000000..2a3d2d2 --- /dev/null +++ b/graphics/languages/spanishLA/openingBG.grit @@ -0,0 +1,6 @@ +# +# Text Box (Background) : 64x64t, 4bpp, SBB-layout, LZ77 compressed. +# Pallet bank 2, copy from 32 to 48. +# +-gt -gB4 -gzl -mR4 -mLs -mp2 -ma64 -mzl -ps0 -pe16 + diff --git a/graphics/languages/spanishLA/openingBG.png b/graphics/languages/spanishLA/openingBG.png new file mode 100644 index 0000000..6da4cba Binary files /dev/null and b/graphics/languages/spanishLA/openingBG.png differ diff --git a/graphics/languages/spanishLA/ptgb_logo_r.png b/graphics/languages/spanishLA/ptgb_logo_r.png index a779749..c6c38a0 100644 Binary files a/graphics/languages/spanishLA/ptgb_logo_r.png and b/graphics/languages/spanishLA/ptgb_logo_r.png differ diff --git a/graphics/languages/spanishLA/types.png b/graphics/languages/spanishLA/types.png index 3793847..ca73657 100644 Binary files a/graphics/languages/spanishLA/types.png and b/graphics/languages/spanishLA/types.png differ diff --git a/graphics/menu_bars.grit b/graphics/menu_bars.grit index 473b559..29e9196 100644 --- a/graphics/menu_bars.grit +++ b/graphics/menu_bars.grit @@ -2,5 +2,5 @@ # Text Box (Background) : 64x64t, 4bpp, SBB-layout, not compressed. # Pallet bank 2, copy from 32 to 48. # --gt -gB4 -gzl -mR4 -mLs -mp2 -mzl -ps0 -pe16 +-gt -gB4 -gzl -mR4 -mLs -mp2 -ma64 -mzl -ps0 -pe16 diff --git a/graphics/menu_bars.png b/graphics/menu_bars.png index fc91ebe..78107b0 100644 Binary files a/graphics/menu_bars.png and b/graphics/menu_bars.png differ diff --git a/graphics/openingBG.png b/graphics/openingBG.png deleted file mode 100644 index 904f3fa..0000000 Binary files a/graphics/openingBG.png and /dev/null differ diff --git a/graphics/textBoxBG.grit b/graphics/textBoxBG.grit index 4465e6c..c58404b 100644 --- a/graphics/textBoxBG.grit +++ b/graphics/textBoxBG.grit @@ -2,5 +2,5 @@ # Text Box (Background) : 64x64t, 4bpp, SBB-layout, LZ77 compressed. # Pallet bank 1, copy from 16 to 32. # --gt -gB4 -gzl -mR4 -mLs -mp1 -mzl -ps0 -pe16 +-gt -gB4 -gzl -mR4 -mLs -mp1 -ma38 -mzl -ps0 -pe16 diff --git a/include/Gen3CartridgeSaveReader.h b/include/Gen3CartridgeSaveReader.h index a8bad58..dc10807 100644 --- a/include/Gen3CartridgeSaveReader.h +++ b/include/Gen3CartridgeSaveReader.h @@ -47,6 +47,11 @@ public: * @brief Flush the current buffer to the cartridge save. */ void flush(); + + /** + * @brief Indicates whether the Gen3SaveManager should recalculate checksums when finishSave is called. + */ + bool shouldRecalculateChecksumsOnFinish() const; protected: private: uintptr_t sector_start_; diff --git a/include/button_menu.h b/include/button_menu.h index 41867b3..0aea43c 100644 --- a/include/button_menu.h +++ b/include/button_menu.h @@ -13,6 +13,7 @@ #define BTN_CREDITS 4 #define BTN_OPENING 5 #define BTN_DEBUG_MENU 6 +#define BTN_TUTORIAL 7 #define BUTTON_CANCEL UINT8_MAX diff --git a/include/dbg/debug_menu.h b/include/dbg/debug_menu.h index 3eaac91..2bf8880 100644 --- a/include/dbg/debug_menu.h +++ b/include/dbg/debug_menu.h @@ -2,6 +2,9 @@ #define _DEBUG_MENU_H #include "vertical_menu.h" +#include "debug_menu_entries.h" + +#define MAX_MENU_LAYERS 3 // This file contains the implementation of the debug menu. // But it doesn't actually define the entries or callback functions. @@ -100,5 +103,6 @@ private: }; void show_debug_menu(); +void push_debug_menu_section(DebugMenuSection section); #endif \ No newline at end of file diff --git a/include/dbg/debug_menu_entries.h b/include/dbg/debug_menu_entries.h index b820d7e..f6e02a0 100644 --- a/include/dbg/debug_menu_entries.h +++ b/include/dbg/debug_menu_entries.h @@ -5,9 +5,26 @@ class vertical_menu; +enum class DebugMenuSection +{ + MAIN, + INJECTION +}; + +/** + * @brief This function pointer is used to define a function filling a specifi DebugMenuSection + */ +typedef void (*fill_menu_entries_func)(vertical_menu &menu, u16 *charset); + +typedef struct MenuSectionMapEntry +{ + DebugMenuSection section; + fill_menu_entries_func fill_func; +} MenuSectionMapEntry; + /** * @brief This function constructs the actual debug menu entries and fills the provided menu with them. */ -void fill_debug_menu_with_entries(vertical_menu &menu, u16 *charset); +void fill_debug_menu_with_entries(vertical_menu &menu, u16 *charset, DebugMenuSection section); #endif \ No newline at end of file diff --git a/include/dbg/debug_menu_functions.h b/include/dbg/debug_menu_functions.h index 505eae9..1132e5a 100644 --- a/include/dbg/debug_menu_functions.h +++ b/include/dbg/debug_menu_functions.h @@ -3,6 +3,13 @@ // Here we define debug menu callback functions, to be used as on_execute_callback or on_option_activate in the debug menu entries. +/** + * @brief Shows a submenu + * + * @param user_param the DebugMenuSection enum value corresponding to the submenu to show. + */ +void show_debug_menu_section(void *context, unsigned user_param); + /** * @brief This function will open the text debug screen. */ @@ -35,4 +42,7 @@ void dbg_inject_pkmn(void *context, unsigned user_param); void dbg_unlock_mystery(void *context, unsigned user_param); +void dbg_inject_wc3(void *context, unsigned user_param); +void dbg_inject_me3(void *context, unsigned user_param); + #endif \ No newline at end of file diff --git a/include/dbg/eon_ticket_rs.h b/include/dbg/eon_ticket_rs.h new file mode 100644 index 0000000..6d90f0c --- /dev/null +++ b/include/dbg/eon_ticket_rs.h @@ -0,0 +1,70 @@ +#include "typeDefs.h" + +// array size is 1012 +// Downloaded from the projectpokemon.org website +static const u8 RS_Item_Eon_Ticket_e_Card_ENG_US_[] = { + 0x10, 0xea, 0x00, 0x00, 0x33, 0x08, 0x01, 0x01, 0xb8, 0x61, 0x00, 0x00, 0x02, 0x47, 0x13, 0x01, + 0x01, 0x00, 0x21, 0x0d, 0x80, 0x01, 0x00, 0xbb, 0x01, 0xbf, 0x00, 0x00, 0x02, 0x4a, 0x13, 0x01, + 0x01, 0x00, 0x21, 0x0d, 0x80, 0x01, 0x00, 0xbb, 0x01, 0xbf, 0x00, 0x00, 0x02, 0x2b, 0xce, 0x00, + 0xbb, 0x01, 0xbf, 0x00, 0x00, 0x02, 0x6a, 0x5a, 0xbd, 0xc9, 0x00, 0x00, 0x02, 0x66, 0x6d, 0x46, + 0x13, 0x01, 0x01, 0x00, 0x21, 0x0d, 0x80, 0x00, 0x00, 0xbb, 0x01, 0xc0, 0x00, 0x00, 0x02, 0x1a, + 0x00, 0x80, 0x13, 0x01, 0x1a, 0x01, 0x80, 0x01, 0x00, 0x09, 0x00, 0x29, 0x53, 0x08, 0xbd, 0x04, + 0x01, 0x00, 0x02, 0x66, 0x6d, 0x6c, 0x0d, 0xbd, 0x83, 0x01, 0x00, 0x02, 0x66, 0x6d, 0x6c, 0x02, + 0xbe, 0xbb, 0xbe, 0xb1, 0xfd, 0x01, 0xab, 0x00, 0xc1, 0xe3, 0xe3, 0xd8, 0x00, 0xe8, 0xe3, 0x00, + 0xe7, 0xd9, 0xd9, 0x00, 0xed, 0xe3, 0xe9, 0xab, 0xfe, 0xce, 0xdc, 0xd9, 0xe6, 0xd9, 0xb4, 0xe7, + 0x00, 0xd5, 0x00, 0xe0, 0xd9, 0xe8, 0xe8, 0xd9, 0xe6, 0x00, 0xdc, 0xd9, 0xe6, 0xd9, 0x00, 0xda, + 0xe3, 0xe6, 0x00, 0xed, 0xe3, 0xe9, 0xb8, 0xfd, 0x01, 0xad, 0xff, 0xbe, 0xbb, 0xbe, 0xb1, 0xc3, + 0xe8, 0x00, 0xd5, 0xe4, 0xe4, 0xd9, 0xd5, 0xe6, 0xe7, 0x00, 0xe8, 0xe3, 0x00, 0xd6, 0xd9, 0x00, + 0xd5, 0x00, 0xda, 0xd9, 0xe6, 0xe6, 0xed, 0x00, 0xce, 0xc3, 0xbd, 0xc5, 0xbf, 0xce, 0xad, 0xfe, + 0xd6, 0xe9, 0xe8, 0x00, 0xc3, 0xb4, 0xea, 0xd9, 0x00, 0xe2, 0xd9, 0xea, 0xd9, 0xe6, 0x00, 0xe7, + 0xd9, 0xd9, 0xe2, 0x00, 0xe3, 0xe2, 0xd9, 0x00, 0xe0, 0xdd, 0xdf, 0xd9, 0x00, 0xdd, 0xe8, 0x00, + 0xd6, 0xd9, 0xda, 0xe3, 0xe6, 0xd9, 0xad, 0xfa, 0xd3, 0xe3, 0xe9, 0x00, 0xe7, 0xdc, 0xe3, 0xe9, + 0xe0, 0xd8, 0x00, 0xea, 0xdd, 0xe7, 0xdd, 0xe8, 0x00, 0xc6, 0xc3, 0xc6, 0xd3, 0xbd, 0xc9, 0xd0, + 0xbf, 0x00, 0xd5, 0xe2, 0xd8, 0x00, 0xd5, 0xe7, 0xdf, 0xfe, 0xd5, 0xd6, 0xe3, 0xe9, 0xe8, 0x00, + 0xdd, 0xe8, 0x00, 0xe8, 0xdc, 0xd9, 0xe6, 0xd9, 0xad, 0xff, 0xbe, 0xbb, 0xbe, 0xb1, 0xfd, 0x01, + 0xb4, 0x00, 0xe8, 0xdc, 0xd9, 0x00, 0xc5, 0xbf, 0xd3, 0x00, 0xc3, 0xce, 0xbf, 0xc7, 0xcd, 0x00, + 0xca, 0xc9, 0xbd, 0xc5, 0xbf, 0xce, 0x00, 0xdd, 0xe2, 0xfe, 0xed, 0xe3, 0xe9, 0xe6, 0x00, 0xbc, + 0xbb, 0xc1, 0x00, 0xdd, 0xe7, 0x00, 0xda, 0xe9, 0xe0, 0xe0, 0xad, 0xfb, 0xc7, 0xe3, 0xea, 0xd9, + 0x00, 0xe7, 0xe3, 0xe1, 0xd9, 0x00, 0xdf, 0xd9, 0xed, 0x00, 0xdd, 0xe8, 0xd9, 0xe1, 0xe7, 0x00, + 0xda, 0xe3, 0xe6, 0x00, 0xe7, 0xd5, 0xda, 0xd9, 0xdf, 0xd9, 0xd9, 0xe4, 0xdd, 0xe2, 0xdb, 0xfe, + 0xdd, 0xe2, 0x00, 0xed, 0xe3, 0xe9, 0xe6, 0x00, 0xca, 0xbd, 0xb4, 0x00, 0xe8, 0xdc, 0xd9, 0xe2, + 0x00, 0xd7, 0xe3, 0xe1, 0xd9, 0x00, 0xe7, 0xd9, 0xd9, 0x00, 0xe1, 0xd9, 0xad, 0xff, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x33, 0x00, 0x00, 0x00, + 0x01, 0x1e, 0x13, 0x01 +}; \ No newline at end of file diff --git a/include/dbg/old_sea_map.h b/include/dbg/old_sea_map.h new file mode 100644 index 0000000..1339a78 --- /dev/null +++ b/include/dbg/old_sea_map.h @@ -0,0 +1,95 @@ +#include "typeDefs.h" + +// array size is 1420 +// Taken from WC3Tool 0.1f: https://github.com/projectpokemon/Gen3-WCTool/releases/tag/0.1f +static const u8 OldSeaMap_E_custom[] = { + 0xcf, 0xa6, 0x00, 0x00, 0xba, 0xb4, 0xbe, 0xb9, 0x00, 0x00, 0x00, 0x00, 0x8c, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0xb1, 0xc9, 0xc6, 0xbe, 0x00, 0xcd, 0xbf, 0xbb, 0x00, 0xc7, 0xbb, + 0xca, 0xb2, 0x00, 0xbd, 0xe9, 0xe7, 0xe8, 0xe3, 0xe1, 0x00, 0xbd, 0xd5, 0xe6, 0xd8, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xce, 0xdc, 0xdd, 0xe7, 0x00, 0xd1, 0xe3, 0xe2, + 0xd8, 0xd9, 0xe6, 0xd7, 0xd5, 0xe6, 0xd8, 0x00, 0xdd, 0xe7, 0x00, 0xdd, 0xe0, 0xe0, 0xd9, 0xdb, + 0xd5, 0xe0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc1, 0xe3, + 0x00, 0xe8, 0xe3, 0x00, 0xe8, 0xdc, 0xd9, 0x00, 0xe7, 0xd9, 0xd7, 0xe3, 0xe2, 0xd8, 0x00, 0xda, + 0xe0, 0xe3, 0xe3, 0xe6, 0x00, 0xe3, 0xda, 0x00, 0xe8, 0xdc, 0xd9, 0x00, 0xca, 0xc9, 0xc5, 0x1b, + 0xc7, 0xc9, 0xc8, 0x00, 0x00, 0x00, 0xbd, 0xbf, 0xc8, 0xce, 0xbf, 0xcc, 0x00, 0xd5, 0xe2, 0xd8, + 0x00, 0xe1, 0xd9, 0xd9, 0xe8, 0x00, 0xe8, 0xdc, 0xd9, 0x00, 0xd8, 0xd9, 0xe0, 0xdd, 0xea, 0xd9, + 0xe6, 0xed, 0x00, 0xe4, 0xd9, 0xe6, 0xe7, 0xe3, 0xe2, 0x00, 0xdd, 0xe2, 0x00, 0x00, 0xdb, 0xe6, + 0xd9, 0xd9, 0xe2, 0xad, 0x00, 0xcc, 0xd9, 0xd7, 0xd9, 0xdd, 0xea, 0xd9, 0x00, 0xe8, 0xdc, 0xd9, + 0x00, 0xc9, 0xc6, 0xbe, 0x00, 0xcd, 0xbf, 0xbb, 0x00, 0xc7, 0xbb, 0xca, 0x00, 0xd5, 0xe2, 0xd8, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xe8, 0xdc, 0xd9, 0xe2, 0x00, 0xe7, 0xd5, 0xea, 0xd9, 0x00, + 0xe8, 0xdc, 0xd9, 0x00, 0xdb, 0xd5, 0xe1, 0xd9, 0xab, 0xab, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xbe, 0xe3, + 0x00, 0xe2, 0xe3, 0xe8, 0x00, 0xe8, 0xe3, 0xe7, 0xe7, 0x00, 0xe8, 0xdc, 0xdd, 0xe7, 0x00, 0xbf, + 0xec, 0xd7, 0xdc, 0xd5, 0xe2, 0xdb, 0xd9, 0x00, 0xbd, 0xd5, 0xe6, 0xd8, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xd6, 0xd9, 0xda, 0xe3, 0xe6, 0xd9, 0x00, 0xe6, 0xd9, 0xd7, + 0xd9, 0xdd, 0xea, 0xdd, 0xe2, 0xdb, 0x00, 0xe8, 0xdc, 0xd9, 0x00, 0xc9, 0xc6, 0xbe, 0x00, 0xcd, + 0xbf, 0xbb, 0x00, 0xc7, 0xbb, 0xca, 0xab, 0xab, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x88, 0x37, 0x00, 0x00, 0x33, 0xff, 0xff, 0xff, 0xb8, 0xf4, 0x57, 0x67, 0x08, 0x6a, 0x5a, 0x2b, + 0x3c, 0x01, 0xbb, 0x01, 0x58, 0x58, 0x67, 0x08, 0x2b, 0xca, 0x01, 0xbb, 0x01, 0x58, 0x58, 0x67, + 0x08, 0x47, 0x78, 0x01, 0x01, 0x00, 0x21, 0x0d, 0x80, 0x01, 0x00, 0xbb, 0x01, 0x58, 0x58, 0x67, + 0x08, 0xbd, 0x61, 0x58, 0x67, 0x08, 0x66, 0x6d, 0x46, 0x78, 0x01, 0x01, 0x00, 0x21, 0x0d, 0x80, + 0x00, 0x00, 0xbb, 0x01, 0x4f, 0x58, 0x67, 0x08, 0x1a, 0x00, 0x80, 0x78, 0x01, 0x1a, 0x01, 0x80, + 0x01, 0x00, 0x09, 0x00, 0x29, 0xd6, 0x08, 0x29, 0x3c, 0x01, 0xbd, 0xd9, 0x58, 0x67, 0x08, 0x66, + 0x6d, 0x6c, 0x02, 0xbd, 0x6a, 0x59, 0x67, 0x08, 0x66, 0x6d, 0x6c, 0x02, 0xbd, 0x3d, 0x59, 0x67, + 0x08, 0x66, 0x6d, 0x6c, 0x02, 0xce, 0xdc, 0xd5, 0xe2, 0xdf, 0x00, 0xed, 0xe3, 0xe9, 0x00, 0xda, + 0xe3, 0xe6, 0x00, 0xe9, 0xe7, 0xdd, 0xe2, 0xdb, 0x00, 0xe8, 0xdc, 0xd9, 0x00, 0xc7, 0xd3, 0xcd, + 0xce, 0xbf, 0xcc, 0xd3, 0xfe, 0xc1, 0xc3, 0xc0, 0xce, 0x00, 0xcd, 0xed, 0xe7, 0xe8, 0xd9, 0xe1, + 0xad, 0xfb, 0xc6, 0xd9, 0xe8, 0x00, 0xe1, 0xd9, 0x00, 0xd7, 0xe3, 0xe2, 0xda, 0xdd, 0xe6, 0xe1, + 0xae, 0xae, 0xed, 0xe3, 0xe9, 0x00, 0xd5, 0xe6, 0xd9, 0x00, 0xfd, 0x01, 0xac, 0xfb, 0xd1, 0xd9, + 0x00, 0xe6, 0xd9, 0xd7, 0xd9, 0xdd, 0xea, 0xd9, 0xd8, 0x00, 0xe8, 0xdc, 0xdd, 0xe7, 0x00, 0xc9, + 0xc6, 0xbe, 0x00, 0xcd, 0xbf, 0xbb, 0x00, 0xc7, 0xbb, 0xca, 0xfe, 0xd5, 0xd8, 0xd8, 0xe6, 0xd9, + 0xe7, 0xe7, 0xd9, 0xd8, 0x00, 0xe8, 0xe3, 0x00, 0xed, 0xe3, 0xe9, 0xad, 0xff, 0xc3, 0xe8, 0x00, + 0xd5, 0xe4, 0xe4, 0xd9, 0xd5, 0xe6, 0xe7, 0x00, 0xe8, 0xe3, 0x00, 0xd6, 0xd9, 0x00, 0xda, 0xe3, + 0xe6, 0x00, 0xe9, 0xe7, 0xd9, 0x00, 0xd5, 0xe8, 0x00, 0xe8, 0xdc, 0xd9, 0xfe, 0xc6, 0xc3, 0xc6, + 0xd3, 0xbd, 0xc9, 0xd0, 0xbf, 0x00, 0xbd, 0xc3, 0xce, 0xd3, 0x00, 0xe4, 0xe3, 0xe6, 0xe8, 0xad, + 0xfb, 0xd1, 0xdc, 0xed, 0x00, 0xe2, 0xe3, 0xe8, 0x00, 0xdb, 0xdd, 0xea, 0xd9, 0x00, 0xdd, 0xe8, + 0x00, 0xd5, 0x00, 0xe8, 0xe6, 0xed, 0x00, 0xd5, 0xe2, 0xd8, 0x00, 0xe7, 0xd9, 0xd9, 0x00, 0xeb, + 0xdc, 0xd5, 0xe8, 0xfe, 0xdd, 0xe8, 0x00, 0xdd, 0xe7, 0x00, 0xd5, 0xd6, 0xe3, 0xe9, 0xe8, 0xac, + 0xff, 0xce, 0xdc, 0xd5, 0xe2, 0xdf, 0x00, 0xed, 0xe3, 0xe9, 0x00, 0xda, 0xe3, 0xe6, 0x00, 0xe9, + 0xe7, 0xdd, 0xe2, 0xdb, 0x00, 0xe8, 0xdc, 0xd9, 0x00, 0xc7, 0xd3, 0xcd, 0xce, 0xbf, 0xcc, 0xd3, + 0xfe, 0xc1, 0xc3, 0xc0, 0xce, 0x00, 0xcd, 0xed, 0xe7, 0xe8, 0xd9, 0xe1, 0xad, 0xff, 0xc9, 0xdc, + 0xb8, 0x00, 0xc3, 0xb4, 0xe1, 0x00, 0xe7, 0xe3, 0xe6, 0xe6, 0xed, 0xb8, 0x00, 0xfd, 0x01, 0xad, + 0xfe, 0xd3, 0xe3, 0xe9, 0xe6, 0x00, 0xbc, 0xbb, 0xc1, 0xb4, 0xe7, 0x00, 0xc5, 0xbf, 0xd3, 0x00, + 0xc3, 0xce, 0xbf, 0xc7, 0xcd, 0x00, 0xca, 0xc9, 0xbd, 0xc5, 0xbf, 0xce, 0x00, 0xdd, 0xe7, 0x00, + 0xda, 0xe9, 0xe0, 0xe0, 0xad, 0xfb, 0xca, 0xe0, 0xd9, 0xd5, 0xe7, 0xd9, 0x00, 0xe7, 0xe8, 0xe3, + 0xe6, 0xd9, 0x00, 0xe7, 0xe3, 0xe1, 0xd9, 0xe8, 0xdc, 0xdd, 0xe2, 0xdb, 0x00, 0xe3, 0xe2, 0x00, + 0xed, 0xe3, 0xe9, 0xe6, 0x00, 0xca, 0xbd, 0xb8, 0xfe, 0xe8, 0xdc, 0xd9, 0xe2, 0x00, 0xd7, 0xe3, + 0xe1, 0xd9, 0x00, 0xd6, 0xd5, 0xd7, 0xdf, 0x00, 0xda, 0xe3, 0xe6, 0x00, 0xe8, 0xdc, 0xdd, 0xe7, + 0xad, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 +}; \ No newline at end of file diff --git a/include/sprite_data.h b/include/sprite_data.h index b3e85e7..49c6db3 100644 --- a/include/sprite_data.h +++ b/include/sprite_data.h @@ -114,6 +114,34 @@ extern OBJ_ATTR *grabbed_front_sprite; #define FLEXBG_MAIN_MENU 3 #define FLEXBG_BOX 4 +// +// VRAM usage is heavily optimized so the rest of it can be used +// as additional work RAM in the future. +// +// VRAM Map +// 06000000 - 06000800 ( 2K): Eternal backdrop and textbox tileset +// 06000800 - 06002000 ( 6K): Flex BG tileset +// 06002000 - 06002400 ( 2K): BG0: Backdrop tilemap +// 06002800 - 06003000 ( 2K): BG1: Flex BG tilemap +// 06003000 - 06003800 ( 2K): BG2: Textbox tilemap +// 06003800 - 06004000 ( 2K): BG3: Text tilemap +// 06004000 -~06009000 (20K): Text rendering bitmap +// 06009000 - 06010000 (28K): Free work RAM (watch the 16-bit bus!) +// 06010000 - 06018000 (32K): Sprite tileset +// + +#define TILESET_PTGB 0 +#define TILESET_TEXT 1 + +#define TILESET_OFFSET_BACKDROP 0 +#define TILESET_OFFSET_TEXTBOX 38 +#define TILESET_OFFSET_FLEXBG 64 + +#define TILEMAP_BACKDROP 4 +#define TILEMAP_FLEXBG 5 +#define TILEMAP_TEXTBOX 6 +#define TILEMAP_TEXT 7 + extern rom_data curr_GBA_rom; void load_sprite(OBJ_ATTR *sprite, const unsigned int objTiles[], int objTilesLen, diff --git a/include/text_engine.h b/include/text_engine.h index befd74e..9af6e83 100644 --- a/include/text_engine.h +++ b/include/text_engine.h @@ -23,7 +23,7 @@ int ptgb_write_textbox(const byte *text, bool instant, bool waitForUser, int tex int ptgb_write_simple(const byte *text, bool instant); int ptgb_write(const byte *text, bool instant, int length, int box_type); int ptgb_write_debug(const u16* charset, const char *text, bool instant); -void wait_for_user_to_continue(); +void wait_for_user_to_continue(int right, int bottom); void scroll_text(bool instant, TTC *tc, bool scrollUp, int left, int top, int right, int bottom); #endif \ No newline at end of file diff --git a/include/vertical_menu.h b/include/vertical_menu.h index 782b32b..52cca43 100644 --- a/include/vertical_menu.h +++ b/include/vertical_menu.h @@ -235,7 +235,7 @@ private: vertical_menu_settings settings_; i_vertical_menu_state_changed_handler *state_changed_handler_; i_run_cycle_handler *run_cycle_handler_; - unsigned focused_index_; + int focused_index_; unsigned viewport_start_index_; ptgb::vector items_; bool is_focused_; diff --git a/source/Gen3CartridgeSaveReader.cpp b/source/Gen3CartridgeSaveReader.cpp index 6b92ebc..d5ea6c7 100644 --- a/source/Gen3CartridgeSaveReader.cpp +++ b/source/Gen3CartridgeSaveReader.cpp @@ -147,4 +147,9 @@ void Gen3CartridgeSaveReader::flush() erase_sector(sector_start_); copy_ram_to_save(sector_buffer_, sector_start_, SECTOR_SIZE); dirty_ = false; +} + +bool Gen3CartridgeSaveReader::shouldRecalculateChecksumsOnFinish() const +{ + return false; } \ No newline at end of file diff --git a/source/dbg/debug_menu.cpp b/source/dbg/debug_menu.cpp index b50b6f2..07868a5 100644 --- a/source/dbg/debug_menu.cpp +++ b/source/dbg/debug_menu.cpp @@ -1,6 +1,5 @@ #include "dbg/debug_menu.h" #include "dbg/debug_menu_functions.h" -#include "dbg/debug_menu_entries.h" #include "sprite_data.h" #include "background_engine.h" #include "vertical_menu_cursor_handler.h" @@ -13,11 +12,21 @@ static on_execute_callback delayed_execute_callback = nullptr; static void *delayed_execute_context = nullptr; static unsigned delayed_execute_user_param = 0; -void show_debug_menu() +// the menu can be MAX_MENU_LAYERS layers deep. +static DebugMenuSection current_menu_section[MAX_MENU_LAYERS]; +static unsigned current_menu_section_stack_size; + +static void pop_submenu() +{ + --current_menu_section_stack_size; +} + +static __attribute__((noinline)) void show_debug_menu_internal(DebugMenuSection sectionType) { u16 charset[256]; const s16 cursor_offset_x = 3; const s16 cursor_offset_y = 6; + unsigned ret; load_localized_charset(charset, 3, ENGLISH); tte_erase_rect(0, 0, H_MAX, V_MAX); @@ -46,10 +55,10 @@ void show_debug_menu() vertical_menu debug_menu(menu_settings); debug_menu.set_state_changed_handler(&cursor_handler); - fill_debug_menu_with_entries(debug_menu, charset); + fill_debug_menu_with_entries(debug_menu, charset, sectionType); debug_menu.show(); - debug_menu.run(); + ret = debug_menu.run(); debug_menu.hide(); obj_hide(toggle_arrow_left); @@ -67,6 +76,25 @@ void show_debug_menu() delayed_execute_context = nullptr; delayed_execute_user_param = 0; } + else if(ret == UINT32_MAX) + { + // if the user cancelled out of the menu, we pop the submenu stack to go back to the previous menu. + pop_submenu(); + } +} + +void show_debug_menu() +{ + DebugMenuSection curr_section; + + current_menu_section_stack_size = 0; + push_debug_menu_section(DebugMenuSection::MAIN); + while(current_menu_section_stack_size > 0) + { + curr_section = current_menu_section[current_menu_section_stack_size - 1]; + show_debug_menu_internal(curr_section); + } + } debug_menu_row_widget::debug_menu_row_widget(const debug_menu_row_data &data) @@ -173,4 +201,14 @@ MenuInputHandleState debug_menu_row_widget::handle_input() } return MenuInputHandleState::NOT_HANDLED; +} + +void push_debug_menu_section(DebugMenuSection section) +{ + constexpr size_t num_levels = sizeof(current_menu_section) / sizeof(current_menu_section[0]); + if(current_menu_section_stack_size < num_levels) + { + current_menu_section[current_menu_section_stack_size] = section; + ++current_menu_section_stack_size; + } } \ No newline at end of file diff --git a/source/dbg/debug_menu_entries.cpp b/source/dbg/debug_menu_entries.cpp index 080fc63..db81377 100644 --- a/source/dbg/debug_menu_entries.cpp +++ b/source/dbg/debug_menu_entries.cpp @@ -7,6 +7,11 @@ #include +#if ENABLE_MYSTERY_GIFT +#include "dbg/old_sea_map.h" +#include "dbg/eon_ticket_rs.h" +#endif + static const option_data toggle_options[] = { { .text = "Off", @@ -18,6 +23,20 @@ static const option_data toggle_options[] = { } }; +static void fill_debug_menu_with_main_menu_entries(vertical_menu &menu, u16 *charset); +static void fill_debug_menu_with_injection_entries(vertical_menu &menu, u16 *charset); + +static const MenuSectionMapEntry menu_section_map[] = { + { + .section = DebugMenuSection::MAIN, + .fill_func = fill_debug_menu_with_main_menu_entries + }, + { + .section = DebugMenuSection::INJECTION, + .fill_func = fill_debug_menu_with_injection_entries + } +}; + static const option_data cbl_data_options[] = { { .text = "Off", @@ -109,17 +128,15 @@ static debug_menu_row_widget* __attribute__((noinline)) define_executable_row(co return new debug_menu_row_widget(row_data); } -// Here we define the actual entries of the debug menu, using the helper functions defined above. -void fill_debug_menu_with_entries(vertical_menu &menu, u16 *charset) +/// Here we define the actual entries of the main debug menu, using the helper functions defined above. +static void fill_debug_menu_with_main_menu_entries(vertical_menu &menu, u16 *charset) { i_item_widget* item_widgets[] = { #if ENABLE_TEXT_DEBUG_SCREEN define_executable_row(charset, "Text Debug", show_text_debug_screen, 0, nullptr), #endif define_executable_row(charset, "Info", show_debug_info_screen, 0, nullptr), -#if ENABLE_DEBUG_PKMN_INJECTION - define_executable_row(charset, "Inject Celebi", dbg_inject_pkmn, 0, nullptr), -#endif + define_executable_row(charset, "Injection", show_debug_menu_section, static_cast(DebugMenuSection::INJECTION), nullptr), #if ENABLE_MYSTERY_GIFT define_executable_row(charset, "Unlock MystE", dbg_unlock_mystery, 0, nullptr), define_executable_row(charset, "Unlock MystG", dbg_unlock_mystery, 1, nullptr), @@ -143,4 +160,37 @@ void fill_debug_menu_with_entries(vertical_menu &menu, u16 *charset) }; menu.add_item_widgets(item_widgets, sizeof(item_widgets) / sizeof(item_widgets[0])); +} + +/// This function defines the entries of the injection submenu +static void fill_debug_menu_with_injection_entries(vertical_menu &menu, u16 *charset) +{ + i_item_widget* item_widgets[] = { +#if ENABLE_DEBUG_PKMN_INJECTION + define_executable_row(charset, "Inject Celebi", dbg_inject_pkmn, 0, nullptr), +#endif +#if ENABLE_MYSTERY_GIFT + define_executable_row(charset, "Unlock MystE", dbg_unlock_mystery, 0, nullptr), + define_executable_row(charset, "Unlock MystG", dbg_unlock_mystery, 1, nullptr), + define_executable_row(charset, "Inj OldSeaMap(E)", dbg_inject_wc3, sizeof(OldSeaMap_E_custom), const_cast(OldSeaMap_E_custom)), + define_executable_row(charset, "Inj Eon Ticket(RS)", dbg_inject_me3, sizeof(RS_Item_Eon_Ticket_e_Card_ENG_US_), const_cast(RS_Item_Eon_Ticket_e_Card_ENG_US_)), + +#endif + }; + menu.add_item_widgets(item_widgets, sizeof(item_widgets) / sizeof(item_widgets[0])); +} + +void fill_debug_menu_with_entries(vertical_menu &menu, u16 *charset, DebugMenuSection section) +{ + const size_t num_sections = sizeof(menu_section_map) / sizeof(menu_section_map[0]); + size_t i = 0; + while(i < num_sections) + { + if(menu_section_map[i].section == section) + { + menu_section_map[i].fill_func(menu, charset); + break; + } + ++i; + } } \ No newline at end of file diff --git a/source/dbg/debug_menu_functions.cpp b/source/dbg/debug_menu_functions.cpp index 0ee0892..bc1fc6c 100644 --- a/source/dbg/debug_menu_functions.cpp +++ b/source/dbg/debug_menu_functions.cpp @@ -1,4 +1,5 @@ #include "dbg/debug_menu_functions.h" +#include "dbg/debug_menu.h" #include "libraries/nanoprintf/nanoprintf.h" #include "text_engine.h" #include "pokemon_data.h" @@ -97,6 +98,13 @@ static void convert_OT_to_utf8(const u8 *encoded_OT, u8 *output_buffer, const u1 *cur_out = '\0'; } +void show_debug_menu_section(void *context, unsigned user_param) +{ + (void)context; // unused + const DebugMenuSection section_to_show = static_cast(user_param); + push_debug_menu_section(section_to_show); +} + void show_text_debug_screen(void *context, unsigned user_param) { (void)context; @@ -271,7 +279,7 @@ void dbg_inject_pkmn(void *context, unsigned user_param) npf_snprintf(text_buffer, sizeof(text_buffer), "%s received a Celebi!\n Celebi was sent to box %d!", decoded_OT_utf8, boxIndex); ptgb_write_debug(tables.gen3_charset, text_buffer, false); - wait_for_user_to_continue(); + wait_for_user_to_continue(H_MAX, V_MAX); if(!g_debug_options.ignore_game_pak && !g_debug_options.ignore_game_pak_sprites) { @@ -309,6 +317,58 @@ void dbg_unlock_mystery(void *context, unsigned user_param) save_manager.setMysteryEventUnlocked(user_param == 0); save_manager.setMysteryGiftUnlocked(user_param != 0); + save_manager.finishSave(); + reader.flush(); +} + +void dbg_inject_wc3(void *context, unsigned user_param) +{ + const u8* wc3_data_ptr = reinterpret_cast(context); + size_t wc3_data_size = user_param; + if(wc3_data_ptr == nullptr) + { + return; + } + + const Game game_type = convert_rom_game_id_to_ptgb_game(curr_GBA_rom.gamecode); + if(game_type != EMERALD) + { + return; + } + + const Language game_lang = convert_rom_lang_to_ptgb_lang(curr_GBA_rom.language); + Gen3CartridgeSaveReader reader(global_memory_buffer); + Gen3SaveManager save_manager(game_type, game_lang, reader); + + save_manager.setMysteryGiftUnlocked(user_param != 0); + save_manager.injectMysteryGift(wc3_data_ptr, wc3_data_size); + + save_manager.finishSave(); + reader.flush(); +} + +void dbg_inject_me3(void *context, unsigned user_param) +{ + const u8* me3_data_ptr = reinterpret_cast(context); + size_t me3_data_size = user_param; + if(me3_data_ptr == nullptr) + { + return; + } + + const Game game_type = convert_rom_game_id_to_ptgb_game(curr_GBA_rom.gamecode); + if(game_type != RUBY && game_type != SAPPHIRE) + { + return; + } + + const Language game_lang = convert_rom_lang_to_ptgb_lang(curr_GBA_rom.language); + Gen3CartridgeSaveReader reader(global_memory_buffer); + Gen3SaveManager save_manager(game_type, game_lang, reader); + + save_manager.setMysteryEventUnlocked(true); + save_manager.injectMysteryEvent(me3_data_ptr, me3_data_size); + save_manager.finishSave(); reader.flush(); } \ No newline at end of file diff --git a/source/main.cpp b/source/main.cpp index 8f4408a..eba8c1d 100644 --- a/source/main.cpp +++ b/source/main.cpp @@ -206,14 +206,96 @@ int __attribute__((noinline)) credits() } }; +int tutorial() +{ + u8 text_decompression_buffer[2048]; + text_data_table tutorial_text_table(text_decompression_buffer); + int curr_tutorial_num = 0; + + tutorial_text_table.decompress(get_compressed_text_table(TUTORIAL_INDEX)); + bool update = true; + + global_next_frame(); + while (true) + { + if (update) + { + ptgb_write_textbox(tutorial_text_table.get_text_entry(curr_tutorial_num), true, false, + TUTORIAL_INDEX, curr_tutorial_num, false); + update = false; + } + + if (key_hit(KEY_B)) + { + tte_erase_rect(0, 0, H_MAX, V_MAX); + hide_textbox(); + erase_textbox_tiles(); + return 0; + } + if (key_hit(KEY_LEFT) && curr_tutorial_num > 0) + { + curr_tutorial_num--; + update = true; + } + if (key_hit(KEY_RIGHT) && curr_tutorial_num < (tutorial_text_table.get_number_of_text_entries() - 1)) + { + curr_tutorial_num++; + update = true; + } + + VBlankIntrWait(); + } +}; + +int tutorial() +{ + u8 text_decompression_buffer[2048]; + text_data_table tutorial_text_table(text_decompression_buffer); + int curr_tutorial_num = 0; + + tutorial_text_table.decompress(get_compressed_text_table(TUTORIAL_INDEX)); + bool update = true; + + global_next_frame(); + while (true) + { + if (update) + { + ptgb_write_textbox(tutorial_text_table.get_text_entry(curr_tutorial_num), true, false, + TUTORIAL_INDEX, curr_tutorial_num, false); + update = false; + } + + if (key_hit(KEY_B)) + { + tte_erase_rect(0, 0, H_MAX, V_MAX); + hide_textbox(); + erase_textbox_tiles(); + return 0; + } + if (key_hit(KEY_LEFT) && curr_tutorial_num > 0) + { + curr_tutorial_num--; + update = true; + } + if (key_hit(KEY_RIGHT) && curr_tutorial_num < (tutorial_text_table.get_number_of_text_entries() - 1)) + { + curr_tutorial_num++; + update = true; + } + + global_next_frame(); + } +}; + // attribute noinline is used to avoid permanently storing the general_text_table_buffer in IWRAM int __attribute__((noinline)) main_menu_loop() { uint8_t general_text_table_buffer[2048]; u8 lineBuffer[1024]; -#define NUM_MENU_OPTIONS 3 - const uint8_t menu_options[NUM_MENU_OPTIONS] = {GENERAL_option_transfer, GENERAL_option_dreamdex, GENERAL_option_credits}; - int return_values[NUM_MENU_OPTIONS] = {BTN_TRANSFER, BTN_POKEDEX, BTN_CREDITS}; +#define NUM_MENU_OPTIONS 4 + const uint8_t menu_options[NUM_MENU_OPTIONS] = {GENERAL_option_transfer, GENERAL_option_dreamdex, GENERAL_option_credits, GENERAL_option_tutorial}; + int return_values[NUM_MENU_OPTIONS] = {BTN_TRANSFER, BTN_POKEDEX, BTN_CREDITS, BTN_TUTORIAL}; const u8 **chunkList; u32 numChunks; u32 chunkSize; @@ -234,7 +316,7 @@ int __attribute__((noinline)) main_menu_loop() text_reader.readFile(menu_options[i], lineBuffer); int string_length = get_string_length(lineBuffer); int x = ((240 - string_length) / 2); - tte_set_pos(x, ((i * (16 + 10)) + 70)); + tte_set_pos(x, ((i * (16 + 6)) + 70)); if (i == curr_selection) { tte_set_ink(INK_WHITE); @@ -255,7 +337,12 @@ int __attribute__((noinline)) main_menu_loop() } else if (key_hit(KEY_UP)) { - curr_selection = ((curr_selection + (NUM_MENU_OPTIONS - 1)) % NUM_MENU_OPTIONS); + if (curr_selection == 0) { + curr_selection = NUM_MENU_OPTIONS - 1; + } + else { + curr_selection = ((curr_selection + (NUM_MENU_OPTIONS - 1)) % NUM_MENU_OPTIONS); + } } else if (key_hit(KEY_A)) { @@ -343,6 +430,8 @@ static void __attribute__((noinline)) show_intro() int main(void) { + // Clear VRAM. We use it as extra BSS. + RegisterRamReset(RESET_VRAM); malloc_init_default_pool(); initialization_script(); @@ -430,6 +519,12 @@ int main(void) obj_hide_multi(ptgb_logo_l, 2); credits(); break; + case (BTN_TUTORIAL): + tte_set_ink(INK_DARK_GREY); + BG_FLEX = (BG_FLEX & ~BG_PRIO_MASK) | BG_PRIO(3); + obj_hide_multi(ptgb_logo_l, 2); + tutorial(); + break; case (BTN_EVENTS): obj_hide_multi(ptgb_logo_l, 2); text_loop(SCRIPT_EVENT); diff --git a/source/mystery_gift_builder.cpp b/source/mystery_gift_builder.cpp index f0b6ac2..90acf69 100644 --- a/source/mystery_gift_builder.cpp +++ b/source/mystery_gift_builder.cpp @@ -391,21 +391,53 @@ void mystery_gift_script::build_script(PokeBox *box) switch (curr_GBA_rom.gamecode) { case RUBY_ID: + textGreet.set_text(decompressed_text_table.get_text_entry(RSEFRLG_dia_textGreet_rse)); + textMoveBox.set_text(decompressed_text_table.get_text_entry(RSEFRLG_dia_textMoveBox_rs)); + textWeHere.set_text(decompressed_text_table.get_text_entry(RSEFRLG_dia_textWeHere_rs)); + textReceived.set_text(decompressed_text_table.get_text_entry(RSEFRLG_dia_textRecieved_rs)); + textIAm.set_text(decompressed_text_table.get_text_entry(first_time ? RSEFRLG_dia_textIAm_first_rs : RSEFRLG_dia_textIAm_second_rs)); + textPCConvo.set_text(decompressed_text_table.get_text_entry(RSEFRLG_dia_textPCConvo_rs)); // ȼDon’t worry ƲÀ,Ňyou won’t have to do a thing!"); + textPCThanks.set_text(decompressed_text_table.get_text_entry(RSEFRLG_dia_textPCThanks_rs)); + textThank.set_text(decompressed_text_table.get_text_entry(RSEFRLG_dia_textThank_rs)); + textPCFull.set_text(decompressed_text_table.get_text_entry(RSEFRLG_dia_textPCFull_rs)); + textLookerFull.set_text(decompressed_text_table.get_text_entry(RSEFRLG_dia_textLookerFull_rs)); + break; case SAPPHIRE_ID: textGreet.set_text(rsefrlgTableReader.getPointerToFileInDecompressionBuffer(RSEFRLG_dia_textGreet_rse)); textMoveBox.set_text(rsefrlgTableReader.getPointerToFileInDecompressionBuffer(RSEFRLG_dia_textMoveBox_rs)); - textWeHere.set_text(rsefrlgTableReader.getPointerToFileInDecompressionBuffer(RSEFRLG_dia_textWeHere_r)); + textWeHere.set_text(rsefrlgTableReader.getPointerToFileInDecompressionBuffer(RSEFRLG_dia_textWeHere_rs)); + textReceived.set_text(decompressed_text_table.get_text_entry(RSEFRLG_dia_textRecieved_rs)); + textIAm.set_text(decompressed_text_table.get_text_entry(first_time ? RSEFRLG_dia_textIAm_first_rs : RSEFRLG_dia_textIAm_second_rs)); + textPCConvo.set_text(decompressed_text_table.get_text_entry(RSEFRLG_dia_textPCConvo_rs)); // ȼDon’t worry ƲÀ,Ňyou won’t have to do a thing!"); + textPCThanks.set_text(decompressed_text_table.get_text_entry(RSEFRLG_dia_textPCThanks_rs)); + textThank.set_text(decompressed_text_table.get_text_entry(RSEFRLG_dia_textThank_rs)); + textPCFull.set_text(decompressed_text_table.get_text_entry(RSEFRLG_dia_textPCFull_rs)); + textLookerFull.set_text(decompressed_text_table.get_text_entry(RSEFRLG_dia_textLookerFull_rr)); break; case FIRERED_ID: case LEAFGREEN_ID: textGreet.set_text(rsefrlgTableReader.getPointerToFileInDecompressionBuffer(RSEFRLG_dia_textGreet_frlg)); textMoveBox.set_text(rsefrlgTableReader.getPointerToFileInDecompressionBuffer(RSEFRLG_dia_textMoveBox_frlg)); textWeHere.set_text(rsefrlgTableReader.getPointerToFileInDecompressionBuffer(RSEFRLG_dia_textWeHere_frlg)); + textReceived.set_text(decompressed_text_table.get_text_entry(RSEFRLG_dia_textRecieved_frlge)); + textIAm.set_text(decompressed_text_table.get_text_entry(first_time ? RSEFRLG_dia_textIAm_first_frlge : RSEFRLG_dia_textIAm_second_frlge)); + textPCConvo.set_text(decompressed_text_table.get_text_entry(RSEFRLG_dia_textPCConvo_frlge)); // ȼDon’t worry ƲÀ,Ňyou won’t have to do a thing!"); + textPCThanks.set_text(decompressed_text_table.get_text_entry(RSEFRLG_dia_textPCThanks_frlge)); + textThank.set_text(decompressed_text_table.get_text_entry(RSEFRLG_dia_textThank_frlge)); + textPCFull.set_text(decompressed_text_table.get_text_entry(RSEFRLG_dia_textPCFull_frlge)); + textLookerFull.set_text(decompressed_text_table.get_text_entry(RSEFRLG_dia_textLookerFull_frlge)); break; case EMERALD_ID: textGreet.set_text(rsefrlgTableReader.getPointerToFileInDecompressionBuffer(RSEFRLG_dia_textGreet_rse)); textMoveBox.set_text(rsefrlgTableReader.getPointerToFileInDecompressionBuffer(RSEFRLG_dia_textMoveBox_e)); textWeHere.set_text(rsefrlgTableReader.getPointerToFileInDecompressionBuffer(RSEFRLG_dia_textWeHere_e)); + textReceived.set_text(decompressed_text_table.get_text_entry(RSEFRLG_dia_textRecieved_frlge)); + textIAm.set_text(decompressed_text_table.get_text_entry(first_time ? RSEFRLG_dia_textIAm_first_frlge : RSEFRLG_dia_textIAm_second_frlge)); + textPCConvo.set_text(decompressed_text_table.get_text_entry(RSEFRLG_dia_textPCConvo_frlge)); // ȼDon’t worry ƲÀ,Ňyou won’t have to do a thing!"); + textPCThanks.set_text(decompressed_text_table.get_text_entry(RSEFRLG_dia_textPCThanks_frlge)); + textThank.set_text(decompressed_text_table.get_text_entry(RSEFRLG_dia_textThank_frlge)); + textPCFull.set_text(decompressed_text_table.get_text_entry(RSEFRLG_dia_textPCFull_frlge)); + textLookerFull.set_text(decompressed_text_table.get_text_entry(RSEFRLG_dia_textLookerFull_frlge)); break; } textReceived.set_text(rsefrlgTableReader.getPointerToFileInDecompressionBuffer(RSEFRLG_dia_textRecieved)); diff --git a/source/pokedex.cpp b/source/pokedex.cpp index deae721..0dc7313 100644 --- a/source/pokedex.cpp +++ b/source/pokedex.cpp @@ -175,6 +175,35 @@ int __attribute__((noinline)) pokedex_loop() delay++; } } + else if (key_hit(KEY_LEFT) || key_hit(KEY_RIGHT)) + { + dex_shift += key_tri_horz() * 7; + update = true; + } + else if (key_held(KEY_LEFT) || key_held(KEY_RIGHT)) + { + if (delay > SPEED_DELAY) + { + if ((get_frame_count() % speed == 0)) + { + if (count > 3 && speed >= 5) + { + speed = speed / 2; + count = 0; + } + else + { + count++; + } + dex_shift += key_tri_horz() * 7; + update = true; + } + } + else + { + delay++; + } + } else { speed = 20; diff --git a/source/sprite_data.cpp b/source/sprite_data.cpp index f1e8c9c..945a765 100644 --- a/source/sprite_data.cpp +++ b/source/sprite_data.cpp @@ -20,15 +20,13 @@ int y_offset_direction = 1; #include "background.h" void load_background() { - int CBB = 2; - int SBB = 12; // Load palette tonccpy(pal_bg_mem, backgroundPal, backgroundPalLen); // Load tiles into CBB 0 - LZ77UnCompVram(backgroundTiles, &tile_mem[CBB][0]); + LZ77UnCompVram(backgroundTiles, &tile_mem[TILESET_PTGB][TILESET_OFFSET_BACKDROP]); // Load map into SBB 0 - LZ77UnCompVram(backgroundMap, &se_mem[SBB][0]); - BG_BACKDROP = BG_CBB(CBB) | BG_SBB(SBB) | BG_4BPP | BG_REG_32x32 | BG_PRIO(3); + LZ77UnCompVram(backgroundMap, &se_mem[TILEMAP_BACKDROP][0]); + BG_BACKDROP = BG_CBB(TILESET_PTGB) | BG_SBB(TILEMAP_BACKDROP) | BG_4BPP | BG_REG_32x32 | BG_PRIO(3); } void set_background_pal(int curr_rom_id, bool dark, bool fade) @@ -124,75 +122,75 @@ void set_background_pal(int curr_rom_id, bool dark, bool fade) #include "menu_bars.h" #include "boxBG.h" +struct flex_background { + const unsigned short *palette; + u16 palette_len; + u16 voffset; + const unsigned int *tileset; + const unsigned short *tilemap; +}; + +static const flex_background FLEX_BACKGROUNDS[] = { + [FLEXBG_OPENING] = { + openingBGPal, + openingBGPalLen, + 96, + openingBGTiles, + openingBGMap, + }, + [FLEXBG_FENNEL] = { + fennelBGPal, + fennelBGPalLen, + FENNEL_SHIFT, + fennelBGTiles, + fennelBGMap, + }, + [FLEXBG_DEX] = { + dexBGPal, + dexBGPalLen, + 0, + dexBGTiles, + dexBGMap, + }, + [FLEXBG_MAIN_MENU] = { + pal_bg_mem, + backgroundPalLen, + 0, + menu_barsTiles, + menu_barsMap, + }, + [FLEXBG_BOX] = { + boxBGPal, + boxBGPalLen, + 0, + boxBGTiles, + boxBGMap, + } +}; + void load_flex_background(int background_id, int layer) { - int CBB = 3; // CBB is the tiles that make up the sprite - int SBB = 31; // SSB is the array of which tile goes where - if (curr_flex_background != background_id) // Only load the background if it isn't already loaded { // This prevents screen tearing on this frame // global_next_frame(); BG_FLEX = (BG_FLEX && !BG_PRIO_MASK) | BG_PRIO(3); - - switch (background_id) - { - case (FLEXBG_OPENING): - // Load palette - tonccpy(pal_bg_mem + 32, openingBGPal, openingBGPalLen); - // Load tiles into CBB 0 - LZ77UnCompVram(openingBGTiles, &tile_mem[CBB][0]); - // Give it a frame to uncompress the data - // global_next_frame(); - // Load map into SBB 0 - LZ77UnCompVram(openingBGMap, &se_mem[SBB][0]); - REG_BG1VOFS = 96; - break; - case (FLEXBG_FENNEL): - // Load palette - tonccpy(pal_bg_mem + 32, fennelBGPal, fennelBGPalLen); - // Load tiles into CBB 0 - LZ77UnCompVram(fennelBGTiles, &tile_mem[CBB][0]); - // Give it a frame to uncompress the data - // global_next_frame(); - // Load map into SBB 0 - LZ77UnCompVram(fennelBGMap, &se_mem[SBB][0]); - REG_BG1VOFS = FENNEL_SHIFT; - break; - case (FLEXBG_DEX): - // Load palette - tonccpy(pal_bg_mem + 32, dexBGPal, dexBGPalLen); - // Load tiles into CBB 0 - LZ77UnCompVram(dexBGTiles, &tile_mem[CBB][0]); - // Give it a frame to uncompress the data - // global_next_frame(); - // Load map into SBB 0 - LZ77UnCompVram(dexBGMap, &se_mem[SBB][0]); - REG_BG1VOFS = 0; - break; - case (FLEXBG_MAIN_MENU): - // Load palette - tonccpy(pal_bg_mem + 32, pal_bg_mem, backgroundPalLen); - // Load tiles into CBB 0 - LZ77UnCompVram(menu_barsTiles, &tile_mem[CBB][0]); - // Give it a frame to uncompress the data - // global_next_frame(); - // Load map into SBB 0 - LZ77UnCompVram(menu_barsMap, &se_mem[SBB][0]); - REG_BG1VOFS = 0; - break; - case (FLEXBG_BOX): - // Load palette - tonccpy(pal_bg_mem + 32, boxBGPal, boxBGPalLen); - // Load tiles into CBB 0 - LZ77UnCompVram(boxBGTiles, &tile_mem[CBB][0]); - // Give it a frame to uncompress the data - // global_next_frame(); - // Load map into SBB 0 - LZ77UnCompVram(boxBGMap, &se_mem[SBB][0]); - REG_BG1VOFS = 0; - break; + const flex_background *flex = &FLEX_BACKGROUNDS[background_id]; +#ifdef DEBUG + // Check to make sure we aren't overflowing tile memory + if ((flex->tileset[0] >> 8) > (6 * 1024)) { + for (;;) {} } +#endif + tonccpy(pal_bg_mem + 32, flex->palette, flex->palette_len); + // Load tiles + LZ77UnCompVram(flex->tileset, &tile_mem[TILESET_PTGB][TILESET_OFFSET_FLEXBG]); + // Give it a frame to uncompress the data + global_next_frame(); + // Load map into the tilemap + LZ77UnCompVram(flex->tilemap, &se_mem[TILEMAP_FLEXBG][0]); + // Set vertical offset + REG_BG1VOFS = flex->voffset; } BG_FLEX = BG_CBB(CBB) | BG_SBB(SBB) | BG_4BPP | BG_REG_32x32 | BG_PRIO(layer); @@ -201,31 +199,24 @@ void load_flex_background(int background_id, int layer) #include "textBoxBG.h" void load_textbox_background() { - int CBB = 2; - int SBB = 20; // Load palette tonccpy(pal_bg_mem + 16, textBoxBGPal, textBoxBGPalLen); // Load tiles into CBB 0 - LZ77UnCompVram(textBoxBGTiles, &tile_mem[CBB][38]); + LZ77UnCompVram(textBoxBGTiles, &tile_mem[TILESET_PTGB][TILESET_OFFSET_TEXTBOX]); // Load map into SBB 0 reload_textbox_background(); REG_BG2VOFS = 96; - BG_TEXTBOX = BG_CBB(CBB) | BG_SBB(SBB) | BG_4BPP | BG_REG_32x32 | BG_PRIO(3); + BG_TEXTBOX = BG_CBB(TILESET_PTGB) | BG_SBB(TILEMAP_TEXTBOX) | BG_4BPP | BG_REG_32x32 | BG_PRIO(3); } void reload_textbox_background() { - int SBB = 20; - LZ77UnCompVram(textBoxBGMap, &se_mem[SBB][0]); - for (int i = 0; i < 1024; i++) - { - se_mem[SBB][i] += 38; // This should be overflow protected, but if we're flipping back around we're already in trouble - } + LZ77UnCompVram(textBoxBGMap, &se_mem[TILEMAP_TEXTBOX][0]); } // tile ID, VH Flip, Palette Bank -#define TILE_OFFSET 38 +#define TILE_OFFSET TILESET_OFFSET_TEXTBOX #define TILE_CLEAR ((0 + TILE_OFFSET) | (0b00 << 0xA) | (1 << 0xC)) #define TILE_MID ((1 + TILE_OFFSET) | (0b00 << 0xA) | (1 << 0xC)) #define TILE_N ((2 + TILE_OFFSET) | (0b00 << 0xA) | (1 << 0xC)) @@ -258,52 +249,51 @@ void reload_textbox_background() #define MENU_WIDTH 11 - 1 // Currently static -static int TILE_SE_U_ARR[4] = {TILE_SE_0, TILE_SE_2, TILE_SE_4U, TILE_SE_6U}; -static int TILE_S_U_ARR[4] = {TILE_S_0, TILE_S_2, TILE_S_4U, TILE_S_6U}; -static int TILE_SW_U_ARR[4] = {TILE_SW_0, TILE_SW_2, TILE_SW_4U, TILE_SW_6U}; -static int TILE_SE_L_ARR[4] = {TILE_CLEAR, TILE_CLEAR, TILE_SE_4L, TILE_SE_6L}; -static int TILE_S_L_ARR[4] = {TILE_CLEAR, TILE_CLEAR, TILE_S_4L, TILE_S_6L}; -static int TILE_SW_L_ARR[4] = {TILE_CLEAR, TILE_CLEAR, TILE_SW_4L, TILE_SW_6L}; +static const u16 TILE_SE_U_ARR[4] = {TILE_SE_0, TILE_SE_2, TILE_SE_4U, TILE_SE_6U}; +static const u16 TILE_S_U_ARR[4] = {TILE_S_0, TILE_S_2, TILE_S_4U, TILE_S_6U}; +static const u16 TILE_SW_U_ARR[4] = {TILE_SW_0, TILE_SW_2, TILE_SW_4U, TILE_SW_6U}; +static const u16 TILE_SE_L_ARR[4] = {TILE_CLEAR, TILE_CLEAR, TILE_SE_4L, TILE_SE_6L}; +static const u16 TILE_S_L_ARR[4] = {TILE_CLEAR, TILE_CLEAR, TILE_S_4L, TILE_S_6L}; +static const u16 TILE_SW_L_ARR[4] = {TILE_CLEAR, TILE_CLEAR, TILE_SW_4L, TILE_SW_6L}; void add_menu_box(int options, int startTileX, int startTileY) { add_menu_box(startTileX, startTileY, (MENU_WIDTH) * 8, (options * 10) + 16); } +// TODO: clean this mess. manual masking used for now but there is a buffer overflow in how the bottom +// row is calculated. void add_menu_box(int startTileX, int startTileY, int full_width, int full_height) { - // We can't check the current offset very easily, so we'll just assume it's in the text box position. startTileY += 12; - int SBB = 20; - int start = (32 * startTileY) + startTileX; int tiles = (full_height / 8) - 1; // For the flex edge int vert_rem = full_height % 8; full_width = (full_width / 8) - 1; // For the right edge // Corners - se_mem[SBB][start] = TILE_NW; - se_mem[SBB][start + full_width] = TILE_NE; - se_mem[SBB][start + (32 * (tiles))] = TILE_SW_U_ARR[vert_rem / 2]; - se_mem[SBB][start + (32 * (tiles + 1))] = TILE_SW_L_ARR[vert_rem / 2]; - se_mem[SBB][start + (32 * (tiles)) + full_width] = TILE_SE_U_ARR[vert_rem / 2]; - se_mem[SBB][start + (32 * (tiles + 1)) + full_width] = TILE_SE_L_ARR[vert_rem / 2]; + se_mem[TILEMAP_TEXTBOX][start] = TILE_NW; + se_mem[TILEMAP_TEXTBOX][start + full_width] = TILE_NE; + se_mem[TILEMAP_TEXTBOX][(start + (32 * (tiles))) & 0x3ff] = TILE_SW_U_ARR[vert_rem / 2]; + se_mem[TILEMAP_TEXTBOX][(start + (32 * (tiles + 1))) & 0x3ff] = TILE_SW_L_ARR[vert_rem / 2]; + se_mem[TILEMAP_TEXTBOX][(start + (32 * (tiles)) + full_width) & 0x3ff] = TILE_SE_U_ARR[vert_rem / 2]; + se_mem[TILEMAP_TEXTBOX][(start + (32 * (tiles + 1)) + full_width) & 0x3ff] = TILE_SE_L_ARR[vert_rem / 2]; // Top and bottom edge for (int i = 1; i < full_width; i++) { - se_mem[SBB][start + i] = TILE_N; - se_mem[SBB][start + ((32 * (tiles))) + i] = TILE_S_U_ARR[vert_rem / 2]; - se_mem[SBB][start + ((32 * (tiles + 1))) + i] = TILE_S_L_ARR[vert_rem / 2]; + se_mem[TILEMAP_TEXTBOX][start + i] = TILE_N; + se_mem[TILEMAP_TEXTBOX][(start + ((32 * (tiles))) + i) & 0x3ff] = TILE_S_U_ARR[vert_rem / 2]; + se_mem[TILEMAP_TEXTBOX][(start + ((32 * (tiles + 1))) + i) & 0x3ff] = TILE_S_L_ARR[vert_rem / 2]; } // Sides for (int i = 1; i < tiles; i++) { - se_mem[SBB][start + (32 * i) + full_width] = TILE_E; - se_mem[SBB][start + (32 * i)] = TILE_W; + se_mem[TILEMAP_TEXTBOX][(start + (32 * i) + full_width) & 0x3ff] = TILE_E; + se_mem[TILEMAP_TEXTBOX][(start + (32 * i)) & 0x3ff] = TILE_W; } // Middle @@ -311,7 +301,7 @@ void add_menu_box(int startTileX, int startTileY, int full_width, int full_heigh { for (int y = 1; y < tiles; y++) { - se_mem[SBB][start + (32 * y) + x] = TILE_MID; + se_mem[TILEMAP_TEXTBOX][(start + (32 * y) + x) & 0x3ff] = TILE_MID; } } } @@ -323,13 +313,12 @@ void erase_textbox_tiles() int startTileY = 12; int start = (32 * startTileY); - int SBB = 20; for (int x = 0; x < 30; x++) { for (int y = 0; y < 20; y++) { - se_mem[SBB][start + (32 * y) + x] = TILE_CLEAR; + se_mem[TILEMAP_TEXTBOX][start + (32 * y) + x] = TILE_CLEAR; } } } @@ -909,47 +898,46 @@ void load_select_sprites(GameBoyROM currROM) } // tile ID, VH Flip, Palette Bank -#define FEN_BLI_L00 (34 | (0b00 << 0xA) | (2 << 0xC)) -#define FEN_BLI_L01 (35 | (0b00 << 0xA) | (2 << 0xC)) -#define FEN_BLI_L10 (140 | (0b00 << 0xA) | (2 << 0xC)) -#define FEN_BLI_L11 (141 | (0b00 << 0xA) | (2 << 0xC)) -#define FEN_BLI_L20 (143 | (0b00 << 0xA) | (2 << 0xC)) -#define FEN_BLI_L21 (144 | (0b00 << 0xA) | (2 << 0xC)) -#define FEN_BLI_R0 (37 | (0b00 << 0xA) | (2 << 0xC)) -#define FEN_BLI_R1 (142 | (0b00 << 0xA) | (2 << 0xC)) -#define FEN_BLI_R2 (145 | (0b00 << 0xA) | (2 << 0xC)) +#define FEN_BLI_L00 ((TILESET_OFFSET_FLEXBG + 34) | (0b00 << 0xA) | (2 << 0xC)) +#define FEN_BLI_L01 ((TILESET_OFFSET_FLEXBG + 35) | (0b00 << 0xA) | (2 << 0xC)) +#define FEN_BLI_L10 ((TILESET_OFFSET_FLEXBG + 140) | (0b00 << 0xA) | (2 << 0xC)) +#define FEN_BLI_L11 ((TILESET_OFFSET_FLEXBG + 141) | (0b00 << 0xA) | (2 << 0xC)) +#define FEN_BLI_L20 ((TILESET_OFFSET_FLEXBG + 143) | (0b00 << 0xA) | (2 << 0xC)) +#define FEN_BLI_L21 ((TILESET_OFFSET_FLEXBG + 144) | (0b00 << 0xA) | (2 << 0xC)) +#define FEN_BLI_R0 ((TILESET_OFFSET_FLEXBG + 37) | (0b00 << 0xA) | (2 << 0xC)) +#define FEN_BLI_R1 ((TILESET_OFFSET_FLEXBG + 142) | (0b00 << 0xA) | (2 << 0xC)) +#define FEN_BLI_R2 ((TILESET_OFFSET_FLEXBG + 145) | (0b00 << 0xA) | (2 << 0xC)) // tile ID, VH Flip, Palette Bank -#define FEN_SPE_00 (46 | (0b00 << 0xA) | (2 << 0xC)) -#define FEN_SPE_01 (56 | (0b00 << 0xA) | (2 << 0xC)) -#define FEN_SPE_10 (146 | (0b00 << 0xA) | (2 << 0xC)) -#define FEN_SPE_11 (56 | (0b00 << 0xA) | (2 << 0xC)) -#define FEN_SPE_20 (147 | (0b00 << 0xA) | (2 << 0xC)) -#define FEN_SPE_21 (149 | (0b00 << 0xA) | (2 << 0xC)) -#define FEN_SPE_30 (148 | (0b00 << 0xA) | (2 << 0xC)) -#define FEN_SPE_31 (150 | (0b00 << 0xA) | (2 << 0xC)) +#define FEN_SPE_00 ((TILESET_OFFSET_FLEXBG + 46) | (0b00 << 0xA) | (2 << 0xC)) +#define FEN_SPE_01 ((TILESET_OFFSET_FLEXBG + 56) | (0b00 << 0xA) | (2 << 0xC)) +#define FEN_SPE_10 ((TILESET_OFFSET_FLEXBG + 146) | (0b00 << 0xA) | (2 << 0xC)) +#define FEN_SPE_11 ((TILESET_OFFSET_FLEXBG + 56) | (0b00 << 0xA) | (2 << 0xC)) +#define FEN_SPE_20 ((TILESET_OFFSET_FLEXBG + 147) | (0b00 << 0xA) | (2 << 0xC)) +#define FEN_SPE_21 ((TILESET_OFFSET_FLEXBG + 149) | (0b00 << 0xA) | (2 << 0xC)) +#define FEN_SPE_30 ((TILESET_OFFSET_FLEXBG + 148) | (0b00 << 0xA) | (2 << 0xC)) +#define FEN_SPE_31 ((TILESET_OFFSET_FLEXBG + 150) | (0b00 << 0xA) | (2 << 0xC)) void fennel_blink(int frame) { bool missingno = get_missingno_enabled(); - int SBB = 31; // SSB is the array of which tile goes where switch (frame) { case 0: - se_mem[SBB][12 + (5 * 32)] = missingno ? FEN_SPE_00 | FEN_BLI_L20 : FEN_BLI_L20; - se_mem[SBB][13 + (5 * 32)] = missingno ? FEN_SPE_01 | FEN_BLI_L21 : FEN_BLI_L21; - se_mem[SBB][15 + (5 * 32)] = missingno ? FEN_SPE_10 | FEN_BLI_R2 : FEN_BLI_R2; + se_mem[TILEMAP_FLEXBG][12 + (5 * 32)] = missingno ? FEN_SPE_00 | FEN_BLI_L20 : FEN_BLI_L20; + se_mem[TILEMAP_FLEXBG][13 + (5 * 32)] = missingno ? FEN_SPE_01 | FEN_BLI_L21 : FEN_BLI_L21; + se_mem[TILEMAP_FLEXBG][15 + (5 * 32)] = missingno ? FEN_SPE_10 | FEN_BLI_R2 : FEN_BLI_R2; break; case 1: case 3: - se_mem[SBB][12 + (5 * 32)] = missingno ? FEN_SPE_11 | FEN_BLI_L10 : FEN_BLI_L10; - se_mem[SBB][13 + (5 * 32)] = missingno ? FEN_SPE_20 | FEN_BLI_L11 : FEN_BLI_L11; - se_mem[SBB][15 + (5 * 32)] = missingno ? FEN_SPE_21 | FEN_BLI_R1 : FEN_BLI_R1; + se_mem[TILEMAP_FLEXBG][12 + (5 * 32)] = missingno ? FEN_SPE_11 | FEN_BLI_L10 : FEN_BLI_L10; + se_mem[TILEMAP_FLEXBG][13 + (5 * 32)] = missingno ? FEN_SPE_20 | FEN_BLI_L11 : FEN_BLI_L11; + se_mem[TILEMAP_FLEXBG][15 + (5 * 32)] = missingno ? FEN_SPE_21 | FEN_BLI_R1 : FEN_BLI_R1; break; case 2: - se_mem[SBB][12 + (5 * 32)] = missingno ? FEN_SPE_30 | FEN_BLI_L00 : FEN_BLI_L00; - se_mem[SBB][13 + (5 * 32)] = missingno ? FEN_SPE_31 | FEN_BLI_L01 : FEN_BLI_L01; - se_mem[SBB][15 + (5 * 32)] = missingno ? FEN_SPE_00 | FEN_BLI_R0 : FEN_BLI_R0; + se_mem[TILEMAP_FLEXBG][12 + (5 * 32)] = missingno ? FEN_SPE_30 | FEN_BLI_L00 : FEN_BLI_L00; + se_mem[TILEMAP_FLEXBG][13 + (5 * 32)] = missingno ? FEN_SPE_31 | FEN_BLI_L01 : FEN_BLI_L01; + se_mem[TILEMAP_FLEXBG][15 + (5 * 32)] = missingno ? FEN_SPE_00 | FEN_BLI_R0 : FEN_BLI_R0; break; } } @@ -957,25 +945,24 @@ void fennel_blink(int frame) void fennel_speak(int frame) { bool missingno = get_missingno_enabled(); - int SBB = 31; // SSB is the array of which tile goes where switch (frame) { case 0: - se_mem[SBB][14 + (6 * 32)] = missingno ? FEN_SPE_00 | FEN_BLI_L20 : FEN_SPE_00; - se_mem[SBB][14 + (7 * 32)] = missingno ? FEN_SPE_01 | FEN_BLI_L21 : FEN_SPE_01; + se_mem[TILEMAP_FLEXBG][14 + (6 * 32)] = missingno ? FEN_SPE_00 | FEN_BLI_L20 : FEN_SPE_00; + se_mem[TILEMAP_FLEXBG][14 + (7 * 32)] = missingno ? FEN_SPE_01 | FEN_BLI_L21 : FEN_SPE_01; break; case 1: - se_mem[SBB][14 + (6 * 32)] = missingno ? FEN_SPE_10 | FEN_BLI_R2 : FEN_SPE_10; - se_mem[SBB][14 + (7 * 32)] = missingno ? FEN_SPE_11 | FEN_BLI_L10 : FEN_SPE_11; + se_mem[TILEMAP_FLEXBG][14 + (6 * 32)] = missingno ? FEN_SPE_10 | FEN_BLI_R2 : FEN_SPE_10; + se_mem[TILEMAP_FLEXBG][14 + (7 * 32)] = missingno ? FEN_SPE_11 | FEN_BLI_L10 : FEN_SPE_11; break; case 2: case 4: - se_mem[SBB][14 + (6 * 32)] = missingno ? FEN_SPE_01 | FEN_BLI_L21 : FEN_SPE_20; - se_mem[SBB][14 + (7 * 32)] = missingno ? FEN_SPE_01 | FEN_BLI_L21 : FEN_SPE_21; + se_mem[TILEMAP_FLEXBG][14 + (6 * 32)] = missingno ? FEN_SPE_01 | FEN_BLI_L21 : FEN_SPE_20; + se_mem[TILEMAP_FLEXBG][14 + (7 * 32)] = missingno ? FEN_SPE_01 | FEN_BLI_L21 : FEN_SPE_21; break; case 3: - se_mem[SBB][14 + (6 * 32)] = missingno ? FEN_SPE_30 | FEN_BLI_L00 : FEN_SPE_30; - se_mem[SBB][14 + (7 * 32)] = missingno ? FEN_SPE_31 | FEN_BLI_L01 : FEN_SPE_31; + se_mem[TILEMAP_FLEXBG][14 + (6 * 32)] = missingno ? FEN_SPE_30 | FEN_BLI_L00 : FEN_SPE_30; + se_mem[TILEMAP_FLEXBG][14 + (7 * 32)] = missingno ? FEN_SPE_31 | FEN_BLI_L01 : FEN_SPE_31; break; } } diff --git a/source/text_engine.cpp b/source/text_engine.cpp index 923dc52..02f7d00 100644 --- a/source/text_engine.cpp +++ b/source/text_engine.cpp @@ -14,9 +14,6 @@ #include "FileContainerReader.h" #include "text_tables.h" -#define TEXT_CBB 0 -#define TEXT_SBB 10 - script_obj curr_line; uint char_index; uint line_char_index; @@ -60,17 +57,17 @@ void init_text_engine() // Load the TTE // tte_init_se(3, BG_CBB(TEXT_CBB) | BG_SBB(TEXT_SBB) | BG_PRIO(0), 0, CLR_WHITE, 14, &japanese_smallFont, NULL); - tte_init_chr4c(3, // BG 3 - BG_CBB(TEXT_CBB) | BG_SBB(TEXT_SBB), // Charblock 0; screenblock 10 - 0xF000, // Screen-entry offset - bytes2word( // Color attributes: - 13, // Text color - 15, // Shadow color - 0, // Paper - 0), // Special - CLR_WHITE, // White text - BUILD_FONT, // Custom font - NULL // Use default chr4 renderer + tte_init_chr4c(3, // BG 3 + BG_CBB(TILESET_TEXT) | BG_SBB(TILEMAP_TEXT), // Charblock 0; screenblock 10 + 0xF000, // Screen-entry offset + bytes2word( // Color attributes: + 13, // Text color + 15, // Shadow color + 0, // Paper + 0), // Special + CLR_WHITE, // White text + BUILD_FONT, // Custom font + NULL // Use default chr4 renderer ); tte_init_con(); @@ -170,7 +167,12 @@ int text_loop(int script) } else if (key_hit(KEY_UP)) { - text_section = (text_section + 1) % NUM_TEXT_SECTIONS; + if (text_section == 0) { + text_section = NUM_TEXT_SECTIONS - 1; + } + else { + text_section = ((text_section + (NUM_TEXT_SECTIONS - 1)) % NUM_TEXT_SECTIONS); + } update_text = true; } else if (key_hit(KEY_DOWN)) @@ -268,7 +270,10 @@ int ptgb_write_textbox(const byte *text, bool instant, bool waitForUser, int out = ptgb_write(text, instant, 9999, text_box_type_tables[text_section][text_key]); // This is kinda silly but it'll work. if (waitForUser) { - wait_for_user_to_continue(); + + int right = H_MAX - 5; + int bottom = V_MAX - 5; + wait_for_user_to_continue(right, bottom); } if (eraseMainBox) { @@ -288,12 +293,12 @@ int ptgb_write_simple(const byte *text, bool instant) // Re-implementing TTE's "tte_write" to use the gen 3 character encoding chart int ptgb_write(const byte *text, bool instant, int length, int box_type) { - int left, top, right, bottom; - instant = instant || g_debug_options.instant_text_speed; if (text == NULL) return 0; + int left, top, right, bottom; + if (box_type == -1) { left = 0; @@ -327,7 +332,7 @@ int ptgb_write(const byte *text, bool instant, int length, int box_type) { tc->drawgProc(0x79); } - wait_for_user_to_continue(); + wait_for_user_to_continue(right, bottom); scroll_text(instant, tc, true, left, top, right, bottom); break; case 0xFB: @@ -335,7 +340,7 @@ int ptgb_write(const byte *text, bool instant, int length, int box_type) { tc->drawgProc(0xB9); } - wait_for_user_to_continue(); + wait_for_user_to_continue(right, bottom); tte_erase_rect(left, top, right, bottom); tte_set_pos(left, top); break; @@ -424,7 +429,7 @@ int ptgb_write_debug(const u16 *charset, const char *text, bool instant) return ptgb_write_simple(temp_holding, instant); } -void wait_for_user_to_continue() +void wait_for_user_to_continue(int right, int bottom) { if (get_curr_flex_background() == FLEXBG_FENNEL) { @@ -438,11 +443,29 @@ void wait_for_user_to_continue() fennel_speak(0); } } + + //obj_set_pos(scroll_indicator_red, right-16, bottom-11); + //obj_set_pos(scroll_indicator_gray, right-16, bottom-10); + //obj_unhide(scroll_indicator_red, 0); + VBlankIntrWait(); while (!(key_hit(KEY_A) || key_hit(KEY_B))) { + /* + int frameCount = get_frame_count(); + if (frameCount % 60 == 0) { + obj_unhide(scroll_indicator_red, 0); + obj_hide(scroll_indicator_gray); + } + else if (frameCount % 30 == 0) { + obj_hide(scroll_indicator_red); + obj_unhide(scroll_indicator_gray, 0); + } + */ VBlankIntrWait(); } + //obj_hide(scroll_indicator_red); + //obj_hide(scroll_indicator_gray); } void scroll_text(bool instant, TTC *tc, bool scrollUp, int left, int top, int right, int bottom) @@ -465,7 +488,7 @@ void scroll_text(bool instant, TTC *tc, bool scrollUp, int left, int top, int ri { for (int i = 0; i < 30; i++) { - tonccpy(&tile_mem[TEXT_CBB][0 + (i * 20)], &tile_mem[TEXT_CBB][2 + (i * 20)], 20 * 32); + tonccpy(&tile_mem[TILESET_TEXT][0 + (i * 20)], &tile_mem[TILESET_TEXT][2 + (i * 20)], 20 * 32); } } else diff --git a/source/vertical_menu.cpp b/source/vertical_menu.cpp index 82b645f..f262699 100644 --- a/source/vertical_menu.cpp +++ b/source/vertical_menu.cpp @@ -170,23 +170,34 @@ MenuInputHandleState vertical_menu::handle_input() return MenuInputHandleState::CANCELLED; } - if (key_hit(KEY_DOWN) && focused_index_ < (items_.size() - 1u)) + if (key_hit(KEY_DOWN)) { - const unsigned current_viewport_end_index = get_viewport_end_index(viewport_start_index_, get_num_visible_items(settings_.height, settings_.margin_top, settings_.margin_bottom, settings_.item_height), items_.size()); + const unsigned num_visible_items = get_num_visible_items(settings_.height, settings_.margin_top, settings_.margin_bottom, settings_.item_height); + const unsigned current_viewport_end_index = get_viewport_end_index(viewport_start_index_, num_visible_items, items_.size()); ++focused_index_; - if (focused_index_ >= current_viewport_end_index) + if (focused_index_ == current_viewport_end_index) { ++viewport_start_index_; viewport_changed = true; } + if (focused_index_ > items_.size() - 1) { + viewport_start_index_ = 0; + focused_index_ = 0; + viewport_changed = true; + } did_navigate = true; } - else if (key_hit(KEY_UP) && focused_index_ > 0) + else if (key_hit(KEY_UP)) { --focused_index_; - if (focused_index_ < viewport_start_index_) + if (focused_index_ < 0) { - --viewport_start_index_; + const unsigned num_visible_items = get_num_visible_items(settings_.height, settings_.margin_top, settings_.margin_bottom, settings_.item_height); + const unsigned current_viewport_end_index = get_viewport_end_index(viewport_start_index_, num_visible_items, items_.size()); + const unsigned max_index = items_.size() - 1; + + viewport_start_index_ = (max_index - num_visible_items) + 1; + focused_index_ = max_index; viewport_changed = true; } did_navigate = true; diff --git a/tools/text_helper/fonts/chinesesi_normal.png b/tools/text_helper/fonts/chinesesi_normal.png new file mode 100644 index 0000000..f9094c9 Binary files /dev/null and b/tools/text_helper/fonts/chinesesi_normal.png differ diff --git a/tools/text_helper/fonts/chinesetr_normal.png b/tools/text_helper/fonts/chinesetr_normal.png new file mode 100644 index 0000000..f1956ae Binary files /dev/null and b/tools/text_helper/fonts/chinesetr_normal.png differ diff --git a/tools/text_helper/fonts/japanese_normal.png b/tools/text_helper/fonts/japanese_normal.png index 5aeacc2..f4d0b59 100644 Binary files a/tools/text_helper/fonts/japanese_normal.png and b/tools/text_helper/fonts/japanese_normal.png differ diff --git a/tools/text_helper/fonts/korean_normal.png b/tools/text_helper/fonts/korean_normal.png new file mode 100644 index 0000000..e77b9de Binary files /dev/null and b/tools/text_helper/fonts/korean_normal.png differ diff --git a/tools/text_helper/main.py b/tools/text_helper/main.py index d12124a..807a7c0 100644 --- a/tools/text_helper/main.py +++ b/tools/text_helper/main.py @@ -234,6 +234,8 @@ charArrays = { ["{MLE}", [0xFC, 0x01, 0x08]], ["{SPA}", [0xFC]], ["{PLR}", [0xFD, 0x01]], + ["{VLN}", [0xFD, 0x0A]], # Displays MAXIE in Ruby or ARCHIE in Sapphire and Emerald + ["{VLN2}", [0xFD, 0x0B]], # Displays ARCHIE in Ruby or MAXIE in Sapphire and Emerald. In our case, have purpose in Emerlad only. ["{NEW}", [0xFE]], ["{END}", [0xFF]], ] @@ -250,6 +252,8 @@ charArrays = { ["{SPA}", [0xFC]], ["{FPC}", [0xFC, 0x06, 0x05]], ["{PLR}", [0xFD, 0x01]], + ["{VLN}", [0xFD, 0x0A]], # Displays MAXIE in Ruby or ARCHIE in Sapphire and Emerald + ["{VLN2}", [0xFD, 0x0B]], # Displays ARCHIE in Ruby or MAXIE in Sapphire and Emerald. Have purpose in Emerlad only. ["{NEW}", [0xFE]], ["{END}", [0xFF]], ] @@ -871,6 +875,32 @@ def write_text_file_container(filename, dictionary, lang, section, context=None) defLine = "@chunkSize=" + str(get_file_container_chunk_size(section)) + "\n" defFile.write(defLine.encode("utf-8")) +def write_text_bin_file(filename, dictionary, lang, section, context=None): + MAX_BIN_SIZES = { + "PTGB": 6144, + "RSEFRLG": 3444, + "GB": 9999, + "GENERAL": 2048, + "CREDITS": 2048, + "TUTORIAL": 2048, + "PKMN_NAMES": 3072, + } + + Path(filename).parent.mkdir(parents=True, exist_ok=True) + with open(filename, 'wb') as binFile: + # Let the first byte indicate the number of entries + dict_size = len(dictionary) + # We need to store 2 bytes instead of one, because not aligning the data to 16 bits will cause corruption on the gba. + binFile.write(bytes([dict_size & 0xFF, (dict_size >> 8) & 0xFF])) + # After this initial byte, we will read the offset (16 bit) of each line (relative to the last index byte) + index = bytearray(len(dictionary) * 2) + # bindata will contain the binary data of each entry + bindata = bytearray() + current_offset = 0 + + num = 0 + # Append every line's binary data to bindata + # keep an index of the binary offset within bindata at which each line starts for key, line in dictionary.items(): with open(buildpath + str(key), 'wb') as lineFile: dictionary[key] = convert_item(line, lang, context)