Linux/GCC Support (#28)
* Initial Linux/GCC support commit * Add instructins for linux in the README * apply suggestions by @Erotemic and @Emill * Fix python 3.10 symlink line * Fix func_80041E80 type mismatch (#3) Type mismatch functions.h:664 * Makefile: clean OTRExporter/libultraship/ZAPDTR with distclean and fix CXX_FILES * Makefile: find C/CXX_FILES automatically * Makefile: remove ugly conditions in find commands * cleanup _MSC_VER usage * fix Windows build * cleanup extraction scripts * fix Windows build * Fix Windows path separator issue * fix rumble support for linux * use glew-cmake in dockerfile * add pulseaudio backend * fix ZAPDTR linkage * Check for "soh.elf" in directory (#6) hide second button if `soh.exe` or `soh.elf` is present * Fix hardcoded segment addresses (#5) * fix condition * hack lus -> soh dep for ZAPDTR Co-authored-by: sholdee <102821812+sholdee@users.noreply.github.com> Co-authored-by: qurious-pixel <62252937+qurious-pixel@users.noreply.github.com> Co-authored-by: GaryOderNichts <12049776+GaryOderNichts@users.noreply.github.com>
This commit is contained in:
@@ -61,17 +61,17 @@ namespace Ship {
|
||||
if (Conf[ConfSection]["GUID"].compare("") == 0 || Conf[ConfSection]["GUID"].compare(INVALID_SDL_CONTROLLER_GUID) == 0 || Conf[ConfSection]["GUID"].compare(NewGuid) == 0) {
|
||||
auto NewCont = SDL_GameControllerOpen(i);
|
||||
|
||||
if (SDL_GameControllerHasSensor(NewCont, SDL_SENSOR_GYRO))
|
||||
{
|
||||
SDL_GameControllerSetSensorEnabled(NewCont, SDL_SENSOR_GYRO, SDL_TRUE);
|
||||
}
|
||||
|
||||
// We failed to load the controller. Go to next.
|
||||
if (NewCont == nullptr) {
|
||||
SPDLOG_ERROR("SDL Controller failed to open: ({})", SDL_GetError());
|
||||
continue;
|
||||
}
|
||||
|
||||
if (SDL_GameControllerHasSensor(NewCont, SDL_SENSOR_GYRO))
|
||||
{
|
||||
SDL_GameControllerSetSensorEnabled(NewCont, SDL_SENSOR_GYRO, SDL_TRUE);
|
||||
}
|
||||
|
||||
guid = NewGuid;
|
||||
Cont = NewCont;
|
||||
|
||||
@@ -101,7 +101,7 @@ namespace Ship {
|
||||
}
|
||||
|
||||
bool SDLController::Close() {
|
||||
if (SDL_GameControllerHasRumble(Cont)) {
|
||||
if (CanRumble()) {
|
||||
SDL_GameControllerRumble(Cont, 0, 0, 0);
|
||||
}
|
||||
if (Cont != nullptr) {
|
||||
@@ -190,7 +190,7 @@ namespace Ship {
|
||||
if (SDL_GameControllerHasSensor(Cont, SDL_SENSOR_GYRO))
|
||||
{
|
||||
size_t contNumber = GetControllerNumber();
|
||||
|
||||
|
||||
float gyroData[3];
|
||||
SDL_GameControllerGetSensorData(Cont, SDL_SENSOR_GYRO, gyroData, 3);
|
||||
|
||||
@@ -347,7 +347,7 @@ namespace Ship {
|
||||
|
||||
void SDLController::WriteToSource(ControllerCallback* controller)
|
||||
{
|
||||
if (SDL_GameControllerHasRumble(Cont)) {
|
||||
if (CanRumble()) {
|
||||
if (controller->rumble > 0) {
|
||||
float rumble_strength = CVar_GetFloat(StringHelper::Sprintf("gCont%i_RumbleStrength", GetControllerNumber()).c_str(), 1.0f);
|
||||
SDL_GameControllerRumble(Cont, 0xFFFF * rumble_strength, 0xFFFF * rumble_strength, 0);
|
||||
|
||||
Reference in New Issue
Block a user