ISO C90 fixes

This commit is contained in:
Ivan Epifanov
2020-12-18 14:28:09 +03:00
committed by Sam Lantinga
parent 0de7b0eca0
commit 7d89f09f74
11 changed files with 422 additions and 376 deletions

View File

@@ -81,6 +81,11 @@ VITA_GL_CreateContext(_THIS, SDL_Window * window)
EGLint num_configs;
int i;
const EGLint contextAttribs[] = {
EGL_CONTEXT_CLIENT_VERSION, 2,
EGL_NONE
};
EGLCHK(display = eglGetDisplay(0));
EGLCHK(eglInitialize(display, NULL, NULL));
@@ -122,10 +127,6 @@ VITA_GL_CreateContext(_THIS, SDL_Window * window)
return 0;
}
const EGLint contextAttribs[] = {
EGL_CONTEXT_CLIENT_VERSION, 2,
EGL_NONE
};
EGLCHK(surface = eglCreateWindowSurface(display, config, VITA_WINDOW_960X544, NULL));

View File

@@ -105,70 +105,72 @@ VITA_PollKeyboard(void)
}
}
Uint8 changed_modifiers = k_reports[numReports - 1].modifiers[0] ^ prev_modifiers;
{
Uint8 changed_modifiers = k_reports[numReports - 1].modifiers[0] ^ prev_modifiers;
if (changed_modifiers & 0x01) {
if (prev_modifiers & 0x01) {
SDL_SendKeyboardKey(SDL_RELEASED, SDL_SCANCODE_LCTRL);
if (changed_modifiers & 0x01) {
if (prev_modifiers & 0x01) {
SDL_SendKeyboardKey(SDL_RELEASED, SDL_SCANCODE_LCTRL);
}
else {
SDL_SendKeyboardKey(SDL_PRESSED, SDL_SCANCODE_LCTRL);
}
}
if (changed_modifiers & 0x02) {
if (prev_modifiers & 0x02) {
SDL_SendKeyboardKey(SDL_RELEASED, SDL_SCANCODE_LSHIFT);
}
else {
SDL_SendKeyboardKey(SDL_PRESSED, SDL_SCANCODE_LCTRL);
SDL_SendKeyboardKey(SDL_PRESSED, SDL_SCANCODE_LSHIFT);
}
}
if (changed_modifiers & 0x04) {
if (prev_modifiers & 0x04) {
SDL_SendKeyboardKey(SDL_RELEASED, SDL_SCANCODE_LALT);
}
else {
SDL_SendKeyboardKey(SDL_PRESSED, SDL_SCANCODE_LALT);
}
}
if (changed_modifiers & 0x08) {
if (prev_modifiers & 0x08) {
SDL_SendKeyboardKey(SDL_RELEASED, SDL_SCANCODE_LGUI);
}
else {
SDL_SendKeyboardKey(SDL_PRESSED, SDL_SCANCODE_LGUI);
}
}
if (changed_modifiers & 0x10) {
if (prev_modifiers & 0x10) {
SDL_SendKeyboardKey(SDL_RELEASED, SDL_SCANCODE_RCTRL);
}
else {
SDL_SendKeyboardKey(SDL_PRESSED, SDL_SCANCODE_RCTRL);
}
}
if (changed_modifiers & 0x02) {
if (prev_modifiers & 0x02) {
SDL_SendKeyboardKey(SDL_RELEASED, SDL_SCANCODE_LSHIFT);
if (changed_modifiers & 0x20) {
if (prev_modifiers & 0x20) {
SDL_SendKeyboardKey(SDL_RELEASED, SDL_SCANCODE_RSHIFT);
}
else {
SDL_SendKeyboardKey(SDL_PRESSED, SDL_SCANCODE_RSHIFT);
}
}
else {
SDL_SendKeyboardKey(SDL_PRESSED, SDL_SCANCODE_LSHIFT);
if (changed_modifiers & 0x40) {
if (prev_modifiers & 0x40) {
SDL_SendKeyboardKey(SDL_RELEASED, SDL_SCANCODE_RALT);
}
else {
SDL_SendKeyboardKey(SDL_PRESSED, SDL_SCANCODE_RALT);
}
}
}
if (changed_modifiers & 0x04) {
if (prev_modifiers & 0x04) {
SDL_SendKeyboardKey(SDL_RELEASED, SDL_SCANCODE_LALT);
}
else {
SDL_SendKeyboardKey(SDL_PRESSED, SDL_SCANCODE_LALT);
}
}
if (changed_modifiers & 0x08) {
if (prev_modifiers & 0x08) {
SDL_SendKeyboardKey(SDL_RELEASED, SDL_SCANCODE_LGUI);
}
else {
SDL_SendKeyboardKey(SDL_PRESSED, SDL_SCANCODE_LGUI);
}
}
if (changed_modifiers & 0x10) {
if (prev_modifiers & 0x10) {
SDL_SendKeyboardKey(SDL_RELEASED, SDL_SCANCODE_RCTRL);
}
else {
SDL_SendKeyboardKey(SDL_PRESSED, SDL_SCANCODE_RCTRL);
}
}
if (changed_modifiers & 0x20) {
if (prev_modifiers & 0x20) {
SDL_SendKeyboardKey(SDL_RELEASED, SDL_SCANCODE_RSHIFT);
}
else {
SDL_SendKeyboardKey(SDL_PRESSED, SDL_SCANCODE_RSHIFT);
}
}
if (changed_modifiers & 0x40) {
if (prev_modifiers & 0x40) {
SDL_SendKeyboardKey(SDL_RELEASED, SDL_SCANCODE_RALT);
}
else {
SDL_SendKeyboardKey(SDL_PRESSED, SDL_SCANCODE_RALT);
}
}
if (changed_modifiers & 0x80) {
if (prev_modifiers & 0x80) {
SDL_SendKeyboardKey(SDL_RELEASED, SDL_SCANCODE_RGUI);
}
else {
SDL_SendKeyboardKey(SDL_PRESSED, SDL_SCANCODE_RGUI);
if (changed_modifiers & 0x80) {
if (prev_modifiers & 0x80) {
SDL_SendKeyboardKey(SDL_RELEASED, SDL_SCANCODE_RGUI);
}
else {
SDL_SendKeyboardKey(SDL_PRESSED, SDL_SCANCODE_RGUI);
}
}
}

View File

@@ -77,13 +77,13 @@ VITA_QuitTouch(void){
void
VITA_PollTouch(void)
{
SDL_FingerID finger_id = 0;
int port;
// We skip polling touch if no window is created
if (Vita_Window == NULL)
return;
SDL_FingerID finger_id = 0;
int port;
memcpy(touch_old, touch, sizeof(touch_old));
for(port = 0; port < SCE_TOUCH_PORT_MAX_NUM; port++) {
@@ -97,8 +97,8 @@ VITA_PollTouch(void)
// for the back panel, the active touch area is used as reference
float x = 0;
float y = 0;
VITA_ConvertTouchXYToSDLXY(&x, &y, touch[port].report[i].x, touch[port].report[i].y, port);
float force = (touch[port].report[i].force - force_info[port].min) / force_info[port].range;
VITA_ConvertTouchXYToSDLXY(&x, &y, touch[port].report[i].x, touch[port].report[i].y, port);
finger_id = (SDL_FingerID) touch[port].report[i].id;
// Send an initial touch
@@ -134,8 +134,8 @@ VITA_PollTouch(void)
if (finger_up == 1) {
float x = 0;
float y = 0;
VITA_ConvertTouchXYToSDLXY(&x, &y, touch_old[port].report[i].x, touch_old[port].report[i].y, port);
float force = (touch_old[port].report[i].force - force_info[port].min) / force_info[port].range;
VITA_ConvertTouchXYToSDLXY(&x, &y, touch_old[port].report[i].x, touch_old[port].report[i].y, port);
finger_id = (SDL_FingerID) touch_old[port].report[i].id;
// Finger released from screen
SDL_SendTouch((SDL_TouchID)port,

View File

@@ -327,6 +327,7 @@ void VITA_ShowScreenKeyboard(_THIS, SDL_Window *window)
wchar_t *title = L"";
wchar_t *text = L"";
SceInt32 res;
SceImeDialogParam param;
sceImeDialogParamInit(&param);
@@ -342,7 +343,7 @@ void VITA_ShowScreenKeyboard(_THIS, SDL_Window *window)
param.initialText = text;
param.inputTextBuffer = videodata->ime_buffer;
SceInt32 res = sceImeDialogInit(&param);
res = sceImeDialogInit(&param);
if (res < 0) {
SDL_SetError("Failed to init IME dialog");
return;
@@ -413,14 +414,15 @@ void VITA_PumpEvents(_THIS)
// update IME status. Terminate, if finished
SceCommonDialogStatus dialogStatus = sceImeDialogGetStatus();
if (dialogStatus == SCE_COMMON_DIALOG_STATUS_FINISHED) {
uint8_t utf8_buffer[SCE_IME_DIALOG_MAX_TEXT_LENGTH];
SceImeDialogResult result;
SDL_memset(&result, 0, sizeof(SceImeDialogResult));
sceImeDialogGetResult(&result);
// Convert UTF16 to UTF8
uint8_t utf8_buffer[SCE_IME_DIALOG_MAX_TEXT_LENGTH];
utf16_to_utf8(videodata->ime_buffer, utf8_buffer);
// send sdl event
SDL_SendKeyboardText((const char*)utf8_buffer);