Fixed playback memory use, adding super offroad and improved testing

This commit is contained in:
Sergio Martin 2024-01-13 07:04:22 +01:00
parent 1952f8a622
commit b36822dfaa
8 changed files with 182212 additions and 6 deletions

View File

@ -15,7 +15,6 @@ struct stepData_t
{
std::string input;
uint8_t* stateData;
int32_t curBlit[BLIT_SIZE];
hash_t hash;
};
@ -30,7 +29,6 @@ class PlaybackInstance
step.stateData = (uint8_t*) malloc(_emu->getStateSize());
_emu->serializeState(step.stateData);
step.hash = _emu->getStateHash();
saveBlit(_emu->getInternalEmulator(), step.curBlit, hqn::HQNState::NES_VIDEO_PALETTE, 0, 0, 0, 0);
// Adding the step into the sequence
_stepSequence.push_back(step);
@ -148,8 +146,23 @@ class PlaybackInstance
if (step.input.find("D") != std::string::npos) overlayButtonDownSurface = _overlayButtonDownSurface;
}
// Since we do not store the blit information (too much memory), we need to load the previous frame and re-run the input
// If its the first step, then simply reset
if (stepId == 0) _emu->getInternalEmulator()->reset();
// Else we load the previous frame
if (stepId > 0)
{
const auto stateData = getStateData(stepId-1);
_emu->deserializeState(stateData);
_emu->advanceState(getStateInput(stepId-1));
}
// Updating image
_hqnGUI->update_blit(step.curBlit, _overlayBaseSurface, overlayButtonASurface, overlayButtonBSurface, overlayButtonSelectSurface, overlayButtonStartSurface, overlayButtonLeftSurface, overlayButtonRightSurface, overlayButtonUpSurface, overlayButtonDownSurface);
int32_t curBlit[BLIT_SIZE];
saveBlit(_emu->getInternalEmulator(), curBlit, hqn::HQNState::NES_VIDEO_PALETTE, 0, 0, 0, 0);
_hqnGUI->update_blit(curBlit, _overlayBaseSurface, overlayButtonASurface, overlayButtonBSurface, overlayButtonSelectSurface, overlayButtonStartSurface, overlayButtonLeftSurface, overlayButtonRightSurface, overlayButtonUpSurface, overlayButtonDownSurface);
}
size_t getSequenceLength() const

View File

@ -99,6 +99,7 @@ int main(int argc, char *argv[])
printf("[] Sequence File: '%s'\n", sequenceFilePath.c_str());
printf("[] Sequence Length: %lu\n", sequenceLength);
printf("[] State Size: %lu bytes\n", stateSize);
printf("[] Running Test...\n");
fflush(stdout);

View File

@ -1,6 +1,4 @@
nomalloc = environment({'MALLOC_PERTURB_': '0'})
# Castlevania 1 Tests
game = 'castlevania1'
goal = 'anyPercent'
test(goal, tester, workdir : meson.current_source_dir(), args : [ goal + '.test'], suite: [ game, goal ])
test(goal, tester, workdir : meson.current_source_dir(), args : [ goal + '.test'], suite: [ game, goal ])

View File

@ -1 +1,4 @@
nomalloc = environment({'MALLOC_PERTURB_': '0'})
subdir('castlevania1')
subdir('superOffroad')

Binary file not shown.

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,7 @@
{
"Rom File": "Ivan 'Ironman' Stewart's Super Off Road (USA).nes",
"Expected ROM SHA1": "57919B685B55EE3ED3AD98FB1D25626B98BE7D39",
"Initial State File": "",
"Verification State File": "anyPercent.final.state",
"Sequence File": "anyPercent.sol"
}

View File

@ -0,0 +1,4 @@
# Ivan 'Ironman' Stewart's Super Off Road (USA) Tests
game = 'superOffroad'
goal = 'anyPercent'
test(goal, tester, workdir : meson.current_source_dir(), args : [ goal + '.test'], suite: [ game, goal ])