@@ -34,7 +34,7 @@ typedef struct StrobeAPI_private_s
34
34
double nexttime , lasttime , framerate ;
35
35
size_t mark ;
36
36
size_t PositiveNormal , PositiveBlack , NegativeNormal , NegativeBlack ;
37
- }StrobeAPI_private_t ;
37
+ } StrobeAPI_private_t ;
38
38
39
39
_inline double func_helper_StandardDeviation ( const double * data , int n )
40
40
{
@@ -73,7 +73,7 @@ _inline void GL_GenerateBlackFrame( void ) // Generates partial or full black fr
73
73
}
74
74
}
75
75
76
- _inline double func_helper_getCooldown ( StrobeAPI_t * self )
76
+ _inline double func_helper_getCooldown ( StrobeAPI_t * const self )
77
77
{
78
78
if ( 0 <= self -> protected -> cdTimer )
79
79
{
@@ -85,31 +85,31 @@ _inline double func_helper_getCooldown( StrobeAPI_t *self )
85
85
}
86
86
}
87
87
88
- _inline qboolean func_helper_isPhaseInverted ( StrobeAPI_t * self )
88
+ _inline qboolean func_helper_isPhaseInverted ( StrobeAPI_t * const self )
89
89
{
90
90
if ( self -> protected -> frameInfo & PHASE_INVERTED )
91
91
return true;
92
92
else
93
93
return false;
94
94
}
95
95
96
- _inline qboolean func_helper_isNormal ( StrobeAPI_t * self )
96
+ _inline qboolean func_helper_isNormal ( StrobeAPI_t * const self )
97
97
{
98
98
if ( self -> protected -> frameInfo & FRAME_RENDER )
99
99
return true;
100
100
else
101
101
return false;
102
102
}
103
103
104
- _inline qboolean func_helper_isPositive ( StrobeAPI_t * self ) // ...
104
+ _inline qboolean func_helper_isPositive ( StrobeAPI_t * const self ) // ...
105
105
{
106
106
if ( self -> protected -> frameInfo & PHASE_POSITIVE )
107
107
return true;
108
108
else
109
109
return false;
110
110
}
111
111
112
- _inline double func_helper_effectiveFPS ( StrobeAPI_t * self )
112
+ _inline double func_helper_effectiveFPS ( StrobeAPI_t * const self )
113
113
{
114
114
int strobeInterval = StrobeAPI .r_strobe -> integer ;
115
115
double eFPS ;
@@ -127,7 +127,7 @@ _inline double func_helper_effectiveFPS( StrobeAPI_t *self )
127
127
return eFPS ;
128
128
}
129
129
130
- _inline void func_helper_GenerateDiffBar ( StrobeAPI_t * self , char * src , int size , char type )
130
+ _inline void func_helper_GenerateDiffBar ( StrobeAPI_t * const self , char * src , int size , char type )
131
131
{
132
132
char _barCounter = 0 ;
133
133
int diff_NB = 0 ;
@@ -239,7 +239,7 @@ _inline void func_helper_GenerateDiffBar( StrobeAPI_t *self, char *src, int size
239
239
}
240
240
}
241
241
242
- _inline double func_pwmsimulation_Frequency ( StrobeAPI_t * self )
242
+ _inline double func_pwmsimulation_Frequency ( StrobeAPI_t * const self )
243
243
{
244
244
return ( 1 / ( ( 1.0f / self -> Helpers .CurrentFPS ( self ) ) * ( abs ( StrobeAPI .r_strobe -> integer ) + 1 ) ) );
245
245
}
@@ -250,23 +250,23 @@ _inline double func_pwmsimulation_DutyCycle( void )
250
250
return ( ( ( 1.0f / ( abs ( strobeInterval ) + 1 ) ) * 100 ) * ( strobeInterval < 0 ? - strobeInterval : 1 ) );
251
251
}
252
252
253
- _inline double func_pwmsimulation_PositivePhaseShift ( StrobeAPI_t * self )
253
+ _inline double func_pwmsimulation_PositivePhaseShift ( StrobeAPI_t * const self )
254
254
{
255
255
if ( !!( self -> protected -> frameInfo & PHASE_INVERTED ) )
256
256
return ( 1.0f / self -> Helpers .CurrentFPS ( self ) ) * 1000 ;
257
257
else
258
258
return 0.0f ;
259
259
}
260
260
261
- _inline double func_pwmsimulation_NegativePhaseShift ( StrobeAPI_t * self )
261
+ _inline double func_pwmsimulation_NegativePhaseShift ( StrobeAPI_t * const self )
262
262
{
263
263
if ( !!( self -> protected -> frameInfo & PHASE_INVERTED ) )
264
264
return abs ( StrobeAPI .r_strobe -> integer ) * ( 1.0f / self -> Helpers .CurrentFPS ( self ) ) * 1000 ;
265
265
else
266
266
return 0.0 ;
267
267
}
268
268
269
- _inline double func_pwmsimulation_Period ( StrobeAPI_t * self )
269
+ _inline double func_pwmsimulation_Period ( StrobeAPI_t * const self )
270
270
{
271
271
return ( ( ( 1.0f / self -> Helpers .CurrentFPS ( self ) ) * ( abs ( StrobeAPI .r_strobe -> integer ) + 1 ) ) * 1000 );
272
272
}
@@ -281,32 +281,32 @@ _inline double func_helper_ArithmeticMean( double x, double y )
281
281
return ( x + y ) / 2 ;
282
282
}
283
283
284
- _inline double func_brightnessreduction_ActualBrightnessReduction ( StrobeAPI_t * self )
284
+ _inline double func_brightnessreduction_ActualBrightnessReduction ( StrobeAPI_t * const self )
285
285
{
286
286
return lossCalculator ( self -> Helpers .CurrentFPS ( self ), self -> Helpers .effectiveFPS ( self ) );
287
287
}
288
288
289
- _inline double func_brightnessreduction_LogarithmicBrightnessReduction ( StrobeAPI_t * self , double base )
289
+ _inline double func_brightnessreduction_LogarithmicBrightnessReduction ( StrobeAPI_t * const self , double base )
290
290
{
291
291
return lossCalculator ( log ( base ), log ( base * self -> Helpers .effectiveFPS ( self ) / self -> Helpers .CurrentFPS ( self ) ) );
292
292
}
293
293
294
- _inline double func_brightnessreduction_SquareBrightnessReduction ( StrobeAPI_t * self , double base )
294
+ _inline double func_brightnessreduction_SquareBrightnessReduction ( StrobeAPI_t * const self , double base )
295
295
{
296
296
return lossCalculator ( sqrt ( base ), sqrt ( base * self -> Helpers .effectiveFPS ( self ) / self -> Helpers .CurrentFPS ( self ) ) );
297
297
}
298
298
299
- _inline double func_brightnessreduction_CubeBrightnessReduction ( StrobeAPI_t * self , double base )
299
+ _inline double func_brightnessreduction_CubeBrightnessReduction ( StrobeAPI_t * const self , double base )
300
300
{
301
301
return lossCalculator ( cbrt ( base ), cbrt ( base * self -> Helpers .effectiveFPS ( self ) / self -> Helpers .CurrentFPS ( self ) ) );
302
302
}
303
303
304
- _inline double func_brightnessreduction_OtherBrightnessReduction ( StrobeAPI_t * self , double base , double ( * reductionFunction )( double ) )
304
+ _inline double func_brightnessreduction_OtherBrightnessReduction ( StrobeAPI_t * const self , double base , double ( * reductionFunction )( double ) )
305
305
{
306
306
return lossCalculator ( reductionFunction ( base ), reductionFunction ( base * self -> Helpers .effectiveFPS ( self ) / self -> Helpers .CurrentFPS ( self ) ) );
307
307
}
308
308
309
- _inline double func_experimental_Badness_Reducted ( StrobeAPI_t * self , qboolean PWMInvolved )
309
+ _inline double func_experimental_Badness_Reducted ( StrobeAPI_t * const self , qboolean PWMInvolved )
310
310
{
311
311
double badness , Diff ;
312
312
int diffP_NB , diffN_NB ;
@@ -340,7 +340,7 @@ _inline double func_experimental_Badness_Reducted( StrobeAPI_t *self, qboolean P
340
340
return badness ;
341
341
}
342
342
343
- _inline double func_experimental_Badness ( StrobeAPI_t * self , qboolean PWMInvolved )
343
+ _inline double func_experimental_Badness ( StrobeAPI_t * const self , qboolean PWMInvolved )
344
344
{
345
345
int diffP_NB , diffN_NB ;
346
346
double diffP = 0.0 , diffN = 0.0 ;
@@ -369,7 +369,7 @@ _inline double func_experimental_Badness( StrobeAPI_t *self, qboolean PWMInvolve
369
369
return badness ;
370
370
}
371
371
372
- _inline size_t func_get_FrameCounter ( StrobeAPI_t * self , STROBE_counterType type )
372
+ _inline size_t func_get_FrameCounter ( StrobeAPI_t * const self , STROBE_counterType type )
373
373
{
374
374
switch ( type )
375
375
{
@@ -410,7 +410,7 @@ _inline size_t func_get_FrameCounter( StrobeAPI_t *self, STROBE_counterType type
410
410
}
411
411
}
412
412
413
- _inline double func_get_currentFPS ( StrobeAPI_t * self )
413
+ _inline double func_get_currentFPS ( StrobeAPI_t * const self )
414
414
{
415
415
// Copied from SCR_DrawFps
416
416
// This way until current fps becomes global!!!
@@ -421,15 +421,15 @@ _inline double func_get_currentFPS( StrobeAPI_t *self )
421
421
if ( newtime >= self -> private -> nexttime )
422
422
{
423
423
self -> private -> framerate = ( self -> protected -> fCounter - self -> private -> mark ) / ( newtime - self -> private -> lasttime );
424
- self -> private -> lasttime = newtime ;
425
- self -> private -> nexttime = max (self -> private -> nexttime + 0.35 , self -> private -> lasttime - 0.35 );
424
+ self -> private -> lasttime = newtime ;
425
+ self -> private -> nexttime = max ( self -> private -> nexttime + 0.35 , self -> private -> lasttime - 0.35 );
426
426
self -> private -> mark = self -> protected -> fCounter ;
427
427
}
428
428
429
429
return self -> private -> framerate ;
430
430
}
431
431
432
- _inline void GenerateDebugStatistics ( StrobeAPI_t * self , char * src , int size )
432
+ _inline void GenerateDebugStatistics ( StrobeAPI_t * const self , char * src , int size )
433
433
{
434
434
char diffBarP [128 ], diffBarN [128 ], diffBarT [128 ];
435
435
size_t nPositiveNormal , nPositiveBlack , nNegativeNormal , nNegativeBlack ;
@@ -459,7 +459,7 @@ _inline void GenerateDebugStatistics( StrobeAPI_t *self, char *src, int size )
459
459
size ,
460
460
"%.2f FPS\n%.2f eFPS\n"
461
461
"Elapsed Time: %.2f\n"
462
- "isPhaseInverted = %d\n"
462
+ "isPhaseInverted = %d\n"
463
463
"Total Frame Count: %zu\n"
464
464
"^7(+) Phase Frame Count: %zu\n"
465
465
"%s\n"
@@ -492,7 +492,7 @@ _inline void GenerateDebugStatistics( StrobeAPI_t *self, char *src, int size )
492
492
self -> Helpers .CurrentFPS ( self ),
493
493
self -> Helpers .effectiveFPS ( self ),
494
494
self -> protected -> elapsedTime ,
495
- self -> Helpers .isPhaseInverted (self ),
495
+ self -> Helpers .isPhaseInverted ( self ),
496
496
self -> get .FrameCounter ( self , STROBE_CT_TotalFrame ),
497
497
self -> get .FrameCounter ( self , STROBE_CT_PositiveFrame ),
498
498
( nPositiveNormal > self -> private -> PositiveNormal ? va ( "^2|-> Normal Frame Count: %zu^7" , nPositiveNormal ) : va ( "|-> Normal Frame Count: %zu" , nPositiveNormal ) ), // Should be white instead of ^7 but white is not available in the color table
@@ -527,7 +527,7 @@ _inline void GenerateDebugStatistics( StrobeAPI_t *self, char *src, int size )
527
527
self -> private -> NegativeBlack = self -> get .FrameCounter ( self , STROBE_CT_NegativeBlackFrame );
528
528
}
529
529
530
- _inline void ProcessFrame ( StrobeAPI_t * self )
530
+ _inline void ProcessFrame ( StrobeAPI_t * const self )
531
531
{
532
532
if ( self -> protected -> cdTriggered != false )
533
533
{
@@ -557,12 +557,12 @@ _inline void ProcessFrame( StrobeAPI_t *self )
557
557
++ self -> protected -> fCounter ;
558
558
}
559
559
560
- _inline void StrobeAPI_constructor ( StrobeAPI_t * self )
560
+ _inline void StrobeAPI_constructor ( StrobeAPI_t * const self )
561
561
{
562
562
self -> protected = (StrobeAPI_protected_t * )calloc ( 1 , sizeof ( StrobeAPI_protected_t ) );
563
- self -> private = (StrobeAPI_private_t * )calloc (1 , sizeof (StrobeAPI_private_t ) );
563
+ self -> private = (StrobeAPI_private_t * )calloc ( 1 , sizeof ( StrobeAPI_private_t ) );
564
564
565
- if (self -> protected == NULL || self -> private == NULL )
565
+ if ( self -> protected == NULL || self -> private == NULL )
566
566
{
567
567
return ; // Fix handling!
568
568
}
@@ -596,9 +596,9 @@ _inline void StrobeAPI_constructor( StrobeAPI_t *self )
596
596
self -> Helpers .GenerateDebugStatistics = GenerateDebugStatistics ;
597
597
}
598
598
599
- _inline void StrobeAPI_destructor ( StrobeAPI_t * self )
599
+ _inline void StrobeAPI_destructor ( StrobeAPI_t * const self )
600
600
{
601
- if (self -> private )
601
+ if ( self -> private )
602
602
{
603
603
free ( self -> private );
604
604
self -> private = NULL ;
@@ -610,7 +610,7 @@ _inline void StrobeAPI_destructor( StrobeAPI_t *self )
610
610
}
611
611
}
612
612
613
- _inline void StrobeAPI_Invoker ( void * * self , void ( * constructor )( void * * ), void ( * main )( void * * ), void ( * destructor )( void * * ) )
613
+ _inline void StrobeAPI_Invoker ( const void * const * const self , void ( * constructor )( const void * const * const ), void ( * main )( const void * const * const ), void ( * destructor )( const void * const * const ) )
614
614
{
615
615
if ( StrobeAPI .r_strobe -> integer )
616
616
{
0 commit comments