SFML community forums

Help => Window => Topic started by: Saadin Dassum on October 24, 2014, 05:58:51 am

Title: 32 bit to 64 bit
Post by: Saadin Dassum on October 24, 2014, 05:58:51 am
I recently made a program with SFML.  It involved a "music player" type interaction with the user.  The main difference was that the user could change the music through a joypad.  A while after completing the first version of my program, I switched from a really incapable intel core i3 32 bit HP to an i7 64 bit Alienware.  Unfortunately, I can't use my new computer's great potential to continue making my program better.  The program seems to run perfectly.  The problem is that when I try to change the music, nothing will happen.  It's as if the program was completely ignoring the controller input.  The input I'm using is exactly the same as in my last computer.  Does my problem have to do with the software and specs?  Do you guys know what my problem might be?  Is it because my new computer is 64 bits? Forgive my ignorance.  I'm a little bit new to all of this.  I can give you guys more information if you need it to help me.  Thank you.
Title: Re: 32 bit to 64 bit
Post by: Ixrec on October 24, 2014, 08:05:29 am
Could you provide a complete and minimal code example that demonstrates the problem?  If there really is a problem in SFML's input handling then a simple game loop that prints joystick events to std::cout should suffice.
Title: Re: 32 bit to 64 bit
Post by: Nexus on October 24, 2014, 10:31:12 am
In addition to Ixrec's note, you should read this post (http://en.sfml-dev.org/forums/index.php?topic=5559.msg36368#msg36368).
Title: Sorry, here's the material
Post by: Saadin Dassum on October 26, 2014, 01:19:13 am
Okay... Sorry about not posting everything that was needed.  I just thought it might have been a problem that was more typical and appeared more commonly when working with both 32-bit and 64-bit operations.
  Anyway, for you guys to understand what my code is supposed to do, there are different playlists.  You can switch to different playlists, and within those playlists, you can pause, play and go to the next or previous song.  You can also raise and lower the volume.  If a song is switched within a playlist, the program loads another file onto the sf::Music object that already exists and simply begins to play the sf::Music object again.  If a playlist is switched, the current sf::Music object's volume is set to 0, and the next playlist's sf::Music object's volume is raised to the user volume.
  All of this worked perfectly on my 32-bit HP.  I don't get why it's not working on my new computer.  None of the controls are working, and the code is the exact same on both systems.  The only other detail that might be important is that for a joypad, I'm using a Dualshock 3 (Playstation controller) with the DS3 tool, which is software to make it act like a joypad.
if (sf::Joystick::isButtonPressed(0, 12)) {  //Up button
        if (userVolume < 100)
            userVolume++;
        else
            userVolume = 100;

        switch (playlist) {
//set current playlist to new user volume
}
//A similar code for the Down button is placed here

    if (sf::Joystick::isButtonPressed(0, 13)) { //Right button
        switch (playlist) {
//set the current playlist's volume to 0 and the new one to userVolume
}
//A similar code for the Left button is placed here

if (playlist == genre1)    {  //While the radio station is set to genre1
        if (sf::Joystick::isButtonPressed(0, 1)) { //X button
                if (genre1Playlist.getStatus() == sf::Music::Playing) {
            genre1playlist.pause(); //Pause
                }
                else{
                genre1playlist.play(); //Play or resume
                }
        }
        if (sf::Joystick::isButtonPressed(0, 7)) { //R1 button
           if (genre1Number < grenre1Max) {
            genre1TrackNumber++;
           }
       //Reload song and play  (Next)
       }
//A similar code for the L1 button is placed here.
}
 

  That's it.  The code seems fine.  I have no idea why this isn't working.
Title: Re: 32 bit to 64 bit
Post by: Gambit on October 26, 2014, 05:35:28 am
The architecture "bit-ness" should not have any impact on the performance (Or lack there-of) of your program. The team behind SFML does their best to make sure that it works on as many platforms as possible with as much support as possible. The problem could simply reside with a compatibility issue between the gamepad you are using and your specs. This could be a hardware incompatibility or you are simply missing drivers. Check if the OS is recognizing your gamepad and if you can use it in games or anything else.
Title: Re: 32 bit to 64 bit
Post by: Jesper Juhl on October 26, 2014, 05:58:06 am
I can't help noticing that this sounds a lot like my Jukebox (https://github.com/SFML/SFML/wiki/Source:-Jukebox) class.
Nothing to do with your problem, I just thought you might want to take a look :-)
Title: Re: 32 bit to 64 bit
Post by: Saadin Dassum on October 26, 2014, 06:51:11 pm
Gambit, my OS is recognizing the gamepad exactly as it was before.  The way I tested it was with GTA: San Andreas.  I've tested it and it still works with San Andreas.  The only thing that it's not working is my program.  The only difference I can spot between both of my comoputers is that the HP is bluetooth compatible with the Dualshock 3, but the Alienware isn't.
Title: Re: 32 bit to 64 bit
Post by: Saadin Dassum on November 19, 2014, 02:36:42 am
Hi again everyone.  I might have found another clue to why my program isn't working.  What I found out another clue (yeah, I'll call it that) as to what is going on in my new system.  I tried to change the window size and realized that this was not working either.  The program that was running in my new computer was probably just compiled in my old computer and being executed in my new one.  The program is not actually compiling.  When trying to build the program from scratch, the build log gives me this:
mingw32-g++.exe: error: unrecognized command line option '-static-libstdc++'
mingw32-g++.exe: error: unrecognized command line option '-static-libstdc++'

By the way, in Code::Blocks's, my Build Options Linker Settings has this:
"
-static-libgcc
-static-libstdc++
-std=c++11
"
in other linker settings.  These lines are the ones I used to be able to compile SFML from the beginning.  Do they have something to do with my problem?
Title: Re: 32 bit to 64 bit
Post by: Gambit on November 19, 2014, 05:10:38 am
You should consider updating the compiler and IDE, then adjust your code to the updates. When you run into problems like these, the first thing you should do is consider what version of the softwares you are using and update if you need to.
Title: AW: 32 bit to 64 bit
Post by: eXpl0it3r on November 19, 2014, 07:57:24 am
If you have issues with your game pad, you should write a simple example to see if you get any connected devices and any input. Just because it works with a random game, doesn't mean it will automatically work for SFML.

Next you should make sure to use the latest SFML version from GitHub to rule out, that it is an already fixed issue.

The error you're getting about -static-xyz is becausr your using the awful TDM compiler, which links the runtine libs statically by default.
If that error occurs when building SFML, then you're using an old version.
Title: Re: 32 bit to 64 bit
Post by: Saadin Dassum on November 21, 2014, 09:41:18 pm
The error you're getting about -static-xyz is becausr your using the awful TDM compiler, which links the runtine libs statically by default.

What compiler would you recommend for me?  I've used codeblocks for everything I have learned in C++.  Should I use Visual C++?
Title: Re: 32 bit to 64 bit
Post by: Jesper Juhl on November 21, 2014, 09:56:28 pm
There are many compilers to chose from. The intel compiler, gcc, clang, visual studio's compiler and more.
You should pick a compiler based on whether it supports the features you need on the platforms you want to support, not based on what IDE it happens to integrate well with (although that may of course be a parameter).
My point is; your IDE is /not/ the same as your compiler and there are many options for the latter.
Title: Re: 32 bit to 64 bit
Post by: Laurent on November 21, 2014, 10:41:56 pm
eXpl0it3r probably didn't mean to get rid of gcc, but only to choose another distribution of it. You can download mingw-w64 or nuwen gcc, and then just change one path in Code::Blocks and continue everything as you did before.
Title: Re: 32 bit to 64 bit
Post by: wintertime on November 22, 2014, 06:41:43 pm
Or even simpler: just remove those options that the compiler/linker does not know, as TDM already links statically without them.
Title: Re: 32 bit to 64 bit
Post by: Saadin Dassum on November 22, 2014, 09:33:59 pm
Or even simpler: just remove those options that the compiler/linker does not know, as TDM already links statically without them.

I just tried that.  Codeblocks gave me something that looks like this:
||=== Build: Debug in MPlayer (compiler: GNU GCC Compiler) ===|
C:\SFML-2.1\lib\libsfml-audio-s.a(Music.cpp.obj):Music.cpp|| undefined reference to `_Unwind_Resume'|
(.text$_ZN2sf4TextD0Ev[__ZN2sf4TextD0Ev]+0xa6)||undefined reference to `_Unwind_Resume'|
||More errors follow but not being shown.|
||Edit the max errors limit in compiler options...|
||=== Build failed: 50 error(s), 0 warning(s) (0 minute(s), 2 second(s)) ===|

I deleted all the build log errors that were repeated or similair.  All of them were undefined references.
I also tried downloading mingw-w64.  The program still won't compile.  I'll run some experiments on my program and then come back after I have deduced more.  Thank you all for trying to help.
Title: Re: 32 bit to 64 bit
Post by: wintertime on November 23, 2014, 08:05:34 pm
That error means you made the mistake of using a library that was compiled with a compiler using a different type of exception handling.
You have to use the same compiler for everything, that means, recompile the library and your code!
Title: Re: 32 bit to 64 bit
Post by: BlueCobold on November 24, 2014, 07:30:41 am
That also might include external libraries like libsndfile or freetype2.