shithub: pt2-clone

Download patch

ref: 1be67afd925e4768d332d4ebe8cb145640a2d6a1
parent: c131e839c1cea8f9fe2931535a1efeb678d4733e
author: Olav Sørensen <olav.sorensen@live.no>
date: Sun Oct 10 18:56:01 EDT 2021

paulaStartDMA() null-pointer fix

--- a/src/pt2_audio.c
+++ b/src/pt2_audio.c
@@ -354,9 +354,8 @@
 {
 	paulaVoice_t *v = &paula[ch];
 
-	const int8_t *dat = v->AUD_LC;
-	if (dat == NULL)
-		dat = &song->sampleData[RESERVED_SAMPLE_OFFSET]; // 128K reserved sample
+	if (v->AUD_LC == NULL)
+		v->AUD_LC = &song->sampleData[RESERVED_SAMPLE_OFFSET]; // 128K reserved sample
 
 	/* This is not really accurate to what happens on Paula
 	** during DMA start, but it's good enough.
@@ -384,7 +383,7 @@
 
 	if (editor.songPlaying)
 	{
-		v->syncTriggerData = dat;
+		v->syncTriggerData = v->AUD_LC;
 		v->syncTriggerLength = v->AUD_LEN * 2;
 		v->syncFlags |= TRIGGER_SCOPE;
 	}
@@ -391,7 +390,7 @@
 	else
 	{
 		scope_t *s = &scope[ch];
-		s->newData = dat;
+		s->newData = v->AUD_LC;
 		s->newLength = v->AUD_LEN * 2;
 		scopeTrigger(ch);
 	}