Difference between revisions of "FF8/BattleStage/Pointers"

From QhimmWiki
Jump to navigation Jump to search
Qhimm>MaKiPL
(Created page with "FF8 engine reads Battle Stage files by positions coded in executable (.text section of .EXE) Engine loads whole file, but starts working with it from spec...")
 
ffrtt>BukTop
m (9 revisions imported)
 
(13 intermediate revisions by 3 users not shown)
Line 1: Line 1:
By MaKiPL.
FF8 engine reads [[FF8/FileFormat_X|Battle Stage files]] by positions coded in executable (.text section of .EXE)
FF8 engine reads [[FF8/FileFormat_X|Battle Stage files]] by positions coded in executable (.text section of .EXE)
Engine loads whole file, but starts working with it from specified position. You CANNOT replace stages, even with originals with the stages, that camera section starts at different position.
How to change levels that use different camera positions:
*Check camera position in the stage that'd be replaced
*Add, delete, manipulate bytes before camera data to be EQUAL to amount of replaced stage
*Voila!
Example:
You want to change a0stg004.x to a0stg000.x
1. Check where camera starts in a0stg004.x (this file will be replaced)
2. Copy and rename a0stg000.x to a0stg004.x
3. Open HEX editor and add FOUR additional bytes at beginning of file (because a0stg000.x cam_position is 0x5D8)
4. Done
Here's the list:
5D4 5D8 OUT*
4 0 8
5 1 16
9 2 19
12 3 20
13 6 30
14 7 31
15 10 37
21 11 44
22 17 45
23 18 46
24 25 48
26 27 51
29 28 52
32 38 54
33 41 56
34 42 79
35 43 92
36 47 107
39 49 108
40 57 136
50 58 137
53 59 142
55 60 147
61 74 157
62 76
63 77
64 80
65 81
66 84
67 93
68 95
69 101
70 102
71 103
72 104
73 109
75 110
78 111
82 112
83 113
85 114
86 115
87 116
88 117
89 118
90 119
91 120
94 128
96 129
97 130
98 131
99 132
100 133
105 134
106 139
121 140
122 143
123 146
124 152
125 153
126 154
127 155
135 156
138 159
141 161
144 162
145
148
149
150
151
158
160


*OUT are other locations I didn't investigate yet [TODO].
'''Here's the list:'''
private static uint GetCameraPointer()
        {
            int[] _x5D4 = {4,5,9,12,13,14,15,21,22,23,24,26,
            29,32,33,34,35,36,39,40,50,53,55,61,62,63,64,65,66,67,68,69,70,
            71,72,73,75,78,82,83,85,86,87,88,89,90,91,94,96,97,98,99,100,105,
            106,121,122,123,124,125,126,127,135,138,141,144,145,148,149,150,
            151,158,160};
            int[] _x5D8 = {
            0,1,2,3,6,7,10,11,17,18,25,27,28,38,41,42,43,47,49,57,58,59,60,74,
            76,77,80,81,84,93,95,101,102,103,104,109,110,111,112,113,114,115,116,
            117,118,119,120,128,129,130,131,132,133,134,139,140,143,146,152,153,154,
            155,156,159,161,162};
            int _5d4 = _x5D4.Count(x => x== Memory.encounters[Memory.battle_encounter].bScenario);
            int _5d8 = _x5D8.Count(x => x == Memory.encounters[Memory.battle_encounter].bScenario);
            if (_5d4 > 0) return 0x5D4;
            if (_5d8 > 0) return 0x5D8;
            switch (Memory.encounters[Memory.battle_encounter].bScenario)
            {
                case 8:
                case 48:
                case 79:
                    return 0x618;
                case 16:
                    return 0x628;
                case 19:
                    return 0x644;
                case 20:
                    return 0x61c;
                case 30:
                case 31:
                    return 0x934;
                case 37:
                    return 0xcc0;
                case 44:
                case 45:
                case 46:
                    return 0x9A4;
                case 51:
                case 52:
                case 107:
                case 108:
                    return 0x600;
                case 54:
                case 56:
                    return 0x620;
                case 92:
                    return 0x83c;
                case 136:
                    return 0x5fc;
                case 137:
                    return 0xFDC; //That one is really giant, what is it? //It's a witch stage, worth to see at MIPS
                case 142:
                    return 0x183C; //That one won! xD //It's a final battle
                case 147:
                    return 0xa0c;
                case 157:
                    return 0x638;
            }
            throw new Exception("0xFFF, unknown pointer!");
        }

Latest revision as of 04:22, 23 May 2019

By MaKiPL.

FF8 engine reads Battle Stage files by positions coded in executable (.text section of .EXE)

Here's the list:

private static uint GetCameraPointer()
       {
           int[] _x5D4 = {4,5,9,12,13,14,15,21,22,23,24,26,
           29,32,33,34,35,36,39,40,50,53,55,61,62,63,64,65,66,67,68,69,70,
           71,72,73,75,78,82,83,85,86,87,88,89,90,91,94,96,97,98,99,100,105,
           106,121,122,123,124,125,126,127,135,138,141,144,145,148,149,150,
           151,158,160};
           int[] _x5D8 = {
           0,1,2,3,6,7,10,11,17,18,25,27,28,38,41,42,43,47,49,57,58,59,60,74,
           76,77,80,81,84,93,95,101,102,103,104,109,110,111,112,113,114,115,116,
           117,118,119,120,128,129,130,131,132,133,134,139,140,143,146,152,153,154,
           155,156,159,161,162};
           int _5d4 = _x5D4.Count(x => x== Memory.encounters[Memory.battle_encounter].bScenario);
           int _5d8 = _x5D8.Count(x => x == Memory.encounters[Memory.battle_encounter].bScenario);
           if (_5d4 > 0) return 0x5D4;
           if (_5d8 > 0) return 0x5D8;
           switch (Memory.encounters[Memory.battle_encounter].bScenario)
           {
               case 8:
               case 48:
               case 79:
                   return 0x618;
               case 16:
                   return 0x628;
               case 19:
                   return 0x644;
               case 20:
                   return 0x61c;
               case 30:
               case 31:
                   return 0x934;
               case 37:
                   return 0xcc0;
               case 44:
               case 45:
               case 46:
                   return 0x9A4;
               case 51:
               case 52:
               case 107:
               case 108:
                   return 0x600;
               case 54:
               case 56:
                   return 0x620;
               case 92:
                   return 0x83c;
               case 136:
                   return 0x5fc;
               case 137:
                   return 0xFDC; //That one is really giant, what is it? //It's a witch stage, worth to see at MIPS
               case 142:
                   return 0x183C; //That one won! xD //It's a final battle
               case 147:
                   return 0xa0c;
               case 157:
                   return 0x638;
           }
           throw new Exception("0xFFF, unknown pointer!");
       }