From 4eda5fb9240a1d1b0df904164c9fe5b6d55a9317 Mon Sep 17 00:00:00 2001 From: Gregory Hainaut Date: Tue, 2 Aug 2016 22:39:56 +0200 Subject: [PATCH] Revert "lilypad: use size_t instead of int for num* variable" This reverts commit 87d73684fa1428c3ccbc9d1ebc19b4831e02ef5b. Will do something that work ;) close #1498 --- plugins/LilyPad/InputManager.cpp | 36 ++++++++++++++++---------------- plugins/LilyPad/InputManager.h | 12 +++++------ plugins/LilyPad/LilyPad.cpp | 4 ++-- plugins/LilyPad/Linux/Config.cpp | 8 +++---- 4 files changed, 30 insertions(+), 30 deletions(-) diff --git a/plugins/LilyPad/InputManager.cpp b/plugins/LilyPad/InputManager.cpp index b6b5e7c31c..97976952d4 100644 --- a/plugins/LilyPad/InputManager.cpp +++ b/plugins/LilyPad/InputManager.cpp @@ -26,7 +26,7 @@ InputDeviceManager::InputDeviceManager() { } void InputDeviceManager::ClearDevices() { - for (size_t i=0; iaxes = (AxisEffectInfo*) realloc(b->axes, sizeof(AxisEffectInfo) * (numFFAxes)); memset(b->axes + (numFFAxes-1), 0, sizeof(AxisEffectInfo)); @@ -244,7 +244,7 @@ void Device::CalcVirtualState() { } VirtualControl *Device::GetVirtualControl(unsigned int uid) { - for (size_t i=0; imotor == motor) { SetEffect(binding, force); @@ -380,7 +380,7 @@ void InputDeviceManager::AddDevice(Device *d) { } void InputDeviceManager::Update(InitInfo *info) { - for (size_t i=0; ienabled) { if (!devices[i]->active) { if (!devices[i]->Activate(info) || !devices[i]->Update()) continue; @@ -394,14 +394,14 @@ void InputDeviceManager::Update(InitInfo *info) { } void InputDeviceManager::PostRead() { - for (size_t i=0; iactive) devices[i]->PostRead(); } } Device *InputDeviceManager::GetActiveDevice(InitInfo *info, unsigned int *uid, int *index, int *value) { - size_t i, j; + int i, j; Update(info); int bestDiff = FULLY_DOWN/2; Device *bestDevice = 0; @@ -461,13 +461,13 @@ Device *InputDeviceManager::GetActiveDevice(InitInfo *info, unsigned int *uid, i } void InputDeviceManager::ReleaseInput() { - for (size_t i=0; iactive) devices[i]->Deactivate(); } } void InputDeviceManager::EnableDevices(DeviceType type, DeviceAPI api) { - for (size_t i=0; iapi == api && devices[i]->type == type) { EnableDevice(i); } @@ -475,7 +475,7 @@ void InputDeviceManager::EnableDevices(DeviceType type, DeviceAPI api) { } void InputDeviceManager::DisableAllDevices() { - for (size_t i=0; ipads[port][slot].numFFBindings) { dev->pads[port][slot].ffBindings = (ForceFeedbackBinding*) malloc(old->pads[port][slot].numFFBindings * sizeof(ForceFeedbackBinding)); - for (size_t j=0; jpads[port][slot].numFFBindings; j++) { + for (int j=0; jpads[port][slot].numFFBindings; j++) { ForceFeedbackBinding *bo = old->pads[port][slot].ffBindings + j; ForceFeedbackBinding *bn = dev->pads[port][slot].ffBindings + dev->pads[port][slot].numFFBindings; ForceFeedbackEffectType *en = dev->GetForcefeedbackEffect(old->ffEffectTypes[bo->effectIndex].effectID); @@ -596,7 +596,7 @@ void InputDeviceManager::CopyBindings(size_t numOldDevices, Device **oldDevices) *bn = *bo; bn->effectIndex = en - dev->ffEffectTypes; bn->axes = (AxisEffectInfo*)calloc(dev->numFFAxes, sizeof(AxisEffectInfo)); - for (size_t k=0; knumFFAxes; k++) { + for (int k=0; knumFFAxes; k++) { ForceFeedbackAxis *newAxis = dev->GetForceFeedbackAxis(old->ffAxes[k].id); if (newAxis) { bn->axes[newAxis - dev->ffAxes] = bo->axes[k]; @@ -615,7 +615,7 @@ void InputDeviceManager::CopyBindings(size_t numOldDevices, Device **oldDevices) } void InputDeviceManager::SetEffect(unsigned char port, unsigned int slot, unsigned char motor, unsigned char force) { - for (size_t i=0; ienabled && dev->numFFEffectTypes) { dev->SetEffects(port, slot, motor, force); diff --git a/plugins/LilyPad/InputManager.h b/plugins/LilyPad/InputManager.h index c070805454..673c8203e8 100644 --- a/plugins/LilyPad/InputManager.h +++ b/plugins/LilyPad/InputManager.h @@ -188,7 +188,7 @@ struct PadBindings { Binding *bindings; int numBindings; ForceFeedbackBinding *ffBindings; - size_t numFFBindings; + int numFFBindings; }; class WndProcEater; @@ -254,7 +254,7 @@ public: // are allowed, but *only* for absolute axes (Which don't support the flip checkbox). // Each control on a device must have a unique id, used for binding. VirtualControl *virtualControls; - size_t numVirtualControls; + int numVirtualControls; int *virtualControlState; int *oldVirtualControlState; @@ -264,9 +264,9 @@ public: int *physicalControlState; ForceFeedbackEffectType *ffEffectTypes; - size_t numFFEffectTypes; + int numFFEffectTypes; ForceFeedbackAxis *ffAxes; - size_t numFFAxes; + int numFFAxes; void AddFFAxis(const wchar_t *displayName, int id); void AddFFEffectType(const wchar_t *displayName, const wchar_t *effectID, EffectType type); @@ -331,7 +331,7 @@ public: class InputDeviceManager { public: Device **devices; - size_t numDevices; + int numDevices; void ClearDevices(); @@ -342,7 +342,7 @@ public: // When old devices are missing, I do a slightly more careful search // using productIDs and then (in desperation) displayName. // Finally create new dummy devices if no matches found. - void CopyBindings(size_t numDevices, Device **devices); + void CopyBindings(int numDevices, Device **devices); InputDeviceManager(); diff --git a/plugins/LilyPad/LilyPad.cpp b/plugins/LilyPad/LilyPad.cpp index 2d6a8b56cf..a247152fbe 100644 --- a/plugins/LilyPad/LilyPad.cpp +++ b/plugins/LilyPad/LilyPad.cpp @@ -263,7 +263,7 @@ void UpdateEnabledDevices(int updateList = 0) { } } } - for (size_t i=0; inumDevices; i++) { + for (int i=0; inumDevices; i++) { Device *dev = dm->devices[i]; if (!dev->enabled) continue; @@ -490,7 +490,7 @@ void Update(unsigned int port, unsigned int slot) { LastCheck = t; - size_t i; + int i; ButtonSum s[2][4]; u8 lockStateChanged[2][4]; memset(lockStateChanged, 0, sizeof(lockStateChanged)); diff --git a/plugins/LilyPad/Linux/Config.cpp b/plugins/LilyPad/Linux/Config.cpp index ebc4193576..214bb54ea4 100644 --- a/plugins/LilyPad/Linux/Config.cpp +++ b/plugins/LilyPad/Linux/Config.cpp @@ -238,7 +238,7 @@ int SaveSettings(wchar_t *file=0) { if (!dm) return 0; - for (size_t i=0; inumDevices; i++) { + for (int i=0; inumDevices; i++) { wchar_t id[50]; wchar_t temp[50], temp2[1000]; wsprintfW(id, L"Device %i", i); @@ -270,12 +270,12 @@ int SaveSettings(wchar_t *file=0) { cfg.WriteStr(id, temp, temp2); } - for (size_t j=0; jpads[port][slot].numFFBindings; j++) { + for (int j=0; jpads[port][slot].numFFBindings; j++) { ForceFeedbackBinding *b = dev->pads[port][slot].ffBindings+j; ForceFeedbackEffectType *eff = &dev->ffEffectTypes[b->effectIndex]; wsprintfW(temp, L"FF Binding %i", ffBindingCount++); wsprintfW(temp2, L"%s %i, %i, %i", eff->effectID, port, b->motor, slot); - for (size_t k=0; knumFFAxes; k++) { + for (int k=0; knumFFAxes; k++) { ForceFeedbackAxis *axis = dev->ffAxes + k; AxisEffectInfo *info = b->axes + k; //wsprintfW(wcschr(temp2,0), L", %i, %i", axis->id, info->force); @@ -463,7 +463,7 @@ void RefreshEnabledDevices(int updateDeviceList) { lastXInputState = config.gameApis.xInput; } - for (size_t i=0; inumDevices; i++) { + for (int i=0; inumDevices; i++) { Device *dev = dm->devices[i]; // XXX windows magic?