Fixed controllers being lost when using the menu.

This commit is contained in:
Scott Duensing 2023-11-16 19:10:57 -06:00
parent 5272605211
commit 36ea0b4d7e
10 changed files with 3443 additions and 3461 deletions

1
.gitignore vendored
View file

@ -4,3 +4,4 @@
**/.github/
cmake-build-debug/
*.log
*.user

8
.idea/.gitignore generated vendored
View file

@ -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
View file

@ -1 +0,0 @@
singe2

View file

@ -1,5 +0,0 @@
<component name="ProjectCodeStyleConfiguration">
<state>
<option name="PREFERRED_PROJECT_CODE_STYLE" value="Default" />
</state>
</component>

4
.idea/misc.xml generated
View file

@ -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
View file

@ -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
View file

@ -1,2 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<module classpath="CMake" type="CPP_MODULE" version="4" />

6
.idea/vcs.xml generated
View file

@ -1,6 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="VcsDirectoryMappings">
<mapping directory="" vcs="Git" />
</component>
</project>

View file

@ -517,29 +517,17 @@ bool extractFile(char *filename, unsigned char *data, int32_t length) {
void launcher(char *exeName, ConfigT *conf) {
int32_t x = 0;
int32_t err = 0;
int32_t flags = 0;
int32_t bestResIndex = -1;
float thisRatio = 0;
float bestRatio = 9999;
int32_t err = 0;
int32_t flags = 0;
char *temp = NULL;
SDL_Window *window = NULL;
SDL_Renderer *renderer = NULL;
SDL_Surface *icon = NULL;
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
if (SDL_GetCurrentDisplayMode(0, &mode) < 0) utilDie("%s", SDL_GetError());
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->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
mainTrace("Creating window");
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);
mainTrace("Re-enabling screen saver");
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) {
char *temp = NULL;
char *data = NULL;
@ -953,6 +945,7 @@ void unpackGames(void) {
int main(int argc, char *argv[]) {
char *exeName = (char *)argv[0];
char *temp = NULL;
ConfigT *conf = NULL;
QueueT *q = NULL;
@ -964,15 +957,33 @@ int main(int argc, char *argv[]) {
queueScript(conf);
destroyConf(&conf);
// Do they want tracing of any kind?
startSDL();
// Run script queue
while (_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);
destroyConf(&q->conf);
LL_DELETE(_scriptQueue, q);
free(q);
utilTraceEnd();
}
stopSDL();
#ifdef _WIN32
if (utilGetConsoleEnabled()) getchar();
#endif

File diff suppressed because it is too large Load diff