MCPcopy Create free account
hub / github.com/0ldsk00l/nestopia / LoadDiskData

Method LoadDiskData

source/win32/NstManagerEmulator.cpp:973–1024  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

971 }
972
973 void Emulator::LoadDiskData(Nes::User::File& context) const
974 {
975 switch (settings.fds.save)
976 {
977 case DISKIMAGE_SAVE_TO_PATCH:
978
979 if (settings.paths.save.FileExists())
980 {
981 try
982 {
983 Io::Stream::In stream( settings.paths.save );
984 const Nes::Result result = context.SetPatchContent( stream );
985
986 if (NES_SUCCEEDED(result))
987 {
988 Io::Log() << "Emulator: patched disk image with \"" << settings.paths.save << "\"\r\n";
989 }
990 else
991 {
992 HeapString msg( Resource::String( IDS_FDS_PATCHDATALOAD_FAILED ).Invoke( settings.paths.save ) );
993
994 if (const uint id = ResultToString( result ))
995 msg << ' ' << Resource::String( id );
996
997 Window::User::Warn( msg.Ptr() );
998 }
999 }
1000 catch (Io::File::Exception id)
1001 {
1002 HeapString msg;
1003
1004 msg << Resource::String( IDS_FDS_PATCHDATALOAD_FAILED ).Invoke( settings.paths.save )
1005 << ' '
1006 << Resource::String( id );
1007
1008 Window::User::Warn( msg.Ptr() );
1009 }
1010 }
1011 else if (settings.paths.save.Length())
1012 {
1013 Io::Log() << "Emulator: patch file \"" << settings.paths.save << "\" not found\r\n";
1014 }
1015 break;
1016
1017 case DISKIMAGE_SAVE_TO_IMAGE:
1018
1019 if (!settings.paths.image.FileExists())
1020 Window::User::Warn( IDS_EMU_FDS_NO_FILE );
1021
1022 break;
1023 }
1024 }
1025
1026 void Emulator::SaveDiskData(Nes::User::File& context) const
1027 {

Callers 1

DoFileIOMethod · 0.80

Calls 7

WarnFunction · 0.85
FileExistsMethod · 0.80
LogClass · 0.70
StringClass · 0.70
SetPatchContentMethod · 0.45
PtrMethod · 0.45
LengthMethod · 0.45

Tested by

no test coverage detected