Skip to content

Commit edab550

Browse files
committed
Update to Nestopia JG 1.51.0
1 parent 72a6e18 commit edab550

28 files changed

+1435
-386
lines changed

Info.plist

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
<key>CFBundleSignature</key>
2020
<string>????</string>
2121
<key>CFBundleVersion</key>
22-
<string>1.49.0.5</string>
22+
<string>1.51.0</string>
2323
<key>NSPrincipalClass</key>
2424
<string>OEGameCoreController</string>
2525
<key>OEGameCoreClass</key>
@@ -71,7 +71,7 @@
7171
<key>OEGameCorePlayerCount</key>
7272
<string>4</string>
7373
<key>OEProjectURL</key>
74-
<string>http://nestopia.sourceforge.net/</string>
74+
<string>https://gitlab.com/jgemu/nestopia</string>
7575
<key>OESystemIdentifiers</key>
7676
<array>
7777
<string>openemu.system.nes</string>

Nestopia.xcodeproj/project.pbxproj

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -315,6 +315,7 @@
315315
82789AE50E70CFD100C01C82 /* NstVsSystem.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 827899C60E70CFD100C01C82 /* NstVsSystem.cpp */; };
316316
82789AE60E70CFD100C01C82 /* NstVsTkoBoxing.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 827899C80E70CFD100C01C82 /* NstVsTkoBoxing.cpp */; };
317317
82789B710E70D27D00C01C82 /* NESGameCore.mm in Sources */ = {isa = PBXBuildFile; fileRef = 82789B700E70D27D00C01C82 /* NESGameCore.mm */; };
318+
872FABE326F27032009BB457 /* NstBoardNamcot340.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 872FABE126F27032009BB457 /* NstBoardNamcot340.cpp */; };
318319
872FC2F522AAEEB600AF67DE /* NstBoardAction53.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 872FC2F322AAEEB400AF67DE /* NstBoardAction53.cpp */; };
319320
876BE44B21AC9E1E00290705 /* NstHomebrew.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 876BE44A21AC9E1D00290705 /* NstHomebrew.cpp */; };
320321
876BE44D21AC9F9B00290705 /* NstVideoFilterNtscCfg.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 876BE44C21AC9F9B00290705 /* NstVideoFilterNtscCfg.cpp */; };
@@ -980,6 +981,8 @@
980981
82798BE50E85CC65001DCA93 /* OpenNestopia.icns */ = {isa = PBXFileReference; lastKnownFileType = image.icns; path = OpenNestopia.icns; sourceTree = "<group>"; };
981982
82F3642E0F51FB4A001495F6 /* NESGameCore+NESFeatures.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = "NESGameCore+NESFeatures.mm"; sourceTree = "<group>"; };
982983
82F45ED70E887EAF00B7B023 /* Preferences.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = Preferences.xib; sourceTree = "<group>"; };
984+
872FABE126F27032009BB457 /* NstBoardNamcot340.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = NstBoardNamcot340.cpp; sourceTree = "<group>"; };
985+
872FABE226F27032009BB457 /* NstBoardNamcot340.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = NstBoardNamcot340.hpp; sourceTree = "<group>"; };
983986
872FC2F322AAEEB400AF67DE /* NstBoardAction53.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = NstBoardAction53.cpp; sourceTree = "<group>"; };
984987
872FC2F422AAEEB500AF67DE /* NstBoardAction53.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = NstBoardAction53.hpp; sourceTree = "<group>"; };
985988
876BE44921AC9E1D00290705 /* NstHomebrew.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = NstHomebrew.hpp; sourceTree = "<group>"; };
@@ -1564,6 +1567,8 @@
15641567
827898950E70CFCC00C01C82 /* NstBoardNamcot163.hpp */,
15651568
876BE46021ACA1AB00290705 /* NstBoardNamcot175.cpp */,
15661569
876BE45F21ACA1AB00290705 /* NstBoardNamcot175.hpp */,
1570+
872FABE126F27032009BB457 /* NstBoardNamcot340.cpp */,
1571+
872FABE226F27032009BB457 /* NstBoardNamcot340.hpp */,
15671572
827898960E70CFCC00C01C82 /* NstBoardNamcot34xx.cpp */,
15681573
827898970E70CFCC00C01C82 /* NstBoardNamcot34xx.hpp */,
15691574
827898980E70CFCC00C01C82 /* NstBoardNanjing.cpp */,
@@ -1925,6 +1930,7 @@
19251930
827899D00E70CFD100C01C82 /* NstApiInput.cpp in Sources */,
19261931
827899D10E70CFD100C01C82 /* NstApiMachine.cpp in Sources */,
19271932
827899D20E70CFD100C01C82 /* NstApiMovie.cpp in Sources */,
1933+
872FABE326F27032009BB457 /* NstBoardNamcot340.cpp in Sources */,
19281934
827899D30E70CFD100C01C82 /* NstApiNsf.cpp in Sources */,
19291935
827899D40E70CFD100C01C82 /* NstApiRewinder.cpp in Sources */,
19301936
827899D50E70CFD100C01C82 /* NstApiSound.cpp in Sources */,

core/NstCartridgeInes.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -674,7 +674,7 @@ namespace Nes
674674

675675
if (setup.version)
676676
{
677-
setup.mapper |= uint(header[8]) << 8 & 0x100;
677+
setup.mapper |= uint(header[8]) << 8 & 0x300;
678678
setup.subMapper = header[8] >> 4;
679679
}
680680

core/NstFds.cpp

Lines changed: 46 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -373,7 +373,7 @@ namespace Nes
373373
{
374374
State::Loader::Data<4> data( state );
375375

376-
io.ctrl = data[0];
376+
io.ctrl = adapter.ctrl = data[0];
377377
io.port = data[1];
378378
break;
379379
}
@@ -550,7 +550,13 @@ namespace Nes
550550

551551
NES_POKE_D(Fds,4023)
552552
{
553-
io.ctrl = data;
553+
io.ctrl = adapter.ctrl = data;
554+
555+
if (!(io.ctrl & Io::CTRL0_DISK_ENABLED))
556+
{
557+
cpu.ClearIRQ();
558+
adapter.DisableIRQ();
559+
}
554560
}
555561

556562
NES_POKE_D(Fds,4026)
@@ -783,21 +789,25 @@ namespace Nes
783789
#pragma optimize("", on)
784790
#endif
785791

786-
void Fds::Unit::Timer::Advance(uint& timer)
792+
bool Fds::Unit::Timer::Clock()
787793
{
788-
timer |= STATUS_PENDING_IRQ;
794+
bool retval = false;
789795

790-
if (ctrl & CTRL_REPEAT)
791-
count = latch;
792-
else
793-
ctrl &= ~uint(CTRL_ENABLED);
794-
795-
latch = 0; // Fixes Kaettekita Mario Bros - FHorse/dragon2snow
796-
}
796+
if (ctrl & CTRL_ENABLED)
797+
{
798+
if (count == 0)
799+
{
800+
retval = true;
801+
count = latch;
797802

798-
NST_SINGLE_CALL bool Fds::Unit::Timer::Clock()
799-
{
800-
return !(ctrl & CTRL_ENABLED) || !count || --count;
803+
if (!(ctrl & CTRL_REPEAT))
804+
ctrl &= ~uint(CTRL_ENABLED);
805+
}
806+
else
807+
count--;
808+
}
809+
810+
return retval;
801811
}
802812

803813
#ifdef NST_MSVC_OPTIMIZE
@@ -1202,11 +1212,15 @@ namespace Nes
12021212

12031213
ibool Fds::Unit::Clock()
12041214
{
1205-
return
1206-
(
1207-
(timer.Clock() ? 0 : (timer.Advance(status), 1)) |
1208-
(drive.Clock() ? 0 : drive.Advance(status))
1209-
);
1215+
bool retval = false;
1216+
1217+
if (timer.Clock())
1218+
{
1219+
status |= STATUS_PENDING_IRQ;
1220+
retval = true;
1221+
}
1222+
1223+
return (retval | (drive.Clock() ? 0 : drive.Advance(status)));
12101224
}
12111225

12121226
#ifdef NST_MSVC_OPTIMIZE
@@ -1216,6 +1230,12 @@ namespace Nes
12161230
Fds::Adapter::Adapter(Cpu& c,const Disks::Sides& s)
12171231
: Timer::M2<Unit>(c,s) {}
12181232

1233+
void Fds::Adapter::DisableIRQ()
1234+
{
1235+
unit.status &= ~uint(Unit::STATUS_PENDING_IRQ);
1236+
unit.timer.ctrl &= ~uint(Unit::Timer::CTRL_ENABLED);
1237+
}
1238+
12191239
void Fds::Adapter::Reset(Cpu& cpu,byte* const io,bool protect)
12201240
{
12211241
Timer::M2<Unit>::Reset( true, true );
@@ -1379,12 +1399,17 @@ namespace Nes
13791399
{
13801400
Update();
13811401

1402+
if (!(ctrl & Io::CTRL0_DISK_ENABLED))
1403+
return;
1404+
13821405
unit.timer.ctrl = data;
13831406
unit.timer.count = unit.timer.latch;
13841407
unit.status &= Unit::STATUS_TRANSFERED;
13851408

1386-
if (!unit.status)
1387-
ClearIRQ();
1409+
if (data & Unit::Timer::CTRL_ENABLED)
1410+
return;
1411+
1412+
ClearIRQ();
13881413
}
13891414

13901415
NES_POKE_D(Fds::Adapter,4024)

core/NstFds.hpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -340,7 +340,6 @@ namespace Nes
340340
Timer();
341341

342342
void Reset();
343-
void Advance(uint&);
344343

345344
NST_SINGLE_CALL bool Clock();
346345

@@ -435,6 +434,7 @@ namespace Nes
435434

436435
Adapter(Cpu&,const Disks::Sides&);
437436

437+
void DisableIRQ();
438438
void Reset(Cpu&,byte*,bool=false);
439439
void LoadState(State::Loader&,dword,Ppu&);
440440
void SaveState(State::Saver&) const;
@@ -447,6 +447,8 @@ namespace Nes
447447
NST_SINGLE_CALL uint Activity() const;
448448

449449
using Timer::M2<Unit>::VSync;
450+
451+
byte ctrl;
450452
};
451453

452454
struct Io

0 commit comments

Comments
 (0)