hrydgard / ppsspp

A PSP emulator for Android, Windows, Mac and Linux, written in C++. Want to contribute? Join us on Discord at https://discord.gg/5NJB6dD or just send pull requests / issues. For discussion use the forums at forums.ppsspp.org.
https://www.ppsspp.org
Other
11.36k stars 2.18k forks source link

Compiling natively with Visual Studio 2012 #2916

Closed thedax closed 11 years ago

thedax commented 11 years ago

What would the best way to add official support for this? Include a v11.suo file with some defaults so that the user just ends up upgrading the visual studio 2010 sln with the needed macros already added?

To get it to compile natively I had to add this macro to Common and native(otherwise i was getting std::bind errors, about having too many args), and GPU too: _VARIADIC_MAX=10

And to both stdafx.h files(common & native):

undef _WIN32_WINNT

if _MSC_VER < 1700

define _WIN32_WINNT 0x501 // Compile for XP if we don't have 2012

else

define _WIN32_WINNT 0x600 // Otherwise if we do, compile for Vista and above

endif

With these added, it compiles just fine.

unknownbrackets commented 11 years ago

Does this solve anything (over just not upgrading the projects)? Does the LittleBigPlanet video play without issues under the interpreter or something? Or is it just to get rid of the "(Visual Studio 2010)" in the Solution Explorer?

-[Unknown]

thedax commented 11 years ago

What's littlebigplanet have to do with anything? O.o

Anyway, I'd like to be able to compile using visual studio 2012's native libraries and compiler, so I don't need to keep visual studio 2010 around as well.

unknownbrackets commented 11 years ago

https://github.com/hrydgard/ppsspp/issues/464 LittleBigPlanet triggers what I think is a MSVC compiler bug.

-[Unknown]

thedax commented 11 years ago

Do you mean glitches like in cloud's video? I don't see it with this 2012 compiled executable, with interpreter mode..

thedax commented 11 years ago

However, I don't notice any glitches with a 2010 compiled one either(with 8.1-760 as the base)..are you sure it was a compiler bug?

unknownbrackets commented 11 years ago

I still see the glitches with a US version of the game in 32-bit. It doesn't happen in 64-bit builds. It also doesn't seem to happen using gcc or clang, from what I recall.

It can be made to happen even with jit enabled by disabling jit for the vmmov instruction when the source and destination overlap (e.g. swizzle.) I "accidentally" fixed it when I wrote the jit for that instruction.

-[Unknown]

thedax commented 11 years ago

@unknownbrackets : with a 2012 compiled 32-bit build, I don't see the glitches, so it is indeed a compiler bug with 2010, it seems..

Also, for the record, I'm not wanting to replace 2010 support so much as just have its newer and younger brother 2012 be able to compile it natively, too.

hrydgard commented 11 years ago

Send a pull request with those two header additions, seems fine.

thedax commented 11 years ago

Closing due to this being merged.

thedax commented 11 years ago

Actually, there's one more issue to iron out, in native/thread/thread.h, we have this code:

    template <typename C>
    class Func
    {
    public:
        Func(C _func) : func(_func)  {}

        void Run() { func(); }

    private:
        C const func;
    };

Visual Studio 2012(native compiling/upgraded from 2012) doesn't like the "C const func" line. It claims:

Error 1 error C3848: expression having type 'const std::_Bind<_Forced,_Ret,_Fun,_V0_t,_V1_t,_V2_t,_V3_t,_V4_t,_V5_t,>' would lose some const-volatile qualifiers in order to call 'void std::_Bind<_Forced,_Ret,_Fun,_V0_t,_V1_t,_V2_t,_V3_t,_V4_t,_V5_t,>::operator ()(void)' \master\native\thread\thread.h 245 1 native

Is there a better way to fix the error than to simply remove the const? I'm not real familiar with templates.

Also, @unknownbrackets ' https://github.com/hrydgard/ppsspp/pull/2931 seems to bring back the std::bind errors, probably due to the native commit..

thedax commented 11 years ago

Hm, it seems as if the const func issue has vanished. I guess a native update fixed it? I'm puzzled, but it's no longer relevant again, so I'm re-closing this. No current 2012 compilation issues are known to me now.