Fixed dolphin input
Some checks failed
Some checks failed
This commit is contained in:
@@ -187,6 +187,7 @@ function sceneUpdate()
|
||||
end
|
||||
|
||||
if inputIsDown(INPUT_ACTION_DOWN) then
|
||||
print("down")
|
||||
y = y + 1
|
||||
end
|
||||
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
# Target definitions
|
||||
target_compile_definitions(${DUSK_LIBRARY_TARGET_NAME} PUBLIC
|
||||
DUSK_DOLPHIN
|
||||
DUSK_INPUT_GAMEPAD
|
||||
DUSK_DISPLAY_WIDTH=640
|
||||
DUSK_DISPLAY_HEIGHT=480
|
||||
)
|
||||
|
||||
@@ -25,57 +25,55 @@ void debugPrint(const char_t *message, ...) {
|
||||
fflush(stdout);
|
||||
|
||||
// Append to buffer
|
||||
vsnprintf(
|
||||
DEBUG_ERROR_BUFFER + start,
|
||||
sizeof(DEBUG_ERROR_BUFFER) - start,
|
||||
message,
|
||||
args
|
||||
);
|
||||
|
||||
va_end(args);
|
||||
// vsnprintf(
|
||||
// DEBUG_ERROR_BUFFER + start,
|
||||
// sizeof(DEBUG_ERROR_BUFFER) - start,
|
||||
// message,
|
||||
// args
|
||||
// );
|
||||
}
|
||||
|
||||
void debugFlush() {
|
||||
fflush(stdout);
|
||||
|
||||
// Either create graphics, or hijack the displays' graphics.
|
||||
void *xfb = NULL;
|
||||
GXRModeObj *rmode = NULL;
|
||||
void *framebuffer;
|
||||
// void *xfb = NULL;
|
||||
// GXRModeObj *rmode = NULL;
|
||||
// void *framebuffer;
|
||||
|
||||
if(DISPLAY.frameBuffer[0]) {
|
||||
console_init(
|
||||
DISPLAY.frameBuffer[0],
|
||||
20,
|
||||
20,
|
||||
DISPLAY.screenMode->fbWidth,
|
||||
DISPLAY.screenMode->xfbHeight,
|
||||
DISPLAY.screenMode->fbWidth * VI_DISPLAY_PIX_SZ
|
||||
);
|
||||
} else {
|
||||
VIDEO_Init();
|
||||
rmode = VIDEO_GetPreferredMode(NULL);
|
||||
framebuffer = MEM_K0_TO_K1(SYS_AllocateFramebuffer(rmode));
|
||||
console_init(
|
||||
framebuffer,
|
||||
20,
|
||||
20,
|
||||
rmode->fbWidth,
|
||||
rmode->xfbHeight,
|
||||
rmode->fbWidth*VI_DISPLAY_PIX_SZ
|
||||
);
|
||||
VIDEO_Configure(rmode);
|
||||
VIDEO_SetNextFramebuffer(framebuffer);
|
||||
VIDEO_SetBlack(FALSE);
|
||||
VIDEO_Flush();
|
||||
VIDEO_WaitVSync();
|
||||
if(rmode->viTVMode&VI_NON_INTERLACE) VIDEO_WaitVSync();
|
||||
}
|
||||
// if(DISPLAY.frameBuffer[0]) {
|
||||
// console_init(
|
||||
// DISPLAY.frameBuffer[0],
|
||||
// 20,
|
||||
// 20,
|
||||
// DISPLAY.screenMode->fbWidth,
|
||||
// DISPLAY.screenMode->xfbHeight,
|
||||
// DISPLAY.screenMode->fbWidth * VI_DISPLAY_PIX_SZ
|
||||
// );
|
||||
// } else {
|
||||
// VIDEO_Init();
|
||||
// rmode = VIDEO_GetPreferredMode(NULL);
|
||||
// framebuffer = MEM_K0_TO_K1(SYS_AllocateFramebuffer(rmode));
|
||||
// console_init(
|
||||
// framebuffer,
|
||||
// 20,
|
||||
// 20,
|
||||
// rmode->fbWidth,
|
||||
// rmode->xfbHeight,
|
||||
// rmode->fbWidth*VI_DISPLAY_PIX_SZ
|
||||
// );
|
||||
// VIDEO_Configure(rmode);
|
||||
// VIDEO_SetNextFramebuffer(framebuffer);
|
||||
// VIDEO_SetBlack(FALSE);
|
||||
// VIDEO_Flush();
|
||||
// VIDEO_WaitVSync();
|
||||
// if(rmode->viTVMode&VI_NON_INTERLACE) VIDEO_WaitVSync();
|
||||
// }
|
||||
|
||||
// Printf
|
||||
printf("SOB\n");
|
||||
printf(DEBUG_ERROR_BUFFER);
|
||||
printf("\nEOB.");
|
||||
// // Printf
|
||||
// printf("SOB\n");
|
||||
// printf(DEBUG_ERROR_BUFFER);
|
||||
// printf("\nEOB.");
|
||||
|
||||
while(SYS_MainLoop()) {
|
||||
VIDEO_WaitVSync();
|
||||
|
||||
@@ -49,8 +49,8 @@ void inputUpdateDolphin(void) {
|
||||
PAD_ScanPads();
|
||||
|
||||
#ifdef DUSK_INPUT_GAMEPAD
|
||||
for(uint8_t i = 0; i < INPUT_PAD_COUNT; i++) {
|
||||
INPUT.platform.padState[i] = PAD_ButtonsDown(i);
|
||||
for(uint8_t i = 0; i < INPUT_DOLPHIN_PAD_COUNT; i++) {
|
||||
INPUT.platform.padState[i] = PAD_ButtonsHeld(i);
|
||||
|
||||
INPUT.platform.pads[i][INPUT_GAMEPAD_AXIS_LEFT_X] = (
|
||||
INPUT_DOLPHIN_AXIS(PAD_StickX(i))
|
||||
@@ -83,12 +83,12 @@ float_t inputButtonGetValueDolphin(const inputbutton_t button) {
|
||||
switch(button.type) {
|
||||
#ifdef DUSK_INPUT_GAMEPAD
|
||||
case INPUT_BUTTON_TYPE_GAMEPAD: {
|
||||
if(INPUT.padState[0] & button.gpButton) return 1.0f;
|
||||
if(INPUT.platform.padState[0] & button.gpButton) return 1.0f;
|
||||
return 0.0f;
|
||||
}
|
||||
|
||||
case INPUT_BUTTON_TYPE_GAMEPAD_AXIS: {
|
||||
float_t value = INPUT.pads[0][button.gpAxis.axis];
|
||||
float_t value = INPUT.platform.pads[0][button.gpAxis.axis];
|
||||
if(!button.gpAxis.positive) value = -value;
|
||||
if(value >= INPUT.deadzone) return value;
|
||||
return 0.0f;
|
||||
|
||||
Reference in New Issue
Block a user