Skip to content

Commit

Permalink
field characters are now working correctly
Browse files Browse the repository at this point in the history
  • Loading branch information
Marcin Gomulak committed Jan 9, 2020
1 parent 9566a06 commit a210e1c
Show file tree
Hide file tree
Showing 3 changed files with 41 additions and 5 deletions.
Binary file modified ff8_demaster.dll
Binary file not shown.
40 changes: 38 additions & 2 deletions ff8_demaster/texturepatch_v2_fieldChara.c
Original file line number Diff line number Diff line change
Expand Up @@ -30,11 +30,15 @@ void _fcpObtainTextureDatas(int bIndex, int aIndex)
else
sprintf(tempSprint, "\\%s%03u_%u", "o", aIndex - 2097, bIndex);

BOOL bNonHdParent = FALSE;

char testPath[256];
sprintf(testPath, "%s%s.png", texPath, tempSprint);
attr = GetFileAttributesA(testPath);
if (attr == INVALID_FILE_ATTRIBUTES)
sprintf(testPath, "%s_new%s.png", texPath, tempSprint);
else
bNonHdParent = TRUE;
attr = GetFileAttributesA(testPath);
if (attr == INVALID_FILE_ATTRIBUTES)
sprintf(testPath, "%s_new\\d000_0.png", tempPath); //ERROR !!!!
Expand All @@ -44,8 +48,9 @@ void _fcpObtainTextureDatas(int bIndex, int aIndex)

int width_, height_, channels;
char * buffer = stbi_load(texPath, &width_, &height_, &channels, 4);

//the most important is height here
height_fcp = height_*2;
height_fcp = height_ * 2;
int scale = height_ / 384; //normally should be always 1


Expand Down Expand Up @@ -89,7 +94,7 @@ __declspec(naked) void _fcpObtainData()
PUSH 0
PUSH 0
PUSH[height_fcp]
PUSH[width_fcp]
PUSH[height_fcp]
MOV EAX, OFFSET IMAGE_BASE
MOV EAX, [EAX]
ADD EAX, 0x160b670 //createGLTexture
Expand All @@ -99,6 +104,26 @@ __declspec(naked) void _fcpObtainData()
}
}

__declspec(naked) void _fcpSetYoffset()
{
__asm
{
CMP[EBP + 0x0C], 0
JE originalcode
MOV EAX, [height_fcp]
SHR EAX, 1
PUSH EAX
PUSH 0
JMP returnhere

originalcode :
push[ebp + 0x0C]
push[ebp + 0x08]
returnhere:
JMP fcpBackAdd2
}
}

void ApplyFieldEntityPatch()
{
//step D* creates glTexture 768x768 again- then they connect the texture by calling
Expand Down Expand Up @@ -136,6 +161,17 @@ void ApplyFieldEntityPatch()
fcpBackAdd1 = InjectJMP(IMAGE_BASE + 0x16061CC, (DWORD)_fcpObtainData, 18);


//step 2. disable out of bounds error- we know that, but we are using new, bigger buffers
modPage(IMAGE_BASE + 0x160C43A, 1);
*(BYTE*)(IMAGE_BASE + 0x160C43A) = 0xEB; //JBE -> JMP

modPage(IMAGE_BASE + 0x160C467, 1);
*(BYTE*)(IMAGE_BASE + 0x160C467) = 0xEB; //JBE -> JMP

//1160545A - set
fcpBackAdd2 = InjectJMP(IMAGE_BASE + 0x160C4AD, (DWORD)_fcpSetYoffset, 6);


//step 2. now tweak the yOffsets as in battle
//TODO - it's the least important thing, as to make it working you would need to upscale ALL textures
}
6 changes: 3 additions & 3 deletions status
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
1.2.1
1.1
Hello! Welcome to Final Fantasy VIII Remastered unofficial patch\n\n========\nRelease notes of 1.2.1:\n-Fixed Edea as enemy not showing up\n====\nUpcoming:\nBug fixes
1.2.2
1.1b
Hello! Welcome to Final Fantasy VIII Remastered unofficial patch\n\n========\nRelease notes of 1.2.2:\n-Fixed field models texture out-of-bounds error\n====\nUpcoming:\nBug fixes

0 comments on commit a210e1c

Please sign in to comment.