Browse Source

gamebridge hacks

master
Cadey Ratio 4 months ago
parent
commit
a49c44a017
6 changed files with 25 additions and 13 deletions
  1. +1
    -1
      gamebridge/src/main.rs
  2. +17
    -7
      gamebridge/src/twitch.rs
  3. +2
    -0
      src/game/mario.c
  4. +2
    -2
      src/pc/controller/controller_entry_point.c
  5. +1
    -1
      src/pc/controller/controller_gamebridge.c
  6. +2
    -2
      src/pc/gfx/gfx_screen_config.h

+ 1
- 1
gamebridge/src/main.rs View File

@ -42,7 +42,7 @@ fn main() -> Result<()> {
let mut vblank = File::open("vblank")?;
let mut input = OpenOptions::new().write(true).open("input")?;
const STICK_LERP_TIME: f64 = 270.0; // 270 frames to lerp stick positions down to 0
const STICK_LERP_TIME: f64 = 500.0; // 450 frames to lerp stick positions down to 0
const BUTTON_LERP_TIME: f64 = 20.0; // 20 frames to lerp button inputs down to 0
let st = {


+ 17
- 7
gamebridge/src/twitch.rs View File

@ -12,9 +12,9 @@ pub(crate) fn run(st: MTState) {
async fn handle(st: MTState) {
let (nick, pass) = (
// twitch name
std::env::var("TWITCH_NICK").unwrap(),
std::env::var("TWITCH_NICK").expect("bot nickname to be in the environment"),
// oauth token for twitch name
std::env::var("TWITCH_PASS").unwrap(),
std::env::var("TWITCH_PASS").expect("bot password to be in the environment"),
);
// putting this in the env so people don't join my channel when running this
@ -87,17 +87,27 @@ async fn run_loop(
"a" => data.a_button.add(BUTTON_ADD_AMT),
"b" => data.b_button.add(BUTTON_ADD_AMT),
"z" => data.z_button.add(BUTTON_ADD_AMT),
"r" => data.r_button.add(BUTTON_ADD_AMT),
"cam" | "camera" => data.r_button.add(BUTTON_ADD_AMT),
"cup" => data.c_up.add(BUTTON_ADD_AMT),
"cdown" => data.c_down.add(BUTTON_ADD_AMT),
"cleft" => data.c_left.add(BUTTON_ADD_AMT),
"cright" => data.c_right.add(BUTTON_ADD_AMT),
"start" => data.start.add(BUTTON_ADD_AMT),
"up" => data.sticky.add(127),
"down" => data.sticky.add(-128),
"left" => data.stickx.add(-128),
"right" => data.stickx.add(127),
"up" | "u" => data.sticky.add(127),
"down" | "d" => data.sticky.add(-128),
"left" | "l" => data.stickx.add(-128),
"right" | "r" => data.stickx.add(127),
"stop" => {data.stickx.update(0); data.sticky.update(0);},
"unstuck" => {
data.a_button.update(0);
data.b_button.update(0);
data.z_button.update(0);
data.r_button.update(0);
data.c_up.update(0);
data.c_down.update(0);
data.c_left.update(0);
data.c_right.update(0);
}
_ => {},
}
}


+ 2
- 0
src/game/mario.c View File

@ -1258,6 +1258,7 @@ void debug_print_speed_action_normal(struct MarioState *m) {
void update_mario_button_inputs(struct MarioState *m) {
if (m->controller->buttonPressed & A_BUTTON) {
m->input |= INPUT_A_PRESSED;
print_text(210, 32, "A");
}
if (m->controller->buttonDown & A_BUTTON) {
@ -1268,6 +1269,7 @@ void update_mario_button_inputs(struct MarioState *m) {
if (m->squishTimer == 0) {
if (m->controller->buttonPressed & B_BUTTON) {
m->input |= INPUT_B_PRESSED;
print_text(210, 48, "B");
}
if (m->controller->buttonDown & Z_TRIG) {


+ 2
- 2
src/pc/controller/controller_entry_point.c View File

@ -9,10 +9,10 @@
static struct ControllerAPI *controller_implementations[] = {
&controller_recorded_tas,
&controller_gamebridge,
&controller_sdl,
&controller_keyboard,
&controller_gamebridge,
&controller_tas_recorder,
//&controller_tas_recorder,
};
s32 osContInit(OSMesgQueue *mq, u8 *controllerBits, OSContStatus *status) {


+ 1
- 1
src/pc/controller/controller_gamebridge.c View File

@ -69,7 +69,7 @@ static void gamebridge_init(void) {
printf("[gamebridge] starting rust daemon\n");
fflush(stdout);
system("./target/debug/gamebridge &");
system("./target/release/gamebridge &");
atexit(gamebridge_close);
}


+ 2
- 2
src/pc/gfx/gfx_screen_config.h View File

@ -1,7 +1,7 @@
#ifndef GFX_SCREEN_CONFIG_H
#define GFX_SCREEN_CONFIG_H
#define DESIRED_SCREEN_WIDTH 640
#define DESIRED_SCREEN_HEIGHT 480
#define DESIRED_SCREEN_WIDTH 1366
#define DESIRED_SCREEN_HEIGHT 768
#endif

Loading…
Cancel
Save