mirror of
https://github.com/rh-hideout/pokeemerald-expansion.git
synced 2026-04-26 10:25:49 -05:00
Add Instructions on how to build FRLG by default (#9415)
This commit is contained in:
parent
5f36a55bf4
commit
21be66b174
|
|
@ -44,3 +44,125 @@ Porymap:
|
|||
## Migrating FRLG tilesets
|
||||
To migrate tilesets that have been previously created for pokefirered you can use [this script](/migration_scripts/frlg_metatile_behavior_converter.py).<br>
|
||||
Instructions are in the script.
|
||||
|
||||
## Disclaimer: The changes below aren't the permanent solution for the problems, A better build system is being worked on so these solutions might cause merge conflicts down the line
|
||||
|
||||
## Build FRLG by default
|
||||
If you want that running `make -j<output of nproc>` to directly compile one of firered or leafgreen instead of emerald make the following changes to the `makefile`
|
||||
|
||||
(Here I have set the default version to be leafgreen and you can still compile emerald or firered using make emerald or make firered)
|
||||
|
||||
```diff
|
||||
-GAME_VERSION ?= EMERALD
|
||||
-TITLE ?= POKEMON EMER
|
||||
-GAME_CODE ?= BPEE
|
||||
-BUILD_NAME ?= emerald
|
||||
-MAP_VERSION ?= emerald
|
||||
+GAME_VERSION ?= LEAFGREEN
|
||||
+TITLE ?= POKEMON LEAF
|
||||
+GAME_CODE ?= BPGE
|
||||
+BUILD_NAME ?= leafgreen
|
||||
+MAP_VERSION ?= firered
|
||||
|
||||
ifeq (firered,$(MAKECMDGOALS))
|
||||
GAME_VERSION := FIRERED
|
||||
TITLE := POKEMON FIRE
|
||||
GAME_CODE := BPRE
|
||||
BUILD_NAME := firered
|
||||
MAP_VERSION := firered
|
||||
else
|
||||
|
||||
-ifeq (leafgreen,$(MAKECMDGOALS))
|
||||
- GAME_VERSION := LEAFGREEN
|
||||
- TITLE := POKEMON LEAF
|
||||
- GAME_CODE := BPGE
|
||||
- BUILD_NAME := leafgreen
|
||||
- MAP_VERSION := firered
|
||||
+ifeq (emerald,$(MAKECMDGOALS))
|
||||
+ GAME_VERSION := EMERALD
|
||||
+ TITLE := POKEMON EMER
|
||||
+ GAME_CODE := BPEE
|
||||
+ BUILD_NAME := emerald
|
||||
+ MAP_VERSION := emerald
|
||||
endif
|
||||
endif
|
||||
```
|
||||
|
||||
## Make empty region attibutes defaults to REGION_KANTO
|
||||
Another issue is that you need to add `REGION_KANTO` attribute to every new map you create
|
||||
|
||||
Make the following changes to your `tools/mapjson/mapjson.cpp` so the new maps you add without the `REGION_KANTO` also work fine
|
||||
|
||||
```diff
|
||||
string region = json_to_string(map_data, "region", true);
|
||||
|
||||
if (region.empty()) {
|
||||
- region = "REGION_HOENN";
|
||||
+ region = "REGION_KANTO";
|
||||
}
|
||||
string map_name = json_to_string(map_data, "name");
|
||||
|
||||
if ((version == "emerald" && region != "REGION_HOENN")
|
||||
|| (version == "firered" && region != "REGION_KANTO")) {
|
||||
invalid_maps.push_back(map_name);
|
||||
}
|
||||
```
|
||||
|
||||
Then run this script to set `REGION_KANTO` as the region attribute for all the Hoenn Maps
|
||||
|
||||
**Make sure you run this from the [root folder](../../) of your project!**
|
||||
|
||||
```
|
||||
python3 migration_scripts/add_region_hoenn_attribute_to_hoenn_maps.py
|
||||
```
|
||||
|
||||
Make sure to run `make clean` after running this script
|
||||
|
||||
## Fix CI if you are building FRLG by default
|
||||
If you make these I would also reccomend fixing your CI too to match these changes
|
||||
|
||||
Make the following changes to your `.github/workflows/build.yml`
|
||||
|
||||
```diff
|
||||
# build-essential and git are already installed
|
||||
|
||||
- - name: ROM (Emerald)
|
||||
+ - name: ROM (Leafgreen)
|
||||
env:
|
||||
COMPARE: 0
|
||||
- GAME_VERSION: EMERALD
|
||||
+ GAME_VERSION: LEAFGREEN
|
||||
run: make -j${nproc} -O all
|
||||
|
||||
- name: Release
|
||||
env:
|
||||
- GAME_VERSION: EMERALD
|
||||
+ GAME_VERSION: LEAFGREEN
|
||||
run: |
|
||||
make tidy
|
||||
make -j${nproc} release
|
||||
# make tidy to purge previous build
|
||||
|
||||
- name: Test
|
||||
env:
|
||||
- GAME_VERSION: EMERALD
|
||||
+ GAME_VERSION: LEAFGREEN
|
||||
TEST: 1
|
||||
run: |
|
||||
make -j${nproc} check
|
||||
|
||||
- name: ROM (Firered)
|
||||
env:
|
||||
COMPARE: 0
|
||||
run: |
|
||||
make clean
|
||||
make firered -j${nproc} -O
|
||||
|
||||
- - name: ROM (Leafgreen)
|
||||
+ - name: ROM (Emerald)
|
||||
env:
|
||||
COMPARE: 0
|
||||
run: |
|
||||
- make leafgreen -j${nproc} -O
|
||||
+ make emerald -j${nproc} -O
|
||||
```
|
||||
|
|
|
|||
|
|
@ -0,0 +1,42 @@
|
|||
import os
|
||||
|
||||
MAPS_DIR = "/data/maps"
|
||||
|
||||
for root, dirs, files in os.walk(MAPS_DIR):
|
||||
for file in files:
|
||||
if not file.endswith(".json"):
|
||||
continue
|
||||
|
||||
if file.endswith("_Frlg.json"):
|
||||
continue
|
||||
|
||||
filepath = os.path.join(root, file)
|
||||
|
||||
with open(filepath, "r", encoding="utf-8") as f:
|
||||
lines = f.readlines()
|
||||
|
||||
# Skip if region already exists
|
||||
if any('"region"' in line for line in lines):
|
||||
continue
|
||||
|
||||
new_lines = []
|
||||
inserted = False
|
||||
|
||||
for i, line in enumerate(lines):
|
||||
new_lines.append(line)
|
||||
|
||||
if '"music"' in line and not inserted:
|
||||
# Detect indentation from current line
|
||||
indent = line[:len(line) - len(line.lstrip())]
|
||||
|
||||
region_line = f'{indent}"region": "REGION_HOENN",\n'
|
||||
new_lines.append(region_line)
|
||||
inserted = True
|
||||
|
||||
if inserted:
|
||||
with open(filepath, "w", encoding="utf-8") as f:
|
||||
f.writelines(new_lines)
|
||||
|
||||
print(f"Updated: {filepath}")
|
||||
|
||||
print("Done.")
|
||||
Loading…
Reference in New Issue
Block a user