init push

This commit is contained in:
Haifisch 2022-09-24 21:48:35 -07:00
parent 5790ecb541
commit dbca65ab58
70 changed files with 11602 additions and 550 deletions

View File

@ -7,13 +7,47 @@
objects = {
/* Begin PBXBuildFile section */
B92B235328D671D800A78F39 /* PreferencePane.m in Sources */ = {isa = PBXBuildFile; fileRef = B92B235128D671D800A78F39 /* PreferencePane.m */; };
B92B235428D671D800A78F39 /* PreferencePane.xib in Resources */ = {isa = PBXBuildFile; fileRef = B92B235228D671D800A78F39 /* PreferencePane.xib */; };
B92B235728D6744400A78F39 /* PreferencesManager.m in Sources */ = {isa = PBXBuildFile; fileRef = B92B235628D6744400A78F39 /* PreferencesManager.m */; };
B949CB8428DA76C9002C81CD /* CollectionLayout.m in Sources */ = {isa = PBXBuildFile; fileRef = B949CB8328DA76C9002C81CD /* CollectionLayout.m */; };
B96675EC28CBF33B00C2ECCE /* AppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = B96675EB28CBF33B00C2ECCE /* AppDelegate.m */; };
B96675EE28CBF33D00C2ECCE /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = B96675ED28CBF33D00C2ECCE /* Assets.xcassets */; };
B96675F128CBF33D00C2ECCE /* MainMenu.xib in Resources */ = {isa = PBXBuildFile; fileRef = B96675EF28CBF33D00C2ECCE /* MainMenu.xib */; };
B96675F328CBF33D00C2ECCE /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = B96675F228CBF33D00C2ECCE /* main.m */; };
B96675FD28CBF81000C2ECCE /* ROMHeaderViewer.m in Sources */ = {isa = PBXBuildFile; fileRef = B96675FB28CBF81000C2ECCE /* ROMHeaderViewer.m */; };
B96675FE28CBF81000C2ECCE /* ROMHeaderViewer.xib in Resources */ = {isa = PBXBuildFile; fileRef = B96675FC28CBF81000C2ECCE /* ROMHeaderViewer.xib */; };
B966760228CBFA5900C2ECCE /* RHMainWindow.m in Sources */ = {isa = PBXBuildFile; fileRef = B966760028CBFA5900C2ECCE /* RHMainWindow.m */; };
B966760328CBFA5900C2ECCE /* RHMainWindow.xib in Resources */ = {isa = PBXBuildFile; fileRef = B966760128CBFA5900C2ECCE /* RHMainWindow.xib */; };
B966760728CC226C00C2ECCE /* IBMPlexMono-Bold.ttf in Resources */ = {isa = PBXBuildFile; fileRef = B966760428CC226C00C2ECCE /* IBMPlexMono-Bold.ttf */; };
B966760828CC226C00C2ECCE /* IBMPlexMono-Regular.ttf in Resources */ = {isa = PBXBuildFile; fileRef = B966760528CC226C00C2ECCE /* IBMPlexMono-Regular.ttf */; };
B966760928CC226C00C2ECCE /* IBMPlexMono-Light.ttf in Resources */ = {isa = PBXBuildFile; fileRef = B966760628CC226C00C2ECCE /* IBMPlexMono-Light.ttf */; };
B966761128CDAAE500C2ECCE /* NDSCartridgeData.m in Sources */ = {isa = PBXBuildFile; fileRef = B966761028CDAAE500C2ECCE /* NDSCartridgeData.m */; };
B966F64428DD7B4500BFA6D8 /* colorspacehandler.cpp in Sources */ = {isa = PBXBuildFile; fileRef = B966F63D28DD7B4400BFA6D8 /* colorspacehandler.cpp */; };
B966F64E28DD9FA100BFA6D8 /* SyncScrollView.m in Sources */ = {isa = PBXBuildFile; fileRef = B966F64D28DD9FA100BFA6D8 /* SyncScrollView.m */; };
B966F65128DE6DE100BFA6D8 /* PopoverInformationView.m in Sources */ = {isa = PBXBuildFile; fileRef = B966F65028DE6DE100BFA6D8 /* PopoverInformationView.m */; };
B96CBA4528D82D4A00FCC2CA /* HexTextView.m in Sources */ = {isa = PBXBuildFile; fileRef = B96CBA4328D82D4A00FCC2CA /* HexTextView.m */; };
B96CBA4628D82D4A00FCC2CA /* HexTextView.xib in Resources */ = {isa = PBXBuildFile; fileRef = B96CBA4428D82D4A00FCC2CA /* HexTextView.xib */; };
B96CBA4A28D8FE2B00FCC2CA /* AddressTextView.m in Sources */ = {isa = PBXBuildFile; fileRef = B96CBA4828D8FE2B00FCC2CA /* AddressTextView.m */; };
B96CBA4B28D8FE2B00FCC2CA /* AddressTextView.xib in Resources */ = {isa = PBXBuildFile; fileRef = B96CBA4928D8FE2B00FCC2CA /* AddressTextView.xib */; };
B96CBA4F28DA671800FCC2CA /* ASCIITextView.m in Sources */ = {isa = PBXBuildFile; fileRef = B96CBA4D28DA671800FCC2CA /* ASCIITextView.m */; };
B96CBA5028DA671800FCC2CA /* ASCIITextView.xib in Resources */ = {isa = PBXBuildFile; fileRef = B96CBA4E28DA671800FCC2CA /* ASCIITextView.xib */; };
B9A79A2128DFDE3100966F34 /* NSString+WordCount.m in Sources */ = {isa = PBXBuildFile; fileRef = B9A79A2028DFDE3100966F34 /* NSString+WordCount.m */; };
B9A79A2528DFEEC100966F34 /* README.txt in Resources */ = {isa = PBXBuildFile; fileRef = B9A79A2428DFEEC100966F34 /* README.txt */; };
B9A79A2A28DFF08600966F34 /* Cocoa.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = B9A79A2928DFF08600966F34 /* Cocoa.framework */; };
B9A79A2C28DFF08A00966F34 /* AppKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = B9A79A2B28DFF08A00966F34 /* AppKit.framework */; };
B9B4B4F428D5786000F629E1 /* ColorGenerator.m in Sources */ = {isa = PBXBuildFile; fileRef = B9B4B4F328D5786000F629E1 /* ColorGenerator.m */; };
B9B4B4F628D57B6A00F629E1 /* ndsheaderspec.plist in Resources */ = {isa = PBXBuildFile; fileRef = B9B4B4F528D57B6A00F629E1 /* ndsheaderspec.plist */; };
/* End PBXBuildFile section */
/* Begin PBXFileReference section */
B92B235028D671D800A78F39 /* PreferencePane.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = PreferencePane.h; sourceTree = "<group>"; };
B92B235128D671D800A78F39 /* PreferencePane.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = PreferencePane.m; sourceTree = "<group>"; };
B92B235228D671D800A78F39 /* PreferencePane.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = PreferencePane.xib; sourceTree = "<group>"; };
B92B235528D6744400A78F39 /* PreferencesManager.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = PreferencesManager.h; sourceTree = "<group>"; };
B92B235628D6744400A78F39 /* PreferencesManager.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = PreferencesManager.m; sourceTree = "<group>"; };
B949CB8228DA76C9002C81CD /* CollectionLayout.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = CollectionLayout.h; sourceTree = "<group>"; };
B949CB8328DA76C9002C81CD /* CollectionLayout.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = CollectionLayout.m; sourceTree = "<group>"; };
B96675E728CBF33B00C2ECCE /* FSCHMasterEditor.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = FSCHMasterEditor.app; sourceTree = BUILT_PRODUCTS_DIR; };
B96675EA28CBF33B00C2ECCE /* AppDelegate.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = AppDelegate.h; sourceTree = "<group>"; };
B96675EB28CBF33B00C2ECCE /* AppDelegate.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = AppDelegate.m; sourceTree = "<group>"; };
@ -21,6 +55,56 @@
B96675F028CBF33D00C2ECCE /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = Base; path = Base.lproj/MainMenu.xib; sourceTree = "<group>"; };
B96675F228CBF33D00C2ECCE /* main.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = "<group>"; };
B96675F428CBF33D00C2ECCE /* FSCHMasterEditor.entitlements */ = {isa = PBXFileReference; lastKnownFileType = text.plist.entitlements; path = FSCHMasterEditor.entitlements; sourceTree = "<group>"; };
B96675FA28CBF81000C2ECCE /* ROMHeaderViewer.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = ROMHeaderViewer.h; sourceTree = "<group>"; };
B96675FB28CBF81000C2ECCE /* ROMHeaderViewer.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = ROMHeaderViewer.m; sourceTree = "<group>"; };
B96675FC28CBF81000C2ECCE /* ROMHeaderViewer.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = ROMHeaderViewer.xib; sourceTree = "<group>"; };
B96675FF28CBFA5900C2ECCE /* RHMainWindow.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = RHMainWindow.h; sourceTree = "<group>"; };
B966760028CBFA5900C2ECCE /* RHMainWindow.m */ = {isa = PBXFileReference; explicitFileType = sourcecode.c.objc; path = RHMainWindow.m; sourceTree = "<group>"; };
B966760128CBFA5900C2ECCE /* RHMainWindow.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = RHMainWindow.xib; sourceTree = "<group>"; };
B966760428CC226C00C2ECCE /* IBMPlexMono-Bold.ttf */ = {isa = PBXFileReference; lastKnownFileType = file; path = "IBMPlexMono-Bold.ttf"; sourceTree = "<group>"; };
B966760528CC226C00C2ECCE /* IBMPlexMono-Regular.ttf */ = {isa = PBXFileReference; lastKnownFileType = file; path = "IBMPlexMono-Regular.ttf"; sourceTree = "<group>"; };
B966760628CC226C00C2ECCE /* IBMPlexMono-Light.ttf */ = {isa = PBXFileReference; lastKnownFileType = file; path = "IBMPlexMono-Light.ttf"; sourceTree = "<group>"; };
B966760B28CC66EE00C2ECCE /* NDSCartridge.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = NDSCartridge.h; sourceTree = "<group>"; };
B966760F28CDAAE500C2ECCE /* NDSCartridgeData.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = NDSCartridgeData.h; sourceTree = "<group>"; };
B966761028CDAAE500C2ECCE /* NDSCartridgeData.m */ = {isa = PBXFileReference; explicitFileType = sourcecode.cpp.objcpp; path = NDSCartridgeData.m; sourceTree = "<group>"; };
B966F63428DD7B4400BFA6D8 /* colorspacehandler_AVX512.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = colorspacehandler_AVX512.cpp; sourceTree = "<group>"; };
B966F63528DD7B4400BFA6D8 /* colorspacehandler_SSE2.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = colorspacehandler_SSE2.h; sourceTree = "<group>"; };
B966F63628DD7B4400BFA6D8 /* colorspacehandler_AVX512.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = colorspacehandler_AVX512.h; sourceTree = "<group>"; };
B966F63728DD7B4400BFA6D8 /* colorspacehandler_AVX2.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = colorspacehandler_AVX2.cpp; sourceTree = "<group>"; };
B966F63828DD7B4400BFA6D8 /* colorspacehandler_NEON.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = colorspacehandler_NEON.cpp; sourceTree = "<group>"; };
B966F63928DD7B4400BFA6D8 /* colorspacehandler_NEON.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = colorspacehandler_NEON.h; sourceTree = "<group>"; };
B966F63A28DD7B4400BFA6D8 /* colorspacehandler_AVX2.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = colorspacehandler_AVX2.h; sourceTree = "<group>"; };
B966F63B28DD7B4400BFA6D8 /* colorspacehandler_SSE2.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = colorspacehandler_SSE2.cpp; sourceTree = "<group>"; };
B966F63C28DD7B4400BFA6D8 /* colorspacehandler_AltiVec.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = colorspacehandler_AltiVec.h; sourceTree = "<group>"; };
B966F63D28DD7B4400BFA6D8 /* colorspacehandler.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = colorspacehandler.cpp; sourceTree = "<group>"; };
B966F63E28DD7B4400BFA6D8 /* colorspacehandler_AltiVec.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = colorspacehandler_AltiVec.cpp; sourceTree = "<group>"; };
B966F63F28DD7B4400BFA6D8 /* colorspacehandler.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = colorspacehandler.h; sourceTree = "<group>"; };
B966F64628DD7B5A00BFA6D8 /* types.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = types.h; sourceTree = "<group>"; };
B966F64728DD7B9B00BFA6D8 /* retro_miscellaneous.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = retro_miscellaneous.h; sourceTree = "<group>"; };
B966F64828DD7BAE00BFA6D8 /* retro_inline.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = retro_inline.h; sourceTree = "<group>"; };
B966F64928DD9E7B00BFA6D8 /* FSCHMasterEditor-Bridging-Header.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "FSCHMasterEditor-Bridging-Header.h"; sourceTree = "<group>"; };
B966F64C28DD9FA100BFA6D8 /* SyncScrollView.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = SyncScrollView.h; sourceTree = "<group>"; };
B966F64D28DD9FA100BFA6D8 /* SyncScrollView.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = SyncScrollView.m; sourceTree = "<group>"; };
B966F64F28DE6DE100BFA6D8 /* PopoverInformationView.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = PopoverInformationView.h; sourceTree = "<group>"; };
B966F65028DE6DE100BFA6D8 /* PopoverInformationView.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = PopoverInformationView.m; sourceTree = "<group>"; };
B96CBA4228D82D4A00FCC2CA /* HexTextView.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = HexTextView.h; sourceTree = "<group>"; };
B96CBA4328D82D4A00FCC2CA /* HexTextView.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = HexTextView.m; sourceTree = "<group>"; };
B96CBA4428D82D4A00FCC2CA /* HexTextView.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = HexTextView.xib; sourceTree = "<group>"; };
B96CBA4728D8FE2B00FCC2CA /* AddressTextView.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = AddressTextView.h; sourceTree = "<group>"; };
B96CBA4828D8FE2B00FCC2CA /* AddressTextView.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = AddressTextView.m; sourceTree = "<group>"; };
B96CBA4928D8FE2B00FCC2CA /* AddressTextView.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = AddressTextView.xib; sourceTree = "<group>"; };
B96CBA4C28DA671800FCC2CA /* ASCIITextView.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = ASCIITextView.h; sourceTree = "<group>"; };
B96CBA4D28DA671800FCC2CA /* ASCIITextView.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = ASCIITextView.m; sourceTree = "<group>"; };
B96CBA4E28DA671800FCC2CA /* ASCIITextView.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = ASCIITextView.xib; sourceTree = "<group>"; };
B9A79A1F28DFDE3100966F34 /* NSString+WordCount.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "NSString+WordCount.h"; sourceTree = "<group>"; };
B9A79A2028DFDE3100966F34 /* NSString+WordCount.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = "NSString+WordCount.m"; sourceTree = "<group>"; };
B9A79A2428DFEEC100966F34 /* README.txt */ = {isa = PBXFileReference; lastKnownFileType = text; path = README.txt; sourceTree = "<group>"; };
B9A79A2728DFF07D00966F34 /* CryptoKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CryptoKit.framework; path = System/Library/Frameworks/CryptoKit.framework; sourceTree = SDKROOT; };
B9A79A2928DFF08600966F34 /* Cocoa.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Cocoa.framework; path = System/Library/Frameworks/Cocoa.framework; sourceTree = SDKROOT; };
B9A79A2B28DFF08A00966F34 /* AppKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = AppKit.framework; path = System/Library/Frameworks/AppKit.framework; sourceTree = SDKROOT; };
B9B4B4F228D5786000F629E1 /* ColorGenerator.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = ColorGenerator.h; sourceTree = "<group>"; };
B9B4B4F328D5786000F629E1 /* ColorGenerator.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = ColorGenerator.m; sourceTree = "<group>"; };
B9B4B4F528D57B6A00F629E1 /* ndsheaderspec.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = ndsheaderspec.plist; sourceTree = "<group>"; };
/* End PBXFileReference section */
/* Begin PBXFrameworksBuildPhase section */
@ -28,6 +112,8 @@
isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647;
files = (
B9A79A2C28DFF08A00966F34 /* AppKit.framework in Frameworks */,
B9A79A2A28DFF08600966F34 /* Cocoa.framework in Frameworks */,
);
runOnlyForDeploymentPostprocessing = 0;
};
@ -39,6 +125,7 @@
children = (
B96675E928CBF33B00C2ECCE /* FSCHMasterEditor */,
B96675E828CBF33B00C2ECCE /* Products */,
B9A79A2628DFF07D00966F34 /* Frameworks */,
);
sourceTree = "<group>";
};
@ -53,16 +140,120 @@
B96675E928CBF33B00C2ECCE /* FSCHMasterEditor */ = {
isa = PBXGroup;
children = (
B9A79A2328DFDE5000966F34 /* prefs */,
B9A79A2228DFDE3C00966F34 /* nds */,
B966760A28CC227500C2ECCE /* fonts */,
B96675EA28CBF33B00C2ECCE /* AppDelegate.h */,
B96675EB28CBF33B00C2ECCE /* AppDelegate.m */,
B96675FA28CBF81000C2ECCE /* ROMHeaderViewer.h */,
B96675FB28CBF81000C2ECCE /* ROMHeaderViewer.m */,
B96675FC28CBF81000C2ECCE /* ROMHeaderViewer.xib */,
B96675FF28CBFA5900C2ECCE /* RHMainWindow.h */,
B966760028CBFA5900C2ECCE /* RHMainWindow.m */,
B966760128CBFA5900C2ECCE /* RHMainWindow.xib */,
B966F64F28DE6DE100BFA6D8 /* PopoverInformationView.h */,
B966F65028DE6DE100BFA6D8 /* PopoverInformationView.m */,
B9B4B4F228D5786000F629E1 /* ColorGenerator.h */,
B9B4B4F328D5786000F629E1 /* ColorGenerator.m */,
B9A79A1F28DFDE3100966F34 /* NSString+WordCount.h */,
B9A79A2028DFDE3100966F34 /* NSString+WordCount.m */,
B96CBA3C28D8299600FCC2CA /* CustomViews */,
B9B4B4F528D57B6A00F629E1 /* ndsheaderspec.plist */,
B96675ED28CBF33D00C2ECCE /* Assets.xcassets */,
B96675EF28CBF33D00C2ECCE /* MainMenu.xib */,
B96675F228CBF33D00C2ECCE /* main.m */,
B96675F428CBF33D00C2ECCE /* FSCHMasterEditor.entitlements */,
B966F64928DD9E7B00BFA6D8 /* FSCHMasterEditor-Bridging-Header.h */,
);
path = FSCHMasterEditor;
sourceTree = "<group>";
};
B966760A28CC227500C2ECCE /* fonts */ = {
isa = PBXGroup;
children = (
B966760428CC226C00C2ECCE /* IBMPlexMono-Bold.ttf */,
B966760628CC226C00C2ECCE /* IBMPlexMono-Light.ttf */,
B966760528CC226C00C2ECCE /* IBMPlexMono-Regular.ttf */,
);
path = fonts;
sourceTree = "<group>";
};
B966F63328DD7B4400BFA6D8 /* colorspacehandler */ = {
isa = PBXGroup;
children = (
B966F63428DD7B4400BFA6D8 /* colorspacehandler_AVX512.cpp */,
B966F63528DD7B4400BFA6D8 /* colorspacehandler_SSE2.h */,
B966F63628DD7B4400BFA6D8 /* colorspacehandler_AVX512.h */,
B966F63728DD7B4400BFA6D8 /* colorspacehandler_AVX2.cpp */,
B966F63828DD7B4400BFA6D8 /* colorspacehandler_NEON.cpp */,
B966F63928DD7B4400BFA6D8 /* colorspacehandler_NEON.h */,
B966F63A28DD7B4400BFA6D8 /* colorspacehandler_AVX2.h */,
B966F63B28DD7B4400BFA6D8 /* colorspacehandler_SSE2.cpp */,
B966F63C28DD7B4400BFA6D8 /* colorspacehandler_AltiVec.h */,
B966F63D28DD7B4400BFA6D8 /* colorspacehandler.cpp */,
B966F63E28DD7B4400BFA6D8 /* colorspacehandler_AltiVec.cpp */,
B966F63F28DD7B4400BFA6D8 /* colorspacehandler.h */,
);
path = colorspacehandler;
sourceTree = "<group>";
};
B96CBA3C28D8299600FCC2CA /* CustomViews */ = {
isa = PBXGroup;
children = (
B966F64C28DD9FA100BFA6D8 /* SyncScrollView.h */,
B966F64D28DD9FA100BFA6D8 /* SyncScrollView.m */,
B96CBA4228D82D4A00FCC2CA /* HexTextView.h */,
B96CBA4328D82D4A00FCC2CA /* HexTextView.m */,
B96CBA4428D82D4A00FCC2CA /* HexTextView.xib */,
B96CBA4728D8FE2B00FCC2CA /* AddressTextView.h */,
B96CBA4828D8FE2B00FCC2CA /* AddressTextView.m */,
B96CBA4928D8FE2B00FCC2CA /* AddressTextView.xib */,
B96CBA4C28DA671800FCC2CA /* ASCIITextView.h */,
B96CBA4D28DA671800FCC2CA /* ASCIITextView.m */,
B96CBA4E28DA671800FCC2CA /* ASCIITextView.xib */,
B949CB8228DA76C9002C81CD /* CollectionLayout.h */,
B949CB8328DA76C9002C81CD /* CollectionLayout.m */,
);
path = CustomViews;
sourceTree = "<group>";
};
B9A79A2228DFDE3C00966F34 /* nds */ = {
isa = PBXGroup;
children = (
B966F63328DD7B4400BFA6D8 /* colorspacehandler */,
B966F64728DD7B9B00BFA6D8 /* retro_miscellaneous.h */,
B966F64628DD7B5A00BFA6D8 /* types.h */,
B966F64828DD7BAE00BFA6D8 /* retro_inline.h */,
B966760B28CC66EE00C2ECCE /* NDSCartridge.h */,
B966760F28CDAAE500C2ECCE /* NDSCartridgeData.h */,
B966761028CDAAE500C2ECCE /* NDSCartridgeData.m */,
B9A79A2428DFEEC100966F34 /* README.txt */,
);
path = nds;
sourceTree = "<group>";
};
B9A79A2328DFDE5000966F34 /* prefs */ = {
isa = PBXGroup;
children = (
B92B235028D671D800A78F39 /* PreferencePane.h */,
B92B235128D671D800A78F39 /* PreferencePane.m */,
B92B235528D6744400A78F39 /* PreferencesManager.h */,
B92B235628D6744400A78F39 /* PreferencesManager.m */,
B92B235228D671D800A78F39 /* PreferencePane.xib */,
);
path = prefs;
sourceTree = "<group>";
};
B9A79A2628DFF07D00966F34 /* Frameworks */ = {
isa = PBXGroup;
children = (
B9A79A2B28DFF08A00966F34 /* AppKit.framework */,
B9A79A2928DFF08600966F34 /* Cocoa.framework */,
B9A79A2728DFF07D00966F34 /* CryptoKit.framework */,
);
name = Frameworks;
sourceTree = "<group>";
};
/* End PBXGroup section */
/* Begin PBXNativeTarget section */
@ -90,10 +281,11 @@
isa = PBXProject;
attributes = {
BuildIndependentTargetsInParallel = 1;
LastUpgradeCheck = 1340;
LastUpgradeCheck = 1400;
TargetAttributes = {
B96675E628CBF33B00C2ECCE = {
CreatedOnToolsVersion = 13.4.1;
LastSwiftMigration = 1400;
};
};
};
@ -120,8 +312,19 @@
isa = PBXResourcesBuildPhase;
buildActionMask = 2147483647;
files = (
B96CBA4B28D8FE2B00FCC2CA /* AddressTextView.xib in Resources */,
B966760328CBFA5900C2ECCE /* RHMainWindow.xib in Resources */,
B96675FE28CBF81000C2ECCE /* ROMHeaderViewer.xib in Resources */,
B9A79A2528DFEEC100966F34 /* README.txt in Resources */,
B92B235428D671D800A78F39 /* PreferencePane.xib in Resources */,
B96675EE28CBF33D00C2ECCE /* Assets.xcassets in Resources */,
B966760728CC226C00C2ECCE /* IBMPlexMono-Bold.ttf in Resources */,
B96CBA4628D82D4A00FCC2CA /* HexTextView.xib in Resources */,
B96CBA5028DA671800FCC2CA /* ASCIITextView.xib in Resources */,
B966760828CC226C00C2ECCE /* IBMPlexMono-Regular.ttf in Resources */,
B9B4B4F628D57B6A00F629E1 /* ndsheaderspec.plist in Resources */,
B96675F128CBF33D00C2ECCE /* MainMenu.xib in Resources */,
B966760928CC226C00C2ECCE /* IBMPlexMono-Light.ttf in Resources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
@ -132,8 +335,22 @@
isa = PBXSourcesBuildPhase;
buildActionMask = 2147483647;
files = (
B96CBA4A28D8FE2B00FCC2CA /* AddressTextView.m in Sources */,
B966F65128DE6DE100BFA6D8 /* PopoverInformationView.m in Sources */,
B966760228CBFA5900C2ECCE /* RHMainWindow.m in Sources */,
B96675F328CBF33D00C2ECCE /* main.m in Sources */,
B966F64E28DD9FA100BFA6D8 /* SyncScrollView.m in Sources */,
B96675FD28CBF81000C2ECCE /* ROMHeaderViewer.m in Sources */,
B96CBA4528D82D4A00FCC2CA /* HexTextView.m in Sources */,
B9A79A2128DFDE3100966F34 /* NSString+WordCount.m in Sources */,
B96675EC28CBF33B00C2ECCE /* AppDelegate.m in Sources */,
B92B235728D6744400A78F39 /* PreferencesManager.m in Sources */,
B949CB8428DA76C9002C81CD /* CollectionLayout.m in Sources */,
B966761128CDAAE500C2ECCE /* NDSCartridgeData.m in Sources */,
B966F64428DD7B4500BFA6D8 /* colorspacehandler.cpp in Sources */,
B96CBA4F28DA671800FCC2CA /* ASCIITextView.m in Sources */,
B92B235328D671D800A78F39 /* PreferencePane.m in Sources */,
B9B4B4F428D5786000F629E1 /* ColorGenerator.m in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
@ -184,6 +401,7 @@
CLANG_WARN_UNREACHABLE_CODE = YES;
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
COPY_PHASE_STRIP = NO;
DEAD_CODE_STRIPPING = YES;
DEBUG_INFORMATION_FORMAT = dwarf;
ENABLE_STRICT_OBJC_MSGSEND = YES;
ENABLE_TESTABILITY = YES;
@ -242,6 +460,7 @@
CLANG_WARN_UNREACHABLE_CODE = YES;
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
COPY_PHASE_STRIP = NO;
DEAD_CODE_STRIPPING = YES;
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
ENABLE_NS_ASSERTIONS = NO;
ENABLE_STRICT_OBJC_MSGSEND = YES;
@ -265,13 +484,20 @@
buildSettings = {
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor;
ASSETCATALOG_COMPILER_INCLUDE_ALL_APPICON_ASSETS = NO;
CLANG_ENABLE_MODULES = YES;
CODE_SIGN_ENTITLEMENTS = FSCHMasterEditor/FSCHMasterEditor.entitlements;
CODE_SIGN_IDENTITY = "-";
"CODE_SIGN_IDENTITY[sdk=macosx*]" = "Apple Development";
CODE_SIGN_STYLE = Automatic;
COMBINE_HIDPI_IMAGES = YES;
CURRENT_PROJECT_VERSION = 1;
CURRENT_PROJECT_VERSION = 2;
DEAD_CODE_STRIPPING = YES;
DEVELOPMENT_TEAM = GH664RVXEQ;
ENABLE_HARDENED_RUNTIME = YES;
GENERATE_INFOPLIST_FILE = YES;
INFOPLIST_KEY_CFBundleDisplayName = "FSCH's Master Editor";
INFOPLIST_KEY_LSApplicationCategoryType = "public.app-category.developer-tools";
INFOPLIST_KEY_NSHumanReadableCopyright = "";
INFOPLIST_KEY_NSMainNibFile = MainMenu;
INFOPLIST_KEY_NSPrincipalClass = NSApplication;
@ -283,6 +509,9 @@
PRODUCT_BUNDLE_IDENTIFIER = software.iwantmyapdemote.FSCHMasterEditor;
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_EMIT_LOC_STRINGS = YES;
SWIFT_OBJC_BRIDGING_HEADER = "FSCHMasterEditor/FSCHMasterEditor-Bridging-Header.h";
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
SWIFT_VERSION = 5.0;
};
name = Debug;
};
@ -291,13 +520,20 @@
buildSettings = {
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor;
ASSETCATALOG_COMPILER_INCLUDE_ALL_APPICON_ASSETS = NO;
CLANG_ENABLE_MODULES = YES;
CODE_SIGN_ENTITLEMENTS = FSCHMasterEditor/FSCHMasterEditor.entitlements;
CODE_SIGN_IDENTITY = "-";
"CODE_SIGN_IDENTITY[sdk=macosx*]" = "Apple Development";
CODE_SIGN_STYLE = Automatic;
COMBINE_HIDPI_IMAGES = YES;
CURRENT_PROJECT_VERSION = 1;
CURRENT_PROJECT_VERSION = 2;
DEAD_CODE_STRIPPING = YES;
DEVELOPMENT_TEAM = GH664RVXEQ;
ENABLE_HARDENED_RUNTIME = YES;
GENERATE_INFOPLIST_FILE = YES;
INFOPLIST_KEY_CFBundleDisplayName = "FSCH's Master Editor";
INFOPLIST_KEY_LSApplicationCategoryType = "public.app-category.developer-tools";
INFOPLIST_KEY_NSHumanReadableCopyright = "";
INFOPLIST_KEY_NSMainNibFile = MainMenu;
INFOPLIST_KEY_NSPrincipalClass = NSApplication;
@ -309,6 +545,8 @@
PRODUCT_BUNDLE_IDENTIFIER = software.iwantmyapdemote.FSCHMasterEditor;
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_EMIT_LOC_STRINGS = YES;
SWIFT_OBJC_BRIDGING_HEADER = "FSCHMasterEditor/FSCHMasterEditor-Bridging-Header.h";
SWIFT_VERSION = 5.0;
};
name = Release;
};

View File

@ -6,19 +6,29 @@
//
#import "AppDelegate.h"
#import "ROMHeaderViewer.h"
#import "PreferencePane.h"
#import "PreferencesManager.h"
@interface AppDelegate ()
@interface AppDelegate () {
PreferencePane *preferences;
PreferencesManager *preferencesManager;
}
@property (readwrite,strong) NSWindowController *windowController;
@property (strong) IBOutlet NSWindow *window;
@end
@implementation AppDelegate
- (void)applicationDidFinishLaunching:(NSNotification *)aNotification {
self.windowController = [[ROMHeaderViewer alloc] init];
[self.windowController showWindow:self];
preferencesManager = [PreferencesManager sharedManager];
// Insert code here to initialize your application
}
- (void)applicationWillTerminate:(NSNotification *)aNotification {
// Insert code here to tear down your application
}
@ -28,5 +38,9 @@
return YES;
}
- (IBAction)openPrefsPane:(id)sender {
preferences = [[PreferencePane alloc] init];
[preferences showWindow:nil];
}
@end

View File

@ -1,51 +1,61 @@
{
"images" : [
{
"filename" : "icon_16x16.png",
"idiom" : "mac",
"scale" : "1x",
"size" : "16x16"
},
{
"filename" : "icon_16x16@2x.png",
"idiom" : "mac",
"scale" : "2x",
"size" : "16x16"
},
{
"filename" : "icon_32x32.png",
"idiom" : "mac",
"scale" : "1x",
"size" : "32x32"
},
{
"filename" : "icon_32x32@2x.png",
"idiom" : "mac",
"scale" : "2x",
"size" : "32x32"
},
{
"filename" : "icon_128x128.png",
"idiom" : "mac",
"scale" : "1x",
"size" : "128x128"
},
{
"filename" : "icon_128x128@2x.png",
"idiom" : "mac",
"scale" : "2x",
"size" : "128x128"
},
{
"filename" : "icon_256x256.png",
"idiom" : "mac",
"scale" : "1x",
"size" : "256x256"
},
{
"filename" : "icon_256x256@2x.png",
"idiom" : "mac",
"scale" : "2x",
"size" : "256x256"
},
{
"filename" : "icon_512x512.png",
"idiom" : "mac",
"scale" : "1x",
"size" : "512x512"
},
{
"filename" : "icon_512x512@2x.png",
"idiom" : "mac",
"scale" : "2x",
"size" : "512x512"

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 531 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 824 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 10 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 824 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 10 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 28 KiB

View File

@ -1,8 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="17150" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none" useAutolayout="YES" customObjectInstantitationMethod="direct">
<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="21225" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none" useAutolayout="YES" customObjectInstantitationMethod="direct">
<dependencies>
<plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="17150"/>
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
<deployment identifier="macosx"/>
<plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="21225"/>
</dependencies>
<objects>
<customObject id="-2" userLabel="File's Owner" customClass="NSApplication">
@ -11,12 +11,8 @@
</connections>
</customObject>
<customObject id="-1" userLabel="First Responder" customClass="FirstResponder"/>
<customObject id="-3" userLabel="Application"/>
<customObject id="Voe-Tx-rLC" customClass="AppDelegate" customModuleProvider="">
<connections>
<outlet property="window" destination="QvC-M9-y7g" id="gIp-Ho-8D9"/>
</connections>
</customObject>
<customObject id="-3" userLabel="Application" customClass="NSObject"/>
<customObject id="Voe-Tx-rLC" customClass="AppDelegate"/>
<customObject id="YLy-65-1bz" customClass="NSFontManager"/>
<menu title="Main Menu" systemMenu="main" id="AYu-sK-qS6">
<items>
@ -31,7 +27,11 @@
</connections>
</menuItem>
<menuItem isSeparatorItem="YES" id="VOq-y0-SEH"/>
<menuItem title="Preferences…" keyEquivalent="," id="BOF-NM-1cW"/>
<menuItem title="Preferences…" keyEquivalent="," id="BOF-NM-1cW">
<connections>
<action selector="openPrefsPane:" target="Voe-Tx-rLC" id="bHz-o3-jyF"/>
</connections>
</menuItem>
<menuItem isSeparatorItem="YES" id="wFC-TO-SCJ"/>
<menuItem title="Services" id="NMo-om-nkz">
<modifierMask key="keyEquivalentModifierMask"/>
@ -68,11 +68,6 @@
<modifierMask key="keyEquivalentModifierMask"/>
<menu key="submenu" title="File" id="bib-Uj-vzu">
<items>
<menuItem title="New" keyEquivalent="n" id="Was-JA-tGl">
<connections>
<action selector="newDocument:" target="-1" id="4Si-XN-c54"/>
</connections>
</menuItem>
<menuItem title="Open…" keyEquivalent="o" id="IAo-SY-fd9">
<connections>
<action selector="openDocument:" target="-1" id="bVn-NM-KNZ"/>
@ -97,546 +92,57 @@
<action selector="performClose:" target="-1" id="HmO-Ls-i7Q"/>
</connections>
</menuItem>
<menuItem title="Save…" keyEquivalent="s" id="pxx-59-PXV">
<connections>
<action selector="saveDocument:" target="-1" id="teZ-XB-qJY"/>
</connections>
</menuItem>
<menuItem title="Save As…" keyEquivalent="S" id="Bw7-FT-i3A">
<connections>
<action selector="saveDocumentAs:" target="-1" id="mDf-zr-I0C"/>
</connections>
</menuItem>
<menuItem title="Revert to Saved" keyEquivalent="r" id="KaW-ft-85H">
<connections>
<action selector="revertDocumentToSaved:" target="-1" id="iJ3-Pv-kwq"/>
</connections>
</menuItem>
<menuItem isSeparatorItem="YES" id="aJh-i4-bef"/>
<menuItem title="Page Setup…" keyEquivalent="P" id="qIS-W8-SiK">
<modifierMask key="keyEquivalentModifierMask" shift="YES" command="YES"/>
<connections>
<action selector="runPageLayout:" target="-1" id="Din-rz-gC5"/>
</connections>
</menuItem>
<menuItem title="Print…" keyEquivalent="p" id="aTl-1u-JFS">
<connections>
<action selector="print:" target="-1" id="qaZ-4w-aoO"/>
</connections>
</menuItem>
</items>
</menu>
</menuItem>
<menuItem title="Edit" id="5QF-Oa-p0T">
<menuItem title="Edit" id="sHG-1b-tQw">
<modifierMask key="keyEquivalentModifierMask"/>
<menu key="submenu" title="Edit" id="W48-6f-4Dl">
<menu key="submenu" title="Edit" id="YWV-na-6ht">
<items>
<menuItem title="Undo" keyEquivalent="z" id="dRJ-4n-Yzg">
<menuItem title="Copy" keyEquivalent="c" id="mgN-jE-UvV">
<connections>
<action selector="undo:" target="-1" id="M6e-cu-g7V"/>
<action selector="copy:" target="-1" id="Q6B-Yp-Qfa"/>
</connections>
</menuItem>
<menuItem title="Redo" keyEquivalent="Z" id="6dh-zS-Vam">
<connections>
<action selector="redo:" target="-1" id="oIA-Rs-6OD"/>
</connections>
</menuItem>
<menuItem isSeparatorItem="YES" id="WRV-NI-Exz"/>
<menuItem title="Cut" keyEquivalent="x" id="uRl-iY-unG">
<connections>
<action selector="cut:" target="-1" id="YJe-68-I9s"/>
</connections>
</menuItem>
<menuItem title="Copy" keyEquivalent="c" id="x3v-GG-iWU">
<connections>
<action selector="copy:" target="-1" id="G1f-GL-Joy"/>
</connections>
</menuItem>
<menuItem title="Paste" keyEquivalent="v" id="gVA-U4-sdL">
<connections>
<action selector="paste:" target="-1" id="UvS-8e-Qdg"/>
</connections>
</menuItem>
<menuItem title="Paste and Match Style" keyEquivalent="V" id="WeT-3V-zwk">
<modifierMask key="keyEquivalentModifierMask" option="YES" command="YES"/>
<connections>
<action selector="pasteAsPlainText:" target="-1" id="cEh-KX-wJQ"/>
</connections>
</menuItem>
<menuItem title="Delete" id="pa3-QI-u2k">
<menuItem isSeparatorItem="YES" id="Frn-FJ-fE5"/>
<menuItem title="Find" id="uFv-Os-4bB">
<modifierMask key="keyEquivalentModifierMask"/>
<connections>
<action selector="delete:" target="-1" id="0Mk-Ml-PaM"/>
</connections>
</menuItem>
<menuItem title="Select All" keyEquivalent="a" id="Ruw-6m-B2m">
<connections>
<action selector="selectAll:" target="-1" id="VNm-Mi-diN"/>
</connections>
</menuItem>
<menuItem isSeparatorItem="YES" id="uyl-h8-XO2"/>
<menuItem title="Find" id="4EN-yA-p0u">
<modifierMask key="keyEquivalentModifierMask"/>
<menu key="submenu" title="Find" id="1b7-l0-nxx">
<menu key="submenu" title="Find" id="CxA-t0-p8e">
<items>
<menuItem title="Find…" tag="1" keyEquivalent="f" id="Xz5-n4-O0W">
<menuItem title="Find…" tag="1" keyEquivalent="f" id="2Az-WD-5M2">
<connections>
<action selector="performFindPanelAction:" target="-1" id="cD7-Qs-BN4"/>
<action selector="performFindPanelAction:" target="-1" id="Un6-Sv-vAj"/>
</connections>
</menuItem>
<menuItem title="Find and Replace…" tag="12" keyEquivalent="f" id="YEy-JH-Tfz">
<menuItem title="Find and Replace…" tag="12" keyEquivalent="f" id="Eiq-pu-QXJ">
<modifierMask key="keyEquivalentModifierMask" option="YES" command="YES"/>
<connections>
<action selector="performFindPanelAction:" target="-1" id="WD3-Gg-5AJ"/>
<action selector="performTextFinderAction:" target="-1" id="vjL-m4-M5y"/>
</connections>
</menuItem>
<menuItem title="Find Next" tag="2" keyEquivalent="g" id="q09-fT-Sye">
<menuItem title="Find Next" tag="2" keyEquivalent="g" id="QCd-kc-Gil">
<connections>
<action selector="performFindPanelAction:" target="-1" id="NDo-RZ-v9R"/>
<action selector="performFindPanelAction:" target="-1" id="NCb-fr-VxT"/>
</connections>
</menuItem>
<menuItem title="Find Previous" tag="3" keyEquivalent="G" id="OwM-mh-QMV">
<menuItem title="Find Previous" tag="3" keyEquivalent="G" id="EXu-mX-KxV">
<connections>
<action selector="performFindPanelAction:" target="-1" id="HOh-sY-3ay"/>
<action selector="performFindPanelAction:" target="-1" id="wlv-4i-iKq"/>
</connections>
</menuItem>
<menuItem title="Use Selection for Find" tag="7" keyEquivalent="e" id="buJ-ug-pKt">
<menuItem title="Use Selection for Find" tag="7" keyEquivalent="e" id="Rbj-fk-zeJ">
<connections>
<action selector="performFindPanelAction:" target="-1" id="U76-nv-p5D"/>
<action selector="performFindPanelAction:" target="-1" id="8mA-zF-rqV"/>
</connections>
</menuItem>
<menuItem title="Jump to Selection" keyEquivalent="j" id="S0p-oC-mLd">
<menuItem title="Jump to Selection" keyEquivalent="j" id="ML4-UC-ISa">
<connections>
<action selector="centerSelectionInVisibleArea:" target="-1" id="IOG-6D-g5B"/>
<action selector="centerSelectionInVisibleArea:" target="-1" id="Hl9-PD-zOK"/>
</connections>
</menuItem>
</items>
</menu>
</menuItem>
<menuItem title="Spelling and Grammar" id="Dv1-io-Yv7">
<modifierMask key="keyEquivalentModifierMask"/>
<menu key="submenu" title="Spelling" id="3IN-sU-3Bg">
<items>
<menuItem title="Show Spelling and Grammar" keyEquivalent=":" id="HFo-cy-zxI">
<connections>
<action selector="showGuessPanel:" target="-1" id="vFj-Ks-hy3"/>
</connections>
</menuItem>
<menuItem title="Check Document Now" keyEquivalent=";" id="hz2-CU-CR7">
<connections>
<action selector="checkSpelling:" target="-1" id="fz7-VC-reM"/>
</connections>
</menuItem>
<menuItem isSeparatorItem="YES" id="bNw-od-mp5"/>
<menuItem title="Check Spelling While Typing" id="rbD-Rh-wIN">
<modifierMask key="keyEquivalentModifierMask"/>
<connections>
<action selector="toggleContinuousSpellChecking:" target="-1" id="7w6-Qz-0kB"/>
</connections>
</menuItem>
<menuItem title="Check Grammar With Spelling" id="mK6-2p-4JG">
<modifierMask key="keyEquivalentModifierMask"/>
<connections>
<action selector="toggleGrammarChecking:" target="-1" id="muD-Qn-j4w"/>
</connections>
</menuItem>
<menuItem title="Correct Spelling Automatically" id="78Y-hA-62v">
<modifierMask key="keyEquivalentModifierMask"/>
<connections>
<action selector="toggleAutomaticSpellingCorrection:" target="-1" id="2lM-Qi-WAP"/>
</connections>
</menuItem>
</items>
</menu>
</menuItem>
<menuItem title="Substitutions" id="9ic-FL-obx">
<modifierMask key="keyEquivalentModifierMask"/>
<menu key="submenu" title="Substitutions" id="FeM-D8-WVr">
<items>
<menuItem title="Show Substitutions" id="z6F-FW-3nz">
<modifierMask key="keyEquivalentModifierMask"/>
<connections>
<action selector="orderFrontSubstitutionsPanel:" target="-1" id="oku-mr-iSq"/>
</connections>
</menuItem>
<menuItem isSeparatorItem="YES" id="gPx-C9-uUO"/>
<menuItem title="Smart Copy/Paste" id="9yt-4B-nSM">
<modifierMask key="keyEquivalentModifierMask"/>
<connections>
<action selector="toggleSmartInsertDelete:" target="-1" id="3IJ-Se-DZD"/>
</connections>
</menuItem>
<menuItem title="Smart Quotes" id="hQb-2v-fYv">
<modifierMask key="keyEquivalentModifierMask"/>
<connections>
<action selector="toggleAutomaticQuoteSubstitution:" target="-1" id="ptq-xd-QOA"/>
</connections>
</menuItem>
<menuItem title="Smart Dashes" id="rgM-f4-ycn">
<modifierMask key="keyEquivalentModifierMask"/>
<connections>
<action selector="toggleAutomaticDashSubstitution:" target="-1" id="oCt-pO-9gS"/>
</connections>
</menuItem>
<menuItem title="Smart Links" id="cwL-P1-jid">
<modifierMask key="keyEquivalentModifierMask"/>
<connections>
<action selector="toggleAutomaticLinkDetection:" target="-1" id="Gip-E3-Fov"/>
</connections>
</menuItem>
<menuItem title="Data Detectors" id="tRr-pd-1PS">
<modifierMask key="keyEquivalentModifierMask"/>
<connections>
<action selector="toggleAutomaticDataDetection:" target="-1" id="R1I-Nq-Kbl"/>
</connections>
</menuItem>
<menuItem title="Text Replacement" id="HFQ-gK-NFA">
<modifierMask key="keyEquivalentModifierMask"/>
<connections>
<action selector="toggleAutomaticTextReplacement:" target="-1" id="DvP-Fe-Py6"/>
</connections>
</menuItem>
</items>
</menu>
</menuItem>
<menuItem title="Transformations" id="2oI-Rn-ZJC">
<modifierMask key="keyEquivalentModifierMask"/>
<menu key="submenu" title="Transformations" id="c8a-y6-VQd">
<items>
<menuItem title="Make Upper Case" id="vmV-6d-7jI">
<modifierMask key="keyEquivalentModifierMask"/>
<connections>
<action selector="uppercaseWord:" target="-1" id="sPh-Tk-edu"/>
</connections>
</menuItem>
<menuItem title="Make Lower Case" id="d9M-CD-aMd">
<modifierMask key="keyEquivalentModifierMask"/>
<connections>
<action selector="lowercaseWord:" target="-1" id="iUZ-b5-hil"/>
</connections>
</menuItem>
<menuItem title="Capitalize" id="UEZ-Bs-lqG">
<modifierMask key="keyEquivalentModifierMask"/>
<connections>
<action selector="capitalizeWord:" target="-1" id="26H-TL-nsh"/>
</connections>
</menuItem>
</items>
</menu>
</menuItem>
<menuItem title="Speech" id="xrE-MZ-jX0">
<modifierMask key="keyEquivalentModifierMask"/>
<menu key="submenu" title="Speech" id="3rS-ZA-NoH">
<items>
<menuItem title="Start Speaking" id="Ynk-f8-cLZ">
<modifierMask key="keyEquivalentModifierMask"/>
<connections>
<action selector="startSpeaking:" target="-1" id="654-Ng-kyl"/>
</connections>
</menuItem>
<menuItem title="Stop Speaking" id="Oyz-dy-DGm">
<modifierMask key="keyEquivalentModifierMask"/>
<connections>
<action selector="stopSpeaking:" target="-1" id="dX8-6p-jy9"/>
</connections>
</menuItem>
</items>
</menu>
</menuItem>
</items>
</menu>
</menuItem>
<menuItem title="Format" id="jxT-CU-nIS">
<modifierMask key="keyEquivalentModifierMask"/>
<menu key="submenu" title="Format" id="GEO-Iw-cKr">
<items>
<menuItem title="Font" id="Gi5-1S-RQB">
<modifierMask key="keyEquivalentModifierMask"/>
<menu key="submenu" title="Font" systemMenu="font" id="aXa-aM-Jaq">
<items>
<menuItem title="Show Fonts" keyEquivalent="t" id="Q5e-8K-NDq">
<connections>
<action selector="orderFrontFontPanel:" target="YLy-65-1bz" id="WHr-nq-2xA"/>
</connections>
</menuItem>
<menuItem title="Bold" tag="2" keyEquivalent="b" id="GB9-OM-e27">
<connections>
<action selector="addFontTrait:" target="YLy-65-1bz" id="hqk-hr-sYV"/>
</connections>
</menuItem>
<menuItem title="Italic" tag="1" keyEquivalent="i" id="Vjx-xi-njq">
<connections>
<action selector="addFontTrait:" target="YLy-65-1bz" id="IHV-OB-c03"/>
</connections>
</menuItem>
<menuItem title="Underline" keyEquivalent="u" id="WRG-CD-K1S">
<connections>
<action selector="underline:" target="-1" id="FYS-2b-JAY"/>
</connections>
</menuItem>
<menuItem isSeparatorItem="YES" id="5gT-KC-WSO"/>
<menuItem title="Bigger" tag="3" keyEquivalent="+" id="Ptp-SP-VEL">
<connections>
<action selector="modifyFont:" target="YLy-65-1bz" id="Uc7-di-UnL"/>
</connections>
</menuItem>
<menuItem title="Smaller" tag="4" keyEquivalent="-" id="i1d-Er-qST">
<connections>
<action selector="modifyFont:" target="YLy-65-1bz" id="HcX-Lf-eNd"/>
</connections>
</menuItem>
<menuItem isSeparatorItem="YES" id="kx3-Dk-x3B"/>
<menuItem title="Kern" id="jBQ-r6-VK2">
<modifierMask key="keyEquivalentModifierMask"/>
<menu key="submenu" title="Kern" id="tlD-Oa-oAM">
<items>
<menuItem title="Use Default" id="GUa-eO-cwY">
<modifierMask key="keyEquivalentModifierMask"/>
<connections>
<action selector="useStandardKerning:" target="-1" id="6dk-9l-Ckg"/>
</connections>
</menuItem>
<menuItem title="Use None" id="cDB-IK-hbR">
<modifierMask key="keyEquivalentModifierMask"/>
<connections>
<action selector="turnOffKerning:" target="-1" id="U8a-gz-Maa"/>
</connections>
</menuItem>
<menuItem title="Tighten" id="46P-cB-AYj">
<modifierMask key="keyEquivalentModifierMask"/>
<connections>
<action selector="tightenKerning:" target="-1" id="hr7-Nz-8ro"/>
</connections>
</menuItem>
<menuItem title="Loosen" id="ogc-rX-tC1">
<modifierMask key="keyEquivalentModifierMask"/>
<connections>
<action selector="loosenKerning:" target="-1" id="8i4-f9-FKE"/>
</connections>
</menuItem>
</items>
</menu>
</menuItem>
<menuItem title="Ligatures" id="o6e-r0-MWq">
<modifierMask key="keyEquivalentModifierMask"/>
<menu key="submenu" title="Ligatures" id="w0m-vy-SC9">
<items>
<menuItem title="Use Default" id="agt-UL-0e3">
<modifierMask key="keyEquivalentModifierMask"/>
<connections>
<action selector="useStandardLigatures:" target="-1" id="7uR-wd-Dx6"/>
</connections>
</menuItem>
<menuItem title="Use None" id="J7y-lM-qPV">
<modifierMask key="keyEquivalentModifierMask"/>
<connections>
<action selector="turnOffLigatures:" target="-1" id="iX2-gA-Ilz"/>
</connections>
</menuItem>
<menuItem title="Use All" id="xQD-1f-W4t">
<modifierMask key="keyEquivalentModifierMask"/>
<connections>
<action selector="useAllLigatures:" target="-1" id="KcB-kA-TuK"/>
</connections>
</menuItem>
</items>
</menu>
</menuItem>
<menuItem title="Baseline" id="OaQ-X3-Vso">
<modifierMask key="keyEquivalentModifierMask"/>
<menu key="submenu" title="Baseline" id="ijk-EB-dga">
<items>
<menuItem title="Use Default" id="3Om-Ey-2VK">
<modifierMask key="keyEquivalentModifierMask"/>
<connections>
<action selector="unscript:" target="-1" id="0vZ-95-Ywn"/>
</connections>
</menuItem>
<menuItem title="Superscript" id="Rqc-34-cIF">
<modifierMask key="keyEquivalentModifierMask"/>
<connections>
<action selector="superscript:" target="-1" id="3qV-fo-wpU"/>
</connections>
</menuItem>
<menuItem title="Subscript" id="I0S-gh-46l">
<modifierMask key="keyEquivalentModifierMask"/>
<connections>
<action selector="subscript:" target="-1" id="Q6W-4W-IGz"/>
</connections>
</menuItem>
<menuItem title="Raise" id="2h7-ER-AoG">
<modifierMask key="keyEquivalentModifierMask"/>
<connections>
<action selector="raiseBaseline:" target="-1" id="4sk-31-7Q9"/>
</connections>
</menuItem>
<menuItem title="Lower" id="1tx-W0-xDw">
<modifierMask key="keyEquivalentModifierMask"/>
<connections>
<action selector="lowerBaseline:" target="-1" id="OF1-bc-KW4"/>
</connections>
</menuItem>
</items>
</menu>
</menuItem>
<menuItem isSeparatorItem="YES" id="Ndw-q3-faq"/>
<menuItem title="Show Colors" keyEquivalent="C" id="bgn-CT-cEk">
<connections>
<action selector="orderFrontColorPanel:" target="-1" id="mSX-Xz-DV3"/>
</connections>
</menuItem>
<menuItem isSeparatorItem="YES" id="iMs-zA-UFJ"/>
<menuItem title="Copy Style" keyEquivalent="c" id="5Vv-lz-BsD">
<modifierMask key="keyEquivalentModifierMask" option="YES" command="YES"/>
<connections>
<action selector="copyFont:" target="-1" id="GJO-xA-L4q"/>
</connections>
</menuItem>
<menuItem title="Paste Style" keyEquivalent="v" id="vKC-jM-MkH">
<modifierMask key="keyEquivalentModifierMask" option="YES" command="YES"/>
<connections>
<action selector="pasteFont:" target="-1" id="JfD-CL-leO"/>
</connections>
</menuItem>
</items>
</menu>
</menuItem>
<menuItem title="Text" id="Fal-I4-PZk">
<modifierMask key="keyEquivalentModifierMask"/>
<menu key="submenu" title="Text" id="d9c-me-L2H">
<items>
<menuItem title="Align Left" keyEquivalent="{" id="ZM1-6Q-yy1">
<connections>
<action selector="alignLeft:" target="-1" id="zUv-R1-uAa"/>
</connections>
</menuItem>
<menuItem title="Center" keyEquivalent="|" id="VIY-Ag-zcb">
<connections>
<action selector="alignCenter:" target="-1" id="spX-mk-kcS"/>
</connections>
</menuItem>
<menuItem title="Justify" id="J5U-5w-g23">
<modifierMask key="keyEquivalentModifierMask"/>
<connections>
<action selector="alignJustified:" target="-1" id="ljL-7U-jND"/>
</connections>
</menuItem>
<menuItem title="Align Right" keyEquivalent="}" id="wb2-vD-lq4">
<connections>
<action selector="alignRight:" target="-1" id="r48-bG-YeY"/>
</connections>
</menuItem>
<menuItem isSeparatorItem="YES" id="4s2-GY-VfK"/>
<menuItem title="Writing Direction" id="H1b-Si-o9J">
<modifierMask key="keyEquivalentModifierMask"/>
<menu key="submenu" title="Writing Direction" id="8mr-sm-Yjd">
<items>
<menuItem title="Paragraph" enabled="NO" id="ZvO-Gk-QUH">
<modifierMask key="keyEquivalentModifierMask"/>
</menuItem>
<menuItem id="YGs-j5-SAR">
<string key="title"> Default</string>
<modifierMask key="keyEquivalentModifierMask"/>
<connections>
<action selector="makeBaseWritingDirectionNatural:" target="-1" id="qtV-5e-UBP"/>
</connections>
</menuItem>
<menuItem id="Lbh-J2-qVU">
<string key="title"> Left to Right</string>
<modifierMask key="keyEquivalentModifierMask"/>
<connections>
<action selector="makeBaseWritingDirectionLeftToRight:" target="-1" id="S0X-9S-QSf"/>
</connections>
</menuItem>
<menuItem id="jFq-tB-4Kx">
<string key="title"> Right to Left</string>
<modifierMask key="keyEquivalentModifierMask"/>
<connections>
<action selector="makeBaseWritingDirectionRightToLeft:" target="-1" id="5fk-qB-AqJ"/>
</connections>
</menuItem>
<menuItem isSeparatorItem="YES" id="swp-gr-a21"/>
<menuItem title="Selection" enabled="NO" id="cqv-fj-IhA">
<modifierMask key="keyEquivalentModifierMask"/>
</menuItem>
<menuItem id="Nop-cj-93Q">
<string key="title"> Default</string>
<modifierMask key="keyEquivalentModifierMask"/>
<connections>
<action selector="makeTextWritingDirectionNatural:" target="-1" id="lPI-Se-ZHp"/>
</connections>
</menuItem>
<menuItem id="BgM-ve-c93">
<string key="title"> Left to Right</string>
<modifierMask key="keyEquivalentModifierMask"/>
<connections>
<action selector="makeTextWritingDirectionLeftToRight:" target="-1" id="caW-Bv-w94"/>
</connections>
</menuItem>
<menuItem id="RB4-Sm-HuC">
<string key="title"> Right to Left</string>
<modifierMask key="keyEquivalentModifierMask"/>
<connections>
<action selector="makeTextWritingDirectionRightToLeft:" target="-1" id="EXD-6r-ZUu"/>
</connections>
</menuItem>
</items>
</menu>
</menuItem>
<menuItem isSeparatorItem="YES" id="fKy-g9-1gm"/>
<menuItem title="Show Ruler" id="vLm-3I-IUL">
<modifierMask key="keyEquivalentModifierMask"/>
<connections>
<action selector="toggleRuler:" target="-1" id="FOx-HJ-KwY"/>
</connections>
</menuItem>
<menuItem title="Copy Ruler" keyEquivalent="c" id="MkV-Pr-PK5">
<modifierMask key="keyEquivalentModifierMask" control="YES" command="YES"/>
<connections>
<action selector="copyRuler:" target="-1" id="71i-fW-3W2"/>
</connections>
</menuItem>
<menuItem title="Paste Ruler" keyEquivalent="v" id="LVM-kO-fVI">
<modifierMask key="keyEquivalentModifierMask" control="YES" command="YES"/>
<connections>
<action selector="pasteRuler:" target="-1" id="cSh-wd-qM2"/>
</connections>
</menuItem>
</items>
</menu>
</menuItem>
</items>
</menu>
</menuItem>
<menuItem title="View" id="H8h-7b-M4v">
<modifierMask key="keyEquivalentModifierMask"/>
<menu key="submenu" title="View" id="HyV-fh-RgO">
<items>
<menuItem title="Show Toolbar" keyEquivalent="t" id="snW-S8-Cw5">
<modifierMask key="keyEquivalentModifierMask" option="YES" command="YES"/>
<connections>
<action selector="toggleToolbarShown:" target="-1" id="BXY-wc-z0C"/>
</connections>
</menuItem>
<menuItem title="Customize Toolbar…" id="1UK-8n-QPP">
<modifierMask key="keyEquivalentModifierMask"/>
<connections>
<action selector="runToolbarCustomizationPalette:" target="-1" id="pQI-g3-MTW"/>
</connections>
</menuItem>
<menuItem isSeparatorItem="YES" id="hB3-LF-h0Y"/>
<menuItem title="Show Sidebar" keyEquivalent="s" id="kIP-vf-haE">
<modifierMask key="keyEquivalentModifierMask" control="YES" command="YES"/>
<connections>
<action selector="toggleSidebar:" target="-1" id="iwa-gc-5KM"/>
</connections>
</menuItem>
<menuItem title="Enter Full Screen" keyEquivalent="f" id="4J7-dP-txa">
<modifierMask key="keyEquivalentModifierMask" control="YES" command="YES"/>
<connections>
<action selector="toggleFullScreen:" target="-1" id="dU3-MA-1Rq"/>
</connections>
</menuItem>
</items>
</menu>
</menuItem>
@ -649,12 +155,6 @@
<action selector="performMiniaturize:" target="-1" id="VwT-WD-YPe"/>
</connections>
</menuItem>
<menuItem title="Zoom" id="R4o-n2-Eq4">
<modifierMask key="keyEquivalentModifierMask"/>
<connections>
<action selector="performZoom:" target="-1" id="DIl-cC-cCs"/>
</connections>
</menuItem>
<menuItem isSeparatorItem="YES" id="eu3-7i-yIM"/>
<menuItem title="Bring All to Front" id="LE2-aR-0XJ">
<modifierMask key="keyEquivalentModifierMask"/>
@ -680,16 +180,5 @@
</items>
<point key="canvasLocation" x="200" y="121"/>
</menu>
<window title="FSCHMasterEditor" allowsToolTipsWhenApplicationIsInactive="NO" autorecalculatesKeyViewLoop="NO" releasedWhenClosed="NO" animationBehavior="default" id="QvC-M9-y7g">
<windowStyleMask key="styleMask" titled="YES" closable="YES" miniaturizable="YES" resizable="YES"/>
<windowPositionMask key="initialPositionMask" leftStrut="YES" rightStrut="YES" topStrut="YES" bottomStrut="YES"/>
<rect key="contentRect" x="335" y="390" width="480" height="360"/>
<rect key="screenRect" x="0.0" y="0.0" width="2560" height="1415"/>
<view key="contentView" id="EiT-Mj-1SZ">
<rect key="frame" x="0.0" y="0.0" width="480" height="360"/>
<autoresizingMask key="autoresizingMask"/>
</view>
<point key="canvasLocation" x="200" y="400"/>
</window>
</objects>
</document>

View File

@ -0,0 +1,19 @@
//
// ColorGenerator.h
// FSCHMasterEditor
//
// Created by Dylan Laws on 9/16/22.
//
#import <Foundation/Foundation.h>
#import <Cocoa/Cocoa.h>
NS_ASSUME_NONNULL_BEGIN
@interface ColorGenerator : NSObject
- (NSColor *)colorFromGradient:(CGFloat)pos;
@end
NS_ASSUME_NONNULL_END

View File

@ -0,0 +1,30 @@
//
// ColorGenerator.m
// FSCHMasterEditor
//
// Created by Dylan Laws on 9/16/22.
//
#import "ColorGenerator.h"
#import "PreferencesManager.h"
@implementation ColorGenerator {
PreferencesManager *preferenceManager;
NSGradient *sharedGradient;
}
- (instancetype)init {
if (self = [super init]) {
preferenceManager = [PreferencesManager sharedManager];
CGFloat pos[5] = {0, 0.25, 0.5, 0.75, 1};
sharedGradient = [[NSGradient alloc] initWithColors:preferenceManager.gradientColors atLocations:pos colorSpace:NSColorSpace.deviceRGBColorSpace];
}
return self;
}
- (NSColor *)colorFromGradient:(CGFloat)pos {
NSColor *ret = [sharedGradient interpolatedColorAtLocation:pos];
return ret;
}
@end

View File

@ -0,0 +1,24 @@
//
// ASCIITextView.h
// FSCHMasterEditor
//
// Created by Dylan Laws on 9/20/22.
//
#import <Cocoa/Cocoa.h>
NS_ASSUME_NONNULL_BEGIN
@interface ASCIITextView : NSCollectionViewItem
@property NSData *rawData;
@property (strong) IBOutlet NSTextField *ASCIIValueLabel;
- (void)setFontColor:(NSColor *)color;
@property BOOL isImportantByte;
@end
NS_ASSUME_NONNULL_END

View File

@ -0,0 +1,66 @@
//
// ASCIITextView.m
// FSCHMasterEditor
//
// Created by Dylan Laws on 9/20/22.
//
#import "ASCIITextView.h"
@interface ASCIITextView () {
NSColor *fontColor;
NSColor *bgColor;
}
@end
@implementation ASCIITextView
- (void)viewDidLoad {
[super viewDidLoad];
self.ASCIIValueLabel = [[self view] viewWithTag:6];
if (self.rawData != nil && self.ASCIIValueLabel != nil) {
NSString *asciiString = [NSString stringWithCString:[self.rawData bytes] encoding:NSASCIIStringEncoding];
NSCharacterSet *whitespaceSet = [NSCharacterSet whitespaceAndNewlineCharacterSet];
NSCharacterSet *controlSet = [NSCharacterSet controlCharacterSet];
if ([asciiString rangeOfCharacterFromSet:whitespaceSet].location != NSNotFound || [asciiString rangeOfCharacterFromSet:controlSet].location != NSNotFound || [asciiString length] == 0) {
asciiString = @".";
}
[self.ASCIIValueLabel setStringValue:asciiString];
}
if (fontColor)
{
[[self ASCIIValueLabel] setTextColor:fontColor];
}
self.view.wantsLayer = true;
// Do view setup here.
}
- (NSNibName)nibName {
return @"ASCIITextView";
}
- (void)setFontColor:(NSColor *)color {
fontColor = color;
CGFloat r,g,b;
r = 1.0f - fontColor.redComponent;
g = 1.0f - fontColor.greenComponent;
b = 1.0f - fontColor.blueComponent;
bgColor = [NSColor colorWithRed:r green:g blue:b alpha:0.6f];
}
- (void)setSelected:(BOOL)selected {
[super setSelected:selected];
if (selected && self.isImportantByte) {
[[[self view] layer] setBackgroundColor:bgColor.CGColor];
} else {
[[[self view] layer] setBackgroundColor:[NSColor clearColor].CGColor];
}
}
- (BOOL)wantsUpdateLayer {
return YES;
}
@end

View File

@ -0,0 +1,40 @@
<?xml version="1.0" encoding="UTF-8"?>
<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="21225" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none" useAutolayout="YES" customObjectInstantitationMethod="direct">
<dependencies>
<deployment identifier="macosx"/>
<plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="21225"/>
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
</dependencies>
<objects>
<customObject id="-2" userLabel="File's Owner" customClass="ASCIITextView">
<connections>
<outlet property="ASCIIValueLabel" destination="DiD-9s-TIM" id="9oP-Fv-ken"/>
<outlet property="textField" destination="DiD-9s-TIM" id="eEz-iJ-p3D"/>
<outlet property="view" destination="VZx-sv-JGC" id="eV5-cN-xCJ"/>
</connections>
</customObject>
<customObject id="-1" userLabel="First Responder" customClass="FirstResponder"/>
<customObject id="-3" userLabel="Application" customClass="NSObject"/>
<customView id="VZx-sv-JGC">
<rect key="frame" x="0.0" y="0.0" width="16" height="16"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
<subviews>
<textField horizontalHuggingPriority="251" verticalHuggingPriority="750" fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="DiD-9s-TIM">
<rect key="frame" x="0.0" y="0.0" width="16" height="16"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<textFieldCell key="cell" lineBreakMode="clipping" alignment="left" title="FF" id="UEY-Di-4I1">
<font key="font" size="12" name="IBMPlexMono-Regular"/>
<color key="textColor" name="labelColor" catalog="System" colorSpace="catalog"/>
<color key="backgroundColor" name="textBackgroundColor" catalog="System" colorSpace="catalog"/>
</textFieldCell>
<userDefinedRuntimeAttributes>
<userDefinedRuntimeAttribute type="number" keyPath="tag">
<integer key="value" value="6"/>
</userDefinedRuntimeAttribute>
</userDefinedRuntimeAttributes>
</textField>
</subviews>
<point key="canvasLocation" x="121" y="5"/>
</customView>
</objects>
</document>

View File

@ -0,0 +1,20 @@
//
// AddressTextView.h
// FSCHMasterEditor
//
// Created by Dylan Laws on 9/19/22.
//
#import <Cocoa/Cocoa.h>
NS_ASSUME_NONNULL_BEGIN
@interface AddressTextView : NSCollectionViewItem
@property NSString *addressString;
@property (strong) IBOutlet NSTextField *addressLabel;
@end
NS_ASSUME_NONNULL_END

View File

@ -0,0 +1,25 @@
//
// AddressTextView.m
// FSCHMasterEditor
//
// Created by Dylan Laws on 9/19/22.
//
#import "AddressTextView.h"
@interface AddressTextView ()
@end
@implementation AddressTextView
- (void)viewDidLoad {
[super viewDidLoad];
self.addressLabel = [[self view] viewWithTag:2];
if (self.addressLabel != nil) {
[self.addressLabel setStringValue:self.addressString];
}
// Do view setup here.
}
@end

View File

@ -0,0 +1,40 @@
<?xml version="1.0" encoding="UTF-8"?>
<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="21225" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none" useAutolayout="YES" customObjectInstantitationMethod="direct">
<dependencies>
<deployment identifier="macosx"/>
<plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="21225"/>
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
</dependencies>
<objects>
<customObject id="-2" userLabel="File's Owner" customClass="AddressTextView">
<connections>
<outlet property="addressLabel" destination="mDx-wT-JV5" id="yOz-GX-3PR"/>
<outlet property="view" destination="Hz6-mo-xeY" id="0bl-1N-x8E"/>
</connections>
</customObject>
<customObject id="-1" userLabel="First Responder" customClass="FirstResponder"/>
<customObject id="-3" userLabel="Application" customClass="NSObject"/>
<customView id="Hz6-mo-xeY">
<rect key="frame" x="0.0" y="0.0" width="48" height="16"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
<subviews>
<textField horizontalHuggingPriority="251" verticalHuggingPriority="750" fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="mDx-wT-JV5">
<rect key="frame" x="-2" y="0.0" width="52" height="16"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
<textFieldCell key="cell" lineBreakMode="clipping" alignment="left" title="000f" id="IGp-9m-Kif">
<font key="font" size="12" name="IBMPlexMono-Light"/>
<color key="textColor" name="labelColor" catalog="System" colorSpace="catalog"/>
<color key="backgroundColor" name="textBackgroundColor" catalog="System" colorSpace="catalog"/>
</textFieldCell>
<userDefinedRuntimeAttributes>
<userDefinedRuntimeAttribute type="number" keyPath="tag">
<integer key="value" value="2"/>
</userDefinedRuntimeAttribute>
</userDefinedRuntimeAttributes>
</textField>
</subviews>
<point key="canvasLocation" x="120" y="154"/>
</customView>
<collectionViewItem nibName="AddressTextView" id="K0c-3G-jHO" customClass="AddressTextView"/>
</objects>
</document>

View File

@ -0,0 +1,16 @@
//
// CollectionLayout.h
// FSCHMasterEditor
//
// Created by Dylan Laws on 9/20/22.
//
#import <Cocoa/Cocoa.h>
NS_ASSUME_NONNULL_BEGIN
@interface CollectionLayout : NSCollectionViewFlowLayout
@end
NS_ASSUME_NONNULL_END

View File

@ -0,0 +1,50 @@
//
// CollectionLayout.m
// FSCHMasterEditor
//
// Created by Dylan Laws on 9/20/22.
//
#import "CollectionLayout.h"
@implementation CollectionLayout
- (void)prepareLayout {
self.scrollDirection = NSCollectionViewScrollDirectionVertical;
self.minimumLineSpacing = 0;
self.minimumInteritemSpacing = 0;
if ([[[self collectionView] identifier] isEqualToString:@"addressView"]) {
self.itemSize = NSMakeSize(48, 16);
self.estimatedItemSize = NSMakeSize(48, 16);
self.sectionInset = NSEdgeInsetsMake(0, 0, 0, 0);
} else {
self.itemSize = NSMakeSize(16, 16);
self.estimatedItemSize = NSMakeSize(16, 16);
self.sectionInset = NSEdgeInsetsMake(0, 0, 0, 0);
}
}
- (BOOL)shouldInvalidateLayoutForBoundsChange:(CGRect)newBounds
{
return NO;
}
/*
- (NSCollectionViewLayoutAttributes *)layoutAttributesForItemAtIndexPath:(NSIndexPath *)indexPath {
NSCollectionViewLayoutAttributes *attr = [[super layoutAttributesForItemAtIndexPath:indexPath] copy];
if (![[[self collectionView] identifier] isEqualToString:@"addressView"]) {
int y = indexPath.item * 16;
int x = (indexPath.item / 24) * 16;
NSRect modifiedFrame = [attr frame];
modifiedFrame.origin.x = floor(modifiedFrame.origin.x / (modifiedFrame.size.width + [self minimumInteritemSpacing])) * (modifiedFrame.size.width + [self minimumInteritemSpacing]);
[attr setFrame:modifiedFrame];
} else {
NSRect modifiedFrame = [attr frame];
modifiedFrame.origin.y = floor(modifiedFrame.origin.y / (modifiedFrame.size.height + [self minimumInteritemSpacing])) * (modifiedFrame.size.height + [self minimumInteritemSpacing]);
[attr setFrame:modifiedFrame];
}
return attr;
}*/
@end

View File

@ -0,0 +1,24 @@
//
// HexTextView.h
// FSCHMasterEditor
//
// Created by Dylan Laws on 9/18/22.
//
#import <Cocoa/Cocoa.h>
NS_ASSUME_NONNULL_BEGIN
@interface HexTextView : NSCollectionViewItem
@property NSData *rawData;
@property (strong) IBOutlet NSTextField *hexValueLabel;
- (void)setFontColor:(NSColor *)color;
@property BOOL isImportantByte;
@end
NS_ASSUME_NONNULL_END

View File

@ -0,0 +1,59 @@
//
// HexTextView.m
// FSCHMasterEditor
//
// Created by Dylan Laws on 9/18/22.
//
#import "HexTextView.h"
@interface HexTextView () {
NSColor *fontColor;
NSColor *bgColor;
}
@end
@implementation HexTextView
- (void)viewDidLoad {
[super viewDidLoad];
self.hexValueLabel = [[self view] viewWithTag:8];
if (self.rawData != nil && self.hexValueLabel != nil) {
[self.hexValueLabel setStringValue:[NSString stringWithFormat:@"%02x", *(unsigned int*)[self.rawData bytes]]];
}
if (fontColor)
{
[[self hexValueLabel] setTextColor:fontColor];
}
self.view.wantsLayer = true;
// Do view setup here.
}
- (void)setFontColor:(NSColor *)color {
fontColor = color;
CGFloat r,g,b;
r = 1.0f - fontColor.redComponent;
g = 1.0f - fontColor.greenComponent;
b = 1.0f - fontColor.blueComponent;
bgColor = [NSColor colorWithRed:r green:g blue:b alpha:0.6f];
}
- (NSNibName)nibName {
return @"HexTextView";
}
- (void)setSelected:(BOOL)selected {
[super setSelected:selected];
if (selected && self.isImportantByte) {
[[[self view] layer] setBackgroundColor:bgColor.CGColor];
} else {
[[[self view] layer] setBackgroundColor:[NSColor clearColor].CGColor];
}
}
- (BOOL)wantsUpdateLayer {
return YES;
}
@end

View File

@ -0,0 +1,41 @@
<?xml version="1.0" encoding="UTF-8"?>
<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="21225" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none" useAutolayout="YES" customObjectInstantitationMethod="direct">
<dependencies>
<deployment identifier="macosx"/>
<plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="21225"/>
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
</dependencies>
<objects>
<customObject id="-2" userLabel="File's Owner" customClass="HexTextView">
<connections>
<outlet property="hexValueLabel" destination="xxz-gq-qZW" id="mNw-Hy-Cu7"/>
<outlet property="sourceItemView" destination="Hz6-mo-xeY" id="9Ns-UN-MIB"/>
<outlet property="textField" destination="xxz-gq-qZW" id="j8O-CQ-ZkD"/>
<outlet property="view" destination="Hz6-mo-xeY" id="0bl-1N-x8E"/>
</connections>
</customObject>
<customObject id="-1" userLabel="First Responder" customClass="FirstResponder"/>
<customObject id="-3" userLabel="Application" customClass="NSObject"/>
<customView id="Hz6-mo-xeY">
<rect key="frame" x="0.0" y="0.0" width="16" height="16"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
<subviews>
<textField identifier="hexValue" horizontalHuggingPriority="251" verticalHuggingPriority="750" fixedFrame="YES" preferredMaxLayoutWidth="16" translatesAutoresizingMaskIntoConstraints="NO" id="xxz-gq-qZW">
<rect key="frame" x="0.0" y="0.0" width="16" height="16"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<textFieldCell key="cell" lineBreakMode="clipping" alignment="left" title="FF" id="FTh-DA-jAf">
<font key="font" size="12" name="IBMPlexMono-Light"/>
<color key="textColor" name="labelColor" catalog="System" colorSpace="catalog"/>
<color key="backgroundColor" name="textBackgroundColor" catalog="System" colorSpace="catalog"/>
</textFieldCell>
<userDefinedRuntimeAttributes>
<userDefinedRuntimeAttribute type="number" keyPath="tag">
<integer key="value" value="8"/>
</userDefinedRuntimeAttribute>
</userDefinedRuntimeAttributes>
</textField>
</subviews>
<point key="canvasLocation" x="-40" y="154"/>
</customView>
</objects>
</document>

View File

@ -0,0 +1,22 @@
//
// SyncScrollView.h
// FSCHMasterEditor
//
// Created by Dylan Laws on 9/23/22.
//
#import <Cocoa/Cocoa.h>
NS_ASSUME_NONNULL_BEGIN
@interface SyncScrollView : NSScrollView {
NSScrollView* synchronizedScrollView; // not retained
}
- (void)setSynchronizedScrollView:(NSScrollView*)scrollview;
- (void)stopSynchronizing;
- (void)synchronizedViewContentBoundsDidChange:(NSNotification *)notification;
@end
NS_ASSUME_NONNULL_END

View File

@ -0,0 +1,102 @@
//
// SyncScrollView.m
// FSCHMasterEditor
//
// Created by Dylan Laws on 9/23/22.
//
#import "SyncScrollView.h"
@implementation SyncScrollView
- (instancetype)initWithFrame:(NSRect)frameRect {
if (self = [super initWithFrame:frameRect]) {
self.hasHorizontalScroller = FALSE;
self.hasVerticalScroller = FALSE;
}
return self;
}
- (void)drawRect:(NSRect)dirtyRect {
[super drawRect:dirtyRect];
// Drawing code here.
}
- (void)setSynchronizedScrollView:(NSScrollView*)scrollview
{
NSView *synchronizedContentView;
// stop an existing scroll view synchronizing
[self stopSynchronizing];
// don't retain the watched view, because we assume that it will
// be retained by the view hierarchy for as long as we're around.
synchronizedScrollView = scrollview;
// get the content view of the
synchronizedContentView=[synchronizedScrollView contentView];
// Make sure the watched view is sending bounds changed
// notifications (which is probably does anyway, but calling
// this again won't hurt).
[synchronizedContentView setPostsBoundsChangedNotifications:YES];
// a register for those notifications on the synchronized content view.
[[NSNotificationCenter defaultCenter] addObserver:self
selector:@selector(synchronizedViewContentBoundsDidChange:)
name:NSViewBoundsDidChangeNotification
object:synchronizedContentView];
}
- (void)synchronizedViewContentBoundsDidChange:(NSNotification *)notification
{
// get the changed content view from the notification
NSClipView *changedContentView=[notification object];
// get the origin of the NSClipView of the scroll view that
// we're watching
NSPoint changedBoundsOrigin = [changedContentView documentVisibleRect].origin;;
// get our current origin
NSPoint curOffset = [[self contentView] bounds].origin;
NSPoint newOffset = curOffset;
// scrolling is synchronized in the vertical plane
// so only modify the y component of the offset
newOffset.y = changedBoundsOrigin.y;
// if our synced position is different from our current
// position, reposition our content view
if (!NSEqualPoints(curOffset, changedBoundsOrigin))
{
// note that a scroll view watching this one will
// get notified here
[[self contentView] scrollToPoint:newOffset];
// we have to tell the NSScrollView to update its
// scrollers
[self reflectScrolledClipView:[self contentView]];
}
}
- (void)stopSynchronizing
{
if (synchronizedScrollView != nil) {
NSView* synchronizedContentView = [synchronizedScrollView contentView];
// remove any existing notification registration
[[NSNotificationCenter defaultCenter] removeObserver:self
name:NSViewBoundsDidChangeNotification
object:synchronizedContentView];
// set synchronizedScrollView to nil
synchronizedScrollView=nil;
}
}
- (void)scrollWheel:(NSEvent *)event {
if ([[self identifier] isEqualToString:@"ASCIIScrollview"]) {
[super scrollWheel:event];
}
}
@end

View File

@ -0,0 +1,4 @@
//
// Use this file to import your target's public headers that you would like to expose to Swift.
//

View File

@ -2,9 +2,9 @@
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>com.apple.security.app-sandbox</key>
<true/>
<key>com.apple.security.files.user-selected.read-only</key>
<true/>
<key>com.apple.security.app-sandbox</key>
<true/>
<key>com.apple.security.files.user-selected.read-write</key>
<true/>
</dict>
</plist>

View File

@ -0,0 +1,18 @@
//
// NSString+WordCount.h
// FSCHMasterEditor
//
// Created by Dylan Laws on 9/24/22.
//
#import <Foundation/Foundation.h>
NS_ASSUME_NONNULL_BEGIN
@interface NSString (NSString_WordCount)
- (NSUInteger)wordCount;
@end
NS_ASSUME_NONNULL_END

View File

@ -0,0 +1,24 @@
//
// NSString+WordCount.m
// FSCHMasterEditor
//
// Created by Dylan Laws on 9/24/22.
//
#import "NSString+WordCount.h"
@implementation NSString (NSString_WordCount)
- (NSUInteger)wordCount {
NSCharacterSet *separators = [NSCharacterSet whitespaceAndNewlineCharacterSet];
NSArray *words = [self componentsSeparatedByCharactersInSet:separators];
NSIndexSet *separatorIndexes = [words indexesOfObjectsPassingTest:^BOOL(id obj, NSUInteger idx, BOOL *stop) {
return [obj isEqualToString:@""];
}];
return [words count] - [separatorIndexes count];
}
@end

View File

@ -0,0 +1,23 @@
//
// PopoverInformationView.h
// FSCHMasterEditor
//
// Created by Dylan Laws on 9/23/22.
//
#import <Cocoa/Cocoa.h>
NS_ASSUME_NONNULL_BEGIN
@interface PopoverInformationView : NSView
@property (strong) NSPopover *hostPopover;
@property (strong) IBOutlet NSTextField *titleLabel;
@property (strong) IBOutlet NSTextField *descriptionLabel;
- (void)setPopoverData:(id)dat title:(NSString *)titleStr;
- (void)setShowingSHASUM:(NSString *)shaValue;
@end
NS_ASSUME_NONNULL_END

View File

@ -0,0 +1,56 @@
//
// PopoverInformationView.m
// FSCHMasterEditor
//
// Created by Dylan Laws on 9/23/22.
//
#import "PopoverInformationView.h"
#import "NSString+WordCount.h"
@implementation PopoverInformationView
- (void)drawRect:(NSRect)dirtyRect {
[super drawRect:dirtyRect];
// Drawing code here.
}
- (BOOL)acceptsFirstResponder {
return TRUE;
}
- (BOOL)canBecomeKeyView {
return YES;
}
- (void)keyDown:(NSEvent *)event {
// todo hide on esc, probably not this way.
}
- (void)setPopoverData:(id)dat title:(NSString *)titleStr {
NSInteger words = [titleStr wordCount];
if (words >= 4) {
[self.titleLabel setFont:[[NSFontManager sharedFontManager] fontWithFamily:@"IBM Plex Mono" traits:NSFontWeightBold weight:0 size:10]];
} else if (words > 2) {
[self.titleLabel setFont:[NSFont fontWithName:@"IBM Plex Mono" size:12]];
} else {
[self.titleLabel setFont:[NSFont fontWithName:@"IBM Plex Mono" size:14]];
}
self.titleLabel.stringValue = titleStr;
NSData *selectedData = dat[@"data"];
NSString *dataFormatType = dat[@"type"];
NSString *selectedValue = @"";
if ([dataFormatType isEqualToString:@"string"]) {
selectedValue = [NSString stringWithCString:(const char*)[selectedData bytes] encoding:NSASCIIStringEncoding];
} else if ([dataFormatType isEqualToString:@"hex"]) {
selectedValue = [NSString stringWithFormat:@"0x%02x", *(unsigned int*)[selectedData bytes]];
}
self.descriptionLabel.stringValue = [NSString stringWithFormat:@"OFFSET @ 0x%02X\nSIZE %i\n%@", [dat[@"offset"] intValue], [dat[@"size"] intValue], selectedValue];
}
- (void)setShowingSHASUM:(NSString *)shaValue {
}
@end

View File

@ -0,0 +1,49 @@
//
// RHMainWindow.h
// FSCHMasterEditor
//
// Created by Dylan Laws on 9/9/22.
//
#import <Cocoa/Cocoa.h>
#import "FSCHMasterEditor-Bridging-Header.h"
#import "SyncScrollView.h"
NS_ASSUME_NONNULL_BEGIN
@protocol RHMainWindowDelegate <NSObject>
@optional
- (void)didFinishLoadingROM;
@end
@interface RHMainWindow : NSWindowController <NSTableViewDelegate, NSTableViewDataSource, NSCollectionViewDelegate, NSCollectionViewDataSource>
typedef void (^completionBlock)(bool param1);
@property (nonatomic, weak) id <RHMainWindowDelegate> delegate;
@property (strong) IBOutlet NSTextField *headerChecksumValidationLabel;
@property (strong) IBOutlet NSImageView *headerChecksumValidationImage;
@property (strong) IBOutlet NSCollectionView *addressCollectionView;
@property (strong) IBOutlet NSCollectionView *hexCollectionView;
@property (strong) IBOutlet NSCollectionView *asciiCollectionView;
@property (strong) IBOutlet SyncScrollView *hexScrollView;
@property (strong) IBOutlet NSClipView *hexClipView;
@property (strong) IBOutlet SyncScrollView *asciiScrollView;
@property (strong) IBOutlet NSClipView *asciiClipView;
@property (strong) IBOutlet SyncScrollView *addressScrollview;
@property (strong) IBOutlet NSClipView *addressClipview;
@property (strong) IBOutlet NSPopover *popoverView;
@property (strong) IBOutlet NSImageView *bannerIconImageView;
- (instancetype)initWithPathToROM:(NSURL *)romPath delegate:(id <RHMainWindowDelegate>)delegate;
- (void)setROMPath:(NSURL *)path;
- (void)doReload;
@end
NS_ASSUME_NONNULL_END

View File

@ -0,0 +1,395 @@
//
// RHMainWindow.m
// FSCHMasterEditor
//
// Created by Dylan Laws on 9/9/22.
//
#import "RHMainWindow.h"
#import "NDSCartridge.h"
#import "NDSCartridgeData.h"
#import "ColorGenerator.h"
#import "HexTextView.h"
#import "AddressTextView.h"
#import "ASCIITextView.h"
#import "PopoverInformationView.h"
#include <objc/runtime.h>
@implementation NSColor (NSColor_Random)
+ (NSColor *)randomColor {
int r,g,b;
r = arc4random_uniform(255);
g = arc4random_uniform(255);
b = arc4random_uniform(255);
return [NSColor colorWithRed:r green:g blue:b alpha:1];
}
@end
@implementation NSData (NSData_Conversion)
#pragma mark - String Conversion
- (NSString *)hexadecimalString {
/* Returns hexadecimal string of NSData. Empty string if data is empty. */
const unsigned char *dataBuffer = (const unsigned char *)[self bytes];
if (!dataBuffer)
return [NSString string];
NSUInteger dataLength = [self length];
NSMutableString *hexString = [NSMutableString stringWithCapacity:(dataLength * 2)];
for (int i = 0; i < dataLength; ++i)
[hexString appendString:[NSString stringWithFormat:@"%02lx ", (unsigned long)dataBuffer[i]]];
return [NSString stringWithString:hexString];
}
@end
@interface RHMainWindow () {
NSURL *romFilePath;
NSFileHandle *romFileHandle;
NSMutableDictionary *romHeaderInfo;
NSMutableArray *addressesArray;
NDSCartridgeData *cartridgeData;
ColorGenerator *colorGen;
BOOL is3DSTypeROM;
BOOL isCollectionViewDataReady;
NSSet<NSIndexPath *> *previousSelectionSet;
int bannerFrame;
BOOL popoverIsShown;
}
@property (strong) IBOutlet NSTableView *tableView;
@end
@implementation RHMainWindow
- (instancetype)initWithPathToROM:(NSURL *)romPath delegate:(id <RHMainWindowDelegate>)ndelegate {
self = [super init];
addressesArray = [[NSMutableArray alloc] init];
colorGen = [[ColorGenerator alloc] init];
romHeaderInfo = [[NSMutableDictionary alloc] init];
isCollectionViewDataReady = false;
self.delegate = ndelegate;
[self setROMPath:romPath];
return self;
}
- (void)windowDidLoad {
[super windowDidLoad];
[[self tableView] setDelegate:self];
[[self tableView] setDataSource:self];
[[self window] setTitle:[romFilePath lastPathComponent]];
[[self addressScrollview] setHasVerticalScroller:FALSE];
[[self hexScrollView] setHasVerticalScroller:FALSE];
[[self addressScrollview] setSynchronizedScrollView:[self hexScrollView]];
[[self hexScrollView] setSynchronizedScrollView:[self asciiScrollView]];
// Implement this method to handle any initialization after your window controller's window has been loaded from its nib file.
}
- (NSString *)windowNibName
{
return @"RHMainWindow";
}
- (void)doReload {
dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_HIGH, 0), ^{
[self processRomFile:^(bool param1) {
if (param1 && self.delegate != nil) {
dispatch_async(dispatch_get_main_queue(), ^{
[self.delegate didFinishLoadingROM];
//[[self hexCollectionView] reloadSections:[NSIndexSet indexSetWithIndex:0]];
//[[self asciiCollectionView] reloadSections:[NSIndexSet indexSetWithIndex:0]];
//[[self addressCollectionView] reloadSections:[NSIndexSet indexSetWithIndex:0]];
[[self hexCollectionView] reloadData];
[[self asciiCollectionView] reloadData];
[[self addressCollectionView] reloadData];
[[self tableView] reloadData];
NSImage *bannerIcon = [self->cartridgeData bannerIcon];
if (self->cartridgeData.hasAnimatedBanner) {
self.bannerIconImageView.image = bannerIcon;
[NSTimer scheduledTimerWithTimeInterval:0.1f target:self selector:@selector(timerInterval:) userInfo:nil repeats:NO];
} else {
self.bannerIconImageView.image = bannerIcon;
}
});
}
}];
});
}
- (NSDictionary *)HeaderSpecificationDictionary {
NSString *specPath = [[NSBundle mainBundle] pathForResource:@"ndsheaderspec" ofType:@"plist"];
return [NSDictionary dictionaryWithContentsOfFile:specPath];
}
- (IBAction)boundsDidChange:(NSNotification *)notification {
}
- (void)processTableView:(sNDSHeaderExt *)ndsHeader andCartridgeData:(NDSCartridgeData *)cartridgeData {
[romFileHandle seekToFileOffset:0];
romHeaderInfo = [[NSMutableDictionary alloc] initWithDictionary:[self HeaderSpecificationDictionary]];
for (int i = 0; i < [romHeaderInfo allKeys].count; i++) {
NSString *curKey = [romHeaderInfo allKeys][i];
int curOffset = [[romHeaderInfo objectForKey:curKey][@"offset"] intValue];
int readSize = [[romHeaderInfo objectForKey:curKey][@"size"] intValue];
[romFileHandle seekToFileOffset:curOffset];
NSData *fileBytes = [romFileHandle readDataOfLength:readSize];
[[romHeaderInfo objectForKey:curKey] setObject:fileBytes forKey:@"data"];
NSColor *dataColor = [colorGen colorFromGradient:(CGFloat)((CGFloat)i/[romHeaderInfo allKeys].count)];
[[romHeaderInfo objectForKey:curKey] setObject:dataColor forKey:@"color"];
}
}
- (IBAction)timerInterval:(id)sender {
dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
while (true) {
if (self->bannerFrame >= self->cartridgeData.bannerIconAnimationFramesMax) {
self->bannerFrame = 0;
}
NSNumber *duration = [self->cartridgeData bannerAnimation][self->bannerFrame].duration;
NSNumber *bannerBitmapIndex = [self->cartridgeData bannerAnimation][self->bannerFrame].bitmapIndex;
//NSLog(@"sleeping for icon animation");
[NSThread sleepForTimeInterval:[duration doubleValue]/20];
// update UI on the main thread
dispatch_async(dispatch_get_main_queue(), ^{
self.bannerIconImageView.image = [[self->cartridgeData animatedBannerIcons] objectAtIndex:[bannerBitmapIndex unsignedIntValue]];
});
self->bannerFrame++;
}
});
//[NSTimer scheduledTimerWithTimeInterval:0.5f target:self selector:@selector(timerInterval:) userInfo:nil repeats:NO];
}
- (void)processForHexView:(completionBlock)completion {
NSData *databuffer;
__block int length = 1024;
__block int offset = 0;
[romFileHandle seekToFileOffset:0];
databuffer = [romFileHandle readDataOfLength:length];
cartridgeData = [[NDSCartridgeData alloc] initWithHeaderData:databuffer fileHandle:romFileHandle];
length = (int)[[self->cartridgeData romHeaderData] length];
[self processTableView:[self->cartridgeData rawHeader] andCartridgeData:self->cartridgeData];
while (length > offset ) {
//[addressFormatStr appendAttributedString:[[NSMutableAttributedString alloc] initWithString:[NSString stringWithFormat:@"%04x:\n", offset]]];
[self->addressesArray addObject:[NSString stringWithFormat:@"%04x:", offset]];
offset += 0x1A;
if (offset > length) {
break;
}
}
self->isCollectionViewDataReady = true;
[self->romFileHandle seekToFileOffset:0];
completion(true);
}
- (void)processRomFile:(completionBlock)returningBlock {
if (romFilePath == nil) returningBlock(false);
if ([[romFilePath path] length] <= 0) returningBlock(false);
romFileHandle = [NSFileHandle fileHandleForReadingAtPath:[romFilePath path]];
if (romFileHandle == nil) {
NSLog(@"Failed to open file");
returningBlock(false);
}
NSData *fileData = [romFileHandle readDataToEndOfFile];
NSData *pattern = [@"NCCH" dataUsingEncoding:NSASCIIStringEncoding];
NSRange range = [fileData rangeOfData:pattern options:0 range:NSMakeRange(0, fileData.length)];
is3DSTypeROM = (range.location != NSNotFound);
[self processForHexView:^(bool param1) {
[self->romFileHandle closeFile];
returningBlock(param1);
}];
}
- (void)setROMPath:(NSURL *)path
{
romFilePath = path;
}
- (NSInteger)numberOfRowsInTableView:(NSTableView *)tableView {
if (romHeaderInfo == nil) return 0;
NSInteger ret = [[romHeaderInfo allKeys] count];
return ret;
}
-(NSView *)tableView:(NSTableView *)tableView viewForTableColumn:(NSTableColumn *)tableColumn row:(NSInteger)row {
NSString *identifier = tableColumn.identifier;
NSTableCellView *cell = [tableView makeViewWithIdentifier:identifier owner:self];
NSString *keyValue = [[romHeaderInfo allKeys] sortedArrayUsingSelector:@selector(localizedCaseInsensitiveCompare:)][row];
if ([[tableColumn identifier] isEqualToString:@"descriptionCol"]) {
[cell textField].stringValue = keyValue;
} else {
NSString *dataFormatType = [romHeaderInfo objectForKey:keyValue][@"type"];
NSData *cellData = [romHeaderInfo objectForKey:keyValue][@"data"];
if ([dataFormatType isEqualToString:@"string"]) {
[cell textField].stringValue = [NSString stringWithCString:(const char*)[cellData bytes] encoding:NSASCIIStringEncoding];
} else if ([dataFormatType isEqualToString:@"hex"]) {
if ([keyValue isEqualToString:@"Header CRC-16"]) {
[cell textField].stringValue = [NSString stringWithFormat:@"0x%02x (recalcsum; 0x%02x)", *(unsigned int*)[cellData bytes], cartridgeData.RecalculatedHeaderCRC16];
} else {
[cell textField].stringValue = [NSString stringWithFormat:@"0x%02x", *(unsigned int*)[cellData bytes]];
}
}
[[cell textField] setTextColor:((NSColor *)[romHeaderInfo objectForKey:keyValue][@"color"])];
if ([keyValue isEqualToString:@"Header CRC-16"]) {
[cell imageView].image = cartridgeData.RecalcChecksumMatchesHeader ? [NSImage imageWithSystemSymbolName:@"checkmark" accessibilityDescription:@"CRC16 Matched"] : [NSImage imageWithSystemSymbolName:@"x.circle.fill" accessibilityDescription:@"CRC16 Check Failed"];
} else {
// info
[cell imageView].image = [NSImage new];
}
}
return cell;
}
- (NSCollectionViewItem *)collectionView:(nonnull NSCollectionView *)collectionView itemForRepresentedObjectAtIndexPath:(nonnull NSIndexPath *)indexPath {
if (!isCollectionViewDataReady) {
return nil;
}
if ([[collectionView identifier] isEqualToString:@"addressView"]) {
AddressTextView *newItem = [[AddressTextView alloc] initWithNibName:@"AddressTextView" bundle:[NSBundle mainBundle]];
newItem.addressString = addressesArray[indexPath.item];
return newItem;
}
NSColor *selectedColor;
for (int i = 0; i < [romHeaderInfo allKeys].count; i++) {
int offset = [[romHeaderInfo objectForKey:[romHeaderInfo allKeys][i]][@"offset"] intValue];
int size = [[romHeaderInfo objectForKey:[romHeaderInfo allKeys][i]][@"size"] intValue];
int maxOffset = offset + size;
if (indexPath.item >= offset && indexPath.item < maxOffset) {
selectedColor = (NSColor *)[romHeaderInfo objectForKey:[romHeaderInfo allKeys][i]][@"color"];
break;
}
}
if ([[collectionView identifier] isEqualToString:@"ASCIIView"]) {
ASCIITextView *newItem = [[ASCIITextView alloc] initWithNibName:@"ASCIITextView" bundle:[NSBundle mainBundle]];
if (cartridgeData.romHeaderData != nil) {
//unsigned char *romHeader = (unsigned char *)[cartridgeData.romHeaderData bytes];
uint16_t rawBytes;
[cartridgeData.romHeaderData getBytes:&rawBytes range:NSMakeRange(indexPath.item, 1)];
[newItem setRawData:[NSData dataWithBytes:&rawBytes length:1]];
if (selectedColor) {
[newItem setFontColor:selectedColor];
newItem.isImportantByte = true;
}
}
return newItem;
} else {
HexTextView *newItem = [[HexTextView alloc] initWithNibName:@"HexTextView" bundle:[NSBundle mainBundle]];
if (cartridgeData.romHeaderData != nil) {
//unsigned char *romHeader = (unsigned char *)[cartridgeData.romHeaderData bytes];
uint16_t rawBytes;
[cartridgeData.romHeaderData getBytes:&rawBytes range:NSMakeRange(indexPath.item, 1)];
[newItem setRawData:[NSData dataWithBytes:&rawBytes length:1]];
if (selectedColor) {
[newItem setFontColor:selectedColor];
newItem.isImportantByte = true;
}
}
return newItem;
}
return nil;
}
- (NSInteger)collectionView:(nonnull NSCollectionView *)collectionView numberOfItemsInSection:(NSInteger)section {
if ([[collectionView identifier] isEqualToString:@"addressView"]) {
return [addressesArray count];
} else {
if (cartridgeData != nil) {
if (cartridgeData.romHeaderData != nil) {
return [cartridgeData.romHeaderData length];
}
}
}
return 0;
}
- (void)collectionView:(NSCollectionView *)collectionView didSelectItemsAtIndexPaths:(NSSet<NSIndexPath *> *)indexPaths {
if (previousSelectionSet) {
[self.asciiCollectionView deselectItemsAtIndexPaths:[self.asciiCollectionView indexPathsForVisibleItems]];
[self.hexCollectionView deselectItemsAtIndexPaths:[self.hexCollectionView indexPathsForVisibleItems]];
}
previousSelectionSet = indexPaths;
NSMutableArray *additonalBytestoSelect = [[NSMutableArray alloc] init];
[indexPaths enumerateObjectsUsingBlock:^(NSIndexPath * _Nonnull path, BOOL * _Nonnull stop) {
id item = [collectionView itemAtIndexPath:path];
if ([item isKindOfClass:[ASCIITextView class]] || [item isKindOfClass:[HexTextView class]]) {
NSDictionary *selectedData;
NSString *selectedTitle;
for (int i = 0; i < [romHeaderInfo allKeys].count; i++) {
int offset = [[romHeaderInfo objectForKey:[romHeaderInfo allKeys][i]][@"offset"] intValue];
int size = [[romHeaderInfo objectForKey:[romHeaderInfo allKeys][i]][@"size"] intValue];
int maxOffset = offset + size;
if (path.item >= offset && path.item < maxOffset) {
selectedData = [romHeaderInfo objectForKey:[romHeaderInfo allKeys][i]];
selectedTitle = [romHeaderInfo allKeys][i];
NSInteger offset = [selectedData[@"offset"] integerValue];
for (int sz = 0; sz < [selectedData[@"size"] integerValue]; sz++) {
NSIndexPath *newPath = [NSIndexPath indexPathForItem:(offset+sz) inSection:0];
[additonalBytestoSelect addObject:newPath];
}
break;
}
}
if (selectedData) {
[(PopoverInformationView *)[[self.popoverView contentViewController] view] setPopoverData:selectedData title:selectedTitle];
[self.popoverView showRelativeToRect:[collectionView frameForItemAtIndex:path.item] ofView:collectionView preferredEdge:NSRectEdgeMinY];
popoverIsShown = true;
} else {
if (popoverIsShown) {
[self.popoverView performClose:self];
}
}
}
}];
NSSet *uniqueMakes = [NSSet setWithArray:additonalBytestoSelect];
[indexPaths setByAddingObjectsFromSet:uniqueMakes];
[self.hexCollectionView setSelectionIndexPaths:uniqueMakes];
[self.asciiCollectionView setSelectionIndexPaths:uniqueMakes];
}
- (void)keyDown:(NSEvent *)event {
}
- (void)encodeWithCoder:(nonnull NSCoder *)coder {
}
- (IBAction)copy:(id)sender {
[[NSPasteboard generalPasteboard] clearContents];
NSInteger selectedTableRow = [[self tableView] selectedRow];
NSString *selectedTableKey = [[romHeaderInfo allKeys] sortedArrayUsingSelector:@selector(localizedCaseInsensitiveCompare:)][selectedTableRow];
NSData *selectedData = romHeaderInfo[selectedTableKey][@"data"];
NSString *dataFormatType = romHeaderInfo[selectedTableKey][@"type"];
NSString *selectedValue = @"";
if ([dataFormatType isEqualToString:@"string"]) {
selectedValue = [NSString stringWithCString:(const char*)[selectedData bytes] encoding:NSASCIIStringEncoding];
} else if ([dataFormatType isEqualToString:@"hex"]) {
selectedValue = [NSString stringWithFormat:@"0x%02x", *(unsigned int*)[selectedData bytes]];
}
[[NSPasteboard generalPasteboard] setString:selectedValue forType:NSPasteboardTypeString];
}
- (IBAction)showROMFingerprint:(id)sender {
NSToolbarItem *btn = (NSToolbarItem *)sender;
[(PopoverInformationView *)[[self.popoverView contentViewController] view] setShowingSHASUM:[cartridgeData ROMSHA256]];
[self.popoverView showRelativeToRect:[btn view].frame ofView:[self window].contentView preferredEdge:NSRectEdgeMinY];
popoverIsShown = true;
}
@end

View File

@ -0,0 +1,315 @@
<?xml version="1.0" encoding="UTF-8"?>
<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="21225" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none" useAutolayout="YES" customObjectInstantitationMethod="direct">
<dependencies>
<deployment identifier="macosx"/>
<plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="21225"/>
<capability name="Image references" minToolsVersion="12.0"/>
<capability name="System colors introduced in macOS 10.14" minToolsVersion="10.0"/>
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
</dependencies>
<objects>
<customObject id="-2" userLabel="File's Owner" customClass="RHMainWindow">
<connections>
<outlet property="addressClipview" destination="ZPP-s6-KJh" id="SfR-qw-d0j"/>
<outlet property="addressCollectionView" destination="q3o-zc-cMd" id="P12-Mk-LEr"/>
<outlet property="addressScrollview" destination="w3x-QM-lKu" id="g1m-sY-afc"/>
<outlet property="asciiClipView" destination="0CY-Uu-ni9" id="4Bi-9t-YJI"/>
<outlet property="asciiCollectionView" destination="zN0-f1-Xc3" id="kKK-gi-Pff"/>
<outlet property="asciiScrollView" destination="oJN-ez-g6t" id="iAP-bk-UG4"/>
<outlet property="bannerIconImageView" destination="Yip-aj-BNi" id="iDj-Eu-vfh"/>
<outlet property="hexClipView" destination="oWM-y6-bnz" id="IfF-ah-BYt"/>
<outlet property="hexCollectionView" destination="ddQ-32-EFo" id="pcF-Pv-sEN"/>
<outlet property="hexScrollView" destination="RVn-vP-Ghw" id="ltQ-jm-F4T"/>
<outlet property="popoverView" destination="sw7-Oa-Sty" id="cQA-uo-d9u"/>
<outlet property="tableView" destination="s3a-Xn-f0r" id="uaV-9d-fzi"/>
<outlet property="window" destination="F0z-JX-Cv5" id="gIp-Ho-8D9"/>
</connections>
</customObject>
<customObject id="-1" userLabel="First Responder" customClass="FirstResponder"/>
<customObject id="-3" userLabel="Application" customClass="NSObject"/>
<window title="Window" allowsToolTipsWhenApplicationIsInactive="NO" autorecalculatesKeyViewLoop="NO" releasedWhenClosed="NO" animationBehavior="default" titlebarAppearsTransparent="YES" id="F0z-JX-Cv5">
<windowStyleMask key="styleMask" titled="YES" closable="YES" miniaturizable="YES" resizable="YES"/>
<windowPositionMask key="initialPositionMask" leftStrut="YES" rightStrut="YES" topStrut="YES" bottomStrut="YES"/>
<rect key="contentRect" x="358" y="240" width="1519" height="800"/>
<rect key="screenRect" x="0.0" y="0.0" width="1920" height="1175"/>
<view key="contentView" id="se5-gp-TjO">
<rect key="frame" x="0.0" y="0.0" width="1519" height="800"/>
<autoresizingMask key="autoresizingMask"/>
<subviews>
<scrollView identifier="HexScrollview" autoresizesSubviews="NO" wantsLayer="YES" fixedFrame="YES" borderType="none" horizontalLineScroll="10" horizontalPageScroll="10" verticalLineScroll="10" verticalPageScroll="10" hasHorizontalScroller="NO" hasVerticalScroller="NO" usesPredominantAxisScrolling="NO" horizontalScrollElasticity="none" verticalScrollElasticity="none" translatesAutoresizingMaskIntoConstraints="NO" id="RVn-vP-Ghw" customClass="SyncScrollView">
<rect key="frame" x="48" y="0.0" width="420" height="800"/>
<autoresizingMask key="autoresizingMask" heightSizable="YES"/>
<clipView key="contentView" identifier="HexClipview" id="oWM-y6-bnz">
<rect key="frame" x="0.0" y="0.0" width="420" height="800"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<subviews>
<collectionView identifier="HexView" selectable="YES" id="ddQ-32-EFo">
<rect key="frame" x="0.0" y="0.0" width="420" height="800"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES"/>
<collectionViewLayout key="collectionViewLayout" id="zOi-Qg-0Us" customClass="CollectionLayout"/>
<color key="primaryBackgroundColor" name="controlBackgroundColor" catalog="System" colorSpace="catalog"/>
<color key="secondaryBackgroundColor" name="alternatingContentBackgroundColor" catalog="System" colorSpace="catalog"/>
<connections>
<outlet property="dataSource" destination="-2" id="e61-lY-cbk"/>
<outlet property="delegate" destination="-2" id="eJV-oX-lnN"/>
</connections>
</collectionView>
</subviews>
<edgeInsets key="contentInsets" left="0.0" right="0.0" top="0.0" bottom="0.0"/>
</clipView>
<edgeInsets key="contentInsets" left="0.0" right="0.0" top="0.0" bottom="0.0"/>
<scroller key="horizontalScroller" hidden="YES" wantsLayer="YES" verticalHuggingPriority="750" horizontal="YES" id="yx7-Qr-1Sw">
<rect key="frame" x="-100" y="-100" width="233" height="15"/>
<autoresizingMask key="autoresizingMask"/>
</scroller>
<scroller key="verticalScroller" hidden="YES" wantsLayer="YES" verticalHuggingPriority="750" doubleValue="1" horizontal="NO" id="sEC-RJ-7KG">
<rect key="frame" x="-100" y="-100" width="16" height="800"/>
<autoresizingMask key="autoresizingMask"/>
</scroller>
</scrollView>
<scrollView identifier="AddressScrollview" autoresizesSubviews="NO" wantsLayer="YES" fixedFrame="YES" borderType="none" horizontalLineScroll="10" horizontalPageScroll="10" verticalLineScroll="10" verticalPageScroll="10" hasHorizontalScroller="NO" hasVerticalScroller="NO" usesPredominantAxisScrolling="NO" horizontalScrollElasticity="none" verticalScrollElasticity="none" translatesAutoresizingMaskIntoConstraints="NO" id="w3x-QM-lKu" customClass="SyncScrollView">
<rect key="frame" x="0.0" y="0.0" width="48" height="800"/>
<autoresizingMask key="autoresizingMask" heightSizable="YES"/>
<clipView key="contentView" identifier="AddressClipview" id="ZPP-s6-KJh">
<rect key="frame" x="0.0" y="0.0" width="48" height="800"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<subviews>
<collectionView identifier="addressView" id="q3o-zc-cMd">
<rect key="frame" x="0.0" y="0.0" width="48" height="800"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES"/>
<collectionViewLayout key="collectionViewLayout" id="w0e-qZ-9Z0" customClass="CollectionLayout"/>
<color key="primaryBackgroundColor" name="controlBackgroundColor" catalog="System" colorSpace="catalog"/>
<connections>
<outlet property="dataSource" destination="-2" id="D3s-sE-dEM"/>
<outlet property="delegate" destination="-2" id="IL1-o7-LTz"/>
</connections>
</collectionView>
</subviews>
</clipView>
<edgeInsets key="contentInsets" left="0.0" right="0.0" top="0.0" bottom="0.0"/>
<scroller key="horizontalScroller" hidden="YES" wantsLayer="YES" verticalHuggingPriority="750" horizontal="YES" id="iAm-Zu-Dbn">
<rect key="frame" x="-100" y="-100" width="60" height="16"/>
<autoresizingMask key="autoresizingMask"/>
</scroller>
<scroller key="verticalScroller" hidden="YES" wantsLayer="YES" verticalHuggingPriority="750" doubleValue="1" horizontal="NO" id="EDE-oZ-bvI">
<rect key="frame" x="-100" y="-100" width="16" height="800"/>
<autoresizingMask key="autoresizingMask"/>
</scroller>
</scrollView>
<scrollView identifier="ASCIIScrollview" autoresizesSubviews="NO" wantsLayer="YES" fixedFrame="YES" borderType="none" horizontalLineScroll="10" horizontalPageScroll="10" verticalLineScroll="10" verticalPageScroll="10" hasHorizontalScroller="NO" usesPredominantAxisScrolling="NO" horizontalScrollElasticity="none" verticalScrollElasticity="none" translatesAutoresizingMaskIntoConstraints="NO" id="oJN-ez-g6t" customClass="SyncScrollView">
<rect key="frame" x="476" y="0.0" width="420" height="800"/>
<autoresizingMask key="autoresizingMask" heightSizable="YES"/>
<clipView key="contentView" identifier="ASCIIClipview" id="0CY-Uu-ni9">
<rect key="frame" x="0.0" y="0.0" width="420" height="800"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<subviews>
<collectionView identifier="ASCIIView" selectable="YES" id="zN0-f1-Xc3">
<rect key="frame" x="0.0" y="0.0" width="420" height="800"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES"/>
<collectionViewLayout key="collectionViewLayout" id="Ygz-QZ-9gg" customClass="CollectionLayout"/>
<color key="primaryBackgroundColor" name="controlBackgroundColor" catalog="System" colorSpace="catalog"/>
<color key="secondaryBackgroundColor" name="alternatingContentBackgroundColor" catalog="System" colorSpace="catalog"/>
<connections>
<outlet property="dataSource" destination="-2" id="cFv-Xk-NV2"/>
<outlet property="delegate" destination="-2" id="sJx-0e-WtT"/>
</connections>
</collectionView>
</subviews>
<edgeInsets key="contentInsets" left="0.0" right="0.0" top="0.0" bottom="0.0"/>
</clipView>
<edgeInsets key="contentInsets" left="0.0" right="0.0" top="0.0" bottom="0.0"/>
<scroller key="horizontalScroller" hidden="YES" wantsLayer="YES" verticalHuggingPriority="750" horizontal="YES" id="JAK-6L-bQ1">
<rect key="frame" x="-100" y="-100" width="420" height="16"/>
<autoresizingMask key="autoresizingMask"/>
</scroller>
<scroller key="verticalScroller" wantsLayer="YES" verticalHuggingPriority="750" doubleValue="1" horizontal="NO" id="yl9-iK-eD0">
<rect key="frame" x="404" y="0.0" width="16" height="800"/>
<autoresizingMask key="autoresizingMask"/>
</scroller>
</scrollView>
<scrollView fixedFrame="YES" borderType="none" horizontalLineScroll="17" horizontalPageScroll="10" verticalLineScroll="17" verticalPageScroll="10" hasHorizontalScroller="NO" hasVerticalScroller="NO" usesPredominantAxisScrolling="NO" translatesAutoresizingMaskIntoConstraints="NO" id="OBY-sX-VNW">
<rect key="frame" x="907" y="127" width="610" height="673"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<clipView key="contentView" id="6Hp-x5-SJA">
<rect key="frame" x="0.0" y="0.0" width="610" height="673"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<subviews>
<tableView verticalHuggingPriority="750" allowsExpansionToolTips="YES" columnAutoresizingStyle="lastColumnOnly" multipleSelection="NO" autosaveColumns="NO" rowSizeStyle="automatic" headerView="cAX-wd-wSF" viewBased="YES" id="s3a-Xn-f0r">
<rect key="frame" x="0.0" y="0.0" width="610" height="645"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<size key="intercellSpacing" width="20" height="0.0"/>
<color key="backgroundColor" name="controlBackgroundColor" catalog="System" colorSpace="catalog"/>
<color key="gridColor" name="gridColor" catalog="System" colorSpace="catalog"/>
<tableColumns>
<tableColumn identifier="descriptionCol" width="156" minWidth="40" maxWidth="200" id="gxl-Xb-2Ah">
<tableHeaderCell key="headerCell" lineBreakMode="truncatingTail" borderStyle="border" title="Description">
<color key="textColor" name="headerTextColor" catalog="System" colorSpace="catalog"/>
<color key="backgroundColor" name="headerColor" catalog="System" colorSpace="catalog"/>
</tableHeaderCell>
<textFieldCell key="dataCell" lineBreakMode="truncatingTail" selectable="YES" editable="YES" sendsActionOnEndEditing="YES" title="Text" id="s5K-AC-f5S">
<font key="font" metaFont="system"/>
<color key="textColor" name="controlTextColor" catalog="System" colorSpace="catalog"/>
<color key="backgroundColor" name="textBackgroundColor" catalog="System" colorSpace="catalog"/>
</textFieldCell>
<tableColumnResizingMask key="resizingMask" resizeWithTable="YES" userResizable="YES"/>
<prototypeCellViews>
<tableCellView id="Yuo-W5-oi5">
<rect key="frame" x="20" y="0.0" width="152" height="17"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<subviews>
<textField horizontalHuggingPriority="251" verticalHuggingPriority="750" horizontalCompressionResistancePriority="250" fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="ywf-z6-A0k">
<rect key="frame" x="0.0" y="1" width="152" height="16"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" flexibleMinY="YES" flexibleMaxY="YES"/>
<textFieldCell key="cell" lineBreakMode="truncatingTail" sendsActionOnEndEditing="YES" title="Table View Cell" id="rWF-l8-I9t">
<font key="font" usesAppearanceFont="YES"/>
<color key="textColor" name="controlTextColor" catalog="System" colorSpace="catalog"/>
<color key="backgroundColor" name="textBackgroundColor" catalog="System" colorSpace="catalog"/>
</textFieldCell>
</textField>
</subviews>
<connections>
<outlet property="textField" destination="ywf-z6-A0k" id="gfG-ix-C7m"/>
</connections>
</tableCellView>
</prototypeCellViews>
</tableColumn>
<tableColumn width="288" minWidth="40" maxWidth="300" id="MUp-9j-Gf0">
<tableHeaderCell key="headerCell" lineBreakMode="truncatingTail" borderStyle="border" title="Value">
<color key="textColor" name="headerTextColor" catalog="System" colorSpace="catalog"/>
<color key="backgroundColor" name="headerColor" catalog="System" colorSpace="catalog"/>
</tableHeaderCell>
<textFieldCell key="dataCell" lineBreakMode="truncatingTail" selectable="YES" editable="YES" title="Text Cell" id="mEY-ZO-NYY">
<font key="font" metaFont="system"/>
<color key="textColor" name="controlTextColor" catalog="System" colorSpace="catalog"/>
<color key="backgroundColor" name="controlBackgroundColor" catalog="System" colorSpace="catalog"/>
</textFieldCell>
<tableColumnResizingMask key="resizingMask" resizeWithTable="YES" userResizable="YES"/>
<prototypeCellViews>
<tableCellView id="b5s-yC-z6R">
<rect key="frame" x="192" y="0.0" width="284" height="17"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<subviews>
<imageView horizontalHuggingPriority="251" verticalHuggingPriority="251" fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="4PJ-GM-8Sg">
<rect key="frame" x="3" y="0.0" width="17" height="17"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
<imageCell key="cell" refusesFirstResponder="YES" alignment="left" imageScaling="proportionallyDown" image="nosign" catalog="system" id="FdV-OQ-V7F"/>
</imageView>
<textField verticalHuggingPriority="750" horizontalCompressionResistancePriority="250" fixedFrame="YES" allowsExpansionToolTips="YES" translatesAutoresizingMaskIntoConstraints="NO" id="XAP-LA-QJM">
<rect key="frame" x="25" y="0.0" width="259" height="17"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" flexibleMinY="YES"/>
<textFieldCell key="cell" lineBreakMode="truncatingTail" sendsActionOnEndEditing="YES" title="Table View Cell" id="rJ2-B1-YUl">
<font key="font" metaFont="system"/>
<color key="textColor" name="controlTextColor" catalog="System" colorSpace="catalog"/>
<color key="backgroundColor" name="controlColor" catalog="System" colorSpace="catalog"/>
</textFieldCell>
</textField>
</subviews>
<connections>
<outlet property="imageView" destination="4PJ-GM-8Sg" id="mpo-7L-RdC"/>
<outlet property="textField" destination="XAP-LA-QJM" id="oIS-7W-E9b"/>
</connections>
</tableCellView>
</prototypeCellViews>
</tableColumn>
</tableColumns>
<connections>
<outlet property="dataSource" destination="-2" id="0Jh-rV-u0a"/>
<outlet property="delegate" destination="-2" id="bRe-lN-Vj8"/>
</connections>
</tableView>
</subviews>
</clipView>
<edgeInsets key="contentInsets" left="0.0" right="0.0" top="0.0" bottom="0.0"/>
<scroller key="horizontalScroller" hidden="YES" wantsLayer="YES" verticalHuggingPriority="750" horizontal="YES" id="Fs3-jb-5vu">
<rect key="frame" x="-100" y="-100" width="483" height="16"/>
<autoresizingMask key="autoresizingMask"/>
</scroller>
<scroller key="verticalScroller" hidden="YES" wantsLayer="YES" verticalHuggingPriority="750" doubleValue="1" horizontal="NO" id="q3f-uF-zjA">
<rect key="frame" x="-100" y="-100" width="15" height="102"/>
<autoresizingMask key="autoresizingMask"/>
</scroller>
<tableHeaderView key="headerView" wantsLayer="YES" id="cAX-wd-wSF">
<rect key="frame" x="0.0" y="0.0" width="610" height="28"/>
<autoresizingMask key="autoresizingMask"/>
</tableHeaderView>
</scrollView>
<imageView wantsLayer="YES" horizontalHuggingPriority="251" verticalHuggingPriority="251" fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="Yip-aj-BNi">
<rect key="frame" x="1096" y="0.0" width="128" height="128"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
<imageCell key="cell" refusesFirstResponder="YES" alignment="left" imageScaling="proportionallyUpOrDown" imageFrameStyle="photo" id="oeV-dh-C8z"/>
</imageView>
<box horizontalHuggingPriority="750" fixedFrame="YES" boxType="separator" translatesAutoresizingMaskIntoConstraints="NO" id="eLV-ot-wGJ">
<rect key="frame" x="895" y="0.0" width="5" height="800"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
</box>
<box horizontalHuggingPriority="750" fixedFrame="YES" boxType="separator" translatesAutoresizingMaskIntoConstraints="NO" id="IUV-op-nAw">
<rect key="frame" x="470" y="0.0" width="5" height="800"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
</box>
</subviews>
</view>
<toolbar key="toolbar" implicitIdentifier="C61E93F9-D32E-41CA-B521-1A6987EEEA52" autosavesConfiguration="NO" allowsUserCustomization="NO" showsBaselineSeparator="NO" displayMode="iconAndLabel" sizeMode="small" id="lyE-76-yK4">
<allowedToolbarItems>
<toolbarItem implicitItemIdentifier="NSToolbarSpaceItem" id="opB-Sh-3Yo"/>
<toolbarItem implicitItemIdentifier="NSToolbarFlexibleSpaceItem" id="JgZ-fh-ozp"/>
<toolbarItem implicitItemIdentifier="ADA2508A-58EF-4D3E-8284-55919E98F8B8" label="SHA256" paletteLabel="" tag="-1" sizingBehavior="auto" id="HDj-6Q-bbs">
<imageReference key="image" image="pawprint.fill" catalog="system" symbolScale="large"/>
<connections>
<action selector="showROMFingerprint:" target="-2" id="jXv-ML-oyP"/>
</connections>
</toolbarItem>
</allowedToolbarItems>
<defaultToolbarItems>
<toolbarItem reference="HDj-6Q-bbs"/>
</defaultToolbarItems>
</toolbar>
<connections>
<outlet property="delegate" destination="-2" id="0bl-1N-AYu"/>
</connections>
<point key="canvasLocation" x="626.5" y="324"/>
</window>
<viewController id="5R7-ty-Aj1" userLabel="Popover View Controller">
<connections>
<outlet property="view" destination="Ntb-aw-3CB" id="ZOa-Ia-VJE"/>
</connections>
</viewController>
<popover id="sw7-Oa-Sty">
<connections>
<outlet property="contentViewController" destination="5R7-ty-Aj1" id="jBj-tK-tcm"/>
</connections>
</popover>
<customView id="Ntb-aw-3CB" customClass="PopoverInformationView">
<rect key="frame" x="0.0" y="0.0" width="163" height="96"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
<subviews>
<textField verticalHuggingPriority="750" horizontalCompressionResistancePriority="250" fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="ArP-h4-GUR">
<rect key="frame" x="2" y="60" width="160" height="32"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
<textFieldCell key="cell" alignment="center" title="Multiline Label" id="NuX-jU-Uea">
<font key="font" size="14" name="IBMPlexMono-Bold"/>
<color key="textColor" name="labelColor" catalog="System" colorSpace="catalog"/>
<color key="backgroundColor" name="textBackgroundColor" catalog="System" colorSpace="catalog"/>
</textFieldCell>
</textField>
<textField verticalHuggingPriority="750" horizontalCompressionResistancePriority="250" fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="8XS-HG-dkO">
<rect key="frame" x="7" y="0.0" width="148" height="58"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
<textFieldCell key="cell" selectable="YES" alignment="center" title="Multiline Label" id="VII-yQ-isf">
<font key="font" size="12" name="IBMPlexMono-Regular"/>
<color key="textColor" name="labelColor" catalog="System" colorSpace="catalog"/>
<color key="backgroundColor" name="textBackgroundColor" catalog="System" colorSpace="catalog"/>
</textFieldCell>
</textField>
</subviews>
<connections>
<outlet property="descriptionLabel" destination="8XS-HG-dkO" id="xYv-Ok-IoR"/>
<outlet property="titleLabel" destination="ArP-h4-GUR" id="nla-My-NOP"/>
</connections>
<point key="canvasLocation" x="1331.5" y="-377"/>
</customView>
</objects>
<resources>
<image name="nosign" catalog="system" width="15" height="15"/>
<image name="pawprint.fill" catalog="system" width="22" height="20"/>
</resources>
</document>

View File

@ -0,0 +1,17 @@
//
// ROMHeaderViewer.h
// FSCHMasterEditor
//
// Created by Dylan Laws on 9/9/22.
//
#import <Cocoa/Cocoa.h>
#import "RHMainWindow.h"
NS_ASSUME_NONNULL_BEGIN
@interface ROMHeaderViewer : NSWindowController <RHMainWindowDelegate>
@property (strong) IBOutlet NSProgressIndicator *progressView;
@end
NS_ASSUME_NONNULL_END

View File

@ -0,0 +1,77 @@
//
// ROMHeaderViewer.m
// FSCHMasterEditor
//
// Created by Dylan Laws on 9/9/22.
//
#import "ROMHeaderViewer.h"
@interface ROMHeaderViewer () {
RHMainWindow *romheaderView;
}
@property (strong) IBOutlet NSTextField *filenameLabel;
@end
@implementation ROMHeaderViewer
- (void)windowDidLoad {
[super windowDidLoad];
[[self window] registerForDraggedTypes:[NSArray arrayWithObjects:NSPasteboardTypeFileURL, nil]];
// Implement this method to handle any initialization after your window controller's window has been loaded from its nib file.
}
- (NSString *)windowNibName
{
return @"ROMHeaderViewer";
}
- (NSDragOperation)draggingEntered:(id < NSDraggingInfo >)sender
{
return NSDragOperationGeneric;
}
- (BOOL)prepareForDragOperation:(id < NSDraggingInfo >)sender
{
NSPasteboard* pbrd = [sender draggingPasteboard];
// Do something here.
NSURL *fileURL = [NSURL URLWithString:[pbrd stringForType:NSPasteboardTypeFileURL]];
[self.filenameLabel setStringValue:[pbrd stringForType:NSPasteboardTypeFileURL]];
romheaderView = [[RHMainWindow alloc] initWithPathToROM:fileURL delegate:self];
[self.progressView startAnimation:nil];
[self.progressView setHidden:FALSE];
[romheaderView doReload];
[[self window] orderOut:self];
return YES;
}
- (IBAction)openFileDialog:(id)sender {
NSOpenPanel* openDlg = [NSOpenPanel openPanel];
[openDlg setCanChooseFiles:YES];
[openDlg setAllowsMultipleSelection:NO];
[openDlg setCanChooseDirectories:NO];
if ([openDlg runModal] == NSModalResponseOK )
{
NSURL* fileURL = [openDlg URL];
if (fileURL != nil)
{
[self.filenameLabel setStringValue:[fileURL lastPathComponent]];
romheaderView = [[RHMainWindow alloc] initWithPathToROM:fileURL delegate:self];
[self.progressView startAnimation:nil];
[self.progressView setHidden:FALSE];
[romheaderView doReload];
[[self window] orderOut:self];
}
}
}
- (void)didFinishLoadingROM {
if (romheaderView == nil) return;
[romheaderView showWindow:nil];
[self.progressView stopAnimation:nil];
[self.progressView setHidden:TRUE];
}
@end

View File

@ -0,0 +1,93 @@
<?xml version="1.0" encoding="UTF-8"?>
<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="21225" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none" useAutolayout="YES" customObjectInstantitationMethod="direct">
<dependencies>
<deployment identifier="macosx"/>
<plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="21225"/>
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
</dependencies>
<objects>
<customObject id="-2" userLabel="File's Owner" customClass="ROMHeaderViewer">
<connections>
<outlet property="filenameLabel" destination="BjM-aG-j0J" id="pre-TS-NKA"/>
<outlet property="progressView" destination="qOm-re-aAC" id="wdG-Ty-zlB"/>
<outlet property="window" destination="F0z-JX-Cv5" id="gIp-Ho-8D9"/>
</connections>
</customObject>
<customObject id="-1" userLabel="First Responder" customClass="FirstResponder"/>
<customObject id="-3" userLabel="Application" customClass="NSObject"/>
<window title="Fisch's &quot;MasterEditor&quot;" subtitle="made with &lt;3" allowsToolTipsWhenApplicationIsInactive="NO" autorecalculatesKeyViewLoop="NO" restorable="NO" animationBehavior="default" titlebarAppearsTransparent="YES" id="F0z-JX-Cv5">
<windowStyleMask key="styleMask" titled="YES" closable="YES"/>
<windowPositionMask key="initialPositionMask" leftStrut="YES" rightStrut="YES" topStrut="YES" bottomStrut="YES"/>
<rect key="contentRect" x="736" y="510" width="480" height="148"/>
<rect key="screenRect" x="0.0" y="0.0" width="1920" height="1175"/>
<value key="minSize" type="size" width="480" height="148"/>
<value key="maxSize" type="size" width="480" height="148"/>
<view key="contentView" id="se5-gp-TjO">
<rect key="frame" x="0.0" y="0.0" width="480" height="148"/>
<autoresizingMask key="autoresizingMask"/>
<subviews>
<textField horizontalHuggingPriority="251" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="KPo-eb-jaX">
<rect key="frame" x="74" y="33" width="332" height="15"/>
<textFieldCell key="cell" lineBreakMode="clipping" alignment="center" title="File formats supported currently; .nds / .srl" id="Efm-td-QQB">
<font key="font" size="12" name="IBMPlexMono-Light"/>
<color key="textColor" name="labelColor" catalog="System" colorSpace="catalog"/>
<color key="backgroundColor" name="textBackgroundColor" catalog="System" colorSpace="catalog"/>
</textFieldCell>
</textField>
<textField horizontalHuggingPriority="251" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="6bQ-mz-cKS">
<rect key="frame" x="90" y="10" width="300" height="15"/>
<textFieldCell key="cell" lineBreakMode="clipping" alignment="center" title="future formats; .tad / .cia / .cci" id="gqH-ZM-reE">
<font key="font" size="12" name="IBMPlexMono-Light"/>
<color key="textColor" name="labelColor" catalog="System" colorSpace="catalog"/>
<color key="backgroundColor" name="textBackgroundColor" catalog="System" colorSpace="catalog"/>
</textFieldCell>
</textField>
<button verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="eSi-12-gNd">
<rect key="frame" x="183" y="57" width="114" height="32"/>
<constraints>
<constraint firstAttribute="width" constant="100" id="Zcu-da-BRj"/>
</constraints>
<buttonCell key="cell" type="push" title="Select File" bezelStyle="rounded" alignment="center" borderStyle="border" imageScaling="proportionallyDown" inset="2" id="fDJ-Xf-itH">
<behavior key="behavior" pushIn="YES" lightByBackground="YES" lightByGray="YES"/>
<font key="font" metaFont="system"/>
</buttonCell>
<connections>
<action selector="openFileDialog:" target="-1" id="XSL-3o-5pI"/>
</connections>
</button>
<textField verticalHuggingPriority="750" horizontalCompressionResistancePriority="250" translatesAutoresizingMaskIntoConstraints="NO" id="BjM-aG-j0J">
<rect key="frame" x="-2" y="102" width="484" height="26"/>
<textFieldCell key="cell" selectable="YES" alignment="center" title="~ no file selected ~" id="Nzx-Qx-69p">
<font key="font" size="16" name="IBMPlexMono-Regular"/>
<color key="textColor" name="labelColor" catalog="System" colorSpace="catalog"/>
<color key="backgroundColor" name="textBackgroundColor" catalog="System" colorSpace="catalog"/>
</textFieldCell>
</textField>
<progressIndicator hidden="YES" maxValue="100" displayedWhenStopped="NO" indeterminate="YES" style="spinning" translatesAutoresizingMaskIntoConstraints="NO" id="qOm-re-aAC">
<rect key="frame" x="304" y="58" width="32" height="32"/>
</progressIndicator>
</subviews>
<constraints>
<constraint firstItem="eSi-12-gNd" firstAttribute="centerX" secondItem="KPo-eb-jaX" secondAttribute="centerX" id="4Kc-15-G2P"/>
<constraint firstItem="eSi-12-gNd" firstAttribute="centerY" secondItem="se5-gp-TjO" secondAttribute="centerY" id="8ZP-0g-Rcn"/>
<constraint firstItem="6bQ-mz-cKS" firstAttribute="top" secondItem="KPo-eb-jaX" secondAttribute="bottom" constant="8" symbolic="YES" id="Anl-Xf-53X"/>
<constraint firstItem="BjM-aG-j0J" firstAttribute="top" secondItem="se5-gp-TjO" secondAttribute="top" constant="20" symbolic="YES" id="KBy-f1-lut"/>
<constraint firstAttribute="trailing" secondItem="BjM-aG-j0J" secondAttribute="trailing" id="Ka3-Le-cES"/>
<constraint firstItem="BjM-aG-j0J" firstAttribute="centerX" secondItem="eSi-12-gNd" secondAttribute="centerX" id="Ry0-Ev-Hye"/>
<constraint firstItem="qOm-re-aAC" firstAttribute="leading" secondItem="eSi-12-gNd" secondAttribute="trailing" constant="14" id="S0s-ll-0kV"/>
<constraint firstAttribute="bottom" secondItem="6bQ-mz-cKS" secondAttribute="bottom" constant="10" id="ZYi-Ru-o3v"/>
<constraint firstItem="qOm-re-aAC" firstAttribute="top" secondItem="BjM-aG-j0J" secondAttribute="bottom" constant="12" id="gav-cn-z5Q"/>
<constraint firstItem="BjM-aG-j0J" firstAttribute="leading" secondItem="se5-gp-TjO" secondAttribute="leading" id="gce-6v-u07"/>
<constraint firstItem="KPo-eb-jaX" firstAttribute="centerX" secondItem="6bQ-mz-cKS" secondAttribute="centerX" id="o2v-Xd-O0b"/>
<constraint firstItem="KPo-eb-jaX" firstAttribute="top" secondItem="qOm-re-aAC" secondAttribute="bottom" constant="10" id="ojn-to-1LR"/>
<constraint firstItem="6bQ-mz-cKS" firstAttribute="leading" secondItem="se5-gp-TjO" secondAttribute="leading" constant="92" id="pGl-WH-HFh"/>
<constraint firstItem="eSi-12-gNd" firstAttribute="centerY" secondItem="qOm-re-aAC" secondAttribute="centerY" id="tse-dC-8Wn"/>
</constraints>
</view>
<connections>
<outlet property="delegate" destination="-2" id="0bl-1N-AYu"/>
</connections>
<point key="canvasLocation" x="139" y="80"/>
</window>
</objects>
</document>

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -0,0 +1,131 @@
//
// NDSCartridge.h
// FSCHMasterEditor
//
// Created by Dylan Laws on 9/9/22.
//
#ifndef NDSCartridge_h
#define NDSCartridge_h
/*!
\brief the NDS file header format
See gbatek for more info.
*/
typedef struct {
char gameTitle[12]; //!< 12 characters for the game title.
char gameCode[4]; //!< 4 characters for the game code.
char makercode[2]; //!< identifies the (commercial) developer.
uint8_t unitCode; //!< identifies the required hardware.
uint8_t deviceType; //!< type of device in the game card
uint8_t deviceSize; //!< capacity of the device (1 << n Mbit)
uint8_t reserved1[9];
uint8_t romversion; //!< version of the ROM.
uint8_t flags; //!< bit 2: auto-boot flag.
uint32_t arm9romOffset; //!< offset of the arm9 binary in the nds file.
uint32_t arm9executeAddress; //!< adress that should be executed after the binary has been copied.
uint32_t arm9destination; //!< destination address to where the arm9 binary should be copied.
uint32_t arm9binarySize; //!< size of the arm9 binary.
uint32_t arm7romOffset; //!< offset of the arm7 binary in the nds file.
uint32_t arm7executeAddress; //!< adress that should be executed after the binary has been copied.
uint32_t arm7destination; //!< destination address to where the arm7 binary should be copied.
uint32_t arm7binarySize; //!< size of the arm7 binary.
uint32_t filenameOffset; //!< File Name Table (FNT) offset.
uint32_t filenameSize; //!< File Name Table (FNT) size.
uint32_t fatOffset; //!< File Allocation Table (FAT) offset.
uint32_t fatSize; //!< File Allocation Table (FAT) size.
uint32_t arm9overlaySource; //!< File arm9 overlay offset.
uint32_t arm9overlaySize; //!< File arm9 overlay size.
uint32_t arm7overlaySource; //!< File arm7 overlay offset.
uint32_t arm7overlaySize; //!< File arm7 overlay size.
uint32_t cardControl13; //!< Port 40001A4h setting for normal commands (used in modes 1 and 3)
uint32_t cardControlBF; //!< Port 40001A4h setting for KEY1 commands (used in mode 2)
uint32_t bannerOffset; //!< offset to the banner with icon and titles etc.
uint16 secureCRC16; //!< Secure Area Checksum, CRC-16.
uint16 readTimeout; //!< Secure Area Loading Timeout.
uint32_t unknownRAM1; //!< ARM9 Auto Load List RAM Address (?)
uint32_t unknownRAM2; //!< ARM7 Auto Load List RAM Address (?)
uint32_t bfPrime1; //!< Secure Area Disable part 1.
uint32_t bfPrime2; //!< Secure Area Disable part 2.
uint32_t romSize; //!< total size of the ROM.
uint32_t headerSize; //!< ROM header size.
uint32_t zeros88[3];
uint16 nandRomEnd; //!< ROM region end for NAND games.
uint16 nandRwStart; //!< RW region start for NAND games.
uint32_t zeros98[10];
uint8_t gbaLogo[156]; //!< Nintendo logo needed for booting the game.
uint16 logoCRC16; //!< Nintendo Logo Checksum, CRC-16.
uint16 headerCRC16; //!< header checksum, CRC-16.
uint32_t debugRomSource; //!< debug ROM offset.
uint32_t debugRomSize; //!< debug size.
uint32_t debugRomDestination; //!< debug RAM destination.
uint32_t offset_0x16C; //reserved?
uint8_t zero[0x40];
uint32_t region;
uint32_t accessControl;
uint32_t arm7SCFGSettings;
uint16 dsi_unk1;
uint8_t dsi_unk2;
uint8_t dsi_flags;
uint32_t arm9iromOffset; //!< offset of the arm9 binary in the nds file.
uint32_t arm9iexecuteAddress;
uint32_t arm9idestination; //!< destination address to where the arm9 binary should be copied.
uint32_t arm9ibinarySize; //!< size of the arm9 binary.
uint32_t arm7iromOffset; //!< offset of the arm7 binary in the nds file.
uint32_t deviceListDestination;
uint32_t arm7idestination; //!< destination address to where the arm7 binary should be copied.
uint32_t arm7ibinarySize; //!< size of the arm7 binary.
uint8_t zero2[0x20];
// 0x200
// TODO: More DSi-specific fields.
uint32_t dsi1[0x10/4];
uint32_t twlRomSize;
uint32_t dsi_unk3;
uint32_t dsi_unk4;
uint32_t dsi_unk5;
uint8_t dsi2[0x10];
uint32_t dsi_tid;
uint32_t dsi_tid2;
uint32_t pubSavSize;
uint32_t prvSavSize;
uint8_t dsi3[0x174];
} sNDSHeaderExt;
/*!
\brief the NDS banner format.
See gbatek for more information.
*/
typedef struct {
uint16_t version; //!< version of the banner.
uint16_t crc[4]; //!< CRC-16s of the banner.
uint8_t reserved[22];
uint8_t icon[512]; //!< 32*32 icon of the game with 4 bit per pixel.
uint16_t palette[16]; //!< the palette of the icon.
uint16_t titles[8][128]; //!< title of the game in 8 different languages.
// [0xA40] Reserved space, possibly for other titles.
uint8_t reserved2[0x800];
// DSi-specific.
uint8_t dsi_icon[8][512]; //!< DSi animated icon frame data.
uint16_t dsi_palette[8][16]; //!< Palette for each DSi icon frame.
uint16_t dsi_seq[64]; //!< DSi animated icon sequence.
} sNDSBannerExt;
#endif /* NDSCartridge_h */

View File

@ -0,0 +1,87 @@
//
// NDSCartridgeData.h
// FSCHMasterEditor
//
// Created by Dylan Laws on 9/10/22.
//
#import <Foundation/Foundation.h>
#import "NDSCartridge.h"
NS_ASSUME_NONNULL_BEGIN
@interface NDSBannerAnimation : NSObject
@property BOOL FlipVertial;
@property BOOL FlipHorizontal;
@property (strong) NSNumber *duration;
@property (strong) NSNumber *bitmapIndex;
@end
@interface NDSCartridgeData : NSObject {
sNDSHeaderExt header;
sNDSBannerExt banner;
}
- (instancetype)initWithHeaderData:(NSData *)databuffer fileHandle:(nonnull NSFileHandle *)handle;
- (sNDSHeaderExt *)rawHeader;
- (sNDSBannerExt *)banner;
@property (strong) NSString *GameTitle;
@property (strong) NSString *GameCode;
@property (strong) NSString *Makercode;
@property (strong) NSString *ROMSHA256;
@property (strong) NSData *romHeaderData;
@property (strong) NSImage *bannerIcon;
@property (strong) NSArray<NSImage *>* animatedBannerIcons;
@property (strong) NSArray<NDSBannerAnimation *>* bannerAnimation;
@property int bannerIconAnimationFramesMax;
@property UInt8 UnitCode;
@property UInt8 DeviceType;
@property UInt8 DeviceSize;
//@property UInt8 reserved1[9];
@property UInt8 RomVersion;
@property UInt8 Flags;
@property UInt32 HeaderSize;
@property UInt32 RomSize;
@property UInt32 Arm9romOffset;
@property UInt32 Arm9executeAddress;
@property UInt32 Arm9destination;
@property UInt32 Arm9binarySize;
@property UInt32 Arm7romOffset;
@property UInt32 Arm7executeAddress;
@property UInt32 Arm7destination;
@property UInt32 Arm7binarySize;
@property UInt16 HeaderCRC16;
@property UInt16 LogoCRC16;
@property UInt16 SecureCRC16;
@property UInt32 BannerOffset;
@property UInt16 RecalculatedHeaderCRC16;
@property BOOL RecalcChecksumMatchesHeader;
@property UInt16 RecalculatedSecureAreaCRC16;
@property BOOL RecalcSecureAreaChecksumMatchesHeader;
@property BOOL TWLAreasFound;
@property BOOL hasAnimatedBanner;
@end
NS_ASSUME_NONNULL_END

View File

@ -0,0 +1,313 @@
//
// NDSCartridgeData.m
// FSCHMasterEditor
//
// Created by Dylan Laws on 9/10/22.
//
#import <Cocoa/Cocoa.h>
#import "NDSCartridgeData.h"
#import "PreferencesManager.h"
#include "colorspacehandler.h"
#include <CommonCrypto/CommonDigest.h>
#define ROM_ICON_WIDTH 32
#define ROM_ICON_HEIGHT 32
static uint16_t MODBUS_CRC16_v1( const unsigned char *buf, unsigned int len )
{
uint16_t crc = 0xFFFF;
char i = 0;
while(len--)
{
crc ^= (*buf++);
for(i = 0; i < 8; i++)
{
if( crc & 1 )
{
crc >>= 1;
crc ^= 0xA001;
}
else
{
crc >>= 1;
}
}
}
return crc;
}
@implementation NDSBannerAnimation
- (instancetype)initWithDuration:(float)duration bitmapIndex:(int)index flipVertical:(BOOL)flipV flipHorizontal:(BOOL)flipH {
if (self = [super init]) {
self.duration = [NSNumber numberWithFloat:duration];
self.bitmapIndex = [NSNumber numberWithInt:index];
self.FlipVertial = flipV;
self.FlipHorizontal = flipH;
}
return self;
}
@end
@implementation NDSCartridgeData
- (NSString *)sha256HashFor:(NSFileHandle *)inputFile
{
[inputFile seekToFileOffset:0];
CC_SHA256_CTX ctx;
CC_SHA256_Init(&ctx);
[inputFile seekToEndOfFile];
int totalSize = (int)[inputFile offsetInFile];
int offset = 0;
while (offset < totalSize) {
[inputFile seekToFileOffset:offset];
CC_SHA256_Update(&ctx, [[inputFile readDataOfLength:16] bytes], 16);
offset += 16;
}
unsigned char bytes[CC_SHA256_DIGEST_LENGTH];
CC_SHA256_Final(bytes, &ctx);
NSMutableString *ret = [NSMutableString stringWithCapacity:CC_SHA256_DIGEST_LENGTH*2];
for(int i = 0; i<CC_SHA256_DIGEST_LENGTH; i++)
{
[ret appendFormat:@"%02x", bytes[i]];
}
return ret;
}
- (instancetype)initWithHeaderData:(NSData *)databuffer fileHandle:(nonnull NSFileHandle *)handle {
self = [super init];
NSInteger romHeaderBytesToRead = [[PreferencesManager sharedManager] bytesToRead];
self.ROMSHA256 = [self sha256HashFor:handle];
[handle seekToFileOffset:0x0];
[databuffer getBytes:&self->header length:sizeof(sNDSHeaderExt)];
unsigned char *headerBuf = (unsigned char *)malloc(romHeaderBytesToRead);
[databuffer getBytes:headerBuf length:romHeaderBytesToRead];
self.RecalculatedHeaderCRC16 = MODBUS_CRC16_v1(headerBuf, 0x15e);
free(headerBuf);
[handle seekToFileOffset:0x0];
self.romHeaderData = [handle readDataOfLength:romHeaderBytesToRead];
[handle seekToFileOffset:self->header.bannerOffset];
self->banner = *(sNDSBannerExt *)[[handle readDataOfLength:sizeof(sNDSBannerExt)] bytes];
//NSLog(@"%@", [[[NSData alloc] initWithBytes:&banner.dsi_icon[0] length:512] base64EncodedStringWithOptions:NSDataBase64EncodingEndLineWithCarriageReturn]);
self.bannerIcon = [self getBannerIcon];
if (self->banner.version >= 0x0103) {
self.animatedBannerIcons = [self getAnimatedBannerIcons];
self.hasAnimatedBanner = true;
}
NSMutableArray *animationArray = [[NSMutableArray alloc] init];
for (int z = 0; z < 64; z++) {
uint16_t frame1 = self->banner.dsi_seq[z];
unsigned short frameLen = frame1 & 0xFF;
unsigned short bitmapIndex = (frame1 >> 8) & 7;
if (frameLen == 0) {
self.bannerIconAnimationFramesMax = z;
break;
}
[animationArray addObject:[[NDSBannerAnimation alloc] initWithDuration:frameLen bitmapIndex:bitmapIndex flipVertical:NO flipHorizontal:NO]];
}
self.bannerAnimation = [animationArray copy];
[handle seekToFileOffset:0x230];
NSData *twlEmagcode = [handle readDataOfLength:4];
NSString *twlEmagcodeStr = [NSString stringWithCString:(const char*)[twlEmagcode bytes] encoding:NSASCIIStringEncoding];
if ([twlEmagcodeStr length] > 0) {
NSLog(@"found twl emagcode");
//[handle seekToFileOffset:0x1BF];
//NSData *twlFileflags = [handle readDataOfLength:1];
//unsigned int fileFlags = *(unsigned int *)[twlFileflags bytes];
}
NSLog(@"RecalculatedHeaderCRC16: %x", self.RecalculatedHeaderCRC16);
NSLog(@"header crc: %x", self->header.headerCRC16);
NSLog(@"RecalculatedSecureAreaCRC16: %x", self.RecalculatedSecureAreaCRC16);
NSLog(@"secureCRC16: %x", self->header.secureCRC16);
self.RecalcChecksumMatchesHeader = (self.RecalculatedHeaderCRC16 == self->header.headerCRC16);
if (!self.RecalcChecksumMatchesHeader) {
NSLog(@"checksum mismatch!");
}
self.GameTitle = [NSString stringWithCString:self->header.gameTitle encoding:NSASCIIStringEncoding];
self.GameCode = [NSString stringWithCString:self->header.gameCode encoding:NSASCIIStringEncoding];
self.Makercode = [NSString stringWithCString:self->header.makercode encoding:NSASCIIStringEncoding];
self.UnitCode = self->header.unitCode;
self.DeviceType = self->header.deviceType;
self.DeviceSize = self->header.deviceSize;
self.RomVersion = self->header.romversion;
self.Flags = self->header.flags;
self.HeaderSize = self->header.headerSize;
self.RomSize = self->header.romSize;
self.Arm9romOffset = self->header.arm9romOffset;
self.Arm9executeAddress = self->header.arm9executeAddress;
self.Arm9destination = self->header.arm9destination;
self.Arm9binarySize = self->header.arm9binarySize;
self.Arm7romOffset = self->header.arm7romOffset;
self.Arm7executeAddress = self->header.arm7executeAddress;
self.Arm7destination = self->header.arm7destination;
self.Arm7binarySize = self->header.arm7binarySize;
self.HeaderCRC16 = self->header.headerCRC16;
self.SecureCRC16 = self->header.secureCRC16;
self.LogoCRC16 = self->header.logoCRC16;
self.BannerOffset = self->header.bannerOffset;
return self;
}
- (sNDSHeaderExt *)rawHeader {
return &header;
}
- (sNDSBannerExt *)banner {
return &banner;
}
- (NSImage *)getBannerIcon {
NSImage *newImage = nil;
newImage = [[NSImage alloc] initWithSize:NSMakeSize(32, 32)];
if(newImage == nil)
{
return newImage;
}
NSBitmapImageRep *imageRep = [[NSBitmapImageRep alloc] initWithBitmapDataPlanes:NULL
pixelsWide:ROM_ICON_WIDTH
pixelsHigh:ROM_ICON_HEIGHT
bitsPerSample:8
samplesPerPixel:4
hasAlpha:YES
isPlanar:NO
colorSpaceName:NSCalibratedRGBColorSpace
bytesPerRow:ROM_ICON_WIDTH * 4
bitsPerPixel:32];
if(imageRep == nil)
{
newImage = nil;
return newImage;
}
uint32_t *bitmapData = (uint32_t *)[imageRep bitmapData];
[self RomIconToRGBA8888:bitmapData iconPixelData:(uint32_t *)banner.icon paletteData:(uint16_t *)banner.palette];
[newImage addRepresentation:imageRep];
return newImage;
}
- (NSArray<NSImage *> *)getAnimatedBannerIcons {
NSMutableArray *imageArray = [[NSMutableArray alloc] init];
for (int i = 0; i < 8; i++) {
NSImage *newImage = nil;
newImage = [[NSImage alloc] initWithSize:NSMakeSize(32, 32)];
if(newImage == nil)
{
return nil;
}
NSBitmapImageRep *imageRep = [[NSBitmapImageRep alloc] initWithBitmapDataPlanes:NULL
pixelsWide:ROM_ICON_WIDTH
pixelsHigh:ROM_ICON_HEIGHT
bitsPerSample:8
samplesPerPixel:4
hasAlpha:YES
isPlanar:NO
colorSpaceName:NSCalibratedRGBColorSpace
bytesPerRow:ROM_ICON_WIDTH * 4
bitsPerPixel:32];
if(imageRep == nil)
{
newImage = nil;
return nil;
}
uint32_t *bitmapData = (uint32_t *)[imageRep bitmapData];
[self RomIconToRGBA8888:bitmapData iconPixelData:(uint32_t *)banner.dsi_icon[i] paletteData:(uint16_t *)banner.palette];
[newImage addRepresentation:imageRep];
[imageArray addObject:newImage];
}
return imageArray;
}
-(void)RomIconToRGBA8888:(uint32_t *)bitmapData iconPixelData:(uint32_t *)iconPixPtr paletteData:(uint16_t *)clut4
{
if (bitmapData == NULL)
{
return;
}
//const RomBanner &ndsRomBanner = gameInfo.getRomBanner(); // Contains the memory addresses we need to get our read pointer locations.
//const uint32_t *iconPixPtr = (uint32_t *)banner.icon; // Read pointer for the icon's pixel data.
// Setup the 4-bit CLUT.
//
// The actual color values are stored with the ROM icon data in RGB555 format.
// We convert these color values and store them in the CLUT as RGBA8888 values.
//
// The first entry always represents the alpha, so just set it to 0.
//const uint16_t *clut4 = (uint16_t *)banner.palette;
CACHE_ALIGN uint32_t clut32[16];
ColorspaceConvertBuffer555To8888Opaque<false, true, BESwapNone>(clut4, clut32, 16);
clut32[0] = 0x00000000;
// Load the image from the icon pixel data.
//
// ROM icons are stored in 4-bit indexed color and have dimensions of 32x32 pixels.
// Also, ROM icons are split into 16 separate 8x8 pixel tiles arranged in a 4x4
// array. Here, we sequentially read from the ROM data, and adjust our write
// location appropriately within the bitmap memory block.
for (size_t y = 0; y < 4; y++)
{
for (size_t x = 0; x < 4; x++)
{
for (size_t p = 0; p < 8; p++, iconPixPtr++)
{
// Load an entire row of palette color indices as a single 32-bit chunk.
const uint32_t palIdx = LE_TO_LOCAL_32(*iconPixPtr);
// Set the write location. The formula below calculates the proper write
// location depending on the position of the read pointer. We use a more
// optimized version of this formula in practice.
//
// bitmapOutPtr = bitmapData + ( ((y * 8) + palIdx) * 32 ) + (x * 8);
uint32_t *bitmapOutPtr = bitmapData + ( ((y << 3) + p) << 5 ) + (x << 3);
*bitmapOutPtr = clut32[(palIdx & 0x0000000F) >> 0];
bitmapOutPtr++;
*bitmapOutPtr = clut32[(palIdx & 0x000000F0) >> 4];
bitmapOutPtr++;
*bitmapOutPtr = clut32[(palIdx & 0x00000F00) >> 8];
bitmapOutPtr++;
*bitmapOutPtr = clut32[(palIdx & 0x0000F000) >> 12];
bitmapOutPtr++;
*bitmapOutPtr = clut32[(palIdx & 0x000F0000) >> 16];
bitmapOutPtr++;
*bitmapOutPtr = clut32[(palIdx & 0x00F00000) >> 20];
bitmapOutPtr++;
*bitmapOutPtr = clut32[(palIdx & 0x0F000000) >> 24];
bitmapOutPtr++;
*bitmapOutPtr = clut32[(palIdx & 0xF0000000) >> 28];
}
}
}
}
@end

View File

@ -0,0 +1,6 @@
Some of this code is taken from the Desmume project, being one of my favorite emulators I *greatly* appreciate their teams time and do not want to re-use without attribution to them somewhere.
Methods reused;
desmume/src/frontend/cocoa/cocoa_rom.mm
RomIconToRGBA8888();
- (NSImage *)icon;

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,434 @@
/*
Copyright (C) 2016-2022 DeSmuME team
This file is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 2 of the License, or
(at your option) any later version.
This file is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with the this software. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef COLORSPACEHANDLER_H
#define COLORSPACEHANDLER_H
#include "types.h"
#include <stdio.h>
#include <stdint.h>
enum NDSColorFormat
{
// The color format information is packed in a 32-bit value.
// The bits are as follows:
// FFFOOOOO AAAAAABB BBBBGGGG GGRRRRRR
//
// F = Flags (see below)
// O = Color order (see below)
// A = Bit count for alpha [0-63]
// B = Bit count for blue [0-63]
// G = Bit count for green [0-63]
// R = Bit count for red [0-63]
//
// Flags:
// Bit 29: Reverse order flag.
// Set = Bits are in reverse order, usually for little-endian usage.
// Cleared = Bits are in normal order, usually for big-endian usage.
//
// Color order bits, 24-28:
// 0x00 = RGBA, common format
// 0x01 = RGAB
// 0x02 = RBGA
// 0x03 = RBAG
// 0x04 = RAGB
// 0x05 = RABG
// 0x06 = GRBA
// 0x07 = GRAB
// 0x08 = GBRA
// 0x09 = GBAR
// 0x0A = GARB
// 0x0B = GABR
// 0x0C = BRGA
// 0x0D = BRAG
// 0x0E = BGRA, common format
// 0x0F = BGAR
// 0x10 = BARG
// 0x11 = BAGR
// 0x12 = ARGB
// 0x13 = ARBG
// 0x14 = AGRB
// 0x15 = AGBR
// 0x16 = ABRG
// 0x17 = ABGR
// Color formats used for internal processing.
//NDSColorFormat_ABGR1555_Rev = 0x20045145,
//NDSColorFormat_ABGR5666_Rev = 0x20186186,
//NDSColorFormat_ABGR8888_Rev = 0x20208208,
// Color formats used by the output framebuffers.
// The 555 format is packed into u16; the 666 and 888 format is packed into u32
NDSColorFormat_BGR555_Rev = 0x20005145,
NDSColorFormat_BGR666_Rev = 0x20006186,
NDSColorFormat_BGR888_Rev = 0x20008208
};
union FragmentColor
{
u32 color;
struct
{
u8 r,g,b,a;
};
};
extern CACHE_ALIGN const u32 material_5bit_to_31bit[32];
extern CACHE_ALIGN const u8 material_5bit_to_6bit[64]; // Padded for vector lookup table routines. Only the first 32 indices are valid. Data is mirrored across 256-bit lanes.
extern CACHE_ALIGN const u8 material_5bit_to_8bit[64]; // Padded for vector lookup table routines. Only the first 32 indices are valid. Data is mirrored across 256-bit lanes.
extern CACHE_ALIGN const u8 material_6bit_to_8bit[64];
extern CACHE_ALIGN const u8 material_3bit_to_5bit[64]; // Padded for vector lookup table routines. Only the first 8 indices are valid. Data is mirrored across 128-bit lanes.
extern CACHE_ALIGN const u8 material_3bit_to_6bit[64]; // Padded for vector lookup table routines. Only the first 8 indices are valid. Data is mirrored across 128-bit lanes.
extern CACHE_ALIGN const u8 material_3bit_to_8bit[64]; // Padded for vector lookup table routines. Only the first 8 indices are valid. Data is mirrored across 128-bit lanes.
extern CACHE_ALIGN u16 color_5551_swap_rb[65536];
extern CACHE_ALIGN u32 color_555_to_6665_opaque[32768];
extern CACHE_ALIGN u32 color_555_to_6665_opaque_swap_rb[32768];
extern CACHE_ALIGN u32 color_555_to_666[32768];
extern CACHE_ALIGN u32 color_555_to_8888_opaque[32768];
extern CACHE_ALIGN u32 color_555_to_8888_opaque_swap_rb[32768];
extern CACHE_ALIGN u32 color_555_to_888[32768];
#define COLOR5551_SWAP_RB(col) (color_5551_swap_rb[(col)]) // Swaps the red-blue colors of a 16-bit RGBA5551 color
#define COLOR555TO6665_OPAQUE(col) (color_555_to_6665_opaque[(col)]) // Convert a 15-bit color to an opaque sparsely packed 32-bit color containing an RGBA6665 color
#define COLOR555TO6665_OPAQUE_SWAP_RB(col) (color_555_to_6665_opaque_swap_rb[(col)]) // Convert a 15-bit color to an opaque sparsely packed 32-bit color containing an RGBA6665 color with R and B components swapped
#define COLOR555TO666(col) (color_555_to_666[(col)]) // Convert a 15-bit color to a fully transparent sparsely packed 32-bit color containing an RGBA6665 color
#define COLOR555TO6665(col,alpha5) (((alpha5)<<24) | color_555_to_666[(col)]) // Convert a 15-bit color to a sparsely packed 32-bit color containing an RGBA6665 color with user-defined alpha
#define COLOR555TO8888_OPAQUE(col) (color_555_to_8888_opaque[(col)]) // Convert a 15-bit color to an opaque 32-bit color
#define COLOR555TO8888_OPAQUE_SWAP_RB(col) (color_555_to_8888_opaque_swap_rb[(col)]) // Convert a 15-bit color to an opaque 32-bit color with R and B components swapped
#define COLOR555TO888(col) (color_555_to_888[(col)]) // Convert a 15-bit color to an opaque 24-bit color or a fully transparent 32-bit color
#define COLOR555TO8888(col,alpha8) (((alpha8)<<24) | color_555_to_888[(col)]) // Convert a 15-bit color to a 32-bit color with user-defined alpha
//produce a 15bpp color from individual 5bit components
#define R5G5B5TORGB15(r,g,b) ( (r) | ((g)<<5) | ((b)<<10) )
//produce a 16bpp color from individual 5bit components
#define R6G6B6TORGB15(r,g,b) ( ((r)>>1) | (((g)&0x3E)<<4) | (((b)&0x3E)<<9) )
void ColorspaceHandlerInit();
template <bool SWAP_RB>
FORCEINLINE u32 ColorspaceConvert555To8888Opaque(const u16 src)
{
return (SWAP_RB) ? COLOR555TO8888_OPAQUE_SWAP_RB(src & 0x7FFF) : COLOR555TO8888_OPAQUE(src & 0x7FFF);
}
template <bool SWAP_RB>
FORCEINLINE u32 ColorspaceConvert555To6665Opaque(const u16 src)
{
return (SWAP_RB) ? COLOR555TO6665_OPAQUE_SWAP_RB(src & 0x7FFF) : COLOR555TO6665_OPAQUE(src & 0x7FFF);
}
template <bool SWAP_RB>
FORCEINLINE u32 ColorspaceConvert8888To6665(FragmentColor srcColor)
{
FragmentColor outColor;
outColor.r = ((SWAP_RB) ? srcColor.b : srcColor.r) >> 2;
outColor.g = srcColor.g >> 2;
outColor.b = ((SWAP_RB) ? srcColor.r : srcColor.b) >> 2;
outColor.a = srcColor.a >> 3;
return outColor.color;
}
template <bool SWAP_RB>
FORCEINLINE u32 ColorspaceConvert8888To6665(u32 srcColor)
{
FragmentColor srcColorComponent;
srcColorComponent.color = srcColor;
return ColorspaceConvert8888To6665<SWAP_RB>(srcColorComponent);
}
template <bool SWAP_RB>
FORCEINLINE u32 ColorspaceConvert6665To8888(FragmentColor srcColor)
{
FragmentColor outColor;
outColor.r = material_6bit_to_8bit[((SWAP_RB) ? srcColor.b : srcColor.r)];
outColor.g = material_6bit_to_8bit[srcColor.g];
outColor.b = material_6bit_to_8bit[((SWAP_RB) ? srcColor.r : srcColor.b)];
outColor.a = material_5bit_to_8bit[srcColor.a];
return outColor.color;
}
template <bool SWAP_RB>
FORCEINLINE u32 ColorspaceConvert6665To8888(u32 srcColor)
{
FragmentColor srcColorComponent;
srcColorComponent.color = srcColor;
return ColorspaceConvert6665To8888<SWAP_RB>(srcColorComponent);
}
template <bool SWAP_RB>
FORCEINLINE u16 ColorspaceConvert8888To5551(FragmentColor srcColor)
{
return R5G5B5TORGB15( ((SWAP_RB) ? srcColor.b : srcColor.r) >> 3, srcColor.g >> 3, ((SWAP_RB) ? srcColor.r : srcColor.b) >> 3) | ((srcColor.a == 0) ? 0x0000 : 0x8000 );
}
template <bool SWAP_RB>
FORCEINLINE u16 ColorspaceConvert8888To5551(u32 srcColor)
{
FragmentColor srcColorComponent;
srcColorComponent.color = srcColor;
return ColorspaceConvert8888To5551<SWAP_RB>(srcColorComponent);
}
template <bool SWAP_RB>
FORCEINLINE u16 ColorspaceConvert6665To5551(FragmentColor srcColor)
{
return R6G6B6TORGB15( ((SWAP_RB) ? srcColor.b : srcColor.r), srcColor.g, ((SWAP_RB) ? srcColor.r : srcColor.b)) | ((srcColor.a == 0) ? 0x0000 : 0x8000);
}
template <bool SWAP_RB>
FORCEINLINE u16 ColorspaceConvert6665To5551(u32 srcColor)
{
FragmentColor srcColorComponent;
srcColorComponent.color = srcColor;
return ColorspaceConvert6665To5551<SWAP_RB>(srcColorComponent);
}
template <bool SWAP_RB>
FORCEINLINE u32 ColorspaceConvert888XTo8888Opaque(FragmentColor srcColor)
{
FragmentColor outColor;
outColor.r = (SWAP_RB) ? srcColor.b : srcColor.r;
outColor.g = srcColor.g;
outColor.b = (SWAP_RB) ? srcColor.r : srcColor.b;
outColor.a = 0xFF;
return outColor.color;
}
template <bool SWAP_RB>
FORCEINLINE u32 ColorspaceConvert888XTo8888Opaque(u32 srcColor)
{
FragmentColor srcColorComponent;
srcColorComponent.color = srcColor;
return ColorspaceConvert888XTo8888Opaque<SWAP_RB>(srcColorComponent);
}
template <bool SWAP_RB>
FORCEINLINE void ColorspaceConvert888XTo888(FragmentColor srcColor, u8 *dst)
{
dst[0] = (SWAP_RB) ? srcColor.b : srcColor.r;
dst[1] = srcColor.g;
dst[2] = (SWAP_RB) ? srcColor.r : srcColor.b;
}
template <bool SWAP_RB>
FORCEINLINE void ColorspaceConvert888XTo888(u32 srcColor, u8 *dst)
{
FragmentColor srcColorComponent;
srcColorComponent.color = srcColor;
ColorspaceConvert888XTo888<SWAP_RB>(srcColorComponent, dst);
}
template <bool SWAP_RB>
FORCEINLINE void ColorspaceConvert555XTo888(u16 srcColor, u8 *dst)
{
FragmentColor srcColorComponent;
srcColorComponent.color = ColorspaceConvert555To8888Opaque<SWAP_RB>(srcColor);
ColorspaceConvert888XTo888<false>(srcColorComponent, dst);
}
template <bool SWAP_RB>
FORCEINLINE u16 ColorspaceCopy16(u16 srcColor)
{
return (SWAP_RB) ? COLOR5551_SWAP_RB(srcColor) : srcColor;
}
template <bool SWAP_RB>
FORCEINLINE u32 ColorspaceCopy32(FragmentColor srcColor)
{
FragmentColor outColor;
outColor.r = (SWAP_RB) ? srcColor.b : srcColor.r;
outColor.g = srcColor.g;
outColor.b = (SWAP_RB) ? srcColor.r : srcColor.b;
outColor.a = srcColor.a;
return outColor.color;
}
template <bool SWAP_RB>
FORCEINLINE u32 ColorspaceCopy32(u32 srcColor)
{
FragmentColor srcColorComponent;
srcColorComponent.color = srcColor;
return ColorspaceCopy32<SWAP_RB>(srcColorComponent);
}
template <bool SWAP_RB>
FORCEINLINE u16 ColorspaceApplyIntensity16(u16 srcColor, float intensity)
{
u16 outColor = (SWAP_RB) ? COLOR5551_SWAP_RB(srcColor) : srcColor;
if (intensity > 0.999f)
{
return outColor;
}
else if (intensity < 0.001f)
{
return (outColor & 0x8000);
}
const u16 intensity_u16 = (u16)(intensity * (float)(0xFFFF));
u8 r = (u8)( (((outColor >> 0) & 0x1F) * intensity_u16) >> 16 );
u8 g = (u8)( (((outColor >> 5) & 0x1F) * intensity_u16) >> 16 );
u8 b = (u8)( (((outColor >> 10) & 0x1F) * intensity_u16) >> 16 );
u8 a = outColor & 0x8000;
return ( (r << 0) | (g << 5) | (b << 10) | a );
}
template <bool SWAP_RB>
FORCEINLINE u32 ColorspaceApplyIntensity32(FragmentColor srcColor, float intensity)
{
FragmentColor outColor;
outColor.r = ((SWAP_RB) ? srcColor.b : srcColor.r);
outColor.g = srcColor.g;
outColor.b = ((SWAP_RB) ? srcColor.r : srcColor.b);
outColor.a = srcColor.a;
if (intensity > 0.999f)
{
return outColor.color;
}
else if (intensity < 0.001f)
{
return (outColor.color & 0xFF000000);
}
const u16 intensity_u16 = (u16)(intensity * (float)(0xFFFF));
outColor.r = (u8)( ((u16)outColor.r * intensity_u16) >> 16 );
outColor.g = (u8)( ((u16)outColor.g * intensity_u16) >> 16 );
outColor.b = (u8)( ((u16)outColor.b * intensity_u16) >> 16 );
outColor.a = outColor.a;
return outColor.color;
}
template <bool SWAP_RB>
FORCEINLINE u32 ColorspaceApplyIntensity32(u32 srcColor, float intensity)
{
FragmentColor srcColorComponent;
srcColorComponent.color = srcColor;
return ColorspaceApplyIntensity32<SWAP_RB>(srcColorComponent);
}
template<bool SWAP_RB, bool IS_UNALIGNED, BESwapFlags BE_BYTESWAP> void ColorspaceConvertBuffer555To8888Opaque(const u16 *__restrict src, u32 *__restrict dst, size_t pixCount);
template<bool SWAP_RB, bool IS_UNALIGNED, BESwapFlags BE_BYTESWAP> void ColorspaceConvertBuffer555To6665Opaque(const u16 *__restrict src, u32 *__restrict dst, size_t pixCount);
template<bool SWAP_RB, bool IS_UNALIGNED> void ColorspaceConvertBuffer8888To6665(const u32 *src, u32 *dst, size_t pixCount);
template<bool SWAP_RB, bool IS_UNALIGNED> void ColorspaceConvertBuffer6665To8888(const u32 *src, u32 *dst, size_t pixCount);
template<bool SWAP_RB, bool IS_UNALIGNED> void ColorspaceConvertBuffer8888To5551(const u32 *__restrict src, u16 *__restrict dst, size_t pixCount);
template<bool SWAP_RB, bool IS_UNALIGNED> void ColorspaceConvertBuffer6665To5551(const u32 *__restrict src, u16 *__restrict dst, size_t pixCount);
template<bool SWAP_RB, bool IS_UNALIGNED> void ColorspaceConvertBuffer888XTo8888Opaque(const u32 *src, u32 *dst, size_t pixCount);
template<bool SWAP_RB, bool IS_UNALIGNED> void ColorspaceConvertBuffer555XTo888(const u16 *__restrict src, u8 *__restrict dst, size_t pixCount);
template<bool SWAP_RB, bool IS_UNALIGNED> void ColorspaceConvertBuffer888XTo888(const u32 *__restrict src, u8 *__restrict dst, size_t pixCount);
template<bool SWAP_RB, bool IS_UNALIGNED> void ColorspaceCopyBuffer16(const u16 *src, u16 *dst, size_t pixCount);
template<bool SWAP_RB, bool IS_UNALIGNED> void ColorspaceCopyBuffer32(const u32 *src, u32 *dst, size_t pixCount);
template<bool SWAP_RB, bool IS_UNALIGNED> void ColorspaceApplyIntensityToBuffer16(u16 *dst, size_t pixCount, float intensity);
template<bool SWAP_RB, bool IS_UNALIGNED> void ColorspaceApplyIntensityToBuffer32(u32 *dst, size_t pixCount, float intensity);
class ColorspaceHandler
{
public:
ColorspaceHandler() {};
template<BESwapFlags BE_BYTESWAP> size_t ConvertBuffer555To8888Opaque(const u16 *__restrict src, u32 *__restrict dst, size_t pixCount) const;
template<BESwapFlags BE_BYTESWAP> size_t ConvertBuffer555To8888Opaque_SwapRB(const u16 *__restrict src, u32 *__restrict dst, size_t pixCount) const;
template<BESwapFlags BE_BYTESWAP> size_t ConvertBuffer555To8888Opaque_IsUnaligned(const u16 *__restrict src, u32 *__restrict dst, size_t pixCount) const;
template<BESwapFlags BE_BYTESWAP> size_t ConvertBuffer555To8888Opaque_SwapRB_IsUnaligned(const u16 *__restrict src, u32 *__restrict dst, size_t pixCount) const;
template<BESwapFlags BE_BYTESWAP> size_t ConvertBuffer555To6665Opaque(const u16 *__restrict src, u32 *__restrict dst, size_t pixCount) const;
template<BESwapFlags BE_BYTESWAP> size_t ConvertBuffer555To6665Opaque_SwapRB(const u16 *__restrict src, u32 *__restrict dst, size_t pixCount) const;
template<BESwapFlags BE_BYTESWAP> size_t ConvertBuffer555To6665Opaque_IsUnaligned(const u16 *__restrict src, u32 *__restrict dst, size_t pixCount) const;
template<BESwapFlags BE_BYTESWAP> size_t ConvertBuffer555To6665Opaque_SwapRB_IsUnaligned(const u16 *__restrict src, u32 *__restrict dst, size_t pixCount) const;
size_t ConvertBuffer8888To6665(const u32 *src, u32 *dst, size_t pixCount) const;
size_t ConvertBuffer8888To6665_SwapRB(const u32 *src, u32 *dst, size_t pixCount) const;
size_t ConvertBuffer8888To6665_IsUnaligned(const u32 *src, u32 *dst, size_t pixCount) const;
size_t ConvertBuffer8888To6665_SwapRB_IsUnaligned(const u32 *src, u32 *dst, size_t pixCount) const;
size_t ConvertBuffer6665To8888(const u32 *src, u32 *dst, size_t pixCount) const;
size_t ConvertBuffer6665To8888_SwapRB(const u32 *src, u32 *dst, size_t pixCount) const;
size_t ConvertBuffer6665To8888_IsUnaligned(const u32 *src, u32 *dst, size_t pixCount) const;
size_t ConvertBuffer6665To8888_SwapRB_IsUnaligned(const u32 *src, u32 *dst, size_t pixCount) const;
size_t ConvertBuffer8888To5551(const u32 *__restrict src, u16 *__restrict dst, size_t pixCount) const;
size_t ConvertBuffer8888To5551_SwapRB(const u32 *__restrict src, u16 *__restrict dst, size_t pixCount) const;
size_t ConvertBuffer8888To5551_IsUnaligned(const u32 *__restrict src, u16 *__restrict dst, size_t pixCount) const;
size_t ConvertBuffer8888To5551_SwapRB_IsUnaligned(const u32 *__restrict src, u16 *__restrict dst, size_t pixCount) const;
size_t ConvertBuffer6665To5551(const u32 *__restrict src, u16 *__restrict dst, size_t pixCount) const;
size_t ConvertBuffer6665To5551_SwapRB(const u32 *__restrict src, u16 *__restrict dst, size_t pixCount) const;
size_t ConvertBuffer6665To5551_IsUnaligned(const u32 *__restrict src, u16 *__restrict dst, size_t pixCount) const;
size_t ConvertBuffer6665To5551_SwapRB_IsUnaligned(const u32 *__restrict src, u16 *__restrict dst, size_t pixCount) const;
size_t ConvertBuffer888XTo8888Opaque(const u32 *src, u32 *dst, size_t pixCount) const;
size_t ConvertBuffer888XTo8888Opaque_SwapRB(const u32 *src, u32 *dst, size_t pixCount) const;
size_t ConvertBuffer888XTo8888Opaque_IsUnaligned(const u32 *src, u32 *dst, size_t pixCount) const;
size_t ConvertBuffer888XTo8888Opaque_SwapRB_IsUnaligned(const u32 *src, u32 *dst, size_t pixCount) const;
size_t ConvertBuffer555XTo888(const u16 *__restrict src, u8 *__restrict dst, size_t pixCount) const;
size_t ConvertBuffer555XTo888_SwapRB(const u16 *__restrict src, u8 *__restrict dst, size_t pixCount) const;
size_t ConvertBuffer555XTo888_IsUnaligned(const u16 *__restrict src, u8 *__restrict dst, size_t pixCount) const;
size_t ConvertBuffer555XTo888_SwapRB_IsUnaligned(const u16 *__restrict src, u8 *__restrict dst, size_t pixCount) const;
size_t ConvertBuffer888XTo888(const u32 *__restrict src, u8 *__restrict dst, size_t pixCount) const;
size_t ConvertBuffer888XTo888_SwapRB(const u32 *__restrict src, u8 *__restrict dst, size_t pixCount) const;
size_t ConvertBuffer888XTo888_IsUnaligned(const u32 *__restrict src, u8 *__restrict dst, size_t pixCount) const;
size_t ConvertBuffer888XTo888_SwapRB_IsUnaligned(const u32 *__restrict src, u8 *__restrict dst, size_t pixCount) const;
size_t CopyBuffer16_SwapRB(const u16 *src, u16 *dst, size_t pixCount) const;
size_t CopyBuffer16_SwapRB_IsUnaligned(const u16 *src, u16 *dst, size_t pixCount) const;
size_t CopyBuffer32_SwapRB(const u32 *src, u32 *dst, size_t pixCount) const;
size_t CopyBuffer32_SwapRB_IsUnaligned(const u32 *src, u32 *dst, size_t pixCount) const;
size_t ApplyIntensityToBuffer16(u16 *dst, size_t pixCount, float intensity) const;
size_t ApplyIntensityToBuffer16_SwapRB(u16 *dst, size_t pixCount, float intensity) const;
size_t ApplyIntensityToBuffer16_IsUnaligned(u16 *dst, size_t pixCount, float intensity) const;
size_t ApplyIntensityToBuffer16_SwapRB_IsUnaligned(u16 *dst, size_t pixCount, float intensity) const;
size_t ApplyIntensityToBuffer32(u32 *dst, size_t pixCount, float intensity) const;
size_t ApplyIntensityToBuffer32_SwapRB(u32 *dst, size_t pixCount, float intensity) const;
size_t ApplyIntensityToBuffer32_IsUnaligned(u32 *dst, size_t pixCount, float intensity) const;
size_t ApplyIntensityToBuffer32_SwapRB_IsUnaligned(u32 *dst, size_t pixCount, float intensity) const;
};
FORCEINLINE FragmentColor MakeFragmentColor(const u8 r, const u8 g, const u8 b, const u8 a)
{
FragmentColor ret;
ret.r = r; ret.g = g; ret.b = b; ret.a = a;
return ret;
}
#endif /* COLORSPACEHANDLER_H */

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,114 @@
/*
Copyright (C) 2016-2021 DeSmuME team
This file is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 2 of the License, or
(at your option) any later version.
This file is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with the this software. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef COLORSPACEHANDLER_AVX2_H
#define COLORSPACEHANDLER_AVX2_H
#include "colorspacehandler.h"
#ifndef ENABLE_AVX2
#warning This header requires AVX2 support.
#else
template<bool SWAP_RB> void ColorspaceConvert555To8888_AVX2(const v256u16 &srcColor, const v256u16 &srcAlphaBits, v256u32 &dstLo, v256u32 &dstHi);
template<bool SWAP_RB> void ColorspaceConvert555XTo888X_AVX2(const v256u16 &srcColor, v256u32 &dstLo, v256u32 &dstHi);
template<bool SWAP_RB> void ColorspaceConvert555To6665_AVX2(const v256u16 &srcColor, const v256u16 &srcAlphaBits, v256u32 &dstLo, v256u32 &dstHi);
template<bool SWAP_RB> void ColorspaceConvert555XTo666X_AVX2(const v256u16 &srcColor, v256u32 &dstLo, v256u32 &dstHi);
template<bool SWAP_RB> void ColorspaceConvert555To8888Opaque_AVX2(const v256u16 &srcColor, v256u32 &dstLo, v256u32 &dstHi);
template<bool SWAP_RB> void ColorspaceConvert555To6665Opaque_AVX2(const v256u16 &srcColor, v256u32 &dstLo, v256u32 &dstHi);
template<bool SWAP_RB> v256u32 ColorspaceConvert8888To6665_AVX2(const v256u32 &src);
template<bool SWAP_RB> v256u32 ColorspaceConvert6665To8888_AVX2(const v256u32 &src);
template<bool SWAP_RB> v256u16 ColorspaceConvert8888To5551_AVX2(const v256u32 &srcLo, const v256u32 &srcHi);
template<bool SWAP_RB> v256u16 ColorspaceConvert6665To5551_AVX2(const v256u32 &srcLo, const v256u32 &srcHi);
template<bool SWAP_RB> v256u32 ColorspaceConvert888XTo8888Opaque_AVX2(const v256u32 &src);
template<bool SWAP_RB> v256u16 ColorspaceCopy16_AVX2(const v256u16 &src);
template<bool SWAP_RB> v256u32 ColorspaceCopy32_AVX2(const v256u32 &src);
template<bool SWAP_RB> v256u16 ColorspaceApplyIntensity16_AVX2(const v256u16 &src, float intensity);
template<bool SWAP_RB> v256u32 ColorspaceApplyIntensity32_AVX2(const v256u32 &src, float intensity);
class ColorspaceHandler_AVX2 : public ColorspaceHandler
{
public:
ColorspaceHandler_AVX2() {};
template<BESwapFlags BE_BYTESWAP> size_t ConvertBuffer555To8888Opaque(const u16 *__restrict src, u32 *__restrict dst, size_t pixCount) const;
template<BESwapFlags BE_BYTESWAP> size_t ConvertBuffer555To8888Opaque_SwapRB(const u16 *__restrict src, u32 *__restrict dst, size_t pixCount) const;
template<BESwapFlags BE_BYTESWAP> size_t ConvertBuffer555To8888Opaque_IsUnaligned(const u16 *__restrict src, u32 *__restrict dst, size_t pixCount) const;
template<BESwapFlags BE_BYTESWAP> size_t ConvertBuffer555To8888Opaque_SwapRB_IsUnaligned(const u16 *__restrict src, u32 *__restrict dst, size_t pixCount) const;
template<BESwapFlags BE_BYTESWAP> size_t ConvertBuffer555To6665Opaque(const u16 *__restrict src, u32 *__restrict dst, size_t pixCount) const;
template<BESwapFlags BE_BYTESWAP> size_t ConvertBuffer555To6665Opaque_SwapRB(const u16 *__restrict src, u32 *__restrict dst, size_t pixCount) const;
template<BESwapFlags BE_BYTESWAP> size_t ConvertBuffer555To6665Opaque_IsUnaligned(const u16 *__restrict src, u32 *__restrict dst, size_t pixCount) const;
template<BESwapFlags BE_BYTESWAP> size_t ConvertBuffer555To6665Opaque_SwapRB_IsUnaligned(const u16 *__restrict src, u32 *__restrict dst, size_t pixCount) const;
size_t ConvertBuffer8888To6665(const u32 *src, u32 *dst, size_t pixCount) const;
size_t ConvertBuffer8888To6665_SwapRB(const u32 *src, u32 *dst, size_t pixCount) const;
size_t ConvertBuffer8888To6665_IsUnaligned(const u32 *src, u32 *dst, size_t pixCount) const;
size_t ConvertBuffer8888To6665_SwapRB_IsUnaligned(const u32 *src, u32 *dst, size_t pixCount) const;
size_t ConvertBuffer6665To8888(const u32 *src, u32 *dst, size_t pixCount) const;
size_t ConvertBuffer6665To8888_SwapRB(const u32 *src, u32 *dst, size_t pixCount) const;
size_t ConvertBuffer6665To8888_IsUnaligned(const u32 *src, u32 *dst, size_t pixCount) const;
size_t ConvertBuffer6665To8888_SwapRB_IsUnaligned(const u32 *src, u32 *dst, size_t pixCount) const;
size_t ConvertBuffer8888To5551(const u32 *__restrict src, u16 *__restrict dst, size_t pixCount) const;
size_t ConvertBuffer8888To5551_SwapRB(const u32 *__restrict src, u16 *__restrict dst, size_t pixCount) const;
size_t ConvertBuffer8888To5551_IsUnaligned(const u32 *__restrict src, u16 *__restrict dst, size_t pixCount) const;
size_t ConvertBuffer8888To5551_SwapRB_IsUnaligned(const u32 *__restrict src, u16 *__restrict dst, size_t pixCount) const;
size_t ConvertBuffer6665To5551(const u32 *__restrict src, u16 *__restrict dst, size_t pixCount) const;
size_t ConvertBuffer6665To5551_SwapRB(const u32 *__restrict src, u16 *__restrict dst, size_t pixCount) const;
size_t ConvertBuffer6665To5551_IsUnaligned(const u32 *__restrict src, u16 *__restrict dst, size_t pixCount) const;
size_t ConvertBuffer6665To5551_SwapRB_IsUnaligned(const u32 *__restrict src, u16 *__restrict dst, size_t pixCount) const;
size_t ConvertBuffer888XTo8888Opaque(const u32 *src, u32 *dst, size_t pixCount) const;
size_t ConvertBuffer888XTo8888Opaque_SwapRB(const u32 *src, u32 *dst, size_t pixCount) const;
size_t ConvertBuffer888XTo8888Opaque_IsUnaligned(const u32 *src, u32 *dst, size_t pixCount) const;
size_t ConvertBuffer888XTo8888Opaque_SwapRB_IsUnaligned(const u32 *src, u32 *dst, size_t pixCount) const;
size_t ConvertBuffer555XTo888(const u16 *__restrict src, u8 *__restrict dst, size_t pixCount) const;
size_t ConvertBuffer555XTo888_SwapRB(const u16 *__restrict src, u8 *__restrict dst, size_t pixCount) const;
size_t ConvertBuffer555XTo888_IsUnaligned(const u16 *__restrict src, u8 *__restrict dst, size_t pixCount) const;
size_t ConvertBuffer555XTo888_SwapRB_IsUnaligned(const u16 *__restrict src, u8 *__restrict dst, size_t pixCount) const;
size_t ConvertBuffer888XTo888(const u32 *__restrict src, u8 *__restrict dst, size_t pixCount) const;
size_t ConvertBuffer888XTo888_SwapRB(const u32 *__restrict src, u8 *__restrict dst, size_t pixCount) const;
size_t ConvertBuffer888XTo888_IsUnaligned(const u32 *__restrict src, u8 *__restrict dst, size_t pixCount) const;
size_t ConvertBuffer888XTo888_SwapRB_IsUnaligned(const u32 *__restrict src, u8 *__restrict dst, size_t pixCount) const;
size_t CopyBuffer16_SwapRB(const u16 *src, u16 *dst, size_t pixCount) const;
size_t CopyBuffer16_SwapRB_IsUnaligned(const u16 *src, u16 *dst, size_t pixCount) const;
size_t CopyBuffer32_SwapRB(const u32 *src, u32 *dst, size_t pixCount) const;
size_t CopyBuffer32_SwapRB_IsUnaligned(const u32 *src, u32 *dst, size_t pixCount) const;
size_t ApplyIntensityToBuffer16(u16 *dst, size_t pixCount, float intensity) const;
size_t ApplyIntensityToBuffer16_SwapRB(u16 *dst, size_t pixCount, float intensity) const;
size_t ApplyIntensityToBuffer16_IsUnaligned(u16 *dst, size_t pixCount, float intensity) const;
size_t ApplyIntensityToBuffer16_SwapRB_IsUnaligned(u16 *dst, size_t pixCount, float intensity) const;
size_t ApplyIntensityToBuffer32(u32 *dst, size_t pixCount, float intensity) const;
size_t ApplyIntensityToBuffer32_SwapRB(u32 *dst, size_t pixCount, float intensity) const;
size_t ApplyIntensityToBuffer32_IsUnaligned(u32 *dst, size_t pixCount, float intensity) const;
size_t ApplyIntensityToBuffer32_SwapRB_IsUnaligned(u32 *dst, size_t pixCount, float intensity) const;
};
#endif // ENABLE_AVX2
#endif /* COLORSPACEHANDLER_AVX2_H */

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,114 @@
/*
Copyright (C) 2016-2021 DeSmuME team
This file is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 2 of the License, or
(at your option) any later version.
This file is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with the this software. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef COLORSPACEHANDLER_AVX512_H
#define COLORSPACEHANDLER_AVX512_H
#include "colorspacehandler.h"
#ifndef ENABLE_AVX512_1
#warning This header requires AVX-512 Tier-1 support.
#else
template<bool SWAP_RB> void ColorspaceConvert555To8888_AVX512(const v512u16 &srcColor, const v512u16 &srcAlphaBits, v512u32 &dstLo, v512u32 &dstHi);
template<bool SWAP_RB> void ColorspaceConvert555XTo888X_AVX512(const v512u16 &srcColor, v512u32 &dstLo, v512u32 &dstHi);
template<bool SWAP_RB> void ColorspaceConvert555To6665_AVX512(const v512u16 &srcColor, const v512u16 &srcAlphaBits, v512u32 &dstLo, v512u32 &dstHi);
template<bool SWAP_RB> void ColorspaceConvert555XTo666X_AVX512(const v512u16 &srcColor, v512u32 &dstLo, v512u32 &dstHi);
template<bool SWAP_RB> void ColorspaceConvert555To8888Opaque_AVX512(const v512u16 &srcColor, v512u32 &dstLo, v512u32 &dstHi);
template<bool SWAP_RB> void ColorspaceConvert555To6665Opaque_AVX512(const v512u16 &srcColor, v512u32 &dstLo, v512u32 &dstHi);
template<bool SWAP_RB> v512u32 ColorspaceConvert8888To6665_AVX512(const v512u32 &src);
template<bool SWAP_RB> v512u32 ColorspaceConvert6665To8888_AVX512(const v512u32 &src);
template<bool SWAP_RB> v512u16 ColorspaceConvert8888To5551_AVX512(const v512u32 &srcLo, const v512u32 &srcHi);
template<bool SWAP_RB> v512u16 ColorspaceConvert6665To5551_AVX512(const v512u32 &srcLo, const v512u32 &srcHi);
template<bool SWAP_RB> v512u32 ColorspaceConvert888XTo8888Opaque_AVX512(const v512u32 &src);
template<bool SWAP_RB> v512u16 ColorspaceCopy16_AVX512(const v512u16 &src);
template<bool SWAP_RB> v512u32 ColorspaceCopy32_AVX512(const v512u32 &src);
template<bool SWAP_RB> v512u16 ColorspaceApplyIntensity16_AVX512(const v512u16 &src, float intensity);
template<bool SWAP_RB> v512u32 ColorspaceApplyIntensity32_AVX512(const v512u32 &src, float intensity);
class ColorspaceHandler_AVX512 : public ColorspaceHandler
{
public:
ColorspaceHandler_AVX512() {};
template<BESwapFlags BE_BYTESWAP> size_t ConvertBuffer555To8888Opaque(const u16 *__restrict src, u32 *__restrict dst, size_t pixCount) const;
template<BESwapFlags BE_BYTESWAP> size_t ConvertBuffer555To8888Opaque_SwapRB(const u16 *__restrict src, u32 *__restrict dst, size_t pixCount) const;
template<BESwapFlags BE_BYTESWAP> size_t ConvertBuffer555To8888Opaque_IsUnaligned(const u16 *__restrict src, u32 *__restrict dst, size_t pixCount) const;
template<BESwapFlags BE_BYTESWAP> size_t ConvertBuffer555To8888Opaque_SwapRB_IsUnaligned(const u16 *__restrict src, u32 *__restrict dst, size_t pixCount) const;
template<BESwapFlags BE_BYTESWAP> size_t ConvertBuffer555To6665Opaque(const u16 *__restrict src, u32 *__restrict dst, size_t pixCount) const;
template<BESwapFlags BE_BYTESWAP> size_t ConvertBuffer555To6665Opaque_SwapRB(const u16 *__restrict src, u32 *__restrict dst, size_t pixCount) const;
template<BESwapFlags BE_BYTESWAP> size_t ConvertBuffer555To6665Opaque_IsUnaligned(const u16 *__restrict src, u32 *__restrict dst, size_t pixCount) const;
template<BESwapFlags BE_BYTESWAP> size_t ConvertBuffer555To6665Opaque_SwapRB_IsUnaligned(const u16 *__restrict src, u32 *__restrict dst, size_t pixCount) const;
size_t ConvertBuffer8888To6665(const u32 *src, u32 *dst, size_t pixCount) const;
size_t ConvertBuffer8888To6665_SwapRB(const u32 *src, u32 *dst, size_t pixCount) const;
size_t ConvertBuffer8888To6665_IsUnaligned(const u32 *src, u32 *dst, size_t pixCount) const;
size_t ConvertBuffer8888To6665_SwapRB_IsUnaligned(const u32 *src, u32 *dst, size_t pixCount) const;
size_t ConvertBuffer6665To8888(const u32 *src, u32 *dst, size_t pixCount) const;
size_t ConvertBuffer6665To8888_SwapRB(const u32 *src, u32 *dst, size_t pixCount) const;
size_t ConvertBuffer6665To8888_IsUnaligned(const u32 *src, u32 *dst, size_t pixCount) const;
size_t ConvertBuffer6665To8888_SwapRB_IsUnaligned(const u32 *src, u32 *dst, size_t pixCount) const;
size_t ConvertBuffer8888To5551(const u32 *__restrict src, u16 *__restrict dst, size_t pixCount) const;
size_t ConvertBuffer8888To5551_SwapRB(const u32 *__restrict src, u16 *__restrict dst, size_t pixCount) const;
size_t ConvertBuffer8888To5551_IsUnaligned(const u32 *__restrict src, u16 *__restrict dst, size_t pixCount) const;
size_t ConvertBuffer8888To5551_SwapRB_IsUnaligned(const u32 *__restrict src, u16 *__restrict dst, size_t pixCount) const;
size_t ConvertBuffer6665To5551(const u32 *__restrict src, u16 *__restrict dst, size_t pixCount) const;
size_t ConvertBuffer6665To5551_SwapRB(const u32 *__restrict src, u16 *__restrict dst, size_t pixCount) const;
size_t ConvertBuffer6665To5551_IsUnaligned(const u32 *__restrict src, u16 *__restrict dst, size_t pixCount) const;
size_t ConvertBuffer6665To5551_SwapRB_IsUnaligned(const u32 *__restrict src, u16 *__restrict dst, size_t pixCount) const;
size_t ConvertBuffer888XTo8888Opaque(const u32 *src, u32 *dst, size_t pixCount) const;
size_t ConvertBuffer888XTo8888Opaque_SwapRB(const u32 *src, u32 *dst, size_t pixCount) const;
size_t ConvertBuffer888XTo8888Opaque_IsUnaligned(const u32 *src, u32 *dst, size_t pixCount) const;
size_t ConvertBuffer888XTo8888Opaque_SwapRB_IsUnaligned(const u32 *src, u32 *dst, size_t pixCount) const;
size_t ConvertBuffer555XTo888(const u16 *__restrict src, u8 *__restrict dst, size_t pixCount) const;
size_t ConvertBuffer555XTo888_SwapRB(const u16 *__restrict src, u8 *__restrict dst, size_t pixCount) const;
size_t ConvertBuffer555XTo888_IsUnaligned(const u16 *__restrict src, u8 *__restrict dst, size_t pixCount) const;
size_t ConvertBuffer555XTo888_SwapRB_IsUnaligned(const u16 *__restrict src, u8 *__restrict dst, size_t pixCount) const;
size_t ConvertBuffer888XTo888(const u32 *__restrict src, u8 *__restrict dst, size_t pixCount) const;
size_t ConvertBuffer888XTo888_SwapRB(const u32 *__restrict src, u8 *__restrict dst, size_t pixCount) const;
size_t ConvertBuffer888XTo888_IsUnaligned(const u32 *__restrict src, u8 *__restrict dst, size_t pixCount) const;
size_t ConvertBuffer888XTo888_SwapRB_IsUnaligned(const u32 *__restrict src, u8 *__restrict dst, size_t pixCount) const;
size_t CopyBuffer16_SwapRB(const u16 *src, u16 *dst, size_t pixCount) const;
size_t CopyBuffer16_SwapRB_IsUnaligned(const u16 *src, u16 *dst, size_t pixCount) const;
size_t CopyBuffer32_SwapRB(const u32 *src, u32 *dst, size_t pixCount) const;
size_t CopyBuffer32_SwapRB_IsUnaligned(const u32 *src, u32 *dst, size_t pixCount) const;
size_t ApplyIntensityToBuffer16(u16 *dst, size_t pixCount, float intensity) const;
size_t ApplyIntensityToBuffer16_SwapRB(u16 *dst, size_t pixCount, float intensity) const;
size_t ApplyIntensityToBuffer16_IsUnaligned(u16 *dst, size_t pixCount, float intensity) const;
size_t ApplyIntensityToBuffer16_SwapRB_IsUnaligned(u16 *dst, size_t pixCount, float intensity) const;
size_t ApplyIntensityToBuffer32(u32 *dst, size_t pixCount, float intensity) const;
size_t ApplyIntensityToBuffer32_SwapRB(u32 *dst, size_t pixCount, float intensity) const;
size_t ApplyIntensityToBuffer32_IsUnaligned(u32 *dst, size_t pixCount, float intensity) const;
size_t ApplyIntensityToBuffer32_SwapRB_IsUnaligned(u32 *dst, size_t pixCount, float intensity) const;
};
#endif // ENABLE_AVX512_1
#endif // COLORSPACEHANDLER_AVX512_H

View File

@ -0,0 +1,658 @@
/*
Copyright (C) 2016-2022 DeSmuME team
This file is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 2 of the License, or
(at your option) any later version.
This file is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with the this software. If not, see <http://www.gnu.org/licenses/>.
*/
#include "colorspacehandler_Altivec.h"
#ifndef ENABLE_ALTIVEC
#error This code requires PowerPC AltiVec support.
#else
#include <string.h>
template <bool SWAP_RB, BESwapFlags BE_BYTESWAP>
FORCEINLINE void ColorspaceConvert555To8888_AltiVec(const v128u16 &srcColor, const v128u16 &srcAlphaBits, v128u32 &dstLo, v128u32 &dstHi)
{
// Conversion algorithm:
// RGB 5-bit to 8-bit formula: dstRGB8 = (srcRGB5 << 3) | ((srcRGB5 >> 2) & 0x07)
v128u16 srcSwapped;
if ( (BE_BYTESWAP == BESwapSrc) || (BE_BYTESWAP == BESwapSrcDst) )
{
srcSwapped = vec_perm((v128u8)srcColor, (v128u8)srcColor, ((v128u8){1,0, 3,2, 5,4, 7,6, 9,8, 11,10, 13,12, 15,14}));
}
else
{
srcSwapped = srcColor;
}
dstLo = vec_unpackl((vector pixel)srcSwapped);
dstLo = vec_or( vec_sl((v128u8)dstLo, ((v128u8){0,3,3,3, 0,3,3,3, 0,3,3,3, 0,3,3,3})), vec_sr((v128u8)dstLo, ((v128u8){0,2,2,2, 0,2,2,2, 0,2,2,2, 0,2,2,2})) );
if ( (BE_BYTESWAP == BESwapDst) || (BE_BYTESWAP == BESwapSrcDst) )
{
dstLo = vec_perm((v128u8)dstLo, (v128u8)srcAlphaBits, (SWAP_RB) ? ((v128u8){0x01,0x02,0x03,0x11, 0x05,0x06,0x07,0x13, 0x09,0x0A,0x0B,0x15, 0x0D,0x0E,0x0F,0x17}) : ((v128u8){0x03,0x02,0x01,0x11, 0x07,0x06,0x05,0x13, 0x0B,0x0A,0x09,0x15, 0x0F,0x0E,0x0D,0x17}));
}
else
{
dstLo = vec_perm((v128u8)dstLo, (v128u8)srcAlphaBits, (SWAP_RB) ? ((v128u8){0x11,0x03,0x02,0x01, 0x13,0x07,0x06,0x05, 0x15,0x0B,0x0A,0x09, 0x17,0x0F,0x0E,0x0D}) : ((v128u8){0x11,0x01,0x02,0x03, 0x13,0x05,0x06,0x07, 0x15,0x09,0x0A,0x0B, 0x17,0x0D,0x0E,0x0F}));
}
dstHi = vec_unpackh((vector pixel)srcSwapped);
dstHi = vec_or( vec_sl((v128u8)dstHi, ((v128u8){0,3,3,3, 0,3,3,3, 0,3,3,3, 0,3,3,3})), vec_sr((v128u8)dstHi, ((v128u8){0,2,2,2, 0,2,2,2, 0,2,2,2, 0,2,2,2})) );
if ( (BE_BYTESWAP == BESwapDst) || (BE_BYTESWAP == BESwapSrcDst) )
{
dstHi = vec_perm((v128u8)dstHi, (v128u8)srcAlphaBits, (SWAP_RB) ? ((v128u8){0x01,0x02,0x03,0x19, 0x05,0x06,0x07,0x1B, 0x09,0x0A,0x0B,0x1D, 0x0D,0x0E,0x0F,0x1F}) : ((v128u8){0x03,0x02,0x01,0x19, 0x07,0x06,0x05,0x1B, 0x0B,0x0A,0x09,0x1D, 0x0F,0x0E,0x0D,0x1F}));
}
else
{
dstHi = vec_perm((v128u8)dstHi, (v128u8)srcAlphaBits, (SWAP_RB) ? ((v128u8){0x19,0x03,0x02,0x01, 0x1B,0x07,0x06,0x05, 0x1D,0x0B,0x0A,0x09, 0x1F,0x0F,0x0E,0x0D}) : ((v128u8){0x19,0x01,0x02,0x03, 0x1B,0x05,0x06,0x07, 0x1D,0x09,0x0A,0x0B, 0x1F,0x0D,0x0E,0x0F}));
}
}
template <bool SWAP_RB, BESwapFlags BE_BYTESWAP>
FORCEINLINE void ColorspaceConvert555XTo888X_AltiVec(const v128u16 &srcColor, v128u32 &dstLo, v128u32 &dstHi)
{
const v128u16 srcAlphaBits16 = {0, 0, 0, 0, 0, 0, 0, 0};
ColorspaceConvert555To8888_AltiVec<SWAP_RB, BE_BYTESWAP>(srcColor, srcAlphaBits16, dstLo, dstHi);
}
template <bool SWAP_RB, BESwapFlags BE_BYTESWAP>
FORCEINLINE void ColorspaceConvert555To6665_AltiVec(const v128u16 &srcColor, const v128u16 &srcAlphaBits, v128u32 &dstLo, v128u32 &dstHi)
{
// Conversion algorithm:
// RGB 5-bit to 6-bit formula: dstRGB6 = (srcRGB5 << 1) | ((srcRGB5 >> 4) & 0x01)
v128u16 srcSwapped;
if ( (BE_BYTESWAP == BESwapSrc) || (BE_BYTESWAP == BESwapSrcDst) )
{
srcSwapped = vec_perm((v128u8)srcColor, (v128u8)srcColor, ((v128u8){1,0, 3,2, 5,4, 7,6, 9,8, 11,10, 13,12, 15,14}));
}
else
{
srcSwapped = srcColor;
}
dstLo = vec_unpackl((vector pixel)srcSwapped);
dstLo = vec_or( vec_sl((v128u8)dstLo, ((v128u8){0,1,1,1, 0,1,1,1, 0,1,1,1, 0,1,1,1})), vec_sr((v128u8)dstLo, ((v128u8){0,4,4,4, 0,4,4,4, 0,4,4,4, 0,4,4,4})) );
if ( (BE_BYTESWAP == BESwapDst) || (BE_BYTESWAP == BESwapSrcDst) )
{
dstLo = vec_perm((v128u8)dstLo, (v128u8)srcAlphaBits, (SWAP_RB) ? ((v128u8){0x01,0x02,0x03,0x11, 0x05,0x06,0x07,0x13, 0x09,0x0A,0x0B,0x15, 0x0D,0x0E,0x0F,0x17}) : ((v128u8){0x03,0x02,0x01,0x11, 0x07,0x06,0x05,0x13, 0x0B,0x0A,0x09,0x15, 0x0F,0x0E,0x0D,0x17}));
}
else
{
dstLo = vec_perm((v128u8)dstLo, (v128u8)srcAlphaBits, (SWAP_RB) ? ((v128u8){0x11,0x03,0x02,0x01, 0x13,0x07,0x06,0x05, 0x15,0x0B,0x0A,0x09, 0x17,0x0F,0x0E,0x0D}) : ((v128u8){0x11,0x01,0x02,0x03, 0x13,0x05,0x06,0x07, 0x15,0x09,0x0A,0x0B, 0x17,0x0D,0x0E,0x0F}));
}
dstHi = vec_unpackh((vector pixel)srcSwapped);
dstHi = vec_or( vec_sl((v128u8)dstHi, ((v128u8){0,1,1,1, 0,1,1,1, 0,1,1,1, 0,1,1,1})), vec_sr((v128u8)dstHi, ((v128u8){0,4,4,4, 0,4,4,4, 0,4,4,4, 0,4,4,4})) );
if ( (BE_BYTESWAP == BESwapDst) || (BE_BYTESWAP == BESwapSrcDst) )
{
dstHi = vec_perm((v128u8)dstHi, (v128u8)srcAlphaBits, (SWAP_RB) ? ((v128u8){0x01,0x02,0x03,0x19, 0x05,0x06,0x07,0x1B, 0x09,0x0A,0x0B,0x1D, 0x0D,0x0E,0x0F,0x1F}) : ((v128u8){0x03,0x02,0x01,0x19, 0x07,0x06,0x05,0x1B, 0x0B,0x0A,0x09,0x1D, 0x0F,0x0E,0x0D,0x1F}));
}
else
{
dstHi = vec_perm((v128u8)dstHi, (v128u8)srcAlphaBits, (SWAP_RB) ? ((v128u8){0x19,0x03,0x02,0x01, 0x1B,0x07,0x06,0x05, 0x1D,0x0B,0x0A,0x09, 0x1F,0x0F,0x0E,0x0D}) : ((v128u8){0x19,0x01,0x02,0x03, 0x1B,0x05,0x06,0x07, 0x1D,0x09,0x0A,0x0B, 0x1F,0x0D,0x0E,0x0F}));
}
}
template <bool SWAP_RB, BESwapFlags BE_BYTESWAP>
FORCEINLINE void ColorspaceConvert555XTo666X_AltiVec(const v128u16 &srcColor, v128u32 &dstLo, v128u32 &dstHi)
{
const v128u16 srcAlphaBits16 = {0, 0, 0, 0, 0, 0, 0, 0};
ColorspaceConvert555To6665_AltiVec<SWAP_RB, BE_BYTESWAP>(srcColor, srcAlphaBits16, dstLo, dstHi);
}
template <bool SWAP_RB, BESwapFlags BE_BYTESWAP>
FORCEINLINE void ColorspaceConvert555To8888Opaque_AltiVec(const v128u16 &srcColor, v128u32 &dstLo, v128u32 &dstHi)
{
const v128u16 srcAlphaBits16 = {0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF};
ColorspaceConvert555To8888_AltiVec<SWAP_RB, BE_BYTESWAP>(srcColor, srcAlphaBits16, dstLo, dstHi);
}
template <bool SWAP_RB, BESwapFlags BE_BYTESWAP>
FORCEINLINE void ColorspaceConvert555To6665Opaque_AltiVec(const v128u16 &srcColor, v128u32 &dstLo, v128u32 &dstHi)
{
const v128u16 srcAlphaBits16 = {0x1F1F, 0x1F1F, 0x1F1F, 0x1F1F, 0x1F1F, 0x1F1F, 0x1F1F, 0x1F1F};
ColorspaceConvert555To6665_AltiVec<SWAP_RB, BE_BYTESWAP>(srcColor, srcAlphaBits16, dstLo, dstHi);
}
template <bool SWAP_RB>
FORCEINLINE v128u32 ColorspaceConvert8888To6665_AltiVec(const v128u32 &src)
{
// Conversion algorithm:
// RGB 8-bit to 6-bit formula: dstRGB6 = (srcRGB8 >> 2)
// Alpha 8-bit to 6-bit formula: dstA5 = (srcA8 >> 3)
v128u8 rgba = vec_sr( (v128u8)src, ((v128u8){2,2,2,3, 2,2,2,3, 2,2,2,3, 2,2,2,3}) );
if (SWAP_RB)
{
rgba = vec_perm( rgba, rgba, ((v128u8){2,1,0,3, 6,5,4,7, 10,9,8,11, 14,13,12,15}) );
}
return (v128u32)rgba;
}
template <bool SWAP_RB>
FORCEINLINE v128u32 ColorspaceConvert6665To8888_AltiVec(const v128u32 &src)
{
// Conversion algorithm:
// RGB 6-bit to 8-bit formula: dstRGB8 = (srcRGB6 << 2) | ((srcRGB6 >> 4) & 0x03)
// Alpha 5-bit to 8-bit formula: dstA8 = (srcA5 << 3) | ((srcA5 >> 2) & 0x07)
v128u8 rgba = vec_or( vec_sl((v128u8)src, ((v128u8){2,2,2,3, 2,2,2,3, 2,2,2,3, 2,2,2,3})), vec_sr((v128u8)src, ((v128u8){4,4,4,2, 4,4,4,2, 4,4,4,2, 4,4,4,2})) );
if (SWAP_RB)
{
rgba = vec_perm( rgba, rgba, ((v128u8){2,1,0,3, 6,5,4,7, 10,9,8,11, 14,13,12,15}) );
}
return (v128u32)rgba;
}
template <NDSColorFormat COLORFORMAT, bool SWAP_RB>
FORCEINLINE v128u16 _ConvertColorBaseTo5551_AltiVec(const v128u32 &srcLo, const v128u32 &srcHi)
{
if (COLORFORMAT == NDSColorFormat_BGR555_Rev)
{
return srcLo;
}
v128u32 rgbLo;
v128u32 rgbHi;
v128u16 dstColor;
v128u16 dstAlpha;
if (COLORFORMAT == NDSColorFormat_BGR666_Rev)
{
rgbLo = vec_sl( srcLo, ((v128u32){2,2,2,2}) );
rgbHi = vec_sl( srcHi, ((v128u32){2,2,2,2}) );
// Convert alpha
dstAlpha = vec_packsu( vec_and(vec_sr(srcLo, ((v128u32){24,24,24,24})), ((v128u32){0x0000001F,0x0000001F,0x0000001F,0x0000001F})), vec_and(vec_sr(srcHi, ((v128u32){24,24,24,24})), ((v128u32){0x0000001F,0x0000001F,0x0000001F,0x0000001F})) );
}
else if (COLORFORMAT == NDSColorFormat_BGR888_Rev)
{
rgbLo = srcLo;
rgbHi = srcHi;
// Convert alpha
dstAlpha = vec_packsu( vec_sr(srcLo, ((v128u32){24,24,24,24})), vec_sr(srcHi, ((v128u32){24,24,24,24})) );
}
dstAlpha = vec_cmpgt(dstAlpha, ((v128u16){0,0,0,0,0,0,0,0}));
dstAlpha = vec_and(dstAlpha, ((v128u16){0x8000,0x8000,0x8000,0x8000,0x8000,0x8000,0x8000,0x8000}));
// Convert RGB
if (SWAP_RB)
{
rgbLo = vec_perm( (v128u8)rgbLo, (v128u8)rgbLo, ((v128u8){3,0,1,2, 7,4,5,6, 11,8,9,10, 15,12,13,14}) );
rgbHi = vec_perm( (v128u8)rgbHi, (v128u8)rgbHi, ((v128u8){3,0,1,2, 7,4,5,6, 11,8,9,10, 15,12,13,14}) );
}
else
{
rgbLo = vec_perm( (v128u8)rgbLo, (v128u8)rgbLo, ((v128u8){3,2,1,0, 7,6,5,4, 11,10,9,8, 15,14,13,12}) );
rgbHi = vec_perm( (v128u8)rgbHi, (v128u8)rgbHi, ((v128u8){3,2,1,0, 7,6,5,4, 11,10,9,8, 15,14,13,12}) );
}
dstColor = (v128u16)vec_packpx(rgbLo, rgbHi);
dstColor = vec_and(dstColor, ((v128u16){0x7FFF,0x7FFF,0x7FFF,0x7FFF,0x7FFF,0x7FFF,0x7FFF,0x7FFF}));
return vec_or(dstColor, dstAlpha);
}
template <bool SWAP_RB>
FORCEINLINE v128u16 ColorspaceConvert8888To5551_AltiVec(const v128u32 &srcLo, const v128u32 &srcHi)
{
return _ConvertColorBaseTo5551_AltiVec<NDSColorFormat_BGR888_Rev, SWAP_RB>(srcLo, srcHi);
}
template <bool SWAP_RB>
FORCEINLINE v128u16 ColorspaceConvert6665To5551_AltiVec(const v128u32 &srcLo, const v128u32 &srcHi)
{
return _ConvertColorBaseTo5551_AltiVec<NDSColorFormat_BGR666_Rev, SWAP_RB>(srcLo, srcHi);
}
template <bool SWAP_RB>
FORCEINLINE v128u32 ColorspaceConvert888XTo8888Opaque_AltiVec(const v128u32 &src)
{
if (SWAP_RB)
{
return vec_or( vec_perm((v128u8)src, (v128u8)src, ((v128u8){3,0,1,2, 7,4,5,6, 11,8,9,10, 15,12,13,14})), ((v128u32){0xFF000000, 0xFF000000, 0xFF000000, 0xFF000000}) );
}
return vec_or( vec_perm((v128u8)src, (v128u8)src, ((v128u8){3,2,1,0, 7,6,5,4, 11,10,9,8, 15,14,13,12})), ((v128u32){0xFF000000, 0xFF000000, 0xFF000000, 0xFF000000}) );
}
template <bool SWAP_RB>
FORCEINLINE v128u16 ColorspaceCopy16_AltiVec(const v128u16 &src)
{
if (SWAP_RB)
{
return vec_or( vec_or(vec_sr(vec_and(src, ((v128u16){0x7C00,0x7C00,0x7C00,0x7C00,0x7C00,0x7C00,0x7C00,0x7C00})), ((v128u16){10,10,10,10,10,10,10,10})), vec_or(vec_and(src, ((v128u16){0x0E30,0x0E30,0x0E30,0x0E30,0x0E30,0x0E30,0x0E30,0x0E30})), vec_sl(vec_and(src, ((v128u16){0x001F,0x001F,0x001F,0x001F,0x001F,0x001F,0x001F,0x001F})), ((v128u16){10,10,10,10,10,10,10,10})))), vec_and(src, ((v128u16){0x8000,0x8000,0x8000,0x8000,0x8000,0x8000,0x8000,0x8000})) );
}
return src;
}
template <bool SWAP_RB>
FORCEINLINE v128u32 ColorspaceCopy32_AltiVec(const v128u32 &src)
{
if (SWAP_RB)
{
return vec_perm((v128u8)src, (v128u8)src, ((v128u8){2,1,0,3, 6,5,4,7, 10,9,8,11, 14,13,12,15}));
}
return src;
}
template <bool SWAP_RB, BESwapFlags BE_BYTESWAP>
static size_t ColorspaceConvertBuffer555To8888Opaque_AltiVec(const u16 *__restrict src, u32 *__restrict dst, const size_t pixCountVec128)
{
size_t i = 0;
for (; i < pixCountVec128; i+=sizeof(v128u16)/sizeof(u16))
{
v128u32 dstConvertedLo, dstConvertedHi;
ColorspaceConvert555To8888Opaque_AltiVec<SWAP_RB, BE_BYTESWAP>( vec_ld(0, src+i), dstConvertedLo, dstConvertedHi );
vec_st(dstConvertedHi, 0, dst+i);
vec_st(dstConvertedLo, 16, dst+i);
}
return i;
}
template <bool SWAP_RB, BESwapFlags BE_BYTESWAP>
size_t ColorspaceConvertBuffer555To6665Opaque_AltiVec(const u16 *__restrict src, u32 *__restrict dst, size_t pixCountVec128)
{
size_t i = 0;
for (; i < pixCountVec128; i+=sizeof(v128u16)/sizeof(u16))
{
v128u32 dstConvertedLo, dstConvertedHi;
ColorspaceConvert555To6665Opaque_AltiVec<SWAP_RB, BE_BYTESWAP>( vec_ld(0, src+i), dstConvertedLo, dstConvertedHi );
vec_st(dstConvertedHi, 0, dst+i);
vec_st(dstConvertedLo, 16, dst+i);
}
return i;
}
template <bool SWAP_RB>
size_t ColorspaceConvertBuffer8888To6665_AltiVec(const u32 *src, u32 *dst, size_t pixCountVec128)
{
size_t i = 0;
for (; i < pixCountVec128; i+=4)
{
vec_st( ColorspaceConvert8888To6665_AltiVec<SWAP_RB>(vec_ld(0, src+i)), 0, dst+i );
}
return i;
}
template <bool SWAP_RB>
size_t ColorspaceConvertBuffer6665To8888_AltiVec(const u32 *src, u32 *dst, size_t pixCountVec128)
{
size_t i = 0;
for (; i < pixCountVec128; i+=4)
{
vec_st( ColorspaceConvert6665To8888_AltiVec<SWAP_RB>(vec_ld(0, src+i)), 0, dst+i );
}
return i;
}
template <bool SWAP_RB>
size_t ColorspaceConvertBuffer8888To5551_AltiVec(const u32 *__restrict src, u16 *__restrict dst, size_t pixCountVec128)
{
size_t i = 0;
for (; i < pixCountVec128; i+=8)
{
vec_st( ColorspaceConvert8888To5551_AltiVec<SWAP_RB>(vec_ld(0, src+i), vec_ld(16, src+i)), 0, dst+i );
}
return i;
}
template <bool SWAP_RB>
size_t ColorspaceConvertBuffer6665To5551_AltiVec(const u32 *__restrict src, u16 *__restrict dst, size_t pixCountVec128)
{
size_t i = 0;
for (; i < pixCountVec128; i+=8)
{
vec_st( ColorspaceConvert6665To5551_AltiVec<SWAP_RB>(vec_ld(0, src+i), vec_ld(16, src+i)), 0, dst+i );
}
return i;
}
template <bool SWAP_RB>
size_t ColorspaceConvertBuffer888XTo8888Opaque_AltiVec(const u32 *src, u32 *dst, size_t pixCountVec128)
{
size_t i = 0;
for (; i < pixCountVec128; i+=4)
{
vec_st( ColorspaceConvert888XTo8888Opaque_AltiVec<SWAP_RB>(vec_ld(0, src+i)), 0, dst+i );
}
return i;
}
template <bool SWAP_RB>
size_t ColorspaceConvertBuffer555XTo888_AltiVec(const u16 *src, u8 *dst, size_t pixCountVec128)
{
size_t i = 0;
v128u16 src_v128u16[2];
v128u32 src_v128u32[4];
for (; i < pixCountVec128; i+=16)
{
src_v128u16[0] = vec_ld( 0, src+i);
src_v128u16[1] = vec_ld(16, src+i);
src_v128u32[0] = vec_unpackl((vector pixel)src_v128u16[0]);
src_v128u32[1] = vec_unpackh((vector pixel)src_v128u16[0]);
src_v128u32[2] = vec_unpackl((vector pixel)src_v128u16[1]);
src_v128u32[3] = vec_unpackh((vector pixel)src_v128u16[1]);
src_v128u32[0] = vec_or( vec_sl((v128u8)src_v128u32[0], ((v128u8){0,3,3,3, 0,3,3,3, 0,3,3,3, 0,3,3,3})), vec_sr((v128u8)src_v128u32[0], ((v128u8){0,2,2,2, 0,2,2,2, 0,2,2,2, 0,2,2,2})) );
src_v128u32[1] = vec_or( vec_sl((v128u8)src_v128u32[1], ((v128u8){0,3,3,3, 0,3,3,3, 0,3,3,3, 0,3,3,3})), vec_sr((v128u8)src_v128u32[1], ((v128u8){0,2,2,2, 0,2,2,2, 0,2,2,2, 0,2,2,2})) );
src_v128u32[2] = vec_or( vec_sl((v128u8)src_v128u32[2], ((v128u8){0,3,3,3, 0,3,3,3, 0,3,3,3, 0,3,3,3})), vec_sr((v128u8)src_v128u32[2], ((v128u8){0,2,2,2, 0,2,2,2, 0,2,2,2, 0,2,2,2})) );
src_v128u32[3] = vec_or( vec_sl((v128u8)src_v128u32[3], ((v128u8){0,3,3,3, 0,3,3,3, 0,3,3,3, 0,3,3,3})), vec_sr((v128u8)src_v128u32[3], ((v128u8){0,2,2,2, 0,2,2,2, 0,2,2,2, 0,2,2,2})) );
if (SWAP_RB)
{
src_v128u32[0] = vec_perm( (v128u8)src_v128u32[0], (v128u8)src_v128u32[1], ((v128u8){0x05,0x03,0x02,0x01, 0x0A,0x09,0x07,0x06, 0x0F,0x0E,0x0D,0x0B, 0x15,0x13,0x12,0x11}) );
src_v128u32[1] = vec_perm( (v128u8)src_v128u32[1], (v128u8)src_v128u32[2], ((v128u8){0x0A,0x09,0x07,0x06, 0x0F,0x0E,0x0D,0x0B, 0x15,0x13,0x12,0x11, 0x1A,0x19,0x17,0x16}) );
src_v128u32[2] = vec_perm( (v128u8)src_v128u32[2], (v128u8)src_v128u32[3], ((v128u8){0x0F,0x0E,0x0D,0x0B, 0x15,0x13,0x12,0x11, 0x1A,0x19,0x17,0x16, 0x1F,0x1E,0x1D,0x1B}) );
}
else
{
src_v128u32[0] = vec_perm( (v128u8)src_v128u32[0], (v128u8)src_v128u32[1], ((v128u8){0x07,0x01,0x02,0x03, 0x0A,0x0B,0x05,0x06, 0x0D,0x0E,0x0F,0x09, 0x17,0x11,0x12,0x13}) );
src_v128u32[1] = vec_perm( (v128u8)src_v128u32[1], (v128u8)src_v128u32[2], ((v128u8){0x0A,0x0B,0x05,0x06, 0x0D,0x0E,0x0F,0x09, 0x17,0x11,0x12,0x13, 0x1A,0x1B,0x15,0x16}) );
src_v128u32[2] = vec_perm( (v128u8)src_v128u32[2], (v128u8)src_v128u32[3], ((v128u8){0x0D,0x0E,0x0F,0x09, 0x17,0x11,0x12,0x13, 0x1A,0x1B,0x15,0x16, 0x1D,0x1E,0x1F,0x19}) );
}
vec_st( src_v128u32[0], 0, dst + (i * 3) );
vec_st( src_v128u32[1], 16, dst + (i * 3) );
vec_st( src_v128u32[2], 32, dst + (i * 3) );
}
return i;
}
template <bool SWAP_RB>
size_t ColorspaceConvertBuffer888XTo888_AltiVec(const u32 *src, u8 *dst, size_t pixCountVec128)
{
size_t i = 0;
v128u32 src_v128u32[4];
for (; i < pixCountVec128; i+=16)
{
src_v128u32[0] = vec_ld( 0, src+i);
src_v128u32[1] = vec_ld(16, src+i);
src_v128u32[2] = vec_ld(32, src+i);
src_v128u32[3] = vec_ld(48, src+i);
if (SWAP_RB)
{
src_v128u32[0] = vec_perm( (v128u8)src_v128u32[0], (v128u8)src_v128u32[1], ((v128u8){0x05,0x03,0x02,0x01, 0x0A,0x09,0x07,0x06, 0x0F,0x0E,0x0D,0x0B, 0x15,0x13,0x12,0x11}) );
src_v128u32[1] = vec_perm( (v128u8)src_v128u32[1], (v128u8)src_v128u32[2], ((v128u8){0x0A,0x09,0x07,0x06, 0x0F,0x0E,0x0D,0x0B, 0x15,0x13,0x12,0x11, 0x1A,0x19,0x17,0x16}) );
src_v128u32[2] = vec_perm( (v128u8)src_v128u32[2], (v128u8)src_v128u32[3], ((v128u8){0x0F,0x0E,0x0D,0x0B, 0x15,0x13,0x12,0x11, 0x1A,0x19,0x17,0x16, 0x1F,0x1E,0x1D,0x1B}) );
}
else
{
src_v128u32[0] = vec_perm( (v128u8)src_v128u32[0], (v128u8)src_v128u32[1], ((v128u8){0x07,0x01,0x02,0x03, 0x0A,0x0B,0x05,0x06, 0x0D,0x0E,0x0F,0x09, 0x17,0x11,0x12,0x13}) );
src_v128u32[1] = vec_perm( (v128u8)src_v128u32[1], (v128u8)src_v128u32[2], ((v128u8){0x0A,0x0B,0x05,0x06, 0x0D,0x0E,0x0F,0x09, 0x17,0x11,0x12,0x13, 0x1A,0x1B,0x15,0x16}) );
src_v128u32[2] = vec_perm( (v128u8)src_v128u32[2], (v128u8)src_v128u32[3], ((v128u8){0x0D,0x0E,0x0F,0x09, 0x17,0x11,0x12,0x13, 0x1A,0x1B,0x15,0x16, 0x1D,0x1E,0x1F,0x19}) );
}
vec_st( src_v128u32[0], 0, dst + (i * 3) );
vec_st( src_v128u32[1], 16, dst + (i * 3) );
vec_st( src_v128u32[2], 32, dst + (i * 3) );
}
return i;
}
template <bool SWAP_RB>
size_t ColorspaceCopyBuffer16_AltiVec(const u16 *src, u16 *dst, size_t pixCountVec128)
{
if (!SWAP_RB)
{
memcpy(dst, src, pixCountVec128 * sizeof(u16));
return pixCountVec128;
}
size_t i = 0;
for (; i < pixCountVec128; i+=8)
{
vec_st( ColorspaceCopy16_AltiVec<SWAP_RB>(vec_ld(0, src+i)), 0, dst+i );
}
return i;
}
template <bool SWAP_RB>
size_t ColorspaceCopyBuffer32_AltiVec(const u32 *src, u32 *dst, size_t pixCountVec128)
{
if (!SWAP_RB)
{
memcpy(dst, src, pixCountVec128 * sizeof(u32));
return pixCountVec128;
}
size_t i = 0;
for (; i < pixCountVec128; i+=4)
{
vec_st( ColorspaceCopy32_AltiVec<SWAP_RB>(vec_ld(0, src+i)), 0, dst+i );
}
return i;
}
template <BESwapFlags BE_BYTESWAP>
size_t ColorspaceHandler_AltiVec::ConvertBuffer555To8888Opaque(const u16 *__restrict src, u32 *__restrict dst, size_t pixCount) const
{
return ColorspaceConvertBuffer555To8888Opaque_AltiVec<false, BE_BYTESWAP>(src, dst, pixCount);
}
template <BESwapFlags BE_BYTESWAP>
size_t ColorspaceHandler_AltiVec::ConvertBuffer555To8888Opaque_SwapRB(const u16 *__restrict src, u32 *__restrict dst, size_t pixCount) const
{
return ColorspaceConvertBuffer555To8888Opaque_AltiVec<true, BE_BYTESWAP>(src, dst, pixCount);
}
template <BESwapFlags BE_BYTESWAP>
size_t ColorspaceHandler_AltiVec::ConvertBuffer555To6665Opaque(const u16 *__restrict src, u32 *__restrict dst, size_t pixCount) const
{
return ColorspaceConvertBuffer555To6665Opaque_AltiVec<false, BE_BYTESWAP>(src, dst, pixCount);
}
template <BESwapFlags BE_BYTESWAP>
size_t ColorspaceHandler_AltiVec::ConvertBuffer555To6665Opaque_SwapRB(const u16 *__restrict src, u32 *__restrict dst, size_t pixCount) const
{
return ColorspaceConvertBuffer555To6665Opaque_AltiVec<true, BE_BYTESWAP>(src, dst, pixCount);
}
size_t ColorspaceHandler_AltiVec::ConvertBuffer8888To6665(const u32 *src, u32 *dst, size_t pixCount) const
{
return ColorspaceConvertBuffer8888To6665_AltiVec<false>(src, dst, pixCount);
}
size_t ColorspaceHandler_AltiVec::ConvertBuffer8888To6665_SwapRB(const u32 *src, u32 *dst, size_t pixCount) const
{
return ColorspaceConvertBuffer8888To6665_AltiVec<true>(src, dst, pixCount);
}
size_t ColorspaceHandler_AltiVec::ConvertBuffer6665To8888(const u32 *src, u32 *dst, size_t pixCount) const
{
return ColorspaceConvertBuffer6665To8888_AltiVec<false>(src, dst, pixCount);
}
size_t ColorspaceHandler_AltiVec::ConvertBuffer6665To8888_SwapRB(const u32 *src, u32 *dst, size_t pixCount) const
{
return ColorspaceConvertBuffer6665To8888_AltiVec<true>(src, dst, pixCount);
}
size_t ColorspaceHandler_AltiVec::ConvertBuffer8888To5551(const u32 *__restrict src, u16 *__restrict dst, size_t pixCount) const
{
return ColorspaceConvertBuffer8888To5551_AltiVec<false>(src, dst, pixCount);
}
size_t ColorspaceHandler_AltiVec::ConvertBuffer8888To5551_SwapRB(const u32 *__restrict src, u16 *__restrict dst, size_t pixCount) const
{
return ColorspaceConvertBuffer8888To5551_AltiVec<true>(src, dst, pixCount);
}
size_t ColorspaceHandler_AltiVec::ConvertBuffer6665To5551(const u32 *__restrict src, u16 *__restrict dst, size_t pixCount) const
{
return ColorspaceConvertBuffer6665To5551_AltiVec<false>(src, dst, pixCount);
}
size_t ColorspaceHandler_AltiVec::ConvertBuffer6665To5551_SwapRB(const u32 *__restrict src, u16 *__restrict dst, size_t pixCount) const
{
return ColorspaceConvertBuffer6665To5551_AltiVec<true>(src, dst, pixCount);
}
size_t ColorspaceHandler_AltiVec::ConvertBuffer888XTo8888Opaque(const u32 *src, u32 *dst, size_t pixCount) const
{
return ColorspaceConvertBuffer888XTo8888Opaque_AltiVec<false>(src, dst, pixCount);
}
size_t ColorspaceHandler_AltiVec::ConvertBuffer888XTo8888Opaque_SwapRB(const u32 *src, u32 *dst, size_t pixCount) const
{
return ColorspaceConvertBuffer888XTo8888Opaque_AltiVec<true>(src, dst, pixCount);
}
size_t ColorspaceHandler_AltiVec::ConvertBuffer555XTo888(const u16 *__restrict src, u8 *__restrict dst, size_t pixCount) const
{
return ColorspaceConvertBuffer555XTo888_AltiVec<false>(src, dst, pixCount);
}
size_t ColorspaceHandler_AltiVec::ConvertBuffer555XTo888_SwapRB(const u16 *__restrict src, u8 *__restrict dst, size_t pixCount) const
{
return ColorspaceConvertBuffer555XTo888_AltiVec<true>(src, dst, pixCount);
}
size_t ColorspaceHandler_AltiVec::ConvertBuffer888XTo888(const u32 *__restrict src, u8 *__restrict dst, size_t pixCount) const
{
return ColorspaceConvertBuffer888XTo888_AltiVec<false>(src, dst, pixCount);
}
size_t ColorspaceHandler_AltiVec::ConvertBuffer888XTo888_SwapRB(const u32 *__restrict src, u8 *__restrict dst, size_t pixCount) const
{
return ColorspaceConvertBuffer888XTo888_AltiVec<true>(src, dst, pixCount);
}
size_t ColorspaceHandler_AltiVec::CopyBuffer16_SwapRB(const u16 *src, u16 *dst, size_t pixCount) const
{
return ColorspaceCopyBuffer16_AltiVec<true>(src, dst, pixCount);
}
size_t ColorspaceHandler_AltiVec::CopyBuffer32_SwapRB(const u32 *src, u32 *dst, size_t pixCount) const
{
return ColorspaceCopyBuffer32_AltiVec<true>(src, dst, pixCount);
}
template void ColorspaceConvert555To8888_AltiVec<true, BESwapNone>(const v128u16 &srcColor, const v128u16 &srcAlphaBits, v128u32 &dstLo, v128u32 &dstHi);
template void ColorspaceConvert555To8888_AltiVec<false, BESwapNone>(const v128u16 &srcColor, const v128u16 &srcAlphaBits, v128u32 &dstLo, v128u32 &dstHi);
template void ColorspaceConvert555To8888_AltiVec<true, BESwapSrc>(const v128u16 &srcColor, const v128u16 &srcAlphaBits, v128u32 &dstLo, v128u32 &dstHi);
template void ColorspaceConvert555To8888_AltiVec<false, BESwapSrc>(const v128u16 &srcColor, const v128u16 &srcAlphaBits, v128u32 &dstLo, v128u32 &dstHi);
template void ColorspaceConvert555To8888_AltiVec<true, BESwapDst>(const v128u16 &srcColor, const v128u16 &srcAlphaBits, v128u32 &dstLo, v128u32 &dstHi);
template void ColorspaceConvert555To8888_AltiVec<false, BESwapDst>(const v128u16 &srcColor, const v128u16 &srcAlphaBits, v128u32 &dstLo, v128u32 &dstHi);
template void ColorspaceConvert555To8888_AltiVec<true, BESwapSrcDst>(const v128u16 &srcColor, const v128u16 &srcAlphaBits, v128u32 &dstLo, v128u32 &dstHi);
template void ColorspaceConvert555To8888_AltiVec<false, BESwapSrcDst>(const v128u16 &srcColor, const v128u16 &srcAlphaBits, v128u32 &dstLo, v128u32 &dstHi);
template void ColorspaceConvert555XTo888X_AltiVec<true, BESwapNone>(const v128u16 &srcColor, v128u32 &dstLo, v128u32 &dstHi);
template void ColorspaceConvert555XTo888X_AltiVec<false, BESwapNone>(const v128u16 &srcColor, v128u32 &dstLo, v128u32 &dstHi);
template void ColorspaceConvert555XTo888X_AltiVec<true, BESwapSrc>(const v128u16 &srcColor, v128u32 &dstLo, v128u32 &dstHi);
template void ColorspaceConvert555XTo888X_AltiVec<false, BESwapSrc>(const v128u16 &srcColor, v128u32 &dstLo, v128u32 &dstHi);
template void ColorspaceConvert555XTo888X_AltiVec<true, BESwapDst>(const v128u16 &srcColor, v128u32 &dstLo, v128u32 &dstHi);
template void ColorspaceConvert555XTo888X_AltiVec<false, BESwapDst>(const v128u16 &srcColor, v128u32 &dstLo, v128u32 &dstHi);
template void ColorspaceConvert555XTo888X_AltiVec<true, BESwapSrcDst>(const v128u16 &srcColor, v128u32 &dstLo, v128u32 &dstHi);
template void ColorspaceConvert555XTo888X_AltiVec<false, BESwapSrcDst>(const v128u16 &srcColor, v128u32 &dstLo, v128u32 &dstHi);
template void ColorspaceConvert555To6665_AltiVec<true, BESwapNone>(const v128u16 &srcColor, const v128u16 &srcAlphaBits, v128u32 &dstLo, v128u32 &dstHi);
template void ColorspaceConvert555To6665_AltiVec<false, BESwapNone>(const v128u16 &srcColor, const v128u16 &srcAlphaBits, v128u32 &dstLo, v128u32 &dstHi);
template void ColorspaceConvert555To6665_AltiVec<true, BESwapSrc>(const v128u16 &srcColor, const v128u16 &srcAlphaBits, v128u32 &dstLo, v128u32 &dstHi);
template void ColorspaceConvert555To6665_AltiVec<false, BESwapSrc>(const v128u16 &srcColor, const v128u16 &srcAlphaBits, v128u32 &dstLo, v128u32 &dstHi);
template void ColorspaceConvert555To6665_AltiVec<true, BESwapDst>(const v128u16 &srcColor, const v128u16 &srcAlphaBits, v128u32 &dstLo, v128u32 &dstHi);
template void ColorspaceConvert555To6665_AltiVec<false, BESwapDst>(const v128u16 &srcColor, const v128u16 &srcAlphaBits, v128u32 &dstLo, v128u32 &dstHi);
template void ColorspaceConvert555To6665_AltiVec<true, BESwapSrcDst>(const v128u16 &srcColor, const v128u16 &srcAlphaBits, v128u32 &dstLo, v128u32 &dstHi);
template void ColorspaceConvert555To6665_AltiVec<false, BESwapSrcDst>(const v128u16 &srcColor, const v128u16 &srcAlphaBits, v128u32 &dstLo, v128u32 &dstHi);
template void ColorspaceConvert555XTo666X_AltiVec<true, BESwapNone>(const v128u16 &srcColor, v128u32 &dstLo, v128u32 &dstHi);
template void ColorspaceConvert555XTo666X_AltiVec<false, BESwapNone>(const v128u16 &srcColor, v128u32 &dstLo, v128u32 &dstHi);
template void ColorspaceConvert555XTo666X_AltiVec<true, BESwapSrc>(const v128u16 &srcColor, v128u32 &dstLo, v128u32 &dstHi);
template void ColorspaceConvert555XTo666X_AltiVec<false, BESwapSrc>(const v128u16 &srcColor, v128u32 &dstLo, v128u32 &dstHi);
template void ColorspaceConvert555XTo666X_AltiVec<true, BESwapDst>(const v128u16 &srcColor, v128u32 &dstLo, v128u32 &dstHi);
template void ColorspaceConvert555XTo666X_AltiVec<false, BESwapDst>(const v128u16 &srcColor, v128u32 &dstLo, v128u32 &dstHi);
template void ColorspaceConvert555XTo666X_AltiVec<true, BESwapSrcDst>(const v128u16 &srcColor, v128u32 &dstLo, v128u32 &dstHi);
template void ColorspaceConvert555XTo666X_AltiVec<false, BESwapSrcDst>(const v128u16 &srcColor, v128u32 &dstLo, v128u32 &dstHi);
template void ColorspaceConvert555To8888Opaque_AltiVec<true, BESwapNone>(const v128u16 &srcColor, v128u32 &dstLo, v128u32 &dstHi);
template void ColorspaceConvert555To8888Opaque_AltiVec<false, BESwapNone>(const v128u16 &srcColor, v128u32 &dstLo, v128u32 &dstHi);
template void ColorspaceConvert555To8888Opaque_AltiVec<true, BESwapSrc>(const v128u16 &srcColor, v128u32 &dstLo, v128u32 &dstHi);
template void ColorspaceConvert555To8888Opaque_AltiVec<false, BESwapSrc>(const v128u16 &srcColor, v128u32 &dstLo, v128u32 &dstHi);
template void ColorspaceConvert555To8888Opaque_AltiVec<true, BESwapDst>(const v128u16 &srcColor, v128u32 &dstLo, v128u32 &dstHi);
template void ColorspaceConvert555To8888Opaque_AltiVec<false, BESwapDst>(const v128u16 &srcColor, v128u32 &dstLo, v128u32 &dstHi);
template void ColorspaceConvert555To8888Opaque_AltiVec<true, BESwapSrcDst>(const v128u16 &srcColor, v128u32 &dstLo, v128u32 &dstHi);
template void ColorspaceConvert555To8888Opaque_AltiVec<false, BESwapSrcDst>(const v128u16 &srcColor, v128u32 &dstLo, v128u32 &dstHi);
template void ColorspaceConvert555To6665Opaque_AltiVec<true, BESwapNone>(const v128u16 &srcColor, v128u32 &dstLo, v128u32 &dstHi);
template void ColorspaceConvert555To6665Opaque_AltiVec<false, BESwapNone>(const v128u16 &srcColor, v128u32 &dstLo, v128u32 &dstHi);
template void ColorspaceConvert555To6665Opaque_AltiVec<true, BESwapSrc>(const v128u16 &srcColor, v128u32 &dstLo, v128u32 &dstHi);
template void ColorspaceConvert555To6665Opaque_AltiVec<false, BESwapSrc>(const v128u16 &srcColor, v128u32 &dstLo, v128u32 &dstHi);
template void ColorspaceConvert555To6665Opaque_AltiVec<true, BESwapDst>(const v128u16 &srcColor, v128u32 &dstLo, v128u32 &dstHi);
template void ColorspaceConvert555To6665Opaque_AltiVec<false, BESwapDst>(const v128u16 &srcColor, v128u32 &dstLo, v128u32 &dstHi);
template void ColorspaceConvert555To6665Opaque_AltiVec<true, BESwapSrcDst>(const v128u16 &srcColor, v128u32 &dstLo, v128u32 &dstHi);
template void ColorspaceConvert555To6665Opaque_AltiVec<false, BESwapSrcDst>(const v128u16 &srcColor, v128u32 &dstLo, v128u32 &dstHi);
template v128u32 ColorspaceConvert8888To6665_AltiVec<true>(const v128u32 &src);
template v128u32 ColorspaceConvert8888To6665_AltiVec<false>(const v128u32 &src);
template v128u32 ColorspaceConvert6665To8888_AltiVec<true>(const v128u32 &src);
template v128u32 ColorspaceConvert6665To8888_AltiVec<false>(const v128u32 &src);
template v128u16 ColorspaceConvert8888To5551_AltiVec<true>(const v128u32 &srcLo, const v128u32 &srcHi);
template v128u16 ColorspaceConvert8888To5551_AltiVec<false>(const v128u32 &srcLo, const v128u32 &srcHi);
template v128u16 ColorspaceConvert6665To5551_AltiVec<true>(const v128u32 &srcLo, const v128u32 &srcHi);
template v128u16 ColorspaceConvert6665To5551_AltiVec<false>(const v128u32 &srcLo, const v128u32 &srcHi);
template v128u32 ColorspaceConvert888XTo8888Opaque_AltiVec<true>(const v128u32 &src);
template v128u32 ColorspaceConvert888XTo8888Opaque_AltiVec<false>(const v128u32 &src);
template v128u16 ColorspaceCopy16_AltiVec<true>(const v128u16 &src);
template v128u16 ColorspaceCopy16_AltiVec<false>(const v128u16 &src);
template v128u32 ColorspaceCopy32_AltiVec<true>(const v128u32 &src);
template v128u32 ColorspaceCopy32_AltiVec<false>(const v128u32 &src);
#endif // ENABLE_ALTIVEC

View File

@ -0,0 +1,83 @@
/*
Copyright (C) 2016-2021 DeSmuME team
This file is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 2 of the License, or
(at your option) any later version.
This file is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with the this software. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef COLORSPACEHANDLER_ALTIVEC_H
#define COLORSPACEHANDLER_ALTIVEC_H
#include "colorspacehandler.h"
#ifndef ENABLE_ALTIVEC
#warning This header requires PowerPC AltiVec support.
#else
template<bool SWAP_RB, BESwapFlags BE_BYTESWAP> void ColorspaceConvert555To8888_AltiVec(const v128u16 &srcColor, const v128u16 &srcAlphaBits, v128u32 &dstLo, v128u32 &dstHi);
template<bool SWAP_RB, BESwapFlags BE_BYTESWAP> void ColorspaceConvert555XTo888X_AltiVec(const v128u16 &srcColor, v128u32 &dstLo, v128u32 &dstHi);
template<bool SWAP_RB, BESwapFlags BE_BYTESWAP> void ColorspaceConvert555To6665_AltiVec(const v128u16 &srcColor, const v128u16 &srcAlphaBits, v128u32 &dstLo, v128u32 &dstHi);
template<bool SWAP_RB, BESwapFlags BE_BYTESWAP> void ColorspaceConvert555XTo666X_AltiVec(const v128u16 &srcColor, v128u32 &dstLo, v128u32 &dstHi);
template<bool SWAP_RB, BESwapFlags BE_BYTESWAP> void ColorspaceConvert555To8888Opaque_AltiVec(const v128u16 &srcColor, v128u32 &dstLo, v128u32 &dstHi);
template<bool SWAP_RB, BESwapFlags BE_BYTESWAP> void ColorspaceConvert555To6665Opaque_AltiVec(const v128u16 &srcColor, v128u32 &dstLo, v128u32 &dstHi);
template<bool SWAP_RB> v128u32 ColorspaceConvert8888To6665_AltiVec(const v128u32 &src);
template<bool SWAP_RB> v128u32 ColorspaceConvert6665To8888_AltiVec(const v128u32 &src);
template<bool SWAP_RB> v128u16 ColorspaceConvert8888To5551_AltiVec(const v128u32 &srcLo, const v128u32 &srcHi);
template<bool SWAP_RB> v128u16 ColorspaceConvert6665To5551_AltiVec(const v128u32 &srcLo, const v128u32 &srcHi);
template<bool SWAP_RB> v128u32 ColorspaceConvert888XTo8888Opaque_AltiVec(const v128u32 &src);
template<bool SWAP_RB> v128u16 ColorspaceCopy16_AltiVec(const v128u16 &src);
template<bool SWAP_RB> v128u32 ColorspaceCopy32_AltiVec(const v128u32 &src);
// AltiVec has very poor support for dealing with unaligned addresses (it's possible, just
// very obtuse), so we're not even going to bother dealing with any unaligned addresses.
class ColorspaceHandler_AltiVec : public ColorspaceHandler
{
public:
ColorspaceHandler_AltiVec() {};
template<BESwapFlags BE_BYTESWAP> size_t ConvertBuffer555To8888Opaque(const u16 *__restrict src, u32 *__restrict dst, size_t pixCount) const;
template<BESwapFlags BE_BYTESWAP> size_t ConvertBuffer555To8888Opaque_SwapRB(const u16 *__restrict src, u32 *__restrict dst, size_t pixCount) const;
template<BESwapFlags BE_BYTESWAP> size_t ConvertBuffer555To6665Opaque(const u16 *__restrict src, u32 *__restrict dst, size_t pixCount) const;
template<BESwapFlags BE_BYTESWAP> size_t ConvertBuffer555To6665Opaque_SwapRB(const u16 *__restrict src, u32 *__restrict dst, size_t pixCount) const;
size_t ConvertBuffer8888To6665(const u32 *src, u32 *dst, size_t pixCount) const;
size_t ConvertBuffer8888To6665_SwapRB(const u32 *src, u32 *dst, size_t pixCount) const;
size_t ConvertBuffer6665To8888(const u32 *src, u32 *dst, size_t pixCount) const;
size_t ConvertBuffer6665To8888_SwapRB(const u32 *src, u32 *dst, size_t pixCount) const;
size_t ConvertBuffer8888To5551(const u32 *__restrict src, u16 *__restrict dst, size_t pixCount) const;
size_t ConvertBuffer8888To5551_SwapRB(const u32 *__restrict src, u16 *__restrict dst, size_t pixCount) const;
size_t ConvertBuffer6665To5551(const u32 *__restrict src, u16 *__restrict dst, size_t pixCount) const;
size_t ConvertBuffer6665To5551_SwapRB(const u32 *__restrict src, u16 *__restrict dst, size_t pixCount) const;
size_t ConvertBuffer888XTo8888Opaque(const u32 *src, u32 *dst, size_t pixCount) const;
size_t ConvertBuffer888XTo8888Opaque_SwapRB(const u32 *src, u32 *dst, size_t pixCount) const;
size_t ConvertBuffer555XTo888(const u16 *__restrict src, u8 *__restrict dst, size_t pixCount) const;
size_t ConvertBuffer555XTo888_SwapRB(const u16 *__restrict src, u8 *__restrict dst, size_t pixCount) const;
size_t ConvertBuffer888XTo888(const u32 *__restrict src, u8 *__restrict dst, size_t pixCount) const;
size_t ConvertBuffer888XTo888_SwapRB(const u32 *__restrict src, u8 *__restrict dst, size_t pixCount) const;
size_t CopyBuffer16_SwapRB(const u16 *src, u16 *dst, size_t pixCount) const;
size_t CopyBuffer32_SwapRB(const u32 *src, u32 *dst, size_t pixCount) const;
};
#endif // ENABLE_ALTIVEC
#endif /* COLORSPACEHANDLER_ALTIVEC_H */

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,114 @@
/*
Copyright (C) 2016-2022 DeSmuME team
This file is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 2 of the License, or
(at your option) any later version.
This file is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with the this software. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef COLORSPACEHANDLER_NEON_H
#define COLORSPACEHANDLER_NEON_H
#include "colorspacehandler.h"
#ifndef ENABLE_NEON_A64
#warning This header requires ARM64 NEON support.
#else
template<bool SWAP_RB> void ColorspaceConvert555To8888_NEON(const v128u16 &srcColor, const v128u16 &srcAlphaBits, v128u32 &dstLo, v128u32 &dstHi);
template<bool SWAP_RB> void ColorspaceConvert555XTo888X_NEON(const v128u16 &srcColor, v128u32 &dstLo, v128u32 &dstHi);
template<bool SWAP_RB> void ColorspaceConvert555To6665_NEON(const v128u16 &srcColor, const v128u16 &srcAlphaBits, v128u32 &dstLo, v128u32 &dstHi);
template<bool SWAP_RB> void ColorspaceConvert555XTo666X_NEON(const v128u16 &srcColor, v128u32 &dstLo, v128u32 &dstHi);
template<bool SWAP_RB> void ColorspaceConvert555To8888Opaque_NEON(const v128u16 &srcColor, v128u32 &dstLo, v128u32 &dstHi);
template<bool SWAP_RB> void ColorspaceConvert555To6665Opaque_NEON(const v128u16 &srcColor, v128u32 &dstLo, v128u32 &dstHi);
template<bool SWAP_RB> v128u32 ColorspaceConvert8888To6665_NEON(const v128u32 &src);
template<bool SWAP_RB> v128u32 ColorspaceConvert6665To8888_NEON(const v128u32 &src);
template<bool SWAP_RB> v128u16 ColorspaceConvert8888To5551_NEON(const v128u32 &srcLo, const v128u32 &srcHi);
template<bool SWAP_RB> v128u16 ColorspaceConvert6665To5551_NEON(const v128u32 &srcLo, const v128u32 &srcHi);
template<bool SWAP_RB> v128u32 C6olorspaceConvert888XTo8888Opaque_NEON(const v128u32 &src);
template<bool SWAP_RB> v128u16 ColorspaceCopy16_NEON(const v128u16 &src);
template<bool SWAP_RB> v128u32 ColorspaceCopy32_NEON(const v128u32 &src);
template<bool SWAP_RB> v128u16 ColorspaceApplyIntensity16_NEON(const v128u16 &src, float intensity);
template<bool SWAP_RB> v128u32 ColorspaceApplyIntensity32_NEON(const v128u32 &src, float intensity);
class ColorspaceHandler_NEON : public ColorspaceHandler
{
public:
ColorspaceHandler_NEON() {};
template<BESwapFlags BE_BYTESWAP> size_t ConvertBuffer555To8888Opaque(const u16 *__restrict src, u32 *__restrict dst, size_t pixCount) const;
template<BESwapFlags BE_BYTESWAP> size_t ConvertBuffer555To8888Opaque_SwapRB(const u16 *__restrict src, u32 *__restrict dst, size_t pixCount) const;
template<BESwapFlags BE_BYTESWAP> size_t ConvertBuffer555To8888Opaque_IsUnaligned(const u16 *__restrict src, u32 *__restrict dst, size_t pixCount) const;
template<BESwapFlags BE_BYTESWAP> size_t ConvertBuffer555To8888Opaque_SwapRB_IsUnaligned(const u16 *__restrict src, u32 *__restrict dst, size_t pixCount) const;
template<BESwapFlags BE_BYTESWAP> size_t ConvertBuffer555To6665Opaque(const u16 *__restrict src, u32 *__restrict dst, size_t pixCount) const;
template<BESwapFlags BE_BYTESWAP> size_t ConvertBuffer555To6665Opaque_SwapRB(const u16 *__restrict src, u32 *__restrict dst, size_t pixCount) const;
template<BESwapFlags BE_BYTESWAP> size_t ConvertBuffer555To6665Opaque_IsUnaligned(const u16 *__restrict src, u32 *__restrict dst, size_t pixCount) const;
template<BESwapFlags BE_BYTESWAP> size_t ConvertBuffer555To6665Opaque_SwapRB_IsUnaligned(const u16 *__restrict src, u32 *__restrict dst, size_t pixCount) const;
size_t ConvertBuffer8888To6665(const u32 *src, u32 *dst, size_t pixCount) const;
size_t ConvertBuffer8888To6665_SwapRB(const u32 *src, u32 *dst, size_t pixCount) const;
size_t ConvertBuffer8888To6665_IsUnaligned(const u32 *src, u32 *dst, size_t pixCount) const;
size_t ConvertBuffer8888To6665_SwapRB_IsUnaligned(const u32 *src, u32 *dst, size_t pixCount) const;
size_t ConvertBuffer6665To8888(const u32 *src, u32 *dst, size_t pixCount) const;
size_t ConvertBuffer6665To8888_SwapRB(const u32 *src, u32 *dst, size_t pixCount) const;
size_t ConvertBuffer6665To8888_IsUnaligned(const u32 *src, u32 *dst, size_t pixCount) const;
size_t ConvertBuffer6665To8888_SwapRB_IsUnaligned(const u32 *src, u32 *dst, size_t pixCount) const;
size_t ConvertBuffer8888To5551(const u32 *__restrict src, u16 *__restrict dst, size_t pixCount) const;
size_t ConvertBuffer8888To5551_SwapRB(const u32 *__restrict src, u16 *__restrict dst, size_t pixCount) const;
size_t ConvertBuffer8888To5551_IsUnaligned(const u32 *__restrict src, u16 *__restrict dst, size_t pixCount) const;
size_t ConvertBuffer8888To5551_SwapRB_IsUnaligned(const u32 *__restrict src, u16 *__restrict dst, size_t pixCount) const;
size_t ConvertBuffer6665To5551(const u32 *__restrict src, u16 *__restrict dst, size_t pixCount) const;
size_t ConvertBuffer6665To5551_SwapRB(const u32 *__restrict src, u16 *__restrict dst, size_t pixCount) const;
size_t ConvertBuffer6665To5551_IsUnaligned(const u32 *__restrict src, u16 *__restrict dst, size_t pixCount) const;
size_t ConvertBuffer6665To5551_SwapRB_IsUnaligned(const u32 *__restrict src, u16 *__restrict dst, size_t pixCount) const;
size_t ConvertBuffer888XTo8888Opaque(const u32 *src, u32 *dst, size_t pixCount) const;
size_t ConvertBuffer888XTo8888Opaque_SwapRB(const u32 *src, u32 *dst, size_t pixCount) const;
size_t ConvertBuffer888XTo8888Opaque_IsUnaligned(const u32 *src, u32 *dst, size_t pixCount) const;
size_t ConvertBuffer888XTo8888Opaque_SwapRB_IsUnaligned(const u32 *src, u32 *dst, size_t pixCount) const;
size_t ConvertBuffer555XTo888(const u16 *__restrict src, u8 *__restrict dst, size_t pixCount) const;
size_t ConvertBuffer555XTo888_SwapRB(const u16 *__restrict src, u8 *__restrict dst, size_t pixCount) const;
size_t ConvertBuffer555XTo888_IsUnaligned(const u16 *__restrict src, u8 *__restrict dst, size_t pixCount) const;
size_t ConvertBuffer555XTo888_SwapRB_IsUnaligned(const u16 *__restrict src, u8 *__restrict dst, size_t pixCount) const;
size_t ConvertBuffer888XTo888(const u32 *__restrict src, u8 *__restrict dst, size_t pixCount) const;
size_t ConvertBuffer888XTo888_SwapRB(const u32 *__restrict src, u8 *__restrict dst, size_t pixCount) const;
size_t ConvertBuffer888XTo888_IsUnaligned(const u32 *__restrict src, u8 *__restrict dst, size_t pixCount) const;
size_t ConvertBuffer888XTo888_SwapRB_IsUnaligned(const u32 *__restrict src, u8 *__restrict dst, size_t pixCount) const;
size_t CopyBuffer16_SwapRB(const u16 *src, u16 *dst, size_t pixCount) const;
size_t CopyBuffer16_SwapRB_IsUnaligned(const u16 *src, u16 *dst, size_t pixCount) const;
size_t CopyBuffer32_SwapRB(const u32 *src, u32 *dst, size_t pixCount) const;
size_t CopyBuffer32_SwapRB_IsUnaligned(const u32 *src, u32 *dst, size_t pixCount) const;
size_t ApplyIntensityToBuffer16(u16 *dst, size_t pixCount, float intensity) const;
size_t ApplyIntensityToBuffer16_SwapRB(u16 *dst, size_t pixCount, float intensity) const;
size_t ApplyIntensityToBuffer16_IsUnaligned(u16 *dst, size_t pixCount, float intensity) const;
size_t ApplyIntensityToBuffer16_SwapRB_IsUnaligned(u16 *dst, size_t pixCount, float intensity) const;
size_t ApplyIntensityToBuffer32(u32 *dst, size_t pixCount, float intensity) const;
size_t ApplyIntensityToBuffer32_SwapRB(u32 *dst, size_t pixCount, float intensity) const;
size_t ApplyIntensityToBuffer32_IsUnaligned(u32 *dst, size_t pixCount, float intensity) const;
size_t ApplyIntensityToBuffer32_SwapRB_IsUnaligned(u32 *dst, size_t pixCount, float intensity) const;
};
#endif // ENABLE_NEON_A64
#endif // COLORSPACEHANDLER_NEON_H

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,116 @@
/*
Copyright (C) 2016-2021 DeSmuME team
This file is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 2 of the License, or
(at your option) any later version.
This file is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with the this software. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef COLORSPACEHANDLER_SSE2_H
#define COLORSPACEHANDLER_SSE2_H
#include "colorspacehandler.h"
#ifndef ENABLE_SSE2
#warning This header requires SSE2 support.
#else
template<bool SWAP_RB> void ColorspaceConvert555To8888_SSE2(const v128u16 &srcColor, const v128u16 &srcAlphaBits, v128u32 &dstLo, v128u32 &dstHi);
template<bool SWAP_RB> void ColorspaceConvert555XTo888X_SSE2(const v128u16 &srcColor, v128u32 &dstLo, v128u32 &dstHi);
template<bool SWAP_RB> void ColorspaceConvert555To6665_SSE2(const v128u16 &srcColor, const v128u16 &srcAlphaBits, v128u32 &dstLo, v128u32 &dstHi);
template<bool SWAP_RB> void ColorspaceConvert555XTo666X_SSE2(const v128u16 &srcColor, v128u32 &dstLo, v128u32 &dstHi);
template<bool SWAP_RB> void ColorspaceConvert555To8888Opaque_SSE2(const v128u16 &srcColor, v128u32 &dstLo, v128u32 &dstHi);
template<bool SWAP_RB> void ColorspaceConvert555To6665Opaque_SSE2(const v128u16 &srcColor, v128u32 &dstLo, v128u32 &dstHi);
template<bool SWAP_RB> v128u32 ColorspaceConvert8888To6665_SSE2(const v128u32 &src);
template<bool SWAP_RB> v128u32 ColorspaceConvert6665To8888_SSE2(const v128u32 &src);
template<bool SWAP_RB> v128u16 ColorspaceConvert8888To5551_SSE2(const v128u32 &srcLo, const v128u32 &srcHi);
template<bool SWAP_RB> v128u16 ColorspaceConvert6665To5551_SSE2(const v128u32 &srcLo, const v128u32 &srcHi);
template<bool SWAP_RB> v128u32 ColorspaceConvert888XTo8888Opaque_SSE2(const v128u32 &src);
template<bool SWAP_RB> v128u16 ColorspaceCopy16_SSE2(const v128u16 &src);
template<bool SWAP_RB> v128u32 ColorspaceCopy32_SSE2(const v128u32 &src);
template<bool SWAP_RB> v128u16 ColorspaceApplyIntensity16_SSE2(const v128u16 &src, float intensity);
template<bool SWAP_RB> v128u32 ColorspaceApplyIntensity32_SSE2(const v128u32 &src, float intensity);
class ColorspaceHandler_SSE2 : public ColorspaceHandler
{
public:
ColorspaceHandler_SSE2() {};
template<BESwapFlags BE_BYTESWAP> size_t ConvertBuffer555To8888Opaque(const u16 *__restrict src, u32 *__restrict dst, size_t pixCount) const;
template<BESwapFlags BE_BYTESWAP> size_t ConvertBuffer555To8888Opaque_SwapRB(const u16 *__restrict src, u32 *__restrict dst, size_t pixCount) const;
template<BESwapFlags BE_BYTESWAP> size_t ConvertBuffer555To8888Opaque_IsUnaligned(const u16 *__restrict src, u32 *__restrict dst, size_t pixCount) const;
template<BESwapFlags BE_BYTESWAP> size_t ConvertBuffer555To8888Opaque_SwapRB_IsUnaligned(const u16 *__restrict src, u32 *__restrict dst, size_t pixCount) const;
template<BESwapFlags BE_BYTESWAP> size_t ConvertBuffer555To6665Opaque(const u16 *__restrict src, u32 *__restrict dst, size_t pixCount) const;
template<BESwapFlags BE_BYTESWAP> size_t ConvertBuffer555To6665Opaque_SwapRB(const u16 *__restrict src, u32 *__restrict dst, size_t pixCount) const;
template<BESwapFlags BE_BYTESWAP> size_t ConvertBuffer555To6665Opaque_IsUnaligned(const u16 *__restrict src, u32 *__restrict dst, size_t pixCount) const;
template<BESwapFlags BE_BYTESWAP> size_t ConvertBuffer555To6665Opaque_SwapRB_IsUnaligned(const u16 *__restrict src, u32 *__restrict dst, size_t pixCount) const;
size_t ConvertBuffer8888To6665(const u32 *src, u32 *dst, size_t pixCount) const;
size_t ConvertBuffer8888To6665_SwapRB(const u32 *src, u32 *dst, size_t pixCount) const;
size_t ConvertBuffer8888To6665_IsUnaligned(const u32 *src, u32 *dst, size_t pixCount) const;
size_t ConvertBuffer8888To6665_SwapRB_IsUnaligned(const u32 *src, u32 *dst, size_t pixCount) const;
size_t ConvertBuffer6665To8888(const u32 *src, u32 *dst, size_t pixCount) const;
size_t ConvertBuffer6665To8888_SwapRB(const u32 *src, u32 *dst, size_t pixCount) const;
size_t ConvertBuffer6665To8888_IsUnaligned(const u32 *src, u32 *dst, size_t pixCount) const;
size_t ConvertBuffer6665To8888_SwapRB_IsUnaligned(const u32 *src, u32 *dst, size_t pixCount) const;
size_t ConvertBuffer8888To5551(const u32 *__restrict src, u16 *__restrict dst, size_t pixCount) const;
size_t ConvertBuffer8888To5551_SwapRB(const u32 *__restrict src, u16 *__restrict dst, size_t pixCount) const;
size_t ConvertBuffer8888To5551_IsUnaligned(const u32 *__restrict src, u16 *__restrict dst, size_t pixCount) const;
size_t ConvertBuffer8888To5551_SwapRB_IsUnaligned(const u32 *__restrict src, u16 *__restrict dst, size_t pixCount) const;
size_t ConvertBuffer6665To5551(const u32 *__restrict src, u16 *__restrict dst, size_t pixCount) const;
size_t ConvertBuffer6665To5551_SwapRB(const u32 *__restrict src, u16 *__restrict dst, size_t pixCount) const;
size_t ConvertBuffer6665To5551_IsUnaligned(const u32 *__restrict src, u16 *__restrict dst, size_t pixCount) const;
size_t ConvertBuffer6665To5551_SwapRB_IsUnaligned(const u32 *__restrict src, u16 *__restrict dst, size_t pixCount) const;
size_t ConvertBuffer888XTo8888Opaque(const u32 *src, u32 *dst, size_t pixCount) const;
size_t ConvertBuffer888XTo8888Opaque_SwapRB(const u32 *src, u32 *dst, size_t pixCount) const;
size_t ConvertBuffer888XTo8888Opaque_IsUnaligned(const u32 *src, u32 *dst, size_t pixCount) const;
size_t ConvertBuffer888XTo8888Opaque_SwapRB_IsUnaligned(const u32 *src, u32 *dst, size_t pixCount) const;
#ifdef ENABLE_SSSE3
size_t ConvertBuffer555XTo888(const u16 *__restrict src, u8 *__restrict dst, size_t pixCount) const;
size_t ConvertBuffer555XTo888_SwapRB(const u16 *__restrict src, u8 *__restrict dst, size_t pixCount) const;
size_t ConvertBuffer555XTo888_IsUnaligned(const u16 *__restrict src, u8 *__restrict dst, size_t pixCount) const;
size_t ConvertBuffer555XTo888_SwapRB_IsUnaligned(const u16 *__restrict src, u8 *__restrict dst, size_t pixCount) const;
size_t ConvertBuffer888XTo888(const u32 *__restrict src, u8 *__restrict dst, size_t pixCount) const;
size_t ConvertBuffer888XTo888_SwapRB(const u32 *__restrict src, u8 *__restrict dst, size_t pixCount) const;
size_t ConvertBuffer888XTo888_IsUnaligned(const u32 *__restrict src, u8 *__restrict dst, size_t pixCount) const;
size_t ConvertBuffer888XTo888_SwapRB_IsUnaligned(const u32 *__restrict src, u8 *__restrict dst, size_t pixCount) const;
#endif
size_t CopyBuffer16_SwapRB(const u16 *src, u16 *dst, size_t pixCount) const;
size_t CopyBuffer16_SwapRB_IsUnaligned(const u16 *src, u16 *dst, size_t pixCount) const;
size_t CopyBuffer32_SwapRB(const u32 *src, u32 *dst, size_t pixCount) const;
size_t CopyBuffer32_SwapRB_IsUnaligned(const u32 *src, u32 *dst, size_t pixCount) const;
size_t ApplyIntensityToBuffer16(u16 *dst, size_t pixCount, float intensity) const;
size_t ApplyIntensityToBuffer16_SwapRB(u16 *dst, size_t pixCount, float intensity) const;
size_t ApplyIntensityToBuffer16_IsUnaligned(u16 *dst, size_t pixCount, float intensity) const;
size_t ApplyIntensityToBuffer16_SwapRB_IsUnaligned(u16 *dst, size_t pixCount, float intensity) const;
size_t ApplyIntensityToBuffer32(u32 *dst, size_t pixCount, float intensity) const;
size_t ApplyIntensityToBuffer32_SwapRB(u32 *dst, size_t pixCount, float intensity) const;
size_t ApplyIntensityToBuffer32_IsUnaligned(u32 *dst, size_t pixCount, float intensity) const;
size_t ApplyIntensityToBuffer32_SwapRB_IsUnaligned(u32 *dst, size_t pixCount, float intensity) const;
};
#endif // ENABLE_SSE2
#endif /* COLORSPACEHANDLER_SSE2_H */

View File

@ -0,0 +1,39 @@
/* Copyright (C) 2010-2016 The RetroArch team
*
* ---------------------------------------------------------------------------------------
* The following license statement only applies to this file (retro_inline.h).
* ---------------------------------------------------------------------------------------
*
* Permission is hereby granted, free of charge,
* to any person obtaining a copy of this software and associated documentation files (the "Software"),
* to deal in the Software without restriction, including without limitation the rights to
* use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software,
* and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
* INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
* WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
#ifndef __LIBRETRO_SDK_INLINE_H
#define __LIBRETRO_SDK_INLINE_H
#ifndef INLINE
#if defined(_WIN32) || defined(__INTEL_COMPILER)
#define INLINE __inline
#elif defined(__STDC_VERSION__) && __STDC_VERSION__>=199901L
#define INLINE inline
#elif defined(__GNUC__)
#define INLINE __inline__
#else
#define INLINE
#endif
#endif
#endif

View File

@ -0,0 +1,194 @@
/* Copyright (C) 2010-2016 The RetroArch team
*
* ---------------------------------------------------------------------------------------
* The following license statement only applies to this file (retro_miscellaneous.h).
* ---------------------------------------------------------------------------------------
*
* Permission is hereby granted, free of charge,
* to any person obtaining a copy of this software and associated documentation files (the "Software"),
* to deal in the Software without restriction, including without limitation the rights to
* use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software,
* and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
* INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
* WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
#ifndef __RARCH_MISCELLANEOUS_H
#define __RARCH_MISCELLANEOUS_H
#include <stdint.h>
#include <math.h>
#if defined(__CELLOS_LV2__) && !defined(__PSL1GHT__)
#include <sys/timer.h>
#elif defined(XENON)
#include <time/time.h>
#elif defined(GEKKO) || defined(__PSL1GHT__) || defined(__QNX__)
#include <unistd.h>
#elif defined(PSP)
#include <pspthreadman.h>
#elif defined(VITA)
#include <psp2/kernel/threadmgr.h>
#elif defined(_3DS)
#include <3ds.h>
#else
#include <time.h>
#endif
#if defined(_WIN32) && !defined(_XBOX)
#define WIN32_LEAN_AND_MEAN
#include <windows.h>
#elif defined(_WIN32) && defined(_XBOX)
#include <Xtl.h>
#endif
#include <limits.h>
#include <math.h>
#ifdef _MSC_VER
#include <compat/msvc.h>
#endif
#include "retro_inline.h"
#ifndef PATH_MAX_LENGTH
#if defined(_XBOX1) || defined(_3DS) || defined(PSP) || defined(GEKKO)
#define PATH_MAX_LENGTH 512
#else
#define PATH_MAX_LENGTH 4096
#endif
#endif
#ifndef M_PI
#define M_PI 3.14159265358979323846264338327
#endif
#ifndef MAX
#define MAX(a, b) ((a) > (b) ? (a) : (b))
#endif
#ifndef MIN
#define MIN(a, b) ((a) < (b) ? (a) : (b))
#endif
#define ARRAY_SIZE(a) (sizeof(a) / sizeof((a)[0]))
#define RARCH_SCALE_BASE 256
/**
* retro_sleep:
* @msec : amount in milliseconds to sleep
*
* Sleeps for a specified amount of milliseconds (@msec).
**/
static INLINE void retro_sleep(unsigned msec)
{
#if defined(__CELLOS_LV2__) && !defined(__PSL1GHT__)
sys_timer_usleep(1000 * msec);
#elif defined(PSP) || defined(VITA)
sceKernelDelayThread(1000 * msec);
#elif defined(_3DS)
svcSleepThread(1000000 * (s64)msec);
#elif defined(_WIN32)
Sleep(msec);
#elif defined(XENON)
udelay(1000 * msec);
#elif defined(GEKKO) || defined(__PSL1GHT__) || defined(__QNX__)
usleep(1000 * msec);
#else
struct timespec tv = {0};
tv.tv_sec = msec / 1000;
tv.tv_nsec = (msec % 1000) * 1000000;
nanosleep(&tv, NULL);
#endif
}
/**
* next_pow2:
* @v : initial value
*
* Get next power of 2 value based on initial value.
*
* Returns: next power of 2 value (derived from @v).
**/
static INLINE uint32_t next_pow2(uint32_t v)
{
v--;
v |= v >> 1;
v |= v >> 2;
v |= v >> 4;
v |= v >> 8;
v |= v >> 16;
v++;
return v;
}
/**
* prev_pow2:
* @v : initial value
*
* Get previous power of 2 value based on initial value.
*
* Returns: previous power of 2 value (derived from @v).
**/
static INLINE uint32_t prev_pow2(uint32_t v)
{
v |= v >> 1;
v |= v >> 2;
v |= v >> 4;
v |= v >> 8;
v |= v >> 16;
return v - (v >> 1);
}
/**
* db_to_gain:
* @db : Decibels.
*
* Converts decibels to voltage gain.
*
* Returns: voltage gain value.
**/
static INLINE float db_to_gain(float db)
{
return powf(10.0f, db / 20.0f);
}
/* Helper macros and struct to keep track of many booleans.
* To check for multiple bits, use &&, not &.
* For OR, | can be used. */
typedef struct
{
uint32_t data[8];
} retro_bits_t;
#define BIT_SET(a, bit) ((a)[(bit) >> 3] |= (1 << ((bit) & 7)))
#define BIT_CLEAR(a, bit) ((a)[(bit) >> 3] &= ~(1 << ((bit) & 7)))
#define BIT_GET(a, bit) ((a)[(bit) >> 3] & (1 << ((bit) & 7)))
#define BIT16_SET(a, bit) ((a) |= (1 << ((bit) & 15)))
#define BIT16_CLEAR(a, bit) ((a) &= ~(1 << ((bit) & 15)))
#define BIT16_GET(a, bit) (!!((a) & (1 << ((bit) & 15))))
#define BIT16_CLEAR_ALL(a) ((a) = 0)
#define BIT32_SET(a, bit) ((a) |= (1 << ((bit) & 31)))
#define BIT32_CLEAR(a, bit) ((a) &= ~(1 << ((bit) & 31)))
#define BIT32_GET(a, bit) (!!((a) & (1 << ((bit) & 31))))
#define BIT32_CLEAR_ALL(a) ((a) = 0)
#define BIT64_SET(a, bit) ((a) |= (UINT64_C(1) << ((bit) & 63)))
#define BIT64_CLEAR(a, bit) ((a) &= ~(UINT64_C(1) << ((bit) & 63)))
#define BIT64_GET(a, bit) (!!((a) & (UINT64_C(1) << ((bit) & 63))))
#define BIT64_CLEAR_ALL(a) ((a) = 0)
#define BIT128_SET(a, bit) ((a).data[(bit) >> 5] |= (1 << ((bit) & 31))
#define BIT128_CLEAR(a, bit) ((a).data[(bit) >> 5] &= ~(1 << ((bit) & 31)))
#define BIT128_GET(a, bit) ((a).data[(bit) >> 5] & (1 << ((bit) & 31)))
#define BIT128_CLEAR_ALL(a) memset(&(a), 0, sizeof(a));
#endif

View File

@ -0,0 +1,555 @@
/*
Copyright (C) 2005 Guillaume Duhamel
Copyright (C) 2008-2022 DeSmuME team
This file is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 2 of the License, or
(at your option) any later version.
This file is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with the this software. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef TYPES_HPP
#define TYPES_HPP
#include "retro_miscellaneous.h"
#include "retro_inline.h"
//#include <math/fx.h>
#ifdef __APPLE__
#include <AvailabilityMacros.h>
#endif
//analyze microsoft compilers
#ifdef _MSC_VER
#define HOST_WINDOWS
#endif //_MSC_VER
// Determine CPU architecture for platforms that don't use the autoconf script
#if defined(HOST_WINDOWS) || defined(DESMUME_COCOA)
#if defined(__x86_64__) || defined(__LP64) || defined(__IA64__) || defined(_M_X64) || defined(_WIN64) || defined(__aarch64__) || defined(_M_ARM64) || defined(__ppc64__)
#define HOST_64
#else
#define HOST_32
#endif
#endif
//enforce a constraint: gdb stub requires developer
#if defined(GDB_STUB) && !defined(DEVELOPER)
#define DEVELOPER
#endif
#ifdef DEVELOPER
#define IF_DEVELOPER(X) X
#else
#define IF_DEVELOPER(X)
#endif
#ifdef __GNUC__
// Our AltiVec code assumes that its being run on a big-endian system. While
// the ppcle and ppc64le architectures do exist, our AltiVec code does not
// support little-endian right now.
#if defined(__ALTIVEC__) && defined(MSB_FIRST) && (MSB_FIRST > 0)
#define ENABLE_ALTIVEC
#endif
// For now, we'll be starting off with only using NEON-A64 for easier testing
// and development. If the development for A64 goes well and if an A32 backport
// is discovered to be feasible, then we may explore backporting the NEON code
// to A32 at a later date.
#if (defined(__ARM_NEON__) || defined(__ARM_NEON)) && (defined(__aarch64__) || defined(_M_ARM64))
#define ENABLE_NEON_A64
#endif
#ifdef __SSE__
#define ENABLE_SSE
#endif
#ifdef __SSE2__
#define ENABLE_SSE2
#endif
#ifdef __SSE3__
#define ENABLE_SSE3
#endif
#ifdef __SSSE3__
#define ENABLE_SSSE3
#endif
#ifdef __SSE4_1__
#define ENABLE_SSE4_1
#endif
#ifdef __SSE4_2__
#define ENABLE_SSE4_2
#endif
#ifdef __AVX__
#define ENABLE_AVX
#endif
#ifdef __AVX2__
#define ENABLE_AVX2
#endif
// AVX-512 is special because it has multiple tiers of support.
//
// For our case, Tier-0 will be the baseline AVX-512 tier that includes the basic Foundation and
// Conflict Detection extensions, which should be supported on all AVX-512 CPUs. Higher tiers
// include more extensions, where each higher tier also assumes support for all lower tiers.
//
// For typical use cases in DeSmuME, the most practical AVX-512 tier will be Tier-1.
#if defined(__AVX512F__) && defined(__AVX512CD__)
#define ENABLE_AVX512_0
#endif
#if defined(ENABLE_AVX512_0) && defined(__AVX512BW__) && defined(__AVX512DQ__) && !defined(FORCE_AVX512_0)
#define ENABLE_AVX512_1
#endif
#if defined(ENABLE_AVX512_1) && defined(__AVX512IFMA__) && defined(__AVX512VBMI__)
#define ENABLE_AVX512_2
#endif
#if defined(ENABLE_AVX512_2) && defined(__AVX512VNNI__) && defined(__AVX512VBMI2__) && defined(__AVX512BITALG__)
#define ENABLE_AVX512_3
#endif
#endif
#ifdef _MSC_VER
#include <compat/msvc.h>
#else
#define WINAPI
#endif
#if !defined(MAX_PATH)
#if defined(HOST_WINDOWS)
#define MAX_PATH 260
#elif defined(__GNUC__)
#include <limits.h>
#if !defined(PATH_MAX)
#define MAX_PATH 1024
#else
#define MAX_PATH PATH_MAX
#endif
#else
#define MAX_PATH 1024
#endif
#endif
//------------alignment macros-------------
//dont apply these to types without further testing. it only works portably here on declarations of variables
//cant we find a pattern other people use more successfully?
#if _MSC_VER >= 9999 // Was 1900. The way we use DS_ALIGN doesn't jive with how alignas() wants itself to be used, so just use __declspec(align(X)) for now to avoid problems.
#define DS_ALIGN(X) alignas(X)
#elif defined(_MSC_VER) || defined(__INTEL_COMPILER)
#define DS_ALIGN(X) __declspec(align(X))
#elif defined(__GNUC__)
#define DS_ALIGN(X) __attribute__ ((aligned (X)))
#else
#define DS_ALIGN(X)
#endif
#ifdef HOST_64
#define CACHE_ALIGN_SIZE 64
#else
#define CACHE_ALIGN_SIZE 32
#endif
//use this for example when you want a byte value to be better-aligned
#define CACHE_ALIGN DS_ALIGN(CACHE_ALIGN_SIZE)
#define FAST_ALIGN DS_ALIGN(4)
//---------------------------------------------
#ifdef __MINGW32__
#define FASTCALL __attribute__((fastcall))
#define ASMJIT_CALL_CONV kX86FuncConvGccFastCall
#elif defined (__i386__) && !defined(__clang__)
#define FASTCALL __attribute__((regparm(3)))
#define ASMJIT_CALL_CONV kX86FuncConvGccRegParm3
#elif defined(_MSC_VER) || defined(__INTEL_COMPILER)
#define FASTCALL
#define ASMJIT_CALL_CONV kX86FuncConvDefault
#else
#define FASTCALL
#define ASMJIT_CALL_CONV kX86FuncConvDefault
#endif
#ifdef _MSC_VER
#define _CDECL_ __cdecl
#else
#define _CDECL_
#endif
#ifndef FORCEINLINE
#if defined(_MSC_VER) || defined(__INTEL_COMPILER)
#define FORCEINLINE __forceinline
#define MSC_FORCEINLINE __forceinline
#else
#define FORCEINLINE inline __attribute__((always_inline))
#define MSC_FORCEINLINE
#endif
#endif
#ifndef NOINLINE
#ifdef __GNUC__
#define NOINLINE __attribute__((noinline))
#else
#define NOINLINE
#endif
#endif
#ifndef LOOPVECTORIZE_DISABLE
#if defined(_MSC_VER)
#if _MSC_VER >= 1700
#define LOOPVECTORIZE_DISABLE loop(no_vector)
#else
#define LOOPVECTORIZE_DISABLE
#endif
#elif defined(__clang__)
#define LOOPVECTORIZE_DISABLE clang loop vectorize(disable)
#else
#define LOOPVECTORIZE_DISABLE
#endif
#endif
#if defined(__LP64__)
typedef unsigned char u8;
typedef unsigned short u16;
typedef unsigned int u32;
typedef unsigned long long u64;
typedef signed char s8;
typedef signed short s16;
typedef signed int s32;
typedef signed long long s64;
#else
typedef unsigned char u8;
typedef unsigned short u16;
typedef unsigned int u32;
#if defined(_MSC_VER) || defined(__INTEL_COMPILER)
typedef unsigned __int64 u64;
#else
typedef unsigned long long u64;
#endif
typedef signed char s8;
typedef signed short s16;
typedef signed int s32;
#if defined(_MSC_VER) || defined(__INTEL_COMPILER)
typedef __int64 s64;
#else
typedef signed long long s64;
#endif
#endif
typedef u8 uint8;
typedef u16 uint16;
#ifndef OBJ_C
typedef u32 uint32;
#else
#define uint32 u32 //uint32 is defined in Leopard somewhere, avoid conflicts
#endif
#ifdef ENABLE_ALTIVEC
#ifndef __APPLE_ALTIVEC__
#include <altivec.h>
#endif
typedef __vector unsigned char v128u8;
typedef __vector signed char v128s8;
typedef __vector unsigned short v128u16;
typedef __vector signed short v128s16;
typedef __vector unsigned int v128u32;
typedef __vector signed int v128s32;
#endif
#ifdef ENABLE_NEON_A64
#include <arm_neon.h>
typedef uint8x16_t v128u8;
typedef int8x16_t v128s8;
typedef uint16x8_t v128u16;
typedef int16x8_t v128s16;
typedef uint32x4_t v128u32;
typedef int32x4_t v128s32;
#endif
#ifdef ENABLE_SSE2
#include <emmintrin.h>
typedef __m128i v128u8;
typedef __m128i v128s8;
typedef __m128i v128u16;
typedef __m128i v128s16;
typedef __m128i v128u32;
typedef __m128i v128s32;
#endif
#if defined(ENABLE_AVX) || defined(ENABLE_AVX512_0)
#include <immintrin.h>
typedef __m256i v256u8;
typedef __m256i v256s8;
typedef __m256i v256u16;
typedef __m256i v256s16;
typedef __m256i v256u32;
typedef __m256i v256s32;
#if defined(ENABLE_AVX512_0)
typedef __m512i v512u8;
typedef __m512i v512s8;
typedef __m512i v512u16;
typedef __m512i v512s16;
typedef __m512i v512u32;
typedef __m512i v512s32;
#endif
#endif // defined(ENABLE_AVX) || defined(ENABLE_AVX512_0)
/*---------- GPU3D fixed-points types -----------*/
typedef s32 f32;
#define inttof32(n) ((n) << 12)
#define f32toint(n) ((n) >> 12)
#define floattof32(n) ((int32)((n) * (1 << 12)))
#define f32tofloat(n) (((float)(n)) / (float)(1<<12))
typedef s16 t16;
#define f32tot16(n) ((t16)(n >> 8))
#define inttot16(n) ((n) << 4)
#define t16toint(n) ((n) >> 4)
#define floattot16(n) ((t16)((n) * (1 << 4)))
#define t16ofloat(n) (((float)(n)) / (float)(1<<4))
typedef s16 v16;
#define inttov16(n) ((n) << 12)
#define f32tov16(n) (n)
#define floattov16(n) ((v16)((n) * (1 << 12)))
#define v16toint(n) ((n) >> 12)
#define v16tofloat(n) (((float)(n)) / (float)(1<<12))
typedef s16 v10;
#define inttov10(n) ((n) << 9)
#define f32tov10(n) ((v10)(n >> 3))
#define v10toint(n) ((n) >> 9)
#define floattov10(n) ((v10)((n) * (1 << 9)))
#define v10tofloat(n) (((float)(n)) / (float)(1<<9))
/*----------------------*/
//#ifndef OBJ_C
//typedef int BOOL;
//#else
//apple also defines BOOL
typedef int desmume_BOOL;
#define BOOL desmume_BOOL
//#endif
#ifndef TRUE
#define TRUE 1
#endif
#ifndef FALSE
#define FALSE 0
#endif
// Atomic functions
#if defined(HOST_WINDOWS)
#include <winnt.h>
//#define atomic_add_32(V,M) InterlockedAddNoFence((volatile LONG *)(V),(LONG)(M)) // Requires Windows 8
inline s32 atomic_add_32(volatile s32 *V, s32 M) { return (s32)(InterlockedExchangeAdd((volatile LONG *)V, (LONG)M) + M); }
inline s32 atomic_add_barrier32(volatile s32 *V, s32 M) { return (s32)(InterlockedExchangeAdd((volatile LONG *)V, (LONG)M) + M); }
//#define atomic_inc_32(V) InterlockedIncrementNoFence((volatile LONG *)(V)) // Requires Windows 8
#define atomic_inc_32(V) _InterlockedIncrement((volatile LONG *)(V))
#define atomic_inc_barrier32(V) _InterlockedIncrement((volatile LONG *)(V))
//#define atomic_dec_32(V) InterlockedDecrementNoFence((volatile LONG *)(V)) // Requires Windows 8
#define atomic_dec_32(V) _InterlockedDecrement((volatile LONG *)(V))
#define atomic_dec_barrier32(V) _InterlockedDecrement((volatile LONG *)(V))
//#define atomic_or_32(V,M) InterlockedOrNoFence((volatile LONG *)(V),(LONG)(M)) // Requires Windows 8
#define atomic_or_32(V,M) _InterlockedOr((volatile LONG *)(V),(LONG)(M))
#define atomic_or_barrier32(V,M) _InterlockedOr((volatile LONG *)(V),(LONG)(M))
//#define atomic_and_32(V,M) InterlockedAndNoFence((volatile LONG *)(V),(LONG)(M)) // Requires Windows 8
#define atomic_and_32(V,M) _InterlockedAnd((volatile LONG *)(V),(LONG)(M))
#define atomic_and_barrier32(V,M) _InterlockedAnd((volatile LONG *)(V),(LONG)(M))
//#define atomic_xor_32(V,M) InterlockedXorNoFence((volatile LONG *)(V),(LONG)(M)) // Requires Windows 8
#define atomic_xor_32(V,M) _InterlockedXor((volatile LONG *)(V),(LONG)(M))
#define atomic_xor_barrier32(V,M) _InterlockedXor((volatile LONG *)(V),(LONG)(M))
inline bool atomic_test_and_set_32(volatile s32 *V, s32 M) { return (_interlockedbittestandset((volatile LONG *)V, (LONG)M)) ? true : false; }
inline bool atomic_test_and_set_barrier32(volatile s32 *V, s32 M) { return (_interlockedbittestandset((volatile LONG *)V, (LONG)M)) ? true : false; }
inline bool atomic_test_and_clear_32(volatile s32 *V, s32 M) { return (_interlockedbittestandreset((volatile LONG *)V, (LONG)M)) ? true : false; }
inline bool atomic_test_and_clear_barrier32(volatile s32 *V, s32 M) { return (_interlockedbittestandreset((volatile LONG *)V, (LONG)M)) ? true : false; }
//#elif defined(DESMUME_COCOA) && ( !defined(__clang__) || (__clang_major__ < 9) || !defined(MAC_OS_X_VERSION_10_7) || (MAC_OS_X_VERSION_MIN_REQUIRED < MAC_OS_X_VERSION_10_7) )
#else
#include <libkern/OSAtomic.h>
#define atomic_add_32(V,M) OSAtomicAdd32((M),(V))
#define atomic_add_barrier32(V,M) OSAtomicAdd32Barrier((M),(V))
#define atomic_inc_32(V) OSAtomicIncrement32((V))
#define atomic_inc_barrier32(V) OSAtomicIncrement32Barrier((V))
#define atomic_dec_32(V) OSAtomicDecrement32((V))
#define atomic_dec_barrier32(V) OSAtomicDecrement32Barrier((V))
#define atomic_or_32(V,M) OSAtomicOr32((M),(volatile uint32_t *)(V))
#define atomic_or_barrier32(V,M) OSAtomicOr32Barrier((M),(volatile uint32_t *)(V))
#define atomic_and_32(V,M) OSAtomicAnd32((M),(volatile uint32_t *)(V))
#define atomic_and_barrier32(V,M) OSAtomicAnd32Barrier((M),(volatile uint32_t *)(V))
#define atomic_xor_32(V,M) OSAtomicXor32((M),(volatile uint32_t *)(V))
#define atomic_xor_barrier32(V,M) OSAtomicXor32Barrier((M),(volatile uint32_t *)(V))
#define atomic_test_and_set_32(V,M) OSAtomicTestAndSet((M),(V))
#define atomic_test_and_set_barrier32(V,M) OSAtomicTestAndSetBarrier((M),(V))
#define atomic_test_and_clear_32(V,M) OSAtomicTestAndClear((M),(V))
#define atomic_test_and_clear_barrier32(V,M) OSAtomicTestAndClearBarrier((M),(V))
#endif
/*
#else // Just use C++11 std::atomic
#include <atomic>
inline s32 atomic_add_32(volatile s32 *V, s32 M) { return std::atomic_fetch_add_explicit<s32>((volatile std::atomic<s32> *)V, M, std::memory_order::memory_order_relaxed) + M; }
inline s32 atomic_add_barrier32(volatile s32 *V, s32 M) { return std::atomic_fetch_add_explicit<s32>((volatile std::atomic<s32> *)V, M, std::memory_order::memory_order_seq_cst) + M; }
inline s32 atomic_inc_32(volatile s32 *V) { return atomic_add_32(V, 1); }
inline s32 atomic_inc_barrier32(volatile s32 *V) { return atomic_add_barrier32(V, 1); }
inline s32 atomic_dec_32(volatile s32 *V) { return atomic_add_32(V, -1); }
inline s32 atomic_dec_barrier32(volatile s32 *V) { return atomic_add_barrier32(V, -1); }
inline s32 atomic_or_32(volatile s32 *V, s32 M) { return std::atomic_fetch_or_explicit<s32>((volatile std::atomic<s32> *)V, M, std::memory_order::memory_order_relaxed) | M; }
inline s32 atomic_or_barrier32(volatile s32 *V, s32 M) { return std::atomic_fetch_or_explicit<s32>((volatile std::atomic<s32> *)V, M, std::memory_order::memory_order_seq_cst) | M; }
inline s32 atomic_and_32(volatile s32 *V, s32 M) { return std::atomic_fetch_and_explicit<s32>((volatile std::atomic<s32> *)V, M, std::memory_order::memory_order_relaxed) & M; }
inline s32 atomic_and_barrier32(volatile s32 *V, s32 M) { return std::atomic_fetch_and_explicit<s32>((volatile std::atomic<s32> *)V, M, std::memory_order::memory_order_seq_cst) & M; }
inline s32 atomic_xor_32(volatile s32 *V, s32 M) { return std::atomic_fetch_xor_explicit<s32>((volatile std::atomic<s32> *)V, M, std::memory_order::memory_order_relaxed) ^ M; }
inline s32 atomic_xor_barrier32(volatile s32 *V, s32 M) { return std::atomic_fetch_xor_explicit<s32>((volatile std::atomic<s32> *)V, M, std::memory_order::memory_order_seq_cst) ^ M; }
inline bool atomic_test_and_set_32(volatile s32 *V, s32 M) { return (std::atomic_fetch_or_explicit<s32>((volatile std::atomic<s32> *)V,(0x80>>((M)&0x07)), std::memory_order::memory_order_relaxed) & (0x80>>((M)&0x07))) ? true : false; }
inline bool atomic_test_and_set_barrier32(volatile s32 *V, s32 M) { return (std::atomic_fetch_or_explicit<s32>((volatile std::atomic<s32> *)V,(0x80>>((M)&0x07)), std::memory_order::memory_order_seq_cst) & (0x80>>((M)&0x07))) ? true : false; }
inline bool atomic_test_and_clear_32(volatile s32 *V, s32 M) { return (std::atomic_fetch_and_explicit<s32>((volatile std::atomic<s32> *)V,~(s32)(0x80>>((M)&0x07)), std::memory_order::memory_order_relaxed) & (0x80>>((M)&0x07))) ? true : false; }
inline bool atomic_test_and_clear_barrier32(volatile s32 *V, s32 M) { return (std::atomic_fetch_and_explicit<s32>((volatile std::atomic<s32> *)V,~(s32)(0x80>>((M)&0x07)), std::memory_order::memory_order_seq_cst) & (0x80>>((M)&0x07))) ? true : false; }
#endif
*/
// Flags used to determine how a conversion function swaps bytes for big-endian systems.
// These flags should be ignored on little-endian systems.
enum BESwapFlags
{
BESwapNone = 0x00, // No byte swapping for both incoming and outgoing data. All data is used as-is.
BESwapIn = 0x01, // All incoming data is byte swapped; outgoing data is used as-is.
BESwapPre = 0x01, // An alternate name for "BESwapIn"
BESwapSrc = 0x01, // An alternate name for "BESwapIn"
BESwapOut = 0x02, // All incoming data is used as-is; outgoing data is byte swapped.
BESwapPost = 0x02, // An alternate name for "BESwapOut"
BESwapDst = 0x02, // An alternate name for "BESwapOut"
BESwapInOut = 0x03, // Both incoming data and outgoing data are byte swapped.
BESwapPrePost = 0x03, // An alternate name for "BESwapInOut"
BESwapSrcDst = 0x03 // An alternate name for "BESwapInOut"
};
/* little endian (ds' endianess) to local endianess convert macros */
#ifdef MSB_FIRST /* local arch is big endian */
# define LE_TO_LOCAL_16(x) ((((x)&0xff)<<8)|(((x)>>8)&0xff))
# define LE_TO_LOCAL_32(x) ((((x)&0xff)<<24)|(((x)&0xff00)<<8)|(((x)>>8)&0xff00)|(((x)>>24)&0xff))
# define LE_TO_LOCAL_64(x) ((((x)&0xff)<<56)|(((x)&0xff00)<<40)|(((x)&0xff0000)<<24)|(((x)&0xff000000)<<8)|(((x)>>8)&0xff000000)|(((x)>>24)&0xff0000)|(((x)>>40)&0xff00)|(((x)>>56)&0xff))
# define LOCAL_TO_LE_16(x) ((((x)&0xff)<<8)|(((x)>>8)&0xff))
# define LOCAL_TO_LE_32(x) ((((x)&0xff)<<24)|(((x)&0xff00)<<8)|(((x)>>8)&0xff00)|(((x)>>24)&0xff))
# define LOCAL_TO_LE_64(x) ((((x)&0xff)<<56)|(((x)&0xff00)<<40)|(((x)&0xff0000)<<24)|(((x)&0xff000000)<<8)|(((x)>>8)&0xff000000)|(((x)>>24)&0xff0000)|(((x)>>40)&0xff00)|(((x)>>56)&0xff))
#else /* local arch is little endian */
# define LE_TO_LOCAL_16(x) (x)
# define LE_TO_LOCAL_32(x) (x)
# define LE_TO_LOCAL_64(x) (x)
# define LOCAL_TO_LE_16(x) (x)
# define LOCAL_TO_LE_32(x) (x)
# define LOCAL_TO_LE_64(x) (x)
#endif
// kilobytes and megabytes macro
#define MB(x) ((x)*1024*1024)
#define KB(x) ((x)*1024)
//fairly standard for loop macros
#define MACRODO1(TRICK,TODO) { const size_t X = TRICK; TODO; }
#define MACRODO2(X,TODO) { MACRODO1((X),TODO) MACRODO1(((X)+1),TODO) }
#define MACRODO4(X,TODO) { MACRODO2((X),TODO) MACRODO2(((X)+2),TODO) }
#define MACRODO8(X,TODO) { MACRODO4((X),TODO) MACRODO4(((X)+4),TODO) }
#define MACRODO16(X,TODO) { MACRODO8((X),TODO) MACRODO8(((X)+8),TODO) }
#define MACRODO32(X,TODO) { MACRODO16((X),TODO) MACRODO16(((X)+16),TODO) }
#define MACRODO64(X,TODO) { MACRODO32((X),TODO) MACRODO32(((X)+32),TODO) }
#define MACRODO128(X,TODO) { MACRODO64((X),TODO) MACRODO64(((X)+64),TODO) }
#define MACRODO256(X,TODO) { MACRODO128((X),TODO) MACRODO128(((X)+128),TODO) }
//this one lets you loop any number of times (as long as N<256)
#define MACRODO_N(N,TODO) {\
if((N)&0x100) MACRODO256(0,TODO); \
if((N)&0x080) MACRODO128((N)&(0x100),TODO); \
if((N)&0x040) MACRODO64((N)&(0x100|0x080),TODO); \
if((N)&0x020) MACRODO32((N)&(0x100|0x080|0x040),TODO); \
if((N)&0x010) MACRODO16((N)&(0x100|0x080|0x040|0x020),TODO); \
if((N)&0x008) MACRODO8((N)&(0x100|0x080|0x040|0x020|0x010),TODO); \
if((N)&0x004) MACRODO4((N)&(0x100|0x080|0x040|0x020|0x010|0x008),TODO); \
if((N)&0x002) MACRODO2((N)&(0x100|0x080|0x040|0x020|0x010|0x008|0x004),TODO); \
if((N)&0x001) MACRODO1((N)&(0x100|0x080|0x040|0x020|0x010|0x008|0x004|0x002),TODO); \
}
//---------------------------
//Binary constant generator macro By Tom Torfs - donated to the public domain
//turn a numeric literal into a hex constant
//(avoids problems with leading zeroes)
//8-bit constants max value 0x11111111, always fits in unsigned long
#define HEX__(n) 0x##n##LU
//8-bit conversion function
#define B8__(x) ((x&0x0000000FLU)?1:0) \
+((x&0x000000F0LU)?2:0) \
+((x&0x00000F00LU)?4:0) \
+((x&0x0000F000LU)?8:0) \
+((x&0x000F0000LU)?16:0) \
+((x&0x00F00000LU)?32:0) \
+((x&0x0F000000LU)?64:0) \
+((x&0xF0000000LU)?128:0)
//for upto 8-bit binary constants
#define B8(d) ((unsigned char)B8__(HEX__(d)))
// for upto 16-bit binary constants, MSB first
#define B16(dmsb,dlsb) (((unsigned short)B8(dmsb)<<8) \
+ B8(dlsb))
// for upto 32-bit binary constants, MSB first */
#define B32(dmsb,db2,db3,dlsb) (((unsigned long)B8(dmsb)<<24) \
+ ((unsigned long)B8(db2)<<16) \
+ ((unsigned long)B8(db3)<<8) \
+ B8(dlsb))
//Sample usage:
//B8(01010101) = 85
//B16(10101010,01010101) = 43605
//B32(10000000,11111111,10101010,01010101) = 2164238933
//---------------------------
#ifndef CTASSERT
#define CTASSERT(x) typedef char __assert ## y[(x) ? 1 : -1]
#endif
template<typename T> inline void reconstruct(T* t) {
t->~T();
new(t) T();
}
#endif

View File

@ -0,0 +1,258 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>Game Title</key>
<dict>
<key>type</key>
<string>string</string>
<key>size</key>
<integer>12</integer>
<key>offset</key>
<integer>0</integer>
</dict>
<key>Gamecode</key>
<dict>
<key>type</key>
<string>string</string>
<key>size</key>
<integer>4</integer>
<key>offset</key>
<integer>12</integer>
</dict>
<key>Makercode</key>
<dict>
<key>type</key>
<string>string</string>
<key>size</key>
<integer>2</integer>
<key>offset</key>
<integer>16</integer>
</dict>
<key>Unitcode</key>
<dict>
<key>type</key>
<string>hex</string>
<key>size</key>
<integer>1</integer>
<key>offset</key>
<integer>18</integer>
</dict>
<key>Encryption Seed Select</key>
<dict>
<key>type</key>
<string>hex</string>
<key>size</key>
<integer>1</integer>
<key>offset</key>
<integer>19</integer>
</dict>
<key>Devicecapacity</key>
<dict>
<key>type</key>
<string>hex</string>
<key>size</key>
<integer>1</integer>
<key>offset</key>
<integer>20</integer>
</dict>
<key>Reserved</key>
<dict>
<key>type</key>
<string>hex</string>
<key>size</key>
<integer>7</integer>
<key>offset</key>
<integer>21</integer>
</dict>
<key>Header CRC-16</key>
<dict>
<key>type</key>
<string>hex</string>
<key>size</key>
<integer>2</integer>
<key>offset</key>
<integer>350</integer>
</dict>
<key>Secure Area CRC-16</key>
<dict>
<key>type</key>
<string>hex</string>
<key>size</key>
<integer>2</integer>
<key>offset</key>
<integer>108</integer>
</dict>
<key>NDS Region</key>
<dict>
<key>type</key>
<string>hex</string>
<key>size</key>
<integer>1</integer>
<key>offset</key>
<integer>29</integer>
</dict>
<key>ROM Version</key>
<dict>
<key>type</key>
<string>hex</string>
<key>size</key>
<integer>1</integer>
<key>offset</key>
<integer>30</integer>
</dict>
<key>Autostart</key>
<dict>
<key>type</key>
<string>hex</string>
<key>size</key>
<integer>1</integer>
<key>offset</key>
<integer>31</integer>
</dict>
<key>ARM9 ROM Offset</key>
<dict>
<key>type</key>
<string>hex</string>
<key>size</key>
<integer>4</integer>
<key>offset</key>
<integer>32</integer>
</dict>
<key>ARM9 Entry Address</key>
<dict>
<key>type</key>
<string>hex</string>
<key>size</key>
<integer>4</integer>
<key>offset</key>
<integer>36</integer>
</dict>
<key>ARM9 RAM Address</key>
<dict>
<key>type</key>
<string>hex</string>
<key>size</key>
<integer>4</integer>
<key>offset</key>
<integer>40</integer>
</dict>
<key>ARM9 ROM Size</key>
<dict>
<key>type</key>
<string>hex</string>
<key>size</key>
<integer>4</integer>
<key>offset</key>
<integer>44</integer>
</dict>
<key>ARM7 ROM Offset</key>
<dict>
<key>type</key>
<string>hex</string>
<key>size</key>
<integer>4</integer>
<key>offset</key>
<integer>48</integer>
</dict>
<key>ARM7 Entry Address</key>
<dict>
<key>type</key>
<string>hex</string>
<key>size</key>
<integer>4</integer>
<key>offset</key>
<integer>52</integer>
</dict>
<key>ARM7 RAM Address</key>
<dict>
<key>type</key>
<string>hex</string>
<key>size</key>
<integer>4</integer>
<key>offset</key>
<integer>56</integer>
</dict>
<key>ARM7 ROM Size</key>
<dict>
<key>type</key>
<string>hex</string>
<key>size</key>
<integer>4</integer>
<key>offset</key>
<integer>60</integer>
</dict>
<key>Icon / Title Offset </key>
<dict>
<key>type</key>
<string>hex</string>
<key>size</key>
<integer>4</integer>
<key>offset</key>
<integer>104</integer>
</dict>
<key>File Name Table (FNT) offset</key>
<dict>
<key>type</key>
<string>hex</string>
<key>size</key>
<integer>4</integer>
<key>offset</key>
<integer>64</integer>
</dict>
<key>File Name Table (FNT) size</key>
<dict>
<key>type</key>
<string>hex</string>
<key>size</key>
<integer>4</integer>
<key>offset</key>
<integer>68</integer>
</dict>
<key>File Allocation Table (FAT) offset</key>
<dict>
<key>type</key>
<string>hex</string>
<key>size</key>
<integer>4</integer>
<key>offset</key>
<integer>72</integer>
</dict>
<key>File Allocation Table (FAT) size</key>
<dict>
<key>type</key>
<string>hex</string>
<key>size</key>
<integer>4</integer>
<key>offset</key>
<integer>76</integer>
</dict>
<key>Title ID Emagcode</key>
<dict>
<key>type</key>
<string>string</string>
<key>size</key>
<integer>4</integer>
<key>offset</key>
<integer>560</integer>
</dict>
<key>Title ID Filetype</key>
<dict>
<key>type</key>
<string>hex</string>
<key>size</key>
<integer>1</integer>
<key>offset</key>
<integer>564</integer>
</dict>
<key>Reserved NDS / DSi Flags</key>
<dict>
<key>type</key>
<string>hex</string>
<key>size</key>
<integer>1</integer>
<key>offset</key>
<integer>28</integer>
</dict>
</dict>
</plist>

View File

@ -0,0 +1,24 @@
//
// PreferencePane.h
// FSCHMasterEditor
//
// Created by Dylan Laws on 9/17/22.
//
#import <Cocoa/Cocoa.h>
NS_ASSUME_NONNULL_BEGIN
@interface PreferencePane : NSWindowController
@property (strong) IBOutlet NSColorWell *colorPickerA;
@property (strong) IBOutlet NSColorWell *colorPickerB;
@property (strong) IBOutlet NSColorWell *colorPickerC;
@property (strong) IBOutlet NSColorWell *colorPickerD;
@property (strong) IBOutlet NSTextField *bytesToReadField;
- (IBAction)selectColor:(id)sender;
@end
NS_ASSUME_NONNULL_END

View File

@ -0,0 +1,77 @@
//
// PreferencePane.m
// FSCHMasterEditor
//
// Created by Dylan Laws on 9/17/22.
//
#import "PreferencePane.h"
#import "PreferencesManager.h"
@interface PreferencePane () {
NSColor *selectedColorA;
NSColor *selectedColorB;
NSColor *selectedColorC;
NSColor *selectedColorD;
NSInteger bytesToRead;
PreferencesManager *prefsManager;
}
@end
@implementation PreferencePane
- (void)windowDidLoad {
[super windowDidLoad];
prefsManager = [PreferencesManager sharedManager];
[self loadPrefs];
// Implement this method to handle any initialization after your window controller's window has been loaded from its nib file.
}
- (NSString *)windowNibName
{
return @"PreferencePane";
}
- (IBAction)selectColor:(id)sender {
if (sender == self.colorPickerA) {
selectedColorA = self.colorPickerA.color;
} else if (sender == self.colorPickerB) {
selectedColorB = self.colorPickerB.color;
} else if (sender == self.colorPickerC) {
selectedColorC = self.colorPickerC.color;
} else if (sender == self.colorPickerD) {
selectedColorD = self.colorPickerD.color;
}
}
- (IBAction)savePrefs:(id)sender {
selectedColorA = self.colorPickerA.color;
selectedColorB = self.colorPickerB.color;
selectedColorC = self.colorPickerC.color;
selectedColorD = self.colorPickerD.color;
[prefsManager setGradientColorArray:[NSArray arrayWithObjects:selectedColorA, selectedColorB, selectedColorC, selectedColorD, nil]];
[prefsManager saveNumberOfHeaderBytesToRead:[[self bytesToReadField] integerValue]];
}
- (void)loadPrefs {
bytesToRead = [prefsManager bytesToRead];
if (bytesToRead == 0) {
[prefsManager saveNumberOfHeaderBytesToRead:1024];
[[self bytesToReadField] setStringValue:@"1024"];
} else {
[[self bytesToReadField] setStringValue:[NSString stringWithFormat:@"%li", (long)bytesToRead]];
}
NSArray *colorArry = [prefsManager gradientColors];
selectedColorA = [colorArry objectAtIndex:0];
selectedColorB = [colorArry objectAtIndex:1];
selectedColorC = [colorArry objectAtIndex:2];
selectedColorD = [colorArry objectAtIndex:3];
self.colorPickerA.color = selectedColorA;
self.colorPickerB.color = selectedColorB;
self.colorPickerC.color = selectedColorC;
self.colorPickerD.color = selectedColorD;
}
@end

View File

@ -0,0 +1,158 @@
<?xml version="1.0" encoding="UTF-8"?>
<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="21225" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none" useAutolayout="YES" customObjectInstantitationMethod="direct">
<dependencies>
<deployment identifier="macosx"/>
<plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="21225"/>
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
</dependencies>
<objects>
<customObject id="-2" userLabel="File's Owner" customClass="PreferencePane">
<connections>
<outlet property="bytesToReadField" destination="Flo-4k-Ga2" id="MyI-Od-lrQ"/>
<outlet property="colorPickerA" destination="u7O-wz-3ec" id="fhd-jJ-D3q"/>
<outlet property="colorPickerB" destination="LvT-mB-dYB" id="jOu-3O-GlB"/>
<outlet property="colorPickerC" destination="GcY-On-owf" id="p4g-Lp-KUM"/>
<outlet property="colorPickerD" destination="Wub-31-DQz" id="13I-ui-5Gs"/>
<outlet property="window" destination="F0z-JX-Cv5" id="gIp-Ho-8D9"/>
</connections>
</customObject>
<customObject id="-1" userLabel="First Responder" customClass="FirstResponder"/>
<customObject id="-3" userLabel="Application" customClass="NSObject"/>
<window title="Settings" allowsToolTipsWhenApplicationIsInactive="NO" autorecalculatesKeyViewLoop="NO" releasedWhenClosed="NO" animationBehavior="default" titlebarAppearsTransparent="YES" id="F0z-JX-Cv5">
<windowStyleMask key="styleMask" titled="YES" closable="YES" miniaturizable="YES" resizable="YES"/>
<windowPositionMask key="initialPositionMask" leftStrut="YES" rightStrut="YES" topStrut="YES" bottomStrut="YES"/>
<rect key="contentRect" x="196" y="240" width="480" height="270"/>
<rect key="screenRect" x="0.0" y="0.0" width="1920" height="1175"/>
<view key="contentView" id="se5-gp-TjO">
<rect key="frame" x="0.0" y="0.0" width="480" height="270"/>
<autoresizingMask key="autoresizingMask"/>
<subviews>
<tabView fixedFrame="YES" drawsBackground="NO" translatesAutoresizingMaskIntoConstraints="NO" id="h6A-TR-Acx">
<rect key="frame" x="3" y="30" width="475" height="246"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
<font key="font" metaFont="system"/>
<tabViewItems>
<tabViewItem label="Hex View" identifier="" id="3hD-Kt-uiO">
<view key="view" id="TBh-zp-LH9">
<rect key="frame" x="10" y="33" width="455" height="200"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<subviews>
<colorWell fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="u7O-wz-3ec">
<rect key="frame" x="82" y="174" width="44" height="23"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
<color key="color" red="0.05813049898" green="0.055541899059999997" blue="1" alpha="1" colorSpace="calibratedRGB"/>
<connections>
<action selector="selectColor:" target="-2" id="eTV-m8-YQu"/>
</connections>
</colorWell>
<textField horizontalHuggingPriority="251" verticalHuggingPriority="750" fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="cGX-Ma-RFU">
<rect key="frame" x="21" y="178" width="55" height="16"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
<textFieldCell key="cell" lineBreakMode="clipping" title="Color #1" id="Vob-oC-l4O">
<font key="font" usesAppearanceFont="YES"/>
<color key="textColor" name="labelColor" catalog="System" colorSpace="catalog"/>
<color key="backgroundColor" name="textBackgroundColor" catalog="System" colorSpace="catalog"/>
</textFieldCell>
</textField>
<colorWell fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="LvT-mB-dYB">
<rect key="frame" x="82" y="147" width="44" height="23"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
<color key="color" red="0.5935948170772215" green="0.055541899059999997" blue="0.14925732255792942" alpha="1" colorSpace="calibratedRGB"/>
<connections>
<action selector="selectColor:" target="-2" id="92z-wf-GWQ"/>
</connections>
</colorWell>
<textField horizontalHuggingPriority="251" verticalHuggingPriority="750" fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="mOO-JC-9ru">
<rect key="frame" x="21" y="151" width="56" height="16"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
<textFieldCell key="cell" lineBreakMode="clipping" title="Color #2" id="it6-Xh-J7N">
<font key="font" usesAppearanceFont="YES"/>
<color key="textColor" name="labelColor" catalog="System" colorSpace="catalog"/>
<color key="backgroundColor" name="textBackgroundColor" catalog="System" colorSpace="catalog"/>
</textFieldCell>
</textField>
<colorWell fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="GcY-On-owf">
<rect key="frame" x="82" y="120" width="44" height="23"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
<color key="color" red="0.05813049898" green="0.055541899059999997" blue="1" alpha="1" colorSpace="calibratedRGB"/>
<connections>
<action selector="selectColor:" target="-2" id="yEl-Y0-ceG"/>
</connections>
</colorWell>
<textField horizontalHuggingPriority="251" verticalHuggingPriority="750" fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="4xW-gt-2Le">
<rect key="frame" x="21" y="124" width="57" height="16"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
<textFieldCell key="cell" lineBreakMode="clipping" title="Color #3" id="631-1K-OBa">
<font key="font" usesAppearanceFont="YES"/>
<color key="textColor" name="labelColor" catalog="System" colorSpace="catalog"/>
<color key="backgroundColor" name="textBackgroundColor" catalog="System" colorSpace="catalog"/>
</textFieldCell>
</textField>
<colorWell fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="Wub-31-DQz">
<rect key="frame" x="82" y="93" width="44" height="23"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
<color key="color" red="0.59359481709999995" green="0.055541899059999997" blue="0.14925732259999999" alpha="1" colorSpace="calibratedRGB"/>
<connections>
<action selector="selectColor:" target="-2" id="ZpB-6j-7Qx"/>
</connections>
</colorWell>
<textField horizontalHuggingPriority="251" verticalHuggingPriority="750" fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="YJo-Bi-gbq">
<rect key="frame" x="21" y="97" width="57" height="16"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
<textFieldCell key="cell" lineBreakMode="clipping" title="Color #4" id="Qtd-Mi-X6l">
<font key="font" usesAppearanceFont="YES"/>
<color key="textColor" name="labelColor" catalog="System" colorSpace="catalog"/>
<color key="backgroundColor" name="textBackgroundColor" catalog="System" colorSpace="catalog"/>
</textFieldCell>
</textField>
<textField horizontalHuggingPriority="251" verticalHuggingPriority="750" fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="xT0-zG-oqK">
<rect key="frame" x="163" y="178" width="128" height="16"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
<textFieldCell key="cell" lineBreakMode="clipping" title="Header bytes shown" id="9jK-2o-5iA">
<font key="font" usesAppearanceFont="YES"/>
<color key="textColor" name="labelColor" catalog="System" colorSpace="catalog"/>
<color key="backgroundColor" name="textBackgroundColor" catalog="System" colorSpace="catalog"/>
</textFieldCell>
</textField>
<textField verticalHuggingPriority="750" fixedFrame="YES" textCompletion="NO" translatesAutoresizingMaskIntoConstraints="NO" id="Flo-4k-Ga2">
<rect key="frame" x="165" y="149" width="124" height="21"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
<textFieldCell key="cell" scrollable="YES" lineBreakMode="clipping" selectable="YES" editable="YES" sendsActionOnEndEditing="YES" state="on" borderStyle="bezel" alignment="center" placeholderString="1024" drawsBackground="YES" id="bD7-uc-hrW">
<numberFormatter key="formatter" formatterBehavior="default10_4" numberStyle="decimal" formatWidth="-1" minimumIntegerDigits="1" maximumIntegerDigits="2000000000" maximumFractionDigits="3" id="amR-N0-6aJ"/>
<font key="font" metaFont="system"/>
<color key="textColor" name="controlTextColor" catalog="System" colorSpace="catalog"/>
<color key="backgroundColor" name="textBackgroundColor" catalog="System" colorSpace="catalog"/>
</textFieldCell>
</textField>
</subviews>
</view>
</tabViewItem>
<tabViewItem label="ASCII View" identifier="" id="mIe-Gc-Oix">
<view key="view" id="7dg-NR-VlA">
<rect key="frame" x="10" y="33" width="455" height="200"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
</view>
</tabViewItem>
</tabViewItems>
</tabView>
<button verticalHuggingPriority="750" fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="k1N-Uf-aob">
<rect key="frame" x="206" y="7" width="69" height="23"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
<buttonCell key="cell" type="smallSquare" title="Save" bezelStyle="smallSquare" alignment="center" lineBreakMode="truncatingTail" state="on" borderStyle="border" imageScaling="proportionallyDown" inset="2" id="Owh-xk-4Gg">
<behavior key="behavior" pushIn="YES" lightByBackground="YES" lightByGray="YES"/>
<font key="font" metaFont="system"/>
</buttonCell>
<color key="contentTintColor" name="systemRedColor" catalog="System" colorSpace="catalog"/>
<connections>
<action selector="savePrefs:" target="-2" id="wTd-Yx-8OR"/>
</connections>
</button>
</subviews>
</view>
<connections>
<outlet property="delegate" destination="-2" id="0bl-1N-AYu"/>
</connections>
<point key="canvasLocation" x="139" y="144"/>
</window>
</objects>
</document>

View File

@ -0,0 +1,26 @@
//
// PreferencesManager.h
// FSCHMasterEditor
//
// Created by Dylan Laws on 9/17/22.
//
#import <Foundation/Foundation.h>
#import <Cocoa/Cocoa.h>
NS_ASSUME_NONNULL_BEGIN
@interface PreferencesManager : NSObject
@property (nonatomic, retain) NSArray<NSColor *> *gradientColors;
+ (id)sharedManager;
- (void)setGradientColorArray:(NSArray<NSColor *> *)gradientColors;
- (NSInteger)bytesToRead;
- (void)saveNumberOfHeaderBytesToRead:(NSInteger)num;
@end
NS_ASSUME_NONNULL_END

View File

@ -0,0 +1,58 @@
//
// PreferencesManager.m
// FSCHMasterEditor
//
// Created by Dylan Laws on 9/17/22.
//
#import "PreferencesManager.h"
@implementation PreferencesManager
+ (id)sharedManager {
static PreferencesManager *sharedMyManager = nil;
static dispatch_once_t onceToken;
dispatch_once(&onceToken, ^{
sharedMyManager = [[self alloc] init];
});
return sharedMyManager;
}
- (instancetype)init {
if (self = [super init]) {
if ([self hasPreferencesSaved] == FALSE) {
self.gradientColors = [NSArray arrayWithObjects:[NSColor colorWithRed:25.0f/255.0f green:29.0f/255.0f blue:200.0f/255.0f alpha:1], [NSColor colorWithRed:255/255.0f green:98.0f/255.0f blue:95.0f/255.0f alpha:1], [NSColor colorWithRed:25.0f/255.0f green:29.0f/255.0f blue:200.0f/255.0f alpha:1], [NSColor colorWithRed:255/255.0f green:98.0f/255.0f blue:95.0f/255.0f alpha:1], nil];
NSError *error;
NSData *theData = [NSKeyedArchiver archivedDataWithRootObject:self.gradientColors requiringSecureCoding:NO error:&error];
[[NSUserDefaults standardUserDefaults] setObject:theData forKey:@"gradientColors"];
[[NSUserDefaults standardUserDefaults] setBool:YES forKey:@"prefsInit"];
} else {
NSError *error;
NSData *storedData = [[NSUserDefaults standardUserDefaults] objectForKey:@"gradientColors"];
NSArray *storedArray = [NSKeyedUnarchiver unarchivedArrayOfObjectsOfClass:[NSColor class] fromData:storedData error:&error];
self.gradientColors = storedArray;
}
}
return self;
}
- (BOOL)hasPreferencesSaved {
return [[NSUserDefaults standardUserDefaults] boolForKey:@"prefsInit"];
}
- (void)setGradientColorArray:(NSArray<NSColor *> *)gradientColors {
self.gradientColors = gradientColors;
NSError *error;
NSData *theData = [NSKeyedArchiver archivedDataWithRootObject:self.gradientColors requiringSecureCoding:NO error:&error];
[[NSUserDefaults standardUserDefaults] setObject:theData forKey:@"gradientColors"];
}
- (NSInteger)bytesToRead {
return [[[NSUserDefaults standardUserDefaults] objectForKey:@"bytesToRead"] integerValue];
}
- (void)saveNumberOfHeaderBytesToRead:(NSInteger)num {
[[NSUserDefaults standardUserDefaults] setInteger:num forKey:@"bytesToRead"];
}
@end

BIN
screenshot.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.0 MiB