Skip to content

Commit

Permalink
VCR/Feat: Allow disabling extended format movie writing
Browse files Browse the repository at this point in the history
Useful when opening movies in external programs which don't handle the new format correctly.
  • Loading branch information
Aurumaker72 committed Jan 18, 2025
1 parent 0339d64 commit cabd749
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 2 deletions.
14 changes: 12 additions & 2 deletions core/r4300/vcr.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -85,8 +85,18 @@ bool write_movie_impl(const t_movie_header* hdr, const std::vector<BUTTONS>& inp
return false;
}

fwrite(hdr, sizeof(t_movie_header), 1, f);
fwrite(inputs.data(), sizeof(BUTTONS), hdr->length_samples, f);
t_movie_header hdr_copy = *hdr;

if (!g_config.vcr_write_extended_format)
{
g_core_logger->info("[VCR] vcr_write_extended_format disabled, replacing new sections with 0...");
hdr_copy.extended_version = 0;
hdr_copy.extended_flags = {};
hdr_copy.extended_data = {};
}

fwrite(&hdr_copy, sizeof(t_movie_header), 1, f);
fwrite(inputs.data(), sizeof(BUTTONS), hdr_copy.length_samples, f);
fclose(f);
return true;
}
Expand Down
1 change: 1 addition & 0 deletions shared/Config.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -617,6 +617,7 @@ mINI::INIStructure handle_config_ini(bool is_reading, mINI::INIStructure ini)
HANDLE_P_VALUE(pause_at_last_frame)
HANDLE_P_VALUE(vcr_readonly)
HANDLE_P_VALUE(vcr_backups)
HANDLE_P_VALUE(vcr_write_extended_format)
HANDLE_P_VALUE(automatic_update_checking)
HANDLE_P_VALUE(silent_mode)
HANDLE_P_VALUE(max_lag)
Expand Down
6 changes: 6 additions & 0 deletions shared/Config.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -653,6 +653,12 @@ typedef struct Config
/// </summary>
int32_t vcr_backups = 1;

/// <summary>
/// Whether movies are written using the new extended format.
/// If disabled, the extended format sections are set to 0.
/// </summary>
int32_t vcr_write_extended_format = 1;

/// <summary>
/// Whether automatic update checking is enabled.
/// </summary>
Expand Down
7 changes: 7 additions & 0 deletions view/gui/features/ConfigDialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1325,6 +1325,13 @@ void get_config_listview_items(std::vector<t_options_group>& groups, std::vector
.data = &g_config.vcr_backups,
.type = t_options_item::Type::Bool,
},
t_options_item{
.group_id = core_group.id,
.name = L"Extended Movie Format",
.tooltip = L"Whether movies are written using the new extended format.\nUseful when opening movies in external programs which don't handle the new format correctly.\nIf disabled, the extended format sections are set to 0.",
.data = &g_config.vcr_write_extended_format,
.type = t_options_item::Type::Bool,
},
t_options_item{
.group_id = core_group.id,
.name = L"Fast-Forward Skip Frequency",
Expand Down

0 comments on commit cabd749

Please sign in to comment.