Skip to content

Commit 2f099c6

Browse files
author
makipl
committed
update for 1.0.2.0 stable
1 parent 8b1c33d commit 2f099c6

6 files changed

+50
-27
lines changed

ff8_demaster/ff8_demaster.vcxproj

+1-1
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@
4848
</PrecompiledHeaderFile>
4949
<InlineFunctionExpansion>Disabled</InlineFunctionExpansion>
5050
<RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
51-
<LanguageStandard>stdcpp20</LanguageStandard>
51+
<LanguageStandard>stdcpp17</LanguageStandard>
5252
</ClCompile>
5353
<Link>
5454
<SubSystem>Windows</SubSystem>

ff8_demaster/mymemory.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ const std::map<ADDRESS_NAME, std::vector<unsigned int>> PATCHADDRESS =
5757
{_ASM_FIELDBGRETADDR3 , std::vector<unsigned int>{ 0x0 , 0x1591B75 , 0x1592185 }},
5858
{DISABLETPAGELIMIT , std::vector<unsigned int>{ 0x0 , 0x1606595 , 0x1606e75 }},
5959
{_ASM_FIELDBGRETADDR2 , std::vector<unsigned int>{ 0x0 , 0x1606540 , 0x1606e20 }},
60-
{DS_FREE , std::vector<unsigned int>{ 0x0 , 0x166b2a8 , 0x166b2a4 }},
60+
{DS_FREE , std::vector<unsigned int>{ 0x0 , 0x166b2a8 , 0x166b2a8 }},
6161
{DS_TEXIMG , std::vector<unsigned int>{ 0x0 , 0x166b4a0 , 0x166b4b4 }},
6262
{_BSPBACKADD1 , std::vector<unsigned int>{ 0x0 , 0x1573AFF , 0x1573f7f }},
6363
{_BSPBACKADD2 , std::vector<unsigned int>{ 0x0 , 0x1573B54 , 0x1573fd4 }},

ff8_demaster/texturepatch_v2.cpp

+3
Original file line numberDiff line numberDiff line change
@@ -48,12 +48,15 @@ __declspec(naked) void _cltObtainTexHeader()
4848

4949
//ORIGINAL CODE
5050
PUSH ECX
51+
PUSH EDX //this one gets cleared after 1020
5152
PUSH UPLOADVRAM
5253
CALL GetAddress
54+
5355
MOV ECX, EAX
5456
MOV EAX, OFFSET IMAGE_BASE
5557
MOV EAX, [EAX]
5658
ADD EAX, ECX //upload_texture_vram
59+
POP EDX
5760
POP ECX
5861
CALL EAX
5962

ff8_demaster/texturepatch_v2_battleScenery.cpp

+20-17
Original file line numberDiff line numberDiff line change
@@ -235,32 +235,35 @@ __declspec(naked) void _bsp()
235235
JMP _bspBackAdd1
236236

237237
_wtpOk :
238-
MOV EAX, OFFSET IMAGE_BASE
239-
MOV EAX, [EAX]
240-
PUSH EAX
241-
PUSH DS_FREE
242-
CALL GetAddress
243-
MOV EBX, EAX
244-
POP EAX
245-
ADD EAX, EBX
238+
//MOV EAX, OFFSET IMAGE_BASE
239+
// MOV EAX, [EAX]
240+
// PUSH EAX
241+
// PUSH DS_FREE
242+
// CALL GetAddress
243+
// MOV EBX, EAX
244+
// POP EAX
245+
// ADD EAX, EBX
246+
247+
246248
PUSH DWORD PTR[EBP + 0x10]
247-
CALL[EAX]
248-
//CALL DWORD PTR DS:0x1166B2A8
249+
MOV EAX, ds_free
250+
MOV EAX, [EAX]
251+
CALL EAX
249252
MOV bAlreadyFreed, 1
250253
CALL _wtpGl
251254
JMP _out
252255

253256
JMP _original
254257

255258
_bspOk :
256-
PUSH DWORD PTR[EBP + 0x10]
257-
MOV EAX, ds_free
258-
MOV EAX, [EAX]
259-
CALL EAX
260-
MOV bAlreadyFreed, 1
259+
PUSH DWORD PTR[EBP + 0x10]
260+
MOV EAX, ds_free
261+
MOV EAX, [EAX]
262+
CALL EAX
263+
MOV bAlreadyFreed, 1
261264

262-
CALL _bspGl
263-
JMP _out
265+
CALL _bspGl
266+
JMP _out
264267

265268
_fbgOk: //FIELD BACKGROUND
266269
PUSH DWORD PTR[EBP + 0x10]

ff8_demaster/texturepatch_v2_fieldBackground.cpp

+24-7
Original file line numberDiff line numberDiff line change
@@ -67,28 +67,29 @@ DWORD fieldReplacementFound;
6767

6868

6969
static char* lastFieldName;
70-
70+
static int lastFieldnameSubstrPos = -1;
7171
/// <summary>
72-
///
72+
/// Returns final field path with either DDS or PNG extension with either palettted or non-paletted instance/version
7373
/// </summary>
7474
/// <returns>char* that points to texture of DDS or PNG</returns>
7575
char* GetFieldBackgroundReplacementTextureName()
7676
{
7777
//directIO_fopenReroute: DEMASTER_EXP\textures\DEMASTER_EXP\textures\field_bg\bv\bvtr_1\bvtr_1_0_2.png, file not found
7878
char n[256]{ 0 };
7979
static char n2[256]{ 0 };
80-
char localn[256]{ 0 };
80+
static char localn[256]{ 0 }; //Maki: static so when assigned to lastFieldName it doesn't get fucked out
8181
static char localn2[256]{ 0 };
8282
int palette = tex_header[52];
8383

84-
84+
8585

8686
if (GetFieldBackgroundFilename(n))
8787
{
8888
n2[0] = '\0';
8989
return n2;
9090
}
9191

92+
9293

9394
sprintf(localn2, "%s%u_%u", n, fieldBackgroundRequestedTPage - 16, palette);
9495

@@ -101,11 +102,23 @@ char* GetFieldBackgroundReplacementTextureName()
101102

102103
OutputDebug("%s: %s, %s\n", __func__, localn, "palette not found");
103104
lastFieldName = localn2;
104-
return localn2;
105+
//return localn2; //Maki: it's easier this way for me to replace whenn using no PNG
105106
}
106-
lastFieldName = localn2;
107+
else
108+
{
109+
lastFieldName = localn; //Maki : localn2 was here instead of localn - probably debug
107110
OutputDebug("%s: %s\n", __func__, localn);
108-
return localn2;
111+
}
112+
113+
114+
if (lastFieldnameSubstrPos == -1)
115+
lastFieldnameSubstrPos = strlen(DIRECT_IO_EXPORT_DIR) + strlen("textures\\");
116+
//Maki: below are various after-fixes because we tried to do DDS but this one needs special treatment for GL segment- pretty easy
117+
lastFieldName[strlen(lastFieldName) - 4] = '\0'; //Maki: This is to throw out the extension- yes, we need to do that so far
118+
lastFieldName = lastFieldName + lastFieldnameSubstrPos;
119+
120+
121+
return lastFieldName; //Maki: yeah, it's for rework, but returning anyway for assembler inject sake
109122
}
110123

111124
__declspec(naked) void _asm_InjectFieldBackgroundModule()
@@ -162,6 +175,10 @@ void _fbgGl()
162175

163176
}
164177

178+
179+
180+
//Maki: This gets checked at first- so we have actually ready .PNG path here- change it so we use one method, not three times getting path lol
181+
// this checks if replacement exists for 0_0 for either DDS or PNG and sets fieldReplacementFound
165182
/// <summary>
166183
/// Passes the DWORD if either the replacement is found or not directly to the game engine
167184
/// </summary>

ff8_demaster/texturepatch_v2_fieldChara.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ __declspec(naked) void _fcpObtainData()
9797
MOV ECX, EAX //EAX as always should return return-value
9898
MOV EAX, OFFSET IMAGE_BASE
9999
MOV EAX, [EAX]
100-
ADD EAX, EAX //createGLTexture
100+
ADD EAX, ECX //createGLTexture
101101
POP ECX //restore ECX from stack
102102
CALL EAX
103103

0 commit comments

Comments
 (0)