Skip to content

Commit

Permalink
version 1.2.0
Browse files Browse the repository at this point in the history
  • Loading branch information
Icer Addis committed May 23, 2021
1 parent 87d739e commit b38b996
Show file tree
Hide file tree
Showing 101 changed files with 8,734 additions and 12,910 deletions.
75 changes: 70 additions & 5 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,9 @@ cmake_minimum_required(VERSION 3.4.1)
project(m1lkdr0p LANGUAGES C CXX)


if (NOT EMSCRIPTEN)
find_package(ZLIB REQUIRED)
endif()

if (ZLIB_FOUND)
include_directories(${ZLIB_INCLUDE_DIRS})
Expand All @@ -27,26 +29,39 @@ set(EXTERNAL_DIR ${CMAKE_CURRENT_SOURCE_DIR}/external)
set(IMGUI_SOURCE_DIR ${EXTERNAL_DIR}/imgui)
set(LZMA_SOURCE_DIR ${EXTERNAL_DIR}/lzma1801/C)


#
# add hlsl2glslfork
#
add_subdirectory(${EXTERNAL_DIR}/hlsl2glslfork)

#
# add minizip
#
# option(USE_AES "enables building of aes library" ON)
SET(USE_AES OFF CACHE BOOL "" FORCE)
add_subdirectory(${EXTERNAL_DIR}/minizip)

#
# add OVRSDK
#
if (OVR)
## OVR library
set(OVR_ROOT_DIR ${EXTERNAL_DIR}/ovr_sdk_mobile_1.45.0)
set(VRAPI_LIB_BUILD_TYPE Release)
set(VRAPI_LIB_PATH "${OVR_ROOT_DIR}/VrApi/Libs/Android/${ANDROID_ABI}/${VRAPI_LIB_BUILD_TYPE}/libvrapi.so")
add_library(vrapi SHARED IMPORTED GLOBAL)
set_target_properties(vrapi PROPERTIES IMPORTED_LOCATION ${VRAPI_LIB_PATH})
endif()

# set(CMAKE_CXX_FLAGS_DEBUG "-g -DANDROID_CONFIG_DEBUG")
# set(CMAKE_CXX_FLAGS_RELEASE "-O2 -DANDROID_CONFIG_RELEASE")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fno-rtti -fno-exceptions -Wall -Wno-reorder -Wno-deprecated-register -Wno-self-assign -Wno-c++11-narrowing ")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wno-reorder -Wno-deprecated-register -Wno-self-assign -Wno-c++11-narrowing -Wno-misleading-indentation ")

set(IMGUI_SOURCE
${IMGUI_SOURCE_DIR}/imgui.cpp
${IMGUI_SOURCE_DIR}/imgui_draw.cpp
${IMGUI_SOURCE_DIR}/imgui_widgets.cpp
${IMGUI_SOURCE_DIR}/imgui_demo.cpp
${IMGUI_SOURCE_DIR}/imgui_tables.cpp
${COMMON_SOURCE_DIR}/imgui_support.cpp
)

set(LZMA_SOURCE
Expand Down Expand Up @@ -90,6 +105,7 @@ set(MDP_SOURCE
${COMMON_SOURCE_DIR}/ImageWriter.cpp
${COMMON_SOURCE_DIR}/VizController.cpp
${COMMON_SOURCE_DIR}/TProfiler.cpp
${COMMON_SOURCE_DIR}/imgui_support.cpp
${COMMON_SOURCE_DIR}/vis_milk2/fft.cpp
${COMMON_SOURCE_DIR}/vis_milk2/milkdropfs.cpp
${COMMON_SOURCE_DIR}/vis_milk2/plugin.cpp
Expand Down Expand Up @@ -121,6 +137,7 @@ set(LIBS
)

set(INCLUDE_DIRS
${IMGUI_SOURCE_DIR}
${COMMON_SOURCE_DIR}
${COMMON_SOURCE_DIR}/script
${COMMON_SOURCE_DIR}/script/mdp-eel2
Expand Down Expand Up @@ -166,6 +183,54 @@ if (APPLE)

set_property (TARGET ${CMAKE_PROJECT_NAME} APPEND_STRING PROPERTY COMPILE_FLAGS "-fobjc-arc")

elseif (EMSCRIPTEN)


include_directories(
${INCLUDE_DIRS}
)

SET(APP_NAME ${CMAKE_PROJECT_NAME} )

SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -s USE_ZLIB -Wno-deprecated-register")

add_executable(${APP_NAME}
${MDP_SOURCE}
${LZMA_SOURCE}
${IMGUI_SOURCE}
${COMMON_SOURCE_DIR}/render/context_gles.cpp
${APP_SOURCE_DIR}/emscripten/emscripten_main.cpp
)

# Include libraries needed for lib
target_link_libraries(${APP_NAME}
${LIBS}
)

set(SHELL_FILE ${CMAKE_SOURCE_DIR}/app/emscripten/shell_minimal.html )

set_target_properties(${APP_NAME} PROPERTIES LINK_FLAGS
"--preload-file ${CMAKE_SOURCE_DIR}/assets@/assets \
--shell-file ${SHELL_FILE} \
-emrun \
-s TOTAL_MEMORY=536870912 \
-s LLD_REPORT_UNDEFINED \
-s DEMANGLE_SUPPORT=1 \
-s WASM=1 \
-s ASSERTIONS=1 \
-s USE_WEBGL2=1 \
-s USE_SDL=2 \
-s MIN_WEBGL_VERSION=2 \
-s MAX_WEBGL_VERSION=2 \
-s DISABLE_DEPRECATED_FIND_EVENT_TARGET_BEHAVIOR=1 \
-mnontrapping-fptoint \
-lopenal"
)

set(CMAKE_EXECUTABLE_SUFFIX ".html")
# set_target_properties(${APP_NAME} PROPERTIES OUTPUT_NAME "m1lkdr0p.html")




elseif (UNIX)
Expand Down
161 changes: 62 additions & 99 deletions Milkdrop.xcodeproj/project.pbxproj

Large diffs are not rendered by default.

5 changes: 0 additions & 5 deletions app/CommonApple/Visualizer.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,6 @@

-(void)draw:(int)screenId screenCount:(int)screenCount;

-(void)onKeyDown:(KeyEvent)e;
-(void)onKeyUp:(KeyEvent)e;

-(void)onDragDrop:(NSArray * _Nonnull)files;

-(bool)shouldQuit;
Expand All @@ -34,8 +31,6 @@
//-(void)drawInDebugScreen;
//-(void)drawInExternalScreen;
//
//-(void)onKeyDown:(KeyEvent)e;
//-(void)onKeyUp:(KeyEvent)e;
//
//-(void)onDragDrop:(NSArray * _Nonnull)files;

Expand Down
12 changes: 0 additions & 12 deletions app/CommonApple/Visualizer.mm
Original file line number Diff line number Diff line change
Expand Up @@ -50,18 +50,6 @@ -(bool)shouldQuit
}


-(void)onKeyDown:(KeyEvent)e
{
_vizController->OnKeyDown(e);
}

-(void)onKeyUp:(KeyEvent)e
{
_vizController->OnKeyUp(e);

}


-(void)onDragDrop:(NSArray * _Nonnull)files
{
for (int i=0; i < files.count; i++)
Expand Down
2 changes: 1 addition & 1 deletion app/OSX/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleShortVersionString</key>
<string>1.0.0</string>
<string>$(MARKETING_VERSION)</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
Expand Down
28 changes: 22 additions & 6 deletions app/OSX/RenderViewControllerOSX.mm
Original file line number Diff line number Diff line change
Expand Up @@ -44,14 +44,21 @@ @implementation RenderViewControllerOSX

- (void)keyDown:(NSEvent *)event
{
PROFILE_FUNCTION()
PROFILE_FUNCTION_CAT("input")

KeyEvent ke = ConvertKeyEvent(event);
[self.visualizer onKeyDown:ke];

ImGuiIO& io = ImGui::GetIO();
io.KeyCtrl = ke.KeyCtrl;
io.KeyShift = ke.KeyShift;
io.KeyAlt = ke.KeyAlt;
io.KeySuper = ke.KeyCommand;
if (ke.code != 0)
{
io.KeysDown[ke.code] = true;
}


ImGuiIO& io = ImGui::GetIO();
NSString* str = event.characters;
int len = (int)[str length];
for (int i = 0; i < len; i++)
Expand All @@ -67,7 +74,16 @@ - (void)keyUp:(NSEvent *)event
PROFILE_FUNCTION_CAT("input")

KeyEvent ke = ConvertKeyEvent(event);
[self.visualizer onKeyUp:ke];

ImGuiIO& io = ImGui::GetIO();
io.KeyCtrl = ke.KeyCtrl;
io.KeyShift = ke.KeyShift;
io.KeyAlt = ke.KeyAlt;
io.KeySuper = ke.KeyCommand;
if (ke.code != 0)
{
io.KeysDown[ke.code] = false;
}
}


Expand Down Expand Up @@ -259,7 +275,7 @@ - (void)drawInGLView:(GLView * _Nonnull)view
@autoreleasepool {
PROFILE_FRAME()

ImGui_ImplOSX_NewFrame();
ImGui_ImplOSX_NewFrame(view);


// [view bindDrawable];
Expand Down Expand Up @@ -296,7 +312,7 @@ - (void)drawInMTKView:(nonnull MTKView *)view
@autoreleasepool {
PROFILE_FRAME()

ImGui_ImplOSX_NewFrame();
ImGui_ImplOSX_NewFrame(view);



Expand Down
19 changes: 13 additions & 6 deletions app/OSX/console_main.mm
Original file line number Diff line number Diff line change
Expand Up @@ -45,16 +45,23 @@ int main(int argc, const char * argv[])
std::string userDir= "user";


std::string firstPreset = "Standard/Aderrasi - Visitor";
// std::string firstPreset = "Standard/Aderrasi - Visitor";


auto vizController = CreateVizController(context, pluginDir, userDir);

printf("1\n");
vizController->SelectPreset(firstPreset);
printf("2\n");
vizController->SetSelectionLock(true);
printf("3\n");
vizController->TestAllPresets(
[](std::string name, std::string error) {

}

);

// printf("1\n");
// vizController->SelectPreset(firstPreset);
// printf("2\n");
// vizController->SetSelectionLock(true);
// printf("3\n");

return 0;
}
Loading

0 comments on commit b38b996

Please sign in to comment.