Pokered Save Editor 2
Pokemon Red & Blue save file editor - Qt 6 C++/QML
Loading...
Searching...
No Matches
savefile_autoport.h
Go to the documentation of this file.
1/*
2 * Copyright 2020 Twilight
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15*/
16#pragma once
17#include <QtCore/qglobal.h>
18#include <QMetaType>
19
30
35#if defined(SAVEFILE_LIBRARY)
36# define SAVEFILE_AUTOPORT Q_DECL_EXPORT
37#else
38# define SAVEFILE_AUTOPORT Q_DECL_IMPORT
39#endif
40
41
42// -- Opaque pointer declarations ----------------------------------------------
43// CAUTION: Q_DECLARE_OPAQUE_POINTER(T*) forces
44// QtPrivate::IsPointerToTypeDerivedFromQObject<T*> = false. For a *real* QObject
45// type that makes Qt store the pointer as a plain opaque value, so any QML read
46// of `obj.thatProperty.subProperty` returns `undefined` even though the C++
47// object is valid. This is why the whole brg.file.data.dataExpanded.* chain used
48// to read as undefined.
49//
50// The fix for QObject types is to fully #include their headers wherever their
51// pointers appear in a Q_PROPERTY / signal / slot / Q_INVOKABLE (see the
52// expanded/*.h headers). With the full definition visible, Qt correctly detects
53// them as QObject pointers and QML can traverse the chain -- no opaque decl
54// needed. See notes/reference/qt6-patterns.md.
55//
56// The types below are kept opaque ON PURPOSE: nothing in QML traverses them
57// (verified by grepping the .qml for dataExpanded.* chains). Keeping them opaque
58// + forward-declared means the widely-included headers (savefileexpanded.h /
59// area.h / world.h) do NOT have to pull these sub-trees into every translation
60// unit -- that fan-out was making the build very slow. If you later traverse one
61// of these in QML, remove it here and #include its full header at the
62// declaration site instead. See notes/reference/qt6-patterns.md.
63
64class Daycare;
65class HallOfFame;
66class Rival;
67class WorldCompleted;
68class WorldEvents;
69class WorldGeneral;
70class WorldHidden;
71class WorldMissables;
72class WorldScripts;
73class WorldTowns;
74class WorldTrades;
75class WorldLocal;
76
77Q_DECLARE_OPAQUE_POINTER(Daycare*)
78Q_DECLARE_OPAQUE_POINTER(HallOfFame*)
79Q_DECLARE_OPAQUE_POINTER(Rival*)
80Q_DECLARE_OPAQUE_POINTER(WorldCompleted*)
81Q_DECLARE_OPAQUE_POINTER(WorldEvents*)
82Q_DECLARE_OPAQUE_POINTER(WorldGeneral*)
83Q_DECLARE_OPAQUE_POINTER(WorldHidden*)
84Q_DECLARE_OPAQUE_POINTER(WorldMissables*)
85Q_DECLARE_OPAQUE_POINTER(WorldScripts*)
86Q_DECLARE_OPAQUE_POINTER(WorldTowns*)
87Q_DECLARE_OPAQUE_POINTER(WorldTrades*)
88Q_DECLARE_OPAQUE_POINTER(WorldLocal*)
The Day Care: at most one deposited Pokemon.
Definition daycare.h:42
The Hall of Fame: a rolling list of up to 50 winning-team records.
Definition halloffame.h:38
The rival: their name and chosen starter.
Definition rival.h:34
A handful of one-off "have you done X yet" milestone flags.
The game's story-event flags – a flat array of 508 booleans.
Definition worldevents.h:39
General world settings: last maps plus the Options / LetterDelay objects.
"Already collected" flags for hidden items and hidden Game Corner coins.
Definition worldhidden.h:42
A few map-specific puzzle/minigame state values.
Definition worldlocal.h:34
Visibility flags for "missable" sprites (one-time NPCs/items on maps).
Per-map script progress values (the in-progress state of each map's script).
"Visited" flags for towns – which fly destinations are unlocked.
Definition worldtowns.h:36
"Done" flags for the game's in-game (NPC) trades.
Definition worldtrades.h:36