Linux: Fixed compilation errors and warnings (clang + gcc)

This commit is contained in:
Souryo 2017-08-30 19:36:20 -04:00
parent 5957bc2d3e
commit 6f5a94e6a2
12 changed files with 129 additions and 19 deletions

View File

@ -1,4 +1,5 @@
#include "stdafx.h"
#include <algorithm>
#include "DebugHud.h"
#include "DrawCommand.h"
#include "DrawLineCommand.h"

View File

@ -17,7 +17,7 @@ protected:
DrawPixel(_x, i, _color);
}
} else {
double deltaErr = abs((double)yDiff / (double)xDiff);
double deltaErr = std::abs((double)yDiff / (double)xDiff);
double error = deltaErr - 0.5;
int y = _y;
for(int x = _x; x <= _x2; x++) {
@ -33,7 +33,7 @@ protected:
public:
DrawLineCommand(int x, int y, int x2, int y2, int color, int frameCount) :
_x(x), _y(y), _x2(x2), _y2(y2), _color(color), DrawCommand(frameCount)
DrawCommand(frameCount), _x(x), _y(y), _x2(x2), _y2(y2), _color(color)
{
if(!(_color & 0xFF000000)) {
_color |= 0xFF000000;

View File

@ -15,7 +15,7 @@ protected:
public:
DrawPixelCommand(int x, int y, int color, int frameCount) :
_x(x), _y(y), _color(color), DrawCommand(frameCount)
DrawCommand(frameCount), _x(x), _y(y), _color(color)
{
if(!(_color & 0xFF000000)) {
_color |= 0xFF000000;

View File

@ -31,7 +31,7 @@ protected:
public:
DrawRectangleCommand(int x, int y, int width, int height, int color, bool fill, int frameCount) :
_x(x), _y(y), _width(width), _height(height), _color(color), _fill(fill), DrawCommand(frameCount)
DrawCommand(frameCount), _x(x), _y(y), _width(width), _height(height), _color(color), _fill(fill)
{
if(!(_color & 0xFF000000)) {
_color |= 0xFF000000;

View File

@ -151,7 +151,7 @@ protected:
public:
DrawStringCommand(int x, int y, string text, int color, int backColor, int frameCount) :
_x(x), _y(y), _text(text), _color(color), _backColor(backColor), DrawCommand(frameCount)
DrawCommand(frameCount), _x(x), _y(y), _color(color), _backColor(backColor), _text(text)
{
if(!(_color & 0xFF000000)) {
_color |= 0xFF000000;

View File

@ -70,7 +70,6 @@ void HdNesPack::DrawTile(HdPpuTileInfo &tileInfo, HdPackTileInfo &hdPackTileInfo
return;
}
uint32_t bgColor = _palette[tileInfo.PpuBackgroundColor];
uint32_t scale = GetScale();
uint32_t *bitmapData = hdPackTileInfo.HdTileData.data();
uint32_t tileWidth = 8 * scale;
@ -165,9 +164,9 @@ HdPackTileInfo * HdNesPack::GetMatchingTile(HdPpuPixelInfo *screenTiles, uint32_
}
if(hdTile != hdData->TileByKey.end()) {
for(HdPackTileInfo* hdTile : hdTile->second) {
if(hdTile->MatchesCondition(screenTiles, x, y, tile)) {
return hdTile;
for(HdPackTileInfo* hdPackTile : hdTile->second) {
if(hdPackTile->MatchesCondition(screenTiles, x, y, tile)) {
return hdPackTile;
}
}
}
@ -193,12 +192,12 @@ bool HdNesPack::IsNextToSprite(HdPpuPixelInfo *screenTiles, uint32_t x, uint32_t
}
};
for(int i = -1; i <= 1; i++) {
if(y + i < 0 || y + i >= PPU::ScreenHeight) {
if((int)y + i < 0 || y + i >= PPU::ScreenHeight) {
continue;
}
for(int j = -1; j <= 1; j++) {
if(x + j < 0 || x + j >= PPU::ScreenWidth) {
if((int)x + j < 0 || x + j >= PPU::ScreenWidth) {
continue;
}

View File

@ -13,8 +13,8 @@ private:
public:
HdVideoFilter();
void ApplyFilter(uint16_t *ppuOutputBuffer);
FrameInfo GetFrameInfo();
void ApplyFilter(uint16_t *ppuOutputBuffer) override;
FrameInfo GetFrameInfo() override;
OverscanDimensions GetOverscan() override;
void SetHdScreenTiles(HdPpuPixelInfo *screenTiles);

View File

@ -1,4 +1,5 @@
#include "stdafx.h"
#include <algorithm>
#include "ScriptingContext.h"
#include "DebuggerTypes.h"
@ -69,7 +70,7 @@ void ScriptingContext::UnregisterMemoryCallback(CallbackType type, int startAddr
}
}
for(int i = startAddr; startAddr < endAddr; i++) {
for(int i = startAddr; i < endAddr; i++) {
vector<int> &refs = _callbacks[(int)type][i];
refs.erase(std::remove(refs.begin(), refs.end(), reference), refs.end());
}

View File

@ -360,7 +360,6 @@
this.txtScriptContent.Cursor = System.Windows.Forms.Cursors.IBeam;
this.txtScriptContent.DisabledColor = System.Drawing.Color.FromArgb(((int)(((byte)(100)))), ((int)(((byte)(180)))), ((int)(((byte)(180)))), ((int)(((byte)(180)))));
this.txtScriptContent.Dock = System.Windows.Forms.DockStyle.Fill;
this.txtScriptContent.Hotkeys = resources.GetString("txtScriptContent.Hotkeys");
this.txtScriptContent.IsReplaceMode = false;
this.txtScriptContent.Language = FastColoredTextBoxNS.Language.Lua;
this.txtScriptContent.LeftBracket = '(';

View File

@ -129,9 +129,6 @@
<metadata name="contextMenu.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>523, 17</value>
</metadata>
<data name="txtScriptContent.Hotkeys" xml:space="preserve">
<value>Tab=IndentIncrease, Escape=ClearHints, PgUp=GoPageUp, PgDn=GoPageDown, End=GoEnd, Home=GoHome, Left=GoLeft, Up=GoUp, Right=GoRight, Down=GoDown, Ins=ReplaceMode, Del=DeleteCharRight, F3=FindNext, Shift+Tab=IndentDecrease, Shift+PgUp=GoPageUpWithSelection, Shift+PgDn=GoPageDownWithSelection, Shift+End=GoEndWithSelection, Shift+Home=GoHomeWithSelection, Shift+Left=GoLeftWithSelection, Shift+Up=GoUpWithSelection, Shift+Right=GoRightWithSelection, Shift+Down=GoDownWithSelection, Shift+Ins=Paste, Shift+Del=Cut, Ctrl+Back=ClearWordLeft, Ctrl+Space=AutocompleteMenu, Ctrl+End=GoLastLine, Ctrl+Home=GoFirstLine, Ctrl+Left=GoWordLeft, Ctrl+Up=ScrollUp, Ctrl+Right=GoWordRight, Ctrl+Down=ScrollDown, Ctrl+Ins=Copy, Ctrl+Del=ClearWordRight, Ctrl+0=ZoomNormal, Ctrl+A=SelectAll, Ctrl+B=BookmarkLine, Ctrl+C=Copy, Ctrl+E=MacroExecute, Ctrl+F=FindDialog, Ctrl+G=GoToDialog, Ctrl+H=ReplaceDialog, Ctrl+I=AutoIndentChars, Ctrl+M=MacroRecord, Ctrl+N=GoNextBookmark, Ctrl+R=Redo, Ctrl+U=UpperCase, Ctrl+V=Paste, Ctrl+X=Cut, Ctrl+Z=Undo, Ctrl+Add=ZoomIn, Ctrl+Subtract=ZoomOut, Ctrl+OemMinus=NavigateBackward, Ctrl+Shift+End=GoLastLineWithSelection, Ctrl+Shift+Home=GoFirstLineWithSelection, Ctrl+Shift+Left=GoWordLeftWithSelection, Ctrl+Shift+Right=GoWordRightWithSelection, Ctrl+Shift+B=UnbookmarkLine, Ctrl+Shift+C=CommentSelected, Ctrl+Shift+N=GoPrevBookmark, Ctrl+Shift+U=LowerCase, Ctrl+Shift+OemMinus=NavigateForward, Alt+Back=Undo, Alt+Up=MoveSelectedLinesUp, Alt+Down=MoveSelectedLinesDown, Alt+Shift+Left=GoLeft_ColumnSelectionMode, Alt+Shift+Up=GoUp_ColumnSelectionMode, Alt+Shift+Right=GoRight_ColumnSelectionMode, Alt+Shift+Down=GoDown_ColumnSelectionMode, Ctrl+Alt+F=FindChar</value>
</data>
<metadata name="tmrLog.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>316, 17</value>
</metadata>

View File

@ -857,6 +857,8 @@ namespace Mesen.GUI
public CPUState CPU;
public PPUDebugState PPU;
public CartridgeState Cartridge;
public ApuState APU;
public NesModel Model;
}
public struct CartridgeState
@ -875,7 +877,7 @@ namespace Mesen.GUI
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 64)]
public UInt32[] ChrSelectedPages;
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 4)]
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 8)]
public UInt32[] Nametables;
}
@ -980,6 +982,113 @@ namespace Mesen.GUI
public UInt16 DebugPC;
}
public struct ApuLengthCounterState
{
[MarshalAs(UnmanagedType.I1)]
public bool Halt;
public Byte Counter;
public Byte ReloadValue;
}
public struct ApuEnvelopeState
{
[MarshalAs(UnmanagedType.I1)]
public bool StartFlag;
[MarshalAs(UnmanagedType.I1)]
public bool Loop;
[MarshalAs(UnmanagedType.I1)]
public bool ConstantVolume;
public Byte Divider;
public Byte Counter;
public Byte Volume;
}
public struct ApuSquareState
{
public Byte Duty;
public Byte DutyPosition;
public UInt16 Period;
[MarshalAs(UnmanagedType.I1)]
public bool SweepEnabled;
[MarshalAs(UnmanagedType.I1)]
public bool SweepNegate;
public Byte SweepPeriod;
public Byte SweepShift;
[MarshalAs(UnmanagedType.I1)]
public bool Enabled;
public Byte OutputVolume;
public UInt32 Frequency;
public ApuLengthCounterState LengthCounter;
public ApuEnvelopeState Envelope;
}
public struct ApuTriangleState
{
public UInt16 Period;
public Byte SequencePosition;
[MarshalAs(UnmanagedType.I1)]
public bool Enabled;
public UInt32 Frequency;
public Byte OutputVolume;
public ApuLengthCounterState LengthCounter;
}
public struct ApuNoiseState
{
public UInt16 Period;
public UInt16 ShiftRegister;
[MarshalAs(UnmanagedType.I1)]
public bool ModeFlag;
[MarshalAs(UnmanagedType.I1)]
public bool Enabled;
public UInt32 Frequency;
public Byte OutputVolume;
public ApuLengthCounterState LengthCounter;
public ApuEnvelopeState Envelope;
}
public struct ApuDmcState
{
public UInt16 SampleAddr;
public UInt16 SampleLength;
[MarshalAs(UnmanagedType.I1)]
public bool Loop;
[MarshalAs(UnmanagedType.I1)]
public bool IrqEnabled;
public UInt16 Period;
public UInt16 BytesRemaining;
public UInt32 Frequency;
public Byte OutputVolume;
}
public struct ApuFrameCounterState
{
[MarshalAs(UnmanagedType.I1)]
public bool FiveStepMode;
public Byte SequencePosition;
[MarshalAs(UnmanagedType.I1)]
public bool IrqEnabled;
}
public struct ApuState
{
public ApuSquareState Square1;
public ApuSquareState Square2;
public ApuTriangleState Triangle;
public ApuNoiseState Noise;
public ApuDmcState Dmc;
public ApuFrameCounterState FrameCounter;
}
public enum StatusFlagFormat
{
Hexadecimal = 0,

View File

@ -4632,7 +4632,11 @@ stb_vorbis * stb_vorbis_open_file(FILE *file, int close_on_free, int *error, con
stb_vorbis * stb_vorbis_open_filename(const char *filename, int *error, const stb_vorbis_alloc *alloc)
{
FILE *f;
#if _WIN32 || _WIN64
fopen_s(&f, filename, "rb");
#else
f = fopen(filename, "rb");
#endif
if (f)
return stb_vorbis_open_file(f, TRUE, error, alloc);
if (error) *error = VORBIS_file_open_failure;