Skip to content

Commit d545f78

Browse files
committed
Pk16 Test
1 parent fbdc1f4 commit d545f78

File tree

1,348 files changed

+32312
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

1,348 files changed

+32312
-0
lines changed

.github/ISSUE_TEMPLATE/blank_issue.md

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
---
2+
name: Update to pokecrystal
3+
about: Suggest a possible change to pokecrystal itself.
4+
---

.github/ISSUE_TEMPLATE/config.yml

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
blank_issues_enabled: false
2+
contact_links:
3+
- name: pret Discord
4+
url: https://discord.gg/d5dubZ3
5+
about: If you need help with using pokecrystal, or just have general questions about it, ask in our Discord server!

.github/webhook.sh

+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
#!/bin/sh
2+
set -e
3+
4+
# Report unnamed symbols
5+
content="$(tools/unnamed.py -r . pokecrystal.sym | grep -v -e '^lib/mobile/' -e '^mobile/' | head)"
6+
7+
curl -H 'Content-Type: application/json' -X POST "$DISCORD_WEBHOOK_URL" -d@- << EOF
8+
{
9+
"username": "OK",
10+
"avatar_url": "https://i.imgur.com/38BQHdd.png",
11+
"content": "\`\`\`$(echo "$content" | sed -E ':a;N;$!ba;s/\r{0,1}\n/\\n/g')\`\`\`"
12+
}
13+
EOF

.github/workflows/main.yml

+77
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,77 @@
1+
name: CI
2+
3+
on:
4+
push:
5+
branches: [ master ]
6+
pull_request:
7+
8+
jobs:
9+
build:
10+
runs-on: ubuntu-latest
11+
steps:
12+
- name: Checkout
13+
uses: actions/checkout@master
14+
15+
- name: Checkout rgbds
16+
uses: actions/checkout@master
17+
with:
18+
path: rgbds
19+
ref: v0.6.1
20+
repository: gbdev/rgbds
21+
22+
- name: Install rgbds
23+
working-directory: rgbds
24+
run: |
25+
sudo make install
26+
27+
- name: Remove rgbds
28+
run: |
29+
rm -rf rgbds
30+
31+
- name: Compare
32+
if: ${{ github.repository_owner == 'pret' }}
33+
run: |
34+
make DEBUG=1 -j$(nproc) compare
35+
if ! git diff-index --quiet HEAD --; then
36+
echo 'Uncommitted changes detected:'
37+
git diff-index HEAD --
38+
return 1
39+
fi
40+
41+
- name: Make
42+
if: ${{ github.repository_owner != 'pret' }}
43+
run: |
44+
make -j$(nproc)
45+
if ! git diff-index --quiet HEAD --; then
46+
echo 'Uncommitted changes detected:'
47+
git diff-index HEAD --
48+
return 1
49+
fi
50+
51+
- name: Discord webhook
52+
if: ${{ github.event_name == 'push' && github.repository_owner == 'pret' }}
53+
env:
54+
DISCORD_WEBHOOK_URL: ${{ secrets.DISCORD_WEBHOOK_URL }}
55+
run: |
56+
.github/webhook.sh
57+
58+
- name: Checkout symbols
59+
if: ${{ github.event_name == 'push' && github.repository_owner == 'pret' }}
60+
uses: actions/checkout@master
61+
with:
62+
path: symbols
63+
ref: symbols
64+
65+
- name: Move symbols
66+
if: ${{ github.event_name == 'push' && github.repository_owner == 'pret' }}
67+
run: |
68+
cp -v *.sym symbols/
69+
cp -v *.map symbols/
70+
71+
- name: Update symbols
72+
if: ${{ github.event_name == 'push' && github.repository_owner == 'pret' }}
73+
uses: EndBug/add-and-commit@v9
74+
with:
75+
cwd: "./symbols"
76+
add: "*.sym *.map"
77+
message: ${{ github.event.commits[0].message }}

FAQ.md

+123
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,123 @@
1+
# FAQ
2+
3+
4+
## Questions
5+
6+
- [What is pokecrystal11.gbc?](#what-is-pokecrystal11gbc)
7+
- [What is pokecrystal_au.gbc?](#what-is-pokecrystal_augbc)
8+
- [I can't build the ROM, `make` just prints an error!](#i-cant-build-the-rom-make-just-prints-an-error)
9+
- [`gcc`: command not found](#gcc-command-not-found)
10+
- ["ERROR: `UNION` already defined"](#error-union-already-defined)
11+
- ["ERROR: Macro not defined"](#error-macro-not-defined)
12+
- ["Expression must be 8-bit"](#expression-must-be-8-bit)
13+
- ["Segmentation fault" from `rgbgfx`](#segmentation-fault-from-rgbgfx)
14+
- ["Section is too big" or "Unable to place section in bank"](#section-is-too-big-or-unable-to-place-section-in-bank)
15+
- ["Invalid file or object file version"](#invalid-file-or-object-file-version)
16+
- ["Syntax error"](#syntax-error)
17+
- [How do I edit maps?](#how-do-i-edit-maps)
18+
- [How do I edit the colors of an image?](#how-do-i-edit-the-colors-of-an-image)
19+
- [How do I write new features?](#how-do-i-write-new-features)
20+
- [How do I share code on Discord?](#how-do-i-share-code-on-discord)
21+
- [I need more help!](#i-need-more-help)
22+
23+
24+
## What is pokecrystal11.gbc?
25+
26+
Version 1.1 of Pokémon Crystal, which fixed some issues with the initial international release. `make crystal11` defines `_CRYSTAL11` so the assembly builds the changed version.
27+
28+
29+
## What is pokecrystal_au.gbc?
30+
31+
The Australian release of Pokémon Crystal, which is based on the international 1.1 release but censors gambling references from the Game Corners. `make crystal_au` defines `_CRYSTAL11` and `_CRYSTAL_AU` so the assembly builds the changed version.
32+
33+
34+
## I can't build the ROM, `make` just prints an error!
35+
36+
Reread [INSTALL.md](INSTALL.md) carefully, and make sure you're following all its steps.
37+
38+
### `gcc`: command not found
39+
40+
You need to install `gcc`. If you're using Cygwin, re-run its setup, and at "Select Packages", choose to install `gcc-core`.
41+
42+
### "ERROR: `UNION` already defined"
43+
44+
Download [**rgbds 0.6.0**][rgbds] or newer. Older versions will not work.
45+
46+
### "ERROR: Macro not defined"
47+
48+
Download [**rgbds 0.6.0**][rgbds] or newer. Older versions will not work.
49+
50+
### "Expression must be 8-bit"
51+
52+
Download [**rgbds 0.6.0**][rgbds] or newer. Older versions will not work.
53+
54+
### "Segmentation fault" from `rgbgfx`
55+
56+
If you are using 64-bit Windows, download [**64-bit Cygwin**][cygwin] and [**64-bit rgbds**][rgbds].
57+
58+
### "Section is too big" or "Unable to place section in bank"
59+
60+
If you have not changed any of the asm, make sure you have the latest version of pokecrystal and the correct version of rgbds (see [INSTALL.md](INSTALL.md)).
61+
62+
If you added or changed any code, it has to fit in the **memory banks**. The 2MB ROM is divided into 128 banks of 4KB ($4000 bytes) each, numbered $00 to $7F. The linkerscript [layout.link](layout.link) lists which `SECTION`s go in which banks. Try moving some code into a new section.
63+
64+
### "Invalid file or object file version"
65+
66+
Run `make clean` to remove all the old `o` files, then re-run `make`.
67+
68+
### "Syntax error"
69+
70+
If you have not changed any of the asm, make sure you have the latest version of pokecrystal and the correct version of rgbds (see [INSTALL.md](INSTALL.md)).
71+
72+
If you added or changed any code, you've made a mistake while writing some of it. Re-read the modifications you've made to the file it complains about and try to compare them with other code.
73+
74+
75+
## How do I edit maps?
76+
77+
For `asm` scripts, read [docs/map_event_scripts.md](https://pret.github.io/pokecrystal/map_event_scripts). For `blk` layouts, use [Polished Map][polished-map].
78+
79+
80+
## How do I edit the colors of an image?
81+
82+
Most `.png` images are paletted PNGs. You can edit these with any program that supports creating PNGs with palette information. These palettes should consist of exactly 4 colors. Additionally, for Pokémon images, the first color should be white, and the last black. Tools such as Paint and [GIMP](gimp) will do the right job, while other tools such as [paint.net](paintdotnet) or Photoshop might mess it up and output palettes of 255 colors even though only using 4. You may try using tools like [GraphicsGale](graphicsgale) or [IrfanView](irfanview) to fix this, or sometimes resaving the image in Paint seems to help.
83+
84+
Some image `.png` files are grayscale. This indicates that even though these images do have proper colors in-game, they're shared with something else, and as such changing them will affect other things as well. Don't try opening the `.2bpp` files, these only contain the image data as well, not the palettes.
85+
86+
It really depends on what image you're trying to change the colors of, where these colors are specified. Try looking for related files or `.pal` files.
87+
88+
89+
## How do I write new features?
90+
91+
There are a number of special-purpose scripting languages, as described in [docs](https://pret.github.io/pokecrystal/). For more general features, you'll need to code directly in [assembly language][asm]. Some of the [tutorials][tutorials] for specific features may also be helpful.
92+
93+
94+
## How do I share code on Discord?
95+
96+
If you're looking for help on Discord, you'll probably need to share your code. How to do this:
97+
98+
- Post *short* pieces of code in Discord messages, surrounded with three <code>\`\`\`backticks\`\`\`</code> to make a [code block][markdown].
99+
- Post longer pieces of code by linking to [GitHub Gist][gist], [Pastebin][pastebin], [Hastebin][hastebin], or other such sites.
100+
- Share your entire pokecrystal project at once by hosting it on GitHub as a fork of this repository. Read the [GitHub Help][forkhelp] for details.
101+
102+
If your code is on GitHub, you can [link to specific lines][snippethelp]. Put "`#L42`" at the end of a URL to link to line 42, or "`#L10-L20`" to link to lines 10-20. For example: [https://github.com/pret/pokecrystal/blob/master/main.asm#L21-L26](https://github.com/pret/pokecrystal/blob/master/main.asm#L21-L26)
103+
104+
105+
## I need more help!
106+
107+
Try asking on Discord or IRC (see [README.md](README.md)).
108+
109+
[cygwin]: https://cygwin.com/install.html
110+
[rgbds]: https://github.com/gbdev/rgbds/releases
111+
[polished-map]: https://github.com/Rangi42/polished-map
112+
[gimp]: https://www.gimp.org/
113+
[paintdotnet]: https://www.getpaint.net/
114+
[graphicsgale]: https://graphicsgale.com/us/
115+
[irfanview]: https://www.irfanview.com/
116+
[asm]: https://github.com/pret/pokecrystal/wiki/Assembly-programming
117+
[tutorials]: https://github.com/pret/pokecrystal/wiki/Tutorials
118+
[markdown]: https://support.discordapp.com/hc/en-us/articles/210298617
119+
[gist]: https://gist.github.com/
120+
[pastebin]: https://pastebin.com/
121+
[hastebin]: https://hastebin.com/
122+
[forkhelp]: https://help.github.com/en/github/getting-started-with-github/fork-a-repo
123+
[snippethelp]: https://help.github.com/en/github/managing-your-work-on-github/creating-a-permanent-link-to-a-code-snippet

STYLE.md

+150
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,150 @@
1+
# Style Guide
2+
3+
Some of the code will disagree with this guide. Older code is less likely to be correct. Use your best judgement.
4+
5+
When you come across an edge case that isn't referenced in this guide, please add it.
6+
7+
8+
## Comments
9+
10+
```asm
11+
; Use tabs for indentation, and spaces for alignment.
12+
; When tabs get in the way of alignment, use spaces instead.
13+
14+
; Comments lead with spaces after the semicolon.
15+
16+
; 80 char soft limit. This isn't enforced, but you should try to keep lines from being any longer.
17+
; rgbasm doesn't have newline escapes so there's no avoiding exceeding the limit for longer macros.
18+
19+
; capitalization and punctuation dont matter
20+
; but it should be consistent with the surroundings
21+
22+
; Space out paragraphs with two newlines. Don't put ;s on blank lines.
23+
24+
; Code comments should be wrapped to whatever
25+
; is most readable rather than what's closest
26+
; to the 80 char limit.
27+
28+
; Especially since most code is going to be
29+
; under 30 chars per line, including tabs.
30+
31+
; Comments should go above the code they're describing, not below, and not inline.
32+
ld a, [hl]
33+
add b
34+
ld [hl], a
35+
ret
36+
37+
; Avoid comments on the same line as instructions.
38+
cp 10
39+
jr c, .elsewhere ; don't do this
40+
41+
; If you have a larger comment and want to make
42+
; a side note on a snippet of code:
43+
; You can indent the comment,
44+
; but each line should be shorter
45+
; and spaced away from the parent comment
46+
halt
47+
nop
48+
49+
; To comment out code, put the ; before the tab indent.
50+
; nop
51+
cp 10
52+
; jr c, .bye
53+
ret
54+
```
55+
56+
## Labels
57+
58+
```asm
59+
; ROM Labels
60+
PascalCase: ; label
61+
PascalCase:: ; global label
62+
.snake_case ; local jump
63+
.PascalCase: ; an atomic chunk of code or data that's local
64+
; don't define unused labels when a comment would do
65+
66+
; Labels are prefixed with lower case letters depending on location
67+
wPascalCase: ; wram
68+
sPascalCase: ; sram
69+
vPascalCase: ; vram
70+
hPascalCase: ; hram
71+
PascalCase: ; rom
72+
73+
; Some constants are also prefixed
74+
DEF rBGP EQU $ff47 ; hardware register
75+
76+
; Most other constants should be upper case
77+
DEF UPPER_CASE EQU 1
78+
79+
; Long lists of constants should be aligned
80+
DEF SHORT_CONSTANT EQU 1
81+
DEF LONGER_CONSTANT EQU 2
82+
DEF PRETTY_LONG_CONSTANT EQU 3
83+
DEF TINY EQU 4
84+
85+
DEF BUT_ONLY_RELATED_CONSTANTS EQU 5
86+
```
87+
88+
## Directives
89+
90+
```asm
91+
; meta and high-level directives should be uppercase
92+
SECTION "section", ROMX
93+
INCLUDE "filename"
94+
INCBIN "filename"
95+
MACRO my_macro
96+
nop
97+
ENDM
98+
DEF TEST EQUS "test"
99+
PURGE TEST
100+
DEF TEST EQU 2
101+
102+
; data macros should be lowercase
103+
db 1
104+
dw 2
105+
my_macro SOME_CONSTANT
106+
; one exception is RGB
107+
RGB 31, 31, 31
108+
109+
; code macros are currently lowercase but this seems to be causing confusion with actual instructions
110+
ld b, TEST
111+
farcall DistantFunction
112+
ret
113+
114+
; the rest is up to you, just be consistent (prefer lowercase)
115+
set X, 1
116+
rept 10
117+
nop
118+
endr
119+
```
120+
121+
## Macros
122+
123+
```asm
124+
MACRO when_in_doubt_lowercase
125+
126+
; only shift if it's required or more readable
127+
; dont
128+
db \1
129+
shift
130+
db \1
131+
132+
; do
133+
rept 10
134+
db \1
135+
shift
136+
endr
137+
138+
; do
139+
db \1, \2, \3, \4, \5
140+
shift 5
141+
db \1, \2, \3, \4, \5
142+
143+
ENDM
144+
145+
146+
MACRO UPPER_CASE_IS_OK_SOMETIMES
147+
148+
; but I can't think of any examples besides ACRONYMS
149+
ENDM
150+
```

WTW.cheats

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
#
2+
0100FAC2
3+
0100FBC2
4+
0100FCC2
5+
0100FDC2
6+
0100FAC2

0 commit comments

Comments
 (0)