diff --git a/code/CMakeModules/FindGLIB2.cmake b/code/CMakeModules/FindGLIB2.cmake new file mode 100644 index 000000000..942b04530 --- /dev/null +++ b/code/CMakeModules/FindGLIB2.cmake @@ -0,0 +1,217 @@ +# - Try to find GLib2 +# Once done this will define +# +# GLIB2_FOUND - system has GLib2 +# GLIB2_INCLUDE_DIRS - the GLib2 include directory +# GLIB2_LIBRARIES - Link these to use GLib2 +# +# HAVE_GLIB_GREGEX_H glib has gregex.h header and +# supports g_regex_match_simple +# +# Copyright (c) 2006 Andreas Schneider +# Copyright (c) 2006 Philippe Bernery +# Copyright (c) 2007 Daniel Gollub +# Copyright (c) 2007 Alban Browaeys +# Copyright (c) 2008 Michael Bell +# Copyright (c) 2008 Bjoern Ricks +# +# Redistribution and use is allowed according to the terms of the New +# BSD license. +# For details see the accompanying COPYING-CMAKE-SCRIPTS file. +# + + +IF (GLIB2_LIBRARIES AND GLIB2_INCLUDE_DIRS ) + # in cache already + SET(GLIB2_FOUND TRUE) +ELSE (GLIB2_LIBRARIES AND GLIB2_INCLUDE_DIRS ) + + INCLUDE(FindPkgConfig) + + ## Glib + IF ( GLIB2_FIND_REQUIRED ) + SET( _pkgconfig_REQUIRED "REQUIRED" ) + ELSE ( GLIB2_FIND_REQUIRED ) + SET( _pkgconfig_REQUIRED "" ) + ENDIF ( GLIB2_FIND_REQUIRED ) + + IF ( GLIB2_MIN_VERSION ) + PKG_SEARCH_MODULE( GLIB2 ${_pkgconfig_REQUIRED} glib-2.0>=${GLIB2_MIN_VERSION} ) + ELSE ( GLIB2_MIN_VERSION ) + PKG_SEARCH_MODULE( GLIB2 ${_pkgconfig_REQUIRED} glib-2.0 ) + ENDIF ( GLIB2_MIN_VERSION ) + IF ( PKG_CONFIG_FOUND ) + IF ( GLIB2_FOUND ) + SET ( GLIB2_CORE_FOUND TRUE ) + ELSE ( GLIB2_FOUND ) + SET ( GLIB2_CORE_FOUND FALSE ) + ENDIF ( GLIB2_FOUND ) + ENDIF ( PKG_CONFIG_FOUND ) + + # Look for glib2 include dir and libraries w/o pkgconfig + IF ( NOT GLIB2_FOUND AND NOT PKG_CONFIG_FOUND ) + FIND_PATH( + _glibconfig_include_DIR + NAMES + glibconfig.h + PATHS + /opt/gnome/lib64 + /opt/gnome/lib + /opt/lib/ + /opt/local/lib + /sw/lib/ + /usr/lib64 + /usr/lib + /usr/local/include + ${CMAKE_LIBRARY_PATH} + PATH_SUFFIXES + glib-2.0/include + ) + + FIND_PATH( + _glib2_include_DIR + NAMES + glib.h + PATHS + /opt/gnome/include + /opt/local/include + /sw/include + /usr/include + /usr/local/include + PATH_SUFFIXES + glib-2.0 + ) + + #MESSAGE(STATUS "Glib headers: ${_glib2_include_DIR}") + + FIND_LIBRARY( + _glib2_link_DIR + NAMES + glib-2.0 + glib + PATHS + /opt/gnome/lib + /opt/local/lib + /sw/lib + /usr/lib + /usr/local/lib + ) + IF ( _glib2_include_DIR AND _glib2_link_DIR ) + SET ( _glib2_FOUND TRUE ) + ENDIF ( _glib2_include_DIR AND _glib2_link_DIR ) + + + IF ( _glib2_FOUND ) + SET ( GLIB2_INCLUDE_DIRS ${_glib2_include_DIR} ${_glibconfig_include_DIR} ) + SET ( GLIB2_LIBRARIES ${_glib2_link_DIR} ) + SET ( GLIB2_CORE_FOUND TRUE ) + ELSE ( _glib2_FOUND ) + SET ( GLIB2_CORE_FOUND FALSE ) + ENDIF ( _glib2_FOUND ) + + # Handle dependencies + # libintl + IF ( NOT LIBINTL_FOUND ) + FIND_PATH(LIBINTL_INCLUDE_DIR + NAMES + libintl.h + PATHS + /opt/gnome/include + /opt/local/include + /sw/include + /usr/include + /usr/local/include + ) + + FIND_LIBRARY(LIBINTL_LIBRARY + NAMES + intl + PATHS + /opt/gnome/lib + /opt/local/lib + /sw/lib + /usr/local/lib + /usr/lib + ) + + IF (LIBINTL_LIBRARY AND LIBINTL_INCLUDE_DIR) + SET (LIBINTL_FOUND TRUE) + ENDIF (LIBINTL_LIBRARY AND LIBINTL_INCLUDE_DIR) + ENDIF ( NOT LIBINTL_FOUND ) + + # libiconv + IF ( NOT LIBICONV_FOUND ) + FIND_PATH(LIBICONV_INCLUDE_DIR + NAMES + iconv.h + PATHS + /opt/gnome/include + /opt/local/include + /opt/local/include + /sw/include + /sw/include + /usr/local/include + /usr/include + PATH_SUFFIXES + glib-2.0 + ) + + FIND_LIBRARY(LIBICONV_LIBRARY + NAMES + iconv + PATHS + /opt/gnome/lib + /opt/local/lib + /sw/lib + /usr/lib + /usr/local/lib + ) + + IF (LIBICONV_LIBRARY AND LIBICONV_INCLUDE_DIR) + SET (LIBICONV_FOUND TRUE) + ENDIF (LIBICONV_LIBRARY AND LIBICONV_INCLUDE_DIR) + ENDIF ( NOT LIBICONV_FOUND ) + + IF (LIBINTL_FOUND) + SET (GLIB2_LIBRARIES ${GLIB2_LIBRARIES} ${LIBINTL_LIBRARY}) + SET (GLIB2_INCLUDE_DIRS ${GLIB2_INCLUDE_DIRS} ${LIBINTL_INCLUDE_DIR}) + ENDIF (LIBINTL_FOUND) + + IF (LIBICONV_FOUND) + SET (GLIB2_LIBRARIES ${GLIB2_LIBRARIES} ${LIBICONV_LIBRARY}) + SET (GLIB2_INCLUDE_DIRS ${GLIB2_INCLUDE_DIRS} ${LIBICONV_INCLUDE_DIR}) + ENDIF (LIBICONV_FOUND) + + ENDIF ( NOT GLIB2_FOUND AND NOT PKG_CONFIG_FOUND ) + ## + + IF (GLIB2_CORE_FOUND AND GLIB2_INCLUDE_DIRS AND GLIB2_LIBRARIES) + SET (GLIB2_FOUND TRUE) + ENDIF (GLIB2_CORE_FOUND AND GLIB2_INCLUDE_DIRS AND GLIB2_LIBRARIES) + + IF (GLIB2_FOUND) + IF (NOT GLIB2_FIND_QUIETLY) + MESSAGE (STATUS "Found GLib2: ${GLIB2_LIBRARIES} ${GLIB2_INCLUDE_DIRS}") + ENDIF (NOT GLIB2_FIND_QUIETLY) + ELSE (GLIB2_FOUND) + IF (GLIB2_FIND_REQUIRED) + MESSAGE (SEND_ERROR "Could not find GLib2") + ENDIF (GLIB2_FIND_REQUIRED) + ENDIF (GLIB2_FOUND) + + # show the GLIB2_INCLUDE_DIRS and GLIB2_LIBRARIES variables only in the advanced view + MARK_AS_ADVANCED(GLIB2_INCLUDE_DIRS GLIB2_LIBRARIES) + MARK_AS_ADVANCED(LIBICONV_INCLUDE_DIR LIBICONV_LIBRARY) + MARK_AS_ADVANCED(LIBINTL_INCLUDE_DIR LIBINTL_LIBRARY) + +ENDIF (GLIB2_LIBRARIES AND GLIB2_INCLUDE_DIRS) + +IF ( GLIB2_FOUND ) + # Check if system has a newer version of glib + # which supports g_regex_match_simple + INCLUDE( CheckIncludeFiles ) + SET( CMAKE_REQUIRED_INCLUDES ${GLIB2_INCLUDE_DIRS} ) + CHECK_INCLUDE_FILES ( glib/gregex.h HAVE_GLIB_GREGEX_H ) + # Reset CMAKE_REQUIRED_INCLUDES + SET( CMAKE_REQUIRED_INCLUDES "" ) +ENDIF( GLIB2_FOUND ) diff --git a/code/CMakeModules/FindLIBGSF.cmake b/code/CMakeModules/FindLIBGSF.cmake new file mode 100644 index 000000000..8d749a87d --- /dev/null +++ b/code/CMakeModules/FindLIBGSF.cmake @@ -0,0 +1,57 @@ +# - Try to find libGSF +# +# Once done this will define +# +# LIBGSF_FOUND - System has LibGSF +# LIBGSF_INCLUDE_DIR - The LibGSF include directory +# LIBGSF_LIBRARIES - The libraries needed to use LibGSF +# LIBGSF_DEFINITIONS - Compiler switches required for using LibGSF +# LIBGSF_GSF_EXECUTABLE - The archive utility +# LIBGSF_GSFOFFICETHUMBNAILER_EXECUTABLE - The office files thumbnailer for the GNOME desktop +# LIBGSF_GSFVBADUMP_EXECUTABLE - The utility to extract Visual Basic for Applications macros + +# Copyright (c) 2009, Pau Garcia i Quiles +# Based off FindLibXml2.cmake from CMake 2.6.4 by Alexander Neundorf +# +# Redistribution and use is allowed according to the terms of the BSD license. +# For details see the accompanying COPYING-CMAKE-SCRIPTS file. + + +IF (LIBGSF_INCLUDE_DIR AND LIBGSF_LIBRARIES) + # in cache already + SET(LIBGSF_FIND_QUIETLY TRUE) +ENDIF (LIBGSF_INCLUDE_DIR AND LIBGSF_LIBRARIES) + +IF (NOT WIN32) + # use pkg-config to get the directories and then use these values + # in the FIND_PATH() and FIND_LIBRARY() calls + FIND_PACKAGE(PkgConfig) + PKG_CHECK_MODULES(PC_LIBGSF libgsf-1) + SET(LIBGSF_DEFINITIONS ${PC_LIBGSF_CFLAGS_OTHER}) +ENDIF (NOT WIN32) + +FIND_PATH(LIBGSF_INCLUDE_DIR gsf/gsf.h + HINTS + ${PC_LIBGSF_INCLUDEDIR} + ${PC_LIBGSF_INCLUDE_DIRS} + PATH_SUFFIXES libgsf-1 + ) + +FIND_LIBRARY(LIBGSF_LIBRARIES NAMES gsf-1 libgsf-1 + HINTS + ${PC_LIBGSF_LIBDIR} + ${PC_LIBGSF_LIBRARY_DIRS} + ) + +FIND_PROGRAM(LIBGSF_GSF_EXECUTABLE gsf) +FIND_PROGRAM(LIBGSF_GSFOFFICETHUMBNAILER_EXECUTABLE gsf-office-thumbnailer) +FIND_PROGRAM(LIBGSF_GSFVBADUMP_EXECUTABLE gsf-vba-dump) + +INCLUDE(FindPackageHandleStandardArgs) + +# handle the QUIETLY and REQUIRED arguments and set LIBGSF_FOUND to TRUE if +# all listed variables are TRUE +FIND_PACKAGE_HANDLE_STANDARD_ARGS(LIBGSF DEFAULT_MSG LIBGSF_LIBRARIES LIBGSF_INCLUDE_DIR) + +MARK_AS_ADVANCED(LIBGSF_INCLUDE_DIR LIBGSF_LIBRARIES LIBGSF_GSF_EXECUTABLE LIBGSF_GSFOFFICETHUMBNAILER_EXECUTABLE LIBGSF_GSFVBADUMP_EXECUTABLE ) + diff --git a/code/nel/tools/pipeline/CMakeLists.txt b/code/nel/tools/pipeline/CMakeLists.txt index 2c59968c1..4fd5f159a 100644 --- a/code/nel/tools/pipeline/CMakeLists.txt +++ b/code/nel/tools/pipeline/CMakeLists.txt @@ -1,4 +1,5 @@ SUBDIRS( + max_dump plugin_library plugin_nel plugin_max diff --git a/code/nel/tools/pipeline/max_dump/CMakeLists.txt b/code/nel/tools/pipeline/max_dump/CMakeLists.txt new file mode 100644 index 000000000..0a47ebab2 --- /dev/null +++ b/code/nel/tools/pipeline/max_dump/CMakeLists.txt @@ -0,0 +1,34 @@ + +FIND_PACKAGE(LIBGSF) + +IF (NOT (LIBGSF_INCLUDE_DIR AND LIBGSF_LIBRARIES)) + MESSAGE(FATAL_ERROR "LIBGSF not found!") +ENDIF (NOT (LIBGSF_INCLUDE_DIR AND LIBGSF_LIBRARIES)) + +FIND_PACKAGE(GLIB2) + +if (NOT GLIB2_FOUND) + MESSAGE(FATAL_ERROR "GLIB2 not found!") +ENDIF (NOT GLIB2_FOUND) + +INCLUDE_DIRECTORIES(${GLIB2_INCLUDE_DIRS}) +INCLUDE_DIRECTORIES(${LIBGSF_INCLUDE_DIR}) + +FILE(GLOB SRCS *.cpp) +FILE(GLOB HDRS *.h) + +ADD_EXECUTABLE(pipeline_max_dump + ${SRCS} + ${HDRS} + ) + +TARGET_LINK_LIBRARIES(pipeline_max_dump + ${LIBGSF_LIBRARIES} + ${GLIB2_LIBRARIES} +) + +NL_DEFAULT_PROPS(pipeline_max_dump "NeL, Tools, Pipeline: Max Dump (Temporary Tool)") +NL_ADD_RUNTIME_FLAGS(pipeline_max_dump) + +INSTALL(TARGETS pipeline_max_dump RUNTIME DESTINATION bin COMPONENT toolsmisc) + diff --git a/code/nel/tools/pipeline/max_dump/info.txt b/code/nel/tools/pipeline/max_dump/info.txt new file mode 100644 index 000000000..02e07b67d --- /dev/null +++ b/code/nel/tools/pipeline/max_dump/info.txt @@ -0,0 +1,72 @@ + + + +see: +http://area.autodesk.com/blogs/chris/reading_and_modifying_asset_file_paths_in_the_3ds_max_file +file:///usr/share/doc/libgsf-1-dev/html/gsf/api.html + + + +(max 3.x) +/srv/work/database/interfaces/anims_max/cp_fy_hof_species.max: +d 0 *root* +f 52 VideoPostQueue +f 2159653 Scene +f 1228 DllDirectory +f 18700 Config +f 3194 ClassDirectory3 +f 176 ClassData +f 34780 SummaryInformation +f 3352 DocumentSummaryInformation + +(max 2010) +/home/kaetemi/source/minimax/GE_Acc_MikotoBaniere.max: +d 0 *root* +f 52 VideoPostQueue +f 147230 Scene +f 366 FileAssetMetaData2 <- this is new in max2010! +f 2198 DllDirectory +f 29605 Config +f 3438 ClassDirectory3 +f 691 ClassData +f 29576 SummaryInformation +f 2320 DocumentSummaryInformation + + + +kaetemi@benzaiten ~/source/minimax/build $ gsf dump /home/kaetemi/source/minimax/GE_Acc_MikotoBaniere.max VideoPostQueue +VideoPostQueue +[ + 50 00 (id: 80) + 0a 00 00 00 (size: 10 - 6 = 4) + [ + 01 00 00 00 (value: 1) + ] +] +[ + 60 00 (id: 96) + 2a 00 00 80 (size: 42 - 6 = 36) (note: negative bit = container) + [ + 10 00 (id: 16) + 1e 00 00 00 (size: 30 - 6 = 24) + [ + 07 00 00 00 (value: 7) + 01 00 00 00 (value: 1) + 00 00 00 00 + 00 00 00 00 + 20 12 00 00 (value: 4610) + 00 00 00 00 + ] + 20 00 (id: 32) + 06 00 00 00 (size: 6 - 6 = 0) + ] +] + + + + + + + + + diff --git a/code/nel/tools/pipeline/max_dump/main.cpp b/code/nel/tools/pipeline/max_dump/main.cpp new file mode 100644 index 000000000..545595065 --- /dev/null +++ b/code/nel/tools/pipeline/max_dump/main.cpp @@ -0,0 +1,66 @@ + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +static const char *filename = "/srv/work/database/interfaces/anims_max/cp_fy_hof_species.max"; +//static const char *filename = "/home/kaetemi/source/minimax/GE_Acc_MikotoBaniere.max"; + +// int __stdcall WinMain(void *, void *, void *, int) +int main(int argc, char **argv) +{ + printf("Pipeline Max Dump (Temporary Tool)\n"); + + char const *me = (argv[0] ? argv[0] : "pipeline_max_dump"); + g_set_prgname(me); + gsf_init(); + + GsfInfile *infile; + GError *error = NULL; + GsfInput *src; + char *display_name; + + src = gsf_input_stdio_new(filename, &error); + + if (error) + { + display_name = g_filename_display_name(filename); + g_printerr (_("%s: Failed to open %s: %s\n"), + g_get_prgname (), + display_name, + error->message); + g_free(display_name); + return 1; + } + + infile = gsf_infile_msole_new(src, NULL); + + if (!infile) + { + display_name = g_filename_display_name(filename); + g_printerr (_("%s: Failed to recognize %s as an archive\n"), + g_get_prgname (), + display_name); + g_free (display_name); + return 1; + } + + display_name = g_filename_display_name(filename); + g_print("%s\n", display_name); + g_free(display_name); + + GsfInput *input = gsf_infile_child_by_name(infile, "DllDirectory"); + gsf_input_dump(input, 1); // just a regular hex dump of this input stream + + g_object_unref(input); + g_object_unref(infile); + + return 0; +} +