mirror of
https://github.com/eried/portapack-mayhem.git
synced 2025-07-26 16:26:06 -04:00
Tones bugfix, numbers station voice files search
This commit is contained in:
parent
ee099504c3
commit
089eeeafe4
24 changed files with 335 additions and 194 deletions
81
firmware/application/ui_playdead.cpp
Normal file
81
firmware/application/ui_playdead.cpp
Normal file
|
@ -0,0 +1,81 @@
|
|||
/*
|
||||
* Copyright (C) 2015 Jared Boone, ShareBrained Technology, Inc.
|
||||
* Copyright (C) 2016 Furrtek
|
||||
*
|
||||
* This file is part of PortaPack.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2, or (at your option)
|
||||
* any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; see the file COPYING. If not, write to
|
||||
* the Free Software Foundation, Inc., 51 Franklin Street,
|
||||
* Boston, MA 02110-1301, USA.
|
||||
*/
|
||||
|
||||
#include "ui_playdead.hpp"
|
||||
#include "portapack_persistent_memory.hpp"
|
||||
#include "string_format.hpp"
|
||||
|
||||
namespace ui {
|
||||
|
||||
void PlayDeadView::focus() {
|
||||
button_seq_entry.focus();
|
||||
}
|
||||
|
||||
void PlayDeadView::paint(Painter& painter) {
|
||||
if (!(portapack::persistent_memory::ui_config() & 16)) {
|
||||
// Blank the whole display
|
||||
painter.fill_rectangle(
|
||||
portapack::display.screen_rect(),
|
||||
style().background
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
PlayDeadView::PlayDeadView(NavigationView& nav) {
|
||||
rtc::RTC datetime;
|
||||
|
||||
portapack::persistent_memory::set_playing_dead(0x5920C1DF); // Enable
|
||||
|
||||
add_children({
|
||||
&text_playdead1,
|
||||
&text_playdead2,
|
||||
&text_playdead3,
|
||||
&button_seq_entry,
|
||||
});
|
||||
|
||||
// Seed from RTC
|
||||
rtcGetTime(&RTCD1, &datetime);
|
||||
text_playdead2.set("0x" + to_string_hex(lfsr_iterate(datetime.second()), 6) + "00");
|
||||
|
||||
text_playdead3.hidden(true);
|
||||
|
||||
button_seq_entry.on_dir = [this](Button&, KeyEvent key){
|
||||
sequence = (sequence << 3) | (static_cast<std::underlying_type<KeyEvent>::type>(key) + 1);
|
||||
return true;
|
||||
};
|
||||
|
||||
button_seq_entry.on_select = [this, &nav](Button&){
|
||||
if (sequence == portapack::persistent_memory::playdead_sequence()) {
|
||||
portapack::persistent_memory::set_playing_dead(0x82175E23); // Disable
|
||||
if (!(portapack::persistent_memory::ui_config() & 16)) {
|
||||
text_playdead3.hidden(false);
|
||||
} else {
|
||||
nav.pop();
|
||||
nav.push<SystemMenuView>();
|
||||
}
|
||||
} else {
|
||||
sequence = 0;
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
} /* namespace ui */
|
Loading…
Add table
Add a link
Reference in a new issue