Compare commits
No commits in common. "master" and "gamebridge" have entirely different histories.
master
...
gamebridge
|
@ -77,6 +77,3 @@ vblank
|
||||||
input
|
input
|
||||||
*.m64
|
*.m64
|
||||||
.env
|
.env
|
||||||
|
|
||||||
# Nix
|
|
||||||
/result
|
|
||||||
|
|
44
default.nix
44
default.nix
|
@ -1,44 +0,0 @@
|
||||||
{ pkgs ? import <nixpkgs> { } }:
|
|
||||||
|
|
||||||
with pkgs;
|
|
||||||
|
|
||||||
stdenv.mkDerivation rec {
|
|
||||||
pname = "sm64pc";
|
|
||||||
version = "latest";
|
|
||||||
|
|
||||||
buildInputs = [
|
|
||||||
gnumake
|
|
||||||
python3
|
|
||||||
audiofile
|
|
||||||
pkg-config
|
|
||||||
SDL2
|
|
||||||
libusb1
|
|
||||||
glfw3
|
|
||||||
libgcc
|
|
||||||
xorg.libX11
|
|
||||||
xorg.libXrandr
|
|
||||||
libpulseaudio
|
|
||||||
alsaLib
|
|
||||||
glfw
|
|
||||||
libGL
|
|
||||||
unixtools.hexdump
|
|
||||||
clang_10
|
|
||||||
];
|
|
||||||
|
|
||||||
src = ./.;
|
|
||||||
|
|
||||||
buildPhase = ''
|
|
||||||
chmod +x ./extract_assets.py
|
|
||||||
make -j
|
|
||||||
'';
|
|
||||||
|
|
||||||
installPhase = ''
|
|
||||||
mkdir -p $out/bin
|
|
||||||
cp ./build/us_pc/sm64.us.f3dex2e $out/bin/sm64pc
|
|
||||||
'';
|
|
||||||
|
|
||||||
meta = with stdenv.lib; {
|
|
||||||
description = "Super Mario 64 PC port, requires rom :)";
|
|
||||||
license = licenses.unfree;
|
|
||||||
};
|
|
||||||
}
|
|
|
@ -1,51 +0,0 @@
|
||||||
SUPER MARIO 64 CONTROL GUIDE
|
|
||||||
|
|
||||||
N64 BUTTON INPUT = KEYBOARD INPUT (KEYBOARD SCAN CODES)
|
|
||||||
|
|
||||||
A Button = L (38)
|
|
||||||
B Button = , (51)
|
|
||||||
Start Button = Spacebar (57)
|
|
||||||
R Button = Right Shift (54)
|
|
||||||
Z Button = K (37)
|
|
||||||
C Stick Up = Up Arrow (?)
|
|
||||||
C stick Down = Down Arrow (?)
|
|
||||||
C Stick Left = Left Arrow (?)
|
|
||||||
C Stick Right = Right Arrow (?)
|
|
||||||
Stick Up = W (17)
|
|
||||||
Stick Down = S (31)
|
|
||||||
Stick Left = A (30)
|
|
||||||
Stick Right = D (32)
|
|
||||||
|
|
||||||
KEYBOARD SCAN CODES:
|
|
||||||
|
|
||||||
Key Code ¦ Key Code ¦ Key Code
|
|
||||||
¦ ¦
|
|
||||||
Esc 1 ¦ A 30 ¦ Caps Lock 58
|
|
||||||
! or 1 2 ¦ S 31 ¦ F1 59
|
|
||||||
@ or 2 3 ¦ D 32 ¦ F2 60
|
|
||||||
# or 3 4 ¦ F 33 ¦ F3 61
|
|
||||||
$ or 4 5 ¦ G 34 ¦ F4 62
|
|
||||||
% or 5 6 ¦ H 35 ¦ F5 63
|
|
||||||
^ or 6 7 ¦ J 36 ¦ F6 64
|
|
||||||
& or 7 8 ¦ K 37 ¦ F7 65
|
|
||||||
* or 8 9 ¦ L 38 ¦ F8 66
|
|
||||||
( or 9 10 ¦ : or ; 39 ¦ F9 67
|
|
||||||
) or 0 11 ¦ " or ' 40 ¦ F10 68
|
|
||||||
_ or - 12 ¦ ~ or ` 41 ¦ F11 133
|
|
||||||
+ or = 13 ¦ Left Shift 42 ¦ F12 134
|
|
||||||
Bksp 14 ¦ | or \ 43 ¦ NumLock 69
|
|
||||||
Tab 15 ¦ Z 44 ¦ Scroll Lock 70
|
|
||||||
Q 16 ¦ X 45 ¦ Home or 7 71
|
|
||||||
W 17 ¦ C 46 ¦ Up or 8 72
|
|
||||||
E 18 ¦ V 47 ¦ PgUp or 9 73
|
|
||||||
R 19 ¦ B 48 ¦ Gray - 74
|
|
||||||
T 20 ¦ N 49 ¦ Left or 4 75
|
|
||||||
Y 21 ¦ M 50 ¦ Center or 5 76
|
|
||||||
U 22 ¦ < or , 51 ¦ Right or 6 77
|
|
||||||
I 23 ¦ > or . 52 ¦ Gray + 78
|
|
||||||
O 24 ¦ ? or / 53 ¦ End or 1 79
|
|
||||||
P 25 ¦ Right Shift 54 ¦ Down or 2 80
|
|
||||||
{ or [ 26 ¦ Prt Sc or * 55 ¦ PgDn or 3 81
|
|
||||||
} or ] 27 ¦ Alt 56 ¦ Ins or 0 82
|
|
||||||
Enter 28 ¦ Spacebar 57 ¦ Del or . 83
|
|
||||||
Ctrl 29 ¦
|
|
22
docker.nix
22
docker.nix
|
@ -1,22 +0,0 @@
|
||||||
{ pkgs ? import <nixpkgs> { } }:
|
|
||||||
|
|
||||||
with pkgs;
|
|
||||||
|
|
||||||
let
|
|
||||||
site = callPackage ./default.nix { };
|
|
||||||
|
|
||||||
dockerImage = pkg:
|
|
||||||
pkgs.dockerTools.buildLayeredImage {
|
|
||||||
name = "ghcr.io/xe/sm64pc";
|
|
||||||
tag = "latest";
|
|
||||||
|
|
||||||
contents = [ pkg mesa mesa.drivers mesa_glu mesa_noglu libGL_driver ];
|
|
||||||
|
|
||||||
config = {
|
|
||||||
Cmd = [ "${strace}/bin/strace" "${pkg}/bin/sm64pc" ];
|
|
||||||
Env = [ "LD_LIBRARY_PATH=/lib" "LIBGL_DRIVERS_PATH=/lib/dri" ];
|
|
||||||
WorkingDir = "/";
|
|
||||||
};
|
|
||||||
};
|
|
||||||
|
|
||||||
in dockerImage site
|
|
|
@ -42,7 +42,7 @@ fn main() -> Result<()> {
|
||||||
let mut vblank = File::open("vblank")?;
|
let mut vblank = File::open("vblank")?;
|
||||||
let mut input = OpenOptions::new().write(true).open("input")?;
|
let mut input = OpenOptions::new().write(true).open("input")?;
|
||||||
|
|
||||||
const STICK_LERP_TIME: f64 = 500.0; // 450 frames to lerp stick positions down to 0
|
const STICK_LERP_TIME: f64 = 270.0; // 270 frames to lerp stick positions down to 0
|
||||||
const BUTTON_LERP_TIME: f64 = 20.0; // 20 frames to lerp button inputs down to 0
|
const BUTTON_LERP_TIME: f64 = 20.0; // 20 frames to lerp button inputs down to 0
|
||||||
|
|
||||||
let st = {
|
let st = {
|
||||||
|
|
|
@ -12,9 +12,9 @@ pub(crate) fn run(st: MTState) {
|
||||||
async fn handle(st: MTState) {
|
async fn handle(st: MTState) {
|
||||||
let (nick, pass) = (
|
let (nick, pass) = (
|
||||||
// twitch name
|
// twitch name
|
||||||
std::env::var("TWITCH_NICK").expect("bot nickname to be in the environment"),
|
std::env::var("TWITCH_NICK").unwrap(),
|
||||||
// oauth token for twitch name
|
// oauth token for twitch name
|
||||||
std::env::var("TWITCH_PASS").expect("bot password to be in the environment"),
|
std::env::var("TWITCH_PASS").unwrap(),
|
||||||
);
|
);
|
||||||
|
|
||||||
// putting this in the env so people don't join my channel when running this
|
// putting this in the env so people don't join my channel when running this
|
||||||
|
@ -87,27 +87,17 @@ async fn run_loop(
|
||||||
"a" => data.a_button.add(BUTTON_ADD_AMT),
|
"a" => data.a_button.add(BUTTON_ADD_AMT),
|
||||||
"b" => data.b_button.add(BUTTON_ADD_AMT),
|
"b" => data.b_button.add(BUTTON_ADD_AMT),
|
||||||
"z" => data.z_button.add(BUTTON_ADD_AMT),
|
"z" => data.z_button.add(BUTTON_ADD_AMT),
|
||||||
"cam" | "camera" => data.r_button.add(BUTTON_ADD_AMT),
|
"r" => data.r_button.add(BUTTON_ADD_AMT),
|
||||||
"cup" => data.c_up.add(BUTTON_ADD_AMT),
|
"cup" => data.c_up.add(BUTTON_ADD_AMT),
|
||||||
"cdown" => data.c_down.add(BUTTON_ADD_AMT),
|
"cdown" => data.c_down.add(BUTTON_ADD_AMT),
|
||||||
"cleft" => data.c_left.add(BUTTON_ADD_AMT),
|
"cleft" => data.c_left.add(BUTTON_ADD_AMT),
|
||||||
"cright" => data.c_right.add(BUTTON_ADD_AMT),
|
"cright" => data.c_right.add(BUTTON_ADD_AMT),
|
||||||
"start" => data.start.add(BUTTON_ADD_AMT),
|
"start" => data.start.add(BUTTON_ADD_AMT),
|
||||||
"up" | "u" => data.sticky.add(127),
|
"up" => data.sticky.add(127),
|
||||||
"down" | "d" => data.sticky.add(-128),
|
"down" => data.sticky.add(-128),
|
||||||
"left" | "l" => data.stickx.add(-128),
|
"left" => data.stickx.add(-128),
|
||||||
"right" | "r" => data.stickx.add(127),
|
"right" => data.stickx.add(127),
|
||||||
"stop" => {data.stickx.update(0); data.sticky.update(0);},
|
"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);
|
|
||||||
}
|
|
||||||
_ => {},
|
_ => {},
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,10 +5,10 @@
|
||||||
"homepage": "https://github.com/nmattia/niv",
|
"homepage": "https://github.com/nmattia/niv",
|
||||||
"owner": "nmattia",
|
"owner": "nmattia",
|
||||||
"repo": "niv",
|
"repo": "niv",
|
||||||
"rev": "e0ca65c81a2d7a4d82a189f1e23a48d59ad42070",
|
"rev": "f73bf8d584148677b01859677a63191c31911eae",
|
||||||
"sha256": "1pq9nh1d8nn3xvbdny8fafzw87mj7gsmp6pxkdl65w2g18rmcmzx",
|
"sha256": "0jlmrx633jvqrqlyhlzpvdrnim128gc81q5psz2lpp2af8p8q9qs",
|
||||||
"type": "tarball",
|
"type": "tarball",
|
||||||
"url": "https://github.com/nmattia/niv/archive/e0ca65c81a2d7a4d82a189f1e23a48d59ad42070.tar.gz",
|
"url": "https://github.com/nmattia/niv/archive/f73bf8d584148677b01859677a63191c31911eae.tar.gz",
|
||||||
"url_template": "https://github.com/<owner>/<repo>/archive/<rev>.tar.gz"
|
"url_template": "https://github.com/<owner>/<repo>/archive/<rev>.tar.gz"
|
||||||
},
|
},
|
||||||
"nixpkgs": {
|
"nixpkgs": {
|
||||||
|
@ -17,10 +17,10 @@
|
||||||
"homepage": "https://github.com/NixOS/nixpkgs",
|
"homepage": "https://github.com/NixOS/nixpkgs",
|
||||||
"owner": "NixOS",
|
"owner": "NixOS",
|
||||||
"repo": "nixpkgs-channels",
|
"repo": "nixpkgs-channels",
|
||||||
"rev": "502845c3e31ef3de0e424f3fcb09217df2ce6df6",
|
"rev": "5f14d99efed32721172a819b6e78a5520bab4bc6",
|
||||||
"sha256": "0fcqpsy6y7dgn0y0wgpa56gsg0b0p8avlpjrd79fp4mp9bl18nda",
|
"sha256": "1nxqbcsc8bfmwy450pv6s12nbvzqxai5mr6v41y478pya26lb108",
|
||||||
"type": "tarball",
|
"type": "tarball",
|
||||||
"url": "https://github.com/NixOS/nixpkgs-channels/archive/502845c3e31ef3de0e424f3fcb09217df2ce6df6.tar.gz",
|
"url": "https://github.com/NixOS/nixpkgs-channels/archive/5f14d99efed32721172a819b6e78a5520bab4bc6.tar.gz",
|
||||||
"url_template": "https://github.com/<owner>/<repo>/archive/<rev>.tar.gz"
|
"url_template": "https://github.com/<owner>/<repo>/archive/<rev>.tar.gz"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
let
|
let
|
||||||
sources = import ./nix/sources.nix;
|
sources = import ./nix/sources.nix;
|
||||||
pkgs = import <nixpkgs> { };
|
pkgs = import sources.nixpkgs { };
|
||||||
in pkgs.mkShell {
|
in pkgs.mkShell {
|
||||||
buildInputs = with pkgs; [
|
buildInputs = with pkgs; [
|
||||||
# Mario 64
|
# Mario 64
|
||||||
|
|
|
@ -1258,24 +1258,10 @@ void debug_print_speed_action_normal(struct MarioState *m) {
|
||||||
void update_mario_button_inputs(struct MarioState *m) {
|
void update_mario_button_inputs(struct MarioState *m) {
|
||||||
if (m->controller->buttonPressed & A_BUTTON) {
|
if (m->controller->buttonPressed & A_BUTTON) {
|
||||||
m->input |= INPUT_A_PRESSED;
|
m->input |= INPUT_A_PRESSED;
|
||||||
print_text(210, 32, "A");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (m->controller->buttonDown & A_BUTTON) {
|
if (m->controller->buttonDown & A_BUTTON) {
|
||||||
m->input |= INPUT_A_DOWN;
|
m->input |= INPUT_A_DOWN;
|
||||||
print_text(210, 32, "A");
|
|
||||||
}
|
|
||||||
|
|
||||||
if (m->controller->buttonDown & B_BUTTON) {
|
|
||||||
print_text(226, 32, "B");
|
|
||||||
}
|
|
||||||
|
|
||||||
if (m->controller->buttonDown & R_TRIG) {
|
|
||||||
print_text(226, 48, "R");
|
|
||||||
}
|
|
||||||
|
|
||||||
if (m->controller->buttonDown & Z_TRIG) {
|
|
||||||
print_text(210, 48, "2");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Don't update for these buttons if squished.
|
// Don't update for these buttons if squished.
|
||||||
|
|
|
@ -9,10 +9,10 @@
|
||||||
|
|
||||||
static struct ControllerAPI *controller_implementations[] = {
|
static struct ControllerAPI *controller_implementations[] = {
|
||||||
&controller_recorded_tas,
|
&controller_recorded_tas,
|
||||||
//&controller_gamebridge,
|
|
||||||
&controller_sdl,
|
&controller_sdl,
|
||||||
&controller_keyboard,
|
&controller_keyboard,
|
||||||
//&controller_tas_recorder,
|
&controller_gamebridge,
|
||||||
|
&controller_tas_recorder,
|
||||||
};
|
};
|
||||||
|
|
||||||
s32 osContInit(OSMesgQueue *mq, u8 *controllerBits, OSContStatus *status) {
|
s32 osContInit(OSMesgQueue *mq, u8 *controllerBits, OSContStatus *status) {
|
||||||
|
|
|
@ -69,7 +69,7 @@ static void gamebridge_init(void) {
|
||||||
|
|
||||||
printf("[gamebridge] starting rust daemon\n");
|
printf("[gamebridge] starting rust daemon\n");
|
||||||
fflush(stdout);
|
fflush(stdout);
|
||||||
system("./target/release/gamebridge &");
|
system("./target/debug/gamebridge &");
|
||||||
atexit(gamebridge_close);
|
atexit(gamebridge_close);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
#ifndef GFX_SCREEN_CONFIG_H
|
#ifndef GFX_SCREEN_CONFIG_H
|
||||||
#define GFX_SCREEN_CONFIG_H
|
#define GFX_SCREEN_CONFIG_H
|
||||||
|
|
||||||
#define DESIRED_SCREEN_WIDTH 1366
|
#define DESIRED_SCREEN_WIDTH 640
|
||||||
#define DESIRED_SCREEN_HEIGHT 768
|
#define DESIRED_SCREEN_HEIGHT 480
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
Loading…
Reference in New Issue