Skip to content

Commit 17b8961

Browse files
committed
synced with b168
1 parent a6f0e56 commit 17b8961

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

80 files changed

+6378
-5363
lines changed

CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
cmake_minimum_required(VERSION 3.7)
22

3-
project(ft2-clone VERSION 0.1.60)
3+
project(ft2-clone VERSION 0.1.68)
44

55
set(SDL_SHARED_ENABLED_BY_DEFAULT OFF)
66
add_subdirectory(include/SDL2 EXCLUDE_FROM_ALL)

README.md

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4,23 +4,24 @@
44

55
# [Releases download](https://github.com/tpanj/ft2/releases)
66
Requirements for running app:
7-
* Windows can be run on Windows XP sp2+
8-
* Linux Ubuntu 18.04 LTS +
7+
* Windows - can be run on Windows XP sp2+
8+
* Linux - Ubuntu 18.04 LTS + or others
99
* Mac OS X to be done by someone with MAC
1010

1111
# Compiling
1212
Whole app executable is linked staticly into single standalone file.
13-
Sources contains vanilla stripped SDL2 stable 2.09 library with removed some items (`rm -fr android-project/ acinclude/ autogen.sh build-scripts configure* docs test VisualC* Xcode*`).
14-
Various IDEs or console toolchains can be used generatet from cmake and that is why project has no other project files commmited.
13+
Sources contains vanilla stripped SDL2 stable 2.0.10 library with removed some items (`rm -fr android-project/ acinclude/ autogen.sh build-scripts configure* docs test VisualC* Xcode*`).
14+
Various IDEs or console toolchains can be used generated from cmake and that is why project has no other project files committed.
1515

16-
If you want to build from sources by yourself, download sources or clone repository.
16+
If you want to build from sources by yourself, download sources or clone repository. CMake build tool is mandatory besides c compiler and linker.
1717

18-
## Windows
18+
## Windows (with VS201X)
1919
```dos
2020
REM repo is in shared folder ft2_cloned_dir outside Vbox
2121
mkdir build-ft2
2222
cd build-ft2
2323
cmake -A Win32 \\VBOXSVR\ft2_cloned_dir
24+
start ft2-clone.sln
2425
```
2526

2627
Set in IDE to release and on project ft2-clone set to MFC to Static and toolset to v141_xp.
@@ -33,4 +34,4 @@ cmake -DCMAKE_BUILD_TYPE=Release ..
3334
```
3435

3536
# Source
36-
All credits goes to Olav → https://16-bits.org/ft2.php
37+
All credits goes to Olav → https://16-bits.org/ft2.php

misc/ft2_clone_changelog.txt

Lines changed: 1180 additions & 0 deletions
Large diffs are not rendered by default.

src/ft2_about.c

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -117,11 +117,11 @@ static void aboutInit(void)
117117
}
118118
else
119119
{
120-
r = random32(30000);
121-
n = random32(5);
122-
w = ((2 * random32(2)) - 1) * sqr(random32(1000));
120+
r = random32(30000);
121+
n = random32(5);
122+
w = ((2 * random32(2)) - 1) * sqr(random32(1000));
123123
ww = (((M_PI * 2.0) / 5.0) * n) + (r / 12000.0) + (w / 3000000.0);
124-
h = ((sqr(r) / 30000) * (random32(10000) - 5000)) / 12000;
124+
h = ((sqr(r) / 30000) * (random32(10000) - 5000)) / 12000;
125125

126126
starcrd[i].x = (int16_t)trunc(r * cos(ww));
127127
starcrd[i].y = (int16_t)trunc(r * sin(ww));
@@ -137,9 +137,9 @@ static void aboutInit(void)
137137
hastighet = 0;
138138
for (i = 0; i < NUM_STARS; i++)
139139
{
140-
r = (int32_t)round(sqrt(random32(500) * 500));
141-
w = random32(3000);
142-
h = cos32767[(((w * 8) + r) / 16) & 1023] / 4;
140+
r = (int32_t)round(sqrt(random32(500) * 500));
141+
w = random32(3000);
142+
h = cos32767[(((w * 8) + r) / 16) & 1023] / 4;
143143

144144
starcrd[i].z = (int16_t)((cos32767[w & 1023] * (w + r)) / 3500);
145145
starcrd[i].y = (int16_t)((sin32767[w & 1023] * (w + r)) / 3500);

src/ft2_about.h

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
1-
#ifndef __FT2_ABOUT_H
2-
#define __FT2_ABOUT_H
1+
#pragma once
32

43
#include <stdint.h>
54

@@ -8,5 +7,3 @@ void seedAboutScreenRandom(uint32_t newseed);
87
void showAboutScreen(void);
98
void hideAboutScreen(void);
109
void exitAboutScreen(void);
11-
12-
#endif

src/ft2_audio.c

Lines changed: 17 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -171,7 +171,7 @@ void setSpeed(uint16_t bpm)
171171
dFrac *= UINT32_MAX + 1.0;
172172
if (dFrac > (double)UINT32_MAX)
173173
dFrac = (double)UINT32_MAX;
174-
double2int32_round(tickTimeLenFrac, dFrac);
174+
tickTimeLenFrac = (uint32_t)dFrac;
175175
}
176176
}
177177

@@ -199,7 +199,7 @@ static inline void voiceUpdateVolumes(uint8_t i, uint8_t status)
199199
volL = v->SVol * amp; // 0..2047 * 1..32 = 0..65504
200200

201201
// (0..65504 * 0..65536) >> 4 = 0..268304384
202-
volR = ((uint32_t)volL * panningTab[ v->SPan]) >> 4;
202+
volR = ((uint32_t)volL * panningTab[v->SPan]) >> 4;
203203
volL = ((uint32_t)volL * panningTab[256 - v->SPan]) >> 4;
204204

205205
if (!audio.volumeRampingFlag)
@@ -693,7 +693,7 @@ uint32_t mixReplayerTickToBuffer(uint8_t *stream, uint8_t bitDepth)
693693
// normalize mix buffer and send to audio stream
694694
if (bitDepth == 16)
695695
{
696-
if (config.audioDither)
696+
if (config.specialFlags2 & DITHERED_AUDIO)
697697
sendSamples16BitDitherStereo(stream, speedVal, 2);
698698
else
699699
sendSamples16BitStereo(stream, speedVal, 2);
@@ -914,15 +914,16 @@ void lockMixerCallback(void) // lock audio + clear voices/scopes (for short oper
914914

915915
audio.resetSyncTickTimeFlag = true;
916916

917-
stopVoices(); // VERY important! prevents potential crashes
917+
stopVoices(); // VERY important! prevents potential crashes by purging pointers
918+
918919
// scopes, mixer and replayer are guaranteed to not be active at this point
919920

920921
resetSyncQueues();
921922
}
922923

923924
void unlockMixerCallback(void)
924925
{
925-
stopVoices(); // VERY important! prevents potential crashes
926+
stopVoices(); // VERY important! prevents potential crashes by purging pointers
926927

927928
if (audio.locked)
928929
unlockAudio();
@@ -931,18 +932,21 @@ void unlockMixerCallback(void)
931932
void pauseAudio(void) // lock audio + clear voices/scopes + render silence (for long operations)
932933
{
933934
if (audioPaused)
935+
{
936+
stopVoices(); // VERY important! prevents potential crashes by purging pointers
934937
return;
938+
}
935939

936940
if (audio.dev > 0)
937941
SDL_PauseAudioDevice(audio.dev, true);
938942

939943
audio.resetSyncTickTimeFlag = true;
940944

941-
stopVoices(); // VERY important! prevents potential crashes
945+
stopVoices(); // VERY important! prevents potential crashes by purging pointers
946+
942947
// scopes, mixer and replayer are guaranteed to not be active at this point
943948

944949
resetSyncQueues();
945-
946950
audioPaused = true;
947951
}
948952

@@ -1092,10 +1096,10 @@ void updateSendAudSamplesRoutine(bool lockMixer)
10921096
lockMixerCallback();
10931097

10941098
// force dither off if somehow set with 24-bit float (illegal)
1095-
if (config.audioDither && (config.specialFlags & BITDEPTH_24))
1096-
config.audioDither = false;
1099+
if ((config.specialFlags2 & DITHERED_AUDIO) && (config.specialFlags & BITDEPTH_24))
1100+
config.specialFlags2 &= ~DITHERED_AUDIO;
10971101

1098-
if (config.audioDither)
1102+
if (config.specialFlags2 & DITHERED_AUDIO)
10991103
{
11001104
if (config.specialFlags & BITDEPTH_16)
11011105
{
@@ -1146,7 +1150,7 @@ static void calcAudioLatencyVars(uint16_t haveSamples, int32_t haveFreq)
11461150
dFrac *= UINT32_MAX + 1.0;
11471151
if (dFrac > (double)UINT32_MAX)
11481152
dFrac = (double)UINT32_MAX;
1149-
double2int32_round(audio.audLatencyPerfValFrac, dFrac);
1153+
audio.audLatencyPerfValFrac = (uint32_t)round(dFrac);
11501154

11511155
audio.dAudioLatencyMs = dAudioLatencySecs * 1000.0;
11521156
}
@@ -1279,8 +1283,8 @@ bool setupAudio(bool showErrorMsg)
12791283

12801284
calcAudioLatencyVars(have.samples, have.freq);
12811285

1282-
if (config.audioDither && newBitDepth == 24)
1283-
config.audioDither = false;
1286+
if ((config.specialFlags2 & DITHERED_AUDIO) && newBitDepth == 24)
1287+
config.specialFlags2 &= ~DITHERED_AUDIO;
12841288

12851289
pmpChannels = have.channels;
12861290
pmpCountDiv = pmpChannels * ((newBitDepth == 16) ? sizeof (int16_t) : sizeof (float));

src/ft2_audio.h

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
1-
#ifndef __FT2_AUDIO_H
2-
#define __FT2_AUDIO_H
1+
#pragma once
32

43
#include <stdint.h>
54
#include <stdbool.h>
@@ -113,5 +112,3 @@ extern pattSyncData_t *pattSyncEntry;
113112
extern chSyncData_t *chSyncEntry;
114113

115114
extern volatile bool pattQueueReading, pattQueueClearing, chQueueReading, chQueueClearing;
116-
117-
#endif

src/ft2_audioselector.h

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
1-
#ifndef __FT2_AUDIOSELECTOR_H
2-
#define __FT2_AUDIOSELECTOR_H
1+
#pragma once
32

43
#include <stdint.h>
54

@@ -20,5 +19,3 @@ void sbAudOutputSetPos(uint32_t pos);
2019
void sbAudInputSetPos(uint32_t pos);
2120
void freeAudioDeviceLists(void);
2221
void freeAudioDeviceSelectorBuffers(void);
23-
24-
#endif

src/ft2_checkboxes.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,8 @@ checkBox_t checkBoxes[NUM_CHECKBOXES] =
9090
{ 113, 79, 128, 12, cbConfigLineColors },
9191
{ 113, 92, 126, 12, cbConfigChanNums },
9292
{ 255, 14, 136, 12, cbConfigShowVolCol },
93+
{ 255, 158, 113, 12, cbHardwareMouse },
94+
// ---------------------------------
9395
{ 212, 2, 142, 12, cbSampCutToBuff },
9496
{ 212, 15, 145, 12, cbPattCutToBuff },
9597
{ 212, 28, 153, 12, cbKillNotesAtStop },

src/ft2_checkboxes.h

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
1-
#ifndef __FT2_CHECKBOXES_H
2-
#define __FT2_CHECKBOXES_H
1+
#pragma once
32

43
#include <stdint.h>
54
#include <stdbool.h>
@@ -68,6 +67,7 @@ enum // CHECKBOXES
6867
CB_CONF_LINECOLORS,
6968
CB_CONF_CHANNUMS,
7069
CB_CONF_SHOW_VOLCOL,
70+
CB_CONF_HARDWARE_MOUSE,
7171

7272
// CONFIG MISCELLANEOUS
7373
CB_CONF_SAMP_CUT_TO_BUF,
@@ -96,9 +96,9 @@ enum // CHECKBOXES
9696
enum
9797
{
9898
CHECKBOX_UNPRESSED = 0,
99-
CHECKBOX_PRESSED = 1,
99+
CHECKBOX_PRESSED = 1,
100100
CHECKBOX_UNCHECKED = 0,
101-
CHECKBOX_CHECKED = 1
101+
CHECKBOX_CHECKED = 1
102102
};
103103

104104
#define CHECKBOX_W 13
@@ -121,5 +121,3 @@ void hideCheckBox(uint16_t checkBoxID);
121121
void handleCheckBoxesWhileMouseDown(void);
122122
bool testCheckBoxMouseDown(void);
123123
void testCheckBoxMouseRelease(void);
124-
125-
#endif

0 commit comments

Comments
 (0)