Fix Dolphin crash
This commit is contained in:
@@ -16,7 +16,6 @@
|
|||||||
#include "ui/ui.h"
|
#include "ui/ui.h"
|
||||||
#include "map/map.h"
|
#include "map/map.h"
|
||||||
#include "script/scriptmanager.h"
|
#include "script/scriptmanager.h"
|
||||||
#include "debug/debug.h"
|
|
||||||
#include "item/backpack.h"
|
#include "item/backpack.h"
|
||||||
#include "assert/assert.h"
|
#include "assert/assert.h"
|
||||||
|
|
||||||
@@ -30,7 +29,7 @@ errorret_t engineInit(const int32_t argc, const char_t **argv) {
|
|||||||
|
|
||||||
// Init systems. Order is important.
|
// Init systems. Order is important.
|
||||||
timeInit();
|
timeInit();
|
||||||
inputInit();
|
errorChain(inputInit());
|
||||||
errorChain(assetInit());
|
errorChain(assetInit());
|
||||||
errorChain(localeManagerInit());
|
errorChain(localeManagerInit());
|
||||||
errorChain(scriptManagerInit());
|
errorChain(scriptManagerInit());
|
||||||
|
|||||||
@@ -15,7 +15,7 @@
|
|||||||
|
|
||||||
input_t INPUT;
|
input_t INPUT;
|
||||||
|
|
||||||
void inputInit(void) {
|
errorret_t inputInit(void) {
|
||||||
memoryZero(&INPUT, sizeof(input_t));
|
memoryZero(&INPUT, sizeof(input_t));
|
||||||
|
|
||||||
for(uint8_t i = 0; i < INPUT_ACTION_COUNT; i++) {
|
for(uint8_t i = 0; i < INPUT_ACTION_COUNT; i++) {
|
||||||
@@ -29,7 +29,7 @@ void inputInit(void) {
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef inputInitPlatform
|
#ifdef inputInitPlatform
|
||||||
inputInitPlatform();
|
errorChain(inputInitPlatform());
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
eventInit(
|
eventInit(
|
||||||
@@ -38,6 +38,8 @@ void inputInit(void) {
|
|||||||
eventInit(
|
eventInit(
|
||||||
&INPUT.eventReleased, INPUT.releasedListeners, INPUT_LISTENER_RELEASED_MAX
|
&INPUT.eventReleased, INPUT.releasedListeners, INPUT_LISTENER_RELEASED_MAX
|
||||||
);
|
);
|
||||||
|
|
||||||
|
errorOk();
|
||||||
}
|
}
|
||||||
|
|
||||||
void inputUpdate(void) {
|
void inputUpdate(void) {
|
||||||
|
|||||||
@@ -6,6 +6,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
#include "error/error.h"
|
||||||
#include "inputbutton.h"
|
#include "inputbutton.h"
|
||||||
#include "inputaction.h"
|
#include "inputaction.h"
|
||||||
#include "event/event.h"
|
#include "event/event.h"
|
||||||
@@ -36,8 +37,10 @@ extern input_t INPUT;
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Initialize the input system.
|
* Initialize the input system.
|
||||||
|
*
|
||||||
|
* @return An error code if initialization fails.
|
||||||
*/
|
*/
|
||||||
void inputInit(void);
|
errorret_t inputInit(void);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Updates the input state.
|
* Updates the input state.
|
||||||
|
|||||||
@@ -33,8 +33,6 @@ void timeUpdate(void) {
|
|||||||
TIME.dynamicTime += TIME.dynamicDelta;
|
TIME.dynamicTime += TIME.dynamicDelta;
|
||||||
TIME.dynamicUpdate = true;
|
TIME.dynamicUpdate = true;
|
||||||
|
|
||||||
printf("Time delta: %f\n", TIME.dynamicDelta);
|
|
||||||
|
|
||||||
assertTrue(TIME.dynamicDelta >= 0.0f, "Time delta is negative");
|
assertTrue(TIME.dynamicDelta >= 0.0f, "Time delta is negative");
|
||||||
|
|
||||||
// Is within 1ms of a full step?
|
// Is within 1ms of a full step?
|
||||||
|
|||||||
@@ -22,6 +22,7 @@ void debugPrint(const char_t *message, ...) {
|
|||||||
va_copy(copy, args);
|
va_copy(copy, args);
|
||||||
vfprintf(stdout, message, copy);
|
vfprintf(stdout, message, copy);
|
||||||
va_end(copy);
|
va_end(copy);
|
||||||
|
fflush(stdout);
|
||||||
|
|
||||||
// Append to buffer
|
// Append to buffer
|
||||||
vsnprintf(
|
vsnprintf(
|
||||||
|
|||||||
@@ -7,6 +7,7 @@
|
|||||||
|
|
||||||
#include "input/input.h"
|
#include "input/input.h"
|
||||||
#include "assert/assert.h"
|
#include "assert/assert.h"
|
||||||
|
#include "debug/debug.h"
|
||||||
|
|
||||||
inputbuttondata_t INPUT_BUTTON_DATA[] = {
|
inputbuttondata_t INPUT_BUTTON_DATA[] = {
|
||||||
#ifdef DUSK_INPUT_GAMEPAD
|
#ifdef DUSK_INPUT_GAMEPAD
|
||||||
@@ -38,6 +39,12 @@ inputbuttondata_t INPUT_BUTTON_DATA[] = {
|
|||||||
{ .name = NULL }
|
{ .name = NULL }
|
||||||
};
|
};
|
||||||
|
|
||||||
|
errorret_t inputInitDolphin(void) {
|
||||||
|
PAD_Init();
|
||||||
|
|
||||||
|
errorOk();
|
||||||
|
}
|
||||||
|
|
||||||
void inputUpdateDolphin(void) {
|
void inputUpdateDolphin(void) {
|
||||||
PAD_ScanPads();
|
PAD_ScanPads();
|
||||||
|
|
||||||
|
|||||||
@@ -7,6 +7,7 @@
|
|||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
#include "dusk.h"
|
#include "dusk.h"
|
||||||
|
#include "error/error.h"
|
||||||
|
|
||||||
#define INPUT_DOLPHIN_PAD_COUNT PAD_CHANMAX
|
#define INPUT_DOLPHIN_PAD_COUNT PAD_CHANMAX
|
||||||
#define INPUT_DOLPHIN_AXIS(value) ((float_t)(value) / 128.0f)
|
#define INPUT_DOLPHIN_AXIS(value) ((float_t)(value) / 128.0f)
|
||||||
@@ -44,6 +45,13 @@ typedef struct {
|
|||||||
#endif
|
#endif
|
||||||
} inputdolphin_t;
|
} inputdolphin_t;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Initializes the input system for Dolphin.
|
||||||
|
*
|
||||||
|
* @return An error code if initialization fails.
|
||||||
|
*/
|
||||||
|
errorret_t inputInitDolphin(void);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Updates the input state for Dolphin.
|
* Updates the input state for Dolphin.
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -15,5 +15,6 @@
|
|||||||
|
|
||||||
typedef inputdolphin_t inputplatform_t;
|
typedef inputdolphin_t inputplatform_t;
|
||||||
|
|
||||||
|
#define inputInitPlatform inputInitDolphin
|
||||||
#define inputUpdatePlatform inputUpdateDolphin
|
#define inputUpdatePlatform inputUpdateDolphin
|
||||||
#define inputButtonGetValuePlatform inputButtonGetValueDolphin
|
#define inputButtonGetValuePlatform inputButtonGetValueDolphin
|
||||||
@@ -61,7 +61,7 @@ errorret_t assetInitLinux(void) {
|
|||||||
ASSET.zip = zip_open(searchPath, ZIP_RDONLY, &error);
|
ASSET.zip = zip_open(searchPath, ZIP_RDONLY, &error);
|
||||||
if(ASSET.zip == NULL) continue;
|
if(ASSET.zip == NULL) continue;
|
||||||
if(error != 0) {
|
if(error != 0) {
|
||||||
printf("Warning: Opened asset file with non-zero error code: %d\n", error);
|
printf("Opened asset file with non-zero error code: %d\n", error);
|
||||||
ASSET.zip = NULL;
|
ASSET.zip = NULL;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user