Skip to content

Commit ea8a652

Browse files
authored
Merge pull request #19 from thebest12dev/dev
v1.8.0
2 parents 7b63ebe + b7ce86f commit ea8a652

24 files changed

Lines changed: 395 additions & 140 deletions

CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,9 @@
1+
# v1.8.0 (2025-05-24)
2+
- Added containers
3+
- Added images
4+
- Added more modular XML processors
5+
- Bug fixes
6+
17
# v1.7.0 (2025-05-15)
28
- Added custom title bar (not accessible)
39
- Renamed CinnamonToast to Reflect

CMakeLists.txt

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ set(CMAKE_CXX_EXTENSIONS OFF)
88
message(STATUS "Generating files...")
99
message(STATUS "vcpkg toolchain location: ${CMAKE_TOOLCHAIN_FILE}")
1010
# Enable Hot Reload for MSVC compilers if supported.
11+
# Force static runtime
1112
if (POLICY CMP0141)
1213
cmake_policy(SET CMP0141 NEW)
1314
if (CMAKE_C_COMPILER_ID STREQUAL "MSVC" AND CMAKE_CXX_COMPILER_ID STREQUAL "MSVC")
@@ -17,16 +18,18 @@ if (POLICY CMP0141)
1718
endif()
1819
# Enable exceptions in MSVC
1920
if(MSVC)
20-
add_compile_options(/EHsc /Zc:__cplusplus)
21+
add_compile_options(/EHsc)
22+
add_compile_options(/MT /NODEFAULTLIB:libcmt)
2123
endif()
2224

2325
# Define the project
24-
set(TRIPLET "x64-windows")
26+
set(TRIPLET "x64-windows-static-md")
27+
set(VCPKG_TARGET_TRIPLET "x64-windows-static-md")
2528
project("cinnamontoast")
2629
set(CMAKE_GENERATOR_PLATFORM "x64")
2730

2831
enable_testing()
29-
32+
set(OPENSSL_USE_STATIC_LIBS TRUE)
3033
file(GLOB_RECURSE REFLECT_CORE "src/core/*.cpp" "src/core/*.h")
3134
file(GLOB_RECURSE REFLECT_NET "src/net/*.cpp" "src/net/*.h" )
3235
file(GLOB_RECURSE REFLECT_CRASHHANDLER "src/crash/*.cpp" "src/crash/*.h")
@@ -57,7 +60,7 @@ endif()
5760

5861
get_filename_component(VCPKG_DIR "${CMAKE_TOOLCHAIN_FILE}" DIRECTORY)
5962
set(VCPKG_DIR "${VCPKG_DIR}/../../")
60-
set(PKG_CONFIG_EXECUTABLE "${VCPKG_DIR}/installed/${TRIPLET}/tools/pkgconf/pkgconf.exe")
63+
set(PKG_CONFIG_EXECUTABLE "${VCPKG_DIR}/installed/x64-windows/tools/pkgconf/pkgconf.exe")
6164
set(LIB_FILE_DIR "${CMAKE_BINARY_DIR}/vcpkg_installed/${TRIPLET}/lib")
6265
set(JAVA_VERSION "21")
6366
set(JNI_INCLUDE_DIR "$ENV{JAVA_HOME}/include/win32" "$ENV{JAVA_HOME}/include")
@@ -88,6 +91,7 @@ else()
8891
add_library(Reflect STATIC ${REFLECT_CSTYLE}
8992
${REFLECT_CRASHHANDLER}
9093
${REFLECT_LUA}
94+
${REFLECT_JAVA}
9195
${REFLECT_NET} ${REFLECT_CORE} ${REFLECT_COMMONS_CORE}
9296
)
9397
target_compile_definitions(Reflect PRIVATE REFLECT_STATIC_LIBRARY=1)
@@ -159,13 +163,15 @@ set_target_properties(reflectw PROPERTIES LINK_FLAGS "/SUBSYSTEM:WINDOWS")
159163
add_executable(reflectt ${REFLECT_TEST})
160164
find_package(tinyxml2 CONFIG REQUIRED)
161165
find_package(GTest REQUIRED)
162-
find_package(OpenSSL REQUIRED)
166+
# find_package(OpenSSL CONFIG REQUIRED)
163167
find_package(GLEW REQUIRED)
164168
find_package(PkgConfig REQUIRED)
165169
pkg_check_modules(LUAJIT REQUIRED luajit)
166170

167171
set(LUAJIT_LIBRARIES "${LIB_FILE_DIR}/${LUAJIT_LIBRARIES}.lib")
172+
set(OPENSSL_LIBRARIES "${LIB_FILE_DIR}/libcrypto.lib" "${LIB_FILE_DIR}/libssl.lib" crypt32)
168173
message(STATUS "LuaJIT binaries: ${LUAJIT_LIBRARIES}")
174+
message(STATUS "OpenSSL binaries: ${OPENSSL_LIBRARIES}")
169175
file(GLOB DLL_FILE_DIR "${CMAKE_BINARY_DIR}/vcpkg_installed/${TRIPLET}/bin/*")
170176

171177
#foreach(file ${DLL_FILE_DIR})
@@ -183,7 +189,8 @@ if(DEFINED REFLECT_BUNDLE)
183189

184190
target_link_libraries(Reflect PRIVATE tinyxml2::tinyxml2 GLEW::GLEW)
185191
target_link_libraries(Reflect PRIVATE ${LUAJIT_LIBRARIES})
186-
target_link_libraries(Reflect PRIVATE OpenSSL::SSL ws2_32)
192+
target_link_libraries(Reflect PRIVATE ${OPENSSL_LIBRARIES} ws2_32)
193+
187194
else()
188195

189196
target_link_libraries(Reflect.CStyleAPI PRIVATE Reflect.Core)

src/api/cstyle/ReflectC.cpp

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@
2020
// Includes
2121
#include "ReflectC.h"
2222
#include "../../core/ReflectAPI.h"
23-
2423
// why do you need this really?
2524
using namespace reflect;
2625

@@ -65,4 +64,14 @@ REFLECT_API bool Reflect_setFontSize(ReflectComponent comp, uint8_t fontSize) {
6564
// font color sizing???
6665
external::setComponentFontSize(comp.id, fontSize);
6766
return true;
67+
};
68+
69+
REFLECT_API bool Reflect_run(ReflectComponent comp) {
70+
external::run(comp.id);
71+
return true;
72+
};
73+
74+
REFLECT_API bool Reflect_invoke(const char *location) {
75+
external::invoke(location);
76+
return true;
6877
};

src/api/cstyle/ReflectC.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -161,7 +161,8 @@ REFLECT_API bool Reflect_setFont(ReflectComponent comp, ReflectString font);
161161
* @return true if successful, false otherwise.
162162
*/
163163
REFLECT_API bool Reflect_setFontSize(ReflectComponent comp, uint8_t fontSize);
164-
164+
REFLECT_API bool Reflect_invoke(const char *location);
165+
REFLECT_API bool Reflect_run(ReflectComponent comp);
165166
// why do we need extern c really?
166167
#ifdef __cplusplus
167168
// end extern "C"

src/api/cstyle/ReflectCExtern.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -171,6 +171,8 @@ REFLECT_API bool Reflect_setFont(ReflectComponent comp, ReflectString font);
171171
* @return true if successful, false otherwise.
172172
*/
173173
REFLECT_API bool Reflect_setFontSize(ReflectComponent comp, uint8_t fontSize);
174+
REFLECT_API bool Reflect_invoke(const char *location);
175+
REFLECT_API bool Reflect_run(ReflectComponent comp);
174176
#ifdef __cplusplus
175177
// end extern "C"
176178
}

src/api/java/ReflectJava.c

Lines changed: 40 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,8 @@
1919
#include "ReflectJava.h"
2020
#include "../cstyle/ReflectCExtern.h"
2121
#include "ReflectJavaUtil.h"
22+
#include <Windows.h>
2223
#include <jni.h>
23-
2424
JNIEXPORT jint JNICALL JavaFunction(ReflectNative,
2525
getReferenceById)(JNI_PARAM_DECL,
2626
jstring id) {
@@ -53,3 +53,42 @@ JNIEXPORT void JNICALL JavaFunction(ReflectNative, addComp)(JNI_PARAM_DECL,
5353
comp2.id = (uint8_t)compRef;
5454
Reflect_addComponent(comp1, comp2);
5555
}
56+
57+
JNIEXPORT void JNICALL JavaFunction(ReflectNative, run)(JNI_PARAM_DECL,
58+
jint ref) {
59+
ReflectComponent comp1;
60+
comp1.id = ref;
61+
Reflect_run(comp1);
62+
}
63+
64+
JNIEXPORT void JNICALL Java_reflect4j_ReflectNative_invoke(JNIEnv *env,
65+
jclass clazz,
66+
jstring location) {
67+
68+
const char *utfChars = (*env)->GetStringUTFChars(env, location, NULL);
69+
if (utfChars == NULL)
70+
return; // Could not get string
71+
72+
// Call your real native function here with the C string
73+
Reflect_invoke(utfChars);
74+
75+
// Don't forget to release memory!
76+
(*env)->ReleaseStringUTFChars(env, location, utfChars);
77+
}
78+
JNIEXPORT jint JNICALL JNI_OnLoad(JavaVM *vm, void *reserved) {
79+
HMODULE hModule = NULL;
80+
81+
// Get handle to the current module (i.e., the DLL)
82+
if (GetModuleHandleEx(GET_MODULE_HANDLE_EX_FLAG_FROM_ADDRESS |
83+
GET_MODULE_HANDLE_EX_FLAG_UNCHANGED_REFCOUNT,
84+
(LPCSTR)&JNI_OnLoad, // any symbol in this DLL
85+
&hModule)) {
86+
// Manually increase the refcount
87+
wchar_t dllPath[MAX_PATH];
88+
if (GetModuleFileNameW(hModule, dllPath, MAX_PATH)) {
89+
LoadLibraryW(dllPath); // increments refcount, keeps DLL loaded
90+
}
91+
}
92+
93+
return JNI_VERSION_1_8;
94+
}

src/api/java/ReflectJava.h

Lines changed: 15 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/api/lua/ReflectLua.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
#include "ReflectLua.h"
2-
32
namespace reflect {
43

54
// Constructor

src/api/lua/ReflectLua.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,9 +24,9 @@
2424

2525
// Include Lua headers
2626
extern "C" {
27-
#include "lauxlib.h"
28-
#include "lua.h"
29-
#include "lualib.h"
27+
#include "luajit/lua.h"
28+
#include "luajit/lualib.h"
29+
#include <luajit/lauxlib.h>
3030
}
3131
// Include C++ headers
3232
#include "TypeDefinitions.h"

src/common/ConsoleHelper.cpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,13 @@
2222
#include "../core/logging/LogInstance.h"
2323
namespace {
2424
// Indicates whether debug logging is enabled.
25+
26+
#ifdef _DEBUG
27+
bool debugEnabled = true;
28+
#else
2529
bool debugEnabled = false;
30+
#endif
31+
2632
} // namespace
2733

2834
namespace reflect {

0 commit comments

Comments
 (0)