Fix issue #1009: sameboy: stack pointer saved in init state

This commit is contained in:
nattthebear 2017-09-29 18:07:50 -04:00
parent 1532950961
commit 148cadda72
3 changed files with 24 additions and 20 deletions

View File

@ -64,7 +64,7 @@ namespace BizHawk.Emulation.Cores.Consoles.Nintendo.Gameboy
{
Filename = "sameboy.wbx",
SbrkHeapSizeKB = 192,
InvisibleHeapSizeKB = 4,
InvisibleHeapSizeKB = 12,
SealedHeapSizeKB = 9 * 1024,
PlainHeapSizeKB = 4,
MmapHeapSizeKB = 1024

Binary file not shown.

View File

@ -3,6 +3,7 @@
#include <string.h>
#include <stdio.h>
#include "snes_spc/spc.h"
#include "../emulibc/emulibc.h"
#define utils_log printf
@ -623,11 +624,14 @@ int sgb_init(const uint8_t *spc, int length)
return 0;
}
// make a scratch buffer in a predictable (not stack) place because spc stores multiple pointers to it
// which is kind of nasty...
int16_t *sound_buffer = alloc_invisible(4096 * sizeof(int16_t));
// the combination of the sameboy bootrom plus the built in SPC file we use means
// that the SPC doesn't finish its init fast enough for donkey kong, which starts poking
// data too early. it's just a combination of various HLE concerns not meshing...
int16_t sound_buffer[4096];
spc_set_output(sgb.spc, sound_buffer, sizeof(sound_buffer) / sizeof(sound_buffer[0]));
spc_set_output(sgb.spc, sound_buffer, 4096);
for (int i = 0; i < 240; i++)
{
spc_end_frame(sgb.spc, 35104);