The online racing simulator
Searching in All forums
(124 results)
Kada_CZ
S2 licensed
HY000 -- (general error) is used for unmapped errors, server error messages,
2003 -- Can't connect to MySQL server on ..., client error messages,
$ perror 1 61
OS error code 1: Operation not permitted
OS error code 61: No data available

perror is a program, that prints error messages, it's part of mysql-server-5.0 package in my Ubuntu. The error codes are also in /usr/include/mysql/mysqld_ername.h and mysqld_error.h (libmysqlclient15-dev package).

What about to write your own simple program/php script, only for testing, to reproduce the error by your simple program? It would allow you to play with the code...

EDIT: Notice, that the error messages for 1 and 61 could be different on your server, it's OS dependent, run the perror on the server to get the right ones.
Last edited by Kada_CZ, .
Kada_CZ
S2 licensed
Quote from the_angry_angel :It does? Not that I don't believe you but I can't find any reference to that anywhere...

Indeed Windows ignores this. I think I originally had it set as the fd and changed it for some reason.. I clearly didn't make a note of why

It's written in 'man select' in my Ubuntu box (package manpages-dev_2.39-1_all.deb), I can't find exact online version [EDIT, man 2 select], but I found this, see "Select Law" at the bottom (2. -- nfds, 10. -- timeout).
Quote from the_angry_angel :
It's probably because I've written it, but I much prefer the monster of the recv function as it was I can see the point of checking rc == 0 earlier, rather than leaving it to default. That said, we've implemented Lua into an engine - cycles probably isn't something we should care about too much. Being an arse I'm gonna leave it as it is - for now. Plus I've got an interesting idea I'm trying out in my developmental version which makes it rather tricky to implement that part of the patch right now

Ok, the main reason, why I added the rc==0 test was debugging the select call.
Quote from the_angry_angel :
With regards to perror having crept into insim_connect - not sure of the relevance there?

I'm sorry, I forgot to remove it. The perror just prints the reason, why "Connection to <host> failed" (e.g. "Connection refused" when the insim port in LFS is not set to the right value).
Last edited by Kada_CZ, .
Kada_CZ
S2 licensed
Hi, I made it work under my Ubuntu. The patch and all_in_one_zip are in the attachements. The most important change is in insim.c line 96, the select call. I changed
rc = select(0, &readfd, NULL, &exceptfd, &(I->socket.select_timeout));

to
rc = select(I->socket.s + 1, &readfd, NULL, &exceptfd, &select_timeout);

The select call modifies the timeout argument, so I made a local copy. The first argument has to be "the highest-numbered file descriptor in any of the three sets, plus 1". I'm not sure, if the windows implementation uses these arguments differently. Without this change the select call returns always zero for me.

The other changes are minor, some typos and warnings. I slightly change the rest of the insim_recv function just for more comfortable debugging.

I spent most of the time discovering, that lfsw_pb.lua example is written for an old version [evt_bind("MSO"...) instead of evt_bind(ISP_MSO...)].

The API looks very good. I hope, that I'll build something bigger soon.

Tested configuration: (GCC) 4.1.2 (Ubuntu 4.1.2-0ubuntu4), liblua5.1-0-dev 5.1.1-2build1, LFS W17, wine-0.9.36.
Kada_CZ
S2 licensed
Slightly more effective version:
float floatSwap (float value)
{
char buffer[ 4 ];

buffer[ 0 ] = ((char*)&value)[ 3 ];
buffer[ 1 ] = ((char*)&value)[ 2 ];
buffer[ 2 ] = ((char*)&value)[ 1 ];
buffer[ 3 ] = ((char*)&value)[ 0 ];
return *( (float *) &buffer );
}

Maybe some C guru post here #define solution in just one expression, I can't see it.

You'll buy me a beer, when I visit Israel .
Kada_CZ
S2 licensed
Quote from mikey_G :I think I found something that works, and complies with Occam Razor

:-), nice. What about this small change to get rid of warnings and the need of RPM data type change:

float floatSwap (float fl)
{
char *value = (char*) &fl;
char buffer[ 4 ];

buffer[ 0 ] = value[ 3 ];
buffer[ 1 ] = value[ 2 ];
buffer[ 2 ] = value[ 1 ];
buffer[ 3 ] = value[ 0 ];

return *( (float *) &buffer );
}

:Handshake
Kada_CZ
S2 licensed
Quote from mikey_G :But indeed, the OSX functions were just nothing more then some usless empty function, weird...

It's ok, because on PC these functions do the conversion. These functions converts the host order to the network order (and the other way around). The network order is the same as on Mac, big endian, so no conversion is needed.
Quote from mikey_G :
I did get warnings though that I was overriding NTOHL and HTONL, so maybe they existed already.

Maybe they are in some header.

It's more complicated, than it seems :-). There is other problem with automatic conversions between floats and ints. Try the following two funcs:
float htonf (float *fg) {
unsigned int *tm;
unsigned int res_c;
float result;

tm = (unsigned int*)fg;
res_c = HTONL (*tm);
memcpy (&result, &res_c, 4);
return (result);
}

float ntohf (float *fg) {
unsigned int *tm;
unsigned int res_c;
float result;

tm = (unsigned int*)fg;
res_c = NTOHL (*tm);
memcpy (&result, &res_c, 4);
return (result);
}

So for the printing:
printf("RPM = %f, memory address is %X\n", htonf (&og_packet.RPM)), &og_packet.RPM);

You will need #include <string.h> for the above code.
Kada_CZ
S2 licensed
Quote :ID of connection = 16777216

This is right, if you have "OutGauge ID" set to 1. 16777216 = 0x01 00 00 00. Probably the endian conversion for floats should be different.

EDIT: I was wrong again. Don't use htonl functions, on Mac it simply returns the argument. You have to write your own conversion func. Try one of these:
#define HTONL(n) (((((unsigned long)(n) & 0xFF)) << 24) | \
((((unsigned long)(n) & 0xFF00)) << 8) | \
((((unsigned long)(n) & 0xFF0000)) >> 8) | \
((((unsigned long)(n) & 0xFF000000)) >> 24))

#define NTOHL(n) (((((unsigned long)(n) & 0xFF)) << 24) | \
((((unsigned long)(n) & 0xFF00)) << 8) | \
((((unsigned long)(n) & 0xFF0000)) >> 8) | \
((((unsigned long)(n) & 0xFF000000)) >> 24))

(stolen from inet.h)
So try something like:
Quote :printf("RPM = %f, memory address is %X\n", (float)NTOHL((unsigned int)og_packet.RPM), &og_packet.RPM);

or the other one.
Last edited by Kada_CZ, .
Kada_CZ
S2 licensed
try:
printf("RPM = %f, memory address is %X\n", (float)ntohl((unsigned int)og_packet.RPM), &og_packet.RPM);

or
printf("RPM = %f, memory address is %X\n", (float)htonl((unsigned int)og_packet.RPM), &og_packet.RPM);

Kada_CZ
S2 licensed
Quote from mikey_G :
btw, I did the changes you said, but i still get huge floating point numbers as results, and they're hardly stable (sometimes a negative number, sometimes positive, maybe there are some alignment issues, but I can't really find them).

Ha, maybe I got it. Mac is a "big endian" system, PC is a "little endian", maybe this is the problem.
Kada_CZ
S2 licensed
It seems, that I was wrong with the "int ID" field. If "OutGauge ID" is set to 0 in the cfg.txt, then LFS (0.5W) sends only 92 bytes in the packet. If "OutGauge ID" is anything nonzero, then LFS send 96 bytes. I'm not sure, if it's a bug or a feature .
Last edited by Kada_CZ, .
Kada_CZ
S2 licensed
Ok, let's make things working :-). There is comma missing between og_packet.Time and &og_packet.Time. Surprisingly, my gcc compiles it, only with warning. The "MAXBUFLEN-1" should be: sizeof (OutGaugePacket). Then it works, at least for me. Maybe it just doesn't produce the results, that you are expected. The speed is in metres per second. Receive more then one packed in a loop and observe what happens.
Kada_CZ
S2 licensed
Your updated code, that you have posted above, still misses the "int ID" field, as the_angry_angel mentioned. The field is _not_ optional in the declaration, it's optional to use it.
Kada_CZ
S2 licensed
Hi,
after quick look, you are missing the __attribute__ ((packed)) for OutGauge struct definition, i. e.:
typedef struct {
...
} __attribute__ ((packed)) OutGaugePacket;

If you have "char" as struct field, it doesn't mean (without "packed" keyword), that it takes only one byte in memory (google packed, c, struct for explanation). Maybe for your compiler the __attribute__ ((packed)) has to be something different, look at documentation for your compiler.

You may look at sources in C for my Gear Indicator to see working app (the main.c is kind of mess, I know :-)).
Last edited by Kada_CZ, .
Kada_CZ
S2 licensed
Quote from MadCatX :Checked out that site, and it is exactly what I've said. Fflib seems to me like a driver(though it is built in kernel) which is able to communicate with certain FF devices and make them creating FF forces.

FFlib is not a driver. The drivers are in the kernel, I agree with you, that "proper" driver is necessary to communicate with FF devices. FFlib is a concept of library, that simplifies programming force feedback effects. FFlib is on a higher level than kernel driver. There is another similar approach in the popular SDL library, still under development tough. Things are getting better.
Quote from MadCatX :
Now it is up to wine devs whether they will implement working FF...

Most of the FF code in wine was created during google's "summer of code" 2005, so it's pretty old. Every one can be wine developer, it's up to us ;-), because I suspect, that most of the wine devs don't play games with force feedback wheel...
Kada_CZ
S2 licensed
Quote from NotAnIllusion :besides it's an advantage for me to do things in a (slightly) sub-optimal manner due to the way it affects my final year dissertation ;P

Ha!, maybe this (looking for the optimal solutions) is the reason, why I didn't finish my disertation yet .
Kada_CZ
S2 licensed
Quote from NotAnIllusion :
Read operation should be fine but to receive stuff on the inbound socket you really would need a loop that reads from the stream and then reacts to what it:
...

Use socket_select instead of busy waiting. It saves a lot of CPU time for you.
A note from the php manual:
You should always try to use socket_select() without timeout. Your program should have nothing to do if there is no data available. Code that depends on timeouts is not usually portable and difficult to debug.
Last edited by Kada_CZ, .
Kada_CZ
S2 licensed
Quote from MadCatX :FFB will never work under Linux unless you have proper driver for your wheel/joystick/whatever.

Force feedback works in linux for most of the wheels available, see libff page. The supported devices list is far from complete, the complete list is in the kernel documentation and kernel sources :-). For example the svn version of native linux game Vdrift (it's better than the name :-)) works with my wheel (WFF GP) with force feedback -- a little hack to the kernel is needed for WFF GP.

The problem is in the Wine, I think. I compiled my own version of wine-0.9.30, with that the LFS successfully detected my wheel as force feedback device. But I simply added some "fake" code, that doesn't do anything, so no forces were generated. There are missing/incomplete implementation of some directx force feedback functions in the wine. On the other hand, the windows version of BZFlag game generates some forces in my linux when it's run by wine.
Last edited by Kada_CZ, .
Kada_CZ
S2 licensed
NEW: Support for Richard Burns Rally. Just copy d3d9.dll and gidll_config.txt files from here to your RBR folder. Set the same IP address and port in gidll_config.txt in the RBR folder and GI's config.txt. Run GI before RBR.

Currently displaying the gear number is supported only. It's incompatible with another d3d9 mods at the moment (e.g. Analogue Gauges mod by Racer_S). I'll support it in the next release. The sources and full documentation for d3d9.dll will be available under GPL soon. The code is based on a great proxy dll concept from www.mikoweb.eu by Michael Koch.

Notice the interesting sideeffect. With this d3d9.dll you can use any application, that recieves LFS's OutGauge packets, with Richard Burns Rally. So if you have support only for LFS, with this dll you may support RBR also. (only the gear number, at the moment).
Kada_CZ
S2 licensed
Hi, I've been playing with DX "overlay". There is very nice howto and code examples at mikoweb.eu. I hope this helps.
Kada_CZ
S2 licensed
I made some changes to make it work under my Ubuntu (gcc (GCC) 4.0.3 (Ubuntu 4.0.3-1ubuntu5)), LFS patch W. In the attachements are the patch file and all sources.

My comments (for the 0.3 version):
- the LICENCE file is missing,
- I added some useless returns, because of "control reaches end of non-void function" warnings,
- the function "lua_error" returns "int" in my LUA 5.1-0 instalation, so I changed a couple of lines like this:
ilua.c:88
fprintf(stderr, "Core not OK (%d)\n", lua_error(L));

The original code has "%s", maybe in your LUA the lua_error function returns string, am I right?
- I have to run LFS first, then to type "/insim 29999" and then to run luaLFS. If I run luaLFS before LFS, it doesn't work, because the ISI and VER request packets gets lost. Maybe you could keep sending version request packets until the VER is received.
Quote from the_angry_angel :Incidentally I realise that the tabbing, etc. is severely cocked up now - thats my fault for changing editor and PC half way through this afternoon.

You may try linux utility "indent" to clean it up. I'm not sure, if there is a version for Windows.

I didn't play with the new API yet :-(.

Great work, keep it up .
Kada_CZ
S2 licensed
Hello, I still (with V6) have a problem with disapearing content of the mirrors described here. The mirrors appears again, when I leave the shift-U mode.
Kada_CZ
S2 licensed
Quote from Gunn :Sorry, I don't follow links to RSC.

Ok, I made an ugly GI homepage (I hate html). I don't know your motivation to not follow liks to RSC, but I would probably created the page outside RSC anyway. You just pushed me to do that :-).
Kada_CZ
S2 licensed
Quote from Gunn :We've talked about USB and serial connectors.

If you have LPT, you may try this (self promotion :shy.
Last edited by Kada_CZ, .
Kada_CZ
S2 licensed
Quote from Zachary Zoomy :sounds great! did you guys have to unlock S2 again?

I had to unlock for upgrading from V (1) version. No unlock needed for me from V2 patch.
Bug: Content in mirrors disapears when switch to another window
Kada_CZ
S2 licensed
I run LFS in windowed mode, the mirror mode is set to "all". Now, In "shift-U" mode I see mirrors, as expected (the first attachement shows it). If I switch to another window (LFS is not minimized) and back to LFS, then mirrors get black (the second attachement). If I go to menu and back, then mirrors are back to normal.

I have Windows 98SE, nvidia GF 4200 Ti, driver 4.14.10.4523.
FGED GREDG RDFGDR GSFDG