Skip to content

Commit

Permalink
Add standalone SDK test project
Browse files Browse the repository at this point in the history
  • Loading branch information
praydog committed Aug 30, 2023
1 parent e5b7289 commit b1a86e7
Show file tree
Hide file tree
Showing 3 changed files with 99 additions and 0 deletions.
41 changes: 41 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -639,6 +639,47 @@ target_link_libraries(example_plugin PUBLIC
unset(CMKR_TARGET)
unset(CMKR_SOURCES)

unset(CMKR_TARGET)
unset(CMKR_SOURCES)

# Target sdk-test
set(CMKR_TARGET sdk-test)
set(sdk-test_SOURCES "")

list(APPEND sdk-test_SOURCES
"side-projects/sdk-test/Main.cpp"
)

list(APPEND sdk-test_SOURCES
cmake.toml
)

set(CMKR_SOURCES ${sdk-test_SOURCES})
add_library(sdk-test SHARED)

if(sdk-test_SOURCES)
target_sources(sdk-test PRIVATE ${sdk-test_SOURCES})
endif()

source_group(TREE ${CMAKE_CURRENT_SOURCE_DIR} FILES ${sdk-test_SOURCES})

target_compile_features(sdk-test PUBLIC
cxx_std_23
)

target_include_directories(sdk-test PUBLIC
"shared/"
"include/"
)

target_link_libraries(sdk-test PUBLIC
kananlib
sdk
)

unset(CMKR_TARGET)
unset(CMKR_SOURCES)

# Target vr-plugin-nullifier
set(CMKR_TARGET vr-plugin-nullifier)
set(vr-plugin-nullifier_SOURCES "")
Expand Down
11 changes: 11 additions & 0 deletions cmake.toml
Original file line number Diff line number Diff line change
Expand Up @@ -169,6 +169,17 @@ type = "plugin"
sources = ["examples/example_plugin/**.cpp", "examples/example_plugin/**.c"]
headers = ["examples/example_plugin/**.hpp", "examples/example_plugin/**.h"]

[target.sdk-test]
type = "shared"
sources = ["side-projects/sdk-test/**.cpp", "side-projects/sdk-test/**.c"]
headers = ["side-projects/sdk-test/**.hpp", "side-projects/sdk-test/**.h"]
include-directories = ["shared/", "include/"]
compile-features = ["cxx_std_23"]
link-libraries = [
"kananlib",
"sdk"
]

[target.vr-plugin-nullifier]
type = "shared"
sources = ["vr-plugin-nullifier/**.cpp", "vr-plugin-nullifier/**.c"]
Expand Down
47 changes: 47 additions & 0 deletions side-projects/sdk-test/Main.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
#include <windows.h>

#include <utility/Module.hpp>
#include <utility/Scan.hpp>
#include <utility/Patch.hpp>
#include <utility/Thread.hpp>

#include <spdlog/spdlog.h>
#include <spdlog/sinks/stdout_sinks.h>

#include <sdk/UObjectArray.hpp>

#define SPAWN_CONSOLE

void startup_thread() {
// Spawn a debug console
#ifdef SPAWN_CONSOLE
AllocConsole();
freopen("CONOUT$", "w", stdout);
#endif

// Set up spdlog to sink to the console
spdlog::set_pattern("[%H:%M:%S] [%^%l%$] [iostore-standalone] %v");
spdlog::set_level(spdlog::level::info);
spdlog::flush_on(spdlog::level::info);
spdlog::set_default_logger(spdlog::stdout_logger_mt("console"));

SPDLOG_INFO("Test!");

sdk::FName::get_constructor();
sdk::FName::get_to_string();
sdk::FUObjectArray::get();

SPDLOG_INFO("Test finished!");
}

BOOL APIENTRY DllMain(HMODULE module, DWORD reason_for_call, LPVOID reserved) {
switch (reason_for_call)
{
case DLL_PROCESS_ATTACH:
//CreateThread(nullptr, 0, (LPTHREAD_START_ROUTINE)startup_thread, nullptr, 0, nullptr);
startup_thread();
break;
}

return TRUE;
}

0 comments on commit b1a86e7

Please sign in to comment.