commit 03d9d9e80c43e38f59ec1ee84d3b2304adaad803
Author: Jon Bell <j.to.the.bell@gmail.com>
AuthorDate: Sat Mar 6 10:35:08 2021 -0700
Commit: jtothebell <j.to.the.bell@gmail.com>
CommitDate: Sat Mar 6 12:25:44 2021 -0700
Add audio to SDL2 platforms
Working on vita and linux desktop. Has problems on Wii U.
---
platform/3ds/source/3dsHost.cpp | 4 +-
platform/SDL2/source/SDL2Host.cpp | 75 ++++++++++++++--------------
platform/switch/source/SwitchHost.cpp | 86 +++-----------------------------
platform/vita/source/VitaHost.cpp | 81 ++++++++++++------------------
platform/wiiu/source/WiiUHost.cpp | 92 +++++++++++++++++------------------
source/FakoBios.h | 20 +++++---
source/host.h | 3 +-
source/main.cpp | 6 ++-
8 files changed, 140 insertions(+), 227 deletions(-)
diff --git a/platform/3ds/source/3dsHost.cpp b/platform/3ds/source/3dsHost.cpp
index 4780e7d..3aad0b5 100644
--- a/platform/3ds/source/3dsHost.cpp
+++ b/platform/3ds/source/3dsHost.cpp
@@ -49,6 +49,7 @@ u32 currKHeld;
Color* _paletteColors;
Bgr24Col _bgrColors[16];
+Audio* _audio;
uint8_t ConvertInputToP8(u32 input){
uint8_t result = 0;
@@ -176,9 +177,10 @@ void audioSetup(){
Host::Host() { }
-void Host::oneTimeSetup(Color* paletteColors){
+void Host::oneTimeSetup(Color* paletteColors, Audio* audio){
osSetSpeedupEnable(true);
+ _audio = audio;
audioSetup();
gfxInitDefault();
diff --git a/platform/SDL2/source/SDL2Host.cpp b/platform/SDL2/source/SDL2Host.cpp
index f97fcb1..1bcc424 100644
--- a/platform/SDL2/source/SDL2Host.cpp
+++ b/platform/SDL2/source/SDL2Host.cpp
@@ -11,6 +11,7 @@ using namespace std;
#include "../../../source/host.h"
#include "../../../source/hostVmShared.h"
#include "../../../source/nibblehelpers.h"
+#include "../../../source/logger.h"
// sdl
#include <SDL2/SDL.h>
@@ -40,22 +41,24 @@ uint8_t currKDown;
uint8_t currKHeld;
Color* _paletteColors;
+Audio* _audio;
SDL_Window* window;
SDL_Event event;
SDL_Renderer *renderer;
SDL_Texture *texture = NULL;
SDL_bool done = SDL_FALSE;
+SDL_AudioSpec want, have;
+SDL_AudioDeviceID dev;
void *pixels;
uint8_t *base;
int pitch;
+bool audioInitialized = false;
+
void postFlipFunction(){
- //flush switch frame buffers
// We're done rendering, so we end the frame here.
-
-
SDL_UnlockTexture(texture);
SDL_RenderCopy(renderer, texture, NULL, NULL);
@@ -63,56 +66,55 @@ void postFlipFunction(){
}
-void init_fill_buffer(void *audioBuffer,size_t offset, size_t size) {
- uint32_t *dest = (uint32_t*)audioBuffer;
-
- for (size_t i=0; i<size; i++) {
- dest[i] = 0;
- }
-
- //DSP_FlushDataCache(audioBuffer,size);
-
-}
-
-bool audioInitialized = false;
-uint32_t *audioBuffer;
-uint32_t audioBufferSize;
-//ndspWaveBuf waveBuf[2];
-bool fillBlock = false;
-uint32_t currPos;
void audioCleanup(){
audioInitialized = false;
- //ndspExit();
+ SDL_CloseAudioDevice(dev);
+}
- if(audioBuffer != nullptr) {
- //linearFree(audioBuffer);
- audioBuffer = nullptr;
- }
+
+void FillAudioDeviceBuffer(void* UserData, Uint8* DeviceBuffer, int Length)
+{
+ _audio->FillAudioBuffer(DeviceBuffer, 0, Length / 4);
}
void audioSetup(){
+ //modifed from SDL docs: https://wiki.libsdl.org/SDL_OpenAudioDevice
+
+ SDL_memset(&want, 0, sizeof(want)); /* or SDL_zero(want) */
+ want.freq = SAMPLERATE;
+ want.format = AUDIO_S16;
+ want.channels = 2;
+ want.samples = 4096;
+ want.callback = FillAudioDeviceBuffer;
+
+ dev = SDL_OpenAudioDevice(NULL, 0, &want, &have, 0);
+ if (dev == 0) {
+ Logger_Write("Failed to open audio: %s", SDL_GetError());
+ } else {
+ if (have.format != want.format) { /* we let this one thing change. */
+ Logger_Write("We didn't get requested audio format.");
+ }
+ SDL_PauseAudioDevice(dev, 0); /* start audio playing. */
+ audioInitialized = true;
+ }
}
-Host::Host() { }
-
-void Host::oneTimeSetup(Color* paletteColors){
+Host::Host() { }
- audioSetup();
- // ----- Initialize SDL
+void Host::oneTimeSetup(Color* paletteColors, Audio* audio){
if (SDL_Init(SDL_INIT_EVERYTHING) != 0)
{
fprintf(stderr, "SDL could not initialize\n");
return;
}
- // ----- Create window
SDL_CreateWindowAndRenderer(SCREEN_SIZE_X, SCREEN_SIZE_Y, 0, &window, &renderer);
if (!window)
{
@@ -126,6 +128,9 @@ void Host::oneTimeSetup(Color* paletteColors){
fprintf(stderr, "Error creating texture.\n");
return;
}
+
+ _audio = audio;
+ audioSetup();
last_time = 0;
now_time = 0;
@@ -251,26 +256,18 @@ void Host::drawFrame(uint8_t* picoFb, uint8_t* screenPaletteMap){
}
bool Host::shouldFillAudioBuff(){
- //return waveBuf[fillBlock].status == NDSP_WBUF_DONE;
return false;
}
void* Host::getAudioBufferPointer(){
- //return waveBuf[fillBlock].data_pcm16;
return nullptr;
}
size_t Host::getAudioBufferSize(){
- //return waveBuf[fillBlock].nsamples;
return 0;
}
void Host::playFilledAudioBuffer(){
- //DSP_FlushDataCache(waveBuf[fillBlock].data_pcm16, waveBuf[fillBlock].nsamples);
-
- //ndspChnWaveBufAdd(0, &waveBuf[fillBlock]);
-
- fillBlock = !fillBlock;
}
bool Host::shouldRunMainLoop(){
diff --git a/platform/switch/source/SwitchHost.cpp b/platform/switch/source/SwitchHost.cpp
index 54f5b29..326baec 100644
--- a/platform/switch/source/SwitchHost.cpp
+++ b/platform/switch/source/SwitchHost.cpp
@@ -38,6 +38,7 @@ u32 currKHeld;
Framebuffer fb;
Color* _paletteColors;
+Audio* _audio;
uint8_t ConvertInputToP8(u32 input){
uint8_t result = 0;
@@ -83,83 +84,15 @@ void postFlipFunction(){
}
-void init_fill_buffer(void *audioBuffer,size_t offset, size_t size) {
-
- u32 *dest = (u32*)audioBuffer;
-
- for (size_t i=0; i<size; i++) {
- dest[i] = 0;
- }
-
- //DSP_FlushDataCache(audioBuffer,size);
-
-}
-
bool audioInitialized = false;
-u32 *audioBuffer;
-u32 audioBufferSize;
-//ndspWaveBuf waveBuf[2];
-bool fillBlock = false;
-u32 currPos;
void audioCleanup(){
audioInitialized = false;
-
- //ndspExit();
-
- if(audioBuffer != nullptr) {
- //linearFree(audioBuffer);
- audioBuffer = nullptr;
- }
}
void audioSetup(){
- /*
- if(R_FAILED(ndspInit())) {
- return;
- }
-
- //audio setup
- audioBufferSize = SAMPLESPERBUF * NUM_BUFFERS * sizeof(u32);
- audioBuffer = (u32*)linearAlloc(audioBufferSize);
- if(audioBuffer == nullptr) {
- audioCleanup();
- return;
- }
-
-
- ndspSetOutputMode(NDSP_OUTPUT_STEREO);
-
- ndspChnSetInterp(0, NDSP_INTERP_LINEAR);
- ndspChnSetRate(0, SAMPLERATE);
- ndspChnSetFormat(0, NDSP_FORMAT_STEREO_PCM16);
-
- float mix[12];
- memset(mix, 0, sizeof(mix));
- mix[0] = 1.0;
- mix[1] = 1.0;
- ndspChnSetMix(0, mix);
-
- memset(waveBuf,0,sizeof(waveBuf));
- waveBuf[0].data_vaddr = &audioBuffer[0];
- waveBuf[0].nsamples = SAMPLESPERBUF;
- waveBuf[1].data_vaddr = &audioBuffer[SAMPLESPERBUF];
- waveBuf[1].nsamples = SAMPLESPERBUF;
-
-
- size_t stream_offset = 0;
-
- //not sure if this is necessary? if it is, memset might be better?
- init_fill_buffer(audioBuffer,stream_offset, SAMPLESPERBUF * 2);
-
- stream_offset += SAMPLESPERBUF;
-
- ndspChnWaveBufAdd(0, &waveBuf[0]);
- ndspChnWaveBufAdd(0, &waveBuf[1]);
-
- audioInitialized = true;
- */
+
}
@@ -167,14 +100,15 @@ void audioSetup(){
Host::Host() { }
-void Host::oneTimeSetup(Color* paletteColors){
-
- audioSetup();
+void Host::oneTimeSetup(Color* paletteColors, Audio* audio){
NWindow* win = nwindowGetDefault();
framebufferCreate(&fb, win, FB_WIDTH, FB_HEIGHT, PIXEL_FORMAT_RGBA_8888, 2);
framebufferMakeLinear(&fb);
+
+ _audio = audio;
+ audioSetup();
last_time = 0;
now_time = 0;
@@ -288,26 +222,18 @@ void Host::drawFrame(uint8_t* picoFb, uint8_t* screenPaletteMap){
}
bool Host::shouldFillAudioBuff(){
- //return waveBuf[fillBlock].status == NDSP_WBUF_DONE;
return false;
}
void* Host::getAudioBufferPointer(){
- //return waveBuf[fillBlock].data_pcm16;
return nullptr;
}
size_t Host::getAudioBufferSize(){
- //return waveBuf[fillBlock].nsamples;
return 0;
}
void Host::playFilledAudioBuffer(){
- //DSP_FlushDataCache(waveBuf[fillBlock].data_pcm16, waveBuf[fillBlock].nsamples);
-
- //ndspChnWaveBufAdd(0, &waveBuf[fillBlock]);
-
- fillBlock = !fillBlock;
}
bool Host::shouldRunMainLoop(){
diff --git a/platform/vita/source/VitaHost.cpp b/platform/vita/source/VitaHost.cpp
index edb38d5..c8086c9 100644
--- a/platform/vita/source/VitaHost.cpp
+++ b/platform/vita/source/VitaHost.cpp
@@ -75,10 +75,14 @@ bool rDown = false;
Color* _paletteColors;
+Audio* _audio;
+
SDL_Window* window;
SDL_Event event;
SDL_Renderer *renderer;
SDL_Texture *texture = NULL;
+SDL_AudioSpec want, have;
+SDL_AudioDeviceID dev;
int quit = 0;
void *pixels;
uint8_t *base;
@@ -87,10 +91,7 @@ int pitch;
SDL_Rect DestR;
void postFlipFunction(){
- //flush switch frame buffers
// We're done rendering, so we end the frame here.
-
-
SDL_UnlockTexture(texture);
SDL_RenderCopy(renderer, texture, NULL, &DestR);
@@ -98,47 +99,47 @@ void postFlipFunction(){
}
-void init_fill_buffer(void *audioBuffer,size_t offset, size_t size) {
-
- uint32_t *dest = (uint32_t*)audioBuffer;
-
- for (size_t i=0; i<size; i++) {
- dest[i] = 0;
- }
-
- //DSP_FlushDataCache(audioBuffer,size);
-
-}
-
bool audioInitialized = false;
-uint32_t *audioBuffer;
-uint32_t audioBufferSize;
-//ndspWaveBuf waveBuf[2];
-bool fillBlock = false;
-uint32_t currPos;
-
void audioCleanup(){
audioInitialized = false;
- //ndspExit();
+ SDL_CloseAudioDevice(dev);
+}
- if(audioBuffer != nullptr) {
- //linearFree(audioBuffer);
- audioBuffer = nullptr;
- }
+void FillAudioDeviceBuffer(void* UserData, Uint8* DeviceBuffer, int Length)
+{
+ _audio->FillAudioBuffer(DeviceBuffer, 0, Length / 4);
}
void audioSetup(){
+ //modifed from SDL docs: https://wiki.libsdl.org/SDL_OpenAudioDevice
+
+ SDL_memset(&want, 0, sizeof(want)); /* or SDL_zero(want) */
+ want.freq = SAMPLERATE;
+ want.format = AUDIO_S16;
+ want.channels = 2;
+ want.samples = 4096;
+ want.callback = FillAudioDeviceBuffer;
+
+
+ dev = SDL_OpenAudioDevice(NULL, 0, &want, &have, 0);
+ if (dev == 0) {
+ Logger_Write("Failed to open audio: %s", SDL_GetError());
+ } else {
+ if (have.format != want.format) { /* we let this one thing change. */
+ Logger_Write("We didn't get requested audio format.");
+ }
+ SDL_PauseAudioDevice(dev, 0); /* start audio playing. */
+ audioInitialized = true;
+ }
}
Host::Host() { }
-void Host::oneTimeSetup(Color* paletteColors){
-
- // ----- Initialize SDL
+void Host::oneTimeSetup(Color* paletteColors, Audio* audio){
if (SDL_Init(SDL_INIT_EVERYTHING) != 0)
{
fprintf(stderr, "SDL could not initialize\n");
@@ -146,7 +147,6 @@ void Host::oneTimeSetup(Color* paletteColors){
return;
}
- //Setup window
window = SDL_CreateWindow(nullptr, SDL_WINDOWPOS_CENTERED, SDL_WINDOWPOS_CENTERED, 0, 0, SDL_WINDOW_FULLSCREEN_DESKTOP);
if (!window)
{
@@ -154,7 +154,6 @@ void Host::oneTimeSetup(Color* paletteColors){
return;
}
- //Setup renderer
renderer = SDL_CreateRenderer(window, -1, SDL_RENDERER_ACCELERATED);
if (!renderer)
{
@@ -176,6 +175,7 @@ void Host::oneTimeSetup(Color* paletteColors){
DestR.w = SCREEN_SIZE_X;
DestR.h = SCREEN_SIZE_Y;
+ _audio = audio;
audioSetup();
for (int i = 0; i < SDL_NumJoysticks(); i++) {
@@ -215,14 +215,6 @@ void Host::changeStretch(){
InputState_t Host::scanInput(){
currKDown = 0;
uint8_t kUp = 0;
- //Logger::Write("Scan input\n");
-
-
-//check input here (call open joystick):
-//https://github.com/ulquiorra-dev/Simple_SDL_Snake_WiiU_Port/blob/master/source/main.c
-//tetris calls open joystick:
-//https://github.com/ulquiorra-dev/SDL_TETRIS_WiiU_Port/blob/master/src/main.c
-
while (SDL_PollEvent(&event)) {
switch (event.type) {
case SDL_JOYBUTTONDOWN :
@@ -321,32 +313,21 @@ void Host::drawFrame(uint8_t* picoFb, uint8_t* screenPaletteMap){
}
bool Host::shouldFillAudioBuff(){
- //return waveBuf[fillBlock].status == NDSP_WBUF_DONE;
return false;
}
void* Host::getAudioBufferPointer(){
- //return waveBuf[fillBlock].data_pcm16;
return nullptr;
}
size_t Host::getAudioBufferSize(){
- //return waveBuf[fillBlock].nsamples;
return 0;
}
void Host::playFilledAudioBuffer(){
- //DSP_FlushDataCache(waveBuf[fillBlock].data_pcm16, waveBuf[fillBlock].nsamples);
-
- //ndspChnWaveBufAdd(0, &waveBuf[fillBlock]);
-
- //fillBlock = !fillBlock;
}
bool Host::shouldRunMainLoop(){
-
- //check how tetris handles update loop - quit flag
- //https://github.com/ulquiorra-dev/SDL_TETRIS_WiiU_Port/blob/master/src/main.c
return !quit;
}
diff --git a/platform/wiiu/source/WiiUHost.cpp b/platform/wiiu/source/WiiUHost.cpp
index 35cdb23..96446bb 100644
--- a/platform/wiiu/source/WiiUHost.cpp
+++ b/platform/wiiu/source/WiiUHost.cpp
@@ -1,11 +1,8 @@
/*
-Wii u port todo:
-(X) exit gracefully
-(X) fix input- ish - still no start
-(X) load files from sd card
-4) sound
+Wii U port todo:
+1) sound messed up (turned off)
+2) Fix buttons being very confusing
*/
-
#include <stdio.h>
#include <string.h>
#include <dirent.h>
@@ -54,10 +51,14 @@ uint8_t currKHeld;
Color* _paletteColors;
+Audio* _audio;
+
SDL_Window* window;
SDL_Event event;
SDL_Renderer *renderer;
SDL_Texture *texture = NULL;
+SDL_AudioSpec want, have;
+SDL_AudioDeviceID dev;
int quit = 0;
void *pixels;
uint8_t *base;
@@ -77,47 +78,51 @@ void postFlipFunction(){
}
-void init_fill_buffer(void *audioBuffer,size_t offset, size_t size) {
-
- uint32_t *dest = (uint32_t*)audioBuffer;
-
- for (size_t i=0; i<size; i++) {
- dest[i] = 0;
- }
-
- //DSP_FlushDataCache(audioBuffer,size);
-
-}
-
bool audioInitialized = false;
-uint32_t *audioBuffer;
-uint32_t audioBufferSize;
-//ndspWaveBuf waveBuf[2];
-bool fillBlock = false;
-uint32_t currPos;
-
void audioCleanup(){
audioInitialized = false;
- //ndspExit();
+ //SDL_CloseAudioDevice(dev);
+}
- if(audioBuffer != nullptr) {
- //linearFree(audioBuffer);
- audioBuffer = nullptr;
- }
+void FillAudioDeviceBuffer(void* UserData, Uint8* DeviceBuffer, int Length)
+{
+ _audio->FillAudioBuffer(DeviceBuffer, 0, Length / 4);
}
void audioSetup(){
+ //modifed from SDL docs: https://wiki.libsdl.org/SDL_OpenAudioDevice
+ //Audio plays but is wrong. maybe a problem with sample rate or endian-ness? haven't investigated thoroughly
+
+/*
+ SDL_memset(&want, 0, sizeof(want)); // or SDL_zero(want)
+ want.freq = SAMPLERATE;
+ want.format = AUDIO_U16;
+ want.channels = 2;
+ want.samples = 4096;
+ want.callback = FillAudioDeviceBuffer;
+
+
+ dev = SDL_OpenAudioDevice(NULL, 0, &want, &have, 0);
+ if (dev == 0) {
+ Logger_Write("Failed to open audio: %s", SDL_GetError());
+ } else {
+ if (have.format != want.format) {
+ Logger_Write("We didn't get requested audio format.");
+ }
+ SDL_PauseAudioDevice(dev, 0); // start audio playing.
+
+ audioInitialized = true;
+ }
+ */
}
Host::Host() { }
-void Host::oneTimeSetup(Color* paletteColors){
-
- // ----- Initialize SDL
+void Host::oneTimeSetup(Color* paletteColors, Audio* audio){
if (SDL_Init(SDL_INIT_EVERYTHING) != 0)
{
fprintf(stderr, "SDL could not initialize\n");
@@ -125,7 +130,6 @@ void Host::oneTimeSetup(Color* paletteColors){
return;
}
- //Setup window
window = SDL_CreateWindow(nullptr, SDL_WINDOWPOS_CENTERED, SDL_WINDOWPOS_CENTERED, 0, 0, SDL_WINDOW_FULLSCREEN_DESKTOP);
if (!window)
{
@@ -133,7 +137,6 @@ void Host::oneTimeSetup(Color* paletteColors){
return;
}
- //Setup renderer
renderer = SDL_CreateRenderer(window, -1, SDL_RENDERER_ACCELERATED);
if (!renderer)
{
@@ -155,6 +158,7 @@ void Host::oneTimeSetup(Color* paletteColors){
DestR.w = SCREEN_SIZE_X;
DestR.h = SCREEN_SIZE_Y;
+ _audio = audio;
audioSetup();
for (int i = 0; i < SDL_NumJoysticks(); i++) {
@@ -192,9 +196,7 @@ void Host::changeStretch(){
InputState_t Host::scanInput(){
currKDown = 0;
uint8_t kUp = 0;
- //Logger::Write("Scan input\n");
-
-
+//For some reason these buttons are all out of whack
//check input here (call open joystick):
//https://github.com/ulquiorra-dev/Simple_SDL_Snake_WiiU_Port/blob/master/source/main.c
//tetris calls open joystick:
@@ -297,32 +299,21 @@ void Host::drawFrame(uint8_t* picoFb, uint8_t* screenPaletteMap){
}
bool Host::shouldFillAudioBuff(){
- //return waveBuf[fillBlock].status == NDSP_WBUF_DONE;
return false;
}
void* Host::getAudioBufferPointer(){
- //return waveBuf[fillBlock].data_pcm16;
return nullptr;
}
size_t Host::getAudioBufferSize(){
- //return waveBuf[fillBlock].nsamples;
return 0;
}
void Host::playFilledAudioBuffer(){
- //DSP_FlushDataCache(waveBuf[fillBlock].data_pcm16, waveBuf[fillBlock].nsamples);
-
- //ndspChnWaveBufAdd(0, &waveBuf[fillBlock]);
-
- //fillBlock = !fillBlock;
}
bool Host::shouldRunMainLoop(){
-
- //check how tetris handles update loop - quit flag
- //https://github.com/ulquiorra-dev/SDL_TETRIS_WiiU_Port/blob/master/src/main.c
return !quit;
}
@@ -351,3 +342,8 @@ vector<string> Host::listcarts(){
return carts;
}
+
+const char* Host::logFilePrefix() {
+ return "";
+}
+
diff --git a/source/FakoBios.h b/source/FakoBios.h
index b869d0a..f166b75 100644
--- a/source/FakoBios.h
+++ b/source/FakoBios.h
@@ -20,6 +20,14 @@ local line
local bgcolor=5
local runcmd=false
+--start customizable per platform
+cartpath = "sdmc:/p8carts/"
+selectbtn = "a"
+pausebtn = "start"
+versionstr = "v0.0.2.3"
+exitbtn = "l + r"
+sizebtn = "r to cycle screen sizes"
+--end customizable per platform
function _init()
if __listcarts then
@@ -37,18 +45,18 @@ function _init()
cursor(0, 6*3)
print("welcome to fake-08")
print("a homebrew pico-8 emulator")
- print("currently in alpha (v0.0.2.2)")
+ print("currently in alpha (" .. versionstr .. ")")
print("")
- print("place p8 carts in sdmc:/p8carts/")
+ print("place p8 carts in " .. cartpath)
if numcarts < 1 then
print("--no carts found--")
else
print("⬅️➡️ to navigate carts")
- print("🅾️ (a) to load selected cart")
- print("start to close current cart")
+ print("🅾️ (" .. selectbtn .. ") to load selected cart")
+ print(pausebtn .. " to close current cart")
end
- print("r to cycle screen sizes")
- print("l + r to exit")
+ print(sizebtn)
+ print(exitbtn .. " to exit")
print("")
-- 18 pixels from cursor() call, then
-- 24 more from 4 print calls
diff --git a/source/host.h b/source/host.h
index d9d0edc..2ef0664 100644
--- a/source/host.h
+++ b/source/host.h
@@ -4,6 +4,7 @@
#include <vector>
#include <string>
#include "hostVmShared.h"
+#include "Audio.h"
enum StretchOption {
PixelPerfect,
@@ -16,7 +17,7 @@ class Host {
public:
Host();
- void oneTimeSetup(Color* paletteColors);
+ void oneTimeSetup(Color* paletteColors, Audio* audio);
void setTargetFps(int targetFps);
diff --git a/source/main.cpp b/source/main.cpp
index 598ff66..b2bd817 100644
--- a/source/main.cpp
+++ b/source/main.cpp
@@ -15,12 +15,14 @@
int main(int argc, char* argv[])
{
Host *host = new Host();
+ PicoRam *memory = new PicoRam();
+ Audio *audio = new Audio(memory);
Logger_Initialize(host->logFilePrefix());
- Vm *vm = new Vm(host);
+ Vm *vm = new Vm(host, memory, nullptr, nullptr, audio);
- host->oneTimeSetup(vm->GetPaletteColors());
+ host->oneTimeSetup(vm->GetPaletteColors(), audio);
Logger_Write("initialized Vm and host\n");