Integrate upstream changes.

Signed-off-by: Andrea Odetti <mariofutire@gmail.com>
This commit is contained in:
Andrea Odetti 2020-12-12 19:57:04 +00:00
parent 1b40c217f4
commit 62c8b61a6b
4 changed files with 6 additions and 30 deletions

View file

@ -31,7 +31,7 @@ void VideoBenchmark(std::function<void()> redraw, std::function<void()> refresh)
// GOING ON, CHANGING HALF OF THE BYTES IN THE VIDEO BUFFER EACH FRAME TO
// SIMULATE THE ACTIVITY OF AN AVERAGE GAME
g_uVideoMode = VF_HIRES;
FillMemory(mem+0x2000,0x2000,0x14);
memset(mem+0x2000,0x14,0x2000);
redraw();
typedef std::chrono::microseconds interval_t;
@ -43,9 +43,9 @@ void VideoBenchmark(std::function<void()> redraw, std::function<void()> refresh)
auto start = std::chrono::steady_clock::now();
do {
if (totalhiresfps & 1)
FillMemory(mem+0x2000,0x2000,0x14);
memset(mem+0x2000,0x14,0x2000);
else
CopyMemory(mem+0x2000,mem+((totalhiresfps & 2) ? 0x4000 : 0x6000),0x2000);
memcpy(mem+0x2000,mem+((totalhiresfps & 2) ? 0x4000 : 0x6000),0x2000);
refresh();
totalhiresfps++;
@ -123,7 +123,7 @@ void VideoBenchmark(std::function<void()> redraw, std::function<void()> refresh)
// WITH FULL EMULATION OF THE CPU, JOYSTICK, AND DISK HAPPENING AT
// THE SAME TIME
counter_t realisticfps = 0;
FillMemory(mem+0x2000,0x2000,0xAA);
memset(mem+0x2000,0xAA,0x2000);
redraw();
const size_t dwClksPerFrame = NTSC_GetCyclesPerFrame();
@ -145,9 +145,9 @@ void VideoBenchmark(std::function<void()> redraw, std::function<void()> refresh)
{
cyclesThisFrame -= dwClksPerFrame;
if (realisticfps & 1)
FillMemory(mem+0x2000,0x2000,0xAA);
memset(mem+0x2000,0xAA,0x2000);
else
CopyMemory(mem+0x2000,mem+((realisticfps & 2) ? 0x4000 : 0x6000),0x2000);
memcpy(mem+0x2000,mem+((realisticfps & 2) ? 0x4000 : 0x6000),0x2000);
realisticfps++;
refresh();
}

View file

@ -2,7 +2,6 @@
#include "linux/windows/wincompat.h"
#include "linux/windows/guiddef.h"
#include "linux/windows/memory.h"
#include "linux/windows/handles.h"
#include "linux/windows/bitmap.h"
#include "linux/windows/files.h"

View file

@ -1,17 +0,0 @@
#include "linux/windows/memory.h"
#include <cstdlib>
LPVOID VirtualAlloc(LPVOID lpAddress, size_t dwSize,
DWORD flAllocationType, DWORD flProtect) {
/* just malloc and alles? 0_0 */
void* mymemory = realloc(lpAddress, dwSize);
if (flAllocationType & MEM_COMMIT)
ZeroMemory(mymemory, dwSize); // original VirtualAlloc does this (if..)
return mymemory;
}
BOOL VirtualFree(LPVOID lpAddress, size_t dwSize,
DWORD dwFreeType) {
free(lpAddress);
return TRUE;
}

View file

@ -1,6 +0,0 @@
#pragma once
#define MoveMemory(Destination,Source,Length) memmove((Destination),(Source),(Length))
#define FillMemory(Destination,Length,Fill) memset((Destination),(Fill),(Length))
#define EqualMemory(Destination,Source,Length) (!memcmp((Destination),(Source),(Length)))
#define CopyMemory(Destination,Source,Length) memcpy((Destination),(Source),(Length))