forked from PekanMmd/Pokemon-XD-Code
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathXDRelIndexes.swift
147 lines (127 loc) · 3.69 KB
/
XDRelIndexes.swift
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
//
// XDRelIndexes.swift
// GoD Tool
//
// Created by The Steez on 04/06/2018.
//
import Foundation
let kNumberMapPointers = 8 // min required
enum MapRelIndexes : Int {
case FirstCharacter = 0
case NumberOfCharacters = 1
case FirstInteractionLocation = 6 // warp entry points
case NumberOfInteractionLocations = 7
}
let kNumberRelPointers = 0x84
enum CommonIndexes : Int {
// 0xf6c is debug menu options
// each entry is used to set the story flag to the specified value
// then calls common.scd's "@flagshop" function (0x5960017) to set other necessary flags
// colosseum only
case PokefaceTextures = -1
case RoomData = -2
case NumberOfRoomData = -3
case Trainers = -4
case NumberOfTrainers = -5
case TrainerAIData = -6
case NumberOfTrainerAIData = -7
case PokemonData = -8
case NumberOfPokemonData = -9
case AIDebugScenarios = -10
case StoryDebugOptions = -12
case BattleDebugScenarios = -13
// xd
case BattleBingo = 0
case NumberOfBingoCards = 1
case PeopleIDs = 2 // 2 bytes at offset 0 person id 4 bytes at offset 4 string id for character name
case NumberOfPeopleIDs = 3
case numberOfPokespots = 11
case PokespotRock = 12
case PokespotRockEntries = 13
case PokespotOasis = 15
case PokespotOasisEntries = 16
case PokespotCave = 18
case PokespotCaveEntries = 19
case PokespotAll = 21
case PokespotAllEntries = 22
case BattleCDs = 24
case NumberBattleCDs = 25
case Battles = 26
case NumberOfBattles = 27
case BattleFields = 28
case NumberOfBattleFields = 29
case TrainerClasses = 38
case NumberOfTrainerClasses = 39
case BattleLayouts = 42 // eg 2 trainers per side, 1 active pokemon per trainer, 6 pokemon per trainer
case NumberOfBattleLayouts = 43
case Flags = 44
case NumberOfFlags = 45
case Rooms = 58 // same as maps
case NumberOfRooms = 59
case Doors = 60 // doors that open when player is near
case NumberOfDoors = 61
case InteractionPoints = 62 // warps and inanimate objects
case NumberOfInteractionPoints = 63
case RoomBGM = 64 // byte 1 = volume, short 2 = room id, short 4 = bgm id
case NumberOfRoomBGMs = 65
case TreasureBoxData = 66 // 0x1c bytes each
case NumberTreasureBoxes = 67
case ValidItems = 68 // list of items which are actually available in XD
case TotalNumberOfItems = 69
case Items = 70
case NumberOfItems = 71
case CharacterModels = 84
case NumberOfCharacterModels = 85
case PokemonStats = 88
case NumberOfPokemon = 89
case Natures = 94
case NumberOfNatures = 95
case SoundsMetaData = 102
case NumberOfSounds = 103
case BGM = 104
case NumberBGM = 105
case USStringTable = 116
case Moves = 124
case NumberOfMoves = 125
case TutorMoves = 126
case NumberOfTutorMoves = 127
case Types = 130
case NumberOfTypes = 131
var pointerOffset : Int {
return common.getPointerOffset(index: self.rawValue)
}
var startOffset : Int {
return common.getPointer(index: self.rawValue)
}
func setStartOffset(_ offset: Int) {
common.replacePointer(index: self.rawValue, newAbsoluteOffset: offset)
}
var value : Int {
return common.getValueAtPointer(index: self.rawValue)
}
func setValue(_ value: Int) {
common.setValueAtPointer(index: self.rawValue, newValue: value)
}
static func indexForStartOffset(offset: Int) -> Int? {
for i in 0 ... CommonIndexes.NumberOfTypes.rawValue{
if common.getPointer(index: i) == offset {
return i
}
}
return nil
}
}
enum PocketIndexes : Int {
case MartStartIndexes = 0
case numberOfMarts = 1
case MartGreetings = 2
case numberOfMartGreetingSections = 3 // 0x4c bytes each
case MartItems = 4
case numberOfMartItems = 5
var startOffset : Int {
return pocket.getPointer(index: self.rawValue)
}
var value : Int {
return pocket.getValueAtPointer(index: self.rawValue)
}
}