aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Emu8000.cpp6
-rw-r--r--Makefile4
-rw-r--r--emu8k.c37
-rw-r--r--emu8k.h3
4 files changed, 44 insertions, 6 deletions
diff --git a/Emu8000.cpp b/Emu8000.cpp
index a28f0dd..6636c2b 100644
--- a/Emu8000.cpp
+++ b/Emu8000.cpp
@@ -377,9 +377,9 @@ static DECLCALLBACK(int) emuR3SaveExec(PPDMDEVINS pDevIns, PSSMHANDLE pSSM)
pHlp->pfnSSMPutU32(pSSM, pThis->uRAMSize);
pHlp->pfnSSMPutMem(pSSM, pThis->ram, pThis->uRAMSize);
- // TODO Should save the rest of the device state, too.
+ pHlp->pfnSSMPutStruct(pSSM, pThis->emu, g_emu8k_fields);
- return 0;
+ return 0;
}
/**
@@ -403,6 +403,8 @@ static DECLCALLBACK(int) emuR3LoadExec(PPDMDEVINS pDevIns, PSSMHANDLE pSSM, uint
pHlp->pfnSSMSkip(pSSM, uRAMSize);
}
+ pHlp->pfnSSMGetStruct(pSSM, pThis->emu, g_emu8k_fields);
+
pThis->tmLastWrite = RTTimeSystemMilliTS();
if (uVersion > EMU_SAVED_STATE_VERSION)
diff --git a/Makefile b/Makefile
index 6cb628f..bece4c4 100644
--- a/Makefile
+++ b/Makefile
@@ -20,11 +20,11 @@ OUTDIR:=out
OUTOSDIR:=$(OUTDIR)/$(OS).$(ARCH)
# Files for each library
-ADLIBR3OBJ:=$(OBJOSDIR)/Adlib.o $(OBJOSDIR)/opl3.o
+ADLIBR3OBJ:=$(OBJOSDIR)/Adlib.o $(OBJOSDIR)/opl3.o
ADLIBR3LIBS:=
MPU401R3OBJ:=$(OBJOSDIR)/Mpu401.o
MPU401R3LIBS:=
-EMU8000R3OBJ:=$(OBJOSDIR)/Emu8000.o $(OBJOSDIR)/emu8k.o
+EMU8000R3OBJ:=$(OBJOSDIR)/Emu8000.o $(OBJOSDIR)/emu8k.o
EMU8000R3LIBS:=
ifeq "$(OS)" "linux"
diff --git a/emu8k.c b/emu8k.c
index 2d3d9a0..9684d8f 100644
--- a/emu8k.c
+++ b/emu8k.c
@@ -44,6 +44,7 @@
#include <iprt/string.h>
#include <iprt/mem.h>
+#include "emu8k.h"
#include "emu8k_internal.h"
#define pclog(...) LogFlow((__VA_ARGS__))
@@ -2416,6 +2417,7 @@ void emu8k_reset(emu8k_t* emu8k)
void emu8k_render(emu8k_t *emu8k, int16_t *buf, size_t frames)
{
+ emu8k->pos = 0;
emu8k_update(emu8k, frames);
// Convert from int32_t samples to int16_t
@@ -2423,8 +2425,6 @@ void emu8k_render(emu8k_t *emu8k, int16_t *buf, size_t frames)
{
buf[i] = RT_CLAMP(emu8k->buffer[i], INT16_MIN, INT16_MAX);
}
-
- emu8k->pos = 0;
}
void emu8k_update_virtual_sample_count(emu8k_t *emu8k, uint16_t sample_count)
@@ -2436,3 +2436,36 @@ void emu8k_update_virtual_sample_count(emu8k_t *emu8k, uint16_t sample_count)
#endif
emu8k->sample_count_virtual = sample_count;
}
+
+const struct SSMFIELD g_emu8k_fields[] =
+{
+ SSMFIELD_ENTRY(emu8k_t, hwcf1),
+ SSMFIELD_ENTRY(emu8k_t, hwcf2),
+ SSMFIELD_ENTRY(emu8k_t, hwcf3),
+ SSMFIELD_ENTRY(emu8k_t, hwcf4),
+ SSMFIELD_ENTRY(emu8k_t, hwcf5),
+ SSMFIELD_ENTRY(emu8k_t, hwcf6),
+ SSMFIELD_ENTRY(emu8k_t, hwcf7),
+ SSMFIELD_ENTRY(emu8k_t, init1),
+ SSMFIELD_ENTRY(emu8k_t, init2),
+ SSMFIELD_ENTRY(emu8k_t, init3),
+ SSMFIELD_ENTRY(emu8k_t, init4),
+ SSMFIELD_ENTRY(emu8k_t, smalr),
+ SSMFIELD_ENTRY(emu8k_t, smarr),
+ SSMFIELD_ENTRY(emu8k_t, smalw),
+ SSMFIELD_ENTRY(emu8k_t, smarw),
+ SSMFIELD_ENTRY(emu8k_t, smld_buffer),
+ SSMFIELD_ENTRY(emu8k_t, smrd_buffer),
+ SSMFIELD_ENTRY(emu8k_t, sample_count),
+ SSMFIELD_ENTRY(emu8k_t, id),
+ SSMFIELD_ENTRY(emu8k_t, cur_reg),
+ SSMFIELD_ENTRY(emu8k_t, cur_voice),
+
+ SSMFIELD_ENTRY(emu8k_t, voice),
+
+ SSMFIELD_ENTRY(emu8k_t, chorus_engine),
+ SSMFIELD_ENTRY(emu8k_t, reverb_engine),
+
+ SSMFIELD_ENTRY_TERM()
+};
+
diff --git a/emu8k.h b/emu8k.h
index f6b7b0f..a119023 100644
--- a/emu8k.h
+++ b/emu8k.h
@@ -41,6 +41,7 @@
#include <stddef.h>
#include <stdint.h>
+#include <VBox/vmm/ssm.h>
#ifdef __cplusplus
extern "C" {
@@ -67,6 +68,8 @@ void emu8k_update_virtual_sample_count(emu8k_t *emu8k, uint16_t sample_count);
* It is reset to 0 whenever we render and therefore increment the real sample count.
* This means that effectively the sample count register may readjust itself (go back or jump ahead) on _render :(. */
+extern const struct SSMFIELD g_emu8k_fields[];
+
#ifdef __cplusplus
} /* extern "C" */
#endif