Skip to content

Commit

Permalink
update to ns-eel2
Browse files Browse the repository at this point in the history
  • Loading branch information
afedchin committed Dec 25, 2017
1 parent 9ddf9b1 commit fa670f5
Show file tree
Hide file tree
Showing 26 changed files with 13,949 additions and 671 deletions.
7 changes: 7 additions & 0 deletions depends/windows/nasmw/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
cmake_minimum_required(VERSION 2.8)
project(nasmw)

install(
DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/
DESTINATION ${CMAKE_INSTALL_PREFIX}/bin
)
1 change: 1 addition & 0 deletions depends/windows/nasmw/nasmw.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
nasmw http://www.nasm.us/pub/nasm/releasebuilds/2.12.02/win32/nasm-2.12.02-win32.zip
4 changes: 2 additions & 2 deletions lib/vis_milkdrop/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ set(SOURCES dx11/CommonStates.cpp
state.cpp
support.cpp)

add_subdirectory(evallib)
add_subdirectory(ns-eel2)

if(CORE_SYSTEM_NAME STREQUAL windowsstore)
add_definitions(-D_WIN32_WINNT=0x0A00 -D_WINDOWS)
Expand All @@ -53,4 +53,4 @@ endif()
remove_definitions(-D_USE_32BIT_TIME_T)
add_library(vis_milkdrop STATIC ${SOURCES} ${SHADER_INCLUDES})

target_link_libraries(vis_milkdrop evallib)
target_link_libraries(vis_milkdrop ns-eel2)
47 changes: 21 additions & 26 deletions lib/vis_milkdrop/milkdropfs.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,9 @@ OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include "plugin.h"
//#include "resource.h"
#include "support.h"
#include "evallib\eval.h" // for math. expr. eval - thanks Francis! (in SourceOffSite, it's the 'vis_avs\evallib' project.)
#include "evallib\compiler.h"
//#include "evallib\eval.h" // for math. expr. eval - thanks Francis! (in SourceOffSite, it's the 'vis_avs\evallib' project.)
//#include "evallib\compiler.h"
#include "ns-eel2/ns-eel.h"
#include "utility.h"

#include <stdlib.h>
Expand Down Expand Up @@ -79,9 +80,10 @@ int g_title_font_sizes[] =
// function changes the control Word to set them and returns
// TRUE, putting the old control Word value in the passback
// location pointed to by pwOldCW.
BOOL MungeFPCW( WORD *pwOldCW )
void MungeFPCW( WORD *pwOldCW )
{
BOOL ret = FALSE;
#if 0
BOOL ret = FALSE;
WORD wTemp, wSave;

__asm fstcw wSave
Expand All @@ -102,13 +104,21 @@ BOOL MungeFPCW( WORD *pwOldCW )
}
if (pwOldCW) *pwOldCW = wSave;
return ret;
#else
#ifndef _WIN64
_controlfp(_PC_24, _MCW_PC); // single precision (not supported on x64 see MSDN)
#endif // !_WIN64
_controlfp(_RC_NEAR, _MCW_RC); // round to nearest mode
_controlfp(_EM_ZERODIVIDE, _EM_ZERODIVIDE); // disable divide-by-zero
#endif
}


#if 0
void RestoreFPCW(WORD wSave)
{
__asm fldcw wSave
__asm fldcw wSave
}
#endif // 0

int GetNumToSpawn(float fTime, float fDeltaT, float fRate, float fRegularity, int iNumSpawnedSoFar)
{
Expand Down Expand Up @@ -596,12 +606,10 @@ void CPlugin::RunPerFrameEquations()
#ifndef _NO_EXPR_
if (pState->m_pf_codehandle)
{
resetVars(pState->m_pf_vars);
if (pState->m_pf_codehandle)
{
executeCode(pState->m_pf_codehandle);
NSEEL_code_execute(pState->m_pf_codehandle);
}
resetVars(NULL);
}
#endif

Expand Down Expand Up @@ -1435,8 +1443,6 @@ void CPlugin::WarpedBlitFromVS0ToVS1()
else
pState = m_pOldState;

resetVars(pState->m_pv_vars);

// cache the doubles as floats so that computations are a bit faster
float fZoom = (float)(*pState->var_pf_zoom);
float fZoomExp = (float)(*pState->var_pf_zoomexp);
Expand Down Expand Up @@ -1499,7 +1505,7 @@ void CPlugin::WarpedBlitFromVS0ToVS1()
//*pState->var_pv_treb_att = *pState->var_pv_treb_att;

#ifndef _NO_EXPR_
executeCode(pState->m_pp_codehandle);
NSEEL_code_execute(pState->m_pp_codehandle);
#endif

fZoom = (float)(*pState->var_pv_zoom);
Expand Down Expand Up @@ -1584,7 +1590,6 @@ void CPlugin::WarpedBlitFromVS0ToVS1()
pState->q_values_after_init_code[7] = *pState->var_pv_q8;
*/

resetVars(NULL);
}


Expand Down Expand Up @@ -1676,9 +1681,7 @@ void CPlugin::DrawCustomShapes()
#ifndef _NO_EXPR_
if (pState->m_shape[i].m_pf_codehandle)
{
resetVars(pState->m_shape[i].m_pf_vars);
executeCode(pState->m_shape[i].m_pf_codehandle);
resetVars(NULL);
NSEEL_code_execute(pState->m_shape[i].m_pf_codehandle);
}
#endif

Expand Down Expand Up @@ -1980,7 +1983,7 @@ void CPlugin::DrawCustomWaves()
*pState->m_wave[i].var_pp_mid_att = *pState->m_wave[i].var_pf_mid_att;
*pState->m_wave[i].var_pp_treb_att = *pState->m_wave[i].var_pf_treb_att;

executeCode(pState->m_wave[i].m_pf_codehandle);
NSEEL_code_execute(pState->m_wave[i].m_pf_codehandle);

*pState->m_wave[i].var_pp_q1 = *pState->m_wave[i].var_pf_q1;
*pState->m_wave[i].var_pp_q2 = *pState->m_wave[i].var_pf_q2;
Expand All @@ -2001,10 +2004,6 @@ void CPlugin::DrawCustomWaves()

// 2. for each point, execute per-point code

#ifndef _NO_EXPR_
resetVars(pState->m_wave[i].m_pp_vars);
#endif

// to do:
// -add any of the m_wave[i].xxx menu-accessible vars to the code?
WFVERTEX v[512];
Expand All @@ -2025,7 +2024,7 @@ void CPlugin::DrawCustomWaves()
*pState->m_wave[i].var_pp_a = *pState->m_wave[i].var_pf_a;

#ifndef _NO_EXPR_
executeCode(pState->m_wave[i].m_pp_codehandle);
NSEEL_code_execute(pState->m_wave[i].m_pp_codehandle);
#endif

v[j].x = (float)(*pState->m_wave[i].var_pp_x* 2-1);//*ASPECT;
Expand All @@ -2037,10 +2036,6 @@ void CPlugin::DrawCustomWaves()
v[j].b = COLOR_NORM(*pState->m_wave[i].var_pp_b);
}

#ifndef _NO_EXPR_
resetVars(NULL);
#endif

// save changes to t1-t8 this frame
/*
pState->m_wave[i].t_values_after_init_code[0] = *pState->m_wave[i].var_pp_t1;
Expand Down
26 changes: 26 additions & 0 deletions lib/vis_milkdrop/ns-eel2/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
project(ns-eel2)

enable_language(C)

cmake_minimum_required(VERSION 2.6)

set(SOURCES ns-eel.h
ns-eel-addfuncs.h
ns-eel-int.h
nseel-caltab.c
nseel-cfunc.c
nseel-compiler.c
nseel-eval.c
nseel-lextab.c
nseel-ram.c
nseel-yylex.c)

if(CMAKE_SIZEOF_VOID_P EQUAL 8)
find_program(CMAKE_ASM_NASM_COMPILER NAMES nasm nasmw)
enable_language(ASM_NASM)
set(SOURCES ${SOURCES}
asm-nseel-x64.asm
)
endif()

add_library(ns-eel2 STATIC ${SOURCES})
Loading

0 comments on commit fa670f5

Please sign in to comment.