port from perforce
1612
8kode/src/intro/framework/4klang.asm
Normal file
22
8kode/src/intro/framework/4klang.h
Normal file
@@ -0,0 +1,22 @@
|
||||
// some useful song defines for 4klang
|
||||
#define SAMPLE_RATE 44100
|
||||
#define BPM 174.170609
|
||||
#define MAX_INSTRUMENTS 10
|
||||
#define MAX_PATTERNS 132
|
||||
#define PATTERN_SIZE_SHIFT 4
|
||||
#define PATTERN_SIZE (1 << PATTERN_SIZE_SHIFT)
|
||||
#define MAX_TICKS (MAX_PATTERNS*PATTERN_SIZE)
|
||||
#define SAMPLES_PER_TICK 3798
|
||||
#define MAX_SAMPLES (SAMPLES_PER_TICK*MAX_TICKS)
|
||||
#define POLYPHONY 1
|
||||
#define FLOAT_32BIT
|
||||
#define SAMPLE_TYPE float
|
||||
|
||||
#define WINDOWS_OBJECT
|
||||
|
||||
// declaration of the external synth render function, you'll always need that
|
||||
extern "C" void __stdcall _4klang_render(void*);
|
||||
// declaration of the external envelope buffer. access only if you're song was exported with that option
|
||||
extern "C" float _4klang_envelope_buffer;
|
||||
// declaration of the external note buffer. access only if you're song was exported with that option
|
||||
extern "C" int _4klang_note_buffer;
|
||||
942
8kode/src/intro/framework/4klang.inc
Normal file
@@ -0,0 +1,942 @@
|
||||
%macro export_func 1
|
||||
global _%1
|
||||
_%1:
|
||||
%endmacro
|
||||
%define USE_SECTIONS
|
||||
%define SAMPLE_RATE 44100
|
||||
%define MAX_INSTRUMENTS 10
|
||||
%define MAX_VOICES 1
|
||||
%define HLD 1
|
||||
%define BPM 174.170609
|
||||
%define MAX_PATTERNS 132
|
||||
%define PATTERN_SIZE_SHIFT 4
|
||||
%define PATTERN_SIZE (1 << PATTERN_SIZE_SHIFT)
|
||||
%define MAX_TICKS (MAX_PATTERNS*PATTERN_SIZE)
|
||||
%define SAMPLES_PER_TICK 3798
|
||||
%define DEF_LFO_NORMALIZE 0.0000658241
|
||||
%define MAX_SAMPLES (SAMPLES_PER_TICK*MAX_TICKS)
|
||||
;%define GO4K_USE_16BIT_OUTPUT
|
||||
;%define GO4K_USE_GROOVE_PATTERN
|
||||
;%define GO4K_USE_ENVELOPE_RECORDINGS
|
||||
;%define GO4K_USE_NOTE_RECORDINGS
|
||||
%define GO4K_CLIP_OUTPUT
|
||||
%define GO4K_USE_DST
|
||||
%define GO4K_USE_DLL
|
||||
%define GO4K_USE_PAN
|
||||
%define GO4K_USE_GLOBAL_DLL
|
||||
%define GO4K_USE_FSTG
|
||||
%define GO4K_USE_ENV_CHECK
|
||||
%define GO4K_USE_ENV_MOD_GM
|
||||
%define GO4K_USE_VCO_CHECK
|
||||
%define GO4K_USE_VCO_PHASE_OFFSET
|
||||
%define GO4K_USE_VCO_SHAPE
|
||||
%define GO4K_USE_VCO_GATE
|
||||
%define GO4K_USE_VCO_MOD_FM
|
||||
%define GO4K_USE_VCO_MOD_TM
|
||||
%define GO4K_USE_VCO_MOD_GM
|
||||
%define GO4K_USE_VCO_MOD_SM
|
||||
%define GO4K_USE_VCF_CHECK
|
||||
%define GO4K_USE_VCF_MOD_FM
|
||||
%define GO4K_USE_VCF_HIGH
|
||||
%define GO4K_USE_VCF_BAND
|
||||
%define GO4K_USE_VCF_PEAK
|
||||
%define GO4K_USE_DST_CHECK
|
||||
%define GO4K_USE_DST_SH
|
||||
%define GO4K_USE_DLL_CHORUS_CLAMP
|
||||
%define GO4K_USE_DLL_DAMP
|
||||
%define GO4K_USE_DLL_DC_FILTER
|
||||
%define GO4K_USE_FSTG_CHECK
|
||||
%define GO4K_USE_OUT_MOD_GM
|
||||
%define GO4K_USE_WAVESHAPER_CLIP
|
||||
%define MAX_DELAY 65536
|
||||
%define MAX_UNITS 48
|
||||
%define MAX_UNIT_SLOTS 9
|
||||
%define GO4K_BEGIN_CMDDEF(def_name)
|
||||
%define GO4K_END_CMDDEF db 0
|
||||
%define GO4K_BEGIN_PARAMDEF(def_name)
|
||||
%define GO4K_END_PARAMDEF
|
||||
GO4K_ENV_ID equ 1
|
||||
%macro GO4K_ENV 5
|
||||
db %1
|
||||
db %2
|
||||
db %3
|
||||
db %4
|
||||
db %5
|
||||
%endmacro
|
||||
%define ATTAC(val) val
|
||||
%define DECAY(val) val
|
||||
%define SUSTAIN(val) val
|
||||
%define RELEASE(val) val
|
||||
%define GAIN(val) val
|
||||
struc go4kENV_val
|
||||
.attac resd 1
|
||||
.decay resd 1
|
||||
.sustain resd 1
|
||||
.release resd 1
|
||||
.gain resd 1
|
||||
.size
|
||||
endstruc
|
||||
struc go4kENV_wrk
|
||||
.state resd 1
|
||||
.level resd 1
|
||||
.gm resd 1
|
||||
.am resd 1
|
||||
.dm resd 1
|
||||
.sm resd 1
|
||||
.rm resd 1
|
||||
.size
|
||||
endstruc
|
||||
%define ENV_STATE_ATTAC 0
|
||||
%define ENV_STATE_DECAY 1
|
||||
%define ENV_STATE_SUSTAIN 2
|
||||
%define ENV_STATE_RELEASE 3
|
||||
%define ENV_STATE_OFF 4
|
||||
GO4K_VCO_ID equ 2
|
||||
%macro GO4K_VCO 8
|
||||
db %1
|
||||
db %2
|
||||
%ifdef GO4K_USE_VCO_PHASE_OFFSET
|
||||
db %3
|
||||
%endif
|
||||
%ifdef GO4K_USE_VCO_GATE
|
||||
db %4
|
||||
%endif
|
||||
db %5
|
||||
%ifdef GO4K_USE_VCO_SHAPE
|
||||
db %6
|
||||
%endif
|
||||
db %7
|
||||
db %8
|
||||
%endmacro
|
||||
%define TRANSPOSE(val) val
|
||||
%define DETUNE(val) val
|
||||
%define PHASE(val) val
|
||||
%define GATES(val) val
|
||||
%define COLOR(val) val
|
||||
%define SHAPE(val) val
|
||||
%define FLAGS(val) val
|
||||
%define SINE 0x01
|
||||
%define TRISAW 0x02
|
||||
%define PULSE 0x04
|
||||
%define NOISE 0x08
|
||||
%define LFO 0x10
|
||||
%define GATE 0x20
|
||||
%define VCO_STEREO 0x40
|
||||
struc go4kVCO_val
|
||||
.transpose resd 1
|
||||
.detune resd 1
|
||||
%ifdef GO4K_USE_VCO_PHASE_OFFSET
|
||||
.phaseofs resd 1
|
||||
%endif
|
||||
%ifdef GO4K_USE_VCO_GATE
|
||||
.gate resd 1
|
||||
%endif
|
||||
.color resd 1
|
||||
%ifdef GO4K_USE_VCO_SHAPE
|
||||
.shape resd 1
|
||||
%endif
|
||||
.gain resd 1
|
||||
.flags resd 1
|
||||
.size
|
||||
endstruc
|
||||
struc go4kVCO_wrk
|
||||
.phase resd 1
|
||||
.tm resd 1
|
||||
.dm resd 1
|
||||
.fm resd 1
|
||||
.pm resd 1
|
||||
.cm resd 1
|
||||
.sm resd 1
|
||||
.gm resd 1
|
||||
.phase2 resd 1
|
||||
.size
|
||||
endstruc
|
||||
GO4K_VCF_ID equ 3
|
||||
%macro GO4K_VCF 3
|
||||
db %1
|
||||
db %2
|
||||
db %3
|
||||
%endmacro
|
||||
%define LOWPASS 0x1
|
||||
%define HIGHPASS 0x2
|
||||
%define BANDPASS 0x4
|
||||
%define BANDSTOP 0x3
|
||||
%define ALLPASS 0x7
|
||||
%define PEAK 0x8
|
||||
%define STEREO 0x10
|
||||
%define FREQUENCY(val) val
|
||||
%define RESONANCE(val) val
|
||||
%define VCFTYPE(val) val
|
||||
struc go4kVCF_val
|
||||
.freq resd 1
|
||||
.res resd 1
|
||||
.type resd 1
|
||||
.size
|
||||
endstruc
|
||||
struc go4kVCF_wrk
|
||||
.low resd 1
|
||||
.high resd 1
|
||||
.band resd 1
|
||||
.freq resd 1
|
||||
.fm resd 1
|
||||
.rm resd 1
|
||||
.low2 resd 1
|
||||
.high2 resd 1
|
||||
.band2 resd 1
|
||||
.size
|
||||
endstruc
|
||||
GO4K_DST_ID equ 4
|
||||
%macro GO4K_DST 3
|
||||
db %1
|
||||
%ifdef GO4K_USE_DST_SH
|
||||
db %2
|
||||
%ifdef GO4K_USE_DST_STEREO
|
||||
db %3
|
||||
%endif
|
||||
%else
|
||||
%ifdef GO4K_USE_DST_STEREO
|
||||
db %3
|
||||
%endif
|
||||
%endif
|
||||
%endmacro
|
||||
%define DRIVE(val) val
|
||||
%define SNHFREQ(val) val
|
||||
%define FLAGS(val) val
|
||||
struc go4kDST_val
|
||||
.drive resd 1
|
||||
%ifdef GO4K_USE_DST_SH
|
||||
.snhfreq resd 1
|
||||
%endif
|
||||
.flags resd 1
|
||||
.size
|
||||
endstruc
|
||||
struc go4kDST_wrk
|
||||
.out resd 1
|
||||
.snhphase resd 1
|
||||
.dm resd 1
|
||||
.sm resd 1
|
||||
.out2 resd 1
|
||||
.size
|
||||
endstruc
|
||||
GO4K_DLL_ID equ 5
|
||||
%macro GO4K_DLL 8
|
||||
db %1
|
||||
db %2
|
||||
db %3
|
||||
%ifdef GO4K_USE_DLL_DAMP
|
||||
db %4
|
||||
%endif
|
||||
%ifdef GO4K_USE_DLL_CHORUS
|
||||
db %5
|
||||
db %6
|
||||
%endif
|
||||
db %7
|
||||
db %8
|
||||
%endmacro
|
||||
%define PREGAIN(val) val
|
||||
%define DRY(val) val
|
||||
%define FEEDBACK(val) val
|
||||
%define DEPTH(val) val
|
||||
%define DAMP(val) val
|
||||
%define DELAY(val) val
|
||||
%define COUNT(val) val
|
||||
struc go4kDLL_val
|
||||
.pregain resd 1
|
||||
.dry resd 1
|
||||
.feedback resd 1
|
||||
%ifdef GO4K_USE_DLL_DAMP
|
||||
.damp resd 1
|
||||
%endif
|
||||
%ifdef GO4K_USE_DLL_CHORUS
|
||||
.freq resd 1
|
||||
.depth
|
||||
%endif
|
||||
.delay resd 1
|
||||
.count resd 1
|
||||
.size
|
||||
endstruc
|
||||
struc go4kDLL_wrk
|
||||
.index resd 1
|
||||
.store resd 1
|
||||
.dcin resd 1
|
||||
.dcout resd 1
|
||||
%ifdef GO4K_USE_DLL_CHORUS
|
||||
.phase resd 1
|
||||
%endif
|
||||
.buffer resd MAX_DELAY
|
||||
.size
|
||||
endstruc
|
||||
struc go4kDLL_wrk2
|
||||
.pm resd 1
|
||||
.fm resd 1
|
||||
.im resd 1
|
||||
.dm resd 1
|
||||
.sm resd 1
|
||||
.am resd 1
|
||||
.size
|
||||
endstruc
|
||||
GO4K_FOP_ID equ 6
|
||||
%macro GO4K_FOP 1
|
||||
db %1
|
||||
%endmacro
|
||||
%define OP(val) val
|
||||
%define FOP_POP 0x1
|
||||
%define FOP_ADDP 0x2
|
||||
%define FOP_MULP 0x3
|
||||
%define FOP_PUSH 0x4
|
||||
%define FOP_XCH 0x5
|
||||
%define FOP_MUL 0x6
|
||||
%define FOP_ADDP2 0x7
|
||||
struc go4kFOP_val
|
||||
.flags resd 1
|
||||
.size
|
||||
endstruc
|
||||
struc go4kFOP_wrk
|
||||
.size
|
||||
endstruc
|
||||
GO4K_FST_ID equ 7
|
||||
%macro GO4K_FST 2
|
||||
db %1
|
||||
dw %2
|
||||
%endmacro
|
||||
%define AMOUNT(val) val
|
||||
%define DEST(val) val
|
||||
%define FST_SET 0x0000
|
||||
%define FST_ADD 0x4000
|
||||
%define FST_POP 0x8000
|
||||
struc go4kFST_val
|
||||
.amount resd 1
|
||||
.op1 resd 1
|
||||
.size
|
||||
endstruc
|
||||
struc go4kFST_wrk
|
||||
.size
|
||||
endstruc
|
||||
GO4K_PAN_ID equ 8
|
||||
%macro GO4K_PAN 1
|
||||
%ifdef GO4K_USE_PAN
|
||||
db %1
|
||||
%endif
|
||||
%endmacro
|
||||
%define PANNING(val) val
|
||||
struc go4kPAN_val
|
||||
%ifdef GO4K_USE_PAN
|
||||
.panning resd 1
|
||||
%endif
|
||||
.size
|
||||
endstruc
|
||||
struc go4kPAN_wrk
|
||||
.pm resd 1
|
||||
.size
|
||||
endstruc
|
||||
GO4K_OUT_ID equ 9
|
||||
%macro GO4K_OUT 2
|
||||
db %1
|
||||
%ifdef GO4K_USE_GLOBAL_DLL
|
||||
db %2
|
||||
%endif
|
||||
%endmacro
|
||||
%define AUXSEND(val) val
|
||||
struc go4kOUT_val
|
||||
.gain resd 1
|
||||
%ifdef GO4K_USE_GLOBAL_DLL
|
||||
.auxsend resd 1
|
||||
%endif
|
||||
.size
|
||||
endstruc
|
||||
struc go4kOUT_wrk
|
||||
.am resd 1
|
||||
.gm resd 1
|
||||
.size
|
||||
endstruc
|
||||
GO4K_ACC_ID equ 10
|
||||
%macro GO4K_ACC 1
|
||||
db %1
|
||||
%endmacro
|
||||
%define OUTPUT 0
|
||||
%define AUX 8
|
||||
%define ACCTYPE(val) val
|
||||
struc go4kACC_val
|
||||
.acctype resd 1
|
||||
.size
|
||||
endstruc
|
||||
struc go4kACC_wrk
|
||||
.size
|
||||
endstruc
|
||||
%ifdef GO4K_USE_FLD
|
||||
GO4K_FLD_ID equ 11
|
||||
%macro GO4K_FLD 1
|
||||
db %1
|
||||
%endmacro
|
||||
%define VALUE(val) val
|
||||
struc go4kFLD_val
|
||||
.value resd 1
|
||||
.size
|
||||
endstruc
|
||||
struc go4kFLD_wrk
|
||||
.vm resd 1
|
||||
.size
|
||||
endstruc
|
||||
%endif
|
||||
%ifdef GO4K_USE_FSTG
|
||||
GO4K_FSTG_ID equ 12
|
||||
%macro GO4K_FSTG 2
|
||||
db %1
|
||||
dw %2
|
||||
%endmacro
|
||||
struc go4kFSTG_val
|
||||
.amount resd 1
|
||||
.op1 resd 1
|
||||
.size
|
||||
endstruc
|
||||
struc go4kFSTG_wrk
|
||||
.size
|
||||
endstruc
|
||||
%endif
|
||||
struc go4k_instrument
|
||||
.release resd 1
|
||||
.note resd 1
|
||||
.workspace resd MAX_UNITS*MAX_UNIT_SLOTS
|
||||
.dlloutl resd 1
|
||||
.dlloutr resd 1
|
||||
.outl resd 1
|
||||
.outr resd 1
|
||||
.size
|
||||
endstruc
|
||||
struc go4k_synth
|
||||
.instruments resb go4k_instrument.size * MAX_INSTRUMENTS * MAX_VOICES
|
||||
.global resb go4k_instrument.size * MAX_VOICES
|
||||
.size
|
||||
endstruc
|
||||
%ifdef USE_SECTIONS
|
||||
section .g4kmuc1 data align=1
|
||||
%else
|
||||
section .data align=1
|
||||
%endif
|
||||
go4k_patterns
|
||||
db 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
db 0, 0, 0, 0, 0, 0, 84, HLD, HLD, HLD, HLD, HLD, 76, HLD, HLD, HLD,
|
||||
db 77, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, 64, HLD, 69, HLD,
|
||||
db 81, HLD, 93, HLD, HLD, HLD, 84, HLD, HLD, HLD, HLD, HLD, 76, HLD, HLD, HLD,
|
||||
db HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, 64, HLD, 69, HLD,
|
||||
db 77, HLD, 76, HLD, 77, HLD, 74, HLD, HLD, HLD, 77, HLD, 81, HLD, HLD, HLD,
|
||||
db 74, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, 88, HLD, 89, HLD, HLD, HLD,
|
||||
db 86, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD,
|
||||
db 79, HLD, 78, HLD, 79, HLD, 76, HLD, HLD, HLD, 79, HLD, 83, HLD, HLD, HLD,
|
||||
db 76, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, 90, HLD, 91, HLD, HLD, HLD,
|
||||
db 88, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD,
|
||||
db 84, HLD, 83, HLD, 84, HLD, 81, HLD, HLD, HLD, 84, HLD, 88, HLD, HLD, HLD,
|
||||
db 81, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, 95, HLD, 96, HLD, HLD, HLD,
|
||||
db 93, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD,
|
||||
db 81, HLD, 79, HLD, 81, HLD, 78, HLD, HLD, HLD, 81, HLD, 84, HLD, HLD, HLD,
|
||||
db 78, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, 91, HLD, 93, HLD, HLD, HLD,
|
||||
db 90, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD,
|
||||
db 76, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, 90, HLD, 91, HLD, 69, HLD,
|
||||
db 88, HLD, 86, HLD, 88, HLD, 84, HLD, HLD, HLD, 88, HLD, 91, HLD, HLD, HLD,
|
||||
db 84, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, 98, HLD, 100, HLD, HLD, HLD,
|
||||
db 96, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD,
|
||||
db 83, HLD, 81, HLD, 83, HLD, 79, HLD, HLD, HLD, 83, HLD, 86, HLD, HLD, HLD,
|
||||
db 79, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, 93, HLD, 95, HLD, HLD, HLD,
|
||||
db 91, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD,
|
||||
db 76, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD,
|
||||
db HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD,
|
||||
db 57, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD,
|
||||
db 62, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD,
|
||||
db 64, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD,
|
||||
db 59, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD,
|
||||
db 60, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD,
|
||||
db 48, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD,
|
||||
db 67, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD,
|
||||
db 55, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD,
|
||||
db 66, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD,
|
||||
db 69, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD,
|
||||
db 71, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD,
|
||||
db 83, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD,
|
||||
db 75, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD,
|
||||
db 72, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD,
|
||||
db 84, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD,
|
||||
db 87, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD,
|
||||
db 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 72, HLD, HLD, HLD,
|
||||
db 0, 0, 0, 0, 0, 0, 0, 0, 60, HLD, 60, HLD, HLD, HLD, 60, HLD,
|
||||
db HLD, HLD, HLD, HLD, HLD, HLD, 60, HLD, 60, HLD, HLD, HLD, HLD, HLD, HLD, HLD,
|
||||
db HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, 60, HLD, 60, HLD, HLD, HLD, 60, HLD,
|
||||
db 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 60, HLD, HLD, HLD,
|
||||
db 60, HLD, HLD, HLD, HLD, HLD, 60, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD,
|
||||
db 60, HLD, HLD, HLD, HLD, HLD, 60, HLD, HLD, HLD, HLD, HLD, 60, HLD, HLD, HLD,
|
||||
db 50, HLD, HLD, HLD, 38, HLD, HLD, HLD, 38, HLD, HLD, HLD, 50, HLD, HLD, HLD,
|
||||
db 38, HLD, HLD, HLD, 38, HLD, HLD, HLD, 50, HLD, 62, HLD, 50, HLD, HLD, HLD,
|
||||
db 38, HLD, HLD, HLD, 50, HLD, HLD, HLD, 50, HLD, HLD, HLD, 38, HLD, HLD, HLD,
|
||||
db 38, HLD, HLD, HLD, 50, HLD, HLD, HLD, 62, HLD, 50, HLD, 38, HLD, HLD, HLD,
|
||||
db 52, HLD, HLD, HLD, 40, HLD, HLD, HLD, 40, HLD, HLD, HLD, 52, HLD, HLD, HLD,
|
||||
db 40, HLD, HLD, HLD, 40, HLD, HLD, HLD, 52, HLD, 64, HLD, 52, HLD, HLD, HLD,
|
||||
db 40, HLD, HLD, HLD, 52, HLD, HLD, HLD, 52, HLD, HLD, HLD, 40, HLD, HLD, HLD,
|
||||
db 40, HLD, HLD, HLD, 52, HLD, HLD, HLD, 64, HLD, 52, HLD, 40, HLD, HLD, HLD,
|
||||
db 57, HLD, HLD, HLD, 45, HLD, HLD, HLD, 45, HLD, HLD, HLD, 57, HLD, HLD, HLD,
|
||||
db 45, HLD, HLD, HLD, 45, HLD, HLD, HLD, 57, HLD, 69, HLD, 57, HLD, HLD, HLD,
|
||||
db 45, HLD, HLD, HLD, 57, HLD, HLD, HLD, 57, HLD, HLD, HLD, 45, HLD, HLD, HLD,
|
||||
db 45, HLD, HLD, HLD, 57, HLD, HLD, HLD, 69, HLD, 57, HLD, 45, HLD, HLD, HLD,
|
||||
db 59, HLD, HLD, HLD, 47, HLD, HLD, HLD, 47, HLD, HLD, HLD, 59, HLD, HLD, HLD,
|
||||
db 47, HLD, HLD, HLD, 47, HLD, HLD, HLD, 59, HLD, 71, HLD, 59, HLD, HLD, HLD,
|
||||
db 47, HLD, HLD, HLD, 59, HLD, HLD, HLD, 59, HLD, HLD, HLD, 47, HLD, HLD, HLD,
|
||||
db 47, HLD, HLD, HLD, 59, HLD, HLD, HLD, 71, HLD, 59, HLD, 47, HLD, HLD, HLD,
|
||||
db 40, HLD, HLD, HLD, 40, HLD, HLD, HLD, 52, HLD, 40, HLD, 52, HLD, HLD, HLD,
|
||||
db 40, HLD, HLD, HLD, 52, HLD, HLD, HLD, 40, HLD, 52, HLD, 40, HLD, HLD, HLD,
|
||||
db 48, HLD, HLD, HLD, 36, HLD, HLD, HLD, 36, HLD, HLD, HLD, 48, HLD, HLD, HLD,
|
||||
db 36, HLD, HLD, HLD, 36, HLD, HLD, HLD, 48, HLD, 60, HLD, 48, HLD, HLD, HLD,
|
||||
db 48, HLD, HLD, HLD, 60, HLD, HLD, HLD, 60, HLD, HLD, HLD, 48, HLD, HLD, HLD,
|
||||
db 48, HLD, HLD, HLD, 60, HLD, HLD, HLD, 72, HLD, 60, HLD, 48, HLD, HLD, HLD,
|
||||
db 55, HLD, HLD, HLD, 43, HLD, HLD, HLD, 43, HLD, HLD, HLD, 55, HLD, HLD, HLD,
|
||||
db 43, HLD, HLD, HLD, 43, HLD, HLD, HLD, 55, HLD, 67, HLD, 55, HLD, HLD, HLD,
|
||||
db 43, HLD, HLD, HLD, 55, HLD, HLD, HLD, 55, HLD, HLD, HLD, 43, HLD, HLD, HLD,
|
||||
db 43, HLD, HLD, HLD, 55, HLD, HLD, HLD, 67, HLD, 55, HLD, 43, HLD, HLD, HLD,
|
||||
db 40, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD,
|
||||
db 81, 0, 83, 0, 84, 0, 86, 0, 2, HLD, 88, HLD, HLD, HLD, HLD, HLD,
|
||||
db 0, 0, 0, 0, 0, 0, 0, 0, 84, HLD, HLD, HLD, 0, 0, 0, 0,
|
||||
db 83, HLD, HLD, HLD, 0, 0, 0, 0, 0, 0, 0, 0, 79, 0, 81, 0,
|
||||
db 76, HLD, HLD, HLD, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
db 79, 0, 81, HLD, HLD, HLD, 83, HLD, 0, 0, 79, HLD, 0, 0, 0, 0,
|
||||
db 78, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD,
|
||||
db 0, 0, 0, 0, 79, 0, 81, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD,
|
||||
db 0, 0, 0, 0, 0, 0, 0, 0, 81, 0, 83, 0, 84, 0, 81, 0,
|
||||
db 83, HLD, HLD, HLD, HLD, HLD, HLD, HLD, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
db 81, HLD, HLD, HLD, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
db 0, 0, 0, 0, 0, 0, 0, 0, 78, 0, 79, 0, 81, 0, 79, 0,
|
||||
db 52, HLD, HLD, HLD, HLD, HLD, HLD, HLD, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
db 52, HLD, HLD, HLD, HLD, HLD, HLD, HLD, 91, 0, 90, 0, 88, 0, 86, 0,
|
||||
db 88, HLD, HLD, HLD, HLD, HLD, HLD, HLD, 0, 0, 0, 0, 0, 0, 90, 0,
|
||||
db 88, 0, 90, HLD, 0, 0, 91, HLD, 0, 0, 100, HLD, 0, 0, 0, 0,
|
||||
db 98, HLD, HLD, HLD, HLD, HLD, HLD, HLD, 0, 0, 0, 0, 0, 0, 93, 0,
|
||||
db 95, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD, HLD,
|
||||
db 91, 0, 93, HLD, 0, 0, 95, HLD, 0, 0, 103, HLD, 0, 0, 0, 0,
|
||||
db 102, HLD, HLD, HLD, HLD, HLD, HLD, HLD, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
db 90, 0, 91, HLD, 0, 0, 93, HLD, 0, 0, 96, HLD, 0, 0, 0, 0,
|
||||
db 95, HLD, HLD, HLD, HLD, HLD, HLD, HLD, 0, 0, 0, 0, 0, 0, 93, 0,
|
||||
db 0, 0, 0, 0, 0, 0, 0, 0, 91, 0, 90, 0, 88, 0, 86, 0,
|
||||
db 88, 0, 90, HLD, 0, 0, 91, HLD, 0, 0, 88, HLD, 0, 0, 0, 0,
|
||||
db 86, HLD, HLD, HLD, HLD, HLD, HLD, HLD, 0, 0, 0, 0, 0, 0, 81, 0,
|
||||
db 79, 0, 81, HLD, 0, 0, 83, HLD, 0, 0, 91, HLD, 0, 0, 0, 0,
|
||||
db 90, HLD, HLD, HLD, HLD, HLD, HLD, HLD, 0, 0, 0, 0, 0, 0, 88, 0,
|
||||
db 0, 0, 0, 0, 0, 0, 0, 0, 83, HLD, HLD, HLD, 0, 0, 0, 0,
|
||||
go4k_patterns_end
|
||||
%ifdef USE_SECTIONS
|
||||
section .g4kmuc2 data align=1
|
||||
%else
|
||||
section .data
|
||||
%endif
|
||||
go4k_pattern_lists
|
||||
Instrument0List db 1, 2, 3, 4, 3, 2, 3, 4, 3, 2, 3, 4, 3, 2, 3, 4, 3, 2, 3, 4, 3, 2, 3, 4, 5, 6, 5, 7, 8, 9, 8, 10, 5, 6, 5, 7, 8, 9, 8, 10, 11, 12, 11, 13, 8, 9, 8, 10, 14, 15, 14, 16, 8, 9, 8, 10, 11, 12, 11, 13, 8, 9, 8, 10, 14, 15, 14, 16, 8, 9, 8, 10, 8, 17, 8, 10, 8, 17, 8, 10, 8, 17, 8, 10, 8, 17, 8, 10, 18, 19, 18, 20, 21, 22, 21, 23, 14, 15, 14, 16, 8, 9, 8, 10, 18, 19, 18, 20, 21, 22, 21, 23, 14, 15, 14, 16, 8, 9, 8, 10, 8, 9, 8, 10, 8, 9, 8, 10, 8, 24, 24, 25,
|
||||
Instrument1List db 26, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 27, 25, 25, 25, 28, 25, 25, 25, 27, 25, 25, 25, 28, 25, 25, 25, 26, 25, 25, 25, 28, 25, 25, 25, 29, 25, 25, 25, 28, 25, 25, 25, 26, 25, 25, 25, 28, 25, 25, 25, 29, 25, 25, 25, 28, 25, 25, 25, 28, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 30, 25, 31, 30, 32, 25, 32, 33, 29, 25, 34, 29, 28, 25, 32, 33, 30, 25, 31, 30, 32, 25, 32, 33, 29, 25, 34, 29, 28, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 0, 0,
|
||||
Instrument2List db 24, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 35, 25, 25, 25, 36, 25, 25, 25, 35, 25, 25, 25, 36, 25, 25, 25, 24, 25, 25, 25, 37, 25, 25, 25, 38, 25, 25, 25, 37, 25, 25, 25, 24, 25, 25, 25, 37, 25, 25, 25, 38, 25, 25, 25, 37, 25, 25, 25, 36, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 39, 40, 25, 25, 37, 25, 25, 25, 38, 25, 25, 25, 37, 25, 25, 25, 39, 40, 25, 25, 37, 25, 25, 25, 38, 41, 25, 25, 37, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 0, 0,
|
||||
Instrument3List db 0, 0, 0, 0, 0, 0, 39, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 42, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
Instrument4List db 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 43, 44, 45, 44, 45, 44, 45, 44, 45, 44, 45, 44, 45, 44, 45, 44, 45, 44, 45, 44, 45, 44, 45, 44, 45, 44, 45, 44, 45, 44, 45, 44, 45, 44, 45, 44, 45, 44, 45, 44, 45, 44, 45, 44, 45, 44, 45, 44, 45, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 44, 45, 44, 45, 44, 45, 44, 45, 44, 45, 44, 45, 44, 45, 44, 45, 44, 45, 44, 45, 44, 45, 44, 45, 44, 45, 44, 45, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 0, 0,
|
||||
Instrument5List db 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 46, 30, 47, 30, 48, 30, 47, 30, 48, 30, 47, 30, 48, 30, 47, 30, 48, 30, 47, 30, 48, 30, 47, 30, 48, 30, 47, 30, 48, 30, 47, 30, 48, 30, 47, 30, 48, 30, 47, 30, 48, 30, 47, 30, 48, 30, 47, 30, 48, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 30, 47, 30, 48, 30, 47, 30, 48, 30, 47, 30, 48, 30, 47, 30, 48, 30, 47, 30, 48, 30, 47, 30, 48, 30, 47, 30, 48, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 0, 0,
|
||||
Instrument6List db 30, 25, 25, 25, 25, 25, 0, 46, 25, 25, 25, 25, 25, 25, 0, 46, 25, 25, 25, 25, 25, 25, 0, 46, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 30, 25, 25, 25, 25, 25, 0, 0, 30, 25, 25, 25, 25, 25, 0, 46, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 0, 0, 0, 0,
|
||||
Instrument7List db 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 49, 50, 51, 52, 53, 54, 55, 56, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 53, 54, 55, 56, 61, 62, 63, 64, 53, 54, 55, 56, 57, 58, 59, 60, 53, 54, 55, 56, 61, 62, 63, 64, 53, 54, 55, 56, 53, 65, 55, 66, 53, 65, 55, 66, 53, 65, 55, 66, 53, 65, 55, 66, 67, 68, 69, 70, 71, 72, 73, 74, 61, 62, 63, 64, 53, 54, 73, 74, 67, 68, 69, 70, 71, 72, 73, 74, 61, 62, 63, 64, 53, 54, 55, 56, 53, 54, 55, 56, 53, 54, 55, 56, 53, 54, 75, 25,
|
||||
Instrument8List db 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 31, 25, 25, 25, 25, 25, 25, 25, 31, 25, 25, 25, 25, 25, 25, 25, 31, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 31, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 31, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
Instrument9List db 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 76, 0, 77, 78, 79, 0, 80, 81, 82, 0, 83, 84, 79, 0, 80, 85, 76, 0, 77, 78, 79, 0, 80, 81, 82, 0, 86, 24, 25, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 87, 87, 87, 87, 87, 87, 87, 88, 89, 23, 0, 90, 91, 92, 0, 93, 94, 92, 0, 95, 96, 23, 0, 97, 89, 23, 0, 98, 99, 37, 0, 100, 101, 41, 0, 102, 10, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
go4k_pattern_lists_end
|
||||
%ifdef USE_SECTIONS
|
||||
section .g4kmuc3 data align=1
|
||||
%else
|
||||
section .data
|
||||
%endif
|
||||
go4k_synth_instructions
|
||||
GO4K_BEGIN_CMDDEF(Instrument0)
|
||||
db GO4K_ENV_ID
|
||||
db GO4K_VCO_ID
|
||||
db GO4K_FOP_ID
|
||||
db GO4K_VCF_ID
|
||||
db GO4K_DLL_ID
|
||||
db GO4K_PAN_ID
|
||||
db GO4K_DLL_ID
|
||||
db GO4K_OUT_ID
|
||||
GO4K_END_CMDDEF
|
||||
GO4K_BEGIN_CMDDEF(Instrument1)
|
||||
db GO4K_ENV_ID
|
||||
db GO4K_VCO_ID
|
||||
db GO4K_FST_ID
|
||||
db GO4K_FOP_ID
|
||||
db GO4K_VCO_ID
|
||||
db GO4K_DST_ID
|
||||
db GO4K_VCF_ID
|
||||
db GO4K_VCO_ID
|
||||
db GO4K_FOP_ID
|
||||
db GO4K_FOP_ID
|
||||
db GO4K_VCF_ID
|
||||
db GO4K_VCF_ID
|
||||
db GO4K_PAN_ID
|
||||
db GO4K_OUT_ID
|
||||
GO4K_END_CMDDEF
|
||||
GO4K_BEGIN_CMDDEF(Instrument2)
|
||||
db GO4K_ENV_ID
|
||||
db GO4K_VCO_ID
|
||||
db GO4K_VCF_ID
|
||||
db GO4K_FST_ID
|
||||
db GO4K_FST_ID
|
||||
db GO4K_FOP_ID
|
||||
db GO4K_VCO_ID
|
||||
db GO4K_VCO_ID
|
||||
db GO4K_VCO_ID
|
||||
db GO4K_VCO_ID
|
||||
db GO4K_FOP_ID
|
||||
db GO4K_FOP_ID
|
||||
db GO4K_FOP_ID
|
||||
db GO4K_FOP_ID
|
||||
db GO4K_VCF_ID
|
||||
db GO4K_DST_ID
|
||||
db GO4K_VCF_ID
|
||||
db GO4K_VCF_ID
|
||||
db GO4K_VCF_ID
|
||||
db GO4K_DLL_ID
|
||||
db GO4K_PAN_ID
|
||||
db GO4K_OUT_ID
|
||||
GO4K_END_CMDDEF
|
||||
GO4K_BEGIN_CMDDEF(Instrument3)
|
||||
db GO4K_ENV_ID
|
||||
db GO4K_FSTG_ID
|
||||
db GO4K_FSTG_ID
|
||||
db GO4K_FSTG_ID
|
||||
db GO4K_FSTG_ID
|
||||
db GO4K_FSTG_ID
|
||||
db GO4K_FSTG_ID
|
||||
db GO4K_FSTG_ID
|
||||
db GO4K_FOP_ID
|
||||
GO4K_END_CMDDEF
|
||||
GO4K_BEGIN_CMDDEF(Instrument4)
|
||||
db GO4K_ENV_ID
|
||||
db GO4K_VCO_ID
|
||||
db GO4K_VCF_ID
|
||||
db GO4K_FOP_ID
|
||||
db GO4K_ENV_ID
|
||||
db GO4K_VCO_ID
|
||||
db GO4K_VCF_ID
|
||||
db GO4K_FOP_ID
|
||||
db GO4K_ENV_ID
|
||||
db GO4K_FST_ID
|
||||
db GO4K_FOP_ID
|
||||
db GO4K_ENV_ID
|
||||
db GO4K_VCO_ID
|
||||
db GO4K_FOP_ID
|
||||
db GO4K_FOP_ID
|
||||
db GO4K_FOP_ID
|
||||
db GO4K_FOP_ID
|
||||
db GO4K_FOP_ID
|
||||
db GO4K_PAN_ID
|
||||
db GO4K_OUT_ID
|
||||
GO4K_END_CMDDEF
|
||||
GO4K_BEGIN_CMDDEF(Instrument5)
|
||||
db GO4K_ENV_ID
|
||||
db GO4K_FST_ID
|
||||
db GO4K_ENV_ID
|
||||
db GO4K_DST_ID
|
||||
db GO4K_FST_ID
|
||||
db GO4K_FOP_ID
|
||||
db GO4K_VCO_ID
|
||||
db GO4K_FOP_ID
|
||||
db GO4K_PAN_ID
|
||||
db GO4K_OUT_ID
|
||||
GO4K_END_CMDDEF
|
||||
GO4K_BEGIN_CMDDEF(Instrument6)
|
||||
db GO4K_ENV_ID
|
||||
db GO4K_FSTG_ID
|
||||
db GO4K_FSTG_ID
|
||||
db GO4K_FOP_ID
|
||||
GO4K_END_CMDDEF
|
||||
GO4K_BEGIN_CMDDEF(Instrument7)
|
||||
db GO4K_ENV_ID
|
||||
db GO4K_FST_ID
|
||||
db GO4K_FST_ID
|
||||
db GO4K_ENV_ID
|
||||
db GO4K_FST_ID
|
||||
db GO4K_FOP_ID
|
||||
db GO4K_VCO_ID
|
||||
db GO4K_VCO_ID
|
||||
db GO4K_FOP_ID
|
||||
db GO4K_VCF_ID
|
||||
db GO4K_DST_ID
|
||||
db GO4K_VCF_ID
|
||||
db GO4K_FOP_ID
|
||||
db GO4K_VCF_ID
|
||||
db GO4K_PAN_ID
|
||||
db GO4K_OUT_ID
|
||||
GO4K_END_CMDDEF
|
||||
GO4K_BEGIN_CMDDEF(Instrument8)
|
||||
db GO4K_ENV_ID
|
||||
db GO4K_VCO_ID
|
||||
db GO4K_VCO_ID
|
||||
db GO4K_VCF_ID
|
||||
db GO4K_VCF_ID
|
||||
db GO4K_FOP_ID
|
||||
db GO4K_FOP_ID
|
||||
db GO4K_PAN_ID
|
||||
db GO4K_OUT_ID
|
||||
GO4K_END_CMDDEF
|
||||
GO4K_BEGIN_CMDDEF(Instrument9)
|
||||
db GO4K_ENV_ID
|
||||
db GO4K_ENV_ID
|
||||
db GO4K_FOP_ID
|
||||
db GO4K_FOP_ID
|
||||
db GO4K_VCO_ID
|
||||
db GO4K_FOP_ID
|
||||
db GO4K_FST_ID
|
||||
db GO4K_FST_ID
|
||||
db GO4K_FST_ID
|
||||
db GO4K_FOP_ID
|
||||
db GO4K_VCO_ID
|
||||
db GO4K_VCO_ID
|
||||
db GO4K_VCO_ID
|
||||
db GO4K_FOP_ID
|
||||
db GO4K_FOP_ID
|
||||
db GO4K_VCF_ID
|
||||
db GO4K_DST_ID
|
||||
db GO4K_FOP_ID
|
||||
db GO4K_VCF_ID
|
||||
db GO4K_VCF_ID
|
||||
db GO4K_VCF_ID
|
||||
db GO4K_DLL_ID
|
||||
db GO4K_PAN_ID
|
||||
db GO4K_OUT_ID
|
||||
GO4K_END_CMDDEF
|
||||
GO4K_BEGIN_CMDDEF(Global)
|
||||
db GO4K_ACC_ID
|
||||
db GO4K_VCF_ID
|
||||
db GO4K_DLL_ID
|
||||
db GO4K_FOP_ID
|
||||
db GO4K_VCF_ID
|
||||
db GO4K_DLL_ID
|
||||
db GO4K_ACC_ID
|
||||
db GO4K_FOP_ID
|
||||
db GO4K_VCO_ID
|
||||
db GO4K_FSTG_ID
|
||||
db GO4K_FSTG_ID
|
||||
db GO4K_FOP_ID
|
||||
db GO4K_VCO_ID
|
||||
db GO4K_FSTG_ID
|
||||
db GO4K_FOP_ID
|
||||
db GO4K_VCF_ID
|
||||
db GO4K_VCF_ID
|
||||
db GO4K_VCF_ID
|
||||
db GO4K_FOP_ID
|
||||
db GO4K_VCF_ID
|
||||
db GO4K_VCF_ID
|
||||
db GO4K_VCF_ID
|
||||
db GO4K_OUT_ID
|
||||
GO4K_END_CMDDEF
|
||||
go4k_synth_instructions_end
|
||||
%ifdef USE_SECTIONS
|
||||
section .g4kmuc4 data align=1
|
||||
%else
|
||||
section .data
|
||||
%endif
|
||||
go4k_synth_parameter_values
|
||||
GO4K_BEGIN_PARAMDEF(Instrument0)
|
||||
GO4K_ENV ATTAC(16),DECAY(68),SUSTAIN(0),RELEASE(32),GAIN(72)
|
||||
GO4K_VCO TRANSPOSE(64),DETUNE(64),PHASE(64),GATES(0),COLOR(32),SHAPE(96),GAIN(128),FLAGS(TRISAW)
|
||||
GO4K_FOP OP(FOP_MULP)
|
||||
GO4K_VCF FREQUENCY(16),RESONANCE(128),VCFTYPE(LOWPASS)
|
||||
GO4K_DLL PREGAIN(64),DRY(96),FEEDBACK(16),DAMP(64),FREQUENCY(64),DEPTH(0),DELAY(17),COUNT(1)
|
||||
GO4K_PAN PANNING(0)
|
||||
GO4K_DLL PREGAIN(128),DRY(64),FEEDBACK(0),DAMP(128),FREQUENCY(0),DEPTH(128),DELAY(18),COUNT(1)
|
||||
GO4K_OUT GAIN(48), AUXSEND(32)
|
||||
GO4K_END_PARAMDEF
|
||||
GO4K_BEGIN_PARAMDEF(Instrument1)
|
||||
GO4K_ENV ATTAC(64),DECAY(64),SUSTAIN(64),RELEASE(64),GAIN(128)
|
||||
GO4K_VCO TRANSPOSE(52),DETUNE(60),PHASE(0),GATES(0),COLOR(128),SHAPE(64),GAIN(8),FLAGS(SINE)
|
||||
GO4K_FST AMOUNT(68),DEST(4*MAX_UNIT_SLOTS+3+FST_SET)
|
||||
GO4K_FOP OP(FOP_POP)
|
||||
GO4K_VCO TRANSPOSE(48),DETUNE(64),PHASE(0),GATES(0),COLOR(64),SHAPE(96),GAIN(128),FLAGS(TRISAW|LFO)
|
||||
GO4K_DST DRIVE(112), SNHFREQ(64), FLAGS(0)
|
||||
GO4K_VCF FREQUENCY(32),RESONANCE(64),VCFTYPE(LOWPASS)
|
||||
GO4K_VCO TRANSPOSE(52),DETUNE(68),PHASE(64),GATES(0),COLOR(64),SHAPE(64),GAIN(128),FLAGS(TRISAW)
|
||||
GO4K_FOP OP(FOP_ADDP)
|
||||
GO4K_FOP OP(FOP_MULP)
|
||||
GO4K_VCF FREQUENCY(8),RESONANCE(128),VCFTYPE(LOWPASS)
|
||||
GO4K_VCF FREQUENCY(16),RESONANCE(128),VCFTYPE(LOWPASS)
|
||||
GO4K_PAN PANNING(40)
|
||||
GO4K_OUT GAIN(32), AUXSEND(24)
|
||||
GO4K_END_PARAMDEF
|
||||
GO4K_BEGIN_PARAMDEF(Instrument2)
|
||||
GO4K_ENV ATTAC(80),DECAY(64),SUSTAIN(64),RELEASE(72),GAIN(128)
|
||||
GO4K_VCO TRANSPOSE(64),DETUNE(64),PHASE(0),GATES(0),COLOR(64),SHAPE(64),GAIN(24),FLAGS(NOISE)
|
||||
GO4K_VCF FREQUENCY(2),RESONANCE(128),VCFTYPE(LOWPASS)
|
||||
GO4K_FST AMOUNT(65),DEST(7*MAX_UNIT_SLOTS+3+FST_SET)
|
||||
GO4K_FST AMOUNT(63),DEST(6*MAX_UNIT_SLOTS+3+FST_SET)
|
||||
GO4K_FOP OP(FOP_POP)
|
||||
GO4K_VCO TRANSPOSE(64),DETUNE(60),PHASE(0),GATES(0),COLOR(32),SHAPE(112),GAIN(24),FLAGS(TRISAW)
|
||||
GO4K_VCO TRANSPOSE(52),DETUNE(62),PHASE(32),GATES(0),COLOR(80),SHAPE(40),GAIN(48),FLAGS(TRISAW)
|
||||
GO4K_VCO TRANSPOSE(60),DETUNE(68),PHASE(64),GATES(0),COLOR(48),SHAPE(88),GAIN(32),FLAGS(TRISAW)
|
||||
GO4K_VCO TRANSPOSE(48),DETUNE(66),PHASE(96),GATES(0),COLOR(96),SHAPE(16),GAIN(32),FLAGS(TRISAW)
|
||||
GO4K_FOP OP(FOP_ADDP)
|
||||
GO4K_FOP OP(FOP_ADDP)
|
||||
GO4K_FOP OP(FOP_ADDP)
|
||||
GO4K_FOP OP(FOP_ADDP)
|
||||
GO4K_VCF FREQUENCY(64),RESONANCE(128),VCFTYPE(LOWPASS)
|
||||
GO4K_DST DRIVE(64), SNHFREQ(96), FLAGS(0)
|
||||
GO4K_VCF FREQUENCY(72),RESONANCE(128),VCFTYPE(LOWPASS)
|
||||
GO4K_VCF FREQUENCY(8),RESONANCE(128),VCFTYPE(LOWPASS)
|
||||
GO4K_VCF FREQUENCY(16),RESONANCE(128),VCFTYPE(LOWPASS)
|
||||
GO4K_DLL PREGAIN(64),DRY(64),FEEDBACK(64),DAMP(64),FREQUENCY(0),DEPTH(0),DELAY(19),COUNT(1)
|
||||
GO4K_PAN PANNING(96)
|
||||
GO4K_OUT GAIN(16), AUXSEND(48)
|
||||
GO4K_END_PARAMDEF
|
||||
GO4K_BEGIN_PARAMDEF(Instrument3)
|
||||
GO4K_ENV ATTAC(112),DECAY(128),SUSTAIN(128),RELEASE(112),GAIN(128)
|
||||
GO4K_FSTG AMOUNT(100),DEST((0*go4k_instrument.size*MAX_VOICES/4)+(3*MAX_UNIT_SLOTS+4)+(go4k_instrument.workspace/4)+FST_SET)
|
||||
GO4K_FSTG AMOUNT(100),DEST((1*go4k_instrument.size*MAX_VOICES/4)+(11*MAX_UNIT_SLOTS+4)+(go4k_instrument.workspace/4)+FST_SET)
|
||||
GO4K_FSTG AMOUNT(100),DEST((2*go4k_instrument.size*MAX_VOICES/4)+(18*MAX_UNIT_SLOTS+4)+(go4k_instrument.workspace/4)+FST_SET)
|
||||
GO4K_FSTG AMOUNT(80),DEST((9*go4k_instrument.size*MAX_VOICES/4)+(23*MAX_UNIT_SLOTS+1)+(go4k_instrument.workspace/4)+FST_SET)
|
||||
GO4K_FSTG AMOUNT(80),DEST((8*go4k_instrument.size*MAX_VOICES/4)+(2*MAX_UNIT_SLOTS+7)+(go4k_instrument.workspace/4)+FST_SET)
|
||||
GO4K_FSTG AMOUNT(112),DEST((7*go4k_instrument.size*MAX_VOICES/4)+(13*MAX_UNIT_SLOTS+4)+(go4k_instrument.workspace/4)+FST_SET)
|
||||
GO4K_FSTG AMOUNT(88),DEST((7*go4k_instrument.size*MAX_VOICES/4)+(15*MAX_UNIT_SLOTS+1)+(go4k_instrument.workspace/4)+FST_SET)
|
||||
GO4K_FOP OP(FOP_POP)
|
||||
GO4K_END_PARAMDEF
|
||||
GO4K_BEGIN_PARAMDEF(Instrument4)
|
||||
GO4K_ENV ATTAC(0),DECAY(70),SUSTAIN(0),RELEASE(0),GAIN(128)
|
||||
GO4K_VCO TRANSPOSE(64),DETUNE(64),PHASE(0),GATES(0),COLOR(64),SHAPE(64),GAIN(128),FLAGS(NOISE)
|
||||
GO4K_VCF FREQUENCY(24),RESONANCE(128),VCFTYPE(BANDPASS)
|
||||
GO4K_FOP OP(FOP_MULP)
|
||||
GO4K_ENV ATTAC(0),DECAY(48),SUSTAIN(0),RELEASE(64),GAIN(96)
|
||||
GO4K_VCO TRANSPOSE(64),DETUNE(64),PHASE(0),GATES(0),COLOR(64),SHAPE(64),GAIN(24),FLAGS(NOISE)
|
||||
GO4K_VCF FREQUENCY(96),RESONANCE(128),VCFTYPE(BANDSTOP)
|
||||
GO4K_FOP OP(FOP_MULP)
|
||||
GO4K_ENV ATTAC(0),DECAY(72),SUSTAIN(64),RELEASE(64),GAIN(16)
|
||||
GO4K_FST AMOUNT(66),DEST(12*MAX_UNIT_SLOTS+3+FST_SET)
|
||||
GO4K_FOP OP(FOP_POP)
|
||||
GO4K_ENV ATTAC(0),DECAY(68),SUSTAIN(0),RELEASE(64),GAIN(128)
|
||||
GO4K_VCO TRANSPOSE(0),DETUNE(64),PHASE(0),GATES(0),COLOR(128),SHAPE(64),GAIN(32),FLAGS(SINE|LFO)
|
||||
GO4K_FOP OP(FOP_MULP)
|
||||
GO4K_FOP OP(FOP_ADDP)
|
||||
GO4K_FOP OP(FOP_ADDP)
|
||||
GO4K_FOP OP(FOP_PUSH)
|
||||
GO4K_FOP OP(FOP_ADDP)
|
||||
GO4K_PAN PANNING(56)
|
||||
GO4K_OUT GAIN(64), AUXSEND(32)
|
||||
GO4K_END_PARAMDEF
|
||||
GO4K_BEGIN_PARAMDEF(Instrument5)
|
||||
GO4K_ENV ATTAC(0),DECAY(76),SUSTAIN(0),RELEASE(64),GAIN(128)
|
||||
GO4K_FST AMOUNT(96),DEST(0*MAX_UNIT_SLOTS+2+FST_SET)
|
||||
GO4K_ENV ATTAC(0),DECAY(72),SUSTAIN(0),RELEASE(0),GAIN(128)
|
||||
GO4K_DST DRIVE(32), SNHFREQ(128), FLAGS(0)
|
||||
GO4K_FST AMOUNT(80),DEST(6*MAX_UNIT_SLOTS+1+FST_SET)
|
||||
GO4K_FOP OP(FOP_POP)
|
||||
GO4K_VCO TRANSPOSE(40),DETUNE(64),PHASE(0),GATES(85),COLOR(64),SHAPE(64),GAIN(128),FLAGS(TRISAW)
|
||||
GO4K_FOP OP(FOP_MULP)
|
||||
GO4K_PAN PANNING(64)
|
||||
GO4K_OUT GAIN(48), AUXSEND(8)
|
||||
GO4K_END_PARAMDEF
|
||||
GO4K_BEGIN_PARAMDEF(Instrument6)
|
||||
GO4K_ENV ATTAC(90),DECAY(128),SUSTAIN(128),RELEASE(90),GAIN(128)
|
||||
GO4K_FSTG AMOUNT(112),DEST((1*go4k_instrument.size*MAX_VOICES/4)+(10*MAX_UNIT_SLOTS+4)+(go4k_instrument.workspace/4)+FST_SET)
|
||||
GO4K_FSTG AMOUNT(112),DEST((2*go4k_instrument.size*MAX_VOICES/4)+(17*MAX_UNIT_SLOTS+4)+(go4k_instrument.workspace/4)+FST_SET)
|
||||
GO4K_FOP OP(FOP_POP)
|
||||
GO4K_END_PARAMDEF
|
||||
GO4K_BEGIN_PARAMDEF(Instrument7)
|
||||
GO4K_ENV ATTAC(32),DECAY(72),SUSTAIN(0),RELEASE(32),GAIN(88)
|
||||
GO4K_FST AMOUNT(108),DEST(0*MAX_UNIT_SLOTS+2+FST_SET)
|
||||
GO4K_FST AMOUNT(88),DEST(11*MAX_UNIT_SLOTS+4+FST_SET)
|
||||
GO4K_ENV ATTAC(0),DECAY(60),SUSTAIN(0),RELEASE(0),GAIN(128)
|
||||
GO4K_FST AMOUNT(52),DEST(7*MAX_UNIT_SLOTS+6+FST_SET)
|
||||
GO4K_FOP OP(FOP_POP)
|
||||
GO4K_VCO TRANSPOSE(64),DETUNE(70),PHASE(32),GATES(85),COLOR(128),SHAPE(80),GAIN(64),FLAGS(SINE)
|
||||
GO4K_VCO TRANSPOSE(64),DETUNE(48),PHASE(48),GATES(85),COLOR(128),SHAPE(96),GAIN(64),FLAGS(SINE)
|
||||
GO4K_FOP OP(FOP_ADDP)
|
||||
GO4K_VCF FREQUENCY(32),RESONANCE(128),VCFTYPE(LOWPASS)
|
||||
GO4K_DST DRIVE(112), SNHFREQ(128), FLAGS(0)
|
||||
GO4K_VCF FREQUENCY(32),RESONANCE(128),VCFTYPE(ALLPASS)
|
||||
GO4K_FOP OP(FOP_MULP)
|
||||
GO4K_VCF FREQUENCY(24),RESONANCE(128),VCFTYPE(LOWPASS)
|
||||
GO4K_PAN PANNING(96)
|
||||
GO4K_OUT GAIN(4), AUXSEND(8)
|
||||
GO4K_END_PARAMDEF
|
||||
GO4K_BEGIN_PARAMDEF(Instrument8)
|
||||
GO4K_ENV ATTAC(0),DECAY(128),SUSTAIN(128),RELEASE(0),GAIN(128)
|
||||
GO4K_VCO TRANSPOSE(64),DETUNE(64),PHASE(0),GATES(1),COLOR(3),SHAPE(64),GAIN(128),FLAGS(GATE|LFO)
|
||||
GO4K_VCO TRANSPOSE(64),DETUNE(64),PHASE(0),GATES(0),COLOR(64),SHAPE(64),GAIN(32),FLAGS(NOISE)
|
||||
GO4K_VCF FREQUENCY(112),RESONANCE(128),VCFTYPE(BANDPASS)
|
||||
GO4K_VCF FREQUENCY(112),RESONANCE(128),VCFTYPE(LOWPASS)
|
||||
GO4K_FOP OP(FOP_MULP)
|
||||
GO4K_FOP OP(FOP_MULP)
|
||||
GO4K_PAN PANNING(80)
|
||||
GO4K_OUT GAIN(12), AUXSEND(8)
|
||||
GO4K_END_PARAMDEF
|
||||
GO4K_BEGIN_PARAMDEF(Instrument9)
|
||||
GO4K_ENV ATTAC(48),DECAY(64),SUSTAIN(64),RELEASE(88),GAIN(128)
|
||||
GO4K_ENV ATTAC(80),DECAY(128),SUSTAIN(128),RELEASE(128),GAIN(128)
|
||||
GO4K_FOP OP(FOP_PUSH)
|
||||
GO4K_FOP OP(FOP_MULP)
|
||||
GO4K_VCO TRANSPOSE(64),DETUNE(64),PHASE(0),GATES(0),COLOR(128),SHAPE(64),GAIN(8),FLAGS(SINE|LFO)
|
||||
GO4K_FOP OP(FOP_MULP)
|
||||
GO4K_FST AMOUNT(66),DEST(10*MAX_UNIT_SLOTS+1+FST_SET)
|
||||
GO4K_FST AMOUNT(66),DEST(11*MAX_UNIT_SLOTS+1+FST_SET)
|
||||
GO4K_FST AMOUNT(66),DEST(12*MAX_UNIT_SLOTS+1+FST_SET)
|
||||
GO4K_FOP OP(FOP_POP)
|
||||
GO4K_VCO TRANSPOSE(64),DETUNE(62),PHASE(0),GATES(0),COLOR(32),SHAPE(64),GAIN(64),FLAGS(TRISAW)
|
||||
GO4K_VCO TRANSPOSE(64),DETUNE(66),PHASE(48),GATES(0),COLOR(64),SHAPE(64),GAIN(64),FLAGS(TRISAW)
|
||||
GO4K_VCO TRANSPOSE(64),DETUNE(64),PHASE(96),GATES(0),COLOR(128),SHAPE(96),GAIN(64),FLAGS(SINE)
|
||||
GO4K_FOP OP(FOP_ADDP)
|
||||
GO4K_FOP OP(FOP_ADDP)
|
||||
GO4K_VCF FREQUENCY(8),RESONANCE(128),VCFTYPE(HIGHPASS)
|
||||
GO4K_DST DRIVE(80), SNHFREQ(96), FLAGS(0)
|
||||
GO4K_FOP OP(FOP_MULP)
|
||||
GO4K_VCF FREQUENCY(96),RESONANCE(0),VCFTYPE(BANDSTOP)
|
||||
GO4K_VCF FREQUENCY(64),RESONANCE(0),VCFTYPE(BANDSTOP)
|
||||
GO4K_VCF FREQUENCY(32),RESONANCE(0),VCFTYPE(BANDSTOP)
|
||||
GO4K_DLL PREGAIN(96),DRY(96),FEEDBACK(64),DAMP(64),FREQUENCY(0),DEPTH(0),DELAY(19),COUNT(1)
|
||||
GO4K_PAN PANNING(64)
|
||||
GO4K_OUT GAIN(32), AUXSEND(24)
|
||||
GO4K_END_PARAMDEF
|
||||
GO4K_BEGIN_PARAMDEF(Global)
|
||||
GO4K_ACC ACCTYPE(AUX)
|
||||
GO4K_VCF FREQUENCY(32),RESONANCE(64),VCFTYPE(HIGHPASS)
|
||||
GO4K_DLL PREGAIN(64),DRY(0),FEEDBACK(112),DAMP(32),FREQUENCY(128),DEPTH(0),DELAY(1),COUNT(8)
|
||||
GO4K_FOP OP(FOP_XCH)
|
||||
GO4K_VCF FREQUENCY(32),RESONANCE(64),VCFTYPE(HIGHPASS)
|
||||
GO4K_DLL PREGAIN(64),DRY(0),FEEDBACK(112),DAMP(32),FREQUENCY(128),DEPTH(0),DELAY(9),COUNT(8)
|
||||
GO4K_ACC ACCTYPE(OUTPUT)
|
||||
GO4K_FOP OP(FOP_ADDP2)
|
||||
GO4K_VCO TRANSPOSE(40),DETUNE(64),PHASE(32),GATES(0),COLOR(128),SHAPE(64),GAIN(128),FLAGS(SINE|LFO)
|
||||
GO4K_FSTG AMOUNT(80),DEST((0*go4k_instrument.size*MAX_VOICES/4)+(1*MAX_UNIT_SLOTS+7)+(go4k_instrument.workspace/4)+FST_SET)
|
||||
GO4K_FSTG AMOUNT(65),DEST((1*go4k_instrument.size*MAX_VOICES/4)+(1*MAX_UNIT_SLOTS+7)+(go4k_instrument.workspace/4)+FST_SET)
|
||||
GO4K_FOP OP(FOP_POP)
|
||||
GO4K_VCO TRANSPOSE(52),DETUNE(64),PHASE(33),GATES(0),COLOR(128),SHAPE(64),GAIN(128),FLAGS(SINE|LFO)
|
||||
GO4K_FSTG AMOUNT(88),DEST((8*go4k_instrument.size*MAX_VOICES/4)+(2*MAX_UNIT_SLOTS+7)+(go4k_instrument.workspace/4)+FST_SET)
|
||||
GO4K_FOP OP(FOP_POP)
|
||||
GO4K_VCF FREQUENCY(72),RESONANCE(32),VCFTYPE(ALLPASS)
|
||||
GO4K_VCF FREQUENCY(96),RESONANCE(64),VCFTYPE(ALLPASS)
|
||||
GO4K_VCF FREQUENCY(48),RESONANCE(128),VCFTYPE(PEAK)
|
||||
GO4K_FOP OP(FOP_XCH)
|
||||
GO4K_VCF FREQUENCY(72),RESONANCE(32),VCFTYPE(ALLPASS)
|
||||
GO4K_VCF FREQUENCY(96),RESONANCE(64),VCFTYPE(ALLPASS)
|
||||
GO4K_VCF FREQUENCY(48),RESONANCE(128),VCFTYPE(PEAK)
|
||||
GO4K_OUT GAIN(64), AUXSEND(0)
|
||||
GO4K_END_PARAMDEF
|
||||
go4k_synth_parameter_values_end
|
||||
%ifdef USE_SECTIONS
|
||||
section .g4kmuc5 data align=1
|
||||
%else
|
||||
section .data
|
||||
%endif
|
||||
%ifdef GO4K_USE_DLL
|
||||
global _go4k_delay_times
|
||||
_go4k_delay_times
|
||||
dw 0
|
||||
dw 1116
|
||||
dw 1188
|
||||
dw 1276
|
||||
dw 1356
|
||||
dw 1422
|
||||
dw 1492
|
||||
dw 1556
|
||||
dw 1618
|
||||
dw 1140
|
||||
dw 1212
|
||||
dw 1300
|
||||
dw 1380
|
||||
dw 1446
|
||||
dw 1516
|
||||
dw 1580
|
||||
dw 1642
|
||||
dw 30384
|
||||
dw 512
|
||||
dw 15192
|
||||
%endif
|
||||
577
8kode/src/intro/framework/authoring.h
Normal file
@@ -0,0 +1,577 @@
|
||||
#pragma once
|
||||
|
||||
#include <Shlwapi.h>
|
||||
#include "mutexlock.h"
|
||||
|
||||
static HANDLE shaderCompileEvent;
|
||||
|
||||
struct SharedMemoryToolType
|
||||
{
|
||||
int WindowLeft;
|
||||
int WindowTop;
|
||||
int WindowWidth;
|
||||
int WindowHeight;
|
||||
int MaxSamples;
|
||||
int SampleSize;
|
||||
int SamplesPerTick;
|
||||
int TicksPerScene;
|
||||
float IntroPosition;
|
||||
int AudioRenderPosition;
|
||||
int SeekToScene;
|
||||
bool KeepAlive;
|
||||
HWND introHandle;
|
||||
HWND analysisHandle;
|
||||
bool UseMinifiedShader;
|
||||
};
|
||||
|
||||
static D3D11_TEXTURE1D_DESC histogramTextureDesc =
|
||||
{
|
||||
256,
|
||||
1,
|
||||
1,
|
||||
DXGI_FORMAT_R32G32B32A32_FLOAT,
|
||||
D3D11_USAGE_DEFAULT,
|
||||
D3D11_BIND_UNORDERED_ACCESS,
|
||||
0,
|
||||
0
|
||||
};
|
||||
|
||||
static D3D11_TEXTURE1D_DESC histogramStagingTextureDesc =
|
||||
{
|
||||
256,
|
||||
1,
|
||||
1,
|
||||
DXGI_FORMAT_R32G32B32A32_FLOAT,
|
||||
D3D11_USAGE_STAGING,
|
||||
0,
|
||||
D3D11_CPU_ACCESS_READ,
|
||||
0
|
||||
};
|
||||
|
||||
static D3D11_TEXTURE1D_DESC histogramBucketTextureDesc =
|
||||
{
|
||||
257,
|
||||
1,
|
||||
1,
|
||||
DXGI_FORMAT_R32_UINT,
|
||||
D3D11_USAGE_DEFAULT,
|
||||
D3D11_BIND_UNORDERED_ACCESS,
|
||||
0,
|
||||
0
|
||||
};
|
||||
|
||||
static D3D11_TEXTURE2D_DESC paradeVectorScopeBucketTextureDesc =
|
||||
{
|
||||
257,
|
||||
256,
|
||||
1,
|
||||
1,
|
||||
DXGI_FORMAT_R32_UINT,
|
||||
{ 1, 0 },
|
||||
D3D11_USAGE_DEFAULT,
|
||||
D3D11_BIND_UNORDERED_ACCESS,
|
||||
0,
|
||||
0
|
||||
};
|
||||
|
||||
static D3D11_TEXTURE2D_DESC paradeTextureDesc =
|
||||
{
|
||||
256,
|
||||
256,
|
||||
1,
|
||||
1,
|
||||
DXGI_FORMAT_R8G8B8A8_UINT,
|
||||
{ 1, 0 },
|
||||
D3D11_USAGE_DEFAULT,
|
||||
D3D11_BIND_UNORDERED_ACCESS,
|
||||
0,
|
||||
0
|
||||
};
|
||||
|
||||
static D3D11_TEXTURE2D_DESC paradeStagingTextureDesc =
|
||||
{
|
||||
256,
|
||||
256,
|
||||
1,
|
||||
1,
|
||||
DXGI_FORMAT_R8G8B8A8_UINT,
|
||||
{ 1, 0 },
|
||||
D3D11_USAGE_STAGING,
|
||||
0,
|
||||
D3D11_CPU_ACCESS_READ,
|
||||
0
|
||||
};
|
||||
|
||||
static D3D11_TEXTURE2D_DESC vectorScopeTextureDesc =
|
||||
{
|
||||
256,
|
||||
256,
|
||||
1,
|
||||
1,
|
||||
DXGI_FORMAT_R8G8B8A8_UINT,
|
||||
{ 1, 0 },
|
||||
D3D11_USAGE_DEFAULT,
|
||||
D3D11_BIND_UNORDERED_ACCESS,
|
||||
0,
|
||||
0
|
||||
};
|
||||
|
||||
static D3D11_TEXTURE2D_DESC vectorScopeStagingTextureDesc =
|
||||
{
|
||||
256,
|
||||
256,
|
||||
1,
|
||||
1,
|
||||
DXGI_FORMAT_R8G8B8A8_UINT,
|
||||
{ 1, 0 },
|
||||
D3D11_USAGE_STAGING,
|
||||
0,
|
||||
D3D11_CPU_ACCESS_READ,
|
||||
0
|
||||
};
|
||||
|
||||
static D3D11_UNORDERED_ACCESS_VIEW_DESC histogramUAVdesc =
|
||||
{
|
||||
DXGI_FORMAT_R32G32B32A32_FLOAT,
|
||||
D3D11_UAV_DIMENSION_TEXTURE1D,
|
||||
{ 0 }
|
||||
};
|
||||
|
||||
static D3D11_UNORDERED_ACCESS_VIEW_DESC histogramBucketUAVdesc =
|
||||
{
|
||||
DXGI_FORMAT_R32_UINT,
|
||||
D3D11_UAV_DIMENSION_TEXTURE1D,
|
||||
{ 0 }
|
||||
};
|
||||
|
||||
static D3D11_UNORDERED_ACCESS_VIEW_DESC paradeUAVdesc =
|
||||
{
|
||||
DXGI_FORMAT_R8G8B8A8_UINT,
|
||||
D3D11_UAV_DIMENSION_TEXTURE2D,
|
||||
{ 0, 1 }
|
||||
};
|
||||
|
||||
static D3D11_UNORDERED_ACCESS_VIEW_DESC paradeVectorScopeBucketUAVdesc =
|
||||
{
|
||||
DXGI_FORMAT_R32_UINT,
|
||||
D3D11_UAV_DIMENSION_TEXTURE2D,
|
||||
{ 0, 1 }
|
||||
};
|
||||
|
||||
static D3D11_UNORDERED_ACCESS_VIEW_DESC vectorScopeUAVdesc =
|
||||
{
|
||||
DXGI_FORMAT_R8G8B8A8_UINT,
|
||||
D3D11_UAV_DIMENSION_TEXTURE2D,
|
||||
{ 0, 1 }
|
||||
};
|
||||
|
||||
static D3D11_SHADER_RESOURCE_VIEW_DESC analysisSRVdesc =
|
||||
{
|
||||
DXGI_FORMAT_R8G8B8A8_UNORM,
|
||||
D3D11_SRV_DIMENSION_TEXTURE2D,
|
||||
{ 0, 1 }
|
||||
};
|
||||
|
||||
static SharedMemoryToolType* SharedMemoryTool;
|
||||
static char* SharedImage;
|
||||
static HANDLE AudioFileMapping;
|
||||
static HANDLE ImageFileMapping;
|
||||
static HANDLE HistogramFileMapping;
|
||||
static HANDLE ParadeFileMapping;
|
||||
static HANDLE VectorscopeFileMapping;
|
||||
static HANDLE SharedMemoryFileMapping;
|
||||
static bool playMusic;
|
||||
static long musicStartOffset;
|
||||
static HANDLE SharedMemoryMutex;
|
||||
static D3D11_TEXTURE2D_DESC analysisDesc;
|
||||
static ID3D11Texture2D* resolvedTexture;
|
||||
static ID3D11Texture2D* stagingTexture;
|
||||
static ID3D11Texture1D* histogramTexture;
|
||||
static ID3D11Texture1D* histogramRedBucketTexture;
|
||||
static ID3D11Texture1D* histogramGreenBucketTexture;
|
||||
static ID3D11Texture1D* histogramBlueBucketTexture;
|
||||
static ID3D11Texture1D* histogramStagingTexture;
|
||||
static ID3D11Texture2D* paradeRedBucketTexture;
|
||||
static ID3D11Texture2D* paradeGreenBucketTexture;
|
||||
static ID3D11Texture2D* paradeBlueBucketTexture;
|
||||
static ID3D11Texture2D* paradeAlphaBucketTexture;
|
||||
static ID3D11Texture2D* paradeTexture;
|
||||
static ID3D11Texture2D* paradeStagingTexture;
|
||||
static ID3D11Texture2D* vectorScopeBucketTexture;
|
||||
static ID3D11Texture2D* vectorScopeTexture;
|
||||
static ID3D11Texture2D* vectorScopeStagingTexture;
|
||||
static ID3D11ComputeShader* csHistogramGather;
|
||||
static ID3D11ComputeShader* csHistogramMaximum;
|
||||
static ID3D11ComputeShader* csHistogramSpread;
|
||||
static ID3D11ComputeShader* csParadeVectorscopeGather;
|
||||
static ID3D11ComputeShader* csParadeVectorscopeMaximum;
|
||||
static ID3D11ComputeShader* csParadeVectorscopeSpread;
|
||||
static ID3D11UnorderedAccessView* histogramUAV;
|
||||
static ID3D11UnorderedAccessView* histogramRedBucketUAV;
|
||||
static ID3D11UnorderedAccessView* histogramGreenBucketUAV;
|
||||
static ID3D11UnorderedAccessView* histogramBlueBucketUAV;
|
||||
static ID3D11UnorderedAccessView* paradeUAV;
|
||||
static ID3D11UnorderedAccessView* paradeRedBucketUAV;
|
||||
static ID3D11UnorderedAccessView* paradeGreenBucketUAV;
|
||||
static ID3D11UnorderedAccessView* paradeBlueBucketUAV;
|
||||
static ID3D11UnorderedAccessView* paradeAlphaBucketUAV;
|
||||
static ID3D11UnorderedAccessView* vectorScopeUAV;
|
||||
static ID3D11UnorderedAccessView* vectorScopeBucketUAV;
|
||||
static ID3D11ShaderResourceView* analysisSRV;
|
||||
static D3D11_MAPPED_SUBRESOURCE mappedResource;
|
||||
static float* histogram;
|
||||
static float* parade;
|
||||
static float* vectorscope;
|
||||
static HANDLE hShaderErrorPipe;
|
||||
|
||||
extern "C" int _4klang_current_tick;
|
||||
|
||||
float AuthoringGetIntroPosition()
|
||||
{
|
||||
float time = SoundGetIntroPosition();
|
||||
return time + musicStartOffset / (float)(SAMPLES_PER_TICK * SOUND_TICKS_PER_SCENE);
|
||||
}
|
||||
|
||||
void ReadFile(char* path, char** content, size_t* length)
|
||||
{
|
||||
FILE* shaderFile;
|
||||
auto error = fopen_s(&shaderFile, path, "rb");
|
||||
fseek(shaderFile, 0, SEEK_END);
|
||||
*length = ftell(shaderFile);
|
||||
*content = new char[*length];
|
||||
fseek(shaderFile, 0, SEEK_SET);
|
||||
fread_s(*content, *length, sizeof(char), *length, shaderFile);
|
||||
fclose(shaderFile);
|
||||
}
|
||||
|
||||
void AuthoringInit()
|
||||
{
|
||||
MutexLock("IntroAuthorMutex");
|
||||
|
||||
Log("IntroInit");
|
||||
SharedMemoryFileMapping = CreateFileMapping(INVALID_HANDLE_VALUE, NULL, PAGE_READWRITE, 0, sizeof(SharedMemoryToolType), "IntroAuthor");
|
||||
AudioFileMapping = CreateFileMapping(INVALID_HANDLE_VALUE, NULL, PAGE_READWRITE, 0, sizeof(SAMPLE_TYPE)* MAX_SAMPLES * 2, "IntroAudio");
|
||||
ImageFileMapping = CreateFileMapping(INVALID_HANDLE_VALUE, NULL, PAGE_READWRITE, 0, 4 * SCREENWIDTH * SCREENHEIGHT, "IntroImage");
|
||||
HistogramFileMapping = CreateFileMapping(INVALID_HANDLE_VALUE, NULL, PAGE_READWRITE, 0, 4 * 4 * 256, "IntroHistogram");
|
||||
ParadeFileMapping = CreateFileMapping(INVALID_HANDLE_VALUE, NULL, PAGE_READWRITE, 0, 4 * 256 * 256, "IntroParade");
|
||||
VectorscopeFileMapping = CreateFileMapping(INVALID_HANDLE_VALUE, NULL, PAGE_READWRITE, 0, 4 * 256 * 256, "IntroVectorscope");
|
||||
|
||||
SharedMemoryTool = (SharedMemoryToolType*)MapViewOfFile(SharedMemoryFileMapping, FILE_MAP_ALL_ACCESS, 0, 0, sizeof(SharedMemoryToolType));
|
||||
soundBuffer = (SAMPLE_TYPE*)MapViewOfFile(AudioFileMapping, FILE_MAP_ALL_ACCESS, 0, 0, sizeof(SAMPLE_TYPE)* MAX_SAMPLES * 2);
|
||||
SharedImage = (char*)MapViewOfFile(ImageFileMapping, FILE_MAP_ALL_ACCESS, 0, 0, 4 * SCREENWIDTH * SCREENHEIGHT);
|
||||
histogram = (float*)MapViewOfFile(HistogramFileMapping, FILE_MAP_ALL_ACCESS, 0, 0, 4 * 4 * 256);
|
||||
parade = (float*)MapViewOfFile(ParadeFileMapping, FILE_MAP_ALL_ACCESS, 0, 0, 4 * 256 * 256);
|
||||
vectorscope = (float*)MapViewOfFile(VectorscopeFileMapping, FILE_MAP_ALL_ACCESS, 0, 0, 4 * 256 * 256);
|
||||
|
||||
WaveHDR.lpData = (LPSTR)soundBuffer;
|
||||
|
||||
RECT rect;
|
||||
GetWindowRect(windowHandle, &rect);
|
||||
SharedMemoryTool->WindowLeft = rect.left;
|
||||
SharedMemoryTool->WindowTop = rect.top;
|
||||
SharedMemoryTool->WindowWidth = rect.right - rect.left - 16;
|
||||
SharedMemoryTool->WindowHeight = rect.bottom - rect.top - 39;
|
||||
SharedMemoryTool->MaxSamples = MAX_SAMPLES;
|
||||
SharedMemoryTool->SampleSize = sizeof(SAMPLE_TYPE);
|
||||
SharedMemoryTool->SamplesPerTick = SAMPLES_PER_TICK;
|
||||
SharedMemoryTool->TicksPerScene = SOUND_TICKS_PER_SCENE;
|
||||
SharedMemoryTool->SeekToScene = -1;
|
||||
SharedMemoryTool->KeepAlive = true;
|
||||
SharedMemoryTool->UseMinifiedShader = true;
|
||||
|
||||
backBufferTexture->GetDesc(&analysisDesc);
|
||||
analysisDesc.Usage = D3D11_USAGE_DEFAULT;
|
||||
analysisDesc.Format = DXGI_FORMAT_R8G8B8A8_UNORM;
|
||||
analysisDesc.BindFlags = D3D11_BIND_SHADER_RESOURCE;
|
||||
analysisDesc.SampleDesc.Count = 1;
|
||||
device->CreateTexture2D(&analysisDesc, NULL, &resolvedTexture);
|
||||
|
||||
analysisDesc.Usage = D3D11_USAGE_STAGING;
|
||||
analysisDesc.BindFlags = 0;
|
||||
analysisDesc.CPUAccessFlags |= D3D11_CPU_ACCESS_READ;
|
||||
device->CreateTexture2D(&analysisDesc, NULL, &stagingTexture);
|
||||
device->CreateShaderResourceView(resolvedTexture, &analysisSRVdesc, &analysisSRV);
|
||||
|
||||
device->CreateTexture1D(&histogramTextureDesc, NULL, &histogramTexture);
|
||||
device->CreateTexture1D(&histogramBucketTextureDesc, NULL, &histogramRedBucketTexture);
|
||||
device->CreateTexture1D(&histogramBucketTextureDesc, NULL, &histogramGreenBucketTexture);
|
||||
device->CreateTexture1D(&histogramBucketTextureDesc, NULL, &histogramBlueBucketTexture);
|
||||
device->CreateUnorderedAccessView(histogramTexture, &histogramUAVdesc, &histogramUAV);
|
||||
device->CreateUnorderedAccessView(histogramRedBucketTexture, &histogramBucketUAVdesc, &histogramRedBucketUAV);
|
||||
device->CreateUnorderedAccessView(histogramGreenBucketTexture, &histogramBucketUAVdesc, &histogramGreenBucketUAV);
|
||||
device->CreateUnorderedAccessView(histogramBlueBucketTexture, &histogramBucketUAVdesc, &histogramBlueBucketUAV);
|
||||
device->CreateTexture1D(&histogramStagingTextureDesc, NULL, &histogramStagingTexture);
|
||||
|
||||
device->CreateTexture2D(¶deVectorScopeBucketTextureDesc, NULL, ¶deRedBucketTexture);
|
||||
device->CreateTexture2D(¶deVectorScopeBucketTextureDesc, NULL, ¶deGreenBucketTexture);
|
||||
device->CreateTexture2D(¶deVectorScopeBucketTextureDesc, NULL, ¶deBlueBucketTexture);
|
||||
device->CreateTexture2D(¶deVectorScopeBucketTextureDesc, NULL, ¶deAlphaBucketTexture);
|
||||
device->CreateTexture2D(¶deVectorScopeBucketTextureDesc, NULL, &vectorScopeBucketTexture);
|
||||
|
||||
device->CreateTexture2D(¶deTextureDesc, NULL, ¶deTexture);
|
||||
device->CreateTexture2D(¶deStagingTextureDesc, NULL, ¶deStagingTexture);
|
||||
device->CreateTexture2D(&vectorScopeTextureDesc, NULL, &vectorScopeTexture);
|
||||
device->CreateTexture2D(&vectorScopeStagingTextureDesc, NULL, &vectorScopeStagingTexture);
|
||||
|
||||
device->CreateUnorderedAccessView(paradeRedBucketTexture, ¶deVectorScopeBucketUAVdesc, ¶deRedBucketUAV);
|
||||
device->CreateUnorderedAccessView(paradeGreenBucketTexture, ¶deVectorScopeBucketUAVdesc, ¶deGreenBucketUAV);
|
||||
device->CreateUnorderedAccessView(paradeBlueBucketTexture, ¶deVectorScopeBucketUAVdesc, ¶deBlueBucketUAV);
|
||||
device->CreateUnorderedAccessView(paradeAlphaBucketTexture, ¶deVectorScopeBucketUAVdesc, ¶deAlphaBucketUAV);
|
||||
device->CreateUnorderedAccessView(vectorScopeBucketTexture, ¶deVectorScopeBucketUAVdesc, &vectorScopeBucketUAV);
|
||||
device->CreateUnorderedAccessView(vectorScopeTexture, &vectorScopeUAVdesc, &vectorScopeUAV);
|
||||
device->CreateUnorderedAccessView(paradeTexture, ¶deUAVdesc, ¶deUAV);
|
||||
|
||||
static char shaderPath[MAX_PATH];
|
||||
static char exePath[MAX_PATH];
|
||||
static char* shaderCode;
|
||||
static size_t shaderLength;
|
||||
|
||||
GetModuleFileName(NULL, exePath, MAX_PATH);
|
||||
PathRemoveFileSpec(exePath);
|
||||
|
||||
PathCombine(shaderPath, exePath, "histogramGather.cso");
|
||||
ReadFile(shaderPath, &shaderCode, &shaderLength);
|
||||
device->CreateComputeShader(shaderCode, shaderLength, NULL, &csHistogramGather);
|
||||
|
||||
PathCombine(shaderPath, exePath, "histogramMaximum.cso");
|
||||
ReadFile(shaderPath, &shaderCode, &shaderLength);
|
||||
device->CreateComputeShader(shaderCode, shaderLength, NULL, &csHistogramMaximum);
|
||||
|
||||
PathCombine(shaderPath, exePath, "histogramSpread.cso");
|
||||
ReadFile(shaderPath, &shaderCode, &shaderLength);
|
||||
device->CreateComputeShader(shaderCode, shaderLength, NULL, &csHistogramSpread);
|
||||
|
||||
PathCombine(shaderPath, exePath, "paradeVectorscopeGather.cso");
|
||||
ReadFile(shaderPath, &shaderCode, &shaderLength);
|
||||
device->CreateComputeShader(shaderCode, shaderLength, NULL, &csParadeVectorscopeGather);
|
||||
|
||||
PathCombine(shaderPath, exePath, "paradeVectorscopeMaximum.cso");
|
||||
ReadFile(shaderPath, &shaderCode, &shaderLength);
|
||||
device->CreateComputeShader(shaderCode, shaderLength, NULL, &csParadeVectorscopeMaximum);
|
||||
|
||||
PathCombine(shaderPath, exePath, "paradeVectorscopeSpread.cso");
|
||||
ReadFile(shaderPath, &shaderCode, &shaderLength);
|
||||
device->CreateComputeShader(shaderCode, shaderLength, NULL, &csParadeVectorscopeSpread);
|
||||
|
||||
while (1)
|
||||
{
|
||||
auto pipeName = "\\\\.\\pipe\\8kode";
|
||||
hShaderErrorPipe = CreateFileA(
|
||||
pipeName, // pipe name
|
||||
GENERIC_WRITE |
|
||||
GENERIC_WRITE, // read/write access
|
||||
0, // no sharing
|
||||
NULL, // default security attributes
|
||||
OPEN_EXISTING, // opens existing pipe
|
||||
0, // default attributes
|
||||
NULL); // no template file
|
||||
|
||||
// Break if the pipe handle is valid.
|
||||
if (hShaderErrorPipe != INVALID_HANDLE_VALUE)
|
||||
break;
|
||||
|
||||
// Exit if an error other than ERROR_PIPE_BUSY occurs.
|
||||
DWORD error;
|
||||
if (error = GetLastError() != ERROR_PIPE_BUSY)
|
||||
{
|
||||
Error("Could not open pipe");
|
||||
}
|
||||
|
||||
// All pipe instances are busy, so wait for 2 seconds.
|
||||
if (WaitNamedPipe(pipeName, 2000))
|
||||
{
|
||||
printf("Could not open pipe: 2 second wait timed out.");
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
bool audio_IsPaused = false;
|
||||
|
||||
void SoundSeekToRow(void *d, int row)
|
||||
{
|
||||
if (row < 0)
|
||||
row = 0;
|
||||
|
||||
musicStartOffset = row * (long)(SAMPLES_PER_TICK * SOUND_TICKS_PER_SCENE) / SYNC_ROWS_PER_SCENE;
|
||||
|
||||
WaveHDR.lpData = (LPSTR)(float*)(soundBuffer + musicStartOffset * 2);
|
||||
WaveHDR.dwBufferLength = (MAX_SAMPLES - musicStartOffset) * sizeof(SAMPLE_TYPE) * 2;
|
||||
|
||||
//send buffer to waveOut
|
||||
waveOutReset(hWaveOut);
|
||||
waveOutPrepareHeader(hWaveOut, &WaveHDR, sizeof(WaveHDR));
|
||||
waveOutWrite(hWaveOut, &WaveHDR, sizeof(WaveHDR));
|
||||
|
||||
//put on pause
|
||||
if (audio_IsPaused)
|
||||
waveOutPause(hWaveOut);
|
||||
}
|
||||
|
||||
void SoundSeekToScene(void *d, int scene)
|
||||
{
|
||||
SoundSeekToRow(d, scene * SYNC_ROWS_PER_SCENE);
|
||||
}
|
||||
|
||||
void SoundPause(void *d, int iPause)
|
||||
{
|
||||
// Check if there is change of current play/pause state?
|
||||
if (audio_IsPaused != (bool)iPause)
|
||||
{
|
||||
// Assign new state
|
||||
audio_IsPaused = (bool)iPause;
|
||||
|
||||
// Change audio play state
|
||||
if (audio_IsPaused)
|
||||
waveOutPause(hWaveOut);
|
||||
else
|
||||
waveOutRestart(hWaveOut);
|
||||
}
|
||||
}
|
||||
|
||||
int SoundIsPlaying(void *d)
|
||||
{
|
||||
return (int)!audio_IsPaused;
|
||||
}
|
||||
|
||||
struct sync_cb usync_cb =
|
||||
{
|
||||
SoundPause,
|
||||
SoundSeekToRow,
|
||||
SoundIsPlaying
|
||||
};
|
||||
|
||||
void *usync_data = NULL;
|
||||
|
||||
bool AuthoringUpdate()
|
||||
{
|
||||
SharedMemoryTool->IntroPosition = AuthoringGetIntroPosition();
|
||||
SharedMemoryTool->AudioRenderPosition = _4klang_current_tick * SAMPLES_PER_TICK;
|
||||
SetWindowPos(windowHandle, 0, SharedMemoryTool->WindowLeft, SharedMemoryTool->WindowTop, SharedMemoryTool->WindowWidth + 16, SharedMemoryTool->WindowHeight + 39, 0);
|
||||
|
||||
static ID3D11Buffer* empty[16];
|
||||
|
||||
context->CSSetConstantBuffers(0, 8, empty);
|
||||
context->VSSetConstantBuffers(0, 8, empty);
|
||||
context->GSSetConstantBuffers(0, 8, empty);
|
||||
context->HSSetConstantBuffers(0, 8, empty);
|
||||
context->DSSetConstantBuffers(0, 8, empty);
|
||||
context->PSSetConstantBuffers(0, 8, empty);
|
||||
|
||||
context->ResolveSubresource(resolvedTexture, 0, backBufferTexture, 0, analysisDesc.Format);
|
||||
context->CopyResource(stagingTexture, resolvedTexture);
|
||||
context->Map(stagingTexture, 0, D3D11_MAP_READ, 0, &mappedResource);
|
||||
memcpy(SharedImage, mappedResource.pData, 4 * SCREENWIDTH * SCREENHEIGHT);
|
||||
context->Unmap(stagingTexture, 0);
|
||||
|
||||
static ID3D11UnorderedAccessView* histogramUAVs[] =
|
||||
{
|
||||
backBufferUAV,
|
||||
histogramRedBucketUAV,
|
||||
histogramGreenBucketUAV,
|
||||
histogramBlueBucketUAV,
|
||||
histogramUAV,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0
|
||||
};
|
||||
|
||||
static ID3D11UnorderedAccessView* paradeVectorscopeUAVs[] =
|
||||
{
|
||||
backBufferUAV,
|
||||
paradeRedBucketUAV,
|
||||
paradeGreenBucketUAV,
|
||||
paradeBlueBucketUAV,
|
||||
paradeAlphaBucketUAV,
|
||||
vectorScopeBucketUAV,
|
||||
paradeUAV,
|
||||
vectorScopeUAV
|
||||
};
|
||||
|
||||
static UINT zero[] = { 0, 0, 0, 0, 0, 0, 0, 0 };
|
||||
|
||||
context->ClearUnorderedAccessViewUint(histogramRedBucketUAV, zero);
|
||||
context->ClearUnorderedAccessViewUint(histogramGreenBucketUAV, zero);
|
||||
context->ClearUnorderedAccessViewUint(histogramBlueBucketUAV, zero);
|
||||
context->ClearUnorderedAccessViewUint(vectorScopeBucketUAV, zero);
|
||||
context->ClearUnorderedAccessViewUint(paradeRedBucketUAV, zero);
|
||||
context->ClearUnorderedAccessViewUint(paradeGreenBucketUAV, zero);
|
||||
context->ClearUnorderedAccessViewUint(paradeBlueBucketUAV, zero);
|
||||
context->ClearUnorderedAccessViewUint(paradeAlphaBucketUAV, zero);
|
||||
|
||||
context->CSSetShaderResources(0, 1, &analysisSRV);
|
||||
|
||||
context->OMSetRenderTargets(1, (ID3D11RenderTargetView* const *)zero, NULL);
|
||||
context->CSSetUnorderedAccessViews(0, 8, histogramUAVs, NULL);
|
||||
context->CSSetShader(csHistogramGather, NULL, 0);
|
||||
context->Dispatch(SCREENWIDTH / 16, SCREENHEIGHT / 16, 1);
|
||||
context->CSSetShader(csHistogramMaximum, NULL, 0);
|
||||
context->Dispatch(16, 1, 1);
|
||||
context->CSSetShader(csHistogramSpread, NULL, 0);
|
||||
context->Dispatch(16, 1, 1);
|
||||
|
||||
context->CSSetUnorderedAccessViews(0, 8, paradeVectorscopeUAVs, NULL);
|
||||
context->CSSetShader(csParadeVectorscopeGather, NULL, 0);
|
||||
context->Dispatch(SCREENWIDTH / 16, SCREENHEIGHT / 16, 1);
|
||||
context->CSSetShader(csParadeVectorscopeMaximum, NULL, 0);
|
||||
context->Dispatch(16, 16, 1);
|
||||
context->CSSetShader(csParadeVectorscopeSpread, NULL, 0);
|
||||
context->Dispatch(16, 16, 1);
|
||||
|
||||
context->CSSetShaderResources(0, 1, (ID3D11ShaderResourceView* const*)zero);
|
||||
context->CSSetUnorderedAccessViews(0, 8, (ID3D11UnorderedAccessView* const *)zero, NULL);
|
||||
|
||||
context->CopyResource(histogramStagingTexture, histogramTexture);
|
||||
context->Map(histogramStagingTexture, 0, D3D11_MAP_READ, 0, &mappedResource);
|
||||
memcpy(histogram, mappedResource.pData, 4 * 4 * 256);
|
||||
context->Unmap(histogramStagingTexture, 0);
|
||||
|
||||
context->CopyResource(paradeStagingTexture, paradeTexture);
|
||||
context->Map(paradeStagingTexture, 0, D3D11_MAP_READ, 0, &mappedResource);
|
||||
memcpy(parade, mappedResource.pData, 4 * 256 * 256);
|
||||
context->Unmap(paradeStagingTexture, 0);
|
||||
|
||||
context->CopyResource(vectorScopeStagingTexture, vectorScopeTexture);
|
||||
context->Map(vectorScopeStagingTexture, 0, D3D11_MAP_READ, 0, &mappedResource);
|
||||
memcpy(vectorscope, mappedResource.pData, 4 * 256 * 256);
|
||||
context->Unmap(vectorScopeStagingTexture, 0);
|
||||
|
||||
if (::WaitForSingleObject(shaderCompileEvent, 0) == WAIT_OBJECT_0)
|
||||
{
|
||||
::Sleep(100);
|
||||
FrameworkShadersCompile();
|
||||
}
|
||||
|
||||
if (SharedMemoryTool->SeekToScene != -1)
|
||||
{
|
||||
auto scene = SharedMemoryTool->SeekToScene;
|
||||
SharedMemoryTool->SeekToScene = -1;
|
||||
SoundSeekToScene(NULL, scene);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
void AuthoringDispose()
|
||||
{
|
||||
usync_export();
|
||||
|
||||
Log("AuthoringDispose");
|
||||
|
||||
UnmapViewOfFile(SharedMemoryTool);
|
||||
UnmapViewOfFile(soundBuffer);
|
||||
UnmapViewOfFile(SharedImage);
|
||||
UnmapViewOfFile(histogram);
|
||||
UnmapViewOfFile(parade);
|
||||
UnmapViewOfFile(vectorscope);
|
||||
|
||||
CloseHandle(SharedMemoryFileMapping);
|
||||
CloseHandle(AudioFileMapping);
|
||||
CloseHandle(ImageFileMapping);
|
||||
CloseHandle(HistogramFileMapping);
|
||||
CloseHandle(ParadeFileMapping);
|
||||
CloseHandle(VectorscopeFileMapping);
|
||||
|
||||
CloseHandle(SharedMemoryMutex);
|
||||
}
|
||||
91
8kode/src/intro/framework/directx.h
Normal file
@@ -0,0 +1,91 @@
|
||||
#pragma once
|
||||
|
||||
#include <d3d11.h>
|
||||
|
||||
//#define DEPTH_STENCIL
|
||||
|
||||
#ifndef RELEASE
|
||||
#define D3D_DEVICE_FLAGS D3D11_CREATE_DEVICE_DEBUG
|
||||
#else
|
||||
#define D3D_DEVICE_FLAGS 0
|
||||
#endif
|
||||
|
||||
#pragma bss_seg(".directxBss")
|
||||
static ID3D11Device* device;
|
||||
static ID3D11DeviceContext* context;
|
||||
static IDXGISwapChain* swapChain;
|
||||
static ID3D11Texture2D* backBufferTexture;
|
||||
static ID3D11UnorderedAccessView* backBufferUAV;
|
||||
static ID3D11RenderTargetView* backBufferRTV;
|
||||
|
||||
#ifdef DEPTH_STENCIL
|
||||
static ID3D11Texture2D* depthStencilBuffer;
|
||||
static ID3D11DepthStencilState* depthStencilState;
|
||||
static ID3D11DepthStencilView* depthStencilView;
|
||||
static ID3D11ShaderResourceView* depthStencilSRV;
|
||||
#endif
|
||||
|
||||
#pragma data_seg(".backBufferUAVdesc")
|
||||
static D3D11_UNORDERED_ACCESS_VIEW_DESC backBufferUAVdesc =
|
||||
{
|
||||
DXGI_FORMAT_R8G8B8A8_UNORM,
|
||||
D3D11_UAV_DIMENSION_TEXTURE2D,
|
||||
{ 0 }
|
||||
};
|
||||
|
||||
#pragma data_seg(".backBufferRTVdesc")
|
||||
static D3D11_RENDER_TARGET_VIEW_DESC backBufferRTVdesc =
|
||||
{
|
||||
DXGI_FORMAT_R8G8B8A8_UNORM,
|
||||
D3D11_RTV_DIMENSION_TEXTURE2D,
|
||||
{ 0 }
|
||||
};
|
||||
|
||||
#pragma data_seg(".directxFeatureLevel")
|
||||
static D3D_FEATURE_LEVEL featureLevel[] = { D3D_FEATURE_LEVEL_11_0 };
|
||||
|
||||
#pragma data_seg(".directxSwapChainDesc")
|
||||
static DXGI_SWAP_CHAIN_DESC swapChainDesc =
|
||||
{
|
||||
{
|
||||
SCREENWIDTH,
|
||||
SCREENHEIGHT,
|
||||
{
|
||||
0, 1
|
||||
},
|
||||
DXGI_FORMAT_R8G8B8A8_UNORM,
|
||||
DXGI_MODE_SCANLINE_ORDER_UNSPECIFIED,
|
||||
DXGI_MODE_SCALING_UNSPECIFIED
|
||||
},
|
||||
{
|
||||
1, 0
|
||||
},
|
||||
DXGI_USAGE_RENDER_TARGET_OUTPUT | DXGI_USAGE_UNORDERED_ACCESS,
|
||||
1,
|
||||
0,
|
||||
WINDOWED,
|
||||
DXGI_SWAP_EFFECT_DISCARD,
|
||||
0
|
||||
};
|
||||
|
||||
#pragma data_seg(".swapChainViewport")
|
||||
static D3D11_VIEWPORT swapChainViewport =
|
||||
{
|
||||
0.0f,
|
||||
0.0f,
|
||||
SCREENWIDTH,
|
||||
SCREENHEIGHT,
|
||||
0.0f,
|
||||
1.0f,
|
||||
};
|
||||
|
||||
#pragma code_seg(".directxInit")
|
||||
INLINE void DirectXInit()
|
||||
{
|
||||
Log("DirectXInit");
|
||||
swapChainDesc.OutputWindow = windowHandle;
|
||||
CHECK(D3D11CreateDeviceAndSwapChain(NULL, D3D_DRIVER_TYPE_HARDWARE, NULL, D3D_DEVICE_FLAGS, featureLevel, 1, D3D11_SDK_VERSION, &swapChainDesc, &swapChain, &device, NULL, &context));
|
||||
CHECK(swapChain->GetBuffer(0, __uuidof(ID3D11Texture2D), (LPVOID*)&backBufferTexture));
|
||||
CHECK(device->CreateUnorderedAccessView(backBufferTexture, &backBufferUAVdesc, &backBufferUAV));
|
||||
CHECK(device->CreateRenderTargetView(backBufferTexture, &backBufferRTVdesc, &backBufferRTV));
|
||||
}
|
||||
128
8kode/src/intro/framework/framework.h
Normal file
@@ -0,0 +1,128 @@
|
||||
#pragma once
|
||||
|
||||
#ifndef _DEBUG
|
||||
#define INLINE __forceinline
|
||||
#else
|
||||
#define INLINE
|
||||
#endif
|
||||
|
||||
#define VC_EXTRALEAN
|
||||
#define WIN32_LEAN_AND_MEAN
|
||||
#include <Windows.h>
|
||||
#include "log.h"
|
||||
#include "window.h"
|
||||
#include "directx.h"
|
||||
#include "4klang.h"
|
||||
#include "sound.h"
|
||||
#include "video.h"
|
||||
|
||||
#pragma bss_seg(".shadersbss")
|
||||
static void* shaderCode;
|
||||
static size_t shaderSize;
|
||||
|
||||
#ifdef AUTHORING
|
||||
bool CompileShader_Authoring(char* entryPoint, char* profile);
|
||||
#define CompileShader(entryPoint, profile) { if (!CompileShader_Authoring(entryPoint, profile)) return; }
|
||||
#else
|
||||
void CompileShader_Release(char* entryPoint, char* profile);
|
||||
#define CompileShader(entryPoint, profile) CompileShader_Release(entryPoint, profile)
|
||||
#endif
|
||||
|
||||
#include "sync/usync.h"
|
||||
#include "shaders_shc.h"
|
||||
|
||||
#pragma code_seg(".introforward")
|
||||
void IntroInit();
|
||||
void IntroUpdate(float _introPosition);
|
||||
|
||||
#ifdef AUTHORING
|
||||
#include "authoring.h"
|
||||
#endif
|
||||
|
||||
#include "shaders.h"
|
||||
|
||||
INLINE void FrameworkInit()
|
||||
{
|
||||
Log("FrameworkInit");
|
||||
WindowInit();
|
||||
DirectXInit();
|
||||
ShadersInit();
|
||||
SyncInit();
|
||||
|
||||
#ifdef AUTHORING
|
||||
AuthoringInit();
|
||||
#endif
|
||||
|
||||
FrameworkShadersCompile();
|
||||
IntroInit();
|
||||
SoundInit();
|
||||
|
||||
#ifdef AUTHORING
|
||||
SoundPause(NULL, (int)true);
|
||||
#endif
|
||||
|
||||
#ifdef VIDEO
|
||||
VideoInit();
|
||||
#endif
|
||||
}
|
||||
|
||||
INLINE float FrameworkGetIntroPosition()
|
||||
{
|
||||
#ifdef AUTHORING
|
||||
return AuthoringGetIntroPosition();
|
||||
#elif VIDEO
|
||||
return VideoGetPosition();
|
||||
#else
|
||||
return SoundGetIntroPosition();
|
||||
#endif
|
||||
}
|
||||
|
||||
INLINE void FrameworkUpdate()
|
||||
{
|
||||
#ifdef VIDEO
|
||||
float t = VideoGetPosition();
|
||||
#else
|
||||
float t = FrameworkGetIntroPosition();
|
||||
#endif
|
||||
|
||||
SyncUpdate(t);
|
||||
|
||||
#ifdef AUTHORING
|
||||
if (AuthoringUpdate())
|
||||
{
|
||||
IntroUpdate(t);
|
||||
}
|
||||
#else
|
||||
IntroUpdate(t);
|
||||
#endif
|
||||
|
||||
#ifdef VIDEO
|
||||
VideoUpdate();
|
||||
#endif
|
||||
}
|
||||
|
||||
INLINE void FrameworkDispose()
|
||||
{
|
||||
Log("FrameworkDispose");
|
||||
#ifdef AUTHORING
|
||||
AuthoringDispose();
|
||||
#endif
|
||||
|
||||
#ifdef VIDEO
|
||||
VideoDispose();
|
||||
#endif
|
||||
}
|
||||
|
||||
static const float introLength = (float)MAX_SAMPLES / (float)(SAMPLES_PER_TICK * SOUND_TICKS_PER_SCENE);
|
||||
|
||||
INLINE bool FrameworkContinueExecuting()
|
||||
{
|
||||
#ifndef AUTHORING
|
||||
if (FrameworkGetIntroPosition() >= introLength)
|
||||
return false;
|
||||
|
||||
return !GetAsyncKeyState(VK_ESCAPE);
|
||||
#else
|
||||
return SharedMemoryTool->KeepAlive;
|
||||
#endif
|
||||
}
|
||||
19
8kode/src/intro/framework/intro_hlsl.h
Normal file
@@ -0,0 +1,19 @@
|
||||
/* File generated with Shader Minifier 1.1.3
|
||||
* http://www.ctrl-alt-test.fr
|
||||
*/
|
||||
#ifndef INTRO_HLSL_H_
|
||||
# define INTRO_HLSL_H_
|
||||
# define VAR_O2D0 "f"
|
||||
|
||||
char merged_hlsl[] = "#define _ [numthreads(16,16,1)]\n"
|
||||
"RWTexture2D<float4> f:register(u0);"
|
||||
"_ "
|
||||
"void cs_Sample(int3 i:SV_DispatchThreadID)"
|
||||
"{"
|
||||
"float2 u;"
|
||||
"f.GetDimensions(u.x,u.y);"
|
||||
"float2 x=(i.xy+.500000)/u;"
|
||||
"f[i.xy]=float4(x,.500000,1.000000);"
|
||||
"}";
|
||||
|
||||
#endif // INTRO_HLSL_H_
|
||||
65
8kode/src/intro/framework/log.h
Normal file
@@ -0,0 +1,65 @@
|
||||
#pragma once
|
||||
|
||||
#ifdef _DEBUG
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdarg.h>
|
||||
|
||||
void Log(char* _text, ...)
|
||||
{
|
||||
va_list args;
|
||||
va_start(args, _text);
|
||||
vprintf(_text, args);
|
||||
va_end(args);
|
||||
|
||||
printf("\n");
|
||||
}
|
||||
|
||||
void Warn(char* _text)
|
||||
{
|
||||
HANDLE hstdout = GetStdHandle(STD_OUTPUT_HANDLE);
|
||||
|
||||
CONSOLE_SCREEN_BUFFER_INFO csbi;
|
||||
GetConsoleScreenBufferInfo(hstdout, &csbi);
|
||||
|
||||
SetConsoleTextAttribute(hstdout, FOREGROUND_RED | FOREGROUND_GREEN | FOREGROUND_INTENSITY);
|
||||
OutputDebugString("WARNING: ");
|
||||
OutputDebugString(_text);
|
||||
OutputDebugString("\n");
|
||||
Log(_text);
|
||||
|
||||
SetConsoleTextAttribute(hstdout, csbi.wAttributes);
|
||||
}
|
||||
|
||||
void Error(char* _text)
|
||||
{
|
||||
HANDLE hstdout = GetStdHandle(STD_OUTPUT_HANDLE);
|
||||
|
||||
CONSOLE_SCREEN_BUFFER_INFO csbi;
|
||||
GetConsoleScreenBufferInfo(hstdout, &csbi);
|
||||
|
||||
SetConsoleTextAttribute(hstdout, FOREGROUND_RED | FOREGROUND_INTENSITY);
|
||||
OutputDebugString("ERROR: ");
|
||||
OutputDebugString(_text);
|
||||
OutputDebugString("\n");
|
||||
Log(_text);
|
||||
SetConsoleTextAttribute(hstdout, csbi.wAttributes);
|
||||
}
|
||||
|
||||
void CHECK(HRESULT _hResult)
|
||||
{
|
||||
if (_hResult != S_OK)
|
||||
{
|
||||
HLOCAL pBuffer;
|
||||
FormatMessage(FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_IGNORE_INSERTS, NULL, _hResult, MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), (LPSTR)&pBuffer, 512, NULL);
|
||||
Error((char*)pBuffer);
|
||||
DebugBreak();
|
||||
}
|
||||
}
|
||||
|
||||
#else
|
||||
#define Log(text)
|
||||
#define Warn(text)
|
||||
#define Error(text)
|
||||
#define CHECK(hresult) hresult
|
||||
#endif
|
||||
11
8kode/src/intro/framework/merged.hlsl
Normal file
@@ -0,0 +1,11 @@
|
||||
RWTexture2D<float4> o2d0 : register(u0); /*(E:\blu-flame.org\8kode\src\intro\shaders\intro.hlsl|1)*/
|
||||
/*(E:\blu-flame.org\8kode\src\intro\shaders\intro.hlsl|2)*/
|
||||
[numthreads(16,16,1)] /*(E:\blu-flame.org\8kode\src\intro\shaders\intro.hlsl|3)*/
|
||||
/*(E:\blu-flame.org\8kode\src\intro\shaders\intro.hlsl|4)*/
|
||||
void cs_Sample(int3 id: SV_DispatchThreadID) /*(E:\blu-flame.org\8kode\src\intro\shaders\intro.hlsl|5)*/
|
||||
{ /*(E:\blu-flame.org\8kode\src\intro\shaders\intro.hlsl|6)*/
|
||||
float2 s; /*(E:\blu-flame.org\8kode\src\intro\shaders\intro.hlsl|7)*/
|
||||
o2d0.GetDimensions(s.x, s.y); /*(E:\blu-flame.org\8kode\src\intro\shaders\intro.hlsl|8)*/
|
||||
float2 uv = (id.xy + 0.5) / s; /*(E:\blu-flame.org\8kode\src\intro\shaders\intro.hlsl|9)*/
|
||||
o2d0[id.xy] = float4(uv, 0.5, 1.0); /*(E:\blu-flame.org\8kode\src\intro\shaders\intro.hlsl|10)*/
|
||||
} /*(E:\blu-flame.org\8kode\src\intro\shaders\intro.hlsl|11)*/
|
||||
22
8kode/src/intro/framework/mutexlock.h
Normal file
@@ -0,0 +1,22 @@
|
||||
#pragma once
|
||||
|
||||
#ifdef AUTHORING
|
||||
struct MutexLock
|
||||
{
|
||||
public:
|
||||
MutexLock(const char* _mutexName)
|
||||
{
|
||||
m_MutexHandle = CreateMutex(NULL, FALSE, _mutexName);
|
||||
while (WaitForSingleObject(m_MutexHandle, 500) != WAIT_OBJECT_0)
|
||||
::Sleep(1);
|
||||
}
|
||||
|
||||
virtual ~MutexLock()
|
||||
{
|
||||
CloseHandle(m_MutexHandle);
|
||||
}
|
||||
|
||||
private:
|
||||
HANDLE m_MutexHandle;
|
||||
};
|
||||
#endif
|
||||
139
8kode/src/intro/framework/shaders.h
Normal file
@@ -0,0 +1,139 @@
|
||||
#pragma once
|
||||
|
||||
#include <d3dcompiler.h>
|
||||
|
||||
#pragma bss_seg(".shadersbss")
|
||||
static ID3DBlob* shaderBlob;
|
||||
static ID3DBlob* errorBlob;
|
||||
static pD3DCompile d3dCompile;
|
||||
|
||||
#pragma data_seg(".d3dcompiler")
|
||||
static char d3dcompiler[] = "d3dcompiler_47.dll";
|
||||
|
||||
#pragma data_seg(".minifiedShader")
|
||||
#include "intro_hlsl.h"
|
||||
|
||||
#ifdef AUTHORING
|
||||
|
||||
#include <process.h>
|
||||
#include <io.h>
|
||||
#include <stdio.h>
|
||||
|
||||
static char g_sMonitoredShaderPath[MAX_PATH];
|
||||
static __time64_t shaderChangedDate;
|
||||
|
||||
DWORD WINAPI filemon(void* args)
|
||||
{
|
||||
while (true)
|
||||
{
|
||||
_finddata_t fdata;
|
||||
long hfile = _findfirst(g_sMonitoredShaderPath, &fdata);
|
||||
if (hfile != -1)
|
||||
{
|
||||
if (fdata.time_write != shaderChangedDate)
|
||||
{
|
||||
shaderChangedDate = fdata.time_write;
|
||||
::SetEvent(shaderCompileEvent);
|
||||
}
|
||||
_findclose(hfile);
|
||||
}
|
||||
::Sleep(100);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
INLINE void ShadersInit()
|
||||
{
|
||||
HINSTANCE hl = LoadLibrary(d3dcompiler);
|
||||
if (!hl)
|
||||
{
|
||||
d3dcompiler[13] = '3';
|
||||
hl = LoadLibrary(d3dcompiler);
|
||||
}
|
||||
d3dCompile = (pD3DCompile)GetProcAddress(hl, "D3DCompile");
|
||||
|
||||
#ifdef AUTHORING
|
||||
static char exePath[MAX_PATH];
|
||||
GetModuleFileName(NULL, exePath, MAX_PATH);
|
||||
PathRemoveFileSpec(exePath);
|
||||
PathCombine(g_sMonitoredShaderPath, exePath, "..\\src\\intro\\framework\\merged.hlsl");
|
||||
|
||||
_finddata_t fdata;
|
||||
long hfile = _findfirst(g_sMonitoredShaderPath, &fdata);
|
||||
if (hfile != -1)
|
||||
{
|
||||
shaderChangedDate = fdata.time_write;
|
||||
_findclose(hfile);
|
||||
}
|
||||
|
||||
shaderCompileEvent = ::CreateEvent(NULL, FALSE, FALSE, TEXT("WriteEvent"));
|
||||
SetThreadPriority((HANDLE)CreateThread(0, 0, &filemon, 0, 0, 0), THREAD_PRIORITY_BELOW_NORMAL);
|
||||
#endif
|
||||
}
|
||||
|
||||
#ifdef AUTHORING
|
||||
#pragma code_seg(".CompileShaderA")
|
||||
bool CompileShader_Authoring(char* entryPoint, char* profile)
|
||||
{
|
||||
ReadFile((char*)g_sMonitoredShaderPath, (char**)&shaderCode, &shaderSize);
|
||||
d3dCompile(shaderCode, shaderSize, g_sMonitoredShaderPath, NULL, NULL, entryPoint, profile, D3DCOMPILE_DEBUG, 0, &shaderBlob, &errorBlob);
|
||||
if (errorBlob != NULL)
|
||||
{
|
||||
auto error = (char*)errorBlob->GetBufferPointer();
|
||||
if (shaderBlob != NULL)
|
||||
{
|
||||
Warn(error);
|
||||
}
|
||||
else
|
||||
{
|
||||
Error(error);
|
||||
}
|
||||
|
||||
DWORD cbSize = strlen(error);
|
||||
DWORD cbWritten = 0;
|
||||
|
||||
WriteFile(
|
||||
hShaderErrorPipe, // pipe handle
|
||||
&cbSize, // message
|
||||
sizeof(DWORD), // message length
|
||||
&cbWritten, // bytes written
|
||||
NULL); // not overlapped
|
||||
|
||||
WriteFile(
|
||||
hShaderErrorPipe, // pipe handle
|
||||
error, // message
|
||||
cbSize, // message length
|
||||
&cbWritten, // bytes written
|
||||
NULL); // not overlapped
|
||||
|
||||
if (shaderBlob == NULL)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
shaderSize = shaderBlob->GetBufferSize();
|
||||
shaderCode = shaderBlob->GetBufferPointer();
|
||||
return true;
|
||||
};
|
||||
#endif
|
||||
|
||||
#pragma code_seg(".CompileShaderR")
|
||||
void CompileShader_Release(char* entryPoint, char* profile)
|
||||
{
|
||||
#ifdef _DEBUG
|
||||
d3dCompile(merged_hlsl, sizeof(merged_hlsl), NULL, NULL, NULL, entryPoint, profile, 0, 0, &shaderBlob, &errorBlob);
|
||||
if (errorBlob != NULL)
|
||||
{
|
||||
auto error = errorBlob->GetBufferPointer();
|
||||
Error((char*)error);
|
||||
}
|
||||
#else
|
||||
d3dCompile(merged_hlsl, sizeof(merged_hlsl), NULL, NULL, NULL, entryPoint, profile, 0, 0, &shaderBlob, 0);
|
||||
#endif
|
||||
|
||||
shaderSize = shaderBlob->GetBufferSize();
|
||||
shaderCode = shaderBlob->GetBufferPointer();
|
||||
};
|
||||
15
8kode/src/intro/framework/shaders/histogramGather.hlsl
Normal file
@@ -0,0 +1,15 @@
|
||||
Texture2D<float4> in0 : register(u0);
|
||||
RWTexture1D<uint> histogramBucketR : register(u1);
|
||||
RWTexture1D<uint> histogramBucketG : register(u2);
|
||||
RWTexture1D<uint> histogramBucketB : register(u3);
|
||||
RWTexture1D<float4> histogramOut : register(u4);
|
||||
|
||||
[numthreads(16, 16, 1)]
|
||||
void main(uint3 id : SV_DispatchThreadID)
|
||||
{
|
||||
int3 iPixel = in0[id.xy].rgb * 255.0f;
|
||||
|
||||
InterlockedAdd(histogramBucketR[iPixel.r], 1);
|
||||
InterlockedAdd(histogramBucketG[iPixel.g], 1);
|
||||
InterlockedAdd(histogramBucketB[iPixel.b], 1);
|
||||
}
|
||||
13
8kode/src/intro/framework/shaders/histogramMaximum.hlsl
Normal file
@@ -0,0 +1,13 @@
|
||||
Texture2D<float4> in0 : register(u0);
|
||||
RWTexture1D<uint> histogramBucketR : register(u1);
|
||||
RWTexture1D<uint> histogramBucketG : register(u2);
|
||||
RWTexture1D<uint> histogramBucketB : register(u3);
|
||||
RWTexture1D<float4> histogramOut : register(u4);
|
||||
|
||||
[numthreads(16, 1, 1)]
|
||||
void main(uint3 id : SV_DispatchThreadID)
|
||||
{
|
||||
InterlockedMax(histogramBucketR[256], histogramBucketR[id.x]);
|
||||
InterlockedMax(histogramBucketG[256], histogramBucketG[id.x]);
|
||||
InterlockedMax(histogramBucketB[256], histogramBucketB[id.x]);
|
||||
}
|
||||
14
8kode/src/intro/framework/shaders/histogramSpread.hlsl
Normal file
@@ -0,0 +1,14 @@
|
||||
Texture2D<float4> in0 : register(u0);
|
||||
RWTexture1D<uint> histogramBucketR : register(u1);
|
||||
RWTexture1D<uint> histogramBucketG : register(u2);
|
||||
RWTexture1D<uint> histogramBucketB : register(u3);
|
||||
RWTexture1D<float4> histogramOut : register(u4);
|
||||
|
||||
[numthreads(16, 1, 1)]
|
||||
void main(uint3 id : SV_DispatchThreadID)
|
||||
{
|
||||
histogramOut[id.x] = float4(
|
||||
log(1.0 + histogramBucketR[id.x]) / log(1.0 + histogramBucketR[256]),
|
||||
log(1.0 + histogramBucketG[id.x]) / log(1.0 + histogramBucketG[256]),
|
||||
log(1.0 + histogramBucketB[id.x]) / log(1.0 + histogramBucketB[256]), 0.0f);
|
||||
}
|
||||
@@ -0,0 +1,28 @@
|
||||
Texture2D<float4> in0 : register(u0);
|
||||
RWTexture2D<uint> paradeBucketR : register(u1);
|
||||
RWTexture2D<uint> paradeBucketG : register(u2);
|
||||
RWTexture2D<uint> paradeBucketB : register(u3);
|
||||
RWTexture2D<uint> paradeBucketA : register(u4);
|
||||
RWTexture2D<uint> vectorScopeBucket : register(u5);
|
||||
RWTexture2D<uint4> paradeOut : register(u6);
|
||||
RWTexture2D<uint4> vectorScopeOut : register(u7);
|
||||
|
||||
[numthreads(16, 16, 1)]
|
||||
void main(uint3 id : SV_DispatchThreadID)
|
||||
{
|
||||
float3 pixel = in0[id.xy].rgb;
|
||||
int3 iPixel = pixel * 255.0f;
|
||||
float luminance = dot(pixel, float3(0.2126f, 0.7152f, 0.0722f));
|
||||
float2 f = float2(0.492f, 0.877f) * (pixel.br - luminance);
|
||||
int2 uv = min(255, max(0, 128 * (1 + f / float2(0.436f, 0.615f))));
|
||||
|
||||
float2 resolution;
|
||||
in0.GetDimensions(resolution.x, resolution.y);
|
||||
int paradeCoord = (id.x * 255.0f) / resolution.x;
|
||||
|
||||
InterlockedAdd(paradeBucketR[int2(paradeCoord, 255 - iPixel.r)], 1);
|
||||
InterlockedAdd(paradeBucketG[int2(paradeCoord, 255 - iPixel.g)], 1);
|
||||
InterlockedAdd(paradeBucketB[int2(paradeCoord, 255 - iPixel.b)], 1);
|
||||
InterlockedAdd(paradeBucketA[int2(paradeCoord, 255 - (uint)(255.0f * luminance))], 1);
|
||||
InterlockedAdd(vectorScopeBucket[uv], 1);
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
Texture2D<float4> in0 : register(u0);
|
||||
RWTexture2D<uint> paradeBucketR : register(u1);
|
||||
RWTexture2D<uint> paradeBucketG : register(u2);
|
||||
RWTexture2D<uint> paradeBucketB : register(u3);
|
||||
RWTexture2D<uint> paradeBucketA : register(u4);
|
||||
RWTexture2D<uint> vectorScopeBucket : register(u5);
|
||||
RWTexture2D<uint4> paradeOut : register(u6);
|
||||
RWTexture2D<uint4> vectorScopeOut : register(u7);
|
||||
|
||||
[numthreads(16, 16, 1)]
|
||||
void main(uint3 id : SV_DispatchThreadID)
|
||||
{
|
||||
InterlockedMax(paradeBucketR[uint2(256, 0)], paradeBucketR[id.xy]);
|
||||
InterlockedMax(paradeBucketG[uint2(256, 0)], paradeBucketG[id.xy]);
|
||||
InterlockedMax(paradeBucketB[uint2(256, 0)], paradeBucketB[id.xy]);
|
||||
InterlockedMax(paradeBucketA[uint2(256, 0)], paradeBucketA[id.xy]);
|
||||
InterlockedMax(vectorScopeBucket[uint2(256, 0)], vectorScopeBucket[id.xy]);
|
||||
}
|
||||
@@ -0,0 +1,31 @@
|
||||
Texture2D<float4> in0 : register(u0);
|
||||
RWTexture2D<uint> paradeBucketR : register(u1);
|
||||
RWTexture2D<uint> paradeBucketG : register(u2);
|
||||
RWTexture2D<uint> paradeBucketB : register(u3);
|
||||
RWTexture2D<uint> paradeBucketA : register(u4);
|
||||
RWTexture2D<uint> vectorScopeBucket : register(u5);
|
||||
RWTexture2D<uint4> paradeOut : register(u6);
|
||||
RWTexture2D<uint4> vectorScopeOut : register(u7);
|
||||
|
||||
[numthreads(16, 16, 1)]
|
||||
void main( uint3 id : SV_DispatchThreadID )
|
||||
{
|
||||
paradeOut[id.xy] = uint4(
|
||||
255.0f * log(1.0f + paradeBucketR[id.xy]) / log(1.0f + paradeBucketR[uint2(256, 0)]),
|
||||
255.0f * log(1.0f + paradeBucketG[id.xy]) / log(1.0f + paradeBucketG[uint2(256, 0)]),
|
||||
255.0f * log(1.0f + paradeBucketB[id.xy]) / log(1.0f + paradeBucketB[uint2(256, 0)]),
|
||||
255.0f * log(1.0f + paradeBucketA[id.xy]) / log(1.0f + paradeBucketA[uint2(256, 0)]));
|
||||
|
||||
float luminance = 1.0f - max(0.0f, min(1.0f, log(1.0f + vectorScopeBucket[id.xy]) / log(1.0f + vectorScopeBucket[uint2(256, 0)])));
|
||||
float2 f = (id.xy - 128.0f) / 128.0f;
|
||||
if (length(f) > 1)
|
||||
luminance = 0.0f;
|
||||
|
||||
float2 uv = ((id.xy / 128.0f) - 1.0f) * float2(0.436f, 0.615f);
|
||||
|
||||
float3 _a = float3(0, -0.3950f, 2.03252f);
|
||||
float3 _b = float3(1.14025f, -0.581f, 0);
|
||||
uint3 rgb = luminance * 255.0f * min(1, max(0, (0.5f + uv.x * _a + uv.y * _b)));
|
||||
|
||||
vectorScopeOut[id.xy] = uint4(rgb, 255);
|
||||
}
|
||||
34
8kode/src/intro/framework/shaders_shc.h
Normal file
@@ -0,0 +1,34 @@
|
||||
#pragma once
|
||||
// WARNING: This file is autogenerated by shc. Do not edit
|
||||
|
||||
#pragma data_seg(".cs_5_0")
|
||||
static char cs_5_0[] = "cs_5_0";
|
||||
|
||||
#pragma data_seg(".vs_5_0")
|
||||
static char vs_5_0[] = "vs_5_0";
|
||||
|
||||
#pragma data_seg(".gs_5_0")
|
||||
static char gs_5_0[] = "gs_5_0";
|
||||
|
||||
#pragma data_seg(".ds_5_0")
|
||||
static char ds_5_0[] = "ds_5_0";
|
||||
|
||||
#pragma data_seg(".hs_5_0")
|
||||
static char hs_5_0[] = "hs_5_0";
|
||||
|
||||
#pragma data_seg(".ps_5_0")
|
||||
static char ps_5_0[] = "ps_5_0";
|
||||
|
||||
#pragma bss_seg(".shaderbss")
|
||||
static ID3D11ComputeShader* cs_Sample;
|
||||
|
||||
#pragma code_seg(".FrameworkShadersCompile")
|
||||
INLINE void FrameworkShadersCompile()
|
||||
{
|
||||
CompileShader("cs_Sample", cs_5_0);
|
||||
device->CreateComputeShader(shaderCode, shaderSize, NULL, &cs_Sample);
|
||||
}
|
||||
|
||||
|
||||
#define SyncInit()
|
||||
#define SyncUpdate(t)
|
||||
76
8kode/src/intro/framework/sound.h
Normal file
@@ -0,0 +1,76 @@
|
||||
#pragma once
|
||||
|
||||
#define SOUND_TICKS_PER_SCENE 64
|
||||
#define SYNC_ROWS_PER_SCENE 16
|
||||
|
||||
#include <mmsystem.h>
|
||||
#include <mmreg.h>
|
||||
|
||||
#pragma bss_seg(".audio_bss")
|
||||
#ifdef AUTHORING
|
||||
static SAMPLE_TYPE* soundBuffer;
|
||||
#else
|
||||
static SAMPLE_TYPE soundBuffer[MAX_SAMPLES * 2];
|
||||
#endif
|
||||
static HWAVEOUT hWaveOut;
|
||||
|
||||
#pragma data_seg(".wavehdr")
|
||||
#ifndef RELEASE
|
||||
WAVEHDR WaveHDR =
|
||||
{
|
||||
(LPSTR)soundBuffer,
|
||||
MAX_SAMPLES*sizeof(SAMPLE_TYPE)* 2,
|
||||
0, 0, 0, 0, 0, 0
|
||||
};
|
||||
#else
|
||||
WAVEHDR WaveHDR =
|
||||
{
|
||||
(LPSTR)soundBuffer,
|
||||
MAX_SAMPLES*sizeof(SAMPLE_TYPE) * 2,
|
||||
0, 0, WHDR_PREPARED, 0, 0, 0
|
||||
};
|
||||
#endif
|
||||
|
||||
#pragma data_seg(".wavefmt")
|
||||
WAVEFORMATEX WaveFMT =
|
||||
{
|
||||
#ifdef FLOAT_32BIT
|
||||
WAVE_FORMAT_IEEE_FLOAT,
|
||||
#else
|
||||
WAVE_FORMAT_PCM,
|
||||
#endif
|
||||
2, // channels
|
||||
SAMPLE_RATE, // samples per sec
|
||||
SAMPLE_RATE*sizeof(SAMPLE_TYPE)* 2, // bytes per sec
|
||||
sizeof(SAMPLE_TYPE)* 2, // block alignment;
|
||||
sizeof(SAMPLE_TYPE)* 8, // bits per sample
|
||||
0 // extension not needed
|
||||
};
|
||||
|
||||
#pragma data_seg(".mmtime")
|
||||
static MMTIME mmtime =
|
||||
{
|
||||
TIME_SAMPLES
|
||||
};
|
||||
|
||||
INLINE float SoundGetIntroPosition()
|
||||
{
|
||||
waveOutGetPosition(hWaveOut, &mmtime, sizeof(MMTIME));
|
||||
return mmtime.u.sample / (float)(SAMPLES_PER_TICK * SOUND_TICKS_PER_SCENE);
|
||||
}
|
||||
|
||||
#pragma code_seg(".initsnd")
|
||||
INLINE void SoundInit()
|
||||
{
|
||||
CreateThread(0, 0, (LPTHREAD_START_ROUTINE)_4klang_render, soundBuffer, 0, 0);
|
||||
|
||||
#ifndef VIDEO
|
||||
::Sleep(1024);// give the 4klang render call some time
|
||||
|
||||
waveOutOpen(&hWaveOut, -1, &WaveFMT, 0, 0, 0);
|
||||
#ifndef RELEASE
|
||||
waveOutPrepareHeader(hWaveOut, &WaveHDR, 0x20);
|
||||
#endif
|
||||
waveOutWrite(hWaveOut, &WaveHDR, 0x20);
|
||||
#endif
|
||||
}
|
||||
590
8kode/src/intro/framework/sync-data.h
Normal file
@@ -0,0 +1,590 @@
|
||||
#ifndef SYNC_DATA_H
|
||||
#define SYNC_DATA_H
|
||||
|
||||
enum sync_tracks {
|
||||
SYNC_TRACK_cameraPosition_x = 0,
|
||||
SYNC_TRACK_cameraPosition_y = 1,
|
||||
SYNC_TRACK_cameraPosition_z = 2,
|
||||
SYNC_TRACK_cameraPosition_w = 3,
|
||||
SYNC_TRACK_cameraCenter_x = 4,
|
||||
SYNC_TRACK_cameraCenter_y = 5,
|
||||
SYNC_TRACK_cameraCenter_z = 6,
|
||||
SYNC_TRACK_cameraCenter_w = 7,
|
||||
SYNC_TRACK_cameraUp_x = 8,
|
||||
SYNC_TRACK_cameraUp_y = 9,
|
||||
SYNC_TRACK_cameraUp_z = 10,
|
||||
SYNC_TRACK_cameraUp_w = 11,
|
||||
SYNC_TRACK_fade = 12,
|
||||
SYNC_TRACK_cubeLifetime = 13,
|
||||
SYNC_TRACK_transition = 14,
|
||||
SYNC_TRACK_COUNT = 15
|
||||
};
|
||||
|
||||
static const unsigned short sync_data_offset[SYNC_TRACK_COUNT] = {
|
||||
0, /* track: cameraPosition_x */
|
||||
16, /* track: cameraPosition_y */
|
||||
27, /* track: cameraPosition_z */
|
||||
47, /* track: cameraPosition_w */
|
||||
48, /* track: cameraCenter_x */
|
||||
59, /* track: cameraCenter_y */
|
||||
75, /* track: cameraCenter_z */
|
||||
86, /* track: cameraCenter_w */
|
||||
87, /* track: cameraUp_x */
|
||||
97, /* track: cameraUp_y */
|
||||
98, /* track: cameraUp_z */
|
||||
99, /* track: cameraUp_w */
|
||||
100, /* track: fade */
|
||||
128, /* track: cubeLifetime */
|
||||
140, /* track: transition */
|
||||
};
|
||||
|
||||
static const unsigned char sync_data_count[SYNC_TRACK_COUNT] = {
|
||||
16, /* track: cameraPosition_x */
|
||||
11, /* track: cameraPosition_y */
|
||||
20, /* track: cameraPosition_z */
|
||||
1, /* track: cameraPosition_w */
|
||||
11, /* track: cameraCenter_x */
|
||||
16, /* track: cameraCenter_y */
|
||||
11, /* track: cameraCenter_z */
|
||||
1, /* track: cameraCenter_w */
|
||||
10, /* track: cameraUp_x */
|
||||
1, /* track: cameraUp_y */
|
||||
1, /* track: cameraUp_z */
|
||||
1, /* track: cameraUp_w */
|
||||
28, /* track: fade */
|
||||
12, /* track: cubeLifetime */
|
||||
19, /* track: transition */
|
||||
};
|
||||
|
||||
static const unsigned short sync_data_rows[] = {
|
||||
/* track: cameraPosition_x */
|
||||
0,
|
||||
128,
|
||||
160,
|
||||
192,
|
||||
223,
|
||||
224,
|
||||
240,
|
||||
256,
|
||||
272,
|
||||
288,
|
||||
352,
|
||||
383,
|
||||
384,
|
||||
416,
|
||||
448,
|
||||
464,
|
||||
/* track: cameraPosition_y */
|
||||
0,
|
||||
128,
|
||||
160,
|
||||
192,
|
||||
223,
|
||||
224,
|
||||
288,
|
||||
384,
|
||||
415,
|
||||
416,
|
||||
448,
|
||||
/* track: cameraPosition_z */
|
||||
0,
|
||||
95,
|
||||
96,
|
||||
128,
|
||||
160,
|
||||
192,
|
||||
223,
|
||||
224,
|
||||
248,
|
||||
287,
|
||||
288,
|
||||
352,
|
||||
368,
|
||||
383,
|
||||
384,
|
||||
416,
|
||||
447,
|
||||
448,
|
||||
456,
|
||||
480,
|
||||
/* track: cameraPosition_w */
|
||||
0,
|
||||
/* track: cameraCenter_x */
|
||||
0,
|
||||
96,
|
||||
128,
|
||||
160,
|
||||
224,
|
||||
288,
|
||||
368,
|
||||
384,
|
||||
416,
|
||||
448,
|
||||
464,
|
||||
/* track: cameraCenter_y */
|
||||
0,
|
||||
96,
|
||||
128,
|
||||
160,
|
||||
192,
|
||||
224,
|
||||
287,
|
||||
288,
|
||||
352,
|
||||
360,
|
||||
384,
|
||||
416,
|
||||
447,
|
||||
448,
|
||||
464,
|
||||
512,
|
||||
/* track: cameraCenter_z */
|
||||
0,
|
||||
95,
|
||||
96,
|
||||
128,
|
||||
160,
|
||||
224,
|
||||
288,
|
||||
416,
|
||||
447,
|
||||
448,
|
||||
480,
|
||||
/* track: cameraCenter_w */
|
||||
0,
|
||||
/* track: cameraUp_x */
|
||||
0,
|
||||
160,
|
||||
192,
|
||||
223,
|
||||
224,
|
||||
352,
|
||||
384,
|
||||
448,
|
||||
456,
|
||||
472,
|
||||
/* track: cameraUp_y */
|
||||
0,
|
||||
/* track: cameraUp_z */
|
||||
0,
|
||||
/* track: cameraUp_w */
|
||||
0,
|
||||
/* track: fade */
|
||||
0,
|
||||
16,
|
||||
94,
|
||||
95,
|
||||
96,
|
||||
97,
|
||||
126,
|
||||
127,
|
||||
128,
|
||||
129,
|
||||
158,
|
||||
159,
|
||||
160,
|
||||
161,
|
||||
284,
|
||||
288,
|
||||
296,
|
||||
382,
|
||||
384,
|
||||
386,
|
||||
414,
|
||||
416,
|
||||
418,
|
||||
446,
|
||||
448,
|
||||
450,
|
||||
512,
|
||||
519,
|
||||
/* track: cubeLifetime */
|
||||
0,
|
||||
288,
|
||||
344,
|
||||
351,
|
||||
352,
|
||||
384,
|
||||
392,
|
||||
396,
|
||||
400,
|
||||
416,
|
||||
448,
|
||||
488,
|
||||
/* track: transition */
|
||||
0,
|
||||
96,
|
||||
216,
|
||||
224,
|
||||
228,
|
||||
256,
|
||||
288,
|
||||
352,
|
||||
380,
|
||||
384,
|
||||
388,
|
||||
412,
|
||||
416,
|
||||
420,
|
||||
444,
|
||||
448,
|
||||
452,
|
||||
480,
|
||||
512,
|
||||
};
|
||||
|
||||
static const float sync_data_values[] = {
|
||||
/* track: cameraPosition_x */
|
||||
0.000000f,
|
||||
-40.000000f,
|
||||
-5.000000f,
|
||||
0.000000f,
|
||||
-5.000000f,
|
||||
-5.500000f,
|
||||
-3.500000f,
|
||||
-5.500000f,
|
||||
-7.500000f,
|
||||
14.000000f,
|
||||
14.000000f,
|
||||
-40.000000f,
|
||||
-8.000000f,
|
||||
-5.000000f,
|
||||
20.000000f,
|
||||
35.000000f,
|
||||
/* track: cameraPosition_y */
|
||||
3.000000f,
|
||||
4.000000f,
|
||||
10.000000f,
|
||||
3.500000f,
|
||||
5.000000f,
|
||||
2.500000f,
|
||||
2.000000f,
|
||||
15.000000f,
|
||||
30.000000f,
|
||||
55.000000f,
|
||||
5.000000f,
|
||||
/* track: cameraPosition_z */
|
||||
0.000000f,
|
||||
50.000000f,
|
||||
75.000000f,
|
||||
100.000000f,
|
||||
125.000000f,
|
||||
140.000000f,
|
||||
175.000000f,
|
||||
203.000000f,
|
||||
208.500000f,
|
||||
225.000000f,
|
||||
65.000000f,
|
||||
65.000000f,
|
||||
40.000000f,
|
||||
50.000000f,
|
||||
81.000000f,
|
||||
135.000000f,
|
||||
30.000000f,
|
||||
25.000000f,
|
||||
25.000000f,
|
||||
30.000000f,
|
||||
/* track: cameraPosition_w */
|
||||
1.000000f,
|
||||
/* track: cameraCenter_x */
|
||||
10.000000f,
|
||||
-20.000000f,
|
||||
40.000000f,
|
||||
0.000000f,
|
||||
-6.000000f,
|
||||
50.000000f,
|
||||
50.000000f,
|
||||
0.000000f,
|
||||
0.000000f,
|
||||
15.000000f,
|
||||
45.000000f,
|
||||
/* track: cameraCenter_y */
|
||||
-10.000000f,
|
||||
-20.000000f,
|
||||
-40.000000f,
|
||||
-100.000000f,
|
||||
-50.000000f,
|
||||
1.000000f,
|
||||
-5.000000f,
|
||||
2.000000f,
|
||||
2.000000f,
|
||||
-5.000000f,
|
||||
20.000000f,
|
||||
20.000000f,
|
||||
5.000000f,
|
||||
10.000000f,
|
||||
5.000000f,
|
||||
-5.000000f,
|
||||
/* track: cameraCenter_z */
|
||||
25.000000f,
|
||||
75.000000f,
|
||||
100.000000f,
|
||||
125.000000f,
|
||||
250.000000f,
|
||||
205.500000f,
|
||||
100.000000f,
|
||||
100.000000f,
|
||||
30.000000f,
|
||||
25.000000f,
|
||||
45.000000f,
|
||||
/* track: cameraCenter_w */
|
||||
1.000000f,
|
||||
/* track: cameraUp_x */
|
||||
0.000000f,
|
||||
0.050000f,
|
||||
0.000000f,
|
||||
-0.100000f,
|
||||
0.000000f,
|
||||
0.000000f,
|
||||
0.100000f,
|
||||
0.000000f,
|
||||
-0.200000f,
|
||||
0.000000f,
|
||||
/* track: cameraUp_y */
|
||||
1.000000f,
|
||||
/* track: cameraUp_z */
|
||||
0.000000f,
|
||||
/* track: cameraUp_w */
|
||||
1.000000f,
|
||||
/* track: fade */
|
||||
0.000000f,
|
||||
0.500000f,
|
||||
0.500000f,
|
||||
0.000000f,
|
||||
0.000000f,
|
||||
0.500000f,
|
||||
0.500000f,
|
||||
0.000000f,
|
||||
0.000000f,
|
||||
0.500000f,
|
||||
0.500000f,
|
||||
0.000000f,
|
||||
0.000000f,
|
||||
0.500000f,
|
||||
0.500000f,
|
||||
0.900000f,
|
||||
0.500000f,
|
||||
0.500000f,
|
||||
0.600000f,
|
||||
0.500000f,
|
||||
0.500000f,
|
||||
0.600000f,
|
||||
0.500000f,
|
||||
0.500000f,
|
||||
0.600000f,
|
||||
0.500000f,
|
||||
0.500000f,
|
||||
0.000000f,
|
||||
/* track: cubeLifetime */
|
||||
0.000000f,
|
||||
17.000000f,
|
||||
17.000000f,
|
||||
1.000000f,
|
||||
1.000000f,
|
||||
17.000000f,
|
||||
17.000000f,
|
||||
1.000000f,
|
||||
1.000000f,
|
||||
50.000000f,
|
||||
50.000000f,
|
||||
4.000000f,
|
||||
/* track: transition */
|
||||
1.000000f,
|
||||
0.000000f,
|
||||
0.000000f,
|
||||
1.000000f,
|
||||
0.000000f,
|
||||
0.000000f,
|
||||
1.000000f,
|
||||
0.000000f,
|
||||
0.000000f,
|
||||
1.000000f,
|
||||
0.000000f,
|
||||
0.000000f,
|
||||
1.000000f,
|
||||
0.000000f,
|
||||
0.000000f,
|
||||
1.000000f,
|
||||
0.000000f,
|
||||
0.000000f,
|
||||
1.000000f,
|
||||
};
|
||||
|
||||
static const unsigned char sync_data_type[] = {
|
||||
/* track: cameraPosition_x */
|
||||
0,
|
||||
0,
|
||||
2,
|
||||
2,
|
||||
0,
|
||||
2,
|
||||
2,
|
||||
2,
|
||||
0,
|
||||
0,
|
||||
2,
|
||||
0,
|
||||
1,
|
||||
3,
|
||||
2,
|
||||
0,
|
||||
/* track: cameraPosition_y */
|
||||
0,
|
||||
0,
|
||||
2,
|
||||
2,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
1,
|
||||
0,
|
||||
2,
|
||||
0,
|
||||
/* track: cameraPosition_z */
|
||||
1,
|
||||
0,
|
||||
1,
|
||||
1,
|
||||
3,
|
||||
1,
|
||||
0,
|
||||
2,
|
||||
3,
|
||||
0,
|
||||
0,
|
||||
2,
|
||||
3,
|
||||
0,
|
||||
1,
|
||||
1,
|
||||
0,
|
||||
0,
|
||||
2,
|
||||
0,
|
||||
/* track: cameraPosition_w */
|
||||
0,
|
||||
/* track: cameraCenter_x */
|
||||
0,
|
||||
1,
|
||||
1,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
3,
|
||||
0,
|
||||
3,
|
||||
2,
|
||||
0,
|
||||
/* track: cameraCenter_y */
|
||||
0,
|
||||
0,
|
||||
1,
|
||||
2,
|
||||
0,
|
||||
3,
|
||||
0,
|
||||
0,
|
||||
2,
|
||||
2,
|
||||
1,
|
||||
2,
|
||||
0,
|
||||
3,
|
||||
2,
|
||||
0,
|
||||
/* track: cameraCenter_z */
|
||||
1,
|
||||
0,
|
||||
1,
|
||||
1,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
1,
|
||||
0,
|
||||
2,
|
||||
0,
|
||||
/* track: cameraCenter_w */
|
||||
0,
|
||||
/* track: cameraUp_x */
|
||||
0,
|
||||
2,
|
||||
2,
|
||||
0,
|
||||
0,
|
||||
3,
|
||||
0,
|
||||
2,
|
||||
2,
|
||||
0,
|
||||
/* track: cameraUp_y */
|
||||
0,
|
||||
/* track: cameraUp_z */
|
||||
0,
|
||||
/* track: cameraUp_w */
|
||||
0,
|
||||
/* track: fade */
|
||||
2,
|
||||
0,
|
||||
1,
|
||||
1,
|
||||
1,
|
||||
0,
|
||||
1,
|
||||
1,
|
||||
1,
|
||||
0,
|
||||
1,
|
||||
1,
|
||||
1,
|
||||
0,
|
||||
1,
|
||||
1,
|
||||
0,
|
||||
1,
|
||||
1,
|
||||
0,
|
||||
1,
|
||||
1,
|
||||
0,
|
||||
1,
|
||||
1,
|
||||
0,
|
||||
3,
|
||||
0,
|
||||
/* track: cubeLifetime */
|
||||
0,
|
||||
0,
|
||||
3,
|
||||
0,
|
||||
1,
|
||||
0,
|
||||
1,
|
||||
0,
|
||||
1,
|
||||
0,
|
||||
1,
|
||||
0,
|
||||
/* track: transition */
|
||||
2,
|
||||
0,
|
||||
3,
|
||||
2,
|
||||
0,
|
||||
3,
|
||||
3,
|
||||
0,
|
||||
3,
|
||||
2,
|
||||
0,
|
||||
3,
|
||||
2,
|
||||
0,
|
||||
3,
|
||||
2,
|
||||
0,
|
||||
3,
|
||||
0,
|
||||
};
|
||||
|
||||
#endif /* !defined(SYNC_DATA_H) */
|
||||
123
8kode/src/intro/framework/sync/base.h
Normal file
@@ -0,0 +1,123 @@
|
||||
/* Copyright (C) 2007-2010 Erik Faye-Lund and Egbert Teeselink
|
||||
* For conditions of distribution and use, see copyright notice in COPYING
|
||||
*/
|
||||
|
||||
#ifndef SYNC_BASE_H
|
||||
#define SYNC_BASE_H
|
||||
|
||||
/* configure inline keyword */
|
||||
#if (!defined(__STDC_VERSION__) || (__STDC_VERSION__ < 199901L)) && !defined(__cplusplus)
|
||||
#if defined(_MSC_VER) || defined(__GNUC__) || defined(__SASC)
|
||||
#define inline __inline
|
||||
#else
|
||||
/* compiler does not support inline, make function static instead */
|
||||
#define inline static
|
||||
#endif
|
||||
#endif
|
||||
|
||||
/* configure lacking CRT features */
|
||||
#ifdef _MSC_VER
|
||||
#define strdup _strdup
|
||||
#define snprintf _snprintf
|
||||
/* int is 32-bit for both x86 and x64 */
|
||||
typedef unsigned int uint32_t;
|
||||
#define UINT32_MAX UINT_MAX
|
||||
#elif defined(__GNUC__)
|
||||
#include <stdint.h>
|
||||
#elif defined(M68000)
|
||||
typedef unsigned int uint32_t;
|
||||
#endif
|
||||
|
||||
/* configure socket-stack */
|
||||
#ifdef _WIN32
|
||||
#define WIN32_LEAN_AND_MEAN
|
||||
#define NOMINMAX
|
||||
#include <winsock2.h>
|
||||
#include <windows.h>
|
||||
#include <limits.h>
|
||||
#include <Shlwapi.h>
|
||||
#elif defined(USE_AMITCP)
|
||||
#include <sys/socket.h>
|
||||
#include <proto/exec.h>
|
||||
#include <proto/socket.h>
|
||||
#include <netdb.h>
|
||||
#define SOCKET int
|
||||
#define INVALID_SOCKET -1
|
||||
#define select(n,r,w,e,t) WaitSelect(n,r,w,e,t,0)
|
||||
#define closesocket(x) CloseSocket(x)
|
||||
#else
|
||||
#include <sys/socket.h>
|
||||
#include <sys/time.h>
|
||||
#include <netinet/in.h>
|
||||
#include <netdb.h>
|
||||
#include <unistd.h>
|
||||
#define SOCKET int
|
||||
#define INVALID_SOCKET -1
|
||||
#define closesocket(x) close(x)
|
||||
#endif
|
||||
|
||||
#define CLIENT_GREET "hello, synctracker!"
|
||||
#define SERVER_GREET "hello, demo!"
|
||||
|
||||
enum {
|
||||
SET_KEY = 0,
|
||||
DELETE_KEY = 1,
|
||||
GET_TRACK = 2,
|
||||
SET_ROW = 3,
|
||||
PAUSE = 4,
|
||||
SAVE_TRACKS = 5
|
||||
};
|
||||
|
||||
static inline int socket_poll(SOCKET socket)
|
||||
{
|
||||
struct timeval to = { 0, 0 };
|
||||
fd_set fds;
|
||||
|
||||
FD_ZERO(&fds);
|
||||
|
||||
#ifdef _MSC_VER
|
||||
#pragma warning(push)
|
||||
#pragma warning(disable: 4127)
|
||||
#endif
|
||||
FD_SET(socket, &fds);
|
||||
#ifdef _MSC_VER
|
||||
#pragma warning(pop)
|
||||
#endif
|
||||
|
||||
return select((int)socket + 1, &fds, NULL, NULL, &to) > 0;
|
||||
}
|
||||
|
||||
#include <assert.h>
|
||||
|
||||
static inline int xsend(SOCKET s, const void *buf, size_t len, int flags)
|
||||
{
|
||||
#ifdef WIN32
|
||||
assert(len <= INT_MAX);
|
||||
return send(s, (const char *)buf, (int)len, flags) != (int)len;
|
||||
#else
|
||||
return send(s, (const char *)buf, len, flags) != len;
|
||||
#endif
|
||||
}
|
||||
|
||||
static inline int xrecv(SOCKET s, void *buf, size_t len, int flags)
|
||||
{
|
||||
#ifdef WIN32
|
||||
assert(len <= INT_MAX);
|
||||
return recv(s, (char *)buf, (int)len, flags) != (int)len;
|
||||
#else
|
||||
return recv(s, (char *)buf, len, flags) != len;
|
||||
#endif
|
||||
}
|
||||
|
||||
#ifdef NEED_STRDUP
|
||||
static inline char *rocket_strdup(const char *str)
|
||||
{
|
||||
char *ret = malloc(strlen(str) + 1);
|
||||
if (ret)
|
||||
strcpy(ret, str);
|
||||
return ret;
|
||||
}
|
||||
#define strdup rocket_strdup
|
||||
#endif
|
||||
|
||||
#endif /* SYNC_BASE_H */
|
||||
33
8kode/src/intro/framework/sync/data.cpp
Normal file
@@ -0,0 +1,33 @@
|
||||
/* Copyright (C) 2007-2008 Erik Faye-Lund and Egbert Teeselink
|
||||
* For conditions of distribution and use, see copyright notice in COPYING
|
||||
*/
|
||||
|
||||
#include "data.h"
|
||||
|
||||
void sync_data_deinit(struct sync_data *d)
|
||||
{
|
||||
int i;
|
||||
for (i = 0; i < (int)d->num_tracks; ++i) {
|
||||
free(d->tracks[i]->name);
|
||||
free(d->tracks[i]->keys);
|
||||
free(d->tracks[i]);
|
||||
}
|
||||
free(d->tracks);
|
||||
}
|
||||
|
||||
int sync_create_track(struct sync_data *d, const char *name)
|
||||
{
|
||||
struct sync_track *t;
|
||||
assert(sync_find_track(d, name) < 0);
|
||||
|
||||
t = (sync_track*)malloc(sizeof(*t));
|
||||
t->name = strdup(name);
|
||||
t->keys = NULL;
|
||||
t->num_keys = 0;
|
||||
|
||||
d->num_tracks++;
|
||||
d->tracks = (sync_track**)realloc(d->tracks, sizeof(d->tracks[0]) * d->num_tracks);
|
||||
d->tracks[d->num_tracks - 1] = t;
|
||||
|
||||
return (int)d->num_tracks - 1;
|
||||
}
|
||||
28
8kode/src/intro/framework/sync/data.h
Normal file
@@ -0,0 +1,28 @@
|
||||
/* Copyright (C) 2007-2010 Erik Faye-Lund and Egbert Teeselink
|
||||
* For conditions of distribution and use, see copyright notice in COPYING
|
||||
*/
|
||||
|
||||
#ifndef SYNC_DATA_H
|
||||
#define SYNC_DATA_H
|
||||
|
||||
#include "track.h"
|
||||
|
||||
struct sync_data {
|
||||
struct sync_track **tracks;
|
||||
size_t num_tracks;
|
||||
};
|
||||
|
||||
static inline int sync_find_track(const struct sync_data *data,
|
||||
const char *name)
|
||||
{
|
||||
int i;
|
||||
for (i = 0; i < (int)data->num_tracks; ++i)
|
||||
if (!strcmp(name, data->tracks[i]->name))
|
||||
return i;
|
||||
return -1; /* not found */
|
||||
}
|
||||
|
||||
void sync_data_deinit(struct sync_data *);
|
||||
int sync_create_track(struct sync_data *, const char *);
|
||||
|
||||
#endif /* SYNC_DATA_H */
|
||||
359
8kode/src/intro/framework/sync/device.cpp
Normal file
@@ -0,0 +1,359 @@
|
||||
/* Copyright (C) 2007-2008 Erik Faye-Lund and Egbert Teeselink
|
||||
* For conditions of distribution and use, see copyright notice in COPYING
|
||||
*/
|
||||
|
||||
#include "device.h"
|
||||
#include "sync.h"
|
||||
#include <stdio.h>
|
||||
#include <math.h>
|
||||
|
||||
static const char *sync_track_path(const char *base, const char *name)
|
||||
{
|
||||
static char temp[FILENAME_MAX];
|
||||
strncpy(temp, base, sizeof(temp) - 1);
|
||||
temp[sizeof(temp) - 1] = '\0';
|
||||
strncat(temp, "_", sizeof(temp) - 1);
|
||||
strncat(temp, name, sizeof(temp) - 1);
|
||||
strncat(temp, ".track", sizeof(temp) - 1);
|
||||
return temp;
|
||||
}
|
||||
|
||||
#ifndef SYNC_PLAYER
|
||||
|
||||
#ifdef USE_AMITCP
|
||||
static struct Library *socket_base = NULL;
|
||||
#endif
|
||||
|
||||
static SOCKET server_connect(const char *host, unsigned short nport)
|
||||
{
|
||||
struct hostent *he;
|
||||
struct sockaddr_in sa;
|
||||
char greet[128], **ap;
|
||||
SOCKET sock = INVALID_SOCKET;
|
||||
|
||||
#ifdef WIN32
|
||||
static int need_init = 1;
|
||||
if (need_init) {
|
||||
WSADATA wsa;
|
||||
if (WSAStartup(MAKEWORD(2, 0), &wsa))
|
||||
return INVALID_SOCKET;
|
||||
need_init = 0;
|
||||
}
|
||||
#elif defined(USE_AMITCP)
|
||||
if (!socket_base) {
|
||||
socket_base = OpenLibrary("bsdsocket.library", 4);
|
||||
if (!socket_base)
|
||||
return INVALID_SOCKET;
|
||||
}
|
||||
#endif
|
||||
|
||||
he = gethostbyname(host);
|
||||
if (!he)
|
||||
return INVALID_SOCKET;
|
||||
|
||||
for (ap = he->h_addr_list; *ap; ++ap) {
|
||||
sa.sin_family = he->h_addrtype;
|
||||
sa.sin_port = htons(nport);
|
||||
memcpy(&sa.sin_addr, *ap, he->h_length);
|
||||
|
||||
sock = socket(he->h_addrtype, SOCK_STREAM, 0);
|
||||
if (sock == INVALID_SOCKET)
|
||||
continue;
|
||||
|
||||
if (connect(sock, (struct sockaddr *)&sa, sizeof(sa)) >= 0)
|
||||
break;
|
||||
|
||||
closesocket(sock);
|
||||
sock = INVALID_SOCKET;
|
||||
}
|
||||
|
||||
if (sock == INVALID_SOCKET)
|
||||
return INVALID_SOCKET;
|
||||
|
||||
if (xsend(sock, CLIENT_GREET, strlen(CLIENT_GREET), 0) ||
|
||||
xrecv(sock, greet, strlen(SERVER_GREET), 0))
|
||||
return INVALID_SOCKET;
|
||||
|
||||
if (!strncmp(SERVER_GREET, greet, strlen(SERVER_GREET)))
|
||||
return sock;
|
||||
|
||||
closesocket(sock);
|
||||
return INVALID_SOCKET;
|
||||
}
|
||||
|
||||
#else
|
||||
|
||||
void sync_set_io_cb(struct sync_device *d, struct sync_io_cb *cb)
|
||||
{
|
||||
d->io_cb.open = cb->open;
|
||||
d->io_cb.read = cb->read;
|
||||
d->io_cb.close = cb->close;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
struct sync_device *sync_create_device(const char *base)
|
||||
{
|
||||
struct sync_device *d = (sync_device*)malloc(sizeof(*d));
|
||||
if (!d)
|
||||
return NULL;
|
||||
|
||||
d->base = strdup(base);
|
||||
if (!d->base) {
|
||||
free(d);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
d->data.tracks = NULL;
|
||||
d->data.num_tracks = 0;
|
||||
|
||||
#ifndef SYNC_PLAYER
|
||||
d->row = -1;
|
||||
d->sock = INVALID_SOCKET;
|
||||
#else
|
||||
d->io_cb.open = (LPFNCBOPEN)fopen;
|
||||
d->io_cb.read = (LPFNCBREAD)fread;
|
||||
d->io_cb.close = (LPFNCBCLOSE)fclose;
|
||||
#endif
|
||||
|
||||
return d;
|
||||
}
|
||||
|
||||
void sync_destroy_device(struct sync_device *d)
|
||||
{
|
||||
free(d->base);
|
||||
sync_data_deinit(&d->data);
|
||||
free(d);
|
||||
|
||||
#if defined(USE_AMITCP) && !defined(SYNC_PLAYER)
|
||||
if (socket_base) {
|
||||
CloseLibrary(socket_base);
|
||||
socket_base = NULL;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
#ifdef SYNC_PLAYER
|
||||
|
||||
static int get_track_data(struct sync_device *d, struct sync_track *t)
|
||||
{
|
||||
int i;
|
||||
void *fp = d->io_cb.open(sync_track_path(d->base, t->name), "rb");
|
||||
if (!fp)
|
||||
return -1;
|
||||
|
||||
d->io_cb.read(&t->num_keys, sizeof(size_t), 1, fp);
|
||||
t->keys = (track_key*)malloc(sizeof(struct track_key) * t->num_keys);
|
||||
if (!t->keys)
|
||||
return -1;
|
||||
|
||||
for (i = 0; i < (int)t->num_keys; ++i) {
|
||||
struct track_key *key = t->keys + i;
|
||||
char type;
|
||||
d->io_cb.read(&key->row, sizeof(int), 1, fp);
|
||||
d->io_cb.read(&key->value, sizeof(float), 1, fp);
|
||||
d->io_cb.read(&type, sizeof(char), 1, fp);
|
||||
key->type = (enum key_type)type;
|
||||
}
|
||||
|
||||
d->io_cb.close(fp);
|
||||
return 0;
|
||||
}
|
||||
|
||||
#else
|
||||
|
||||
static int save_track(const struct sync_track *t, const char *path)
|
||||
{
|
||||
int i;
|
||||
FILE *fp = fopen(path, "wb");
|
||||
if (!fp)
|
||||
return -1;
|
||||
|
||||
fwrite(&t->num_keys, sizeof(size_t), 1, fp);
|
||||
for (i = 0; i < (int)t->num_keys; ++i) {
|
||||
char type = (char)t->keys[i].type;
|
||||
fwrite(&t->keys[i].row, sizeof(int), 1, fp);
|
||||
fwrite(&t->keys[i].value, sizeof(float), 1, fp);
|
||||
fwrite(&type, sizeof(char), 1, fp);
|
||||
}
|
||||
|
||||
fclose(fp);
|
||||
return 0;
|
||||
}
|
||||
|
||||
void sync_save_tracks(const struct sync_device *d)
|
||||
{
|
||||
int i;
|
||||
for (i = 0; i < (int)d->data.num_tracks; ++i) {
|
||||
const struct sync_track *t = d->data.tracks[i];
|
||||
save_track(t, sync_track_path(d->base, t->name));
|
||||
}
|
||||
}
|
||||
|
||||
static int get_track_data(struct sync_device *d, struct sync_track *t)
|
||||
{
|
||||
unsigned char cmd = GET_TRACK;
|
||||
uint32_t name_len;
|
||||
|
||||
assert(strlen(t->name) <= UINT32_MAX);
|
||||
name_len = htonl((uint32_t)strlen(t->name));
|
||||
|
||||
/* send request data */
|
||||
if (xsend(d->sock, (char *)&cmd, 1, 0) ||
|
||||
xsend(d->sock, (char *)&name_len, sizeof(name_len), 0) ||
|
||||
xsend(d->sock, t->name, (int)strlen(t->name), 0))
|
||||
{
|
||||
closesocket(d->sock);
|
||||
d->sock = INVALID_SOCKET;
|
||||
return -1;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int handle_set_key_cmd(SOCKET sock, struct sync_data *data)
|
||||
{
|
||||
uint32_t track, row;
|
||||
union {
|
||||
float f;
|
||||
uint32_t i;
|
||||
} v;
|
||||
struct track_key key;
|
||||
unsigned char type;
|
||||
|
||||
if (xrecv(sock, (char *)&track, sizeof(track), 0) ||
|
||||
xrecv(sock, (char *)&row, sizeof(row), 0) ||
|
||||
xrecv(sock, (char *)&v.i, sizeof(v.i), 0) ||
|
||||
xrecv(sock, (char *)&type, 1, 0))
|
||||
return -1;
|
||||
|
||||
track = ntohl(track);
|
||||
v.i = ntohl(v.i);
|
||||
|
||||
key.row = ntohl(row);
|
||||
key.value = v.f;
|
||||
|
||||
assert(type < KEY_TYPE_COUNT);
|
||||
assert(track < data->num_tracks);
|
||||
key.type = (enum key_type)type;
|
||||
return sync_set_key(data->tracks[track], &key);
|
||||
}
|
||||
|
||||
static int handle_del_key_cmd(SOCKET sock, struct sync_data *data)
|
||||
{
|
||||
uint32_t track, row;
|
||||
|
||||
if (xrecv(sock, (char *)&track, sizeof(track), 0) ||
|
||||
xrecv(sock, (char *)&row, sizeof(row), 0))
|
||||
return -1;
|
||||
|
||||
track = ntohl(track);
|
||||
row = ntohl(row);
|
||||
|
||||
assert(track < data->num_tracks);
|
||||
return sync_del_key(data->tracks[track], row);
|
||||
}
|
||||
|
||||
int sync_connect(struct sync_device *d, const char *host, unsigned short port)
|
||||
{
|
||||
int i;
|
||||
if (d->sock != INVALID_SOCKET)
|
||||
closesocket(d->sock);
|
||||
|
||||
d->sock = server_connect(host, port);
|
||||
if (d->sock == INVALID_SOCKET)
|
||||
return -1;
|
||||
|
||||
for (i = 0; i < (int)d->data.num_tracks; ++i) {
|
||||
free(d->data.tracks[i]->keys);
|
||||
d->data.tracks[i]->keys = NULL;
|
||||
d->data.tracks[i]->num_keys = 0;
|
||||
}
|
||||
|
||||
for (i = 0; i < (int)d->data.num_tracks; ++i) {
|
||||
if (get_track_data(d, d->data.tracks[i])) {
|
||||
closesocket(d->sock);
|
||||
d->sock = INVALID_SOCKET;
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
int sync_update(struct sync_device *d, int row, struct sync_cb *cb,
|
||||
void *cb_param)
|
||||
{
|
||||
if (d->sock == INVALID_SOCKET)
|
||||
return -1;
|
||||
|
||||
/* look for new commands */
|
||||
while (socket_poll(d->sock)) {
|
||||
unsigned char cmd = 0, flag;
|
||||
uint32_t row;
|
||||
if (xrecv(d->sock, (char *)&cmd, 1, 0))
|
||||
goto sockerr;
|
||||
|
||||
switch (cmd) {
|
||||
case SET_KEY:
|
||||
if (handle_set_key_cmd(d->sock, &d->data))
|
||||
goto sockerr;
|
||||
break;
|
||||
case DELETE_KEY:
|
||||
if (handle_del_key_cmd(d->sock, &d->data))
|
||||
goto sockerr;
|
||||
break;
|
||||
case SET_ROW:
|
||||
if (xrecv(d->sock, (char *)&row, sizeof(row), 0))
|
||||
goto sockerr;
|
||||
if (cb && cb->set_row)
|
||||
cb->set_row(cb_param, ntohl(row));
|
||||
break;
|
||||
case PAUSE:
|
||||
if (xrecv(d->sock, (char *)&flag, 1, 0))
|
||||
goto sockerr;
|
||||
if (cb && cb->pause)
|
||||
cb->pause(cb_param, flag);
|
||||
break;
|
||||
case SAVE_TRACKS:
|
||||
sync_save_tracks(d);
|
||||
break;
|
||||
default:
|
||||
fprintf(stderr, "unknown cmd: %02x\n", cmd);
|
||||
goto sockerr;
|
||||
}
|
||||
}
|
||||
|
||||
if (cb && cb->is_playing && cb->is_playing(cb_param)) {
|
||||
if (d->row != row && d->sock != INVALID_SOCKET) {
|
||||
unsigned char cmd = SET_ROW;
|
||||
uint32_t nrow = htonl(row);
|
||||
if (xsend(d->sock, (char*)&cmd, 1, 0) ||
|
||||
xsend(d->sock, (char*)&nrow, sizeof(nrow), 0))
|
||||
goto sockerr;
|
||||
d->row = row;
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
|
||||
sockerr:
|
||||
closesocket(d->sock);
|
||||
d->sock = INVALID_SOCKET;
|
||||
return -1;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
const struct sync_track *sync_get_track(struct sync_device *d,
|
||||
const char *name)
|
||||
{
|
||||
struct sync_track *t;
|
||||
int idx = sync_find_track(&d->data, name);
|
||||
if (idx >= 0)
|
||||
return d->data.tracks[idx];
|
||||
|
||||
idx = sync_create_track(&d->data, name);
|
||||
t = d->data.tracks[idx];
|
||||
|
||||
get_track_data(d, t);
|
||||
return t;
|
||||
}
|
||||
23
8kode/src/intro/framework/sync/device.h
Normal file
@@ -0,0 +1,23 @@
|
||||
/* Copyright (C) 2007-2008 Erik Faye-Lund and Egbert Teeselink
|
||||
* For conditions of distribution and use, see copyright notice in COPYING
|
||||
*/
|
||||
|
||||
#ifndef SYNC_DEVICE_H
|
||||
#define SYNC_DEVICE_H
|
||||
|
||||
#include "data.h"
|
||||
#include "sync.h"
|
||||
|
||||
struct sync_device {
|
||||
char *base;
|
||||
struct sync_data data;
|
||||
|
||||
#ifndef SYNC_PLAYER
|
||||
int row;
|
||||
SOCKET sock;
|
||||
#else
|
||||
struct sync_io_cb io_cb;
|
||||
#endif
|
||||
};
|
||||
|
||||
#endif /* SYNC_DEVICE_H */
|
||||
47
8kode/src/intro/framework/sync/sync.h
Normal file
@@ -0,0 +1,47 @@
|
||||
/* Copyright (C) 2010 Erik Faye-Lund and Egbert Teeselink
|
||||
* For conditions of distribution and use, see copyright notice in COPYING
|
||||
*/
|
||||
|
||||
#ifndef SYNC_H
|
||||
#define SYNC_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
struct sync_device;
|
||||
struct sync_track;
|
||||
|
||||
struct sync_device *sync_create_device(const char *);
|
||||
void sync_destroy_device(struct sync_device *);
|
||||
|
||||
#ifndef SYNC_PLAYER
|
||||
struct sync_cb {
|
||||
void (*pause)(void *, int);
|
||||
void (*set_row)(void *, int);
|
||||
int (*is_playing)(void *);
|
||||
};
|
||||
#define SYNC_DEFAULT_PORT 1338
|
||||
int sync_connect(struct sync_device *, const char *, unsigned short);
|
||||
int sync_update(struct sync_device *, int, struct sync_cb *, void *);
|
||||
void sync_save_tracks(const struct sync_device *);
|
||||
#else /* defined(SYNC_PLAYER) */
|
||||
typedef void *(*LPFNCBOPEN)(const char *filename, const char *mode);
|
||||
typedef size_t(*LPFNCBREAD)(void *ptr, size_t size, size_t nitems, void *stream);
|
||||
typedef int(*LPFNCBCLOSE)(void *stream);
|
||||
struct sync_io_cb {
|
||||
LPFNCBOPEN open;
|
||||
LPFNCBREAD read;
|
||||
LPFNCBCLOSE close;
|
||||
};
|
||||
void sync_set_io_cb(struct sync_device *d, struct sync_io_cb *cb);
|
||||
#endif /* defined(SYNC_PLAYER) */
|
||||
|
||||
const struct sync_track *sync_get_track(struct sync_device *, const char *);
|
||||
double sync_get_val(const struct sync_track *, double);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* !defined(SYNC_H) */
|
||||
128
8kode/src/intro/framework/sync/track.cpp
Normal file
@@ -0,0 +1,128 @@
|
||||
/* Copyright (C) 2010 Erik Faye-Lund and Egbert Teeselink
|
||||
* For conditions of distribution and use, see copyright notice in COPYING
|
||||
*/
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <assert.h>
|
||||
#include <math.h>
|
||||
#ifndef M_PI
|
||||
#define M_PI 3.141926
|
||||
#endif
|
||||
|
||||
#include "sync.h"
|
||||
#include "track.h"
|
||||
#include "base.h"
|
||||
|
||||
static double key_linear(const struct track_key k[2], double row)
|
||||
{
|
||||
double t = (row - k[0].row) / (k[1].row - k[0].row);
|
||||
return k[0].value + (k[1].value - k[0].value) * t;
|
||||
}
|
||||
|
||||
static double key_smooth(const struct track_key k[2], double row)
|
||||
{
|
||||
double t = (row - k[0].row) / (k[1].row - k[0].row);
|
||||
t = t * t * (3 - 2 * t);
|
||||
return k[0].value + (k[1].value - k[0].value) * t;
|
||||
}
|
||||
|
||||
static double key_ramp(const struct track_key k[2], double row)
|
||||
{
|
||||
double t = (row - k[0].row) / (k[1].row - k[0].row);
|
||||
t = pow(t, 2.0);
|
||||
return k[0].value + (k[1].value - k[0].value) * t;
|
||||
}
|
||||
|
||||
double sync_get_val(const struct sync_track *t, double row)
|
||||
{
|
||||
int idx, irow;
|
||||
|
||||
/* If we have no keys at all, return a constant 0 */
|
||||
if (!t->num_keys)
|
||||
return 0.0f;
|
||||
|
||||
irow = (int)floor(row);
|
||||
idx = key_idx_floor(t, irow);
|
||||
|
||||
/* at the edges, return the first/last value */
|
||||
if (idx < 0)
|
||||
return t->keys[0].value;
|
||||
if (idx > (int)t->num_keys - 2)
|
||||
return t->keys[t->num_keys - 1].value;
|
||||
|
||||
/* interpolate according to key-type */
|
||||
switch (t->keys[idx].type) {
|
||||
case KEY_STEP:
|
||||
return t->keys[idx].value;
|
||||
case KEY_LINEAR:
|
||||
return key_linear(t->keys + idx, row);
|
||||
case KEY_SMOOTH:
|
||||
return key_smooth(t->keys + idx, row);
|
||||
case KEY_RAMP:
|
||||
return key_ramp(t->keys + idx, row);
|
||||
default:
|
||||
assert(0);
|
||||
return 0.0f;
|
||||
}
|
||||
}
|
||||
|
||||
int sync_find_key(const struct sync_track *t, int row)
|
||||
{
|
||||
int lo = 0, hi = t->num_keys;
|
||||
|
||||
/* binary search, t->keys is sorted by row */
|
||||
while (lo < hi) {
|
||||
int mi = (lo + hi) / 2;
|
||||
assert(mi != hi);
|
||||
|
||||
if (t->keys[mi].row < row)
|
||||
lo = mi + 1;
|
||||
else if (t->keys[mi].row > row)
|
||||
hi = mi;
|
||||
else
|
||||
return mi; /* exact hit */
|
||||
}
|
||||
assert(lo == hi);
|
||||
|
||||
/* return first key after row, negated and biased (to allow -0) */
|
||||
return -lo - 1;
|
||||
}
|
||||
|
||||
#ifndef SYNC_PLAYER
|
||||
int sync_set_key(struct sync_track *t, const struct track_key *k)
|
||||
{
|
||||
int idx = sync_find_key(t, k->row);
|
||||
if (idx < 0) {
|
||||
/* no exact hit, we need to allocate a new key */
|
||||
void *tmp;
|
||||
idx = -idx - 1;
|
||||
tmp = realloc(t->keys, sizeof(struct track_key) *
|
||||
(t->num_keys + 1));
|
||||
if (!tmp)
|
||||
return -1;
|
||||
t->num_keys++;
|
||||
t->keys = (track_key*)tmp;
|
||||
memmove(t->keys + idx + 1, t->keys + idx,
|
||||
sizeof(struct track_key) * (t->num_keys - idx - 1));
|
||||
}
|
||||
t->keys[idx] = *k;
|
||||
return 0;
|
||||
}
|
||||
|
||||
int sync_del_key(struct sync_track *t, int pos)
|
||||
{
|
||||
void *tmp;
|
||||
int idx = sync_find_key(t, pos);
|
||||
assert(idx >= 0);
|
||||
memmove(t->keys + idx, t->keys + idx + 1,
|
||||
sizeof(struct track_key) * (t->num_keys - idx - 1));
|
||||
assert(t->keys);
|
||||
tmp = realloc(t->keys, sizeof(struct track_key) *
|
||||
(t->num_keys - 1));
|
||||
if (t->num_keys != 1 && !tmp)
|
||||
return -1;
|
||||
t->num_keys--;
|
||||
t->keys = (track_key*)tmp;
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
51
8kode/src/intro/framework/sync/track.h
Normal file
@@ -0,0 +1,51 @@
|
||||
/* Copyright (C) 2007-2010 Erik Faye-Lund and Egbert Teeselink
|
||||
* For conditions of distribution and use, see copyright notice in COPYING
|
||||
*/
|
||||
|
||||
#ifndef SYNC_TRACK_H
|
||||
#define SYNC_TRACK_H
|
||||
|
||||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
#include "base.h"
|
||||
|
||||
enum key_type {
|
||||
KEY_STEP, /* stay constant */
|
||||
KEY_LINEAR, /* lerp to the next value */
|
||||
KEY_SMOOTH, /* smooth curve to the next value */
|
||||
KEY_RAMP,
|
||||
KEY_TYPE_COUNT
|
||||
};
|
||||
|
||||
struct track_key {
|
||||
int row;
|
||||
float value;
|
||||
enum key_type type;
|
||||
};
|
||||
|
||||
struct sync_track {
|
||||
char *name;
|
||||
struct track_key *keys;
|
||||
int num_keys;
|
||||
};
|
||||
|
||||
int sync_find_key(const struct sync_track *, int);
|
||||
static inline int key_idx_floor(const struct sync_track *t, int row)
|
||||
{
|
||||
int idx = sync_find_key(t, row);
|
||||
if (idx < 0)
|
||||
idx = -idx - 2;
|
||||
return idx;
|
||||
}
|
||||
|
||||
#ifndef SYNC_PLAYER
|
||||
int sync_set_key(struct sync_track *, const struct track_key *);
|
||||
int sync_del_key(struct sync_track *, int);
|
||||
static inline int is_key_frame(const struct sync_track *t, int row)
|
||||
{
|
||||
return sync_find_key(t, row) >= 0;
|
||||
}
|
||||
|
||||
#endif /* !defined(SYNC_PLAYER) */
|
||||
|
||||
#endif /* SYNC_TRACK_H */
|
||||
171
8kode/src/intro/framework/sync/usync.cpp
Normal file
@@ -0,0 +1,171 @@
|
||||
#include "usync.h"
|
||||
#include <math.h>
|
||||
//#include <Shlwapi.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#ifdef SYNC_PLAYER
|
||||
|
||||
static int usync_rows[SYNC_TRACK_COUNT];
|
||||
float usync_values[SYNC_TRACK_COUNT];
|
||||
|
||||
void usync_update(float t, float* targetvalues)
|
||||
{
|
||||
int i; float row = t;
|
||||
for (i = 0; i < SYNC_TRACK_COUNT; ++i) {
|
||||
int pos;
|
||||
float mag, x, a, b, c, d;
|
||||
|
||||
/* empty tracks should not be neccesary! */
|
||||
if (!sync_data_count[i]) {
|
||||
targetvalues[i] = 0.0f;
|
||||
continue;
|
||||
}
|
||||
|
||||
/* step forward until we're at the right key-frame */
|
||||
while (usync_rows[i] < (sync_data_count[i] - 1) &&
|
||||
row >= sync_data_rows[sync_data_offset[i] + usync_rows[i] + 1]) {
|
||||
usync_rows[i]++;
|
||||
}
|
||||
|
||||
pos = usync_rows[i] + sync_data_offset[i];
|
||||
|
||||
/* we need a segment to interpolate over */
|
||||
if (usync_rows[i] == sync_data_count[i] - 1) {
|
||||
targetvalues[i] = sync_data_values[pos];
|
||||
continue;
|
||||
}
|
||||
|
||||
/* prepare coefficients for interpolation */
|
||||
a = sync_data_values[pos];
|
||||
mag = sync_data_values[pos + 1] - sync_data_values[pos];
|
||||
switch (sync_data_type[pos]) {
|
||||
case 0:
|
||||
b = c = d = 0.0f;
|
||||
break;
|
||||
|
||||
case 1:
|
||||
b = mag;
|
||||
c = d = 0.0f;
|
||||
break;
|
||||
|
||||
case 2:
|
||||
b = 0.0f;
|
||||
c = 3 * mag;
|
||||
d = -2 * mag;
|
||||
break;
|
||||
|
||||
case 3:
|
||||
b = d = 0.0f;
|
||||
c = mag;
|
||||
break;
|
||||
}
|
||||
|
||||
/* evaluate function */
|
||||
x = (t - sync_data_rows[pos]) / (sync_data_rows[pos + 1] - sync_data_rows[pos]);
|
||||
targetvalues[i] = a + (b + (c + d * x) * x) * x;
|
||||
}
|
||||
}
|
||||
|
||||
#else /* !defined(SYNC_PLAYER) */
|
||||
|
||||
#include <stdio.h>
|
||||
#include "sync.h"
|
||||
#include "device.h"
|
||||
|
||||
struct sync_device *usync_dev;
|
||||
float usync_time = 0;
|
||||
|
||||
void usync_update(float t, float* targetValues)
|
||||
{
|
||||
usync_time = t;
|
||||
sync_update(usync_dev, (int)floor(t), &usync_cb, usync_data);
|
||||
}
|
||||
|
||||
int usync_init(void)
|
||||
{
|
||||
usync_dev = sync_create_device("sync");
|
||||
return sync_connect(usync_dev, "localhost", SYNC_DEFAULT_PORT);
|
||||
}
|
||||
|
||||
void usync_export(void)
|
||||
{
|
||||
if (usync_dev == 0)
|
||||
return;
|
||||
|
||||
int i, j;
|
||||
int offset = 0;
|
||||
static char exePath[MAX_PATH];
|
||||
static char syncPath[MAX_PATH];
|
||||
GetModuleFileName(NULL, exePath, MAX_PATH);
|
||||
PathRemoveFileSpecA(exePath);
|
||||
PathCombineA(syncPath, exePath, "..\\src\\intro\\framework\\sync-data.h");
|
||||
FILE *fp = fopen(syncPath, "w");
|
||||
|
||||
if (!fp)
|
||||
return;
|
||||
|
||||
/* header-guard */
|
||||
fputs("#ifndef SYNC_DATA_H\n#define SYNC_DATA_H\n\n", fp);
|
||||
|
||||
fputs("enum sync_tracks {\n", fp);
|
||||
for (i = 0; i < usync_dev->data.num_tracks; ++i) {
|
||||
struct sync_track *t = usync_dev->data.tracks[i];
|
||||
fprintf(fp, "\tSYNC_TRACK_%s = %d,\n", t->name, i);
|
||||
}
|
||||
fprintf(fp, "\tSYNC_TRACK_COUNT = %d\n", usync_dev->data.num_tracks);
|
||||
fputs("};\n\n", fp);
|
||||
|
||||
fputs("static const unsigned short sync_data_offset[SYNC_TRACK_COUNT] = {\n", fp);
|
||||
for (i = 0; i < usync_dev->data.num_tracks; ++i) {
|
||||
struct sync_track *t = usync_dev->data.tracks[i];
|
||||
fprintf(fp, "\t%d, /* track: %s */\n", offset, t->name);
|
||||
offset += t->num_keys;
|
||||
}
|
||||
fputs("};\n\n", fp);
|
||||
|
||||
fputs("static const unsigned char sync_data_count[SYNC_TRACK_COUNT] = {\n", fp);
|
||||
for (i = 0; i < usync_dev->data.num_tracks; ++i) {
|
||||
struct sync_track *t = usync_dev->data.tracks[i];
|
||||
fprintf(fp, "\t%d, /* track: %s */\n", t->num_keys, t->name);
|
||||
}
|
||||
fputs("};\n\n", fp);
|
||||
|
||||
fputs("static const unsigned short sync_data_rows[] = {\n", fp);
|
||||
for (i = 0; i < usync_dev->data.num_tracks; ++i) {
|
||||
struct sync_track *t = usync_dev->data.tracks[i];
|
||||
fprintf(fp, "\t/* track: %s */\n", t->name);
|
||||
for (j = 0; j < t->num_keys; ++j)
|
||||
fprintf(fp, "\t%d,\n", t->keys[j].row);
|
||||
}
|
||||
fputs("};\n\n", fp);
|
||||
|
||||
fputs("static const float sync_data_values[] = {\n", fp);
|
||||
for (i = 0; i < usync_dev->data.num_tracks; ++i) {
|
||||
struct sync_track *t = usync_dev->data.tracks[i];
|
||||
fprintf(fp, "\t/* track: %s */\n", t->name);
|
||||
for (j = 0; j < t->num_keys; ++j)
|
||||
fprintf(fp, "\t%.6ff,\n", t->keys[j].value);
|
||||
}
|
||||
fputs("};\n\n", fp);
|
||||
|
||||
fputs("static const unsigned char sync_data_type[] = {\n", fp);
|
||||
for (i = 0; i < usync_dev->data.num_tracks; ++i) {
|
||||
struct sync_track *t = usync_dev->data.tracks[i];
|
||||
fprintf(fp, "\t/* track: %s */\n", t->name);
|
||||
for (j = 0; j < t->num_keys; ++j)
|
||||
fprintf(fp, "\t%d,\n", t->keys[j].type);
|
||||
}
|
||||
fputs("};\n\n", fp);
|
||||
|
||||
fputs("#endif /* !defined(SYNC_DATA_H) */\n", fp);
|
||||
fclose(fp);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
42
8kode/src/intro/framework/sync/usync.h
Normal file
@@ -0,0 +1,42 @@
|
||||
#ifndef USYNC_H
|
||||
#define USYNC_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
{
|
||||
#endif
|
||||
|
||||
#ifdef SYNC_PLAYER
|
||||
|
||||
#include "../sync-data.h"
|
||||
extern float usync_values[SYNC_TRACK_COUNT];
|
||||
|
||||
/* tiny api */
|
||||
#define usync_init() 0
|
||||
void usync_update(float t, float* targetValues);
|
||||
#define usync_get_val(x) usync_values[ SYNC_TRACK_##x ]
|
||||
#define usync_export()
|
||||
|
||||
#else /* !defined(SYNC_PLAYER) */
|
||||
|
||||
#include "sync.h"
|
||||
|
||||
extern struct sync_device *usync_dev;
|
||||
extern float usync_time;
|
||||
|
||||
int usync_init(void);
|
||||
void usync_update(float t, float* targetValues);
|
||||
#define usync_get_val(track) sync_get_val(sync_get_track(usync_dev, #track), usync_time)
|
||||
void usync_export(void);
|
||||
|
||||
/* implement these yourself */
|
||||
extern struct sync_cb usync_cb;
|
||||
extern void *usync_data;
|
||||
|
||||
#endif /* !defined(SYNC_PLAYER) */
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* !defined(USYNC_H) */
|
||||
152
8kode/src/intro/framework/video.h
Normal file
@@ -0,0 +1,152 @@
|
||||
#ifdef VIDEO
|
||||
#include <vfw.h>
|
||||
|
||||
#define FPS 60
|
||||
#define MOTION_BLUR 8
|
||||
|
||||
typedef struct
|
||||
{
|
||||
PAVISTREAM m_ps;
|
||||
PAVISTREAM m_psCompressed;
|
||||
PAVISTREAM m_psAudio;
|
||||
AVISTREAMINFO m_strhdr;
|
||||
AVICOMPRESSOPTIONS m_opts;
|
||||
PAVIFILE m_pfile;
|
||||
BITMAPINFOHEADER m_alpbi;
|
||||
} AVIWRITER;
|
||||
|
||||
static D3D11_TEXTURE2D_DESC videoStagingTextureDesc =
|
||||
{
|
||||
SCREENWIDTH,
|
||||
SCREENHEIGHT,
|
||||
1,
|
||||
1,
|
||||
DXGI_FORMAT_R8G8B8A8_UNORM,
|
||||
{ 1, 0 },
|
||||
D3D11_USAGE_STAGING,
|
||||
0,
|
||||
D3D11_CPU_ACCESS_READ,
|
||||
0
|
||||
};
|
||||
|
||||
#pragma bss_seg(".videobss")
|
||||
static AVIWRITER avi;
|
||||
static int frame = 0;
|
||||
static ID3D11Texture2D* videoStagingTexture;
|
||||
static byte buffer[3 * SCREENWIDTH * SCREENHEIGHT];
|
||||
static int tempBuffer[3 * SCREENWIDTH * SCREENHEIGHT];
|
||||
|
||||
#pragma code_seg(".VideoInit")
|
||||
void VideoInit()
|
||||
{
|
||||
AVIFileInit();
|
||||
CHECK(AVIFileOpen(&avi.m_pfile, "intro.avi", OF_WRITE | OF_CREATE, NULL));
|
||||
|
||||
memset(&avi.m_strhdr, 0, sizeof(avi.m_strhdr));
|
||||
avi.m_strhdr.fccType = streamtypeVIDEO;
|
||||
avi.m_strhdr.fccHandler = 0;
|
||||
avi.m_strhdr.dwScale = 1;
|
||||
avi.m_strhdr.dwRate = FPS;
|
||||
avi.m_strhdr.dwSuggestedBufferSize = 0;// 3 * SCREENWIDTH * SCREENHEIGHT;
|
||||
SetRect(&avi.m_strhdr.rcFrame, 0, 0, SCREENWIDTH, SCREENHEIGHT);
|
||||
|
||||
CHECK(AVIFileCreateStream(avi.m_pfile, &avi.m_ps, &avi.m_strhdr));
|
||||
|
||||
memset(&avi.m_strhdr, 0, sizeof(avi.m_strhdr));
|
||||
avi.m_strhdr.fccType = streamtypeAUDIO;
|
||||
avi.m_strhdr.dwScale = WaveFMT.nBlockAlign;
|
||||
avi.m_strhdr.dwRate = WaveFMT.nSamplesPerSec * WaveFMT.nBlockAlign;
|
||||
avi.m_strhdr.dwSampleSize = WaveFMT.nBlockAlign;
|
||||
avi.m_strhdr.dwQuality = (DWORD)-1;
|
||||
SetRect(&avi.m_strhdr.rcFrame, 0, 0, SCREENWIDTH, SCREENHEIGHT);
|
||||
|
||||
CHECK(AVIFileCreateStream(avi.m_pfile, &avi.m_psAudio, &avi.m_strhdr));
|
||||
CHECK(AVIStreamSetFormat(avi.m_psAudio, 0, &WaveFMT, sizeof(WAVEFORMATEX)));
|
||||
|
||||
auto ops = &avi.m_opts;
|
||||
if (AVISaveOptions(windowHandle, 0, 1, &avi.m_ps, &ops) == FALSE)
|
||||
{
|
||||
ExitProcess(0);
|
||||
}
|
||||
|
||||
CHECK(AVIMakeCompressedStream(&avi.m_psCompressed, avi.m_ps, &avi.m_opts, NULL));
|
||||
|
||||
memset(&avi.m_alpbi, 0, sizeof(avi.m_alpbi));
|
||||
avi.m_alpbi.biSize = sizeof(avi.m_alpbi);
|
||||
avi.m_alpbi.biWidth = SCREENWIDTH;
|
||||
avi.m_alpbi.biHeight = SCREENHEIGHT;
|
||||
avi.m_alpbi.biPlanes = 1;
|
||||
avi.m_alpbi.biBitCount = 24;
|
||||
avi.m_alpbi.biCompression = BI_RGB;
|
||||
|
||||
CHECK(AVIStreamSetFormat(avi.m_psCompressed, 0, &avi.m_alpbi, sizeof(avi.m_alpbi)));
|
||||
|
||||
CHECK(device->CreateTexture2D(&videoStagingTextureDesc, NULL, &videoStagingTexture));
|
||||
}
|
||||
|
||||
#pragma code_seg(".VideoGetPosition")
|
||||
float VideoGetPosition()
|
||||
{
|
||||
float seconds = (float)frame / (float)(FPS * MOTION_BLUR);
|
||||
float samples = seconds * SAMPLE_RATE;
|
||||
float ticks = samples / (float)SAMPLES_PER_TICK;
|
||||
return ticks / SOUND_TICKS_PER_SCENE;
|
||||
}
|
||||
|
||||
#pragma code_seg(".VideoUpdate")
|
||||
void VideoUpdate()
|
||||
{
|
||||
static D3D11_MAPPED_SUBRESOURCE videoMappedSubresource;
|
||||
|
||||
context->CopyResource(videoStagingTexture, backBufferTexture);
|
||||
context->Map(videoStagingTexture, 0, D3D11_MAP_READ, 0, &videoMappedSubresource);
|
||||
|
||||
auto introPtr = (byte*)videoMappedSubresource.pData;
|
||||
for (int y = 0; y < SCREENHEIGHT; ++y)
|
||||
{
|
||||
auto vy = SCREENHEIGHT - y - 1;
|
||||
for (int x = 0; x < SCREENWIDTH; ++x)
|
||||
{
|
||||
for (int c = 0; c < 4; ++c)
|
||||
{
|
||||
byte color = *introPtr++;
|
||||
if (c < 3)
|
||||
{
|
||||
auto vc = 2 - c;
|
||||
auto vidx = vc + 3 * (x + SCREENWIDTH * vy);
|
||||
tempBuffer[vidx] += color;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
context->Unmap(videoStagingTexture, 0);
|
||||
|
||||
if ((frame++ % MOTION_BLUR) == 0)
|
||||
{
|
||||
auto videoPtr = (byte*)buffer;
|
||||
auto tempPtr = (int*)tempBuffer;
|
||||
for (int i = 0; i < SCREENWIDTH * SCREENHEIGHT * 3; ++i)
|
||||
{
|
||||
*videoPtr++ = (byte)(*tempPtr / MOTION_BLUR);
|
||||
*tempPtr++ = 0;
|
||||
}
|
||||
|
||||
CHECK(AVIStreamWrite(avi.m_psCompressed, (frame - 1) / MOTION_BLUR, 1, buffer, 3 * SCREENWIDTH * SCREENHEIGHT, AVIIF_KEYFRAME, NULL, NULL));
|
||||
}
|
||||
}
|
||||
|
||||
#pragma code_seg(".VideoDispose")
|
||||
void VideoDispose()
|
||||
{
|
||||
auto const extraSamples = 0;// SOUND_TICKS_PER_SCENE * SAMPLES_PER_TICK / 4;
|
||||
static SAMPLE_TYPE audioBuffer[2 * (MAX_SAMPLES + extraSamples)];
|
||||
memcpy(audioBuffer + extraSamples * 2, WaveHDR.lpData, WaveHDR.dwBufferLength);
|
||||
AVIStreamWrite(avi.m_psAudio, 0, MAX_SAMPLES + extraSamples, audioBuffer, WaveHDR.dwBufferLength + extraSamples * sizeof(SAMPLE_TYPE) * 2, 0, NULL, NULL);
|
||||
|
||||
AVIStreamClose(avi.m_ps);
|
||||
AVIStreamClose(avi.m_psCompressed);
|
||||
AVIStreamClose(avi.m_psAudio);
|
||||
AVIFileClose(avi.m_pfile);
|
||||
AVIFileExit();
|
||||
}
|
||||
#endif
|
||||
88
8kode/src/intro/framework/window.h
Normal file
@@ -0,0 +1,88 @@
|
||||
#pragma once
|
||||
|
||||
#ifndef SCREENWIDTH
|
||||
#define SCREENWIDTH 1920
|
||||
#endif
|
||||
|
||||
#ifndef SCREENHEIGHT
|
||||
#define SCREENHEIGHT 1080
|
||||
#endif
|
||||
|
||||
#ifndef WINDOWED
|
||||
#define WINDOWED FALSE
|
||||
#endif
|
||||
|
||||
#pragma bss_seg(".windowbss")
|
||||
static float windowWidth = SCREENWIDTH;
|
||||
static float windowHeight = SCREENHEIGHT;
|
||||
static HWND windowHandle;
|
||||
|
||||
#ifdef VIDEO
|
||||
#define windowTitle "Intro (rendering to video)"
|
||||
#endif
|
||||
|
||||
#ifdef RELEASE
|
||||
#define windowTitle "Intro (release)"
|
||||
#endif
|
||||
|
||||
#ifdef SHADERDEBUG
|
||||
#define windowTitle "Intro (shader debug)"
|
||||
#endif
|
||||
|
||||
#ifdef AUTHORING
|
||||
#define windowTitle "Intro (authoring)"
|
||||
#endif
|
||||
|
||||
#ifndef windowTitle
|
||||
#define windowTitle "Intro (unknown configuration)"
|
||||
#endif
|
||||
|
||||
#ifndef COMPRESS
|
||||
#undef WINDOWED
|
||||
#define WINDOWED TRUE
|
||||
#endif
|
||||
|
||||
#pragma code_seg(".windowInit")
|
||||
INLINE void WindowInit()
|
||||
{
|
||||
Log("WindowInit");
|
||||
#ifdef RELEASE
|
||||
windowHandle = CreateWindowExA(0, (LPCSTR)0x0000C019, 0, WS_OVERLAPPEDWINDOW | WS_VISIBLE, 0, 0, windowWidth + 16, windowHeight + 39, 0, 0, 0, 0);
|
||||
ShowCursor(false);
|
||||
#else
|
||||
WNDCLASSEX wndclass;
|
||||
wndclass.cbSize = sizeof(wndclass);
|
||||
wndclass.style = CS_HREDRAW | CS_VREDRAW | CS_OWNDC;
|
||||
wndclass.lpfnWndProc = (WNDPROC)DefWindowProc;
|
||||
wndclass.cbClsExtra = 0;
|
||||
wndclass.cbWndExtra = 0;
|
||||
wndclass.hInstance = NULL;
|
||||
wndclass.hIcon = LoadIcon(NULL, IDI_APPLICATION);
|
||||
wndclass.hCursor = LoadCursor(NULL, IDC_ARROW);
|
||||
wndclass.hbrBackground = (HBRUSH)GetStockObject(BLACK_BRUSH);
|
||||
wndclass.lpszMenuName = NULL;
|
||||
wndclass.lpszClassName = "IntroWindowClass";
|
||||
wndclass.hIconSm = LoadIcon(NULL, IDI_APPLICATION);
|
||||
|
||||
RegisterClassEx(&wndclass);
|
||||
#ifndef AUTHORING
|
||||
windowHandle = CreateWindowExA(0,
|
||||
wndclass.lpszClassName,
|
||||
windowTitle,
|
||||
WS_EX_APPWINDOW,
|
||||
GetSystemMetrics(SM_CXSCREEN) - windowWidth - 16,
|
||||
0,
|
||||
windowWidth + 16,
|
||||
windowHeight + 39,
|
||||
NULL,
|
||||
NULL,
|
||||
GetModuleHandle(NULL),
|
||||
NULL
|
||||
);
|
||||
ShowWindow(windowHandle, SW_NORMAL);
|
||||
SetWindowPos(windowHandle, 0, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE);
|
||||
#else
|
||||
windowHandle = CreateWindowExA(0, wndclass.lpszClassName, windowTitle, 0, 0, 0, SCREENWIDTH + 16, SCREENHEIGHT + 39, 0, 0, GetModuleHandle(NULL), 0);
|
||||
#endif
|
||||
#endif
|
||||
}
|
||||
BIN
8kode/src/intro/intro.suo
Normal file
570
8kode/src/intro/intro.vcxproj
Normal file
@@ -0,0 +1,570 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project DefaultTargets="Build" ToolsVersion="12.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<ItemGroup Label="ProjectConfigurations">
|
||||
<ProjectConfiguration Include="Authoring|Win32">
|
||||
<Configuration>Authoring</Configuration>
|
||||
<Platform>Win32</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Release|Win32">
|
||||
<Configuration>Release</Configuration>
|
||||
<Platform>Win32</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="ShaderDebug|Win32">
|
||||
<Configuration>ShaderDebug</Configuration>
|
||||
<Platform>Win32</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Compress|Win32">
|
||||
<Configuration>Compress</Configuration>
|
||||
<Platform>Win32</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Video|Win32">
|
||||
<Configuration>Video</Configuration>
|
||||
<Platform>Win32</Platform>
|
||||
</ProjectConfiguration>
|
||||
</ItemGroup>
|
||||
<PropertyGroup Label="Globals">
|
||||
<ProjectGuid>{EC001821-5569-4BB5-87B3-20CB8FF9137B}</ProjectGuid>
|
||||
<Keyword>Win32Proj</Keyword>
|
||||
<RootNamespace>ConsoleApplication1</RootNamespace>
|
||||
<ProjectName>intro</ProjectName>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='ShaderDebug|Win32'" Label="Configuration">
|
||||
<ConfigurationType>Application</ConfigurationType>
|
||||
<UseDebugLibraries>true</UseDebugLibraries>
|
||||
<PlatformToolset>v120</PlatformToolset>
|
||||
<CharacterSet>NotSet</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Video|Win32'" Label="Configuration">
|
||||
<ConfigurationType>Application</ConfigurationType>
|
||||
<UseDebugLibraries>true</UseDebugLibraries>
|
||||
<PlatformToolset>v120</PlatformToolset>
|
||||
<CharacterSet>NotSet</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Authoring|Win32'" Label="Configuration">
|
||||
<ConfigurationType>Application</ConfigurationType>
|
||||
<UseDebugLibraries>true</UseDebugLibraries>
|
||||
<PlatformToolset>v120</PlatformToolset>
|
||||
<CharacterSet>NotSet</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Compress|Win32'" Label="Configuration">
|
||||
<ConfigurationType>Application</ConfigurationType>
|
||||
<UseDebugLibraries>false</UseDebugLibraries>
|
||||
<PlatformToolset>v120</PlatformToolset>
|
||||
<WholeProgramOptimization>true</WholeProgramOptimization>
|
||||
<CharacterSet>NotSet</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
|
||||
<ConfigurationType>Application</ConfigurationType>
|
||||
<UseDebugLibraries>false</UseDebugLibraries>
|
||||
<PlatformToolset>v120</PlatformToolset>
|
||||
<WholeProgramOptimization>true</WholeProgramOptimization>
|
||||
<CharacterSet>NotSet</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
|
||||
<ImportGroup Label="ExtensionSettings">
|
||||
</ImportGroup>
|
||||
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='ShaderDebug|Win32'">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Video|Win32'" Label="PropertySheets">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Authoring|Win32'" Label="PropertySheets">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Compress|Win32'">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="PropertySheets">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<PropertyGroup Label="UserMacros" />
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='ShaderDebug|Win32'">
|
||||
<LinkIncremental>true</LinkIncremental>
|
||||
<OutDir>$(SolutionDir)bin\</OutDir>
|
||||
<IntDir>$(SolutionDir)obj\$(Configuration)\</IntDir>
|
||||
<TargetName>$(ProjectName)_$(Configuration)</TargetName>
|
||||
<ExecutablePath>$(SolutionDir)\tools;$(ExecutablePath)</ExecutablePath>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Video|Win32'">
|
||||
<LinkIncremental>true</LinkIncremental>
|
||||
<OutDir>$(SolutionDir)bin\</OutDir>
|
||||
<IntDir>$(SolutionDir)obj\$(Configuration)\</IntDir>
|
||||
<TargetName>$(ProjectName)_$(Configuration)</TargetName>
|
||||
<ExecutablePath>$(SolutionDir)\tools;$(ExecutablePath)</ExecutablePath>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Authoring|Win32'">
|
||||
<LinkIncremental>true</LinkIncremental>
|
||||
<OutDir>$(SolutionDir)bin\</OutDir>
|
||||
<IntDir>$(SolutionDir)obj\$(Configuration)\</IntDir>
|
||||
<TargetName>$(ProjectName)_$(Configuration)</TargetName>
|
||||
<ExecutablePath>$(SolutionDir)\tools;$(ExecutablePath)</ExecutablePath>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Compress|Win32'">
|
||||
<LinkIncremental>false</LinkIncremental>
|
||||
<OutDir>$(SolutionDir)bin\</OutDir>
|
||||
<IntDir>$(SolutionDir)obj\$(Configuration)\</IntDir>
|
||||
<TargetName>$(ProjectName)_$(Configuration)</TargetName>
|
||||
<ExecutablePath>$(SolutionDir)\tools;$(ExecutablePath)</ExecutablePath>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<LinkIncremental>false</LinkIncremental>
|
||||
<OutDir>$(SolutionDir)bin\</OutDir>
|
||||
<IntDir>$(SolutionDir)obj\$(Configuration)\</IntDir>
|
||||
<TargetName>$(ProjectName)_$(Configuration)</TargetName>
|
||||
<ExecutablePath>$(SolutionDir)\tools;$(ExecutablePath)</ExecutablePath>
|
||||
</PropertyGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='ShaderDebug|Win32'">
|
||||
<ClCompile>
|
||||
<PrecompiledHeader>
|
||||
</PrecompiledHeader>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<Optimization>Disabled</Optimization>
|
||||
<PreprocessorDefinitions>SHADERDEBUG;WIN32;_DEBUG;_CONSOLE;_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<CallingConvention>StdCall</CallingConvention>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<SubSystem>Console</SubSystem>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
<AdditionalDependencies>dxgi.lib;d3d11.lib;D3dcompiler.lib;winmm.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
</Link>
|
||||
<PreBuildEvent>
|
||||
<Command>
|
||||
</Command>
|
||||
</PreBuildEvent>
|
||||
<CustomBuildStep>
|
||||
<Command>
|
||||
</Command>
|
||||
</CustomBuildStep>
|
||||
<CustomBuildStep>
|
||||
<Message>
|
||||
</Message>
|
||||
<Outputs>
|
||||
</Outputs>
|
||||
<Inputs>
|
||||
</Inputs>
|
||||
</CustomBuildStep>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Video|Win32'">
|
||||
<ClCompile>
|
||||
<PrecompiledHeader>
|
||||
</PrecompiledHeader>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<Optimization>Disabled</Optimization>
|
||||
<PreprocessorDefinitions>VIDEO;WIN32;SYNC_PLAYER;_DEBUG;_CONSOLE;_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<CallingConvention>StdCall</CallingConvention>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<SubSystem>Console</SubSystem>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
<AdditionalDependencies>dxgi.lib;d3d11.lib;D3dcompiler.lib;winmm.lib;vfw32.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
</Link>
|
||||
<PreBuildEvent>
|
||||
<Command>
|
||||
</Command>
|
||||
</PreBuildEvent>
|
||||
<CustomBuildStep>
|
||||
<Command>
|
||||
</Command>
|
||||
</CustomBuildStep>
|
||||
<CustomBuildStep>
|
||||
<Message>
|
||||
</Message>
|
||||
<Outputs>
|
||||
</Outputs>
|
||||
<Inputs>
|
||||
</Inputs>
|
||||
</CustomBuildStep>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Authoring|Win32'">
|
||||
<ClCompile>
|
||||
<PrecompiledHeader>
|
||||
</PrecompiledHeader>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<Optimization>Disabled</Optimization>
|
||||
<PreprocessorDefinitions>AUTHORING;WIN32;_DEBUG;_CONSOLE;_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<CallingConvention>StdCall</CallingConvention>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<SubSystem>Console</SubSystem>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
<AdditionalDependencies>dxgi.lib;d3d11.lib;dxguid.lib;D3dcompiler.lib;winmm.lib;Shlwapi.lib;ws2_32.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
<Profile>true</Profile>
|
||||
</Link>
|
||||
<PreBuildEvent>
|
||||
<Command>
|
||||
</Command>
|
||||
</PreBuildEvent>
|
||||
<CustomBuildStep>
|
||||
<Command>
|
||||
</Command>
|
||||
</CustomBuildStep>
|
||||
<CustomBuildStep>
|
||||
<Message>
|
||||
</Message>
|
||||
<Outputs>
|
||||
</Outputs>
|
||||
<Inputs>
|
||||
</Inputs>
|
||||
</CustomBuildStep>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Compress|Win32'">
|
||||
<ClCompile>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<PrecompiledHeader>
|
||||
</PrecompiledHeader>
|
||||
<Optimization>MinSpace</Optimization>
|
||||
<FunctionLevelLinking>false</FunctionLevelLinking>
|
||||
<IntrinsicFunctions>true</IntrinsicFunctions>
|
||||
<PreprocessorDefinitions>COMPRESS;RELEASE;WIN32;NDEBUG;SYNC_PLAYER;_CONSOLE;_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<DebugInformationFormat Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">None</DebugInformationFormat>
|
||||
<FavorSizeOrSpeed Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">Size</FavorSizeOrSpeed>
|
||||
<OmitFramePointers Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</OmitFramePointers>
|
||||
<WholeProgramOptimization Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">false</WholeProgramOptimization>
|
||||
<ExceptionHandling Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">false</ExceptionHandling>
|
||||
<RuntimeLibrary Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">MultiThreadedDLL</RuntimeLibrary>
|
||||
<BufferSecurityCheck Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">false</BufferSecurityCheck>
|
||||
<FloatingPointModel Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">Fast</FloatingPointModel>
|
||||
<DebugInformationFormat>None</DebugInformationFormat>
|
||||
<FavorSizeOrSpeed>Size</FavorSizeOrSpeed>
|
||||
<OmitFramePointers>true</OmitFramePointers>
|
||||
<WholeProgramOptimization>false</WholeProgramOptimization>
|
||||
<ExceptionHandling>false</ExceptionHandling>
|
||||
<BufferSecurityCheck>false</BufferSecurityCheck>
|
||||
<EnableEnhancedInstructionSet>NoExtensions</EnableEnhancedInstructionSet>
|
||||
<AdditionalOptions>/QIfist %(AdditionalOptions)</AdditionalOptions>
|
||||
<FloatingPointModel>Fast</FloatingPointModel>
|
||||
<CallingConvention>StdCall</CallingConvention>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<SubSystem>Console</SubSystem>
|
||||
<GenerateDebugInformation>false</GenerateDebugInformation>
|
||||
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
||||
<OptimizeReferences>true</OptimizeReferences>
|
||||
<AdditionalDependencies>dxgi.lib;d3d11.lib;D3dcompiler.lib;winmm.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
<AdditionalOptions>/CRINKLER /TRANSFORM:CALLS /COMPMODE:FAST /HASHTRIES:10 /HASHSIZE:256 /ORDERTRIES:200 /UNSAFEIMPORT /REPORT:crinkler.html /PROGRESSGUI %(AdditionalOptions)</AdditionalOptions>
|
||||
<EntryPointSymbol>main</EntryPointSymbol>
|
||||
</Link>
|
||||
<PreBuildEvent>
|
||||
<Command>
|
||||
</Command>
|
||||
</PreBuildEvent>
|
||||
<CustomBuildStep>
|
||||
<Command>
|
||||
</Command>
|
||||
</CustomBuildStep>
|
||||
<CustomBuildStep>
|
||||
<Message>
|
||||
</Message>
|
||||
<Outputs>
|
||||
</Outputs>
|
||||
<Inputs>
|
||||
</Inputs>
|
||||
</CustomBuildStep>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<ClCompile>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<PrecompiledHeader>
|
||||
</PrecompiledHeader>
|
||||
<Optimization>Disabled</Optimization>
|
||||
<FunctionLevelLinking>true</FunctionLevelLinking>
|
||||
<IntrinsicFunctions>true</IntrinsicFunctions>
|
||||
<PreprocessorDefinitions>RELEASE;WIN32;SYNC_PLAYER;_DEBUG;_CONSOLE;_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<AssemblerOutput>All</AssemblerOutput>
|
||||
<CallingConvention>StdCall</CallingConvention>
|
||||
<FloatingPointModel>Fast</FloatingPointModel>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<SubSystem>Console</SubSystem>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
||||
<OptimizeReferences>true</OptimizeReferences>
|
||||
<AdditionalDependencies>dxgi.lib;d3d11.lib;dxguid.lib;D3dcompiler.lib;winmm.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
<AdditionalOptions>/CRINKLER /TRANSFORM:CALLS /COMPMODE:FAST /HASHTRIES:10 /HASHSIZE:256 /ORDERTRIES:200 /UNSAFEIMPORT /REPORT:crinkler.html /PROGRESSGUI %(AdditionalOptions)</AdditionalOptions>
|
||||
</Link>
|
||||
<PreBuildEvent>
|
||||
<Command>
|
||||
</Command>
|
||||
</PreBuildEvent>
|
||||
<CustomBuildStep>
|
||||
<Command>
|
||||
</Command>
|
||||
</CustomBuildStep>
|
||||
<CustomBuildStep>
|
||||
<Message>
|
||||
</Message>
|
||||
<Outputs>
|
||||
</Outputs>
|
||||
<Inputs>
|
||||
</Inputs>
|
||||
</CustomBuildStep>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="framework\sync\data.cpp" />
|
||||
<ClCompile Include="framework\sync\device.cpp" />
|
||||
<ClCompile Include="framework\sync\track.cpp" />
|
||||
<ClCompile Include="framework\sync\usync.cpp" />
|
||||
<ClCompile Include="main.cpp">
|
||||
<AssemblerOutput Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">All</AssemblerOutput>
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">false</ExcludedFromBuild>
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Compress|Win32'">false</ExcludedFromBuild>
|
||||
</ClCompile>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="framework\4klang.h" />
|
||||
<ClInclude Include="framework\authoring.h" />
|
||||
<ClInclude Include="framework\directx.h" />
|
||||
<ClInclude Include="framework\framework.h" />
|
||||
<ClInclude Include="framework\intro_hlsl.h" />
|
||||
<ClInclude Include="framework\log.h" />
|
||||
<ClInclude Include="framework\mutexlock.h" />
|
||||
<ClInclude Include="framework\shaders.h" />
|
||||
<ClInclude Include="framework\shaders_shc.h" />
|
||||
<ClInclude Include="framework\sync-data.h" />
|
||||
<ClInclude Include="framework\sync\base.h" />
|
||||
<ClInclude Include="framework\sync\data.h" />
|
||||
<ClInclude Include="framework\sync\device.h" />
|
||||
<ClInclude Include="framework\sync\sync.h" />
|
||||
<ClInclude Include="framework\sync\track.h" />
|
||||
<ClInclude Include="framework\sync\usync.h" />
|
||||
<ClInclude Include="framework\video.h" />
|
||||
<ClInclude Include="framework\window.h" />
|
||||
<ClInclude Include="intro\data.h" />
|
||||
<ClInclude Include="framework\sound.h" />
|
||||
<ClInclude Include="intro\intro.h" />
|
||||
<ClInclude Include="intro\update.h" />
|
||||
<ClInclude Include="intro\functions.h" />
|
||||
<ClInclude Include="intro\init.h" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<CustomBuild Include="framework\4klang.asm">
|
||||
<FileType>Document</FileType>
|
||||
<Command Condition="'$(Configuration)|$(Platform)'=='Video|Win32'">yasm -f win32 -o "$(IntermediateOutputPath)framework\4klang.obj" "$(ProjectDir)framework\4klang.asm"</Command>
|
||||
<Message Condition="'$(Configuration)|$(Platform)'=='Video|Win32'">Compiling 4klang...</Message>
|
||||
<Outputs Condition="'$(Configuration)|$(Platform)'=='Video|Win32'">$(IntermediateOutputPath)framework\4klang.obj</Outputs>
|
||||
<AdditionalInputs Condition="'$(Configuration)|$(Platform)'=='Video|Win32'">$(ProjectDir)framework\4klang.inc</AdditionalInputs>
|
||||
<Command Condition="'$(Configuration)|$(Platform)'=='Compress|Win32'">yasm -f win32 -o "$(IntermediateOutputPath)framework\4klang.obj" "$(ProjectDir)framework\4klang.asm"</Command>
|
||||
<Command Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">yasm -f win32 -o "$(IntermediateOutputPath)framework\4klang.obj" "$(ProjectDir)framework\4klang.asm"</Command>
|
||||
<Message Condition="'$(Configuration)|$(Platform)'=='Compress|Win32'">Compiling 4klang...</Message>
|
||||
<Message Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">Compiling 4klang...</Message>
|
||||
<Outputs Condition="'$(Configuration)|$(Platform)'=='Compress|Win32'">$(IntermediateOutputPath)framework\4klang.obj</Outputs>
|
||||
<Outputs Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(IntermediateOutputPath)framework\4klang.obj</Outputs>
|
||||
<AdditionalInputs Condition="'$(Configuration)|$(Platform)'=='Compress|Win32'">$(ProjectDir)framework\4klang.inc</AdditionalInputs>
|
||||
<AdditionalInputs Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(ProjectDir)framework\4klang.inc</AdditionalInputs>
|
||||
<Command Condition="'$(Configuration)|$(Platform)'=='ShaderDebug|Win32'">yasm -f win32 -o "$(IntermediateOutputPath)framework\4klang.obj" "$(ProjectDir)framework\4klang.asm"</Command>
|
||||
<Message Condition="'$(Configuration)|$(Platform)'=='ShaderDebug|Win32'">Compiling 4klang...</Message>
|
||||
<Outputs Condition="'$(Configuration)|$(Platform)'=='ShaderDebug|Win32'">$(IntermediateOutputPath)framework\4klang.obj</Outputs>
|
||||
<AdditionalInputs Condition="'$(Configuration)|$(Platform)'=='ShaderDebug|Win32'">$(ProjectDir)framework\4klang.inc</AdditionalInputs>
|
||||
<Command Condition="'$(Configuration)|$(Platform)'=='Authoring|Win32'">yasm -D AUTHORING -f win32 -o "$(IntermediateOutputPath)framework\4klang.obj" "$(ProjectDir)framework\4klang.asm"</Command>
|
||||
<Message Condition="'$(Configuration)|$(Platform)'=='Authoring|Win32'">Compiling 4klang...</Message>
|
||||
<Outputs Condition="'$(Configuration)|$(Platform)'=='Authoring|Win32'">$(IntermediateOutputPath)framework\4klang.obj</Outputs>
|
||||
<AdditionalInputs Condition="'$(Configuration)|$(Platform)'=='Authoring|Win32'">$(ProjectDir)framework\4klang.inc</AdditionalInputs>
|
||||
</CustomBuild>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="framework\4klang.inc" />
|
||||
<None Include="shaders\lib\fxaa311.hlsl">
|
||||
<FileType>Document</FileType>
|
||||
</None>
|
||||
<None Include="shaders\lib\lighting.hlsl">
|
||||
<FileType>Document</FileType>
|
||||
</None>
|
||||
<None Include="shaders\lib\material.hlsl">
|
||||
<FileType>Document</FileType>
|
||||
</None>
|
||||
<None Include="shaders\lib\ogl2dx.hlsl">
|
||||
<FileType>Document</FileType>
|
||||
</None>
|
||||
<None Include="shaders\lib\postprocessing.hlsl">
|
||||
<FileType>Document</FileType>
|
||||
</None>
|
||||
<None Include="shaders\lib\rt.hlsl">
|
||||
<FileType>Document</FileType>
|
||||
</None>
|
||||
<None Include="shaders\lib\sdf.hlsl">
|
||||
<FileType>Document</FileType>
|
||||
</None>
|
||||
<None Include="shaders\lib\utils.hlsl">
|
||||
<FileType>Document</FileType>
|
||||
</None>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<CustomBuild Include="shaders\intro.hlsl">
|
||||
<ShaderType Condition="'$(Configuration)|$(Platform)'=='Video|Win32'">Compute</ShaderType>
|
||||
<ShaderModel Condition="'$(Configuration)|$(Platform)'=='Video|Win32'">4.0</ShaderModel>
|
||||
<ShaderType Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">Compute</ShaderType>
|
||||
<ShaderModel Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">4.0</ShaderModel>
|
||||
<ShaderType Condition="'$(Configuration)|$(Platform)'=='ShaderDebug|Win32'">Compute</ShaderType>
|
||||
<ShaderModel Condition="'$(Configuration)|$(Platform)'=='ShaderDebug|Win32'">4.0</ShaderModel>
|
||||
<ShaderType Condition="'$(Configuration)|$(Platform)'=='Compress|Win32'">Compute</ShaderType>
|
||||
<ShaderModel Condition="'$(Configuration)|$(Platform)'=='Compress|Win32'">4.0</ShaderModel>
|
||||
<ShaderType Condition="'$(Configuration)|$(Platform)'=='Authoring|Win32'">Compute</ShaderType>
|
||||
<ShaderModel Condition="'$(Configuration)|$(Platform)'=='Authoring|Win32'">4.0</ShaderModel>
|
||||
<FileType>Document</FileType>
|
||||
<Command Condition="'$(Configuration)|$(Platform)'=='Video|Win32'">$(TargetDir)shc "%(FullPath)" "$(ProjectDir)framework\intro_hlsl.h" "$(ProjectDir)framework\shaders_shc.h" "$(ProjectDir)framework\merged.hlsl"</Command>
|
||||
<Command Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(TargetDir)shc "%(FullPath)" "$(ProjectDir)framework\intro_hlsl.h" "$(ProjectDir)framework\shaders_shc.h" "$(ProjectDir)framework\merged.hlsl"</Command>
|
||||
<Command Condition="'$(Configuration)|$(Platform)'=='ShaderDebug|Win32'">$(TargetDir)shc "%(FullPath)" "$(ProjectDir)framework\intro_hlsl.h" "$(ProjectDir)framework\shaders_shc.h" "$(ProjectDir)framework\merged.hlsl"</Command>
|
||||
<Command Condition="'$(Configuration)|$(Platform)'=='Compress|Win32'">$(TargetDir)shc "%(FullPath)" "$(ProjectDir)framework\intro_hlsl.h" "$(ProjectDir)framework\shaders_shc.h" "$(ProjectDir)framework\merged.hlsl"</Command>
|
||||
<Command Condition="'$(Configuration)|$(Platform)'=='Authoring|Win32'">$(TargetDir)shc "%(FullPath)" "$(ProjectDir)framework\intro_hlsl.h" "$(ProjectDir)framework\shaders_shc.h" "$(ProjectDir)framework\merged.hlsl"</Command>
|
||||
<Message Condition="'$(Configuration)|$(Platform)'=='Video|Win32'">Compiling intro.hlsl...</Message>
|
||||
<Outputs Condition="'$(Configuration)|$(Platform)'=='Video|Win32'">$(ProjectDir)framework\shaders_shc.h;$(ProjectDir)framework\intro_hlsl.h;$(ProjectDir)framework\merged.hlsl;%(Outputs)</Outputs>
|
||||
<Message Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">Compiling intro.hlsl...</Message>
|
||||
<Outputs Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(ProjectDir)framework\shaders_shc.h;$(ProjectDir)framework\intro_hlsl.h;$(ProjectDir)framework\merged.hlsl;%(Outputs)</Outputs>
|
||||
<Message Condition="'$(Configuration)|$(Platform)'=='ShaderDebug|Win32'">Compiling intro.hlsl...</Message>
|
||||
<Outputs Condition="'$(Configuration)|$(Platform)'=='ShaderDebug|Win32'">$(ProjectDir)framework\shaders_shc.h;$(ProjectDir)framework\intro_hlsl.h;$(ProjectDir)framework\merged.hlsl;%(Outputs)</Outputs>
|
||||
<Message Condition="'$(Configuration)|$(Platform)'=='Compress|Win32'">Compiling intro.hlsl...</Message>
|
||||
<Outputs Condition="'$(Configuration)|$(Platform)'=='Compress|Win32'">$(ProjectDir)framework\shaders_shc.h;$(ProjectDir)framework\intro_hlsl.h;$(ProjectDir)framework\merged.hlsl;%(Outputs)</Outputs>
|
||||
<Message Condition="'$(Configuration)|$(Platform)'=='Authoring|Win32'">Compiling intro.hlsl...</Message>
|
||||
<Outputs Condition="'$(Configuration)|$(Platform)'=='Authoring|Win32'">$(ProjectDir)framework\shaders_shc.h;$(ProjectDir)framework\intro_hlsl.h;$(ProjectDir)framework\merged.hlsl;%(Outputs)</Outputs>
|
||||
</CustomBuild>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<FxCompile Include="framework\merged.hlsl">
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Video|Win32'">true</ExcludedFromBuild>
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild>
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='ShaderDebug|Win32'">true</ExcludedFromBuild>
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Compress|Win32'">true</ExcludedFromBuild>
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Authoring|Win32'">true</ExcludedFromBuild>
|
||||
</FxCompile>
|
||||
<FxCompile Include="framework\shaders\histogramGather.hlsl">
|
||||
<ShaderType Condition="'$(Configuration)|$(Platform)'=='Video|Win32'">Compute</ShaderType>
|
||||
<ShaderModel Condition="'$(Configuration)|$(Platform)'=='Video|Win32'">5.0</ShaderModel>
|
||||
<ShaderType Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">Compute</ShaderType>
|
||||
<ShaderModel Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">5.0</ShaderModel>
|
||||
<ShaderType Condition="'$(Configuration)|$(Platform)'=='ShaderDebug|Win32'">Compute</ShaderType>
|
||||
<ShaderModel Condition="'$(Configuration)|$(Platform)'=='ShaderDebug|Win32'">5.0</ShaderModel>
|
||||
<ShaderType Condition="'$(Configuration)|$(Platform)'=='Compress|Win32'">Compute</ShaderType>
|
||||
<ShaderModel Condition="'$(Configuration)|$(Platform)'=='Compress|Win32'">5.0</ShaderModel>
|
||||
<ShaderType Condition="'$(Configuration)|$(Platform)'=='Authoring|Win32'">Compute</ShaderType>
|
||||
<ShaderModel Condition="'$(Configuration)|$(Platform)'=='Authoring|Win32'">5.0</ShaderModel>
|
||||
<DisableOptimizations Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</DisableOptimizations>
|
||||
<EnableDebuggingInformation Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</EnableDebuggingInformation>
|
||||
<DisableOptimizations Condition="'$(Configuration)|$(Platform)'=='Compress|Win32'">true</DisableOptimizations>
|
||||
<EnableDebuggingInformation Condition="'$(Configuration)|$(Platform)'=='Compress|Win32'">true</EnableDebuggingInformation>
|
||||
</FxCompile>
|
||||
<FxCompile Include="framework\shaders\histogramSpread.hlsl">
|
||||
<ShaderType Condition="'$(Configuration)|$(Platform)'=='Video|Win32'">Compute</ShaderType>
|
||||
<ShaderModel Condition="'$(Configuration)|$(Platform)'=='Video|Win32'">5.0</ShaderModel>
|
||||
<ShaderType Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">Compute</ShaderType>
|
||||
<ShaderModel Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">5.0</ShaderModel>
|
||||
<ShaderType Condition="'$(Configuration)|$(Platform)'=='ShaderDebug|Win32'">Compute</ShaderType>
|
||||
<ShaderModel Condition="'$(Configuration)|$(Platform)'=='ShaderDebug|Win32'">5.0</ShaderModel>
|
||||
<ShaderType Condition="'$(Configuration)|$(Platform)'=='Compress|Win32'">Compute</ShaderType>
|
||||
<ShaderModel Condition="'$(Configuration)|$(Platform)'=='Compress|Win32'">5.0</ShaderModel>
|
||||
<ShaderType Condition="'$(Configuration)|$(Platform)'=='Authoring|Win32'">Compute</ShaderType>
|
||||
<ShaderModel Condition="'$(Configuration)|$(Platform)'=='Authoring|Win32'">5.0</ShaderModel>
|
||||
<DisableOptimizations Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</DisableOptimizations>
|
||||
<EnableDebuggingInformation Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</EnableDebuggingInformation>
|
||||
<DisableOptimizations Condition="'$(Configuration)|$(Platform)'=='Compress|Win32'">true</DisableOptimizations>
|
||||
<EnableDebuggingInformation Condition="'$(Configuration)|$(Platform)'=='Compress|Win32'">true</EnableDebuggingInformation>
|
||||
</FxCompile>
|
||||
<FxCompile Include="framework\shaders\histogramMaximum.hlsl">
|
||||
<ShaderType Condition="'$(Configuration)|$(Platform)'=='Video|Win32'">Compute</ShaderType>
|
||||
<ShaderModel Condition="'$(Configuration)|$(Platform)'=='Video|Win32'">5.0</ShaderModel>
|
||||
<ShaderType Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">Compute</ShaderType>
|
||||
<ShaderModel Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">5.0</ShaderModel>
|
||||
<ShaderType Condition="'$(Configuration)|$(Platform)'=='ShaderDebug|Win32'">Compute</ShaderType>
|
||||
<ShaderModel Condition="'$(Configuration)|$(Platform)'=='ShaderDebug|Win32'">5.0</ShaderModel>
|
||||
<ShaderType Condition="'$(Configuration)|$(Platform)'=='Compress|Win32'">Compute</ShaderType>
|
||||
<ShaderModel Condition="'$(Configuration)|$(Platform)'=='Compress|Win32'">5.0</ShaderModel>
|
||||
<ShaderType Condition="'$(Configuration)|$(Platform)'=='Authoring|Win32'">Compute</ShaderType>
|
||||
<ShaderModel Condition="'$(Configuration)|$(Platform)'=='Authoring|Win32'">5.0</ShaderModel>
|
||||
<DisableOptimizations Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</DisableOptimizations>
|
||||
<EnableDebuggingInformation Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</EnableDebuggingInformation>
|
||||
<DisableOptimizations Condition="'$(Configuration)|$(Platform)'=='Compress|Win32'">true</DisableOptimizations>
|
||||
<EnableDebuggingInformation Condition="'$(Configuration)|$(Platform)'=='Compress|Win32'">true</EnableDebuggingInformation>
|
||||
</FxCompile>
|
||||
<FxCompile Include="framework\shaders\paradeVectorscopeGather.hlsl">
|
||||
<ShaderType Condition="'$(Configuration)|$(Platform)'=='Video|Win32'">Compute</ShaderType>
|
||||
<ShaderModel Condition="'$(Configuration)|$(Platform)'=='Video|Win32'">5.0</ShaderModel>
|
||||
<ShaderType Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">Compute</ShaderType>
|
||||
<ShaderModel Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">5.0</ShaderModel>
|
||||
<ShaderType Condition="'$(Configuration)|$(Platform)'=='ShaderDebug|Win32'">Compute</ShaderType>
|
||||
<ShaderModel Condition="'$(Configuration)|$(Platform)'=='ShaderDebug|Win32'">5.0</ShaderModel>
|
||||
<ShaderType Condition="'$(Configuration)|$(Platform)'=='Compress|Win32'">Compute</ShaderType>
|
||||
<ShaderModel Condition="'$(Configuration)|$(Platform)'=='Compress|Win32'">5.0</ShaderModel>
|
||||
<ShaderType Condition="'$(Configuration)|$(Platform)'=='Authoring|Win32'">Compute</ShaderType>
|
||||
<ShaderModel Condition="'$(Configuration)|$(Platform)'=='Authoring|Win32'">5.0</ShaderModel>
|
||||
<DisableOptimizations Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</DisableOptimizations>
|
||||
<EnableDebuggingInformation Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</EnableDebuggingInformation>
|
||||
<DisableOptimizations Condition="'$(Configuration)|$(Platform)'=='Compress|Win32'">true</DisableOptimizations>
|
||||
<EnableDebuggingInformation Condition="'$(Configuration)|$(Platform)'=='Compress|Win32'">true</EnableDebuggingInformation>
|
||||
</FxCompile>
|
||||
<FxCompile Include="framework\shaders\paradeVectorscopeMaximum.hlsl">
|
||||
<ShaderType Condition="'$(Configuration)|$(Platform)'=='Video|Win32'">Compute</ShaderType>
|
||||
<ShaderModel Condition="'$(Configuration)|$(Platform)'=='Video|Win32'">5.0</ShaderModel>
|
||||
<ShaderType Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">Compute</ShaderType>
|
||||
<ShaderModel Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">5.0</ShaderModel>
|
||||
<ShaderType Condition="'$(Configuration)|$(Platform)'=='ShaderDebug|Win32'">Compute</ShaderType>
|
||||
<ShaderModel Condition="'$(Configuration)|$(Platform)'=='ShaderDebug|Win32'">5.0</ShaderModel>
|
||||
<ShaderType Condition="'$(Configuration)|$(Platform)'=='Compress|Win32'">Compute</ShaderType>
|
||||
<ShaderModel Condition="'$(Configuration)|$(Platform)'=='Compress|Win32'">5.0</ShaderModel>
|
||||
<ShaderType Condition="'$(Configuration)|$(Platform)'=='Authoring|Win32'">Compute</ShaderType>
|
||||
<ShaderModel Condition="'$(Configuration)|$(Platform)'=='Authoring|Win32'">5.0</ShaderModel>
|
||||
<DisableOptimizations Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</DisableOptimizations>
|
||||
<EnableDebuggingInformation Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</EnableDebuggingInformation>
|
||||
<DisableOptimizations Condition="'$(Configuration)|$(Platform)'=='Compress|Win32'">true</DisableOptimizations>
|
||||
<EnableDebuggingInformation Condition="'$(Configuration)|$(Platform)'=='Compress|Win32'">true</EnableDebuggingInformation>
|
||||
</FxCompile>
|
||||
<FxCompile Include="framework\shaders\paradeVectorscopeSpread.hlsl">
|
||||
<ShaderType Condition="'$(Configuration)|$(Platform)'=='Video|Win32'">Compute</ShaderType>
|
||||
<ShaderModel Condition="'$(Configuration)|$(Platform)'=='Video|Win32'">5.0</ShaderModel>
|
||||
<ShaderType Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">Compute</ShaderType>
|
||||
<ShaderModel Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">5.0</ShaderModel>
|
||||
<ShaderType Condition="'$(Configuration)|$(Platform)'=='ShaderDebug|Win32'">Compute</ShaderType>
|
||||
<ShaderModel Condition="'$(Configuration)|$(Platform)'=='ShaderDebug|Win32'">5.0</ShaderModel>
|
||||
<ShaderType Condition="'$(Configuration)|$(Platform)'=='Compress|Win32'">Compute</ShaderType>
|
||||
<ShaderModel Condition="'$(Configuration)|$(Platform)'=='Compress|Win32'">5.0</ShaderModel>
|
||||
<ShaderType Condition="'$(Configuration)|$(Platform)'=='Authoring|Win32'">Compute</ShaderType>
|
||||
<ShaderModel Condition="'$(Configuration)|$(Platform)'=='Authoring|Win32'">5.0</ShaderModel>
|
||||
<DisableOptimizations Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</DisableOptimizations>
|
||||
<EnableDebuggingInformation Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</EnableDebuggingInformation>
|
||||
<DisableOptimizations Condition="'$(Configuration)|$(Platform)'=='Compress|Win32'">true</DisableOptimizations>
|
||||
<EnableDebuggingInformation Condition="'$(Configuration)|$(Platform)'=='Compress|Win32'">true</EnableDebuggingInformation>
|
||||
</FxCompile>
|
||||
<None Include="shaders\parts\shared.hlsl">
|
||||
<ShaderType Condition="'$(Configuration)|$(Platform)'=='Video|Win32'">Compute</ShaderType>
|
||||
<ShaderModel Condition="'$(Configuration)|$(Platform)'=='Video|Win32'">4.0</ShaderModel>
|
||||
<ShaderType Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">Compute</ShaderType>
|
||||
<ShaderModel Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">4.0</ShaderModel>
|
||||
<ShaderType Condition="'$(Configuration)|$(Platform)'=='ShaderDebug|Win32'">Compute</ShaderType>
|
||||
<ShaderModel Condition="'$(Configuration)|$(Platform)'=='ShaderDebug|Win32'">4.0</ShaderModel>
|
||||
<ShaderType Condition="'$(Configuration)|$(Platform)'=='Compress|Win32'">Compute</ShaderType>
|
||||
<ShaderModel Condition="'$(Configuration)|$(Platform)'=='Compress|Win32'">4.0</ShaderModel>
|
||||
<ShaderType Condition="'$(Configuration)|$(Platform)'=='Authoring|Win32'">Compute</ShaderType>
|
||||
<ShaderModel Condition="'$(Configuration)|$(Platform)'=='Authoring|Win32'">4.0</ShaderModel>
|
||||
<FileType>Document</FileType>
|
||||
</None>
|
||||
<None Include="shaders\parts\part2.hlsl">
|
||||
<ShaderType Condition="'$(Configuration)|$(Platform)'=='Video|Win32'">Compute</ShaderType>
|
||||
<ShaderModel Condition="'$(Configuration)|$(Platform)'=='Video|Win32'">4.0</ShaderModel>
|
||||
<ShaderType Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">Compute</ShaderType>
|
||||
<ShaderModel Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">4.0</ShaderModel>
|
||||
<ShaderType Condition="'$(Configuration)|$(Platform)'=='ShaderDebug|Win32'">Compute</ShaderType>
|
||||
<ShaderModel Condition="'$(Configuration)|$(Platform)'=='ShaderDebug|Win32'">4.0</ShaderModel>
|
||||
<ShaderType Condition="'$(Configuration)|$(Platform)'=='Compress|Win32'">Compute</ShaderType>
|
||||
<ShaderModel Condition="'$(Configuration)|$(Platform)'=='Compress|Win32'">4.0</ShaderModel>
|
||||
<ShaderType Condition="'$(Configuration)|$(Platform)'=='Authoring|Win32'">Compute</ShaderType>
|
||||
<ShaderModel Condition="'$(Configuration)|$(Platform)'=='Authoring|Win32'">4.0</ShaderModel>
|
||||
<FileType>Document</FileType>
|
||||
</None>
|
||||
<None Include="shaders\parts\part1.hlsl">
|
||||
<ShaderType Condition="'$(Configuration)|$(Platform)'=='Video|Win32'">Compute</ShaderType>
|
||||
<ShaderModel Condition="'$(Configuration)|$(Platform)'=='Video|Win32'">4.0</ShaderModel>
|
||||
<ShaderType Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">Compute</ShaderType>
|
||||
<ShaderModel Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">4.0</ShaderModel>
|
||||
<ShaderType Condition="'$(Configuration)|$(Platform)'=='ShaderDebug|Win32'">Compute</ShaderType>
|
||||
<ShaderModel Condition="'$(Configuration)|$(Platform)'=='ShaderDebug|Win32'">4.0</ShaderModel>
|
||||
<ShaderType Condition="'$(Configuration)|$(Platform)'=='Compress|Win32'">Compute</ShaderType>
|
||||
<ShaderModel Condition="'$(Configuration)|$(Platform)'=='Compress|Win32'">4.0</ShaderModel>
|
||||
<ShaderType Condition="'$(Configuration)|$(Platform)'=='Authoring|Win32'">Compute</ShaderType>
|
||||
<ShaderModel Condition="'$(Configuration)|$(Platform)'=='Authoring|Win32'">4.0</ShaderModel>
|
||||
<FileType>Document</FileType>
|
||||
</None>
|
||||
</ItemGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
||||
<ImportGroup Label="ExtensionTargets">
|
||||
</ImportGroup>
|
||||
</Project>
|
||||
139
8kode/src/intro/intro.vcxproj.filters
Normal file
@@ -0,0 +1,139 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<ItemGroup>
|
||||
<Filter Include="Source Files">
|
||||
<UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier>
|
||||
<Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions>
|
||||
</Filter>
|
||||
<Filter Include="Header Files">
|
||||
<UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier>
|
||||
<Extensions>h;hh;hpp;hxx;hm;inl;inc;xsd</Extensions>
|
||||
</Filter>
|
||||
<Filter Include="Resource Files">
|
||||
<UniqueIdentifier>{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}</UniqueIdentifier>
|
||||
<Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms</Extensions>
|
||||
</Filter>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="main.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="framework\sync\data.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="framework\sync\device.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="framework\sync\track.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="framework\sync\usync.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="framework\framework.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="intro\data.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="intro\init.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="intro\functions.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="framework\authoring.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="intro\update.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="framework\directx.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="framework\sound.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="framework\4klang.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="framework\window.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="framework\log.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="intro\intro.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="framework\mutexlock.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="framework\shaders.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="framework\intro_hlsl.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="framework\shaders_shc.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="framework\sync-data.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="framework\sync\base.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="framework\sync\data.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="framework\sync\device.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="framework\sync\sync.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="framework\sync\track.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="framework\sync\usync.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="framework\video.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="framework\4klang.inc">
|
||||
<Filter>Header Files</Filter>
|
||||
</None>
|
||||
<None Include="shaders\lib\fxaa311.hlsl" />
|
||||
<None Include="shaders\lib\lighting.hlsl" />
|
||||
<None Include="shaders\lib\material.hlsl" />
|
||||
<None Include="shaders\lib\ogl2dx.hlsl" />
|
||||
<None Include="shaders\lib\postprocessing.hlsl" />
|
||||
<None Include="shaders\lib\rt.hlsl" />
|
||||
<None Include="shaders\lib\sdf.hlsl" />
|
||||
<None Include="shaders\lib\utils.hlsl" />
|
||||
<None Include="shaders\parts\shared.hlsl" />
|
||||
<None Include="shaders\parts\part2.hlsl" />
|
||||
<None Include="shaders\parts\part1.hlsl" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<CustomBuild Include="framework\4klang.asm">
|
||||
<Filter>Source Files</Filter>
|
||||
</CustomBuild>
|
||||
<CustomBuild Include="shaders\intro.hlsl" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<FxCompile Include="framework\shaders\histogramSpread.hlsl" />
|
||||
<FxCompile Include="framework\shaders\paradeVectorscopeSpread.hlsl" />
|
||||
<FxCompile Include="framework\shaders\histogramMaximum.hlsl" />
|
||||
<FxCompile Include="framework\shaders\paradeVectorscopeMaximum.hlsl" />
|
||||
<FxCompile Include="framework\shaders\paradeVectorscopeGather.hlsl" />
|
||||
<FxCompile Include="framework\shaders\histogramGather.hlsl" />
|
||||
<FxCompile Include="framework\merged.hlsl" />
|
||||
</ItemGroup>
|
||||
</Project>
|
||||
6
8kode/src/intro/intro.vcxproj.user
Normal file
@@ -0,0 +1,6 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="12.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<PropertyGroup>
|
||||
<ShowAllFiles>true</ShowAllFiles>
|
||||
</PropertyGroup>
|
||||
</Project>
|
||||
1
8kode/src/intro/intro/data.h
Normal file
@@ -0,0 +1 @@
|
||||
#pragma once
|
||||
7
8kode/src/intro/intro/init.h
Normal file
@@ -0,0 +1,7 @@
|
||||
#pragma once
|
||||
|
||||
#pragma code_seg(".IntroInit")
|
||||
INLINE void IntroInit()
|
||||
{
|
||||
Log("IntroInit");
|
||||
}
|
||||
7
8kode/src/intro/intro/intro.h
Normal file
@@ -0,0 +1,7 @@
|
||||
#pragma once
|
||||
|
||||
#include "data.h"
|
||||
#include "init.h"
|
||||
#include "update.h"
|
||||
|
||||
// EOF
|
||||
11
8kode/src/intro/intro/update.h
Normal file
@@ -0,0 +1,11 @@
|
||||
#pragma once
|
||||
|
||||
#pragma code_seg(".IntroUpdate")
|
||||
INLINE void IntroUpdate(float _introPosition)
|
||||
{
|
||||
context->CSSetShader(cs_Sample, NULL, 0);
|
||||
context->CSSetUnorderedAccessViews(0, 1, &backBufferUAV, NULL);
|
||||
context->Dispatch(SCREENWIDTH / 16, SCREENHEIGHT / 16, 1);
|
||||
|
||||
swapChain->Present(0, 0);
|
||||
}
|
||||
17
8kode/src/intro/main.cpp
Normal file
@@ -0,0 +1,17 @@
|
||||
#include "framework/framework.h"
|
||||
#include "intro/intro.h"
|
||||
|
||||
int _cdecl main(int argc, char* argv[])
|
||||
{
|
||||
FrameworkInit();
|
||||
|
||||
do
|
||||
{
|
||||
FrameworkUpdate();
|
||||
} while (FrameworkContinueExecuting());
|
||||
|
||||
FrameworkDispose();
|
||||
ExitProcess(0);
|
||||
return 0;
|
||||
}
|
||||
|
||||
11
8kode/src/intro/shaders/intro.hlsl
Normal file
@@ -0,0 +1,11 @@
|
||||
RWTexture2D<float4> o2d0 : register(u0);
|
||||
|
||||
[numthreads(16,16,1)]
|
||||
[entrypoint(cs)]
|
||||
void cs_Sample(int3 id: SV_DispatchThreadID)
|
||||
{
|
||||
float2 s;
|
||||
o2d0.GetDimensions(s.x, s.y);
|
||||
float2 uv = (id.xy + 0.5) / s;
|
||||
o2d0[id.xy] = float4(uv, 0.5, 1.0);
|
||||
}
|
||||
6
8kode/src/shc/App.config
Normal file
@@ -0,0 +1,6 @@
|
||||
<?xml version="1.0" encoding="utf-8" ?>
|
||||
<configuration>
|
||||
<startup>
|
||||
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5" />
|
||||
</startup>
|
||||
</configuration>
|
||||
593
8kode/src/shc/Program.cs
Normal file
@@ -0,0 +1,593 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace shc
|
||||
{
|
||||
class Program
|
||||
{
|
||||
struct EntryPoint
|
||||
{
|
||||
public string TypeName { get; set; }
|
||||
public string Name { get; set; }
|
||||
public string Prefix { get; set; }
|
||||
public string[] Parameters { get; set; }
|
||||
}
|
||||
|
||||
struct ShaderInfo
|
||||
{
|
||||
public ShaderInfo(string pointerType, string prefix, string createFunction)
|
||||
: this()
|
||||
{
|
||||
PointerType = pointerType;
|
||||
Prefix = prefix;
|
||||
CreateFunction = createFunction;
|
||||
}
|
||||
|
||||
public string PointerType { get; set; }
|
||||
public string Prefix { get; set; }
|
||||
public string CreateFunction { get; set; }
|
||||
}
|
||||
|
||||
static int Main(string[] args)
|
||||
{
|
||||
Console.WriteLine("shc " + string.Join(" ", args.Select(arg => "\"" + arg + "\"")));
|
||||
|
||||
if (args.Length != 4)
|
||||
{
|
||||
Console.WriteLine("Usage: shc $(HlslInputPath) $(MinifiedHeaderPath) $(ShaderHeaderPath) $(MergedHlslOutputPath) ");
|
||||
return -1;
|
||||
}
|
||||
|
||||
var path = Path.GetFullPath(args[0]);
|
||||
if (!File.Exists(args[0]))
|
||||
{
|
||||
Console.WriteLine("ERROR: " + args[0] + " does not exist!");
|
||||
return -2;
|
||||
}
|
||||
|
||||
var resultLines = new List<string>();
|
||||
var entryPoints = new List<EntryPoint>();
|
||||
string mergedPath = args[3];
|
||||
try
|
||||
{
|
||||
var lines = GetCombinedLinesFromIncludes(path, resultLines, entryPoints);
|
||||
lines.Add(string.Empty);
|
||||
File.WriteAllText(mergedPath, string.Join("\n", lines));
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
Console.WriteLine("ERROR: While loading " + path + ": " + e.Message);
|
||||
return -3;
|
||||
}
|
||||
|
||||
var outputPath = Path.GetFullPath(args[1]);
|
||||
if (File.Exists(outputPath))
|
||||
{
|
||||
File.Delete(outputPath);
|
||||
}
|
||||
|
||||
var toolsLocation = Path.Combine(Path.GetDirectoryName(System.Reflection.Assembly.GetEntryAssembly().Location), "..\\tools");
|
||||
try
|
||||
{
|
||||
string arguments = "--hlsl -v -o " + outputPath + " ";
|
||||
if (entryPoints.Count > 0)
|
||||
{
|
||||
arguments += "--no-renaming-list " + string.Join(",", entryPoints.Select(kvp => kvp.Name)) + " ";
|
||||
}
|
||||
arguments += mergedPath;
|
||||
|
||||
Process myProcess = new Process();
|
||||
ProcessStartInfo myProcessStartInfo = new ProcessStartInfo(Path.Combine(toolsLocation, "shader_minifier.exe"), arguments);
|
||||
myProcessStartInfo.UseShellExecute = false;
|
||||
myProcessStartInfo.RedirectStandardOutput = true;
|
||||
myProcess.StartInfo = myProcessStartInfo;
|
||||
myProcess.Start();
|
||||
StreamReader myStreamReader = myProcess.StandardOutput;
|
||||
var output = myStreamReader.ReadToEnd();
|
||||
Console.WriteLine(output);
|
||||
myProcess.WaitForExit();
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
Console.WriteLine("ERROR: While running shader minifier: " + e.Message);
|
||||
return -4;
|
||||
}
|
||||
|
||||
if (!File.Exists(outputPath))
|
||||
{
|
||||
return -5;
|
||||
}
|
||||
|
||||
var outputLines = File.ReadAllLines(outputPath).ToArray();
|
||||
for (int i = 0; i < outputLines.Length; ++i)
|
||||
{
|
||||
if (outputLines[i].Trim() == "char merged_hlsl[] =")
|
||||
{
|
||||
outputLines[i] = "char merged_hlsl[] = \"#define _ [numthreads(16,16,1)]\\n\"";
|
||||
}
|
||||
else if (outputLines[i].Trim() == "\"[numthreads(16,16,1)]\"")
|
||||
{
|
||||
outputLines[i] = " \"_ \"";
|
||||
}
|
||||
}
|
||||
File.WriteAllLines(outputPath, outputLines);
|
||||
|
||||
try
|
||||
{
|
||||
var headerPath = Path.GetFullPath(args[2]);
|
||||
using (var stream = new FileStream(headerPath, FileMode.Create, FileAccess.Write))
|
||||
{
|
||||
using (var writer = new StreamWriter(stream))
|
||||
{
|
||||
if (entryPoints.Count > 0)
|
||||
{
|
||||
writer.WriteLine("#pragma once");
|
||||
writer.WriteLine("// WARNING: This file is autogenerated by shc. Do not edit");
|
||||
writer.WriteLine();
|
||||
writer.WriteLine("#pragma data_seg(\".cs_5_0\")");
|
||||
writer.WriteLine("static char cs_5_0[] = \"cs_5_0\";");
|
||||
writer.WriteLine();
|
||||
writer.WriteLine("#pragma data_seg(\".vs_5_0\")");
|
||||
writer.WriteLine("static char vs_5_0[] = \"vs_5_0\";");
|
||||
writer.WriteLine();
|
||||
writer.WriteLine("#pragma data_seg(\".gs_5_0\")");
|
||||
writer.WriteLine("static char gs_5_0[] = \"gs_5_0\";");
|
||||
writer.WriteLine();
|
||||
writer.WriteLine("#pragma data_seg(\".ds_5_0\")");
|
||||
writer.WriteLine("static char ds_5_0[] = \"ds_5_0\";");
|
||||
writer.WriteLine();
|
||||
writer.WriteLine("#pragma data_seg(\".hs_5_0\")");
|
||||
writer.WriteLine("static char hs_5_0[] = \"hs_5_0\";");
|
||||
writer.WriteLine();
|
||||
writer.WriteLine("#pragma data_seg(\".ps_5_0\")");
|
||||
writer.WriteLine("static char ps_5_0[] = \"ps_5_0\";");
|
||||
writer.WriteLine();
|
||||
writer.WriteLine("#pragma bss_seg(\".shaderbss\")");
|
||||
foreach (var entryPoint in entryPoints)
|
||||
{
|
||||
if (entryPoint.TypeName == "hc")
|
||||
continue;
|
||||
|
||||
foreach (var shaderInfo in GetShaderInfo(entryPoint.TypeName))
|
||||
{
|
||||
writer.WriteLine("static " + shaderInfo.PointerType + "* " + shaderInfo.Prefix + entryPoint.Name + ";");
|
||||
}
|
||||
}
|
||||
|
||||
foreach (var entryPoint in entryPoints)
|
||||
{
|
||||
if (entryPoint.TypeName == "hc")
|
||||
continue;
|
||||
|
||||
if (entryPoint.TypeName == "gs_so" || entryPoint.TypeName == "vs_gs_so")
|
||||
{
|
||||
writer.WriteLine();
|
||||
writer.WriteLine("#pragma data_seg(\"." + entryPoint.Name + "SODeclarations\")");
|
||||
writer.WriteLine("extern D3D11_SO_DECLARATION_ENTRY " + entryPoint.Name + "SODeclarations[" + entryPoint.Parameters[0] + "];");
|
||||
writer.WriteLine();
|
||||
writer.WriteLine("#pragma data_seg(\"." + entryPoint.Name + "Strides\")");
|
||||
writer.WriteLine("extern UINT " + entryPoint.Name + "Strides[" + entryPoint.Parameters[1] + "];");
|
||||
}
|
||||
|
||||
if (entryPoint.TypeName == "vs_il")
|
||||
{
|
||||
writer.WriteLine();
|
||||
writer.WriteLine("#pragma data_seg(\"." + entryPoint.Name + "InputLayoutDesc\")");
|
||||
writer.WriteLine("extern D3D11_INPUT_ELEMENT_DESC " + entryPoint.Name + "InputLayoutDesc[" + entryPoint.Parameters[0] + "];");
|
||||
}
|
||||
}
|
||||
|
||||
writer.WriteLine();
|
||||
writer.WriteLine("#pragma code_seg(\".FrameworkShadersCompile\")");
|
||||
writer.WriteLine("INLINE void FrameworkShadersCompile()");
|
||||
writer.WriteLine("{");
|
||||
foreach (var entryPoint in entryPoints)
|
||||
{
|
||||
if (entryPoint.TypeName == "hc")
|
||||
continue;
|
||||
|
||||
writer.WriteLine("\tCompileShader(\"" + entryPoint.Name + "\", " + entryPoint.Prefix + "_5_0);");
|
||||
foreach (var shaderInfo in GetShaderInfo(entryPoint.TypeName))
|
||||
{
|
||||
if (shaderInfo.CreateFunction == "CreateGeometryShaderWithStreamOutput")
|
||||
{
|
||||
var parameters = string.Join(", ", entryPoint.Parameters);
|
||||
writer.WriteLine("\tdevice->CreateGeometryShaderWithStreamOutput(shaderCode, shaderSize, " + entryPoint.Name + "SODeclarations, " + entryPoint.Parameters[0] + ", " + entryPoint.Name + "Strides, " + entryPoint.Parameters[1] + ", D3D11_SO_NO_RASTERIZED_STREAM, NULL, &" + shaderInfo.Prefix + entryPoint.Name + ");");
|
||||
}
|
||||
else if (shaderInfo.CreateFunction == "CreateInputLayout")
|
||||
{
|
||||
var parameters = string.Join(", ", entryPoint.Parameters);
|
||||
writer.WriteLine("\tdevice->CreateInputLayout(" + entryPoint.Name + "InputLayoutDesc, " + entryPoint.Parameters[0] + ", shaderCode, shaderSize, &" + shaderInfo.Prefix + entryPoint.Name + ");");
|
||||
}
|
||||
else
|
||||
{
|
||||
writer.WriteLine("\tdevice->" + shaderInfo.CreateFunction + "(shaderCode, shaderSize, NULL, &" + shaderInfo.Prefix + entryPoint.Name + ");");
|
||||
}
|
||||
}
|
||||
}
|
||||
writer.WriteLine("}");
|
||||
writer.WriteLine();
|
||||
}
|
||||
|
||||
int iSize = 0;
|
||||
foreach (var line in s_SyncStructLines)
|
||||
{
|
||||
var tokens = line.Split(' ', '\t', ';').Select(t => t.Trim()).Where(t => !string.IsNullOrEmpty(t)).ToList();
|
||||
if (tokens[0] == "struct")
|
||||
{
|
||||
s_SyncStructName = tokens[1];
|
||||
writer.WriteLine(line);
|
||||
continue;
|
||||
}
|
||||
|
||||
int typeIndex = Math.Max(Math.Max(Math.Max(tokens.IndexOf("float"), tokens.IndexOf("float2")), tokens.IndexOf("float3")), tokens.IndexOf("float4"));
|
||||
if (typeIndex != -1)
|
||||
{
|
||||
switch (tokens[typeIndex])
|
||||
{
|
||||
case "float":
|
||||
{
|
||||
RecordSyncVariable(1, tokens[typeIndex + 1]);
|
||||
iSize += 4;
|
||||
break;
|
||||
}
|
||||
case "float2":
|
||||
{
|
||||
RecordSyncVariable(2, tokens[typeIndex + 1]);
|
||||
iSize += 8;
|
||||
break;
|
||||
}
|
||||
case "float3":
|
||||
{
|
||||
RecordSyncVariable(3, tokens[typeIndex + 1]);
|
||||
iSize += 12;
|
||||
break;
|
||||
}
|
||||
case "float4":
|
||||
{
|
||||
RecordSyncVariable(4, tokens[typeIndex + 1]);
|
||||
iSize += 16;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (line.Trim()[0] == '}')
|
||||
{
|
||||
if (iSize % 16 != 0)
|
||||
iSize += 16 - (iSize % 16);
|
||||
|
||||
foreach (var syncVar in s_SyncVariables)
|
||||
{
|
||||
switch (syncVar.Item1)
|
||||
{
|
||||
case 1:
|
||||
writer.WriteLine("\tfloat " + syncVar.Item2 + ";");
|
||||
iSize -= 4;
|
||||
break;
|
||||
case 2:
|
||||
writer.WriteLine("\tfloat " + syncVar.Item2 + "_x;");
|
||||
writer.WriteLine("\tfloat " + syncVar.Item2 + "_y;");
|
||||
iSize -= 8;
|
||||
break;
|
||||
case 3:
|
||||
writer.WriteLine("\tfloat " + syncVar.Item2 + "_x;");
|
||||
writer.WriteLine("\tfloat " + syncVar.Item2 + "_y;");
|
||||
writer.WriteLine("\tfloat " + syncVar.Item2 + "_z;");
|
||||
iSize -= 12;
|
||||
break;
|
||||
case 4:
|
||||
writer.WriteLine("\tfloat " + syncVar.Item2 + "_x;");
|
||||
writer.WriteLine("\tfloat " + syncVar.Item2 + "_y;");
|
||||
writer.WriteLine("\tfloat " + syncVar.Item2 + "_z;");
|
||||
writer.WriteLine("\tfloat " + syncVar.Item2 + "_w;");
|
||||
iSize -= 16;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
int iDummyIndex = 1;
|
||||
|
||||
while (iSize > 0)
|
||||
{
|
||||
writer.WriteLine("\tfloat dummy_" + iDummyIndex++ + ";");
|
||||
iSize -= 4;
|
||||
}
|
||||
writer.WriteLine(line);
|
||||
}
|
||||
else
|
||||
{
|
||||
writer.WriteLine(line);
|
||||
}
|
||||
}
|
||||
|
||||
if (s_SyncStructLines.Count > 0)
|
||||
{
|
||||
writer.WriteLine();
|
||||
writer.WriteLine("#define SYNC_TYPE_NAME " + s_SyncStructName);
|
||||
writer.WriteLine("#define SYNC_VAR_NAME s_" + s_SyncStructName);
|
||||
writer.WriteLine();
|
||||
writer.WriteLine("#pragma bss_seg(\".syncbss\")");
|
||||
writer.WriteLine("static SYNC_TYPE_NAME SYNC_VAR_NAME;");
|
||||
writer.WriteLine();
|
||||
writer.WriteLine("#pragma code_seg(\".SyncInit\")");
|
||||
writer.WriteLine("INLINE void SyncInit()");
|
||||
writer.WriteLine("{");
|
||||
writer.WriteLine("\tif (usync_init() < 0)");
|
||||
writer.WriteLine("\t\treturn;");
|
||||
writer.WriteLine();
|
||||
writer.WriteLine("#ifndef SYNC_PLAYER");
|
||||
foreach (var syncVar in s_SyncVariables)
|
||||
{
|
||||
if (syncVar.Item2.StartsWith("dummy"))
|
||||
continue;
|
||||
|
||||
switch (syncVar.Item1)
|
||||
{
|
||||
case 1:
|
||||
writer.WriteLine("\tusync_get_val(" + syncVar.Item2 + ");");
|
||||
break;
|
||||
case 2:
|
||||
writer.WriteLine("\tusync_get_val(" + syncVar.Item2 + "_x);");
|
||||
writer.WriteLine("\tusync_get_val(" + syncVar.Item2 + "_y);");
|
||||
break;
|
||||
case 3:
|
||||
writer.WriteLine("\tusync_get_val(" + syncVar.Item2 + "_x);");
|
||||
writer.WriteLine("\tusync_get_val(" + syncVar.Item2 + "_y);");
|
||||
writer.WriteLine("\tusync_get_val(" + syncVar.Item2 + "_z);");
|
||||
break;
|
||||
case 4:
|
||||
writer.WriteLine("\tusync_get_val(" + syncVar.Item2 + "_x);");
|
||||
writer.WriteLine("\tusync_get_val(" + syncVar.Item2 + "_y);");
|
||||
writer.WriteLine("\tusync_get_val(" + syncVar.Item2 + "_z);");
|
||||
writer.WriteLine("\tusync_get_val(" + syncVar.Item2 + "_w);");
|
||||
break;
|
||||
}
|
||||
}
|
||||
writer.WriteLine("\tusync_update(0.0f, NULL);");
|
||||
writer.WriteLine("#endif");
|
||||
writer.WriteLine("}");
|
||||
writer.WriteLine();
|
||||
writer.WriteLine("INLINE void SyncUpdate(float t)");
|
||||
writer.WriteLine("{");
|
||||
writer.WriteLine("#ifndef SYNC_PLAYER");
|
||||
writer.WriteLine("\tusync_update(t * SYNC_ROWS_PER_SCENE, NULL);");
|
||||
foreach (var syncVar in s_SyncVariables)
|
||||
{
|
||||
if (syncVar.Item2.StartsWith("dummy"))
|
||||
continue;
|
||||
|
||||
switch (syncVar.Item1)
|
||||
{
|
||||
case 1:
|
||||
writer.WriteLine("\tSYNC_VAR_NAME." + syncVar.Item2 + " = usync_get_val(" + syncVar.Item2 + ");");
|
||||
break;
|
||||
case 2:
|
||||
writer.WriteLine("\tSYNC_VAR_NAME." + syncVar.Item2 + "_x = usync_get_val(" + syncVar.Item2 + "_x);");
|
||||
writer.WriteLine("\tSYNC_VAR_NAME." + syncVar.Item2 + "_y = usync_get_val(" + syncVar.Item2 + "_y);");
|
||||
break;
|
||||
case 3:
|
||||
writer.WriteLine("\tSYNC_VAR_NAME." + syncVar.Item2 + "_x = usync_get_val(" + syncVar.Item2 + "_x);");
|
||||
writer.WriteLine("\tSYNC_VAR_NAME." + syncVar.Item2 + "_y = usync_get_val(" + syncVar.Item2 + "_y);");
|
||||
writer.WriteLine("\tSYNC_VAR_NAME." + syncVar.Item2 + "_z = usync_get_val(" + syncVar.Item2 + "_z);");
|
||||
break;
|
||||
case 4:
|
||||
writer.WriteLine("\tSYNC_VAR_NAME." + syncVar.Item2 + "_x = usync_get_val(" + syncVar.Item2 + "_x);");
|
||||
writer.WriteLine("\tSYNC_VAR_NAME." + syncVar.Item2 + "_y = usync_get_val(" + syncVar.Item2 + "_y);");
|
||||
writer.WriteLine("\tSYNC_VAR_NAME." + syncVar.Item2 + "_z = usync_get_val(" + syncVar.Item2 + "_z);");
|
||||
writer.WriteLine("\tSYNC_VAR_NAME." + syncVar.Item2 + "_w = usync_get_val(" + syncVar.Item2 + "_w);");
|
||||
break;
|
||||
}
|
||||
}
|
||||
writer.WriteLine("#else");
|
||||
writer.WriteLine("\tusync_update(t * SYNC_ROWS_PER_SCENE, (float*)&SYNC_VAR_NAME);");
|
||||
writer.WriteLine("#endif");
|
||||
writer.WriteLine("}");
|
||||
writer.WriteLine();
|
||||
}
|
||||
else
|
||||
{
|
||||
writer.WriteLine();
|
||||
writer.WriteLine("#define SyncInit()");
|
||||
writer.WriteLine("#define SyncUpdate(t)");
|
||||
}
|
||||
writer.Flush();
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
Console.WriteLine("ERROR: While generating shc output: " + e.Message);
|
||||
return -6;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
private static void RecordSyncVariable(int _iSize, string _sSyncVarName)
|
||||
{
|
||||
s_SyncVariables.Add(new Tuple<int, string>(_iSize, _sSyncVarName));
|
||||
}
|
||||
|
||||
private static IEnumerable<ShaderInfo> GetShaderInfo(string p)
|
||||
{
|
||||
if (p == "cs")
|
||||
yield return new ShaderInfo("ID3D11ComputeShader", "", "CreateComputeShader");
|
||||
else if (p == "vs")
|
||||
yield return new ShaderInfo("ID3D11VertexShader", "", "CreateVertexShader");
|
||||
else if (p == "vs_il")
|
||||
{
|
||||
yield return new ShaderInfo("ID3D11VertexShader", "vs_", "CreateVertexShader");
|
||||
yield return new ShaderInfo("ID3D11InputLayout", "il_", "CreateInputLayout");
|
||||
}
|
||||
else if (p == "ds")
|
||||
yield return new ShaderInfo("ID3D11DomainShader", "", "CreateDomainShader");
|
||||
else if (p == "hs")
|
||||
yield return new ShaderInfo("ID3D11HullShader", "", "CreateHullShader");
|
||||
else if (p == "gs")
|
||||
yield return new ShaderInfo("ID3D11GeometryShader", "", "CreateGeometryShader");
|
||||
else if (p == "ps")
|
||||
yield return new ShaderInfo("ID3D11PixelShader", "", "CreatePixelShader");
|
||||
else if (p == "gs_so")
|
||||
yield return new ShaderInfo("ID3D11GeometryShader", "", "CreateGeometryShaderWithStreamOutput");
|
||||
else if (p == "vs_gs_so")
|
||||
{
|
||||
yield return new ShaderInfo("ID3D11VertexShader", "vs_", "CreateVertexShader");
|
||||
yield return new ShaderInfo("ID3D11GeometryShader", "gs_", "CreateGeometryShaderWithStreamOutput");
|
||||
}
|
||||
}
|
||||
|
||||
private static List<string> GetCombinedLinesFromIncludes(string path, List<string> resultLines, List<EntryPoint> entryPoints)
|
||||
{
|
||||
var loadedPaths = new List<string>();
|
||||
AggregateLines(path, resultLines, entryPoints, loadedPaths);
|
||||
return resultLines;
|
||||
}
|
||||
|
||||
private static void AggregateLines(string path, List<string> resultLines, List<EntryPoint> entryPoints, List<string> loadedPaths)
|
||||
{
|
||||
if (loadedPaths.Contains(path))
|
||||
return;
|
||||
|
||||
loadedPaths.Add(path);
|
||||
var basePath = Path.GetDirectoryName(path);
|
||||
var lines = File.ReadAllLines(path);
|
||||
string sEntryPointType = null;
|
||||
string[] entryPointParameters = null;
|
||||
int lineNumber = 1;
|
||||
var enumerator = lines.GetEnumerator();
|
||||
while (enumerator.MoveNext())
|
||||
{
|
||||
var line = (string)enumerator.Current;
|
||||
if (line.StartsWith("#include"))
|
||||
{
|
||||
var includeFile = line.Substring(8).Trim().Split('"')[1];
|
||||
var includePath = Path.GetFullPath(Path.Combine(basePath, includeFile));
|
||||
AggregateLines(includePath, resultLines, entryPoints, loadedPaths);
|
||||
}
|
||||
else if (line.Trim().StartsWith("[entrypoint"))
|
||||
{
|
||||
sEntryPointType = line.Trim().Substring(11).Trim();
|
||||
if (sEntryPointType.StartsWith("("))
|
||||
{
|
||||
entryPointParameters = sEntryPointType.Substring(1, sEntryPointType.Length - 2).Trim().Split(',', ')').Skip(1).ToArray();
|
||||
entryPointParameters = entryPointParameters.Take(entryPointParameters.Length - 1).Select(p => p.Trim()).ToArray();
|
||||
sEntryPointType = sEntryPointType.Substring(1).Split(',', ')')[0];
|
||||
}
|
||||
else
|
||||
{
|
||||
sEntryPointType = "unknown";
|
||||
}
|
||||
|
||||
if (sEntryPointType == "vs_gs_so" || sEntryPointType == "gs_so")
|
||||
{
|
||||
if (entryPointParameters.Length != 2)
|
||||
{
|
||||
throw new Exception("An entry point of type " + sEntryPointType + " needs 2 parameters: (StreamOutputDeclaration count, Stride count)");
|
||||
}
|
||||
}
|
||||
else if (sEntryPointType == "vs_il")
|
||||
{
|
||||
if (entryPointParameters.Length != 1)
|
||||
{
|
||||
throw new Exception("An entry point of type " + sEntryPointType + " needs 1 parameter: (InputElementDesc count)");
|
||||
}
|
||||
}
|
||||
else if (entryPointParameters != null && entryPointParameters.Length != 0)
|
||||
{
|
||||
throw new Exception("An entry point of type " + sEntryPointType + " needs no parameters");
|
||||
}
|
||||
|
||||
resultLines.Add(GetComment(path, lineNumber));
|
||||
}
|
||||
else if (line.Trim().StartsWith("[patchconstantfunc"))
|
||||
{
|
||||
var sEntryPointName = line.Trim().Substring(18).Trim();
|
||||
if (sEntryPointName.StartsWith("("))
|
||||
{
|
||||
sEntryPointName = sEntryPointName.Substring(2).Split('\"', ')')[0];
|
||||
}
|
||||
entryPoints.Add(new EntryPoint() { TypeName = "hc", Name = sEntryPointName });
|
||||
resultLines.Add(line + GetComment(path, lineNumber));
|
||||
}
|
||||
else if (line.Trim() == "[syncstruct]")
|
||||
{
|
||||
int iBracketCount = 0;
|
||||
bool bStructStarted = false;
|
||||
bool bStructFound = false;
|
||||
while (enumerator.MoveNext())
|
||||
{
|
||||
line = (string)enumerator.Current;
|
||||
if (line.Contains('{'))
|
||||
{
|
||||
++iBracketCount;
|
||||
bStructStarted = true;
|
||||
}
|
||||
if (line.Contains('}'))
|
||||
{
|
||||
--iBracketCount;
|
||||
}
|
||||
|
||||
resultLines.Add(line + GetComment(path, lineNumber));
|
||||
s_SyncStructLines.Add(line);
|
||||
++lineNumber;
|
||||
|
||||
if (bStructStarted && iBracketCount == 0)
|
||||
{
|
||||
bStructFound = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (!bStructFound)
|
||||
{
|
||||
throw new Exception("[syncstruct] may only be used before a struct");
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (sEntryPointType != null)
|
||||
{
|
||||
var tempLine = line.Trim();
|
||||
while (tempLine.StartsWith("["))
|
||||
{
|
||||
var idx = tempLine.IndexOf("]");
|
||||
tempLine = tempLine.Substring(idx + 1).Trim();
|
||||
}
|
||||
var functionName = tempLine.Split(' ')[1].Split('(')[0];
|
||||
entryPoints.Add(new EntryPoint() { TypeName = sEntryPointType.ToLower(), Name = functionName, Prefix = sEntryPointType.ToLower().Substring(0, 2), Parameters = entryPointParameters });
|
||||
sEntryPointType = null;
|
||||
}
|
||||
|
||||
var resultLine = line;
|
||||
var commentIndex = line.IndexOf("//");
|
||||
if (commentIndex != -1)
|
||||
resultLine = resultLine.Substring(0, commentIndex);
|
||||
|
||||
if (line.StartsWith("#"))
|
||||
{
|
||||
resultLines.Add(resultLine);
|
||||
}
|
||||
else
|
||||
{
|
||||
resultLines.Add(resultLine + GetComment(path, lineNumber));
|
||||
}
|
||||
}
|
||||
|
||||
++lineNumber;
|
||||
}
|
||||
}
|
||||
|
||||
private static string GetComment(string path, int lineNumber)
|
||||
{
|
||||
return " /*(" + path + "|" + lineNumber + ")*/";
|
||||
}
|
||||
|
||||
private static List<string> s_SyncStructLines = new List<string>();
|
||||
private static List<Tuple<int, string>> s_SyncVariables = new List<Tuple<int, string>>();
|
||||
private static string s_SyncStructName;
|
||||
}
|
||||
}
|
||||
36
8kode/src/shc/Properties/AssemblyInfo.cs
Normal file
@@ -0,0 +1,36 @@
|
||||
using System.Reflection;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
// General Information about an assembly is controlled through the following
|
||||
// set of attributes. Change these attribute values to modify the information
|
||||
// associated with an assembly.
|
||||
[assembly: AssemblyTitle("shc")]
|
||||
[assembly: AssemblyDescription("")]
|
||||
[assembly: AssemblyConfiguration("")]
|
||||
[assembly: AssemblyCompany("")]
|
||||
[assembly: AssemblyProduct("shc")]
|
||||
[assembly: AssemblyCopyright("Copyright © 2014")]
|
||||
[assembly: AssemblyTrademark("")]
|
||||
[assembly: AssemblyCulture("")]
|
||||
|
||||
// Setting ComVisible to false makes the types in this assembly not visible
|
||||
// to COM components. If you need to access a type in this assembly from
|
||||
// COM, set the ComVisible attribute to true on that type.
|
||||
[assembly: ComVisible(false)]
|
||||
|
||||
// The following GUID is for the ID of the typelib if this project is exposed to COM
|
||||
[assembly: Guid("8e619b64-e97a-4b10-8e79-96582ebfe084")]
|
||||
|
||||
// Version information for an assembly consists of the following four values:
|
||||
//
|
||||
// Major Version
|
||||
// Minor Version
|
||||
// Build Number
|
||||
// Revision
|
||||
//
|
||||
// You can specify all the values or you can default the Build and Revision Numbers
|
||||
// by using the '*' as shown below:
|
||||
// [assembly: AssemblyVersion("1.0.*")]
|
||||
[assembly: AssemblyVersion("1.0.0.0")]
|
||||
[assembly: AssemblyFileVersion("1.0.0.0")]
|
||||
6
8kode/src/shc/bin/Debug/shc.exe.config
Normal file
@@ -0,0 +1,6 @@
|
||||
<?xml version="1.0" encoding="utf-8" ?>
|
||||
<configuration>
|
||||
<startup>
|
||||
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5" />
|
||||
</startup>
|
||||
</configuration>
|
||||
6
8kode/src/shc/bin/Debug/shc.vshost.exe.config
Normal file
@@ -0,0 +1,6 @@
|
||||
<?xml version="1.0" encoding="utf-8" ?>
|
||||
<configuration>
|
||||
<startup>
|
||||
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5" />
|
||||
</startup>
|
||||
</configuration>
|
||||
BIN
8kode/src/shc/bin/Release/shc.exe
Normal file
6
8kode/src/shc/bin/Release/shc.exe.config
Normal file
@@ -0,0 +1,6 @@
|
||||
<?xml version="1.0" encoding="utf-8" ?>
|
||||
<configuration>
|
||||
<startup>
|
||||
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5" />
|
||||
</startup>
|
||||
</configuration>
|
||||
BIN
8kode/src/shc/bin/Release/shc.pdb
Normal file
BIN
8kode/src/shc/bin/Release/shc.vshost.exe
Normal file
6
8kode/src/shc/bin/Release/shc.vshost.exe.config
Normal file
@@ -0,0 +1,6 @@
|
||||
<?xml version="1.0" encoding="utf-8" ?>
|
||||
<configuration>
|
||||
<startup>
|
||||
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5" />
|
||||
</startup>
|
||||
</configuration>
|
||||
11
8kode/src/shc/bin/Release/shc.vshost.exe.manifest
Normal file
@@ -0,0 +1,11 @@
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
|
||||
<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0">
|
||||
<assemblyIdentity version="1.0.0.0" name="MyApplication.app"/>
|
||||
<trustInfo xmlns="urn:schemas-microsoft-com:asm.v2">
|
||||
<security>
|
||||
<requestedPrivileges xmlns="urn:schemas-microsoft-com:asm.v3">
|
||||
<requestedExecutionLevel level="asInvoker" uiAccess="false"/>
|
||||
</requestedPrivileges>
|
||||
</security>
|
||||
</trustInfo>
|
||||
</assembly>
|
||||
6
8kode/src/shc/bin/shc.exe.config
Normal file
@@ -0,0 +1,6 @@
|
||||
<?xml version="1.0" encoding="utf-8" ?>
|
||||
<configuration>
|
||||
<startup>
|
||||
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5" />
|
||||
</startup>
|
||||
</configuration>
|
||||
6
8kode/src/shc/bin/shc.vshost.exe.config
Normal file
@@ -0,0 +1,6 @@
|
||||
<?xml version="1.0" encoding="utf-8" ?>
|
||||
<configuration>
|
||||
<startup>
|
||||
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5" />
|
||||
</startup>
|
||||
</configuration>
|
||||
18
8kode/src/shc/obj/Debug/shc.csproj.FileListAbsolute.txt
Normal file
@@ -0,0 +1,18 @@
|
||||
E:\blu-flame.org\hgplus\author\src\shc\bin\Debug\shc.exe.config
|
||||
E:\blu-flame.org\hgplus\author\src\shc\bin\shc.exe.config
|
||||
E:\blu-flame.org\hgplus\author\bin\shc.exe.config
|
||||
E:\blu-flame.org\hgplus\author\bin\shc.exe
|
||||
E:\blu-flame.org\hgplus\author\bin\shc.pdb
|
||||
E:\blu-flame.org\hgplus\author\src\shc\obj\Debug\shc.exe
|
||||
E:\blu-flame.org\hgplus\author\src\shc\obj\Debug\shc.pdb
|
||||
E:\blu-flame.org\hgplus\author\src\shc\obj\Debug\shc.csprojResolveAssemblyReference.cache
|
||||
E:\alcatraz\8kode\bin\shc.exe.config
|
||||
E:\alcatraz\8kode\bin\shc.exe
|
||||
E:\alcatraz\8kode\bin\shc.pdb
|
||||
E:\alcatraz\8kode\src\shc\obj\Debug\shc.exe
|
||||
E:\alcatraz\8kode\src\shc\obj\Debug\shc.pdb
|
||||
E:\blu-flame.org\8kode\bin\shc.exe.config
|
||||
E:\blu-flame.org\8kode\bin\shc.exe
|
||||
E:\blu-flame.org\8kode\bin\shc.pdb
|
||||
E:\blu-flame.org\8kode\src\shc\obj\Debug\shc.exe
|
||||
E:\blu-flame.org\8kode\src\shc\obj\Debug\shc.pdb
|
||||
BIN
8kode/src/shc/obj/Debug/shc.exe
Normal file
BIN
8kode/src/shc/obj/Debug/shc.pdb
Normal file
@@ -0,0 +1,6 @@
|
||||
E:\blu-flame.org\hgplus\author\src\shc\bin\Release\shc.exe.config
|
||||
E:\blu-flame.org\hgplus\author\src\shc\bin\Release\shc.exe
|
||||
E:\blu-flame.org\hgplus\author\src\shc\bin\Release\shc.pdb
|
||||
E:\blu-flame.org\hgplus\author\src\shc\obj\Release\shc.csprojResolveAssemblyReference.cache
|
||||
E:\blu-flame.org\hgplus\author\src\shc\obj\Release\shc.exe
|
||||
E:\blu-flame.org\hgplus\author\src\shc\obj\Release\shc.pdb
|
||||
BIN
8kode/src/shc/obj/Release/shc.exe
Normal file
BIN
8kode/src/shc/obj/Release/shc.pdb
Normal file
50
8kode/src/shc/shc.csproj
Normal file
@@ -0,0 +1,50 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
|
||||
<PropertyGroup>
|
||||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
|
||||
<ProjectGuid>{930621BA-75BE-49FE-80DE-E75E7DC06931}</ProjectGuid>
|
||||
<OutputType>Exe</OutputType>
|
||||
<AppDesignerFolder>Properties</AppDesignerFolder>
|
||||
<RootNamespace>shc</RootNamespace>
|
||||
<AssemblyName>shc</AssemblyName>
|
||||
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
|
||||
<FileAlignment>512</FileAlignment>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||
<PlatformTarget>AnyCPU</PlatformTarget>
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
<DebugType>full</DebugType>
|
||||
<Optimize>false</Optimize>
|
||||
<OutputPath>..\..\bin\</OutputPath>
|
||||
<DefineConstants>DEBUG;TRACE</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
<UseVSHostingProcess>false</UseVSHostingProcess>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="System" />
|
||||
<Reference Include="System.Core" />
|
||||
<Reference Include="System.Xml.Linq" />
|
||||
<Reference Include="System.Data.DataSetExtensions" />
|
||||
<Reference Include="Microsoft.CSharp" />
|
||||
<Reference Include="System.Data" />
|
||||
<Reference Include="System.Xml" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="Program.cs" />
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="App.config" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
|
||||
Other similar extension points exist, see Microsoft.Common.targets.
|
||||
<Target Name="BeforeBuild">
|
||||
</Target>
|
||||
<Target Name="AfterBuild">
|
||||
</Target>
|
||||
-->
|
||||
</Project>
|
||||
7
8kode/src/shc/shc.csproj.user
Normal file
@@ -0,0 +1,7 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="12.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|AnyCPU'">
|
||||
<StartArguments>shaders\intro.hlsl framework\intro_hlsl.h framework\shaders_shc.h framework\merged.hlsl</StartArguments>
|
||||
<StartWorkingDirectory>E:\alcatraz\revision15-8k\src\intro</StartWorkingDirectory>
|
||||
</PropertyGroup>
|
||||
</Project>
|
||||
18
8kode/src/tool/App.config
Normal file
@@ -0,0 +1,18 @@
|
||||
<?xml version="1.0" encoding="utf-8" ?>
|
||||
<configuration>
|
||||
<configSections>
|
||||
<sectionGroup name="userSettings" type="System.Configuration.UserSettingsGroup, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" >
|
||||
<section name="tool.Properties.Settings" type="System.Configuration.ClientSettingsSection, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" allowExeDefinition="MachineToLocalUser" requirePermission="false" />
|
||||
</sectionGroup>
|
||||
</configSections>
|
||||
<startup>
|
||||
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5" />
|
||||
</startup>
|
||||
<userSettings>
|
||||
<tool.Properties.Settings>
|
||||
<setting name="LastLayout" serializeAs="String">
|
||||
<value />
|
||||
</setting>
|
||||
</tool.Properties.Settings>
|
||||
</userSettings>
|
||||
</configuration>
|
||||
13
8kode/src/tool/App.xaml
Normal file
@@ -0,0 +1,13 @@
|
||||
<Application x:Class="tool.App"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
|
||||
<Application.Resources>
|
||||
<ResourceDictionary>
|
||||
<ResourceDictionary.MergedDictionaries>
|
||||
<ResourceDictionary Source="/Themes/Shared/Controls.xaml" />
|
||||
<ResourceDictionary Source="/Themes/Dark/Theme.xaml" />
|
||||
<ResourceDictionary Source="/Layout/Views/Resources.xaml" />
|
||||
</ResourceDictionary.MergedDictionaries>
|
||||
</ResourceDictionary>
|
||||
</Application.Resources>
|
||||
</Application>
|
||||
116
8kode/src/tool/App.xaml.cs
Normal file
@@ -0,0 +1,116 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Collections.ObjectModel;
|
||||
using System.Configuration;
|
||||
using System.Data;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Reflection;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows;
|
||||
using System.Xml.Serialization;
|
||||
using tool.Layout.Services;
|
||||
using tool.Layout.ViewModels;
|
||||
using tool.Properties;
|
||||
using tool.ViewModels;
|
||||
|
||||
namespace tool
|
||||
{
|
||||
/// <summary>
|
||||
/// Interaction logic for App.xaml
|
||||
/// </summary>
|
||||
public partial class App : Application
|
||||
{
|
||||
public App()
|
||||
{
|
||||
#if VOID
|
||||
Shutdown();
|
||||
return;
|
||||
#endif
|
||||
|
||||
LayoutViewRegistry.RegisterAssembly(Assembly.GetExecutingAssembly());
|
||||
|
||||
Layouts = new ObservableCollection<LayoutViewModel>();
|
||||
|
||||
var serializer = new XmlSerializer(typeof(LayoutViewModel));
|
||||
if (Settings.Default.Layouts != null)
|
||||
{
|
||||
foreach (var layout in Settings.Default.Layouts)
|
||||
{
|
||||
Layouts.Add(serializer.Deserialize(new StringReader(layout)) as LayoutViewModel);
|
||||
}
|
||||
}
|
||||
|
||||
if (!string.IsNullOrEmpty(Settings.Default.LastLayout))
|
||||
{
|
||||
var layoutVm = serializer.Deserialize(new StringReader(Settings.Default.LastLayout)) as LayoutViewModel;
|
||||
if (layoutVm.Windows.Count == 0)
|
||||
{
|
||||
WindowViewModel.CreateNewWindow();
|
||||
}
|
||||
else
|
||||
{
|
||||
LoadLayout(layoutVm);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
WindowViewModel.CreateNewWindow();
|
||||
}
|
||||
}
|
||||
|
||||
public void LoadLayout(LayoutViewModel layoutViewModel)
|
||||
{
|
||||
RootViewModel.Instance.Windows.Clear();
|
||||
foreach (var window in layoutViewModel.Windows)
|
||||
{
|
||||
RootViewModel.Instance.Windows.Add(window);
|
||||
}
|
||||
m_sCurrentLayout = layoutViewModel.DisplayName;
|
||||
}
|
||||
|
||||
public void SaveLayoutAs()
|
||||
{
|
||||
var layout = new LayoutViewModel();
|
||||
layout.DisplayName = MessageBoxService.Input("Enter the layout name:", m_sCurrentLayout);
|
||||
layout.Windows = RootViewModel.Instance.Windows.ToList();
|
||||
var existingLayout = Layouts.FirstOrDefault(l => l.DisplayName == layout.DisplayName);
|
||||
if (existingLayout != null)
|
||||
{
|
||||
Layouts.Remove(existingLayout);
|
||||
}
|
||||
Layouts.Add(layout);
|
||||
m_sCurrentLayout = layout.DisplayName;
|
||||
var serializer = new XmlSerializer(typeof(LayoutViewModel));
|
||||
var sb = new StringBuilder();
|
||||
serializer.Serialize(new StringWriter(sb), layout);
|
||||
if (Settings.Default.Layouts == null)
|
||||
{
|
||||
Settings.Default.Layouts = new System.Collections.Specialized.StringCollection();
|
||||
}
|
||||
Settings.Default.Layouts.Add(sb.ToString());
|
||||
Settings.Default.Save();
|
||||
}
|
||||
|
||||
public void SaveLastLayout()
|
||||
{
|
||||
var layout = new LayoutViewModel();
|
||||
layout.DisplayName = "Least recently used";
|
||||
layout.Windows = RootViewModel.Instance.Windows.ToList();
|
||||
var serializer = new XmlSerializer(typeof(LayoutViewModel));
|
||||
var sb = new StringBuilder();
|
||||
serializer.Serialize(new StringWriter(sb), layout);
|
||||
Settings.Default.LastLayout = sb.ToString();
|
||||
Settings.Default.Save();
|
||||
}
|
||||
|
||||
public ObservableCollection<LayoutViewModel> Layouts
|
||||
{
|
||||
get;
|
||||
private set;
|
||||
}
|
||||
|
||||
private string m_sCurrentLayout;
|
||||
}
|
||||
}
|
||||
27
8kode/src/tool/Dialogs/MessageBox.xaml
Normal file
@@ -0,0 +1,27 @@
|
||||
<Window x:Class="tool.Dialogs.MessageBox"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
mc:Ignorable="d" Title="LavaMold" SizeToContent="WidthAndHeight"
|
||||
d:DesignWidth="500" d:DesignHeight="200" MinWidth="400" WindowStartupLocation="CenterOwner">
|
||||
<Grid>
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="Auto" />
|
||||
<ColumnDefinition />
|
||||
</Grid.ColumnDefinitions>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="Auto" />
|
||||
<RowDefinition />
|
||||
<RowDefinition Height="Auto" />
|
||||
</Grid.RowDefinitions>
|
||||
<Image x:Name="ErrorIcon" Source="/tool;component/Images/bigerror.png" Grid.Row="1" Stretch="Uniform" Width="32" Height="32" Margin="5" VerticalAlignment="Top" />
|
||||
<Image x:Name="InfoIcon" Source="/tool;component/Images/biginfo.png" Grid.Row="1" Stretch="Uniform" Width="32" Height="32" Margin="5" VerticalAlignment="Top" />
|
||||
<TextBlock Grid.Column="1" x:Name="Message" Margin="5,10" FontWeight="Bold" />
|
||||
<TextBox Grid.Row="1" Grid.Column="1" x:Name="Details" TextWrapping="Wrap" IsReadOnly="True" Height="Auto" Margin="5" MaxWidth="800" MaxHeight="700" VerticalAlignment="Top" VerticalScrollBarVisibility="Auto" />
|
||||
<StackPanel Orientation="Horizontal" Grid.Column="1" Grid.Row="2" HorizontalAlignment="Right">
|
||||
<Button Content="Close" Margin="5,10" HorizontalAlignment="Right" Padding="5,3" Click="Button_Click" />
|
||||
</StackPanel>
|
||||
</Grid>
|
||||
</Window>
|
||||
|
||||
32
8kode/src/tool/Dialogs/MessageBox.xaml.cs
Normal file
@@ -0,0 +1,32 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
using System.Windows.Data;
|
||||
using System.Windows.Documents;
|
||||
using System.Windows.Input;
|
||||
using System.Windows.Media;
|
||||
using System.Windows.Media.Imaging;
|
||||
using System.Windows.Shapes;
|
||||
|
||||
namespace tool.Dialogs
|
||||
{
|
||||
/// <summary>
|
||||
/// Interaction logic for MessageBox.xaml
|
||||
/// </summary>
|
||||
public partial class MessageBox : Window
|
||||
{
|
||||
public MessageBox()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
|
||||
private void Button_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
this.Close();
|
||||
}
|
||||
}
|
||||
}
|
||||
28
8kode/src/tool/Dialogs/QueryChooseBox.xaml
Normal file
@@ -0,0 +1,28 @@
|
||||
<Window x:Class="tool.Dialogs.QueryChooseBox"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:local="clr-namespace:tool.Dialogs"
|
||||
mc:Ignorable="d" SizeToContent="WidthAndHeight" Title="8kode"
|
||||
d:DesignHeight="300" d:DesignWidth="300" WindowStartupLocation="CenterOwner">
|
||||
<Grid>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition />
|
||||
<RowDefinition Height="Auto" />
|
||||
</Grid.RowDefinitions>
|
||||
<TextBlock x:Name="Message" Margin="5,10" FontWeight="Bold" TextWrapping="Wrap" Height="Auto" VerticalAlignment="Top" />
|
||||
<ItemsControl ItemsSource="{Binding Options, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type local:QueryChooseBox}}}" Grid.Row="1" HorizontalAlignment="Right">
|
||||
<ItemsControl.ItemsPanel>
|
||||
<ItemsPanelTemplate>
|
||||
<StackPanel Orientation="Horizontal" />
|
||||
</ItemsPanelTemplate>
|
||||
</ItemsControl.ItemsPanel>
|
||||
<ItemsControl.ItemTemplate>
|
||||
<DataTemplate>
|
||||
<Button Content="{Binding}" Margin="5,10" HorizontalAlignment="Right" Padding="5,3" Click="Button_Click" />
|
||||
</DataTemplate>
|
||||
</ItemsControl.ItemTemplate>
|
||||
</ItemsControl>
|
||||
</Grid>
|
||||
</Window>
|
||||
39
8kode/src/tool/Dialogs/QueryChooseBox.xaml.cs
Normal file
@@ -0,0 +1,39 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
using System.Windows.Data;
|
||||
using System.Windows.Documents;
|
||||
using System.Windows.Input;
|
||||
using System.Windows.Media;
|
||||
using System.Windows.Media.Imaging;
|
||||
using System.Windows.Shapes;
|
||||
|
||||
namespace tool.Dialogs
|
||||
{
|
||||
/// <summary>
|
||||
/// Interaction logic for QueryChooseBox.xaml
|
||||
/// </summary>
|
||||
public partial class QueryChooseBox : Window
|
||||
{
|
||||
public QueryChooseBox()
|
||||
{
|
||||
Result = null;
|
||||
InitializeComponent();
|
||||
}
|
||||
|
||||
public string Result { get; private set; }
|
||||
|
||||
private void Button_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
Result = (sender as Button).DataContext as string;
|
||||
this.Close();
|
||||
}
|
||||
|
||||
public List<string> Options { get; set; }
|
||||
}
|
||||
}
|
||||
|
||||
22
8kode/src/tool/Dialogs/UserInputBox.xaml
Normal file
@@ -0,0 +1,22 @@
|
||||
<Window x:Class="tool.Dialogs.UserInputBox"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
mc:Ignorable="d" SizeToContent="WidthAndHeight" Title="8kode"
|
||||
d:DesignWidth="500" d:DesignHeight="200" MaxWidth="500" WindowStartupLocation="CenterOwner">
|
||||
<Grid Margin="10,5">
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition />
|
||||
<RowDefinition Height="Auto" />
|
||||
<RowDefinition Height="Auto" />
|
||||
</Grid.RowDefinitions>
|
||||
<TextBlock x:Name="Message" Margin="5" FontWeight="Bold" TextWrapping="Wrap" Height="Auto" VerticalAlignment="Top" />
|
||||
<TextBox Grid.Row="1" x:Name="UserInput" AcceptsReturn="False" MaxLines="1" Margin="5" Height="23" />
|
||||
<StackPanel Orientation="Horizontal" Grid.Row="2" HorizontalAlignment="Right">
|
||||
<Button Content="OK" Margin="5" IsDefault="True" HorizontalAlignment="Right" Padding="5,3" Click="OkButton_Click" />
|
||||
<Button Content="Cancel" Margin="5" HorizontalAlignment="Right" Padding="5,3" Click="CancelButton_Click" />
|
||||
</StackPanel>
|
||||
</Grid>
|
||||
</Window>
|
||||
|
||||
38
8kode/src/tool/Dialogs/UserInputBox.xaml.cs
Normal file
@@ -0,0 +1,38 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
using System.Windows.Data;
|
||||
using System.Windows.Documents;
|
||||
using System.Windows.Input;
|
||||
using System.Windows.Media;
|
||||
using System.Windows.Media.Imaging;
|
||||
using System.Windows.Shapes;
|
||||
|
||||
namespace tool.Dialogs
|
||||
{
|
||||
/// <summary>
|
||||
/// Interaction logic for UserInputBox.xaml
|
||||
/// </summary>
|
||||
public partial class UserInputBox : Window
|
||||
{
|
||||
public UserInputBox()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
|
||||
private void OkButton_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
this.Close();
|
||||
}
|
||||
|
||||
private void CancelButton_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
UserInput.Text = null;
|
||||
this.Close();
|
||||
}
|
||||
}
|
||||
}
|
||||
19
8kode/src/tool/Dialogs/YesNoBox.xaml
Normal file
@@ -0,0 +1,19 @@
|
||||
<Window x:Class="tool.Dialogs.YesNoBox"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
mc:Ignorable="d" SizeToContent="WidthAndHeight" Title="Alcatraz 8kode"
|
||||
d:DesignHeight="300" d:DesignWidth="300" WindowStartupLocation="CenterOwner">
|
||||
<Grid>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition />
|
||||
<RowDefinition Height="Auto" />
|
||||
</Grid.RowDefinitions>
|
||||
<TextBlock x:Name="Message" Margin="5,10" FontWeight="Bold" TextWrapping="Wrap" Height="Auto" VerticalAlignment="Top" />
|
||||
<StackPanel Orientation="Horizontal" Grid.Row="1" HorizontalAlignment="Right">
|
||||
<Button Content="Yes" Margin="5,10" HorizontalAlignment="Right" Padding="5,3" Click="YesButton_Click" />
|
||||
<Button Content="No" Margin="5,10" HorizontalAlignment="Right" Padding="5,3" Click="NoButton_Click" />
|
||||
</StackPanel>
|
||||
</Grid>
|
||||
</Window>
|
||||
41
8kode/src/tool/Dialogs/YesNoBox.xaml.cs
Normal file
@@ -0,0 +1,41 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
using System.Windows.Data;
|
||||
using System.Windows.Documents;
|
||||
using System.Windows.Input;
|
||||
using System.Windows.Media;
|
||||
using System.Windows.Media.Imaging;
|
||||
using System.Windows.Shapes;
|
||||
|
||||
namespace tool.Dialogs
|
||||
{
|
||||
/// <summary>
|
||||
/// Interaction logic for YesNoBox.xaml
|
||||
/// </summary>
|
||||
public partial class YesNoBox : Window
|
||||
{
|
||||
public YesNoBox()
|
||||
{
|
||||
Result = false;
|
||||
InitializeComponent();
|
||||
}
|
||||
|
||||
public bool Result { get; private set; }
|
||||
|
||||
private void YesButton_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
Result = true;
|
||||
this.Close();
|
||||
}
|
||||
|
||||
private void NoButton_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
this.Close();
|
||||
}
|
||||
}
|
||||
}
|
||||
404
8kode/src/tool/HLSL.xshd
Normal file
@@ -0,0 +1,404 @@
|
||||
<?xml version="1.0"?>
|
||||
|
||||
<SyntaxDefinition name = "HLSL" extensions = ".fx;.hlsl">
|
||||
|
||||
<Properties>
|
||||
<Property name="LineComment" value="//"/>
|
||||
</Properties>
|
||||
|
||||
<Digits name = "Digits" bold = "false" italic = "false" color = "#FFC040"/>
|
||||
|
||||
<RuleSets>
|
||||
<RuleSet ignorecase = "false">
|
||||
<Delimiters>~!%^*()-+=|\#/{}[]:;"'<> , .?</Delimiters>
|
||||
|
||||
<Span name = "PreprocessorDirectives" bold="false" italic="false" color="#FF40C0" stopateol = "true">
|
||||
<Begin>#</Begin>
|
||||
</Span>
|
||||
|
||||
<Span name = "LineComment" bold = "true" italic = "true" color = "#808080" stopateol = "true">
|
||||
<Begin>//</Begin>
|
||||
</Span>
|
||||
|
||||
<Span name = "BlockComment" bold = "true" italic = "true" color = "#808080" stopateol = "false">
|
||||
<Begin>/*</Begin>
|
||||
<End>*/</End>
|
||||
</Span>
|
||||
|
||||
<Span name = "String" bold = "false" italic = "false" color = "#C0C040" stopateol = "true">
|
||||
<Begin>"</Begin>
|
||||
<End>"</End>
|
||||
</Span>
|
||||
|
||||
<Span name = "Char" bold = "false" italic = "false" color = "#C0C040" stopateol = "true">
|
||||
<Begin>'</Begin>
|
||||
<End>'</End>
|
||||
</Span>
|
||||
|
||||
<MarkPrevious bold = "false" italic = "false" color = "White">(</MarkPrevious>
|
||||
|
||||
<KeyWords name = "KEYWORD2" bold="false" italic="true" color="#26F9AD">
|
||||
<Key word = "and" />
|
||||
<Key word = "and_eq" />
|
||||
<Key word = "asm" />
|
||||
<Key word = "auto" />
|
||||
<Key word = "bitand" />
|
||||
<Key word = "bitor" />
|
||||
<Key word = "bool" />
|
||||
<Key word = "catch" />
|
||||
<Key word = "char" />
|
||||
<Key word = "class" />
|
||||
<Key word = "compl" />
|
||||
<Key word = "const" />
|
||||
<Key word = "const_cast" />
|
||||
<Key word = "delete" />
|
||||
<Key word = "double" />
|
||||
<Key word = "dynamic_cast" />
|
||||
<Key word = "enum" />
|
||||
<Key word = "explicit" />
|
||||
<Key word = "export" />
|
||||
<Key word = "extern" />
|
||||
<Key word = "false" />
|
||||
<Key word = "half" />
|
||||
<Key word = "half2" />
|
||||
<Key word = "half3" />
|
||||
<Key word = "half4" />
|
||||
<Key word = "half4x4" />
|
||||
<Key word = "half4x3" />
|
||||
<Key word = "half3x3" />
|
||||
<Key word = "float" />
|
||||
<Key word = "float2" />
|
||||
<Key word = "float3" />
|
||||
<Key word = "float4" />
|
||||
<Key word = "float4x4" />
|
||||
<Key word = "float4x3" />
|
||||
<Key word = "float3x3" />
|
||||
<Key word = "friend" />
|
||||
<Key word = "inline" />
|
||||
<Key word = "int" />
|
||||
<Key word = "int2" />
|
||||
<Key word = "int3" />
|
||||
<Key word = "int4" />
|
||||
<Key word = "int4x4" />
|
||||
<Key word = "int4x3" />
|
||||
<Key word = "int3x3" />
|
||||
<Key word = "long" />
|
||||
<Key word = "mutable" />
|
||||
<Key word = "namespace" />
|
||||
<Key word = "new" />
|
||||
<Key word = "not" />
|
||||
<Key word = "not_eq" />
|
||||
<Key word = "operator" />
|
||||
<Key word = "or" />
|
||||
<Key word = "or_eq" />
|
||||
<Key word = "private" />
|
||||
<Key word = "protected" />
|
||||
<Key word = "public" />
|
||||
<Key word = "register" />
|
||||
<Key word = "reinterpret_cast" />
|
||||
<Key word = "short" />
|
||||
<Key word = "signed" />
|
||||
<Key word = "sizeof" />
|
||||
<Key word = "static" />
|
||||
<Key word = "static_cast" />
|
||||
<Key word = "struct" />
|
||||
<Key word = "template" />
|
||||
<Key word = "this" />
|
||||
<Key word = "throw" />
|
||||
<Key word = "true" />
|
||||
<Key word = "try" />
|
||||
<Key word = "typedef" />
|
||||
<Key word = "typeid" />
|
||||
<Key word = "typename" />
|
||||
<Key word = "union" />
|
||||
<Key word = "unsigned" />
|
||||
<Key word = "using" />
|
||||
<Key word = "virtual" />
|
||||
<Key word = "void" />
|
||||
<Key word = "volatile" />
|
||||
<Key word = "xor" />
|
||||
<Key word = "xor_eq" />
|
||||
<Key word = "technique" />
|
||||
<Key word = "texture" />
|
||||
<Key word = "sampler2D" />
|
||||
<Key word = "using" />
|
||||
<Key word = "namespace" />
|
||||
</KeyWords>
|
||||
|
||||
<KeyWords name = "Punctuation" bold = "false" italic = "false" color = "#80C080">
|
||||
<Key word = "?" />
|
||||
<Key word = "," />
|
||||
<Key word = "." />
|
||||
<Key word = ";" />
|
||||
<Key word = "(" />
|
||||
<Key word = ")" />
|
||||
<Key word = "[" />
|
||||
<Key word = "]" />
|
||||
<Key word = "{" />
|
||||
<Key word = "}" />
|
||||
<Key word = "+" />
|
||||
<Key word = "-" />
|
||||
<Key word = "/" />
|
||||
<Key word = "%" />
|
||||
<Key word = "*" />
|
||||
<Key word = "<" />
|
||||
<Key word = ">" />
|
||||
<Key word = "^" />
|
||||
<Key word = "=" />
|
||||
<Key word = "~" />
|
||||
<Key word = "!" />
|
||||
<Key word = "|" />
|
||||
<Key word = "&" />
|
||||
</KeyWords>
|
||||
|
||||
<KeyWords name = "OperatorKeywords" bold="false" italic="true" color="#80C080">
|
||||
<Key word = "and" />
|
||||
<Key word = "and_eq" />
|
||||
|
||||
<Key word = "bitand" />
|
||||
<Key word = "bitor" />
|
||||
|
||||
<Key word = "new" />
|
||||
<Key word = "not" />
|
||||
<Key word = "not_eq" />
|
||||
<Key word = "or" />
|
||||
<Key word = "or_eq" />
|
||||
<Key word = "xor" />
|
||||
<Key word = "xor_eq" />
|
||||
<Key word = "string" />
|
||||
<Key word = "pass" />
|
||||
<Key word = "PixelShader" />
|
||||
<Key word = "VertexShader" />
|
||||
<Key word = "compile" />
|
||||
</KeyWords>
|
||||
|
||||
|
||||
<KeyWords name = "AccessModifiers" bold="false" italic="false" color="#4040C0">
|
||||
<Key word = "private" />
|
||||
<Key word = "protected" />
|
||||
<Key word = "public" />
|
||||
<Key word = "uniform" />
|
||||
<Key word = "const" />
|
||||
<Key word = "volatile" />
|
||||
|
||||
<Key word = "static" />
|
||||
</KeyWords>
|
||||
|
||||
<KeyWords name = "Types" bold="false" italic="true" color="#26F9AD">
|
||||
<Key word = "bool" />
|
||||
<Key word = "char" />
|
||||
<Key word = "unsigned" />
|
||||
<Key word = "union" />
|
||||
<Key word = "virtual" />
|
||||
<Key word = "double" />
|
||||
<Key word = "float" />
|
||||
<Key word = "short" />
|
||||
<Key word = "signed" />
|
||||
<Key word = "void" />
|
||||
<Key word = "class" />
|
||||
|
||||
<Key word = "enum" />
|
||||
<Key word = "struct" />
|
||||
</KeyWords>
|
||||
|
||||
<KeyWords name = "IntrinsicFunctions" bold="false" italic="false" color="#C080A0">
|
||||
|
||||
<Key word = "abort" />
|
||||
<Key word = "abs" />
|
||||
<Key word = "acos" />
|
||||
<Key word = "all" />
|
||||
<Key word = "AllMemoryBarrier" />
|
||||
<Key word = "AllMemoryBarrierWithGroupSync" />
|
||||
<Key word = "any" />
|
||||
<Key word = "asdouble" />
|
||||
<Key word = "asfloat" />
|
||||
<Key word = "asin" />
|
||||
<Key word = "asint" />
|
||||
<Key word = "asint" />
|
||||
<Key word = "asuint" />
|
||||
<Key word = "asuint" />
|
||||
<Key word = "atan" />
|
||||
<Key word = "atan2" />
|
||||
<Key word = "ceil" />
|
||||
<Key word = "CheckAccessFullyMapped" />
|
||||
<Key word = "clamp" />
|
||||
<Key word = "clip" />
|
||||
<Key word = "cos" />
|
||||
<Key word = "cosh" />
|
||||
<Key word = "countbits" />
|
||||
<Key word = "cross" />
|
||||
<Key word = "D3DCOLORtoUBYTE4" />
|
||||
<Key word = "ddx" />
|
||||
<Key word = "ddx_coarse" />
|
||||
<Key word = "ddx_fine" />
|
||||
<Key word = "ddy" />
|
||||
<Key word = "ddy_coarse" />
|
||||
<Key word = "ddy_fine" />
|
||||
<Key word = "degrees" />
|
||||
<Key word = "determinant" />
|
||||
<Key word = "DeviceMemoryBarrier" />
|
||||
<Key word = "DeviceMemoryBarrierWithGroupSync" />
|
||||
<Key word = "distance" />
|
||||
<Key word = "dot" />
|
||||
<Key word = "dst" />
|
||||
<Key word = "errorf" />
|
||||
<Key word = "EvaluateAttributeAtCentroid" />
|
||||
<Key word = "EvaluateAttributeAtSample" />
|
||||
<Key word = "EvaluateAttributeSnapped" />
|
||||
<Key word = "exp" />
|
||||
<Key word = "exp2" />
|
||||
<Key word = "f16tof32" />
|
||||
<Key word = "f32tof16" />
|
||||
<Key word = "faceforward" />
|
||||
<Key word = "firstbithigh" />
|
||||
<Key word = "firstbitlow" />
|
||||
<Key word = "floor" />
|
||||
<Key word = "fma" />
|
||||
<Key word = "fmod" />
|
||||
<Key word = "frac" />
|
||||
<Key word = "frexp" />
|
||||
<Key word = "fwidth" />
|
||||
<Key word = "GetRenderTargetSampleCount" />
|
||||
<Key word = "GetRenderTargetSamplePosition" />
|
||||
<Key word = "GroupMemoryBarrier" />
|
||||
<Key word = "GroupMemoryBarrierWithGroupSync" />
|
||||
<Key word = "InterlockedAdd" />
|
||||
<Key word = "InterlockedAnd" />
|
||||
<Key word = "InterlockedCompareExchange" />
|
||||
<Key word = "InterlockedCompareStore" />
|
||||
<Key word = "InterlockedExchange" />
|
||||
<Key word = "InterlockedMax" />
|
||||
<Key word = "InterlockedMin" />
|
||||
<Key word = "InterlockedOr" />
|
||||
<Key word = "InterlockedXor" />
|
||||
<Key word = "isfinite" />
|
||||
<Key word = "isinf" />
|
||||
<Key word = "isnan" />
|
||||
<Key word = "ldexp" />
|
||||
<Key word = "length" />
|
||||
<Key word = "lerp" />
|
||||
<Key word = "lit" />
|
||||
<Key word = "log" />
|
||||
<Key word = "log10" />
|
||||
<Key word = "log2" />
|
||||
<Key word = "mad" />
|
||||
<Key word = "max" />
|
||||
<Key word = "min" />
|
||||
<Key word = "modf" />
|
||||
<Key word = "msad4" />
|
||||
<Key word = "mul" />
|
||||
<Key word = "noise" />
|
||||
<Key word = "normalize" />
|
||||
<Key word = "pow" />
|
||||
<Key word = "printf" />
|
||||
<Key word = "Process2DQuadTessFactorsAvg" />
|
||||
<Key word = "Process2DQuadTessFactorsMax" />
|
||||
<Key word = "Process2DQuadTessFactorsMin" />
|
||||
<Key word = "ProcessIsolineTessFactors" />
|
||||
<Key word = "ProcessQuadTessFactorsAvg" />
|
||||
<Key word = "ProcessQuadTessFactorsMax" />
|
||||
<Key word = "ProcessQuadTessFactorsMin" />
|
||||
<Key word = "ProcessTriTessFactorsAvg" />
|
||||
<Key word = "ProcessTriTessFactorsMax" />
|
||||
<Key word = "ProcessTriTessFactorsMin" />
|
||||
<Key word = "radians" />
|
||||
<Key word = "rcp" />
|
||||
<Key word = "reflect" />
|
||||
<Key word = "refract" />
|
||||
<Key word = "reversebits" />
|
||||
<Key word = "round" />
|
||||
<Key word = "rsqrt" />
|
||||
<Key word = "saturate" />
|
||||
<Key word = "sign" />
|
||||
<Key word = "sin" />
|
||||
<Key word = "sincos" />
|
||||
<Key word = "sinh" />
|
||||
<Key word = "smoothstep" />
|
||||
<Key word = "sqrt" />
|
||||
<Key word = "step" />
|
||||
<Key word = "tan" />
|
||||
<Key word = "tanh" />
|
||||
<Key word = "tex1D" />
|
||||
<Key word = "tex1D" />
|
||||
<Key word = "tex1Dbias" />
|
||||
<Key word = "tex1Dgrad" />
|
||||
<Key word = "tex1Dlod" />
|
||||
<Key word = "tex1Dproj" />
|
||||
<Key word = "tex2D" />
|
||||
<Key word = "tex2D" />
|
||||
<Key word = "tex2Dbias" />
|
||||
<Key word = "tex2Dgrad" />
|
||||
<Key word = "tex2Dlod" />
|
||||
<Key word = "tex2Dproj" />
|
||||
<Key word = "tex3D" />
|
||||
<Key word = "tex3D" />
|
||||
<Key word = "tex3Dbias" />
|
||||
<Key word = "tex3Dgrad" />
|
||||
<Key word = "tex3Dlod" />
|
||||
<Key word = "tex3Dproj" />
|
||||
<Key word = "texCUBE" />
|
||||
<Key word = "texCUBE" />
|
||||
<Key word = "texCUBEbias" />
|
||||
<Key word = "texCUBEgrad" />
|
||||
<Key word = "texCUBElod" />
|
||||
<Key word = "texCUBEproj" />
|
||||
<Key word = "transpose" />
|
||||
<Key word = "trunc" />
|
||||
</KeyWords>
|
||||
|
||||
<KeyWords name = "Literals" bold="true" italic="false" color="White">
|
||||
<Key word = "false" />
|
||||
<Key word = "true" />
|
||||
</KeyWords>
|
||||
|
||||
<KeyWords name = "IterationStatements" bold="true" italic="false" color="#FFFF40">
|
||||
<Key word = "do" />
|
||||
<Key word = "for" />
|
||||
<Key word = "while" />
|
||||
</KeyWords>
|
||||
|
||||
<KeyWords name = "JumpStatements" bold="true" italic="false" color="#FFFF40">
|
||||
<Key word = "break" />
|
||||
<Key word = "continue" />
|
||||
<Key word = "goto" />
|
||||
<Key word = "return" />
|
||||
</KeyWords>
|
||||
|
||||
<KeyWords name = "SelectionStatements" bold="true" italic="false" color="#FF8040">
|
||||
<Key word = "case" />
|
||||
<Key word = "else" />
|
||||
<Key word = "if" />
|
||||
<Key word = "switch" />
|
||||
<Key word = "default" />
|
||||
</KeyWords>
|
||||
|
||||
<KeyWords name = "KEYWORD1" bold="false" italic="false" color="#26F9AD">
|
||||
<Key word = "asm" />
|
||||
<Key word = "auto" />
|
||||
<Key word = "compl" />
|
||||
<Key word = "mutable" />
|
||||
<Key word = "const_cast" />
|
||||
<Key word = "delete" />
|
||||
<Key word = "dynamic_cast" />
|
||||
<Key word = "explicit" />
|
||||
<Key word = "export" />
|
||||
<Key word = "extern" />
|
||||
<Key word = "inline" />
|
||||
<Key word = "int" />
|
||||
<Key word = "long" />
|
||||
<Key word = "operator" />
|
||||
<Key word = "register" />
|
||||
<Key word = "reinterpret_cast" />
|
||||
<Key word = "sizeof" />
|
||||
<Key word = "static_cast" />
|
||||
<Key word = "template" />
|
||||
<Key word = "typedef" />
|
||||
<Key word = "typeid" />
|
||||
<Key word = "typename" />
|
||||
<Key word = "typename" />
|
||||
|
||||
</KeyWords>
|
||||
|
||||
</RuleSet>
|
||||
</RuleSets>
|
||||
</SyntaxDefinition>
|
||||
145
8kode/src/tool/ImageSourceService.cs
Normal file
@@ -0,0 +1,145 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows.Media;
|
||||
using System.Windows.Media.Imaging;
|
||||
using System.Windows;
|
||||
using System.Net.Cache;
|
||||
|
||||
namespace tool
|
||||
{
|
||||
public static class ImageSourceService
|
||||
{
|
||||
public struct Options
|
||||
{
|
||||
public bool m_bPreserveAspectAndHeight;
|
||||
public int m_iDesiredWidth;
|
||||
public int m_iDesiredHeight;
|
||||
}
|
||||
|
||||
public static ImageSource GetImageSource(string _sPath, Options? _options = null)
|
||||
{
|
||||
lock (s_dCache)
|
||||
{
|
||||
_sPath = SanitizePath(_sPath);
|
||||
if (string.IsNullOrEmpty(_sPath))
|
||||
return null;
|
||||
|
||||
var key = new Tuple<string, Options?>(_sPath, _options);
|
||||
|
||||
if (s_dCache.ContainsKey(key))
|
||||
return s_dCache[key];
|
||||
|
||||
ImageSource result = null;
|
||||
var bi = new BitmapImage();
|
||||
result = bi;
|
||||
try
|
||||
{
|
||||
if (_sPath.StartsWith("pack:"))
|
||||
{
|
||||
bi.BeginInit();
|
||||
bi.UriSource = new Uri(_sPath);
|
||||
bi.EndInit();
|
||||
}
|
||||
else
|
||||
{
|
||||
using (var stream = new FileStream(_sPath, FileMode.Open, FileAccess.Read, FileShare.ReadWrite))
|
||||
{
|
||||
bi.BeginInit();
|
||||
bi.StreamSource = stream;
|
||||
bi.CacheOption = BitmapCacheOption.OnLoad;
|
||||
bi.EndInit();
|
||||
}
|
||||
}
|
||||
|
||||
s_dDimensions[key.Item1] = bi.PixelWidth + " x " + bi.PixelHeight + "px";
|
||||
|
||||
if (_options.HasValue)
|
||||
{
|
||||
var iWidth = _options.Value.m_iDesiredWidth;
|
||||
var iHeight = _options.Value.m_iDesiredHeight;
|
||||
if (_options.Value.m_bPreserveAspectAndHeight)
|
||||
{
|
||||
iWidth = (int)Math.Max(1, iHeight * bi.PixelWidth / bi.PixelHeight);
|
||||
}
|
||||
result = CreateResizedImage(bi, iWidth, iHeight);
|
||||
}
|
||||
|
||||
s_dCache[key] = result;
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
result = null;
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
||||
private static string SanitizePath(string _sPath)
|
||||
{
|
||||
if (string.IsNullOrEmpty(_sPath))
|
||||
return null;
|
||||
|
||||
if (_sPath[1] == ':')
|
||||
_sPath = System.IO.Path.GetFullPath(_sPath);
|
||||
|
||||
return _sPath;
|
||||
}
|
||||
|
||||
public static BitmapFrame CreateResizedImage(ImageSource source, int width, int height)
|
||||
{
|
||||
var rect = new Rect(0, 0, width, height);
|
||||
|
||||
var group = new DrawingGroup();
|
||||
RenderOptions.SetBitmapScalingMode(group, BitmapScalingMode.HighQuality);
|
||||
group.Children.Add(new ImageDrawing(source, rect));
|
||||
|
||||
var drawingVisual = new DrawingVisual();
|
||||
using (var drawingContext = drawingVisual.RenderOpen())
|
||||
drawingContext.DrawDrawing(group);
|
||||
|
||||
var resizedImage = new RenderTargetBitmap(
|
||||
width, height, // Resized dimensions
|
||||
96, 96, // Default DPI values
|
||||
PixelFormats.Default); // Default pixel format
|
||||
resizedImage.Render(drawingVisual);
|
||||
|
||||
return BitmapFrame.Create(resizedImage);
|
||||
}
|
||||
|
||||
public static void ClearCache()
|
||||
{
|
||||
var toRemove = s_dCache.Keys.Where(k => !k.Item1.StartsWith("pack:")).ToList();
|
||||
foreach (var key in toRemove)
|
||||
{
|
||||
s_dCache.Remove(key);
|
||||
}
|
||||
|
||||
if (OnCacheCleared != null)
|
||||
{
|
||||
OnCacheCleared(null, EventArgs.Empty);
|
||||
}
|
||||
}
|
||||
|
||||
public static string GetDimensions(string _sPath)
|
||||
{
|
||||
_sPath = SanitizePath(_sPath);
|
||||
if (string.IsNullOrEmpty(_sPath))
|
||||
return null;
|
||||
|
||||
if (!s_dDimensions.ContainsKey(_sPath))
|
||||
return null;
|
||||
|
||||
return s_dDimensions[_sPath];
|
||||
}
|
||||
|
||||
private static Dictionary<Tuple<string, Options?>, ImageSource> s_dCache = new Dictionary<Tuple<string, Options?>, ImageSource>();
|
||||
private static Dictionary<string, string> s_dDimensions = new Dictionary<string, string>();
|
||||
|
||||
public static event EventHandler OnCacheCleared;
|
||||
}
|
||||
}
|
||||
BIN
8kode/src/tool/Images/audio.png
Normal file
|
After Width: | Height: | Size: 1.1 KiB |
BIN
8kode/src/tool/Images/bigerror.png
Normal file
|
After Width: | Height: | Size: 1.4 KiB |
BIN
8kode/src/tool/Images/biginfo.png
Normal file
|
After Width: | Height: | Size: 2.3 KiB |
BIN
8kode/src/tool/Images/explorer.png
Normal file
|
After Width: | Height: | Size: 567 B |
BIN
8kode/src/tool/Images/glow.png
Normal file
|
After Width: | Height: | Size: 15 KiB |
BIN
8kode/src/tool/Images/group.png
Normal file
|
After Width: | Height: | Size: 2.8 KiB |
BIN
8kode/src/tool/Images/histogram.png
Normal file
|
After Width: | Height: | Size: 639 B |
BIN
8kode/src/tool/Images/intro.png
Normal file
|
After Width: | Height: | Size: 720 B |
BIN
8kode/src/tool/Images/notepad++.png
Normal file
|
After Width: | Height: | Size: 642 B |
BIN
8kode/src/tool/Images/operator.png
Normal file
|
After Width: | Height: | Size: 389 B |
BIN
8kode/src/tool/Images/parade.png
Normal file
|
After Width: | Height: | Size: 171 B |
BIN
8kode/src/tool/Images/thumb.png
Normal file
|
After Width: | Height: | Size: 158 B |
BIN
8kode/src/tool/Images/vectorscope.png
Normal file
|
After Width: | Height: | Size: 645 B |
21
8kode/src/tool/Layout/Attributes/LayoutViewAttribute.cs
Normal file
@@ -0,0 +1,21 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace tool.Layout.Attributes
|
||||
{
|
||||
public class LayoutViewAttribute : Attribute
|
||||
{
|
||||
public LayoutViewAttribute(string _sViewName, string _sViewIconPath)
|
||||
{
|
||||
ViewName = _sViewName;
|
||||
ViewIconPath = _sViewIconPath;
|
||||
}
|
||||
|
||||
public string ViewName { get; private set; }
|
||||
|
||||
public string ViewIconPath { get; private set; }
|
||||
}
|
||||
}
|
||||
18
8kode/src/tool/Layout/Attributes/LayoutWindowAttribute.cs
Normal file
@@ -0,0 +1,18 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace tool.Layout.Attributes
|
||||
{
|
||||
public class LayoutWindowAttribute : Attribute
|
||||
{
|
||||
public LayoutWindowAttribute(bool _bMainWindow)
|
||||
{
|
||||
MainWindow = _bMainWindow;
|
||||
}
|
||||
|
||||
public bool MainWindow { get; private set; }
|
||||
}
|
||||
}
|
||||