mirror of
https://github.com/isledecomp/isle-portable.git
synced 2026-02-03 04:21:15 +00:00
🧑💻 chore: improve reusability
This commit is contained in:
parent
6770db9c8b
commit
2c313f3acc
@ -545,6 +545,11 @@ if (ISLE_BUILD_APP)
|
|||||||
ISLE/3ds/config.cpp
|
ISLE/3ds/config.cpp
|
||||||
)
|
)
|
||||||
endif()
|
endif()
|
||||||
|
if(WINDOWS_STORE)
|
||||||
|
target_sources(isle PRIVATE
|
||||||
|
ISLE/xbox_one_series/config.cpp
|
||||||
|
)
|
||||||
|
endif()
|
||||||
if(Python3_FOUND)
|
if(Python3_FOUND)
|
||||||
if(NOT DEFINED PYTHON_PIL_AVAILABLE)
|
if(NOT DEFINED PYTHON_PIL_AVAILABLE)
|
||||||
execute_process(
|
execute_process(
|
||||||
|
|||||||
8
ISLE/dummy_controller_map.h
Normal file
8
ISLE/dummy_controller_map.h
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
#pragma once
|
||||||
|
|
||||||
|
#define ISLE_BUTTON_SPACE 0
|
||||||
|
#define ISLE_BUTTON_ESCAPE 0
|
||||||
|
|
||||||
|
#define ISLE_MOUSE_JOYSTICK_X 0
|
||||||
|
#define ISLE_MOUSE_JOYSTICK_Y 0
|
||||||
|
#define ISLE_MOUSE_CLICK_AXIS 0
|
||||||
@ -36,7 +36,6 @@
|
|||||||
#include "roi/legoroi.h"
|
#include "roi/legoroi.h"
|
||||||
#include "tgl/d3drm/impl.h"
|
#include "tgl/d3drm/impl.h"
|
||||||
#include "viewmanager/viewmanager.h"
|
#include "viewmanager/viewmanager.h"
|
||||||
#include "xbox_buttons.h"
|
|
||||||
|
|
||||||
#include <miniwin/miniwindevice.h>
|
#include <miniwin/miniwindevice.h>
|
||||||
|
|
||||||
@ -54,6 +53,8 @@
|
|||||||
#include "emscripten/messagebox.h"
|
#include "emscripten/messagebox.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#include "dummy_controller_map.h"
|
||||||
|
|
||||||
#ifdef __3DS__
|
#ifdef __3DS__
|
||||||
#include "3ds/apthooks.h"
|
#include "3ds/apthooks.h"
|
||||||
#include "3ds/config.h"
|
#include "3ds/config.h"
|
||||||
@ -61,6 +62,7 @@
|
|||||||
|
|
||||||
#ifdef WINDOWS_STORE
|
#ifdef WINDOWS_STORE
|
||||||
#include "xbox_one_series/config.h"
|
#include "xbox_one_series/config.h"
|
||||||
|
#include "xbox_one_series/xbox_controller_map.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
DECOMP_SIZE_ASSERT(IsleApp, 0x8c)
|
DECOMP_SIZE_ASSERT(IsleApp, 0x8c)
|
||||||
@ -491,12 +493,12 @@ SDL_AppResult SDL_AppEvent(void* appstate, SDL_Event* event)
|
|||||||
}
|
}
|
||||||
case SDL_EVENT_JOYSTICK_BUTTON_DOWN: {
|
case SDL_EVENT_JOYSTICK_BUTTON_DOWN: {
|
||||||
{
|
{
|
||||||
if (event->gbutton.button == SDL_XBOX_BUTTON_A) {
|
if (event->gbutton.button == ISLE_BUTTON_SPACE) {
|
||||||
if (InputManager()) {
|
if (InputManager()) {
|
||||||
InputManager()->QueueEvent(c_notificationKeyPress, SDLK_SPACE, 0, 0, SDLK_SPACE);
|
InputManager()->QueueEvent(c_notificationKeyPress, SDLK_SPACE, 0, 0, SDLK_SPACE);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (event->gbutton.button == SDL_XBOX_BUTTON_START) {
|
if (event->gbutton.button == ISLE_BUTTON_ESCAPE) {
|
||||||
if (InputManager()) {
|
if (InputManager()) {
|
||||||
InputManager()->QueueEvent(c_notificationKeyPress, SDLK_ESCAPE, 0, 0, SDLK_ESCAPE);
|
InputManager()->QueueEvent(c_notificationKeyPress, SDLK_ESCAPE, 0, 0, SDLK_ESCAPE);
|
||||||
}
|
}
|
||||||
@ -505,14 +507,18 @@ SDL_AppResult SDL_AppEvent(void* appstate, SDL_Event* event)
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case SDL_EVENT_JOYSTICK_AXIS_MOTION: {
|
case SDL_EVENT_JOYSTICK_AXIS_MOTION: {
|
||||||
if (event->gaxis.axis == SDL_XBOX_AXIS_RIGHT_X) {
|
if (event->gaxis.axis == ISLE_MOUSE_JOYSTICK_X) {
|
||||||
g_lastJoystickMouseX = ((float) event->gaxis.value) / SDL_JOYSTICK_AXIS_MAX * g_isle->GetMouseSensitivity();
|
g_lastJoystickMouseX = ((float) event->gaxis.value) / SDL_JOYSTICK_AXIS_MAX * g_isle->GetMouseSensitivity();
|
||||||
}
|
}
|
||||||
else if (event->gaxis.axis == SDL_XBOX_AXIS_RIGHT_Y) {
|
else if (event->gaxis.axis == ISLE_MOUSE_JOYSTICK_Y) {
|
||||||
|
#ifdef WINDOWS_STORE
|
||||||
g_lastJoystickMouseY =
|
g_lastJoystickMouseY =
|
||||||
-((float) event->gaxis.value) / SDL_JOYSTICK_AXIS_MAX * g_isle->GetMouseSensitivity();
|
-((float) event->gaxis.value) / SDL_JOYSTICK_AXIS_MAX * g_isle->GetMouseSensitivity();
|
||||||
|
#else
|
||||||
|
g_lastJoystickMouseY = ((float) event->gaxis.value) / SDL_JOYSTICK_AXIS_MAX * g_isle->GetMouseSensitivity();
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
else if (event->gaxis.axis == SDL_XBOX_AXIS_RIGHT_TRIGGER) {
|
else if (event->gaxis.axis == ISLE_MOUSE_CLICK_AXIS) {
|
||||||
if (event->gaxis.value != SDL_JOYSTICK_AXIS_MIN) {
|
if (event->gaxis.value != SDL_JOYSTICK_AXIS_MIN) {
|
||||||
g_mousedown = TRUE;
|
g_mousedown = TRUE;
|
||||||
|
|
||||||
|
|||||||
@ -1,3 +1,5 @@
|
|||||||
|
#pragma once
|
||||||
|
|
||||||
#define SDL_XBOX_BUTTON_A 0
|
#define SDL_XBOX_BUTTON_A 0
|
||||||
#define SDL_XBOX_BUTTON_B 1
|
#define SDL_XBOX_BUTTON_B 1
|
||||||
#define SDL_XBOX_BUTTON_X 2
|
#define SDL_XBOX_BUTTON_X 2
|
||||||
@ -19,3 +21,10 @@
|
|||||||
#define SDL_XBOX_AXIS_RIGHT_X 3
|
#define SDL_XBOX_AXIS_RIGHT_X 3
|
||||||
#define SDL_XBOX_AXIS_LEFT_TRIGGER 4
|
#define SDL_XBOX_AXIS_LEFT_TRIGGER 4
|
||||||
#define SDL_XBOX_AXIS_RIGHT_TRIGGER 5
|
#define SDL_XBOX_AXIS_RIGHT_TRIGGER 5
|
||||||
|
|
||||||
|
#define ISLE_BUTTON_SPACE SDL_XBOX_BUTTON_A
|
||||||
|
#define ISLE_BUTTON_ESCAPE SDL_XBOX_BUTTON_START
|
||||||
|
|
||||||
|
#define ISLE_MOUSE_JOYSTICK_X SDL_XBOX_AXIS_RIGHT_X
|
||||||
|
#define ISLE_MOUSE_JOYSTICK_Y SDL_XBOX_AXIS_RIGHT_Y
|
||||||
|
#define ISLE_MOUSE_CLICK_AXIS SDL_XBOX_AXIS_RIGHT_TRIGGER
|
||||||
Loading…
Reference in New Issue
Block a user