mirror of https://github.com/stella-emu/stella.git
Updated build requirement for Windows to Visual Studio 2015. This allowa to use 'constexpr', which this patch does for a few classes.
git-svn-id: svn://svn.code.sf.net/p/stella/code/trunk@3299 8b62c5a3-ac7e-4cc8-8f21-d9a121418aba
This commit is contained in:
parent
7903c52406
commit
dd96a80e7e
|
@ -363,8 +363,3 @@ uInt8 CartridgeDASHWidget::internalRamGetValue(int addr)
|
|||
{
|
||||
return myCart.myRAM[addr];
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
const CartridgeDASHWidget::BankID CartridgeDASHWidget::bankEnum[4] = {
|
||||
kBank0Changed, kBank1Changed, kBank2Changed, kBank3Changed
|
||||
};
|
||||
|
|
|
@ -57,7 +57,10 @@ class CartridgeDASHWidget : public CartDebugWidget
|
|||
kBank2Changed = 'b2CH',
|
||||
kBank3Changed = 'b3CH'
|
||||
};
|
||||
static const BankID bankEnum[4];
|
||||
static constexpr BankID bankEnum[4] = {
|
||||
kBank0Changed, kBank1Changed, kBank2Changed, kBank3Changed
|
||||
};
|
||||
|
||||
|
||||
private:
|
||||
void saveOldState() override;
|
||||
|
|
|
@ -76,7 +76,7 @@ class Cartridge : public Device
|
|||
/**
|
||||
Query some information about this cartridge.
|
||||
*/
|
||||
static const string& about() { return myAboutString; }
|
||||
static constexpr string& about() { return myAboutString; }
|
||||
|
||||
/**
|
||||
Save the internal (patched) ROM image.
|
||||
|
|
|
@ -237,31 +237,31 @@ private:
|
|||
// two as well, one 512 byte for read and one for write. The RAM locations are +0x800 apart, and the ROM
|
||||
// are consecutive. This allows us to determine on a read/write exactly where the data is.
|
||||
|
||||
static const uInt16 BANK_UNDEFINED = 0x8000; // bank is undefined and inaccessible
|
||||
static constexpr uInt16 BANK_UNDEFINED = 0x8000; // bank is undefined and inaccessible
|
||||
uInt16 bankInUse[8]; // bank being used for ROM/RAM (eight 512 byte areas)
|
||||
uInt16 segmentInUse[4]; // set by bank methods, to know which hotspot was accessed
|
||||
|
||||
static const uInt16 BANK_SWITCH_HOTSPOT_RAM = 0x3E; // writes to this address cause bankswitching
|
||||
static const uInt16 BANK_SWITCH_HOTSPOT_ROM = 0x3F; // writes to this address cause bankswitching
|
||||
static constexpr uInt16 BANK_SWITCH_HOTSPOT_RAM = 0x3E; // writes to this address cause bankswitching
|
||||
static constexpr uInt16 BANK_SWITCH_HOTSPOT_ROM = 0x3F; // writes to this address cause bankswitching
|
||||
|
||||
static const uInt8 BANK_BITS = 6; // # bits for bank
|
||||
static const uInt8 BIT_BANK_MASK = (1 << BANK_BITS) - 1; // mask for those bits
|
||||
static const uInt16 BITMASK_LOWERUPPER = 0x100; // flags lower or upper section of bank (1==upper)
|
||||
static const uInt16 BITMASK_ROMRAM = 0x200; // flags ROM or RAM bank switching (1==RAM)
|
||||
static constexpr uInt8 BANK_BITS = 6; // # bits for bank
|
||||
static constexpr uInt8 BIT_BANK_MASK = (1 << BANK_BITS) - 1; // mask for those bits
|
||||
static constexpr uInt16 BITMASK_LOWERUPPER = 0x100; // flags lower or upper section of bank (1==upper)
|
||||
static constexpr uInt16 BITMASK_ROMRAM = 0x200; // flags ROM or RAM bank switching (1==RAM)
|
||||
|
||||
static const uInt16 MAXIMUM_BANK_COUNT = (1<<BANK_BITS);
|
||||
static const uInt16 RAM_BANK_TO_POWER = 9; // 2^n = 512
|
||||
static const uInt16 RAM_BANK_SIZE = (1 << RAM_BANK_TO_POWER);
|
||||
static const uInt16 BITMASK_RAM_BANK = (RAM_BANK_SIZE - 1);
|
||||
static const uInt32 RAM_TOTAL_SIZE = MAXIMUM_BANK_COUNT * RAM_BANK_SIZE;
|
||||
static constexpr uInt16 MAXIMUM_BANK_COUNT = (1<<BANK_BITS);
|
||||
static constexpr uInt16 RAM_BANK_TO_POWER = 9; // 2^n = 512
|
||||
static constexpr uInt16 RAM_BANK_SIZE = (1 << RAM_BANK_TO_POWER);
|
||||
static constexpr uInt16 BITMASK_RAM_BANK = (RAM_BANK_SIZE - 1);
|
||||
static constexpr uInt32 RAM_TOTAL_SIZE = MAXIMUM_BANK_COUNT * RAM_BANK_SIZE;
|
||||
|
||||
static const uInt16 ROM_BANK_TO_POWER = 10; // 2^n = 1024
|
||||
static const uInt16 ROM_BANK_SIZE = (1 << ROM_BANK_TO_POWER);
|
||||
static const uInt16 BITMASK_ROM_BANK = (ROM_BANK_SIZE -1);
|
||||
static constexpr uInt16 ROM_BANK_TO_POWER = 10; // 2^n = 1024
|
||||
static constexpr uInt16 ROM_BANK_SIZE = (1 << ROM_BANK_TO_POWER);
|
||||
static constexpr uInt16 BITMASK_ROM_BANK = (ROM_BANK_SIZE -1);
|
||||
|
||||
static const uInt16 ROM_BANK_COUNT = 64;
|
||||
static constexpr uInt16 ROM_BANK_COUNT = 64;
|
||||
|
||||
static const uInt16 RAM_WRITE_OFFSET = 0x800;
|
||||
static constexpr uInt16 RAM_WRITE_OFFSET = 0x800;
|
||||
|
||||
uInt32 mySize; // Size of the ROM image
|
||||
unique_ptr<uInt8[]> myImage; // Pointer to a dynamically allocated ROM image of the cartridge
|
||||
|
|
|
@ -168,9 +168,3 @@ bool Controller::load(Serializer& in)
|
|||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
const Int32 Controller::maximumResistance = 0x7FFFFFFF;
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
const Int32 Controller::minimumResistance = 0x00000000;
|
||||
|
|
|
@ -235,10 +235,10 @@ class Controller : public Serializable
|
|||
|
||||
public:
|
||||
/// Constant which represents maximum resistance for analog pins
|
||||
static const Int32 maximumResistance;
|
||||
static constexpr Int32 maximumResistance = 0x7FFFFFFF;
|
||||
|
||||
/// Constant which represents minimum resistance for analog pins
|
||||
static const Int32 minimumResistance;
|
||||
static constexpr Int32 minimumResistance = 0x00000000;
|
||||
|
||||
protected:
|
||||
/// Specifies which jack the controller is plugged in
|
||||
|
|
|
@ -329,7 +329,7 @@ class M6502 : public Serializable
|
|||
uInt16 myDataAddressForPoke;
|
||||
|
||||
/// Indicates the number of system cycles per processor cycle
|
||||
static const uInt32 SYSTEM_CYCLES_PER_CPU = 1;
|
||||
static constexpr uInt32 SYSTEM_CYCLES_PER_CPU = 1;
|
||||
|
||||
#ifdef DEBUGGER_SUPPORT
|
||||
Int32 evalCondBreaks() {
|
||||
|
|
|
@ -419,6 +419,3 @@ int Paddles::TRIGRANGE = Paddles::TRIGMAX;
|
|||
int Paddles::DIGITAL_SENSITIVITY = -1;
|
||||
int Paddles::DIGITAL_DISTANCE = -1;
|
||||
int Paddles::MOUSE_SENSITIVITY = -1;
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
const Controller::DigitalPin Paddles::ourButtonPin[2] = { Four, Three };
|
||||
|
|
|
@ -128,18 +128,17 @@ class Paddles : public Controller
|
|||
|
||||
// Range of values over which digital and mouse movement is scaled
|
||||
// to paddle resistance
|
||||
static const int TRIGMIN = 1;
|
||||
static const int TRIGMAX = 4096;
|
||||
static constexpr int TRIGMIN = 1;
|
||||
static constexpr int TRIGMAX = 4096;
|
||||
static int TRIGRANGE; // This one is variable for the upper range
|
||||
|
||||
static const int MAX_DIGITAL_SENSE = 20;
|
||||
static const int MAX_MOUSE_SENSE = 20;
|
||||
static constexpr int MAX_DIGITAL_SENSE = 20;
|
||||
static constexpr int MAX_MOUSE_SENSE = 20;
|
||||
static int DIGITAL_SENSITIVITY, DIGITAL_DISTANCE;
|
||||
static int MOUSE_SENSITIVITY;
|
||||
|
||||
// Lookup table for associating paddle buttons with controller pins
|
||||
// Yes, this is hideously complex
|
||||
static const Controller::DigitalPin ourButtonPin[2];
|
||||
static constexpr Controller::DigitalPin ourButtonPin[2] = { Four, Three };
|
||||
|
||||
private:
|
||||
// Following constructors and assignment operators not supported
|
||||
|
|
|
@ -57,16 +57,16 @@ class System : public Serializable
|
|||
virtual ~System() = default;
|
||||
|
||||
// Mask to apply to an address before accessing memory
|
||||
static const uInt16 ADDRESS_MASK = (1 << 13) - 1;
|
||||
static constexpr uInt16 ADDRESS_MASK = (1 << 13) - 1;
|
||||
|
||||
// Amount to shift an address by to determine what page it's on
|
||||
static const uInt16 PAGE_SHIFT = 6;
|
||||
static constexpr uInt16 PAGE_SHIFT = 6;
|
||||
|
||||
// Mask to apply to an address to obtain its page offset
|
||||
static const uInt16 PAGE_MASK = (1 << PAGE_SHIFT) - 1;
|
||||
static constexpr uInt16 PAGE_MASK = (1 << PAGE_SHIFT) - 1;
|
||||
|
||||
// Number of pages in the system
|
||||
static const uInt16 NUM_PAGES = 1 << (13 - PAGE_SHIFT);
|
||||
static constexpr uInt16 NUM_PAGES = 1 << (13 - PAGE_SHIFT);
|
||||
|
||||
public:
|
||||
/**
|
||||
|
|
|
@ -308,8 +308,3 @@ void GlobalPropsDialog::handleCommand(CommandSender* sender, int cmd,
|
|||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
const char* GlobalPropsDialog::ourJoyState[10] = {
|
||||
"U", "D", "L", "R", "F", "U", "D", "L", "R", "F"
|
||||
};
|
||||
|
|
|
@ -60,7 +60,10 @@ class GlobalPropsDialog : public Dialog, public CommandSender
|
|||
CheckboxWidget* myHoldSelect;
|
||||
CheckboxWidget* myHoldReset;
|
||||
|
||||
static const char* ourJoyState[10];
|
||||
static constexpr char* ourJoyState[10] = {
|
||||
"U", "D", "L", "R", "F", "U", "D", "L", "R", "F"
|
||||
};
|
||||
|
||||
|
||||
private:
|
||||
// Following constructors and assignment operators not supported
|
||||
|
|
|
@ -249,9 +249,3 @@ void LauncherFilterDialog::handleCommand(CommandSender* sender, int cmd,
|
|||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
const char* LauncherFilterDialog::ourRomTypes[2][5] = {
|
||||
{ ".a26", ".bin", ".rom", ".zip", ".gz" },
|
||||
{ "a26", "bin", "rom", "zip", "gz" }
|
||||
};
|
||||
|
|
|
@ -74,7 +74,11 @@ class LauncherFilterDialog : public Dialog, public CommandSender
|
|||
};
|
||||
|
||||
// Holds static strings representing ROM types
|
||||
static const char* ourRomTypes[2][5];
|
||||
static constexpr char* ourRomTypes[2][5] = {
|
||||
{ ".a26", ".bin", ".rom", ".zip", ".gz" },
|
||||
{ "a26", "bin", "rom", "zip", "gz" }
|
||||
};
|
||||
|
||||
|
||||
private:
|
||||
// Following constructors and assignment operators not supported
|
||||
|
|
|
@ -18,6 +18,7 @@
|
|||
//============================================================================
|
||||
|
||||
#include <cassert>
|
||||
#pragma warning( disable : 4091 )
|
||||
#include <shlobj.h>
|
||||
|
||||
#ifdef ARRAYSIZE
|
||||
|
|
|
@ -20,99 +20,58 @@
|
|||
#ifndef __HOME_FINDER_
|
||||
#define __HOME_FINDER_
|
||||
|
||||
#pragma warning( disable : 4091 )
|
||||
#include <shlobj.h>
|
||||
|
||||
/*
|
||||
* Used to determine the location of the various Win32 user/system folders.
|
||||
*
|
||||
* Win98 and earlier don't have SHGetFolderPath in shell32.dll.
|
||||
* Microsoft recommend that we load shfolder.dll at run time and
|
||||
* access the function through that.
|
||||
*
|
||||
* shfolder.dll is loaded dynamically in the constructor, and unloaded in
|
||||
* the destructor
|
||||
*
|
||||
* The class makes SHGetFolderPath available through its function operator.
|
||||
* It will work on all versions of Windows >= Win95.
|
||||
*
|
||||
* This code was borrowed from the Lyx project.
|
||||
*/
|
||||
class HomeFinder
|
||||
{
|
||||
public:
|
||||
HomeFinder() : myFolderModule(0), myFolderPathFunc(0)
|
||||
{
|
||||
myFolderModule = LoadLibrary("shfolder.dll");
|
||||
if(myFolderModule)
|
||||
myFolderPathFunc = reinterpret_cast<function_pointer>
|
||||
(::GetProcAddress(myFolderModule, "SHGetFolderPathA"));
|
||||
}
|
||||
HomeFinder() = default;
|
||||
~HomeFinder() = default;
|
||||
|
||||
~HomeFinder() { if(myFolderModule) FreeLibrary(myFolderModule); }
|
||||
|
||||
/** Wrapper for SHGetFolderPathA, returning the 'HOME/User' folder
|
||||
(or an empty string if the folder couldn't be determined. */
|
||||
// Return the 'HOME/User' folder, or an empty string if the folder couldn't be determined.
|
||||
const string& getHomePath() const
|
||||
{
|
||||
if(ourHomePath == "")
|
||||
{
|
||||
if(!myFolderPathFunc)
|
||||
ourHomePath = "";
|
||||
else
|
||||
{
|
||||
char folder_path[MAX_PATH];
|
||||
HRESULT const result = (myFolderPathFunc)
|
||||
(NULL, CSIDL_PROFILE | CSIDL_FLAG_CREATE, NULL, 0, folder_path);
|
||||
ourHomePath = (result == 0) ? folder_path : "";
|
||||
}
|
||||
HRESULT const result = SHGetFolderPathA(NULL, CSIDL_PROFILE | CSIDL_FLAG_CREATE,
|
||||
NULL, 0, folder_path);
|
||||
ourHomePath = (result == S_OK) ? folder_path : EmptyString;
|
||||
}
|
||||
return ourHomePath;
|
||||
}
|
||||
|
||||
/** Wrapper for SHGetFolderPathA, returning the 'APPDATA' folder
|
||||
(or an empty string if the folder couldn't be determined. */
|
||||
// Return the 'APPDATA' folder, or an empty string if the folder couldn't be determined.
|
||||
const string& getAppDataPath() const
|
||||
{
|
||||
if(ourAppDataPath == "")
|
||||
{
|
||||
if(!myFolderPathFunc)
|
||||
ourAppDataPath = "";
|
||||
else
|
||||
{
|
||||
char folder_path[MAX_PATH];
|
||||
HRESULT const result = (myFolderPathFunc)
|
||||
(NULL, CSIDL_APPDATA | CSIDL_FLAG_CREATE, NULL, 0, folder_path);
|
||||
ourAppDataPath = (result == 0) ? folder_path : "";
|
||||
}
|
||||
HRESULT const result = SHGetFolderPathA(NULL, CSIDL_APPDATA | CSIDL_FLAG_CREATE,
|
||||
NULL, 0, folder_path);
|
||||
ourAppDataPath = (result == S_OK) ? folder_path : EmptyString;
|
||||
}
|
||||
return ourAppDataPath;
|
||||
}
|
||||
|
||||
/** Wrapper for SHGetFolderPathA, returning the 'DESKTOPDIRECTORY' folder
|
||||
(or an empty string if the folder couldn't be determined. */
|
||||
// Return the 'DESKTOPDIRECTORY' folder, or an empty string if the folder couldn't be determined.
|
||||
const string& getDesktopPath() const
|
||||
{
|
||||
if(ourDesktopPath == "")
|
||||
{
|
||||
if(!myFolderPathFunc)
|
||||
ourDesktopPath = "";
|
||||
else
|
||||
{
|
||||
char folder_path[MAX_PATH];
|
||||
HRESULT const result = (myFolderPathFunc)
|
||||
(NULL, CSIDL_DESKTOPDIRECTORY | CSIDL_FLAG_CREATE, NULL, 0, folder_path);
|
||||
ourDesktopPath = (result == 0) ? folder_path : "";
|
||||
}
|
||||
HRESULT const result = SHGetFolderPathA(NULL, CSIDL_DESKTOPDIRECTORY | CSIDL_FLAG_CREATE,
|
||||
NULL, 0, folder_path);
|
||||
ourDesktopPath = (result == S_OK) ? folder_path : EmptyString;
|
||||
}
|
||||
return ourDesktopPath;
|
||||
}
|
||||
|
||||
private:
|
||||
typedef HRESULT (__stdcall * function_pointer)(HWND, int, HANDLE, DWORD, LPCSTR);
|
||||
|
||||
HMODULE myFolderModule;
|
||||
function_pointer myFolderPathFunc;
|
||||
|
||||
static string ourHomePath, ourAppDataPath, ourDesktopPath;
|
||||
|
||||
// Following constructors and assignment operators not supported
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project DefaultTargets="Build" ToolsVersion="12.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<Project DefaultTargets="Build" ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<ItemGroup Label="ProjectConfigurations">
|
||||
<ProjectConfiguration Include="Debug|Win32">
|
||||
<Configuration>Debug</Configuration>
|
||||
|
@ -27,22 +27,22 @@
|
|||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
|
||||
<ConfigurationType>Application</ConfigurationType>
|
||||
<CharacterSet>MultiByte</CharacterSet>
|
||||
<PlatformToolset>v120_xp</PlatformToolset>
|
||||
<PlatformToolset>v140_xp</PlatformToolset>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
|
||||
<ConfigurationType>Application</ConfigurationType>
|
||||
<CharacterSet>MultiByte</CharacterSet>
|
||||
<PlatformToolset>v120_xp</PlatformToolset>
|
||||
<PlatformToolset>v140_xp</PlatformToolset>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
|
||||
<ConfigurationType>Application</ConfigurationType>
|
||||
<CharacterSet>MultiByte</CharacterSet>
|
||||
<PlatformToolset>v120_xp</PlatformToolset>
|
||||
<PlatformToolset>v140_xp</PlatformToolset>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
|
||||
<ConfigurationType>Application</ConfigurationType>
|
||||
<CharacterSet>MultiByte</CharacterSet>
|
||||
<PlatformToolset>v120_xp</PlatformToolset>
|
||||
<PlatformToolset>v140_xp</PlatformToolset>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
|
||||
<ImportGroup Label="ExtensionSettings">
|
||||
|
|
Loading…
Reference in New Issue