2019-06-04 02:27:45 +00:00
|
|
|
#include <windows.h>
|
|
|
|
|
|
|
|
#include <assert.h>
|
|
|
|
#include <stdbool.h>
|
|
|
|
#include <stddef.h>
|
2021-05-23 15:54:24 +00:00
|
|
|
#include <stdlib.h>
|
2019-06-04 02:27:45 +00:00
|
|
|
|
2021-05-23 15:54:24 +00:00
|
|
|
#include "board/aime-dll.h"
|
2019-06-04 02:27:45 +00:00
|
|
|
#include "board/config.h"
|
2019-11-06 00:40:00 +00:00
|
|
|
#include "board/sg-reader.h"
|
2024-02-06 11:34:11 +00:00
|
|
|
#include "board/vfd.h"
|
2019-06-04 02:27:45 +00:00
|
|
|
|
2023-12-17 18:43:00 +00:00
|
|
|
#include "util/dprintf.h"
|
|
|
|
|
|
|
|
// Check windows
|
|
|
|
#if _WIN32 || _WIN64
|
|
|
|
#if _WIN64
|
|
|
|
#define ENV64BIT
|
|
|
|
#else
|
|
|
|
#define ENV32BIT
|
|
|
|
#endif
|
|
|
|
#endif
|
|
|
|
|
|
|
|
// Check GCC
|
|
|
|
#if __GNUC__
|
|
|
|
#if __x86_64__ || __ppc64__
|
|
|
|
#define ENV64BIT
|
|
|
|
#else
|
|
|
|
#define ENV32BIT
|
|
|
|
#endif
|
|
|
|
#endif
|
|
|
|
|
2021-05-23 15:54:24 +00:00
|
|
|
static void aime_dll_config_load(struct aime_dll_config *cfg, const wchar_t *filename)
|
|
|
|
{
|
|
|
|
assert(cfg != NULL);
|
|
|
|
assert(filename != NULL);
|
|
|
|
|
2023-12-17 18:43:00 +00:00
|
|
|
// Workaround for x64/x86 external IO dlls
|
|
|
|
// path32 for 32bit, path64 for 64bit
|
|
|
|
// for else.. is that possible? idk
|
|
|
|
|
|
|
|
if (cfg->path64) {
|
|
|
|
#if defined(ENV32BIT)
|
|
|
|
// Always empty, due to amdaemon being 64 bit in 32 bit mode
|
|
|
|
memset(cfg->path, 0, sizeof(cfg->path));
|
|
|
|
#elif defined(ENV64BIT)
|
|
|
|
GetPrivateProfileStringW(
|
|
|
|
L"aimeio",
|
|
|
|
L"path",
|
|
|
|
L"",
|
|
|
|
cfg->path,
|
|
|
|
_countof(cfg->path),
|
|
|
|
filename);
|
|
|
|
#else
|
|
|
|
#error "Unknown environment"
|
|
|
|
#endif
|
|
|
|
} else {
|
|
|
|
GetPrivateProfileStringW(
|
2021-05-23 15:54:24 +00:00
|
|
|
L"aimeio",
|
|
|
|
L"path",
|
|
|
|
L"",
|
|
|
|
cfg->path,
|
|
|
|
_countof(cfg->path),
|
|
|
|
filename);
|
2023-12-17 18:43:00 +00:00
|
|
|
}
|
2021-05-23 15:54:24 +00:00
|
|
|
}
|
|
|
|
|
2019-06-04 02:27:45 +00:00
|
|
|
void aime_config_load(struct aime_config *cfg, const wchar_t *filename)
|
|
|
|
{
|
|
|
|
assert(cfg != NULL);
|
|
|
|
assert(filename != NULL);
|
|
|
|
|
2021-05-23 15:54:24 +00:00
|
|
|
aime_dll_config_load(&cfg->dll, filename);
|
2019-06-04 02:27:45 +00:00
|
|
|
cfg->enable = GetPrivateProfileIntW(L"aime", L"enable", 1, filename);
|
2024-01-16 16:54:06 +00:00
|
|
|
cfg->high_baudrate = GetPrivateProfileIntW(L"aime", L"highBaud", 1, filename);
|
2023-12-03 17:45:42 +00:00
|
|
|
cfg->gen = GetPrivateProfileIntW(L"aime", L"gen", 0, filename);
|
2019-06-04 02:27:45 +00:00
|
|
|
}
|
2020-10-07 17:26:12 +00:00
|
|
|
|
|
|
|
void io4_config_load(struct io4_config *cfg, const wchar_t *filename)
|
|
|
|
{
|
|
|
|
assert(cfg != NULL);
|
|
|
|
assert(filename != NULL);
|
|
|
|
|
|
|
|
cfg->enable = GetPrivateProfileIntW(L"io4", L"enable", 1, filename);
|
|
|
|
}
|
2024-02-06 11:34:11 +00:00
|
|
|
|
|
|
|
void vfd_config_load(struct vfd_config *cfg, const wchar_t *filename)
|
|
|
|
{
|
|
|
|
assert(cfg != NULL);
|
|
|
|
assert(filename != NULL);
|
|
|
|
|
|
|
|
cfg->enable = GetPrivateProfileIntW(L"vfd", L"enable", 1, filename);
|
2024-08-23 14:30:22 +00:00
|
|
|
cfg->port = GetPrivateProfileIntW(L"vfd", L"portNo", 1, filename);
|
|
|
|
cfg->utf_conversion = GetPrivateProfileIntW(L"vfd", L"utfConversion", 0, filename);
|
2024-02-06 11:34:11 +00:00
|
|
|
}
|