summaryrefslogtreecommitdiff
path: root/platform
diff options
context:
space:
mode:
Diffstat (limited to 'platform')
-rw-r--r--platform/iphone/os_iphone.cpp2
-rw-r--r--platform/osx/joypad_osx.cpp17
-rw-r--r--platform/osx/joypad_osx.h3
-rw-r--r--platform/windows/joypad.cpp14
-rw-r--r--platform/windows/joypad.h1
-rw-r--r--platform/windows/os_windows.cpp17
-rw-r--r--platform/x11/godot_x11.cpp10
-rw-r--r--platform/x11/joypad_linux.cpp11
-rw-r--r--platform/x11/joypad_linux.h1
-rw-r--r--platform/x11/os_x11.cpp2
10 files changed, 24 insertions, 54 deletions
diff --git a/platform/iphone/os_iphone.cpp b/platform/iphone/os_iphone.cpp
index e34dbae017..816e456838 100644
--- a/platform/iphone/os_iphone.cpp
+++ b/platform/iphone/os_iphone.cpp
@@ -40,7 +40,7 @@
#include "core/os/dir_access.h"
#include "core/os/file_access.h"
#include "core/io/file_access_pack.h"
-#include "core/globals.h"
+#include "core/global_config.h"
#include "sem_iphone.h"
diff --git a/platform/osx/joypad_osx.cpp b/platform/osx/joypad_osx.cpp
index 5d25017aa6..98bcc8dc73 100644
--- a/platform/osx/joypad_osx.cpp
+++ b/platform/osx/joypad_osx.cpp
@@ -275,7 +275,6 @@ void JoypadOSX::_device_removed(int p_id) {
input->joy_connection_changed(p_id, false, "");
device_list[device].free();
device_list.remove(device);
- attached_devices[p_id] = false;
}
static String _hex_str(uint8_t p_byte) {
@@ -307,7 +306,7 @@ bool JoypadOSX::configure_joypad(IOHIDDeviceRef p_device_ref, joypad* p_joy) {
}
name = c_name;
- int id = get_free_joy_id();
+ int id = input->get_unused_joy_id();
ERR_FAIL_COND_V(id == -1, false);
p_joy->id = id;
int vendor = 0;
@@ -510,16 +509,6 @@ void JoypadOSX::joypad_vibration_stop(int p_id, uint64_t p_timestamp) {
FFEffectStop(joy->ff_object);
}
-int JoypadOSX::get_free_joy_id() {
- for (int i = 0; i < JOYPADS_MAX; i++) {
- if (!attached_devices[i]) {
- attached_devices[i] = true;
- return i;
- }
- }
- return -1;
-}
-
int JoypadOSX::get_joy_index(int p_id) const {
for (int i = 0; i < device_list.size(); i++) {
if (device_list[i].id == p_id) return i;
@@ -582,10 +571,6 @@ JoypadOSX::JoypadOSX()
self = this;
input = (InputDefault*)Input::get_singleton();
- for (int i = 0; i < JOYPADS_MAX; i++) {
- attached_devices[i] = false;
- }
-
int okay = 1;
const void *vals[] = {
(void *) create_match_dictionary(kHIDPage_GenericDesktop, kHIDUsage_GD_Joystick, &okay),
diff --git a/platform/osx/joypad_osx.h b/platform/osx/joypad_osx.h
index aafd82880d..71a0335316 100644
--- a/platform/osx/joypad_osx.h
+++ b/platform/osx/joypad_osx.h
@@ -95,14 +95,11 @@ private:
InputDefault *input;
IOHIDManagerRef hid_manager;
- bool attached_devices[JOYPADS_MAX];
Vector<joypad> device_list;
bool have_device(IOHIDDeviceRef p_device) const;
bool configure_joypad(IOHIDDeviceRef p_device_ref, joypad *p_joy);
-
- int get_free_joy_id();
int get_joy_index(int p_id) const;
void poll_joypads() const;
diff --git a/platform/windows/joypad.cpp b/platform/windows/joypad.cpp
index f2848268fc..4c1eeb425a 100644
--- a/platform/windows/joypad.cpp
+++ b/platform/windows/joypad.cpp
@@ -87,16 +87,6 @@ bool JoypadWindows::have_device(const GUID &p_guid) {
return false;
}
-int JoypadWindows::check_free_joy_slot() const {
-
- for (int i = 0; i < JOYPADS_MAX; i++) {
-
- if (!attached_joypads[i])
- return i;
- }
- return -1;
-}
-
// adapted from SDL2, works a lot better than the MSDN version
bool JoypadWindows::is_xinput_device(const GUID *p_guid) {
@@ -146,7 +136,7 @@ bool JoypadWindows::is_xinput_device(const GUID *p_guid) {
bool JoypadWindows::setup_dinput_joypad(const DIDEVICEINSTANCE* instance) {
HRESULT hr;
- int num = check_free_joy_slot();
+ int num = input->get_unused_joy_id();
if (have_device(instance->guidInstance) || num == -1)
return false;
@@ -296,7 +286,7 @@ void JoypadWindows::probe_joypads() {
dwResult = xinput_get_state(i, &x_joypads[i].state);
if ( dwResult == ERROR_SUCCESS) {
- int id = check_free_joy_slot();
+ int id = input->get_unused_joy_id();
if (id != -1 && !x_joypads[i].attached) {
x_joypads[i].attached = true;
diff --git a/platform/windows/joypad.h b/platform/windows/joypad.h
index 63eee8c015..d6670c90db 100644
--- a/platform/windows/joypad.h
+++ b/platform/windows/joypad.h
@@ -132,7 +132,6 @@ private:
void load_xinput();
void unload_xinput();
- int check_free_joy_slot() const;
unsigned int post_hat(unsigned int p_last_id, int p_device, DWORD p_dpad);
bool have_device(const GUID &p_guid);
diff --git a/platform/windows/os_windows.cpp b/platform/windows/os_windows.cpp
index 1afbfd5230..0ef964522b 100644
--- a/platform/windows/os_windows.cpp
+++ b/platform/windows/os_windows.cpp
@@ -1255,6 +1255,10 @@ void OS_Windows::finalize() {
main_loop=NULL;
+ for (int i = 0; i < get_audio_driver_count(); i++) {
+ AudioDriverManager::get_driver(i)->finish();
+ }
+
memdelete(joypad);
memdelete(input);
@@ -1282,13 +1286,8 @@ void OS_Windows::finalize() {
memdelete(physics_2d_server);
monitor_info.clear();
-
- for (int i = 0; i < get_audio_driver_count(); i++)
- {
- AudioDriverManager::get_driver(i)->finish();
- }
-
}
+
void OS_Windows::finalize_core() {
memdelete(process_map);
@@ -1969,10 +1968,10 @@ Error OS_Windows::execute(const String& p_path, const List<String>& p_arguments,
String argss;
argss="\"\""+p_path+"\"";
+
+ for (const List<String>::Element* E=p_arguments.front(); E; E=E->next()) {
- for(int i=0;i<p_arguments.size();i++) {
-
- argss+=String(" \"")+p_arguments[i]+"\"";
+ argss+=String(" \"")+E->get()+"\"";
}
//print_line("ARGS: "+argss);
diff --git a/platform/x11/godot_x11.cpp b/platform/x11/godot_x11.cpp
index f85ba17020..adb919c2f1 100644
--- a/platform/x11/godot_x11.cpp
+++ b/platform/x11/godot_x11.cpp
@@ -26,6 +26,10 @@
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/
+#include <unistd.h>
+#include <limits.h>
+#include <stdlib.h>
+
#include "main/main.h"
#include "os_x11.h"
@@ -33,6 +37,9 @@ int main(int argc, char* argv[]) {
OS_X11 os;
+ char *cwd = (char*)malloc(PATH_MAX);
+ getcwd(cwd, PATH_MAX);
+
Error err = Main::setup(argv[0],argc-1,&argv[1]);
if (err!=OK)
return 255;
@@ -41,5 +48,8 @@ int main(int argc, char* argv[]) {
os.run(); // it is actually the OS that decides how to run
Main::cleanup();
+ chdir(cwd);
+ free(cwd);
+
return os.get_exit_code();
}
diff --git a/platform/x11/joypad_linux.cpp b/platform/x11/joypad_linux.cpp
index 362999661e..bdbd2912a6 100644
--- a/platform/x11/joypad_linux.cpp
+++ b/platform/x11/joypad_linux.cpp
@@ -219,15 +219,6 @@ void JoypadLinux::monitor_joypads() {
}
}
-int JoypadLinux::get_free_joy_slot() const {
-
- for (int i = 0; i < JOYPADS_MAX; i++) {
-
- if (joypads[i].fd == -1) return i;
- }
- return -1;
-}
-
int JoypadLinux::get_joy_from_path(String p_path) const {
for (int i = 0; i < JOYPADS_MAX; i++) {
@@ -329,7 +320,7 @@ void JoypadLinux::setup_joypad_properties(int p_id) {
void JoypadLinux::open_joypad(const char *p_path) {
- int joy_num = get_free_joy_slot();
+ int joy_num = input->get_unused_joy_id();
int fd = open(p_path, O_RDWR | O_NONBLOCK);
if (fd != -1 && joy_num != -1) {
diff --git a/platform/x11/joypad_linux.h b/platform/x11/joypad_linux.h
index 18ad199f6b..310f5c1488 100644
--- a/platform/x11/joypad_linux.h
+++ b/platform/x11/joypad_linux.h
@@ -81,7 +81,6 @@ private:
static void joy_thread_func(void *p_user);
int get_joy_from_path(String path) const;
- int get_free_joy_slot() const;
void setup_joypad_properties(int p_id);
void close_joypad(int p_id = -1);
diff --git a/platform/x11/os_x11.cpp b/platform/x11/os_x11.cpp
index 27df280927..a4ed08f330 100644
--- a/platform/x11/os_x11.cpp
+++ b/platform/x11/os_x11.cpp
@@ -1241,7 +1241,7 @@ static Property read_property(Display* p_display, Window p_window, Atom p_proper
}while(bytes_after != 0);
- Property p = {ret, actual_format, nitems, actual_type};
+ Property p = {ret, actual_format, (int)nitems, actual_type};
return p;
}