Skip to content
This repository has been archived by the owner on Jul 10, 2023. It is now read-only.

Commit

Permalink
Add more targets to Wercker, including Windows
Browse files Browse the repository at this point in the history
Upgrade mutexes to cMutex to avoid issues on Windows
Seems that we cannot include stdclass.h from a header without
things going bad, due to some cyclic dependency in preprocessed
stuff?
  • Loading branch information
davidgfnet committed May 24, 2019
1 parent f4c90e7 commit 9eec298
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 18 deletions.
18 changes: 9 additions & 9 deletions core/input/gamepad_device.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ extern u8 rt[4], lt[4];
extern s8 joyx[4], joyy[4];

std::vector<std::shared_ptr<GamepadDevice>> GamepadDevice::_gamepads;
std::mutex GamepadDevice::_gamepads_mutex;
static cMutex _gamepads_mutex;

bool GamepadDevice::gamepad_btn_input(u32 code, bool pressed)
{
Expand Down Expand Up @@ -238,21 +238,21 @@ bool GamepadDevice::find_mapping(const char *custom_mapping /* = NULL */)

int GamepadDevice::GetGamepadCount()
{
_gamepads_mutex.lock();
_gamepads_mutex.Lock();
int count = _gamepads.size();
_gamepads_mutex.unlock();
_gamepads_mutex.Unlock();
return count;
}

std::shared_ptr<GamepadDevice> GamepadDevice::GetGamepad(int index)
{
_gamepads_mutex.lock();
_gamepads_mutex.Lock();
std::shared_ptr<GamepadDevice> dev;
if (index >= 0 && index < _gamepads.size())
dev = _gamepads[index];
else
dev = NULL;
_gamepads_mutex.unlock();
_gamepads_mutex.Unlock();
return dev;
}

Expand Down Expand Up @@ -295,21 +295,21 @@ void GamepadDevice::Register(std::shared_ptr<GamepadDevice> gamepad)
if (maple_port != 12345)
gamepad->set_maple_port(maple_port);

_gamepads_mutex.lock();
_gamepads_mutex.Lock();
_gamepads.push_back(gamepad);
_gamepads_mutex.unlock();
_gamepads_mutex.Unlock();
}

void GamepadDevice::Unregister(std::shared_ptr<GamepadDevice> gamepad)
{
gamepad->save_mapping();
_gamepads_mutex.lock();
_gamepads_mutex.Lock();
for (auto it = _gamepads.begin(); it != _gamepads.end(); it++)
if (*it == gamepad) {
_gamepads.erase(it);
break;
}
_gamepads_mutex.unlock();
_gamepads_mutex.Unlock();
}

void GamepadDevice::SaveMaplePorts()
Expand Down
2 changes: 0 additions & 2 deletions core/input/gamepad_device.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@

#pragma once
#include <memory>
#include <mutex>
#include "types.h"
#include "mapping.h"

Expand Down Expand Up @@ -89,5 +88,4 @@ class GamepadDevice
float _dead_zone = 0.1f;

static std::vector<std::shared_ptr<GamepadDevice>> _gamepads;
static std::mutex _gamepads_mutex;
};
2 changes: 0 additions & 2 deletions shell/linux/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -255,8 +255,6 @@ else ifneq (,$(findstring win32,$(platform)))
LDFLAGS += -static-libgcc -static-libstdc++ -Wl,-subsystem,windows
LIBS := -lopengl32 -lwinmm -lgdi32 -lwsock32 -ldsound -lcomctl32 -lcomdlg32 -lxinput -liphlpapi
PLATFORM_EXT := exe
CC = gcc
CXX = g++
ifeq ($(WITH_DYNAREC), x86)
X86_REC := 1
LDFLAGS += -m32
Expand Down
16 changes: 11 additions & 5 deletions wercker.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,16 @@ build:
steps:
- script:
name: install-dependencies
code: sudo apt-get clean && sudo apt-get update && sudo apt-get install -y build-essential pkgconf libasound2-dev libgl1-mesa-dev libx11-dev libudev-dev git
code: sudo dpkg --add-architecture i386 && sudo apt-get clean && sudo apt-get update && sudo apt-get install -y build-essential pkgconf libasound2-dev libgl1-mesa-dev libx11-dev libudev-dev git && sudo apt-get install -y libasound2-dev:i386 libgl1-mesa-dev:i386 libx11-dev:i386 libudev-dev:i386 libc6:i386 g++-multilib gcc-multilib && sudo apt-get install -y g++-mingw-w64-x86-64 mingw-w64-x86-64-dev libz-mingw-w64-dev libnpth-mingw-w64-dev
- script:
name: gcc-version
code: gcc --version
name: toolchain info
code: gcc --version && x86_64-w64-mingw32-gcc --version
- script:
name: reicast x64 build
code: make -C shell/linux platform=x64
name: reicast Linux x64 build
code: make -C shell/linux -j `nproc` platform=x64
- script:
name: reicast Linux x86 build
code: make -C shell/linux -j `nproc` platform=x86
- script:
name: reicast Windows x64 (MinGW) build
code: make -C shell/linux -j `nproc` platform=win32 CC_PREFIX=x86_64-w64-mingw32-

0 comments on commit 9eec298

Please sign in to comment.