Bemanitools v5.26 release

This commit is contained in:
icex2
2019-09-27 22:36:50 +02:00
commit cbd7720349
718 changed files with 62731 additions and 0 deletions
+66
View File
@@ -0,0 +1,66 @@
testexes += iidxhook-util-config-eamuse-test
srcdir_iidxhook-util-config-eamuse-test := src/test/iidxhook-util
ldflags_iidxhook-util-config-eamuse-test := \
-lws2_32 \
libs_iidxhook-util-config-eamuse-test := \
security \
iidxhook-util \
cconfig \
test \
util \
src_iidxhook-util-config-eamuse-test := \
iidxhook-util-config-eamuse-test.c \
################################################################################
testexes += iidxhook-util-config-gfx-test
srcdir_iidxhook-util-config-gfx-test := src/test/iidxhook-util
libs_iidxhook-util-config-gfx-test := \
security \
iidxhook-util \
cconfig \
test \
util \
src_iidxhook-util-config-gfx-test := \
iidxhook-util-config-gfx-test.c \
################################################################################
testexes += iidxhook-util-config-misc-test
srcdir_iidxhook-util-config-misc-test := src/test/iidxhook-util
libs_iidxhook-util-config-misc-test := \
security \
iidxhook-util \
cconfig \
test \
util \
src_iidxhook-util-config-misc-test := \
iidxhook-util-config-misc-test.c \
################################################################################
testexes += iidxhook-util-config-sec-test
srcdir_iidxhook-util-config-sec-test := src/test/iidxhook-util
libs_iidxhook-util-config-sec-test := \
security \
iidxhook-util \
cconfig \
test \
util \
src_iidxhook-util-config-sec-test := \
iidxhook-util-config-sec-test.c \
################################################################################
@@ -0,0 +1,86 @@
#include "iidxhook-util/config-eamuse.h"
#include "test/check.h"
#include "test/test.h"
/* We don't care about cleaning up some of the memory to avoid cluttering
the tests */
static void test_config_eamuse_defaults()
{
struct cconfig* config;
struct iidxhook_util_config_eamuse config_eamuse;
config = cconfig_init();
iidxhook_util_config_eamuse_init(config);
iidxhook_util_config_eamuse_get(&config_eamuse, config);
cconfig_finit(config);
check_str_eq(config_eamuse.card_type, "C02");
check_str_eq(net_addr_to_str(&config_eamuse.server), "localhost:80");
check_str_eq(security_id_to_str(&config_eamuse.pcbid, false),
"0101020304050607086F");
check_str_eq(security_id_to_str(&config_eamuse.eamid, false),
"0101020304050607086F");
}
static void test_config_eamuse()
{
struct cconfig* config;
struct iidxhook_util_config_eamuse config_eamuse;
config = cconfig_init();
iidxhook_util_config_eamuse_init(config);
cconfig_set2(config, "eamuse.card_type", "D01");
cconfig_set2(config, "eamuse.server", "http://myServer.com/legacy");
cconfig_set2(config, "eamuse.pcbid", "0101020304050607086F");
cconfig_set2(config, "eamuse.eamid", "0101020304050607086F");
iidxhook_util_config_eamuse_get(&config_eamuse, config);
cconfig_finit(config);
check_str_eq(config_eamuse.card_type, "D01");
check_str_eq(net_addr_to_str(&config_eamuse.server),
"http://myServer.com/legacy");
check_str_eq(security_id_to_str(&config_eamuse.pcbid, false),
"0101020304050607086F");
check_str_eq(security_id_to_str(&config_eamuse.eamid, false),
"0101020304050607086F");
}
static void test_config_eamuse_invalid_values()
{
struct cconfig* config;
struct iidxhook_util_config_eamuse config_eamuse;
config = cconfig_init();
iidxhook_util_config_eamuse_init(config);
cconfig_set2(config, "eamuse.card_type", "XXXX");
cconfig_set2(config, "eamuse.server", "asdf");
cconfig_set2(config, "eamuse.pcbid", "00000000000000000000");
cconfig_set2(config, "eamuse.eamid", "00000000000000000000");
iidxhook_util_config_eamuse_get(&config_eamuse, config);
cconfig_finit(config);
check_str_eq(config_eamuse.card_type, "C02");
check_str_eq(net_addr_to_str(&config_eamuse.server), "asdf");
check_str_eq(security_id_to_str(&config_eamuse.pcbid, false),
"00000000000000000000");
check_str_eq(security_id_to_str(&config_eamuse.eamid, false),
"00000000000000000000");
}
TEST_MODULE_BEGIN("iidxhook-config-eamuse")
TEST_MODULE_TEST(test_config_eamuse_defaults)
TEST_MODULE_TEST(test_config_eamuse)
TEST_MODULE_TEST(test_config_eamuse_invalid_values)
TEST_MODULE_END()
@@ -0,0 +1,107 @@
#include "iidxhook-util/config-gfx.h"
#include "test/check.h"
#include "test/test.h"
/* We don't care about cleaning up some of the memory to avoid cluttering
the tests */
static void test_config_gfx_defaults()
{
struct cconfig* config;
struct iidxhook_config_gfx config_gfx;
config = cconfig_init();
iidxhook_config_gfx_init(config);
iidxhook_config_gfx_get(&config_gfx, config);
cconfig_finit(config);
check_bool_false(config_gfx.bgvideo_uv_fix);
check_bool_false(config_gfx.framed);
check_float_eq(config_gfx.frame_rate_limit, 0.0f, 0.1f);
check_float_eq(config_gfx.monitor_check, -1.0f, 0.1f);
check_int_eq(config_gfx.pci_id_vid, 0x1002);
check_int_eq(config_gfx.pci_id_pid, 0x7146);
check_bool_false(config_gfx.windowed);
check_int_eq(config_gfx.scale_back_buffer_width, 0);
check_int_eq(config_gfx.scale_back_buffer_height, 0);
check_int_eq(config_gfx.scale_back_buffer_width, D3D9_BACK_BUFFER_SCALE_FILTER_NONE);
}
static void test_config_gfx()
{
struct cconfig* config;
struct iidxhook_config_gfx config_gfx;
config = cconfig_init();
iidxhook_config_gfx_init(config);
cconfig_set2(config, "gfx.bgvideo_uv_fix", "true");
cconfig_set2(config, "gfx.framed", "true");
cconfig_set2(config, "gfx.frame_rate_limit", "60.04");
cconfig_set2(config, "gfx.monitor_check", "59.999");
cconfig_set2(config, "gfx.pci_id", "1111:1234");
cconfig_set2(config, "gfx.windowed", "true");
cconfig_set2(config, "gfx.scale_back_buffer_width", "1920");
cconfig_set2(config, "gfx.scale_back_buffer_height", "1080");
cconfig_set2(config, "gfx.scale_back_buffer_filter", "linear");
iidxhook_config_gfx_get(&config_gfx, config);
cconfig_finit(config);
check_bool_true(config_gfx.bgvideo_uv_fix);
check_bool_true(config_gfx.framed);
check_float_eq(config_gfx.frame_rate_limit, 60.04f, 0.1f);
check_float_eq(config_gfx.monitor_check, 59.999f, 0.001f);
check_int_eq(config_gfx.pci_id_vid, 0x1111);
check_int_eq(config_gfx.pci_id_pid, 0x1234);
check_bool_true(config_gfx.windowed);
check_int_eq(config_gfx.scale_back_buffer_width, 1920);
check_int_eq(config_gfx.scale_back_buffer_height, 1080);
check_int_eq(config_gfx.scale_back_buffer_filter, D3D9_BACK_BUFFER_SCALE_FILTER_LINEAR);
}
static void test_config_gfx_invalid_values()
{
struct cconfig* config;
struct iidxhook_config_gfx config_gfx;
config = cconfig_init();
iidxhook_config_gfx_init(config);
cconfig_set2(config, "gfx.bgvideo_uv_fix", "123");
cconfig_set2(config, "gfx.framed", "aaa");
cconfig_set2(config, "gfx.frame_rate_limit", "-1.0f");
cconfig_set2(config, "gfx.monitor_check", "asdf");
cconfig_set2(config, "gfx.pci_id", "11111234");
cconfig_set2(config, "gfx.windowed", "-5");
cconfig_set2(config, "gfx.scale_back_buffer_width", "asdf");
cconfig_set2(config, "gfx.scale_back_buffer_height", "");
cconfig_set2(config, "gfx.scale_back_buffer_filter", "ffff");
iidxhook_config_gfx_get(&config_gfx, config);
cconfig_finit(config);
check_bool_false(config_gfx.bgvideo_uv_fix);
check_bool_false(config_gfx.framed);
check_float_eq(config_gfx.frame_rate_limit, 0.0f, 0.1f);
check_float_eq(config_gfx.monitor_check, -1.0f, 0.1f);
check_int_eq(config_gfx.pci_id_vid, 0x1002);
check_int_eq(config_gfx.pci_id_pid, 0x7146);
check_bool_false(config_gfx.windowed);
check_int_eq(config_gfx.scale_back_buffer_width, 0);
check_int_eq(config_gfx.scale_back_buffer_height, 0);
check_int_eq(config_gfx.scale_back_buffer_width, D3D9_BACK_BUFFER_SCALE_FILTER_NONE);
}
TEST_MODULE_BEGIN("iidxhook-config-gfx")
TEST_MODULE_TEST(test_config_gfx_defaults)
TEST_MODULE_TEST(test_config_gfx)
TEST_MODULE_TEST(test_config_gfx_invalid_values)
TEST_MODULE_END()
@@ -0,0 +1,68 @@
#include "iidxhook-util/config-misc.h"
#include "test/check.h"
#include "test/test.h"
/* We don't care about cleaning up some of the memory to avoid cluttering the tests */
static void test_config_misc_defaults()
{
struct cconfig* config;
struct iidxhook_config_misc config_misc;
config = cconfig_init();
iidxhook_config_misc_init(config);
iidxhook_config_misc_get(&config_misc, config);
cconfig_finit(config);
check_bool_false(config_misc.disable_clock_set);
check_bool_false(config_misc.rteffect_stub);
}
static void test_config_misc()
{
struct cconfig* config;
struct iidxhook_config_misc config_misc;
config = cconfig_init();
iidxhook_config_misc_init(config);
cconfig_set2(config, "misc.disable_clock_set", "true");
cconfig_set2(config, "misc.rteffect_stub", "true");
iidxhook_config_misc_get(&config_misc, config);
cconfig_finit(config);
check_bool_true(config_misc.disable_clock_set);
check_bool_true(config_misc.rteffect_stub);
}
static void test_config_misc_invalid_values()
{
struct cconfig* config;
struct iidxhook_config_misc config_misc;
config = cconfig_init();
iidxhook_config_misc_init(config);
cconfig_set2(config, "misc.disable_clock_set", "asdf");
cconfig_set2(config, "misc.rteffect_stub", "222");
iidxhook_config_misc_get(&config_misc, config);
cconfig_finit(config);
check_bool_false(config_misc.disable_clock_set);
check_bool_false(config_misc.rteffect_stub);
}
TEST_MODULE_BEGIN("iidxhook-config-misc")
TEST_MODULE_TEST(test_config_misc_defaults)
TEST_MODULE_TEST(test_config_misc)
TEST_MODULE_TEST(test_config_misc_invalid_values)
TEST_MODULE_END()
@@ -0,0 +1,82 @@
#include "iidxhook-util/config-sec.h"
#include "test/check.h"
#include "test/test.h"
/* We don't care about cleaning up some of the memory to avoid cluttering the tests */
static void test_config_sec_defaults()
{
struct cconfig* config;
struct iidxhook_config_sec config_sec;
const uint32_t boot_seeds[3] = {0, 0, 0};
config = cconfig_init();
iidxhook_config_sec_init(config);
iidxhook_config_sec_get(&config_sec, config);
cconfig_finit(config);
check_str_eq(security_mcode_to_str(&config_sec.boot_version), "GEC02 ");
check_data_eq(config_sec.boot_seeds, sizeof(config_sec.boot_seeds),
(void*) boot_seeds, sizeof(boot_seeds));
check_str_eq(security_mcode_to_str(&config_sec.black_plug_mcode),
"GQC02JAA");
}
static void test_config_sec()
{
struct cconfig* config;
struct iidxhook_config_sec config_sec;
const uint32_t boot_seeds[3] = {1, 1, 1};
config = cconfig_init();
iidxhook_config_sec_init(config);
cconfig_set2(config, "sec.boot_version", "ASDFG ");
cconfig_set2(config, "sec.boot_seeds", "1:1:1");
cconfig_set2(config, "sec.black_plug_mcode", "GQD01JAB");
iidxhook_config_sec_get(&config_sec, config);
cconfig_finit(config);
check_str_eq(security_mcode_to_str(&config_sec.boot_version), "ASDFG ");
check_data_eq(config_sec.boot_seeds, sizeof(config_sec.boot_seeds),
(void*) boot_seeds, sizeof(boot_seeds));
check_str_eq(security_mcode_to_str(&config_sec.black_plug_mcode),
"GQD01JAB");
}
static void test_config_sec_invalid_values()
{
struct cconfig* config;
struct iidxhook_config_sec config_sec;
const uint32_t boot_seeds[3] = {0, 0, 0};
config = cconfig_init();
iidxhook_config_sec_init(config);
cconfig_set2(config, "sec.boot_version", "ASDFG1234");
cconfig_set2(config, "sec.boot_seeds", "1:11");
cconfig_set2(config, "sec.black_plug_mcode", "GQD01JABA");
iidxhook_config_sec_get(&config_sec, config);
cconfig_finit(config);
check_str_eq(security_mcode_to_str(&config_sec.boot_version), "GEC02 ");
check_data_eq(config_sec.boot_seeds, sizeof(config_sec.boot_seeds),
(void*) boot_seeds, sizeof(boot_seeds));
check_str_eq(security_mcode_to_str(&config_sec.black_plug_mcode),
"GQC02JAA");
}
TEST_MODULE_BEGIN("iidxhook-config-sec")
TEST_MODULE_TEST(test_config_sec_defaults)
TEST_MODULE_TEST(test_config_sec)
TEST_MODULE_TEST(test_config_sec_invalid_values)
TEST_MODULE_END()