Fixing flag set

This commit is contained in:
Sergiotarxz 2024-03-04 02:02:44 +01:00
parent 7a648474c8
commit 44134761ea
3 changed files with 16 additions and 6 deletions

View File

@ -84,7 +84,7 @@ SELECT message, date, input_file,
output_file, backup_input_file,
backup_output_file
FROM logs
ORDER BY date;
ORDER BY date DESC;
EOF
my $results = $db->selectall_arrayref($query, {Slice => {}});
return $results;

View File

@ -5,8 +5,7 @@ use v5.16.3;
use strict;
use warnings;
use Rsaves
qw/read_save check_correct_size get_saves find_current_save_index check_correct_size find_pokemon_substruct change_gender read_pc_storage save_pc_changes enable_eon_ticket save_changes pokemon_set_shiny read_pkm_file_box parse_version_name check_flag_id get_first_super_data check_rematch/;
use Rsaves;
use Rsaves::Constants::Global
qw/$SAPPHIRE_VERSION $RUBY_VERSION $EMERALD_VERSION $FIRERED_VERSION $LEAFGREEN_VERSION $COLOSSEUM_VERSION/;
use Rsaves::Constants::Emerald::Flags;
@ -92,6 +91,7 @@ sub diff_boolean_flag_like {
for ( my $i = 0 ; $i < scalar @$initial ; $i++ ) {
my $flag_ini = $initial->[$i];
my $flag_end = $final->[$i];
say $i;
if ( ( !!$flag_ini->{value} ) == ( !!$flag_end->{value} ) ) {
next;
}
@ -127,6 +127,16 @@ sub set_rematch {
$self->_set_superdata($superdata);
}
sub set_flag {
my $self = shift;
my $flag_id = shift;
my $value = shift;
my $superdata = $self->_get_superdata;
my $save = $self->_get_current_save;
Rsaves::set_flag_id( $save, $superdata, $flag_id, $value );
$self->_set_superdata($superdata);
}
sub _set_superdata {
my $self = shift;
my $superdata = shift;
@ -171,8 +181,8 @@ sub _get_rematches_hash_by_id {
sub _build_saves_and_extra {
my $self = shift;
my ( @saves_raw, $extra );
( @saves_raw[ 0, 1 ], $extra ) = read_save( $self->input_file );
my @saves = get_saves( @saves_raw, $EMERALD_VERSION );
( @saves_raw[ 0, 1 ], $extra ) = Rsaves::read_save( $self->input_file );
my @saves = Rsaves::get_saves( @saves_raw, $EMERALD_VERSION );
$self->__saves( \@saves );
$self->__extra($extra);
$self->store_initial_flags_and_rematch;

View File

@ -248,7 +248,7 @@ sub start_editing_file {
$toggle->signal_connect(
toggled => sub {
my $active = $toggle->get_active;
$self->_save->set_flag($active);
$self->_save->set_flag($id, $active);
}
);