mirror of
https://github.com/projectM-visualizer/projectm.git
synced 2026-03-09 08:55:02 +00:00
git-svn-id: https://projectm.svn.sourceforge.net/svnroot/projectm/personal/carm/dev-1.0@348 6778bc44-b910-0410-a7a0-be141de4315d
This commit is contained in:
@ -10,22 +10,22 @@ using namespace std;
|
||||
#include <sys/stat.h>
|
||||
#include <sys/types.h>
|
||||
|
||||
#include <config.h>
|
||||
#include <libvisual/libvisual.h>
|
||||
#include <libprojectM/BeatDetect.hpp>
|
||||
#include <libprojectM/PCM.hpp>
|
||||
#include <libprojectM/projectM.hpp>
|
||||
#include <libprojectM/console_interface.h>
|
||||
#include "lvtoprojectM.hpp"
|
||||
#include "lvtoprojectM.h"
|
||||
|
||||
#define CONFIG_FILE "/share/projectM/config.1.00"
|
||||
#define FONTS_DIR "/share/projectM/fonts"
|
||||
|
||||
|
||||
#if HAVE_CONFIG_H
|
||||
#include <config.h>
|
||||
#endif
|
||||
#define CONFIG_FILE "/config"
|
||||
#define PRESETS_DIR "/presets"
|
||||
#define FONTS_DIR "/fonts"
|
||||
|
||||
void read_config();
|
||||
|
||||
char preset_dir[1024];
|
||||
char fonts_dir[1024];
|
||||
int texsize=512;
|
||||
int gx=32,gy=24;
|
||||
int wvw=512,wvh=512;
|
||||
@ -109,35 +109,27 @@ extern "C" int lv_projectm_init (VisPluginData *plugin)
|
||||
visual_object_set_private (VISUAL_OBJECT (plugin), priv);
|
||||
|
||||
//FIXME
|
||||
priv->PM = visual_mem_new0 (projectM, 1);
|
||||
priv->PM = new projectM();
|
||||
//globalPM = (projectM *)wipemalloc( sizeof( projectM ) );
|
||||
priv->PM->projectM_reset();
|
||||
|
||||
|
||||
//projectM_reset( globalPM );
|
||||
|
||||
priv->PM->fullscreen = 0; //fullscreen;
|
||||
priv->PM->renderTarget->texsize = texsize;
|
||||
priv->PM->renderTarget->usePbuffers = 1;
|
||||
priv->PM->gx=gx;
|
||||
priv->PM->gy=gy;
|
||||
priv->PM->fps=fps;
|
||||
|
||||
|
||||
strcpy(projectM_data, PROJECTM_DATADIR);
|
||||
strcpy(projectM_data+strlen(PROJECTM_DATADIR), FONTS_DIR);
|
||||
projectM_data[strlen(PROJECTM_DATADIR)+strlen(FONTS_DIR)]='\0';
|
||||
|
||||
priv->PM->fontURL = (char *)malloc( sizeof( char ) * 1024 );
|
||||
strcpy( priv->PM->fontURL, projectM_data );
|
||||
|
||||
priv->PM->fontURL = (char *)malloc( sizeof( char ) * 512 );
|
||||
strcpy( priv->PM->fontURL, projectM_data );
|
||||
|
||||
strcpy(projectM_data+strlen(PROJECTM_DATADIR), PRESETS_DIR);
|
||||
projectM_data[strlen(PROJECTM_DATADIR)+strlen(PRESETS_DIR)]='\0';
|
||||
|
||||
priv->PM->presetURL = (char *)malloc( sizeof( char ) * 512 );
|
||||
strcpy( priv->PM->presetURL, projectM_data );
|
||||
priv->PM->presetURL = (char *)malloc( sizeof( char ) * 1024 );
|
||||
strcpy( priv->PM->presetURL, preset_dir );
|
||||
|
||||
|
||||
//projectM_reset( globalPM );
|
||||
priv->PM->projectM_init(gx, gy, fps, texsize, fullscreen ? fvw:wvw, fullscreen? fvh:wvh);
|
||||
|
||||
|
||||
|
||||
priv->PM->projectM_init();
|
||||
|
||||
priv->PM->projectM_resetGL( wvw, wvh );
|
||||
|
||||
@ -267,13 +259,12 @@ extern "C" int lv_projectm_render (VisPluginData *plugin, VisVideo *video, VisAu
|
||||
}
|
||||
|
||||
|
||||
|
||||
void read_config()
|
||||
{
|
||||
|
||||
int n;
|
||||
|
||||
char num[80];
|
||||
char num[512];
|
||||
FILE *in;
|
||||
FILE *out;
|
||||
|
||||
@ -284,20 +275,20 @@ void read_config()
|
||||
strcpy(projectM_config, PROJECTM_DATADIR);
|
||||
strcpy(projectM_config+strlen(PROJECTM_DATADIR), CONFIG_FILE);
|
||||
projectM_config[strlen(PROJECTM_DATADIR)+strlen(CONFIG_FILE)]='\0';
|
||||
|
||||
printf("dir:%s \n",projectM_config);
|
||||
home=getenv("HOME");
|
||||
strcpy(projectM_home, home);
|
||||
strcpy(projectM_home+strlen(home), "/.projectM/config");
|
||||
projectM_home[strlen(home)+strlen("/.projectM/config")]='\0';
|
||||
strcpy(projectM_home+strlen(home), "/.projectM/config.1.00");
|
||||
projectM_home[strlen(home)+strlen("/.projectM/config.1.00")]='\0';
|
||||
|
||||
|
||||
if ((in = fopen(projectM_home, "r")) != 0)
|
||||
{
|
||||
printf("reading ~/.projectM/config \n");
|
||||
printf("reading ~/.projectM/config.1.00 \n");
|
||||
}
|
||||
else
|
||||
{
|
||||
printf("trying to create ~/.projectM/config \n");
|
||||
printf("trying to create ~/.projectM/config.1.00 \n");
|
||||
|
||||
strcpy(projectM_home, home);
|
||||
strcpy(projectM_home+strlen(home), "/.projectM");
|
||||
@ -305,8 +296,8 @@ void read_config()
|
||||
mkdir(projectM_home,0755);
|
||||
|
||||
strcpy(projectM_home, home);
|
||||
strcpy(projectM_home+strlen(home), "/.projectM/config");
|
||||
projectM_home[strlen(home)+strlen("/.projectM/config")]='\0';
|
||||
strcpy(projectM_home+strlen(home), "/.projectM/config.1.00");
|
||||
projectM_home[strlen(home)+strlen("/.projectM/config.1.00")]='\0';
|
||||
|
||||
if((out = fopen(projectM_home,"w"))!=0)
|
||||
{
|
||||
@ -323,14 +314,14 @@ void read_config()
|
||||
|
||||
|
||||
if ((in = fopen(projectM_home, "r")) != 0)
|
||||
{ printf("created ~/.projectM/config successfully\n"); }
|
||||
{ printf("created ~/.projectM/config.1.00 successfully\n"); }
|
||||
else{printf("This shouldn't happen, using implementation defualts\n");return;}
|
||||
}
|
||||
else{printf("Cannot find projectM default config, using implementation defaults\n");return;}
|
||||
}
|
||||
else
|
||||
{
|
||||
printf("Cannot create ~/.projectM/config, using default config file\n");
|
||||
printf("Cannot create ~/.projectM/config.1.00, using default config file\n");
|
||||
if ((in = fopen(projectM_config, "r")) != 0)
|
||||
{ printf("Successfully opened default config file\n");}
|
||||
else{ printf("Using implementation defaults, your system is really messed up, I'm suprised we even got this far\n"); return;}
|
||||
@ -341,32 +332,31 @@ void read_config()
|
||||
|
||||
|
||||
|
||||
fgets(num, 80, in); fgets(num, 80, in); fgets(num, 80, in);
|
||||
if(fgets(num, 80, in) != NULL) sscanf (num, "%d", &texsize);
|
||||
fgets(num, 512, in); fgets(num, 512, in); fgets(num, 512, in);
|
||||
if(fgets(num, 512, in) != NULL) sscanf (num, "%d", &texsize);
|
||||
|
||||
fgets(num, 80, in);
|
||||
if(fgets(num, 80, in) != NULL) sscanf (num, "%d", &gx);
|
||||
fgets(num, 512, in);
|
||||
if(fgets(num, 512, in) != NULL) sscanf (num, "%d", &gx);
|
||||
|
||||
fgets(num, 80, in);
|
||||
if(fgets(num, 80, in) != NULL) sscanf (num, "%d", &gy);
|
||||
fgets(num, 512, in);
|
||||
if(fgets(num, 512, in) != NULL) sscanf (num, "%d", &gy);
|
||||
|
||||
fgets(num, 80, in);
|
||||
if(fgets(num, 80, in) != NULL) sscanf (num, "%d", &wvw);
|
||||
fgets(num, 512, in);
|
||||
if(fgets(num, 512, in) != NULL) sscanf (num, "%d", &wvw);
|
||||
|
||||
fgets(num, 80, in);
|
||||
if(fgets(num, 80, in) != NULL) sscanf (num, "%d", &wvh);
|
||||
fgets(num, 512, in);
|
||||
if(fgets(num, 512, in) != NULL) sscanf (num, "%d", &wvh);
|
||||
|
||||
fgets(num, 512, in);
|
||||
if(fgets(num, 512, in) != NULL) sscanf (num, "%d", &fps);
|
||||
|
||||
fgets(num, 80, in);
|
||||
if(fgets(num, 80, in) != NULL) sscanf (num, "%d", &fvw);
|
||||
fgets(num, 512, in);
|
||||
if(fgets(num, 512, in) != NULL) sscanf (num, "%d", &fullscreen);
|
||||
fgets(num, 512, in);
|
||||
|
||||
fgets(num, 80, in);
|
||||
if(fgets(num, 80, in) != NULL) sscanf (num, "%d", &fvh);
|
||||
|
||||
fgets(num, 80, in);
|
||||
if(fgets(num, 80, in) != NULL) sscanf (num, "%d", &fps);
|
||||
|
||||
fgets(num, 80, in);
|
||||
if(fgets(num, 80, in) != NULL) sscanf (num, "%d", &fullscreen);
|
||||
if(fgets(num, 512, in) != NULL) strcpy(preset_dir, num);
|
||||
preset_dir[strlen(preset_dir)-1]='\0';
|
||||
|
||||
/*
|
||||
fgets(num, 80, in);
|
||||
fgets(num, 80, in);
|
||||
@ -388,3 +378,5 @@ void read_config()
|
||||
fclose(in);
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user