mirror of
https://github.com/open-goal/jak-project.git
synced 2024-10-20 11:26:18 -04:00
5b44aece75
* delete unused shaders * hide some options in debug menu * change fullscreen logic a bit * add "all actors" toggle * borderless fix and fix alpha in direct renderer untextured (do we need a separate shader for that?) * fix fuel cell orbit icons in widescreen * fix `curve` types * refs * fix levitator task... * fix some task stuff * update font code a bit (temp) * cmake, third-party and visual studio overhaul * Update .gitmodules * update modules * clone repos * fix encoding in zydis * where did these come from * try again * add submodule * Update 11zip * Update 11zip * Update 11zip * delete * try again * clang * update compiler flags * delete 11zip. go away. * Create memory-dump-p2s.py * properly * fix minimum architecture c++ compiler flags * fix zydis * oops * Update all-types.gc * fix clang-cl tests * make "all actors" work better, entity debug qol * update game-text conversion code to be more modularized * Create vendor.txt * fix typos and minor things * update refs * clang * Attempt to add clang-cl support to vs2019 and CI * vs2022 + clang-cl * srsly? fix clang build * Update launch.vs.json * extend windows CI timer
35 lines
1.5 KiB
C++
35 lines
1.5 KiB
C++
#include "gtest/gtest.h"
|
|
#include "common/common_types.h"
|
|
#include "third-party/zydis/include/Zydis/Zydis.h"
|
|
|
|
TEST(Zydis, Basic) {
|
|
// int3, return
|
|
u8 code[] = {0xcc, 0xc3};
|
|
ZydisDecoder decoder;
|
|
ZydisDecoderInit(&decoder, ZYDIS_MACHINE_MODE_LONG_64, ZYDIS_STACK_WIDTH_64);
|
|
ZydisFormatter formatter;
|
|
ZydisFormatterInit(&formatter, ZYDIS_FORMATTER_STYLE_INTEL);
|
|
|
|
ZydisDecodedInstruction instr;
|
|
ZydisDecodedOperand op[ZYDIS_MAX_OPERAND_COUNT_VISIBLE];
|
|
|
|
// should get first instruction
|
|
EXPECT_TRUE(ZYAN_SUCCESS(ZydisDecoderDecodeFull(&decoder, code, 2, &instr, op,
|
|
ZYDIS_MAX_OPERAND_COUNT_VISIBLE,
|
|
ZYDIS_DFLAG_VISIBLE_OPERANDS_ONLY)));
|
|
char result[256];
|
|
ZydisFormatterFormatInstruction(&formatter, &instr, op, instr.operand_count_visible, result,
|
|
sizeof(result), 0);
|
|
EXPECT_EQ(std::string("int3"), result);
|
|
EXPECT_EQ(1, instr.length);
|
|
|
|
// should get second instruction
|
|
EXPECT_TRUE(ZYAN_SUCCESS(ZydisDecoderDecodeFull(&decoder, code + 1, 1, &instr, op,
|
|
ZYDIS_MAX_OPERAND_COUNT_VISIBLE,
|
|
ZYDIS_DFLAG_VISIBLE_OPERANDS_ONLY)));
|
|
ZydisFormatterFormatInstruction(&formatter, &instr, op, instr.operand_count_visible, result,
|
|
sizeof(result), 0);
|
|
EXPECT_EQ(std::string("ret"), result);
|
|
EXPECT_EQ(1, instr.length);
|
|
}
|