Difference between revisions of "FF8/BattleStage/Pointers"

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

Latest revision as of 05: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!");
       }