1
0
Fork 0
mirror of https://github.com/jugeeya/UltimateTrainingModpack.git synced 2024-11-20 00:46:34 +00:00
This commit is contained in:
jugeeya 2022-03-24 17:12:10 -07:00
commit 3f049605c3
4 changed files with 87 additions and 41 deletions

View file

@ -112,7 +112,26 @@ jobs:
body: > body: >
Beta built off of the latest code in the repository. Beta built off of the latest code in the repository.
Install the same way you would install a full release. Install the same way you would install a full release.
## Installing on Ryujinx
Instructions to get the beta working on Ryujinx.
1. Download a Skyline-tolerant build of Ryujinx, which can be found here: https://github.com/Ryujinx/Ryujinx/pull/2966#issuecomment-1003648371
2. Download the beta. https://github.com/jugeeya/UltimateTrainingModpack/releases/tag/beta
3. The atmosphere folder from the beta zip is everything that should be in Ryujinx's mod folder. This means `%AppData%/Ryujinx/mods/contents/01006a800016e000` should have what `atmosphere/contents/01006a800016e000` has.
4. The other files/folders such as `shader_binaries` and `font.ttf` from the beta zip ishould be placed on the root of the SD card, which for Ryujinx is `%AppData/Ryujinx/sdcard`.
5. You should be good to go after this. When in training mode, use Special+Uptaunt to bring up the menu.
files: > files: >
training_modpack_beta.zip training_modpack_beta.zip
- name: Upload zip as artifact - name: Upload zip as artifact

View file

@ -28,6 +28,7 @@ use std::fs;
use owo_colors::OwoColorize; use owo_colors::OwoColorize;
use training_mod_consts::OnOff; use training_mod_consts::OnOff;
use training_mod_tui::Color;
fn nro_main(nro: &NroInfo<'_>) { fn nro_main(nro: &NroInfo<'_>) {
if nro.module.isLoaded { if nro.module.isLoaded {
@ -173,12 +174,16 @@ pub fn main() {
unsafe { unsafe {
let mut has_slept_millis = 0; let mut has_slept_millis = 0;
let render_frames = 5;
let mut url = String::new(); let mut url = String::new();
let button_presses = &mut common::menu::BUTTON_PRESSES; let button_presses = &mut common::menu::BUTTON_PRESSES;
let mut received_input = true;
loop { loop {
button_presses.a.read_press().then(|| app.on_a()); button_presses.a.read_press().then(|| { app.on_a(); received_input = true; });
button_presses.b.read_press().then(|| { let b_press = &mut button_presses.b;
if app.outer_list == false { b_press.read_press().then(|| {
received_input = true;
if !app.outer_list {
app.on_b() app.on_b()
} else { } else {
// Leave menu. // Leave menu.
@ -186,18 +191,22 @@ pub fn main() {
crate::menu::set_menu_from_url(url.as_str()); crate::menu::set_menu_from_url(url.as_str());
} }
}); });
button_presses.zl.read_press().then(|| app.on_l()); button_presses.zl.read_press().then(|| { app.on_l(); received_input = true; });
button_presses.zr.read_press().then(|| app.on_r()); button_presses.zr.read_press().then(|| { app.on_r(); received_input = true; });
button_presses.left.read_press().then(|| app.on_left()); button_presses.left.read_press().then(|| { app.on_left(); received_input = true; });
button_presses.right.read_press().then(|| app.on_right()); button_presses.right.read_press().then(|| { app.on_right(); received_input = true; });
button_presses.up.read_press().then(|| app.on_up()); button_presses.up.read_press().then(|| { app.on_up(); received_input = true; });
button_presses.down.read_press().then(|| app.on_down()); button_presses.down.read_press().then(|| { app.on_down(); received_input = true; });
std::thread::sleep(std::time::Duration::from_millis(16)); std::thread::sleep(std::time::Duration::from_millis(16));
has_slept_millis += 16; has_slept_millis += 16;
let render_frames = 5; if has_slept_millis < 16 * render_frames { continue; }
if has_slept_millis > 16 * render_frames {
has_slept_millis = 16; has_slept_millis = 16;
if !menu::QUICK_MENU_ACTIVE {
set_should_display_text_to_screen(false);
continue;
}
if !received_input { continue; }
let mut view = String::new(); let mut view = String::new();
let frame_res = terminal let frame_res = terminal
@ -205,20 +214,31 @@ pub fn main() {
.unwrap(); .unwrap();
use std::fmt::Write; use std::fmt::Write;
for (i, cell) in frame_res.buffer.content().into_iter().enumerate() { for (i, cell) in frame_res.buffer.content().iter().enumerate() {
write!(&mut view, "{}", cell.symbol).unwrap(); match cell.fg {
Color::Black => write!(&mut view, "{}", &cell.symbol.black()),
Color::Blue => write!(&mut view, "{}", &cell.symbol.blue()),
Color::LightBlue => write!(&mut view, "{}", &cell.symbol.bright_blue()),
Color::Cyan => write!(&mut view, "{}", &cell.symbol.cyan()),
Color::LightCyan => write!(&mut view, "{}", &cell.symbol.cyan()),
Color::Red => write!(&mut view, "{}", &cell.symbol.red()),
Color::LightRed => write!(&mut view, "{}", &cell.symbol.bright_red()),
Color::LightGreen => write!(&mut view, "{}", &cell.symbol.bright_green()),
Color::Green => write!(&mut view, "{}", &cell.symbol.green()),
Color::Yellow => write!(&mut view, "{}", &cell.symbol.yellow()),
Color::LightYellow => write!(&mut view, "{}", &cell.symbol.bright_yellow()),
Color::Magenta => write!(&mut view, "{}", &cell.symbol.magenta()),
Color::LightMagenta => write!(&mut view, "{}", &cell.symbol.bright_magenta()),
_ => write!(&mut view, "{}", &cell.symbol),
}.unwrap();
if i % frame_res.area.width as usize == frame_res.area.width as usize - 1 { if i % frame_res.area.width as usize == frame_res.area.width as usize - 1 {
write!(&mut view, "\n").unwrap(); writeln!(&mut view).unwrap();
} }
} }
write!(&mut view, "\n").unwrap(); writeln!(&mut view).unwrap();
if menu::QUICK_MENU_ACTIVE {
render_text_to_screen(view.as_str()); render_text_to_screen(view.as_str());
} else { received_input = false;
set_should_display_text_to_screen(false);
}
}
} }
} }
}); });

View file

@ -2,13 +2,13 @@ use training_mod_consts::{OnOffSelector, Slider, SubMenu, SubMenuType, Toggle};
use tui::{ use tui::{
backend::{Backend}, backend::{Backend},
layout::{Constraint, Corner, Direction, Layout}, layout::{Constraint, Corner, Direction, Layout},
style::{Color, Modifier, Style}, style::{Modifier, Style},
text::Spans, text::{Span, Spans},
widgets::{Tabs, Paragraph, Block, List, ListItem, ListState}, widgets::{Tabs, Paragraph, Block, List, ListItem, ListState},
Frame, Frame,
}; };
pub use tui::{backend::TestBackend, Terminal}; pub use tui::{backend::TestBackend, Terminal, style::Color};
use std::collections::HashMap; use std::collections::HashMap;
mod list; mod list;
@ -322,8 +322,13 @@ pub fn ui<B: Backend>(f: &mut Frame<B>, app: &mut App) -> String {
Spans::from(" ".to_owned() + tab) Spans::from(" ".to_owned() + tab)
} }
}).collect(); }).collect();
let tabs = Tabs::new(titles) let tabs = Tabs::new(titles)
.block(Block::default().title("Ultimate Training Modpack Menu")) .block(Block::default()
.title(
Spans::from(
Span::styled("Ultimate Training Modpack Menu",
Style::default().fg(Color::LightRed)))))
.style(Style::default().fg(Color::White)) .style(Style::default().fg(Color::White))
.highlight_style(Style::default().fg(Color::Yellow)) .highlight_style(Style::default().fg(Color::Yellow))
.divider("|") .divider("|")
@ -359,15 +364,17 @@ pub fn ui<B: Backend>(f: &mut Frame<B>, app: &mut App) -> String {
} else { } else {
" ".to_owned() + i.title " ".to_owned() + i.title
})]; })];
ListItem::new(lines).style(Style::default().fg(Color::Black).bg(Color::White)) ListItem::new(lines).style(Style::default().fg(Color::White))
}) })
.collect(); .collect();
let list = List::new(items) let list = List::new(items)
.block(Block::default().title(if list_section == 0 { "Options" } else { "" })) .block(Block::default()
.title(if list_section == 0 { "Options" } else { "" })
.style(Style::default().fg(Color::LightRed)))
.highlight_style( .highlight_style(
Style::default() Style::default()
.bg(Color::LightBlue) .fg(Color::Green)
.add_modifier(Modifier::BOLD), .add_modifier(Modifier::BOLD),
) )
.highlight_symbol(">> "); .highlight_symbol(">> ");
@ -382,8 +389,8 @@ pub fn ui<B: Backend>(f: &mut Frame<B>, app: &mut App) -> String {
let help_paragraph = Paragraph::new( let help_paragraph = Paragraph::new(
item_help.unwrap_or("").replace("\"", "") + item_help.unwrap_or("").replace("\"", "") +
"\nA: Enter sub-menu | B: Exit menu | ZL/ZR: Next tab | R: Save defaults" "\nA: Enter sub-menu | B: Exit menu | ZL/ZR: Next tab"
); ).style(Style::default().fg(Color::Cyan));
f.render_widget(help_paragraph, vertical_chunks[2]); f.render_widget(help_paragraph, vertical_chunks[2]);
} else { } else {
let (title, help_text, mut sub_menu_str_lists) = app.sub_menu_strs_and_states(); let (title, help_text, mut sub_menu_str_lists) = app.sub_menu_strs_and_states();
@ -403,7 +410,7 @@ pub fn ui<B: Backend>(f: &mut Frame<B>, app: &mut App) -> String {
.start_corner(Corner::TopLeft) .start_corner(Corner::TopLeft)
.highlight_style( .highlight_style(
Style::default() Style::default()
.bg(Color::LightGreen) .fg(Color::LightGreen)
.add_modifier(Modifier::BOLD), .add_modifier(Modifier::BOLD),
) )
.highlight_symbol(">> "); .highlight_symbol(">> ");
@ -413,7 +420,7 @@ pub fn ui<B: Backend>(f: &mut Frame<B>, app: &mut App) -> String {
let help_paragraph = Paragraph::new( let help_paragraph = Paragraph::new(
help_text.replace("\"", "") + help_text.replace("\"", "") +
"\nA: Select toggle | B: Exit submenu" "\nA: Select toggle | B: Exit submenu"
); ).style(Style::default().fg(Color::Cyan));
f.render_widget(help_paragraph, vertical_chunks[2]); f.render_widget(help_paragraph, vertical_chunks[2]);
} }