GB Video: Fix SGB video logs

This commit is contained in:
Vicki Pfau 2020-11-22 15:08:45 -08:00
parent 13c36a54f1
commit 7918b5af45
5 changed files with 13 additions and 3 deletions

View File

@ -58,6 +58,7 @@ Other fixes:
- Debugger: Close trace log when done tracing
- FFmpeg: Fix some small memory leaks
- FFmpeg: Fix encoding of time base
- GB Video: Fix SGB video logs
- mGUI: Don't attempt to preload files larger than can fit in RAM
- Qt: Force OpenGL paint engine creation thread (fixes mgba.io/i/1642)
- Qt: Fix static compilation in MinGW (fixes mgba.io/i/1769)

View File

@ -437,6 +437,9 @@ struct GBSerializedState {
bool GBDeserialize(struct GB* gb, const struct GBSerializedState* state);
void GBSerialize(struct GB* gb, struct GBSerializedState* state);
void GBSGBSerialize(struct GB* gb, struct GBSerializedState* state);
void GBSGBDeserialize(struct GB* gb, const struct GBSerializedState* state);
CXX_GUARD_END
#endif

View File

@ -1163,6 +1163,9 @@ static bool _GBVLPLoadState(struct mCore* core, const void* buffer) {
GBVideoDeserialize(&gb->video, state);
GBIODeserialize(gb, state);
GBAudioReset(&gb->audio);
if (gb->model & GB_MODEL_SGB) {
GBSGBDeserialize(gb, state);
}
// Make sure CPU loop never spins
gb->memory.ie = 0;

View File

@ -102,6 +102,12 @@ void GBVideoProxyRendererShim(struct GBVideo* video, struct GBVideoProxyRenderer
renderer->backend = video->renderer;
video->renderer = &renderer->d;
renderer->d.cache = renderer->backend->cache;
renderer->d.sgbRenderMode = renderer->backend->sgbRenderMode;
renderer->d.sgbCharRam = renderer->backend->sgbCharRam;
renderer->d.sgbMapRam = renderer->backend->sgbMapRam;
renderer->d.sgbPalRam = renderer->backend->sgbPalRam;
renderer->d.sgbAttributeFiles = renderer->backend->sgbAttributeFiles;
renderer->d.sgbAttributes = renderer->backend->sgbAttributes;
renderer->d.vram = video->vram;
renderer->d.oam = &video->oam;
_init(renderer);

View File

@ -16,9 +16,6 @@ mLOG_DEFINE_CATEGORY(GB_STATE, "GB Savestate", "gb.serialize");
const uint32_t GB_SAVESTATE_MAGIC = 0x00400000;
const uint32_t GB_SAVESTATE_VERSION = 0x00000002;
static void GBSGBSerialize(struct GB* gb, struct GBSerializedState* state);
static void GBSGBDeserialize(struct GB* gb, const struct GBSerializedState* state);
void GBSerialize(struct GB* gb, struct GBSerializedState* state) {
STORE_32LE(GB_SAVESTATE_MAGIC + GB_SAVESTATE_VERSION, 0, &state->versionMagic);
STORE_32LE(gb->romCrc32, 0, &state->romCrc32);