Skip to content

Commit c7aa0b6

Browse files
authored
Merge pull request #1 from lmirel/dev
build fix
2 parents 95bbed0 + d772a22 commit c7aa0b6

File tree

11 files changed

+49
-281
lines changed

11 files changed

+49
-281
lines changed

clients/assetto-corsa/Makefile

+3-3
Original file line numberDiff line numberDiff line change
@@ -8,16 +8,16 @@ program_INCLUDE_DIRS :=
88
program_LIBRARY_DIRS :=
99
program_LIBRARIES :=
1010

11-
CPPFLAGS += $(foreach includedir,$(program_INCLUDE_DIRS),-I$(includedir))
11+
CPPFLAGS += $(foreach includedir,$(program_INCLUDE_DIRS),-I$(includedir)) -std=c99
1212
LDFLAGS += $(foreach librarydir,$(program_LIBRARY_DIRS),-L$(librarydir))
13-
LDFLAGS += $(foreach library,$(program_LIBRARIES),-l$(library))
13+
LDLIBS += $(foreach library,$(program_LIBRARIES),-l$(library))
1414

1515
.PHONY: all clean distclean
1616

1717
all: $(program_NAME)
1818

1919
$(program_NAME): $(program_OBJS)
20-
$(LINK.cc) $(program_OBJS) -o $(program_NAME)
20+
$(LINK.cc) $(program_OBJS) $(LDLIBS) -o $(program_NAME)
2121

2222
clean:
2323
@- $(RM) $(program_NAME)

clients/assetto-corsa/ac-cli.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -346,7 +346,7 @@ int main (int argc, char **argv, char **envp)
346346
switch (argv[i][1])
347347
{
348348
case 'c': //roll %
349-
snprintf (_pp_ps4, 49, argv[i]+2);
349+
snprintf (_pp_ps4, 49, "%s", argv[i]+2);
350350
pp_ps4 = _pp_ps4;
351351
break;
352352
//profiling params

clients/cm-f1/Makefile

+3-3
Original file line numberDiff line numberDiff line change
@@ -8,16 +8,16 @@ program_INCLUDE_DIRS :=
88
program_LIBRARY_DIRS :=
99
program_LIBRARIES :=
1010

11-
CPPFLAGS += $(foreach includedir,$(program_INCLUDE_DIRS),-I$(includedir))
11+
CPPFLAGS += $(foreach includedir,$(program_INCLUDE_DIRS),-I$(includedir)) -std=c99
1212
LDFLAGS += $(foreach librarydir,$(program_LIBRARY_DIRS),-L$(librarydir))
13-
LDFLAGS += $(foreach library,$(program_LIBRARIES),-l$(library))
13+
LDLIBS += $(foreach library,$(program_LIBRARIES),-l$(library))
1414

1515
.PHONY: all clean distclean
1616

1717
all: $(program_NAME)
1818

1919
$(program_NAME): $(program_OBJS)
20-
$(LINK.cc) $(program_OBJS) -o $(program_NAME)
20+
$(LINK.cc) $(program_OBJS) $(LDLIBS) -o $(program_NAME)
2121

2222
clean:
2323
@- $(RM) $(program_NAME)

clients/pcars/Makefile

+3-3
Original file line numberDiff line numberDiff line change
@@ -8,16 +8,16 @@ program_INCLUDE_DIRS :=
88
program_LIBRARY_DIRS :=
99
program_LIBRARIES :=
1010

11-
CPPFLAGS += $(foreach includedir,$(program_INCLUDE_DIRS),-I$(includedir))
11+
CPPFLAGS += $(foreach includedir,$(program_INCLUDE_DIRS),-I$(includedir)) -std=c99
1212
LDFLAGS += $(foreach librarydir,$(program_LIBRARY_DIRS),-L$(librarydir))
13-
LDFLAGS += $(foreach library,$(program_LIBRARIES),-l$(library))
13+
LDLIBS += $(foreach library,$(program_LIBRARIES),-l$(library))
1414

1515
.PHONY: all clean distclean
1616

1717
all: $(program_NAME)
1818

1919
$(program_NAME): $(program_OBJS)
20-
$(LINK.cc) $(program_OBJS) -o $(program_NAME)
20+
$(LINK.cc) $(program_OBJS) $(LDLIBS) -o $(program_NAME)
2121

2222
clean:
2323
@- $(RM) $(program_NAME)

lib/extras.c

+2-214
Original file line numberDiff line numberDiff line change
@@ -280,56 +280,9 @@ void mfc_bcast_close ()
280280
mfc_bcast_sock = -1;
281281
}
282282

283-
//x-sim 2.x and 3.x
284-
// Memory map of buffer sent via network
285-
//
286-
// integer function
287-
// 0-6 Joystick axis
288-
// 7-166 40 data of Yoda 4 Bytes per value: 1=active 2=data 3=play 4=type
289-
// 87-166 20 data of plugin 4 bytes per value: 1=1 2=data 3=1 4=99
290-
// 7-166 40 overwrite positions for force injector / only if needed
291-
// 167-174 8 integer with joy button value
292-
// 175 autostart trigger
293-
// 176-218 43 extended gauge data (only x-sim 2 and up)
294-
//This means integer 175, is far I know it may be inverted?
295-
//This is a inrace detection, there maybe a difference to the ingame time.
296-
//A integer has 4 bytes. Some my be used multible.
297-
//There maybe a change that enlarge the packet in one of the next versions but will not change the front area
298-
typedef struct sEvtPacket {
299-
int joystick[7];
300-
int plugin[40][4]; //might need additional byte from auxdata
301-
//int yoda[40]; //might need additional byte from auxdata
302-
//int plugin[20]; //might need additional byte from auxdata
303-
//int forceinjector[40];
304-
//
305-
//int auxdata[60];
306-
//
307-
int joybutton[8];
308-
int autostart;
309-
int gaugedata[43];
310-
//
311-
int padding[1];
312-
} SEvtPacket;
313-
314-
typedef enum eGaugeData
315-
{
316-
gSpeed = 0,
317-
gRpm,
318-
gFuel,
319-
gFuelTemp,
320-
gGear,
321-
gLapNumber,
322-
gBestLapTime,
323-
gLastLapTime,
324-
gPosition,
325-
gWaterTemp,
326-
gFlags,
327-
gTimeStamp
328-
} EGaugeData;
329283

330284
int bcast_sock = -1;
331285
struct sockaddr_in si_other;
332-
SEvtPacket pkt = {0};
333286
void bcast_prep (char *dst)
334287
{
335288
//sockets
@@ -375,11 +328,9 @@ void bcast_prep (char *dst)
375328
}
376329
#endif
377330
bcast_sock = s;
378-
pkt.gaugedata[gFlags] = -1;
379-
pkt.gaugedata[gGear] = 0;
380-
pkt.gaugedata[gRpm] = -1;
381331
}
382332

333+
#if 0
383334
void bcast_send ()
384335
{
385336
#if 1
@@ -391,177 +342,14 @@ void bcast_send ()
391342
// printf ("%d .pkt %d sent\n", pkt.gaugedata[gTimeStamp], pktk);
392343
#endif
393344
}
345+
#endif
394346

395347
void bcast_close ()
396348
{
397349
if (bcast_sock > 0)
398350
close (bcast_sock);
399351
}
400352

401-
/*
402-
* serial led control
403-
*/
404-
int _maxg = 6;
405-
406-
int opt_gear_max (int g)
407-
{
408-
static int mlg = 0;
409-
char cg = 0;
410-
if (g == 0 && mlg == -1)
411-
{
412-
_maxg--;
413-
cg++;
414-
}
415-
if (g == 0 && mlg == 1)
416-
{
417-
_maxg++;
418-
cg++;
419-
}
420-
mlg = g;
421-
return cg;
422-
}
423-
424-
void s7led_gear_max (int g)
425-
{
426-
if (opt_gear_max (g))
427-
{
428-
char cgear[5];
429-
snprintf (cgear, 4, "m%2d", _maxg);
430-
s7ledS_send (cgear);
431-
//
432-
bcast_send ();
433-
}
434-
}
435-
436-
static int opt_gear (int g);
437-
void s7led_gear (int g)
438-
{
439-
char cgear[15] = {0x79, 3, };
440-
switch (opt_gear_get())
441-
{
442-
case 0:
443-
snprintf (cgear+2, 4, "n");
444-
break;
445-
case -1:
446-
snprintf (cgear+2, 4, "r");
447-
break;
448-
default:
449-
snprintf (cgear+2, 4, "%1d", opt_gear_get());
450-
}
451-
s7ledS_sendCmd (cgear, 3);
452-
//s7ledS_send (cgear);
453-
}
454-
455-
static int opt_gear (int g)
456-
{
457-
static int mgear = 0;
458-
static int lg = 0;
459-
char cg = 0;
460-
if (g == 0 && lg == -1)
461-
{
462-
if (mgear > -1)
463-
mgear--;
464-
cg++;
465-
}
466-
if (g == 0 && lg == 1)
467-
{
468-
if (mgear < _maxg)
469-
mgear++;
470-
cg++;
471-
}
472-
lg = g;
473-
if (cg)
474-
{
475-
pkt.gaugedata[gGear] = mgear;
476-
s7led_gear (mgear);
477-
}
478-
return cg;
479-
}
480-
481-
int opt_gear_get ()
482-
{
483-
return pkt.gaugedata[gGear];
484-
}
485-
486-
int opt_gear_max_get ()
487-
{
488-
return _maxg;
489-
}
490-
491-
int opt_rpm_set (int rpm)
492-
{
493-
char rc = 0;
494-
if (pkt.gaugedata[gRpm] != rpm)
495-
rc ++;
496-
pkt.gaugedata[gRpm] = rpm;
497-
if (rc)
498-
{
499-
switch (rpm)
500-
{
501-
default:
502-
s7ledS_send (" ");
503-
break;
504-
case 1:
505-
s7ledS_send ("__");
506-
break;
507-
case 2:
508-
s7ledS_send ("o ");
509-
break;
510-
case 3:
511-
s7ledS_send ("oo");
512-
break;
513-
case 4:
514-
s7ledS_send ("Oo");
515-
break;
516-
case 5:
517-
s7ledS_send ("OO");
518-
break;
519-
}
520-
bcast_send ();
521-
}
522-
//printf ("\n#RPM %d", pkt.gaugedata[gRpm]);
523-
return rpm;
524-
}
525-
526-
int opt_rpm_get ()
527-
{
528-
return pkt.gaugedata[gRpm];
529-
}
530-
531-
int opt_gear_up ()
532-
{
533-
return opt_gear (1);
534-
//printf ("\n#gear UP");
535-
}
536-
537-
int opt_gear_dn ()
538-
{
539-
return opt_gear (-1);
540-
//printf ("\n#gear DN");
541-
}
542-
543-
int opt_gear_ready ()
544-
{
545-
opt_gear (0);
546-
bcast_send ();
547-
return 1;
548-
}
549-
550-
int opt_gear_max_up ()
551-
{
552-
return opt_gear_max (1);
553-
}
554-
555-
int opt_gear_max_dn ()
556-
{
557-
return opt_gear_max (-1);
558-
}
559-
560-
int opt_gear_max_ready ()
561-
{
562-
return opt_gear_max (0);
563-
}
564-
565353
long get_map (long x, long in_min, long in_max, long out_min, long out_max)
566354
{
567355
return (x - in_min) * (out_max - out_min) / (in_max - in_min) + out_min;

lib/scn_adapter.c

+4-4
Original file line numberDiff line numberDiff line change
@@ -263,8 +263,8 @@ int scn_get_crc (char *pl)
263263
*/
264264
int hex2int (char *hex)
265265
{
266-
int val = 0;
267-
for (int i = 0; i < 8; i++) {
266+
int val = 0, i;
267+
for (i = 0; i < 8; i++) {
268268
// get current character then increment
269269
char byte = *hex++;
270270
// transform hex character to the 4bit equivalent number, using the ascii table indexes
@@ -284,8 +284,8 @@ int hex2int (char *hex)
284284
*/
285285
int hex2byte (char *hex)
286286
{
287-
int val = 0;
288-
for (int i = 0; i < 2; i++) {
287+
int val = 0, i;
288+
for (i = 0; i < 2; i++) {
289289
// get current character then increment
290290
char byte = *hex++;
291291
// transform hex character to the 4bit equivalent number, using the ascii table indexes

mfcserver/Makefile

+4-4
Original file line numberDiff line numberDiff line change
@@ -6,18 +6,18 @@ program_CXX_OBJS := ${program_CXX_SRCS:.cpp=.o}
66
program_OBJS := $(program_C_OBJS) $(program_CXX_OBJS)
77
program_INCLUDE_DIRS := ../lib
88
program_LIBRARY_DIRS := ../lib
9-
program_LIBRARIES :=usb-1.0 curl
9+
program_LIBRARIES :=usb-1.0
1010

11-
CPPFLAGS += $(foreach includedir,$(program_INCLUDE_DIRS),-I$(includedir)) -Wall
11+
CPPFLAGS += $(foreach includedir,$(program_INCLUDE_DIRS),-I$(includedir)) -Wall -std=c99
1212
LDFLAGS += $(foreach librarydir,$(program_LIBRARY_DIRS),-L$(librarydir))
13-
LDFLAGS += $(foreach library,$(program_LIBRARIES),-l$(library))
13+
LDLIBS += $(foreach library,$(program_LIBRARIES),-l$(library))
1414

1515
.PHONY: all clean distclean
1616

1717
all: $(program_NAME)
1818

1919
$(program_NAME): $(program_OBJS)
20-
$(LINK.cc) $(program_OBJS) -o $(program_NAME)
20+
$(LINK.cc) $(program_OBJS) $(LDLIBS) -o $(program_NAME)
2121

2222
clean:
2323
@- $(RM) $(program_NAME)

0 commit comments

Comments
 (0)