Fixed controllers being lost when using the menu.
This commit is contained in:
parent
5272605211
commit
36ea0b4d7e
10 changed files with 3443 additions and 3461 deletions
1
.gitignore
vendored
1
.gitignore
vendored
|
@ -4,3 +4,4 @@
|
||||||
**/.github/
|
**/.github/
|
||||||
cmake-build-debug/
|
cmake-build-debug/
|
||||||
*.log
|
*.log
|
||||||
|
*.user
|
||||||
|
|
8
.idea/.gitignore
generated
vendored
8
.idea/.gitignore
generated
vendored
|
@ -1,8 +0,0 @@
|
||||||
# Default ignored files
|
|
||||||
/shelf/
|
|
||||||
/workspace.xml
|
|
||||||
# Editor-based HTTP Client requests
|
|
||||||
/httpRequests/
|
|
||||||
# Datasource local storage ignored files
|
|
||||||
/dataSources/
|
|
||||||
/dataSources.local.xml
|
|
1
.idea/.name
generated
1
.idea/.name
generated
|
@ -1 +0,0 @@
|
||||||
singe2
|
|
5
.idea/codeStyles/codeStyleConfig.xml
generated
5
.idea/codeStyles/codeStyleConfig.xml
generated
|
@ -1,5 +0,0 @@
|
||||||
<component name="ProjectCodeStyleConfiguration">
|
|
||||||
<state>
|
|
||||||
<option name="PREFERRED_PROJECT_CODE_STYLE" value="Default" />
|
|
||||||
</state>
|
|
||||||
</component>
|
|
4
.idea/misc.xml
generated
4
.idea/misc.xml
generated
|
@ -1,4 +0,0 @@
|
||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<project version="4">
|
|
||||||
<component name="CMakeWorkspace" PROJECT_DIR="$PROJECT_DIR$" />
|
|
||||||
</project>
|
|
8
.idea/modules.xml
generated
8
.idea/modules.xml
generated
|
@ -1,8 +0,0 @@
|
||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<project version="4">
|
|
||||||
<component name="ProjectModuleManager">
|
|
||||||
<modules>
|
|
||||||
<module fileurl="file://$PROJECT_DIR$/.idea/singe2.iml" filepath="$PROJECT_DIR$/.idea/singe2.iml" />
|
|
||||||
</modules>
|
|
||||||
</component>
|
|
||||||
</project>
|
|
2
.idea/singe2.iml
generated
2
.idea/singe2.iml
generated
|
@ -1,2 +0,0 @@
|
||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<module classpath="CMake" type="CPP_MODULE" version="4" />
|
|
6
.idea/vcs.xml
generated
6
.idea/vcs.xml
generated
|
@ -1,6 +0,0 @@
|
||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<project version="4">
|
|
||||||
<component name="VcsDirectoryMappings">
|
|
||||||
<mapping directory="" vcs="Git" />
|
|
||||||
</component>
|
|
||||||
</project>
|
|
91
src/main.c
91
src/main.c
|
@ -517,29 +517,17 @@ bool extractFile(char *filename, unsigned char *data, int32_t length) {
|
||||||
|
|
||||||
void launcher(char *exeName, ConfigT *conf) {
|
void launcher(char *exeName, ConfigT *conf) {
|
||||||
int32_t x = 0;
|
int32_t x = 0;
|
||||||
int32_t err = 0;
|
|
||||||
int32_t flags = 0;
|
|
||||||
int32_t bestResIndex = -1;
|
int32_t bestResIndex = -1;
|
||||||
float thisRatio = 0;
|
float thisRatio = 0;
|
||||||
float bestRatio = 9999;
|
float bestRatio = 9999;
|
||||||
|
int32_t err = 0;
|
||||||
|
int32_t flags = 0;
|
||||||
char *temp = NULL;
|
char *temp = NULL;
|
||||||
SDL_Window *window = NULL;
|
SDL_Window *window = NULL;
|
||||||
SDL_Renderer *renderer = NULL;
|
SDL_Renderer *renderer = NULL;
|
||||||
SDL_Surface *icon = NULL;
|
SDL_Surface *icon = NULL;
|
||||||
SDL_DisplayMode mode;
|
SDL_DisplayMode mode;
|
||||||
|
|
||||||
// Do they want tracing of any kind?
|
|
||||||
if (conf->scriptTracing || conf->programTracing) {
|
|
||||||
temp = utilCreateString("%strace.txt", conf->dataDir);
|
|
||||||
utilTraceStart(temp);
|
|
||||||
free(temp);
|
|
||||||
temp = NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Init SDL
|
|
||||||
mainTrace("Starting SDL");
|
|
||||||
if (SDL_Init(SDL_INIT_EVERYTHING) != 0) utilDie("%s", SDL_GetError());
|
|
||||||
|
|
||||||
// Get current screen resolution
|
// Get current screen resolution
|
||||||
if (SDL_GetCurrentDisplayMode(0, &mode) < 0) utilDie("%s", SDL_GetError());
|
if (SDL_GetCurrentDisplayMode(0, &mode) < 0) utilDie("%s", SDL_GetError());
|
||||||
mainTrace("Display is %dx%d", mode.w, mode.h);
|
mainTrace("Display is %dx%d", mode.w, mode.h);
|
||||||
|
@ -614,22 +602,6 @@ void launcher(char *exeName, ConfigT *conf) {
|
||||||
if (conf->yResolution <= 0) showUsage(exeName, "Unable to determine Y resolution. (Is the X value sane?)");
|
if (conf->yResolution <= 0) showUsage(exeName, "Unable to determine Y resolution. (Is the X value sane?)");
|
||||||
if ((conf->xResolution > mode.w) || (conf->yResolution > mode.h)) showUsage(exeName, "Specified resolution is larger than the display.");
|
if ((conf->xResolution > mode.w) || (conf->yResolution > mode.h)) showUsage(exeName, "Specified resolution is larger than the display.");
|
||||||
|
|
||||||
// Init SDL_mixer
|
|
||||||
mainTrace("Starting mixer");
|
|
||||||
flags = MIX_INIT_FLAC | MIX_INIT_MID | MIX_INIT_MOD | MIX_INIT_MP3 | MIX_INIT_OGG | MIX_INIT_OPUS | MIX_INIT_WAVPACK;
|
|
||||||
err = Mix_Init(flags);
|
|
||||||
if (err != flags) utilDie("%s", Mix_GetError());
|
|
||||||
|
|
||||||
// Init SDL_image
|
|
||||||
mainTrace("Starting image loader");
|
|
||||||
flags = /* IMG_INIT_AVIF | */ IMG_INIT_JPG | /* IMG_INIT_JXL | */ IMG_INIT_PNG | /* IMG_INIT_TIF | */ IMG_INIT_WEBP;
|
|
||||||
err = IMG_Init(flags);
|
|
||||||
if (err != flags) utilDie("%s", IMG_GetError());
|
|
||||||
|
|
||||||
// Init SDL_ttf
|
|
||||||
mainTrace("Starting fonts");
|
|
||||||
if (TTF_Init() < 0) utilDie("%s", TTF_GetError());
|
|
||||||
|
|
||||||
// Create Window
|
// Create Window
|
||||||
mainTrace("Creating window");
|
mainTrace("Creating window");
|
||||||
window = SDL_CreateWindow("SINGE", SDL_WINDOWPOS_UNDEFINED, SDL_WINDOWPOS_UNDEFINED, conf->xResolution, conf->yResolution, 0 /* SDL_WINDOW_RESIZABLE */);
|
window = SDL_CreateWindow("SINGE", SDL_WINDOWPOS_UNDEFINED, SDL_WINDOWPOS_UNDEFINED, conf->xResolution, conf->yResolution, 0 /* SDL_WINDOW_RESIZABLE */);
|
||||||
|
@ -692,16 +664,6 @@ void launcher(char *exeName, ConfigT *conf) {
|
||||||
SDL_DestroyWindow(window);
|
SDL_DestroyWindow(window);
|
||||||
mainTrace("Re-enabling screen saver");
|
mainTrace("Re-enabling screen saver");
|
||||||
SDL_EnableScreenSaver();
|
SDL_EnableScreenSaver();
|
||||||
mainTrace("Shutting down fonts");
|
|
||||||
TTF_Quit();
|
|
||||||
mainTrace("Shutting down image loader");
|
|
||||||
IMG_Quit();
|
|
||||||
mainTrace("Shutting down mixer");
|
|
||||||
Mix_Quit();
|
|
||||||
mainTrace("Shutting down SDL");
|
|
||||||
SDL_Quit();
|
|
||||||
mainTrace("Shutting down tracing");
|
|
||||||
utilTraceEnd();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -805,6 +767,36 @@ void showUsage(char *name, char *message) {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void startSDL(void) {
|
||||||
|
int32_t err = 0;
|
||||||
|
int32_t flags = 0;
|
||||||
|
|
||||||
|
// Init SDL
|
||||||
|
if (SDL_Init(SDL_INIT_EVERYTHING) != 0) utilDie("%s", SDL_GetError());
|
||||||
|
|
||||||
|
// Init SDL_mixer
|
||||||
|
flags = MIX_INIT_FLAC | MIX_INIT_MID | MIX_INIT_MOD | MIX_INIT_MP3 | MIX_INIT_OGG | MIX_INIT_OPUS | MIX_INIT_WAVPACK;
|
||||||
|
err = Mix_Init(flags);
|
||||||
|
if (err != flags) utilDie("%s", Mix_GetError());
|
||||||
|
|
||||||
|
// Init SDL_image
|
||||||
|
flags = /* IMG_INIT_AVIF | */ IMG_INIT_JPG | /* IMG_INIT_JXL | */ IMG_INIT_PNG | /* IMG_INIT_TIF | */ IMG_INIT_WEBP;
|
||||||
|
err = IMG_Init(flags);
|
||||||
|
if (err != flags) utilDie("%s", IMG_GetError());
|
||||||
|
|
||||||
|
// Init SDL_ttf
|
||||||
|
if (TTF_Init() < 0) utilDie("%s", TTF_GetError());
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void stopSDL(void) {
|
||||||
|
TTF_Quit();
|
||||||
|
IMG_Quit();
|
||||||
|
Mix_Quit();
|
||||||
|
SDL_Quit();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
void unpackData(char *name) {
|
void unpackData(char *name) {
|
||||||
char *temp = NULL;
|
char *temp = NULL;
|
||||||
char *data = NULL;
|
char *data = NULL;
|
||||||
|
@ -953,6 +945,7 @@ void unpackGames(void) {
|
||||||
|
|
||||||
int main(int argc, char *argv[]) {
|
int main(int argc, char *argv[]) {
|
||||||
char *exeName = (char *)argv[0];
|
char *exeName = (char *)argv[0];
|
||||||
|
char *temp = NULL;
|
||||||
ConfigT *conf = NULL;
|
ConfigT *conf = NULL;
|
||||||
QueueT *q = NULL;
|
QueueT *q = NULL;
|
||||||
|
|
||||||
|
@ -964,15 +957,33 @@ int main(int argc, char *argv[]) {
|
||||||
queueScript(conf);
|
queueScript(conf);
|
||||||
destroyConf(&conf);
|
destroyConf(&conf);
|
||||||
|
|
||||||
|
// Do they want tracing of any kind?
|
||||||
|
|
||||||
|
startSDL();
|
||||||
|
|
||||||
// Run script queue
|
// Run script queue
|
||||||
while (_scriptQueue) {
|
while (_scriptQueue) {
|
||||||
|
|
||||||
q = _scriptQueue;
|
q = _scriptQueue;
|
||||||
|
|
||||||
|
if (q->conf->scriptTracing || q->conf->programTracing) {
|
||||||
|
temp = utilCreateString("%strace.txt", q->conf->dataDir);
|
||||||
|
utilTraceStart(temp);
|
||||||
|
free(temp);
|
||||||
|
temp = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
launcher(exeName, q->conf);
|
launcher(exeName, q->conf);
|
||||||
|
|
||||||
destroyConf(&q->conf);
|
destroyConf(&q->conf);
|
||||||
LL_DELETE(_scriptQueue, q);
|
LL_DELETE(_scriptQueue, q);
|
||||||
free(q);
|
free(q);
|
||||||
|
|
||||||
|
utilTraceEnd();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
stopSDL();
|
||||||
|
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
if (utilGetConsoleEnabled()) getchar();
|
if (utilGetConsoleEnabled()) getchar();
|
||||||
#endif
|
#endif
|
||||||
|
|
10
src/singe.c
10
src/singe.c
|
@ -3947,7 +3947,9 @@ void singe(SDL_Window *window, SDL_Renderer *renderer, ConfigT *conf) {
|
||||||
lastAnalogDirection[x] = AXIS_KEY_UP;
|
lastAnalogDirection[x] = AXIS_KEY_UP;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Controllers are started by the event loop
|
// Controllers are started by the event loop only for the first script in
|
||||||
|
// the queue - so kick 'em here to be sure they're going.
|
||||||
|
startControllers();
|
||||||
|
|
||||||
// Set volume
|
// Set volume
|
||||||
_global.effectsVolume = (int32_t)((float)AUDIO_MAX_VOLUME * (float)_global.conf->volumeNonVldp * (float)0.01);
|
_global.effectsVolume = (int32_t)((float)AUDIO_MAX_VOLUME * (float)_global.conf->volumeNonVldp * (float)0.01);
|
||||||
|
@ -4133,8 +4135,8 @@ void singe(SDL_Window *window, SDL_Renderer *renderer, ConfigT *conf) {
|
||||||
break;
|
break;
|
||||||
|
|
||||||
//***TODO*** Doesn't ever seem used?
|
//***TODO*** Doesn't ever seem used?
|
||||||
/*
|
|
||||||
case MANYMOUSE_EVENT_ABSMOTION:
|
case MANYMOUSE_EVENT_ABSMOTION:
|
||||||
|
/*
|
||||||
val = (float)(mouseEvent.value - mouseEvent.minval);
|
val = (float)(mouseEvent.value - mouseEvent.minval);
|
||||||
maxval = (float)(mouseEvent.maxval - mouseEvent.minval);
|
maxval = (float)(mouseEvent.maxval - mouseEvent.minval);
|
||||||
switch (mouseEvent.item) {
|
switch (mouseEvent.item) {
|
||||||
|
@ -4158,8 +4160,10 @@ void singe(SDL_Window *window, SDL_Renderer *renderer, ConfigT *conf) {
|
||||||
_global.axisCache[MAX_CONTROLLERS * 2 + mouseEvent.device * 2 + 1] = y;
|
_global.axisCache[MAX_CONTROLLERS * 2 + mouseEvent.device * 2 + 1] = y;
|
||||||
// Fire event
|
// Fire event
|
||||||
callLua("onMouseMoved", "iiiii", x, y, xr, yr, mouseEvent.device);
|
callLua("onMouseMoved", "iiiii", x, y, xr, yr, mouseEvent.device);
|
||||||
break;
|
|
||||||
*/
|
*/
|
||||||
|
progTrace("Unimplemented MANYMOUSE_EVENT_ABSMOTION called");
|
||||||
|
break;
|
||||||
|
|
||||||
case MANYMOUSE_EVENT_BUTTON:
|
case MANYMOUSE_EVENT_BUTTON:
|
||||||
if (mouseEvent.item < 5 /* 32 */) { // Limited to 5 buttons so it matches single-mouse mode
|
if (mouseEvent.item < 5 /* 32 */) { // Limited to 5 buttons so it matches single-mouse mode
|
||||||
//utilSay("ManyMouse %d Button: %d", mouseEvent.device, mouseEvent.item);
|
//utilSay("ManyMouse %d Button: %d", mouseEvent.device, mouseEvent.item);
|
||||||
|
|
Loading…
Add table
Reference in a new issue