2022-04-08 23:43:21 +02:00
# include <gint/display.h>
# include <gint/keyboard.h>
# include <gint/dma.h>
# include <gint/rtc.h>
2022-04-12 18:51:31 +02:00
# include <libprof.h>
2022-04-11 08:56:37 +02:00
# include <gint/usb.h>
# include <gint/usb-ff-bulk.h>
2022-04-08 23:43:21 +02:00
# include <math.h>
# include <stdlib.h>
# include <string.h>
2022-04-10 01:16:14 +02:00
# include "fixed.h"
2022-04-08 23:43:21 +02:00
# define MAXHEIGHT 200
2022-04-12 15:07:18 +02:00
# include "clock.h"
2022-04-08 23:43:21 +02:00
bool stop = false ;
2022-04-10 18:52:08 +02:00
bool skip_intro = false ;
2022-04-08 23:43:21 +02:00
uint8_t moduleToRun = 1 ;
2022-04-10 01:16:14 +02:00
uint8_t pagevisible = 0 ;
2022-04-08 23:43:21 +02:00
2022-04-11 08:56:37 +02:00
bool screenshot = false ;
bool record = false ;
2022-04-15 21:06:51 +02:00
extern font_t font_fantasy ;
2022-04-08 23:43:21 +02:00
size_t image_size_profile ( int profile , int width , int height )
{
size_t size = sizeof ( bopti_image_t ) ;
if ( profile = = 0 | | profile = = 1 ) // PX_RGB565, PX_RGB565A
size + = width * height * 2 ;
else if ( profile = = 2 ) // PX_P8
size + = 512 + width * height ;
else if ( profile = = 3 ) // PX_P4
size + = 32 + ( ( width + 1 ) / 2 ) * height ;
return size ;
}
int get_pixel ( bopti_image_t const * img , int x , int y )
{
if ( ( unsigned ) x > = img - > width | | ( unsigned ) y > = img - > height )
return 0 ;
uint8_t * bytes = ( void * ) img - > data ;
if ( img - > profile < = 1 )
return img - > data [ y * img - > width + x ] ;
if ( img - > profile = = 2 )
return bytes [ y * img - > width + x + 512 ] ;
if ( img - > profile = = 3 )
{
int s = ( img - > width + 1 ) > > 1 ;
int i = y * s + ( x > > 1 ) + 32 ;
if ( x & 1 )
return bytes [ i ] & 0x0f ;
else
return bytes [ i ] > > 4 ;
}
return 0 ;
}
void set_pixel ( bopti_image_t * img , int x , int y , int color )
{
if ( ( unsigned ) x > = img - > width | | ( unsigned ) y > = img - > height )
return ;
uint8_t * bytes = ( void * ) img - > data ;
if ( img - > profile < = 1 )
img - > data [ y * img - > width + x ] = color ;
else if ( img - > profile = = 2 )
bytes [ y * img - > width + x + 512 ] = color ;
else if ( img - > profile = = 3 )
{
int s = ( img - > width + 1 ) > > 1 ;
int i = y * s + ( x > > 1 ) + 32 ;
if ( x & 1 )
bytes [ i ] = ( bytes [ i ] & 0xf0 ) | ( color & 0x0f ) ;
else
bytes [ i ] = ( bytes [ i ] & 0x0f ) | ( ( color & 0x0f ) < < 4 ) ;
}
}
bopti_image_t * screen ;
uint16_t palette [ 256 ] ;
size_t palette_size = 512 ;
uint8_t imagedata [ DWIDTH * MAXHEIGHT ] ;
/********************************\
* PLASMA EFFECT - MODULE 1 *
* Specific data and structures *
\ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
static int aSin [ 512 ] ;
uint8_t index ;
static uint16_t pos1 = 0 , pos2 = 0 , pos3 = 0 , pos4 = 0 , tpos1 , tpos2 , tpos3 , tpos4 ;
uint16_t x ;
void init_module1 ( void )
{
for ( int i = 0 ; i < 64 ; + + i )
{
palette [ i ] = C_RGB ( i < < 2 , 255 - ( ( i < < 2 ) + 1 ) , 0 ) ;
palette [ i + 64 ] = C_RGB ( 255 , ( i < < 2 ) + 1 , 0 ) ;
palette [ i + 128 ] = C_RGB ( 255 - ( ( i < < 2 ) + 1 ) , 255 - ( ( i < < 2 ) + 1 ) , 0 ) ;
palette [ i + 192 ] = C_RGB ( 0 , ( i < < 2 ) + 1 , 0 ) ;
}
memcpy ( screen - > data , palette , palette_size ) ;
for ( int i = 0 ; i < 512 ; i + + )
{
float rad = ( ( float ) i * 0.703125 ) * 0.0174532 ; /* 360 / 512 * degree to rad, 360 degrees spread over 512 values to be able to use AND 512-1 instead of using modulo 360*/
aSin [ i ] = sin ( rad ) * 1024 ; /*using fixed point math with 1024 as base*/
}
}
void run_module1 ( void )
{
uint8_t * image = imagedata ;
tpos4 = pos4 ;
tpos3 = pos3 ;
for ( int i = 0 ; i < MAXHEIGHT ; + + i )
{
tpos1 = pos1 + 5 ;
tpos2 = pos2 + 3 ;
tpos3 & = 511 ;
tpos4 & = 511 ;
for ( int j = 0 ; j < DWIDTH ; + + j )
{
tpos1 & = 511 ;
tpos2 & = 511 ;
x = aSin [ tpos1 ] + aSin [ tpos2 ] + aSin [ tpos3 ] + aSin [ tpos4 ] ; /*actual plasma calculation*/
index = 128 + ( x > > 4 ) ; /*fixed point multiplication but optimized so basically it says (x * (64 * 1024) / (1024 * 1024)), x is already multiplied by 1024*/
* image + + = index ;
tpos1 + = 5 ;
tpos2 + = 3 ;
}
tpos4 + = 3 ;
tpos3 + = 1 ;
}
void * pos = screen - > data ;
pos + = palette_size ;
memcpy ( pos , imagedata , DWIDTH * MAXHEIGHT ) ;
dimage ( 0 , 0 , screen ) ;
pos1 + = 9 ;
pos3 + = 8 ;
}
/********************************\
* BLOBS EFFECT - MODULE 2 *
* Specific data and structures *
\ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
# define BLOB_RADIUS 30
# define BLOB_DRADIUS (BLOB_RADIUS * 2)
# define BLOB_SRADIUS (BLOB_RADIUS * BLOB_RADIUS)
# define NUMBER_OF_BLOBS 30 //40
uint8_t blob [ BLOB_DRADIUS ] [ BLOB_DRADIUS ] ;
typedef struct
{
uint16_t xpos , ypos ;
int8_t xdel , ydel ;
} BLOB ;
static BLOB blobs [ NUMBER_OF_BLOBS ] ;
void init_blob ( BLOB * blob )
{
blob - > xpos = rand ( ) % DWIDTH ; //(DWIDTH >> 1) - BLOB_RADIUS;
blob - > ypos = rand ( ) % MAXHEIGHT ; //(MAXHEIGHT >> 1) - BLOB_RADIUS;
while ( blob - > xdel = = 0 & & blob - > ydel = = 0 )
{
blob - > xdel = - 2 + rand ( ) % 5 ;
blob - > ydel = - 2 + rand ( ) % 5 ;
}
}
void init_module2 ( void )
{
uint32_t distance_squared ;
float fraction ;
for ( int i = 0 ; i < 32 ; + + i )
{
palette [ i ] = C_RGB ( i , i , i ) ;
}
memcpy ( screen - > data , palette , palette_size ) ;
for ( int i = - BLOB_RADIUS ; i < BLOB_RADIUS ; + + i )
{
for ( int j = - BLOB_RADIUS ; j < BLOB_RADIUS ; + + j )
{
distance_squared = i * i + j * j ;
if ( distance_squared < = BLOB_SRADIUS )
{
fraction = ( float ) distance_squared / ( float ) BLOB_SRADIUS ;
blob [ i + BLOB_RADIUS ] [ j + BLOB_RADIUS ] = pow ( ( 1.0 - ( fraction * fraction ) ) , 4.0 ) * 32.0 ;
}
else
blob [ i + BLOB_RADIUS ] [ j + BLOB_RADIUS ] = 0 ;
}
}
for ( int i = 0 ; i < NUMBER_OF_BLOBS ; i + + )
init_blob ( blobs + i ) ;
}
void run_module2 ( void )
{
uint8_t * image = imagedata ;
uint32_t start ;
//dma_memset(image, 0x01, DWIDTH*MAXHEIGHT); // set 1 to clear the screen as 0 is transparency
for ( int i = 0 ; i < MAXHEIGHT ; i + + )
for ( int j = 0 ; j < DWIDTH ; j + + )
image [ i * DWIDTH + j ] = 1 ;
for ( int i = 0 ; i < NUMBER_OF_BLOBS ; i + + )
{
blobs [ i ] . xpos + = blobs [ i ] . xdel ;
blobs [ i ] . ypos + = blobs [ i ] . ydel ;
}
for ( int k = 0 ; k < NUMBER_OF_BLOBS ; + + k )
{
if ( blobs [ k ] . xpos > 0 & & blobs [ k ] . xpos < DWIDTH - BLOB_DRADIUS & &
blobs [ k ] . ypos > 0 & & blobs [ k ] . ypos < MAXHEIGHT - BLOB_DRADIUS )
{
start = blobs [ k ] . xpos + blobs [ k ] . ypos * DWIDTH ;
for ( int i = 0 ; i < BLOB_DRADIUS ; + + i )
{
for ( int j = 0 ; j < BLOB_DRADIUS ; + + j )
{
if ( image [ start + j ] + blob [ i ] [ j ] > 31 )
image [ start + j ] = 31 ;
else
image [ start + j ] + = blob [ i ] [ j ] ;
}
start + = DWIDTH ;
}
}
else
init_blob ( blobs + k ) ;
}
void * pos = screen - > data ;
pos + = palette_size ;
memcpy ( pos , imagedata , DWIDTH * MAXHEIGHT ) ;
dimage ( 0 , 0 , screen ) ;
}
/********************************\
* LENS EFFECT - MODULE 3 *
* Specific data and structures *
\ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
# define LENS_WIDTH 120
# define LENS_ZOOM 20
extern bopti_image_t bglens ;
static uint32_t lens [ LENS_WIDTH ] [ LENS_WIDTH ] ;
int x3 = 16 , y3 = 16 ;
int xd = 1 , yd = 1 ;
void init_module3 ( void )
{
int i , x , y , r , d ;
r = LENS_WIDTH / 2 ;
d = LENS_ZOOM ;
for ( y = 0 ; y < LENS_WIDTH > > 1 ; y + + )
{
for ( x = 0 ; x < LENS_WIDTH > > 1 ; x + + )
{
int ix , iy , offset ;
if ( ( x * x + y * y ) < ( r * r ) )
{
float shift = d / sqrt ( d * d - ( x * x + y * y - r * r ) ) ;
ix = x * shift - x ;
iy = y * shift - y ;
}
else
{
ix = 0 ;
iy = 0 ;
}
offset = ( iy * DWIDTH + ix ) ;
lens [ LENS_WIDTH / 2 - y ] [ LENS_WIDTH / 2 - x ] = - offset ;
lens [ LENS_WIDTH / 2 + y ] [ LENS_WIDTH / 2 + x ] = offset ;
offset = ( - iy * DWIDTH + ix ) ;
lens [ LENS_WIDTH / 2 + y ] [ LENS_WIDTH / 2 - x ] = - offset ;
lens [ LENS_WIDTH / 2 - y ] [ LENS_WIDTH / 2 + x ] = offset ;
}
}
memcpy ( screen - > data , bglens . data , palette_size ) ;
}
void apply_lens ( int ox , int oy )
{
uint8_t * image = imagedata ;
uint8_t * back = bglens . data ;
back + = palette_size ;
memcpy ( image , back , DWIDTH * MAXHEIGHT ) ;
int x , y , temp , pos ;
for ( y = 0 ; y < LENS_WIDTH ; y + + )
{
temp = ( y + oy ) * DWIDTH + ox ;
for ( x = 0 ; x < LENS_WIDTH ; x + + )
{
pos = temp + x ;
image [ pos ] = back [ pos + lens [ y ] [ x ] ] ;
}
}
}
void run_module3 ( )
{
//dimage(0,0, &bglens);
apply_lens ( x3 , y3 ) ;
/* shift the coordinates around */
x3 + = xd ;
y3 + = yd ;
if ( x3 > ( DWIDTH - LENS_WIDTH - 1 ) | | x3 < 1 ) xd = - xd ;
if ( y3 > ( MAXHEIGHT - LENS_WIDTH - 1 ) | | y3 < 1 ) yd = - yd ;
void * pos = screen - > data ;
pos + = palette_size ;
memcpy ( pos , imagedata , DWIDTH * MAXHEIGHT ) ;
dimage ( 0 , 0 , screen ) ;
}
/********************************\
* STARFIELD EFFECT - MODULE 4 *
* Specific data and structures *
\ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
# define NUMBER_OF_STARS 1024
typedef struct
{
float xpos , ypos ;
short zpos , speed ;
uint8_t color ;
} STAR ;
static STAR stars [ NUMBER_OF_STARS ] ;
uint16_t centerx , centery ;
void init_star ( STAR * star , int i )
{
star - > xpos = - 10.0 + rand ( ) % 21 ;
star - > ypos = - 10.0 + rand ( ) % 21 ;
star - > xpos * = 3072.0 ;
star - > ypos * = 3072.0 ;
star - > zpos = i ;
star - > speed = 2 + rand ( ) % 5 ;
star - > color = i > > 2 ;
}
void init_module4 ( )
{
palette [ 0 ] = 0x0000 ;
for ( int i = 0 ; i < 255 ; + + i )
{
palette [ i ] = C_RGB ( i , i , i ) ;
}
memcpy ( screen - > data , palette , palette_size ) ;
for ( int i = 0 ; i < NUMBER_OF_STARS ; i + + )
{
init_star ( stars + i , i + 1 ) ;
}
}
void run_module4 ( )
{
uint8_t * image = imagedata ;
uint32_t start ;
int tempx , tempy ;
void * pos = screen - > data ;
pos + = palette_size ;
centerx = DWIDTH > > 1 ;
centery = MAXHEIGHT > > 1 ;
//dma_memset(image, 0x01, DWIDTH*MAXHEIGHT); // set 1 to clear the screen as 0 is transparency
for ( int i = 0 ; i < MAXHEIGHT ; i + + )
for ( int j = 0 ; j < DWIDTH ; j + + )
image [ i * DWIDTH + j ] = 1 ;
for ( int i = 0 ; i < NUMBER_OF_STARS ; i + + )
{
stars [ i ] . zpos - = stars [ i ] . speed ;
if ( stars [ i ] . zpos < = 0 )
{
init_star ( stars + i , i + 1 ) ;
}
/*compute 3D position*/
tempx = ( stars [ i ] . xpos / stars [ i ] . zpos ) + centerx ;
tempy = ( stars [ i ] . ypos / stars [ i ] . zpos ) + centery ;
if ( tempx < 1 | | tempx > DWIDTH | | tempy < 1 | | tempy > MAXHEIGHT )
{
init_star ( stars + i , i + 1 ) ;
continue ;
}
* ( ( uint8_t * ) imagedata + ( tempy * DWIDTH ) + tempx ) = stars [ i ] . color ;
}
memcpy ( pos , imagedata , DWIDTH * MAXHEIGHT ) ;
dimage ( 0 , 0 , screen ) ;
}
/********************************\
* RAINDROPS EFFECT - MODULE 5 *
* Specific data and structures *
\ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
extern bopti_image_t bglens2 ;
static const int max_array = DWIDTH * MAXHEIGHT ;
static const short amplitudes [ 4 ] = { - 250 , - 425 , - 350 , - 650 } ;
static short wavemap [ DWIDTH * MAXHEIGHT ] ;
static short old_wavemap [ DWIDTH * MAXHEIGHT ] ;
static short * p_old = old_wavemap ;
static short * p_new = wavemap ;
short * address_new , * address_old , * temp ;
short height , xdiff ;
uint8_t * pscreen , * pimage ;
void init_module5 ( )
{
for ( int i = 0 ; i < max_array ; + + i )
{
wavemap [ i ] = 0 ;
old_wavemap [ i ] = 0 ;
}
}
void start_drop ( )
{
uint32_t v , w ;
static const uint16_t b = DWIDTH - 10 ;
static const uint16_t c = DWIDTH * 10 ;
static const uint32_t d = ( DWIDTH * MAXHEIGHT ) - ( DWIDTH * 10 ) ;
static uint8_t amp_index = 0 ;
/* borders are invalid so keep trying till valid value*/
do
{
v = rand ( ) % max_array ;
w = v % DWIDTH ;
}
while ( w < 10 | | w > b | | v < c | | v > d ) ;
wavemap [ v ] = amplitudes [ amp_index + + ] ;
amp_index & = 4 ;
}
void run_module5 ( )
{
uint16_t t ;
start_drop ( ) ;
t = DWIDTH + 1 ;
address_new = p_new + t ;
address_old = p_old + t ;
for ( int i = 1 ; i < MAXHEIGHT - 1 ; + + i )
{
for ( int j = 1 ; j < DWIDTH - 1 ; + + j )
{
height = 0 ;
height + = * ( address_new + DWIDTH ) ;
height + = * ( address_new - 1 ) ;
height + = * ( address_new + 1 ) ;
height + = * ( address_new - DWIDTH ) ;
height > > = 1 ;
height - = * address_old ;
height - = height > > 5 ;
* address_old = height ;
address_new + + ;
address_old + + ;
}
address_new + = 2 ; /* next scanline starting at pos 1 */
address_old + = 2 ;
}
t = DWIDTH + 1 ;
address_old = p_old + t ;
pscreen = ( uint8_t * ) imagedata + t ;
pimage = ( uint8_t * ) bglens2 . data + palette_size + t ;
/* draw waves */
for ( int i = 1 ; i < MAXHEIGHT - 1 ; + + i )
{
for ( int j = 1 ; j < DWIDTH - 1 ; + + j )
{
xdiff = * ( address_old + 1 ) - * ( address_old ) ;
* pscreen = * ( pimage + xdiff ) ;
address_old + + ;
pscreen + + ;
pimage + + ;
}
address_old + = 2 ;
pscreen + = 2 ; /* next scanline starting at pos 1 */
pimage + = 2 ;
}
/* swap wave tables */
temp = p_new ;
p_new = p_old ;
p_old = temp ;
void * pos = screen - > data ;
memcpy ( pos , bglens2 . data , palette_size ) ;
pos + = palette_size ;
memcpy ( pos , imagedata , DWIDTH * MAXHEIGHT ) ;
dimage ( 0 , 0 , screen ) ;
}
/********************************\
* MATRIX EFFECT - MODULE 6 *
* Specific data and structures *
\ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
# define NUMBER_OF_STRIPS 80
# define CHAR_HEIGHT 14
# define CHAR_WIDTH 9
extern font_t matrix ;
typedef struct
{
int x ;
2022-04-10 01:16:14 +02:00
int y ;
int speed ;
int len ;
char str [ 32 ] ;
2022-04-08 23:43:21 +02:00
} STRIP ;
static STRIP strips [ NUMBER_OF_STRIPS ] ;
void init_strip ( STRIP * strip )
{
2022-04-10 01:16:14 +02:00
strip - > len = 5 + rand ( ) % 28 ;
strip - > x = rand ( ) % 45 ;
strip - > y = - 1 * strip - > len * CHAR_HEIGHT ;
strip - > speed = 1 + rand ( ) % 5 ;
2022-04-08 23:43:21 +02:00
2022-04-10 01:16:14 +02:00
for ( int j = 0 ; j < strips - > len ; j + + )
strip - > str [ j ] = ' ! ' + rand ( ) % 96 ;
2022-04-08 23:43:21 +02:00
}
void init_module6 ( )
{
for ( int k = 0 ; k < NUMBER_OF_STRIPS ; k + + )
{
init_strip ( strips + k ) ;
}
}
void run_module6 ( void )
{
for ( int k = 0 ; k < NUMBER_OF_STRIPS ; k + + )
{
strips [ k ] . y + = strips [ k ] . speed ;
}
for ( int k = 0 ; k < NUMBER_OF_STRIPS ; k + + )
{
for ( int j = 0 ; j < strips [ k ] . len ; j + + )
if ( strips [ k ] . y - j * CHAR_HEIGHT < = 200 - CHAR_HEIGHT )
{
if ( j = = 0 ) dprint ( strips [ k ] . x * CHAR_WIDTH , strips [ k ] . y - j * CHAR_HEIGHT , C_WHITE , " %c " , strips [ k ] . str [ j ] ) ;
2022-04-10 01:16:14 +02:00
else if ( j = = 0 ) dprint ( strips [ k ] . x * CHAR_WIDTH , strips [ k ] . y - j * CHAR_HEIGHT , C_RGB ( 150 , 255 , 150 ) , " %c " , strips [ k ] . str [ j ] ) ;
2022-04-08 23:43:21 +02:00
else if ( j = = 0 ) dprint ( strips [ k ] . x * CHAR_WIDTH , strips [ k ] . y - j * CHAR_HEIGHT , C_RGB ( 50 , 255 , 50 ) , " %c " , strips [ k ] . str [ j ] ) ;
else dprint ( strips [ k ] . x * CHAR_WIDTH , strips [ k ] . y - j * CHAR_HEIGHT , C_GREEN , " %c " , strips [ k ] . str [ j ] ) ;
}
if ( strips [ k ] . y - strips [ k ] . len * CHAR_HEIGHT > 200 - CHAR_HEIGHT )
init_strip ( strips + k ) ;
}
2022-04-10 01:16:14 +02:00
}
/********************************\
* FIRE EFFECT - MODULE 7 *
* Specific data and structures *
\ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
void init_module7 ( )
{
for ( int i = 0 ; i < MAXHEIGHT ; i + + )
for ( int j = 0 ; j < DWIDTH ; j + + )
imagedata [ i * DWIDTH + j ] = 1 ;
for ( int i = 0 ; i < 32 ; + + i )
{
// palette[i] = C_RGB( 0, 0, i<<1 );
// palette[i+32] = C_RGB( i<<3, 0, 64-(i<<1) );
// palette[i+64] = C_RGB( 255, i<<3, 0 );
// palette[i+96] = C_RGB( 255, 255, i<<2 );
// palette[i+128] = C_RGB( 255, 255, 64+(i<<2) );
// palette[i+160] = C_RGB( 255, 255, 128+(i<<2) );
// palette[i+192] = C_RGB( 255, 255, 192+i );
// palette[i+224] = C_RGB( 255, 255, 224+i );
palette [ i ] = C_RGB ( 0 , 0 , 0 ) ;
palette [ i + 32 ] = C_RGB ( i * 8 , 0 , 0 ) ;
palette [ i + 64 ] = C_RGB ( 255 , i * 8 , 0 ) ;
palette [ i + 96 ] = C_RGB ( 255 , 255 , i * 2 ) ;
palette [ i + 128 ] = C_RGB ( 255 , 255 , 64 + i ) ;
palette [ i + 160 ] = C_RGB ( 255 , 255 , 128 + i ) ;
palette [ i + 192 ] = C_RGB ( 255 , 255 , 192 + i ) ;
palette [ i + 224 ] = C_RGB ( 255 , 255 , 224 + i ) ;
}
memcpy ( screen - > data , palette , palette_size ) ;
}
void run_module7 ( void )
{
uint8_t * image = screen - > data ;
uint16_t temp ;
uint8_t index ;
int i , j ;
j = DWIDTH * ( MAXHEIGHT - 1 ) ;
for ( i = 0 ; i < DWIDTH - 1 ; i + + )
{
int random = 1 + rand ( ) % 16 ;
if ( random > 9 )
imagedata [ j + i ] = 255 ;
else
imagedata [ j + i ] = 0 ;
}
for ( index = 0 ; index < 60 ; + + index )
{
for ( i = 0 ; i < DWIDTH - 1 ; + + i )
{
if ( i = = 0 )
{
temp = imagedata [ j ] ;
temp + = imagedata [ j + 1 ] ;
temp + = imagedata [ j - DWIDTH ] ;
temp / = 3 ;
}
else if ( i = = DWIDTH - 1 )
{
temp = imagedata [ j + i ] ;
temp + = imagedata [ j - DWIDTH + i ] ;
temp + = imagedata [ j + i - 1 ] ;
temp / = 3 ;
}
else
{
temp = imagedata [ j + i ] ;
temp + = imagedata [ j + i + 1 ] ;
temp + = imagedata [ j + i - 1 ] ;
temp + = imagedata [ j - DWIDTH + i ] ;
temp > > = 2 ;
}
if ( temp > 1 )
temp - = 1 ;
imagedata [ j - DWIDTH + i ] = temp ;
}
j - = DWIDTH ;
}
image + = palette_size + ( DWIDTH * MAXHEIGHT ) ;
for ( i = MAXHEIGHT - 3 ; i > = 100 ; - - i )
{
for ( j = DWIDTH - 1 ; j > = 0 ; - - j )
{
* image = imagedata [ i * DWIDTH + j ] ;
image - - ;
}
}
void * pos = screen - > data ;
pos + = palette_size ;
memcpy ( pos , imagedata , DWIDTH * MAXHEIGHT ) ;
dimage ( 0 , 0 , screen ) ;
}
/********************************\
* JULIA FRACTAL SET - MODULE 8 *
* Specific data and structures *
\ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
int PIXELZOOM = 2 ;
int SPEED_UP = 1 ;
int SCR_WID_PIXEL ;
int SCR_HEI_PIXEL ;
int MAX_ITERATION ;
fixed_t cr , ci ;
fixed_t xmin , xmax , ymin , ymax ;
float rit = - 0.80f ;
float iit = - 1.0f ;
float si = 1.0 ;
float sr = 1.0 ;
void init_module8 ( )
{
PIXELZOOM = 2 ;
2022-04-10 17:48:01 +02:00
SPEED_UP = 2 ;
2022-04-10 01:16:14 +02:00
SCR_WID_PIXEL = DWIDTH / PIXELZOOM ;
SCR_HEI_PIXEL = MAXHEIGHT / PIXELZOOM ;
MAX_ITERATION = 256 / SPEED_UP ;
}
void draw_Julia ( float xmi , float ymi , float xma , float yma , float r , float i )
{
fixed_t zr , zi ;
int u ;
int maxiter = MAX_ITERATION ;
fixed_t tmp , zr2 , zi2 ;
fixed_t xinc , yinc , fi , fj ;
cr = fix ( r ) ;
ci = fix ( i ) ;
xmin = fix ( xmi ) ;
xmax = fix ( xma ) ;
ymin = fix ( ymi ) ;
ymax = fix ( yma ) ;
xinc = fdiv ( xmax - xmin , fix ( SCR_WID_PIXEL ) ) ;
yinc = fdiv ( ymax - ymin , fix ( SCR_HEI_PIXEL ) ) ;
for ( int j = 0 ; j < = SCR_HEI_PIXEL / 2 ; j + + )
{
fj = fix ( j ) ;
for ( int i = 0 ; i < = SCR_WID_PIXEL ; i + + )
{
fi = fix ( i ) ;
zr = xmin + fmul ( fi , xinc ) ;
zi = ymax - fmul ( fj , yinc ) ;
zi2 = fmul ( zi , zi ) ;
zr2 = fmul ( zr , zr ) ;
u = 0 ;
while ( ( ( zr2 + zi2 ) < fix ( 4 ) ) & & ( u < maxiter ) )
{
tmp = zr ;
zr2 = fmul ( zr , zr ) ;
zi2 = fmul ( zi , zi ) ;
zr = zr2 - zi2 + cr ;
zi = fmul ( fix ( 2 ) , fmul ( zi , tmp ) ) + ci ;
u + + ;
}
if ( u = = maxiter )
{
drect ( i * PIXELZOOM , j * PIXELZOOM , ( i + 1 ) * PIXELZOOM - 1 , ( j + 1 ) * PIXELZOOM - 1 , 0x0000 ) ;
drect ( DWIDTH - i * PIXELZOOM , MAXHEIGHT - j * PIXELZOOM , DWIDTH - ( i + 1 ) * PIXELZOOM + 1 , MAXHEIGHT - ( j + 1 ) * PIXELZOOM + 1 , 0x0000 ) ;
}
else
{
int sr = 0 ;
int sg = 0 ;
int sb = 0 ;
if ( u < MAX_ITERATION / 4 / SPEED_UP )
{
sr = 0 ;
sg = u * 4 * SPEED_UP ;
sb = 255 ;
}
else if ( u < 2 * MAX_ITERATION / 4 / SPEED_UP )
{
sr = 0 ;
sg = 255 ;
sb = ( 255 - ( u - MAX_ITERATION / 4 / SPEED_UP ) * 4 * SPEED_UP ) ;
}
else if ( u < 3 * MAX_ITERATION / 4 / SPEED_UP )
{
sr = ( u - 2 * MAX_ITERATION / 4 / SPEED_UP ) * 4 * SPEED_UP ;
sg = 255 ;
sb = 0 ;
}
else if ( u < MAX_ITERATION / SPEED_UP )
{
sr = 255 ;
sg = ( 256 - ( u - 3 * MAX_ITERATION / 4 / SPEED_UP ) * 4 * SPEED_UP ) ;
sb = 0 ;
}
drect ( i * PIXELZOOM , j * PIXELZOOM , ( i + 1 ) * PIXELZOOM - 1 , ( j + 1 ) * PIXELZOOM - 1 , C_RGB ( sr , sg , sb ) ) ;
drect ( DWIDTH - i * PIXELZOOM , MAXHEIGHT - j * PIXELZOOM , DWIDTH - ( i + 1 ) * PIXELZOOM + 1 , MAXHEIGHT - ( j + 1 ) * PIXELZOOM + 1 , C_RGB ( sr , sg , sb ) ) ;
}
}
}
}
2022-04-08 23:43:21 +02:00
2022-04-10 01:16:14 +02:00
void run_module8 ( void )
{
iit + = 0.01 * si ;
if ( iit < - 1.0 | | iit > 1.0 ) si * = - 1.0f ;
2022-04-08 23:43:21 +02:00
2022-04-10 01:16:14 +02:00
//rit += 0.01*sr;
//if (rit<-0.8 || rit>0.8) sr*=-1.0f;
2022-04-08 23:43:21 +02:00
2022-04-10 01:16:14 +02:00
draw_Julia ( - 1.98f , - 1.0f , 1.98f , 1.0f , rit , iit ) ;
2022-04-08 23:43:21 +02:00
}
2022-04-10 01:16:14 +02:00
/********************************\
* MANDELBROT SET - MODULE 9 *
* Specific data and structures *
\ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
float zoomfactor = 1.0f ;
float sens = 1.0f ;
void init_module9 ( )
{
zoomfactor = 1.0f ;
sens = 1.0f ;
2022-04-10 17:48:01 +02:00
PIXELZOOM = 3 ;
SPEED_UP = 2 ;
2022-04-10 01:16:14 +02:00
SCR_WID_PIXEL = DWIDTH / PIXELZOOM ;
SCR_HEI_PIXEL = MAXHEIGHT / PIXELZOOM ;
MAX_ITERATION = 256 / SPEED_UP ;
}
void draw_Mandelbrot ( float xmi , float ymi , float xma , float yma )
{
int u ;
int maxiter = MAX_ITERATION ;
fixed_t tmp , xinc , yinc , fi , fj , x , y , x2 , y2 , x0 , y0 , w ;
xmin = fix ( xmi ) ;
xmax = fix ( xma ) ;
ymin = fix ( ymi ) ;
ymax = fix ( yma ) ;
xinc = fdiv ( xmax - xmin , fix ( SCR_WID_PIXEL ) ) ;
yinc = fdiv ( ymax - ymin , fix ( SCR_HEI_PIXEL ) ) ;
for ( int j = 0 ; j < = SCR_HEI_PIXEL ; j + + )
{
fj = fix ( j ) ;
for ( int i = 0 ; i < = SCR_WID_PIXEL ; i + + )
{
fi = fix ( i ) ;
x0 = xmin + fmul ( fi , xinc ) ;
y0 = ymax - fmul ( fj , yinc ) ;
x = fix ( 0 ) ;
y = fix ( 0 ) ;
w = fix ( 0 ) ;
x2 = fmul ( x , x ) ;
y2 = fmul ( y , y ) ;
u = 0 ;
while ( ( x2 + y2 < = fix ( 4 ) ) & & ( u < maxiter ) )
{
x = x2 - y2 + x0 ;
y = w - x2 - y2 + y0 ;
x2 = fmul ( x , x ) ;
y2 = fmul ( y , y ) ;
w = fmul ( x + y , x + y ) ;
u + + ;
}
if ( u = = maxiter )
{
drect ( i * PIXELZOOM , j * PIXELZOOM , ( i + 1 ) * PIXELZOOM - 1 , ( j + 1 ) * PIXELZOOM - 1 , 0x0000 ) ;
//drect( i*PIXELZOOM, MAXHEIGHT-j*PIXELZOOM, (i+1)*PIXELZOOM+1, MAXHEIGHT-(j+1)*PIXELZOOM+1, 0x0000 );
}
else
{
int sr = 0 ;
int sg = 0 ;
int sb = 0 ;
if ( u < MAX_ITERATION / 4 / SPEED_UP )
{
sr = 0 ;
sg = u * 4 * SPEED_UP ;
sb = 255 ;
}
else if ( u < 2 * MAX_ITERATION / 4 / SPEED_UP )
{
sr = 0 ;
sg = 255 ;
sb = ( 255 - ( u - MAX_ITERATION / 4 / SPEED_UP ) * 4 * SPEED_UP ) ;
}
else if ( u < 3 * MAX_ITERATION / 4 / SPEED_UP )
{
sr = ( u - 2 * MAX_ITERATION / 4 / SPEED_UP ) * 4 * SPEED_UP ;
sg = 255 ;
sb = 0 ;
}
else if ( u < MAX_ITERATION / SPEED_UP )
{
sr = 255 ;
sg = ( 256 - ( u - 3 * MAX_ITERATION / 4 / SPEED_UP ) * 4 * SPEED_UP ) ;
sb = 0 ;
}
drect ( i * PIXELZOOM , j * PIXELZOOM , ( i + 1 ) * PIXELZOOM - 1 , ( j + 1 ) * PIXELZOOM - 1 , C_RGB ( sr , sg , sb ) ) ;
//drect( i*PIXELZOOM, MAXHEIGHT-j*PIXELZOOM, (i+1)*PIXELZOOM+1, MAXHEIGHT-(j+1)*PIXELZOOM+1, C_RGB(sr,sg,sb) );
}
}
}
}
void run_module9 ( void )
{
2022-04-10 17:48:01 +02:00
float x0 = - 0.16 - 4.0f / zoomfactor ;
float x1 = - 0.16 + 4.0f / zoomfactor ;
float y0 = 1.0405 - 1.5f / zoomfactor ;
float y1 = 1.0405 + 1.5f / zoomfactor ;
//float x0 = -0.7746806106269039 - 4.0f/zoomfactor;
//float x1 = -0.7746806106269039 + 4.0f/zoomfactor;
//float y0 = -0.1374168856037867 - 1.5f/zoomfactor;
//float y1 = -0.1374168856037867 + 1.5f/zoomfactor;
2022-04-10 01:16:14 +02:00
draw_Mandelbrot ( x0 , y0 , x1 , y1 ) ;
if ( sens > 0 ) zoomfactor * = 1.2f ;
else zoomfactor / = 1.2f ;
2022-04-11 08:56:37 +02:00
if ( zoomfactor > = 2000 | | zoomfactor < = 1 ) sens * = - 1 ;
2022-04-10 01:16:14 +02:00
}
2022-04-10 16:09:56 +02:00
/********************************\
* INFINITE BOBS - MODULE 10 *
* Specific data and structures *
\ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
extern bopti_image_t bglens3 , eye ;
static int xpath [ 2048 ] ;
static int ypath [ 2048 ] ;
2022-04-10 17:48:01 +02:00
# define NUMBER_OF_BOBS 512
2022-04-10 16:09:56 +02:00
uint32_t i = 0 , j = 40 , k , l , m ;
bool firstrun = true ;
void init_module10 ( )
{
int hw , hh ;
hw = ( DWIDTH - 36 ) > > 1 ;
hh = ( MAXHEIGHT - 36 ) > > 1 ;
/*create x and y values for the bob */
for ( int i = 0 ; i < 512 ; + + i )
{
double rad = ( ( float ) i * 2 * 0.703125 ) * 0.0174532 ; /* spread 360 degrees over 512 values and convert to rad */
xpath [ i ] = sin ( rad ) * hw + hw ;
ypath [ i ] = cos ( rad ) * hh + hh ;
xpath [ i + 512 ] = sin ( rad * 2.0 ) * hw + hw ;
ypath [ i + 512 ] = cos ( rad ) * hh + hh ;
xpath [ i + 1024 ] = sin ( rad ) * hw + hw ;
ypath [ i + 1024 ] = cos ( rad * 2.0 ) * hh + hh ;
xpath [ i + 1536 ] = sin ( rad * 2.0 ) * hw + hw ;
ypath [ i + 1536 ] = cos ( rad * 2.0 ) * hh + hh ;
}
}
void run_module10 ( void )
{
int indexstart ;
dimage ( 0 , 0 , & bglens3 ) ;
if ( firstrun )
{
if ( i < = NUMBER_OF_BOBS )
indexstart = 0 ;
else indexstart = i - NUMBER_OF_BOBS ;
for ( int k = indexstart ; k < = i ; k + + )
dimage ( xpath [ k % 2048 ] , ypath [ k % 2048 ] , & eye ) ;
}
i + + ;
//dimage( 100, 100, &eye );
}
2022-04-10 01:16:14 +02:00
2022-04-10 18:52:08 +02:00
/********************************\
* INTRODUCING THE CCJ DEMOS *
* Specific data and structures *
\ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
extern bopti_image_t SlyVTT , Selection ;
static char text [ ] = " CHILL CASIO JAM 2022 " ;
void run_intro ( void )
{
dclear ( C_BLACK ) ;
dimage ( 0 , 12 , & SlyVTT ) ;
dprint ( 175 , 25 , C_WHITE , " %s " , text ) ;
dimage ( 175 , 50 , & Selection ) ;
dprint ( 175 , 180 , C_WHITE , " PRESS EXE TO SELECT " ) ;
dprint ( 175 , 200 , C_WHITE , " OLDSCHOOL DEMO EFFECTS " ) ;
}
/* update movement of scroller */
2022-04-12 18:51:31 +02:00
uint8_t valueOC = 0 ;
2022-04-10 18:52:08 +02:00
2022-04-08 23:43:21 +02:00
static void get_minimum_inputs ( void )
{
key_event_t ev ;
while ( ( ev = pollevent ( ) ) . type ! = KEYEV_NONE )
{
}
2022-04-10 18:52:08 +02:00
if ( keydown ( KEY_EXE ) ) skip_intro = true ;
2022-04-08 23:43:21 +02:00
if ( keydown ( KEY_EXIT ) ) stop = true ;
2022-04-10 01:16:14 +02:00
if ( pagevisible = = 0 & & keydown ( KEY_F1 ) )
2022-04-08 23:43:21 +02:00
{
init_module1 ( ) ;
moduleToRun = 1 ;
}
2022-04-10 01:16:14 +02:00
if ( pagevisible = = 0 & & keydown ( KEY_F2 ) )
2022-04-08 23:43:21 +02:00
{
init_module2 ( ) ;
moduleToRun = 2 ;
}
2022-04-10 01:16:14 +02:00
if ( pagevisible = = 0 & & keydown ( KEY_F3 ) )
2022-04-08 23:43:21 +02:00
{
init_module3 ( ) ;
moduleToRun = 3 ;
}
2022-04-10 01:16:14 +02:00
if ( pagevisible = = 0 & & keydown ( KEY_F4 ) )
2022-04-08 23:43:21 +02:00
{
init_module4 ( ) ;
moduleToRun = 4 ;
}
2022-04-10 01:16:14 +02:00
if ( pagevisible = = 0 & & keydown ( KEY_F5 ) )
2022-04-08 23:43:21 +02:00
{
init_module5 ( ) ;
moduleToRun = 5 ;
}
2022-04-10 01:16:14 +02:00
if ( pagevisible = = 0 & & keydown ( KEY_F6 ) )
{
pagevisible = 1 ;
}
if ( pagevisible = = 1 & & keydown ( KEY_F1 ) )
{
pagevisible = 0 ;
}
if ( pagevisible = = 1 & & keydown ( KEY_F2 ) )
2022-04-08 23:43:21 +02:00
{
init_module6 ( ) ;
moduleToRun = 6 ;
}
2022-04-10 01:16:14 +02:00
if ( pagevisible = = 1 & & keydown ( KEY_F3 ) )
{
init_module7 ( ) ;
moduleToRun = 7 ;
}
if ( pagevisible = = 1 & & keydown ( KEY_F4 ) )
{
init_module8 ( ) ;
moduleToRun = 8 ;
}
if ( pagevisible = = 1 & & keydown ( KEY_F5 ) )
{
init_module9 ( ) ;
moduleToRun = 9 ;
}
2022-04-10 16:09:56 +02:00
if ( pagevisible = = 1 & & keydown ( KEY_F6 ) )
{
init_module10 ( ) ;
moduleToRun = 10 ;
}
2022-04-11 08:56:37 +02:00
if ( keydown ( KEY_7 ) ) screenshot = true ;
if ( keydown ( KEY_8 ) ) record = ! record ;
2022-04-12 15:07:18 +02:00
/// TEST OC
2022-04-12 18:51:31 +02:00
if ( keydown ( KEY_1 ) ) valueOC = clock_overclock ( OC_Default ) ;
if ( keydown ( KEY_2 ) ) valueOC = clock_overclock ( OC_PtuneF2 ) ;
if ( keydown ( KEY_3 ) ) valueOC = clock_overclock ( OC_PtuneF3 ) ;
if ( keydown ( KEY_4 ) ) valueOC = clock_overclock ( OC_PtuneF4 ) ;
if ( keydown ( KEY_5 ) ) valueOC = clock_overclock ( OC_PtuneF5 ) ;
2022-04-08 23:43:21 +02:00
}
int main ( void )
{
2022-04-12 18:51:31 +02:00
__printf_enable_fp ( ) ;
__printf_enable_fixed ( ) ;
2022-04-11 08:56:37 +02:00
usb_interface_t const * interfaces [ ] = { & usb_ff_bulk , NULL } ;
usb_open ( interfaces , GINT_CALL_NULL ) ;
2022-04-12 18:51:31 +02:00
prof_init ( ) ;
prof_t perf_render ;
uint32_t time_render = 0 ;
float dt = 1.0 ;
2022-04-12 15:07:18 +02:00
/// TEST OC
clock_overclock ( OC_Default ) ;
2022-04-10 01:16:14 +02:00
srand ( rtc_ticks ( ) ) ;
2022-04-08 23:43:21 +02:00
size_t size = image_size_profile ( 2 , DWIDTH , MAXHEIGHT ) ;
screen = malloc ( size ) ;
screen - > profile = 2 ;
screen - > alpha = 0 ;
screen - > width = DWIDTH ;
screen - > height = MAXHEIGHT ;
2022-04-10 01:16:14 +02:00
init_module1 ( ) ;
2022-04-08 23:43:21 +02:00
while ( ! stop )
{
2022-04-12 18:51:31 +02:00
dt = ( ( float ) time_render / 1000.0 ) ;
perf_render = prof_make ( ) ;
prof_enter ( perf_render ) ;
2022-04-08 23:43:21 +02:00
dclear ( C_BLACK ) ;
2022-04-15 21:06:51 +02:00
dfont ( & matrix ) ;
2022-04-10 18:52:08 +02:00
if ( skip_intro = = false )
2022-04-10 01:16:14 +02:00
{
2022-04-10 18:52:08 +02:00
run_intro ( ) ;
2022-04-10 01:16:14 +02:00
}
2022-04-10 18:52:08 +02:00
else
2022-04-10 01:16:14 +02:00
{
2022-04-10 18:52:08 +02:00
if ( moduleToRun = = 1 ) run_module1 ( ) ;
else if ( moduleToRun = = 2 ) run_module2 ( ) ;
else if ( moduleToRun = = 3 ) run_module3 ( ) ;
else if ( moduleToRun = = 4 ) run_module4 ( ) ;
else if ( moduleToRun = = 5 ) run_module5 ( ) ;
else if ( moduleToRun = = 6 ) run_module6 ( ) ;
else if ( moduleToRun = = 7 ) run_module7 ( ) ;
else if ( moduleToRun = = 8 ) run_module8 ( ) ;
else if ( moduleToRun = = 9 ) run_module9 ( ) ;
else if ( moduleToRun = = 10 ) run_module10 ( ) ;
if ( pagevisible = = 0 )
{
dprint_opt ( 33 , 212 , moduleToRun = = 1 ? C_RGB ( 255 , 0 , 0 ) : C_RGB ( 255 , 255 , 255 ) , C_NONE , DTEXT_CENTER , DTEXT_CENTER , " PLASMA " ) ;
dprint_opt ( 99 , 212 , moduleToRun = = 2 ? C_RGB ( 255 , 0 , 0 ) : C_RGB ( 255 , 255 , 255 ) , C_NONE , DTEXT_CENTER , DTEXT_CENTER , " BLOBS " ) ;
dprint_opt ( 165 , 212 , moduleToRun = = 3 ? C_RGB ( 255 , 0 , 0 ) : C_RGB ( 255 , 255 , 255 ) , C_NONE , DTEXT_CENTER , DTEXT_CENTER , " LENS " ) ;
dprint_opt ( 231 , 212 , moduleToRun = = 4 ? C_RGB ( 255 , 0 , 0 ) : C_RGB ( 255 , 255 , 255 ) , C_NONE , DTEXT_CENTER , DTEXT_CENTER , " STARS " ) ;
dprint_opt ( 297 , 212 , moduleToRun = = 5 ? C_RGB ( 255 , 0 , 0 ) : C_RGB ( 255 , 255 , 255 ) , C_NONE , DTEXT_CENTER , DTEXT_CENTER , " RAIN " ) ;
dprint_opt ( 363 , 212 , C_RGB ( 255 , 255 , 255 ) , C_NONE , DTEXT_CENTER , DTEXT_CENTER , " %c%c%c " , ' ! ' + 31 , ' ! ' + 31 , ' ! ' + 31 ) ;
}
else if ( pagevisible = = 1 )
{
dprint_opt ( 33 , 212 , C_RGB ( 255 , 255 , 255 ) , C_NONE , DTEXT_CENTER , DTEXT_CENTER , " %c%c%c " , ' ! ' - 1 , ' ! ' - 1 , ' ! ' - 1 ) ;
dprint_opt ( 99 , 212 , moduleToRun = = 6 ? C_RGB ( 255 , 0 , 0 ) : C_RGB ( 255 , 255 , 255 ) , C_NONE , DTEXT_CENTER , DTEXT_CENTER , " MATRIX " ) ;
dprint_opt ( 165 , 212 , moduleToRun = = 7 ? C_RGB ( 255 , 0 , 0 ) : C_RGB ( 255 , 255 , 255 ) , C_NONE , DTEXT_CENTER , DTEXT_CENTER , " FIRE " ) ;
dprint_opt ( 231 , 212 , moduleToRun = = 8 ? C_RGB ( 255 , 0 , 0 ) : C_RGB ( 255 , 255 , 255 ) , C_NONE , DTEXT_CENTER , DTEXT_CENTER , " JULIA " ) ;
dprint_opt ( 297 , 212 , moduleToRun = = 9 ? C_RGB ( 255 , 0 , 0 ) : C_RGB ( 255 , 255 , 255 ) , C_NONE , DTEXT_CENTER , DTEXT_CENTER , " MANDEL " ) ;
dprint_opt ( 363 , 212 , moduleToRun = = 10 ? C_RGB ( 255 , 0 , 0 ) : C_RGB ( 255 , 255 , 255 ) , C_NONE , DTEXT_CENTER , DTEXT_CENTER , " BOBS " ) ;
}
2022-04-10 01:16:14 +02:00
}
2022-04-08 23:43:21 +02:00
2022-04-15 21:06:51 +02:00
dfont ( & font_fantasy ) ;
2022-04-12 18:51:31 +02:00
dprint ( 1 , 1 , C_WHITE , " FPS %.0f " , ( float ) ( 1000.0f / dt ) ) ;
dprint ( 1 , 15 , C_WHITE , " OC STAT %d " , valueOC ) ;
2022-04-08 23:43:21 +02:00
dupdate ( ) ;
2022-04-12 18:51:31 +02:00
prof_leave ( perf_render ) ;
time_render = prof_time ( perf_render ) ;
2022-04-11 08:56:37 +02:00
if ( screenshot & & usb_is_open ( ) )
{
usb_fxlink_screenshot ( false ) ;
screenshot = false ;
}
if ( record & & usb_is_open ( ) )
{
usb_fxlink_videocapture ( false ) ;
}
2022-04-08 23:43:21 +02:00
get_minimum_inputs ( ) ;
}
2022-04-12 15:07:18 +02:00
/// TEST OC
clock_overclock ( OC_Default ) ;
2022-04-12 18:51:31 +02:00
prof_quit ( ) ;
usb_close ( ) ;
2022-04-08 23:43:21 +02:00
//free( screen );
return 1 ;
}