1 #pragma once
2 
3 #include <stdint.h>
4 #include <stdbool.h>
5 #include "ft2_header.h"
6 
7 typedef struct cpu_t
8 {
9 	bool hasSSE, hasSSE2;
10 } cpu_t;
11 
12 typedef struct editor_t
13 {
14 	UNICHAR *binaryPathU, *tmpFilenameU, *tmpInstrFilenameU; // used by saving/loading threads
15 	UNICHAR *configFileLocationU, *audioDevConfigFileLocationU, *midiConfigFileLocationU;
16 
17 	volatile bool mainLoopOngoing;
18 	volatile bool busy, scopeThreadBusy, programRunning, wavIsRendering, wavReachedEndFlag;
19 	volatile bool updateCurSmp, updateCurInstr, diskOpReadDir, diskOpReadDone, updateWindowTitle;
20 	volatile uint8_t loadMusicEvent;
21 	volatile FILE *wavRendererFileHandle;
22 
23 	bool autoPlayOnDrop, trimThreadWasDone, throwExit, editTextFlag;
24 	bool copyMaskEnable, diskOpReadOnOpen, samplingAudioFlag, editSampleFlag;
25 	bool instrBankSwapped, chnMode[MAX_CHANNELS], NI_Play;
26 
27 	uint8_t curPlayInstr, curPlaySmp, curSmpChannel, currPanEnvPoint, currVolEnvPoint;
28 	uint8_t copyMask[5], pasteMask[5], transpMask[5], smpEd_NoteNr, instrBankOffset, sampleBankOffset;
29 	uint8_t srcInstr, curInstr, srcSmp, curSmp, currHelpScreen, currConfigScreen, textCursorBlinkCounter;
30 	uint8_t keyOnTab[MAX_CHANNELS], editRowSkip, curOctave;
31 	uint8_t sampleSaveMode, moduleSaveMode, ptnJumpPos[4];
32 	int16_t globalVolume, songPos, row;
33 	uint16_t tmpPattern, editPattern, BPM, speed, tick, ptnCursorY;
34 	int32_t keyOffNr, keyOffTime[MAX_CHANNELS];
35 	uint32_t framesPassed, wavRendererTime;
36 	double dPerfFreq, dPerfFreqMulMicro, dPerfFreqMulMs;
37 } editor_t;
38 
39 typedef struct ui_t
40 {
41 	volatile bool setMouseBusy, setMouseIdle;
42 	bool sysReqEnterPressed;
43 
44 	// all screens
45 	bool extended, sysReqShown;
46 
47 	// top screens
48 	bool instrSwitcherShown, aboutScreenShown, helpScreenShown, configScreenShown;
49 	bool scopesShown, diskOpShown, nibblesShown, transposeShown, instEditorExtShown;
50 	bool sampleEditorExtShown, advEditShown, wavRendererShown, trimScreenShown;
51 	bool drawBPMFlag, drawSpeedFlag, drawGlobVolFlag, drawPosEdFlag, drawPattNumLenFlag;
52 	bool updatePosSections, updatePosEdScrollBar;
53 	uint8_t oldTopLeftScreen;
54 
55 	// bottom screens
56 	bool patternEditorShown, instEditorShown, sampleEditorShown, pattChanScrollShown;
57 	bool leftLoopPinMoving, rightLoopPinMoving;
58 	bool drawReplayerPianoFlag, drawPianoFlag, updatePatternEditor;
59 	uint8_t channelOffset, numChannelsShown, maxVisibleChannels;
60 	uint16_t patternChannelWidth;
61 	int32_t sampleDataOrLoopDrag;
62 
63 	// backup flag for when entering/exiting extended pattern editor (TODO: this is lame and shouldn't be hardcoded)
64 	bool _aboutScreenShown, _helpScreenShown, _configScreenShown, _diskOpShown;
65 	bool _nibblesShown, _transposeShown, _instEditorShown;
66 	bool _instEditorExtShown, _sampleEditorExtShown, _patternEditorShown;
67 	bool _sampleEditorShown, _advEditShown, _wavRendererShown, _trimScreenShown;
68 	// -------------------------------------------------------------------------
69 } ui_t;
70 
71 typedef struct cursor_t
72 {
73 	uint8_t ch;
74 	int8_t object;
75 } cursor_t;
76 
77 extern cpu_t cpu;
78 extern editor_t editor;
79 extern ui_t ui;
80 extern cursor_t cursor;
81