Skip to content

Commit

Permalink
make get_raw_input function
Browse files Browse the repository at this point in the history
  • Loading branch information
Dregu committed Nov 5, 2023
1 parent ff9f552 commit ce48ab5
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 6 deletions.
6 changes: 6 additions & 0 deletions src/game_api/game_manager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,9 @@ GameManager* get_game_manager()
static GameManager** gm = (GameManager**)get_address("game_manager"sv);
return *gm;
}

RawInput* get_raw_input()
{
static auto offset = get_address("input_table");
return reinterpret_cast<RawInput*>(offset);
}
1 change: 1 addition & 0 deletions src/game_api/game_manager.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -195,3 +195,4 @@ struct GameManager
};

GameManager* get_game_manager();
RawInput* get_raw_input();
8 changes: 2 additions & 6 deletions src/game_api/script/usertypes/game_manager_lua.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -144,11 +144,7 @@ void register_usertypes(sol::state& lua)
"pressed",
&ControllerButton::pressed);

lua["get_raw_input"] = []() -> RawInput*
{
// TODO:temp, move to rpc or something
static auto offset = get_address("input_table");
return reinterpret_cast<RawInput*>(offset);
};
/// Returns RawInput, a game structure for raw keyboard and controller state
lua["get_raw_input"] = get_raw_input;
}
}; // namespace NGM
3 changes: 3 additions & 0 deletions src/injected/ui.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1913,6 +1913,9 @@ void quick_start(uint8_t screen, uint8_t world, uint8_t level, uint8_t theme)
g_game_manager->main_menu_music->kill(false);
g_game_manager->main_menu_music = nullptr;
}

// TODO: this doesn't quite work, loads intro after character selection
g_state->screen_character_select->available_mine_entrances = 4;
}

std::string get_clipboard()
Expand Down

0 comments on commit ce48ab5

Please sign in to comment.