Skip to content

Commit

Permalink
FF8: use better textures from texl archive for the worldmap
Browse files Browse the repository at this point in the history
  • Loading branch information
myst6re committed May 21, 2022
1 parent 5501e89 commit 92a2e3b
Show file tree
Hide file tree
Showing 10 changed files with 407 additions and 354 deletions.
6 changes: 6 additions & 0 deletions misc/FFNx.toml
Original file line number Diff line number Diff line change
Expand Up @@ -550,6 +550,12 @@ save_path = "save"
# OPTIONS ONLY FOR FF8
###############################################################################

## ENHANCEMENTS

# Load higher resolution textures on worldmap
#~~~~~~~~~~~~~~~~~~~~~~~~~~~
ff8_worldmap_texture_fix = true

## GAME INSTALLATION OPTIONS

#[APP PATH]
Expand Down
2 changes: 2 additions & 0 deletions src/cfg.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,7 @@ bool steam_achievements_debug_mode;
double hdr_max_nits;
long external_audio_number_of_channels;
long external_audio_sample_rate;
bool ff8_worldmap_texture_fix;
std::string app_path;
std::string data_drive;

Expand Down Expand Up @@ -254,6 +255,7 @@ void read_cfg()
hdr_max_nits = config["hdr_max_nits"].value_or(0);
external_audio_number_of_channels = config["external_audio_number_of_channels"].value_or(2);
external_audio_sample_rate = config["external_audio_sample_rate"].value_or(44100);
ff8_worldmap_texture_fix = config["ff8_worldmap_texture_fix"].value_or(false);
app_path = config["app_path"].value_or("");
data_drive = config["data_drive"].value_or("");

Expand Down
1 change: 1 addition & 0 deletions src/cfg.h
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,7 @@ extern bool steam_achievements_debug_mode;
extern double hdr_max_nits;
extern long external_audio_number_of_channels;
extern long external_audio_sample_rate;
extern bool ff8_worldmap_texture_fix;
extern std::string app_path;
extern std::string data_drive;

Expand Down
4 changes: 2 additions & 2 deletions src/common.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1276,7 +1276,7 @@ uint32_t load_external_texture(void* image_data, uint32_t dataSize, struct textu
}
else if(ff8)
{
uint8_t scale = texturePacker.getMaxScale();
uint8_t scale = texturePacker.getMaxScale(VREF(tex_header, image_data));
uint8_t *image_data_scaled = (uint8_t *)image_data;

if (scale > 1)
Expand All @@ -1292,7 +1292,7 @@ uint32_t load_external_texture(void* image_data, uint32_t dataSize, struct textu
}
}

if (image_data_scaled != nullptr && texturePacker.drawModdedTextures(VREF(tex_header, image_data), (uint32_t *)image_data_scaled, (uint32_t *)image_data, originalWidth, originalHeight, scale))
if (image_data_scaled != nullptr && scale > 0 && texturePacker.drawModdedTextures(VREF(tex_header, image_data), tex_format, (uint32_t *)image_data_scaled, (uint32_t *)image_data, originalWidth, originalHeight, scale, VREF(tex_header, palette_index)))
{
VREF(texture_set, ogl.width) = originalWidth * scale;
VREF(texture_set, ogl.height) = originalHeight * scale;
Expand Down
5 changes: 3 additions & 2 deletions src/ff8.h
Original file line number Diff line number Diff line change
Expand Up @@ -451,8 +451,9 @@ struct struc_50
uint32_t vram_y;
uint32_t vram_width;
uint32_t vram_height;
uint32_t vram_palette_data;
uint32_t vram_palette_pos; // 24-bit | 6-bit
uint16_t *vram_palette_data;
uint16_t vram_palette_pos; // 10-bit | 6-bit
uint16_t padding;
};

struct struc_51
Expand Down
Loading

0 comments on commit 92a2e3b

Please sign in to comment.