diff options
-rw-r--r-- | Emu8000.cpp | 6 | ||||
-rw-r--r-- | Makefile | 4 | ||||
-rw-r--r-- | emu8k.c | 37 | ||||
-rw-r--r-- | emu8k.h | 3 |
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) @@ -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" @@ -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() +}; + @@ -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 |