Skip to content

Commit

Permalink
Adds isotile load debug printing
Browse files Browse the repository at this point in the history
  • Loading branch information
tomsons26 committed Feb 9, 2022
1 parent dd58119 commit fd61dde
Showing 1 changed file with 53 additions and 0 deletions.
53 changes: 53 additions & 0 deletions src/extensions/isotiletype/isotiletypeext_init.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -315,6 +315,50 @@ DECLARE_PATCH(_IsometricTileTypeClass_Read_INI_Patch_2)
}


class dummy : public IsometricTileTypeClass
{
public:
int Load_Tile();
int Load_Tile_Wrapper()
{

bool available = false;
int file_size = 0;
{
CCFileClass file(Filename);

available = file.Is_Available();
file_size = file.Size();
}

if (!available) {
DEBUG_ERROR("ISOTILEDEBUG - Isometric Tile %s is missing!\n", Filename);
return 0;
}

if (file_size == 0) {
DEBUG_ERROR("ISOTILEDEBUG - Isometric Tile %s is a empty file!\n", Filename);
return 0;
}

int read_size = Load_Tile();

if (Image == nullptr) {
DEBUG_ERROR("ISOTILEDEBUG - Failed to load image for Isometric Tile %s!\n", Filename);
return 0;
}

if (read_size != file_size) {
DEBUG_ERROR("ISOTILEDEBUG - Isometric Tile %s file size %d doesn't match read size!\n", file_size, read_size, Filename);
}

return read_size;
}
};

//need to change tspp otherwise
DEFINE_IMPLEMENTATION(int dummy::Load_Tile(), 0x004F5940);

/**
* Main function for patching the hooks.
*/
Expand All @@ -328,4 +372,13 @@ void IsometricTileTypeClassExtension_Init()
Patch_Jump(0x004F55F2, &_IsometricTileTypeClass_Init_Patch);
Patch_Jump(0x004F50AE, &_IsometricTileTypeClass_Read_INI_Patch_1);
Patch_Jump(0x004F53E9, &_IsometricTileTypeClass_Read_INI_Patch_2);


Patch_Call(0x004F350C, &dummy::Load_Tile_Wrapper);
Patch_Call(0x004F3554, &dummy::Load_Tile_Wrapper);
Patch_Call(0x004F3586, &dummy::Load_Tile_Wrapper);
Patch_Call(0x004F58E6, &dummy::Load_Tile_Wrapper);
Patch_Call(0x004F8424, &dummy::Load_Tile_Wrapper);
Patch_Call(0x004F8784, &dummy::Load_Tile_Wrapper);

}

0 comments on commit fd61dde

Please sign in to comment.