mirror of
https://github.com/tangerineturtle1/NX2navi.git
synced 2026-11-15 19:19:58 -04:00
Up to four players, each in their own game and save, meet in a room. Rooms are Steam lobbies and the games talk through Steam's networking, so nobody forwards a port and nobody runs a server. The game signs in to Steam as its test app (480), so Steam shows the player as playing Spacewar. Off by default; the menu has a Co-op tab with Create a room, Join a room by its ID, Invite a friend, the players, chat and Leave, in English, Russian, Brazilian Portuguese and Simplified Chinese. runtime/steam.c loads steam_api64.dll from beside the exe at run time and declares the C functions it calls itself; nothing of the Steamworks SDK is in the repository, and a player copies the file from a Steam game they have. runtime/coop.c is the room: the lobby's owner is the host, lets games of the same protocol and game build in and lists them, and every game takes positions, chat and progress only from the players on that list. runtime/coop_game.c reads Link from the Player actor and shares progress, items, songs and quest items through the game's own flag routines, each value only ever raised; small keys, rupees, ammunition and hearts stay each player's own, and the save is copied to coop-backup before anything of a room reaches it. The other players show as a name with a distance where their Link stands, projected with the upscaler's camera. One Steam account cannot be in a lobby twice, and this PC has not the memory for two games, so the room and the game side were run with one game and tests/coop_peer.py as the second player over runtime/coop_local.c, a stand-in for Steam on 127.0.0.1 that only the environment turns on: the peer was let in, saw the game's Link in Hyrule Field, chat went both ways, the save was copied, one flag the save lacked was set and a flag the game does not share was refused. On Steam itself one game signed in as app 480, made a room, showed its ID and the player's Steam name on the Co-op tab and left. Not run: two Steam accounts in one room, an invite, a join by room ID over Steam, a host that leaves, a removal, and the menu's text probe on this build. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
75 lines
4.2 KiB
C
75 lines
4.2 KiB
C
// The debug menu's access to the game (debug_tools.c). Everything but dbg_tick is for the menu's thread.
|
|
#pragma once
|
|
#include <stdint.h>
|
|
|
|
#ifndef __cplusplus
|
|
#include "cpu.h"
|
|
void dbg_tick(Cpu *c); // the game's thread, at its pad read (ov_input.c): does what the menu asked for
|
|
// ... and the pad's state before the game gets it: the free camera takes the sticks and four buttons while it flies
|
|
void dbg_pad(uint64_t *buttons, int32_t *lx, int32_t *ly, int32_t *rx, int32_t *ry);
|
|
void dbg_freecam_host(Cpu *c); // the free camera's patch site (recomp/patches-v111.txt, set freecam)
|
|
#endif
|
|
|
|
#ifdef __cplusplus
|
|
extern "C" {
|
|
#endif
|
|
int dbg_supported(void); // this game build's structures are known (Ocarina of Time 1.1.1)
|
|
|
|
int dbg_player_pos(float xyz[3]); // Link's position in metres; 0 while there is no player
|
|
int dbg_area(char out[64]); // the area the game is in, by its name in the game's files; 0 unknown
|
|
float dbg_speed_factor(void); // the game's speed: 1 normal, 0.05 to 8 (frame_rate.c multiplies the game's step)
|
|
void dbg_speed_set(float factor);
|
|
|
|
// The game's on/off flags, sorted by hash. dbg_flags_refresh reads their values and returns their number (0 until a
|
|
// save is loaded). A change is made by the game's own function at the next frame.
|
|
int dbg_flags_refresh(void);
|
|
uint32_t dbg_flag_hash(int i);
|
|
int dbg_flag_value(int i);
|
|
const char *dbg_flag_name(int i); // NULL: no name found for it
|
|
void dbg_flag_set(uint32_t hash, int on);
|
|
int dbg_names(int *found); // 0 not started, 1 being read from the game's files, 2 read (*found of them)
|
|
|
|
// Teleporting and events. The places are the game's areas with their named start positions, and the events its event
|
|
// files that hold a script: both lists come from the player's game files with the flag names (0 until dbg_names
|
|
// answers 2). dbg_warp changes area as the game's own doors do; dbg_event_start starts an event by its name. One at a
|
|
// time: nothing is taken while dbg_busy. dbg_status is the last thing that happened, in words.
|
|
int dbg_places(void);
|
|
const char *dbg_place_area(int i);
|
|
const char *dbg_place_pos(int i); // never "": a teleport without a listed position takes the area's first
|
|
void dbg_warp(const char *area, const char *pos);
|
|
int dbg_events(void);
|
|
const char *dbg_event_name(int i);
|
|
void dbg_event_start(const char *name);
|
|
int dbg_busy(void);
|
|
void dbg_status(char out[160]);
|
|
|
|
// The free camera: the game draws from a camera of the menu's instead of its own. With sticks on, the pad flies it and
|
|
// Link stands; with sticks off it stays where it is and the pad plays the game. speed in metres a second.
|
|
int dbg_freecam_available(void); // the build has the camera's patch set
|
|
void dbg_freecam_set(int on, int sticks, float speed);
|
|
void dbg_freecam_reset(void); // back to the game's view, free again from there
|
|
int dbg_freecam(int *sticks, float *speed, double pos[3]); // on or off
|
|
int dbg_freecam_flying(void); // on, with the sticks and ground avoidance: vk_dlaa.c reads the ground's distances back
|
|
void dbg_freecam_avoid_set(int on); // ground avoidance (off by default): the camera stays a metre above ground-like surfaces
|
|
int dbg_freecam_avoid(void);
|
|
// The replay's thread: nine view distances of the lower view (three rows of three, the top row first; 0 sky), with the
|
|
// tangent of half the view's vertical angle and its width over its height
|
|
void dbg_freecam_ground(const float *dist, int n, float tan_half_y, float aspect);
|
|
|
|
// Memory: values of 1, 2 or 4 bytes in the game's heap.
|
|
int dbg_search_new(uint32_t value, int size); // returns the number of places
|
|
int dbg_search_next(int mode, uint32_t value); // 0 equals value, 1 changed, 2 unchanged, 3 greater, 4 less
|
|
int dbg_search_count(int *over); // *over: the first search found more than are kept
|
|
uint64_t dbg_search_addr(int i);
|
|
int dbg_search_size(void);
|
|
void dbg_search_clear(void);
|
|
int dbg_mem_read(uint64_t addr, int size, uint32_t *v);
|
|
void dbg_mem_write(uint64_t addr, uint64_t value, int size);
|
|
int dbg_freeze(uint64_t addr, uint64_t value, int size, int on); // written every frame while on; 0: the list is full
|
|
int dbg_frozen(uint64_t addr);
|
|
int dbg_frozen_count(void);
|
|
void dbg_unfreeze_all(void);
|
|
#ifdef __cplusplus
|
|
}
|
|
#endif
|