Skip to content

Commit

Permalink
FF7: Fix softlock on the Steam edition (#626)
Browse files Browse the repository at this point in the history
  • Loading branch information
maciej-trebacz committed Nov 21, 2023
1 parent 7e7f04f commit a304000
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 8 deletions.
4 changes: 4 additions & 0 deletions Changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,10 @@
- Widescreen: Fix Pandora Box white background position
- Voice: Fix auto-text sometimes not working on certain fields after long gameplay sessions

## FF7 Steam

- Common: Fix a softlock when trying to change in-game Controller setting to "Normal" (by disabling this option)

## FF8

- Hext: `fix_uv_coords` hext files are not needed anymore ( https://github.com/julianxhokaxhiu/FFNx/pull/619 )
Expand Down
2 changes: 1 addition & 1 deletion src/ff7.h
Original file line number Diff line number Diff line change
Expand Up @@ -2793,7 +2793,7 @@ struct ff7_externals
uint32_t field_map_infos;
uint32_t sound_operation;
struct ff7_field_sfx_state* sound_states;
uint32_t menu_sound_slider_loop;
uint32_t config_menu_sub;
uint32_t call_menu_sound_slider_loop_sfx_up;
uint32_t call_menu_sound_slider_loop_sfx_down;
uint32_t menu_start;
Expand Down
2 changes: 1 addition & 1 deletion src/ff7_data.h
Original file line number Diff line number Diff line change
Expand Up @@ -285,7 +285,7 @@ void ff7_find_externals(struct ff7_game_obj* game_object)
ff7_externals.menu_tutorial_sub_6C49FD = (int (*)())get_relative_call(ff7_externals.menu_sub_6CB56A, 0x2B7);
ff7_externals.timer_menu_sub = ff7_externals.menu_subs_call_table[0];
ff7_externals.status_menu_sub = ff7_externals.menu_subs_call_table[5];
ff7_externals.menu_sound_slider_loop = ff7_externals.menu_subs_call_table[8];
ff7_externals.config_menu_sub = ff7_externals.menu_subs_call_table[8];
ff7_externals.menu_sub_6FEDB0 = ff7_externals.menu_subs_call_table[10];

ff7_externals.menu_tutorial_window_state = (BYTE*)get_absolute_value((uint32_t)ff7_externals.menu_tutorial_sub_6C49FD, 0x9);
Expand Down
9 changes: 6 additions & 3 deletions src/ff7_opengl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -365,9 +365,9 @@ void ff7_init_hooks(struct game_obj *_game_object)
memset_code(ff7_externals.field_apply_kawai_op_64A070 + 0x23C, 0x90, 5);
}

//#############################
// steam save game preservation
//#############################
//#############################################
// steam save game preservation and other fixes
//#############################################
if (steam_edition)
{
switch(version)
Expand All @@ -383,6 +383,9 @@ void ff7_init_hooks(struct game_obj *_game_object)
replace_call_function(ff7_externals.menu_sub_6FEDB0 + 0x10FE, ff7_write_save_file);
break;
}

// Disable "Normal" setting in Controller section of the Config menu (it softlocks on Steam)
memset_code(ff7_externals.config_menu_sub + 0x8AC, 0x90, 0xE6);
}

//###############################
Expand Down
6 changes: 3 additions & 3 deletions src/sfx.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -551,7 +551,7 @@ void sfx_update_volume(int modifier)
if (trace_all || trace_sfx) ffnx_info("%s: Update SFX volumes %d\n", __func__, modifier);

// Set master sfx volume
BYTE** sfx_tmp_volume = (BYTE**)(ff7_externals.menu_sound_slider_loop + ff7_externals.call_menu_sound_slider_loop_sfx_down + 0xA);
BYTE** sfx_tmp_volume = (BYTE**)(ff7_externals.config_menu_sub + ff7_externals.call_menu_sound_slider_loop_sfx_down + 0xA);

*common_externals.master_sfx_volume = **sfx_tmp_volume + modifier;

Expand Down Expand Up @@ -749,8 +749,8 @@ void sfx_init()
// On volume change in main menu initialization
replace_call(ff7_externals.menu_start + 0x17, sfx_menu_force_channel_5_volume);
// On SFX volume change in config menu
replace_call(ff7_externals.menu_sound_slider_loop + ff7_externals.call_menu_sound_slider_loop_sfx_down, sfx_menu_play_sound_down);
replace_call(ff7_externals.menu_sound_slider_loop + ff7_externals.call_menu_sound_slider_loop_sfx_up, sfx_menu_play_sound_up);
replace_call(ff7_externals.config_menu_sub + ff7_externals.call_menu_sound_slider_loop_sfx_down, sfx_menu_play_sound_down);
replace_call(ff7_externals.config_menu_sub + ff7_externals.call_menu_sound_slider_loop_sfx_up, sfx_menu_play_sound_up);
// Fix escape sound not played more than once
replace_function(ff7_externals.battle_clear_sound_flags, sfx_clear_sound_locks);
// On stop sound in battle swirl
Expand Down

0 comments on commit a304000

Please sign in to comment.