Skip to content
Permalink
Browse files

Build: Changes required to compile and run using VS 2019 (#2975)

in vs 2019, the system xhash used by unordered_map uses Target in its template definition. pcsx2 #defines this in the r5900 and r3000 headers which leak cause a cryptic compilation error. A quick fix here is just to undef it in gamebase.h. A better fix would be to encapsulate the definition or use something more c++ to avoid the pre-processor. Add a comment to explain the _Target_ undef.

tap.h did not have string defined. I guess this was included transitively somewhere with an earlier set of system headers.

Biostools, the file is opened in text mode which causes the bios to be partially read. I'm not sure that's vs2019 specific but it's wrong in any case. Maybe the default mode parameter changed at some point. Maybe wxFile would be a better choice here rather than WxFFile because wxFile always open s in binary mode.
  • Loading branch information...
bigianb authored and lightningterror committed Jun 1, 2019
1 parent 1f1b68a commit a1a63747098e2e27d49e9670b1f7feaa088e2a0f
Showing with 7 additions and 1 deletion.
  1. +5 −0 pcsx2/GameDatabase.h
  2. +1 −1 pcsx2/ps2/BiosTools.cpp
  3. +1 −0 plugins/dev9ghzdrk/Win32/tap.h
@@ -18,6 +18,11 @@
//#include "Common.h"
#include "AppConfig.h"

// _Target_ is defined by R300A.h and R5900.h and the definition leaks to here.
// The problem, at least with Visual Studio 2019 on Windows,
// is that unordered_map includes xhash which uses _Target_ as a template
// parameter. Unless we undef it here, the build breaks with a cryptic error message.
#undef _Target_
#include <unordered_map>
#include <wx/wfstream.h>

@@ -281,7 +281,7 @@ void LoadBIOS()
BiosChecksum = 0;

wxString biosZone;
wxFFile fp( Bios );
wxFFile fp( Bios , "rb");
fp.Read( eeMem->ROM, std::min<s64>( Ps2MemSize::Rom, filesize ) );

ChecksumIt( BiosChecksum, eeMem->ROM );
@@ -15,6 +15,7 @@

#pragma once
#include <vector>
#include <string>
#include "..\net.h"
using namespace std;

0 comments on commit a1a6374

Please sign in to comment.
You can’t perform that action at this time.