Files
nt-lite/code/video/video.c
T

87 lines
2.4 KiB
C

#include <stdint.h>
#include <stddef.h>
#include <string.h>
#include <intrin.h>
#include "bink.h"
void OutputDebugStringA(const char* s);
_Noreturn void ExitProcess(unsigned int code);
void* HeapAlloc(void* heap, unsigned long flags, size_t size);
void BitBlt(int x, int y, int w, int h, const uint32_t* pixels);
void* CreateFileA(const char* name, unsigned long access,
unsigned long share, void* sa,
unsigned long disp, unsigned long flags,
void* templ);
unsigned long GetFileSize(void* handle, unsigned long* high);
int ReadFile(void* handle, void* buf, unsigned long toRead,
unsigned long* read, void* overlapped);
int main() {
OutputDebugStringA("video: starting\n");
// void* f = CreateFileA("video.bk2", 0, 0, 0, 3, 0, 0);
// if (!f) {
// OutputDebugStringA("video: failed to open video.bk2\n");
// ExitProcess(1);
// }
// unsigned long s = GetFileSize(f, 0);
// void* buf = HeapAlloc(0, 0, s);
// if (!buf) {
// OutputDebugStringA("video: HeapAlloc failed\n");
// ExitProcess(1);
// }
// int r = ReadFile(f, buf, s, 0, 0);
// if (!r) {
// OutputDebugStringA("video: ReadFile failed\n");
// ExitProcess(1);
// }
// OutputDebugStringA("video: video.bk2 loaded\n");
// HBINK bink = BinkOpen(buf, BINKFROMMEMORY);
// if (!bink) {
// OutputDebugStringA("video: BinkOpen failed: ");
// OutputDebugStringA(BinkGetError());
// OutputDebugStringA("\n");
// ExitProcess(1);
// }
// uint32_t width = bink->Width;
// uint32_t height = bink->Height;
// uint32_t* fb = HeapAlloc(0, 0, width * height * sizeof(uint32_t));
// if (!fb) {
// OutputDebugStringA("video: framebuffer alloc failed\n");
// ExitProcess(1);
// }
// while (1) {
// if (BinkWait(bink)) {
// _mm_pause();
// continue;
// }
// BinkDoFrame(bink);
// if (BinkShouldSkip(bink)) {
// BinkNextFrame(bink);
// BinkDoFrame(bink);
// continue;
// }
// BinkCopyToBuffer(bink, fb, width * 4, height, 0, 0, BINKSURFACE32);
// BitBlt(0, 0, width, height, fb);
// if (bink->FrameNum == bink->Frames)
// break;
// BinkNextFrame(bink);
// }
// BinkClose(bink);
for (int i = 0; i < 10000000; i++) _mm_pause();
OutputDebugStringA("video: done\n");
ExitProcess(0);
}