spiegel-keyman/developer/src/kmcmpdll/versioning.cpp
Marc Durdin 39d473fb2d refactor(developer): move comperr.h to kmn_compiler_errors.h
Consolidates the two copies of comperr.h (they were identical) and
moves to a common folder. Updates all references to comperr.h, except
for one github commit ref.
2023-04-20 13:20:29 +07:00

28 lines
750 B
C++

#include "pch.h"
#include <compfile.h>
#include <kmn_compiler_errors.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;
}