Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -45,4 +45,4 @@ include( "cmake/simpleinstall.cmake" )
add_subdirectory( "plugins/vpExamplePlugin" )
add_subdirectory( "plugins/vpGLView" )
add_subdirectory( "plugins/vpHalfLifeAlpha" )
add_subdirectory( "utils/pluginrunner" )
add_subdirectory( "utils/jmftools" )
104 changes: 104 additions & 0 deletions utils/jmftools/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,104 @@
#-----------------------------------------------------------------------------
# jmftools
#
# Project Script
#-----------------------------------------------------------------------------

cmake_minimum_required( VERSION 3.20 FATAL_ERROR )

include( "${SRCDIR}/sdk/JackPluginSDK.cmake" )

set( JMFTOOLS_SOURCE_FILES )
BEGIN_SRC( JMFTOOLS_SOURCE_FILES "Source Files" )
SRC_GRP(
SOURCES
#{
"logger.cpp"
"main.cpp"
"math.cpp"
"mem.cpp"

"${SRCDIR}/plugins/common/DataSerializer.cpp"
"${SRCDIR}/plugins/common/vstdlib_static.cpp"
#}
)

SRC_GRP(
SUBGROUP "Map Objects"
SOURCES
#{
"mapbrush.cpp"
"mapcamera.cpp"
"mapentity.cpp"
"mapface.cpp"
"mapgroup.cpp"
"mappath.cpp"
"mapworld.cpp"
#}
)

SRC_GRP(
SUBGROUP "Serializers"
SOURCES
#{
"serializer_jmf.cpp"
"serializer_map.cpp"
#}
)
END_SRC( JMFTOOLS_SOURCE_FILES "Source Files" )

set( JMFTOOLS_HEADER_FILES )
BEGIN_SRC( JMFTOOLS_HEADER_FILES "Header Files" )
SRC_GRP(
SOURCES
#{
"logger.h"
"math.h"
"mem.h"

"${SRCDIR}/plugins/common/DataSerializer.h"
"${SRCDIR}/plugins/common/vstdlib_static.h"
#}
)

SRC_GRP(
SUBGROUP "Map Objects"
SOURCES
#{
"mapbrush.h"
"mapcamera.h"
"mapentity.h"
"mapface.h"
"mapgroup.h"
"mappath.h"
"mapworld.h"
#}
)

SRC_GRP(
SUBGROUP "Serializers"
SOURCES
#{
"serializer_jmf.h"
"serializer_map.h"
#}
)
END_SRC( JMFTOOLS_HEADER_FILES "Header Files" )

add_executable(
jmftools
${JMFTOOLS_SOURCE_FILES} ${JMFTOOLS_HEADER_FILES}
)

install_library(
TARGET jmftools EXECUTABLE
INSTALL_DEST "${CMAKE_INSTALL_PREFIX}"
)

target_include_directories(
jmftools PRIVATE

"${SRCDIR}/plugins/common"
)

target_use_jackpluginsdk( jmftools "${SRCDIR}/sdk" )
126 changes: 126 additions & 0 deletions utils/jmftools/logger.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,126 @@
//=====================================================================================//
//
// Purpose: JMFTools
//
// Author(-s): SanyaSho (2026)
//
//=====================================================================================//

#include <stdio.h>
#include <stdarg.h>

#if defined( WIN32 )
#define WIN32_LEAN_AND_MEAN
#define NOMINMAX
#include <Windows.h>
#endif // WIN32

/*
===============
Sys_Printf
===============
*/
void Sys_Printf( const char *format, ... )
{
if ( !format )
{
return;
}

static char buf[2048] = { 0 };

va_list argptr;
va_start( argptr, format );
vsnprintf( buf, sizeof( buf ), format, argptr );
va_end( argptr );

#if defined( WIN32 )
OutputDebugString( buf );
OutputDebugString( "\n" );
#endif // WIN32

printf( "%s\n", buf );
}

/*
===============
Sys_DPrintf
===============
*/
void Sys_DPrintf( const char *format, ... )
{
if ( !format )
{
return;
}

static char buf[2048] = { 0 };

va_list argptr;
va_start( argptr, format );
vsnprintf( buf, sizeof( buf ), format, argptr );
va_end( argptr );

#if defined( WIN32 )
OutputDebugString( buf );
OutputDebugString( "\n" );
#endif // WIN32

printf( "%s\n", buf );
}

/*
===============
Sys_Warning
===============
*/
void Sys_Warning( const char *format, ... )
{
if ( !format )
{
return;
}

static char buf[2048] = { 0 };

va_list argptr;
va_start( argptr, format );
vsnprintf( buf, sizeof( buf ), format, argptr );
va_end( argptr );

#if defined( WIN32 )
OutputDebugString( "WARNING: " );
OutputDebugString( buf );
OutputDebugString( "\n" );
#endif // WIN32

printf( "WARNING: %s\n", buf );
}

/*
===============
Sys_Error
===============
*/
void Sys_Error( const char *format, ... )
{
if ( !format )
{
return;
}

static char buf[2048] = { 0 };

va_list argptr;
va_start( argptr, format );
vsnprintf( buf, sizeof( buf ), format, argptr );
va_end( argptr );

#if defined( WIN32 )
OutputDebugString( "ERROR: " );
OutputDebugString( buf );
OutputDebugString( "\n" );
#endif // WIN32

printf( "ERROR: %s\n", buf );
}
17 changes: 17 additions & 0 deletions utils/jmftools/logger.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
//=====================================================================================//
//
// Purpose: JMFTools
//
// Author(-s): SanyaSho (2026)
//
//=====================================================================================//

#if !defined( LOGGER_H )
#define LOGGER_H

extern void Sys_Printf( const char *format, ... );
extern void Sys_DPrintf( const char *format, ... );
extern void Sys_Warning( const char *format, ... );
extern void Sys_Error( const char *format, ... );

#endif // !LOGGER_H
Loading