ref: 4205fc20cb6541818c9ffc3ea62e69bce0f7cee6
parent: d3ed7576858d869b5a5c3ae5061162f2aa6765df
author: Olav Sørensen <olav.sorensen@live.no>
date: Tue May 5 19:11:58 EDT 2020
Windows crashfix when double-clicking associated .mod files
--- a/src/pt2_header.h
+++ b/src/pt2_header.h
@@ -14,7 +14,7 @@
#include "pt2_unicode.h"
#include "pt2_palette.h"
-#define PROG_VER_STR "1.13"
+#define PROG_VER_STR "1.14"
#ifdef _WIN32
#define DIR_DELIMITER '\\'
--- a/src/pt2_module_loader.c
+++ b/src/pt2_module_loader.c
@@ -981,12 +981,12 @@
strcpy(filenameU, arg);
#endif
- module_t *tempSong = modLoad(filenameU);
- if (tempSong != NULL)
+ module_t *newSong = modLoad(filenameU);
+ if (newSong != NULL)
{
song->loaded = false;
modFree();
- song = tempSong;
+ song = newSong;
setupNewMod();
song->loaded = true;
}
@@ -1056,6 +1056,7 @@
fullPathU = (UNICHAR *)calloc(fullPathLen + 2, sizeof (UNICHAR));
if (fullPathU == NULL)
{
+ free(ansiName);
statusOutOfMemory();
return;
}
@@ -1107,8 +1108,8 @@
return;
}
- module_t *tempSong = modLoad(fullPathU);
- if (tempSong != NULL)
+ module_t *newSong = modLoad(fullPathU);
+ if (newSong != NULL)
{
oldMode = editor.currMode;
oldPlayMode = editor.playMode;
@@ -1116,7 +1117,7 @@
modStop();
modFree();
- song = tempSong;
+ song = newSong;
setupNewMod();
song->loaded = true;
--- a/src/pt2_replayer.c
+++ b/src/pt2_replayer.c
@@ -1210,14 +1210,17 @@
editor.songPlaying = false;
turnOffVoices();
- for (int32_t i = 0; i < AMIGA_VOICES; i++)
+ if (song != NULL)
{
- moduleChannel_t *c = &song->channels[i];
+ for (int32_t i = 0; i < AMIGA_VOICES; i++)
+ {
+ moduleChannel_t *c = &song->channels[i];
- c->n_wavecontrol = 0;
- c->n_glissfunk = 0;
- c->n_finetune = 0;
- c->n_loopcount = 0;
+ c->n_wavecontrol = 0;
+ c->n_glissfunk = 0;
+ c->n_finetune = 0;
+ c->n_loopcount = 0;
+ }
}
pBreakFlag = false;