feat: implement M2 emulator foundation
This commit is contained in:
@@ -1,5 +1,31 @@
|
||||
#include "native_smoke.h"
|
||||
#include "session_rules.h"
|
||||
#include "video_buffer.h"
|
||||
|
||||
int main() {
|
||||
return neslite::native_protocol_version() == neslite::kNativeProtocolVersion ? 0 : 1;
|
||||
using neslite::SessionState;
|
||||
if (neslite::native_protocol_version() != neslite::kNativeProtocolVersion) return 1;
|
||||
if (!neslite::command_allowed(SessionState::Paused, "run")) return 2;
|
||||
if (neslite::command_allowed(SessionState::Running, "run")) return 3;
|
||||
if (!neslite::command_allowed(SessionState::Running, "pause")) return 4;
|
||||
if (neslite::command_allowed(SessionState::Loading, "reset")) return 5;
|
||||
if (!neslite::command_targets_active_session(9, 9)) return 6;
|
||||
if (neslite::command_targets_active_session(10, 9)) return 7;
|
||||
if (neslite::command_targets_active_session(0, 0)) return 8;
|
||||
if (!neslite::required_host_capabilities_available(1, 1, true)) return 16;
|
||||
if (neslite::required_host_capabilities_available(2, 1, true)) return 17;
|
||||
if (neslite::required_host_capabilities_available(1, 1, false)) return 18;
|
||||
neslite::VideoBuffer video;
|
||||
const unsigned char padded[] = {1, 2, 3, 4, 99, 99, 5, 6, 7, 8, 99, 99};
|
||||
if (!video.submit(padded, 2, 2, 6, 2, 2)) return 9;
|
||||
neslite::VideoFrame frame;
|
||||
if (!video.latest(&frame) || frame.pitch != 4 || frame.bytes.size() != 8) return 10;
|
||||
if (static_cast<unsigned char>(frame.bytes[4]) != 5) return 11;
|
||||
const auto first_sequence = frame.sequence;
|
||||
if (video.submit(nullptr, 2, 2, 4, 2, 2)) return 12;
|
||||
if (!video.latest(&frame) || frame.sequence != first_sequence) return 13;
|
||||
const unsigned char replacement[] = {9, 10, 11, 12};
|
||||
if (!video.submit(replacement, 2, 1, 4, 2, 2)) return 14;
|
||||
if (!video.latest(&frame) || frame.sequence != first_sequence + 1 || frame.height != 1) return 15;
|
||||
return 0;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user