annotate src/projectm/main.c @ 1608:e423bdc4b4d5

Simplify xs_is_our_file_vfs().
author Matti Hamalainen <ccr@tnsp.org>
date Fri, 07 Sep 2007 06:46:01 +0300
parents 761e17b23e0c
children c0463e51c338
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
358
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
1 /*
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
2 xmms-projectM v0.99 - xmms-projectm.sourceforge.net
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
3 --------------------------------------------------
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
4
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
5 Lead Developers: Carmelo Piccione (cep@andrew.cmu.edu) &
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
6 Peter Sperl (peter@sperl.com)
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
7
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
8 We have also been advised by some professors at CMU, namely Roger B. Dannenberg.
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
9 http://www-2.cs.cmu.edu/~rbd/
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
10
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
11 The inspiration for this program was Milkdrop by Ryan Geiss. Obviously.
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
12
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
13 This code is distributed under the GPL.
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
14
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
15
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
16 THANKS FOR THE CODE!!!
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
17 -------------------------------------------------
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
18 The base for this program was andy@nobugs.org's XMMS plugin tutorial
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
19 http://www.xmms.org/docs/vis-plugin.html
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
20
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
21 We used some FFT code by Takuya OOURA instead of XMMS' built-in fft code
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
22 fftsg.c - http://momonga.t.u-tokyo.ac.jp/~ooura/fft.html
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
23
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
24 For font rendering we used GLF by Roman Podobedov
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
25 glf.c - http://astronomy.swin.edu.au/~pbourke/opengl/glf/
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
26
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
27 and some beat detection code was inspired by Frederic Patin @
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
28 www.gamedev.net/reference/programming/features/beatdetection/
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
29
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
30 */
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
31
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
32
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
33 #include <stdio.h>
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
34 #include <audacious/plugin.h>
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
35 #include <string.h>
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
36 #include <stdlib.h>
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
37 #include <gtk/gtk.h>
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
38 #include <audacious/util.h>
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
39 #include <SDL/SDL.h>
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
40 #include <SDL/SDL_thread.h>
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
41 #include <GL/gl.h>
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
42 #include <GL/glu.h>
1035
711ec8d39ca6 [svn] Changed alarm and projectm plugins so they use auddrct now.
magma
parents: 663
diff changeset
43 #include <audacious/auddrct.h>
358
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
44 #include <math.h>
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
45 #include <sys/stat.h>
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
46 #include <sys/types.h>
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
47
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
48 #include <projectM/projectM.h>
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
49 #include <projectM/console_interface.h>
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
50 #include "sdltoprojectM.h"
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
51 #include "video_init.h"
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
52
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
53 #if HAVE_CONFIG_H
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
54 #include <config.h>
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
55 #endif
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
56 #define CONFIG_FILE "/config"
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
57 #define PRESETS_DIR "/presets"
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
58 #define FONTS_DIR "/fonts"
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
59
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
60 // Forward declarations
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
61 static void projectM_xmms_init(void);
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
62 static void projectM_cleanup(void);
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
63 static void projectM_about(void);
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
64 static void projectM_configure(void);
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
65 static void projectM_playback_start(void);
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
66 static void projectM_playback_stop(void);
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
67 static void projectM_render_pcm(gint16 pcm_data[2][512]);
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
68 static void projectM_render_freq(gint16 pcm_data[2][256]);
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
69 void read_config();
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
70
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
71
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
72 //extern preset_t * active_preset;
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
73
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
74 // Callback functions
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
75 VisPlugin projectM_vtable = {
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
76 NULL, // Handle, filled in by xmms
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
77 NULL, // Filename, filled in by xmms
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
78 "projectM v0.99", // description
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
79 2, // # of PCM channels for render_pcm()
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
80 0, // # of freq channels wanted for render_freq()
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
81 projectM_xmms_init, // Called when plugin is enabled
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
82 projectM_cleanup, // Called when plugin is disabled
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
83 projectM_about, // Show the about box
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
84 projectM_configure, // Show the configure box
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
85 NULL, // Called to disable plugin, filled in by xmms
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
86 projectM_playback_start, // Called when playback starts
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
87 projectM_playback_stop, // Called when playback stops
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
88 projectM_render_pcm, // Render the PCM data, must return quickly
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
89 projectM_render_freq // Render the freq data, must return quickly
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
90 };
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
91
1139
038298d9fbe3 [svn] - projectm: convert to plugin2 architecture. now SVN users have milkdrop back.
nenolod
parents: 1061
diff changeset
92 VisPlugin *projectM_vplist[] = { &projectM_vtable, NULL };
038298d9fbe3 [svn] - projectm: convert to plugin2 architecture. now SVN users have milkdrop back.
nenolod
parents: 1061
diff changeset
93
1395
761e17b23e0c added Discovery plugin type
Cristi Magherusan <majeru@atheme-project.org>
parents: 1139
diff changeset
94 DECLARE_PLUGIN(projectm, NULL, NULL, NULL, NULL, NULL, NULL, projectM_vplist,NULL);
358
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
95
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
96 // Our worker thread
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
97 SDL_Thread *worker_thread;
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
98
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
99 SDL_mutex *mutex;
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
100
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
101 SDL_sem *sem;
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
102
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
103 SDL_Event event;
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
104
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
105 SDL_Surface *screen;
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
106 //SDL_RenderTarget *RenderTarget = NULL;
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
107 //GLuint RenderTargetTextureID;
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
108
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
109 projectM_t *globalPM = NULL;
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
110
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
111 int maxsamples=512;
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
112
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
113 int texsize=512;
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
114 int gx=32,gy=24;
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
115 int wvw=640,wvh=480;
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
116 int fvw=1280,fvh=960;
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
117 int fps=30, fullscreen=0;
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
118 char *disp;
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
119
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
120 int disable_projectm(void) {
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
121 projectM_vtable.disable_plugin(&projectM_vtable);
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
122 return 0;
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
123 }
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
124
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
125 int get_xmms_title(void) {
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
126 static char check_title = 1;
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
127 static int last_pos;
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
128 static char *last_title = NULL;
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
129 int pos;
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
130 char *title = NULL;
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
131
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
132 //Nice optimization, but we want the title no matter what so I can display it when the song changes
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
133 #if 0
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
134 if(!(globalPM->showtitle%2)) {
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
135 /* Repeat less often when not showing title */
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
136 return 1000;
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
137 }
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
138 #endif
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
139
1035
711ec8d39ca6 [svn] Changed alarm and projectm plugins so they use auddrct now.
magma
parents: 663
diff changeset
140 pos = audacious_drct_pl_get_pos();
358
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
141 /* Only check every 1 second for title change, otherwise check pos */
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
142 if(check_title || pos != last_pos) {
1035
711ec8d39ca6 [svn] Changed alarm and projectm plugins so they use auddrct now.
magma
parents: 663
diff changeset
143 title = audacious_drct_pl_get_title(pos);
358
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
144 if(title && (!last_title || strcmp(last_title,title))) {
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
145 globalPM->title = title;
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
146 globalPM->drawtitle = 1;
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
147 g_free(last_title);
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
148 last_title = title;
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
149 } else if(title && last_title != title) {
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
150 /* New copy of last title */
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
151 g_free(title);
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
152 }
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
153 check_title = !check_title;
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
154 }
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
155 last_pos = pos;
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
156 /* Repeat every 500ms */
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
157 return 500;
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
158 }
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
159
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
160 void worker_func()
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
161 {
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
162 char projectM_data[PATH_MAX];
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
163
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
164 SDL_TimerID title_timer = NULL;
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
165
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
166
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
167 read_config();
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
168
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
169 init_display(wvw,wvh,fullscreen);
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
170
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
171 SDL_WM_SetCaption("projectM v0.99", "projectM v0.99");
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
172
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
173
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
174 /** Initialise projectM */
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
175
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
176 globalPM = (projectM_t *)malloc( sizeof( projectM_t ) );
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
177
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
178 projectM_reset( globalPM );
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
179
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
180 globalPM->fullscreen = fullscreen;
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
181 globalPM->renderTarget->texsize = texsize;
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
182 globalPM->gx=gx;
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
183 globalPM->gy=gy;
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
184 globalPM->fps=fps;
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
185 globalPM->renderTarget->usePbuffers=0;
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
186
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
187 strcpy(projectM_data, PROJECTM_DATADIR);
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
188 strcpy(projectM_data+strlen(PROJECTM_DATADIR), FONTS_DIR);
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
189 projectM_data[strlen(PROJECTM_DATADIR)+strlen(FONTS_DIR)]='\0';
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
190
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
191 globalPM->fontURL = (char *)malloc( sizeof( char ) * 512 );
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
192 strcpy( globalPM->fontURL, projectM_data );
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
193
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
194 strcpy(projectM_data+strlen(PROJECTM_DATADIR), PRESETS_DIR);
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
195 projectM_data[strlen(PROJECTM_DATADIR)+strlen(PRESETS_DIR)]='\0';
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
196
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
197 globalPM->presetURL = (char *)malloc( sizeof( char ) * 512 );
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
198 strcpy( globalPM->presetURL, projectM_data );
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
199
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
200
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
201 projectM_init( globalPM );
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
202
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
203 projectM_resetGL( globalPM, wvw, wvh );
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
204
663
aaab0bede198 [svn] Cast those pointers properly, and do not use deprecated GTK+ functions.
chainsaw
parents: 358
diff changeset
205 title_timer = SDL_AddTimer(500, (SDL_NewTimerCallback) get_xmms_title, NULL);
358
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
206
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
207 /** Initialise the thread */
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
208
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
209 SDL_SemTryWait(sem);
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
210 while ( SDL_SemTryWait(sem) ) {
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
211 projectMEvent evt;
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
212 projectMKeycode key;
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
213 projectMModifier mod;
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
214
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
215 /** Process SDL events */
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
216 SDL_Event event;
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
217 while ( SDL_PollEvent( &event ) ) {
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
218 /** Translate into projectM codes and process */
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
219 evt = sdl2pmEvent( event );
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
220 key = sdl2pmKeycode( event.key.keysym.sym );
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
221 mod = sdl2pmModifier( event.key.keysym.mod );
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
222
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
223 if ( evt == PROJECTM_KEYDOWN ) {
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
224
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
225
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
226 if(key == SDLK_f)
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
227 {
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
228 int w, h;
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
229 if (fullscreen == 0) {
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
230 w = fvw;
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
231 h = fvh;
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
232 } else {
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
233 w = wvw;
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
234 h = wvh;
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
235 }
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
236 globalPM->fullscreen = fullscreen ^= 1;
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
237 resize_display(w, h, fullscreen);
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
238 projectM_resetGL( globalPM, w, h );
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
239 }
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
240 else key_handler(globalPM,evt,key,mod);
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
241
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
242 }
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
243 else if ( evt == PROJECTM_VIDEORESIZE )
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
244 {
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
245 wvw=event.resize.w;
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
246 wvh=event.resize.h;
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
247 resize_display(wvw, wvh, 0);
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
248 projectM_resetGL( globalPM, wvw, wvh );
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
249
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
250 }
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
251 else if ( evt == PROJECTM_VIDEOQUIT ) {
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
252
663
aaab0bede198 [svn] Cast those pointers properly, and do not use deprecated GTK+ functions.
chainsaw
parents: 358
diff changeset
253 (void) g_idle_add ((GSourceFunc) disable_projectm, NULL);
358
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
254 /* if(quit_timer == NULL)
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
255 quit_timer = SDL_AddTimer(500, disable_projectm, NULL);*/
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
256 }
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
257
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
258 }
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
259
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
260
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
261 /** Render the new frame */
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
262
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
263 renderFrame( globalPM );
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
264
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
265 SDL_GL_SwapBuffers();
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
266 }
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
267
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
268
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
269
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
270 printf("Worker thread: Exiting\n");
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
271 if(title_timer) SDL_RemoveTimer(title_timer);
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
272 g_free(globalPM->title);
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
273 free(globalPM->presetURL);
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
274 free(globalPM->fontURL);
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
275 free(globalPM);
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
276 close_display();
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
277 }
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
278
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
279 static void projectM_xmms_init(void)
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
280 {
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
281
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
282 printf("projectM plugin: Initializing\n");
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
283
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
284 SDL_EnableUNICODE(1);
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
285
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
286 mutex = SDL_CreateMutex();
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
287
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
288 sem = SDL_CreateSemaphore(1);
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
289
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
290 worker_thread = SDL_CreateThread ((void *) worker_func, NULL);
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
291
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
292 }
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
293
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
294
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
295
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
296 static void projectM_cleanup(void)
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
297 {
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
298
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
299 SDL_SemPost(sem);
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
300 SDL_WaitThread(worker_thread, NULL);
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
301
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
302 SDL_DestroySemaphore(sem);
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
303 printf("Destroy Semaphore\n");
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
304 SDL_DestroyMutex(mutex);
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
305 printf("Destroy Mutex\n");
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
306
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
307 printf("projectM plugin: Cleanup completed\n");
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
308 }
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
309 static void projectM_about(void)
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
310 {
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
311 printf("projectM plugin: About\n");
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
312 }
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
313 static void projectM_configure(void)
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
314 {
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
315 printf("projectM plugin: Configure\n");
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
316 }
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
317 static void projectM_playback_start(void)
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
318 {
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
319 printf("projectM plugin: Playback starting\n");
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
320 }
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
321 static void projectM_playback_stop(void)
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
322 {
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
323 printf("projectM plugin: Playback stopping\n");
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
324 }
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
325 static void projectM_render_pcm(gint16 pcm_data[2][512])
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
326 {
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
327
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
328 if (0 < SDL_SemValue(sem)) return;
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
329 SDL_mutexP(mutex);
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
330
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
331 addPCM16Data(pcm_data,512);
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
332
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
333 SDL_mutexV(mutex);
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
334
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
335 }
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
336
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
337 static void projectM_render_freq(gint16 freq_data[2][256])
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
338 {
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
339 printf("NO GOOD\n");
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
340 }
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
341
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
342
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
343 void read_config()
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
344 {
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
345
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
346 int n;
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
347
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
348 char num[80];
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
349 FILE *in;
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
350 FILE *out;
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
351
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
352 char* home;
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
353 char projectM_home[PATH_MAX];
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
354 char projectM_config[PATH_MAX];
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
355
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
356 strcpy(projectM_config, PROJECTM_DATADIR);
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
357 strcpy(projectM_config+strlen(PROJECTM_DATADIR), CONFIG_FILE);
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
358 projectM_config[strlen(PROJECTM_DATADIR)+strlen(CONFIG_FILE)]='\0';
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
359
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
360 home=getenv("HOME");
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
361 strcpy(projectM_home, home);
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
362 strcpy(projectM_home+strlen(home), "/.projectM/config");
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
363 projectM_home[strlen(home)+strlen("/.projectM/config")]='\0';
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
364
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
365
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
366 if ((in = fopen(projectM_home, "r")) != 0)
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
367 {
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
368 printf("reading ~/.projectM/config \n");
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
369 }
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
370 else
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
371 {
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
372 printf("trying to create ~/.projectM/config \n");
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
373
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
374 strcpy(projectM_home, home);
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
375 strcpy(projectM_home+strlen(home), "/.projectM");
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
376 projectM_home[strlen(home)+strlen("/.projectM")]='\0';
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
377 mkdir(projectM_home,0755);
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
378
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
379 strcpy(projectM_home, home);
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
380 strcpy(projectM_home+strlen(home), "/.projectM/config");
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
381 projectM_home[strlen(home)+strlen("/.projectM/config")]='\0';
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
382
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
383 if((out = fopen(projectM_home,"w"))!=0)
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
384 {
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
385
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
386 if ((in = fopen(projectM_config, "r")) != 0)
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
387 {
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
388
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
389 while(fgets(num,80,in)!=NULL)
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
390 {
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
391 fputs(num,out);
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
392 }
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
393 fclose(in);
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
394 fclose(out);
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
395
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
396
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
397 if ((in = fopen(projectM_home, "r")) != 0)
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
398 { printf("created ~/.projectM/config successfully\n"); }
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
399 else{printf("This shouldn't happen, using implementation defualts\n");return;}
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
400 }
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
401 else{printf("Cannot find projectM default config, using implementation defaults\n");return;}
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
402 }
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
403 else
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
404 {
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
405 printf("Cannot create ~/.projectM/config, using default config file\n");
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
406 if ((in = fopen(projectM_config, "r")) != 0)
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
407 { printf("Successfully opened default config file\n");}
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
408 else{ printf("Using implementation defaults, your system is really messed up, I'm suprised we even got this far\n"); return;}
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
409
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
410 }
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
411
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
412 }
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
413
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
414
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
415
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
416 fgets(num, 80, in); fgets(num, 80, in); fgets(num, 80, in);
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
417 if(fgets(num, 80, in) != NULL) sscanf (num, "%d", &texsize);
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
418
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
419 fgets(num, 80, in);
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
420 if(fgets(num, 80, in) != NULL) sscanf (num, "%d", &gx);
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
421
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
422 fgets(num, 80, in);
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
423 if(fgets(num, 80, in) != NULL) sscanf (num, "%d", &gy);
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
424
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
425 fgets(num, 80, in);
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
426 if(fgets(num, 80, in) != NULL) sscanf (num, "%d", &wvw);
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
427
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
428 fgets(num, 80, in);
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
429 if(fgets(num, 80, in) != NULL) sscanf (num, "%d", &wvh);
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
430
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
431 fgets(num, 80, in);
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
432 if(fgets(num, 80, in) != NULL) sscanf (num, "%d", &fvw);
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
433
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
434 fgets(num, 80, in);
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
435 if(fgets(num, 80, in) != NULL) sscanf (num, "%d", &fvh);
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
436
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
437 fgets(num, 80, in);
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
438 if(fgets(num, 80, in) != NULL) sscanf (num, "%d", &fps);
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
439
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
440 fgets(num, 80, in);
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
441 if(fgets(num, 80, in) != NULL) sscanf (num, "%d", &fullscreen);
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
442 /*
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
443 fgets(num, 80, in);
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
444 fgets(num, 80, in);
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
445
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
446 n=0;
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
447 while (num[n]!=' ' && num[n]!='\n' && n < 80 && num[n]!=EOF)
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
448 {
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
449 disp[n]=num[n];
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
450 n++;
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
451 }
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
452 disp[n]=0;
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
453
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
454
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
455 // sprintf(disp,"%s",num );
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
456 setenv("DISPLAY",disp,1);
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
457 printf("%s %d\n", disp,strlen(disp));
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
458 setenv("LD_PRELOAD", "/usr/lib/tls/libGL.so.1.0.4496", 1);
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
459 */
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
460 fclose(in);
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
461
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
462 }