diff options
| author | ItsNotRexed <300290919+ItsNotRexed@users.noreply.github.com> | 2026-11-21 22:09:26 -0500 |
|---|---|---|
| committer | ItsNotRexed <300290919+ItsNotRexed@users.noreply.github.com> | 2026-11-21 22:09:26 -0500 |
| commit | 3d4f0df6c4d1560e3117d5df1e37e186d53473a5 (patch) | |
| tree | 3385a2e12d6ffe694f1c4aaf983ec072837d4b0e | |
| parent | ec4840ab361f512e027a8f43248f2983800348bc (diff) | |
| parent | cd6ade80c9ca72a3296cf52177f9a715349b7c8c (diff) | |
Merge pull request #787 from 465d6a0eac
| -rw-r--r-- | docs/gamedata.md | 49 | ||||
| -rw-r--r-- | tests/test_gamedata_maps.py | 49 | ||||
| -rw-r--r-- | tools/gamedata_maps.py | 77 |
3 files changed, 157 insertions, 18 deletions
diff --git a/docs/gamedata.md b/docs/gamedata.md index b7ea0aab9..3a1a7aad7 100644 --- a/docs/gamedata.md +++ b/docs/gamedata.md | |||
| @@ -133,17 +133,17 @@ and 1,100 x 1,100) was an artifact. The prefix is the zeroed row headers of | |||
| 133 | the empty rows, and the grid is 2048 x 2048. The largest square that ends at | 133 | the empty rows, and the grid is 2048 x 2048. The largest square that ends at |
| 134 | the payload end happened to fit the byte count, but it is not the format. | 134 | the payload end happened to fit the byte count, but it is not the format. |
| 135 | 135 | ||
| 136 | ### `PAMH`: `HMAP` v1.2, 144 x 164 max/min heightmap | 136 | ### `PAMH`: `HMAP` max/min heightmap (`common.rpf` 144 x 164, tiles 64 x 64) |
| 137 | 137 | ||
| 138 | | Header | Offset | Type | Measured | | 138 | | Header | Offset | Type | Measured | |
| 139 | |---|---|---|---| | 139 | |---|---|---|---| |
| 140 | | magic | 0x00 | 4 bytes | `PAMH` (little-endian `HMAP`) | | 140 | | magic | 0x00 | 4 bytes | `PAMH` (little-endian `HMAP`) | |
| 141 | | version | 0x04 | 2 x `u8` | 1.2 | | 141 | | version | 0x04 | 2 x `u8` | 1.2 in `common.rpf`; overwritten in the `levels.rpf` tiles | |
| 142 | | pad | 0x06 | `u16` | 0 | | 142 | | pad | 0x06 | `u16` | 0 in `common.rpf`; text in the tiles | |
| 143 | | flag word | 0x08 | `u32` | `0x1BBC8CED` (GTA V's `compressed` field) | | 143 | | flag word | 0x08 | `u32` | `0x1BBC8CED` in `common.rpf`; padding in the tiles | |
| 144 | | width, height | 0x0C | 2 x `u16` | 144, 164 | | 144 | | width, height | 0x0C | 2 x `u16` | 144, 164 in `common.rpf`; 64, 64 in every tile | |
| 145 | | six bounds | 0x10 | 6 x `f32` | `(-13312, -9728, -302)` to `(5120, 11264, 404)` | | 145 | | six bounds | 0x10 | 6 x `f32` | `(-13312, -9728, -302)` to `(5120, 11264, 404)` | |
| 146 | | data size | 0x28 | `u32` | 48,544 | | 146 | | data size | 0x28 | `u32` | 48,544 in `common.rpf`; 8,704 in a tile | |
| 147 | 147 | ||
| 148 | At 0x2C there are 164 row records, then `width * height` **max** bytes and | 148 | At 0x2C there are 164 row records, then `width * height` **max** bytes and |
| 149 | `width * height` **min** bytes. The measured max layer runs 110..255 and the | 149 | `width * height` **min** bytes. The measured max layer runs 110..255 and the |
| @@ -154,6 +154,34 @@ on land. The min layer is the ground or sea floor. | |||
| 154 | The earlier u16 reading interleaved the two arrays: every measured `0x6E6E` | 154 | The earlier u16 reading interleaved the two arrays: every measured `0x6E6E` |
| 155 | was a `(110, 110)` max/min pair, not the value 28,270. | 155 | was a `(110, 110)` max/min pair, not the value 28,270. |
| 156 | 156 | ||
| 157 | ### The 1,476 `PAMH` tiles in `levels.rpf` | ||
| 158 | |||
| 159 | `levels.rpf` holds 1,476 more `PAMH` payloads. All of them decode with the | ||
| 160 | same rules: a 44-byte header, 64 x 64 cells, 64 full-width row records with | ||
| 161 | `start = 0`, `count = 64` and `offset = y * 64`, then 4,096 **max** bytes and | ||
| 162 | 4,096 **min** bytes. That is 6,045,696 cells in total. | ||
| 163 | |||
| 164 | - The tiles are a 36 x 41 rectangle with **512 m** spacing, so they cover the | ||
| 165 | same `(-13312, -9728)` to `(5120, 11264)` box as the `common.rpf` payload, | ||
| 166 | with the same Z box `-302` to `404`. | ||
| 167 | - Max values span 0..255 and min values 0..254. `min <= max` in all but 62 | ||
| 168 | cells, all in the tile at `(-5120, 2048)`, where the encoder wrote a min | ||
| 169 | above its max. | ||
| 170 | - Bytes 0x05..0x0B are leftover text, not a version minor and a flag. 0x04 | ||
| 171 | stays 1, 0x05.. hold the tile name `n_m` (column + 1, row + 1), and the | ||
| 172 | remaining bytes keep the tail of the string `height`, right-aligned at 0x0B. | ||
| 173 | The 28 distinct 0x08..0x0B words are all text; none is zero and none changes | ||
| 174 | the arrays. | ||
| 175 | - The census groups by grid size, not by the 0x04 version bytes, because | ||
| 176 | 0x05 is the first digit of the name. Nothing depends on the 0x08 word. | ||
| 177 | |||
| 178 | ```powershell | ||
| 179 | python -I tools/gamedata_maps.py <work>\carve\levels --json levels.json | ||
| 180 | ``` | ||
| 181 | |||
| 182 | The tool prints one `PAMH census 64x64: ...` line and writes the per-group | ||
| 183 | counts. Only header fields and counts are written, never the height bytes. | ||
| 184 | |||
| 157 | ### Cross-check and Z mapping | 185 | ### Cross-check and Z mapping |
| 158 | 186 | ||
| 159 | MHIU and PAMH cover slightly different boxes at different resolutions. | 187 | MHIU and PAMH cover slightly different boxes at different resolutions. |
| @@ -176,9 +204,12 @@ python -I tools/gamedata_maps.py <work>\carve\common --json maps.json | |||
| 176 | 204 | ||
| 177 | ### Checksum and unknown fields | 205 | ### Checksum and unknown fields |
| 178 | 206 | ||
| 179 | - `PAMH` 0x08 is the HMAP `compressed` word (GTA V writes 1). The measured | 207 | - `PAMH` 0x08 is GTA V's `compressed` word only in the `common.rpf` payload, |
| 180 | `0x1BBC8CED` is not CRC32, Adler32, FNV-1a, joaat32 or a hashlib digest of | 208 | where it holds `0x1BBC8CED`. In the 1,476 `levels.rpf` tiles bytes 0x04..0x0B |
| 181 | the max/min arrays; it is reported as a flag word, not a proven checksum. | 209 | are leftover text (tile name plus `height`), so 0x08 is padding there. The |
| 210 | `0x1BBC8CED` value is not CRC32, Adler32, FNV-1a, joaat32 or a hashlib | ||
| 211 | digest of the max/min arrays; it is reported as a flag word, not a proven | ||
| 212 | checksum. | ||
| 182 | - `MHIU` 0x28 is a `u8` default height, not a 32-bit word (ASSET-48). Its | 213 | - `MHIU` 0x28 is a `u8` default height, not a 32-bit word (ASSET-48). Its |
| 183 | value is 23 in both payloads, the same value the empty rows were measured | 214 | value is 23 in both payloads, the same value the empty rows were measured |
| 184 | to hold, and the row cropping above uses it. A full scan of all 12 archives | 215 | to hold, and the row cropping above uses it. A full scan of all 12 archives |
diff --git a/tests/test_gamedata_maps.py b/tests/test_gamedata_maps.py index 13ed40ca9..f898de816 100644 --- a/tests/test_gamedata_maps.py +++ b/tests/test_gamedata_maps.py | |||
| @@ -47,15 +47,16 @@ def mhiu_payload(width: int, height: int, rows, pixels: bytes, | |||
| 47 | 47 | ||
| 48 | 48 | ||
| 49 | def pamh_payload(width: int, height: int, maximum, minimum, | 49 | def pamh_payload(width: int, height: int, maximum, minimum, |
| 50 | flag: int = 0x1BBC8CED) -> bytes: | 50 | padding: int = 0x1BBC8CED, |
| 51 | version: tuple = (1, 2)) -> bytes: | ||
| 51 | rows = b"".join(struct.pack("<HHi", 0, width, i * width) | 52 | rows = b"".join(struct.pack("<HHi", 0, width, i * width) |
| 52 | for i in range(height)) | 53 | for i in range(height)) |
| 53 | data = rows + bytes(maximum) + bytes(minimum) | 54 | data = rows + bytes(maximum) + bytes(minimum) |
| 54 | head = bytearray(44) | 55 | head = bytearray(44) |
| 55 | head[:4] = b"PAMH" | 56 | head[:4] = b"PAMH" |
| 56 | head[0x04] = 1 | 57 | head[0x04] = version[0] |
| 57 | head[0x05] = 2 | 58 | head[0x05] = version[1] |
| 58 | struct.pack_into("<I", head, 0x08, flag) | 59 | struct.pack_into("<I", head, 0x08, padding) |
| 59 | struct.pack_into("<HH", head, 0x0C, width, height) | 60 | struct.pack_into("<HH", head, 0x0C, width, height) |
| 60 | struct.pack_into("<6f", head, 0x10, -10.0, -20.0, -30.0, 40.0, 50.0, 60.0) | 61 | struct.pack_into("<6f", head, 0x10, -10.0, -20.0, -30.0, 40.0, 50.0, 60.0) |
| 61 | struct.pack_into("<I", head, 0x28, len(data)) | 62 | struct.pack_into("<I", head, 0x28, len(data)) |
| @@ -151,12 +152,50 @@ class GamedataMapsTest(unittest.TestCase): | |||
| 151 | p = gamedata_maps.parse_pamh(payload) | 152 | p = gamedata_maps.parse_pamh(payload) |
| 152 | self.assertEqual(p["header"]["version_major"], 1) | 153 | self.assertEqual(p["header"]["version_major"], 1) |
| 153 | self.assertEqual(p["header"]["version_minor"], 2) | 154 | self.assertEqual(p["header"]["version_minor"], 2) |
| 154 | self.assertEqual(p["header"]["flag"], 0x1BBC8CED) | 155 | self.assertEqual(p["header"]["padding08"], 0x1BBC8CED) |
| 155 | self.assertEqual(p["header"]["bounds"]["max"], [40.0, 50.0, 60.0]) | 156 | self.assertEqual(p["header"]["bounds"]["max"], [40.0, 50.0, 60.0]) |
| 156 | self.assertEqual(list(p["_max"]), [1, 2, 3, 4, 5, 6]) | 157 | self.assertEqual(list(p["_max"]), [1, 2, 3, 4, 5, 6]) |
| 157 | self.assertEqual(list(p["_min"]), [0, 1, 2, 3, 4, 7]) | 158 | self.assertEqual(list(p["_min"]), [0, 1, 2, 3, 4, 7]) |
| 158 | self.assertEqual(p["grid"]["min_above_max"], 1) | 159 | self.assertEqual(p["grid"]["min_above_max"], 1) |
| 159 | 160 | ||
| 161 | def test_pamh_padding_word_does_not_change_the_arrays(self): | ||
| 162 | args = (3, 2, [1, 2, 3, 4, 5, 6], [0, 1, 2, 3, 4, 7]) | ||
| 163 | zero = gamedata_maps.parse_pamh(pamh_payload(*args, padding=0)) | ||
| 164 | measured = gamedata_maps.parse_pamh(pamh_payload(*args, padding=0x1BBC8CED)) | ||
| 165 | ascii_tail = gamedata_maps.parse_pamh(pamh_payload(*args, padding=0x74680001)) | ||
| 166 | self.assertEqual((zero["header"]["padding08"], measured["header"]["padding08"], | ||
| 167 | ascii_tail["header"]["padding08"]), | ||
| 168 | (0, 0x1BBC8CED, 0x74680001)) | ||
| 169 | self.assertEqual(zero["_max"], measured["_max"]) | ||
| 170 | self.assertEqual(zero["_min"], ascii_tail["_min"]) | ||
| 171 | self.assertEqual(measured["grid"], ascii_tail["grid"]) | ||
| 172 | |||
| 173 | def test_pamh_census_groups_tiles_by_grid(self): | ||
| 174 | self.add(pamh_payload(4, 3, [1] * 12, [0] * 12, padding=0, version=(1, 1))) | ||
| 175 | self.add(pamh_payload(4, 3, [2] * 12, [0] * 12, | ||
| 176 | padding=0x74680001, version=(1, 2))) | ||
| 177 | self.add(pamh_payload(2, 2, [3] * 4, [0] * 4, version=(1, 2))) | ||
| 178 | self.finish() | ||
| 179 | |||
| 180 | p, data = self.run_tool() | ||
| 181 | self.assertEqual(p.returncode, 0, p.stdout + p.stderr) | ||
| 182 | census = data["pamh_census"] | ||
| 183 | self.assertEqual([(g["width"], g["height"], g["tiles"]) for g in census], | ||
| 184 | [(4, 3, 2), (2, 2, 1)]) | ||
| 185 | first = census[0] | ||
| 186 | self.assertEqual((first["full_width_row_tiles"], first["padding08_zero"], | ||
| 187 | first["padding08_distinct"]), (2, 1, 2)) | ||
| 188 | self.assertEqual(first["version_minor"], {"1": 1, "2": 1}) | ||
| 189 | self.assertEqual(first["bounds_min"], [-10.0, -20.0, -30.0]) | ||
| 190 | self.assertIn("PAMH census 4x3: 2 tiles", p.stdout) | ||
| 191 | |||
| 192 | def test_pamh_row_table_full_width_count(self): | ||
| 193 | payload = pamh_payload(3, 2, [1] * 6, [0] * 6) | ||
| 194 | head = bytearray(payload) | ||
| 195 | struct.pack_into("<HH", head, 44, 0, 2) | ||
| 196 | p = gamedata_maps.parse_pamh(bytes(head)) | ||
| 197 | self.assertEqual(p["grid"]["full_width_rows"], 1) | ||
| 198 | |||
| 160 | def test_pamh_rejects_a_short_row_body(self): | 199 | def test_pamh_rejects_a_short_row_body(self): |
| 161 | payload = pamh_payload(2, 2, [1, 2, 3, 4], [0, 1, 2, 3]) | 200 | payload = pamh_payload(2, 2, [1, 2, 3, 4], [0, 1, 2, 3]) |
| 162 | head = bytearray(payload[:-1]) | 201 | head = bytearray(payload[:-1]) |
diff --git a/tools/gamedata_maps.py b/tools/gamedata_maps.py index 9efce56a5..c490d4e9e 100644 --- a/tools/gamedata_maps.py +++ b/tools/gamedata_maps.py | |||
| @@ -24,9 +24,11 @@ match the published GTA V `heightmap.dat` (`HMAP`) layout: | |||
| 24 | 24 | ||
| 25 | `PAMH` (`HMAP` read little-endian) | 25 | `PAMH` (`HMAP` read little-endian) |
| 26 | 0x00 "PAMH" (the `HMAP` magic stored little-endian) | 26 | 0x00 "PAMH" (the `HMAP` magic stored little-endian) |
| 27 | 0x04 u8 version major, u8 version minor | 27 | 0x04 u8 version major, u8 version minor (1.2 in `common.rpf`) |
| 28 | 0x05 in the `levels.rpf` tiles 0x05..0x0B also hold leftover text of the | ||
| 29 | tile name; 0x04 stays 1 and the real fields start at 0x0C (see below) | ||
| 28 | 0x06 u16 pad | 30 | 0x06 u16 pad |
| 29 | 0x08 u32 compressed/flag word (GTA V writes 1; measured 0x1BBC8CED here) | 31 | 0x08 u32: GTA V's `compressed` word in `common.rpf`, padding in the tiles |
| 30 | 0x0C u16 width | 32 | 0x0C u16 width |
| 31 | 0x0E u16 height | 33 | 0x0E u16 height |
| 32 | 0x10 six f32 bounds (min xyz, max xyz) | 34 | 0x10 six f32 bounds (min xyz, max xyz) |
| @@ -36,6 +38,14 @@ match the published GTA V `heightmap.dat` (`HMAP`) layout: | |||
| 36 | On the measured file the first array is a flat 110 (2.5 m) sea-surface | 38 | On the measured file the first array is a flat 110 (2.5 m) sea-surface |
| 37 | layer and the second is the ground; min <= max in all 23,616 cells. | 39 | layer and the second is the ground; min <= max in all 23,616 cells. |
| 38 | 40 | ||
| 41 | In the 1,476 64 x 64 tiles of `levels.rpf`, bytes 0x05..0x0B hold leftover text, | ||
| 42 | not a version minor and a flag: 0x04 stays 1, 0x05.. hold the tile name `n_m` | ||
| 43 | (n = column + 1, m = row + 1), and the remaining bytes keep the right-aligned | ||
| 44 | tail of the string `height` (`ght`, `ht`, or a zero byte when the name is | ||
| 45 | longer). The 28 distinct 0x08..0x0B words are all text and none of them changes | ||
| 46 | the arrays, so 0x08 is padding there. The `common.rpf` payload happens to hold | ||
| 47 | 0x1BBC8CED, which is why it was once reported as a `compressed` flag. | ||
| 48 | |||
| 39 | Both formats scale a u8 value into the header's Z box: | 49 | Both formats scale a u8 value into the header's Z box: |
| 40 | 50 | ||
| 41 | z = min.z + value / 255 * (max.z - min.z) | 51 | z = min.z + value / 255 * (max.z - min.z) |
| @@ -178,11 +188,14 @@ def parse_pamh(blob: bytes) -> dict: | |||
| 178 | half = width * height | 188 | half = width * height |
| 179 | maximum = bytearray(half) | 189 | maximum = bytearray(half) |
| 180 | minimum = bytearray(half) | 190 | minimum = bytearray(half) |
| 191 | full_width = 0 | ||
| 181 | for y in range(height): | 192 | for y in range(height): |
| 182 | start, count = struct.unpack_from("<HH", rows, y * 8) | 193 | start, count = struct.unpack_from("<HH", rows, y * 8) |
| 183 | offset = struct.unpack_from("<i", rows, y * 8 + 4)[0] | 194 | offset = struct.unpack_from("<i", rows, y * 8 + 4)[0] |
| 184 | if start + count > width: | 195 | if start + count > width: |
| 185 | raise ValueError(f"PAMH row {y} leaves the {width}-cell width") | 196 | raise ValueError(f"PAMH row {y} leaves the {width}-cell width") |
| 197 | if start == 0 and count == width: | ||
| 198 | full_width += 1 | ||
| 186 | for i in range(count): | 199 | for i in range(count): |
| 187 | x = start + i | 200 | x = start + i |
| 188 | at = offset + x | 201 | at = offset + x |
| @@ -197,7 +210,7 @@ def parse_pamh(blob: bytes) -> dict: | |||
| 197 | "header": { | 210 | "header": { |
| 198 | "version_major": blob[0x04], | 211 | "version_major": blob[0x04], |
| 199 | "version_minor": blob[0x05], | 212 | "version_minor": blob[0x05], |
| 200 | "flag": _u32(blob, 0x08), | 213 | "padding08": _u32(blob, 0x08), |
| 201 | "width": width, | 214 | "width": width, |
| 202 | "height": height, | 215 | "height": height, |
| 203 | "bounds": bounds, | 216 | "bounds": bounds, |
| @@ -210,6 +223,7 @@ def parse_pamh(blob: bytes) -> dict: | |||
| 210 | "height": height, | 223 | "height": height, |
| 211 | "cells": width * height, | 224 | "cells": width * height, |
| 212 | "row_records": height, | 225 | "row_records": height, |
| 226 | "full_width_rows": full_width, | ||
| 213 | "max_min": min(maximum), | 227 | "max_min": min(maximum), |
| 214 | "max_max": max(maximum), | 228 | "max_max": max(maximum), |
| 215 | "min_min": min(minimum), | 229 | "min_min": min(minimum), |
| @@ -221,6 +235,52 @@ def parse_pamh(blob: bytes) -> dict: | |||
| 221 | } | 235 | } |
| 222 | 236 | ||
| 223 | 237 | ||
| 238 | def pamh_census(payloads: list[dict]) -> list[dict]: | ||
| 239 | """Group decoded PAMH payloads by grid size and count what varies inside a group. | ||
| 240 | |||
| 241 | The 0x08 word is padding, so it is counted, not used as a key. Byte 0x05 is the HMAP | ||
| 242 | version-minor byte in the common.rpf payload but holds text in the levels.rpf tiles, so it is | ||
| 243 | reported as a distribution instead of a group key.""" | ||
| 244 | groups = {} | ||
| 245 | for p in payloads: | ||
| 246 | if p["type"] != "PAMH": | ||
| 247 | continue | ||
| 248 | h, g = p["header"], p["grid"] | ||
| 249 | grp = groups.get((g["width"], g["height"])) | ||
| 250 | if grp is None: | ||
| 251 | grp = groups[(g["width"], g["height"])] = { | ||
| 252 | "width": g["width"], | ||
| 253 | "height": g["height"], | ||
| 254 | "tiles": 0, | ||
| 255 | "cells": 0, | ||
| 256 | "bounds_min": list(h["bounds"]["min"]), | ||
| 257 | "bounds_max": list(h["bounds"]["max"]), | ||
| 258 | "full_width_row_tiles": 0, | ||
| 259 | "min_above_max": 0, | ||
| 260 | "version_minor": {}, | ||
| 261 | "padding08_zero": 0, | ||
| 262 | "_padding": set(), | ||
| 263 | } | ||
| 264 | grp["tiles"] += 1 | ||
| 265 | grp["cells"] += g["cells"] | ||
| 266 | for i in range(3): | ||
| 267 | grp["bounds_min"][i] = min(grp["bounds_min"][i], h["bounds"]["min"][i]) | ||
| 268 | grp["bounds_max"][i] = max(grp["bounds_max"][i], h["bounds"]["max"][i]) | ||
| 269 | if g["full_width_rows"] == g["height"]: | ||
| 270 | grp["full_width_row_tiles"] += 1 | ||
| 271 | grp["min_above_max"] += g["min_above_max"] | ||
| 272 | minor = str(h["version_minor"]) | ||
| 273 | grp["version_minor"][minor] = grp["version_minor"].get(minor, 0) + 1 | ||
| 274 | if h["padding08"] == 0: | ||
| 275 | grp["padding08_zero"] += 1 | ||
| 276 | grp["_padding"].add(h["padding08"]) | ||
| 277 | out = list(groups.values()) | ||
| 278 | for grp in out: | ||
| 279 | grp["padding08_distinct"] = len(grp.pop("_padding")) | ||
| 280 | out.sort(key=lambda x: (-x["tiles"], x["width"], x["height"])) | ||
| 281 | return out | ||
| 282 | |||
| 283 | |||
| 224 | def parse_payload(blob: bytes) -> dict: | 284 | def parse_payload(blob: bytes) -> dict: |
| 225 | if blob[:4] == b"MHIU": | 285 | if blob[:4] == b"MHIU": |
| 226 | return parse_mhiu(blob) | 286 | return parse_mhiu(blob) |
| @@ -310,9 +370,18 @@ def main() -> int: | |||
| 310 | f'{g["min_above_max"]} cells min>max') | 370 | f'{g["min_above_max"]} cells min>max') |
| 311 | if not payloads: | 371 | if not payloads: |
| 312 | print("no MHIU or PAMH payloads") | 372 | print("no MHIU or PAMH payloads") |
| 373 | census = pamh_census(payloads) | ||
| 374 | for grp in census: | ||
| 375 | print(f'PAMH census {grp["width"]}x{grp["height"]}: {grp["tiles"]} tiles, ' | ||
| 376 | f'{grp["full_width_row_tiles"]} with full-width rows, ' | ||
| 377 | f'{grp["min_above_max"]} cells min>max, padding 08 zero {grp["padding08_zero"]}, ' | ||
| 378 | f'{grp["padding08_distinct"]} distinct') | ||
| 313 | if a.json: | 379 | if a.json: |
| 380 | out = {"payloads": [_public(p) for p in payloads]} | ||
| 381 | if census: | ||
| 382 | out["pamh_census"] = census | ||
| 314 | with open(a.json, "w", encoding="utf-8") as f: | 383 | with open(a.json, "w", encoding="utf-8") as f: |
| 315 | json.dump({"payloads": [_public(p) for p in payloads]}, f, indent=1) | 384 | json.dump(out, f, indent=1) |
| 316 | print("wrote", a.json) | 385 | print("wrote", a.json) |
| 317 | return 0 | 386 | return 0 |
| 318 | 387 | ||