Skip to content

Commit 86faea2

Browse files
authored
Merge pull request #9 from ActuallyTaylor/fix-uint8-casting
Fix Compilation
2 parents 91f65da + d8e31d0 commit 86faea2

69 files changed

Lines changed: 504 additions & 411 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

NESGameCore.mm

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -499,7 +499,7 @@ - (NSData *)serializeStateWithError:(NSError **)outError
499499
NSLocalizedRecoverySuggestionErrorKey : errorDescription
500500
}];
501501

502-
return NO;
502+
return nil;
503503
}
504504

505505
stateStream.seekg(0, std::ios::end);

Nestopia.xcodeproj/project.pbxproj

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1015,7 +1015,6 @@
10151015
8F28FD4729FD3DB1008FC4A9 /* NstBoardUnlMmc3BigPrgRom.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = NstBoardUnlMmc3BigPrgRom.cpp; sourceTree = "<group>"; };
10161016
8F28FD4829FD3DB1008FC4A9 /* NstBoardUnlRetX7Gbl.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = NstBoardUnlRetX7Gbl.cpp; sourceTree = "<group>"; };
10171017
8F28FD4929FD3DB1008FC4A9 /* NstBoardUnlRetX7Gbl.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = NstBoardUnlRetX7Gbl.hpp; sourceTree = "<group>"; };
1018-
946C18A91714895200C64BF9 /* OEFDSSystemResponderClient.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = OEFDSSystemResponderClient.h; path = "../OpenEmu/SystemPlugins/Nintendo FDS/OEFDSSystemResponderClient.h"; sourceTree = "<group>"; };
10191018
947944D318791948008259C6 /* NstTimer.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = NstTimer.hpp; sourceTree = "<group>"; };
10201019
947944D418791948008259C6 /* NstVideoFilter2xSaI.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = NstVideoFilter2xSaI.cpp; sourceTree = "<group>"; };
10211020
947944D518791948008259C6 /* NstVideoFilter2xSaI.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = NstVideoFilter2xSaI.hpp; sourceTree = "<group>"; };
@@ -1033,9 +1032,10 @@
10331032
94CB655D18791A5400A19D7D /* NstBoardUnlN625092.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = NstBoardUnlN625092.cpp; sourceTree = "<group>"; };
10341033
94CB655E18791A5400A19D7D /* NstBoardUnlN625092.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = NstBoardUnlN625092.hpp; sourceTree = "<group>"; };
10351034
C6296C610FCEEE45004F84C4 /* AdvancedPreference.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = AdvancedPreference.xib; sourceTree = "<group>"; };
1036-
C6B3E692136525EB00D34947 /* OENESSystemResponderClient.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = OENESSystemResponderClient.h; path = ../OpenEmu/SystemPlugins/NES/OENESSystemResponderClient.h; sourceTree = "<group>"; };
10371035
C6D120F81711313900E868A8 /* OpenEmuBase.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; path = OpenEmuBase.framework; sourceTree = BUILT_PRODUCTS_DIR; };
10381036
D2F7E65807B2D6F200F64583 /* CoreData.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreData.framework; path = System/Library/Frameworks/CoreData.framework; sourceTree = SDKROOT; };
1037+
DB0B09012E9854F5007A0109 /* OENESSystemResponderClient.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = OENESSystemResponderClient.h; path = ../../OpenEmu/SystemPlugins/NES/OENESSystemResponderClient.h; sourceTree = SOURCE_ROOT; };
1038+
DB0B09022E9854FD007A0109 /* OEFDSSystemResponderClient.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = OEFDSSystemResponderClient.h; path = "../../OpenEmu/SystemPlugins/Nintendo FDS/OEFDSSystemResponderClient.h"; sourceTree = SOURCE_ROOT; };
10391039
/* End PBXFileReference section */
10401040

10411041
/* Begin PBXFrameworksBuildPhase section */
@@ -1097,8 +1097,8 @@
10971097
82789B6F0E70D27D00C01C82 /* NESGameCore.h */,
10981098
82789B700E70D27D00C01C82 /* NESGameCore.mm */,
10991099
82F3642E0F51FB4A001495F6 /* NESGameCore+NESFeatures.mm */,
1100-
C6B3E692136525EB00D34947 /* OENESSystemResponderClient.h */,
1101-
946C18A91714895200C64BF9 /* OEFDSSystemResponderClient.h */,
1100+
DB0B09012E9854F5007A0109 /* OENESSystemResponderClient.h */,
1101+
DB0B09022E9854FD007A0109 /* OEFDSSystemResponderClient.h */,
11021102
);
11031103
name = Classes;
11041104
sourceTree = "<group>";
Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<Scheme
3+
LastUpgradeVersion = "2600"
4+
version = "1.7">
5+
<BuildAction
6+
parallelizeBuildables = "YES"
7+
buildImplicitDependencies = "YES"
8+
buildArchitectures = "Automatic">
9+
<BuildActionEntries>
10+
<BuildActionEntry
11+
buildForTesting = "YES"
12+
buildForRunning = "YES"
13+
buildForProfiling = "YES"
14+
buildForArchiving = "YES"
15+
buildForAnalyzing = "YES">
16+
<BuildableReference
17+
BuildableIdentifier = "primary"
18+
BlueprintIdentifier = "82D814E50F1D81BE00EF8CF5"
19+
BuildableName = "Build &amp; Install Nestopia"
20+
BlueprintName = "Build &amp; Install Nestopia"
21+
ReferencedContainer = "container:Nestopia.xcodeproj">
22+
</BuildableReference>
23+
</BuildActionEntry>
24+
</BuildActionEntries>
25+
</BuildAction>
26+
<TestAction
27+
buildConfiguration = "Debug"
28+
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
29+
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
30+
shouldUseLaunchSchemeArgsEnv = "YES"
31+
shouldAutocreateTestPlan = "YES">
32+
</TestAction>
33+
<LaunchAction
34+
buildConfiguration = "Release"
35+
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
36+
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
37+
launchStyle = "0"
38+
useCustomWorkingDirectory = "NO"
39+
ignoresPersistentStateOnLaunch = "NO"
40+
debugDocumentVersioning = "YES"
41+
debugServiceExtension = "internal"
42+
allowLocationSimulation = "YES">
43+
</LaunchAction>
44+
<ProfileAction
45+
buildConfiguration = "Release"
46+
shouldUseLaunchSchemeArgsEnv = "YES"
47+
savedToolIdentifier = ""
48+
useCustomWorkingDirectory = "NO"
49+
debugDocumentVersioning = "YES">
50+
<MacroExpansion>
51+
<BuildableReference
52+
BuildableIdentifier = "primary"
53+
BlueprintIdentifier = "82D814E50F1D81BE00EF8CF5"
54+
BuildableName = "Build &amp; Install Nestopia"
55+
BlueprintName = "Build &amp; Install Nestopia"
56+
ReferencedContainer = "container:Nestopia.xcodeproj">
57+
</BuildableReference>
58+
</MacroExpansion>
59+
</ProfileAction>
60+
<AnalyzeAction
61+
buildConfiguration = "Debug">
62+
</AnalyzeAction>
63+
<ArchiveAction
64+
buildConfiguration = "Release"
65+
revealArchiveInOrganizer = "YES">
66+
</ArchiveAction>
67+
</Scheme>

core/NstApu.cpp

Lines changed: 74 additions & 74 deletions
Original file line numberDiff line numberDiff line change
@@ -470,10 +470,10 @@ namespace Nes
470470

471471
const byte data[4] =
472472
{
473-
ctrl,
474-
clock & 0xFF,
475-
clock >> 8,
476-
cycles.frameDivider
473+
static_cast<byte>(ctrl),
474+
static_cast<byte>(clock & 0xFF),
475+
static_cast<byte>(clock >> 8),
476+
static_cast<byte>(cycles.frameDivider)
477477
};
478478

479479
state.Begin( AsciiId<'F','R','M'>::V ).Write( data ).End();
@@ -494,9 +494,9 @@ namespace Nes
494494

495495
const byte data[3] =
496496
{
497-
clock & 0xFF,
498-
clock >> 8,
499-
cycles.frameIrqRepeat % 3
497+
static_cast<byte>(clock & 0xFF),
498+
static_cast<byte>(clock >> 8),
499+
static_cast<byte>(cycles.frameIrqRepeat % 3)
500500
};
501501

502502
state.Begin( AsciiId<'I','R','Q'>::V ).Write( data ).End();
@@ -532,10 +532,10 @@ namespace Nes
532532
{
533533
const byte data[4] =
534534
{
535-
cycles.rateCounter & 0xFFU,
536-
cycles.rateCounter >> 8,
537-
cycles.rateCounter >> 16,
538-
cycles.rateCounter >> 24,
535+
static_cast<byte>(cycles.rateCounter & 0xFFU),
536+
static_cast<byte>(cycles.rateCounter >> 8),
537+
static_cast<byte>(cycles.rateCounter >> 16),
538+
static_cast<byte>(cycles.rateCounter >> 24),
539539
};
540540

541541
state.Begin( AsciiId<'S','0','0'>::V ).Write( data ).End();
@@ -1065,7 +1065,7 @@ namespace Nes
10651065
const byte data[3] =
10661066
{
10671067
count,
1068-
regs[0] | (reset ? 0x80U : 0x00U),
1068+
static_cast<byte>(regs[0] | (reset ? 0x80U : 0x00U)),
10691069
regs[1]
10701070
};
10711071

@@ -1158,18 +1158,18 @@ namespace Nes
11581158
{
11591159
const byte data[12] =
11601160
{
1161-
acc & 0xFFU,
1162-
acc >> 8,
1163-
acc >> 16,
1164-
acc >> 24,
1165-
prev & 0xFFU,
1166-
prev >> 8,
1167-
prev >> 16,
1168-
prev >> 24,
1169-
next & 0xFFU,
1170-
next >> 8,
1171-
next >> 16,
1172-
next >> 24,
1161+
static_cast<byte>(acc & 0xFFU),
1162+
static_cast<byte>(acc >> 8),
1163+
static_cast<byte>(acc >> 16),
1164+
static_cast<byte>(acc >> 24),
1165+
static_cast<byte>(prev & 0xFFU),
1166+
static_cast<byte>(prev >> 8),
1167+
static_cast<byte>(prev >> 16),
1168+
static_cast<byte>(prev >> 24),
1169+
static_cast<byte>(next & 0xFFU),
1170+
static_cast<byte>(next >> 8),
1171+
static_cast<byte>(next >> 16),
1172+
static_cast<byte>(next >> 24),
11731173
};
11741174

11751175
state.Begin( AsciiId<'S','0','0'>::V ).Write( data ).End();
@@ -1380,19 +1380,19 @@ namespace Nes
13801380
{
13811381
const byte data[13] =
13821382
{
1383-
step,
1384-
timer & 0xFFU,
1385-
timer >> 8,
1386-
timer >> 16,
1387-
timer >> 24,
1388-
frequency & 0xFFU,
1389-
frequency >> 8,
1390-
frequency >> 16,
1391-
frequency >> 24,
1392-
amp & 0xFFU,
1393-
amp >> 8,
1394-
amp >> 16,
1395-
amp >> 24,
1383+
static_cast<byte>(step),
1384+
static_cast<byte>(timer & 0xFFU),
1385+
static_cast<byte>(timer >> 8),
1386+
static_cast<byte>(timer >> 16),
1387+
static_cast<byte>(timer >> 24),
1388+
static_cast<byte>(frequency & 0xFFU),
1389+
static_cast<byte>(frequency >> 8),
1390+
static_cast<byte>(frequency >> 16),
1391+
static_cast<byte>(frequency >> 24),
1392+
static_cast<byte>(amp & 0xFFU),
1393+
static_cast<byte>(amp >> 8),
1394+
static_cast<byte>(amp >> 16),
1395+
static_cast<byte>(amp >> 24),
13961396
};
13971397

13981398
state.Begin( AsciiId<'S','0','0'>::V ).Write( data ).End();
@@ -1682,9 +1682,9 @@ namespace Nes
16821682
{
16831683
const byte data[4] =
16841684
{
1685-
waveLength & 0xFFU,
1686-
waveLength >> 8,
1687-
linearCounter | (uint(status) << 7),
1685+
static_cast<byte>(waveLength & 0xFFU),
1686+
static_cast<byte>(waveLength >> 8),
1687+
static_cast<byte>(linearCounter | (uint(status) << 7)),
16881688
linearCtrl
16891689
};
16901690

@@ -1696,15 +1696,15 @@ namespace Nes
16961696
{
16971697
const byte data[9] =
16981698
{
1699-
step,
1700-
timer & 0xFFU,
1701-
timer >> 8,
1702-
timer >> 16,
1703-
timer >> 24,
1704-
amp & 0xFFU,
1705-
amp >> 8,
1706-
amp >> 16,
1707-
amp >> 24,
1699+
static_cast<byte>(step),
1700+
static_cast<byte>(timer & 0xFFU),
1701+
static_cast<byte>(timer >> 8),
1702+
static_cast<byte>(timer >> 16),
1703+
static_cast<byte>(timer >> 24),
1704+
static_cast<byte>(amp & 0xFFU),
1705+
static_cast<byte>(amp >> 8),
1706+
static_cast<byte>(amp >> 16),
1707+
static_cast<byte>(amp >> 24),
17081708
};
17091709

17101710
state.Begin( AsciiId<'S','0','0'>::V ).Write( data ).End();
@@ -1925,12 +1925,12 @@ namespace Nes
19251925
{
19261926
const byte data[6] =
19271927
{
1928-
bits & 0xFFU,
1929-
bits >> 8,
1930-
timer & 0xFFU,
1931-
timer >> 8,
1932-
timer >> 16,
1933-
timer >> 24
1928+
static_cast<byte>(bits & 0xFFU),
1929+
static_cast<byte>(bits >> 8),
1930+
static_cast<byte>(timer & 0xFFU),
1931+
static_cast<byte>(timer >> 8),
1932+
static_cast<byte>(timer >> 16),
1933+
static_cast<byte>(timer >> 24)
19341934
};
19351935

19361936
state.Begin( AsciiId<'S','0','0'>::V ).Write( data ).End();
@@ -2147,21 +2147,21 @@ namespace Nes
21472147
{
21482148
const byte data[12] =
21492149
{
2150-
dmcClock & 0xFF,
2151-
dmcClock >> 8,
2152-
(
2153-
( ( regs.ctrl & REG0_FREQUENCY ) ) |
2154-
( ( regs.ctrl & REG0_LOOP ) ? 0x10U : 0U ) |
2155-
( ( regs.ctrl & REG0_IRQ_ENABLE ) ? 0x20U : 0U ) |
2156-
( ( dma.lengthCounter ) ? 0x40U : 0U )
2157-
),
2158-
(regs.address - 0xC000U) >> 6,
2159-
(regs.lengthCounter - 1U) >> 4,
2160-
(dma.address >> 0 & 0xFFU),
2161-
(dma.address >> 8 & 0x7FU) | (dma.buffered ? 0x80 : 0x00),
2162-
dma.lengthCounter ? (dma.lengthCounter - 1U) >> 4 : 0,
2163-
dma.buffer,
2164-
7 - out.shifter,
2150+
static_cast<byte>(dmcClock & 0xFF),
2151+
static_cast<byte>(dmcClock >> 8),
2152+
static_cast<byte>((
2153+
( ( regs.ctrl & REG0_FREQUENCY ) ) |
2154+
( ( regs.ctrl & REG0_LOOP ) ? 0x10U : 0U ) |
2155+
( ( regs.ctrl & REG0_IRQ_ENABLE ) ? 0x20U : 0U ) |
2156+
( ( dma.lengthCounter ) ? 0x40U : 0U )
2157+
)),
2158+
static_cast<byte>((regs.address - 0xC000U) >> 6),
2159+
static_cast<byte>((regs.lengthCounter - 1U) >> 4),
2160+
static_cast<byte>((dma.address >> 0 & 0xFFU)),
2161+
static_cast<byte>((dma.address >> 8 & 0x7FU) | (dma.buffered ? 0x80 : 0x00)),
2162+
static_cast<byte>(dma.lengthCounter ? (dma.lengthCounter - 1U) >> 4 : 0),
2163+
static_cast<byte>(dma.buffer),
2164+
static_cast<byte>(7 - out.shifter),
21652165
out.buffer,
21662166
out.dac,
21672167
};
@@ -2172,10 +2172,10 @@ namespace Nes
21722172
{
21732173
const byte data[4] =
21742174
{
2175-
linSample & 0xFFU,
2176-
linSample >> 8,
2177-
dma.lengthCounter & 0xFFU,
2178-
dma.lengthCounter >> 8,
2175+
static_cast<byte>(linSample & 0xFFU),
2176+
static_cast<byte>(linSample >> 8),
2177+
static_cast<byte>(dma.lengthCounter & 0xFFU),
2178+
static_cast<byte>(dma.lengthCounter >> 8),
21792179
};
21802180

21812181
state.Begin( AsciiId<'S','0','0'>::V ).Write( data ).End();

core/NstCartridgeUnif.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -738,10 +738,10 @@ namespace Nes
738738
{
739739
const byte bytes[] =
740740
{
741-
id >> 0 & 0xFF,
742-
id >> 8 & 0xFF,
743-
id >> 16 & 0xFF,
744-
id >> 24 & 0xFF,
741+
static_cast<byte>(id >> 0 & 0xFF),
742+
static_cast<byte>(id >> 8 & 0xFF),
743+
static_cast<byte>(id >> 16 & 0xFF),
744+
static_cast<byte>(id >> 24 & 0xFF),
745745
0
746746
};
747747

core/NstCpu.cpp

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -343,13 +343,13 @@ namespace Nes
343343
{
344344
const byte data[7] =
345345
{
346-
pc & 0xFF,
347-
pc >> 8,
348-
sp,
349-
a,
350-
x,
351-
y,
352-
flags.Pack()
346+
static_cast<byte>(pc & 0xFF),
347+
static_cast<byte>(pc >> 8),
348+
static_cast<byte>(sp),
349+
static_cast<byte>(a),
350+
static_cast<byte>(x),
351+
static_cast<byte>(y),
352+
static_cast<byte>(flags.Pack())
353353
};
354354

355355
state.Begin( AsciiId<'R','E','G'>::V ).Write( data ).End();
@@ -360,16 +360,16 @@ namespace Nes
360360
{
361361
const byte data[5] =
362362
{
363-
((interrupt.nmiClock != CYCLE_MAX) ? 0x01U : 0x00U) |
364-
((interrupt.low & IRQ_FRAME) ? 0x02U : 0x00U) |
365-
((interrupt.low & IRQ_DMC) ? 0x04U : 0x00U) |
366-
((interrupt.low & IRQ_EXT) ? 0x08U : 0x00U) |
367-
(jammed ? 0x40U : 0x00U) |
368-
(model == CPU_RP2A07 ? 0x80U : model == CPU_DENDY ? 0x20U : 0x00U),
369-
cycles.count & 0xFF,
370-
cycles.count >> 8,
371-
(interrupt.nmiClock != CYCLE_MAX) ? interrupt.nmiClock+1 : 0,
372-
(interrupt.irqClock != CYCLE_MAX) ? interrupt.irqClock+1 : 0
363+
static_cast<byte>(((interrupt.nmiClock != CYCLE_MAX) ? 0x01U : 0x00U) |
364+
((interrupt.low & IRQ_FRAME) ? 0x02U : 0x00U) |
365+
((interrupt.low & IRQ_DMC) ? 0x04U : 0x00U) |
366+
((interrupt.low & IRQ_EXT) ? 0x08U : 0x00U) |
367+
(jammed ? 0x40U : 0x00U) |
368+
(model == CPU_RP2A07 ? 0x80U : model == CPU_DENDY ? 0x20U : 0x00U)),
369+
static_cast<byte>(cycles.count & 0xFF),
370+
static_cast<byte>(cycles.count >> 8),
371+
static_cast<byte>((interrupt.nmiClock != CYCLE_MAX) ? interrupt.nmiClock+1 : 0),
372+
static_cast<byte>((interrupt.irqClock != CYCLE_MAX) ? interrupt.irqClock+1 : 0)
373373
};
374374

375375
state.Begin( AsciiId<'F','R','M'>::V ).Write( data ).End();

0 commit comments

Comments
 (0)