spiegel-keyman/developer/src/kmcmpdll/versioning.cpp
Marc Durdin e5b31669af chore(developer): move and rename compiler.h
The name compiler.h was misleading, so renamed to legacy_kmx_file.h, as
it largely describes .kmx files. There are two declarations in the file
which are specific to kmcmpdll, at the bottom of the file, but
everything else is all related to the .kmx file format. (We may move
those in a future update to kmcmpdll, but that should wait until the
kmcmpdll cross-platform refactor is complete.)

Moved to common/windows/cpp/include/ because it is used by both
Developer and Windows projects.

Where possible, removed redundant references, as compfile.h includes
legacy_kmx_file.h anyway.
2022-06-12 06:31:38 +10:00

28 lines
738 B
C++

#include "pch.h"
#include <compfile.h>
#include <comperr.h>
#include <kmcmpdll.h>
BOOL CheckKeyboardFinalVersion(PFILE_KEYBOARD fk) {
char buf[128];
if (fk->dwFlags & KF_AUTOMATICVERSION) {
if (fk->version <= 0) {
fk->version = VERSION_60; // minimum version that we can be safe with
}
wsprintf(buf, "The compiler has assigned a minimum engine version of %d.%d based on features used in this keyboard", (int)((fk->version & 0xFF00) >> 8), (int)(fk->version & 0xFF));
AddCompileString(buf);
}
return TRUE;
}
BOOL VerifyKeyboardVersion(PFILE_KEYBOARD fk, DWORD ver) {
if (fk->dwFlags & KF_AUTOMATICVERSION) {
fk->version = max(fk->version, ver);
return TRUE;
}
return fk->version >= ver;
}