mirror of https://github.com/ClassiCube/ClassiCube
Wii/Gamecube now show dialogs
This commit is contained in:
parent
45ec826517
commit
b40eb663a7
|
|
@ -110,6 +110,8 @@ static const BindMapping pad_defaults[BIND_COUNT] = {
|
|||
[BIND_HOTBAR_RIGHT] = { CCPAD_4, CCPAD_RIGHT }
|
||||
};
|
||||
|
||||
void Gamepads_PreInit(void) { }
|
||||
|
||||
void Gamepads_Init(void) {
|
||||
Input.Sources |= INPUT_SOURCE_GAMEPAD;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -153,10 +153,12 @@ static const BindMapping defaults_3ds[BIND_COUNT] = {
|
|||
};
|
||||
|
||||
static Result irrst_result;
|
||||
void Gamepads_PreInit(void) {
|
||||
irrst_result = irrstInit();
|
||||
}
|
||||
|
||||
void Gamepads_Init(void) {
|
||||
Input.Sources = INPUT_SOURCE_GAMEPAD;
|
||||
irrst_result = irrstInit();
|
||||
}
|
||||
|
||||
static void HandleButtons(int port, u32 mods) {
|
||||
|
|
|
|||
|
|
@ -116,9 +116,9 @@ void Window_ProcessEvents(float delta) {
|
|||
dispatcher.ProcessEvents(CoreProcessEventsOption::ProcessAllIfPresent);
|
||||
}
|
||||
|
||||
void Gamepads_Init(void) {
|
||||
void Gamepads_PreInit(void) { }
|
||||
|
||||
}
|
||||
void Gamepads_Init(void) { }
|
||||
|
||||
void Gamepads_Process(float delta) { }
|
||||
|
||||
|
|
|
|||
|
|
@ -11,12 +11,12 @@ static cc_bool dlg_close;
|
|||
static cc_bool VirtualDialog_InputHook(int key, struct InputDevice* device) { return true; }
|
||||
|
||||
static void VirtualDialog_OnInputDown(void* obj, int key, cc_bool was, struct InputDevice* device) {
|
||||
Platform_LogConst("AAAA");
|
||||
dlg_close = true;
|
||||
}
|
||||
|
||||
struct LogPosition { struct Bitmap* bmp; int x, y; };
|
||||
#define BEG_X 10
|
||||
#define VD_BEG_X 10
|
||||
#define VD_LINE_SPACE 20
|
||||
|
||||
static void PlotOnscreen(int x, int y, void* ctx) {
|
||||
struct LogPosition* pos = ctx;
|
||||
|
|
@ -31,30 +31,33 @@ static void PlotOnscreen(int x, int y, void* ctx) {
|
|||
static int DrawText(const char* msg, struct Bitmap* bmp, int y) {
|
||||
struct LogPosition pos;
|
||||
pos.bmp = bmp;
|
||||
pos.x = BEG_X;
|
||||
pos.x = VD_BEG_X;
|
||||
pos.y = y;
|
||||
|
||||
while (*msg)
|
||||
{
|
||||
if (pos.x + 20 >= bmp->width) {
|
||||
pos.x = BEG_X;
|
||||
pos.y += 20;
|
||||
char c = *msg;
|
||||
if (pos.x + 20 >= bmp->width || c == '\n') {
|
||||
pos.x = VD_BEG_X;
|
||||
pos.y += VD_LINE_SPACE;
|
||||
}
|
||||
|
||||
pos.x += FallbackFont_Plot((cc_uint8)*msg, PlotOnscreen, 1, &pos);
|
||||
if (c != '\n') { pos.x += FallbackFont_Plot((cc_uint8)c, PlotOnscreen, 1, &pos); }
|
||||
msg++;
|
||||
}
|
||||
return pos.y;
|
||||
}
|
||||
|
||||
#define DLG_TICK_INTERVAL 50
|
||||
#define VD_TICK_INTERVAL 50
|
||||
#define VD_MAX_ITERS (5000 / VD_TICK_INTERVAL)
|
||||
|
||||
static void VirtualDialog_Show(const char* title, const char* msg) {
|
||||
struct Bitmap bmp;
|
||||
Platform_LogConst(title);
|
||||
Platform_LogConst(msg);
|
||||
|
||||
if (!LBackend_FB.bmp.scan0) {
|
||||
Window_AllocFramebuffer(&bmp, Window_Main.Width, Window_Main.Height);
|
||||
Window_AllocFramebuffer(&bmp, DisplayInfo.Width, DisplayInfo.Height);
|
||||
} else {
|
||||
bmp = LBackend_FB.bmp;
|
||||
}
|
||||
|
|
@ -64,9 +67,9 @@ static void VirtualDialog_Show(const char* title, const char* msg) {
|
|||
Context2D_Clear(&ctx, BitmapCol_Make(50, 50, 50, 255),
|
||||
0, 0, bmp.width, bmp.height);
|
||||
|
||||
const char* ipt_msg = "Press any button to continue";
|
||||
const char* ipt_msg = "Press any button to continue (or wait 5 seconds)";
|
||||
dlg_close = false;
|
||||
int y = 30;
|
||||
int y = max(30, bmp.height / 2 - 50);
|
||||
|
||||
y = DrawText(title, &bmp, y);
|
||||
y = DrawText(msg, &bmp, y + 20);
|
||||
|
|
@ -77,14 +80,18 @@ static void VirtualDialog_Show(const char* title, const char* msg) {
|
|||
Event_Register_(&InputEvents.Down2, NULL, VirtualDialog_OnInputDown);
|
||||
|
||||
Rect2D rect = { 0, 0, bmp.width, bmp.height };
|
||||
cc_bool has_window = Window_Main.Exists;
|
||||
|
||||
while (Window_Main.Exists && !dlg_close)
|
||||
for (int i = 0; !dlg_close && i < VD_MAX_ITERS; i++)
|
||||
{
|
||||
Window_ProcessEvents(1.0f / DLG_TICK_INTERVAL);
|
||||
Gamepads_Process( 1.0f / DLG_TICK_INTERVAL);
|
||||
Window_ProcessEvents(1.0f / VD_TICK_INTERVAL);
|
||||
Gamepads_Process( 1.0f / VD_TICK_INTERVAL);
|
||||
|
||||
Window_DrawFramebuffer(rect, &bmp);
|
||||
Thread_Sleep(DLG_TICK_INTERVAL);
|
||||
Thread_Sleep(VD_TICK_INTERVAL);
|
||||
|
||||
// Window_ProcessEvents processed an app exit event
|
||||
if (has_window && !Window_Main.Exists) break;
|
||||
}
|
||||
|
||||
Context2D_Clear(&ctx, BitmapCol_Make(40, 40, 40, 255),
|
||||
|
|
|
|||
|
|
@ -139,6 +139,8 @@ void Window_RequestClose(void);
|
|||
/* Processes all pending window messages/events. */
|
||||
void Window_ProcessEvents(float delta);
|
||||
|
||||
/* Initialises necessary state before initing platform and loading options */
|
||||
void Gamepads_PreInit(void);
|
||||
/* Initialises state for gamepad/joystick input. */
|
||||
void Gamepads_Init(void);
|
||||
/* Processes all pending gamepad/joystick input. */
|
||||
|
|
|
|||
|
|
@ -549,9 +549,9 @@ void Window_ProcessEvents(float delta) {
|
|||
}
|
||||
}
|
||||
|
||||
void Gamepads_Init(void) {
|
||||
void Gamepads_PreInit(void) { }
|
||||
|
||||
}
|
||||
void Gamepads_Init(void) { }
|
||||
|
||||
void Gamepads_Process(float delta) { }
|
||||
|
||||
|
|
|
|||
|
|
@ -386,9 +386,9 @@ void Window_ProcessEvents(float delta) {
|
|||
}
|
||||
}
|
||||
|
||||
void Gamepads_Init(void) {
|
||||
void Gamepads_PreInit(void) { }
|
||||
|
||||
}
|
||||
void Gamepads_Init(void) { }
|
||||
|
||||
void Gamepads_Process(float delta) { }
|
||||
|
||||
|
|
|
|||
|
|
@ -120,9 +120,12 @@ static const BindMapping defaults_n64[BIND_COUNT] = {
|
|||
[BIND_SET_SPAWN] = { CCPAD_START },
|
||||
};
|
||||
|
||||
void Gamepads_PreInit(void) {
|
||||
joypad_init();
|
||||
}
|
||||
|
||||
void Gamepads_Init(void) {
|
||||
Input.Sources |= INPUT_SOURCE_GAMEPAD;
|
||||
joypad_init();
|
||||
}
|
||||
|
||||
static void HandleButtons(int port, joypad_buttons_t btns) {
|
||||
|
|
|
|||
|
|
@ -604,6 +604,8 @@ void Window_DisableRawMouse(void) {
|
|||
DefaultDisableRawMouse();
|
||||
}
|
||||
|
||||
void Gamepads_PreInit(void) { }
|
||||
|
||||
void Gamepads_Init(void) { }
|
||||
|
||||
void Gamepads_Process(float delta) { }
|
||||
|
|
|
|||
|
|
@ -473,7 +473,9 @@ void Window_DisableRawMouse(void) {
|
|||
#include "ExtMath.h"
|
||||
static SDL_GameController* controllers[INPUT_MAX_GAMEPADS];
|
||||
|
||||
static void LoadControllers(void) {
|
||||
void Gamepads_PreInit(void) { }
|
||||
|
||||
void Gamepads_Init(void) {
|
||||
for (int i = 0, port = 0; i < SDL_NumJoysticks() && port < INPUT_MAX_GAMEPADS; i++)
|
||||
{
|
||||
if (!SDL_IsGameController(i)) continue;
|
||||
|
|
@ -484,10 +486,6 @@ static void LoadControllers(void) {
|
|||
}
|
||||
}
|
||||
|
||||
void Gamepads_Init(void) {
|
||||
LoadControllers();
|
||||
}
|
||||
|
||||
static void ProcessGamepadButtons(int port, SDL_GameController* gp) {
|
||||
Gamepad_SetButton(port, CCPAD_1, SDL_GameControllerGetButton(gp, SDL_CONTROLLER_BUTTON_A));
|
||||
Gamepad_SetButton(port, CCPAD_2, SDL_GameControllerGetButton(gp, SDL_CONTROLLER_BUTTON_B));
|
||||
|
|
|
|||
|
|
@ -502,7 +502,9 @@ void Window_DisableRawMouse(void) {
|
|||
#include "ExtMath.h"
|
||||
static SDL_Gamepad* controllers[INPUT_MAX_GAMEPADS];
|
||||
|
||||
static void LoadControllers(void) {
|
||||
void Gamepads_PreInit(void) { }
|
||||
|
||||
void Gamepads_Init(void) {
|
||||
int count = 0;
|
||||
SDL_JoystickID* joysticks = SDL_GetGamepads(&count);
|
||||
|
||||
|
|
@ -514,10 +516,6 @@ static void LoadControllers(void) {
|
|||
SDL_free(joysticks);
|
||||
}
|
||||
|
||||
void Gamepads_Init(void) {
|
||||
LoadControllers();
|
||||
}
|
||||
|
||||
static void ProcessGamepadButtons(int port, SDL_Gamepad* gp) {
|
||||
Gamepad_SetButton(port, CCPAD_1, SDL_GetGamepadButton(gp, SDL_GAMEPAD_BUTTON_SOUTH));
|
||||
Gamepad_SetButton(port, CCPAD_2, SDL_GetGamepadButton(gp, SDL_GAMEPAD_BUTTON_EAST));
|
||||
|
|
|
|||
|
|
@ -490,9 +490,9 @@ void Window_ProcessEvents(float delta) {
|
|||
ProcessConsoleEvents(delta);
|
||||
}
|
||||
|
||||
void Gamepads_Init(void) {
|
||||
void Gamepads_PreInit(void) { }
|
||||
|
||||
}
|
||||
void Gamepads_Init(void) { }
|
||||
|
||||
void Gamepads_Process(float delta) { }
|
||||
|
||||
|
|
|
|||
|
|
@ -602,9 +602,9 @@ void Window_ProcessEvents(float delta) {
|
|||
}
|
||||
}
|
||||
|
||||
void Gamepads_Init(void) {
|
||||
void Gamepads_PreInit(void) { }
|
||||
|
||||
}
|
||||
void Gamepads_Init(void) { }
|
||||
|
||||
void Gamepads_Process(float delta) { }
|
||||
|
||||
|
|
|
|||
|
|
@ -550,9 +550,9 @@ void Window_ProcessEvents(float delta) {
|
|||
}
|
||||
}
|
||||
|
||||
void Gamepads_Init(void) {
|
||||
void Gamepads_PreInit(void) { }
|
||||
|
||||
}
|
||||
void Gamepads_Init(void) { }
|
||||
|
||||
void Gamepads_Process(float delta) { }
|
||||
|
||||
|
|
|
|||
|
|
@ -851,9 +851,9 @@ void Window_ProcessEvents(float delta) {
|
|||
}
|
||||
}
|
||||
|
||||
void Gamepads_Init(void) {
|
||||
void Gamepads_PreInit(void) { }
|
||||
|
||||
}
|
||||
void Gamepads_Init(void) { }
|
||||
|
||||
void Gamepads_Process(float delta) { }
|
||||
|
||||
|
|
|
|||
|
|
@ -606,9 +606,9 @@ void Window_ProcessEvents(float delta) {
|
|||
}
|
||||
}
|
||||
|
||||
void Gamepads_Init(void) {
|
||||
void Gamepads_PreInit(void) { }
|
||||
|
||||
}
|
||||
void Gamepads_Init(void) { }
|
||||
|
||||
void Gamepads_Process(float delta) { }
|
||||
|
||||
|
|
|
|||
|
|
@ -333,9 +333,9 @@ void Window_ProcessEvents(float delta) {
|
|||
} while (res == kCFRunLoopRunHandledSource);
|
||||
}
|
||||
|
||||
void Gamepads_Init(void) {
|
||||
void Gamepads_PreInit(void) { }
|
||||
|
||||
}
|
||||
void Gamepads_Init(void) { }
|
||||
|
||||
void Gamepads_Process(float delta) { }
|
||||
|
||||
|
|
|
|||
|
|
@ -83,9 +83,10 @@ void Window_RequestClose(void) {
|
|||
|
||||
void Window_ProcessEvents(float delta) {
|
||||
}
|
||||
void Gamepads_Init(void) {
|
||||
|
||||
}
|
||||
void Gamepads_PreInit(void) { }
|
||||
|
||||
void Gamepads_Init(void) { }
|
||||
|
||||
void Gamepads_Process(float delta) { }
|
||||
|
||||
|
|
|
|||
|
|
@ -361,9 +361,9 @@ void Window_ProcessEvents(float delta) {
|
|||
Java_ICall_Void(env, JAVA_processEvents, NULL);
|
||||
}
|
||||
|
||||
void Gamepads_Init(void) {
|
||||
void Gamepads_PreInit(void) { }
|
||||
|
||||
}
|
||||
void Gamepads_Init(void) { }
|
||||
|
||||
void Gamepads_Process(float delta) { }
|
||||
|
||||
|
|
|
|||
|
|
@ -94,7 +94,9 @@ void Window_UpdateRawMouse(void) { }
|
|||
|
||||
/*########################################################################################################################*
|
||||
*-------------------------------------------------------Gamepads----------------------------------------------------------*
|
||||
*#########################################################################################################################*/
|
||||
*#########################################################################################################################*/
|
||||
void Gamepads_PreInit(void) { }
|
||||
|
||||
void Gamepads_Init(void) { }
|
||||
|
||||
void Gamepads_Process(float delta) { }
|
||||
|
|
|
|||
|
|
@ -245,6 +245,8 @@ static const BindMapping defaults_dc[BIND_COUNT] = {
|
|||
[BIND_SCREENSHOT] = { CCPAD_3 },
|
||||
};
|
||||
|
||||
void Gamepads_PreInit(void) { }
|
||||
|
||||
void Gamepads_Init(void) {
|
||||
Input.Sources |= INPUT_SOURCE_GAMEPAD;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -102,6 +102,8 @@ static const BindMapping pad_defaults[BIND_COUNT] = {
|
|||
[BIND_HOTBAR_RIGHT] = { CCPAD_L, CCPAD_RIGHT }
|
||||
};
|
||||
|
||||
void Gamepads_PreInit(void) { }
|
||||
|
||||
void Gamepads_Init(void) {
|
||||
Input.Sources |= INPUT_SOURCE_GAMEPAD;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -101,7 +101,7 @@ static void InitSockets(void) {
|
|||
if (ret >= 0) {
|
||||
Platform_Log3("Network ip: %c, gw: %c, mask %c", localip, gateway, netmask);
|
||||
} else {
|
||||
Platform_Log1("Network setup failed: %i", &ret);
|
||||
Logger_SimpleWarn(ret, "setting up network");
|
||||
net_supported = false;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -97,7 +97,7 @@ cc_result Socket_GetLastError(cc_socket s) {
|
|||
|
||||
static void InitSockets(void) {
|
||||
int ret = net_init();
|
||||
Platform_Log1("Network setup result: %i", &ret);
|
||||
if (ret) Logger_SimpleWarn(ret, "setting up network");
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -11,6 +11,7 @@
|
|||
#include "../Graphics.h"
|
||||
#include "../Options.h"
|
||||
#include "../VirtualKeyboard.h"
|
||||
#include "../VirtualDialog.h"
|
||||
|
||||
#include <gccore.h>
|
||||
#if defined HW_RVL
|
||||
|
|
@ -62,16 +63,16 @@ void Window_PreInit(void) {
|
|||
SYS_SetPowerCallback(OnPowerOff);
|
||||
#endif
|
||||
InitVideo();
|
||||
}
|
||||
|
||||
void Window_Init(void) {
|
||||
DisplayInfo.Width = cur_mode->fbWidth;
|
||||
DisplayInfo.Height = cur_mode->xfbHeight;
|
||||
DisplayInfo.ScaleX = 1;
|
||||
DisplayInfo.ScaleY = 1;
|
||||
|
||||
Window_Main.Width = cur_mode->fbWidth;
|
||||
Window_Main.Height = cur_mode->xfbHeight;
|
||||
}
|
||||
|
||||
void Window_Init(void) {
|
||||
Window_Main.Width = DisplayInfo.Width;
|
||||
Window_Main.Height = DisplayInfo.Height;
|
||||
Window_Main.Focused = true;
|
||||
|
||||
Window_Main.Exists = true;
|
||||
|
|
@ -91,7 +92,6 @@ void Window_Init(void) {
|
|||
void Window_Free(void) { }
|
||||
|
||||
void Window_Create2D(int width, int height) {
|
||||
needsFBUpdate = true;
|
||||
Window_Main.Is3D = false;
|
||||
}
|
||||
|
||||
|
|
@ -358,9 +358,7 @@ void Window_DisableRawMouse(void) { Input.RawMode = false; }
|
|||
/*########################################################################################################################*
|
||||
*-------------------------------------------------------Gamepads----------------------------------------------------------*
|
||||
*#########################################################################################################################*/
|
||||
void Gamepads_Init(void) {
|
||||
Input.Sources |= INPUT_SOURCE_GAMEPAD;
|
||||
|
||||
void Gamepads_PreInit(void) {
|
||||
#if defined HW_RVL
|
||||
WPAD_Init();
|
||||
for (int i = 0; i < 4; i++)
|
||||
|
|
@ -369,6 +367,10 @@ void Gamepads_Init(void) {
|
|||
PAD_Init();
|
||||
}
|
||||
|
||||
void Gamepads_Init(void) {
|
||||
Input.Sources |= INPUT_SOURCE_GAMEPAD;
|
||||
}
|
||||
|
||||
#if defined HW_RVL
|
||||
static const BindMapping default_nunchuck[BIND_COUNT] = {
|
||||
[BIND_FORWARD] = { CCPAD_CUP, 0 },
|
||||
|
|
@ -522,6 +524,8 @@ void Window_AllocFramebuffer(struct Bitmap* bmp, int width, int height) {
|
|||
bmp->scan0 = (BitmapCol*)Mem_Alloc(width * height, BITMAPCOLOR_SIZE, "window pixels");
|
||||
bmp->width = width;
|
||||
bmp->height = height;
|
||||
|
||||
needsFBUpdate = true;
|
||||
}
|
||||
|
||||
// TODO: Get rid of this complexity and use the 3D API instead..
|
||||
|
|
@ -608,11 +612,8 @@ int Window_IsObscured(void) { return 0; }
|
|||
void Window_Show(void) { }
|
||||
void Window_SetSize(int width, int height) { }
|
||||
|
||||
|
||||
void Window_ShowDialog(const char* title, const char* msg) {
|
||||
/* TODO implement */
|
||||
Platform_LogConst(title);
|
||||
Platform_LogConst(msg);
|
||||
VirtualDialog_Show(title, msg);
|
||||
}
|
||||
|
||||
cc_result Window_OpenFileDialog(const struct OpenFileDialogArgs* args) {
|
||||
|
|
|
|||
|
|
@ -126,6 +126,7 @@ static void SetupProgram(int argc, char** argv) {
|
|||
CrashHandler_Install();
|
||||
Logger_Hook();
|
||||
Window_PreInit();
|
||||
Gamepads_PreInit();
|
||||
Platform_Init();
|
||||
|
||||
res = Platform_SetDefaultCurrentDirectory(argc, argv);
|
||||
|
|
|
|||
|
|
@ -255,9 +255,9 @@ void Window_ProcessEvents(float delta) {
|
|||
Keyboard_UpdateState(delta);
|
||||
}
|
||||
|
||||
void Gamepads_Init(void) {
|
||||
void Gamepads_PreInit(void) { }
|
||||
|
||||
}
|
||||
void Gamepads_Init(void) { }
|
||||
|
||||
void Gamepads_Process(float delta) { }
|
||||
|
||||
|
|
|
|||
|
|
@ -170,14 +170,14 @@ void Window_PreInit(void) {
|
|||
Window_Main.Is3D = 210; // So SetupVideo still runs
|
||||
SetupVideo(false);
|
||||
setBrightness(2, 0);
|
||||
}
|
||||
|
||||
void Window_Init(void) {
|
||||
DisplayInfo.Width = SCREEN_WIDTH;
|
||||
DisplayInfo.Height = SCREEN_HEIGHT;
|
||||
DisplayInfo.ScaleX = 0.5f;
|
||||
DisplayInfo.ScaleY = 0.5f;
|
||||
|
||||
}
|
||||
|
||||
void Window_Init(void) {
|
||||
Window_Main.Width = DisplayInfo.Width;
|
||||
Window_Main.Height = DisplayInfo.Height;
|
||||
Window_Main.Focused = true;
|
||||
|
|
@ -274,6 +274,8 @@ static const BindMapping defaults_nds[BIND_COUNT] = {
|
|||
[BIND_HOTBAR_LEFT] = { CCPAD_2, CCPAD_LEFT },
|
||||
[BIND_HOTBAR_RIGHT] = { CCPAD_2, CCPAD_RIGHT }
|
||||
};
|
||||
|
||||
void Gamepads_PreInit(void) { }
|
||||
|
||||
void Gamepads_Init(void) {
|
||||
Input.Sources |= INPUT_SOURCE_GAMEPAD;
|
||||
|
|
|
|||
|
|
@ -162,15 +162,17 @@ static const BindMapping pad_defaults[BIND_COUNT] = {
|
|||
|
||||
static char pad_buff[2][34];
|
||||
|
||||
void Gamepads_Init(void) {
|
||||
Input.Sources |= INPUT_SOURCE_GAMEPAD;
|
||||
|
||||
void Gamepads_PreInit(void) {
|
||||
// http://lameguy64.net/tutorials/pstutorials/chapter1/4-controllers.html
|
||||
InitPAD(&pad_buff[0][0], 34, &pad_buff[1][0], 34);
|
||||
pad_buff[0][0] = pad_buff[0][1] = 0xff;
|
||||
pad_buff[1][0] = pad_buff[1][1] = 0xff;
|
||||
StartPAD();
|
||||
ChangeClearPAD(0);
|
||||
}
|
||||
|
||||
void Gamepads_Init(void) {
|
||||
Input.Sources |= INPUT_SOURCE_GAMEPAD;
|
||||
|
||||
Input_DisplayNames[CCPAD_1] = "CIRCLE";
|
||||
Input_DisplayNames[CCPAD_2] = "CROSS";
|
||||
|
|
|
|||
|
|
@ -252,12 +252,14 @@ static const BindMapping defaults_ps2[BIND_COUNT] = {
|
|||
static char padBuf0[256] __attribute__((aligned(64)));
|
||||
static char padBuf1[256] __attribute__((aligned(64)));
|
||||
|
||||
void Gamepads_Init(void) {
|
||||
Input.Sources |= INPUT_SOURCE_GAMEPAD;
|
||||
|
||||
void Gamepads_PreInit(void) {
|
||||
padInit(0);
|
||||
padPortOpen(0, 0, padBuf0);
|
||||
padPortOpen(1, 0, padBuf1);
|
||||
}
|
||||
|
||||
void Gamepads_Init(void) {
|
||||
Input.Sources |= INPUT_SOURCE_GAMEPAD;
|
||||
|
||||
Input_DisplayNames[CCPAD_1] = "CIRCLE";
|
||||
Input_DisplayNames[CCPAD_2] = "CROSS";
|
||||
|
|
|
|||
|
|
@ -296,9 +296,12 @@ static padInfo pad_info;
|
|||
static padData pad_data[MAX_PORT_NUM];
|
||||
static cc_bool circle_main;
|
||||
|
||||
void Gamepads_PreInit(void) {
|
||||
ioPadInit(MAX_PORT_NUM);
|
||||
}
|
||||
|
||||
void Gamepads_Init(void) {
|
||||
Input.Sources |= INPUT_SOURCE_GAMEPAD;
|
||||
ioPadInit(MAX_PORT_NUM);
|
||||
|
||||
int ret = 0;
|
||||
sysUtilGetSystemParamInt(SYSUTIL_SYSTEMPARAM_ID_ENTER_BUTTON_ASSIGN, &ret);
|
||||
|
|
|
|||
|
|
@ -88,6 +88,8 @@ void Window_DisableRawMouse(void) { Input.RawMode = false; }
|
|||
/*########################################################################################################################*
|
||||
*-------------------------------------------------------Gamepads----------------------------------------------------------*
|
||||
*#########################################################################################################################*/
|
||||
void Gamepads_PreInit(void) { }
|
||||
|
||||
void Gamepads_Init(void) {
|
||||
Input.Sources |= INPUT_SOURCE_GAMEPAD;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -103,11 +103,13 @@ static const BindMapping defaults_psp[BIND_COUNT] = {
|
|||
[BIND_HOTBAR_RIGHT] = { CCPAD_ZR }
|
||||
};
|
||||
|
||||
void Gamepads_Init(void) {
|
||||
Input.Sources |= INPUT_SOURCE_GAMEPAD;
|
||||
|
||||
void Gamepads_PreInit(void) {
|
||||
sceCtrlSetSamplingCycle(0);
|
||||
sceCtrlSetSamplingMode(PSP_CTRL_MODE_ANALOG);
|
||||
}
|
||||
|
||||
void Gamepads_Init(void) {
|
||||
Input.Sources |= INPUT_SOURCE_GAMEPAD;
|
||||
|
||||
Input_DisplayNames[CCPAD_1] = "CIRCLE";
|
||||
Input_DisplayNames[CCPAD_2] = "CROSS";
|
||||
|
|
|
|||
|
|
@ -159,11 +159,13 @@ static const BindMapping defaults_vita[BIND_COUNT] = {
|
|||
};
|
||||
static cc_bool circle_main;
|
||||
|
||||
void Gamepads_PreInit(void) {
|
||||
sceCtrlSetSamplingMode(SCE_CTRL_MODE_ANALOG);
|
||||
}
|
||||
|
||||
void Gamepads_Init(void) {
|
||||
Input.Sources |= INPUT_SOURCE_GAMEPAD;
|
||||
|
||||
sceCtrlSetSamplingMode(SCE_CTRL_MODE_ANALOG);
|
||||
|
||||
SceAppUtilInitParam init_param = { 0 };
|
||||
SceAppUtilBootParam boot_param = { 0 };
|
||||
sceAppUtilInit(&init_param, &boot_param);
|
||||
|
|
|
|||
|
|
@ -112,9 +112,12 @@ static const BindMapping saturn_defaults[BIND_COUNT] = {
|
|||
[BIND_DELETE_BLOCK] = { CCPAD_R },
|
||||
};
|
||||
|
||||
void Gamepads_PreInit(void) {
|
||||
smpc_peripheral_init();
|
||||
}
|
||||
|
||||
void Gamepads_Init(void) {
|
||||
Input.Sources |= INPUT_SOURCE_GAMEPAD;
|
||||
smpc_peripheral_init();
|
||||
|
||||
Input_DisplayNames[CCPAD_1] = "A";
|
||||
Input_DisplayNames[CCPAD_2] = "B";
|
||||
|
|
|
|||
|
|
@ -167,6 +167,8 @@ static const BindMapping defaults_switch[BIND_COUNT] = {
|
|||
[BIND_HOTBAR_RIGHT] = { CCPAD_ZR }
|
||||
};
|
||||
|
||||
void Gamepads_PreInit(void) { }
|
||||
|
||||
void Gamepads_Init(void) {
|
||||
Input.Sources |= INPUT_SOURCE_GAMEPAD;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -905,6 +905,8 @@ void Window_DisableRawMouse(void) {
|
|||
Input.RawMode = false;
|
||||
}
|
||||
|
||||
void Gamepads_PreInit(void) { }
|
||||
|
||||
void Gamepads_Init(void) { }
|
||||
|
||||
void Gamepads_Process(float delta) { }
|
||||
|
|
|
|||
|
|
@ -568,6 +568,8 @@ static void Cursor_DoSetVisible(cc_bool visible) {
|
|||
/*########################################################################################################################*
|
||||
*-------------------------------------------------------Gamepads----------------------------------------------------------*
|
||||
*#########################################################################################################################*/
|
||||
void Gamepads_PreInit(void) { }
|
||||
|
||||
void Gamepads_Init(void) {
|
||||
/* Devices can't be detected until first time a button is pressed */
|
||||
}
|
||||
|
|
|
|||
|
|
@ -156,13 +156,15 @@ void Window_DisableRawMouse(void) { Input.RawMode = false; }
|
|||
static VPADStatus vpadStatus;
|
||||
static KPADStatus kpads[4];
|
||||
|
||||
void Gamepads_Init(void) {
|
||||
Input.Sources |= INPUT_SOURCE_GAMEPAD;
|
||||
|
||||
void Gamepads_PreInit(void) {
|
||||
KPADInit();
|
||||
VPADInit();
|
||||
}
|
||||
|
||||
void Gamepads_Init(void) {
|
||||
Input.Sources |= INPUT_SOURCE_GAMEPAD;
|
||||
}
|
||||
|
||||
static void ProcessKPadButtons(int port, int mods) {
|
||||
Gamepad_SetButton(port, CCPAD_L, mods & WPAD_BUTTON_1);
|
||||
Gamepad_SetButton(port, CCPAD_R, mods & WPAD_BUTTON_2);
|
||||
|
|
|
|||
|
|
@ -146,9 +146,7 @@ static void OnDeviceChanged(xid_dev_t *xid_dev__, int status__) {
|
|||
xid_ctrl = NULL;
|
||||
}
|
||||
|
||||
void Gamepads_Init(void) {
|
||||
Input.Sources |= INPUT_SOURCE_GAMEPAD;
|
||||
|
||||
void Gamepads_PreInit(void) {
|
||||
#ifndef CC_BUILD_CXBX
|
||||
usbh_core_init();
|
||||
usbh_xid_init();
|
||||
|
|
@ -158,6 +156,10 @@ void Gamepads_Init(void) {
|
|||
#endif
|
||||
}
|
||||
|
||||
void Gamepads_Init(void) {
|
||||
Input.Sources |= INPUT_SOURCE_GAMEPAD;
|
||||
}
|
||||
|
||||
// https://docs.microsoft.com/en-us/windows/win32/api/xinput/ns-xinput-xinput_gamepad
|
||||
// NOTE: Analog buttons use dedicated field rather than being part of dButtons
|
||||
#define XINPUT_GAMEPAD_DPAD_UP 0x0001
|
||||
|
|
|
|||
|
|
@ -104,12 +104,14 @@ static const BindMapping defaults_xbox360[BIND_COUNT] = {
|
|||
[BIND_HOTBAR_RIGHT] = { CCPAD_ZR }
|
||||
};
|
||||
|
||||
void Gamepads_Init(void) {
|
||||
Input.Sources |= INPUT_SOURCE_GAMEPAD;
|
||||
|
||||
void Gamepads_PreInit(void) {
|
||||
usb_init();
|
||||
usb_do_poll();
|
||||
}
|
||||
|
||||
void Gamepads_Init(void) {
|
||||
Input.Sources |= INPUT_SOURCE_GAMEPAD;
|
||||
}
|
||||
/*
|
||||
struct controller_data_s
|
||||
{
|
||||
|
|
|
|||
Loading…
Reference in New Issue